gsd-pi 2.65.0-dev.5c8557b → 2.65.0-dev.6cc5110
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/mcp-server.js +6 -2
- package/dist/resources/extensions/browser-tools/capture.js +20 -1
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +93 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +13 -2
- package/dist/resources/extensions/gsd/auto/session.js +4 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +99 -9
- package/dist/resources/extensions/gsd/auto-model-selection.js +7 -5
- package/dist/resources/extensions/gsd/auto-post-unit.js +17 -6
- package/dist/resources/extensions/gsd/auto-prompts.js +24 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +40 -22
- package/dist/resources/extensions/gsd/auto-start.js +42 -11
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +10 -0
- package/dist/resources/extensions/gsd/auto-worktree.js +29 -7
- package/dist/resources/extensions/gsd/auto.js +21 -15
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +17 -4
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +10 -0
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +6 -4
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +5 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +4 -1
- package/dist/resources/extensions/gsd/commands/context.js +8 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +20 -0
- package/dist/resources/extensions/gsd/commands-extensions.js +1 -1
- package/dist/resources/extensions/gsd/config-overlay.js +312 -0
- package/dist/resources/extensions/gsd/db-writer.js +13 -3
- package/dist/resources/extensions/gsd/detection.js +1 -1
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -0
- package/dist/resources/extensions/gsd/doctor.js +2 -1
- package/dist/resources/extensions/gsd/gitignore.js +1 -0
- package/dist/resources/extensions/gsd/gsd-db.js +11 -2
- package/dist/resources/extensions/gsd/guided-flow.js +220 -29
- package/dist/resources/extensions/gsd/json-persistence.js +5 -2
- package/dist/resources/extensions/gsd/md-importer.js +14 -7
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +17 -11
- package/dist/resources/extensions/gsd/pre-execution-checks.js +12 -5
- package/dist/resources/extensions/gsd/preferences-types.js +3 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +45 -1
- package/dist/resources/extensions/gsd/preferences.js +9 -2
- package/dist/resources/extensions/gsd/preparation.js +1092 -0
- package/dist/resources/extensions/gsd/prompt-validation.js +67 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +3 -3
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-prepared.md +424 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +4 -1
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +5 -4
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +23 -0
- package/dist/resources/extensions/gsd/prompts/rethink.md +2 -1
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +56 -23
- package/dist/resources/extensions/gsd/quick.js +19 -15
- package/dist/resources/extensions/gsd/reactive-graph.js +12 -0
- package/dist/resources/extensions/gsd/roadmap-slices.js +24 -5
- package/dist/resources/extensions/gsd/safety/content-validator.js +3 -3
- package/dist/resources/extensions/gsd/session-lock.js +23 -1
- package/dist/resources/extensions/gsd/state.js +112 -22
- package/dist/resources/extensions/gsd/templates/context-enhanced.md +138 -0
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +15 -3
- package/dist/resources/extensions/gsd/tools/complete-slice.js +27 -6
- package/dist/resources/extensions/gsd/tools/complete-task.js +31 -7
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -5
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +5 -2
- package/dist/resources/extensions/gsd/tools/reopen-milestone.js +119 -0
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +30 -0
- package/dist/resources/extensions/gsd/tools/reopen-task.js +18 -0
- package/dist/resources/extensions/gsd/triage-resolution.js +33 -16
- package/dist/resources/extensions/gsd/undo.js +3 -2
- package/dist/resources/extensions/gsd/workflow-logger.js +1 -1
- package/dist/resources/extensions/gsd/workflow-projections.js +4 -7
- package/dist/resources/extensions/gsd/workflow-reconcile.js +100 -9
- package/dist/resources/extensions/gsd/workflow-templates.js +11 -2
- package/dist/resources/extensions/gsd/worktree-manager.js +5 -2
- package/dist/resources/extensions/gsd/worktree.js +9 -0
- package/dist/resources/extensions/shared/interview-ui.js +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +18 -18
- 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 +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- 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 +18 -18
- 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 +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/6502.8874bcae249c02e1.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-a1c1e452c6b32d04.js → webpack-9fed74684e1c5bb1.js} +1 -1
- package/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js +30 -19
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js +51 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +9 -9
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +10 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +20 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +15 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +18 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/core/retry-handler.test.ts +80 -0
- package/packages/pi-coding-agent/src/core/retry-handler.ts +37 -25
- package/packages/pi-coding-agent/src/core/sdk.ts +9 -9
- package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +10 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +20 -4
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +27 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +16 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +5 -0
- package/packages/pi-tui/dist/components/image.d.ts +2 -0
- package/packages/pi-tui/dist/components/image.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/image.js +4 -0
- package/packages/pi-tui/dist/components/image.js.map +1 -1
- package/packages/pi-tui/dist/components/image.test.d.ts +6 -0
- package/packages/pi-tui/dist/components/image.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/image.test.js +32 -0
- package/packages/pi-tui/dist/components/image.test.js.map +1 -0
- package/packages/pi-tui/src/components/image.test.ts +36 -0
- package/packages/pi-tui/src/components/image.ts +5 -0
- package/src/resources/extensions/browser-tools/capture.ts +19 -1
- package/src/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +93 -0
- package/src/resources/extensions/gsd/auto/run-unit.ts +12 -2
- package/src/resources/extensions/gsd/auto/session.ts +4 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +110 -9
- package/src/resources/extensions/gsd/auto-model-selection.ts +7 -5
- package/src/resources/extensions/gsd/auto-post-unit.ts +16 -6
- package/src/resources/extensions/gsd/auto-prompts.ts +31 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -23
- package/src/resources/extensions/gsd/auto-start.ts +45 -10
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +10 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +28 -7
- package/src/resources/extensions/gsd/auto.ts +19 -8
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +16 -4
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +10 -0
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +5 -4
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +4 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +4 -1
- package/src/resources/extensions/gsd/commands/context.ts +7 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +23 -0
- package/src/resources/extensions/gsd/commands-extensions.ts +1 -1
- package/src/resources/extensions/gsd/config-overlay.ts +331 -0
- package/src/resources/extensions/gsd/db-writer.ts +11 -3
- package/src/resources/extensions/gsd/detection.ts +1 -1
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -0
- package/src/resources/extensions/gsd/doctor.ts +2 -1
- package/src/resources/extensions/gsd/gitignore.ts +1 -0
- package/src/resources/extensions/gsd/gsd-db.ts +13 -2
- package/src/resources/extensions/gsd/guided-flow.ts +254 -30
- package/src/resources/extensions/gsd/json-persistence.ts +6 -3
- package/src/resources/extensions/gsd/md-importer.ts +13 -6
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +19 -11
- package/src/resources/extensions/gsd/pre-execution-checks.ts +15 -7
- package/src/resources/extensions/gsd/preferences-types.ts +25 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +45 -1
- package/src/resources/extensions/gsd/preferences.ts +9 -2
- package/src/resources/extensions/gsd/preparation.ts +1419 -0
- package/src/resources/extensions/gsd/prompt-validation.ts +88 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +3 -3
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-prepared.md +424 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +4 -1
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +5 -4
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +23 -0
- package/src/resources/extensions/gsd/prompts/rethink.md +2 -1
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +56 -23
- package/src/resources/extensions/gsd/quick.ts +20 -15
- package/src/resources/extensions/gsd/reactive-graph.ts +18 -0
- package/src/resources/extensions/gsd/roadmap-slices.ts +21 -5
- package/src/resources/extensions/gsd/safety/content-validator.ts +3 -3
- package/src/resources/extensions/gsd/session-lock.ts +17 -1
- package/src/resources/extensions/gsd/state.ts +112 -20
- package/src/resources/extensions/gsd/templates/context-enhanced.md +138 -0
- package/src/resources/extensions/gsd/tests/adversarial-review-fixes.test.ts +223 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +33 -2
- package/src/resources/extensions/gsd/tests/auto-remediate-slice-status.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +41 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +72 -0
- package/src/resources/extensions/gsd/tests/complete-task-normalize-lists.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/defer-milestone-stamp.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/discuss-incremental-persistence.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard-closed-status.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/error-success-mask.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/frontmatter-parse-noise.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/guided-flow-state-rebuild.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/import-done-milestones.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +11 -9
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +28 -30
- package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
- package/src/resources/extensions/gsd/tests/integration-prepared-discussion.test.ts +525 -0
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/needs-remediation-revalidation.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/note-captures-executed.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/phantom-ghost-detection.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/phantom-milestone-default-queued.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +218 -20
- package/src/resources/extensions/gsd/tests/pre-execution-fail-closed.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/preparation.test.ts +1211 -0
- package/src/resources/extensions/gsd/tests/project-root-cwd-crash.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/prompt-builder.test.ts +669 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +7 -4
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/query-tools-db-open.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/queued-discuss-fast-path.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/reactive-graph.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/rogue-file-detection.test.ts +4 -5
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/show-config-command.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/skip-slice-state-rebuild.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/skipped-validation-completion.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/slice-sequence-insert.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/stale-lockfile-recovery.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/stale-queued-milestone.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +13 -0
- package/src/resources/extensions/gsd/tests/stash-pop-gsd-conflict.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +6 -7
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/symlink-extension-discovery.test.ts +125 -0
- package/src/resources/extensions/gsd/tests/sync-worktree-skip-current.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +29 -1
- package/src/resources/extensions/gsd/tests/triage-resolution.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +3 -4
- package/src/resources/extensions/gsd/tests/verification-operational-gate.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/wave1-critical-regressions.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/wave2-events-regressions.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/wave3-session-regressions.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/wave4-write-safety-regressions.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/worker-model-override.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-audit.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/worktree-expected-warnings.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/worktree-integration.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/worktree-main-branch.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +16 -17
- package/src/resources/extensions/gsd/tests/worktree-sync-tasks.test.ts +13 -9
- package/src/resources/extensions/gsd/tests/worktree.test.ts +26 -9
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +19 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +13 -3
- package/src/resources/extensions/gsd/tools/complete-slice.ts +26 -6
- package/src/resources/extensions/gsd/tools/complete-task.ts +29 -7
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +11 -9
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +5 -2
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +152 -0
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +27 -0
- package/src/resources/extensions/gsd/tools/reopen-task.ts +17 -0
- package/src/resources/extensions/gsd/triage-resolution.ts +37 -17
- package/src/resources/extensions/gsd/types.ts +4 -0
- package/src/resources/extensions/gsd/undo.ts +3 -2
- package/src/resources/extensions/gsd/workflow-events.ts +1 -1
- package/src/resources/extensions/gsd/workflow-logger.ts +1 -1
- package/src/resources/extensions/gsd/workflow-projections.ts +4 -6
- package/src/resources/extensions/gsd/workflow-reconcile.ts +109 -8
- package/src/resources/extensions/gsd/workflow-templates.ts +11 -2
- package/src/resources/extensions/gsd/worktree-manager.ts +4 -2
- package/src/resources/extensions/gsd/worktree.ts +10 -0
- package/src/resources/extensions/shared/interview-ui.ts +1 -1
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +8 -10
- package/dist/web/standalone/.next/static/chunks/6502.7593d7797a4b3999.js +0 -9
- /package/dist/web/standalone/.next/static/{qq3YfHPfyqvh3DIMVmsRH → iueakR5x5bQbax2sGz8Yr}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{qq3YfHPfyqvh3DIMVmsRH → iueakR5x5bQbax2sGz8Yr}/_ssgManifest.js +0 -0
|
@@ -1,48 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
# Milestone Validation — Parallel Review
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
You are the validation orchestrator for **{{milestoneId}} — {{milestoneTitle}}**.
|
|
4
4
|
|
|
5
5
|
## Working Directory
|
|
6
6
|
|
|
7
7
|
Your working directory is `{{workingDirectory}}`. All file reads, writes, and shell commands MUST operate relative to this directory. Do NOT `cd` to any other directory.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Mission
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Dispatch 3 independent parallel reviewers, then synthesize their findings into the final VALIDATION verdict.
|
|
12
12
|
|
|
13
13
|
This is remediation round {{remediationRound}}. If this is round 0, this is the first validation pass. If > 0, prior validation found issues and remediation slices were added and executed — verify those remediation slices resolved the issues.
|
|
14
14
|
|
|
15
|
+
## Context
|
|
16
|
+
|
|
15
17
|
All relevant context has been preloaded below — the roadmap, all slice summaries, UAT results, requirements, decisions, and project context are inlined. Start working immediately without re-reading these files.
|
|
16
18
|
|
|
17
19
|
{{inlinedContext}}
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## Execution Protocol
|
|
22
|
+
|
|
23
|
+
### Step 1 — Dispatch Parallel Reviewers
|
|
24
|
+
|
|
25
|
+
Call `subagent` with `tasks: [...]` containing ALL THREE reviewers simultaneously:
|
|
26
|
+
|
|
27
|
+
**Reviewer A — Requirements Coverage**
|
|
28
|
+
Prompt: "Review milestone {{milestoneId}} requirements coverage. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/REQUIREMENTS.md` (or equivalent requirements file). For each requirement, check the slice SUMMARY files in `.gsd/{{milestoneId}}/` to determine if it is: COVERED (clearly demonstrated), PARTIAL (mentioned but not fully demonstrated), or MISSING (no evidence). Output a markdown table with columns: Requirement | Status | Evidence. End with a one-line verdict: PASS if all covered, NEEDS-ATTENTION if partials exist, FAIL if any missing."
|
|
29
|
+
|
|
30
|
+
**Reviewer B — Cross-Slice Integration**
|
|
31
|
+
Prompt: "Review milestone {{milestoneId}} cross-slice integration. Working directory: {{workingDirectory}}. Read `{{roadmapPath}}` and find the boundary map (produces/consumes contracts). For each boundary, check that the producing slice's SUMMARY confirms it produced the artifact, and the consuming slice's SUMMARY confirms it consumed it. Output a markdown table: Boundary | Producer Summary | Consumer Summary | Status. End with a one-line verdict: PASS if all boundaries honored, NEEDS-ATTENTION if any gaps."
|
|
32
|
+
|
|
33
|
+
**Reviewer C — UAT & Acceptance Criteria**
|
|
34
|
+
Prompt: "Review milestone {{milestoneId}} UAT and acceptance criteria. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/CONTEXT.md` for acceptance criteria. Check for UAT-RESULT files in each slice directory. Verify each acceptance criterion maps to either a passing UAT result or clear SUMMARY evidence. Output a checklist: [ ] Criterion | Evidence. End with a one-line verdict: PASS if all criteria met, NEEDS-ATTENTION if gaps exist."
|
|
35
|
+
|
|
36
|
+
### Step 2 — Synthesize Findings
|
|
20
37
|
|
|
21
|
-
|
|
38
|
+
After all reviewers complete, aggregate their verdicts:
|
|
39
|
+
- If ALL reviewers say PASS → overall verdict: `pass`
|
|
40
|
+
- If any reviewer says NEEDS-ATTENTION → overall verdict: `needs-attention`
|
|
41
|
+
- If any reviewer says FAIL → overall verdict: `needs-remediation`
|
|
22
42
|
|
|
23
|
-
|
|
24
|
-
2. For each **slice** in the roadmap, verify its demo/deliverable claim against its summary. Flag any slice whose summary does not substantiate its claimed output.
|
|
25
|
-
3. Check **cross-slice integration points** — do boundary map entries (produces/consumes) align with what was actually built?
|
|
26
|
-
4. Check **requirement coverage** — are all active requirements addressed by at least one slice?
|
|
27
|
-
5. If **Verification Classes** are provided in the inlined context above, check each non-empty class:
|
|
28
|
-
- For each verification class (Contract, Integration, Operational, UAT), determine whether slice summaries, UAT results, or observable behavior provide evidence that this verification tier was addressed.
|
|
29
|
-
- Document the compliance status of each class in a dedicated verification classes section.
|
|
30
|
-
- If `Operational` verification is non-empty and no evidence of operational verification exists, flag this explicitly — it means planned operational checks (migrations, deployments, runtime verification) were not proven.
|
|
31
|
-
- A milestone with unaddressed verification classes may still pass if the gaps are minor, but the gaps MUST be documented in the Deferred Work Inventory.
|
|
32
|
-
6. Determine a verdict:
|
|
33
|
-
- `pass` — all criteria met, all slices delivered, no gaps
|
|
34
|
-
- `needs-attention` — minor gaps that do not block completion (document them)
|
|
35
|
-
- `needs-remediation` — material gaps found; remediation slices must be added to the roadmap
|
|
43
|
+
### Step 3 — Write VALIDATION File
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
Write to `{{validationPath}}`:
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
```markdown
|
|
48
|
+
---
|
|
49
|
+
verdict: <pass|needs-attention|needs-remediation>
|
|
50
|
+
remediation_round: {{remediationRound}}
|
|
51
|
+
reviewers: 3
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
# Milestone Validation: {{milestoneId}}
|
|
55
|
+
|
|
56
|
+
## Reviewer A — Requirements Coverage
|
|
57
|
+
<paste Reviewer A output>
|
|
58
|
+
|
|
59
|
+
## Reviewer B — Cross-Slice Integration
|
|
60
|
+
<paste Reviewer B output>
|
|
61
|
+
|
|
62
|
+
## Reviewer C — UAT & Acceptance Criteria
|
|
63
|
+
<paste Reviewer C output>
|
|
64
|
+
|
|
65
|
+
## Synthesis
|
|
66
|
+
<2-3 sentences summarizing overall findings and verdict rationale>
|
|
67
|
+
|
|
68
|
+
## Remediation Plan
|
|
69
|
+
<if verdict is not pass: specific actions required>
|
|
70
|
+
```
|
|
40
71
|
|
|
41
72
|
**DB access safety:** Do NOT query `.gsd/gsd.db` directly via `sqlite3` or `node -e require('better-sqlite3')` — the engine owns the WAL connection. Use `gsd_milestone_status` to read milestone and slice state. All data you need is already inlined in the context above or accessible via the `gsd_*` tools. Direct DB access corrupts the WAL and bypasses tool-level validation.
|
|
42
73
|
|
|
43
74
|
If verdict is `needs-remediation`:
|
|
44
|
-
-
|
|
45
|
-
- These
|
|
75
|
+
- Add new slices to `{{roadmapPath}}` with unchecked `[ ]` status
|
|
76
|
+
- These slices will be planned and executed before validation re-runs
|
|
77
|
+
|
|
78
|
+
**You MUST write `{{validationPath}}` before finishing.**
|
|
46
79
|
|
|
47
80
|
**File system safety:** When scanning milestone directories for evidence, use `ls` or `find` to list directory contents first — never pass a directory path (e.g. `tasks/`, `slices/`) directly to the `read` tool. The `read` tool only accepts file paths, not directories.
|
|
48
81
|
|
|
@@ -192,28 +192,33 @@ export async function handleQuick(
|
|
|
192
192
|
const taskDirRel = `.gsd/quick/${taskNum}-${slug}`;
|
|
193
193
|
const date = new Date().toISOString().split("T")[0];
|
|
194
194
|
|
|
195
|
-
// Create git branch for the quick task
|
|
195
|
+
// Create git branch for the quick task (unless isolation:none — #3337)
|
|
196
196
|
const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git ?? {};
|
|
197
197
|
const git = new GitServiceImpl(basePath, gitPrefs);
|
|
198
198
|
const branchName = `gsd/quick/${taskNum}-${slug}`;
|
|
199
199
|
let originalBranch = git.getCurrentBranch();
|
|
200
200
|
|
|
201
|
+
const { getIsolationMode } = await import("./preferences.js");
|
|
202
|
+
const usesBranch = getIsolationMode() !== "none";
|
|
203
|
+
|
|
201
204
|
let branchCreated = false;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
205
|
+
if (usesBranch) {
|
|
206
|
+
try {
|
|
207
|
+
const current = originalBranch;
|
|
208
|
+
if (current !== branchName) {
|
|
209
|
+
// Auto-commit any dirty state before switching
|
|
210
|
+
try {
|
|
211
|
+
git.autoCommit("quick-task", `Q${taskNum}`, []);
|
|
212
|
+
} catch { /* nothing to commit — fine */ }
|
|
213
|
+
|
|
214
|
+
runGit(basePath, ["checkout", "-b", branchName]);
|
|
215
|
+
branchCreated = true;
|
|
216
|
+
}
|
|
217
|
+
} catch (err) {
|
|
218
|
+
// Branch creation failed — continue on current branch
|
|
219
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
220
|
+
ctx.ui.notify(`Could not create branch ${branchName}: ${message}. Working on current branch.`, "warning");
|
|
212
221
|
}
|
|
213
|
-
} catch (err) {
|
|
214
|
-
// Branch creation failed — continue on current branch
|
|
215
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
216
|
-
ctx.ui.notify(`Could not create branch ${branchName}: ${message}. Working on current branch.`, "warning");
|
|
217
222
|
}
|
|
218
223
|
|
|
219
224
|
const actualBranch = branchCreated ? branchName : git.getCurrentBranch();
|
|
@@ -131,6 +131,24 @@ export function isGraphAmbiguous(graph: DerivedTaskNode[]): boolean {
|
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Returns tasks that are missing IO annotations (no inputFiles and no outputFiles).
|
|
136
|
+
* These tasks prevent parallel dispatch by making the graph ambiguous.
|
|
137
|
+
* Used to surface actionable diagnostics when parallel execution falls back to sequential.
|
|
138
|
+
*/
|
|
139
|
+
export function getMissingAnnotationTasks(
|
|
140
|
+
graph: DerivedTaskNode[],
|
|
141
|
+
): Array<{ id: string; title: string }> {
|
|
142
|
+
return graph
|
|
143
|
+
.filter(
|
|
144
|
+
(node) =>
|
|
145
|
+
!node.done &&
|
|
146
|
+
node.inputFiles.length === 0 &&
|
|
147
|
+
node.outputFiles.length === 0,
|
|
148
|
+
)
|
|
149
|
+
.map((node) => ({ id: node.id, title: node.title }));
|
|
150
|
+
}
|
|
151
|
+
|
|
134
152
|
/**
|
|
135
153
|
* Detect deadlock: no tasks are ready and none are in-flight, yet incomplete
|
|
136
154
|
* tasks remain. This indicates a circular dependency or impossible state.
|
|
@@ -66,6 +66,17 @@ function parseTableSlices(section: string): RoadmapSliceEntry[] {
|
|
|
66
66
|
const lines = section.split("\n");
|
|
67
67
|
const slices: RoadmapSliceEntry[] = [];
|
|
68
68
|
|
|
69
|
+
// Detect dependency column index from the header row (#3383, #3336).
|
|
70
|
+
// Only parse deps from this column (or cells with explicit "depends"/"deps" keywords).
|
|
71
|
+
let depColumnIndex = -1;
|
|
72
|
+
for (const line of lines) {
|
|
73
|
+
if (!line.includes("|")) continue;
|
|
74
|
+
if (/S\d+/.test(line)) break; // reached data rows
|
|
75
|
+
const headerCells = line.split("|").map(c => c.trim()).filter(Boolean);
|
|
76
|
+
depColumnIndex = headerCells.findIndex(c => /^(depends|deps|depend)/i.test(c));
|
|
77
|
+
if (depColumnIndex >= 0) break;
|
|
78
|
+
}
|
|
79
|
+
|
|
69
80
|
for (const line of lines) {
|
|
70
81
|
// Skip non-table lines, separator lines (|---|---|), and header rows
|
|
71
82
|
if (!line.includes("|")) continue;
|
|
@@ -95,12 +106,17 @@ function parseTableSlices(section: string): RoadmapSliceEntry[] {
|
|
|
95
106
|
if (/\bmedium\b/.test(cellLower) || /\bmed\b/.test(cellLower)) { risk = "medium"; break; }
|
|
96
107
|
}
|
|
97
108
|
|
|
98
|
-
// Extract dependencies from
|
|
109
|
+
// Extract dependencies only from the dependency column or cells with
|
|
110
|
+
// explicit "depends"/"deps" keywords — never from title cells (#3383).
|
|
99
111
|
let depends: string[] = [];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
112
|
+
if (depColumnIndex >= 0 && cells[depColumnIndex]) {
|
|
113
|
+
const depCell = cells[depColumnIndex]!;
|
|
114
|
+
const depIds = (depCell.match(/S\d+/g) ?? []).filter(d => d !== id);
|
|
115
|
+
depends = expandDependencies(depIds);
|
|
116
|
+
} else {
|
|
117
|
+
for (const cell of cells) {
|
|
118
|
+
if (/depends|deps/i.test(cell)) {
|
|
119
|
+
const depIds = (cell.match(/S\d+/g) ?? []).filter(d => d !== id);
|
|
104
120
|
depends = expandDependencies(depIds);
|
|
105
121
|
break;
|
|
106
122
|
}
|
|
@@ -54,12 +54,12 @@ const VALIDATORS: Record<string, ContentValidatorFn> = {
|
|
|
54
54
|
function validatePlanSlice(content: string): ContentViolation[] {
|
|
55
55
|
const violations: ContentViolation[] = [];
|
|
56
56
|
|
|
57
|
-
// Must have at least
|
|
57
|
+
// Must have at least 1 task entry — single-task slices are valid (#3649)
|
|
58
58
|
const taskCount = (content.match(/- \[[ x]\] \*\*T\d+/g) || []).length;
|
|
59
|
-
if (taskCount <
|
|
59
|
+
if (taskCount < 1) {
|
|
60
60
|
violations.push({
|
|
61
61
|
severity: "warning",
|
|
62
|
-
reason: `Slice plan has
|
|
62
|
+
reason: `Slice plan has ${taskCount} task(s) — expected at least 1`,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -288,6 +288,20 @@ export function acquireSessionLock(basePath: string): SessionLockResult {
|
|
|
288
288
|
const gsdDir = gsdRoot(basePath);
|
|
289
289
|
const lockTarget = effectiveLockTarget(gsdDir);
|
|
290
290
|
|
|
291
|
+
// #3218: Pre-flight stale lock cleanup — if the .lock/ directory exists but
|
|
292
|
+
// no auto.lock metadata is present (or the PID is dead), remove the lock
|
|
293
|
+
// directory before attempting acquisition. This prevents the 30-min stale
|
|
294
|
+
// window from blocking /gsd after crashes, SIGKILL, or laptop sleep.
|
|
295
|
+
const lockDir = lockTarget + ".lock";
|
|
296
|
+
if (existsSync(lockDir)) {
|
|
297
|
+
const existingData = readExistingLockData(lp);
|
|
298
|
+
const isOrphan = !existingData || (existingData.pid && !isPidAlive(existingData.pid));
|
|
299
|
+
if (isOrphan) {
|
|
300
|
+
try { rmSync(lockDir, { recursive: true, force: true }); } catch { /* best-effort */ }
|
|
301
|
+
try { if (existsSync(lp)) unlinkSync(lp); } catch { /* best-effort */ }
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
291
305
|
try {
|
|
292
306
|
// Try to acquire an exclusive OS-level lock on the lock target.
|
|
293
307
|
// We lock a directory since proper-lockfile works best on directories,
|
|
@@ -344,9 +358,11 @@ export function acquireSessionLock(basePath: string): SessionLockResult {
|
|
|
344
358
|
}
|
|
345
359
|
}
|
|
346
360
|
|
|
361
|
+
// #3218: Provide actionable workaround when lock recovery fails
|
|
362
|
+
const lockDirPath = lockTarget + ".lock";
|
|
347
363
|
const reason = existingPid
|
|
348
364
|
? `Another auto-mode session (PID ${existingPid}) appears to be running.\nStop it with \`kill ${existingPid}\` before starting a new session.`
|
|
349
|
-
: `Another auto-mode session is
|
|
365
|
+
: `Another auto-mode session lock is stuck on this project.\nRun: rm -rf "${lockDirPath}" && rm -f "${lp}"`;
|
|
350
366
|
|
|
351
367
|
return { acquired: false, reason, existingPid };
|
|
352
368
|
}
|
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
getSlice,
|
|
56
56
|
insertMilestone,
|
|
57
57
|
insertSlice,
|
|
58
|
+
insertTask,
|
|
58
59
|
updateTaskStatus,
|
|
59
60
|
getPendingSliceGateCount,
|
|
60
61
|
type MilestoneRow,
|
|
@@ -78,10 +79,20 @@ import {
|
|
|
78
79
|
* as ghosts, causing auto-mode to skip them entirely.
|
|
79
80
|
*/
|
|
80
81
|
export function isGhostMilestone(basePath: string, mid: string): boolean {
|
|
81
|
-
// If the milestone has a DB row, it's a known milestone — not a ghost.
|
|
82
|
+
// If the milestone has a DB row, it's usually a known milestone — not a ghost.
|
|
83
|
+
// Exception: a "queued" row with no disk artifacts is a phantom from
|
|
84
|
+
// gsd_milestone_generate_id that was never planned (#3645).
|
|
82
85
|
if (isDbAvailable()) {
|
|
83
86
|
const dbRow = getMilestone(mid);
|
|
84
|
-
if (dbRow)
|
|
87
|
+
if (dbRow) {
|
|
88
|
+
if (dbRow.status === 'queued') {
|
|
89
|
+
const hasContent = resolveMilestoneFile(basePath, mid, "CONTEXT")
|
|
90
|
+
|| resolveMilestoneFile(basePath, mid, "ROADMAP")
|
|
91
|
+
|| resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
92
|
+
return !hasContent;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
// If a worktree exists for this milestone, it was legitimately created.
|
|
@@ -178,7 +189,7 @@ export async function getActiveMilestoneId(basePath: string): Promise<string | n
|
|
|
178
189
|
const byId = new Map(allMilestones.map(m => [m.id, m]));
|
|
179
190
|
for (const id of sortedIds) {
|
|
180
191
|
const m = byId.get(id)!;
|
|
181
|
-
if (m.status
|
|
192
|
+
if (isClosedStatus(m.status) || m.status === "parked") continue;
|
|
182
193
|
return m.id;
|
|
183
194
|
}
|
|
184
195
|
return null;
|
|
@@ -431,13 +442,10 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
431
442
|
continue;
|
|
432
443
|
}
|
|
433
444
|
|
|
434
|
-
//
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
// if a summary file exists
|
|
439
|
-
// Note: without summary file, the milestone is in validating/completing state, not complete
|
|
440
|
-
}
|
|
445
|
+
// Milestones with all slices done but no SUMMARY file are in
|
|
446
|
+
// validating/completing state — intentionally NOT added to
|
|
447
|
+
// completeMilestoneIds. The SUMMARY file (checked above) is the
|
|
448
|
+
// terminal artifact that proves completion per #864.
|
|
441
449
|
}
|
|
442
450
|
|
|
443
451
|
// Phase 2: Build registry and find active milestone
|
|
@@ -446,6 +454,10 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
446
454
|
let activeMilestoneSlices: SliceRow[] = [];
|
|
447
455
|
let activeMilestoneFound = false;
|
|
448
456
|
let activeMilestoneHasDraft = false;
|
|
457
|
+
// Queued shells (DB row, no slices, no content files) are deferred during
|
|
458
|
+
// the main loop so they don't eclipse real active milestones (#3470).
|
|
459
|
+
// If no real active milestone is found, the first deferred shell is promoted.
|
|
460
|
+
let firstDeferredQueuedShell: { id: string; title: string; deps: string[] } | null = null;
|
|
449
461
|
|
|
450
462
|
for (const m of milestones) {
|
|
451
463
|
if (parkedMilestoneIds.has(m.id)) {
|
|
@@ -453,9 +465,10 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
453
465
|
continue;
|
|
454
466
|
}
|
|
455
467
|
|
|
456
|
-
// Ghost milestone check: no slices in DB AND no substantive files on disk
|
|
468
|
+
// Ghost milestone check: no slices in DB AND no substantive files on disk.
|
|
469
|
+
// Skip queued milestones — they are handled by the deferred-shell logic below (#3470).
|
|
457
470
|
const slices = getMilestoneSlices(m.id);
|
|
458
|
-
if (slices.length === 0 && !isStatusDone(m.status)) {
|
|
471
|
+
if (slices.length === 0 && !isStatusDone(m.status) && m.status !== 'queued') {
|
|
459
472
|
// Check disk for ghost detection
|
|
460
473
|
if (isGhostMilestone(basePath, m.id)) continue;
|
|
461
474
|
}
|
|
@@ -500,6 +513,23 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
500
513
|
continue;
|
|
501
514
|
}
|
|
502
515
|
|
|
516
|
+
// Defer queued shell milestones with no substantive content (#3470).
|
|
517
|
+
// A queued milestone with no slices and no context/draft file is a
|
|
518
|
+
// placeholder that should not block later real active milestones.
|
|
519
|
+
// If no real active milestone is found after the loop, the first
|
|
520
|
+
// deferred shell is promoted to active (#2921).
|
|
521
|
+
if (m.status === 'queued' && slices.length === 0) {
|
|
522
|
+
const contextFile = resolveMilestoneFile(basePath, m.id, "CONTEXT");
|
|
523
|
+
const draftFile = resolveMilestoneFile(basePath, m.id, "CONTEXT-DRAFT");
|
|
524
|
+
if (!contextFile && !draftFile) {
|
|
525
|
+
if (!firstDeferredQueuedShell) {
|
|
526
|
+
firstDeferredQueuedShell = { id: m.id, title, deps };
|
|
527
|
+
}
|
|
528
|
+
registry.push({ id: m.id, title, status: 'pending', ...(deps.length > 0 ? { dependsOn: deps } : {}) });
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
503
533
|
// Handle all-slices-done case (validating/completing)
|
|
504
534
|
if (allSlicesDone) {
|
|
505
535
|
const validationFile = resolveMilestoneFile(basePath, m.id, "VALIDATION");
|
|
@@ -532,6 +562,16 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
532
562
|
}
|
|
533
563
|
}
|
|
534
564
|
|
|
565
|
+
// Promote deferred queued shell if no real active milestone was found (#3470/#2921).
|
|
566
|
+
if (!activeMilestoneFound && firstDeferredQueuedShell) {
|
|
567
|
+
const shell = firstDeferredQueuedShell;
|
|
568
|
+
activeMilestone = { id: shell.id, title: shell.title };
|
|
569
|
+
activeMilestoneSlices = [];
|
|
570
|
+
activeMilestoneFound = true;
|
|
571
|
+
const entry = registry.find(e => e.id === shell.id);
|
|
572
|
+
if (entry) entry.status = 'active';
|
|
573
|
+
}
|
|
574
|
+
|
|
535
575
|
const milestoneProgress = {
|
|
536
576
|
done: registry.filter(e => e.status === 'complete').length,
|
|
537
577
|
total: registry.length,
|
|
@@ -636,12 +676,15 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
636
676
|
const validationFile = resolveMilestoneFile(basePath, activeMilestone.id, "VALIDATION");
|
|
637
677
|
const validationContent = validationFile ? await loadFile(validationFile) : null;
|
|
638
678
|
const validationTerminal = validationContent ? isValidationTerminal(validationContent) : false;
|
|
679
|
+
const verdict = validationContent ? extractVerdict(validationContent) : undefined;
|
|
639
680
|
const sliceProgress = {
|
|
640
681
|
done: activeMilestoneSlices.length,
|
|
641
682
|
total: activeMilestoneSlices.length,
|
|
642
683
|
};
|
|
643
684
|
|
|
644
|
-
|
|
685
|
+
// Force re-validation when verdict is needs-remediation — remediation slices
|
|
686
|
+
// may have completed since the stale validation was written (#3596).
|
|
687
|
+
if (!validationTerminal || verdict === 'needs-remediation') {
|
|
645
688
|
return {
|
|
646
689
|
activeMilestone, activeSlice: null, activeTask: null,
|
|
647
690
|
phase: 'validating-milestone',
|
|
@@ -738,6 +781,44 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
738
781
|
// ── Get tasks from DB ────────────────────────────────────────────────
|
|
739
782
|
let tasks = getSliceTasks(activeMilestone.id, activeSlice.id);
|
|
740
783
|
|
|
784
|
+
// ── Reconcile missing tasks: plan file has tasks but DB is empty (#3600) ──
|
|
785
|
+
// When the planning agent writes S##-PLAN.md with task entries but never
|
|
786
|
+
// calls the gsd_plan_slice persistence tool, the DB has zero task rows
|
|
787
|
+
// even though the plan file contains valid tasks. Without this reconciliation,
|
|
788
|
+
// deriveState returns phase='planning' forever — the dispatcher re-dispatches
|
|
789
|
+
// plan-slice in an infinite loop.
|
|
790
|
+
if (tasks.length === 0 && planFile) {
|
|
791
|
+
try {
|
|
792
|
+
const planContent = await loadFile(planFile);
|
|
793
|
+
if (planContent) {
|
|
794
|
+
const diskPlan = parsePlan(planContent);
|
|
795
|
+
if (diskPlan.tasks.length > 0) {
|
|
796
|
+
for (let i = 0; i < diskPlan.tasks.length; i++) {
|
|
797
|
+
const t = diskPlan.tasks[i];
|
|
798
|
+
try {
|
|
799
|
+
insertTask({
|
|
800
|
+
id: t.id,
|
|
801
|
+
sliceId: activeSlice.id,
|
|
802
|
+
milestoneId: activeMilestone.id,
|
|
803
|
+
title: t.title,
|
|
804
|
+
status: t.done ? 'complete' : 'pending',
|
|
805
|
+
sequence: i + 1,
|
|
806
|
+
});
|
|
807
|
+
} catch (insertErr) {
|
|
808
|
+
// Task may already exist from a partial previous import — skip
|
|
809
|
+
logWarning("reconcile", `failed to insert task ${t.id} from plan file: ${insertErr instanceof Error ? insertErr.message : String(insertErr)}`);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
tasks = getSliceTasks(activeMilestone.id, activeSlice.id);
|
|
813
|
+
logWarning("reconcile", `imported ${tasks.length} tasks from plan file for ${activeMilestone.id}/${activeSlice.id} — DB was empty (#3600)`, { mid: activeMilestone.id, sid: activeSlice.id });
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
} catch (err) {
|
|
817
|
+
// Non-fatal — fall through to the existing "empty plan" logic
|
|
818
|
+
logError("reconcile", `plan-file task import failed for ${activeMilestone.id}/${activeSlice.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
741
822
|
// ── Reconcile stale task status (#2514) ──────────────────────────────
|
|
742
823
|
// When a session disconnects after the agent writes SUMMARY + VERIFY
|
|
743
824
|
// artifacts but before postUnitPostVerification updates the DB, tasks
|
|
@@ -870,7 +951,12 @@ export async function deriveStateFromDb(basePath: string): Promise<GSDState> {
|
|
|
870
951
|
// ── REPLAN-TRIGGER detection ─────────────────────────────────────────
|
|
871
952
|
if (!blockerTaskId) {
|
|
872
953
|
const sliceRow = getSlice(activeMilestone.id, activeSlice.id);
|
|
873
|
-
|
|
954
|
+
// Check DB column first, fall back to disk trigger file when DB write
|
|
955
|
+
// was best-effort and failed (triage-resolution.ts dual-write gap).
|
|
956
|
+
const dbTriggered = !!sliceRow?.replan_triggered_at;
|
|
957
|
+
const diskTriggered = !dbTriggered &&
|
|
958
|
+
!!resolveSliceFile(basePath, activeMilestone.id, activeSlice.id, "REPLAN-TRIGGER");
|
|
959
|
+
if (dbTriggered || diskTriggered) {
|
|
874
960
|
// Loop protection: if replan_history has entries, replan was already done
|
|
875
961
|
const replanHistory = getReplanHistory(activeMilestone.id, activeSlice.id);
|
|
876
962
|
if (replanHistory.length === 0) {
|
|
@@ -1099,22 +1185,25 @@ export async function _deriveStateImpl(basePath: string): Promise<GSDState> {
|
|
|
1099
1185
|
const validationFile = resolveMilestoneFile(basePath, mid, "VALIDATION");
|
|
1100
1186
|
const validationContent = validationFile ? await cachedLoadFile(validationFile) : null;
|
|
1101
1187
|
const validationTerminal = validationContent ? isValidationTerminal(validationContent) : false;
|
|
1188
|
+
const verdict = validationContent ? extractVerdict(validationContent) : undefined;
|
|
1189
|
+
// needs-remediation is terminal but requires re-validation (#3596)
|
|
1190
|
+
const needsRevalidation = !validationTerminal || verdict === 'needs-remediation';
|
|
1102
1191
|
|
|
1103
1192
|
if (summaryFile) {
|
|
1104
1193
|
// Summary exists → milestone is complete regardless of validation state.
|
|
1105
1194
|
// The summary is the terminal artifact (#864).
|
|
1106
1195
|
registry.push({ id: mid, title, status: 'complete' });
|
|
1107
|
-
} else if (
|
|
1108
|
-
// No summary and
|
|
1196
|
+
} else if (needsRevalidation && !activeMilestoneFound) {
|
|
1197
|
+
// No summary and needs (re-)validation → validating-milestone
|
|
1109
1198
|
activeMilestone = { id: mid, title };
|
|
1110
1199
|
activeRoadmap = roadmap;
|
|
1111
1200
|
activeMilestoneFound = true;
|
|
1112
1201
|
registry.push({ id: mid, title, status: 'active' });
|
|
1113
|
-
} else if (
|
|
1114
|
-
//
|
|
1202
|
+
} else if (needsRevalidation && activeMilestoneFound) {
|
|
1203
|
+
// Needs (re-)validation, but another milestone is already active
|
|
1115
1204
|
registry.push({ id: mid, title, status: 'pending' });
|
|
1116
1205
|
} else if (!activeMilestoneFound) {
|
|
1117
|
-
// Terminal validation but no summary → completing-milestone
|
|
1206
|
+
// Terminal validation (pass/needs-attention) but no summary → completing-milestone
|
|
1118
1207
|
activeMilestone = { id: mid, title };
|
|
1119
1208
|
activeRoadmap = roadmap;
|
|
1120
1209
|
activeMilestoneFound = true;
|
|
@@ -1299,12 +1388,15 @@ export async function _deriveStateImpl(basePath: string): Promise<GSDState> {
|
|
|
1299
1388
|
const validationFile = resolveMilestoneFile(basePath, activeMilestone.id, "VALIDATION");
|
|
1300
1389
|
const validationContent = validationFile ? await cachedLoadFile(validationFile) : null;
|
|
1301
1390
|
const validationTerminal = validationContent ? isValidationTerminal(validationContent) : false;
|
|
1391
|
+
const verdict = validationContent ? extractVerdict(validationContent) : undefined;
|
|
1302
1392
|
const sliceProgress = {
|
|
1303
1393
|
done: activeRoadmap.slices.length,
|
|
1304
1394
|
total: activeRoadmap.slices.length,
|
|
1305
1395
|
};
|
|
1306
1396
|
|
|
1307
|
-
|
|
1397
|
+
// Force re-validation when verdict is needs-remediation — remediation slices
|
|
1398
|
+
// may have completed since the stale validation was written (#3596).
|
|
1399
|
+
if (!validationTerminal || verdict === 'needs-remediation') {
|
|
1308
1400
|
return {
|
|
1309
1401
|
activeMilestone,
|
|
1310
1402
|
activeSlice: null,
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# {{milestoneId}}: {{milestoneTitle}}
|
|
2
|
+
|
|
3
|
+
**Gathered:** {{date}}
|
|
4
|
+
**Status:** Ready for planning
|
|
5
|
+
|
|
6
|
+
## Project Description
|
|
7
|
+
|
|
8
|
+
{{description}}
|
|
9
|
+
|
|
10
|
+
## Why This Milestone
|
|
11
|
+
|
|
12
|
+
{{whatProblemThisSolves_AND_whyNow}}
|
|
13
|
+
|
|
14
|
+
## Codebase Brief
|
|
15
|
+
|
|
16
|
+
### Technology Stack
|
|
17
|
+
|
|
18
|
+
{{techStack}}
|
|
19
|
+
|
|
20
|
+
### Key Modules
|
|
21
|
+
|
|
22
|
+
{{keyModules}}
|
|
23
|
+
|
|
24
|
+
### Patterns in Use
|
|
25
|
+
|
|
26
|
+
{{patternsInUse}}
|
|
27
|
+
|
|
28
|
+
## User-Visible Outcome
|
|
29
|
+
|
|
30
|
+
### When this milestone is complete, the user can:
|
|
31
|
+
|
|
32
|
+
- {{literalUserActionInRealEnvironment}}
|
|
33
|
+
- {{literalUserActionInRealEnvironment}}
|
|
34
|
+
|
|
35
|
+
### Entry point / environment
|
|
36
|
+
|
|
37
|
+
- Entry point: {{CLI command / URL / bot / extension / service / workflow}}
|
|
38
|
+
- Environment: {{local dev / browser / mobile / launchd / CI / production-like}}
|
|
39
|
+
- Live dependencies involved: {{telegram / database / webhook / rpc subprocess / none}}
|
|
40
|
+
|
|
41
|
+
## Completion Class
|
|
42
|
+
|
|
43
|
+
- Contract complete means: {{what can be proven by tests / fixtures / artifacts}}
|
|
44
|
+
- Integration complete means: {{what must work across real subsystems}}
|
|
45
|
+
- Operational complete means: {{what must work under real lifecycle conditions, or none}}
|
|
46
|
+
|
|
47
|
+
## Architectural Decisions
|
|
48
|
+
|
|
49
|
+
### {{decisionTitle}}
|
|
50
|
+
|
|
51
|
+
**Decision:** {{decisionStatement}}
|
|
52
|
+
|
|
53
|
+
**Rationale:** {{rationale}}
|
|
54
|
+
|
|
55
|
+
**Evidence:** {{evidence}}
|
|
56
|
+
|
|
57
|
+
**Alternatives Considered:**
|
|
58
|
+
- {{alternative1}} — {{whyNotChosen1}}
|
|
59
|
+
- {{alternative2}} — {{whyNotChosen2}}
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
> Add additional decisions as separate `### Decision Title` blocks following the same structure above.
|
|
64
|
+
|
|
65
|
+
## Interface Contracts
|
|
66
|
+
|
|
67
|
+
{{interfaceContracts}}
|
|
68
|
+
|
|
69
|
+
> Document API boundaries, function signatures, data shapes, or protocol agreements that must be honored. Leave blank or remove if not applicable to this milestone.
|
|
70
|
+
|
|
71
|
+
## Error Handling Strategy
|
|
72
|
+
|
|
73
|
+
{{errorHandlingStrategy}}
|
|
74
|
+
|
|
75
|
+
> Describe the approach for handling failures, edge cases, and error propagation. Include retry policies, fallback behaviors, and user-facing error messages where relevant.
|
|
76
|
+
|
|
77
|
+
## Final Integrated Acceptance
|
|
78
|
+
|
|
79
|
+
To call this milestone complete, we must prove:
|
|
80
|
+
|
|
81
|
+
- {{one real end-to-end scenario}}
|
|
82
|
+
- {{one real end-to-end scenario}}
|
|
83
|
+
- {{what cannot be simulated if this milestone is to be considered truly done}}
|
|
84
|
+
|
|
85
|
+
## Testing Requirements
|
|
86
|
+
|
|
87
|
+
{{testingRequirements}}
|
|
88
|
+
|
|
89
|
+
> Specify test types (unit, integration, e2e), coverage expectations, and any specific test scenarios that must pass.
|
|
90
|
+
|
|
91
|
+
## Acceptance Criteria
|
|
92
|
+
|
|
93
|
+
{{acceptanceCriteria}}
|
|
94
|
+
|
|
95
|
+
> Per-slice acceptance criteria gathered during discussion. Each slice should have clear, testable criteria.
|
|
96
|
+
|
|
97
|
+
## Risks and Unknowns
|
|
98
|
+
|
|
99
|
+
- {{riskOrUnknown}} — {{whyItMatters}}
|
|
100
|
+
|
|
101
|
+
## Existing Codebase / Prior Art
|
|
102
|
+
|
|
103
|
+
- `{{fileOrModule}}` — {{howItRelates}}
|
|
104
|
+
- `{{fileOrModule}}` — {{howItRelates}}
|
|
105
|
+
|
|
106
|
+
> See `.gsd/DECISIONS.md` for all architectural and pattern decisions — it is an append-only register; read it during planning, append to it during execution.
|
|
107
|
+
|
|
108
|
+
## Relevant Requirements
|
|
109
|
+
|
|
110
|
+
- {{requirementId}} — {{howThisMilestoneAdvancesIt}}
|
|
111
|
+
|
|
112
|
+
## Scope
|
|
113
|
+
|
|
114
|
+
### In Scope
|
|
115
|
+
|
|
116
|
+
- {{inScopeItem}}
|
|
117
|
+
|
|
118
|
+
### Out of Scope / Non-Goals
|
|
119
|
+
|
|
120
|
+
- {{outOfScopeItem}}
|
|
121
|
+
|
|
122
|
+
## Technical Constraints
|
|
123
|
+
|
|
124
|
+
- {{constraint}}
|
|
125
|
+
|
|
126
|
+
## Integration Points
|
|
127
|
+
|
|
128
|
+
- {{systemOrService}} — {{howThisMilestoneInteractsWithIt}}
|
|
129
|
+
|
|
130
|
+
## Ecosystem Notes
|
|
131
|
+
|
|
132
|
+
{{ecosystemNotes}}
|
|
133
|
+
|
|
134
|
+
> Research findings, best practices, known issues, and relevant external documentation discovered during preparation.
|
|
135
|
+
|
|
136
|
+
## Open Questions
|
|
137
|
+
|
|
138
|
+
- {{question}} — {{currentThinking}}
|