specweave 0.1.6 → 0.1.8

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.
@@ -9,7 +9,7 @@ SpecWeave provides short aliases for frequently used commands to speed up your w
9
9
  | Full Command | Alias | Description |
10
10
  |--------------|-------|-------------|
11
11
  | `/create-project` | `/init` | Initialize new SpecWeave project |
12
- | `/create-increment` | `/ci` | Create new increment |
12
+ | `/create-increment` | `/pi` | Plan Product Increment (create new increment) |
13
13
  | `/start-increment` | `/si` | Start working on increment |
14
14
  | `/add-tasks` | `/at` | Add tasks to increment |
15
15
  | `/validate-increment` | `/vi` | Validate increment quality |
@@ -55,8 +55,8 @@ Use aliases when:
55
55
  # 1. Initialize project
56
56
  /init my-saas
57
57
 
58
- # 2. Create first increment
59
- /ci "User authentication"
58
+ # 2. Plan Product Increment (PI = Product Increment in Agile)
59
+ /pi "User authentication"
60
60
 
61
61
  # 3. Start working
62
62
  /si 0001
@@ -94,7 +94,7 @@ Use aliases when:
94
94
  | Command | Alias | Description |
95
95
  |---------|-------|-------------|
96
96
  | `/create-project` | `/init` | Bootstrap new SpecWeave project with auto-detection |
97
- | `/create-increment` | `/ci` | Create new increment with PM/Architect/QA planning |
97
+ | `/create-increment` | `/pi` | Plan Product Increment with PM/Architect/QA planning |
98
98
  | `/start-increment` | `/si` | Start working on an increment (load context, create branch) |
99
99
  | `/add-tasks` | `/at` | Add tasks to existing increment |
100
100
  | `/validate-increment` | `/vi` | Validate increment (120 rules + optional LLM quality judge) |
@@ -168,4 +168,6 @@ npm run install:commands
168
168
 
169
169
  **💡 Pro Tip**: Learn the aliases - they'll save you hundreds of keystrokes per day!
170
170
 
171
- **Most used**: `/ci`, `/si`, `/vi`, `/done`, `/ls`
171
+ **Most used**: `/pi`, `/si`, `/vi`, `/done`, `/ls`
172
+
173
+ **PI** = Product Increment (standard Agile/Scrum terminology)
@@ -0,0 +1,433 @@
1
+ ---
2
+ name: build
3
+ description: Execute increment implementation following spec and plan - hooks run after EVERY task
4
+ ---
5
+
6
+ # Build Increment
7
+
8
+ **Implementation Execution**: Following spec.md and plan.md to build the increment.
9
+
10
+ You are helping the user implement a SpecWeave increment by executing tasks from tasks.md with automatic documentation updates after EVERY task completion.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /build <increment-id>
16
+ ```
17
+
18
+ ## Arguments
19
+
20
+ - `<increment-id>`: Required. Increment ID (e.g., "001", "0001", "1", "0042")
21
+
22
+ ---
23
+
24
+ ## Workflow
25
+
26
+ ### Step 1: Load Context
27
+
28
+ 1. **Find increment directory**:
29
+ - Normalize ID to 4-digit format (e.g., "1" → "0001")
30
+ - Find `.specweave/increments/0001-name/`
31
+ - Verify increment exists
32
+
33
+ 2. **Load specification and plan**:
34
+ - Read `spec.md` - Understand WHAT and WHY
35
+ - Read `plan.md` - Understand HOW
36
+ - Read `tasks.md` - Understand implementation steps
37
+ - Read `tests.md` - Understand test strategy
38
+
39
+ 3. **Verify readiness**:
40
+ - Check status is "planned" (not already in-progress or completed)
41
+ - Check no blocking dependencies
42
+ - Check tasks.md has tasks to execute
43
+
44
+ **Example output**:
45
+ ```
46
+ 📂 Loading increment 0001-user-authentication...
47
+
48
+ ✅ Loaded context:
49
+ • spec.md (6 user stories, 15 requirements)
50
+ • plan.md (Architecture: JWT + PostgreSQL)
51
+ • tasks.md (42 tasks, estimated 3-4 weeks)
52
+ • tests.md (12 test cases, 85% coverage)
53
+
54
+ 🎯 Ready to build!
55
+ ```
56
+
57
+ ### Step 2: Update Status to In-Progress
58
+
59
+ Update `spec.md` frontmatter:
60
+
61
+ ```yaml
62
+ ---
63
+ increment: 0001-user-authentication
64
+ status: in-progress # ← Changed from "planned"
65
+ started: 2025-10-28 # ← Start date
66
+ ---
67
+ ```
68
+
69
+ ### Step 3: Execute Tasks Sequentially
70
+
71
+ **For each task in tasks.md**:
72
+
73
+ 1. **Read task details**:
74
+ - Task ID (T001, T002, etc.)
75
+ - Description
76
+ - Acceptance criteria
77
+ - File paths affected
78
+ - Implementation notes
79
+
80
+ 2. **Execute task**:
81
+ - Follow plan.md architecture
82
+ - Implement using detected tech stack
83
+ - Write clean, maintainable code
84
+ - Add inline documentation
85
+
86
+ 3. **Mark task complete** in tasks.md:
87
+ - Change `[ ]` → `[x]`
88
+ - Add completion timestamp
89
+ - Note any deviations from plan
90
+
91
+ 4. **🔥 CRITICAL: Run hooks after EVERY task**:
92
+ - Hook: `post-task-completion`
93
+ - Actions:
94
+ - Update documentation (CLAUDE.md, README.md)
95
+ - Update CHANGELOG.md if needed
96
+ - Verify docs reflect new code
97
+ - Check for doc/code drift
98
+
99
+ **Example task execution**:
100
+ ```
101
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
102
+ TASK T001: Create User model (PostgreSQL)
103
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
104
+
105
+ 📋 Task details:
106
+ • File: src/models/User.ts
107
+ • Description: Create User model with Prisma
108
+ • Acceptance: Model has id, email, passwordHash, createdAt fields
109
+
110
+ 🔨 Implementing...
111
+ ✓ Created src/models/User.ts
112
+ ✓ Added Prisma schema definition
113
+ ✓ Generated migration file
114
+ ✓ Added inline documentation
115
+
116
+ ✅ Task T001 completed
117
+
118
+ 🪝 Running post-task hooks...
119
+ ✓ Updated CLAUDE.md (added User model to schema)
120
+ ✓ Updated README.md (added database section)
121
+ ✓ Verified documentation consistency
122
+
123
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
124
+
125
+ Progress: 1/42 tasks (2%) | Estimated remaining: 3.9 weeks
126
+ ```
127
+
128
+ ### Step 4: Handle Blockers
129
+
130
+ If a task cannot be completed:
131
+
132
+ 1. **Document blocker**:
133
+ - Add to tasks.md as note
134
+ - Explain reason (missing dependency, unclear requirement, etc.)
135
+
136
+ 2. **Ask user for clarification**:
137
+ - Present blocker clearly
138
+ - Offer solutions or alternatives
139
+ - Wait for user decision
140
+
141
+ 3. **Continue or pause**:
142
+ - Skip to next task if blocker is non-blocking
143
+ - Pause if blocker is critical
144
+
145
+ **Example blocker**:
146
+ ```
147
+ ⚠️ Blocker on Task T012: "Add email verification"
148
+
149
+ Issue: Email service provider not specified in plan.md
150
+
151
+ Options:
152
+ A) Use SendGrid (recommended, $15/month)
153
+ B) Use AWS SES (cheaper, $1/1000 emails)
154
+ C) Use SMTP (self-hosted, free but complex)
155
+ D) Skip for now, add as new task later
156
+
157
+ Your choice? [A/B/C/D]: _
158
+ ```
159
+
160
+ ### Step 5: Run Tests Continuously
161
+
162
+ **After completing tasks that affect testable functionality**:
163
+
164
+ 1. **Run relevant tests**:
165
+ - Unit tests for the module
166
+ - Integration tests if applicable
167
+ - Show pass/fail status
168
+
169
+ 2. **If tests fail**:
170
+ - Show error details
171
+ - Fix immediately
172
+ - Re-run tests
173
+ - Continue only when tests pass
174
+
175
+ **Example test run**:
176
+ ```
177
+ 🧪 Running tests for auth module...
178
+
179
+ ✓ User model validation
180
+ ✓ Password hashing
181
+ ✗ JWT token generation (FAILED)
182
+ Expected token to expire in 24h, got 1h
183
+
184
+ 🔧 Fixing test failure...
185
+ • Updated JWT expiry config in plan.md
186
+ • Fixed token generation in src/auth/jwt.ts
187
+
188
+ Re-running tests...
189
+
190
+ ✓ JWT token generation
191
+
192
+ ✅ All tests passing (3/3)
193
+ ```
194
+
195
+ ### Step 6: Progress Tracking
196
+
197
+ **Show progress regularly**:
198
+
199
+ ```
200
+ 📊 Increment Progress: 0001-user-authentication
201
+
202
+ Tasks completed: 15/42 (36%)
203
+ Time elapsed: 1.2 weeks
204
+ Estimated remaining: 2.1 weeks
205
+ On track: ✅ Yes
206
+
207
+ Current phase: Backend Implementation
208
+ Next phase: Frontend Integration
209
+
210
+ Recent completions:
211
+ ✓ T012: Add email verification (2h ago)
212
+ ✓ T013: Implement password reset (1h ago)
213
+ ✓ T014: Add rate limiting (30m ago)
214
+
215
+ Up next:
216
+ [ ] T015: Create login API endpoint
217
+ [ ] T016: Add JWT middleware
218
+ ```
219
+
220
+ ### Step 7: Completion Check
221
+
222
+ **When all tasks marked complete**:
223
+
224
+ ```
225
+ 🎉 All tasks completed!
226
+
227
+ ✅ Tasks: 42/42 (100%)
228
+ ⏱️ Time taken: 3.2 weeks (vs estimated 3-4 weeks)
229
+
230
+ Next steps:
231
+ 1. Run full test suite: npm test
232
+ 2. Validate increment: /validate 0001 --quality
233
+ 3. Close increment: /done 0001 (PM validates before closing)
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Hook Integration (CRITICAL!)
239
+
240
+ **Post-Task Completion Hook** runs after EVERY task:
241
+
242
+ ### Configuration
243
+
244
+ **File**: `.specweave/config.yaml`
245
+
246
+ ```yaml
247
+ hooks:
248
+ enabled: true
249
+ post_task_completion:
250
+ enabled: true # ← MUST be true
251
+ actions:
252
+ - update_documentation # Update CLAUDE.md, README.md
253
+ - update_changelog # Update CHANGELOG.md if public API changes
254
+ - verify_consistency # Check docs match code
255
+ ```
256
+
257
+ ### Hook Behavior
258
+
259
+ **After EVERY task completion**:
260
+
261
+ 1. **Scan changed files**:
262
+ - Detect new functions, classes, APIs
263
+ - Detect changed behavior
264
+ - Detect new configuration
265
+
266
+ 2. **Update documentation**:
267
+ - CLAUDE.md: Add to quick reference tables
268
+ - README.md: Update examples if needed
269
+ - API docs: Regenerate if API changed
270
+
271
+ 3. **Verify consistency**:
272
+ - Check docs mention new features
273
+ - Check no stale references
274
+ - Check examples still work
275
+
276
+ 4. **Report**:
277
+ ```
278
+ 🪝 Post-task documentation update:
279
+
280
+ Files updated:
281
+ • CLAUDE.md (+3 lines: Added User model to schema reference)
282
+ • README.md (+12 lines: Added authentication example)
283
+
284
+ Consistency checks:
285
+ ✓ All code references up to date
286
+ ✓ Examples tested and working
287
+ ✓ No stale documentation
288
+
289
+ Documentation drift: 0% (perfect sync)
290
+ ```
291
+
292
+ ---
293
+
294
+ ## Examples
295
+
296
+ ### Example 1: Build Complete Increment
297
+
298
+ ```bash
299
+ /build 0001
300
+ ```
301
+
302
+ **Output**:
303
+ ```
304
+ 📂 Loading increment 0001-user-authentication...
305
+
306
+ ✅ Context loaded (spec.md, plan.md, tasks.md, tests.md)
307
+
308
+ 🔨 Starting implementation (42 tasks)...
309
+
310
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
311
+ Task T001: Create User model
312
+ ✅ Completed | 🪝 Docs updated
313
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
314
+
315
+ [... continues for all 42 tasks ...]
316
+
317
+ 🎉 All tasks completed (42/42)
318
+
319
+ Next: /validate 0001 --quality
320
+ ```
321
+
322
+ ### Example 2: Build with Blocker
323
+
324
+ ```bash
325
+ /build 0002
326
+ ```
327
+
328
+ **Output**:
329
+ ```
330
+ 📂 Loading increment 0002-payment-processing...
331
+
332
+ 🔨 Implementing tasks...
333
+
334
+ Task T005: Integrate Stripe payment
335
+ ⚠️ Blocker: Stripe API key not in .env
336
+
337
+ Options:
338
+ A) Add API key now (provide test key)
339
+ B) Skip for now, add as separate task
340
+ C) Use mock payment provider
341
+
342
+ Your choice? [A/B/C]: _
343
+ ```
344
+
345
+ ### Example 3: Build with Test Failure
346
+
347
+ ```bash
348
+ /build 0003
349
+ ```
350
+
351
+ **Output**:
352
+ ```
353
+ 📂 Loading increment 0003-reporting-dashboard...
354
+
355
+ Task T008: Add CSV export
356
+ ✅ Completed
357
+
358
+ 🧪 Running tests...
359
+ ✗ CSV export test failed
360
+ Expected: 1000 rows
361
+ Got: 999 rows (off-by-one error)
362
+
363
+ 🔧 Fixing test failure...
364
+ • Fixed loop boundary in src/reports/csv.ts
365
+
366
+ ✅ Tests now passing (12/12)
367
+
368
+ 🪝 Docs updated
369
+
370
+ Next task: T009
371
+ ```
372
+
373
+ ---
374
+
375
+ ## Error Handling
376
+
377
+ ### Increment Not Found
378
+ ```
379
+ ❌ Error: Increment 0001 not found
380
+
381
+ Available increments:
382
+ • 0002-core-enhancements (planned)
383
+ • 0003-payment-processing (in-progress)
384
+
385
+ Usage: /build <increment-id>
386
+ ```
387
+
388
+ ### Increment Not Planned
389
+ ```
390
+ ❌ Error: Cannot build increment 0001 (status: backlog)
391
+
392
+ Increment must be "planned" before building.
393
+
394
+ Run: /increment "User authentication" to plan this increment first.
395
+ ```
396
+
397
+ ### No Tasks to Execute
398
+ ```
399
+ ⚠️ Warning: No tasks found in tasks.md
400
+
401
+ This usually means:
402
+ 1. Tasks weren't auto-generated from plan.md
403
+ 2. Tasks.md is empty or missing
404
+
405
+ Options:
406
+ 1. Re-plan increment: /increment 0001 (regenerate tasks)
407
+ 2. Add tasks manually: Edit .specweave/increments/0001-name/tasks.md
408
+ ```
409
+
410
+ ---
411
+
412
+ ## Related Commands
413
+
414
+ - `/increment`: Plan increment (creates spec.md, plan.md, tasks.md)
415
+ - `/validate`: Validate quality before building
416
+ - `/done`: Close increment (PM validates completion)
417
+ - `/list-increments`: List all increments with status
418
+
419
+ ---
420
+
421
+ ## Related Skills
422
+
423
+ - `context-loader`: Loads relevant context (70% token reduction)
424
+ - `nodejs-backend`: Node.js implementation knowledge
425
+ - `python-backend`: Python implementation knowledge
426
+ - `nextjs`: Next.js implementation knowledge
427
+ - `frontend`: React/Vue/Angular implementation knowledge
428
+
429
+ ---
430
+
431
+ **Important**: This command is designed for continuous execution. It's normal to run `/build` and let it execute multiple tasks sequentially with documentation updates after each one.
432
+
433
+ **Best Practice**: Always run `/validate 0001 --quality` after building to ensure quality before closing with `/done`.