gsd-pi 2.80.0-dev.fbe7c8c6f → 2.81.0
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 +35 -59
- package/dist/claude-cli-check.d.ts +30 -0
- package/dist/claude-cli-check.js +18 -7
- package/dist/cli.js +0 -19
- package/dist/headless-query.d.ts +10 -0
- package/dist/headless-query.js +6 -4
- package/dist/loader-entrypoint.d.ts +8 -0
- package/dist/loader-entrypoint.js +27 -0
- package/dist/loader.js +2 -11
- package/dist/mcp-server.d.ts +1 -0
- package/dist/mcp-server.js +6 -3
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/claude-code-cli/readiness.js +18 -7
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +40 -3
- package/dist/resources/extensions/github-sync/sync.js +4 -1
- package/dist/resources/extensions/gsd/auto/contracts.js +2 -0
- package/dist/resources/extensions/gsd/auto/loop.js +103 -9
- package/dist/resources/extensions/gsd/auto/orchestrator.js +48 -4
- package/dist/resources/extensions/gsd/auto/phases.js +282 -132
- package/dist/resources/extensions/gsd/auto/resolve.js +29 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +22 -30
- package/dist/resources/extensions/gsd/auto/session.js +9 -1
- package/dist/resources/extensions/gsd/auto/unit-runner-events.js +7 -0
- package/dist/resources/extensions/gsd/auto/workflow-dispatch-claim.js +33 -1
- package/dist/resources/extensions/gsd/auto/workflow-worker-heartbeat.js +9 -1
- package/dist/resources/extensions/gsd/auto-dashboard.js +18 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +5 -32
- package/dist/resources/extensions/gsd/auto-dispatch.js +16 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +112 -78
- package/dist/resources/extensions/gsd/auto-prompts.js +103 -16
- package/dist/resources/extensions/gsd/auto-recovery.js +43 -1
- package/dist/resources/extensions/gsd/auto-start.js +252 -14
- package/dist/resources/extensions/gsd/auto-supervisor.js +8 -1
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +2 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +229 -336
- package/dist/resources/extensions/gsd/auto.js +264 -86
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +122 -11
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +44 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +37 -10
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +30 -20
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +6 -4
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +5 -3
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +1 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +330 -54
- package/dist/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.js +4 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +82 -23
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +19 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +24 -6
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +2 -2
- package/dist/resources/extensions/gsd/commands-config.js +1 -1
- package/dist/resources/extensions/gsd/commands-eval-review.js +2 -2
- package/dist/resources/extensions/gsd/commands-handlers.js +23 -9
- package/dist/resources/extensions/gsd/context-budget.js +37 -2
- package/dist/resources/extensions/gsd/crash-recovery.js +56 -10
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +92 -0
- package/dist/resources/extensions/gsd/db-base-schema.js +4 -2
- package/dist/resources/extensions/gsd/db-migration-steps.js +6 -0
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +2 -0
- package/dist/resources/extensions/gsd/git-service.js +73 -5
- package/dist/resources/extensions/gsd/gsd-db.js +46 -13
- package/dist/resources/extensions/gsd/guided-flow.js +119 -42
- package/dist/resources/extensions/gsd/health-widget.js +3 -0
- package/dist/resources/extensions/gsd/init-wizard.js +4 -1
- package/dist/resources/extensions/gsd/memory-store.js +69 -12
- package/dist/resources/extensions/gsd/migrate/command.js +40 -1
- package/dist/resources/extensions/gsd/migration-auto-check.js +87 -0
- package/dist/resources/extensions/gsd/native-git-bridge.js +32 -8
- package/dist/resources/extensions/gsd/orphan-stash-audit.js +101 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +13 -3
- package/dist/resources/extensions/gsd/planning-path-scope.js +26 -0
- package/dist/resources/extensions/gsd/pre-execution-checks.js +22 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +28 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +22 -17
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/execute-task.md +4 -2
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -5
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
- package/dist/resources/extensions/gsd/quick.js +34 -2
- package/dist/resources/extensions/gsd/recovery-classification.js +94 -0
- package/dist/resources/extensions/gsd/slice-cadence.js +45 -2
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +15 -9
- package/dist/resources/extensions/gsd/state-reconciliation.js +27 -0
- package/dist/resources/extensions/gsd/tool-contract.js +50 -0
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -7
- package/dist/resources/extensions/gsd/tools/complete-task.js +1 -1
- package/dist/resources/extensions/gsd/tools/context-mode-tool-result.js +15 -0
- package/dist/resources/extensions/gsd/tools/exec-search-tool.js +5 -0
- package/dist/resources/extensions/gsd/tools/exec-tool.js +3 -15
- package/dist/resources/extensions/gsd/tools/memory-tools.js +1 -0
- package/dist/resources/extensions/gsd/tools/plan-slice.js +9 -0
- package/dist/resources/extensions/gsd/tools/plan-task.js +9 -0
- package/dist/resources/extensions/gsd/tools/resume-tool.js +5 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +1 -1
- package/dist/resources/extensions/gsd/unit-context-composer.js +12 -3
- package/dist/resources/extensions/gsd/unit-runtime.js +22 -0
- package/dist/resources/extensions/gsd/workflow-protocol.js +131 -0
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +958 -0
- package/dist/resources/extensions/gsd/worktree-safety.js +119 -0
- package/dist/resources/extensions/gsd/worktree-state-projection.js +317 -0
- package/dist/resources/skills/web-quality-audit/scripts/analyze.sh +0 -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 +4 -4
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +2 -2
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +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_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 +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- 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/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- 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 +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- 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/63.js +3 -3
- package/dist/web/standalone/.next/server/chunks/6897.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +3 -3
- 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/8359.e059d86b255fce1c.js +10 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-f2a7482d42a5614b.js → page-2f24283c162b6ab3.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-a16c7a7ecdf0c2cf.js → layout-9ecfd95f343793f0.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-200592a7f3baf579.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-0481f1221120a7c6.js → webpack-de742b64187e13fe.js} +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/dist/welcome-screen.d.ts +2 -0
- package/dist/welcome-screen.js +9 -7
- package/package.json +3 -3
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +22 -17
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/workflow-tools.test.ts +75 -2
- package/packages/mcp-server/src/workflow-tools.ts +30 -16
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +4 -1
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +9 -2
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +43 -11
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/index.d.ts +1 -0
- package/packages/pi-agent-core/dist/index.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/index.js +2 -0
- package/packages/pi-agent-core/dist/index.js.map +1 -1
- package/packages/pi-agent-core/dist/token-audit.d.ts +47 -0
- package/packages/pi-agent-core/dist/token-audit.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/token-audit.js +221 -0
- package/packages/pi-agent-core/dist/token-audit.js.map +1 -0
- package/packages/pi-agent-core/dist/types.d.ts +31 -0
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/types.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +128 -0
- package/packages/pi-agent-core/src/agent-loop.ts +4 -1
- package/packages/pi-agent-core/src/agent.ts +52 -11
- package/packages/pi-agent-core/src/index.ts +2 -0
- package/packages/pi-agent-core/src/token-audit.test.ts +189 -0
- package/packages/pi-agent-core/src/token-audit.ts +287 -0
- package/packages/pi-agent-core/src/types.ts +26 -10
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +35 -13
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js +21 -11
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +7 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +9 -7
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js +23 -14
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +2 -0
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +48 -21
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js +22 -21
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js +22 -21
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +39 -25
- package/packages/pi-ai/src/providers/anthropic-bearer-auth.test.ts +26 -22
- package/packages/pi-ai/src/providers/anthropic.ts +22 -9
- package/packages/pi-ai/src/providers/minimax-tool-name.test.ts +34 -21
- package/packages/pi-ai/src/types.ts +3 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +56 -22
- package/packages/pi-ai/src/utils/oauth/google-antigravity.test.ts +24 -28
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.test.ts +24 -28
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +36 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +30 -1
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +21 -2
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +94 -16
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +6 -2
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +11 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +9 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js +103 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.js +66 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.js +24 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +8 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +3 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +6 -6
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +5 -3
- package/packages/pi-coding-agent/dist/core/extensions/runner.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +60 -4
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js +2 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.js +46 -0
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts +10 -2
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +81 -4
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +20 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +25 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js +22 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +6 -7
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +2 -3
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash-spawn-windows.test.js +22 -56
- package/packages/pi-coding-agent/dist/core/tools/bash-spawn-windows.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.js +12 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.js +14 -6
- package/packages/pi-coding-agent/dist/core/tools/find.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/grep.js +12 -3
- package/packages/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +2 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/ls.js +10 -3
- package/packages/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/read.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/read.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js +7 -62
- package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.js +115 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.d.ts +19 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.js +20 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts +4 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/write.js +9 -1
- package/packages/pi-coding-agent/dist/core/tools/write.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +89 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +25 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +6 -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 +155 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +31 -6
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +2 -0
- 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 +25 -3
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +28 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +3 -2
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +40 -1
- package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +40 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +102 -16
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +6 -2
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +18 -0
- package/packages/pi-coding-agent/src/core/compaction-threshold.test.ts +121 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.test.ts +32 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.ts +66 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +10 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +5 -3
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +8 -5
- package/packages/pi-coding-agent/src/core/extensions/types.ts +63 -2
- package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +2 -0
- package/packages/pi-coding-agent/src/core/sdk-tool-filter.test.ts +60 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +92 -4
- package/packages/pi-coding-agent/src/core/settings-manager.ts +39 -1
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +28 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +8 -10
- package/packages/pi-coding-agent/src/core/tools/bash-spawn-windows.test.ts +22 -66
- package/packages/pi-coding-agent/src/core/tools/bash.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/edit.ts +13 -1
- package/packages/pi-coding-agent/src/core/tools/find.ts +15 -6
- package/packages/pi-coding-agent/src/core/tools/grep.ts +13 -3
- package/packages/pi-coding-agent/src/core/tools/hashline-read.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/index.ts +8 -0
- package/packages/pi-coding-agent/src/core/tools/ls.ts +11 -3
- package/packages/pi-coding-agent/src/core/tools/read.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/spawn-shell-windows.test.ts +11 -72
- package/packages/pi-coding-agent/src/core/tools/tool-target-metadata.test.ts +127 -0
- package/packages/pi-coding-agent/src/core/tools/tool-target.ts +48 -0
- package/packages/pi-coding-agent/src/core/tools/write.ts +14 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +119 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +31 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +180 -7
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +75 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +39 -8
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +27 -3
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +1 -1
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +31 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +3 -2
- 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 +18 -8
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/tui.ts +20 -8
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/README.md +7 -0
- package/packages/rpc-client/package.json +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +25 -7
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +42 -3
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +67 -0
- package/src/resources/extensions/github-sync/sync.ts +8 -1
- package/src/resources/extensions/github-sync/tests/sync-source.test.ts +6 -18
- package/src/resources/extensions/gsd/auto/contracts.ts +19 -2
- package/src/resources/extensions/gsd/auto/loop-deps.ts +10 -11
- package/src/resources/extensions/gsd/auto/loop.ts +134 -16
- package/src/resources/extensions/gsd/auto/orchestrator.ts +52 -4
- package/src/resources/extensions/gsd/auto/phases.ts +393 -200
- package/src/resources/extensions/gsd/auto/resolve.ts +42 -1
- package/src/resources/extensions/gsd/auto/run-unit.ts +28 -30
- package/src/resources/extensions/gsd/auto/session.ts +9 -1
- package/src/resources/extensions/gsd/auto/types.ts +3 -0
- package/src/resources/extensions/gsd/auto/unit-runner-events.ts +15 -0
- package/src/resources/extensions/gsd/auto/workflow-dispatch-claim.ts +63 -1
- package/src/resources/extensions/gsd/auto/workflow-worker-heartbeat.ts +14 -1
- package/src/resources/extensions/gsd/auto-dashboard.ts +20 -0
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +8 -34
- package/src/resources/extensions/gsd/auto-dispatch.ts +16 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +124 -80
- package/src/resources/extensions/gsd/auto-prompts.ts +112 -15
- package/src/resources/extensions/gsd/auto-recovery.ts +54 -0
- package/src/resources/extensions/gsd/auto-start.ts +319 -19
- package/src/resources/extensions/gsd/auto-supervisor.ts +7 -0
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +2 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +259 -360
- package/src/resources/extensions/gsd/auto.ts +324 -88
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +147 -11
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +45 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +36 -10
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +32 -19
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +5 -1
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +7 -4
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +6 -3
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +1 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +379 -54
- package/src/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.ts +4 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +90 -22
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +19 -2
- package/src/resources/extensions/gsd/clean-root-preflight.ts +32 -7
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +4 -2
- package/src/resources/extensions/gsd/commands-config.ts +1 -1
- package/src/resources/extensions/gsd/commands-eval-review.ts +2 -2
- package/src/resources/extensions/gsd/commands-handlers.ts +34 -15
- package/src/resources/extensions/gsd/context-budget.ts +44 -2
- package/src/resources/extensions/gsd/crash-recovery.ts +67 -10
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +107 -0
- package/src/resources/extensions/gsd/db-base-schema.ts +4 -2
- package/src/resources/extensions/gsd/db-migration-steps.ts +8 -0
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +3 -0
- package/src/resources/extensions/gsd/git-service.ts +87 -10
- package/src/resources/extensions/gsd/gsd-db.ts +50 -13
- package/src/resources/extensions/gsd/guided-flow.ts +148 -49
- package/src/resources/extensions/gsd/health-widget.ts +3 -0
- package/src/resources/extensions/gsd/init-wizard.ts +5 -1
- package/src/resources/extensions/gsd/memory-store.ts +77 -12
- package/src/resources/extensions/gsd/migrate/command.ts +47 -1
- package/src/resources/extensions/gsd/migration-auto-check.ts +129 -0
- package/src/resources/extensions/gsd/native-git-bridge.ts +39 -6
- package/src/resources/extensions/gsd/orphan-stash-audit.ts +117 -0
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +13 -3
- package/src/resources/extensions/gsd/planning-path-scope.ts +35 -0
- package/src/resources/extensions/gsd/pre-execution-checks.ts +23 -0
- package/src/resources/extensions/gsd/preferences-types.ts +1 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +27 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +22 -17
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/execute-task.md +4 -2
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/quick-task.md +1 -5
- package/src/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
- package/src/resources/extensions/gsd/quick.ts +37 -2
- package/src/resources/extensions/gsd/recovery-classification.ts +122 -0
- package/src/resources/extensions/gsd/slice-cadence.ts +49 -2
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +23 -9
- package/src/resources/extensions/gsd/state-reconciliation.ts +57 -0
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +59 -89
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +47 -172
- package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +0 -35
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +35 -9
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +543 -40
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +80 -59
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +119 -2
- package/src/resources/extensions/gsd/tests/auto-paused-session-validation.test.ts +3 -47
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +76 -18
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +175 -11
- package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +54 -95
- package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +67 -26
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +14 -1
- package/src/resources/extensions/gsd/tests/auto-remediate-slice-status.test.ts +32 -30
- package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +32 -128
- package/src/resources/extensions/gsd/tests/auto-start-clean-runtime-db-gated.test.ts +20 -54
- package/src/resources/extensions/gsd/tests/auto-start-cold-db-bootstrap.test.ts +20 -30
- package/src/resources/extensions/gsd/tests/auto-start-index-lock.test.ts +17 -29
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/auto-start-time-persistence.test.ts +21 -39
- package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +15 -24
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +44 -29
- package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +39 -51
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +159 -213
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +15 -32
- package/src/resources/extensions/gsd/tests/browser-teardown.test.ts +0 -41
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +15 -6
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +34 -27
- package/src/resources/extensions/gsd/tests/cmux.test.ts +51 -53
- package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +39 -61
- package/src/resources/extensions/gsd/tests/commands-config.test.ts +26 -19
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +14 -1
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/complete-slice-composer.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/complete-task-normalize-lists.test.ts +29 -33
- package/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts +45 -108
- package/src/resources/extensions/gsd/tests/context-budget.test.ts +10 -1
- package/src/resources/extensions/gsd/tests/context-store.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +90 -31
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +18 -10
- package/src/resources/extensions/gsd/tests/cwd-fallback-hardening.test.ts +138 -0
- package/src/resources/extensions/gsd/tests/dashboard-custom-engine.test.ts +4 -68
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +6 -11
- package/src/resources/extensions/gsd/tests/deferred-milestone-dir-4996.test.ts +14 -65
- package/src/resources/extensions/gsd/tests/discuss-tool-scoping.test.ts +44 -37
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +58 -40
- package/src/resources/extensions/gsd/tests/dispatch-guard-closed-status.test.ts +25 -15
- package/src/resources/extensions/gsd/tests/dispatch-rule-coverage.test.ts +313 -0
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +35 -17
- package/src/resources/extensions/gsd/tests/error-success-mask.test.ts +16 -21
- package/src/resources/extensions/gsd/tests/est-annotation-timeout.test.ts +15 -82
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +5 -2
- package/src/resources/extensions/gsd/tests/fast-forward-reused-milestone-branch.test.ts +219 -0
- package/src/resources/extensions/gsd/tests/finalize-survivor-branch.test.ts +151 -0
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +2 -20
- package/src/resources/extensions/gsd/tests/frontmatter-parse-noise.test.ts +18 -26
- package/src/resources/extensions/gsd/tests/init-skip-git.test.ts +9 -12
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/integration/commands-eval-review.integration.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/integration/git-locale.test.ts +31 -20
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/integration/milestone-transition-worktree.test.ts +0 -47
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +60 -202
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +13 -56
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +248 -10
- package/src/resources/extensions/gsd/tests/journal-query-tool.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/lazy-pi-tui-import.test.ts +44 -6
- package/src/resources/extensions/gsd/tests/memory-decay-factor.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +21 -35
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +37 -7
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-stash-restore.test.ts +267 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +88 -98
- package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +70 -278
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +34 -2
- package/src/resources/extensions/gsd/tests/needs-remediation-revalidation.test.ts +37 -30
- package/src/resources/extensions/gsd/tests/note-captures-executed.test.ts +32 -28
- package/src/resources/extensions/gsd/tests/originalbase-path-comparison.test.ts +44 -9
- package/src/resources/extensions/gsd/tests/orphan-merge-bootstrap.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/orphan-stash-audit.test.ts +201 -0
- package/src/resources/extensions/gsd/tests/parallel-orchestrator-fast-forward.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/phantom-ghost-detection.test.ts +24 -37
- package/src/resources/extensions/gsd/tests/phantom-milestone-default-queued.test.ts +9 -24
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +95 -75
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +36 -22
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +36 -30
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +45 -5
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +74 -4
- package/src/resources/extensions/gsd/tests/preferences-worktree-sync.test.ts +20 -22
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +130 -32
- package/src/resources/extensions/gsd/tests/project-root-cwd-crash.test.ts +18 -36
- package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +35 -73
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +76 -138
- package/src/resources/extensions/gsd/tests/prompt-duplication-cuts.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/prompt-path-audit.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +70 -106
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +59 -161
- package/src/resources/extensions/gsd/tests/query-tools-db-open.test.ts +33 -29
- package/src/resources/extensions/gsd/tests/queue-auto-guard.test.ts +22 -196
- package/src/resources/extensions/gsd/tests/quick-auto-guard.test.ts +23 -93
- package/src/resources/extensions/gsd/tests/quick-external-gsd.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +50 -79
- package/src/resources/extensions/gsd/tests/reassess-default-optin.test.ts +27 -13
- package/src/resources/extensions/gsd/tests/remote-questions.test.ts +151 -251
- package/src/resources/extensions/gsd/tests/resource-loader-import-path.test.ts +41 -29
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +58 -69
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +32 -164
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +57 -41
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/schema-v27-v28-sequence.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/select-resumable-milestone.test.ts +96 -0
- package/src/resources/extensions/gsd/tests/session-model-override.test.ts +14 -9
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +222 -0
- package/src/resources/extensions/gsd/tests/show-config-command.test.ts +44 -42
- package/src/resources/extensions/gsd/tests/signal-handlers.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/skip-slice-state-rebuild.test.ts +56 -24
- package/src/resources/extensions/gsd/tests/skipped-validation-db-atomicity.test.ts +51 -11
- package/src/resources/extensions/gsd/tests/slice-cadence.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +66 -50
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +68 -107
- package/src/resources/extensions/gsd/tests/slice-sequence-insert.test.ts +115 -42
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +21 -77
- package/src/resources/extensions/gsd/tests/smart-entry-draft.test.ts +25 -116
- package/src/resources/extensions/gsd/tests/sqlite-unavailable-gate.test.ts +21 -57
- package/src/resources/extensions/gsd/tests/stale-dirlistcache-4648.test.ts +29 -76
- package/src/resources/extensions/gsd/tests/stale-lockfile-recovery.test.ts +33 -24
- package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +39 -30
- package/src/resources/extensions/gsd/tests/stalled-tool-recovery.test.ts +49 -1
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -4
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +35 -40
- package/src/resources/extensions/gsd/tests/stop-auto-merge-back.test.ts +48 -46
- package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +14 -102
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +78 -232
- package/src/resources/extensions/gsd/tests/sync-worktree-skip-current.test.ts +32 -35
- package/src/resources/extensions/gsd/tests/system-context-memory.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +7 -9
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +84 -309
- package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +291 -0
- package/src/resources/extensions/gsd/tests/triage-dispatch.test.ts +134 -341
- package/src/resources/extensions/gsd/tests/tui-header-lifecycle.test.ts +210 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +136 -4
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +8 -25
- package/src/resources/extensions/gsd/tests/unit-dispatches.test.ts +80 -1
- package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +5 -99
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +43 -36
- package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +84 -444
- package/src/resources/extensions/gsd/tests/workflow-dispatch-claim.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +44 -189
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -57
- package/src/resources/extensions/gsd/tests/workflow-protocol-excerpt.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/workflow-worker-heartbeat.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/worktree-db-same-file.test.ts +21 -44
- package/src/resources/extensions/gsd/tests/worktree-expected-warnings.test.ts +27 -26
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +14 -13
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +50 -31
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +434 -0
- package/src/resources/extensions/gsd/tests/worktree-main-branch.test.ts +20 -18
- package/src/resources/extensions/gsd/tests/worktree-path-injection.test.ts +22 -19
- package/src/resources/extensions/gsd/tests/worktree-project-root-degrade.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +373 -76
- package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +327 -0
- package/src/resources/extensions/gsd/tests/worktree-state-projection.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +40 -1
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +19 -13
- package/src/resources/extensions/gsd/tool-contract.ts +82 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +14 -15
- package/src/resources/extensions/gsd/tools/complete-task.ts +1 -1
- package/src/resources/extensions/gsd/tools/context-mode-tool-result.ts +25 -0
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +7 -7
- package/src/resources/extensions/gsd/tools/exec-tool.ts +4 -23
- package/src/resources/extensions/gsd/tools/memory-tools.ts +1 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -0
- package/src/resources/extensions/gsd/tools/plan-task.ts +10 -0
- package/src/resources/extensions/gsd/tools/resume-tool.ts +7 -7
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-composer.ts +19 -4
- package/src/resources/extensions/gsd/unit-runtime.ts +25 -0
- package/src/resources/extensions/gsd/workflow-protocol.ts +160 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +1255 -0
- package/src/resources/extensions/gsd/worktree-safety.ts +282 -0
- package/src/resources/extensions/gsd/worktree-state-projection.ts +404 -0
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +86 -40
- package/src/resources/skills/web-quality-audit/scripts/analyze.sh +0 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +0 -733
- package/dist/web/standalone/.next/static/chunks/8336.631939fb583761fa.js +0 -10
- package/dist/web/standalone/.next/static/chunks/app/page-fab3ebb85b006001.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +0 -1
- package/src/resources/extensions/gsd/tests/sync-layer-scope.test.ts +0 -434
- package/src/resources/extensions/gsd/worktree-resolver.ts +0 -909
- /package/dist/web/standalone/.next/static/{yTuahMMuJzVnsov5PreWl → drLMkgfHQ8lzS229_HWYR}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{yTuahMMuJzVnsov5PreWl → drLMkgfHQ8lzS229_HWYR}/_ssgManifest.js +0 -0
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
realpathSync,
|
|
19
19
|
rmSync,
|
|
20
20
|
unlinkSync,
|
|
21
|
-
statSync,
|
|
22
21
|
lstatSync as lstatSyncFn,
|
|
23
22
|
} from "node:fs";
|
|
24
23
|
import { isAbsolute, join, relative, sep as pathSep } from "node:path";
|
|
@@ -28,13 +27,13 @@ import {
|
|
|
28
27
|
isDbAvailable,
|
|
29
28
|
getMilestone,
|
|
30
29
|
getMilestoneSlices,
|
|
30
|
+
getSliceTasks,
|
|
31
31
|
closeDatabase,
|
|
32
32
|
openDatabase,
|
|
33
33
|
getDbPath,
|
|
34
34
|
} from "./gsd-db.js";
|
|
35
35
|
import { atomicWriteSync } from "./atomic-write.js";
|
|
36
36
|
import { execFileSync } from "node:child_process";
|
|
37
|
-
import { safeCopy, safeCopyRecursive } from "./safe-fs.js";
|
|
38
37
|
import { gsdRoot, resolveGsdPathContract } from "./paths.js";
|
|
39
38
|
import {
|
|
40
39
|
createWorktree,
|
|
@@ -78,9 +77,15 @@ import {
|
|
|
78
77
|
nativeUpdateRef,
|
|
79
78
|
nativeIsAncestor,
|
|
80
79
|
nativeMergeAbort,
|
|
80
|
+
nativeWorktreeList,
|
|
81
81
|
} from "./native-git-bridge.js";
|
|
82
82
|
import { gsdHome } from "./gsd-home.js";
|
|
83
83
|
import { type MilestoneScope, type GsdWorkspace, createWorkspace } from "./workspace.js";
|
|
84
|
+
import {
|
|
85
|
+
_finalizeProjectionForMergeImpl,
|
|
86
|
+
_projectRootToWorktreeImpl,
|
|
87
|
+
_projectWorktreeToRootImpl,
|
|
88
|
+
} from "./worktree-state-projection.js";
|
|
84
89
|
|
|
85
90
|
const PROJECT_PREFERENCES_FILE = "PREFERENCES.md";
|
|
86
91
|
const LEGACY_PROJECT_PREFERENCES_FILE = "preferences.md";
|
|
@@ -114,11 +119,6 @@ const ROOT_STATE_FILES = [
|
|
|
114
119
|
// because the project root is authoritative for preferences (#2684).
|
|
115
120
|
] as const;
|
|
116
121
|
|
|
117
|
-
const ROOT_DIAGNOSTIC_FILES = [
|
|
118
|
-
"completed-units.json",
|
|
119
|
-
"metrics.json",
|
|
120
|
-
] as const;
|
|
121
|
-
|
|
122
122
|
/**
|
|
123
123
|
* Pop a stash entry by tracking the unique marker embedded in its message so
|
|
124
124
|
* concurrent stash operations against the same project root cannot cause us to
|
|
@@ -193,68 +193,46 @@ function isSamePath(a: string, b: string): boolean {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const VERDICT_RE = /verdict:\s*[\w-]+/i;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Walk a milestone directory and force-overwrite ASSESSMENT files in the
|
|
203
|
-
* destination when the source copy contains a `verdict:` field.
|
|
204
|
-
*
|
|
205
|
-
* This is the targeted fix for the UAT stuck-loop (#2821): the main
|
|
206
|
-
* safeCopyRecursive uses force:false to protect worktree-local projection
|
|
207
|
-
* files (#1886), but ASSESSMENT files written by run-uat must be
|
|
208
|
-
* forward-synced when the project root has a verdict. Without this,
|
|
209
|
-
* the worktree retains a stale FAIL or missing ASSESSMENT and
|
|
210
|
-
* checkNeedsRunUat re-dispatches run-uat indefinitely.
|
|
211
|
-
*
|
|
212
|
-
* Only overwrites when the source has a verdict — never clobbers a
|
|
213
|
-
* worktree ASSESSMENT with a verdictless project-root copy.
|
|
214
|
-
*/
|
|
215
|
-
function forceOverwriteAssessmentsWithVerdict(
|
|
216
|
-
srcMilestoneDir: string,
|
|
217
|
-
dstMilestoneDir: string,
|
|
218
|
-
): void {
|
|
219
|
-
if (!existsSync(srcMilestoneDir)) return;
|
|
220
|
-
|
|
221
|
-
// Walk slices/<SID>/ looking for *-ASSESSMENT.md files
|
|
222
|
-
const slicesDir = join(srcMilestoneDir, "slices");
|
|
223
|
-
if (!existsSync(slicesDir)) return;
|
|
196
|
+
export function _isSamePath(a: string, b: string): boolean {
|
|
197
|
+
return isSamePath(a, b);
|
|
198
|
+
}
|
|
224
199
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
200
|
+
export function _resolveAutoWorktreeStartPoint(
|
|
201
|
+
integrationBranch: string | null | undefined,
|
|
202
|
+
gitMainBranch: string | null | undefined,
|
|
203
|
+
branchExists: (branch: string) => boolean,
|
|
204
|
+
): string | undefined {
|
|
205
|
+
if (integrationBranch) return integrationBranch;
|
|
206
|
+
return gitMainBranch &&
|
|
207
|
+
typeof gitMainBranch === "string" &&
|
|
208
|
+
gitMainBranch.length > 0 &&
|
|
209
|
+
branchExists(gitMainBranch)
|
|
210
|
+
? gitMainBranch
|
|
211
|
+
: undefined;
|
|
212
|
+
}
|
|
230
213
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
214
|
+
export function _shouldReconcileWorktreeDb(
|
|
215
|
+
worktreeDbPath: string,
|
|
216
|
+
mainDbPath: string,
|
|
217
|
+
pathExists: (path: string) => boolean = existsSync,
|
|
218
|
+
samePath: (a: string, b: string) => boolean = isSamePath,
|
|
219
|
+
): boolean {
|
|
220
|
+
return pathExists(worktreeDbPath) && !samePath(worktreeDbPath, mainDbPath);
|
|
221
|
+
}
|
|
235
222
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
223
|
+
export function _isExpectedWorktreeUnlinkError(
|
|
224
|
+
code: string | undefined,
|
|
225
|
+
): boolean {
|
|
226
|
+
return code === "ENOENT" || code === "EISDIR";
|
|
227
|
+
}
|
|
240
228
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
} catch (err) {
|
|
250
|
-
/* non-fatal per slice */
|
|
251
|
-
logWarning("worktree", `assessment slice scan failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
} catch (err) {
|
|
255
|
-
/* non-fatal */
|
|
256
|
-
logWarning("worktree", `assessment sync failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
257
|
-
}
|
|
229
|
+
function stripGsdDisplayPrefix(value: string | undefined | null, id: string): string | undefined {
|
|
230
|
+
const raw = String(value ?? "").trim();
|
|
231
|
+
if (!raw) return undefined;
|
|
232
|
+
const lower = raw.toLowerCase();
|
|
233
|
+
const idLower = id.toLowerCase();
|
|
234
|
+
if (lower.startsWith(`${idLower}:`)) return raw.slice(id.length + 1).trim() || undefined;
|
|
235
|
+
return raw;
|
|
258
236
|
}
|
|
259
237
|
|
|
260
238
|
// ─── Module State ──────────────────────────────────────────────────────────
|
|
@@ -356,7 +334,7 @@ function clearProjectRootStateFiles(basePath: string, milestoneId: string): void
|
|
|
356
334
|
} catch (err) {
|
|
357
335
|
// ENOENT/EISDIR are expected for already-removed or directory entries (#3597)
|
|
358
336
|
const code = (err as NodeJS.ErrnoException).code;
|
|
359
|
-
if (code
|
|
337
|
+
if (!_isExpectedWorktreeUnlinkError(code)) {
|
|
360
338
|
logWarning("worktree", `untracked file unlink failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
361
339
|
}
|
|
362
340
|
}
|
|
@@ -389,6 +367,42 @@ export const isSafeToAutoResolve = (filePath: string): boolean =>
|
|
|
389
367
|
filePath.startsWith(".gsd/") ||
|
|
390
368
|
SAFE_AUTO_RESOLVE_PATTERNS.some((re) => re.test(filePath));
|
|
391
369
|
|
|
370
|
+
function removeMergeStateFiles(basePath: string, contextLabel: string): void {
|
|
371
|
+
try {
|
|
372
|
+
const gitDir_ = resolveGitDir(basePath);
|
|
373
|
+
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
374
|
+
const p = join(gitDir_, f);
|
|
375
|
+
if (existsSync(p)) unlinkSync(p);
|
|
376
|
+
}
|
|
377
|
+
} catch (err) {
|
|
378
|
+
logError("worktree", `${contextLabel} merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function cleanupSquashConflictState(basePath: string): void {
|
|
383
|
+
// `git merge --squash` conflicts can leave unmerged index entries without
|
|
384
|
+
// MERGE_HEAD, so merge-abort alone is not enough. Reset the merge index, then
|
|
385
|
+
// remove merge message files that native/libgit2 paths may have created.
|
|
386
|
+
try {
|
|
387
|
+
nativeMergeAbort(basePath);
|
|
388
|
+
} catch (err) {
|
|
389
|
+
// Expected for squash conflicts when MERGE_HEAD was never written.
|
|
390
|
+
debugLog("squash-conflict-cleanup:merge-abort-skipped", {
|
|
391
|
+
error: err instanceof Error ? err.message : String(err),
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
try {
|
|
395
|
+
execFileSync("git", ["reset", "--merge"], {
|
|
396
|
+
cwd: basePath,
|
|
397
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
398
|
+
encoding: "utf-8",
|
|
399
|
+
});
|
|
400
|
+
} catch (err) {
|
|
401
|
+
logError("worktree", `git reset --merge failed after squash conflict: ${err instanceof Error ? err.message : String(err)}`);
|
|
402
|
+
}
|
|
403
|
+
removeMergeStateFiles(basePath, "squash conflict");
|
|
404
|
+
}
|
|
405
|
+
|
|
392
406
|
// ─── Dispatch-Level Sync (project root ↔ worktree) ──────────────────────────
|
|
393
407
|
|
|
394
408
|
/**
|
|
@@ -399,199 +413,30 @@ export const isSafeToAutoResolve = (filePath: string): boolean =>
|
|
|
399
413
|
* Non-fatal — sync failure should never block dispatch.
|
|
400
414
|
*/
|
|
401
415
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* in argument order. Asserts both scopes belong to the same workspace identity
|
|
407
|
-
* to prevent silent mismatch bugs.
|
|
408
|
-
*/
|
|
409
|
-
export function syncProjectRootToWorktreeByScope(
|
|
410
|
-
rootScope: MilestoneScope,
|
|
411
|
-
worktreeScope: MilestoneScope,
|
|
412
|
-
): void {
|
|
413
|
-
if (rootScope.workspace.identityKey !== worktreeScope.workspace.identityKey) {
|
|
414
|
-
throw new Error(
|
|
415
|
-
`syncProjectRootToWorktreeByScope: scope identity mismatch — ` +
|
|
416
|
-
`rootScope.identityKey="${rootScope.workspace.identityKey}" ` +
|
|
417
|
-
`worktreeScope.identityKey="${worktreeScope.workspace.identityKey}"`,
|
|
418
|
-
);
|
|
419
|
-
}
|
|
420
|
-
if (rootScope.milestoneId !== worktreeScope.milestoneId) {
|
|
421
|
-
throw new Error(
|
|
422
|
-
`syncProjectRootToWorktreeByScope: milestoneId mismatch — ` +
|
|
423
|
-
`rootScope.milestoneId="${rootScope.milestoneId}" worktreeScope.milestoneId="${worktreeScope.milestoneId}"`,
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
const projectRoot = rootScope.workspace.projectRoot;
|
|
427
|
-
const worktreePath_ = worktreeScope.workspace.worktreeRoot ?? worktreeScope.workspace.projectRoot;
|
|
428
|
-
const milestoneId = rootScope.milestoneId;
|
|
429
|
-
syncProjectRootToWorktree(projectRoot, worktreePath_, milestoneId);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* @deprecated Use syncProjectRootToWorktreeByScope instead.
|
|
434
|
-
* TODO(C-future): remove once all callers migrated.
|
|
416
|
+
* Path-string entry point to WorktreeStateProjection.projectRootToWorktree.
|
|
417
|
+
* Production code goes through the Module class; this delegator survives so
|
|
418
|
+
* the projection-invariant tests (#1886, #2184, #2478, #2821) can exercise
|
|
419
|
+
* the bodies with raw paths.
|
|
435
420
|
*/
|
|
436
421
|
export function syncProjectRootToWorktree(
|
|
437
422
|
projectRoot: string,
|
|
438
423
|
worktreePath_: string,
|
|
439
424
|
milestoneId: string | null,
|
|
440
425
|
): void {
|
|
441
|
-
|
|
442
|
-
if (!milestoneId) return;
|
|
443
|
-
|
|
444
|
-
const contract = resolveGsdPathContract(worktreePath_, projectRoot);
|
|
445
|
-
const prGsd = contract.projectGsd;
|
|
446
|
-
const wtGsd = contract.worktreeGsd ?? join(worktreePath_, ".gsd");
|
|
447
|
-
|
|
448
|
-
// When .gsd is a symlink to the same external directory in both locations,
|
|
449
|
-
// cpSync rejects the copy because source === destination (ERR_FS_CP_EINVAL).
|
|
450
|
-
// Compare realpaths and skip when they resolve to the same physical path (#2184).
|
|
451
|
-
if (isSamePath(prGsd, wtGsd)) return;
|
|
452
|
-
|
|
453
|
-
// Copy milestone directory from project root to worktree — additive only.
|
|
454
|
-
// force:false prevents cpSync from overwriting existing worktree files.
|
|
455
|
-
// Without this, worktree-local files (e.g. VALIDATION.md written
|
|
456
|
-
// by validate-milestone) get clobbered by stale project root copies,
|
|
457
|
-
// causing an infinite re-validation loop (#1886).
|
|
458
|
-
safeCopyRecursive(
|
|
459
|
-
join(prGsd, "milestones", milestoneId),
|
|
460
|
-
join(wtGsd, "milestones", milestoneId),
|
|
461
|
-
{ force: false },
|
|
462
|
-
);
|
|
463
|
-
|
|
464
|
-
// Force-sync ASSESSMENT files that have a verdict from project root (#2821).
|
|
465
|
-
// The additive-only copy above preserves worktree-local files, but
|
|
466
|
-
// ASSESSMENT files are special: after run-uat writes a verdict and post-unit
|
|
467
|
-
// syncs it to the project root, the worktree may retain a stale copy (e.g.
|
|
468
|
-
// verdict:fail while the project root has verdict:pass from a retry). On
|
|
469
|
-
// session resume the DB is rebuilt from disk, and if the stale ASSESSMENT
|
|
470
|
-
// persists, checkNeedsRunUat finds no passing verdict → re-dispatches
|
|
471
|
-
// run-uat indefinitely (stuck-loop ×9).
|
|
472
|
-
forceOverwriteAssessmentsWithVerdict(
|
|
473
|
-
join(prGsd, "milestones", milestoneId),
|
|
474
|
-
join(wtGsd, "milestones", milestoneId),
|
|
475
|
-
);
|
|
476
|
-
|
|
477
|
-
// Forward-sync completed-units.json from project root to worktree.
|
|
478
|
-
// Project root is authoritative for completion state after crash recovery;
|
|
479
|
-
// without this, the worktree re-dispatches already-completed units (#1886).
|
|
480
|
-
safeCopy(
|
|
481
|
-
join(prGsd, "completed-units.json"),
|
|
482
|
-
join(wtGsd, "completed-units.json"),
|
|
483
|
-
{ force: true },
|
|
484
|
-
);
|
|
485
|
-
|
|
486
|
-
// Delete a legacy worktree-local gsd.db ONLY if it is empty (0 bytes).
|
|
487
|
-
// Runtime opens contract.projectDb; this cleanup only removes corrupt
|
|
488
|
-
// pre-upgrade local DB projections.
|
|
489
|
-
try {
|
|
490
|
-
const wtDb = join(wtGsd, "gsd.db");
|
|
491
|
-
let deleteSidecars = false;
|
|
492
|
-
if (existsSync(wtDb)) {
|
|
493
|
-
const size = statSync(wtDb).size;
|
|
494
|
-
if (size === 0) {
|
|
495
|
-
unlinkSync(wtDb);
|
|
496
|
-
deleteSidecars = true;
|
|
497
|
-
}
|
|
498
|
-
} else {
|
|
499
|
-
// Main DB already missing — sidecars are orphaned from a previous
|
|
500
|
-
// partial cleanup and must still be removed.
|
|
501
|
-
deleteSidecars = true;
|
|
502
|
-
}
|
|
503
|
-
// Always clean up WAL/SHM sidecar files when the main DB was deleted
|
|
504
|
-
// or is already missing. Orphaned WAL/SHM files cause SQLite WAL
|
|
505
|
-
// recovery on next open, which triggers a CPU spin on Node 24's
|
|
506
|
-
// node:sqlite DatabaseSync implementation (#2478).
|
|
507
|
-
if (deleteSidecars) {
|
|
508
|
-
for (const suffix of ["-wal", "-shm"]) {
|
|
509
|
-
const f = wtDb + suffix;
|
|
510
|
-
if (existsSync(f)) {
|
|
511
|
-
unlinkSync(f);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
} catch (err) {
|
|
516
|
-
/* non-fatal */
|
|
517
|
-
logWarning("worktree", `worktree DB cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
518
|
-
}
|
|
426
|
+
_projectRootToWorktreeImpl(projectRoot, worktreePath_, milestoneId);
|
|
519
427
|
}
|
|
520
428
|
|
|
521
429
|
/**
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
* argument order (worktree → root). Asserts both scopes belong to the same
|
|
526
|
-
* workspace identity to prevent silent mismatch bugs.
|
|
527
|
-
*/
|
|
528
|
-
export function syncStateToProjectRootByScope(
|
|
529
|
-
worktreeScope: MilestoneScope,
|
|
530
|
-
rootScope: MilestoneScope,
|
|
531
|
-
): void {
|
|
532
|
-
if (worktreeScope.workspace.identityKey !== rootScope.workspace.identityKey) {
|
|
533
|
-
throw new Error(
|
|
534
|
-
`syncStateToProjectRootByScope: scope identity mismatch — ` +
|
|
535
|
-
`worktreeScope.identityKey="${worktreeScope.workspace.identityKey}" ` +
|
|
536
|
-
`rootScope.identityKey="${rootScope.workspace.identityKey}"`,
|
|
537
|
-
);
|
|
538
|
-
}
|
|
539
|
-
if (worktreeScope.milestoneId !== rootScope.milestoneId) {
|
|
540
|
-
throw new Error(
|
|
541
|
-
`syncStateToProjectRootByScope: milestoneId mismatch — ` +
|
|
542
|
-
`worktreeScope.milestoneId="${worktreeScope.milestoneId}" rootScope.milestoneId="${rootScope.milestoneId}"`,
|
|
543
|
-
);
|
|
544
|
-
}
|
|
545
|
-
const worktreePath_ = worktreeScope.workspace.worktreeRoot ?? worktreeScope.workspace.projectRoot;
|
|
546
|
-
const projectRoot = rootScope.workspace.projectRoot;
|
|
547
|
-
const milestoneId = worktreeScope.milestoneId;
|
|
548
|
-
syncStateToProjectRoot(worktreePath_, projectRoot, milestoneId);
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Sync worktree diagnostics from worktree to project root.
|
|
553
|
-
* Only runs when inside an auto-worktree (worktreePath differs from projectRoot).
|
|
554
|
-
* DB/project-root state remains authoritative; markdown projections are not
|
|
555
|
-
* copied from the worktree back to the project root.
|
|
556
|
-
* Non-fatal — sync failure should never block dispatch.
|
|
557
|
-
* @deprecated Use syncStateToProjectRootByScope instead.
|
|
558
|
-
* TODO(C-future): remove once all callers migrated.
|
|
430
|
+
* Path-string entry point to WorktreeStateProjection.projectWorktreeToRoot.
|
|
431
|
+
* Production code goes through the Module class; this delegator survives so
|
|
432
|
+
* the projection-invariant tests can exercise the body with raw paths.
|
|
559
433
|
*/
|
|
560
434
|
export function syncStateToProjectRoot(
|
|
561
435
|
worktreePath_: string,
|
|
562
436
|
projectRoot: string,
|
|
563
437
|
milestoneId: string | null,
|
|
564
438
|
): void {
|
|
565
|
-
|
|
566
|
-
if (!milestoneId) return;
|
|
567
|
-
|
|
568
|
-
const contract = resolveGsdPathContract(worktreePath_, projectRoot);
|
|
569
|
-
const wtGsd = contract.worktreeGsd ?? join(worktreePath_, ".gsd");
|
|
570
|
-
const prGsd = contract.projectGsd;
|
|
571
|
-
|
|
572
|
-
// When .gsd is a symlink to the same external directory in both locations,
|
|
573
|
-
// cpSync rejects the copy because source === destination (ERR_FS_CP_EINVAL).
|
|
574
|
-
// Compare realpaths and skip when they resolve to the same physical path (#2184).
|
|
575
|
-
if (isSamePath(wtGsd, prGsd)) return;
|
|
576
|
-
|
|
577
|
-
// metrics.json — session cost/token tracking (#2313).
|
|
578
|
-
// Without this, metrics accumulated in the worktree are invisible from the
|
|
579
|
-
// project root and never appear in the dashboard or skill-health reports.
|
|
580
|
-
safeCopy(join(wtGsd, "metrics.json"), join(prGsd, "metrics.json"), { force: true });
|
|
581
|
-
|
|
582
|
-
// completed-units.json — runtime completion diagnostics used to avoid
|
|
583
|
-
// re-dispatching work already completed in an isolated worktree.
|
|
584
|
-
safeCopy(join(wtGsd, "completed-units.json"), join(prGsd, "completed-units.json"), { force: true });
|
|
585
|
-
|
|
586
|
-
// Runtime records — unit dispatch diagnostics used by selfHealRuntimeRecords().
|
|
587
|
-
// Without this, a crash during a unit leaves the runtime record only in the
|
|
588
|
-
// worktree. If the next session resolves basePath before worktree re-entry,
|
|
589
|
-
// selfHeal can't find or clear the stale record (#769).
|
|
590
|
-
safeCopyRecursive(
|
|
591
|
-
join(wtGsd, "runtime", "units"),
|
|
592
|
-
join(prGsd, "runtime", "units"),
|
|
593
|
-
{ force: true },
|
|
594
|
-
);
|
|
439
|
+
_projectWorktreeToRootImpl(worktreePath_, projectRoot, milestoneId);
|
|
595
440
|
}
|
|
596
441
|
|
|
597
442
|
// ─── Resource Staleness ───────────────────────────────────────────────────
|
|
@@ -953,51 +798,7 @@ export function syncWorktreeStateBack(
|
|
|
953
798
|
worktreePath: string,
|
|
954
799
|
milestoneId: string,
|
|
955
800
|
): { synced: string[] } {
|
|
956
|
-
|
|
957
|
-
const mainGsd = contract.projectGsd;
|
|
958
|
-
const wtGsd = contract.worktreeGsd ?? join(worktreePath, ".gsd");
|
|
959
|
-
const synced: string[] = [];
|
|
960
|
-
|
|
961
|
-
// If both resolve to the same directory (symlink), no sync needed
|
|
962
|
-
if (isSamePath(mainGsd, wtGsd)) return { synced };
|
|
963
|
-
|
|
964
|
-
if (!existsSync(wtGsd) || !existsSync(mainGsd)) return { synced };
|
|
965
|
-
|
|
966
|
-
// ── 0. Pre-upgrade worktree DB reconciliation ────────────────────────
|
|
967
|
-
// If the worktree has its own gsd.db (copied before the WAL transition),
|
|
968
|
-
// reconcile its hierarchy data into the project root DB before syncing
|
|
969
|
-
// files. This handles in-flight worktrees that were created before the
|
|
970
|
-
// upgrade to shared WAL mode.
|
|
971
|
-
const wtLocalDb = join(wtGsd, "gsd.db");
|
|
972
|
-
const mainDb = contract.projectDb;
|
|
973
|
-
if (existsSync(wtLocalDb) && existsSync(mainDb)) {
|
|
974
|
-
try {
|
|
975
|
-
reconcileWorktreeDb(mainDb, wtLocalDb);
|
|
976
|
-
synced.push("gsd.db (pre-upgrade reconcile)");
|
|
977
|
-
} catch (err) {
|
|
978
|
-
// Non-fatal — file sync below is the fallback
|
|
979
|
-
logError("worktree", `DB reconciliation failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
// ── 1. Sync root-level diagnostic files back ─────────────────────────
|
|
984
|
-
// Markdown/JSON state projections remain project-root/DB authoritative.
|
|
985
|
-
// These diagnostic files are copied for observability only.
|
|
986
|
-
for (const f of ROOT_DIAGNOSTIC_FILES) {
|
|
987
|
-
const src = join(wtGsd, f);
|
|
988
|
-
const dst = join(mainGsd, f);
|
|
989
|
-
if (existsSync(src)) {
|
|
990
|
-
try {
|
|
991
|
-
cpSync(src, dst, { force: true });
|
|
992
|
-
synced.push(f);
|
|
993
|
-
} catch (err) {
|
|
994
|
-
/* non-fatal */
|
|
995
|
-
logWarning("worktree", `state file copy-back failed (${f}): ${err instanceof Error ? err.message : String(err)}`);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
return { synced };
|
|
801
|
+
return _finalizeProjectionForMergeImpl(mainBasePath, worktreePath, milestoneId);
|
|
1001
802
|
}
|
|
1002
803
|
// ─── Worktree Post-Create Hook (#597) ────────────────────────────────────────
|
|
1003
804
|
|
|
@@ -1095,19 +896,12 @@ export function enterBranchModeForMilestone(
|
|
|
1095
896
|
const integrationBranch =
|
|
1096
897
|
readIntegrationBranch(basePath, milestoneId) ?? undefined;
|
|
1097
898
|
const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
1098
|
-
// Validate main_branch preference exists in the repo before using it —
|
|
1099
|
-
// a stale preference (e.g. "master" when repo uses "main") would cause
|
|
1100
|
-
// nativeBranchForceReset to fail with a bad start-point reference.
|
|
1101
|
-
const validatedPrefBranch =
|
|
1102
|
-
gitPrefs?.main_branch &&
|
|
1103
|
-
typeof gitPrefs.main_branch === "string" &&
|
|
1104
|
-
gitPrefs.main_branch.length > 0 &&
|
|
1105
|
-
nativeBranchExists(basePath, gitPrefs.main_branch)
|
|
1106
|
-
? gitPrefs.main_branch
|
|
1107
|
-
: undefined;
|
|
1108
899
|
const startPoint =
|
|
1109
|
-
|
|
1110
|
-
|
|
900
|
+
_resolveAutoWorktreeStartPoint(
|
|
901
|
+
integrationBranch,
|
|
902
|
+
gitPrefs?.main_branch,
|
|
903
|
+
(branchName) => nativeBranchExists(basePath, branchName),
|
|
904
|
+
) ??
|
|
1111
905
|
nativeDetectMainBranch(basePath);
|
|
1112
906
|
|
|
1113
907
|
// TOCTOU ancestry guard (Issue #4980 HIGH-3).
|
|
@@ -1180,6 +974,122 @@ export function enterBranchModeForMilestone(
|
|
|
1180
974
|
* (both formerly here) became dead.
|
|
1181
975
|
*/
|
|
1182
976
|
|
|
977
|
+
/**
|
|
978
|
+
* True when `branch` is checked out in any worktree listed by
|
|
979
|
+
* `git worktree list --porcelain`. Used to gate ref updates that would
|
|
980
|
+
* otherwise leave a concurrent worktree's HEAD inconsistent with its
|
|
981
|
+
* index/working tree (Codex peer-review of #5538-followup).
|
|
982
|
+
*
|
|
983
|
+
* Best-effort: a `nativeWorktreeList` failure returns true so we err on
|
|
984
|
+
* the side of NOT moving the ref. Better to skip a fast-forward than to
|
|
985
|
+
* silently corrupt another worktree.
|
|
986
|
+
*/
|
|
987
|
+
export function _isBranchCheckedOutElsewhere(
|
|
988
|
+
basePath: string,
|
|
989
|
+
branch: string,
|
|
990
|
+
): boolean {
|
|
991
|
+
try {
|
|
992
|
+
const entries = nativeWorktreeList(basePath);
|
|
993
|
+
return entries.some((entry) => entry.branch === branch);
|
|
994
|
+
} catch {
|
|
995
|
+
return true;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Resolve the integration branch using the same 3-tier fallback as the
|
|
1001
|
+
* fresh-create path: META.json → git.main_branch preference → detected
|
|
1002
|
+
* main branch. Returns null when no usable target exists.
|
|
1003
|
+
*/
|
|
1004
|
+
function _resolveIntegrationBranchForReuse(
|
|
1005
|
+
basePath: string,
|
|
1006
|
+
milestoneId: string,
|
|
1007
|
+
): string | null {
|
|
1008
|
+
const fromMeta = readIntegrationBranch(basePath, milestoneId);
|
|
1009
|
+
if (fromMeta) return fromMeta;
|
|
1010
|
+
|
|
1011
|
+
const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
1012
|
+
const fromPref = gitPrefs?.main_branch &&
|
|
1013
|
+
typeof gitPrefs.main_branch === "string" &&
|
|
1014
|
+
gitPrefs.main_branch.length > 0 &&
|
|
1015
|
+
nativeBranchExists(basePath, gitPrefs.main_branch)
|
|
1016
|
+
? gitPrefs.main_branch
|
|
1017
|
+
: null;
|
|
1018
|
+
if (fromPref) return fromPref;
|
|
1019
|
+
|
|
1020
|
+
try {
|
|
1021
|
+
return nativeDetectMainBranch(basePath);
|
|
1022
|
+
} catch {
|
|
1023
|
+
return null;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* When reusing an existing milestone branch, fast-forward it onto the
|
|
1029
|
+
* integration branch when that's safe (branch is a strict ancestor of
|
|
1030
|
+
* integration — no commits would be lost). Skips when the branch has its
|
|
1031
|
+
* own commits ahead of integration, when the integration branch can't be
|
|
1032
|
+
* resolved, or when any git operation fails — the merge gate at milestone
|
|
1033
|
+
* completion will surface real divergence as a conflict.
|
|
1034
|
+
*
|
|
1035
|
+
* The previous behavior re-attached the worktree to whatever stale tip
|
|
1036
|
+
* the branch held, which caused new milestone work to fork from a base
|
|
1037
|
+
* missing prior milestones' merges (#5538-followup).
|
|
1038
|
+
*/
|
|
1039
|
+
export function fastForwardReusedMilestoneBranchIfSafe(
|
|
1040
|
+
basePath: string,
|
|
1041
|
+
milestoneId: string,
|
|
1042
|
+
branch: string,
|
|
1043
|
+
): void {
|
|
1044
|
+
try {
|
|
1045
|
+
const integrationBranch = _resolveIntegrationBranchForReuse(basePath, milestoneId);
|
|
1046
|
+
if (!integrationBranch || integrationBranch === branch) return;
|
|
1047
|
+
if (!nativeBranchExists(basePath, integrationBranch)) return;
|
|
1048
|
+
|
|
1049
|
+
// Pure fast-forward only: branch must be a strict ancestor of integration.
|
|
1050
|
+
// If the branch has its own commits ahead, leave it alone.
|
|
1051
|
+
if (!nativeIsAncestor(basePath, branch, integrationBranch)) {
|
|
1052
|
+
debugLog("createAutoWorktree", {
|
|
1053
|
+
phase: "skip-ff-branch-not-ancestor",
|
|
1054
|
+
milestoneId,
|
|
1055
|
+
branch,
|
|
1056
|
+
integration: integrationBranch,
|
|
1057
|
+
});
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// Codex peer-review: `nativeUpdateRef` succeeds even when the branch is
|
|
1062
|
+
// currently checked out in another worktree, leaving that worktree's HEAD
|
|
1063
|
+
// inconsistent with its index/work tree. Skip the fast-forward if any
|
|
1064
|
+
// listed worktree has this branch checked out — the merge gate at
|
|
1065
|
+
// milestone-completion will surface stale-base divergence as a conflict
|
|
1066
|
+
// instead of silently corrupting the other worktree's state.
|
|
1067
|
+
if (_isBranchCheckedOutElsewhere(basePath, branch)) {
|
|
1068
|
+
debugLog("createAutoWorktree", {
|
|
1069
|
+
phase: "skip-ff-branch-checked-out-elsewhere",
|
|
1070
|
+
milestoneId,
|
|
1071
|
+
branch,
|
|
1072
|
+
});
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
nativeUpdateRef(basePath, `refs/heads/${branch}`, integrationBranch);
|
|
1077
|
+
debugLog("createAutoWorktree", {
|
|
1078
|
+
phase: "fast-forward-reused-branch",
|
|
1079
|
+
milestoneId,
|
|
1080
|
+
branch,
|
|
1081
|
+
integration: integrationBranch,
|
|
1082
|
+
});
|
|
1083
|
+
} catch (err) {
|
|
1084
|
+
debugLog("createAutoWorktree", {
|
|
1085
|
+
phase: "fast-forward-reused-branch-failed",
|
|
1086
|
+
milestoneId,
|
|
1087
|
+
branch,
|
|
1088
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1183
1093
|
export function createAutoWorktree(
|
|
1184
1094
|
basePath: string,
|
|
1185
1095
|
milestoneId: string,
|
|
@@ -1206,6 +1116,12 @@ export function createAutoWorktree(
|
|
|
1206
1116
|
|
|
1207
1117
|
let info: { name: string; path: string; branch: string; exists: boolean };
|
|
1208
1118
|
if (branchExists) {
|
|
1119
|
+
// #5538-followup: fast-forward the reused branch onto the integration
|
|
1120
|
+
// branch when safe so the next milestone forks from up-to-date code.
|
|
1121
|
+
// Without this, a milestone that was created before another milestone
|
|
1122
|
+
// merged into main would carry a stale base into its worktree.
|
|
1123
|
+
fastForwardReusedMilestoneBranchIfSafe(basePath, milestoneId, branch);
|
|
1124
|
+
|
|
1209
1125
|
// Re-attach worktree to the existing milestone branch (preserving commits)
|
|
1210
1126
|
info = createWorktree(basePath, milestoneId, {
|
|
1211
1127
|
branch,
|
|
@@ -1222,14 +1138,11 @@ export function createAutoWorktree(
|
|
|
1222
1138
|
const integrationBranch =
|
|
1223
1139
|
readIntegrationBranch(basePath, milestoneId) ?? undefined;
|
|
1224
1140
|
const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
? gitPrefs.main_branch
|
|
1231
|
-
: undefined;
|
|
1232
|
-
const startPoint = integrationBranch ?? validatedPrefBranch ?? undefined;
|
|
1141
|
+
const startPoint = _resolveAutoWorktreeStartPoint(
|
|
1142
|
+
integrationBranch,
|
|
1143
|
+
gitPrefs?.main_branch,
|
|
1144
|
+
(branchName) => nativeBranchExists(basePath, branchName),
|
|
1145
|
+
);
|
|
1233
1146
|
info = createWorktree(basePath, milestoneId, {
|
|
1234
1147
|
branch,
|
|
1235
1148
|
startPoint,
|
|
@@ -1325,7 +1238,7 @@ export function teardownAutoWorktree(
|
|
|
1325
1238
|
const contract = resolveGsdPathContract(previousCwd, originalBasePath);
|
|
1326
1239
|
const worktreeDbPath = join(contract.worktreeGsd ?? join(previousCwd, ".gsd"), "gsd.db");
|
|
1327
1240
|
const mainDbPath = contract.projectDb;
|
|
1328
|
-
if (
|
|
1241
|
+
if (_shouldReconcileWorktreeDb(worktreeDbPath, mainDbPath)) {
|
|
1329
1242
|
reconcileWorktreeDb(mainDbPath, worktreeDbPath);
|
|
1330
1243
|
}
|
|
1331
1244
|
} catch (err) {
|
|
@@ -1505,6 +1418,15 @@ export function getAutoWorktreeOriginalBase(): string | null {
|
|
|
1505
1418
|
return getActiveWorkspace()?.projectRoot ?? null;
|
|
1506
1419
|
}
|
|
1507
1420
|
|
|
1421
|
+
/**
|
|
1422
|
+
* Test-only — resets the module-level `activeWorkspace` registry between
|
|
1423
|
+
* runs. Production code never clears the registry directly; tests call this
|
|
1424
|
+
* in `beforeEach`/`afterEach` to isolate registry-mutating cases. Renaming
|
|
1425
|
+
* the underscore-prefixed `_*ForTest` exports it joins (slice 7 / step G of
|
|
1426
|
+
* ADR-016) was deliberate: those wrapped real production helpers and lost
|
|
1427
|
+
* the suffix; this one stays as the only legitimate test-scaffolding export
|
|
1428
|
+
* because it has no production caller.
|
|
1429
|
+
*/
|
|
1508
1430
|
export function _resetAutoWorktreeOriginalBaseForTests(): void {
|
|
1509
1431
|
setActiveWorkspace(null);
|
|
1510
1432
|
}
|
|
@@ -1624,7 +1546,7 @@ export function mergeMilestoneToMain(
|
|
|
1624
1546
|
const contract = resolveGsdPathContract(worktreeCwd, originalBasePath_);
|
|
1625
1547
|
const worktreeDbPath = join(contract.worktreeGsd ?? join(worktreeCwd, ".gsd"), "gsd.db");
|
|
1626
1548
|
const mainDbPath = contract.projectDb;
|
|
1627
|
-
if (
|
|
1549
|
+
if (_shouldReconcileWorktreeDb(worktreeDbPath, mainDbPath)) {
|
|
1628
1550
|
reconcileWorktreeDb(mainDbPath, worktreeDbPath);
|
|
1629
1551
|
}
|
|
1630
1552
|
} catch (err) {
|
|
@@ -1634,18 +1556,27 @@ export function mergeMilestoneToMain(
|
|
|
1634
1556
|
}
|
|
1635
1557
|
|
|
1636
1558
|
// 2. Get completed slices for commit message
|
|
1637
|
-
let completedSlices: { id: string; title: string }[] = [];
|
|
1559
|
+
let completedSlices: { id: string; title: string; tasks: Array<{ id: string; title: string }> }[] = [];
|
|
1638
1560
|
if (isDbAvailable()) {
|
|
1639
1561
|
completedSlices = getMilestoneSlices(milestoneId)
|
|
1640
1562
|
.filter(s => s.status === "complete")
|
|
1641
|
-
.map(s => ({
|
|
1563
|
+
.map(s => ({
|
|
1564
|
+
id: s.id,
|
|
1565
|
+
title: stripGsdDisplayPrefix(s.title, s.id) ?? s.id,
|
|
1566
|
+
tasks: getSliceTasks(milestoneId, s.id)
|
|
1567
|
+
.filter((task) => task.status === "complete")
|
|
1568
|
+
.map((task) => ({
|
|
1569
|
+
id: task.id,
|
|
1570
|
+
title: stripGsdDisplayPrefix(task.title, task.id) ?? task.id,
|
|
1571
|
+
})),
|
|
1572
|
+
}));
|
|
1642
1573
|
}
|
|
1643
1574
|
// Fallback: parse roadmap content when DB is unavailable
|
|
1644
1575
|
if (completedSlices.length === 0 && roadmapContent) {
|
|
1645
1576
|
const sliceRe = /- \[x\] \*\*(\w+):\s*(.+?)\*\*/gi;
|
|
1646
1577
|
let m: RegExpExecArray | null;
|
|
1647
1578
|
while ((m = sliceRe.exec(roadmapContent)) !== null) {
|
|
1648
|
-
completedSlices.push({ id: m[1], title: m[2] });
|
|
1579
|
+
completedSlices.push({ id: m[1], title: m[2], tasks: [] });
|
|
1649
1580
|
}
|
|
1650
1581
|
}
|
|
1651
1582
|
|
|
@@ -1718,8 +1649,7 @@ export function mergeMilestoneToMain(
|
|
|
1718
1649
|
|
|
1719
1650
|
// 6. Build rich commit message
|
|
1720
1651
|
const dbMilestone = getMilestone(milestoneId);
|
|
1721
|
-
let milestoneTitle =
|
|
1722
|
-
(dbMilestone?.title ?? "").replace(/^M\d+:\s*/, "").trim();
|
|
1652
|
+
let milestoneTitle = stripGsdDisplayPrefix(dbMilestone?.title, milestoneId) ?? "";
|
|
1723
1653
|
// Fallback: parse title from roadmap content header (e.g. "# M020: Backend foundation")
|
|
1724
1654
|
if (!milestoneTitle && roadmapContent) {
|
|
1725
1655
|
const titleMatch = roadmapContent.match(new RegExp(`^#\\s+${milestoneId}:\\s*(.+)`, "m"));
|
|
@@ -1727,14 +1657,21 @@ export function mergeMilestoneToMain(
|
|
|
1727
1657
|
}
|
|
1728
1658
|
milestoneTitle = milestoneTitle || milestoneId;
|
|
1729
1659
|
const subject = `feat: ${milestoneTitle}`;
|
|
1660
|
+
const milestoneContext = milestoneTitle === milestoneId
|
|
1661
|
+
? `Milestone: ${milestoneId}`
|
|
1662
|
+
: `Milestone: ${milestoneId} - ${milestoneTitle}`;
|
|
1730
1663
|
let body = "";
|
|
1731
1664
|
if (completedSlices.length > 0) {
|
|
1732
1665
|
const sliceLines = completedSlices
|
|
1733
1666
|
.map((s) => `- ${s.id}: ${s.title}`)
|
|
1734
1667
|
.join("\n");
|
|
1735
|
-
|
|
1668
|
+
const taskLines = completedSlices
|
|
1669
|
+
.flatMap((s) => s.tasks.map((task) => `- ${s.id}/${task.id}: ${task.title}`))
|
|
1670
|
+
.join("\n");
|
|
1671
|
+
const taskBlock = taskLines ? `\n\nCompleted tasks:\n${taskLines}` : "";
|
|
1672
|
+
body = `\n\nCompleted slices:\n${sliceLines}${taskBlock}\n\n${milestoneContext}\nGSD-Milestone: ${milestoneId}\nBranch: ${milestoneBranch}`;
|
|
1736
1673
|
} else {
|
|
1737
|
-
body = `\n\nGSD-Milestone: ${milestoneId}\nBranch: ${milestoneBranch}`;
|
|
1674
|
+
body = `\n\n${milestoneContext}\nGSD-Milestone: ${milestoneId}\nBranch: ${milestoneBranch}`;
|
|
1738
1675
|
}
|
|
1739
1676
|
const commitMessage = subject + body;
|
|
1740
1677
|
|
|
@@ -1942,15 +1879,7 @@ export function mergeMilestoneToMain(
|
|
|
1942
1879
|
// or interrupted operation) causes `git merge --squash` to refuse with
|
|
1943
1880
|
// "fatal: You have not concluded your merge (MERGE_HEAD exists)".
|
|
1944
1881
|
// Defensively remove merge artifacts before starting.
|
|
1945
|
-
|
|
1946
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
1947
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
1948
|
-
const p = join(gitDir_, f);
|
|
1949
|
-
if (existsSync(p)) unlinkSync(p);
|
|
1950
|
-
}
|
|
1951
|
-
} catch (err) { /* best-effort */
|
|
1952
|
-
logError("worktree", `merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1953
|
-
}
|
|
1882
|
+
removeMergeStateFiles(originalBasePath_, "pre-merge");
|
|
1954
1883
|
|
|
1955
1884
|
// 8. Squash merge — auto-resolve .gsd/ state file conflicts (#530)
|
|
1956
1885
|
const mergeResult = nativeMergeSquash(originalBasePath_, milestoneBranch);
|
|
@@ -1962,15 +1891,7 @@ export function mergeMilestoneToMain(
|
|
|
1962
1891
|
if (mergeResult.conflicts.includes("__dirty_working_tree__")) {
|
|
1963
1892
|
// Defensively clean merge state — the native path may leave MERGE_HEAD
|
|
1964
1893
|
// even when the merge is rejected (#2912).
|
|
1965
|
-
|
|
1966
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
1967
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
1968
|
-
const p = join(gitDir_, f);
|
|
1969
|
-
if (existsSync(p)) unlinkSync(p);
|
|
1970
|
-
}
|
|
1971
|
-
} catch (err) { /* best-effort */
|
|
1972
|
-
logError("worktree", `merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1973
|
-
}
|
|
1894
|
+
removeMergeStateFiles(originalBasePath_, "dirty-tree rejection");
|
|
1974
1895
|
|
|
1975
1896
|
// Pop stash before throwing so local work is not lost.
|
|
1976
1897
|
if (stashed) {
|
|
@@ -2028,21 +1949,7 @@ export function mergeMilestoneToMain(
|
|
|
2028
1949
|
|
|
2029
1950
|
// If there are still real code conflicts, escalate
|
|
2030
1951
|
if (codeConflicts.length > 0) {
|
|
2031
|
-
|
|
2032
|
-
// libgit2's merge creates MERGE_HEAD even for squash merges; if left
|
|
2033
|
-
// dangling, subsequent merges fail and doctor reports corrupt state.
|
|
2034
|
-
try { nativeMergeAbort(originalBasePath_); } catch (err) { /* best-effort */
|
|
2035
|
-
logError("worktree", `git merge-abort failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
2036
|
-
}
|
|
2037
|
-
try {
|
|
2038
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
2039
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
2040
|
-
const p = join(gitDir_, f);
|
|
2041
|
-
if (existsSync(p)) unlinkSync(p);
|
|
2042
|
-
}
|
|
2043
|
-
} catch (err) { /* best-effort */
|
|
2044
|
-
logError("worktree", `merge state file cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
2045
|
-
}
|
|
1952
|
+
cleanupSquashConflictState(originalBasePath_);
|
|
2046
1953
|
|
|
2047
1954
|
// Pop stash before throwing so local work is not lost (#2151).
|
|
2048
1955
|
if (stashed) {
|
|
@@ -2080,15 +1987,7 @@ export function mergeMilestoneToMain(
|
|
|
2080
1987
|
// of which trigger git's SQUASH_MSG cleanup. MERGE_HEAD is created by
|
|
2081
1988
|
// libgit2's merge even in squash mode and is not removed by nativeCommit.
|
|
2082
1989
|
// If left on disk, doctor reports `corrupt_merge_state` on every subsequent run.
|
|
2083
|
-
|
|
2084
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
2085
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
2086
|
-
const p = join(gitDir_, f);
|
|
2087
|
-
if (existsSync(p)) unlinkSync(p);
|
|
2088
|
-
}
|
|
2089
|
-
} catch (err) { /* best-effort */
|
|
2090
|
-
logError("worktree", `post-commit merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
2091
|
-
}
|
|
1990
|
+
removeMergeStateFiles(originalBasePath_, "post-commit");
|
|
2092
1991
|
|
|
2093
1992
|
// 9a-ii. Restore stashed files now that the merge+commit is complete (#2151).
|
|
2094
1993
|
// Pop after commit so stashed changes do not interfere with the squash merge
|