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
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Comprehensive health check for hooks - detects import errors, runtime failures, performance issues, and provides auto-fix suggestions
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Check Hook Health
|
|
6
|
-
|
|
7
|
-
**Command**: `/sw:check-hooks`
|
|
8
|
-
|
|
9
|
-
Runs comprehensive health check on all hooks in the project.
|
|
10
|
-
Detects import errors, runtime failures, performance issues, and provides auto-fix suggestions.
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# Check all hooks
|
|
16
|
-
/sw:check-hooks
|
|
17
|
-
|
|
18
|
-
# Check and auto-fix issues
|
|
19
|
-
/sw:check-hooks --fix
|
|
20
|
-
|
|
21
|
-
# Check only critical hooks
|
|
22
|
-
/sw:check-hooks --critical
|
|
23
|
-
|
|
24
|
-
# Verbose output with details
|
|
25
|
-
/sw:check-hooks --verbose
|
|
26
|
-
|
|
27
|
-
# Check specific hook
|
|
28
|
-
/sw:check-hooks update-ac-status
|
|
29
|
-
|
|
30
|
-
# Generate markdown report
|
|
31
|
-
/sw:check-hooks --format markdown --output report.md
|
|
32
|
-
|
|
33
|
-
# Check reflect hook health (self-improving AI)
|
|
34
|
-
/sw:check-hooks --reflect
|
|
35
|
-
|
|
36
|
-
# Check reflect with verbose details
|
|
37
|
-
/sw:check-hooks --reflect --verbose
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Options
|
|
41
|
-
|
|
42
|
-
- `--fix` - Automatically repair fixable issues (missing .js extensions, etc.)
|
|
43
|
-
- `--critical` - Check only critical hooks (post-task-completion, user-prompt-submit)
|
|
44
|
-
- `--verbose` - Show detailed error messages and stack traces
|
|
45
|
-
- `--format <format>` - Output format: console (default), markdown, json, junit
|
|
46
|
-
- `--output <file>` - Write report to file
|
|
47
|
-
- `--timeout <ms>` - Hook execution timeout (default: 5000ms)
|
|
48
|
-
- `--fail-on-warnings` - Exit with error code if warnings detected
|
|
49
|
-
- `--reflect` - Check reflect hook health (stop-reflect.sh, jq, memory dirs)
|
|
50
|
-
- `--include-cache` - Also check plugin cache health
|
|
51
|
-
|
|
52
|
-
## What It Checks
|
|
53
|
-
|
|
54
|
-
### Import Errors (ERR_MODULE_NOT_FOUND)
|
|
55
|
-
- Missing .js extensions in ES module imports
|
|
56
|
-
- Incorrect import paths
|
|
57
|
-
- Missing dependencies
|
|
58
|
-
|
|
59
|
-
### Runtime Errors
|
|
60
|
-
- Static vs instance method mismatches
|
|
61
|
-
- Syntax errors
|
|
62
|
-
- JSON parse errors
|
|
63
|
-
|
|
64
|
-
### Performance Issues
|
|
65
|
-
- Hooks exceeding expected execution time
|
|
66
|
-
- Slow file I/O operations
|
|
67
|
-
|
|
68
|
-
### Best Practices
|
|
69
|
-
- Deprecated API usage
|
|
70
|
-
- Security vulnerabilities
|
|
71
|
-
|
|
72
|
-
## Auto-Fix Capabilities
|
|
73
|
-
|
|
74
|
-
The `--fix` flag can automatically repair:
|
|
75
|
-
|
|
76
|
-
1. **Missing .js Extensions**
|
|
77
|
-
```typescript
|
|
78
|
-
// Before:
|
|
79
|
-
import { ACStatusManager } from '../../../../src/core/increment/ac-status-manager';
|
|
80
|
-
|
|
81
|
-
// After:
|
|
82
|
-
import { ACStatusManager } from '../../../../src/core/increment/ac-status-manager.js';
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
2. **Import Path Corrections** (high confidence only)
|
|
86
|
-
|
|
87
|
-
## Output Formats
|
|
88
|
-
|
|
89
|
-
### Console (Default)
|
|
90
|
-
Colorized output for terminal viewing:
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
🏥 Hook Health Check
|
|
94
|
-
═══════════════════════════════════════════════════════════
|
|
95
|
-
|
|
96
|
-
✅ All hooks healthy (8/8 passed)
|
|
97
|
-
|
|
98
|
-
Hooks Checked:
|
|
99
|
-
✅ update-ac-status (42ms)
|
|
100
|
-
✅ auto-transition (38ms)
|
|
101
|
-
✅ sync-living-docs (156ms)
|
|
102
|
-
...
|
|
103
|
-
|
|
104
|
-
Summary:
|
|
105
|
-
Total Hooks: 8
|
|
106
|
-
✅ Passed: 8
|
|
107
|
-
⏱️ Total Time: 625ms
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Markdown
|
|
111
|
-
Detailed report for documentation:
|
|
112
|
-
|
|
113
|
-
```markdown
|
|
114
|
-
# 🏥 Hook Health Check Report
|
|
115
|
-
|
|
116
|
-
**Generated**: 2025-11-16 14:00:00
|
|
117
|
-
**Overall Health**: 🟢 HEALTHY
|
|
118
|
-
|
|
119
|
-
## Summary
|
|
120
|
-
- **Total Hooks**: 8
|
|
121
|
-
- **Passed**: ✅ 8
|
|
122
|
-
- **Failed**: ❌ 0
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### JSON
|
|
126
|
-
Machine-readable format for CI/CD:
|
|
127
|
-
|
|
128
|
-
```json
|
|
129
|
-
{
|
|
130
|
-
"timestamp": "2025-11-16T14:00:00Z",
|
|
131
|
-
"totalHooks": 8,
|
|
132
|
-
"passedHooks": 8,
|
|
133
|
-
"failedHooks": 0,
|
|
134
|
-
"overallHealth": "healthy"
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### JUnit XML
|
|
139
|
-
For CI/CD test reporting:
|
|
140
|
-
|
|
141
|
-
```xml
|
|
142
|
-
<testsuite name="Hook Health Check" tests="8" failures="0">
|
|
143
|
-
<testcase name="update-ac-status" classname="specweave" time="0.042"/>
|
|
144
|
-
</testsuite>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
## Exit Codes
|
|
148
|
-
|
|
149
|
-
- `0` - All hooks healthy
|
|
150
|
-
- `1` - Hook failures detected
|
|
151
|
-
- `2` - Critical hook failures (blocks workflow)
|
|
152
|
-
|
|
153
|
-
## Examples
|
|
154
|
-
|
|
155
|
-
### Pre-Build Health Check
|
|
156
|
-
```bash
|
|
157
|
-
npm run check:hooks
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### CI/CD Integration
|
|
161
|
-
```yaml
|
|
162
|
-
# .github/workflows/test.yml
|
|
163
|
-
- name: Check Hook Health
|
|
164
|
-
run: npm run check:hooks -- --format junit --output junit.xml
|
|
165
|
-
|
|
166
|
-
- name: Publish Test Results
|
|
167
|
-
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
168
|
-
with:
|
|
169
|
-
files: junit.xml
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Pre-Commit Hook
|
|
173
|
-
```bash
|
|
174
|
-
#!/bin/bash
|
|
175
|
-
# .git/hooks/pre-commit
|
|
176
|
-
|
|
177
|
-
npm run check:hooks --critical
|
|
178
|
-
if [ $? -ne 0 ]; then
|
|
179
|
-
echo "❌ Critical hooks failing - commit blocked"
|
|
180
|
-
exit 1
|
|
181
|
-
fi
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
## Troubleshooting
|
|
185
|
-
|
|
186
|
-
### "Hook execution timeout"
|
|
187
|
-
Increase timeout: `/sw:check-hooks --timeout 10000`
|
|
188
|
-
|
|
189
|
-
### "Cannot find module"
|
|
190
|
-
Run with auto-fix: `/sw:check-hooks --fix`
|
|
191
|
-
|
|
192
|
-
### "Permission denied"
|
|
193
|
-
Check hook file permissions: `chmod +x plugins/*/hooks/*.sh`
|
|
194
|
-
|
|
195
|
-
## Quick Health Dashboard
|
|
196
|
-
|
|
197
|
-
For a quick visual dashboard of hook health, run:
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
bash plugins/specweave/scripts/hook-health.sh
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Or use specific views:
|
|
204
|
-
```bash
|
|
205
|
-
bash plugins/specweave/scripts/hook-health.sh --status # Quick status
|
|
206
|
-
bash plugins/specweave/scripts/hook-health.sh --metrics # Detailed metrics
|
|
207
|
-
bash plugins/specweave/scripts/hook-health.sh --reset # Reset circuit breakers
|
|
208
|
-
bash plugins/specweave/scripts/hook-health.sh --clean # Clean stale state
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## Concurrency System
|
|
212
|
-
|
|
213
|
-
The hook system uses proper concurrency primitives:
|
|
214
|
-
|
|
215
|
-
### Semaphore
|
|
216
|
-
- Limits concurrent hook execution (default: 15)
|
|
217
|
-
- Graceful degradation when slots unavailable
|
|
218
|
-
- Automatic cleanup of stale locks
|
|
219
|
-
|
|
220
|
-
### Circuit Breaker
|
|
221
|
-
- Per-hook circuit breakers with 3 states:
|
|
222
|
-
- CLOSED: Normal operation
|
|
223
|
-
- OPEN: Too many failures, fail fast
|
|
224
|
-
- HALF_OPEN: Testing recovery
|
|
225
|
-
|
|
226
|
-
### Metrics
|
|
227
|
-
- Success/failure/timeout tracking
|
|
228
|
-
- Latency percentiles (p50, p95, p99)
|
|
229
|
-
- Health score calculation
|
|
230
|
-
|
|
231
|
-
### Configuration
|
|
232
|
-
Environment variables:
|
|
233
|
-
- `HOOK_MAX_CONCURRENT` - Max concurrent hooks (default: 15)
|
|
234
|
-
- `HOOK_TIMEOUT` - Hook execution timeout in seconds (default: 5)
|
|
235
|
-
- `HOOK_DEBUG` - Enable debug logging (1 = enabled)
|
|
236
|
-
|
|
237
|
-
## See Also
|
|
238
|
-
|
|
239
|
-
- Hook Health Check Architecture: `.specweave/increments/0037-project-specific-tasks/architecture/HOOK-HEALTH-CHECK-ARCHITECTURE.md`
|
|
240
|
-
- Hook Development Guide: `.specweave/docs/public/guides/hook-development.md`
|
|
241
|
-
- Concurrency Libraries: `plugins/specweave/hooks/lib/`
|
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Auto-embed Acceptance Criteria from living docs into increment spec.md for hook compatibility
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Embed Acceptance Criteria from Living Docs
|
|
6
|
-
|
|
7
|
-
You are helping the user embed Acceptance Criteria from living documentation into increment spec.md.
|
|
8
|
-
|
|
9
|
-
## Context
|
|
10
|
-
|
|
11
|
-
**Problem**: The AC sync hook requires ACs to be in spec.md, but some increments use `structure: user-stories` which references external living docs without embedding ACs inline.
|
|
12
|
-
|
|
13
|
-
**Solution**: This command auto-embeds ACs from living docs into spec.md, ensuring sync hooks work correctly.
|
|
14
|
-
|
|
15
|
-
**Architecture**: spec.md is ALWAYS the source of truth for ACs, even when living docs exist as a documentation layer. (See ADR-0062)
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
/sw:embed-acs <increment-id>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Arguments
|
|
24
|
-
|
|
25
|
-
- `<increment-id>`: Required. Increment ID (e.g., "0050", "50", "0050-feature-name")
|
|
26
|
-
|
|
27
|
-
## Workflow
|
|
28
|
-
|
|
29
|
-
### Step 1: Parse and Validate Arguments
|
|
30
|
-
|
|
31
|
-
1. **Extract increment ID**:
|
|
32
|
-
- Parse from command: `/sw:embed-acs 0050` → "0050"
|
|
33
|
-
- Normalize to 4-digit format: "0050"
|
|
34
|
-
- Support formats: "50", "0050", "0050-feature-name"
|
|
35
|
-
|
|
36
|
-
2. **Validate increment exists**:
|
|
37
|
-
- List directories in `.specweave/increments/`
|
|
38
|
-
- Find matching increment (e.g., `0050-external-tool-import-phase-1b-7`)
|
|
39
|
-
- If not found: Show error with available increments
|
|
40
|
-
|
|
41
|
-
**Example output if not found**:
|
|
42
|
-
```
|
|
43
|
-
❌ Error: Increment 0050 not found
|
|
44
|
-
|
|
45
|
-
Available increments:
|
|
46
|
-
• 0048-external-tool-import-enhancement
|
|
47
|
-
• 0049-cli-first-init-flow
|
|
48
|
-
|
|
49
|
-
Usage: /sw:embed-acs <increment-id>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Step 2: Validate Increment Structure
|
|
53
|
-
|
|
54
|
-
1. **Check spec.md exists**:
|
|
55
|
-
```bash
|
|
56
|
-
ls .specweave/increments/0050-*/spec.md
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
2. **Check for `structure: user-stories` in frontmatter**:
|
|
60
|
-
```bash
|
|
61
|
-
grep "structure: user-stories" spec.md
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
3. **If NOT using living docs structure**:
|
|
65
|
-
```
|
|
66
|
-
ℹ️ Info: Increment 0050 does not use 'structure: user-stories'
|
|
67
|
-
|
|
68
|
-
This command is intended for increments that reference external living docs.
|
|
69
|
-
For standard increments, ACs should already be in spec.md.
|
|
70
|
-
|
|
71
|
-
Do you want to proceed anyway? [Y/n]:
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Step 3: Find Living Docs Path
|
|
75
|
-
|
|
76
|
-
1. **Extract feature_id from spec.md frontmatter**:
|
|
77
|
-
```bash
|
|
78
|
-
grep "feature_id:" spec.md | cut -d: -f2 | tr -d ' '
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
2. **Construct living docs path**:
|
|
82
|
-
```
|
|
83
|
-
.specweave/docs/internal/specs/specweave/{feature_id}/
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
3. **Validate living docs path exists**:
|
|
87
|
-
```bash
|
|
88
|
-
ls .specweave/docs/internal/specs/specweave/FS-048/
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
4. **If living docs not found**:
|
|
92
|
-
```
|
|
93
|
-
❌ Error: Living docs not found for feature FS-048
|
|
94
|
-
|
|
95
|
-
Expected path: .specweave/docs/internal/specs/specweave/FS-048/
|
|
96
|
-
Actual path: Not found
|
|
97
|
-
|
|
98
|
-
This increment may not have living docs, or they're in a different location.
|
|
99
|
-
|
|
100
|
-
Please specify living docs path manually:
|
|
101
|
-
/sw:embed-acs 0050 --living-docs-path <path>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Step 4: Extract User Stories from spec.md
|
|
105
|
-
|
|
106
|
-
1. **Read user_stories from frontmatter**:
|
|
107
|
-
```yaml
|
|
108
|
-
user_stories:
|
|
109
|
-
- US-001
|
|
110
|
-
- US-002
|
|
111
|
-
- US-004
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
2. **Display user stories to embed**:
|
|
115
|
-
```
|
|
116
|
-
Found 7 user stories in spec.md frontmatter:
|
|
117
|
-
• US-001: Smart Pagination During Init
|
|
118
|
-
• US-002: CLI-First Defaults
|
|
119
|
-
• US-004: Smart Caching with TTL
|
|
120
|
-
• US-005: Dedicated Import Commands
|
|
121
|
-
• US-006: ADO Area Path Mapping
|
|
122
|
-
• US-007: Progress Tracking
|
|
123
|
-
• US-008: Smart Filtering
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Step 5: Extract ACs from Living Docs
|
|
127
|
-
|
|
128
|
-
1. **For each user story**, find corresponding file:
|
|
129
|
-
```bash
|
|
130
|
-
# Try multiple file naming patterns
|
|
131
|
-
find .specweave/docs/internal/specs/specweave/FS-048/ -name "us-001-*.md"
|
|
132
|
-
find .specweave/docs/internal/specs/specweave/FS-048/ -name "US-001.md"
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
2. **Extract ACs from each file**:
|
|
136
|
-
```bash
|
|
137
|
-
grep -E "^### AC-US[0-9]+-[0-9]+:" us-001-smart-pagination-during-init.md
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
3. **Display extraction progress**:
|
|
141
|
-
```
|
|
142
|
-
Extracting ACs from living docs...
|
|
143
|
-
✓ US-001: Found 5 ACs (AC-US1-01 to AC-US1-05)
|
|
144
|
-
✓ US-002: Found 4 ACs (AC-US2-01 to AC-US2-04)
|
|
145
|
-
✓ US-004: Found 5 ACs (AC-US4-01 to AC-US4-05)
|
|
146
|
-
✓ US-005: Found 7 ACs (AC-US5-01 to AC-US5-07)
|
|
147
|
-
✓ US-006: Found 6 ACs (AC-US6-01 to AC-US6-06)
|
|
148
|
-
✓ US-007: Found 6 ACs (AC-US7-01 to AC-US7-06)
|
|
149
|
-
✓ US-008: Found 6 ACs (AC-US8-01 to AC-US8-06)
|
|
150
|
-
|
|
151
|
-
Total: 39 Acceptance Criteria extracted
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Step 6: Check for Existing ACs
|
|
155
|
-
|
|
156
|
-
1. **Check if spec.md already has AC section**:
|
|
157
|
-
```bash
|
|
158
|
-
grep -q "## Acceptance Criteria" spec.md
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
2. **If ACs already exist**:
|
|
162
|
-
```
|
|
163
|
-
⚠️ Warning: spec.md already contains Acceptance Criteria section
|
|
164
|
-
|
|
165
|
-
Found 39 existing ACs in spec.md.
|
|
166
|
-
|
|
167
|
-
What would you like to do?
|
|
168
|
-
[R] Replace existing ACs with freshly embedded ones
|
|
169
|
-
[M] Merge (keep existing + add missing)
|
|
170
|
-
[C] Cancel
|
|
171
|
-
|
|
172
|
-
Choice:
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
3. **If user chooses "Replace"**: Remove old AC section, add new one
|
|
176
|
-
4. **If user chooses "Merge"**: Smart merge (add only missing ACs)
|
|
177
|
-
5. **If user chooses "Cancel"**: Exit without changes
|
|
178
|
-
|
|
179
|
-
### Step 7: Format and Embed ACs
|
|
180
|
-
|
|
181
|
-
1. **Format ACs as markdown**:
|
|
182
|
-
```markdown
|
|
183
|
-
## Acceptance Criteria
|
|
184
|
-
|
|
185
|
-
<!-- Auto-synced from living docs -->
|
|
186
|
-
|
|
187
|
-
### US-001: Smart Pagination During Init
|
|
188
|
-
|
|
189
|
-
- [ ] **AC-US1-01**: 50-Project Limit During Init
|
|
190
|
-
- [ ] **AC-US1-02**: Explicit Choice Prompt
|
|
191
|
-
- [ ] **AC-US1-03**: Async Fetch for "Import All"
|
|
192
|
-
- [ ] **AC-US1-04**: Init Completes < 30 Seconds
|
|
193
|
-
- [ ] **AC-US1-05**: No Timeout Errors
|
|
194
|
-
|
|
195
|
-
### US-002: CLI-First Defaults
|
|
196
|
-
|
|
197
|
-
- [ ] **AC-US2-01**: "Import All" as Default Choice
|
|
198
|
-
- [ ] **AC-US2-02**: All Projects Checked in Checkbox Mode
|
|
199
|
-
- [ ] **AC-US2-03**: Clear Deselection Instructions
|
|
200
|
-
- [ ] **AC-US2-04**: Easy Override for "Select None"
|
|
201
|
-
|
|
202
|
-
...
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
2. **Find insertion point in spec.md**:
|
|
206
|
-
- After "## Implementation Summary" section, OR
|
|
207
|
-
- Before final line if no summary section
|
|
208
|
-
|
|
209
|
-
3. **Use Edit tool to insert ACs**:
|
|
210
|
-
```typescript
|
|
211
|
-
Edit({
|
|
212
|
-
file_path: "spec.md",
|
|
213
|
-
old_string: "**See**: [plan.md](./plan.md)...",
|
|
214
|
-
new_string: "**See**: [plan.md](./plan.md)...\n\n---\n\n" + acMarkdown
|
|
215
|
-
});
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Step 8: Update metadata.json
|
|
219
|
-
|
|
220
|
-
1. **Count total ACs**:
|
|
221
|
-
```bash
|
|
222
|
-
grep -cE "^- \[ \] \*\*AC-US[0-9]+-[0-9]+\*\*:" spec.md
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
2. **Update metadata.json**:
|
|
226
|
-
```json
|
|
227
|
-
{
|
|
228
|
-
"total_acs": 39,
|
|
229
|
-
"completed_acs": 0
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
3. **Use Edit tool to update**:
|
|
234
|
-
```typescript
|
|
235
|
-
Edit({
|
|
236
|
-
file_path: "metadata.json",
|
|
237
|
-
old_string: '"total_acs": 32,',
|
|
238
|
-
new_string: '"total_acs": 39,'
|
|
239
|
-
});
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
### Step 9: Validate Embedding
|
|
243
|
-
|
|
244
|
-
1. **Re-count ACs in spec.md**:
|
|
245
|
-
```bash
|
|
246
|
-
grep -cE "^- \[[x ]\] \*\*AC-US[0-9]+-[0-9]+\*\*:" spec.md
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
2. **Validate format**:
|
|
250
|
-
- All ACs follow pattern: `- [ ] **AC-US1-01**: Title`
|
|
251
|
-
- No duplicate AC IDs
|
|
252
|
-
- All user stories represented
|
|
253
|
-
|
|
254
|
-
3. **Display validation results**:
|
|
255
|
-
```
|
|
256
|
-
✅ Validation: PASSED
|
|
257
|
-
|
|
258
|
-
Embedded 39 Acceptance Criteria into spec.md:
|
|
259
|
-
• US-001: 5 ACs
|
|
260
|
-
• US-002: 4 ACs
|
|
261
|
-
• US-004: 5 ACs
|
|
262
|
-
• US-005: 7 ACs
|
|
263
|
-
• US-006: 6 ACs
|
|
264
|
-
• US-007: 6 ACs
|
|
265
|
-
• US-008: 6 ACs
|
|
266
|
-
|
|
267
|
-
metadata.json updated: total_acs = 39
|
|
268
|
-
|
|
269
|
-
Next steps:
|
|
270
|
-
1. Review embedded ACs in spec.md
|
|
271
|
-
2. Run: /sw:validate 0050
|
|
272
|
-
3. Start work: /sw:do
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Flags (Optional)
|
|
276
|
-
|
|
277
|
-
### `--living-docs-path <path>`
|
|
278
|
-
|
|
279
|
-
Manually specify living docs path if auto-detection fails:
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
/sw:embed-acs 0050 --living-docs-path .specweave/docs/internal/specs/specweave/FS-048
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### `--dry-run`
|
|
286
|
-
|
|
287
|
-
Preview what would be embedded without modifying files:
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
/sw:embed-acs 0050 --dry-run
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
**Output**:
|
|
294
|
-
```
|
|
295
|
-
[DRY RUN] Would embed 39 ACs into spec.md
|
|
296
|
-
|
|
297
|
-
Preview:
|
|
298
|
-
• US-001: 5 ACs (AC-US1-01 to AC-US1-05)
|
|
299
|
-
• US-002: 4 ACs (AC-US2-01 to AC-US2-04)
|
|
300
|
-
...
|
|
301
|
-
|
|
302
|
-
No files modified.
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### `--force`
|
|
306
|
-
|
|
307
|
-
Skip confirmation prompts:
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
/sw:embed-acs 0050 --force
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
## Error Handling
|
|
314
|
-
|
|
315
|
-
### Living Docs Not Found
|
|
316
|
-
```
|
|
317
|
-
❌ Error: Living docs not found for feature FS-048
|
|
318
|
-
|
|
319
|
-
Expected: .specweave/docs/internal/specs/specweave/FS-048/
|
|
320
|
-
Found: Directory does not exist
|
|
321
|
-
|
|
322
|
-
Possible solutions:
|
|
323
|
-
1. Check if feature_id in spec.md is correct
|
|
324
|
-
2. Manually specify path: --living-docs-path <path>
|
|
325
|
-
3. Create living docs first: /sw:sync-docs
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### No User Stories in spec.md
|
|
329
|
-
```
|
|
330
|
-
❌ Error: No user_stories field in spec.md frontmatter
|
|
331
|
-
|
|
332
|
-
This command requires user_stories to be listed in spec.md.
|
|
333
|
-
|
|
334
|
-
Add to spec.md frontmatter:
|
|
335
|
-
user_stories:
|
|
336
|
-
- US-001
|
|
337
|
-
- US-002
|
|
338
|
-
...
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### User Story File Not Found
|
|
342
|
-
```
|
|
343
|
-
⚠️ Warning: User story file not found for US-003
|
|
344
|
-
|
|
345
|
-
Expected paths tried:
|
|
346
|
-
• .specweave/docs/internal/specs/specweave/FS-048/us-003.md
|
|
347
|
-
• .specweave/docs/internal/specs/specweave/FS-048/US-003.md
|
|
348
|
-
• .specweave/docs/internal/specs/specweave/FS-048/us-003-*.md
|
|
349
|
-
|
|
350
|
-
Continuing with remaining user stories...
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
### No ACs Found in User Story
|
|
354
|
-
```
|
|
355
|
-
⚠️ Warning: No ACs found in US-005 file
|
|
356
|
-
|
|
357
|
-
File: .specweave/docs/internal/specs/specweave/FS-048/us-005-dedicated-import-commands.md
|
|
358
|
-
|
|
359
|
-
This file may be incomplete or use a different AC format.
|
|
360
|
-
Skipping US-005 for now.
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
## Integration with Other Commands
|
|
364
|
-
|
|
365
|
-
This command is referenced by:
|
|
366
|
-
|
|
367
|
-
1. **`/sw:validate`**: Suggests running `/sw:embed-acs` when ACs are missing
|
|
368
|
-
2. **`/sw:do`**: Pre-start hook suggests this command if validation fails
|
|
369
|
-
3. **`/sw:increment`**: Should auto-call this when creating `structure: user-stories` increments
|
|
370
|
-
|
|
371
|
-
## Examples
|
|
372
|
-
|
|
373
|
-
### Example 1: Basic Usage
|
|
374
|
-
|
|
375
|
-
```bash
|
|
376
|
-
/sw:embed-acs 0050
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
**Output**:
|
|
380
|
-
```
|
|
381
|
-
Embedding ACs from living docs for increment 0050-external-tool-import-phase-1b-7...
|
|
382
|
-
|
|
383
|
-
Living docs path: .specweave/docs/internal/specs/specweave/FS-048/
|
|
384
|
-
|
|
385
|
-
Extracting ACs...
|
|
386
|
-
✓ US-001: 5 ACs
|
|
387
|
-
✓ US-002: 4 ACs
|
|
388
|
-
✓ US-004: 5 ACs
|
|
389
|
-
✓ US-005: 7 ACs
|
|
390
|
-
✓ US-006: 6 ACs
|
|
391
|
-
✓ US-007: 6 ACs
|
|
392
|
-
✓ US-008: 6 ACs
|
|
393
|
-
|
|
394
|
-
✅ Embedded 39 ACs into spec.md
|
|
395
|
-
✅ Updated metadata.json (total_acs: 39)
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Example 2: Dry Run
|
|
399
|
-
|
|
400
|
-
```bash
|
|
401
|
-
/sw:embed-acs 0050 --dry-run
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
**Output**:
|
|
405
|
-
```
|
|
406
|
-
[DRY RUN] Embedding ACs for increment 0050...
|
|
407
|
-
|
|
408
|
-
Would extract 39 ACs from 7 user stories.
|
|
409
|
-
No files would be modified.
|
|
410
|
-
|
|
411
|
-
To apply changes, run without --dry-run flag.
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
### Example 3: Manual Path
|
|
415
|
-
|
|
416
|
-
```bash
|
|
417
|
-
/sw:embed-acs 0050 --living-docs-path .specweave/docs/internal/specs/custom/FS-048
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
**Output**:
|
|
421
|
-
```
|
|
422
|
-
Using custom living docs path: .specweave/docs/internal/specs/custom/FS-048
|
|
423
|
-
|
|
424
|
-
Extracting ACs...
|
|
425
|
-
✓ US-001: 5 ACs
|
|
426
|
-
...
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
## Related Commands
|
|
430
|
-
|
|
431
|
-
- `/sw:increment`: Create new increment (should auto-embed ACs)
|
|
432
|
-
- `/sw:validate`: Validate increment (checks AC presence)
|
|
433
|
-
- `/sw:do`: Start increment (pre-start hook validates ACs)
|
|
434
|
-
- `/sw:sync-docs`: Sync living documentation
|
|
435
|
-
|
|
436
|
-
## Related Documentation
|
|
437
|
-
|
|
438
|
-
- **ADR-0062**: AC Embedding Architecture
|
|
439
|
-
- **CLAUDE.md**: Rule #X (spec.md AC presence requirement)
|
|
440
|
-
- **src/utils/ac-embedder.ts**: AC embedding utility (implementation)
|
|
441
|
-
- **src/core/validators/ac-presence-validator.ts**: AC presence validation
|
|
442
|
-
|
|
443
|
-
---
|
|
444
|
-
|
|
445
|
-
**Important**: This command should NOT be needed in the future if spec generators are updated to auto-embed ACs during increment creation. Consider this a **migration/fix utility** for existing increments.
|