gsd-pi 2.29.0-dev.49d972f → 2.29.0-dev.4c155ee

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 (256) hide show
  1. package/README.md +24 -17
  2. package/dist/headless.js +4 -0
  3. package/dist/resources/extensions/bg-shell/process-manager.ts +13 -0
  4. package/dist/resources/extensions/gsd/auto-dashboard.ts +217 -65
  5. package/dist/resources/extensions/gsd/auto-dispatch.ts +32 -3
  6. package/dist/resources/extensions/gsd/auto-post-unit.ts +44 -12
  7. package/dist/resources/extensions/gsd/auto-prompts.ts +40 -17
  8. package/dist/resources/extensions/gsd/auto-recovery.ts +2 -1
  9. package/dist/resources/extensions/gsd/auto-start.ts +18 -32
  10. package/dist/resources/extensions/gsd/auto-worktree.ts +21 -182
  11. package/dist/resources/extensions/gsd/auto.ts +2 -9
  12. package/dist/resources/extensions/gsd/captures.ts +4 -10
  13. package/dist/resources/extensions/gsd/commands-handlers.ts +2 -1
  14. package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
  15. package/dist/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
  16. package/dist/resources/extensions/gsd/commands.ts +55 -2
  17. package/dist/resources/extensions/gsd/detection.ts +2 -1
  18. package/dist/resources/extensions/gsd/doctor-checks.ts +49 -1
  19. package/dist/resources/extensions/gsd/doctor-types.ts +3 -1
  20. package/dist/resources/extensions/gsd/forensics.ts +2 -2
  21. package/dist/resources/extensions/gsd/git-service.ts +3 -2
  22. package/dist/resources/extensions/gsd/gitignore.ts +9 -63
  23. package/dist/resources/extensions/gsd/gsd-db.ts +1 -165
  24. package/dist/resources/extensions/gsd/guided-flow.ts +8 -5
  25. package/dist/resources/extensions/gsd/index.ts +3 -3
  26. package/dist/resources/extensions/gsd/md-importer.ts +3 -2
  27. package/dist/resources/extensions/gsd/mechanical-completion.ts +430 -0
  28. package/dist/resources/extensions/gsd/migrate/command.ts +3 -2
  29. package/dist/resources/extensions/gsd/migrate/writer.ts +2 -1
  30. package/dist/resources/extensions/gsd/migrate-external.ts +123 -0
  31. package/dist/resources/extensions/gsd/paths.ts +24 -2
  32. package/dist/resources/extensions/gsd/post-unit-hooks.ts +6 -5
  33. package/dist/resources/extensions/gsd/preferences-models.ts +7 -1
  34. package/dist/resources/extensions/gsd/preferences-validation.ts +2 -1
  35. package/dist/resources/extensions/gsd/preferences.ts +10 -5
  36. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +4 -2
  37. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  38. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +26 -2
  39. package/dist/resources/extensions/gsd/prompts/plan-slice.md +15 -1
  40. package/dist/resources/extensions/gsd/prompts/workflow-start.md +28 -0
  41. package/dist/resources/extensions/gsd/repo-identity.ts +148 -0
  42. package/dist/resources/extensions/gsd/resource-version.ts +99 -0
  43. package/dist/resources/extensions/gsd/session-forensics.ts +4 -3
  44. package/dist/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
  45. package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
  46. package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -58
  47. package/dist/resources/extensions/gsd/tests/doctor-runtime.test.ts +3 -4
  48. package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
  49. package/dist/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +5 -18
  50. package/dist/resources/extensions/gsd/tests/git-service.test.ts +10 -37
  51. package/dist/resources/extensions/gsd/tests/knowledge.test.ts +4 -4
  52. package/dist/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
  53. package/dist/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +1 -0
  54. package/dist/resources/extensions/gsd/tests/token-profile.test.ts +14 -16
  55. package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
  56. package/dist/resources/extensions/gsd/triage-resolution.ts +2 -1
  57. package/dist/resources/extensions/gsd/types.ts +2 -0
  58. package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
  59. package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
  60. package/dist/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
  61. package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
  62. package/dist/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
  63. package/dist/resources/extensions/gsd/workflow-templates/registry.json +85 -0
  64. package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
  65. package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
  66. package/dist/resources/extensions/gsd/workflow-templates/spike.md +69 -0
  67. package/dist/resources/extensions/gsd/workflow-templates.ts +241 -0
  68. package/dist/resources/extensions/gsd/worktree-command.ts +1 -11
  69. package/dist/resources/extensions/gsd/worktree-manager.ts +3 -2
  70. package/dist/resources/extensions/gsd/worktree.ts +42 -5
  71. package/dist/resources/extensions/mcp-client/index.ts +459 -0
  72. package/dist/resources/skills/create-gsd-extension/SKILL.md +87 -0
  73. package/dist/resources/skills/create-gsd-extension/references/compaction-session-control.md +77 -0
  74. package/dist/resources/skills/create-gsd-extension/references/custom-commands.md +139 -0
  75. package/dist/resources/skills/create-gsd-extension/references/custom-rendering.md +108 -0
  76. package/dist/resources/skills/create-gsd-extension/references/custom-tools.md +183 -0
  77. package/dist/resources/skills/create-gsd-extension/references/custom-ui.md +490 -0
  78. package/dist/resources/skills/create-gsd-extension/references/events-reference.md +126 -0
  79. package/dist/resources/skills/create-gsd-extension/references/extension-lifecycle.md +64 -0
  80. package/dist/resources/skills/create-gsd-extension/references/extensionapi-reference.md +75 -0
  81. package/dist/resources/skills/create-gsd-extension/references/extensioncontext-reference.md +53 -0
  82. package/dist/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +36 -0
  83. package/dist/resources/skills/create-gsd-extension/references/mode-behavior.md +32 -0
  84. package/dist/resources/skills/create-gsd-extension/references/model-provider-management.md +89 -0
  85. package/dist/resources/skills/create-gsd-extension/references/packaging-distribution.md +55 -0
  86. package/dist/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +90 -0
  87. package/dist/resources/skills/create-gsd-extension/references/state-management.md +70 -0
  88. package/dist/resources/skills/create-gsd-extension/references/system-prompt-modification.md +52 -0
  89. package/dist/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
  90. package/dist/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
  91. package/dist/resources/skills/create-gsd-extension/workflows/add-capability.md +57 -0
  92. package/dist/resources/skills/create-gsd-extension/workflows/create-extension.md +156 -0
  93. package/dist/resources/skills/create-gsd-extension/workflows/debug-extension.md +74 -0
  94. package/dist/resources/skills/create-skill/SKILL.md +184 -0
  95. package/dist/resources/skills/create-skill/references/api-security.md +226 -0
  96. package/dist/resources/skills/create-skill/references/be-clear-and-direct.md +531 -0
  97. package/dist/resources/skills/create-skill/references/common-patterns.md +595 -0
  98. package/dist/resources/skills/create-skill/references/core-principles.md +437 -0
  99. package/dist/resources/skills/create-skill/references/executable-code.md +175 -0
  100. package/dist/resources/skills/create-skill/references/gsd-skill-ecosystem.md +68 -0
  101. package/dist/resources/skills/create-skill/references/iteration-and-testing.md +474 -0
  102. package/dist/resources/skills/create-skill/references/recommended-structure.md +168 -0
  103. package/dist/resources/skills/create-skill/references/skill-structure.md +372 -0
  104. package/dist/resources/skills/create-skill/references/use-xml-tags.md +466 -0
  105. package/dist/resources/skills/create-skill/references/using-scripts.md +113 -0
  106. package/dist/resources/skills/create-skill/references/using-templates.md +112 -0
  107. package/dist/resources/skills/create-skill/references/workflows-and-validation.md +510 -0
  108. package/dist/resources/skills/create-skill/templates/router-skill.md +73 -0
  109. package/dist/resources/skills/create-skill/templates/simple-skill.md +33 -0
  110. package/dist/resources/skills/create-skill/workflows/add-reference.md +96 -0
  111. package/dist/resources/skills/create-skill/workflows/add-script.md +93 -0
  112. package/dist/resources/skills/create-skill/workflows/add-template.md +74 -0
  113. package/dist/resources/skills/create-skill/workflows/add-workflow.md +120 -0
  114. package/dist/resources/skills/create-skill/workflows/audit-skill.md +148 -0
  115. package/dist/resources/skills/create-skill/workflows/create-new-skill.md +196 -0
  116. package/dist/resources/skills/create-skill/workflows/get-guidance.md +121 -0
  117. package/dist/resources/skills/create-skill/workflows/upgrade-to-router.md +161 -0
  118. package/dist/resources/skills/create-skill/workflows/verify-skill.md +204 -0
  119. package/dist/resources/skills/react-best-practices/SKILL.md +1 -1
  120. package/package.json +1 -1
  121. package/packages/native/dist/native.d.ts +2 -0
  122. package/packages/native/dist/native.js +19 -5
  123. package/packages/native/src/native.ts +23 -9
  124. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  125. package/packages/pi-coding-agent/dist/core/extensions/loader.js +13 -0
  126. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  127. package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
  128. package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -0
  129. package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
  130. package/packages/pi-coding-agent/src/core/extensions/loader.ts +13 -0
  131. package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -0
  132. package/src/resources/extensions/bg-shell/process-manager.ts +13 -0
  133. package/src/resources/extensions/gsd/auto-dashboard.ts +217 -65
  134. package/src/resources/extensions/gsd/auto-dispatch.ts +32 -3
  135. package/src/resources/extensions/gsd/auto-post-unit.ts +44 -12
  136. package/src/resources/extensions/gsd/auto-prompts.ts +40 -17
  137. package/src/resources/extensions/gsd/auto-recovery.ts +2 -1
  138. package/src/resources/extensions/gsd/auto-start.ts +18 -32
  139. package/src/resources/extensions/gsd/auto-worktree.ts +21 -182
  140. package/src/resources/extensions/gsd/auto.ts +2 -9
  141. package/src/resources/extensions/gsd/captures.ts +4 -10
  142. package/src/resources/extensions/gsd/commands-handlers.ts +2 -1
  143. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
  144. package/src/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
  145. package/src/resources/extensions/gsd/commands.ts +55 -2
  146. package/src/resources/extensions/gsd/detection.ts +2 -1
  147. package/src/resources/extensions/gsd/doctor-checks.ts +49 -1
  148. package/src/resources/extensions/gsd/doctor-types.ts +3 -1
  149. package/src/resources/extensions/gsd/forensics.ts +2 -2
  150. package/src/resources/extensions/gsd/git-service.ts +3 -2
  151. package/src/resources/extensions/gsd/gitignore.ts +9 -63
  152. package/src/resources/extensions/gsd/gsd-db.ts +1 -165
  153. package/src/resources/extensions/gsd/guided-flow.ts +8 -5
  154. package/src/resources/extensions/gsd/index.ts +3 -3
  155. package/src/resources/extensions/gsd/md-importer.ts +3 -2
  156. package/src/resources/extensions/gsd/mechanical-completion.ts +430 -0
  157. package/src/resources/extensions/gsd/migrate/command.ts +3 -2
  158. package/src/resources/extensions/gsd/migrate/writer.ts +2 -1
  159. package/src/resources/extensions/gsd/migrate-external.ts +123 -0
  160. package/src/resources/extensions/gsd/paths.ts +24 -2
  161. package/src/resources/extensions/gsd/post-unit-hooks.ts +6 -5
  162. package/src/resources/extensions/gsd/preferences-models.ts +7 -1
  163. package/src/resources/extensions/gsd/preferences-validation.ts +2 -1
  164. package/src/resources/extensions/gsd/preferences.ts +10 -5
  165. package/src/resources/extensions/gsd/prompts/discuss-headless.md +4 -2
  166. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  167. package/src/resources/extensions/gsd/prompts/plan-milestone.md +26 -2
  168. package/src/resources/extensions/gsd/prompts/plan-slice.md +15 -1
  169. package/src/resources/extensions/gsd/prompts/workflow-start.md +28 -0
  170. package/src/resources/extensions/gsd/repo-identity.ts +148 -0
  171. package/src/resources/extensions/gsd/resource-version.ts +99 -0
  172. package/src/resources/extensions/gsd/session-forensics.ts +4 -3
  173. package/src/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
  174. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
  175. package/src/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -58
  176. package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +3 -4
  177. package/src/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
  178. package/src/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +5 -18
  179. package/src/resources/extensions/gsd/tests/git-service.test.ts +10 -37
  180. package/src/resources/extensions/gsd/tests/knowledge.test.ts +4 -4
  181. package/src/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
  182. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +1 -0
  183. package/src/resources/extensions/gsd/tests/token-profile.test.ts +14 -16
  184. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
  185. package/src/resources/extensions/gsd/triage-resolution.ts +2 -1
  186. package/src/resources/extensions/gsd/types.ts +2 -0
  187. package/src/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
  188. package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
  189. package/src/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
  190. package/src/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
  191. package/src/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
  192. package/src/resources/extensions/gsd/workflow-templates/registry.json +85 -0
  193. package/src/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
  194. package/src/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
  195. package/src/resources/extensions/gsd/workflow-templates/spike.md +69 -0
  196. package/src/resources/extensions/gsd/workflow-templates.ts +241 -0
  197. package/src/resources/extensions/gsd/worktree-command.ts +1 -11
  198. package/src/resources/extensions/gsd/worktree-manager.ts +3 -2
  199. package/src/resources/extensions/gsd/worktree.ts +42 -5
  200. package/src/resources/extensions/mcp-client/index.ts +459 -0
  201. package/src/resources/skills/create-gsd-extension/SKILL.md +87 -0
  202. package/src/resources/skills/create-gsd-extension/references/compaction-session-control.md +77 -0
  203. package/src/resources/skills/create-gsd-extension/references/custom-commands.md +139 -0
  204. package/src/resources/skills/create-gsd-extension/references/custom-rendering.md +108 -0
  205. package/src/resources/skills/create-gsd-extension/references/custom-tools.md +183 -0
  206. package/src/resources/skills/create-gsd-extension/references/custom-ui.md +490 -0
  207. package/src/resources/skills/create-gsd-extension/references/events-reference.md +126 -0
  208. package/src/resources/skills/create-gsd-extension/references/extension-lifecycle.md +64 -0
  209. package/src/resources/skills/create-gsd-extension/references/extensionapi-reference.md +75 -0
  210. package/src/resources/skills/create-gsd-extension/references/extensioncontext-reference.md +53 -0
  211. package/src/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +36 -0
  212. package/src/resources/skills/create-gsd-extension/references/mode-behavior.md +32 -0
  213. package/src/resources/skills/create-gsd-extension/references/model-provider-management.md +89 -0
  214. package/src/resources/skills/create-gsd-extension/references/packaging-distribution.md +55 -0
  215. package/src/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +90 -0
  216. package/src/resources/skills/create-gsd-extension/references/state-management.md +70 -0
  217. package/src/resources/skills/create-gsd-extension/references/system-prompt-modification.md +52 -0
  218. package/src/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
  219. package/src/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
  220. package/src/resources/skills/create-gsd-extension/workflows/add-capability.md +57 -0
  221. package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +156 -0
  222. package/src/resources/skills/create-gsd-extension/workflows/debug-extension.md +74 -0
  223. package/src/resources/skills/create-skill/SKILL.md +184 -0
  224. package/src/resources/skills/create-skill/references/api-security.md +226 -0
  225. package/src/resources/skills/create-skill/references/be-clear-and-direct.md +531 -0
  226. package/src/resources/skills/create-skill/references/common-patterns.md +595 -0
  227. package/src/resources/skills/create-skill/references/core-principles.md +437 -0
  228. package/src/resources/skills/create-skill/references/executable-code.md +175 -0
  229. package/src/resources/skills/create-skill/references/gsd-skill-ecosystem.md +68 -0
  230. package/src/resources/skills/create-skill/references/iteration-and-testing.md +474 -0
  231. package/src/resources/skills/create-skill/references/recommended-structure.md +168 -0
  232. package/src/resources/skills/create-skill/references/skill-structure.md +372 -0
  233. package/src/resources/skills/create-skill/references/use-xml-tags.md +466 -0
  234. package/src/resources/skills/create-skill/references/using-scripts.md +113 -0
  235. package/src/resources/skills/create-skill/references/using-templates.md +112 -0
  236. package/src/resources/skills/create-skill/references/workflows-and-validation.md +510 -0
  237. package/src/resources/skills/create-skill/templates/router-skill.md +73 -0
  238. package/src/resources/skills/create-skill/templates/simple-skill.md +33 -0
  239. package/src/resources/skills/create-skill/workflows/add-reference.md +96 -0
  240. package/src/resources/skills/create-skill/workflows/add-script.md +93 -0
  241. package/src/resources/skills/create-skill/workflows/add-template.md +74 -0
  242. package/src/resources/skills/create-skill/workflows/add-workflow.md +120 -0
  243. package/src/resources/skills/create-skill/workflows/audit-skill.md +148 -0
  244. package/src/resources/skills/create-skill/workflows/create-new-skill.md +196 -0
  245. package/src/resources/skills/create-skill/workflows/get-guidance.md +121 -0
  246. package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +161 -0
  247. package/src/resources/skills/create-skill/workflows/verify-skill.md +204 -0
  248. package/src/resources/skills/react-best-practices/SKILL.md +1 -1
  249. package/dist/resources/extensions/gsd/auto-worktree-sync.ts +0 -199
  250. package/dist/resources/extensions/gsd/tests/worktree-db-integration.test.ts +0 -205
  251. package/dist/resources/extensions/gsd/tests/worktree-db.test.ts +0 -442
  252. package/dist/resources/extensions/mcporter/index.ts +0 -525
  253. package/src/resources/extensions/gsd/auto-worktree-sync.ts +0 -199
  254. package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +0 -205
  255. package/src/resources/extensions/gsd/tests/worktree-db.test.ts +0 -442
  256. package/src/resources/extensions/mcporter/index.ts +0 -525
@@ -53,6 +53,7 @@ test("types: PhaseSkipPreferences interface exported", () => {
53
53
  assert.ok(typesSrc.includes("skip_research"), "should include skip_research");
54
54
  assert.ok(typesSrc.includes("skip_reassess"), "should include skip_reassess");
55
55
  assert.ok(typesSrc.includes("skip_slice_research"), "should include skip_slice_research");
56
+ assert.ok(typesSrc.includes("reassess_after_slice"), "should include reassess_after_slice");
56
57
  });
57
58
 
58
59
  // ═══════════════════════════════════════════════════════════════════════════
@@ -113,24 +114,21 @@ test("profile: budget profile sets phase skips to true", () => {
113
114
  assert.ok(budgetBlock.includes("skip_slice_research: true"), "budget should skip slice research");
114
115
  });
115
116
 
116
- test("profile: balanced profile skips only slice research", () => {
117
+ test("profile: balanced profile skips research, reassess, and slice research (ADR-003)", () => {
117
118
  const balancedIdx = preferencesSrc.indexOf('case "balanced":');
118
119
  const qualityIdx = preferencesSrc.indexOf('case "quality":');
119
120
  const balancedBlock = preferencesSrc.slice(balancedIdx, qualityIdx);
120
121
  assert.ok(balancedBlock.includes("skip_slice_research: true"), "balanced should skip slice research");
121
- assert.ok(!balancedBlock.includes("skip_research: true"), "balanced should NOT skip milestone research");
122
- assert.ok(!balancedBlock.includes("skip_reassess: true"), "balanced should NOT skip reassess");
122
+ assert.ok(balancedBlock.includes("skip_research: true"), "balanced should skip milestone research");
123
+ assert.ok(balancedBlock.includes("skip_reassess: true"), "balanced should skip reassess");
123
124
  });
124
125
 
125
- test("profile: quality profile has empty phases (no skips)", () => {
126
+ test("profile: quality profile skips research, slice research, and reassess (ADR-003)", () => {
126
127
  const qualityIdx = preferencesSrc.indexOf('case "quality":');
127
- const qualityEnd = preferencesSrc.indexOf("}", qualityIdx + 50);
128
- // Look for the return block after case "quality":
129
- const qualityReturn = preferencesSrc.slice(qualityIdx, qualityIdx + 200);
130
- assert.ok(
131
- qualityReturn.includes("phases: {}"),
132
- "quality should have empty phases object (no skips)",
133
- );
128
+ const qualityBlock = preferencesSrc.slice(qualityIdx, qualityIdx + 300);
129
+ assert.ok(qualityBlock.includes("skip_research: true"), "quality should skip research");
130
+ assert.ok(qualityBlock.includes("skip_slice_research: true"), "quality should skip slice research");
131
+ assert.ok(qualityBlock.includes("skip_reassess: true"), "quality should skip reassess");
134
132
  });
135
133
 
136
134
  // ═══════════════════════════════════════════════════════════════════════════
@@ -253,10 +251,10 @@ test("dispatch: research-slice rule has skip guards", () => {
253
251
  );
254
252
  });
255
253
 
256
- test("dispatch: reassess-roadmap rule has skip_reassess guard", () => {
254
+ test("dispatch: reassess-roadmap rule has reassess_after_slice opt-in guard (ADR-003)", () => {
257
255
  assert.ok(
258
- dispatchSrc.includes("skip_reassess") && dispatchSrc.includes("reassess-roadmap"),
259
- "reassess-roadmap dispatch rule should check phases.skip_reassess",
256
+ dispatchSrc.includes("reassess_after_slice") && dispatchSrc.includes("reassess-roadmap"),
257
+ "reassess-roadmap dispatch rule should check phases.reassess_after_slice",
260
258
  );
261
259
  });
262
260
 
@@ -265,6 +263,6 @@ test("dispatch: phase skip guards return null (not stop)", () => {
265
263
  const researchGuard = dispatchSrc.match(/skip_research\).*?return null/s);
266
264
  assert.ok(researchGuard, "skip_research guard should return null (fall-through)");
267
265
 
268
- const reassessGuard = dispatchSrc.match(/skip_reassess\).*?return null/s);
269
- assert.ok(reassessGuard, "skip_reassess guard should return null (fall-through)");
266
+ const reassessGuard = dispatchSrc.match(/reassess_after_slice\).*?return null/s);
267
+ assert.ok(reassessGuard, "reassess_after_slice guard should return null (fall-through)");
270
268
  });
@@ -0,0 +1,173 @@
1
+ // GSD Workflow Templates — Unit Tests
2
+ //
3
+ // Tests registry loading, template resolution, auto-detection, and listing.
4
+
5
+ import { createTestContext } from './test-helpers.ts';
6
+ import {
7
+ loadRegistry,
8
+ resolveByName,
9
+ autoDetect,
10
+ listTemplates,
11
+ getTemplateInfo,
12
+ loadWorkflowTemplate,
13
+ } from '../workflow-templates.ts';
14
+
15
+ const { assertEq, assertTrue, assertMatch, report } = createTestContext();
16
+
17
+ // ═══════════════════════════════════════════════════════════════════════════
18
+ // Registry Loading
19
+ // ═══════════════════════════════════════════════════════════════════════════
20
+
21
+ console.log('\n── Registry Loading ──');
22
+
23
+ {
24
+ const registry = loadRegistry();
25
+ assertTrue(registry !== null, 'Registry should load');
26
+ assertEq(registry.version, 1, 'Registry version should be 1');
27
+ assertTrue(Object.keys(registry.templates).length >= 8, 'Should have at least 8 templates');
28
+
29
+ // Verify required template keys exist
30
+ const expectedIds = ['full-project', 'bugfix', 'small-feature', 'refactor', 'spike', 'hotfix', 'security-audit', 'dep-upgrade'];
31
+ for (const id of expectedIds) {
32
+ assertTrue(id in registry.templates, `Template "${id}" should exist in registry`);
33
+ }
34
+
35
+ // Verify each template has required fields
36
+ for (const [id, entry] of Object.entries(registry.templates)) {
37
+ assertTrue(typeof entry.name === 'string' && entry.name.length > 0, `${id}: name should be non-empty string`);
38
+ assertTrue(typeof entry.description === 'string' && entry.description.length > 0, `${id}: description should be non-empty`);
39
+ assertTrue(typeof entry.file === 'string' && entry.file.endsWith('.md'), `${id}: file should be a .md path`);
40
+ assertTrue(Array.isArray(entry.phases) && entry.phases.length > 0, `${id}: phases should be non-empty array`);
41
+ assertTrue(Array.isArray(entry.triggers) && entry.triggers.length > 0, `${id}: triggers should be non-empty array`);
42
+ }
43
+ }
44
+
45
+ // ═══════════════════════════════════════════════════════════════════════════
46
+ // Resolve by Name
47
+ // ═══════════════════════════════════════════════════════════════════════════
48
+
49
+ console.log('\n── Resolve by Name ──');
50
+
51
+ {
52
+ // Exact match
53
+ const bugfix = resolveByName('bugfix');
54
+ assertTrue(bugfix !== null, 'Should resolve "bugfix"');
55
+ assertEq(bugfix!.id, 'bugfix', 'ID should be "bugfix"');
56
+ assertEq(bugfix!.confidence, 'exact', 'Exact name should have exact confidence');
57
+
58
+ // Case-insensitive name match
59
+ const spike = resolveByName('Research Spike');
60
+ assertTrue(spike !== null, 'Should resolve "Research Spike" by name');
61
+ assertEq(spike!.id, 'spike', 'Should resolve to spike');
62
+
63
+ // Alias match
64
+ const bug = resolveByName('bug');
65
+ assertTrue(bug !== null, 'Should resolve "bug" alias');
66
+ assertEq(bug!.id, 'bugfix', 'Alias "bug" should map to bugfix');
67
+
68
+ const feat = resolveByName('feat');
69
+ assertTrue(feat !== null, 'Should resolve "feat" alias');
70
+ assertEq(feat!.id, 'small-feature', 'Alias "feat" should map to small-feature');
71
+
72
+ const deps = resolveByName('deps');
73
+ assertTrue(deps !== null, 'Should resolve "deps" alias');
74
+ assertEq(deps!.id, 'dep-upgrade', 'Alias "deps" should map to dep-upgrade');
75
+
76
+ // No match
77
+ const missing = resolveByName('nonexistent-template');
78
+ assertTrue(missing === null, 'Should return null for unknown template');
79
+ }
80
+
81
+ // ═══════════════════════════════════════════════════════════════════════════
82
+ // Auto-Detection
83
+ // ═══════════════════════════════════════════════════════════════════════════
84
+
85
+ console.log('\n── Auto-Detection ──');
86
+
87
+ {
88
+ // Should detect bugfix from "fix" keyword
89
+ const fixMatches = autoDetect('fix the login button');
90
+ assertTrue(fixMatches.length > 0, 'Should detect matches for "fix the login button"');
91
+ assertTrue(fixMatches.some(m => m.id === 'bugfix'), 'Should include bugfix in matches');
92
+
93
+ // Should detect spike from "research" keyword
94
+ const researchMatches = autoDetect('research authentication libraries');
95
+ assertTrue(researchMatches.length > 0, 'Should detect matches for "research"');
96
+ assertTrue(researchMatches.some(m => m.id === 'spike'), 'Should include spike in matches');
97
+
98
+ // Should detect hotfix from "urgent" keyword
99
+ const urgentMatches = autoDetect('urgent production is down');
100
+ assertTrue(urgentMatches.length > 0, 'Should detect matches for "urgent"');
101
+ assertTrue(urgentMatches.some(m => m.id === 'hotfix'), 'Should include hotfix in matches');
102
+
103
+ // Should detect dep-upgrade from "upgrade" keyword
104
+ const upgradeMatches = autoDetect('upgrade react to v19');
105
+ assertTrue(upgradeMatches.length > 0, 'Should detect matches for "upgrade"');
106
+ assertTrue(upgradeMatches.some(m => m.id === 'dep-upgrade'), 'Should include dep-upgrade in matches');
107
+
108
+ // Multi-word triggers should score higher
109
+ const projectMatches = autoDetect('create a new project from scratch');
110
+ const projectMatch = projectMatches.find(m => m.id === 'full-project');
111
+ assertTrue(projectMatch !== undefined, 'Should detect full-project for "from scratch"');
112
+
113
+ // Empty input should return no matches
114
+ const emptyMatches = autoDetect('');
115
+ assertEq(emptyMatches.length, 0, 'Empty input should return no matches');
116
+ }
117
+
118
+ // ═══════════════════════════════════════════════════════════════════════════
119
+ // List Templates
120
+ // ═══════════════════════════════════════════════════════════════════════════
121
+
122
+ console.log('\n── List Templates ──');
123
+
124
+ {
125
+ const output = listTemplates();
126
+ assertTrue(output.includes('Workflow Templates'), 'Should have header');
127
+ assertTrue(output.includes('bugfix'), 'Should list bugfix');
128
+ assertTrue(output.includes('spike'), 'Should list spike');
129
+ assertTrue(output.includes('hotfix'), 'Should list hotfix');
130
+ assertTrue(output.includes('/gsd start'), 'Should include usage hint');
131
+ }
132
+
133
+ // ═══════════════════════════════════════════════════════════════════════════
134
+ // Template Info
135
+ // ═══════════════════════════════════════════════════════════════════════════
136
+
137
+ console.log('\n── Template Info ──');
138
+
139
+ {
140
+ const info = getTemplateInfo('bugfix');
141
+ assertTrue(info !== null, 'Should return info for bugfix');
142
+ assertTrue(info!.includes('Bug Fix'), 'Should include template name');
143
+ assertTrue(info!.includes('triage'), 'Should include phase names');
144
+ assertTrue(info!.includes('Triggers'), 'Should include triggers section');
145
+
146
+ const missing = getTemplateInfo('nonexistent');
147
+ assertTrue(missing === null, 'Should return null for unknown template');
148
+ }
149
+
150
+ // ═══════════════════════════════════════════════════════════════════════════
151
+ // Load Workflow Template Content
152
+ // ═══════════════════════════════════════════════════════════════════════════
153
+
154
+ console.log('\n── Load Workflow Template ──');
155
+
156
+ {
157
+ const content = loadWorkflowTemplate('bugfix');
158
+ assertTrue(content !== null, 'Should load bugfix template');
159
+ assertTrue(content!.includes('Bugfix Workflow'), 'Should contain workflow title');
160
+ assertTrue(content!.includes('Phase 1: Triage'), 'Should contain triage phase');
161
+ assertTrue(content!.includes('Phase 4: Ship'), 'Should contain ship phase');
162
+
163
+ const hotfixContent = loadWorkflowTemplate('hotfix');
164
+ assertTrue(hotfixContent !== null, 'Should load hotfix template');
165
+ assertTrue(hotfixContent!.includes('Hotfix Workflow'), 'Should contain hotfix title');
166
+
167
+ const missingContent = loadWorkflowTemplate('nonexistent');
168
+ assertTrue(missingContent === null, 'Should return null for unknown template');
169
+ }
170
+
171
+ // ═══════════════════════════════════════════════════════════════════════════
172
+
173
+ report();
@@ -12,6 +12,7 @@
12
12
 
13
13
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
14
14
  import { join } from "node:path";
15
+ import { gsdRoot } from "./paths.js";
15
16
  import type { Classification, CaptureEntry } from "./captures.js";
16
17
  import {
17
18
  loadPendingCaptures,
@@ -36,7 +37,7 @@ export function executeInject(
36
37
  ): string | null {
37
38
  try {
38
39
  // Resolve the plan file path
39
- const planPath = join(basePath, ".gsd", "milestones", mid, "slices", sid, `${sid}-PLAN.md`);
40
+ const planPath = join(gsdRoot(basePath), "milestones", mid, "slices", sid, `${sid}-PLAN.md`);
40
41
  if (!existsSync(planPath)) return null;
41
42
 
42
43
  const content = readFileSync(planPath, "utf-8");
@@ -304,6 +304,8 @@ export interface PhaseSkipPreferences {
304
304
  skip_reassess?: boolean;
305
305
  skip_slice_research?: boolean;
306
306
  skip_milestone_validation?: boolean;
307
+ /** When true, reassess-roadmap fires after each slice completion. Opt-in. */
308
+ reassess_after_slice?: boolean;
307
309
  /** When true, auto-mode pauses before each slice for discussion (#789). */
308
310
  require_slice_discussion?: boolean;
309
311
  }
@@ -0,0 +1,87 @@
1
+ # Bugfix Workflow
2
+
3
+ <template_meta>
4
+ name: bugfix
5
+ version: 1
6
+ requires_project: false
7
+ artifact_dir: .gsd/workflows/bugfixes/
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ Fix a bug from identification through to PR submission. Designed for issues reported
12
+ via GitHub, user reports, or developer discovery. Emphasizes root cause analysis
13
+ before jumping to fixes.
14
+ </purpose>
15
+
16
+ <phases>
17
+ 1. triage — Identify root cause, reproduce the bug
18
+ 2. fix — Implement the fix with tests
19
+ 3. verify — Run full test suite, check for regressions
20
+ 4. ship — Create PR with detailed explanation
21
+ </phases>
22
+
23
+ <process>
24
+
25
+ ## Phase 1: Triage
26
+
27
+ **Goal:** Understand the bug before touching any code.
28
+
29
+ 1. **Gather context:**
30
+ - If a GitHub issue was referenced, read the issue description, labels, and comments
31
+ - Identify the expected behavior vs actual behavior
32
+ - Note any error messages, stack traces, or reproduction steps provided
33
+
34
+ 2. **Reproduce:**
35
+ - Find the minimal reproduction path
36
+ - Identify the affected code paths (files, functions, lines)
37
+ - If the bug is intermittent, note the conditions that trigger it
38
+
39
+ 3. **Root cause analysis:**
40
+ - Trace the bug to its root cause (not just the symptom)
41
+ - Identify when the bug was introduced if possible (git blame/log)
42
+ - Assess blast radius: what else could be affected?
43
+
44
+ 4. **Produce:** Write a brief `TRIAGE.md` in the artifact directory with:
45
+ - Root cause explanation
46
+ - Reproduction steps
47
+ - Affected files/functions
48
+ - Proposed fix approach
49
+
50
+ 5. **Gate:** Present the triage findings and proposed fix to the user for confirmation.
51
+
52
+ ## Phase 2: Fix
53
+
54
+ **Goal:** Implement a clean, tested fix.
55
+
56
+ 1. **Plan the fix:** Write a brief plan (1-3 tasks max)
57
+ 2. **Write the fix:** Implement the code change
58
+ 3. **Write tests:** Add or update tests that:
59
+ - Reproduce the original bug (test fails without fix)
60
+ - Verify the fix works
61
+ - Cover edge cases
62
+ 4. **Commit:** Atomic commit with message: `fix(<scope>): <description>`
63
+
64
+ ## Phase 3: Verify
65
+
66
+ **Goal:** Ensure the fix doesn't break anything else.
67
+
68
+ 1. Run the project's full test suite
69
+ 2. Run the build (if applicable)
70
+ 3. Run the linter (if applicable)
71
+ 4. Check for regressions in related functionality
72
+ 5. If any failures, fix them before proceeding
73
+
74
+ ## Phase 4: Ship
75
+
76
+ **Goal:** Create a well-documented PR.
77
+
78
+ 1. Ensure all changes are committed on the workflow branch
79
+ 2. Build the PR body:
80
+ - Link to the original issue (if applicable)
81
+ - Explain the root cause
82
+ - Describe the fix approach
83
+ - List the test coverage added
84
+ 3. Present the PR details to the user for review
85
+ 4. Create the PR via `gh pr create` (with user approval)
86
+
87
+ </process>
@@ -0,0 +1,74 @@
1
+ # Dependency Upgrade Workflow
2
+
3
+ <template_meta>
4
+ name: dep-upgrade
5
+ version: 1
6
+ requires_project: false
7
+ artifact_dir: .gsd/workflows/upgrades/
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ Upgrade project dependencies safely. Assess breaking changes before upgrading,
12
+ fix issues incrementally, and verify everything works. Handles both single-package
13
+ upgrades and bulk dependency refresh.
14
+ </purpose>
15
+
16
+ <phases>
17
+ 1. assess — Analyze what's outdated and what will break
18
+ 2. upgrade — Apply upgrades incrementally
19
+ 3. fix — Resolve breaking changes
20
+ 4. verify — Full test suite and build validation
21
+ </phases>
22
+
23
+ <process>
24
+
25
+ ## Phase 1: Assess
26
+
27
+ **Goal:** Know what you're getting into before changing versions.
28
+
29
+ 1. **List outdated dependencies:** Run `npm outdated` / equivalent
30
+ 2. **For each target upgrade:**
31
+ - Read the changelog / release notes
32
+ - Identify breaking changes
33
+ - Check for known migration guides
34
+ - Assess impact on the codebase (grep for affected APIs)
35
+ 3. **Prioritize:** Which upgrades to do now, which to defer
36
+ 4. **Produce:** Write `ASSESSMENT.md` with:
37
+ - Dependency list with current → target versions
38
+ - Breaking changes per dependency
39
+ - Upgrade order (dependencies before dependents)
40
+ - Risk assessment
41
+
42
+ 5. **Gate:** Review assessment with user. Confirm upgrade scope.
43
+
44
+ ## Phase 2: Upgrade
45
+
46
+ **Goal:** Apply version bumps incrementally.
47
+
48
+ 1. Upgrade one dependency (or one group of related dependencies) at a time
49
+ 2. Run tests after each upgrade
50
+ 3. Commit each upgrade: `chore(deps): upgrade <package> to <version>`
51
+ 4. If tests fail, move to Phase 3 for that dependency before continuing
52
+
53
+ ## Phase 3: Fix
54
+
55
+ **Goal:** Resolve any breaking changes from upgrades.
56
+
57
+ 1. Fix API changes, type errors, deprecations
58
+ 2. Update configuration if needed
59
+ 3. Commit fixes separately from the upgrade: `fix(deps): adapt to <package> v<version> changes`
60
+
61
+ ## Phase 4: Verify
62
+
63
+ **Goal:** Ensure everything works together.
64
+
65
+ 1. Run the full test suite
66
+ 2. Run the build
67
+ 3. Run the linter
68
+ 4. Check for deprecation warnings in output
69
+ 5. **Produce:** Write `SUMMARY.md` with:
70
+ - Dependencies upgraded (from → to)
71
+ - Breaking changes encountered and how they were resolved
72
+ - Any deferred upgrades and why
73
+
74
+ </process>
@@ -0,0 +1,41 @@
1
+ # Full Project Workflow
2
+
3
+ <template_meta>
4
+ name: full-project
5
+ version: 1
6
+ requires_project: true
7
+ artifact_dir: .gsd/
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ The complete GSD workflow with full ceremony: roadmap, milestones, slices, tasks,
12
+ research, planning, execution, and verification. Use for greenfield projects or
13
+ major features that need the full planning apparatus.
14
+
15
+ This template wraps the existing GSD workflow for registry completeness.
16
+ When selected, it routes to the standard /gsd init → /gsd auto pipeline.
17
+ </purpose>
18
+
19
+ <phases>
20
+ 1. init — Initialize project, detect stack, create .gsd/
21
+ 2. discuss — Define requirements, decisions, and architecture
22
+ 3. plan — Create roadmap with milestones and slices
23
+ 4. execute — Execute slices: research → plan → implement → verify per slice
24
+ 5. verify — Milestone-level verification and completion
25
+ </phases>
26
+
27
+ <process>
28
+
29
+ ## Routing to Standard GSD
30
+
31
+ This template is a convenience entry point. When selected via `/gsd start full-project`,
32
+ it should route to the standard GSD workflow:
33
+
34
+ 1. If `.gsd/` doesn't exist: Run `/gsd init` to bootstrap the project
35
+ 2. If `.gsd/` exists but no milestones: Start the discuss phase via `/gsd discuss`
36
+ 3. If milestones exist: Resume via `/gsd auto` or `/gsd next`
37
+
38
+ The full GSD workflow protocol is defined in `GSD-WORKFLOW.md` and handles all
39
+ phases, state tracking, and agent orchestration.
40
+
41
+ </process>
@@ -0,0 +1,45 @@
1
+ # Hotfix Workflow
2
+
3
+ <template_meta>
4
+ name: hotfix
5
+ version: 1
6
+ requires_project: false
7
+ artifact_dir: null
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ Minimal ceremony for urgent fixes. Fix it, test it, ship it. No planning artifacts,
12
+ no research phase, no lengthy documentation. For when production is broken and
13
+ speed matters.
14
+ </purpose>
15
+
16
+ <phases>
17
+ 1. fix — Identify and fix the issue
18
+ 2. ship — Test, commit, and create PR
19
+ </phases>
20
+
21
+ <process>
22
+
23
+ ## Phase 1: Fix
24
+
25
+ **Goal:** Find and fix the issue as fast as possible.
26
+
27
+ 1. Identify the broken behavior
28
+ 2. Locate the root cause
29
+ 3. Implement the minimal fix
30
+ 4. Add a regression test if possible (don't block on this if the fix is urgent)
31
+ 5. Commit: `fix(<scope>): <description>`
32
+
33
+ ## Phase 2: Ship
34
+
35
+ **Goal:** Get the fix deployed.
36
+
37
+ 1. Run tests — fix any failures
38
+ 2. Run the build
39
+ 3. Push and create PR with:
40
+ - What broke
41
+ - What the fix does
42
+ - How to verify
43
+ 4. Present PR to user for approval
44
+
45
+ </process>
@@ -0,0 +1,83 @@
1
+ # Refactor / Migration Workflow
2
+
3
+ <template_meta>
4
+ name: refactor
5
+ version: 1
6
+ requires_project: false
7
+ artifact_dir: .gsd/workflows/refactors/
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ Systematic code transformation with inventory-driven planning. Designed for
12
+ renames, restructures, pattern migrations, and API modernization. Executes in
13
+ waves to minimize risk and enable incremental verification.
14
+ </purpose>
15
+
16
+ <phases>
17
+ 1. inventory — Catalog everything that needs to change
18
+ 2. plan — Group changes into safe waves
19
+ 3. migrate — Execute waves with verification between each
20
+ 4. verify — Full regression testing and cleanup
21
+ </phases>
22
+
23
+ <process>
24
+
25
+ ## Phase 1: Inventory
26
+
27
+ **Goal:** Know the full scope before changing anything.
28
+
29
+ 1. **Scan the codebase:** Find all instances of what needs to change
30
+ - Files, functions, types, imports, tests, docs, config
31
+ - Use grep/glob to be exhaustive — don't rely on memory
32
+ 2. **Categorize:** Group by type (source, test, config, docs)
33
+ 3. **Identify dependencies:** What order must changes happen in?
34
+ 4. **Produce:** Write `INVENTORY.md` with:
35
+ - Complete list of files/locations that need changes
36
+ - Dependency relationships
37
+ - Estimated scope (number of files, lines affected)
38
+
39
+ 5. **Gate:** Review inventory with user. Confirm nothing is missing.
40
+
41
+ ## Phase 2: Plan
42
+
43
+ **Goal:** Break the migration into safe, independently-verifiable waves.
44
+
45
+ 1. **Define waves:** Group related changes so each wave:
46
+ - Leaves the codebase in a working state
47
+ - Can be committed and tested independently
48
+ - Handles dependencies (change the definition before the consumers)
49
+ 2. **Typical wave structure:**
50
+ - Wave 1: Types/interfaces
51
+ - Wave 2: Core implementation
52
+ - Wave 3: Consumers/callers
53
+ - Wave 4: Tests
54
+ - Wave 5: Documentation and config
55
+ 3. **Produce:** Write `PLAN.md` with waves and per-wave file lists
56
+
57
+ 4. **Gate:** Confirm plan with user.
58
+
59
+ ## Phase 3: Migrate
60
+
61
+ **Goal:** Execute waves one at a time with verification between each.
62
+
63
+ 1. For each wave:
64
+ - Make the changes
65
+ - Run tests (at minimum, the build must pass)
66
+ - Commit: `refactor(<scope>): wave N — <description>`
67
+ 2. If a wave introduces failures, fix them before moving to the next wave
68
+ 3. If unexpected scope is discovered, update the inventory and plan
69
+
70
+ ## Phase 4: Verify
71
+
72
+ **Goal:** Ensure the full refactor is complete and clean.
73
+
74
+ 1. Run the complete test suite
75
+ 2. Run the build
76
+ 3. Run the linter — fix any new warnings
77
+ 4. Search for any remnants of the old pattern (grep for old names/patterns)
78
+ 5. **Produce:** Write `SUMMARY.md` with:
79
+ - What was changed and why
80
+ - Files modified (count and list)
81
+ - Any remaining follow-up items
82
+
83
+ </process>