gsd-pi 2.82.0-dev.2841a1e44 → 2.82.0-dev.3a3c6509d

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.
Files changed (377) hide show
  1. package/README.md +3 -3
  2. package/dist/resources/.managed-resources-content-hash +1 -1
  3. package/dist/resources/GSD-WORKFLOW.md +7 -0
  4. package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
  5. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +1 -1
  6. package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
  7. package/dist/resources/extensions/gsd/auto/loop.js +5 -5
  8. package/dist/resources/extensions/gsd/auto/orchestrator.js +11 -0
  9. package/dist/resources/extensions/gsd/auto/phases.js +81 -31
  10. package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
  11. package/dist/resources/extensions/gsd/auto-dashboard.js +66 -1
  12. package/dist/resources/extensions/gsd/auto-direct-dispatch.js +1 -0
  13. package/dist/resources/extensions/gsd/auto-dispatch.js +20 -19
  14. package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
  15. package/dist/resources/extensions/gsd/auto-post-unit.js +71 -10
  16. package/dist/resources/extensions/gsd/auto-recovery.js +71 -14
  17. package/dist/resources/extensions/gsd/auto-start.js +87 -14
  18. package/dist/resources/extensions/gsd/auto-verification.js +17 -4
  19. package/dist/resources/extensions/gsd/auto-worktree.js +176 -10
  20. package/dist/resources/extensions/gsd/auto.js +37 -5
  21. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +31 -7
  22. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +10 -9
  23. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +4 -2
  24. package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +5 -2
  25. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +14 -2
  26. package/dist/resources/extensions/gsd/commands/handlers/core.js +17 -1
  27. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +7 -2
  28. package/dist/resources/extensions/gsd/crash-recovery.js +43 -5
  29. package/dist/resources/extensions/gsd/db/milestone-leases.js +24 -0
  30. package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
  31. package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
  32. package/dist/resources/extensions/gsd/doctor-git-checks.js +46 -1
  33. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
  34. package/dist/resources/extensions/gsd/doctor.js +2 -28
  35. package/dist/resources/extensions/gsd/export-html.js +27 -425
  36. package/dist/resources/extensions/gsd/forensics.js +3 -3
  37. package/dist/resources/extensions/gsd/git-service.js +45 -3
  38. package/dist/resources/extensions/gsd/gsd-db.js +21 -6
  39. package/dist/resources/extensions/gsd/guided-flow-queue.js +4 -3
  40. package/dist/resources/extensions/gsd/guided-flow.js +101 -116
  41. package/dist/resources/extensions/gsd/guided-unit-context.js +23 -0
  42. package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
  43. package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
  44. package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
  45. package/dist/resources/extensions/gsd/native-git-bridge.js +48 -12
  46. package/dist/resources/extensions/gsd/pending-auto-start.js +52 -0
  47. package/dist/resources/extensions/gsd/post-execution-checks.js +73 -2
  48. package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
  49. package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
  50. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  51. package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  52. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
  53. package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
  54. package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
  55. package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
  56. package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
  57. package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
  58. package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
  59. package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
  60. package/dist/resources/extensions/gsd/queue-reorder-ui.js +30 -13
  61. package/dist/resources/extensions/gsd/smart-entry-routing.js +36 -0
  62. package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
  63. package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
  64. package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
  65. package/dist/resources/extensions/gsd/state.js +1 -1
  66. package/dist/resources/extensions/gsd/status-guards.js +11 -0
  67. package/dist/resources/extensions/gsd/templates/plan.md +8 -5
  68. package/dist/resources/extensions/gsd/templates/task-plan.md +4 -2
  69. package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
  70. package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
  71. package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
  72. package/dist/resources/extensions/gsd/tools/plan-slice.js +89 -14
  73. package/dist/resources/extensions/gsd/unit-context-manifest.js +7 -8
  74. package/dist/resources/extensions/gsd/validation.js +23 -1
  75. package/dist/resources/extensions/gsd/verification-gate.js +68 -7
  76. package/dist/resources/extensions/gsd/workflow-mcp.js +17 -1
  77. package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
  78. package/dist/resources/extensions/gsd/worktree-lifecycle.js +33 -8
  79. package/dist/resources/extensions/gsd/worktree-manager.js +1 -1
  80. package/dist/resources/extensions/shared/html-shell.js +388 -0
  81. package/dist/resources/extensions/visual-brief/page-contract.js +2 -0
  82. package/dist/resources/extensions/visual-brief/prompts.js +29 -0
  83. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  84. package/dist/web/standalone/.next/BUILD_ID +1 -1
  85. package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
  86. package/dist/web/standalone/.next/build-manifest.json +3 -3
  87. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  88. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  89. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  90. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  91. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  92. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  93. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  94. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  95. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  96. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  97. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  98. package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  99. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  100. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  101. package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
  102. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
  103. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  104. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -5
  105. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  106. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  107. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -5
  108. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  109. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  110. package/dist/web/standalone/.next/server/app/index.html +1 -1
  111. package/dist/web/standalone/.next/server/app/index.rsc +4 -7
  112. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  113. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -7
  114. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  115. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -5
  116. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
  117. package/dist/web/standalone/.next/server/app/page.js +2 -2
  118. package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
  119. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  120. package/dist/web/standalone/.next/server/app-paths-manifest.json +11 -11
  121. package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
  122. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  123. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  124. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  125. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  126. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  127. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  128. package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
  129. package/dist/web/standalone/.next/static/chunks/{webpack-6a95bc41e0f7ec89.js → webpack-9a4db269f9ed63ad.js} +1 -1
  130. package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
  131. package/package.json +2 -2
  132. package/packages/mcp-server/src/workflow-tools.test.ts +1 -1
  133. package/packages/native/tsconfig.json +2 -1
  134. package/packages/native/tsconfig.tsbuildinfo +1 -1
  135. package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
  136. package/packages/pi-ai/dist/providers/google-gemini-cli.js +5 -0
  137. package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
  138. package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts +2 -0
  139. package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts.map +1 -0
  140. package/packages/pi-ai/dist/providers/google-gemini-cli.test.js +41 -0
  141. package/packages/pi-ai/dist/providers/google-gemini-cli.test.js.map +1 -0
  142. package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  143. package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
  144. package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  145. package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
  146. package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
  147. package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
  148. package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
  149. package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
  150. package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
  151. package/packages/pi-ai/dist/providers/simple-options.js +5 -6
  152. package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
  153. package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
  154. package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
  155. package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
  156. package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
  157. package/packages/pi-ai/src/providers/google-gemini-cli.test.ts +49 -0
  158. package/packages/pi-ai/src/providers/google-gemini-cli.ts +7 -0
  159. package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
  160. package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
  161. package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
  162. package/packages/pi-ai/src/providers/simple-options.ts +5 -6
  163. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  164. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
  165. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
  166. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
  167. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
  168. package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
  169. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  170. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +44 -3
  171. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  172. package/packages/pi-coding-agent/dist/core/sdk.js +1 -1
  173. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  174. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  175. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +24 -6
  176. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  177. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  178. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +71 -97
  179. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  180. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js +12 -0
  181. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -1
  182. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  183. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +19 -8
  184. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  185. package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
  186. package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
  187. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +53 -3
  188. package/packages/pi-coding-agent/src/core/sdk.ts +1 -1
  189. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +23 -7
  190. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +75 -102
  191. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +14 -0
  192. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +23 -8
  193. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  194. package/packages/pi-tui/dist/__tests__/terminal.test.d.ts +2 -0
  195. package/packages/pi-tui/dist/__tests__/terminal.test.d.ts.map +1 -0
  196. package/packages/pi-tui/dist/__tests__/terminal.test.js +103 -0
  197. package/packages/pi-tui/dist/__tests__/terminal.test.js.map +1 -0
  198. package/packages/pi-tui/dist/terminal.d.ts +2 -0
  199. package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
  200. package/packages/pi-tui/dist/terminal.js +12 -0
  201. package/packages/pi-tui/dist/terminal.js.map +1 -1
  202. package/packages/pi-tui/src/__tests__/terminal.test.ts +121 -0
  203. package/packages/pi-tui/src/terminal.ts +11 -0
  204. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  205. package/src/resources/GSD-WORKFLOW.md +7 -0
  206. package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
  207. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +1 -1
  208. package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
  209. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +9 -0
  210. package/src/resources/extensions/gsd/auto/contracts.ts +14 -6
  211. package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
  212. package/src/resources/extensions/gsd/auto/loop.ts +8 -5
  213. package/src/resources/extensions/gsd/auto/orchestrator.ts +11 -0
  214. package/src/resources/extensions/gsd/auto/phases.ts +90 -38
  215. package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
  216. package/src/resources/extensions/gsd/auto-dashboard.ts +72 -1
  217. package/src/resources/extensions/gsd/auto-direct-dispatch.ts +1 -0
  218. package/src/resources/extensions/gsd/auto-dispatch.ts +21 -19
  219. package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
  220. package/src/resources/extensions/gsd/auto-post-unit.ts +78 -8
  221. package/src/resources/extensions/gsd/auto-recovery.ts +74 -11
  222. package/src/resources/extensions/gsd/auto-start.ts +94 -12
  223. package/src/resources/extensions/gsd/auto-verification.ts +22 -2
  224. package/src/resources/extensions/gsd/auto-worktree.ts +193 -10
  225. package/src/resources/extensions/gsd/auto.ts +40 -5
  226. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +42 -7
  227. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +10 -9
  228. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +4 -2
  229. package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +3 -1
  230. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +17 -2
  231. package/src/resources/extensions/gsd/commands/handlers/core.ts +17 -1
  232. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +8 -3
  233. package/src/resources/extensions/gsd/crash-recovery.ts +44 -4
  234. package/src/resources/extensions/gsd/db/milestone-leases.ts +26 -0
  235. package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
  236. package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
  237. package/src/resources/extensions/gsd/doctor-git-checks.ts +45 -1
  238. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
  239. package/src/resources/extensions/gsd/doctor-types.ts +1 -0
  240. package/src/resources/extensions/gsd/doctor.ts +2 -27
  241. package/src/resources/extensions/gsd/export-html.ts +27 -427
  242. package/src/resources/extensions/gsd/forensics.ts +3 -3
  243. package/src/resources/extensions/gsd/git-service.ts +51 -4
  244. package/src/resources/extensions/gsd/gsd-db.ts +21 -6
  245. package/src/resources/extensions/gsd/guided-flow-queue.ts +4 -3
  246. package/src/resources/extensions/gsd/guided-flow.ts +134 -133
  247. package/src/resources/extensions/gsd/guided-unit-context.ts +30 -0
  248. package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
  249. package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
  250. package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
  251. package/src/resources/extensions/gsd/native-git-bridge.ts +54 -12
  252. package/src/resources/extensions/gsd/pending-auto-start.ts +79 -0
  253. package/src/resources/extensions/gsd/post-execution-checks.ts +87 -2
  254. package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
  255. package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
  256. package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  257. package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  258. package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
  259. package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
  260. package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
  261. package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
  262. package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
  263. package/src/resources/extensions/gsd/prompts/queue.md +4 -4
  264. package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
  265. package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
  266. package/src/resources/extensions/gsd/queue-reorder-ui.ts +31 -13
  267. package/src/resources/extensions/gsd/smart-entry-routing.ts +77 -0
  268. package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
  269. package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
  270. package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
  271. package/src/resources/extensions/gsd/state.ts +1 -1
  272. package/src/resources/extensions/gsd/status-guards.ts +13 -0
  273. package/src/resources/extensions/gsd/templates/plan.md +8 -5
  274. package/src/resources/extensions/gsd/templates/task-plan.md +4 -2
  275. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +71 -0
  276. package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
  277. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +56 -0
  278. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +80 -1
  279. package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +35 -7
  280. package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +53 -2
  281. package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +12 -1
  282. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +91 -6
  283. package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
  284. package/src/resources/extensions/gsd/tests/auto-stop-notification.test.ts +20 -0
  285. package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
  286. package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +87 -0
  287. package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +11 -2
  288. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
  289. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +5 -9
  290. package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
  291. package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +86 -2
  292. package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
  293. package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
  294. package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +59 -2
  295. package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +66 -0
  296. package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
  297. package/src/resources/extensions/gsd/tests/doctor-empty-worktree.test.ts +65 -0
  298. package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
  299. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +11 -0
  300. package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
  301. package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +106 -0
  302. package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +59 -11
  303. package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
  304. package/src/resources/extensions/gsd/tests/guided-tool-contract.test.ts +65 -0
  305. package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +7 -7
  306. package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
  307. package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
  308. package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
  309. package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
  310. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +112 -1
  311. package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
  312. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +46 -0
  313. package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +179 -0
  314. package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
  315. package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +26 -18
  316. package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +63 -2
  317. package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
  318. package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
  319. package/src/resources/extensions/gsd/tests/pending-autostart-scope.test.ts +29 -5
  320. package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +2 -1
  321. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
  322. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
  323. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +225 -1
  324. package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
  325. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +86 -0
  326. package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
  327. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +53 -0
  328. package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +59 -0
  329. package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
  330. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +37 -1
  331. package/src/resources/extensions/gsd/tests/queue-reorder-ui.test.ts +54 -0
  332. package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +89 -2
  333. package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +2 -3
  334. package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
  335. package/src/resources/extensions/gsd/tests/smart-entry-routing.test.ts +113 -0
  336. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +53 -2
  337. package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +119 -23
  338. package/src/resources/extensions/gsd/tests/status-guards.test.ts +13 -1
  339. package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
  340. package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
  341. package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +82 -7
  342. package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +29 -2
  343. package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
  344. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +19 -1
  345. package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
  346. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
  347. package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
  348. package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
  349. package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +38 -0
  350. package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
  351. package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
  352. package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
  353. package/src/resources/extensions/gsd/tools/plan-slice.ts +98 -12
  354. package/src/resources/extensions/gsd/types.ts +1 -1
  355. package/src/resources/extensions/gsd/unit-context-manifest.ts +12 -9
  356. package/src/resources/extensions/gsd/validation.ts +23 -1
  357. package/src/resources/extensions/gsd/verification-gate.ts +78 -6
  358. package/src/resources/extensions/gsd/workflow-mcp.ts +18 -1
  359. package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
  360. package/src/resources/extensions/gsd/worktree-lifecycle.ts +41 -8
  361. package/src/resources/extensions/gsd/worktree-manager.ts +1 -1
  362. package/src/resources/extensions/shared/html-shell.ts +412 -0
  363. package/src/resources/extensions/visual-brief/page-contract.ts +2 -0
  364. package/src/resources/extensions/visual-brief/prompts.ts +37 -1
  365. package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +40 -0
  366. package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
  367. package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
  368. package/dist/web/standalone/.next/static/css/0262768ec1b89d34.css +0 -1
  369. package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
  370. package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
  371. package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
  372. package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  373. package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
  374. package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  375. package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
  376. /package/dist/web/standalone/.next/static/{Qgr2B_MRhPxC0z8fwv4vT → O6femb9LLl3nlgsDaYwS-}/_buildManifest.js +0 -0
  377. /package/dist/web/standalone/.next/static/{Qgr2B_MRhPxC0z8fwv4vT → O6femb9LLl3nlgsDaYwS-}/_ssgManifest.js +0 -0
@@ -11,6 +11,7 @@ import {
11
11
  clearPendingAutoStart,
12
12
  _getPendingAutoStart,
13
13
  } from "../guided-flow.ts";
14
+ import type { PendingAutoStartInput } from "../pending-auto-start.ts";
14
15
 
15
16
  // ─── Helpers ─────────────────────────────────────────────────────────────────
16
17
 
@@ -20,6 +21,15 @@ function makeProjectDir(): string {
20
21
  return dir;
21
22
  }
22
23
 
24
+ function pendingInput(basePath: string, milestoneId: string) {
25
+ return {
26
+ basePath,
27
+ milestoneId,
28
+ ctx: { ui: { notify: () => undefined } } as any,
29
+ pi: { sendMessage: () => undefined } as any,
30
+ };
31
+ }
32
+
23
33
  // ─── Tests ───────────────────────────────────────────────────────────────────
24
34
 
25
35
  describe("pendingAutoStart scope pinning (C1)", () => {
@@ -38,7 +48,7 @@ describe("pendingAutoStart scope pinning (C1)", () => {
38
48
  });
39
49
 
40
50
  test("setPendingAutoStart stores a scope whose paths derive from the basePath at reservation time", () => {
41
- setPendingAutoStart(base, { basePath: base, milestoneId: "M001" });
51
+ setPendingAutoStart(base, pendingInput(base, "M001"));
42
52
 
43
53
  const entry = _getPendingAutoStart(base);
44
54
  assert.ok(entry, "entry should exist");
@@ -54,8 +64,22 @@ describe("pendingAutoStart scope pinning (C1)", () => {
54
64
  assert.equal(entry.scope.stateFile(), expectedState);
55
65
  });
56
66
 
67
+ test("setPendingAutoStart rejects entries without ctx and pi before storing them", () => {
68
+ assert.throws(
69
+ () =>
70
+ setPendingAutoStart(base, {
71
+ basePath: base,
72
+ milestoneId: "M001",
73
+ } as PendingAutoStartInput),
74
+ /requires ctx and pi/,
75
+ "pending entries must include the handles later used by auto-start recovery",
76
+ );
77
+
78
+ assert.equal(_getPendingAutoStart(base), null);
79
+ });
80
+
57
81
  test("scope paths are unaffected by process.chdir after reservation", (t) => {
58
- setPendingAutoStart(base, { basePath: base, milestoneId: "M002" });
82
+ setPendingAutoStart(base, pendingInput(base, "M002"));
59
83
 
60
84
  const entry = _getPendingAutoStart(base);
61
85
  assert.ok(entry, "entry should exist");
@@ -82,7 +106,7 @@ describe("pendingAutoStart scope pinning (C1)", () => {
82
106
 
83
107
  test("scope identityKey matches the realpath of the original basePath even with trailing slash", () => {
84
108
  const baseWithSlash = base + "/";
85
- setPendingAutoStart(base, { basePath: baseWithSlash, milestoneId: "M003" });
109
+ setPendingAutoStart(base, pendingInput(baseWithSlash, "M003"));
86
110
 
87
111
  const entry = _getPendingAutoStart(base);
88
112
  assert.ok(entry, "entry should exist");
@@ -96,7 +120,7 @@ describe("pendingAutoStart scope pinning (C1)", () => {
96
120
  });
97
121
 
98
122
  test("clearPendingAutoStart removes the entry", () => {
99
- setPendingAutoStart(base, { basePath: base, milestoneId: "M001" });
123
+ setPendingAutoStart(base, pendingInput(base, "M001"));
100
124
 
101
125
  const before = _getPendingAutoStart(base);
102
126
  assert.ok(before, "entry should exist before clear");
@@ -108,7 +132,7 @@ describe("pendingAutoStart scope pinning (C1)", () => {
108
132
  });
109
133
 
110
134
  test("_getPendingAutoStart with no basePath argument returns the sole entry", () => {
111
- setPendingAutoStart(base, { basePath: base, milestoneId: "M001" });
135
+ setPendingAutoStart(base, pendingInput(base, "M001"));
112
136
 
113
137
  // No argument — should return the sole entry
114
138
  const entry = _getPendingAutoStart();
@@ -243,7 +243,8 @@ test("#4781 phase 2: validate-milestone rule writes pass-through VALIDATION for
243
243
  const content = readFileSync(validationPath, "utf-8");
244
244
  assert.match(content, /verdict: pass/);
245
245
  assert.match(content, /skip_validation: true/);
246
- assert.match(content, /trivial-scope pipeline variant \(#4781\)/);
246
+ assert.match(content, /trivial-scope pipeline variant/);
247
+ assert.doesNotMatch(content, /#[0-9]{3,}/, "validation output must not include tracker-style refs");
247
248
  });
248
249
 
249
250
  test("#4781 phase 2: validate-milestone skip path does not persist gates without a real slice", async (t) => {
@@ -116,6 +116,32 @@ test('handlePlanMilestone rejects invalid payloads', async () => {
116
116
  }
117
117
  });
118
118
 
119
+ test('handlePlanMilestone rejects delimiter characters in milestone and slice titles', async () => {
120
+ const base = makeTmpBase();
121
+ const dbPath = join(base, '.gsd', 'gsd.db');
122
+ openDatabase(dbPath);
123
+
124
+ try {
125
+ const milestoneResult = await handlePlanMilestone({ ...validParams(), title: 'Client/Server split' }, base);
126
+ assert.ok('error' in milestoneResult);
127
+ assert.match(milestoneResult.error, /validation failed: title is invalid: .*forward slash/);
128
+ assert.equal(getMilestone('M001'), null, 'invalid milestone title must not persist');
129
+
130
+ const sliceResult = await handlePlanMilestone({
131
+ ...validParams(),
132
+ slices: [
133
+ validParams().slices[0],
134
+ { ...validParams().slices[1], title: 'Client/Server migration' },
135
+ ],
136
+ }, base);
137
+ assert.ok('error' in sliceResult);
138
+ assert.match(sliceResult.error, /validation failed: slices\[1\]\.title is invalid: .*forward slash/);
139
+ assert.equal(getMilestoneSlices('M001').length, 0, 'invalid slice title must not persist partial roadmap state');
140
+ } finally {
141
+ cleanup(base);
142
+ }
143
+ });
144
+
119
145
  test('handlePlanMilestone surfaces render failures and does not clear parse-visible state on failure', async () => {
120
146
  const base = makeTmpBase();
121
147
  const dbPath = join(base, '.gsd', 'gsd.db');
@@ -65,7 +65,9 @@ test("plan-slice prompt: DB-backed tool names survive template substitution", ()
65
65
  const result = loadPrompt("plan-slice", { ...BASE_VARS, commitInstruction: "Do not commit." });
66
66
  assert.ok(result.includes("gsd_plan_slice"), "gsd_plan_slice should appear in rendered prompt");
67
67
  assert.ok(result.includes("gsd_plan_task"), "gsd_plan_task should appear in rendered prompt");
68
+ assert.ok(result.includes("gsd_decision_save"), "structural decisions should use DB-backed decision tool");
68
69
  assert.ok(result.includes("canonical write path"), "canonical write path language should survive substitution");
70
+ assert.doesNotMatch(result, /append them to `.gsd\/DECISIONS\.md`/);
69
71
  });
70
72
 
71
73
  test("plan-slice prompt: compact planning gates survive template substitution", () => {
@@ -6,7 +6,7 @@ import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync, writeFileSync
6
6
  import { join } from 'node:path';
7
7
  import { tmpdir } from 'node:os';
8
8
 
9
- import { openDatabase, closeDatabase, insertMilestone, insertSlice, getSlice, getSliceTasks, getTask } from '../gsd-db.ts';
9
+ import { openDatabase, closeDatabase, insertMilestone, insertSlice, getSlice, getSliceTasks, getTask, getGateResults, updateTaskStatus } from '../gsd-db.ts';
10
10
  import { handlePlanSlice } from '../tools/plan-slice.ts';
11
11
  import { parsePlan } from '../parsers-legacy.ts';
12
12
  import { parseTaskPlanFile } from '../files.ts';
@@ -15,6 +15,10 @@ import { deriveState, invalidateStateCache } from '../state.ts';
15
15
  function makeTmpBase(): string {
16
16
  const base = mkdtempSync(join(tmpdir(), 'gsd-plan-slice-'));
17
17
  mkdirSync(join(base, '.gsd', 'milestones', 'M001', 'slices', 'S02', 'tasks'), { recursive: true });
18
+ mkdirSync(join(base, 'src', 'resources', 'extensions', 'gsd', 'tools'), { recursive: true });
19
+ writeFileSync(join(base, 'src', 'resources', 'extensions', 'gsd', 'tools', 'plan-milestone.ts'), '// fixture\n', 'utf-8');
20
+ writeFileSync(join(base, 'src', 'resources', 'extensions', 'gsd', 'tools', 'plan-task.ts'), '// fixture\n', 'utf-8');
21
+ writeFileSync(join(base, 'stale-input.py'), '# fixture\n', 'utf-8');
18
22
  return base;
19
23
  }
20
24
 
@@ -125,6 +129,31 @@ test('handlePlanSlice advances DB-derived state out of planning immediately', as
125
129
  }
126
130
  });
127
131
 
132
+ test('handlePlanSlice clears sketch flag so DB-derived state leaves refining', async () => {
133
+ const base = makeTmpBase();
134
+ openDatabase(join(base, '.gsd', 'gsd.db'));
135
+
136
+ try {
137
+ insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
138
+ insertSlice({ id: 'S02', milestoneId: 'M001', title: 'Planning slice', status: 'pending', demo: 'Rendered plans exist.', isSketch: true });
139
+
140
+ invalidateStateCache();
141
+ const before = await deriveState(base);
142
+ assert.equal(before.phase, 'refining');
143
+
144
+ const result = await handlePlanSlice(validParams(), base);
145
+ assert.ok(!('error' in result), `unexpected error: ${'error' in result ? result.error : ''}`);
146
+ assert.equal(getSlice('M001', 'S02')?.is_sketch, 0, 'planned slice must no longer be treated as a sketch');
147
+
148
+ invalidateStateCache();
149
+ const after = await deriveState(base);
150
+ assert.notEqual(after.phase, 'refining');
151
+ assert.equal(after.progress?.tasks?.total, 2);
152
+ } finally {
153
+ cleanup(base);
154
+ }
155
+ });
156
+
128
157
  test('handlePlanSlice leaves omitted enrichment fields empty instead of rendering placeholders', async () => {
129
158
  const base = makeTmpBase();
130
159
  openDatabase(join(base, '.gsd', 'gsd.db'));
@@ -172,6 +201,28 @@ test('handlePlanSlice rejects invalid payloads', async () => {
172
201
  }
173
202
  });
174
203
 
204
+ test('handlePlanSlice explains string task IO fields must be arrays', async () => {
205
+ const base = makeTmpBase();
206
+ openDatabase(join(base, '.gsd', 'gsd.db'));
207
+
208
+ try {
209
+ seedParentSlice();
210
+ const result = await handlePlanSlice({
211
+ ...validParams(),
212
+ tasks: [
213
+ {
214
+ ...validParams().tasks[0],
215
+ inputs: 'src/index.ts' as unknown as string[],
216
+ },
217
+ ],
218
+ }, base);
219
+ assert.ok('error' in result);
220
+ assert.match(result.error, /validation failed: tasks\[0\]\.inputs must be an array of strings, not string/);
221
+ } finally {
222
+ cleanup(base);
223
+ }
224
+ });
225
+
175
226
  test('handlePlanSlice rejects absolute task IO paths outside the active worktree', async () => {
176
227
  const base = makeTmpBase();
177
228
  openDatabase(join(base, '.gsd', 'gsd.db'));
@@ -198,6 +249,63 @@ test('handlePlanSlice rejects absolute task IO paths outside the active worktree
198
249
  }
199
250
  });
200
251
 
252
+ test('handlePlanSlice rejects missing task input paths before persisting tasks', async () => {
253
+ const base = makeTmpBase();
254
+ openDatabase(join(base, '.gsd', 'gsd.db'));
255
+
256
+ try {
257
+ seedParentSlice();
258
+ const result = await handlePlanSlice({
259
+ ...validParams(),
260
+ tasks: [
261
+ {
262
+ ...validParams().tasks[0],
263
+ inputs: ['fixtures/missing-source.json'],
264
+ },
265
+ ],
266
+ }, base);
267
+
268
+ assert.ok('error' in result);
269
+ assert.match(result.error, /pre-execution validation failed:/);
270
+ assert.match(result.error, /fixtures\/missing-source\.json/);
271
+ assert.equal(getSliceTasks('M001', 'S02').length, 0, 'invalid planning IO must not persist tasks');
272
+ } finally {
273
+ cleanup(base);
274
+ }
275
+ });
276
+
277
+ test('handlePlanSlice rejects task input paths created by later tasks before persisting tasks', async () => {
278
+ const base = makeTmpBase();
279
+ openDatabase(join(base, '.gsd', 'gsd.db'));
280
+
281
+ try {
282
+ seedParentSlice();
283
+ const params = validParams();
284
+ const result = await handlePlanSlice({
285
+ ...params,
286
+ tasks: [
287
+ {
288
+ ...params.tasks[0],
289
+ inputs: ['generated/report.json'],
290
+ expectedOutput: ['generated/summary.json'],
291
+ },
292
+ {
293
+ ...params.tasks[1],
294
+ inputs: [],
295
+ expectedOutput: ['generated/report.json'],
296
+ },
297
+ ],
298
+ }, base);
299
+
300
+ assert.ok('error' in result);
301
+ assert.match(result.error, /pre-execution validation failed:/);
302
+ assert.match(result.error, /sequence violation/);
303
+ assert.equal(getSliceTasks('M001', 'S02').length, 0, 'invalid task ordering must not persist tasks');
304
+ } finally {
305
+ cleanup(base);
306
+ }
307
+ });
308
+
201
309
  test('handlePlanSlice accepts absolute task IO paths inside the active worktree', async () => {
202
310
  const base = makeTmpBase();
203
311
  openDatabase(join(base, '.gsd', 'gsd.db'));
@@ -304,3 +412,119 @@ test('handlePlanSlice reruns idempotently and refreshes parse-visible state', as
304
412
  cleanup(base);
305
413
  }
306
414
  });
415
+
416
+ test('handlePlanSlice removes omitted pending tasks when replanning a smaller task set', async () => {
417
+ const base = makeTmpBase();
418
+ openDatabase(join(base, '.gsd', 'gsd.db'));
419
+
420
+ try {
421
+ seedParentSlice();
422
+ const fourTaskPlan = {
423
+ ...validParams(),
424
+ tasks: [
425
+ ...validParams().tasks,
426
+ { ...validParams().tasks[0], taskId: 'T03', title: 'Third task' },
427
+ { ...validParams().tasks[0], taskId: 'T04', title: 'Stale task', inputs: ['stale-input.py'] },
428
+ ],
429
+ };
430
+
431
+ const first = await handlePlanSlice(fourTaskPlan, base);
432
+ assert.ok(!('error' in first), `unexpected error: ${'error' in first ? first.error : ''}`);
433
+ const staleTaskPlanPath = join(base, '.gsd', 'milestones', 'M001', 'slices', 'S02', 'tasks', 'T04-PLAN.md');
434
+ assert.ok(existsSync(staleTaskPlanPath), 'initial plan should render T04');
435
+
436
+ const second = await handlePlanSlice({
437
+ ...validParams(),
438
+ tasks: fourTaskPlan.tasks.filter((task) => task.taskId !== 'T04'),
439
+ }, base);
440
+ assert.ok(!('error' in second), `unexpected error: ${'error' in second ? second.error : ''}`);
441
+
442
+ assert.deepEqual(getSliceTasks('M001', 'S02').map((task) => task.id), ['T01', 'T02', 'T03']);
443
+ assert.equal(getGateResults('M001', 'S02', 'task').some((gate) => gate.task_id === 'T04'), false);
444
+ assert.equal(existsSync(staleTaskPlanPath), false, 'omitted task plan artifact should be removed');
445
+ } finally {
446
+ cleanup(base);
447
+ }
448
+ });
449
+
450
+ test('handlePlanSlice rejects omitted completed tasks without changing slice or task state', async () => {
451
+ const base = makeTmpBase();
452
+ openDatabase(join(base, '.gsd', 'gsd.db'));
453
+
454
+ try {
455
+ seedParentSlice();
456
+ const fourTaskPlan = {
457
+ ...validParams(),
458
+ tasks: [
459
+ ...validParams().tasks,
460
+ { ...validParams().tasks[0], taskId: 'T03', title: 'Third task' },
461
+ { ...validParams().tasks[0], taskId: 'T04', title: 'Stale task', inputs: ['stale-input.py'] },
462
+ ],
463
+ };
464
+
465
+ const first = await handlePlanSlice(fourTaskPlan, base);
466
+ assert.ok(!('error' in first), `unexpected error: ${'error' in first ? first.error : ''}`);
467
+ const staleTaskPlanPath = join(base, '.gsd', 'milestones', 'M001', 'slices', 'S02', 'tasks', 'T04-PLAN.md');
468
+ assert.ok(existsSync(staleTaskPlanPath), 'initial plan should render T04');
469
+
470
+ updateTaskStatus('M001', 'S02', 'T04', 'complete', '2026-05-12T00:00:00.000Z');
471
+ const tasksBefore = getSliceTasks('M001', 'S02');
472
+ const gatesBefore = getGateResults('M001', 'S02', 'task');
473
+
474
+ const second = await handlePlanSlice({
475
+ ...validParams(),
476
+ goal: 'Rejected replan should not persist.',
477
+ tasks: fourTaskPlan.tasks.filter((task) => task.taskId !== 'T04'),
478
+ }, base);
479
+ assert.deepEqual(second, { error: 'cannot remove completed task T04' });
480
+
481
+ assert.equal(getSlice('M001', 'S02')?.goal, 'Persist slice planning through the DB.');
482
+ assert.deepEqual(getSliceTasks('M001', 'S02'), tasksBefore);
483
+ assert.deepEqual(getGateResults('M001', 'S02', 'task'), gatesBefore);
484
+ assert.ok(existsSync(staleTaskPlanPath), 'completed task plan artifact should remain after rejected replan');
485
+ } finally {
486
+ cleanup(base);
487
+ }
488
+ });
489
+
490
+ test('regression: validateTasks surfaces clean per-field errors for non-array IO inputs', async () => {
491
+ // Regression for the bug fixed in PR #5872: an earlier refactor on main
492
+ // (0b0e1a901) re-added validateStringArray() calls inside validateTasks
493
+ // without re-adding its import. The catch around validateParams swallowed
494
+ // the ReferenceError into a generic "validation failed: validateStringArray
495
+ // is not defined" message, so silent runtime breakage was possible.
496
+ //
497
+ // Exercise every validateStringArray call site (files, inputs, expectedOutput)
498
+ // so a future missing-import would surface as a per-field assertion failure
499
+ // here, not a deep ReferenceError that's easy to mis-diagnose.
500
+ const base = makeTmpBase();
501
+ openDatabase(join(base, '.gsd', 'gsd.db'));
502
+
503
+ try {
504
+ seedParentSlice();
505
+
506
+ for (const field of ['files', 'inputs', 'expectedOutput'] as const) {
507
+ const result = await handlePlanSlice({
508
+ ...validParams(),
509
+ tasks: [{
510
+ ...validParams().tasks[0],
511
+ [field]: 'not-an-array' as unknown as string[],
512
+ }],
513
+ }, base);
514
+ assert.ok('error' in result, `${field}: expected validation error, got success`);
515
+ assert.match(
516
+ result.error,
517
+ new RegExp(`tasks\\[0\\]\\.${field} must be an array`),
518
+ `${field}: expected per-field validation message, got: ${result.error}`,
519
+ );
520
+ assert.doesNotMatch(
521
+ result.error,
522
+ /is not defined/,
523
+ `${field}: validation surfaced ReferenceError — likely a missing import in plan-slice.ts`,
524
+ );
525
+ assert.equal(getSliceTasks('M001', 'S02').length, 0, `${field}: invalid input must not persist`);
526
+ }
527
+ } finally {
528
+ cleanup(base);
529
+ }
530
+ });
@@ -79,6 +79,23 @@ test('handlePlanTask rejects invalid payloads', async () => {
79
79
  }
80
80
  });
81
81
 
82
+ test('handlePlanTask explains string IO fields must be arrays', async () => {
83
+ const base = makeTmpBase();
84
+ openDatabase(join(base, '.gsd', 'gsd.db'));
85
+
86
+ try {
87
+ seedParent();
88
+ const result = await handlePlanTask({
89
+ ...validParams(),
90
+ expectedOutput: 'src/output.ts' as unknown as string[],
91
+ }, base);
92
+ assert.ok('error' in result);
93
+ assert.match(result.error, /validation failed: expectedOutput must be an array of strings, not string/);
94
+ } finally {
95
+ cleanup(base);
96
+ }
97
+ });
98
+
82
99
  test('handlePlanTask rejects absolute task IO paths outside the active worktree', async () => {
83
100
  const base = makeTmpBase();
84
101
  openDatabase(join(base, '.gsd', 'gsd.db'));
@@ -127,6 +127,61 @@ import { b } from './b';
127
127
  assert.equal(imports.length, 2);
128
128
  });
129
129
 
130
+ test("ignores import-looking string literals in test fixtures", () => {
131
+ const source = `
132
+ const rewritten = source.replace(
133
+ 'import { normalizeZagrebBusinessDeadline } from "./cutoff";',
134
+ 'const helper = true;'
135
+ );
136
+
137
+ import realThing from "./real-thing";
138
+ `;
139
+ const imports = extractRelativeImports(source);
140
+ assert.deepEqual(imports, [
141
+ { importPath: "./real-thing", lineNum: 7 },
142
+ ]);
143
+ });
144
+
145
+ test("ignores import-looking lines inside template literals", () => {
146
+ const source = [
147
+ "const fixture = `",
148
+ "import missingThing from './missing-thing';",
149
+ "`;",
150
+ "",
151
+ "import realThing from './real-thing';",
152
+ ].join("\n");
153
+ const imports = extractRelativeImports(source);
154
+ assert.deepEqual(imports, [
155
+ { importPath: "./real-thing", lineNum: 5 },
156
+ ]);
157
+ });
158
+
159
+ test("ignores require() inside string literals", () => {
160
+ const source = [
161
+ 'const fixture = "const x = require(\'./missing\');";',
162
+ "const otherFixture = 'const y = require(\"./also-missing\");';",
163
+ "const real = require('./real');",
164
+ ].join("\n");
165
+ const imports = extractRelativeImports(source);
166
+ assert.deepEqual(imports, [
167
+ { importPath: "./real", lineNum: 3 },
168
+ ]);
169
+ });
170
+
171
+ test("ignores require() inside template literals", () => {
172
+ const source = [
173
+ "const fixture = `",
174
+ "const x = require('./missing');",
175
+ "`;",
176
+ "",
177
+ "const real = require('./real');",
178
+ ].join("\n");
179
+ const imports = extractRelativeImports(source);
180
+ assert.deepEqual(imports, [
181
+ { importPath: "./real", lineNum: 5 },
182
+ ]);
183
+ });
184
+
130
185
  test("handles empty source", () => {
131
186
  const imports = extractRelativeImports("");
132
187
  assert.deepEqual(imports, []);
@@ -810,6 +865,37 @@ describe("runPostExecutionChecks", () => {
810
865
  }
811
866
  });
812
867
 
868
+ test("does not fail on import-looking strings in task key files", () => {
869
+ tempDir = join(tmpdir(), `post-exec-test-${Date.now()}`);
870
+ mkdirSync(tempDir, { recursive: true });
871
+ mkdirSync(join(tempDir, "tests"), { recursive: true });
872
+ writeFileSync(join(tempDir, "tests", "real-thing.ts"), "export default true;");
873
+ writeFileSync(
874
+ join(tempDir, "tests", "source-verifier.test.ts"),
875
+ `
876
+ const rewritten = source.replace(
877
+ 'import { normalizeZagrebBusinessDeadline } from "./cutoff";',
878
+ 'const helper = true;'
879
+ );
880
+
881
+ import realThing from "./real-thing";
882
+ assert.ok(realThing);
883
+ `
884
+ );
885
+
886
+ try {
887
+ const task = createTask({
888
+ id: "T03",
889
+ key_files: ["tests/source-verifier.test.ts"],
890
+ });
891
+ const result = runPostExecutionChecks(task, [], tempDir);
892
+ assert.equal(result.status, "pass");
893
+ assert.deepEqual(result.checks, []);
894
+ } finally {
895
+ rmSync(tempDir, { recursive: true, force: true });
896
+ }
897
+ });
898
+
813
899
  test("returns fail status when blocking failure exists", () => {
814
900
  tempDir = join(tmpdir(), `post-exec-test-${Date.now()}`);
815
901
  mkdirSync(tempDir, { recursive: true });
@@ -11,7 +11,7 @@ const source = readFileSync(
11
11
 
12
12
  test("postUnitPreVerification blocks on git action failure", () => {
13
13
  const failureBlock = extractSourceRegion(source, 'if (gitResult.status === "failed")');
14
- assert.ok(failureBlock.includes('ctx.ui.notify(failureMsg, "error")'));
14
+ assert.ok(failureBlock.includes('ctx.ui.notify(failureMsg, opts?.softFailure ? "warning" : "error")'));
15
15
  assert.ok(failureBlock.includes("await pauseAuto(ctx, pi)"));
16
16
  assert.ok(failureBlock.includes('return "dispatched"'));
17
17
  assert.ok(!failureBlock.includes("git-action-failed-nonblocking"));
@@ -9,6 +9,7 @@
9
9
  * 2. File path consistency — files exist vs prior expected_output
10
10
  * 3. Task ordering — detect impossible read-before-create
11
11
  * 4. Interface contracts — contradictory function signatures
12
+ * 5. Verify commands — reject unsafe or non-runnable task verification
12
13
  */
13
14
 
14
15
  import { describe, test, mock } from "node:test";
@@ -22,6 +23,7 @@ import {
22
23
  checkFilePathConsistency,
23
24
  checkTaskOrdering,
24
25
  checkInterfaceContracts,
26
+ checkVerificationCommands,
25
27
  runPreExecutionChecks,
26
28
  normalizeFilePath,
27
29
  type PreExecutionResult,
@@ -812,6 +814,33 @@ function process(a: number): number
812
814
  });
813
815
  });
814
816
 
817
+ describe("checkVerificationCommands", () => {
818
+ test("accepts pipe-free pytest Verify command", () => {
819
+ const results = checkVerificationCommands([
820
+ createTask({
821
+ id: "T01",
822
+ verify: "python3 -m pytest tests/ -q --tb=short",
823
+ }),
824
+ ]);
825
+
826
+ assert.deepEqual(results, []);
827
+ });
828
+
829
+ test("rejects piped pytest Verify command", () => {
830
+ const results = checkVerificationCommands([
831
+ createTask({
832
+ id: "T01",
833
+ verify: "python3 -m pytest tests/ -q --tb=short 2>&1 | tail -5",
834
+ }),
835
+ ]);
836
+
837
+ assert.equal(results.length, 1);
838
+ assert.equal(results[0]?.category, "tool");
839
+ assert.equal(results[0]?.blocking, true);
840
+ assert.match(results[0]?.message ?? "", /shell control syntax/);
841
+ });
842
+ });
843
+
815
844
  // ─── runPreExecutionChecks Integration Tests ─────────────────────────────────
816
845
 
817
846
  describe("runPreExecutionChecks", () => {
@@ -847,6 +876,30 @@ describe("runPreExecutionChecks", () => {
847
876
  }
848
877
  });
849
878
 
879
+ test("returns fail status for unsafe Verify command before execution", async () => {
880
+ tempDir = join(tmpdir(), `pre-exec-test-${Date.now()}`);
881
+ mkdirSync(tempDir, { recursive: true });
882
+
883
+ try {
884
+ const tasks = [
885
+ createTask({
886
+ id: "T01",
887
+ verify: "python3 -m pytest tests/ -q --tb=short 2>&1 | tail -5",
888
+ }),
889
+ ];
890
+
891
+ const result = await runPreExecutionChecks(tasks, tempDir);
892
+
893
+ assert.equal(result.status, "fail");
894
+ assert.equal(result.checks.length, 1);
895
+ assert.equal(result.checks[0]?.category, "tool");
896
+ assert.equal(result.checks[0]?.blocking, true);
897
+ assert.match(result.checks[0]?.message ?? "", /Unsafe or non-runnable Verify command/);
898
+ } finally {
899
+ rmSync(tempDir, { recursive: true, force: true });
900
+ }
901
+ });
902
+
850
903
  test("returns fail status when blocking failure exists", async () => {
851
904
  tempDir = join(tmpdir(), `pre-exec-test-${Date.now()}`);
852
905
  mkdirSync(tempDir, { recursive: true });
@@ -141,3 +141,62 @@ test("category summaries expose the wizard menu surface for configured prefs", (
141
141
  assert.match(summaries.integrations, /remote: C123/);
142
142
  assert.match(summaries.verification, /1 cmd/);
143
143
  });
144
+
145
+ test("models wizard offers discovered models for enabled providers", async () => {
146
+ const dir = mkdtempSync(join(tmpdir(), "gsd-prefs-wizard-"));
147
+ const prefsPath = join(dir, "PREFERENCES.md");
148
+ const choices = [
149
+ "Models",
150
+ "local (2 models)",
151
+ "discovered-model",
152
+ "(keep current)",
153
+ "(keep current)",
154
+ "(keep current)",
155
+ "(keep current)",
156
+ "(keep current)",
157
+ "(keep current)",
158
+ "(keep current)",
159
+ ];
160
+ const ctx = {
161
+ modelRegistry: {
162
+ getAvailable: () => [{ provider: "local", id: "baseline-model" }],
163
+ getAllWithDiscovered: () => [
164
+ { provider: "local", id: "baseline-model" },
165
+ { provider: "local", id: "discovered-model" },
166
+ { provider: "disabled", id: "hidden-model" },
167
+ ],
168
+ },
169
+ ui: {
170
+ notify() {},
171
+ select: async (label: string, options: string[]) => {
172
+ const choice = choices.shift();
173
+ if (!choice && label === "GSD Preferences") return "── Save & Exit ──";
174
+ if (!choice && options.includes("(keep current)")) return "(keep current)";
175
+ if (!choice && options.includes("Done")) return "Done";
176
+ assert.ok(choice, `Unexpected prompt: ${label}`);
177
+ if (choice === "Models") {
178
+ const modelsOption = options.find((option) => option.startsWith("Models"));
179
+ assert.ok(modelsOption, "Expected Models category option");
180
+ return modelsOption;
181
+ }
182
+ assert.ok(options.includes(choice), `"${choice}" must be offered by "${label}"`);
183
+ assert.ok(!options.includes("hidden-model"), "models from disabled providers must not be offered");
184
+ return choice;
185
+ },
186
+ input: async () => null,
187
+ },
188
+ waitForIdle: async () => {},
189
+ reload: async () => {},
190
+ } as any;
191
+
192
+ try {
193
+ await handlePrefsWizard(ctx, "project", {}, { pathOverride: prefsPath });
194
+
195
+ assert.equal(choices.length, 0, "Expected all queued wizard choices to be consumed");
196
+ const saved = readFileSync(prefsPath, "utf-8");
197
+ assert.match(saved, /research:\s+local\/discovered-model/);
198
+ assert.doesNotMatch(saved, /hidden-model/);
199
+ } finally {
200
+ rmSync(dir, { recursive: true, force: true });
201
+ }
202
+ });