specweave 1.0.256 โ†’ 1.0.259

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 (113) hide show
  1. package/CLAUDE.md +56 -221
  2. package/README.md +31 -0
  3. package/bin/specweave.js +17 -0
  4. package/dist/src/adapters/README.md +4 -4
  5. package/dist/src/adapters/agents-md-generator.d.ts.map +1 -1
  6. package/dist/src/adapters/agents-md-generator.js +0 -2
  7. package/dist/src/adapters/agents-md-generator.js.map +1 -1
  8. package/dist/src/adapters/claude/README.md +3 -3
  9. package/dist/src/adapters/claude/adapter.js +3 -3
  10. package/dist/src/adapters/claude-md-generator.js +1 -1
  11. package/dist/src/adapters/claude-md-generator.js.map +1 -1
  12. package/dist/src/adapters/registry.yaml +1 -1
  13. package/dist/src/cli/commands/create-increment.d.ts +24 -0
  14. package/dist/src/cli/commands/create-increment.d.ts.map +1 -0
  15. package/dist/src/cli/commands/create-increment.js +53 -0
  16. package/dist/src/cli/commands/create-increment.js.map +1 -0
  17. package/dist/src/cli/commands/init.d.ts.map +1 -1
  18. package/dist/src/cli/commands/init.js +48 -31
  19. package/dist/src/cli/commands/init.js.map +1 -1
  20. package/dist/src/cli/commands/update.d.ts.map +1 -1
  21. package/dist/src/cli/commands/update.js +36 -0
  22. package/dist/src/cli/commands/update.js.map +1 -1
  23. package/dist/src/cli/helpers/init/directory-structure.d.ts.map +1 -1
  24. package/dist/src/cli/helpers/init/directory-structure.js +13 -1
  25. package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
  26. package/dist/src/cli/helpers/init/summary-banner.d.ts +11 -0
  27. package/dist/src/cli/helpers/init/summary-banner.d.ts.map +1 -1
  28. package/dist/src/cli/helpers/init/summary-banner.js +49 -3
  29. package/dist/src/cli/helpers/init/summary-banner.js.map +1 -1
  30. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  31. package/dist/src/cli/helpers/issue-tracker/index.js +0 -1
  32. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  33. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts.map +1 -1
  34. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js +6 -2
  35. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -1
  36. package/dist/src/core/ac-progress-sync.d.ts +13 -0
  37. package/dist/src/core/ac-progress-sync.d.ts.map +1 -1
  38. package/dist/src/core/ac-progress-sync.js +28 -0
  39. package/dist/src/core/ac-progress-sync.js.map +1 -1
  40. package/dist/src/core/config/types.d.ts +24 -1
  41. package/dist/src/core/config/types.d.ts.map +1 -1
  42. package/dist/src/core/config/types.js +6 -1
  43. package/dist/src/core/config/types.js.map +1 -1
  44. package/dist/src/core/doctor/checkers/project-structure-checker.d.ts +1 -0
  45. package/dist/src/core/doctor/checkers/project-structure-checker.d.ts.map +1 -1
  46. package/dist/src/core/doctor/checkers/project-structure-checker.js +53 -3
  47. package/dist/src/core/doctor/checkers/project-structure-checker.js.map +1 -1
  48. package/dist/src/core/fabric/security-scanner.d.ts.map +1 -1
  49. package/dist/src/core/fabric/security-scanner.js +70 -9
  50. package/dist/src/core/fabric/security-scanner.js.map +1 -1
  51. package/dist/src/core/increment/increment-utils.d.ts +6 -0
  52. package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
  53. package/dist/src/core/increment/increment-utils.js +5 -0
  54. package/dist/src/core/increment/increment-utils.js.map +1 -1
  55. package/dist/src/core/living-docs/discovery.d.ts +2 -0
  56. package/dist/src/core/living-docs/discovery.d.ts.map +1 -1
  57. package/dist/src/core/living-docs/discovery.js +91 -17
  58. package/dist/src/core/living-docs/discovery.js.map +1 -1
  59. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts +5 -0
  60. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts.map +1 -1
  61. package/dist/src/core/living-docs/intelligent-analyzer/index.js +3 -3
  62. package/dist/src/core/living-docs/intelligent-analyzer/index.js.map +1 -1
  63. package/dist/src/core/living-docs/lsp-bootstrapper.d.ts +64 -0
  64. package/dist/src/core/living-docs/lsp-bootstrapper.d.ts.map +1 -0
  65. package/dist/src/core/living-docs/lsp-bootstrapper.js +118 -0
  66. package/dist/src/core/living-docs/lsp-bootstrapper.js.map +1 -0
  67. package/dist/src/core/project/project-service.d.ts +10 -1
  68. package/dist/src/core/project/project-service.d.ts.map +1 -1
  69. package/dist/src/core/project/project-service.js +37 -2
  70. package/dist/src/core/project/project-service.js.map +1 -1
  71. package/dist/src/core/universal-auto-create.d.ts +64 -0
  72. package/dist/src/core/universal-auto-create.d.ts.map +1 -0
  73. package/dist/src/core/universal-auto-create.js +228 -0
  74. package/dist/src/core/universal-auto-create.js.map +1 -0
  75. package/package.json +1 -1
  76. package/plugins/specweave/PLUGIN.md +0 -3
  77. package/plugins/specweave/commands/living-docs.md +0 -2
  78. package/plugins/specweave/hooks/stop-sync.sh +34 -5
  79. package/plugins/specweave/hooks/user-prompt-submit.sh +115 -326
  80. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +19 -5
  81. package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +14 -4
  82. package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +181 -0
  83. package/plugins/specweave/lib/hooks/sync-living-docs.js +4 -2
  84. package/plugins/specweave/scripts/skill-context.sh +160 -0
  85. package/plugins/specweave/skills/architect/SKILL.md +1 -1
  86. package/plugins/specweave/skills/archive-increments/SKILL.md +13 -3
  87. package/plugins/specweave/skills/auto/SKILL.md +92 -1038
  88. package/plugins/specweave/skills/do/SKILL.md +66 -1106
  89. package/plugins/specweave/skills/docs/SKILL.md +124 -56
  90. package/plugins/specweave/skills/done/SKILL.md +76 -1406
  91. package/plugins/specweave/skills/framework/SKILL.md +1 -1
  92. package/plugins/specweave/skills/increment/SKILL.md +1 -1
  93. package/plugins/specweave/skills/increment-planner/SKILL.md +29 -19
  94. package/plugins/specweave/skills/jobs/SKILL.md +52 -0
  95. package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +1 -1
  96. package/plugins/specweave/skills/save/SKILL.md +51 -1372
  97. package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +1 -1
  98. package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +1 -1
  99. package/plugins/specweave/skills/validate/SKILL.md +65 -848
  100. package/plugins/specweave-backend/skills/database-optimizer/SKILL.md +1 -1
  101. package/plugins/specweave-backend/skills/graphql/SKILL.md +1 -1
  102. package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +1 -1
  103. package/plugins/specweave-frontend/skills/frontend/SKILL.md +1 -1
  104. package/plugins/specweave-frontend/skills/frontend-architect/SKILL.md +1 -1
  105. package/plugins/specweave-frontend/skills/frontend-design/SKILL.md +1 -1
  106. package/plugins/specweave-frontend/skills/i18n-expert/SKILL.md +1 -1
  107. package/plugins/specweave-payments/skills/billing-automation/SKILL.md +1 -1
  108. package/plugins/specweave-testing/skills/accessibility-testing/SKILL.md +1 -1
  109. package/src/templates/CLAUDE.md.template +50 -356
  110. package/src/templates/config.json.template +5 -1
  111. package/plugins/specweave/commands/brownfield-analyzer.md +0 -408
  112. package/plugins/specweave/commands/brownfield-onboarder.md +0 -837
  113. package/plugins/specweave/commands/export-skills.md +0 -179
@@ -19,1157 +19,117 @@ hooks:
19
19
 
20
20
  !`s="do"; for d in .specweave/skill-memories .claude/skill-memories "$HOME/.claude/skill-memories"; do p="$d/$s.md"; [ -f "$p" ] && awk '/^## Learnings$/{ok=1;next}/^## /{ok=0}ok' "$p" && break; done 2>/dev/null; true`
21
21
 
22
- **Implementation Execution**: Following spec.md and plan.md to execute the increment work.
22
+ ## Project Context
23
23
 
24
- You are helping the user implement a SpecWeave increment by executing tasks from tasks.md with automatic documentation updates after EVERY task completion.
24
+ !`.specweave/scripts/skill-context.sh do 2>/dev/null; true`
25
25
 
26
- ## Usage
27
-
28
- ```bash
29
- # Auto-resumes from last incomplete task
30
- /sw:do <increment-id>
26
+ Execute a SpecWeave increment by running tasks from tasks.md with automatic AC-sync after every task completion.
31
27
 
32
- # Or let it find active increment automatically
33
- /sw:do
28
+ ## Usage
34
29
 
35
- # Override model selection for all tasks (advanced)
36
- /sw:do <increment-id> --model haiku
37
- /sw:do <increment-id> --model sonnet
38
- /sw:do <increment-id> --model opus
39
30
  ```
40
-
41
- ## Arguments
42
-
43
- - `<increment-id>`: Optional. Increment ID (e.g., "001", "0001", "1", "0042")
44
- - If omitted, **MUST auto-select best candidate** (see Step 0.5 below)
45
- - **Smart resume**: Automatically starts from next incomplete task
46
-
47
- - `--model <tier>`: Optional. Override model selection for all tasks
48
- - `haiku`: Fast, cheap execution (simple mechanical tasks)
49
- - `sonnet`: Legacy option (rarely needed)
50
- - `opus`: Maximum quality (default for all complex tasks)
51
- - If omitted, uses model hints from tasks.md (recommended)
52
-
53
- ---
54
-
55
- ## Workflow
56
-
57
- ### Step 0.5: Smart Increment Auto-Selection (MANDATORY when no ID provided)
58
-
59
- **๐ŸŽฏ CRITICAL: When user runs `/sw:do` without increment ID, you MUST auto-select the best candidate.**
60
-
61
- **DO NOT** ask the user for an increment ID. **DO NOT** fail with "increment ID required". Instead:
62
-
63
- 1. **Scan for candidates** in this priority order:
64
-
65
- ```bash
66
- # Priority 1: in-progress (resume work)
67
- IN_PROGRESS=$(find .specweave/increments -maxdepth 2 -name "metadata.json" -exec grep -l '"status": "in-progress"' {} \; 2>/dev/null | head -1)
68
-
69
- # Priority 2: planned (start next work)
70
- PLANNED=$(find .specweave/increments -maxdepth 2 -name "metadata.json" -exec grep -l '"status": "planned"' {} \; 2>/dev/null | head -1)
71
-
72
- # Priority 3: ready_for_review with incomplete tasks (needs finishing)
73
- READY=$(find .specweave/increments -maxdepth 2 -name "metadata.json" -exec grep -l '"status": "ready_for_review"' {} \; 2>/dev/null)
74
-
75
- # Priority 4: backlog with tasks (can start)
76
- BACKLOG=$(find .specweave/increments -maxdepth 2 -name "metadata.json" -exec grep -l '"status": "backlog"' {} \; 2>/dev/null)
77
- ```
78
-
79
- 2. **For each candidate**, check if it has incomplete tasks:
80
-
81
- ```bash
82
- # Count incomplete tasks in tasks.md (supports multiple formats)
83
- # Format 1: List items "- [ ] Task"
84
- INCOMPLETE=$(grep -c '^\- \[ \]' "$INCREMENT_PATH/tasks.md" 2>/dev/null || echo "0")
85
- # Format 2: Status field "**Status**: [ ] pending"
86
- INCOMPLETE_STATUS=$(grep -c '\*\*Status\*\*: \[ \]' "$INCREMENT_PATH/tasks.md" 2>/dev/null || echo "0")
87
- # Total incomplete = sum of all formats
88
- TOTAL_INCOMPLETE=$((INCOMPLETE + INCOMPLETE_STATUS))
89
- ```
90
-
91
- 3. **Select the best candidate**:
92
- - If `in-progress` increment exists โ†’ use it
93
- - Else if `planned` increment exists โ†’ use it
94
- - Else if `ready_for_review` with incomplete tasks โ†’ use it
95
- - Else if `backlog` increment exists with incomplete tasks โ†’ use it (and change status to in-progress)
96
-
97
- 4. **If candidate found, display selection and continue**:
98
-
99
- ```
100
- ๐ŸŽฏ Auto-selected increment: 0162-lsp-skill-integration
101
-
102
- Status: backlog โ†’ in-progress (auto-promoted)
103
- Tasks: 0/28 completed (0%)
104
- Priority: P1
105
- Type: refactor
106
-
107
- Proceeding with execution...
108
- ```
109
-
110
- 5. **If NO candidates found (all done), show insights and ask user**:
111
-
112
- ```
113
- โœ… All increments completed!
114
-
115
- ๐Ÿ“Š Quick Status:
116
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
117
- โ”‚ Active: 0 | Backlog: 0 | Completed: 47 | Archived: 125 โ”‚
118
- โ”‚ Last completed: 0167-comprehensive-code-review (2 days ago) โ”‚
119
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
120
-
121
- ๐Ÿ”ฎ Recent completions:
122
- โ€ข 0175-plugin-session-restart-warning (completed 1 day ago)
123
- โ€ข 0174-router-brain-orchestrator (ready_for_review)
124
- โ€ข 0167-comprehensive-code-review (ready_for_review)
125
-
126
- ๐Ÿ’ก What would you like to do?
127
-
128
- Options:
129
- A) Create new increment: /sw:increment "feature name"
130
- B) Close ready_for_review: /sw:done 0174
131
- C) Resume from backlog: /sw:resume 0162
132
- D) View full status: /sw:status
133
-
134
- Your choice? [A/B/C/D or type feature name]: _
135
- ```
136
-
137
- **Why This Matters**:
138
- - Users shouldn't need to remember increment IDs
139
- - `/sw:do` should "just work" like `/sw:auto`
140
- - Smart selection saves context switches
141
-
142
- ---
143
-
144
- ### Step 0: Self-Awareness Check
145
-
146
- **๐ŸŽฏ OPTIONAL BUT RECOMMENDED**: Check if running in SpecWeave repository itself.
147
-
148
- This step is particularly useful when implementing SpecWeave features vs user projects, as it provides context for:
149
- - Understanding if changes affect the framework
150
- - Being careful with breaking changes
151
- - Considering backward compatibility
152
-
153
- ```typescript
154
- import { detectSpecWeaveRepository } from './src/utils/repository-detector.js';
155
-
156
- const repoInfo = detectSpecWeaveRepository(process.cwd());
157
-
158
- if (repoInfo.isSpecWeaveRepo) {
159
- console.log('โ„น๏ธ Working on SpecWeave framework increment');
160
- console.log(` Confidence: ${repoInfo.confidence}`);
161
- console.log('');
162
- console.log(' ๐Ÿ’ก Reminders:');
163
- console.log(' โ€ข Test changes don\'t break existing user projects');
164
- console.log(' โ€ข Consider backward compatibility');
165
- console.log(' โ€ข Update CLAUDE.md if workflow changes');
166
- console.log('');
167
- }
31
+ /sw:do <increment-id> # Execute specific increment
32
+ /sw:do # Auto-select best candidate
33
+ /sw:do <id> --model haiku|sonnet|opus # Override model for all tasks
168
34
  ```
169
35
 
170
- **When to Show This**:
171
- - On first task execution for the increment
172
- - Skip on subsequent tasks (user already knows context)
173
-
174
- **Why This Helps**:
175
- Contributors working on SpecWeave itself need different mindset than users building apps:
176
- - Framework changes affect ALL users
177
- - Breaking changes need deprecation warnings
178
- - Documentation updates are critical
36
+ - `<increment-id>`: Optional. Supports "001", "0001", "1", "0042", or "0153-feature-name" formats.
37
+ - `--model <tier>`: Optional. Overrides per-task model hints.
179
38
 
180
39
  ---
181
40
 
182
- ### Step 1: Load Context
183
-
184
- **Prerequisite**: Increment ID is now available (either from user input or auto-selected in Step 0.5).
185
-
186
- 1. **Find increment directory**:
187
- - **Normalize increment ID**:
188
- - If ID contains dash (e.g., "0153-feature-name"), extract numeric portion before first dash โ†’ "0153"
189
- - Convert to 4-digit format (e.g., "1" โ†’ "0001", "153" โ†’ "0153")
190
- - Both formats work: `/sw:do 0153` or `/sw:do 0153-feature-name`
191
- - Find matching directory: `.specweave/increments/0001-*/` (matches by prefix)
192
- - Verify increment exists
193
-
194
- 2. **Load specification and plan**:
195
- - Read `spec.md` - Understand WHAT and WHY
196
- - Read `plan.md` - Understand HOW
197
- - Read `tasks.md` - Understand implementation steps
198
- - Read `tests.md` - Understand test strategy
199
-
200
- 3. **๐Ÿ”„ Load Living Docs Context**:
201
-
202
- **Optional but recommended**: Load relevant living documentation context.
203
-
204
- ```bash
205
- # Extract topic keywords from spec.md title/user stories
206
- TOPIC=$(grep -m1 "^#" spec.md | sed 's/# //' | tr '[:upper:]' '[:lower:]')
207
-
208
- # Check if related living docs exist
209
- LIVING_DOCS_ROOT=".specweave/docs/internal"
210
- RELATED_DOCS=$(find "$LIVING_DOCS_ROOT" -name "*${TOPIC}*" -o -name "*${KEYWORD}*" 2>/dev/null)
211
- ```
212
-
213
- **If related living docs found**:
214
- - Read relevant ADRs from `.specweave/docs/internal/architecture/adr/`
215
- - Read relevant specs from `.specweave/docs/internal/specs/`
216
- - Read relevant architecture docs from `.specweave/docs/internal/architecture/`
217
-
218
- **Why This Helps**:
219
- - Ensures implementation follows established patterns
220
- - Avoids contradicting existing ADRs
221
- - Provides historical context for design decisions
222
- - References related features for consistency
223
-
224
- **Example output**:
225
- ```
226
- ๐Ÿ“š Living Docs Context Loaded:
227
- โ€ข ADR-0023: Database Connection Pooling (relevant)
228
- โ€ข spec-005: User Management (related feature)
229
- โ€ข architecture/auth-flow.md (pattern to follow)
230
- ```
231
-
232
- **Skip if**: Living docs don't exist or no relevant docs found
233
-
234
- 4. **Verify readiness**:
235
- - Check status is "planned" (not already in-progress or completed)
236
- - Check no blocking dependencies
237
- - Check tasks.md has tasks to execute
238
-
239
- 5. **๐Ÿšจ CRITICAL: Task Count Validation (CRASH PREVENTION!)**:
240
-
241
- **MANDATORY**: Count tasks in tasks.md before proceeding.
242
-
243
- ```bash
244
- TASK_COUNT=$(grep -c "^### T-" .specweave/increments/<id>/tasks.md)
245
- ```
246
-
247
- **If TASK_COUNT > 25**:
248
- ```
249
- โš ๏ธ TASK COUNT EXCEEDS SOFT LIMIT
250
-
251
- This increment has X tasks (soft limit: 25)
252
-
253
- >25 tasks = consider splitting for maintainability (per CLAUDE.md rules)
254
-
255
- ๐Ÿ’ก RECOMMENDED: Split this increment OR execute phase-by-phase:
256
-
257
- Option A - Split into separate increments:
258
- Pattern: 0116-feature/ โ†’ Split into:
259
- โ€ข 0116-feature-phase1/ (T-001 to T-008)
260
- โ€ข 0117-feature-phase2/ (T-009 to T-016)
261
- โ€ข 0118-feature-phase3/ (T-017 to T-025)
262
-
263
- Option B - Phase-by-phase execution (recommended for 15-25 tasks):
264
- Execute Phase 1 โ†’ validate โ†’ continue to Phase 2 โ†’ ...
41
+ ## Workflow
265
42
 
266
- User choice required to proceed.
267
- ```
43
+ ### Step 1: Smart Increment Auto-Selection
268
44
 
269
- **If TASK_COUNT <= 25**: Proceed to next step
45
+ When no ID provided, auto-select (NEVER ask user for ID):
270
46
 
271
- 6. **๐Ÿšจ CRITICAL: Validate AC Presence**:
47
+ 1. Scan by priority: `in-progress` > `planned` > `ready_for_review` (with incomplete tasks) > `backlog` (with incomplete tasks)
48
+ 2. For each candidate, count incomplete tasks: `grep -c '^\- \[ \]'` + `grep -c '\*\*Status\*\*: \[ \]'` in tasks.md
49
+ 3. Select best candidate and auto-promote to in-progress if needed
50
+ 4. If no candidates, show status summary and offer: create new, close ready_for_review, resume backlog, or view status
272
51
 
273
- **MANDATORY**: Run pre-increment-start validation hook to verify spec.md contains ACs.
52
+ ### Step 2: Load Context
274
53
 
275
- Use the Bash tool to run:
54
+ 1. **Find increment directory**: Normalize ID to 4-digit format, match `.specweave/increments/NNNN-*/`
55
+ 2. **Load files**: Read `spec.md`, `plan.md`, `tasks.md`, `tests.md`
56
+ 3. **Load living docs**: Check ADRs and specs in `.specweave/docs/internal/` for related context
57
+ 4. **Verify readiness**: Status is planned/in-progress, no blocking deps, tasks exist
58
+ 5. **Task count validation**: If >25 tasks, warn and offer to split or phase execution
59
+ 6. **Validate AC presence** (MANDATORY):
276
60
  ```bash
277
61
  bash plugins/specweave/hooks/pre-increment-start.sh <increment-path>
278
- # Example: bash plugins/specweave/hooks/pre-increment-start.sh .specweave/increments/0050-feature-name
279
62
  ```
63
+ If fails: run `/sw:embed-acs`, then retry. Do NOT proceed without ACs in spec.md.
280
64
 
281
- **Expected Output (Success)**:
282
- ```
283
- โœ… AC Presence Validation PASSED
284
- โ€ข spec.md contains 39 ACs
285
- โ€ข Matches metadata.json (39 expected)
286
- โ€ข Ready to start implementation
287
- ```
288
-
289
- **Expected Output (Failure)**:
290
- ```
291
- โŒ AC Presence Validation FAILED
292
- โ€ข spec.md contains 0 ACs (expected 39)
293
- โ€ข ACs are REQUIRED for task-AC sync to work
294
-
295
- ๐Ÿ’ก Fix: Run /sw:embed-acs <increment-id>
296
- ```
297
-
298
- **What to Do After Validation**:
299
- - โœ… **If validation passes**: Proceed to Step 2
300
- - โŒ **If validation fails**: Show error, run `/sw:embed-acs`, then retry
301
- - **DO NOT PROCEED** without ACs in spec.md (hooks will fail!)
302
-
303
- **Why This Matters** (ADR-0064):
304
- - The AC sync hook requires ACs in spec.md to update completion status
305
- - Without inline ACs, you get 0% AC completion and broken status line
306
- - Even with external living docs, ACs MUST be embedded in spec.md
307
-
308
- **Example output**:
309
- ```
310
- ๐Ÿ“‚ Loading increment 0001-user-authentication...
311
-
312
- โœ… Loaded context:
313
- โ€ข spec.md (6 user stories, 15 requirements)
314
- โ€ข plan.md (Architecture: JWT + PostgreSQL)
315
- โ€ข tasks.md (42 tasks, estimated 3-4 weeks)
316
- โ€ข tests.md (12 test cases, 85% coverage)
317
-
318
- ๐ŸŽฏ Ready to execute!
319
- ```
320
-
321
- ### Step 1.5: Check TDD Mode
322
-
323
- **Read testMode from metadata.json:**
65
+ ### Step 3: TDD Setup
324
66
 
67
+ Read `testMode` from metadata.json:
325
68
  ```bash
326
- INCREMENT_PATH=".specweave/increments/<id>"
327
69
  TEST_MODE=$(cat "$INCREMENT_PATH/metadata.json" | jq -r '.testMode // "test-after"')
328
70
  ```
329
71
 
330
- **If TEST_MODE == "TDD", display TDD reminder banner:**
331
-
332
- ```
333
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
334
- โ”‚ ๐Ÿ”ด TDD MODE ACTIVE โ”‚
335
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
336
- โ”‚ โ”‚
337
- โ”‚ This increment uses Test-Driven Development. โ”‚
338
- โ”‚ โ”‚
339
- โ”‚ WORKFLOW: โ”‚
340
- โ”‚ 1. [RED] Write failing test FIRST โ”‚
341
- โ”‚ 2. [GREEN] Minimal code to make test pass โ”‚
342
- โ”‚ 3. [REFACTOR] Improve code, keep tests green โ”‚
343
- โ”‚ โ”‚
344
- โ”‚ โš ๏ธ GREEN tasks depend on their RED counterpart! โ”‚
345
- โ”‚ ๐Ÿ’ก Tip: Use /sw:tdd-cycle for guided workflow โ”‚
346
- โ”‚ โ”‚
347
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
348
- ```
349
-
350
- **When executing tasks, detect and display current phase:**
351
-
352
- ```bash
353
- CURRENT_TASK_TITLE="T-001: [RED] Write failing test for login"
354
-
355
- if [[ "$CURRENT_TASK_TITLE" == *"[RED]"* ]]; then
356
- PHASE="๐Ÿ”ด RED - Writing failing test"
357
- elif [[ "$CURRENT_TASK_TITLE" == *"[GREEN]"* ]]; then
358
- PHASE="๐ŸŸข GREEN - Making test pass"
359
- elif [[ "$CURRENT_TASK_TITLE" == *"[REFACTOR]"* ]]; then
360
- PHASE="๐Ÿ”ต REFACTOR - Improving code quality"
361
- else
362
- PHASE="" # Not a TDD task
363
- fi
364
-
365
- if [ -n "$PHASE" ]; then
366
- echo "Current Phase: $PHASE"
367
- fi
368
- ```
369
-
370
- **Skip TDD banner if**:
371
- - `testMode` is not "TDD"
372
- - Already showed banner in current session
373
-
374
- ### Step 1.5.5: TDD Marker Validation (CRITICAL when TDD mode is enabled)
375
-
376
- **๐Ÿšจ CRITICAL: When TDD mode is active, verify tasks.md has TDD markers!**
377
-
378
- This step MUST run BEFORE Step 1.6 enforcement to catch the case where TDD is enabled but tasks were NOT generated with `/sw:increment`.
379
-
380
- **Check for TDD markers in tasks.md:**
381
-
382
- ```bash
383
- INCREMENT_PATH=".specweave/increments/<id>"
384
- TASKS_FILE="$INCREMENT_PATH/tasks.md"
385
-
386
- # Count TDD markers
387
- RED_COUNT=$(grep -c '\[RED\]' "$TASKS_FILE" 2>/dev/null || echo "0")
388
- GREEN_COUNT=$(grep -c '\[GREEN\]' "$TASKS_FILE" 2>/dev/null || echo "0")
389
- REFACTOR_COUNT=$(grep -c '\[REFACTOR\]' "$TASKS_FILE" 2>/dev/null || echo "0")
390
- TOTAL_MARKERS=$((RED_COUNT + GREEN_COUNT + REFACTOR_COUNT))
391
-
392
- echo "TDD Markers found: RED=$RED_COUNT, GREEN=$GREEN_COUNT, REFACTOR=$REFACTOR_COUNT"
393
- ```
394
-
395
- **If TDD mode is enabled BUT no markers found (TOTAL_MARKERS == 0):**
396
-
397
- ```typescript
398
- function validateTDDMarkers(tasksContent: string, tddMode: string, tddEnforcement: string): void {
399
- if (tddMode !== 'TDD') return; // Not TDD mode, skip
400
-
401
- const hasRedMarkers = tasksContent.includes('[RED]');
402
- const hasGreenMarkers = tasksContent.includes('[GREEN]');
403
- const hasRefactorMarkers = tasksContent.includes('[REFACTOR]');
404
-
405
- if (!hasRedMarkers && !hasGreenMarkers && !hasRefactorMarkers) {
406
- // TDD mode enabled but NO markers in tasks.md!
407
- const message = `
408
- โš ๏ธ TDD MODE ENABLED BUT TASKS LACK TDD MARKERS
409
-
410
- Your config has TDD mode enabled:
411
- testing.defaultTestMode: "TDD"
412
-
413
- But tasks.md has NO [RED], [GREEN], [REFACTOR] markers.
414
-
415
- This means TDD enforcement CANNOT work because:
416
- โ€ข /sw:do checks task markers to enforce order
417
- โ€ข Without markers, enforcement is silently bypassed
418
-
419
- CAUSE: Tasks were likely created manually or before TDD was enabled.
420
-
421
- FIX OPTIONS:
422
- 1. (Recommended) Regenerate tasks with /sw:increment
423
- This will create proper REDโ†’GREENโ†’REFACTOR triplets
424
-
425
- 2. Add markers manually to existing tasks:
426
- ### T-001: [RED] Write failing test for feature X
427
- ### T-002: [GREEN] Implement feature X to pass test
428
- ### T-003: [REFACTOR] Clean up feature X code
429
-
430
- 3. Disable TDD mode:
431
- Set testing.defaultTestMode: "test-after" in config.json
432
- `;
433
-
434
- if (tddEnforcement === 'strict') {
435
- console.error(message);
436
- console.error('โŒ BLOCKED: Cannot proceed without TDD markers in strict mode.');
437
- console.error(' Fix tasks.md or change tddEnforcement to "warn".');
438
- throw new Error('TDD_MARKERS_MISSING');
439
- } else if (tddEnforcement === 'warn') {
440
- console.warn(message);
441
- console.warn('โš ๏ธ Proceeding without TDD enforcement (warn mode)...');
442
- }
443
- // If tddEnforcement === 'off', silently continue
444
- }
445
- }
446
- ```
447
-
448
- **Enforcement behavior:**
449
-
450
- | tddEnforcement | TDD Enabled + No Markers | Behavior |
451
- |----------------|--------------------------|----------|
452
- | `strict` | **BLOCK** | โŒ "Cannot proceed without TDD markers. Run /sw:increment or add markers manually." |
453
- | `warn` (default) | **WARN but allow** | โš ๏ธ "TDD markers missing. Enforcement bypassed. Consider regenerating tasks." |
454
- | `off` | **No check** | Silent pass |
455
-
456
- **Example output (strict mode, no markers):**
457
-
458
- ```
459
- โŒ TDD MARKER VALIDATION FAILED
460
-
461
- TDD mode is enabled (testing.defaultTestMode: "TDD")
462
- But tasks.md has 0 TDD markers:
463
- โ€ข [RED] markers: 0
464
- โ€ข [GREEN] markers: 0
465
- โ€ข [REFACTOR] markers: 0
466
-
467
- This means TDD discipline CANNOT be enforced!
468
-
469
- ๐Ÿ’ก To fix, choose one:
470
- 1. /sw:increment "feature-name" โ† Regenerate with TDD tasks
471
- 2. Add [RED]/[GREEN]/[REFACTOR] markers to task titles
472
- 3. Set tddEnforcement: "warn" to proceed anyway
473
-
474
- Blocked in strict mode. Fix markers or change enforcement level.
475
- ```
476
-
477
- **Example output (warn mode, no markers):**
478
-
479
- ```
480
- โš ๏ธ TDD MARKERS MISSING
481
-
482
- TDD mode is enabled but tasks.md lacks [RED]/[GREEN]/[REFACTOR] markers.
483
- TDD enforcement is effectively DISABLED for this increment.
484
-
485
- ๐Ÿ’ก For proper TDD discipline, regenerate tasks: /sw:increment "feature"
486
-
487
- Proceeding without enforcement (warn mode)...
488
- ```
489
-
490
- **When this validation passes:**
491
- - TDD mode not enabled โ†’ Skip (no validation needed)
492
- - TDD mode enabled + markers found โ†’ Pass (proceed to Step 1.6)
493
- - TDD mode enabled + no markers + strict โ†’ Block (user must fix)
494
- - TDD mode enabled + no markers + warn โ†’ Warn and proceed
495
- - TDD mode enabled + no markers + off โ†’ Silent pass
496
-
497
- ### Step 1.6: TDD Enforcement (MANDATORY when TDD mode is enabled)
498
-
499
- **๐Ÿšจ CRITICAL: When TDD mode is active, enforce REDโ†’GREENโ†’REFACTOR order!**
500
-
501
- **Read enforcement level from config.json:**
502
-
503
- ```bash
504
- CONFIG_PATH=".specweave/config.json"
505
- TDD_ENFORCEMENT=$(cat "$CONFIG_PATH" | jq -r '.testing.tddEnforcement // "warn"')
506
- # Values: "strict" (blocks), "warn" (allows but warns), "off" (no checks)
507
- ```
508
-
509
- **Before marking ANY task as complete, check TDD discipline:**
510
-
511
- ```typescript
512
- function checkTDDViolation(currentTask: Task, allTasks: Task[]): TDDViolation | null {
513
- // Only check if task has TDD phase marker
514
- const phase = extractPhase(currentTask.title); // [RED], [GREEN], [REFACTOR]
515
- if (!phase) return null;
516
-
517
- // Find related tasks in the same triplet (e.g., T-001, T-002, T-003)
518
- const tripletBase = Math.floor((currentTask.number - 1) / 3) * 3 + 1;
519
-
520
- if (phase === 'GREEN') {
521
- // GREEN requires RED to be completed first
522
- const redTask = allTasks.find(t =>
523
- t.number === tripletBase && t.title.includes('[RED]')
524
- );
525
- if (redTask && redTask.status !== 'completed') {
526
- return {
527
- type: 'GREEN_BEFORE_RED',
528
- message: `Cannot complete GREEN task (${currentTask.id}) before RED task (${redTask.id})`,
529
- redTaskId: redTask.id,
530
- };
531
- }
532
- }
533
-
534
- if (phase === 'REFACTOR') {
535
- // REFACTOR requires GREEN to be completed first
536
- const greenTask = allTasks.find(t =>
537
- t.number === tripletBase + 1 && t.title.includes('[GREEN]')
538
- );
539
- if (greenTask && greenTask.status !== 'completed') {
540
- return {
541
- type: 'REFACTOR_BEFORE_GREEN',
542
- message: `Cannot complete REFACTOR task (${currentTask.id}) before GREEN task (${greenTask.id})`,
543
- greenTaskId: greenTask.id,
544
- };
545
- }
546
- }
547
-
548
- return null; // No violation
549
- }
550
- ```
551
-
552
- **Enforcement behavior based on level:**
553
-
554
- | Level | On Violation | Behavior |
555
- |-------|--------------|----------|
556
- | `strict` | **BLOCK** | โŒ "TDD VIOLATION: Cannot complete GREEN before RED. Complete T-001 [RED] first." |
557
- | `warn` (default) | **WARN but allow** | โš ๏ธ "TDD Warning: Completing GREEN before RED violates TDD discipline." |
558
- | `off` | **No check** | Silent pass |
559
-
560
- **Example output (strict mode):**
561
-
562
- ```
563
- โŒ TDD ENFORCEMENT BLOCKED
564
-
565
- You attempted to complete: T-002: [GREEN] Implement login handler
566
- But its RED counterpart is not done: T-001: [RED] Write login test
567
-
568
- TDD DISCIPLINE REQUIRES:
569
- 1. ๐Ÿ”ด RED - Write failing test FIRST
570
- 2. ๐ŸŸข GREEN - Then implement to pass
571
- 3. ๐Ÿ”ต REFACTOR - Then improve code
572
-
573
- ๐Ÿ’ก Complete T-001 first, then come back to T-002.
574
- Or disable strict enforcement: Set tddEnforcement: "warn" in config.json
575
- ```
576
-
577
- **Example output (warn mode):**
72
+ If TDD mode active:
73
+ - Show TDD reminder banner (RED > GREEN > REFACTOR)
74
+ - Detect phase from task title markers: `[RED]`, `[GREEN]`, `[REFACTOR]`
75
+ - **Validate TDD markers exist** in tasks.md. If missing:
76
+ - `strict` enforcement: BLOCK, require regeneration via `/sw:increment`
77
+ - `warn` (default): warn and proceed
78
+ - `off`: silent pass
79
+ - **Enforce order**: GREEN requires RED complete; REFACTOR requires GREEN complete
80
+ - Read enforcement: `jq -r '.testing.tddEnforcement // "warn"' .specweave/config.json`
81
+ - `strict`: block violations; `warn`: warn but allow; `off`: no check
578
82
 
579
- ```
580
- โš ๏ธ TDD DISCIPLINE WARNING
83
+ ### Step 4: Smart Resume
581
84
 
582
- Completing T-002 [GREEN] before T-001 [RED] violates TDD discipline.
85
+ 1. Parse tasks.md, find first incomplete task (`[ ]`)
86
+ 2. Extract model hints per task (haiku/sonnet/opus)
87
+ 3. Show resume context with completion percentage
583
88
 
584
- TDD works best when you:
585
- 1. Write the failing test first (RED)
586
- 2. Then implement just enough to pass (GREEN)
89
+ ### Step 5: Update Status
587
90
 
588
- Proceeding anyway... (set tddEnforcement: "strict" to block)
589
- ```
91
+ If status is "planned", update to "in-progress" with start date in spec.md frontmatter.
590
92
 
591
- **When to check:**
592
- - โœ… Before marking any [GREEN] or [REFACTOR] task complete
593
- - โŒ Skip check for [RED] tasks (they can be completed freely)
594
- - โŒ Skip check for non-TDD tasks (no phase marker)
93
+ ### Step 6: Execute Tasks Sequentially
595
94
 
596
- ### Step 2: Smart Resume - Find Next Incomplete Task
95
+ For each task:
597
96
 
598
- **๐ŸŽฏ CRITICAL: Auto-resume functionality** - no need to remember which task you were on!
97
+ 1. **Read task details**: ID, model hint, description, ACs, file paths
98
+ 2. **Select model**: Use task hint or `--model` override
99
+ 3. **Execute**: Follow plan.md architecture, implement, write clean code
100
+ 4. **Mark complete**: Change `[ ]` to `[x]` in tasks.md
599
101
 
600
- 1. **Parse tasks.md**:
601
- - Scan all tasks in order
602
- - Check completion status (`[x]` = complete, `[ ]` = incomplete)
603
- - **Extract model hints** (โšก haiku, ๐Ÿง  sonnet, ๐Ÿ’Ž opus)
604
- - Find first incomplete task
102
+ **After EVERY task completion** (CRITICAL):
605
103
 
606
- 2. **Determine starting point**:
607
- - If all tasks complete โ†’ Show completion message
608
- - If tasks incomplete โ†’ Resume from first incomplete task
609
- - If no tasks started โ†’ Start from T001
104
+ - **AC-sync hook fires automatically** (via PostToolUse on Edit/Write) updating spec.md ACs
105
+ - **Update docs inline**: CLAUDE.md (new commands/config/skills), README.md (user-facing changes), CHANGELOG.md (API/breaking changes), openapi.yaml (if API task + apiDocs.enabled)
106
+ - **GitHub sync** (if plugin enabled): close task issue, check off in epic, post completion comment
107
+ - Continue to next incomplete task
610
108
 
611
- 3. **Show resume context with model optimization**:
612
- ```
613
- ๐Ÿ“Š Resume Context:
109
+ ### Step 7: Handle Blockers
614
110
 
615
- Completed: 3/12 tasks (25%)
616
- โ”œโ”€ [โœ…] T001: โšก haiku - Setup auth module (P1) [saved $0.14]
617
- โ”œโ”€ [โœ…] T002: โšก haiku - Create user model (P1) [saved $0.14]
618
- โ”œโ”€ [โœ…] T003: ๐Ÿ’Ž opus - Implement JWT tokens (P1)
619
- โ””โ”€ [โณ] T004: โšก haiku - Add password hashing (P1) โ† RESUMING HERE
111
+ If task blocked: document in tasks.md, present options to user, skip or pause depending on severity.
620
112
 
621
- Remaining: 9 tasks (estimated 2 weeks)
622
- Cost savings so far: $0.28 (67% cheaper than all-Opus)
623
- ```
113
+ ### Step 8: Run Tests
624
114
 
625
- **Why smart resume?**
626
- - โœ… No manual tracking needed
627
- - โœ… Seamlessly continue after breaks
628
- - โœ… Prevents duplicate work
629
- - โœ… Shows progress at a glance
630
- - โœ… **Cost optimization through smart model selection**
115
+ After testable tasks: run relevant tests, fix failures immediately, only continue when green.
631
116
 
632
- ### Step 3: Update Status to In-Progress (if needed)
117
+ ### Step 9: Completion
633
118
 
634
- If status is "planned", update `spec.md` frontmatter:
119
+ When all tasks done:
120
+ 1. Run `/sw:sync-docs update` to sync living docs
121
+ 2. Suggest: `npm test` then `/sw:validate <id> --quality` then `/sw:done <id>`
635
122
 
636
- ```yaml
637
123
  ---
638
- increment: 0001-user-authentication
639
- status: in-progress # โ† Changed from "planned"
640
- started: 2025-10-28 # โ† Start date
641
- ---
642
- ```
643
-
644
- If already "in-progress", keep existing metadata.
645
-
646
- ### Step 4: Execute Tasks Sequentially
647
-
648
- **For each task in tasks.md**:
649
-
650
- 1. **Read task details**:
651
- - Task ID (T001, T002, etc.)
652
- - **Model hint** (โšก haiku, ๐Ÿง  sonnet, ๐Ÿ’Ž opus)
653
- - Description
654
- - Acceptance criteria
655
- - File paths affected
656
- - Implementation notes
657
-
658
- 2. **Select execution model**:
659
- - **Use model from task hint** (recommended, optimizes cost/speed)
660
- - OR use `--model` override if specified by user
661
- - Show selected model and reasoning
662
-
663
- 3. **Execute task**:
664
- - Follow plan.md architecture
665
- - Implement using detected tech stack
666
- - Write clean, maintainable code
667
- - Add inline documentation
668
- - **Track cost savings** when using Haiku
669
-
670
- 3. **Mark task complete** in tasks.md:
671
- - Change `[ ]` โ†’ `[x]`
672
- - Add completion timestamp
673
- - Note any deviations from plan
674
-
675
- 4. **๐Ÿ”ฅ CRITICAL: After EVERY task completion**:
676
-
677
- **Step A: Hook executes automatically (via .claude/hooks.json)**:
678
- - ๐Ÿ”Š Plays completion sound (Glass.aiff on macOS)
679
- - ๐Ÿ“ Shows reminder message
680
- - โœ… This happens automatically when you mark task complete
681
124
 
682
- **Step B: Update GitHub Issue (if GitHub plugin enabled)**:
683
- - Close task GitHub issue (#43, #44, etc.)
684
- - Check off task in epic issue
685
- - Post completion comment with stats:
686
- - Files modified (+lines/-lines)
687
- - Tests passing
688
- - Actual vs estimated duration
689
- - Brief summary of changes
690
- - Next task
691
- - Update epic progress (X/Y tasks completed, Z%)
692
- - Add 'in-progress' label to epic (if first task)
693
-
694
- **Example GitHub sync**:
695
- ```
696
- ๐Ÿ”— Syncing to GitHub...
697
- โœ“ Closed task issue #43
698
- โœ“ Checked off [T-001] in epic #42
699
- โœ“ Posted completion comment
700
- โœ“ Updated epic progress: 7/48 tasks (15%)
701
- ```
702
-
703
- **Step C: Update project documentation inline**:
704
- - Update CLAUDE.md if task added:
705
- - New commands or CLI flags
706
- - New file structure
707
- - New configuration options
708
- - New skills or agents
709
- - Update README.md if task added:
710
- - User-facing features
711
- - Installation steps
712
- - Usage examples
713
- - API changes
714
- - Update CHANGELOG.md if task added:
715
- - Public API changes
716
- - Breaking changes
717
- - New features
718
- - **Update API docs if task is API-related** (only if `apiDocs.enabled` in config):
719
- - New endpoint โ†’ Update openapi.yaml (or regenerate from decorators)
720
- - On increment close โ†’ Generate postman-collection.json from OpenAPI
721
-
722
- **Step D: Continue to next task**:
723
- - Do NOT call `/sw:sync-docs` yet (wait until all tasks complete)
724
- - Move to next incomplete task
725
-
726
- **Example task execution**:
727
- ```
728
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
729
- TASK T001: Create User model (PostgreSQL)
730
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
731
-
732
- ๐Ÿ“‹ Task details:
733
- โ€ข File: src/models/User.ts
734
- โ€ข Model: โšก haiku (clear instructions, specific file path)
735
- โ€ข Description: Create User model with Prisma
736
- โ€ข Acceptance: Model has id, email, passwordHash, createdAt fields
737
-
738
- โšก Executing with Haiku (3x faster, ~$0.0025 vs $0.15 Opus)...
739
- โœ“ Created src/models/User.ts
740
- โœ“ Added Prisma schema definition
741
- โœ“ Generated migration file
742
- โœ“ Added inline documentation
743
-
744
- โœ… Task T001 completed
745
- ๐Ÿ’ฐ Cost savings: $0.1475 (98% cheaper than Opus)
746
-
747
- ๐Ÿ”Š [Glass.aiff plays automatically via hook]
748
- ๐Ÿ”” Task completed! Remember to update documentation...
749
-
750
- ๐Ÿ”— Syncing to GitHub (if enabled):
751
- โœ“ Closed task issue #43
752
- โœ“ Checked off [T-001] in epic #42
753
- โœ“ Posted completion comment to #43
754
- โœ“ Updated epic #42 progress: 1/42 tasks (2%)
755
-
756
- ๐Ÿ“ Updating project documentation:
757
- โœ“ Updated CLAUDE.md (added User model to schema reference)
758
- โœ“ Updated README.md (added database section with example)
759
- โœ“ No CHANGELOG.md update needed (internal model)
760
-
761
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
762
-
763
- Progress: 1/42 tasks (2%) | Cost savings so far: $0.05 | Estimated remaining: 3.9 weeks
764
-
765
- Moving to next task...
766
- ```
767
-
768
- ### Step 4: Handle Blockers
769
-
770
- If a task cannot be completed:
771
-
772
- 1. **Document blocker**:
773
- - Add to tasks.md as note
774
- - Explain reason (missing dependency, unclear requirement, etc.)
775
-
776
- 2. **Ask user for clarification**:
777
- - Present blocker clearly
778
- - Offer solutions or alternatives
779
- - Wait for user decision
780
-
781
- 3. **Continue or pause**:
782
- - Skip to next task if blocker is non-blocking
783
- - Pause if blocker is critical
784
-
785
- **Example blocker**:
786
- ```
787
- โš ๏ธ Blocker on Task T012: "Add email verification"
788
-
789
- Issue: Email service provider not specified in plan.md
790
-
791
- Options:
792
- A) Use SendGrid (recommended, $15/month)
793
- B) Use AWS SES (cheaper, $1/1000 emails)
794
- C) Use SMTP (self-hosted, free but complex)
795
- D) Skip for now, add as new task later
796
-
797
- Your choice? [A/B/C/D]: _
798
- ```
799
-
800
- ### Step 5: Run Tests Continuously
801
-
802
- **After completing tasks that affect testable functionality**:
803
-
804
- 1. **Run relevant tests**:
805
- - Unit tests for the module
806
- - Integration tests if applicable
807
- - Show pass/fail status
808
-
809
- 2. **If tests fail**:
810
- - Show error details
811
- - Fix immediately
812
- - Re-run tests
813
- - Continue only when tests pass
814
-
815
- **Example test run**:
816
- ```
817
- ๐Ÿงช Running tests for auth module...
818
-
819
- โœ“ User model validation
820
- โœ“ Password hashing
821
- โœ— JWT token generation (FAILED)
822
- Expected token to expire in 24h, got 1h
823
-
824
- ๐Ÿ”ง Fixing test failure...
825
- โ€ข Updated JWT expiry config in plan.md
826
- โ€ข Fixed token generation in src/auth/jwt.ts
827
-
828
- Re-running tests...
829
-
830
- โœ“ JWT token generation
831
-
832
- โœ… All tests passing (3/3)
833
- ```
834
-
835
- ### Step 6: Progress Tracking
836
-
837
- **Show progress regularly**:
838
-
839
- ```
840
- ๐Ÿ“Š Increment Progress: 0001-user-authentication
841
-
842
- Tasks completed: 15/42 (36%)
843
- Time elapsed: 1.2 weeks
844
- Estimated remaining: 2.1 weeks
845
- On track: โœ… Yes
846
-
847
- Current phase: Backend Implementation
848
- Next phase: Frontend Integration
849
-
850
- Recent completions:
851
- โœ“ T012: Add email verification (2h ago)
852
- โœ“ T013: Implement password reset (1h ago)
853
- โœ“ T014: Add rate limiting (30m ago)
854
-
855
- Up next:
856
- [ ] T015: Create login API endpoint
857
- [ ] T016: Add JWT middleware
858
- ```
859
-
860
- ### Step 7: Completion Check
861
-
862
- **When all tasks marked complete**:
863
-
864
- ```
865
- ๐ŸŽ‰ All tasks completed!
866
-
867
- โœ… Tasks: 42/42 (100%)
868
- โฑ๏ธ Time taken: 3.2 weeks (vs estimated 3-4 weeks)
869
-
870
- ๐Ÿ”Š [Playing celebration sound...]
871
-
872
- ๐Ÿ“ Now syncing implementation learnings to living docs...
873
- ```
874
-
875
- **CRITICAL: Now run `/sw:sync-docs update` to sync to living docs**:
876
-
877
- ```bash
878
- /sw:sync-docs update
879
- ```
880
-
881
- This will:
882
- - Update ADRs with implementation details (Proposed โ†’ Accepted)
883
- - Update API documentation with actual endpoints
884
- - Update architecture diagrams with actual system
885
- - Update feature lists with completed features
886
- - May prompt for conflict resolution if needed
887
-
888
- **After `/sw:sync-docs update` completes**:
889
-
890
- ```
891
- โœ… Living documentation synchronized!
892
-
893
- Next steps:
894
- 1. Run full test suite: npm test
895
- 2. Validate increment: /sw:validate 0001 --quality
896
- 3. Close increment: /sw:done 0001 (PM validates before closing)
897
- ```
898
-
899
- ---
900
-
901
- ## Hook Integration (CRITICAL!)
902
-
903
- **Post-Task Completion Hook** runs after EVERY task via `.claude/hooks.json`:
904
-
905
- ### Configuration
906
-
907
- **File**: `.claude/hooks.json`
908
-
909
- ```json
910
- {
911
- "hooks": {
912
- "PostToolUse": [
913
- {
914
- "matcher": "TodoWrite",
915
- "hooks": [
916
- {
917
- "type": "command",
918
- "command": "bash .claude/hooks/post-task-completion.sh"
919
- }
920
- ]
921
- }
922
- ]
923
- }
924
- }
925
- ```
926
-
927
- **Hook Script**: `.claude/hooks/post-task-completion.sh`
125
+ ## Credentials Auto-Execute
928
126
 
127
+ Before deployment tasks, check credentials (NEVER display values):
929
128
  ```bash
930
- #!/bin/bash
931
- # Plays completion sound and outputs reminder JSON
932
- # Output: {"continue": true, "systemMessage": "Task completed! Update docs..."}
129
+ grep -qE "SUPABASE|DATABASE_URL|CF_|AWS_|HETZNER" .env 2>/dev/null && echo "Credentials found"
933
130
  ```
934
-
935
- ### Hook Behavior
936
-
937
- **After EVERY task completion (via TodoWrite)**:
938
-
939
- 1. **Play sound synchronously**:
940
- - macOS: Glass.aiff via `afplay`
941
- - Linux: complete.oga via `paplay`
942
- - Windows: chimes.wav via PowerShell
943
- - Sound plays BEFORE Claude continues
944
-
945
- 2. **Show reminder**:
946
- - JSON systemMessage displayed to user
947
- - Reminds to update CLAUDE.md, README.md inline
948
-
949
- 3. **Log completion**:
950
- - Appends to `.specweave/logs/tasks.log`
951
-
952
- ### Documentation Updates (Manual)
953
-
954
- After each task, Claude should manually update:
955
-
956
- - **CLAUDE.md**: New commands, file structure, config options, skills, agents
957
- - **README.md**: User-facing features, installation, usage, API changes
958
- - **CHANGELOG.md**: Public API changes, breaking changes, new features
959
-
960
- **Living docs sync** (via `/sw:sync-docs update`):
961
- - Only after ALL tasks complete
962
- - Updates `.specweave/docs/` with implementation learnings
963
- - Updates ADRs from Proposed โ†’ Accepted
964
- - Updates architecture diagrams with actual system
131
+ If found: execute directly. If missing: ask user for credential.
965
132
 
966
133
  ---
967
134
 
968
- ## Examples
969
-
970
- ### Example 1: Execute Complete Increment
971
-
972
- ```bash
973
- /sw:do 0001
974
- ```
975
-
976
- **Output**:
977
- ```
978
- ๐Ÿ“‚ Loading increment 0001-user-authentication...
979
-
980
- โœ… Context loaded (spec.md, plan.md, tasks.md, tests.md)
981
-
982
- ๐Ÿ”จ Starting execution (42 tasks)...
983
-
984
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
985
- Task T001: Create User model
986
- โœ… Completed | ๐Ÿช Docs updated
987
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
988
-
989
- [... continues for all 42 tasks ...]
990
-
991
- ๐ŸŽ‰ All tasks completed (42/42)
992
-
993
- Next: /sw:validate 0001 --quality
994
- ```
995
-
996
- ### Example 2: Execute with Blocker
997
-
998
- ```bash
999
- /sw:do 0002
1000
- ```
1001
-
1002
- **Output**:
1003
- ```
1004
- ๐Ÿ“‚ Loading increment 0002-payment-processing...
1005
-
1006
- ๐Ÿ”จ Executing tasks...
1007
-
1008
- Task T005: Integrate Stripe payment
1009
- โš ๏ธ Blocker: Stripe API key not in .env
1010
-
1011
- Options:
1012
- A) Add API key now (provide test key)
1013
- B) Skip for now, add as separate task
1014
- C) Use mock payment provider
1015
-
1016
- Your choice? [A/B/C]: _
1017
- ```
1018
-
1019
- ### Example 3: Execute with Test Failure
1020
-
1021
- ```bash
1022
- /sw:do 0003
1023
- ```
1024
-
1025
- **Output**:
1026
- ```
1027
- ๐Ÿ“‚ Loading increment 0003-reporting-dashboard...
1028
-
1029
- Task T008: Add CSV export
1030
- โœ… Completed
1031
-
1032
- ๐Ÿงช Running tests...
1033
- โœ— CSV export test failed
1034
- Expected: 1000 rows
1035
- Got: 999 rows (off-by-one error)
1036
-
1037
- ๐Ÿ”ง Fixing test failure...
1038
- โ€ข Fixed loop boundary in src/reports/csv.ts
1039
-
1040
- โœ… Tests now passing (12/12)
1041
-
1042
- ๐Ÿช Docs updated
1043
-
1044
- Next task: T009
1045
- ```
1046
-
1047
- ---
1048
-
1049
- ## Error Handling
1050
-
1051
- ### Increment Not Found
1052
- ```
1053
- โŒ Error: Increment 0001 not found
1054
-
1055
- Available increments:
1056
- โ€ข 0002-core-enhancements (planned)
1057
- โ€ข 0003-payment-processing (in-progress)
1058
-
1059
- Usage: /sw:do <increment-id>
1060
- ```
1061
-
1062
- ### Increment Not Planned
1063
- ```
1064
- โŒ Error: Cannot execute increment 0001 (status: backlog)
1065
-
1066
- Increment must be "planned" before execution.
1067
-
1068
- Run: /sw:increment "User authentication" to plan this increment first.
1069
- ```
1070
-
1071
- ### No Tasks to Execute
1072
- ```
1073
- โš ๏ธ Warning: No tasks found in tasks.md
1074
-
1075
- This usually means:
1076
- 1. Tasks weren't auto-generated from plan.md
1077
- 2. Tasks.md is empty or missing
1078
-
1079
- Options:
1080
- 1. Re-plan increment: /sw:increment 0001 (regenerate tasks)
1081
- 2. Add tasks manually: Edit .specweave/increments/0001-name/tasks.md
1082
- ```
1083
-
1084
- ---
1085
-
1086
- ## Related Commands
1087
-
1088
- - `/increment`: Plan increment (creates spec.md, plan.md, tasks.md)
1089
- - `/validate`: Validate quality before executing
1090
- - `/specweave done`: Close increment (PM validates completion)
1091
- - `/list-increments`: List all increments with status
1092
-
1093
- ---
1094
-
1095
- ## Related Skills
1096
-
1097
- - `context-loader`: Loads relevant context (70% token reduction)
1098
- - `nodejs-backend`: Node.js implementation knowledge
1099
- - `python-backend`: Python implementation knowledge
1100
- - `nextjs`: Next.js implementation knowledge
1101
- - `frontend`: React/Vue/Angular implementation knowledge
1102
-
1103
- ---
1104
-
1105
- ---
1106
-
1107
- ## ๐Ÿ” Auto-Execute with Credentials (MANDATORY)
1108
-
1109
- **When executing deployment tasks, ALWAYS follow auto-execute rules:**
1110
-
1111
- ### The Golden Rule
1112
-
1113
- ```
1114
- โŒ FORBIDDEN: "Next Steps: Run wrangler deploy"
1115
- โŒ FORBIDDEN: "Execute the schema in Supabase SQL Editor"
1116
- โŒ FORBIDDEN: "Set secret via: wrangler secret put..."
1117
-
1118
- โœ… REQUIRED: Execute commands DIRECTLY using available credentials
1119
- ```
1120
-
1121
- ### Before Any Deployment Task
1122
-
1123
- ```bash
1124
- # Always check for credentials FIRST (presence only - never display values!):
1125
- grep -qE "SUPABASE|DATABASE_URL|CF_|AWS_|HETZNER" .env 2>/dev/null && echo "Credentials found in .env"
1126
- wrangler whoami 2>/dev/null
1127
- aws sts get-caller-identity 2>/dev/null
1128
- gh auth status 2>/dev/null
1129
- ```
1130
-
1131
- ### Auto-Execute Decision
1132
-
1133
- | Credentials Found? | Action |
1134
- |-------------------|--------|
1135
- | โœ… Found | Execute command directly, show success message |
1136
- | โŒ Not found | ASK for credential (don't show manual steps) |
1137
-
1138
- ### Example: Supabase Migration Task
1139
-
1140
- **If DATABASE_URL exists in .env:**
1141
- ```bash
1142
- source .env
1143
- psql "$DATABASE_URL" -f src/db/schema.sql
1144
- echo "โœ… Schema applied successfully"
1145
- ```
1146
-
1147
- **If DATABASE_URL missing:**
1148
- ```markdown
1149
- ๐Ÿ” **Credential Required**
1150
-
1151
- I need your Supabase database URL to execute the migration.
1152
-
1153
- **Please paste your DATABASE_URL:**
1154
- [I will save to .env and execute automatically]
1155
- ```
1156
-
1157
- ---
1158
-
1159
- ## Why "/do" instead of "/do"?
1160
-
1161
- **Universal applicability**: SpecWeave isn't just for software engineering!
1162
-
1163
- - Software projects: Writing code, tests, documentation
1164
- - Writing projects: Chapters, articles, research papers
1165
- - Design projects: Mockups, prototypes, design systems
1166
- - Business projects: Reports, analyses, presentations
1167
- - Creative projects: Scripts, storyboards, content
1168
-
1169
- "/do" works for any domain - it's about **executing the planned work**, whatever that work may be.
1170
-
1171
- ---
1172
-
1173
- **Important**: This command is designed for continuous execution. It's normal to run `/sw:do` and let it execute multiple tasks sequentially with documentation updates after each one.
1174
-
1175
- **Best Practice**: Always run `/sw:validate 0001 --quality` after execution to ensure quality before closing with `/sw:done`.
135
+ Run `/sw:validate` after execution to ensure quality before closing with `/sw:done`.