Commit graph

2186 commits

Author SHA1 Message Date
Jeremy McSpadden
19cbb17683 Merge pull request #3961 from jeremymcs/fix/windows-portability-sweep
fix: harden Windows portability across runtime and tooling
2026-04-10 21:53:10 -05:00
Jeremy
153ed252fe fix(ci): unblock windows portability follow-up 2026-04-10 20:45:51 -05:00
Jeremy
61204ce771 fix(windows): harden portability across runtime and tooling 2026-04-10 20:33:18 -05:00
Jeremy McSpadden
8fcaee6d5a Merge pull request #3885 from mastertyko/fix/3856-doctor-scope-db-unavailable
fix(gsd): surface scoped doctor health warnings
2026-04-10 20:31:47 -05:00
Jeremy McSpadden
b5ffff50ee Merge pull request #3886 from mastertyko/fix/3806-update-registry-version-fallback
fix(update): fetch latest version from registry
2026-04-10 20:31:06 -05:00
Jeremy McSpadden
854ab38498 Merge pull request #3894 from mastertyko/fix/3892-double-backtick-preexec
fix(gsd): handle doubled-backtick pre-exec paths
2026-04-10 20:29:46 -05:00
Jeremy McSpadden
999c2fc576 Merge pull request #3931 from mastertyko/fix/3912-skip-skipped-summaries
fix(gsd): skip skipped slices in milestone prompts
2026-04-10 20:29:27 -05:00
Jeremy
e26c5cff56 fix(auto): use pathToFileURL for cross-platform import and reconcile regression test
Convert resource-loader import path to file URL via pathToFileURL() to
fix Windows ERR_UNSUPPORTED_ESM_URL_SCHEME. Update existing regression
test to validate the GSD_PKG_ROOT + pathToFileURL contract.
2026-04-10 20:05:32 -05:00
Jeremy
7b2601e6a0 fix(auto): resolve resource-loader.js from GSD_PKG_ROOT on resume (#3949)
Auto-mode resume crashed with "Cannot find module" because the relative
import ../../../resource-loader.js only works from the source tree, not
from the deployed path at ~/.gsd/agent/extensions/gsd/auto.js.

Expose GSD_PKG_ROOT from loader.ts and use it in auto.ts to construct
an absolute path to dist/resource-loader.js that works in both contexts.
2026-04-10 20:00:46 -05:00
Jeremy
3c6093cf37 test remove secret-like onboarding fixture 2026-04-10 19:30:38 -05:00
Jeremy
d64056f833 fix claude code mcp elicitation bridge 2026-04-10 19:24:51 -05:00
Jeremy
5a940856c1 fix claude-code discuss question fallback 2026-04-10 19:12:45 -05:00
mastertyko
07da34dadb fix(gsd): surface scoped doctor health warnings 2026-04-11 01:49:05 +02:00
Jeremy
7ee1fa0c46 fix(pi-ai): remove Anthropic OAuth flow for TOS compliance
Delete the Anthropic OAuth module, remove it from the built-in provider
registry, strip the OAuth client branch from the Anthropic streaming
provider, and replace the daemon orchestrator's token refresh with a
simple ANTHROPIC_API_KEY requirement.

Anthropic access is now API key or local Claude Code CLI only.

Closes #3952
2026-04-10 17:33:34 -05:00
Jeremy McSpadden
7a44ca7aed Merge pull request #3948 from jeremymcs/fix/cmux-auto-enable
fix(gsd): auto-enable cmux when detected
2026-04-10 17:16:46 -05:00
Jeremy McSpadden
0575d2cb58 Merge pull request #3946 from jeremymcs/feat/mcp-ask-user-questions-elicitation
feat(mcp-server): expose ask_user_questions via elicitation
2026-04-10 16:58:34 -05:00
Jeremy
6d1e7952a5 test(gsd): accept source workflow MCP module paths 2026-04-10 16:45:09 -05:00
mastertyko
c2de4eb17b fix(gsd): skip skipped slices in milestone prompts 2026-04-10 23:19:25 +02:00
Jeremy
6c2964c502 test(mcp-server): cover ask_user_questions elicitation 2026-04-10 16:14:34 -05:00
Jeremy
28decda937 test(gsd): add regression tests for cmux auto-enable
Covers: successful auto-enable, missing prefs file fallback,
and preservation of existing cmux sub-preferences.
2026-04-10 16:12:35 -05:00
Jeremy
fffec6174a fix(gsd): auto-enable cmux when detected instead of prompting
When running inside a cmux terminal, GSD now automatically enables cmux
in project preferences instead of showing a manual enable prompt. Users
who explicitly disabled cmux (enabled: false) are still respected.

Closes gsd-build/gsd-2#3947
2026-04-10 15:46:36 -05:00
Jeremy
b3275a182d feat(mcp-server): expose ask_user_questions via elicitation 2026-04-10 15:44:08 -05:00
Jeremy McSpadden
4e84196bdb Merge pull request #3941 from jeremymcs/fix/codebase-generator-excludes
fix(gsd): add missing dirs to codebase generator exclude list
2026-04-10 14:17:44 -05:00
Jeremy
89bdc1e7f9 test(gsd): add regression test for .agents/ and tooling dir exclusion
Verifies that .agents/, .bg-shell/, .idea/, .cache/, tmp/, target/,
and venv/ are excluded from the codebase map during generation.
2026-04-10 13:46:53 -05:00
Jeremy
099a7723a3 fix(gsd): add missing directories to codebase generator exclude list
.agents/, .bg-shell/, .idea/, venv/, target/, .cache/, and tmp/ were
missing from DEFAULT_EXCLUDES. This caused /gsd-new-project to scan
skill and agent definition files as project code, confusing researcher
agents during project initialization.

Aligns the exclude list with the gitignore patterns in gitignore.ts.
2026-04-10 13:40:45 -05:00
Jeremy
2ad315b9fb fix(gsd): wire ADR-005 infrastructure into live paths
Addresses Codex adversarial review findings — the ADR-005 registries
and filters were built but not connected to the actual model selection
and provider adapter paths.

Fix 1+2: Tool filtering applied after model selection
- selectAndApplyModel() now calls adjustToolSet() after pi.setModel()
- Incompatible tools are removed via pi.setActiveTools()
- adjust_tool_set hook fires to allow extension overrides
- Verbose output reports filtered tools with provider context

Fix 3: ProviderSwitchReport wired through all 6 provider adapters
- New transformMessagesWithReport() convenience wrapper creates report,
  passes it to transformMessages(), and logs non-empty reports to stderr
  when GSD_VERBOSE=1 or PI_VERBOSE=1
- All adapters updated: anthropic, google, openai-responses,
  openai-completions, mistral, bedrock
2026-04-10 12:49:49 -05:00
Jeremy
b1c0dafc70 feat(gsd): implement ADR-005 multi-model provider and tool strategy
Implements all 4 phases of ADR-005 (issue #2790):

Phase 1: Provider Capabilities Registry
- Declarative ProviderCapabilities interface and PROVIDER_CAPABILITIES
  registry covering all 12 API providers
- Consolidates scattered *-shared.ts knowledge into queryable registry
- Unknown providers get permissive defaults (backward compatible)

Phase 2: Tool Compatibility Metadata
- ToolCompatibility interface (producesImages, schemaFeatures, minCapabilityTier)
- compatibility field on ToolDefinition
- Tool compatibility registry with pre-populated built-in tools
- Auto-registration from registerTool() and MCP tool defaults

Phase 3: Tool-Compat Filter + ProviderSwitchReport
- ProviderSwitchReport tracks thinking blocks dropped/downgraded,
  tool call IDs remapped, synthetic results inserted, thought
  signatures dropped during cross-provider message transformation
- isToolCompatibleWithProvider(), filterToolsForProvider(), adjustToolSet()
  functions in model router
- filteredTools field on RoutingDecision
- Verbose output for filtered tools in auto-model-selection

Phase 4: adjustToolSet Extension Hook
- AdjustToolSetEvent and AdjustToolSetResult interfaces
- emitAdjustToolSet() on ExtensionAPI and ExtensionRuntime
- Default no-op handler in register-hooks.ts

Includes 47 new tests (20 provider caps + 10 switch report + 17 tool compat)

Closes #2790
2026-04-10 12:33:40 -05:00
Jeremy
f96bc91014 feat(gsd): complete ADR-004 capability-aware model routing implementation
Close three remaining gaps from ADR-004:

1. Add modelOverrides to GSDPreferences type — removes unsafe type cast
   in auto-model-selection.ts, enables TypeScript validation for user
   capability override config.

2. Add profile completeness lint test — two tests in capability-router
   that fail if MODEL_CAPABILITY_TIER and MODEL_CAPABILITY_PROFILES
   drift out of sync (catches stale profiles on new model additions).

3. Add capability profiles for all 24 missing tier-mapped models — goes
   from 9 to 33 profiles, organized by provider. Values reflect each
   model family's known strengths (o-series high reasoning, nano/spark
   high speed, codex variants high coding).

Closes #2659
2026-04-10 12:10:29 -05:00
Jeremy
49ef77e40a fix(gsd): replace empty catch with logWarning for CI compliance 2026-04-10 11:50:46 -05:00
Jeremy
a9fc396043 fix(gsd): merge enhanced context sections into standard template, clean up stale gate patterns
- Add Architectural Decisions, Error Handling Strategy, Testing
  Requirements, and Acceptance Criteria sections to context.md so
  discussion investigation output persists for downstream phases
- Remove layer1-4 gate patterns from write-gate.ts (only depth_verification
  remains — the 4-layer gates were only in the deleted discuss-prepared.md)
- Update write-gate tests to use depth_verification fixtures

Follows up on #3934
2026-04-10 11:44:39 -05:00
Jeremy
cc5157e534 fix(gsd): remove broken discuss-prepared template, inject briefs into discuss.md
The discuss-prepared.md template (PR #3602) broke new project init by
presenting codebase analysis as scope recommendations before asking
the user what they want to build. On fresh projects it would invent
project scope from existing files instead of asking "What's the vision?"

- Delete discuss-prepared.md, context-enhanced.md, prompt-validation.ts
- Rewrite prepareAndBuildDiscussPrompt() to inject preparation briefs
  as supplementary context into the standard discuss.md template
- Add {{preparationContext}} placeholder to discuss.md
- Delete 5 test files that only tested removed code
- Keep preparation.ts engine intact — codebase analysis is useful
  background context, just shouldn't drive scope

Fixes #3934
2026-04-10 11:30:10 -05:00
Jeremy
6d9f02054d fix(test): update discord invite test path after docs reorganization
The docs were moved from docs/what-is-pi/ to docs/dev/what-is-pi/ but
the test path was not updated, causing CI to fail with ENOENT.
2026-04-10 10:19:07 -05:00
Jeremy
41d4de1c32 test(gsd): add regression test for resource-loader import path
Verifies auto.ts does not use a relative import reaching above
extensions/ for resource-loader (breaks on deployment to ~/.gsd/).
Guards against regression of the fix for #3899.
2026-04-10 10:13:01 -05:00
Jeremy
02b905f3f5 fix(gsd): resolve resource-loader import for deployed extensions
The relative import `../../../resource-loader.js` in auto.ts works from
the source tree (src/resources/extensions/gsd/ → src/resource-loader.js)
but breaks when extensions are deployed to ~/.gsd/agent/extensions/gsd/
(resolves to ~/.gsd/resource-loader.js which doesn't exist).

Use createRequire to resolve the gsd-pi package root and import
dist/resource-loader.js from there, which works in both source and
deployed contexts.

Regression introduced in #3899 (9ed543f1c8).
2026-04-10 10:05:37 -05:00
Jeremy
be2032794b test: add regression test for wasDbOpenAttempted flag
Verifies the flag returns true after openDatabase() is called and
persists after closeDatabase(), ensuring the "not yet initialized"
vs "genuinely unavailable" distinction works correctly.
2026-04-10 08:19:58 -05:00
Jeremy
96490d269d fix(state): prevent false degraded-mode warning when DB not yet initialized
deriveState() is called during before_agent_start context injection,
before any tool invocation has had a chance to open the DB. Previously,
isDbAvailable() returning false in this path triggered a misleading
"DB unavailable — using filesystem state derivation (degraded mode)"
warning, even though the DB was simply not yet initialized (not failed).

Add a _dbOpenAttempted flag in gsd-db.ts that tracks whether
openDatabase() has been called at least once. The degraded-mode warning
now only fires when the DB was actually attempted and failed to open,
not when it hasn't been initialized yet.

Supersedes #3922.
2026-04-10 08:16:29 -05:00
Jeremy McSpadden
e7e27a8ad3 Merge pull request #1687 from dpearson2699/fix/stale-interrupted-session-resume
fix stale interrupted-session resume prompts
2026-04-10 07:36:47 -05:00
Jeremy McSpadden
56f137860e Merge pull request #3896 from mastertyko/fix/3859-forensics-context-hijack
fix(gsd): stop stale forensics context hijacks
2026-04-10 07:35:59 -05:00
Jeremy McSpadden
ee417db63b Merge pull request #3871 from mastertyko/fix/3868-copyplanningartifacts-samepath
fix(gsd): skip same-path planning artifact copies
2026-04-10 07:34:46 -05:00
Jeremy McSpadden
f6a7c3138f Merge pull request #3898 from mastertyko/fix/3897-verification-not-applicable-emdash
fix(gsd): accept em-dash none verification rationale
2026-04-10 07:34:21 -05:00
Jeremy McSpadden
a250ba92c8 Merge pull request #3899 from mastertyko/fix/3761-resync-resources-on-auto-resume
fix(gsd): resync managed resources on auto resume
2026-04-10 07:34:04 -05:00
Jeremy McSpadden
57c993f806 Merge pull request #3919 from jeremymcs/fix/merge-cwd-guard-parallel
fix: guard autoCommitDirtyState and restore cwd on MergeConflictError
2026-04-10 07:03:03 -05:00
Jeremy McSpadden
2ee5cc6c98 Merge pull request #3921 from jeremymcs/fix/3915-manifest-skipped-slices
fix(gsd): avoid false manifest and skipped-slice warnings
2026-04-10 07:02:29 -05:00
Jeremy
d8c6bd99fa fix(gsd): use debugLog in catch block to satisfy empty-catch lint
The compiled JS strips comments, so the catch body needs real code.
2026-04-10 06:51:35 -05:00
Jeremy
3f1699bdf7 fix(gsd): avoid false manifest and skipped-slice warnings 2026-04-10 06:48:47 -05:00
Jeremy
475bf6cd84 fix(gsd): replace empty catch block with descriptive comment
CI lint rule forbids empty catch blocks in migrated files.
2026-04-10 06:44:18 -05:00
Jeremy
7240b284dd test(gsd): use beforeEach/afterEach per CONTRIBUTING.md test standards
Replace try/finally cleanup with describe + beforeEach/afterEach pattern
and array-join for fixture data per project test conventions.
2026-04-10 06:39:55 -05:00
Jeremy
f6f15ddec6 fix: guard autoCommitDirtyState and restore cwd on MergeConflictError (#2929)
Three fixes to prevent cross-milestone contamination during parallel merge:

1. autoCommitDirtyState branch guard: only auto-commit when cwd is on the
   milestone branch, not the integration branch. Prevents committing dirty
   files from other milestones onto main.

2. process.chdir(previousCwd) before MergeConflictError throw: restores cwd
   so the next merge in a parallel sequence doesn't inherit a leaked cwd.

3. Pre-teardown auto-commit branch guard: skip the safety-net commit when
   cwd is on the integration branch, not the milestone branch.

Supersedes #3130.
2026-04-10 06:38:06 -05:00
Jeremy
ac1a51ef55 fix: Claude Code MCP tool output rendering and real-time streaming
- Stream tool results in real-time during Claude Code SDK sessions
  instead of deferring until session end. Tool calls (read, bash, write,
  etc.) now show their output as they complete, not collapsed as "..."

- Stop suppressing toolcall_start/delta/end events from stream adapter
  so the TUI can render tool call progress during streaming

- On SDK turn boundary (user message with tool results), push synthetic
  toolcall_end events with externalResult attached for immediate rendering

- Chat controller checks for externalResult on toolcall_end message
  updates and calls updateResult on pending ToolExecutionComponents

- Fix case-sensitive tool name matching (Read vs read, Bash vs bash)
  in TUI ToolExecutionComponent rendering

- Auto-discover and pass GSD_WORKFLOW_EXECUTORS_MODULE and
  GSD_WORKFLOW_WRITE_GATE_MODULE env vars in MCP server launch config

- Add /gsd mcp init command and auto-bootstrap .mcp.json for Claude
  Code provider during auto-start

- Add tool_execution_update event type for web UI streaming updates

- Add setStderrLoggingEnabled toggle for workflow logger
2026-04-10 06:12:44 -05:00
Jeremy McSpadden
0c37a88024 Merge pull request #3905 from jeremymcs/fix/workflow-mcp-auto-discovery
Fix workflow MCP auto-discovery for Claude Code auto-mode
2026-04-09 19:01:52 -05:00