gsd-pi 2.76.0 → 2.77.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/README.md +45 -25
- package/dist/claude-cli-check.js +32 -3
- package/dist/mcp-server.d.ts +7 -0
- package/dist/mcp-server.js +35 -1
- package/dist/onboarding.js +45 -0
- package/dist/resource-loader.d.ts +1 -1
- package/dist/resource-loader.js +2 -8
- package/dist/resources/agents/researcher.md +1 -1
- package/dist/resources/extensions/claude-code-cli/readiness.js +31 -8
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +77 -17
- package/dist/resources/extensions/gsd/auto/loop.js +9 -0
- package/dist/resources/extensions/gsd/auto/phases.js +104 -11
- package/dist/resources/extensions/gsd/auto/run-unit.js +38 -2
- package/dist/resources/extensions/gsd/auto/session.js +22 -1
- package/dist/resources/extensions/gsd/auto-dispatch.js +16 -3
- package/dist/resources/extensions/gsd/auto-model-selection.js +53 -16
- package/dist/resources/extensions/gsd/auto-post-unit.js +25 -2
- package/dist/resources/extensions/gsd/auto-prompts.js +14 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +32 -1
- package/dist/resources/extensions/gsd/auto-start.js +58 -57
- package/dist/resources/extensions/gsd/auto-verification.js +33 -0
- package/dist/resources/extensions/gsd/auto-worktree.js +51 -53
- package/dist/resources/extensions/gsd/auto.js +70 -28
- package/dist/resources/extensions/gsd/blocked-models.js +68 -0
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +93 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +39 -9
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +93 -0
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +3 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +12 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +52 -6
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +84 -23
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +34 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +93 -0
- package/dist/resources/extensions/gsd/commands-extract-learnings.js +54 -89
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +968 -23
- package/dist/resources/extensions/gsd/compaction-snapshot.js +121 -0
- package/dist/resources/extensions/gsd/complexity-classifier.js +5 -3
- package/dist/resources/extensions/gsd/db-writer.js +88 -16
- package/dist/resources/extensions/gsd/doctor-git-checks.js +23 -29
- package/dist/resources/extensions/gsd/doctor-providers.js +51 -5
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +1 -0
- package/dist/resources/extensions/gsd/error-classifier.js +31 -3
- package/dist/resources/extensions/gsd/exec-history.js +120 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +258 -0
- package/dist/resources/extensions/gsd/gitignore.js +1 -0
- package/dist/resources/extensions/gsd/gsd-db.js +168 -23
- package/dist/resources/extensions/gsd/guided-flow.js +190 -1
- package/dist/resources/extensions/gsd/health-widget.js +4 -1
- package/dist/resources/extensions/gsd/hook-emitter.js +108 -0
- package/dist/resources/extensions/gsd/init-wizard.js +15 -1
- package/dist/resources/extensions/gsd/key-manager.js +28 -0
- package/dist/resources/extensions/gsd/memory-backfill.js +126 -0
- package/dist/resources/extensions/gsd/memory-store.js +19 -0
- package/dist/resources/extensions/gsd/model-router.js +36 -3
- package/dist/resources/extensions/gsd/pre-execution-checks.js +44 -9
- package/dist/resources/extensions/gsd/preferences-types.js +9 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +83 -0
- package/dist/resources/extensions/gsd/preferences.js +17 -17
- package/dist/resources/extensions/gsd/prompt-loader.js +22 -7
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/debug-diagnose.md +2 -0
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -0
- package/dist/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/dist/resources/extensions/gsd/prompts/execute-task.md +3 -2
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +96 -0
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +13 -5
- package/dist/resources/extensions/gsd/safety/safety-harness.js +5 -1
- package/dist/resources/extensions/gsd/state.js +43 -4
- package/dist/resources/extensions/gsd/token-counter.js +22 -5
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +16 -10
- package/dist/resources/extensions/gsd/tools/exec-search-tool.js +59 -0
- package/dist/resources/extensions/gsd/tools/exec-tool.js +126 -0
- package/dist/resources/extensions/gsd/tools/memory-tools.js +26 -1
- package/dist/resources/extensions/gsd/tools/resume-tool.js +23 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +20 -3
- package/dist/resources/extensions/gsd/workflow-mcp.js +3 -0
- package/dist/resources/extensions/gsd/workflow-templates/spike.md +6 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +50 -10
- package/dist/resources/extensions/search-the-web/command-search-provider.js +5 -4
- package/dist/resources/extensions/search-the-web/native-search.js +45 -13
- package/dist/resources/skills/api-design/SKILL.md +190 -0
- package/dist/resources/skills/create-mcp-server/SKILL.md +121 -0
- package/dist/resources/skills/decompose-into-slices/SKILL.md +139 -0
- package/dist/resources/skills/dependency-upgrade/SKILL.md +158 -0
- package/dist/resources/skills/design-an-interface/SKILL.md +102 -0
- package/dist/resources/skills/forensics/SKILL.md +153 -0
- package/dist/resources/skills/grill-me/SKILL.md +93 -0
- package/dist/resources/skills/handoff/SKILL.md +121 -0
- package/dist/resources/skills/observability/SKILL.md +174 -0
- package/dist/resources/skills/security-review/SKILL.md +181 -0
- package/dist/resources/skills/spike-wrap-up/SKILL.md +138 -0
- package/dist/resources/skills/tdd/SKILL.md +112 -0
- package/dist/resources/skills/verify-before-complete/SKILL.md +98 -0
- package/dist/resources/skills/write-docs/SKILL.md +82 -0
- package/dist/resources/skills/write-milestone-brief/SKILL.md +135 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +10 -10
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
- package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/dist/welcome-screen.js +6 -1
- package/dist/wizard.js +2 -0
- package/package.json +1 -1
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/remote-questions.d.ts +45 -0
- package/packages/mcp-server/dist/remote-questions.d.ts.map +1 -0
- package/packages/mcp-server/dist/remote-questions.js +732 -0
- package/packages/mcp-server/dist/remote-questions.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts +7 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +70 -8
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/session-manager.d.ts +14 -0
- package/packages/mcp-server/dist/session-manager.d.ts.map +1 -1
- package/packages/mcp-server/dist/session-manager.js +49 -1
- package/packages/mcp-server/dist/session-manager.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +163 -25
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +4 -3
- package/packages/mcp-server/src/mcp-server.test.ts +67 -0
- package/packages/mcp-server/src/remote-questions.test.ts +294 -0
- package/packages/mcp-server/src/remote-questions.ts +916 -0
- package/packages/mcp-server/src/server.ts +89 -14
- package/packages/mcp-server/src/session-manager.ts +43 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +146 -1
- package/packages/mcp-server/src/workflow-tools.ts +215 -43
- package/packages/mcp-server/tsconfig.test.json +19 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +12 -0
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/types.d.ts +30 -0
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/types.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +14 -0
- package/packages/pi-agent-core/src/types.ts +34 -0
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/models/custom.d.ts +38 -0
- package/packages/pi-ai/dist/models/custom.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/custom.js +41 -0
- package/packages/pi-ai/dist/models/custom.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js +13 -0
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +27 -4
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +13 -4
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js +80 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +60 -15
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.d.ts +10 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +16 -1
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/think-tag-parser.d.ts +17 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.js +75 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.js.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.js +41 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +12 -2
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +164 -14
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +15 -3
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js +67 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +16 -3
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js +67 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js +289 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js.map +1 -0
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/models/custom.ts +42 -0
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +1 -1
- package/packages/pi-ai/src/providers/anthropic-bearer-auth.test.ts +26 -0
- package/packages/pi-ai/src/providers/anthropic-shared.ts +26 -5
- package/packages/pi-ai/src/providers/anthropic.ts +15 -4
- package/packages/pi-ai/src/providers/minimax-tool-name.test.ts +98 -0
- package/packages/pi-ai/src/providers/openai-completions.ts +57 -16
- package/packages/pi-ai/src/providers/simple-options.ts +17 -1
- 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/utils/oauth/github-copilot.test.ts +200 -23
- package/packages/pi-ai/src/utils/oauth/github-copilot.ts +12 -2
- package/packages/pi-ai/src/utils/oauth/google-antigravity.test.ts +84 -0
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +15 -5
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.test.ts +84 -0
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +16 -5
- package/packages/pi-ai/src/utils/oauth/oauth-providers.test.ts +363 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +3 -2
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +32 -2
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +4 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +35 -2
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +233 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +205 -2
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts +53 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.js +337 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js +234 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.d.ts +3 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.js +92 -12
- package/packages/pi-coding-agent/dist/core/model-discovery.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.test.js +16 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js +40 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.js +203 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-discovery.test.js +61 -1
- package/packages/pi-coding-agent/dist/core/model-registry-discovery.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +5 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +90 -10
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js +49 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js +67 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +10 -6
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js +45 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +55 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +5 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +13 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +7 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +29 -21
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +13 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +3 -2
- package/packages/pi-coding-agent/src/core/agent-session.ts +38 -2
- package/packages/pi-coding-agent/src/core/extensions/index.ts +16 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +5 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +351 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +258 -0
- package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +269 -0
- package/packages/pi-coding-agent/src/core/hooks-runner.ts +460 -0
- package/packages/pi-coding-agent/src/core/index.ts +10 -0
- package/packages/pi-coding-agent/src/core/model-discovery.test.ts +19 -0
- package/packages/pi-coding-agent/src/core/model-discovery.ts +99 -12
- package/packages/pi-coding-agent/src/core/model-registry-auth-header.test.ts +44 -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 +75 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +102 -10
- 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/session-manager.test.ts +65 -1
- package/packages/pi-coding-agent/src/core/session-manager.ts +10 -6
- package/packages/pi-coding-agent/src/core/settings-manager.ts +57 -0
- package/packages/pi-coding-agent/src/index.ts +16 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +6 -6
- package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +16 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +36 -22
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +13 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/pkg/package.json +1 -1
- package/scripts/link-workspace-packages.cjs +1 -0
- package/src/resources/agents/researcher.md +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +32 -8
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +78 -17
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +149 -5
- package/src/resources/extensions/gsd/auto/loop-deps.ts +14 -0
- package/src/resources/extensions/gsd/auto/loop.ts +9 -0
- package/src/resources/extensions/gsd/auto/phases.ts +131 -10
- package/src/resources/extensions/gsd/auto/run-unit.ts +40 -2
- package/src/resources/extensions/gsd/auto/session.ts +35 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +16 -3
- package/src/resources/extensions/gsd/auto-model-selection.ts +71 -15
- package/src/resources/extensions/gsd/auto-post-unit.ts +29 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +28 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +26 -1
- package/src/resources/extensions/gsd/auto-start.ts +60 -68
- package/src/resources/extensions/gsd/auto-verification.ts +33 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +62 -63
- package/src/resources/extensions/gsd/auto.ts +73 -28
- package/src/resources/extensions/gsd/blocked-models.ts +98 -0
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +120 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +40 -9
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +109 -0
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +5 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +15 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +54 -6
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +89 -26
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +35 -2
- package/src/resources/extensions/gsd/clean-root-preflight.ts +111 -0
- package/src/resources/extensions/gsd/commands-extract-learnings.ts +55 -90
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +898 -32
- package/src/resources/extensions/gsd/compaction-snapshot.ts +165 -0
- package/src/resources/extensions/gsd/complexity-classifier.ts +5 -3
- package/src/resources/extensions/gsd/db-writer.ts +88 -17
- package/src/resources/extensions/gsd/doctor-git-checks.ts +23 -27
- package/src/resources/extensions/gsd/doctor-providers.ts +59 -6
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +2 -0
- package/src/resources/extensions/gsd/error-classifier.ts +36 -3
- package/src/resources/extensions/gsd/exec-history.ts +153 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +326 -0
- package/src/resources/extensions/gsd/gitignore.ts +1 -1
- package/src/resources/extensions/gsd/gsd-db.ts +186 -23
- package/src/resources/extensions/gsd/guided-flow.ts +222 -1
- package/src/resources/extensions/gsd/health-widget.ts +3 -1
- package/src/resources/extensions/gsd/hook-emitter.ts +188 -0
- package/src/resources/extensions/gsd/init-wizard.ts +15 -1
- package/src/resources/extensions/gsd/journal.ts +2 -1
- package/src/resources/extensions/gsd/key-manager.ts +28 -0
- package/src/resources/extensions/gsd/memory-backfill.ts +140 -0
- package/src/resources/extensions/gsd/memory-store.ts +26 -0
- package/src/resources/extensions/gsd/model-router.ts +42 -1
- package/src/resources/extensions/gsd/pre-execution-checks.ts +46 -10
- package/src/resources/extensions/gsd/preferences-types.ts +46 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +79 -0
- package/src/resources/extensions/gsd/preferences.ts +17 -17
- package/src/resources/extensions/gsd/prompt-loader.ts +30 -7
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/debug-diagnose.md +2 -0
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -0
- package/src/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/src/resources/extensions/gsd/prompts/execute-task.md +3 -2
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +119 -0
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +17 -4
- package/src/resources/extensions/gsd/safety/safety-harness.ts +9 -0
- package/src/resources/extensions/gsd/state.ts +45 -4
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +188 -2
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +95 -1
- package/src/resources/extensions/gsd/tests/auto-paused-session-validation.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +141 -0
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +33 -3
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/blocked-models.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/bundled-skill-triggers.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +68 -66
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +61 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complexity-classifier.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +8 -4
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +148 -3
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +306 -1
- package/src/resources/extensions/gsd/tests/escalation.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +237 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +210 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +40 -9
- package/src/resources/extensions/gsd/tests/freeform-decisions.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +447 -1
- package/src/resources/extensions/gsd/tests/init-wizard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git-symlink-cwd.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/integration/gitignore-tracked-gsd.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/issue-4540-regressions.test.ts +288 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/load-memory-block.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/plan-gate-failed-doctor-heal-hint.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/pre-exec-gate-loop.test.ts +272 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +356 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/prompt-loader-extension-dir.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +103 -4
- package/src/resources/extensions/gsd/tests/ready-phrase-no-files-4573.test.ts +388 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +205 -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/session-start-footer.test.ts +32 -40
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/token-counter.test.ts +105 -1
- package/src/resources/extensions/gsd/tests/tool-compatibility.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +65 -2
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +78 -5
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +3 -1
- package/src/resources/extensions/gsd/token-counter.ts +22 -5
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +15 -9
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +81 -0
- package/src/resources/extensions/gsd/tools/exec-tool.ts +183 -0
- package/src/resources/extensions/gsd/tools/memory-tools.ts +31 -1
- package/src/resources/extensions/gsd/tools/resume-tool.ts +40 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +26 -3
- package/src/resources/extensions/gsd/workflow-logger.ts +4 -1
- package/src/resources/extensions/gsd/workflow-mcp.ts +3 -0
- package/src/resources/extensions/gsd/workflow-templates/spike.md +6 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +54 -9
- package/src/resources/extensions/search-the-web/command-search-provider.ts +5 -4
- package/src/resources/extensions/search-the-web/native-search.ts +48 -12
- package/src/resources/skills/api-design/SKILL.md +190 -0
- package/src/resources/skills/create-mcp-server/SKILL.md +121 -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/grill-me/SKILL.md +93 -0
- package/src/resources/skills/handoff/SKILL.md +121 -0
- package/src/resources/skills/observability/SKILL.md +174 -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/verify-before-complete/SKILL.md +98 -0
- package/src/resources/skills/write-docs/SKILL.md +82 -0
- package/src/resources/skills/write-milestone-brief/SKILL.md +135 -0
- /package/dist/web/standalone/.next/static/{ssX7BLv3Dw9Fb4CtrCGeR → pV-mPo7rYGb5JBC09C8GG}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ssX7BLv3Dw9Fb4CtrCGeR → pV-mPo7rYGb5JBC09C8GG}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pre-exec-gate-loop.test.ts — Regression tests for #4551.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that when a pre-execution gate fails on a plan-slice unit:
|
|
5
|
+
* 1. `s.lastPreExecFailure` is populated on the AutoSession with the blocking
|
|
6
|
+
* findings and a verdict excerpt.
|
|
7
|
+
* 2. The `planning → plan-slice` dispatch rule reads that field and injects a
|
|
8
|
+
* "Fix these specific issues" section into the prompt.
|
|
9
|
+
* 3. The field is cleared (consumed) after the prompt is built so that stale
|
|
10
|
+
* context does not bleed into an unrelated future plan-slice run.
|
|
11
|
+
* 4. When the failure belongs to a *different* unit ID, the dispatch rule
|
|
12
|
+
* does NOT inject the stale context into the prompt.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import test from "node:test";
|
|
16
|
+
import assert from "node:assert/strict";
|
|
17
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import { tmpdir } from "node:os";
|
|
20
|
+
|
|
21
|
+
import { AutoSession } from "../auto/session.ts";
|
|
22
|
+
import { resolveDispatch } from "../auto-dispatch.ts";
|
|
23
|
+
import type { DispatchContext } from "../auto-dispatch.ts";
|
|
24
|
+
import { buildPlanSlicePrompt } from "../auto-prompts.ts";
|
|
25
|
+
import {
|
|
26
|
+
openDatabase,
|
|
27
|
+
closeDatabase,
|
|
28
|
+
insertMilestone,
|
|
29
|
+
insertSlice,
|
|
30
|
+
insertTask,
|
|
31
|
+
} from "../gsd-db.ts";
|
|
32
|
+
import { deriveStateFromDb } from "../state.ts";
|
|
33
|
+
import { _clearGsdRootCache } from "../paths.ts";
|
|
34
|
+
import { invalidateAllCaches } from "../cache.ts";
|
|
35
|
+
|
|
36
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
function makeTempBase(): string {
|
|
39
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-4551-"));
|
|
40
|
+
mkdirSync(join(base, ".gsd", "milestones", "M001", "slices", "S01"), { recursive: true });
|
|
41
|
+
mkdirSync(join(base, ".gsd", "milestones", "M001", "slices", "S01", "tasks"), { recursive: true });
|
|
42
|
+
return base;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function seedPlanningState(base: string): void {
|
|
46
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
47
|
+
insertMilestone({ id: "M001", title: "Test Milestone", status: "active" });
|
|
48
|
+
insertSlice({
|
|
49
|
+
id: "S01",
|
|
50
|
+
milestoneId: "M001",
|
|
51
|
+
title: "Core Slice",
|
|
52
|
+
status: "pending",
|
|
53
|
+
risk: "medium",
|
|
54
|
+
depends: [],
|
|
55
|
+
demo: "demo",
|
|
56
|
+
sequence: 1,
|
|
57
|
+
isSketch: false,
|
|
58
|
+
});
|
|
59
|
+
// Write minimal ROADMAP so state derivation doesn't error
|
|
60
|
+
writeFileSync(
|
|
61
|
+
join(base, ".gsd", "milestones", "M001", "M001-ROADMAP.md"),
|
|
62
|
+
"# Roadmap\n",
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function cleanup(base: string, originalCwd: string): void {
|
|
67
|
+
try { closeDatabase(); } catch { /* noop */ }
|
|
68
|
+
try { process.chdir(originalCwd); } catch { /* noop */ }
|
|
69
|
+
try { rmSync(base, { recursive: true, force: true }); } catch { /* noop */ }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ─── Tests ────────────────────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
test("#4551: AutoSession.lastPreExecFailure defaults to null", () => {
|
|
75
|
+
const s = new AutoSession();
|
|
76
|
+
assert.equal(s.lastPreExecFailure, null, "lastPreExecFailure must start null");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test("#4551: AutoSession.reset() clears lastPreExecFailure", () => {
|
|
80
|
+
const s = new AutoSession();
|
|
81
|
+
s.lastPreExecFailure = {
|
|
82
|
+
unitId: "M001/S01",
|
|
83
|
+
blockingFindings: ["[file] src/foo.ts: file not found"],
|
|
84
|
+
verdictExcerpt: "status=fail; 1 blocking issue detected",
|
|
85
|
+
};
|
|
86
|
+
s.reset();
|
|
87
|
+
assert.equal(s.lastPreExecFailure, null, "reset() must clear lastPreExecFailure");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test("#4551: buildPlanSlicePrompt injects fix section when priorPreExecFailure provided", async (t) => {
|
|
91
|
+
const originalCwd = process.cwd();
|
|
92
|
+
const base = makeTempBase();
|
|
93
|
+
t.after(() => cleanup(base, originalCwd));
|
|
94
|
+
|
|
95
|
+
seedPlanningState(base);
|
|
96
|
+
process.chdir(base);
|
|
97
|
+
_clearGsdRootCache();
|
|
98
|
+
invalidateAllCaches();
|
|
99
|
+
|
|
100
|
+
const prompt = await buildPlanSlicePrompt(
|
|
101
|
+
"M001", "Test Milestone", "S01", "Core Slice", base,
|
|
102
|
+
undefined,
|
|
103
|
+
{
|
|
104
|
+
priorPreExecFailure: {
|
|
105
|
+
blockingFindings: [
|
|
106
|
+
"[file] src/utils/helper.ts: file not found",
|
|
107
|
+
"[package] nonexistent-pkg: package not found on npm",
|
|
108
|
+
],
|
|
109
|
+
verdictExcerpt: "status=fail; 2 blocking issues detected",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
assert.ok(
|
|
115
|
+
prompt.includes("Fix these specific issues from the prior pre-exec check"),
|
|
116
|
+
"prompt must contain the fix section heading",
|
|
117
|
+
);
|
|
118
|
+
assert.ok(
|
|
119
|
+
prompt.includes("src/utils/helper.ts: file not found"),
|
|
120
|
+
"prompt must include the specific file finding",
|
|
121
|
+
);
|
|
122
|
+
assert.ok(
|
|
123
|
+
prompt.includes("nonexistent-pkg: package not found on npm"),
|
|
124
|
+
"prompt must include the specific package finding",
|
|
125
|
+
);
|
|
126
|
+
assert.ok(
|
|
127
|
+
prompt.includes("status=fail; 2 blocking issues detected"),
|
|
128
|
+
"prompt must include the verdict excerpt",
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test("#4551: buildPlanSlicePrompt with no priorPreExecFailure does NOT include fix section", async (t) => {
|
|
133
|
+
const originalCwd = process.cwd();
|
|
134
|
+
const base = makeTempBase();
|
|
135
|
+
t.after(() => cleanup(base, originalCwd));
|
|
136
|
+
|
|
137
|
+
seedPlanningState(base);
|
|
138
|
+
process.chdir(base);
|
|
139
|
+
_clearGsdRootCache();
|
|
140
|
+
invalidateAllCaches();
|
|
141
|
+
|
|
142
|
+
const prompt = await buildPlanSlicePrompt(
|
|
143
|
+
"M001", "Test Milestone", "S01", "Core Slice", base,
|
|
144
|
+
undefined,
|
|
145
|
+
{ /* no priorPreExecFailure */ },
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
assert.ok(
|
|
149
|
+
!prompt.includes("Fix these specific issues from the prior pre-exec check"),
|
|
150
|
+
"prompt must NOT include the fix section when no failure context is given",
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("#4551: dispatch rule injects failure context and clears session field", async (t) => {
|
|
155
|
+
const originalCwd = process.cwd();
|
|
156
|
+
const base = makeTempBase();
|
|
157
|
+
t.after(() => cleanup(base, originalCwd));
|
|
158
|
+
|
|
159
|
+
seedPlanningState(base);
|
|
160
|
+
// Write a RESEARCH file so the dispatch rule skips research-slice and reaches
|
|
161
|
+
// plan-slice (which is the phase we're testing).
|
|
162
|
+
writeFileSync(
|
|
163
|
+
join(base, ".gsd", "milestones", "M001", "slices", "S01", "S01-RESEARCH.md"),
|
|
164
|
+
"# Research\n",
|
|
165
|
+
);
|
|
166
|
+
process.chdir(base);
|
|
167
|
+
_clearGsdRootCache();
|
|
168
|
+
invalidateAllCaches();
|
|
169
|
+
|
|
170
|
+
const state = await deriveStateFromDb(base);
|
|
171
|
+
assert.equal(state.phase, "planning", "state must be in planning phase");
|
|
172
|
+
|
|
173
|
+
const session = new AutoSession();
|
|
174
|
+
session.basePath = base;
|
|
175
|
+
session.active = true;
|
|
176
|
+
session.lastPreExecFailure = {
|
|
177
|
+
unitId: "M001/S01",
|
|
178
|
+
blockingFindings: ["[file] src/missing.ts: file not found"],
|
|
179
|
+
verdictExcerpt: "status=fail; 1 blocking issue detected",
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const ctx: DispatchContext = {
|
|
183
|
+
basePath: base,
|
|
184
|
+
mid: "M001",
|
|
185
|
+
midTitle: "Test Milestone",
|
|
186
|
+
state,
|
|
187
|
+
prefs: { phases: { reassess_after_slice: false, skip_research: true } } as any,
|
|
188
|
+
session,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const result = await resolveDispatch(ctx);
|
|
192
|
+
assert.equal(result.action, "dispatch", "must dispatch a unit");
|
|
193
|
+
if (result.action !== "dispatch") throw new Error("unreachable");
|
|
194
|
+
assert.equal(result.unitType, "plan-slice", "must be a plan-slice unit");
|
|
195
|
+
|
|
196
|
+
// The fix section must appear in the prompt
|
|
197
|
+
assert.ok(
|
|
198
|
+
result.prompt.includes("Fix these specific issues from the prior pre-exec check"),
|
|
199
|
+
"dispatched prompt must include the fix section",
|
|
200
|
+
);
|
|
201
|
+
assert.ok(
|
|
202
|
+
result.prompt.includes("src/missing.ts: file not found"),
|
|
203
|
+
"dispatched prompt must include the specific blocking finding",
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
// Field must be cleared after consumption
|
|
207
|
+
assert.equal(
|
|
208
|
+
session.lastPreExecFailure,
|
|
209
|
+
null,
|
|
210
|
+
"lastPreExecFailure must be cleared after being consumed by the dispatch rule",
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test("#4551: dispatch rule does NOT inject stale failure for a different slice", async (t) => {
|
|
215
|
+
const originalCwd = process.cwd();
|
|
216
|
+
const base = makeTempBase();
|
|
217
|
+
t.after(() => cleanup(base, originalCwd));
|
|
218
|
+
|
|
219
|
+
seedPlanningState(base);
|
|
220
|
+
// Write a RESEARCH file so dispatch reaches plan-slice, making the assertion
|
|
221
|
+
// about the prompt meaningful (we can check it's a plan-slice prompt without
|
|
222
|
+
// the fix section rather than a research-slice prompt without it).
|
|
223
|
+
writeFileSync(
|
|
224
|
+
join(base, ".gsd", "milestones", "M001", "slices", "S01", "S01-RESEARCH.md"),
|
|
225
|
+
"# Research\n",
|
|
226
|
+
);
|
|
227
|
+
process.chdir(base);
|
|
228
|
+
_clearGsdRootCache();
|
|
229
|
+
invalidateAllCaches();
|
|
230
|
+
|
|
231
|
+
const state = await deriveStateFromDb(base);
|
|
232
|
+
|
|
233
|
+
const session = new AutoSession();
|
|
234
|
+
session.basePath = base;
|
|
235
|
+
session.active = true;
|
|
236
|
+
// Failure belongs to a different slice (S02), not the active one (S01)
|
|
237
|
+
session.lastPreExecFailure = {
|
|
238
|
+
unitId: "M001/S02",
|
|
239
|
+
blockingFindings: ["[file] src/other.ts: file not found"],
|
|
240
|
+
verdictExcerpt: "status=fail; 1 blocking issue detected",
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const ctx: DispatchContext = {
|
|
244
|
+
basePath: base,
|
|
245
|
+
mid: "M001",
|
|
246
|
+
midTitle: "Test Milestone",
|
|
247
|
+
state,
|
|
248
|
+
prefs: { phases: { reassess_after_slice: false, skip_research: true } } as any,
|
|
249
|
+
session,
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const result = await resolveDispatch(ctx);
|
|
253
|
+
assert.equal(result.action, "dispatch");
|
|
254
|
+
if (result.action !== "dispatch") throw new Error("unreachable");
|
|
255
|
+
|
|
256
|
+
// The stale fix section must NOT appear
|
|
257
|
+
assert.ok(
|
|
258
|
+
!result.prompt.includes("Fix these specific issues from the prior pre-exec check"),
|
|
259
|
+
"prompt must NOT include fix section for a mismatched unit ID",
|
|
260
|
+
);
|
|
261
|
+
assert.ok(
|
|
262
|
+
!result.prompt.includes("src/other.ts"),
|
|
263
|
+
"prompt must NOT include findings from a different slice",
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
// Field must remain untouched (not consumed)
|
|
267
|
+
assert.notEqual(
|
|
268
|
+
session.lastPreExecFailure,
|
|
269
|
+
null,
|
|
270
|
+
"lastPreExecFailure must NOT be cleared when unit IDs don't match",
|
|
271
|
+
);
|
|
272
|
+
});
|
|
@@ -140,6 +140,25 @@ import type { Request } from 'express';
|
|
|
140
140
|
assert.ok(packages.includes("typescript"));
|
|
141
141
|
assert.ok(!packages.includes("-D"));
|
|
142
142
|
});
|
|
143
|
+
|
|
144
|
+
// Regression tests for #4388: prose containing `from "..."` must not produce false-positive packages
|
|
145
|
+
test("does not treat prose 'from \"What's Next\"' as a package name (#4388)", () => {
|
|
146
|
+
const desc = 'Build the feature described from "What\'s Next" in the roadmap';
|
|
147
|
+
const packages = extractPackageReferences(desc);
|
|
148
|
+
assert.deepEqual(packages, [], `prose 'from "What\\'s Next"' must not produce package names, got: ${JSON.stringify(packages)}`);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("does not treat prose \"from 'master'\" as a package name (#4388)", () => {
|
|
152
|
+
const desc = "Review changes from 'master' branch before merging";
|
|
153
|
+
const packages = extractPackageReferences(desc);
|
|
154
|
+
assert.deepEqual(packages, [], `prose "from 'master'" must not produce package names, got: ${JSON.stringify(packages)}`);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("still extracts import statements in code blocks after #4388 fix", () => {
|
|
158
|
+
const desc = "```typescript\nimport express from 'express';\nimport { Router } from 'express';\n```";
|
|
159
|
+
const packages = extractPackageReferences(desc);
|
|
160
|
+
assert.ok(packages.includes("express"), "import...from in code blocks must still be recognized");
|
|
161
|
+
});
|
|
143
162
|
});
|
|
144
163
|
|
|
145
164
|
// ─── File Path Consistency Tests ─────────────────────────────────────────────
|
|
@@ -1580,6 +1599,221 @@ describe("checkTaskOrdering directory inputs (#4446)", () => {
|
|
|
1580
1599
|
});
|
|
1581
1600
|
});
|
|
1582
1601
|
|
|
1602
|
+
// ─── Regression Tests: checkTaskOrdering false positive for pre-execution refs (#4071) ──
|
|
1603
|
+
|
|
1604
|
+
describe("checkTaskOrdering false positive for pre-execution refs (#4071)", () => {
|
|
1605
|
+
test("completed task at higher index does not trigger ordering violation for its outputs", () => {
|
|
1606
|
+
// Scenario: after a replan, a completed task at higher array index has already
|
|
1607
|
+
// created a file. A new earlier-sequence task reads that file. Since the
|
|
1608
|
+
// completed task already ran, its output is available regardless of disk state.
|
|
1609
|
+
// checkTaskOrdering must not flag this as a sequence violation.
|
|
1610
|
+
const tasks = [
|
|
1611
|
+
createTask({
|
|
1612
|
+
id: "T_NEW",
|
|
1613
|
+
sequence: 1,
|
|
1614
|
+
status: "pending",
|
|
1615
|
+
inputs: ["artifacts/setup.json"],
|
|
1616
|
+
expected_output: [],
|
|
1617
|
+
}),
|
|
1618
|
+
createTask({
|
|
1619
|
+
id: "T_SETUP",
|
|
1620
|
+
sequence: 5,
|
|
1621
|
+
status: "completed",
|
|
1622
|
+
inputs: [],
|
|
1623
|
+
expected_output: ["artifacts/setup.json"],
|
|
1624
|
+
}),
|
|
1625
|
+
];
|
|
1626
|
+
|
|
1627
|
+
const results = checkTaskOrdering(tasks, "/tmp");
|
|
1628
|
+
assert.equal(
|
|
1629
|
+
results.length,
|
|
1630
|
+
0,
|
|
1631
|
+
"completed task outputs must not trigger ordering violations for earlier-sequence tasks that read them",
|
|
1632
|
+
);
|
|
1633
|
+
});
|
|
1634
|
+
|
|
1635
|
+
test("pending task at higher index still triggers ordering violation", () => {
|
|
1636
|
+
// A PENDING task at higher index creating a file is a real violation.
|
|
1637
|
+
// Only completed tasks get the exemption.
|
|
1638
|
+
const tasks = [
|
|
1639
|
+
createTask({
|
|
1640
|
+
id: "T01",
|
|
1641
|
+
sequence: 1,
|
|
1642
|
+
status: "pending",
|
|
1643
|
+
inputs: ["artifacts/output.json"],
|
|
1644
|
+
expected_output: [],
|
|
1645
|
+
}),
|
|
1646
|
+
createTask({
|
|
1647
|
+
id: "T02",
|
|
1648
|
+
sequence: 5,
|
|
1649
|
+
status: "pending",
|
|
1650
|
+
inputs: [],
|
|
1651
|
+
expected_output: ["artifacts/output.json"],
|
|
1652
|
+
}),
|
|
1653
|
+
];
|
|
1654
|
+
|
|
1655
|
+
const results = checkTaskOrdering(tasks, "/tmp");
|
|
1656
|
+
assert.equal(
|
|
1657
|
+
results.length,
|
|
1658
|
+
1,
|
|
1659
|
+
"pending task at higher index must still be flagged as ordering violation",
|
|
1660
|
+
);
|
|
1661
|
+
assert.equal(results[0].blocking, true);
|
|
1662
|
+
assert.ok(results[0].message.includes("T01"));
|
|
1663
|
+
assert.ok(results[0].message.includes("T02"));
|
|
1664
|
+
assert.ok(results[0].message.includes("sequence violation"));
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
test("pending-first then completed-later: completed replaces pending in fileCreators (#4572)", () => {
|
|
1668
|
+
// Regression for CodeRabbit Major finding on PR #4572:
|
|
1669
|
+
// fileCreators only stored the FIRST task for a given path. If a PENDING task at
|
|
1670
|
+
// array index 1 was registered first, and a COMPLETED task at array index 2 also
|
|
1671
|
+
// declared the same output path, the completed entry was discarded. Line ~529 then
|
|
1672
|
+
// saw a pending creator with index > i and incorrectly fired a sequence violation
|
|
1673
|
+
// for the reader at array index 0.
|
|
1674
|
+
//
|
|
1675
|
+
// Scenario: path first declared by pending task (index 1), then by completed task
|
|
1676
|
+
// (index 2). Reader is at index 0. Without the fix a violation fires; with the fix
|
|
1677
|
+
// the completed entry replaces the pending entry and grants the exemption.
|
|
1678
|
+
const tasks = [
|
|
1679
|
+
// array index 0 — reads the shared path
|
|
1680
|
+
createTask({
|
|
1681
|
+
id: "T_READER",
|
|
1682
|
+
sequence: 1,
|
|
1683
|
+
status: "pending",
|
|
1684
|
+
inputs: ["shared/artifact.json"],
|
|
1685
|
+
expected_output: [],
|
|
1686
|
+
}),
|
|
1687
|
+
// array index 1 — pending producer (visited first during map build)
|
|
1688
|
+
createTask({
|
|
1689
|
+
id: "T_PENDING_PRODUCER",
|
|
1690
|
+
sequence: 5,
|
|
1691
|
+
status: "pending",
|
|
1692
|
+
inputs: [],
|
|
1693
|
+
expected_output: ["shared/artifact.json"],
|
|
1694
|
+
}),
|
|
1695
|
+
// array index 2 — completed producer (visited second; must replace pending entry)
|
|
1696
|
+
createTask({
|
|
1697
|
+
id: "T_COMPLETED_PRODUCER",
|
|
1698
|
+
sequence: 2,
|
|
1699
|
+
status: "completed",
|
|
1700
|
+
inputs: [],
|
|
1701
|
+
expected_output: ["shared/artifact.json"],
|
|
1702
|
+
}),
|
|
1703
|
+
];
|
|
1704
|
+
|
|
1705
|
+
// Without the fix: creator = T_PENDING_PRODUCER (index 1), !creator.completed && 1 > 0 → violation.
|
|
1706
|
+
// With the fix: creator = T_COMPLETED_PRODUCER (index 2), creator.completed → no violation.
|
|
1707
|
+
const results = checkTaskOrdering(tasks, "/tmp");
|
|
1708
|
+
assert.equal(
|
|
1709
|
+
results.length,
|
|
1710
|
+
0,
|
|
1711
|
+
"completed producer must replace pending producer in fileCreators and suppress false violation",
|
|
1712
|
+
);
|
|
1713
|
+
});
|
|
1714
|
+
|
|
1715
|
+
test("completed task output exemption applies regardless of whether file exists on disk", (t) => {
|
|
1716
|
+
// The completed-task exemption must work even when the file is not on disk
|
|
1717
|
+
// (e.g., the file was a temporary artifact that was cleaned up after the task ran).
|
|
1718
|
+
const tempDir = join(tmpdir(), `pre-exec-completed-task-${Date.now()}`);
|
|
1719
|
+
mkdirSync(tempDir, { recursive: true });
|
|
1720
|
+
t.after(() => rmSync(tempDir, { recursive: true, force: true }));
|
|
1721
|
+
|
|
1722
|
+
// File deliberately NOT created on disk — completed task ran in a prior session
|
|
1723
|
+
const tasks = [
|
|
1724
|
+
createTask({
|
|
1725
|
+
id: "T_MAIN",
|
|
1726
|
+
sequence: 0,
|
|
1727
|
+
status: "pending",
|
|
1728
|
+
inputs: ["generated/config.json"],
|
|
1729
|
+
expected_output: [],
|
|
1730
|
+
}),
|
|
1731
|
+
createTask({
|
|
1732
|
+
id: "T_INIT",
|
|
1733
|
+
sequence: 10,
|
|
1734
|
+
status: "completed",
|
|
1735
|
+
inputs: [],
|
|
1736
|
+
expected_output: ["generated/config.json"],
|
|
1737
|
+
}),
|
|
1738
|
+
];
|
|
1739
|
+
|
|
1740
|
+
const results = checkTaskOrdering(tasks, tempDir);
|
|
1741
|
+
assert.equal(
|
|
1742
|
+
results.length,
|
|
1743
|
+
0,
|
|
1744
|
+
"completed task exemption must apply even when file is absent from disk",
|
|
1745
|
+
);
|
|
1746
|
+
});
|
|
1747
|
+
});
|
|
1748
|
+
|
|
1749
|
+
describe("checkFilePathConsistency completed-task output exemption (#4071)", () => {
|
|
1750
|
+
test("completed task at higher index does not cause false positive for file it produced", (t) => {
|
|
1751
|
+
// Parallel to the checkTaskOrdering fix: checkFilePathConsistency also uses
|
|
1752
|
+
// getExpectedOutputsUpTo which historically only looked at prior-index tasks.
|
|
1753
|
+
// A completed task at a higher index has already run and its outputs are available.
|
|
1754
|
+
const tempDir = join(tmpdir(), `pre-exec-fc-completed-${Date.now()}`);
|
|
1755
|
+
mkdirSync(tempDir, { recursive: true });
|
|
1756
|
+
t.after(() => rmSync(tempDir, { recursive: true, force: true }));
|
|
1757
|
+
|
|
1758
|
+
// File is NOT on disk — completed task ran in a prior session and file was cleaned
|
|
1759
|
+
const tasks = [
|
|
1760
|
+
createTask({
|
|
1761
|
+
id: "T_MAIN",
|
|
1762
|
+
sequence: 1,
|
|
1763
|
+
status: "pending",
|
|
1764
|
+
inputs: ["artifacts/config.json"],
|
|
1765
|
+
expected_output: [],
|
|
1766
|
+
}),
|
|
1767
|
+
createTask({
|
|
1768
|
+
id: "T_SETUP",
|
|
1769
|
+
sequence: 10,
|
|
1770
|
+
status: "completed",
|
|
1771
|
+
inputs: [],
|
|
1772
|
+
expected_output: ["artifacts/config.json"],
|
|
1773
|
+
}),
|
|
1774
|
+
];
|
|
1775
|
+
|
|
1776
|
+
const results = checkFilePathConsistency(tasks, tempDir);
|
|
1777
|
+
assert.equal(
|
|
1778
|
+
results.length,
|
|
1779
|
+
0,
|
|
1780
|
+
"completed task at higher index should satisfy inputs of pending tasks that read its outputs",
|
|
1781
|
+
);
|
|
1782
|
+
});
|
|
1783
|
+
|
|
1784
|
+
test("pending task at higher index still causes a missing-file error", (t) => {
|
|
1785
|
+
const tempDir = join(tmpdir(), `pre-exec-fc-pending-${Date.now()}`);
|
|
1786
|
+
mkdirSync(tempDir, { recursive: true });
|
|
1787
|
+
t.after(() => rmSync(tempDir, { recursive: true, force: true }));
|
|
1788
|
+
|
|
1789
|
+
const tasks = [
|
|
1790
|
+
createTask({
|
|
1791
|
+
id: "T01",
|
|
1792
|
+
sequence: 1,
|
|
1793
|
+
status: "pending",
|
|
1794
|
+
inputs: ["artifacts/output.json"],
|
|
1795
|
+
expected_output: [],
|
|
1796
|
+
}),
|
|
1797
|
+
createTask({
|
|
1798
|
+
id: "T02",
|
|
1799
|
+
sequence: 10,
|
|
1800
|
+
status: "pending",
|
|
1801
|
+
inputs: [],
|
|
1802
|
+
expected_output: ["artifacts/output.json"],
|
|
1803
|
+
}),
|
|
1804
|
+
];
|
|
1805
|
+
|
|
1806
|
+
const results = checkFilePathConsistency(tasks, tempDir);
|
|
1807
|
+
assert.equal(
|
|
1808
|
+
results.length,
|
|
1809
|
+
1,
|
|
1810
|
+
"pending task at higher index must still be flagged — the file is not available yet",
|
|
1811
|
+
);
|
|
1812
|
+
assert.equal(results[0].blocking, true);
|
|
1813
|
+
assert.equal(results[0].target, "artifacts/output.json");
|
|
1814
|
+
});
|
|
1815
|
+
});
|
|
1816
|
+
|
|
1583
1817
|
describe("checkFilePathConsistency self-referential inputs (#4459)", () => {
|
|
1584
1818
|
test("input that is also in the same task's expected_output is not blocking when missing on disk", (t) => {
|
|
1585
1819
|
const tempDir = join(tmpdir(), `pre-exec-self-output-${Date.now()}`);
|
|
@@ -1645,3 +1879,125 @@ describe("checkFilePathConsistency self-referential inputs (#4459)", () => {
|
|
|
1645
1879
|
);
|
|
1646
1880
|
});
|
|
1647
1881
|
});
|
|
1882
|
+
|
|
1883
|
+
// ─── Regression Tests: quote-wrapped inputs treated as literal paths (#3747) ──
|
|
1884
|
+
|
|
1885
|
+
describe("checkFilePathConsistency quote-wrapped annotation (#3747)", () => {
|
|
1886
|
+
test("double-quoted path annotation is stripped before path check", (t) => {
|
|
1887
|
+
// Plan documents sometimes emit `"src/foo.ts"` (double-quote wrapped) as an
|
|
1888
|
+
// input value. The checker must strip the quotes before checking existence so
|
|
1889
|
+
// it doesn't produce a false-positive "file not found" error.
|
|
1890
|
+
const tempDir = join(tmpdir(), `pre-exec-quote-${Date.now()}`);
|
|
1891
|
+
mkdirSync(join(tempDir, "src"), { recursive: true });
|
|
1892
|
+
writeFileSync(join(tempDir, "src/foo.ts"), "// content");
|
|
1893
|
+
t.after(() => rmSync(tempDir, { recursive: true, force: true }));
|
|
1894
|
+
|
|
1895
|
+
const tasks = [
|
|
1896
|
+
createTask({
|
|
1897
|
+
id: "T01",
|
|
1898
|
+
inputs: ['"src/foo.ts"'],
|
|
1899
|
+
expected_output: [],
|
|
1900
|
+
}),
|
|
1901
|
+
];
|
|
1902
|
+
|
|
1903
|
+
const results = checkFilePathConsistency(tasks, tempDir);
|
|
1904
|
+
assert.equal(
|
|
1905
|
+
results.length,
|
|
1906
|
+
0,
|
|
1907
|
+
"Double-quoted path should be stripped and resolved to the real file",
|
|
1908
|
+
);
|
|
1909
|
+
});
|
|
1910
|
+
|
|
1911
|
+
test("single-quoted path annotation is stripped before path check", (t) => {
|
|
1912
|
+
const tempDir = join(tmpdir(), `pre-exec-squote-${Date.now()}`);
|
|
1913
|
+
mkdirSync(join(tempDir, "src"), { recursive: true });
|
|
1914
|
+
writeFileSync(join(tempDir, "src/bar.ts"), "// content");
|
|
1915
|
+
t.after(() => rmSync(tempDir, { recursive: true, force: true }));
|
|
1916
|
+
|
|
1917
|
+
const tasks = [
|
|
1918
|
+
createTask({
|
|
1919
|
+
id: "T01",
|
|
1920
|
+
inputs: ["'src/bar.ts'"],
|
|
1921
|
+
expected_output: [],
|
|
1922
|
+
}),
|
|
1923
|
+
];
|
|
1924
|
+
|
|
1925
|
+
const results = checkFilePathConsistency(tasks, tempDir);
|
|
1926
|
+
assert.equal(
|
|
1927
|
+
results.length,
|
|
1928
|
+
0,
|
|
1929
|
+
"Single-quoted path should be stripped and resolved to the real file",
|
|
1930
|
+
);
|
|
1931
|
+
});
|
|
1932
|
+
|
|
1933
|
+
test("backtick-only wrapped path without annotation resolves correctly", (t) => {
|
|
1934
|
+
// The bare form `src/foo.ts` (no dash annotation) must also work
|
|
1935
|
+
const tempDir = join(tmpdir(), `pre-exec-backtick-bare-${Date.now()}`);
|
|
1936
|
+
mkdirSync(join(tempDir, "src"), { recursive: true });
|
|
1937
|
+
writeFileSync(join(tempDir, "src/baz.ts"), "// content");
|
|
1938
|
+
t.after(() => rmSync(tempDir, { recursive: true, force: true }));
|
|
1939
|
+
|
|
1940
|
+
const tasks = [
|
|
1941
|
+
createTask({
|
|
1942
|
+
id: "T01",
|
|
1943
|
+
inputs: ["`src/baz.ts`"],
|
|
1944
|
+
expected_output: [],
|
|
1945
|
+
}),
|
|
1946
|
+
];
|
|
1947
|
+
|
|
1948
|
+
const results = checkFilePathConsistency(tasks, tempDir);
|
|
1949
|
+
assert.equal(
|
|
1950
|
+
results.length,
|
|
1951
|
+
0,
|
|
1952
|
+
"Bare backtick-wrapped path should resolve to the real file",
|
|
1953
|
+
);
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
test("prose value with spaces inside quotes is skipped (not a path)", () => {
|
|
1957
|
+
// "some description text" contains spaces — should not be checked as a path
|
|
1958
|
+
const tasks = [
|
|
1959
|
+
createTask({
|
|
1960
|
+
id: "T01",
|
|
1961
|
+
inputs: ['"some description text"'],
|
|
1962
|
+
expected_output: [],
|
|
1963
|
+
}),
|
|
1964
|
+
];
|
|
1965
|
+
|
|
1966
|
+
const results = checkFilePathConsistency(tasks, "/tmp");
|
|
1967
|
+
assert.equal(
|
|
1968
|
+
results.length,
|
|
1969
|
+
0,
|
|
1970
|
+
"Quoted prose with spaces should not be treated as a file path",
|
|
1971
|
+
);
|
|
1972
|
+
});
|
|
1973
|
+
|
|
1974
|
+
test("17-error scenario: mixed annotated inputs produce 0 blocking errors", (t) => {
|
|
1975
|
+
// Reproduces the M004-ej6j88/S07 scenario from issue #3747 where a plan with
|
|
1976
|
+
// multiple backtick- and quote-wrapped input strings causes 17 false blocking errors.
|
|
1977
|
+
const tempDir = join(tmpdir(), `pre-exec-3747-scenario-${Date.now()}`);
|
|
1978
|
+
mkdirSync(join(tempDir, "src"), { recursive: true });
|
|
1979
|
+
writeFileSync(join(tempDir, "src/foo.ts"), "// content");
|
|
1980
|
+
writeFileSync(join(tempDir, "src/bar.ts"), "// content");
|
|
1981
|
+
t.after(() => rmSync(tempDir, { recursive: true, force: true }));
|
|
1982
|
+
|
|
1983
|
+
const tasks = [
|
|
1984
|
+
createTask({
|
|
1985
|
+
id: "T01",
|
|
1986
|
+
inputs: [
|
|
1987
|
+
"`src/foo.ts`",
|
|
1988
|
+
'"src/bar.ts"',
|
|
1989
|
+
"some description text",
|
|
1990
|
+
"Existing enum definition",
|
|
1991
|
+
],
|
|
1992
|
+
expected_output: [],
|
|
1993
|
+
}),
|
|
1994
|
+
];
|
|
1995
|
+
|
|
1996
|
+
const results = checkFilePathConsistency(tasks, tempDir);
|
|
1997
|
+
assert.equal(
|
|
1998
|
+
results.length,
|
|
1999
|
+
0,
|
|
2000
|
+
"Annotated file paths and prose inputs should produce zero blocking errors",
|
|
2001
|
+
);
|
|
2002
|
+
});
|
|
2003
|
+
});
|