@opengsd/gsd-pi 1.2.0-dev.5457a158 → 1.2.0-dev.822c9439
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/headless-events.js +7 -5
- package/dist/mcp-server.js +2 -1
- package/dist/resource-loader.d.ts +9 -5
- package/dist/resource-loader.js +114 -6
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +5 -4
- package/dist/resources/extensions/async-jobs/async-bash-tool.js +30 -64
- package/dist/resources/extensions/async-jobs/await-tool.js +80 -12
- package/dist/resources/extensions/async-jobs/index.js +65 -0
- package/dist/resources/extensions/async-jobs/job-manager.js +12 -1
- package/dist/resources/extensions/bg-shell/bg-shell-command.js +6 -6
- package/dist/resources/extensions/bg-shell/bg-shell-tool.js +10 -7
- package/dist/resources/extensions/bg-shell/overlay.js +9 -6
- package/dist/resources/extensions/bg-shell/process-manager.js +54 -25
- package/dist/resources/extensions/bg-shell/readiness-detector.js +11 -0
- package/dist/resources/extensions/browser-tools/engine/managed-gsd-browser.js +209 -88
- package/dist/resources/extensions/browser-tools/engine/selection.js +73 -5
- package/dist/resources/extensions/browser-tools/index.js +69 -12
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +3 -2
- package/dist/resources/extensions/gsd/auto/custom-verify-retry-store.js +17 -2
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +33 -13
- package/dist/resources/extensions/gsd/auto/dispatch-history.js +105 -0
- package/dist/resources/extensions/gsd/auto/dispatch-key.js +37 -0
- package/dist/resources/extensions/gsd/auto/loop.js +4 -1
- package/dist/resources/extensions/gsd/auto/orchestrator.js +89 -54
- package/dist/resources/extensions/gsd/auto/phases.js +49 -6
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +11 -34
- package/dist/resources/extensions/gsd/auto-dispatch.js +50 -58
- package/dist/resources/extensions/gsd/auto-model-selection.js +36 -13
- package/dist/resources/extensions/gsd/auto-post-unit.js +30 -12
- package/dist/resources/extensions/gsd/auto-prompts.js +78 -19
- package/dist/resources/extensions/gsd/auto-start.js +12 -12
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +45 -21
- package/dist/resources/extensions/gsd/auto-unit-tool-scope.js +5 -4
- package/dist/resources/extensions/gsd/auto-verification.js +23 -30
- package/dist/resources/extensions/gsd/auto-worktree.js +14 -1
- package/dist/resources/extensions/gsd/auto.js +37 -1
- package/dist/resources/extensions/gsd/blocked-models.js +28 -0
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +26 -6
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +23 -6
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +19 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +172 -59
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +302 -80
- package/dist/resources/extensions/gsd/browser-daemon-auto-prep.js +83 -0
- package/dist/resources/extensions/gsd/browser-evidence.js +8 -2
- package/dist/resources/extensions/gsd/closeout-wizard.js +92 -0
- package/dist/resources/extensions/gsd/commands/context.js +16 -2
- package/dist/resources/extensions/gsd/commands-handlers.js +46 -3
- package/dist/resources/extensions/gsd/consent-question.js +353 -0
- package/dist/resources/extensions/gsd/consent-verdict.js +63 -0
- package/dist/resources/extensions/gsd/constants.js +0 -2
- package/dist/resources/extensions/gsd/crash-recovery.js +8 -3
- package/dist/resources/extensions/gsd/db/queries.js +26 -0
- package/dist/resources/extensions/gsd/dispatch-guard.js +10 -35
- package/dist/resources/extensions/gsd/doctor-engine-checks.js +5 -5
- package/dist/resources/extensions/gsd/doctor-git-checks.js +2 -18
- package/dist/resources/extensions/gsd/engine-hook-contract.js +70 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +30 -10
- package/dist/resources/extensions/gsd/files.js +33 -19
- package/dist/resources/extensions/gsd/gsd-command-home.js +22 -12
- package/dist/resources/extensions/gsd/gsd-db.js +2 -1
- package/dist/resources/extensions/gsd/guidance.js +60 -0
- package/dist/resources/extensions/gsd/guided-flow.js +6 -3
- package/dist/resources/extensions/gsd/markdown-renderer.js +10 -0
- package/dist/resources/extensions/gsd/mcp-filter.js +2 -19
- package/dist/resources/extensions/gsd/milestone-closeout.js +85 -24
- package/dist/resources/extensions/gsd/milestone-planning-persistence.js +2 -2
- package/dist/resources/extensions/gsd/milestone-reopen-events.js +3 -5
- package/dist/resources/extensions/gsd/parsers-legacy.js +16 -4
- package/dist/resources/extensions/gsd/preferences-models.js +2 -2
- package/dist/resources/extensions/gsd/projection-flush.js +7 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +3 -3
- package/dist/resources/extensions/gsd/prompts/execute-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/prompts/run-uat.md +7 -5
- package/dist/resources/extensions/gsd/prompts/system.md +5 -2
- package/dist/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
- package/dist/resources/extensions/gsd/reactive-graph.js +8 -1
- package/dist/resources/extensions/gsd/roadmap-slices.js +25 -3
- package/dist/resources/extensions/gsd/safety/destructive-confirmation.js +108 -0
- package/dist/resources/extensions/gsd/session-lock.js +1 -1
- package/dist/resources/extensions/gsd/state.js +5 -0
- package/dist/resources/extensions/gsd/tool-contract.js +14 -3
- package/dist/resources/extensions/gsd/tool-presentation-plan.js +4 -4
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +3 -2
- package/dist/resources/extensions/gsd/tools/complete-slice.js +22 -12
- package/dist/resources/extensions/gsd/tools/complete-task.js +3 -2
- package/dist/resources/extensions/gsd/tools/exec-tool.js +5 -0
- package/dist/resources/extensions/gsd/tools/plan-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/plan-task.js +2 -2
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +2 -2
- package/dist/resources/extensions/gsd/tools/reopen-milestone.js +2 -2
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/reopen-task.js +2 -2
- package/dist/resources/extensions/gsd/tools/replan-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +67 -2
- package/dist/resources/extensions/gsd/uat-policy.js +42 -16
- package/dist/resources/extensions/gsd/unit-context-composer.js +65 -0
- package/dist/resources/extensions/gsd/unit-registry.js +7 -20
- package/dist/resources/extensions/gsd/verdict-parser.js +1 -1
- package/dist/resources/extensions/gsd/verification-verdict.js +2 -1
- package/dist/resources/extensions/gsd/web-app-uat.js +45 -8
- package/dist/resources/extensions/gsd/workflow-event-ledger.js +91 -0
- package/dist/resources/extensions/gsd/workflow-event-vocabulary.js +46 -0
- package/dist/resources/extensions/gsd/workflow-events.js +6 -18
- package/dist/resources/extensions/gsd/workflow-reconcile.js +21 -56
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +3 -2
- package/dist/resources/extensions/gsd/worktree-manager.js +7 -1
- package/dist/resources/extensions/gsd/worktree.js +8 -1
- package/dist/resources/extensions/search-the-web/native-search.js +5 -3
- package/dist/resources/extensions/shared/browser-contract.js +59 -0
- package/dist/resources/extensions/shared/gsd-browser-cli.js +116 -6
- package/dist/resources/shared/gsd-browser-path-sync.js +214 -0
- package/dist/resources/shared/package-manager-detection.js +1 -1
- package/dist/resources/shared/package.json +3 -0
- package/dist/resources/skills/create-skill/SKILL.md +3 -0
- package/dist/resources/skills/create-skill/references/executable-code.md +1 -1
- package/dist/resources/skills/create-skill/references/skill-structure.md +1 -0
- package/dist/resources/skills/create-skill/workflows/add-reference.md +8 -3
- package/dist/resources/skills/create-skill/workflows/add-script.md +4 -2
- package/dist/resources/skills/create-skill/workflows/add-template.md +3 -1
- package/dist/resources/skills/create-skill/workflows/add-workflow.md +8 -3
- package/dist/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
- package/dist/resources/skills/create-skill/workflows/verify-skill.md +9 -4
- package/dist/resources/skills/spike-wrap-up/SKILL.md +9 -9
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-check.d.ts +2 -0
- package/dist/update-check.js +24 -1
- package/dist/update-cmd.js +20 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +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.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/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- 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-paths-manifest.json +11 -11
- package/dist/web/standalone/.next/server/chunks/8357.js +2 -2
- 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/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/{796.cf859a427a2cb2ac.js → 796.e0bdc932325d7e03.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{webpack-fbea77b5f9953368.js → webpack-f0285ce91d4ec9ef.js} +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/dist/web/standalone/package.json +1 -1
- package/package.json +1 -1
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/dist/rpc.d.ts +1 -0
- package/packages/contracts/dist/rpc.d.ts.map +1 -1
- package/packages/contracts/dist/rpc.js.map +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts +5 -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 +5 -0
- 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.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +7 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js +8 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.js +11 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.js +4 -4
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.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 +3 -1
- 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/cli.js +10 -5
- package/packages/mcp-server/dist/cli.js.map +1 -1
- package/packages/mcp-server/dist/moonshot-tool-schema.d.ts +29 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.d.ts.map +1 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.js +50 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +4 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +18 -18
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +99 -38
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +5 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/harness/env/nodejs.d.ts +1 -0
- package/packages/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/harness/env/nodejs.js +34 -3
- package/packages/pi-agent-core/dist/harness/env/nodejs.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 +3 -0
- package/packages/pi-agent-core/dist/index.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/README.md +1 -0
- package/packages/pi-ai/dist/image-models.generated.d.ts +2 -2
- package/packages/pi-ai/dist/image-models.generated.js +6 -6
- package/packages/pi-ai/dist/image-models.generated.js.map +1 -1
- package/packages/pi-ai/dist/index.d.ts +2 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +2 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +239 -153
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +256 -145
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +12 -7
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +5 -0
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +12 -3
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +7 -3
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.d.ts +9 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.js +34 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +6 -2
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/packages/pi-ai/package.json +3 -2
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +19 -13
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/provider-readiness.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/provider-readiness.js +13 -6
- package/packages/pi-coding-agent/dist/core/provider-readiness.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +11 -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 +53 -11
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/shell.d.ts +28 -2
- package/packages/pi-coding-agent/dist/utils/shell.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/shell.js +56 -10
- package/packages/pi-coding-agent/dist/utils/shell.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +9 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +5 -4
- package/src/resources/extensions/async-jobs/async-bash-cancel.test.ts +360 -0
- package/src/resources/extensions/async-jobs/async-bash-tool.ts +33 -56
- package/src/resources/extensions/async-jobs/await-tool.test.ts +139 -0
- package/src/resources/extensions/async-jobs/await-tool.ts +82 -12
- package/src/resources/extensions/async-jobs/index.ts +79 -0
- package/src/resources/extensions/async-jobs/job-manager.ts +21 -1
- package/src/resources/extensions/bg-shell/bg-shell-command.ts +6 -6
- package/src/resources/extensions/bg-shell/bg-shell-tool.ts +10 -6
- package/src/resources/extensions/bg-shell/overlay.ts +9 -5
- package/src/resources/extensions/bg-shell/process-manager.ts +50 -25
- package/src/resources/extensions/bg-shell/readiness-detector.ts +12 -0
- package/src/resources/extensions/bg-shell/tests/lifecycle-and-utilities.test.ts +48 -1
- package/src/resources/extensions/browser-tools/engine/managed-gsd-browser.ts +265 -98
- package/src/resources/extensions/browser-tools/engine/selection.ts +90 -4
- package/src/resources/extensions/browser-tools/index.ts +71 -13
- package/src/resources/extensions/browser-tools/tests/browser-engine-selection.test.mjs +83 -13
- package/src/resources/extensions/browser-tools/tests/gsd-browser-launch-config.test.mjs +40 -1
- package/src/resources/extensions/browser-tools/tests/managed-gsd-browser-tools.test.mjs +136 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +3 -2
- package/src/resources/extensions/gsd/auto/custom-verify-retry-store.ts +21 -3
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +32 -9
- package/src/resources/extensions/gsd/auto/dispatch-history.ts +152 -0
- package/src/resources/extensions/gsd/auto/dispatch-key.ts +39 -0
- package/src/resources/extensions/gsd/auto/loop.ts +4 -1
- package/src/resources/extensions/gsd/auto/orchestrator.ts +98 -56
- package/src/resources/extensions/gsd/auto/phases.ts +65 -26
- package/src/resources/extensions/gsd/auto/session.ts +3 -0
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +18 -48
- package/src/resources/extensions/gsd/auto-dispatch.ts +48 -61
- package/src/resources/extensions/gsd/auto-model-selection.ts +41 -12
- package/src/resources/extensions/gsd/auto-post-unit.ts +33 -12
- package/src/resources/extensions/gsd/auto-prompts.ts +115 -35
- package/src/resources/extensions/gsd/auto-start.ts +12 -14
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +83 -28
- package/src/resources/extensions/gsd/auto-unit-tool-scope.ts +4 -4
- package/src/resources/extensions/gsd/auto-verification.ts +26 -28
- package/src/resources/extensions/gsd/auto-worktree.ts +14 -1
- package/src/resources/extensions/gsd/auto.ts +44 -1
- package/src/resources/extensions/gsd/blocked-models.ts +49 -0
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +34 -5
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +23 -6
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +211 -59
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +350 -86
- package/src/resources/extensions/gsd/browser-daemon-auto-prep.ts +108 -0
- package/src/resources/extensions/gsd/browser-evidence.ts +18 -2
- package/src/resources/extensions/gsd/closeout-wizard.ts +102 -0
- package/src/resources/extensions/gsd/commands/context.ts +16 -2
- package/src/resources/extensions/gsd/commands-handlers.ts +46 -3
- package/src/resources/extensions/gsd/consent-question.ts +431 -0
- package/src/resources/extensions/gsd/consent-verdict.ts +86 -0
- package/src/resources/extensions/gsd/constants.ts +0 -3
- package/src/resources/extensions/gsd/crash-recovery.ts +10 -2
- package/src/resources/extensions/gsd/db/queries.ts +37 -0
- package/src/resources/extensions/gsd/dispatch-guard.ts +8 -31
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +5 -4
- package/src/resources/extensions/gsd/doctor-git-checks.ts +2 -19
- package/src/resources/extensions/gsd/engine-hook-contract.ts +79 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +49 -9
- package/src/resources/extensions/gsd/files.ts +33 -12
- package/src/resources/extensions/gsd/gsd-command-home.ts +13 -3
- package/src/resources/extensions/gsd/gsd-db.ts +4 -3
- package/src/resources/extensions/gsd/guidance.ts +78 -0
- package/src/resources/extensions/gsd/guided-flow.ts +21 -26
- package/src/resources/extensions/gsd/markdown-renderer.ts +11 -0
- package/src/resources/extensions/gsd/mcp-filter.ts +2 -23
- package/src/resources/extensions/gsd/milestone-closeout.ts +109 -24
- package/src/resources/extensions/gsd/milestone-planning-persistence.ts +2 -2
- package/src/resources/extensions/gsd/milestone-reopen-events.ts +3 -6
- package/src/resources/extensions/gsd/parsers-legacy.ts +16 -4
- package/src/resources/extensions/gsd/preferences-models.ts +2 -1
- package/src/resources/extensions/gsd/projection-flush.ts +20 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +3 -3
- package/src/resources/extensions/gsd/prompts/execute-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/quick-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/replan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/prompts/run-uat.md +7 -5
- package/src/resources/extensions/gsd/prompts/system.md +5 -2
- package/src/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
- package/src/resources/extensions/gsd/reactive-graph.ts +11 -1
- package/src/resources/extensions/gsd/roadmap-slices.ts +28 -3
- package/src/resources/extensions/gsd/safety/destructive-confirmation.ts +134 -0
- package/src/resources/extensions/gsd/session-lock.ts +1 -1
- package/src/resources/extensions/gsd/state.ts +5 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +97 -1
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +198 -26
- package/src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts +65 -3
- package/src/resources/extensions/gsd/tests/blocked-models.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/browser-automation-contract-fixture.ts +39 -0
- package/src/resources/extensions/gsd/tests/browser-contract.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/browser-daemon-auto-prep.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/consent-question.test.ts +351 -0
- package/src/resources/extensions/gsd/tests/custom-verify-retry-store.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +10 -10
- package/src/resources/extensions/gsd/tests/destructive-confirmation.test.ts +303 -0
- package/src/resources/extensions/gsd/tests/discuss-routing-fixes.test.ts +12 -2
- package/src/resources/extensions/gsd/tests/dispatch-history.test.ts +273 -0
- package/src/resources/extensions/gsd/tests/dispatch-run-uat-browser-tools.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/doctor-git-checks-terminal.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/dynamic-bash-no-cap.test.ts +132 -0
- package/src/resources/extensions/gsd/tests/engine-hook-contract.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/exec-graceful-kill.test.ts +193 -0
- package/src/resources/extensions/gsd/tests/exec-tool.test.ts +29 -1
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +35 -1
- package/src/resources/extensions/gsd/tests/gsd-command-home.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/guidance.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +2 -6
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +7 -11
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +20 -58
- package/src/resources/extensions/gsd/tests/integration/gsd-integration-fixture.ts +80 -0
- package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +199 -0
- package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +95 -4
- package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/oauth-api-model-routing.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +138 -0
- package/src/resources/extensions/gsd/tests/phases-terminal-complete-idempotent.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +63 -2
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +124 -6
- package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +19 -1
- package/src/resources/extensions/gsd/tests/teardown-chdir-failure-clears-registry.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/tool-unavailable-retry.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/transport-gate-double-complete.test.ts +139 -0
- package/src/resources/extensions/gsd/tests/uat-policy.test.ts +112 -29
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/uok-audit-unified.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/web-app-uat.test.ts +44 -1
- package/src/resources/extensions/gsd/tests/workflow-events.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/workflow-reconcile.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +273 -38
- package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/worktree.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/write-gate-seam.test.ts +358 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +67 -1
- package/src/resources/extensions/gsd/tool-contract.ts +38 -3
- package/src/resources/extensions/gsd/tool-presentation-plan.ts +4 -4
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +3 -2
- package/src/resources/extensions/gsd/tools/complete-slice.ts +22 -12
- package/src/resources/extensions/gsd/tools/complete-task.ts +3 -2
- package/src/resources/extensions/gsd/tools/exec-tool.ts +4 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/plan-task.ts +2 -2
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +2 -2
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +2 -2
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/reopen-task.ts +2 -2
- package/src/resources/extensions/gsd/tools/replan-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +81 -2
- package/src/resources/extensions/gsd/uat-policy.ts +62 -16
- package/src/resources/extensions/gsd/unit-context-composer.ts +99 -0
- package/src/resources/extensions/gsd/unit-registry.ts +7 -20
- package/src/resources/extensions/gsd/verdict-parser.ts +1 -1
- package/src/resources/extensions/gsd/verification-verdict.ts +4 -2
- package/src/resources/extensions/gsd/web-app-uat.ts +51 -8
- package/src/resources/extensions/gsd/workflow-event-ledger.ts +131 -0
- package/src/resources/extensions/gsd/workflow-event-vocabulary.ts +59 -0
- package/src/resources/extensions/gsd/workflow-events.ts +12 -20
- package/src/resources/extensions/gsd/workflow-reconcile.ts +29 -62
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +3 -8
- package/src/resources/extensions/gsd/worktree-manager.ts +6 -1
- package/src/resources/extensions/gsd/worktree.ts +7 -1
- package/src/resources/extensions/search-the-web/native-search.ts +5 -3
- package/src/resources/extensions/shared/browser-contract.ts +66 -0
- package/src/resources/extensions/shared/gsd-browser-cli.ts +141 -6
- package/src/resources/shared/gsd-browser-path-sync.ts +273 -0
- package/src/resources/shared/package-manager-detection.ts +1 -1
- package/src/resources/shared/package.json +3 -0
- package/src/resources/skills/create-skill/SKILL.md +3 -0
- package/src/resources/skills/create-skill/references/executable-code.md +1 -1
- package/src/resources/skills/create-skill/references/skill-structure.md +1 -0
- package/src/resources/skills/create-skill/workflows/add-reference.md +8 -3
- package/src/resources/skills/create-skill/workflows/add-script.md +4 -2
- package/src/resources/skills/create-skill/workflows/add-template.md +3 -1
- package/src/resources/skills/create-skill/workflows/add-workflow.md +8 -3
- package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
- package/src/resources/skills/create-skill/workflows/verify-skill.md +9 -4
- package/src/resources/skills/spike-wrap-up/SKILL.md +9 -9
- package/dist/resources/extensions/gsd/user-input-boundary.js +0 -218
- package/dist/resources/skills/gsd-browser/SKILL.md +0 -41
- package/src/resources/extensions/gsd/tests/user-input-boundary.test.ts +0 -173
- package/src/resources/extensions/gsd/user-input-boundary.ts +0 -216
- package/src/resources/skills/gsd-browser/SKILL.md +0 -41
- /package/dist/web/standalone/.next/static/{2p9Rv9pQflAxCBbGVI2vb → yWwBo-w09Y_W-nmeeWFRp}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{2p9Rv9pQflAxCBbGVI2vb → yWwBo-w09Y_W-nmeeWFRp}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Structural invariant: parsers-legacy is banned from decision paths (ADR-017).
|
|
2
|
+
//
|
|
3
|
+
// The DB is the single source of truth; `.gsd/*.md` files are projections.
|
|
4
|
+
// Dispatch/gate/completion code must read state via gsd-db queries (e.g.
|
|
5
|
+
// getMilestoneSliceSummaries), never by parsing markdown projections.
|
|
6
|
+
//
|
|
7
|
+
// Two assertions:
|
|
8
|
+
// 1. Decision-path modules must NOT import parsers-legacy (hard ban).
|
|
9
|
+
// 2. Every other importer must be on the explicit allowlist below, each with
|
|
10
|
+
// a one-line justification. When this test fails, do not extend the
|
|
11
|
+
// allowlist for a decision path — add/extend a query in db/queries.ts and
|
|
12
|
+
// read the DB instead.
|
|
13
|
+
|
|
14
|
+
import test from "node:test";
|
|
15
|
+
import assert from "node:assert/strict";
|
|
16
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
17
|
+
import { join, relative } from "node:path";
|
|
18
|
+
|
|
19
|
+
const extensionsDir = join(process.cwd(), "src/resources/extensions");
|
|
20
|
+
|
|
21
|
+
// Modules that make dispatch/gate/completion decisions. Importing
|
|
22
|
+
// parsers-legacy here is always a violation, allowlist or not.
|
|
23
|
+
const BANNED_DECISION_PATHS = new Set([
|
|
24
|
+
"gsd/auto-direct-dispatch.ts",
|
|
25
|
+
"gsd/dispatch-guard.ts",
|
|
26
|
+
"gsd/auto-verification.ts",
|
|
27
|
+
"gsd/auto-dispatch.ts",
|
|
28
|
+
"gsd/auto-post-unit.ts",
|
|
29
|
+
"gsd/milestone-closeout.ts",
|
|
30
|
+
"gsd/auto/phases.ts",
|
|
31
|
+
"gsd/auto/orchestrator.ts",
|
|
32
|
+
"gsd/auto/loop.ts",
|
|
33
|
+
"gsd/tools/complete-slice.ts",
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
// Legitimate importers. Each entry carries its justification; anything not
|
|
37
|
+
// listed here (and not under a tests/ directory) fails the test.
|
|
38
|
+
const ALLOWED_IMPORTERS = new Set([
|
|
39
|
+
// migration/import: parses markdown to populate the DB
|
|
40
|
+
"gsd/md-importer.ts",
|
|
41
|
+
"gsd/workflow-migration.ts",
|
|
42
|
+
"gsd/migration-auto-check.ts",
|
|
43
|
+
// drift detection: compares markdown projection against DB by design
|
|
44
|
+
"gsd/state-reconciliation/drift/roadmap.ts",
|
|
45
|
+
// stale-render detection + render verification helpers over rendered output
|
|
46
|
+
"gsd/markdown-renderer.ts",
|
|
47
|
+
// pre-migration fallback: deriveState must work before the DB exists
|
|
48
|
+
"gsd/state.ts",
|
|
49
|
+
// explicit degraded-mode fallback when DB has no task rows (warns on use)
|
|
50
|
+
"gsd/reactive-graph.ts",
|
|
51
|
+
// recovery path: explicit pre-migration/DB-unavailable fallback branches
|
|
52
|
+
"gsd/auto-recovery.ts",
|
|
53
|
+
// diagnostics-only surfaces: report on projections, make no dispatch decisions
|
|
54
|
+
"gsd/doctor.ts",
|
|
55
|
+
// display/telemetry-only surfaces
|
|
56
|
+
"gsd/workspace-index.ts",
|
|
57
|
+
"gsd/visualizer-data.ts",
|
|
58
|
+
// prompt context text (display strings injected into unit prompts)
|
|
59
|
+
"gsd/auto-prompts.ts",
|
|
60
|
+
// cold-path maintenance command (branch cleanup messaging)
|
|
61
|
+
"gsd/commands-maintenance.ts",
|
|
62
|
+
// display-only GitHub issue/PR body sync
|
|
63
|
+
"github-sync/sync.ts",
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
const IMPORT_RE = /from\s+["'][^"']*parsers-legacy(?:\.js)?["']|import\(\s*["'][^"']*parsers-legacy(?:\.js)?["']\s*\)|require\(\s*["'][^"']*parsers-legacy(?:\.js)?["']\s*\)/;
|
|
67
|
+
|
|
68
|
+
function walkTsFiles(root: string): string[] {
|
|
69
|
+
const out: string[] = [];
|
|
70
|
+
const stack: string[] = [root];
|
|
71
|
+
|
|
72
|
+
while (stack.length > 0) {
|
|
73
|
+
const dir = stack.pop()!;
|
|
74
|
+
let entries;
|
|
75
|
+
try {
|
|
76
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
77
|
+
} catch {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
for (const ent of entries) {
|
|
81
|
+
const full = join(dir, ent.name);
|
|
82
|
+
if (ent.isDirectory()) {
|
|
83
|
+
if (ent.name === "tests" || ent.name === "node_modules") continue;
|
|
84
|
+
stack.push(full);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (!ent.isFile()) continue;
|
|
88
|
+
if (!ent.name.endsWith(".ts")) continue;
|
|
89
|
+
if (ent.name.startsWith(".")) continue;
|
|
90
|
+
if (ent.name.endsWith(".test.ts")) continue;
|
|
91
|
+
out.push(full);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function findImporters(): string[] {
|
|
98
|
+
const importers: string[] = [];
|
|
99
|
+
for (const file of walkTsFiles(extensionsDir)) {
|
|
100
|
+
const rel = relative(extensionsDir, file).split("\\").join("/");
|
|
101
|
+
if (rel === "gsd/parsers-legacy.ts") continue; // the module itself
|
|
102
|
+
const content = readFileSync(file, "utf-8");
|
|
103
|
+
if (IMPORT_RE.test(content)) importers.push(rel);
|
|
104
|
+
}
|
|
105
|
+
return importers.sort();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
test("decision-path modules do not import parsers-legacy (ADR-017)", () => {
|
|
109
|
+
const violations = findImporters().filter((rel) => BANNED_DECISION_PATHS.has(rel));
|
|
110
|
+
assert.deepEqual(
|
|
111
|
+
violations,
|
|
112
|
+
[],
|
|
113
|
+
`Decision-path modules must read the DB (db/queries.ts, e.g. getMilestoneSliceSummaries), ` +
|
|
114
|
+
`not parse .gsd/*.md projections. Violations:\n ${violations.join("\n ")}`,
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test("every parsers-legacy importer is on the explicit allowlist", () => {
|
|
119
|
+
const unexpected = findImporters().filter((rel) => !ALLOWED_IMPORTERS.has(rel));
|
|
120
|
+
assert.deepEqual(
|
|
121
|
+
unexpected,
|
|
122
|
+
[],
|
|
123
|
+
`New parsers-legacy importer(s) detected:\n ${unexpected.join("\n ")}\n` +
|
|
124
|
+
`If this is migration/drift/display-only code, add it to ALLOWED_IMPORTERS ` +
|
|
125
|
+
`with a one-line justification. If it makes dispatch/gate/completion ` +
|
|
126
|
+
`decisions, read the DB instead (db/queries.ts).`,
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("allowlist has no stale entries", () => {
|
|
131
|
+
const importers = new Set(findImporters());
|
|
132
|
+
const stale = [...ALLOWED_IMPORTERS].filter((rel) => !importers.has(rel));
|
|
133
|
+
assert.deepEqual(
|
|
134
|
+
stale,
|
|
135
|
+
[],
|
|
136
|
+
`Allowlist entries no longer import parsers-legacy — remove them:\n ${stale.join("\n ")}`,
|
|
137
|
+
);
|
|
138
|
+
});
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* phases-terminal-complete-idempotent.test.ts — Regression test for the
|
|
3
|
+
* milestone-completion double-closeout guard in `runPreDispatch`.
|
|
4
|
+
*
|
|
5
|
+
* When `runPreDispatch` observes that the active milestone (or the last one
|
|
6
|
+
* the session was working on) has already been closed by another session,
|
|
7
|
+
* the loop must exit cleanly with `{ action: "break", reason:
|
|
8
|
+
* "milestone-complete" }` and must NOT replay merge, desktop / cmux
|
|
9
|
+
* notifications, unit closeout, or `stopAuto`.
|
|
10
|
+
*
|
|
11
|
+
* There are two `deriveState` shapes the guard must cover, and both are
|
|
12
|
+
* exercised below because the canonical one is easy to miss:
|
|
13
|
+
*
|
|
14
|
+
* 1. `state.phase === "complete"` with `activeMilestone` set, so the
|
|
15
|
+
* loop computes a non-null `mid` from `state.activeMilestone.id`.
|
|
16
|
+
*
|
|
17
|
+
* 2. `state.phase === "complete"` with `activeMilestone: null` — the
|
|
18
|
+
* canonical "all milestones complete" return from `deriveState`
|
|
19
|
+
* (state.ts:613, state.ts:1293). `mid` is undefined here, so the
|
|
20
|
+
* guard must consult `s.currentMilestoneId` (the milestone this
|
|
21
|
+
* session was working on) instead. Without coverage for this case,
|
|
22
|
+
* a guard that only inspects `mid` is unreachable in production and
|
|
23
|
+
* the loop replays `_runMilestoneMergeOnceWithStashRestore`,
|
|
24
|
+
* `sendDesktopNotification("All milestones complete!")`,
|
|
25
|
+
* `logCmuxEvent`, and `stopAuto` — exactly the duplicate side
|
|
26
|
+
* effects this fix exists to prevent.
|
|
27
|
+
*
|
|
28
|
+
* Both fire-paths of the guard (`completionStopInProgress` and a
|
|
29
|
+
* DB-already-closed milestone) are exercised against each shape.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
33
|
+
import { runPreDispatch } from "../auto/phases.ts";
|
|
34
|
+
import {
|
|
35
|
+
openDatabase,
|
|
36
|
+
closeDatabase,
|
|
37
|
+
insertMilestone,
|
|
38
|
+
isDbAvailable,
|
|
39
|
+
} from "../gsd-db.ts";
|
|
40
|
+
|
|
41
|
+
const { assertTrue, report } = createTestContext();
|
|
42
|
+
|
|
43
|
+
type SideEffect = string;
|
|
44
|
+
|
|
45
|
+
interface ScenarioOverrides {
|
|
46
|
+
completionStopInProgress: boolean;
|
|
47
|
+
sideEffects: SideEffect[];
|
|
48
|
+
notifications: Array<{ message: string; level?: string }>;
|
|
49
|
+
// When `null`, deriveState returns activeMilestone: null (canonical
|
|
50
|
+
// all-complete path). Otherwise, returns an activeMilestone with this id.
|
|
51
|
+
activeMilestone: { id: string; title: string } | null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function makeIterationContext(overrides: ScenarioOverrides): any {
|
|
55
|
+
const basePath = "/tmp/gsd-test-terminal-complete";
|
|
56
|
+
const recordSideEffect = (label: string) => {
|
|
57
|
+
overrides.sideEffects.push(label);
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
ctx: {
|
|
61
|
+
ui: {
|
|
62
|
+
notify(message: string, level?: string) {
|
|
63
|
+
overrides.notifications.push({ message, level });
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
pi: {},
|
|
68
|
+
s: {
|
|
69
|
+
basePath,
|
|
70
|
+
originalBasePath: basePath,
|
|
71
|
+
canonicalProjectRoot: basePath,
|
|
72
|
+
resourceVersionOnStart: "test",
|
|
73
|
+
// Critical for the `!mid` canonical path: even when deriveState returns
|
|
74
|
+
// activeMilestone: null, the session still remembers the milestone it
|
|
75
|
+
// was working on, and we use that to look up DB status.
|
|
76
|
+
currentMilestoneId: "M001",
|
|
77
|
+
currentUnit: null,
|
|
78
|
+
milestoneMergedInPhases: false,
|
|
79
|
+
completionStopInProgress: overrides.completionStopInProgress,
|
|
80
|
+
},
|
|
81
|
+
prefs: undefined,
|
|
82
|
+
iteration: 1,
|
|
83
|
+
flowId: "test-flow",
|
|
84
|
+
nextSeq: () => 1,
|
|
85
|
+
deps: {
|
|
86
|
+
checkResourcesStale() {
|
|
87
|
+
return null;
|
|
88
|
+
},
|
|
89
|
+
invalidateAllCaches() {},
|
|
90
|
+
async preDispatchHealthGate() {
|
|
91
|
+
return { proceed: true, fixesApplied: [] };
|
|
92
|
+
},
|
|
93
|
+
async deriveState() {
|
|
94
|
+
return {
|
|
95
|
+
phase: "complete",
|
|
96
|
+
activeMilestone: overrides.activeMilestone,
|
|
97
|
+
activeSlice: null,
|
|
98
|
+
activeTask: null,
|
|
99
|
+
// Registry says M001 is complete and no other milestones exist, so
|
|
100
|
+
// `incomplete.length === 0 && state.registry.length > 0` evaluates
|
|
101
|
+
// true in the `!mid` branch.
|
|
102
|
+
registry: [{ id: "M001", status: "complete" }],
|
|
103
|
+
nextAction: "complete",
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
syncCmuxSidebar() {},
|
|
107
|
+
setActiveMilestoneId() {},
|
|
108
|
+
reconcileMergeState() {
|
|
109
|
+
return "clean";
|
|
110
|
+
},
|
|
111
|
+
// Anything below this point MUST NOT be reached when the guard fires.
|
|
112
|
+
preflightCleanRoot() {
|
|
113
|
+
recordSideEffect("preflight");
|
|
114
|
+
return { ok: true, stashPushed: false, stashMarker: null };
|
|
115
|
+
},
|
|
116
|
+
postflightPopStash() {
|
|
117
|
+
recordSideEffect("postflight");
|
|
118
|
+
return { ok: true, needsManualRecovery: false };
|
|
119
|
+
},
|
|
120
|
+
lifecycle: {
|
|
121
|
+
exitMilestone() {
|
|
122
|
+
recordSideEffect("merge");
|
|
123
|
+
return { ok: true };
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
sendDesktopNotification() {
|
|
127
|
+
recordSideEffect("desktop-notify");
|
|
128
|
+
},
|
|
129
|
+
logCmuxEvent() {
|
|
130
|
+
recordSideEffect("cmux-event");
|
|
131
|
+
},
|
|
132
|
+
async closeoutUnit() {
|
|
133
|
+
recordSideEffect("closeout-unit");
|
|
134
|
+
},
|
|
135
|
+
buildSnapshotOpts() {
|
|
136
|
+
return {};
|
|
137
|
+
},
|
|
138
|
+
async stopAuto(_ctx: unknown, _pi: unknown, reason?: string) {
|
|
139
|
+
recordSideEffect(`stop:${reason ?? ""}`);
|
|
140
|
+
},
|
|
141
|
+
async pauseAuto() {
|
|
142
|
+
recordSideEffect("pause");
|
|
143
|
+
},
|
|
144
|
+
emitJournalEvent() {
|
|
145
|
+
recordSideEffect("journal-event");
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function runScenario(opts: {
|
|
152
|
+
label: string;
|
|
153
|
+
completionStopInProgress: boolean;
|
|
154
|
+
activeMilestone: { id: string; title: string } | null;
|
|
155
|
+
// When true, the test opens an in-memory DB and inserts M001 with status
|
|
156
|
+
// "complete" so the DB-closed branch of the guard can fire.
|
|
157
|
+
dbAlreadyClosed: boolean;
|
|
158
|
+
}): Promise<void> {
|
|
159
|
+
if (isDbAvailable()) {
|
|
160
|
+
closeDatabase();
|
|
161
|
+
}
|
|
162
|
+
if (opts.dbAlreadyClosed) {
|
|
163
|
+
openDatabase(":memory:");
|
|
164
|
+
insertMilestone({ id: "M001", title: "Milestone one", status: "complete" });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
const sideEffects: SideEffect[] = [];
|
|
169
|
+
const notifications: Array<{ message: string; level?: string }> = [];
|
|
170
|
+
const ic = makeIterationContext({
|
|
171
|
+
completionStopInProgress: opts.completionStopInProgress,
|
|
172
|
+
sideEffects,
|
|
173
|
+
notifications,
|
|
174
|
+
activeMilestone: opts.activeMilestone,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const result = await runPreDispatch(ic, {
|
|
178
|
+
recentUnits: [],
|
|
179
|
+
stuckRecoveryAttempts: 0,
|
|
180
|
+
consecutiveFinalizeTimeouts: 0,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
assertTrue(
|
|
184
|
+
result.action === "break",
|
|
185
|
+
`${opts.label}: returns break instead of next`,
|
|
186
|
+
);
|
|
187
|
+
if (result.action === "break") {
|
|
188
|
+
assertTrue(
|
|
189
|
+
result.reason === "milestone-complete",
|
|
190
|
+
`${opts.label}: reason is milestone-complete (got "${result.reason}")`,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
assertTrue(
|
|
194
|
+
sideEffects.length === 0,
|
|
195
|
+
`${opts.label}: no closeout side effects replayed (saw [${sideEffects.join(", ")}])`,
|
|
196
|
+
);
|
|
197
|
+
assertTrue(
|
|
198
|
+
notifications.length === 0,
|
|
199
|
+
`${opts.label}: no user notifications emitted (saw ${notifications.length})`,
|
|
200
|
+
);
|
|
201
|
+
} finally {
|
|
202
|
+
if (isDbAvailable()) {
|
|
203
|
+
closeDatabase();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
console.log("\n=== Terminal complete is idempotent across both observer paths ===");
|
|
209
|
+
|
|
210
|
+
// ── state.phase === "complete" branch (activeMilestone non-null) ────────────
|
|
211
|
+
await runScenario({
|
|
212
|
+
label: "phase=complete + mid set + completionStopInProgress",
|
|
213
|
+
completionStopInProgress: true,
|
|
214
|
+
activeMilestone: { id: "M001", title: "Milestone one" },
|
|
215
|
+
dbAlreadyClosed: false,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
await runScenario({
|
|
219
|
+
label: "phase=complete + mid set + DB closed",
|
|
220
|
+
completionStopInProgress: false,
|
|
221
|
+
activeMilestone: { id: "M001", title: "Milestone one" },
|
|
222
|
+
dbAlreadyClosed: true,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// ── Canonical !mid "all milestones complete" sub-branch ────────────────────
|
|
226
|
+
// deriveState returns phase: "complete" with activeMilestone: null. The
|
|
227
|
+
// session's s.currentMilestoneId (M001) is what the guard consults.
|
|
228
|
+
await runScenario({
|
|
229
|
+
label: "phase=complete + activeMilestone=null + completionStopInProgress",
|
|
230
|
+
completionStopInProgress: true,
|
|
231
|
+
activeMilestone: null,
|
|
232
|
+
dbAlreadyClosed: false,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
await runScenario({
|
|
236
|
+
label: "phase=complete + activeMilestone=null + DB closed",
|
|
237
|
+
completionStopInProgress: false,
|
|
238
|
+
activeMilestone: null,
|
|
239
|
+
dbAlreadyClosed: true,
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
report();
|
|
@@ -145,7 +145,7 @@ function createBasicTask(): void {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
function createTaskWithoutVerify(): void {
|
|
148
|
+
function createTaskWithoutVerify(status = "pending"): void {
|
|
149
149
|
insertMilestone({ id: "M001" });
|
|
150
150
|
insertSlice({
|
|
151
151
|
id: "S01",
|
|
@@ -159,7 +159,7 @@ function createTaskWithoutVerify(): void {
|
|
|
159
159
|
sliceId: "S01",
|
|
160
160
|
milestoneId: "M001",
|
|
161
161
|
title: "Task without host verification",
|
|
162
|
-
status
|
|
162
|
+
status,
|
|
163
163
|
planning: {
|
|
164
164
|
description: "Task intentionally missing runnable verification",
|
|
165
165
|
estimate: "1h",
|
|
@@ -558,6 +558,32 @@ describe("Post-execution blocking failure retry bypass", () => {
|
|
|
558
558
|
assert.equal(pauseAutoMock.mock.callCount(), 1);
|
|
559
559
|
assert.equal(s.pendingVerificationRetry, null);
|
|
560
560
|
|
|
561
|
+
const notifyMessages = ctx.ui.notify.mock.calls.map((c: { arguments: unknown[] }) =>
|
|
562
|
+
String(c.arguments[0])
|
|
563
|
+
);
|
|
564
|
+
assert.ok(
|
|
565
|
+
notifyMessages.some(
|
|
566
|
+
(m: string) =>
|
|
567
|
+
m.includes(".gsd/PREFERENCES.md") &&
|
|
568
|
+
m.includes("task-plan Verify command") &&
|
|
569
|
+
m.includes("/gsd next")
|
|
570
|
+
),
|
|
571
|
+
"no-host-checks notification should guide the user to add verification and resume",
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
const pauseCalls = pauseAutoMock.mock.calls as Array<{ arguments: unknown[] }>;
|
|
575
|
+
const pauseCallArgs = pauseCalls[0]?.arguments[2] as
|
|
576
|
+
| { message?: string }
|
|
577
|
+
| undefined;
|
|
578
|
+
assert.ok(
|
|
579
|
+
pauseCallArgs?.message?.includes(".gsd/PREFERENCES.md"),
|
|
580
|
+
"pause reason should include the project verification configuration path",
|
|
581
|
+
);
|
|
582
|
+
assert.ok(
|
|
583
|
+
pauseCallArgs?.message?.includes("/gsd next"),
|
|
584
|
+
"pause reason should tell the user how to resume",
|
|
585
|
+
);
|
|
586
|
+
|
|
561
587
|
const evidencePath = join(tempDir, ".gsd", "milestones", "M001", "slices", "S01", "tasks", "T01-VERIFY.json");
|
|
562
588
|
const evidence = JSON.parse(readFileSync(evidencePath, "utf-8"));
|
|
563
589
|
assert.equal(evidence.passed, false);
|
|
@@ -566,6 +592,41 @@ describe("Post-execution blocking failure retry bypass", () => {
|
|
|
566
592
|
assert.ok(!("maxRetries" in evidence), "no-host-checks evidence must not include maxRetries");
|
|
567
593
|
});
|
|
568
594
|
|
|
595
|
+
test("completed browser-facing execute-task with no host-owned verification continues toward browser UAT", async () => {
|
|
596
|
+
createTaskWithoutVerify("complete");
|
|
597
|
+
writeFileSync(join(tempDir, "index.html"), "<!doctype html><button>Import</button>", "utf-8");
|
|
598
|
+
|
|
599
|
+
const ctx = makeMockCtx();
|
|
600
|
+
const pi = makeMockPi();
|
|
601
|
+
const pauseAutoMock = mock.fn(async () => {});
|
|
602
|
+
const s = makeMockSession(tempDir, { type: "execute-task", id: "M001/S01/T01" });
|
|
603
|
+
|
|
604
|
+
const result = await runPostUnitVerification({ s, ctx, pi }, pauseAutoMock);
|
|
605
|
+
|
|
606
|
+
assert.equal(result, "continue");
|
|
607
|
+
assert.equal(pauseAutoMock.mock.callCount(), 0);
|
|
608
|
+
assert.equal(s.pendingVerificationRetry, null);
|
|
609
|
+
|
|
610
|
+
const notifyMessages = ctx.ui.notify.mock.calls.map((c: { arguments: unknown[] }) =>
|
|
611
|
+
String(c.arguments[0])
|
|
612
|
+
);
|
|
613
|
+
assert.ok(
|
|
614
|
+
notifyMessages.some(
|
|
615
|
+
(m: string) =>
|
|
616
|
+
m.includes("browser-facing task") &&
|
|
617
|
+
m.includes("slice UAT") &&
|
|
618
|
+
m.includes("browser tools")
|
|
619
|
+
),
|
|
620
|
+
"completed web tasks without task-level commands should explain browser UAT handoff",
|
|
621
|
+
);
|
|
622
|
+
|
|
623
|
+
const evidencePath = join(tempDir, ".gsd", "milestones", "M001", "slices", "S01", "tasks", "T01-VERIFY.json");
|
|
624
|
+
const evidence = JSON.parse(readFileSync(evidencePath, "utf-8"));
|
|
625
|
+
assert.equal(evidence.passed, false);
|
|
626
|
+
assert.equal(evidence.discoverySource, "none");
|
|
627
|
+
assert.ok(!("retryAttempt" in evidence), "browser-UAT handoff evidence must not request a task retry");
|
|
628
|
+
});
|
|
629
|
+
|
|
569
630
|
test("auto-discovered package.json verification failure retries instead of continuing", async () => {
|
|
570
631
|
createTaskWithoutVerify();
|
|
571
632
|
writeFileSync(
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import { describe, test } from 'node:test';
|
|
9
9
|
import assert from 'node:assert/strict';
|
|
10
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { tmpdir } from 'node:os';
|
|
10
13
|
import {
|
|
11
14
|
openDatabase,
|
|
12
15
|
closeDatabase,
|
|
@@ -22,6 +25,17 @@ import {
|
|
|
22
25
|
formatDecisionsForPrompt,
|
|
23
26
|
formatRequirementsForPrompt,
|
|
24
27
|
} from '../context-store.ts';
|
|
28
|
+
import { inlineRequirementsFromDb } from '../auto-prompts.ts';
|
|
29
|
+
import { migrateFromMarkdown } from '../md-importer.ts';
|
|
30
|
+
|
|
31
|
+
function createDbProjectWithRequirements(content: string): { tmpDir: string; gsdDir: string } {
|
|
32
|
+
const tmpDir = mkdtempSync(join(tmpdir(), 'prompt-db-requirements-'));
|
|
33
|
+
const gsdDir = join(tmpDir, '.gsd');
|
|
34
|
+
mkdirSync(gsdDir, { recursive: true });
|
|
35
|
+
writeFileSync(join(gsdDir, 'REQUIREMENTS.md'), content);
|
|
36
|
+
openDatabase(join(gsdDir, 'gsd.db'));
|
|
37
|
+
return { tmpDir, gsdDir };
|
|
38
|
+
}
|
|
25
39
|
|
|
26
40
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
27
41
|
// prompt-db: DB-aware decisions helper returns scoped content
|
|
@@ -182,6 +196,116 @@ console.log('\n=== prompt-db: fallback when DB unavailable ===');
|
|
|
182
196
|
assert.deepStrictEqual(formattedReqs, '', 'formatRequirementsForPrompt returns empty for empty input');
|
|
183
197
|
}
|
|
184
198
|
|
|
199
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
200
|
+
// prompt-db: DB-aware requirements helper does not fall back on empty DB rows
|
|
201
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
202
|
+
|
|
203
|
+
test('prompt-db: inlineRequirementsFromDb returns null instead of full file when DB query is empty', async () => {
|
|
204
|
+
const { tmpDir } = createDbProjectWithRequirements(
|
|
205
|
+
`# Requirements\n\nFULL FILE SHOULD NOT BE INLINED\n\n${'large requirement body\n'.repeat(500)}`,
|
|
206
|
+
);
|
|
207
|
+
try {
|
|
208
|
+
const inlined = await inlineRequirementsFromDb(tmpDir, 'M999', undefined, 'full');
|
|
209
|
+
|
|
210
|
+
assert.equal(inlined, null);
|
|
211
|
+
} finally {
|
|
212
|
+
closeDatabase();
|
|
213
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test('prompt-db: inlineRequirementsFromDb cascades from empty milestone query to active requirements', async () => {
|
|
218
|
+
const { tmpDir } = createDbProjectWithRequirements(
|
|
219
|
+
'# Requirements\n\nFULL FILE SHOULD NOT BE INLINED\n',
|
|
220
|
+
);
|
|
221
|
+
try {
|
|
222
|
+
insertRequirement({
|
|
223
|
+
id: 'R001',
|
|
224
|
+
class: 'functional',
|
|
225
|
+
status: 'active',
|
|
226
|
+
description: 'active requirement for another milestone',
|
|
227
|
+
why: 'needed',
|
|
228
|
+
source: 'M001',
|
|
229
|
+
primary_owner: 'M001/S01',
|
|
230
|
+
supporting_slices: '',
|
|
231
|
+
validation: 'test',
|
|
232
|
+
notes: '',
|
|
233
|
+
full_content: '',
|
|
234
|
+
superseded_by: null,
|
|
235
|
+
});
|
|
236
|
+
insertRequirement({
|
|
237
|
+
id: 'R002',
|
|
238
|
+
class: 'functional',
|
|
239
|
+
status: 'validated',
|
|
240
|
+
description: 'validated requirement should not be active fallback',
|
|
241
|
+
why: 'already done',
|
|
242
|
+
source: 'M001',
|
|
243
|
+
primary_owner: 'M001/S02',
|
|
244
|
+
supporting_slices: '',
|
|
245
|
+
validation: 'done',
|
|
246
|
+
notes: '',
|
|
247
|
+
full_content: '',
|
|
248
|
+
superseded_by: null,
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const inlined = await inlineRequirementsFromDb(tmpDir, 'M999', undefined, 'full');
|
|
252
|
+
|
|
253
|
+
assert.ok(inlined);
|
|
254
|
+
assert.match(inlined, /### Requirements/);
|
|
255
|
+
assert.match(inlined, /# Requirements \(compact\)/);
|
|
256
|
+
assert.match(inlined, /R001/);
|
|
257
|
+
assert.match(inlined, /active requirement for another milestone/);
|
|
258
|
+
assert.doesNotMatch(inlined, /R002/);
|
|
259
|
+
assert.doesNotMatch(inlined, /FULL FILE SHOULD NOT BE INLINED/);
|
|
260
|
+
} finally {
|
|
261
|
+
closeDatabase();
|
|
262
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test('prompt-db: inlineRequirementsFromDb keeps active fallback compact for slice-scoped full calls', async () => {
|
|
267
|
+
const { tmpDir } = createDbProjectWithRequirements(
|
|
268
|
+
'# Requirements\n\nFULL FILE SHOULD NOT BE INLINED\n',
|
|
269
|
+
);
|
|
270
|
+
try {
|
|
271
|
+
insertRequirement({
|
|
272
|
+
id: 'R001',
|
|
273
|
+
class: 'functional',
|
|
274
|
+
status: 'active',
|
|
275
|
+
description: 'active requirement for another milestone',
|
|
276
|
+
why: 'needed',
|
|
277
|
+
source: 'M001',
|
|
278
|
+
primary_owner: 'M001/S01',
|
|
279
|
+
supporting_slices: '',
|
|
280
|
+
validation: 'test',
|
|
281
|
+
notes: '',
|
|
282
|
+
full_content: '',
|
|
283
|
+
superseded_by: null,
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// Slice-scoped call at inlineLevel "full" with no matching rows for the
|
|
287
|
+
// milestone+slice or milestone-only queries. The cascade should land on
|
|
288
|
+
// status: "active" rows from another milestone, and those project-wide
|
|
289
|
+
// active rows must be formatted compactly even though sliceId is set —
|
|
290
|
+
// otherwise the full per-requirement markdown would be inlined for every
|
|
291
|
+
// active row across the project.
|
|
292
|
+
const inlined = await inlineRequirementsFromDb(tmpDir, 'M999', 'S99', 'full');
|
|
293
|
+
|
|
294
|
+
assert.ok(inlined);
|
|
295
|
+
assert.match(inlined, /### Requirements/);
|
|
296
|
+
assert.match(inlined, /# Requirements \(compact\)/);
|
|
297
|
+
assert.match(inlined, /R001/);
|
|
298
|
+
// Full per-requirement markdown is forbidden here — its hallmark fields
|
|
299
|
+
// (Class:/Status:/Why: as bolded list items) are emitted only by
|
|
300
|
+
// formatRequirementsForPrompt, never by formatRequirementsCompact.
|
|
301
|
+
assert.doesNotMatch(inlined, /\*\*Class:\*\*/);
|
|
302
|
+
assert.doesNotMatch(inlined, /FULL FILE SHOULD NOT BE INLINED/);
|
|
303
|
+
} finally {
|
|
304
|
+
closeDatabase();
|
|
305
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
185
309
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
186
310
|
// prompt-db: scoped filtering reduces content vs unscoped
|
|
187
311
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -316,12 +440,6 @@ console.log('\n=== prompt-db: DB helpers wrapper format matches expected pattern
|
|
|
316
440
|
// prompt-db: re-import updates DB when source markdown changes
|
|
317
441
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
318
442
|
|
|
319
|
-
import { mkdtempSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
320
|
-
import { join } from 'node:path';
|
|
321
|
-
import { tmpdir } from 'node:os';
|
|
322
|
-
import { migrateFromMarkdown } from '../md-importer.ts';
|
|
323
|
-
|
|
324
|
-
|
|
325
443
|
describe('prompt-db', () => {
|
|
326
444
|
test('prompt-db: re-import updates DB when source markdown changes', () => {
|
|
327
445
|
// Create a temp dir simulating a project with .gsd/DECISIONS.md
|