@opengsd/gsd-pi 1.2.0-dev.844675c9 → 1.2.0-dev.b1abb545
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/dist/cli-web-branch.d.ts +2 -0
- package/dist/cli-web-branch.js +9 -2
- package/dist/help-text.js +5 -0
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/ask-user-questions.js +78 -23
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +84 -228
- package/dist/resources/extensions/claude-code-cli/turn-assembler.js +224 -0
- package/dist/resources/extensions/github-sync/templates.js +3 -3
- package/dist/resources/extensions/gsd/artifact-projection.js +14 -0
- package/dist/resources/extensions/gsd/auto/loop.js +74 -56
- package/dist/resources/extensions/gsd/auto/orchestrator.js +109 -11
- package/dist/resources/extensions/gsd/auto/phases.js +28 -3
- package/dist/resources/extensions/gsd/auto/run-unit.js +2 -1
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +16 -4
- package/dist/resources/extensions/gsd/auto-dispatch.js +6 -5
- package/dist/resources/extensions/gsd/auto-model-selection.js +8 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +4 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +81 -8
- package/dist/resources/extensions/gsd/auto-recovery.js +48 -49
- package/dist/resources/extensions/gsd/auto-runtime-state.js +14 -0
- package/dist/resources/extensions/gsd/auto-start.js +12 -23
- package/dist/resources/extensions/gsd/auto-timers.js +16 -2
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +32 -0
- package/dist/resources/extensions/gsd/auto-unit-tool-scope.js +4 -29
- package/dist/resources/extensions/gsd/auto-verification.js +7 -7
- package/dist/resources/extensions/gsd/auto-worktree.js +21 -19
- package/dist/resources/extensions/gsd/auto.js +11 -7
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +28 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +11 -37
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +100 -138
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +63 -4
- package/dist/resources/extensions/gsd/closeout-consistency-gate.js +21 -4
- package/dist/resources/extensions/gsd/codebase-generator.js +8 -4
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +3 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +20 -0
- package/dist/resources/extensions/gsd/commands-inspect.js +4 -8
- package/dist/resources/extensions/gsd/commands-maintenance.js +61 -41
- package/dist/resources/extensions/gsd/commands-ship.js +2 -2
- package/dist/resources/extensions/gsd/commands-verdict.js +12 -2
- package/dist/resources/extensions/gsd/db-workspace.js +103 -0
- package/dist/resources/extensions/gsd/delegation-policy.js +2 -10
- package/dist/resources/extensions/gsd/discussion-handoff.js +218 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +9 -0
- package/dist/resources/extensions/gsd/doctor.js +16 -9
- package/dist/resources/extensions/gsd/error-classifier.js +1 -1
- package/dist/resources/extensions/gsd/git-conflict-state.js +16 -1
- package/dist/resources/extensions/gsd/gsd-db.js +12 -0
- package/dist/resources/extensions/gsd/guided-flow.js +34 -468
- package/dist/resources/extensions/gsd/guided-unit-completion.js +225 -0
- package/dist/resources/extensions/gsd/markdown-renderer.js +2 -1
- package/dist/resources/extensions/gsd/mcp-filter.js +2 -1
- package/dist/resources/extensions/gsd/mcp-tool-name.js +26 -0
- package/dist/resources/extensions/gsd/md-importer.js +4 -3
- package/dist/resources/extensions/gsd/migrate/safety.js +2 -2
- package/dist/resources/extensions/gsd/migration-auto-check.js +3 -2
- package/dist/resources/extensions/gsd/milestone-closeout-proof.js +72 -0
- package/dist/resources/extensions/gsd/milestone-closeout.js +12 -4
- package/dist/resources/extensions/gsd/milestone-merge-transaction.js +10 -0
- package/dist/resources/extensions/gsd/milestone-planning-persistence.js +156 -0
- package/dist/resources/extensions/gsd/milestone-readiness.js +77 -0
- package/dist/resources/extensions/gsd/milestone-settlement.js +50 -0
- package/dist/resources/extensions/gsd/milestone-validation-evidence.js +73 -0
- package/dist/resources/extensions/gsd/milestone-validation-verdict.js +57 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.js +3 -6
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/preferences-diagnostics.js +67 -0
- package/dist/resources/extensions/gsd/preferences.js +147 -29
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/execute-task.md +2 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +3 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/system.md +1 -1
- package/dist/resources/extensions/gsd/provider-payload-policy.js +83 -0
- package/dist/resources/extensions/gsd/pull-request-process.js +13 -0
- package/dist/resources/extensions/gsd/quality-gate-closure.js +109 -0
- package/dist/resources/extensions/gsd/question-transport.js +86 -0
- package/dist/resources/extensions/gsd/roadmap-slices.js +8 -2
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/state.js +13 -5
- package/dist/resources/extensions/gsd/templates/plan.md +7 -0
- package/dist/resources/extensions/gsd/templates/project.md +1 -0
- package/dist/resources/extensions/gsd/templates/roadmap.md +1 -1
- package/dist/resources/extensions/gsd/templates/uat.md +5 -1
- package/dist/resources/extensions/gsd/tool-contract.js +52 -8
- package/dist/resources/extensions/gsd/tool-presentation-plan.js +15 -34
- package/dist/resources/extensions/gsd/tool-surface-snapshot.js +17 -0
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +15 -143
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +39 -0
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +15 -78
- package/dist/resources/extensions/gsd/uat-policy.js +16 -10
- package/dist/resources/extensions/gsd/uat-run.js +9 -14
- package/dist/resources/extensions/gsd/unit-context-composer.js +40 -20
- package/dist/resources/extensions/gsd/unit-runtime.js +3 -2
- package/dist/resources/extensions/gsd/unit-tool-contracts.js +2 -1
- package/dist/resources/extensions/gsd/user-input-boundary.js +23 -0
- package/dist/resources/extensions/gsd/validation-block-guard.js +2 -0
- package/dist/resources/extensions/gsd/web-app-uat.js +80 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +15 -102
- package/dist/resources/extensions/gsd/workflow-reconcile.js +4 -3
- package/dist/resources/extensions/gsd/workflow-tool-surface.js +46 -0
- package/dist/resources/extensions/gsd/workspace-git-guard.js +2 -0
- package/dist/resources/extensions/gsd/worktree-state-projection.js +33 -4
- package/dist/resources/extensions/gsd/worktree-telemetry.js +12 -0
- package/dist/resources/extensions/shared/interview-ui.js +2 -2
- package/dist/resources/shared/claude-runtime-floor.js +182 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-cmd.js +20 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
- 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 +8 -8
- 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 +7 -7
- package/dist/web/standalone/.next/server/chunks/8357.js +1 -1
- 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/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/2659.b7b129ee6a769448.js +1 -0
- package/dist/web/standalone/.next/static/chunks/2772.bfa657f49f955239.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{3616.4113d484a994e411.js → 3616.3c60753b8ffcbd2e.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/4283.e4873b058df143a1.js +2 -0
- package/dist/web/standalone/.next/static/chunks/5826.a46ecdd1cfe8dabc.js +1 -0
- package/dist/web/standalone/.next/static/chunks/796.cf859a427a2cb2ac.js +10 -0
- package/dist/web/standalone/.next/static/chunks/8785.2e5a118797fb2dd2.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-dda80a1ef5587410.js → webpack-fbea77b5f9953368.js} +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/dist/web-mode.d.ts +2 -0
- package/dist/web-mode.js +20 -8
- package/package.json +2 -1
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.d.ts +2 -0
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.js +14 -0
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.js.map +1 -1
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +106 -40
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.js +6 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/dist/server.d.ts +10 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +8 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +41 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +2 -1
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +3 -3
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +8 -93
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +35 -120
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/dist/components/input.js +1 -1
- package/packages/pi-tui/dist/components/input.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +39 -30
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.js +22 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -1
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/extensions/ask-user-questions.ts +87 -24
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +108 -281
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +240 -0
- package/src/resources/extensions/claude-code-cli/turn-assembler.ts +287 -0
- package/src/resources/extensions/github-sync/templates.ts +3 -3
- package/src/resources/extensions/github-sync/tests/templates.test.ts +2 -2
- package/src/resources/extensions/gsd/artifact-projection.ts +31 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +32 -2
- package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -0
- package/src/resources/extensions/gsd/auto/loop.ts +83 -61
- package/src/resources/extensions/gsd/auto/orchestrator.ts +125 -12
- package/src/resources/extensions/gsd/auto/phases.ts +35 -3
- package/src/resources/extensions/gsd/auto/run-unit.ts +2 -1
- package/src/resources/extensions/gsd/auto/session.ts +4 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +18 -4
- package/src/resources/extensions/gsd/auto-dispatch.ts +20 -7
- package/src/resources/extensions/gsd/auto-model-selection.ts +8 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +4 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +107 -9
- package/src/resources/extensions/gsd/auto-recovery.ts +50 -50
- package/src/resources/extensions/gsd/auto-runtime-state.ts +26 -0
- package/src/resources/extensions/gsd/auto-start.ts +17 -20
- package/src/resources/extensions/gsd/auto-timers.ts +16 -2
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +35 -0
- package/src/resources/extensions/gsd/auto-unit-tool-scope.ts +9 -30
- package/src/resources/extensions/gsd/auto-verification.ts +7 -8
- package/src/resources/extensions/gsd/auto-worktree.ts +33 -26
- package/src/resources/extensions/gsd/auto.ts +15 -8
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +29 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +10 -37
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +116 -151
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +107 -3
- package/src/resources/extensions/gsd/closeout-consistency-gate.ts +27 -5
- package/src/resources/extensions/gsd/codebase-generator.ts +9 -5
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +3 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +18 -0
- package/src/resources/extensions/gsd/commands-inspect.ts +7 -8
- package/src/resources/extensions/gsd/commands-maintenance.ts +74 -40
- package/src/resources/extensions/gsd/commands-ship.ts +2 -2
- package/src/resources/extensions/gsd/commands-verdict.ts +19 -2
- package/src/resources/extensions/gsd/db-workspace.ts +170 -0
- package/src/resources/extensions/gsd/delegation-policy.ts +3 -11
- package/src/resources/extensions/gsd/discussion-handoff.ts +276 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +9 -0
- package/src/resources/extensions/gsd/doctor.ts +15 -5
- package/src/resources/extensions/gsd/error-classifier.ts +1 -1
- package/src/resources/extensions/gsd/git-conflict-state.ts +17 -1
- package/src/resources/extensions/gsd/gsd-db.ts +12 -0
- package/src/resources/extensions/gsd/guided-flow.ts +47 -558
- package/src/resources/extensions/gsd/guided-unit-completion.ts +275 -0
- package/src/resources/extensions/gsd/markdown-renderer.ts +2 -1
- package/src/resources/extensions/gsd/mcp-filter.ts +2 -1
- package/src/resources/extensions/gsd/mcp-tool-name.ts +35 -0
- package/src/resources/extensions/gsd/md-importer.ts +3 -3
- package/src/resources/extensions/gsd/migrate/safety.ts +2 -2
- package/src/resources/extensions/gsd/migration-auto-check.ts +2 -2
- package/src/resources/extensions/gsd/milestone-closeout-proof.ts +131 -0
- package/src/resources/extensions/gsd/milestone-closeout.ts +12 -4
- package/src/resources/extensions/gsd/milestone-merge-transaction.ts +47 -0
- package/src/resources/extensions/gsd/milestone-planning-persistence.ts +224 -0
- package/src/resources/extensions/gsd/milestone-readiness.ts +125 -0
- package/src/resources/extensions/gsd/milestone-settlement.ts +81 -0
- package/src/resources/extensions/gsd/milestone-validation-evidence.ts +95 -0
- package/src/resources/extensions/gsd/milestone-validation-verdict.ts +80 -0
- package/src/resources/extensions/gsd/parallel-eligibility.ts +4 -5
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/preferences-diagnostics.ts +98 -0
- package/src/resources/extensions/gsd/preferences-types.ts +16 -0
- package/src/resources/extensions/gsd/preferences.ts +173 -28
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/execute-task.md +2 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +3 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/system.md +1 -1
- package/src/resources/extensions/gsd/provider-payload-policy.ts +140 -0
- package/src/resources/extensions/gsd/pull-request-process.ts +41 -0
- package/src/resources/extensions/gsd/quality-gate-closure.ts +140 -0
- package/src/resources/extensions/gsd/question-transport.ts +138 -0
- package/src/resources/extensions/gsd/roadmap-slices.ts +8 -2
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/state.ts +15 -5
- package/src/resources/extensions/gsd/templates/plan.md +7 -0
- package/src/resources/extensions/gsd/templates/project.md +1 -0
- package/src/resources/extensions/gsd/templates/roadmap.md +1 -1
- package/src/resources/extensions/gsd/templates/uat.md +5 -1
- package/src/resources/extensions/gsd/tests/ask-user-questions-render.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +29 -1
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +321 -5
- package/src/resources/extensions/gsd/tests/auto-milestone-target.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection-tool-poisoning.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +133 -4
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/canonical-milestone-root.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/commands-dispatcher-workspace-git.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +38 -1
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +34 -3
- package/src/resources/extensions/gsd/tests/dispatch-run-uat-browser-tools.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/doctor-scope-db-unavailable.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +1 -5
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +1 -5
- package/src/resources/extensions/gsd/tests/gate-state-canonicalization.test.ts +48 -1
- package/src/resources/extensions/gsd/tests/mcp-tool-name.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/milestone-closeout-proof.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-transaction.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/milestone-readiness.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/milestone-validation-evidence.test.ts +41 -0
- package/src/resources/extensions/gsd/tests/milestone-validation-verdict.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/planning-crossval.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/preferences-diagnostics.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +183 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/provider-payload-policy.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/pull-request-process.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +94 -0
- package/src/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +25 -1
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +80 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +101 -1
- package/src/resources/extensions/gsd/tests/stale-queued-milestone.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/tool-availability-audit.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +35 -42
- package/src/resources/extensions/gsd/tests/uat-policy.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/user-input-boundary.test.ts +86 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/web-app-uat.test.ts +150 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +126 -9
- package/src/resources/extensions/gsd/tests/workspace-git-preflight.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/worktree-projection-writers.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +79 -0
- package/src/resources/extensions/gsd/tool-contract.ts +86 -8
- package/src/resources/extensions/gsd/tool-presentation-plan.ts +16 -33
- package/src/resources/extensions/gsd/tool-surface-snapshot.ts +47 -0
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +19 -160
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +43 -0
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +25 -84
- package/src/resources/extensions/gsd/uat-policy.ts +19 -10
- package/src/resources/extensions/gsd/uat-run.ts +10 -14
- package/src/resources/extensions/gsd/unit-context-composer.ts +85 -20
- package/src/resources/extensions/gsd/unit-runtime.ts +3 -2
- package/src/resources/extensions/gsd/unit-tool-contracts.ts +2 -1
- package/src/resources/extensions/gsd/user-input-boundary.ts +18 -0
- package/src/resources/extensions/gsd/validation-block-guard.ts +2 -0
- package/src/resources/extensions/gsd/web-app-uat.ts +101 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +22 -110
- package/src/resources/extensions/gsd/workflow-reconcile.ts +3 -3
- package/src/resources/extensions/gsd/workflow-tool-surface.ts +73 -0
- package/src/resources/extensions/gsd/workspace-git-guard.ts +1 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +7 -16
- package/src/resources/extensions/gsd/worktree-state-projection.ts +55 -7
- package/src/resources/extensions/gsd/worktree-telemetry.ts +16 -0
- package/src/resources/extensions/shared/interview-ui.ts +15 -2
- package/src/resources/shared/claude-runtime-floor.ts +248 -0
- package/dist/web/standalone/.next/static/chunks/2659.feb6499ca863ebfc.js +0 -1
- package/dist/web/standalone/.next/static/chunks/2772.151789db0edea835.js +0 -1
- package/dist/web/standalone/.next/static/chunks/4283.10a065467b5340d8.js +0 -2
- package/dist/web/standalone/.next/static/chunks/5826.960dc4634cc9b0d3.js +0 -1
- package/dist/web/standalone/.next/static/chunks/796.46f811c0fac23aab.js +0 -10
- package/dist/web/standalone/.next/static/chunks/8785.d32f7a61f55c1600.js +0 -1
- /package/dist/web/standalone/.next/static/{Qbr81pQ-pbQXP4bq2VXLv → 3PtrU9qGPEXwNLWkIyiqk}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Qbr81pQ-pbQXP4bq2VXLv → 3PtrU9qGPEXwNLWkIyiqk}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Recover guided-unit completion signals that did not produce expected tool/file evidence.
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { clearPathCache, relMilestoneFile, resolveMilestoneFile, resolveMilestonePath, } from "./paths.js";
|
|
6
|
+
import { _getPendingAutoStart, deletePendingAutoStart, hasPendingAutoStart, } from "./pending-auto-start.js";
|
|
7
|
+
import { logWarning } from "./workflow-logger.js";
|
|
8
|
+
// #4573: cap for how many times we nudge the LLM after a premature ready
|
|
9
|
+
// phrase before giving up and asking the user to re-run /gsd.
|
|
10
|
+
const MAX_READY_REJECTS = 2;
|
|
11
|
+
// #4573: matches the canonical ready phrase the discuss prompt asks the LLM
|
|
12
|
+
// to emit. Accepts any M-prefixed milestone ID (three digits + optional
|
|
13
|
+
// suffix) with optional trailing punctuation.
|
|
14
|
+
const READY_PHRASE_RE = /\bMilestone\s+M\d{3}[A-Z0-9-]*\s+ready\.?/i;
|
|
15
|
+
const emptyTurnCounterByBase = new Map();
|
|
16
|
+
const MAX_EMPTY_TURN_RETRIES = 2;
|
|
17
|
+
// Phrases that indicate the LLM is about to do something but has not yet.
|
|
18
|
+
// Kept tight to avoid flagging legitimate narration like "I'll wait for your answer."
|
|
19
|
+
//
|
|
20
|
+
// "make" was previously in the verb list but matches conversational meta phrases
|
|
21
|
+
// like "Let me make sure I understand…" which are NOT action announcements —
|
|
22
|
+
// removed to prevent the empty-turn nudge from auto-replying to user questions
|
|
23
|
+
// in discuss flows.
|
|
24
|
+
const COMMIT_INTENT_RE = /\b(?:I['’]ll|I will|Next,? I['’]ll|Now I['’]ll|Let me|I['’]m going to|I am going to)\s+(?:now\s+)?(?:write|create|call|invoke|update|add|run|execute|generate|produce|emit|compose|implement|save|apply|commit)\b/i;
|
|
25
|
+
/**
|
|
26
|
+
* Extract the concatenated text content from an assistant message, whether it
|
|
27
|
+
* stores content as a string or as an array of text blocks.
|
|
28
|
+
*/
|
|
29
|
+
function extractAssistantText(msg) {
|
|
30
|
+
if (!msg)
|
|
31
|
+
return "";
|
|
32
|
+
const content = msg.content;
|
|
33
|
+
if (typeof content === "string")
|
|
34
|
+
return content;
|
|
35
|
+
if (!Array.isArray(content))
|
|
36
|
+
return "";
|
|
37
|
+
const parts = [];
|
|
38
|
+
for (const block of content) {
|
|
39
|
+
if (!block || typeof block !== "object")
|
|
40
|
+
continue;
|
|
41
|
+
if (block.type === "text" && typeof block.text === "string")
|
|
42
|
+
parts.push(block.text);
|
|
43
|
+
}
|
|
44
|
+
return parts.join("\n");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Return true if the assistant message contains any tool-use block.
|
|
48
|
+
*
|
|
49
|
+
* The canonical pi-ai `AssistantMessage.content` (see packages/pi-ai/src/types.ts)
|
|
50
|
+
* uses `type: "toolCall"` and `type: "serverToolUse"` for tool invocations —
|
|
51
|
+
* every provider (anthropic-direct, claude-code-cli, openai, etc.) normalizes
|
|
52
|
+
* incoming tool blocks into these two shapes before they reach guided-flow.
|
|
53
|
+
*
|
|
54
|
+
* The Anthropic API wire shape `"tool_use"` / `"server_tool_use"` does NOT appear
|
|
55
|
+
* in the internal AssistantMessage — those literals are only used when sending
|
|
56
|
+
* messages back out to the Anthropic API. Matching them here was a latent bug:
|
|
57
|
+
* `hasToolUse` returned `false` for every real tool call, which let the
|
|
58
|
+
* empty-turn nudge fire and pre-empt MCP tools that block on the user
|
|
59
|
+
* (e.g. `ask_user_questions`). See investigation in PR for #4658.
|
|
60
|
+
*/
|
|
61
|
+
function hasToolUse(msg) {
|
|
62
|
+
if (!msg)
|
|
63
|
+
return false;
|
|
64
|
+
const content = msg.content;
|
|
65
|
+
if (!Array.isArray(content))
|
|
66
|
+
return false;
|
|
67
|
+
return content.some((b) => b &&
|
|
68
|
+
typeof b === "object" &&
|
|
69
|
+
(b.type === "toolCall" || b.type === "serverToolUse"));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* #4573 — Detect and recover from the "ready phrase without files" failure mode.
|
|
73
|
+
*
|
|
74
|
+
* When the LLM emits "Milestone {{id}} ready." but has not written the
|
|
75
|
+
* milestone CONTEXT/ROADMAP artifacts, `checkAutoStartAfterDiscuss()` silently
|
|
76
|
+
* returns false and the next /gsd invocation loops into the "All milestones
|
|
77
|
+
* complete" warning.
|
|
78
|
+
*
|
|
79
|
+
* This function, called from `handleAgentEnd` after `checkAutoStartAfterDiscuss`
|
|
80
|
+
* returns false, pattern-matches the ready phrase on the last assistant message.
|
|
81
|
+
* If it fired AND neither the canonical M###-CONTEXT.md/M###-ROADMAP.md nor
|
|
82
|
+
* legacy CONTEXT.md/ROADMAP.md files exist, it:
|
|
83
|
+
* 1. Notifies the user that the signal was rejected.
|
|
84
|
+
* 2. Injects a system message via `pi.sendMessage(..., {triggerTurn:true})`
|
|
85
|
+
* telling the LLM the signal was premature and to emit the writes now.
|
|
86
|
+
* 3. Caps at `MAX_READY_REJECTS` per-entry; beyond that, gives up and asks
|
|
87
|
+
* the user to re-run /gsd.
|
|
88
|
+
*
|
|
89
|
+
* Returns true when a nudge (or give-up) was emitted, signaling the caller to
|
|
90
|
+
* skip `resolveAgentEnd`.
|
|
91
|
+
*/
|
|
92
|
+
export function maybeHandleReadyPhraseWithoutFiles(event, lookupBasePath) {
|
|
93
|
+
const entry = _getPendingAutoStart(lookupBasePath);
|
|
94
|
+
if (!entry)
|
|
95
|
+
return false;
|
|
96
|
+
const { ctx, pi, basePath, milestoneId } = entry;
|
|
97
|
+
// Gate: last assistant message must contain the ready phrase
|
|
98
|
+
const lastMsg = event.messages[event.messages.length - 1];
|
|
99
|
+
const text = extractAssistantText(lastMsg);
|
|
100
|
+
if (!READY_PHRASE_RE.test(text))
|
|
101
|
+
return false;
|
|
102
|
+
// Bust paths.ts cached dir listings before checking for fresh writes. The
|
|
103
|
+
// LLM's Write tool calls do not invalidate paths.ts caches, so a stale
|
|
104
|
+
// listing taken before the milestone dir or its CONTEXT/ROADMAP files
|
|
105
|
+
// existed would falsely report the artifacts as missing and trigger the
|
|
106
|
+
// 3-strike "ready without files" abort even though the writes succeeded.
|
|
107
|
+
clearPathCache();
|
|
108
|
+
// Gate: artifacts must still be missing — if they exist, the happy path
|
|
109
|
+
// already fired and we have nothing to do.
|
|
110
|
+
const contextFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT");
|
|
111
|
+
const roadmapFile = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
112
|
+
if (contextFile || roadmapFile)
|
|
113
|
+
return false;
|
|
114
|
+
// Diagnostic: when the cached resolver reports both files missing, also probe
|
|
115
|
+
// the canonical paths with uncached existsSync so we can tell whether the
|
|
116
|
+
// recovery is firing on real-missing files or a path-resolution miss
|
|
117
|
+
// (basePath/symlink mismatch, stale cache despite agent-end-recovery flush,
|
|
118
|
+
// legacy descriptor dir not matching, etc.).
|
|
119
|
+
try {
|
|
120
|
+
const mDir = resolveMilestonePath(basePath, milestoneId);
|
|
121
|
+
const canonicalCtx = mDir ? join(mDir, `${milestoneId}-CONTEXT.md`) : null;
|
|
122
|
+
const canonicalRoadmap = mDir ? join(mDir, `${milestoneId}-ROADMAP.md`) : null;
|
|
123
|
+
logWarning("guided", `ready-phrase-reject diagnostic mid=${milestoneId} basePath=${basePath} ` +
|
|
124
|
+
`mDir=${mDir ?? "null"} ` +
|
|
125
|
+
`canonical-ctx=${canonicalCtx ?? "null"} ctx-exists=${canonicalCtx ? existsSync(canonicalCtx) : "n/a"} ` +
|
|
126
|
+
`canonical-roadmap=${canonicalRoadmap ?? "null"} roadmap-exists=${canonicalRoadmap ? existsSync(canonicalRoadmap) : "n/a"}`);
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
logWarning("guided", `ready-phrase-reject diagnostic failed: ${e.message}`);
|
|
130
|
+
}
|
|
131
|
+
entry.readyRejectCount = (entry.readyRejectCount ?? 0) + 1;
|
|
132
|
+
if (entry.readyRejectCount > MAX_READY_REJECTS) {
|
|
133
|
+
// Give up: clear state and tell the user to re-run /gsd. Avoids an
|
|
134
|
+
// infinite nudge loop when the LLM never produces the writes.
|
|
135
|
+
deletePendingAutoStart(basePath);
|
|
136
|
+
ctx.ui.notify(`Milestone ${milestoneId}: LLM signaled "ready" ${entry.readyRejectCount} times without writing files. ` +
|
|
137
|
+
`Stopping auto-nudge. Run /gsd to try again.`, "error");
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
const contextRel = relMilestoneFile(basePath, milestoneId, "CONTEXT");
|
|
141
|
+
const roadmapRel = relMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
142
|
+
ctx.ui.notify(`Milestone ${milestoneId}: "ready" signal rejected — ${contextRel} and ${roadmapRel} are missing. Asking the LLM to complete the writes.`, "warning");
|
|
143
|
+
const nudge = `You emitted "Milestone ${milestoneId} ready." but neither ` +
|
|
144
|
+
`${contextRel} nor ${roadmapRel} exists on disk. ` +
|
|
145
|
+
`The ready phrase is a POST-WRITE signal and has been rejected. ` +
|
|
146
|
+
`In this turn: (1) write PROJECT.md, REQUIREMENTS.md, and the milestone ` +
|
|
147
|
+
`CONTEXT.md, (2) call gsd_plan_milestone, then (3) emit the ready phrase. ` +
|
|
148
|
+
`Do not describe these steps — execute them as tool calls. ` +
|
|
149
|
+
`This is retry ${entry.readyRejectCount}/${MAX_READY_REJECTS}; further ` +
|
|
150
|
+
`premature signals will clear the session.`;
|
|
151
|
+
try {
|
|
152
|
+
pi.sendMessage({ customType: "gsd-ready-no-files", content: nudge, display: false }, { triggerTurn: true });
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
logWarning("guided", `ready-phrase nudge sendMessage failed: ${e.message}`);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Reset the empty-turn counter for a basePath after a successful tool-use turn.
|
|
162
|
+
* Called from handleAgentEnd when the last message contains tool_use blocks.
|
|
163
|
+
*/
|
|
164
|
+
export function resetEmptyTurnCounter(basePath) {
|
|
165
|
+
if (basePath)
|
|
166
|
+
emptyTurnCounterByBase.delete(basePath);
|
|
167
|
+
else
|
|
168
|
+
emptyTurnCounterByBase.clear();
|
|
169
|
+
}
|
|
170
|
+
export function maybeHandleEmptyIntentTurn(event, isAuto, lookupBasePath) {
|
|
171
|
+
// Gate: only fire when there is system-driven work in flight. Interactive
|
|
172
|
+
// /gsd discuss (user-driven) produces legitimate text-only turns.
|
|
173
|
+
if (!isAuto && !hasPendingAutoStart(lookupBasePath))
|
|
174
|
+
return false;
|
|
175
|
+
const lastMsg = event.messages[event.messages.length - 1];
|
|
176
|
+
if (!lastMsg)
|
|
177
|
+
return false;
|
|
178
|
+
if (hasToolUse(lastMsg))
|
|
179
|
+
return false;
|
|
180
|
+
const text = extractAssistantText(lastMsg).trim();
|
|
181
|
+
if (!text)
|
|
182
|
+
return false;
|
|
183
|
+
// Skip if the LLM is emitting the ready phrase — that is the ready-no-files
|
|
184
|
+
// path, handled by maybeHandleReadyPhraseWithoutFiles.
|
|
185
|
+
if (READY_PHRASE_RE.test(text))
|
|
186
|
+
return false;
|
|
187
|
+
// Skip if the LLM is clearly handing back to the user. Discuss flows
|
|
188
|
+
// often pose a question and follow it with a conditional intent on the
|
|
189
|
+
// same line ("Did I capture that correctly? If so, I'll write the
|
|
190
|
+
// requirements."). A line-trailing `?` check misses these because the
|
|
191
|
+
// line ends in `.`. Match any sentence-terminating `?` (followed by
|
|
192
|
+
// whitespace or end-of-text) — false negatives here auto-reply to the
|
|
193
|
+
// user, which is a much worse failure mode than a missed nudge.
|
|
194
|
+
if (/\?(?:\s|$)/.test(text))
|
|
195
|
+
return false;
|
|
196
|
+
// Must contain a commit-intent phrase — this is the stall we care about.
|
|
197
|
+
if (!COMMIT_INTENT_RE.test(text))
|
|
198
|
+
return false;
|
|
199
|
+
// Resolve the target basePath + pi for injection. Prefer the pending
|
|
200
|
+
// autostart entry (discuss flow); otherwise we cannot inject.
|
|
201
|
+
const entry = _getPendingAutoStart(lookupBasePath);
|
|
202
|
+
if (!entry)
|
|
203
|
+
return false;
|
|
204
|
+
const { ctx, pi, basePath } = entry;
|
|
205
|
+
const count = (emptyTurnCounterByBase.get(basePath) ?? 0) + 1;
|
|
206
|
+
emptyTurnCounterByBase.set(basePath, count);
|
|
207
|
+
if (count > MAX_EMPTY_TURN_RETRIES) {
|
|
208
|
+
ctx.ui.notify(`Empty-turn recovery: LLM announced intent ${count} times without calling any tool. ` +
|
|
209
|
+
`Stopping auto-nudge.`, "error");
|
|
210
|
+
return false; // let the normal flow resolve/pause the unit
|
|
211
|
+
}
|
|
212
|
+
ctx.ui.notify(`Empty-turn detected: LLM announced intent but called no tool. Prompting it to execute.`, "info");
|
|
213
|
+
const nudge = `Your last turn announced an action (e.g. "I'll write…" or "Let me call…") ` +
|
|
214
|
+
`but contained no tool call. The system records zero tool-use blocks for ` +
|
|
215
|
+
`that turn. Execute the announced action NOW as a tool call in this turn. ` +
|
|
216
|
+
`Do not describe it again. Retry ${count}/${MAX_EMPTY_TURN_RETRIES}.`;
|
|
217
|
+
try {
|
|
218
|
+
pi.sendMessage({ customType: "gsd-empty-turn-recovery", content: nudge, display: false }, { triggerTurn: true });
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
logWarning("guided", `empty-turn nudge sendMessage failed: ${e.message}`);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
@@ -125,7 +125,8 @@ function renderRoadmapMarkdown(milestone, slices) {
|
|
|
125
125
|
lines.push("");
|
|
126
126
|
for (const slice of slices) {
|
|
127
127
|
const done = isClosedStatus(slice.status) ? "x" : " ";
|
|
128
|
-
const
|
|
128
|
+
const cleanDepends = (slice.depends ?? []).map(d => d.replace(/^\[|\]$/g, '')).filter(d => /^[A-Za-z0-9][A-Za-z0-9-]*$/.test(d));
|
|
129
|
+
const depends = `[${cleanDepends.join(",")}]`;
|
|
129
130
|
const safeTitle = sanitizeInlineRoadmapText(slice.title || slice.id) || slice.id;
|
|
130
131
|
const safeRisk = normalizeRiskLevel(slice.risk);
|
|
131
132
|
// ADR-011: sketch slices get a `[sketch]` badge so the roadmap shows at a
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
+
import { toMcpWildcardToolName } from "./mcp-tool-name.js";
|
|
4
5
|
import { resolveModelMcpConfig } from "./preferences-mcp.js";
|
|
5
6
|
function isRecord(value) {
|
|
6
7
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
@@ -123,5 +124,5 @@ export function computeMcpDisallowedTools(modelId, mcpConfig, discoveredServers,
|
|
|
123
124
|
if (workflowServerName && !(entry.blocked_servers ?? []).includes(workflowServerName)) {
|
|
124
125
|
blocked.delete(workflowServerName);
|
|
125
126
|
}
|
|
126
|
-
return [...blocked].map(
|
|
127
|
+
return [...blocked].map(toMcpWildcardToolName);
|
|
127
128
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Shared parsing and formatting helpers for MCP-scoped tool names.
|
|
3
|
+
const MCP_TOOL_PREFIX = "mcp__";
|
|
4
|
+
export function parseMcpToolName(toolName) {
|
|
5
|
+
if (!toolName.startsWith(MCP_TOOL_PREFIX))
|
|
6
|
+
return null;
|
|
7
|
+
const toolSeparator = toolName.indexOf("__", MCP_TOOL_PREFIX.length);
|
|
8
|
+
if (toolSeparator < 0)
|
|
9
|
+
return null;
|
|
10
|
+
return {
|
|
11
|
+
serverName: toolName.slice(MCP_TOOL_PREFIX.length, toolSeparator),
|
|
12
|
+
toolName: toolName.slice(toolSeparator + 2),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function stripMcpToolPrefix(toolName) {
|
|
16
|
+
return parseMcpToolName(toolName)?.toolName ?? toolName;
|
|
17
|
+
}
|
|
18
|
+
export function toMcpToolName(serverName, toolName) {
|
|
19
|
+
return `${MCP_TOOL_PREFIX}${serverName}__${toolName}`;
|
|
20
|
+
}
|
|
21
|
+
export function toMcpWildcardToolName(serverName) {
|
|
22
|
+
return toMcpToolName(serverName, "*");
|
|
23
|
+
}
|
|
24
|
+
export function mcpToolMatchesBaseName(toolName, baseName) {
|
|
25
|
+
return parseMcpToolName(toolName)?.toolName === baseName;
|
|
26
|
+
}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
// Exports: parseDecisionsTable, parseRequirementsSections, migrateFromMarkdown
|
|
6
6
|
import { readFileSync, readdirSync, existsSync, statSync } from 'node:fs';
|
|
7
7
|
import { join } from 'node:path';
|
|
8
|
-
import { upsertDecision, upsertRequirement, insertArtifact, insertMilestone, insertSlice, insertTask,
|
|
8
|
+
import { upsertDecision, upsertRequirement, insertArtifact, insertMilestone, insertSlice, insertTask, transaction, updateMilestoneStatus, updateSliceStatus, _getAdapter, } from './gsd-db.js';
|
|
9
|
+
import { openWorkflowDatabasePath } from './db-workspace.js';
|
|
9
10
|
import { resolveGsdRootFile, resolveMilestoneFile, resolveSliceFile, resolveTasksDir, milestonesDir, gsdRoot, resolveTaskFiles, } from './paths.js';
|
|
10
11
|
import { findMilestoneIds } from './guided-flow.js';
|
|
11
12
|
import { parseRoadmap, parsePlan } from './parsers-legacy.js';
|
|
@@ -542,7 +543,7 @@ export function migrateHierarchyToDb(basePath) {
|
|
|
542
543
|
title: sliceEntry.title,
|
|
543
544
|
status: sliceStatus,
|
|
544
545
|
risk: sliceEntry.risk,
|
|
545
|
-
depends: sliceEntry.depends,
|
|
546
|
+
depends: (sliceEntry.depends ?? []).map(d => d.replace(/^\[|\]$/g, '')).filter(d => /^[A-Za-z0-9][A-Za-z0-9-]*$/.test(d)),
|
|
546
547
|
demo: sliceEntry.demo,
|
|
547
548
|
sequence: si + 1, // Preserve roadmap parse order (#3356)
|
|
548
549
|
isSketch: sliceEntry.isSketch ?? false, // ADR-011: preserve the `[sketch]` flag on re-import
|
|
@@ -628,7 +629,7 @@ export function migrateFromMarkdown(gsdDir) {
|
|
|
628
629
|
const dbPath = join(gsdRoot(gsdDir), 'gsd.db');
|
|
629
630
|
// Open DB if not already open
|
|
630
631
|
if (!_getAdapter()) {
|
|
631
|
-
|
|
632
|
+
openWorkflowDatabasePath(dbPath);
|
|
632
633
|
}
|
|
633
634
|
let decisions = 0;
|
|
634
635
|
let requirements = 0;
|
|
@@ -5,7 +5,7 @@ import { basename, dirname, join, resolve } from "node:path";
|
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import { ensureDbOpen } from "../bootstrap/dynamic-tools.js";
|
|
7
7
|
import { readCrashLock, isLockProcessAlive } from "../crash-recovery.js";
|
|
8
|
-
import {
|
|
8
|
+
import { closeWorkflowDatabase } from "../db-workspace.js";
|
|
9
9
|
import { readPausedSessionMetadata } from "../interrupted-session.js";
|
|
10
10
|
import { gsdRoot } from "../paths.js";
|
|
11
11
|
export class MigrationBlockedError extends Error {
|
|
@@ -110,6 +110,6 @@ export async function assertMigrationTargetAvailable(targetRoot) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
finally {
|
|
113
|
-
|
|
113
|
+
closeWorkflowDatabase();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { ensureDbOpen } from "./bootstrap/dynamic-tools.js";
|
|
3
|
-
import { getAllMilestones, getMilestoneSlices, getSliceTasks, isDbAvailable,
|
|
3
|
+
import { getAllMilestones, getMilestoneSlices, getSliceTasks, isDbAvailable, } from "./gsd-db.js";
|
|
4
|
+
import { refreshWorkflowDatabaseFromDisk } from "./db-workspace.js";
|
|
4
5
|
import { parsePlan, parseRoadmap } from "./parsers-legacy.js";
|
|
5
6
|
import { milestonesDir, resolveMilestoneFile, resolveSliceFile, } from "./paths.js";
|
|
6
7
|
function zeroCounts() {
|
|
@@ -124,7 +125,7 @@ export async function checkMarkdownHierarchyAgainstDb(basePath) {
|
|
|
124
125
|
// The markdown projections may have just been written by a workflow/MCP
|
|
125
126
|
// server in another process. Reopen before comparing so startup does not
|
|
126
127
|
// warn from a stale long-lived SQLite handle.
|
|
127
|
-
|
|
128
|
+
refreshWorkflowDatabaseFromDisk();
|
|
128
129
|
const dbScan = scanDbHierarchy();
|
|
129
130
|
const beforeDb = dbScan.counts;
|
|
130
131
|
const markdownEmpty = sameCounts(markdown, zeroCounts());
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Single proof surface for milestone closeout readiness/finality.
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { CLOSEOUT_CONSISTENCY_BLOCKED_REASON, checkCloseoutConsistencyGate, } from "./closeout-consistency-gate.js";
|
|
5
|
+
import { resolveExpectedArtifactPath } from "./auto-artifact-paths.js";
|
|
6
|
+
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
7
|
+
import { hasImplementationArtifacts } from "./milestone-implementation-evidence.js";
|
|
8
|
+
function blocked(reason, message) {
|
|
9
|
+
return {
|
|
10
|
+
ok: false,
|
|
11
|
+
reason,
|
|
12
|
+
recoveryReason: CLOSEOUT_CONSISTENCY_BLOCKED_REASON,
|
|
13
|
+
message,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function fromConsistencyResult(result) {
|
|
17
|
+
if (result.ok)
|
|
18
|
+
return result;
|
|
19
|
+
return {
|
|
20
|
+
ok: false,
|
|
21
|
+
reason: result.reason,
|
|
22
|
+
recoveryReason: result.recoveryReason,
|
|
23
|
+
message: result.message,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function checkSummaryArtifact(milestoneId, basePath) {
|
|
27
|
+
const summaryPath = resolveExpectedArtifactPath("complete-milestone", milestoneId, basePath);
|
|
28
|
+
if (!summaryPath || !existsSync(summaryPath)) {
|
|
29
|
+
return blocked("summary-artifact-missing", `Closeout proof blocked for ${milestoneId}: milestone summary artifact is missing.`);
|
|
30
|
+
}
|
|
31
|
+
const summaryOutcome = classifyMilestoneSummaryContent(readFileSync(summaryPath, "utf-8"));
|
|
32
|
+
if (summaryOutcome === "failure") {
|
|
33
|
+
return blocked("summary-artifact-failed", `Closeout proof blocked for ${milestoneId}: milestone summary records failed closeout.`);
|
|
34
|
+
}
|
|
35
|
+
return { ok: true };
|
|
36
|
+
}
|
|
37
|
+
function checkImplementationEvidence(milestoneId, basePath, requirement) {
|
|
38
|
+
const evidence = hasImplementationArtifacts(basePath, milestoneId);
|
|
39
|
+
if (requirement === "present" && evidence === "present")
|
|
40
|
+
return { ok: true };
|
|
41
|
+
if (requirement === "not-absent" && evidence !== "absent")
|
|
42
|
+
return { ok: true };
|
|
43
|
+
return blocked("implementation-evidence-missing", `Closeout proof blocked for ${milestoneId}: implementation evidence is ${evidence}.`);
|
|
44
|
+
}
|
|
45
|
+
export function proveMilestoneCloseout(milestoneId, options = {}) {
|
|
46
|
+
const consistency = checkCloseoutConsistencyGate(milestoneId, {
|
|
47
|
+
refreshFromDisk: options.refreshFromDisk,
|
|
48
|
+
allowOpenMilestone: options.allowOpenMilestone,
|
|
49
|
+
artifactBasePath: options.summaryArtifactBasePath,
|
|
50
|
+
});
|
|
51
|
+
if (!consistency.ok)
|
|
52
|
+
return fromConsistencyResult(consistency);
|
|
53
|
+
if (options.summaryArtifactBasePath) {
|
|
54
|
+
const summary = checkSummaryArtifact(milestoneId, options.summaryArtifactBasePath);
|
|
55
|
+
if (!summary.ok)
|
|
56
|
+
return summary;
|
|
57
|
+
}
|
|
58
|
+
if (options.implementationEvidence) {
|
|
59
|
+
const implementation = checkImplementationEvidence(milestoneId, options.implementationEvidence.basePath, options.implementationEvidence.requirement);
|
|
60
|
+
if (!implementation.ok)
|
|
61
|
+
return implementation;
|
|
62
|
+
}
|
|
63
|
+
return { ok: true };
|
|
64
|
+
}
|
|
65
|
+
export function formatCloseoutProofBlock(result) {
|
|
66
|
+
if (result.ok)
|
|
67
|
+
return "";
|
|
68
|
+
if (result.reason.startsWith("summary-") || result.reason.startsWith("implementation-")) {
|
|
69
|
+
return `${result.message} Recovery reason: ${result.recoveryReason}. Resolve the closeout evidence and run /gsd auto to retry.`;
|
|
70
|
+
}
|
|
71
|
+
return `${result.message} Recovery reason: ${result.recoveryReason}. Resolve the canonical DB state and run /gsd auto to retry.`;
|
|
72
|
+
}
|
|
@@ -9,13 +9,13 @@ import { parseRoadmap } from "./parsers-legacy.js";
|
|
|
9
9
|
import { resolveMilestoneFile } from "./paths.js";
|
|
10
10
|
import { getMilestone, getMilestoneSlices, isDbAvailable } from "./gsd-db.js";
|
|
11
11
|
import { isClosedStatus } from "./status-guards.js";
|
|
12
|
-
import { verifyExpectedArtifact } from "./auto-recovery.js";
|
|
13
12
|
import { runSafely } from "./auto-utils.js";
|
|
14
13
|
import { extractVerdict, isAcceptableUatVerdict } from "./verdict-parser.js";
|
|
15
14
|
import { logWarning } from "./workflow-logger.js";
|
|
16
15
|
import { hasImplementationArtifacts } from "./milestone-implementation-evidence.js";
|
|
17
16
|
import { buildCompleteMilestonePrompt } from "./auto-prompts.js";
|
|
18
|
-
import {
|
|
17
|
+
import { proveMilestoneCloseout } from "./milestone-closeout-proof.js";
|
|
18
|
+
import { resolveCanonicalMilestoneRoot } from "./worktree-manager.js";
|
|
19
19
|
import { commitPendingMilestoneCloseoutChanges, findMissingSummaries, isVerificationNotApplicable, readUatGateVerdict, } from "./auto-dispatch.js";
|
|
20
20
|
const COMPLETE_MILESTONE_DB_SETTLE_MS = 1500;
|
|
21
21
|
const COMPLETE_MILESTONE_DB_SETTLE_POLL_MS = 100;
|
|
@@ -29,8 +29,16 @@ export async function isMilestoneCloseoutSettled(mid, basePath) {
|
|
|
29
29
|
if (isDbAvailable()) {
|
|
30
30
|
const milestone = getMilestone(mid);
|
|
31
31
|
if (milestone && isClosedStatus(milestone.status)) {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const artifactBasePath = resolveCanonicalMilestoneRoot(basePath, mid);
|
|
33
|
+
const closeoutProof = proveMilestoneCloseout(mid, {
|
|
34
|
+
refreshFromDisk: true,
|
|
35
|
+
summaryArtifactBasePath: artifactBasePath,
|
|
36
|
+
implementationEvidence: {
|
|
37
|
+
basePath,
|
|
38
|
+
requirement: "not-absent",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
if (closeoutProof.ok) {
|
|
34
42
|
return true;
|
|
35
43
|
}
|
|
36
44
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Process-level transaction wrapper for milestone merge closeout.
|
|
3
|
+
export function runMilestoneMergeTransaction(deps, input) {
|
|
4
|
+
return deps.mergeMilestoneToMain(input.basePath, input.milestoneId, input.roadmapContent);
|
|
5
|
+
}
|
|
6
|
+
export function createMilestoneMergeTransaction(mergeMilestoneToMain) {
|
|
7
|
+
return function mergeMilestoneTransaction(basePath, milestoneId, roadmapContent) {
|
|
8
|
+
return runMilestoneMergeTransaction({ mergeMilestoneToMain }, { basePath, milestoneId, roadmapContent });
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Persist planned milestone roadmaps and their DB-backed projections.
|
|
3
|
+
import { clearParseCache } from "./files.js";
|
|
4
|
+
import { isClosedStatus } from "./status-guards.js";
|
|
5
|
+
import { transaction, getMilestone, getMilestoneSlices, getSlice, insertMilestone, insertSlice, upsertMilestonePlanning, upsertSlicePlanning, } from "./gsd-db.js";
|
|
6
|
+
import { invalidateStateCache } from "./state.js";
|
|
7
|
+
import { renderRoadmapFromDb } from "./markdown-renderer.js";
|
|
8
|
+
import { renderAllProjections } from "./workflow-projections.js";
|
|
9
|
+
import { writeManifest } from "./workflow-manifest.js";
|
|
10
|
+
import { appendEvent } from "./workflow-events.js";
|
|
11
|
+
import { logWarning } from "./workflow-logger.js";
|
|
12
|
+
function validatePlanPromotion(params) {
|
|
13
|
+
const existingMilestone = getMilestone(params.milestoneId);
|
|
14
|
+
if (existingMilestone && isClosedStatus(existingMilestone.status)) {
|
|
15
|
+
return `cannot re-plan milestone ${params.milestoneId}: it is already complete`;
|
|
16
|
+
}
|
|
17
|
+
// Guard: refuse to re-plan a milestone that would drop completed slices (#2960).
|
|
18
|
+
// Allow re-planning when all completed slices are still present in the
|
|
19
|
+
// incoming plan — their status is preserved below (#2558). Block only when
|
|
20
|
+
// the new plan omits a completed slice, which could shadow completed work.
|
|
21
|
+
const existingSlices = getMilestoneSlices(params.milestoneId);
|
|
22
|
+
const completedSlices = existingSlices.filter(s => isClosedStatus(s.status));
|
|
23
|
+
if (completedSlices.length > 0) {
|
|
24
|
+
const incomingSliceIds = new Set(params.slices.map(s => s.sliceId));
|
|
25
|
+
const droppedCompleted = completedSlices.filter(s => !incomingSliceIds.has(s.id));
|
|
26
|
+
if (droppedCompleted.length > 0) {
|
|
27
|
+
return `cannot re-plan milestone ${params.milestoneId}: ${droppedCompleted.length} completed slice(s) would be dropped (${droppedCompleted.map(s => s.id).join(", ")}). Use gsd_reassess_roadmap to modify the roadmap.`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Validate depends_on: all dependencies must exist and be complete
|
|
31
|
+
if (params.dependsOn && params.dependsOn.length > 0) {
|
|
32
|
+
for (const depId of params.dependsOn) {
|
|
33
|
+
const dep = getMilestone(depId);
|
|
34
|
+
if (!dep) {
|
|
35
|
+
return `depends_on references unknown milestone: ${depId}`;
|
|
36
|
+
}
|
|
37
|
+
if (!isClosedStatus(dep.status)) {
|
|
38
|
+
return `depends_on milestone ${depId} is not yet complete (status: ${dep.status})`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function writePlanRows(params) {
|
|
45
|
+
insertMilestone({
|
|
46
|
+
id: params.milestoneId,
|
|
47
|
+
title: params.title,
|
|
48
|
+
status: params.status ?? "active",
|
|
49
|
+
depends_on: params.dependsOn ?? [],
|
|
50
|
+
});
|
|
51
|
+
upsertMilestonePlanning(params.milestoneId, {
|
|
52
|
+
title: params.title,
|
|
53
|
+
status: params.status ?? "active",
|
|
54
|
+
depends_on: params.dependsOn ?? [],
|
|
55
|
+
vision: params.vision,
|
|
56
|
+
successCriteria: params.successCriteria,
|
|
57
|
+
keyRisks: params.keyRisks,
|
|
58
|
+
proofStrategy: params.proofStrategy,
|
|
59
|
+
verificationContract: params.verificationContract,
|
|
60
|
+
verificationIntegration: params.verificationIntegration,
|
|
61
|
+
verificationOperational: params.verificationOperational,
|
|
62
|
+
verificationUat: params.verificationUat,
|
|
63
|
+
definitionOfDone: params.definitionOfDone,
|
|
64
|
+
requirementCoverage: params.requirementCoverage,
|
|
65
|
+
boundaryMapMarkdown: params.boundaryMapMarkdown,
|
|
66
|
+
});
|
|
67
|
+
for (let i = 0; i < params.slices.length; i++) {
|
|
68
|
+
const slice = params.slices[i];
|
|
69
|
+
// Preserve completed/done status on re-plan (#2558).
|
|
70
|
+
// Without this, a re-plan after milestone transition would reset
|
|
71
|
+
// already-completed slices back to "pending".
|
|
72
|
+
const existing = getSlice(params.milestoneId, slice.sliceId);
|
|
73
|
+
const status = existing && (existing.status === "complete" || existing.status === "done")
|
|
74
|
+
? existing.status
|
|
75
|
+
: "pending";
|
|
76
|
+
insertSlice({
|
|
77
|
+
id: slice.sliceId,
|
|
78
|
+
milestoneId: params.milestoneId,
|
|
79
|
+
title: slice.title,
|
|
80
|
+
status,
|
|
81
|
+
risk: slice.risk,
|
|
82
|
+
depends: slice.depends,
|
|
83
|
+
demo: slice.demo,
|
|
84
|
+
sequence: i + 1, // Preserve agent-ordered sequence (#3356)
|
|
85
|
+
// ADR-011: pass undefined through so ON CONFLICT preserves existing values
|
|
86
|
+
// when the caller omitted the fields on a re-plan.
|
|
87
|
+
isSketch: slice.isSketch,
|
|
88
|
+
sketchScope: slice.sketchScope,
|
|
89
|
+
});
|
|
90
|
+
upsertSlicePlanning(params.milestoneId, slice.sliceId, {
|
|
91
|
+
goal: slice.goal,
|
|
92
|
+
successCriteria: slice.successCriteria,
|
|
93
|
+
proofLevel: slice.proofLevel,
|
|
94
|
+
integrationClosure: slice.integrationClosure,
|
|
95
|
+
observabilityImpact: slice.observabilityImpact,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function renderPlanArtifacts(basePath, params) {
|
|
100
|
+
try {
|
|
101
|
+
const renderResult = await renderRoadmapFromDb(basePath, params.milestoneId);
|
|
102
|
+
return renderResult.roadmapPath;
|
|
103
|
+
}
|
|
104
|
+
catch (renderErr) {
|
|
105
|
+
logWarning("tool", `plan_milestone — render failed (DB rows preserved for debugging): ${renderErr.message}`);
|
|
106
|
+
invalidateStateCache();
|
|
107
|
+
return { error: `render failed: ${renderErr.message}` };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function runPostPlanHooks(basePath, params) {
|
|
111
|
+
try {
|
|
112
|
+
await renderAllProjections(basePath, params.milestoneId);
|
|
113
|
+
writeManifest(basePath);
|
|
114
|
+
appendEvent(basePath, {
|
|
115
|
+
cmd: "plan-milestone",
|
|
116
|
+
params: { milestoneId: params.milestoneId },
|
|
117
|
+
ts: new Date().toISOString(),
|
|
118
|
+
actor: "agent",
|
|
119
|
+
actor_name: params.actorName,
|
|
120
|
+
trigger_reason: params.triggerReason,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch (hookErr) {
|
|
124
|
+
logWarning("tool", `plan-milestone post-mutation hook warning: ${hookErr.message}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export async function persistMilestonePlan(params, basePath) {
|
|
128
|
+
// ── Guards + DB writes inside a single transaction (prevents TOCTOU) ───
|
|
129
|
+
// Guards must be inside the transaction so the state they check cannot
|
|
130
|
+
// change between the read and the write (#2723).
|
|
131
|
+
let guardError = null;
|
|
132
|
+
try {
|
|
133
|
+
transaction(() => {
|
|
134
|
+
guardError = validatePlanPromotion(params);
|
|
135
|
+
if (guardError)
|
|
136
|
+
return;
|
|
137
|
+
writePlanRows(params);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
return { error: `db write failed: ${err.message}` };
|
|
142
|
+
}
|
|
143
|
+
if (guardError) {
|
|
144
|
+
return { error: guardError };
|
|
145
|
+
}
|
|
146
|
+
const roadmapPath = await renderPlanArtifacts(basePath, params);
|
|
147
|
+
if (typeof roadmapPath !== "string")
|
|
148
|
+
return roadmapPath;
|
|
149
|
+
invalidateStateCache();
|
|
150
|
+
clearParseCache();
|
|
151
|
+
await runPostPlanHooks(basePath, params);
|
|
152
|
+
return {
|
|
153
|
+
milestoneId: params.milestoneId,
|
|
154
|
+
roadmapPath,
|
|
155
|
+
};
|
|
156
|
+
}
|