specweave 1.0.261 → 1.0.262

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 (123) hide show
  1. package/.claude-plugin/README.md +0 -2
  2. package/CLAUDE.md +27 -27
  3. package/bin/specweave.js +14 -85
  4. package/dist/dashboard/assets/index-Cv1XUAKk.css +1 -0
  5. package/dist/dashboard/assets/index-DHOztQSu.js +11 -0
  6. package/dist/dashboard/index.html +2 -2
  7. package/dist/src/adapters/README.md +1 -1
  8. package/dist/src/adapters/agents-md-generator.js +1 -1
  9. package/dist/src/adapters/agents-md-generator.js.map +1 -1
  10. package/dist/src/adapters/claude/README.md +8 -8
  11. package/dist/src/adapters/claude/adapter.js +2 -2
  12. package/dist/src/adapters/claude-md-generator.js +2 -2
  13. package/dist/src/adapters/claude-md-generator.js.map +1 -1
  14. package/dist/src/adapters/cursor/README.md +7 -7
  15. package/dist/src/adapters/generic/README.md +2 -2
  16. package/dist/src/cli/commands/create-increment.d.ts +1 -1
  17. package/dist/src/cli/commands/create-increment.js +1 -1
  18. package/dist/src/cli/commands/update.d.ts.map +1 -1
  19. package/dist/src/cli/commands/update.js +64 -1
  20. package/dist/src/cli/commands/update.js.map +1 -1
  21. package/dist/src/cli/helpers/init/api-docs-config.js +7 -7
  22. package/dist/src/cli/helpers/init/api-docs-config.js.map +1 -1
  23. package/dist/src/core/config/types.d.ts +18 -0
  24. package/dist/src/core/config/types.d.ts.map +1 -1
  25. package/dist/src/core/config/types.js +4 -0
  26. package/dist/src/core/config/types.js.map +1 -1
  27. package/dist/src/core/external-tools/external-items-display.d.ts.map +1 -1
  28. package/dist/src/core/external-tools/external-items-display.js +1 -11
  29. package/dist/src/core/external-tools/external-items-display.js.map +1 -1
  30. package/dist/src/core/increment/increment-archiver.js +1 -1
  31. package/dist/src/core/increment/increment-archiver.js.map +1 -1
  32. package/dist/src/core/increment/metadata-manager.js +2 -2
  33. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  34. package/dist/src/core/increment/template-creator.d.ts +1 -1
  35. package/dist/src/core/increment/template-creator.js +4 -4
  36. package/dist/src/core/lazy-loading/llm-plugin-detector.d.ts +2 -2
  37. package/dist/src/core/lazy-loading/llm-plugin-detector.d.ts.map +1 -1
  38. package/dist/src/core/lazy-loading/llm-plugin-detector.js +15 -5
  39. package/dist/src/core/lazy-loading/llm-plugin-detector.js.map +1 -1
  40. package/dist/src/core/living-docs/feature-consistency-validator.js +1 -1
  41. package/dist/src/core/living-docs/feature-consistency-validator.js.map +1 -1
  42. package/dist/src/core/living-docs/scaffolding/scaffold.js +3 -3
  43. package/dist/src/core/notifications/command-integration.d.ts.map +1 -1
  44. package/dist/src/core/notifications/command-integration.js +0 -1
  45. package/dist/src/core/notifications/command-integration.js.map +1 -1
  46. package/dist/src/core/reflection/reflect-handler.js +2 -2
  47. package/dist/src/core/reflection/reflect-handler.js.map +1 -1
  48. package/dist/src/core/validators/ac-presence-validator.d.ts +1 -1
  49. package/dist/src/core/validators/ac-presence-validator.js +3 -3
  50. package/dist/src/core/validators/ac-presence-validator.js.map +1 -1
  51. package/dist/src/dashboard/server/command-runner.d.ts.map +1 -1
  52. package/dist/src/dashboard/server/command-runner.js +2 -2
  53. package/dist/src/dashboard/server/command-runner.js.map +1 -1
  54. package/dist/src/dashboard/server/dashboard-server.d.ts.map +1 -1
  55. package/dist/src/dashboard/server/dashboard-server.js +20 -9
  56. package/dist/src/dashboard/server/dashboard-server.js.map +1 -1
  57. package/dist/src/utils/agents-md-compiler.js +1 -1
  58. package/dist/src/utils/agents-md-compiler.js.map +1 -1
  59. package/dist/src/utils/find-project-root.d.ts +5 -4
  60. package/dist/src/utils/find-project-root.d.ts.map +1 -1
  61. package/dist/src/utils/find-project-root.js +8 -10
  62. package/dist/src/utils/find-project-root.js.map +1 -1
  63. package/dist/src/utils/generate-skills-index.js +3 -3
  64. package/dist/src/utils/notification-constants.js +1 -1
  65. package/dist/src/utils/notification-constants.js.map +1 -1
  66. package/package.json +1 -1
  67. package/plugins/FINAL-AUDIT-RECOMMENDATIONS.md +3 -3
  68. package/plugins/specweave/PLUGIN.md +0 -22
  69. package/plugins/specweave/commands/analytics.md +1 -1
  70. package/plugins/specweave/commands/discrepancies.md +0 -1
  71. package/plugins/specweave/commands/living-docs.md +0 -1
  72. package/plugins/specweave/commands/reconcile.md +1 -1
  73. package/plugins/specweave/hooks/hooks.json +10 -0
  74. package/plugins/specweave/hooks/pre-compact.sh +39 -0
  75. package/plugins/specweave/hooks/stop-sync.sh +23 -1
  76. package/plugins/specweave/hooks/universal/fail-fast-wrapper.sh +4 -0
  77. package/plugins/specweave/hooks/user-prompt-submit.sh +193 -59
  78. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +7 -0
  79. package/plugins/specweave/hooks/v2/guards/spec-template-enforcement-guard.sh +1 -1
  80. package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +25 -6
  81. package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +21 -3
  82. package/plugins/specweave/hooks/v2/lib/check-provider-enabled.sh +52 -0
  83. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +2 -2
  84. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  85. package/plugins/specweave/skills/do/SKILL.md +1 -1
  86. package/plugins/specweave/skills/done/SKILL.md +1 -1
  87. package/plugins/specweave/skills/framework/SKILL.md +4 -4
  88. package/plugins/specweave/skills/increment/SKILL.md +192 -25
  89. package/plugins/specweave/skills/next/SKILL.md +36 -630
  90. package/plugins/specweave/skills/pm/phases/00-deep-interview.md +2 -2
  91. package/plugins/specweave/skills/progress-sync/SKILL.md +7 -25
  92. package/plugins/specweave/skills/spec-generator/SKILL.md +44 -626
  93. package/plugins/specweave/skills/tdd-green/SKILL.md +10 -798
  94. package/plugins/specweave/skills/tdd-red/SKILL.md +8 -136
  95. package/plugins/specweave/skills/tdd-refactor/SKILL.md +15 -147
  96. package/plugins/specweave-github/hooks/github-auto-create-handler.sh +23 -5
  97. package/src/templates/AGENTS.md.template +11 -11
  98. package/src/templates/CLAUDE.md.template +1 -1
  99. package/dist/dashboard/assets/index-CDl14O5G.css +0 -1
  100. package/dist/dashboard/assets/index-CmqBqnWd.js +0 -11
  101. package/plugins/specweave/commands/api-docs.md +0 -672
  102. package/plugins/specweave/commands/check-hooks.md +0 -241
  103. package/plugins/specweave/commands/embed-acs.md +0 -445
  104. package/plugins/specweave/commands/external.md +0 -145
  105. package/plugins/specweave/commands/import-docs.md +0 -212
  106. package/plugins/specweave/commands/migrate-config.md +0 -104
  107. package/plugins/specweave/commands/notifications.md +0 -94
  108. package/plugins/specweave/commands/plugin-validator.md +0 -429
  109. package/plugins/specweave/commands/revert-wip-limit.md +0 -82
  110. package/plugins/specweave/commands/sync-acs.md +0 -342
  111. package/plugins/specweave/commands/sync-specs.md +0 -339
  112. package/plugins/specweave/commands/sync-tasks.md +0 -255
  113. package/plugins/specweave/commands/update-scope.md +0 -351
  114. package/plugins/specweave/commands/validate-features.md +0 -207
  115. package/plugins/specweave/skills/archive-increments/SKILL.md +0 -209
  116. package/plugins/specweave/skills/code-review/SKILL.md +0 -598
  117. package/plugins/specweave/skills/increment-planner/SKILL.md +0 -238
  118. package/plugins/specweave/skills/increment-work-router/SKILL.md +0 -562
  119. package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +0 -423
  120. package/plugins/specweave/skills/pm-closure-validation/SKILL.md +0 -542
  121. package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +0 -245
  122. package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +0 -228
  123. package/plugins/specweave/skills/umbrella-repo-detector/SKILL.md +0 -301
@@ -1,245 +0,0 @@
1
- ---
2
- description: Detects issues with recently completed work and suggests reopening tasks/increments. Use for bugs, regressions, or problems with recently finished features.
3
- user-invocable: false
4
- ---
5
-
6
- # Smart Reopen Detector
7
-
8
- ## Purpose
9
-
10
- When you report an issue with recently completed work, I'll automatically:
11
- 1. 🔍 **Scan your recent work** (active + completed in last 7 days)
12
- 2. 🎯 **Identify related items** using keyword matching
13
- 3. 💡 **Suggest what to reopen** with relevance scoring
14
- 4. ⚠️ **Check WIP limits** before suggesting reopen
15
-
16
- ## When I Activate
17
-
18
- I automatically activate when you mention these keywords:
19
- - **Not working**: "not working", "broken", "failing", "error", "crash"
20
- - **Quality issues**: "bug", "issue", "problem", "wrong", "incorrect", "missing"
21
- - **Regressions**: "still broken", "regression", "broken again", "came back"
22
-
23
- ## How I Help
24
-
25
- ### Example 1: Issue Report
26
- ```
27
- User: "The GitHub sync isn't working, it was just completed yesterday"
28
- ```
29
-
30
- I'll respond with:
31
- ```
32
- 🔍 Scanning recent work...
33
-
34
- Found 2 related item(s) in recent work:
35
-
36
- 📦 INCREMENT: 0031-external-tool-status-sync
37
- Increment: 0031-external-tool-status-sync
38
- Completed: 2 days ago
39
- Relevance: 15 points
40
- Matched: github, sync
41
-
42
- ✓ TASK: T-003 GitHub Content Sync
43
- Increment: 0031-external-tool-status-sync
44
- Completed: 1 day ago
45
- Relevance: 14 points
46
- Matched: github, sync
47
-
48
- 💡 Suggested action:
49
- /sw:reopen 0031-external-tool-status-sync --reason "GitHub sync not working"
50
-
51
- Would you like me to:
52
- 1. Reopen the entire increment (checks WIP limits)
53
- 2. Reopen just task T-003 (targeted fix)
54
- 3. Show me the WIP status first
55
- ```
56
-
57
- ### Example 2: Specific Feature Broken
58
- ```
59
- User: "The authentication is broken after the recent deployment"
60
- ```
61
-
62
- I'll respond with:
63
- ```
64
- 🔍 Scanning recent work...
65
-
66
- Found 3 related item(s) in recent work:
67
-
68
- ✓ TASK: T-012 Authentication Service
69
- Increment: 0025-user-auth
70
- Completed: 3 days ago
71
- Relevance: 10 points
72
- Matched: authentication
73
-
74
- ✓ TASK: T-014 JWT Token Validation
75
- Increment: 0025-user-auth
76
- Completed: 3 days ago
77
- Relevance: 7 points
78
- Matched: authentication
79
-
80
- 💡 Suggested action:
81
- /sw:reopen 0025-user-auth --task T-012 --reason "Authentication broken after deployment"
82
-
83
- ⚠️ Note: Increment 0025 was completed 3 days ago. Consider checking deployment config first.
84
- ```
85
-
86
- ### Example 3: No Recent Work Found
87
- ```
88
- User: "The payment flow is not working"
89
- ```
90
-
91
- I'll respond with:
92
- ```
93
- 🔍 Scanning recent work...
94
-
95
- 🔍 No related work found in recent activity (last 7 days)
96
-
97
- The payment functionality might be:
98
- 1. From an older increment (>7 days ago)
99
- 2. Not yet implemented
100
- 3. Part of external dependencies
101
-
102
- Would you like me to:
103
- 1. Search all increments (not just recent)
104
- 2. Create a new bug increment for investigation
105
- 3. Check the backlog for related work
106
- ```
107
-
108
- ## What I Do
109
-
110
- ### Step 1: Extract Keywords
111
- From your message, I extract relevant keywords:
112
- - Feature names (authentication, github, payment)
113
- - Action words (sync, deploy, validate)
114
- - Component names (api, database, frontend)
115
-
116
- ### Step 2: Scan Recent Work
117
- I scan:
118
- - ✅ **Active increments** (currently being worked on)
119
- - ✅ **Recently completed** (last 7 days)
120
- - ✅ **All tasks** from these increments
121
-
122
- ### Step 3: Score Matches
123
- I assign relevance scores using:
124
- - **+10 points**: Exact match in title/ID
125
- - **+7 points**: Partial match in title
126
- - **+5 points**: Match in increment ID
127
- - **+3 points**: Match in description/AC
128
-
129
- ### Step 4: Suggest Actions
130
- I provide:
131
- - Top matches (up to 5)
132
- - Relevance scores
133
- - Suggested `/sw:reopen` command
134
- - WIP limit warnings (if applicable)
135
-
136
- ## Smart Suggestions
137
-
138
- ### For Increments
139
- ```bash
140
- # Reopen entire increment
141
- /sw:reopen 0031-external-tool-status-sync --reason "GitHub sync failing"
142
-
143
- # Check WIP limits first (recommended)
144
- /sw:status
145
- ```
146
-
147
- ### For Specific Tasks
148
- ```bash
149
- # Reopen single task (surgical fix)
150
- /sw:reopen 0031 --task T-003 --reason "GitHub API 500 error"
151
-
152
- # Reopen multiple related tasks
153
- /sw:reopen 0031 --user-story US-001 --reason "All GitHub features broken"
154
- ```
155
-
156
- ### Force Reopen (Bypass WIP Limits)
157
- ```bash
158
- # Use --force for critical production issues
159
- /sw:reopen 0031 --force --reason "Production down, critical fix needed"
160
- ```
161
-
162
- ## WIP Limit Awareness
163
-
164
- Before suggesting increment reopen, I check:
165
- - ✅ Current active increment count
166
- - ✅ Type-specific limits (feature: 2, refactor: 1, etc.)
167
- - ⚠️ Warn if reopening will exceed limits
168
-
169
- **Example Warning**:
170
- ```
171
- ⚠️ WIP LIMIT WARNING:
172
- Current active: 2 features
173
- Limit: 2 features
174
- Reopening 0031-external-tool-status-sync will EXCEED the limit!
175
-
176
- Options:
177
- 1. Pause another feature first: /sw:pause 0030
178
- 2. Complete another feature: /sw:done 0029
179
- 3. Force reopen (not recommended): --force
180
- ```
181
-
182
- ## Integration with Commands
183
-
184
- I work seamlessly with:
185
- - `/sw:reopen` - Execute reopen action
186
- - `/sw:status` - Check WIP limits
187
- - `/sw:progress` - See increment progress
188
- - `/sw:pause` - Pause another increment to make room
189
-
190
- ## When NOT to Use
191
-
192
- I don't activate for:
193
- - ❌ General questions about code
194
- - ❌ Feature requests (use `/sw:increment`)
195
- - ❌ Documentation questions
196
- - ❌ Status inquiries (use `/sw:status`)
197
-
198
- I **only** activate when you explicitly report something is broken/not working.
199
-
200
- ## Technical Implementation
201
-
202
- **Core Logic**:
203
- - Uses `RecentWorkScanner` to find matches
204
- - Keyword extraction from user message
205
- - Relevance scoring algorithm
206
- - WIP limit validation before suggestions
207
-
208
- **Smart Features**:
209
- - Deduplication (same increment from active + recent)
210
- - Recency bias (prefer more recent completions)
211
- - Contextual hints (deployment, config, dependencies)
212
-
213
- ## Examples of Activation
214
-
215
- ### ✅ Will Activate
216
- - "GitHub sync not working"
217
- - "Authentication is broken"
218
- - "Tests are failing after the last commit"
219
- - "Deployment crashed"
220
- - "API returns 500 error"
221
- - "Still broken after the fix"
222
-
223
- ### ❌ Won't Activate
224
- - "How does GitHub sync work?"
225
- - "Can you add authentication?"
226
- - "What's the status of increment 0031?"
227
- - "Show me the progress"
228
- - "Create a new feature for payments"
229
-
230
- ## Success Metrics
231
-
232
- I'm successful when:
233
- - ✅ You find the related work quickly (<30 seconds)
234
- - ✅ The suggested reopen command is correct
235
- - ✅ No false positives (only relevant matches)
236
- - ✅ WIP limits are respected
237
- - ✅ Clear next steps provided
238
-
239
- ---
240
-
241
- **Auto-loads when**: You report issues with recently completed work
242
- **Commands**: `/sw:reopen`, `/sw:status`
243
- **Related Skills**: `increment-planner`, `tdd-workflow`
244
-
245
-
@@ -1,228 +0,0 @@
1
- ---
2
- description: TDD orchestrator for red-green-refactor discipline and multi-agent test-driven workflows. Use for TDD enforcement, writing tests first, test isolation, quality gates.
3
- allowed-tools: Read, Write, Edit, Bash, Grep, Glob
4
- user-invocable: false
5
- ---
6
-
7
- # TDD Orchestrator Skill
8
-
9
- ## Project Overrides
10
-
11
- !`s="tdd-orchestrator"; 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`
12
-
13
- ## Overview
14
-
15
- You are an expert TDD orchestrator specializing in comprehensive test-driven development coordination, modern TDD practices, and multi-agent workflow management. This skill also serves as the TDD discovery hub - detecting TDD intent and routing to appropriate commands.
16
-
17
- ## When to Activate
18
-
19
- **Automatic activation when user mentions**:
20
- - "implement with TDD"
21
- - "use test-driven development"
22
- - "red-green-refactor"
23
- - "write tests first"
24
- - "test-first approach"
25
- - "Kent Beck style"
26
- - "TDD discipline"
27
-
28
- ## Core Principles
29
-
30
- 1. **ONE TDD phase per response** - Red, Green, OR Refactor
31
- 2. **Test-first discipline** - Always write failing tests first
32
- 3. **Minimal implementation** - Just enough to pass tests
33
-
34
- ## Quick Reference
35
-
36
- ### TDD Phases
37
-
38
- | Phase | What | Token Budget |
39
- |-------|------|--------------|
40
- | Red | Create failing tests | < 600 tokens |
41
- | Green | Minimal implementation | < 600 tokens |
42
- | Refactor | Clean up (tests green) | < 600 tokens |
43
-
44
- ### TDD Styles
45
-
46
- - **Classic TDD (Chicago)**: State-based testing, real collaborators
47
- - **London School (Mockist)**: Interaction-based, test doubles
48
-
49
- ### Red Phase Guidelines 🔴
50
-
51
- - Write test FIRST (should fail)
52
- - Ensure test fails for the right reason
53
- - Write the simplest test that fails
54
- - Test should compile but fail on assertion
55
- - Focus on WHAT, not HOW
56
- - One test at a time
57
- - Max 10-15 tests per response
58
- - Ask before moving to Green Phase
59
-
60
- ### Green Phase Guidelines 🟢
61
-
62
- - Write MINIMAL code to pass tests
63
- - Embrace "fake it till you make it"
64
- - Hardcoded values acceptable initially
65
- - Get to green FAST
66
- - One implementation file per response
67
- - Verify tests pass before continuing
68
- - Ask before moving to Refactor Phase
69
-
70
- ### Refactor Phase Guidelines 🔵
71
-
72
- - Refactor while keeping tests green
73
- - Improve code structure
74
- - Extract methods, remove duplication
75
- - One refactoring pass per response
76
- - Commit after each refactor
77
- - Ask before starting new cycle
78
-
79
- ### TDD Anti-Patterns to Avoid
80
-
81
- - ❌ Writing implementation before test
82
- - ❌ Writing multiple tests before implementation
83
- - ❌ Over-engineering in GREEN phase
84
- - ❌ Refactoring without tests passing
85
- - ❌ Skipping refactor phase
86
-
87
- ## Workflow
88
-
89
- 1. **Analysis** (< 500 tokens): List TDD phases needed, ask which first
90
- 2. **Execute ONE phase** (< 600 tokens): Red, Green, or Refactor
91
- 3. **Report progress**: "Phase complete. Ready for next?"
92
- 4. **Repeat**: One phase at a time
93
-
94
- ## Token Budget
95
-
96
- - **Analysis**: 300-500 tokens
97
- - **Red Phase**: 400-600 tokens (2-3 test files max)
98
- - **Green Phase**: 400-600 tokens (1-2 impl files)
99
- - **Refactor Phase**: 400-600 tokens
100
-
101
- **NEVER exceed 2000 tokens per response!**
102
-
103
- ## TDD Workflow Example
104
-
105
- ```
106
- 1. 📝 Red: Write failing tests
107
- 2. ❌ Run tests: 0/N passing
108
- 3. ✅ Green: Implement feature
109
- 4. 🟢 Run tests: N/N passing
110
- 5. ♻️ Refactor: Clean up
111
- 6. 🟢 Run tests: Still passing
112
- ```
113
-
114
- ## Integration with SpecWeave
115
-
116
- **In Increment Workflow**:
117
- ```
118
- /sw:inc "Authentication feature" → spec.md created
119
-
120
- User: "Implement with TDD"
121
-
122
- tdd-orchestrator skill activates
123
-
124
- /sw:tdd:cycle invoked
125
-
126
- Phase 1: RED - tests.md updated with failing tests
127
- Phase 2: GREEN - tasks.md implementation
128
- Phase 3: REFACTOR - code improvements
129
-
130
- Increment tasks completed with TDD discipline
131
- ```
132
-
133
- ## Commands Reference
134
-
135
- ### Full Cycle
136
- - `/sw:tdd:cycle` - Complete red-green-refactor orchestration
137
-
138
- ### Individual Phases
139
- - `/sw:tdd:red` - RED phase only (write failing test)
140
- - `/sw:tdd:green` - GREEN phase only (make test pass)
141
- - `/sw:tdd:refactor` - REFACTOR phase only (improve code)
142
-
143
- ### When to Use Each
144
-
145
- **Use /sw:tdd:cycle when**:
146
- - ✅ Starting new feature from scratch
147
- - ✅ Learning TDD or teaching team
148
- - ✅ Want enforced discipline (gates)
149
- - ✅ Working in increment-based workflow
150
-
151
- **Use individual commands when**:
152
- - ✅ Already in middle of TDD cycle
153
- - ✅ Need to repeat a phase (e.g., multiple refactors)
154
- - ✅ Want finer control over cycle
155
- - ✅ Integrating with other workflows
156
-
157
- ## CLI/Hook Integration Testing
158
-
159
- When TDD targets CLI commands, hooks, or terminal tools, apply these patterns:
160
-
161
- ### Test Isolation Stack
162
-
163
- | Layer | Helper | Purpose |
164
- |-------|--------|---------|
165
- | Home dir | `withIsolatedHome()` | Override HOME to temp dir |
166
- | Working dir | `createIsolatedTestDir()` | Isolated .specweave/ structure |
167
- | Env vars | `getIsolatedEnv()` | Strip NODE_OPTIONS, set HOME |
168
- | Output | `normalizeOutput()` | Strip ANSI, normalize endings |
169
- | JSON parsing | `extractJson()` | Extract JSON from mixed stdout |
170
-
171
- ### TDD for CLI: Red Phase
172
- ```typescript
173
- // RED: Write test that spawns CLI process
174
- it('should init project in isolated dir', async () => {
175
- const { homePath, restore } = await withIsolatedHome('init-test');
176
- try {
177
- const result = await execAsync('node bin/specweave.js init', {
178
- cwd: workDir,
179
- env: getIsolatedEnv(homePath, { CI: 'true' }),
180
- timeout: 30000,
181
- });
182
- expect(normalizeOutput(result.stdout)).toContain('initialized');
183
- } finally {
184
- await restore();
185
- }
186
- });
187
- ```
188
-
189
- ### TDD for Hooks: Red Phase
190
- ```typescript
191
- // RED: Write test that executes real hook
192
- it('should approve when no increment active', async () => {
193
- const harness = new HookTestHarness(testDir, hookPath);
194
- const result = await harness.execute({ CI: 'true' });
195
- const json = extractJson<{ decision: string }>(result.stdout);
196
- expect(json?.decision).toBe('approve');
197
- });
198
- ```
199
-
200
- ### Key Rules for CLI TDD
201
- - Use 30s timeout for CLI tests (not default 5s)
202
- - Always use `getCleanEnv()` or `getIsolatedEnv()` for child processes
203
- - Never test hooks by string-matching file contents - EXECUTE them
204
- - Separate CLI tests into `vitest.e2e.config.ts` with fewer workers
205
- - Run `npm run test:e2e:cli` for CLI-specific tests
206
-
207
- ## Configuration
208
-
209
- **Optional**: Customize TDD preferences in `.specweave/config.yaml`:
210
-
211
- ```yaml
212
- tdd:
213
- default_workflow: "cycle" # Options: "cycle", "agent", "manual"
214
- auto_activate: true # Auto-offer TDD on new features
215
- gates_enabled: true # Enforce phase gates in cycle mode
216
- mutation_testing: false # Enable mutation testing (requires setup)
217
- ```
218
-
219
- ## Related Skills & Commands
220
-
221
- **Commands**:
222
- - `/sw:tdd:cycle` - Full red-green-refactor orchestration
223
- - `/sw:tdd:red`, `/sw:tdd:green`, `/sw:tdd:refactor` - Individual phases
224
-
225
- **Skills**:
226
- - `sw-testing:qa-engineer` - Test strategy overlaps with TDD principles
227
-
228
-