specweave 0.6.8 → 0.7.1

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 (255) hide show
  1. package/.claude-plugin/README.md +1 -1
  2. package/CLAUDE.md +903 -99
  3. package/README.md +143 -207
  4. package/bin/specweave.js +67 -0
  5. package/dist/cli/commands/abandon.d.ts +13 -0
  6. package/dist/cli/commands/abandon.d.ts.map +1 -0
  7. package/dist/cli/commands/abandon.js +15 -0
  8. package/dist/cli/commands/abandon.js.map +1 -0
  9. package/dist/cli/commands/init.d.ts.map +1 -1
  10. package/dist/cli/commands/init.js +94 -18
  11. package/dist/cli/commands/init.js.map +1 -1
  12. package/dist/cli/commands/pause.d.ts +13 -0
  13. package/dist/cli/commands/pause.d.ts.map +1 -0
  14. package/dist/cli/commands/pause.js +15 -0
  15. package/dist/cli/commands/pause.js.map +1 -0
  16. package/dist/cli/commands/qa.d.ts +54 -0
  17. package/dist/cli/commands/qa.d.ts.map +1 -0
  18. package/dist/cli/commands/qa.js +98 -0
  19. package/dist/cli/commands/qa.js.map +1 -0
  20. package/dist/cli/commands/resume.d.ts +12 -0
  21. package/dist/cli/commands/resume.d.ts.map +1 -0
  22. package/dist/cli/commands/resume.js +14 -0
  23. package/dist/cli/commands/resume.js.map +1 -0
  24. package/dist/cli/commands/status.d.ts +12 -0
  25. package/dist/cli/commands/status.d.ts.map +1 -0
  26. package/dist/cli/commands/status.js +23 -0
  27. package/dist/cli/commands/status.js.map +1 -0
  28. package/dist/cli/helpers/issue-tracker/ado.d.ts +57 -0
  29. package/dist/cli/helpers/issue-tracker/ado.d.ts.map +1 -0
  30. package/dist/cli/helpers/issue-tracker/ado.js +223 -0
  31. package/dist/cli/helpers/issue-tracker/ado.js.map +1 -0
  32. package/dist/cli/helpers/issue-tracker/github.d.ts +65 -0
  33. package/dist/cli/helpers/issue-tracker/github.d.ts.map +1 -0
  34. package/dist/cli/helpers/issue-tracker/github.js +284 -0
  35. package/dist/cli/helpers/issue-tracker/github.js.map +1 -0
  36. package/dist/cli/helpers/issue-tracker/index.d.ts +22 -0
  37. package/dist/cli/helpers/issue-tracker/index.d.ts.map +1 -0
  38. package/dist/cli/helpers/issue-tracker/index.js +270 -0
  39. package/dist/cli/helpers/issue-tracker/index.js.map +1 -0
  40. package/dist/cli/helpers/issue-tracker/jira.d.ts +61 -0
  41. package/dist/cli/helpers/issue-tracker/jira.d.ts.map +1 -0
  42. package/dist/cli/helpers/issue-tracker/jira.js +265 -0
  43. package/dist/cli/helpers/issue-tracker/jira.js.map +1 -0
  44. package/dist/cli/helpers/issue-tracker/types.d.ts +86 -0
  45. package/dist/cli/helpers/issue-tracker/types.d.ts.map +1 -0
  46. package/dist/cli/helpers/issue-tracker/types.js +16 -0
  47. package/dist/cli/helpers/issue-tracker/types.js.map +1 -0
  48. package/dist/cli/helpers/issue-tracker/utils.d.ts +103 -0
  49. package/dist/cli/helpers/issue-tracker/utils.d.ts.map +1 -0
  50. package/dist/cli/helpers/issue-tracker/utils.js +240 -0
  51. package/dist/cli/helpers/issue-tracker/utils.js.map +1 -0
  52. package/dist/core/increment/limits.d.ts +68 -0
  53. package/dist/core/increment/limits.d.ts.map +1 -0
  54. package/dist/core/increment/limits.js +224 -0
  55. package/dist/core/increment/limits.js.map +1 -0
  56. package/dist/core/increment/metadata-manager.d.ts +114 -0
  57. package/dist/core/increment/metadata-manager.d.ts.map +1 -0
  58. package/dist/core/increment/metadata-manager.js +320 -0
  59. package/dist/core/increment/metadata-manager.js.map +1 -0
  60. package/dist/core/increment/status-commands.d.ts +43 -0
  61. package/dist/core/increment/status-commands.d.ts.map +1 -0
  62. package/dist/core/increment/status-commands.js +277 -0
  63. package/dist/core/increment/status-commands.js.map +1 -0
  64. package/dist/core/plugin-detector.d.ts +1 -0
  65. package/dist/core/plugin-detector.d.ts.map +1 -1
  66. package/dist/core/plugin-detector.js +25 -0
  67. package/dist/core/plugin-detector.js.map +1 -1
  68. package/dist/core/qa/qa-runner.d.ts +16 -0
  69. package/dist/core/qa/qa-runner.d.ts.map +1 -0
  70. package/dist/core/qa/qa-runner.js +404 -0
  71. package/dist/core/qa/qa-runner.js.map +1 -0
  72. package/dist/core/qa/quality-gate-decider.d.ts +53 -0
  73. package/dist/core/qa/quality-gate-decider.d.ts.map +1 -0
  74. package/dist/core/qa/quality-gate-decider.js +268 -0
  75. package/dist/core/qa/quality-gate-decider.js.map +1 -0
  76. package/dist/core/qa/risk-calculator.d.ts +126 -0
  77. package/dist/core/qa/risk-calculator.d.ts.map +1 -0
  78. package/dist/core/qa/risk-calculator.js +247 -0
  79. package/dist/core/qa/risk-calculator.js.map +1 -0
  80. package/dist/core/qa/types.d.ts +315 -0
  81. package/dist/core/qa/types.d.ts.map +1 -0
  82. package/dist/core/qa/types.js +8 -0
  83. package/dist/core/qa/types.js.map +1 -0
  84. package/dist/core/types/config.d.ts +35 -0
  85. package/dist/core/types/config.d.ts.map +1 -1
  86. package/dist/core/types/config.js +16 -0
  87. package/dist/core/types/config.js.map +1 -1
  88. package/dist/core/types/increment-metadata.d.ts +120 -0
  89. package/dist/core/types/increment-metadata.d.ts.map +1 -0
  90. package/dist/core/types/increment-metadata.js +138 -0
  91. package/dist/core/types/increment-metadata.js.map +1 -0
  92. package/dist/hooks/lib/invoke-translator-skill.d.ts +60 -0
  93. package/dist/hooks/lib/invoke-translator-skill.d.ts.map +1 -0
  94. package/dist/hooks/lib/invoke-translator-skill.js +201 -0
  95. package/dist/hooks/lib/invoke-translator-skill.js.map +1 -0
  96. package/dist/hooks/lib/translate-file.d.ts +59 -0
  97. package/dist/hooks/lib/translate-file.d.ts.map +1 -0
  98. package/dist/hooks/lib/translate-file.js +350 -0
  99. package/dist/hooks/lib/translate-file.js.map +1 -0
  100. package/dist/locales/en/cli.json +3 -1
  101. package/dist/metrics/calculators/change-failure-rate.d.ts +22 -0
  102. package/dist/metrics/calculators/change-failure-rate.d.ts.map +1 -0
  103. package/dist/metrics/calculators/change-failure-rate.js +70 -0
  104. package/dist/metrics/calculators/change-failure-rate.js.map +1 -0
  105. package/dist/metrics/calculators/deployment-frequency.d.ts +20 -0
  106. package/dist/metrics/calculators/deployment-frequency.d.ts.map +1 -0
  107. package/dist/metrics/calculators/deployment-frequency.js +61 -0
  108. package/dist/metrics/calculators/deployment-frequency.js.map +1 -0
  109. package/dist/metrics/calculators/lead-time.d.ts +22 -0
  110. package/dist/metrics/calculators/lead-time.d.ts.map +1 -0
  111. package/dist/metrics/calculators/lead-time.js +82 -0
  112. package/dist/metrics/calculators/lead-time.js.map +1 -0
  113. package/dist/metrics/calculators/mttr.d.ts +21 -0
  114. package/dist/metrics/calculators/mttr.d.ts.map +1 -0
  115. package/dist/metrics/calculators/mttr.js +60 -0
  116. package/dist/metrics/calculators/mttr.js.map +1 -0
  117. package/dist/metrics/dora-calculator.d.ts +24 -0
  118. package/dist/metrics/dora-calculator.d.ts.map +1 -0
  119. package/dist/metrics/dora-calculator.js +104 -0
  120. package/dist/metrics/dora-calculator.js.map +1 -0
  121. package/dist/metrics/github-client.d.ts +51 -0
  122. package/dist/metrics/github-client.d.ts.map +1 -0
  123. package/dist/metrics/github-client.js +133 -0
  124. package/dist/metrics/github-client.js.map +1 -0
  125. package/dist/metrics/types.d.ts +112 -0
  126. package/dist/metrics/types.d.ts.map +1 -0
  127. package/dist/metrics/types.js +10 -0
  128. package/dist/metrics/types.js.map +1 -0
  129. package/dist/metrics/utils/percentile.d.ts +25 -0
  130. package/dist/metrics/utils/percentile.d.ts.map +1 -0
  131. package/dist/metrics/utils/percentile.js +46 -0
  132. package/dist/metrics/utils/percentile.js.map +1 -0
  133. package/dist/metrics/utils/tier-classifier.d.ts +61 -0
  134. package/dist/metrics/utils/tier-classifier.d.ts.map +1 -0
  135. package/dist/metrics/utils/tier-classifier.js +100 -0
  136. package/dist/metrics/utils/tier-classifier.js.map +1 -0
  137. package/dist/utils/auth-helpers.d.ts +58 -0
  138. package/dist/utils/auth-helpers.d.ts.map +1 -0
  139. package/dist/utils/auth-helpers.js +108 -0
  140. package/dist/utils/auth-helpers.js.map +1 -0
  141. package/dist/utils/env-file.d.ts +88 -0
  142. package/dist/utils/env-file.d.ts.map +1 -0
  143. package/dist/utils/env-file.js +180 -0
  144. package/dist/utils/env-file.js.map +1 -0
  145. package/dist/utils/plugin-detection.d.ts +50 -0
  146. package/dist/utils/plugin-detection.d.ts.map +1 -0
  147. package/dist/utils/plugin-detection.js +229 -0
  148. package/dist/utils/plugin-detection.js.map +1 -0
  149. package/dist/utils/secrets-loader.d.ts +88 -0
  150. package/dist/utils/secrets-loader.d.ts.map +1 -0
  151. package/dist/utils/secrets-loader.js +271 -0
  152. package/dist/utils/secrets-loader.js.map +1 -0
  153. package/dist/utils/translation.d.ts +187 -0
  154. package/dist/utils/translation.d.ts.map +1 -0
  155. package/dist/utils/translation.js +414 -0
  156. package/dist/utils/translation.js.map +1 -0
  157. package/package.json +28 -44
  158. package/plugins/specweave/.claude-plugin/plugin.json +3 -3
  159. package/plugins/specweave/agents/pm/AGENT.md +330 -54
  160. package/plugins/specweave/agents/test-aware-planner/AGENT.md +1035 -0
  161. package/plugins/specweave/agents/test-aware-planner/templates/README.md +118 -0
  162. package/plugins/specweave/agents/test-aware-planner/templates/task-non-testable.md.template +24 -0
  163. package/plugins/specweave/agents/test-aware-planner/templates/task-testable.md.template +53 -0
  164. package/plugins/specweave/agents/test-aware-planner/templates/tasks-frontmatter.md.template +11 -0
  165. package/plugins/specweave/commands/README.md +88 -163
  166. package/plugins/specweave/commands/specweave-abandon.md +314 -0
  167. package/plugins/specweave/commands/specweave-check-tests.md +546 -0
  168. package/plugins/specweave/commands/{do.md → specweave-do.md} +5 -7
  169. package/plugins/specweave/commands/{increment.md → specweave-increment.md} +231 -4
  170. package/plugins/specweave/commands/specweave-pause.md +189 -0
  171. package/plugins/specweave/commands/specweave-qa.md +245 -0
  172. package/plugins/specweave/commands/specweave-resume.md +216 -0
  173. package/plugins/specweave/commands/specweave-status.md +397 -0
  174. package/plugins/specweave/commands/specweave-sync-tasks.md +256 -0
  175. package/plugins/specweave/commands/{translate.md → specweave-translate.md} +3 -3
  176. package/plugins/specweave/commands/specweave-update-scope.md +351 -0
  177. package/plugins/specweave/commands/specweave.md +21 -21
  178. package/plugins/specweave/hooks/post-increment-planning.sh +335 -0
  179. package/plugins/specweave/hooks/post-task-completion.sh +141 -0
  180. package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
  181. package/plugins/specweave/skills/brownfield-analyzer/SKILL.md +9 -9
  182. package/plugins/specweave/skills/increment-planner/SKILL.md +400 -212
  183. package/plugins/specweave/skills/increment-quality-judge-v2/SKILL.md +499 -0
  184. package/plugins/specweave/skills/plugin-detector/SKILL.md +114 -1
  185. package/plugins/specweave/skills/project-kickstarter/SKILL.md +74 -1
  186. package/plugins/specweave/skills/{rfc-generator → spec-generator}/SKILL.md +22 -29
  187. package/plugins/specweave/skills/specweave-detector/SKILL.md +3 -3
  188. package/plugins/specweave/skills/specweave-framework/SKILL.md +2 -2
  189. package/plugins/specweave-ado/.claude-plugin/plugin.json +18 -4
  190. package/plugins/specweave-ado/agents/ado-manager/AGENT.md +426 -0
  191. package/plugins/specweave-ado/commands/close-workitem.md +52 -0
  192. package/plugins/specweave-ado/commands/create-workitem.md +53 -0
  193. package/plugins/specweave-ado/commands/status.md +53 -0
  194. package/plugins/specweave-ado/commands/sync.md +55 -0
  195. package/plugins/specweave-ado/lib/ado-client.ts +361 -0
  196. package/plugins/specweave-ado/reference/ado-specweave-mapping.md +552 -0
  197. package/plugins/specweave-ado/skills/ado-sync/SKILL.md +344 -193
  198. package/plugins/specweave-docs/skills/docusaurus/SKILL.md +73 -0
  199. package/plugins/specweave-github/agents/github-manager/AGENT.md +49 -0
  200. package/plugins/specweave-github/commands/{github-close-issue.md → close-issue.md} +1 -1
  201. package/plugins/specweave-github/commands/{github-create-issue.md → create-issue.md} +1 -1
  202. package/plugins/specweave-github/commands/{github-status.md → status.md} +1 -1
  203. package/plugins/specweave-github/commands/{github-sync-tasks.md → sync-tasks.md} +1 -1
  204. package/plugins/specweave-github/commands/{github-sync.md → sync.md} +1 -1
  205. package/plugins/specweave-github/reference/github-specweave-mapping.md +377 -0
  206. package/plugins/specweave-github/skills/github-sync/SKILL.md +11 -3
  207. package/plugins/specweave-infrastructure/commands/{specweave.monitor-setup.md → monitor-setup.md} +5 -0
  208. package/plugins/specweave-infrastructure/commands/{specweave.slo-implement.md → slo-implement.md} +5 -0
  209. package/plugins/specweave-jira/agents/jira-manager/AGENT.md +380 -0
  210. package/plugins/specweave-jira/commands/{specweave.sync-jira.md → sync.md} +1 -1
  211. package/plugins/specweave-jira/reference/jira-specweave-mapping.md +508 -0
  212. package/plugins/specweave-ml/commands/ml-deploy.md +1 -1
  213. package/plugins/specweave-ml/commands/ml-evaluate.md +1 -1
  214. package/plugins/specweave-ml/commands/ml-explain.md +1 -1
  215. package/plugins/specweave-ml/commands/{specweave.ml-pipeline.md → ml-pipeline.md} +5 -0
  216. package/src/templates/AGENTS.md.template +331 -31
  217. package/src/templates/CLAUDE.md.template +36 -21
  218. package/src/templates/COMPLETION-REPORT.template.md +128 -0
  219. package/src/templates/README.md.template +17 -16
  220. package/src/templates/docs/README.md +11 -9
  221. package/src/templates/docs/spec-template.md +229 -0
  222. package/plugins/specweave/commands/inc.md +0 -85
  223. package/plugins/specweave/commands/list-increments.md +0 -180
  224. package/src/adapters/README.md +0 -275
  225. package/src/adapters/adapter-base.ts +0 -182
  226. package/src/adapters/adapter-interface.ts +0 -166
  227. package/src/adapters/adapter-loader.ts +0 -256
  228. package/src/adapters/agents-md-generator.ts +0 -228
  229. package/src/adapters/claude/README.md +0 -233
  230. package/src/adapters/claude/adapter.ts +0 -468
  231. package/src/adapters/claude-md-generator.ts +0 -377
  232. package/src/adapters/codex/README.md +0 -105
  233. package/src/adapters/codex/adapter.ts +0 -333
  234. package/src/adapters/cursor/.cursor/context/docs-context.md +0 -62
  235. package/src/adapters/cursor/.cursor/context/increments-context.md +0 -71
  236. package/src/adapters/cursor/.cursor/context/strategy-context.md +0 -73
  237. package/src/adapters/cursor/.cursor/context/tests-context.md +0 -89
  238. package/src/adapters/cursor/README.md +0 -283
  239. package/src/adapters/cursor/adapter.ts +0 -451
  240. package/src/adapters/doc-generator.ts +0 -331
  241. package/src/adapters/gemini/README.md +0 -97
  242. package/src/adapters/gemini/adapter.ts +0 -298
  243. package/src/adapters/generic/README.md +0 -277
  244. package/src/adapters/generic/adapter.ts +0 -378
  245. package/src/adapters/registry.yaml +0 -187
  246. /package/plugins/specweave/commands/{costs.md → specweave-costs.md} +0 -0
  247. /package/plugins/specweave/commands/{done.md → specweave-done.md} +0 -0
  248. /package/plugins/specweave/commands/{next.md → specweave-next.md} +0 -0
  249. /package/plugins/specweave/commands/{progress.md → specweave-progress.md} +0 -0
  250. /package/plugins/specweave/commands/{sync-docs.md → specweave-sync-docs.md} +0 -0
  251. /package/plugins/specweave/commands/{tdd-cycle.md → specweave-tdd-cycle.md} +0 -0
  252. /package/plugins/specweave/commands/{tdd-green.md → specweave-tdd-green.md} +0 -0
  253. /package/plugins/specweave/commands/{tdd-red.md → specweave-tdd-red.md} +0 -0
  254. /package/plugins/specweave/commands/{tdd-refactor.md → specweave-tdd-refactor.md} +0 -0
  255. /package/plugins/specweave/commands/{validate.md → specweave-validate.md} +0 -0
@@ -157,6 +157,234 @@ This step remains for auto-closing "in-progress" increments that ARE complete.
157
157
  - ✅ Enforces quality awareness (can't ignore incomplete work)
158
158
  - ✅ No manual `/done` needed when gates pass
159
159
 
160
+ ### Step 0C: Simplified WIP Enforcement (v0.7.0+ Redesigned)
161
+
162
+ **NEW PHILOSOPHY: Default to 1 active increment (maximum focus), allow 2 only for emergencies.**
163
+
164
+ After passing pre-flight checks (Step 0A, 0B), enforce WIP limits based on simplified config.
165
+
166
+ **Implementation**:
167
+ ```typescript
168
+ import { MetadataManager } from '../core/metadata-manager';
169
+ import { ConfigManager } from '../core/config-manager';
170
+ import { IncrementType } from '../core/types';
171
+
172
+ // 1. Load config (defaults: maxActiveIncrements=1, hardCap=2, allowEmergencyInterrupt=true)
173
+ const config = ConfigManager.load();
174
+ const limits = config.limits || {
175
+ maxActiveIncrements: 1,
176
+ hardCap: 2,
177
+ allowEmergencyInterrupt: true,
178
+ typeBehaviors: {
179
+ canInterrupt: ['hotfix', 'bug']
180
+ }
181
+ };
182
+
183
+ // 2. Count active increments (NOT paused/completed/abandoned)
184
+ const active = MetadataManager.getAllActive();
185
+ const activeCount = active.length;
186
+
187
+ // 3. Ask user for increment type (or detect from title)
188
+ const incrementType = await promptForType(); // hotfix, feature, bug, change-request, refactor, experiment
189
+
190
+ // 4. HARD CAP ENFORCEMENT (never >2 active)
191
+ if (activeCount >= limits.hardCap) {
192
+ console.log(chalk.red.bold('\n❌ HARD CAP REACHED\n'));
193
+ console.log(chalk.red(`You have ${activeCount} active increments (absolute maximum: ${limits.hardCap})\n`));
194
+
195
+ console.log(chalk.yellow('Active increments:'));
196
+ active.forEach(inc => {
197
+ console.log(chalk.dim(` • ${inc.id} [${inc.type}]`));
198
+ });
199
+
200
+ console.log(chalk.blue('\n💡 You MUST complete or pause existing work first:\n'));
201
+ console.log(chalk.white('1️⃣ Complete an increment:'));
202
+ console.log(chalk.dim(' /done <id>\n'));
203
+ console.log(chalk.white('2️⃣ Pause an increment:'));
204
+ console.log(chalk.dim(' /pause <id> --reason="..."\n'));
205
+ console.log(chalk.white('3️⃣ Check status:'));
206
+ console.log(chalk.dim(' /status\n'));
207
+
208
+ console.log(chalk.yellow('📝 Multiple hotfixes? Combine them into ONE increment!'));
209
+ console.log(chalk.dim(' Example: 0009-security-fixes (SQL + XSS + CSRF)\n'));
210
+
211
+ console.log(chalk.red.bold('⛔ This limit is enforced for your productivity.'));
212
+ console.log(chalk.dim('Research: 3+ concurrent tasks = 40% slower + more bugs\n'));
213
+
214
+ // NO force override at hard cap - absolute maximum
215
+ process.exit(1);
216
+ }
217
+
218
+ // 5. SOFT ENFORCEMENT (activeCount >= maxActiveIncrements)
219
+ if (activeCount >= limits.maxActiveIncrements) {
220
+ const canInterrupt = limits.typeBehaviors?.canInterrupt || ['hotfix', 'bug'];
221
+ const isEmergency = canInterrupt.includes(incrementType);
222
+
223
+ if (isEmergency && limits.allowEmergencyInterrupt) {
224
+ // ✅ ALLOW - Emergency interrupt
225
+ console.log(chalk.yellow.bold('\n⚠️ EMERGENCY INTERRUPT\n'));
226
+ console.log(chalk.yellow(`Starting ${incrementType} increment (emergency exception allowed)\n`));
227
+ console.log(chalk.dim('You have 1 active increment. This will be your 2nd (emergency ceiling).\n'));
228
+
229
+ console.log(chalk.blue('📋 Active increments:'));
230
+ active.forEach(inc => {
231
+ console.log(chalk.dim(` • ${inc.id} [${inc.type}]`));
232
+ });
233
+
234
+ console.log(chalk.yellow('\n💡 Recommendation: After emergency, complete or pause it before resuming normal work.\n'));
235
+
236
+ // Continue to Step 1
237
+ } else {
238
+ // ❌ SOFT BLOCK - Warn and offer options
239
+ console.log(chalk.yellow.bold('\n⚠️ WIP LIMIT REACHED\n'));
240
+ console.log(chalk.yellow(`You have ${activeCount} active increment(s) (recommended limit: ${limits.maxActiveIncrements})\n`));
241
+
242
+ console.log(chalk.yellow('Active increments:'));
243
+ active.forEach(inc => {
244
+ console.log(chalk.dim(` • ${inc.id} [${inc.type}]`));
245
+ });
246
+
247
+ console.log(chalk.dim('\n🧠 Focus Principle: ONE active increment = maximum productivity'));
248
+ console.log(chalk.dim('Starting a 2nd increment reduces focus and velocity.\n'));
249
+
250
+ console.log(chalk.blue('💡 What would you like to do?\n'));
251
+ console.log(chalk.white('1️⃣ Complete current work (recommended)'));
252
+ console.log(chalk.dim(' Finish active increment before starting new\n'));
253
+ console.log(chalk.white('2️⃣ Pause current work'));
254
+ console.log(chalk.dim(' Pause active increment to focus on new work\n'));
255
+ console.log(chalk.white('3️⃣ Start 2nd increment anyway'));
256
+ console.log(chalk.dim(' Accept productivity cost (20% slower)\n'));
257
+
258
+ const choice = await prompt({
259
+ type: 'list',
260
+ message: 'Choose an option:',
261
+ choices: [
262
+ { name: 'Complete current work', value: 'complete' },
263
+ { name: 'Pause current work', value: 'pause' },
264
+ { name: 'Start 2nd increment anyway', value: 'continue' }
265
+ ]
266
+ });
267
+
268
+ if (choice === 'complete') {
269
+ console.log(chalk.green('\n✅ Smart choice! Finish current work first.\n'));
270
+ console.log(chalk.dim('Use /do to continue work\n'));
271
+ process.exit(0);
272
+ } else if (choice === 'pause') {
273
+ console.log(chalk.blue('\n⏸️ Pausing current increment...\n'));
274
+ const pauseReason = await prompt({
275
+ type: 'input',
276
+ message: 'Reason for pausing:',
277
+ default: 'Paused to start new work'
278
+ });
279
+
280
+ for (const inc of active) {
281
+ await MetadataManager.pause(inc.id, pauseReason);
282
+ console.log(chalk.green(`✅ Paused ${inc.id}`));
283
+ }
284
+ console.log(chalk.green('\n✅ Proceeding with new increment...\n'));
285
+ } else {
286
+ // choice === 'continue'
287
+ console.log(chalk.yellow('\n⚠️ Starting 2nd increment (20% productivity cost)\n'));
288
+ console.log(chalk.dim('Research: Context switching reduces velocity significantly.\n'));
289
+ }
290
+ }
291
+ }
292
+
293
+ // 6. If activeCount < maxActiveIncrements, no warnings - proceed directly
294
+ if (activeCount === 0) {
295
+ console.log(chalk.green('✅ No active increments. Starting fresh!\n'));
296
+ }
297
+
298
+ // Proceed to Step 1 (find next increment number)
299
+ ```
300
+
301
+ **Example Output - Hard Cap (2 active)**:
302
+ ```
303
+ ❌ HARD CAP REACHED
304
+
305
+ You have 2 active increments (absolute maximum: 2)
306
+
307
+ Active increments:
308
+ • 0005-authentication [feature]
309
+ • 0006-security-hotfix [hotfix]
310
+
311
+ 💡 You MUST complete or pause existing work first:
312
+
313
+ 1️⃣ Complete an increment:
314
+ /done <id>
315
+
316
+ 2️⃣ Pause an increment:
317
+ /pause <id> --reason="..."
318
+
319
+ 3️⃣ Check status:
320
+ /status
321
+
322
+ 📝 Multiple hotfixes? Combine them into ONE increment!
323
+ Example: 0009-security-fixes (SQL + XSS + CSRF)
324
+
325
+ ⛔ This limit is enforced for your productivity.
326
+ Research: 3+ concurrent tasks = 40% slower + more bugs
327
+ ```
328
+
329
+ **Example Output - Soft Warning (1 active, starting 2nd)**:
330
+ ```
331
+ ⚠️ WIP LIMIT REACHED
332
+
333
+ You have 1 active increment(s) (recommended limit: 1)
334
+
335
+ Active increments:
336
+ • 0005-authentication [feature]
337
+
338
+ 🧠 Focus Principle: ONE active increment = maximum productivity
339
+ Starting a 2nd increment reduces focus and velocity.
340
+
341
+ 💡 What would you like to do?
342
+
343
+ 1️⃣ Complete current work (recommended)
344
+ Finish active increment before starting new
345
+
346
+ 2️⃣ Pause current work
347
+ Pause active increment to focus on new work
348
+
349
+ 3️⃣ Start 2nd increment anyway
350
+ Accept productivity cost (20% slower)
351
+
352
+ Choose an option: 1
353
+
354
+ ✅ Smart choice! Finish current work first.
355
+
356
+ Use /do to continue work
357
+ ```
358
+
359
+ **Example Output - Emergency Interrupt (hotfix)**:
360
+ ```
361
+ ⚠️ EMERGENCY INTERRUPT
362
+
363
+ Starting hotfix increment (emergency exception allowed)
364
+
365
+ You have 1 active increment. This will be your 2nd (emergency ceiling).
366
+
367
+ 📋 Active increments:
368
+ • 0005-authentication [feature]
369
+
370
+ 💡 Recommendation: After emergency, complete or pause it before resuming normal work.
371
+
372
+ Proceeding with hotfix 0006...
373
+ ```
374
+
375
+ **Type-Based Limits** (from `TYPE_LIMITS` in `increment-metadata.ts`):
376
+ - **Hotfix**: Unlimited (critical production fixes)
377
+ - **Bug**: Unlimited (production bugs need immediate attention)
378
+ - **Feature**: Max 2 active (standard development)
379
+ - **Change Request**: Max 2 active (stakeholder requests)
380
+ - **Refactor**: Max 1 active (requires focus)
381
+ - **Experiment**: Unlimited (POCs, spikes)
382
+
383
+ **Bypassing Warnings** (not recommended):
384
+ - Users can answer "yes" to continue anyway
385
+ - Hotfixes and bugs bypass context switching warnings (emergency work)
386
+ - Use sparingly - discipline exists for a reason!
387
+
160
388
  ### Step 1: Find next increment number
161
389
 
162
390
  - Scan `.specweave/increments/` directory
@@ -317,10 +545,9 @@ After the increment-planner skill completes, verify:
317
545
  - `.specweave/docs/internal/architecture/adr/` has ADRs
318
546
 
319
547
  2. **Increment files created:**
320
- - `.specweave/increments/####-name/spec.md` (references strategy docs)
321
- - `.specweave/increments/####-name/plan.md` (references architecture docs)
322
- - `.specweave/increments/####-name/tasks.md` (auto-generated from plan)
323
- - `.specweave/increments/####-name/tests.md` (test strategy)
548
+ - `.specweave/increments/####-name/spec.md` (references strategy docs, AC-IDs)
549
+ - `.specweave/increments/####-name/plan.md` (references architecture docs, test strategy)
550
+ - `.specweave/increments/####-name/tasks.md` (implementation + embedded tests in BDD format, v0.7.0+)
324
551
  - `.specweave/increments/####-name/context-manifest.yaml`
325
552
 
326
553
  3. **Hooks executed:**
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: pause
3
+ description: Pause an active increment (blocked by external dependency, deprioritized)
4
+ usage: /specweave:pause <increment-id> --reason="<reason>"
5
+ ---
6
+
7
+ # Pause Increment Command
8
+
9
+ **Usage**: `/specweave:pause <increment-id> --reason="<reason>"`
10
+
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ Pause an active increment when:
16
+ - **Blocked** by external dependency (API keys, approvals, reviews)
17
+ - **Waiting** for another increment to complete
18
+ - **Deprioritized** (will return to later)
19
+ - **Needs discussion** before continuing
20
+
21
+ ---
22
+
23
+ ## Behavior
24
+
25
+ 1. **Validates** increment exists and is "active"
26
+ 2. **Prompts** for reason if not provided via --reason flag
27
+ 3. **Updates** metadata.json:
28
+ - `status`: "active" → "paused"
29
+ - `pausedReason`: User-provided reason
30
+ - `pausedAt`: Current timestamp
31
+ 4. **Displays** confirmation message
32
+ 5. **Suggests** next actions (/resume to continue)
33
+
34
+ ---
35
+
36
+ ## Examples
37
+
38
+ ### Pause with reason
39
+ ```bash
40
+ /pause 0006 --reason="Waiting for Stripe API keys"
41
+
42
+ ✅ Increment 0006 paused
43
+ 📝 Reason: Waiting for Stripe API keys
44
+ ⏸️ No longer counts toward active limit
45
+ 💡 Resume with: /resume 0006
46
+ ```
47
+
48
+ ### Pause without reason (prompts)
49
+ ```bash
50
+ /pause 0006
51
+
52
+ ❓ Why are you pausing this increment?
53
+ 1. Blocked by external dependency
54
+ 2. Waiting for code review
55
+ 3. Deprioritized
56
+ 4. Other (type reason)
57
+
58
+ > 1
59
+
60
+ ✅ Increment 0006 paused
61
+ 📝 Reason: Blocked by external dependency
62
+ 💡 Resume with: /resume 0006
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Edge Cases
68
+
69
+ ### Already Paused
70
+ ```bash
71
+ /pause 0006 --reason="Different reason"
72
+
73
+ ⚠️ Increment 0006 is already paused
74
+ Previous reason: Waiting for Stripe API keys
75
+ New reason: Different reason
76
+
77
+ Update reason? [Y/n]: y
78
+
79
+ ✅ Reason updated
80
+ 📝 New reason: Different reason
81
+ ```
82
+
83
+ ### Cannot Pause Completed
84
+ ```bash
85
+ /pause 0005
86
+
87
+ ❌ Cannot pause increment 0005
88
+ Status: completed
89
+ Completed increments cannot be paused
90
+ ```
91
+
92
+ ### Cannot Pause Abandoned
93
+ ```bash
94
+ /pause 0008
95
+
96
+ ❌ Cannot pause increment 0008
97
+ Status: abandoned
98
+ Resume it first: /resume 0008
99
+ ```
100
+
101
+ ### Increment Not Found
102
+ ```bash
103
+ /pause 9999
104
+
105
+ ❌ Increment not found: 9999
106
+ 💡 Check available increments: /status
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Implementation
112
+
113
+ This command uses the MetadataManager to update increment status:
114
+
115
+ ```typescript
116
+ import { MetadataManager, IncrementStatus } from '../src/core/increment/metadata-manager';
117
+
118
+ // Read current metadata
119
+ const metadata = MetadataManager.read(incrementId);
120
+
121
+ // Validate can pause
122
+ if (metadata.status !== IncrementStatus.ACTIVE) {
123
+ throw new Error(`Cannot pause increment with status: ${metadata.status}`);
124
+ }
125
+
126
+ // Update status
127
+ MetadataManager.updateStatus(incrementId, IncrementStatus.PAUSED, reason);
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Status Flow
133
+
134
+ ```
135
+ active ──pause──> paused
136
+
137
+ └──resume──> active
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Related Commands
143
+
144
+ - `/resume <id>` - Resume paused increment
145
+ - `/abandon <id>` - Abandon increment (permanent)
146
+ - `/status` - Show all increment statuses
147
+
148
+ ---
149
+
150
+ ## Best Practices
151
+
152
+ ✅ **Always provide a reason** - Helps future you remember context
153
+
154
+ ✅ **Review paused increments weekly** - Don't let them pile up
155
+
156
+ ✅ **Set calendar reminder** - For external blockers (API keys, approvals)
157
+
158
+ ✅ **Resume or abandon** - After 7+ days paused
159
+
160
+ ❌ **Don't pause as procrastination** - Address scope/motivation issues instead
161
+
162
+ ❌ **Don't pause to start new work** - Finish current work first (focus)
163
+
164
+ ---
165
+
166
+ ## Warning: Stale Paused Increments
167
+
168
+ Increments paused for **7+ days** trigger warnings in `/status`:
169
+
170
+ ```bash
171
+ /status
172
+
173
+ ⏸️ Paused (1):
174
+ 🔄 0007-stripe-integration [feature]
175
+ Paused: 10 days ago
176
+ Reason: Waiting for Stripe API keys
177
+ ⚠️ STALE! Review or abandon?
178
+
179
+ 💡 Actions:
180
+ /resume 0007 # If unblocked
181
+ /abandon 0007 # If no longer needed
182
+ ```
183
+
184
+ ---
185
+
186
+ **Command**: `/specweave:pause` (or `/pause`)
187
+ **Plugin**: specweave (core)
188
+ **Version**: v0.7.0+
189
+ **Part of**: Increment 0007 - Smart Status Management
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: qa
3
+ description: Run quality assessment on a SpecWeave increment with risk scoring and quality gate decisions
4
+ ---
5
+
6
+ # /qa - Quality Assessment Command
7
+
8
+ **IMPORTANT**: You MUST invoke the CLI `specweave qa` command using the Bash tool. The slash command provides guidance and orchestration only.
9
+
10
+ ## Purpose
11
+
12
+ Run comprehensive quality assessment on an increment using:
13
+ - ✅ Rule-based validation (120 checks)
14
+ - ✅ AI quality assessment (7 dimensions including risk)
15
+ - ✅ BMAD risk scoring (Probability × Impact)
16
+ - ✅ Quality gate decisions (PASS/CONCERNS/FAIL)
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ /qa <increment-id> [options]
22
+ ```
23
+
24
+ ### Examples
25
+
26
+ ```bash
27
+ # Quick mode (default)
28
+ /qa 0008
29
+
30
+ # Pre-implementation check
31
+ /qa 0008 --pre
32
+
33
+ # Quality gate check (comprehensive)
34
+ /qa 0008 --gate
35
+
36
+ # Export blockers to tasks.md
37
+ /qa 0008 --export
38
+
39
+ # CI mode (exit 1 on FAIL)
40
+ /qa 0008 --ci
41
+
42
+ # Skip AI assessment (rule-based only)
43
+ /qa 0008 --no-ai
44
+
45
+ # Force run even if rule-based fails
46
+ /qa 0008 --force
47
+ ```
48
+
49
+ ### Options
50
+
51
+ - `--quick` - Quick mode (default) - Fast assessment with core checks
52
+ - `--pre` - Pre-implementation mode - Check before starting work
53
+ - `--gate` - Quality gate mode - Comprehensive check before closing
54
+ - `--full` - Full multi-agent mode (Phase 3, v0.9.0+)
55
+ - `--ci` - CI mode - Exit 1 on FAIL (for automation)
56
+ - `--no-ai` - Skip AI assessment - Rule-based validation only (free, fast)
57
+ - `--export` - Export blockers/concerns to tasks.md
58
+ - `--force` - Force run even if rule-based validation fails
59
+ - `-v, --verbose` - Show recommendations in addition to blockers/concerns
60
+
61
+ ## What It Does
62
+
63
+ ### Step 1: Rule-Based Validation (Always First, Always Free)
64
+
65
+ The command runs 120+ validation checks on increment files:
66
+ - ✅ File existence (spec.md, plan.md, tasks.md)
67
+ - ✅ YAML frontmatter structure
68
+ - ✅ AC-ID traceability (spec.md → tasks.md)
69
+ - ✅ Link integrity
70
+ - ✅ Format consistency
71
+
72
+ **If rule-based fails** → Stop (don't waste AI tokens) unless `--force` flag used
73
+
74
+ ### Step 2: AI Quality Assessment (Optional, skip with `--no-ai`)
75
+
76
+ Invoke the `increment-quality-judge-v2` skill to evaluate:
77
+ - **7 Dimensions**:
78
+ 1. Clarity (18% weight)
79
+ 2. Testability (22% weight)
80
+ 3. Completeness (18% weight)
81
+ 4. Feasibility (13% weight)
82
+ 5. Maintainability (9% weight)
83
+ 6. Edge Cases (9% weight)
84
+ 7. **Risk Assessment (11% weight)**
85
+
86
+ **Risk Assessment** uses BMAD pattern:
87
+ - Probability (0.0-1.0) × Impact (1-10) = Risk Score (0.0-10.0)
88
+ - 4 categories: Security, Technical, Implementation, Operational
89
+ - Severity: CRITICAL (≥9.0), HIGH (6.0-8.9), MEDIUM (3.0-5.9), LOW (<3.0)
90
+
91
+ ### Step 3: Quality Gate Decision
92
+
93
+ Based on thresholds:
94
+
95
+ **FAIL** if any:
96
+ - Risk score ≥ 9.0 (CRITICAL)
97
+ - Test coverage < 60%
98
+ - Spec quality < 50
99
+ - Critical security vulnerabilities ≥ 1
100
+
101
+ **CONCERNS** if any:
102
+ - Risk score 6.0-8.9 (HIGH)
103
+ - Test coverage < 80%
104
+ - Spec quality < 70
105
+ - High security vulnerabilities ≥ 1
106
+
107
+ **PASS** otherwise
108
+
109
+ ### Step 4: Display Report
110
+
111
+ Show results with:
112
+ - 🟢 PASS / 🟡 CONCERNS / 🔴 FAIL decision
113
+ - Blockers (MUST fix)
114
+ - Concerns (SHOULD fix)
115
+ - Recommendations (NICE to fix, with `--verbose`)
116
+ - Spec quality scores (7 dimensions)
117
+ - Summary (duration, tokens, cost)
118
+
119
+ ### Step 5: Export (Optional)
120
+
121
+ If `--export` flag provided:
122
+ - Append blockers/concerns to tasks.md
123
+ - Add priority (P0 for blockers, P1 for concerns)
124
+ - Include mitigation strategies
125
+
126
+ ## Implementation
127
+
128
+ **When user runs `/qa <increment-id>`**:
129
+
130
+ 1. **Parse arguments**
131
+ ```typescript
132
+ const incrementId = args[0]; // e.g., "0008"
133
+ const options = parseOptions(args.slice(1));
134
+ ```
135
+
136
+ 2. **Invoke CLI command via Bash tool**
137
+ ```bash
138
+ specweave qa 0008 --pre --export
139
+ ```
140
+
141
+ 3. **CLI handles everything**:
142
+ - Rule-based validation
143
+ - AI assessment invocation
144
+ - Quality gate decision
145
+ - Report display
146
+ - Export to tasks.md
147
+
148
+ 4. **Return result to user**
149
+ - Show CLI output (already formatted)
150
+ - Suggest next steps based on decision
151
+
152
+ ## Modes Explained
153
+
154
+ ### Quick Mode (Default)
155
+
156
+ **Use when**: Quick check during development
157
+ **Checks**: Rule-based + AI spec quality + risk assessment
158
+ **Time**: ~30 seconds
159
+ **Cost**: ~$0.025-$0.050
160
+
161
+ ### Pre-Implementation Mode (`--pre`)
162
+
163
+ **Use when**: Before starting increment work
164
+ **Checks**: All quick mode checks + architecture review
165
+ **Time**: ~1 minute
166
+ **Cost**: ~$0.05-$0.10
167
+
168
+ ### Quality Gate Mode (`--gate`)
169
+
170
+ **Use when**: Before closing increment (via `/specweave:done`)
171
+ **Checks**: All pre-implementation checks + test coverage + security audit
172
+ **Time**: ~2-3 minutes
173
+ **Cost**: ~$0.10-$0.20
174
+
175
+ ### Full Multi-Agent Mode (`--full`, Phase 3)
176
+
177
+ **Use when**: Comprehensive audit for critical increments
178
+ **Checks**: 6 specialized subagents in parallel
179
+ **Time**: ~5 minutes
180
+ **Cost**: ~$0.50-$1.00
181
+
182
+ ## Cost Breakdown
183
+
184
+ | Mode | Tokens | Cost (USD) | Time |
185
+ |------|--------|------------|------|
186
+ | Quick | ~2,500 | ~$0.025 | 30s |
187
+ | Pre | ~5,000 | ~$0.050 | 1m |
188
+ | Gate | ~10,000 | ~$0.100 | 2-3m |
189
+ | Full | ~50,000 | ~$0.500 | 5m |
190
+
191
+ **Optimization**: Use Haiku model by default (cheapest, fastest)
192
+
193
+ ## Exit Codes (for CI)
194
+
195
+ When `--ci` flag used:
196
+ - **Exit 0**: PASS or CONCERNS (warning, but not blocking)
197
+ - **Exit 1**: FAIL (blocking issues found)
198
+
199
+ **CI Integration Example**:
200
+ ```yaml
201
+ # .github/workflows/qa-check.yml
202
+ - name: Run QA Check
203
+ run: specweave qa ${{ env.INCREMENT_ID }} --gate --ci
204
+ ```
205
+
206
+ ## Error Handling
207
+
208
+ **Common errors**:
209
+ - ❌ Increment not found → Check ID format (4 digits: 0001, 0008)
210
+ - ❌ Missing files → Run `/specweave:inc` to create increment first
211
+ - ❌ Rule-based fails → Fix validation errors before AI assessment
212
+ - ❌ AI timeout → Retry with `--quick` mode or `--no-ai`
213
+
214
+ ## Integration Points
215
+
216
+ **Auto-invoked by**:
217
+ - `/specweave:done` - Runs `--gate` mode before closing increment
218
+ - Post-task-completion hook (optional) - Runs `--quick` mode after tasks complete
219
+
220
+ **Manual invocation**:
221
+ - During development - `/qa 0008` for quick checks
222
+ - Before commit - `/qa 0008 --pre` to catch issues early
223
+ - Before PR - `/qa 0008 --gate --export` for comprehensive check
224
+
225
+ ## Best Practices
226
+
227
+ 1. **Run early and often** - Use `--quick` during development
228
+ 2. **Fix blockers immediately** - Don't proceed with FAIL decision
229
+ 3. **Address concerns before release** - CONCERNS = should fix
230
+ 4. **Use risk scores to prioritize** - Fix CRITICAL (≥9.0) risks first
231
+ 5. **Export to tasks.md** - Convert blockers/concerns to actionable tasks
232
+ 6. **CI integration** - Block PRs with FAIL decision
233
+
234
+ ## Related
235
+
236
+ - **Skill**: `increment-quality-judge-v2` (7 dimensions with risk assessment)
237
+ - **Command**: `/specweave:done` (auto-runs QA gate)
238
+ - **CLI**: `specweave qa` (direct invocation)
239
+ - **Types**: `src/core/qa/types.ts` (TypeScript definitions)
240
+ - **Tests**: `tests/unit/qa/` (58 test cases, 100% passing)
241
+
242
+ ## Example Session
243
+
244
+ ```
245
+ User: /qa 0008