gsd-pi 2.29.0-dev.953d788 → 2.29.0-dev.f08b4fe

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 (316) hide show
  1. package/README.md +24 -17
  2. package/dist/extension-registry.d.ts +63 -0
  3. package/dist/extension-registry.js +166 -0
  4. package/dist/headless.js +4 -0
  5. package/dist/loader.js +10 -1
  6. package/dist/resource-loader.js +11 -1
  7. package/dist/resources/extensions/async-jobs/extension-manifest.json +13 -0
  8. package/dist/resources/extensions/bg-shell/extension-manifest.json +14 -0
  9. package/dist/resources/extensions/bg-shell/process-manager.ts +13 -0
  10. package/dist/resources/extensions/browser-tools/extension-manifest.json +37 -0
  11. package/dist/resources/extensions/context7/extension-manifest.json +12 -0
  12. package/dist/resources/extensions/google-search/extension-manifest.json +12 -0
  13. package/dist/resources/extensions/gsd/auto-dashboard.ts +217 -65
  14. package/dist/resources/extensions/gsd/auto-dispatch.ts +32 -3
  15. package/dist/resources/extensions/gsd/auto-post-unit.ts +45 -13
  16. package/dist/resources/extensions/gsd/auto-prompts.ts +40 -17
  17. package/dist/resources/extensions/gsd/auto-recovery.ts +18 -23
  18. package/dist/resources/extensions/gsd/auto-start.ts +18 -32
  19. package/dist/resources/extensions/gsd/auto-worktree.ts +21 -182
  20. package/dist/resources/extensions/gsd/auto.ts +2 -24
  21. package/dist/resources/extensions/gsd/captures.ts +4 -10
  22. package/dist/resources/extensions/gsd/commands-extensions.ts +328 -0
  23. package/dist/resources/extensions/gsd/commands-handlers.ts +22 -2
  24. package/dist/resources/extensions/gsd/commands-logs.ts +13 -14
  25. package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
  26. package/dist/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
  27. package/dist/resources/extensions/gsd/commands.ts +108 -24
  28. package/dist/resources/extensions/gsd/dashboard-overlay.ts +2 -1
  29. package/dist/resources/extensions/gsd/detection.ts +2 -1
  30. package/dist/resources/extensions/gsd/doctor-checks.ts +49 -1
  31. package/dist/resources/extensions/gsd/doctor-types.ts +3 -1
  32. package/dist/resources/extensions/gsd/extension-manifest.json +18 -0
  33. package/dist/resources/extensions/gsd/forensics.ts +2 -2
  34. package/dist/resources/extensions/gsd/git-service.ts +3 -2
  35. package/dist/resources/extensions/gsd/gitignore.ts +9 -63
  36. package/dist/resources/extensions/gsd/gsd-db.ts +1 -165
  37. package/dist/resources/extensions/gsd/guided-flow.ts +8 -5
  38. package/dist/resources/extensions/gsd/index.ts +3 -3
  39. package/dist/resources/extensions/gsd/json-persistence.ts +16 -1
  40. package/dist/resources/extensions/gsd/md-importer.ts +3 -2
  41. package/dist/resources/extensions/gsd/mechanical-completion.ts +430 -0
  42. package/dist/resources/extensions/gsd/migrate/command.ts +3 -2
  43. package/dist/resources/extensions/gsd/migrate/writer.ts +2 -1
  44. package/dist/resources/extensions/gsd/migrate-external.ts +123 -0
  45. package/dist/resources/extensions/gsd/paths.ts +24 -2
  46. package/dist/resources/extensions/gsd/post-unit-hooks.ts +6 -5
  47. package/dist/resources/extensions/gsd/preferences-models.ts +7 -1
  48. package/dist/resources/extensions/gsd/preferences-validation.ts +2 -1
  49. package/dist/resources/extensions/gsd/preferences.ts +10 -5
  50. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +4 -2
  51. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  52. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +26 -2
  53. package/dist/resources/extensions/gsd/prompts/plan-slice.md +15 -1
  54. package/dist/resources/extensions/gsd/prompts/workflow-start.md +28 -0
  55. package/dist/resources/extensions/gsd/queue-order.ts +10 -11
  56. package/dist/resources/extensions/gsd/repo-identity.ts +148 -0
  57. package/dist/resources/extensions/gsd/resource-version.ts +99 -0
  58. package/dist/resources/extensions/gsd/session-forensics.ts +4 -3
  59. package/dist/resources/extensions/gsd/session-status-io.ts +23 -41
  60. package/dist/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
  61. package/dist/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +1 -1
  62. package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
  63. package/dist/resources/extensions/gsd/tests/auto-skip-loop.test.ts +1 -1
  64. package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -58
  65. package/dist/resources/extensions/gsd/tests/doctor-runtime.test.ts +3 -4
  66. package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
  67. package/dist/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +5 -18
  68. package/dist/resources/extensions/gsd/tests/git-service.test.ts +10 -37
  69. package/dist/resources/extensions/gsd/tests/knowledge.test.ts +4 -4
  70. package/dist/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
  71. package/dist/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +1 -1
  72. package/dist/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +1 -0
  73. package/dist/resources/extensions/gsd/tests/token-profile.test.ts +14 -16
  74. package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
  75. package/dist/resources/extensions/gsd/triage-resolution.ts +2 -1
  76. package/dist/resources/extensions/gsd/types.ts +2 -0
  77. package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
  78. package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
  79. package/dist/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
  80. package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
  81. package/dist/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
  82. package/dist/resources/extensions/gsd/workflow-templates/registry.json +85 -0
  83. package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
  84. package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
  85. package/dist/resources/extensions/gsd/workflow-templates/spike.md +69 -0
  86. package/dist/resources/extensions/gsd/workflow-templates.ts +241 -0
  87. package/dist/resources/extensions/gsd/worktree-command.ts +1 -11
  88. package/dist/resources/extensions/gsd/worktree-manager.ts +3 -2
  89. package/dist/resources/extensions/gsd/worktree.ts +42 -5
  90. package/dist/resources/extensions/mac-tools/extension-manifest.json +16 -0
  91. package/dist/resources/extensions/mcp-client/index.ts +459 -0
  92. package/dist/resources/extensions/mcporter/extension-manifest.json +12 -0
  93. package/dist/resources/extensions/remote-questions/discord-adapter.ts +8 -19
  94. package/dist/resources/extensions/remote-questions/extension-manifest.json +11 -0
  95. package/dist/resources/extensions/remote-questions/http-client.ts +76 -0
  96. package/dist/resources/extensions/remote-questions/slack-adapter.ts +11 -17
  97. package/dist/resources/extensions/remote-questions/telegram-adapter.ts +8 -19
  98. package/dist/resources/extensions/search-the-web/extension-manifest.json +13 -0
  99. package/dist/resources/extensions/slash-commands/extension-manifest.json +11 -0
  100. package/dist/resources/extensions/subagent/extension-manifest.json +13 -0
  101. package/dist/resources/extensions/ttsr/extension-manifest.json +11 -0
  102. package/dist/resources/extensions/universal-config/extension-manifest.json +13 -0
  103. package/dist/resources/extensions/voice/extension-manifest.json +12 -0
  104. package/dist/resources/skills/create-gsd-extension/SKILL.md +87 -0
  105. package/dist/resources/skills/create-gsd-extension/references/compaction-session-control.md +77 -0
  106. package/dist/resources/skills/create-gsd-extension/references/custom-commands.md +139 -0
  107. package/dist/resources/skills/create-gsd-extension/references/custom-rendering.md +108 -0
  108. package/dist/resources/skills/create-gsd-extension/references/custom-tools.md +183 -0
  109. package/dist/resources/skills/create-gsd-extension/references/custom-ui.md +490 -0
  110. package/dist/resources/skills/create-gsd-extension/references/events-reference.md +126 -0
  111. package/dist/resources/skills/create-gsd-extension/references/extension-lifecycle.md +64 -0
  112. package/dist/resources/skills/create-gsd-extension/references/extensionapi-reference.md +75 -0
  113. package/dist/resources/skills/create-gsd-extension/references/extensioncontext-reference.md +53 -0
  114. package/dist/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +36 -0
  115. package/dist/resources/skills/create-gsd-extension/references/mode-behavior.md +32 -0
  116. package/dist/resources/skills/create-gsd-extension/references/model-provider-management.md +89 -0
  117. package/dist/resources/skills/create-gsd-extension/references/packaging-distribution.md +55 -0
  118. package/dist/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +90 -0
  119. package/dist/resources/skills/create-gsd-extension/references/state-management.md +70 -0
  120. package/dist/resources/skills/create-gsd-extension/references/system-prompt-modification.md +52 -0
  121. package/dist/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
  122. package/dist/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
  123. package/dist/resources/skills/create-gsd-extension/workflows/add-capability.md +57 -0
  124. package/dist/resources/skills/create-gsd-extension/workflows/create-extension.md +156 -0
  125. package/dist/resources/skills/create-gsd-extension/workflows/debug-extension.md +74 -0
  126. package/dist/resources/skills/create-skill/SKILL.md +184 -0
  127. package/dist/resources/skills/create-skill/references/api-security.md +226 -0
  128. package/dist/resources/skills/create-skill/references/be-clear-and-direct.md +531 -0
  129. package/dist/resources/skills/create-skill/references/common-patterns.md +595 -0
  130. package/dist/resources/skills/create-skill/references/core-principles.md +437 -0
  131. package/dist/resources/skills/create-skill/references/executable-code.md +175 -0
  132. package/dist/resources/skills/create-skill/references/gsd-skill-ecosystem.md +68 -0
  133. package/dist/resources/skills/create-skill/references/iteration-and-testing.md +474 -0
  134. package/dist/resources/skills/create-skill/references/recommended-structure.md +168 -0
  135. package/dist/resources/skills/create-skill/references/skill-structure.md +372 -0
  136. package/dist/resources/skills/create-skill/references/use-xml-tags.md +466 -0
  137. package/dist/resources/skills/create-skill/references/using-scripts.md +113 -0
  138. package/dist/resources/skills/create-skill/references/using-templates.md +112 -0
  139. package/dist/resources/skills/create-skill/references/workflows-and-validation.md +510 -0
  140. package/dist/resources/skills/create-skill/templates/router-skill.md +73 -0
  141. package/dist/resources/skills/create-skill/templates/simple-skill.md +33 -0
  142. package/dist/resources/skills/create-skill/workflows/add-reference.md +96 -0
  143. package/dist/resources/skills/create-skill/workflows/add-script.md +93 -0
  144. package/dist/resources/skills/create-skill/workflows/add-template.md +74 -0
  145. package/dist/resources/skills/create-skill/workflows/add-workflow.md +120 -0
  146. package/dist/resources/skills/create-skill/workflows/audit-skill.md +148 -0
  147. package/dist/resources/skills/create-skill/workflows/create-new-skill.md +196 -0
  148. package/dist/resources/skills/create-skill/workflows/get-guidance.md +121 -0
  149. package/dist/resources/skills/create-skill/workflows/upgrade-to-router.md +161 -0
  150. package/dist/resources/skills/create-skill/workflows/verify-skill.md +204 -0
  151. package/dist/resources/skills/react-best-practices/SKILL.md +1 -1
  152. package/package.json +1 -1
  153. package/packages/native/dist/native.d.ts +2 -0
  154. package/packages/native/dist/native.js +19 -5
  155. package/packages/native/src/native.ts +23 -9
  156. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  157. package/packages/pi-coding-agent/dist/core/extensions/loader.js +13 -0
  158. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  159. package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
  160. package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -0
  161. package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
  162. package/packages/pi-coding-agent/src/core/extensions/loader.ts +13 -0
  163. package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -0
  164. package/src/resources/extensions/async-jobs/extension-manifest.json +13 -0
  165. package/src/resources/extensions/bg-shell/extension-manifest.json +14 -0
  166. package/src/resources/extensions/bg-shell/process-manager.ts +13 -0
  167. package/src/resources/extensions/browser-tools/extension-manifest.json +37 -0
  168. package/src/resources/extensions/context7/extension-manifest.json +12 -0
  169. package/src/resources/extensions/google-search/extension-manifest.json +12 -0
  170. package/src/resources/extensions/gsd/auto-dashboard.ts +217 -65
  171. package/src/resources/extensions/gsd/auto-dispatch.ts +32 -3
  172. package/src/resources/extensions/gsd/auto-post-unit.ts +45 -13
  173. package/src/resources/extensions/gsd/auto-prompts.ts +40 -17
  174. package/src/resources/extensions/gsd/auto-recovery.ts +18 -23
  175. package/src/resources/extensions/gsd/auto-start.ts +18 -32
  176. package/src/resources/extensions/gsd/auto-worktree.ts +21 -182
  177. package/src/resources/extensions/gsd/auto.ts +2 -24
  178. package/src/resources/extensions/gsd/captures.ts +4 -10
  179. package/src/resources/extensions/gsd/commands-extensions.ts +328 -0
  180. package/src/resources/extensions/gsd/commands-handlers.ts +22 -2
  181. package/src/resources/extensions/gsd/commands-logs.ts +13 -14
  182. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
  183. package/src/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
  184. package/src/resources/extensions/gsd/commands.ts +108 -24
  185. package/src/resources/extensions/gsd/dashboard-overlay.ts +2 -1
  186. package/src/resources/extensions/gsd/detection.ts +2 -1
  187. package/src/resources/extensions/gsd/doctor-checks.ts +49 -1
  188. package/src/resources/extensions/gsd/doctor-types.ts +3 -1
  189. package/src/resources/extensions/gsd/extension-manifest.json +18 -0
  190. package/src/resources/extensions/gsd/forensics.ts +2 -2
  191. package/src/resources/extensions/gsd/git-service.ts +3 -2
  192. package/src/resources/extensions/gsd/gitignore.ts +9 -63
  193. package/src/resources/extensions/gsd/gsd-db.ts +1 -165
  194. package/src/resources/extensions/gsd/guided-flow.ts +8 -5
  195. package/src/resources/extensions/gsd/index.ts +3 -3
  196. package/src/resources/extensions/gsd/json-persistence.ts +16 -1
  197. package/src/resources/extensions/gsd/md-importer.ts +3 -2
  198. package/src/resources/extensions/gsd/mechanical-completion.ts +430 -0
  199. package/src/resources/extensions/gsd/migrate/command.ts +3 -2
  200. package/src/resources/extensions/gsd/migrate/writer.ts +2 -1
  201. package/src/resources/extensions/gsd/migrate-external.ts +123 -0
  202. package/src/resources/extensions/gsd/paths.ts +24 -2
  203. package/src/resources/extensions/gsd/post-unit-hooks.ts +6 -5
  204. package/src/resources/extensions/gsd/preferences-models.ts +7 -1
  205. package/src/resources/extensions/gsd/preferences-validation.ts +2 -1
  206. package/src/resources/extensions/gsd/preferences.ts +10 -5
  207. package/src/resources/extensions/gsd/prompts/discuss-headless.md +4 -2
  208. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  209. package/src/resources/extensions/gsd/prompts/plan-milestone.md +26 -2
  210. package/src/resources/extensions/gsd/prompts/plan-slice.md +15 -1
  211. package/src/resources/extensions/gsd/prompts/workflow-start.md +28 -0
  212. package/src/resources/extensions/gsd/queue-order.ts +10 -11
  213. package/src/resources/extensions/gsd/repo-identity.ts +148 -0
  214. package/src/resources/extensions/gsd/resource-version.ts +99 -0
  215. package/src/resources/extensions/gsd/session-forensics.ts +4 -3
  216. package/src/resources/extensions/gsd/session-status-io.ts +23 -41
  217. package/src/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
  218. package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +1 -1
  219. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
  220. package/src/resources/extensions/gsd/tests/auto-skip-loop.test.ts +1 -1
  221. package/src/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -58
  222. package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +3 -4
  223. package/src/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
  224. package/src/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +5 -18
  225. package/src/resources/extensions/gsd/tests/git-service.test.ts +10 -37
  226. package/src/resources/extensions/gsd/tests/knowledge.test.ts +4 -4
  227. package/src/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
  228. package/src/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +1 -1
  229. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +1 -0
  230. package/src/resources/extensions/gsd/tests/token-profile.test.ts +14 -16
  231. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
  232. package/src/resources/extensions/gsd/triage-resolution.ts +2 -1
  233. package/src/resources/extensions/gsd/types.ts +2 -0
  234. package/src/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
  235. package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
  236. package/src/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
  237. package/src/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
  238. package/src/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
  239. package/src/resources/extensions/gsd/workflow-templates/registry.json +85 -0
  240. package/src/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
  241. package/src/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
  242. package/src/resources/extensions/gsd/workflow-templates/spike.md +69 -0
  243. package/src/resources/extensions/gsd/workflow-templates.ts +241 -0
  244. package/src/resources/extensions/gsd/worktree-command.ts +1 -11
  245. package/src/resources/extensions/gsd/worktree-manager.ts +3 -2
  246. package/src/resources/extensions/gsd/worktree.ts +42 -5
  247. package/src/resources/extensions/mac-tools/extension-manifest.json +16 -0
  248. package/src/resources/extensions/mcp-client/index.ts +459 -0
  249. package/src/resources/extensions/mcporter/extension-manifest.json +12 -0
  250. package/src/resources/extensions/remote-questions/discord-adapter.ts +8 -19
  251. package/src/resources/extensions/remote-questions/extension-manifest.json +11 -0
  252. package/src/resources/extensions/remote-questions/http-client.ts +76 -0
  253. package/src/resources/extensions/remote-questions/slack-adapter.ts +11 -17
  254. package/src/resources/extensions/remote-questions/telegram-adapter.ts +8 -19
  255. package/src/resources/extensions/search-the-web/extension-manifest.json +13 -0
  256. package/src/resources/extensions/slash-commands/extension-manifest.json +11 -0
  257. package/src/resources/extensions/subagent/extension-manifest.json +13 -0
  258. package/src/resources/extensions/ttsr/extension-manifest.json +11 -0
  259. package/src/resources/extensions/universal-config/extension-manifest.json +13 -0
  260. package/src/resources/extensions/voice/extension-manifest.json +12 -0
  261. package/src/resources/skills/create-gsd-extension/SKILL.md +87 -0
  262. package/src/resources/skills/create-gsd-extension/references/compaction-session-control.md +77 -0
  263. package/src/resources/skills/create-gsd-extension/references/custom-commands.md +139 -0
  264. package/src/resources/skills/create-gsd-extension/references/custom-rendering.md +108 -0
  265. package/src/resources/skills/create-gsd-extension/references/custom-tools.md +183 -0
  266. package/src/resources/skills/create-gsd-extension/references/custom-ui.md +490 -0
  267. package/src/resources/skills/create-gsd-extension/references/events-reference.md +126 -0
  268. package/src/resources/skills/create-gsd-extension/references/extension-lifecycle.md +64 -0
  269. package/src/resources/skills/create-gsd-extension/references/extensionapi-reference.md +75 -0
  270. package/src/resources/skills/create-gsd-extension/references/extensioncontext-reference.md +53 -0
  271. package/src/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +36 -0
  272. package/src/resources/skills/create-gsd-extension/references/mode-behavior.md +32 -0
  273. package/src/resources/skills/create-gsd-extension/references/model-provider-management.md +89 -0
  274. package/src/resources/skills/create-gsd-extension/references/packaging-distribution.md +55 -0
  275. package/src/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +90 -0
  276. package/src/resources/skills/create-gsd-extension/references/state-management.md +70 -0
  277. package/src/resources/skills/create-gsd-extension/references/system-prompt-modification.md +52 -0
  278. package/src/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
  279. package/src/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
  280. package/src/resources/skills/create-gsd-extension/workflows/add-capability.md +57 -0
  281. package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +156 -0
  282. package/src/resources/skills/create-gsd-extension/workflows/debug-extension.md +74 -0
  283. package/src/resources/skills/create-skill/SKILL.md +184 -0
  284. package/src/resources/skills/create-skill/references/api-security.md +226 -0
  285. package/src/resources/skills/create-skill/references/be-clear-and-direct.md +531 -0
  286. package/src/resources/skills/create-skill/references/common-patterns.md +595 -0
  287. package/src/resources/skills/create-skill/references/core-principles.md +437 -0
  288. package/src/resources/skills/create-skill/references/executable-code.md +175 -0
  289. package/src/resources/skills/create-skill/references/gsd-skill-ecosystem.md +68 -0
  290. package/src/resources/skills/create-skill/references/iteration-and-testing.md +474 -0
  291. package/src/resources/skills/create-skill/references/recommended-structure.md +168 -0
  292. package/src/resources/skills/create-skill/references/skill-structure.md +372 -0
  293. package/src/resources/skills/create-skill/references/use-xml-tags.md +466 -0
  294. package/src/resources/skills/create-skill/references/using-scripts.md +113 -0
  295. package/src/resources/skills/create-skill/references/using-templates.md +112 -0
  296. package/src/resources/skills/create-skill/references/workflows-and-validation.md +510 -0
  297. package/src/resources/skills/create-skill/templates/router-skill.md +73 -0
  298. package/src/resources/skills/create-skill/templates/simple-skill.md +33 -0
  299. package/src/resources/skills/create-skill/workflows/add-reference.md +96 -0
  300. package/src/resources/skills/create-skill/workflows/add-script.md +93 -0
  301. package/src/resources/skills/create-skill/workflows/add-template.md +74 -0
  302. package/src/resources/skills/create-skill/workflows/add-workflow.md +120 -0
  303. package/src/resources/skills/create-skill/workflows/audit-skill.md +148 -0
  304. package/src/resources/skills/create-skill/workflows/create-new-skill.md +196 -0
  305. package/src/resources/skills/create-skill/workflows/get-guidance.md +121 -0
  306. package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +161 -0
  307. package/src/resources/skills/create-skill/workflows/verify-skill.md +204 -0
  308. package/src/resources/skills/react-best-practices/SKILL.md +1 -1
  309. package/dist/resources/extensions/gsd/auto-worktree-sync.ts +0 -198
  310. package/dist/resources/extensions/gsd/tests/worktree-db-integration.test.ts +0 -205
  311. package/dist/resources/extensions/gsd/tests/worktree-db.test.ts +0 -442
  312. package/dist/resources/extensions/mcporter/index.ts +0 -525
  313. package/src/resources/extensions/gsd/auto-worktree-sync.ts +0 -198
  314. package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +0 -205
  315. package/src/resources/extensions/gsd/tests/worktree-db.test.ts +0 -442
  316. package/src/resources/extensions/mcporter/index.ts +0 -525
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "google-search",
3
+ "name": "Google Search",
4
+ "version": "1.0.0",
5
+ "description": "Web search via Google with AI-synthesized answers and source citations",
6
+ "tier": "bundled",
7
+ "requires": { "platform": ">=2.29.0" },
8
+ "provides": {
9
+ "tools": ["google_search"],
10
+ "hooks": ["session_start"]
11
+ }
12
+ }
@@ -11,6 +11,7 @@ import type { GSDState } from "./types.js";
11
11
  import { getCurrentBranch } from "./worktree.js";
12
12
  import { getActiveHook } from "./post-unit-hooks.js";
13
13
  import { getLedger, getProjectTotals, formatCost, formatTokenCount, formatTierSavings } from "./metrics.js";
14
+ import { getHealthTrend, getConsecutiveErrorUnits } from "./doctor-proactive.js";
14
15
  import {
15
16
  resolveMilestoneFile,
16
17
  resolveSliceFile,
@@ -204,6 +205,13 @@ export function estimateTimeRemaining(): string | null {
204
205
 
205
206
  // ─── Slice Progress Cache ─────────────────────────────────────────────────────
206
207
 
208
+ /** Cached task detail for the widget task checklist */
209
+ interface CachedTaskDetail {
210
+ id: string;
211
+ title: string;
212
+ done: boolean;
213
+ }
214
+
207
215
  /** Cached slice progress for the widget — avoid async in render */
208
216
  let cachedSliceProgress: {
209
217
  done: number;
@@ -211,6 +219,8 @@ let cachedSliceProgress: {
211
219
  milestoneId: string;
212
220
  /** Real task progress for the active slice, if its plan file exists */
213
221
  activeSliceTasks: { done: number; total: number } | null;
222
+ /** Full task list for the active slice checklist */
223
+ taskDetails: CachedTaskDetail[] | null;
214
224
  } | null = null;
215
225
 
216
226
  export function updateSliceProgressCache(base: string, mid: string, activeSid?: string): void {
@@ -221,6 +231,7 @@ export function updateSliceProgressCache(base: string, mid: string, activeSid?:
221
231
  const roadmap = parseRoadmap(content);
222
232
 
223
233
  let activeSliceTasks: { done: number; total: number } | null = null;
234
+ let taskDetails: CachedTaskDetail[] | null = null;
224
235
  if (activeSid) {
225
236
  try {
226
237
  const planFile = resolveSliceFile(base, mid, activeSid, "PLAN");
@@ -231,6 +242,7 @@ export function updateSliceProgressCache(base: string, mid: string, activeSid?:
231
242
  done: plan.tasks.filter(t => t.done).length,
232
243
  total: plan.tasks.length,
233
244
  };
245
+ taskDetails = plan.tasks.map(t => ({ id: t.id, title: t.title, done: t.done }));
234
246
  }
235
247
  } catch {
236
248
  // Non-fatal — just omit task count
@@ -242,13 +254,19 @@ export function updateSliceProgressCache(base: string, mid: string, activeSid?:
242
254
  total: roadmap.slices.length,
243
255
  milestoneId: mid,
244
256
  activeSliceTasks,
257
+ taskDetails,
245
258
  };
246
259
  } catch {
247
260
  // Non-fatal — widget just won't show progress bar
248
261
  }
249
262
  }
250
263
 
251
- export function getRoadmapSlicesSync(): { done: number; total: number; activeSliceTasks: { done: number; total: number } | null } | null {
264
+ export function getRoadmapSlicesSync(): {
265
+ done: number;
266
+ total: number;
267
+ activeSliceTasks: { done: number; total: number } | null;
268
+ taskDetails: CachedTaskDetail[] | null;
269
+ } | null {
252
270
  return cachedSliceProgress;
253
271
  }
254
272
 
@@ -349,87 +367,84 @@ export function updateProgressWidget(
349
367
  const lines: string[] = [];
350
368
  const pad = INDENT.base;
351
369
 
352
- // ── Line 1: Top bar ───────────────────────────────────────────────
370
+ // ── Top bar ─────────────────────────────────────────────────────
353
371
  lines.push(...ui.bar());
354
372
 
373
+ // ── Header: GSD AUTO ... elapsed ────────────────────────────────
355
374
  const dot = pulseBright
356
375
  ? theme.fg("accent", GLYPH.statusActive)
357
376
  : theme.fg("dim", GLYPH.statusPending);
358
377
  const elapsed = formatAutoElapsed(accessors.getAutoStartTime());
359
378
  const modeTag = accessors.isStepMode() ? "NEXT" : "AUTO";
360
- const headerLeft = `${pad}${dot} ${theme.fg("accent", theme.bold("GSD"))} ${theme.fg("success", modeTag)}`;
379
+ const headerLeft = `${pad}${dot} ${theme.fg("accent", theme.bold("GSD"))} ${theme.fg("success", modeTag)}`;
361
380
  const headerRight = elapsed ? theme.fg("dim", elapsed) : "";
362
381
  lines.push(rightAlign(headerLeft, headerRight, width));
363
382
 
364
- lines.push("");
365
-
366
- if (mid) {
367
- lines.push(truncateToWidth(`${pad}${theme.fg("dim", mid.title)}`, width));
368
- }
369
-
383
+ // ── Context: project · slice · action (merged into one line) ────
384
+ const contextParts: string[] = [];
385
+ if (mid) contextParts.push(theme.fg("dim", mid.title));
370
386
  if (slice && unitType !== "research-milestone" && unitType !== "plan-milestone") {
371
- lines.push(truncateToWidth(
372
- `${pad}${theme.fg("text", theme.bold(`${slice.id}: ${slice.title}`))}`,
373
- width,
374
- ));
387
+ contextParts.push(theme.fg("text", theme.bold(`${slice.id}: ${slice.title}`)));
375
388
  }
376
-
377
- lines.push("");
378
-
379
389
  const isHook = unitType.startsWith("hook/");
380
390
  const target = isHook
381
391
  ? (unitId.split("/").pop() ?? unitId)
382
392
  : (task ? `${task.id}: ${task.title}` : unitId);
383
- const actionLeft = `${pad}${theme.fg("accent", "▸")} ${theme.fg("accent", verb)} ${theme.fg("text", target)}`;
393
+ contextParts.push(`${theme.fg("accent", "▸")} ${theme.fg("accent", verb)} ${theme.fg("text", target)}`);
394
+
384
395
  const tierTag = tierBadge ? theme.fg("dim", `[${tierBadge}] `) : "";
385
396
  const phaseBadge = `${tierTag}${theme.fg("dim", phaseLabel)}`;
386
- lines.push(rightAlign(actionLeft, phaseBadge, width));
387
- lines.push("");
388
-
389
- if (mid) {
390
- const roadmapSlices = getRoadmapSlicesSync();
391
- if (roadmapSlices) {
392
- const { done, total, activeSliceTasks } = roadmapSlices;
393
- const barWidth = Math.max(8, Math.min(24, Math.floor(width * 0.3)));
394
- const pct = total > 0 ? done / total : 0;
395
- const filled = Math.round(pct * barWidth);
396
- const bar = theme.fg("success", "█".repeat(filled))
397
- + theme.fg("dim", "░".repeat(barWidth - filled));
398
-
399
- let meta = theme.fg("dim", `${done}/${total} slices`);
400
-
401
- if (activeSliceTasks && activeSliceTasks.total > 0) {
402
- // For hooks, show the trigger task number (done), not the next task (done + 1)
403
- const taskNum = isHook
404
- ? Math.max(activeSliceTasks.done, 1)
405
- : Math.min(activeSliceTasks.done + 1, activeSliceTasks.total);
406
- meta += theme.fg("dim", ` · task ${taskNum}/${activeSliceTasks.total}`);
407
- }
408
-
409
- // ETA estimate
410
- const eta = estimateTimeRemaining();
411
- if (eta) {
412
- meta += theme.fg("dim", ` · ${eta}`);
413
- }
397
+ const contextLine = contextParts.join(theme.fg("dim", " · "));
398
+ lines.push(rightAlign(`${pad}${contextLine}`, phaseBadge, width));
399
+
400
+ // ── Two-column body ─────────────────────────────────────────────
401
+ // Left: progress, ETA, next, stats (fixed) | Right: task checklist (fixed, adjacent)
402
+ // Both columns sit left-to-center; empty space is on the right.
403
+ const divider = theme.fg("dim", "│");
404
+ const minTwoColWidth = 100;
405
+ const rightColFixed = 44;
406
+ const colGap = 5; // breathing room between columns
407
+ // Left column takes remaining space — no truncation on wide terminals
408
+ const useTwoCol = width >= minTwoColWidth;
409
+ const rightColWidth = useTwoCol ? rightColFixed : 0;
410
+ const leftColWidth = useTwoCol ? width - rightColWidth - colGap : width;
411
+
412
+ const roadmapSlices = mid ? getRoadmapSlicesSync() : null;
413
+
414
+ // Build left column: progress bar, ETA, next step, token stats
415
+ const leftLines: string[] = [];
416
+
417
+ if (roadmapSlices) {
418
+ const { done, total, activeSliceTasks } = roadmapSlices;
419
+ const barWidth = Math.max(6, Math.min(18, Math.floor(leftColWidth * 0.4)));
420
+ const pct = total > 0 ? done / total : 0;
421
+ const filled = Math.round(pct * barWidth);
422
+ const bar = theme.fg("success", "█".repeat(filled))
423
+ + theme.fg("dim", "░".repeat(barWidth - filled));
424
+
425
+ let meta = theme.fg("dim", `${done}/${total} slices`);
426
+ if (activeSliceTasks && activeSliceTasks.total > 0) {
427
+ const taskNum = isHook
428
+ ? Math.max(activeSliceTasks.done, 1)
429
+ : Math.min(activeSliceTasks.done + 1, activeSliceTasks.total);
430
+ meta += theme.fg("dim", ` · task ${taskNum}/${activeSliceTasks.total}`);
431
+ }
432
+ leftLines.push(truncateToWidth(`${pad}${bar} ${meta}`, leftColWidth));
414
433
 
415
- lines.push(truncateToWidth(`${pad}${bar} ${meta}`, width));
434
+ const eta = estimateTimeRemaining();
435
+ if (eta) {
436
+ leftLines.push(truncateToWidth(`${pad}${theme.fg("dim", eta)}`, leftColWidth));
416
437
  }
417
438
  }
418
439
 
419
- lines.push("");
420
-
421
440
  if (next) {
422
- lines.push(truncateToWidth(
441
+ leftLines.push(truncateToWidth(
423
442
  `${pad}${theme.fg("dim", "→")} ${theme.fg("dim", `then ${next}`)}`,
424
- width,
443
+ leftColWidth,
425
444
  ));
426
445
  }
427
446
 
428
- // ── Footer info (pwd, tokens, cost, context, model) ──────────────
429
- lines.push("");
430
- lines.push(truncateToWidth(theme.fg("dim", `${pad}${widgetPwd}`), width, theme.fg("dim", "…")));
431
-
432
- // Token stats from current unit session + cumulative cost from metrics
447
+ // Token stats
433
448
  {
434
449
  const cmdCtx = accessors.getCmdCtx();
435
450
  let totalInput = 0, totalOutput = 0;
@@ -464,7 +479,6 @@ export function updateProgressWidget(
464
479
  if (totalOutput) sp.push(`↓${formatWidgetTokens(totalOutput)}`);
465
480
  if (totalCacheRead) sp.push(`R${formatWidgetTokens(totalCacheRead)}`);
466
481
  if (totalCacheWrite) sp.push(`W${formatWidgetTokens(totalCacheWrite)}`);
467
- // Cache hit rate for current unit
468
482
  if (totalCacheRead + totalInput > 0) {
469
483
  const hitRate = Math.round((totalCacheRead / (totalCacheRead + totalInput)) * 100);
470
484
  sp.push(`\u26A1${hitRate}%`);
@@ -483,33 +497,134 @@ export function updateProgressWidget(
483
497
  sp.push(cxDisplay);
484
498
  }
485
499
 
486
- const sLeft = sp.map(p => p.includes("\x1b[") ? p : theme.fg("dim", p))
500
+ const tokenLine = sp.map(p => p.includes("\x1b[") ? p : theme.fg("dim", p))
487
501
  .join(theme.fg("dim", " "));
502
+ leftLines.push(truncateToWidth(`${pad}${tokenLine}`, leftColWidth));
488
503
 
489
504
  const modelId = cmdCtx?.model?.id ?? "";
490
505
  const modelProvider = cmdCtx?.model?.provider ?? "";
491
- const modelPhase = phaseLabel ? theme.fg("dim", `[${phaseLabel}] `) : "";
492
506
  const modelDisplay = modelProvider && modelId
493
507
  ? `${modelProvider}/${modelId}`
494
508
  : modelId;
495
- const sRight = modelDisplay
496
- ? `${modelPhase}${theme.fg("dim", modelDisplay)}`
497
- : "";
498
- lines.push(rightAlign(`${pad}${sLeft}`, sRight, width));
509
+ if (modelDisplay) {
510
+ leftLines.push(truncateToWidth(`${pad}${theme.fg("dim", modelDisplay)}`, leftColWidth));
511
+ }
499
512
 
500
- // Dynamic routing savings summary
513
+ // Dynamic routing savings
501
514
  if (mLedger && mLedger.units.some(u => u.tier)) {
502
515
  const savings = formatTierSavings(mLedger.units);
503
516
  if (savings) {
504
- lines.push(truncateToWidth(theme.fg("dim", `${pad}${savings}`), width));
517
+ leftLines.push(truncateToWidth(`${pad}${theme.fg("dim", savings)}`, leftColWidth));
518
+ }
519
+ }
520
+ }
521
+
522
+ // Build right column: task checklist (pegged to right edge)
523
+ const rightLines: string[] = [];
524
+ const taskDetails = roadmapSlices?.taskDetails ?? null;
525
+ const maxVisibleTasks = 8;
526
+ const rpad = " ";
527
+
528
+ if (useTwoCol) {
529
+ if (taskDetails && taskDetails.length > 0) {
530
+ const visibleTasks = taskDetails.slice(0, maxVisibleTasks);
531
+ for (const t of visibleTasks) {
532
+ const isCurrent = task && t.id === task.id;
533
+ const glyph = t.done
534
+ ? theme.fg("success", GLYPH.statusDone)
535
+ : isCurrent
536
+ ? theme.fg("accent", "▸")
537
+ : theme.fg("dim", " ");
538
+ const label = isCurrent
539
+ ? theme.fg("text", `${t.id}: ${t.title}`)
540
+ : t.done
541
+ ? theme.fg("dim", `${t.id}: ${t.title}`)
542
+ : theme.fg("text", `${t.id}: ${t.title}`);
543
+ rightLines.push(truncateToWidth(`${rpad}${glyph} ${label}`, rightColWidth));
544
+ }
545
+ if (taskDetails.length > maxVisibleTasks) {
546
+ rightLines.push(truncateToWidth(
547
+ `${rpad}${theme.fg("dim", ` …+${taskDetails.length - maxVisibleTasks} more`)}`,
548
+ rightColWidth,
549
+ ));
550
+ }
551
+ } else if (roadmapSlices?.activeSliceTasks) {
552
+ const { done: tDone, total: tTotal } = roadmapSlices.activeSliceTasks;
553
+ rightLines.push(`${rpad}${theme.fg("dim", `${tDone}/${tTotal} tasks`)}`);
554
+ }
555
+ } else {
556
+ // Narrow single-column: task list goes into left column
557
+ if (taskDetails && taskDetails.length > 0) {
558
+ for (const t of taskDetails.slice(0, maxVisibleTasks)) {
559
+ const isCurrent = task && t.id === task.id;
560
+ const glyph = t.done
561
+ ? theme.fg("success", GLYPH.statusDone)
562
+ : isCurrent
563
+ ? theme.fg("accent", "▸")
564
+ : theme.fg("dim", " ");
565
+ const label = isCurrent
566
+ ? theme.fg("text", `${t.id}: ${t.title}`)
567
+ : t.done
568
+ ? theme.fg("dim", `${t.id}: ${t.title}`)
569
+ : theme.fg("text", `${t.id}: ${t.title}`);
570
+ leftLines.push(truncateToWidth(`${pad}${glyph} ${label}`, leftColWidth));
571
+ }
572
+ }
573
+ // Add progress bar inline
574
+ if (roadmapSlices) {
575
+ const { done, total, activeSliceTasks } = roadmapSlices;
576
+ const barWidth = Math.max(6, Math.min(18, Math.floor(leftColWidth * 0.4)));
577
+ const pct = total > 0 ? done / total : 0;
578
+ const filled = Math.round(pct * barWidth);
579
+ const bar = theme.fg("success", "█".repeat(filled))
580
+ + theme.fg("dim", "░".repeat(barWidth - filled));
581
+ let meta = theme.fg("dim", `${done}/${total} slices`);
582
+ if (activeSliceTasks && activeSliceTasks.total > 0) {
583
+ const taskNum = isHook
584
+ ? Math.max(activeSliceTasks.done, 1)
585
+ : Math.min(activeSliceTasks.done + 1, activeSliceTasks.total);
586
+ meta += theme.fg("dim", ` · task ${taskNum}/${activeSliceTasks.total}`);
587
+ }
588
+ const eta = estimateTimeRemaining();
589
+ if (eta) meta += theme.fg("dim", ` · ${eta}`);
590
+ leftLines.push(truncateToWidth(`${pad}${bar} ${meta}`, leftColWidth));
591
+ }
592
+ if (next) {
593
+ leftLines.push(truncateToWidth(
594
+ `${pad}${theme.fg("dim", "→")} ${theme.fg("dim", `then ${next}`)}`,
595
+ leftColWidth,
596
+ ));
597
+ }
598
+ }
599
+
600
+ // Compose columns
601
+ if (useTwoCol) {
602
+ const maxRows = Math.max(leftLines.length, rightLines.length);
603
+ if (maxRows > 0) {
604
+ lines.push(""); // spacer before columns
605
+ for (let i = 0; i < maxRows; i++) {
606
+ const left = padToWidth(leftLines[i] ?? "", leftColWidth);
607
+ const gap = " ".repeat(colGap - 2); // colGap minus divider and its trailing space
608
+ const right = rightLines[i] ?? "";
609
+ lines.push(truncateToWidth(`${left}${gap}${divider} ${right}`, width));
505
610
  }
506
611
  }
612
+ } else {
613
+ // Narrow single-column: just stack
614
+ if (leftLines.length > 0) {
615
+ lines.push("");
616
+ for (const l of leftLines) lines.push(l);
617
+ }
507
618
  }
508
619
 
620
+ // ── Footer: pwd + hints ─────────────────────────────────────────
621
+ lines.push("");
509
622
  const hintParts: string[] = [];
510
623
  hintParts.push("esc pause");
511
624
  hintParts.push(process.platform === "darwin" ? "⌃⌥G dashboard" : "Ctrl+Alt+G dashboard");
512
- lines.push(...ui.hints(hintParts));
625
+ const hintStr = theme.fg("dim", hintParts.join(" | "));
626
+ const pwdStr = theme.fg("dim", widgetPwd);
627
+ lines.push(rightAlign(`${pad}${pwdStr}`, hintStr, width));
513
628
 
514
629
  lines.push(...ui.bar());
515
630
 
@@ -535,6 +650,31 @@ export function updateProgressWidget(
535
650
  * Build a compact string-array representation of the progress widget.
536
651
  * Used as a fallback when the factory-based widget cannot render (RPC mode).
537
652
  */
653
+ // ─── Model Health Indicator ───────────────────────────────────────────────────
654
+
655
+ /**
656
+ * Compute a traffic-light health indicator from observable signals.
657
+ * 🟢 progressing well — no errors, trend stable/improving
658
+ * 🟡 struggling — some errors or degrading trend
659
+ * 🔴 stuck — consecutive errors, likely needs attention
660
+ */
661
+ export function getModelHealthIndicator(): { emoji: string; label: string } {
662
+ const trend = getHealthTrend();
663
+ const consecutiveErrors = getConsecutiveErrorUnits();
664
+
665
+ if (consecutiveErrors >= 3) {
666
+ return { emoji: "🔴", label: "stuck" };
667
+ }
668
+ if (consecutiveErrors >= 1 || trend === "degrading") {
669
+ return { emoji: "🟡", label: "struggling" };
670
+ }
671
+ if (trend === "improving") {
672
+ return { emoji: "🟢", label: "progressing well" };
673
+ }
674
+ // stable or unknown
675
+ return { emoji: "🟢", label: "progressing" };
676
+ }
677
+
538
678
  function buildProgressTextLines(
539
679
  verb: string,
540
680
  phaseLabel: string,
@@ -583,6 +723,11 @@ function buildProgressTextLines(
583
723
  }
584
724
 
585
725
  if (next) lines.push(` Next: ${next}`);
726
+
727
+ // Model health indicator
728
+ const health = getModelHealthIndicator();
729
+ lines.push(` Health: ${health.emoji} ${health.label}`);
730
+
586
731
  lines.push(` ${widgetPwd}`);
587
732
 
588
733
  return lines;
@@ -597,3 +742,10 @@ function rightAlign(left: string, right: string, width: number): string {
597
742
  const gap = Math.max(1, width - leftVis - rightVis);
598
743
  return truncateToWidth(left + " ".repeat(gap) + right, width);
599
744
  }
745
+
746
+ /** Pad a string with trailing spaces to fill exactly `colWidth` (ANSI-aware). */
747
+ function padToWidth(s: string, colWidth: number): string {
748
+ const vis = visibleWidth(s);
749
+ if (vis >= colWidth) return truncateToWidth(s, colWidth);
750
+ return s + " ".repeat(colWidth - vis);
751
+ }
@@ -12,7 +12,7 @@
12
12
  import type { GSDState } from "./types.js";
13
13
  import type { GSDPreferences } from "./preferences.js";
14
14
  import type { UatType } from "./files.js";
15
- import { loadFile, extractUatType, loadActiveOverrides } from "./files.js";
15
+ import { loadFile, extractUatType, loadActiveOverrides, parseRoadmap } from "./files.js";
16
16
  import {
17
17
  resolveMilestoneFile, resolveMilestonePath, resolveSliceFile, resolveTaskFile,
18
18
  relSliceFile, buildMilestoneFileName,
@@ -123,11 +123,40 @@ const DISPATCH_RULES: DispatchRule[] = [
123
123
  };
124
124
  },
125
125
  },
126
+ {
127
+ name: "uat-verdict-gate (non-PASS blocks progression)",
128
+ match: async ({ mid, basePath, prefs }) => {
129
+ // Only applies when UAT dispatch is enabled
130
+ if (!prefs?.uat_dispatch) return null;
131
+
132
+ const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
133
+ const roadmapContent = roadmapFile ? await loadFile(roadmapFile) : null;
134
+ if (!roadmapContent) return null;
135
+
136
+ const roadmap = parseRoadmap(roadmapContent);
137
+ for (const slice of roadmap.slices.filter(s => s.done)) {
138
+ const resultFile = resolveSliceFile(basePath, mid, slice.id, "UAT-RESULT");
139
+ if (!resultFile) continue;
140
+ const content = await loadFile(resultFile);
141
+ if (!content) continue;
142
+ const verdictMatch = content.match(/verdict:\s*([\w-]+)/i);
143
+ const verdict = verdictMatch?.[1]?.toLowerCase();
144
+ if (verdict && verdict !== "pass" && verdict !== "passed") {
145
+ return {
146
+ action: "stop" as const,
147
+ reason: `UAT verdict for ${slice.id} is "${verdict}" — blocking progression until resolved.\nReview the UAT result and update the verdict to PASS, or re-run /gsd auto after fixing.`,
148
+ level: "warning" as const,
149
+ };
150
+ }
151
+ }
152
+ return null;
153
+ },
154
+ },
126
155
  {
127
156
  name: "reassess-roadmap (post-completion)",
128
157
  match: async ({ state, mid, midTitle, basePath, prefs }) => {
129
- // Phase skip: skip reassess when preference or profile says so
130
- if (prefs?.phases?.skip_reassess) return null;
158
+ // Reassess is opt-in: only fire when explicitly enabled
159
+ if (!prefs?.phases?.reassess_after_slice) return null;
131
160
  const needsReassess = await checkNeedsReassessment(basePath, mid, state);
132
161
  if (!needsReassess) return null;
133
162
  return {
@@ -37,7 +37,6 @@ import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences } from "./pref
37
37
  import { runGSDDoctor, rebuildState, summarizeDoctorIssues } from "./doctor.js";
38
38
  import { COMPLETION_TRANSITION_CODES } from "./doctor-types.js";
39
39
  import { recordHealthSnapshot, checkHealEscalation } from "./doctor-proactive.js";
40
- import { syncStateToProjectRoot } from "./auto-worktree-sync.js";
41
40
  import { resetRewriteCircuitBreaker } from "./auto-dispatch.js";
42
41
  import { isDbAvailable } from "./gsd-db.js";
43
42
  import { consumeSignal } from "./session-status-io.js";
@@ -176,7 +175,7 @@ export async function postUnitPreVerification(pctx: PostUnitContext): Promise<"d
176
175
  );
177
176
  try {
178
177
  const { formatDoctorIssuesForPrompt, formatDoctorReport } = await import("./doctor.js");
179
- const { dispatchDoctorHeal } = await import("./commands.js");
178
+ const { dispatchDoctorHeal } = await import("./commands-handlers.js");
180
179
  const actionable = report.issues.filter(i => i.severity === "error");
181
180
  const reportText = formatDoctorReport(report, { scope: doctorScope, includeWarnings: true });
182
181
  const structuredIssues = formatDoctorIssuesForPrompt(actionable);
@@ -202,23 +201,17 @@ export async function postUnitPreVerification(pctx: PostUnitContext): Promise<"d
202
201
  }
203
202
  }
204
203
 
205
- // Prune dead bg-shell processes
204
+ // Prune dead bg-shell processes and kill non-persistent live ones.
205
+ // Without killing live processes between units, dev servers spawned during
206
+ // one task keep ports bound, causing conflicts in subsequent tasks (#1209).
206
207
  try {
207
- const { pruneDeadProcesses } = await import("../bg-shell/process-manager.js");
208
+ const { pruneDeadProcesses, killSessionProcesses } = await import("../bg-shell/process-manager.js");
208
209
  pruneDeadProcesses();
210
+ killSessionProcesses();
209
211
  } catch {
210
212
  // Non-fatal
211
213
  }
212
214
 
213
- // Sync worktree state back to project root
214
- if (s.originalBasePath && s.originalBasePath !== s.basePath) {
215
- try {
216
- syncStateToProjectRoot(s.basePath, s.originalBasePath, s.currentMilestoneId);
217
- } catch {
218
- // Non-fatal
219
- }
220
- }
221
-
222
215
  // Rewrite-docs completion
223
216
  if (s.currentUnit.type === "rewrite-docs") {
224
217
  try {
@@ -328,6 +321,45 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
328
321
  }
329
322
  }
330
323
 
324
+ // ── Mechanical completion (ADR-003) ──
325
+ // After task execution, attempt mechanical slice and milestone completion
326
+ // instead of dispatching LLM sessions for complete-slice / validate-milestone.
327
+ if (s.currentUnit?.type === "execute-task" && !s.stepMode) {
328
+ try {
329
+ const [mid, sid] = s.currentUnit.id.split("/");
330
+ if (mid && sid) {
331
+ const state = await deriveState(s.basePath);
332
+ if (state.phase === "summarizing" && state.activeSlice?.id === sid) {
333
+ const { mechanicalSliceCompletion } = await import("./mechanical-completion.js");
334
+ const ok = await mechanicalSliceCompletion(s.basePath, mid, sid);
335
+ if (ok) {
336
+ invalidateAllCaches();
337
+ autoCommitCurrentBranch(s.basePath, "mechanical-completion", `${mid}/${sid}`);
338
+ ctx.ui.notify(`Mechanical completion: ${sid} summary + roadmap updated.`, "info");
339
+
340
+ // Re-derive state — check if milestone is now ready for validation
341
+ invalidateAllCaches();
342
+ const postSliceState = await deriveState(s.basePath);
343
+ if (postSliceState.phase === "validating-milestone" || postSliceState.phase === "completing-milestone") {
344
+ const { aggregateMilestoneVerification, generateMilestoneSummary } = await import("./mechanical-completion.js");
345
+ const validation = await aggregateMilestoneVerification(s.basePath, mid);
346
+ if (validation.verdict !== "failed") {
347
+ await generateMilestoneSummary(s.basePath, mid);
348
+ invalidateAllCaches();
349
+ autoCommitCurrentBranch(s.basePath, "mechanical-milestone-completion", mid);
350
+ ctx.ui.notify(`Mechanical completion: ${mid} validation + summary written.`, "info");
351
+ }
352
+ }
353
+ }
354
+ // If !ok, summarizing phase persists → dispatch rule fires as LLM fallback
355
+ }
356
+ }
357
+ } catch (err) {
358
+ process.stderr.write(`gsd-mechanical: completion failed: ${(err as Error).message}\n`);
359
+ // Non-fatal — fall through to normal dispatch
360
+ }
361
+ }
362
+
331
363
  // ── Post-unit hooks ──
332
364
  if (s.currentUnit && !s.stepMode) {
333
365
  const hookUnit = checkPostUnitHooks(s.currentUnit.type, s.currentUnit.id, s.basePath);