specweave 1.0.256 → 1.0.259
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.md +56 -221
- package/README.md +31 -0
- package/bin/specweave.js +17 -0
- package/dist/src/adapters/README.md +4 -4
- package/dist/src/adapters/agents-md-generator.d.ts.map +1 -1
- package/dist/src/adapters/agents-md-generator.js +0 -2
- package/dist/src/adapters/agents-md-generator.js.map +1 -1
- package/dist/src/adapters/claude/README.md +3 -3
- package/dist/src/adapters/claude/adapter.js +3 -3
- package/dist/src/adapters/claude-md-generator.js +1 -1
- package/dist/src/adapters/claude-md-generator.js.map +1 -1
- package/dist/src/adapters/registry.yaml +1 -1
- package/dist/src/cli/commands/create-increment.d.ts +24 -0
- package/dist/src/cli/commands/create-increment.d.ts.map +1 -0
- package/dist/src/cli/commands/create-increment.js +53 -0
- package/dist/src/cli/commands/create-increment.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +48 -31
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/update.d.ts.map +1 -1
- package/dist/src/cli/commands/update.js +36 -0
- package/dist/src/cli/commands/update.js.map +1 -1
- package/dist/src/cli/helpers/init/directory-structure.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/directory-structure.js +13 -1
- package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
- package/dist/src/cli/helpers/init/summary-banner.d.ts +11 -0
- package/dist/src/cli/helpers/init/summary-banner.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/summary-banner.js +49 -3
- package/dist/src/cli/helpers/init/summary-banner.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +0 -1
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js +6 -2
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -1
- package/dist/src/core/ac-progress-sync.d.ts +13 -0
- package/dist/src/core/ac-progress-sync.d.ts.map +1 -1
- package/dist/src/core/ac-progress-sync.js +28 -0
- package/dist/src/core/ac-progress-sync.js.map +1 -1
- package/dist/src/core/config/types.d.ts +24 -1
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js +6 -1
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/doctor/checkers/project-structure-checker.d.ts +1 -0
- package/dist/src/core/doctor/checkers/project-structure-checker.d.ts.map +1 -1
- package/dist/src/core/doctor/checkers/project-structure-checker.js +53 -3
- package/dist/src/core/doctor/checkers/project-structure-checker.js.map +1 -1
- package/dist/src/core/fabric/security-scanner.d.ts.map +1 -1
- package/dist/src/core/fabric/security-scanner.js +70 -9
- package/dist/src/core/fabric/security-scanner.js.map +1 -1
- package/dist/src/core/increment/increment-utils.d.ts +6 -0
- package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
- package/dist/src/core/increment/increment-utils.js +5 -0
- package/dist/src/core/increment/increment-utils.js.map +1 -1
- package/dist/src/core/living-docs/discovery.d.ts +2 -0
- package/dist/src/core/living-docs/discovery.d.ts.map +1 -1
- package/dist/src/core/living-docs/discovery.js +91 -17
- package/dist/src/core/living-docs/discovery.js.map +1 -1
- package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts +5 -0
- package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts.map +1 -1
- package/dist/src/core/living-docs/intelligent-analyzer/index.js +3 -3
- package/dist/src/core/living-docs/intelligent-analyzer/index.js.map +1 -1
- package/dist/src/core/living-docs/lsp-bootstrapper.d.ts +64 -0
- package/dist/src/core/living-docs/lsp-bootstrapper.d.ts.map +1 -0
- package/dist/src/core/living-docs/lsp-bootstrapper.js +118 -0
- package/dist/src/core/living-docs/lsp-bootstrapper.js.map +1 -0
- package/dist/src/core/project/project-service.d.ts +10 -1
- package/dist/src/core/project/project-service.d.ts.map +1 -1
- package/dist/src/core/project/project-service.js +37 -2
- package/dist/src/core/project/project-service.js.map +1 -1
- package/dist/src/core/universal-auto-create.d.ts +64 -0
- package/dist/src/core/universal-auto-create.d.ts.map +1 -0
- package/dist/src/core/universal-auto-create.js +228 -0
- package/dist/src/core/universal-auto-create.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/PLUGIN.md +0 -3
- package/plugins/specweave/commands/living-docs.md +0 -2
- package/plugins/specweave/hooks/stop-sync.sh +34 -5
- package/plugins/specweave/hooks/user-prompt-submit.sh +115 -326
- package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +19 -5
- package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +14 -4
- package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +181 -0
- package/plugins/specweave/lib/hooks/sync-living-docs.js +4 -2
- package/plugins/specweave/scripts/skill-context.sh +160 -0
- package/plugins/specweave/skills/architect/SKILL.md +1 -1
- package/plugins/specweave/skills/archive-increments/SKILL.md +13 -3
- package/plugins/specweave/skills/auto/SKILL.md +92 -1038
- package/plugins/specweave/skills/do/SKILL.md +66 -1106
- package/plugins/specweave/skills/docs/SKILL.md +124 -56
- package/plugins/specweave/skills/done/SKILL.md +76 -1406
- package/plugins/specweave/skills/framework/SKILL.md +1 -1
- package/plugins/specweave/skills/increment/SKILL.md +1 -1
- package/plugins/specweave/skills/increment-planner/SKILL.md +29 -19
- package/plugins/specweave/skills/jobs/SKILL.md +52 -0
- package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +1 -1
- package/plugins/specweave/skills/save/SKILL.md +51 -1372
- package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +1 -1
- package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +1 -1
- package/plugins/specweave/skills/validate/SKILL.md +65 -848
- package/plugins/specweave-backend/skills/database-optimizer/SKILL.md +1 -1
- package/plugins/specweave-backend/skills/graphql/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/frontend-architect/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/frontend-design/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/i18n-expert/SKILL.md +1 -1
- package/plugins/specweave-payments/skills/billing-automation/SKILL.md +1 -1
- package/plugins/specweave-testing/skills/accessibility-testing/SKILL.md +1 -1
- package/src/templates/CLAUDE.md.template +50 -356
- package/src/templates/config.json.template +5 -1
- package/plugins/specweave/commands/brownfield-analyzer.md +0 -408
- package/plugins/specweave/commands/brownfield-onboarder.md +0 -837
- package/plugins/specweave/commands/export-skills.md +0 -179
|
@@ -14,1463 +14,133 @@ hooks:
|
|
|
14
14
|
|
|
15
15
|
!`s="done"; 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`
|
|
16
16
|
|
|
17
|
-
**
|
|
17
|
+
**PM-Led Closure**: Validate tasks, tests, and docs before closing.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
**Automatic GitHub issue reopening**: When validation fails. If PM gates fail and a GitHub issue exists for this increment, the system automatically reopens the issue with validation failure details. This ensures issues aren't prematurely closed when work is incomplete.
|
|
22
|
-
|
|
23
|
-
**EXPLICIT USER APPROVAL REQUIRED**: This command is the ONLY way to transition from `ready_for_review` → `completed`. This prevents the auto-completion bug where increments get marked "completed" without:
|
|
24
|
-
1. All ACs being checked in spec.md
|
|
25
|
-
2. User explicitly confirming the closure
|
|
19
|
+
**EXPLICIT USER APPROVAL REQUIRED**: Only way to transition `ready_for_review` -> `completed`. Prevents auto-completion without AC checks and user confirmation.
|
|
26
20
|
|
|
27
21
|
## Usage
|
|
28
22
|
|
|
29
|
-
```
|
|
23
|
+
```
|
|
30
24
|
/sw:done <increment-id>
|
|
31
25
|
```
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- `<increment-id>`: Required. Increment ID (e.g., "001", "0001", "1", "0042")
|
|
27
|
+
Argument: Required increment ID (e.g., "001", "0001", "0042", "0153-feature-name"). Numeric portion extracted and zero-padded to 4 digits.
|
|
36
28
|
|
|
37
29
|
---
|
|
38
30
|
|
|
39
31
|
## Workflow
|
|
40
32
|
|
|
41
|
-
### Step
|
|
42
|
-
|
|
43
|
-
**🎯 OPTIONAL BUT INFORMATIVE**: Check if closing a SpecWeave framework increment.
|
|
44
|
-
|
|
45
|
-
When closing increments in the SpecWeave repository itself, provide additional context about the impact:
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
import { detectSpecWeaveRepository } from './src/utils/repository-detector.js';
|
|
49
|
-
|
|
50
|
-
const repoInfo = detectSpecWeaveRepository(process.cwd());
|
|
51
|
-
|
|
52
|
-
if (repoInfo.isSpecWeaveRepo) {
|
|
53
|
-
console.log('ℹ️ Closing SpecWeave framework increment');
|
|
54
|
-
console.log('');
|
|
55
|
-
console.log(' 📋 Post-Closure Checklist:');
|
|
56
|
-
console.log(' • Update CHANGELOG.md if user-facing change');
|
|
57
|
-
console.log(' • Update CLAUDE.md if workflow changed');
|
|
58
|
-
console.log(' • Consider version bump (patch/minor/major)');
|
|
59
|
-
console.log(' • Run: npm test && npm run rebuild');
|
|
60
|
-
console.log(' • Check for breaking changes');
|
|
61
|
-
console.log('');
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**When to Show This**:
|
|
66
|
-
- Only when closing increments (not on validation failures)
|
|
67
|
-
- Skip if already shown recently in session
|
|
68
|
-
|
|
69
|
-
**Why This Helps**:
|
|
70
|
-
Contributors closing SpecWeave features need reminders about:
|
|
71
|
-
- Documentation updates (CHANGELOG, CLAUDE.md)
|
|
72
|
-
- Version implications
|
|
73
|
-
- Testing framework changes
|
|
74
|
-
- Breaking change considerations
|
|
75
|
-
|
|
76
|
-
**Note**: This is informational only, not blocking. The closure proceeds normally after showing reminders.
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
### Step 0.5: Inline Grill Review (MANDATORY)
|
|
81
|
-
|
|
82
|
-
**🔥 CRITICAL: Run code grill before closure!**
|
|
83
|
-
|
|
84
|
-
Before proceeding with PM validation, run `/sw:grill {incrementId}` inline:
|
|
85
|
-
|
|
86
|
-
1. Check config: `jq -r '.grill.required // true' .specweave/config.json` — if `false`, skip grill
|
|
87
|
-
2. Invoke `/sw:grill {incrementId}` (the full grill skill, not just a check)
|
|
88
|
-
3. If grill finds **BLOCKERs or CRITICALs** → **STOP closure**, show findings, ask user to fix
|
|
89
|
-
4. If grill passes (no blockers) → continue to Step 0.55
|
|
90
|
-
|
|
91
|
-
**No marker files needed** — grill runs fresh each time as part of `/sw:done`.
|
|
92
|
-
|
|
93
|
-
**To disable** (not recommended): Set `{ "grill": { "required": false } }` in `.specweave/config.json`
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
### Step 0.55: Judge LLM Validation (MANDATORY)
|
|
98
|
-
|
|
99
|
-
**Independent deep validation using Opus with extended thinking.**
|
|
100
|
-
|
|
101
|
-
After grill passes, run `/sw:judge-llm` for a second opinion with fresh context:
|
|
102
|
-
|
|
103
|
-
1. Invoke `/sw:judge-llm --last-commit` (or `--staged` if not yet committed)
|
|
104
|
-
- Alternatively: `Skill({ skill: "sw:judge-llm" })` with the changed files
|
|
105
|
-
2. Judge LLM uses **ultrathink extended thinking** via a separate Opus API call
|
|
106
|
-
3. Wait for verdict: **APPROVED**, **CONCERNS**, or **REJECTED**
|
|
107
|
-
|
|
108
|
-
**Verdict handling**:
|
|
109
|
-
- **APPROVED** → continue to Step 0.6
|
|
110
|
-
- **CONCERNS** → show findings to user, recommend fixes, but allow continuation
|
|
111
|
-
- **REJECTED** → **STOP closure**, show critical findings, ask user to fix before retrying
|
|
112
|
-
|
|
113
|
-
**Why both grill AND judge-llm**: Grill runs in-session (shares conversation context). Judge LLM makes a separate API call with fresh context, catching issues that in-session review may miss due to context saturation.
|
|
114
|
-
|
|
115
|
-
**If no ANTHROPIC_API_KEY**: Judge LLM falls back to basic pattern matching. This is informational only and does not block closure.
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
### Step 0.6: Status Validation
|
|
120
|
-
|
|
121
|
-
**🔥 CRITICAL: Only `ready_for_review` or `active` increments can be closed!**
|
|
122
|
-
|
|
123
|
-
1. **Check current status from metadata.json**:
|
|
124
|
-
- If status is `ready_for_review` → Proceed (all tasks already validated as complete)
|
|
125
|
-
- If status is `active` → Check if all tasks are done, then transition to `ready_for_review` first
|
|
126
|
-
- If status is `completed` → Already closed, warn user
|
|
127
|
-
- If status is `backlog`, `paused`, or `abandoned` → BLOCK with error
|
|
128
|
-
|
|
129
|
-
2. **Require explicit user confirmation**:
|
|
130
|
-
```
|
|
131
|
-
✅ Increment ready for closure:
|
|
132
|
-
• Status: ready_for_review
|
|
133
|
-
• All 4 tasks completed
|
|
134
|
-
• All 12 ACs checked in spec.md
|
|
135
|
-
|
|
136
|
-
⚠️ This will permanently mark the increment as COMPLETED.
|
|
137
|
-
|
|
138
|
-
Please confirm: Type "yes" to close this increment, or "no" to cancel.
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Why this matters**: Prevents the auto-completion bug from increment 0081 where
|
|
142
|
-
status was set to "completed" without ACs being checked or user approval.
|
|
143
|
-
|
|
144
|
-
### Step 1: Load Increment Context
|
|
145
|
-
|
|
146
|
-
1. **Find increment directory**:
|
|
147
|
-
- **Normalize increment ID**:
|
|
148
|
-
- If ID contains dash (e.g., "0153-feature-name"), extract numeric portion before first dash → "0153"
|
|
149
|
-
- Convert to 4-digit format (e.g., "1" → "0001", "153" → "0153")
|
|
150
|
-
- Both formats work: `/sw:done 0153` or `/sw:done 0153-feature-name`
|
|
151
|
-
- Find matching directory: `.specweave/increments/0001-*/` (matches by prefix)
|
|
152
|
-
- Verify increment exists and is `ready_for_review` or `active` (NOT already completed)
|
|
153
|
-
|
|
154
|
-
2. **Load all documents**:
|
|
155
|
-
- `spec.md` - Requirements and acceptance criteria
|
|
156
|
-
- `plan.md` - Architecture and implementation approach
|
|
157
|
-
- `tasks.md` - Implementation tasks
|
|
158
|
-
- `tests.md` - Test strategy
|
|
159
|
-
|
|
160
|
-
**Example output**:
|
|
161
|
-
```
|
|
162
|
-
📂 Loading increment 0001-user-authentication...
|
|
163
|
-
|
|
164
|
-
✅ Context loaded:
|
|
165
|
-
• spec.md (6 user stories, 15 requirements)
|
|
166
|
-
• plan.md (Architecture: JWT + PostgreSQL)
|
|
167
|
-
• tasks.md (42 tasks)
|
|
168
|
-
• tests.md (12 test cases)
|
|
169
|
-
|
|
170
|
-
🎯 Validating readiness for closure...
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Step 2: Automated Completion Validation (Gate 0)
|
|
174
|
-
|
|
175
|
-
**🔥 CRITICAL: Automated validation runs BEFORE PM validation to catch obvious issues!**
|
|
176
|
-
|
|
177
|
-
**BEFORE** invoking the PM agent, run automated validation using `IncrementCompletionValidator`:
|
|
178
|
-
|
|
179
|
-
```typescript
|
|
180
|
-
import { IncrementCompletionValidator } from '../../../src/core/increment/completion-validator.js';
|
|
181
|
-
import { DesyncDetector } from '../../../src/core/increment/desync-detector.js';
|
|
182
|
-
import { ACStatusManager } from '../../../src/core/increment/ac-status-manager.js';
|
|
183
|
-
|
|
184
|
-
// **NEW (2025-12-08)**: Sync ACs BEFORE validation to prevent race conditions
|
|
185
|
-
// The background hook (post-task-completion.sh) may not have completed yet
|
|
186
|
-
// This ensures spec.md ACs are up-to-date with tasks.md completion status
|
|
187
|
-
console.log('🔄 Syncing AC status before validation...');
|
|
188
|
-
const acManager = new ACStatusManager(projectRoot);
|
|
189
|
-
const acSyncResult = await acManager.syncACStatus(incrementId);
|
|
190
|
-
if (acSyncResult.synced && acSyncResult.updated.length > 0) {
|
|
191
|
-
console.log(`✅ Updated ${acSyncResult.updated.length} ACs: ${acSyncResult.updated.join(', ')}`);
|
|
192
|
-
} else {
|
|
193
|
-
console.log('✅ AC status already in sync');
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// **NEW (2025-11-20)**: Validate no status desync exists
|
|
197
|
-
// This prevents closing increments with inconsistent metadata.json and spec.md
|
|
198
|
-
const desyncDetector = new DesyncDetector();
|
|
199
|
-
try {
|
|
200
|
-
await desyncDetector.validateOrThrow(incrementId);
|
|
201
|
-
} catch (error) {
|
|
202
|
-
console.error('❌ CANNOT CLOSE INCREMENT - Status desync detected');
|
|
203
|
-
console.error('');
|
|
204
|
-
console.error(error.message);
|
|
205
|
-
console.error('');
|
|
206
|
-
process.exit(1);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Validate increment is ready for completion
|
|
210
|
-
const validation = await IncrementCompletionValidator.validateCompletion(incrementId);
|
|
211
|
-
|
|
212
|
-
if (!validation.isValid) {
|
|
213
|
-
// BLOCK completion and show errors
|
|
214
|
-
console.error('❌ CANNOT CLOSE INCREMENT - Automated validation failed');
|
|
215
|
-
console.error('');
|
|
216
|
-
validation.errors.forEach(err => console.error(` • ${err}`));
|
|
217
|
-
console.error('');
|
|
218
|
-
console.error('Fix these issues before running /sw:done again');
|
|
219
|
-
process.exit(1);
|
|
220
|
-
}
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
**Example validation output** (FAIL):
|
|
224
|
-
```
|
|
225
|
-
❌ CANNOT CLOSE INCREMENT - Automated validation failed
|
|
226
|
-
|
|
227
|
-
• 17 acceptance criteria still open
|
|
228
|
-
• 13 tasks still pending
|
|
229
|
-
• 4 ACs uncovered by tasks
|
|
230
|
-
• 2 orphan tasks detected
|
|
231
|
-
|
|
232
|
-
Fix these issues before running /sw:done again
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
**Example validation output** (PASS):
|
|
236
|
-
```
|
|
237
|
-
✅ Automated validation passed
|
|
238
|
-
• All acceptance criteria completed
|
|
239
|
-
• All tasks completed
|
|
240
|
-
• 100% AC coverage (29/29 ACs)
|
|
241
|
-
• 0 orphan tasks
|
|
242
|
-
|
|
243
|
-
Proceeding to PM validation...
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
**What Gate 0 validates**:
|
|
247
|
-
- [ ] All acceptance criteria are checked in **spec.md** (`- [x] **AC-...`)
|
|
248
|
-
- [ ] All tasks are completed in **tasks.md** (`**Status**: [x] completed`)
|
|
249
|
-
- [ ] Required files exist (`spec.md`, `tasks.md`)
|
|
250
|
-
- [ ] **NEW**: Tasks count in frontmatter matches checked tasks (source of truth validation)
|
|
251
|
-
- [ ] AC coverage validation (US-Task Linkage Architecture)
|
|
252
|
-
- [ ] All ACs covered by at least one task (0% uncovered)
|
|
253
|
-
- [ ] No orphan tasks (all tasks have **Satisfies ACs** field)
|
|
254
|
-
- [ ] All US linkage valid (**User Story** field references exist in spec.md)
|
|
255
|
-
|
|
256
|
-
**⚠️ SOURCE OF TRUTH ENFORCEMENT (CRITICAL)**:
|
|
257
|
-
|
|
258
|
-
Gate 0 now validates that `tasks.md` and `spec.md` are the ACTUAL source of truth, not internal TODO lists:
|
|
259
|
-
|
|
260
|
-
```typescript
|
|
261
|
-
// 1. Count completed tasks in tasks.md (ACTUAL source of truth)
|
|
262
|
-
const tasksInFile = await countCompletedTasks(tasksPath);
|
|
263
|
-
|
|
264
|
-
// 2. Compare with frontmatter
|
|
265
|
-
const { total_tasks } = readTasksFrontmatter(tasksPath);
|
|
266
|
-
|
|
267
|
-
// 3. BLOCK if mismatch
|
|
268
|
-
if (tasksInFile < total_tasks) {
|
|
269
|
-
throw new ValidationError(
|
|
270
|
-
`CRITICAL: Source of truth violation!\n` +
|
|
271
|
-
`tasks.md shows ${tasksInFile}/${total_tasks} tasks completed.\n` +
|
|
272
|
-
`Internal TODO lists are NOT the source of truth.\n` +
|
|
273
|
-
`You MUST update tasks.md checkboxes before closing.\n` +
|
|
274
|
-
`See CLAUDE.md Rule #7 for details.`
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
**This prevents**:
|
|
280
|
-
- ❌ Closing increments with `[ ] pending` tasks in tasks.md
|
|
281
|
-
- ❌ Relying on internal TODO lists instead of source files
|
|
282
|
-
- ❌ Marking work "done" without updating acceptance criteria
|
|
283
|
-
- ❌ The critical violation from increment 0044 (2025-11-19)
|
|
284
|
-
|
|
285
|
-
**AC COVERAGE VALIDATION**:
|
|
286
|
-
|
|
287
|
-
Gate 0 now validates AC coverage to ensure all Acceptance Criteria have implementing tasks:
|
|
288
|
-
|
|
289
|
-
```typescript
|
|
290
|
-
import { validateACCoverage } from '../../../src/validators/ac-coverage-validator.js';
|
|
291
|
-
|
|
292
|
-
// Validate AC coverage
|
|
293
|
-
const coverageReport = validateACCoverage(incrementPath, {
|
|
294
|
-
minCoveragePercentage: 100, // Require 100% coverage
|
|
295
|
-
allowOrphans: false, // Block if orphan tasks exist
|
|
296
|
-
logger: consoleLogger
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
// BLOCK if coverage fails
|
|
300
|
-
if (coverageReport.uncoveredACs.length > 0) {
|
|
301
|
-
throw new ValidationError(
|
|
302
|
-
`CRITICAL: AC Coverage validation failed!\n` +
|
|
303
|
-
`\n` +
|
|
304
|
-
`Uncovered Acceptance Criteria (${coverageReport.uncoveredACs.length}):\n` +
|
|
305
|
-
coverageReport.uncoveredACs.map(acId => ` • ${acId}`).join('\n') +
|
|
306
|
-
`\n\n` +
|
|
307
|
-
`All ACs MUST have at least one implementing task.\n` +
|
|
308
|
-
`Create tasks with **Satisfies ACs** field linking to these ACs.\n` +
|
|
309
|
-
`\n` +
|
|
310
|
-
`Run: /sw:validate ${incrementId} to see detailed coverage report.`
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (coverageReport.orphanTasks.length > 0) {
|
|
315
|
-
throw new ValidationError(
|
|
316
|
-
`CRITICAL: Orphan tasks detected!\n` +
|
|
317
|
-
`\n` +
|
|
318
|
-
`Tasks without AC linkage (${coverageReport.orphanTasks.length}):\n` +
|
|
319
|
-
coverageReport.orphanTasks.map(taskId => ` • ${taskId}`).join('\n') +
|
|
320
|
-
`\n\n` +
|
|
321
|
-
`All tasks MUST have **Satisfies ACs** field linking to acceptance criteria.\n` +
|
|
322
|
-
`Add AC references to these tasks.\n` +
|
|
323
|
-
`\n` +
|
|
324
|
-
`Run: /sw:validate ${incrementId} to see detailed validation report.`
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
**This ensures**:
|
|
330
|
-
- ✅ All ACs covered by at least one task (100% coverage required)
|
|
331
|
-
- ✅ No orphan tasks (all tasks link to valid ACs)
|
|
332
|
-
- ✅ Traceability maintained (AC → Task mapping complete)
|
|
333
|
-
- ✅ Living docs accuracy (sync depends on task-AC linkage)
|
|
334
|
-
|
|
335
|
-
**Why Gate 0 matters**:
|
|
336
|
-
- **Prevents false completion**: Can't mark increment "completed" with open work
|
|
337
|
-
- **Fast feedback**: Fails immediately (< 1s) vs waiting for PM agent (30s+)
|
|
338
|
-
- **Data integrity**: Ensures status matches reality (no spec.md desync)
|
|
339
|
-
- **Source of truth discipline**: Enforces tasks.md and spec.md as the ONLY source of truth
|
|
340
|
-
|
|
341
|
-
**CRITICAL**: Gate 0 is MANDATORY and CANNOT be bypassed. If validation fails, increment stays "in-progress" and command exits.
|
|
342
|
-
|
|
343
|
-
---
|
|
344
|
-
|
|
345
|
-
### Step 3: PM Validation (3 Gates)
|
|
346
|
-
|
|
347
|
-
**🔥 CRITICAL: PM agent MUST validate all 3 gates before allowing closure!**
|
|
348
|
-
|
|
349
|
-
**⛔ CRITICAL: PM Validation Report File Location**
|
|
350
|
-
|
|
351
|
-
When the PM agent writes the validation report, it MUST go in the `reports/` subfolder:
|
|
352
|
-
- ✅ **CORRECT**: `.specweave/increments/####-name/reports/PM-VALIDATION-REPORT.md`
|
|
353
|
-
- ❌ **WRONG**: `.specweave/increments/####-name/PM-VALIDATION-REPORT.md`
|
|
354
|
-
|
|
355
|
-
**Folder structure rules**:
|
|
356
|
-
- ONLY spec.md, plan.md, tasks.md allowed in increment root
|
|
357
|
-
- ALL reports MUST go in `reports/` subfolder
|
|
358
|
-
- ALL scripts MUST go in `scripts/` subfolder
|
|
359
|
-
- ALL logs MUST go in `logs/` subfolder
|
|
360
|
-
|
|
361
|
-
Invoke PM agent with validation task:
|
|
362
|
-
|
|
363
|
-
```
|
|
364
|
-
PM Agent: Please validate if increment 0001 is ready to close.
|
|
365
|
-
|
|
366
|
-
Check these 3 gates:
|
|
367
|
-
1. ✅ All tasks completed (especially P1 priority)
|
|
368
|
-
2. ✅ Tests passing (unit, integration, E2E if applicable)
|
|
369
|
-
3. ✅ Documentation updated (CLAUDE.md, README.md reflect new features)
|
|
370
|
-
|
|
371
|
-
Provide detailed feedback for each gate.
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
#### Gate 1: Tasks Completed ✅
|
|
375
|
-
|
|
376
|
-
**PM checks**:
|
|
377
|
-
- [ ] All P1 (critical) tasks completed
|
|
378
|
-
- [ ] All P2 (important) tasks completed OR deferred with reason
|
|
379
|
-
- [ ] P3 (nice-to-have) tasks completed, deferred, or moved to backlog
|
|
380
|
-
- [ ] No tasks in "blocked" state
|
|
381
|
-
- [ ] Acceptance criteria for each task met
|
|
382
|
-
|
|
383
|
-
**Example check**:
|
|
384
|
-
```
|
|
385
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
386
|
-
GATE 1: Tasks Completion
|
|
387
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
388
|
-
|
|
389
|
-
Checking tasks.md...
|
|
390
|
-
|
|
391
|
-
Priority P1 (Critical): 12 tasks
|
|
392
|
-
✅ 12/12 completed (100%)
|
|
393
|
-
|
|
394
|
-
Priority P2 (Important): 18 tasks
|
|
395
|
-
✅ 16/18 completed (89%)
|
|
396
|
-
⚠️ 2 deferred to next increment (with reason)
|
|
397
|
-
|
|
398
|
-
Priority P3 (Nice-to-have): 12 tasks
|
|
399
|
-
✅ 8/12 completed (67%)
|
|
400
|
-
📋 4 moved to backlog (acceptable)
|
|
401
|
-
|
|
402
|
-
Status: ✅ PASS
|
|
403
|
-
• All critical tasks completed
|
|
404
|
-
• P2 deferrals documented with valid reasons
|
|
405
|
-
• P3 tasks appropriately triaged
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
**If tasks incomplete**:
|
|
409
|
-
```
|
|
410
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
411
|
-
GATE 1: Tasks Completion
|
|
412
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
413
|
-
|
|
414
|
-
❌ FAIL - Incomplete tasks found
|
|
415
|
-
|
|
416
|
-
Priority P1 (Critical): 12 tasks
|
|
417
|
-
⚠️ 10/12 completed (83%)
|
|
418
|
-
❌ 2 tasks INCOMPLETE:
|
|
419
|
-
- T005: Add password hashing (CRITICAL - security requirement)
|
|
420
|
-
- T008: Implement JWT validation (CRITICAL - authentication won't work)
|
|
421
|
-
|
|
422
|
-
Recommendation: ❌ CANNOT close increment
|
|
423
|
-
• Complete T005 and T008 (security critical)
|
|
424
|
-
• These are core authentication features from spec.md
|
|
425
|
-
• Estimated effort: 4-6 hours
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
#### Gate 2a: E2E Test Execution (AUTOMATED - BLOCKING)
|
|
429
|
-
|
|
430
|
-
**Before PM subjective review, automatically detect and run E2E tests.**
|
|
431
|
-
|
|
432
|
-
**Step 1: Detect E2E test frameworks**
|
|
433
|
-
|
|
434
|
-
Scan the project for E2E test configurations:
|
|
435
|
-
|
|
436
|
-
```bash
|
|
437
|
-
# Detect E2E test frameworks
|
|
438
|
-
E2E_DETECTED=false
|
|
439
|
-
E2E_FRAMEWORK=""
|
|
440
|
-
E2E_DIRS=()
|
|
441
|
-
|
|
442
|
-
# Check current project
|
|
443
|
-
if [ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]; then
|
|
444
|
-
E2E_DETECTED=true; E2E_FRAMEWORK="playwright"
|
|
445
|
-
elif [ -f "cypress.config.ts" ] || [ -f "cypress.config.js" ]; then
|
|
446
|
-
E2E_DETECTED=true; E2E_FRAMEWORK="cypress"
|
|
447
|
-
fi
|
|
448
|
-
|
|
449
|
-
# Multi-repo: scan repositories/ for ALL E2E projects (collect all, not just last)
|
|
450
|
-
if [ -d "repositories" ]; then
|
|
451
|
-
for e2e_dir in repositories/*/*-e2e repositories/*/e2e; do
|
|
452
|
-
if [ -d "$e2e_dir" ]; then
|
|
453
|
-
E2E_DETECTED=true
|
|
454
|
-
E2E_DIRS+=("$e2e_dir")
|
|
455
|
-
fi
|
|
456
|
-
done
|
|
457
|
-
fi
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
**Step 2: Run E2E tests (BLOCKING - E2E test failure blocks closure)**
|
|
461
|
-
|
|
462
|
-
```bash
|
|
463
|
-
if [ "$E2E_DETECTED" = "true" ]; then
|
|
464
|
-
case "$E2E_FRAMEWORK" in
|
|
465
|
-
playwright) npx playwright test --reporter=list ;;
|
|
466
|
-
cypress) npx cypress run --reporter spec ;;
|
|
467
|
-
esac
|
|
468
|
-
|
|
469
|
-
# Multi-repo: run E2E tests in each collected directory
|
|
470
|
-
for dir in "${E2E_DIRS[@]}"; do
|
|
471
|
-
echo "Running E2E tests in $dir..."
|
|
472
|
-
(cd "$dir" && npm test)
|
|
473
|
-
# If E2E tests fail → BLOCK closure
|
|
474
|
-
done
|
|
475
|
-
fi
|
|
476
|
-
# If E2E tests fail → "CANNOT CLOSE INCREMENT - E2E tests failing. Fix failures before /sw:done."
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
**E2E test passing is a BLOCKING requirement for closure.** If E2E tests are detected and they fail, the increment CANNOT be closed. This is an automated gate, not a subjective PM check. If no E2E tests are detected, this gate is skipped.
|
|
480
|
-
|
|
481
|
-
#### Gate 2: Tests Passing ✅
|
|
482
|
-
|
|
483
|
-
**PM checks**:
|
|
484
|
-
- [ ] All test suites passing (no failures)
|
|
485
|
-
- [ ] Test coverage meets requirements (>80% for critical paths)
|
|
486
|
-
- [ ] E2E tests passing (if UI exists)
|
|
487
|
-
- [ ] No skipped tests without documentation
|
|
488
|
-
- [ ] Test cases align with acceptance criteria in spec.md
|
|
489
|
-
|
|
490
|
-
**Example check**:
|
|
491
|
-
```
|
|
492
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
493
|
-
GATE 2: Tests Passing
|
|
494
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
495
|
-
|
|
496
|
-
Running test suite...
|
|
497
|
-
|
|
498
|
-
Unit Tests:
|
|
499
|
-
✅ 47/47 passing
|
|
500
|
-
✅ Coverage: 89% (above 80% target)
|
|
501
|
-
|
|
502
|
-
Integration Tests:
|
|
503
|
-
✅ 15/15 passing
|
|
504
|
-
✅ All API endpoints tested
|
|
505
|
-
|
|
506
|
-
E2E Tests:
|
|
507
|
-
✅ 8/8 passing
|
|
508
|
-
✅ Login flow verified
|
|
509
|
-
✅ Password reset flow verified
|
|
510
|
-
|
|
511
|
-
Test Coverage by Component:
|
|
512
|
-
• User model: 95%
|
|
513
|
-
• Auth service: 92%
|
|
514
|
-
• JWT middleware: 88%
|
|
515
|
-
• Password util: 90%
|
|
516
|
-
|
|
517
|
-
Status: ✅ PASS
|
|
518
|
-
• All tests passing
|
|
519
|
-
• Coverage exceeds target
|
|
520
|
-
• E2E tests validate user stories
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
**If tests failing**:
|
|
524
|
-
```
|
|
525
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
526
|
-
GATE 2: Tests Passing
|
|
527
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
528
|
-
|
|
529
|
-
❌ FAIL - Tests failing
|
|
530
|
-
|
|
531
|
-
Unit Tests:
|
|
532
|
-
⚠️ 45/47 passing (96%)
|
|
533
|
-
❌ 2 FAILURES:
|
|
534
|
-
- test/auth/jwt.test.ts: Token expiry validation
|
|
535
|
-
Expected 24h, got 1h
|
|
536
|
-
- test/auth/password.test.ts: Weak password rejection
|
|
537
|
-
Allowed weak password "password123"
|
|
538
|
-
|
|
539
|
-
Integration Tests:
|
|
540
|
-
✅ 15/15 passing
|
|
541
|
-
|
|
542
|
-
E2E Tests:
|
|
543
|
-
❌ 7/8 passing (88%)
|
|
544
|
-
❌ 1 FAILURE:
|
|
545
|
-
- test/e2e/login.spec.ts: Rate limiting test
|
|
546
|
-
Expected 429 after 5 attempts, got 200
|
|
547
|
-
|
|
548
|
-
Recommendation: ❌ CANNOT close increment
|
|
549
|
-
• Fix JWT expiry configuration (security issue)
|
|
550
|
-
• Strengthen password validation (spec.md requirement)
|
|
551
|
-
• Fix rate limiting (prevents brute force attacks)
|
|
552
|
-
• Estimated effort: 2-3 hours
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
#### Gate 3: Documentation Updated ✅
|
|
556
|
-
|
|
557
|
-
**PM checks**:
|
|
558
|
-
- [ ] CLAUDE.md updated with new features
|
|
559
|
-
- [ ] README.md updated with usage examples
|
|
560
|
-
- [ ] CHANGELOG.md updated (if public API changed)
|
|
561
|
-
- [ ] API documentation regenerated (if applicable)
|
|
562
|
-
- [ ] Inline code documentation complete
|
|
563
|
-
- [ ] No stale references to old code
|
|
564
|
-
|
|
565
|
-
**Example check**:
|
|
566
|
-
```
|
|
567
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
568
|
-
GATE 3: Documentation Updated
|
|
569
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
570
|
-
|
|
571
|
-
Checking documentation updates...
|
|
572
|
-
|
|
573
|
-
CLAUDE.md:
|
|
574
|
-
✅ Added authentication section
|
|
575
|
-
✅ Added User model to schema reference
|
|
576
|
-
✅ Updated slash commands table
|
|
577
|
-
✅ No stale references found
|
|
578
|
-
|
|
579
|
-
README.md:
|
|
580
|
-
✅ Added authentication quick start example
|
|
581
|
-
✅ Updated API documentation link
|
|
582
|
-
✅ Added database setup instructions
|
|
583
|
-
|
|
584
|
-
CHANGELOG.md:
|
|
585
|
-
✅ Added v0.1.7 entry
|
|
586
|
-
✅ Listed new authentication features
|
|
587
|
-
✅ Migration guide included
|
|
588
|
-
|
|
589
|
-
Inline Documentation:
|
|
590
|
-
✅ All public functions documented (JSDoc)
|
|
591
|
-
✅ API routes have descriptions
|
|
592
|
-
✅ Complex logic explained with comments
|
|
593
|
-
|
|
594
|
-
Status: ✅ PASS
|
|
595
|
-
• All documentation current
|
|
596
|
-
• Examples tested and working
|
|
597
|
-
• No doc/code drift detected
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
**If docs outdated**:
|
|
601
|
-
```
|
|
602
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
603
|
-
GATE 3: Documentation Updated
|
|
604
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
605
|
-
|
|
606
|
-
❌ FAIL - Documentation outdated
|
|
607
|
-
|
|
608
|
-
CLAUDE.md:
|
|
609
|
-
⚠️ Partially updated
|
|
610
|
-
❌ Missing authentication section in quick reference
|
|
611
|
-
❌ Slash commands table doesn't mention /login
|
|
612
|
-
|
|
613
|
-
README.md:
|
|
614
|
-
❌ Not updated
|
|
615
|
-
❌ No authentication examples
|
|
616
|
-
❌ Setup instructions don't mention database migrations
|
|
617
|
-
|
|
618
|
-
CHANGELOG.md:
|
|
619
|
-
❌ Not updated
|
|
620
|
-
❌ v0.1.7 entry missing
|
|
621
|
-
|
|
622
|
-
Inline Documentation:
|
|
623
|
-
⚠️ 80% complete
|
|
624
|
-
❌ JWT middleware missing JSDoc comments
|
|
625
|
-
❌ Password util functions undocumented
|
|
626
|
-
|
|
627
|
-
Recommendation: ❌ CANNOT close increment
|
|
628
|
-
• Update CLAUDE.md with authentication section
|
|
629
|
-
• Add authentication examples to README.md
|
|
630
|
-
• Create CHANGELOG.md entry for v0.1.7
|
|
631
|
-
• Document JWT and password utilities
|
|
632
|
-
• Estimated effort: 1-2 hours
|
|
633
|
-
```
|
|
634
|
-
|
|
635
|
-
### Step 4: PM Decision
|
|
636
|
-
|
|
637
|
-
**Based on 3-gate validation**:
|
|
638
|
-
|
|
639
|
-
#### Scenario A: All Gates Pass ✅
|
|
640
|
-
|
|
641
|
-
```
|
|
642
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
643
|
-
PM VALIDATION RESULT: ✅ READY TO CLOSE
|
|
644
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
645
|
-
|
|
646
|
-
✅ Gate 1: Tasks Completed (100% P1, 89% P2)
|
|
647
|
-
✅ Gate 2: Tests Passing (70/70, 89% coverage)
|
|
648
|
-
✅ Gate 3: Documentation Updated (all current)
|
|
649
|
-
|
|
650
|
-
Increment Summary:
|
|
651
|
-
• Started: 2025-10-14
|
|
652
|
-
• Duration: 14 days (vs 21 days estimated)
|
|
653
|
-
• Velocity: +50% faster than planned
|
|
654
|
-
• Quality: Excellent
|
|
655
|
-
|
|
656
|
-
Business Value Delivered:
|
|
657
|
-
• Users can register and log in
|
|
658
|
-
• JWT authentication secure and tested
|
|
659
|
-
• Password security meets OWASP standards
|
|
660
|
-
• Rate limiting prevents brute force attacks
|
|
661
|
-
|
|
662
|
-
PM Approval: ✅ APPROVED for closure
|
|
663
|
-
|
|
664
|
-
**🔐 CRITICAL: Create marker file before status change**
|
|
665
|
-
Before updating metadata.json to "completed" status, you MUST create the marker file:
|
|
666
|
-
```bash
|
|
667
|
-
mkdir -p .specweave/state && touch .specweave/state/.sw-done-in-progress
|
|
668
|
-
```
|
|
669
|
-
This marker allows the status-completion-guard hook to permit the change.
|
|
670
|
-
After closure is complete, remove the marker file.
|
|
671
|
-
|
|
672
|
-
Closing increment 0001-user-authentication...
|
|
673
|
-
✓ Created marker file (.sw-done-in-progress)
|
|
674
|
-
✓ Updated status: in-progress → completed
|
|
675
|
-
✓ Removed marker file
|
|
676
|
-
✓ Set completion date: 2025-10-28
|
|
677
|
-
✓ Generated completion report
|
|
678
|
-
✓ Updated backlog (4 P3 tasks moved)
|
|
679
|
-
|
|
680
|
-
🎉 Increment 0001 closed successfully!
|
|
681
|
-
```
|
|
682
|
-
|
|
683
|
-
### Step 5: Post-Closure Sync (AUTOMATIC)
|
|
684
|
-
|
|
685
|
-
**CRITICAL**: After increment closes, the following syncs happen AUTOMATICALLY via the `post-increment-completion.sh` hook:
|
|
686
|
-
|
|
687
|
-
#### 0) Sync spec.md Status (ALWAYS)
|
|
688
|
-
|
|
689
|
-
**MANDATORY**: Ensures spec.md frontmatter status matches metadata.json.
|
|
690
|
-
|
|
691
|
-
```
|
|
692
|
-
🔄 Syncing spec.md status to 'completed'...
|
|
693
|
-
✅ spec.md status updated: active → completed
|
|
694
|
-
✅ Status line cache updated
|
|
695
|
-
```
|
|
696
|
-
|
|
697
|
-
**Why this matters**:
|
|
698
|
-
- Prevents desyncs between metadata.json and spec.md
|
|
699
|
-
- Ensures status line shows correct increment count
|
|
700
|
-
- Maintains source-of-truth discipline
|
|
701
|
-
- No need to manually run `/sw:sync-status`
|
|
702
|
-
|
|
703
|
-
**What gets synced**:
|
|
704
|
-
1. spec.md YAML frontmatter `status` field → `completed`
|
|
705
|
-
2. Status line cache updated via `lib/update-status-line.sh`
|
|
706
|
-
|
|
707
|
-
**If you still see desync after closure**:
|
|
708
|
-
```bash
|
|
709
|
-
# Manual fix (should rarely be needed)
|
|
710
|
-
/sw:sync-status --fix
|
|
711
|
-
```
|
|
712
|
-
|
|
713
|
-
**CRITICAL**: After increment closes, automatically perform these syncs:
|
|
714
|
-
|
|
715
|
-
#### A) Sync Living Docs to GitHub Project
|
|
716
|
-
|
|
717
|
-
**Check configuration** (`.specweave/config.json`):
|
|
718
|
-
```typescript
|
|
719
|
-
// Check if GitHub sync is enabled
|
|
720
|
-
const syncEnabled = config.hooks?.post_increment_done?.sync_to_github_project === true;
|
|
721
|
-
```
|
|
722
|
-
|
|
723
|
-
**If enabled**:
|
|
724
|
-
1. **Find living docs spec**:
|
|
725
|
-
- Look for `.specweave/docs/internal/specs/spec-{id}*.md`
|
|
726
|
-
- Pattern 1: `spec-0001-user-authentication.md` (4-digit)
|
|
727
|
-
- Pattern 2: `spec-001-user-authentication.md` (3-digit)
|
|
728
|
-
- Check increment `spec.md` for reference
|
|
729
|
-
|
|
730
|
-
2. **Sync to GitHub Project**:
|
|
731
|
-
```bash
|
|
732
|
-
/sw-github:sync-spec <spec-file>
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
3. **Report result**:
|
|
736
|
-
```
|
|
737
|
-
🔗 Post-Closure Sync:
|
|
738
|
-
✓ Found living docs: spec-0001-user-authentication.md
|
|
739
|
-
✓ Syncing to GitHub Project...
|
|
740
|
-
✓ GitHub Project updated successfully
|
|
741
|
-
```
|
|
742
|
-
|
|
743
|
-
**If spec not found**:
|
|
744
|
-
```
|
|
745
|
-
ℹ️ No living docs spec found (OK for bug/hotfix increments)
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
**If sync disabled**:
|
|
749
|
-
```
|
|
750
|
-
ℹ️ GitHub Project sync disabled in config
|
|
751
|
-
```
|
|
752
|
-
|
|
753
|
-
#### B) Close GitHub Issue (if exists)
|
|
754
|
-
|
|
755
|
-
**Check metadata** (`.specweave/increments/0001/.metadata.json`):
|
|
756
|
-
```json
|
|
757
|
-
{
|
|
758
|
-
"github": {
|
|
759
|
-
"issue": 42,
|
|
760
|
-
"url": "https://github.com/org/repo/issues/42"
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
**If issue exists AND config.hooks.post_increment_done.close_github_issue = true**:
|
|
766
|
-
1. **Close issue via gh CLI**:
|
|
767
|
-
```bash
|
|
768
|
-
gh issue close 42 --comment "✅ Increment 0001 completed and closed
|
|
769
|
-
|
|
770
|
-
All PM gates passed:
|
|
771
|
-
✅ Gate 1: Tasks completed
|
|
772
|
-
✅ Gate 2: Tests passing
|
|
773
|
-
✅ Gate 3: Documentation updated
|
|
774
|
-
|
|
775
|
-
Duration: 14 days
|
|
776
|
-
Velocity: +50% faster than planned"
|
|
777
|
-
```
|
|
778
|
-
|
|
779
|
-
2. **Report result**:
|
|
780
|
-
```
|
|
781
|
-
🐙 GitHub Issue:
|
|
782
|
-
✓ Closed issue #42
|
|
783
|
-
✓ Added completion summary
|
|
784
|
-
```
|
|
785
|
-
|
|
786
|
-
**If no issue**:
|
|
787
|
-
```
|
|
788
|
-
ℹ️ No GitHub issue linked to this increment
|
|
789
|
-
```
|
|
790
|
-
|
|
791
|
-
#### B.2) Auto-Close External-Origin GitHub Issue
|
|
792
|
-
|
|
793
|
-
**For increments with E-suffix (external origin), auto-close the source issue:**
|
|
794
|
-
|
|
795
|
-
**This is different from section B** which handles issues created BY SpecWeave. Section B.2 handles issues that SpecWeave increments were CREATED FROM (imported from GitHub).
|
|
796
|
-
|
|
797
|
-
**Check metadata** (`.specweave/increments/0118E-name/metadata.json`):
|
|
798
|
-
```json
|
|
799
|
-
{
|
|
800
|
-
"origin": "external",
|
|
801
|
-
"external_ref": "github#anton-abyzov/specweave#786"
|
|
802
|
-
}
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
**If external_ref exists AND starts with "github#"**:
|
|
806
|
-
|
|
807
|
-
1. **Parse the external_ref format**:
|
|
808
|
-
```typescript
|
|
809
|
-
const externalRef = metadata.external_ref;
|
|
810
|
-
|
|
811
|
-
if (externalRef && externalRef.startsWith('github#')) {
|
|
812
|
-
// Parse: github#owner/repo#issue_number
|
|
813
|
-
const match = externalRef.match(/^github#([^#]+)#(\d+)$/);
|
|
814
|
-
if (match) {
|
|
815
|
-
const [, ownerRepo, issueNumber] = match;
|
|
816
|
-
// ownerRepo = "anton-abyzov/specweave"
|
|
817
|
-
// issueNumber = "786"
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
```
|
|
821
|
-
|
|
822
|
-
2. **Check canUpdateStatus permission**:
|
|
823
|
-
```typescript
|
|
824
|
-
const configPath = path.join(projectRoot, '.specweave/config.json');
|
|
825
|
-
const config = await readJson(configPath);
|
|
826
|
-
|
|
827
|
-
if (!config.sync?.settings?.canUpdateStatus) {
|
|
828
|
-
console.log('⚠️ Skipping external issue closure - canUpdateStatus is disabled');
|
|
829
|
-
console.log('💡 Enable in .specweave/config.json: sync.settings.canUpdateStatus: true');
|
|
830
|
-
return;
|
|
831
|
-
}
|
|
832
|
-
```
|
|
833
|
-
|
|
834
|
-
3. **Close issue via gh CLI with completion summary**:
|
|
835
|
-
```bash
|
|
836
|
-
gh issue close 786 -R anton-abyzov/specweave --comment "$(cat <<'EOF'
|
|
837
|
-
✅ **Fixed in SpecWeave increment 0118E**
|
|
838
|
-
|
|
839
|
-
## PM Validation Passed
|
|
840
|
-
- ✅ Gate 1: All tasks completed
|
|
841
|
-
- ✅ Gate 2: Tests passing
|
|
842
|
-
- ✅ Gate 3: Documentation updated
|
|
843
|
-
|
|
844
|
-
## Deliverables
|
|
845
|
-
[Summary of key deliverables from increment]
|
|
846
|
-
|
|
847
|
-
## Duration
|
|
848
|
-
Started: 2025-12-07
|
|
849
|
-
Completed: 2025-12-07
|
|
850
|
-
Duration: 1 day
|
|
851
|
-
|
|
852
|
-
🔗 Closed automatically by `/sw:done`
|
|
853
|
-
EOF
|
|
854
|
-
)"
|
|
855
|
-
```
|
|
856
|
-
|
|
857
|
-
4. **Handle errors gracefully**:
|
|
858
|
-
- If `gh` CLI not installed: `⚠️ GitHub CLI not installed. Install: brew install gh`
|
|
859
|
-
- If `gh` not authenticated: `⚠️ GitHub auth failed. Run: gh auth login`
|
|
860
|
-
- If issue already closed: `ℹ️ Issue #786 already closed`
|
|
861
|
-
- If rate limited: `⚠️ GitHub rate limit. Retry later or close manually: gh issue close 786`
|
|
862
|
-
|
|
863
|
-
**Expected output (success)**:
|
|
864
|
-
```
|
|
865
|
-
🐙 External Issue Closure:
|
|
866
|
-
✓ Detected external_ref: github#anton-abyzov/specweave#786
|
|
867
|
-
✓ Permission check passed (canUpdateStatus: true)
|
|
868
|
-
✓ Closing GitHub issue #786...
|
|
869
|
-
✓ Issue #786 closed with completion summary
|
|
870
|
-
```
|
|
871
|
-
|
|
872
|
-
**Expected output (permission denied)**:
|
|
873
|
-
```
|
|
874
|
-
🐙 External Issue Closure:
|
|
875
|
-
✓ Detected external_ref: github#anton-abyzov/specweave#786
|
|
876
|
-
⚠️ Skipping - canUpdateStatus is disabled in config
|
|
877
|
-
💡 Enable in .specweave/config.json to auto-close external issues
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
**Expected output (no external ref)**:
|
|
881
|
-
```
|
|
882
|
-
ℹ️ No external_ref in metadata (not an external-origin increment)
|
|
883
|
-
```
|
|
884
|
-
|
|
885
|
-
**IMPORTANT**: This section runs ONLY for external-origin increments (E-suffix). Regular increments (without E-suffix) skip this section entirely.
|
|
886
|
-
|
|
887
|
-
#### C) Sync Status to External Tools
|
|
888
|
-
|
|
889
|
-
**CRITICAL**: After increment completes, automatically sync status to all linked external tools (GitHub, JIRA, Azure DevOps).
|
|
890
|
-
|
|
891
|
-
**Check metadata** (`.specweave/increments/0001/.metadata.json`):
|
|
892
|
-
```json
|
|
893
|
-
{
|
|
894
|
-
"github": {
|
|
895
|
-
"issue": 42,
|
|
896
|
-
"url": "https://github.com/org/repo/issues/42"
|
|
897
|
-
},
|
|
898
|
-
"jira": {
|
|
899
|
-
"issue": "PROJ-123",
|
|
900
|
-
"url": "https://company.atlassian.net/browse/PROJ-123"
|
|
901
|
-
},
|
|
902
|
-
"ado": {
|
|
903
|
-
"workItem": 456,
|
|
904
|
-
"url": "https://dev.azure.com/org/project/_workitems/edit/456"
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
```
|
|
908
|
-
|
|
909
|
-
**Check configuration** (`.specweave/config.json`):
|
|
910
|
-
```json
|
|
911
|
-
{
|
|
912
|
-
"sync": {
|
|
913
|
-
"statusSync": {
|
|
914
|
-
"enabled": true,
|
|
915
|
-
"autoSync": true,
|
|
916
|
-
"promptUser": true,
|
|
917
|
-
"conflictResolution": "last-write-wins",
|
|
918
|
-
"mappings": {
|
|
919
|
-
"github": {
|
|
920
|
-
"completed": "closed"
|
|
921
|
-
},
|
|
922
|
-
"jira": {
|
|
923
|
-
"completed": "Done"
|
|
924
|
-
},
|
|
925
|
-
"ado": {
|
|
926
|
-
"completed": "Closed"
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
```
|
|
933
|
-
|
|
934
|
-
**If status sync enabled AND external links exist**:
|
|
935
|
-
|
|
936
|
-
Uses provider-agnostic AC sync to post final progress to all enabled providers:
|
|
937
|
-
|
|
938
|
-
```typescript
|
|
939
|
-
import { syncACProgressToProviders } from '../../../src/core/ac-progress-sync.js';
|
|
940
|
-
|
|
941
|
-
// Builds config from .specweave/config.json + metadata.json externalLinks
|
|
942
|
-
// Syncs to ALL enabled providers (GitHub, JIRA, ADO) in a single call
|
|
943
|
-
const result = await syncACProgressToProviders(
|
|
944
|
-
incrementId, affectedUSIds, specPath, config,
|
|
945
|
-
);
|
|
946
|
-
|
|
947
|
-
// result.github — posted comments, auto-closed issues
|
|
948
|
-
// result.jira — posted comments, transitioned to Done
|
|
949
|
-
// result.ado — posted comments, transitioned to Closed
|
|
950
|
-
```
|
|
951
|
-
|
|
952
|
-
**Report results**:
|
|
953
|
-
```
|
|
954
|
-
🔄 Status Sync:
|
|
955
|
-
✓ GitHub issue #42: active → closed (with comment)
|
|
956
|
-
✓ JIRA issue PROJ-123: In Progress → Done (with comment)
|
|
957
|
-
✓ ADO work item #456: Active → Closed (with comment)
|
|
958
|
-
```
|
|
959
|
-
|
|
960
|
-
**If status sync disabled**:
|
|
961
|
-
```
|
|
962
|
-
ℹ️ Status sync disabled in config (enable in .specweave/config.json)
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
**If no external links**:
|
|
966
|
-
```
|
|
967
|
-
ℹ️ No external tools linked to this increment
|
|
968
|
-
```
|
|
969
|
-
|
|
970
|
-
**If user declines sync**:
|
|
971
|
-
```
|
|
972
|
-
ℹ️ Status sync skipped (user choice)
|
|
973
|
-
```
|
|
974
|
-
|
|
975
|
-
**Conflict Resolution** (if remote status differs):
|
|
976
|
-
- Uses configured strategy (default: `last-write-wins`)
|
|
977
|
-
- Compares timestamps to determine which status to use
|
|
978
|
-
- Favors local (SpecWeave) status on timestamp tie
|
|
979
|
-
- Reports conflict and resolution in output:
|
|
980
|
-
```
|
|
981
|
-
⚠️ Conflict detected:
|
|
982
|
-
Local: completed (2025-11-12 15:00:00)
|
|
983
|
-
Remote: active (2025-11-12 14:30:00)
|
|
984
|
-
Resolution: Use local (last-write-wins)
|
|
985
|
-
Action: Syncing to external
|
|
986
|
-
```
|
|
987
|
-
|
|
988
|
-
**Example Full Output**:
|
|
989
|
-
```
|
|
990
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
991
|
-
🎉 INCREMENT CLOSED SUCCESSFULLY
|
|
992
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
993
|
-
|
|
994
|
-
Increment: 0001-user-authentication
|
|
995
|
-
Status: completed
|
|
996
|
-
Duration: 14 days (vs 21 estimated)
|
|
997
|
-
Velocity: +50% faster
|
|
998
|
-
|
|
999
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1000
|
-
🔗 POST-CLOSURE SYNC
|
|
1001
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1002
|
-
|
|
1003
|
-
GitHub Project:
|
|
1004
|
-
✓ Found living docs: spec-0001-user-authentication.md
|
|
1005
|
-
✓ Syncing to GitHub Project...
|
|
1006
|
-
✓ GitHub Project updated successfully
|
|
1007
|
-
|
|
1008
|
-
GitHub Issue:
|
|
1009
|
-
✓ Closed issue #42
|
|
1010
|
-
✓ Added completion summary
|
|
1011
|
-
|
|
1012
|
-
Status Sync:
|
|
1013
|
-
✓ GitHub issue #42: active → closed (with comment)
|
|
1014
|
-
✓ JIRA issue PROJ-123: In Progress → Done (with comment)
|
|
1015
|
-
✓ ADO work item #456: Active → Closed (with comment)
|
|
1016
|
-
|
|
1017
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1018
|
-
📋 NEXT STEPS
|
|
1019
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1020
|
-
|
|
1021
|
-
1. Create PR: git push && gh pr create
|
|
1022
|
-
2. Deploy to staging: npm run deploy:staging
|
|
1023
|
-
3. Create new increment: /sw:increment "Next feature"
|
|
1024
|
-
```
|
|
1025
|
-
|
|
1026
|
-
#### Scenario B: One or More Gates Fail ❌
|
|
1027
|
-
|
|
1028
|
-
```
|
|
1029
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1030
|
-
PM VALIDATION RESULT: ❌ NOT READY TO CLOSE
|
|
1031
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1032
|
-
|
|
1033
|
-
❌ Gate 1: Tasks Completed - 2 P1 tasks incomplete
|
|
1034
|
-
✅ Gate 2: Tests Passing - All tests pass
|
|
1035
|
-
❌ Gate 3: Documentation Updated - CLAUDE.md and README.md outdated
|
|
1036
|
-
|
|
1037
|
-
PM Decision: ❌ CANNOT close increment
|
|
1038
|
-
|
|
1039
|
-
Blockers (MUST fix before closure):
|
|
1040
|
-
1. Complete tasks T005 and T008 (security critical)
|
|
1041
|
-
Estimated: 4-6 hours
|
|
1042
|
-
Impact: Authentication won't work without these
|
|
1043
|
-
|
|
1044
|
-
2. Update CLAUDE.md and README.md
|
|
1045
|
-
Estimated: 1-2 hours
|
|
1046
|
-
Impact: Users won't know how to use authentication
|
|
1047
|
-
|
|
1048
|
-
Total estimated effort to fix: 5-8 hours
|
|
1049
|
-
|
|
1050
|
-
Action Plan:
|
|
1051
|
-
1. Complete T005 (password hashing) - 2h
|
|
1052
|
-
2. Complete T008 (JWT validation) - 3h
|
|
1053
|
-
3. Update CLAUDE.md - 30m
|
|
1054
|
-
4. Update README.md - 1h
|
|
1055
|
-
5. Re-run /sw:done 0001 for validation
|
|
1056
|
-
|
|
1057
|
-
Increment remains: in-progress
|
|
1058
|
-
|
|
1059
|
-
🔄 GitHub Issue Auto-Reopen (if exists):
|
|
1060
|
-
Checking metadata for GitHub issue...
|
|
1061
|
-
✓ Found: GitHub issue #42
|
|
1062
|
-
✓ Reopening with validation failure details...
|
|
1063
|
-
✓ Issue #42 reopened with comment:
|
|
1064
|
-
"❌ Validation failed - increment not ready for closure
|
|
1065
|
-
|
|
1066
|
-
Gate failures:
|
|
1067
|
-
• Gate 1: 2 P1 tasks incomplete
|
|
1068
|
-
• Gate 3: Documentation outdated
|
|
1069
|
-
|
|
1070
|
-
See PM validation report for details."
|
|
1071
|
-
|
|
1072
|
-
Try again after fixing blockers: /sw:done 0001
|
|
1073
|
-
```
|
|
1074
|
-
|
|
1075
|
-
### Step 5.25: Sync Living Docs (MANDATORY)
|
|
1076
|
-
|
|
1077
|
-
**🔄 CRITICAL: Before quality assessment, sync increment to living docs!**
|
|
1078
|
-
|
|
1079
|
-
This ensures living docs are up-to-date with completed increment status.
|
|
1080
|
-
|
|
1081
|
-
**🚨 MANDATORY - USE SlashCommand TOOL:**
|
|
1082
|
-
|
|
1083
|
-
You MUST invoke the sync-specs command using the SlashCommand tool:
|
|
1084
|
-
|
|
1085
|
-
```
|
|
1086
|
-
SlashCommand(command: "/sw:sync-specs {increment-id}")
|
|
1087
|
-
```
|
|
1088
|
-
|
|
1089
|
-
**DO NOT** just mention the command in output - you MUST actually execute it!
|
|
1090
|
-
|
|
1091
|
-
**What this syncs**:
|
|
1092
|
-
1. Creates/updates FS-XXX folder in `.specweave/docs/internal/specs/{project}/`
|
|
1093
|
-
2. Updates FEATURE.md with completion status
|
|
1094
|
-
3. Updates us-*.md files with final implementation details
|
|
1095
|
-
4. Triggers external tool sync (GitHub/JIRA/ADO) if configured
|
|
1096
|
-
|
|
1097
|
-
**Expected output**:
|
|
1098
|
-
```
|
|
1099
|
-
🔄 Syncing increment to living docs...
|
|
1100
|
-
✅ Living docs synced: FS-127
|
|
1101
|
-
Created/Updated: 4 files (FEATURE.md, us-001.md, us-002.md, us-003.md)
|
|
1102
|
-
```
|
|
1103
|
-
|
|
1104
|
-
**Why this is mandatory**:
|
|
1105
|
-
- The event-driven hook may not fire reliably in all scenarios
|
|
1106
|
-
- Explicit sync ensures living docs are ALWAYS up-to-date after closure
|
|
1107
|
-
- Prevents stale documentation in `.specweave/docs/internal/specs/`
|
|
1108
|
-
|
|
1109
|
-
### Step 5.5: Post-Closure Quality Assessment
|
|
1110
|
-
|
|
1111
|
-
**🎯 MANDATORY**: After successful closure, automatically run quality assessment to validate implementation quality.
|
|
1112
|
-
|
|
1113
|
-
**This step runs ONLY if closure succeeded** (all PM gates passed). If gates failed, increment remains in-progress and this step is skipped.
|
|
1114
|
-
|
|
1115
|
-
**Why This Step Matters**:
|
|
1116
|
-
- PM validation (Gates 0-3) checks **structural completion** (tasks done, tests pass, docs updated, AC coverage)
|
|
1117
|
-
- Quality assessment checks **implementation quality** (code quality, architecture decisions, risks, security)
|
|
1118
|
-
- Provides retrospective learning and continuous improvement
|
|
1119
|
-
- Identifies technical debt and areas for future enhancement
|
|
1120
|
-
- Builds quality metrics over time for velocity tracking
|
|
1121
|
-
|
|
1122
|
-
**Implementation**:
|
|
1123
|
-
|
|
1124
|
-
1. **Invoke QA command automatically**:
|
|
1125
|
-
```bash
|
|
1126
|
-
/sw:qa ${incrementId}
|
|
1127
|
-
```
|
|
1128
|
-
|
|
1129
|
-
2. **Quality assessment evaluates 7 dimensions**:
|
|
1130
|
-
- **Clarity**: Problem statement, objectives, terminology consistency
|
|
1131
|
-
- **Testability**: Acceptance criteria testability, measurable success, edge cases
|
|
1132
|
-
- **Completeness**: Requirements coverage, error handling, NFRs
|
|
1133
|
-
- **Feasibility**: Architecture scalability, technical constraints, timeline
|
|
1134
|
-
- **Maintainability**: Modular design, extension points, technical debt
|
|
1135
|
-
- **Edge Cases**: Failure scenarios, performance limits, security considerations
|
|
1136
|
-
- **Risk Assessment** (BMAD): Probability × Impact scoring (0-10 scale)
|
|
1137
|
-
|
|
1138
|
-
3. **Quality gate decision**:
|
|
1139
|
-
- **✅ PASS**: Score ≥80, no critical risks → Proceed to next work
|
|
1140
|
-
- **🟡 CONCERNS**: Score 60-79, high risks present → Log concerns, suggest improvements
|
|
1141
|
-
- **🔴 FAIL**: Score <60, critical risks present → Create follow-up increment for fixes
|
|
1142
|
-
|
|
1143
|
-
4. **Generate quality report**:
|
|
1144
|
-
- Save to `.specweave/increments/####/reports/qa-post-closure.md`
|
|
1145
|
-
- Include dimension scores, risks identified, recommendations
|
|
1146
|
-
- Link to specific code locations and acceptance criteria
|
|
1147
|
-
|
|
1148
|
-
**Example Output (PASS)**:
|
|
1149
|
-
```
|
|
1150
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1151
|
-
🔍 POST-CLOSURE QUALITY ASSESSMENT
|
|
1152
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1153
|
-
|
|
1154
|
-
Running quality assessment to validate implementation...
|
|
1155
|
-
|
|
1156
|
-
Overall Score: 87/100 (GOOD) ✓
|
|
1157
|
-
|
|
1158
|
-
Dimension Scores:
|
|
1159
|
-
Clarity: 92/100 ✓✓
|
|
1160
|
-
Testability: 85/100 ✓
|
|
1161
|
-
Completeness: 90/100 ✓✓
|
|
1162
|
-
Feasibility: 88/100 ✓✓
|
|
1163
|
-
Maintainability: 85/100 ✓
|
|
1164
|
-
Edge Cases: 78/100 ✓
|
|
1165
|
-
Risk Assessment: 75/100 ✓
|
|
1166
|
-
|
|
1167
|
-
Quality Gate Decision: ✅ PASS
|
|
1168
|
-
|
|
1169
|
-
📋 Report: .specweave/increments/0001-user-authentication/reports/qa-post-closure.md
|
|
1170
|
-
|
|
1171
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1172
|
-
```
|
|
1173
|
-
|
|
1174
|
-
**Example Output (CONCERNS)**:
|
|
1175
|
-
```
|
|
1176
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1177
|
-
🔍 POST-CLOSURE QUALITY ASSESSMENT
|
|
1178
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1179
|
-
|
|
1180
|
-
Overall Score: 72/100 (ACCEPTABLE) ⚠️
|
|
1181
|
-
|
|
1182
|
-
Dimension Scores:
|
|
1183
|
-
Clarity: 85/100 ✓
|
|
1184
|
-
Testability: 68/100 ⚠️
|
|
1185
|
-
Edge Cases: 65/100 ⚠️
|
|
1186
|
-
Risk Assessment: 70/100 ⚠️
|
|
1187
|
-
|
|
1188
|
-
Quality Gate Decision: 🟡 CONCERNS
|
|
1189
|
-
|
|
1190
|
-
Issues to Address:
|
|
1191
|
-
• Testability: Some acceptance criteria not measurable
|
|
1192
|
-
• Edge cases: Missing error handling for network failures
|
|
1193
|
-
• 2 HIGH risks identified (see report)
|
|
1194
|
-
|
|
1195
|
-
Recommendations:
|
|
1196
|
-
1. Add measurable metrics to 3 acceptance criteria
|
|
1197
|
-
2. Implement retry logic for API calls
|
|
1198
|
-
3. Add integration tests for edge cases
|
|
1199
|
-
|
|
1200
|
-
📋 Full report: .specweave/increments/0001-*/reports/qa-post-closure.md
|
|
1201
|
-
|
|
1202
|
-
These can be addressed in future iterations.
|
|
1203
|
-
|
|
1204
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1205
|
-
```
|
|
1206
|
-
|
|
1207
|
-
**Example Output (FAIL)**:
|
|
1208
|
-
```
|
|
1209
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1210
|
-
🔍 POST-CLOSURE QUALITY ASSESSMENT
|
|
1211
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1212
|
-
|
|
1213
|
-
Overall Score: 58/100 (POOR) 🔴
|
|
1214
|
-
|
|
1215
|
-
Dimension Scores:
|
|
1216
|
-
Risk Assessment: 45/100 🔴 (CRITICAL)
|
|
1217
|
-
|
|
1218
|
-
Quality Gate Decision: 🔴 FAIL
|
|
1219
|
-
|
|
1220
|
-
CRITICAL Issues Found:
|
|
1221
|
-
🔴 RISK-001: Password storage implementation (9.0/10 - CRITICAL)
|
|
1222
|
-
→ No password hashing specified
|
|
1223
|
-
→ SECURITY VULNERABILITY: Passwords stored in plain text
|
|
1224
|
-
→ MUST FIX: Use bcrypt or Argon2
|
|
1225
|
-
|
|
1226
|
-
🔴 RISK-002: Rate limiting not specified (8.0/10 - HIGH)
|
|
1227
|
-
→ No brute-force protection
|
|
1228
|
-
→ SECURITY VULNERABILITY: OWASP A07:2021
|
|
1229
|
-
|
|
1230
|
-
Recommendation: Create follow-up increment 0002-security-fixes immediately
|
|
1231
|
-
|
|
1232
|
-
Options:
|
|
1233
|
-
A. Create follow-up increment now (STRONGLY RECOMMENDED)
|
|
1234
|
-
B. Log as critical technical debt (must fix in next sprint)
|
|
1235
|
-
C. Continue anyway (NOT RECOMMENDED - security risk!)
|
|
1236
|
-
|
|
1237
|
-
What would you like to do? [A/B/C]
|
|
1238
|
-
|
|
1239
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1240
|
-
```
|
|
1241
|
-
|
|
1242
|
-
**IMPORTANT Notes**:
|
|
1243
|
-
- Quality assessment runs **AFTER** closure to not block delivery
|
|
1244
|
-
- Increment is already closed and can be deployed
|
|
1245
|
-
- QA provides learning, continuous improvement, and technical debt identification
|
|
1246
|
-
- Critical issues trigger follow-up increment creation for fixes
|
|
1247
|
-
- Quality metrics tracked over time for velocity and quality trends
|
|
1248
|
-
|
|
1249
|
-
### Step 6: Handle Incomplete Work
|
|
1250
|
-
|
|
1251
|
-
**If increment cannot close due to scope creep**:
|
|
1252
|
-
|
|
1253
|
-
```
|
|
1254
|
-
🤔 PM Analysis: Scope creep detected
|
|
1255
|
-
|
|
1256
|
-
Original plan: 42 tasks (estimated 3-4 weeks)
|
|
1257
|
-
Current state: 55 tasks (3 weeks elapsed)
|
|
1258
|
-
Reason: 13 tasks added during implementation
|
|
1259
|
-
|
|
1260
|
-
Options:
|
|
1261
|
-
A) Complete all 55 tasks (1 more week)
|
|
1262
|
-
B) Move 13 new tasks to next increment (close now)
|
|
1263
|
-
C) Re-plan as 2 increments (recommended)
|
|
33
|
+
### Step 1: Self-Awareness Check (OPTIONAL)
|
|
1264
34
|
|
|
1265
|
-
|
|
1266
|
-
• Increment 0001: Core authentication (42 tasks) - Close now
|
|
1267
|
-
• Increment 0002: Enhanced authentication (13 tasks) - New increment
|
|
35
|
+
If closing a SpecWeave framework increment, show post-closure reminders: update CHANGELOG.md, CLAUDE.md, consider version bump, run `npm test && npm run rebuild`, check for breaking changes. Informational only, not blocking.
|
|
1268
36
|
|
|
1269
|
-
|
|
37
|
+
### Step 2: Inline Grill Review (MANDATORY)
|
|
1270
38
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
39
|
+
1. Check config: `jq -r '.grill.required // true' .specweave/config.json` -- if `false`, skip
|
|
40
|
+
2. Invoke `Skill({ skill: "sw:grill" })` with incrementId
|
|
41
|
+
3. BLOCKERs or CRITICALs found -> STOP closure, show findings, ask user to fix
|
|
42
|
+
4. Passes -> continue
|
|
1275
43
|
|
|
1276
|
-
|
|
1277
|
-
✓ Status: completed
|
|
1278
|
-
✓ Transferred 13 tasks to 0002
|
|
44
|
+
### Step 3: Judge LLM Validation (MANDATORY)
|
|
1279
45
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
---
|
|
1285
|
-
|
|
1286
|
-
## Examples
|
|
1287
|
-
|
|
1288
|
-
### Example 1: Successful Closure
|
|
1289
|
-
|
|
1290
|
-
```bash
|
|
1291
|
-
/sw:done 0001
|
|
1292
|
-
```
|
|
1293
|
-
|
|
1294
|
-
**Output**:
|
|
1295
|
-
```
|
|
1296
|
-
✅ Gate 1: Tasks (100% P1)
|
|
1297
|
-
✅ Gate 2: Tests (70/70 passing)
|
|
1298
|
-
✅ Gate 3: Docs (all updated)
|
|
1299
|
-
|
|
1300
|
-
PM Approval: ✅ APPROVED
|
|
1301
|
-
|
|
1302
|
-
🎉 Increment 0001 closed successfully!
|
|
1303
|
-
|
|
1304
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1305
|
-
🔍 POST-CLOSURE QUALITY ASSESSMENT
|
|
1306
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1307
|
-
|
|
1308
|
-
Running quality assessment to validate implementation...
|
|
1309
|
-
|
|
1310
|
-
Overall Score: 87/100 (GOOD) ✓
|
|
1311
|
-
|
|
1312
|
-
Dimension Scores:
|
|
1313
|
-
Clarity: 92/100 ✓✓
|
|
1314
|
-
Testability: 85/100 ✓
|
|
1315
|
-
Risk Assessment: 75/100 ✓
|
|
1316
|
-
|
|
1317
|
-
Quality Gate Decision: ✅ PASS
|
|
1318
|
-
|
|
1319
|
-
📋 Report: .specweave/increments/0001-user-authentication/reports/qa-post-closure.md
|
|
1320
|
-
|
|
1321
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1322
|
-
|
|
1323
|
-
Next: /sw:increment "Next feature"
|
|
1324
|
-
```
|
|
1325
|
-
|
|
1326
|
-
### Example 2: Blocked by Failing Tests
|
|
1327
|
-
|
|
1328
|
-
```bash
|
|
1329
|
-
/sw:done 0002
|
|
1330
|
-
```
|
|
1331
|
-
|
|
1332
|
-
**Output**:
|
|
1333
|
-
```
|
|
1334
|
-
✅ Gate 1: Tasks (100%)
|
|
1335
|
-
❌ Gate 2: Tests (3 failures)
|
|
1336
|
-
✅ Gate 3: Docs (current)
|
|
46
|
+
1. Invoke `Skill({ skill: "sw:judge-llm" })` with `--last-commit` (or `--staged`)
|
|
47
|
+
2. Uses ultrathink extended thinking via separate Opus API call
|
|
48
|
+
3. **APPROVED** -> continue | **CONCERNS** -> show, allow continuation | **REJECTED** -> STOP closure
|
|
49
|
+
4. No ANTHROPIC_API_KEY -> falls back to pattern matching, does not block
|
|
1337
50
|
|
|
1338
|
-
|
|
51
|
+
### Step 4: Status Validation
|
|
1339
52
|
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
53
|
+
- `ready_for_review` -> Proceed
|
|
54
|
+
- `active` -> Check all tasks done, transition to `ready_for_review` first
|
|
55
|
+
- `completed` -> Already closed, warn user
|
|
56
|
+
- `backlog` / `paused` / `abandoned` -> BLOCK with error
|
|
1343
57
|
|
|
1344
|
-
|
|
1345
|
-
```
|
|
58
|
+
Require explicit user confirmation before closure ("yes" to close, "no" to cancel).
|
|
1346
59
|
|
|
1347
|
-
###
|
|
60
|
+
### Step 5: Load Increment Context
|
|
1348
61
|
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
```
|
|
62
|
+
1. Find increment directory: normalize ID to 4-digit, match `.specweave/increments/0001-*/`
|
|
63
|
+
2. Load: `spec.md`, `plan.md`, `tasks.md`, `tests.md`
|
|
1352
64
|
|
|
1353
|
-
|
|
1354
|
-
```
|
|
1355
|
-
✅ Gate 1: Tasks (100%)
|
|
1356
|
-
✅ Gate 2: Tests (passing)
|
|
1357
|
-
❌ Gate 3: Docs (CLAUDE.md, README.md outdated)
|
|
65
|
+
### Step 6: Automated Completion Validation (Gate 0)
|
|
1358
66
|
|
|
1359
|
-
|
|
67
|
+
MANDATORY, cannot be bypassed. Runs BEFORE PM validation.
|
|
1360
68
|
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
• Update CHANGELOG.md
|
|
1365
|
-
• Estimated: 1-2 hours
|
|
69
|
+
1. **Sync ACs first**: `ACStatusManager.syncACStatus(incrementId)` -- prevents race conditions with background hooks
|
|
70
|
+
2. **Desync check**: `DesyncDetector.validateOrThrow(incrementId)` -- blocks if metadata.json/spec.md inconsistent
|
|
71
|
+
3. **Completion validation**: `IncrementCompletionValidator.validateCompletion(incrementId)`
|
|
1366
72
|
|
|
1367
|
-
|
|
1368
|
-
|
|
73
|
+
**Gate 0 validates**:
|
|
74
|
+
- All ACs checked in spec.md (`- [x] **AC-...`)
|
|
75
|
+
- All tasks completed in tasks.md (`**Status**: [x] completed`)
|
|
76
|
+
- Required files exist (spec.md, tasks.md)
|
|
77
|
+
- Tasks count in frontmatter matches checked tasks (source of truth)
|
|
78
|
+
- AC coverage: all ACs covered by tasks (100%), no orphan tasks, all US linkage valid
|
|
1369
79
|
|
|
1370
|
-
|
|
80
|
+
If validation fails -> increment stays in-progress, command exits.
|
|
1371
81
|
|
|
1372
|
-
|
|
1373
|
-
/sw:done 0004
|
|
1374
|
-
```
|
|
82
|
+
### Step 7: PM Validation (3 Gates)
|
|
1375
83
|
|
|
1376
|
-
|
|
1377
|
-
```
|
|
1378
|
-
🤔 Scope creep detected (15 extra tasks)
|
|
84
|
+
PM validation report goes in: `.specweave/increments/####-name/reports/PM-VALIDATION-REPORT.md`
|
|
1379
85
|
|
|
1380
|
-
|
|
1381
|
-
A) Complete all (1 more week)
|
|
1382
|
-
B) Move to next increment
|
|
1383
|
-
C) Split into 2 increments ✅ (recommended)
|
|
86
|
+
**Gate 1 - Tasks Completed**: All P1 done, P2 done or deferred with reason, P3 done/deferred/backlogged, no blocked tasks, ACs met.
|
|
1384
87
|
|
|
1385
|
-
|
|
1386
|
-
✓ Transferred 15 tasks
|
|
88
|
+
**Gate 2a - E2E Tests (AUTOMATED, BLOCKING)**: Detect playwright/cypress configs (including `repositories/*/*-e2e`). If found, run them. E2E failure blocks closure. No E2E detected -> skip.
|
|
1387
89
|
|
|
1388
|
-
|
|
1389
|
-
✅ Completed (original scope)
|
|
90
|
+
**Gate 2 - Tests Passing**: All suites passing, coverage >80% critical paths, no unexplained skips, tests align with ACs.
|
|
1390
91
|
|
|
1391
|
-
|
|
1392
|
-
📋 Increment 0005 ready to plan
|
|
1393
|
-
```
|
|
92
|
+
**Gate 3 - Documentation Updated**: CLAUDE.md, README.md, CHANGELOG.md updated as needed. Inline docs complete. No stale references.
|
|
1394
93
|
|
|
1395
|
-
|
|
94
|
+
### Step 8: PM Decision
|
|
1396
95
|
|
|
1397
|
-
|
|
96
|
+
**All gates pass**:
|
|
97
|
+
1. Create marker file: `mkdir -p .specweave/state && touch .specweave/state/.sw-done-in-progress`
|
|
98
|
+
2. Update metadata.json status to `completed`, set completion date
|
|
99
|
+
3. Remove marker file
|
|
100
|
+
4. Generate completion report, update backlog
|
|
1398
101
|
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
102
|
+
**Any gate fails**:
|
|
103
|
+
- Show failures and blockers with estimated fix effort
|
|
104
|
+
- If GitHub issue exists, reopen it with failure details
|
|
105
|
+
- Increment remains in-progress
|
|
1402
106
|
|
|
1403
|
-
|
|
1404
|
-
• 0002-core-enhancements (in-progress)
|
|
1405
|
-
• 0003-payment-processing (planned)
|
|
107
|
+
### Step 9: Post-Closure Sync (AUTOMATIC)
|
|
1406
108
|
|
|
1407
|
-
|
|
1408
|
-
```
|
|
109
|
+
Runs automatically after successful closure:
|
|
1409
110
|
|
|
1410
|
-
|
|
1411
|
-
```
|
|
1412
|
-
❌ Error: Cannot close increment 0001 (status: planned)
|
|
111
|
+
**A) Sync spec.md status** to `completed` (frontmatter + status line cache). Always runs.
|
|
1413
112
|
|
|
1414
|
-
|
|
113
|
+
**B) Sync living docs to GitHub Project**: If `hooks.post_increment_done.sync_to_github_project` enabled, find living docs spec and run `/sw-github:sync-spec`.
|
|
1415
114
|
|
|
1416
|
-
|
|
1417
|
-
```
|
|
115
|
+
**C) Close GitHub issue**: If `hooks.post_increment_done.close_github_issue` enabled and metadata has `github.issue`, close via `gh issue close`.
|
|
1418
116
|
|
|
1419
|
-
|
|
1420
|
-
```
|
|
1421
|
-
❌ CRITICAL: Major blockers prevent closure
|
|
117
|
+
**D) Close external-origin issue** (E-suffix increments only): Parse `metadata.external_ref` (format: `github#owner/repo#number`). Check `sync.settings.canUpdateStatus` permission. Close via `gh issue close -R`.
|
|
1422
118
|
|
|
1423
|
-
|
|
1424
|
-
Gate 2: ❌ 12 test failures (including security tests)
|
|
1425
|
-
Gate 3: ❌ Documentation completely outdated
|
|
119
|
+
**E) Sync to external tools**: If `sync.statusSync.enabled`, use `syncACProgressToProviders()` to sync to all enabled providers (GitHub, JIRA, ADO).
|
|
1426
120
|
|
|
1427
|
-
|
|
121
|
+
### Step 10: Sync Living Docs (MANDATORY)
|
|
1428
122
|
|
|
1429
|
-
|
|
1430
|
-
• Complete critical P1 tasks (estimated 2-3 days)
|
|
1431
|
-
• Fix all test failures (estimated 1 day)
|
|
1432
|
-
• Update all documentation (estimated 4 hours)
|
|
123
|
+
Execute: `Skill({ skill: "sw:sync-specs" })` with increment-id. Do NOT just mention it -- actually invoke it.
|
|
1433
124
|
|
|
1434
|
-
|
|
125
|
+
### Step 11: Post-Closure Quality Assessment
|
|
1435
126
|
|
|
1436
|
-
|
|
127
|
+
Runs ONLY if closure succeeded. Invoke: `/sw:qa ${incrementId}`
|
|
1437
128
|
|
|
1438
|
-
|
|
1439
|
-
```
|
|
1440
|
-
|
|
1441
|
-
---
|
|
1442
|
-
|
|
1443
|
-
## Related Commands
|
|
1444
|
-
|
|
1445
|
-
- `/increment`: Plan new increment
|
|
1446
|
-
- `/do`: Execute implementation
|
|
1447
|
-
- `/validate`: Validate quality before closing
|
|
1448
|
-
- `/list-increments`: List all increments with status
|
|
1449
|
-
|
|
1450
|
-
---
|
|
1451
|
-
|
|
1452
|
-
## Related Agents
|
|
1453
|
-
|
|
1454
|
-
- `pm`: Product Manager agent (validates completion)
|
|
1455
|
-
- `sw-testing:qa-engineer`: QA Engineer agent (validates tests)
|
|
1456
|
-
- `docs-writer`: Documentation writer (validates docs)
|
|
129
|
+
Evaluates 7 dimensions: Clarity, Testability, Completeness, Feasibility, Maintainability, Edge Cases, Risk Assessment.
|
|
1457
130
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
131
|
+
- Score >=80 -> PASS, proceed
|
|
132
|
+
- Score 60-79 -> CONCERNS, log and suggest improvements
|
|
133
|
+
- Score <60 -> FAIL, recommend follow-up increment
|
|
1461
134
|
|
|
1462
|
-
|
|
1463
|
-
- Tasks: P1 required, P2 can be deferred
|
|
1464
|
-
- Tests: All tests must pass, 80% coverage required
|
|
1465
|
-
- Documentation: CLAUDE.md, README.md, and CHANGELOG.md must be updated
|
|
135
|
+
Report saved to: `.specweave/increments/####/reports/qa-post-closure.md`
|
|
1466
136
|
|
|
1467
|
-
|
|
137
|
+
Quality assessment runs AFTER closure (not blocking delivery). Critical issues trigger follow-up increment creation.
|
|
1468
138
|
|
|
1469
|
-
|
|
139
|
+
### Step 12: Handle Incomplete Work
|
|
1470
140
|
|
|
1471
|
-
|
|
141
|
+
If scope creep detected, offer options:
|
|
142
|
+
- A) Complete all tasks (estimate effort)
|
|
143
|
+
- B) Move extra tasks to next increment (close now)
|
|
144
|
+
- C) Split into 2 increments (recommended)
|
|
1472
145
|
|
|
1473
|
-
|
|
1474
|
-
- ✅ Business value delivered (tasks complete)
|
|
1475
|
-
- ✅ Quality maintained (tests passing)
|
|
1476
|
-
- ✅ Knowledge preserved (docs updated)
|
|
146
|
+
Transfer tasks creates new increment with dependencies on current one.
|