specweave 0.32.2 → 0.32.3

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 (191) hide show
  1. package/CLAUDE.md +39 -0
  2. package/bin/specweave.js +34 -0
  3. package/dist/plugins/specweave-ado/lib/ado-duplicate-detector.d.ts +100 -0
  4. package/dist/plugins/specweave-ado/lib/ado-duplicate-detector.d.ts.map +1 -0
  5. package/dist/plugins/specweave-ado/lib/ado-duplicate-detector.js +291 -0
  6. package/dist/plugins/specweave-ado/lib/ado-duplicate-detector.js.map +1 -0
  7. package/dist/plugins/specweave-jira/lib/jira-duplicate-detector.d.ts +103 -0
  8. package/dist/plugins/specweave-jira/lib/jira-duplicate-detector.d.ts.map +1 -0
  9. package/dist/plugins/specweave-jira/lib/jira-duplicate-detector.js +310 -0
  10. package/dist/plugins/specweave-jira/lib/jira-duplicate-detector.js.map +1 -0
  11. package/dist/plugins/specweave-jira/lib/jira-permission-gate.d.ts +126 -0
  12. package/dist/plugins/specweave-jira/lib/jira-permission-gate.d.ts.map +1 -0
  13. package/dist/plugins/specweave-jira/lib/jira-permission-gate.js +207 -0
  14. package/dist/plugins/specweave-jira/lib/jira-permission-gate.js.map +1 -0
  15. package/dist/src/adapters/codex/README.md +1 -1
  16. package/dist/src/adapters/codex/adapter.js +1 -1
  17. package/dist/src/cli/commands/archive.d.ts +2 -0
  18. package/dist/src/cli/commands/archive.d.ts.map +1 -1
  19. package/dist/src/cli/commands/archive.js +33 -0
  20. package/dist/src/cli/commands/archive.js.map +1 -1
  21. package/dist/src/cli/commands/context.d.ts +92 -0
  22. package/dist/src/cli/commands/context.d.ts.map +1 -0
  23. package/dist/src/cli/commands/context.js +205 -0
  24. package/dist/src/cli/commands/context.js.map +1 -0
  25. package/dist/src/cli/commands/init.d.ts.map +1 -1
  26. package/dist/src/cli/commands/init.js +111 -69
  27. package/dist/src/cli/commands/init.js.map +1 -1
  28. package/dist/src/cli/helpers/init/external-import.d.ts +3 -0
  29. package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
  30. package/dist/src/cli/helpers/init/external-import.js +17 -4
  31. package/dist/src/cli/helpers/init/external-import.js.map +1 -1
  32. package/dist/src/cli/helpers/init/index.d.ts +1 -0
  33. package/dist/src/cli/helpers/init/index.d.ts.map +1 -1
  34. package/dist/src/cli/helpers/init/index.js +2 -0
  35. package/dist/src/cli/helpers/init/index.js.map +1 -1
  36. package/dist/src/cli/helpers/init/jira-ado-auto-detect.d.ts +70 -0
  37. package/dist/src/cli/helpers/init/jira-ado-auto-detect.d.ts.map +1 -1
  38. package/dist/src/cli/helpers/init/jira-ado-auto-detect.js +214 -4
  39. package/dist/src/cli/helpers/init/jira-ado-auto-detect.js.map +1 -1
  40. package/dist/src/cli/helpers/init/living-docs-preflight.d.ts +4 -0
  41. package/dist/src/cli/helpers/init/living-docs-preflight.d.ts.map +1 -1
  42. package/dist/src/cli/helpers/init/living-docs-preflight.js +34 -3
  43. package/dist/src/cli/helpers/init/living-docs-preflight.js.map +1 -1
  44. package/dist/src/cli/helpers/init/testing-config.d.ts +3 -0
  45. package/dist/src/cli/helpers/init/testing-config.d.ts.map +1 -1
  46. package/dist/src/cli/helpers/init/testing-config.js +9 -2
  47. package/dist/src/cli/helpers/init/testing-config.js.map +1 -1
  48. package/dist/src/cli/helpers/init/translation-config.d.ts +3 -0
  49. package/dist/src/cli/helpers/init/translation-config.d.ts.map +1 -1
  50. package/dist/src/cli/helpers/init/translation-config.js +21 -4
  51. package/dist/src/cli/helpers/init/translation-config.js.map +1 -1
  52. package/dist/src/cli/helpers/init/wizard-navigation.d.ts +45 -0
  53. package/dist/src/cli/helpers/init/wizard-navigation.d.ts.map +1 -0
  54. package/dist/src/cli/helpers/init/wizard-navigation.js +97 -0
  55. package/dist/src/cli/helpers/init/wizard-navigation.js.map +1 -0
  56. package/dist/src/core/increment/increment-archiver.d.ts +25 -4
  57. package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
  58. package/dist/src/core/increment/increment-archiver.js +64 -20
  59. package/dist/src/core/increment/increment-archiver.js.map +1 -1
  60. package/dist/src/core/increment/increment-utils.d.ts +65 -0
  61. package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
  62. package/dist/src/core/increment/increment-utils.js +114 -0
  63. package/dist/src/core/increment/increment-utils.js.map +1 -1
  64. package/dist/src/core/living-docs/feature-archiver.d.ts +4 -0
  65. package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -1
  66. package/dist/src/core/living-docs/feature-archiver.js +32 -10
  67. package/dist/src/core/living-docs/feature-archiver.js.map +1 -1
  68. package/dist/src/core/living-docs/feature-id-manager.d.ts.map +1 -1
  69. package/dist/src/core/living-docs/feature-id-manager.js +7 -3
  70. package/dist/src/core/living-docs/feature-id-manager.js.map +1 -1
  71. package/dist/src/core/living-docs/governance/ecosystem-detector.d.ts +38 -0
  72. package/dist/src/core/living-docs/governance/ecosystem-detector.d.ts.map +1 -0
  73. package/dist/src/core/living-docs/governance/ecosystem-detector.js +325 -0
  74. package/dist/src/core/living-docs/governance/ecosystem-detector.js.map +1 -0
  75. package/dist/src/core/living-docs/governance/frontend-standards-parser.d.ts +74 -0
  76. package/dist/src/core/living-docs/governance/frontend-standards-parser.d.ts.map +1 -0
  77. package/dist/src/core/living-docs/governance/frontend-standards-parser.js +366 -0
  78. package/dist/src/core/living-docs/governance/frontend-standards-parser.js.map +1 -0
  79. package/dist/src/core/living-docs/governance/go-standards-parser.d.ts +64 -0
  80. package/dist/src/core/living-docs/governance/go-standards-parser.d.ts.map +1 -0
  81. package/dist/src/core/living-docs/governance/go-standards-parser.js +229 -0
  82. package/dist/src/core/living-docs/governance/go-standards-parser.js.map +1 -0
  83. package/dist/src/core/living-docs/governance/index.d.ts +50 -0
  84. package/dist/src/core/living-docs/governance/index.d.ts.map +1 -0
  85. package/dist/src/core/living-docs/governance/index.js +56 -0
  86. package/dist/src/core/living-docs/governance/index.js.map +1 -0
  87. package/dist/src/core/living-docs/governance/java-standards-parser.d.ts +89 -0
  88. package/dist/src/core/living-docs/governance/java-standards-parser.d.ts.map +1 -0
  89. package/dist/src/core/living-docs/governance/java-standards-parser.js +356 -0
  90. package/dist/src/core/living-docs/governance/java-standards-parser.js.map +1 -0
  91. package/dist/src/core/living-docs/governance/python-standards-parser.d.ts +83 -0
  92. package/dist/src/core/living-docs/governance/python-standards-parser.d.ts.map +1 -0
  93. package/dist/src/core/living-docs/governance/python-standards-parser.js +347 -0
  94. package/dist/src/core/living-docs/governance/python-standards-parser.js.map +1 -0
  95. package/dist/src/core/living-docs/governance/standards-generator.d.ts +38 -0
  96. package/dist/src/core/living-docs/governance/standards-generator.d.ts.map +1 -0
  97. package/dist/src/core/living-docs/governance/standards-generator.js +476 -0
  98. package/dist/src/core/living-docs/governance/standards-generator.js.map +1 -0
  99. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.d.ts.map +1 -1
  100. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.js +54 -2
  101. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.js.map +1 -1
  102. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.d.ts +5 -1
  103. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.d.ts.map +1 -1
  104. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.js +358 -30
  105. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.js.map +1 -1
  106. package/dist/src/core/living-docs/intelligent-analyzer/types.d.ts +44 -0
  107. package/dist/src/core/living-docs/intelligent-analyzer/types.d.ts.map +1 -1
  108. package/dist/src/core/living-docs/living-docs-sync.d.ts +6 -3
  109. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  110. package/dist/src/core/living-docs/living-docs-sync.js +17 -8
  111. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  112. package/dist/src/core/living-docs/module-analyzer.d.ts +22 -0
  113. package/dist/src/core/living-docs/module-analyzer.d.ts.map +1 -1
  114. package/dist/src/core/living-docs/module-analyzer.js +123 -19
  115. package/dist/src/core/living-docs/module-analyzer.js.map +1 -1
  116. package/dist/src/core/llm/provider-factory.js +2 -2
  117. package/dist/src/core/llm/provider-factory.js.map +1 -1
  118. package/dist/src/core/llm/providers/anthropic-provider.js +1 -1
  119. package/dist/src/core/llm/providers/bedrock-provider.d.ts.map +1 -1
  120. package/dist/src/core/llm/providers/bedrock-provider.js +8 -4
  121. package/dist/src/core/llm/providers/bedrock-provider.js.map +1 -1
  122. package/dist/src/importers/jira-importer.d.ts +14 -0
  123. package/dist/src/importers/jira-importer.d.ts.map +1 -1
  124. package/dist/src/importers/jira-importer.js +75 -0
  125. package/dist/src/importers/jira-importer.js.map +1 -1
  126. package/dist/src/integrations/jira/jira-token-provider.d.ts +93 -0
  127. package/dist/src/integrations/jira/jira-token-provider.d.ts.map +1 -0
  128. package/dist/src/integrations/jira/jira-token-provider.js +160 -0
  129. package/dist/src/integrations/jira/jira-token-provider.js.map +1 -0
  130. package/dist/src/sync/ado-reconciler.d.ts +92 -0
  131. package/dist/src/sync/ado-reconciler.d.ts.map +1 -0
  132. package/dist/src/sync/ado-reconciler.js +335 -0
  133. package/dist/src/sync/ado-reconciler.js.map +1 -0
  134. package/dist/src/sync/jira-reconciler.d.ts +106 -0
  135. package/dist/src/sync/jira-reconciler.d.ts.map +1 -0
  136. package/dist/src/sync/jira-reconciler.js +405 -0
  137. package/dist/src/sync/jira-reconciler.js.map +1 -0
  138. package/dist/src/types/model-selection.d.ts +6 -4
  139. package/dist/src/types/model-selection.d.ts.map +1 -1
  140. package/dist/src/types/model-selection.js +3 -1
  141. package/dist/src/types/model-selection.js.map +1 -1
  142. package/dist/src/utils/external-tool-drift-detector.d.ts +1 -1
  143. package/dist/src/utils/external-tool-drift-detector.d.ts.map +1 -1
  144. package/dist/src/utils/external-tool-drift-detector.js +5 -4
  145. package/dist/src/utils/external-tool-drift-detector.js.map +1 -1
  146. package/dist/src/utils/feature-id-derivation.d.ts +8 -3
  147. package/dist/src/utils/feature-id-derivation.d.ts.map +1 -1
  148. package/dist/src/utils/feature-id-derivation.js +14 -6
  149. package/dist/src/utils/feature-id-derivation.js.map +1 -1
  150. package/dist/src/utils/model-selection.d.ts +3 -4
  151. package/dist/src/utils/model-selection.d.ts.map +1 -1
  152. package/dist/src/utils/model-selection.js +3 -4
  153. package/dist/src/utils/model-selection.js.map +1 -1
  154. package/package.json +1 -1
  155. package/plugins/specweave/agents/code-standards-detective/AGENT.md +48 -0
  156. package/plugins/specweave/commands/specweave-costs.md +4 -4
  157. package/plugins/specweave/commands/specweave-do.md +9 -9
  158. package/plugins/specweave/commands/specweave-done.md +13 -0
  159. package/plugins/specweave/commands/specweave-validate.md +27 -1
  160. package/plugins/specweave/hooks/hooks.json +10 -0
  161. package/plugins/specweave/hooks/spec-project-validator.sh +80 -25
  162. package/plugins/specweave/hooks/v2/guards/increment-duplicate-guard.sh +135 -0
  163. package/plugins/specweave/scripts/read-costs.sh +3 -3
  164. package/plugins/specweave/skills/code-standards-analyzer/SKILL.md +58 -6
  165. package/plugins/specweave/skills/increment-planner/SKILL.md +56 -25
  166. package/plugins/specweave/skills/increment-planner/templates/spec-multi-project.md +4 -2
  167. package/plugins/specweave/skills/increment-planner/templates/spec-single-project.md +2 -1
  168. package/plugins/specweave/skills/increment-planner/templates/tasks-multi-project.md +1 -1
  169. package/plugins/specweave/skills/increment-planner/templates/tasks-single-project.md +1 -1
  170. package/plugins/specweave-ado/commands/cleanup-duplicates.md +212 -0
  171. package/plugins/specweave-ado/commands/reconcile.md +120 -0
  172. package/plugins/specweave-ado/lib/ado-duplicate-detector.js +279 -0
  173. package/plugins/specweave-ado/lib/ado-duplicate-detector.ts +407 -0
  174. package/plugins/specweave-github/agents/github-manager/AGENT.md +2 -2
  175. package/plugins/specweave-infrastructure/skills/hetzner-provisioner/README.md +1 -1
  176. package/plugins/specweave-jira/agents/jira-manager/AGENT.md +1 -1
  177. package/plugins/specweave-jira/agents/jira-multi-project-mapper/AGENT.md +530 -0
  178. package/plugins/specweave-jira/agents/jira-sync-judge/AGENT.md +438 -0
  179. package/plugins/specweave-jira/commands/cleanup-duplicates.md +219 -0
  180. package/plugins/specweave-jira/commands/close.md +297 -0
  181. package/plugins/specweave-jira/commands/create.md +198 -0
  182. package/plugins/specweave-jira/commands/reconcile.md +123 -0
  183. package/plugins/specweave-jira/commands/status.md +215 -0
  184. package/plugins/specweave-jira/lib/jira-duplicate-detector.js +296 -0
  185. package/plugins/specweave-jira/lib/jira-duplicate-detector.ts +434 -0
  186. package/plugins/specweave-jira/lib/jira-permission-gate.js +160 -0
  187. package/plugins/specweave-jira/lib/jira-permission-gate.ts +276 -0
  188. package/plugins/specweave-jira/lib/jira-profile-resolver.js +222 -0
  189. package/plugins/specweave-jira/lib/jira-profile-resolver.ts +427 -0
  190. package/plugins/specweave-jira/reference/jira-specweave-mapping.md +16 -11
  191. package/plugins/specweave-release/commands/specweave-release-npm.md +140 -14
@@ -408,9 +408,15 @@ Full standards: .specweave/docs/internal/governance/coding-standards.md"
408
408
  ### Supported Languages
409
409
  - ✅ TypeScript (primary)
410
410
  - ✅ JavaScript (ES6+)
411
- - 🔜 Python (future)
412
- - 🔜 Java (future)
413
- - 🔜 Go (future)
411
+ - Python (pyproject.toml, .pylintrc, ruff.toml, .flake8, mypy.ini)
412
+ - Java/Kotlin (checkstyle.xml, pmd.xml, spotbugs.xml, detekt.yml)
413
+ - Go (go.mod, .golangci.yml, staticcheck.conf)
414
+ - ✅ C#/.NET (.editorconfig, StyleCop.json, Directory.Build.props)
415
+ - ✅ Rust (rustfmt.toml, clippy.toml, Cargo.toml)
416
+ - ✅ React (package.json, ESLint plugin:react/*)
417
+ - ✅ Angular (angular.json, ESLint @angular-eslint)
418
+ - ✅ Vue (package.json, ESLint plugin:vue/*)
419
+ - ✅ Svelte (package.json, svelte.config.js)
414
420
 
415
421
  ### Detection Algorithms
416
422
 
@@ -439,14 +445,60 @@ Full standards: .specweave/docs/internal/governance/coding-standards.md"
439
445
 
440
446
  1. **Implicit Standards**: Requires representative codebase sample
441
447
  2. **False Positives**: Anti-pattern detection may flag intentional code
442
- 3. **Language Support**: Currently TypeScript/JavaScript only
443
- 4. **Context**: Can't understand business rationale for patterns
448
+ 3. **Context**: Can't understand business rationale for patterns
449
+
450
+ ---
451
+
452
+ ## Multi-Technology Support
453
+
454
+ **Status**: ✅ Implemented (increment 0122-multi-technology-governance)
455
+
456
+ | Technology | Config Files | Status |
457
+ |------------|--------------|--------|
458
+ | TypeScript/JavaScript | `.eslintrc.*`, `.prettierrc`, `tsconfig.json` | ✅ Implemented |
459
+ | Python | `pyproject.toml`, `.pylintrc`, `ruff.toml`, `.flake8`, `mypy.ini` | ✅ Implemented |
460
+ | Go | `go.mod`, `.golangci.yml`, `staticcheck.conf` | ✅ Implemented |
461
+ | Java/Kotlin | `checkstyle.xml`, `pmd.xml`, `spotbugs.xml`, `detekt.yml` | ✅ Implemented |
462
+ | C#/.NET | `.editorconfig`, `StyleCop.json`, `Directory.Build.props` | ✅ Implemented |
463
+ | Rust | `rustfmt.toml`, `clippy.toml`, `Cargo.toml` | ✅ Implemented |
464
+ | React | ESLint + `plugin:react/*`, `package.json` | ✅ Implemented |
465
+ | Angular | `angular.json`, `.eslintrc` | ✅ Implemented |
466
+ | Vue | ESLint + `plugin:vue/*`, `vite.config.*` | ✅ Implemented |
467
+ | Svelte | `svelte.config.js`, `package.json` | ✅ Implemented |
468
+
469
+ **Output Structure:**
470
+ ```
471
+ .specweave/docs/internal/governance/
472
+ ├── coding-standards.md # Unified summary of ALL technologies
473
+ ├── shared-conventions.md # EditorConfig, Git conventions
474
+ └── standards/
475
+ ├── typescript.md
476
+ ├── python.md
477
+ ├── golang.md
478
+ ├── java.md
479
+ ├── react.md
480
+ ├── angular.md
481
+ ├── vue.md
482
+ └── svelte.md
483
+ ```
484
+
485
+ **Usage**:
486
+ ```typescript
487
+ import {
488
+ detectEcosystems,
489
+ parsePythonStandards,
490
+ parseGoStandards,
491
+ parseJavaStandards,
492
+ parseFrontendStandards,
493
+ generateStandardsMarkdown,
494
+ generateUnifiedSummary
495
+ } from 'src/core/living-docs/governance/index.js';
496
+ ```
444
497
 
445
498
  ---
446
499
 
447
500
  ## Future Enhancements
448
501
 
449
- - [ ] Multi-language support (Python, Java, Go)
450
502
  - [ ] Auto-generate ESLint rules from detected patterns
451
503
  - [ ] AI-powered suggestions from top OSS projects
452
504
  - [ ] Team-specific standards in multi-project mode
@@ -176,39 +176,68 @@ echo "Using coverageTarget: $coverageTarget"
176
176
 
177
177
  **Store these values for use in STEP 4 and STEP 7!**
178
178
 
179
- ### STEP 0B: Detect Structure Level & Select Project/Board (MANDATORY!)
179
+ ### STEP 0B: Get Project Context (MANDATORY - BLOCKING!)
180
180
 
181
- **⚠️ CRITICAL: Before generating spec.md, you MUST know the target project (and board for 2-level structures)!**
181
+ **⛔ DO NOT PROCEED TO STEP 1 WITHOUT COMPLETING THIS STEP!**
182
182
 
183
- **Structure Levels:**
184
- - **1-Level**: `internal/specs/{project}/FS-XXX/` - requires `project` in spec.md
185
- - **2-Level**: `internal/specs/{project}/{board}/FS-XXX/` - requires BOTH `project` AND `board`
183
+ Before generating ANY spec.md content, you MUST run this CLI command:
186
184
 
187
- **Detection Logic** (use `src/utils/structure-level-detector.ts`):
185
+ ```bash
186
+ specweave context projects
187
+ ```
188
188
 
189
- ```typescript
190
- import { detectStructureLevel, getRequiredSpecFields } from './utils/structure-level-detector.js';
189
+ This returns JSON with available projects and structure level:
191
190
 
192
- const structureConfig = detectStructureLevel(projectRoot);
193
- console.log(`Structure level: ${structureConfig.level}`);
194
- console.log(`Detection reason: ${structureConfig.detectionReason}`);
195
- console.log(`Available projects: ${structureConfig.projects.map(p => p.id).join(', ')}`);
191
+ ```json
192
+ {
193
+ "level": 1,
194
+ "projects": [{"id": "my-app", "name": "My App"}],
195
+ "detectionReason": "multiProject configuration",
196
+ "source": "multi-project"
197
+ }
198
+ ```
196
199
 
197
- if (structureConfig.level === 2 && structureConfig.boardsByProject) {
198
- console.log('Available boards by project:');
199
- for (const [projectId, boards] of Object.entries(structureConfig.boardsByProject)) {
200
- console.log(` ${projectId}: ${boards.map(b => b.id).join(', ')}`);
201
- }
200
+ **For 2-level structures**, output includes boards:
201
+ ```json
202
+ {
203
+ "level": 2,
204
+ "projects": [{"id": "acme-corp", "name": "ACME Corporation"}],
205
+ "boardsByProject": {
206
+ "acme-corp": [
207
+ {"id": "digital-ops", "name": "Digital Operations"},
208
+ {"id": "mobile-team", "name": "Mobile Team"}
209
+ ]
210
+ },
211
+ "detectionReason": "ADO area path mapping configured",
212
+ "source": "ado-area-path"
202
213
  }
203
214
  ```
204
215
 
205
- **Manual Detection:**
216
+ **VALIDATION RULES:**
217
+
218
+ ```
219
+ ✅ REQUIRED: Parse the JSON output and use ONLY those project/board values
220
+ ✅ REQUIRED: project field MUST match one of the returned projects[].id
221
+ ✅ REQUIRED: board field (2-level) MUST match one of boardsByProject[project].id
222
+ ❌ FORBIDDEN: Inventing or guessing project names
223
+ ❌ FORBIDDEN: Using folder name as project (e.g., "sw-olysense")
224
+ ❌ FORBIDDEN: Creating spec.md with {{PROJECT_ID}} placeholder
225
+ ❌ FORBIDDEN: Creating spec.md for 2-level without board: field
226
+ ```
227
+
228
+ **Structure Levels:**
229
+ - **1-Level**: `internal/specs/{project}/FS-XXX/` - requires `project` in spec.md
230
+ - **2-Level**: `internal/specs/{project}/{board}/FS-XXX/` - requires BOTH `project` AND `board`
231
+
232
+ **Alternative: Interactive Selection:**
206
233
  ```bash
207
- # Check if 2-level (ADO area paths or JIRA boards)
208
- jq '.sync.profiles | to_entries[] | select(.value.provider == "ado") | .value.config.areaPathMapping' .specweave/config.json
234
+ specweave context select
235
+ # Returns auto-selected or prompts for selection
236
+ ```
209
237
 
210
- # Check existing folder structure
211
- ls -la .specweave/docs/internal/specs/*/ # If sub-folders exist (not FS-XXX) → 2-level
238
+ **Get boards for a specific project (2-level):**
239
+ ```bash
240
+ specweave context boards --project=acme-corp
212
241
  ```
213
242
 
214
243
  **Project/Board Selection - ULTRA-SMART LOGIC (MANDATORY BEFORE STEP 4!):**
@@ -766,19 +795,21 @@ When creating tasks, assign optimal models:
766
795
  - Simple CRUD, configuration, setup
767
796
  - Mechanical work with defined approach
768
797
 
769
- **🧠 Sonnet** (thinking, balanced):
798
+ **💎 Opus** (best quality, default):
770
799
  - Architecture decisions
771
800
  - Multiple valid approaches
772
801
  - Integration between components
773
802
  - Complex business logic
774
803
  - Error handling strategies
775
-
776
- **💎 Opus** (critical, expensive):
777
804
  - Critical system architecture
778
805
  - Security-critical decisions
779
806
  - Performance-critical algorithms
780
807
  - Novel problem-solving
781
808
 
809
+ **🧠 Sonnet** (legacy, rarely needed):
810
+ - Use only for backwards compatibility
811
+ - Prefer Opus or Haiku instead
812
+
782
813
  ---
783
814
 
784
815
  ## Validation Checklist
@@ -8,8 +8,10 @@ created: {{DATE}}
8
8
  structure: user-stories
9
9
  test_mode: {{TEST_MODE}}
10
10
  coverage_target: {{COVERAGE_TARGET}}
11
- default_project: {{PROJECT_ID}}
12
- default_board: {{BOARD_ID}}
11
+ # MANDATORY: Run "specweave context projects" to get valid project/board IDs
12
+ # For 2-level structures: BOTH project AND board are REQUIRED
13
+ project: {{PROJECT_ID}}
14
+ board: {{BOARD_ID}}
13
15
  multi_project: true
14
16
  projects:
15
17
  - id: {{PROJECT_FE_ID}}
@@ -8,7 +8,8 @@ created: {{DATE}}
8
8
  structure: user-stories
9
9
  test_mode: {{TEST_MODE}}
10
10
  coverage_target: {{COVERAGE_TARGET}}
11
- default_project: {{PROJECT_ID}}
11
+ # MANDATORY: Run "specweave context projects" to get valid project ID
12
+ project: {{PROJECT_ID}}
12
13
  ---
13
14
 
14
15
  # Feature: {{FEATURE_TITLE}}
@@ -6,7 +6,7 @@
6
6
  - `[P]`: Parallelizable
7
7
  - `[ ]`: Not started
8
8
  - `[x]`: Completed
9
- - Model hints: ⚡ haiku, 🧠 sonnet, 💎 opus
9
+ - Model hints: ⚡ haiku (simple), 💎 opus (default)
10
10
 
11
11
  ## Phase 1: Foundation & Setup
12
12
 
@@ -6,7 +6,7 @@
6
6
  - `[P]`: Parallelizable
7
7
  - `[ ]`: Not started
8
8
  - `[x]`: Completed
9
- - Model hints: ⚡ haiku, 🧠 sonnet, 💎 opus
9
+ - Model hints: ⚡ haiku (simple), 💎 opus (default)
10
10
 
11
11
  ## Phase 1: Setup
12
12
 
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: specweave-ado:cleanup-duplicates
3
+ description: Clean up duplicate Azure DevOps work items for a Feature. Finds work items with duplicate titles and closes all except the first created item.
4
+ justification: |
5
+ CRITICAL INCIDENT RESPONSE TOOL - DO NOT DELETE!
6
+
7
+ Why This Command Exists:
8
+ - Prevention systems work for single-process execution
9
+ - Multiple parallel Claude Code instances bypass all prevention (file-based cache, no distributed locking)
10
+ - ADO API race conditions: Time gap between "check exists" and "create work item" allows duplicates
11
+ - Historical duplicates from pre-v0.33.0 users (before prevention was added)
12
+
13
+ Evidence of Need:
14
+ - GitHub had 123 duplicate issues incident (cleaned to 29 unique) - same risk exists for ADO
15
+ - Parallel execution creates race conditions that prevention CANNOT solve
16
+ - Industry standard: Prevention + Detection + Cleanup (defense in depth)
17
+
18
+ When to Delete:
19
+ - ONLY if distributed locking implemented
20
+ - AND parallel execution tested (100+ concurrent syncs with zero duplicates)
21
+ - AND zero duplicates for 6+ months in production
22
+ ---
23
+
24
+ # Clean Up Duplicate ADO Work Items
25
+
26
+ **CRITICAL**: This command detects and closes duplicate ADO work items created by multiple syncs.
27
+
28
+ ## Usage
29
+
30
+ ```bash
31
+ /specweave-ado:cleanup-duplicates <feature-id> [--dry-run]
32
+ ```
33
+
34
+ ## What It Does
35
+
36
+ **Duplicate Detection & Cleanup**:
37
+
38
+ 1. **Find all work items** for the Feature (searches by Feature ID in title)
39
+ 2. **Group by title** (detect duplicates)
40
+ 3. **For each duplicate group**:
41
+ - Keep the **FIRST created** work item (lowest ID)
42
+ - Close all **LATER** work items with comment: "Duplicate of #XXX"
43
+ 4. **Update Feature README** with correct work item IDs
44
+
45
+ ## Examples
46
+
47
+ ### Dry Run (No Changes)
48
+
49
+ ```bash
50
+ /specweave-ado:cleanup-duplicates FS-031 --dry-run
51
+ ```
52
+
53
+ **Output**:
54
+ ```
55
+ Scanning for duplicates in Feature FS-031...
56
+ Found 25 total work items
57
+ Detected 10 duplicate groups:
58
+
59
+ Group 1: "[FS-031] External Tool Status Synchronization"
60
+ - #1250 (KEEP) - Created 2025-11-10
61
+ - #1255 (CLOSE) - Created 2025-11-11 - DUPLICATE
62
+ - #1260 (CLOSE) - Created 2025-11-12 - DUPLICATE
63
+
64
+ Group 2: "[FS-031] Multi-Project ADO Sync"
65
+ - #1251 (KEEP) - Created 2025-11-10
66
+ - #1256 (CLOSE) - Created 2025-11-11 - DUPLICATE
67
+
68
+ ...
69
+
70
+ Dry run complete!
71
+ Total work items: 25
72
+ Duplicate groups: 10
73
+ Work items to close: 15
74
+
75
+ This was a DRY RUN - no changes made.
76
+ Run without --dry-run to actually close duplicates.
77
+ ```
78
+
79
+ ### Actual Cleanup
80
+
81
+ ```bash
82
+ /specweave-ado:cleanup-duplicates FS-031
83
+ ```
84
+
85
+ **Output**:
86
+ ```
87
+ Scanning for duplicates in Feature FS-031...
88
+ Found 25 total work items
89
+ Detected 10 duplicate groups
90
+
91
+ CONFIRM: Close 15 duplicate work items? [y/N]
92
+ > y
93
+
94
+ Closing duplicates...
95
+ Closed #1255 (duplicate of #1250)
96
+ Closed #1256 (duplicate of #1251)
97
+ Closed #1260 (duplicate of #1250)
98
+ ...
99
+
100
+ Updating Feature README frontmatter...
101
+ Updated frontmatter with correct work item IDs
102
+
103
+ Cleanup complete!
104
+ Closed: 15 duplicates
105
+ Kept: 10 original work items
106
+ ```
107
+
108
+ ## Arguments
109
+
110
+ - `<feature-id>` - Feature ID (e.g., `FS-031` or just `031`)
111
+ - `--dry-run` - Preview changes without actually closing work items (optional)
112
+
113
+ ## Safety Features
114
+
115
+ - **Confirmation prompt**: Asks before closing work items (unless --dry-run)
116
+ - **Dry run mode**: Preview changes safely
117
+ - **Keeps oldest work item**: Preserves the first created item
118
+ - **Adds closure comment**: Links to the original work item
119
+ - **Updates metadata**: Fixes Feature README frontmatter
120
+
121
+ ## What Gets Closed
122
+
123
+ **Closed work items**:
124
+ - Duplicate titles (second, third, etc. occurrences)
125
+ - Closed with comment: "Duplicate of #XXX"
126
+ - Original work item kept open (or maintains its status)
127
+
128
+ **Example comment on closed duplicate**:
129
+ ```markdown
130
+ ## Duplicate of #1250
131
+
132
+ This work item was automatically closed by SpecWeave cleanup because it is a duplicate.
133
+
134
+ The original work item (#1250) contains the same content and should be used for tracking instead.
135
+
136
+ Auto-closed by SpecWeave Duplicate Cleanup
137
+ ```
138
+
139
+ ## Requirements
140
+
141
+ 1. **Azure DevOps PAT** configured (`AZURE_DEVOPS_PAT`)
142
+ 2. **Organization** configured (`AZURE_DEVOPS_ORG`)
143
+ 3. **Project** configured (`AZURE_DEVOPS_PROJECT`)
144
+ 4. **Write access** to project (for closing work items)
145
+ 5. **Feature folder exists** at `.specweave/docs/internal/specs/FS-XXX-name/`
146
+
147
+ ## When to Use
148
+
149
+ **Use this command when**:
150
+ - You see multiple work items with the same title in ADO
151
+ - Feature sync ran multiple times and created duplicates
152
+ - Feature README frontmatter got corrupted and reset
153
+ - Post-sync validation warns about duplicates
154
+
155
+ **Example warning that triggers this**:
156
+ ```
157
+ WARNING: 10 duplicate(s) detected!
158
+ Run cleanup command to resolve:
159
+ /specweave-ado:cleanup-duplicates FS-031
160
+ ```
161
+
162
+ ## Architecture
163
+
164
+ **Duplicate Detection Logic**:
165
+ 1. Query WIQL for work items with Feature ID in title
166
+ 2. Group work items by **exact title match**
167
+ 3. Within each group, sort by **work item ID** (ascending)
168
+ 4. Keep **first work item** (lowest ID = oldest)
169
+ 5. Close **all others** as duplicates via state transition
170
+
171
+ **Why lowest ID?**:
172
+ - Lower work item IDs were created first
173
+ - Preserves chronological order
174
+ - Maintains links from old documentation
175
+
176
+ ## Related Commands
177
+
178
+ - `/specweave-ado:sync` - Sync Feature to ADO (with duplicate detection)
179
+ - `/specweave-ado:reconcile` - Reconcile work item states
180
+ - `/specweave:validate` - Validate increment completeness
181
+
182
+ ## Implementation
183
+
184
+ **File**: `plugins/specweave-ado/lib/ado-duplicate-detector.ts`
185
+
186
+ **Class**: `AdoDuplicateDetector`
187
+
188
+ **Algorithm** (3-phase protection):
189
+ 1. **Detection**: WIQL query for existing work items matching pattern
190
+ 2. **Verification**: Count check to detect duplicates after creation
191
+ 3. **Reflection**: Auto-close duplicates automatically
192
+
193
+ For manual cleanup:
194
+ 1. WIQL query for all work items with Feature ID
195
+ 2. Group by title (Map<string, number[]>)
196
+ 3. Filter groups with >1 item (duplicates)
197
+ 4. For each duplicate group:
198
+ - Keep first work item (lowest ID)
199
+ - Close others via ADO REST API
200
+
201
+ ## Next Steps
202
+
203
+ After cleanup:
204
+
205
+ 1. **Verify cleanup**: Check ADO for remaining work items
206
+ 2. **Check Feature FEATURE.md**: Verify frontmatter has correct work item IDs
207
+ 3. **Re-run sync**: `/specweave-ado:sync` (should show no duplicates)
208
+ 4. **Duplicate detection**: Automatically enabled via AdoDuplicateDetector
209
+
210
+ ---
211
+
212
+ **SAFE TO USE**: This command is idempotent and safe to run multiple times.
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: specweave-ado:reconcile
3
+ description: Reconcile Azure DevOps work item states with increment statuses. Fixes drift by closing work items for completed increments and reactivating work items for resumed increments.
4
+ ---
5
+
6
+ # Azure DevOps Status Reconciliation
7
+
8
+ Scan all increments and fix any drift between local metadata.json status and ADO work item states.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ /specweave-ado:reconcile [options]
14
+ ```
15
+
16
+ ## Options
17
+
18
+ - `--dry-run`: Preview changes without making them
19
+ - `--verbose`: Show detailed output for each work item checked
20
+
21
+ ## What It Does
22
+
23
+ 1. **Scans** all non-archived increments
24
+ 2. **Compares** metadata.json status with ADO work item state
25
+ 3. **Fixes** mismatches:
26
+ - `metadata=completed` + `ADO=Active` → **Close** the work item
27
+ - `metadata=in-progress` + `ADO=Closed` → **Reactivate** the work item
28
+
29
+ ## When to Use
30
+
31
+ - After manual metadata.json edits
32
+ - After git pulls that changed increment statuses
33
+ - When you notice active work items for completed work
34
+ - As a periodic health check
35
+
36
+ ## Implementation
37
+
38
+ Run the reconciliation using the AdoReconciler:
39
+
40
+ ```typescript
41
+ import { AdoReconciler } from '../../../src/sync/ado-reconciler.js';
42
+
43
+ const reconciler = new AdoReconciler({
44
+ projectRoot: process.cwd(),
45
+ dryRun: args.includes('--dry-run'),
46
+ });
47
+
48
+ const result = await reconciler.reconcile();
49
+
50
+ // Report results
51
+ console.log(`\nReconciliation complete:`);
52
+ console.log(` Scanned: ${result.scanned} increments`);
53
+ console.log(` Fixed: ${result.closed} closed, ${result.reopened} reopened`);
54
+ if (result.errors.length > 0) {
55
+ console.log(` Errors: ${result.errors.length}`);
56
+ }
57
+ ```
58
+
59
+ ## Example Output
60
+
61
+ ```
62
+ 📊 Scanning 5 increment(s) for ADO state drift...
63
+
64
+ ✅ Work Item #1234 (0056-plugin-fix/US-001): State matches (Active)
65
+ ❌ Work Item #1240 (0066-import-wizard/US-003): Active but should be CLOSED (status=completed)
66
+ ✅ Closed work item #1240
67
+ ❌ Work Item #1238 (0063-multi-repo/US-001): CLOSED but should be ACTIVE (status=in-progress)
68
+ ✅ Reactivated work item #1238
69
+
70
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
71
+ 📊 ADO RECONCILIATION SUMMARY
72
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
73
+ Increments scanned: 5
74
+ Mismatches found: 2
75
+ Work items closed: 1
76
+ Work items reopened: 1
77
+ Errors: 0
78
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
79
+ ```
80
+
81
+ ## Dry Run Mode
82
+
83
+ ```bash
84
+ /specweave-ado:reconcile --dry-run
85
+ ```
86
+
87
+ Shows what would be changed without making any modifications:
88
+
89
+ ```
90
+ ❌ Work Item #1240 (0066-import-wizard/US-003): Active but should be CLOSED
91
+ [DRY RUN] Would close work item #1240
92
+
93
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+ 📊 ADO RECONCILIATION SUMMARY
95
+ ⚠️ DRY RUN - No changes were made
96
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
97
+ ```
98
+
99
+ ## Requirements
100
+
101
+ - Azure DevOps PAT configured (`AZURE_DEVOPS_PAT`)
102
+ - `sync.ado.enabled = true` in config.json
103
+ - `sync.settings.canUpdateExternalItems = true` in config.json
104
+
105
+ ## ADO Status Mapping
106
+
107
+ | SpecWeave Status | Expected ADO State |
108
+ |-----------------|-------------------|
109
+ | `completed` | Closed, Done, Resolved |
110
+ | `abandoned` | Closed, Removed |
111
+ | `in-progress` | Active, In Progress |
112
+ | `active` | Active, New |
113
+ | `planning` | New |
114
+
115
+ ## Related Commands
116
+
117
+ - `/specweave-ado:status`: View sync status for increments
118
+ - `/specweave-ado:sync`: Manual sync to ADO
119
+ - `/specweave:done`: Close increment (triggers auto-close)
120
+ - `/specweave:resume`: Resume increment (now triggers auto-reopen)