@opengsd/gsd-pi 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/package.json +171 -0
- package/packages/contracts/dist/index.d.ts +3 -0
- package/packages/contracts/dist/index.d.ts.map +1 -0
- package/packages/contracts/dist/index.js +5 -0
- package/packages/contracts/dist/index.js.map +1 -0
- package/packages/contracts/dist/rpc.d.ts +549 -0
- package/packages/contracts/dist/rpc.d.ts.map +1 -0
- package/packages/contracts/dist/rpc.js +53 -0
- package/packages/contracts/dist/rpc.js.map +1 -0
- package/packages/contracts/dist/rpc.test.d.ts +2 -0
- package/packages/contracts/dist/rpc.test.d.ts.map +1 -0
- package/packages/contracts/dist/rpc.test.js +54 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -0
- package/packages/contracts/dist/workflow.d.ts +201 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -0
- package/packages/contracts/dist/workflow.js +225 -0
- package/packages/contracts/dist/workflow.js.map +1 -0
- package/packages/contracts/package.json +39 -0
- package/packages/contracts/src/index.ts +5 -0
- package/packages/contracts/src/rpc.test.ts +80 -0
- package/packages/contracts/src/rpc.ts +286 -0
- package/packages/contracts/src/workflow.ts +237 -0
- package/packages/contracts/tsconfig.json +25 -0
- package/packages/daemon/package.json +49 -0
- package/packages/daemon/src/channel-manager.ts +223 -0
- package/packages/daemon/src/cli.ts +96 -0
- package/packages/daemon/src/commands.ts +110 -0
- package/packages/daemon/src/config.ts +137 -0
- package/packages/daemon/src/daemon.test.ts +763 -0
- package/packages/daemon/src/daemon.ts +199 -0
- package/packages/daemon/src/discord-bot.test.ts +792 -0
- package/packages/daemon/src/discord-bot.ts +491 -0
- package/packages/daemon/src/event-bridge.test.ts +620 -0
- package/packages/daemon/src/event-bridge.ts +494 -0
- package/packages/daemon/src/event-formatter.test.ts +401 -0
- package/packages/daemon/src/event-formatter.ts +413 -0
- package/packages/daemon/src/index.ts +55 -0
- package/packages/daemon/src/launchd.test.ts +356 -0
- package/packages/daemon/src/launchd.ts +242 -0
- package/packages/daemon/src/logger.ts +89 -0
- package/packages/daemon/src/message-batcher.test.ts +308 -0
- package/packages/daemon/src/message-batcher.ts +216 -0
- package/packages/daemon/src/orchestrator.test.ts +584 -0
- package/packages/daemon/src/orchestrator.ts +469 -0
- package/packages/daemon/src/project-scanner.test.ts +235 -0
- package/packages/daemon/src/project-scanner.ts +99 -0
- package/packages/daemon/src/session-manager.test.ts +822 -0
- package/packages/daemon/src/session-manager.ts +400 -0
- package/packages/daemon/src/types.ts +184 -0
- package/packages/daemon/src/verbosity.test.ts +171 -0
- package/packages/daemon/src/verbosity.ts +101 -0
- package/packages/daemon/tsconfig.json +24 -0
- package/packages/mcp-server/README.md +275 -0
- package/packages/mcp-server/package.json +53 -0
- package/packages/mcp-server/src/alias-telemetry.test.ts +78 -0
- package/packages/mcp-server/src/alias-telemetry.ts +30 -0
- package/packages/mcp-server/src/cli.ts +70 -0
- package/packages/mcp-server/src/env-writer.test.ts +433 -0
- package/packages/mcp-server/src/env-writer.ts +292 -0
- package/packages/mcp-server/src/import-candidates.test.ts +53 -0
- package/packages/mcp-server/src/index.ts +43 -0
- package/packages/mcp-server/src/mcp-server.test.ts +1395 -0
- package/packages/mcp-server/src/parse-workflow-args.test.ts +80 -0
- package/packages/mcp-server/src/readers/captures.ts +119 -0
- package/packages/mcp-server/src/readers/doctor-lite.ts +225 -0
- package/packages/mcp-server/src/readers/graph.test.ts +679 -0
- package/packages/mcp-server/src/readers/graph.ts +863 -0
- package/packages/mcp-server/src/readers/index.ts +28 -0
- package/packages/mcp-server/src/readers/knowledge.ts +111 -0
- package/packages/mcp-server/src/readers/metrics.ts +118 -0
- package/packages/mcp-server/src/readers/paths.test.ts +67 -0
- package/packages/mcp-server/src/readers/paths.ts +334 -0
- package/packages/mcp-server/src/readers/readers.test.ts +513 -0
- package/packages/mcp-server/src/readers/roadmap.ts +263 -0
- package/packages/mcp-server/src/readers/state.ts +223 -0
- package/packages/mcp-server/src/remote-questions.test.ts +397 -0
- package/packages/mcp-server/src/remote-questions.ts +967 -0
- package/packages/mcp-server/src/secure-env-collect.test.ts +260 -0
- package/packages/mcp-server/src/server.ts +1342 -0
- package/packages/mcp-server/src/session-manager.ts +404 -0
- package/packages/mcp-server/src/tool-credentials.test.ts +95 -0
- package/packages/mcp-server/src/tool-credentials.ts +97 -0
- package/packages/mcp-server/src/types.ts +96 -0
- package/packages/mcp-server/src/workflow-tools-parity.test.ts +257 -0
- package/packages/mcp-server/src/workflow-tools.test.ts +2350 -0
- package/packages/mcp-server/src/workflow-tools.ts +2257 -0
- package/packages/mcp-server/tsconfig.json +25 -0
- package/packages/mcp-server/tsconfig.test.json +19 -0
- package/packages/native/dist/ast/index.d.ts +4 -0
- package/packages/native/dist/ast/index.js +11 -0
- package/packages/native/dist/ast/types.d.ts +69 -0
- package/packages/native/dist/ast/types.js +2 -0
- package/packages/native/dist/clipboard/index.d.ts +28 -0
- package/packages/native/dist/clipboard/index.js +38 -0
- package/packages/native/dist/clipboard/types.d.ts +7 -0
- package/packages/native/dist/clipboard/types.js +2 -0
- package/packages/native/dist/diff/index.d.ts +33 -0
- package/packages/native/dist/diff/index.js +43 -0
- package/packages/native/dist/diff/types.d.ts +23 -0
- package/packages/native/dist/diff/types.js +2 -0
- package/packages/native/dist/fd/index.d.ts +26 -0
- package/packages/native/dist/fd/index.js +30 -0
- package/packages/native/dist/fd/types.d.ts +29 -0
- package/packages/native/dist/fd/types.js +2 -0
- package/packages/native/dist/glob/index.d.ts +28 -0
- package/packages/native/dist/glob/index.js +35 -0
- package/packages/native/dist/glob/types.d.ts +50 -0
- package/packages/native/dist/glob/types.js +2 -0
- package/packages/native/dist/grep/index.d.ts +21 -0
- package/packages/native/dist/grep/index.js +28 -0
- package/packages/native/dist/grep/types.d.ts +99 -0
- package/packages/native/dist/grep/types.js +2 -0
- package/packages/native/dist/gsd-parser/index.d.ts +45 -0
- package/packages/native/dist/gsd-parser/index.js +61 -0
- package/packages/native/dist/gsd-parser/types.d.ts +55 -0
- package/packages/native/dist/gsd-parser/types.js +8 -0
- package/packages/native/dist/highlight/index.d.ts +28 -0
- package/packages/native/dist/highlight/index.js +38 -0
- package/packages/native/dist/highlight/types.d.ts +25 -0
- package/packages/native/dist/highlight/types.js +2 -0
- package/packages/native/dist/html/index.d.ts +15 -0
- package/packages/native/dist/html/index.js +19 -0
- package/packages/native/dist/html/types.d.ts +7 -0
- package/packages/native/dist/html/types.js +2 -0
- package/packages/native/dist/image/index.d.ts +15 -0
- package/packages/native/dist/image/index.js +23 -0
- package/packages/native/dist/image/types.d.ts +35 -0
- package/packages/native/dist/image/types.js +29 -0
- package/packages/native/dist/index.d.ts +46 -0
- package/packages/native/dist/index.js +85 -0
- package/packages/native/dist/json-parse/index.d.ts +23 -0
- package/packages/native/dist/json-parse/index.js +78 -0
- package/packages/native/dist/native.d.ts +57 -0
- package/packages/native/dist/native.js +113 -0
- package/packages/native/dist/ps/index.d.ts +38 -0
- package/packages/native/dist/ps/index.js +53 -0
- package/packages/native/dist/stream-process/index.d.ts +35 -0
- package/packages/native/dist/stream-process/index.js +254 -0
- package/packages/native/dist/text/index.d.ts +55 -0
- package/packages/native/dist/text/index.js +76 -0
- package/packages/native/dist/text/types.d.ts +27 -0
- package/packages/native/dist/text/types.js +13 -0
- package/packages/native/dist/truncate/index.d.ts +29 -0
- package/packages/native/dist/truncate/index.js +30 -0
- package/packages/native/dist/ttsr/index.d.ts +27 -0
- package/packages/native/dist/ttsr/index.js +37 -0
- package/packages/native/dist/ttsr/types.d.ts +9 -0
- package/packages/native/dist/ttsr/types.js +2 -0
- package/packages/native/dist/xxhash/index.d.ts +22 -0
- package/packages/native/dist/xxhash/index.js +89 -0
- package/packages/native/package.json +97 -0
- package/packages/native/src/__tests__/_test-coverage-guard.test.mjs +98 -0
- package/packages/native/src/__tests__/clipboard.test.mjs +126 -0
- package/packages/native/src/__tests__/diff.test.mjs +189 -0
- package/packages/native/src/__tests__/fd.test.mjs +199 -0
- package/packages/native/src/__tests__/glob.test.mjs +237 -0
- package/packages/native/src/__tests__/grep.test.mjs +179 -0
- package/packages/native/src/__tests__/highlight.test.mjs +156 -0
- package/packages/native/src/__tests__/html.test.mjs +98 -0
- package/packages/native/src/__tests__/image.test.mjs +137 -0
- package/packages/native/src/__tests__/json-parse.test.mjs +158 -0
- package/packages/native/src/__tests__/module-compat.test.mjs +123 -0
- package/packages/native/src/__tests__/ps.test.mjs +115 -0
- package/packages/native/src/__tests__/stream-process.test.mjs +108 -0
- package/packages/native/src/__tests__/text.test.mjs +295 -0
- package/packages/native/src/__tests__/truncate.test.mjs +160 -0
- package/packages/native/src/__tests__/ttsr.test.mjs +135 -0
- package/packages/native/src/__tests__/xxhash.test.mjs +122 -0
- package/packages/native/src/ast/index.ts +12 -0
- package/packages/native/src/ast/types.ts +75 -0
- package/packages/native/src/clipboard/index.ts +40 -0
- package/packages/native/src/clipboard/types.ts +7 -0
- package/packages/native/src/diff/index.ts +61 -0
- package/packages/native/src/diff/types.ts +24 -0
- package/packages/native/src/fd/index.ts +36 -0
- package/packages/native/src/fd/types.ts +31 -0
- package/packages/native/src/glob/index.ts +44 -0
- package/packages/native/src/glob/types.ts +53 -0
- package/packages/native/src/grep/index.ts +49 -0
- package/packages/native/src/grep/types.ts +105 -0
- package/packages/native/src/gsd-parser/index.ts +98 -0
- package/packages/native/src/gsd-parser/types.ts +62 -0
- package/packages/native/src/highlight/index.ts +44 -0
- package/packages/native/src/highlight/types.ts +25 -0
- package/packages/native/src/html/index.ts +24 -0
- package/packages/native/src/html/types.ts +7 -0
- package/packages/native/src/image/index.ts +28 -0
- package/packages/native/src/image/types.ts +41 -0
- package/packages/native/src/index.ts +128 -0
- package/packages/native/src/json-parse/index.ts +76 -0
- package/packages/native/src/native.ts +154 -0
- package/packages/native/src/ps/index.ts +52 -0
- package/packages/native/src/stream-process/index.ts +313 -0
- package/packages/native/src/text/index.ts +125 -0
- package/packages/native/src/text/types.ts +29 -0
- package/packages/native/src/truncate/index.ts +50 -0
- package/packages/native/src/ttsr/index.ts +39 -0
- package/packages/native/src/ttsr/types.ts +10 -0
- package/packages/native/src/xxhash/index.ts +98 -0
- package/packages/native/tsconfig.json +9 -0
- package/packages/native/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-agent-core/package.json +23 -0
- package/packages/pi-agent-core/src/agent-loop.test.ts +733 -0
- package/packages/pi-agent-core/src/agent-loop.ts +851 -0
- package/packages/pi-agent-core/src/agent.test.ts +129 -0
- package/packages/pi-agent-core/src/agent.ts +668 -0
- package/packages/pi-agent-core/src/index.ts +10 -0
- package/packages/pi-agent-core/src/proxy.ts +334 -0
- package/packages/pi-agent-core/src/token-audit.test.ts +189 -0
- package/packages/pi-agent-core/src/token-audit.ts +287 -0
- package/packages/pi-agent-core/src/types.ts +358 -0
- package/packages/pi-agent-core/tsconfig.json +28 -0
- package/packages/pi-ai/bedrock-provider.d.ts +1 -0
- package/packages/pi-ai/bedrock-provider.js +1 -0
- package/packages/pi-ai/package.json +48 -0
- package/packages/pi-ai/scripts/generate-models.ts +1671 -0
- package/packages/pi-ai/src/api-registry.ts +86 -0
- package/packages/pi-ai/src/bedrock-provider.ts +6 -0
- package/packages/pi-ai/src/cli.ts +133 -0
- package/packages/pi-ai/src/env-api-keys.ts +148 -0
- package/packages/pi-ai/src/index.ts +36 -0
- package/packages/pi-ai/src/models/capability-patches.ts +51 -0
- package/packages/pi-ai/src/models/custom.ts +337 -0
- package/packages/pi-ai/src/models/fake-model.ts +30 -0
- package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +1554 -0
- package/packages/pi-ai/src/models/generated/anthropic.ts +398 -0
- package/packages/pi-ai/src/models/generated/azure-openai-responses.ts +704 -0
- package/packages/pi-ai/src/models/generated/cerebras.ts +75 -0
- package/packages/pi-ai/src/models/generated/github-copilot.ts +446 -0
- package/packages/pi-ai/src/models/generated/google-antigravity.ts +177 -0
- package/packages/pi-ai/src/models/generated/google-gemini-cli.ts +109 -0
- package/packages/pi-ai/src/models/generated/google-vertex.ts +211 -0
- package/packages/pi-ai/src/models/generated/google.ts +466 -0
- package/packages/pi-ai/src/models/generated/groq.ts +160 -0
- package/packages/pi-ai/src/models/generated/huggingface.ts +349 -0
- package/packages/pi-ai/src/models/generated/index.ts +52 -0
- package/packages/pi-ai/src/models/generated/kimi-coding.ts +41 -0
- package/packages/pi-ai/src/models/generated/minimax-cn.ts +109 -0
- package/packages/pi-ai/src/models/generated/minimax.ts +109 -0
- package/packages/pi-ai/src/models/generated/mistral.ts +449 -0
- package/packages/pi-ai/src/models/generated/openai-codex.ts +177 -0
- package/packages/pi-ai/src/models/generated/openai.ts +721 -0
- package/packages/pi-ai/src/models/generated/opencode-go.ts +126 -0
- package/packages/pi-ai/src/models/generated/opencode.ts +534 -0
- package/packages/pi-ai/src/models/generated/openrouter.ts +4291 -0
- package/packages/pi-ai/src/models/generated/vercel-ai-gateway.ts +2608 -0
- package/packages/pi-ai/src/models/generated/xai.ts +415 -0
- package/packages/pi-ai/src/models/generated/zai.ts +241 -0
- package/packages/pi-ai/src/models/index.ts +115 -0
- package/packages/pi-ai/src/models.generated.test.ts +362 -0
- package/packages/pi-ai/src/models.test.ts +404 -0
- package/packages/pi-ai/src/models.ts +3 -0
- package/packages/pi-ai/src/oauth.ts +1 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.test.ts +164 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +797 -0
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +92 -0
- package/packages/pi-ai/src/providers/anthropic-bearer-auth.test.ts +36 -0
- package/packages/pi-ai/src/providers/anthropic-shared.cache-breakpoint.test.ts +289 -0
- package/packages/pi-ai/src/providers/anthropic-shared.test.ts +134 -0
- package/packages/pi-ai/src/providers/anthropic-shared.ts +899 -0
- package/packages/pi-ai/src/providers/anthropic-vertex.ts +130 -0
- package/packages/pi-ai/src/providers/anthropic.ts +240 -0
- package/packages/pi-ai/src/providers/api-family.test.ts +129 -0
- package/packages/pi-ai/src/providers/api-family.ts +57 -0
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +248 -0
- package/packages/pi-ai/src/providers/fake.ts +376 -0
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +37 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.test.ts +90 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +982 -0
- package/packages/pi-ai/src/providers/google-shared.test.ts +137 -0
- package/packages/pi-ai/src/providers/google-shared.ts +364 -0
- package/packages/pi-ai/src/providers/google-vertex.ts +500 -0
- package/packages/pi-ai/src/providers/google.ts +467 -0
- package/packages/pi-ai/src/providers/minimax-tool-name.test.ts +118 -0
- package/packages/pi-ai/src/providers/mistral.ts +597 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +1007 -0
- package/packages/pi-ai/src/providers/openai-completions.test.ts +75 -0
- package/packages/pi-ai/src/providers/openai-completions.ts +830 -0
- package/packages/pi-ai/src/providers/openai-responses-shared.ts +496 -0
- package/packages/pi-ai/src/providers/openai-responses.ts +205 -0
- package/packages/pi-ai/src/providers/openai-shared.ts +193 -0
- package/packages/pi-ai/src/providers/provider-capabilities.test.ts +174 -0
- package/packages/pi-ai/src/providers/provider-capabilities.ts +215 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +216 -0
- package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
- package/packages/pi-ai/src/providers/simple-options.ts +61 -0
- package/packages/pi-ai/src/providers/think-tag-parser.test.ts +44 -0
- package/packages/pi-ai/src/providers/think-tag-parser.ts +94 -0
- package/packages/pi-ai/src/providers/transform-messages-report.test.ts +189 -0
- package/packages/pi-ai/src/providers/transform-messages.ts +289 -0
- package/packages/pi-ai/src/stream.ts +59 -0
- package/packages/pi-ai/src/types.ts +413 -0
- package/packages/pi-ai/src/utils/event-stream.ts +87 -0
- package/packages/pi-ai/src/utils/hash.ts +13 -0
- package/packages/pi-ai/src/utils/json-parse.ts +51 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +282 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.ts +470 -0
- package/packages/pi-ai/src/utils/oauth/google-antigravity.test.ts +80 -0
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +323 -0
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.test.ts +80 -0
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +468 -0
- package/packages/pi-ai/src/utils/oauth/google-oauth-utils.ts +201 -0
- package/packages/pi-ai/src/utils/oauth/index.ts +134 -0
- package/packages/pi-ai/src/utils/oauth/openai-codex.ts +472 -0
- package/packages/pi-ai/src/utils/oauth/pkce.ts +34 -0
- package/packages/pi-ai/src/utils/oauth/types.ts +49 -0
- package/packages/pi-ai/src/utils/overflow.ts +129 -0
- package/packages/pi-ai/src/utils/repair-tool-json.ts +241 -0
- package/packages/pi-ai/src/utils/sanitize-unicode.ts +25 -0
- package/packages/pi-ai/src/utils/tests/json-parse.test.ts +17 -0
- package/packages/pi-ai/src/utils/tests/overflow.test.ts +58 -0
- package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +240 -0
- package/packages/pi-ai/src/utils/typebox-helpers.ts +24 -0
- package/packages/pi-ai/src/utils/validation.ts +69 -0
- package/packages/pi-ai/src/web-runtime-env-api-keys.ts +86 -0
- package/packages/pi-ai/src/web-runtime-oauth.ts +9 -0
- package/packages/pi-ai/tsconfig.json +28 -0
- package/packages/pi-coding-agent/package.json +52 -0
- package/packages/pi-coding-agent/scripts/copy-assets.cjs +55 -0
- package/packages/pi-coding-agent/src/cli/abort-signal-timeout.test.ts +73 -0
- package/packages/pi-coding-agent/src/cli/abort-signal-timeout.ts +18 -0
- package/packages/pi-coding-agent/src/cli/args.test.ts +44 -0
- package/packages/pi-coding-agent/src/cli/args.ts +357 -0
- package/packages/pi-coding-agent/src/cli/config-selector.ts +52 -0
- package/packages/pi-coding-agent/src/cli/file-processor.ts +96 -0
- package/packages/pi-coding-agent/src/cli/list-models.ts +164 -0
- package/packages/pi-coding-agent/src/cli/session-picker.ts +51 -0
- package/packages/pi-coding-agent/src/cli.ts +20 -0
- package/packages/pi-coding-agent/src/config.ts +245 -0
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +491 -0
- package/packages/pi-coding-agent/src/core/agent-session-model-switch.test.ts +93 -0
- package/packages/pi-coding-agent/src/core/agent-session-renderable-tools.test.ts +70 -0
- package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
- package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +172 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +3150 -0
- package/packages/pi-coding-agent/src/core/artifact-manager.ts +125 -0
- package/packages/pi-coding-agent/src/core/auth-storage.test.ts +654 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +925 -0
- package/packages/pi-coding-agent/src/core/bash-executor.ts +316 -0
- package/packages/pi-coding-agent/src/core/blob-store.ts +154 -0
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +1571 -0
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +307 -0
- package/packages/pi-coding-agent/src/core/compaction/compaction.test.ts +598 -0
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +986 -0
- package/packages/pi-coding-agent/src/core/compaction/index.ts +7 -0
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +368 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.test.ts +154 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +440 -0
- package/packages/pi-coding-agent/src/core/compaction-threshold.test.ts +121 -0
- package/packages/pi-coding-agent/src/core/compaction-utils.test.ts +117 -0
- package/packages/pi-coding-agent/src/core/constants.ts +59 -0
- package/packages/pi-coding-agent/src/core/contextual-tips.test.ts +259 -0
- package/packages/pi-coding-agent/src/core/contextual-tips.ts +232 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.test.ts +32 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.ts +66 -0
- package/packages/pi-coding-agent/src/core/defaults.ts +3 -0
- package/packages/pi-coding-agent/src/core/diagnostics.ts +15 -0
- package/packages/pi-coding-agent/src/core/discovery-cache.test.ts +163 -0
- package/packages/pi-coding-agent/src/core/discovery-cache.ts +104 -0
- package/packages/pi-coding-agent/src/core/event-bus.ts +33 -0
- package/packages/pi-coding-agent/src/core/exec.ts +106 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +258 -0
- package/packages/pi-coding-agent/src/core/export-html/index.ts +306 -0
- package/packages/pi-coding-agent/src/core/export-html/template.css +971 -0
- package/packages/pi-coding-agent/src/core/export-html/template.html +54 -0
- package/packages/pi-coding-agent/src/core/export-html/template.js +1583 -0
- package/packages/pi-coding-agent/src/core/export-html/tool-renderer.ts +114 -0
- package/packages/pi-coding-agent/src/core/export-html/vendor/highlight.min.js +1213 -0
- package/packages/pi-coding-agent/src/core/export-html/vendor/marked.min.js +6 -0
- package/packages/pi-coding-agent/src/core/extensions/extension-discovery.ts +119 -0
- package/packages/pi-coding-agent/src/core/extensions/extension-manifest.test.ts +77 -0
- package/packages/pi-coding-agent/src/core/extensions/extension-manifest.ts +62 -0
- package/packages/pi-coding-agent/src/core/extensions/extension-registry.ts +222 -0
- package/packages/pi-coding-agent/src/core/extensions/extension-sort.test.ts +134 -0
- package/packages/pi-coding-agent/src/core/extensions/extension-sort.ts +137 -0
- package/packages/pi-coding-agent/src/core/extensions/index.ts +186 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.test.ts +275 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +1139 -0
- package/packages/pi-coding-agent/src/core/extensions/project-trust.ts +51 -0
- package/packages/pi-coding-agent/src/core/extensions/provider-registration.test.ts +81 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +282 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +1241 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +1872 -0
- package/packages/pi-coding-agent/src/core/extensions/wrapper.ts +127 -0
- package/packages/pi-coding-agent/src/core/fallback-resolver.test.ts +242 -0
- package/packages/pi-coding-agent/src/core/fallback-resolver.ts +164 -0
- package/packages/pi-coding-agent/src/core/footer-data-provider.ts +144 -0
- package/packages/pi-coding-agent/src/core/fs-utils.test.ts +54 -0
- package/packages/pi-coding-agent/src/core/fs-utils.ts +12 -0
- package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +271 -0
- package/packages/pi-coding-agent/src/core/hooks-runner.ts +460 -0
- package/packages/pi-coding-agent/src/core/image-overflow-recovery.test.ts +228 -0
- package/packages/pi-coding-agent/src/core/image-overflow-recovery.ts +118 -0
- package/packages/pi-coding-agent/src/core/index.ts +80 -0
- package/packages/pi-coding-agent/src/core/keybindings.ts +211 -0
- package/packages/pi-coding-agent/src/core/lifecycle-hooks.test.ts +227 -0
- package/packages/pi-coding-agent/src/core/lifecycle-hooks.ts +280 -0
- package/packages/pi-coding-agent/src/core/local-model-check.ts +45 -0
- package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +968 -0
- package/packages/pi-coding-agent/src/core/lsp/config.ts +356 -0
- package/packages/pi-coding-agent/src/core/lsp/defaults.json +456 -0
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +109 -0
- package/packages/pi-coding-agent/src/core/lsp/helpers.ts +54 -0
- package/packages/pi-coding-agent/src/core/lsp/index.ts +1065 -0
- package/packages/pi-coding-agent/src/core/lsp/lsp-integration.test.ts +451 -0
- package/packages/pi-coding-agent/src/core/lsp/lsp-legacy-alias.test.ts +70 -0
- package/packages/pi-coding-agent/src/core/lsp/lsp.md +39 -0
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +190 -0
- package/packages/pi-coding-agent/src/core/lsp/types.ts +445 -0
- package/packages/pi-coding-agent/src/core/lsp/utils.ts +706 -0
- package/packages/pi-coding-agent/src/core/messages.test.ts +114 -0
- package/packages/pi-coding-agent/src/core/messages.ts +226 -0
- package/packages/pi-coding-agent/src/core/model-discovery.test.ts +144 -0
- package/packages/pi-coding-agent/src/core/model-discovery.ts +318 -0
- package/packages/pi-coding-agent/src/core/model-registry-auth-header.test.ts +44 -0
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +730 -0
- package/packages/pi-coding-agent/src/core/model-registry-custom-caps.test.ts +245 -0
- package/packages/pi-coding-agent/src/core/model-registry-discovery.test.ts +210 -0
- package/packages/pi-coding-agent/src/core/model-registry-env-fallback.test.ts +59 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +1053 -0
- package/packages/pi-coding-agent/src/core/model-resolver-initial-model-auth.test.ts +78 -0
- package/packages/pi-coding-agent/src/core/model-resolver.test.ts +85 -0
- package/packages/pi-coding-agent/src/core/model-resolver.ts +511 -0
- package/packages/pi-coding-agent/src/core/models-json-writer.test.ts +145 -0
- package/packages/pi-coding-agent/src/core/models-json-writer.ts +188 -0
- package/packages/pi-coding-agent/src/core/package-commands.test.ts +262 -0
- package/packages/pi-coding-agent/src/core/package-commands.ts +310 -0
- package/packages/pi-coding-agent/src/core/package-manager.ts +1845 -0
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +299 -0
- package/packages/pi-coding-agent/src/core/redact-secrets.test.ts +86 -0
- package/packages/pi-coding-agent/src/core/redact-secrets.ts +58 -0
- package/packages/pi-coding-agent/src/core/resolve-config-value.test.ts +295 -0
- package/packages/pi-coding-agent/src/core/resolve-config-value.ts +118 -0
- package/packages/pi-coding-agent/src/core/resource-loader-cache-reset.test.ts +107 -0
- package/packages/pi-coding-agent/src/core/resource-loader.ts +929 -0
- package/packages/pi-coding-agent/src/core/retry-handler.test.ts +518 -0
- package/packages/pi-coding-agent/src/core/retry-handler.ts +576 -0
- package/packages/pi-coding-agent/src/core/retryable-error-regex.ts +18 -0
- package/packages/pi-coding-agent/src/core/sdk-tool-filter.test.ts +60 -0
- package/packages/pi-coding-agent/src/core/sdk.test.ts +113 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +688 -0
- package/packages/pi-coding-agent/src/core/session-manager.test.ts +129 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +1646 -0
- package/packages/pi-coding-agent/src/core/settings-manager-security.test.ts +102 -0
- package/packages/pi-coding-agent/src/core/settings-manager.ts +1247 -0
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +117 -0
- package/packages/pi-coding-agent/src/core/skills.ts +490 -0
- package/packages/pi-coding-agent/src/core/slash-commands.ts +43 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +296 -0
- package/packages/pi-coding-agent/src/core/timings.ts +25 -0
- package/packages/pi-coding-agent/src/core/token-telemetry.ts +77 -0
- package/packages/pi-coding-agent/src/core/tools/bash-background.test.ts +91 -0
- package/packages/pi-coding-agent/src/core/tools/bash-interceptor.test.ts +198 -0
- package/packages/pi-coding-agent/src/core/tools/bash-interceptor.ts +115 -0
- package/packages/pi-coding-agent/src/core/tools/bash-spawn-windows.test.ts +77 -0
- package/packages/pi-coding-agent/src/core/tools/bash.ts +478 -0
- package/packages/pi-coding-agent/src/core/tools/edit-diff.test.ts +85 -0
- package/packages/pi-coding-agent/src/core/tools/edit-diff.ts +402 -0
- package/packages/pi-coding-agent/src/core/tools/edit.ts +242 -0
- package/packages/pi-coding-agent/src/core/tools/find.ts +209 -0
- package/packages/pi-coding-agent/src/core/tools/grep.ts +356 -0
- package/packages/pi-coding-agent/src/core/tools/hashline-edit.ts +318 -0
- package/packages/pi-coding-agent/src/core/tools/hashline-read.ts +207 -0
- package/packages/pi-coding-agent/src/core/tools/hashline.test.ts +456 -0
- package/packages/pi-coding-agent/src/core/tools/hashline.ts +525 -0
- package/packages/pi-coding-agent/src/core/tools/index.ts +226 -0
- package/packages/pi-coding-agent/src/core/tools/ls.ts +178 -0
- package/packages/pi-coding-agent/src/core/tools/path-utils.test.ts +67 -0
- package/packages/pi-coding-agent/src/core/tools/path-utils.ts +106 -0
- package/packages/pi-coding-agent/src/core/tools/read.ts +235 -0
- package/packages/pi-coding-agent/src/core/tools/spawn-shell-windows.test.ts +31 -0
- package/packages/pi-coding-agent/src/core/tools/tool-compatibility-registry.ts +83 -0
- package/packages/pi-coding-agent/src/core/tools/tool-target-metadata.test.ts +127 -0
- package/packages/pi-coding-agent/src/core/tools/tool-target.ts +48 -0
- package/packages/pi-coding-agent/src/core/tools/truncate.ts +267 -0
- package/packages/pi-coding-agent/src/core/tools/write.ts +133 -0
- package/packages/pi-coding-agent/src/index.ts +422 -0
- package/packages/pi-coding-agent/src/main.ts +649 -0
- package/packages/pi-coding-agent/src/migrations.ts +295 -0
- package/packages/pi-coding-agent/src/modes/index.ts +16 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/assistant-message-design.test.ts +128 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.ts +93 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/collapsible-message.test.ts +111 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/login-dialog.test.ts +24 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/provider-display-name.test.ts +28 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/timestamp.test.ts +41 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +512 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/user-message-design.test.ts +139 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.test.ts +66 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +161 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/animated-component.test.ts +115 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/animated-component.ts +107 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/armin.ts +360 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +200 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/bash-execution.test.ts +35 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/bash-execution.ts +287 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/bordered-loader.ts +66 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/branch-summary-message.ts +54 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/collapsible-message.ts +45 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/compaction-summary-message.ts +73 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/config-selector.ts +599 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/countdown-timer.ts +43 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/custom-editor.ts +97 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/custom-message.ts +89 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/daxnuts.test.ts +68 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/daxnuts.ts +159 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/diff.ts +153 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.test.ts +99 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +97 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-editor.ts +150 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-input.ts +92 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-selector.ts +152 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +266 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/index.ts +33 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/interactive-key-handling.test.ts +122 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/keybinding-hints.ts +84 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +256 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +693 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/oauth-selector.ts +127 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +231 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/render-cache.ts +22 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/scoped-models-selector.ts +342 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/selector-footers.test.ts +63 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +194 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +1015 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +466 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/show-images-selector.ts +47 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +61 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/theme-selector.test.ts +27 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/theme-selector.ts +67 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/thinking-selector.ts +66 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/timestamp.ts +49 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +303 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1457 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/transcript-design.ts +345 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-render-utils.ts +84 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +1125 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message-selector.test.ts +28 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message-selector.ts +154 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +76 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/visual-truncate.ts +50 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +230 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +1066 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/extension-ui-controller.ts +68 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +373 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +157 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/model-controller.ts +76 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-lifecycle.test.ts +63 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +73 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +40 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +4418 -0
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.test.ts +95 -0
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +695 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-highlight.test.ts +23 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +96 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +1130 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +388 -0
- package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +68 -0
- package/packages/pi-coding-agent/src/modes/interactive/tui-mode.ts +29 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/shorten-path.ts +15 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/tool-call-summary.test.ts +39 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/tool-call-summary.ts +56 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +106 -0
- package/packages/pi-coding-agent/src/modes/rpc/jsonl.ts +64 -0
- package/packages/pi-coding-agent/src/modes/rpc/remote-terminal.ts +109 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-client.ts +574 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +891 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-protocol-v2.test.ts +971 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-types.ts +4 -0
- package/packages/pi-coding-agent/src/modes/shared/command-context-actions.ts +53 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/index.ts +270 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/pipeline.ts +567 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +31 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage.test.ts +98 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +479 -0
- package/packages/pi-coding-agent/src/tests/path-display.test.ts +85 -0
- package/packages/pi-coding-agent/src/tests/system-prompt-cache-stability.test.ts +102 -0
- package/packages/pi-coding-agent/src/tests/system-prompt-file-safety.test.ts +22 -0
- package/packages/pi-coding-agent/src/tests/system-prompt-skill-filter.test.ts +157 -0
- package/packages/pi-coding-agent/src/tests/token-telemetry.test.ts +200 -0
- package/packages/pi-coding-agent/src/types/ambient-modules.d.ts +69 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +99 -0
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +227 -0
- package/packages/pi-coding-agent/src/utils/clipboard-native.ts +11 -0
- package/packages/pi-coding-agent/src/utils/clipboard.ts +14 -0
- package/packages/pi-coding-agent/src/utils/error.ts +6 -0
- package/packages/pi-coding-agent/src/utils/frontmatter.ts +39 -0
- package/packages/pi-coding-agent/src/utils/git.ts +192 -0
- package/packages/pi-coding-agent/src/utils/image-convert.ts +28 -0
- package/packages/pi-coding-agent/src/utils/image-resize.ts +225 -0
- package/packages/pi-coding-agent/src/utils/mime.ts +30 -0
- package/packages/pi-coding-agent/src/utils/path-display.ts +36 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +2 -0
- package/packages/pi-coding-agent/src/utils/shell.ts +212 -0
- package/packages/pi-coding-agent/src/utils/sleep.ts +18 -0
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +286 -0
- package/packages/pi-coding-agent/tsconfig.json +28 -0
- package/packages/pi-tui/dist/__tests__/autocomplete.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/autocomplete.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +206 -0
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/fuzzy.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/fuzzy.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/fuzzy.test.js +100 -0
- package/packages/pi-tui/dist/__tests__/fuzzy.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/keys.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/keys.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/keys.test.js +18 -0
- package/packages/pi-tui/dist/__tests__/keys.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/loader.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/loader.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/loader.test.js +24 -0
- package/packages/pi-tui/dist/__tests__/loader.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +227 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js +80 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/style.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/style.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/style.test.js +129 -0
- package/packages/pi-tui/dist/__tests__/style.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js +103 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/tui.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +315 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/utils.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/utils.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/utils.test.js +17 -0
- package/packages/pi-tui/dist/__tests__/utils.test.js.map +1 -0
- package/packages/pi-tui/dist/autocomplete.d.ts +55 -0
- package/packages/pi-tui/dist/autocomplete.d.ts.map +1 -0
- package/packages/pi-tui/dist/autocomplete.js +540 -0
- package/packages/pi-tui/dist/autocomplete.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/box.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/box.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/box.test.js +20 -0
- package/packages/pi-tui/dist/components/__tests__/box.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/cancellable-loader.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/cancellable-loader.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/cancellable-loader.test.js +38 -0
- package/packages/pi-tui/dist/components/__tests__/cancellable-loader.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.js +89 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/input.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/input.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/input.test.js +81 -0
- package/packages/pi-tui/dist/components/__tests__/input.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js +161 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/loader.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/loader.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/loader.test.js +81 -0
- package/packages/pi-tui/dist/components/__tests__/loader.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-list.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-list.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-list.test.js +36 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-list.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js +70 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/select-list.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/select-list.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/select-list.test.js +42 -0
- package/packages/pi-tui/dist/components/__tests__/select-list.test.js.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/truncated-text.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/truncated-text.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/truncated-text.test.js +14 -0
- package/packages/pi-tui/dist/components/__tests__/truncated-text.test.js.map +1 -0
- package/packages/pi-tui/dist/components/box.d.ts +23 -0
- package/packages/pi-tui/dist/components/box.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/box.js +111 -0
- package/packages/pi-tui/dist/components/box.js.map +1 -0
- package/packages/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
- package/packages/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/cancellable-loader.js +38 -0
- package/packages/pi-tui/dist/components/cancellable-loader.js.map +1 -0
- package/packages/pi-tui/dist/components/editor.d.ts +245 -0
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/editor.js +1825 -0
- package/packages/pi-tui/dist/components/editor.js.map +1 -0
- package/packages/pi-tui/dist/components/image.d.ts +37 -0
- package/packages/pi-tui/dist/components/image.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/image.js +84 -0
- package/packages/pi-tui/dist/components/image.js.map +1 -0
- package/packages/pi-tui/dist/components/image.test.d.ts +6 -0
- package/packages/pi-tui/dist/components/image.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/image.test.js +33 -0
- package/packages/pi-tui/dist/components/image.test.js.map +1 -0
- package/packages/pi-tui/dist/components/input.d.ts +42 -0
- package/packages/pi-tui/dist/components/input.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/input.js +479 -0
- package/packages/pi-tui/dist/components/input.js.map +1 -0
- package/packages/pi-tui/dist/components/loader.d.ts +24 -0
- package/packages/pi-tui/dist/components/loader.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/loader.js +74 -0
- package/packages/pi-tui/dist/components/loader.js.map +1 -0
- package/packages/pi-tui/dist/components/markdown.d.ts +106 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/markdown.js +668 -0
- package/packages/pi-tui/dist/components/markdown.js.map +1 -0
- package/packages/pi-tui/dist/components/select-list.d.ts +32 -0
- package/packages/pi-tui/dist/components/select-list.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/select-list.js +155 -0
- package/packages/pi-tui/dist/components/select-list.js.map +1 -0
- package/packages/pi-tui/dist/components/settings-list.d.ts +50 -0
- package/packages/pi-tui/dist/components/settings-list.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/settings-list.js +179 -0
- package/packages/pi-tui/dist/components/settings-list.js.map +1 -0
- package/packages/pi-tui/dist/components/spacer.d.ts +12 -0
- package/packages/pi-tui/dist/components/spacer.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/spacer.js +22 -0
- package/packages/pi-tui/dist/components/spacer.js.map +1 -0
- package/packages/pi-tui/dist/components/text.d.ts +19 -0
- package/packages/pi-tui/dist/components/text.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/text.js +83 -0
- package/packages/pi-tui/dist/components/text.js.map +1 -0
- package/packages/pi-tui/dist/components/truncated-text.d.ts +13 -0
- package/packages/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/truncated-text.js +54 -0
- package/packages/pi-tui/dist/components/truncated-text.js.map +1 -0
- package/packages/pi-tui/dist/editor-component.d.ts +41 -0
- package/packages/pi-tui/dist/editor-component.d.ts.map +1 -0
- package/packages/pi-tui/dist/editor-component.js +2 -0
- package/packages/pi-tui/dist/editor-component.js.map +1 -0
- package/packages/pi-tui/dist/fuzzy.d.ts +16 -0
- package/packages/pi-tui/dist/fuzzy.d.ts.map +1 -0
- package/packages/pi-tui/dist/fuzzy.js +111 -0
- package/packages/pi-tui/dist/fuzzy.js.map +1 -0
- package/packages/pi-tui/dist/index.d.ts +24 -0
- package/packages/pi-tui/dist/index.d.ts.map +1 -0
- package/packages/pi-tui/dist/index.js +35 -0
- package/packages/pi-tui/dist/index.js.map +1 -0
- package/packages/pi-tui/dist/keybindings.d.ts +39 -0
- package/packages/pi-tui/dist/keybindings.d.ts.map +1 -0
- package/packages/pi-tui/dist/keybindings.js +116 -0
- package/packages/pi-tui/dist/keybindings.js.map +1 -0
- package/packages/pi-tui/dist/keys.d.ts +142 -0
- package/packages/pi-tui/dist/keys.d.ts.map +1 -0
- package/packages/pi-tui/dist/keys.js +994 -0
- package/packages/pi-tui/dist/keys.js.map +1 -0
- package/packages/pi-tui/dist/kill-ring.d.ts +28 -0
- package/packages/pi-tui/dist/kill-ring.d.ts.map +1 -0
- package/packages/pi-tui/dist/kill-ring.js +46 -0
- package/packages/pi-tui/dist/kill-ring.js.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.js +314 -0
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
- package/packages/pi-tui/dist/stdin-buffer.d.ts +55 -0
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
- package/packages/pi-tui/dist/stdin-buffer.js +342 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -0
- package/packages/pi-tui/dist/style.d.ts +52 -0
- package/packages/pi-tui/dist/style.d.ts.map +1 -0
- package/packages/pi-tui/dist/style.js +219 -0
- package/packages/pi-tui/dist/style.js.map +1 -0
- package/packages/pi-tui/dist/terminal-image.d.ts +68 -0
- package/packages/pi-tui/dist/terminal-image.d.ts.map +1 -0
- package/packages/pi-tui/dist/terminal-image.js +181 -0
- package/packages/pi-tui/dist/terminal-image.js.map +1 -0
- package/packages/pi-tui/dist/terminal.d.ts +89 -0
- package/packages/pi-tui/dist/terminal.d.ts.map +1 -0
- package/packages/pi-tui/dist/terminal.js +295 -0
- package/packages/pi-tui/dist/terminal.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +213 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -0
- package/packages/pi-tui/dist/tui.js +978 -0
- package/packages/pi-tui/dist/tui.js.map +1 -0
- package/packages/pi-tui/dist/undo-stack.d.ts +17 -0
- package/packages/pi-tui/dist/undo-stack.d.ts.map +1 -0
- package/packages/pi-tui/dist/undo-stack.js +27 -0
- package/packages/pi-tui/dist/undo-stack.js.map +1 -0
- package/packages/pi-tui/dist/utils.d.ts +72 -0
- package/packages/pi-tui/dist/utils.d.ts.map +1 -0
- package/packages/pi-tui/dist/utils.js +120 -0
- package/packages/pi-tui/dist/utils.js.map +1 -0
- package/packages/pi-tui/package.json +35 -0
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +264 -0
- package/packages/pi-tui/src/__tests__/fuzzy.test.ts +120 -0
- package/packages/pi-tui/src/__tests__/keys.test.ts +21 -0
- package/packages/pi-tui/src/__tests__/loader.test.ts +30 -0
- package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +266 -0
- package/packages/pi-tui/src/__tests__/stdin-buffer.test.ts +99 -0
- package/packages/pi-tui/src/__tests__/style.test.ts +156 -0
- package/packages/pi-tui/src/__tests__/terminal.test.ts +121 -0
- package/packages/pi-tui/src/__tests__/tui.test.ts +377 -0
- package/packages/pi-tui/src/__tests__/utils.test.ts +22 -0
- package/packages/pi-tui/src/autocomplete.ts +675 -0
- package/packages/pi-tui/src/components/__tests__/box.test.ts +25 -0
- package/packages/pi-tui/src/components/__tests__/cancellable-loader.test.ts +45 -0
- package/packages/pi-tui/src/components/__tests__/editor.test.ts +119 -0
- package/packages/pi-tui/src/components/__tests__/input.test.ts +111 -0
- package/packages/pi-tui/src/components/__tests__/leak-fixes-runtime.test.ts +219 -0
- package/packages/pi-tui/src/components/__tests__/loader.test.ts +122 -0
- package/packages/pi-tui/src/components/__tests__/markdown-list.test.ts +40 -0
- package/packages/pi-tui/src/components/__tests__/markdown-maxlines.test.ts +82 -0
- package/packages/pi-tui/src/components/__tests__/select-list.test.ts +70 -0
- package/packages/pi-tui/src/components/__tests__/truncated-text.test.ts +17 -0
- package/packages/pi-tui/src/components/box.ts +150 -0
- package/packages/pi-tui/src/components/cancellable-loader.ts +42 -0
- package/packages/pi-tui/src/components/editor.ts +2196 -0
- package/packages/pi-tui/src/components/image.test.ts +41 -0
- package/packages/pi-tui/src/components/image.ts +131 -0
- package/packages/pi-tui/src/components/input.ts +558 -0
- package/packages/pi-tui/src/components/loader.ts +83 -0
- package/packages/pi-tui/src/components/markdown.ts +842 -0
- package/packages/pi-tui/src/components/select-list.ts +194 -0
- package/packages/pi-tui/src/components/settings-list.ts +251 -0
- package/packages/pi-tui/src/components/spacer.ts +28 -0
- package/packages/pi-tui/src/components/text.ts +107 -0
- package/packages/pi-tui/src/components/truncated-text.ts +72 -0
- package/packages/pi-tui/src/editor-component.ts +77 -0
- package/packages/pi-tui/src/fuzzy.ts +138 -0
- package/packages/pi-tui/src/index.ts +98 -0
- package/packages/pi-tui/src/keybindings.ts +189 -0
- package/packages/pi-tui/src/keys.ts +1196 -0
- package/packages/pi-tui/src/kill-ring.ts +46 -0
- package/packages/pi-tui/src/overlay-layout.ts +408 -0
- package/packages/pi-tui/src/stdin-buffer.ts +419 -0
- package/packages/pi-tui/src/style.ts +295 -0
- package/packages/pi-tui/src/terminal-image.ts +260 -0
- package/packages/pi-tui/src/terminal.ts +377 -0
- package/packages/pi-tui/src/tui.ts +1182 -0
- package/packages/pi-tui/src/undo-stack.ts +28 -0
- package/packages/pi-tui/src/utils.ts +154 -0
- package/packages/pi-tui/tsconfig.json +28 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -0
- package/packages/rpc-client/README.md +132 -0
- package/packages/rpc-client/examples/basic-usage.ts +13 -0
- package/packages/rpc-client/package.json +42 -0
- package/packages/rpc-client/src/index.ts +10 -0
- package/packages/rpc-client/src/jsonl.ts +64 -0
- package/packages/rpc-client/src/rpc-client.test.ts +625 -0
- package/packages/rpc-client/src/rpc-client.ts +663 -0
- package/packages/rpc-client/src/rpc-types.ts +4 -0
- package/packages/rpc-client/tsconfig.examples.json +17 -0
- package/packages/rpc-client/tsconfig.json +25 -0
- package/pkg/dist/core/export-html/template.css +971 -0
- package/pkg/dist/core/export-html/template.html +54 -0
- package/pkg/dist/core/export-html/template.js +1583 -0
- package/pkg/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/pkg/dist/core/export-html/vendor/marked.min.js +6 -0
- package/pkg/package.json +8 -0
- package/scripts/ensure-workspace-builds.cjs +123 -0
- package/scripts/install.js +526 -0
- package/scripts/lib/workspace-manifest.cjs +86 -0
- package/scripts/link-workspace-packages.cjs +82 -0
- package/scripts/postinstall.js +11 -0
- package/src/resources/GSD-WORKFLOW.md +664 -0
- package/src/resources/agents/debugger.md +58 -0
- package/src/resources/agents/doc-writer.md +43 -0
- package/src/resources/agents/git-ops.md +56 -0
- package/src/resources/agents/javascript-pro.md +55 -0
- package/src/resources/agents/planner.md +55 -0
- package/src/resources/agents/refactorer.md +47 -0
- package/src/resources/agents/researcher.md +29 -0
- package/src/resources/agents/reviewer.md +48 -0
- package/src/resources/agents/scout.md +56 -0
- package/src/resources/agents/security.md +59 -0
- package/src/resources/agents/tester.md +50 -0
- package/src/resources/agents/typescript-pro.md +61 -0
- package/src/resources/agents/worker.md +31 -0
- package/src/resources/extensions/ask-user-questions.ts +478 -0
- package/src/resources/extensions/async-jobs/async-bash-timeout.test.ts +122 -0
- package/src/resources/extensions/async-jobs/async-bash-tool.ts +263 -0
- package/src/resources/extensions/async-jobs/await-tool.test.ts +200 -0
- package/src/resources/extensions/async-jobs/await-tool.ts +136 -0
- package/src/resources/extensions/async-jobs/cancel-job-tool.ts +35 -0
- package/src/resources/extensions/async-jobs/extension-manifest.json +13 -0
- package/src/resources/extensions/async-jobs/index.ts +153 -0
- package/src/resources/extensions/async-jobs/job-manager.ts +242 -0
- package/src/resources/extensions/aws-auth/index.ts +144 -0
- package/src/resources/extensions/bg-shell/bg-shell-command.ts +219 -0
- package/src/resources/extensions/bg-shell/bg-shell-lifecycle.ts +413 -0
- package/src/resources/extensions/bg-shell/bg-shell-tool.ts +985 -0
- package/src/resources/extensions/bg-shell/extension-manifest.json +14 -0
- package/src/resources/extensions/bg-shell/index.ts +54 -0
- package/src/resources/extensions/bg-shell/interaction.ts +200 -0
- package/src/resources/extensions/bg-shell/output-formatter.ts +262 -0
- package/src/resources/extensions/bg-shell/overlay.ts +441 -0
- package/src/resources/extensions/bg-shell/process-manager.ts +469 -0
- package/src/resources/extensions/bg-shell/readiness-detector.ts +126 -0
- package/src/resources/extensions/bg-shell/types.ts +291 -0
- package/src/resources/extensions/bg-shell/utilities.ts +93 -0
- package/src/resources/extensions/browser-tools/BROWSER-TOOLS-V2-PROPOSAL.md +1277 -0
- package/src/resources/extensions/browser-tools/capture.ts +229 -0
- package/src/resources/extensions/browser-tools/core.ts +1196 -0
- package/src/resources/extensions/browser-tools/evaluate-helpers.ts +184 -0
- package/src/resources/extensions/browser-tools/extension-manifest.json +37 -0
- package/src/resources/extensions/browser-tools/index.ts +163 -0
- package/src/resources/extensions/browser-tools/lifecycle.ts +270 -0
- package/src/resources/extensions/browser-tools/package.json +24 -0
- package/src/resources/extensions/browser-tools/refs.ts +264 -0
- package/src/resources/extensions/browser-tools/settle.ts +197 -0
- package/src/resources/extensions/browser-tools/state.ts +408 -0
- package/src/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +601 -0
- package/src/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +651 -0
- package/src/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +91 -0
- package/src/resources/extensions/browser-tools/tools/action-cache.ts +216 -0
- package/src/resources/extensions/browser-tools/tools/assertions.ts +342 -0
- package/src/resources/extensions/browser-tools/tools/codegen.ts +274 -0
- package/src/resources/extensions/browser-tools/tools/device.ts +183 -0
- package/src/resources/extensions/browser-tools/tools/extract.ts +229 -0
- package/src/resources/extensions/browser-tools/tools/forms.ts +805 -0
- package/src/resources/extensions/browser-tools/tools/injection-detect.ts +221 -0
- package/src/resources/extensions/browser-tools/tools/inspection.ts +492 -0
- package/src/resources/extensions/browser-tools/tools/intent.ts +629 -0
- package/src/resources/extensions/browser-tools/tools/interaction.ts +865 -0
- package/src/resources/extensions/browser-tools/tools/navigation.ts +232 -0
- package/src/resources/extensions/browser-tools/tools/network-mock.ts +244 -0
- package/src/resources/extensions/browser-tools/tools/pages.ts +303 -0
- package/src/resources/extensions/browser-tools/tools/pdf.ts +92 -0
- package/src/resources/extensions/browser-tools/tools/refs.ts +541 -0
- package/src/resources/extensions/browser-tools/tools/screenshot.ts +102 -0
- package/src/resources/extensions/browser-tools/tools/session.ts +400 -0
- package/src/resources/extensions/browser-tools/tools/state-persistence.ts +202 -0
- package/src/resources/extensions/browser-tools/tools/verify.ts +117 -0
- package/src/resources/extensions/browser-tools/tools/visual-diff.ts +209 -0
- package/src/resources/extensions/browser-tools/tools/wait.ts +247 -0
- package/src/resources/extensions/browser-tools/tools/zoom.ts +105 -0
- package/src/resources/extensions/browser-tools/utils.ts +660 -0
- package/src/resources/extensions/claude-code-cli/index.ts +28 -0
- package/src/resources/extensions/claude-code-cli/models.ts +51 -0
- package/src/resources/extensions/claude-code-cli/package.json +11 -0
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +305 -0
- package/src/resources/extensions/claude-code-cli/readiness.ts +242 -0
- package/src/resources/extensions/claude-code-cli/sdk-types.ts +149 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +1981 -0
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +256 -0
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +2380 -0
- package/src/resources/extensions/cmux/index.ts +479 -0
- package/src/resources/extensions/cmux/package.json +7 -0
- package/src/resources/extensions/context7/extension-manifest.json +12 -0
- package/src/resources/extensions/context7/index.ts +435 -0
- package/src/resources/extensions/context7/package.json +11 -0
- package/src/resources/extensions/get-secrets-from-user.ts +608 -0
- package/src/resources/extensions/github-sync/cli.ts +367 -0
- package/src/resources/extensions/github-sync/index.ts +93 -0
- package/src/resources/extensions/github-sync/mapping.ts +81 -0
- package/src/resources/extensions/github-sync/sync.ts +594 -0
- package/src/resources/extensions/github-sync/templates.ts +339 -0
- package/src/resources/extensions/github-sync/tests/cli.test.ts +89 -0
- package/src/resources/extensions/github-sync/tests/commit-linking.test.ts +43 -0
- package/src/resources/extensions/github-sync/tests/inline-code.test.ts +66 -0
- package/src/resources/extensions/github-sync/tests/mapping.test.ts +104 -0
- package/src/resources/extensions/github-sync/tests/sync-source.test.ts +14 -0
- package/src/resources/extensions/github-sync/tests/templates.test.ts +209 -0
- package/src/resources/extensions/github-sync/types.ts +47 -0
- package/src/resources/extensions/google-search/extension-manifest.json +13 -0
- package/src/resources/extensions/google-search/index.ts +6 -0
- package/src/resources/extensions/google-search/package.json +9 -0
- package/src/resources/extensions/gsd/abandon-detect.ts +62 -0
- package/src/resources/extensions/gsd/activity-log.ts +184 -0
- package/src/resources/extensions/gsd/atomic-write.ts +185 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +159 -0
- package/src/resources/extensions/gsd/auto/custom-verify-retry-store.ts +72 -0
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +138 -0
- package/src/resources/extensions/gsd/auto/finalize-timeout.ts +49 -0
- package/src/resources/extensions/gsd/auto/infra-errors.ts +92 -0
- package/src/resources/extensions/gsd/auto/lease-conflict-notice.ts +62 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +302 -0
- package/src/resources/extensions/gsd/auto/loop.ts +1448 -0
- package/src/resources/extensions/gsd/auto/orchestrator.ts +417 -0
- package/src/resources/extensions/gsd/auto/phases.ts +3014 -0
- package/src/resources/extensions/gsd/auto/resolve.ts +176 -0
- package/src/resources/extensions/gsd/auto/run-unit.ts +306 -0
- package/src/resources/extensions/gsd/auto/session.ts +427 -0
- package/src/resources/extensions/gsd/auto/turn-epoch.ts +108 -0
- package/src/resources/extensions/gsd/auto/types.ts +130 -0
- package/src/resources/extensions/gsd/auto/unit-runner-events.ts +19 -0
- package/src/resources/extensions/gsd/auto/verification-retry-policy.ts +82 -0
- package/src/resources/extensions/gsd/auto/workflow-custom-engine-dispatch-outcome.ts +28 -0
- package/src/resources/extensions/gsd/auto/workflow-custom-engine-iteration.ts +52 -0
- package/src/resources/extensions/gsd/auto/workflow-custom-engine-reconcile-outcome.ts +58 -0
- package/src/resources/extensions/gsd/auto/workflow-custom-engine-reconcile.ts +71 -0
- package/src/resources/extensions/gsd/auto/workflow-custom-engine-retry.ts +90 -0
- package/src/resources/extensions/gsd/auto/workflow-custom-engine-verify-outcome.ts +50 -0
- package/src/resources/extensions/gsd/auto/workflow-dispatch-claim.ts +179 -0
- package/src/resources/extensions/gsd/auto/workflow-dispatch-ledger.ts +45 -0
- package/src/resources/extensions/gsd/auto/workflow-iteration-completion.ts +26 -0
- package/src/resources/extensions/gsd/auto/workflow-journal-reporter.ts +33 -0
- package/src/resources/extensions/gsd/auto/workflow-kernel.ts +542 -0
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +71 -0
- package/src/resources/extensions/gsd/auto/workflow-phase-reporter.ts +22 -0
- package/src/resources/extensions/gsd/auto/workflow-session-lock.ts +68 -0
- package/src/resources/extensions/gsd/auto/workflow-sidecar-iteration.ts +46 -0
- package/src/resources/extensions/gsd/auto/workflow-sidecar-queue.ts +46 -0
- package/src/resources/extensions/gsd/auto/workflow-turn-reporter.ts +68 -0
- package/src/resources/extensions/gsd/auto/workflow-unit-dispatch.ts +89 -0
- package/src/resources/extensions/gsd/auto/workflow-worker-heartbeat.ts +51 -0
- package/src/resources/extensions/gsd/auto-artifact-paths.ts +218 -0
- package/src/resources/extensions/gsd/auto-budget.ts +57 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +1239 -0
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +311 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +1827 -0
- package/src/resources/extensions/gsd/auto-model-selection.ts +755 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +2375 -0
- package/src/resources/extensions/gsd/auto-prompts.ts +4108 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +1217 -0
- package/src/resources/extensions/gsd/auto-runtime-state.ts +63 -0
- package/src/resources/extensions/gsd/auto-start.ts +1561 -0
- package/src/resources/extensions/gsd/auto-status-message.ts +45 -0
- package/src/resources/extensions/gsd/auto-supervisor.ts +86 -0
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +308 -0
- package/src/resources/extensions/gsd/auto-timers.ts +366 -0
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +156 -0
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +138 -0
- package/src/resources/extensions/gsd/auto-utils.ts +25 -0
- package/src/resources/extensions/gsd/auto-verification.ts +955 -0
- package/src/resources/extensions/gsd/auto-worktree-repair.ts +194 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +2570 -0
- package/src/resources/extensions/gsd/auto.ts +3167 -0
- package/src/resources/extensions/gsd/blocked-models.ts +98 -0
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +685 -0
- package/src/resources/extensions/gsd/bootstrap/crash-log.ts +32 -0
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +1408 -0
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +144 -0
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +123 -0
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +67 -0
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +166 -0
- package/src/resources/extensions/gsd/bootstrap/notify-interceptor.ts +34 -0
- package/src/resources/extensions/gsd/bootstrap/provider-error-resume.ts +61 -0
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +68 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +154 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +1203 -0
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +101 -0
- package/src/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.ts +61 -0
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +32 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +770 -0
- package/src/resources/extensions/gsd/bootstrap/tests/write-gate-basepath.test.ts +103 -0
- package/src/resources/extensions/gsd/bootstrap/tests/write-gate-shouldblock-basepath.test.ts +97 -0
- package/src/resources/extensions/gsd/bootstrap/tool-call-loop-guard.ts +103 -0
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +1059 -0
- package/src/resources/extensions/gsd/branch-patterns.ts +16 -0
- package/src/resources/extensions/gsd/browser-evidence.ts +29 -0
- package/src/resources/extensions/gsd/cache.ts +40 -0
- package/src/resources/extensions/gsd/captures.ts +571 -0
- package/src/resources/extensions/gsd/changelog.ts +213 -0
- package/src/resources/extensions/gsd/claude-import.ts +705 -0
- package/src/resources/extensions/gsd/clean-root-preflight.ts +564 -0
- package/src/resources/extensions/gsd/closeout-recovery.ts +290 -0
- package/src/resources/extensions/gsd/codebase-generator.ts +616 -0
- package/src/resources/extensions/gsd/collision-diagnostics.ts +332 -0
- package/src/resources/extensions/gsd/commands/catalog.ts +577 -0
- package/src/resources/extensions/gsd/commands/context.ts +159 -0
- package/src/resources/extensions/gsd/commands/dispatcher.ts +101 -0
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +179 -0
- package/src/resources/extensions/gsd/commands/handlers/core.ts +597 -0
- package/src/resources/extensions/gsd/commands/handlers/escalate.ts +216 -0
- package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +144 -0
- package/src/resources/extensions/gsd/commands/handlers/onboarding.ts +196 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +359 -0
- package/src/resources/extensions/gsd/commands/handlers/parallel.ts +147 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +691 -0
- package/src/resources/extensions/gsd/commands/index.ts +20 -0
- package/src/resources/extensions/gsd/commands-add-tests.ts +137 -0
- package/src/resources/extensions/gsd/commands-backlog.ts +182 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +280 -0
- package/src/resources/extensions/gsd/commands-closeout.ts +109 -0
- package/src/resources/extensions/gsd/commands-cmux.ts +182 -0
- package/src/resources/extensions/gsd/commands-codebase.ts +198 -0
- package/src/resources/extensions/gsd/commands-config.ts +119 -0
- package/src/resources/extensions/gsd/commands-debug.ts +510 -0
- package/src/resources/extensions/gsd/commands-do.ts +110 -0
- package/src/resources/extensions/gsd/commands-eval-review.ts +716 -0
- package/src/resources/extensions/gsd/commands-extensions.ts +1088 -0
- package/src/resources/extensions/gsd/commands-extract-learnings.ts +493 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +510 -0
- package/src/resources/extensions/gsd/commands-inspect.ts +99 -0
- package/src/resources/extensions/gsd/commands-logs.ts +537 -0
- package/src/resources/extensions/gsd/commands-maintenance.ts +544 -0
- package/src/resources/extensions/gsd/commands-mcp-status.ts +402 -0
- package/src/resources/extensions/gsd/commands-memory.ts +551 -0
- package/src/resources/extensions/gsd/commands-pr-branch.ts +234 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1848 -0
- package/src/resources/extensions/gsd/commands-rate.ts +55 -0
- package/src/resources/extensions/gsd/commands-scan.ts +126 -0
- package/src/resources/extensions/gsd/commands-session-report.ts +101 -0
- package/src/resources/extensions/gsd/commands-ship.ts +292 -0
- package/src/resources/extensions/gsd/commands-verdict.ts +229 -0
- package/src/resources/extensions/gsd/commands-workflow-templates.ts +684 -0
- package/src/resources/extensions/gsd/commands-worktree.ts +383 -0
- package/src/resources/extensions/gsd/commands.ts +17 -0
- package/src/resources/extensions/gsd/compaction-snapshot.ts +165 -0
- package/src/resources/extensions/gsd/complexity-classifier.ts +331 -0
- package/src/resources/extensions/gsd/component-loader.ts +592 -0
- package/src/resources/extensions/gsd/component-types.ts +362 -0
- package/src/resources/extensions/gsd/config-overlay.ts +331 -0
- package/src/resources/extensions/gsd/constants.ts +69 -0
- package/src/resources/extensions/gsd/context-budget.ts +309 -0
- package/src/resources/extensions/gsd/context-injector.ts +100 -0
- package/src/resources/extensions/gsd/context-masker.ts +74 -0
- package/src/resources/extensions/gsd/context-store.ts +497 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +427 -0
- package/src/resources/extensions/gsd/custom-execution-policy.ts +74 -0
- package/src/resources/extensions/gsd/custom-verification.ts +183 -0
- package/src/resources/extensions/gsd/custom-workflow-engine.ts +274 -0
- package/src/resources/extensions/gsd/dashboard-overlay.ts +684 -0
- package/src/resources/extensions/gsd/db/auto-workers.ts +310 -0
- package/src/resources/extensions/gsd/db/command-queue.ts +149 -0
- package/src/resources/extensions/gsd/db/milestone-leases.ts +300 -0
- package/src/resources/extensions/gsd/db/runtime-kv.ts +127 -0
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +554 -0
- package/src/resources/extensions/gsd/db-adapter.ts +75 -0
- package/src/resources/extensions/gsd/db-base-schema.ts +387 -0
- package/src/resources/extensions/gsd/db-connection-cache.ts +45 -0
- package/src/resources/extensions/gsd/db-coordination-schema.ts +109 -0
- package/src/resources/extensions/gsd/db-decision-requirement-rows.ts +77 -0
- package/src/resources/extensions/gsd/db-gate-rows.ts +19 -0
- package/src/resources/extensions/gsd/db-lightweight-query-rows.ts +50 -0
- package/src/resources/extensions/gsd/db-memory-fts-schema.ts +66 -0
- package/src/resources/extensions/gsd/db-migration-backup.ts +34 -0
- package/src/resources/extensions/gsd/db-migration-steps.ts +464 -0
- package/src/resources/extensions/gsd/db-milestone-artifact-rows.ts +70 -0
- package/src/resources/extensions/gsd/db-open-state.ts +47 -0
- package/src/resources/extensions/gsd/db-provider.ts +148 -0
- package/src/resources/extensions/gsd/db-runtime-kv-schema.ts +30 -0
- package/src/resources/extensions/gsd/db-schema-metadata.ts +33 -0
- package/src/resources/extensions/gsd/db-task-slice-rows.ts +150 -0
- package/src/resources/extensions/gsd/db-transaction.ts +76 -0
- package/src/resources/extensions/gsd/db-verification-evidence-rows.ts +14 -0
- package/src/resources/extensions/gsd/db-verification-evidence-schema.ts +22 -0
- package/src/resources/extensions/gsd/db-writer.ts +966 -0
- package/src/resources/extensions/gsd/debug-logger.ts +178 -0
- package/src/resources/extensions/gsd/debug-session-store.ts +377 -0
- package/src/resources/extensions/gsd/deep-project-setup-policy.ts +257 -0
- package/src/resources/extensions/gsd/definition-io.ts +18 -0
- package/src/resources/extensions/gsd/definition-loader.ts +469 -0
- package/src/resources/extensions/gsd/delegation-policy.ts +197 -0
- package/src/resources/extensions/gsd/detection.ts +1339 -0
- package/src/resources/extensions/gsd/dev-execution-policy.ts +51 -0
- package/src/resources/extensions/gsd/dev-workflow-engine.ts +110 -0
- package/src/resources/extensions/gsd/diff-context.ts +214 -0
- package/src/resources/extensions/gsd/dispatch-guard.ts +211 -0
- package/src/resources/extensions/gsd/docs/COORDINATION.md +42 -0
- package/src/resources/extensions/gsd/docs/claude-marketplace-import.md +214 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +755 -0
- package/src/resources/extensions/gsd/doctor-checks.ts +5 -0
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +196 -0
- package/src/resources/extensions/gsd/doctor-environment.ts +643 -0
- package/src/resources/extensions/gsd/doctor-format.ts +99 -0
- package/src/resources/extensions/gsd/doctor-git-checks.ts +622 -0
- package/src/resources/extensions/gsd/doctor-global-checks.ts +84 -0
- package/src/resources/extensions/gsd/doctor-proactive.ts +488 -0
- package/src/resources/extensions/gsd/doctor-providers.ts +523 -0
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +793 -0
- package/src/resources/extensions/gsd/doctor-types.ts +134 -0
- package/src/resources/extensions/gsd/doctor.ts +802 -0
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +233 -0
- package/src/resources/extensions/gsd/ecosystem/loader.ts +201 -0
- package/src/resources/extensions/gsd/engine-resolver.ts +57 -0
- package/src/resources/extensions/gsd/engine-types.ts +71 -0
- package/src/resources/extensions/gsd/env-utils.ts +31 -0
- package/src/resources/extensions/gsd/error-classifier.ts +188 -0
- package/src/resources/extensions/gsd/error-utils.ts +6 -0
- package/src/resources/extensions/gsd/errors.ts +29 -0
- package/src/resources/extensions/gsd/escalation.ts +369 -0
- package/src/resources/extensions/gsd/eval-review-schema.ts +243 -0
- package/src/resources/extensions/gsd/exec-history.ts +153 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +333 -0
- package/src/resources/extensions/gsd/execution-policy.ts +43 -0
- package/src/resources/extensions/gsd/exit-command.ts +30 -0
- package/src/resources/extensions/gsd/export-html.ts +1008 -0
- package/src/resources/extensions/gsd/export.ts +318 -0
- package/src/resources/extensions/gsd/extension-manifest.json +33 -0
- package/src/resources/extensions/gsd/file-lock.ts +132 -0
- package/src/resources/extensions/gsd/files.ts +1009 -0
- package/src/resources/extensions/gsd/forensics.ts +1342 -0
- package/src/resources/extensions/gsd/fresh-run-ui.ts +43 -0
- package/src/resources/extensions/gsd/gate-registry.ts +251 -0
- package/src/resources/extensions/gsd/git-conflict-state.ts +23 -0
- package/src/resources/extensions/gsd/git-constants.ts +41 -0
- package/src/resources/extensions/gsd/git-self-heal.ts +158 -0
- package/src/resources/extensions/gsd/git-service.ts +1412 -0
- package/src/resources/extensions/gsd/gitignore.ts +336 -0
- package/src/resources/extensions/gsd/graph-context.ts +212 -0
- package/src/resources/extensions/gsd/graph.ts +349 -0
- package/src/resources/extensions/gsd/gsd-command-home.ts +209 -0
- package/src/resources/extensions/gsd/gsd-db.ts +3190 -0
- package/src/resources/extensions/gsd/gsd-home.ts +30 -0
- package/src/resources/extensions/gsd/guided-flow-queue.ts +443 -0
- package/src/resources/extensions/gsd/guided-flow.ts +2887 -0
- package/src/resources/extensions/gsd/guided-unit-context.ts +30 -0
- package/src/resources/extensions/gsd/health-widget-core.ts +140 -0
- package/src/resources/extensions/gsd/health-widget.ts +148 -0
- package/src/resources/extensions/gsd/history.ts +144 -0
- package/src/resources/extensions/gsd/hook-emitter.ts +188 -0
- package/src/resources/extensions/gsd/index.ts +37 -0
- package/src/resources/extensions/gsd/init-wizard.ts +704 -0
- package/src/resources/extensions/gsd/interrupted-session.ts +269 -0
- package/src/resources/extensions/gsd/journal.ts +218 -0
- package/src/resources/extensions/gsd/json-persistence.ts +78 -0
- package/src/resources/extensions/gsd/jsonl-utils.ts +21 -0
- package/src/resources/extensions/gsd/key-manager.ts +1018 -0
- package/src/resources/extensions/gsd/knowledge-backfill.ts +164 -0
- package/src/resources/extensions/gsd/knowledge-capture.ts +160 -0
- package/src/resources/extensions/gsd/knowledge-parser.ts +174 -0
- package/src/resources/extensions/gsd/knowledge-projection.ts +241 -0
- package/src/resources/extensions/gsd/legacy-telemetry.ts +99 -0
- package/src/resources/extensions/gsd/markdown-renderer.ts +982 -0
- package/src/resources/extensions/gsd/marketplace-discovery.ts +508 -0
- package/src/resources/extensions/gsd/mcp-filter.ts +80 -0
- package/src/resources/extensions/gsd/mcp-project-config.ts +128 -0
- package/src/resources/extensions/gsd/md-importer.ts +748 -0
- package/src/resources/extensions/gsd/memory-backfill.ts +212 -0
- package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +277 -0
- package/src/resources/extensions/gsd/memory-embeddings.ts +235 -0
- package/src/resources/extensions/gsd/memory-extractor.ts +434 -0
- package/src/resources/extensions/gsd/memory-ingest.ts +286 -0
- package/src/resources/extensions/gsd/memory-relations.ts +240 -0
- package/src/resources/extensions/gsd/memory-source-store.ts +138 -0
- package/src/resources/extensions/gsd/memory-store.ts +909 -0
- package/src/resources/extensions/gsd/metrics.ts +1040 -0
- package/src/resources/extensions/gsd/migrate/audit.ts +219 -0
- package/src/resources/extensions/gsd/migrate/command.ts +341 -0
- package/src/resources/extensions/gsd/migrate/index.ts +44 -0
- package/src/resources/extensions/gsd/migrate/parser.ts +323 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +676 -0
- package/src/resources/extensions/gsd/migrate/preview.ts +58 -0
- package/src/resources/extensions/gsd/migrate/safety.ts +149 -0
- package/src/resources/extensions/gsd/migrate/transformer.ts +411 -0
- package/src/resources/extensions/gsd/migrate/types.ts +370 -0
- package/src/resources/extensions/gsd/migrate/validator.ts +55 -0
- package/src/resources/extensions/gsd/migrate/writer.ts +592 -0
- package/src/resources/extensions/gsd/migrate-external.ts +215 -0
- package/src/resources/extensions/gsd/migration-auto-check.ts +121 -0
- package/src/resources/extensions/gsd/milestone-actions.ts +193 -0
- package/src/resources/extensions/gsd/milestone-id-reservation.ts +47 -0
- package/src/resources/extensions/gsd/milestone-id-utils.ts +32 -0
- package/src/resources/extensions/gsd/milestone-ids.ts +136 -0
- package/src/resources/extensions/gsd/milestone-scope-classifier.ts +373 -0
- package/src/resources/extensions/gsd/milestone-summary-classifier.ts +42 -0
- package/src/resources/extensions/gsd/milestone-validation-gates.ts +53 -0
- package/src/resources/extensions/gsd/model-cost-table.ts +89 -0
- package/src/resources/extensions/gsd/model-router.ts +844 -0
- package/src/resources/extensions/gsd/namespaced-registry.ts +467 -0
- package/src/resources/extensions/gsd/namespaced-resolver.ts +307 -0
- package/src/resources/extensions/gsd/native-git-bridge.ts +1447 -0
- package/src/resources/extensions/gsd/native-parser-bridge.ts +267 -0
- package/src/resources/extensions/gsd/notification-overlay.ts +322 -0
- package/src/resources/extensions/gsd/notification-store.ts +342 -0
- package/src/resources/extensions/gsd/notification-widget.ts +69 -0
- package/src/resources/extensions/gsd/notifications.ts +153 -0
- package/src/resources/extensions/gsd/observability-validator.ts +456 -0
- package/src/resources/extensions/gsd/onboarding-state.ts +146 -0
- package/src/resources/extensions/gsd/orphan-stash-audit.ts +117 -0
- package/src/resources/extensions/gsd/package.json +11 -0
- package/src/resources/extensions/gsd/parallel-eligibility.ts +248 -0
- package/src/resources/extensions/gsd/parallel-merge.ts +270 -0
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +507 -0
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +1077 -0
- package/src/resources/extensions/gsd/parsers-legacy.ts +292 -0
- package/src/resources/extensions/gsd/paths.ts +722 -0
- package/src/resources/extensions/gsd/pending-auto-start.ts +81 -0
- package/src/resources/extensions/gsd/phase-anchor.ts +71 -0
- package/src/resources/extensions/gsd/planning-depth.ts +137 -0
- package/src/resources/extensions/gsd/planning-path-scope.ts +45 -0
- package/src/resources/extensions/gsd/plugin-importer.ts +411 -0
- package/src/resources/extensions/gsd/post-execution-checks.ts +665 -0
- package/src/resources/extensions/gsd/post-unit-hooks.ts +86 -0
- package/src/resources/extensions/gsd/pr-evidence.ts +182 -0
- package/src/resources/extensions/gsd/pre-execution-checks.ts +890 -0
- package/src/resources/extensions/gsd/preferences-mcp.ts +27 -0
- package/src/resources/extensions/gsd/preferences-models.ts +572 -0
- package/src/resources/extensions/gsd/preferences-skills.ts +147 -0
- package/src/resources/extensions/gsd/preferences-types.ts +579 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +1453 -0
- package/src/resources/extensions/gsd/preferences.ts +697 -0
- package/src/resources/extensions/gsd/preparation.ts +1419 -0
- package/src/resources/extensions/gsd/process-task-path.ts +81 -0
- package/src/resources/extensions/gsd/progress-score.ts +161 -0
- package/src/resources/extensions/gsd/project-research-policy.ts +259 -0
- package/src/resources/extensions/gsd/prompt-cache-optimizer.ts +217 -0
- package/src/resources/extensions/gsd/prompt-loader.ts +248 -0
- package/src/resources/extensions/gsd/prompt-ordering.ts +200 -0
- package/src/resources/extensions/gsd/prompt-validation.ts +157 -0
- package/src/resources/extensions/gsd/prompts/add-tests.md +36 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +91 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +49 -0
- package/src/resources/extensions/gsd/prompts/debug-diagnose.md +27 -0
- package/src/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +252 -0
- package/src/resources/extensions/gsd/prompts/discuss.md +368 -0
- package/src/resources/extensions/gsd/prompts/doctor-heal.md +31 -0
- package/src/resources/extensions/gsd/prompts/execute-task.md +73 -0
- package/src/resources/extensions/gsd/prompts/forensics.md +155 -0
- package/src/resources/extensions/gsd/prompts/gate-evaluate.md +32 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +116 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +113 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +99 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +74 -0
- package/src/resources/extensions/gsd/prompts/guided-research-decision.md +70 -0
- package/src/resources/extensions/gsd/prompts/guided-research-project.md +102 -0
- package/src/resources/extensions/gsd/prompts/guided-research-slice.md +15 -0
- package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -0
- package/src/resources/extensions/gsd/prompts/guided-workflow-preferences.md +68 -0
- package/src/resources/extensions/gsd/prompts/heal-skill.md +45 -0
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +28 -0
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +114 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +55 -0
- package/src/resources/extensions/gsd/prompts/queue.md +128 -0
- package/src/resources/extensions/gsd/prompts/quick-task.md +40 -0
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +44 -0
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +68 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +79 -0
- package/src/resources/extensions/gsd/prompts/replan-slice.md +39 -0
- package/src/resources/extensions/gsd/prompts/research-milestone.md +47 -0
- package/src/resources/extensions/gsd/prompts/research-slice.md +58 -0
- package/src/resources/extensions/gsd/prompts/rethink.md +95 -0
- package/src/resources/extensions/gsd/prompts/review-migration.md +66 -0
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +33 -0
- package/src/resources/extensions/gsd/prompts/run-uat.md +89 -0
- package/src/resources/extensions/gsd/prompts/scan.md +79 -0
- package/src/resources/extensions/gsd/prompts/system.md +180 -0
- package/src/resources/extensions/gsd/prompts/triage-captures.md +68 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +88 -0
- package/src/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
- package/src/resources/extensions/gsd/prompts/workflow-start.md +28 -0
- package/src/resources/extensions/gsd/prompts/worktree-merge.md +125 -0
- package/src/resources/extensions/gsd/provider-error-pause.ts +49 -0
- package/src/resources/extensions/gsd/provider-switch-observer.ts +185 -0
- package/src/resources/extensions/gsd/python-resolver.ts +76 -0
- package/src/resources/extensions/gsd/queue-order.ts +235 -0
- package/src/resources/extensions/gsd/queue-reorder-ui.ts +295 -0
- package/src/resources/extensions/gsd/quick.ts +297 -0
- package/src/resources/extensions/gsd/reactive-graph.ts +337 -0
- package/src/resources/extensions/gsd/recovery-classification.ts +139 -0
- package/src/resources/extensions/gsd/repo-identity.ts +683 -0
- package/src/resources/extensions/gsd/reports.ts +505 -0
- package/src/resources/extensions/gsd/repository-registry.ts +108 -0
- package/src/resources/extensions/gsd/rethink.ts +164 -0
- package/src/resources/extensions/gsd/roadmap-mutations.ts +134 -0
- package/src/resources/extensions/gsd/roadmap-slices.ts +294 -0
- package/src/resources/extensions/gsd/root-write-leak-guard.ts +101 -0
- package/src/resources/extensions/gsd/routing-history.ts +286 -0
- package/src/resources/extensions/gsd/rule-registry.ts +599 -0
- package/src/resources/extensions/gsd/rule-types.ts +68 -0
- package/src/resources/extensions/gsd/run-manager.ts +214 -0
- package/src/resources/extensions/gsd/safe-fs.ts +48 -0
- package/src/resources/extensions/gsd/safety/content-validator.ts +98 -0
- package/src/resources/extensions/gsd/safety/destructive-guard.ts +49 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +265 -0
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +155 -0
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +124 -0
- package/src/resources/extensions/gsd/safety/git-checkpoint.ts +130 -0
- package/src/resources/extensions/gsd/safety/safety-harness.ts +114 -0
- package/src/resources/extensions/gsd/schemas/__fixtures__/valid-project.md +26 -0
- package/src/resources/extensions/gsd/schemas/__fixtures__/valid-requirements.md +57 -0
- package/src/resources/extensions/gsd/schemas/__fixtures__/valid-roadmap.md +19 -0
- package/src/resources/extensions/gsd/schemas/parsers.ts +346 -0
- package/src/resources/extensions/gsd/schemas/validate.ts +452 -0
- package/src/resources/extensions/gsd/service-tier.ts +199 -0
- package/src/resources/extensions/gsd/session-forensics.ts +580 -0
- package/src/resources/extensions/gsd/session-lock.ts +732 -0
- package/src/resources/extensions/gsd/session-model-override.ts +36 -0
- package/src/resources/extensions/gsd/session-status-io.ts +179 -0
- package/src/resources/extensions/gsd/setup-catalog.ts +105 -0
- package/src/resources/extensions/gsd/shortcut-defs.ts +56 -0
- package/src/resources/extensions/gsd/skill-catalog.ts +1088 -0
- package/src/resources/extensions/gsd/skill-discovery.ts +157 -0
- package/src/resources/extensions/gsd/skill-health.ts +422 -0
- package/src/resources/extensions/gsd/skill-manifest.ts +175 -0
- package/src/resources/extensions/gsd/skill-telemetry.ts +141 -0
- package/src/resources/extensions/gsd/skills/gsd-headless/SKILL.md +242 -0
- package/src/resources/extensions/gsd/skills/gsd-headless/references/answer-injection.md +83 -0
- package/src/resources/extensions/gsd/skills/gsd-headless/references/commands.md +64 -0
- package/src/resources/extensions/gsd/skills/gsd-headless/references/multi-session.md +176 -0
- package/src/resources/extensions/gsd/slice-cadence.ts +411 -0
- package/src/resources/extensions/gsd/slice-parallel-conflict.ts +86 -0
- package/src/resources/extensions/gsd/slice-parallel-eligibility.ts +73 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +913 -0
- package/src/resources/extensions/gsd/smart-entry-routing.ts +77 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/completion.ts +172 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +417 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +66 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +101 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/sketch-flag.ts +68 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/stale-render.ts +185 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/stale-worker.ts +46 -0
- package/src/resources/extensions/gsd/state-reconciliation/errors.ts +67 -0
- package/src/resources/extensions/gsd/state-reconciliation/index.ts +142 -0
- package/src/resources/extensions/gsd/state-reconciliation/registry.ts +27 -0
- package/src/resources/extensions/gsd/state-reconciliation/spawn-gate.ts +65 -0
- package/src/resources/extensions/gsd/state-reconciliation/types.ts +83 -0
- package/src/resources/extensions/gsd/state-reconciliation.ts +25 -0
- package/src/resources/extensions/gsd/state-transition-matrix.ts +152 -0
- package/src/resources/extensions/gsd/state.ts +1730 -0
- package/src/resources/extensions/gsd/status-guards.ts +41 -0
- package/src/resources/extensions/gsd/structured-data-formatter.ts +146 -0
- package/src/resources/extensions/gsd/sync-lock.ts +152 -0
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +101 -0
- package/src/resources/extensions/gsd/templates/context.md +108 -0
- package/src/resources/extensions/gsd/templates/decisions.md +8 -0
- package/src/resources/extensions/gsd/templates/knowledge.md +19 -0
- package/src/resources/extensions/gsd/templates/milestone-summary.md +81 -0
- package/src/resources/extensions/gsd/templates/milestone-validation.md +74 -0
- package/src/resources/extensions/gsd/templates/plan.md +152 -0
- package/src/resources/extensions/gsd/templates/project.md +41 -0
- package/src/resources/extensions/gsd/templates/reassessment.md +29 -0
- package/src/resources/extensions/gsd/templates/requirements.md +81 -0
- package/src/resources/extensions/gsd/templates/research.md +79 -0
- package/src/resources/extensions/gsd/templates/roadmap.md +131 -0
- package/src/resources/extensions/gsd/templates/runtime.md +21 -0
- package/src/resources/extensions/gsd/templates/secrets-manifest.md +22 -0
- package/src/resources/extensions/gsd/templates/slice-context.md +58 -0
- package/src/resources/extensions/gsd/templates/slice-summary.md +108 -0
- package/src/resources/extensions/gsd/templates/state.md +17 -0
- package/src/resources/extensions/gsd/templates/task-plan.md +95 -0
- package/src/resources/extensions/gsd/templates/task-summary.md +66 -0
- package/src/resources/extensions/gsd/templates/uat.md +54 -0
- package/src/resources/extensions/gsd/tests/active-milestone-id-guard.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/activity-log.test.ts +175 -0
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +80 -0
- package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +296 -0
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/artifact-validators.test.ts +524 -0
- package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +143 -0
- package/src/resources/extensions/gsd/tests/ask-user-questions-dedup.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/atomic-write.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/auto-blocked-remediation-message.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +807 -0
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +457 -0
- package/src/resources/extensions/gsd/tests/auto-discuss-milestone-deadlock-4973.test.ts +289 -0
- package/src/resources/extensions/gsd/tests/auto-loop-no-copy-artifacts.test.ts +72 -0
- package/src/resources/extensions/gsd/tests/auto-loop-symlink-worktree.test.ts +190 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +5503 -0
- package/src/resources/extensions/gsd/tests/auto-migrating-recovery.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/auto-milestone-target.test.ts +61 -0
- package/src/resources/extensions/gsd/tests/auto-mode-guards.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/auto-mode-interactive-guard.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection-tool-poisoning.test.ts +742 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +479 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +1300 -0
- package/src/resources/extensions/gsd/tests/auto-pause-double-entry-guard.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/auto-paused-session-validation.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +759 -0
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +390 -0
- package/src/resources/extensions/gsd/tests/auto-post-unit-artifact-diagnostic.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/auto-post-unit-evidence-crossref-4909.test.ts +60 -0
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +218 -0
- package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +74 -0
- package/src/resources/extensions/gsd/tests/auto-prompts-fallback.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +1773 -0
- package/src/resources/extensions/gsd/tests/auto-remediate-slice-status.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +277 -0
- package/src/resources/extensions/gsd/tests/auto-session-scope.test.ts +348 -0
- package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/auto-start-clean-runtime-db-gated.test.ts +61 -0
- package/src/resources/extensions/gsd/tests/auto-start-cold-db-bootstrap.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/auto-start-index-lock.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/auto-start-needs-discussion.test.ts +175 -0
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +161 -0
- package/src/resources/extensions/gsd/tests/auto-start-project-milestone-reconcile.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/auto-start-time-persistence.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/auto-start-validation-block.test.ts +52 -0
- package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/auto-status-message.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/auto-stop-notification.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/auto-supervisor.test.mjs +70 -0
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/auto-unit-closeout.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/auto-workers.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-auto-resolve.test.ts +80 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +244 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-repair.test.ts +199 -0
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +171 -0
- package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +143 -0
- package/src/resources/extensions/gsd/tests/block-db-writes.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/blocked-models.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/browser-teardown.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/browser-tools-compatibility-declarations.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/budget-prediction.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/bundled-skill-triggers.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/bundled-workflow-defs.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +290 -0
- package/src/resources/extensions/gsd/tests/canonical-milestone-root.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/capability-router.test.ts +371 -0
- package/src/resources/extensions/gsd/tests/captures.test.ts +524 -0
- package/src/resources/extensions/gsd/tests/check-auto-start-pending-gate.test.ts +203 -0
- package/src/resources/extensions/gsd/tests/check-auto-start-ready-guard.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/claude-import-marketplace-discovery.test.ts +191 -0
- package/src/resources/extensions/gsd/tests/claude-import-tui.test.ts +350 -0
- package/src/resources/extensions/gsd/tests/claude-skill-dirs.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +509 -0
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/cli-provider-rate-limit.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/closeout-recovery.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/cmux.test.ts +333 -0
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +669 -0
- package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/collect-from-manifest.test.ts +506 -0
- package/src/resources/extensions/gsd/tests/collision-diagnostics.test.ts +705 -0
- package/src/resources/extensions/gsd/tests/command-queue.test.ts +141 -0
- package/src/resources/extensions/gsd/tests/commands-backlog.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/commands-config.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/commands-dispatcher-unmerged-milestone.test.ts +188 -0
- package/src/resources/extensions/gsd/tests/commands-dispatcher-validation-block.test.ts +178 -0
- package/src/resources/extensions/gsd/tests/commands-do.test.ts +175 -0
- package/src/resources/extensions/gsd/tests/commands-eval-review.test.ts +612 -0
- package/src/resources/extensions/gsd/tests/commands-extensions-version-compare.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +663 -0
- package/src/resources/extensions/gsd/tests/commands-inspect-open-db.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/commands-logs.test.ts +241 -0
- package/src/resources/extensions/gsd/tests/commands-pr-branch.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/commands-scan.test.ts +351 -0
- package/src/resources/extensions/gsd/tests/commands-session-report.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/commands-ship-eval-warn.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/commands-ship.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +439 -0
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +311 -0
- package/src/resources/extensions/gsd/tests/commands-worktree-clean.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +136 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +366 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-prompt-rendering.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +743 -0
- package/src/resources/extensions/gsd/tests/complete-slice-composer.test.ts +193 -0
- package/src/resources/extensions/gsd/tests/complete-slice-gate-closure.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/complete-slice-prompt-task-summary-layout.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/complete-slice-string-coercion.test.ts +247 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +556 -0
- package/src/resources/extensions/gsd/tests/complete-task-normalize-lists.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/complete-task-rollback-evidence.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +513 -0
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +84 -0
- package/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts +61 -0
- package/src/resources/extensions/gsd/tests/completion-hierarchy-guards.test.ts +192 -0
- package/src/resources/extensions/gsd/tests/complexity-classifier.test.ts +206 -0
- package/src/resources/extensions/gsd/tests/component-loader.test.ts +582 -0
- package/src/resources/extensions/gsd/tests/component-types.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/context-budget.test.ts +389 -0
- package/src/resources/extensions/gsd/tests/context-injector.test.ts +313 -0
- package/src/resources/extensions/gsd/tests/context-masker.test.ts +122 -0
- package/src/resources/extensions/gsd/tests/context-store-decisions-from-memories.test.ts +312 -0
- package/src/resources/extensions/gsd/tests/context-store.test.ts +715 -0
- package/src/resources/extensions/gsd/tests/core-overlay-fallback.test.ts +185 -0
- package/src/resources/extensions/gsd/tests/cost-projection.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +294 -0
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +331 -0
- package/src/resources/extensions/gsd/tests/crash-recovery.test.ts +709 -0
- package/src/resources/extensions/gsd/tests/current-directory-root-homedir-fallback.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +902 -0
- package/src/resources/extensions/gsd/tests/custom-verification.test.ts +415 -0
- package/src/resources/extensions/gsd/tests/custom-verify-retry-store.test.ts +139 -0
- package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +483 -0
- package/src/resources/extensions/gsd/tests/cwd-fallback-hardening.test.ts +138 -0
- package/src/resources/extensions/gsd/tests/dashboard-budget.test.ts +360 -0
- package/src/resources/extensions/gsd/tests/dashboard-custom-engine.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/db-access-guardrails.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/db-adapter.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/db-base-schema.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/db-connection-cache.test.ts +60 -0
- package/src/resources/extensions/gsd/tests/db-coordination-schema.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/db-decision-requirement-rows.test.ts +135 -0
- package/src/resources/extensions/gsd/tests/db-gate-rows.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/db-lightweight-query-rows.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/db-memory-fts-schema.test.ts +86 -0
- package/src/resources/extensions/gsd/tests/db-migration-backup.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/db-migration-steps.integration.test.ts +428 -0
- package/src/resources/extensions/gsd/tests/db-migration-steps.test.ts +159 -0
- package/src/resources/extensions/gsd/tests/db-milestone-artifact-rows.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/db-open-state.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/db-provider.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/db-runtime-kv-schema.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/db-schema-metadata.test.ts +115 -0
- package/src/resources/extensions/gsd/tests/db-task-slice-rows.test.ts +130 -0
- package/src/resources/extensions/gsd/tests/db-transaction.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/db-verification-evidence-schema.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/db-writer-path-containment.test.ts +152 -0
- package/src/resources/extensions/gsd/tests/db-writer-root-artifact.test.ts +221 -0
- package/src/resources/extensions/gsd/tests/db-writer-scope.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +980 -0
- package/src/resources/extensions/gsd/tests/debug-command-handler.test.ts +942 -0
- package/src/resources/extensions/gsd/tests/debug-command-lifecycle.integration.test.ts +1229 -0
- package/src/resources/extensions/gsd/tests/debug-logger.test.ts +187 -0
- package/src/resources/extensions/gsd/tests/debug-session-store.test.ts +565 -0
- package/src/resources/extensions/gsd/tests/decision-scope-cascade.test.ts +370 -0
- package/src/resources/extensions/gsd/tests/decisions-projection-from-memories.test.ts +453 -0
- package/src/resources/extensions/gsd/tests/decisions-stop-table-writes.test.ts +348 -0
- package/src/resources/extensions/gsd/tests/deep-mode-integration.test.ts +406 -0
- package/src/resources/extensions/gsd/tests/deep-planning-mode-dispatch.test.ts +923 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +1705 -0
- package/src/resources/extensions/gsd/tests/deep-project-setup-policy.test.ts +193 -0
- package/src/resources/extensions/gsd/tests/defer-milestone-stamp.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/deferred-milestone-dir-4996.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/deferred-slice-dispatch.test.ts +203 -0
- package/src/resources/extensions/gsd/tests/definition-io.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/definition-loader.test.ts +762 -0
- package/src/resources/extensions/gsd/tests/delegation-policy.test.ts +151 -0
- package/src/resources/extensions/gsd/tests/derive-state-crossval.test.ts +514 -0
- package/src/resources/extensions/gsd/tests/derive-state-db-disk-reconcile.test.ts +133 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +1388 -0
- package/src/resources/extensions/gsd/tests/derive-state-deps.test.ts +641 -0
- package/src/resources/extensions/gsd/tests/derive-state-draft.test.ts +313 -0
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +558 -0
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +1049 -0
- package/src/resources/extensions/gsd/tests/detect-stuck-respects-retry.test.ts +173 -0
- package/src/resources/extensions/gsd/tests/detection.test.ts +1367 -0
- package/src/resources/extensions/gsd/tests/dev-engine-wrapper.test.ts +314 -0
- package/src/resources/extensions/gsd/tests/diff-context.test.ts +136 -0
- package/src/resources/extensions/gsd/tests/discord-invite-links.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/discuss-cold-start-db-open.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/discuss-command-targeting-5471.test.ts +125 -0
- package/src/resources/extensions/gsd/tests/discuss-empty-db-fallback.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/discuss-headless-rendering.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/discuss-incremental-persistence.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/discuss-milestone-structured-questions.test.ts +115 -0
- package/src/resources/extensions/gsd/tests/discuss-prompt.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/discuss-queued-milestones.test.ts +170 -0
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/discuss-tool-scoping.test.ts +138 -0
- package/src/resources/extensions/gsd/tests/dispatch-backgroundable-annotation.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +276 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard-closed-status.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard-summary-db-mismatch.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +446 -0
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +279 -0
- package/src/resources/extensions/gsd/tests/dispatch-rule-coverage.test.ts +358 -0
- package/src/resources/extensions/gsd/tests/dispatch-uat-last-completed.test.ts +206 -0
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/dist-redirect.mjs +112 -0
- package/src/resources/extensions/gsd/tests/doctor-empty-worktree.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/doctor-fix-flag.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/doctor-forensics-db-open-regression.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/doctor-orphan-milestone-4996.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +828 -0
- package/src/resources/extensions/gsd/tests/doctor-runtime-checks.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/doctor-scope-db-unavailable.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/draft-promotion.test.ts +149 -0
- package/src/resources/extensions/gsd/tests/dynamic-routing-default.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/engine-interfaces-contract.test.ts +271 -0
- package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +531 -0
- package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +530 -0
- package/src/resources/extensions/gsd/tests/ensure-preconditions-guard-4996.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/error-success-mask.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/escalation.test.ts +819 -0
- package/src/resources/extensions/gsd/tests/est-annotation-timeout.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/eval-review-schema.test.ts +282 -0
- package/src/resources/extensions/gsd/tests/event-replay-idempotency.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +121 -0
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +252 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +407 -0
- package/src/resources/extensions/gsd/tests/execute-summary-save-empty-project.test.ts +109 -0
- package/src/resources/extensions/gsd/tests/execute-task-prompt-existing-artifact-guard.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/execution-entry-missing-context-4671.test.ts +187 -0
- package/src/resources/extensions/gsd/tests/exit-command.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/export-html-all.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +387 -0
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +164 -0
- package/src/resources/extensions/gsd/tests/extension-selector-separator.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/fast-forward-reused-milestone-branch.test.ts +219 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/file-lock.test.ts +177 -0
- package/src/resources/extensions/gsd/tests/files-loadfile-eisdir.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/finalize-survivor-branch.test.ts +151 -0
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed-runtime.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-basic.md +52 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-empty-optionals.md +42 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +55 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +60 -0
- package/src/resources/extensions/gsd/tests/flag-file-db.test.ts +278 -0
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +305 -0
- package/src/resources/extensions/gsd/tests/forensics-error-filter.test.ts +121 -0
- package/src/resources/extensions/gsd/tests/forensics-issue-routing.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/forensics-prompt-rendering.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +215 -0
- package/src/resources/extensions/gsd/tests/format-shortcut.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/freeform-decisions.test.ts +298 -0
- package/src/resources/extensions/gsd/tests/fresh-run-ui.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/frontmatter-parse-noise.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/gate-1b-orphan-discrimination.test.ts +193 -0
- package/src/resources/extensions/gsd/tests/gate-1b-recovery-bound-corrections.test.ts +246 -0
- package/src/resources/extensions/gsd/tests/gate-1b-recovery-bound.test.ts +218 -0
- package/src/resources/extensions/gsd/tests/gate-dispatch.test.ts +216 -0
- package/src/resources/extensions/gsd/tests/gate-registry.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/gate-state-canonicalization.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/gate-storage.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/git-checkpoint.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell-runtime.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/google-search-stub.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/graph-context.test.ts +337 -0
- package/src/resources/extensions/gsd/tests/graph-operations.test.ts +599 -0
- package/src/resources/extensions/gsd/tests/gsd-command-home.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/gsd-db-failed-open-restore.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/gsd-db-workspace-scope.test.ts +226 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +1210 -0
- package/src/resources/extensions/gsd/tests/gsd-home.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/gsd-inspect.test.ts +114 -0
- package/src/resources/extensions/gsd/tests/gsd-no-project-error-runtime.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/gsd-recover.test.ts +440 -0
- package/src/resources/extensions/gsd/tests/gsd-root-canonical.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/gsd-root-home-guard.test.ts +149 -0
- package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +445 -0
- package/src/resources/extensions/gsd/tests/gsdroot-worktree-detection.test.ts +146 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-milestone-prompt-rendering.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-requirements-prompt-rendering.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/guided-flow-dynamic-routing.test.ts +135 -0
- package/src/resources/extensions/gsd/tests/guided-flow-prompt-consolidation.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +219 -0
- package/src/resources/extensions/gsd/tests/guided-flow-state-rebuild.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/guided-tool-contract.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/handler-worktree-write-isolation.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/has-pending-deep-stage.test.ts +130 -0
- package/src/resources/extensions/gsd/tests/header-renderer.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/headless-answers.test.ts +350 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/headless-query.test.ts +184 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +251 -0
- package/src/resources/extensions/gsd/tests/help-menu-coverage.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/hook-key-parsing.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/import-done-milestones-runtime.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/in-flight-tool-tracking.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +129 -0
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +189 -0
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +275 -0
- package/src/resources/extensions/gsd/tests/init-skip-git.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/init-wizard.test.ts +239 -0
- package/src/resources/extensions/gsd/tests/insert-slice-no-wipe.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/integration/all-milestones-complete-merge.test.ts +199 -0
- package/src/resources/extensions/gsd/tests/integration/atomic-task-closeout.test.ts +72 -0
- package/src/resources/extensions/gsd/tests/integration/auto-preflight.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +966 -0
- package/src/resources/extensions/gsd/tests/integration/auto-secrets-gate.test.ts +194 -0
- package/src/resources/extensions/gsd/tests/integration/auto-stash-merge.test.ts +121 -0
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +964 -0
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +430 -0
- package/src/resources/extensions/gsd/tests/integration/commands-eval-review.integration.test.ts +256 -0
- package/src/resources/extensions/gsd/tests/integration/continue-here.test.ts +281 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-completion-deferral.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-delimiter-fix.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-enhancements.test.ts +243 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-environment-worktree.test.ts +164 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-environment.test.ts +403 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-false-positives.test.ts +243 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-fixlevel.test.ts +263 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git-symlink-cwd.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +954 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +431 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-roadmap-summary-atomicity.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +549 -0
- package/src/resources/extensions/gsd/tests/integration/doctor.test.ts +612 -0
- package/src/resources/extensions/gsd/tests/integration/e2e-workflow-pipeline-integration.test.ts +476 -0
- package/src/resources/extensions/gsd/tests/integration/feature-branch-lifecycle-integration.test.ts +415 -0
- package/src/resources/extensions/gsd/tests/integration/git-locale.test.ts +130 -0
- package/src/resources/extensions/gsd/tests/integration/git-self-heal.test.ts +131 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +2040 -0
- package/src/resources/extensions/gsd/tests/integration/gitignore-staging-2570.test.ts +150 -0
- package/src/resources/extensions/gsd/tests/integration/gitignore-tracked-gsd.test.ts +257 -0
- package/src/resources/extensions/gsd/tests/integration/headless-command.ts +534 -0
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +474 -0
- package/src/resources/extensions/gsd/tests/integration/inherited-repo-home-dir.test.ts +191 -0
- package/src/resources/extensions/gsd/tests/integration/integration-lifecycle.test.ts +274 -0
- package/src/resources/extensions/gsd/tests/integration/integration-mixed-milestones.test.ts +539 -0
- package/src/resources/extensions/gsd/tests/integration/integration-proof.test.ts +634 -0
- package/src/resources/extensions/gsd/tests/integration/merge-cwd-restore.test.ts +169 -0
- package/src/resources/extensions/gsd/tests/integration/merge-preserve-worktree-on-preteardown-error.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/integration/migrate-command.test.ts +405 -0
- package/src/resources/extensions/gsd/tests/integration/milestone-transition-worktree.test.ts +119 -0
- package/src/resources/extensions/gsd/tests/integration/parallel-merge.test.ts +669 -0
- package/src/resources/extensions/gsd/tests/integration/parallel-workers-multi-milestone-e2e.test.ts +337 -0
- package/src/resources/extensions/gsd/tests/integration/paths.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/integration/plugin-importer-live.test.ts +481 -0
- package/src/resources/extensions/gsd/tests/integration/queue-completed-milestone-perf.test.ts +161 -0
- package/src/resources/extensions/gsd/tests/integration/queue-reorder-e2e.test.ts +335 -0
- package/src/resources/extensions/gsd/tests/integration/quick-branch-lifecycle.test.ts +253 -0
- package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +689 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +1356 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +980 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +832 -0
- package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
- package/src/resources/extensions/gsd/tests/integration/token-savings.test.ts +341 -0
- package/src/resources/extensions/gsd/tests/integration/workspace-collapse-integration.test.ts +369 -0
- package/src/resources/extensions/gsd/tests/integration/worktree-e2e.test.ts +248 -0
- package/src/resources/extensions/gsd/tests/integration-edge.test.ts +223 -0
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/interactive-tool-idle-exemption.test.ts +119 -0
- package/src/resources/extensions/gsd/tests/interrupted-session-auto.test.ts +241 -0
- package/src/resources/extensions/gsd/tests/interrupted-session-ui.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/issue-4540-regressions.test.ts +288 -0
- package/src/resources/extensions/gsd/tests/iterate-engine-integration.test.ts +429 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +1473 -0
- package/src/resources/extensions/gsd/tests/journal-query-tool.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/journal.test.ts +373 -0
- package/src/resources/extensions/gsd/tests/json-persistence-atomic.test.ts +183 -0
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +501 -0
- package/src/resources/extensions/gsd/tests/knowledge-backfill-projection.test.ts +323 -0
- package/src/resources/extensions/gsd/tests/knowledge-capture.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +434 -0
- package/src/resources/extensions/gsd/tests/lazy-pi-tui-import.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/lease-conflict-notice.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/legacy-component-format-telemetry.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/legacy-telemetry.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/load-knowledge-block-rules-only.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/load-memory-block.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/manifest-status.test.ts +274 -0
- package/src/resources/extensions/gsd/tests/markdown-renderer.test.ts +1292 -0
- package/src/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +91 -0
- package/src/resources/extensions/gsd/tests/mcp-client-security.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/mcp-filter.test.ts +287 -0
- package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +183 -0
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +416 -0
- package/src/resources/extensions/gsd/tests/measurement.test.ts +531 -0
- package/src/resources/extensions/gsd/tests/memory-consolidation-scanner.test.ts +316 -0
- package/src/resources/extensions/gsd/tests/memory-decay-factor.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/memory-embeddings.test.ts +213 -0
- package/src/resources/extensions/gsd/tests/memory-extractor.test.ts +244 -0
- package/src/resources/extensions/gsd/tests/memory-ingest.test.ts +153 -0
- package/src/resources/extensions/gsd/tests/memory-leak-guards.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/memory-maintenance.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/memory-relations.test.ts +175 -0
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +460 -0
- package/src/resources/extensions/gsd/tests/memory-tools.test.ts +327 -0
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +303 -0
- package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/merge-self-branch-guard.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/metrics-atomic-merge.test.ts +222 -0
- package/src/resources/extensions/gsd/tests/metrics-lock-hardening.test.ts +400 -0
- package/src/resources/extensions/gsd/tests/metrics-lock-not-acquired.test.ts +141 -0
- package/src/resources/extensions/gsd/tests/metrics-lock-retry-sleep.test.ts +287 -0
- package/src/resources/extensions/gsd/tests/metrics-milestone-scope.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/metrics-prune-cache-invalidation.test.ts +149 -0
- package/src/resources/extensions/gsd/tests/metrics-scope.test.ts +378 -0
- package/src/resources/extensions/gsd/tests/metrics.test.ts +519 -0
- package/src/resources/extensions/gsd/tests/migrate-external-worktree.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/migrate-hierarchy.test.ts +429 -0
- package/src/resources/extensions/gsd/tests/migrate-parser.test.ts +782 -0
- package/src/resources/extensions/gsd/tests/migrate-safety-audit.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/migrate-transformer.test.ts +651 -0
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +448 -0
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +347 -0
- package/src/resources/extensions/gsd/tests/migrate-writer.test.ts +361 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +135 -0
- package/src/resources/extensions/gsd/tests/milestone-id-gap-reuse-4996.test.ts +152 -0
- package/src/resources/extensions/gsd/tests/milestone-id-reservation.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/milestone-leases.test.ts +152 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-stash-restore.test.ts +364 -0
- package/src/resources/extensions/gsd/tests/milestone-report-path.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/milestone-scope-classifier.test.ts +206 -0
- package/src/resources/extensions/gsd/tests/milestone-status-authoritative.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +202 -0
- package/src/resources/extensions/gsd/tests/milestone-summary-classifier.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +122 -0
- package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +111 -0
- package/src/resources/extensions/gsd/tests/model-isolation.test.ts +305 -0
- package/src/resources/extensions/gsd/tests/model-router.test.ts +990 -0
- package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/must-have-parser.test.ts +278 -0
- package/src/resources/extensions/gsd/tests/namespaced-registry.test.ts +1027 -0
- package/src/resources/extensions/gsd/tests/namespaced-resolver.test.ts +671 -0
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +228 -0
- package/src/resources/extensions/gsd/tests/native-git-infra-errors.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/native-has-changes-cache.test.ts +61 -0
- package/src/resources/extensions/gsd/tests/needs-remediation-revalidation.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/next-milestone-id.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/none-mode-gates.test.ts +200 -0
- package/src/resources/extensions/gsd/tests/note-captures-executed.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +129 -0
- package/src/resources/extensions/gsd/tests/notification-store.test.ts +325 -0
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/notifications-handler.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/notifications.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/onboarding-state.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/originalbase-path-comparison.test.ts +159 -0
- package/src/resources/extensions/gsd/tests/orphan-merge-bootstrap.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/orphan-stash-audit.test.ts +201 -0
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +374 -0
- package/src/resources/extensions/gsd/tests/overrides.test.ts +124 -0
- package/src/resources/extensions/gsd/tests/parallel-budget-atomicity.test.ts +330 -0
- package/src/resources/extensions/gsd/tests/parallel-commit-scope.test.ts +164 -0
- package/src/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +273 -0
- package/src/resources/extensions/gsd/tests/parallel-eligibility-ghost.test.ts +170 -0
- package/src/resources/extensions/gsd/tests/parallel-milestone-isolation.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +114 -0
- package/src/resources/extensions/gsd/tests/parallel-orchestration.test.ts +736 -0
- package/src/resources/extensions/gsd/tests/parallel-orchestrator-fast-forward.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/parallel-orchestrator-zombie-cleanup.test.ts +332 -0
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +308 -0
- package/src/resources/extensions/gsd/tests/parallel-skill-prompt-integration.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/parallel-worker-lock-contention.test.ts +226 -0
- package/src/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +199 -0
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +157 -0
- package/src/resources/extensions/gsd/tests/park-edge-cases.test.ts +253 -0
- package/src/resources/extensions/gsd/tests/park-milestone.test.ts +420 -0
- package/src/resources/extensions/gsd/tests/parsers.test.ts +1892 -0
- package/src/resources/extensions/gsd/tests/path-cache-decoupled.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/path-normalization-unified.test.ts +175 -0
- package/src/resources/extensions/gsd/tests/paths-cache.test.ts +170 -0
- package/src/resources/extensions/gsd/tests/paused-session-via-db.test.ts +121 -0
- package/src/resources/extensions/gsd/tests/pending-autostart-scope.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/phantom-ghost-detection.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/phantom-milestone-default-queued.test.ts +24 -0
- package/src/resources/extensions/gsd/tests/phase-anchor.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +126 -0
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +404 -0
- package/src/resources/extensions/gsd/tests/plan-gate-failed-doctor-heal-hint.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-artifact-verification.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-boundary-map-preservation.test.ts +114 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-queue-context.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-rendering.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-sketch-render.test.ts +157 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-title.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +349 -0
- package/src/resources/extensions/gsd/tests/plan-quality-validator.test.ts +474 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +306 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +712 -0
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +183 -0
- package/src/resources/extensions/gsd/tests/planning-crossval.test.ts +305 -0
- package/src/resources/extensions/gsd/tests/planning-depth-setter.test.ts +172 -0
- package/src/resources/extensions/gsd/tests/plugin-importer.test.ts +1383 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +536 -0
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +1065 -0
- package/src/resources/extensions/gsd/tests/post-mutation-hook.test.ts +171 -0
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/post-unit-hooks.test.ts +300 -0
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +567 -0
- package/src/resources/extensions/gsd/tests/pr-evidence-equivalence.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/pr-evidence-hardening.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/pr-evidence.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +149 -0
- package/src/resources/extensions/gsd/tests/pre-exec-gate-loop.test.ts +275 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +2246 -0
- package/src/resources/extensions/gsd/tests/pre-execution-fail-closed.test.ts +244 -0
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +708 -0
- package/src/resources/extensions/gsd/tests/preferences-formatting.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/preferences-mcp.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/preferences-worktree-sync.test.ts +118 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +1314 -0
- package/src/resources/extensions/gsd/tests/preflight-context-draft-filter.test.ts +115 -0
- package/src/resources/extensions/gsd/tests/prefs-missing-models-crash.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +222 -0
- package/src/resources/extensions/gsd/tests/process-task-path.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +620 -0
- package/src/resources/extensions/gsd/tests/project-relocation-recovery.test.ts +297 -0
- package/src/resources/extensions/gsd/tests/project-root-cwd-crash.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/projection-regression.test.ts +277 -0
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +677 -0
- package/src/resources/extensions/gsd/tests/prompt-cache-optimizer.test.ts +326 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +574 -0
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +387 -0
- package/src/resources/extensions/gsd/tests/prompt-duplication-cuts.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/prompt-loader-extension-dir.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/prompt-loader-replacement.test.ts +178 -0
- package/src/resources/extensions/gsd/tests/prompt-loader-working-directory.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/prompt-ordering.test.ts +296 -0
- package/src/resources/extensions/gsd/tests/prompt-path-audit.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/prompt-system-gate-coverage.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/prompt-tool-names.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/prompts-no-gitignored-test-refs.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +744 -0
- package/src/resources/extensions/gsd/tests/provider-switch-observer.test.ts +252 -0
- package/src/resources/extensions/gsd/tests/python-resolver.test.ts +131 -0
- package/src/resources/extensions/gsd/tests/quality-gates.test.ts +344 -0
- package/src/resources/extensions/gsd/tests/query-tools-db-open.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/queue-auto-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/queue-draft-detection.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/queue-execution-guard.test.ts +166 -0
- package/src/resources/extensions/gsd/tests/queue-order.test.ts +192 -0
- package/src/resources/extensions/gsd/tests/queue-prompt-rendering.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/queue-reorder-ui.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/queued-discuss-fast-path.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/quick-auto-guard.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/quick-external-gsd.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +61 -0
- package/src/resources/extensions/gsd/tests/rate-limit-model-fallback.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/reactive-executor.test.ts +511 -0
- package/src/resources/extensions/gsd/tests/reactive-graph.test.ts +363 -0
- package/src/resources/extensions/gsd/tests/ready-phrase-no-files-4573.test.ts +728 -0
- package/src/resources/extensions/gsd/tests/reassess-default-optin.test.ts +146 -0
- package/src/resources/extensions/gsd/tests/reassess-detection.test.ts +154 -0
- package/src/resources/extensions/gsd/tests/reassess-handler.test.ts +442 -0
- package/src/resources/extensions/gsd/tests/reassess-prompt.test.ts +135 -0
- package/src/resources/extensions/gsd/tests/reconciliation-edge-cases.test.ts +162 -0
- package/src/resources/extensions/gsd/tests/recovery-attempts-reset.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/regex-hardening.test.ts +161 -0
- package/src/resources/extensions/gsd/tests/register-extension-guard.test.ts +126 -0
- package/src/resources/extensions/gsd/tests/register-hooks-compaction-checkpoint.test.ts +252 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +442 -0
- package/src/resources/extensions/gsd/tests/register-shortcuts.test.ts +131 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +197 -0
- package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/remote-questions.test.ts +774 -0
- package/src/resources/extensions/gsd/tests/remote-status.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/reopen-slice.test.ts +155 -0
- package/src/resources/extensions/gsd/tests/reopen-task.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/replan-handler.test.ts +410 -0
- package/src/resources/extensions/gsd/tests/replan-slice.test.ts +609 -0
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +258 -0
- package/src/resources/extensions/gsd/tests/repository-registry.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/require-slice-discussion-dispatch.test.ts +170 -0
- package/src/resources/extensions/gsd/tests/requirements.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/research-milestone-composer.test.ts +132 -0
- package/src/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +23 -0
- package/src/resources/extensions/gsd/tests/resolve-ts.mjs +9 -0
- package/src/resources/extensions/gsd/tests/resource-loader-import-path.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/resume-missing-worktree-warning.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/retry-diagnostic-reasoning.test.ts +161 -0
- package/src/resources/extensions/gsd/tests/retry-state-reset.test.ts +305 -0
- package/src/resources/extensions/gsd/tests/rewrite-count-persist.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/rewrite-docs-abandon-detect.test.ts +195 -0
- package/src/resources/extensions/gsd/tests/right-sized-workflow-prompts.test.ts +213 -0
- package/src/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +399 -0
- package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +464 -0
- package/src/resources/extensions/gsd/tests/rogue-file-detection.test.ts +294 -0
- package/src/resources/extensions/gsd/tests/routing-history.test.ts +229 -0
- package/src/resources/extensions/gsd/tests/rule-registry.test.ts +411 -0
- package/src/resources/extensions/gsd/tests/run-manager.test.ts +229 -0
- package/src/resources/extensions/gsd/tests/run-uat-composer.test.ts +151 -0
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +94 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +94 -0
- package/src/resources/extensions/gsd/tests/runtime-kv.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +268 -0
- package/src/resources/extensions/gsd/tests/save-gate-result-render.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/schema-v21-sequence.test.ts +413 -0
- package/src/resources/extensions/gsd/tests/schema-v27-v28-sequence.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/schema-v9-sequence.test.ts +176 -0
- package/src/resources/extensions/gsd/tests/secure-env-collect.test.ts +364 -0
- package/src/resources/extensions/gsd/tests/select-resumable-milestone.test.ts +96 -0
- package/src/resources/extensions/gsd/tests/service-tier.test.ts +131 -0
- package/src/resources/extensions/gsd/tests/session-forensics-readonly-classification.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/session-lock-multipath.test.ts +166 -0
- package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +379 -0
- package/src/resources/extensions/gsd/tests/session-lock-transient-read.test.ts +224 -0
- package/src/resources/extensions/gsd/tests/session-model-override.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +387 -0
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +304 -0
- package/src/resources/extensions/gsd/tests/shared-wal.test.ts +239 -0
- package/src/resources/extensions/gsd/tests/show-config-command.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/sidecar-queue.test.ts +182 -0
- package/src/resources/extensions/gsd/tests/signal-handlers.test.ts +130 -0
- package/src/resources/extensions/gsd/tests/silent-catch-diagnostics.test.ts +244 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/single-writer-v3-tool-surface.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +352 -0
- package/src/resources/extensions/gsd/tests/skill-catalog.test.ts +193 -0
- package/src/resources/extensions/gsd/tests/skill-lifecycle.test.ts +126 -0
- package/src/resources/extensions/gsd/tests/skill-manifest.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/skip-slice-cascades-tasks.test.ts +125 -0
- package/src/resources/extensions/gsd/tests/skip-slice-state-rebuild.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/skipped-validation-completion.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/skipped-validation-db-atomicity.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/slice-cadence.test.ts +301 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/slice-disk-reconcile.test.ts +187 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-conflict.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-eligibility.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +348 -0
- package/src/resources/extensions/gsd/tests/slice-sequence-insert.test.ts +124 -0
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/smart-entry-draft.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/smart-entry-routing.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/sqlite-unavailable-gate.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/stale-dirlistcache-4648.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/stale-lockfile-recovery.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/stale-milestone-id-reservation.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/stale-queued-milestone.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +152 -0
- package/src/resources/extensions/gsd/tests/stalled-tool-recovery.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +334 -0
- package/src/resources/extensions/gsd/tests/stash-pop-gsd-conflict.test.ts +203 -0
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +442 -0
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +424 -0
- package/src/resources/extensions/gsd/tests/state-derivation-parity.test.ts +257 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +1645 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +1137 -0
- package/src/resources/extensions/gsd/tests/state-transition-matrix.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/status-guards.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/steer-worktree-path.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/stop-auto-merge-back.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/stop-backtrack.test.ts +216 -0
- package/src/resources/extensions/gsd/tests/structured-data-formatter.test.ts +285 -0
- package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +232 -0
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +197 -0
- package/src/resources/extensions/gsd/tests/subagent-agent-discovery.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +174 -0
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +226 -0
- package/src/resources/extensions/gsd/tests/survivor-branch-complete.test.ts +121 -0
- package/src/resources/extensions/gsd/tests/symlink-extension-discovery.test.ts +125 -0
- package/src/resources/extensions/gsd/tests/symlink-numbered-variants.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/sync-lock.test.ts +153 -0
- package/src/resources/extensions/gsd/tests/sync-worktree-skip-current.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/system-context-memory.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/teardown-chdir-failure-clears-registry.test.ts +162 -0
- package/src/resources/extensions/gsd/tests/teardown-cleanup-parity.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/teardown-failure-clears-registry.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/terminated-transient.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/test-helpers.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/test-helpers.ts +214 -0
- package/src/resources/extensions/gsd/tests/test-utils.ts +165 -0
- package/src/resources/extensions/gsd/tests/token-cost-display.test.ts +118 -0
- package/src/resources/extensions/gsd/tests/token-counter.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +382 -0
- package/src/resources/extensions/gsd/tests/tool-call-loop-guard.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/tool-compatibility.test.ts +306 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +211 -0
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +155 -0
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +383 -0
- package/src/resources/extensions/gsd/tests/triage-dispatch.test.ts +138 -0
- package/src/resources/extensions/gsd/tests/triage-resolution.test.ts +612 -0
- package/src/resources/extensions/gsd/tests/tui-header-lifecycle.test.ts +330 -0
- package/src/resources/extensions/gsd/tests/tui-render-kit.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/turn-epoch.test.ts +153 -0
- package/src/resources/extensions/gsd/tests/uat-stuck-loop-orphaned-worktree.test.ts +289 -0
- package/src/resources/extensions/gsd/tests/unborn-branch.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/undo.test.ts +462 -0
- package/src/resources/extensions/gsd/tests/unique-milestone-ids.test.ts +203 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +529 -0
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +462 -0
- package/src/resources/extensions/gsd/tests/unit-dispatches.test.ts +326 -0
- package/src/resources/extensions/gsd/tests/unit-ownership.test.ts +258 -0
- package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +335 -0
- package/src/resources/extensions/gsd/tests/unmerged-milestone-guard.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/uok-audit-unified.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +245 -0
- package/src/resources/extensions/gsd/tests/uok-execution-graph.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/uok-flags.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/uok-gate-runner.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +241 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-wiring.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/uok-kernel-path.test.ts +178 -0
- package/src/resources/extensions/gsd/tests/uok-loop-adapter-writer.test.ts +163 -0
- package/src/resources/extensions/gsd/tests/uok-model-policy.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/uok-parity-report.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +262 -0
- package/src/resources/extensions/gsd/tests/uok-preferences.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/uok-writer.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/update-command.test.ts +86 -0
- package/src/resources/extensions/gsd/tests/vacuous-truth-slices.test.ts +115 -0
- package/src/resources/extensions/gsd/tests/vacuum-recovery.test.ts +154 -0
- package/src/resources/extensions/gsd/tests/validate-directory.test.ts +269 -0
- package/src/resources/extensions/gsd/tests/validate-extension-package.test.ts +168 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +300 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +371 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +766 -0
- package/src/resources/extensions/gsd/tests/validation-block-guard.test.ts +104 -0
- package/src/resources/extensions/gsd/tests/validation-gate-patterns.test.ts +178 -0
- package/src/resources/extensions/gsd/tests/validation.test.ts +72 -0
- package/src/resources/extensions/gsd/tests/validator-scope-parity.test.ts +239 -0
- package/src/resources/extensions/gsd/tests/verdict-parser.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/verification-evidence.test.ts +601 -0
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +1265 -0
- package/src/resources/extensions/gsd/tests/verification-operational-gate.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/verification-retry-policy.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +204 -0
- package/src/resources/extensions/gsd/tests/visualizer-critical-path.test.ts +109 -0
- package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +84 -0
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +359 -0
- package/src/resources/extensions/gsd/tests/visualizer-views.test.ts +716 -0
- package/src/resources/extensions/gsd/tests/wave1-critical-regressions.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/wave2-events-regressions.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/wave3-session-regressions.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/wave4-write-safety-regressions.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/wave5-consistency-regressions.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/windows-path-normalization.test.ts +97 -0
- package/src/resources/extensions/gsd/tests/worker-model-override.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/worker-registry.test.ts +146 -0
- package/src/resources/extensions/gsd/tests/workflow-custom-engine-dispatch-outcome.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/workflow-custom-engine-iteration.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/workflow-custom-engine-reconcile-outcome.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/workflow-custom-engine-reconcile.test.ts +146 -0
- package/src/resources/extensions/gsd/tests/workflow-custom-engine-retry.test.ts +136 -0
- package/src/resources/extensions/gsd/tests/workflow-custom-engine-verify-outcome.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/workflow-dispatch-claim.test.ts +313 -0
- package/src/resources/extensions/gsd/tests/workflow-dispatch-ledger.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/workflow-events.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/workflow-install.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/workflow-iteration-completion.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/workflow-journal-reporter.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/workflow-kernel.test.ts +630 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-audit.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +411 -0
- package/src/resources/extensions/gsd/tests/workflow-manifest.test.ts +336 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp-auto-prep.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +771 -0
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/workflow-phase-reporter.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/workflow-plugins.test.ts +310 -0
- package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +405 -0
- package/src/resources/extensions/gsd/tests/workflow-protocol-excerpt.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/workflow-reconcile.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/workflow-session-lock.test.ts +135 -0
- package/src/resources/extensions/gsd/tests/workflow-sidecar-iteration.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/workflow-sidecar-queue.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +198 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1397 -0
- package/src/resources/extensions/gsd/tests/workflow-turn-reporter.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/workflow-unit-dispatch.test.ts +160 -0
- package/src/resources/extensions/gsd/tests/workflow-worker-heartbeat.test.ts +154 -0
- package/src/resources/extensions/gsd/tests/working-output-messages.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/workspace-index.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/workspace.test.ts +196 -0
- package/src/resources/extensions/gsd/tests/worktree-bugfix.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +202 -0
- package/src/resources/extensions/gsd/tests/worktree-db-respawn-truncation.test.ts +219 -0
- package/src/resources/extensions/gsd/tests/worktree-db-same-file.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +440 -0
- package/src/resources/extensions/gsd/tests/worktree-expected-warnings.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +207 -0
- package/src/resources/extensions/gsd/tests/worktree-health-monorepo.test.ts +109 -0
- package/src/resources/extensions/gsd/tests/worktree-health.test.ts +181 -0
- package/src/resources/extensions/gsd/tests/worktree-integration.test.ts +216 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +397 -0
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +992 -0
- package/src/resources/extensions/gsd/tests/worktree-main-branch.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +290 -0
- package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/worktree-path-injection.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/worktree-post-create-hook.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/worktree-preferences-sync.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/worktree-project-root-degrade.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/worktree-projection-writers.test.ts +206 -0
- package/src/resources/extensions/gsd/tests/worktree-root-resolution.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/worktree-root.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +417 -0
- package/src/resources/extensions/gsd/tests/worktree-state-projection.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +228 -0
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +705 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-overwrite-loop.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-tasks.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +283 -0
- package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +206 -0
- package/src/resources/extensions/gsd/tests/worktree.test.ts +304 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +476 -0
- package/src/resources/extensions/gsd/tests/write-gate-predicates.test.ts +188 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +726 -0
- package/src/resources/extensions/gsd/tests/write-intercept.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +81 -0
- package/src/resources/extensions/gsd/token-counter.ts +83 -0
- package/src/resources/extensions/gsd/tool-contract.ts +82 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +273 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +568 -0
- package/src/resources/extensions/gsd/tools/complete-task.ts +473 -0
- package/src/resources/extensions/gsd/tools/context-mode-tool-result.ts +25 -0
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +81 -0
- package/src/resources/extensions/gsd/tools/exec-tool.ts +286 -0
- package/src/resources/extensions/gsd/tools/memory-tools.ts +427 -0
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +370 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +443 -0
- package/src/resources/extensions/gsd/tools/plan-task.ts +161 -0
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +289 -0
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +152 -0
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +152 -0
- package/src/resources/extensions/gsd/tools/reopen-task.ts +146 -0
- package/src/resources/extensions/gsd/tools/replan-slice.ts +242 -0
- package/src/resources/extensions/gsd/tools/resume-tool.ts +40 -0
- package/src/resources/extensions/gsd/tools/skip-slice.ts +133 -0
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +301 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +991 -0
- package/src/resources/extensions/gsd/triage-resolution.ts +578 -0
- package/src/resources/extensions/gsd/triage-ui.ts +196 -0
- package/src/resources/extensions/gsd/tui/render-kit.ts +153 -0
- package/src/resources/extensions/gsd/types.ts +721 -0
- package/src/resources/extensions/gsd/undo.ts +465 -0
- package/src/resources/extensions/gsd/unit-context-composer.ts +285 -0
- package/src/resources/extensions/gsd/unit-context-manifest.ts +796 -0
- package/src/resources/extensions/gsd/unit-id.ts +14 -0
- package/src/resources/extensions/gsd/unit-ownership.ts +275 -0
- package/src/resources/extensions/gsd/unit-runtime.ts +267 -0
- package/src/resources/extensions/gsd/unmerged-milestone-guard.ts +150 -0
- package/src/resources/extensions/gsd/uok/audit-toggle.ts +9 -0
- package/src/resources/extensions/gsd/uok/audit.ts +85 -0
- package/src/resources/extensions/gsd/uok/contracts.ts +306 -0
- package/src/resources/extensions/gsd/uok/dispatch-envelope.ts +60 -0
- package/src/resources/extensions/gsd/uok/execution-graph.ts +263 -0
- package/src/resources/extensions/gsd/uok/flags.ts +45 -0
- package/src/resources/extensions/gsd/uok/gate-runner.ts +206 -0
- package/src/resources/extensions/gsd/uok/gitops.ts +80 -0
- package/src/resources/extensions/gsd/uok/kernel.ts +124 -0
- package/src/resources/extensions/gsd/uok/loop-adapter.ts +212 -0
- package/src/resources/extensions/gsd/uok/model-policy.ts +112 -0
- package/src/resources/extensions/gsd/uok/parity-report.ts +84 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +209 -0
- package/src/resources/extensions/gsd/uok/timeline.ts +158 -0
- package/src/resources/extensions/gsd/uok/writer.ts +113 -0
- package/src/resources/extensions/gsd/user-input-boundary.ts +166 -0
- package/src/resources/extensions/gsd/validate-directory.ts +186 -0
- package/src/resources/extensions/gsd/validation-block-guard.ts +83 -0
- package/src/resources/extensions/gsd/validation.ts +45 -0
- package/src/resources/extensions/gsd/verdict-parser.ts +110 -0
- package/src/resources/extensions/gsd/verification-evidence.ts +270 -0
- package/src/resources/extensions/gsd/verification-gate.ts +848 -0
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/visualizer-data.ts +953 -0
- package/src/resources/extensions/gsd/visualizer-overlay.ts +570 -0
- package/src/resources/extensions/gsd/visualizer-views.ts +1229 -0
- package/src/resources/extensions/gsd/watch/header-renderer.ts +331 -0
- package/src/resources/extensions/gsd/watch/splash-palette.ts +11 -0
- package/src/resources/extensions/gsd/workflow-dispatch.ts +106 -0
- package/src/resources/extensions/gsd/workflow-engine.ts +38 -0
- package/src/resources/extensions/gsd/workflow-events.ts +166 -0
- package/src/resources/extensions/gsd/workflow-install.ts +422 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +381 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +260 -0
- package/src/resources/extensions/gsd/workflow-mcp-auto-prep.ts +60 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +459 -0
- package/src/resources/extensions/gsd/workflow-migration.ts +340 -0
- package/src/resources/extensions/gsd/workflow-plugins.ts +402 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +567 -0
- package/src/resources/extensions/gsd/workflow-protocol.ts +160 -0
- package/src/resources/extensions/gsd/workflow-reconcile.ts +681 -0
- package/src/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
- package/src/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
- package/src/resources/extensions/gsd/workflow-templates/bugfix.md +88 -0
- package/src/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
- package/src/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
- package/src/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
- package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +75 -0
- package/src/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
- package/src/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
- package/src/resources/extensions/gsd/workflow-templates/full-project.md +42 -0
- package/src/resources/extensions/gsd/workflow-templates/hotfix.md +46 -0
- package/src/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
- package/src/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
- package/src/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
- package/src/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
- package/src/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
- package/src/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
- package/src/resources/extensions/gsd/workflow-templates/refactor.md +84 -0
- package/src/resources/extensions/gsd/workflow-templates/registry.json +269 -0
- package/src/resources/extensions/gsd/workflow-templates/release.md +118 -0
- package/src/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
- package/src/resources/extensions/gsd/workflow-templates/security-audit.md +74 -0
- package/src/resources/extensions/gsd/workflow-templates/small-feature.md +82 -0
- package/src/resources/extensions/gsd/workflow-templates/spike.md +76 -0
- package/src/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
- package/src/resources/extensions/gsd/workflow-templates.ts +278 -0
- package/src/resources/extensions/gsd/working-output-messages.ts +120 -0
- package/src/resources/extensions/gsd/workspace-index.ts +277 -0
- package/src/resources/extensions/gsd/workspace.ts +95 -0
- package/src/resources/extensions/gsd/worktree-command-bootstrap.ts +46 -0
- package/src/resources/extensions/gsd/worktree-command.ts +834 -0
- package/src/resources/extensions/gsd/worktree-health.ts +178 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +1989 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +909 -0
- package/src/resources/extensions/gsd/worktree-root.ts +182 -0
- package/src/resources/extensions/gsd/worktree-safety.ts +329 -0
- package/src/resources/extensions/gsd/worktree-session-state.ts +35 -0
- package/src/resources/extensions/gsd/worktree-state-projection.ts +447 -0
- package/src/resources/extensions/gsd/worktree-telemetry.ts +366 -0
- package/src/resources/extensions/gsd/worktree.ts +235 -0
- package/src/resources/extensions/gsd/write-intercept.ts +99 -0
- package/src/resources/extensions/mac-tools/extension-manifest.json +16 -0
- package/src/resources/extensions/mac-tools/index.ts +852 -0
- package/src/resources/extensions/mac-tools/swift-cli/Package.swift +22 -0
- package/src/resources/extensions/mac-tools/swift-cli/Sources/main.swift +1318 -0
- package/src/resources/extensions/mcp-client/auth.ts +160 -0
- package/src/resources/extensions/mcp-client/index.ts +526 -0
- package/src/resources/extensions/mcp-client/manager.ts +516 -0
- package/src/resources/extensions/mcp-client/tests/global-config.test.ts +91 -0
- package/src/resources/extensions/mcp-client/tests/manager.test.ts +165 -0
- package/src/resources/extensions/mcp-client/tests/server-name-spaces.test.ts +89 -0
- package/src/resources/extensions/ollama/index.ts +158 -0
- package/src/resources/extensions/ollama/model-capabilities.ts +186 -0
- package/src/resources/extensions/ollama/ndjson-stream.ts +63 -0
- package/src/resources/extensions/ollama/ollama-auth-mode.test.ts +128 -0
- package/src/resources/extensions/ollama/ollama-chat-provider.ts +459 -0
- package/src/resources/extensions/ollama/ollama-client.ts +262 -0
- package/src/resources/extensions/ollama/ollama-commands.ts +248 -0
- package/src/resources/extensions/ollama/ollama-discovery.ts +134 -0
- package/src/resources/extensions/ollama/ollama-status-indicator.test.ts +215 -0
- package/src/resources/extensions/ollama/ollama-tool.ts +287 -0
- package/src/resources/extensions/ollama/tests/model-capabilities.test.ts +258 -0
- package/src/resources/extensions/ollama/tests/ollama-chat-provider-stream.test.ts +82 -0
- package/src/resources/extensions/ollama/tests/ollama-client-timeout-env.test.ts +147 -0
- package/src/resources/extensions/ollama/tests/ollama-client.test.ts +38 -0
- package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +55 -0
- package/src/resources/extensions/ollama/thinking-parser.ts +116 -0
- package/src/resources/extensions/ollama/types.ts +153 -0
- package/src/resources/extensions/package.json +3 -0
- package/src/resources/extensions/remote-questions/commands.ts +480 -0
- package/src/resources/extensions/remote-questions/config.ts +126 -0
- package/src/resources/extensions/remote-questions/discord-adapter.ts +148 -0
- package/src/resources/extensions/remote-questions/extension-manifest.json +11 -0
- package/src/resources/extensions/remote-questions/format.ts +315 -0
- package/src/resources/extensions/remote-questions/http-client.ts +76 -0
- package/src/resources/extensions/remote-questions/manager.ts +270 -0
- package/src/resources/extensions/remote-questions/mod.ts +16 -0
- package/src/resources/extensions/remote-questions/notify.ts +90 -0
- package/src/resources/extensions/remote-questions/remote-command.ts +437 -0
- package/src/resources/extensions/remote-questions/slack-adapter.ts +141 -0
- package/src/resources/extensions/remote-questions/status.ts +31 -0
- package/src/resources/extensions/remote-questions/store.ts +81 -0
- package/src/resources/extensions/remote-questions/telegram-adapter.ts +231 -0
- package/src/resources/extensions/remote-questions/tests/command-polling.test.ts +256 -0
- package/src/resources/extensions/remote-questions/tests/remote-answer-normalization.test.ts +92 -0
- package/src/resources/extensions/remote-questions/tests/telegram-commands.test.ts +267 -0
- package/src/resources/extensions/remote-questions/types.ts +102 -0
- package/src/resources/extensions/search-the-web/cache.ts +78 -0
- package/src/resources/extensions/search-the-web/command-search-provider.ts +105 -0
- package/src/resources/extensions/search-the-web/extension-manifest.json +13 -0
- package/src/resources/extensions/search-the-web/format.ts +258 -0
- package/src/resources/extensions/search-the-web/http.ts +238 -0
- package/src/resources/extensions/search-the-web/index.ts +64 -0
- package/src/resources/extensions/search-the-web/native-search.ts +276 -0
- package/src/resources/extensions/search-the-web/provider.ts +150 -0
- package/src/resources/extensions/search-the-web/tavily.ts +116 -0
- package/src/resources/extensions/search-the-web/tool-fetch-page.ts +589 -0
- package/src/resources/extensions/search-the-web/tool-llm-context.ts +608 -0
- package/src/resources/extensions/search-the-web/tool-search.ts +677 -0
- package/src/resources/extensions/search-the-web/url-utils.ts +144 -0
- package/src/resources/extensions/shared/cmux-events.ts +59 -0
- package/src/resources/extensions/shared/confirm-ui.ts +126 -0
- package/src/resources/extensions/shared/format-utils.ts +99 -0
- package/src/resources/extensions/shared/frontmatter.ts +117 -0
- package/src/resources/extensions/shared/gsd-phase-state.ts +95 -0
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/shared/interview-ui.ts +848 -0
- package/src/resources/extensions/shared/layout-utils.ts +75 -0
- package/src/resources/extensions/shared/mod.ts +31 -0
- package/src/resources/extensions/shared/next-action-ui.ts +226 -0
- package/src/resources/extensions/shared/path-display.ts +19 -0
- package/src/resources/extensions/shared/rtk-session-stats.ts +248 -0
- package/src/resources/extensions/shared/rtk-shared.ts +58 -0
- package/src/resources/extensions/shared/rtk.ts +98 -0
- package/src/resources/extensions/shared/sanitize.ts +55 -0
- package/src/resources/extensions/shared/terminal.ts +28 -0
- package/src/resources/extensions/shared/tests/ask-user-freetext.test.ts +161 -0
- package/src/resources/extensions/shared/tests/format-utils.test.ts +155 -0
- package/src/resources/extensions/shared/tests/gsd-phase-state.test.ts +90 -0
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +198 -0
- package/src/resources/extensions/shared/tests/interview-preview.test.ts +185 -0
- package/src/resources/extensions/shared/tests/next-action-ui-hasui.test.ts +144 -0
- package/src/resources/extensions/shared/tests/preview-layout.test.ts +120 -0
- package/src/resources/extensions/shared/tui.ts +11 -0
- package/src/resources/extensions/shared/ui.ts +401 -0
- package/src/resources/extensions/slash-commands/audit.ts +89 -0
- package/src/resources/extensions/slash-commands/clear.ts +10 -0
- package/src/resources/extensions/slash-commands/create-extension.ts +311 -0
- package/src/resources/extensions/slash-commands/create-slash-command.ts +234 -0
- package/src/resources/extensions/slash-commands/extension-manifest.json +11 -0
- package/src/resources/extensions/slash-commands/index.ts +12 -0
- package/src/resources/extensions/subagent/agents.ts +166 -0
- package/src/resources/extensions/subagent/extension-manifest.json +13 -0
- package/src/resources/extensions/subagent/index.ts +1938 -0
- package/src/resources/extensions/subagent/isolation.ts +504 -0
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/agents-conflicts.test.ts +33 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/model-override.test.ts +55 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/subagent/worker-registry.ts +100 -0
- package/src/resources/extensions/ttsr/extension-manifest.json +11 -0
- package/src/resources/extensions/ttsr/index.ts +168 -0
- package/src/resources/extensions/ttsr/rule-loader.ts +75 -0
- package/src/resources/extensions/ttsr/ttsr-interrupt.md +6 -0
- package/src/resources/extensions/ttsr/ttsr-manager.ts +465 -0
- package/src/resources/extensions/universal-config/discovery.ts +104 -0
- package/src/resources/extensions/universal-config/extension-manifest.json +13 -0
- package/src/resources/extensions/universal-config/format.ts +191 -0
- package/src/resources/extensions/universal-config/index.ts +120 -0
- package/src/resources/extensions/universal-config/package.json +11 -0
- package/src/resources/extensions/universal-config/scanners.ts +642 -0
- package/src/resources/extensions/universal-config/tests/discovery.test.ts +119 -0
- package/src/resources/extensions/universal-config/tests/format.test.ts +127 -0
- package/src/resources/extensions/universal-config/tests/scanners.test.ts +456 -0
- package/src/resources/extensions/universal-config/tools.ts +60 -0
- package/src/resources/extensions/universal-config/types.ts +135 -0
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
- package/src/resources/extensions/visual-brief/prompts.ts +183 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
- package/src/resources/extensions/voice/extension-manifest.json +12 -0
- package/src/resources/extensions/voice/index.ts +264 -0
- package/src/resources/extensions/voice/linux-ready.ts +86 -0
- package/src/resources/extensions/voice/speech-recognizer.py +504 -0
- package/src/resources/extensions/voice/speech-recognizer.swift +154 -0
- package/src/resources/extensions/voice/tests/linux-ready.test.ts +140 -0
- package/src/resources/skills/accessibility/SKILL.md +522 -0
- package/src/resources/skills/accessibility/references/WCAG.md +162 -0
- package/src/resources/skills/agent-browser/SKILL.md +517 -0
- package/src/resources/skills/agent-browser/references/authentication.md +202 -0
- package/src/resources/skills/agent-browser/references/commands.md +263 -0
- package/src/resources/skills/agent-browser/references/profiling.md +120 -0
- package/src/resources/skills/agent-browser/references/proxy-support.md +194 -0
- package/src/resources/skills/agent-browser/references/session-management.md +193 -0
- package/src/resources/skills/agent-browser/references/snapshot-refs.md +194 -0
- package/src/resources/skills/agent-browser/references/video-recording.md +173 -0
- package/src/resources/skills/agent-browser/templates/authenticated-session.sh +105 -0
- package/src/resources/skills/agent-browser/templates/capture-workflow.sh +69 -0
- package/src/resources/skills/agent-browser/templates/form-automation.sh +62 -0
- package/src/resources/skills/api-design/SKILL.md +190 -0
- package/src/resources/skills/best-practices/SKILL.md +583 -0
- package/src/resources/skills/btw/SKILL.md +42 -0
- package/src/resources/skills/code-optimizer/SKILL.md +160 -0
- package/src/resources/skills/code-optimizer/references/algorithmic-complexity.md +66 -0
- package/src/resources/skills/code-optimizer/references/build-compilation.md +90 -0
- package/src/resources/skills/code-optimizer/references/bundle-dependencies.md +82 -0
- package/src/resources/skills/code-optimizer/references/caching-memoization.md +76 -0
- package/src/resources/skills/code-optimizer/references/concurrency-async.md +80 -0
- package/src/resources/skills/code-optimizer/references/config-infra.md +71 -0
- package/src/resources/skills/code-optimizer/references/data-structures.md +80 -0
- package/src/resources/skills/code-optimizer/references/database-queries.md +76 -0
- package/src/resources/skills/code-optimizer/references/dead-code-redundancy.md +84 -0
- package/src/resources/skills/code-optimizer/references/error-resilience.md +80 -0
- package/src/resources/skills/code-optimizer/references/io-network.md +89 -0
- package/src/resources/skills/code-optimizer/references/logging-observability.md +64 -0
- package/src/resources/skills/code-optimizer/references/memory-resources.md +66 -0
- package/src/resources/skills/code-optimizer/references/rendering-ui.md +90 -0
- package/src/resources/skills/code-optimizer/references/security-performance.md +68 -0
- package/src/resources/skills/core-web-vitals/SKILL.md +441 -0
- package/src/resources/skills/core-web-vitals/references/LCP.md +208 -0
- package/src/resources/skills/create-gsd-extension/SKILL.md +93 -0
- package/src/resources/skills/create-gsd-extension/references/compaction-session-control.md +77 -0
- package/src/resources/skills/create-gsd-extension/references/custom-commands.md +139 -0
- package/src/resources/skills/create-gsd-extension/references/custom-rendering.md +108 -0
- package/src/resources/skills/create-gsd-extension/references/custom-tools.md +183 -0
- package/src/resources/skills/create-gsd-extension/references/custom-ui.md +490 -0
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +126 -0
- package/src/resources/skills/create-gsd-extension/references/extension-lifecycle.md +64 -0
- package/src/resources/skills/create-gsd-extension/references/extensionapi-reference.md +75 -0
- package/src/resources/skills/create-gsd-extension/references/extensioncontext-reference.md +53 -0
- package/src/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +37 -0
- package/src/resources/skills/create-gsd-extension/references/mode-behavior.md +32 -0
- package/src/resources/skills/create-gsd-extension/references/model-provider-management.md +89 -0
- package/src/resources/skills/create-gsd-extension/references/packaging-distribution.md +55 -0
- package/src/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +90 -0
- package/src/resources/skills/create-gsd-extension/references/state-management.md +70 -0
- package/src/resources/skills/create-gsd-extension/references/system-prompt-modification.md +52 -0
- package/src/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
- package/src/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +104 -0
- package/src/resources/skills/create-gsd-extension/workflows/add-capability.md +57 -0
- package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +176 -0
- package/src/resources/skills/create-gsd-extension/workflows/debug-extension.md +76 -0
- package/src/resources/skills/create-mcp-server/SKILL.md +121 -0
- package/src/resources/skills/create-skill/SKILL.md +186 -0
- package/src/resources/skills/create-skill/references/api-security.md +226 -0
- package/src/resources/skills/create-skill/references/be-clear-and-direct.md +531 -0
- package/src/resources/skills/create-skill/references/common-patterns.md +595 -0
- package/src/resources/skills/create-skill/references/core-principles.md +437 -0
- package/src/resources/skills/create-skill/references/executable-code.md +175 -0
- package/src/resources/skills/create-skill/references/gsd-skill-ecosystem.md +68 -0
- package/src/resources/skills/create-skill/references/iteration-and-testing.md +474 -0
- package/src/resources/skills/create-skill/references/recommended-structure.md +168 -0
- package/src/resources/skills/create-skill/references/skill-structure.md +372 -0
- package/src/resources/skills/create-skill/references/use-xml-tags.md +466 -0
- package/src/resources/skills/create-skill/references/using-scripts.md +113 -0
- package/src/resources/skills/create-skill/references/using-templates.md +112 -0
- package/src/resources/skills/create-skill/references/workflows-and-validation.md +510 -0
- package/src/resources/skills/create-skill/templates/router-skill.md +73 -0
- package/src/resources/skills/create-skill/templates/simple-skill.md +33 -0
- package/src/resources/skills/create-skill/workflows/add-reference.md +96 -0
- package/src/resources/skills/create-skill/workflows/add-script.md +93 -0
- package/src/resources/skills/create-skill/workflows/add-template.md +74 -0
- package/src/resources/skills/create-skill/workflows/add-workflow.md +120 -0
- package/src/resources/skills/create-skill/workflows/audit-skill.md +148 -0
- package/src/resources/skills/create-skill/workflows/create-new-skill.md +196 -0
- package/src/resources/skills/create-skill/workflows/get-guidance.md +121 -0
- package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +161 -0
- package/src/resources/skills/create-skill/workflows/verify-skill.md +204 -0
- package/src/resources/skills/create-workflow/SKILL.md +130 -0
- package/src/resources/skills/create-workflow/references/feature-patterns.md +128 -0
- package/src/resources/skills/create-workflow/references/verification-policies.md +76 -0
- package/src/resources/skills/create-workflow/references/yaml-schema-v1.md +46 -0
- package/src/resources/skills/create-workflow/templates/blog-post-pipeline.yaml +60 -0
- package/src/resources/skills/create-workflow/templates/code-audit.yaml +60 -0
- package/src/resources/skills/create-workflow/templates/release-checklist.yaml +66 -0
- package/src/resources/skills/create-workflow/templates/workflow-definition.yaml +32 -0
- package/src/resources/skills/create-workflow/workflows/create-from-scratch.md +104 -0
- package/src/resources/skills/create-workflow/workflows/create-from-template.md +72 -0
- package/src/resources/skills/debug-like-expert/SKILL.md +231 -0
- package/src/resources/skills/debug-like-expert/references/debugging-mindset.md +253 -0
- package/src/resources/skills/debug-like-expert/references/hypothesis-testing.md +373 -0
- package/src/resources/skills/debug-like-expert/references/investigation-techniques.md +337 -0
- package/src/resources/skills/debug-like-expert/references/verification-patterns.md +425 -0
- package/src/resources/skills/debug-like-expert/references/when-to-research.md +361 -0
- package/src/resources/skills/decompose-into-slices/SKILL.md +139 -0
- package/src/resources/skills/dependency-upgrade/SKILL.md +158 -0
- package/src/resources/skills/design-an-interface/SKILL.md +102 -0
- package/src/resources/skills/forensics/SKILL.md +153 -0
- package/src/resources/skills/frontend-design/SKILL.md +45 -0
- package/src/resources/skills/github-workflows/SKILL.md +90 -0
- package/src/resources/skills/github-workflows/references/gh/SKILL.md +276 -0
- package/src/resources/skills/github-workflows/references/gh/references/issue-stories.md +204 -0
- package/src/resources/skills/github-workflows/references/gh/references/labels.md +170 -0
- package/src/resources/skills/github-workflows/references/gh/references/milestones.md +158 -0
- package/src/resources/skills/github-workflows/references/gh/references/projects-v2.md +177 -0
- package/src/resources/skills/github-workflows/references/gh/scripts/experiment_cleanup.py +191 -0
- package/src/resources/skills/github-workflows/references/gh/scripts/github_project_setup.py +799 -0
- package/src/resources/skills/github-workflows/references/gh/tests/__init__.py +0 -0
- package/src/resources/skills/github-workflows/references/gh/tests/test_github_project_setup.py +608 -0
- package/src/resources/skills/grill-me/SKILL.md +93 -0
- package/src/resources/skills/handoff/SKILL.md +121 -0
- package/src/resources/skills/lint/SKILL.md +145 -0
- package/src/resources/skills/make-interfaces-feel-better/SKILL.md +122 -0
- package/src/resources/skills/make-interfaces-feel-better/animations.md +379 -0
- package/src/resources/skills/make-interfaces-feel-better/performance.md +88 -0
- package/src/resources/skills/make-interfaces-feel-better/surfaces.md +247 -0
- package/src/resources/skills/make-interfaces-feel-better/typography.md +123 -0
- package/src/resources/skills/observability/SKILL.md +174 -0
- package/src/resources/skills/react-best-practices/README.md +123 -0
- package/src/resources/skills/react-best-practices/SKILL.md +136 -0
- package/src/resources/skills/react-best-practices/metadata.json +15 -0
- package/src/resources/skills/react-best-practices/rules/_sections.md +46 -0
- package/src/resources/skills/react-best-practices/rules/_template.md +28 -0
- package/src/resources/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/src/resources/skills/react-best-practices/rules/advanced-init-once.md +42 -0
- package/src/resources/skills/react-best-practices/rules/advanced-use-latest.md +39 -0
- package/src/resources/skills/react-best-practices/rules/async-api-routes.md +38 -0
- package/src/resources/skills/react-best-practices/rules/async-defer-await.md +80 -0
- package/src/resources/skills/react-best-practices/rules/async-dependencies.md +51 -0
- package/src/resources/skills/react-best-practices/rules/async-parallel.md +28 -0
- package/src/resources/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/src/resources/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/src/resources/skills/react-best-practices/rules/bundle-conditional.md +31 -0
- package/src/resources/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/src/resources/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/src/resources/skills/react-best-practices/rules/bundle-preload.md +50 -0
- package/src/resources/skills/react-best-practices/rules/client-event-listeners.md +74 -0
- package/src/resources/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/src/resources/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/src/resources/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/src/resources/skills/react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/src/resources/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/src/resources/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/src/resources/skills/react-best-practices/rules/js-cache-storage.md +70 -0
- package/src/resources/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/src/resources/skills/react-best-practices/rules/js-early-exit.md +50 -0
- package/src/resources/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/src/resources/skills/react-best-practices/rules/js-index-maps.md +37 -0
- package/src/resources/skills/react-best-practices/rules/js-length-check-first.md +49 -0
- package/src/resources/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/src/resources/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/src/resources/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/src/resources/skills/react-best-practices/rules/rendering-activity.md +26 -0
- package/src/resources/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/src/resources/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/src/resources/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/src/resources/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/src/resources/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/src/resources/skills/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/src/resources/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/src/resources/skills/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/src/resources/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/src/resources/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/src/resources/skills/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/src/resources/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/src/resources/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/src/resources/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/src/resources/skills/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/src/resources/skills/react-best-practices/rules/rerender-memo.md +44 -0
- package/src/resources/skills/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/src/resources/skills/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/src/resources/skills/react-best-practices/rules/rerender-transitions.md +40 -0
- package/src/resources/skills/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/src/resources/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/src/resources/skills/react-best-practices/rules/server-auth-actions.md +96 -0
- package/src/resources/skills/react-best-practices/rules/server-cache-lru.md +41 -0
- package/src/resources/skills/react-best-practices/rules/server-cache-react.md +76 -0
- package/src/resources/skills/react-best-practices/rules/server-dedup-props.md +65 -0
- package/src/resources/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/src/resources/skills/react-best-practices/rules/server-serialization.md +38 -0
- package/src/resources/skills/review/SKILL.md +218 -0
- package/src/resources/skills/security-review/SKILL.md +181 -0
- package/src/resources/skills/spike-wrap-up/SKILL.md +138 -0
- package/src/resources/skills/tdd/SKILL.md +112 -0
- package/src/resources/skills/test/SKILL.md +204 -0
- package/src/resources/skills/userinterface-wiki/SKILL.md +253 -0
- package/src/resources/skills/userinterface-wiki/rules/_sections.md +66 -0
- package/src/resources/skills/userinterface-wiki/rules/_template.md +24 -0
- package/src/resources/skills/userinterface-wiki/rules/a11y-reduced-motion-check.md +30 -0
- package/src/resources/skills/userinterface-wiki/rules/a11y-toggle-setting.md +30 -0
- package/src/resources/skills/userinterface-wiki/rules/a11y-visual-equivalent.md +36 -0
- package/src/resources/skills/userinterface-wiki/rules/a11y-volume-control.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/appropriate-confirmations-only.md +19 -0
- package/src/resources/skills/userinterface-wiki/rules/appropriate-errors-warnings.md +18 -0
- package/src/resources/skills/userinterface-wiki/rules/appropriate-no-decorative.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/appropriate-no-high-frequency.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/appropriate-no-punishing.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/container-callback-ref.md +31 -0
- package/src/resources/skills/userinterface-wiki/rules/container-guard-initial-zero.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/container-no-excessive-use.md +13 -0
- package/src/resources/skills/userinterface-wiki/rules/container-overflow-hidden.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/container-transition-delay.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/container-two-div-pattern.md +35 -0
- package/src/resources/skills/userinterface-wiki/rules/container-use-resize-observer.md +48 -0
- package/src/resources/skills/userinterface-wiki/rules/context-cleanup-nodes.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/context-resume-suspended.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/context-reuse-single.md +30 -0
- package/src/resources/skills/userinterface-wiki/rules/design-filter-for-character.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/design-noise-for-percussion.md +26 -0
- package/src/resources/skills/userinterface-wiki/rules/design-oscillator-for-tonal.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/duration-max-300ms.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/duration-press-hover.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/duration-shorten-before-curve.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/duration-small-state.md +15 -0
- package/src/resources/skills/userinterface-wiki/rules/easing-entrance-ease-out.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/easing-exit-ease-in.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/easing-for-state-change.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/easing-linear-only-progress.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/easing-natural-decay.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/easing-no-linear-motion.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/easing-transition-ease-in-out.md +15 -0
- package/src/resources/skills/userinterface-wiki/rules/envelope-exponential-decay.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/envelope-no-zero-target.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/envelope-set-initial-value.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/exit-key-required.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/exit-matches-initial.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/exit-prop-required.md +33 -0
- package/src/resources/skills/userinterface-wiki/rules/exit-requires-wrapper.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/impl-default-subtle.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/impl-preload-audio.md +34 -0
- package/src/resources/skills/userinterface-wiki/rules/impl-reset-current-time.md +26 -0
- package/src/resources/skills/userinterface-wiki/rules/mode-pop-layout-for-lists.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/mode-sync-layout-conflict.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/mode-wait-doubles-duration.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-aria-hidden.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-consistent-viewbox.md +23 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-group-variants.md +33 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-jump-non-grouped.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-reduced-motion.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-spring-rotation.md +23 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-strokelinecap-round.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-three-lines.md +32 -0
- package/src/resources/skills/userinterface-wiki/rules/morphing-use-collapsed.md +33 -0
- package/src/resources/skills/userinterface-wiki/rules/native-backdrop-styling.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/native-placeholder-styling.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/native-selection-styling.md +18 -0
- package/src/resources/skills/userinterface-wiki/rules/nested-consistent-timing.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/nested-propagate-required.md +41 -0
- package/src/resources/skills/userinterface-wiki/rules/none-context-menu-entrance.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/none-high-frequency.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/none-keyboard-navigation.md +32 -0
- package/src/resources/skills/userinterface-wiki/rules/param-click-duration.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/param-filter-frequency-range.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/param-q-value-range.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/param-reasonable-gain.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/physics-active-state.md +23 -0
- package/src/resources/skills/userinterface-wiki/rules/physics-no-excessive-stagger.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/physics-spring-for-overshoot.md +23 -0
- package/src/resources/skills/userinterface-wiki/rules/physics-subtle-deformation.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/prefetch-hit-slop.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/prefetch-keyboard-tab.md +19 -0
- package/src/resources/skills/userinterface-wiki/rules/prefetch-not-everything.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/prefetch-touch-fallback.md +34 -0
- package/src/resources/skills/userinterface-wiki/rules/prefetch-trajectory-over-hover.md +32 -0
- package/src/resources/skills/userinterface-wiki/rules/prefetch-use-selectively.md +13 -0
- package/src/resources/skills/userinterface-wiki/rules/presence-disable-interactions.md +31 -0
- package/src/resources/skills/userinterface-wiki/rules/presence-hook-in-child.md +31 -0
- package/src/resources/skills/userinterface-wiki/rules/presence-safe-to-remove.md +37 -0
- package/src/resources/skills/userinterface-wiki/rules/pseudo-content-required.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/pseudo-first-line-styling.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/pseudo-hit-target-expansion.md +31 -0
- package/src/resources/skills/userinterface-wiki/rules/pseudo-marker-styling.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/pseudo-over-dom-node.md +32 -0
- package/src/resources/skills/userinterface-wiki/rules/pseudo-position-relative-parent.md +33 -0
- package/src/resources/skills/userinterface-wiki/rules/pseudo-z-index-layering.md +37 -0
- package/src/resources/skills/userinterface-wiki/rules/spring-for-gestures.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/spring-for-interruptible.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/spring-params-balanced.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/spring-preserves-velocity.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/staging-dim-background.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/staging-one-focal-point.md +24 -0
- package/src/resources/skills/userinterface-wiki/rules/staging-z-index-hierarchy.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/timing-consistent.md +24 -0
- package/src/resources/skills/userinterface-wiki/rules/timing-no-entrance-context-menu.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/timing-under-300ms.md +22 -0
- package/src/resources/skills/userinterface-wiki/rules/transition-name-cleanup.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/transition-name-required.md +27 -0
- package/src/resources/skills/userinterface-wiki/rules/transition-name-unique.md +24 -0
- package/src/resources/skills/userinterface-wiki/rules/transition-over-js-library.md +32 -0
- package/src/resources/skills/userinterface-wiki/rules/transition-style-pseudo-elements.md +24 -0
- package/src/resources/skills/userinterface-wiki/rules/type-antialiased-on-retina.md +18 -0
- package/src/resources/skills/userinterface-wiki/rules/type-disambiguation-stylistic-set.md +15 -0
- package/src/resources/skills/userinterface-wiki/rules/type-font-display-swap.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/type-justify-with-hyphens.md +24 -0
- package/src/resources/skills/userinterface-wiki/rules/type-letter-spacing-uppercase.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/type-no-font-synthesis.md +18 -0
- package/src/resources/skills/userinterface-wiki/rules/type-oldstyle-nums-for-prose.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/type-opentype-contextual-alternates.md +15 -0
- package/src/resources/skills/userinterface-wiki/rules/type-optical-sizing-auto.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/type-proper-fractions.md +15 -0
- package/src/resources/skills/userinterface-wiki/rules/type-slashed-zero.md +17 -0
- package/src/resources/skills/userinterface-wiki/rules/type-tabular-nums-for-data.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/type-text-wrap-balance-headings.md +21 -0
- package/src/resources/skills/userinterface-wiki/rules/type-text-wrap-pretty.md +16 -0
- package/src/resources/skills/userinterface-wiki/rules/type-underline-offset.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/type-variable-weight-continuous.md +23 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-aesthetic-usability.md +32 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-cognitive-load-reduce.md +49 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-common-region-boundaries.md +50 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-doherty-perceived-speed.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-doherty-under-400ms.md +30 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-fitts-hit-area.md +32 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-fitts-target-size.md +31 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-goal-gradient-progress.md +33 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-hicks-minimize-choices.md +45 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-jakobs-familiar-patterns.md +37 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-millers-chunking.md +23 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-pareto-prioritize-features.md +36 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-peak-end-finish-strong.md +35 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-postels-accept-messy-input.md +45 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-pragnanz-simplify.md +33 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-progressive-disclosure.md +41 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-proximity-grouping.md +38 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-serial-position.md +31 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-similarity-consistency.md +35 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-teslers-complexity.md +28 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-uniform-connectedness.md +43 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-von-restorff-emphasis.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/ux-zeigarnik-show-incomplete.md +36 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-animate-shadow-pseudo.md +49 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-border-alpha-colors.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-button-shadow-anatomy.md +49 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-concentric-radius.md +40 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-consistent-spacing-scale.md +35 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-layered-shadows.md +30 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-no-pure-black-shadow.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-shadow-direction.md +25 -0
- package/src/resources/skills/userinterface-wiki/rules/visual-shadow-matches-elevation.md +23 -0
- package/src/resources/skills/userinterface-wiki/rules/weight-duration-matches-action.md +29 -0
- package/src/resources/skills/userinterface-wiki/rules/weight-match-action.md +32 -0
- package/src/resources/skills/verify-before-complete/SKILL.md +98 -0
- package/src/resources/skills/web-design-guidelines/SKILL.md +39 -0
- package/src/resources/skills/web-quality-audit/SKILL.md +168 -0
- package/src/resources/skills/web-quality-audit/scripts/analyze.sh +91 -0
- package/src/resources/skills/write-docs/SKILL.md +82 -0
- package/src/resources/skills/write-milestone-brief/SKILL.md +135 -0
|
@@ -0,0 +1,2887 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Guided Flow — Smart Entry Wizard
|
|
3
|
+
*
|
|
4
|
+
* One function: showSmartEntry(). Reads state from disk, shows a contextual
|
|
5
|
+
* wizard via showNextAction(), and dispatches through GSD-WORKFLOW.md.
|
|
6
|
+
* No execution state, no hooks, no tools — the LLM does the rest.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ExtensionAPI, ExtensionContext, ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
|
10
|
+
import type { GSDState } from "./types.js";
|
|
11
|
+
import { showNextAction } from "../shared/tui.js";
|
|
12
|
+
import { loadFile, saveFile } from "./files.js";
|
|
13
|
+
import { isDbAvailable, getMilestone, getMilestoneSlices } from "./gsd-db.js";
|
|
14
|
+
import { parseRoadmapSlices } from "./roadmap-slices.js";
|
|
15
|
+
import { loadPrompt, inlineTemplate } from "./prompt-loader.js";
|
|
16
|
+
import {
|
|
17
|
+
buildCompleteSlicePrompt,
|
|
18
|
+
buildDiscussMilestonePrompt,
|
|
19
|
+
buildExecuteTaskPrompt,
|
|
20
|
+
buildPlanMilestonePrompt,
|
|
21
|
+
buildPlanSlicePrompt,
|
|
22
|
+
buildSkillActivationBlock,
|
|
23
|
+
} from "./auto-prompts.js";
|
|
24
|
+
import { deriveState, isGhostMilestone } from "./state.js";
|
|
25
|
+
import { invalidateAllCaches } from "./cache.js";
|
|
26
|
+
import { startAutoDetached } from "./auto.js";
|
|
27
|
+
import { clearLock } from "./crash-recovery.js";
|
|
28
|
+
import {
|
|
29
|
+
assessInterruptedSession,
|
|
30
|
+
formatInterruptedSessionRunningMessage,
|
|
31
|
+
formatInterruptedSessionSummary,
|
|
32
|
+
} from "./interrupted-session.js";
|
|
33
|
+
import { listUnitRuntimeRecords, clearUnitRuntimeRecord, isInFlightRuntimePhase } from "./unit-runtime.js";
|
|
34
|
+
import { resolveExpectedArtifactPath } from "./auto.js";
|
|
35
|
+
import { gsdHome } from "./gsd-home.js";
|
|
36
|
+
import {
|
|
37
|
+
gsdRoot, milestonesDir, resolveMilestoneFile, resolveMilestonePath,
|
|
38
|
+
resolveSliceFile, resolveSlicePath, resolveGsdRootFile, relGsdRootFile,
|
|
39
|
+
relMilestoneFile, relSliceFile, clearPathCache,
|
|
40
|
+
} from "./paths.js";
|
|
41
|
+
import { join } from "node:path";
|
|
42
|
+
import { readFileSync, existsSync, mkdirSync, readdirSync, rmSync, unlinkSync } from "node:fs";
|
|
43
|
+
import { readSessionLockData, isSessionLockProcessAlive } from "./session-lock.js";
|
|
44
|
+
import { nativeAddAll, nativeCommit, nativeHasCommittedHead, nativeIsRepo, nativeInit } from "./native-git-bridge.js";
|
|
45
|
+
import { isInheritedRepo } from "./repo-identity.js";
|
|
46
|
+
import { ensureGitignore, ensurePreferences, untrackRuntimeFiles } from "./gitignore.js";
|
|
47
|
+
import { getIsolationMode, loadEffectiveGSDPreferences } from "./preferences.js";
|
|
48
|
+
import { resolveUokFlags } from "./uok/flags.js";
|
|
49
|
+
import { ensurePlanV2Graph, isMissingFinalizedContextResult } from "./uok/plan-v2.js";
|
|
50
|
+
import { detectProjectState, hasGsdBootstrapArtifacts } from "./detection.js";
|
|
51
|
+
import { isFutureMilestoneStatus } from "./status-guards.js";
|
|
52
|
+
import { showProjectInit, offerMigration } from "./init-wizard.js";
|
|
53
|
+
import { validateDirectory } from "./validate-directory.js";
|
|
54
|
+
import { showConfirm } from "../shared/tui.js";
|
|
55
|
+
import { debugLog } from "./debug-logger.js";
|
|
56
|
+
import { findMilestoneIds, clearReservedMilestoneIds } from "./milestone-ids.js";
|
|
57
|
+
import { nextMilestoneIdReserved } from "./milestone-id-reservation.js";
|
|
58
|
+
export { nextMilestoneIdReserved } from "./milestone-id-reservation.js";
|
|
59
|
+
import { parkMilestone, discardMilestone } from "./milestone-actions.js";
|
|
60
|
+
import { selectAndApplyModel } from "./auto-model-selection.js";
|
|
61
|
+
import { DISCUSS_TOOLS_ALLOWLIST } from "./constants.js";
|
|
62
|
+
import {
|
|
63
|
+
getWorkflowTransportSupportError,
|
|
64
|
+
getRequiredWorkflowToolsForGuidedUnit,
|
|
65
|
+
supportsStructuredQuestions,
|
|
66
|
+
} from "./workflow-mcp.js";
|
|
67
|
+
import {
|
|
68
|
+
runPreparation,
|
|
69
|
+
formatCodebaseBrief,
|
|
70
|
+
formatPriorContextBrief,
|
|
71
|
+
} from "./preparation.js";
|
|
72
|
+
import { verifyExpectedArtifact } from "./auto-recovery.js";
|
|
73
|
+
import type { MilestoneScope } from "./workspace.js";
|
|
74
|
+
import { getPendingGate, extractDepthVerificationMilestoneId } from "./bootstrap/write-gate.js";
|
|
75
|
+
import {
|
|
76
|
+
_getPendingAutoStart,
|
|
77
|
+
clearPendingAutoStart,
|
|
78
|
+
deletePendingAutoStart,
|
|
79
|
+
getDiscussionMilestoneId,
|
|
80
|
+
hasPendingAutoStart,
|
|
81
|
+
setPendingAutoStart,
|
|
82
|
+
} from "./pending-auto-start.js";
|
|
83
|
+
import { clearGuidedUnitContext, setGuidedUnitContext } from "./guided-unit-context.js";
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
_getPendingAutoStart,
|
|
87
|
+
clearPendingAutoStart,
|
|
88
|
+
getDiscussionMilestoneId,
|
|
89
|
+
setPendingAutoStart,
|
|
90
|
+
} from "./pending-auto-start.js";
|
|
91
|
+
|
|
92
|
+
export function shouldSkipGitBootstrapAfterInit(result: { gitEnabled?: boolean }): boolean {
|
|
93
|
+
return result.gitEnabled === false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ─── Re-exports (preserve public API for existing importers) ────────────────
|
|
97
|
+
export {
|
|
98
|
+
MILESTONE_ID_RE, generateMilestoneSuffix, nextMilestoneId,
|
|
99
|
+
extractMilestoneSeq, parseMilestoneId, milestoneIdSort,
|
|
100
|
+
maxMilestoneNum, findMilestoneIds,
|
|
101
|
+
reserveMilestoneId, claimReservedId, getReservedMilestoneIds, clearReservedMilestoneIds,
|
|
102
|
+
} from "./milestone-ids.js";
|
|
103
|
+
export {
|
|
104
|
+
showQueue, handleQueueReorder, showQueueAdd,
|
|
105
|
+
buildExistingMilestonesContext,
|
|
106
|
+
} from "./guided-flow-queue.js";
|
|
107
|
+
import { logWarning } from "./workflow-logger.js";
|
|
108
|
+
import { readManifest } from "./workflow-manifest.js";
|
|
109
|
+
import { deleteRuntimeKv } from "./db/runtime-kv.js";
|
|
110
|
+
import { PAUSED_SESSION_KV_KEY } from "./interrupted-session.js";
|
|
111
|
+
import { buildWorkflowDispatchContent } from "./workflow-protocol.js";
|
|
112
|
+
import { isFullGsdToolSurfaceRequested, restoreGsdWorkflowTools, scopeGsdWorkflowToolsForDispatch } from "./bootstrap/register-hooks.js";
|
|
113
|
+
import {
|
|
114
|
+
resolveActiveTaskChoiceRoute,
|
|
115
|
+
type ActiveTaskChoice,
|
|
116
|
+
} from "./smart-entry-routing.js";
|
|
117
|
+
|
|
118
|
+
export { resolveGuidedExecuteLaunchMode } from "./smart-entry-routing.js";
|
|
119
|
+
|
|
120
|
+
export interface HeadlessMilestoneCreationOptions {
|
|
121
|
+
startAutoAfterReady?: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type AutoStartOptions = Parameters<typeof startAutoDetached>[4];
|
|
125
|
+
type AutoStartLauncher = typeof startAutoDetached;
|
|
126
|
+
|
|
127
|
+
function scheduleAutoStartAfterIdle(
|
|
128
|
+
ctx: ExtensionCommandContext,
|
|
129
|
+
pi: ExtensionAPI,
|
|
130
|
+
basePath: string,
|
|
131
|
+
verboseMode: boolean,
|
|
132
|
+
options?: AutoStartOptions,
|
|
133
|
+
launch: AutoStartLauncher = startAutoDetached,
|
|
134
|
+
): void {
|
|
135
|
+
const waitForIdle =
|
|
136
|
+
typeof (ctx as { waitForIdle?: unknown }).waitForIdle === "function"
|
|
137
|
+
? ctx.waitForIdle.bind(ctx)
|
|
138
|
+
: async () => {};
|
|
139
|
+
void waitForIdle()
|
|
140
|
+
.then(() => {
|
|
141
|
+
setTimeout(() => launch(ctx, pi, basePath, verboseMode, options), 0);
|
|
142
|
+
})
|
|
143
|
+
.catch((err) => {
|
|
144
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
145
|
+
ctx.ui.notify(`Auto-start failed while waiting for the prior turn to settle: ${message}`, "error");
|
|
146
|
+
logWarning("guided", `auto-start idle wait failed: ${message}`);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const _scheduleAutoStartAfterIdleForTest = scheduleAutoStartAfterIdle;
|
|
151
|
+
|
|
152
|
+
// ─── Scope-based validator wrappers ──────────────────────────────────────────
|
|
153
|
+
// These thin wrappers accept a MilestoneScope so callers that already hold a
|
|
154
|
+
// pinned scope never have to re-derive (basePath, milestoneId) separately.
|
|
155
|
+
// The underlying implementations in auto-recovery.ts / auto-artifact-paths.ts /
|
|
156
|
+
// state.ts are unchanged — only the call surface in guided-flow.ts is migrated.
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Scope-based overload of verifyExpectedArtifact.
|
|
160
|
+
* Uses scope.workspace.projectRoot as the authoritative base path, making
|
|
161
|
+
* the check immune to cwd-drift and worktree-path divergence.
|
|
162
|
+
*/
|
|
163
|
+
export function verifyExpectedArtifactForScope(
|
|
164
|
+
scope: MilestoneScope,
|
|
165
|
+
unitType: string,
|
|
166
|
+
unitId: string,
|
|
167
|
+
): boolean {
|
|
168
|
+
return verifyExpectedArtifact(unitType, unitId, scope.workspace.projectRoot);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Scope-based overload of resolveExpectedArtifactPath.
|
|
173
|
+
* Returns the canonical absolute path (or null) using the scope's projectRoot.
|
|
174
|
+
*/
|
|
175
|
+
export function resolveExpectedArtifactPathForScope(
|
|
176
|
+
scope: MilestoneScope,
|
|
177
|
+
unitType: string,
|
|
178
|
+
unitId: string,
|
|
179
|
+
): string | null {
|
|
180
|
+
return resolveExpectedArtifactPath(unitType, unitId, scope.workspace.projectRoot);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async function runQuickTaskChoice(ctx: ExtensionCommandContext, pi: ExtensionAPI): Promise<void> {
|
|
184
|
+
if (!ctx.hasUI) {
|
|
185
|
+
ctx.ui.notify("Run /gsd quick <task> for small bounded work, or /gsd do <task> for natural-language routing.", "info");
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const task = (await ctx.ui.input("Quick task", "Describe the small task to run with /gsd quick"))?.trim();
|
|
190
|
+
if (!task) {
|
|
191
|
+
ctx.ui.notify("Quick task cancelled.", "info");
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const { handleQuick } = await import("./quick.js");
|
|
196
|
+
await handleQuick(task, ctx, pi);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function isNonInteractiveContext(ctx: ExtensionCommandContext): boolean {
|
|
200
|
+
if (!ctx.hasUI) return true;
|
|
201
|
+
return process.env.GSD_HEADLESS === "1" || process.env.GSD_WEB_BRIDGE_TUI === "1";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Scope-based overload of isGhostMilestone.
|
|
206
|
+
* Binds basePath and milestoneId from the scope, ensuring path resolution
|
|
207
|
+
* uses the canonical project root regardless of the cwd at call time.
|
|
208
|
+
*/
|
|
209
|
+
export function isGhostMilestoneByScope(scope: MilestoneScope): boolean {
|
|
210
|
+
return isGhostMilestone(scope.workspace.projectRoot, scope.milestoneId);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function needsPlanV2Gate(state: GSDState): boolean {
|
|
214
|
+
return state.phase === "executing"
|
|
215
|
+
|| state.phase === "summarizing"
|
|
216
|
+
|| state.phase === "validating-milestone"
|
|
217
|
+
|| state.phase === "completing-milestone";
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
type PlanV2GateDecision = "pass" | "recover-missing-context" | "block";
|
|
221
|
+
|
|
222
|
+
function runPlanV2Gate(
|
|
223
|
+
ctx: ExtensionContext,
|
|
224
|
+
basePath: string,
|
|
225
|
+
state: GSDState,
|
|
226
|
+
): PlanV2GateDecision {
|
|
227
|
+
const prefs = loadEffectiveGSDPreferences(basePath)?.preferences;
|
|
228
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
229
|
+
if (!uokFlags.planV2 || !needsPlanV2Gate(state)) return "pass";
|
|
230
|
+
const compiled = ensurePlanV2Graph(basePath, state);
|
|
231
|
+
if (!compiled.ok) {
|
|
232
|
+
if (isMissingFinalizedContextResult(compiled)) {
|
|
233
|
+
return "recover-missing-context";
|
|
234
|
+
}
|
|
235
|
+
const reason = compiled.reason ?? "plan-v2 compilation failed";
|
|
236
|
+
ctx.ui.notify(
|
|
237
|
+
`Plan gate failed-closed: ${reason}. Complete plan/discuss artifacts before execution.\n\nIf this keeps happening, try: /gsd doctor heal`,
|
|
238
|
+
"error",
|
|
239
|
+
);
|
|
240
|
+
return "block";
|
|
241
|
+
}
|
|
242
|
+
return "pass";
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const _needsPlanV2GateForTest = needsPlanV2Gate;
|
|
246
|
+
export const _runPlanV2GateForTest = runPlanV2Gate;
|
|
247
|
+
|
|
248
|
+
export function _roadmapHasParseableSlicesForTest(
|
|
249
|
+
roadmapContent: string | null | undefined,
|
|
250
|
+
): boolean {
|
|
251
|
+
if (!roadmapContent) return false;
|
|
252
|
+
return parseRoadmapSlices(roadmapContent).length > 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// ─── Commit Instruction Helpers ──────────────────────────────────────────────
|
|
256
|
+
|
|
257
|
+
/** Build commit instruction for planning prompts. .gsd/ is managed externally and always gitignored. */
|
|
258
|
+
function buildDocsCommitInstruction(_message: string): string {
|
|
259
|
+
return "Do not commit planning artifacts — .gsd/ is managed externally.";
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// ─── Auto-start after discuss ─────────────────────────────────────────────────
|
|
263
|
+
|
|
264
|
+
interface PendingDeepProjectSetupEntry {
|
|
265
|
+
ctx: ExtensionCommandContext;
|
|
266
|
+
pi: ExtensionAPI;
|
|
267
|
+
basePath: string;
|
|
268
|
+
step?: boolean;
|
|
269
|
+
createdAt: number;
|
|
270
|
+
sessionId?: string;
|
|
271
|
+
currentUnitType?: string;
|
|
272
|
+
currentUnitId?: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// #4573: cap for how many times we nudge the LLM after a premature ready
|
|
276
|
+
// phrase before giving up and asking the user to re-run /gsd.
|
|
277
|
+
const MAX_READY_REJECTS = 2;
|
|
278
|
+
|
|
279
|
+
// H1 (#5012): cap for Gate 1b plan-blocked recovery hints. After this many
|
|
280
|
+
// consecutive recovery attempts the loop is stopped and the user is directed
|
|
281
|
+
// to investigate manually.
|
|
282
|
+
const MAX_PLAN_BLOCKED_RECOVERIES = 3;
|
|
283
|
+
|
|
284
|
+
// #4573: matches the canonical ready phrase the discuss prompt asks the LLM
|
|
285
|
+
// to emit. Accepts any M-prefixed milestone ID (three digits + optional
|
|
286
|
+
// suffix) with optional trailing punctuation.
|
|
287
|
+
const READY_PHRASE_RE = /\bMilestone\s+M\d{3}[A-Z0-9-]*\s+ready\.?/i;
|
|
288
|
+
|
|
289
|
+
const pendingDeepProjectSetupMap = new Map<string, PendingDeepProjectSetupEntry>();
|
|
290
|
+
const USER_DRIVEN_DEEP_SETUP_UNITS = new Set([
|
|
291
|
+
"discuss-project",
|
|
292
|
+
"discuss-requirements",
|
|
293
|
+
"research-decision",
|
|
294
|
+
]);
|
|
295
|
+
export const FOREGROUND_DEEP_SETUP_RULE_NAMES = new Set([
|
|
296
|
+
"deep: pre-planning (no workflow prefs) → workflow-preferences",
|
|
297
|
+
"deep: pre-planning (no PROJECT) → discuss-project",
|
|
298
|
+
"deep: pre-planning (no REQUIREMENTS) → discuss-requirements",
|
|
299
|
+
"deep: pre-planning (no research decision) → research-decision",
|
|
300
|
+
]);
|
|
301
|
+
const LEGACY_DEEP_SETUP_PSEUDO_MILESTONE_DIRS = new Set([
|
|
302
|
+
"PROJECT",
|
|
303
|
+
"REQUIREMENTS",
|
|
304
|
+
"RESEARCH-DECISION",
|
|
305
|
+
"RESEARCH-PROJECT",
|
|
306
|
+
"WORKFLOW-PREFS",
|
|
307
|
+
]);
|
|
308
|
+
const FOREGROUND_DEEP_SETUP_QUESTION_POLICY = `## Foreground Deep Setup Question Policy
|
|
309
|
+
|
|
310
|
+
This stage is running inside the foreground \`/gsd new-project --deep\` interview. Ask user questions in plain chat only.
|
|
311
|
+
|
|
312
|
+
- Do NOT call \`ask_user_questions\`, \`AskUserQuestion\`, or ToolSearch to discover user-input tools.
|
|
313
|
+
- Ask one focused round, then stop and wait for the user's normal chat response.`;
|
|
314
|
+
|
|
315
|
+
function hasNestedFileOrSymlink(dir: string): boolean {
|
|
316
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
317
|
+
if (entry.isFile() || entry.isSymbolicLink()) return true;
|
|
318
|
+
if (entry.isDirectory() && hasNestedFileOrSymlink(join(dir, entry.name))) return true;
|
|
319
|
+
}
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function clearEmptyLegacyDeepSetupPseudoMilestones(basePath: string, entries: string[]): string[] {
|
|
324
|
+
const mDir = milestonesDir(basePath);
|
|
325
|
+
const remaining: string[] = [];
|
|
326
|
+
for (const entry of entries) {
|
|
327
|
+
if (!LEGACY_DEEP_SETUP_PSEUDO_MILESTONE_DIRS.has(entry)) {
|
|
328
|
+
remaining.push(entry);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const entryPath = join(mDir, entry);
|
|
333
|
+
try {
|
|
334
|
+
if (hasNestedFileOrSymlink(entryPath)) {
|
|
335
|
+
remaining.push(entry);
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
rmSync(entryPath, { recursive: true, force: true });
|
|
339
|
+
logWarning("guided", `Self-heal: removed empty legacy deep setup pseudo-milestone directory ${entry}`);
|
|
340
|
+
} catch (err) {
|
|
341
|
+
remaining.push(entry);
|
|
342
|
+
logWarning("guided", `legacy deep setup pseudo-milestone cleanup failed for ${entry}: ${(err as Error).message}`);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return remaining;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function clearPendingDeepProjectSetup(basePath?: string): void {
|
|
349
|
+
if (basePath) {
|
|
350
|
+
pendingDeepProjectSetupMap.delete(basePath);
|
|
351
|
+
} else {
|
|
352
|
+
pendingDeepProjectSetupMap.clear();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function _getPendingDeepProjectSetup(basePath?: string): PendingDeepProjectSetupEntry | null {
|
|
357
|
+
if (basePath) return pendingDeepProjectSetupMap.get(basePath) ?? null;
|
|
358
|
+
if (pendingDeepProjectSetupMap.size === 1) return pendingDeepProjectSetupMap.values().next().value!;
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function getDeepSetupSessionId(ctx: ExtensionContext | undefined): string | undefined {
|
|
363
|
+
return ctx?.sessionManager?.getSessionId?.();
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function _getPendingDeepProjectSetupForContext(
|
|
367
|
+
ctx: ExtensionContext | undefined,
|
|
368
|
+
basePath?: string,
|
|
369
|
+
): PendingDeepProjectSetupEntry | null {
|
|
370
|
+
if (basePath) {
|
|
371
|
+
const direct = pendingDeepProjectSetupMap.get(basePath);
|
|
372
|
+
if (direct) return direct;
|
|
373
|
+
}
|
|
374
|
+
if (!ctx) return _getPendingDeepProjectSetup();
|
|
375
|
+
|
|
376
|
+
const sessionId = getDeepSetupSessionId(ctx);
|
|
377
|
+
if (sessionId) {
|
|
378
|
+
const matches = [...pendingDeepProjectSetupMap.values()].filter(entry => entry.sessionId === sessionId);
|
|
379
|
+
if (matches.length === 1) return matches[0]!;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const matches = [...pendingDeepProjectSetupMap.values()].filter(entry => entry.ctx === ctx);
|
|
383
|
+
return matches.length === 1 ? matches[0]! : null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export function getPendingDeepProjectSetupUnitForContext(
|
|
387
|
+
ctx: ExtensionContext | undefined,
|
|
388
|
+
basePath?: string,
|
|
389
|
+
): { unitType: string; unitId: string } | null {
|
|
390
|
+
const entry = _getPendingDeepProjectSetupForContext(ctx, basePath);
|
|
391
|
+
if (!entry?.currentUnitType || !entry.currentUnitId) return null;
|
|
392
|
+
return {
|
|
393
|
+
unitType: entry.currentUnitType,
|
|
394
|
+
unitId: entry.currentUnitId,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export async function startDeepProjectSetupForeground(
|
|
399
|
+
ctx: ExtensionCommandContext,
|
|
400
|
+
pi: ExtensionAPI,
|
|
401
|
+
basePath: string,
|
|
402
|
+
step?: boolean,
|
|
403
|
+
): Promise<void> {
|
|
404
|
+
const entry: PendingDeepProjectSetupEntry = {
|
|
405
|
+
ctx,
|
|
406
|
+
pi,
|
|
407
|
+
basePath,
|
|
408
|
+
step,
|
|
409
|
+
createdAt: Date.now(),
|
|
410
|
+
sessionId: getDeepSetupSessionId(ctx),
|
|
411
|
+
};
|
|
412
|
+
pendingDeepProjectSetupMap.set(basePath, entry);
|
|
413
|
+
await dispatchNextDeepProjectSetupStage(entry);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export async function checkDeepProjectSetupAfterTurn(
|
|
417
|
+
_event: { messages: any[] },
|
|
418
|
+
ctx?: ExtensionContext,
|
|
419
|
+
basePath?: string,
|
|
420
|
+
): Promise<boolean> {
|
|
421
|
+
const entry = _getPendingDeepProjectSetupForContext(ctx, basePath);
|
|
422
|
+
if (!entry) return false;
|
|
423
|
+
|
|
424
|
+
if (entry.currentUnitType && entry.currentUnitId) {
|
|
425
|
+
// TODO(C-future): PendingDeepProjectSetupEntry does not carry a MilestoneScope
|
|
426
|
+
// because deep-project-setup units span non-milestone unit types (discuss-project,
|
|
427
|
+
// discuss-requirements, etc.). Migrate to verifyExpectedArtifactForScope once
|
|
428
|
+
// PendingDeepProjectSetupEntry is extended with a scope field.
|
|
429
|
+
const artifactReady = verifyExpectedArtifact(entry.currentUnitType, entry.currentUnitId, entry.basePath);
|
|
430
|
+
if (!artifactReady) {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// R2: a depth-verification gate is still pending — the LLM emitted the
|
|
436
|
+
// confirmation question (via ask_user_questions or plain chat) but the user
|
|
437
|
+
// has not approved yet. Returning false keeps the entry in the
|
|
438
|
+
// pendingDeepProjectSetupMap so the next user message can resume.
|
|
439
|
+
const pendingGateId = getPendingGate(entry.basePath);
|
|
440
|
+
if (pendingGateId) {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return dispatchNextDeepProjectSetupStage(entry);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
async function dispatchNextDeepProjectSetupStage(entry: PendingDeepProjectSetupEntry): Promise<boolean> {
|
|
448
|
+
invalidateAllCaches();
|
|
449
|
+
const prefs = loadEffectiveGSDPreferences(entry.basePath)?.preferences;
|
|
450
|
+
const { DISPATCH_RULES, hasPendingDeepStage } = await import("./auto-dispatch.js");
|
|
451
|
+
|
|
452
|
+
if (!hasPendingDeepStage(prefs, entry.basePath)) {
|
|
453
|
+
pendingDeepProjectSetupMap.delete(entry.basePath);
|
|
454
|
+
scheduleAutoStartAfterIdle(entry.ctx, entry.pi, entry.basePath, false, { step: entry.step });
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const state = await deriveState(entry.basePath);
|
|
459
|
+
const dispatchCtx = {
|
|
460
|
+
basePath: entry.basePath,
|
|
461
|
+
mid: "PROJECT",
|
|
462
|
+
midTitle: "Project setup",
|
|
463
|
+
state,
|
|
464
|
+
prefs,
|
|
465
|
+
// Claude Code currently surfaces workflow-MCP question calls as tool-request
|
|
466
|
+
// UI that can be cancelled outside the normal chat flow. During the
|
|
467
|
+
// foreground deep project setup interview, keep user input in plain chat so
|
|
468
|
+
// `/gsd new-project --deep` cannot bounce through cancelled tool requests.
|
|
469
|
+
structuredQuestionsAvailable: "false" as const,
|
|
470
|
+
};
|
|
471
|
+
let result: Awaited<ReturnType<(typeof DISPATCH_RULES)[number]["match"]>> = null;
|
|
472
|
+
for (const rule of DISPATCH_RULES) {
|
|
473
|
+
// Only evaluate foreground setup gates here. Later deep rules such as
|
|
474
|
+
// research-project have dispatch-time side effects (e.g. claiming an
|
|
475
|
+
// inflight marker) and must be left to auto-mode once the interview is
|
|
476
|
+
// complete.
|
|
477
|
+
if (!FOREGROUND_DEEP_SETUP_RULE_NAMES.has(rule.name)) continue;
|
|
478
|
+
result = await rule.match(dispatchCtx);
|
|
479
|
+
if (result) break;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (!result || result.action !== "dispatch") {
|
|
483
|
+
if (result?.action === "stop") {
|
|
484
|
+
entry.ctx.ui.notify(result.reason, result.level);
|
|
485
|
+
} else if (hasPendingDeepStage(prefs, entry.basePath)) {
|
|
486
|
+
pendingDeepProjectSetupMap.delete(entry.basePath);
|
|
487
|
+
scheduleAutoStartAfterIdle(entry.ctx, entry.pi, entry.basePath, false, { step: entry.step });
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (!USER_DRIVEN_DEEP_SETUP_UNITS.has(result.unitType)) {
|
|
494
|
+
pendingDeepProjectSetupMap.delete(entry.basePath);
|
|
495
|
+
scheduleAutoStartAfterIdle(entry.ctx, entry.pi, entry.basePath, false, { step: entry.step });
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
entry.currentUnitType = result.unitType;
|
|
500
|
+
entry.currentUnitId = result.unitId;
|
|
501
|
+
entry.createdAt = Date.now();
|
|
502
|
+
await dispatchWorkflow(
|
|
503
|
+
entry.pi,
|
|
504
|
+
`${result.prompt}\n\n${FOREGROUND_DEEP_SETUP_QUESTION_POLICY}`,
|
|
505
|
+
"gsd-run",
|
|
506
|
+
entry.ctx,
|
|
507
|
+
result.unitType,
|
|
508
|
+
{ basePath: entry.basePath },
|
|
509
|
+
);
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** Called from agent_end to check if auto-mode should start after discuss */
|
|
514
|
+
export function checkAutoStartAfterDiscuss(lookupBasePath?: string): boolean {
|
|
515
|
+
const entry = _getPendingAutoStart(lookupBasePath);
|
|
516
|
+
if (!entry) return false;
|
|
517
|
+
|
|
518
|
+
const { ctx, pi, basePath, milestoneId, step } = entry;
|
|
519
|
+
|
|
520
|
+
// Gate 1: Primary milestone must have CONTEXT.md or ROADMAP.md
|
|
521
|
+
// The "discuss" path creates CONTEXT.md; the "plan" path creates ROADMAP.md.
|
|
522
|
+
// Use pinned scope (immune to cwd-drift) for existence checks.
|
|
523
|
+
const contextFilePath = entry.scope.contextFile();
|
|
524
|
+
const roadmapFilePath = entry.scope.roadmapFile();
|
|
525
|
+
const contextFile = existsSync(contextFilePath) ? contextFilePath : null;
|
|
526
|
+
const roadmapFile = existsSync(roadmapFilePath) ? roadmapFilePath : null;
|
|
527
|
+
if (!contextFile && !roadmapFile) return false; // neither artifact yet — keep waiting
|
|
528
|
+
|
|
529
|
+
// Gate 1a: a depth-verification gate is still pending for THIS milestone — the
|
|
530
|
+
// LLM emitted the confirmation question (via ask_user_questions or plain chat)
|
|
531
|
+
// but the user has not answered yet. Advancing now would skip the gate and
|
|
532
|
+
// race ahead with unverified context.
|
|
533
|
+
const basePathForGate = entry.scope.workspace.projectRoot;
|
|
534
|
+
const pendingGateId = getPendingGate(basePathForGate);
|
|
535
|
+
if (pendingGateId) {
|
|
536
|
+
const pendingMilestoneId = extractDepthVerificationMilestoneId(pendingGateId);
|
|
537
|
+
// Block advancement if the gate is for THIS milestone, OR if it's a
|
|
538
|
+
// project/requirements gate (no milestone id encoded) for the deep setup flow.
|
|
539
|
+
const isProjectGate =
|
|
540
|
+
pendingGateId === "depth_verification_project_confirm" ||
|
|
541
|
+
pendingGateId === "depth_verification_requirements_confirm" ||
|
|
542
|
+
pendingGateId === "depth_verification_research_decision_confirm";
|
|
543
|
+
if (pendingMilestoneId === milestoneId || isProjectGate) {
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Gate 1b: Discriminate plan-blocked from discuss-incomplete when the DB row is queued.
|
|
549
|
+
// If the DB is available and the row is still "queued" but CONTEXT.md already exists on
|
|
550
|
+
// disk, the discuss phase completed but gsd_plan_milestone was hard-blocked by the
|
|
551
|
+
// depth-verification gate. Emit a recovery hint so the next agent turn can retry
|
|
552
|
+
// gsd_plan_milestone, then return false (keep blocking auto-start).
|
|
553
|
+
// If CONTEXT.md does not exist (discuss-incomplete), Gate 1 already blocked above.
|
|
554
|
+
if (isDbAvailable()) {
|
|
555
|
+
const dbRow = getMilestone(milestoneId);
|
|
556
|
+
if (dbRow?.status === "queued" && contextFile) {
|
|
557
|
+
if (entry.planBlockedRecoveryCount >= MAX_PLAN_BLOCKED_RECOVERIES) {
|
|
558
|
+
// H1: recovery loop cap reached — stop triggering new turns, escalate to user.
|
|
559
|
+
logWarning(
|
|
560
|
+
"guided",
|
|
561
|
+
`Gate 1b: milestone ${milestoneId} plan-blocked recovery limit reached ` +
|
|
562
|
+
`(${entry.planBlockedRecoveryCount}/${MAX_PLAN_BLOCKED_RECOVERIES}); escalating to user`,
|
|
563
|
+
);
|
|
564
|
+
ctx.ui.notify(
|
|
565
|
+
`Milestone ${milestoneId} plan_milestone has been blocked ${entry.planBlockedRecoveryCount} times. ` +
|
|
566
|
+
`Re-run /gsd to reset the recovery counter, or run /gsd-debug to diagnose without resetting.`,
|
|
567
|
+
"error",
|
|
568
|
+
);
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
logWarning(
|
|
572
|
+
"guided",
|
|
573
|
+
`Gate 1b: milestone ${milestoneId} queued with CONTEXT.md present — ` +
|
|
574
|
+
`plan_milestone was blocked; emitting recovery hint ` +
|
|
575
|
+
`(attempt ${entry.planBlockedRecoveryCount + 1}/${MAX_PLAN_BLOCKED_RECOVERIES})`,
|
|
576
|
+
);
|
|
577
|
+
ctx.ui.notify(
|
|
578
|
+
`Milestone ${milestoneId}: context file exists but milestone is still queued. ` +
|
|
579
|
+
`Retrying gsd_plan_milestone to complete the blocked planning step.`,
|
|
580
|
+
"warning",
|
|
581
|
+
);
|
|
582
|
+
try {
|
|
583
|
+
pi.sendMessage(
|
|
584
|
+
{
|
|
585
|
+
customType: "gsd-plan-milestone-blocked-recovery",
|
|
586
|
+
content:
|
|
587
|
+
`Milestone ${milestoneId} has ${contextFile} on disk but its DB row is still ` +
|
|
588
|
+
`"queued". The gsd_plan_milestone tool was previously blocked by the ` +
|
|
589
|
+
`depth-verification gate. Call gsd_plan_milestone now to complete the ` +
|
|
590
|
+
`planning phase.`,
|
|
591
|
+
display: false,
|
|
592
|
+
},
|
|
593
|
+
{ triggerTurn: true },
|
|
594
|
+
);
|
|
595
|
+
// Increment only after a successful dispatch so transient sendMessage
|
|
596
|
+
// failures do not consume recovery budget.
|
|
597
|
+
entry.planBlockedRecoveryCount += 1;
|
|
598
|
+
} catch (e) {
|
|
599
|
+
logWarning("guided", `Gate 1b recovery sendMessage failed: ${(e as Error).message}`);
|
|
600
|
+
}
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// Gate 2: STATE.md must exist — written as the last step in the discuss
|
|
606
|
+
// output phase. This prevents auto-start from firing during Phase 3
|
|
607
|
+
// (sequential readiness gates for remaining milestones) in multi-milestone
|
|
608
|
+
// discussions, where M001-CONTEXT.md exists but M002/M003 haven't been
|
|
609
|
+
// processed yet.
|
|
610
|
+
const stateFilePath = entry.scope.stateFile();
|
|
611
|
+
if (!existsSync(stateFilePath)) return false; // discussion not finalized yet
|
|
612
|
+
|
|
613
|
+
// Gate 3: Multi-milestone completeness warning
|
|
614
|
+
// Parse PROJECT.md for milestone sequence, warn if any are missing context.
|
|
615
|
+
// Don't block — milestones can be intentionally queued without context.
|
|
616
|
+
const projectFile = resolveGsdRootFile(basePath, "PROJECT");
|
|
617
|
+
let projectIds: string[] = [];
|
|
618
|
+
if (projectFile) {
|
|
619
|
+
try {
|
|
620
|
+
const projectContent = readFileSync(projectFile, "utf-8");
|
|
621
|
+
projectIds = parseMilestoneSequenceFromProject(projectContent);
|
|
622
|
+
if (projectIds.length > 1) {
|
|
623
|
+
const missing = projectIds.filter(id => {
|
|
624
|
+
const hasContext = !!resolveMilestoneFile(basePath, id, "CONTEXT");
|
|
625
|
+
const hasDraft = !!resolveMilestoneFile(basePath, id, "CONTEXT-DRAFT");
|
|
626
|
+
const hasDir = existsSync(join(gsdRoot(basePath), "milestones", id));
|
|
627
|
+
return !hasContext && !hasDraft && !hasDir;
|
|
628
|
+
});
|
|
629
|
+
if (missing.length > 0) {
|
|
630
|
+
ctx.ui.notify(
|
|
631
|
+
`Multi-milestone validation: ${missing.join(", ")} not found in filesystem. ` +
|
|
632
|
+
`Discussion may not have completed all readiness gates.`,
|
|
633
|
+
"warning",
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
} catch (e) { logWarning("guided", `PROJECT.md parsing failed: ${(e as Error).message}`); }
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// Gate 4: Discussion manifest process verification (multi-milestone only)
|
|
641
|
+
// The LLM writes DISCUSSION-MANIFEST.json after each Phase 3 gate decision.
|
|
642
|
+
// When it exists, validate it before auto-starting. Project history alone is
|
|
643
|
+
// not a reliable signal for the current discussion mode.
|
|
644
|
+
const manifestPath = join(entry.scope.workspace.contract.projectGsd, "DISCUSSION-MANIFEST.json");
|
|
645
|
+
if (existsSync(manifestPath)) {
|
|
646
|
+
try {
|
|
647
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
648
|
+
const total = typeof manifest.total === "number" ? manifest.total : 0;
|
|
649
|
+
const completed = typeof manifest.gates_completed === "number" ? manifest.gates_completed : 0;
|
|
650
|
+
|
|
651
|
+
if (total > 1 && completed < total) {
|
|
652
|
+
// Discussion not complete — block auto-start until all gates are done
|
|
653
|
+
return false;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// Cross-check manifest milestones against PROJECT.md if available
|
|
657
|
+
if (projectIds.length > 0) {
|
|
658
|
+
const manifestIds = Object.keys(manifest.milestones ?? {});
|
|
659
|
+
const untracked = projectIds.filter(id => !manifestIds.includes(id));
|
|
660
|
+
if (untracked.length > 0) {
|
|
661
|
+
ctx.ui.notify(
|
|
662
|
+
`Discussion manifest missing gates for: ${untracked.join(", ")}`,
|
|
663
|
+
"warning",
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
} catch (e) { logWarning("guided", `discussion manifest verification failed: ${(e as Error).message}`); }
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// Draft promotion cleanup: if a CONTEXT-DRAFT.md exists alongside the new
|
|
671
|
+
// CONTEXT.md, delete the draft — it's been consumed by the discussion.
|
|
672
|
+
try {
|
|
673
|
+
const draftFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT-DRAFT");
|
|
674
|
+
if (draftFile) unlinkSync(draftFile);
|
|
675
|
+
} catch (e) { logWarning("guided", `CONTEXT-DRAFT.md unlink failed: ${(e as Error).message}`); }
|
|
676
|
+
|
|
677
|
+
// Cleanup: remove discussion manifest after auto-start (only needed during discussion)
|
|
678
|
+
if (existsSync(manifestPath)) {
|
|
679
|
+
try { unlinkSync(manifestPath); } catch (e) { logWarning("guided", `manifest unlink failed: ${(e as Error).message}`); }
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
// R3b: belt-and-suspenders for silent registration failure. The discuss flow
|
|
683
|
+
// finished and STATE.md exists, but the milestone may never have landed in
|
|
684
|
+
// the DB. Without this guard, the user sees "Milestone M001 ready." and then
|
|
685
|
+
// /gsd reports "No Active Milestone".
|
|
686
|
+
if (isDbAvailable()) {
|
|
687
|
+
const milestoneRow = getMilestone(milestoneId);
|
|
688
|
+
if (!milestoneRow) {
|
|
689
|
+
let manifestHasMilestone = false;
|
|
690
|
+
try {
|
|
691
|
+
const manifest = readManifest(basePath);
|
|
692
|
+
manifestHasMilestone = Array.isArray(manifest?.milestones) && manifest.milestones.some(m => m.id === milestoneId);
|
|
693
|
+
} catch (e) {
|
|
694
|
+
logWarning("guided", `R3b: failed to read state manifest: ${(e as Error).message}`);
|
|
695
|
+
}
|
|
696
|
+
if (manifestHasMilestone) {
|
|
697
|
+
logWarning("guided", `R3b: getMilestone(${milestoneId}) returned null but manifest has the row — treating as stale read`);
|
|
698
|
+
} else {
|
|
699
|
+
ctx.ui.notify(
|
|
700
|
+
`Milestone ${milestoneId}: discuss artifacts on disk but no DB row exists. ` +
|
|
701
|
+
`PROJECT.md may have failed to register milestones. ` +
|
|
702
|
+
`Re-save PROJECT.md with canonical "- [ ] M001: Title — One-liner" lines, ` +
|
|
703
|
+
`then re-run /gsd to recover.`,
|
|
704
|
+
"error",
|
|
705
|
+
);
|
|
706
|
+
return false;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
deletePendingAutoStart(basePath);
|
|
712
|
+
ctx.ui.notify(`Milestone ${milestoneId} ready.`, "success");
|
|
713
|
+
if (entry.startAuto !== false) {
|
|
714
|
+
scheduleAutoStartAfterIdle(ctx, pi, basePath, false, { step });
|
|
715
|
+
}
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Extract the concatenated text content from an assistant message, whether it
|
|
721
|
+
* stores content as a string or as an array of text blocks.
|
|
722
|
+
*/
|
|
723
|
+
function extractAssistantText(msg: any): string {
|
|
724
|
+
if (!msg) return "";
|
|
725
|
+
const content = msg.content;
|
|
726
|
+
if (typeof content === "string") return content;
|
|
727
|
+
if (!Array.isArray(content)) return "";
|
|
728
|
+
const parts: string[] = [];
|
|
729
|
+
for (const block of content) {
|
|
730
|
+
if (!block || typeof block !== "object") continue;
|
|
731
|
+
if (block.type === "text" && typeof block.text === "string") parts.push(block.text);
|
|
732
|
+
}
|
|
733
|
+
return parts.join("\n");
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Return true if the assistant message contains any tool-use block.
|
|
738
|
+
*
|
|
739
|
+
* The canonical pi-ai `AssistantMessage.content` (see packages/pi-ai/src/types.ts)
|
|
740
|
+
* uses `type: "toolCall"` and `type: "serverToolUse"` for tool invocations —
|
|
741
|
+
* every provider (anthropic-direct, claude-code-cli, openai, etc.) normalizes
|
|
742
|
+
* incoming tool blocks into these two shapes before they reach guided-flow.
|
|
743
|
+
*
|
|
744
|
+
* The Anthropic API wire shape `"tool_use"` / `"server_tool_use"` does NOT appear
|
|
745
|
+
* in the internal AssistantMessage — those literals are only used when sending
|
|
746
|
+
* messages back out to the Anthropic API. Matching them here was a latent bug:
|
|
747
|
+
* `hasToolUse` returned `false` for every real tool call, which let the
|
|
748
|
+
* empty-turn nudge fire and pre-empt MCP tools that block on the user
|
|
749
|
+
* (e.g. `ask_user_questions`). See investigation in PR for #4658.
|
|
750
|
+
*/
|
|
751
|
+
function hasToolUse(msg: any): boolean {
|
|
752
|
+
if (!msg) return false;
|
|
753
|
+
const content = msg.content;
|
|
754
|
+
if (!Array.isArray(content)) return false;
|
|
755
|
+
return content.some(
|
|
756
|
+
(b: any) =>
|
|
757
|
+
b &&
|
|
758
|
+
typeof b === "object" &&
|
|
759
|
+
(b.type === "toolCall" || b.type === "serverToolUse"),
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* #4573 — Detect and recover from the "ready phrase without files" failure mode.
|
|
765
|
+
*
|
|
766
|
+
* When the LLM emits "Milestone {{id}} ready." but has not written the
|
|
767
|
+
* milestone CONTEXT/ROADMAP artifacts, `checkAutoStartAfterDiscuss()` silently
|
|
768
|
+
* returns false and the next /gsd invocation loops into the "All milestones
|
|
769
|
+
* complete" warning.
|
|
770
|
+
*
|
|
771
|
+
* This function, called from `handleAgentEnd` after `checkAutoStartAfterDiscuss`
|
|
772
|
+
* returns false, pattern-matches the ready phrase on the last assistant message.
|
|
773
|
+
* If it fired AND neither the canonical M###-CONTEXT.md/M###-ROADMAP.md nor
|
|
774
|
+
* legacy CONTEXT.md/ROADMAP.md files exist, it:
|
|
775
|
+
* 1. Notifies the user that the signal was rejected.
|
|
776
|
+
* 2. Injects a system message via `pi.sendMessage(..., {triggerTurn:true})`
|
|
777
|
+
* telling the LLM the signal was premature and to emit the writes now.
|
|
778
|
+
* 3. Caps at `MAX_READY_REJECTS` per-entry; beyond that, gives up and asks
|
|
779
|
+
* the user to re-run /gsd.
|
|
780
|
+
*
|
|
781
|
+
* Returns true when a nudge (or give-up) was emitted, signaling the caller to
|
|
782
|
+
* skip `resolveAgentEnd`.
|
|
783
|
+
*/
|
|
784
|
+
export function maybeHandleReadyPhraseWithoutFiles(event: { messages: any[] }, lookupBasePath?: string): boolean {
|
|
785
|
+
const entry = _getPendingAutoStart(lookupBasePath);
|
|
786
|
+
if (!entry) return false;
|
|
787
|
+
const { ctx, pi, basePath, milestoneId } = entry;
|
|
788
|
+
|
|
789
|
+
// Gate: last assistant message must contain the ready phrase
|
|
790
|
+
const lastMsg = event.messages[event.messages.length - 1];
|
|
791
|
+
const text = extractAssistantText(lastMsg);
|
|
792
|
+
if (!READY_PHRASE_RE.test(text)) return false;
|
|
793
|
+
|
|
794
|
+
// Bust paths.ts cached dir listings before checking for fresh writes. The
|
|
795
|
+
// LLM's Write tool calls do not invalidate paths.ts caches, so a stale
|
|
796
|
+
// listing taken before the milestone dir or its CONTEXT/ROADMAP files
|
|
797
|
+
// existed would falsely report the artifacts as missing and trigger the
|
|
798
|
+
// 3-strike "ready without files" abort even though the writes succeeded.
|
|
799
|
+
clearPathCache();
|
|
800
|
+
|
|
801
|
+
// Gate: artifacts must still be missing — if they exist, the happy path
|
|
802
|
+
// already fired and we have nothing to do.
|
|
803
|
+
const contextFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT");
|
|
804
|
+
const roadmapFile = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
805
|
+
if (contextFile || roadmapFile) return false;
|
|
806
|
+
|
|
807
|
+
// Diagnostic: when the cached resolver reports both files missing, also probe
|
|
808
|
+
// the canonical paths with uncached existsSync so we can tell whether the
|
|
809
|
+
// recovery is firing on real-missing files or a path-resolution miss
|
|
810
|
+
// (basePath/symlink mismatch, stale cache despite agent-end-recovery flush,
|
|
811
|
+
// legacy descriptor dir not matching, etc.).
|
|
812
|
+
try {
|
|
813
|
+
const mDir = resolveMilestonePath(basePath, milestoneId);
|
|
814
|
+
const canonicalCtx = mDir ? join(mDir, `${milestoneId}-CONTEXT.md`) : null;
|
|
815
|
+
const canonicalRoadmap = mDir ? join(mDir, `${milestoneId}-ROADMAP.md`) : null;
|
|
816
|
+
logWarning(
|
|
817
|
+
"guided",
|
|
818
|
+
`ready-phrase-reject diagnostic mid=${milestoneId} basePath=${basePath} ` +
|
|
819
|
+
`mDir=${mDir ?? "null"} ` +
|
|
820
|
+
`canonical-ctx=${canonicalCtx ?? "null"} ctx-exists=${canonicalCtx ? existsSync(canonicalCtx) : "n/a"} ` +
|
|
821
|
+
`canonical-roadmap=${canonicalRoadmap ?? "null"} roadmap-exists=${canonicalRoadmap ? existsSync(canonicalRoadmap) : "n/a"}`,
|
|
822
|
+
);
|
|
823
|
+
} catch (e) {
|
|
824
|
+
logWarning("guided", `ready-phrase-reject diagnostic failed: ${(e as Error).message}`);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
entry.readyRejectCount = (entry.readyRejectCount ?? 0) + 1;
|
|
828
|
+
|
|
829
|
+
if (entry.readyRejectCount > MAX_READY_REJECTS) {
|
|
830
|
+
// Give up: clear state and tell the user to re-run /gsd. Avoids an
|
|
831
|
+
// infinite nudge loop when the LLM never produces the writes.
|
|
832
|
+
deletePendingAutoStart(basePath);
|
|
833
|
+
ctx.ui.notify(
|
|
834
|
+
`Milestone ${milestoneId}: LLM signaled "ready" ${entry.readyRejectCount} times without writing files. ` +
|
|
835
|
+
`Stopping auto-nudge. Run /gsd to try again.`,
|
|
836
|
+
"error",
|
|
837
|
+
);
|
|
838
|
+
return true;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
const contextRel = relMilestoneFile(basePath, milestoneId, "CONTEXT");
|
|
842
|
+
const roadmapRel = relMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
843
|
+
ctx.ui.notify(
|
|
844
|
+
`Milestone ${milestoneId}: "ready" signal rejected — ${contextRel} and ${roadmapRel} are missing. Asking the LLM to complete the writes.`,
|
|
845
|
+
"warning",
|
|
846
|
+
);
|
|
847
|
+
|
|
848
|
+
const nudge =
|
|
849
|
+
`You emitted "Milestone ${milestoneId} ready." but neither ` +
|
|
850
|
+
`${contextRel} nor ${roadmapRel} exists on disk. ` +
|
|
851
|
+
`The ready phrase is a POST-WRITE signal and has been rejected. ` +
|
|
852
|
+
`In this turn: (1) write PROJECT.md, REQUIREMENTS.md, and the milestone ` +
|
|
853
|
+
`CONTEXT.md, (2) call gsd_plan_milestone, then (3) emit the ready phrase. ` +
|
|
854
|
+
`Do not describe these steps — execute them as tool calls. ` +
|
|
855
|
+
`This is retry ${entry.readyRejectCount}/${MAX_READY_REJECTS}; further ` +
|
|
856
|
+
`premature signals will clear the session.`;
|
|
857
|
+
|
|
858
|
+
try {
|
|
859
|
+
pi.sendMessage(
|
|
860
|
+
{ customType: "gsd-ready-no-files", content: nudge, display: false },
|
|
861
|
+
{ triggerTurn: true },
|
|
862
|
+
);
|
|
863
|
+
} catch (e) {
|
|
864
|
+
logWarning("guided", `ready-phrase nudge sendMessage failed: ${(e as Error).message}`);
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* #4573 — Detect and recover from the "announces tool, never calls it" stall.
|
|
872
|
+
*
|
|
873
|
+
* The LLM emits text like "I'll now write the CONTEXT.md file" but the turn
|
|
874
|
+
* ends with zero tool-use blocks. The harness has no post-turn tool-call
|
|
875
|
+
* validation, so the unit promise resolves and the user sees a stalled state.
|
|
876
|
+
*
|
|
877
|
+
* This function, called from `handleAgentEnd`, inspects the last assistant
|
|
878
|
+
* message. If ALL of the following are true, it injects a recovery message:
|
|
879
|
+
* - Text-only (no tool-use blocks)
|
|
880
|
+
* - Contains a commit-intent phrase ("I'll write", "I'll call", etc.)
|
|
881
|
+
* - Auto-mode is active OR a discussion autostart is pending
|
|
882
|
+
* - `emptyTurnRetryCount` is under the cap
|
|
883
|
+
*
|
|
884
|
+
* Per-handler state is held on the `PendingAutoStartEntry` when present, and
|
|
885
|
+
* on a module-level map otherwise. The counter resets on any successful
|
|
886
|
+
* tool-use turn via `resetEmptyTurnCounter`.
|
|
887
|
+
*/
|
|
888
|
+
const emptyTurnCounterByBase = new Map<string, number>();
|
|
889
|
+
const MAX_EMPTY_TURN_RETRIES = 2;
|
|
890
|
+
|
|
891
|
+
// Phrases that indicate the LLM is about to do something but has not yet.
|
|
892
|
+
// Kept tight to avoid flagging legitimate narration like "I'll wait for your answer."
|
|
893
|
+
//
|
|
894
|
+
// "make" was previously in the verb list but matches conversational meta phrases
|
|
895
|
+
// like "Let me make sure I understand…" which are NOT action announcements —
|
|
896
|
+
// removed to prevent the empty-turn nudge from auto-replying to user questions
|
|
897
|
+
// in discuss flows.
|
|
898
|
+
const COMMIT_INTENT_RE =
|
|
899
|
+
/\b(?:I['’]ll|I will|Next,? I['’]ll|Now I['’]ll|Let me|I['’]m going to|I am going to)\s+(?:now\s+)?(?:write|create|call|invoke|update|add|run|execute|generate|produce|emit|compose|implement|save|apply|commit)\b/i;
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Reset the empty-turn counter for a basePath after a successful tool-use turn.
|
|
903
|
+
* Called from handleAgentEnd when the last message contains tool_use blocks.
|
|
904
|
+
*/
|
|
905
|
+
export function resetEmptyTurnCounter(basePath?: string): void {
|
|
906
|
+
if (basePath) emptyTurnCounterByBase.delete(basePath);
|
|
907
|
+
else emptyTurnCounterByBase.clear();
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
export function maybeHandleEmptyIntentTurn(
|
|
911
|
+
event: { messages: any[] },
|
|
912
|
+
isAuto: boolean,
|
|
913
|
+
lookupBasePath?: string,
|
|
914
|
+
): boolean {
|
|
915
|
+
// Gate: only fire when there is system-driven work in flight. Interactive
|
|
916
|
+
// /gsd discuss (user-driven) produces legitimate text-only turns.
|
|
917
|
+
if (!isAuto && !hasPendingAutoStart(lookupBasePath)) return false;
|
|
918
|
+
|
|
919
|
+
const lastMsg = event.messages[event.messages.length - 1];
|
|
920
|
+
if (!lastMsg) return false;
|
|
921
|
+
if (hasToolUse(lastMsg)) return false;
|
|
922
|
+
|
|
923
|
+
const text = extractAssistantText(lastMsg).trim();
|
|
924
|
+
if (!text) return false;
|
|
925
|
+
|
|
926
|
+
// Skip if the LLM is emitting the ready phrase — that is the ready-no-files
|
|
927
|
+
// path, handled by maybeHandleReadyPhraseWithoutFiles.
|
|
928
|
+
if (READY_PHRASE_RE.test(text)) return false;
|
|
929
|
+
|
|
930
|
+
// Skip if the LLM is clearly handing back to the user. Discuss flows
|
|
931
|
+
// often pose a question and follow it with a conditional intent on the
|
|
932
|
+
// same line ("Did I capture that correctly? If so, I'll write the
|
|
933
|
+
// requirements."). A line-trailing `?` check misses these because the
|
|
934
|
+
// line ends in `.`. Match any sentence-terminating `?` (followed by
|
|
935
|
+
// whitespace or end-of-text) — false negatives here auto-reply to the
|
|
936
|
+
// user, which is a much worse failure mode than a missed nudge.
|
|
937
|
+
if (/\?(?:\s|$)/.test(text)) return false;
|
|
938
|
+
|
|
939
|
+
// Must contain a commit-intent phrase — this is the stall we care about.
|
|
940
|
+
if (!COMMIT_INTENT_RE.test(text)) return false;
|
|
941
|
+
|
|
942
|
+
// Resolve the target basePath + pi for injection. Prefer the pending
|
|
943
|
+
// autostart entry (discuss flow); otherwise we cannot inject.
|
|
944
|
+
const entry = _getPendingAutoStart(lookupBasePath);
|
|
945
|
+
if (!entry) return false;
|
|
946
|
+
const { ctx, pi, basePath } = entry;
|
|
947
|
+
|
|
948
|
+
const count = (emptyTurnCounterByBase.get(basePath) ?? 0) + 1;
|
|
949
|
+
emptyTurnCounterByBase.set(basePath, count);
|
|
950
|
+
|
|
951
|
+
if (count > MAX_EMPTY_TURN_RETRIES) {
|
|
952
|
+
ctx.ui.notify(
|
|
953
|
+
`Empty-turn recovery: LLM announced intent ${count} times without calling any tool. ` +
|
|
954
|
+
`Stopping auto-nudge.`,
|
|
955
|
+
"error",
|
|
956
|
+
);
|
|
957
|
+
return false; // let the normal flow resolve/pause the unit
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
ctx.ui.notify(
|
|
961
|
+
`Empty-turn detected: LLM announced intent but called no tool. Prompting it to execute.`,
|
|
962
|
+
"info",
|
|
963
|
+
);
|
|
964
|
+
|
|
965
|
+
const nudge =
|
|
966
|
+
`Your last turn announced an action (e.g. "I'll write…" or "Let me call…") ` +
|
|
967
|
+
`but contained no tool call. The system records zero tool-use blocks for ` +
|
|
968
|
+
`that turn. Execute the announced action NOW as a tool call in this turn. ` +
|
|
969
|
+
`Do not describe it again. Retry ${count}/${MAX_EMPTY_TURN_RETRIES}.`;
|
|
970
|
+
|
|
971
|
+
try {
|
|
972
|
+
pi.sendMessage(
|
|
973
|
+
{ customType: "gsd-empty-turn-recovery", content: nudge, display: false },
|
|
974
|
+
{ triggerTurn: true },
|
|
975
|
+
);
|
|
976
|
+
} catch (e) {
|
|
977
|
+
logWarning("guided", `empty-turn nudge sendMessage failed: ${(e as Error).message}`);
|
|
978
|
+
return false;
|
|
979
|
+
}
|
|
980
|
+
return true;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Extract milestone IDs from PROJECT.md milestone sequence table.
|
|
985
|
+
* Looks for rows like "| M001 | Name | Status |" and extracts the ID column.
|
|
986
|
+
*/
|
|
987
|
+
function parseMilestoneSequenceFromProject(content: string): string[] {
|
|
988
|
+
const ids: string[] = [];
|
|
989
|
+
const lines = content.split(/\r?\n/);
|
|
990
|
+
for (const line of lines) {
|
|
991
|
+
const match = line.match(/^\|\s*(M\d{3}[A-Z0-9-]*)\s*\|/);
|
|
992
|
+
if (match) ids.push(match[1]);
|
|
993
|
+
}
|
|
994
|
+
return ids;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
998
|
+
|
|
999
|
+
type UIContext = ExtensionContext;
|
|
1000
|
+
|
|
1001
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
1002
|
+
|
|
1003
|
+
interface DispatchWorkflowOptions {
|
|
1004
|
+
basePath?: string;
|
|
1005
|
+
deps?: {
|
|
1006
|
+
loadPreferences?: typeof loadEffectiveGSDPreferences;
|
|
1007
|
+
selectModel?: typeof selectAndApplyModel;
|
|
1008
|
+
getTransportSupportError?: typeof getWorkflowTransportSupportError;
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
export function resolveGuidedDispatchProjectRoot(basePath?: string): string {
|
|
1013
|
+
return basePath ?? process.cwd();
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Read GSD-WORKFLOW.md and dispatch it to the LLM with a contextual note.
|
|
1018
|
+
* This is the only way the wizard triggers work — everything else is the LLM's job.
|
|
1019
|
+
*
|
|
1020
|
+
* When a unitType is provided, resolves the user's model preference for that
|
|
1021
|
+
* phase (e.g., models.planning → "plan-milestone", models.discuss → "discuss-milestone") and applies it before
|
|
1022
|
+
* dispatching. This ensures guided-flow dispatches respect the same
|
|
1023
|
+
* per-phase model preferences that auto-mode uses.
|
|
1024
|
+
*/
|
|
1025
|
+
async function dispatchWorkflow(
|
|
1026
|
+
pi: ExtensionAPI,
|
|
1027
|
+
note: string,
|
|
1028
|
+
customType = "gsd-run",
|
|
1029
|
+
ctx?: ExtensionContext,
|
|
1030
|
+
unitType?: string,
|
|
1031
|
+
options?: DispatchWorkflowOptions,
|
|
1032
|
+
): Promise<void> {
|
|
1033
|
+
const resolvedOptions = options ?? {};
|
|
1034
|
+
const projectRoot = resolveGuidedDispatchProjectRoot(resolvedOptions.basePath);
|
|
1035
|
+
const loadPreferences = resolvedOptions.deps?.loadPreferences ?? loadEffectiveGSDPreferences;
|
|
1036
|
+
const selectModel = resolvedOptions.deps?.selectModel ?? selectAndApplyModel;
|
|
1037
|
+
const getTransportSupportError = resolvedOptions.deps?.getTransportSupportError ?? getWorkflowTransportSupportError;
|
|
1038
|
+
|
|
1039
|
+
// Route through the dynamic routing pipeline (complexity classification,
|
|
1040
|
+
// tier downgrade, fallback chains) — same path as auto-mode dispatches (#2958).
|
|
1041
|
+
if (ctx && unitType) {
|
|
1042
|
+
const prefs = loadPreferences(projectRoot)?.preferences;
|
|
1043
|
+
const result = await selectModel(
|
|
1044
|
+
ctx, pi, unitType, /* unitId */ "", projectRoot,
|
|
1045
|
+
prefs, /* verbose */ false, /* autoModeStartModel */ null,
|
|
1046
|
+
/* retryContext */ undefined, /* isAutoMode */ false,
|
|
1047
|
+
);
|
|
1048
|
+
if (result.appliedModel) {
|
|
1049
|
+
debugLog("guided-flow-model-applied", {
|
|
1050
|
+
unitType,
|
|
1051
|
+
model: `${result.appliedModel.provider}/${result.appliedModel.id}`,
|
|
1052
|
+
routing: result.routing,
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
const compatibilityError = getTransportSupportError(
|
|
1057
|
+
result.appliedModel?.provider ?? ctx.model?.provider,
|
|
1058
|
+
getRequiredWorkflowToolsForGuidedUnit(unitType),
|
|
1059
|
+
{
|
|
1060
|
+
projectRoot,
|
|
1061
|
+
surface: "guided flow",
|
|
1062
|
+
unitType,
|
|
1063
|
+
authMode: result.appliedModel?.provider
|
|
1064
|
+
? ctx.modelRegistry.getProviderAuthMode(result.appliedModel.provider)
|
|
1065
|
+
: ctx.model?.provider
|
|
1066
|
+
? ctx.modelRegistry.getProviderAuthMode(ctx.model.provider)
|
|
1067
|
+
: undefined,
|
|
1068
|
+
baseUrl: result.appliedModel?.baseUrl ?? ctx.model?.baseUrl,
|
|
1069
|
+
activeTools: typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [],
|
|
1070
|
+
},
|
|
1071
|
+
);
|
|
1072
|
+
if (compatibilityError) {
|
|
1073
|
+
ctx.ui.notify(compatibilityError, "error");
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// Scope tools for guided workflow turns (#2949, token-consumption savings).
|
|
1079
|
+
// Providers with grammar-based constrained decoding (xAI/Grok) return
|
|
1080
|
+
// "Grammar is too complex" when the combined tool schema is too large.
|
|
1081
|
+
// Guided workflow turns only need the active unit's tool surface; strip
|
|
1082
|
+
// unrelated GSD tools and broad non-GSD tools for this queued turn, then
|
|
1083
|
+
// restore so the narrowed surface does not leak into future dispatches.
|
|
1084
|
+
let savedTools: ReturnType<typeof scopeGsdWorkflowToolsForDispatch> = null;
|
|
1085
|
+
|
|
1086
|
+
try {
|
|
1087
|
+
const currentTools = pi.getActiveTools();
|
|
1088
|
+
savedTools = {
|
|
1089
|
+
tools: currentTools,
|
|
1090
|
+
visibleSkills: typeof pi.getVisibleSkills === "function" ? pi.getVisibleSkills() : undefined,
|
|
1091
|
+
restoreVisibleSkills: typeof pi.setVisibleSkills === "function",
|
|
1092
|
+
};
|
|
1093
|
+
if (unitType?.startsWith("discuss-") && !isFullGsdToolSurfaceRequested()) {
|
|
1094
|
+
// Keep all non-GSD tools (builtins, other extensions) and only the
|
|
1095
|
+
// GSD tools on the discuss allowlist.
|
|
1096
|
+
const scopedTools = currentTools.filter(
|
|
1097
|
+
(t) => !t.startsWith("gsd_") || DISCUSS_TOOLS_ALLOWLIST.includes(t),
|
|
1098
|
+
);
|
|
1099
|
+
pi.setActiveTools(scopedTools);
|
|
1100
|
+
const scopedState = scopeGsdWorkflowToolsForDispatch(pi, unitType);
|
|
1101
|
+
savedTools = {
|
|
1102
|
+
tools: currentTools,
|
|
1103
|
+
visibleSkills: scopedState?.visibleSkills ?? savedTools.visibleSkills,
|
|
1104
|
+
restoreVisibleSkills: scopedState?.restoreVisibleSkills ?? savedTools.restoreVisibleSkills,
|
|
1105
|
+
};
|
|
1106
|
+
debugLog("discuss-tool-scoping", {
|
|
1107
|
+
unitType,
|
|
1108
|
+
before: currentTools.length,
|
|
1109
|
+
after: pi.getActiveTools().length,
|
|
1110
|
+
removed: currentTools.length - pi.getActiveTools().length,
|
|
1111
|
+
});
|
|
1112
|
+
} else {
|
|
1113
|
+
savedTools = scopeGsdWorkflowToolsForDispatch(pi, unitType) ?? savedTools;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
const workflowPath = process.env.GSD_WORKFLOW_PATH ?? join(gsdHome(), "agent", "GSD-WORKFLOW.md");
|
|
1117
|
+
const workflow = readFileSync(workflowPath, "utf-8");
|
|
1118
|
+
|
|
1119
|
+
if (unitType) setGuidedUnitContext(projectRoot, unitType);
|
|
1120
|
+
try {
|
|
1121
|
+
pi.sendMessage(
|
|
1122
|
+
{
|
|
1123
|
+
customType,
|
|
1124
|
+
content: buildWorkflowDispatchContent({ workflow, workflowPath, task: note }),
|
|
1125
|
+
display: false,
|
|
1126
|
+
},
|
|
1127
|
+
{ triggerTurn: true },
|
|
1128
|
+
);
|
|
1129
|
+
} catch (err) {
|
|
1130
|
+
clearGuidedUnitContext(projectRoot);
|
|
1131
|
+
throw err;
|
|
1132
|
+
}
|
|
1133
|
+
} finally {
|
|
1134
|
+
// Restore full tool set after the message is queued. The LLM turn has
|
|
1135
|
+
// already captured the scoped set — restoring prevents the narrowed
|
|
1136
|
+
// tools from leaking into subsequent dispatches (#3628). The finally
|
|
1137
|
+
// block ensures restoration even if sendMessage throws.
|
|
1138
|
+
restoreGsdWorkflowTools(pi, savedTools);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
export const _dispatchWorkflowForTest = dispatchWorkflow;
|
|
1143
|
+
|
|
1144
|
+
export function getDiscussableFutureMilestones<T extends { id: string; status: string }>(
|
|
1145
|
+
registry: T[],
|
|
1146
|
+
activeMilestoneId?: string | null,
|
|
1147
|
+
): T[] {
|
|
1148
|
+
return registry.filter((m) =>
|
|
1149
|
+
m.id !== activeMilestoneId && m.status !== "complete" && m.status !== "parked",
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
function getStructuredQuestionsAvailability(
|
|
1154
|
+
pi: ExtensionAPI,
|
|
1155
|
+
ctx: ExtensionContext | undefined,
|
|
1156
|
+
): "true" | "false" {
|
|
1157
|
+
if (!ctx) return "false";
|
|
1158
|
+
|
|
1159
|
+
const provider = ctx.model?.provider;
|
|
1160
|
+
const authMode = provider ? ctx.modelRegistry.getProviderAuthMode(provider) : undefined;
|
|
1161
|
+
return supportsStructuredQuestions(pi.getActiveTools(), {
|
|
1162
|
+
authMode,
|
|
1163
|
+
baseUrl: ctx.model?.baseUrl,
|
|
1164
|
+
}) ? "true" : "false";
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Resolve a model ID string to a model object from available models.
|
|
1169
|
+
* Handles "provider/model" and bare ID formats.
|
|
1170
|
+
*/
|
|
1171
|
+
function resolveAvailableModel<T extends { id: string; provider: string }>(
|
|
1172
|
+
modelId: string,
|
|
1173
|
+
availableModels: T[],
|
|
1174
|
+
currentProvider: string | undefined,
|
|
1175
|
+
): T | undefined {
|
|
1176
|
+
const slashIdx = modelId.indexOf("/");
|
|
1177
|
+
|
|
1178
|
+
if (slashIdx !== -1) {
|
|
1179
|
+
const maybeProvider = modelId.substring(0, slashIdx);
|
|
1180
|
+
const id = modelId.substring(slashIdx + 1);
|
|
1181
|
+
|
|
1182
|
+
const knownProviders = new Set(availableModels.map(m => m.provider.toLowerCase()));
|
|
1183
|
+
if (knownProviders.has(maybeProvider.toLowerCase())) {
|
|
1184
|
+
const match = availableModels.find(
|
|
1185
|
+
m => m.provider.toLowerCase() === maybeProvider.toLowerCase()
|
|
1186
|
+
&& m.id.toLowerCase() === id.toLowerCase(),
|
|
1187
|
+
);
|
|
1188
|
+
if (match) return match;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// Try matching the full string as a model ID (OpenRouter-style)
|
|
1192
|
+
const lower = modelId.toLowerCase();
|
|
1193
|
+
return availableModels.find(
|
|
1194
|
+
m => m.id.toLowerCase() === lower
|
|
1195
|
+
|| `${m.provider}/${m.id}`.toLowerCase() === lower,
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// Bare ID — prefer current provider, then first available
|
|
1200
|
+
const exactProviderMatch = availableModels.find(
|
|
1201
|
+
m => m.id === modelId && m.provider === currentProvider,
|
|
1202
|
+
);
|
|
1203
|
+
return exactProviderMatch ?? availableModels.find(m => m.id === modelId);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Build the discuss-and-plan prompt for a new milestone.
|
|
1208
|
+
* Used by all three "new milestone" paths (first ever, no active, all complete).
|
|
1209
|
+
*/
|
|
1210
|
+
function buildDiscussPrompt(nextId: string, preamble: string, _basePath: string, pi: ExtensionAPI, ctx: ExtensionCommandContext, preparationContext?: string): string {
|
|
1211
|
+
const milestoneRel = `.gsd/milestones/${nextId}`;
|
|
1212
|
+
const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
|
|
1213
|
+
const inlinedTemplates = [
|
|
1214
|
+
inlineTemplate("project", "Project"),
|
|
1215
|
+
inlineTemplate("requirements", "Requirements"),
|
|
1216
|
+
inlineTemplate("context", "Context"),
|
|
1217
|
+
inlineTemplate("roadmap", "Roadmap"),
|
|
1218
|
+
inlineTemplate("decisions", "Decisions"),
|
|
1219
|
+
].join("\n\n---\n\n");
|
|
1220
|
+
return loadPrompt("discuss", {
|
|
1221
|
+
milestoneId: nextId,
|
|
1222
|
+
preamble,
|
|
1223
|
+
preparationContext: preparationContext ?? "",
|
|
1224
|
+
structuredQuestionsAvailable,
|
|
1225
|
+
contextPath: `${milestoneRel}/${nextId}-CONTEXT.md`,
|
|
1226
|
+
roadmapPath: `${milestoneRel}/${nextId}-ROADMAP.md`,
|
|
1227
|
+
inlinedTemplates,
|
|
1228
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${nextId}): context, requirements, and roadmap`),
|
|
1229
|
+
multiMilestoneCommitInstruction: buildDocsCommitInstruction("docs: project plan — N milestones"),
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Build the discuss prompt for headless milestone creation.
|
|
1235
|
+
* Uses the discuss-headless prompt template with seed context injected.
|
|
1236
|
+
*/
|
|
1237
|
+
function buildHeadlessDiscussPrompt(nextId: string, seedContext: string, _basePath: string): string {
|
|
1238
|
+
const milestoneRel = `.gsd/milestones/${nextId}`;
|
|
1239
|
+
const inlinedTemplates = [
|
|
1240
|
+
inlineTemplate("project", "Project"),
|
|
1241
|
+
inlineTemplate("requirements", "Requirements"),
|
|
1242
|
+
inlineTemplate("context", "Context"),
|
|
1243
|
+
inlineTemplate("roadmap", "Roadmap"),
|
|
1244
|
+
inlineTemplate("decisions", "Decisions"),
|
|
1245
|
+
].join("\n\n---\n\n");
|
|
1246
|
+
return loadPrompt("discuss-headless", {
|
|
1247
|
+
milestoneId: nextId,
|
|
1248
|
+
seedContext,
|
|
1249
|
+
contextPath: `${milestoneRel}/${nextId}-CONTEXT.md`,
|
|
1250
|
+
roadmapPath: `${milestoneRel}/${nextId}-ROADMAP.md`,
|
|
1251
|
+
inlinedTemplates,
|
|
1252
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${nextId}): context, requirements, and roadmap`),
|
|
1253
|
+
multiMilestoneCommitInstruction: buildDocsCommitInstruction("docs: project plan — N milestones"),
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Run preparation phase if enabled, then build the discuss prompt.
|
|
1259
|
+
* Preparation analyzes the codebase and prior context, injecting the results
|
|
1260
|
+
* as supplementary context into the standard discuss template. The discuss
|
|
1261
|
+
* template drives the conversation (asks "What's the vision?" first), while
|
|
1262
|
+
* the preparation briefs give the agent grounding in the existing codebase.
|
|
1263
|
+
*
|
|
1264
|
+
* @param ctx - Extension command context with UI for progress notifications
|
|
1265
|
+
* @param nextId - The milestone ID being discussed
|
|
1266
|
+
* @param preamble - Preamble text for the discuss prompt
|
|
1267
|
+
* @param basePath - Root directory of the project
|
|
1268
|
+
* @returns The discuss prompt string
|
|
1269
|
+
*/
|
|
1270
|
+
async function prepareAndBuildDiscussPrompt(
|
|
1271
|
+
ctx: ExtensionCommandContext,
|
|
1272
|
+
pi: ExtensionAPI,
|
|
1273
|
+
nextId: string,
|
|
1274
|
+
preamble: string,
|
|
1275
|
+
basePath: string,
|
|
1276
|
+
): Promise<string> {
|
|
1277
|
+
const prefs = loadEffectiveGSDPreferences()?.preferences ?? {};
|
|
1278
|
+
|
|
1279
|
+
// Run preparation if enabled (default: true) — results are injected as
|
|
1280
|
+
// supplementary context into the standard discuss prompt, NOT as a
|
|
1281
|
+
// replacement template. The discuss prompt always leads with "What's the
|
|
1282
|
+
// vision?" so the user defines the scope, not the codebase analysis.
|
|
1283
|
+
let preparationContext = "";
|
|
1284
|
+
if (prefs.discuss_preparation !== false) {
|
|
1285
|
+
try {
|
|
1286
|
+
const prepResult = await runPreparation(basePath, ctx.ui, {
|
|
1287
|
+
discuss_preparation: prefs.discuss_preparation,
|
|
1288
|
+
discuss_web_research: prefs.discuss_web_research,
|
|
1289
|
+
discuss_depth: prefs.discuss_depth,
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1292
|
+
if (prepResult.enabled) {
|
|
1293
|
+
const codebaseBrief = prepResult.codebaseBrief || formatCodebaseBrief(prepResult.codebase);
|
|
1294
|
+
const priorContextBrief = prepResult.priorContextBrief || formatPriorContextBrief(prepResult.priorContext);
|
|
1295
|
+
const parts: string[] = [];
|
|
1296
|
+
if (codebaseBrief) parts.push(`### Codebase Brief\n\n${codebaseBrief}`);
|
|
1297
|
+
if (priorContextBrief) parts.push(`### Prior Context Brief\n\n${priorContextBrief}`);
|
|
1298
|
+
if (parts.length > 0) {
|
|
1299
|
+
preparationContext = `\n\n## Preparation Context\n\nThe system analyzed the codebase before this discussion. Use these findings as background context — they describe what already exists, NOT what the user wants to build. Always ask the user what they want to build first.\n\n${parts.join("\n\n")}`;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
} catch (err) {
|
|
1303
|
+
logWarning("guided", `preparation failed, proceeding without context: ${(err as Error).message}`);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
return buildDiscussPrompt(nextId, preamble, basePath, pi, ctx, preparationContext);
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* Bootstrap a .gsd/ project from scratch for headless use.
|
|
1312
|
+
* Ensures git repo, .gsd/ structure, gitignore, and preferences all exist.
|
|
1313
|
+
*/
|
|
1314
|
+
function bootstrapGsdProject(basePath: string): void {
|
|
1315
|
+
if (!nativeIsRepo(basePath) || isInheritedRepo(basePath)) {
|
|
1316
|
+
const mainBranch = loadEffectiveGSDPreferences()?.preferences?.git?.main_branch || "main";
|
|
1317
|
+
nativeInit(basePath, mainBranch);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
const root = gsdRoot(basePath);
|
|
1321
|
+
mkdirSync(join(root, "milestones"), { recursive: true });
|
|
1322
|
+
mkdirSync(join(root, "runtime"), { recursive: true });
|
|
1323
|
+
|
|
1324
|
+
const gitPrefs = loadEffectiveGSDPreferences(basePath)?.preferences?.git;
|
|
1325
|
+
const manageGitignore = gitPrefs?.manage_gitignore;
|
|
1326
|
+
ensureGitignore(basePath, { manageGitignore });
|
|
1327
|
+
ensurePreferences(basePath);
|
|
1328
|
+
if (manageGitignore !== false) untrackRuntimeFiles(basePath);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* Headless milestone creation from a seed specification document.
|
|
1333
|
+
* Bootstraps the project if needed, generates the next milestone ID,
|
|
1334
|
+
* and dispatches the headless discuss prompt (no Q&A rounds).
|
|
1335
|
+
*/
|
|
1336
|
+
export async function showHeadlessMilestoneCreation(
|
|
1337
|
+
ctx: ExtensionCommandContext,
|
|
1338
|
+
pi: ExtensionAPI,
|
|
1339
|
+
basePath: string,
|
|
1340
|
+
seedContext: string,
|
|
1341
|
+
options: HeadlessMilestoneCreationOptions = {},
|
|
1342
|
+
): Promise<void> {
|
|
1343
|
+
// Clear stale reservations from previous cancelled sessions (#2488)
|
|
1344
|
+
clearReservedMilestoneIds();
|
|
1345
|
+
|
|
1346
|
+
// Ensure .gsd/ is bootstrapped
|
|
1347
|
+
bootstrapGsdProject(basePath);
|
|
1348
|
+
|
|
1349
|
+
const { ensureDbOpen } = await import("./bootstrap/dynamic-tools.js");
|
|
1350
|
+
await ensureDbOpen(basePath);
|
|
1351
|
+
|
|
1352
|
+
// Generate next milestone ID
|
|
1353
|
+
const existingIds = findMilestoneIds(basePath);
|
|
1354
|
+
const prefs = loadEffectiveGSDPreferences();
|
|
1355
|
+
const nextId = nextMilestoneIdReserved(existingIds, prefs?.preferences?.unique_milestone_ids ?? false, basePath);
|
|
1356
|
+
|
|
1357
|
+
// Fix #4996: Do NOT pre-create the milestone directory here.
|
|
1358
|
+
// atomicWriteAsync (used by all artifact writers) calls mkdir lazily before
|
|
1359
|
+
// each write, so every path through saveArtifactToDb / saveFile is already
|
|
1360
|
+
// lazy-mkdir-safe. Pre-creating the dir before the discuss flow runs leaves
|
|
1361
|
+
// an orphan stub if discuss is abandoned — that stub later skews nextMilestoneId.
|
|
1362
|
+
|
|
1363
|
+
// Build and dispatch the headless discuss prompt
|
|
1364
|
+
const prompt = buildHeadlessDiscussPrompt(nextId, seedContext, basePath);
|
|
1365
|
+
|
|
1366
|
+
// Set the ready handoff. Headless --auto owns the auto start itself so it can
|
|
1367
|
+
// wait for completion without racing the guided-flow pending auto-start.
|
|
1368
|
+
setPendingAutoStart(basePath, {
|
|
1369
|
+
ctx,
|
|
1370
|
+
pi,
|
|
1371
|
+
basePath,
|
|
1372
|
+
milestoneId: nextId,
|
|
1373
|
+
startAuto: options.startAutoAfterReady !== false,
|
|
1374
|
+
});
|
|
1375
|
+
|
|
1376
|
+
// Dispatch as discuss-milestone. The LLM writes PROJECT.md, REQUIREMENTS.md,
|
|
1377
|
+
// and CONTEXT.md, then calls gsd_plan_milestone — this is semantically the
|
|
1378
|
+
// discuss path, just non-interactive. Using "plan-milestone" here caused
|
|
1379
|
+
// model/tool routing to skip discuss-flow tool scoping and
|
|
1380
|
+
// `checkAutoStartAfterDiscuss` guardrails that rely on the
|
|
1381
|
+
// "discuss-"-prefixed unitType.
|
|
1382
|
+
await dispatchWorkflow(pi, prompt, "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
// ─── Discuss Flow ─────────────────────────────────────────────────────────────
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
* Build a rich inlined-context prompt for discussing a specific slice.
|
|
1390
|
+
* Preloads roadmap, milestone context, research, decisions, and completed
|
|
1391
|
+
* slice summaries so the agent can ask grounded UX/behaviour questions
|
|
1392
|
+
* without wasting a turn reading files.
|
|
1393
|
+
*/
|
|
1394
|
+
async function buildDiscussSlicePrompt(
|
|
1395
|
+
mid: string,
|
|
1396
|
+
sid: string,
|
|
1397
|
+
sTitle: string,
|
|
1398
|
+
base: string,
|
|
1399
|
+
options?: { rediscuss?: boolean; structuredQuestionsAvailable?: string },
|
|
1400
|
+
): Promise<string> {
|
|
1401
|
+
const inlined: string[] = [];
|
|
1402
|
+
|
|
1403
|
+
// Roadmap — always included so the agent sees surrounding slices
|
|
1404
|
+
const roadmapPath = resolveMilestoneFile(base, mid, "ROADMAP");
|
|
1405
|
+
const roadmapRel = relMilestoneFile(base, mid, "ROADMAP");
|
|
1406
|
+
const roadmapContent = roadmapPath ? await loadFile(roadmapPath) : null;
|
|
1407
|
+
if (roadmapContent) {
|
|
1408
|
+
inlined.push(`### Milestone Roadmap\nSource: \`${roadmapRel}\`\n\n${roadmapContent.trim()}`);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
// Milestone context — understanding the full milestone intent
|
|
1412
|
+
const contextPath = resolveMilestoneFile(base, mid, "CONTEXT");
|
|
1413
|
+
const contextRel = relMilestoneFile(base, mid, "CONTEXT");
|
|
1414
|
+
const contextContent = contextPath ? await loadFile(contextPath) : null;
|
|
1415
|
+
if (contextContent) {
|
|
1416
|
+
inlined.push(`### Milestone Context\nSource: \`${contextRel}\`\n\n${contextContent.trim()}`);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
// Milestone research — technical grounding
|
|
1420
|
+
const researchPath = resolveMilestoneFile(base, mid, "RESEARCH");
|
|
1421
|
+
const researchRel = relMilestoneFile(base, mid, "RESEARCH");
|
|
1422
|
+
const researchContent = researchPath ? await loadFile(researchPath) : null;
|
|
1423
|
+
if (researchContent) {
|
|
1424
|
+
inlined.push(`### Milestone Research\nSource: \`${researchRel}\`\n\n${researchContent.trim()}`);
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
// Decisions — architectural context that constrains this slice
|
|
1428
|
+
const decisionsPath = resolveGsdRootFile(base, "DECISIONS");
|
|
1429
|
+
if (existsSync(decisionsPath)) {
|
|
1430
|
+
const decisionsContent = await loadFile(decisionsPath);
|
|
1431
|
+
if (decisionsContent) {
|
|
1432
|
+
inlined.push(`### Decisions Register\nSource: \`${relGsdRootFile("DECISIONS")}\`\n\n${decisionsContent.trim()}`);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
// Completed slice summaries — what was already built that this slice builds on
|
|
1437
|
+
// Ensure DB is open so getMilestoneSlices returns real data (#2560).
|
|
1438
|
+
{
|
|
1439
|
+
const { ensureDbOpen } = await import("./bootstrap/dynamic-tools.js");
|
|
1440
|
+
await ensureDbOpen();
|
|
1441
|
+
type NormSlice = { id: string; done: boolean };
|
|
1442
|
+
let normSlices: NormSlice[] = [];
|
|
1443
|
+
if (isDbAvailable()) {
|
|
1444
|
+
normSlices = getMilestoneSlices(mid).map(s => ({ id: s.id, done: s.status === "complete" }));
|
|
1445
|
+
}
|
|
1446
|
+
for (const s of normSlices) {
|
|
1447
|
+
if (!s.done || s.id === sid) continue;
|
|
1448
|
+
const summaryPath = resolveSliceFile(base, mid, s.id, "SUMMARY");
|
|
1449
|
+
const summaryRel = relSliceFile(base, mid, s.id, "SUMMARY");
|
|
1450
|
+
const summaryContent = summaryPath ? await loadFile(summaryPath) : null;
|
|
1451
|
+
if (summaryContent) {
|
|
1452
|
+
inlined.push(`### ${s.id} Summary (completed)\nSource: \`${summaryRel}\`\n\n${summaryContent.trim()}`);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
const inlinedContext = inlined.length > 0
|
|
1458
|
+
? `## Inlined Context (preloaded — do not re-read these files)\n\n${inlined.join("\n\n---\n\n")}`
|
|
1459
|
+
: `## Inlined Context\n\n_(no context files found yet — go in blind and ask broad questions)_`;
|
|
1460
|
+
|
|
1461
|
+
const sliceDirPath = `.gsd/milestones/${mid}/slices/${sid}`;
|
|
1462
|
+
const sliceContextPath = `${sliceDirPath}/${sid}-CONTEXT.md`;
|
|
1463
|
+
|
|
1464
|
+
// When re-discussing, inject a preamble so the agent treats this as an update interview
|
|
1465
|
+
const rediscussPreamble = options?.rediscuss
|
|
1466
|
+
? `\n\n## Re-discuss Mode\n\nThis slice already has an existing context file (\`${sliceContextPath}\`) from a prior discussion. The user has chosen to re-discuss it. Read the existing context file, interview for any updates, changes, or new decisions, and rewrite the file with merged findings. Do NOT skip the interview — the user explicitly asked to revisit this slice.\n`
|
|
1467
|
+
: "";
|
|
1468
|
+
|
|
1469
|
+
const inlinedTemplates = inlineTemplate("slice-context", "Slice Context");
|
|
1470
|
+
return loadPrompt("guided-discuss-slice", {
|
|
1471
|
+
milestoneId: mid,
|
|
1472
|
+
sliceId: sid,
|
|
1473
|
+
sliceTitle: sTitle,
|
|
1474
|
+
inlinedContext: inlinedContext + rediscussPreamble,
|
|
1475
|
+
sliceDirPath,
|
|
1476
|
+
contextPath: sliceContextPath,
|
|
1477
|
+
projectRoot: base,
|
|
1478
|
+
inlinedTemplates,
|
|
1479
|
+
structuredQuestionsAvailable: options?.structuredQuestionsAvailable ?? "false",
|
|
1480
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${mid}/${sid}): slice context from discuss`),
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* /gsd discuss — show a picker of non-done slices and run a slice interview.
|
|
1486
|
+
* Loops back to the picker after each discussion so the user can chain
|
|
1487
|
+
* multiple slice interviews in one session.
|
|
1488
|
+
*/
|
|
1489
|
+
export async function showDiscuss(
|
|
1490
|
+
ctx: ExtensionCommandContext,
|
|
1491
|
+
pi: ExtensionAPI,
|
|
1492
|
+
basePath: string,
|
|
1493
|
+
options?: { target?: string },
|
|
1494
|
+
): Promise<void> {
|
|
1495
|
+
// Guard: no .gsd/ project
|
|
1496
|
+
if (!existsSync(gsdRoot(basePath))) {
|
|
1497
|
+
ctx.ui.notify("No GSD project found. Run /gsd to start one first.", "warning");
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
// Ensure DB is open before deriving state (#5837).
|
|
1502
|
+
const { ensureDbOpen } = await import("./bootstrap/dynamic-tools.js");
|
|
1503
|
+
await ensureDbOpen(basePath);
|
|
1504
|
+
|
|
1505
|
+
// Invalidate caches to pick up artifacts written by a just-completed discuss/plan
|
|
1506
|
+
invalidateAllCaches();
|
|
1507
|
+
|
|
1508
|
+
const state = await deriveState(basePath);
|
|
1509
|
+
const discussableFutureMilestones = getDiscussableFutureMilestones(
|
|
1510
|
+
state.registry,
|
|
1511
|
+
state.activeMilestone?.id,
|
|
1512
|
+
);
|
|
1513
|
+
|
|
1514
|
+
// Rebuild STATE.md from derived state before any dispatch (#3475).
|
|
1515
|
+
// Without this, guided prompts read a stale STATE.md cache and the
|
|
1516
|
+
// agent bootstraps from the wrong milestone.
|
|
1517
|
+
try {
|
|
1518
|
+
const { buildStateMarkdown } = await import("./doctor.js");
|
|
1519
|
+
await saveFile(resolveGsdRootFile(basePath, "STATE"), buildStateMarkdown(state));
|
|
1520
|
+
} catch (err) {
|
|
1521
|
+
logWarning("guided", `STATE.md rebuild failed: ${(err as Error).message}`);
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
const target = options?.target?.trim();
|
|
1525
|
+
if (target) {
|
|
1526
|
+
const slash = target.indexOf("/");
|
|
1527
|
+
if (slash > 0) {
|
|
1528
|
+
const mid = target.slice(0, slash);
|
|
1529
|
+
const sid = target.slice(slash + 1);
|
|
1530
|
+
const targetMilestone = state.registry.find((m) => m.id === mid);
|
|
1531
|
+
if (!targetMilestone || targetMilestone.status === "complete" || targetMilestone.status === "parked") {
|
|
1532
|
+
ctx.ui.notify(`Milestone ${mid} is not discussable.`, "warning");
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
const slices = isDbAvailable()
|
|
1536
|
+
? getMilestoneSlices(mid).map(s => ({ id: s.id, done: s.status === "complete", title: s.title }))
|
|
1537
|
+
: [];
|
|
1538
|
+
const chosen = slices.find((s) => s.id === sid);
|
|
1539
|
+
if (!chosen) {
|
|
1540
|
+
ctx.ui.notify(`Slice ${target} was not found in discussable slices.`, "warning");
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
if (chosen.done) {
|
|
1544
|
+
ctx.ui.notify(`Slice ${target} is already complete; nothing to discuss.`, "info");
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
const contextFile = resolveSliceFile(basePath, mid, sid, "CONTEXT");
|
|
1548
|
+
const sqAvail = getStructuredQuestionsAvailability(pi, ctx);
|
|
1549
|
+
const prompt = await buildDiscussSlicePrompt(mid, sid, chosen.title, basePath, {
|
|
1550
|
+
rediscuss: !!contextFile,
|
|
1551
|
+
structuredQuestionsAvailable: sqAvail,
|
|
1552
|
+
});
|
|
1553
|
+
await dispatchWorkflow(pi, prompt, "gsd-discuss", ctx, "discuss-slice", { basePath });
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
const targetMilestone = state.registry.find((m) => m.id === target);
|
|
1558
|
+
if (!targetMilestone || targetMilestone.status === "complete" || targetMilestone.status === "parked") {
|
|
1559
|
+
ctx.ui.notify(`Milestone ${target} is not discussable.`, "warning");
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
await dispatchDiscussForMilestone(ctx, pi, basePath, targetMilestone.id, targetMilestone.title, {});
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
// No active milestone (or corrupted milestone with undefined id) —
|
|
1567
|
+
// check for pending milestones to discuss instead
|
|
1568
|
+
if (!state.activeMilestone?.id) {
|
|
1569
|
+
if (discussableFutureMilestones.length === 0) {
|
|
1570
|
+
ctx.ui.notify("No active milestone. Run /gsd to create one first.", "warning");
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
await showDiscussQueuedMilestone(ctx, pi, basePath, discussableFutureMilestones);
|
|
1574
|
+
return;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
const mid = state.activeMilestone.id;
|
|
1578
|
+
const milestoneTitle = state.activeMilestone.title;
|
|
1579
|
+
|
|
1580
|
+
// Special case: milestone is in needs-discussion phase (has CONTEXT-DRAFT.md but no roadmap yet).
|
|
1581
|
+
// Route to the draft discussion flow instead of erroring — the discussion IS how the roadmap gets created.
|
|
1582
|
+
if (state.phase === "needs-discussion") {
|
|
1583
|
+
const draftFile = resolveMilestoneFile(basePath, mid, "CONTEXT-DRAFT");
|
|
1584
|
+
const draftContent = draftFile ? await loadFile(draftFile) : null;
|
|
1585
|
+
|
|
1586
|
+
const choice = await showNextAction(ctx, {
|
|
1587
|
+
title: `GSD — ${mid}: ${milestoneTitle}`,
|
|
1588
|
+
summary: ["This milestone has a draft context from a prior discussion.", "It needs a dedicated discussion before auto-planning can begin."],
|
|
1589
|
+
actions: [
|
|
1590
|
+
{
|
|
1591
|
+
id: "discuss_draft",
|
|
1592
|
+
label: "Discuss from draft",
|
|
1593
|
+
description: "Continue where the prior discussion left off — seed material is loaded automatically.",
|
|
1594
|
+
recommended: true,
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
id: "discuss_fresh",
|
|
1598
|
+
label: "Start fresh discussion",
|
|
1599
|
+
description: "Discard the draft and start a new discussion from scratch.",
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
id: "skip_milestone",
|
|
1603
|
+
label: "Skip — create new milestone",
|
|
1604
|
+
description: "Leave this milestone as-is and start something new.",
|
|
1605
|
+
},
|
|
1606
|
+
],
|
|
1607
|
+
notYetMessage: "Run /gsd discuss when ready to discuss this milestone.",
|
|
1608
|
+
});
|
|
1609
|
+
|
|
1610
|
+
if (choice === "discuss_draft") {
|
|
1611
|
+
const discussMilestoneTemplates = inlineTemplate("context", "Context");
|
|
1612
|
+
const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
|
|
1613
|
+
const basePrompt = loadPrompt("guided-discuss-milestone", {
|
|
1614
|
+
workingDirectory: basePath,
|
|
1615
|
+
milestoneId: mid, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
|
|
1616
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${mid}): milestone context from discuss`),
|
|
1617
|
+
fastPathInstruction: "",
|
|
1618
|
+
});
|
|
1619
|
+
const seed = draftContent
|
|
1620
|
+
? `${basePrompt}\n\n## Prior Discussion (Draft Seed)\n\n${draftContent}`
|
|
1621
|
+
: basePrompt;
|
|
1622
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: mid, step: false });
|
|
1623
|
+
await dispatchWorkflow(pi, seed, "gsd-discuss", ctx, "discuss-milestone", { basePath });
|
|
1624
|
+
} else if (choice === "discuss_fresh") {
|
|
1625
|
+
const discussMilestoneTemplates = inlineTemplate("context", "Context");
|
|
1626
|
+
const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
|
|
1627
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: mid, step: false });
|
|
1628
|
+
await dispatchWorkflow(pi, loadPrompt("guided-discuss-milestone", {
|
|
1629
|
+
workingDirectory: basePath,
|
|
1630
|
+
milestoneId: mid, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
|
|
1631
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${mid}): milestone context from discuss`),
|
|
1632
|
+
fastPathInstruction: "",
|
|
1633
|
+
}), "gsd-discuss", ctx, "discuss-milestone", { basePath });
|
|
1634
|
+
} else if (choice === "skip_milestone") {
|
|
1635
|
+
const { ensureDbOpen } = await import("./bootstrap/dynamic-tools.js");
|
|
1636
|
+
await ensureDbOpen(basePath);
|
|
1637
|
+
const milestoneIds = findMilestoneIds(basePath);
|
|
1638
|
+
const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
1639
|
+
const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
|
|
1640
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: false });
|
|
1641
|
+
await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId, `New milestone ${nextId}.`, basePath), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
1642
|
+
}
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// Guard: no roadmap yet (unless DB has slices)
|
|
1647
|
+
const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
|
|
1648
|
+
const roadmapContent = roadmapFile ? await loadFile(roadmapFile) : null;
|
|
1649
|
+
if (!roadmapContent && !isDbAvailable()) {
|
|
1650
|
+
ctx.ui.notify("No roadmap yet for this milestone. Run /gsd to plan first.", "warning");
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
// Normalize slices: prefer DB, fall back to parser
|
|
1655
|
+
type NormSlice = { id: string; done: boolean; title: string };
|
|
1656
|
+
let normSlices: NormSlice[];
|
|
1657
|
+
if (isDbAvailable()) {
|
|
1658
|
+
normSlices = getMilestoneSlices(mid).map(s => ({ id: s.id, done: s.status === "complete", title: s.title }));
|
|
1659
|
+
} else {
|
|
1660
|
+
normSlices = [];
|
|
1661
|
+
}
|
|
1662
|
+
// DB is open but returned zero slices despite a roadmap existing —
|
|
1663
|
+
// the DB may be empty due to WAL loss or truncation (see #2815, #2892).
|
|
1664
|
+
// Fall back to roadmap parsing to prevent false "all complete" exit.
|
|
1665
|
+
if (normSlices.length === 0 && roadmapContent) {
|
|
1666
|
+
normSlices = parseRoadmapSlices(roadmapContent).map(s => ({ id: s.id, done: s.done, title: s.title }));
|
|
1667
|
+
}
|
|
1668
|
+
const pendingSlices = normSlices.filter(s => !s.done);
|
|
1669
|
+
|
|
1670
|
+
if (pendingSlices.length === 0) {
|
|
1671
|
+
// All slices complete — but queued milestones may still need discussion (#3150)
|
|
1672
|
+
if (discussableFutureMilestones.length > 0) {
|
|
1673
|
+
await showDiscussQueuedMilestone(ctx, pi, basePath, discussableFutureMilestones);
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
ctx.ui.notify("All slices are complete — nothing to discuss.", "info");
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
// Loop: show picker, dispatch discuss, repeat until "not_yet"
|
|
1681
|
+
while (true) {
|
|
1682
|
+
// Invalidate caches so we pick up CONTEXT files written by the just-completed discussion
|
|
1683
|
+
invalidateAllCaches();
|
|
1684
|
+
|
|
1685
|
+
// Build discussion-state map: which slices have CONTEXT files already?
|
|
1686
|
+
const discussedMap = new Map<string, boolean>();
|
|
1687
|
+
for (const s of pendingSlices) {
|
|
1688
|
+
const contextFile = resolveSliceFile(basePath, mid, s.id, "CONTEXT");
|
|
1689
|
+
discussedMap.set(s.id, !!contextFile);
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
// If all pending slices are discussed, check for queued milestones before exiting (#3150)
|
|
1693
|
+
const allDiscussed = pendingSlices.every(s => discussedMap.get(s.id));
|
|
1694
|
+
if (allDiscussed) {
|
|
1695
|
+
if (discussableFutureMilestones.length > 0) {
|
|
1696
|
+
await showDiscussQueuedMilestone(ctx, pi, basePath, discussableFutureMilestones);
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
const lockData = readSessionLockData(basePath);
|
|
1700
|
+
const remoteAutoRunning = lockData && lockData.pid !== process.pid && isSessionLockProcessAlive(lockData);
|
|
1701
|
+
const nextStep = remoteAutoRunning
|
|
1702
|
+
? "Auto-mode is already running — use /gsd status to check progress."
|
|
1703
|
+
: "Run /gsd to start planning.";
|
|
1704
|
+
ctx.ui.notify(
|
|
1705
|
+
`All ${pendingSlices.length} slices discussed. ${nextStep}`,
|
|
1706
|
+
"info",
|
|
1707
|
+
);
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
// Find the first undiscussed slice to recommend
|
|
1712
|
+
const firstUndiscussedId = pendingSlices.find(s => !discussedMap.get(s.id))?.id;
|
|
1713
|
+
|
|
1714
|
+
const actions = pendingSlices.map((s) => {
|
|
1715
|
+
const discussed = discussedMap.get(s.id) ?? false;
|
|
1716
|
+
const statusParts: string[] = [];
|
|
1717
|
+
if (state.activeSlice?.id === s.id) statusParts.push("active");
|
|
1718
|
+
else statusParts.push("upcoming");
|
|
1719
|
+
statusParts.push(discussed ? "discussed ✓" : "not discussed");
|
|
1720
|
+
|
|
1721
|
+
return {
|
|
1722
|
+
id: s.id,
|
|
1723
|
+
label: `${s.id}: ${s.title}`,
|
|
1724
|
+
description: statusParts.join(" · "),
|
|
1725
|
+
recommended: s.id === firstUndiscussedId,
|
|
1726
|
+
};
|
|
1727
|
+
});
|
|
1728
|
+
|
|
1729
|
+
// Offer access to queued milestones when any exist
|
|
1730
|
+
if (discussableFutureMilestones.length > 0) {
|
|
1731
|
+
actions.push({
|
|
1732
|
+
id: "discuss_queued_milestone",
|
|
1733
|
+
label: "Discuss a future/planned milestone",
|
|
1734
|
+
description: `Refine context for ${discussableFutureMilestones.length} future milestone(s). Does not affect current execution.`,
|
|
1735
|
+
recommended: false,
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
const choice = await showNextAction(ctx, {
|
|
1740
|
+
title: "GSD — Discuss a slice",
|
|
1741
|
+
summary: [
|
|
1742
|
+
`${mid}: ${milestoneTitle}`,
|
|
1743
|
+
"Pick a slice to interview. Context file will be written when done.",
|
|
1744
|
+
],
|
|
1745
|
+
actions,
|
|
1746
|
+
notYetMessage: "Run /gsd discuss when ready.",
|
|
1747
|
+
});
|
|
1748
|
+
|
|
1749
|
+
if (choice === "not_yet") return;
|
|
1750
|
+
|
|
1751
|
+
if (choice === "discuss_queued_milestone") {
|
|
1752
|
+
await showDiscussQueuedMilestone(ctx, pi, basePath, discussableFutureMilestones);
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
const chosen = pendingSlices.find(s => s.id === choice);
|
|
1757
|
+
if (!chosen) return;
|
|
1758
|
+
|
|
1759
|
+
// If the slice already has a CONTEXT file, confirm re-discuss intent
|
|
1760
|
+
const isRediscuss = discussedMap.get(chosen.id) ?? false;
|
|
1761
|
+
if (isRediscuss) {
|
|
1762
|
+
const confirm = await showNextAction(ctx, {
|
|
1763
|
+
title: `Re-discuss ${chosen.id}?`,
|
|
1764
|
+
summary: [
|
|
1765
|
+
`${chosen.id} already has a context file from a prior discussion.`,
|
|
1766
|
+
"Re-discussing will interview for updates and rewrite the context file.",
|
|
1767
|
+
],
|
|
1768
|
+
actions: [
|
|
1769
|
+
{ id: "rediscuss", label: "Re-discuss to update context", description: "Interview for changes and rewrite", recommended: true },
|
|
1770
|
+
{ id: "cancel", label: "Cancel", description: "Go back to slice picker" },
|
|
1771
|
+
],
|
|
1772
|
+
});
|
|
1773
|
+
if (confirm !== "rediscuss") continue;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
const sqAvail = getStructuredQuestionsAvailability(pi, ctx);
|
|
1777
|
+
const prompt = await buildDiscussSlicePrompt(mid, chosen.id, chosen.title, basePath, { rediscuss: isRediscuss, structuredQuestionsAvailable: sqAvail });
|
|
1778
|
+
await dispatchWorkflow(pi, prompt, "gsd-discuss", ctx, "discuss-slice", { basePath });
|
|
1779
|
+
|
|
1780
|
+
// Wait for the discuss session to finish, then loop back to the picker
|
|
1781
|
+
await ctx.waitForIdle();
|
|
1782
|
+
invalidateAllCaches();
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
// ─── Queued Milestone Discussion ─────────────────────────────────────────────
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* Show a picker of queued (pending) milestones and dispatch a discuss flow for
|
|
1790
|
+
* the chosen one. Discussing a queued milestone does NOT activate it — it only
|
|
1791
|
+
* refines the CONTEXT.md artifact so it is better prepared when auto-mode
|
|
1792
|
+
* eventually reaches it.
|
|
1793
|
+
*/
|
|
1794
|
+
async function showDiscussQueuedMilestone(
|
|
1795
|
+
ctx: ExtensionCommandContext,
|
|
1796
|
+
pi: ExtensionAPI,
|
|
1797
|
+
basePath: string,
|
|
1798
|
+
pendingMilestones: Array<{ id: string; title: string; status: string }>,
|
|
1799
|
+
): Promise<void> {
|
|
1800
|
+
const actions = pendingMilestones.map((m, i) => {
|
|
1801
|
+
const hasContext = !!resolveMilestoneFile(basePath, m.id, "CONTEXT");
|
|
1802
|
+
const hasDraft = !hasContext && !!resolveMilestoneFile(basePath, m.id, "CONTEXT-DRAFT");
|
|
1803
|
+
const hasRoadmap = !!resolveMilestoneFile(basePath, m.id, "ROADMAP");
|
|
1804
|
+
const contextStatus = hasContext ? "context ✓" : hasDraft ? "draft context" : "no context yet";
|
|
1805
|
+
const roadmapStatus = hasRoadmap ? " · roadmap ✓" : "";
|
|
1806
|
+
return {
|
|
1807
|
+
id: m.id,
|
|
1808
|
+
label: `${m.id}: ${m.title}`,
|
|
1809
|
+
description: `[${m.status}] · ${contextStatus}${roadmapStatus}`,
|
|
1810
|
+
recommended: i === 0,
|
|
1811
|
+
};
|
|
1812
|
+
});
|
|
1813
|
+
|
|
1814
|
+
const choice = await showNextAction(ctx, {
|
|
1815
|
+
title: "GSD — Discuss a future/planned milestone",
|
|
1816
|
+
summary: [
|
|
1817
|
+
"Select a future or planned milestone to discuss.",
|
|
1818
|
+
"Discussing will update its context file. It will not be activated.",
|
|
1819
|
+
],
|
|
1820
|
+
actions,
|
|
1821
|
+
|
|
1822
|
+
});
|
|
1823
|
+
|
|
1824
|
+
if (choice === "not_yet") return;
|
|
1825
|
+
|
|
1826
|
+
const chosen = pendingMilestones.find(m => m.id === choice);
|
|
1827
|
+
if (!chosen) return;
|
|
1828
|
+
|
|
1829
|
+
const hasDraft = !!resolveMilestoneFile(basePath, chosen.id, "CONTEXT-DRAFT");
|
|
1830
|
+
let fastPath = hasDraft;
|
|
1831
|
+
|
|
1832
|
+
if (!hasDraft) {
|
|
1833
|
+
const mode = await showNextAction(ctx, {
|
|
1834
|
+
title: `Discuss ${chosen.id}`,
|
|
1835
|
+
summary: [
|
|
1836
|
+
"Choose how to start the discussion.",
|
|
1837
|
+
"Fast path skips generic scouting — use it when you already know the scope.",
|
|
1838
|
+
],
|
|
1839
|
+
actions: [
|
|
1840
|
+
{
|
|
1841
|
+
id: "full",
|
|
1842
|
+
label: "Full discussion",
|
|
1843
|
+
description: "Scout the codebase, ask open-ended questions, explore deeply",
|
|
1844
|
+
recommended: true,
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
id: "fast",
|
|
1848
|
+
label: "I have the scope — fast path",
|
|
1849
|
+
description: "Treat your first message as authoritative seed context; skip scouting",
|
|
1850
|
+
},
|
|
1851
|
+
],
|
|
1852
|
+
notYetMessage: "Run /gsd discuss when ready.",
|
|
1853
|
+
});
|
|
1854
|
+
if (mode === "not_yet") return;
|
|
1855
|
+
fastPath = mode === "fast";
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
await dispatchDiscussForMilestone(ctx, pi, basePath, chosen.id, chosen.title, { fastPath });
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* Dispatch the guided-discuss-milestone prompt for a milestone without
|
|
1863
|
+
* setting pendingAutoStart — so discussing a queued milestone does not
|
|
1864
|
+
* implicitly activate it when the session ends.
|
|
1865
|
+
*/
|
|
1866
|
+
async function dispatchDiscussForMilestone(
|
|
1867
|
+
ctx: ExtensionCommandContext,
|
|
1868
|
+
pi: ExtensionAPI,
|
|
1869
|
+
basePath: string,
|
|
1870
|
+
mid: string,
|
|
1871
|
+
milestoneTitle: string,
|
|
1872
|
+
opts: { fastPath?: boolean } = {},
|
|
1873
|
+
): Promise<void> {
|
|
1874
|
+
const draftFile = resolveMilestoneFile(basePath, mid, "CONTEXT-DRAFT");
|
|
1875
|
+
const draftContent = draftFile ? await loadFile(draftFile) : null;
|
|
1876
|
+
const hasSeed = !!(draftContent || opts.fastPath);
|
|
1877
|
+
const fastPathInstruction = hasSeed
|
|
1878
|
+
? [
|
|
1879
|
+
"> **Fast path active — scope provided.**",
|
|
1880
|
+
"> Do NOT perform a generic codebase scouting pass.",
|
|
1881
|
+
"> Do at most 2 targeted reads to check for obvious conflicts with existing work.",
|
|
1882
|
+
"> Treat the seed context or the operator's first message as authoritative.",
|
|
1883
|
+
"> Move directly to the depth summary and write step.",
|
|
1884
|
+
"> Ask only questions where the answer would materially change scope.",
|
|
1885
|
+
].join("\n")
|
|
1886
|
+
: "";
|
|
1887
|
+
const discussMilestoneTemplates = inlineTemplate("context", "Context");
|
|
1888
|
+
const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
|
|
1889
|
+
const basePrompt = loadPrompt("guided-discuss-milestone", {
|
|
1890
|
+
workingDirectory: basePath,
|
|
1891
|
+
milestoneId: mid,
|
|
1892
|
+
milestoneTitle,
|
|
1893
|
+
inlinedTemplates: discussMilestoneTemplates,
|
|
1894
|
+
structuredQuestionsAvailable,
|
|
1895
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${mid}): milestone context from discuss`),
|
|
1896
|
+
fastPathInstruction,
|
|
1897
|
+
});
|
|
1898
|
+
const prompt = draftContent
|
|
1899
|
+
? `${basePrompt}\n\n## Prior Discussion (Draft Seed)\n\n${draftContent}`
|
|
1900
|
+
: basePrompt;
|
|
1901
|
+
await dispatchWorkflow(pi, prompt, "gsd-discuss", ctx, "discuss-milestone", { basePath });
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
// ─── Smart Entry Point ────────────────────────────────────────────────────────
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* The one wizard. Reads state, shows contextual options, dispatches into the workflow doc.
|
|
1908
|
+
*/
|
|
1909
|
+
/**
|
|
1910
|
+
* Self-heal: scan runtime records and clear stale ones left behind when
|
|
1911
|
+
* auto-mode crashed mid-unit. auto.ts has its own selfHealRuntimeRecords()
|
|
1912
|
+
* but guided-flow (manual /gsd mode) never called it — meaning stale records
|
|
1913
|
+
* persisted until the next /gsd auto run. This ensures the wizard always
|
|
1914
|
+
* starts from a clean state regardless of how the previous session ended.
|
|
1915
|
+
*/
|
|
1916
|
+
function selfHealRuntimeRecords(basePath: string, ctx: ExtensionContext): { cleared: number } {
|
|
1917
|
+
try {
|
|
1918
|
+
const records = listUnitRuntimeRecords(basePath);
|
|
1919
|
+
let cleared = 0;
|
|
1920
|
+
for (const record of records) {
|
|
1921
|
+
const { unitType, unitId, phase } = record;
|
|
1922
|
+
// Clear records whose expected artifact already exists (completed but not cleaned up)
|
|
1923
|
+
// TODO(C-future): selfHealRuntimeRecords iterates across all unit types (not just milestone
|
|
1924
|
+
// units), so it cannot be converted to resolveExpectedArtifactPathForScope without
|
|
1925
|
+
// first establishing a per-record scope. Migrate once unit runtime records carry scope info.
|
|
1926
|
+
const artifactPath = resolveExpectedArtifactPath(unitType, unitId, basePath);
|
|
1927
|
+
if (artifactPath && existsSync(artifactPath)) {
|
|
1928
|
+
clearUnitRuntimeRecord(basePath, unitType, unitId);
|
|
1929
|
+
cleared++;
|
|
1930
|
+
continue;
|
|
1931
|
+
}
|
|
1932
|
+
// Clear records stuck in an in-flight phase (process died mid-unit).
|
|
1933
|
+
if (isInFlightRuntimePhase(phase)) {
|
|
1934
|
+
clearUnitRuntimeRecord(basePath, unitType, unitId);
|
|
1935
|
+
cleared++;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
if (cleared > 0) {
|
|
1939
|
+
ctx.ui.notify(`Self-heal: cleared ${cleared} stale runtime record(s) from a previous session.`, "info");
|
|
1940
|
+
}
|
|
1941
|
+
return { cleared };
|
|
1942
|
+
} catch (e) {
|
|
1943
|
+
logWarning("guided", `self-heal stale runtime records failed: ${(e as Error).message}`);
|
|
1944
|
+
return { cleared: 0 };
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
// ─── Milestone Actions Submenu ──────────────────────────────────────────────
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* Shows a submenu with Park / Discard / Skip / Back options for the active milestone.
|
|
1952
|
+
* Returns true if an action was taken (caller should re-enter showSmartEntry or
|
|
1953
|
+
* dispatch a new workflow). Returns false if the user chose "Back".
|
|
1954
|
+
*/
|
|
1955
|
+
async function handleMilestoneActions(
|
|
1956
|
+
ctx: ExtensionCommandContext,
|
|
1957
|
+
pi: ExtensionAPI,
|
|
1958
|
+
basePath: string,
|
|
1959
|
+
milestoneId: string,
|
|
1960
|
+
milestoneTitle: string,
|
|
1961
|
+
options?: { step?: boolean },
|
|
1962
|
+
): Promise<boolean> {
|
|
1963
|
+
const stepMode = options?.step;
|
|
1964
|
+
const choice = await showNextAction(ctx, {
|
|
1965
|
+
title: `Milestone Actions — ${milestoneId}`,
|
|
1966
|
+
summary: [`${milestoneId}: ${milestoneTitle}`],
|
|
1967
|
+
actions: [
|
|
1968
|
+
{
|
|
1969
|
+
id: "park",
|
|
1970
|
+
label: "Park milestone",
|
|
1971
|
+
description: "Pause this milestone — it stays on disk but is skipped.",
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
id: "discard",
|
|
1975
|
+
label: "Discard milestone",
|
|
1976
|
+
description: "Permanently delete this milestone and all its contents.",
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
id: "skip",
|
|
1980
|
+
label: "Skip — create new milestone",
|
|
1981
|
+
description: "Leave this milestone and start a fresh one.",
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
id: "back",
|
|
1985
|
+
label: "Back",
|
|
1986
|
+
description: "Return to the previous menu.",
|
|
1987
|
+
},
|
|
1988
|
+
],
|
|
1989
|
+
notYetMessage: "Run /gsd when ready.",
|
|
1990
|
+
});
|
|
1991
|
+
|
|
1992
|
+
if (choice === "park") {
|
|
1993
|
+
const reason = await showNextAction(ctx, {
|
|
1994
|
+
title: `Park ${milestoneId}`,
|
|
1995
|
+
summary: ["Why is this milestone being parked?"],
|
|
1996
|
+
actions: [
|
|
1997
|
+
{ id: "priority_shift", label: "Priority shift", description: "Other work is more important right now." },
|
|
1998
|
+
{ id: "blocked_external", label: "Blocked externally", description: "Waiting on an external dependency or decision." },
|
|
1999
|
+
{ id: "needs_rethink", label: "Needs rethinking", description: "The approach needs to be reconsidered." },
|
|
2000
|
+
],
|
|
2001
|
+
notYetMessage: "Run /gsd when ready.",
|
|
2002
|
+
});
|
|
2003
|
+
|
|
2004
|
+
// User pressed "Not yet" / Escape — cancel the park operation
|
|
2005
|
+
if (!reason || reason === "not_yet") return false;
|
|
2006
|
+
|
|
2007
|
+
const reasonText = reason === "priority_shift" ? "Priority shift — other work is more important"
|
|
2008
|
+
: reason === "blocked_external" ? "Blocked externally — waiting on external dependency"
|
|
2009
|
+
: reason === "needs_rethink" ? "Needs rethinking — approach needs reconsideration"
|
|
2010
|
+
: "Parked by user";
|
|
2011
|
+
|
|
2012
|
+
const success = parkMilestone(basePath, milestoneId, reasonText);
|
|
2013
|
+
if (success) {
|
|
2014
|
+
ctx.ui.notify(`Parked ${milestoneId}. Run /gsd unpark ${milestoneId} to reactivate.`, "info");
|
|
2015
|
+
} else {
|
|
2016
|
+
ctx.ui.notify(`Could not park ${milestoneId} — milestone not found or already parked.`, "warning");
|
|
2017
|
+
}
|
|
2018
|
+
return true;
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
if (choice === "discard") {
|
|
2022
|
+
const confirmed = await showConfirm(ctx, {
|
|
2023
|
+
title: "Discard milestone?",
|
|
2024
|
+
message: `This will permanently delete ${milestoneId} and all its contents (roadmap, plans, task summaries).`,
|
|
2025
|
+
confirmLabel: "Discard",
|
|
2026
|
+
declineLabel: "Cancel",
|
|
2027
|
+
});
|
|
2028
|
+
if (confirmed) {
|
|
2029
|
+
discardMilestone(basePath, milestoneId);
|
|
2030
|
+
ctx.ui.notify(`Discarded ${milestoneId}.`, "info");
|
|
2031
|
+
return true;
|
|
2032
|
+
}
|
|
2033
|
+
return false;
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
if (choice === "skip") {
|
|
2037
|
+
const milestoneIds = findMilestoneIds(basePath);
|
|
2038
|
+
const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
2039
|
+
const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
|
|
2040
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
|
|
2041
|
+
await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
|
|
2042
|
+
`New milestone ${nextId}.`,
|
|
2043
|
+
basePath
|
|
2044
|
+
), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
2045
|
+
return true;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
// "back" or null
|
|
2049
|
+
return false;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
export async function showSmartEntry(
|
|
2053
|
+
ctx: ExtensionCommandContext,
|
|
2054
|
+
pi: ExtensionAPI,
|
|
2055
|
+
basePath: string,
|
|
2056
|
+
options?: { step?: boolean },
|
|
2057
|
+
): Promise<void> {
|
|
2058
|
+
const stepMode = options?.step;
|
|
2059
|
+
|
|
2060
|
+
// ── Clear stale milestone ID reservations from previous cancelled sessions ──
|
|
2061
|
+
// Reservations only need to survive within a single /gsd interaction.
|
|
2062
|
+
// Without this, each cancelled session permanently bumps the next ID. (#2488)
|
|
2063
|
+
clearReservedMilestoneIds();
|
|
2064
|
+
|
|
2065
|
+
// ── Directory safety check — refuse to operate in system/home dirs ───
|
|
2066
|
+
const dirCheck = validateDirectory(basePath);
|
|
2067
|
+
if (dirCheck.severity === "blocked") {
|
|
2068
|
+
ctx.ui.notify(dirCheck.reason!, "error");
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
if (dirCheck.severity === "warning") {
|
|
2072
|
+
const proceed = await showConfirm(ctx, {
|
|
2073
|
+
title: "GSD — Unusual Directory",
|
|
2074
|
+
message: dirCheck.reason!,
|
|
2075
|
+
confirmLabel: "Continue anyway",
|
|
2076
|
+
declineLabel: "Cancel",
|
|
2077
|
+
});
|
|
2078
|
+
if (!proceed) return;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
// ── Detection preamble — run before any bootstrap ────────────────────
|
|
2082
|
+
// Check bootstrap completeness, not just .gsd/ directory existence.
|
|
2083
|
+
// A zombie .gsd/ state (symlink exists but missing PREFERENCES.md and
|
|
2084
|
+
// milestones/) must trigger the init wizard, not skip it (#2942).
|
|
2085
|
+
const gsdPath = gsdRoot(basePath);
|
|
2086
|
+
const hasBootstrapArtifacts = hasGsdBootstrapArtifacts(gsdPath);
|
|
2087
|
+
let skipGitBootstrap = false;
|
|
2088
|
+
|
|
2089
|
+
if (!hasBootstrapArtifacts) {
|
|
2090
|
+
const detection = detectProjectState(basePath);
|
|
2091
|
+
|
|
2092
|
+
// v1 .planning/ detected — offer migration before anything else
|
|
2093
|
+
if (detection.state === "v1-planning" && detection.v1) {
|
|
2094
|
+
const migrationChoice = await offerMigration(ctx, detection.v1);
|
|
2095
|
+
if (migrationChoice === "cancel") return;
|
|
2096
|
+
if (migrationChoice === "migrate") {
|
|
2097
|
+
const { handleMigrate } = await import("./migrate/command.js");
|
|
2098
|
+
await handleMigrate("", ctx, pi);
|
|
2099
|
+
return;
|
|
2100
|
+
}
|
|
2101
|
+
// "fresh" — fall through to init wizard
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
// No .gsd/ or zombie .gsd/ — run the project init wizard
|
|
2105
|
+
const result = await showProjectInit(ctx, pi, basePath, detection);
|
|
2106
|
+
if (!result.completed) return; // User cancelled
|
|
2107
|
+
skipGitBootstrap = shouldSkipGitBootstrapAfterInit(result);
|
|
2108
|
+
|
|
2109
|
+
// Init wizard bootstrapped .gsd/ — fall through to the normal flow below
|
|
2110
|
+
// which will detect "no milestones" and start the discuss prompt
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
// ── Ensure git repo exists — GSD needs it for worktree isolation ──────
|
|
2114
|
+
// Also handle inherited repos: if basePath is a subdirectory of another
|
|
2115
|
+
// git repo that has no .gsd, create a fresh repo to prevent cross-project
|
|
2116
|
+
// state leaks (#1639).
|
|
2117
|
+
if (!skipGitBootstrap && (!nativeIsRepo(basePath) || isInheritedRepo(basePath))) {
|
|
2118
|
+
const mainBranch = loadEffectiveGSDPreferences()?.preferences?.git?.main_branch || "main";
|
|
2119
|
+
nativeInit(basePath, mainBranch);
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
// ── Ensure .gitignore has baseline patterns ──────────────────────────
|
|
2123
|
+
if (!skipGitBootstrap && nativeIsRepo(basePath)) {
|
|
2124
|
+
const gitPrefs = loadEffectiveGSDPreferences(basePath)?.preferences?.git;
|
|
2125
|
+
const manageGitignore = gitPrefs?.manage_gitignore;
|
|
2126
|
+
ensureGitignore(basePath, { manageGitignore });
|
|
2127
|
+
if (manageGitignore !== false) untrackRuntimeFiles(basePath);
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// Deep setup can pre-create .gsd/PREFERENCES.md before the normal init
|
|
2131
|
+
// wizard path runs. If that path also initialized git, make HEAD reachable
|
|
2132
|
+
// now so later worktree/git-log operations do not run on an unborn branch.
|
|
2133
|
+
if (!skipGitBootstrap && nativeIsRepo(basePath) && !nativeHasCommittedHead(basePath)) {
|
|
2134
|
+
try {
|
|
2135
|
+
nativeAddAll(basePath);
|
|
2136
|
+
nativeCommit(basePath, "chore: init project");
|
|
2137
|
+
} catch (err) {
|
|
2138
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2139
|
+
logWarning("guided", `initial git commit failed; worktree isolation will remain disabled until HEAD exists: ${message}`);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
{
|
|
2144
|
+
const { ensureDbOpen } = await import("./bootstrap/dynamic-tools.js");
|
|
2145
|
+
await ensureDbOpen(basePath);
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
// ── Self-heal stale runtime records from crashed auto-mode sessions ──
|
|
2149
|
+
selfHealRuntimeRecords(basePath, ctx);
|
|
2150
|
+
|
|
2151
|
+
const interrupted = await assessInterruptedSession(basePath);
|
|
2152
|
+
if (interrupted.classification === "running") {
|
|
2153
|
+
ctx.ui.notify(formatInterruptedSessionRunningMessage(interrupted), "error");
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
if (interrupted.classification === "stale") {
|
|
2158
|
+
clearLock(basePath);
|
|
2159
|
+
if (interrupted.pausedSession) {
|
|
2160
|
+
// Phase C pt 2: paused-session.json migrated to runtime_kv
|
|
2161
|
+
// (global scope, key PAUSED_SESSION_KV_KEY).
|
|
2162
|
+
try {
|
|
2163
|
+
deleteRuntimeKv("global", "", PAUSED_SESSION_KV_KEY);
|
|
2164
|
+
} catch (e) {
|
|
2165
|
+
logWarning("guided", `stale paused-session DB cleanup failed: ${(e as Error).message}`, { file: "guided-flow.ts" });
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
} else if (interrupted.classification === "recoverable") {
|
|
2169
|
+
if (interrupted.lock) clearLock(basePath);
|
|
2170
|
+
const resumeLabel = interrupted.pausedSession?.stepMode
|
|
2171
|
+
? "Resume with /gsd next"
|
|
2172
|
+
: "Resume with /gsd auto";
|
|
2173
|
+
const resume = await showNextAction(ctx, {
|
|
2174
|
+
title: "GSD — Interrupted Session Detected",
|
|
2175
|
+
summary: formatInterruptedSessionSummary(interrupted),
|
|
2176
|
+
actions: [
|
|
2177
|
+
{ id: "resume", label: resumeLabel, description: "Pick up where it left off", recommended: true },
|
|
2178
|
+
{ id: "continue", label: "Continue manually", description: "Open the wizard as normal" },
|
|
2179
|
+
],
|
|
2180
|
+
});
|
|
2181
|
+
if (resume === "resume") {
|
|
2182
|
+
startAutoDetached(ctx, pi, basePath, false, {
|
|
2183
|
+
interrupted,
|
|
2184
|
+
step: interrupted.pausedSession?.stepMode ?? false,
|
|
2185
|
+
});
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
if (interrupted.classification !== "recoverable") {
|
|
2191
|
+
try {
|
|
2192
|
+
const { checkMarkdownHierarchyAgainstDb } = await import("./migration-auto-check.js");
|
|
2193
|
+
const result = await checkMarkdownHierarchyAgainstDb(basePath);
|
|
2194
|
+
if (result.action === "recovery-required") {
|
|
2195
|
+
ctx.ui.notify(
|
|
2196
|
+
result.message ??
|
|
2197
|
+
`Markdown planning artifacts do not match the authoritative DB. Run \`${result.recoveryCommand ?? "gsd recover"}\` to import markdown explicitly.`,
|
|
2198
|
+
"warning",
|
|
2199
|
+
);
|
|
2200
|
+
}
|
|
2201
|
+
} catch (err) {
|
|
2202
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2203
|
+
ctx.ui.notify(`GSD could not compare markdown planning artifacts with gsd.db: ${message}`, "warning");
|
|
2204
|
+
logWarning("guided", `planning state DB/markdown comparison failed: ${message}`, { file: "guided-flow.ts" });
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
// Always derive from the project root — the assessment may have derived
|
|
2209
|
+
// state from a worktree path that was cleaned up in the stale branch above.
|
|
2210
|
+
const state = await deriveState(basePath);
|
|
2211
|
+
|
|
2212
|
+
// Rebuild STATE.md from derived state before any dispatch (#3475).
|
|
2213
|
+
try {
|
|
2214
|
+
const { buildStateMarkdown } = await import("./doctor.js");
|
|
2215
|
+
await saveFile(resolveGsdRootFile(basePath, "STATE"), buildStateMarkdown(state));
|
|
2216
|
+
} catch (err) {
|
|
2217
|
+
logWarning("guided", `STATE.md rebuild failed: ${(err as Error).message}`);
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
// ── Deep planning mode kickoff ────────────────────────────────────────
|
|
2221
|
+
// When `planning_depth: deep` is set (e.g. via `/gsd new-project --deep`)
|
|
2222
|
+
// and any project-level stage gate is still pending, keep the user-question
|
|
2223
|
+
// stages in the foreground conversation. Auto-mode is resumed only after
|
|
2224
|
+
// the project interview artifacts exist, so questions do not look like
|
|
2225
|
+
// cancelled auto-mode runs.
|
|
2226
|
+
// Light mode and fully-completed deep projects fall through to the
|
|
2227
|
+
// standard wizard below.
|
|
2228
|
+
{
|
|
2229
|
+
const prefs = loadEffectiveGSDPreferences(basePath)?.preferences;
|
|
2230
|
+
const { shouldRunDeepProjectSetup } = await import("./auto-dispatch.js");
|
|
2231
|
+
if (shouldRunDeepProjectSetup(state, prefs, basePath)) {
|
|
2232
|
+
await startDeepProjectSetupForeground(ctx, pi, basePath, stepMode);
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
const planV2GateDecision = runPlanV2Gate(ctx, basePath, state);
|
|
2238
|
+
if (planV2GateDecision === "block") return;
|
|
2239
|
+
|
|
2240
|
+
if (!state.activeMilestone?.id) {
|
|
2241
|
+
// Guard: if a discuss session is already in flight, don't re-inject the prompt.
|
|
2242
|
+
// Both /gsd and /gsd auto reach this branch when no milestone exists yet.
|
|
2243
|
+
// Without this guard, every subsequent /gsd call overwrites the pending auto-start
|
|
2244
|
+
// and fires another dispatchWorkflow, resetting the conversation mid-interview.
|
|
2245
|
+
if (hasPendingAutoStart(basePath)) {
|
|
2246
|
+
// #3274: If /clear interrupted the discussion, the pending entry is stale.
|
|
2247
|
+
// Detect staleness: no manifest, no milestone CONTEXT artifact, AND entry is older than
|
|
2248
|
+
// 30s (avoids race between .set() and LLM writing first artifact).
|
|
2249
|
+
const entry = _getPendingAutoStart(basePath)!;
|
|
2250
|
+
const ageMs = Date.now() - (entry.createdAt || 0);
|
|
2251
|
+
const manifestExists = existsSync(join(gsdRoot(basePath), "DISCUSSION-MANIFEST.json"));
|
|
2252
|
+
const milestoneHasContext = !!resolveMilestoneFile(basePath, entry.milestoneId, "CONTEXT");
|
|
2253
|
+
const milestoneHasRoadmap = !!resolveMilestoneFile(basePath, entry.milestoneId, "ROADMAP");
|
|
2254
|
+
const milestoneRow = isDbAvailable() ? getMilestone(entry.milestoneId) : null;
|
|
2255
|
+
const discussPlanComplete = milestoneHasRoadmap && !!milestoneRow && milestoneRow.status !== "queued";
|
|
2256
|
+
if (discussPlanComplete) {
|
|
2257
|
+
// The discuss flow already completed, but pending auto-start cleanup handshake did not run.
|
|
2258
|
+
// Clear stale in-memory guard and continue through normal active-milestone routing.
|
|
2259
|
+
deletePendingAutoStart(basePath);
|
|
2260
|
+
} else if (!manifestExists && !milestoneHasContext && ageMs > 30_000) {
|
|
2261
|
+
// Stale entry from an interrupted discussion — clear and continue
|
|
2262
|
+
deletePendingAutoStart(basePath);
|
|
2263
|
+
} else {
|
|
2264
|
+
ctx.ui.notify("Discussion already in progress — answer the question above to continue.", "info");
|
|
2265
|
+
return;
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
const milestoneIds = findMilestoneIds(basePath);
|
|
2270
|
+
|
|
2271
|
+
// Sanity check (#456): if findMilestoneIds returns [] but the milestones
|
|
2272
|
+
// directory has contents, something went wrong (permissions, stale worktree
|
|
2273
|
+
// cwd, etc). Warn instead of silently starting a new-project flow.
|
|
2274
|
+
if (milestoneIds.length === 0) {
|
|
2275
|
+
const mDir = milestonesDir(basePath);
|
|
2276
|
+
if (existsSync(mDir)) {
|
|
2277
|
+
try {
|
|
2278
|
+
const entries = clearEmptyLegacyDeepSetupPseudoMilestones(basePath, readdirSync(mDir));
|
|
2279
|
+
if (entries.length > 0) {
|
|
2280
|
+
ctx.ui.notify(
|
|
2281
|
+
`Milestone directory has ${entries.length} entries but none were recognized as milestones. ` +
|
|
2282
|
+
`This may indicate a corrupted state or wrong working directory. Run \`/gsd doctor\` to diagnose.`,
|
|
2283
|
+
"warning",
|
|
2284
|
+
);
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
} catch (e) { logWarning("guided", `directory read failed: ${(e as Error).message}`); }
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
2292
|
+
const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
|
|
2293
|
+
const isFirst = milestoneIds.length === 0;
|
|
2294
|
+
|
|
2295
|
+
if (isFirst) {
|
|
2296
|
+
// First ever — skip wizard, just ask directly
|
|
2297
|
+
ctx.ui.setStatus("gsd-step", "New Milestone · answer the questions above to plan");
|
|
2298
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
|
|
2299
|
+
await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
|
|
2300
|
+
`New project, milestone ${nextId}. Do NOT read or explore .gsd/ — it's empty scaffolding.`,
|
|
2301
|
+
basePath
|
|
2302
|
+
), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
2303
|
+
} else {
|
|
2304
|
+
if (isNonInteractiveContext(ctx)) {
|
|
2305
|
+
ctx.ui.notify(`Auto-mode stopped — ${state.nextAction || "No active milestone."}`, "info");
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
const choice = await showNextAction(ctx, {
|
|
2309
|
+
title: "GSD — Get Shit Done",
|
|
2310
|
+
summary: ["No active milestone."],
|
|
2311
|
+
actions: [
|
|
2312
|
+
{
|
|
2313
|
+
id: "quick_task",
|
|
2314
|
+
label: "Quick task",
|
|
2315
|
+
description: "For small bounded work, run /gsd quick <task> or /gsd do <task>.",
|
|
2316
|
+
recommended: true,
|
|
2317
|
+
},
|
|
2318
|
+
{
|
|
2319
|
+
id: "new_milestone",
|
|
2320
|
+
label: "Create next milestone",
|
|
2321
|
+
description: "Define a larger body of work with planning artifacts.",
|
|
2322
|
+
},
|
|
2323
|
+
],
|
|
2324
|
+
notYetMessage: "Run /gsd when ready.",
|
|
2325
|
+
});
|
|
2326
|
+
|
|
2327
|
+
if (choice === "quick_task") {
|
|
2328
|
+
await runQuickTaskChoice(ctx, pi);
|
|
2329
|
+
} else if (choice === "new_milestone") {
|
|
2330
|
+
ctx.ui.setStatus("gsd-step", "New Milestone · answer the questions above to plan");
|
|
2331
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
|
|
2332
|
+
await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
|
|
2333
|
+
`New milestone ${nextId}.`,
|
|
2334
|
+
basePath
|
|
2335
|
+
), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
const milestoneId = state.activeMilestone.id;
|
|
2342
|
+
const milestoneTitle = state.activeMilestone.title;
|
|
2343
|
+
|
|
2344
|
+
if (planV2GateDecision === "recover-missing-context") {
|
|
2345
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId, step: stepMode });
|
|
2346
|
+
await dispatchWorkflow(
|
|
2347
|
+
pi,
|
|
2348
|
+
await buildDiscussMilestonePrompt(
|
|
2349
|
+
milestoneId,
|
|
2350
|
+
milestoneTitle,
|
|
2351
|
+
basePath,
|
|
2352
|
+
getStructuredQuestionsAvailability(pi, ctx),
|
|
2353
|
+
),
|
|
2354
|
+
"gsd-discuss",
|
|
2355
|
+
ctx,
|
|
2356
|
+
"discuss-milestone",
|
|
2357
|
+
{ basePath },
|
|
2358
|
+
);
|
|
2359
|
+
return;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
// ── All milestones complete → New milestone ──────────────────────────
|
|
2363
|
+
if (state.phase === "complete") {
|
|
2364
|
+
if (isNonInteractiveContext(ctx)) {
|
|
2365
|
+
ctx.ui.notify("Auto-mode stopped — all milestones complete.", "info");
|
|
2366
|
+
return;
|
|
2367
|
+
}
|
|
2368
|
+
const choice = await showNextAction(ctx, {
|
|
2369
|
+
title: `GSD — ${milestoneId}: ${milestoneTitle}`,
|
|
2370
|
+
summary: ["All milestones complete."],
|
|
2371
|
+
actions: [
|
|
2372
|
+
{
|
|
2373
|
+
id: "quick_task",
|
|
2374
|
+
label: "Quick task",
|
|
2375
|
+
description: "Do a small bounded task without opening a milestone.",
|
|
2376
|
+
recommended: true,
|
|
2377
|
+
},
|
|
2378
|
+
{
|
|
2379
|
+
id: "new_milestone",
|
|
2380
|
+
label: "Start new milestone",
|
|
2381
|
+
description: "Define and plan the next milestone.",
|
|
2382
|
+
},
|
|
2383
|
+
{
|
|
2384
|
+
id: "status",
|
|
2385
|
+
label: "View status",
|
|
2386
|
+
description: "Review what was built.",
|
|
2387
|
+
},
|
|
2388
|
+
],
|
|
2389
|
+
notYetMessage: "Run /gsd when ready.",
|
|
2390
|
+
});
|
|
2391
|
+
|
|
2392
|
+
if (choice === "quick_task") {
|
|
2393
|
+
await runQuickTaskChoice(ctx, pi);
|
|
2394
|
+
} else if (choice === "new_milestone") {
|
|
2395
|
+
const milestoneIds = findMilestoneIds(basePath);
|
|
2396
|
+
const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
2397
|
+
const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
|
|
2398
|
+
|
|
2399
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
|
|
2400
|
+
await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
|
|
2401
|
+
`New milestone ${nextId}.`,
|
|
2402
|
+
basePath
|
|
2403
|
+
), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
2404
|
+
} else if (choice === "status") {
|
|
2405
|
+
const { fireStatusViaCommand } = await import("./commands.js");
|
|
2406
|
+
await fireStatusViaCommand(ctx);
|
|
2407
|
+
}
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
// ── Draft milestone — needs discussion before planning ────────────────
|
|
2412
|
+
if (state.phase === "needs-discussion") {
|
|
2413
|
+
const draftFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT-DRAFT");
|
|
2414
|
+
const draftContent = draftFile ? await loadFile(draftFile) : null;
|
|
2415
|
+
|
|
2416
|
+
const choice = await showNextAction(ctx, {
|
|
2417
|
+
title: `GSD — ${milestoneId}: ${milestoneTitle}`,
|
|
2418
|
+
summary: ["This milestone has a draft context from a prior discussion.", "It needs a dedicated discussion before auto-planning can begin."],
|
|
2419
|
+
actions: [
|
|
2420
|
+
{
|
|
2421
|
+
id: "discuss_draft",
|
|
2422
|
+
label: "Discuss from draft",
|
|
2423
|
+
description: "Continue where the prior discussion left off — seed material is loaded automatically.",
|
|
2424
|
+
recommended: true,
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
id: "discuss_fresh",
|
|
2428
|
+
label: "Start fresh discussion",
|
|
2429
|
+
description: "Discard the draft and start a new discussion from scratch.",
|
|
2430
|
+
},
|
|
2431
|
+
{
|
|
2432
|
+
id: "skip_milestone",
|
|
2433
|
+
label: "Skip — create new milestone",
|
|
2434
|
+
description: "Leave this milestone as-is and start something new.",
|
|
2435
|
+
},
|
|
2436
|
+
],
|
|
2437
|
+
notYetMessage: "Run /gsd when ready to discuss this milestone.",
|
|
2438
|
+
});
|
|
2439
|
+
|
|
2440
|
+
if (choice === "discuss_draft") {
|
|
2441
|
+
const discussMilestoneTemplates = inlineTemplate("context", "Context");
|
|
2442
|
+
const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
|
|
2443
|
+
const basePrompt = loadPrompt("guided-discuss-milestone", {
|
|
2444
|
+
workingDirectory: basePath,
|
|
2445
|
+
milestoneId, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
|
|
2446
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${milestoneId}): milestone context from discuss`),
|
|
2447
|
+
fastPathInstruction: "",
|
|
2448
|
+
});
|
|
2449
|
+
const seed = draftContent
|
|
2450
|
+
? `${basePrompt}\n\n## Prior Discussion (Draft Seed)\n\n${draftContent}`
|
|
2451
|
+
: basePrompt;
|
|
2452
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId, step: stepMode });
|
|
2453
|
+
await dispatchWorkflow(pi, seed, "gsd-discuss", ctx, "discuss-milestone", { basePath });
|
|
2454
|
+
} else if (choice === "discuss_fresh") {
|
|
2455
|
+
const discussMilestoneTemplates = inlineTemplate("context", "Context");
|
|
2456
|
+
const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
|
|
2457
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId, step: stepMode });
|
|
2458
|
+
await dispatchWorkflow(pi, loadPrompt("guided-discuss-milestone", {
|
|
2459
|
+
workingDirectory: basePath,
|
|
2460
|
+
milestoneId, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
|
|
2461
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${milestoneId}): milestone context from discuss`),
|
|
2462
|
+
fastPathInstruction: "",
|
|
2463
|
+
}), "gsd-discuss", ctx, "discuss-milestone", { basePath });
|
|
2464
|
+
} else if (choice === "skip_milestone") {
|
|
2465
|
+
const milestoneIds = findMilestoneIds(basePath);
|
|
2466
|
+
const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
2467
|
+
const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
|
|
2468
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
|
|
2469
|
+
await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
|
|
2470
|
+
`New milestone ${nextId}.`,
|
|
2471
|
+
basePath
|
|
2472
|
+
), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
2473
|
+
}
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
if (state.phase === "blocked") {
|
|
2478
|
+
const choice = await showNextAction(ctx, {
|
|
2479
|
+
title: `GSD — ${milestoneId}: ${milestoneTitle}`,
|
|
2480
|
+
summary: state.blockers.length > 0
|
|
2481
|
+
? state.blockers
|
|
2482
|
+
: [state.nextAction || "This milestone is blocked."],
|
|
2483
|
+
actions: [
|
|
2484
|
+
{
|
|
2485
|
+
id: "status",
|
|
2486
|
+
label: "View status",
|
|
2487
|
+
description: "Review the blocker and current milestone state.",
|
|
2488
|
+
recommended: true,
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
id: "park",
|
|
2492
|
+
label: "Park milestone",
|
|
2493
|
+
description: "Explicitly defer this milestone before starting other work.",
|
|
2494
|
+
},
|
|
2495
|
+
],
|
|
2496
|
+
notYetMessage: "Resolve the blocker, or park the milestone explicitly.",
|
|
2497
|
+
});
|
|
2498
|
+
|
|
2499
|
+
if (choice === "status") {
|
|
2500
|
+
const { fireStatusViaCommand } = await import("./commands.js");
|
|
2501
|
+
await fireStatusViaCommand(ctx);
|
|
2502
|
+
} else if (choice === "park") {
|
|
2503
|
+
const success = parkMilestone(basePath, milestoneId, "Validation attention deferred by user");
|
|
2504
|
+
ctx.ui.notify(
|
|
2505
|
+
success ? `Parked ${milestoneId}. Run /gsd unpark ${milestoneId} to reactivate.` : `Could not park ${milestoneId} — milestone not found.`,
|
|
2506
|
+
success ? "info" : "warning",
|
|
2507
|
+
);
|
|
2508
|
+
}
|
|
2509
|
+
return;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
// ── No active slice ──────────────────────────────────────────────────
|
|
2513
|
+
if (!state.activeSlice) {
|
|
2514
|
+
const roadmapFile = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
2515
|
+
const hasRoadmap = !!(roadmapFile && await loadFile(roadmapFile));
|
|
2516
|
+
|
|
2517
|
+
// A roadmap file with zero parseable slices (placeholder text) should be
|
|
2518
|
+
// treated the same as no roadmap — offer "Create roadmap" instead of "Go auto"
|
|
2519
|
+
// which would immediately get stuck in blocked state (#3441).
|
|
2520
|
+
let roadmapHasSlices = false;
|
|
2521
|
+
if (hasRoadmap) {
|
|
2522
|
+
const roadmapContent = await loadFile(roadmapFile!);
|
|
2523
|
+
if (roadmapContent) {
|
|
2524
|
+
roadmapHasSlices = _roadmapHasParseableSlicesForTest(roadmapContent);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
if (!hasRoadmap || !roadmapHasSlices) {
|
|
2529
|
+
// No roadmap → discuss or plan
|
|
2530
|
+
const contextFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT");
|
|
2531
|
+
const hasContext = !!(contextFile && await loadFile(contextFile));
|
|
2532
|
+
|
|
2533
|
+
const actions = [
|
|
2534
|
+
{
|
|
2535
|
+
id: "quick_task",
|
|
2536
|
+
label: "Quick task instead",
|
|
2537
|
+
description: "Use this when the work is small and should not become a milestone.",
|
|
2538
|
+
recommended: true,
|
|
2539
|
+
},
|
|
2540
|
+
{
|
|
2541
|
+
id: "plan",
|
|
2542
|
+
label: "Create roadmap",
|
|
2543
|
+
description: hasContext
|
|
2544
|
+
? "Context captured. Decompose into slices with a boundary map."
|
|
2545
|
+
: "Decompose the milestone into slices with a boundary map.",
|
|
2546
|
+
},
|
|
2547
|
+
...(!hasContext ? [{
|
|
2548
|
+
id: "discuss",
|
|
2549
|
+
label: "Discuss first",
|
|
2550
|
+
description: "Capture decisions on gray areas before planning.",
|
|
2551
|
+
}] : []),
|
|
2552
|
+
{
|
|
2553
|
+
id: "skip_milestone",
|
|
2554
|
+
label: "Skip — create new milestone",
|
|
2555
|
+
description: "Leave this milestone on disk and start a fresh one.",
|
|
2556
|
+
},
|
|
2557
|
+
{
|
|
2558
|
+
id: "discard_milestone",
|
|
2559
|
+
label: "Discard this milestone",
|
|
2560
|
+
description: "Delete the milestone directory and start over.",
|
|
2561
|
+
},
|
|
2562
|
+
];
|
|
2563
|
+
|
|
2564
|
+
const choice = await showNextAction(ctx, {
|
|
2565
|
+
title: `GSD — ${milestoneId}: ${milestoneTitle}`,
|
|
2566
|
+
summary: [hasContext ? "Context captured. Ready to create roadmap." : "New milestone — no roadmap yet."],
|
|
2567
|
+
actions,
|
|
2568
|
+
notYetMessage: "Run /gsd when ready.",
|
|
2569
|
+
});
|
|
2570
|
+
|
|
2571
|
+
if (choice === "quick_task") {
|
|
2572
|
+
await runQuickTaskChoice(ctx, pi);
|
|
2573
|
+
} else if (choice === "plan") {
|
|
2574
|
+
ctx.ui.setStatus("gsd-step", "Planning Milestone · decomposing into slices");
|
|
2575
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId, step: stepMode });
|
|
2576
|
+
await dispatchWorkflow(
|
|
2577
|
+
pi,
|
|
2578
|
+
await buildPlanMilestonePrompt(milestoneId, milestoneTitle, basePath),
|
|
2579
|
+
"gsd-run",
|
|
2580
|
+
ctx,
|
|
2581
|
+
"plan-milestone",
|
|
2582
|
+
{ basePath },
|
|
2583
|
+
);
|
|
2584
|
+
} else if (choice === "discuss") {
|
|
2585
|
+
const discussMilestoneTemplates = inlineTemplate("context", "Context");
|
|
2586
|
+
const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
|
|
2587
|
+
await dispatchWorkflow(pi, loadPrompt("guided-discuss-milestone", {
|
|
2588
|
+
workingDirectory: basePath,
|
|
2589
|
+
milestoneId, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
|
|
2590
|
+
commitInstruction: buildDocsCommitInstruction(`docs(${milestoneId}): milestone context from discuss`),
|
|
2591
|
+
fastPathInstruction: "",
|
|
2592
|
+
}), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
2593
|
+
} else if (choice === "skip_milestone") {
|
|
2594
|
+
const milestoneIds = findMilestoneIds(basePath);
|
|
2595
|
+
const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
2596
|
+
const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
|
|
2597
|
+
setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
|
|
2598
|
+
await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
|
|
2599
|
+
`New milestone ${nextId}.`,
|
|
2600
|
+
basePath
|
|
2601
|
+
), "gsd-run", ctx, "discuss-milestone", { basePath });
|
|
2602
|
+
} else if (choice === "discard_milestone") {
|
|
2603
|
+
const confirmed = await showConfirm(ctx, {
|
|
2604
|
+
title: "Discard milestone?",
|
|
2605
|
+
message: `This will permanently delete ${milestoneId} and all its contents.`,
|
|
2606
|
+
confirmLabel: "Discard",
|
|
2607
|
+
declineLabel: "Cancel",
|
|
2608
|
+
});
|
|
2609
|
+
if (confirmed) {
|
|
2610
|
+
discardMilestone(basePath, milestoneId);
|
|
2611
|
+
return showSmartEntry(ctx, pi, basePath, options);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
} else {
|
|
2615
|
+
// Roadmap exists — either blocked or ready for auto
|
|
2616
|
+
const actions = [
|
|
2617
|
+
{
|
|
2618
|
+
id: "auto",
|
|
2619
|
+
label: "Go auto",
|
|
2620
|
+
description: "Execute everything automatically until milestone complete.",
|
|
2621
|
+
recommended: true,
|
|
2622
|
+
},
|
|
2623
|
+
{
|
|
2624
|
+
id: "status",
|
|
2625
|
+
label: "View status",
|
|
2626
|
+
description: "See milestone progress and blockers.",
|
|
2627
|
+
},
|
|
2628
|
+
{
|
|
2629
|
+
id: "milestone_actions",
|
|
2630
|
+
label: "Milestone actions",
|
|
2631
|
+
description: "Park, discard, or skip this milestone.",
|
|
2632
|
+
},
|
|
2633
|
+
];
|
|
2634
|
+
|
|
2635
|
+
const choice = await showNextAction(ctx, {
|
|
2636
|
+
title: `GSD — ${milestoneId}: ${milestoneTitle}`,
|
|
2637
|
+
summary: ["Roadmap exists. Ready to execute."],
|
|
2638
|
+
actions,
|
|
2639
|
+
notYetMessage: "Run /gsd status for details.",
|
|
2640
|
+
});
|
|
2641
|
+
|
|
2642
|
+
if (choice === "auto") {
|
|
2643
|
+
startAutoDetached(ctx, pi, basePath, false);
|
|
2644
|
+
} else if (choice === "status") {
|
|
2645
|
+
const { fireStatusViaCommand } = await import("./commands.js");
|
|
2646
|
+
await fireStatusViaCommand(ctx);
|
|
2647
|
+
} else if (choice === "milestone_actions") {
|
|
2648
|
+
const acted = await handleMilestoneActions(ctx, pi, basePath, milestoneId, milestoneTitle, options);
|
|
2649
|
+
if (acted) return showSmartEntry(ctx, pi, basePath, options);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
return;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
const sliceId = state.activeSlice.id;
|
|
2656
|
+
const sliceTitle = state.activeSlice.title;
|
|
2657
|
+
|
|
2658
|
+
// ── Slice needs planning ─────────────────────────────────────────────
|
|
2659
|
+
if (state.phase === "planning") {
|
|
2660
|
+
const contextFile = resolveSliceFile(basePath, milestoneId, sliceId, "CONTEXT");
|
|
2661
|
+
const researchFile = resolveSliceFile(basePath, milestoneId, sliceId, "RESEARCH");
|
|
2662
|
+
const hasContext = !!(contextFile && await loadFile(contextFile));
|
|
2663
|
+
const hasResearch = !!(researchFile && await loadFile(researchFile));
|
|
2664
|
+
|
|
2665
|
+
const actions = [
|
|
2666
|
+
{
|
|
2667
|
+
id: "plan",
|
|
2668
|
+
label: `Plan ${sliceId}`,
|
|
2669
|
+
description: `Decompose "${sliceTitle}" into tasks with must-haves.`,
|
|
2670
|
+
recommended: true,
|
|
2671
|
+
},
|
|
2672
|
+
...(!hasContext ? [{
|
|
2673
|
+
id: "discuss",
|
|
2674
|
+
label: `Discuss ${sliceId} first`,
|
|
2675
|
+
description: "Capture context and decisions for this slice.",
|
|
2676
|
+
}] : []),
|
|
2677
|
+
...(!hasResearch ? [{
|
|
2678
|
+
id: "research",
|
|
2679
|
+
label: `Research ${sliceId} first`,
|
|
2680
|
+
description: "Scout codebase and relevant docs.",
|
|
2681
|
+
}] : []),
|
|
2682
|
+
{
|
|
2683
|
+
id: "status",
|
|
2684
|
+
label: "View status",
|
|
2685
|
+
description: "See milestone progress.",
|
|
2686
|
+
},
|
|
2687
|
+
{
|
|
2688
|
+
id: "milestone_actions",
|
|
2689
|
+
label: "Milestone actions",
|
|
2690
|
+
description: "Park, discard, or skip this milestone.",
|
|
2691
|
+
},
|
|
2692
|
+
];
|
|
2693
|
+
|
|
2694
|
+
const summaryParts = [];
|
|
2695
|
+
if (hasContext) summaryParts.push("context ✓");
|
|
2696
|
+
if (hasResearch) summaryParts.push("research ✓");
|
|
2697
|
+
const summaryLine = summaryParts.length > 0
|
|
2698
|
+
? `${sliceId}: ${sliceTitle} (${summaryParts.join(", ")})`
|
|
2699
|
+
: `${sliceId}: ${sliceTitle} — ready for planning.`;
|
|
2700
|
+
|
|
2701
|
+
const choice = await showNextAction(ctx, {
|
|
2702
|
+
title: `GSD — ${milestoneId} / ${sliceId}: ${sliceTitle}`,
|
|
2703
|
+
summary: [summaryLine],
|
|
2704
|
+
actions,
|
|
2705
|
+
notYetMessage: "Run /gsd when ready.",
|
|
2706
|
+
});
|
|
2707
|
+
|
|
2708
|
+
if (choice === "plan") {
|
|
2709
|
+
ctx.ui.setStatus("gsd-step", "Slice Planning · answer the questions above");
|
|
2710
|
+
await dispatchWorkflow(
|
|
2711
|
+
pi,
|
|
2712
|
+
await buildPlanSlicePrompt(milestoneId, milestoneTitle, sliceId, sliceTitle, basePath),
|
|
2713
|
+
"gsd-run",
|
|
2714
|
+
ctx,
|
|
2715
|
+
"plan-slice",
|
|
2716
|
+
{ basePath },
|
|
2717
|
+
);
|
|
2718
|
+
} else if (choice === "discuss") {
|
|
2719
|
+
const sqAvail = getStructuredQuestionsAvailability(pi, ctx);
|
|
2720
|
+
await dispatchWorkflow(pi, await buildDiscussSlicePrompt(milestoneId, sliceId, sliceTitle, basePath, { rediscuss: hasContext, structuredQuestionsAvailable: sqAvail }), "gsd-run", ctx, "discuss-slice", { basePath });
|
|
2721
|
+
} else if (choice === "research") {
|
|
2722
|
+
const researchTemplates = inlineTemplate("research", "Research");
|
|
2723
|
+
await dispatchWorkflow(pi, loadPrompt("guided-research-slice", {
|
|
2724
|
+
milestoneId,
|
|
2725
|
+
sliceId,
|
|
2726
|
+
sliceTitle,
|
|
2727
|
+
inlinedTemplates: researchTemplates,
|
|
2728
|
+
skillActivation: buildSkillActivationBlock({
|
|
2729
|
+
base: basePath,
|
|
2730
|
+
milestoneId,
|
|
2731
|
+
sliceId,
|
|
2732
|
+
sliceTitle,
|
|
2733
|
+
extraContext: [researchTemplates],
|
|
2734
|
+
}),
|
|
2735
|
+
}), "gsd-run", ctx, "research-slice", { basePath });
|
|
2736
|
+
} else if (choice === "status") {
|
|
2737
|
+
const { fireStatusViaCommand } = await import("./commands.js");
|
|
2738
|
+
await fireStatusViaCommand(ctx);
|
|
2739
|
+
} else if (choice === "milestone_actions") {
|
|
2740
|
+
const acted = await handleMilestoneActions(ctx, pi, basePath, milestoneId, milestoneTitle, options);
|
|
2741
|
+
if (acted) return showSmartEntry(ctx, pi, basePath, options);
|
|
2742
|
+
}
|
|
2743
|
+
return;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
// ── All tasks done → Complete slice ──────────────────────────────────
|
|
2747
|
+
if (state.phase === "summarizing") {
|
|
2748
|
+
const choice = await showNextAction(ctx, {
|
|
2749
|
+
title: `GSD — ${milestoneId} / ${sliceId}: ${sliceTitle}`,
|
|
2750
|
+
summary: ["All tasks complete. Ready for slice summary."],
|
|
2751
|
+
actions: [
|
|
2752
|
+
{
|
|
2753
|
+
id: "complete",
|
|
2754
|
+
label: `Complete ${sliceId}`,
|
|
2755
|
+
description: "Write slice summary, UAT, mark done, and squash-merge to main.",
|
|
2756
|
+
recommended: true,
|
|
2757
|
+
},
|
|
2758
|
+
{
|
|
2759
|
+
id: "status",
|
|
2760
|
+
label: "View status",
|
|
2761
|
+
description: "Review tasks before completing.",
|
|
2762
|
+
},
|
|
2763
|
+
{
|
|
2764
|
+
id: "milestone_actions",
|
|
2765
|
+
label: "Milestone actions",
|
|
2766
|
+
description: "Park, discard, or skip this milestone.",
|
|
2767
|
+
},
|
|
2768
|
+
],
|
|
2769
|
+
notYetMessage: "Run /gsd when ready.",
|
|
2770
|
+
});
|
|
2771
|
+
|
|
2772
|
+
if (choice === "complete") {
|
|
2773
|
+
ctx.ui.setStatus("gsd-step", "Completing Slice · review changes above");
|
|
2774
|
+
await dispatchWorkflow(
|
|
2775
|
+
pi,
|
|
2776
|
+
await buildCompleteSlicePrompt(milestoneId, milestoneTitle, sliceId, sliceTitle, basePath),
|
|
2777
|
+
"gsd-run",
|
|
2778
|
+
ctx,
|
|
2779
|
+
"complete-slice",
|
|
2780
|
+
{ basePath },
|
|
2781
|
+
);
|
|
2782
|
+
} else if (choice === "status") {
|
|
2783
|
+
const { fireStatusViaCommand } = await import("./commands.js");
|
|
2784
|
+
await fireStatusViaCommand(ctx);
|
|
2785
|
+
} else if (choice === "milestone_actions") {
|
|
2786
|
+
const acted = await handleMilestoneActions(ctx, pi, basePath, milestoneId, milestoneTitle, options);
|
|
2787
|
+
if (acted) return showSmartEntry(ctx, pi, basePath, options);
|
|
2788
|
+
}
|
|
2789
|
+
return;
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
// ── Active task → Execute ────────────────────────────────────────────
|
|
2793
|
+
if (state.activeTask) {
|
|
2794
|
+
const taskId = state.activeTask.id;
|
|
2795
|
+
const taskTitle = state.activeTask.title;
|
|
2796
|
+
|
|
2797
|
+
const continueFile = resolveSliceFile(basePath, milestoneId, sliceId, "CONTINUE");
|
|
2798
|
+
const sDir = resolveSlicePath(basePath, milestoneId, sliceId);
|
|
2799
|
+
const hasInterrupted = !!(continueFile && await loadFile(continueFile)) ||
|
|
2800
|
+
!!(sDir && await loadFile(join(sDir, "continue.md")));
|
|
2801
|
+
|
|
2802
|
+
const choice = await showNextAction(ctx, {
|
|
2803
|
+
title: `GSD — ${milestoneId} / ${sliceId}: ${sliceTitle}`,
|
|
2804
|
+
summary: [
|
|
2805
|
+
hasInterrupted
|
|
2806
|
+
? `Resuming: ${taskId} — ${taskTitle}`
|
|
2807
|
+
: `Next: ${taskId} — ${taskTitle}`,
|
|
2808
|
+
],
|
|
2809
|
+
actions: [
|
|
2810
|
+
{
|
|
2811
|
+
id: "execute",
|
|
2812
|
+
label: hasInterrupted ? `Resume ${taskId}` : `Execute ${taskId}`,
|
|
2813
|
+
description: hasInterrupted
|
|
2814
|
+
? "Continue from where you left off."
|
|
2815
|
+
: `Start working on "${taskTitle}".`,
|
|
2816
|
+
recommended: true,
|
|
2817
|
+
},
|
|
2818
|
+
{
|
|
2819
|
+
id: "auto",
|
|
2820
|
+
label: "Go auto",
|
|
2821
|
+
description: "Execute this and all remaining tasks automatically.",
|
|
2822
|
+
},
|
|
2823
|
+
{
|
|
2824
|
+
id: "status",
|
|
2825
|
+
label: "View status",
|
|
2826
|
+
description: "See slice progress before starting.",
|
|
2827
|
+
},
|
|
2828
|
+
{
|
|
2829
|
+
id: "milestone_actions",
|
|
2830
|
+
label: "Milestone actions",
|
|
2831
|
+
description: "Park, discard, or skip this milestone.",
|
|
2832
|
+
},
|
|
2833
|
+
],
|
|
2834
|
+
notYetMessage: "Run /gsd when ready.",
|
|
2835
|
+
});
|
|
2836
|
+
|
|
2837
|
+
if (choice === "not_yet") return;
|
|
2838
|
+
|
|
2839
|
+
const route = resolveActiveTaskChoiceRoute({
|
|
2840
|
+
choice: choice as ActiveTaskChoice,
|
|
2841
|
+
isolationMode: getIsolationMode(basePath),
|
|
2842
|
+
milestoneId,
|
|
2843
|
+
});
|
|
2844
|
+
|
|
2845
|
+
if (route.kind === "auto-bootstrap") {
|
|
2846
|
+
startAutoDetached(ctx, pi, basePath, route.verboseMode, route.options);
|
|
2847
|
+
return;
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
if (route.kind === "guided-dispatch") {
|
|
2851
|
+
ctx.ui.setStatus("gsd-step", "Executing Task · follow progress above");
|
|
2852
|
+
if (hasInterrupted) {
|
|
2853
|
+
await dispatchWorkflow(pi, loadPrompt("guided-resume-task", {
|
|
2854
|
+
milestoneId,
|
|
2855
|
+
sliceId,
|
|
2856
|
+
skillActivation: buildSkillActivationBlock({
|
|
2857
|
+
base: basePath,
|
|
2858
|
+
milestoneId,
|
|
2859
|
+
sliceId,
|
|
2860
|
+
taskId,
|
|
2861
|
+
taskTitle,
|
|
2862
|
+
}),
|
|
2863
|
+
}), "gsd-run", ctx, "execute-task", { basePath });
|
|
2864
|
+
} else {
|
|
2865
|
+
await dispatchWorkflow(
|
|
2866
|
+
pi,
|
|
2867
|
+
await buildExecuteTaskPrompt(milestoneId, sliceId, sliceTitle, taskId, taskTitle, basePath),
|
|
2868
|
+
"gsd-run",
|
|
2869
|
+
ctx,
|
|
2870
|
+
"execute-task",
|
|
2871
|
+
{ basePath },
|
|
2872
|
+
);
|
|
2873
|
+
}
|
|
2874
|
+
} else if (route.kind === "status") {
|
|
2875
|
+
const { fireStatusViaCommand } = await import("./commands.js");
|
|
2876
|
+
await fireStatusViaCommand(ctx);
|
|
2877
|
+
} else if (route.kind === "milestone-actions") {
|
|
2878
|
+
const acted = await handleMilestoneActions(ctx, pi, basePath, milestoneId, milestoneTitle, options);
|
|
2879
|
+
if (acted) return showSmartEntry(ctx, pi, basePath, options);
|
|
2880
|
+
}
|
|
2881
|
+
return;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
// ── Fallback: show status ────────────────────────────────────────────
|
|
2885
|
+
const { fireStatusViaCommand } = await import("./commands.js");
|
|
2886
|
+
await fireStatusViaCommand(ctx);
|
|
2887
|
+
}
|