specweave 0.22.2 → 0.22.4

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 (93) hide show
  1. package/CLAUDE.md +300 -920
  2. package/dist/src/cli/commands/repair-status-desync.d.ts +69 -0
  3. package/dist/src/cli/commands/repair-status-desync.d.ts.map +1 -0
  4. package/dist/src/cli/commands/repair-status-desync.js +221 -0
  5. package/dist/src/cli/commands/repair-status-desync.js.map +1 -0
  6. package/dist/src/cli/commands/sync-specs.d.ts +4 -1
  7. package/dist/src/cli/commands/sync-specs.d.ts.map +1 -1
  8. package/dist/src/cli/commands/sync-specs.js +99 -49
  9. package/dist/src/cli/commands/sync-specs.js.map +1 -1
  10. package/dist/src/cli/commands/validate-status-sync.d.ts +52 -0
  11. package/dist/src/cli/commands/validate-status-sync.d.ts.map +1 -0
  12. package/dist/src/cli/commands/validate-status-sync.js +176 -0
  13. package/dist/src/cli/commands/validate-status-sync.js.map +1 -0
  14. package/dist/src/cli/update-status-line.d.ts +16 -0
  15. package/dist/src/cli/update-status-line.d.ts.map +1 -0
  16. package/dist/src/cli/update-status-line.js +44 -0
  17. package/dist/src/cli/update-status-line.js.map +1 -0
  18. package/dist/src/core/cicd/workflow-monitor.d.ts +4 -0
  19. package/dist/src/core/cicd/workflow-monitor.d.ts.map +1 -1
  20. package/dist/src/core/cicd/workflow-monitor.js +6 -2
  21. package/dist/src/core/cicd/workflow-monitor.js.map +1 -1
  22. package/dist/src/core/increment/completion-validator.d.ts +56 -0
  23. package/dist/src/core/increment/completion-validator.d.ts.map +1 -0
  24. package/dist/src/core/increment/completion-validator.js +102 -0
  25. package/dist/src/core/increment/completion-validator.js.map +1 -0
  26. package/dist/src/core/increment/increment-archiver.d.ts +4 -1
  27. package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
  28. package/dist/src/core/increment/increment-archiver.js +21 -9
  29. package/dist/src/core/increment/increment-archiver.js.map +1 -1
  30. package/dist/src/core/increment/metadata-manager.d.ts +22 -0
  31. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  32. package/dist/src/core/increment/metadata-manager.js +62 -0
  33. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  34. package/dist/src/core/increment/spec-frontmatter-updater.d.ts +78 -0
  35. package/dist/src/core/increment/spec-frontmatter-updater.d.ts.map +1 -0
  36. package/dist/src/core/increment/spec-frontmatter-updater.js +152 -0
  37. package/dist/src/core/increment/spec-frontmatter-updater.js.map +1 -0
  38. package/dist/src/core/increment/spec-sync-manager.d.ts +5 -1
  39. package/dist/src/core/increment/spec-sync-manager.d.ts.map +1 -1
  40. package/dist/src/core/increment/spec-sync-manager.js +4 -2
  41. package/dist/src/core/increment/spec-sync-manager.js.map +1 -1
  42. package/dist/src/core/increment-utils.d.ts.map +1 -1
  43. package/dist/src/core/increment-utils.js +18 -1
  44. package/dist/src/core/increment-utils.js.map +1 -1
  45. package/dist/src/core/living-docs/living-docs-sync.d.ts +5 -1
  46. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  47. package/dist/src/core/living-docs/living-docs-sync.js +36 -33
  48. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  49. package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -1
  50. package/dist/src/core/living-docs/task-project-specific-generator.js +13 -8
  51. package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -1
  52. package/dist/src/core/status-line/status-line-manager.d.ts +3 -2
  53. package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
  54. package/dist/src/core/status-line/status-line-manager.js +42 -17
  55. package/dist/src/core/status-line/status-line-manager.js.map +1 -1
  56. package/dist/src/core/status-line/status-line-updater.d.ts +67 -0
  57. package/dist/src/core/status-line/status-line-updater.d.ts.map +1 -0
  58. package/dist/src/core/status-line/status-line-updater.js +203 -0
  59. package/dist/src/core/status-line/status-line-updater.js.map +1 -0
  60. package/dist/src/core/status-line/types.d.ts +19 -5
  61. package/dist/src/core/status-line/types.d.ts.map +1 -1
  62. package/dist/src/core/status-line/types.js +3 -3
  63. package/dist/src/core/status-line/types.js.map +1 -1
  64. package/dist/src/integrations/jira/jira-incremental-mapper.d.ts.map +1 -1
  65. package/dist/src/integrations/jira/jira-incremental-mapper.js +4 -0
  66. package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
  67. package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
  68. package/dist/src/integrations/jira/jira-mapper.js +4 -0
  69. package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
  70. package/dist/src/utils/logger.d.ts +48 -0
  71. package/dist/src/utils/logger.d.ts.map +1 -0
  72. package/dist/src/utils/logger.js +53 -0
  73. package/dist/src/utils/logger.js.map +1 -0
  74. package/package.json +3 -2
  75. package/plugins/specweave/agents/code-standards-detective/AGENT.md +828 -0
  76. package/plugins/specweave/agents/test-aware-planner/templates/task-non-testable.md.template +12 -0
  77. package/plugins/specweave/agents/test-aware-planner/templates/task-testable.md.template +12 -0
  78. package/plugins/specweave/commands/specweave-analyze-standards.sh +315 -0
  79. package/plugins/specweave/commands/specweave-done.md +91 -4
  80. package/plugins/specweave/commands/specweave-reopen.md +29 -2
  81. package/plugins/specweave/commands/specweave-sync-docs.md +137 -22
  82. package/plugins/specweave/commands/specweave-update-status.md +151 -0
  83. package/plugins/specweave/hooks/lib/update-status-line.sh +39 -8
  84. package/plugins/specweave/hooks/user-prompt-submit.sh +21 -0
  85. package/plugins/specweave/hooks/validate-increment-completion.sh +113 -0
  86. package/plugins/specweave/skills/brownfield-analyzer/SKILL.md +40 -3
  87. package/plugins/specweave/skills/code-standards-analyzer/SKILL.md +455 -0
  88. package/plugins/specweave/templates/coding-standards.md.template +447 -0
  89. package/plugins/specweave-ado/lib/ado-multi-project-sync.js +0 -1
  90. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +21 -0
  91. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
  92. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -170
  93. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +0 -3222
@@ -6,6 +6,18 @@
6
6
  **Estimate**: {estimate} hours
7
7
  **Status**: [ ] pending
8
8
 
9
+ **⚠️ SOURCE OF TRUTH REMINDER** (for AI agents):
10
+ ```
11
+ When you complete this task:
12
+ 1. ✅ Update internal TODO: TodoWrite([{task: "T-{task_number}", status: "completed"}])
13
+ 2. ⚠️ IMMEDIATELY update this line: **Status**: [ ] pending → **Status**: [x] completed
14
+ 3. ⚠️ IMMEDIATELY update spec.md: - [ ] **AC-{ac_ids}** → - [x] **AC-{ac_ids}**
15
+ 4. ✅ Verify both files before moving to next task
16
+
17
+ NEVER mark internal TODO as complete without updating these source files!
18
+ See CLAUDE.md Rule #7 for details.
19
+ ```
20
+
9
21
  **Test Plan**: N/A ({task_type} task)
10
22
 
11
23
  **Validation**:
@@ -6,6 +6,18 @@
6
6
  **Estimate**: {estimate} hours
7
7
  **Status**: [ ] pending
8
8
 
9
+ **⚠️ SOURCE OF TRUTH REMINDER** (for AI agents):
10
+ ```
11
+ When you complete this task:
12
+ 1. ✅ Update internal TODO: TodoWrite([{task: "T-{task_number}", status: "completed"}])
13
+ 2. ⚠️ IMMEDIATELY update this line: **Status**: [ ] pending → **Status**: [x] completed
14
+ 3. ⚠️ IMMEDIATELY update spec.md: - [ ] **AC-{ac_ids}** → - [x] **AC-{ac_ids}**
15
+ 4. ✅ Verify both files before moving to next task
16
+
17
+ NEVER mark internal TODO as complete without updating these source files!
18
+ See CLAUDE.md Rule #7 for details.
19
+ ```
20
+
9
21
  **Test Plan**:
10
22
  - **Given** {given_condition}
11
23
  - **When** {when_action}
@@ -0,0 +1,315 @@
1
+ #!/usr/bin/env bash
2
+ # ---
3
+ # name: specweave-analyze-standards
4
+ # description: Analyze and document coding standards from codebase. Detects naming conventions, import patterns, type usage, and anti-patterns. Generates evidence-based standards documentation with confidence levels. Supports full analysis, drift detection, and standards updates.
5
+ # usage: /specweave:analyze-standards [--drift] [--update] [--verbose]
6
+ # ---
7
+
8
+ set -e
9
+
10
+ # Detect project root (where .specweave/ is located)
11
+ PROJECT_ROOT="$(pwd)"
12
+ while [[ ! -d "$PROJECT_ROOT/.specweave" ]] && [[ "$PROJECT_ROOT" != "/" ]]; do
13
+ PROJECT_ROOT="$(dirname "$PROJECT_ROOT")"
14
+ done
15
+
16
+ if [[ ! -d "$PROJECT_ROOT/.specweave" ]]; then
17
+ echo "❌ Error: Not in a SpecWeave project (no .specweave/ directory found)"
18
+ exit 1
19
+ fi
20
+
21
+ cd "$PROJECT_ROOT"
22
+
23
+ # Parse arguments
24
+ MODE="full"
25
+ VERBOSE=false
26
+
27
+ while [[ $# -gt 0 ]]; do
28
+ case $1 in
29
+ --drift)
30
+ MODE="drift"
31
+ shift
32
+ ;;
33
+ --update)
34
+ MODE="update"
35
+ shift
36
+ ;;
37
+ --verbose)
38
+ VERBOSE=true
39
+ shift
40
+ ;;
41
+ *)
42
+ echo "❌ Unknown option: $1"
43
+ echo "Usage: /specweave:analyze-standards [--drift] [--update] [--verbose]"
44
+ exit 1
45
+ ;;
46
+ esac
47
+ done
48
+
49
+ # Ensure governance directory exists
50
+ GOVERNANCE_DIR="$PROJECT_ROOT/.specweave/docs/internal/governance"
51
+ mkdir -p "$GOVERNANCE_DIR"
52
+
53
+ # Display banner
54
+ echo "🔍 Code Standards Analysis"
55
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
56
+ echo ""
57
+
58
+ case $MODE in
59
+ full)
60
+ echo "Mode: Full Analysis"
61
+ echo "Output: $GOVERNANCE_DIR/coding-standards-analysis.md"
62
+ echo ""
63
+ echo "📊 Analyzing codebase..."
64
+ echo ""
65
+
66
+ # Launch code-standards-detective agent
67
+ cat <<'AGENT_PROMPT'
68
+ You are the code-standards-detective agent. Perform a complete coding standards analysis:
69
+
70
+ ## Your Mission
71
+
72
+ Analyze this codebase and generate comprehensive coding standards documentation.
73
+
74
+ ## Steps
75
+
76
+ ### Phase 1: Explicit Standards (5 seconds)
77
+ 1. Check for existing `.specweave/docs/internal/governance/coding-standards.md`
78
+ 2. Parse ESLint config (`.eslintrc.json`, `.eslintrc.js`)
79
+ 3. Parse Prettier config (`.prettierrc`, `.prettierrc.json`)
80
+ 4. Parse TypeScript config (`tsconfig.json`)
81
+ 5. Extract standards from `CLAUDE.md`, `CONTRIBUTING.md`
82
+
83
+ ### Phase 2: Implicit Standards (30 seconds)
84
+ 1. Find all source files: `src/**/*.{ts,js,tsx,jsx}`
85
+ 2. Analyze naming conventions (variables, functions, classes, constants)
86
+ 3. Detect import patterns (extensions, ordering)
87
+ 4. Measure function characteristics (length, style)
88
+ 5. Assess type usage (any, interfaces vs types)
89
+ 6. Identify error handling patterns
90
+
91
+ ### Phase 3: Anti-Pattern Detection (15 seconds)
92
+ 1. Detect console.* usage in src/
93
+ 2. Find hardcoded secrets (API keys, passwords)
94
+ 3. Identify large files (>500 lines)
95
+ 4. Find long functions (>100 lines)
96
+ 5. Check error handling coverage
97
+ 6. Detect N+1 query patterns
98
+
99
+ ### Phase 4: Documentation Generation (10 seconds)
100
+ 1. Merge explicit + implicit standards
101
+ 2. Calculate confidence levels
102
+ 3. Extract real code examples
103
+ 4. Highlight inconsistencies
104
+ 5. Provide recommendations
105
+
106
+ ## Output
107
+
108
+ Write comprehensive analysis to:
109
+ `.specweave/docs/internal/governance/coding-standards-analysis.md`
110
+
111
+ Include:
112
+ - Summary with confidence levels
113
+ - Naming conventions with examples
114
+ - Import patterns
115
+ - Function guidelines
116
+ - Type safety assessment
117
+ - Error handling analysis
118
+ - Anti-patterns and security issues
119
+ - Actionable recommendations
120
+
121
+ ## Console Summary
122
+
123
+ Print summary to stdout:
124
+ ```
125
+ ✅ Analysis complete!
126
+
127
+ 📊 Summary:
128
+ - Files: X
129
+ - LOC: Y
130
+ - Confidence: Z%
131
+
132
+ ✅ Strengths: [list]
133
+ ⚠️ Issues: [list]
134
+
135
+ 📄 Full report: .specweave/docs/internal/governance/coding-standards-analysis.md
136
+ ```
137
+
138
+ Execute the analysis now.
139
+ AGENT_PROMPT
140
+ ;;
141
+
142
+ drift)
143
+ echo "Mode: Drift Detection"
144
+ echo ""
145
+
146
+ # Check if standards exist
147
+ if [[ ! -f "$GOVERNANCE_DIR/coding-standards.md" ]]; then
148
+ echo "❌ Error: No coding standards found at:"
149
+ echo " $GOVERNANCE_DIR/coding-standards.md"
150
+ echo ""
151
+ echo "💡 Tip: Run /specweave:analyze-standards first to generate baseline standards"
152
+ exit 1
153
+ fi
154
+
155
+ echo "📊 Comparing declared standards vs actual code..."
156
+ echo ""
157
+
158
+ # Launch agent in drift-detection mode
159
+ cat <<'AGENT_PROMPT'
160
+ You are the code-standards-detective agent in DRIFT DETECTION mode.
161
+
162
+ ## Your Mission
163
+
164
+ Compare declared coding standards against actual codebase to detect drift.
165
+
166
+ ## Steps
167
+
168
+ 1. Read existing standards:
169
+ `.specweave/docs/internal/governance/coding-standards.md`
170
+
171
+ 2. Analyze current codebase (same as Phase 2-3 in full analysis)
172
+
173
+ 3. Compare declared vs actual:
174
+ - For each declared standard, check compliance percentage
175
+ - Identify violations
176
+ - Calculate drift score
177
+
178
+ 4. Report findings:
179
+ - Standards with high compliance (90%+) ✅
180
+ - Standards with drift (70-89%) ⚠️
181
+ - Standards violated (<70%) 🔴
182
+
183
+ ## Output Format
184
+
185
+ ```markdown
186
+ # Standards Drift Report
187
+
188
+ **Date**: {timestamp}
189
+ **Overall Compliance**: {percentage}%
190
+
191
+ ## ✅ Compliant Standards (90%+)
192
+ - Naming conventions: 98% compliant
193
+ - Import extensions: 100% compliant
194
+
195
+ ## ⚠️ Drift Detected (70-89%)
196
+ - Constant naming: 85% compliant (15% use camelCase instead of UPPER_SNAKE_CASE)
197
+ - Recommendation: Update 8 files or relax standard
198
+
199
+ ## 🔴 Violations (<70%)
200
+ - Function length: 65% compliant (35% have functions >100 lines)
201
+ - Critical: src/core/orchestrator.ts:processIncrement() - 156 lines
202
+ - Recommendation: Refactor large functions or update standard
203
+
204
+ ## New Patterns Detected
205
+ - Pattern: Using Zod for validation (34% of files)
206
+ - Not documented in standards
207
+ - Recommendation: Add to official standards
208
+ ```
209
+
210
+ Write to: `.specweave/docs/internal/governance/coding-standards-drift.md`
211
+
212
+ Print summary to stdout.
213
+
214
+ Execute drift detection now.
215
+ AGENT_PROMPT
216
+ ;;
217
+
218
+ update)
219
+ echo "Mode: Update Standards"
220
+ echo ""
221
+
222
+ # Check if analysis exists
223
+ if [[ ! -f "$GOVERNANCE_DIR/coding-standards-analysis.md" ]]; then
224
+ echo "⚠️ No analysis found. Running full analysis first..."
225
+ echo ""
226
+ MODE="full"
227
+ # Re-run in full mode (recursive call avoided by changing MODE)
228
+ fi
229
+
230
+ echo "📊 Generating updated standards..."
231
+ echo ""
232
+
233
+ # Launch agent in update mode
234
+ cat <<'AGENT_PROMPT'
235
+ You are the code-standards-detective agent in UPDATE mode.
236
+
237
+ ## Your Mission
238
+
239
+ Update official coding standards based on latest analysis.
240
+
241
+ ## Steps
242
+
243
+ 1. Read existing standards (if exist):
244
+ `.specweave/docs/internal/governance/coding-standards.md`
245
+
246
+ 2. Read latest analysis:
247
+ `.specweave/docs/internal/governance/coding-standards-analysis.md`
248
+
249
+ 3. Merge intelligently:
250
+ - Keep manually curated sections
251
+ - Update statistics from analysis
252
+ - Add new patterns if high confidence (>90%)
253
+ - Flag conflicts for human review
254
+
255
+ 4. Generate updated standards document
256
+
257
+ ## Important Rules
258
+
259
+ - NEVER remove manually written content without asking
260
+ - Mark auto-generated sections clearly
261
+ - Add "Last Updated" timestamp
262
+ - Preserve human rationale/explanations
263
+ - Flag breaking changes
264
+
265
+ ## Output
266
+
267
+ Write to: `.specweave/docs/internal/governance/coding-standards.md`
268
+
269
+ Also write summary to: `.specweave/docs/internal/governance/coding-standards-history.md`
270
+ - Append entry with timestamp
271
+ - List what changed
272
+ - Explain why
273
+
274
+ Execute update now.
275
+ AGENT_PROMPT
276
+ ;;
277
+ esac
278
+
279
+ echo ""
280
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
281
+ echo "✅ Code standards analysis complete!"
282
+ echo ""
283
+ echo "📂 Files generated:"
284
+ case $MODE in
285
+ full)
286
+ echo " - $GOVERNANCE_DIR/coding-standards-analysis.md"
287
+ ;;
288
+ drift)
289
+ echo " - $GOVERNANCE_DIR/coding-standards-drift.md"
290
+ ;;
291
+ update)
292
+ echo " - $GOVERNANCE_DIR/coding-standards.md (updated)"
293
+ echo " - $GOVERNANCE_DIR/coding-standards-history.md (appended)"
294
+ ;;
295
+ esac
296
+ echo ""
297
+ echo "🎯 Next steps:"
298
+ case $MODE in
299
+ full)
300
+ echo " 1. Review the analysis report"
301
+ echo " 2. Fix critical issues (hardcoded secrets, etc.)"
302
+ echo " 3. Run /specweave:analyze-standards --update to formalize"
303
+ ;;
304
+ drift)
305
+ echo " 1. Review drift report"
306
+ echo " 2. Fix violations or update standards"
307
+ echo " 3. Re-run analysis to verify"
308
+ ;;
309
+ update)
310
+ echo " 1. Review updated standards"
311
+ echo " 2. Commit to git if satisfied"
312
+ echo " 3. Share with team"
313
+ ;;
314
+ esac
315
+ echo ""
@@ -51,7 +51,94 @@ You are acting as the Product Manager to validate increment completion before cl
51
51
  🎯 Validating readiness for closure...
52
52
  ```
53
53
 
54
- ### Step 2: PM Validation (3 Gates)
54
+ ### Step 2: Automated Completion Validation (Gate 0)
55
+
56
+ **🔥 CRITICAL: Automated validation runs BEFORE PM validation to catch obvious issues!**
57
+
58
+ **BEFORE** invoking the PM agent, run automated validation using `IncrementCompletionValidator`:
59
+
60
+ ```typescript
61
+ import { IncrementCompletionValidator } from '../../../src/core/increment/completion-validator.js';
62
+
63
+ // Validate increment is ready for completion
64
+ const validation = await IncrementCompletionValidator.validateCompletion(incrementId);
65
+
66
+ if (!validation.isValid) {
67
+ // BLOCK completion and show errors
68
+ console.error('❌ CANNOT CLOSE INCREMENT - Automated validation failed');
69
+ console.error('');
70
+ validation.errors.forEach(err => console.error(` • ${err}`));
71
+ console.error('');
72
+ console.error('Fix these issues before running /specweave:done again');
73
+ process.exit(1);
74
+ }
75
+ ```
76
+
77
+ **Example validation output** (FAIL):
78
+ ```
79
+ ❌ CANNOT CLOSE INCREMENT - Automated validation failed
80
+
81
+ • 17 acceptance criteria still open
82
+ • 13 tasks still pending
83
+
84
+ Fix these issues before running /specweave:done again
85
+ ```
86
+
87
+ **Example validation output** (PASS):
88
+ ```
89
+ ✅ Automated validation passed
90
+ • All acceptance criteria completed
91
+ • All tasks completed
92
+
93
+ Proceeding to PM validation...
94
+ ```
95
+
96
+ **What Gate 0 validates**:
97
+ - [ ] All acceptance criteria are checked in **spec.md** (`- [x] **AC-...`)
98
+ - [ ] All tasks are completed in **tasks.md** (`**Status**: [x] completed`)
99
+ - [ ] Required files exist (`spec.md`, `tasks.md`)
100
+ - [ ] **NEW**: Tasks count in frontmatter matches checked tasks (source of truth validation)
101
+
102
+ **⚠️ SOURCE OF TRUTH ENFORCEMENT (CRITICAL)**:
103
+
104
+ Gate 0 now validates that `tasks.md` and `spec.md` are the ACTUAL source of truth, not internal TODO lists:
105
+
106
+ ```typescript
107
+ // 1. Count completed tasks in tasks.md (ACTUAL source of truth)
108
+ const tasksInFile = await countCompletedTasks(tasksPath);
109
+
110
+ // 2. Compare with frontmatter
111
+ const { total_tasks } = readTasksFrontmatter(tasksPath);
112
+
113
+ // 3. BLOCK if mismatch
114
+ if (tasksInFile < total_tasks) {
115
+ throw new ValidationError(
116
+ `CRITICAL: Source of truth violation!\n` +
117
+ `tasks.md shows ${tasksInFile}/${total_tasks} tasks completed.\n` +
118
+ `Internal TODO lists are NOT the source of truth.\n` +
119
+ `You MUST update tasks.md checkboxes before closing.\n` +
120
+ `See CLAUDE.md Rule #7 for details.`
121
+ );
122
+ }
123
+ ```
124
+
125
+ **This prevents**:
126
+ - ❌ Closing increments with `[ ] pending` tasks in tasks.md
127
+ - ❌ Relying on internal TODO lists instead of source files
128
+ - ❌ Marking work "done" without updating acceptance criteria
129
+ - ❌ The critical violation from increment 0044 (2025-11-19)
130
+
131
+ **Why Gate 0 matters**:
132
+ - **Prevents false completion**: Can't mark increment "completed" with open work
133
+ - **Fast feedback**: Fails immediately (< 1s) vs waiting for PM agent (30s+)
134
+ - **Data integrity**: Ensures status matches reality (no spec.md desync)
135
+ - **Source of truth discipline**: Enforces tasks.md and spec.md as the ONLY source of truth
136
+
137
+ **CRITICAL**: Gate 0 is MANDATORY and CANNOT be bypassed. If validation fails, increment stays "in-progress" and command exits.
138
+
139
+ ---
140
+
141
+ ### Step 3: PM Validation (3 Gates)
55
142
 
56
143
  **🔥 CRITICAL: PM agent MUST validate all 3 gates before allowing closure!**
57
144
 
@@ -288,7 +375,7 @@ Recommendation: ❌ CANNOT close increment
288
375
  • Estimated effort: 1-2 hours
289
376
  ```
290
377
 
291
- ### Step 3: PM Decision
378
+ ### Step 4: PM Decision
292
379
 
293
380
  **Based on 3-gate validation**:
294
381
 
@@ -326,7 +413,7 @@ Closing increment 0001-user-authentication...
326
413
  🎉 Increment 0001 closed successfully!
327
414
  ```
328
415
 
329
- ### Step 4: Post-Closure Sync (AUTOMATIC)
416
+ ### Step 5: Post-Closure Sync (AUTOMATIC)
330
417
 
331
418
  **CRITICAL**: After increment closes, automatically perform these syncs:
332
419
 
@@ -651,7 +738,7 @@ Increment remains: in-progress
651
738
  Try again after fixing blockers: /specweave:done 0001
652
739
  ```
653
740
 
654
- ### Step 4: Handle Incomplete Work
741
+ ### Step 6: Handle Incomplete Work
655
742
 
656
743
  **If increment cannot close due to scope creep**:
657
744
 
@@ -13,7 +13,10 @@ Reopen completed work when issues are discovered after completion.
13
13
  ## Quick Start
14
14
 
15
15
  ```bash
16
- # Reopen entire increment
16
+ # Reopen entire increment (natural language - RECOMMENDED)
17
+ /specweave:reopen 0043 Bug found in AC sync implementation
18
+
19
+ # OR with explicit --reason flag
17
20
  /specweave:reopen 0031 --reason "GitHub sync failing"
18
21
 
19
22
  # Reopen specific task
@@ -23,6 +26,23 @@ Reopen completed work when issues are discovered after completion.
23
26
  /specweave:reopen 0031 --user-story US-001 --reason "Acceptance criteria not met"
24
27
  ```
25
28
 
29
+ ### Natural Language Syntax (NEW!)
30
+
31
+ You can now use natural language without the `--reason` flag:
32
+
33
+ ```bash
34
+ # ✅ WORKS: Natural language (everything after increment ID is the reason)
35
+ /specweave:reopen 0043 Bug found in implementation, need to fix
36
+
37
+ # ✅ WORKS: Traditional syntax with flag
38
+ /specweave:reopen 0043 --reason "Bug found in implementation"
39
+
40
+ # ✅ WORKS: With task ID
41
+ /specweave:reopen 0043 --task T-005 Found edge case not covered
42
+ ```
43
+
44
+ **How it works**: All text after the increment ID (and any flags) is treated as the reason. No quotes needed!
45
+
26
46
  ## Smart Detection First!
27
47
 
28
48
  **Before using this command manually**, try reporting your issue naturally:
@@ -119,11 +139,18 @@ Use `--force` to bypass WIP limit checks (use sparingly!).
119
139
  | Parameter | Required | Description |
120
140
  |-----------|----------|-------------|
121
141
  | `<increment-id>` | Yes | Increment to reopen (e.g., `0031` or `0031-external-tool-status-sync`) |
122
- | `--reason <text>` | Yes | Why reopening (for audit trail) |
142
+ | `--reason <text>` | Optional* | Why reopening (for audit trail). *Can use natural language instead! |
123
143
  | `--task <id>` | No | Reopen specific task (e.g., `T-003`) |
124
144
  | `--user-story <id>` | No | Reopen user story + related tasks (e.g., `US-001`) |
125
145
  | `--force` | No | Bypass WIP limit checks |
126
146
 
147
+ **Natural Language**: If `--reason` is not provided, all remaining text is used as the reason.
148
+
149
+ Examples:
150
+ - `/specweave:reopen 0043 Bug found` → reason = "Bug found"
151
+ - `/specweave:reopen 0043 --task T-005 Edge case` → reason = "Edge case"
152
+ - `/specweave:reopen 0043 --reason "Formal reason"` → reason = "Formal reason" (explicit)
153
+
127
154
  ## WIP Limit Validation
128
155
 
129
156
  The command automatically checks WIP limits before reopening increments.