gsd-pi 2.82.0-dev.725028083 → 2.82.0-dev.98ea09b1e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +10 -1
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +5 -5
- package/dist/resources/extensions/gsd/auto/orchestrator.js +124 -6
- package/dist/resources/extensions/gsd/auto/phases.js +8 -1
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +13 -6
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +233 -127
- package/dist/resources/extensions/gsd/auto-prompts.js +2 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +31 -1
- package/dist/resources/extensions/gsd/auto-start.js +85 -12
- package/dist/resources/extensions/gsd/auto-verification.js +28 -22
- package/dist/resources/extensions/gsd/auto-worktree.js +111 -1
- package/dist/resources/extensions/gsd/auto.js +158 -55
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +9 -8
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +16 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +4 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +37 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +31 -5
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
- package/dist/resources/extensions/gsd/doctor.js +2 -28
- package/dist/resources/extensions/gsd/export-html.js +27 -425
- package/dist/resources/extensions/gsd/git-service.js +39 -1
- package/dist/resources/extensions/gsd/gsd-db.js +1 -0
- package/dist/resources/extensions/gsd/guided-flow.js +13 -6
- package/dist/resources/extensions/gsd/md-importer.js +1 -1
- package/dist/resources/extensions/gsd/migrate/command.js +5 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +9 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +51 -4
- package/dist/resources/extensions/gsd/migrate/writer.js +11 -1
- package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +48 -12
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -2
- package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
- package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
- package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
- package/dist/resources/extensions/gsd/status-guards.js +4 -0
- package/dist/resources/extensions/gsd/templates/plan.md +8 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +4 -2
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
- package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +89 -14
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +32 -10
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +68 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +54 -10
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
- package/dist/resources/extensions/visual-brief/prompts.js +140 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -5
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -7
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -7
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -5
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
- package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/{8359.e059d86b255fce1c.js → 8359.7eb3bb8f8ecf4c01.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-9a4db269f9ed63ad.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +4 -4
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/mcp-server/README.md +13 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +80 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +23 -1
- package/packages/mcp-server/src/workflow-tools.ts +168 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +5 -6
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
- package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
- package/packages/pi-ai/src/providers/simple-options.ts +5 -6
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +5 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/tui.ts +6 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/src/resources/GSD-WORKFLOW.md +10 -1
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +59 -16
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +8 -5
- package/src/resources/extensions/gsd/auto/orchestrator.ts +129 -6
- package/src/resources/extensions/gsd/auto/phases.ts +7 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +14 -6
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +266 -139
- package/src/resources/extensions/gsd/auto-prompts.ts +2 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -0
- package/src/resources/extensions/gsd/auto-start.ts +92 -9
- package/src/resources/extensions/gsd/auto-verification.ts +36 -34
- package/src/resources/extensions/gsd/auto-worktree.ts +119 -1
- package/src/resources/extensions/gsd/auto.ts +167 -53
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +6 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +9 -8
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +19 -3
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +4 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +40 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +30 -4
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/git-service.ts +45 -1
- package/src/resources/extensions/gsd/gsd-db.ts +3 -0
- package/src/resources/extensions/gsd/guided-flow.ts +14 -7
- package/src/resources/extensions/gsd/md-importer.ts +1 -1
- package/src/resources/extensions/gsd/migrate/command.ts +5 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/migrate/preview.ts +10 -0
- package/src/resources/extensions/gsd/migrate/transformer.ts +58 -4
- package/src/resources/extensions/gsd/migrate/writer.ts +14 -1
- package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +54 -12
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -2
- package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/src/resources/extensions/gsd/prompts/queue.md +4 -4
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
- package/src/resources/extensions/gsd/status-guards.ts +5 -0
- package/src/resources/extensions/gsd/templates/plan.md +8 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +4 -2
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +487 -4
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +12 -11
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +5 -9
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +43 -2
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +103 -1
- package/src/resources/extensions/gsd/tests/integration/migrate-command.test.ts +48 -3
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/migrate-transformer.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +26 -18
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +63 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +225 -1
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +86 -0
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +46 -2
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +119 -23
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +86 -7
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +54 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
- package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
- package/src/resources/extensions/gsd/tools/plan-slice.ts +98 -12
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +135 -0
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +47 -11
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +78 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +61 -10
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/subagent/index.ts +567 -103
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
- package/src/resources/extensions/visual-brief/prompts.ts +183 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
- package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
- package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
- package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- /package/dist/web/standalone/.next/static/{KDRTXR-22LPCsa80X9dey → euQ0CLP_v8V4e76Tu3odJ}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{KDRTXR-22LPCsa80X9dey → euQ0CLP_v8V4e76Tu3odJ}/_ssgManifest.js +0 -0
|
@@ -21,7 +21,7 @@ import { invalidateAllCaches } from "./cache.js";
|
|
|
21
21
|
import { writeLock, clearLock } from "./crash-recovery.js";
|
|
22
22
|
import { acquireSessionLock, releaseSessionLock, updateSessionLock, } from "./session-lock.js";
|
|
23
23
|
import { ensureGitignore, untrackRuntimeFiles } from "./gitignore.js";
|
|
24
|
-
import { nativeIsRepo, nativeInit, nativeAddAll, nativeCommit, nativeGetCurrentBranch, nativeDetectMainBranch, nativeCheckoutBranch, nativeBranchList, nativeBranchListMerged, nativeBranchDelete, nativeWorktreeRemove, nativeCommitCountBetween, } from "./native-git-bridge.js";
|
|
24
|
+
import { nativeIsRepo, nativeInit, nativeAddAll, nativeCommit, nativeGetCurrentBranch, nativeDetectMainBranch, nativeCheckoutBranch, nativeBranchList, nativeBranchExists, nativeBranchListMerged, nativeBranchDelete, nativeWorktreeRemove, nativeCommitCountBetween, } from "./native-git-bridge.js";
|
|
25
25
|
import { GitServiceImpl } from "./git-service.js";
|
|
26
26
|
import { captureIntegrationBranch, detectWorktreeName, setActiveMilestoneId, } from "./worktree.js";
|
|
27
27
|
import { getAutoWorktreePath } from "./auto-worktree.js";
|
|
@@ -33,7 +33,7 @@ import { initRoutingHistory } from "./routing-history.js";
|
|
|
33
33
|
import { restoreHookState, resetHookState } from "./post-unit-hooks.js";
|
|
34
34
|
import { resetProactiveHealing, setLevelChangeCallback } from "./doctor-proactive.js";
|
|
35
35
|
import { snapshotSkills } from "./skill-discovery.js";
|
|
36
|
-
import { isDbAvailable, getMilestone, openDatabase, getDbStatus } from "./gsd-db.js";
|
|
36
|
+
import { isDbAvailable, getMilestone, getAllMilestones, openDatabase, getDbStatus } from "./gsd-db.js";
|
|
37
37
|
import { isClosedStatus } from "./status-guards.js";
|
|
38
38
|
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
39
39
|
import { auditOrphanedPreflightStashes } from "./orphan-stash-audit.js";
|
|
@@ -88,9 +88,11 @@ export function decideSurvivorAction(hasSurvivorBranch, phase) {
|
|
|
88
88
|
return "finalize";
|
|
89
89
|
return "none";
|
|
90
90
|
}
|
|
91
|
-
export function auditOrphanedMilestoneBranches(basePath, isolationMode) {
|
|
91
|
+
export function auditOrphanedMilestoneBranches(basePath, isolationMode, gitDeps = {}) {
|
|
92
92
|
const recovered = [];
|
|
93
93
|
const warnings = [];
|
|
94
|
+
const branchList = gitDeps.branchList ?? nativeBranchList;
|
|
95
|
+
const branchExists = gitDeps.branchExists ?? nativeBranchExists;
|
|
94
96
|
// Skip in none mode — no milestone branches are created
|
|
95
97
|
if (isolationMode === "none")
|
|
96
98
|
return { recovered, warnings };
|
|
@@ -98,15 +100,16 @@ export function auditOrphanedMilestoneBranches(basePath, isolationMode) {
|
|
|
98
100
|
if (!isDbAvailable())
|
|
99
101
|
return { recovered, warnings };
|
|
100
102
|
let milestoneBranches;
|
|
103
|
+
let milestoneBranchListAvailable = true;
|
|
101
104
|
try {
|
|
102
|
-
milestoneBranches =
|
|
105
|
+
milestoneBranches = branchList(basePath, "milestone/*");
|
|
103
106
|
}
|
|
104
107
|
catch {
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
milestoneBranchListAvailable = false;
|
|
109
|
+
// git branch list failed — fall through with an empty branch set so the
|
|
110
|
+
// branch-less orphan pass can still run after per-milestone verification.
|
|
111
|
+
milestoneBranches = [];
|
|
107
112
|
}
|
|
108
|
-
if (milestoneBranches.length === 0)
|
|
109
|
-
return { recovered, warnings };
|
|
110
113
|
// Detect main branch for merge-check
|
|
111
114
|
let mainBranch;
|
|
112
115
|
try {
|
|
@@ -236,6 +239,71 @@ export function auditOrphanedMilestoneBranches(basePath, isolationMode) {
|
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
}
|
|
242
|
+
// Second pass (#5879): catch worktree directories stranded by a previous
|
|
243
|
+
// audit that deleted the milestone/* branch but failed to remove the
|
|
244
|
+
// directory (or the dir was orphaned by a separate path entirely, e.g.
|
|
245
|
+
// postflight-stash-restore-failed during closeout). The branch-keyed loop
|
|
246
|
+
// above is invisible to these cases — `nativeBranchList` returns nothing
|
|
247
|
+
// for the milestone, so the dir-cleanup block at line ~310 is never
|
|
248
|
+
// reached.
|
|
249
|
+
//
|
|
250
|
+
// Keyed on milestones whose DB status is `complete`. We do not iterate
|
|
251
|
+
// over arbitrary directories under .gsd/worktrees/ to avoid touching
|
|
252
|
+
// dirs that belong to an in-progress milestone whose branch was deleted
|
|
253
|
+
// separately — those are handled by the in-progress orphan path above
|
|
254
|
+
// when the branch is present, and by `/gsd doctor` when it is not.
|
|
255
|
+
const seenMilestoneIds = new Set(milestoneBranches.map((branch) => branch.replace(/^milestone\//, "")));
|
|
256
|
+
let completedMilestones = [];
|
|
257
|
+
try {
|
|
258
|
+
completedMilestones = getAllMilestones();
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
// DB read failure — skip the second pass; the first pass is still useful.
|
|
262
|
+
completedMilestones = [];
|
|
263
|
+
}
|
|
264
|
+
for (const m of completedMilestones) {
|
|
265
|
+
if (m.status !== "complete")
|
|
266
|
+
continue;
|
|
267
|
+
if (seenMilestoneIds.has(m.id))
|
|
268
|
+
continue; // already processed in the branch loop
|
|
269
|
+
if (!milestoneBranchListAvailable) {
|
|
270
|
+
try {
|
|
271
|
+
if (branchExists(basePath, `milestone/${m.id}`))
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
catch (err) {
|
|
275
|
+
warnings.push(`Could not verify whether milestone/${m.id} still exists; skipping branch-less worktree cleanup for safety: ${err instanceof Error ? err.message : String(err)}`);
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const wtDir = getWorktreeDir(basePath, m.id);
|
|
280
|
+
if (!existsSync(wtDir))
|
|
281
|
+
continue;
|
|
282
|
+
if (!isInsideWorktreesDir(basePath, wtDir)) {
|
|
283
|
+
warnings.push(`Orphaned worktree directory for ${m.id} is outside .gsd/worktrees/ — skipping removal for safety.`);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
// Try `git worktree remove` first in case the dir is still registered
|
|
287
|
+
// (defensive — usually it is not when we reach this branch-less pass).
|
|
288
|
+
try {
|
|
289
|
+
nativeWorktreeRemove(basePath, wtDir, true);
|
|
290
|
+
}
|
|
291
|
+
catch (e) {
|
|
292
|
+
logWarning("engine", `worktree remove failed (expected for branch-less orphans): ${e instanceof Error ? e.message : String(e)}`);
|
|
293
|
+
}
|
|
294
|
+
if (existsSync(wtDir)) {
|
|
295
|
+
try {
|
|
296
|
+
rmSync(wtDir, { recursive: true, force: true });
|
|
297
|
+
recovered.push(`Removed orphaned worktree directory for ${m.id} (branch already deleted).`);
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
warnings.push(`Failed to remove orphaned worktree directory for ${m.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
recovered.push(`Removed orphaned worktree directory for ${m.id} (branch already deleted).`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
239
307
|
return { recovered, warnings };
|
|
240
308
|
}
|
|
241
309
|
/**
|
|
@@ -368,7 +436,7 @@ export function _mergeOrphanCompletedMilestone(lifecycle, orphanId, ui) {
|
|
|
368
436
|
return { merged: false, error: err };
|
|
369
437
|
}
|
|
370
438
|
export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, requestedStepMode, deps, interrupted) {
|
|
371
|
-
const { shouldUseWorktreeIsolation, registerSigtermHandler, lockBase, buildLifecycle, } = deps;
|
|
439
|
+
const { shouldUseWorktreeIsolation, registerSigtermHandler, registerAutoWorkerForSession, lockBase, buildLifecycle, } = deps;
|
|
372
440
|
const dirCheck = validateDirectory(base);
|
|
373
441
|
if (dirCheck.severity === "blocked") {
|
|
374
442
|
ctx.ui.notify(dirCheck.reason, "error");
|
|
@@ -523,6 +591,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
523
591
|
// consult DB status and avoid clearing runtime units for milestones that
|
|
524
592
|
// only have a failure-path SUMMARY on disk (#4663).
|
|
525
593
|
await openProjectDbIfPresent(base);
|
|
594
|
+
registerAutoWorkerForSession(base);
|
|
526
595
|
// Clean stale runtime unit files for completed milestones (#887).
|
|
527
596
|
// DB-authoritative: when DB is available, require DB status to be closed
|
|
528
597
|
// before clearing runtime units. A SUMMARY file alone is no longer
|
|
@@ -606,12 +675,16 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
606
675
|
// worktree cleanup) was never run — the survivor branch must be merged.
|
|
607
676
|
// Applies to both worktree and branch isolation modes.
|
|
608
677
|
let hasSurvivorBranch = false;
|
|
609
|
-
|
|
678
|
+
let survivorMilestoneId = state.activeMilestone?.id ?? null;
|
|
679
|
+
if (!survivorMilestoneId && state.phase === "complete") {
|
|
680
|
+
survivorMilestoneId = findUnmergedCompletedMilestone(base, getIsolationMode(base));
|
|
681
|
+
}
|
|
682
|
+
if (survivorMilestoneId &&
|
|
610
683
|
(state.phase === "pre-planning" || state.phase === "complete") &&
|
|
611
684
|
getIsolationMode(base) !== "none" &&
|
|
612
685
|
!detectWorktreeName(base) &&
|
|
613
686
|
!base.includes(`${pathSep}.gsd${pathSep}worktrees${pathSep}`)) {
|
|
614
|
-
const milestoneBranch = `milestone/${
|
|
687
|
+
const milestoneBranch = `milestone/${survivorMilestoneId}`;
|
|
615
688
|
const { nativeBranchExists } = await import("./native-git-bridge.js");
|
|
616
689
|
hasSurvivorBranch = nativeBranchExists(base, milestoneBranch);
|
|
617
690
|
if (hasSurvivorBranch) {
|
|
@@ -645,7 +718,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
645
718
|
// Re-evaluate via the helper — the discuss branch above may have cleared
|
|
646
719
|
// hasSurvivorBranch after a successful promotion.
|
|
647
720
|
if (decideSurvivorAction(hasSurvivorBranch, state.phase) === "finalize") {
|
|
648
|
-
const mid =
|
|
721
|
+
const mid = survivorMilestoneId;
|
|
649
722
|
// Commit 68ef58a3c made `_mergeBranchMode` throw on wrong-branch
|
|
650
723
|
// instead of returning false silently. Wrap the call so the throw is
|
|
651
724
|
// converted into an error notify + clean bootstrap abort, not an
|
|
@@ -18,9 +18,7 @@ import { join } from "node:path";
|
|
|
18
18
|
import { resolveUokFlags } from "./uok/flags.js";
|
|
19
19
|
import { UokGateRunner } from "./uok/gate-runner.js";
|
|
20
20
|
import { verificationRetryKey } from "./auto/verification-retry-policy.js";
|
|
21
|
-
|
|
22
|
-
return /\b(ENOENT|ENOTFOUND|ETIMEDOUT|ECONNRESET|EAI_AGAIN|spawn\s+\S+\s+ENOENT|command not found)\b/i.test(stderr);
|
|
23
|
-
}
|
|
21
|
+
import { decideVerificationVerdict } from "./verification-verdict.js";
|
|
24
22
|
/**
|
|
25
23
|
* Post-unit guard for `validate-milestone` units (#4094).
|
|
26
24
|
*
|
|
@@ -128,7 +126,7 @@ async function countIncompleteSlices(basePath, milestoneId) {
|
|
|
128
126
|
/**
|
|
129
127
|
* Run the verification gate for the current execute-task unit.
|
|
130
128
|
* Returns:
|
|
131
|
-
* - "continue" —
|
|
129
|
+
* - "continue" — host-owned verification passed, proceed normally
|
|
132
130
|
* - "retry" — gate failed with retries remaining, s.pendingVerificationRetry set for loop re-iteration
|
|
133
131
|
* - "pause" — gate failed with retries exhausted, pauseAuto already called
|
|
134
132
|
*/
|
|
@@ -178,6 +176,10 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
178
176
|
process.stderr.write(` [${w.severity}] ${w.name}: ${w.title}\n`);
|
|
179
177
|
}
|
|
180
178
|
}
|
|
179
|
+
const verdict = decideVerificationVerdict(s.currentUnit.type, result);
|
|
180
|
+
if (!verdict.passed) {
|
|
181
|
+
result.passed = false;
|
|
182
|
+
}
|
|
181
183
|
if (uokFlags.gates) {
|
|
182
184
|
const gateRunner = new UokGateRunner();
|
|
183
185
|
gateRunner.register({
|
|
@@ -190,10 +192,12 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
190
192
|
: "verification",
|
|
191
193
|
rationale: result.passed
|
|
192
194
|
? "verification checks passed"
|
|
193
|
-
:
|
|
195
|
+
: verdict.reason === "no-host-checks"
|
|
196
|
+
? "no runnable host-owned verification checks discovered"
|
|
197
|
+
: "verification checks failed",
|
|
194
198
|
findings: result.passed
|
|
195
199
|
? ""
|
|
196
|
-
: formatFailureContext(result),
|
|
200
|
+
: verdict.failureContext || formatFailureContext(result),
|
|
197
201
|
}),
|
|
198
202
|
});
|
|
199
203
|
await gateRunner.run("verification-gate", {
|
|
@@ -251,7 +255,11 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
251
255
|
}
|
|
252
256
|
else {
|
|
253
257
|
const nextAttempt = attempt + 1;
|
|
254
|
-
|
|
258
|
+
const includeRetryMetadata = !result.passed &&
|
|
259
|
+
verdict.retryable &&
|
|
260
|
+
autoFixEnabled &&
|
|
261
|
+
nextAttempt <= maxRetries;
|
|
262
|
+
writeVerificationJSON(result, tasksDir, tid, s.currentUnit.id, includeRetryMetadata ? nextAttempt : undefined, includeRetryMetadata ? maxRetries : undefined);
|
|
255
263
|
}
|
|
256
264
|
}
|
|
257
265
|
}
|
|
@@ -259,18 +267,6 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
259
267
|
logWarning("engine", `verification-evidence write error: ${evidenceErr.message}`);
|
|
260
268
|
}
|
|
261
269
|
}
|
|
262
|
-
const advisoryFailure = !result.passed &&
|
|
263
|
-
(result.discoverySource === "package-json" ||
|
|
264
|
-
result.checks.some((check) => isInfraVerificationFailure(check.stderr)));
|
|
265
|
-
if (advisoryFailure) {
|
|
266
|
-
s.verificationRetryCount.delete(retryKey);
|
|
267
|
-
s.verificationRetryFailureHashes.delete(retryKey);
|
|
268
|
-
s.pendingVerificationRetry = null;
|
|
269
|
-
ctx.ui.notify(result.discoverySource === "package-json"
|
|
270
|
-
? "Verification failed in auto-discovered package.json checks — treating as advisory."
|
|
271
|
-
: "Verification failed due to infrastructure/runtime environment issues — treating as advisory.", "warning");
|
|
272
|
-
return "continue";
|
|
273
|
-
}
|
|
274
270
|
// ── Post-execution checks (run after main verification passes for execute-task units) ──
|
|
275
271
|
let postExecChecks;
|
|
276
272
|
let postExecBlockingFailure = false;
|
|
@@ -430,6 +426,15 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
430
426
|
s.pendingVerificationRetry = null;
|
|
431
427
|
return "continue";
|
|
432
428
|
}
|
|
429
|
+
else if (verdict.reason === "no-host-checks") {
|
|
430
|
+
s.verificationRetryCount.delete(retryKey);
|
|
431
|
+
s.verificationRetryFailureHashes.delete(retryKey);
|
|
432
|
+
s.pendingVerificationRetry = null;
|
|
433
|
+
ctx.ui.notify("Verification gate FAILED — no runnable host-owned verification checks were discovered. Pausing for human review.", "error");
|
|
434
|
+
process.stderr.write(`verification-gate: ${verdict.failureContext}\n`);
|
|
435
|
+
await pauseAuto(ctx, pi);
|
|
436
|
+
return "pause";
|
|
437
|
+
}
|
|
433
438
|
else if (postExecBlockingFailure) {
|
|
434
439
|
// Post-execution failures are cross-task consistency issues — retrying the same task won't fix them.
|
|
435
440
|
// Skip retry and pause immediately for human review.
|
|
@@ -445,7 +450,7 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
445
450
|
s.verificationRetryCount.set(retryKey, nextAttempt);
|
|
446
451
|
s.pendingVerificationRetry = {
|
|
447
452
|
unitId: s.currentUnit.id,
|
|
448
|
-
failureContext: formatFailureContext(result),
|
|
453
|
+
failureContext: verdict.failureContext || formatFailureContext(result),
|
|
449
454
|
attempt: nextAttempt,
|
|
450
455
|
};
|
|
451
456
|
const failedCmds = result.checks
|
|
@@ -475,9 +480,10 @@ export async function runPostUnitVerification(vctx, pauseAuto) {
|
|
|
475
480
|
}
|
|
476
481
|
}
|
|
477
482
|
catch (err) {
|
|
478
|
-
// Gate errors are non-fatal
|
|
479
483
|
logWarning("engine", `verification-gate error: ${err.message}`);
|
|
480
|
-
|
|
484
|
+
ctx.ui.notify(`Verification gate errored before producing an authoritative verdict: ${err.message}`, "error");
|
|
485
|
+
await pauseAuto(ctx, pi);
|
|
486
|
+
return "pause";
|
|
481
487
|
}
|
|
482
488
|
}
|
|
483
489
|
/**
|
|
@@ -173,7 +173,18 @@ function gitPathspecForWorktreePath(basePath, targetPath) {
|
|
|
173
173
|
let base = basePath;
|
|
174
174
|
let target = targetPath;
|
|
175
175
|
try {
|
|
176
|
-
base =
|
|
176
|
+
base = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
177
|
+
cwd: basePath,
|
|
178
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
179
|
+
encoding: "utf-8",
|
|
180
|
+
}).trim() || basePath;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
/* keep original */
|
|
184
|
+
void base;
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
base = realpathSync.native(base);
|
|
177
188
|
}
|
|
178
189
|
catch {
|
|
179
190
|
/* keep original */
|
|
@@ -191,6 +202,9 @@ function gitPathspecForWorktreePath(basePath, targetPath) {
|
|
|
191
202
|
return null;
|
|
192
203
|
return rel.replaceAll("\\", "/");
|
|
193
204
|
}
|
|
205
|
+
export function _gitPathspecForWorktreePath(basePath, targetPath) {
|
|
206
|
+
return gitPathspecForWorktreePath(basePath, targetPath);
|
|
207
|
+
}
|
|
194
208
|
function gitRemoteExists(basePath, remote) {
|
|
195
209
|
try {
|
|
196
210
|
execFileSync("git", ["remote", "get-url", remote], {
|
|
@@ -204,6 +218,52 @@ function gitRemoteExists(basePath, remote) {
|
|
|
204
218
|
return false;
|
|
205
219
|
}
|
|
206
220
|
}
|
|
221
|
+
function findRegularMergeChangedPaths(basePath, milestoneBranch, mainBranch) {
|
|
222
|
+
const changedPaths = new Set();
|
|
223
|
+
let mergeLog = "";
|
|
224
|
+
try {
|
|
225
|
+
mergeLog = execFileSync("git", ["rev-list", "--merges", "--parents", mainBranch], {
|
|
226
|
+
cwd: basePath,
|
|
227
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
228
|
+
encoding: "utf-8",
|
|
229
|
+
}).trim();
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
logWarning("worktree", `regular merge lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
233
|
+
return changedPaths;
|
|
234
|
+
}
|
|
235
|
+
for (const line of mergeLog.split("\n").filter(Boolean)) {
|
|
236
|
+
const [mergeCommit, firstParent, ...otherParents] = line.split(" ");
|
|
237
|
+
if (!mergeCommit || !firstParent || otherParents.length === 0)
|
|
238
|
+
continue;
|
|
239
|
+
const mergedMilestone = otherParents.some((parent) => {
|
|
240
|
+
try {
|
|
241
|
+
return nativeIsAncestor(basePath, milestoneBranch, parent);
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
if (!mergedMilestone)
|
|
248
|
+
continue;
|
|
249
|
+
try {
|
|
250
|
+
const output = execFileSync("git", ["diff", "--name-only", firstParent, mergeCommit], {
|
|
251
|
+
cwd: basePath,
|
|
252
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
253
|
+
encoding: "utf-8",
|
|
254
|
+
}).trim();
|
|
255
|
+
for (const path of output.split("\n").filter(Boolean)) {
|
|
256
|
+
if (!path.startsWith(".gsd/"))
|
|
257
|
+
changedPaths.add(path);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
logWarning("worktree", `regular merge diff lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
262
|
+
}
|
|
263
|
+
return changedPaths;
|
|
264
|
+
}
|
|
265
|
+
return changedPaths;
|
|
266
|
+
}
|
|
207
267
|
function clearProjectRootStateFiles(basePath, milestoneId) {
|
|
208
268
|
const gsdDir = gsdRoot(basePath);
|
|
209
269
|
// Phase C pt 2: auto.lock removed from this list — the file is gone
|
|
@@ -1482,6 +1542,56 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1482
1542
|
});
|
|
1483
1543
|
}
|
|
1484
1544
|
}
|
|
1545
|
+
// Already regular-merged milestones can skip the squash path and proceed to cleanup (#5831).
|
|
1546
|
+
if (nativeIsAncestor(originalBasePath_, milestoneBranch, mainBranch)) {
|
|
1547
|
+
const codeChanges = nativeDiffNumstat(originalBasePath_, mainBranch, milestoneBranch).filter((entry) => !entry.path.startsWith(".gsd/"));
|
|
1548
|
+
if (codeChanges.length > 0) {
|
|
1549
|
+
const regularMergeChangedPaths = findRegularMergeChangedPaths(originalBasePath_, milestoneBranch, mainBranch);
|
|
1550
|
+
const unanchoredCodeChanges = codeChanges.filter((entry) => regularMergeChangedPaths.has(entry.path));
|
|
1551
|
+
if (unanchoredCodeChanges.length > 0) {
|
|
1552
|
+
process.chdir(previousCwd);
|
|
1553
|
+
throw new GSDError(GSD_GIT_ERROR, `Milestone branch "${milestoneBranch}" is reachable from "${mainBranch}" ` +
|
|
1554
|
+
`but has ${unanchoredCodeChanges.length} milestone-touched code file(s) not on current "${mainBranch}". ` +
|
|
1555
|
+
`Aborting worktree teardown to prevent data loss.`);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
debugLog("mergeMilestoneToMain", {
|
|
1559
|
+
action: "skip-squash-already-merged",
|
|
1560
|
+
milestoneId,
|
|
1561
|
+
milestoneBranch,
|
|
1562
|
+
mainBranch,
|
|
1563
|
+
});
|
|
1564
|
+
try {
|
|
1565
|
+
clearProjectRootStateFiles(originalBasePath_, milestoneId);
|
|
1566
|
+
}
|
|
1567
|
+
catch (err) {
|
|
1568
|
+
logWarning("worktree", `clearProjectRootStateFiles failed during already-merged cleanup: ${err instanceof Error ? err.message : String(err)}`);
|
|
1569
|
+
}
|
|
1570
|
+
try {
|
|
1571
|
+
removeWorktree(originalBasePath_, milestoneId, {
|
|
1572
|
+
branch: milestoneBranch,
|
|
1573
|
+
deleteBranch: false,
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
catch (err) {
|
|
1577
|
+
logWarning("worktree", `worktree removal failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1578
|
+
}
|
|
1579
|
+
try {
|
|
1580
|
+
nativeBranchDelete(originalBasePath_, milestoneBranch);
|
|
1581
|
+
}
|
|
1582
|
+
catch (err) {
|
|
1583
|
+
logWarning("worktree", `git branch-delete failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1584
|
+
}
|
|
1585
|
+
setActiveWorkspace(null);
|
|
1586
|
+
nudgeGitBranchCache(previousCwd);
|
|
1587
|
+
try {
|
|
1588
|
+
process.chdir(originalBasePath_);
|
|
1589
|
+
}
|
|
1590
|
+
catch (err) {
|
|
1591
|
+
logWarning("worktree", `chdir to project root after already-merged cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1592
|
+
}
|
|
1593
|
+
return { commitMessage, pushed: false, prCreated: false, codeFilesChanged: true };
|
|
1594
|
+
}
|
|
1485
1595
|
// 7. Shelter queued milestone directories before the squash merge (#2505).
|
|
1486
1596
|
// The milestone branch may contain copies of queued milestone dirs (via
|
|
1487
1597
|
// copyPlanningArtifacts), so `git merge --squash` rejects when those same
|