gsd-pi 2.82.0-dev.725028083 → 2.82.0-dev.98ea09b1e
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 +4 -3
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +10 -1
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +5 -5
- package/dist/resources/extensions/gsd/auto/orchestrator.js +124 -6
- package/dist/resources/extensions/gsd/auto/phases.js +8 -1
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +13 -6
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +233 -127
- package/dist/resources/extensions/gsd/auto-prompts.js +2 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +31 -1
- package/dist/resources/extensions/gsd/auto-start.js +85 -12
- package/dist/resources/extensions/gsd/auto-verification.js +28 -22
- package/dist/resources/extensions/gsd/auto-worktree.js +111 -1
- package/dist/resources/extensions/gsd/auto.js +158 -55
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +9 -8
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +16 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +4 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +37 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +31 -5
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
- package/dist/resources/extensions/gsd/doctor.js +2 -28
- package/dist/resources/extensions/gsd/export-html.js +27 -425
- package/dist/resources/extensions/gsd/git-service.js +39 -1
- package/dist/resources/extensions/gsd/gsd-db.js +1 -0
- package/dist/resources/extensions/gsd/guided-flow.js +13 -6
- package/dist/resources/extensions/gsd/md-importer.js +1 -1
- package/dist/resources/extensions/gsd/migrate/command.js +5 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +9 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +51 -4
- package/dist/resources/extensions/gsd/migrate/writer.js +11 -1
- package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +48 -12
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -2
- package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
- package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
- package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
- package/dist/resources/extensions/gsd/status-guards.js +4 -0
- package/dist/resources/extensions/gsd/templates/plan.md +8 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +4 -2
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
- package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +89 -14
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +32 -10
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +68 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +54 -10
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
- package/dist/resources/extensions/visual-brief/prompts.js +140 -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 +14 -14
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +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/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- 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 +4 -5
- 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 +2 -5
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -7
- 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 +4 -7
- 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 +4 -5
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
- package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-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/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/{8359.e059d86b255fce1c.js → 8359.7eb3bb8f8ecf4c01.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-9a4db269f9ed63ad.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +4 -4
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/mcp-server/README.md +13 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +80 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +23 -1
- package/packages/mcp-server/src/workflow-tools.ts +168 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +5 -6
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
- package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
- package/packages/pi-ai/src/providers/simple-options.ts +5 -6
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +5 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/tui.ts +6 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/src/resources/GSD-WORKFLOW.md +10 -1
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +59 -16
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +8 -5
- package/src/resources/extensions/gsd/auto/orchestrator.ts +129 -6
- package/src/resources/extensions/gsd/auto/phases.ts +7 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +14 -6
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +266 -139
- package/src/resources/extensions/gsd/auto-prompts.ts +2 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -0
- package/src/resources/extensions/gsd/auto-start.ts +92 -9
- package/src/resources/extensions/gsd/auto-verification.ts +36 -34
- package/src/resources/extensions/gsd/auto-worktree.ts +119 -1
- package/src/resources/extensions/gsd/auto.ts +167 -53
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +6 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +9 -8
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +19 -3
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +4 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +40 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +30 -4
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/git-service.ts +45 -1
- package/src/resources/extensions/gsd/gsd-db.ts +3 -0
- package/src/resources/extensions/gsd/guided-flow.ts +14 -7
- package/src/resources/extensions/gsd/md-importer.ts +1 -1
- package/src/resources/extensions/gsd/migrate/command.ts +5 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/migrate/preview.ts +10 -0
- package/src/resources/extensions/gsd/migrate/transformer.ts +58 -4
- package/src/resources/extensions/gsd/migrate/writer.ts +14 -1
- package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +54 -12
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -2
- package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/src/resources/extensions/gsd/prompts/queue.md +4 -4
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
- package/src/resources/extensions/gsd/status-guards.ts +5 -0
- package/src/resources/extensions/gsd/templates/plan.md +8 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +4 -2
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +487 -4
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +12 -11
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +5 -9
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +43 -2
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +103 -1
- package/src/resources/extensions/gsd/tests/integration/migrate-command.test.ts +48 -3
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/migrate-transformer.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +26 -18
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +63 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +225 -1
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +86 -0
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +46 -2
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +119 -23
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +86 -7
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +54 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
- package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
- package/src/resources/extensions/gsd/tools/plan-slice.ts +98 -12
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +135 -0
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +47 -11
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +78 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +61 -10
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/subagent/index.ts +567 -103
- 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/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -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/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
- package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
- package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- /package/dist/web/standalone/.next/static/{KDRTXR-22LPCsa80X9dey → euQ0CLP_v8V4e76Tu3odJ}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{KDRTXR-22LPCsa80X9dey → euQ0CLP_v8V4e76Tu3odJ}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Adapts shared GSD workflow handlers for MCP executor calls.
|
|
1
3
|
import { ensureDbOpen } from "../bootstrap/dynamic-tools.js";
|
|
2
4
|
import { sanitizeCompleteMilestoneParams } from "../bootstrap/sanitize-complete-milestone.js";
|
|
3
5
|
import { loadWriteGateSnapshot, shouldBlockContextArtifactSaveInSnapshot, shouldBlockRootArtifactSaveInSnapshot } from "../bootstrap/write-gate.js";
|
|
@@ -12,6 +14,9 @@ import { handleCompleteSlice } from "./complete-slice.js";
|
|
|
12
14
|
import { handlePlanMilestone } from "./plan-milestone.js";
|
|
13
15
|
import { handlePlanSlice } from "./plan-slice.js";
|
|
14
16
|
import { handleReplanSlice } from "./replan-slice.js";
|
|
17
|
+
import { handleReopenMilestone } from "./reopen-milestone.js";
|
|
18
|
+
import { handleReopenSlice } from "./reopen-slice.js";
|
|
19
|
+
import { handleReopenTask } from "./reopen-task.js";
|
|
15
20
|
import { handleReassessRoadmap } from "./reassess-roadmap.js";
|
|
16
21
|
import { handleValidateMilestone } from "./validate-milestone.js";
|
|
17
22
|
import { logError, logWarning } from "../workflow-logger.js";
|
|
@@ -274,6 +279,120 @@ export async function executeTaskComplete(params, basePath = process.cwd()) {
|
|
|
274
279
|
};
|
|
275
280
|
}
|
|
276
281
|
}
|
|
282
|
+
export async function executeTaskReopen(params, basePath = process.cwd()) {
|
|
283
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
284
|
+
if (!dbAvailable) {
|
|
285
|
+
return {
|
|
286
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot reopen task." }],
|
|
287
|
+
details: { operation: "reopen_task", error: "db_unavailable" },
|
|
288
|
+
isError: true,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const result = await handleReopenTask(params, basePath);
|
|
293
|
+
if ("error" in result) {
|
|
294
|
+
return {
|
|
295
|
+
content: [{ type: "text", text: `Error reopening task: ${result.error}` }],
|
|
296
|
+
details: { operation: "reopen_task", error: result.error },
|
|
297
|
+
isError: true,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
content: [{ type: "text", text: `Reopened task ${result.taskId} (${result.sliceId}/${result.milestoneId})` }],
|
|
302
|
+
details: {
|
|
303
|
+
operation: "reopen_task",
|
|
304
|
+
taskId: result.taskId,
|
|
305
|
+
sliceId: result.sliceId,
|
|
306
|
+
milestoneId: result.milestoneId,
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
catch (err) {
|
|
311
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
312
|
+
logError("tool", `reopen_task tool failed: ${msg}`, { tool: "gsd_task_reopen", error: String(err) });
|
|
313
|
+
return {
|
|
314
|
+
content: [{ type: "text", text: `Error reopening task: ${msg}` }],
|
|
315
|
+
details: { operation: "reopen_task", error: msg },
|
|
316
|
+
isError: true,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
export async function executeSliceReopen(params, basePath = process.cwd()) {
|
|
321
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
322
|
+
if (!dbAvailable) {
|
|
323
|
+
return {
|
|
324
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot reopen slice." }],
|
|
325
|
+
details: { operation: "reopen_slice", error: "db_unavailable" },
|
|
326
|
+
isError: true,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
const result = await handleReopenSlice(params, basePath);
|
|
331
|
+
if ("error" in result) {
|
|
332
|
+
return {
|
|
333
|
+
content: [{ type: "text", text: `Error reopening slice: ${result.error}` }],
|
|
334
|
+
details: { operation: "reopen_slice", error: result.error },
|
|
335
|
+
isError: true,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
return {
|
|
339
|
+
content: [{ type: "text", text: `Reopened slice ${result.sliceId} (${result.milestoneId})` }],
|
|
340
|
+
details: {
|
|
341
|
+
operation: "reopen_slice",
|
|
342
|
+
sliceId: result.sliceId,
|
|
343
|
+
milestoneId: result.milestoneId,
|
|
344
|
+
tasksReset: result.tasksReset,
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
catch (err) {
|
|
349
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
350
|
+
logError("tool", `reopen_slice tool failed: ${msg}`, { tool: "gsd_slice_reopen", error: String(err) });
|
|
351
|
+
return {
|
|
352
|
+
content: [{ type: "text", text: `Error reopening slice: ${msg}` }],
|
|
353
|
+
details: { operation: "reopen_slice", error: msg },
|
|
354
|
+
isError: true,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
export async function executeMilestoneReopen(params, basePath = process.cwd()) {
|
|
359
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
360
|
+
if (!dbAvailable) {
|
|
361
|
+
return {
|
|
362
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot reopen milestone." }],
|
|
363
|
+
details: { operation: "reopen_milestone", error: "db_unavailable" },
|
|
364
|
+
isError: true,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
try {
|
|
368
|
+
const result = await handleReopenMilestone(params, basePath);
|
|
369
|
+
if ("error" in result) {
|
|
370
|
+
return {
|
|
371
|
+
content: [{ type: "text", text: `Error reopening milestone: ${result.error}` }],
|
|
372
|
+
details: { operation: "reopen_milestone", error: result.error },
|
|
373
|
+
isError: true,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
return {
|
|
377
|
+
content: [{ type: "text", text: `Reopened milestone ${result.milestoneId}` }],
|
|
378
|
+
details: {
|
|
379
|
+
operation: "reopen_milestone",
|
|
380
|
+
milestoneId: result.milestoneId,
|
|
381
|
+
slicesReset: result.slicesReset,
|
|
382
|
+
tasksReset: result.tasksReset,
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
catch (err) {
|
|
387
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
388
|
+
logError("tool", `reopen_milestone tool failed: ${msg}`, { tool: "gsd_milestone_reopen", error: String(err) });
|
|
389
|
+
return {
|
|
390
|
+
content: [{ type: "text", text: `Error reopening milestone: ${msg}` }],
|
|
391
|
+
details: { operation: "reopen_milestone", error: msg },
|
|
392
|
+
isError: true,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
}
|
|
277
396
|
export async function executeSliceComplete(params, basePath = process.cwd()) {
|
|
278
397
|
const dbAvailable = await ensureDbOpen(basePath);
|
|
279
398
|
if (!dbAvailable) {
|
|
@@ -73,6 +73,7 @@ const COMMON_BUDGET_SMALL = 250_000; // ~65K tokens
|
|
|
73
73
|
// allowed-path set for the docs policy lives in one reviewable place.
|
|
74
74
|
const TOOLS_ALL = { mode: "all" };
|
|
75
75
|
const TOOLS_PLANNING = { mode: "planning" };
|
|
76
|
+
const TOOLS_VERIFICATION = { mode: "verification" };
|
|
76
77
|
// Like TOOLS_PLANNING but permits dispatch to read-only recon/planning
|
|
77
78
|
// specialists. Runtime-enforced by write-gate.ts before the subagent tool runs.
|
|
78
79
|
const TOOLS_PLANNING_DISPATCH_RECON = {
|
|
@@ -187,8 +188,8 @@ export const UNIT_MANIFESTS = {
|
|
|
187
188
|
contextMode: "verification",
|
|
188
189
|
// planning-dispatch: validation is a verification-fan-out unit. It reads
|
|
189
190
|
// the milestone surface and dispatches reviewer/security/tester subagents
|
|
190
|
-
// to report findings without touching user source.
|
|
191
|
-
//
|
|
191
|
+
// to report findings without touching user source. Write isolation to
|
|
192
|
+
// .gsd/ is preserved.
|
|
192
193
|
tools: TOOLS_PLANNING_DISPATCH_REVIEW,
|
|
193
194
|
artifacts: {
|
|
194
195
|
inline: ["roadmap", "slice-summary", "slice-uat", "requirements", "decisions", "templates"],
|
|
@@ -204,11 +205,9 @@ export const UNIT_MANIFESTS = {
|
|
|
204
205
|
codebaseMap: false,
|
|
205
206
|
preferences: "active-only",
|
|
206
207
|
contextMode: "verification",
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
// preserved.
|
|
211
|
-
tools: TOOLS_PLANNING_DISPATCH_REVIEW,
|
|
208
|
+
// Milestone closeout must run unrestricted shell verification commands
|
|
209
|
+
// against the final diff before recording completion.
|
|
210
|
+
tools: TOOLS_ALL,
|
|
212
211
|
artifacts: {
|
|
213
212
|
// #4780 landed slice-summary as excerpt for this unit; phase 2 of
|
|
214
213
|
// the architecture will read this manifest as the source of truth
|
|
@@ -227,7 +226,9 @@ export const UNIT_MANIFESTS = {
|
|
|
227
226
|
codebaseMap: true,
|
|
228
227
|
preferences: "active-only",
|
|
229
228
|
contextMode: "research",
|
|
230
|
-
|
|
229
|
+
// Multi-slice research dispatches use the research-slice unit contract to
|
|
230
|
+
// fan out scout subagents that write .gsd research artifacts.
|
|
231
|
+
tools: TOOLS_PLANNING_DISPATCH_RECON,
|
|
231
232
|
artifacts: {
|
|
232
233
|
inline: ["roadmap", "milestone-research", "dependency-summaries", "templates"],
|
|
233
234
|
excerpt: [],
|
|
@@ -365,7 +366,7 @@ export const UNIT_MANIFESTS = {
|
|
|
365
366
|
codebaseMap: false,
|
|
366
367
|
preferences: "active-only",
|
|
367
368
|
contextMode: "verification",
|
|
368
|
-
tools:
|
|
369
|
+
tools: TOOLS_VERIFICATION,
|
|
369
370
|
artifacts: {
|
|
370
371
|
// Phase 3 migration (#4782): manifest matches today's actual
|
|
371
372
|
// buildRunUatPrompt inlining. Prior phase-1 entry listed
|
|
@@ -384,7 +385,9 @@ export const UNIT_MANIFESTS = {
|
|
|
384
385
|
codebaseMap: false,
|
|
385
386
|
preferences: "active-only",
|
|
386
387
|
contextMode: "verification",
|
|
387
|
-
|
|
388
|
+
// Gate evaluation fans out tester-style subagents, which read the slice
|
|
389
|
+
// plan and report via the DB-backed gate-result tool.
|
|
390
|
+
tools: TOOLS_PLANNING_DISPATCH_REVIEW,
|
|
388
391
|
artifacts: {
|
|
389
392
|
inline: ["slice-plan", "prior-task-summaries"],
|
|
390
393
|
excerpt: [],
|
|
@@ -509,3 +512,22 @@ export const UNIT_MANIFESTS = {
|
|
|
509
512
|
export function resolveManifest(unitType) {
|
|
510
513
|
return UNIT_MANIFESTS[unitType] ?? null;
|
|
511
514
|
}
|
|
515
|
+
export function compileSubagentPermissionContract(policy) {
|
|
516
|
+
if (!policy) {
|
|
517
|
+
return { allowed: false, allowedSubagents: [], toolsMode: "unknown" };
|
|
518
|
+
}
|
|
519
|
+
if (policy.mode === "all") {
|
|
520
|
+
return { allowed: true, allowedSubagents: ["*"], toolsMode: policy.mode };
|
|
521
|
+
}
|
|
522
|
+
if (policy.mode === "planning-dispatch") {
|
|
523
|
+
return {
|
|
524
|
+
allowed: true,
|
|
525
|
+
allowedSubagents: [...policy.allowedSubagents],
|
|
526
|
+
toolsMode: policy.mode,
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
return { allowed: false, allowedSubagents: [], toolsMode: policy.mode };
|
|
530
|
+
}
|
|
531
|
+
export function resolveSubagentPermissionContract(unitType) {
|
|
532
|
+
return compileSubagentPermissionContract(resolveManifest(unitType)?.tools);
|
|
533
|
+
}
|
|
@@ -5,6 +5,27 @@
|
|
|
5
5
|
export function isNonEmptyString(value) {
|
|
6
6
|
return typeof value === "string" && value.trim().length > 0;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Characters that are used as delimiters in GSD state management documents
|
|
10
|
+
* and should not appear in milestone or slice titles.
|
|
11
|
+
*/
|
|
12
|
+
const TITLE_DELIMITER_RE = /[\u2014\u2013\/]/; // em dash, en dash, forward slash
|
|
13
|
+
/**
|
|
14
|
+
* Check whether a milestone or slice title contains characters that conflict
|
|
15
|
+
* with GSD's state document delimiter conventions.
|
|
16
|
+
* Returns a human-readable description of the problem, or null if the title is safe.
|
|
17
|
+
*/
|
|
18
|
+
export function validateTitle(title) {
|
|
19
|
+
if (TITLE_DELIMITER_RE.test(title)) {
|
|
20
|
+
const found = [];
|
|
21
|
+
if (/[\u2014\u2013]/.test(title))
|
|
22
|
+
found.push("em/en dash (\u2014 or \u2013)");
|
|
23
|
+
if (/\//.test(title))
|
|
24
|
+
found.push("forward slash (/)");
|
|
25
|
+
return `title contains ${found.join(" and ")}, which conflict with GSD state document delimiters`;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
8
29
|
/**
|
|
9
30
|
* Validate that `value` is an array of non-empty strings.
|
|
10
31
|
* Throws with a message referencing `field` on failure.
|
|
@@ -12,7 +33,8 @@ export function isNonEmptyString(value) {
|
|
|
12
33
|
*/
|
|
13
34
|
export function validateStringArray(value, field) {
|
|
14
35
|
if (!Array.isArray(value)) {
|
|
15
|
-
|
|
36
|
+
const received = value === null ? "null" : typeof value;
|
|
37
|
+
throw new Error(`${field} must be an array of strings, not ${received}`);
|
|
16
38
|
}
|
|
17
39
|
if (value.some((item) => !isNonEmptyString(item))) {
|
|
18
40
|
throw new Error(`${field} must contain only non-empty strings`);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Discovery order (D003): preference → task plan verify → package.json scripts.
|
|
4
4
|
// First non-empty source wins.
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
6
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
7
7
|
import { join, basename } from "node:path";
|
|
8
8
|
import { DEFAULT_COMMAND_TIMEOUT_MS } from "./constants.js";
|
|
9
9
|
import { rewriteCommandWithRtk } from "../shared/rtk.js";
|
|
@@ -27,7 +27,8 @@ const PACKAGE_SCRIPT_KEYS = ["typecheck", "lint", "test"];
|
|
|
27
27
|
* 1. Explicit preference commands
|
|
28
28
|
* 2. Task plan verify field (split on &&)
|
|
29
29
|
* 3. package.json scripts (typecheck, lint, test)
|
|
30
|
-
* 4.
|
|
30
|
+
* 4. Python pytest project markers
|
|
31
|
+
* 5. None found
|
|
31
32
|
*/
|
|
32
33
|
export function discoverCommands(options) {
|
|
33
34
|
// 1. Preference commands
|
|
@@ -72,9 +73,57 @@ export function discoverCommands(options) {
|
|
|
72
73
|
// Malformed package.json — fall through to "none"
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
+
const pythonCommand = discoverPythonPytestCommand(options.cwd);
|
|
77
|
+
if (pythonCommand) {
|
|
78
|
+
return { commands: [pythonCommand], source: "python-project" };
|
|
79
|
+
}
|
|
80
|
+
// 5. Nothing found
|
|
76
81
|
return { commands: [], source: "none" };
|
|
77
82
|
}
|
|
83
|
+
function discoverPythonPytestCommand(cwd) {
|
|
84
|
+
const hasPythonTestFiles = hasPythonTests(join(cwd, "tests"));
|
|
85
|
+
const hasPytestConfig = existsSync(join(cwd, "pytest.ini"));
|
|
86
|
+
const pyprojectPath = join(cwd, "pyproject.toml");
|
|
87
|
+
const hasPyproject = existsSync(pyprojectPath);
|
|
88
|
+
if (!hasPythonTestFiles && !hasPytestConfig && !hasPyproject) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
if (hasPytestConfig || hasPythonTestFiles) {
|
|
92
|
+
return "python3 -m pytest";
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
const pyproject = readFileSync(pyprojectPath, "utf-8");
|
|
96
|
+
if (pyproject.includes("[tool.pytest]") ||
|
|
97
|
+
pyproject.includes("[tool.pytest.") ||
|
|
98
|
+
pyproject.includes("[pytest]") ||
|
|
99
|
+
pyproject.includes("[tool:pytest]")) {
|
|
100
|
+
return "python3 -m pytest";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// Ignore unreadable pyproject.toml and fall through.
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function hasPythonTests(dir) {
|
|
109
|
+
let entries;
|
|
110
|
+
try {
|
|
111
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
for (const entry of entries) {
|
|
117
|
+
const path = join(dir, entry.name);
|
|
118
|
+
if (entry.isDirectory() && hasPythonTests(path)) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
if (entry.isFile() && /^test_.*\.py$|^.*_test\.py$/.test(entry.name)) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
78
127
|
// ─── Failure Context Formatting ──────────────────────────────────────────────
|
|
79
128
|
/** Maximum chars of stderr to include per failed check in failure context. */
|
|
80
129
|
const MAX_STDERR_PER_CHECK = 2_000;
|
|
@@ -112,7 +161,7 @@ export function formatFailureContext(result) {
|
|
|
112
161
|
}
|
|
113
162
|
// ─── Gate Execution ─────────────────────────────────────────────────────────
|
|
114
163
|
/** Characters that indicate shell injection when found in a command string. */
|
|
115
|
-
const SHELL_INJECTION_PATTERN = /[
|
|
164
|
+
const SHELL_INJECTION_PATTERN = /[;|`<>]|\$\(/;
|
|
116
165
|
/**
|
|
117
166
|
* Known executable first-tokens that are safe to run.
|
|
118
167
|
* Lowercase commands, common build/test tools, and npm/yarn/pnpm invocations.
|
|
@@ -148,6 +197,7 @@ const KNOWN_COMMAND_PREFIXES = new Set([
|
|
|
148
197
|
* Heuristics (any true → prose-like):
|
|
149
198
|
* 1. First token starts with an uppercase letter and the string has 4+ words
|
|
150
199
|
* 2. String contains commas followed by spaces (prose clause structure)
|
|
200
|
+
* 3. First token has no ASCII letters or digits and the string has 4+ words
|
|
151
201
|
*/
|
|
152
202
|
export function isLikelyCommand(cmd) {
|
|
153
203
|
const trimmed = cmd.trim();
|
|
@@ -173,16 +223,27 @@ export function isLikelyCommand(cmd) {
|
|
|
173
223
|
// First token has uppercase letters and no path separators → prose
|
|
174
224
|
if (/[A-Z]/.test(firstToken) && !firstToken.includes("/"))
|
|
175
225
|
return false;
|
|
226
|
+
// Non-ASCII prose with multiple words should not be executed as a command.
|
|
227
|
+
if (!/[A-Za-z0-9]/.test(firstToken) && tokens.length >= 4)
|
|
228
|
+
return false;
|
|
176
229
|
return true;
|
|
177
230
|
}
|
|
178
231
|
/**
|
|
179
232
|
* Validate a command string for obvious shell injection patterns.
|
|
180
233
|
* Returns the command unchanged if safe, or null if suspicious.
|
|
181
234
|
*/
|
|
235
|
+
export function validateVerificationCommand(cmd) {
|
|
236
|
+
if (SHELL_INJECTION_PATTERN.test(cmd)) {
|
|
237
|
+
return { ok: false, reason: "contains shell control syntax such as pipes, redirects, semicolons, backticks, or command substitution" };
|
|
238
|
+
}
|
|
239
|
+
if (!isLikelyCommand(cmd)) {
|
|
240
|
+
return { ok: false, reason: "does not look like a runnable command" };
|
|
241
|
+
}
|
|
242
|
+
return { ok: true };
|
|
243
|
+
}
|
|
182
244
|
function sanitizeCommand(cmd) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (!isLikelyCommand(cmd))
|
|
245
|
+
const validation = validateVerificationCommand(cmd);
|
|
246
|
+
if (!validation.ok)
|
|
186
247
|
return null;
|
|
187
248
|
return cmd;
|
|
188
249
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Host-owned verification verdict policy for auto-mode units.
|
|
3
|
+
export function decideVerificationVerdict(unitType, result) {
|
|
4
|
+
if (unitType === "execute-task" && result.discoverySource === "none" && result.checks.length === 0) {
|
|
5
|
+
return {
|
|
6
|
+
passed: false,
|
|
7
|
+
reason: "no-host-checks",
|
|
8
|
+
retryable: false,
|
|
9
|
+
failureContext: "No runnable host-owned verification command was discovered. Add project verification_commands or a runnable task-plan Verify command before completing this execute-task.",
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (!result.passed) {
|
|
13
|
+
return {
|
|
14
|
+
passed: false,
|
|
15
|
+
reason: "checks-failed",
|
|
16
|
+
retryable: true,
|
|
17
|
+
failureContext: "",
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
passed: true,
|
|
22
|
+
reason: "passed",
|
|
23
|
+
retryable: false,
|
|
24
|
+
failureContext: "",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -150,11 +150,11 @@ export function renderSummaryContent(taskRow, sliceId, milestoneId, evidence) {
|
|
|
150
150
|
}
|
|
151
151
|
// ── Frontmatter (YAML list format, matches parseSummary() expectations) ──
|
|
152
152
|
const keyFilesYaml = taskRow.key_files && taskRow.key_files.length > 0
|
|
153
|
-
? taskRow.key_files.map(f => ` - ${f}`).join("\n")
|
|
154
|
-
: "
|
|
153
|
+
? `\n${taskRow.key_files.map(f => ` - ${f}`).join("\n")}`
|
|
154
|
+
: " []";
|
|
155
155
|
const keyDecisionsYaml = taskRow.key_decisions && taskRow.key_decisions.length > 0
|
|
156
|
-
? taskRow.key_decisions.map(d => ` - ${d}`).join("\n")
|
|
157
|
-
: "
|
|
156
|
+
? `\n${taskRow.key_decisions.map(d => ` - ${d}`).join("\n")}`
|
|
157
|
+
: " []";
|
|
158
158
|
// Derive verification_result from evidence if available
|
|
159
159
|
const evidenceList = evidence ?? [];
|
|
160
160
|
const allPassed = evidenceList.length > 0 &&
|
|
@@ -182,10 +182,8 @@ export function renderSummaryContent(taskRow, sliceId, milestoneId, evidence) {
|
|
|
182
182
|
id: ${taskRow.id}
|
|
183
183
|
parent: ${sliceId}
|
|
184
184
|
milestone: ${milestoneId}
|
|
185
|
-
key_files
|
|
186
|
-
|
|
187
|
-
key_decisions:
|
|
188
|
-
${keyDecisionsYaml}
|
|
185
|
+
key_files:${keyFilesYaml}
|
|
186
|
+
key_decisions:${keyDecisionsYaml}
|
|
189
187
|
duration: ${taskRow.duration || ""}
|
|
190
188
|
verification_result: ${verificationResult}
|
|
191
189
|
completed_at: ${taskRow.completed_at || ""}
|
|
@@ -20,6 +20,7 @@ import { existsSync, readFileSync, unlinkSync } from "node:fs";
|
|
|
20
20
|
import { randomUUID } from "node:crypto";
|
|
21
21
|
import { join } from "node:path";
|
|
22
22
|
import { debugLog } from "./debug-logger.js";
|
|
23
|
+
import { logWarning } from "./workflow-logger.js";
|
|
23
24
|
import { emitJournalEvent } from "./journal.js";
|
|
24
25
|
import { emitWorktreeCreated, emitWorktreeMerged } from "./worktree-telemetry.js";
|
|
25
26
|
import { resolveWorktreeProjectRoot, normalizeWorktreePathForCompare, } from "./worktree-root.js";
|
|
@@ -48,6 +49,11 @@ import { nativeCheckoutBranch } from "./native-git-bridge.js";
|
|
|
48
49
|
// is the only Module that calls them, and they live alongside the Module's
|
|
49
50
|
// other primitives in `auto-worktree.ts`.
|
|
50
51
|
import { autoWorktreeBranch, createAutoWorktree, enterAutoWorktree, enterBranchModeForMilestone, getAutoWorktreePath, isInAutoWorktree, teardownAutoWorktree, } from "./auto-worktree.js";
|
|
52
|
+
const recentWorktreeMergeFailures = new Map();
|
|
53
|
+
const MERGE_FAILURE_DEDUPE_MS = 60_000;
|
|
54
|
+
export function resetRecentWorktreeMergeFailuresForTest() {
|
|
55
|
+
recentWorktreeMergeFailures.clear();
|
|
56
|
+
}
|
|
51
57
|
/**
|
|
52
58
|
* Internal sentinel — thrown by `_mergeBranchMode` when it has already
|
|
53
59
|
* emitted a user-visible error. The outer `mergeAndExit` catches the type
|
|
@@ -208,7 +214,7 @@ export function _enterMilestoneCore(s, deps, milestoneId, ctx) {
|
|
|
208
214
|
}
|
|
209
215
|
// Phase B: claim a milestone lease before any worktree mutation. Two
|
|
210
216
|
// workers cannot enter the same milestone concurrently. Best-effort:
|
|
211
|
-
//
|
|
217
|
+
// warn if no worker registered (single-worker fallback) or skip if DB
|
|
212
218
|
// unavailable; reuse existing lease if we already hold it on this
|
|
213
219
|
// milestone (re-entry within the same session).
|
|
214
220
|
if (s.workerId) {
|
|
@@ -288,6 +294,9 @@ export function _enterMilestoneCore(s, deps, milestoneId, ctx) {
|
|
|
288
294
|
}
|
|
289
295
|
}
|
|
290
296
|
}
|
|
297
|
+
else {
|
|
298
|
+
logWarning("worktree", `enterMilestone(${milestoneId}) ran before auto worker registration; milestone lease was not claimed.`);
|
|
299
|
+
}
|
|
291
300
|
// Resolve the project root for worktree operations via shared helper.
|
|
292
301
|
// Handles the case where originalBasePath is falsy and basePath is itself
|
|
293
302
|
// a worktree path — prevents double-nested worktree paths (#3729).
|
|
@@ -477,6 +486,28 @@ function rebuildGitService(s, deps) {
|
|
|
477
486
|
// GitService cast.
|
|
478
487
|
s.gitService = deps.gitServiceFactory(s.basePath);
|
|
479
488
|
}
|
|
489
|
+
function emitWorktreeMergeFailedOnce(basePath, milestoneId, err) {
|
|
490
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
491
|
+
const errorCategory = err instanceof Error ? err.name : "Error";
|
|
492
|
+
const now = Date.now();
|
|
493
|
+
const key = `${basePath}\0${milestoneId}\0${errorCategory}`;
|
|
494
|
+
const previous = recentWorktreeMergeFailures.get(key);
|
|
495
|
+
if (previous && now - previous < MERGE_FAILURE_DEDUPE_MS)
|
|
496
|
+
return;
|
|
497
|
+
for (const [candidate, ts] of recentWorktreeMergeFailures) {
|
|
498
|
+
if (now - ts >= MERGE_FAILURE_DEDUPE_MS) {
|
|
499
|
+
recentWorktreeMergeFailures.delete(candidate);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
emitJournalEvent(basePath, {
|
|
503
|
+
ts: new Date().toISOString(),
|
|
504
|
+
flowId: randomUUID(),
|
|
505
|
+
seq: 0,
|
|
506
|
+
eventType: "worktree-merge-failed",
|
|
507
|
+
data: { milestoneId, error: msg },
|
|
508
|
+
});
|
|
509
|
+
recentWorktreeMergeFailures.set(key, now);
|
|
510
|
+
}
|
|
480
511
|
// ─── Session-less merge entry (ADR-016 phase 2 / A1) ─────────────────────
|
|
481
512
|
/**
|
|
482
513
|
* Worktree-mode merge body. Session-less — operates on a `MergeContext`.
|
|
@@ -590,13 +621,7 @@ function _mergeWorktreeModeImpl(deps, mctx) {
|
|
|
590
621
|
error: msg,
|
|
591
622
|
fallback: "chdir-to-project-root",
|
|
592
623
|
});
|
|
593
|
-
|
|
594
|
-
ts: new Date().toISOString(),
|
|
595
|
-
flowId: randomUUID(),
|
|
596
|
-
seq: 0,
|
|
597
|
-
eventType: "worktree-merge-failed",
|
|
598
|
-
data: { milestoneId, error: msg },
|
|
599
|
-
});
|
|
624
|
+
emitWorktreeMergeFailedOnce(originalBasePath || worktreeBasePath, milestoneId, err);
|
|
600
625
|
// Surface a clear, actionable error. Worktree and milestone branch
|
|
601
626
|
// are intentionally preserved — nothing has been deleted. User can
|
|
602
627
|
// retry /gsd dispatch complete-milestone or merge manually once the
|
|
@@ -1198,17 +1223,36 @@ export class WorktreeLifecycle {
|
|
|
1198
1223
|
}
|
|
1199
1224
|
}
|
|
1200
1225
|
/**
|
|
1201
|
-
* Restore `s.basePath` to `s.originalBasePath
|
|
1202
|
-
* No-op when `originalBasePath` is empty (fresh
|
|
1226
|
+
* Restore `s.basePath` to `s.originalBasePath`, chdir process cwd, and
|
|
1227
|
+
* rebuild `s.gitService`. No-op when `originalBasePath` is empty (fresh
|
|
1228
|
+
* sessions).
|
|
1203
1229
|
*
|
|
1204
1230
|
* Used by error/cleanup paths that need the session to behave as if the
|
|
1205
1231
|
* worktree was never entered. Does NOT teardown the worktree directory —
|
|
1206
1232
|
* callers that need teardown go through `exitMilestone({ merge: false })`.
|
|
1233
|
+
*
|
|
1234
|
+
* ADR-016 phase 3 (#5693): chdir lives inside the verb so callers do not
|
|
1235
|
+
* pair `restoreToProjectRoot()` with a redundant `process.chdir`. The
|
|
1236
|
+
* chdir runs BEFORE the throwable work (`rebuildGitService`, cache
|
|
1237
|
+
* invalidation) so that cleanup-path cwd is restored even if the
|
|
1238
|
+
* downstream rebuild throws. The chdir itself is best-effort; failure is
|
|
1239
|
+
* logged via debugLog and swallowed.
|
|
1207
1240
|
*/
|
|
1208
1241
|
restoreToProjectRoot() {
|
|
1209
1242
|
if (!this.s.originalBasePath)
|
|
1210
1243
|
return;
|
|
1211
1244
|
this.s.basePath = this.s.originalBasePath;
|
|
1245
|
+
try {
|
|
1246
|
+
process.chdir(this.s.basePath);
|
|
1247
|
+
}
|
|
1248
|
+
catch (err) {
|
|
1249
|
+
debugLog("WorktreeLifecycle", {
|
|
1250
|
+
action: "restoreToProjectRoot",
|
|
1251
|
+
result: "chdir-failed",
|
|
1252
|
+
basePath: this.s.basePath,
|
|
1253
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1212
1256
|
rebuildGitService(this.s, this.deps);
|
|
1213
1257
|
invalidateAllCaches();
|
|
1214
1258
|
}
|