specweave 0.26.10 → 0.26.13

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 (33) hide show
  1. package/CLAUDE.md +95 -520
  2. package/dist/plugins/specweave-github/lib/completion-calculator.d.ts +4 -1
  3. package/dist/plugins/specweave-github/lib/completion-calculator.d.ts.map +1 -1
  4. package/dist/plugins/specweave-github/lib/completion-calculator.js +49 -29
  5. package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -1
  6. package/dist/src/cli/commands/init.js +2 -2
  7. package/dist/src/cli/commands/init.js.map +1 -1
  8. package/dist/src/core/increment/increment-archiver.d.ts +3 -0
  9. package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
  10. package/dist/src/core/increment/increment-archiver.js +35 -4
  11. package/dist/src/core/increment/increment-archiver.js.map +1 -1
  12. package/dist/src/core/living-docs/feature-archiver.d.ts +5 -0
  13. package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -1
  14. package/dist/src/core/living-docs/feature-archiver.js +66 -18
  15. package/dist/src/core/living-docs/feature-archiver.js.map +1 -1
  16. package/package.json +1 -1
  17. package/plugins/specweave/commands/specweave-archive.md +10 -1
  18. package/plugins/specweave/hooks/hooks.json +10 -0
  19. package/plugins/specweave/hooks/lib/update-active-increment.sh +96 -0
  20. package/plugins/specweave/hooks/lib/update-status-line.sh +153 -189
  21. package/plugins/specweave/hooks/post-edit-write-consolidated.sh +6 -0
  22. package/plugins/specweave/hooks/post-metadata-change.sh +9 -0
  23. package/plugins/specweave/hooks/post-task-completion.sh +8 -0
  24. package/plugins/specweave/hooks/post-task-edit.sh +37 -0
  25. package/plugins/specweave/hooks/pre-command-deduplication.sh +43 -53
  26. package/plugins/specweave/hooks/pre-tool-use.sh +5 -0
  27. package/plugins/specweave/hooks/user-prompt-submit.sh +143 -289
  28. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +18 -0
  29. package/plugins/specweave-github/lib/completion-calculator.js +34 -16
  30. package/plugins/specweave-github/lib/completion-calculator.ts +54 -32
  31. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +27 -0
  32. package/src/templates/AGENTS.md.template +301 -2452
  33. package/src/templates/CLAUDE.md.template +99 -667
@@ -1,758 +1,190 @@
1
1
  # {PROJECT_NAME} - SpecWeave Quick Reference
2
2
 
3
- This project uses **SpecWeave** - a specification-first AI development framework where specs and docs are the SOURCE OF TRUTH.
3
+ **Framework**: SpecWeave (spec-first development)
4
+ **Source of Truth**: `spec.md` + `tasks.md` (not internal TODO)
4
5
 
5
6
  ---
6
7
 
7
- ## 🚨 Meta-Rule: Thinking-Before-Acting (For Claude)
8
+ ## Critical Rules
8
9
 
9
- **If you identify a dependency in your reasoning, satisfy it BEFORE attempting the dependent operation.**
10
+ ### 1. File Organization
11
+ **NEVER pollute project root!** All AI-generated files → increment folders.
10
12
 
11
13
  ```
12
- ❌ Anti-pattern: node script.js → Error: file not compiled → npm run build
13
- Correct: npm run build node script.js → Success
14
+ .specweave/increments/####-name/
15
+ ├── spec.md, plan.md, tasks.md ← ONLY these at root
16
+ ├── reports/ ← Reports, summaries, analysis
17
+ ├── scripts/ ← Helper scripts, migrations
18
+ └── logs/ ← Execution logs, temp data
14
19
  ```
15
20
 
16
- **Why**: Avoids predictable failures when you already know what needs to happen first.
17
-
18
- ---
19
-
20
- ## 🎯 Getting Started
21
-
22
- **Initial Increment Created**: `0001-project-setup` (`.specweave/increments/0001-project-setup/`)
23
-
24
- This increment was auto-generated by `specweave init` to give you a starting point.
25
-
26
- **Your Options**:
27
- 1. **Start Fresh** (Recommended): Delete it and create your first real feature
28
- ```bash
29
- rm -rf .specweave/increments/0001-project-setup
30
- /specweave:increment "your-feature-name"
31
- ```
32
- 2. **Customize It**: Edit the spec.md and use this increment for initial setup tasks
21
+ ### 2. Source of Truth
22
+ After completing work, **IMMEDIATELY update both files**:
23
+ ```typescript
24
+ TodoWrite([{task: "T-001", status: "completed"}]);
25
+ Edit("tasks.md", "**Status**: [ ] pending", "**Status**: [x] completed");
26
+ Edit("spec.md", "- [ ] **AC-US1-01**", "- [x] **AC-US1-01**");
27
+ ```
33
28
 
34
- **Note**: SpecWeave works best when each increment represents a single, focused feature or bugfix.
29
+ ### 3. Increment Numbers Must Be Unique
30
+ **Format**: `####-descriptive-name` (e.g., `0001-user-auth`)
31
+ **Check before creating**: `ls -1 .specweave/increments/ | grep -E "^[0-9]{4}-" | sort | tail -5`
35
32
 
36
33
  ---
37
34
 
38
- ## 🚨 CRITICAL: NEVER POLLUTE PROJECT ROOT!
39
-
40
- **⛔ THIS IS THE #1 RULE - ALL AI-GENERATED FILES GO IN INCREMENT FOLDERS ⛔**
41
-
42
- ### ❌ NEVER Create in Root
35
+ ## Core Workflow
43
36
 
44
37
  ```
45
- WRONG - ROOT FILES (NOT ALLOWED!):
46
- /SESSION-SUMMARY.md # NO! Goes to increment reports/
47
- /ANALYSIS-REPORT.md # NO! Goes to increment reports/
48
- /migration-script.py # NO! Goes to increment scripts/
49
- /execution.log # NO! Goes to increment logs/
50
- /temp-data.json # NO! Goes to increment logs/
51
-
52
- ✅ CORRECT - INCREMENT FOLDERS:
53
- .specweave/increments/0001-user-auth/
54
- ├── spec.md # Core spec files
55
- ├── plan.md
56
- ├── tasks.md # Tasks with embedded tests (BDD format)
57
- ├── reports/ # ✅ PUT REPORTS HERE!
58
- │ ├── SESSION-SUMMARY.md
59
- │ └── ANALYSIS-REPORT.md
60
- ├── scripts/ # ✅ PUT SCRIPTS HERE!
61
- │ └── migration-script.py
62
- └── logs/ # ✅ PUT LOGS HERE!
63
- ├── execution.log
64
- └── temp-data.json
38
+ /specweave:increment "feature" /specweave:do /specweave:progress → /specweave:done 0001
65
39
  ```
66
40
 
67
- ### What IS Allowed in Root?
68
-
69
- **ONLY these files**:
70
- - `CLAUDE.md` (this file)
71
- - Your project files (`src/`, `package.json`, etc.)
72
- - Standard config (`.env`, `.gitignore`, `tsconfig.json`)
41
+ | Command | Purpose |
42
+ |---------|---------|
43
+ | `/specweave:increment "X"` | Plan new feature |
44
+ | `/specweave:do` | Execute implementation |
45
+ | `/specweave:progress` | Check status |
46
+ | `/specweave:validate 0001` | Quality check |
47
+ | `/specweave:done 0001` | Close increment |
73
48
 
74
- **Everything else increment folders!**
75
-
76
- **Before asking me to commit, check**: `git status` - If you see unexpected `.md` files in root, STOP and move them!
49
+ **Sync Commands** (if plugins installed):
50
+ - `/specweave-github:sync` - Sync to GitHub Issues
51
+ - `/specweave-jira:sync` - Sync to Jira
52
+ - `/specweave-ado:sync` - Sync to Azure DevOps
77
53
 
78
54
  ---
79
55
 
80
- ## 📋 Quick Reference Cards
81
-
82
- ### Daily Workflow
83
- ```
84
- ┌────────────────────────────────────────────────────────────┐
85
- │ TASK → COMMAND │
86
- ├────────────────────────────────────────────────────────────┤
87
- │ Plan new feature → /specweave:increment "feature" │
88
- │ Execute tasks → /specweave:do │
89
- │ Check progress → /specweave:progress │
90
- │ Validate quality → /specweave:validate 0001 │
91
- │ Close increment → /specweave:done 0001 │
92
- │ Sync to GitHub → /specweave:github:sync │
93
- │ Sync to Jira → /specweave:jira:sync │
94
- └────────────────────────────────────────────────────────────┘
95
- ```
56
+ ## Project Structure
96
57
 
97
- ### When to Use Which Command
98
- | User Says... | Use Command |
99
- |---------------------------|------------------------------------|
100
- | "Let's build X" | `/specweave:increment "X"` |
101
- | "Start implementing" | `/specweave:do` |
102
- | "What's the status?" | `/specweave:progress` |
103
- | "Is this ready?" | `/specweave:validate 0001` |
104
- | "We're done" | `/specweave:done 0001` |
105
- | "Sync to GitHub" | `/specweave:github:sync` |
106
- | "Sync to Jira" | `/specweave:jira:sync` |
107
-
108
- ### File Organization Rules
109
58
  ```
110
- ┌────────────────────────────────────────────────────────────┐
111
- NEVER in Root ↔ ALWAYS in Increment Folder │
112
- ├────────────────────────────────────────────────────────────┤
113
- ❌ analysis.md .../0001/reports/analysis.md │
114
- ❌ migration.py ↔ ✅ .../0001/scripts/migration.py │
115
- ❌ execution.log ↔ .../0001/logs/execution.log │
116
- ❌ session-notes.md ↔ .../0001/reports/session.md │
117
- └────────────────────────────────────────────────────────────┘
59
+ .specweave/
60
+ ├── increments/ # Feature increments (####-name/)
61
+ │ └── 0001-feature/
62
+ ├── spec.md # WHAT & WHY
63
+ ├── plan.md # HOW
64
+ ├── tasks.md # Checklist with embedded tests
65
+ └── context-manifest.yaml # Selective loading
66
+ ├── docs/internal/
67
+ │ ├── strategy/ # Business specs
68
+ │ ├── specs/ # Living docs (post-completion)
69
+ │ │ └── {project}/ # Project-specific specs
70
+ │ ├── architecture/ # Technical design, ADRs
71
+ │ └── operations/ # Runbooks, SLOs
72
+ └── config.json # Project configuration
118
73
  ```
119
74
 
120
75
  ---
121
76
 
122
- ## SpecWeave Workflow (Use These Commands!)
77
+ ## Task Format (Mandatory)
123
78
 
124
- **How SpecWeave works**:
79
+ ```markdown
80
+ ### T-001: Task Title
81
+ **User Story**: US-001 ← REQUIRED
82
+ **Satisfies ACs**: AC-US1-01 ← REQUIRED
83
+ **Status**: [x] completed
125
84
 
85
+ **Test Plan** (BDD):
86
+ - **Given** [context] → **When** [action] → **Then** [result]
126
87
  ```
127
- /specweave:increment "feature" → /specweave:do → /specweave:progress → /specweave:done → repeat
128
- ```
129
-
130
- **1. Plan Feature** → `/specweave:increment "user authentication"`
131
- - Creates spec.md (WHAT/WHY), plan.md (HOW), tasks.md (with embedded tests)
132
- - PM-led process with architect/security/QA review
133
- - **Use when**: Starting any new feature or increment
134
-
135
- **2. Execute Tasks** → `/specweave:do` or `/specweave:do 0001`
136
- - Smart resume (picks up where you left off)
137
- - Runs hooks after EVERY task completion
138
- - **Use when**: Ready to implement planned work
139
-
140
- **3. Check Progress** → `/specweave:progress`
141
- - Shows task completion %, next action
142
- - **Use when**: Want to see status
143
-
144
- **4. Validate Quality** → `/specweave:validate 0001` or `/specweave:qa 0001`
145
- - Rule-based validation (120 checks) or AI quality assessment with risk scoring
146
- - Validates tasks, tests (embedded in tasks.md), and documentation
147
- - **Use when**: Verify increment quality before completion
148
-
149
- **5. Close Increment** → `/specweave:done 0001`
150
- - Validates all tasks complete
151
- - **Use when**: Feature is finished
152
-
153
- **6. Sync to External** (Plugin Commands):
154
- - `/specweave:github:sync` - Export to GitHub issues (github plugin)
155
- - `/specweave:jira:sync` - Export to Jira (jira plugin)
156
- - **Use when**: Need to sync with project management tools
157
-
158
- **All other functionality (agents, skills) activates automatically based on context.**
159
88
 
160
89
  ---
161
90
 
162
- ## ⚠️ Increment Discipline (CRITICAL)
163
-
164
- ### 🚨 INCREMENT NUMBERS MUST BE UNIQUE!
165
-
166
- **Duplicate numbers break everything** - sync, status line, git history.
167
-
168
- **Format**: `####-descriptive-name` (e.g., `0001-user-auth`)
169
-
170
- **Check before creating:**
171
- ```bash
172
- ls -1 .specweave/increments/ | grep -E "^[0-9]{4}-" | sort | tail -5
173
- ```
174
-
175
- ### 📁 Folder Structure (MANDATORY)
176
-
177
- **Only 3 files in root:** `spec.md`, `plan.md`, `tasks.md`
91
+ ## Context Loading (Token Savings)
178
92
 
179
- **Everything else in subfolders:**
180
- - `reports/` - Analysis, summaries, session notes
181
- - `scripts/` - Helper scripts
182
- - `logs/` - Execution logs
93
+ **ALWAYS read `context-manifest.yaml` first!** Load only files listed there.
94
+ - Full specs: 50k tokens
95
+ - Manifest files: 5k tokens
96
+ - **Savings: 90%**
183
97
 
184
98
  ---
185
99
 
186
- ## 🔗 Automatic Syncing (Living Docs + External Tools)
187
-
188
- **SpecWeave automatically syncs your work** after EVERY task completion via hooks:
189
-
190
- ### What Gets Synced Automatically
191
-
192
- 1. **Living Docs** → `.specweave/docs/internal/specs/`
193
- - Increment specs sync to permanent knowledge base
194
- - Ensures complete project history
195
- - **Configurable**: Set `sync_living_docs: true` in `.specweave/config.json`
196
-
197
- 2. **External Trackers** (if configured):
198
- - GitHub Issues - Task checkboxes update automatically
199
- - Jira - Issue status updates automatically
200
- - Azure DevOps - Work item updates automatically
201
- - **Configurable**: Set `external_tracker_sync: true` in `.specweave/config.json`
202
-
203
- ### 🏷️ GitHub Sync Mapping (Universal Hierarchy)
204
-
205
- **SpecWeave follows strict hierarchy for GitHub sync:**
206
-
207
- | SpecWeave Entity | GitHub Mapping | Example |
208
- |------------------|----------------|---------|
209
- | **Feature** (FS-XXX) | **Milestone** | `FS-031: External Tool Status Sync` |
210
- | **User Story** (US-XXX) | **Issue** | `[FS-031][US-002] Task-Level Mapping` |
211
- | **Task** (T-XXX) | **Checkbox** | `- [ ] T-001: Implement validator` |
212
-
213
- **Key Principles**:
214
- - ✅ **Features → Milestones** (container for all User Stories)
215
- - ✅ **User Stories → Issues** (each US-* file = separate GitHub issue)
216
- - ✅ **Tasks → Checkboxes** (listed in User Story issue body)
217
- - ❌ **NEVER create Feature-level issues** (Features are Milestones!)
218
-
219
- **⛔ DEPRECATED**:
220
- - ❌ `[INC-XXXX]` - Old increment format (pre-v0.18.0)
221
- - ❌ `[FS-XXX] Feature Title` as issue - Feature-level issues (pre-v0.19.0, wrong!)
222
-
223
- 3. **Sound Notifications**:
224
- - Plays sound when tasks complete (helps you know when to review)
225
- - Platform-specific: Glass.aiff (macOS), system sounds (Linux/Windows)
226
-
227
- ### Configuration (`.specweave/config.json`)
100
+ ## Automatic Syncing (Hooks)
228
101
 
229
- Created automatically during `specweave init`, but you can customize:
102
+ After **EVERY task completion**, hooks automatically:
103
+ 1. Update `tasks.md` status
104
+ 2. Sync to living docs (`.specweave/docs/internal/specs/`)
105
+ 3. Sync to external trackers (GitHub/Jira/ADO) if configured
230
106
 
107
+ **Configuration** (`.specweave/config.json`):
231
108
  ```json
232
109
  {
233
110
  "hooks": {
234
111
  "post_task_completion": {
235
- "sync_living_docs": true, // Sync specs to living docs
236
- "sync_tasks_md": true, // Update tasks.md
237
- "external_tracker_sync": true // Sync to GitHub/Jira/ADO
112
+ "sync_living_docs": true,
113
+ "external_tracker_sync": true
238
114
  }
239
115
  }
240
116
  }
241
117
  ```
242
118
 
243
- **Just works!** No manual syncing needed - focus on implementation, SpecWeave handles the rest.
244
-
245
- ---
246
-
247
- ## 🧠 Automatic Intent Detection (NEW in v0.3.8+)
248
-
249
- **SpecWeave now detects when you're describing a product/project and automatically helps you plan it!**
250
-
251
- ### How It Works
252
-
253
- When working in a SpecWeave-initialized project (`.specweave/` exists), SpecWeave recognizes product descriptions by detecting these patterns:
254
-
255
- **Signals that trigger auto-detection:**
256
- 1. ✅ **Project Name/Description** - "Project: RosterSync", "I want to build X"
257
- 2. ✅ **Features List** - Bullet points or numbered list of features (3+ items)
258
- 3. ✅ **Tech Stack** - Languages, frameworks, databases mentioned
259
- 4. ✅ **Timeline/Scope** - "MVP", "2 weeks", "Phase 1", "Quick build"
260
- 5. ✅ **Problem Statement** - "For teams...", "Helps users...", "Solves..."
261
- 6. ✅ **Business Model** - "Freemium", "$X/mo", "B2B", "Consumer"
262
-
263
- **Confidence Levels:**
264
- - **High (5-6 signals + SpecWeave folder)**: Auto-route to `/specweave:increment` immediately
265
- - **Medium (3-4 signals + SpecWeave folder)**: Ask 1-2 clarifying questions, then route
266
- - **Low (<3 signals)**: Regular conversation (no auto-routing)
267
-
268
- ### Example: Automatic Detection
269
-
270
- ```
271
- You: Project: RosterSync - Team scheduling SaaS
272
- Core features:
273
- - Team roster management
274
- - Availability calendar
275
- - Event scheduling with notifications
276
- - Lineup builder
277
- Tech stack: .NET 8, Next.js 14+, PostgreSQL
278
- MVP: 2-3 weeks
279
- Monetization: Freemium ($10/mo)
280
-
281
- SpecWeave detects: ✅ Name ✅ Features ✅ Tech ✅ Timeline ✅ Problem ✅ Business
282
- → Automatically recognizes this as a product description
283
- → Guides you through increment planning
284
- → Invokes /specweave:increment automatically
285
-
286
- No need to remember the full command!
287
- ```
288
-
289
- ### Opt-Out Options
290
-
291
- You can override automatic routing with explicit instructions:
292
- - **"Just brainstorm first"** → Uses spec-driven-brainstorming instead
293
- - **"Don't plan yet"** → Regular conversation
294
- - **"Quick discussion"** → No automatic routing
295
- - **"Let's explore ideas first"** → Exploratory mode
296
-
297
- ### Two Ways to Use SpecWeave
298
-
299
- 1. ✅ **Automatic** (NEW): Describe your product → SpecWeave detects it → Plans automatically
300
- 2. ✅ **Explicit** (Classic): Type `/specweave:increment "feature"` → Works as before
301
-
302
- Both approaches work perfectly - use whichever feels more natural!
303
-
304
- ---
305
-
306
- ## 🚨 CRITICAL: File Organization Rules
307
-
308
- **Keep project root CLEAN!** All AI-generated files MUST go into increment folders.
309
-
310
- ### What Goes Where
311
-
312
- **✅ ALLOWED in Root**:
313
- - `CLAUDE.md` (this file)
314
- - Your existing project files (package.json, src/, etc.)
315
- - Standard config files (.env, .gitignore, tsconfig.json)
316
-
317
- **❌ NEVER Create in Root** (use increment folders):
318
- - Reports → `.specweave/increments/0001-feature-name/reports/`
319
- - Scripts → `.specweave/increments/0001-feature-name/scripts/`
320
- - Logs → `.specweave/increments/0001-feature-name/logs/`
321
- - Analysis files → `.specweave/increments/0001-feature-name/reports/`
322
- - Temp files → `.specweave/increments/0001-feature-name/logs/`
323
-
324
- ### Increment Structure
325
-
326
- ```
327
- .specweave/increments/0001-user-auth/ # ⚠️ ID must be unique!
328
- ├── spec.md # WHAT & WHY
329
- ├── plan.md # HOW
330
- ├── tasks.md # Tasks with embedded test plans (BDD format)
331
- ├── context-manifest.yaml # Selective context loading
332
- ├── logs/ # ✅ Execution logs, errors, AI sessions
333
- ├── scripts/ # ✅ Helper scripts, migrations, setup
334
- └── reports/ # ✅ Analysis, completion, performance
335
- ```
336
-
337
- **Why?**
338
- - ✅ Complete traceability (know which increment created which files)
339
- - ✅ Easy cleanup (delete increment folder = delete all related files)
340
- - ✅ Clear context (all files for a feature in one place)
341
- - ✅ No root clutter
342
-
343
- **Example**:
344
- ```
345
- ❌ WRONG:
346
- project-root/
347
- ├── analysis-report.md # NO! Pollutes root
348
- ├── migration-script.py # NO! Pollutes root
349
- └── execution.log # NO! Pollutes root
350
-
351
- ✅ CORRECT:
352
- .specweave/increments/0001-user-auth/
353
- ├── reports/analysis-report.md
354
- ├── scripts/migration-script.py
355
- └── logs/execution.log
356
- ```
357
-
358
119
  ---
359
120
 
360
- ## 🔗 Bidirectional Task ↔ User Story Linking
361
-
362
- **AUTOMATIC FEATURE**: SpecWeave creates bidirectional links between tasks and user stories.
363
-
364
- ### How It Works
365
-
366
- **When you complete an increment** (`/specweave:done`):
367
- 1. User stories are extracted to `.specweave/docs/internal/specs/default/`
368
- 2. Tasks.md is automatically updated with links back to user stories
369
- 3. Complete bidirectional navigation is created!
370
-
371
- **Example Task** (WITH bidirectional link):
372
- ```markdown
373
- ### T-001: Implement User Login
374
-
375
- **User Story**: [US-001: User Authentication](../../docs/internal/specs/default/auth-service/us-001-user-authentication.md)
376
-
377
- **AC**: AC-US1-01, AC-US1-02, AC-US1-03
378
-
379
- **Test Plan** (BDD):
380
- - **Given** valid credentials → **When** login → **Then** receive JWT token
381
- ```
382
-
383
- ### Requirements
384
-
385
- **Your tasks.md MUST have AC-IDs** for bidirectional linking:
386
-
387
- ```markdown
388
- ## T-001: Implement User Login
389
-
390
- **AC**: AC-US1-01, AC-US1-02, AC-US1-03 ← CRITICAL for linking!
391
- ```
392
-
393
- **AC-ID Format**: `AC-US{number}-{criteria}` (e.g., `AC-US1-01`, `AC-US2-03`)
394
- - Maps to user stories: `AC-US1-01` → `US-001`
395
- - Multiple AC-IDs allowed per task
396
- - Task links to FIRST user story found
397
-
398
- ### Benefits
399
-
400
- - ✅ **Navigate both directions**: Tasks → User Stories → Tasks
401
- - ✅ **Automatic**: No manual linking needed
402
- - ✅ **Multi-project aware**: Works with backend, frontend, mobile, etc.
403
- - ✅ **Always in sync**: Links created during `/specweave:done`
404
- - ✅ **NEW (v0.18.3+)**: User stories include project-specific checkable task lists
121
+ ## GitHub Sync Mapping
405
122
 
406
- ### Project-Specific Tasks (v0.18.3+)
407
-
408
- **NEW**: User stories now have their OWN checkable task lists, not just links!
409
-
410
- ```markdown
411
- ## Tasks
412
-
413
- - [ ] **T-001**: Setup API endpoint
414
- - [x] **T-003**: Add DB migration (completed)
415
-
416
- > **Note**: Tasks are project-specific. See increment tasks.md for full list
417
- ```
123
+ | SpecWeave | GitHub |
124
+ |-----------|--------|
125
+ | Feature (FS-XXX) | Milestone |
126
+ | User Story (US-XXX) | Issue |
127
+ | Task (T-XXX) | Checkbox |
418
128
 
419
- **Benefits**:
420
- - **Project Isolation**: Backend tasks ≠ Frontend tasks
421
- - **GitHub UX**: Checkable task lists in GitHub issues
422
- - **Traceability**: Each user story explicitly lists its tasks
423
- - **Completion Tracking**: Status synced from increment tasks.md
424
-
425
- **For complete details**: Ask me about "bidirectional linking" or check `.specweave/docs/internal/specs/default/README.md`
129
+ **Issue Title Format**: `[FS-XXX][US-YYY] User Story Title`
426
130
 
427
131
  ---
428
132
 
429
133
  ## Tech Stack
430
134
 
431
- **Project Type**: {MONOREPO_OR_SINGLE}
135
+ **Type**: {MONOREPO_OR_SINGLE}
432
136
 
433
137
  {#IF_SINGLE_STACK}
434
- **Stack**:
435
138
  - Language: {DETECTED_LANGUAGE}
436
139
  - Framework: {DETECTED_FRAMEWORK}
437
140
  - Database: {SPECIFIED_DATABASE}
438
- - Platform: {SPECIFIED_PLATFORM}
439
141
  {#ENDIF}
440
142
 
441
143
  {#IF_MONOREPO}
442
144
  **Services**:
443
- - {SERVICE_1_NAME}: {SERVICE_1_LANGUAGE} + {SERVICE_1_FRAMEWORK} ({SERVICE_1_PATH}/)
444
- - {SERVICE_2_NAME}: {SERVICE_2_LANGUAGE} + {SERVICE_2_FRAMEWORK} ({SERVICE_2_PATH}/)
445
- {#ENDIF}
446
-
447
- Config: Auto-detected from project files
448
-
449
- ---
450
-
451
- ## Project Structure
452
-
453
- **IMPORTANT**: This project uses {MONOREPO_OR_SINGLE} mode.
454
-
455
- {#IF_SINGLE_PROJECT}
456
- ### Single Project Structure
457
-
458
- ```
459
- {PROJECT_NAME}/
460
- ├── .specweave/
461
- │ ├── docs/ # Strategic documentation
462
- │ │ ├── internal/
463
- │ │ │ ├── strategy/ # Business specs (WHAT, WHY)
464
- │ │ │ ├── specs/ # Feature specifications (living docs)
465
- │ │ │ │ └── default/ # ✅ All specs in default project
466
- │ │ │ ├── architecture/ # Technical design (HOW)
467
- │ │ │ ├── delivery/ # Guides, roadmap, CI/CD
468
- │ │ │ ├── operations/ # Runbooks, monitoring
469
- │ │ │ └── governance/ # Security, compliance
470
- │ │ └── public/ # Published docs
471
- │ ├── increments/ # Features (auto-numbered, UNIQUE IDs)
472
- │ │ └── 0001-feature-name/ # ⚠️ Each ID must be unique (0001-9999)
473
- │ │ ├── spec.md # What we're building
474
- │ │ ├── plan.md # How we'll build it
475
- │ │ ├── tasks.md # Tasks with embedded tests
476
- │ │ ├── logs/ # ✅ Put logs here
477
- │ │ ├── scripts/ # ✅ Put scripts here
478
- │ │ └── reports/ # ✅ Put reports here
479
- │ └── tests/ # Centralized test repository
480
-
481
- ├── .claude/ # Pre-installed components
482
- │ ├── agents/ # Core + plugin agents (auto-activate)
483
- │ ├── skills/ # Core + plugin skills (auto-activate)
484
- │ └── commands/ # Core + plugin slash commands
485
-
486
- ├── CLAUDE.md # This file
487
- └── src/ # Your source code
488
- ```
489
- {#ENDIF}
490
-
491
- {#IF_MULTI_PROJECT}
492
- ### Multi-Project Structure (v0.16.11+ Flattened)
493
-
494
- **CRITICAL**: Specs are organized by project with FLATTENED structure (v0.16.11+).
495
-
496
- ```
497
- {PROJECT_NAME}/
498
- ├── .specweave/
499
- │ ├── docs/internal/
500
- │ │ ├── strategy/ # Cross-project strategy
501
- │ │ ├── specs/ # ✅ FLATTENED structure (v0.16.11+)
502
- │ │ │ ├── backend/ # Backend project specs
503
- │ │ │ │ ├── spec-001-api-auth.md
504
- │ │ │ │ └── spec-002-data-layer.md
505
- │ │ │ ├── frontend/ # Frontend project specs
506
- │ │ │ │ ├── spec-001-user-dashboard.md
507
- │ │ │ │ └── spec-002-dark-mode.md
508
- │ │ │ ├── mobile/ # Mobile project specs (if applicable)
509
- │ │ │ │ └── spec-001-push-notifications.md
510
- │ │ │ └── _parent/ # Parent repo specs (multi-repo only)
511
- │ │ │ └── spec-001-system-architecture.md
512
- │ │ ├── architecture/ # System-wide technical design
513
- │ │ ├── delivery/ # Cross-project delivery
514
- │ │ ├── operations/ # Cross-project operations
515
- │ │ └── governance/ # Cross-project governance
516
- │ ├── increments/
517
- │ │ ├── 0001-backend-auth/ # Backend increment
518
- │ │ ├── 0002-frontend-ui/ # Frontend increment
519
- │ │ └── 0003-mobile-push/ # Mobile increment
520
- │ └── ...
521
- ```
522
-
523
- **Living Docs Path Format**:
524
- - ✅ **CORRECT** (v0.16.11+): `.specweave/docs/internal/specs/{project-id}/spec-NNN-name.md`
525
- - ❌ **OLD** (v0.8.0-v0.16.10): `.specweave/docs/internal/projects/{project-id}/specs/...` (DEPRECATED)
526
-
527
- **Project Detection** (automatic):
528
- - **From increment name**: `0001-backend-auth` → project: `backend`
529
- - **From tech stack**: React/Next.js → `frontend`, ASP.NET/Node.js → `backend`
530
- - **From config**: `multiProject.activeProject` in `.specweave/config.json`
531
- - **Fallback**: Uses `default` project
532
- {#ENDIF}
533
-
534
- ---
535
-
536
- ## Plugins
537
-
538
- SpecWeave uses Claude Code's native plugin system. All plugins auto-install during `specweave init`.
539
-
540
- **Enabled plugins**: {ENABLED_PLUGINS}
541
-
542
- **Plugin commands** (examples):
543
- - `/specweave:github:sync` - Sync to GitHub
544
- - `/specweave:jira:sync` - Sync to Jira
545
-
546
- Skills/agents activate automatically based on context.
547
-
548
- ---
549
-
550
- ## Documentation Approach
551
-
552
- **You chose**: {DOCUMENTATION_APPROACH}
553
-
554
- {#IF_COMPREHENSIVE}
555
- **Comprehensive** - Detailed specs upfront, best for enterprise/regulated industries.
556
- {#ENDIF}
557
-
558
- {#IF_INCREMENTAL}
559
- **Incremental** - Build docs as you go, best for startups/MVPs.
145
+ - {SERVICE_1_NAME}: {SERVICE_1_LANGUAGE} ({SERVICE_1_PATH}/)
146
+ - {SERVICE_2_NAME}: {SERVICE_2_LANGUAGE} ({SERVICE_2_PATH}/)
560
147
  {#ENDIF}
561
148
 
562
149
  ---
563
150
 
564
- ## Quick Reference
565
-
566
- **Need help?** [SpecWeave Docs](https://spec-weave.com/docs)
567
- - **Which spec is source of truth?** Living docs spec (when it exists), otherwise increment spec
568
-
569
- ### Key Topics Covered
570
- - ✅ Two-spec architecture explained
571
- - ✅ When to create living docs specs
572
- - ✅ Increment spec lifecycle
573
- - ✅ Brownfield documentation linking
574
- - ✅ External PM tool integration (Jira, ADO, GitHub)
575
- - ✅ Small vs large feature decisions
576
- - ✅ Project structure and organization
577
-
578
- **[View Complete FAQ →](https://spec-weave.com/docs/faq)**
579
-
580
- ---
581
-
582
151
  ## Testing
583
152
 
584
- **Four Levels**:
585
- 1. **Specification** (`.specweave/docs/internal/strategy/`) - Acceptance criteria (AC-IDs)
586
- 2. **Feature** (`.specweave/increments/####/tasks.md`) - Test plans embedded in tasks (BDD format)
587
- 3. **Integration** (`tests/integration/` or `tests/specs/`) - Component/module tests
588
- 4. **Code** (`tests/`) - Automated tests (Unit, Integration, E2E)
589
-
590
- **Test-Aware Planning**: Tests are embedded in tasks.md using BDD format (Given/When/Then), with AC-ID traceability and realistic coverage targets (80-90%).
591
-
592
- **Requirements**:
593
- - E2E tests when UI exists
594
- - >80% coverage for critical paths
595
- - Tests MUST tell the truth
153
+ **Test-Aware Planning**: Tests embedded in `tasks.md` (BDD format)
154
+ - Unit tests: >80% coverage
155
+ - Integration tests: Critical paths
156
+ - E2E tests: When UI exists
596
157
 
597
- ### Writing Modern Tests (Vitest)
158
+ **Test Files**: `.test.ts` (Vitest), NOT `.spec.ts`
598
159
 
599
- **SpecWeave uses Vitest**. Key patterns:
160
+ ---
600
161
 
601
- ```typescript
602
- // ✅ CORRECT: ES6 imports, Vitest API, type-safe mocks
603
- import { describe, it, expect, vi } from 'vitest';
604
- vi.mock('fs-extra', () => ({ default: { readFile: vi.fn() } }));
605
- import fs from 'fs-extra';
606
-
607
- describe('Feature', () => {
608
- const mockReadFile = vi.mocked(fs.readFile);
609
-
610
- beforeEach(() => {
611
- vi.clearAllMocks();
612
- mockReadFile.mockResolvedValue('data');
613
- });
614
-
615
- it('works', async () => {
616
- const result = await MyModule.doSomething();
617
- expect(mockReadFile).toHaveBeenCalled();
618
- });
619
- });
620
- ```
162
+ ## Troubleshooting
621
163
 
622
- **Common mistakes to avoid**:
623
- - ❌ `require()` → ✅ `import` (ES modules only)
624
- - `jest.fn()` `vi.fn()` (Vitest API)
625
- - `fs as anyed<>` `vi.mocked(fs.method)` (type-safe)
626
- - External variable in `vi.mock()` factory Inline `vi.fn()`
164
+ | Issue | Solution |
165
+ |-------|----------|
166
+ | Skills not activating | Restart Claude Code |
167
+ | Commands not found | Check plugin: `/plugin list --installed` |
168
+ | Root polluted | Move files to increment folders |
169
+ | Tasks out of sync | `/specweave:sync-tasks` |
170
+ | Can't find increment | `/specweave:status` |
627
171
 
628
172
  ---
629
173
 
630
- ## Key SpecWeave Principles
174
+ ## Documentation
631
175
 
632
- 1. **Specification-First**: Always start with `/specweave:increment` to create specs before coding
633
- 2. **Documentation = Source of Truth**: Specs guide implementation, not the reverse
634
- 3. **Incremental**: Work in small, measurable increments
635
- 4. **Validated**: Every increment validated before closure
636
- 5. **Traceable**: All work traces back to specs and requirements
637
- 6. **Clean Organization**: All supporting files in increment folders, never root
638
- 7. **No Duplicate Increments**: Each increment must have a unique 4-digit ID (0001-9999)
176
+ - **Quick Reference**: This file
177
+ - **Full Docs**: https://spec-weave.com
178
+ - **Project Docs**: `.specweave/docs/internal/`
639
179
 
640
180
  ---
641
181
 
642
182
  ## Project-Specific Notes
643
183
 
644
184
  {#CUSTOM_NOTES}
645
- <!-- Add project-specific conventions, team workflows, deployment notes here -->
185
+ <!-- Add project-specific conventions here -->
646
186
  {#ENDCUSTOM}
647
187
 
648
188
  ---
649
189
 
650
- ## 🆘 Troubleshooting
651
-
652
- ### Skills Not Activating
653
-
654
- **Symptoms**: Expected skill didn't load automatically
655
-
656
- **Solutions**:
657
- 1. Restart Claude Code (skills loaded at startup)
658
- 2. Check keywords: Skills activate based on description keywords
659
- 3. Verify plugin installed: Use `/plugin list --installed`
660
- 4. Manual check: Look in `.claude/skills/SKILLS-INDEX.md` for available skills
661
-
662
- ### Commands Not Found
663
-
664
- **Symptoms**: `/specweave:increment` doesn't work
665
-
666
- **Solutions**:
667
- 1. Verify plugin installed: `/plugin list --installed`
668
- 2. Check installed commands: `ls .claude/commands/`
669
- 3. Restart Claude Code
670
- 4. Re-run: `specweave init` if plugins missing
671
-
672
- ### Root Folder Polluted
673
-
674
- **Symptoms**: `git status` shows `.md` files in project root
675
-
676
- **Solutions**:
677
- 1. **Immediate fix**: Move files to increment folder
678
- ```bash
679
- mv SESSION-NOTES.md .specweave/increments/0001/reports/
680
- mv analysis.md .specweave/increments/0001/reports/
681
- ```
682
- 2. Check `.gitignore` is up to date
683
- 3. Commit cleaned structure:
684
- ```bash
685
- git add .
686
- git commit -m "fix: move reports to increment folder"
687
- ```
688
-
689
- ### Increment Numbers Not Unique
690
-
691
- **Symptoms**: Multiple increments with same number (0001, 0001, etc.)
692
-
693
- **Solutions**:
694
- 1. Check existing: `ls -1 .specweave/increments/ | grep -E "^[0-9]{4}-"`
695
- 2. Use next available number
696
- 3. If duplicates exist, run: `/specweave:fix-duplicates`
697
-
698
- ### External Tracker Not Syncing
699
-
700
- **Symptoms**: GitHub/Jira not updating after task completion
701
-
702
- **Solutions (Claude Code)**:
703
- 1. Check config: `.specweave/config.json` has `external_tracker_sync: true`
704
- 2. Verify hook exists: `ls plugins/specweave-github/hooks/post-task-completion.sh`
705
- 3. Check credentials: `gh auth status` or `jira config list`
706
- 4. Manual sync: `/specweave:github:sync 0001`
707
-
708
- ### Tasks.md Out of Sync
709
-
710
- **Symptoms**: Progress shows 0/24 but many tasks done
711
-
712
- **Solutions**:
713
- 1. Auto-sync from reality: `/specweave:sync-tasks`
714
- 2. Manual update: Edit tasks.md, change `[ ]` to `[x]`
715
- 3. Recalculate progress counters
716
-
717
- ### Can't Find Increment
718
-
719
- **Symptoms**: Don't know which increment is active
720
-
721
- **Solutions**:
722
- 1. Check status: `/specweave:status` (shows all increments)
723
- 2. Check progress: `/specweave:progress` (shows active increment)
724
- 3. View active: `cat .specweave/state/active-increment.json`
725
-
726
- ### More Help
727
-
728
- **Documentation**: https://spec-weave.com/docs/troubleshooting
729
- **GitHub Issues**: https://github.com/anton-abyzov/specweave/issues
730
- **Discussions**: https://github.com/anton-abyzov/specweave/discussions
731
-
732
- ---
733
-
734
- ## Getting Started
735
-
736
- **Create your first feature**:
737
- ```bash
738
- /specweave:increment "your feature description"
739
- ```
740
-
741
- **Typical Workflow**:
742
- 1. `/specweave:increment "feature"` → SpecWeave creates specs
743
- 2. Review specs (spec.md, plan.md, tasks.md)
744
- 3. `/specweave:do` → Claude implements the code
745
- 4. `/specweave:progress` → Check status anytime
746
- 5. `/specweave:validate 0001` → Validate quality (optional)
747
- 6. `/specweave:done 0001` → Close when complete
748
-
749
- **Remember**:
750
- - Type `/specweave:increment` first, THEN implement
751
- - Keep root clean (use increment folders)
752
- - All agents/skills activate automatically
753
-
754
- **SpecWeave Documentation**: https://spec-weave.com
755
-
756
- ---
757
-
758
- **Last Updated**: Auto-updated via SpecWeave hooks
190
+ **SpecWeave**: Specification-first AI development framework