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,475 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Set up CI/CD pipeline and deployment automation
|
|
3
|
+
argument-hint: [optional: platform (github|gitlab|vercel|railway)]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Command: /deploy
|
|
7
|
+
|
|
8
|
+
Set up automated CI/CD pipeline and configure deployment to your chosen platform.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
/deploy
|
|
14
|
+
/deploy --platform github
|
|
15
|
+
/deploy --platform vercel
|
|
16
|
+
/deploy --platform railway
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
### 1. Assess Current Setup
|
|
22
|
+
- Check existing CI/CD configuration
|
|
23
|
+
- Identify deployment platform
|
|
24
|
+
- Review infrastructure needs
|
|
25
|
+
|
|
26
|
+
### 2. Platform Selection
|
|
27
|
+
If not specified, suggest based on project:
|
|
28
|
+
- **Next.js/React**: Vercel (recommended)
|
|
29
|
+
- **Full-stack with DB**: Railway
|
|
30
|
+
- **High traffic**: Cloudflare Workers
|
|
31
|
+
- **Multi-service**: Render
|
|
32
|
+
- **Custom infrastructure**: GitHub Actions + platform of choice
|
|
33
|
+
|
|
34
|
+
### 3. Generate CI/CD Pipeline
|
|
35
|
+
- Create GitHub Actions workflow (or GitLab CI)
|
|
36
|
+
- Configure automated testing
|
|
37
|
+
- Add security scanning
|
|
38
|
+
- Set up deployment automation
|
|
39
|
+
|
|
40
|
+
### 4. Configure Deployment
|
|
41
|
+
- Set up deployment platform
|
|
42
|
+
- Configure environment variables
|
|
43
|
+
- Add health checks
|
|
44
|
+
- Enable monitoring
|
|
45
|
+
|
|
46
|
+
### 5. Test Deployment
|
|
47
|
+
- Deploy to staging
|
|
48
|
+
- Run smoke tests
|
|
49
|
+
- Verify functionality
|
|
50
|
+
- Deploy to production
|
|
51
|
+
|
|
52
|
+
## Supported Platforms 2025
|
|
53
|
+
|
|
54
|
+
### GitHub Actions (CI/CD)
|
|
55
|
+
```yaml
|
|
56
|
+
# .github/workflows/deploy.yml
|
|
57
|
+
name: Deploy
|
|
58
|
+
|
|
59
|
+
on:
|
|
60
|
+
push:
|
|
61
|
+
branches: [main]
|
|
62
|
+
|
|
63
|
+
jobs:
|
|
64
|
+
deploy:
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/checkout@v4
|
|
68
|
+
- uses: actions/setup-node@v4
|
|
69
|
+
with:
|
|
70
|
+
node-version: '20'
|
|
71
|
+
|
|
72
|
+
- run: npm ci
|
|
73
|
+
- run: npm test
|
|
74
|
+
- run: npm run build
|
|
75
|
+
|
|
76
|
+
- name: Deploy to Vercel
|
|
77
|
+
uses: amondnet/vercel-action@v25
|
|
78
|
+
with:
|
|
79
|
+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
80
|
+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
|
81
|
+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
82
|
+
vercel-args: '--prod'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Vercel (Next.js/React)
|
|
86
|
+
```json
|
|
87
|
+
// vercel.json
|
|
88
|
+
{
|
|
89
|
+
"version": 2,
|
|
90
|
+
"framework": "nextjs",
|
|
91
|
+
"buildCommand": "npm run build",
|
|
92
|
+
"env": {
|
|
93
|
+
"NODE_ENV": "production"
|
|
94
|
+
},
|
|
95
|
+
"headers": [
|
|
96
|
+
{
|
|
97
|
+
"source": "/(.*)",
|
|
98
|
+
"headers": [
|
|
99
|
+
{"key": "X-Frame-Options", "value": "DENY"},
|
|
100
|
+
{"key": "X-Content-Type-Options", "value": "nosniff"}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Railway (Full-Stack)
|
|
108
|
+
```toml
|
|
109
|
+
# railway.toml
|
|
110
|
+
[build]
|
|
111
|
+
builder = "NIXPACKS"
|
|
112
|
+
|
|
113
|
+
[deploy]
|
|
114
|
+
startCommand = "npm start"
|
|
115
|
+
healthcheckPath = "/health"
|
|
116
|
+
restartPolicyType = "ON_FAILURE"
|
|
117
|
+
|
|
118
|
+
[[services]]
|
|
119
|
+
name = "web"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Cloudflare Workers (Edge)
|
|
123
|
+
```toml
|
|
124
|
+
# wrangler.toml
|
|
125
|
+
name = "app"
|
|
126
|
+
main = "src/index.ts"
|
|
127
|
+
compatibility_date = "2025-01-01"
|
|
128
|
+
|
|
129
|
+
[env.production]
|
|
130
|
+
routes = [{ pattern = "app.com/*", zone_name = "app.com" }]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Complete CI/CD Pipeline
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
# .github/workflows/ci-cd.yml
|
|
137
|
+
name: CI/CD Pipeline
|
|
138
|
+
|
|
139
|
+
on:
|
|
140
|
+
push:
|
|
141
|
+
branches: [main, develop]
|
|
142
|
+
pull_request:
|
|
143
|
+
branches: [main]
|
|
144
|
+
|
|
145
|
+
env:
|
|
146
|
+
NODE_VERSION: '20.x'
|
|
147
|
+
|
|
148
|
+
jobs:
|
|
149
|
+
# Quality checks
|
|
150
|
+
quality:
|
|
151
|
+
runs-on: ubuntu-latest
|
|
152
|
+
steps:
|
|
153
|
+
- uses: actions/checkout@v4
|
|
154
|
+
- uses: actions/setup-node@v4
|
|
155
|
+
with:
|
|
156
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
157
|
+
|
|
158
|
+
- run: npm ci
|
|
159
|
+
- run: npm run lint
|
|
160
|
+
- run: npm run type-check
|
|
161
|
+
|
|
162
|
+
# Tests
|
|
163
|
+
test:
|
|
164
|
+
runs-on: ubuntu-latest
|
|
165
|
+
steps:
|
|
166
|
+
- uses: actions/checkout@v4
|
|
167
|
+
- uses: actions/setup-node@v4
|
|
168
|
+
|
|
169
|
+
- run: npm ci
|
|
170
|
+
- run: npm test -- --coverage
|
|
171
|
+
|
|
172
|
+
- name: Check coverage >= 80%
|
|
173
|
+
run: |
|
|
174
|
+
coverage=$(cat coverage/coverage-summary.json | jq '.total.lines.pct')
|
|
175
|
+
if (( $(echo "$coverage < 80" | bc -l) )); then
|
|
176
|
+
exit 1
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
# Security scan
|
|
180
|
+
security:
|
|
181
|
+
runs-on: ubuntu-latest
|
|
182
|
+
steps:
|
|
183
|
+
- uses: actions/checkout@v4
|
|
184
|
+
- uses: snyk/actions/node@master
|
|
185
|
+
env:
|
|
186
|
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
|
187
|
+
|
|
188
|
+
# Build
|
|
189
|
+
build:
|
|
190
|
+
needs: [quality, test, security]
|
|
191
|
+
runs-on: ubuntu-latest
|
|
192
|
+
steps:
|
|
193
|
+
- uses: actions/checkout@v4
|
|
194
|
+
- uses: actions/setup-node@v4
|
|
195
|
+
|
|
196
|
+
- run: npm ci
|
|
197
|
+
- run: npm run build
|
|
198
|
+
|
|
199
|
+
- uses: actions/upload-artifact@v4
|
|
200
|
+
with:
|
|
201
|
+
name: build
|
|
202
|
+
path: dist/
|
|
203
|
+
|
|
204
|
+
# Deploy to production
|
|
205
|
+
deploy:
|
|
206
|
+
if: github.ref == 'refs/heads/main'
|
|
207
|
+
needs: [build]
|
|
208
|
+
runs-on: ubuntu-latest
|
|
209
|
+
environment: production
|
|
210
|
+
steps:
|
|
211
|
+
- uses: actions/checkout@v4
|
|
212
|
+
- uses: actions/download-artifact@v4
|
|
213
|
+
|
|
214
|
+
- name: Deploy
|
|
215
|
+
run: |
|
|
216
|
+
# Platform-specific deployment
|
|
217
|
+
npm run deploy
|
|
218
|
+
|
|
219
|
+
- name: Health check
|
|
220
|
+
run: |
|
|
221
|
+
sleep 30
|
|
222
|
+
curl -f https://app.com/health || exit 1
|
|
223
|
+
|
|
224
|
+
- name: Rollback on failure
|
|
225
|
+
if: failure()
|
|
226
|
+
run: npm run rollback
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Environment Variables Setup
|
|
230
|
+
|
|
231
|
+
### GitHub Secrets
|
|
232
|
+
```bash
|
|
233
|
+
# Add secrets to GitHub repository
|
|
234
|
+
gh secret set DATABASE_URL
|
|
235
|
+
gh secret set VERCEL_TOKEN
|
|
236
|
+
gh secret set SNYK_TOKEN
|
|
237
|
+
gh secret set STRIPE_SECRET_KEY
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### .env.example Template
|
|
241
|
+
```bash
|
|
242
|
+
# Database
|
|
243
|
+
DATABASE_URL=postgresql://user:pass@localhost/db
|
|
244
|
+
|
|
245
|
+
# API Keys
|
|
246
|
+
STRIPE_SECRET_KEY=sk_test_xxx
|
|
247
|
+
SENDGRID_API_KEY=SG.xxx
|
|
248
|
+
|
|
249
|
+
# Auth
|
|
250
|
+
JWT_SECRET=your-secret-here
|
|
251
|
+
|
|
252
|
+
# Monitoring
|
|
253
|
+
SENTRY_DSN=https://xxx@sentry.io/xxx
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Deployment Checklist
|
|
257
|
+
|
|
258
|
+
### Pre-Deployment
|
|
259
|
+
- ✅ All tests passing
|
|
260
|
+
- ✅ Security scan clean
|
|
261
|
+
- ✅ Code reviewed
|
|
262
|
+
- ✅ Coverage >80%
|
|
263
|
+
- ✅ Secrets in environment (not code)
|
|
264
|
+
- ✅ Health checks implemented
|
|
265
|
+
- ✅ Rollback plan ready
|
|
266
|
+
|
|
267
|
+
### Deployment
|
|
268
|
+
- ✅ Deploy to staging first
|
|
269
|
+
- ✅ Run smoke tests
|
|
270
|
+
- ✅ Check logs/metrics
|
|
271
|
+
- ✅ Verify health checks
|
|
272
|
+
- ✅ Deploy to production
|
|
273
|
+
- ✅ Monitor for 10 minutes
|
|
274
|
+
|
|
275
|
+
### Post-Deployment
|
|
276
|
+
- ✅ Verify functionality
|
|
277
|
+
- ✅ Check error rates
|
|
278
|
+
- ✅ Monitor performance
|
|
279
|
+
- ✅ Update documentation
|
|
280
|
+
|
|
281
|
+
## Monitoring Setup
|
|
282
|
+
|
|
283
|
+
### Health Check Endpoint
|
|
284
|
+
```typescript
|
|
285
|
+
// app/api/health/route.ts
|
|
286
|
+
export async function GET() {
|
|
287
|
+
const checks = {
|
|
288
|
+
database: await checkDatabase(),
|
|
289
|
+
redis: await checkRedis()
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const healthy = Object.values(checks).every(c => c.healthy);
|
|
293
|
+
|
|
294
|
+
return Response.json({
|
|
295
|
+
status: healthy ? 'healthy' : 'degraded',
|
|
296
|
+
checks,
|
|
297
|
+
timestamp: new Date().toISOString()
|
|
298
|
+
}, {
|
|
299
|
+
status: healthy ? 200 : 503
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Sentry (Error Tracking)
|
|
305
|
+
```typescript
|
|
306
|
+
import * as Sentry from '@sentry/node';
|
|
307
|
+
|
|
308
|
+
Sentry.init({
|
|
309
|
+
dsn: process.env.SENTRY_DSN,
|
|
310
|
+
environment: process.env.NODE_ENV,
|
|
311
|
+
tracesSampleRate: 1.0
|
|
312
|
+
});
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Rollback Strategy
|
|
316
|
+
|
|
317
|
+
### Automatic Rollback
|
|
318
|
+
```yaml
|
|
319
|
+
- name: Health check after deploy
|
|
320
|
+
run: |
|
|
321
|
+
sleep 60
|
|
322
|
+
health=$(curl -s https://app.com/health | jq -r '.status')
|
|
323
|
+
if [ "$health" != "healthy" ]; then
|
|
324
|
+
echo "Deployment unhealthy, rolling back"
|
|
325
|
+
exit 1
|
|
326
|
+
fi
|
|
327
|
+
|
|
328
|
+
- name: Rollback on failure
|
|
329
|
+
if: failure()
|
|
330
|
+
run: |
|
|
331
|
+
# Platform-specific rollback
|
|
332
|
+
vercel rollback
|
|
333
|
+
# or railway rollback
|
|
334
|
+
# or kubectl rollout undo
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Manual Rollback
|
|
338
|
+
```bash
|
|
339
|
+
# Vercel
|
|
340
|
+
vercel rollback
|
|
341
|
+
|
|
342
|
+
# Railway
|
|
343
|
+
railway rollback
|
|
344
|
+
|
|
345
|
+
# Kubernetes
|
|
346
|
+
kubectl rollout undo deployment/app
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Platform-Specific Guides
|
|
350
|
+
|
|
351
|
+
### Vercel Deployment
|
|
352
|
+
```bash
|
|
353
|
+
# Install Vercel CLI
|
|
354
|
+
npm i -g vercel
|
|
355
|
+
|
|
356
|
+
# Login
|
|
357
|
+
vercel login
|
|
358
|
+
|
|
359
|
+
# Link project
|
|
360
|
+
vercel link
|
|
361
|
+
|
|
362
|
+
# Deploy
|
|
363
|
+
vercel --prod
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Railway Deployment
|
|
367
|
+
```bash
|
|
368
|
+
# Install Railway CLI
|
|
369
|
+
npm i -g @railway/cli
|
|
370
|
+
|
|
371
|
+
# Login
|
|
372
|
+
railway login
|
|
373
|
+
|
|
374
|
+
# Init project
|
|
375
|
+
railway init
|
|
376
|
+
|
|
377
|
+
# Deploy
|
|
378
|
+
railway up
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Cloudflare Workers
|
|
382
|
+
```bash
|
|
383
|
+
# Install Wrangler
|
|
384
|
+
npm i -g wrangler
|
|
385
|
+
|
|
386
|
+
# Login
|
|
387
|
+
wrangler login
|
|
388
|
+
|
|
389
|
+
# Deploy
|
|
390
|
+
wrangler deploy
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## Security Configuration
|
|
394
|
+
|
|
395
|
+
### Security Headers
|
|
396
|
+
```typescript
|
|
397
|
+
// middleware.ts
|
|
398
|
+
export function middleware() {
|
|
399
|
+
const headers = new Headers();
|
|
400
|
+
headers.set('X-Frame-Options', 'DENY');
|
|
401
|
+
headers.set('X-Content-Type-Options', 'nosniff');
|
|
402
|
+
headers.set('Strict-Transport-Security', 'max-age=31536000');
|
|
403
|
+
return NextResponse.next({ headers });
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Rate Limiting
|
|
408
|
+
```typescript
|
|
409
|
+
import rateLimit from 'express-rate-limit';
|
|
410
|
+
|
|
411
|
+
const limiter = rateLimit({
|
|
412
|
+
windowMs: 15 * 60 * 1000, // 15 min
|
|
413
|
+
max: 100
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
app.use('/api/', limiter);
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
## Output
|
|
420
|
+
|
|
421
|
+
After `/deploy` completion:
|
|
422
|
+
|
|
423
|
+
✅ **CI/CD Pipeline Configured**
|
|
424
|
+
- Automated testing
|
|
425
|
+
- Security scanning
|
|
426
|
+
- Build automation
|
|
427
|
+
- Deployment automation
|
|
428
|
+
|
|
429
|
+
✅ **Deployment Platform Set Up**
|
|
430
|
+
- Environment variables configured
|
|
431
|
+
- Health checks enabled
|
|
432
|
+
- Monitoring integrated
|
|
433
|
+
- Rollback tested
|
|
434
|
+
|
|
435
|
+
✅ **Documentation Created**
|
|
436
|
+
- Deployment guide
|
|
437
|
+
- Environment setup
|
|
438
|
+
- Rollback procedures
|
|
439
|
+
- Monitoring access
|
|
440
|
+
|
|
441
|
+
## Next Steps
|
|
442
|
+
|
|
443
|
+
1. Push code to trigger deployment
|
|
444
|
+
2. Monitor deployment in CI/CD
|
|
445
|
+
3. Verify application health
|
|
446
|
+
4. Set up alerts for errors
|
|
447
|
+
5. Document any manual steps
|
|
448
|
+
|
|
449
|
+
## Common Issues
|
|
450
|
+
|
|
451
|
+
### Build Failures
|
|
452
|
+
- Check Node.js version
|
|
453
|
+
- Verify dependencies
|
|
454
|
+
- Check build logs
|
|
455
|
+
|
|
456
|
+
### Environment Variables
|
|
457
|
+
- Ensure all secrets set
|
|
458
|
+
- Check variable names
|
|
459
|
+
- Verify access permissions
|
|
460
|
+
|
|
461
|
+
### Health Check Fails
|
|
462
|
+
- Check application logs
|
|
463
|
+
- Verify database connection
|
|
464
|
+
- Test health endpoint locally
|
|
465
|
+
|
|
466
|
+
## Remember
|
|
467
|
+
|
|
468
|
+
**Deployment should be:**
|
|
469
|
+
- Automated (no manual steps)
|
|
470
|
+
- Fast (<10 minutes)
|
|
471
|
+
- Safe (can rollback)
|
|
472
|
+
- Monitored (know if issues)
|
|
473
|
+
- Repeatable (consistent every time)
|
|
474
|
+
|
|
475
|
+
**Production is sacred - test in staging first.**
|