@opengsd/gsd-pi 1.3.0-dev.eed73bea → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/cli.js +17 -4
- package/dist/headless-answers.js +1 -1
- package/dist/headless-ui.d.ts +1 -1
- package/dist/headless-ui.js +1 -1
- package/dist/headless.js +1 -1
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- package/dist/resources/extensions/gsd/artifact-verification.js +427 -0
- package/dist/resources/extensions/gsd/auto/session.js +11 -0
- package/dist/resources/extensions/gsd/auto/verification-retry-policy.js +1 -1
- package/dist/resources/extensions/gsd/auto-artifact-paths.js +28 -1
- package/dist/resources/extensions/gsd/auto-budget.js +5 -1
- package/dist/resources/extensions/gsd/auto-dispatch.js +17 -6
- package/dist/resources/extensions/gsd/auto-post-unit.js +1 -1
- package/dist/resources/extensions/gsd/auto-prompts.js +8 -24
- package/dist/resources/extensions/gsd/auto-recovery.js +9 -517
- package/dist/resources/extensions/gsd/auto-runtime-state.js +4 -5
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +3 -3
- package/dist/resources/extensions/gsd/auto-verification.js +5 -2
- package/dist/resources/extensions/gsd/auto.js +19 -10
- package/dist/resources/extensions/gsd/bootstrap/core-session-tools.js +39 -0
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +5 -4
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +33 -18
- package/dist/resources/extensions/gsd/bootstrap/tool-call-loop-guard.js +48 -36
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +15 -4
- package/dist/resources/extensions/gsd/closeout-consistency-gate.js +3 -1
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +1 -1
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
- package/dist/resources/extensions/gsd/commands-usage.js +1 -1
- package/dist/resources/extensions/gsd/db/engine.js +4 -1
- package/dist/resources/extensions/gsd/db-memory-fts-schema.js +34 -0
- package/dist/resources/extensions/gsd/db-workspace.js +55 -3
- package/dist/resources/extensions/gsd/delegation-policy.js +1 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +2 -2
- package/dist/resources/extensions/gsd/doctor-engine-checks.js +192 -4
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +3 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +8 -2
- package/dist/resources/extensions/gsd/flat-phase-migration.js +45 -0
- package/dist/resources/extensions/gsd/git-service.js +57 -0
- package/dist/resources/extensions/gsd/gitignore.js +4 -1
- package/dist/resources/extensions/gsd/guided-flow-queue.js +20 -13
- package/dist/resources/extensions/gsd/json-persistence.js +20 -0
- package/dist/resources/extensions/gsd/knowledge-backfill.js +18 -11
- package/dist/resources/extensions/gsd/layout-policy.js +3 -1
- package/dist/resources/extensions/gsd/markdown-renderer.js +2 -7
- package/dist/resources/extensions/gsd/memory-backfill.js +28 -21
- package/dist/resources/extensions/gsd/metrics.js +4 -4
- package/dist/resources/extensions/gsd/migrate-external.js +11 -2
- package/dist/resources/extensions/gsd/migration-auto-check.js +22 -0
- package/dist/resources/extensions/gsd/milestone-ids.js +32 -2
- package/dist/resources/extensions/gsd/orphan-stash-audit.js +92 -16
- package/dist/resources/extensions/gsd/prompts/code-review.md +6 -4
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +2 -2
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/dist/resources/extensions/gsd/root-write-leak-guard.js +7 -1
- package/dist/resources/extensions/gsd/safety/destructive-guard.js +8 -1
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +16 -1
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +5 -2
- package/dist/resources/extensions/gsd/skills/gsd-headless/references/commands.md +1 -1
- package/dist/resources/extensions/gsd/state/derive/cache.js +28 -0
- package/dist/resources/extensions/gsd/state/derive/db-open.js +39 -0
- package/dist/resources/extensions/gsd/state/derive/from-db.js +452 -0
- package/dist/resources/extensions/gsd/state/derive/index.js +75 -0
- package/dist/resources/extensions/gsd/state/derive/interrupted-work.js +21 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/stale-render.js +27 -33
- package/dist/resources/extensions/gsd/state-reconciliation/index.js +48 -23
- package/dist/resources/extensions/gsd/state-reconciliation/registry.js +32 -28
- package/dist/resources/extensions/gsd/state.js +12 -611
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +4 -2
- package/dist/resources/extensions/gsd/tools/complete-slice.js +3 -34
- package/dist/resources/extensions/gsd/tools/complete-task.js +8 -41
- package/dist/resources/extensions/gsd/tools/plan-slice.js +59 -44
- package/dist/resources/extensions/gsd/tools/plan-task.js +28 -5
- package/dist/resources/extensions/gsd/undo.js +43 -6
- package/dist/resources/extensions/gsd/unit-registry.js +11 -3
- package/dist/resources/extensions/gsd/verification-gate.js +7 -0
- package/dist/resources/extensions/gsd/workflow-manifest.js +126 -13
- package/dist/resources/extensions/gsd/workflow-projections.js +19 -14
- package/dist/resources/extensions/gsd/worktree-manager.js +44 -2
- 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 +10 -10
- package/dist/web/standalone/.next/build-manifest.json +4 -4
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +9 -9
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
- package/dist/web/standalone/.next/server/chunks/2842.js +4 -4
- package/dist/web/standalone/.next/server/chunks/8357.js +3 -3
- 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/{2659.b7b129ee6a769448.js → 2659.58e950899a9bb82f.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/2772.a7c1fcc69a4685ef.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{3616.3c60753b8ffcbd2e.js → 3616.61a2af74bb8833c8.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{4283.8e446784528ed9dc.js → 4283.d0d9e0a955e441cb.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{5826.a46ecdd1cfe8dabc.js → 5826.5421d66c72b9f34e.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{8785.481aa5869991b760.js → 8785.e29b3134cab1d153.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/8937.640dc9c2aaa1dfad.js +10 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/page-49f565245e1e4afe.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/{layout-4ae2d68984392bbf.js → layout-b35cbfff38aaf4cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-bc4c723c6a19c6f0.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{main-app-90d1d8d5e5d2dc6b.js → main-app-590a74400e35f685.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ec3eaffc9785ba48.js +1 -0
- package/dist/web/standalone/.next/static/chunks/webpack-9c401904f87ded16.js +1 -0
- package/dist/web/standalone/node_modules/@gsd/native/package.json +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/package.json +6 -6
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/dist/agent-session.d.ts +1 -0
- package/packages/gsd-agent-core/dist/agent-session.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/agent-session.js +3 -0
- package/packages/gsd-agent-core/dist/agent-session.js.map +1 -1
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.d.ts +41 -0
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.d.ts.map +1 -0
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.js +62 -0
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.js.map +1 -0
- package/packages/gsd-agent-core/dist/index.d.ts +2 -0
- package/packages/gsd-agent-core/dist/index.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/index.js +2 -0
- package/packages/gsd-agent-core/dist/index.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-events.js +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-events.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts +1 -0
- package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-host.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.d.ts +5 -0
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.js +60 -3
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.js.map +1 -1
- package/packages/gsd-agent-core/dist/transcript-store.d.ts +58 -0
- package/packages/gsd-agent-core/dist/transcript-store.d.ts.map +1 -0
- package/packages/gsd-agent-core/dist/transcript-store.js +132 -0
- package/packages/gsd-agent-core/dist/transcript-store.js.map +1 -0
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +25 -11
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller-latency.d.ts +4 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller-latency.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller-latency.js +7 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller-latency.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts +3 -24
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +26 -841
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.d.ts +58 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.js +312 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.d.ts +31 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.js +130 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.d.ts +15 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.js +258 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.d.ts +13 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.js +118 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.d.ts +9 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.js +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.d.ts +54 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.js +20 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts +4 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js +9 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.d.ts +56 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.js +44 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.d.ts +5 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.js +77 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.d.ts +2 -0
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.js +23 -5
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js +18 -0
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/dist/workflow-tools.js +1 -1
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +4 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +3 -2
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +46 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +38 -0
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/README.md +3 -2
- package/packages/pi-coding-agent/dist/core/session-manager-context.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/session-manager-context.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-context.js +94 -0
- package/packages/pi-coding-agent/dist/core/session-manager-context.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.d.ts +8 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.js +244 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.d.ts +12 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.js +84 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.d.ts +135 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.js +2 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +6 -154
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +22 -459
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme-schema.d.ts +75 -75
- package/packages/pi-coding-agent/dist/theme/theme-schema.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme-schema.js +1 -1
- package/packages/pi-coding-agent/dist/theme/theme-schema.js.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.js +11 -7
- package/packages/pi-coding-agent/dist/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/dist/theme/theme-schema.d.ts +75 -75
- package/pkg/dist/theme/theme-schema.d.ts.map +1 -1
- package/pkg/dist/theme/theme-schema.js +1 -1
- package/pkg/dist/theme/theme-schema.js.map +1 -1
- package/pkg/dist/theme/theme.d.ts.map +1 -1
- package/pkg/dist/theme/theme.js +11 -7
- package/pkg/dist/theme/theme.js.map +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/tests/index.test.ts +14 -0
- package/src/resources/extensions/gsd/artifact-verification.ts +464 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
- package/src/resources/extensions/gsd/auto/session.ts +14 -0
- package/src/resources/extensions/gsd/auto/verification-retry-policy.ts +3 -1
- package/src/resources/extensions/gsd/auto-artifact-paths.ts +47 -1
- package/src/resources/extensions/gsd/auto-budget.ts +12 -1
- package/src/resources/extensions/gsd/auto-dispatch.ts +17 -7
- package/src/resources/extensions/gsd/auto-post-unit.ts +1 -1
- package/src/resources/extensions/gsd/auto-prompts.ts +7 -23
- package/src/resources/extensions/gsd/auto-recovery.ts +13 -518
- package/src/resources/extensions/gsd/auto-runtime-state.ts +4 -5
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +3 -2
- package/src/resources/extensions/gsd/auto-verification.ts +5 -1
- package/src/resources/extensions/gsd/auto.ts +23 -8
- package/src/resources/extensions/gsd/bootstrap/core-session-tools.ts +44 -0
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +5 -4
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +43 -18
- package/src/resources/extensions/gsd/bootstrap/tests/write-gate-basepath.test.ts +49 -1
- package/src/resources/extensions/gsd/bootstrap/tool-call-loop-guard.ts +50 -37
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +16 -4
- package/src/resources/extensions/gsd/closeout-consistency-gate.ts +2 -1
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +1 -1
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
- package/src/resources/extensions/gsd/commands-usage.ts +1 -1
- package/src/resources/extensions/gsd/db/engine.ts +8 -1
- package/src/resources/extensions/gsd/db-memory-fts-schema.ts +45 -0
- package/src/resources/extensions/gsd/db-workspace.ts +61 -3
- package/src/resources/extensions/gsd/delegation-policy.ts +1 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +2 -2
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +233 -5
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +3 -0
- package/src/resources/extensions/gsd/doctor-types.ts +3 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +7 -2
- package/src/resources/extensions/gsd/flat-phase-migration.ts +44 -0
- package/src/resources/extensions/gsd/git-service.ts +64 -0
- package/src/resources/extensions/gsd/gitignore.ts +4 -1
- package/src/resources/extensions/gsd/guided-flow-queue.ts +20 -13
- package/src/resources/extensions/gsd/json-persistence.ts +20 -0
- package/src/resources/extensions/gsd/knowledge-backfill.ts +16 -10
- package/src/resources/extensions/gsd/layout-policy.ts +2 -1
- package/src/resources/extensions/gsd/markdown-renderer.ts +2 -10
- package/src/resources/extensions/gsd/memory-backfill.ts +26 -20
- package/src/resources/extensions/gsd/metrics.ts +4 -4
- package/src/resources/extensions/gsd/migrate-external.ts +8 -2
- package/src/resources/extensions/gsd/migration-auto-check.ts +23 -0
- package/src/resources/extensions/gsd/milestone-ids.ts +31 -2
- package/src/resources/extensions/gsd/orphan-stash-audit.ts +108 -20
- package/src/resources/extensions/gsd/prompts/code-review.md +6 -4
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +2 -2
- package/src/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/src/resources/extensions/gsd/root-write-leak-guard.ts +13 -1
- package/src/resources/extensions/gsd/safety/destructive-guard.ts +9 -1
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +16 -1
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +8 -2
- package/src/resources/extensions/gsd/skills/gsd-headless/references/commands.md +1 -1
- package/src/resources/extensions/gsd/state/derive/cache.ts +46 -0
- package/src/resources/extensions/gsd/state/derive/db-open.ts +45 -0
- package/src/resources/extensions/gsd/state/derive/from-db.ts +561 -0
- package/src/resources/extensions/gsd/state/derive/index.ts +104 -0
- package/src/resources/extensions/gsd/state/derive/interrupted-work.ts +31 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/stale-render.ts +36 -30
- package/src/resources/extensions/gsd/state-reconciliation/index.ts +50 -24
- package/src/resources/extensions/gsd/state-reconciliation/registry.ts +43 -28
- package/src/resources/extensions/gsd/state.ts +32 -732
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/auto-artifact-paths.test.ts +98 -1
- package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +14 -5
- package/src/resources/extensions/gsd/tests/auto-pause-double-entry-guard.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +182 -4
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/commands-gsd-core.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/complete-slice-reopen-handoff.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/db-memory-fts-schema.test.ts +58 -3
- package/src/resources/extensions/gsd/tests/decisions-projection-from-memories.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/destructive-guard.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +143 -0
- package/src/resources/extensions/gsd/tests/doctor-scope-db-unavailable.test.ts +239 -2
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/flat-phase-migration.test.ts +37 -2
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell-runtime.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +11 -2
- package/src/resources/extensions/gsd/tests/json-persistence-atomic.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/knowledge-backfill-projection.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/merge-closeout-consistency-gate.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/metrics-prune-cache-invalidation.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/metrics.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/migrate-external-worktree.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/orphan-stash-audit.test.ts +91 -7
- package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +103 -4
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +44 -1
- package/src/resources/extensions/gsd/tests/post-mutation-hook.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +50 -14
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +8 -6
- package/src/resources/extensions/gsd/tests/register-hooks-loop-guard-auto.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/root-write-leak-guard.test.ts +20 -1
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +15 -3
- package/src/resources/extensions/gsd/tests/stalled-tool-recovery.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +115 -0
- package/src/resources/extensions/gsd/tests/tool-call-loop-guard.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/undo.test.ts +74 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/verification-retry-policy.test.ts +69 -4
- package/src/resources/extensions/gsd/tests/workflow-manifest.test.ts +96 -15
- package/src/resources/extensions/gsd/tests/workflow-mcp-preflight.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +8 -4
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +6 -5
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +39 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +3 -2
- package/src/resources/extensions/gsd/tools/complete-slice.ts +3 -30
- package/src/resources/extensions/gsd/tools/complete-task.ts +7 -39
- package/src/resources/extensions/gsd/tools/plan-slice.ts +60 -47
- package/src/resources/extensions/gsd/tools/plan-task.ts +30 -5
- package/src/resources/extensions/gsd/undo.ts +47 -6
- package/src/resources/extensions/gsd/unit-registry.ts +11 -3
- package/src/resources/extensions/gsd/verification-gate.ts +8 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +141 -7
- package/src/resources/extensions/gsd/workflow-projections.ts +20 -14
- package/src/resources/extensions/gsd/worktree-manager.ts +41 -1
- package/dist/web/standalone/.next/static/chunks/2772.bfa657f49f955239.js +0 -1
- package/dist/web/standalone/.next/static/chunks/796.3976108148518f7d.js +0 -10
- package/dist/web/standalone/.next/static/chunks/app/_not-found/page-a6fb1847f67f167c.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/page-6644fc6ee8ca1247.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-1115d46ac61b9823.js +0 -1
- package/dist/web/standalone/.next/static/chunks/webpack-7c1d97e39be2da11.js +0 -1
- /package/dist/web/standalone/.next/static/{SzEuqWX37DR9MEpEuQjP1 → zQLcXm0Za8lexoXtgDpMG}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{SzEuqWX37DR9MEpEuQjP1 → zQLcXm0Za8lexoXtgDpMG}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// gsd-pi + src/resources/extensions/gsd/tests/orphan-stash-audit.test.ts
|
|
2
|
-
// Regression
|
|
3
|
-
//
|
|
2
|
+
// Regression coverage for orphaned gsd-preflight-stash entries from completed
|
|
3
|
+
// milestones: safe startup recovery for untracked work, manual warnings for
|
|
4
|
+
// tracked or dirty-tree cases that would silently mutate user state.
|
|
4
5
|
|
|
5
6
|
import { describe, test, beforeEach, afterEach } from "node:test";
|
|
6
7
|
import assert from "node:assert/strict";
|
|
@@ -37,6 +38,13 @@ function pushPreflightStash(repo: string, milestoneId: string, fileName: string,
|
|
|
37
38
|
return marker;
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
function pushTrackedPreflightStash(repo: string, milestoneId: string, fileName: string, content: string): string {
|
|
42
|
+
writeFileSync(join(repo, fileName), content);
|
|
43
|
+
const marker = `gsd-preflight-stash:${milestoneId}:42:1700000000000:tracked`;
|
|
44
|
+
git(repo, "stash", "push", "-m", `gsd-preflight-stash [${marker}]`);
|
|
45
|
+
return marker;
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
describe("auditOrphanedPreflightStashes", () => {
|
|
41
49
|
let repo: string;
|
|
42
50
|
|
|
@@ -83,6 +91,23 @@ describe("auditOrphanedPreflightStashes", () => {
|
|
|
83
91
|
assert.match(list, /gsd-preflight-stash:M002:/);
|
|
84
92
|
});
|
|
85
93
|
|
|
94
|
+
test("does not auto-apply a tracked orphan preflight stash onto a clean working tree", () => {
|
|
95
|
+
pushTrackedPreflightStash(repo, "M006", "seed.txt", "seed\ntracked pre-merge work\n");
|
|
96
|
+
assert.equal(readFileSync(join(repo, "seed.txt"), "utf-8"), "seed\n");
|
|
97
|
+
|
|
98
|
+
const result = auditOrphanedPreflightStashes(repo, () => true);
|
|
99
|
+
|
|
100
|
+
assert.equal(result.applied.length, 0);
|
|
101
|
+
assert.equal(result.warnings.length, 1);
|
|
102
|
+
assert.match(result.warnings[0], /not auto-applied/);
|
|
103
|
+
assert.match(result.warnings[0], /stash modifies tracked files/);
|
|
104
|
+
assert.match(result.warnings[0], /git stash apply stash@\{\d+\}/);
|
|
105
|
+
assert.equal(readFileSync(join(repo, "seed.txt"), "utf-8"), "seed\n");
|
|
106
|
+
|
|
107
|
+
const list = git(repo, "stash", "list");
|
|
108
|
+
assert.match(list, /gsd-preflight-stash:M006:/);
|
|
109
|
+
});
|
|
110
|
+
|
|
86
111
|
test("ignores stashes whose milestone is not complete", () => {
|
|
87
112
|
pushPreflightStash(repo, "M003", "wip.txt", "still-working\n");
|
|
88
113
|
|
|
@@ -115,23 +140,25 @@ describe("auditOrphanedPreflightStashes", () => {
|
|
|
115
140
|
assert.match(result.warnings[0], /db unavailable/);
|
|
116
141
|
});
|
|
117
142
|
|
|
118
|
-
test("collects a warning
|
|
119
|
-
// Push a stash containing a change to seed.txt; then dirty seed.txt
|
|
120
|
-
//
|
|
143
|
+
test("collects a warning instead of applying when the working tree is not clean", () => {
|
|
144
|
+
// Push a stash containing a change to seed.txt; then dirty seed.txt before
|
|
145
|
+
// the audit runs. Startup recovery must leave the tree untouched and ask
|
|
146
|
+
// the user to apply the retained backup stash manually.
|
|
121
147
|
writeFileSync(join(repo, "seed.txt"), "stashed\n");
|
|
122
148
|
const marker = `gsd-preflight-stash:M005:42:1700:zz`;
|
|
123
149
|
git(repo, "stash", "push", "-m", `gsd-preflight-stash [${marker}]`);
|
|
124
150
|
|
|
125
|
-
// Dirty the working tree so apply will conflict.
|
|
126
151
|
writeFileSync(join(repo, "seed.txt"), "conflicting modification\n");
|
|
127
152
|
|
|
128
153
|
const result = auditOrphanedPreflightStashes(repo, () => true);
|
|
129
154
|
|
|
130
155
|
assert.equal(result.applied.length, 0);
|
|
131
156
|
assert.equal(result.warnings.length, 1);
|
|
132
|
-
assert.match(result.warnings[0], /
|
|
157
|
+
assert.match(result.warnings[0], /not auto-applied/);
|
|
158
|
+
assert.match(result.warnings[0], /working tree not clean/);
|
|
133
159
|
assert.match(result.warnings[0], /M005/);
|
|
134
160
|
assert.match(result.warnings[0], /git stash apply/);
|
|
161
|
+
assert.equal(readFileSync(join(repo, "seed.txt"), "utf-8"), "conflicting modification\n");
|
|
135
162
|
|
|
136
163
|
const list = git(repo, "stash", "list");
|
|
137
164
|
assert.match(list, /gsd-preflight-stash:M005:/);
|
|
@@ -169,6 +196,63 @@ describe("auditOrphanedPreflightStashes", () => {
|
|
|
169
196
|
"second run must NOT warn — files are already restored from first run",
|
|
170
197
|
);
|
|
171
198
|
});
|
|
199
|
+
|
|
200
|
+
test("warns instead of silently skipping when only some stash untracked files were restored", () => {
|
|
201
|
+
// Cursor Bugbot caught: isAlreadyRestoredUntrackedStatus treated a dirty
|
|
202
|
+
// tree as fully restored when every *current* untracked path appeared in
|
|
203
|
+
// the stash, without requiring every *stash* untracked path to be present.
|
|
204
|
+
// A partial restore (only some files recovered) was misread as the
|
|
205
|
+
// idempotent steady state, so the audit no-oped and the remaining pre-merge
|
|
206
|
+
// files stayed missing with no warning.
|
|
207
|
+
writeFileSync(join(repo, "first.txt"), "first\n");
|
|
208
|
+
writeFileSync(join(repo, "second.txt"), "second\n");
|
|
209
|
+
const marker = `gsd-preflight-stash:M007:42:1700000000000:partial`;
|
|
210
|
+
git(repo, "stash", "push", "--include-untracked", "-m", `gsd-preflight-stash [${marker}]`);
|
|
211
|
+
|
|
212
|
+
// Both files are stashed away.
|
|
213
|
+
assert.equal(existsSync(join(repo, "first.txt")), false);
|
|
214
|
+
assert.equal(existsSync(join(repo, "second.txt")), false);
|
|
215
|
+
|
|
216
|
+
// Simulate a partial restore: only first.txt came back; second.txt is still
|
|
217
|
+
// missing from the working tree.
|
|
218
|
+
writeFileSync(join(repo, "first.txt"), "first\n");
|
|
219
|
+
|
|
220
|
+
const result = auditOrphanedPreflightStashes(repo, () => true);
|
|
221
|
+
|
|
222
|
+
// Must NOT be treated as already-restored: second.txt is still missing, so
|
|
223
|
+
// the audit must surface a manual-recovery warning rather than no-op.
|
|
224
|
+
assert.equal(result.applied.length, 0);
|
|
225
|
+
assert.equal(result.warnings.length, 1, "partial restore must warn, not silently no-op");
|
|
226
|
+
assert.match(result.warnings[0], /not auto-applied/);
|
|
227
|
+
assert.match(result.warnings[0], /working tree not clean/);
|
|
228
|
+
assert.match(result.warnings[0], /M007/);
|
|
229
|
+
assert.match(result.warnings[0], /git stash apply/);
|
|
230
|
+
|
|
231
|
+
// The stash entry must remain so the user can recover second.txt manually.
|
|
232
|
+
const list = git(repo, "stash", "list");
|
|
233
|
+
assert.match(list, /gsd-preflight-stash:M007:/);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("fully restored multi-file untracked stash stays a silent no-op", () => {
|
|
237
|
+
// Guards the other direction of the set-equality fix: when EVERY stash
|
|
238
|
+
// untracked file is present in the working tree, the genuine idempotent
|
|
239
|
+
// steady state must still be recognized and skipped without warning, even
|
|
240
|
+
// when the stash captured more than one file.
|
|
241
|
+
writeFileSync(join(repo, "alpha.txt"), "alpha\n");
|
|
242
|
+
writeFileSync(join(repo, "beta.txt"), "beta\n");
|
|
243
|
+
const marker = `gsd-preflight-stash:M008:42:1700000000000:multi`;
|
|
244
|
+
git(repo, "stash", "push", "--include-untracked", "-m", `gsd-preflight-stash [${marker}]`);
|
|
245
|
+
|
|
246
|
+
const first = auditOrphanedPreflightStashes(repo, () => true);
|
|
247
|
+
assert.equal(first.applied.length, 1, "first run applies both files");
|
|
248
|
+
assert.equal(first.warnings.length, 0);
|
|
249
|
+
assert.equal(existsSync(join(repo, "alpha.txt")), true);
|
|
250
|
+
assert.equal(existsSync(join(repo, "beta.txt")), true);
|
|
251
|
+
|
|
252
|
+
const second = auditOrphanedPreflightStashes(repo, () => true);
|
|
253
|
+
assert.equal(second.applied.length, 0, "second run skips");
|
|
254
|
+
assert.equal(second.warnings.length, 0, "fully restored multi-file stash must not warn");
|
|
255
|
+
});
|
|
172
256
|
});
|
|
173
257
|
|
|
174
258
|
test("_isAlreadyRestoredApplyError detects the git stash apply already-exists error", () => {
|
|
@@ -54,9 +54,12 @@ const ALLOWED_IMPORTERS = new Set([
|
|
|
54
54
|
// explicit degraded-mode fallback when DB has no task rows (warns on use)
|
|
55
55
|
"gsd/reactive-graph.ts",
|
|
56
56
|
// recovery path: explicit pre-migration/DB-unavailable fallback branches
|
|
57
|
-
|
|
57
|
+
// (verifyExpectedArtifact extracted here from auto-recovery.ts)
|
|
58
|
+
"gsd/artifact-verification.ts",
|
|
58
59
|
// diagnostics-only surfaces: report on projections, make no dispatch decisions
|
|
59
60
|
"gsd/doctor.ts",
|
|
61
|
+
// diagnostics-only: compares PLAN.md task checkboxes against DB status
|
|
62
|
+
"gsd/doctor-engine-checks.ts",
|
|
60
63
|
// display/telemetry-only surfaces
|
|
61
64
|
"gsd/workspace-index.ts",
|
|
62
65
|
"gsd/visualizer-data.ts",
|
|
@@ -94,6 +94,16 @@ test("plan-slice prompt: absence checks use negated quiet searches", () => {
|
|
|
94
94
|
assert.ok(result.includes("count commands exit 1 when they find zero matches"));
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
test("plan-slice prompt: npm package existence rule is stated during generation", () => {
|
|
98
|
+
const result = loadPrompt("plan-slice", { ...BASE_VARS, commitInstruction: "Do not commit." });
|
|
99
|
+
assert.ok(result.includes("reference only packages that exist on the public npm registry"));
|
|
100
|
+
assert.ok(result.includes("remove or correct any package name that is not real"));
|
|
101
|
+
// The post-unit pre-execution gate parses package names from require/import
|
|
102
|
+
// patterns too, not just install commands, so the rule must cover that scope.
|
|
103
|
+
assert.ok(result.includes("require('...')"));
|
|
104
|
+
assert.ok(result.includes("import ... from '...'"));
|
|
105
|
+
});
|
|
106
|
+
|
|
97
107
|
test("plan-slice prompt: footer references gsd_plan_slice tool, not direct write", () => {
|
|
98
108
|
const result = loadPrompt("plan-slice", { ...BASE_VARS, commitInstruction: "Do not commit." });
|
|
99
109
|
assert.ok(
|
|
@@ -8,6 +8,7 @@ import { tmpdir } from 'node:os';
|
|
|
8
8
|
|
|
9
9
|
import { openDatabase, closeDatabase, insertMilestone, insertSlice, insertTask, getSlice, getSliceTasks, getTask, getGateResults, updateTaskStatus } from '../gsd-db.ts';
|
|
10
10
|
import { handlePlanSlice } from '../tools/plan-slice.ts';
|
|
11
|
+
import { handlePlanTask } from '../tools/plan-task.ts';
|
|
11
12
|
import { parsePlan } from '../parsers-legacy.ts';
|
|
12
13
|
import { deriveState, invalidateStateCache } from '../state.ts';
|
|
13
14
|
|
|
@@ -511,15 +512,113 @@ test('handlePlanSlice leaves omitted enrichment fields empty instead of renderin
|
|
|
511
512
|
}
|
|
512
513
|
});
|
|
513
514
|
|
|
514
|
-
test('handlePlanSlice
|
|
515
|
+
test('handlePlanSlice accepts metadata-only payloads without deleting existing tasks', async () => {
|
|
515
516
|
const base = makeTmpBase();
|
|
516
517
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
517
518
|
|
|
518
519
|
try {
|
|
519
520
|
seedParentSlice();
|
|
520
|
-
const
|
|
521
|
-
assert.ok('error' in
|
|
522
|
-
assert.
|
|
521
|
+
const first = await handlePlanSlice(validParams(), base);
|
|
522
|
+
assert.ok(!('error' in first), `unexpected error: ${'error' in first ? first.error : ''}`);
|
|
523
|
+
assert.equal(getSliceTasks('M001', 'S02').length, 2);
|
|
524
|
+
|
|
525
|
+
const second = await handlePlanSlice({
|
|
526
|
+
milestoneId: 'M001',
|
|
527
|
+
sliceId: 'S02',
|
|
528
|
+
goal: 'Persist updated slice metadata before incremental tasks.',
|
|
529
|
+
successCriteria: '- Metadata renders before task planning',
|
|
530
|
+
proofLevel: 'unit',
|
|
531
|
+
integrationClosure: 'Task details follow through gsd_plan_task.',
|
|
532
|
+
observabilityImpact: 'Progress survives between tool calls.',
|
|
533
|
+
}, base);
|
|
534
|
+
assert.ok(!('error' in second), `unexpected error: ${'error' in second ? second.error : ''}`);
|
|
535
|
+
assert.equal(getSlice('M001', 'S02')?.goal, 'Persist updated slice metadata before incremental tasks.');
|
|
536
|
+
assert.deepEqual(getSliceTasks('M001', 'S02').map((task) => task.id), ['T01', 'T02']);
|
|
537
|
+
|
|
538
|
+
const third = await handlePlanSlice({ ...validParams(), tasks: [] }, base);
|
|
539
|
+
assert.ok(!('error' in third), `unexpected error: ${'error' in third ? third.error : ''}`);
|
|
540
|
+
assert.deepEqual(getSliceTasks('M001', 'S02').map((task) => task.id), ['T01', 'T02']);
|
|
541
|
+
} finally {
|
|
542
|
+
cleanup(base);
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
test('handlePlanSlice metadata-only on a fresh sketch slice keeps is_sketch set and renders no PLAN.md (#1027)', async () => {
|
|
547
|
+
const base = makeTmpBase();
|
|
548
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
549
|
+
|
|
550
|
+
try {
|
|
551
|
+
insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
|
|
552
|
+
insertSlice({ id: 'S02', milestoneId: 'M001', title: 'Planning slice', status: 'pending', demo: 'Rendered plans exist.', isSketch: true });
|
|
553
|
+
|
|
554
|
+
// The incremental flow's first call carries metadata only (no tasks). It
|
|
555
|
+
// must NOT error (renderPlanFromDb throws on a task-less slice), and it must
|
|
556
|
+
// NOT clear the sketch flag — clearing it without a PLAN.md would leave the
|
|
557
|
+
// slice out of refining with no plan artifact, breaking sketch/plan signaling.
|
|
558
|
+
const result = await handlePlanSlice({
|
|
559
|
+
milestoneId: 'M001',
|
|
560
|
+
sliceId: 'S02',
|
|
561
|
+
goal: 'Persist slice metadata before any tasks exist.',
|
|
562
|
+
}, base);
|
|
563
|
+
assert.ok(!('error' in result), `unexpected error: ${'error' in result ? result.error : ''}`);
|
|
564
|
+
assert.equal(getSlice('M001', 'S02')?.goal, 'Persist slice metadata before any tasks exist.');
|
|
565
|
+
assert.equal(getSliceTasks('M001', 'S02').length, 0);
|
|
566
|
+
assert.equal(getSlice('M001', 'S02')?.is_sketch, 1, 'sketch flag must stay set until a task-bearing plan renders');
|
|
567
|
+
|
|
568
|
+
const planPath = join(base, '.gsd', 'phases', '01-test', '01-02-PLAN.md');
|
|
569
|
+
assert.ok(!existsSync(planPath), 'no PLAN.md should be rendered until the first task is planned');
|
|
570
|
+
|
|
571
|
+
invalidateStateCache();
|
|
572
|
+
const after = await deriveState(base);
|
|
573
|
+
assert.equal(after.phase, 'refining', 'a task-less sketch slice stays in refining');
|
|
574
|
+
} finally {
|
|
575
|
+
cleanup(base);
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
test('handlePlanTask materializes the slice PLAN.md and clears the sketch flag on the incremental path (#1027)', async () => {
|
|
580
|
+
const base = makeTmpBase();
|
|
581
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
582
|
+
|
|
583
|
+
try {
|
|
584
|
+
insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
|
|
585
|
+
insertSlice({ id: 'S02', milestoneId: 'M001', title: 'Planning slice', status: 'pending', demo: 'Rendered plans exist.', isSketch: true });
|
|
586
|
+
|
|
587
|
+
const sliceResult = await handlePlanSlice({
|
|
588
|
+
milestoneId: 'M001',
|
|
589
|
+
sliceId: 'S02',
|
|
590
|
+
goal: 'Incrementally planned slice.',
|
|
591
|
+
successCriteria: '- The slice plan is built up one task at a time',
|
|
592
|
+
}, base);
|
|
593
|
+
assert.ok(!('error' in sliceResult), `unexpected error: ${'error' in sliceResult ? sliceResult.error : ''}`);
|
|
594
|
+
|
|
595
|
+
const taskResult = await handlePlanTask({
|
|
596
|
+
milestoneId: 'M001',
|
|
597
|
+
sliceId: 'S02',
|
|
598
|
+
taskId: 'T01',
|
|
599
|
+
title: 'First incremental task',
|
|
600
|
+
description: 'Implement the first task added through gsd_plan_task.',
|
|
601
|
+
estimate: '30m',
|
|
602
|
+
files: ['src/resources/extensions/gsd/tools/plan-task.ts'],
|
|
603
|
+
verify: 'node --test src/resources/extensions/gsd/tests/plan-task.test.ts',
|
|
604
|
+
inputs: ['src/resources/extensions/gsd/tools/plan-milestone.ts'],
|
|
605
|
+
expectedOutput: ['src/resources/extensions/gsd/tools/plan-task.ts'],
|
|
606
|
+
}, base);
|
|
607
|
+
assert.ok(!('error' in taskResult), `unexpected error: ${'error' in taskResult ? taskResult.error : ''}`);
|
|
608
|
+
|
|
609
|
+
// The first incremental task materializes the canonical slice PLAN.md with
|
|
610
|
+
// the task present, and clears the sketch flag now that a plan exists.
|
|
611
|
+
const planPath = join(base, '.gsd', 'phases', '01-test', '01-02-PLAN.md');
|
|
612
|
+
assert.ok(existsSync(planPath), 'slice PLAN.md should exist after the first task is planned');
|
|
613
|
+
const parsedPlan = parsePlan(readFileSync(planPath, 'utf-8'));
|
|
614
|
+
assert.equal(parsedPlan.goal, 'Incrementally planned slice.');
|
|
615
|
+
assert.equal(parsedPlan.tasks.length, 1);
|
|
616
|
+
assert.equal(parsedPlan.tasks[0]?.id, 'T01');
|
|
617
|
+
assert.equal(getSlice('M001', 'S02')?.is_sketch, 0, 'sketch flag must clear once the first task renders a plan');
|
|
618
|
+
|
|
619
|
+
invalidateStateCache();
|
|
620
|
+
const after = await deriveState(base);
|
|
621
|
+
assert.notEqual(after.phase, 'refining', 'a planned slice leaves refining');
|
|
523
622
|
} finally {
|
|
524
623
|
cleanup(base);
|
|
525
624
|
}
|
|
@@ -4,7 +4,7 @@ import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync, writeFileSync
|
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { tmpdir } from 'node:os';
|
|
6
6
|
|
|
7
|
-
import { openDatabase, closeDatabase, insertMilestone, insertSlice, insertTask, getTask } from '../gsd-db.ts';
|
|
7
|
+
import { openDatabase, closeDatabase, insertMilestone, insertSlice, insertTask, getSlice, getTask, getGateResults } from '../gsd-db.ts';
|
|
8
8
|
import { handlePlanTask } from '../tools/plan-task.ts';
|
|
9
9
|
import { parseTaskPlanFile } from '../files.ts';
|
|
10
10
|
|
|
@@ -65,6 +65,25 @@ test('handlePlanTask writes planning state and renders task plan', async () => {
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
test('handlePlanTask seeds execute-task gate rows for incremental planning', async () => {
|
|
69
|
+
const base = makeTmpBase();
|
|
70
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
seedParent();
|
|
74
|
+
const result = await handlePlanTask(validParams(), base);
|
|
75
|
+
assert.ok(!('error' in result), `unexpected error: ${'error' in result ? result.error : ''}`);
|
|
76
|
+
|
|
77
|
+
const gateIds = getGateResults('M001', 'S02', 'task')
|
|
78
|
+
.filter((gate) => gate.task_id === 'T02')
|
|
79
|
+
.map((gate) => gate.gate_id)
|
|
80
|
+
.sort();
|
|
81
|
+
assert.deepEqual(gateIds, ['Q5', 'Q6', 'Q7']);
|
|
82
|
+
} finally {
|
|
83
|
+
cleanup(base);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
68
87
|
test('handlePlanTask rejects invalid payloads', async () => {
|
|
69
88
|
const base = makeTmpBase();
|
|
70
89
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
@@ -170,6 +189,30 @@ test('handlePlanTask surfaces render failures without changing parse-visible tas
|
|
|
170
189
|
}
|
|
171
190
|
});
|
|
172
191
|
|
|
192
|
+
test('handlePlanTask keeps the sketch flag set when the flat-phase slice plan sync fails (#1083)', async () => {
|
|
193
|
+
const base = makeTmpBase();
|
|
194
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
|
|
198
|
+
insertSlice({ id: 'S02', milestoneId: 'M001', title: 'Planning slice', status: 'pending', demo: 'Rendered plans exist.', isSketch: true });
|
|
199
|
+
|
|
200
|
+
// The per-task render writes T02-PLAN.md and succeeds, but the flat-phase
|
|
201
|
+
// slice re-render (the canonical PLAN.md that embeds task checkboxes) targets
|
|
202
|
+
// phases/01-test/01-02-PLAN.md. Pre-creating that path as a directory forces
|
|
203
|
+
// EISDIR on the slice sync, so the canonical slice plan never reflects the
|
|
204
|
+
// task. The sketch flag must therefore stay set — the slice keeps refining —
|
|
205
|
+
// instead of leaving the slice out of refining over a stale plan.
|
|
206
|
+
mkdirSync(join(base, '.gsd', 'phases', '01-test', '01-02-PLAN.md'), { recursive: true });
|
|
207
|
+
|
|
208
|
+
const result = await handlePlanTask(validParams(), base);
|
|
209
|
+
assert.equal(getSlice('M001', 'S02')?.is_sketch, 1, 'sketch flag must stay set when the canonical slice plan could not sync');
|
|
210
|
+
assert.ok(getTask('M001', 'S02', 'T02'), 'the task itself is still persisted so the slice can re-sync on retry');
|
|
211
|
+
} finally {
|
|
212
|
+
cleanup(base);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
173
216
|
test('handlePlanTask reruns idempotently and refreshes parse-visible state', async () => {
|
|
174
217
|
const base = makeTmpBase();
|
|
175
218
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
@@ -10,7 +10,7 @@ import * as os from 'node:os';
|
|
|
10
10
|
import { openDatabase, closeDatabase } from '../gsd-db.ts';
|
|
11
11
|
import { handleCompleteTask } from '../tools/complete-task.ts';
|
|
12
12
|
import { readEvents } from '../workflow-events.ts';
|
|
13
|
-
import { readManifest } from '../workflow-manifest.ts';
|
|
13
|
+
import { flushManifest, readManifest } from '../workflow-manifest.ts';
|
|
14
14
|
|
|
15
15
|
function tempDir(): string {
|
|
16
16
|
return fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-post-hook-'));
|
|
@@ -115,8 +115,9 @@ test('post-mutation-hook: state-manifest.json exists after handleCompleteTask',
|
|
|
115
115
|
const result = await handleCompleteTask(makeCompleteTaskParams(), base);
|
|
116
116
|
assert.ok(!('error' in result), `handler should succeed, got: ${JSON.stringify(result)}`);
|
|
117
117
|
|
|
118
|
+
await flushManifest(base);
|
|
118
119
|
const manifestPath = path.join(base, '.gsd', 'state-manifest.json');
|
|
119
|
-
assert.ok(fs.existsSync(manifestPath), 'state-manifest.json should exist after
|
|
120
|
+
assert.ok(fs.existsSync(manifestPath), 'state-manifest.json should exist after manifest flush');
|
|
120
121
|
} finally {
|
|
121
122
|
closeDatabase();
|
|
122
123
|
cleanupDir(base);
|
|
@@ -131,6 +132,7 @@ test('post-mutation-hook: manifest has version 1 and includes completed task', a
|
|
|
131
132
|
|
|
132
133
|
try {
|
|
133
134
|
await handleCompleteTask(makeCompleteTaskParams(), base);
|
|
135
|
+
await flushManifest(base);
|
|
134
136
|
|
|
135
137
|
const manifest = readManifest(base);
|
|
136
138
|
assert.ok(manifest !== null, 'manifest should be readable');
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
getSlice,
|
|
18
18
|
} from "../gsd-db.ts";
|
|
19
19
|
import { autoHealSketchFlags } from "../state-reconciliation/drift/sketch-flag.ts";
|
|
20
|
-
import { deriveState, deriveStateFromDb } from "../state.ts";
|
|
20
|
+
import { deriveState, deriveStateFromDb, invalidateStateCache } from "../state.ts";
|
|
21
|
+
import { reconcileBeforeDispatch } from "../state-reconciliation.ts";
|
|
21
22
|
import { resolveDispatch } from "../auto-dispatch.ts";
|
|
22
23
|
import type { DispatchContext } from "../auto-dispatch.ts";
|
|
23
24
|
|
|
@@ -174,7 +175,7 @@ test("ADR-011: refining + flag flipped OFF mid-milestone → falls through to pl
|
|
|
174
175
|
}
|
|
175
176
|
});
|
|
176
177
|
|
|
177
|
-
test("ADR-011: existing PLAN
|
|
178
|
+
test("ADR-011: existing PLAN + stale sketch flag heals via reconcileBeforeDispatch, then dispatch routes past refining (progressive_planning ON)", async (t) => {
|
|
178
179
|
const originalCwd = process.cwd();
|
|
179
180
|
const base = makeFixtureBase();
|
|
180
181
|
t.after(() => cleanup(base, originalCwd));
|
|
@@ -188,11 +189,22 @@ test("ADR-011: existing PLAN heals stale sketch flag via deriveStateFromDb (prog
|
|
|
188
189
|
);
|
|
189
190
|
process.chdir(base);
|
|
190
191
|
|
|
191
|
-
//
|
|
192
|
-
//
|
|
192
|
+
// Derivation is pure (ADR-017): a stale sketch flag (PLAN on disk but
|
|
193
|
+
// is_sketch=1) yields 'refining' and must NOT mutate the DB. Healing is
|
|
194
|
+
// owned by reconcileBeforeDispatch, which runs before every dispatch.
|
|
195
|
+
invalidateStateCache();
|
|
196
|
+
const beforeReconcile = await deriveStateFromDb(base);
|
|
197
|
+
assert.equal(beforeReconcile.activeSlice?.id, "S02");
|
|
198
|
+
assert.equal(beforeReconcile.phase, "refining", "derive alone must not heal the stale sketch flag");
|
|
199
|
+
assert.equal(getSlice("M001", "S02")?.is_sketch, 1, "derive must not mutate is_sketch");
|
|
200
|
+
|
|
201
|
+
const reconcile = await reconcileBeforeDispatch(base);
|
|
202
|
+
assert.equal(reconcile.ok, true);
|
|
203
|
+
assert.equal(getSlice("M001", "S02")?.is_sketch, 0, "reconcile clears the stale sketch flag once PLAN exists");
|
|
204
|
+
|
|
205
|
+
invalidateStateCache();
|
|
193
206
|
const state = await deriveStateFromDb(base);
|
|
194
|
-
assert.equal(
|
|
195
|
-
assert.equal(state.phase, "planning", "derive: phase advances past refining once flag is healed");
|
|
207
|
+
assert.equal(state.phase, "planning", "re-derive advances past refining once the flag is healed");
|
|
196
208
|
|
|
197
209
|
const ctx: DispatchContext = {
|
|
198
210
|
basePath: base,
|
|
@@ -229,7 +241,7 @@ test("ADR-011: autoHealSketchFlags flips is_sketch=0 when PLAN file exists", asy
|
|
|
229
241
|
assert.equal(getSlice("M001", "S02")?.is_sketch, 0, "post-heal: flag cleared");
|
|
230
242
|
});
|
|
231
243
|
|
|
232
|
-
test("ADR-011:
|
|
244
|
+
test("ADR-011: reconcileBeforeDispatch auto-heals stale sketch flag when PLAN exists", async (t) => {
|
|
233
245
|
const originalCwd = process.cwd();
|
|
234
246
|
const base = makeFixtureBase();
|
|
235
247
|
t.after(() => cleanup(base, originalCwd));
|
|
@@ -244,12 +256,23 @@ test("ADR-011: deriveStateFromDb auto-heals stale sketch flag when PLAN exists",
|
|
|
244
256
|
);
|
|
245
257
|
process.chdir(base);
|
|
246
258
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
259
|
+
// Pure derivation reports the stale flag as 'refining' without repairing it.
|
|
260
|
+
invalidateStateCache();
|
|
261
|
+
const stale = await deriveStateFromDb(base);
|
|
262
|
+
assert.equal(stale.phase, "refining", "derive alone must not heal the stale flag");
|
|
263
|
+
assert.equal(getSlice("M001", "S02")?.is_sketch, 1, "is_sketch unchanged before reconcile");
|
|
264
|
+
|
|
265
|
+
// Reconciliation owns the repair (ADR-017 stale-sketch-flag drift handler).
|
|
266
|
+
const reconcile = await reconcileBeforeDispatch(base);
|
|
267
|
+
assert.equal(reconcile.ok, true);
|
|
268
|
+
assert.equal(getSlice("M001", "S02")?.is_sketch, 0, "reconcile should clear stale is_sketch");
|
|
269
|
+
|
|
270
|
+
invalidateStateCache();
|
|
271
|
+
const healed = await deriveStateFromDb(base);
|
|
272
|
+
assert.equal(healed.phase, "planning", "state advances past refining once the stale flag is healed");
|
|
250
273
|
});
|
|
251
274
|
|
|
252
|
-
test("ADR-011: deriveState
|
|
275
|
+
test("ADR-011: deriveState stays pure across worktree/canonical-root; healing belongs to reconcile at the canonical artifact root", async (t) => {
|
|
253
276
|
const originalCwd = process.cwd();
|
|
254
277
|
const base = makeFixtureBase();
|
|
255
278
|
t.after(() => cleanup(base, originalCwd));
|
|
@@ -265,9 +288,22 @@ test("ADR-011: deriveState uses canonical artifact root for sketch-flag healing"
|
|
|
265
288
|
mkdirSync(worktreePath, { recursive: true });
|
|
266
289
|
process.chdir(worktreePath);
|
|
267
290
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
291
|
+
// Deriving from the worktree with reads routed to the canonical artifact
|
|
292
|
+
// root resolves DB state but never mutates it (ADR-017: derive is pure).
|
|
293
|
+
// The legacy projectRootForReads-driven heal is gone; healing now happens
|
|
294
|
+
// in reconcileBeforeDispatch, which auto runs against canonicalProjectRoot.
|
|
295
|
+
invalidateStateCache();
|
|
296
|
+
const beforeReconcile = await deriveState(worktreePath, { projectRootForReads: base });
|
|
297
|
+
assert.equal(beforeReconcile.phase, "refining", "derive alone must not heal, even via projectRootForReads");
|
|
298
|
+
assert.equal(getSlice("M001", "S02")?.is_sketch, 1, "derive must not mutate is_sketch");
|
|
299
|
+
|
|
300
|
+
const reconcile = await reconcileBeforeDispatch(base);
|
|
301
|
+
assert.equal(reconcile.ok, true);
|
|
302
|
+
assert.equal(getSlice("M001", "S02")?.is_sketch, 0, "reconcile at the canonical root heals the stale flag");
|
|
303
|
+
|
|
304
|
+
invalidateStateCache();
|
|
305
|
+
const healed = await deriveState(worktreePath, { projectRootForReads: base });
|
|
306
|
+
assert.equal(healed.phase, "planning", "re-derive advances past refining once healed at the canonical root");
|
|
271
307
|
});
|
|
272
308
|
|
|
273
309
|
test("ADR-011: schema v16 is idempotent — re-opening DB preserves is_sketch and sketch_scope columns", async (t) => {
|
|
@@ -72,6 +72,25 @@ function setupDependencyFixture(
|
|
|
72
72
|
mkdirSync(targetSliceDir, { recursive: true });
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
function setupFlatPhaseSlicePlan(base: string): void {
|
|
76
|
+
const phaseDir = join(base, ".gsd", "phases", "01-flat-phase");
|
|
77
|
+
mkdirSync(phaseDir, { recursive: true });
|
|
78
|
+
writeFileSync(
|
|
79
|
+
join(phaseDir, "01-01-PLAN.md"),
|
|
80
|
+
[
|
|
81
|
+
"# S01: Flat phase slice",
|
|
82
|
+
"",
|
|
83
|
+
"## Tasks",
|
|
84
|
+
"",
|
|
85
|
+
"- [ ] **T01: Flat task** `est:15m`",
|
|
86
|
+
"",
|
|
87
|
+
"## Verification",
|
|
88
|
+
"",
|
|
89
|
+
"- Rendered prompt points at this slice plan.",
|
|
90
|
+
].join("\n"),
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
75
94
|
// ─── inlineDependencySummaries truncation ─────────────────────────────────────
|
|
76
95
|
|
|
77
96
|
describe("prompt-budget: inlineDependencySummaries truncation", () => {
|
|
@@ -412,6 +431,26 @@ describe("prompt-budget: execute-task template", () => {
|
|
|
412
431
|
}
|
|
413
432
|
});
|
|
414
433
|
|
|
434
|
+
it("flat-phase execute-task fallback points at the slice plan", async () => {
|
|
435
|
+
const base = createFixtureBase();
|
|
436
|
+
try {
|
|
437
|
+
setupFlatPhaseSlicePlan(base);
|
|
438
|
+
|
|
439
|
+
const prompt = await buildExecuteTaskPrompt("M001", "S01", "Slice", "T01", "Task", base, {
|
|
440
|
+
level: "minimal",
|
|
441
|
+
sessionContextWindow: 128_000,
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
assert.match(
|
|
445
|
+
prompt,
|
|
446
|
+
/Task plan not found at dispatch time\. Read `\.gsd\/phases\/01-flat-phase\/01-01-PLAN\.md` before executing\./,
|
|
447
|
+
);
|
|
448
|
+
assert.doesNotMatch(prompt, /\.gsd\/phases\/01-flat-phase\/tasks\/T01-PLAN\.md/);
|
|
449
|
+
} finally {
|
|
450
|
+
cleanup(base);
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
|
|
415
454
|
it("verificationBudget format varies with context window size", () => {
|
|
416
455
|
const budget128K = computeBudgets(128_000);
|
|
417
456
|
const budget1M = computeBudgets(1_000_000);
|
|
@@ -566,6 +605,25 @@ describe("prompt-budget: execute-task builder truncation pattern", () => {
|
|
|
566
605
|
});
|
|
567
606
|
|
|
568
607
|
describe("prompt-budget: reactive-execute builder", () => {
|
|
608
|
+
it("flat-phase subagent fallback points at the slice plan", async () => {
|
|
609
|
+
const base = createFixtureBase();
|
|
610
|
+
try {
|
|
611
|
+
setupFlatPhaseSlicePlan(base);
|
|
612
|
+
|
|
613
|
+
const prompt = await buildReactiveExecutePrompt("M001", "Milestone", "S01", "Slice", ["T01"], base, undefined, {
|
|
614
|
+
sessionContextWindow: 128_000,
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
assert.match(
|
|
618
|
+
prompt,
|
|
619
|
+
/Task plan not found at dispatch time\. Read `\.gsd\/phases\/01-flat-phase\/01-01-PLAN\.md` before executing\./,
|
|
620
|
+
);
|
|
621
|
+
assert.doesNotMatch(prompt, /\.gsd\/phases\/01-flat-phase\/tasks\/T01-PLAN\.md/);
|
|
622
|
+
} finally {
|
|
623
|
+
cleanup(base);
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
|
|
569
627
|
it("caps dependency carry-forward per ready subagent", async () => {
|
|
570
628
|
const base = createFixtureBase();
|
|
571
629
|
try {
|
|
@@ -533,6 +533,7 @@ test("plan-milestone prompt references DB-backed planning tool and explicitly fo
|
|
|
533
533
|
assert.match(prompt, /Do \*\*not\*\* write `?\{\{outputPath\}\}`?, `?ROADMAP\.md`?, or other planning artifacts manually/i);
|
|
534
534
|
assert.match(prompt, /NEVER call `gsd_plan_milestone` with only `milestoneId` and `sliceId`/);
|
|
535
535
|
assert.match(prompt, /gsd_plan_slice/);
|
|
536
|
+
assert.match(prompt, /gsd_plan_task/);
|
|
536
537
|
});
|
|
537
538
|
|
|
538
539
|
test("discuss prompts forbid gsd_plan_milestone slice-only tool args", () => {
|
|
@@ -548,12 +549,12 @@ test("plan-slice prompt no longer frames direct PLAN writes as the source of tru
|
|
|
548
549
|
assert.match(prompt, /Do \*\*not\*\* rely on direct `PLAN\.md` writes as the source of truth/i);
|
|
549
550
|
});
|
|
550
551
|
|
|
551
|
-
test("plan-slice prompt explicitly names
|
|
552
|
+
test("plan-slice prompt explicitly names incremental DB-backed planning tools", () => {
|
|
552
553
|
const prompt = readPrompt("plan-slice");
|
|
553
554
|
assert.match(prompt, /gsd_plan_slice/);
|
|
554
555
|
assert.match(prompt, /gsd_plan_task/);
|
|
555
|
-
|
|
556
|
-
assert.match(prompt, /DB-backed
|
|
556
|
+
assert.match(prompt, /Persist incrementally through DB-backed tools/i);
|
|
557
|
+
assert.match(prompt, /DB-backed tools are the canonical write path/i);
|
|
557
558
|
});
|
|
558
559
|
|
|
559
560
|
test("plan-slice prompt does not instruct direct file writes as a primary step", () => {
|
|
@@ -562,11 +563,12 @@ test("plan-slice prompt does not instruct direct file writes as a primary step",
|
|
|
562
563
|
assert.doesNotMatch(prompt, /^\d+\.\s+Write `?\{\{outputPath\}\}`?\s*$/m);
|
|
563
564
|
});
|
|
564
565
|
|
|
565
|
-
test("plan-slice prompt
|
|
566
|
+
test("plan-slice prompt requires per-task incremental persistence", () => {
|
|
566
567
|
const prompt = readPrompt("plan-slice");
|
|
567
|
-
// gsd_plan_slice persists tasks in its transaction — no separate gsd_plan_task calls needed
|
|
568
568
|
assert.match(prompt, /gsd_plan_task/);
|
|
569
|
-
assert.match(prompt, /
|
|
569
|
+
assert.match(prompt, /omit `tasks` for this metadata call/i);
|
|
570
|
+
assert.match(prompt, /call `gsd_plan_task` once per task/i);
|
|
571
|
+
assert.doesNotMatch(prompt, /do not call `gsd_plan_task`/i);
|
|
570
572
|
});
|
|
571
573
|
|
|
572
574
|
test("plan-slice prompt references web app UAT guidance when planning browser work", () => {
|