specweave 1.0.261 → 1.0.263
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.
- package/.claude-plugin/README.md +0 -2
- package/CLAUDE.md +27 -27
- package/bin/specweave.js +14 -85
- package/dist/dashboard/assets/index-Cv1XUAKk.css +1 -0
- package/dist/dashboard/assets/index-DHOztQSu.js +11 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/src/adapters/README.md +1 -1
- package/dist/src/adapters/agents-md-generator.js +1 -1
- package/dist/src/adapters/agents-md-generator.js.map +1 -1
- package/dist/src/adapters/claude/README.md +8 -8
- package/dist/src/adapters/claude/adapter.js +2 -2
- package/dist/src/adapters/claude-md-generator.js +2 -2
- package/dist/src/adapters/claude-md-generator.js.map +1 -1
- package/dist/src/adapters/cursor/README.md +7 -7
- package/dist/src/adapters/generic/README.md +2 -2
- package/dist/src/cli/commands/create-increment.d.ts +1 -1
- package/dist/src/cli/commands/create-increment.js +1 -1
- package/dist/src/cli/commands/update.d.ts.map +1 -1
- package/dist/src/cli/commands/update.js +64 -1
- package/dist/src/cli/commands/update.js.map +1 -1
- package/dist/src/cli/helpers/init/api-docs-config.js +7 -7
- package/dist/src/cli/helpers/init/api-docs-config.js.map +1 -1
- package/dist/src/core/config/types.d.ts +18 -0
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js +4 -0
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/external-tools/external-items-display.d.ts.map +1 -1
- package/dist/src/core/external-tools/external-items-display.js +1 -11
- package/dist/src/core/external-tools/external-items-display.js.map +1 -1
- package/dist/src/core/increment/increment-archiver.js +1 -1
- package/dist/src/core/increment/increment-archiver.js.map +1 -1
- package/dist/src/core/increment/metadata-manager.js +2 -2
- package/dist/src/core/increment/metadata-manager.js.map +1 -1
- package/dist/src/core/increment/template-creator.d.ts +1 -1
- package/dist/src/core/increment/template-creator.js +4 -4
- package/dist/src/core/lazy-loading/llm-plugin-detector.d.ts +2 -2
- package/dist/src/core/lazy-loading/llm-plugin-detector.d.ts.map +1 -1
- package/dist/src/core/lazy-loading/llm-plugin-detector.js +15 -5
- package/dist/src/core/lazy-loading/llm-plugin-detector.js.map +1 -1
- package/dist/src/core/living-docs/feature-consistency-validator.js +1 -1
- package/dist/src/core/living-docs/feature-consistency-validator.js.map +1 -1
- package/dist/src/core/living-docs/scaffolding/scaffold.js +3 -3
- package/dist/src/core/notifications/command-integration.d.ts.map +1 -1
- package/dist/src/core/notifications/command-integration.js +0 -1
- package/dist/src/core/notifications/command-integration.js.map +1 -1
- package/dist/src/core/reflection/reflect-handler.js +2 -2
- package/dist/src/core/reflection/reflect-handler.js.map +1 -1
- package/dist/src/core/validators/ac-presence-validator.d.ts +1 -1
- package/dist/src/core/validators/ac-presence-validator.js +3 -3
- package/dist/src/core/validators/ac-presence-validator.js.map +1 -1
- package/dist/src/dashboard/server/command-runner.d.ts.map +1 -1
- package/dist/src/dashboard/server/command-runner.js +2 -2
- package/dist/src/dashboard/server/command-runner.js.map +1 -1
- package/dist/src/dashboard/server/dashboard-server.d.ts.map +1 -1
- package/dist/src/dashboard/server/dashboard-server.js +22 -10
- package/dist/src/dashboard/server/dashboard-server.js.map +1 -1
- package/dist/src/dashboard/server/data/dashboard-data-aggregator.d.ts +9 -1
- package/dist/src/dashboard/server/data/dashboard-data-aggregator.d.ts.map +1 -1
- package/dist/src/dashboard/server/data/dashboard-data-aggregator.js +140 -13
- package/dist/src/dashboard/server/data/dashboard-data-aggregator.js.map +1 -1
- package/dist/src/dashboard/server/data/plugin-scanner.d.ts +1 -1
- package/dist/src/dashboard/server/data/plugin-scanner.d.ts.map +1 -1
- package/dist/src/dashboard/server/data/plugin-scanner.js +2 -2
- package/dist/src/dashboard/server/data/plugin-scanner.js.map +1 -1
- package/dist/src/utils/agents-md-compiler.js +1 -1
- package/dist/src/utils/agents-md-compiler.js.map +1 -1
- package/dist/src/utils/find-project-root.d.ts +5 -4
- package/dist/src/utils/find-project-root.d.ts.map +1 -1
- package/dist/src/utils/find-project-root.js +8 -10
- package/dist/src/utils/find-project-root.js.map +1 -1
- package/dist/src/utils/generate-skills-index.js +3 -3
- package/dist/src/utils/notification-constants.js +1 -1
- package/dist/src/utils/notification-constants.js.map +1 -1
- package/package.json +1 -1
- package/plugins/FINAL-AUDIT-RECOMMENDATIONS.md +3 -3
- package/plugins/specweave/PLUGIN.md +0 -22
- package/plugins/specweave/commands/analytics.md +1 -1
- package/plugins/specweave/commands/discrepancies.md +0 -1
- package/plugins/specweave/commands/living-docs.md +0 -1
- package/plugins/specweave/commands/reconcile.md +1 -1
- package/plugins/specweave/hooks/hooks.json +19 -0
- package/plugins/specweave/hooks/pre-compact.sh +39 -0
- package/plugins/specweave/hooks/stop-sync.sh +23 -1
- package/plugins/specweave/hooks/universal/fail-fast-wrapper.sh +4 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +193 -59
- package/plugins/specweave/hooks/v2/dispatchers/post-tool-use-analytics.sh +83 -0
- package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +7 -0
- package/plugins/specweave/hooks/v2/guards/spec-template-enforcement-guard.sh +1 -1
- package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +25 -6
- package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +21 -3
- package/plugins/specweave/hooks/v2/lib/check-provider-enabled.sh +52 -0
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +2 -2
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
- package/plugins/specweave/scripts/track-analytics.sh +4 -0
- package/plugins/specweave/skills/do/SKILL.md +1 -1
- package/plugins/specweave/skills/done/SKILL.md +1 -1
- package/plugins/specweave/skills/framework/SKILL.md +4 -4
- package/plugins/specweave/skills/increment/SKILL.md +192 -25
- package/plugins/specweave/skills/next/SKILL.md +36 -630
- package/plugins/specweave/skills/pm/phases/00-deep-interview.md +2 -2
- package/plugins/specweave/skills/progress-sync/SKILL.md +7 -25
- package/plugins/specweave/skills/spec-generator/SKILL.md +44 -626
- package/plugins/specweave/skills/tdd-green/SKILL.md +10 -798
- package/plugins/specweave/skills/tdd-red/SKILL.md +8 -136
- package/plugins/specweave/skills/tdd-refactor/SKILL.md +15 -147
- package/plugins/specweave-github/hooks/github-auto-create-handler.sh +23 -5
- package/src/templates/AGENTS.md.template +11 -11
- package/src/templates/CLAUDE.md.template +1 -1
- package/dist/dashboard/assets/index-CDl14O5G.css +0 -1
- package/dist/dashboard/assets/index-CmqBqnWd.js +0 -11
- package/plugins/specweave/commands/api-docs.md +0 -672
- package/plugins/specweave/commands/check-hooks.md +0 -241
- package/plugins/specweave/commands/embed-acs.md +0 -445
- package/plugins/specweave/commands/external.md +0 -145
- package/plugins/specweave/commands/import-docs.md +0 -212
- package/plugins/specweave/commands/migrate-config.md +0 -104
- package/plugins/specweave/commands/notifications.md +0 -94
- package/plugins/specweave/commands/plugin-validator.md +0 -429
- package/plugins/specweave/commands/revert-wip-limit.md +0 -82
- package/plugins/specweave/commands/sync-acs.md +0 -342
- package/plugins/specweave/commands/sync-specs.md +0 -339
- package/plugins/specweave/commands/sync-tasks.md +0 -255
- package/plugins/specweave/commands/update-scope.md +0 -351
- package/plugins/specweave/commands/validate-features.md +0 -207
- package/plugins/specweave/skills/archive-increments/SKILL.md +0 -209
- package/plugins/specweave/skills/code-review/SKILL.md +0 -598
- package/plugins/specweave/skills/increment-planner/SKILL.md +0 -238
- package/plugins/specweave/skills/increment-work-router/SKILL.md +0 -562
- package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +0 -423
- package/plugins/specweave/skills/pm-closure-validation/SKILL.md +0 -542
- package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +0 -245
- package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +0 -228
- package/plugins/specweave/skills/umbrella-repo-detector/SKILL.md +0 -301
|
@@ -4,27 +4,32 @@ description: Generates comprehensive specifications (spec.md, plan.md, tasks.md
|
|
|
4
4
|
|
|
5
5
|
# Spec Generator - Flexible Increment Documentation
|
|
6
6
|
|
|
7
|
-
**Purpose**:
|
|
7
|
+
**Purpose**: Generate spec.md, plan.md, tasks.md with embedded tests for SpecWeave increments.
|
|
8
8
|
|
|
9
|
-
**When to Use**:
|
|
10
|
-
- Creating new increments (`/sw:inc`)
|
|
11
|
-
- Planning features or products
|
|
12
|
-
- Generating structured documentation
|
|
13
|
-
- Converting ideas into actionable specs
|
|
14
|
-
|
|
15
|
-
**Based On**: Flexible Spec Generator (V2) - context-aware, non-rigid templates
|
|
9
|
+
**When to Use**: Creating increments (`/sw:inc`), planning features, converting ideas into specs.
|
|
16
10
|
|
|
17
11
|
---
|
|
18
12
|
|
|
19
|
-
##
|
|
13
|
+
## MANDATORY STEP 0: Get Project Context FIRST
|
|
14
|
+
|
|
15
|
+
**This step is BLOCKING — do not proceed until you have actual project/board IDs.**
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
1. **Run**: `specweave context projects`
|
|
18
|
+
2. **Parse** the JSON output for project IDs and (if 2-level) board IDs
|
|
19
|
+
3. **Resolve** each user story to correct project using this priority:
|
|
20
|
+
- EXACT MATCH from config → use it
|
|
21
|
+
- LIVING DOCS folder match → use it
|
|
22
|
+
- RECENT PATTERNS in past increments → use same
|
|
23
|
+
- UNCERTAIN → ASK USER (never guess!)
|
|
24
|
+
- FALLBACK → use "default" (never "specweave")
|
|
22
25
|
|
|
23
|
-
**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
**VALIDATION**: Every US MUST have `**Project**:` field with resolved value. Never use placeholders.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 1. Spec Generation (spec.md)
|
|
31
|
+
|
|
32
|
+
**Adapts to Context**: New Product (full PRD) | Feature Addition (focused stories) | Bug Fix (problem-solution) | Refactoring (current-proposed)
|
|
28
33
|
|
|
29
34
|
**YAML Frontmatter**:
|
|
30
35
|
```yaml
|
|
@@ -35,640 +40,53 @@ type: feature
|
|
|
35
40
|
priority: P1
|
|
36
41
|
status: planned
|
|
37
42
|
created: 2025-12-04
|
|
38
|
-
# NOTE: project: and board: fields REMOVED from frontmatter!
|
|
39
|
-
# Use per-US **Project**: and **Board**: fields instead (see below)
|
|
40
43
|
---
|
|
41
44
|
```
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
This is MANDATORY in BOTH single-project AND multi-project modes.
|
|
46
|
+
**Core Sections**: Executive Summary, Problem Statement, User Stories & Acceptance Criteria, Success Metrics, Non-Goals.
|
|
46
47
|
|
|
47
|
-
**
|
|
48
|
+
**Per-US Format**:
|
|
48
49
|
```markdown
|
|
49
|
-
# Product Specification: [Increment Name]
|
|
50
|
-
|
|
51
|
-
**Increment**: [ID]
|
|
52
|
-
**Title**: [Title]
|
|
53
|
-
**Status**: Planning
|
|
54
|
-
**Priority**: [P0-P3]
|
|
55
|
-
**Created**: [Date]
|
|
56
|
-
|
|
57
|
-
## Executive Summary
|
|
58
|
-
[1-2 paragraph overview]
|
|
59
|
-
|
|
60
|
-
## Problem Statement
|
|
61
|
-
### Current State
|
|
62
|
-
### User Pain Points
|
|
63
|
-
### Target Audience
|
|
64
|
-
|
|
65
|
-
## User Stories & Acceptance Criteria
|
|
66
|
-
|
|
67
|
-
<!--
|
|
68
|
-
⛔ MANDATORY: **Project**: field on EVERY User Story
|
|
69
|
-
- Single-project: Use config.project.name value
|
|
70
|
-
- Multi-project: Use one of multiProject.projects keys
|
|
71
|
-
NEVER generate a User Story without **Project**: field!
|
|
72
|
-
-->
|
|
73
|
-
|
|
74
50
|
### US-001: [Title]
|
|
75
|
-
**Project**: [MANDATORY -
|
|
76
|
-
**Board**: [MANDATORY for 2-level
|
|
51
|
+
**Project**: [MANDATORY - resolved from Step 0]
|
|
52
|
+
**Board**: [MANDATORY for 2-level only]
|
|
77
53
|
|
|
78
54
|
**As a** [user type]
|
|
79
55
|
**I want** [goal]
|
|
80
56
|
**So that** [benefit]
|
|
81
57
|
|
|
82
58
|
**Acceptance Criteria**:
|
|
83
|
-
- [ ] **AC-US1-01**: [Criterion
|
|
84
|
-
- [ ] **AC-US1-02**: [Criterion 2]
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
### MANDATORY STEP 0: Get Project Context FIRST
|
|
89
|
-
|
|
90
|
-
**⛔ YOU CANNOT GENERATE spec.md UNTIL YOU COMPLETE THIS STEP!**
|
|
91
|
-
|
|
92
|
-
**This step is BLOCKING - do not proceed until you have actual project/board IDs.**
|
|
93
|
-
|
|
94
|
-
**🧠 ULTRATHINK REQUIRED - ANALYZE ALL AVAILABLE CONTEXT FIRST!**
|
|
95
|
-
|
|
96
|
-
Before assigning ANY project, you MUST analyze:
|
|
97
|
-
1. **Living docs structure**: `ls .specweave/docs/internal/specs/` - what project folders exist?
|
|
98
|
-
2. **Recent increments**: `grep -r "^\*\*Project\*\*:" .specweave/increments/*/spec.md | tail -10`
|
|
99
|
-
3. **config.json**: Read `project.name` (single-project) or `multiProject.projects` (multi-project)
|
|
100
|
-
4. **Feature description**: What does the user want to build? Match to existing projects.
|
|
101
|
-
|
|
102
|
-
**1. Run the context API command:**
|
|
103
|
-
```bash
|
|
104
|
-
specweave context projects
|
|
59
|
+
- [ ] **AC-US1-01**: [Criterion]
|
|
105
60
|
```
|
|
106
61
|
|
|
107
|
-
**
|
|
108
|
-
```json
|
|
109
|
-
{
|
|
110
|
-
"level": 1,
|
|
111
|
-
"projects": [{"id": "frontend-app", "name": "Frontend App"}],
|
|
112
|
-
"detectionReason": "multiProject configuration"
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
For 2-level:
|
|
116
|
-
```json
|
|
117
|
-
{
|
|
118
|
-
"level": 2,
|
|
119
|
-
"projects": [{"id": "acme-corp", "name": "ACME Corp"}],
|
|
120
|
-
"boardsByProject": {
|
|
121
|
-
"acme-corp": [
|
|
122
|
-
{"id": "digital-ops", "name": "Digital Operations"},
|
|
123
|
-
{"id": "mobile-team", "name": "Mobile Team"}
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**3. 🧠 ULTRATHINK - SMART PROJECT RESOLUTION:**
|
|
62
|
+
**Flexible Sections** (auto-include by context): Competitive Analysis, Technical Requirements, API Design, UI/UX, Security, Migration Plan.
|
|
130
63
|
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
1. ✅ EXACT MATCH: config.project.name or multiProject.projects key → USE IT
|
|
134
|
-
2. ✅ LIVING DOCS: Existing folder in specs/ → USE THAT PROJECT ID
|
|
135
|
-
3. ✅ RECENT PATTERNS: Same feature type in past increments → USE SAME PROJECT
|
|
136
|
-
4. ⚠️ UNCERTAIN: Multiple valid options OR no clear match → ASK USER!
|
|
137
|
-
5. 🔄 FALLBACK: If all else fails → USE "default" (NEVER "specweave"!)
|
|
138
|
-
```
|
|
64
|
+
## 2. Technical Plan (plan.md)
|
|
139
65
|
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
I found multiple potential projects for this feature:
|
|
143
|
-
- frontend-app (keywords: UI, form, React)
|
|
144
|
-
- backend-api (keywords: API, endpoint)
|
|
66
|
+
Core sections: Architecture Overview, Component Architecture, Data Models, Implementation Strategy (phased), Testing Strategy, Deployment Plan, Risks & Mitigations.
|
|
145
67
|
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**❌ NEVER DO THIS:**
|
|
150
|
-
- Silently assign to "specweave" (that's the framework name, not user's project!)
|
|
151
|
-
- Guess without analyzing context
|
|
152
|
-
- Skip asking when genuinely uncertain
|
|
153
|
-
|
|
154
|
-
**✅ CORRECT FALLBACK (when no projects configured):**
|
|
155
|
-
```
|
|
156
|
-
**Project**: default
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**4. STORE the actual IDs for use in spec.md:**
|
|
160
|
-
```
|
|
161
|
-
RESOLVED_PROJECT = "frontend-app" // from projects[].id
|
|
162
|
-
RESOLVED_BOARD = "digital-ops" // from boardsByProject (2-level only)
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**5. Now generate spec.md using RESOLVED values (NEVER placeholders!)**
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
### Per-US Project Resolution (MANDATORY)
|
|
170
|
-
|
|
171
|
-
**🧠 USE CONTEXT API OUTPUT + LIVING DOCS TO RESOLVE PROJECT/BOARD:**
|
|
172
|
-
|
|
173
|
-
After running `specweave context projects`, you have the valid project/board IDs.
|
|
174
|
-
Now map each user story to the correct project:
|
|
175
|
-
|
|
176
|
-
**Resolution Flow:**
|
|
177
|
-
```
|
|
178
|
-
1. Get valid projects from context API: ["frontend-app", "backend-api", "shared"]
|
|
179
|
-
2. Analyze feature description for keywords
|
|
180
|
-
3. Map keywords to ACTUAL project IDs (from step 1, NOT generic terms!)
|
|
181
|
-
4. Assign each US to its project
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
**Resolution Example:**
|
|
185
|
-
```
|
|
186
|
-
Context API returned: projects = ["frontend-app", "backend-api", "shared"]
|
|
187
|
-
|
|
188
|
-
Feature: "Add OAuth login to React frontend"
|
|
189
|
-
Detected keywords: "React", "frontend", "login"
|
|
190
|
-
|
|
191
|
-
Mapping:
|
|
192
|
-
- "frontend" keyword → matches "frontend-app" (from context API)
|
|
193
|
-
- "login" spans frontend + backend
|
|
194
|
-
|
|
195
|
-
Result:
|
|
196
|
-
US-001 (Login UI) → **Project**: frontend-app
|
|
197
|
-
US-002 (Auth API) → **Project**: backend-api
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**VALIDATION RULES:**
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
✅ REQUIRED: Run "specweave context projects" BEFORE generating spec.md
|
|
204
|
-
✅ REQUIRED: Use ONLY project IDs from the API response
|
|
205
|
-
✅ REQUIRED: Each US has explicit **Project**: field with resolved value
|
|
206
|
-
✅ REQUIRED: For 2-level, each US has explicit **Board**: field with resolved value
|
|
68
|
+
## 3. Task Breakdown (tasks.md)
|
|
207
69
|
|
|
208
|
-
❌ FORBIDDEN: Generating spec.md without running context API first
|
|
209
|
-
❌ FORBIDDEN: Using {{PROJECT_ID}} or {{BOARD_ID}} placeholders
|
|
210
|
-
❌ FORBIDDEN: Using generic keywords as project names ("frontend" vs "frontend-app")
|
|
211
|
-
❌ FORBIDDEN: Inventing project names not in the API response
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Success Metrics
|
|
215
|
-
[How we'll measure success]
|
|
216
|
-
|
|
217
|
-
## Non-Goals (Out of Scope)
|
|
218
|
-
[What we're NOT doing in this increment]
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
**Flexible Sections** (Context-Dependent):
|
|
222
|
-
- **Competitive Analysis** (if new product)
|
|
223
|
-
- **Technical Requirements** (if complex feature)
|
|
224
|
-
- **API Design** (if backend API)
|
|
225
|
-
- **UI/UX Requirements** (if frontend)
|
|
226
|
-
- **Security Considerations** (if auth/data)
|
|
227
|
-
- **Migration Plan** (if breaking change)
|
|
228
|
-
|
|
229
|
-
### 2. Technical Plan Generation (plan.md)
|
|
230
|
-
|
|
231
|
-
**Adapts to Complexity**:
|
|
232
|
-
- **Simple Feature**: Component list, data flow, implementation steps
|
|
233
|
-
- **Complex System**: Full architecture, C4 diagrams, sequence diagrams, ER diagrams
|
|
234
|
-
- **Infrastructure**: Deployment architecture, scaling strategy, monitoring
|
|
235
|
-
|
|
236
|
-
**Core Sections**:
|
|
237
|
-
```markdown
|
|
238
|
-
# Technical Plan: [Increment Name]
|
|
239
|
-
|
|
240
|
-
## Architecture Overview
|
|
241
|
-
[System design, components, interactions]
|
|
242
|
-
|
|
243
|
-
## Component Architecture
|
|
244
|
-
### Component 1
|
|
245
|
-
[Purpose, responsibilities, interfaces]
|
|
246
|
-
|
|
247
|
-
## Data Models
|
|
248
|
-
[Entities, relationships, schemas]
|
|
249
|
-
|
|
250
|
-
## Implementation Strategy
|
|
251
|
-
### Phase 1: [Name]
|
|
252
|
-
### Phase 2: [Name]
|
|
253
|
-
|
|
254
|
-
## Testing Strategy
|
|
255
|
-
[Unit, integration, E2E approach]
|
|
256
|
-
|
|
257
|
-
## Deployment Plan
|
|
258
|
-
[How we'll roll this out]
|
|
259
|
-
|
|
260
|
-
## Risks & Mitigations
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
### 3. Task Breakdown Generation (tasks.md)
|
|
264
|
-
|
|
265
|
-
**Smart Task Creation**:
|
|
266
70
|
```markdown
|
|
267
|
-
# Implementation Tasks: [Increment Name]
|
|
268
|
-
|
|
269
|
-
## Task Overview
|
|
270
|
-
**Total Tasks**: [N]
|
|
271
|
-
**Estimated Duration**: [X weeks]
|
|
272
|
-
**Priority**: [P0]
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## Phase 1: Foundation (Week 1) - X tasks
|
|
277
|
-
|
|
278
71
|
### T-001: [Task Title]
|
|
279
|
-
**
|
|
280
|
-
**Estimate**: [X hours]
|
|
281
|
-
**Status**: pending
|
|
282
|
-
|
|
283
|
-
**Description**:
|
|
284
|
-
[What needs to be done]
|
|
285
|
-
|
|
286
|
-
**Files to Create/Modify**:
|
|
287
|
-
- `path/to/file.ts`
|
|
288
|
-
|
|
289
|
-
**Implementation**:
|
|
290
|
-
```[language]
|
|
291
|
-
[Code example or approach]
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
**Acceptance Criteria**:
|
|
295
|
-
- ✅ [Criterion 1]
|
|
296
|
-
- ✅ [Criterion 2]
|
|
297
|
-
|
|
298
|
-
---
|
|
299
|
-
|
|
300
|
-
[Repeat for all tasks]
|
|
301
|
-
|
|
302
|
-
## Task Dependencies
|
|
303
|
-
[Dependency graph if complex]
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### 4. Test Strategy Generation (tests.md)
|
|
307
|
-
|
|
308
|
-
**Comprehensive Test Coverage**:
|
|
309
|
-
```markdown
|
|
310
|
-
# Test Strategy: [Increment Name]
|
|
311
|
-
|
|
312
|
-
## Test Overview
|
|
313
|
-
**Total Test Cases**: [N]
|
|
314
|
-
**Test Levels**: [Unit, Integration, E2E, Performance]
|
|
315
|
-
**Coverage Target**: 80%+ overall, 90%+ critical
|
|
316
|
-
|
|
317
|
-
---
|
|
318
|
-
|
|
319
|
-
## Unit Tests (X test cases)
|
|
320
|
-
|
|
321
|
-
### TC-001: [Test Name]
|
|
322
|
-
```[language]
|
|
323
|
-
describe('[Component]', () => {
|
|
324
|
-
it('[should do something]', async () => {
|
|
325
|
-
// Arrange
|
|
326
|
-
// Act
|
|
327
|
-
// Assert
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
## Integration Tests (X test cases)
|
|
333
|
-
## E2E Tests (X test cases)
|
|
334
|
-
## Performance Tests (X test cases)
|
|
335
|
-
|
|
336
|
-
## Coverage Requirements
|
|
337
|
-
- Critical paths: 90%+
|
|
338
|
-
- Overall: 80%+
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
---
|
|
342
|
-
|
|
343
|
-
## Spec Generator Templates
|
|
344
|
-
|
|
345
|
-
### Template Selection Logic
|
|
346
|
-
|
|
347
|
-
**Input Analysis**:
|
|
348
|
-
1. Analyze increment description (keywords, complexity)
|
|
349
|
-
2. Detect domain (frontend, backend, infra, ML, etc.)
|
|
350
|
-
3. Determine scope (feature, product, bug fix, refactor)
|
|
351
|
-
4. Assess technical complexity (simple, moderate, complex)
|
|
352
|
-
|
|
353
|
-
**Template Selection**:
|
|
354
|
-
```
|
|
355
|
-
IF new_product THEN
|
|
356
|
-
spec_template = "Full PRD"
|
|
357
|
-
plan_template = "System Architecture"
|
|
358
|
-
ELSE IF feature_addition THEN
|
|
359
|
-
spec_template = "User Stories Focused"
|
|
360
|
-
plan_template = "Component Design"
|
|
361
|
-
ELSE IF bug_fix THEN
|
|
362
|
-
spec_template = "Problem-Solution"
|
|
363
|
-
plan_template = "Implementation Steps"
|
|
364
|
-
ELSE IF refactoring THEN
|
|
365
|
-
spec_template = "Current-Proposed"
|
|
366
|
-
plan_template = "Migration Strategy"
|
|
367
|
-
END IF
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
### Context-Aware Sections
|
|
371
|
-
|
|
372
|
-
**Auto-Include Based On**:
|
|
373
|
-
- **"authentication"** → Security Considerations, JWT/OAuth design
|
|
374
|
-
- **"API"** → API Design, OpenAPI spec, rate limiting
|
|
375
|
-
- **"database"** → ER diagrams, migration scripts, indexes
|
|
376
|
-
- **"frontend"** → Component hierarchy, state management, UI/UX
|
|
377
|
-
- **"deployment"** → CI/CD, infrastructure, monitoring
|
|
378
|
-
- **"ML"** → Model architecture, training pipeline, evaluation metrics
|
|
379
|
-
|
|
380
|
-
---
|
|
381
|
-
|
|
382
|
-
## Usage Examples
|
|
383
|
-
|
|
384
|
-
### Example 1: Simple Feature
|
|
385
|
-
```
|
|
386
|
-
User: /sw:inc "Add dark mode toggle to settings"
|
|
387
|
-
|
|
388
|
-
Spec Generator:
|
|
389
|
-
✓ Detected: Frontend feature (UI component)
|
|
390
|
-
✓ Complexity: Simple
|
|
391
|
-
✓ Template: User Stories + Component Design
|
|
392
|
-
|
|
393
|
-
Generating specifications...
|
|
394
|
-
✓ spec.md: 3 user stories, UI mockups section
|
|
395
|
-
✓ plan.md: Component design, state management, CSS-in-JS
|
|
396
|
-
✓ tasks.md: 8 tasks (component, styles, state, tests)
|
|
397
|
-
✓ tests.md: Unit tests for component, E2E for toggle
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Example 2: Complex System
|
|
401
|
-
```
|
|
402
|
-
User: /sw:inc "Multi-tenant SaaS platform with billing"
|
|
403
|
-
|
|
404
|
-
Spec Generator:
|
|
405
|
-
✓ Detected: New product (SaaS, multi-tenant, payments)
|
|
406
|
-
✓ Complexity: High
|
|
407
|
-
✓ Template: Full PRD + System Architecture
|
|
408
|
-
|
|
409
|
-
Generating specifications...
|
|
410
|
-
✓ spec.md: Market analysis, personas, competitive landscape, 15 user stories
|
|
411
|
-
✓ plan.md: Multi-tenant architecture, database per tenant, Stripe integration, C4 diagrams
|
|
412
|
-
✓ tasks.md: 40 tasks across 4 weeks (auth, tenancy, billing, UI)
|
|
413
|
-
✓ tests.md: 100+ test cases (unit, integration, E2E, load testing)
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
### Example 3: Bug Fix
|
|
417
|
-
```
|
|
418
|
-
User: /sw:inc "Fix race condition in user session handling"
|
|
419
|
-
|
|
420
|
-
Spec Generator:
|
|
421
|
-
✓ Detected: Bug fix (concurrency issue)
|
|
422
|
-
✓ Complexity: Moderate
|
|
423
|
-
✓ Template: Problem-Solution
|
|
424
|
-
|
|
425
|
-
Generating specifications...
|
|
426
|
-
✓ spec.md: Problem statement, root cause analysis, impact, solution
|
|
427
|
-
✓ plan.md: Current implementation, proposed fix, Redis locking
|
|
428
|
-
✓ tasks.md: 5 tasks (analysis, fix, tests, rollout, monitoring)
|
|
429
|
-
✓ tests.md: Concurrency tests, stress tests
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
|
-
## Integration with /sw:inc
|
|
435
|
-
|
|
436
|
-
The Spec Generator is automatically invoked by `/sw:inc`:
|
|
437
|
-
|
|
438
|
-
1. **User Intent Analysis**:
|
|
439
|
-
- Analyze increment description
|
|
440
|
-
- Detect keywords, domain, complexity
|
|
441
|
-
|
|
442
|
-
2. **Template Selection**:
|
|
443
|
-
- Choose appropriate templates
|
|
444
|
-
- Auto-include relevant sections
|
|
445
|
-
|
|
446
|
-
3. **Specification Generation**:
|
|
447
|
-
- Generate spec.md with PM context
|
|
448
|
-
- Generate plan.md with Architect context
|
|
449
|
-
- Generate tasks.md with breakdown
|
|
450
|
-
- Generate tests.md with coverage strategy
|
|
451
|
-
|
|
452
|
-
4. **User Review**:
|
|
453
|
-
- Show generated structure
|
|
454
|
-
- Allow refinement
|
|
455
|
-
- Confirm before creating files
|
|
456
|
-
|
|
457
|
-
---
|
|
458
|
-
|
|
459
|
-
## Advantages Over Rigid Templates
|
|
460
|
-
|
|
461
|
-
**Flexible (V2) Approach**:
|
|
462
|
-
- ✅ Adapts to increment type (product, feature, bug fix, refactor)
|
|
463
|
-
- ✅ Includes only relevant sections
|
|
464
|
-
- ✅ Scales complexity up/down
|
|
465
|
-
- ✅ Domain-aware (frontend, backend, ML, infra)
|
|
466
|
-
- ✅ Faster for simple increments
|
|
467
|
-
- ✅ Comprehensive for complex products
|
|
468
|
-
|
|
469
|
-
**Rigid (V1) Approach**:
|
|
470
|
-
- ❌ Same template for everything
|
|
471
|
-
- ❌ Many irrelevant sections
|
|
472
|
-
- ❌ Wastes time on simple features
|
|
473
|
-
- ❌ Insufficient for complex products
|
|
474
|
-
- ❌ One-size-fits-none
|
|
475
|
-
|
|
476
|
-
---
|
|
477
|
-
|
|
478
|
-
## Configuration
|
|
479
|
-
|
|
480
|
-
Users can customize spec generation in `.specweave/config.yaml`:
|
|
481
|
-
|
|
482
|
-
```yaml
|
|
483
|
-
spec_generator:
|
|
484
|
-
# Default complexity level
|
|
485
|
-
default_complexity: moderate # simple | moderate | complex
|
|
486
|
-
|
|
487
|
-
# Always include sections
|
|
488
|
-
always_include:
|
|
489
|
-
- executive_summary
|
|
490
|
-
- user_stories
|
|
491
|
-
- success_metrics
|
|
492
|
-
|
|
493
|
-
# Never include sections
|
|
494
|
-
never_include:
|
|
495
|
-
- competitive_analysis # We're not doing market research
|
|
496
|
-
|
|
497
|
-
# Domain defaults
|
|
498
|
-
domain_defaults:
|
|
499
|
-
frontend:
|
|
500
|
-
include: [ui_mockups, component_hierarchy, state_management]
|
|
501
|
-
backend:
|
|
502
|
-
include: [api_design, database_schema, authentication]
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
---
|
|
506
|
-
|
|
507
|
-
## 🔀 Multi-Project User Story Generation
|
|
508
|
-
|
|
509
|
-
**CRITICAL**: When umbrella/multi-project mode is detected, user stories MUST be generated per-project!
|
|
510
|
-
|
|
511
|
-
### Detection (MANDATORY FIRST STEP)
|
|
512
|
-
|
|
513
|
-
**Automated Detection**: Use `detectMultiProjectMode(projectRoot)` from `src/utils/multi-project-detector.ts`. This utility checks ALL config formats automatically.
|
|
514
|
-
|
|
515
|
-
**Manual check (for agents)**: Read `.specweave/config.json` and check:
|
|
516
|
-
- `umbrella.enabled` + `childRepos[]`
|
|
517
|
-
- `multiProject.enabled` + `projects{}`
|
|
518
|
-
- `sync.profiles[].config.boardMapping`
|
|
519
|
-
- Multiple folders in `.specweave/docs/internal/specs/`
|
|
520
|
-
|
|
521
|
-
**If ANY of these conditions are TRUE → Multi-project mode ACTIVE:**
|
|
522
|
-
- `umbrella.enabled: true` in config.json
|
|
523
|
-
- `umbrella.childRepos` has entries
|
|
524
|
-
- Multiple project folders exist in `specs/` (e.g., `sw-app-fe/`, `sw-app-be/`, `sw-app-shared/`)
|
|
525
|
-
- User prompt mentions: "3 repos", "frontend repo", "backend API", "shared library"
|
|
526
|
-
|
|
527
|
-
### Per-User-Story Project Targeting (PREFERRED)
|
|
528
|
-
|
|
529
|
-
Each user story specifies its target project inline:
|
|
530
|
-
|
|
531
|
-
```markdown
|
|
532
|
-
## User Stories
|
|
533
|
-
|
|
534
|
-
### US-001: Thumbnail Upload & Comparison (P1)
|
|
535
|
-
**Project**: frontend-app
|
|
536
|
-
**Board**: ui-team <!-- 2-level structures only -->
|
|
537
|
-
**As a** content creator
|
|
538
|
-
**I want** to upload multiple thumbnail variants
|
|
539
|
-
**So that** I can visually evaluate my options
|
|
540
|
-
|
|
541
|
-
**Acceptance Criteria**:
|
|
542
|
-
- [ ] **AC-US1-01**: User can drag-and-drop up to 5 images
|
|
543
|
-
|
|
544
|
-
---
|
|
545
|
-
|
|
546
|
-
### US-002: CTR Prediction API (P1)
|
|
547
|
-
**Project**: backend-api
|
|
548
|
-
**Board**: ml-team <!-- 2-level structures only -->
|
|
549
|
-
**As a** frontend application
|
|
550
|
-
**I want** to call POST /predict-ctr endpoint
|
|
551
|
-
**So that** I can get AI-powered predictions
|
|
552
|
-
|
|
553
|
-
**Acceptance Criteria**:
|
|
554
|
-
- [ ] **AC-US2-01**: POST /predict-ctr accepts thumbnail image
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
**Benefits of per-US targeting:**
|
|
558
|
-
- Each US syncs to correct project/repo
|
|
559
|
-
- Single increment can span multiple projects
|
|
560
|
-
- Living docs auto-grouped by project
|
|
561
|
-
- External tools (GitHub/JIRA/ADO) receive issues in correct project
|
|
562
|
-
|
|
563
|
-
### Multi-Project User Story Format (with **Project**: per US)
|
|
564
|
-
|
|
565
|
-
**✅ CORRECT Format - Every US has `**Project**:`:**
|
|
566
|
-
```markdown
|
|
567
|
-
## User Stories
|
|
568
|
-
|
|
569
|
-
### US-001: Thumbnail Upload
|
|
570
|
-
**Project**: frontend-app # ← MANDATORY!
|
|
571
|
-
**As a** content creator
|
|
572
|
-
**I want** to upload thumbnails
|
|
573
|
-
**So that** I can test different versions
|
|
574
|
-
|
|
575
|
-
**Acceptance Criteria**:
|
|
576
|
-
- [ ] **AC-US1-01**: User can drag-and-drop images
|
|
577
|
-
- [ ] **AC-US1-02**: Images validated for YouTube specs
|
|
578
|
-
|
|
579
|
-
### US-002: Thumbnail Analysis API
|
|
580
|
-
**Project**: backend-api # ← MANDATORY! Different project = different folder
|
|
581
|
-
**As a** frontend application
|
|
582
|
-
**I want** to call POST /predict-ctr endpoint
|
|
583
|
-
**So that** I can get AI-powered predictions
|
|
584
|
-
|
|
585
|
-
**Acceptance Criteria**:
|
|
586
|
-
- [ ] **AC-US2-01**: POST /predict-ctr endpoint accepts thumbnail image
|
|
587
|
-
- [ ] **AC-US2-02**: ML model returns prediction score
|
|
588
|
-
```
|
|
589
|
-
|
|
590
|
-
### Project Classification Rules
|
|
591
|
-
|
|
592
|
-
When analyzing user descriptions, classify each user story by keywords:
|
|
593
|
-
|
|
594
|
-
| Keywords | Project | Prefix |
|
|
595
|
-
|----------|---------|--------|
|
|
596
|
-
| UI, component, page, form, view, drag-drop, theme, builder, menu display | Frontend | FE |
|
|
597
|
-
| API, endpoint, CRUD, webhook, analytics, database, service, ML model | Backend | BE |
|
|
598
|
-
| types, schemas, validators, utilities, localization, common | Shared | SHARED |
|
|
599
|
-
| iOS, Android, mobile app, push notification | Mobile | MOBILE |
|
|
600
|
-
| Terraform, K8s, Docker, CI/CD, deployment | Infrastructure | INFRA |
|
|
601
|
-
|
|
602
|
-
### AC-ID Format by Project
|
|
603
|
-
|
|
604
|
-
```
|
|
605
|
-
AC-{PROJECT}-US{story}-{number}
|
|
606
|
-
|
|
607
|
-
Examples:
|
|
608
|
-
- AC-FE-US1-01 (Frontend, User Story 1, AC #1)
|
|
609
|
-
- AC-BE-US1-01 (Backend, User Story 1, AC #1)
|
|
610
|
-
- AC-SHARED-US1-01 (Shared, User Story 1, AC #1)
|
|
611
|
-
- AC-MOBILE-US1-01 (Mobile, User Story 1, AC #1)
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
### tasks.md Must Reference Project-Scoped User Stories
|
|
615
|
-
|
|
616
|
-
```markdown
|
|
617
|
-
### T-001: Create Thumbnail Upload Component
|
|
618
|
-
**User Story**: US-FE-001 ← MUST reference project-scoped ID!
|
|
619
|
-
**Satisfies ACs**: AC-FE-US1-01, AC-FE-US1-02
|
|
72
|
+
**User Story**: US-001 | **Satisfies ACs**: AC-US1-01
|
|
620
73
|
**Status**: [ ] Not Started
|
|
621
|
-
|
|
622
|
-
### T-004: Database Schema & Migrations
|
|
623
|
-
**User Story**: US-BE-001, US-BE-002 ← Backend stories only!
|
|
624
|
-
**Satisfies ACs**: AC-BE-US1-01, AC-BE-US2-01
|
|
625
|
-
**Status**: [ ] Not Started
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
### Workflow Summary
|
|
629
|
-
|
|
74
|
+
**Test**: Given [X] → When [Y] → Then [Z]
|
|
630
75
|
```
|
|
631
|
-
1. DETECT multi-project mode (check config.json, folder structure)
|
|
632
|
-
↓
|
|
633
|
-
2. If multi-project → Group user stories by project (FE/BE/SHARED/MOBILE/INFRA)
|
|
634
|
-
↓
|
|
635
|
-
3. Generate prefixed user stories: US-FE-001, US-BE-001, US-SHARED-001
|
|
636
|
-
↓
|
|
637
|
-
4. Generate prefixed ACs: AC-FE-US1-01, AC-BE-US1-01
|
|
638
|
-
↓
|
|
639
|
-
5. Generate tasks referencing correct project user stories
|
|
640
|
-
↓
|
|
641
|
-
6. Each project folder gets its own filtered spec
|
|
642
|
-
```
|
|
643
|
-
|
|
644
|
-
### Why This Matters
|
|
645
76
|
|
|
646
|
-
|
|
647
|
-
- ❌ All issues created in ONE repo (wrong!)
|
|
648
|
-
- ❌ No clarity which team owns what
|
|
649
|
-
- ❌ Tasks reference wrong user stories
|
|
650
|
-
- ❌ GitHub sync broken across repos
|
|
651
|
-
|
|
652
|
-
With project-scoped stories:
|
|
653
|
-
- ✅ Each repo gets only its user stories
|
|
654
|
-
- ✅ Clear ownership per team/repo
|
|
655
|
-
- ✅ GitHub issues in correct repo
|
|
656
|
-
- ✅ Clean separation of concerns
|
|
657
|
-
|
|
658
|
-
---
|
|
659
|
-
|
|
660
|
-
## Related Skills
|
|
661
|
-
|
|
662
|
-
- **Planning workflow**: Guides increment planning (uses Spec Generator internally)
|
|
663
|
-
- **Context loading**: Loads relevant context for specification generation
|
|
664
|
-
- **Quality validation**: Validates generated specifications for completeness
|
|
665
|
-
- **multi-project-spec-mapper**: Splits specs into project-specific files
|
|
666
|
-
- **umbrella-repo-detector**: Detects multi-repo architecture
|
|
667
|
-
|
|
668
|
-
---
|
|
669
|
-
|
|
670
|
-
---
|
|
77
|
+
## Multi-Project User Story Generation
|
|
671
78
|
|
|
672
|
-
|
|
79
|
+
When multi-project mode detected (config `multiProject.enabled`, multiple `specs/` folders, or user mentions multiple repos):
|
|
673
80
|
|
|
81
|
+
- Group user stories by project (FE/BE/SHARED/MOBILE/INFRA)
|
|
82
|
+
- Use prefixed IDs: `US-FE-001`, `AC-FE-US1-01`
|
|
83
|
+
- Each US specifies `**Project**:` inline
|
|
84
|
+
- Tasks reference project-scoped story IDs
|
|
674
85
|
|
|
86
|
+
| Keywords | Project |
|
|
87
|
+
|----------|---------|
|
|
88
|
+
| UI, component, page, form, view | Frontend |
|
|
89
|
+
| API, endpoint, CRUD, webhook, service | Backend |
|
|
90
|
+
| types, schemas, validators, utilities | Shared |
|
|
91
|
+
| iOS, Android, mobile, push notification | Mobile |
|
|
92
|
+
| Terraform, K8s, Docker, CI/CD | Infrastructure |
|