gsd-pi 2.80.0-dev.96f4d89d5 → 2.80.0-dev.b0acf17e9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- 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/GSD-WORKFLOW.md +2 -2
- 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 +103 -9
- package/dist/resources/extensions/gsd/auto/phases.js +240 -139
- package/dist/resources/extensions/gsd/auto/resolve.js +29 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +22 -30
- package/dist/resources/extensions/gsd/auto/session.js +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 +26 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +103 -86
- package/dist/resources/extensions/gsd/auto-prompts.js +214 -17
- package/dist/resources/extensions/gsd/auto-recovery.js +197 -9
- package/dist/resources/extensions/gsd/auto-start.js +240 -15
- package/dist/resources/extensions/gsd/auto-supervisor.js +8 -1
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +2 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +165 -28
- package/dist/resources/extensions/gsd/auto.js +165 -45
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +99 -10
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +50 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +35 -10
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +36 -20
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +10 -1
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +12 -4
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +11 -3
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +1 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +330 -55
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +82 -23
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +129 -1
- package/dist/resources/extensions/gsd/clean-root-preflight.js +65 -9
- package/dist/resources/extensions/gsd/commands/dispatcher.js +5 -0
- 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-extract-learnings.js +17 -12
- package/dist/resources/extensions/gsd/commands-handlers.js +23 -9
- package/dist/resources/extensions/gsd/context-budget.js +37 -2
- package/dist/resources/extensions/gsd/crash-recovery.js +56 -10
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +92 -0
- package/dist/resources/extensions/gsd/db-base-schema.js +18 -2
- package/dist/resources/extensions/gsd/db-migration-steps.js +22 -0
- package/dist/resources/extensions/gsd/detection.js +106 -0
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +2 -0
- package/dist/resources/extensions/gsd/git-service.js +73 -5
- package/dist/resources/extensions/gsd/gsd-db.js +146 -13
- package/dist/resources/extensions/gsd/guided-flow.js +143 -48
- package/dist/resources/extensions/gsd/init-wizard.js +4 -1
- package/dist/resources/extensions/gsd/memory-store.js +69 -12
- package/dist/resources/extensions/gsd/migrate/command.js +40 -1
- package/dist/resources/extensions/gsd/migration-auto-check.js +87 -0
- package/dist/resources/extensions/gsd/native-git-bridge.js +32 -8
- package/dist/resources/extensions/gsd/orphan-stash-audit.js +101 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +13 -3
- package/dist/resources/extensions/gsd/planning-path-scope.js +26 -0
- package/dist/resources/extensions/gsd/pre-execution-checks.js +22 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +28 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +21 -19
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/execute-task.md +4 -2
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -5
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
- package/dist/resources/extensions/gsd/quick.js +34 -2
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +10 -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-task.js +1 -1
- package/dist/resources/extensions/gsd/tools/context-mode-tool-result.js +15 -0
- package/dist/resources/extensions/gsd/tools/exec-search-tool.js +5 -0
- package/dist/resources/extensions/gsd/tools/exec-tool.js +3 -15
- package/dist/resources/extensions/gsd/tools/memory-tools.js +1 -0
- package/dist/resources/extensions/gsd/tools/plan-slice.js +9 -0
- package/dist/resources/extensions/gsd/tools/plan-task.js +9 -0
- package/dist/resources/extensions/gsd/tools/resume-tool.js +5 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +1 -1
- package/dist/resources/extensions/gsd/unit-context-composer.js +12 -3
- package/dist/resources/extensions/gsd/unit-runtime.js +22 -0
- package/dist/resources/extensions/gsd/workflow-protocol.js +131 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +16 -14
- package/dist/resources/extensions/gsd/worktree-resolver.js +90 -22
- 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 +12 -12
- 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/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 +12 -12
- 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/welcome-screen.d.ts +2 -0
- package/dist/welcome-screen.js +9 -7
- package/package.json +6 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +22 -17
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +75 -2
- package/packages/mcp-server/src/workflow-tools.ts +30 -16
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +4 -1
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +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-abort-order.test.js +32 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +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 +44 -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 +78 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +11 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +9 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js +103 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.js +66 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.js +24 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +8 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +5 -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 +20 -7
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +102 -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 +41 -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/settings-manager.d.ts +20 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +25 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js +22 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +6 -7
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +2 -3
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash-spawn-windows.test.js +22 -56
- package/packages/pi-coding-agent/dist/core/tools/bash-spawn-windows.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.js +12 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.js +14 -6
- package/packages/pi-coding-agent/dist/core/tools/find.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/grep.js +12 -3
- package/packages/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +2 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/ls.js +10 -3
- package/packages/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/read.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/read.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js +7 -62
- package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.js +115 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.d.ts +19 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.js +20 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts +4 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/write.js +9 -1
- package/packages/pi-coding-agent/dist/core/tools/write.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js +6 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +137 -19
- 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/adaptive-layout.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +7 -6
- 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 +18 -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 +225 -16
- 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 +85 -2
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +3 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +36 -27
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +21 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +28 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +3 -2
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +36 -0
- 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 +48 -7
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +91 -0
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +18 -0
- package/packages/pi-coding-agent/src/core/compaction-threshold.test.ts +121 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.test.ts +32 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.ts +66 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +10 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +113 -3
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +24 -6
- package/packages/pi-coding-agent/src/core/extensions/types.ts +44 -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/settings-manager.ts +39 -1
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +28 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +8 -10
- package/packages/pi-coding-agent/src/core/tools/bash-spawn-windows.test.ts +22 -66
- package/packages/pi-coding-agent/src/core/tools/bash.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/edit.ts +13 -1
- package/packages/pi-coding-agent/src/core/tools/find.ts +15 -6
- package/packages/pi-coding-agent/src/core/tools/grep.ts +13 -3
- package/packages/pi-coding-agent/src/core/tools/hashline-read.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/index.ts +8 -0
- package/packages/pi-coding-agent/src/core/tools/ls.ts +11 -3
- package/packages/pi-coding-agent/src/core/tools/read.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/spawn-shell-windows.test.ts +11 -72
- package/packages/pi-coding-agent/src/core/tools/tool-target-metadata.test.ts +127 -0
- package/packages/pi-coding-agent/src/core/tools/tool-target.ts +48 -0
- package/packages/pi-coding-agent/src/core/tools/write.ts +14 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.ts +7 -5
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +185 -19
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +10 -9
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +260 -16
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +75 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +107 -3
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +3 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +36 -27
- package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +25 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +31 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +3 -2
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +18 -8
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/tui.ts +20 -8
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.js +36 -27
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
- package/src/resources/GSD-WORKFLOW.md +2 -2
- 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 +3 -2
- package/src/resources/extensions/gsd/auto/loop.ts +134 -16
- package/src/resources/extensions/gsd/auto/phases.ts +328 -200
- package/src/resources/extensions/gsd/auto/resolve.ts +42 -1
- package/src/resources/extensions/gsd/auto/run-unit.ts +28 -30
- package/src/resources/extensions/gsd/auto/session.ts +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 +33 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +116 -88
- package/src/resources/extensions/gsd/auto-prompts.ts +228 -16
- package/src/resources/extensions/gsd/auto-recovery.ts +207 -7
- package/src/resources/extensions/gsd/auto-start.ts +293 -21
- package/src/resources/extensions/gsd/auto-supervisor.ts +7 -0
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +2 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +199 -30
- package/src/resources/extensions/gsd/auto.ts +216 -40
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +120 -8
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +51 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +35 -10
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +38 -19
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +11 -1
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +13 -4
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +12 -3
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +1 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +386 -55
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +90 -22
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +135 -1
- package/src/resources/extensions/gsd/clean-root-preflight.ts +72 -9
- package/src/resources/extensions/gsd/commands/dispatcher.ts +6 -0
- 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-extract-learnings.ts +17 -12
- package/src/resources/extensions/gsd/commands-handlers.ts +34 -15
- package/src/resources/extensions/gsd/context-budget.ts +44 -2
- package/src/resources/extensions/gsd/crash-recovery.ts +67 -10
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +107 -0
- package/src/resources/extensions/gsd/db-base-schema.ts +19 -2
- package/src/resources/extensions/gsd/db-migration-steps.ts +25 -0
- package/src/resources/extensions/gsd/detection.ts +128 -0
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +3 -0
- package/src/resources/extensions/gsd/git-service.ts +87 -10
- package/src/resources/extensions/gsd/gsd-db.ts +168 -13
- package/src/resources/extensions/gsd/guided-flow.ts +169 -55
- package/src/resources/extensions/gsd/init-wizard.ts +5 -1
- package/src/resources/extensions/gsd/memory-store.ts +77 -12
- package/src/resources/extensions/gsd/migrate/command.ts +47 -1
- package/src/resources/extensions/gsd/migration-auto-check.ts +129 -0
- package/src/resources/extensions/gsd/native-git-bridge.ts +39 -6
- package/src/resources/extensions/gsd/orphan-stash-audit.ts +117 -0
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +13 -3
- package/src/resources/extensions/gsd/planning-path-scope.ts +35 -0
- package/src/resources/extensions/gsd/pre-execution-checks.ts +23 -0
- package/src/resources/extensions/gsd/preferences-types.ts +1 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +27 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +21 -19
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/execute-task.md +4 -2
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/quick-task.md +1 -5
- package/src/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
- package/src/resources/extensions/gsd/quick.ts +37 -2
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +11 -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 +433 -11
- 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 +160 -11
- package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +54 -95
- package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +67 -26
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +184 -2
- 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 +97 -2
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +34 -27
- package/src/resources/extensions/gsd/tests/cmux.test.ts +42 -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/commands-extract-learnings.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +14 -1
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/complete-slice-composer.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/complete-task-normalize-lists.test.ts +29 -33
- package/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts +45 -108
- package/src/resources/extensions/gsd/tests/context-budget.test.ts +10 -1
- package/src/resources/extensions/gsd/tests/context-store.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +90 -31
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +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/db-schema-metadata.test.ts +2 -2
- 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/detection.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/discuss-tool-scoping.test.ts +44 -37
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +58 -40
- package/src/resources/extensions/gsd/tests/dispatch-guard-closed-status.test.ts +25 -15
- package/src/resources/extensions/gsd/tests/dispatch-rule-coverage.test.ts +313 -0
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +35 -17
- package/src/resources/extensions/gsd/tests/error-success-mask.test.ts +16 -21
- package/src/resources/extensions/gsd/tests/est-annotation-timeout.test.ts +15 -82
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +5 -2
- package/src/resources/extensions/gsd/tests/fast-forward-reused-milestone-branch.test.ts +219 -0
- package/src/resources/extensions/gsd/tests/finalize-survivor-branch.test.ts +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/gsd-db.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/has-pending-deep-stage.test.ts +33 -1
- 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 +35 -0
- package/src/resources/extensions/gsd/tests/integration/git-locale.test.ts +31 -20
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/integration/milestone-transition-worktree.test.ts +0 -47
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +60 -202
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +13 -56
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +239 -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-decay-factor.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +21 -35
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-stash-restore.test.ts +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/plan-slice.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +36 -22
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +36 -30
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +45 -5
- package/src/resources/extensions/gsd/tests/preferences-worktree-sync.test.ts +20 -22
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +130 -32
- package/src/resources/extensions/gsd/tests/project-root-cwd-crash.test.ts +18 -36
- package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +35 -73
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +76 -138
- package/src/resources/extensions/gsd/tests/prompt-duplication-cuts.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/prompt-path-audit.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +70 -106
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +59 -161
- package/src/resources/extensions/gsd/tests/query-tools-db-open.test.ts +33 -29
- package/src/resources/extensions/gsd/tests/queue-auto-guard.test.ts +22 -196
- package/src/resources/extensions/gsd/tests/quick-auto-guard.test.ts +23 -93
- package/src/resources/extensions/gsd/tests/quick-external-gsd.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +50 -79
- package/src/resources/extensions/gsd/tests/reassess-default-optin.test.ts +27 -13
- package/src/resources/extensions/gsd/tests/remote-questions.test.ts +151 -251
- package/src/resources/extensions/gsd/tests/resource-loader-import-path.test.ts +41 -29
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +58 -69
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +32 -164
- package/src/resources/extensions/gsd/tests/right-sized-workflow-prompts.test.ts +192 -0
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +57 -41
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/schema-v27-v28-sequence.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/select-resumable-milestone.test.ts +96 -0
- package/src/resources/extensions/gsd/tests/session-model-override.test.ts +14 -9
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +166 -0
- package/src/resources/extensions/gsd/tests/show-config-command.test.ts +44 -42
- package/src/resources/extensions/gsd/tests/signal-handlers.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/skip-slice-state-rebuild.test.ts +56 -24
- package/src/resources/extensions/gsd/tests/skipped-validation-db-atomicity.test.ts +51 -11
- package/src/resources/extensions/gsd/tests/slice-cadence.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +66 -50
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +68 -107
- package/src/resources/extensions/gsd/tests/slice-sequence-insert.test.ts +115 -42
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +21 -59
- package/src/resources/extensions/gsd/tests/smart-entry-draft.test.ts +25 -116
- package/src/resources/extensions/gsd/tests/sqlite-unavailable-gate.test.ts +21 -57
- package/src/resources/extensions/gsd/tests/stale-dirlistcache-4648.test.ts +29 -76
- package/src/resources/extensions/gsd/tests/stale-lockfile-recovery.test.ts +33 -24
- package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +39 -30
- package/src/resources/extensions/gsd/tests/stalled-tool-recovery.test.ts +49 -1
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +101 -2
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +35 -40
- package/src/resources/extensions/gsd/tests/stop-auto-merge-back.test.ts +36 -45
- 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-composer.test.ts +136 -4
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +8 -25
- package/src/resources/extensions/gsd/tests/unit-dispatches.test.ts +80 -1
- package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +5 -99
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +43 -36
- package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +84 -444
- package/src/resources/extensions/gsd/tests/workflow-dispatch-claim.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +44 -189
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -57
- package/src/resources/extensions/gsd/tests/workflow-protocol-excerpt.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/workflow-worker-heartbeat.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/worktree-db-same-file.test.ts +21 -44
- package/src/resources/extensions/gsd/tests/worktree-expected-warnings.test.ts +27 -26
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +38 -6
- 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-manager.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +9 -2
- 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 +203 -4
- package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +19 -13
- package/src/resources/extensions/gsd/tools/complete-task.ts +1 -1
- package/src/resources/extensions/gsd/tools/context-mode-tool-result.ts +25 -0
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +7 -7
- package/src/resources/extensions/gsd/tools/exec-tool.ts +4 -23
- package/src/resources/extensions/gsd/tools/memory-tools.ts +1 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -0
- package/src/resources/extensions/gsd/tools/plan-task.ts +10 -0
- package/src/resources/extensions/gsd/tools/resume-tool.ts +7 -7
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-composer.ts +19 -4
- package/src/resources/extensions/gsd/unit-runtime.ts +25 -0
- package/src/resources/extensions/gsd/workflow-protocol.ts +160 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +15 -4
- package/src/resources/extensions/gsd/worktree-resolver.ts +119 -20
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +86 -40
- package/dist/web/standalone/.next/static/chunks/8336.631939fb583761fa.js +0 -10
- /package/dist/web/standalone/.next/static/{y7d--cnc6Cibuva-Lzzw_ → naNyn5ToUBzCQtuLbEYXC}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{y7d--cnc6Cibuva-Lzzw_ → naNyn5ToUBzCQtuLbEYXC}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: WorktreeResolver unit and regression tests.
|
|
1
3
|
import test from "node:test";
|
|
2
4
|
import assert from "node:assert/strict";
|
|
3
5
|
import { mkdtempSync, rmSync, mkdirSync, realpathSync } from "node:fs";
|
|
@@ -9,6 +11,17 @@ import {
|
|
|
9
11
|
type NotifyCtx,
|
|
10
12
|
} from "../worktree-resolver.js";
|
|
11
13
|
import { AutoSession } from "../auto/session.js";
|
|
14
|
+
import {
|
|
15
|
+
closeDatabase,
|
|
16
|
+
insertMilestone,
|
|
17
|
+
openDatabase,
|
|
18
|
+
} from "../gsd-db.js";
|
|
19
|
+
import { registerAutoWorker } from "../db/auto-workers.js";
|
|
20
|
+
import {
|
|
21
|
+
claimMilestoneLease,
|
|
22
|
+
getMilestoneLease,
|
|
23
|
+
releaseMilestoneLease,
|
|
24
|
+
} from "../db/milestone-leases.js";
|
|
12
25
|
|
|
13
26
|
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
14
27
|
|
|
@@ -19,11 +32,12 @@ interface CallLog {
|
|
|
19
32
|
}
|
|
20
33
|
|
|
21
34
|
function makeSession(
|
|
22
|
-
overrides?: Partial<
|
|
35
|
+
overrides?: Partial<AutoSession>,
|
|
23
36
|
): AutoSession {
|
|
24
37
|
const s = new AutoSession();
|
|
25
38
|
s.basePath = overrides?.basePath ?? "/project";
|
|
26
39
|
s.originalBasePath = overrides?.originalBasePath ?? "/project";
|
|
40
|
+
Object.assign(s, overrides);
|
|
27
41
|
return s;
|
|
28
42
|
}
|
|
29
43
|
|
|
@@ -104,6 +118,9 @@ function makeDeps(
|
|
|
104
118
|
calls.push({ fn: "getCurrentBranch", args: [basePath] });
|
|
105
119
|
return "main";
|
|
106
120
|
},
|
|
121
|
+
checkoutBranch: (basePath: string, branch: string) => {
|
|
122
|
+
calls.push({ fn: "checkoutBranch", args: [basePath, branch] });
|
|
123
|
+
},
|
|
107
124
|
autoWorktreeBranch: (milestoneId: string) => {
|
|
108
125
|
calls.push({ fn: "autoWorktreeBranch", args: [milestoneId] });
|
|
109
126
|
return `milestone/${milestoneId}`;
|
|
@@ -182,6 +199,17 @@ function findCalls(calls: CallLog[], fn: string): CallLog[] {
|
|
|
182
199
|
return calls.filter((c) => c.fn === fn);
|
|
183
200
|
}
|
|
184
201
|
|
|
202
|
+
function makeDbBase(): string {
|
|
203
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-worktree-resolver-"));
|
|
204
|
+
mkdirSync(join(base, ".gsd"), { recursive: true });
|
|
205
|
+
return base;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function cleanupDbBase(base: string): void {
|
|
209
|
+
try { closeDatabase(); } catch { /* noop */ }
|
|
210
|
+
try { rmSync(base, { recursive: true, force: true }); } catch { /* noop */ }
|
|
211
|
+
}
|
|
212
|
+
|
|
185
213
|
// ─── Getter Tests ────────────────────────────────────────────────────────────
|
|
186
214
|
|
|
187
215
|
test("workPath returns s.basePath", () => {
|
|
@@ -371,6 +399,43 @@ test("enterMilestone does not create double-nested worktree when originalBasePat
|
|
|
371
399
|
);
|
|
372
400
|
});
|
|
373
401
|
|
|
402
|
+
test("enterMilestone reacquires a released same-milestone lease before worktree entry", (t) => {
|
|
403
|
+
const base = makeDbBase();
|
|
404
|
+
t.after(() => cleanupDbBase(base));
|
|
405
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
406
|
+
insertMilestone({ id: "M001", title: "Test milestone", status: "active" });
|
|
407
|
+
|
|
408
|
+
const workerId = registerAutoWorker({ projectRootRealpath: base });
|
|
409
|
+
const originalClaim = claimMilestoneLease(workerId, "M001");
|
|
410
|
+
assert.equal(originalClaim.ok, true);
|
|
411
|
+
if (!originalClaim.ok) throw new Error("expected test lease claim");
|
|
412
|
+
assert.equal(releaseMilestoneLease(workerId, "M001", originalClaim.token), true);
|
|
413
|
+
|
|
414
|
+
const s = makeSession({
|
|
415
|
+
basePath: base,
|
|
416
|
+
originalBasePath: base,
|
|
417
|
+
workerId,
|
|
418
|
+
currentMilestoneId: "M001",
|
|
419
|
+
milestoneLeaseToken: originalClaim.token,
|
|
420
|
+
});
|
|
421
|
+
const deps = makeDeps({
|
|
422
|
+
createAutoWorktree: (basePath: string, milestoneId: string) => join(basePath, ".gsd", "worktrees", milestoneId),
|
|
423
|
+
});
|
|
424
|
+
const ctx = makeNotifyCtx();
|
|
425
|
+
const resolver = new WorktreeResolver(s, deps);
|
|
426
|
+
|
|
427
|
+
resolver.enterMilestone("M001", ctx);
|
|
428
|
+
|
|
429
|
+
const row = getMilestoneLease("M001");
|
|
430
|
+
assert.ok(row);
|
|
431
|
+
assert.equal(row.worker_id, workerId);
|
|
432
|
+
assert.equal(row.status, "held");
|
|
433
|
+
assert.equal(row.fencing_token, originalClaim.token + 1);
|
|
434
|
+
assert.equal(s.milestoneLeaseToken, originalClaim.token + 1);
|
|
435
|
+
assert.equal(s.basePath, join(base, ".gsd", "worktrees", "M001"));
|
|
436
|
+
assert.equal(ctx.messages.some((m) => m.level === "error"), false);
|
|
437
|
+
});
|
|
438
|
+
|
|
374
439
|
// ─── enterMilestone Tests (branch mode) ──────────────────────────────────────
|
|
375
440
|
|
|
376
441
|
test("enterMilestone in branch mode calls enterBranchModeForMilestone and rebuilds GitService", () => {
|
|
@@ -464,6 +529,42 @@ test("exitMilestone commits, tears down, and resets basePath", () => {
|
|
|
464
529
|
assert.equal(findCalls(deps.calls, "invalidateAllCaches").length, 1);
|
|
465
530
|
});
|
|
466
531
|
|
|
532
|
+
test("exitMilestone moves cwd to project root before teardown", (t) => {
|
|
533
|
+
const originalCwd = process.cwd();
|
|
534
|
+
const base = realpathSync(mkdtempSync(join(tmpdir(), "gsd-exit-cwd-")));
|
|
535
|
+
const wtPath = join(base, ".gsd", "worktrees", "M001");
|
|
536
|
+
mkdirSync(wtPath, { recursive: true });
|
|
537
|
+
t.after(() => {
|
|
538
|
+
process.chdir(originalCwd);
|
|
539
|
+
rmSync(base, { recursive: true, force: true });
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
process.chdir(wtPath);
|
|
543
|
+
const s = makeSession({
|
|
544
|
+
basePath: wtPath,
|
|
545
|
+
originalBasePath: base,
|
|
546
|
+
});
|
|
547
|
+
const deps = makeDeps({
|
|
548
|
+
isInAutoWorktree: () => true,
|
|
549
|
+
});
|
|
550
|
+
deps.teardownAutoWorktree = (
|
|
551
|
+
teardownBasePath: string,
|
|
552
|
+
milestoneId: string,
|
|
553
|
+
opts?: { preserveBranch?: boolean },
|
|
554
|
+
) => {
|
|
555
|
+
deps.calls.push({ fn: "teardownAutoWorktree", args: [teardownBasePath, milestoneId, opts] });
|
|
556
|
+
assert.equal(process.cwd(), base);
|
|
557
|
+
rmSync(wtPath, { recursive: true, force: true });
|
|
558
|
+
};
|
|
559
|
+
const ctx = makeNotifyCtx();
|
|
560
|
+
const resolver = new WorktreeResolver(s, deps);
|
|
561
|
+
|
|
562
|
+
resolver.exitMilestone("M001", ctx);
|
|
563
|
+
|
|
564
|
+
assert.equal(process.cwd(), base);
|
|
565
|
+
assert.equal(s.basePath, base);
|
|
566
|
+
});
|
|
567
|
+
|
|
467
568
|
test("exitMilestone is no-op when not in worktree", () => {
|
|
468
569
|
const s = makeSession();
|
|
469
570
|
const deps = makeDeps({
|
|
@@ -740,21 +841,92 @@ test("mergeAndExit in branch mode merges when on milestone branch", () => {
|
|
|
740
841
|
assert.ok(ctx.messages.some((m) => m.msg.includes("branch mode")));
|
|
741
842
|
});
|
|
742
843
|
|
|
743
|
-
test("mergeAndExit in branch mode
|
|
844
|
+
test("mergeAndExit in branch mode checks out the milestone branch and merges (#5538-followup)", () => {
|
|
845
|
+
// Regression: previously this case silently returned without merging,
|
|
846
|
+
// stranding the milestone's commits on the branch (the test12345 repro).
|
|
847
|
+
// The fix forces a checkout first; merge proceeds when checkout succeeds.
|
|
744
848
|
const s = makeSession({ basePath: "/project", originalBasePath: "/project" });
|
|
849
|
+
let currentBranch = "main";
|
|
850
|
+
const checkoutInvocations: Array<{ basePath: string; branch: string }> = [];
|
|
745
851
|
const deps = makeDeps({
|
|
746
852
|
isInAutoWorktree: () => false,
|
|
747
853
|
getIsolationMode: () => "branch",
|
|
748
|
-
getCurrentBranch: () =>
|
|
854
|
+
getCurrentBranch: () => currentBranch,
|
|
749
855
|
autoWorktreeBranch: () => "milestone/M001",
|
|
856
|
+
checkoutBranch: (basePath: string, branch: string) => {
|
|
857
|
+
checkoutInvocations.push({ basePath, branch });
|
|
858
|
+
currentBranch = branch;
|
|
859
|
+
},
|
|
750
860
|
});
|
|
751
861
|
const ctx = makeNotifyCtx();
|
|
752
862
|
const resolver = new WorktreeResolver(s, deps);
|
|
753
863
|
|
|
754
864
|
resolver.mergeAndExit("M001", ctx);
|
|
755
865
|
|
|
866
|
+
assert.equal(checkoutInvocations.length, 1, "must attempt checkout when on wrong branch");
|
|
867
|
+
assert.deepEqual(checkoutInvocations[0], { basePath: "/project", branch: "milestone/M001" });
|
|
868
|
+
assert.equal(findCalls(deps.calls, "mergeMilestoneToMain").length, 1);
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
test("mergeAndExit in branch mode throws when checkout fails", () => {
|
|
872
|
+
// Regression for the silent-skip bug: if the working tree is on the wrong
|
|
873
|
+
// branch and checkout fails, we must throw so the caller pauses auto-mode
|
|
874
|
+
// — never silently advance with the milestone unmerged.
|
|
875
|
+
const s = makeSession({ basePath: "/project", originalBasePath: "/project" });
|
|
876
|
+
const deps = makeDeps({
|
|
877
|
+
isInAutoWorktree: () => false,
|
|
878
|
+
getIsolationMode: () => "branch",
|
|
879
|
+
getCurrentBranch: () => "main",
|
|
880
|
+
autoWorktreeBranch: () => "milestone/M001",
|
|
881
|
+
checkoutBranch: () => {
|
|
882
|
+
throw new Error("dirty working tree blocks checkout");
|
|
883
|
+
},
|
|
884
|
+
});
|
|
885
|
+
const ctx = makeNotifyCtx();
|
|
886
|
+
const resolver = new WorktreeResolver(s, deps);
|
|
887
|
+
|
|
888
|
+
assert.throws(
|
|
889
|
+
() => resolver.mergeAndExit("M001", ctx),
|
|
890
|
+
/dirty working tree blocks checkout/,
|
|
891
|
+
);
|
|
892
|
+
assert.equal(
|
|
893
|
+
findCalls(deps.calls, "mergeMilestoneToMain").length,
|
|
894
|
+
0,
|
|
895
|
+
"merge must not run when checkout failed",
|
|
896
|
+
);
|
|
897
|
+
const errorNotify = ctx.messages.find((m) => m.level === "error");
|
|
898
|
+
assert.ok(errorNotify, "an error notification must be emitted");
|
|
899
|
+
assert.match(errorNotify!.msg, /milestone\/M001 failed/);
|
|
900
|
+
assert.match(errorNotify!.msg, /Resolve manually/);
|
|
901
|
+
assert.equal(
|
|
902
|
+
ctx.messages.some((m) => m.level === "warning" && m.msg.includes("Milestone merge failed")),
|
|
903
|
+
false,
|
|
904
|
+
"checkout failures with explicit recovery guidance must not emit a duplicate warning",
|
|
905
|
+
);
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
test("mergeAndExit in branch mode throws when checkout reports success but HEAD is still wrong", () => {
|
|
909
|
+
// Defense in depth: even if checkoutBranch returns without throwing, we
|
|
910
|
+
// re-verify and throw if HEAD didn't actually move. Prevents merging on
|
|
911
|
+
// top of the wrong branch on platforms where the checkout is a no-op.
|
|
912
|
+
const s = makeSession({ basePath: "/project", originalBasePath: "/project" });
|
|
913
|
+
const deps = makeDeps({
|
|
914
|
+
isInAutoWorktree: () => false,
|
|
915
|
+
getIsolationMode: () => "branch",
|
|
916
|
+
getCurrentBranch: () => "main", // never changes — simulates no-op checkout
|
|
917
|
+
autoWorktreeBranch: () => "milestone/M001",
|
|
918
|
+
checkoutBranch: () => {
|
|
919
|
+
// Pretend success — but getCurrentBranch will still return "main".
|
|
920
|
+
},
|
|
921
|
+
});
|
|
922
|
+
const ctx = makeNotifyCtx();
|
|
923
|
+
const resolver = new WorktreeResolver(s, deps);
|
|
924
|
+
|
|
925
|
+
assert.throws(
|
|
926
|
+
() => resolver.mergeAndExit("M001", ctx),
|
|
927
|
+
/reported success but current branch is main/,
|
|
928
|
+
);
|
|
756
929
|
assert.equal(findCalls(deps.calls, "mergeMilestoneToMain").length, 0);
|
|
757
|
-
assert.equal(ctx.messages.length, 0);
|
|
758
930
|
});
|
|
759
931
|
|
|
760
932
|
test("mergeAndExit in branch mode handles merge failure gracefully", () => {
|
|
@@ -977,6 +1149,33 @@ test("mergeAndEnterNext enters next milestone even if merge fails", () => {
|
|
|
977
1149
|
);
|
|
978
1150
|
});
|
|
979
1151
|
|
|
1152
|
+
test("mergeAndEnterNext halts after branch-mode user-notified checkout failure", () => {
|
|
1153
|
+
const s = makeSession({ basePath: "/project", originalBasePath: "/project" });
|
|
1154
|
+
const deps = makeDeps({
|
|
1155
|
+
isInAutoWorktree: () => false,
|
|
1156
|
+
getIsolationMode: () => "branch",
|
|
1157
|
+
getCurrentBranch: () => "main",
|
|
1158
|
+
autoWorktreeBranch: () => "milestone/M001",
|
|
1159
|
+
checkoutBranch: () => {
|
|
1160
|
+
throw new Error("dirty working tree blocks checkout");
|
|
1161
|
+
},
|
|
1162
|
+
});
|
|
1163
|
+
const ctx = makeNotifyCtx();
|
|
1164
|
+
const resolver = new WorktreeResolver(s, deps);
|
|
1165
|
+
|
|
1166
|
+
assert.throws(
|
|
1167
|
+
() => resolver.mergeAndEnterNext("M001", "M002", ctx),
|
|
1168
|
+
/dirty working tree blocks checkout/,
|
|
1169
|
+
);
|
|
1170
|
+
assert.equal(
|
|
1171
|
+
findCalls(deps.calls, "enterBranchModeForMilestone").length,
|
|
1172
|
+
0,
|
|
1173
|
+
"must not enter the next milestone after a user-notified branch-mode failure",
|
|
1174
|
+
);
|
|
1175
|
+
assert.equal(findCalls(deps.calls, "mergeMilestoneToMain").length, 0);
|
|
1176
|
+
assert.ok(ctx.messages.some((m) => m.level === "error" && m.msg.includes("Resolve manually")));
|
|
1177
|
+
});
|
|
1178
|
+
|
|
980
1179
|
// ─── GitService Rebuild Atomicity ────────────────────────────────────────────
|
|
981
1180
|
|
|
982
1181
|
test("GitService is rebuilt with the NEW basePath after enterMilestone", () => {
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// GSD-2 worktree-isolation write gate (#5199).
|
|
2
|
+
//
|
|
3
|
+
// Regression coverage for shouldBlockWorktreeWrite — the helper that prevents
|
|
4
|
+
// the LLM from authoring code at the project root when `git.isolation: worktree`
|
|
5
|
+
// is configured but auto-mode (and its post-unit commit pipeline) hasn't run.
|
|
6
|
+
// Without this gate, writes silently orphan outside git history.
|
|
7
|
+
//
|
|
8
|
+
// Test setup creates a fresh temp project for each isolation case, writes a
|
|
9
|
+
// `.gsd/PREFERENCES.md` with `isolation: "worktree"`, and exercises the helper
|
|
10
|
+
// against the 9 scenarios listed in the issue. No source-grep tests — every
|
|
11
|
+
// assertion exercises the real predicate.
|
|
12
|
+
|
|
13
|
+
import { test, describe, beforeEach, afterEach } from "node:test";
|
|
14
|
+
import assert from "node:assert/strict";
|
|
15
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
|
|
19
|
+
import { shouldBlockWorktreeWrite } from "../bootstrap/write-gate.js";
|
|
20
|
+
import { invalidateAllCaches } from "../cache.js";
|
|
21
|
+
|
|
22
|
+
function makeProject(isolation: "none" | "worktree" | "branch" | null): string {
|
|
23
|
+
const root = mkdtempSync(join(tmpdir(), "wt-write-gate-"));
|
|
24
|
+
if (isolation !== null) {
|
|
25
|
+
mkdirSync(join(root, ".gsd"), { recursive: true });
|
|
26
|
+
writeFileSync(
|
|
27
|
+
join(root, ".gsd", "PREFERENCES.md"),
|
|
28
|
+
`---\ngit:\n isolation: "${isolation}"\n---\n`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
invalidateAllCaches();
|
|
32
|
+
return root;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const PLANNING_WRITE_TOOLS = ["write", "edit", "multi_edit", "notebook_edit"];
|
|
36
|
+
|
|
37
|
+
describe("shouldBlockWorktreeWrite (#5199)", () => {
|
|
38
|
+
let projectRoot: string;
|
|
39
|
+
let prevDisableEnv: string | undefined;
|
|
40
|
+
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
prevDisableEnv = process.env.GSD_DISABLE_WORKTREE_WRITE_GUARD;
|
|
43
|
+
delete process.env.GSD_DISABLE_WORKTREE_WRITE_GUARD;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
if (projectRoot) {
|
|
48
|
+
try { rmSync(projectRoot, { recursive: true, force: true }); } catch { /* best-effort */ }
|
|
49
|
+
}
|
|
50
|
+
if (prevDisableEnv === undefined) {
|
|
51
|
+
delete process.env.GSD_DISABLE_WORKTREE_WRITE_GUARD;
|
|
52
|
+
} else {
|
|
53
|
+
process.env.GSD_DISABLE_WORKTREE_WRITE_GUARD = prevDisableEnv;
|
|
54
|
+
}
|
|
55
|
+
invalidateAllCaches();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("Case 1: every PLANNING_WRITE_TOOLS variant writing to <root>/app.js is blocked", () => {
|
|
59
|
+
projectRoot = makeProject("worktree");
|
|
60
|
+
for (const tool of PLANNING_WRITE_TOOLS) {
|
|
61
|
+
const result = shouldBlockWorktreeWrite(
|
|
62
|
+
tool,
|
|
63
|
+
join(projectRoot, "app.js"),
|
|
64
|
+
projectRoot,
|
|
65
|
+
/* isAutoLive */ false,
|
|
66
|
+
/* unitType */ null,
|
|
67
|
+
);
|
|
68
|
+
assert.equal(result.block, true, `tool ${tool} should be blocked`);
|
|
69
|
+
assert.match(result.reason ?? "", /HARD BLOCK/);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("Case 2: write to <root>/.gsd/PROJECT.md is allowed", () => {
|
|
74
|
+
projectRoot = makeProject("worktree");
|
|
75
|
+
const result = shouldBlockWorktreeWrite(
|
|
76
|
+
"write",
|
|
77
|
+
join(projectRoot, ".gsd", "PROJECT.md"),
|
|
78
|
+
projectRoot,
|
|
79
|
+
false,
|
|
80
|
+
null,
|
|
81
|
+
);
|
|
82
|
+
assert.equal(result.block, false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("Case 3: write inside <root>/.gsd/worktrees/M001/ is allowed", () => {
|
|
86
|
+
projectRoot = makeProject("worktree");
|
|
87
|
+
const target = join(projectRoot, ".gsd", "worktrees", "M001", "src", "app.js");
|
|
88
|
+
const result = shouldBlockWorktreeWrite("edit", target, projectRoot, false, null);
|
|
89
|
+
assert.equal(result.block, false);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test("Case 4: write to <root>/.gsd/worktrees-extra/M001/app.js (prefix trick) is blocked", () => {
|
|
93
|
+
projectRoot = makeProject("worktree");
|
|
94
|
+
const target = join(projectRoot, ".gsd", "worktrees-extra", "M001", "app.js");
|
|
95
|
+
const result = shouldBlockWorktreeWrite("write", target, projectRoot, false, null);
|
|
96
|
+
assert.equal(result.block, true);
|
|
97
|
+
assert.match(result.reason ?? "", /HARD BLOCK/);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("Case 5: isolation=none → allow", () => {
|
|
101
|
+
projectRoot = makeProject("none");
|
|
102
|
+
const result = shouldBlockWorktreeWrite(
|
|
103
|
+
"write",
|
|
104
|
+
join(projectRoot, "app.js"),
|
|
105
|
+
projectRoot,
|
|
106
|
+
false,
|
|
107
|
+
null,
|
|
108
|
+
);
|
|
109
|
+
assert.equal(result.block, false);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("Case 6: isolation=worktree, auto active, effectiveBasePath inside worktree → allow", () => {
|
|
113
|
+
projectRoot = makeProject("worktree");
|
|
114
|
+
const inside = join(projectRoot, ".gsd", "worktrees", "M001");
|
|
115
|
+
mkdirSync(inside, { recursive: true });
|
|
116
|
+
const result = shouldBlockWorktreeWrite(
|
|
117
|
+
"write",
|
|
118
|
+
join(inside, "src", "app.js"),
|
|
119
|
+
inside,
|
|
120
|
+
/* isAutoLive */ true,
|
|
121
|
+
null,
|
|
122
|
+
);
|
|
123
|
+
assert.equal(result.block, false);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("Case 7: isolation=worktree, auto active, effectiveBasePath is project root (cwd never flipped) → block", () => {
|
|
127
|
+
projectRoot = makeProject("worktree");
|
|
128
|
+
const result = shouldBlockWorktreeWrite(
|
|
129
|
+
"write",
|
|
130
|
+
join(projectRoot, "app.js"),
|
|
131
|
+
projectRoot,
|
|
132
|
+
/* isAutoLive */ true,
|
|
133
|
+
null,
|
|
134
|
+
);
|
|
135
|
+
assert.equal(result.block, true);
|
|
136
|
+
assert.match(result.reason ?? "", /HARD BLOCK/);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("Case 8: bootstrap unit type active → allow", () => {
|
|
140
|
+
projectRoot = makeProject("worktree");
|
|
141
|
+
for (const unitType of ["discuss-milestone", "plan-milestone", "init"]) {
|
|
142
|
+
const result = shouldBlockWorktreeWrite(
|
|
143
|
+
"write",
|
|
144
|
+
join(projectRoot, "app.js"),
|
|
145
|
+
projectRoot,
|
|
146
|
+
false,
|
|
147
|
+
unitType,
|
|
148
|
+
);
|
|
149
|
+
assert.equal(result.block, false, `unit ${unitType} should bypass the guard`);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("Case 9: GSD_DISABLE_WORKTREE_WRITE_GUARD=1 → allow", () => {
|
|
154
|
+
projectRoot = makeProject("worktree");
|
|
155
|
+
process.env.GSD_DISABLE_WORKTREE_WRITE_GUARD = "1";
|
|
156
|
+
const result = shouldBlockWorktreeWrite(
|
|
157
|
+
"write",
|
|
158
|
+
join(projectRoot, "app.js"),
|
|
159
|
+
projectRoot,
|
|
160
|
+
false,
|
|
161
|
+
null,
|
|
162
|
+
);
|
|
163
|
+
assert.equal(result.block, false);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("non-planning tools (read/grep/bash) pass through unconditionally", () => {
|
|
167
|
+
projectRoot = makeProject("worktree");
|
|
168
|
+
for (const tool of ["read", "grep", "bash", "ls"]) {
|
|
169
|
+
const result = shouldBlockWorktreeWrite(
|
|
170
|
+
tool,
|
|
171
|
+
join(projectRoot, "app.js"),
|
|
172
|
+
projectRoot,
|
|
173
|
+
false,
|
|
174
|
+
null,
|
|
175
|
+
);
|
|
176
|
+
assert.equal(result.block, false, `tool ${tool} must not be gated`);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* parseable slices the same as no roadmap — offer "Create roadmap" not "Go auto".
|
|
4
|
-
*/
|
|
1
|
+
// GSD-2 — Guided roadmap slice detection regression tests.
|
|
2
|
+
|
|
5
3
|
import { test } from "node:test";
|
|
6
4
|
import assert from "node:assert/strict";
|
|
7
|
-
import { readFileSync } from "node:fs";
|
|
8
|
-
import { join } from "node:path";
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
import { _roadmapHasParseableSlicesForTest } from "../guided-flow.ts";
|
|
7
|
+
|
|
8
|
+
test("guided flow treats placeholder roadmaps with zero slices as not runnable", () => {
|
|
9
|
+
assert.equal(
|
|
10
|
+
_roadmapHasParseableSlicesForTest("# M001 Roadmap\n\nPlanning notes only.\n"),
|
|
11
|
+
false,
|
|
14
12
|
);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("guided flow accepts roadmaps with parseable slices", () => {
|
|
16
|
+
assert.equal(
|
|
17
|
+
_roadmapHasParseableSlicesForTest([
|
|
18
|
+
"# M001 Roadmap",
|
|
19
|
+
"",
|
|
20
|
+
"## Slices",
|
|
21
|
+
"- [ ] **S01: First slice** `risk:low` `depends:[]`",
|
|
22
|
+
].join("\n")),
|
|
23
|
+
true,
|
|
18
24
|
);
|
|
19
25
|
});
|
|
@@ -85,7 +85,7 @@ function taskGateFieldForId(
|
|
|
85
85
|
* Normalize a list parameter that may arrive as a string (newline-delimited
|
|
86
86
|
* bullet list from the LLM) into a string array (#3361).
|
|
87
87
|
*/
|
|
88
|
-
function normalizeListParam(value: unknown): string[] {
|
|
88
|
+
export function normalizeListParam(value: unknown): string[] {
|
|
89
89
|
if (Array.isArray(value)) return value.map(String);
|
|
90
90
|
if (typeof value === "string" && value.trim()) {
|
|
91
91
|
return value.split(/\n/).map(s => s.replace(/^[\s\-*•]+/, "").trim()).filter(Boolean);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Shared Context Mode tool result helpers.
|
|
3
|
+
|
|
4
|
+
export interface ToolExecutionResult {
|
|
5
|
+
content: Array<{ type: "text"; text: string }>;
|
|
6
|
+
details: Record<string, unknown>;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ContextModeToolName = "gsd_exec" | "gsd_exec_search" | "gsd_resume";
|
|
11
|
+
|
|
12
|
+
export function contextModeDisabledResult(operation: ContextModeToolName): ToolExecutionResult {
|
|
13
|
+
return {
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: "text",
|
|
17
|
+
text:
|
|
18
|
+
`${operation} is disabled by \`context_mode.enabled: false\` in preferences. ` +
|
|
19
|
+
"Remove that override or set it to true to re-enable Context Mode tools.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
details: { operation, error: "context_mode_disabled" },
|
|
23
|
+
isError: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
// re-discover past runs without re-executing. Read-only; no DB writes.
|
|
5
5
|
|
|
6
6
|
import { searchExecHistory, type ExecSearchOptions } from "../exec-history.js";
|
|
7
|
+
import { isContextModeEnabled, type ContextModeConfig } from "../preferences-types.js";
|
|
8
|
+
import { contextModeDisabledResult, type ToolExecutionResult } from "./context-mode-tool-result.js";
|
|
7
9
|
|
|
8
10
|
export interface ExecSearchToolParams {
|
|
9
11
|
query?: string;
|
|
@@ -12,16 +14,14 @@ export interface ExecSearchToolParams {
|
|
|
12
14
|
limit?: number;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export interface ToolExecutionResult {
|
|
16
|
-
content: Array<{ type: "text"; text: string }>;
|
|
17
|
-
details: Record<string, unknown>;
|
|
18
|
-
isError?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
export function executeExecSearch(
|
|
22
18
|
params: ExecSearchToolParams,
|
|
23
|
-
opts: { baseDir: string },
|
|
19
|
+
opts: { baseDir: string; preferences?: { context_mode?: ContextModeConfig } | null },
|
|
24
20
|
): ToolExecutionResult {
|
|
21
|
+
if (!isContextModeEnabled(opts.preferences)) {
|
|
22
|
+
return contextModeDisabledResult("gsd_exec_search");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
25
|
const searchOpts: ExecSearchOptions = {
|
|
26
26
|
query: typeof params.query === "string" ? params.query : undefined,
|
|
27
27
|
runtime: params.runtime,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type ExecSandboxResult,
|
|
13
13
|
} from "../exec-sandbox.js";
|
|
14
14
|
import { isContextModeEnabled, type ContextModeConfig } from "../preferences-types.js";
|
|
15
|
+
import { contextModeDisabledResult, type ToolExecutionResult } from "./context-mode-tool-result.js";
|
|
15
16
|
|
|
16
17
|
export interface ExecToolParams {
|
|
17
18
|
runtime: ExecSandboxRequest["runtime"];
|
|
@@ -20,17 +21,12 @@ export interface ExecToolParams {
|
|
|
20
21
|
timeout_ms?: number;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
export interface ToolExecutionResult {
|
|
24
|
-
content: Array<{ type: "text"; text: string }>;
|
|
25
|
-
details: Record<string, unknown>;
|
|
26
|
-
isError?: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
24
|
export interface ExecToolDeps {
|
|
30
25
|
baseDir: string;
|
|
31
26
|
preferences: { context_mode?: ContextModeConfig } | null;
|
|
32
27
|
/** Optional override for testing. */
|
|
33
28
|
run?: (req: ExecSandboxRequest, opts: ExecSandboxOptions) => Promise<ExecSandboxResult>;
|
|
29
|
+
env?: NodeJS.ProcessEnv;
|
|
34
30
|
now?: () => Date;
|
|
35
31
|
generateId?: () => string;
|
|
36
32
|
}
|
|
@@ -77,21 +73,6 @@ function isEnabled(prefs: ExecToolDeps["preferences"]): boolean {
|
|
|
77
73
|
return isContextModeEnabled(prefs);
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
function disabledResult(): ToolExecutionResult {
|
|
81
|
-
return {
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
type: "text",
|
|
85
|
-
text:
|
|
86
|
-
"gsd_exec is disabled by `context_mode.enabled: false` in preferences. Remove that " +
|
|
87
|
-
"override (or set it to true) to re-enable sandboxed tool-output execution.",
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
details: { operation: "gsd_exec", error: "context_mode_disabled" },
|
|
91
|
-
isError: true,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
76
|
function paramError(message: string): ToolExecutionResult {
|
|
96
77
|
return {
|
|
97
78
|
content: [{ type: "text", text: `Error: ${message}` }],
|
|
@@ -104,7 +85,7 @@ export async function executeGsdExec(
|
|
|
104
85
|
params: ExecToolParams,
|
|
105
86
|
deps: ExecToolDeps,
|
|
106
87
|
): Promise<ToolExecutionResult> {
|
|
107
|
-
if (!isEnabled(deps.preferences)) return
|
|
88
|
+
if (!isEnabled(deps.preferences)) return contextModeDisabledResult("gsd_exec");
|
|
108
89
|
|
|
109
90
|
const runtime = params.runtime;
|
|
110
91
|
if (runtime !== "bash" && runtime !== "node" && runtime !== "python") {
|
|
@@ -121,7 +102,7 @@ export async function executeGsdExec(
|
|
|
121
102
|
const opts = buildExecOptions(
|
|
122
103
|
deps.baseDir,
|
|
123
104
|
deps.preferences?.context_mode,
|
|
124
|
-
{ now: deps.now, generateId: deps.generateId },
|
|
105
|
+
{ env: deps.env, now: deps.now, generateId: deps.generateId },
|
|
125
106
|
);
|
|
126
107
|
const run = deps.run ?? runExecSandbox;
|
|
127
108
|
|
|
@@ -308,6 +308,7 @@ function includeSupersededMemories(rankedActive: Memory[]): Memory[] {
|
|
|
308
308
|
scope: (row["scope"] as string) ?? "project",
|
|
309
309
|
tags,
|
|
310
310
|
structured_fields: structuredFields,
|
|
311
|
+
last_hit_at: (row["last_hit_at"] as string | null) ?? null,
|
|
311
312
|
};
|
|
312
313
|
});
|
|
313
314
|
} catch {
|
|
@@ -18,6 +18,7 @@ import { renderAllProjections } from "../workflow-projections.js";
|
|
|
18
18
|
import { writeManifest } from "../workflow-manifest.js";
|
|
19
19
|
import { appendEvent } from "../workflow-events.js";
|
|
20
20
|
import { logWarning } from "../workflow-logger.js";
|
|
21
|
+
import { validatePlanningPathScope } from "../planning-path-scope.js";
|
|
21
22
|
|
|
22
23
|
export interface PlanSliceTaskInput {
|
|
23
24
|
taskId: string;
|
|
@@ -141,6 +142,18 @@ export async function handlePlanSlice(
|
|
|
141
142
|
return { error: `validation failed: ${(err as Error).message}` };
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
const pathScopeError = validatePlanningPathScope(
|
|
146
|
+
basePath,
|
|
147
|
+
params.tasks.flatMap((task, index) => [
|
|
148
|
+
{ field: `tasks[${index}].files`, values: task.files },
|
|
149
|
+
{ field: `tasks[${index}].inputs`, values: task.inputs },
|
|
150
|
+
{ field: `tasks[${index}].expectedOutput`, values: task.expectedOutput },
|
|
151
|
+
]),
|
|
152
|
+
);
|
|
153
|
+
if (pathScopeError) {
|
|
154
|
+
return { error: `validation failed: ${pathScopeError}` };
|
|
155
|
+
}
|
|
156
|
+
|
|
144
157
|
// ── Guards + DB writes inside a single transaction (prevents TOCTOU) ───
|
|
145
158
|
// Guards must be inside the transaction so the state they check cannot
|
|
146
159
|
// change between the read and the write (#2723).
|