gsd-pi 2.44.0-dev.d25d507 → 2.45.0-dev.1afbdaa

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 (407) hide show
  1. package/dist/help-text.js +1 -1
  2. package/dist/loader.js +34 -0
  3. package/dist/resources/extensions/gsd/activity-log.js +7 -0
  4. package/dist/resources/extensions/gsd/auto/infra-errors.js +3 -0
  5. package/dist/resources/extensions/gsd/auto/phases.js +63 -77
  6. package/dist/resources/extensions/gsd/auto/run-unit.js +6 -3
  7. package/dist/resources/extensions/gsd/auto/session.js +0 -11
  8. package/dist/resources/extensions/gsd/auto-artifact-paths.js +112 -0
  9. package/dist/resources/extensions/gsd/auto-post-unit.js +25 -96
  10. package/dist/resources/extensions/gsd/auto-prompts.js +24 -1
  11. package/dist/resources/extensions/gsd/auto-start.js +23 -5
  12. package/dist/resources/extensions/gsd/auto-timers.js +57 -3
  13. package/dist/resources/extensions/gsd/auto-worktree-sync.js +4 -0
  14. package/dist/resources/extensions/gsd/auto-worktree.js +14 -10
  15. package/dist/resources/extensions/gsd/auto.js +42 -60
  16. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +170 -11
  17. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +18 -0
  18. package/dist/resources/extensions/gsd/commands/catalog.js +7 -1
  19. package/dist/resources/extensions/gsd/commands/context.js +0 -4
  20. package/dist/resources/extensions/gsd/commands/handlers/core.js +2 -0
  21. package/dist/resources/extensions/gsd/commands/handlers/ops.js +10 -0
  22. package/dist/resources/extensions/gsd/commands/handlers/parallel.js +1 -1
  23. package/dist/resources/extensions/gsd/commands-mcp-status.js +187 -0
  24. package/dist/resources/extensions/gsd/crash-recovery.js +2 -4
  25. package/dist/resources/extensions/gsd/dashboard-overlay.js +0 -44
  26. package/dist/resources/extensions/gsd/db-writer.js +40 -22
  27. package/dist/resources/extensions/gsd/doctor-checks.js +167 -2
  28. package/dist/resources/extensions/gsd/doctor.js +13 -3
  29. package/dist/resources/extensions/gsd/git-service.js +8 -3
  30. package/dist/resources/extensions/gsd/gsd-db.js +28 -4
  31. package/dist/resources/extensions/gsd/guided-flow.js +1 -2
  32. package/dist/resources/extensions/gsd/markdown-renderer.js +1 -1
  33. package/dist/resources/extensions/gsd/parallel-merge.js +1 -1
  34. package/dist/resources/extensions/gsd/parallel-orchestrator.js +5 -18
  35. package/dist/resources/extensions/gsd/preferences-types.js +2 -2
  36. package/dist/resources/extensions/gsd/preferences.js +8 -4
  37. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +21 -10
  38. package/dist/resources/extensions/gsd/prompts/complete-slice.md +10 -23
  39. package/dist/resources/extensions/gsd/prompts/discuss.md +2 -2
  40. package/dist/resources/extensions/gsd/prompts/execute-task.md +5 -15
  41. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  42. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
  43. package/dist/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
  44. package/dist/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
  45. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
  46. package/dist/resources/extensions/gsd/prompts/plan-slice.md +5 -3
  47. package/dist/resources/extensions/gsd/prompts/queue.md +2 -2
  48. package/dist/resources/extensions/gsd/prompts/quick-task.md +2 -0
  49. package/dist/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
  50. package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +6 -6
  51. package/dist/resources/extensions/gsd/prompts/replan-slice.md +3 -14
  52. package/dist/resources/extensions/gsd/prompts/research-slice.md +3 -3
  53. package/dist/resources/extensions/gsd/prompts/rethink.md +83 -0
  54. package/dist/resources/extensions/gsd/prompts/system.md +1 -1
  55. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +7 -37
  56. package/dist/resources/extensions/gsd/provider-error-pause.js +7 -0
  57. package/dist/resources/extensions/gsd/repo-identity.js +45 -7
  58. package/dist/resources/extensions/gsd/rethink.js +115 -0
  59. package/dist/resources/extensions/gsd/session-lock.js +1 -3
  60. package/dist/resources/extensions/gsd/state.js +48 -3
  61. package/dist/resources/extensions/gsd/sync-lock.js +89 -0
  62. package/dist/resources/extensions/gsd/tools/complete-milestone.js +61 -11
  63. package/dist/resources/extensions/gsd/tools/complete-slice.js +56 -11
  64. package/dist/resources/extensions/gsd/tools/complete-task.js +50 -2
  65. package/dist/resources/extensions/gsd/tools/plan-milestone.js +37 -1
  66. package/dist/resources/extensions/gsd/tools/plan-slice.js +31 -1
  67. package/dist/resources/extensions/gsd/tools/plan-task.js +28 -1
  68. package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +32 -2
  69. package/dist/resources/extensions/gsd/tools/reopen-slice.js +86 -0
  70. package/dist/resources/extensions/gsd/tools/reopen-task.js +90 -0
  71. package/dist/resources/extensions/gsd/tools/replan-slice.js +34 -2
  72. package/dist/resources/extensions/gsd/tools/validate-milestone.js +88 -0
  73. package/dist/resources/extensions/gsd/unit-ownership.js +85 -0
  74. package/dist/resources/extensions/gsd/workflow-events.js +102 -0
  75. package/dist/resources/extensions/gsd/workflow-logger.js +193 -0
  76. package/dist/resources/extensions/gsd/workflow-manifest.js +244 -0
  77. package/dist/resources/extensions/gsd/workflow-migration.js +280 -0
  78. package/dist/resources/extensions/gsd/workflow-projections.js +373 -0
  79. package/dist/resources/extensions/gsd/workflow-reconcile.js +411 -0
  80. package/dist/resources/extensions/gsd/worktree-manager.js +34 -3
  81. package/dist/resources/extensions/gsd/worktree-resolver.js +43 -0
  82. package/dist/resources/extensions/gsd/write-intercept.js +84 -0
  83. package/dist/resources/extensions/mcp-client/index.js +14 -0
  84. package/dist/resources/extensions/voice/index.js +11 -16
  85. package/dist/resources/extensions/voice/linux-ready.js +67 -0
  86. package/dist/web/standalone/.next/BUILD_ID +1 -1
  87. package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
  88. package/dist/web/standalone/.next/build-manifest.json +3 -3
  89. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  90. package/dist/web/standalone/.next/react-loadable-manifest.json +2 -2
  91. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  92. package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
  93. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  94. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  95. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  96. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  97. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  98. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  99. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  100. package/dist/web/standalone/.next/server/app/_not-found/page.js +1 -1
  101. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  102. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  103. package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
  104. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  105. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  106. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  107. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  108. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  109. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  110. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  111. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  112. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  113. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  114. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  115. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  116. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  117. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  118. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  119. package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
  120. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  121. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  122. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  123. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  124. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  125. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  126. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  127. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  128. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  129. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  130. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  131. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  132. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  133. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  134. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  135. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  136. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  137. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  138. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  139. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  140. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  141. package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
  142. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  143. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  144. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
  145. package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
  146. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  147. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  148. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  149. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  150. package/dist/web/standalone/.next/server/app/index.html +1 -1
  151. package/dist/web/standalone/.next/server/app/index.rsc +4 -4
  152. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  153. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
  154. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  155. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  156. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  157. package/dist/web/standalone/.next/server/app/page.js +1 -1
  158. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  159. package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
  160. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  161. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  162. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  163. package/dist/web/standalone/.next/server/pages/500.html +2 -2
  164. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  165. package/dist/web/standalone/.next/static/chunks/4024.11ca5c01938e5948.js +9 -0
  166. package/dist/web/standalone/.next/static/chunks/{3721.bf31263de6d5fa46.js → 485.243af25f0cdf50d6.js} +2 -2
  167. package/dist/web/standalone/.next/static/chunks/app/{page-b9367c5ae13b99c6.js → page-6654a8cca61a3d1c.js} +1 -1
  168. package/dist/web/standalone/.next/static/chunks/webpack-0a4cd455ec4197d2.js +1 -0
  169. package/dist/web/standalone/.next/static/css/dd4ae3f58ac9b600.css +1 -0
  170. package/package.json +2 -1
  171. package/packages/native/dist/stream-process/index.js +2 -2
  172. package/packages/native/src/__tests__/stream-process.test.mjs +34 -0
  173. package/packages/native/src/stream-process/index.ts +2 -2
  174. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +3 -1
  175. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  176. package/packages/pi-coding-agent/dist/core/auth-storage.js +15 -1
  177. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  178. package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -1
  179. package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +2 -0
  180. package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -1
  181. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +2 -1
  182. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  183. package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  184. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.d.ts +4 -0
  185. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.d.ts.map +1 -1
  186. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.js +10 -5
  187. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.js.map +1 -1
  188. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.test.d.ts +2 -0
  189. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.test.d.ts.map +1 -0
  190. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.test.js +185 -0
  191. package/packages/pi-coding-agent/dist/core/lifecycle-hooks.test.js.map +1 -0
  192. package/packages/pi-coding-agent/dist/core/local-model-check.d.ts +15 -0
  193. package/packages/pi-coding-agent/dist/core/local-model-check.d.ts.map +1 -0
  194. package/packages/pi-coding-agent/dist/core/local-model-check.js +41 -0
  195. package/packages/pi-coding-agent/dist/core/local-model-check.js.map +1 -0
  196. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +239 -10
  197. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
  198. package/packages/pi-coding-agent/dist/core/model-registry.d.ts +13 -1
  199. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  200. package/packages/pi-coding-agent/dist/core/model-registry.js +40 -3
  201. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  202. package/packages/pi-coding-agent/dist/core/package-commands.test.js +206 -195
  203. package/packages/pi-coding-agent/dist/core/package-commands.test.js.map +1 -1
  204. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +3 -0
  205. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  206. package/packages/pi-coding-agent/dist/core/settings-manager.js +6 -0
  207. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  208. package/packages/pi-coding-agent/dist/main.d.ts.map +1 -1
  209. package/packages/pi-coding-agent/dist/main.js +17 -0
  210. package/packages/pi-coding-agent/dist/main.js.map +1 -1
  211. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.d.ts +2 -0
  212. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.d.ts.map +1 -0
  213. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.js +32 -0
  214. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/timestamp.test.js.map +1 -0
  215. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +3 -1
  216. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  217. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +8 -1
  218. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  219. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  220. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  221. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +12 -0
  222. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  223. package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.d.ts +15 -0
  224. package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.d.ts.map +1 -0
  225. package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.js +40 -0
  226. package/packages/pi-coding-agent/dist/modes/interactive/components/timestamp.js.map +1 -0
  227. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  228. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +4 -1
  229. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  230. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts +5 -2
  231. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  232. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +13 -2
  233. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
  234. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  235. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +17 -8
  236. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  237. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  238. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +7 -3
  239. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  240. package/packages/pi-coding-agent/package.json +1 -1
  241. package/packages/pi-coding-agent/src/core/auth-storage.ts +15 -1
  242. package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +2 -0
  243. package/packages/pi-coding-agent/src/core/extensions/types.ts +2 -1
  244. package/packages/pi-coding-agent/src/core/lifecycle-hooks.test.ts +227 -0
  245. package/packages/pi-coding-agent/src/core/lifecycle-hooks.ts +11 -5
  246. package/packages/pi-coding-agent/src/core/local-model-check.ts +45 -0
  247. package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +297 -11
  248. package/packages/pi-coding-agent/src/core/model-registry.ts +51 -4
  249. package/packages/pi-coding-agent/src/core/package-commands.test.ts +227 -205
  250. package/packages/pi-coding-agent/src/core/settings-manager.ts +9 -0
  251. package/packages/pi-coding-agent/src/main.ts +19 -0
  252. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/timestamp.test.ts +38 -0
  253. package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +10 -0
  254. package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +15 -0
  255. package/packages/pi-coding-agent/src/modes/interactive/components/timestamp.ts +48 -0
  256. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +3 -1
  257. package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +18 -3
  258. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +16 -7
  259. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +8 -1
  260. package/pkg/package.json +1 -1
  261. package/src/resources/extensions/gsd/activity-log.ts +1 -0
  262. package/src/resources/extensions/gsd/auto/infra-errors.ts +3 -0
  263. package/src/resources/extensions/gsd/auto/loop-deps.ts +0 -19
  264. package/src/resources/extensions/gsd/auto/phases.ts +69 -91
  265. package/src/resources/extensions/gsd/auto/run-unit.ts +6 -3
  266. package/src/resources/extensions/gsd/auto/session.ts +0 -18
  267. package/src/resources/extensions/gsd/auto-artifact-paths.ts +131 -0
  268. package/src/resources/extensions/gsd/auto-dashboard.ts +0 -1
  269. package/src/resources/extensions/gsd/auto-post-unit.ts +25 -106
  270. package/src/resources/extensions/gsd/auto-prompts.ts +24 -1
  271. package/src/resources/extensions/gsd/auto-start.ts +26 -5
  272. package/src/resources/extensions/gsd/auto-timers.ts +64 -3
  273. package/src/resources/extensions/gsd/auto-worktree-sync.ts +5 -0
  274. package/src/resources/extensions/gsd/auto-worktree.ts +17 -11
  275. package/src/resources/extensions/gsd/auto.ts +44 -86
  276. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +162 -11
  277. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
  278. package/src/resources/extensions/gsd/commands/catalog.ts +7 -1
  279. package/src/resources/extensions/gsd/commands/context.ts +0 -5
  280. package/src/resources/extensions/gsd/commands/handlers/core.ts +2 -0
  281. package/src/resources/extensions/gsd/commands/handlers/ops.ts +10 -0
  282. package/src/resources/extensions/gsd/commands/handlers/parallel.ts +1 -1
  283. package/src/resources/extensions/gsd/commands-mcp-status.ts +247 -0
  284. package/src/resources/extensions/gsd/crash-recovery.ts +1 -5
  285. package/src/resources/extensions/gsd/dashboard-overlay.ts +0 -50
  286. package/src/resources/extensions/gsd/db-writer.ts +41 -27
  287. package/src/resources/extensions/gsd/doctor-checks.ts +180 -2
  288. package/src/resources/extensions/gsd/doctor-types.ts +7 -1
  289. package/src/resources/extensions/gsd/doctor.ts +13 -4
  290. package/src/resources/extensions/gsd/git-service.ts +6 -2
  291. package/src/resources/extensions/gsd/gsd-db.ts +32 -4
  292. package/src/resources/extensions/gsd/guided-flow.ts +1 -2
  293. package/src/resources/extensions/gsd/journal.ts +6 -1
  294. package/src/resources/extensions/gsd/markdown-renderer.ts +1 -1
  295. package/src/resources/extensions/gsd/parallel-merge.ts +1 -1
  296. package/src/resources/extensions/gsd/parallel-orchestrator.ts +5 -21
  297. package/src/resources/extensions/gsd/preferences-types.ts +2 -2
  298. package/src/resources/extensions/gsd/preferences.ts +7 -3
  299. package/src/resources/extensions/gsd/prompts/complete-milestone.md +21 -10
  300. package/src/resources/extensions/gsd/prompts/complete-slice.md +10 -23
  301. package/src/resources/extensions/gsd/prompts/discuss.md +2 -2
  302. package/src/resources/extensions/gsd/prompts/execute-task.md +5 -15
  303. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  304. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
  305. package/src/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
  306. package/src/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
  307. package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
  308. package/src/resources/extensions/gsd/prompts/plan-slice.md +5 -3
  309. package/src/resources/extensions/gsd/prompts/queue.md +2 -2
  310. package/src/resources/extensions/gsd/prompts/quick-task.md +2 -0
  311. package/src/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
  312. package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +6 -6
  313. package/src/resources/extensions/gsd/prompts/replan-slice.md +3 -14
  314. package/src/resources/extensions/gsd/prompts/research-slice.md +3 -3
  315. package/src/resources/extensions/gsd/prompts/rethink.md +83 -0
  316. package/src/resources/extensions/gsd/prompts/system.md +1 -1
  317. package/src/resources/extensions/gsd/prompts/validate-milestone.md +7 -37
  318. package/src/resources/extensions/gsd/provider-error-pause.ts +9 -0
  319. package/src/resources/extensions/gsd/repo-identity.ts +46 -7
  320. package/src/resources/extensions/gsd/rethink.ts +154 -0
  321. package/src/resources/extensions/gsd/session-lock.ts +0 -4
  322. package/src/resources/extensions/gsd/state.ts +49 -1
  323. package/src/resources/extensions/gsd/sync-lock.ts +94 -0
  324. package/src/resources/extensions/gsd/tests/auto-lock-creation.test.ts +5 -13
  325. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +6 -10
  326. package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +88 -0
  327. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +96 -0
  328. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +264 -228
  329. package/src/resources/extensions/gsd/tests/complete-task.test.ts +317 -250
  330. package/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts +114 -0
  331. package/src/resources/extensions/gsd/tests/crash-recovery.test.ts +2 -8
  332. package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +0 -3
  333. package/src/resources/extensions/gsd/tests/db-writer.test.ts +79 -0
  334. package/src/resources/extensions/gsd/tests/derive-state-db-disk-reconcile.test.ts +121 -0
  335. package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +60 -0
  336. package/src/resources/extensions/gsd/tests/est-annotation-timeout.test.ts +120 -0
  337. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +1 -1
  338. package/src/resources/extensions/gsd/tests/idle-recovery.test.ts +1 -1
  339. package/src/resources/extensions/gsd/tests/infra-error.test.ts +20 -2
  340. package/src/resources/extensions/gsd/tests/inherited-repo-home-dir.test.ts +121 -0
  341. package/src/resources/extensions/gsd/tests/integration-proof.test.ts +15 -24
  342. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +0 -3
  343. package/src/resources/extensions/gsd/tests/mcp-status.test.ts +103 -0
  344. package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
  345. package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
  346. package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +66 -0
  347. package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +8 -9
  348. package/src/resources/extensions/gsd/tests/none-mode-gates.test.ts +42 -3
  349. package/src/resources/extensions/gsd/tests/parallel-budget-atomicity.test.ts +0 -1
  350. package/src/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +0 -7
  351. package/src/resources/extensions/gsd/tests/parallel-merge.test.ts +7 -8
  352. package/src/resources/extensions/gsd/tests/parallel-orchestration.test.ts +20 -24
  353. package/src/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +0 -2
  354. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +9 -6
  355. package/src/resources/extensions/gsd/tests/post-mutation-hook.test.ts +171 -0
  356. package/src/resources/extensions/gsd/tests/preferences.test.ts +7 -9
  357. package/src/resources/extensions/gsd/tests/projection-regression.test.ts +174 -0
  358. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +26 -21
  359. package/src/resources/extensions/gsd/tests/recovery-attempts-reset.test.ts +176 -0
  360. package/src/resources/extensions/gsd/tests/reopen-slice.test.ts +155 -0
  361. package/src/resources/extensions/gsd/tests/reopen-task.test.ts +165 -0
  362. package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +1 -4
  363. package/src/resources/extensions/gsd/tests/stop-auto-merge-back.test.ts +67 -0
  364. package/src/resources/extensions/gsd/tests/stop-auto-remote.test.ts +2 -3
  365. package/src/resources/extensions/gsd/tests/survivor-branch-complete.test.ts +108 -0
  366. package/src/resources/extensions/gsd/tests/sync-lock.test.ts +122 -0
  367. package/src/resources/extensions/gsd/tests/terminated-transient.test.ts +49 -0
  368. package/src/resources/extensions/gsd/tests/tool-naming.test.ts +2 -1
  369. package/src/resources/extensions/gsd/tests/unit-ownership.test.ts +175 -0
  370. package/src/resources/extensions/gsd/tests/workflow-events.test.ts +205 -0
  371. package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +275 -0
  372. package/src/resources/extensions/gsd/tests/workflow-manifest.test.ts +186 -0
  373. package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +171 -0
  374. package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +220 -0
  375. package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +65 -0
  376. package/src/resources/extensions/gsd/tests/write-intercept.test.ts +76 -0
  377. package/src/resources/extensions/gsd/tools/complete-milestone.ts +74 -11
  378. package/src/resources/extensions/gsd/tools/complete-slice.ts +68 -11
  379. package/src/resources/extensions/gsd/tools/complete-task.ts +63 -1
  380. package/src/resources/extensions/gsd/tools/plan-milestone.ts +45 -0
  381. package/src/resources/extensions/gsd/tools/plan-slice.ts +40 -0
  382. package/src/resources/extensions/gsd/tools/plan-task.ts +37 -1
  383. package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +39 -1
  384. package/src/resources/extensions/gsd/tools/reopen-slice.ts +125 -0
  385. package/src/resources/extensions/gsd/tools/reopen-task.ts +129 -0
  386. package/src/resources/extensions/gsd/tools/replan-slice.ts +41 -1
  387. package/src/resources/extensions/gsd/tools/validate-milestone.ts +127 -0
  388. package/src/resources/extensions/gsd/types.ts +8 -0
  389. package/src/resources/extensions/gsd/unit-ownership.ts +104 -0
  390. package/src/resources/extensions/gsd/workflow-events.ts +154 -0
  391. package/src/resources/extensions/gsd/workflow-logger.ts +243 -0
  392. package/src/resources/extensions/gsd/workflow-manifest.ts +334 -0
  393. package/src/resources/extensions/gsd/workflow-migration.ts +345 -0
  394. package/src/resources/extensions/gsd/workflow-projections.ts +425 -0
  395. package/src/resources/extensions/gsd/workflow-reconcile.ts +503 -0
  396. package/src/resources/extensions/gsd/worktree-manager.ts +41 -5
  397. package/src/resources/extensions/gsd/worktree-resolver.ts +44 -0
  398. package/src/resources/extensions/gsd/write-intercept.ts +90 -0
  399. package/src/resources/extensions/mcp-client/index.ts +20 -0
  400. package/src/resources/extensions/voice/index.ts +11 -21
  401. package/src/resources/extensions/voice/linux-ready.ts +87 -0
  402. package/src/resources/extensions/voice/tests/linux-ready.test.ts +124 -0
  403. package/dist/web/standalone/.next/static/chunks/4024.0de81b543b28b9fe.js +0 -9
  404. package/dist/web/standalone/.next/static/chunks/webpack-9014b5adb127a98a.js +0 -1
  405. package/dist/web/standalone/.next/static/css/8a727f372cf53002.css +0 -1
  406. /package/dist/web/standalone/.next/static/{tokoGmfkYfWf1_Yl_Gz7i → j-BskPs0nxxPeYY-bSrab}/_buildManifest.js +0 -0
  407. /package/dist/web/standalone/.next/static/{tokoGmfkYfWf1_Yl_Gz7i → j-BskPs0nxxPeYY-bSrab}/_ssgManifest.js +0 -0
@@ -5,7 +5,7 @@ import type { DoctorIssue, DoctorIssueCode } from "./doctor-types.js";
5
5
  import { readRepoMeta, externalProjectsRoot, cleanNumberedGsdVariants } from "./repo-identity.js";
6
6
  import { loadFile } from "./files.js";
7
7
  import { parseRoadmap as parseLegacyRoadmap } from "./parsers-legacy.js";
8
- import { isDbAvailable, getMilestoneSlices } from "./gsd-db.js";
8
+ import { isDbAvailable, _getAdapter, getMilestoneSlices } from "./gsd-db.js";
9
9
  import { resolveMilestoneFile, milestonesDir, gsdRoot, resolveGsdRootFile, relGsdRootFile } from "./paths.js";
10
10
  import { deriveState, isMilestoneComplete } from "./state.js";
11
11
  import { saveFile } from "./files.js";
@@ -19,13 +19,15 @@ import { getAllWorktreeHealth } from "./worktree-health.js";
19
19
  import { readAllSessionStatuses, isSessionStale, removeSessionStatus } from "./session-status-io.js";
20
20
  import { recoverFailedMigration } from "./migrate-external.js";
21
21
  import { loadEffectiveGSDPreferences } from "./preferences.js";
22
+ import { readEvents } from "./workflow-events.js";
23
+ import { renderAllProjections } from "./workflow-projections.js";
22
24
 
23
25
  export async function checkGitHealth(
24
26
  basePath: string,
25
27
  issues: DoctorIssue[],
26
28
  fixesApplied: string[],
27
29
  shouldFix: (code: DoctorIssueCode) => boolean,
28
- isolationMode: "none" | "worktree" | "branch" = "worktree",
30
+ isolationMode: "none" | "worktree" | "branch" = "none",
29
31
  ): Promise<void> {
30
32
  // Degrade gracefully if not a git repo
31
33
  if (!nativeIsRepo(basePath)) {
@@ -1111,3 +1113,179 @@ export async function checkGlobalHealth(
1111
1113
  // Non-fatal — global health check must not block per-project doctor
1112
1114
  }
1113
1115
  }
1116
+
1117
+ // ── Engine Health Checks ────────────────────────────────────────────────────
1118
+ // DB constraint violation detection and projection drift checks.
1119
+
1120
+ export async function checkEngineHealth(
1121
+ basePath: string,
1122
+ issues: DoctorIssue[],
1123
+ fixesApplied: string[],
1124
+ ): Promise<void> {
1125
+ // ── DB constraint violation detection (full doctor only, not pre-dispatch per D-10) ──
1126
+ try {
1127
+ if (isDbAvailable()) {
1128
+ const adapter = _getAdapter()!;
1129
+
1130
+ // a. Orphaned tasks (task.slice_id points to non-existent slice)
1131
+ try {
1132
+ const orphanedTasks = adapter
1133
+ .prepare(
1134
+ `SELECT t.id, t.slice_id, t.milestone_id
1135
+ FROM tasks t
1136
+ LEFT JOIN slices s ON t.milestone_id = s.milestone_id AND t.slice_id = s.id
1137
+ WHERE s.id IS NULL`,
1138
+ )
1139
+ .all() as Array<{ id: string; slice_id: string; milestone_id: string }>;
1140
+
1141
+ for (const row of orphanedTasks) {
1142
+ issues.push({
1143
+ severity: "error",
1144
+ code: "db_orphaned_task",
1145
+ scope: "task",
1146
+ unitId: `${row.milestone_id}/${row.slice_id}/${row.id}`,
1147
+ message: `Task ${row.id} references slice ${row.slice_id} in milestone ${row.milestone_id} but no such slice exists in the database`,
1148
+ fixable: false,
1149
+ });
1150
+ }
1151
+ } catch {
1152
+ // Non-fatal — orphaned task check failed
1153
+ }
1154
+
1155
+ // b. Orphaned slices (slice.milestone_id points to non-existent milestone)
1156
+ try {
1157
+ const orphanedSlices = adapter
1158
+ .prepare(
1159
+ `SELECT s.id, s.milestone_id
1160
+ FROM slices s
1161
+ LEFT JOIN milestones m ON s.milestone_id = m.id
1162
+ WHERE m.id IS NULL`,
1163
+ )
1164
+ .all() as Array<{ id: string; milestone_id: string }>;
1165
+
1166
+ for (const row of orphanedSlices) {
1167
+ issues.push({
1168
+ severity: "error",
1169
+ code: "db_orphaned_slice",
1170
+ scope: "slice",
1171
+ unitId: `${row.milestone_id}/${row.id}`,
1172
+ message: `Slice ${row.id} references milestone ${row.milestone_id} but no such milestone exists in the database`,
1173
+ fixable: false,
1174
+ });
1175
+ }
1176
+ } catch {
1177
+ // Non-fatal — orphaned slice check failed
1178
+ }
1179
+
1180
+ // c. Tasks marked complete without summaries
1181
+ try {
1182
+ const doneTasks = adapter
1183
+ .prepare(
1184
+ `SELECT id, slice_id, milestone_id FROM tasks
1185
+ WHERE status = 'done' AND (summary IS NULL OR summary = '')`,
1186
+ )
1187
+ .all() as Array<{ id: string; slice_id: string; milestone_id: string }>;
1188
+
1189
+ for (const row of doneTasks) {
1190
+ issues.push({
1191
+ severity: "warning",
1192
+ code: "db_done_task_no_summary",
1193
+ scope: "task",
1194
+ unitId: `${row.milestone_id}/${row.slice_id}/${row.id}`,
1195
+ message: `Task ${row.id} is marked done but has no summary in the database`,
1196
+ fixable: false,
1197
+ });
1198
+ }
1199
+ } catch {
1200
+ // Non-fatal — done-task-no-summary check failed
1201
+ }
1202
+
1203
+ // d. Duplicate entity IDs (safety check)
1204
+ try {
1205
+ const dupMilestones = adapter
1206
+ .prepare("SELECT id, COUNT(*) as cnt FROM milestones GROUP BY id HAVING cnt > 1")
1207
+ .all() as Array<{ id: string; cnt: number }>;
1208
+ for (const row of dupMilestones) {
1209
+ issues.push({
1210
+ severity: "error",
1211
+ code: "db_duplicate_id",
1212
+ scope: "milestone",
1213
+ unitId: row.id,
1214
+ message: `Duplicate milestone ID "${row.id}" appears ${row.cnt} times in the database`,
1215
+ fixable: false,
1216
+ });
1217
+ }
1218
+
1219
+ const dupSlices = adapter
1220
+ .prepare("SELECT id, milestone_id, COUNT(*) as cnt FROM slices GROUP BY id, milestone_id HAVING cnt > 1")
1221
+ .all() as Array<{ id: string; milestone_id: string; cnt: number }>;
1222
+ for (const row of dupSlices) {
1223
+ issues.push({
1224
+ severity: "error",
1225
+ code: "db_duplicate_id",
1226
+ scope: "slice",
1227
+ unitId: `${row.milestone_id}/${row.id}`,
1228
+ message: `Duplicate slice ID "${row.id}" in milestone ${row.milestone_id} appears ${row.cnt} times`,
1229
+ fixable: false,
1230
+ });
1231
+ }
1232
+
1233
+ const dupTasks = adapter
1234
+ .prepare("SELECT id, slice_id, milestone_id, COUNT(*) as cnt FROM tasks GROUP BY id, slice_id, milestone_id HAVING cnt > 1")
1235
+ .all() as Array<{ id: string; slice_id: string; milestone_id: string; cnt: number }>;
1236
+ for (const row of dupTasks) {
1237
+ issues.push({
1238
+ severity: "error",
1239
+ code: "db_duplicate_id",
1240
+ scope: "task",
1241
+ unitId: `${row.milestone_id}/${row.slice_id}/${row.id}`,
1242
+ message: `Duplicate task ID "${row.id}" in slice ${row.slice_id} appears ${row.cnt} times`,
1243
+ fixable: false,
1244
+ });
1245
+ }
1246
+ } catch {
1247
+ // Non-fatal — duplicate ID check failed
1248
+ }
1249
+ }
1250
+ } catch {
1251
+ // Non-fatal — DB constraint checks failed entirely
1252
+ }
1253
+
1254
+ // ── Projection drift detection ──────────────────────────────────────────
1255
+ // If the DB is available, check whether markdown projections are stale
1256
+ // relative to the event log and re-render them.
1257
+ try {
1258
+ if (isDbAvailable()) {
1259
+ const eventLogPath = join(basePath, ".gsd", "event-log.jsonl");
1260
+ const events = readEvents(eventLogPath);
1261
+ if (events.length > 0) {
1262
+ const lastEventTs = new Date(events[events.length - 1]!.ts).getTime();
1263
+ const state = await deriveState(basePath);
1264
+ for (const milestone of state.registry) {
1265
+ if (milestone.status === "complete") continue;
1266
+ const roadmapPath = resolveMilestoneFile(basePath, milestone.id, "ROADMAP");
1267
+ if (!roadmapPath || !existsSync(roadmapPath)) {
1268
+ try {
1269
+ await renderAllProjections(basePath, milestone.id);
1270
+ fixesApplied.push(`re-rendered missing projections for ${milestone.id}`);
1271
+ } catch {
1272
+ // Non-fatal — projection re-render failed
1273
+ }
1274
+ continue;
1275
+ }
1276
+ const projectionMtime = statSync(roadmapPath).mtimeMs;
1277
+ if (lastEventTs > projectionMtime) {
1278
+ try {
1279
+ await renderAllProjections(basePath, milestone.id);
1280
+ fixesApplied.push(`re-rendered stale projections for ${milestone.id}`);
1281
+ } catch {
1282
+ // Non-fatal — projection re-render failed
1283
+ }
1284
+ }
1285
+ }
1286
+ }
1287
+ }
1288
+ } catch {
1289
+ // Non-fatal — projection drift check must never block doctor
1290
+ }
1291
+ }
@@ -70,7 +70,13 @@ export type DoctorIssueCode =
70
70
  | "large_planning_file"
71
71
  // Slow environment checks (opt-in via --build / --test flags)
72
72
  | "env_build"
73
- | "env_test";
73
+ | "env_test"
74
+ // Engine health checks (Phase 4)
75
+ | "db_orphaned_task"
76
+ | "db_orphaned_slice"
77
+ | "db_done_task_no_summary"
78
+ | "db_duplicate_id"
79
+ | "projection_drift";
74
80
 
75
81
  /**
76
82
  * Issue codes that represent global or completion-critical state.
@@ -12,7 +12,7 @@ import { loadEffectiveGSDPreferences, type GSDPreferences } from "./preferences.
12
12
  import type { DoctorIssue, DoctorIssueCode, DoctorReport } from "./doctor-types.js";
13
13
  import { GLOBAL_STATE_CODES } from "./doctor-types.js";
14
14
  import type { RoadmapSliceEntry } from "./types.js";
15
- import { checkGitHealth, checkRuntimeHealth, checkGlobalHealth } from "./doctor-checks.js";
15
+ import { checkGitHealth, checkRuntimeHealth, checkGlobalHealth, checkEngineHealth } from "./doctor-checks.js";
16
16
  import { checkEnvironmentHealth } from "./doctor-environment.js";
17
17
  import { runProviderChecks } from "./doctor-providers.js";
18
18
 
@@ -360,8 +360,8 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
360
360
  // Git health checks — timed
361
361
  const t0git = Date.now();
362
362
  const isolationMode: "none" | "worktree" | "branch" = options?.isolationMode ??
363
- (prefs?.preferences?.git?.isolation === "none" ? "none" :
364
- prefs?.preferences?.git?.isolation === "branch" ? "branch" : "worktree");
363
+ (prefs?.preferences?.git?.isolation === "worktree" ? "worktree" :
364
+ prefs?.preferences?.git?.isolation === "branch" ? "branch" : "none");
365
365
  await checkGitHealth(basePath, issues, fixesApplied, shouldFix, isolationMode);
366
366
  const gitMs = Date.now() - t0git;
367
367
 
@@ -382,6 +382,9 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
382
382
  });
383
383
  const envMs = Date.now() - t0env;
384
384
 
385
+ // Engine health checks — DB constraints and projection drift
386
+ await checkEngineHealth(basePath, issues, fixesApplied);
387
+
385
388
  const milestonesPath = milestonesDir(basePath);
386
389
  if (!existsSync(milestonesPath)) {
387
390
  const report: DoctorReport = { ok: issues.every(i => i.severity !== "error"), basePath, issues, fixesApplied, timing: { git: gitMs, runtime: runtimeMs, environment: envMs, gsdState: 0 } };
@@ -470,7 +473,7 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
470
473
  if (!roadmapContent) continue;
471
474
 
472
475
  // Normalize slices: prefer DB, fall back to parser
473
- type NormSlice = RoadmapSliceEntry;
476
+ type NormSlice = RoadmapSliceEntry & { pending?: boolean };
474
477
  let slices: NormSlice[];
475
478
  if (isDbAvailable()) {
476
479
  const dbSlices = getMilestoneSlices(milestoneId);
@@ -478,6 +481,7 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
478
481
  id: s.id,
479
482
  title: s.title,
480
483
  done: s.status === "complete",
484
+ pending: s.status === "pending",
481
485
  risk: (s.risk || "medium") as RoadmapSliceEntry["risk"],
482
486
  depends: s.depends,
483
487
  demo: s.demo,
@@ -564,6 +568,9 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
564
568
 
565
569
  const slicePath = resolveSlicePath(basePath, milestoneId, slice.id);
566
570
  if (!slicePath) {
571
+ // Pending slices haven't been planned yet — directories are created
572
+ // lazily by ensurePreconditions() at dispatch time. Skip them.
573
+ if (slice.pending) continue;
567
574
  const expectedPath = relSlicePath(basePath, milestoneId, slice.id);
568
575
  issues.push({
569
576
  severity: slice.done ? "warning" : "error",
@@ -586,6 +593,8 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
586
593
 
587
594
  const tasksDir = resolveTasksDir(basePath, milestoneId, slice.id);
588
595
  if (!tasksDir) {
596
+ // Pending slices haven't been planned yet — tasks/ is created on demand.
597
+ if (slice.pending) continue;
589
598
  issues.push({
590
599
  severity: slice.done ? "warning" : "error",
591
600
  code: "missing_tasks_dir",
@@ -684,13 +684,17 @@ export function createDraftPR(
684
684
  milestoneId: string,
685
685
  title: string,
686
686
  body: string,
687
+ opts?: { head?: string; base?: string },
687
688
  ): string | null {
688
689
  try {
689
- const result = execFileSync("gh", [
690
+ const args = [
690
691
  "pr", "create", "--draft",
691
692
  "--title", title,
692
693
  "--body", body,
693
- ], { cwd: basePath, encoding: "utf8", timeout: 30000, env: GIT_NO_PROMPT_ENV });
694
+ ];
695
+ if (opts?.head) args.push("--head", opts.head);
696
+ if (opts?.base) args.push("--base", opts.base);
697
+ const result = execFileSync("gh", args, { cwd: basePath, encoding: "utf8", timeout: 30000, env: GIT_NO_PROMPT_ENV });
694
698
  return result.trim();
695
699
  } catch {
696
700
  return null;
@@ -78,8 +78,12 @@ function loadProvider(): void {
78
78
  // unavailable
79
79
  }
80
80
 
81
+ const nodeMajor = parseInt(process.versions.node.split(".")[0], 10);
82
+ const versionHint = nodeMajor < 22
83
+ ? ` GSD requires Node >= 22.0.0 (current: v${process.versions.node}). Upgrade Node to fix this.`
84
+ : "";
81
85
  process.stderr.write(
82
- "gsd-db: No SQLite provider available (tried node:sqlite, better-sqlite3)\n",
86
+ `gsd-db: No SQLite provider available (tried node:sqlite, better-sqlite3).${versionHint}\n`,
83
87
  );
84
88
  }
85
89
 
@@ -145,7 +149,7 @@ function openRawDb(path: string): unknown {
145
149
  return new Database(path);
146
150
  }
147
151
 
148
- const SCHEMA_VERSION = 10;
152
+ const SCHEMA_VERSION = 11;
149
153
 
150
154
  function initSchema(db: DbAdapter, fileBacked: boolean): void {
151
155
  if (fileBacked) db.exec("PRAGMA journal_mode=WAL");
@@ -301,6 +305,7 @@ function initSchema(db: DbAdapter, fileBacked: boolean): void {
301
305
  inputs TEXT NOT NULL DEFAULT '[]',
302
306
  expected_output TEXT NOT NULL DEFAULT '[]',
303
307
  observability_impact TEXT NOT NULL DEFAULT '',
308
+ full_plan_md TEXT NOT NULL DEFAULT '',
304
309
  sequence INTEGER DEFAULT 0, -- DEAD CODE: no tool exposes sequence — always 0
305
310
  PRIMARY KEY (milestone_id, slice_id, id),
306
311
  FOREIGN KEY (milestone_id, slice_id) REFERENCES slices(milestone_id, id)
@@ -616,6 +621,22 @@ function migrateSchema(db: DbAdapter): void {
616
621
  });
617
622
  }
618
623
 
624
+ if (currentVersion < 11) {
625
+ ensureColumn(db, "tasks", "full_plan_md", `ALTER TABLE tasks ADD COLUMN full_plan_md TEXT NOT NULL DEFAULT ''`);
626
+ // Add unique constraint to replan_history for idempotency:
627
+ // one replan record per blocker task per slice per milestone.
628
+ db.exec(`
629
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_replan_history_unique
630
+ ON replan_history(milestone_id, slice_id, task_id)
631
+ WHERE slice_id IS NOT NULL AND task_id IS NOT NULL
632
+ `);
633
+
634
+ db.prepare("INSERT INTO schema_version (version, applied_at) VALUES (:version, :applied_at)").run({
635
+ ":version": 11,
636
+ ":applied_at": new Date().toISOString(),
637
+ });
638
+ }
639
+
619
640
  db.exec("COMMIT");
620
641
  } catch (err) {
621
642
  db.exec("ROLLBACK");
@@ -923,6 +944,7 @@ export interface TaskPlanningRecord {
923
944
  inputs: string[];
924
945
  expectedOutput: string[];
925
946
  observabilityImpact: string;
947
+ fullPlanMd?: string;
926
948
  }
927
949
 
928
950
  export function insertMilestone(m: {
@@ -1163,7 +1185,8 @@ export function upsertTaskPlanning(milestoneId: string, sliceId: string, taskId:
1163
1185
  verify = COALESCE(:verify, verify),
1164
1186
  inputs = COALESCE(:inputs, inputs),
1165
1187
  expected_output = COALESCE(:expected_output, expected_output),
1166
- observability_impact = COALESCE(:observability_impact, observability_impact)
1188
+ observability_impact = COALESCE(:observability_impact, observability_impact),
1189
+ full_plan_md = COALESCE(:full_plan_md, full_plan_md)
1167
1190
  WHERE milestone_id = :milestone_id AND slice_id = :slice_id AND id = :id`,
1168
1191
  ).run({
1169
1192
  ":milestone_id": milestoneId,
@@ -1177,6 +1200,7 @@ export function upsertTaskPlanning(milestoneId: string, sliceId: string, taskId:
1177
1200
  ":inputs": planning.inputs ? JSON.stringify(planning.inputs) : null,
1178
1201
  ":expected_output": planning.expectedOutput ? JSON.stringify(planning.expectedOutput) : null,
1179
1202
  ":observability_impact": planning.observabilityImpact ?? null,
1203
+ ":full_plan_md": planning.fullPlanMd ?? null,
1180
1204
  });
1181
1205
  }
1182
1206
 
@@ -1268,6 +1292,7 @@ export interface TaskRow {
1268
1292
  inputs: string[];
1269
1293
  expected_output: string[];
1270
1294
  observability_impact: string;
1295
+ full_plan_md: string;
1271
1296
  sequence: number;
1272
1297
  }
1273
1298
 
@@ -1296,6 +1321,7 @@ function rowToTask(row: Record<string, unknown>): TaskRow {
1296
1321
  inputs: JSON.parse((row["inputs"] as string) || "[]"),
1297
1322
  expected_output: JSON.parse((row["expected_output"] as string) || "[]"),
1298
1323
  observability_impact: (row["observability_impact"] as string) ?? "",
1324
+ full_plan_md: (row["full_plan_md"] as string) ?? "",
1299
1325
  sequence: (row["sequence"] as number) ?? 0,
1300
1326
  };
1301
1327
  }
@@ -1587,8 +1613,10 @@ export function insertReplanHistory(entry: {
1587
1613
  replacementArtifactPath?: string | null;
1588
1614
  }): void {
1589
1615
  if (!currentDb) throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
1616
+ // INSERT OR REPLACE: idempotent on (milestone_id, slice_id, task_id) via schema v11 unique index.
1617
+ // Retrying the same replan silently updates summary instead of accumulating duplicate rows.
1590
1618
  currentDb.prepare(
1591
- `INSERT INTO replan_history (milestone_id, slice_id, task_id, summary, previous_artifact_path, replacement_artifact_path, created_at)
1619
+ `INSERT OR REPLACE INTO replan_history (milestone_id, slice_id, task_id, summary, previous_artifact_path, replacement_artifact_path, created_at)
1592
1620
  VALUES (:milestone_id, :slice_id, :task_id, :summary, :previous_artifact_path, :replacement_artifact_path, :created_at)`,
1593
1621
  ).run({
1594
1622
  ":milestone_id": entry.milestoneId,
@@ -910,8 +910,7 @@ export async function showSmartEntry(
910
910
  // when the user exits during init wizard or discuss phase before any
911
911
  // real auto-mode work begins.
912
912
  const isBootstrapCrash = crashLock.unitType === "starting"
913
- && crashLock.unitId === "bootstrap"
914
- && crashLock.completedUnits === 0;
913
+ && crashLock.unitId === "bootstrap";
915
914
 
916
915
  if (!isBootstrapCrash) {
917
916
  const resume = await showNextAction(ctx, {
@@ -32,7 +32,12 @@ export type JournalEventType =
32
32
  | "milestone-transition"
33
33
  | "stuck-detected"
34
34
  | "sidecar-dequeue"
35
- | "iteration-end";
35
+ | "iteration-end"
36
+ | "worktree-enter"
37
+ | "worktree-create-failed"
38
+ | "worktree-skip"
39
+ | "worktree-merge-start"
40
+ | "worktree-merge-failed";
36
41
 
37
42
  /** A single structured event in the journal. */
38
43
  export interface JournalEntry {
@@ -387,7 +387,7 @@ export async function renderTaskPlanFromDb(
387
387
  mkdirSync(tasksDir, { recursive: true });
388
388
  const absPath = join(tasksDir, buildTaskFileName(taskId, "PLAN"));
389
389
  const artifactPath = toArtifactPath(absPath, basePath);
390
- const content = renderTaskPlanMarkdown(task);
390
+ const content = task.full_plan_md.trim() ? task.full_plan_md : renderTaskPlanMarkdown(task);
391
391
 
392
392
  await writeAndStore(absPath, artifactPath, content, {
393
393
  artifact_type: "PLAN",
@@ -37,7 +37,7 @@ export function determineMergeOrder(
37
37
  workers: WorkerInfo[],
38
38
  order: MergeOrder = "sequential",
39
39
  ): string[] {
40
- const completed = workers.filter(w => w.state === "stopped" && w.completedUnits > 0);
40
+ const completed = workers.filter(w => w.state === "stopped");
41
41
  if (order === "by-completion") {
42
42
  return completed
43
43
  .sort((a, b) => a.startedAt - b.startedAt) // earliest first
@@ -52,7 +52,6 @@ export interface WorkerInfo {
52
52
  worktreePath: string;
53
53
  startedAt: number;
54
54
  state: "running" | "paused" | "stopped" | "error";
55
- completedUnits: number;
56
55
  cost: number;
57
56
  cleanup?: () => void;
58
57
  }
@@ -83,7 +82,6 @@ export interface PersistedState {
83
82
  worktreePath: string;
84
83
  startedAt: number;
85
84
  state: "running" | "paused" | "stopped" | "error";
86
- completedUnits: number;
87
85
  cost: number;
88
86
  }>;
89
87
  totalCost: number;
@@ -114,7 +112,6 @@ export function persistState(basePath: string): void {
114
112
  worktreePath: w.worktreePath,
115
113
  startedAt: w.startedAt,
116
114
  state: w.state,
117
- completedUnits: w.completedUnits,
118
115
  cost: w.cost,
119
116
  })),
120
117
  totalCost: state.totalCost,
@@ -226,7 +223,6 @@ function restoreRuntimeState(basePath: string): boolean {
226
223
  worktreePath: diskStatus?.worktreePath ?? w.worktreePath,
227
224
  startedAt: w.startedAt,
228
225
  state: diskStatus?.state ?? w.state,
229
- completedUnits: diskStatus?.completedUnits ?? w.completedUnits,
230
226
  cost: diskStatus?.cost ?? w.cost,
231
227
  });
232
228
  }
@@ -261,7 +257,6 @@ function restoreRuntimeState(basePath: string): boolean {
261
257
  worktreePath: status.worktreePath,
262
258
  startedAt: status.startedAt,
263
259
  state: status.state,
264
- completedUnits: status.completedUnits,
265
260
  cost: status.cost,
266
261
  });
267
262
  state.totalCost += status.cost;
@@ -389,7 +384,6 @@ export async function startParallel(
389
384
  worktreePath: w.worktreePath,
390
385
  startedAt: w.startedAt,
391
386
  state: "running",
392
- completedUnits: w.completedUnits,
393
387
  cost: w.cost,
394
388
  });
395
389
  adopted.push(w.milestoneId);
@@ -440,7 +434,6 @@ export async function startParallel(
440
434
  worktreePath: wtPath,
441
435
  startedAt: now,
442
436
  state: "running",
443
- completedUnits: 0,
444
437
  cost: 0,
445
438
  };
446
439
 
@@ -602,7 +595,7 @@ export function spawnWorker(
602
595
  pid: worker.pid,
603
596
  state: "running",
604
597
  currentUnit: null,
605
- completedUnits: worker.completedUnits,
598
+ completedUnits: 0,
606
599
  cost: worker.cost,
607
600
  lastHeartbeat: Date.now(),
608
601
  startedAt: worker.startedAt,
@@ -645,7 +638,7 @@ export function spawnWorker(
645
638
  pid: w.pid,
646
639
  state: w.state,
647
640
  currentUnit: null,
648
- completedUnits: w.completedUnits,
641
+ completedUnits: 0,
649
642
  cost: w.cost,
650
643
  lastHeartbeat: Date.now(),
651
644
  startedAt: w.startedAt,
@@ -727,14 +720,6 @@ function processWorkerLine(basePath: string, milestoneId: string, line: string):
727
720
  }
728
721
  }
729
722
 
730
- // Track completed units (each message_end from assistant = progress)
731
- if (msg.role === "assistant") {
732
- const worker = state.workers.get(milestoneId);
733
- if (worker) {
734
- worker.completedUnits++;
735
- }
736
- }
737
-
738
723
  // Update session status file so dashboard sees live cost
739
724
  const worker = state.workers.get(milestoneId);
740
725
  if (worker) {
@@ -743,7 +728,7 @@ function processWorkerLine(basePath: string, milestoneId: string, line: string):
743
728
  pid: worker.pid,
744
729
  state: worker.state,
745
730
  currentUnit: null,
746
- completedUnits: worker.completedUnits,
731
+ completedUnits: 0,
747
732
  cost: worker.cost,
748
733
  lastHeartbeat: Date.now(),
749
734
  startedAt: worker.startedAt,
@@ -762,7 +747,7 @@ function processWorkerLine(basePath: string, milestoneId: string, line: string):
762
747
  pid: worker.pid,
763
748
  state: worker.state,
764
749
  currentUnit: null,
765
- completedUnits: worker.completedUnits,
750
+ completedUnits: 0,
766
751
  cost: worker.cost,
767
752
  lastHeartbeat: Date.now(),
768
753
  startedAt: worker.startedAt,
@@ -930,14 +915,13 @@ export function refreshWorkerStatuses(
930
915
  if (!isPidAlive(worker.pid)) {
931
916
  worker.cleanup?.();
932
917
  worker.cleanup = undefined;
933
- worker.state = worker.completedUnits > 0 ? "stopped" : "error";
918
+ worker.state = "error";
934
919
  worker.process = null;
935
920
  }
936
921
  continue;
937
922
  }
938
923
 
939
924
  worker.state = diskStatus.state;
940
- worker.completedUnits = diskStatus.completedUnits;
941
925
  worker.cost = diskStatus.cost;
942
926
  worker.pid = diskStatus.pid;
943
927
  }
@@ -34,7 +34,7 @@ export const MODE_DEFAULTS: Record<WorkflowMode, Partial<GSDPreferences>> = {
34
34
  push_branches: false,
35
35
  pre_merge_check: false,
36
36
  merge_strategy: "squash",
37
- isolation: "worktree",
37
+ isolation: "none",
38
38
  },
39
39
  unique_milestone_ids: false,
40
40
  },
@@ -44,7 +44,7 @@ export const MODE_DEFAULTS: Record<WorkflowMode, Partial<GSDPreferences>> = {
44
44
  push_branches: true,
45
45
  pre_merge_check: true,
46
46
  merge_strategy: "squash",
47
- isolation: "worktree",
47
+ isolation: "none",
48
48
  },
49
49
  unique_milestone_ids: true,
50
50
  },
@@ -497,13 +497,17 @@ export function resolvePreDispatchHooks(): PreDispatchHookConfig[] {
497
497
 
498
498
  /**
499
499
  * Resolve the effective git isolation mode from preferences.
500
- * Returns "worktree" (default), "branch", or "none".
500
+ * Returns "none" (default), "worktree", or "branch".
501
+ *
502
+ * Default is "none" so GSD works out of the box without preferences.md.
503
+ * Worktree isolation requires explicit opt-in because it depends on git
504
+ * branch infrastructure that must be set up before use.
501
505
  */
502
506
  export function getIsolationMode(): "none" | "worktree" | "branch" {
503
507
  const prefs = loadEffectiveGSDPreferences()?.preferences?.git;
504
- if (prefs?.isolation === "none") return "none";
508
+ if (prefs?.isolation === "worktree") return "worktree";
505
509
  if (prefs?.isolation === "branch") return "branch";
506
- return "worktree"; // default
510
+ return "none"; // default — no isolation, work on current branch
507
511
  }
508
512
 
509
513
  export function resolveParallelConfig(prefs: GSDPreferences | undefined): import("./types.js").ParallelConfig {
@@ -17,20 +17,31 @@ All relevant context has been preloaded below — the roadmap, all slice summari
17
17
  Then:
18
18
  1. Use the **Milestone Summary** output template from the inlined context above
19
19
  2. {{skillActivation}}
20
- 3. **Verify code changes exist.** Run `git diff --stat HEAD $(git merge-base HEAD main) -- ':!.gsd/'` (or the equivalent for the integration branch). If no non-`.gsd/` files appear in the diff, the milestone produced only planning artifacts and no actual code. In that case, do NOT mark the milestone as passing verification — document the gap clearly in the summary and state that implementation is missing.
21
- 4. Verify each **success criterion** from the milestone definition in `{{roadmapPath}}`. For each criterion, confirm it was met with specific evidence from slice summaries, test results, or observable behavior. List any criterion that was NOT met.
22
- 5. Verify the milestone's **definition of done** — all slices are `[x]`, all slice summaries exist, and any cross-slice integration points work correctly.
20
+ 3. **Verify code changes exist.** Run `git diff --stat HEAD $(git merge-base HEAD main) -- ':!.gsd/'` (or the equivalent for the integration branch). If no non-`.gsd/` files appear in the diff, the milestone produced only planning artifacts and no actual code. Record this as a **verification failure**.
21
+ 4. Verify each **success criterion** from the milestone definition in `{{roadmapPath}}`. For each criterion, confirm it was met with specific evidence from slice summaries, test results, or observable behavior. Record any criterion that was NOT met as a **verification failure**.
22
+ 5. Verify the milestone's **definition of done** — all slices are `[x]`, all slice summaries exist, and any cross-slice integration points work correctly. Record any unmet items as a **verification failure**.
23
23
  6. Validate **requirement status transitions**. For each requirement that changed status during this milestone, confirm the transition is supported by evidence. Requirements can move between Active, Validated, Deferred, Blocked, or Out of Scope — but only with proof.
24
- 7. Write `{{milestoneSummaryPath}}` using the milestone-summary template. Fill all frontmatter fields and narrative sections. The `requirement_outcomes` field must list every requirement that changed status with `from_status`, `to_status`, and `proof`.
25
- 8. Update `.gsd/REQUIREMENTS.md` if any requirement status transitions were validated in step 5.
24
+
25
+ ### Verification Gate STOP if verification failed
26
+
27
+ **If ANY verification failure was recorded in steps 3, 4, or 5, you MUST follow the failure path below. Do NOT proceed to step 7.**
28
+
29
+ **Failure path** (verification failed):
30
+ - Do NOT call `gsd_complete_milestone` — the milestone must not be marked as complete.
31
+ - Do NOT update `.gsd/PROJECT.md` to reflect completion.
32
+ - Do NOT update `.gsd/REQUIREMENTS.md` to mark requirements as validated.
33
+ - Write a clear summary of what failed and why to help the next attempt.
34
+ - Say: "Milestone {{milestoneId}} verification FAILED — not complete." and stop.
35
+
36
+ **Success path** (all verifications passed — continue with steps 7–11):
37
+
38
+ 7. **Persist completion through `gsd_complete_milestone`.** Call it with: `milestoneId`, `title`, `oneLiner`, `narrative`, `successCriteriaResults`, `definitionOfDoneResults`, `requirementOutcomes`, `keyDecisions`, `keyFiles`, `lessonsLearned`, `followUps`, `deviations`, `verificationPassed: true`. The tool updates the milestone status in the DB, renders `{{milestoneSummaryPath}}`, and validates all slices are complete before proceeding.
39
+ 8. For each requirement whose status changed in step 6, call `gsd_requirement_update` with the requirement ID and updated `status` and `validation` fields — the tool regenerates `.gsd/REQUIREMENTS.md` automatically.
26
40
  9. Update `.gsd/PROJECT.md` to reflect milestone completion and current project state.
27
41
  10. Review all slice summaries for cross-cutting lessons, patterns, or gotchas that emerged during this milestone. Append any non-obvious, reusable insights to `.gsd/KNOWLEDGE.md`.
28
42
  11. Do not commit manually — the system auto-commits your changes after this unit completes.
43
+ - Say: "Milestone {{milestoneId}} complete."
29
44
 
30
- **Important:** Do NOT skip the code change verification, success criteria, or definition of done verification (steps 3-5). The milestone summary must reflect actual verified outcomes, not assumed success. If any criterion was not met or no code changes exist, document it clearly in the summary and do not mark the milestone as passing verification.
45
+ **Important:** Do NOT skip the code change verification, success criteria, or definition of done verification (steps 3-5). The milestone summary must reflect actual verified outcomes, not assumed success. Verification failures BLOCK completion there is no override. The milestone stays in its current state until issues are resolved and verification is re-run.
31
46
 
32
47
  **File system safety:** When scanning milestone directories for evidence, use `ls` or `find` to list directory contents first — never pass a directory path (e.g. `tasks/`, `slices/`) directly to the `read` tool. The `read` tool only accepts file paths, not directories.
33
-
34
- **You MUST write `{{milestoneSummaryPath}}` AND update PROJECT.md before finishing.**
35
-
36
- When done, say: "Milestone {{milestoneId}} complete."