specweave 0.32.0 → 0.32.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 (191) hide show
  1. package/CLAUDE.md +176 -2
  2. package/README.md +22 -0
  3. package/bin/specweave.js +18 -1
  4. package/dist/src/cli/commands/cache.d.ts +17 -0
  5. package/dist/src/cli/commands/cache.d.ts.map +1 -0
  6. package/dist/src/cli/commands/cache.js +126 -0
  7. package/dist/src/cli/commands/cache.js.map +1 -0
  8. package/dist/src/cli/commands/init.js +1 -1
  9. package/dist/src/cli/commands/init.js.map +1 -1
  10. package/dist/src/cli/commands/plan/increment-detector.js +2 -2
  11. package/dist/src/cli/commands/plan/increment-detector.js.map +1 -1
  12. package/dist/src/cli/commands/sync-spec-commits.js +1 -1
  13. package/dist/src/cli/commands/sync-spec-commits.js.map +1 -1
  14. package/dist/src/cli/commands/sync-specs.js +2 -2
  15. package/dist/src/cli/commands/sync-specs.js.map +1 -1
  16. package/dist/src/cli/helpers/github/increment-profile-selector.js +1 -1
  17. package/dist/src/cli/helpers/github/increment-profile-selector.js.map +1 -1
  18. package/dist/src/cli/workers/living-docs-worker.js +66 -1
  19. package/dist/src/cli/workers/living-docs-worker.js.map +1 -1
  20. package/dist/src/config/types.d.ts +203 -1208
  21. package/dist/src/config/types.d.ts.map +1 -1
  22. package/dist/src/core/discrepancy/increment-generator.d.ts.map +1 -1
  23. package/dist/src/core/discrepancy/increment-generator.js +5 -2
  24. package/dist/src/core/discrepancy/increment-generator.js.map +1 -1
  25. package/dist/src/core/increment/duplicate-detector.js +2 -2
  26. package/dist/src/core/increment/duplicate-detector.js.map +1 -1
  27. package/dist/src/core/increment/increment-archiver.d.ts +24 -0
  28. package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
  29. package/dist/src/core/increment/increment-archiver.js +59 -2
  30. package/dist/src/core/increment/increment-archiver.js.map +1 -1
  31. package/dist/src/core/increment/increment-status.js +2 -2
  32. package/dist/src/core/increment/increment-status.js.map +1 -1
  33. package/dist/src/core/increment/increment-utils.d.ts +85 -0
  34. package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
  35. package/dist/src/core/increment/increment-utils.js +102 -4
  36. package/dist/src/core/increment/increment-utils.js.map +1 -1
  37. package/dist/src/core/increment/metadata-validator.js +1 -1
  38. package/dist/src/core/increment/metadata-validator.js.map +1 -1
  39. package/dist/src/core/living-docs/feature-id-manager.js +1 -1
  40. package/dist/src/core/living-docs/feature-id-manager.js.map +1 -1
  41. package/dist/src/core/living-docs/hierarchy-mapper.js +3 -3
  42. package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
  43. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.d.ts +18 -0
  44. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.d.ts.map +1 -0
  45. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.js +247 -0
  46. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.js.map +1 -0
  47. package/dist/src/core/living-docs/intelligent-analyzer/deep-repo-analyzer.d.ts +15 -0
  48. package/dist/src/core/living-docs/intelligent-analyzer/deep-repo-analyzer.d.ts.map +1 -0
  49. package/dist/src/core/living-docs/intelligent-analyzer/deep-repo-analyzer.js +138 -0
  50. package/dist/src/core/living-docs/intelligent-analyzer/deep-repo-analyzer.js.map +1 -0
  51. package/dist/src/core/living-docs/intelligent-analyzer/file-sampler.d.ts +24 -0
  52. package/dist/src/core/living-docs/intelligent-analyzer/file-sampler.d.ts.map +1 -0
  53. package/dist/src/core/living-docs/intelligent-analyzer/file-sampler.js +198 -0
  54. package/dist/src/core/living-docs/intelligent-analyzer/file-sampler.js.map +1 -0
  55. package/dist/src/core/living-docs/intelligent-analyzer/inconsistency-detector.d.ts +17 -0
  56. package/dist/src/core/living-docs/intelligent-analyzer/inconsistency-detector.d.ts.map +1 -0
  57. package/dist/src/core/living-docs/intelligent-analyzer/inconsistency-detector.js +241 -0
  58. package/dist/src/core/living-docs/intelligent-analyzer/inconsistency-detector.js.map +1 -0
  59. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts +28 -0
  60. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts.map +1 -0
  61. package/dist/src/core/living-docs/intelligent-analyzer/index.js +197 -0
  62. package/dist/src/core/living-docs/intelligent-analyzer/index.js.map +1 -0
  63. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.d.ts +18 -0
  64. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.d.ts.map +1 -0
  65. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.js +154 -0
  66. package/dist/src/core/living-docs/intelligent-analyzer/organization-synthesizer.js.map +1 -0
  67. package/dist/src/core/living-docs/intelligent-analyzer/strategy-generator.d.ts +42 -0
  68. package/dist/src/core/living-docs/intelligent-analyzer/strategy-generator.d.ts.map +1 -0
  69. package/dist/src/core/living-docs/intelligent-analyzer/strategy-generator.js +343 -0
  70. package/dist/src/core/living-docs/intelligent-analyzer/strategy-generator.js.map +1 -0
  71. package/dist/src/core/living-docs/intelligent-analyzer/types.d.ts +146 -0
  72. package/dist/src/core/living-docs/intelligent-analyzer/types.d.ts.map +1 -0
  73. package/dist/src/core/living-docs/intelligent-analyzer/types.js +7 -0
  74. package/dist/src/core/living-docs/intelligent-analyzer/types.js.map +1 -0
  75. package/dist/src/core/living-docs/living-docs-sync.d.ts +5 -0
  76. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  77. package/dist/src/core/living-docs/living-docs-sync.js +36 -2
  78. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  79. package/dist/src/core/sync/spec-increment-mapper.js +3 -3
  80. package/dist/src/core/sync/spec-increment-mapper.js.map +1 -1
  81. package/dist/src/importers/item-converter.d.ts +25 -0
  82. package/dist/src/importers/item-converter.d.ts.map +1 -1
  83. package/dist/src/importers/item-converter.js +135 -5
  84. package/dist/src/importers/item-converter.js.map +1 -1
  85. package/dist/src/init/architecture/types.d.ts +33 -140
  86. package/dist/src/init/architecture/types.d.ts.map +1 -1
  87. package/dist/src/init/compliance/types.d.ts +30 -27
  88. package/dist/src/init/compliance/types.d.ts.map +1 -1
  89. package/dist/src/init/repo/types.d.ts +11 -34
  90. package/dist/src/init/repo/types.d.ts.map +1 -1
  91. package/dist/src/init/research/src/config/types.d.ts +15 -82
  92. package/dist/src/init/research/src/config/types.d.ts.map +1 -1
  93. package/dist/src/init/research/types.d.ts +38 -93
  94. package/dist/src/init/research/types.d.ts.map +1 -1
  95. package/dist/src/init/team/types.d.ts +4 -42
  96. package/dist/src/init/team/types.d.ts.map +1 -1
  97. package/dist/src/types/dashboard-cache.d.ts +181 -0
  98. package/dist/src/types/dashboard-cache.d.ts.map +1 -0
  99. package/dist/src/types/dashboard-cache.js +65 -0
  100. package/dist/src/types/dashboard-cache.js.map +1 -0
  101. package/dist/src/utils/docs-validator.d.ts +131 -0
  102. package/dist/src/utils/docs-validator.d.ts.map +1 -0
  103. package/dist/src/utils/docs-validator.js +529 -0
  104. package/dist/src/utils/docs-validator.js.map +1 -0
  105. package/dist/src/utils/feature-id-collision.js +1 -1
  106. package/dist/src/utils/feature-id-collision.js.map +1 -1
  107. package/dist/src/utils/html-to-mdx.d.ts +1 -0
  108. package/dist/src/utils/html-to-mdx.d.ts.map +1 -1
  109. package/dist/src/utils/html-to-mdx.js +43 -5
  110. package/dist/src/utils/html-to-mdx.js.map +1 -1
  111. package/package.json +1 -1
  112. package/plugins/specweave/agents/pm/AGENT.md +10 -7
  113. package/plugins/specweave/commands/specweave-archive-features.md +5 -7
  114. package/plugins/specweave/commands/specweave-archive.md +2 -1
  115. package/plugins/specweave/commands/specweave-do.md +35 -1
  116. package/plugins/specweave/commands/specweave-done.md +96 -0
  117. package/plugins/specweave/commands/specweave-import-external.md +45 -18
  118. package/plugins/specweave/commands/specweave-increment.md +331 -33
  119. package/plugins/specweave/commands/specweave-jobs.md +2 -2
  120. package/plugins/specweave/commands/specweave-progress.md +4 -4
  121. package/plugins/specweave/commands/specweave-restore-feature.md +5 -4
  122. package/plugins/specweave/commands/specweave-sync-docs.md +1 -1
  123. package/plugins/specweave/commands/specweave-sync-specs.md +216 -322
  124. package/plugins/specweave/commands/specweave-validate-features.md +13 -8
  125. package/plugins/specweave/hooks/docs-changed.sh.backup +79 -0
  126. package/plugins/specweave/hooks/hooks.json +33 -4
  127. package/plugins/specweave/hooks/human-input-required.sh.backup +75 -0
  128. package/plugins/specweave/hooks/lib/common-setup.sh +375 -0
  129. package/plugins/specweave/hooks/lib/crash-prevention.sh +336 -0
  130. package/plugins/specweave/hooks/post-first-increment.sh.backup +61 -0
  131. package/plugins/specweave/hooks/post-increment-change.sh.backup +98 -0
  132. package/plugins/specweave/hooks/post-increment-completion.sh.backup +231 -0
  133. package/plugins/specweave/hooks/post-increment-planning.sh.backup +1048 -0
  134. package/plugins/specweave/hooks/post-increment-status-change.sh.backup +147 -0
  135. package/plugins/specweave/hooks/post-spec-update.sh.backup +158 -0
  136. package/plugins/specweave/hooks/post-task-completion.sh +4 -23
  137. package/plugins/specweave/hooks/post-user-story-complete.sh.backup +179 -0
  138. package/plugins/specweave/hooks/pre-command-deduplication.sh +1 -6
  139. package/plugins/specweave/hooks/pre-command-deduplication.sh.backup +83 -0
  140. package/plugins/specweave/hooks/pre-implementation.sh.backup +67 -0
  141. package/plugins/specweave/hooks/pre-task-completion.sh +8 -37
  142. package/plugins/specweave/hooks/pre-task-completion.sh.backup +194 -0
  143. package/plugins/specweave/hooks/pre-tool-use.sh +2 -11
  144. package/plugins/specweave/hooks/pre-tool-use.sh.backup +133 -0
  145. package/plugins/specweave/hooks/universal/dispatcher.mjs +135 -42
  146. package/plugins/specweave/hooks/universal/fail-fast-wrapper.sh +183 -0
  147. package/plugins/specweave/hooks/user-prompt-submit.sh +140 -38
  148. package/plugins/specweave/hooks/user-prompt-submit.sh.backup +386 -0
  149. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +12 -0
  150. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +89 -0
  151. package/plugins/specweave/hooks/v2/guards/bash-file-guard.sh +211 -0
  152. package/plugins/specweave/hooks/v2/guards/bash-file-guard.test.sh +163 -0
  153. package/plugins/specweave/hooks/v2/guards/completion-guard.sh +26 -28
  154. package/plugins/specweave/hooks/v2/guards/features-folder-guard.sh +50 -0
  155. package/plugins/specweave/lib/vendor/core/increment/duplicate-detector.js +2 -2
  156. package/plugins/specweave/lib/vendor/core/increment/duplicate-detector.js.map +1 -1
  157. package/plugins/specweave/scripts/README.md +166 -0
  158. package/plugins/specweave/scripts/cleanup-state.sh +142 -0
  159. package/plugins/specweave/scripts/force-kill.sh +142 -0
  160. package/plugins/specweave/scripts/jobs.js +171 -0
  161. package/plugins/specweave/scripts/progress.js +170 -0
  162. package/plugins/specweave/scripts/read-costs.sh +132 -0
  163. package/plugins/specweave/scripts/read-jobs.sh +324 -0
  164. package/plugins/specweave/scripts/read-progress.sh +185 -0
  165. package/plugins/specweave/scripts/read-status.sh +146 -0
  166. package/plugins/specweave/scripts/read-workflow.sh +173 -0
  167. package/plugins/specweave/scripts/rebuild-dashboard-cache.sh +327 -0
  168. package/plugins/specweave/scripts/session-watchdog.sh +192 -0
  169. package/plugins/specweave/scripts/status.js +154 -0
  170. package/plugins/specweave/scripts/update-dashboard-cache.sh +281 -0
  171. package/plugins/specweave/skills/increment-planner/SKILL.md +333 -24
  172. package/plugins/specweave/skills/increment-planner/templates/spec-multi-project.md +17 -9
  173. package/plugins/specweave/skills/increment-planner/templates/spec-single-project.md +6 -2
  174. package/plugins/specweave/skills/instant-status/SKILL.md +70 -0
  175. package/plugins/specweave-ado/hooks/post-living-docs-update.sh.backup +353 -0
  176. package/plugins/specweave-ado/hooks/post-task-completion.sh.backup +172 -0
  177. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
  178. package/plugins/specweave-docs/commands/build.md +32 -4
  179. package/plugins/specweave-docs/commands/preview.md +43 -1
  180. package/plugins/specweave-docs/commands/validate.md +250 -0
  181. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +1262 -0
  182. package/plugins/specweave-github/hooks/post-task-completion.sh.backup +258 -0
  183. package/plugins/specweave-github/lib/enhanced-github-sync.js +220 -0
  184. package/plugins/specweave-jira/hooks/post-task-completion.sh.backup +172 -0
  185. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +134 -0
  186. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +1254 -0
  187. package/plugins/specweave-release/hooks/post-task-completion.sh.backup +110 -0
  188. package/plugins/specweave/hooks/post-edit-spec.sh +0 -265
  189. package/plugins/specweave/hooks/post-write-spec.sh +0 -267
  190. package/plugins/specweave/hooks/pre-edit-spec.sh +0 -151
  191. package/plugins/specweave/hooks/pre-write-spec.sh +0 -151
@@ -1,446 +1,340 @@
1
1
  ---
2
2
  name: specweave:sync-specs
3
- description: Sync increment specifications to living docs structure. Auto-generates feature IDs for greenfield increments (FS-XXX). Use after completing an increment to make it visible in living docs.
3
+ description: Sync ALL increment specifications to living docs structure by default. Creates FS-XXX folders for each increment. Use with increment ID to sync single increment.
4
4
  ---
5
5
 
6
6
  # Sync Increment Specifications to Living Docs
7
7
 
8
- Syncs increment specs to living docs structure for stakeholder visibility. Auto-generates feature IDs for greenfield increments.
8
+ **DEFAULT BEHAVIOR**: Syncs ALL increments to living docs (not just one!)
9
9
 
10
10
  ---
11
11
 
12
- ## STEP 1: Parse Arguments
12
+ ## STEP 1: Parse Arguments & Determine Mode
13
13
 
14
14
  ```
15
- Arguments provided: [user's arguments]
15
+ Arguments provided: $ARGUMENTS
16
16
  ```
17
17
 
18
- **Parse the input**:
19
- - Check for increment ID: `0001`, `0002`, etc.
20
- - If no increment ID: find the most recent increment
21
- - Check for options: `--force`, `--dry-run`
18
+ **Parse the input to determine sync mode**:
22
19
 
23
- **Find increment**:
24
- ```bash
25
- if [[ -z "$INCREMENT_ID" ]]; then
26
- # Find most recent increment
27
- INCREMENT_ID=$(ls -1 .specweave/increments/ | grep -E '^[0-9]{4}-' | sort -r | head -1)
28
- fi
29
-
30
- # Verify increment exists
31
- INCREMENT_PATH=".specweave/increments/$INCREMENT_ID"
32
- if [[ ! -d "$INCREMENT_PATH" ]]; then
33
- echo "❌ Error: Increment $INCREMENT_ID not found"
34
- exit 1
35
- fi
36
- ```
20
+ | Input | Mode | Action |
21
+ |-------|------|--------|
22
+ | `/specweave:sync-specs` | **ALL** (default) | Sync ALL increments |
23
+ | `/specweave:sync-specs --all` | **ALL** (explicit) | Sync ALL increments |
24
+ | `/specweave:sync-specs 0106` | **SINGLE** | Sync only increment 0106 |
25
+ | `/specweave:sync-specs 0106 --dry-run` | **SINGLE + DRY** | Preview sync for 0106 |
26
+ | `/specweave:sync-specs --dry-run` | **ALL + DRY** | Preview sync for ALL |
37
27
 
38
- **Output**:
39
- ```
40
- 🎯 Target increment: {increment_id}
41
- 📁 Increment path: .specweave/increments/{increment_id}
42
- 🔄 Mode: Specs-only sync (Universal Hierarchy)
43
-
44
- Processing...
45
- ```
28
+ **CRITICAL**: No increment ID = sync ALL increments (this is the DEFAULT!)
46
29
 
47
30
  ---
48
31
 
49
- ## STEP 2: Check Prerequisites
50
-
51
- ### 2.1 Verify Spec File Exists
32
+ ## STEP 2: Execute Sync Based on Mode
52
33
 
53
- ```bash
54
- SPEC_FILE="$INCREMENT_PATH/spec.md"
55
- if [[ ! -f "$SPEC_FILE" ]]; then
56
- echo "❌ Error: No spec.md found in increment $INCREMENT_ID"
57
- echo " Cannot sync specs without a spec file"
58
- exit 1
59
- fi
60
- ```
34
+ ### MODE A: Sync ALL Increments (Default)
61
35
 
62
- ### 2.2 Check Tasks File (for bidirectional linking)
36
+ **This is the DEFAULT when no increment ID is provided!**
63
37
 
64
38
  ```bash
65
- TASKS_FILE="$INCREMENT_PATH/tasks.md"
66
- HAS_TASKS=false
67
- if [[ -f "$TASKS_FILE" ]]; then
68
- HAS_TASKS=true
69
- echo "✅ Found tasks.md - will create bidirectional links"
70
- else
71
- echo "⚠️ No tasks.md - spec will sync without task links"
72
- fi
39
+ # List ALL syncable increments (with spec.md)
40
+ ls -1 .specweave/increments/ | grep -E '^[0-9]{4}E?-' | sort
73
41
  ```
74
42
 
75
- ### 2.3 Read Metadata for External Links
43
+ **Execute sync for EACH increment**:
76
44
 
77
- ```bash
78
- METADATA_FILE="$INCREMENT_PATH/metadata.json"
79
- if [[ -f "$METADATA_FILE" ]]; then
80
- echo "✅ Found metadata.json - will include external links"
81
- else
82
- echo "⚠️ No metadata.json - no external tool links available"
83
- fi
84
45
  ```
46
+ 🔄 Syncing ALL increments to living docs...
85
47
 
86
- ---
87
-
88
- ## STEP 3: Execute Spec Sync
89
-
90
- ### 3.1 Run Sync Command
48
+ Found {N} increments with spec.md files.
49
+ ```
91
50
 
92
- **Execute the sync using the CLI command**:
51
+ **For each increment**, call the sync logic:
93
52
 
94
53
  ```typescript
95
- import { syncSpecs } from './dist/src/cli/commands/sync-specs.js';
96
-
97
- // Parse arguments
98
- const args = process.argv.slice(2); // e.g., ['0040', '--dry-run']
99
-
100
- // Execute sync
101
- await syncSpecs(args);
54
+ import { LivingDocsSync } from './src/core/living-docs/living-docs-sync.js';
55
+
56
+ const sync = new LivingDocsSync(projectRoot);
57
+
58
+ // Get all increment folders
59
+ const incrementsDir = '.specweave/increments';
60
+ const entries = fs.readdirSync(incrementsDir);
61
+ const increments = entries.filter(e => /^\d{4}E?-/.test(e));
62
+
63
+ let successCount = 0;
64
+ let failCount = 0;
65
+ const results = [];
66
+
67
+ for (const incrementId of increments.sort()) {
68
+ // Check if spec.md exists
69
+ const specPath = path.join(incrementsDir, incrementId, 'spec.md');
70
+ if (!fs.existsSync(specPath)) {
71
+ console.log(` ⚠️ Skipping ${incrementId} (no spec.md)`);
72
+ continue;
73
+ }
74
+
75
+ try {
76
+ const result = await sync.syncIncrement(incrementId, { dryRun, force });
77
+ if (result.success) {
78
+ successCount++;
79
+ results.push({ id: incrementId, featureId: result.featureId, status: '✅' });
80
+ } else {
81
+ failCount++;
82
+ results.push({ id: incrementId, featureId: '', status: '❌', error: result.errors[0] });
83
+ }
84
+ } catch (error) {
85
+ failCount++;
86
+ results.push({ id: incrementId, featureId: '', status: '❌', error: error.message });
87
+ }
88
+ }
102
89
  ```
103
90
 
104
- **This will**:
105
- 1. **Derive feature ID from increment number** (e.g., 0040 → FS-040, 0002 → FS-002)
106
- 2. **Read project/board from spec.md YAML frontmatter** (v0.31.0+ REQUIRED):
107
- - For 1-level: `project:` field REQUIRED
108
- - For 2-level: `project:` AND `board:` fields REQUIRED
109
- - See [ADR-0190](/internal/architecture/adr/0190-spec-project-board-requirement.md)
110
- 3. **Smart project matching fallback** (only if YAML fields missing - deprecated):
111
- - `**Project**:` field in spec.md body (legacy)
112
- - `multiProject.activeProject` in config.json
113
- - ADO area path / JIRA board mapping
114
- - Git remote (repo name)
115
- - **ASK USER if unsure** (multi-project mode)
116
- 4. Parse spec.md for user stories and acceptance criteria
117
- 5. Create living docs structure:
118
- - 1-level: `.specweave/docs/internal/specs/{project}/FS-XXX/`
119
- - 2-level: `.specweave/docs/internal/specs/{project}/{board}/FS-XXX/`
120
-
121
- **CRITICAL**: Feature ID is DERIVED from increment number (ADR-0187)
122
- - Increment 0002-user-authentication → FS-002
123
- - Increment 0040-some-feature → FS-040
124
- - NO date-based patterns like FS-YY-MM-DD-name
125
-
126
- ### 3.2 Project/Board Validation (v0.31.0+)
127
-
128
- **Structure Level Detection** (from `src/utils/structure-level-detector.ts`):
129
- - Detects 1-level vs 2-level from config (ADO, JIRA, umbrella, multiProject, folders)
130
- - Validates spec.md has required fields based on structure level
131
- - For 2-level: **ERROR if project OR board missing** (cannot sync)
132
- - For 1-level: **WARNING if project missing** (uses fallback, deprecated)
133
-
134
- **Expected spec.md frontmatter**:
135
-
136
- ```yaml
137
- # 1-level structure
138
- ---
139
- increment: 0001-feature-name
140
- project: my-project # REQUIRED for 1-level
141
- ---
142
-
143
- # 2-level structure
144
- ---
145
- increment: 0001-feature-name
146
- project: acme-corp # REQUIRED for 2-level
147
- board: clinical-insights # REQUIRED for 2-level
148
- ---
149
- ```
150
-
151
- **Migration**: See [Migration Guide](/public/guides/migration-v031-project-fields.md)
152
-
153
- ---
154
-
155
- ## STEP 4: Report Distribution Results
156
-
157
- ### 4.1 Show What Was Created
91
+ **Output summary table**:
158
92
 
159
93
  ```
160
94
  ═══════════════════════════════════════════════════════
161
- SPECS-ONLY SYNC COMPLETE
95
+ BULK SYNC COMPLETE
162
96
  ═══════════════════════════════════════════════════════
163
97
 
164
- Increment: {increment_id}
165
- Title: {title from spec.md}
98
+ | Increment | Feature ID | Status |
99
+ |-----------|------------|--------|
100
+ | 0093-ado-permission-profile-fixes | FS-093 | ✅ |
101
+ | 0094-unit-test-alignment | FS-094 | ✅ |
102
+ | 0095-per-project-epic-hierarchy | FS-095 | ✅ |
103
+ | ... | ... | ... |
166
104
 
167
105
  ───────────────────────────────────────────────────────
168
- 📊 UNIVERSAL HIERARCHY CREATED
106
+ 📊 SUMMARY
169
107
  ───────────────────────────────────────────────────────
170
108
 
171
- 📁 Epic (Optional):
172
- {if created}
173
- Path: .specweave/docs/internal/specs/_epics/{EPIC-ID}/EPIC.md
174
- Status: Created/Updated
175
-
176
- 📁 Feature (Required):
177
- Path: .specweave/docs/internal/specs/_features/{FS-ID}/FEATURE.md
178
- Status: Created/Updated
179
- Projects: {list of projects}
180
-
181
- 📁 Project Contexts:
182
- {for each project}
183
- • {project}: .specweave/docs/internal/specs/{project}/{FS-ID}/README.md
184
-
185
- 📝 User Stories:
186
- {for each project}
187
- {project}:
188
- {for each story}
189
- • {story-id}: {story-title}
190
- Path: .specweave/docs/internal/specs/{project}/{FS-ID}/{us-id}.md
109
+ Total increments: {N}
110
+ ✅ Succeeded: {successCount}
111
+ ❌ Failed: {failCount}
112
+ ⏭️ Skipped: {skippedCount} (no spec.md)
191
113
 
192
- ───────────────────────────────────────────────────────
193
- 🔗 BIDIRECTIONAL LINKING
194
- ───────────────────────────────────────────────────────
114
+ ═══════════════════════════════════════════════════════
115
+ ```
195
116
 
196
- {if tasks.md exists}
197
- ✅ Task → User Story Links:
198
- Updated tasks.md with user story references
199
- Each task now links to its parent user story
117
+ ### MODE B: Sync SINGLE Increment
200
118
 
201
- User Story Task Links:
202
- Each user story shows implementing tasks
203
- Tasks linked back to increment #{increment_id}
204
- {else}
205
- ⚠️ No tasks.md found - stories created without task links
206
- {/if}
119
+ **Only when a specific increment ID is provided**:
207
120
 
208
- ───────────────────────────────────────────────────────
209
- 📂 FILE STRUCTURE (v5.0.0+)
210
- ───────────────────────────────────────────────────────
121
+ ```
122
+ 🎯 Target increment: {increment_id}
123
+ 📁 Increment path: .specweave/increments/{increment_id}
124
+ 🔄 Mode: Single increment sync
125
+ ```
211
126
 
212
- **NO _features folder** - Features live directly in project folders!
213
-
214
- **Project folder detection** (priority order):
215
- 1. `**Project**:` field in spec.md (explicit)
216
- 2. `multiProject.activeProject` in config.json
217
- 3. ADO area path mapping / JIRA board mapping
218
- 4. Git remote (repo name)
219
- 5. **ASK USER if multi-project mode and unsure**
220
-
221
- .specweave/docs/internal/specs/
222
- ├── {project}/ ← Features + stories together
223
- │ └── FS-XXX/ ← Feature ID derived from increment (0002 → FS-002)
224
- │ ├── FEATURE.md ← Feature overview
225
- │ ├── us-001-{title}.md ← User story 1
226
- │ ├── us-002-{title}.md ← User story 2
227
- │ └── ...
228
- ├── _epics/ ← Optional (SAFe/large orgs only)
229
- │ └── EP-XXX/
230
- │ └── EPIC.md
231
- └── _archive/ ← Archived features
232
- └── {project}/FS-XXX/
127
+ **Execute single sync**:
233
128
 
234
- ───────────────────────────────────────────────────────
235
- 🎯 WHAT THIS SYNC DID
236
- ───────────────────────────────────────────────────────
129
+ ```typescript
130
+ const result = await sync.syncIncrement(incrementId, { dryRun, force });
131
+ ```
237
132
 
238
- ✅ Parsed increment spec.md
239
- ✅ Derived Feature ID from increment number (e.g., 0002 → FS-002)
240
- ✅ Detected project folder (or asked user if unsure)
241
- Generated hierarchical structure in {project}/FS-XXX/
242
- ✅ Created bidirectional links (if tasks.md exists)
243
- ✅ Preserved external tool links (GitHub/Jira/ADO)
133
+ **Output**:
134
+ ```
135
+ ═══════════════════════════════════════════════════════
136
+ SINGLE INCREMENT SYNC COMPLETE
137
+ ═══════════════════════════════════════════════════════
244
138
 
245
- DID NOT UPDATE:
246
- Architecture decisions (ADRs)
247
- Operations docs (runbooks, deployment)
248
- • Delivery docs (CI/CD, testing)
249
- • Governance docs (security, compliance)
250
- • Strategy docs (PRDs, roadmaps)
139
+ Increment: {increment_id}
140
+ Feature ID: FS-{XXX} (derived from increment number)
141
+ Project: {project}
251
142
 
252
- This command ONLY syncs specs folder content!
143
+ Files created:
144
+ • {project}/FS-{XXX}/FEATURE.md
145
+ • {project}/FS-{XXX}/us-001-*.md
146
+ • {project}/FS-{XXX}/us-002-*.md
147
+ ...
253
148
 
254
149
  ═══════════════════════════════════════════════════════
255
150
  ```
256
151
 
257
152
  ---
258
153
 
259
- ## STEP 5: Next Steps Guidance
154
+ ## STEP 3: Identify Missing/New Specs
260
155
 
261
- ```
262
- 🎯 NEXT STEPS
263
- ───────────────────────────────────────────────────────
264
-
265
- 1. Review generated specs:
266
- cd .specweave/docs/internal/specs/
267
- ls -la {project}/{FS-ID}/
268
-
269
- 2. Verify bidirectional links (if applicable):
270
- • Check tasks.md has "User Story:" links
271
- • Check user stories have "Implementation:" sections
272
-
273
- 3. Sync to external tools (if configured):
274
- {if GitHub configured}
275
- • GitHub: /specweave-github:sync-spec
276
- {/if}
277
- {if Jira configured}
278
- • Jira: /specweave-jira:sync-spec
279
- {/if}
280
- {if ADO configured}
281
- • Azure DevOps: /specweave-ado:sync-spec
282
- {/if}
283
-
284
- 4. Update other docs (if needed):
285
- • Full sync: /specweave:sync-docs
286
- • Architecture only: Update ADRs manually
287
- • Operations only: Update runbooks manually
288
-
289
- 5. Commit changes:
290
- git add .specweave/docs/internal/specs/
291
- git commit -m "docs: sync specs from increment {increment_id}"
292
- ```
156
+ After sync, compare increments vs specs:
293
157
 
294
- ---
158
+ ```bash
159
+ # Get all increment numbers
160
+ INCREMENT_NUMS=$(ls -1 .specweave/increments/ | grep -E '^[0-9]{4}E?-' | sed 's/^\([0-9]*E\?\).*/\1/')
295
161
 
296
- ## ERROR HANDLING
162
+ # Get all FS-XXX folders in specs
163
+ SPEC_NUMS=$(ls -1 .specweave/docs/internal/specs/*/FS-* 2>/dev/null | grep -oE 'FS-[0-9]+E?' | sed 's/FS-//')
297
164
 
298
- ### Error: Increment Not Found
165
+ # Find missing (increments without corresponding FS-XXX)
166
+ echo "Checking for gaps..."
299
167
  ```
300
- ❌ Error: Increment '{increment_id}' not found
301
168
 
302
- Available increments:
303
- {list .specweave/increments/*/}
304
-
305
- Usage: /specweave:sync-specs [increment_id] [--dry-run]
306
- ```
169
+ **Report gaps** (increments without corresponding specs):
307
170
 
308
- ### Error: No Spec File
309
171
  ```
310
- Error: No spec.md in increment '{increment_id}'
172
+ 📊 GAP ANALYSIS
173
+ ───────────────────────────────────────────────────────
311
174
 
312
- The increment must have a spec.md file to sync specs.
313
- Check: .specweave/increments/{increment_id}/spec.md
175
+ {if gaps found}
176
+ ⚠️ Found {N} increments without corresponding specs:
177
+ • 0106-ci-health-improvements → FS-106 missing
178
+ • 0113-enhanced-living-docs-architecture → FS-113 missing
314
179
 
315
- Cannot proceed with specs sync.
180
+ These were synced in this run.
181
+ {else}
182
+ ✅ All increments have corresponding spec folders!
183
+ {/if}
316
184
  ```
317
185
 
318
- ### Error: Distribution Failed
319
- ```
320
- ❌ Error: Failed to distribute specs
186
+ ---
321
187
 
322
- Reason: {error message}
188
+ ## STEP 4: Feature ID Derivation Rules
323
189
 
324
- Common causes:
325
- • Invalid spec.md format
326
- • Missing user stories
327
- • Corrupted YAML frontmatter
190
+ **CRITICAL**: Feature ID is ALWAYS derived from increment number:
328
191
 
329
- Try: /specweave:validate {increment_id}
330
- ```
192
+ | Increment ID | Feature ID |
193
+ |--------------|------------|
194
+ | 0002-user-authentication | FS-002 |
195
+ | 0040-some-feature | FS-040 |
196
+ | 0106-ci-health | FS-106 |
197
+ | 0111E-dora-metrics-fix | FS-111E |
198
+
199
+ **Rules**:
200
+ - Increment `XXXX-name` → Feature `FS-XXX` (3-digit minimum)
201
+ - Increment `XXXXE-name` (external) → Feature `FS-XXXE`
202
+ - NO date-based patterns (FS-YY-MM-DD-name is WRONG)
203
+ - See ADR-0187 for rationale
331
204
 
332
205
  ---
333
206
 
334
207
  ## OPTIONS
335
208
 
336
209
  ### --dry-run
337
- Show what would be synced without making changes:
210
+ Preview what would be synced without making changes:
338
211
 
339
212
  ```bash
340
- /specweave:sync-specs 0031 --dry-run
341
- ```
342
-
343
- Output:
344
- ```
345
- 🔍 DRY RUN MODE - No files will be modified
346
-
347
- Would create/update:
348
- • Feature: specweave/FS-031/FEATURE.md
349
- • User story: specweave/FS-031/us-001-api-sync.md
350
- • User story: specweave/FS-031/us-002-status-mapping.md
351
- • Tasks.md: Would add 5 user story links
352
-
353
- Total: 4 files would be affected
354
-
355
- Note: Feature ID FS-031 derived from increment number 0031
213
+ /specweave:sync-specs --dry-run # Preview ALL
214
+ /specweave:sync-specs 0106 --dry-run # Preview single
356
215
  ```
357
216
 
358
217
  ### --force
359
218
  Overwrite existing files without prompting:
360
219
 
361
220
  ```bash
362
- /specweave:sync-specs 0031 --force
221
+ /specweave:sync-specs --force # Force ALL
222
+ /specweave:sync-specs 0106 --force # Force single
363
223
  ```
364
224
 
365
225
  ---
366
226
 
367
227
  ## EXAMPLES
368
228
 
369
- ### Example 1: Sync Current Increment
229
+ ### Example 1: Sync ALL (Default - Most Common)
370
230
  ```
371
231
  User: /specweave:sync-specs
372
232
 
373
233
  Output:
374
- 🎯 Target increment: 0031-external-tool-status-sync
375
- 📁 Increment path: .specweave/increments/0031-external-tool-status-sync
376
- 🔄 Mode: Specs-only sync
377
-
378
- Processing...
379
- ✅ Distribution successful!
380
- 📊 Total stories: 7
381
- 📁 Total files created: 10
382
- 🎯 Feature ID: FS-031 (derived from increment 0031)
383
- 📁 Project folder: specweave/FS-031/
234
+ 🔄 Syncing ALL increments to living docs...
235
+
236
+ Found 25 increments with spec.md files.
237
+
238
+ | Increment | Feature ID | Status |
239
+ |-----------|------------|--------|
240
+ | 0093-ado-permission-profile-fixes | FS-093 | ✅ |
241
+ | 0094-unit-test-alignment | FS-094 | ✅ |
242
+ | 0095-per-project-epic-hierarchy | FS-095 | |
243
+ | 0096-ado-import-fixes | FS-096 | ✅ |
244
+ | 0097-umbrella-module-detection | FS-097 | ✅ |
245
+ | ... | ... | ... |
246
+ | 0116-livingspec-universal-standard | FS-116 | ✅ |
247
+
248
+ 📊 SUMMARY: 25 succeeded, 0 failed
384
249
  ```
385
250
 
386
- ### Example 2: Sync Specific Increment
251
+ ### Example 2: Sync Single Increment
387
252
  ```
388
- User: /specweave:sync-specs 0025
253
+ User: /specweave:sync-specs 0106
389
254
 
390
255
  Output:
391
- 🎯 Target increment: 0025-per-project-resource-config
392
- 📁 Increment path: .specweave/increments/0025-per-project-resource-config
393
- 🔄 Mode: Specs-only sync (Universal Hierarchy)
394
-
395
- Processing...
396
- Distribution successful!
397
- 📊 Total stories: 3
398
- 📁 Total files created: 5
256
+ 🎯 Target increment: 0106-ci-health-improvements
257
+ 📁 Increment path: .specweave/increments/0106-ci-health-improvements
258
+ 🔄 Mode: Single increment sync
259
+
260
+ ✅ Synced 0106-ci-health-improvements → FS-106
261
+ Created: specweave/FS-106/FEATURE.md
262
+ Created: specweave/FS-106/us-001-*.md
399
263
  ```
400
264
 
401
- ### Example 3: Dry Run
265
+ ### Example 3: Dry Run ALL
402
266
  ```
403
- User: /specweave:sync-specs 0031 --dry-run
267
+ User: /specweave:sync-specs --dry-run
404
268
 
405
269
  Output:
406
270
  🔍 DRY RUN MODE - No files will be modified
407
271
 
408
- Would sync increment: 0031-external-tool-status-sync
409
- Would create feature: FS-031 (derived from increment 0031)
410
- Would use project folder: specweave/FS-031/
411
- Would create 7 user stories
412
- Would update tasks.md with bidirectional links
272
+ Would sync 25 increments:
273
+ 0093 FS-093 (exists, would update)
274
+ 0094 FS-094 (exists, would update)
275
+ 0106 FS-106 (NEW - would create)
276
+ 0113 FS-113 (NEW - would create)
277
+ ...
413
278
 
414
279
  No changes made (dry run mode)
415
280
  ```
416
281
 
417
282
  ---
418
283
 
284
+ ## ERROR HANDLING
285
+
286
+ ### Error: No Increments Found
287
+ ```
288
+ ❌ Error: No increments found in .specweave/increments/
289
+
290
+ Create an increment first:
291
+ /specweave:increment "feature name"
292
+ ```
293
+
294
+ ### Error: Specific Increment Not Found
295
+ ```
296
+ ❌ Error: Increment '0999' not found
297
+
298
+ Available increments:
299
+ 0093-ado-permission-profile-fixes
300
+ 0094-unit-test-alignment
301
+ ...
302
+
303
+ Usage: /specweave:sync-specs [increment_id]
304
+ ```
305
+
306
+ ### Error: Missing spec.md
307
+ ```
308
+ ⚠️ Skipping 0107-incomplete-feature (no spec.md)
309
+
310
+ Increment must have a spec.md file to sync.
311
+ ```
312
+
313
+ ---
314
+
419
315
  ## IMPORTANT NOTES
420
316
 
421
- 1. **Specs-only**: This command ONLY updates `.specweave/docs/internal/specs/` folder
422
- 2. **Universal Hierarchy**: Uses Epic Feature User Story Task structure
423
- 3. **Bidirectional Links**: Automatically creates if tasks.md exists
424
- 4. **Project-aware**: Distributes stories to correct project folders
425
- 5. **Non-destructive**: Creates backups before overwriting (unless --force)
426
- 6. **External Links**: Preserves GitHub/Jira/ADO links from metadata.json
317
+ 1. **DEFAULT = ALL**: Running without arguments syncs ALL increments
318
+ 2. **Idempotent**: Safe to run multiple times (updates existing, creates missing)
319
+ 3. **Feature ID derivation**: Always from increment number (not stored in metadata)
320
+ 4. **Project detection**: Reads `project:` from spec.md YAML frontmatter
321
+ 5. **External sync**: Triggers GitHub/JIRA/ADO sync if configured
427
322
 
428
323
  ---
429
324
 
430
325
  ## WHEN TO USE THIS COMMAND
431
326
 
432
- ✅ **Use `/specweave:sync-specs` when**:
433
- - You only want to update user stories and features
434
- - You've made changes to spec.md and want them in living docs
435
- - You want to preserve existing architecture/operations docs
436
- - You need quick spec sync without full documentation update
327
+ ✅ **Use `/specweave:sync-specs` (no args) when**:
328
+ - You want to ensure ALL increments are in living docs
329
+ - After creating multiple increments
330
+ - To fix gaps in specs folder
331
+ - Regular maintenance sync
437
332
 
438
- **Use `/specweave:sync-docs` instead when**:
439
- - You want to update ALL documentation areas
440
- - You have new architecture decisions (ADRs)
441
- - You updated operations/deployment docs
442
- - You need comprehensive documentation sync
333
+ **Use `/specweave:sync-specs <id>` when**:
334
+ - You only want to sync one specific increment
335
+ - After updating a single spec.md
336
+ - Debugging sync issues for one increment
443
337
 
444
338
  ---
445
339
 
446
- **You are now ready to execute this specs-only sync command. Follow the steps above precisely.**
340
+ **Execute this command now. Default = sync ALL increments.**