@eskoubar95/spec 0.1.0 → 0.1.2
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/dist/commands/help.d.ts +5 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +23 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +30 -14
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +5 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +88 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/update.d.ts +5 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +72 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/workspace.d.ts +5 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +17 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/index.js +42 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/backup-cursor.d.ts +16 -0
- package/dist/lib/backup-cursor.d.ts.map +1 -0
- package/dist/lib/backup-cursor.js +50 -0
- package/dist/lib/backup-cursor.js.map +1 -0
- package/dist/lib/copy-template.d.ts +9 -1
- package/dist/lib/copy-template.d.ts.map +1 -1
- package/dist/lib/copy-template.js +94 -3
- package/dist/lib/copy-template.js.map +1 -1
- package/dist/lib/cursor-detection.d.ts +6 -0
- package/dist/lib/cursor-detection.d.ts.map +1 -0
- package/dist/lib/cursor-detection.js +31 -0
- package/dist/lib/cursor-detection.js.map +1 -0
- package/dist/lib/detection.d.ts +25 -0
- package/dist/lib/detection.d.ts.map +1 -0
- package/dist/lib/detection.js +186 -0
- package/dist/lib/detection.js.map +1 -0
- package/dist/lib/install-existing.d.ts +6 -0
- package/dist/lib/install-existing.d.ts.map +1 -0
- package/dist/lib/install-existing.js +63 -0
- package/dist/lib/install-existing.js.map +1 -0
- package/dist/lib/project-name.d.ts +7 -0
- package/dist/lib/project-name.d.ts.map +1 -0
- package/dist/lib/project-name.js +13 -0
- package/dist/lib/project-name.js.map +1 -0
- package/dist/lib/prompts.d.ts +6 -5
- package/dist/lib/prompts.d.ts.map +1 -1
- package/dist/lib/prompts.js +114 -0
- package/dist/lib/prompts.js.map +1 -1
- package/dist/lib/version-check.d.ts +21 -0
- package/dist/lib/version-check.d.ts.map +1 -0
- package/dist/lib/version-check.js +49 -0
- package/dist/lib/version-check.js.map +1 -0
- package/dist/lib/workspace.d.ts +7 -0
- package/dist/lib/workspace.d.ts.map +1 -0
- package/dist/lib/workspace.js +38 -0
- package/dist/lib/workspace.js.map +1 -0
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +2 -2
- package/template/.cursor/commands/_shared/activation.md +220 -0
- package/template/.cursor/commands/_shared/coderabbit-integration.md +278 -0
- package/template/.cursor/commands/_shared/command-stacks.md +124 -0
- package/template/.cursor/commands/_shared/deployment-detection.md +294 -0
- package/template/.cursor/commands/_shared/detection.md +277 -0
- package/template/.cursor/commands/_shared/documentation-lookup.md +321 -0
- package/template/.cursor/commands/_shared/git-workflow.md +288 -0
- package/template/.cursor/commands/_shared/github-helpers.md +337 -0
- package/template/.cursor/commands/_shared/github-workflows.md +351 -0
- package/template/.cursor/commands/_shared/helper-metadata.md +481 -0
- package/template/.cursor/commands/_shared/linear-automation.md +388 -0
- package/template/.cursor/commands/_shared/linear-helpers.md +254 -0
- package/template/.cursor/commands/_shared/performance-monitoring.md +369 -0
- package/template/.cursor/commands/_shared/pr-description.md +279 -0
- package/template/.cursor/commands/_shared/retrospective-spec-creation.md +977 -0
- package/template/.cursor/commands/_shared/scaling.md +264 -0
- package/template/.cursor/commands/_shared/state-assertions.md +174 -0
- package/template/.cursor/commands/_shared/test-automation.md +388 -0
- package/template/.cursor/commands/_shared/verification-checkpoints.md +145 -0
- package/template/.cursor/commands/spec/audit.md +240 -0
- package/template/.cursor/commands/spec/evolve.md +163 -0
- package/template/.cursor/commands/spec/sync.md +196 -0
- package/template/.cursor/commands/tools/refactor.md +555 -0
- package/template/.cursor/rules/10-engineering.mdc +149 -0
- package/template/.cursor/rules/11-design.mdc +129 -0
- package/template/.cursor/rules/12-business.mdc +132 -0
- package/template/.cursor/rules/20-nextjs.mdc +146 -0
- package/template/.cursor/rules/21-api-design.mdc +176 -0
- package/template/.cursor/rules/30-database.mdc +183 -0
- package/template/.cursor/rules/31-testing.mdc +191 -0
- package/template/.cursor/scripts/validate-helpers.js +254 -0
- package/template/.sdd/detection-cache.json +1 -0
- package/template/.sdd/install-info.json +1 -0
- package/template/.sdd/version +1 -0
- package/template/spec/00-root-spec.md +8 -1
- package/template/work/backlog/tasks.local.md +92 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
---
|
|
2
|
+
helper_id: test-automation
|
|
3
|
+
load_when:
|
|
4
|
+
- test_framework_detected
|
|
5
|
+
- validation_step
|
|
6
|
+
- refactoring_analysis
|
|
7
|
+
sections:
|
|
8
|
+
detection:
|
|
9
|
+
title: "Test Framework Detection"
|
|
10
|
+
lines: [39, 67]
|
|
11
|
+
execution:
|
|
12
|
+
title: "Test Execution"
|
|
13
|
+
lines: [68, 154]
|
|
14
|
+
coverage:
|
|
15
|
+
title: "Test Coverage Tracking"
|
|
16
|
+
lines: [180, 207]
|
|
17
|
+
failure_detection:
|
|
18
|
+
title: "Test Failure Detection"
|
|
19
|
+
lines: [233, 247]
|
|
20
|
+
generation:
|
|
21
|
+
title: "Test Generation Assistance"
|
|
22
|
+
lines: [273, 273]
|
|
23
|
+
always_load: false
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Test Automation Integration
|
|
27
|
+
|
|
28
|
+
This helper provides logic for automatic test framework detection, test execution, coverage tracking, and test generation assistance - all framework-agnostic and dynamically adaptable.
|
|
29
|
+
|
|
30
|
+
## Purpose
|
|
31
|
+
|
|
32
|
+
Automate test-related operations:
|
|
33
|
+
- Detect test frameworks automatically
|
|
34
|
+
- Run tests automatically during validation
|
|
35
|
+
- Track test coverage
|
|
36
|
+
- Detect test failures
|
|
37
|
+
- Assist with test generation
|
|
38
|
+
|
|
39
|
+
## Section: Test Framework Detection (Lines 14-67)
|
|
40
|
+
|
|
41
|
+
### Detection Methods
|
|
42
|
+
|
|
43
|
+
**Method 1: Package.json Dependencies**
|
|
44
|
+
- Check `package.json` for test framework dependencies
|
|
45
|
+
- Common frameworks:
|
|
46
|
+
- `jest` → Jest
|
|
47
|
+
- `vitest` → Vitest
|
|
48
|
+
- `@playwright/test` → Playwright
|
|
49
|
+
- `cypress` → Cypress
|
|
50
|
+
- `mocha` → Mocha
|
|
51
|
+
- `ava` → Ava
|
|
52
|
+
- `tape` → Tape
|
|
53
|
+
- `jasmine` → Jasmine
|
|
54
|
+
- `pytest` → pytest (Python)
|
|
55
|
+
- `unittest` → unittest (Python)
|
|
56
|
+
|
|
57
|
+
**Method 2: Config Files**
|
|
58
|
+
- Check for framework-specific config files:
|
|
59
|
+
- `jest.config.js`, `jest.config.ts`, `jest.config.json`
|
|
60
|
+
- `vitest.config.ts`, `vitest.config.js`
|
|
61
|
+
- `playwright.config.ts`, `playwright.config.js`
|
|
62
|
+
- `cypress.config.js`, `cypress.config.ts`
|
|
63
|
+
- `mocha.opts`, `.mocharc.js`
|
|
64
|
+
- `pytest.ini`, `setup.cfg` (Python)
|
|
65
|
+
- `pytest.ini`, `tox.ini` (Python)
|
|
66
|
+
|
|
67
|
+
**Method 3: Test Scripts**
|
|
68
|
+
- Check `package.json` scripts for test commands:
|
|
69
|
+
- `test`, `test:unit`, `test:integration`, `test:e2e`
|
|
70
|
+
- Parse script to identify framework
|
|
71
|
+
|
|
72
|
+
**Method 4: File Patterns**
|
|
73
|
+
- Check for test file patterns:
|
|
74
|
+
- `**/*.test.ts`, `**/*.test.tsx`, `**/*.test.js`
|
|
75
|
+
- `**/*.spec.ts`, `**/*.spec.tsx`, `**/*.spec.js`
|
|
76
|
+
- `**/__tests__/**`
|
|
77
|
+
- `**/tests/**`
|
|
78
|
+
|
|
79
|
+
### Framework Detection Priority
|
|
80
|
+
|
|
81
|
+
1. **Check package.json dependencies** (most reliable)
|
|
82
|
+
2. **Check config files** (framework-specific)
|
|
83
|
+
3. **Check test scripts** (fallback)
|
|
84
|
+
4. **Check file patterns** (last resort)
|
|
85
|
+
|
|
86
|
+
### Multiple Framework Support
|
|
87
|
+
|
|
88
|
+
**If multiple frameworks detected:**
|
|
89
|
+
- Support running all detected frameworks
|
|
90
|
+
- Prioritize by usage (most test files)
|
|
91
|
+
- Allow user to specify which to run
|
|
92
|
+
|
|
93
|
+
## Test Execution
|
|
94
|
+
|
|
95
|
+
### Framework-Agnostic Test Runner
|
|
96
|
+
|
|
97
|
+
**Detection-based execution:**
|
|
98
|
+
1. Detect test framework
|
|
99
|
+
2. Determine test command based on framework
|
|
100
|
+
3. Execute test command
|
|
101
|
+
4. Parse test output
|
|
102
|
+
5. Report results
|
|
103
|
+
|
|
104
|
+
### Test Commands by Framework
|
|
105
|
+
|
|
106
|
+
**Jest:**
|
|
107
|
+
- `npm test` or `jest`
|
|
108
|
+
- `npm test -- --coverage` (with coverage)
|
|
109
|
+
|
|
110
|
+
**Vitest:**
|
|
111
|
+
- `npm test` or `vitest run`
|
|
112
|
+
- `npm test -- --coverage` (with coverage)
|
|
113
|
+
|
|
114
|
+
**Playwright:**
|
|
115
|
+
- `npx playwright test`
|
|
116
|
+
- `npx playwright test --reporter=json` (JSON output)
|
|
117
|
+
|
|
118
|
+
**Cypress:**
|
|
119
|
+
- `npx cypress run`
|
|
120
|
+
- `npx cypress run --headless`
|
|
121
|
+
|
|
122
|
+
**Mocha:**
|
|
123
|
+
- `npm test` or `mocha`
|
|
124
|
+
- `npm test -- --reporter json` (JSON output)
|
|
125
|
+
|
|
126
|
+
**pytest (Python):**
|
|
127
|
+
- `pytest`
|
|
128
|
+
- `pytest --cov` (with coverage)
|
|
129
|
+
|
|
130
|
+
### Test Execution Options
|
|
131
|
+
|
|
132
|
+
**Standard execution:**
|
|
133
|
+
- Run all tests
|
|
134
|
+
- Parse output for pass/fail
|
|
135
|
+
- Report summary
|
|
136
|
+
|
|
137
|
+
**Coverage execution:**
|
|
138
|
+
- Run tests with coverage flag
|
|
139
|
+
- Collect coverage data
|
|
140
|
+
- Generate coverage report
|
|
141
|
+
|
|
142
|
+
**Watch mode (optional):**
|
|
143
|
+
- Run tests in watch mode
|
|
144
|
+
- Re-run on file changes
|
|
145
|
+
- User can enable/disable
|
|
146
|
+
|
|
147
|
+
### Test Output Parsing
|
|
148
|
+
|
|
149
|
+
**Parse test results:**
|
|
150
|
+
- Pass/fail count
|
|
151
|
+
- Test names and status
|
|
152
|
+
- Error messages
|
|
153
|
+
- Execution time
|
|
154
|
+
- Coverage percentage (if available)
|
|
155
|
+
|
|
156
|
+
**Output format:**
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"framework": "jest",
|
|
160
|
+
"passed": 45,
|
|
161
|
+
"failed": 2,
|
|
162
|
+
"skipped": 1,
|
|
163
|
+
"total": 48,
|
|
164
|
+
"duration": 3.2,
|
|
165
|
+
"coverage": {
|
|
166
|
+
"lines": 85.5,
|
|
167
|
+
"functions": 90.2,
|
|
168
|
+
"branches": 78.3,
|
|
169
|
+
"statements": 85.5
|
|
170
|
+
},
|
|
171
|
+
"failures": [
|
|
172
|
+
{
|
|
173
|
+
"test": "UserService should handle errors",
|
|
174
|
+
"error": "Expected error but got success"
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Section: Test Coverage Tracking (Lines 155-207)
|
|
181
|
+
|
|
182
|
+
### Coverage Collection
|
|
183
|
+
|
|
184
|
+
**Framework-specific coverage:**
|
|
185
|
+
- Jest: `--coverage` flag
|
|
186
|
+
- Vitest: `--coverage` flag
|
|
187
|
+
- pytest: `--cov` flag
|
|
188
|
+
- Other frameworks: Check framework-specific coverage tools
|
|
189
|
+
|
|
190
|
+
### Coverage Metrics
|
|
191
|
+
|
|
192
|
+
**Collect coverage data:**
|
|
193
|
+
- Line coverage percentage
|
|
194
|
+
- Function coverage percentage
|
|
195
|
+
- Branch coverage percentage
|
|
196
|
+
- Statement coverage percentage
|
|
197
|
+
- Per-file coverage
|
|
198
|
+
|
|
199
|
+
### Coverage Reports
|
|
200
|
+
|
|
201
|
+
**Generate coverage reports:**
|
|
202
|
+
- HTML reports (if framework supports)
|
|
203
|
+
- JSON reports (for parsing)
|
|
204
|
+
- Console output (for quick view)
|
|
205
|
+
|
|
206
|
+
### Coverage Tracking
|
|
207
|
+
|
|
208
|
+
**Track coverage over time:**
|
|
209
|
+
- Store coverage data in `.sdd/test-coverage.json`
|
|
210
|
+
- Compare coverage before/after changes
|
|
211
|
+
- Alert if coverage decreases significantly
|
|
212
|
+
|
|
213
|
+
**Coverage file format:**
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"timestamp": "2026-01-07T12:00:00Z",
|
|
217
|
+
"framework": "jest",
|
|
218
|
+
"overall": {
|
|
219
|
+
"lines": 85.5,
|
|
220
|
+
"functions": 90.2,
|
|
221
|
+
"branches": 78.3,
|
|
222
|
+
"statements": 85.5
|
|
223
|
+
},
|
|
224
|
+
"files": {
|
|
225
|
+
"src/auth/service.ts": {
|
|
226
|
+
"lines": 95.0,
|
|
227
|
+
"functions": 100.0
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Section: Test Failure Detection (Lines 208-247)
|
|
234
|
+
|
|
235
|
+
### Failure Analysis
|
|
236
|
+
|
|
237
|
+
**Detect test failures:**
|
|
238
|
+
- Parse test output for failures
|
|
239
|
+
- Identify failed tests
|
|
240
|
+
- Extract error messages
|
|
241
|
+
- Categorize failures (syntax errors, assertion failures, timeouts, etc.)
|
|
242
|
+
|
|
243
|
+
### Failure Reporting
|
|
244
|
+
|
|
245
|
+
**Report failures:**
|
|
246
|
+
- List failed tests
|
|
247
|
+
- Show error messages
|
|
248
|
+
- Suggest fixes (if possible)
|
|
249
|
+
- Block PR if configured (optional)
|
|
250
|
+
|
|
251
|
+
### Failure Categories
|
|
252
|
+
|
|
253
|
+
**Syntax errors:**
|
|
254
|
+
- Code compilation errors
|
|
255
|
+
- Import errors
|
|
256
|
+
- Type errors
|
|
257
|
+
|
|
258
|
+
**Assertion failures:**
|
|
259
|
+
- Test expectations not met
|
|
260
|
+
- Wrong values returned
|
|
261
|
+
- Missing functionality
|
|
262
|
+
|
|
263
|
+
**Timeouts:**
|
|
264
|
+
- Tests taking too long
|
|
265
|
+
- Async operations not completing
|
|
266
|
+
- Network timeouts
|
|
267
|
+
|
|
268
|
+
**Setup/Teardown errors:**
|
|
269
|
+
- Test environment issues
|
|
270
|
+
- Database connection errors
|
|
271
|
+
- Mock setup failures
|
|
272
|
+
|
|
273
|
+
## Section: Test Generation Assistance (Lines 248-273)
|
|
274
|
+
|
|
275
|
+
### Test Suggestions
|
|
276
|
+
|
|
277
|
+
**For new features:**
|
|
278
|
+
- Analyze code to identify test cases
|
|
279
|
+
- Suggest unit tests for functions
|
|
280
|
+
- Suggest integration tests for APIs
|
|
281
|
+
- Suggest E2E tests for user flows
|
|
282
|
+
|
|
283
|
+
### Test Template Generation
|
|
284
|
+
|
|
285
|
+
**Based on code structure:**
|
|
286
|
+
- Generate test templates for functions
|
|
287
|
+
- Generate test templates for components
|
|
288
|
+
- Generate test templates for API endpoints
|
|
289
|
+
- Include common test patterns
|
|
290
|
+
|
|
291
|
+
### Missing Coverage Detection
|
|
292
|
+
|
|
293
|
+
**Identify untested code:**
|
|
294
|
+
- Compare code with test files
|
|
295
|
+
- Identify functions without tests
|
|
296
|
+
- Identify components without tests
|
|
297
|
+
- Suggest tests for critical paths
|
|
298
|
+
|
|
299
|
+
## Integration Points
|
|
300
|
+
|
|
301
|
+
### In `/task/validate`:
|
|
302
|
+
|
|
303
|
+
**After automated checks:**
|
|
304
|
+
1. Detect test framework
|
|
305
|
+
2. If framework detected → run tests
|
|
306
|
+
3. Parse test results
|
|
307
|
+
4. Report pass/fail status
|
|
308
|
+
5. If tests fail → block validation (if configured)
|
|
309
|
+
6. Collect coverage (if enabled)
|
|
310
|
+
|
|
311
|
+
### In `/spec/plan`:
|
|
312
|
+
|
|
313
|
+
**When creating tasks:**
|
|
314
|
+
1. Check if testing is required for task
|
|
315
|
+
2. If yes → add test requirements to task
|
|
316
|
+
3. Suggest test types (unit, integration, E2E)
|
|
317
|
+
4. Include test acceptance criteria
|
|
318
|
+
|
|
319
|
+
### In GitHub Actions:
|
|
320
|
+
|
|
321
|
+
**In CI workflows:**
|
|
322
|
+
1. Add test execution step
|
|
323
|
+
2. Run tests on every PR
|
|
324
|
+
3. Collect coverage
|
|
325
|
+
4. Report test results
|
|
326
|
+
5. Block merge if tests fail (if configured)
|
|
327
|
+
|
|
328
|
+
## Error Handling
|
|
329
|
+
|
|
330
|
+
- **Test framework not detected:** Skip test execution, continue workflow
|
|
331
|
+
- **Test execution fails:** Report error, continue workflow (unless blocking configured)
|
|
332
|
+
- **Coverage collection fails:** Skip coverage, continue workflow
|
|
333
|
+
- **Test parsing fails:** Report raw output, continue workflow
|
|
334
|
+
- **Never block workflow:** All test features optional unless explicitly configured
|
|
335
|
+
|
|
336
|
+
## Configuration
|
|
337
|
+
|
|
338
|
+
### Test Configuration Options
|
|
339
|
+
|
|
340
|
+
**Via spec or config:**
|
|
341
|
+
- `RUN_TESTS_ON_VALIDATE=true/false` (default: true)
|
|
342
|
+
- `REQUIRE_TESTS_PASS=true/false` (default: false)
|
|
343
|
+
- `COLLECT_COVERAGE=true/false` (default: true)
|
|
344
|
+
- `COVERAGE_THRESHOLD=80` (minimum coverage percentage)
|
|
345
|
+
- `TEST_FRAMEWORK=jest` (override auto-detection)
|
|
346
|
+
|
|
347
|
+
### Sensible Defaults
|
|
348
|
+
|
|
349
|
+
- Run tests on validate: **true**
|
|
350
|
+
- Require tests pass: **false** (warn only)
|
|
351
|
+
- Collect coverage: **true**
|
|
352
|
+
- Coverage threshold: **none** (report only)
|
|
353
|
+
|
|
354
|
+
## Best Practices
|
|
355
|
+
|
|
356
|
+
1. **Auto-detect framework:** Don't require manual configuration
|
|
357
|
+
2. **Graceful degradation:** Work even if tests unavailable
|
|
358
|
+
3. **Report clearly:** Show test results clearly
|
|
359
|
+
4. **Don't block by default:** Tests are helpful but not blocking unless configured
|
|
360
|
+
5. **Coverage tracking:** Track coverage trends over time
|
|
361
|
+
|
|
362
|
+
## Examples
|
|
363
|
+
|
|
364
|
+
### Example 1: Jest Detection and Execution
|
|
365
|
+
|
|
366
|
+
**Detection:** `jest` in package.json
|
|
367
|
+
**Command:** `npm test`
|
|
368
|
+
**Output:** Parse Jest output
|
|
369
|
+
**Coverage:** `npm test -- --coverage`
|
|
370
|
+
|
|
371
|
+
### Example 2: Vitest Detection
|
|
372
|
+
|
|
373
|
+
**Detection:** `vitest` in package.json
|
|
374
|
+
**Command:** `npm test` or `vitest run`
|
|
375
|
+
**Coverage:** `vitest run --coverage`
|
|
376
|
+
|
|
377
|
+
### Example 3: Multiple Frameworks
|
|
378
|
+
|
|
379
|
+
**Detection:** Both `jest` and `@playwright/test` found
|
|
380
|
+
**Action:** Run both (unit tests + E2E tests)
|
|
381
|
+
**Report:** Combined results
|
|
382
|
+
|
|
383
|
+
### Example 4: No Framework Detected
|
|
384
|
+
|
|
385
|
+
**Detection:** No test framework found
|
|
386
|
+
**Action:** Skip test execution
|
|
387
|
+
**Report:** "No test framework detected. Skipping test execution."
|
|
388
|
+
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
helper_id: verification-checkpoints
|
|
3
|
+
load_when:
|
|
4
|
+
- file_creation
|
|
5
|
+
- file_modification
|
|
6
|
+
- critical_operation
|
|
7
|
+
sections:
|
|
8
|
+
gates:
|
|
9
|
+
title: "Verification Gates"
|
|
10
|
+
lines: [1, 50]
|
|
11
|
+
critical_files:
|
|
12
|
+
title: "Critical Files"
|
|
13
|
+
lines: [51, 100]
|
|
14
|
+
always_load: false
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Verification Checkpoints
|
|
18
|
+
|
|
19
|
+
Verification checkpoints provide safety gates before creating or modifying critical files.
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
Verification checkpoints ensure:
|
|
24
|
+
- **File Safety**: Prevent accidental overwrites or incorrect file creation
|
|
25
|
+
- **Path Correctness**: Verify directory structure and file naming
|
|
26
|
+
- **Content Alignment**: Ensure content matches command purpose
|
|
27
|
+
- **User Control**: Give user explicit control over critical file operations
|
|
28
|
+
|
|
29
|
+
## Critical Files
|
|
30
|
+
|
|
31
|
+
The following files are considered critical and require verification checkpoints:
|
|
32
|
+
|
|
33
|
+
- `spec/00-root-spec.md` - Root specification (project foundation)
|
|
34
|
+
- `work/backlog/tasks.local.md` - Task definitions (execution plan)
|
|
35
|
+
- `work/backlog/milestones.md` - Milestone definitions (project structure)
|
|
36
|
+
- `spec/tasks/[task-id]/spec.md` - Task-level specifications (if created)
|
|
37
|
+
- `spec/tasks/[task-id]/acceptance.md` - Task-level acceptance criteria (if created)
|
|
38
|
+
|
|
39
|
+
## Checkpoint Protocol
|
|
40
|
+
|
|
41
|
+
**Before creating or modifying a critical file, verify:**
|
|
42
|
+
|
|
43
|
+
1. **File Existence Check:**
|
|
44
|
+
- Check if file already exists
|
|
45
|
+
- If exists → ask: "File exists. Overwrite, append, or skip?"
|
|
46
|
+
- Wait for user decision before proceeding
|
|
47
|
+
|
|
48
|
+
2. **File Path Verification:**
|
|
49
|
+
- Verify directory structure exists (create if needed)
|
|
50
|
+
- Verify file naming matches convention
|
|
51
|
+
- Verify file path is correct relative to project root
|
|
52
|
+
|
|
53
|
+
3. **Content Alignment:**
|
|
54
|
+
- Verify content matches command purpose
|
|
55
|
+
- Verify no conflicting information with existing files
|
|
56
|
+
- Verify content aligns with project-level spec (if applicable)
|
|
57
|
+
|
|
58
|
+
4. **User Confirmation:**
|
|
59
|
+
- For critical files → ask: "Ready to create [file]?"
|
|
60
|
+
- Wait for explicit confirmation
|
|
61
|
+
- For non-critical files → proceed if safe
|
|
62
|
+
|
|
63
|
+
## Checkpoint Format
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
## Verification Checkpoint (Before File Creation)
|
|
67
|
+
|
|
68
|
+
**Before creating [critical file], verify:**
|
|
69
|
+
|
|
70
|
+
1. **File doesn't exist:**
|
|
71
|
+
- Check if `[file path]` exists
|
|
72
|
+
- If exists → ask: "File exists. Overwrite, append, or skip?"
|
|
73
|
+
- Wait for user decision
|
|
74
|
+
|
|
75
|
+
2. **File path is correct:**
|
|
76
|
+
- Verify directory structure exists: `[directory path]`
|
|
77
|
+
- Verify file naming matches convention: `[naming pattern]`
|
|
78
|
+
- Create directory if needed
|
|
79
|
+
|
|
80
|
+
3. **Content aligns with command purpose:**
|
|
81
|
+
- Verify content matches command purpose: [purpose]
|
|
82
|
+
- Verify no conflicting information
|
|
83
|
+
- Verify alignment with project-level spec (if applicable)
|
|
84
|
+
|
|
85
|
+
4. **User confirmation:**
|
|
86
|
+
- Ask: "Ready to create [file]?"
|
|
87
|
+
- Wait for confirmation before proceeding
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Usage in Commands
|
|
91
|
+
|
|
92
|
+
Commands that create or modify critical files must:
|
|
93
|
+
1. Run verification checkpoint before file operation
|
|
94
|
+
2. Wait for user confirmation if file exists
|
|
95
|
+
3. Verify path and content alignment
|
|
96
|
+
4. Proceed only after verification passes
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
99
|
+
|
|
100
|
+
**Example 1: Creating Root Spec**
|
|
101
|
+
```markdown
|
|
102
|
+
## Verification Checkpoint (Before File Creation)
|
|
103
|
+
|
|
104
|
+
**Before creating spec/00-root-spec.md, verify:**
|
|
105
|
+
|
|
106
|
+
1. **File doesn't exist:**
|
|
107
|
+
- Check if `spec/00-root-spec.md` exists
|
|
108
|
+
- If exists → ask: "File exists. Overwrite, append, or skip?"
|
|
109
|
+
|
|
110
|
+
2. **File path is correct:**
|
|
111
|
+
- Verify `spec/` directory exists
|
|
112
|
+
- Verify file naming: `00-root-spec.md`
|
|
113
|
+
|
|
114
|
+
3. **Content aligns with command purpose:**
|
|
115
|
+
- Verify content matches /spec/init purpose: Create initial root specification
|
|
116
|
+
- Verify no conflicting information
|
|
117
|
+
|
|
118
|
+
4. **User confirmation:**
|
|
119
|
+
- Ask: "Ready to create spec/00-root-spec.md?"
|
|
120
|
+
- Wait for confirmation
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Example 2: Creating Tasks File**
|
|
124
|
+
```markdown
|
|
125
|
+
## Verification Checkpoint (Before File Creation)
|
|
126
|
+
|
|
127
|
+
**Before creating work/backlog/tasks.local.md, verify:**
|
|
128
|
+
|
|
129
|
+
1. **File doesn't exist:**
|
|
130
|
+
- Check if `work/backlog/tasks.local.md` exists
|
|
131
|
+
- If exists → ask: "File exists. Overwrite, append, or skip?"
|
|
132
|
+
|
|
133
|
+
2. **File path is correct:**
|
|
134
|
+
- Verify `work/backlog/` directory exists (create if needed)
|
|
135
|
+
- Verify file naming: `tasks.local.md`
|
|
136
|
+
|
|
137
|
+
3. **Content aligns with command purpose:**
|
|
138
|
+
- Verify content matches /spec/plan purpose: Create task definitions
|
|
139
|
+
- Verify tasks are traceable to spec
|
|
140
|
+
|
|
141
|
+
4. **User confirmation:**
|
|
142
|
+
- Ask: "Ready to create work/backlog/tasks.local.md?"
|
|
143
|
+
- Wait for confirmation
|
|
144
|
+
```
|
|
145
|
+
|