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,141 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* auto-start-bootstrap-await-3420.test.ts — Regression test for #3420.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* fire-and-forget call that returns immediately. The LLM discussion runs
|
|
8
|
-
* asynchronously in a separate turn.
|
|
9
|
-
*
|
|
10
|
-
* The bug: after showSmartEntry returns (before the LLM has run), the code
|
|
11
|
-
* immediately calls invalidateAllCaches() + deriveState() + checks postState.
|
|
12
|
-
* Since the discussion hasn't run yet, postState.phase is still "pre-planning"
|
|
13
|
-
* and the context check fails, producing the warning:
|
|
14
|
-
* "Discussion completed but milestone context is still missing. Run /gsd to try again."
|
|
15
|
-
*
|
|
16
|
-
* The discussion never ran — the warning fires immediately.
|
|
17
|
-
*
|
|
18
|
-
* Fix: bootstrapAutoSession must return false (release lock) after showSmartEntry
|
|
19
|
-
* dispatches the workflow. The checkAutoStartAfterDiscuss callback in guided-flow.ts
|
|
20
|
-
* already handles re-entering auto-mode when the discussion completes.
|
|
21
|
-
*
|
|
22
|
-
* This test verifies the fix by asserting that the pre-planning !hasContext block
|
|
23
|
-
* does NOT contain a postState phase check after showSmartEntry — it must
|
|
24
|
-
* return false immediately to let the async dispatch complete.
|
|
4
|
+
* The discussion handoff is asynchronous: bootstrap queues a discuss turn and
|
|
5
|
+
* releases the lock; checkAutoStartAfterDiscuss is responsible for re-entry
|
|
6
|
+
* once artifacts exist.
|
|
25
7
|
*/
|
|
26
8
|
|
|
27
9
|
import test from "node:test";
|
|
28
10
|
import assert from "node:assert/strict";
|
|
29
|
-
import {
|
|
11
|
+
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
30
12
|
import { join } from "node:path";
|
|
13
|
+
import { tmpdir } from "node:os";
|
|
31
14
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// This block dispatches showSmartEntry which is async (fire-and-forget via pi.sendMessage).
|
|
38
|
-
// After the dispatch, checking postState.phase immediately is premature — the
|
|
39
|
-
// LLM discussion hasn't run yet. The block should return false instead.
|
|
40
|
-
const prePlanningNoContextBlock = source.match(
|
|
41
|
-
/\/\/ Active milestone exists but has no roadmap\s*\n\s*if\s*\(\s*state\.phase\s*===\s*"pre-planning"\s*\)([\s\S]*?)\/\/ Active milestone has CONTEXT-DRAFT/,
|
|
42
|
-
);
|
|
43
|
-
assert.ok(
|
|
44
|
-
!!prePlanningNoContextBlock,
|
|
45
|
-
"auto-start.ts must have the pre-planning handler block before needs-discussion",
|
|
46
|
-
);
|
|
15
|
+
import {
|
|
16
|
+
checkAutoStartAfterDiscuss,
|
|
17
|
+
clearPendingAutoStart,
|
|
18
|
+
setPendingAutoStart,
|
|
19
|
+
} from "../guided-flow.ts";
|
|
47
20
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// The block must call showSmartEntry when !hasContext
|
|
51
|
-
assert.ok(
|
|
52
|
-
block.includes("showSmartEntry"),
|
|
53
|
-
"pre-planning !hasContext block must call showSmartEntry to dispatch the discuss workflow",
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
// FAILING ASSERTION (before fix): after showSmartEntry, the block must NOT
|
|
57
|
-
// immediately check postState.phase — that check fires before the LLM runs.
|
|
58
|
-
// Instead, it must return false (release lock) so the async dispatch can complete.
|
|
59
|
-
// The warning "Discussion completed but milestone context is still missing"
|
|
60
|
-
// fires prematurely when this postState check exists.
|
|
61
|
-
assert.ok(
|
|
62
|
-
!block.includes("Discussion completed but milestone context is still missing"),
|
|
63
|
-
"pre-planning !hasContext block must NOT check postState.phase immediately after showSmartEntry — " +
|
|
64
|
-
"the dispatch is async (pi.sendMessage is fire-and-forget) and the discussion hasn't run yet; " +
|
|
65
|
-
"return false instead so checkAutoStartAfterDiscuss can re-enter auto-mode after discussion completes (#3420)",
|
|
66
|
-
);
|
|
21
|
+
test.afterEach(() => {
|
|
22
|
+
clearPendingAutoStart();
|
|
67
23
|
});
|
|
68
24
|
|
|
69
|
-
test("
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
assert.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Specifically, the "no milestone context was written" warning fires too early.
|
|
90
|
-
assert.ok(
|
|
91
|
-
!block.includes("Discussion completed but no milestone context was written"),
|
|
92
|
-
"complete/no-milestone block must NOT check postState.phase immediately after showSmartEntry dispatch — " +
|
|
93
|
-
"return false instead so the async LLM turn can complete (#3420)",
|
|
94
|
-
);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test("bootstrapAutoSession: showSmartEntry in pre-planning path is followed by releaseLockAndReturn, not postState check (#3420)", () => {
|
|
98
|
-
// After the fix, the pre-planning !hasContext branch should call showSmartEntry
|
|
99
|
-
// and then immediately return releaseLockAndReturn() — not check postState.
|
|
100
|
-
const prePlanningNoContextBlock = source.match(
|
|
101
|
-
/\/\/ Active milestone exists but has no roadmap\s*\n\s*if\s*\(\s*state\.phase\s*===\s*"pre-planning"\s*\)([\s\S]*?)\/\/ Active milestone has CONTEXT-DRAFT/,
|
|
102
|
-
);
|
|
103
|
-
assert.ok(!!prePlanningNoContextBlock, "pre-planning handler block found");
|
|
104
|
-
|
|
105
|
-
const block = prePlanningNoContextBlock![1];
|
|
106
|
-
|
|
107
|
-
// After the fix, the !hasContext branch ends with releaseLockAndReturn
|
|
108
|
-
assert.ok(
|
|
109
|
-
block.includes("releaseLockAndReturn"),
|
|
110
|
-
"pre-planning !hasContext block must call releaseLockAndReturn() after showSmartEntry dispatch (#3420)",
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
// The showSmartEntry call must appear before releaseLockAndReturn
|
|
114
|
-
const showSmartEntryIdx = block.indexOf("showSmartEntry");
|
|
115
|
-
const releaseLockIdx = block.indexOf("releaseLockAndReturn");
|
|
116
|
-
assert.ok(
|
|
117
|
-
showSmartEntryIdx > -1 && releaseLockIdx > -1,
|
|
118
|
-
"both showSmartEntry and releaseLockAndReturn must appear in the block",
|
|
119
|
-
);
|
|
120
|
-
assert.ok(
|
|
121
|
-
showSmartEntryIdx < releaseLockIdx,
|
|
122
|
-
"showSmartEntry must appear before releaseLockAndReturn in pre-planning !hasContext block",
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
// There must be NO invalidateAllCaches between showSmartEntry and releaseLockAndReturn
|
|
126
|
-
// (invalidateAllCaches + deriveState after showSmartEntry is the buggy premature check)
|
|
127
|
-
const afterShowSmartEntry = block.substring(showSmartEntryIdx);
|
|
128
|
-
const cacheInvalidateIdx = afterShowSmartEntry.indexOf("invalidateAllCaches");
|
|
129
|
-
const releaseFromShowIdx = afterShowSmartEntry.indexOf("releaseLockAndReturn");
|
|
130
|
-
|
|
131
|
-
// If invalidateAllCaches appears, it must appear AFTER releaseLockAndReturn
|
|
132
|
-
// (which is impossible since releaseLockAndReturn returns) — so invalidateAllCaches
|
|
133
|
-
// must not appear at all between showSmartEntry and the end of the !hasContext block.
|
|
134
|
-
if (cacheInvalidateIdx !== -1) {
|
|
135
|
-
assert.ok(
|
|
136
|
-
cacheInvalidateIdx > releaseFromShowIdx,
|
|
137
|
-
"invalidateAllCaches must NOT appear between showSmartEntry and releaseLockAndReturn — " +
|
|
138
|
-
"this is the premature postState check that causes #3420",
|
|
139
|
-
);
|
|
140
|
-
}
|
|
25
|
+
test("checkAutoStartAfterDiscuss waits until discussion artifacts exist before re-entering auto-mode", (t) => {
|
|
26
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-bootstrap-await-"));
|
|
27
|
+
const notifications: string[] = [];
|
|
28
|
+
t.after(() => rmSync(base, { recursive: true, force: true }));
|
|
29
|
+
mkdirSync(join(base, ".gsd", "milestones", "M001"), { recursive: true });
|
|
30
|
+
setPendingAutoStart(base, {
|
|
31
|
+
basePath: base,
|
|
32
|
+
milestoneId: "M001",
|
|
33
|
+
ctx: { ui: { notify: (message: string) => notifications.push(message) } } as any,
|
|
34
|
+
pi: { sendMessage: () => {} } as any,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
assert.equal(checkAutoStartAfterDiscuss(), false);
|
|
38
|
+
assert.deepEqual(notifications, []);
|
|
39
|
+
|
|
40
|
+
writeFileSync(join(base, ".gsd", "milestones", "M001", "M001-CONTEXT.md"), "# Context\n", "utf-8");
|
|
41
|
+
writeFileSync(join(base, ".gsd", "STATE.md"), "# State\n", "utf-8");
|
|
42
|
+
|
|
43
|
+
assert.equal(checkAutoStartAfterDiscuss(), true);
|
|
44
|
+
assert.deepEqual(notifications, ["Milestone M001 ready."]);
|
|
141
45
|
});
|
|
@@ -1,72 +1,38 @@
|
|
|
1
1
|
// GSD-2 auto-start regression test: cleanStaleRuntimeUnits is DB-gated (#4663)
|
|
2
|
-
//
|
|
3
|
-
// Source-level structural check that the stale-runtime-cleanup predicate in
|
|
4
|
-
// auto-start.ts consults DB status when available instead of treating a
|
|
5
|
-
// SUMMARY-file on disk as proof of milestone completion. Pairs with #4658 /
|
|
6
|
-
// PR #4660 fix in auto-dispatch + auto-recovery.
|
|
7
2
|
|
|
8
3
|
import { describe, test } from "node:test";
|
|
9
4
|
import assert from "node:assert/strict";
|
|
10
|
-
import { existsSync, mkdirSync,
|
|
11
|
-
import { join
|
|
12
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { join } from "node:path";
|
|
13
7
|
import { tmpdir } from "node:os";
|
|
14
8
|
import { randomUUID } from "node:crypto";
|
|
15
9
|
import { cleanStaleRuntimeUnits } from "../auto-worktree.ts";
|
|
16
|
-
import { extractSourceRegion } from "./test-helpers.ts";
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
function makeBase(): string {
|
|
12
|
+
return join(tmpdir(), `gsd-clean-runtime-${randomUUID()}`);
|
|
13
|
+
}
|
|
20
14
|
|
|
21
15
|
describe("auto-start cleanStaleRuntimeUnits DB gating (#4663)", () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test("cleanStaleRuntimeUnits is called after openProjectDbIfPresent", () => {
|
|
32
|
-
const openDbIdx = source.indexOf("await openProjectDbIfPresent(base)");
|
|
33
|
-
assert.ok(openDbIdx > -1, "openProjectDbIfPresent should be called in auto-start");
|
|
34
|
-
const cleanIdx = source.indexOf("cleanStaleRuntimeUnits(", openDbIdx);
|
|
35
|
-
assert.ok(
|
|
36
|
-
cleanIdx > -1,
|
|
37
|
-
"cleanStaleRuntimeUnits must run AFTER openProjectDbIfPresent so predicate can consult DB",
|
|
38
|
-
);
|
|
39
|
-
});
|
|
16
|
+
test("predicate controls whether milestone runtime units are removed", () => {
|
|
17
|
+
const base = makeBase();
|
|
18
|
+
const unitsDir = join(base, ".gsd", "runtime", "units");
|
|
19
|
+
try {
|
|
20
|
+
mkdirSync(unitsDir, { recursive: true });
|
|
21
|
+
const unitFile = join(unitsDir, "execute-task-M001-S01-T01.json");
|
|
22
|
+
writeFileSync(unitFile, "{}\n", "utf-8");
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
assert.ok(cleanIdx > -1);
|
|
44
|
-
const snippet = extractSourceRegion(source, "cleanStaleRuntimeUnits(");
|
|
45
|
-
assert.match(
|
|
46
|
-
snippet,
|
|
47
|
-
/isDbAvailable\(\)/,
|
|
48
|
-
"predicate must branch on DB availability",
|
|
49
|
-
);
|
|
50
|
-
assert.match(
|
|
51
|
-
snippet,
|
|
52
|
-
/isClosedStatus\(/,
|
|
53
|
-
"predicate must check DB status via isClosedStatus",
|
|
54
|
-
);
|
|
55
|
-
});
|
|
24
|
+
assert.equal(cleanStaleRuntimeUnits(join(base, ".gsd"), () => false), 0);
|
|
25
|
+
assert.equal(existsSync(unitFile), true);
|
|
56
26
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
snippet,
|
|
63
|
-
/resolveMilestoneFile\(base,\s*mid,\s*["']SUMMARY["']\)/,
|
|
64
|
-
"legacy FS-fallback branch should still use SUMMARY file presence",
|
|
65
|
-
);
|
|
27
|
+
assert.equal(cleanStaleRuntimeUnits(join(base, ".gsd"), (mid) => mid === "M001"), 1);
|
|
28
|
+
assert.equal(existsSync(unitFile), false);
|
|
29
|
+
} finally {
|
|
30
|
+
rmSync(base, { recursive: true, force: true });
|
|
31
|
+
}
|
|
66
32
|
});
|
|
67
33
|
|
|
68
34
|
test("cleanStaleRuntimeUnits removes legacy pseudo deep-setup runtime files", () => {
|
|
69
|
-
const base =
|
|
35
|
+
const base = makeBase();
|
|
70
36
|
const gsdRoot = join(base, ".gsd");
|
|
71
37
|
const unitsDir = join(gsdRoot, "runtime", "units");
|
|
72
38
|
try {
|
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, mkdirSync, realpathSync, rmSync } from "node:fs";
|
|
2
4
|
import { join } from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
3
6
|
|
|
4
|
-
import {
|
|
7
|
+
import { openProjectDbIfPresent } from "../auto-start.ts";
|
|
8
|
+
import { closeDatabase, isDbAvailable, openDatabase } from "../gsd-db.ts";
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
test.afterEach(() => {
|
|
11
|
+
if (isDbAvailable()) closeDatabase();
|
|
12
|
+
});
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
const
|
|
14
|
+
test("#2841: cold DB bootstrap opens an existing project database before state derivation", async (t) => {
|
|
15
|
+
const base = realpathSync(mkdtempSync(join(tmpdir(), "gsd-cold-db-")));
|
|
16
|
+
t.after(() => rmSync(base, { recursive: true, force: true }));
|
|
17
|
+
mkdirSync(join(base, ".gsd"), { recursive: true });
|
|
18
|
+
const dbPath = join(base, ".gsd", "gsd.db");
|
|
10
19
|
|
|
11
|
-
|
|
20
|
+
assert.equal(openDatabase(dbPath), true);
|
|
21
|
+
closeDatabase();
|
|
22
|
+
assert.equal(isDbAvailable(), false);
|
|
12
23
|
|
|
13
|
-
|
|
14
|
-
assertTrue(helperIdx >= 0, "auto-start.ts defines a helper for pre-derive DB open (#2841)");
|
|
24
|
+
await openProjectDbIfPresent(base);
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
helperRegion.includes("resolveProjectRootDbPath(basePath)"),
|
|
19
|
-
"pre-derive DB helper resolves the project-root DB path (#2841)",
|
|
20
|
-
);
|
|
21
|
-
assertTrue(
|
|
22
|
-
helperRegion.includes("openDatabase(gsdDbPath)"),
|
|
23
|
-
"pre-derive DB helper opens the resolved DB path (#2841)",
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const firstDeriveIdx = src.indexOf("let state = await deriveState(base);");
|
|
27
|
-
assertTrue(firstDeriveIdx > 0, "auto-start.ts has the initial deriveState(base) call");
|
|
28
|
-
|
|
29
|
-
const preDeriveRegion = firstDeriveIdx > 0 ? src.slice(0, firstDeriveIdx) : "";
|
|
30
|
-
const preDeriveOpenIdx = preDeriveRegion.lastIndexOf("await openProjectDbIfPresent(base);");
|
|
31
|
-
|
|
32
|
-
assertTrue(
|
|
33
|
-
preDeriveOpenIdx > 0,
|
|
34
|
-
"bootstrapAutoSession opens the DB before the first deriveState(base) call (#2841)",
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
report();
|
|
26
|
+
assert.equal(isDbAvailable(), true);
|
|
27
|
+
});
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import test from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import {
|
|
3
|
+
import { existsSync, mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
const source = readFileSync(sourcePath, "utf-8");
|
|
7
|
+
import { hasGitIndexLockForTest } from "../auto-start.ts";
|
|
8
8
|
|
|
9
|
-
test("bootstrapAutoSession
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
9
|
+
test("bootstrapAutoSession detects .git/index.lock without deleting it", (t) => {
|
|
10
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-index-lock-"));
|
|
11
|
+
t.after(() => rmSync(base, { recursive: true, force: true }));
|
|
12
|
+
const lockPath = join(base, ".git", "index.lock");
|
|
13
|
+
mkdirSync(join(base, ".git"), { recursive: true });
|
|
14
|
+
writeFileSync(lockPath, "locked\n", "utf-8");
|
|
14
15
|
|
|
15
|
-
assert.
|
|
16
|
-
assert.
|
|
17
|
-
assert.ok(addIdx > -1, "bootstrap still stages bootstrap files when safe");
|
|
18
|
-
assert.ok(commitIdx > -1, "bootstrap still commits bootstrap files when safe");
|
|
19
|
-
|
|
20
|
-
assert.ok(preflightIdx < initIdx, "index.lock preflight must run before git init");
|
|
21
|
-
assert.ok(preflightIdx < addIdx, "index.lock preflight must run before git add");
|
|
22
|
-
assert.ok(preflightIdx < commitIdx, "index.lock preflight must run before git commit");
|
|
16
|
+
assert.equal(hasGitIndexLockForTest(base), true);
|
|
17
|
+
assert.equal(existsSync(lockPath), true);
|
|
23
18
|
});
|
|
24
19
|
|
|
25
|
-
test("bootstrapAutoSession
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
assert.
|
|
31
|
-
!source.includes("STALE_GIT_LOCK_THRESHOLD_MS"),
|
|
32
|
-
"bootstrap must not use lock age as a deletion heuristic",
|
|
33
|
-
);
|
|
34
|
-
assert.ok(
|
|
35
|
-
source.includes("return releaseLockAndReturn();"),
|
|
36
|
-
"bootstrap must abort and release the session lock when the git index is locked",
|
|
37
|
-
);
|
|
20
|
+
test("bootstrapAutoSession reports no index lock when the lock file is absent", (t) => {
|
|
21
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-index-lock-missing-"));
|
|
22
|
+
t.after(() => rmSync(base, { recursive: true, force: true }));
|
|
23
|
+
mkdirSync(join(base, ".git"), { recursive: true });
|
|
24
|
+
|
|
25
|
+
assert.equal(hasGitIndexLockForTest(base), false);
|
|
38
26
|
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Bootstrap behavior tests for completed milestone orphan merges.
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import assert from "node:assert/strict";
|
|
5
|
+
import { execFileSync } from "node:child_process";
|
|
6
|
+
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { tmpdir } from "node:os";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
|
|
10
|
+
import { bootstrapAutoSession } from "../auto-start.ts";
|
|
11
|
+
import { AutoSession } from "../auto/session.ts";
|
|
12
|
+
import {
|
|
13
|
+
closeDatabase,
|
|
14
|
+
insertMilestone,
|
|
15
|
+
openDatabase,
|
|
16
|
+
} from "../gsd-db.ts";
|
|
17
|
+
|
|
18
|
+
function runGit(base: string, args: string[]): string {
|
|
19
|
+
return execFileSync("git", args, {
|
|
20
|
+
cwd: base,
|
|
21
|
+
encoding: "utf-8",
|
|
22
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
23
|
+
}).trim();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function makeRepoWithUnmergedCompletedMilestone(): string {
|
|
27
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-orphan-bootstrap-"));
|
|
28
|
+
mkdirSync(join(base, ".gsd", "milestones"), { recursive: true });
|
|
29
|
+
writeFileSync(
|
|
30
|
+
join(base, ".gsd", "PREFERENCES.md"),
|
|
31
|
+
"---\ngit:\n isolation: \"branch\"\n---\n",
|
|
32
|
+
);
|
|
33
|
+
runGit(base, ["init"]);
|
|
34
|
+
runGit(base, ["config", "user.email", "test@test.com"]);
|
|
35
|
+
runGit(base, ["config", "user.name", "Test"]);
|
|
36
|
+
writeFileSync(join(base, "README.md"), "# test\n");
|
|
37
|
+
runGit(base, ["add", "-A"]);
|
|
38
|
+
runGit(base, ["commit", "-m", "init"]);
|
|
39
|
+
runGit(base, ["branch", "-M", "main"]);
|
|
40
|
+
|
|
41
|
+
runGit(base, ["checkout", "-b", "milestone/M002"]);
|
|
42
|
+
writeFileSync(join(base, "m002.txt"), "complete but unmerged\n");
|
|
43
|
+
runGit(base, ["add", "-A"]);
|
|
44
|
+
runGit(base, ["commit", "-m", "feat: M002 work"]);
|
|
45
|
+
runGit(base, ["checkout", "main"]);
|
|
46
|
+
|
|
47
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
48
|
+
insertMilestone({ id: "M002", title: "Completed milestone", status: "complete" });
|
|
49
|
+
insertMilestone({ id: "M003", title: "Next milestone", status: "active" });
|
|
50
|
+
closeDatabase();
|
|
51
|
+
|
|
52
|
+
return base;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function makeCtx(notifications: Array<{ message: string; level?: string }>) {
|
|
56
|
+
const model = { provider: "claude-code", id: "claude-sonnet-4-6", contextWindow: 128000 };
|
|
57
|
+
return {
|
|
58
|
+
ui: {
|
|
59
|
+
notify: (message: string, level?: string) => {
|
|
60
|
+
notifications.push({ message, level });
|
|
61
|
+
},
|
|
62
|
+
setStatus: () => {},
|
|
63
|
+
setWidget: () => {},
|
|
64
|
+
},
|
|
65
|
+
model,
|
|
66
|
+
modelRegistry: {
|
|
67
|
+
getAvailable: () => [model],
|
|
68
|
+
isProviderRequestReady: () => true,
|
|
69
|
+
getProviderAuthMode: () => "oauth",
|
|
70
|
+
},
|
|
71
|
+
sessionManager: {
|
|
72
|
+
getSessionId: () => "orphan-bootstrap-test",
|
|
73
|
+
getSessionFile: () => null,
|
|
74
|
+
getEntries: () => [],
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
test("bootstrap aborts before starting next milestone when completed orphan merge fails", async () => {
|
|
80
|
+
const base = makeRepoWithUnmergedCompletedMilestone();
|
|
81
|
+
const previousCwd = process.cwd();
|
|
82
|
+
const s = new AutoSession();
|
|
83
|
+
const mergeCalls: string[] = [];
|
|
84
|
+
const notifications: Array<{ message: string; level?: string }> = [];
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
const ready = await bootstrapAutoSession(
|
|
88
|
+
s,
|
|
89
|
+
makeCtx(notifications) as any,
|
|
90
|
+
{
|
|
91
|
+
getThinkingLevel: () => "medium",
|
|
92
|
+
getActiveTools: () => [],
|
|
93
|
+
events: { emit: () => {} },
|
|
94
|
+
} as any,
|
|
95
|
+
base,
|
|
96
|
+
false,
|
|
97
|
+
false,
|
|
98
|
+
{
|
|
99
|
+
shouldUseWorktreeIsolation: () => true,
|
|
100
|
+
registerSigtermHandler: () => {},
|
|
101
|
+
lockBase: () => base,
|
|
102
|
+
buildResolver: () => ({
|
|
103
|
+
mergeAndExit: (milestoneId: string) => {
|
|
104
|
+
mergeCalls.push(milestoneId);
|
|
105
|
+
throw new Error("synthetic merge failure");
|
|
106
|
+
},
|
|
107
|
+
}) as any,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
classification: "none",
|
|
111
|
+
lock: null,
|
|
112
|
+
pausedSession: null,
|
|
113
|
+
state: null,
|
|
114
|
+
recovery: null,
|
|
115
|
+
recoveryPrompt: null,
|
|
116
|
+
recoveryToolCallCount: 0,
|
|
117
|
+
artifactSatisfied: false,
|
|
118
|
+
hasResumableDiskState: false,
|
|
119
|
+
isBootstrapCrash: false,
|
|
120
|
+
},
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
assert.equal(ready, false);
|
|
124
|
+
assert.deepEqual(mergeCalls, ["M002"]);
|
|
125
|
+
assert.equal(s.active, false);
|
|
126
|
+
assert.match(
|
|
127
|
+
notifications.map((entry) => entry.message).join("\n"),
|
|
128
|
+
/Could not merge orphan milestone M002: synthetic merge failure/,
|
|
129
|
+
);
|
|
130
|
+
} finally {
|
|
131
|
+
try {
|
|
132
|
+
closeDatabase();
|
|
133
|
+
} catch {}
|
|
134
|
+
process.chdir(previousCwd);
|
|
135
|
+
rmSync(base, { recursive: true, force: true });
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
@@ -1,50 +1,32 @@
|
|
|
1
|
-
// GSD2 — Verify autoStartTime is
|
|
2
|
-
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* auto-start-time-persistence.test.ts — Ensures autoStartTime survives
|
|
6
|
-
* cross-session resume via paused-session.json (#3585).
|
|
7
|
-
*
|
|
8
|
-
* Source-code regression guards: verify auto.ts saves and restores
|
|
9
|
-
* autoStartTime so the elapsed timer doesn't vanish after /exit + resume.
|
|
10
|
-
*/
|
|
1
|
+
// GSD2 — Verify autoStartTime is carried through dashboard state
|
|
11
2
|
|
|
12
3
|
import test from "node:test";
|
|
13
4
|
import assert from "node:assert/strict";
|
|
14
|
-
import { readFileSync } from "node:fs";
|
|
15
|
-
import { join, dirname } from "node:path";
|
|
16
|
-
import { fileURLToPath } from "node:url";
|
|
17
|
-
|
|
18
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
const AUTO_TS_PATH = join(__dirname, "..", "auto.ts");
|
|
20
5
|
|
|
21
|
-
|
|
6
|
+
import { getAutoDashboardData } from "../auto.ts";
|
|
7
|
+
import { autoSession } from "../auto-runtime-state.ts";
|
|
22
8
|
|
|
23
|
-
test
|
|
24
|
-
|
|
25
|
-
source.includes("autoStartTime: s.autoStartTime"),
|
|
26
|
-
"pausedMeta must include autoStartTime so the timer survives /exit",
|
|
27
|
-
);
|
|
9
|
+
test.afterEach(() => {
|
|
10
|
+
autoSession.reset();
|
|
28
11
|
});
|
|
29
12
|
|
|
30
|
-
test("
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"both resume paths (custom workflow + milestone) must restore autoStartTime from meta",
|
|
35
|
-
);
|
|
36
|
-
});
|
|
13
|
+
test("getAutoDashboardData exposes the active autoStartTime (#3585)", () => {
|
|
14
|
+
const start = Date.now() - 5_000;
|
|
15
|
+
autoSession.active = true;
|
|
16
|
+
autoSession.autoStartTime = start;
|
|
37
17
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
);
|
|
18
|
+
const data = getAutoDashboardData();
|
|
19
|
+
|
|
20
|
+
assert.equal(data.startTime, start);
|
|
21
|
+
assert.ok(data.elapsed >= 0);
|
|
43
22
|
});
|
|
44
23
|
|
|
45
|
-
test("
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
24
|
+
test("getAutoDashboardData suppresses elapsed time when autoStartTime is zero (#3585)", () => {
|
|
25
|
+
autoSession.active = true;
|
|
26
|
+
autoSession.autoStartTime = 0;
|
|
27
|
+
|
|
28
|
+
const data = getAutoDashboardData();
|
|
29
|
+
|
|
30
|
+
assert.equal(data.startTime, 0);
|
|
31
|
+
assert.equal(data.elapsed, 0);
|
|
50
32
|
});
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, mkdirSync, realpathSync, rmSync } from "node:fs";
|
|
2
4
|
import { join } from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
3
6
|
|
|
4
|
-
import {
|
|
7
|
+
import { resolveProjectRootDbPath } from "../bootstrap/dynamic-tools.ts";
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
test("#3822: worktree bootstrap resolves the project-root DB path", (t) => {
|
|
10
|
+
const project = realpathSync(mkdtempSync(join(tmpdir(), "gsd-project-db-")));
|
|
11
|
+
t.after(() => rmSync(project, { recursive: true, force: true }));
|
|
12
|
+
const worktree = join(project, ".gsd", "worktrees", "M001");
|
|
13
|
+
mkdirSync(worktree, { recursive: true });
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const dbLifecycleIdx = src.indexOf("// ── DB lifecycle ──");
|
|
14
|
-
assertTrue(dbLifecycleIdx > 0, "auto-start.ts has a DB lifecycle section");
|
|
15
|
-
|
|
16
|
-
const dbLifecycleRegion = dbLifecycleIdx > 0 ? extractSourceRegion(src, "// ── DB lifecycle ──") : "";
|
|
17
|
-
|
|
18
|
-
assertTrue(
|
|
19
|
-
dbLifecycleRegion.includes("const gsdDbPath = resolveProjectRootDbPath(s.basePath);"),
|
|
20
|
-
"DB lifecycle resolves the project-root DB path after worktree entry (#3822)",
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
assertTrue(
|
|
24
|
-
!dbLifecycleRegion.includes('join(s.basePath, ".gsd", "gsd.db")'),
|
|
25
|
-
"DB lifecycle no longer derives gsd.db directly from the worktree path (#3822)",
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
report();
|
|
15
|
+
assert.equal(
|
|
16
|
+
resolveProjectRootDbPath(worktree),
|
|
17
|
+
join(project, ".gsd", "gsd.db"),
|
|
18
|
+
);
|
|
19
|
+
});
|