@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
|
@@ -1001,6 +1001,11 @@ export function upsertMilestonePlanning(milestoneId, planning) {
|
|
|
1001
1001
|
export function insertSlice(s) {
|
|
1002
1002
|
if (!currentDb)
|
|
1003
1003
|
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1004
|
+
const SLICE_ID_RE = /^[A-Za-z0-9][A-Za-z0-9-]*$/;
|
|
1005
|
+
const invalidDep = (s.depends ?? []).find(d => !SLICE_ID_RE.test(d));
|
|
1006
|
+
if (invalidDep !== undefined) {
|
|
1007
|
+
throw new GSDError(GSD_STALE_STATE, `insertSlice: depends element "${invalidDep}" is not a valid slice ID`);
|
|
1008
|
+
}
|
|
1004
1009
|
currentDb.prepare(`INSERT INTO slices (
|
|
1005
1010
|
milestone_id, id, title, status, risk, depends, demo, created_at,
|
|
1006
1011
|
goal, success_criteria, proof_level, integration_closure, observability_impact, target_repositories, sequence,
|
|
@@ -2124,6 +2129,13 @@ export function deleteMilestone(milestoneId) {
|
|
|
2124
2129
|
export function updateSliceFields(milestoneId, sliceId, fields) {
|
|
2125
2130
|
if (!currentDb)
|
|
2126
2131
|
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
2132
|
+
const SLICE_ID_RE = /^[A-Za-z0-9][A-Za-z0-9-]*$/;
|
|
2133
|
+
if (fields.depends !== undefined) {
|
|
2134
|
+
const invalidDep = fields.depends.find(d => !SLICE_ID_RE.test(d));
|
|
2135
|
+
if (invalidDep !== undefined) {
|
|
2136
|
+
throw new GSDError(GSD_STALE_STATE, `updateSliceFields: depends element "${invalidDep}" is not a valid slice ID`);
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2127
2139
|
currentDb.prepare(`UPDATE slices SET
|
|
2128
2140
|
title = COALESCE(:title, title),
|
|
2129
2141
|
risk = COALESCE(:risk, risk),
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { showNextAction } from "../shared/tui.js";
|
|
9
9
|
import { notifyDiscussNeedsInteractiveMenu, notifySmartEntryNeedsInteractiveMenu, requiresInteractiveMenu, isInteractiveCommandContext, } from "./command-feedback.js";
|
|
10
10
|
import { loadFile, saveFile } from "./files.js";
|
|
11
|
-
import { isDbAvailable, getMilestone, getMilestoneSlices
|
|
11
|
+
import { isDbAvailable, getMilestone, getMilestoneSlices } from "./gsd-db.js";
|
|
12
12
|
import { parseRoadmapSlices } from "./roadmap-slices.js";
|
|
13
13
|
import { loadPrompt, inlineTemplate } from "./prompt-loader.js";
|
|
14
14
|
import { buildCompleteSlicePrompt, buildDiscussMilestonePrompt, buildExecuteTaskPrompt, buildPlanMilestonePrompt, buildPlanSlicePrompt, buildSkillActivationBlock, } from "./auto-prompts.js";
|
|
@@ -20,9 +20,9 @@ import { assessInterruptedSession, formatInterruptedSessionRunningMessage, forma
|
|
|
20
20
|
import { listUnitRuntimeRecords, clearUnitRuntimeRecord, isInFlightRuntimePhase } from "./unit-runtime.js";
|
|
21
21
|
import { resolveExpectedArtifactPath } from "./auto.js";
|
|
22
22
|
import { gsdHome } from "./gsd-home.js";
|
|
23
|
-
import { gsdRoot, milestonesDir, resolveMilestoneFile,
|
|
23
|
+
import { gsdRoot, milestonesDir, resolveMilestoneFile, resolveSliceFile, resolveSlicePath, resolveGsdRootFile, relGsdRootFile, relMilestoneFile, relSliceFile, } from "./paths.js";
|
|
24
24
|
import { join } from "node:path";
|
|
25
|
-
import { readFileSync, existsSync, mkdirSync, readdirSync, rmSync
|
|
25
|
+
import { readFileSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
|
|
26
26
|
import { readSessionLockData, isSessionLockProcessAlive } from "./session-lock.js";
|
|
27
27
|
import { nativeAddAll, nativeCommit, nativeHasCommittedHead, nativeIsRepo, nativeInit } from "./native-git-bridge.js";
|
|
28
28
|
import { isInheritedRepo } from "./repo-identity.js";
|
|
@@ -47,10 +47,13 @@ import { DISCUSS_TOOLS_ALLOWLIST } from "./constants.js";
|
|
|
47
47
|
import { getWorkflowTransportSupportError, getRequiredWorkflowToolsForGuidedUnit, supportsStructuredQuestions, } from "./workflow-mcp.js";
|
|
48
48
|
import { runPreparation, formatCodebaseBrief, formatPriorContextBrief, } from "./preparation.js";
|
|
49
49
|
import { verifyExpectedArtifact } from "./auto-recovery.js";
|
|
50
|
-
import { getPendingGate
|
|
50
|
+
import { getPendingGate } from "./bootstrap/write-gate.js";
|
|
51
51
|
import { _getPendingAutoStart, deletePendingAutoStart, hasPendingAutoStart, setPendingAutoStart, } from "./pending-auto-start.js";
|
|
52
52
|
import { clearGuidedUnitContext, setGuidedUnitContext } from "./guided-unit-context.js";
|
|
53
|
+
import { scheduleAutoStartAfterIdle } from "./discussion-handoff.js";
|
|
54
|
+
export { maybeHandleEmptyIntentTurn, maybeHandleReadyPhraseWithoutFiles, resetEmptyTurnCounter, } from "./guided-unit-completion.js";
|
|
53
55
|
export { _getPendingAutoStart, clearPendingAutoStart, getDiscussionMilestoneId, setPendingAutoStart, } from "./pending-auto-start.js";
|
|
56
|
+
export { checkAutoStartAfterDiscuss } from "./discussion-handoff.js";
|
|
54
57
|
export function shouldSkipGitBootstrapAfterInit(result) {
|
|
55
58
|
return result.gitEnabled === false;
|
|
56
59
|
}
|
|
@@ -58,27 +61,12 @@ export function shouldSkipGitBootstrapAfterInit(result) {
|
|
|
58
61
|
export { MILESTONE_ID_RE, generateMilestoneSuffix, nextMilestoneId, extractMilestoneSeq, parseMilestoneId, milestoneIdSort, maxMilestoneNum, findMilestoneIds, reserveMilestoneId, claimReservedId, getReservedMilestoneIds, clearReservedMilestoneIds, } from "./milestone-ids.js";
|
|
59
62
|
export { showQueue, handleQueueReorder, showQueueAdd, buildExistingMilestonesContext, } from "./guided-flow-queue.js";
|
|
60
63
|
import { logWarning } from "./workflow-logger.js";
|
|
61
|
-
import { readManifest } from "./workflow-manifest.js";
|
|
62
64
|
import { deleteRuntimeKv } from "./db/runtime-kv.js";
|
|
63
65
|
import { PAUSED_SESSION_KV_KEY } from "./interrupted-session.js";
|
|
64
66
|
import { buildWorkflowDispatchContent } from "./workflow-protocol.js";
|
|
65
67
|
import { isFullGsdToolSurfaceRequested, restoreGsdWorkflowTools, scopeGsdWorkflowToolsForDispatch } from "./bootstrap/register-hooks.js";
|
|
66
68
|
import { resolveActiveTaskChoiceRoute, } from "./smart-entry-routing.js";
|
|
67
69
|
export { resolveGuidedExecuteLaunchMode } from "./smart-entry-routing.js";
|
|
68
|
-
function scheduleAutoStartAfterIdle(ctx, pi, basePath, verboseMode, options, launch = startAutoDetached) {
|
|
69
|
-
const waitForIdle = typeof ctx.waitForIdle === "function"
|
|
70
|
-
? ctx.waitForIdle.bind(ctx)
|
|
71
|
-
: async () => { };
|
|
72
|
-
void waitForIdle()
|
|
73
|
-
.then(() => {
|
|
74
|
-
setTimeout(() => launch(ctx, pi, basePath, verboseMode, options), 0);
|
|
75
|
-
})
|
|
76
|
-
.catch((err) => {
|
|
77
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
78
|
-
ctx.ui.notify(`Auto-start failed while waiting for the prior turn to settle: ${message}`, "error");
|
|
79
|
-
logWarning("guided", `auto-start idle wait failed: ${message}`);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
70
|
export const _scheduleAutoStartAfterIdleForTest = scheduleAutoStartAfterIdle;
|
|
83
71
|
// ─── Scope-based validator wrappers ──────────────────────────────────────────
|
|
84
72
|
// These thin wrappers accept a MilestoneScope so callers that already hold a
|
|
@@ -178,98 +166,11 @@ export function _roadmapHasParseableSlicesForTest(roadmapContent) {
|
|
|
178
166
|
return false;
|
|
179
167
|
return parseRoadmapSlices(roadmapContent).length > 0;
|
|
180
168
|
}
|
|
181
|
-
function hasExecutablePlanForHandoff(milestoneId, roadmapFile) {
|
|
182
|
-
if (isDbAvailable()) {
|
|
183
|
-
return getMilestoneSlices(milestoneId).length > 0;
|
|
184
|
-
}
|
|
185
|
-
if (!roadmapFile)
|
|
186
|
-
return false;
|
|
187
|
-
try {
|
|
188
|
-
return parseRoadmapSlices(readFileSync(roadmapFile, "utf-8")).length > 0;
|
|
189
|
-
}
|
|
190
|
-
catch (e) {
|
|
191
|
-
logWarning("guided", `failed to parse roadmap slices for ${milestoneId}: ${e.message}`);
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function formatAcceptedDiscussHandoffMessage(milestoneId, contextFile, hasExecutablePlan) {
|
|
196
|
-
if (hasExecutablePlan)
|
|
197
|
-
return `Milestone ${milestoneId} ready.`;
|
|
198
|
-
if (contextFile)
|
|
199
|
-
return `Milestone ${milestoneId} context captured. Continuing the planning pipeline.`;
|
|
200
|
-
return `Milestone ${milestoneId} planning artifacts captured. Continuing the planning pipeline.`;
|
|
201
|
-
}
|
|
202
|
-
function manifestContainsMilestone(basePath, milestoneId) {
|
|
203
|
-
try {
|
|
204
|
-
const manifest = readManifest(basePath);
|
|
205
|
-
return (Array.isArray(manifest?.milestones) &&
|
|
206
|
-
manifest.milestones.some(m => m.id === milestoneId));
|
|
207
|
-
}
|
|
208
|
-
catch (e) {
|
|
209
|
-
logWarning("guided", `R3b: failed to read state manifest: ${e.message}`);
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
function notifyDbRowRecoveryFailed(entry) {
|
|
214
|
-
entry.ctx.ui.notify(`Milestone ${entry.milestoneId}: DB row recovery failed ${entry.r3bRecoveryCount} times. ` +
|
|
215
|
-
`Re-run /gsd to reset the recovery counter, or run /gsd-debug to diagnose without resetting.`, "error");
|
|
216
|
-
}
|
|
217
|
-
function noteDbRowRecoveryMiss(entry) {
|
|
218
|
-
entry.r3bRecoveryCount += 1;
|
|
219
|
-
if (entry.r3bRecoveryCount >= MAX_DB_ROW_RECOVERIES) {
|
|
220
|
-
notifyDbRowRecoveryFailed(entry);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
function ensureMilestoneRowForAcceptedHandoff(entry, contextFile) {
|
|
224
|
-
if (!isDbAvailable())
|
|
225
|
-
return true;
|
|
226
|
-
const { basePath, milestoneId } = entry;
|
|
227
|
-
const milestoneRow = getMilestone(milestoneId);
|
|
228
|
-
if (milestoneRow)
|
|
229
|
-
return true;
|
|
230
|
-
if (manifestContainsMilestone(basePath, milestoneId)) {
|
|
231
|
-
logWarning("guided", `R3b: getMilestone(${milestoneId}) returned null but manifest has the row — treating as stale read`);
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
if (!contextFile) {
|
|
235
|
-
entry.ctx.ui.notify(`Milestone ${milestoneId}: discuss artifacts on disk but no DB row exists. ` +
|
|
236
|
-
`PROJECT.md may have failed to register milestones. ` +
|
|
237
|
-
`Re-save PROJECT.md with canonical "- [ ] M001: Title — One-liner" lines, ` +
|
|
238
|
-
`then re-run /gsd to recover.`, "error");
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
if (entry.r3bRecoveryCount >= MAX_DB_ROW_RECOVERIES) {
|
|
242
|
-
logWarning("guided", `R3b: milestone ${milestoneId} DB-row recovery limit reached ` +
|
|
243
|
-
`(${entry.r3bRecoveryCount}/${MAX_DB_ROW_RECOVERIES}); user already notified`);
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
logWarning("guided", `R3b: ${milestoneId} has CONTEXT.md but no DB row — inserting placeholder "queued" row ` +
|
|
247
|
-
`(attempt ${entry.r3bRecoveryCount + 1}/${MAX_DB_ROW_RECOVERIES})`);
|
|
248
|
-
try {
|
|
249
|
-
insertMilestone({ id: milestoneId, title: milestoneId, status: "queued" });
|
|
250
|
-
}
|
|
251
|
-
catch (e) {
|
|
252
|
-
logWarning("guided", `R3b: insertMilestone failed: ${e.message}`);
|
|
253
|
-
}
|
|
254
|
-
if (getMilestone(milestoneId))
|
|
255
|
-
return true;
|
|
256
|
-
noteDbRowRecoveryMiss(entry);
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
169
|
// ─── Commit Instruction Helpers ──────────────────────────────────────────────
|
|
260
170
|
/** Build commit instruction for planning prompts. .gsd/ is managed externally and always gitignored. */
|
|
261
171
|
function buildDocsCommitInstruction(_message) {
|
|
262
172
|
return "Do not commit planning artifacts — .gsd/ is managed externally.";
|
|
263
173
|
}
|
|
264
|
-
// #4573: cap for how many times we nudge the LLM after a premature ready
|
|
265
|
-
// phrase before giving up and asking the user to re-run /gsd.
|
|
266
|
-
const MAX_READY_REJECTS = 2;
|
|
267
|
-
// Cap failed in-flight DB row repair attempts before escalating to the user.
|
|
268
|
-
const MAX_DB_ROW_RECOVERIES = 3;
|
|
269
|
-
// #4573: matches the canonical ready phrase the discuss prompt asks the LLM
|
|
270
|
-
// to emit. Accepts any M-prefixed milestone ID (three digits + optional
|
|
271
|
-
// suffix) with optional trailing punctuation.
|
|
272
|
-
const READY_PHRASE_RE = /\bMilestone\s+M\d{3}[A-Z0-9-]*\s+ready\.?/i;
|
|
273
174
|
const pendingDeepProjectSetupMap = new Map();
|
|
274
175
|
const USER_DRIVEN_DEEP_SETUP_UNITS = new Set([
|
|
275
176
|
"discuss-project",
|
|
@@ -464,366 +365,6 @@ async function dispatchNextDeepProjectSetupStage(entry) {
|
|
|
464
365
|
await dispatchWorkflow(entry.pi, `${result.prompt}\n\n${FOREGROUND_DEEP_SETUP_QUESTION_POLICY}`, "gsd-run", entry.ctx, result.unitType, { basePath: entry.basePath });
|
|
465
366
|
return true;
|
|
466
367
|
}
|
|
467
|
-
/** Called from agent_end to check if auto-mode should start after discuss */
|
|
468
|
-
export function checkAutoStartAfterDiscuss(lookupBasePath) {
|
|
469
|
-
const entry = _getPendingAutoStart(lookupBasePath);
|
|
470
|
-
if (!entry)
|
|
471
|
-
return false;
|
|
472
|
-
const { ctx, pi, basePath, milestoneId, step } = entry;
|
|
473
|
-
// Gate 1: Primary milestone must have CONTEXT.md or ROADMAP.md
|
|
474
|
-
// The "discuss" path creates CONTEXT.md; the "plan" path creates ROADMAP.md.
|
|
475
|
-
// Use pinned scope (immune to cwd-drift) for existence checks.
|
|
476
|
-
const contextFilePath = entry.scope.contextFile();
|
|
477
|
-
const roadmapFilePath = entry.scope.roadmapFile();
|
|
478
|
-
const contextFile = existsSync(contextFilePath) ? contextFilePath : null;
|
|
479
|
-
const roadmapFile = existsSync(roadmapFilePath) ? roadmapFilePath : null;
|
|
480
|
-
if (!contextFile && !roadmapFile)
|
|
481
|
-
return false; // neither artifact yet — keep waiting
|
|
482
|
-
// Gate 1a: a depth-verification gate is still pending for THIS milestone — the
|
|
483
|
-
// LLM emitted the confirmation question (via ask_user_questions or plain chat)
|
|
484
|
-
// but the user has not answered yet. Advancing now would skip the gate and
|
|
485
|
-
// race ahead with unverified context.
|
|
486
|
-
const basePathForGate = entry.scope.workspace.projectRoot;
|
|
487
|
-
const pendingGateId = getPendingGate(basePathForGate);
|
|
488
|
-
if (pendingGateId) {
|
|
489
|
-
const pendingMilestoneId = extractDepthVerificationMilestoneId(pendingGateId);
|
|
490
|
-
// Block advancement if the gate is for THIS milestone, OR if it's a
|
|
491
|
-
// project/requirements gate (no milestone id encoded) for the deep setup flow.
|
|
492
|
-
const isProjectGate = pendingGateId === "depth_verification_project_confirm" ||
|
|
493
|
-
pendingGateId === "depth_verification_requirements_confirm" ||
|
|
494
|
-
pendingGateId === "depth_verification_research_decision_confirm";
|
|
495
|
-
if (pendingMilestoneId === milestoneId || isProjectGate) {
|
|
496
|
-
return false;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
// Gate 1b: accept the in-flight discuss handoff. A queued DB row with pinned
|
|
500
|
-
// CONTEXT.md is Discussion Complete, Planning Pending, not a plan-blocked
|
|
501
|
-
// failure. If the row is missing, only this pending handoff may repair it.
|
|
502
|
-
if (!ensureMilestoneRowForAcceptedHandoff(entry, contextFile))
|
|
503
|
-
return false;
|
|
504
|
-
// Gate 2: Multi-milestone completeness warning
|
|
505
|
-
// Parse PROJECT.md for milestone sequence, warn if any are missing context.
|
|
506
|
-
// Don't block — milestones can be intentionally queued without context.
|
|
507
|
-
const projectFile = resolveGsdRootFile(basePath, "PROJECT");
|
|
508
|
-
let projectIds = [];
|
|
509
|
-
if (projectFile) {
|
|
510
|
-
try {
|
|
511
|
-
const projectContent = readFileSync(projectFile, "utf-8");
|
|
512
|
-
projectIds = parseMilestoneSequenceFromProject(projectContent);
|
|
513
|
-
if (projectIds.length > 1) {
|
|
514
|
-
const missing = projectIds.filter(id => {
|
|
515
|
-
const hasContext = !!resolveMilestoneFile(basePath, id, "CONTEXT");
|
|
516
|
-
const hasDraft = !!resolveMilestoneFile(basePath, id, "CONTEXT-DRAFT");
|
|
517
|
-
const hasDir = existsSync(join(gsdRoot(basePath), "milestones", id));
|
|
518
|
-
return !hasContext && !hasDraft && !hasDir;
|
|
519
|
-
});
|
|
520
|
-
if (missing.length > 0) {
|
|
521
|
-
ctx.ui.notify(`Multi-milestone validation: ${missing.join(", ")} not found in filesystem. ` +
|
|
522
|
-
`Discussion may not have completed all readiness gates.`, "warning");
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
catch (e) {
|
|
527
|
-
logWarning("guided", `PROJECT.md parsing failed: ${e.message}`);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
// Gate 3: Discussion manifest process verification (multi-milestone only)
|
|
531
|
-
// The LLM writes DISCUSSION-MANIFEST.json after each Phase 3 gate decision.
|
|
532
|
-
// When it exists, validate it before auto-starting. Project history alone is
|
|
533
|
-
// not a reliable signal for the current discussion mode.
|
|
534
|
-
const manifestPath = join(entry.scope.workspace.contract.projectGsd, "DISCUSSION-MANIFEST.json");
|
|
535
|
-
if (existsSync(manifestPath)) {
|
|
536
|
-
try {
|
|
537
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
538
|
-
const total = typeof manifest.total === "number" ? manifest.total : 0;
|
|
539
|
-
const completed = typeof manifest.gates_completed === "number" ? manifest.gates_completed : 0;
|
|
540
|
-
if (total > 1 && completed < total) {
|
|
541
|
-
// Discussion not complete — block auto-start until all gates are done
|
|
542
|
-
return false;
|
|
543
|
-
}
|
|
544
|
-
// Cross-check manifest milestones against PROJECT.md if available
|
|
545
|
-
if (projectIds.length > 0) {
|
|
546
|
-
const manifestIds = Object.keys(manifest.milestones ?? {});
|
|
547
|
-
const untracked = projectIds.filter(id => !manifestIds.includes(id));
|
|
548
|
-
if (untracked.length > 0) {
|
|
549
|
-
ctx.ui.notify(`Discussion manifest missing gates for: ${untracked.join(", ")}`, "warning");
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
catch (e) {
|
|
554
|
-
logWarning("guided", `discussion manifest verification failed: ${e.message}`);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
// Draft promotion cleanup: if a CONTEXT-DRAFT.md exists alongside the new
|
|
558
|
-
// CONTEXT.md, delete the draft — it's been consumed by the discussion.
|
|
559
|
-
try {
|
|
560
|
-
const draftFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT-DRAFT");
|
|
561
|
-
if (draftFile)
|
|
562
|
-
unlinkSync(draftFile);
|
|
563
|
-
}
|
|
564
|
-
catch (e) {
|
|
565
|
-
logWarning("guided", `CONTEXT-DRAFT.md unlink failed: ${e.message}`);
|
|
566
|
-
}
|
|
567
|
-
// Cleanup: remove discussion manifest after auto-start (only needed during discussion)
|
|
568
|
-
if (existsSync(manifestPath)) {
|
|
569
|
-
try {
|
|
570
|
-
unlinkSync(manifestPath);
|
|
571
|
-
}
|
|
572
|
-
catch (e) {
|
|
573
|
-
logWarning("guided", `manifest unlink failed: ${e.message}`);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
deletePendingAutoStart(basePath);
|
|
577
|
-
const hasExecutablePlan = hasExecutablePlanForHandoff(milestoneId, roadmapFile);
|
|
578
|
-
ctx.ui.notify(formatAcceptedDiscussHandoffMessage(milestoneId, contextFile, hasExecutablePlan), "success");
|
|
579
|
-
if (entry.startAuto !== false) {
|
|
580
|
-
scheduleAutoStartAfterIdle(ctx, pi, basePath, false, { step: step ?? true });
|
|
581
|
-
}
|
|
582
|
-
return true;
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* Extract the concatenated text content from an assistant message, whether it
|
|
586
|
-
* stores content as a string or as an array of text blocks.
|
|
587
|
-
*/
|
|
588
|
-
function extractAssistantText(msg) {
|
|
589
|
-
if (!msg)
|
|
590
|
-
return "";
|
|
591
|
-
const content = msg.content;
|
|
592
|
-
if (typeof content === "string")
|
|
593
|
-
return content;
|
|
594
|
-
if (!Array.isArray(content))
|
|
595
|
-
return "";
|
|
596
|
-
const parts = [];
|
|
597
|
-
for (const block of content) {
|
|
598
|
-
if (!block || typeof block !== "object")
|
|
599
|
-
continue;
|
|
600
|
-
if (block.type === "text" && typeof block.text === "string")
|
|
601
|
-
parts.push(block.text);
|
|
602
|
-
}
|
|
603
|
-
return parts.join("\n");
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Return true if the assistant message contains any tool-use block.
|
|
607
|
-
*
|
|
608
|
-
* The canonical pi-ai `AssistantMessage.content` (see packages/pi-ai/src/types.ts)
|
|
609
|
-
* uses `type: "toolCall"` and `type: "serverToolUse"` for tool invocations —
|
|
610
|
-
* every provider (anthropic-direct, claude-code-cli, openai, etc.) normalizes
|
|
611
|
-
* incoming tool blocks into these two shapes before they reach guided-flow.
|
|
612
|
-
*
|
|
613
|
-
* The Anthropic API wire shape `"tool_use"` / `"server_tool_use"` does NOT appear
|
|
614
|
-
* in the internal AssistantMessage — those literals are only used when sending
|
|
615
|
-
* messages back out to the Anthropic API. Matching them here was a latent bug:
|
|
616
|
-
* `hasToolUse` returned `false` for every real tool call, which let the
|
|
617
|
-
* empty-turn nudge fire and pre-empt MCP tools that block on the user
|
|
618
|
-
* (e.g. `ask_user_questions`). See investigation in PR for #4658.
|
|
619
|
-
*/
|
|
620
|
-
function hasToolUse(msg) {
|
|
621
|
-
if (!msg)
|
|
622
|
-
return false;
|
|
623
|
-
const content = msg.content;
|
|
624
|
-
if (!Array.isArray(content))
|
|
625
|
-
return false;
|
|
626
|
-
return content.some((b) => b &&
|
|
627
|
-
typeof b === "object" &&
|
|
628
|
-
(b.type === "toolCall" || b.type === "serverToolUse"));
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* #4573 — Detect and recover from the "ready phrase without files" failure mode.
|
|
632
|
-
*
|
|
633
|
-
* When the LLM emits "Milestone {{id}} ready." but has not written the
|
|
634
|
-
* milestone CONTEXT/ROADMAP artifacts, `checkAutoStartAfterDiscuss()` silently
|
|
635
|
-
* returns false and the next /gsd invocation loops into the "All milestones
|
|
636
|
-
* complete" warning.
|
|
637
|
-
*
|
|
638
|
-
* This function, called from `handleAgentEnd` after `checkAutoStartAfterDiscuss`
|
|
639
|
-
* returns false, pattern-matches the ready phrase on the last assistant message.
|
|
640
|
-
* If it fired AND neither the canonical M###-CONTEXT.md/M###-ROADMAP.md nor
|
|
641
|
-
* legacy CONTEXT.md/ROADMAP.md files exist, it:
|
|
642
|
-
* 1. Notifies the user that the signal was rejected.
|
|
643
|
-
* 2. Injects a system message via `pi.sendMessage(..., {triggerTurn:true})`
|
|
644
|
-
* telling the LLM the signal was premature and to emit the writes now.
|
|
645
|
-
* 3. Caps at `MAX_READY_REJECTS` per-entry; beyond that, gives up and asks
|
|
646
|
-
* the user to re-run /gsd.
|
|
647
|
-
*
|
|
648
|
-
* Returns true when a nudge (or give-up) was emitted, signaling the caller to
|
|
649
|
-
* skip `resolveAgentEnd`.
|
|
650
|
-
*/
|
|
651
|
-
export function maybeHandleReadyPhraseWithoutFiles(event, lookupBasePath) {
|
|
652
|
-
const entry = _getPendingAutoStart(lookupBasePath);
|
|
653
|
-
if (!entry)
|
|
654
|
-
return false;
|
|
655
|
-
const { ctx, pi, basePath, milestoneId } = entry;
|
|
656
|
-
// Gate: last assistant message must contain the ready phrase
|
|
657
|
-
const lastMsg = event.messages[event.messages.length - 1];
|
|
658
|
-
const text = extractAssistantText(lastMsg);
|
|
659
|
-
if (!READY_PHRASE_RE.test(text))
|
|
660
|
-
return false;
|
|
661
|
-
// Bust paths.ts cached dir listings before checking for fresh writes. The
|
|
662
|
-
// LLM's Write tool calls do not invalidate paths.ts caches, so a stale
|
|
663
|
-
// listing taken before the milestone dir or its CONTEXT/ROADMAP files
|
|
664
|
-
// existed would falsely report the artifacts as missing and trigger the
|
|
665
|
-
// 3-strike "ready without files" abort even though the writes succeeded.
|
|
666
|
-
clearPathCache();
|
|
667
|
-
// Gate: artifacts must still be missing — if they exist, the happy path
|
|
668
|
-
// already fired and we have nothing to do.
|
|
669
|
-
const contextFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT");
|
|
670
|
-
const roadmapFile = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
671
|
-
if (contextFile || roadmapFile)
|
|
672
|
-
return false;
|
|
673
|
-
// Diagnostic: when the cached resolver reports both files missing, also probe
|
|
674
|
-
// the canonical paths with uncached existsSync so we can tell whether the
|
|
675
|
-
// recovery is firing on real-missing files or a path-resolution miss
|
|
676
|
-
// (basePath/symlink mismatch, stale cache despite agent-end-recovery flush,
|
|
677
|
-
// legacy descriptor dir not matching, etc.).
|
|
678
|
-
try {
|
|
679
|
-
const mDir = resolveMilestonePath(basePath, milestoneId);
|
|
680
|
-
const canonicalCtx = mDir ? join(mDir, `${milestoneId}-CONTEXT.md`) : null;
|
|
681
|
-
const canonicalRoadmap = mDir ? join(mDir, `${milestoneId}-ROADMAP.md`) : null;
|
|
682
|
-
logWarning("guided", `ready-phrase-reject diagnostic mid=${milestoneId} basePath=${basePath} ` +
|
|
683
|
-
`mDir=${mDir ?? "null"} ` +
|
|
684
|
-
`canonical-ctx=${canonicalCtx ?? "null"} ctx-exists=${canonicalCtx ? existsSync(canonicalCtx) : "n/a"} ` +
|
|
685
|
-
`canonical-roadmap=${canonicalRoadmap ?? "null"} roadmap-exists=${canonicalRoadmap ? existsSync(canonicalRoadmap) : "n/a"}`);
|
|
686
|
-
}
|
|
687
|
-
catch (e) {
|
|
688
|
-
logWarning("guided", `ready-phrase-reject diagnostic failed: ${e.message}`);
|
|
689
|
-
}
|
|
690
|
-
entry.readyRejectCount = (entry.readyRejectCount ?? 0) + 1;
|
|
691
|
-
if (entry.readyRejectCount > MAX_READY_REJECTS) {
|
|
692
|
-
// Give up: clear state and tell the user to re-run /gsd. Avoids an
|
|
693
|
-
// infinite nudge loop when the LLM never produces the writes.
|
|
694
|
-
deletePendingAutoStart(basePath);
|
|
695
|
-
ctx.ui.notify(`Milestone ${milestoneId}: LLM signaled "ready" ${entry.readyRejectCount} times without writing files. ` +
|
|
696
|
-
`Stopping auto-nudge. Run /gsd to try again.`, "error");
|
|
697
|
-
return true;
|
|
698
|
-
}
|
|
699
|
-
const contextRel = relMilestoneFile(basePath, milestoneId, "CONTEXT");
|
|
700
|
-
const roadmapRel = relMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
701
|
-
ctx.ui.notify(`Milestone ${milestoneId}: "ready" signal rejected — ${contextRel} and ${roadmapRel} are missing. Asking the LLM to complete the writes.`, "warning");
|
|
702
|
-
const nudge = `You emitted "Milestone ${milestoneId} ready." but neither ` +
|
|
703
|
-
`${contextRel} nor ${roadmapRel} exists on disk. ` +
|
|
704
|
-
`The ready phrase is a POST-WRITE signal and has been rejected. ` +
|
|
705
|
-
`In this turn: (1) write PROJECT.md, REQUIREMENTS.md, and the milestone ` +
|
|
706
|
-
`CONTEXT.md, (2) call gsd_plan_milestone, then (3) emit the ready phrase. ` +
|
|
707
|
-
`Do not describe these steps — execute them as tool calls. ` +
|
|
708
|
-
`This is retry ${entry.readyRejectCount}/${MAX_READY_REJECTS}; further ` +
|
|
709
|
-
`premature signals will clear the session.`;
|
|
710
|
-
try {
|
|
711
|
-
pi.sendMessage({ customType: "gsd-ready-no-files", content: nudge, display: false }, { triggerTurn: true });
|
|
712
|
-
}
|
|
713
|
-
catch (e) {
|
|
714
|
-
logWarning("guided", `ready-phrase nudge sendMessage failed: ${e.message}`);
|
|
715
|
-
return false;
|
|
716
|
-
}
|
|
717
|
-
return true;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* #4573 — Detect and recover from the "announces tool, never calls it" stall.
|
|
721
|
-
*
|
|
722
|
-
* The LLM emits text like "I'll now write the CONTEXT.md file" but the turn
|
|
723
|
-
* ends with zero tool-use blocks. The harness has no post-turn tool-call
|
|
724
|
-
* validation, so the unit promise resolves and the user sees a stalled state.
|
|
725
|
-
*
|
|
726
|
-
* This function, called from `handleAgentEnd`, inspects the last assistant
|
|
727
|
-
* message. If ALL of the following are true, it injects a recovery message:
|
|
728
|
-
* - Text-only (no tool-use blocks)
|
|
729
|
-
* - Contains a commit-intent phrase ("I'll write", "I'll call", etc.)
|
|
730
|
-
* - Auto-mode is active OR a discussion autostart is pending
|
|
731
|
-
* - `emptyTurnRetryCount` is under the cap
|
|
732
|
-
*
|
|
733
|
-
* Per-handler state is held on the `PendingAutoStartEntry` when present, and
|
|
734
|
-
* on a module-level map otherwise. The counter resets on any successful
|
|
735
|
-
* tool-use turn via `resetEmptyTurnCounter`.
|
|
736
|
-
*/
|
|
737
|
-
const emptyTurnCounterByBase = new Map();
|
|
738
|
-
const MAX_EMPTY_TURN_RETRIES = 2;
|
|
739
|
-
// Phrases that indicate the LLM is about to do something but has not yet.
|
|
740
|
-
// Kept tight to avoid flagging legitimate narration like "I'll wait for your answer."
|
|
741
|
-
//
|
|
742
|
-
// "make" was previously in the verb list but matches conversational meta phrases
|
|
743
|
-
// like "Let me make sure I understand…" which are NOT action announcements —
|
|
744
|
-
// removed to prevent the empty-turn nudge from auto-replying to user questions
|
|
745
|
-
// in discuss flows.
|
|
746
|
-
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;
|
|
747
|
-
/**
|
|
748
|
-
* Reset the empty-turn counter for a basePath after a successful tool-use turn.
|
|
749
|
-
* Called from handleAgentEnd when the last message contains tool_use blocks.
|
|
750
|
-
*/
|
|
751
|
-
export function resetEmptyTurnCounter(basePath) {
|
|
752
|
-
if (basePath)
|
|
753
|
-
emptyTurnCounterByBase.delete(basePath);
|
|
754
|
-
else
|
|
755
|
-
emptyTurnCounterByBase.clear();
|
|
756
|
-
}
|
|
757
|
-
export function maybeHandleEmptyIntentTurn(event, isAuto, lookupBasePath) {
|
|
758
|
-
// Gate: only fire when there is system-driven work in flight. Interactive
|
|
759
|
-
// /gsd discuss (user-driven) produces legitimate text-only turns.
|
|
760
|
-
if (!isAuto && !hasPendingAutoStart(lookupBasePath))
|
|
761
|
-
return false;
|
|
762
|
-
const lastMsg = event.messages[event.messages.length - 1];
|
|
763
|
-
if (!lastMsg)
|
|
764
|
-
return false;
|
|
765
|
-
if (hasToolUse(lastMsg))
|
|
766
|
-
return false;
|
|
767
|
-
const text = extractAssistantText(lastMsg).trim();
|
|
768
|
-
if (!text)
|
|
769
|
-
return false;
|
|
770
|
-
// Skip if the LLM is emitting the ready phrase — that is the ready-no-files
|
|
771
|
-
// path, handled by maybeHandleReadyPhraseWithoutFiles.
|
|
772
|
-
if (READY_PHRASE_RE.test(text))
|
|
773
|
-
return false;
|
|
774
|
-
// Skip if the LLM is clearly handing back to the user. Discuss flows
|
|
775
|
-
// often pose a question and follow it with a conditional intent on the
|
|
776
|
-
// same line ("Did I capture that correctly? If so, I'll write the
|
|
777
|
-
// requirements."). A line-trailing `?` check misses these because the
|
|
778
|
-
// line ends in `.`. Match any sentence-terminating `?` (followed by
|
|
779
|
-
// whitespace or end-of-text) — false negatives here auto-reply to the
|
|
780
|
-
// user, which is a much worse failure mode than a missed nudge.
|
|
781
|
-
if (/\?(?:\s|$)/.test(text))
|
|
782
|
-
return false;
|
|
783
|
-
// Must contain a commit-intent phrase — this is the stall we care about.
|
|
784
|
-
if (!COMMIT_INTENT_RE.test(text))
|
|
785
|
-
return false;
|
|
786
|
-
// Resolve the target basePath + pi for injection. Prefer the pending
|
|
787
|
-
// autostart entry (discuss flow); otherwise we cannot inject.
|
|
788
|
-
const entry = _getPendingAutoStart(lookupBasePath);
|
|
789
|
-
if (!entry)
|
|
790
|
-
return false;
|
|
791
|
-
const { ctx, pi, basePath } = entry;
|
|
792
|
-
const count = (emptyTurnCounterByBase.get(basePath) ?? 0) + 1;
|
|
793
|
-
emptyTurnCounterByBase.set(basePath, count);
|
|
794
|
-
if (count > MAX_EMPTY_TURN_RETRIES) {
|
|
795
|
-
ctx.ui.notify(`Empty-turn recovery: LLM announced intent ${count} times without calling any tool. ` +
|
|
796
|
-
`Stopping auto-nudge.`, "error");
|
|
797
|
-
return false; // let the normal flow resolve/pause the unit
|
|
798
|
-
}
|
|
799
|
-
ctx.ui.notify(`Empty-turn detected: LLM announced intent but called no tool. Prompting it to execute.`, "info");
|
|
800
|
-
const nudge = `Your last turn announced an action (e.g. "I'll write…" or "Let me call…") ` +
|
|
801
|
-
`but contained no tool call. The system records zero tool-use blocks for ` +
|
|
802
|
-
`that turn. Execute the announced action NOW as a tool call in this turn. ` +
|
|
803
|
-
`Do not describe it again. Retry ${count}/${MAX_EMPTY_TURN_RETRIES}.`;
|
|
804
|
-
try {
|
|
805
|
-
pi.sendMessage({ customType: "gsd-empty-turn-recovery", content: nudge, display: false }, { triggerTurn: true });
|
|
806
|
-
}
|
|
807
|
-
catch (e) {
|
|
808
|
-
logWarning("guided", `empty-turn nudge sendMessage failed: ${e.message}`);
|
|
809
|
-
return false;
|
|
810
|
-
}
|
|
811
|
-
return true;
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* Extract milestone IDs from PROJECT.md milestone sequence table.
|
|
815
|
-
* Looks for rows like "| M001 | Name | Status |" and extracts the ID column.
|
|
816
|
-
*/
|
|
817
|
-
function parseMilestoneSequenceFromProject(content) {
|
|
818
|
-
const ids = [];
|
|
819
|
-
const lines = content.split(/\r?\n/);
|
|
820
|
-
for (const line of lines) {
|
|
821
|
-
const match = line.match(/^\|\s*(M\d{3}[A-Z0-9-]*)\s*\|/);
|
|
822
|
-
if (match)
|
|
823
|
-
ids.push(match[1]);
|
|
824
|
-
}
|
|
825
|
-
return ids;
|
|
826
|
-
}
|
|
827
368
|
export function resolveGuidedDispatchProjectRoot(basePath) {
|
|
828
369
|
return basePath ?? process.cwd();
|
|
829
370
|
}
|
|
@@ -1864,8 +1405,33 @@ export async function showSmartEntry(ctx, pi, basePath, options) {
|
|
|
1864
1405
|
const { checkMarkdownHierarchyAgainstDb } = await import("./migration-auto-check.js");
|
|
1865
1406
|
const result = await checkMarkdownHierarchyAgainstDb(basePath);
|
|
1866
1407
|
if (result.action === "recovery-required") {
|
|
1867
|
-
|
|
1868
|
-
|
|
1408
|
+
if (result.recoveryCommand === "/gsd rebuild markdown") {
|
|
1409
|
+
try {
|
|
1410
|
+
const { rebuildMarkdownProjectionsFromDb } = await import("./commands-maintenance.js");
|
|
1411
|
+
const rebuild = await rebuildMarkdownProjectionsFromDb(basePath);
|
|
1412
|
+
const after = await checkMarkdownHierarchyAgainstDb(basePath);
|
|
1413
|
+
if (after.action === "none") {
|
|
1414
|
+
ctx.ui.notify(`Self-heal: rebuilt markdown projections from the authoritative DB ` +
|
|
1415
|
+
`(${rebuild.rendered} rendered${rebuild.errors.length > 0 ? `, ${rebuild.errors.length} error(s)` : ""}).`, rebuild.errors.length > 0 ? "warning" : "info");
|
|
1416
|
+
}
|
|
1417
|
+
else {
|
|
1418
|
+
ctx.ui.notify((result.message ?? "Markdown planning artifacts still diverge from the DB after auto-rebuild.") +
|
|
1419
|
+
(rebuild.errors.length > 0
|
|
1420
|
+
? `\nAuto-rebuild had ${rebuild.errors.length} projection error(s). Run \`/gsd rebuild markdown\` after review.`
|
|
1421
|
+
: ""), "warning");
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
catch (rebuildErr) {
|
|
1425
|
+
const rebuildMessage = rebuildErr instanceof Error ? rebuildErr.message : String(rebuildErr);
|
|
1426
|
+
logWarning("guided", `markdown auto-rebuild failed: ${rebuildMessage}`, { file: "guided-flow.ts" });
|
|
1427
|
+
ctx.ui.notify(result.message ??
|
|
1428
|
+
`Markdown planning artifacts do not match the authoritative DB. Run \`${result.recoveryCommand ?? "/gsd rebuild markdown"}\` to re-project from the DB.`, "warning");
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
else {
|
|
1432
|
+
ctx.ui.notify(result.message ??
|
|
1433
|
+
`Markdown planning artifacts do not match the authoritative DB. Run \`${result.recoveryCommand ?? "/gsd recover --confirm"}\` to import markdown explicitly.`, "warning");
|
|
1434
|
+
}
|
|
1869
1435
|
}
|
|
1870
1436
|
}
|
|
1871
1437
|
catch (err) {
|