specweave 1.0.227 → 1.0.228

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 (107) hide show
  1. package/CLAUDE.md +107 -387
  2. package/README.md +3 -0
  3. package/bin/specweave.js +0 -20
  4. package/dist/src/cli/commands/update.d.ts.map +1 -1
  5. package/dist/src/cli/commands/update.js +30 -0
  6. package/dist/src/cli/commands/update.js.map +1 -1
  7. package/dist/src/core/increment/completion-validator.d.ts +23 -0
  8. package/dist/src/core/increment/completion-validator.d.ts.map +1 -1
  9. package/dist/src/core/increment/completion-validator.js +71 -0
  10. package/dist/src/core/increment/completion-validator.js.map +1 -1
  11. package/dist/src/core/increment/metadata-manager.d.ts +4 -0
  12. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  13. package/dist/src/core/increment/metadata-manager.js +7 -0
  14. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  15. package/dist/src/core/increment/metadata-validator.d.ts.map +1 -1
  16. package/dist/src/core/increment/metadata-validator.js +39 -4
  17. package/dist/src/core/increment/metadata-validator.js.map +1 -1
  18. package/dist/src/core/lsp/cache/index.d.ts +1 -1
  19. package/dist/src/core/lsp/cache/index.js +1 -1
  20. package/dist/src/core/lsp/cache/symbol-cache.d.ts +26 -16
  21. package/dist/src/core/lsp/cache/symbol-cache.d.ts.map +1 -1
  22. package/dist/src/core/lsp/cache/symbol-cache.js +78 -47
  23. package/dist/src/core/lsp/cache/symbol-cache.js.map +1 -1
  24. package/dist/src/core/lsp/config/language-analyzer.d.ts.map +1 -1
  25. package/dist/src/core/lsp/config/language-analyzer.js +3 -1
  26. package/dist/src/core/lsp/config/language-analyzer.js.map +1 -1
  27. package/dist/src/core/lsp/config/lsp-config.d.ts +3 -0
  28. package/dist/src/core/lsp/config/lsp-config.d.ts.map +1 -1
  29. package/dist/src/core/lsp/config/lsp-config.js +6 -1
  30. package/dist/src/core/lsp/config/lsp-config.js.map +1 -1
  31. package/dist/src/core/lsp/config/project-detector.d.ts.map +1 -1
  32. package/dist/src/core/lsp/config/project-detector.js +43 -17
  33. package/dist/src/core/lsp/config/project-detector.js.map +1 -1
  34. package/dist/src/core/lsp/diagnostics/progress.d.ts.map +1 -1
  35. package/dist/src/core/lsp/diagnostics/progress.js +9 -6
  36. package/dist/src/core/lsp/diagnostics/progress.js.map +1 -1
  37. package/dist/src/core/lsp/index.d.ts +1 -2
  38. package/dist/src/core/lsp/index.d.ts.map +1 -1
  39. package/dist/src/core/lsp/index.js +1 -2
  40. package/dist/src/core/lsp/index.js.map +1 -1
  41. package/dist/src/core/lsp/warmup/executor.d.ts +1 -0
  42. package/dist/src/core/lsp/warmup/executor.d.ts.map +1 -1
  43. package/dist/src/core/lsp/warmup/executor.js +7 -1
  44. package/dist/src/core/lsp/warmup/executor.js.map +1 -1
  45. package/dist/src/core/lsp/warmup/strategies/csharp.d.ts.map +1 -1
  46. package/dist/src/core/lsp/warmup/strategies/csharp.js +18 -4
  47. package/dist/src/core/lsp/warmup/strategies/csharp.js.map +1 -1
  48. package/dist/src/core/lsp/warmup/strategies/go.d.ts.map +1 -1
  49. package/dist/src/core/lsp/warmup/strategies/go.js +8 -1
  50. package/dist/src/core/lsp/warmup/strategies/go.js.map +1 -1
  51. package/dist/src/core/lsp/warmup/strategies/python.d.ts.map +1 -1
  52. package/dist/src/core/lsp/warmup/strategies/python.js +10 -3
  53. package/dist/src/core/lsp/warmup/strategies/python.js.map +1 -1
  54. package/dist/src/core/lsp/warmup/strategies/rust.d.ts.map +1 -1
  55. package/dist/src/core/lsp/warmup/strategies/rust.js +8 -1
  56. package/dist/src/core/lsp/warmup/strategies/rust.js.map +1 -1
  57. package/dist/src/core/lsp/warmup/strategies/typescript.d.ts.map +1 -1
  58. package/dist/src/core/lsp/warmup/strategies/typescript.js +9 -2
  59. package/dist/src/core/lsp/warmup/strategies/typescript.js.map +1 -1
  60. package/dist/src/core/reflection/index.d.ts +7 -6
  61. package/dist/src/core/reflection/index.d.ts.map +1 -1
  62. package/dist/src/core/reflection/index.js +8 -6
  63. package/dist/src/core/reflection/index.js.map +1 -1
  64. package/dist/src/core/reflection/reflect-handler.d.ts +12 -13
  65. package/dist/src/core/reflection/reflect-handler.d.ts.map +1 -1
  66. package/dist/src/core/reflection/reflect-handler.js +72 -43
  67. package/dist/src/core/reflection/reflect-handler.js.map +1 -1
  68. package/dist/src/core/reflection/skill-memories.d.ts +47 -0
  69. package/dist/src/core/reflection/skill-memories.d.ts.map +1 -1
  70. package/dist/src/core/reflection/skill-memories.js +119 -0
  71. package/dist/src/core/reflection/skill-memories.js.map +1 -1
  72. package/dist/src/core/session/session-state.d.ts.map +1 -1
  73. package/dist/src/core/session/session-state.js +80 -23
  74. package/dist/src/core/session/session-state.js.map +1 -1
  75. package/dist/src/utils/increment-id-validator.d.ts +71 -0
  76. package/dist/src/utils/increment-id-validator.d.ts.map +1 -0
  77. package/dist/src/utils/increment-id-validator.js +112 -0
  78. package/dist/src/utils/increment-id-validator.js.map +1 -0
  79. package/dist/src/utils/platform-utils.d.ts +3 -0
  80. package/dist/src/utils/platform-utils.d.ts.map +1 -1
  81. package/dist/src/utils/platform-utils.js +27 -18
  82. package/dist/src/utils/platform-utils.js.map +1 -1
  83. package/package.json +4 -1
  84. package/plugins/specweave/PLUGIN.md +135 -0
  85. package/plugins/specweave/commands/done.md +35 -1
  86. package/plugins/specweave/hooks/hooks.json +4 -0
  87. package/plugins/specweave/hooks/stop-grill.sh +102 -0
  88. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.d.ts +4 -0
  89. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +7 -0
  90. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  91. package/plugins/specweave/skills/grill/SKILL.md +259 -0
  92. package/dist/src/cli/commands/validate-plugins.d.ts +0 -41
  93. package/dist/src/cli/commands/validate-plugins.d.ts.map +0 -1
  94. package/dist/src/cli/commands/validate-plugins.js +0 -175
  95. package/dist/src/cli/commands/validate-plugins.js.map +0 -1
  96. package/dist/src/core/living-docs/intelligent-analyzer/cache-manager.d.ts +0 -70
  97. package/dist/src/core/living-docs/intelligent-analyzer/cache-manager.d.ts.map +0 -1
  98. package/dist/src/core/living-docs/intelligent-analyzer/cache-manager.js +0 -188
  99. package/dist/src/core/living-docs/intelligent-analyzer/cache-manager.js.map +0 -1
  100. package/dist/src/types/dashboard-cache.d.ts +0 -183
  101. package/dist/src/types/dashboard-cache.d.ts.map +0 -1
  102. package/dist/src/types/dashboard-cache.js +0 -65
  103. package/dist/src/types/dashboard-cache.js.map +0 -1
  104. package/dist/src/utils/plugin-validator.d.ts +0 -170
  105. package/dist/src/utils/plugin-validator.d.ts.map +0 -1
  106. package/dist/src/utils/plugin-validator.js +0 -626
  107. package/dist/src/utils/plugin-validator.js.map +0 -1
package/CLAUDE.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- SW:META template="claude" version="1.0.226" sections="header,start,autodetect,metarule,rules,workflow,reflect,context,structure,taskformat,secrets,syncing,testing,tdd,api,limits,troubleshooting,lazyloading,principles,linking,mcp,auto,docs" -->
1
+ <!-- SW:META template="claude" version="1.0.228" sections="header,start,autodetect,metarule,rules,workflow,reflect,context,structure,taskformat,secrets,syncing,testing,tdd,api,limits,troubleshooting,lazyloading,principles,linking,mcp,auto,grill,docs" -->
2
2
 
3
3
  <!-- SW:SECTION:hook-priority version="1.0.171" -->
4
4
  ## ⛔ Hook Instructions Override Everything
@@ -13,24 +13,31 @@
13
13
  **SKILL FIRST ≠ only one skill.** Chain: hook skill → `sw-frontend:*` / `sw-backend:*` / etc → implement.
14
14
  <!-- SW:END:hook-priority -->
15
15
 
16
- <!-- SW:SECTION:header version="1.0.226" -->
16
+ <!-- SW:SECTION:header version="1.0.227" -->
17
17
  **Framework**: SpecWeave | **Truth**: `spec.md` + `tasks.md`
18
18
  <!-- SW:END:header -->
19
19
 
20
20
  <!-- SW:SECTION:claude-code-concepts version="1.0.150" -->
21
- ## Claude Code Concepts
21
+ ## Skills & Plugins
22
22
 
23
- | Concept | How to Use |
24
- |---------|------------|
25
- | **Skills** | `/skill-name` or auto-invoke via keywords |
26
- | **Plugins** | `claude plugin install sw@specweave` |
27
- | **Subagents** | Append "use subagents" for parallel work |
23
+ **Invoke**: `/skill-name` | auto-trigger by keywords | `Skill({ skill: "name" })`
28
24
 
29
- **Skill invocation control** (frontmatter):
30
- - `disable-model-invocation: true` → User only (side effects like `/deploy`)
31
- - `user-invocable: false` Claude only (background knowledge)
25
+ **Parallel work**: Append "use subagents" to requests
26
+
27
+ **Skill inventory**: 90+ skills across 23 plugins. Key skills: `sw:pm`, `sw:architect`, `sw:grill`, `sw:tdd-orchestrator`, `sw-frontend:*`, `sw-backend:*`, `sw-testing:*`
32
28
  <!-- SW:END:claude-code-concepts -->
33
29
 
30
+ ## Automatic Enforcement (Hooks)
31
+
32
+ Hooks auto-enforce quality gates - no manual intervention needed:
33
+
34
+ | Hook | Enforcement |
35
+ |------|-------------|
36
+ | `task-ac-sync` | Task completion → auto-updates spec.md ACs |
37
+ | `tdd-enforcement` | Blocks GREEN tasks if RED not done (strict mode) |
38
+ | `grill-guard` | Blocks `/sw:done` if grill not passed |
39
+ | `living-specs` | Auto-updates documentation on changes |
40
+
34
41
  <!-- SW:SECTION:skill-chaining version="1.0.179" -->
35
42
  ## ⚠️ MANDATORY: Skill Chaining During Implementation
36
43
 
@@ -73,21 +80,8 @@ Per [official Claude Code docs](https://code.claude.com/docs/en/skills):
73
80
 
74
81
  ### Example: Multi-Domain Request
75
82
 
76
- User says: "Create React dashboard with Stripe checkout and .NET backend"
77
-
78
- **WRONG** (what I did before):
79
- ```
80
- Skill(sw:increment-planner) → Implement everything directly
81
- ```
82
-
83
- **CORRECT** (what I should do):
84
- ```
85
- Skill(sw:increment-planner) → Plan the increment
86
- Skill(sw-frontend:frontend-architect) → React dashboard patterns
87
- Skill(sw-payments:stripe-integration) → Stripe checkout flow
88
- Skill(sw-backend:dotnet-backend) → .NET API patterns
89
- [Use specweave lsp CLI for code intelligence]
90
- ```
83
+ "Create React dashboard with Stripe checkout and .NET backend" → Chain skills:
84
+ `sw:increment-planner` → `sw-frontend:frontend-architect` → `sw-payments:stripe-integration` → `sw-backend:dotnet-backend`
91
85
 
92
86
  ### Skill Usage Checklist
93
87
 
@@ -111,19 +105,9 @@ Hook auto-detects "find references" requests and injects CLI instructions.
111
105
 
112
106
  ## Plugin Scopes
113
107
 
114
- | Scope | Use |
115
- |-------|-----|
116
- | **User** (default) | Personal plugins, all projects |
117
- | **Project** | Team plugins, shared via git |
118
- | **Local** | Gitignored, personal experiments |
119
-
120
- ```bash
121
- claude plugin install sw@specweave --scope project # Team-shared
122
- ```
108
+ `--scope user` (default, all projects) | `--scope project` (team, git-shared) | `--scope local` (gitignored)
123
109
 
124
- SpecWeave auto-installs: LSP → project scope, sw-* → user scope.
125
-
126
- <!-- SW:SECTION:start version="1.0.226" -->
110
+ <!-- SW:SECTION:start version="1.0.227" -->
127
111
  ## Getting Started
128
112
 
129
113
  **Initial increment**: `0001-project-setup` (auto-created by `specweave init`)
@@ -133,7 +117,7 @@ SpecWeave auto-installs: LSP → project scope, sw-* → user scope.
133
117
  2. **Customize**: Edit spec.md and use for setup tasks
134
118
  <!-- SW:END:start -->
135
119
 
136
- <!-- SW:SECTION:autodetect version="1.0.226" -->
120
+ <!-- SW:SECTION:autodetect version="1.0.227" -->
137
121
  ## Auto-Detection
138
122
 
139
123
  SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
@@ -143,7 +127,7 @@ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
143
127
  **Opt-out phrases**: "Just brainstorm first" | "Don't plan yet" | "Quick discussion" | "Let's explore ideas"
144
128
  <!-- SW:END:autodetect -->
145
129
 
146
- <!-- SW:SECTION:metarule version="1.0.226" -->
130
+ <!-- SW:SECTION:metarule version="1.0.227" -->
147
131
  ## Workflow Orchestration
148
132
 
149
133
  ### 1. Plan Mode Default
@@ -170,11 +154,11 @@ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
170
154
  ```
171
155
  <!-- SW:END:metarule -->
172
156
 
173
- <!-- SW:SECTION:rules version="1.0.226" -->
157
+ <!-- SW:SECTION:rules version="1.0.227" -->
174
158
  ## Rules
175
159
 
176
160
  1. **Files** → `.specweave/increments/####-name/` (see Structure section for details)
177
- 2. **Update immediately**: `Edit("tasks.md", "[ ] pending", "[x] completed")` + `Edit("spec.md", "[ ] AC-", "[x] AC-")`
161
+ 2. **Update tasks.md**: Mark tasks complete hooks auto-sync to spec.md ACs
178
162
  3. **Unique IDs**: Check ALL folders (active, archive, abandoned):
179
163
  ```bash
180
164
  find .specweave/increments -maxdepth 2 -type d -name "[0-9]*" | grep -oE '[0-9]{4}E?' | sort -u | tail -5
@@ -189,10 +173,10 @@ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
189
173
  Use next available number. **NEVER create duplicate prefixes.**
190
174
  <!-- SW:END:rules -->
191
175
 
192
- <!-- SW:SECTION:workflow version="1.0.226" -->
176
+ <!-- SW:SECTION:workflow version="1.0.228" -->
193
177
  ## Workflow
194
178
 
195
- `/sw:increment "X"` → `/sw:do` → `/sw:progress` → `/sw:done 0001`
179
+ `/sw:increment "X"` → `/sw:do` → `/sw:progress` → `/sw:grill` → `/sw:done 0001`
196
180
 
197
181
  | Cmd | Action |
198
182
  |-----|--------|
@@ -202,11 +186,12 @@ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
202
186
  | `/sw:auto-status` | Check auto session |
203
187
  | `/sw:cancel-auto` | ⚠️ EMERGENCY ONLY manual cancel |
204
188
  | `/sw:validate` | Quality check |
205
- | `/sw:done` | Close |
189
+ | `/sw:grill` | **MANDATORY** code review before close |
190
+ | `/sw:done` | Close (requires grill to pass first) |
206
191
  | `/sw-github:sync` | GitHub sync |
207
192
  | `/sw-jira:sync` | Jira sync |
208
193
 
209
- **Natural language**: "Let's build X" → `/sw:increment` | "What's status?" → `/sw:progress` | "We're done" → `/sw:done` | "Ship while sleeping" → `/sw:auto`
194
+ **Natural language**: "Let's build X" → `/sw:increment` | "What's status?" → `/sw:progress` | "Grill my code" → `/sw:grill` | "We're done" → `/sw:done` | "Ship while sleeping" → `/sw:auto`
210
195
  <!-- SW:END:workflow -->
211
196
 
212
197
  <!-- SW:SECTION:save-nested-repos version="1.0.194" -->
@@ -235,7 +220,7 @@ project/
235
220
  **NEVER assume single-repo mode without scanning first!**
236
221
  <!-- SW:END:save-nested-repos -->
237
222
 
238
- <!-- SW:SECTION:reflect version="1.0.226" -->
223
+ <!-- SW:SECTION:reflect version="1.0.227" -->
239
224
  ## Skill Memories
240
225
 
241
226
  SpecWeave learns from corrections. Learnings saved here automatically. Edit or delete as needed.
@@ -243,22 +228,23 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
243
228
  **Disable**: Set `"reflect": { "enabled": false }` in `.specweave/config.json`
244
229
  <!-- SW:END:reflect -->
245
230
 
231
+
246
232
  ## Skill Memories
247
233
 
248
234
  <!-- Auto-captured by SpecWeave reflect. Edit or delete as needed. -->
249
235
 
250
236
  ### Pm
251
237
  - **2026-02-04**: Enable interview process during increment creation for SpecWeave projects
252
- - **2026-02-04**: Interview process for increment creation: 10 questions is not mandatory minimum, use ultrathink to intelligently decide optimal question count (5 minimum acceptable)
253
- - **2026-02-04**: Interview process for increment creation should use ultrathink (extended thinking) to intelligently determine question count based on context, not enforce a fixed minimum of 10 questions - 5 minimum is acceptable
254
- - **2026-02-04**: Interview process for increment creation: 10 questions is not mandatory minimum, use ultrathink to determine optimal question count (5 minimum acceptable)
238
+ - **2026-02-04**: Interview question count determined by ultrathink based on context (5 minimum acceptable)
239
+ - **2026-02-04**: Call /sw:grill before completing features/increments to validate quality and fix revealed issues
255
240
 
256
241
  ### General
257
242
  - **2026-02-04**: Use subagents liberally for codebase analysis - up to 10+ concurrent for large-scale exploration
258
243
  - **2026-02-04**: Prefer leaderboard-style reporting when analyzing usage patterns or identifying deletion candidates
259
244
  - **2026-02-04**: Auto command must have explicit stop conditions (passing tests, increment completion, quality gates) and log/display output visibly to user in terminal
245
+ - **2026-02-04**: Call /sw:grill before completing features or increments to review and fix issues
260
246
 
261
- <!-- SW:SECTION:context version="1.0.226" -->
247
+ <!-- SW:SECTION:context version="1.0.227" -->
262
248
  ## Context
263
249
 
264
250
  **Before implementing**: Check ADRs at `.specweave/docs/internal/architecture/adr/`
@@ -266,7 +252,7 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
266
252
  **Load context**: `/sw:context <topic>` loads relevant living docs into conversation
267
253
  <!-- SW:END:context -->
268
254
 
269
- <!-- SW:SECTION:structure version="1.0.226" -->
255
+ <!-- SW:SECTION:structure version="1.0.227" -->
270
256
  ## Structure
271
257
 
272
258
  ```
@@ -281,7 +267,7 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
281
267
  **Everything else → subfolders**: `reports/` | `logs/` | `scripts/` | `backups/`
282
268
  <!-- SW:END:structure -->
283
269
 
284
- <!-- SW:SECTION:taskformat version="1.0.226" -->
270
+ <!-- SW:SECTION:taskformat version="1.0.227" -->
285
271
  ## Task Format
286
272
 
287
273
  ```markdown
@@ -291,7 +277,7 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
291
277
  ```
292
278
  <!-- SW:END:taskformat -->
293
279
 
294
- <!-- SW:SECTION:secrets version="1.0.226" -->
280
+ <!-- SW:SECTION:secrets version="1.0.227" -->
295
281
  ## Secrets Check
296
282
 
297
283
  **BEFORE CLI tools**: Check existing config first!
@@ -305,7 +291,7 @@ gh auth status
305
291
  **SECURITY**: NEVER use `grep TOKEN .env` without `-q` flag - it exposes credentials in terminal!
306
292
  <!-- SW:END:secrets -->
307
293
 
308
- <!-- SW:SECTION:syncing version="1.0.226" -->
294
+ <!-- SW:SECTION:syncing version="1.0.227" -->
309
295
  ## External Sync (GitHub/JIRA/ADO)
310
296
 
311
297
  **Commands**: `/sw-github:sync {id}` (issues) | `/sw:sync-specs` (living docs only)
@@ -315,7 +301,7 @@ gh auth status
315
301
  **Config**: Set `sync.github.enabled: true` + `canUpdateExternalItems: true` in config.json
316
302
  <!-- SW:END:syncing -->
317
303
 
318
- <!-- SW:SECTION:testing version="1.0.226" -->
304
+ <!-- SW:SECTION:testing version="1.0.227" -->
319
305
  ## Testing
320
306
 
321
307
  BDD in tasks.md | Unit >80% | `.test.ts` (Vitest)
@@ -327,68 +313,24 @@ vi.mock('./module', () => ({ func: mockFn }));
327
313
  ```
328
314
  <!-- SW:END:testing -->
329
315
 
330
- <!-- SW:SECTION:tdd version="1.0.226" -->
331
- ## TDD Mode (Test-Driven Development)
332
-
333
- **When `testing.defaultTestMode: "TDD"` is configured**, follow RED-GREEN-REFACTOR discipline:
334
-
335
- ### TDD Workflow (MANDATORY when configured)
336
-
337
- ```
338
- 1. RED: Write FAILING test first → verify it fails
339
- 2. GREEN: Write MINIMAL code to pass → no extra features
340
- 3. REFACTOR: Improve code quality → keep tests green
341
- ```
342
-
343
- ### Check TDD Mode Before Implementation
344
-
345
- ```bash
346
- # Check if TDD mode is enabled
347
- jq -r '.testing.defaultTestMode' .specweave/config.json
348
- # Returns: "TDD" | "test-first" | "test-after"
349
- ```
350
-
351
- ### TDD Commands
352
-
353
- | Command | Phase | Purpose |
354
- |---------|-------|---------|
355
- | `/sw:tdd-red` | RED | Write failing tests |
356
- | `/sw:tdd-green` | GREEN | Minimal implementation |
357
- | `/sw:tdd-refactor` | REFACTOR | Code quality improvement |
358
- | `/sw:tdd-cycle` | ALL | Full orchestrated workflow |
359
-
360
- ### Enforcement Levels
361
-
362
- Set `testing.tddEnforcement` in config.json:
363
-
364
- | Level | Behavior |
365
- |-------|----------|
366
- | `strict` | **BLOCKS** task completion if RED not done before GREEN |
367
- | `warn` | Shows warning but allows continuation (default) |
368
- | `off` | No enforcement |
369
-
370
- ### TDD Task Format
316
+ <!-- SW:SECTION:tdd version="1.0.227" -->
317
+ ## TDD Mode
371
318
 
372
- When TDD is enabled, tasks include phase markers:
319
+ **When `testing.defaultTestMode: "TDD"` in config.json**: RED GREEN → REFACTOR
373
320
 
374
- ```markdown
375
- ### T-001: [RED] Write auth service tests
376
- **Depends On**: None
377
- **Status**: [ ] pending
378
-
379
- ### T-002: [GREEN] Implement auth service
380
- **Depends On**: T-001
381
- **Status**: [ ] pending
321
+ | Command | Purpose |
322
+ |---------|---------|
323
+ | `/sw:tdd-red` | Write failing tests |
324
+ | `/sw:tdd-green` | Minimal implementation |
325
+ | `/sw:tdd-refactor` | Improve code quality |
326
+ | `/sw:tdd-cycle` | Full orchestrated workflow |
382
327
 
383
- ### T-003: [REFACTOR] Extract token utilities
384
- **Depends On**: T-002
385
- **Status**: [ ] pending
386
- ```
328
+ **Enforcement** (`testing.tddEnforcement`): `strict` (blocks) | `warn` (default) | `off`
387
329
 
388
- **Rule**: Complete dependencies BEFORE dependent tasks (RED before GREEN).
330
+ Tasks use phase markers: `[RED]`, `[GREEN]`, `[REFACTOR]` with dependencies.
389
331
  <!-- SW:END:tdd -->
390
332
 
391
- <!-- SW:SECTION:api version="1.0.226" -->
333
+ <!-- SW:SECTION:api version="1.0.227" -->
392
334
  ## API Development (OpenAPI-First)
393
335
 
394
336
  **For API projects only.** Commands: `/sw:api-docs --all` | `--openapi` | `--postman` | `--validate`
@@ -396,13 +338,13 @@ When TDD is enabled, tasks include phase markers:
396
338
  Enable in config: `{"apiDocs":{"enabled":true,"openApiPath":"openapi.yaml"}}`
397
339
  <!-- SW:END:api -->
398
340
 
399
- <!-- SW:SECTION:limits version="1.0.226" -->
341
+ <!-- SW:SECTION:limits version="1.0.227" -->
400
342
  ## Limits
401
343
 
402
344
  **Max 1500 lines/file** — extract before adding
403
345
  <!-- SW:END:limits -->
404
346
 
405
- <!-- SW:SECTION:troubleshooting version="1.0.226" -->
347
+ <!-- SW:SECTION:troubleshooting version="1.0.227" -->
406
348
  ## Troubleshooting
407
349
 
408
350
  | Issue | Fix |
@@ -415,21 +357,15 @@ Enable in config: `{"apiDocs":{"enabled":true,"openApiPath":"openapi.yaml"}}`
415
357
  | Session stuck | Kill + `rm -f .specweave/state/*.lock` + restart |
416
358
  <!-- SW:END:troubleshooting -->
417
359
 
418
- <!-- SW:SECTION:lazyloading version="1.0.226" -->
360
+ <!-- SW:SECTION:lazyloading version="1.0.227" -->
419
361
  ## Plugin Auto-Loading
420
362
 
421
- Plugins load automatically based on project type and keywords. Manual install if needed:
422
-
423
- ```bash
424
- claude plugin install sw-frontend@specweave # Install plugin
425
- claude plugin list # Check installed
426
- export SPECWEAVE_DISABLE_AUTO_LOAD=1 # Disable auto-load
427
- ```
363
+ Plugins load on-demand by keywords. Manual: `claude plugin install sw-frontend@specweave`
428
364
 
429
- **Token savings**: Core ~3-5K tokens vs all plugins ~60K+
365
+ Disable: `SPECWEAVE_DISABLE_AUTO_LOAD=1` | Core ~3-5K tokens vs all ~60K+
430
366
  <!-- SW:END:lazyloading -->
431
367
 
432
- <!-- SW:SECTION:principles version="1.0.226" -->
368
+ <!-- SW:SECTION:principles version="1.0.227" -->
433
369
  ## Principles
434
370
 
435
371
  ### SpecWeave Principles
@@ -445,7 +381,7 @@ export SPECWEAVE_DISABLE_AUTO_LOAD=1 # Disable auto-load
445
381
  - **Demand Elegance**: For non-trivial changes, pause and ask "is there a more elegant way?" - but skip this for simple, obvious fixes (don't over-engineer).
446
382
  <!-- SW:END:principles -->
447
383
 
448
- <!-- SW:SECTION:linking version="1.0.226" -->
384
+ <!-- SW:SECTION:linking version="1.0.227" -->
449
385
  ## Bidirectional Linking
450
386
 
451
387
  Tasks ↔ User Stories auto-linked via AC-IDs: `AC-US1-01` → `US-001`
@@ -453,7 +389,7 @@ Tasks ↔ User Stories auto-linked via AC-IDs: `AC-US1-01` → `US-001`
453
389
  Task format: `**AC**: AC-US1-01, AC-US1-02` (CRITICAL for linking)
454
390
  <!-- SW:END:linking -->
455
391
 
456
- <!-- SW:SECTION:mcp version="1.0.226" -->
392
+ <!-- SW:SECTION:mcp version="1.0.227" -->
457
393
  ## External Services
458
394
 
459
395
  **Priority**: CLI tools first (simpler) → MCP for complex integrations
@@ -475,7 +411,7 @@ claude mcp add --transport stdio postgres -- npx -y @modelcontextprotocol/server
475
411
  MCP supports lazy-loading (auto mode) - tools load on-demand when >10% context.
476
412
  <!-- SW:END:mcp -->
477
413
 
478
- <!-- SW:SECTION:auto version="1.0.226" -->
414
+ <!-- SW:SECTION:auto version="1.0.227" -->
479
415
  ## Auto Mode
480
416
 
481
417
  **Commands**: `/sw:auto` (start) | `/sw:auto-status` (check) | `/sw:cancel-auto` (emergency only)
@@ -492,288 +428,72 @@ MCP supports lazy-loading (auto mode) - tools load on-demand when >10% context.
492
428
  **STOP & ASK** if: Spec conflicts | Task unnecessary | Requirement ambiguous
493
429
  <!-- SW:END:auto -->
494
430
 
495
- <!-- SW:SECTION:docs version="1.0.226" -->
496
- ## Docs
497
-
498
- [spec-weave.com](https://spec-weave.com)
499
- <!-- SW:END:docs -->
500
-
501
- ---
502
- <!-- ↓ ORIGINAL ↓ -->
431
+ <!-- SW:SECTION:grill version="1.0.228" -->
432
+ ## Grill (Code Review)
503
433
 
504
- # SpecWeave Development Guide
434
+ **MANDATORY** before `/sw:done` - code must be reviewed before increment closure.
505
435
 
506
- **Project**: SpecWeave - Spec-Driven Development Framework
507
- **Type**: TypeScript CLI (NPM Package)
436
+ **Command**: `/sw:grill {increment-id}` or `/sw:grill {increment-id} {focus-area}`
508
437
 
509
- For **contributors to SpecWeave itself** (not users).
438
+ **Focus areas**: `security` | `performance` | `edge-cases` | `correctness` | `all` (default)
510
439
 
511
- ---
512
-
513
- ## Git Commits
440
+ **What happens**:
441
+ 1. Reviews all code changes in the increment
442
+ 2. Checks for security, performance, edge cases, correctness issues
443
+ 3. Categorizes issues: BLOCKER, CRITICAL, MAJOR, MINOR, SUGGESTION
444
+ 4. Creates marker file on PASS: `.specweave/state/.sw-grill-passed-{id}`
514
445
 
515
- - Do NOT include "Generated with Claude Code" or AI-assisted notes in commit messages
516
- - Do NOT include "Co-Authored-By: Claude" in commit messages
517
- - Keep commit messages clean and professional
518
-
519
- ---
446
+ **Enforcement**:
447
+ - `/sw:done` BLOCKED if grill marker missing
448
+ - To disable (not recommended): `{ "grill": { "required": false } }` in config.json
520
449
 
521
- ## Marketplace Commands
450
+ **Natural language**: "Grill the code" | "Review my work" | "Critique implementation" → `/sw:grill`
451
+ <!-- SW:END:grill -->
522
452
 
523
- | Who | Command |
524
- |-----|---------|
525
- | **Contributors** | `bash scripts/refresh-marketplace.sh` (defaults to --github) |
526
- | **End Users** | `specweave refresh-marketplace` |
453
+ <!-- SW:SECTION:docs version="1.0.227" -->
454
+ ## Docs
527
455
 
528
- ⚠️ NEVER suggest `scripts/` to end users - they don't have it (npm global install).
456
+ [spec-weave.com](https://spec-weave.com)
457
+ <!-- SW:END:docs -->
529
458
 
530
459
  ---
531
460
 
532
- ## Critical Safety Rules (Contributors)
533
-
534
- ### 1. Context Management (CRASH PREVENTION)
535
-
536
- **Active increment (10+ tasks) + large file edit (2000+ lines) = CRASH**
537
-
538
- ```bash
539
- /sw:pause XXXX → edit large file → /sw:resume XXXX
540
- ```
541
-
542
- - **Token budget**: ~80k/increment | **Max tasks**: 25 | **Max lines/file**: 1500
543
-
544
- ### 2. Status Workflow
545
-
546
- **NEVER edit metadata.json to "completed" directly!** Use `/sw:done <id>` which validates ACs.
547
-
548
- Programmatic closure: `MetadataManager.updateStatus(id, IncrementStatus.COMPLETED)` - only succeeds from `ready_for_review`.
549
-
550
- ### 3. Task-AC Auto-Sync
551
-
552
- Hooks auto-update when task marked complete: task checkboxes → spec.md ACs → `ready_for_review` status.
553
-
554
- ### 4. Per-US Project Fields
461
+ # SpecWeave Contributor Guide
555
462
 
556
- User Stories need `**Project**: my-project` field for external sync. Each US = ONE Project.
463
+ **Full guide**: [.github/CONTRIBUTING.md](.github/CONTRIBUTING.md)
557
464
 
558
- ### 5. Protected Directories
465
+ ## Critical Rules
559
466
 
560
- **NEVER delete**: `.specweave/docs/`, `.specweave/increments/`
467
+ | Rule | Detail |
468
+ |------|--------|
469
+ | **Completion** | `/sw:done` only (NEVER edit metadata.json) |
470
+ | **Protected dirs** | NEVER delete `.specweave/docs/`, `.specweave/increments/` |
471
+ | **Token budget** | ~80k/increment, max 25 tasks, max 1500 lines/file |
472
+ | **Marketplace** | Contributors: `scripts/refresh-marketplace.sh` | Users: `specweave refresh-marketplace` |
561
473
 
562
- ### 6. Subagent Parallelization ("use subagents")
474
+ ## Plugin Naming
563
475
 
564
- **The phrase "use subagents" is a SAFE parallelization trigger.** Append it to requests to distribute work.
565
-
566
- **How it works** (per Boris Cherny, Claude Code creator):
567
- - Claude spawns isolated subagents (up to 10 concurrent)
568
- - Each subagent has its own context (~20K tokens overhead each)
569
- - Main context stays clean and focused
570
- - Subagents handle complexity, return results
571
-
572
- **When to use "use subagents":**
573
- ```
574
- ✅ "Find all unused exports in src/ - use subagents"
575
- ✅ "Analyze each module for security issues - use subagents"
576
- ✅ "Search for deprecated patterns across the codebase - use subagents"
577
- ✅ "Review these 15 files for code quality - use subagents"
578
- ```
579
-
580
- **Best for:**
581
- - Codebase exploration/discovery (read-only analysis)
582
- - Multi-file searches and pattern detection
583
- - Batch validation and quality checks
584
- - Large-scale refactoring analysis
585
- - Parallel code reviews
586
-
587
- **Constraint**: Subagents don't receive full CLAUDE.md context - use for compartmentalized tasks.
588
-
589
- ### 7. Skills Best Practices
590
-
591
- **ALWAYS use skills when available!** Skills provide specialized expertise and are designed to be used extensively.
592
-
593
- **During Planning:**
594
- - Use `/sw:pm` or PM skill for specification refinement
595
- - Use `/sw:architect` or Architect skill for architecture design
596
- - Skills can invoke other skills - this is encouraged!
597
-
598
- **During Implementation:**
599
- - Use `sw-frontend:*` skills for React/Vue/Angular work
600
- - Use `sw-backend:*` skills for .NET/Node/Python APIs
601
- - Use `sw-payments:stripe-integration` for Stripe
602
-
603
- **Code Intelligence (LSP):** Use `specweave lsp` CLI (native LSP broken in CC v2.1.0+).
604
-
605
- **Pattern:**
606
- ```
607
- /sw:increment → PM skill → Architect skill → Implementation skills
608
- (Use specweave lsp refs/def for code intelligence)
609
- ```
610
-
611
- ### 8. NODE_OPTIONS in Debug Mode
612
-
613
- Child processes fail in VSCode Debug mode due to inherited `NODE_OPTIONS`. **Strip before spawning:**
614
- ```typescript
615
- const cleanEnv = { ...process.env };
616
- delete cleanEnv.NODE_OPTIONS;
617
- delete cleanEnv.NODE_V8_COVERAGE;
618
- spawnSync('claude', ['--version'], { env: cleanEnv });
619
- ```
620
- See: `src/utils/claude-cli-detector.ts`
621
-
622
- ### 9. Fast Claude CLI Calls
623
-
624
- For headless `claude -p` calls, skip settings loading (~50s → <1s):
625
- ```bash
626
- claude -p "prompt" --model haiku --setting-sources ""
627
- ```
628
-
629
- ### 10. Increment ID Collision Prevention
630
-
631
- **IDs must be unique across ALL folders** (active, _archive, _abandoned, _paused, external).
632
- ```bash
633
- find .specweave/increments -maxdepth 2 -type d -name "[0-9]*" | grep -oE '[0-9]{4}E?' | sort -u
634
- ```
635
- **Always use `IncrementNumberManager.getNextIncrementNumber()`** - never hardcode IDs.
636
-
637
- ### 11. Hook Output Format
638
-
639
- | Event | Format |
640
- |-------|--------|
641
- | UserPromptSubmit/SessionStart | `{"hookSpecificOutput":{"hookEventName":"...","additionalContext":"..."}}` |
642
- | PreToolUse | `{"decision":"allow"}` or `{"decision":"block","reason":"..."}` |
643
- | PostToolUse | `{"continue":true}` |
644
-
645
- ⚠️ `systemMessage` doesn't exist - content silently ignored!
646
-
647
- ---
476
+ | Context | Format | Example |
477
+ |---------|--------|---------|
478
+ | CLI/API | `sw-*` | `sw-frontend`, `sw-github` |
479
+ | Filesystem | `specweave-*` | `~/.claude/plugins/.../specweave-frontend/` |
648
480
 
649
481
  ## Coding Standards
650
482
 
651
- - **Logger**: Prefer `logger` over `console.*` in new code (legacy migration ongoing)
652
- - **Imports**: ALWAYS `.js` extensions (enforced)
653
- - **Tests**: `.test.ts` files, `vi.fn()` (not jest), `os.tmpdir()` (not cwd)
654
- - **Filesystem**: Prefer native `fs` (fs-extra only in legacy utils)
655
- - **Config vs Secrets**: Config in `config.json`, secrets in `.env`
656
- - **Test Location**: Tests in `src/**/*.test.ts` (colocated with source) - consolidated single storage
657
- - **Development Secrets**: `.env` with real tokens is acceptable for local development (gitignored)
658
- - **File Permissions**: `.env` should be `chmod 600` (owner-only read/write) for security
659
-
660
- ### Plugin Naming Convention (`sw-*` vs `specweave-*`)
661
-
662
- **Two naming systems exist for plugins:**
663
-
664
- | System | Format | Example |
665
- |--------|--------|---------|
666
- | **Marketplace names** | `sw`, `sw-*` | `sw`, `sw-frontend`, `sw-github` |
667
- | **Directory names** | `specweave`, `specweave-*` | `specweave`, `specweave-frontend`, `specweave-github` |
668
-
669
- **Use MARKETPLACE names (`sw-*`) for:**
670
- - Claude CLI: `claude plugin install sw@specweave`
671
- - API inputs: `installPlugins(['sw', 'sw-github'])`
672
- - LLM responses: `detectPluginsViaLLM()` returns `['sw-frontend']`
673
- - `keyword-detector.ts` constants (PLUGIN_GROUPS, KEYWORD_PLUGIN_MAP)
674
- - Registry keys: `sw-router@specweave` in `installed_plugins.json`
675
- - State file: `loadedPlugins: ['sw', 'sw-github']`
676
-
677
- **Use DIRECTORY names (`specweave-*`) for:**
678
- - Marketplace filesystem paths: `~/.claude/plugins/marketplaces/specweave/plugins/specweave-frontend/`
679
- - Test mocks for directories: `createMockPlugin(path, 'specweave')`
680
-
681
- **Conversion functions** (in `cache-manager.ts`):
682
- ```typescript
683
- marketplaceNameToDirectory('sw') // → 'specweave'
684
- marketplaceNameToDirectory('sw-frontend') // → 'specweave-frontend'
685
- directoryToMarketplaceName('specweave') // → 'sw'
686
- ```
687
-
688
- ---
689
-
690
- ## Key Formats
691
-
692
- | Format | Pattern |
693
- |--------|---------|
694
- | GitHub Issue | `[FS-XXX][US-YYY] User Story Title` |
695
- | ADR | `XXXX-decision-title.md` (no `adr-` prefix) |
696
- | External Increment | `0111E-*` (E suffix for imported) |
697
-
698
- Task format → see `## Task Format` section above.
699
-
700
- ---
701
-
702
- ## Build & Test
703
-
704
- ```bash
705
- npm run rebuild # Clean + build
706
- npm test # Smoke tests
707
- npm run test:all # All tests
708
- ```
709
-
710
- ---
483
+ - **Imports**: ALWAYS `.js` extensions
484
+ - **Tests**: `.test.ts`, `vi.fn()`, `os.tmpdir()`
485
+ - **Logger**: `logger` over `console.*`
711
486
 
712
- ## Emergency
487
+ ## Build & Emergency
713
488
 
714
- ### Session Stuck ("Marinating...")
715
489
  ```bash
716
- # 1. Force quit Claude Code
717
- # 2. Kill zombies:
718
- pkill -f "cat.*EOF"
719
- pkill -9 -f "bash.*specweave"
720
- # 3. Clean locks:
721
- rm -f .specweave/state/*.lock
722
- # 4. Restart
723
- ```
724
-
725
- ### Disable Hooks
726
- ```bash
727
- export SPECWEAVE_DISABLE_HOOKS=1
728
- ```
490
+ npm run rebuild # Clean + build
491
+ npm test # All tests
729
492
 
730
- ### Debug Hooks
731
- ```bash
732
- # Real-time verbose output to stderr
733
- export SPECWEAVE_DEBUG_HOOKS=1
734
-
735
- # Query decision log (structured JSON)
736
- specweave decision-log # Last 20 decisions
737
- specweave decision-log --hook stop-auto # Filter by hook
738
- specweave decision-log --decision block # Filter by decision type
739
- specweave decision-log --since 1h # Time window (1h, 24h, 7d)
740
- specweave decision-log --tail # Follow in real-time
741
- specweave decision-log --json # Raw JSON for jq
742
- ```
493
+ # Session stuck? Kill zombies + clean locks:
494
+ pkill -f "cat.*EOF" ; pkill -9 -f "bash.*specweave" ; rm -f .specweave/state/*.lock
743
495
 
744
- **Decision log location**: `.specweave/logs/decisions.jsonl`
745
-
746
- ### Crash Loop
747
- ```bash
748
- rm -f .specweave/state/*.lock
749
- npm run rebuild
496
+ # Debug/disable hooks:
497
+ SPECWEAVE_DEBUG_HOOKS=1 # Verbose hook output
498
+ SPECWEAVE_DISABLE_HOOKS=1 # Disable all hooks
750
499
  ```
751
-
752
- ---
753
-
754
- ## Quick Reference
755
-
756
- | Aspect | Rule |
757
- |--------|------|
758
- | File ops | Write/Edit/Read tools ONLY (never Bash heredoc/echo) |
759
- | Source of truth | tasks.md + spec.md (update immediately) |
760
- | Completion | `/sw:done` only (NEVER edit metadata.json directly) |
761
- | **Skills** | **ALWAYS use when available** (PM, Architect, domain skills) |
762
- | **LSP** | Use `specweave lsp refs/def/hover` (native LSP broken in v2.1.0+) |
763
- | **Parallelization** | Append "use subagents" for batch/exploration tasks |
764
- | Increment root | ONLY 4 files: spec.md, plan.md, tasks.md, metadata.json |
765
- | Increment IDs | 🚨 Check ALL folders: `find .specweave/increments -maxdepth 2 -name "[0-9]*" \| grep -oE '[0-9]{4}E?'` |
766
- | Reports/logs | Always to `reports/`, `logs/` subfolders |
767
- | Multi-repo | Clone to `repositories/` (never project root) |
768
- | Secrets | Check `.env` first, never display values (`grep -q`) |
769
- | Marketplace | `specweave refresh-marketplace` (not `scripts/`) |
770
- | Stuck session | Kill + `pkill -f "bash.*specweave"` + `rm .specweave/state/*.lock` |
771
- | **Hook debugging** | `specweave decision-log` or `SPECWEAVE_DEBUG_HOOKS=1` |
772
-
773
- ---
774
-
775
- ## References
776
-
777
- - **Internal Docs**: `.specweave/docs/internal/`
778
- - **ADRs**: `.specweave/docs/internal/architecture/adr/`
779
- - **Troubleshooting**: `.specweave/docs/internal/troubleshooting/`