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
|
@@ -1,72 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Regression test for #3628 — restore tool set after discuss flow scoping
|
|
3
|
-
*
|
|
4
|
-
* The discuss flow narrows the active tool set to avoid "grammar too complex"
|
|
5
|
-
* errors. Without restoring after sendMessage, the narrowed tools leaked into
|
|
6
|
-
* subsequent dispatches, breaking plan/execute flows.
|
|
7
|
-
*
|
|
8
|
-
* The fix saves the full tool set before scoping and restores it after
|
|
9
|
-
* sendMessage returns.
|
|
2
|
+
* Regression test for #3628 — restore tool set after discuss flow scoping.
|
|
10
3
|
*/
|
|
11
4
|
|
|
12
|
-
import
|
|
13
|
-
import assert from
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
assert.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
'setActiveTools(savedTools) must be called to restore the full tool set',
|
|
70
|
-
)
|
|
71
|
-
})
|
|
72
|
-
})
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import assert from "node:assert/strict";
|
|
7
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
|
|
11
|
+
import { _dispatchWorkflowForTest } from "../guided-flow.ts";
|
|
12
|
+
|
|
13
|
+
test("discuss workflow scopes tools for the queued turn and restores the full tool set", async () => {
|
|
14
|
+
const dir = mkdtempSync(join(tmpdir(), "gsd-discuss-tools-"));
|
|
15
|
+
const workflowPath = join(dir, "GSD-WORKFLOW.md");
|
|
16
|
+
const originalWorkflowPath = process.env.GSD_WORKFLOW_PATH;
|
|
17
|
+
const originalTools = [
|
|
18
|
+
"gsd_task_complete",
|
|
19
|
+
"gsd_summary_save",
|
|
20
|
+
"shell_exec",
|
|
21
|
+
"gsd_plan_milestone",
|
|
22
|
+
];
|
|
23
|
+
let activeTools = [...originalTools];
|
|
24
|
+
let sentTools: string[] | null = null;
|
|
25
|
+
let triggerTurn = false;
|
|
26
|
+
|
|
27
|
+
const pi = {
|
|
28
|
+
getActiveTools: () => [...activeTools],
|
|
29
|
+
setActiveTools: (tools: string[]) => {
|
|
30
|
+
activeTools = [...tools];
|
|
31
|
+
},
|
|
32
|
+
sendMessage: (_message: unknown, options?: { triggerTurn?: boolean }) => {
|
|
33
|
+
sentTools = [...activeTools];
|
|
34
|
+
triggerTurn = options?.triggerTurn === true;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
writeFileSync(workflowPath, "# Workflow\n", "utf-8");
|
|
40
|
+
process.env.GSD_WORKFLOW_PATH = workflowPath;
|
|
41
|
+
|
|
42
|
+
await _dispatchWorkflowForTest(
|
|
43
|
+
pi as any,
|
|
44
|
+
"Interview the user.",
|
|
45
|
+
"gsd-discuss",
|
|
46
|
+
undefined,
|
|
47
|
+
"discuss-milestone",
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
assert.deepEqual(sentTools, ["gsd_summary_save"]);
|
|
51
|
+
assert.deepEqual(activeTools, originalTools);
|
|
52
|
+
assert.equal(triggerTurn, true);
|
|
53
|
+
} finally {
|
|
54
|
+
if (originalWorkflowPath === undefined) {
|
|
55
|
+
delete process.env.GSD_WORKFLOW_PATH;
|
|
56
|
+
} else {
|
|
57
|
+
process.env.GSD_WORKFLOW_PATH = originalWorkflowPath;
|
|
58
|
+
}
|
|
59
|
+
rmSync(dir, { recursive: true, force: true });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tests for fix of #3723: auto-mode resume/crash-recovery dispatches
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* During resume, the paused-session metadata may record `worktreePath` that
|
|
6
|
-
* was active when the session paused. The resume path must use that path (or
|
|
7
|
-
* derive the worktree path via filesystem lookup) to set the dispatch context
|
|
8
|
-
* (`s.basePath`), rather than defaulting to the project root.
|
|
9
|
-
*
|
|
10
|
-
* The fix adds an early worktree-path resolution step in the paused-session
|
|
11
|
-
* resume block of auto.ts — immediately after `s.basePath = base` — so that
|
|
12
|
-
* the correct dispatch directory is used before the dispatch loop runs.
|
|
2
|
+
* Tests for fix of #3723: auto-mode resume/crash-recovery dispatches from
|
|
3
|
+
* the paused milestone worktree when that worktree still exists.
|
|
13
4
|
*/
|
|
14
5
|
|
|
15
6
|
import test from "node:test";
|
|
@@ -18,95 +9,8 @@ import { readFileSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
|
18
9
|
import { join } from "node:path";
|
|
19
10
|
import { tmpdir } from "node:os";
|
|
20
11
|
import { randomUUID } from "node:crypto";
|
|
21
|
-
import { fileURLToPath } from "node:url";
|
|
22
|
-
import { dirname } from "node:path";
|
|
23
12
|
|
|
24
|
-
|
|
25
|
-
const autoSrc = readFileSync(join(__dirname, "..", "auto.ts"), "utf-8");
|
|
26
|
-
|
|
27
|
-
// ── Source-structure tests ────────────────────────────────────────────────────
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Extract the paused-session resume block from auto.ts.
|
|
31
|
-
*
|
|
32
|
-
* The block we care about is the `if (s.paused) { ... }` section inside
|
|
33
|
-
* startAuto, which contains `s.basePath = base` (line ~1473) followed by the
|
|
34
|
-
* `enterMilestone` call.
|
|
35
|
-
*
|
|
36
|
-
* We find it by locating the `s.basePath = base` assignment that appears
|
|
37
|
-
* WITHIN the s.paused branch (there's only one: all other basePath assignments
|
|
38
|
-
* use originalBasePath or a different value). We extract from that assignment
|
|
39
|
-
* up to just before `enterMilestone(`.
|
|
40
|
-
*/
|
|
41
|
-
function getBasepathToEnterMilestoneSegment(): string {
|
|
42
|
-
// Find `s.basePath = base;` in the s.paused branch
|
|
43
|
-
// This assignment appears uniquely inside the resume block
|
|
44
|
-
const assignPattern = "s.basePath = base;";
|
|
45
|
-
const assignIdx = autoSrc.indexOf(assignPattern);
|
|
46
|
-
assert.ok(
|
|
47
|
-
assignIdx > -1,
|
|
48
|
-
`auto.ts must contain '${assignPattern}' in the resume block`,
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
// Find the next enterMilestone call after this assignment
|
|
52
|
-
const enterMilestoneIdx = autoSrc.indexOf("enterMilestone(", assignIdx);
|
|
53
|
-
assert.ok(
|
|
54
|
-
enterMilestoneIdx > assignIdx,
|
|
55
|
-
"auto.ts must call enterMilestone after the s.basePath = base assignment",
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
// Return the code between the assignment and enterMilestone
|
|
59
|
-
return autoSrc.slice(assignIdx, enterMilestoneIdx);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
test("auto.ts resume block resolves paused-session worktreePath and applies it to s.basePath before entering worktree (fixes #3723)", () => {
|
|
63
|
-
// The segment between `s.basePath = base` and `enterMilestone(` must
|
|
64
|
-
// contain logic that resolves the paused-session worktreePath and applies
|
|
65
|
-
// it to s.basePath when the worktree exists on disk.
|
|
66
|
-
//
|
|
67
|
-
// The fix reads the worktree path from freshStartAssessment.pausedSession
|
|
68
|
-
// (since `meta` is out of scope at this point in startAuto) and assigns
|
|
69
|
-
// it to s.basePath, guarded by existsSync.
|
|
70
|
-
//
|
|
71
|
-
// Without this fix, the dispatch loop runs from `base` (project root)
|
|
72
|
-
// instead of the worktree, causing split-brain execution (#3723).
|
|
73
|
-
const segment = getBasepathToEnterMilestoneSegment();
|
|
74
|
-
|
|
75
|
-
// The fix uses freshStartAssessment.pausedSession?.worktreePath via a
|
|
76
|
-
// local variable (resumeWorktreePath) and assigns to s.basePath.
|
|
77
|
-
const hasWorktreePathResolution =
|
|
78
|
-
segment.includes("worktreePath") &&
|
|
79
|
-
segment.includes("existsSync") &&
|
|
80
|
-
segment.includes("s.basePath =");
|
|
81
|
-
|
|
82
|
-
assert.ok(
|
|
83
|
-
hasWorktreePathResolution,
|
|
84
|
-
"auto.ts must resolve the paused-session worktreePath, check existsSync, and assign " +
|
|
85
|
-
"s.basePath before enterMilestone — crash-recovery currently dispatches from project root " +
|
|
86
|
-
"instead of milestone worktree (issue #3723). The fix belongs between `s.basePath = base` " +
|
|
87
|
-
"and the enterMilestone call.",
|
|
88
|
-
);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("auto.ts worktreePath assignment in resume block guards against non-existent path (fixes #3723)", () => {
|
|
92
|
-
// The assignment to s.basePath from the paused-session worktreePath must
|
|
93
|
-
// be guarded by existsSync to avoid setting an invalid basePath if the
|
|
94
|
-
// worktree was cleaned up between pause and resume.
|
|
95
|
-
const segment = getBasepathToEnterMilestoneSegment();
|
|
96
|
-
|
|
97
|
-
// Must have existsSync guard AND a worktreePath reference AND s.basePath assignment
|
|
98
|
-
const hasGuardedAssignment =
|
|
99
|
-
segment.includes("existsSync") &&
|
|
100
|
-
segment.includes("worktreePath") &&
|
|
101
|
-
segment.includes("s.basePath =");
|
|
102
|
-
|
|
103
|
-
assert.ok(
|
|
104
|
-
hasGuardedAssignment,
|
|
105
|
-
"auto.ts must guard the s.basePath = worktreePath assignment with existsSync (fixes #3723)",
|
|
106
|
-
);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// ── Functional tests ──────────────────────────────────────────────────────────
|
|
13
|
+
import { _resolvePausedResumeBasePathForTest } from "../auto.ts";
|
|
110
14
|
|
|
111
15
|
function makeTmpBase(): string {
|
|
112
16
|
const base = join(tmpdir(), `gsd-resume-wt-${randomUUID()}`);
|
|
@@ -115,7 +19,7 @@ function makeTmpBase(): string {
|
|
|
115
19
|
}
|
|
116
20
|
|
|
117
21
|
function cleanup(base: string): void {
|
|
118
|
-
try { rmSync(base, { recursive: true, force: true }); } catch { /* */ }
|
|
22
|
+
try { rmSync(base, { recursive: true, force: true }); } catch { /* noop */ }
|
|
119
23
|
}
|
|
120
24
|
|
|
121
25
|
function writePausedSession(
|
|
@@ -142,7 +46,6 @@ function makeWorktreePath(base: string, milestoneId: string): string {
|
|
|
142
46
|
|
|
143
47
|
function setupWorktreeOnDisk(wt: string): void {
|
|
144
48
|
mkdirSync(wt, { recursive: true });
|
|
145
|
-
// Simulate a git worktree: .git file with gitdir pointer
|
|
146
49
|
writeFileSync(
|
|
147
50
|
join(wt, ".git"),
|
|
148
51
|
"gitdir: /project/.git/worktrees/M001-test\n",
|
|
@@ -150,81 +53,46 @@ function setupWorktreeOnDisk(wt: string): void {
|
|
|
150
53
|
);
|
|
151
54
|
}
|
|
152
55
|
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
"utf-8",
|
|
167
|
-
);
|
|
168
|
-
}
|
|
56
|
+
test("resume base path uses paused-session worktreePath when the worktree exists", () => {
|
|
57
|
+
const base = makeTmpBase();
|
|
58
|
+
const wt = makeWorktreePath(base, "M001-test");
|
|
59
|
+
try {
|
|
60
|
+
setupWorktreeOnDisk(wt);
|
|
61
|
+
assert.equal(
|
|
62
|
+
_resolvePausedResumeBasePathForTest(base, wt),
|
|
63
|
+
wt,
|
|
64
|
+
);
|
|
65
|
+
} finally {
|
|
66
|
+
cleanup(base);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
169
69
|
|
|
170
|
-
test("
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
70
|
+
test("resume base path falls back to project root when paused worktree is missing", () => {
|
|
71
|
+
const base = makeTmpBase();
|
|
72
|
+
const wt = makeWorktreePath(base, "M001-test");
|
|
73
|
+
try {
|
|
74
|
+
assert.equal(
|
|
75
|
+
_resolvePausedResumeBasePathForTest(base, wt),
|
|
76
|
+
base,
|
|
77
|
+
);
|
|
78
|
+
} finally {
|
|
79
|
+
cleanup(base);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("read paused-session metadata round-trips worktreePath from paused-session.json", () => {
|
|
176
84
|
const base = makeTmpBase();
|
|
177
85
|
const wt = makeWorktreePath(base, "M001-test");
|
|
178
86
|
try {
|
|
179
87
|
setupWorktreeOnDisk(wt);
|
|
180
88
|
writePausedSession(base, "M001-test", wt);
|
|
181
89
|
|
|
182
|
-
// Simulate readPausedSessionMetadata without importing the full module
|
|
183
90
|
const pausedPath = join(base, ".gsd", "runtime", "paused-session.json");
|
|
184
91
|
const meta = JSON.parse(readFileSync(pausedPath, "utf-8"));
|
|
185
92
|
|
|
186
|
-
assert.ok(meta, "paused-session metadata must be readable");
|
|
187
93
|
assert.equal(meta.milestoneId, "M001-test");
|
|
188
|
-
assert.equal(meta.worktreePath, wt
|
|
94
|
+
assert.equal(meta.worktreePath, wt);
|
|
189
95
|
} finally {
|
|
190
96
|
cleanup(base);
|
|
191
97
|
}
|
|
192
98
|
});
|
|
193
|
-
|
|
194
|
-
test("auto.ts resume block uses worktreePath from freshStartAssessment.pausedSession as dispatch basePath when worktree exists (#3723)", () => {
|
|
195
|
-
// End-to-end structural verification: the auto.ts source must contain code
|
|
196
|
-
// that reads the worktreePath from freshStartAssessment.pausedSession AND
|
|
197
|
-
// applies it to s.basePath (guarded by existsSync) between the
|
|
198
|
-
// `s.basePath = base` assignment and `enterMilestone`.
|
|
199
|
-
//
|
|
200
|
-
// This is the core of the #3723 fix. Without this check, a session that
|
|
201
|
-
// paused while operating inside a worktree will resume dispatching from the
|
|
202
|
-
// project root, not the worktree — causing split-brain execution where some
|
|
203
|
-
// operations target the worktree and others target the project root.
|
|
204
|
-
const segment = getBasepathToEnterMilestoneSegment();
|
|
205
|
-
|
|
206
|
-
// Must reference freshStartAssessment.pausedSession?.worktreePath or
|
|
207
|
-
// equivalent local variable, AND contain an existsSync guard
|
|
208
|
-
const hasAssessmentWorktreePath =
|
|
209
|
-
segment.includes("freshStartAssessment.pausedSession") &&
|
|
210
|
-
segment.includes("worktreePath");
|
|
211
|
-
|
|
212
|
-
assert.ok(
|
|
213
|
-
hasAssessmentWorktreePath,
|
|
214
|
-
"auto.ts must read worktreePath from freshStartAssessment.pausedSession between " +
|
|
215
|
-
"s.basePath=base and enterMilestone",
|
|
216
|
-
);
|
|
217
|
-
assert.ok(
|
|
218
|
-
segment.includes("existsSync"),
|
|
219
|
-
"auto.ts must guard worktreePath usage with existsSync",
|
|
220
|
-
);
|
|
221
|
-
// The actual basePath re-assignment must be present in the segment
|
|
222
|
-
// (note: there are multiple `s.basePath =` assignments — we need one after
|
|
223
|
-
// the initial `s.basePath = base` assignment within this segment)
|
|
224
|
-
const worktreeAssignIdx = segment.lastIndexOf("s.basePath =");
|
|
225
|
-
const baseAssignIdx = segment.indexOf("s.basePath = base");
|
|
226
|
-
assert.ok(
|
|
227
|
-
worktreeAssignIdx > baseAssignIdx,
|
|
228
|
-
"auto.ts must assign s.basePath to the worktree path after `s.basePath = base` in the resume block",
|
|
229
|
-
);
|
|
230
|
-
});
|
|
@@ -1,51 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Regression test for #3624 — cap run-uat dispatch attempts
|
|
3
|
-
*
|
|
4
|
-
* When verification commands fail before writing a verdict, the run-uat
|
|
5
|
-
* dispatch rule fires repeatedly in an infinite loop. The fix adds a
|
|
6
|
-
* MAX_UAT_ATTEMPTS constant and calls incrementUatCount before dispatch
|
|
7
|
-
* to cap the number of attempts.
|
|
8
|
-
*
|
|
9
|
-
* Structural verification test — reads source to confirm MAX_UAT_ATTEMPTS
|
|
10
|
-
* and incrementUatCount exist.
|
|
2
|
+
* Regression test for #3624 — cap run-uat dispatch attempts.
|
|
11
3
|
*/
|
|
12
4
|
|
|
13
|
-
import
|
|
14
|
-
import assert from
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import assert from "node:assert/strict";
|
|
7
|
+
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
const __dirname = dirname(__filename);
|
|
11
|
+
import { DISPATCH_RULES, getUatCount } from "../auto-dispatch.ts";
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
function makeUatProject(): string {
|
|
14
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-uat-cap-"));
|
|
15
|
+
const milestone = join(base, ".gsd", "milestones", "M001");
|
|
16
|
+
mkdirSync(join(milestone, "slices", "S01"), { recursive: true });
|
|
17
|
+
mkdirSync(join(milestone, "slices", "S02"), { recursive: true });
|
|
18
|
+
writeFileSync(
|
|
19
|
+
join(milestone, "M001-ROADMAP.md"),
|
|
20
|
+
[
|
|
21
|
+
"# M001: UAT Cap",
|
|
22
|
+
"",
|
|
23
|
+
"## Slices",
|
|
24
|
+
"- [x] **S01: Completed slice** `risk:low`",
|
|
25
|
+
" Demo: done.",
|
|
26
|
+
"- [ ] **S02: Remaining slice** `risk:low`",
|
|
27
|
+
" Demo: pending.",
|
|
28
|
+
].join("\n"),
|
|
29
|
+
"utf-8",
|
|
30
|
+
);
|
|
31
|
+
writeFileSync(
|
|
32
|
+
join(milestone, "slices", "S01", "S01-UAT.md"),
|
|
33
|
+
"# UAT\n\nRun the checks. No verdict has been written yet.\n",
|
|
34
|
+
"utf-8",
|
|
35
|
+
);
|
|
36
|
+
return base;
|
|
37
|
+
}
|
|
23
38
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
39
|
+
test("run-uat dispatch stops after three attempts without a verdict", async () => {
|
|
40
|
+
const basePath = makeUatProject();
|
|
41
|
+
const rule = DISPATCH_RULES.find((r) => r.name === "run-uat (post-completion)");
|
|
42
|
+
assert.ok(rule, "run-uat dispatch rule is registered");
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
const ctx = {
|
|
45
|
+
state: { phase: "planning", activeSlice: null },
|
|
46
|
+
mid: "M001",
|
|
47
|
+
midTitle: "UAT Cap",
|
|
48
|
+
basePath,
|
|
49
|
+
prefs: { uat_dispatch: true },
|
|
50
|
+
};
|
|
34
51
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
try {
|
|
53
|
+
for (let i = 1; i <= 3; i++) {
|
|
54
|
+
const action = await rule.match(ctx as any);
|
|
55
|
+
assert.equal(action?.action, "dispatch");
|
|
56
|
+
assert.equal(action?.unitType, "run-uat");
|
|
57
|
+
assert.equal(getUatCount(basePath, "M001", "S01"), i);
|
|
58
|
+
}
|
|
39
59
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
assert.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
test('attempts are compared against MAX_UAT_ATTEMPTS', () => {
|
|
48
|
-
assert.match(source, /attempts\s*>\s*MAX_UAT_ATTEMPTS/,
|
|
49
|
-
'dispatch should check attempts > MAX_UAT_ATTEMPTS');
|
|
50
|
-
});
|
|
60
|
+
const capped = await rule.match(ctx as any);
|
|
61
|
+
assert.equal(capped?.action, "stop");
|
|
62
|
+
assert.match(capped?.reason ?? "", /dispatched 3 times/);
|
|
63
|
+
assert.equal(getUatCount(basePath, "M001", "S01"), 4);
|
|
64
|
+
} finally {
|
|
65
|
+
rmSync(basePath, { recursive: true, force: true });
|
|
66
|
+
}
|
|
51
67
|
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// GSD-2 + src/resources/extensions/gsd/tests/select-resumable-milestone.test.ts
|
|
2
|
+
// Regression: bootstrap must rederive `currentMilestoneId` from an unmerged
|
|
3
|
+
// completed milestone branch when in-memory state was lost across a process
|
|
4
|
+
// restart (#5538-followup).
|
|
5
|
+
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import assert from "node:assert/strict";
|
|
8
|
+
|
|
9
|
+
import { _selectResumableMilestone } from "../auto-start.js";
|
|
10
|
+
|
|
11
|
+
const ALL_COMPLETE = (_id: string) => true;
|
|
12
|
+
const NEVER_COMPLETE = (_id: string) => false;
|
|
13
|
+
const HAS_COMMITS = (_branch: string) => 1;
|
|
14
|
+
const NO_COMMITS = (_branch: string) => 0;
|
|
15
|
+
|
|
16
|
+
test("returns null when no branches exist", () => {
|
|
17
|
+
const result = _selectResumableMilestone([], new Set(), ALL_COMPLETE, HAS_COMMITS);
|
|
18
|
+
assert.equal(result, null);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("returns null when every milestone branch is already merged", () => {
|
|
22
|
+
const branches = ["milestone/M001", "milestone/M002"];
|
|
23
|
+
const merged = new Set(branches);
|
|
24
|
+
const result = _selectResumableMilestone(branches, merged, ALL_COMPLETE, HAS_COMMITS);
|
|
25
|
+
assert.equal(result, null);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("returns null when no candidate milestones are complete", () => {
|
|
29
|
+
const branches = ["milestone/M002"];
|
|
30
|
+
const result = _selectResumableMilestone(branches, new Set(), NEVER_COMPLETE, HAS_COMMITS);
|
|
31
|
+
assert.equal(result, null);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("returns null when no branch has commits ahead", () => {
|
|
35
|
+
const branches = ["milestone/M002"];
|
|
36
|
+
const result = _selectResumableMilestone(branches, new Set(), ALL_COMPLETE, NO_COMMITS);
|
|
37
|
+
assert.equal(result, null);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("returns the unmerged completed milestone (regression: M002 stranded after restart)", () => {
|
|
41
|
+
// Repro of test12345 state: M001 ✅ merged, M002 ✅ unmerged, M003 🔄.
|
|
42
|
+
// Bootstrap must seed currentMilestoneId = "M002" so the loop's transition
|
|
43
|
+
// guard fires when the next iteration sees mid="M003".
|
|
44
|
+
const branches = ["milestone/M002", "milestone/M003"];
|
|
45
|
+
const merged = new Set<string>(); // none merged from this list
|
|
46
|
+
const isComplete = (id: string) => id === "M002"; // M003 still in progress
|
|
47
|
+
const result = _selectResumableMilestone(branches, merged, isComplete, HAS_COMMITS);
|
|
48
|
+
assert.equal(result, "M002");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("picks the lex-greatest milestone when multiple candidates exist", () => {
|
|
52
|
+
// M001, M002 both unmerged complete -> pick M002 (the most recent).
|
|
53
|
+
const branches = ["milestone/M001", "milestone/M002"];
|
|
54
|
+
const result = _selectResumableMilestone(
|
|
55
|
+
branches,
|
|
56
|
+
new Set(),
|
|
57
|
+
ALL_COMPLETE,
|
|
58
|
+
HAS_COMMITS,
|
|
59
|
+
);
|
|
60
|
+
assert.equal(result, "M002");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("ignores branch names that don't follow the milestone/ prefix", () => {
|
|
64
|
+
const branches = ["feature/something", "milestone/M002", "fix/bug-1"];
|
|
65
|
+
const result = _selectResumableMilestone(
|
|
66
|
+
branches,
|
|
67
|
+
new Set(),
|
|
68
|
+
ALL_COMPLETE,
|
|
69
|
+
HAS_COMMITS,
|
|
70
|
+
);
|
|
71
|
+
assert.equal(result, "M002");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("isComplete callback throwing skips that milestone but does not crash", () => {
|
|
75
|
+
const branches = ["milestone/M001", "milestone/M002"];
|
|
76
|
+
const isComplete = (id: string) => {
|
|
77
|
+
if (id === "M001") throw new Error("db unavailable for M001");
|
|
78
|
+
return true;
|
|
79
|
+
};
|
|
80
|
+
// Implementation choice: a thrown isComplete is propagated. Wrapping in
|
|
81
|
+
// try/catch happens at the production wrapper level (findUnmergedCompletedMilestone).
|
|
82
|
+
// Verify the helper itself surfaces the error so callers see real failures.
|
|
83
|
+
assert.throws(() => _selectResumableMilestone(branches, new Set(), isComplete, HAS_COMMITS));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("commitsAhead callback throwing for one branch falls through to others", () => {
|
|
87
|
+
// Production wrapper: commits-ahead failures should not abort the search.
|
|
88
|
+
// The helper catches throws from commitsAhead per-branch and treats as 0.
|
|
89
|
+
const branches = ["milestone/M001", "milestone/M002"];
|
|
90
|
+
const commitsAhead = (branch: string) => {
|
|
91
|
+
if (branch === "milestone/M001") throw new Error("rev-walk failed");
|
|
92
|
+
return 5;
|
|
93
|
+
};
|
|
94
|
+
const result = _selectResumableMilestone(branches, new Set(), ALL_COMPLETE, commitsAhead);
|
|
95
|
+
assert.equal(result, "M002");
|
|
96
|
+
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import test from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
3
|
|
|
6
4
|
import {
|
|
7
5
|
clearSessionModelOverride,
|
|
@@ -9,8 +7,6 @@ import {
|
|
|
9
7
|
setSessionModelOverride,
|
|
10
8
|
} from "../session-model-override.js";
|
|
11
9
|
|
|
12
|
-
const phasesSource = readFileSync(join(import.meta.dirname, "..", "auto", "phases.ts"), "utf-8");
|
|
13
|
-
|
|
14
10
|
test("setSessionModelOverride stores provider/model for the session", () => {
|
|
15
11
|
const sessionId = `session-override-${Date.now()}`;
|
|
16
12
|
setSessionModelOverride(sessionId, { provider: "openai-codex", id: "gpt-5.4" });
|
|
@@ -27,9 +23,18 @@ test("clearSessionModelOverride removes the session override", () => {
|
|
|
27
23
|
assert.equal(getSessionModelOverride(sessionId), undefined);
|
|
28
24
|
});
|
|
29
25
|
|
|
30
|
-
test("
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
26
|
+
test("session model overrides are isolated by session id", () => {
|
|
27
|
+
const first = `session-first-${Date.now()}`;
|
|
28
|
+
const second = `session-second-${Date.now()}`;
|
|
29
|
+
setSessionModelOverride(first, { provider: "openai-codex", id: "gpt-5.4" });
|
|
30
|
+
setSessionModelOverride(second, { provider: "anthropic", id: "claude-sonnet-4-6" });
|
|
31
|
+
|
|
32
|
+
assert.deepEqual(getSessionModelOverride(first), {
|
|
33
|
+
provider: "openai-codex",
|
|
34
|
+
id: "gpt-5.4",
|
|
35
|
+
});
|
|
36
|
+
assert.deepEqual(getSessionModelOverride(second), {
|
|
37
|
+
provider: "anthropic",
|
|
38
|
+
id: "claude-sonnet-4-6",
|
|
39
|
+
});
|
|
35
40
|
});
|