gsd-pi 2.80.0-dev.42bd34838 → 2.80.0-dev.488219eb6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +29 -0
- package/dist/resources/extensions/github-sync/sync.js +4 -1
- package/dist/resources/extensions/gsd/auto/loop.js +71 -8
- package/dist/resources/extensions/gsd/auto/phases.js +179 -99
- package/dist/resources/extensions/gsd/auto/resolve.js +12 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +10 -30
- package/dist/resources/extensions/gsd/auto/session.js +8 -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-direct-dispatch.js +5 -32
- package/dist/resources/extensions/gsd/auto-dispatch.js +16 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +94 -76
- package/dist/resources/extensions/gsd/auto-prompts.js +90 -15
- package/dist/resources/extensions/gsd/auto-start.js +238 -12
- package/dist/resources/extensions/gsd/auto-worktree.js +209 -81
- package/dist/resources/extensions/gsd/auto.js +95 -44
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +96 -26
- 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 +6 -3
- 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 +298 -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/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/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +53 -0
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +2 -0
- package/dist/resources/extensions/gsd/git-service.js +37 -1
- package/dist/resources/extensions/gsd/guided-flow.js +61 -32
- package/dist/resources/extensions/gsd/init-wizard.js +4 -1
- 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/pre-execution-checks.js +22 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +8 -4
- 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/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- 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/tools/complete-milestone.js +6 -7
- package/dist/resources/extensions/gsd/tools/complete-task.js +1 -1
- package/dist/resources/extensions/gsd/workflow-protocol.js +131 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +57 -5
- 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 +11 -11
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +2 -2
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- 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_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 +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +2 -2
- 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 +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +11 -11
- 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/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/{page-fab3ebb85b006001.js → page-752f1e2ebdaa3e45.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{webpack-0481f1221120a7c6.js → webpack-de742b64187e13fe.js} +1 -1
- 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 +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 +5 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +2 -0
- 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 +9 -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/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 +8 -0
- 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 +14 -0
- 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/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/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/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-tool-refresh.test.js +18 -0
- 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 +12 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +36 -7
- 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 +3 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- 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 +2 -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 +3 -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 +3 -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 +34 -3
- 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 +74 -2
- package/packages/pi-coding-agent/dist/core/sdk.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 +5 -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 +153 -8
- 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 +18 -1
- 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 +23 -5
- 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 +19 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +23 -5
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +25 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +40 -7
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +3 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +10 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +3 -3
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +5 -5
- package/packages/pi-coding-agent/src/core/extensions/types.ts +37 -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 +85 -3
- 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 +177 -8
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +24 -5
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +17 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +21 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +25 -8
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +25 -7
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +30 -0
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +26 -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/loop-deps.ts +2 -2
- package/src/resources/extensions/gsd/auto/loop.ts +84 -8
- package/src/resources/extensions/gsd/auto/phases.ts +258 -159
- package/src/resources/extensions/gsd/auto/resolve.ts +19 -0
- package/src/resources/extensions/gsd/auto/run-unit.ts +10 -29
- package/src/resources/extensions/gsd/auto/session.ts +8 -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-direct-dispatch.ts +8 -34
- package/src/resources/extensions/gsd/auto-dispatch.ts +16 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +107 -78
- package/src/resources/extensions/gsd/auto-prompts.ts +95 -14
- package/src/resources/extensions/gsd/auto-start.ts +286 -15
- package/src/resources/extensions/gsd/auto-worktree.ts +241 -72
- package/src/resources/extensions/gsd/auto.ts +132 -40
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +116 -24
- 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 +8 -3
- 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 +347 -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/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/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +66 -0
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +3 -0
- package/src/resources/extensions/gsd/git-service.ts +41 -2
- package/src/resources/extensions/gsd/guided-flow.ts +71 -39
- package/src/resources/extensions/gsd/init-wizard.ts +5 -1
- 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/pre-execution-checks.ts +23 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +8 -4
- 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/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- 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/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 +361 -10
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +80 -59
- 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 +106 -0
- 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-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 +138 -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/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-store.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +35 -31
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +5 -1
- 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 +4 -9
- 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/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/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 +132 -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 +12 -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 +5 -1
- 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-pressure-stuck-state.test.ts +21 -35
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-stash-restore.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +79 -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 +3 -0
- package/src/resources/extensions/gsd/tests/orphan-merge-bootstrap.test.ts +133 -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 +91 -75
- 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-step-ordering.test.ts +70 -125
- 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-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/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 +166 -0
- package/src/resources/extensions/gsd/tests/show-config-command.test.ts +44 -42
- 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 -97
- 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/state-corruption-2945.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +33 -47
- 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/unit-context-manifest.test.ts +8 -25
- package/src/resources/extensions/gsd/tests/unit-dispatches.test.ts +50 -1
- 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-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 +1 -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 +140 -3
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +19 -13
- 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/workflow-protocol.ts +160 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +83 -5
- 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/web/standalone/.next/static/chunks/8336.631939fb583761fa.js +0 -10
- /package/dist/web/standalone/.next/static/{tht0ltP8EIjsohPOA_WZf → G68KoLv5claox_Dyd4pZn}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{tht0ltP8EIjsohPOA_WZf → G68KoLv5claox_Dyd4pZn}/_ssgManifest.js +0 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { existsSync, cpSync, readFileSync, readdirSync, mkdirSync, realpathSync, rmSync, unlinkSync, statSync, lstatSync as lstatSyncFn, } from "node:fs";
|
|
11
11
|
import { isAbsolute, join, relative, sep as pathSep } from "node:path";
|
|
12
12
|
import { GSDError, GSD_IO_ERROR, GSD_GIT_ERROR } from "./errors.js";
|
|
13
|
-
import { reconcileWorktreeDb, isDbAvailable, getMilestone, getMilestoneSlices, closeDatabase, openDatabase, getDbPath, } from "./gsd-db.js";
|
|
13
|
+
import { reconcileWorktreeDb, isDbAvailable, getMilestone, getMilestoneSlices, getSliceTasks, closeDatabase, openDatabase, getDbPath, } from "./gsd-db.js";
|
|
14
14
|
import { execFileSync } from "node:child_process";
|
|
15
15
|
import { safeCopy, safeCopyRecursive } from "./safe-fs.js";
|
|
16
16
|
import { gsdRoot, resolveGsdPathContract } from "./paths.js";
|
|
@@ -23,7 +23,7 @@ import { debugLog } from "./debug-logger.js";
|
|
|
23
23
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
24
24
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
25
25
|
import { MILESTONE_ID_RE } from "./milestone-ids.js";
|
|
26
|
-
import { nativeGetCurrentBranch, nativeDetectMainBranch, nativeWorkingTreeStatus, nativeAddAllWithExclusions, nativeCommit, nativeCheckoutBranch, nativeMergeSquash, nativeConflictFiles, nativeCheckoutTheirs, nativeAddPaths, nativeRmForce, nativeBranchDelete, nativeBranchForceReset, nativeBranchExists, nativeDiffNumstat, nativeUpdateRef, nativeIsAncestor, nativeMergeAbort, } from "./native-git-bridge.js";
|
|
26
|
+
import { nativeGetCurrentBranch, nativeDetectMainBranch, nativeWorkingTreeStatus, nativeAddAllWithExclusions, nativeCommit, nativeCheckoutBranch, nativeMergeSquash, nativeConflictFiles, nativeCheckoutTheirs, nativeAddPaths, nativeRmForce, nativeBranchDelete, nativeBranchForceReset, nativeBranchExists, nativeDiffNumstat, nativeUpdateRef, nativeIsAncestor, nativeMergeAbort, nativeWorktreeList, } from "./native-git-bridge.js";
|
|
27
27
|
import { gsdHome } from "./gsd-home.js";
|
|
28
28
|
import { createWorkspace } from "./workspace.js";
|
|
29
29
|
const PROJECT_PREFERENCES_FILE = "PREFERENCES.md";
|
|
@@ -135,6 +135,35 @@ function isSamePath(a, b) {
|
|
|
135
135
|
return false;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
+
export function _isSamePathForTest(a, b) {
|
|
139
|
+
return isSamePath(a, b);
|
|
140
|
+
}
|
|
141
|
+
export function _resolveAutoWorktreeStartPointForTest(integrationBranch, gitMainBranch, branchExists) {
|
|
142
|
+
if (integrationBranch)
|
|
143
|
+
return integrationBranch;
|
|
144
|
+
return gitMainBranch &&
|
|
145
|
+
typeof gitMainBranch === "string" &&
|
|
146
|
+
gitMainBranch.length > 0 &&
|
|
147
|
+
branchExists(gitMainBranch)
|
|
148
|
+
? gitMainBranch
|
|
149
|
+
: undefined;
|
|
150
|
+
}
|
|
151
|
+
export function _shouldReconcileWorktreeDbForTest(worktreeDbPath, mainDbPath, pathExists = existsSync, samePath = isSamePath) {
|
|
152
|
+
return pathExists(worktreeDbPath) && !samePath(worktreeDbPath, mainDbPath);
|
|
153
|
+
}
|
|
154
|
+
export function _isExpectedWorktreeUnlinkErrorForTest(code) {
|
|
155
|
+
return code === "ENOENT" || code === "EISDIR";
|
|
156
|
+
}
|
|
157
|
+
function stripGsdDisplayPrefix(value, id) {
|
|
158
|
+
const raw = String(value ?? "").trim();
|
|
159
|
+
if (!raw)
|
|
160
|
+
return undefined;
|
|
161
|
+
const lower = raw.toLowerCase();
|
|
162
|
+
const idLower = id.toLowerCase();
|
|
163
|
+
if (lower.startsWith(`${idLower}:`))
|
|
164
|
+
return raw.slice(id.length + 1).trim() || undefined;
|
|
165
|
+
return raw;
|
|
166
|
+
}
|
|
138
167
|
// ─── ASSESSMENT Force-Sync Helper (#2821) ─────────────────────────────────
|
|
139
168
|
/** Regex matching YAML frontmatter `verdict:` field. */
|
|
140
169
|
const VERDICT_RE = /verdict:\s*[\w-]+/i;
|
|
@@ -288,7 +317,7 @@ function clearProjectRootStateFiles(basePath, milestoneId) {
|
|
|
288
317
|
catch (err) {
|
|
289
318
|
// ENOENT/EISDIR are expected for already-removed or directory entries (#3597)
|
|
290
319
|
const code = err.code;
|
|
291
|
-
if (code
|
|
320
|
+
if (!_isExpectedWorktreeUnlinkErrorForTest(code)) {
|
|
292
321
|
logWarning("worktree", `untracked file unlink failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
293
322
|
}
|
|
294
323
|
}
|
|
@@ -317,6 +346,44 @@ export const SAFE_AUTO_RESOLVE_PATTERNS = [
|
|
|
317
346
|
* Covers `.gsd/` state files and common build artifacts. */
|
|
318
347
|
export const isSafeToAutoResolve = (filePath) => filePath.startsWith(".gsd/") ||
|
|
319
348
|
SAFE_AUTO_RESOLVE_PATTERNS.some((re) => re.test(filePath));
|
|
349
|
+
function removeMergeStateFiles(basePath, contextLabel) {
|
|
350
|
+
try {
|
|
351
|
+
const gitDir_ = resolveGitDir(basePath);
|
|
352
|
+
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
353
|
+
const p = join(gitDir_, f);
|
|
354
|
+
if (existsSync(p))
|
|
355
|
+
unlinkSync(p);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
catch (err) {
|
|
359
|
+
logError("worktree", `${contextLabel} merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function cleanupSquashConflictState(basePath) {
|
|
363
|
+
// `git merge --squash` conflicts can leave unmerged index entries without
|
|
364
|
+
// MERGE_HEAD, so merge-abort alone is not enough. Reset the merge index, then
|
|
365
|
+
// remove merge message files that native/libgit2 paths may have created.
|
|
366
|
+
try {
|
|
367
|
+
nativeMergeAbort(basePath);
|
|
368
|
+
}
|
|
369
|
+
catch (err) {
|
|
370
|
+
// Expected for squash conflicts when MERGE_HEAD was never written.
|
|
371
|
+
debugLog("squash-conflict-cleanup:merge-abort-skipped", {
|
|
372
|
+
error: err instanceof Error ? err.message : String(err),
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
execFileSync("git", ["reset", "--merge"], {
|
|
377
|
+
cwd: basePath,
|
|
378
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
379
|
+
encoding: "utf-8",
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
catch (err) {
|
|
383
|
+
logError("worktree", `git reset --merge failed after squash conflict: ${err instanceof Error ? err.message : String(err)}`);
|
|
384
|
+
}
|
|
385
|
+
removeMergeStateFiles(basePath, "squash conflict");
|
|
386
|
+
}
|
|
320
387
|
// ─── Dispatch-Level Sync (project root ↔ worktree) ──────────────────────────
|
|
321
388
|
/**
|
|
322
389
|
* Sync milestone artifacts from project root INTO worktree before deriveState.
|
|
@@ -945,17 +1012,7 @@ export function enterBranchModeForMilestone(basePath, milestoneId) {
|
|
|
945
1012
|
// Create the milestone branch from the integration branch start-point.
|
|
946
1013
|
const integrationBranch = readIntegrationBranch(basePath, milestoneId) ?? undefined;
|
|
947
1014
|
const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
948
|
-
|
|
949
|
-
// a stale preference (e.g. "master" when repo uses "main") would cause
|
|
950
|
-
// nativeBranchForceReset to fail with a bad start-point reference.
|
|
951
|
-
const validatedPrefBranch = gitPrefs?.main_branch &&
|
|
952
|
-
typeof gitPrefs.main_branch === "string" &&
|
|
953
|
-
gitPrefs.main_branch.length > 0 &&
|
|
954
|
-
nativeBranchExists(basePath, gitPrefs.main_branch)
|
|
955
|
-
? gitPrefs.main_branch
|
|
956
|
-
: undefined;
|
|
957
|
-
const startPoint = integrationBranch ??
|
|
958
|
-
validatedPrefBranch ??
|
|
1015
|
+
const startPoint = _resolveAutoWorktreeStartPointForTest(integrationBranch, gitPrefs?.main_branch, (branchName) => nativeBranchExists(basePath, branchName)) ??
|
|
959
1016
|
nativeDetectMainBranch(basePath);
|
|
960
1017
|
// TOCTOU ancestry guard (Issue #4980 HIGH-3).
|
|
961
1018
|
//
|
|
@@ -1018,6 +1075,111 @@ export function enterBranchModeForMilestone(basePath, milestoneId) {
|
|
|
1018
1075
|
* for both reads and writes. copyPlanningArtifacts and reconcilePlanCheckboxes
|
|
1019
1076
|
* (both formerly here) became dead.
|
|
1020
1077
|
*/
|
|
1078
|
+
/**
|
|
1079
|
+
* True when `branch` is checked out in any worktree listed by
|
|
1080
|
+
* `git worktree list --porcelain`. Used to gate ref updates that would
|
|
1081
|
+
* otherwise leave a concurrent worktree's HEAD inconsistent with its
|
|
1082
|
+
* index/working tree (Codex peer-review of #5538-followup).
|
|
1083
|
+
*
|
|
1084
|
+
* Best-effort: a `nativeWorktreeList` failure returns true so we err on
|
|
1085
|
+
* the side of NOT moving the ref. Better to skip a fast-forward than to
|
|
1086
|
+
* silently corrupt another worktree.
|
|
1087
|
+
*/
|
|
1088
|
+
export function _isBranchCheckedOutElsewhere(basePath, branch) {
|
|
1089
|
+
try {
|
|
1090
|
+
const entries = nativeWorktreeList(basePath);
|
|
1091
|
+
return entries.some((entry) => entry.branch === branch);
|
|
1092
|
+
}
|
|
1093
|
+
catch {
|
|
1094
|
+
return true;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Resolve the integration branch using the same 3-tier fallback as the
|
|
1099
|
+
* fresh-create path: META.json → git.main_branch preference → detected
|
|
1100
|
+
* main branch. Returns null when no usable target exists.
|
|
1101
|
+
*/
|
|
1102
|
+
function _resolveIntegrationBranchForReuse(basePath, milestoneId) {
|
|
1103
|
+
const fromMeta = readIntegrationBranch(basePath, milestoneId);
|
|
1104
|
+
if (fromMeta)
|
|
1105
|
+
return fromMeta;
|
|
1106
|
+
const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
1107
|
+
const fromPref = gitPrefs?.main_branch &&
|
|
1108
|
+
typeof gitPrefs.main_branch === "string" &&
|
|
1109
|
+
gitPrefs.main_branch.length > 0 &&
|
|
1110
|
+
nativeBranchExists(basePath, gitPrefs.main_branch)
|
|
1111
|
+
? gitPrefs.main_branch
|
|
1112
|
+
: null;
|
|
1113
|
+
if (fromPref)
|
|
1114
|
+
return fromPref;
|
|
1115
|
+
try {
|
|
1116
|
+
return nativeDetectMainBranch(basePath);
|
|
1117
|
+
}
|
|
1118
|
+
catch {
|
|
1119
|
+
return null;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* When reusing an existing milestone branch, fast-forward it onto the
|
|
1124
|
+
* integration branch when that's safe (branch is a strict ancestor of
|
|
1125
|
+
* integration — no commits would be lost). Skips when the branch has its
|
|
1126
|
+
* own commits ahead of integration, when the integration branch can't be
|
|
1127
|
+
* resolved, or when any git operation fails — the merge gate at milestone
|
|
1128
|
+
* completion will surface real divergence as a conflict.
|
|
1129
|
+
*
|
|
1130
|
+
* The previous behavior re-attached the worktree to whatever stale tip
|
|
1131
|
+
* the branch held, which caused new milestone work to fork from a base
|
|
1132
|
+
* missing prior milestones' merges (#5538-followup).
|
|
1133
|
+
*/
|
|
1134
|
+
export function fastForwardReusedMilestoneBranchIfSafe(basePath, milestoneId, branch) {
|
|
1135
|
+
try {
|
|
1136
|
+
const integrationBranch = _resolveIntegrationBranchForReuse(basePath, milestoneId);
|
|
1137
|
+
if (!integrationBranch || integrationBranch === branch)
|
|
1138
|
+
return;
|
|
1139
|
+
if (!nativeBranchExists(basePath, integrationBranch))
|
|
1140
|
+
return;
|
|
1141
|
+
// Pure fast-forward only: branch must be a strict ancestor of integration.
|
|
1142
|
+
// If the branch has its own commits ahead, leave it alone.
|
|
1143
|
+
if (!nativeIsAncestor(basePath, branch, integrationBranch)) {
|
|
1144
|
+
debugLog("createAutoWorktree", {
|
|
1145
|
+
phase: "skip-ff-branch-not-ancestor",
|
|
1146
|
+
milestoneId,
|
|
1147
|
+
branch,
|
|
1148
|
+
integration: integrationBranch,
|
|
1149
|
+
});
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
// Codex peer-review: `nativeUpdateRef` succeeds even when the branch is
|
|
1153
|
+
// currently checked out in another worktree, leaving that worktree's HEAD
|
|
1154
|
+
// inconsistent with its index/work tree. Skip the fast-forward if any
|
|
1155
|
+
// listed worktree has this branch checked out — the merge gate at
|
|
1156
|
+
// milestone-completion will surface stale-base divergence as a conflict
|
|
1157
|
+
// instead of silently corrupting the other worktree's state.
|
|
1158
|
+
if (_isBranchCheckedOutElsewhere(basePath, branch)) {
|
|
1159
|
+
debugLog("createAutoWorktree", {
|
|
1160
|
+
phase: "skip-ff-branch-checked-out-elsewhere",
|
|
1161
|
+
milestoneId,
|
|
1162
|
+
branch,
|
|
1163
|
+
});
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
nativeUpdateRef(basePath, `refs/heads/${branch}`, integrationBranch);
|
|
1167
|
+
debugLog("createAutoWorktree", {
|
|
1168
|
+
phase: "fast-forward-reused-branch",
|
|
1169
|
+
milestoneId,
|
|
1170
|
+
branch,
|
|
1171
|
+
integration: integrationBranch,
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
catch (err) {
|
|
1175
|
+
debugLog("createAutoWorktree", {
|
|
1176
|
+
phase: "fast-forward-reused-branch-failed",
|
|
1177
|
+
milestoneId,
|
|
1178
|
+
branch,
|
|
1179
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1021
1183
|
export function createAutoWorktree(basePath, milestoneId) {
|
|
1022
1184
|
basePath = resolveWorktreeProjectRoot(basePath);
|
|
1023
1185
|
// Check if repo has commits — git worktree requires a valid HEAD
|
|
@@ -1035,6 +1197,11 @@ export function createAutoWorktree(basePath, milestoneId) {
|
|
|
1035
1197
|
const branchExists = nativeBranchExists(basePath, branch);
|
|
1036
1198
|
let info;
|
|
1037
1199
|
if (branchExists) {
|
|
1200
|
+
// #5538-followup: fast-forward the reused branch onto the integration
|
|
1201
|
+
// branch when safe so the next milestone forks from up-to-date code.
|
|
1202
|
+
// Without this, a milestone that was created before another milestone
|
|
1203
|
+
// merged into main would carry a stale base into its worktree.
|
|
1204
|
+
fastForwardReusedMilestoneBranchIfSafe(basePath, milestoneId, branch);
|
|
1038
1205
|
// Re-attach worktree to the existing milestone branch (preserving commits)
|
|
1039
1206
|
info = createWorktree(basePath, milestoneId, {
|
|
1040
1207
|
branch,
|
|
@@ -1051,13 +1218,7 @@ export function createAutoWorktree(basePath, milestoneId) {
|
|
|
1051
1218
|
// would fork worktrees from the wrong (stale) branch.
|
|
1052
1219
|
const integrationBranch = readIntegrationBranch(basePath, milestoneId) ?? undefined;
|
|
1053
1220
|
const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
1054
|
-
const
|
|
1055
|
-
typeof gitPrefs.main_branch === "string" &&
|
|
1056
|
-
gitPrefs.main_branch.length > 0 &&
|
|
1057
|
-
nativeBranchExists(basePath, gitPrefs.main_branch)
|
|
1058
|
-
? gitPrefs.main_branch
|
|
1059
|
-
: undefined;
|
|
1060
|
-
const startPoint = integrationBranch ?? validatedPrefBranch ?? undefined;
|
|
1221
|
+
const startPoint = _resolveAutoWorktreeStartPointForTest(integrationBranch, gitPrefs?.main_branch, (branchName) => nativeBranchExists(basePath, branchName));
|
|
1061
1222
|
info = createWorktree(basePath, milestoneId, {
|
|
1062
1223
|
branch,
|
|
1063
1224
|
startPoint,
|
|
@@ -1134,7 +1295,7 @@ export function teardownAutoWorktree(originalBasePath, milestoneId, opts = {}) {
|
|
|
1134
1295
|
const contract = resolveGsdPathContract(previousCwd, originalBasePath);
|
|
1135
1296
|
const worktreeDbPath = join(contract.worktreeGsd ?? join(previousCwd, ".gsd"), "gsd.db");
|
|
1136
1297
|
const mainDbPath = contract.projectDb;
|
|
1137
|
-
if (
|
|
1298
|
+
if (_shouldReconcileWorktreeDbForTest(worktreeDbPath, mainDbPath)) {
|
|
1138
1299
|
reconcileWorktreeDb(mainDbPath, worktreeDbPath);
|
|
1139
1300
|
}
|
|
1140
1301
|
}
|
|
@@ -1384,7 +1545,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1384
1545
|
const contract = resolveGsdPathContract(worktreeCwd, originalBasePath_);
|
|
1385
1546
|
const worktreeDbPath = join(contract.worktreeGsd ?? join(worktreeCwd, ".gsd"), "gsd.db");
|
|
1386
1547
|
const mainDbPath = contract.projectDb;
|
|
1387
|
-
if (
|
|
1548
|
+
if (_shouldReconcileWorktreeDbForTest(worktreeDbPath, mainDbPath)) {
|
|
1388
1549
|
reconcileWorktreeDb(mainDbPath, worktreeDbPath);
|
|
1389
1550
|
}
|
|
1390
1551
|
}
|
|
@@ -1398,14 +1559,23 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1398
1559
|
if (isDbAvailable()) {
|
|
1399
1560
|
completedSlices = getMilestoneSlices(milestoneId)
|
|
1400
1561
|
.filter(s => s.status === "complete")
|
|
1401
|
-
.map(s => ({
|
|
1562
|
+
.map(s => ({
|
|
1563
|
+
id: s.id,
|
|
1564
|
+
title: stripGsdDisplayPrefix(s.title, s.id) ?? s.id,
|
|
1565
|
+
tasks: getSliceTasks(milestoneId, s.id)
|
|
1566
|
+
.filter((task) => task.status === "complete")
|
|
1567
|
+
.map((task) => ({
|
|
1568
|
+
id: task.id,
|
|
1569
|
+
title: stripGsdDisplayPrefix(task.title, task.id) ?? task.id,
|
|
1570
|
+
})),
|
|
1571
|
+
}));
|
|
1402
1572
|
}
|
|
1403
1573
|
// Fallback: parse roadmap content when DB is unavailable
|
|
1404
1574
|
if (completedSlices.length === 0 && roadmapContent) {
|
|
1405
1575
|
const sliceRe = /- \[x\] \*\*(\w+):\s*(.+?)\*\*/gi;
|
|
1406
1576
|
let m;
|
|
1407
1577
|
while ((m = sliceRe.exec(roadmapContent)) !== null) {
|
|
1408
|
-
completedSlices.push({ id: m[1], title: m[2] });
|
|
1578
|
+
completedSlices.push({ id: m[1], title: m[2], tasks: [] });
|
|
1409
1579
|
}
|
|
1410
1580
|
}
|
|
1411
1581
|
// 3. chdir to original base
|
|
@@ -1462,7 +1632,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1462
1632
|
}
|
|
1463
1633
|
// 6. Build rich commit message
|
|
1464
1634
|
const dbMilestone = getMilestone(milestoneId);
|
|
1465
|
-
let milestoneTitle = (dbMilestone?.title ?? ""
|
|
1635
|
+
let milestoneTitle = stripGsdDisplayPrefix(dbMilestone?.title, milestoneId) ?? "";
|
|
1466
1636
|
// Fallback: parse title from roadmap content header (e.g. "# M020: Backend foundation")
|
|
1467
1637
|
if (!milestoneTitle && roadmapContent) {
|
|
1468
1638
|
const titleMatch = roadmapContent.match(new RegExp(`^#\\s+${milestoneId}:\\s*(.+)`, "m"));
|
|
@@ -1471,15 +1641,22 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1471
1641
|
}
|
|
1472
1642
|
milestoneTitle = milestoneTitle || milestoneId;
|
|
1473
1643
|
const subject = `feat: ${milestoneTitle}`;
|
|
1644
|
+
const milestoneContext = milestoneTitle === milestoneId
|
|
1645
|
+
? `Milestone: ${milestoneId}`
|
|
1646
|
+
: `Milestone: ${milestoneId} - ${milestoneTitle}`;
|
|
1474
1647
|
let body = "";
|
|
1475
1648
|
if (completedSlices.length > 0) {
|
|
1476
1649
|
const sliceLines = completedSlices
|
|
1477
1650
|
.map((s) => `- ${s.id}: ${s.title}`)
|
|
1478
1651
|
.join("\n");
|
|
1479
|
-
|
|
1652
|
+
const taskLines = completedSlices
|
|
1653
|
+
.flatMap((s) => s.tasks.map((task) => `- ${s.id}/${task.id}: ${task.title}`))
|
|
1654
|
+
.join("\n");
|
|
1655
|
+
const taskBlock = taskLines ? `\n\nCompleted tasks:\n${taskLines}` : "";
|
|
1656
|
+
body = `\n\nCompleted slices:\n${sliceLines}${taskBlock}\n\n${milestoneContext}\nGSD-Milestone: ${milestoneId}\nBranch: ${milestoneBranch}`;
|
|
1480
1657
|
}
|
|
1481
1658
|
else {
|
|
1482
|
-
body = `\n\nGSD-Milestone: ${milestoneId}\nBranch: ${milestoneBranch}`;
|
|
1659
|
+
body = `\n\n${milestoneContext}\nGSD-Milestone: ${milestoneId}\nBranch: ${milestoneBranch}`;
|
|
1483
1660
|
}
|
|
1484
1661
|
const commitMessage = subject + body;
|
|
1485
1662
|
// 6b. Reconcile worktree HEAD with milestone branch ref (#1846).
|
|
@@ -1680,17 +1857,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1680
1857
|
// or interrupted operation) causes `git merge --squash` to refuse with
|
|
1681
1858
|
// "fatal: You have not concluded your merge (MERGE_HEAD exists)".
|
|
1682
1859
|
// Defensively remove merge artifacts before starting.
|
|
1683
|
-
|
|
1684
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
1685
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
1686
|
-
const p = join(gitDir_, f);
|
|
1687
|
-
if (existsSync(p))
|
|
1688
|
-
unlinkSync(p);
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
catch (err) { /* best-effort */
|
|
1692
|
-
logError("worktree", `merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1693
|
-
}
|
|
1860
|
+
removeMergeStateFiles(originalBasePath_, "pre-merge");
|
|
1694
1861
|
// 8. Squash merge — auto-resolve .gsd/ state file conflicts (#530)
|
|
1695
1862
|
const mergeResult = nativeMergeSquash(originalBasePath_, milestoneBranch);
|
|
1696
1863
|
if (!mergeResult.success) {
|
|
@@ -1700,17 +1867,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1700
1867
|
if (mergeResult.conflicts.includes("__dirty_working_tree__")) {
|
|
1701
1868
|
// Defensively clean merge state — the native path may leave MERGE_HEAD
|
|
1702
1869
|
// even when the merge is rejected (#2912).
|
|
1703
|
-
|
|
1704
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
1705
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
1706
|
-
const p = join(gitDir_, f);
|
|
1707
|
-
if (existsSync(p))
|
|
1708
|
-
unlinkSync(p);
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
catch (err) { /* best-effort */
|
|
1712
|
-
logError("worktree", `merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1713
|
-
}
|
|
1870
|
+
removeMergeStateFiles(originalBasePath_, "dirty-tree rejection");
|
|
1714
1871
|
// Pop stash before throwing so local work is not lost.
|
|
1715
1872
|
if (stashed) {
|
|
1716
1873
|
try {
|
|
@@ -1759,26 +1916,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1759
1916
|
}
|
|
1760
1917
|
// If there are still real code conflicts, escalate
|
|
1761
1918
|
if (codeConflicts.length > 0) {
|
|
1762
|
-
|
|
1763
|
-
// libgit2's merge creates MERGE_HEAD even for squash merges; if left
|
|
1764
|
-
// dangling, subsequent merges fail and doctor reports corrupt state.
|
|
1765
|
-
try {
|
|
1766
|
-
nativeMergeAbort(originalBasePath_);
|
|
1767
|
-
}
|
|
1768
|
-
catch (err) { /* best-effort */
|
|
1769
|
-
logError("worktree", `git merge-abort failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1770
|
-
}
|
|
1771
|
-
try {
|
|
1772
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
1773
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
1774
|
-
const p = join(gitDir_, f);
|
|
1775
|
-
if (existsSync(p))
|
|
1776
|
-
unlinkSync(p);
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
catch (err) { /* best-effort */
|
|
1780
|
-
logError("worktree", `merge state file cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1781
|
-
}
|
|
1919
|
+
cleanupSquashConflictState(originalBasePath_);
|
|
1782
1920
|
// Pop stash before throwing so local work is not lost (#2151).
|
|
1783
1921
|
if (stashed) {
|
|
1784
1922
|
try {
|
|
@@ -1809,17 +1947,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1809
1947
|
// of which trigger git's SQUASH_MSG cleanup. MERGE_HEAD is created by
|
|
1810
1948
|
// libgit2's merge even in squash mode and is not removed by nativeCommit.
|
|
1811
1949
|
// If left on disk, doctor reports `corrupt_merge_state` on every subsequent run.
|
|
1812
|
-
|
|
1813
|
-
const gitDir_ = resolveGitDir(originalBasePath_);
|
|
1814
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_HEAD"]) {
|
|
1815
|
-
const p = join(gitDir_, f);
|
|
1816
|
-
if (existsSync(p))
|
|
1817
|
-
unlinkSync(p);
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
catch (err) { /* best-effort */
|
|
1821
|
-
logError("worktree", `post-commit merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1822
|
-
}
|
|
1950
|
+
removeMergeStateFiles(originalBasePath_, "post-commit");
|
|
1823
1951
|
// 9a-ii. Restore stashed files now that the merge+commit is complete (#2151).
|
|
1824
1952
|
// Pop after commit so stashed changes do not interfere with the squash merge
|
|
1825
1953
|
// or the commit content. Conflict on pop is non-fatal — the stash entry is
|