specweave 0.21.3 β†’ 0.22.2

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 (235) hide show
  1. package/CLAUDE.md +409 -6
  2. package/README.md +38 -8
  3. package/bin/specweave.js +5 -8
  4. package/dist/plugins/specweave-github/lib/CodeValidator.d.ts +101 -0
  5. package/dist/plugins/specweave-github/lib/CodeValidator.d.ts.map +1 -0
  6. package/dist/plugins/specweave-github/lib/CodeValidator.js +219 -0
  7. package/dist/plugins/specweave-github/lib/CodeValidator.js.map +1 -0
  8. package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts +182 -0
  9. package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts.map +1 -0
  10. package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js +603 -0
  11. package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js.map +1 -0
  12. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +10 -0
  13. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
  14. package/dist/plugins/specweave-github/lib/github-client-v2.js +26 -0
  15. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  16. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
  17. package/dist/plugins/specweave-github/lib/task-sync.js +7 -0
  18. package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
  19. package/dist/plugins/specweave-github/lib/types.d.ts +34 -0
  20. package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -1
  21. package/dist/src/cli/commands/init.d.ts.map +1 -1
  22. package/dist/src/cli/commands/init.js +60 -5
  23. package/dist/src/cli/commands/init.js.map +1 -1
  24. package/dist/src/cli/commands/migrate-to-profiles.d.ts +1 -0
  25. package/dist/src/cli/commands/migrate-to-profiles.d.ts.map +1 -1
  26. package/dist/src/cli/commands/migrate-to-profiles.js +12 -1
  27. package/dist/src/cli/commands/migrate-to-profiles.js.map +1 -1
  28. package/dist/src/cli/commands/next-command.d.ts +52 -0
  29. package/dist/src/cli/commands/next-command.d.ts.map +1 -0
  30. package/dist/src/cli/commands/next-command.js +204 -0
  31. package/dist/src/cli/commands/next-command.js.map +1 -0
  32. package/dist/src/cli/commands/sync-specs.d.ts +16 -0
  33. package/dist/src/cli/commands/sync-specs.d.ts.map +1 -0
  34. package/dist/src/cli/commands/sync-specs.js +130 -0
  35. package/dist/src/cli/commands/sync-specs.js.map +1 -0
  36. package/dist/src/cli/count-tasks.d.ts +20 -0
  37. package/dist/src/cli/count-tasks.d.ts.map +1 -0
  38. package/dist/src/cli/count-tasks.js +50 -0
  39. package/dist/src/cli/count-tasks.js.map +1 -0
  40. package/dist/src/config/ConfigManager.d.ts.map +1 -1
  41. package/dist/src/config/ConfigManager.js +2 -1
  42. package/dist/src/config/ConfigManager.js.map +1 -1
  43. package/dist/src/config/types.d.ts +58 -58
  44. package/dist/src/core/cicd/state-manager.d.ts +8 -0
  45. package/dist/src/core/cicd/state-manager.d.ts.map +1 -1
  46. package/dist/src/core/cicd/state-manager.js +60 -15
  47. package/dist/src/core/cicd/state-manager.js.map +1 -1
  48. package/dist/src/core/cost-tracker.d.ts.map +1 -1
  49. package/dist/src/core/cost-tracker.js +2 -1
  50. package/dist/src/core/cost-tracker.js.map +1 -1
  51. package/dist/src/core/iac/template-engine.d.ts.map +1 -1
  52. package/dist/src/core/iac/template-engine.js +28 -0
  53. package/dist/src/core/iac/template-engine.js.map +1 -1
  54. package/dist/src/core/iac/template-generator.d.ts +53 -0
  55. package/dist/src/core/iac/template-generator.d.ts.map +1 -0
  56. package/dist/src/core/iac/template-generator.js +125 -0
  57. package/dist/src/core/iac/template-generator.js.map +1 -0
  58. package/dist/src/core/increment/status-auto-transition.js +3 -3
  59. package/dist/src/core/increment/status-auto-transition.js.map +1 -1
  60. package/dist/src/core/living-docs/CodeValidator.js +1 -1
  61. package/dist/src/core/living-docs/CodeValidator.js.map +1 -1
  62. package/dist/src/core/living-docs/CompletionPropagator.d.ts.map +1 -1
  63. package/dist/src/core/living-docs/CompletionPropagator.js +4 -3
  64. package/dist/src/core/living-docs/CompletionPropagator.js.map +1 -1
  65. package/dist/src/core/living-docs/SpecDistributor.d.ts +5 -0
  66. package/dist/src/core/living-docs/SpecDistributor.d.ts.map +1 -1
  67. package/dist/src/core/living-docs/SpecDistributor.js +12 -0
  68. package/dist/src/core/living-docs/SpecDistributor.js.map +1 -1
  69. package/dist/src/core/living-docs/content-distributor.d.ts.map +1 -1
  70. package/dist/src/core/living-docs/content-distributor.js +11 -1
  71. package/dist/src/core/living-docs/content-distributor.js.map +1 -1
  72. package/dist/src/core/living-docs/living-docs-sync.d.ts +166 -0
  73. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -0
  74. package/dist/src/core/living-docs/living-docs-sync.js +726 -0
  75. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -0
  76. package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
  77. package/dist/src/core/living-docs/project-detector.js +38 -0
  78. package/dist/src/core/living-docs/project-detector.js.map +1 -1
  79. package/dist/src/core/living-docs/task-project-specific-generator.d.ts +7 -3
  80. package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -1
  81. package/dist/src/core/living-docs/task-project-specific-generator.js +40 -24
  82. package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -1
  83. package/dist/src/core/plugin-loader.d.ts +7 -0
  84. package/dist/src/core/plugin-loader.d.ts.map +1 -1
  85. package/dist/src/core/plugin-loader.js +18 -1
  86. package/dist/src/core/plugin-loader.js.map +1 -1
  87. package/dist/src/core/serverless/platform-data-loader.d.ts +8 -0
  88. package/dist/src/core/serverless/platform-data-loader.d.ts.map +1 -1
  89. package/dist/src/core/serverless/platform-data-loader.js +14 -0
  90. package/dist/src/core/serverless/platform-data-loader.js.map +1 -1
  91. package/dist/src/core/serverless/types.d.ts +1 -1
  92. package/dist/src/core/serverless/types.d.ts.map +1 -1
  93. package/dist/src/core/status-line/status-line-manager.d.ts +6 -2
  94. package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
  95. package/dist/src/core/status-line/status-line-manager.js +11 -5
  96. package/dist/src/core/status-line/status-line-manager.js.map +1 -1
  97. package/dist/src/core/status-line/task-counter.d.ts +69 -0
  98. package/dist/src/core/status-line/task-counter.d.ts.map +1 -0
  99. package/dist/src/core/status-line/task-counter.js +107 -0
  100. package/dist/src/core/status-line/task-counter.js.map +1 -0
  101. package/dist/src/core/types/config.d.ts +23 -0
  102. package/dist/src/core/types/config.d.ts.map +1 -1
  103. package/dist/src/core/types/config.js +10 -0
  104. package/dist/src/core/types/config.js.map +1 -1
  105. package/dist/src/core/workflow/autonomous-executor.d.ts +111 -0
  106. package/dist/src/core/workflow/autonomous-executor.d.ts.map +1 -0
  107. package/dist/src/core/workflow/autonomous-executor.js +275 -0
  108. package/dist/src/core/workflow/autonomous-executor.js.map +1 -0
  109. package/dist/src/core/workflow/backlog-scanner.d.ts +94 -0
  110. package/dist/src/core/workflow/backlog-scanner.d.ts.map +1 -0
  111. package/dist/src/core/workflow/backlog-scanner.js +170 -0
  112. package/dist/src/core/workflow/backlog-scanner.js.map +1 -0
  113. package/dist/src/core/workflow/command-invoker.d.ts +86 -0
  114. package/dist/src/core/workflow/command-invoker.d.ts.map +1 -0
  115. package/dist/src/core/workflow/command-invoker.js +131 -0
  116. package/dist/src/core/workflow/command-invoker.js.map +1 -0
  117. package/dist/src/core/workflow/cost-estimator.d.ts +120 -0
  118. package/dist/src/core/workflow/cost-estimator.d.ts.map +1 -0
  119. package/dist/src/core/workflow/cost-estimator.js +222 -0
  120. package/dist/src/core/workflow/cost-estimator.js.map +1 -0
  121. package/dist/src/core/workflow/index.d.ts +20 -0
  122. package/dist/src/core/workflow/index.d.ts.map +1 -0
  123. package/dist/src/core/workflow/index.js +24 -0
  124. package/dist/src/core/workflow/index.js.map +1 -0
  125. package/dist/src/core/workflow/state-manager.d.ts +107 -0
  126. package/dist/src/core/workflow/state-manager.d.ts.map +1 -0
  127. package/dist/src/core/workflow/state-manager.js +126 -0
  128. package/dist/src/core/workflow/state-manager.js.map +1 -0
  129. package/dist/src/core/workflow/workflow-orchestrator.d.ts +93 -0
  130. package/dist/src/core/workflow/workflow-orchestrator.d.ts.map +1 -0
  131. package/dist/src/core/workflow/workflow-orchestrator.js +195 -0
  132. package/dist/src/core/workflow/workflow-orchestrator.js.map +1 -0
  133. package/dist/src/init/ArchitecturePresenter.d.ts +47 -0
  134. package/dist/src/init/ArchitecturePresenter.d.ts.map +1 -0
  135. package/dist/src/init/ArchitecturePresenter.js +180 -0
  136. package/dist/src/init/ArchitecturePresenter.js.map +1 -0
  137. package/dist/src/init/InitFlow.d.ts.map +1 -1
  138. package/dist/src/init/InitFlow.js +30 -1
  139. package/dist/src/init/InitFlow.js.map +1 -1
  140. package/dist/src/init/architecture/CostEstimator.d.ts +52 -0
  141. package/dist/src/init/architecture/CostEstimator.d.ts.map +1 -0
  142. package/dist/src/init/architecture/CostEstimator.js +107 -0
  143. package/dist/src/init/architecture/CostEstimator.js.map +1 -0
  144. package/dist/src/init/architecture/InfrastructureMapper.d.ts +41 -0
  145. package/dist/src/init/architecture/InfrastructureMapper.d.ts.map +1 -0
  146. package/dist/src/init/architecture/InfrastructureMapper.js +140 -0
  147. package/dist/src/init/architecture/InfrastructureMapper.js.map +1 -0
  148. package/dist/src/init/architecture/ProjectGenerator.d.ts +44 -0
  149. package/dist/src/init/architecture/ProjectGenerator.d.ts.map +1 -0
  150. package/dist/src/init/architecture/ProjectGenerator.js +216 -0
  151. package/dist/src/init/architecture/ProjectGenerator.js.map +1 -0
  152. package/dist/src/init/architecture/types.d.ts +10 -10
  153. package/dist/src/init/research/src/config/types.d.ts +8 -8
  154. package/dist/src/metrics/dora-calculator.js +2 -2
  155. package/dist/src/metrics/dora-calculator.js.map +1 -1
  156. package/dist/src/utils/pricing-constants.d.ts +5 -2
  157. package/dist/src/utils/pricing-constants.d.ts.map +1 -1
  158. package/dist/src/utils/pricing-constants.js +3 -2
  159. package/dist/src/utils/pricing-constants.js.map +1 -1
  160. package/package.json +9 -8
  161. package/plugins/specweave/agents/infrastructure/AGENT.md +88 -46
  162. package/plugins/specweave/agents/pm/AGENT.md +58 -1
  163. package/plugins/specweave/commands/specweave-archive-features.md +1 -1
  164. package/plugins/specweave/commands/specweave-archive-increments.md +1 -1
  165. package/plugins/specweave/commands/specweave-check-hooks.md +5 -0
  166. package/plugins/specweave/commands/specweave-done.md +12 -0
  167. package/plugins/specweave/commands/specweave-plan.md +1 -1
  168. package/plugins/specweave/commands/specweave-progress.md +108 -379
  169. package/plugins/specweave/commands/specweave-reopen.md +1 -1
  170. package/plugins/specweave/commands/specweave-restore-feature.md +1 -1
  171. package/plugins/specweave/commands/specweave-sync-specs.md +20 -48
  172. package/plugins/specweave/hooks/lib/update-status-line.sh +44 -35
  173. package/plugins/specweave/hooks/lib/validate-spec-status.sh +163 -0
  174. package/plugins/specweave/hooks/user-prompt-submit.sh +17 -35
  175. package/plugins/specweave/lib/hooks/update-tasks-md.js +52 -9
  176. package/plugins/specweave/lib/hooks/update-tasks-md.ts +77 -16
  177. package/plugins/specweave/templates/iac/aws-lambda/defaults.json +24 -0
  178. package/plugins/specweave/templates/iac/aws-lambda/templates/README.md.hbs +260 -0
  179. package/plugins/specweave/templates/iac/aws-lambda/templates/environments/dev.tfvars.hbs +34 -0
  180. package/plugins/specweave/templates/iac/aws-lambda/templates/environments/prod.tfvars.hbs +37 -0
  181. package/plugins/specweave/templates/iac/aws-lambda/templates/environments/staging.tfvars.hbs +35 -0
  182. package/plugins/specweave/templates/iac/aws-lambda/templates/outputs.tf.hbs +77 -0
  183. package/plugins/specweave/templates/iac/aws-lambda/templates/providers.tf.hbs +36 -0
  184. package/plugins/specweave/templates/iac/aws-lambda/templates/variables.tf.hbs +115 -0
  185. package/plugins/specweave/templates/iac/azure-functions/defaults.json +25 -0
  186. package/plugins/specweave/templates/iac/azure-functions/templates/README.md.hbs +268 -0
  187. package/plugins/specweave/templates/iac/azure-functions/templates/environments/dev.tfvars.hbs +34 -0
  188. package/plugins/specweave/templates/iac/azure-functions/templates/environments/prod.tfvars.hbs +46 -0
  189. package/plugins/specweave/templates/iac/azure-functions/templates/environments/staging.tfvars.hbs +34 -0
  190. package/plugins/specweave/templates/iac/azure-functions/templates/main.tf.hbs +225 -0
  191. package/plugins/specweave/templates/iac/azure-functions/templates/outputs.tf.hbs +89 -0
  192. package/plugins/specweave/templates/iac/azure-functions/templates/provider.tf.hbs +27 -0
  193. package/plugins/specweave/templates/iac/azure-functions/templates/providers.tf.hbs +35 -0
  194. package/plugins/specweave/templates/iac/azure-functions/templates/variables.tf.hbs +124 -0
  195. package/plugins/specweave/templates/iac/firebase/defaults.json +29 -0
  196. package/plugins/specweave/templates/iac/firebase/templates/README.md.hbs +35 -0
  197. package/plugins/specweave/templates/iac/firebase/templates/environments/dev.tfvars.hbs +7 -0
  198. package/plugins/specweave/templates/iac/firebase/templates/environments/prod.tfvars.hbs +7 -0
  199. package/plugins/specweave/templates/iac/firebase/templates/environments/staging.tfvars.hbs +7 -0
  200. package/plugins/specweave/templates/iac/firebase/templates/main.tf.hbs +90 -0
  201. package/plugins/specweave/templates/iac/firebase/templates/outputs.tf.hbs +15 -0
  202. package/plugins/specweave/templates/iac/firebase/templates/providers.tf.hbs +23 -0
  203. package/plugins/specweave/templates/iac/firebase/templates/variables.tf.hbs +42 -0
  204. package/plugins/specweave/templates/iac/gcp-cloud-functions/defaults.json +26 -0
  205. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/README.md.hbs +299 -0
  206. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/dev.tfvars.hbs +36 -0
  207. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/prod.tfvars.hbs +48 -0
  208. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/staging.tfvars.hbs +41 -0
  209. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/main.tf.hbs +192 -0
  210. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/outputs.tf.hbs +66 -0
  211. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/providers.tf.hbs +25 -0
  212. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/variables.tf.hbs +119 -0
  213. package/plugins/specweave/templates/iac/supabase/defaults.json +15 -0
  214. package/plugins/specweave/templates/iac/supabase/templates/README.md.hbs +46 -0
  215. package/plugins/specweave/templates/iac/supabase/templates/main.tf.hbs +50 -0
  216. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
  217. package/plugins/specweave-github/agents/github-manager/AGENT.md +39 -7
  218. package/plugins/specweave-github/commands/specweave-github-create-issue.md +5 -5
  219. package/plugins/specweave-github/lib/CodeValidator.js +195 -0
  220. package/plugins/specweave-github/lib/CodeValidator.ts +284 -0
  221. package/plugins/specweave-github/lib/ThreeLayerSyncManager.js +545 -0
  222. package/plugins/specweave-github/lib/ThreeLayerSyncManager.ts +809 -0
  223. package/plugins/specweave-github/lib/github-client-v2.js +29 -0
  224. package/plugins/specweave-github/lib/github-client-v2.ts +30 -0
  225. package/plugins/specweave-github/lib/task-sync.js +4 -0
  226. package/plugins/specweave-github/lib/task-sync.ts +7 -0
  227. package/plugins/specweave-github/lib/types.ts +38 -0
  228. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
  229. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +3222 -0
  230. package/src/templates/AGENTS.md.template +22 -1
  231. package/src/templates/CLAUDE.md.template +31 -0
  232. package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts +0 -116
  233. package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts.map +0 -1
  234. package/dist/src/core/living-docs/ThreeLayerSyncManager.js +0 -356
  235. package/dist/src/core/living-docs/ThreeLayerSyncManager.js.map +0 -1
package/CLAUDE.md CHANGED
@@ -24,21 +24,23 @@ Users receive a different CLAUDE.md via the template system.
24
24
  /SESSION-SUMMARY-2025-10-28.md # NO! Goes to increment reports/
25
25
  /ADR-006-DEEP-ANALYSIS.md # NO! Goes to .specweave/docs/internal/architecture/adr/
26
26
  /ANALYSIS-MULTI-TOOL-COMPARISON.md # NO! Goes to increment reports/
27
+ /QUICK-START.md # NO! Goes to increment reports/
27
28
  /migration-helper.sh # NO! Goes to increment scripts/
28
29
  /execution.log # NO! Goes to increment logs/
29
30
 
30
31
  βœ… CORRECT - INCREMENT FOLDERS:
31
32
  .specweave/increments/0004-plugin-architecture/
32
- β”œβ”€β”€ spec.md # Spec files (core 3)
33
+ β”œβ”€β”€ spec.md # ⚠️ ONLY THESE 3 FILES in root!
33
34
  β”œβ”€β”€ plan.md
34
35
  β”œβ”€β”€ tasks.md # Tasks with embedded tests
35
- β”œβ”€β”€ reports/ # βœ… PUT REPORTS HERE!
36
+ β”œβ”€β”€ reports/ # βœ… ALL REPORTS HERE!
36
37
  β”‚ β”œβ”€β”€ PLUGIN-MIGRATION-COMPLETE.md # βœ… Completion reports
37
38
  β”‚ β”œβ”€β”€ SESSION-SUMMARY.md # βœ… Session summaries
39
+ β”‚ β”œβ”€β”€ QUICK-START.md # βœ… Quick start guides
38
40
  β”‚ └── ANALYSIS-*.md # βœ… Analysis files
39
- β”œβ”€β”€ scripts/ # βœ… PUT SCRIPTS HERE!
41
+ β”œβ”€β”€ scripts/ # βœ… ALL SCRIPTS HERE!
40
42
  β”‚ └── migration-helper.sh # βœ… Helper scripts
41
- └── logs/ # βœ… PUT LOGS HERE!
43
+ └── logs/ # βœ… ALL LOGS HERE!
42
44
  └── execution.log # βœ… Execution logs
43
45
 
44
46
  .specweave/docs/internal/architecture/ # βœ… PUT ADRS/DIAGRAMS HERE!
@@ -48,6 +50,215 @@ Users receive a different CLAUDE.md via the template system.
48
50
 
49
51
  **Before committing, ALWAYS check**: `git status` - If you see `.md` files in root, MOVE THEM!
50
52
 
53
+ ### πŸ“ Increment Structure Rules (MANDATORY)
54
+
55
+ **ONLY 3 files allowed in increment root**:
56
+ 1. βœ… `spec.md` - Specification
57
+ 2. βœ… `plan.md` - Implementation plan
58
+ 3. βœ… `tasks.md` - Tasks with embedded tests
59
+
60
+ **Everything else MUST be in subfolders**:
61
+ - `reports/` - Session summaries, completion reports, analysis files, quick-start guides
62
+ - `scripts/` - Helper scripts, migrations, utilities
63
+ - `logs/` - Execution logs, debug output, temp files
64
+
65
+ **Examples of files that belong in subfolders**:
66
+ - `QUICK-START.md` β†’ `reports/QUICK-START.md`
67
+ - `SESSION-NOTES.md` β†’ `reports/SESSION-NOTES.md`
68
+ - `ULTRATHINK-*.md` β†’ `reports/ULTRATHINK-*.md`
69
+ - `validation.sh` β†’ `scripts/validation.sh`
70
+ - `debug.log` β†’ `logs/debug.log`
71
+
72
+ **Why this matters**:
73
+ - βœ… Clean, predictable structure
74
+ - βœ… Easy to find files by type
75
+ - βœ… No increment root clutter
76
+ - βœ… Consistent across all increments
77
+
78
+ ---
79
+
80
+ ## πŸ›‘οΈ CRITICAL: NEVER DELETE .specweave/ DIRECTORIES!
81
+
82
+ **β›” MASS DELETION PROTECTION IS ACTIVE β›”**
83
+
84
+ **PROTECTED DIRECTORIES**:
85
+ - `.specweave/docs/` - All project documentation (internal + public)
86
+ - `.specweave/increments/` - All increment history and specifications
87
+
88
+ **WHAT THIS MEANS**:
89
+ - ❌ **NEVER** run `rm -rf .specweave/docs` or `rm -rf .specweave/increments`
90
+ - ❌ **NEVER** delete more than 50 files in these directories at once
91
+ - βœ… Pre-commit hook will **BLOCK** accidental mass deletions
92
+ - βœ… If intentional, bypass with `git commit --no-verify`
93
+
94
+ **WHY THIS EXISTS**:
95
+ On 2025-11-17, an accidental mass deletion occurred (1,200+ files). All files were recovered via `git restore`, but this protection prevents future incidents.
96
+
97
+ **IF YOU ACCIDENTALLY DELETE**:
98
+ ```bash
99
+ # Immediately restore:
100
+ git restore .specweave/
101
+
102
+ # Verify restoration:
103
+ git status
104
+ ```
105
+
106
+ **See**: `.specweave/increments/0039/reports/ACCIDENTAL-DELETION-RECOVERY-2025-11-17.md`
107
+
108
+ ---
109
+
110
+ ## 🚨 CRITICAL: DANGEROUS TEST CLEANUP OPERATIONS!
111
+
112
+ **β›” WARNING: Test cleanup can cause CATASTROPHIC deletion β›”**
113
+
114
+ **INCIDENT**: On 2025-11-18, during increment 0042 (test infrastructure cleanup), a bash command nearly deleted the entire `tests/integration/` directory (209 test files). The command failed due to working directory confusion, but demonstrated the EXACT catastrophic risk identified in ultrathink analysis.
115
+
116
+ **THE DANGER**:
117
+ ```bash
118
+ # ❌ EXTREMELY DANGEROUS (can delete entire test suite):
119
+ cd tests/integration
120
+ find . -maxdepth 1 -type d ... -exec rm -rf {} +
121
+ # Risk: Working directory confusion + no confirmation = catastrophic deletion
122
+
123
+ # ❌ DANGEROUS (no verification):
124
+ find tests/integration -type d -exec rm -rf {} +
125
+ # Risk: Too broad, deletes everything
126
+
127
+ # ❌ DANGEROUS (assumes pwd):
128
+ rm -rf tests/integration/*/
129
+ # Risk: If pwd is wrong, deletes unintended directories
130
+ ```
131
+
132
+ **SAFE APPROACH** (MANDATORY for test cleanup):
133
+ ```bash
134
+ # βœ… STEP 1: Verify working directory (ALWAYS FIRST!)
135
+ pwd
136
+ # Must output: /Users/antonabyzov/Projects/github/specweave
137
+
138
+ # βœ… STEP 2: DRY RUN (list only, NO deletion)
139
+ find tests/integration -maxdepth 1 -type d \
140
+ ! -name "integration" \
141
+ ! -name "core" ! -name "features" ! -name "external-tools" ! -name "generators" \
142
+ -print
143
+ # Review output MANUALLY before proceeding
144
+
145
+ # βœ… STEP 3: Count directories to delete
146
+ find tests/integration -maxdepth 1 -type d \
147
+ ! -name "integration" \
148
+ ! -name "core" ! -name "features" ! -name "external-tools" ! -name "generators" \
149
+ -print | wc -l
150
+ # Verify count matches expectations
151
+
152
+ # βœ… STEP 4: Manual confirmation (REQUIRED)
153
+ echo "About to delete XX directories. Type 'DELETE' to confirm:"
154
+ read confirmation
155
+ if [ "$confirmation" != "DELETE" ]; then
156
+ echo "Cancelled"
157
+ exit 1
158
+ fi
159
+
160
+ # βœ… STEP 5: Execute deletion (ONLY after all checks pass)
161
+ find tests/integration -maxdepth 1 -type d \
162
+ ! -name "integration" \
163
+ ! -name "core" ! -name "features" ! -name "external-tools" ! -name "generators" \
164
+ -exec rm -rf {} +
165
+
166
+ # βœ… STEP 6: Verify results
167
+ ls tests/integration/
168
+ find tests/integration -name "*.test.ts" | wc -l
169
+
170
+ # βœ… STEP 7: Run tests (MANDATORY)
171
+ npm run test:integration
172
+ ```
173
+
174
+ **MANDATORY SAFETY RULES**:
175
+ 1. βœ… **ALWAYS** verify `pwd` before ANY deletion command
176
+ 2. βœ… **ALWAYS** use dry-run (`-print`) before `-exec rm`
177
+ 3. βœ… **ALWAYS** count directories/files before deletion
178
+ 4. βœ… **ALWAYS** require manual confirmation for deletion
179
+ 5. βœ… **ALWAYS** verify results after deletion
180
+ 6. βœ… **ALWAYS** run tests after structural changes
181
+ 7. βœ… **NEVER** use `rm -rf` without multiple safety checks
182
+
183
+ **WHY THIS MATTERS**:
184
+ - πŸ”΄ One wrong command = entire test suite deleted
185
+ - πŸ”΄ 213 unsafe `process.cwd()` patterns exist in tests (increment 0042 audit)
186
+ - πŸ”΄ Working directory confusion is COMMON
187
+ - πŸ”΄ Recovery requires git restore (assumes uncommitted changes)
188
+ - πŸ”΄ If changes committed, recovery requires time-consuming rollback
189
+
190
+ **LESSONS FROM INCIDENT 0042**:
191
+ 1. **Dry-run is NOT optional** - Always list before deleting
192
+ 2. **Working directory matters** - Verify pwd FIRST
193
+ 3. **Confirmation prevents accidents** - Require manual "DELETE" confirmation
194
+ 4. **Test after changes** - Structural changes can break tests
195
+ 5. **Incremental commits** - Commit after each phase (easier rollback)
196
+
197
+ **IF CATASTROPHIC DELETION OCCURS**:
198
+ ```bash
199
+ # Immediately restore from git (if not committed):
200
+ git restore tests/
201
+
202
+ # If committed, restore from previous commit:
203
+ git log --oneline -- tests/
204
+ git checkout <previous-commit-hash> -- tests/
205
+
206
+ # Verify restoration:
207
+ find tests -name "*.test.ts" | wc -l
208
+ npm run test:all
209
+ ```
210
+
211
+ **REFERENCES**:
212
+ - Incident report: `.specweave/increments/0042-test-infrastructure-cleanup/reports/CATASTROPHIC-DELETION-INCIDENT-2025-11-18.md`
213
+ - Ultrathink analysis: `.specweave/increments/0041-living-docs-test-fixes/reports/ULTRATHINK-TEST-DUPLICATION-ANALYSIS-2025-11-18.md`
214
+ - Safe cleanup approach: Increment 0042 Phase 1 tasks
215
+
216
+ **NEVER delete test directories without following ALL safety steps above!**
217
+
218
+ ---
219
+
220
+ ## ⚠️ CRITICAL: NEVER USE `specweave init . --force` FOR REINSTALLS!
221
+
222
+ **β›” COMMON MISTAKE THAT DELETES ALL DATA β›”**
223
+
224
+ **THE DANGER**:
225
+ ```bash
226
+ # ❌ DANGEROUS (deletes ALL increments and docs):
227
+ specweave init . --force
228
+
229
+ # What --force actually does:
230
+ # 1. Skips all confirmation prompts
231
+ # 2. AUTOMATICALLY DELETES .specweave/ entirely
232
+ # 3. Loses all increments, docs, and history
233
+ # 4. No backup unless you create one manually
234
+ ```
235
+
236
+ **SAFE ALTERNATIVES**:
237
+ ```bash
238
+ # βœ… SAFE - Update files, keep all data:
239
+ specweave init .
240
+ # When prompted, select: "Continue working"
241
+
242
+ # βœ… SAFE - Always interactive, never deletes:
243
+ npx specweave init .
244
+ ```
245
+
246
+ **WHY THIS MATTERS**:
247
+ - Documentation used to recommend `--force` for troubleshooting (FIXED in v0.21.4+)
248
+ - Users followed the docs and lost all their work
249
+ - Now `--force` has multiple safeguards:
250
+ - ⚠️ BIG RED WARNING before deletion
251
+ - βœ… ALWAYS requires confirmation (even in force mode)
252
+ - πŸ“¦ Automatic backup created before deletion
253
+ - πŸ”’ Pre-commit hook blocks accidental commits
254
+
255
+ **IF YOU NEED A FRESH START**:
256
+ 1. Backup first: `cp -r .specweave .specweave.backup-$(date +%Y%m%d)`
257
+ 2. Run: `specweave init .` (select "Fresh start" option)
258
+ 3. Or: `specweave init . --force` (requires confirmation + creates auto-backup)
259
+
260
+ **NEVER use `--force` unless you want to DELETE EVERYTHING!**
261
+
51
262
  ---
52
263
 
53
264
  ## Tool Support
@@ -353,12 +564,204 @@ npm run build # Compile TypeScript
353
564
 
354
565
  ### Testing
355
566
 
567
+ **Test Framework**: **Vitest** (migrated from Jest on 2025-11-17)
568
+
356
569
  ```bash
357
- npm test # Unit tests
358
- npm run test:integration # Integration tests (includes build verification)
570
+ npm test # Smoke tests (quick validation)
571
+ npm run test:unit # Unit tests with Vitest
572
+ npm run test:integration # Integration tests with Vitest
359
573
  npm run test:e2e # E2E tests (Playwright)
574
+ npm run test:all # All tests
575
+ npm run test:coverage # Coverage report
576
+ ```
577
+
578
+ **Why Vitest?**
579
+ - βœ… ESM-native (no tsconfig hacks)
580
+ - βœ… Faster than Jest
581
+ - βœ… Better TypeScript integration
582
+ - βœ… Native import.meta.url support
583
+ - βœ… Modern, actively maintained
584
+
585
+ **Test Organization** (4 categories):
586
+ - `tests/unit/` - Pure logic tests (no I/O) - **Vitest**
587
+ - `tests/plugin-validation/` - Plugin structure contracts
588
+ - `tests/integration/` - 4 semantic categories - **Vitest**:
589
+ - `external-tools/` - GitHub, JIRA, ADO, Kafka sync
590
+ - `core/` - Core framework + workflows
591
+ - `generators/` - Code generation (frontend, backend, ML)
592
+ - `features/` - Feature plugins (Figma, i18n, diagrams, etc.)
593
+ - `tests/e2e/` - Full user scenarios - **Playwright**
594
+
595
+ **Test Naming Convention** (standardized 2025-11-18):
596
+ - βœ… ALL tests use `.test.ts` extension (unit, integration, E2E)
597
+ - ❌ NEVER use `.spec.ts` extension (deprecated)
598
+ - **Why**: Consistent glob patterns, simpler test discovery, aligned with Vitest conventions
599
+
600
+ **Writing Tests**:
601
+ ```typescript
602
+ // Import from vitest (NOT jest)
603
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
604
+
605
+ // Mocking
606
+ vi.mock('fs/promises');
607
+ const mockFn = vi.fn();
608
+ vi.clearAllMocks();
609
+ ```
610
+
611
+ **Details**: `.specweave/docs/internal/architecture/TEST-ORGANIZATION-PROPOSAL.md`
612
+
613
+ ### Test Isolation (CRITICAL - Prevents .specweave/ Deletion!)
614
+
615
+ **🚨 MANDATORY FOR ALL TESTS creating .specweave/ structures:**
616
+
617
+ **THE PROBLEM**: Tests using `process.cwd()` can accidentally delete the project `.specweave/` folder containing all your work!
618
+
619
+ **CORRECT PATTERN** (ALWAYS use this):
620
+ ```typescript
621
+ import * as os from 'os';
622
+ import * as path from 'path';
623
+
624
+ // βœ… SAFE: Uses isolated temp directory
625
+ const testRoot = path.join(os.tmpdir(), 'test-name-' + Date.now());
626
+ ```
627
+
628
+ **DANGEROUS PATTERN** (NEVER use this):
629
+ ```typescript
630
+ // ❌ DANGER: Creates directories in project root!
631
+ const testRoot = path.join(process.cwd(), '.test-something');
632
+ const testPath = path.join(__dirname, '..', '.specweave', 'increments');
360
633
  ```
361
634
 
635
+ ### Vitest Mock Best Practices
636
+
637
+ **🚨 MANDATORY FOR ALL TESTS using mocks:**
638
+
639
+ **CORRECT PATTERN** (vi.mocked() for type-safe mocks):
640
+ ```typescript
641
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
642
+ import fs from 'fs-extra';
643
+
644
+ // Mock fs-extra BEFORE using it
645
+ vi.mock('fs-extra');
646
+
647
+ // Type-safe mocked functions
648
+ const mockReadFile = vi.mocked(fs.readFile);
649
+ const mockWriteFile = vi.mocked(fs.writeFile);
650
+ const mockExistsSync = vi.mocked(fs.existsSync);
651
+
652
+ beforeEach(() => {
653
+ vi.clearAllMocks();
654
+ mockExistsSync.mockReturnValue(true);
655
+ mockReadFile.mockResolvedValue('content');
656
+ });
657
+ ```
658
+
659
+ **DANGEROUS PATTERN** (NEVER use this):
660
+ ```typescript
661
+ // ❌ WRONG: Invalid anyed<> syntax (pre-Vitest migration)
662
+ const mockFs = fs as anyed<typeof fs> & {
663
+ readFile: anyedFunction<typeof fs.readFile>;
664
+ };
665
+ // This causes TypeScript errors and test failures!
666
+ ```
667
+
668
+ **Why This Matters**:
669
+ 1. `vi.mocked()` provides full type safety
670
+ 2. Catches mock setup errors at compile time
671
+ 3. Works correctly with Vitest's mock system
672
+ 4. Prevents runtime "Cannot read properties of undefined" errors
673
+
674
+ **Common Mock Gotchas**:
675
+ - Always call `vi.clearAllMocks()` in beforeEach
676
+ - Use `mockResolvedValue` for async functions
677
+ - Use `mockReturnValue` for sync functions
678
+ - Check that mocks are actually called: `expect(mockFn).toHaveBeenCalled()`
679
+
680
+ ### Testing Best Practices & Anti-Patterns
681
+
682
+ **Lessons from fixing 72+ test failures (2025-11-17 Vitest migration)**
683
+
684
+ #### Critical Rules (Will Fail Tests)
685
+
686
+ ```typescript
687
+ // ❌ WRONG // βœ… CORRECT
688
+ require('../src/module') import { Module } from '../src/module.js'
689
+ jest.fn() vi.fn()
690
+ jest.mock() vi.mock()
691
+ fs as anyed<typeof fs> vi.mocked(fs.readFile)
692
+ const mock = vi.fn() vi.mock('mod', () => ({
693
+ vi.mock('mod', () => ({ mock })) method: vi.fn() // inline!
694
+ }))
695
+ mockReadJson.mockResolvedValue(arr) mockReadJson.mockResolvedValue([...arr]) // copy!
696
+ ```
697
+
698
+ #### Quick Template
699
+
700
+ ```typescript
701
+ import { describe, it, expect, vi } from 'vitest';
702
+ vi.mock('fs-extra', () => ({ default: { readFile: vi.fn() } }));
703
+ import fs from 'fs-extra';
704
+
705
+ describe('Feature', () => {
706
+ const mockReadFile = vi.mocked(fs.readFile);
707
+
708
+ beforeEach(() => {
709
+ vi.clearAllMocks();
710
+ mockReadFile.mockResolvedValue('data');
711
+ });
712
+
713
+ it('works', async () => {
714
+ const result = await MyModule.doSomething();
715
+ expect(mockReadFile).toHaveBeenCalled();
716
+ });
717
+ });
718
+ ```
719
+
720
+ #### Pre-Commit Checklist
721
+
722
+ - [ ] ES6 imports (NOT require())
723
+ - [ ] vi.* APIs (NOT jest.*)
724
+ - [ ] vi.mocked() for mocks (NOT anyed<>)
725
+ - [ ] Inline mock factories (NO external variables)
726
+ - [ ] Array copies in mocks (NO shared references)
727
+ - [ ] vi.clearAllMocks() in beforeEach()
728
+
729
+ **Full guide**: `tests/test-template.test.ts`
730
+
731
+ **Why This Matters**:
732
+ 1. Tests create mock `.specweave/` structures for testing
733
+ 2. Cleanup uses `fs.rm(testRoot, { recursive: true })`
734
+ 3. If `testRoot` points to project root β†’ **DELETES REAL .specweave/!**
735
+ 4. You lose all increments, docs, and history
736
+
737
+ **Use Test Utilities** (RECOMMENDED):
738
+ ```typescript
739
+ import { createIsolatedTestDir, createSpecweaveStructure } from '../test-utils/isolated-test-dir';
740
+
741
+ test('my test', async () => {
742
+ const { testDir, cleanup } = await createIsolatedTestDir('my-test');
743
+
744
+ try {
745
+ // Setup .specweave structure in isolated directory
746
+ await createSpecweaveStructure(testDir);
747
+
748
+ // Test code here - NEVER touches project .specweave/
749
+ const incrementPath = path.join(testDir, '.specweave', 'increments', '0001-test');
750
+ // ...
751
+ } finally {
752
+ await cleanup(); // ALWAYS cleanup
753
+ }
754
+ });
755
+ ```
756
+
757
+ **Protection Layers**:
758
+ 1. βœ… **Pre-commit hook**: Blocks commits with dangerous test patterns
759
+ 2. βœ… **Test utilities**: `tests/test-utils/isolated-test-dir.ts`
760
+ 3. βœ… **Documentation**: This section
761
+
762
+ **Related Incident**: 2025-11-17 - Multiple `.specweave/` deletions traced to dangerous test patterns
763
+ **Root Cause Analysis**: `.specweave/increments/0037/reports/DELETION-ROOT-CAUSE-2025-11-17.md`
764
+
362
765
  ### Build Health Checks
363
766
 
364
767
  **CRITICAL**: TypeScript ES Modules require specific practices:
package/README.md CHANGED
@@ -14,14 +14,14 @@ The framework that turns solo builders into unicorn-level engineering teams.
14
14
 
15
15
  ## πŸ“Š Engineering Metrics (DORA)
16
16
 
17
- [![Deploy Frequency](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.deploymentFrequency.value&label=Deploy%20Frequency&suffix=/month&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
18
- [![Lead Time](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.leadTime.value&label=Lead%20Time&suffix=h&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
19
- [![Change Failure Rate](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.changeFailureRate.value&label=Change%20Failure%20Rate&suffix=%25&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
20
- [![MTTR](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.mttr.value&label=MTTR&suffix=min&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
17
+ [![Deploy Frequency](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/.specweave/metrics/dora-latest.json&query=$.metrics.deploymentFrequency.value&label=Deploy%20Frequency&suffix=/month&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
18
+ [![Lead Time](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/.specweave/metrics/dora-latest.json&query=$.metrics.leadTime.value&label=Lead%20Time&suffix=h&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
19
+ [![Change Failure Rate](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/.specweave/metrics/dora-latest.json&query=$.metrics.changeFailureRate.value&label=Change%20Failure%20Rate&suffix=%25&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
20
+ [![MTTR](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/.specweave/metrics/dora-latest.json&query=$.metrics.mttr.value&label=MTTR&suffix=min&color=brightgreen)](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/docs/internal/delivery/dora-metrics.md)
21
21
 
22
22
  **SpecWeave builds SpecWeave using SpecWeave.** These are real metrics from our own development.
23
23
 
24
- **[β†’ Live Dashboard](https://spec-weave.com/docs/metrics)** | **[β†’ Detailed Report](https://github.com/anton-abyzov/specweave/blob/develop/metrics/dora-report.md)**
24
+ **[β†’ Live Dashboard](https://spec-weave.com/docs/metrics)** | **[β†’ Detailed Report](https://github.com/anton-abyzov/specweave/blob/develop/.specweave/metrics/dora-report.md)**
25
25
 
26
26
  ---
27
27
 
@@ -232,8 +232,18 @@ Claude implements Task 1:
232
232
  # Install SpecWeave
233
233
  npm install -g specweave
234
234
 
235
- # Initialize new project
235
+ # Initialize with Strategic Init (AI-powered research)
236
236
  specweave init my-project
237
+
238
+ # Strategic Init guides you through 6 phases:
239
+ # Phase 1: Vision & Market Research
240
+ # Phase 2: Scaling & Performance Goals
241
+ # Phase 3: Data & Compliance Detection
242
+ # Phase 4: Budget & Cloud Credits
243
+ # Phase 5: Methodology & Organization
244
+ # Phase 6: Repository Selection (optional)
245
+
246
+ # Result: Architecture recommendation, team plan, cost estimates
237
247
  cd my-project
238
248
 
239
249
  # Start building
@@ -242,6 +252,15 @@ cd my-project
242
252
  /specweave:done 0001 # Complete increment
243
253
  ```
244
254
 
255
+ ### Multi-Project Setup
256
+ ```bash
257
+ # Initialize with multiple projects
258
+ specweave init --projects backend,frontend,mobile
259
+
260
+ # Tasks automatically split by project keyword detection
261
+ # Each project gets its own user stories and GitHub issues
262
+ ```
263
+
245
264
  ### Brownfield (Existing Project)
246
265
  ```bash
247
266
  # Initialize SpecWeave in existing project
@@ -255,7 +274,7 @@ specweave init .
255
274
  /specweave:increment "Add dark mode"
256
275
  ```
257
276
 
258
- **[β†’ Complete Quickstart Guide](https://spec-weave.com/docs/guides/getting-started/quickstart)**
277
+ **[β†’ Complete Quickstart Guide](https://spec-weave.com/docs/guides/getting-started/quickstart)** | **[β†’ Strategic Init Guide](https://spec-weave.com/docs/guides/strategic-init)**
259
278
 
260
279
  ---
261
280
 
@@ -296,12 +315,23 @@ specweave init .
296
315
 
297
316
  ## Key Features
298
317
 
318
+ ### Strategic Init - AI-Powered Architecture Planning (NEW!)
319
+
320
+ - 🎯 **Research-Driven Discovery** - Answer 6 phases of questions about your product
321
+ - πŸ—οΈ **Architecture Recommendations** - Tech stack, scaling strategy, cost projections
322
+ - πŸ”’ **Compliance Detection** - Auto-detects 30+ standards (HIPAA, GDPR, SOC2, etc.)
323
+ - πŸ‘₯ **Smart Team Planning** - Current and future team structure, hiring roadmap
324
+ - ☁️ **Cloud Credits Discovery** - AWS Activate, Azure Startup, GCP eligibility
325
+ - πŸ“¦ **Repository Selection** - Batch select 1-100+ repos with intelligent routing
326
+
327
+ ### Production Features
328
+
299
329
  - πŸ€– **AI-Native Enterprise Sync** - Claude updates JIRA/GitHub/ADO automatically (bidirectional!)
300
330
  - πŸ“š **Living Documentation** - Auto-updates after every task (no manual sync!)
301
331
  - πŸ§ͺ **Test-Aware Planning** - Embedded tests in BDD format (Given/When/Then)
302
332
  - 🎯 **Disciplined Progress** - Can't start increment N+1 until N is DONE
303
333
  - ⏸️ **Intelligent Pausing** - Auto-detects blockers, pauses with context, resumes when ready
304
- - πŸ”„ **Smart Reopen (NEW!)** - Report "broken" β†’ Auto-detects what to reopen, respects WIP limits
334
+ - πŸ”„ **Smart Reopen** - Report "broken" β†’ Auto-detects what to reopen, respects WIP limits
305
335
  - πŸ‘₯ **Multi-Project Tracking** - Unlimited JIRA/ADO/GitHub repos, intelligent routing
306
336
  - πŸ€– **AI Agents** - PM, Architect, Quality Judge guide your work
307
337
  - πŸ”§ **CI/CD Auto-Fix** - Workflow failures auto-fixed by Claude (just mention `@claude`)
package/bin/specweave.js CHANGED
@@ -311,20 +311,17 @@ async function checkForDuplicates() {
311
311
  const report = await detectAllDuplicates(process.cwd());
312
312
 
313
313
  if (report.duplicateCount > 0) {
314
- console.log(chalk.yellow('\n⚠️ WARNING: Duplicate increments detected!\n'));
314
+ console.log(chalk.yellow('\n⚠️ Duplicate increment(s) detected:\n'));
315
315
 
316
316
  for (const duplicate of report.duplicates) {
317
- console.log(chalk.yellow(` Increment ${duplicate.incrementNumber} exists in multiple locations:`));
317
+ console.log(chalk.dim(` ${duplicate.incrementNumber}:`));
318
318
  for (const location of duplicate.locations) {
319
- const indicator = location === duplicate.recommendedWinner ? chalk.green('βœ“ (recommended)') : chalk.red('βœ—');
320
- console.log(` ${indicator} ${location.name} [${location.status}] - ${location.path}`);
319
+ const indicator = location === duplicate.recommendedWinner ? chalk.green('β†’') : chalk.red('βœ—');
320
+ console.log(` ${indicator} ${location.name} [${location.status}]`);
321
321
  }
322
- console.log(chalk.dim(` Reason: ${duplicate.resolutionReason}\n`));
323
322
  }
324
323
 
325
- console.log(chalk.yellow(' Resolution:'));
326
- console.log(chalk.dim(' Run /specweave:fix-duplicates to automatically resolve conflicts'));
327
- console.log(chalk.dim(' or manually delete/archive the losing versions\n'));
324
+ console.log(chalk.dim('\n Run /specweave:fix-duplicates to resolve\n'));
328
325
  }
329
326
  } catch (error) {
330
327
  // Silently ignore errors (don't block CLI startup)
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Code Validator
3
+ *
4
+ * Validates that completed tasks have actual code implementation.
5
+ * Prevents marking tasks as complete when:
6
+ * - Files don't exist
7
+ * - Files are empty or have trivial content
8
+ * - Implementation is incomplete
9
+ *
10
+ * Used by GitHub sync to enforce code-completion discipline.
11
+ *
12
+ * @module CodeValidator
13
+ */
14
+ /**
15
+ * File validation result
16
+ */
17
+ export interface FileValidationResult {
18
+ path: string;
19
+ exists: boolean;
20
+ hasContent: boolean;
21
+ lineCount: number;
22
+ reason?: string;
23
+ }
24
+ /**
25
+ * Task validation result
26
+ */
27
+ export interface TaskValidationResult {
28
+ taskId: string;
29
+ valid: boolean;
30
+ files: FileValidationResult[];
31
+ reason?: string;
32
+ }
33
+ /**
34
+ * CodeValidator options
35
+ */
36
+ export interface CodeValidatorOptions {
37
+ minLines?: number;
38
+ minChars?: number;
39
+ projectRoot?: string;
40
+ }
41
+ export declare class CodeValidator {
42
+ private options;
43
+ constructor(options?: CodeValidatorOptions);
44
+ /**
45
+ * Validate that code exists for a task
46
+ *
47
+ * Extracts file paths from task description and verifies:
48
+ * 1. Files exist
49
+ * 2. Files have meaningful content
50
+ * 3. Files are not just stubs
51
+ *
52
+ * @param taskDescription - Task description with file paths
53
+ * @param taskId - Task ID for error messages
54
+ * @returns Validation result
55
+ */
56
+ validateTask(taskDescription: string, taskId: string): Promise<TaskValidationResult>;
57
+ /**
58
+ * Validate a single file
59
+ *
60
+ * @param filePath - Path to file (relative or absolute)
61
+ * @returns File validation result
62
+ */
63
+ validateFile(filePath: string): Promise<FileValidationResult>;
64
+ /**
65
+ * Extract file paths from task description
66
+ *
67
+ * Supports multiple formats:
68
+ * - **Files**: src/foo.ts, src/bar.ts
69
+ * - **Files to create**: src/foo.ts
70
+ * - **Files to modify**: src/bar.ts
71
+ * - Inline code blocks with file paths
72
+ *
73
+ * @param description - Task description text
74
+ * @returns Array of file paths
75
+ */
76
+ extractFilePaths(description: string): string[];
77
+ /**
78
+ * Batch validate multiple tasks
79
+ *
80
+ * @param tasks - Array of {taskId, description}
81
+ * @returns Array of validation results
82
+ */
83
+ validateTasks(tasks: Array<{
84
+ taskId: string;
85
+ description: string;
86
+ }>): Promise<TaskValidationResult[]>;
87
+ /**
88
+ * Get summary of validation results
89
+ *
90
+ * @param results - Array of task validation results
91
+ * @returns Summary statistics
92
+ */
93
+ summarizeResults(results: TaskValidationResult[]): {
94
+ total: number;
95
+ valid: number;
96
+ invalid: number;
97
+ noFiles: number;
98
+ invalidTasks: string[];
99
+ };
100
+ }
101
+ //# sourceMappingURL=CodeValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeValidator.d.ts","sourceRoot":"","sources":["../../../../plugins/specweave-github/lib/CodeValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAiC;gBAEpC,OAAO,GAAE,oBAAyB;IAQ9C;;;;;;;;;;;OAWG;IACG,YAAY,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAsC1F;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA4EnE;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE;IAuC/C;;;;;OAKG;IACG,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAS3G;;;;;OAKG;IACH,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG;QACjD,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,EAAE,CAAC;KACxB;CAeF"}