ai-sprint-kit 1.1.0
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/README.md +299 -0
- package/bin/cli.js +135 -0
- package/lib/installer.js +205 -0
- package/lib/scanner.js +341 -0
- package/package.json +55 -0
- package/templates/.claude/.env.example +13 -0
- package/templates/.claude/agents/debugger.md +667 -0
- package/templates/.claude/agents/devops.md +727 -0
- package/templates/.claude/agents/docs.md +661 -0
- package/templates/.claude/agents/implementer.md +235 -0
- package/templates/.claude/agents/planner.md +243 -0
- package/templates/.claude/agents/researcher.md +448 -0
- package/templates/.claude/agents/reviewer.md +610 -0
- package/templates/.claude/agents/security.md +202 -0
- package/templates/.claude/agents/tester.md +604 -0
- package/templates/.claude/commands/auto.md +85 -0
- package/templates/.claude/commands/code.md +301 -0
- package/templates/.claude/commands/debug.md +449 -0
- package/templates/.claude/commands/deploy.md +475 -0
- package/templates/.claude/commands/docs.md +519 -0
- package/templates/.claude/commands/plan.md +57 -0
- package/templates/.claude/commands/review.md +412 -0
- package/templates/.claude/commands/scan.md +146 -0
- package/templates/.claude/commands/secure.md +88 -0
- package/templates/.claude/commands/test.md +352 -0
- package/templates/.claude/commands/validate.md +238 -0
- package/templates/.claude/settings.json +27 -0
- package/templates/.claude/skills/codebase-context/SKILL.md +68 -0
- package/templates/.claude/skills/codebase-context/references/reading-context.md +68 -0
- package/templates/.claude/skills/codebase-context/references/refresh-triggers.md +82 -0
- package/templates/.claude/skills/implementation/SKILL.md +70 -0
- package/templates/.claude/skills/implementation/references/error-handling.md +106 -0
- package/templates/.claude/skills/implementation/references/security-patterns.md +73 -0
- package/templates/.claude/skills/implementation/references/validation-patterns.md +107 -0
- package/templates/.claude/skills/memory/SKILL.md +67 -0
- package/templates/.claude/skills/memory/references/decisions-format.md +68 -0
- package/templates/.claude/skills/memory/references/learning-format.md +74 -0
- package/templates/.claude/skills/planning/SKILL.md +72 -0
- package/templates/.claude/skills/planning/references/plan-templates.md +81 -0
- package/templates/.claude/skills/planning/references/research-phase.md +62 -0
- package/templates/.claude/skills/planning/references/solution-design.md +66 -0
- package/templates/.claude/skills/quality-assurance/SKILL.md +79 -0
- package/templates/.claude/skills/quality-assurance/references/review-checklist.md +72 -0
- package/templates/.claude/skills/quality-assurance/references/security-checklist.md +70 -0
- package/templates/.claude/skills/quality-assurance/references/testing-strategy.md +85 -0
- package/templates/.claude/statusline.sh +126 -0
- package/templates/.claude/workflows/development-rules.md +97 -0
- package/templates/.claude/workflows/orchestration-protocol.md +194 -0
- package/templates/.mcp.json.example +36 -0
- package/templates/CLAUDE.md +409 -0
- package/templates/README.md +331 -0
- package/templates/ai_context/codebase/.gitkeep +0 -0
- package/templates/ai_context/memory/active.md +15 -0
- package/templates/ai_context/memory/decisions.md +18 -0
- package/templates/ai_context/memory/learning.md +22 -0
- package/templates/ai_context/plans/.gitkeep +0 -0
- package/templates/ai_context/reports/.gitkeep +0 -0
- package/templates/docs/user-guide-th.md +454 -0
- package/templates/docs/user-guide.md +595 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate and run automated tests with coverage analysis
|
|
3
|
+
argument-hint: [optional: specific file or feature to test]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Command: /test
|
|
7
|
+
|
|
8
|
+
Generate comprehensive test suites and run them with coverage analysis. Ensures >80% code coverage with focus on critical paths.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
/test
|
|
14
|
+
/test src/auth/
|
|
15
|
+
/test "payment processing"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
### 1. Analyze Codebase
|
|
21
|
+
- Identify untested code
|
|
22
|
+
- Find critical paths (auth, payments, data mutations)
|
|
23
|
+
- Check existing test patterns
|
|
24
|
+
|
|
25
|
+
### 2. Generate Tests
|
|
26
|
+
- **Unit tests** (70% of suite)
|
|
27
|
+
- **Integration tests** (20%)
|
|
28
|
+
- **E2E tests** (10%)
|
|
29
|
+
|
|
30
|
+
### 3. Run Test Suite
|
|
31
|
+
- Execute all tests
|
|
32
|
+
- Generate coverage report
|
|
33
|
+
- Identify gaps
|
|
34
|
+
|
|
35
|
+
### 4. Security Tests
|
|
36
|
+
- SQL injection prevention
|
|
37
|
+
- XSS prevention
|
|
38
|
+
- Auth bypass attempts
|
|
39
|
+
- CSRF protection
|
|
40
|
+
- Rate limiting
|
|
41
|
+
|
|
42
|
+
## Test Generation
|
|
43
|
+
|
|
44
|
+
### Unit Tests
|
|
45
|
+
```typescript
|
|
46
|
+
// Generated for: calculateDiscount function
|
|
47
|
+
describe('calculateDiscount', () => {
|
|
48
|
+
it('calculates 10% discount correctly', () => {
|
|
49
|
+
expect(calculateDiscount(100, 10)).toBe(90);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('handles zero discount', () => {
|
|
53
|
+
expect(calculateDiscount(100, 0)).toBe(100);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('throws on invalid percentage', () => {
|
|
57
|
+
expect(() => calculateDiscount(100, 150)).toThrow();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('handles decimal prices', () => {
|
|
61
|
+
expect(calculateDiscount(99.99, 20)).toBeCloseTo(79.99, 2);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Integration Tests
|
|
67
|
+
```typescript
|
|
68
|
+
// Generated for: POST /api/users endpoint
|
|
69
|
+
describe('POST /api/users', () => {
|
|
70
|
+
it('creates user with valid data', async () => {
|
|
71
|
+
const response = await request(app)
|
|
72
|
+
.post('/api/users')
|
|
73
|
+
.send({
|
|
74
|
+
email: 'test@example.com',
|
|
75
|
+
password: 'SecurePass123!'
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(response.status).toBe(201);
|
|
79
|
+
expect(response.body).toHaveProperty('id');
|
|
80
|
+
expect(response.body.email).toBe('test@example.com');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('rejects invalid email', async () => {
|
|
84
|
+
const response = await request(app)
|
|
85
|
+
.post('/api/users')
|
|
86
|
+
.send({
|
|
87
|
+
email: 'invalid-email',
|
|
88
|
+
password: 'SecurePass123!'
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect(response.status).toBe(400);
|
|
92
|
+
expect(response.body.error).toContain('email');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('requires strong password', async () => {
|
|
96
|
+
const response = await request(app)
|
|
97
|
+
.post('/api/users')
|
|
98
|
+
.send({
|
|
99
|
+
email: 'test@example.com',
|
|
100
|
+
password: '123'
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
expect(response.status).toBe(400);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Security Tests
|
|
109
|
+
```typescript
|
|
110
|
+
describe('Security: SQL Injection', () => {
|
|
111
|
+
it('prevents SQL injection in search', async () => {
|
|
112
|
+
const malicious = "'; DROP TABLE users; --";
|
|
113
|
+
|
|
114
|
+
const response = await request(app)
|
|
115
|
+
.get(`/api/search?q=${encodeURIComponent(malicious)}`);
|
|
116
|
+
|
|
117
|
+
expect(response.status).toBe(200);
|
|
118
|
+
|
|
119
|
+
// Verify database still intact
|
|
120
|
+
const users = await db.users.count();
|
|
121
|
+
expect(users).toBeGreaterThan(0);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe('Security: XSS Prevention', () => {
|
|
126
|
+
it('sanitizes HTML input', async () => {
|
|
127
|
+
const xss = '<script>alert("xss")</script>';
|
|
128
|
+
|
|
129
|
+
const response = await request(app)
|
|
130
|
+
.post('/api/comments')
|
|
131
|
+
.send({ text: xss });
|
|
132
|
+
|
|
133
|
+
const comment = await db.comments.findUnique({
|
|
134
|
+
where: { id: response.body.id }
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
expect(comment.text).not.toContain('<script>');
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe('Security: Authentication', () => {
|
|
142
|
+
it('rejects unauthenticated requests', async () => {
|
|
143
|
+
const response = await request(app)
|
|
144
|
+
.get('/api/private-data');
|
|
145
|
+
|
|
146
|
+
expect(response.status).toBe(401);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('rejects expired tokens', async () => {
|
|
150
|
+
const expiredToken = generateExpiredToken();
|
|
151
|
+
|
|
152
|
+
const response = await request(app)
|
|
153
|
+
.get('/api/private-data')
|
|
154
|
+
.set('Authorization', `Bearer ${expiredToken}`);
|
|
155
|
+
|
|
156
|
+
expect(response.status).toBe(401);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### E2E Tests
|
|
162
|
+
```typescript
|
|
163
|
+
// Generated with Playwright
|
|
164
|
+
test('complete checkout flow', async ({ page }) => {
|
|
165
|
+
// Login
|
|
166
|
+
await page.goto('/login');
|
|
167
|
+
await page.fill('[name="email"]', 'test@example.com');
|
|
168
|
+
await page.fill('[name="password"]', 'password');
|
|
169
|
+
await page.click('button[type="submit"]');
|
|
170
|
+
|
|
171
|
+
// Add to cart
|
|
172
|
+
await page.goto('/products');
|
|
173
|
+
await page.click('[data-testid="add-to-cart-1"]');
|
|
174
|
+
|
|
175
|
+
// Checkout
|
|
176
|
+
await page.goto('/checkout');
|
|
177
|
+
await page.fill('[name="cardNumber"]', '4242424242424242');
|
|
178
|
+
await page.fill('[name="expiry"]', '12/25');
|
|
179
|
+
await page.fill('[name="cvc"]', '123');
|
|
180
|
+
await page.click('button[type="submit"]');
|
|
181
|
+
|
|
182
|
+
// Verify success
|
|
183
|
+
await expect(page).toHaveURL('/order-confirmation');
|
|
184
|
+
await expect(page.locator('h1')).toContainText('Order Confirmed');
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Running Tests
|
|
189
|
+
|
|
190
|
+
### Commands
|
|
191
|
+
```bash
|
|
192
|
+
# Run all tests
|
|
193
|
+
npm test
|
|
194
|
+
|
|
195
|
+
# Run with coverage
|
|
196
|
+
npm test -- --coverage
|
|
197
|
+
|
|
198
|
+
# Run specific file
|
|
199
|
+
npm test -- users.test.ts
|
|
200
|
+
|
|
201
|
+
# Watch mode
|
|
202
|
+
npm test -- --watch
|
|
203
|
+
|
|
204
|
+
# Run E2E
|
|
205
|
+
npm run test:e2e
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Coverage Report
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
## Test Coverage Report
|
|
212
|
+
|
|
213
|
+
**Overall Coverage: 87.3%** ✅
|
|
214
|
+
|
|
215
|
+
### By Category
|
|
216
|
+
- Statements: 88.1%
|
|
217
|
+
- Branches: 82.4%
|
|
218
|
+
- Functions: 91.2%
|
|
219
|
+
- Lines: 87.3%
|
|
220
|
+
|
|
221
|
+
### Critical Paths (100% Required)
|
|
222
|
+
✅ Authentication: 100%
|
|
223
|
+
✅ Payment Processing: 100%
|
|
224
|
+
✅ Data Mutations: 98.5%
|
|
225
|
+
|
|
226
|
+
### Areas Needing Attention
|
|
227
|
+
⚠️ utils/legacy.ts: 45% (below threshold)
|
|
228
|
+
⚠️ api/webhooks.ts: 67% (below threshold)
|
|
229
|
+
|
|
230
|
+
### Security Tests
|
|
231
|
+
✅ SQL Injection: 15 tests passing
|
|
232
|
+
✅ XSS Prevention: 12 tests passing
|
|
233
|
+
✅ Auth Bypass: 8 tests passing
|
|
234
|
+
✅ CSRF Protection: 6 tests passing
|
|
235
|
+
|
|
236
|
+
### Test Execution
|
|
237
|
+
- Total tests: 1,247
|
|
238
|
+
- Passed: 1,245
|
|
239
|
+
- Failed: 2
|
|
240
|
+
- Duration: 12.3s
|
|
241
|
+
|
|
242
|
+
### Failed Tests
|
|
243
|
+
❌ api/users.test.ts:45 - should handle concurrent requests
|
|
244
|
+
❌ e2e/checkout.test.ts:89 - should process payment
|
|
245
|
+
|
|
246
|
+
### Recommendations
|
|
247
|
+
1. Fix failing tests immediately
|
|
248
|
+
2. Increase coverage in utils/legacy.ts
|
|
249
|
+
3. Add integration tests for webhooks
|
|
250
|
+
4. Consider performance benchmarks
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Success Criteria
|
|
254
|
+
|
|
255
|
+
Tests are successful when:
|
|
256
|
+
- ✅ Overall coverage ≥80%
|
|
257
|
+
- ✅ Critical paths 100% covered
|
|
258
|
+
- ✅ All tests pass
|
|
259
|
+
- ✅ No flaky tests
|
|
260
|
+
- ✅ Security tests included
|
|
261
|
+
- ✅ Fast execution (<30s)
|
|
262
|
+
|
|
263
|
+
## Integration with Other Commands
|
|
264
|
+
|
|
265
|
+
**/code** → **/test**
|
|
266
|
+
- After generating code, run /test to create test suite
|
|
267
|
+
|
|
268
|
+
**/test** → **/review**
|
|
269
|
+
- After tests pass, run /review for quality check
|
|
270
|
+
|
|
271
|
+
**/test** → **/secure**
|
|
272
|
+
- Security tests complement security scanning
|
|
273
|
+
|
|
274
|
+
## Test Quality
|
|
275
|
+
|
|
276
|
+
### Good Tests
|
|
277
|
+
- ✅ Fast (<100ms for unit tests)
|
|
278
|
+
- ✅ Isolated (no dependencies)
|
|
279
|
+
- ✅ Repeatable (same result every time)
|
|
280
|
+
- ✅ Clear (obvious what's being tested)
|
|
281
|
+
- ✅ Focused (one thing per test)
|
|
282
|
+
|
|
283
|
+
### Bad Tests
|
|
284
|
+
- ❌ Slow (wait for timeouts)
|
|
285
|
+
- ❌ Flaky (random failures)
|
|
286
|
+
- ❌ Testing implementation details
|
|
287
|
+
- ❌ Multiple assertions unrelated
|
|
288
|
+
- ❌ No clear failure message
|
|
289
|
+
|
|
290
|
+
## Common Test Patterns
|
|
291
|
+
|
|
292
|
+
### API Testing
|
|
293
|
+
```typescript
|
|
294
|
+
describe('GET /api/products', () => {
|
|
295
|
+
it('returns paginated products', async () => {
|
|
296
|
+
const response = await request(app)
|
|
297
|
+
.get('/api/products?page=1&limit=10');
|
|
298
|
+
|
|
299
|
+
expect(response.status).toBe(200);
|
|
300
|
+
expect(response.body.products).toHaveLength(10);
|
|
301
|
+
expect(response.body).toHaveProperty('total');
|
|
302
|
+
expect(response.body).toHaveProperty('page');
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Database Testing
|
|
308
|
+
```typescript
|
|
309
|
+
beforeEach(async () => {
|
|
310
|
+
await db.migrate.latest();
|
|
311
|
+
await db.seed.run();
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
afterEach(async () => {
|
|
315
|
+
await db.migrate.rollback();
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
test('creates user in database', async () => {
|
|
319
|
+
const user = await createUser({
|
|
320
|
+
email: 'test@example.com',
|
|
321
|
+
password: 'password'
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
const found = await db.users.findUnique({
|
|
325
|
+
where: { id: user.id }
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
expect(found.email).toBe('test@example.com');
|
|
329
|
+
});
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Async Testing
|
|
333
|
+
```typescript
|
|
334
|
+
test('async operation succeeds', async () => {
|
|
335
|
+
const result = await fetchData();
|
|
336
|
+
expect(result).toBeDefined();
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
test('async operation fails', async () => {
|
|
340
|
+
await expect(fetchInvalidData()).rejects.toThrow('Not found');
|
|
341
|
+
});
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Remember
|
|
345
|
+
|
|
346
|
+
**Testing is mandatory:**
|
|
347
|
+
- Production code requires tests
|
|
348
|
+
- >80% coverage enforced
|
|
349
|
+
- Security tests critical
|
|
350
|
+
- Regression tests prevent bugs
|
|
351
|
+
|
|
352
|
+
**Test early, test often.**
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run comprehensive validation (tests + review + security + coverage)
|
|
3
|
+
argument-hint: [optional: path or scope]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Command: /validate
|
|
7
|
+
|
|
8
|
+
Run all validation checks in one command: tests, code review, security scan, and coverage analysis.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
/validate
|
|
14
|
+
/validate src/
|
|
15
|
+
/validate --strict
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
### 0. Initialize Context
|
|
21
|
+
```bash
|
|
22
|
+
# Get real-world timestamp
|
|
23
|
+
date "+%y%m%d-%H%M"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Check `ai_context/memory/learning.md` for known validation issues.
|
|
27
|
+
|
|
28
|
+
### 1. Run Tests
|
|
29
|
+
- Execute test suite
|
|
30
|
+
- Check coverage >= 80%
|
|
31
|
+
- Identify failing tests
|
|
32
|
+
|
|
33
|
+
### 2. Code Quality Review
|
|
34
|
+
- Run linter
|
|
35
|
+
- Check type safety
|
|
36
|
+
- Analyze complexity
|
|
37
|
+
- Identify code smells
|
|
38
|
+
|
|
39
|
+
### 3. Security Scan
|
|
40
|
+
- SAST scanning
|
|
41
|
+
- Secret detection
|
|
42
|
+
- Dependency vulnerabilities
|
|
43
|
+
- OWASP Top 10 compliance
|
|
44
|
+
|
|
45
|
+
### 4. Generate Report
|
|
46
|
+
Save to: `ai_context/reports/validate-{timestamp}.md`
|
|
47
|
+
|
|
48
|
+
## Validation Checks
|
|
49
|
+
|
|
50
|
+
### Testing (Tester Agent)
|
|
51
|
+
- [ ] All tests pass
|
|
52
|
+
- [ ] Coverage >= 80%
|
|
53
|
+
- [ ] No flaky tests
|
|
54
|
+
- [ ] Critical paths tested
|
|
55
|
+
- [ ] Security tests included
|
|
56
|
+
|
|
57
|
+
### Code Quality (Reviewer Agent)
|
|
58
|
+
- [ ] No linting errors
|
|
59
|
+
- [ ] Types complete
|
|
60
|
+
- [ ] Functions < 50 lines
|
|
61
|
+
- [ ] No code smells
|
|
62
|
+
- [ ] Documentation present
|
|
63
|
+
|
|
64
|
+
### Security (Security Agent)
|
|
65
|
+
- [ ] No hardcoded secrets
|
|
66
|
+
- [ ] Input validation present
|
|
67
|
+
- [ ] SQL injection prevented
|
|
68
|
+
- [ ] XSS prevented
|
|
69
|
+
- [ ] Dependencies secure
|
|
70
|
+
- [ ] OWASP Top 10 compliant
|
|
71
|
+
|
|
72
|
+
## Report Format
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
# Validation Report
|
|
76
|
+
|
|
77
|
+
**Date:** {use bash: date "+%Y-%m-%d"}
|
|
78
|
+
**Scope:** {files validated}
|
|
79
|
+
**Status:** Pass / Fail
|
|
80
|
+
|
|
81
|
+
## Summary
|
|
82
|
+
|
|
83
|
+
| Category | Status | Issues |
|
|
84
|
+
|----------|--------|--------|
|
|
85
|
+
| Tests | ✅/❌ | X |
|
|
86
|
+
| Coverage | ✅/❌ | X% |
|
|
87
|
+
| Quality | ✅/❌ | X |
|
|
88
|
+
| Security | ✅/❌ | X |
|
|
89
|
+
|
|
90
|
+
## Test Results
|
|
91
|
+
|
|
92
|
+
- Total: X tests
|
|
93
|
+
- Passed: X
|
|
94
|
+
- Failed: X
|
|
95
|
+
- Coverage: X%
|
|
96
|
+
|
|
97
|
+
## Code Quality
|
|
98
|
+
|
|
99
|
+
### Issues Found
|
|
100
|
+
- [severity] [file:line] - [description]
|
|
101
|
+
|
|
102
|
+
### Recommendations
|
|
103
|
+
- [specific improvements]
|
|
104
|
+
|
|
105
|
+
## Security Scan
|
|
106
|
+
|
|
107
|
+
### Vulnerabilities
|
|
108
|
+
- [Critical] X issues
|
|
109
|
+
- [High] X issues
|
|
110
|
+
- [Medium] X issues
|
|
111
|
+
- [Low] X issues
|
|
112
|
+
|
|
113
|
+
### Secrets Detected
|
|
114
|
+
- None / [file:line] - [type]
|
|
115
|
+
|
|
116
|
+
### Dependency Vulnerabilities
|
|
117
|
+
- [package] - [CVE] - [severity]
|
|
118
|
+
|
|
119
|
+
## Quality Gates
|
|
120
|
+
|
|
121
|
+
- [ ] Tests: All passing
|
|
122
|
+
- [ ] Coverage: >= 80%
|
|
123
|
+
- [ ] Quality: No critical issues
|
|
124
|
+
- [ ] Security: No critical vulnerabilities
|
|
125
|
+
- [ ] Secrets: None detected
|
|
126
|
+
|
|
127
|
+
## Verdict
|
|
128
|
+
|
|
129
|
+
**PASS** - Ready for deployment
|
|
130
|
+
or
|
|
131
|
+
**FAIL** - Issues must be fixed
|
|
132
|
+
|
|
133
|
+
## Next Steps
|
|
134
|
+
|
|
135
|
+
1. [Required actions]
|
|
136
|
+
2. [Recommended improvements]
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Exit Codes
|
|
140
|
+
|
|
141
|
+
- `0` - All validations pass
|
|
142
|
+
- `1` - Test failures
|
|
143
|
+
- `2` - Quality issues (critical)
|
|
144
|
+
- `3` - Security vulnerabilities (critical)
|
|
145
|
+
- `4` - Coverage below threshold
|
|
146
|
+
|
|
147
|
+
## Options
|
|
148
|
+
|
|
149
|
+
### --strict
|
|
150
|
+
Fail on any warning-level issue:
|
|
151
|
+
```
|
|
152
|
+
/validate --strict
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### --fix
|
|
156
|
+
Auto-fix fixable issues:
|
|
157
|
+
```
|
|
158
|
+
/validate --fix
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### --coverage N
|
|
162
|
+
Set custom coverage threshold:
|
|
163
|
+
```
|
|
164
|
+
/validate --coverage 90
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Agent Delegation
|
|
168
|
+
|
|
169
|
+
`/validate` orchestrates multiple agents:
|
|
170
|
+
|
|
171
|
+
1. **Tester Agent** - Run tests, check coverage
|
|
172
|
+
2. **Reviewer Agent** - Code quality analysis
|
|
173
|
+
3. **Security Agent** - Security scanning
|
|
174
|
+
|
|
175
|
+
Results are aggregated into single report.
|
|
176
|
+
|
|
177
|
+
## Integration
|
|
178
|
+
|
|
179
|
+
### Pre-Commit
|
|
180
|
+
```bash
|
|
181
|
+
# Run before each commit
|
|
182
|
+
/validate || exit 1
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### CI/CD Pipeline
|
|
186
|
+
```yaml
|
|
187
|
+
- name: Validate
|
|
188
|
+
run: |
|
|
189
|
+
/validate --strict
|
|
190
|
+
if [ $? -ne 0 ]; then
|
|
191
|
+
echo "Validation failed"
|
|
192
|
+
exit 1
|
|
193
|
+
fi
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Memory Integration
|
|
197
|
+
|
|
198
|
+
Before validation:
|
|
199
|
+
- Check `ai_context/memory/learning.md` for recurring issues
|
|
200
|
+
|
|
201
|
+
After validation:
|
|
202
|
+
- Update `ai_context/memory/learning.md` with new patterns
|
|
203
|
+
- Save report to `ai_context/reports/validate-{timestamp}.md`
|
|
204
|
+
|
|
205
|
+
## Common Issues
|
|
206
|
+
|
|
207
|
+
### Low Coverage
|
|
208
|
+
- Identify untested code
|
|
209
|
+
- Generate missing tests with `/test`
|
|
210
|
+
|
|
211
|
+
### Security Vulnerabilities
|
|
212
|
+
- Fix immediately with `/code`
|
|
213
|
+
- Re-run `/secure` to verify
|
|
214
|
+
|
|
215
|
+
### Code Quality
|
|
216
|
+
- Refactor with `/code`
|
|
217
|
+
- Re-run `/review` to verify
|
|
218
|
+
|
|
219
|
+
## Success Criteria
|
|
220
|
+
|
|
221
|
+
Validation passes when:
|
|
222
|
+
- ✅ All tests pass
|
|
223
|
+
- ✅ Coverage >= 80%
|
|
224
|
+
- ✅ No critical quality issues
|
|
225
|
+
- ✅ No critical security vulnerabilities
|
|
226
|
+
- ✅ No secrets detected
|
|
227
|
+
- ✅ Dependencies secure
|
|
228
|
+
|
|
229
|
+
## Remember
|
|
230
|
+
|
|
231
|
+
**Validation is the last gate before deployment.**
|
|
232
|
+
|
|
233
|
+
Run `/validate` before:
|
|
234
|
+
- Committing code
|
|
235
|
+
- Creating pull requests
|
|
236
|
+
- Deploying to any environment
|
|
237
|
+
|
|
238
|
+
A passing validation means code is production-ready.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"framework": "ai-sprint",
|
|
4
|
+
"statusLine": {
|
|
5
|
+
"type": "command",
|
|
6
|
+
"command": ".claude/statusline.sh",
|
|
7
|
+
"padding": 0
|
|
8
|
+
},
|
|
9
|
+
"security": {
|
|
10
|
+
"enableSAST": true,
|
|
11
|
+
"enableSecretDetection": true,
|
|
12
|
+
"enableDependencyCheck": true
|
|
13
|
+
},
|
|
14
|
+
"agents": {
|
|
15
|
+
"defaultModel": "sonnet",
|
|
16
|
+
"plannerModel": "opus"
|
|
17
|
+
},
|
|
18
|
+
"approvalGates": {
|
|
19
|
+
"deployment": true,
|
|
20
|
+
"infrastructureChanges": true,
|
|
21
|
+
"securityFixes": false
|
|
22
|
+
},
|
|
23
|
+
"testing": {
|
|
24
|
+
"minimumCoverage": 80,
|
|
25
|
+
"autoRunTests": true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-context
|
|
3
|
+
description: Efficient codebase understanding using scanned context. Activate when starting work on existing projects or after major code changes. Reads ai_context/codebase/ documents for project structure and compressed code overview.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codebase Context
|
|
8
|
+
|
|
9
|
+
Understand existing codebases efficiently using ai_context/codebase/ documents.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
**Starting work on existing project:**
|
|
14
|
+
1. Check if `ai_context/codebase/` exists
|
|
15
|
+
2. Read structure.md for project layout
|
|
16
|
+
3. Read overview.md for compressed codebase
|
|
17
|
+
|
|
18
|
+
**After major changes:**
|
|
19
|
+
- Run `/scan` to refresh context
|
|
20
|
+
|
|
21
|
+
## Context Files
|
|
22
|
+
|
|
23
|
+
Located in `ai_context/codebase/`:
|
|
24
|
+
|
|
25
|
+
| File | Purpose | When to Read |
|
|
26
|
+
|------|---------|--------------|
|
|
27
|
+
| `structure.md` | Directory tree | First - understand layout |
|
|
28
|
+
| `overview.md` | Compressed code | Second - understand patterns |
|
|
29
|
+
| `repomix-output.xml` | Token-efficient format | For detailed AI queries |
|
|
30
|
+
| `scan-metadata.json` | Scan statistics | Check freshness |
|
|
31
|
+
|
|
32
|
+
## Reading Strategy
|
|
33
|
+
|
|
34
|
+
Load: `references/reading-context.md`
|
|
35
|
+
|
|
36
|
+
## Refresh Triggers
|
|
37
|
+
|
|
38
|
+
Load: `references/refresh-triggers.md`
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Check if context exists
|
|
44
|
+
ls ai_context/codebase/
|
|
45
|
+
|
|
46
|
+
# Read structure first (fast overview)
|
|
47
|
+
cat ai_context/codebase/structure.md
|
|
48
|
+
|
|
49
|
+
# Then read overview (comprehensive)
|
|
50
|
+
cat ai_context/codebase/overview.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Token Efficiency
|
|
54
|
+
|
|
55
|
+
| Task | Best Source |
|
|
56
|
+
|------|-------------|
|
|
57
|
+
| Project structure | structure.md |
|
|
58
|
+
| How feature works | overview.md |
|
|
59
|
+
| Find all API routes | repomix-output.xml |
|
|
60
|
+
| Check specific file | Read file directly |
|
|
61
|
+
|
|
62
|
+
## Integration
|
|
63
|
+
|
|
64
|
+
Before planning or implementing:
|
|
65
|
+
1. Check if codebase context exists
|
|
66
|
+
2. Read structure for project layout
|
|
67
|
+
3. Reference patterns from overview
|
|
68
|
+
4. Refresh with `/scan` if stale (>1 day)
|