ai-sprint-kit 1.3.0 → 2.0.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.
Files changed (64) hide show
  1. package/LICENSE +35 -123
  2. package/README.md +39 -207
  3. package/bin/ai-sprint.js +105 -0
  4. package/lib/auth.js +73 -0
  5. package/lib/installer.js +62 -174
  6. package/lib/messages.js +53 -0
  7. package/package.json +15 -18
  8. package/bin/cli.js +0 -135
  9. package/lib/scanner.js +0 -341
  10. package/templates/.claude/.env.example +0 -13
  11. package/templates/.claude/agents/debugger.md +0 -667
  12. package/templates/.claude/agents/devops.md +0 -727
  13. package/templates/.claude/agents/docs.md +0 -661
  14. package/templates/.claude/agents/implementer.md +0 -288
  15. package/templates/.claude/agents/planner.md +0 -273
  16. package/templates/.claude/agents/researcher.md +0 -453
  17. package/templates/.claude/agents/reviewer.md +0 -643
  18. package/templates/.claude/agents/security.md +0 -202
  19. package/templates/.claude/agents/tester.md +0 -646
  20. package/templates/.claude/commands/ai-sprint-auto.md +0 -150
  21. package/templates/.claude/commands/ai-sprint-code.md +0 -316
  22. package/templates/.claude/commands/ai-sprint-debug.md +0 -453
  23. package/templates/.claude/commands/ai-sprint-deploy.md +0 -475
  24. package/templates/.claude/commands/ai-sprint-docs.md +0 -519
  25. package/templates/.claude/commands/ai-sprint-plan.md +0 -136
  26. package/templates/.claude/commands/ai-sprint-review.md +0 -433
  27. package/templates/.claude/commands/ai-sprint-scan.md +0 -146
  28. package/templates/.claude/commands/ai-sprint-secure.md +0 -88
  29. package/templates/.claude/commands/ai-sprint-test.md +0 -352
  30. package/templates/.claude/commands/ai-sprint-validate.md +0 -253
  31. package/templates/.claude/settings.json +0 -27
  32. package/templates/.claude/skills/codebase-context/SKILL.md +0 -68
  33. package/templates/.claude/skills/codebase-context/references/reading-context.md +0 -68
  34. package/templates/.claude/skills/codebase-context/references/refresh-triggers.md +0 -82
  35. package/templates/.claude/skills/implementation/SKILL.md +0 -70
  36. package/templates/.claude/skills/implementation/references/error-handling.md +0 -106
  37. package/templates/.claude/skills/implementation/references/security-patterns.md +0 -73
  38. package/templates/.claude/skills/implementation/references/validation-patterns.md +0 -107
  39. package/templates/.claude/skills/memory/SKILL.md +0 -67
  40. package/templates/.claude/skills/memory/references/decisions-format.md +0 -68
  41. package/templates/.claude/skills/memory/references/learning-format.md +0 -74
  42. package/templates/.claude/skills/planning/SKILL.md +0 -72
  43. package/templates/.claude/skills/planning/references/plan-templates.md +0 -81
  44. package/templates/.claude/skills/planning/references/research-phase.md +0 -62
  45. package/templates/.claude/skills/planning/references/solution-design.md +0 -66
  46. package/templates/.claude/skills/quality-assurance/SKILL.md +0 -79
  47. package/templates/.claude/skills/quality-assurance/references/review-checklist.md +0 -72
  48. package/templates/.claude/skills/quality-assurance/references/security-checklist.md +0 -70
  49. package/templates/.claude/skills/quality-assurance/references/testing-strategy.md +0 -85
  50. package/templates/.claude/skills/quality-assurance/scripts/check-size.py +0 -333
  51. package/templates/.claude/statusline.sh +0 -126
  52. package/templates/.claude/workflows/development-rules.md +0 -133
  53. package/templates/.claude/workflows/orchestration-protocol.md +0 -194
  54. package/templates/.mcp.json.example +0 -36
  55. package/templates/CLAUDE.md +0 -409
  56. package/templates/README.md +0 -331
  57. package/templates/ai_context/codebase/.gitkeep +0 -0
  58. package/templates/ai_context/memory/active.md +0 -15
  59. package/templates/ai_context/memory/decisions.md +0 -18
  60. package/templates/ai_context/memory/learning.md +0 -22
  61. package/templates/ai_context/plans/.gitkeep +0 -0
  62. package/templates/ai_context/reports/.gitkeep +0 -0
  63. package/templates/docs/user-guide-th.md +0 -454
  64. package/templates/docs/user-guide.md +0 -595
@@ -1,150 +0,0 @@
1
- ---
2
- description: Automatic full development cycle (plan → code → test → review → secure)
3
- argument-hint: [feature description]
4
- ---
5
-
6
- **ULTRATHINK** - Execute complete autonomous development workflow.
7
-
8
- **Objective:** $ARGUMENTS
9
-
10
- ## MANDATORY Workflow Execution
11
-
12
- **CRITICAL:** You MUST execute each phase in order. Do NOT skip to coding.
13
-
14
- ---
15
-
16
- ### Phase 1: Planning (MANDATORY - Execute First)
17
-
18
- **⚠️ STOP! Before ANY code, execute `/ai-sprint-plan` command:**
19
-
20
- ```
21
- /ai-sprint-plan "$ARGUMENTS"
22
- ```
23
-
24
- The `/ai-sprint-plan` command will:
25
- 1. Research best practices and approaches
26
- 2. Ask clarifying questions if needed
27
- 3. Create implementation plan with architecture
28
- 4. Save plan to `ai_context/ai-sprint-plans/`
29
-
30
- **Validation Gate:** Plan MUST exist before proceeding.
31
- - Check: `ai_context/ai-sprint-plans/` has new plan directory
32
- - If NO plan exists → STOP and run `/ai-sprint-plan` first
33
-
34
- ---
35
-
36
- ### Phase 2: Implementation
37
-
38
- Only after plan exists, execute:
39
- ```
40
- /ai-sprint-code "implement the plan at ai_context/ai-sprint-plans/{plan-path}"
41
- ```
42
-
43
- **Requirements:**
44
- - Follow the plan phases step by step
45
- - Generate production-quality code
46
- - Follow security best practices (OWASP Top 10)
47
- - Handle errors properly (no silent failures)
48
-
49
- ---
50
-
51
- ### Phase 3: Testing
52
-
53
- After implementation, execute:
54
- ```
55
- /ai-sprint-test
56
- ```
57
-
58
- **Requirements:**
59
- - Generate unit tests for business logic
60
- - Generate integration tests for APIs
61
- - Ensure >80% code coverage
62
- - All tests must pass
63
-
64
- **Validation Gate:** Tests must pass before proceeding.
65
- - If tests fail → Fix issues → Rerun `/ai-sprint-test`
66
- - Do NOT proceed with failing tests
67
-
68
- ---
69
-
70
- ### Phase 4: Code Review
71
-
72
- After tests pass, execute:
73
- ```
74
- /ai-sprint-review
75
- ```
76
-
77
- **Requirements:**
78
- - Code quality analysis (YAGNI, KISS, DRY)
79
- - Best practices verification
80
- - No critical issues allowed
81
-
82
- **Validation Gate:** Review must pass.
83
- - If critical issues → Fix → Rerun `/ai-sprint-review`
84
-
85
- ---
86
-
87
- ### Phase 5: Security Scan
88
-
89
- After review passes, execute:
90
- ```
91
- /ai-sprint-secure
92
- ```
93
-
94
- **Requirements:**
95
- - SAST scanning for vulnerabilities
96
- - Secret detection (no hardcoded credentials)
97
- - Dependency vulnerability check
98
-
99
- **Validation Gate:** No high/critical security issues.
100
- - If issues found → Fix → Rerun `/ai-sprint-secure`
101
-
102
- ---
103
-
104
- ### Phase 6: Documentation
105
-
106
- After security passes, execute:
107
- ```
108
- /ai-sprint-docs
109
- ```
110
-
111
- **Requirements:**
112
- - Update relevant documentation
113
- - Add code comments where needed
114
- - Generate API docs if applicable
115
-
116
- ---
117
-
118
- ## Human-in-the-Loop Gates
119
-
120
- Pause and ask for approval before:
121
- - Deployment actions
122
- - Infrastructure changes
123
- - Critical security vulnerability fixes
124
- - Database schema migrations
125
-
126
- ## Success Criteria
127
-
128
- All gates must pass:
129
- - ✅ Plan created and approved
130
- - ✅ Code implemented per plan
131
- - ✅ Tests passing (>80% coverage)
132
- - ✅ Code review approved
133
- - ✅ Security scan clean
134
- - ✅ Documentation updated
135
-
136
- ## Final Report
137
-
138
- After all phases complete, provide summary:
139
- 1. What was implemented
140
- 2. Test coverage achieved
141
- 3. Security scan results
142
- 4. Files created/modified
143
- 5. Next steps (commit, deploy)
144
-
145
- ## REMEMBER
146
-
147
- - **Phase 1 is MANDATORY** - Always run `/ai-sprint-plan` first
148
- - **No skipping** - Execute each phase in order
149
- - **Validation gates** - Do not proceed if a gate fails
150
- - **Fix and retry** - If any phase fails, fix issues and rerun
@@ -1,316 +0,0 @@
1
- ---
2
- description: Generate or refactor code with best practices and security
3
- argument-hint: [plan-path or task description]
4
- ---
5
-
6
- **THINK HARDER** - Follow plan or implement with security-first approach.
7
-
8
- **Objective:** $ARGUMENTS
9
-
10
- ## Workflow
11
-
12
- ### Step 0: Check for Plan (IMPORTANT)
13
-
14
- **If argument contains a plan path (e.g., `ai_context/ai-sprint-plans/...`):**
15
- 1. Read the plan: `plan.md` and `phase-*.md` files
16
- 2. Follow implementation phases in order
17
- 3. Mark phases complete as you progress
18
-
19
- **If no plan exists:**
20
- - Ask: "No plan found. Run `/ai-sprint-plan` first or proceed with direct implementation?"
21
- - If direct implementation requested, continue to Step 1
22
-
23
- ---
24
-
25
- ### Step 1: Understand Requirements
26
-
27
- - Read plan phases if available
28
- - Clarify what needs to be built or refactored
29
- - Ask questions if requirements unclear
30
- - Identify affected files and components
31
-
32
- ---
33
-
34
- ### Step 2: Delegate to Implementer Agent
35
-
36
- ```
37
- Task(subagent_type="implementer", prompt="Implement: $ARGUMENTS. Follow security-first principles, YAGNI/KISS/DRY. Handle errors properly.", description="Implement code")
38
- ```
39
-
40
- Agent responsibilities:
41
- - Follow plan phases if provided
42
- - Security-first implementation
43
- - Proper error handling
44
- - Type safety
45
-
46
- ### 3. Code Generation
47
- - Generate clean, maintainable code
48
- - Follow YAGNI, KISS, DRY principles
49
- - Include proper TypeScript types
50
- - Add necessary error handling
51
- - Implement input validation
52
-
53
- ### 4. Security Checklist
54
- **Automatically enforced:**
55
- - ✅ No hardcoded secrets
56
- - ✅ Input validation on all user inputs
57
- - ✅ Parameterized queries (no SQL injection)
58
- - ✅ Output encoding (no XSS)
59
- - ✅ Proper authentication/authorization
60
- - ✅ Error messages don't leak information
61
- - ✅ OWASP Top 10 compliance
62
-
63
- ### 5. Quality Standards
64
- **Code must be:**
65
- - ✅ Type-safe (TypeScript/proper types)
66
- - ✅ Well-structured (clear responsibilities)
67
- - ✅ Properly tested (test cases generated)
68
- - ✅ Documented (comments where needed)
69
- - ✅ Performance-optimized (no N+1 queries)
70
-
71
- ## Code Generation Principles
72
-
73
- ### Security-First
74
- ```typescript
75
- // ✅ Good - Secure
76
- export async function createUser(data: CreateUserInput) {
77
- // Input validation
78
- const validated = validateUserInput(data);
79
-
80
- // Parameterized query (no SQL injection)
81
- const user = await db.users.create({
82
- data: {
83
- email: validated.email,
84
- password: await hash(validated.password, 10)
85
- }
86
- });
87
-
88
- return user;
89
- }
90
-
91
- // ❌ Bad - Insecure
92
- export async function createUser(email, password) {
93
- const query = `INSERT INTO users (email, password) VALUES ('${email}', '${password}')`;
94
- await db.query(query); // SQL injection!
95
- return email;
96
- }
97
- ```
98
-
99
- ### Error Handling
100
- ```typescript
101
- // ✅ Good
102
- export async function getUser(id: string) {
103
- try {
104
- const user = await db.users.findUnique({ where: { id } });
105
-
106
- if (!user) {
107
- throw new NotFoundError(`User ${id} not found`);
108
- }
109
-
110
- return user;
111
- } catch (error) {
112
- logger.error('Failed to get user', { error, id });
113
- throw error;
114
- }
115
- }
116
-
117
- // ❌ Bad - No error handling
118
- export async function getUser(id) {
119
- return await db.users.findUnique({ where: { id } });
120
- }
121
- ```
122
-
123
- ### Type Safety
124
- ```typescript
125
- // ✅ Good - Typed
126
- interface CreateUserInput {
127
- email: string;
128
- password: string;
129
- name?: string;
130
- }
131
-
132
- export async function createUser(data: CreateUserInput): Promise<User> {
133
- // Implementation
134
- }
135
-
136
- // ❌ Bad - No types
137
- export async function createUser(data) {
138
- // Implementation
139
- }
140
- ```
141
-
142
- ## Examples
143
-
144
- ### Example 1: API Endpoint
145
- ```
146
- /ai-sprint-code "create REST API endpoint for user registration with email verification"
147
- ```
148
-
149
- **Generated:**
150
- ```typescript
151
- // api/auth/register/route.ts
152
- import { hash } from 'bcrypt';
153
- import { z } from 'zod';
154
-
155
- const registerSchema = z.object({
156
- email: z.string().email(),
157
- password: z.string().min(8),
158
- name: z.string().min(1)
159
- });
160
-
161
- export async function POST(request: Request) {
162
- try {
163
- const body = await request.json();
164
-
165
- // Input validation
166
- const validated = registerSchema.parse(body);
167
-
168
- // Check if user exists
169
- const existing = await db.users.findUnique({
170
- where: { email: validated.email }
171
- });
172
-
173
- if (existing) {
174
- return Response.json(
175
- { error: 'Email already registered' },
176
- { status: 400 }
177
- );
178
- }
179
-
180
- // Create user
181
- const user = await db.users.create({
182
- data: {
183
- email: validated.email,
184
- password: await hash(validated.password, 10),
185
- name: validated.name,
186
- verified: false
187
- }
188
- });
189
-
190
- // Send verification email
191
- await sendVerificationEmail(user.email, user.id);
192
-
193
- return Response.json({
194
- message: 'Registration successful. Check your email to verify.'
195
- }, { status: 201 });
196
-
197
- } catch (error) {
198
- if (error instanceof z.ZodError) {
199
- return Response.json(
200
- { error: 'Invalid input', details: error.errors },
201
- { status: 400 }
202
- );
203
- }
204
-
205
- logger.error('Registration failed', { error });
206
- return Response.json(
207
- { error: 'Internal server error' },
208
- { status: 500 }
209
- );
210
- }
211
- }
212
- ```
213
-
214
- ### Example 2: Refactoring
215
- ```
216
- /ai-sprint-code "refactor this callback-based code to use async/await"
217
- ```
218
-
219
- **Before:**
220
- ```javascript
221
- function getUser(id, callback) {
222
- db.query('SELECT * FROM users WHERE id = ?', [id], (err, result) => {
223
- if (err) return callback(err);
224
- callback(null, result);
225
- });
226
- }
227
- ```
228
-
229
- **After:**
230
- ```typescript
231
- async function getUser(id: string): Promise<User> {
232
- const user = await db.users.findUnique({
233
- where: { id }
234
- });
235
-
236
- if (!user) {
237
- throw new NotFoundError(`User ${id} not found`);
238
- }
239
-
240
- return user;
241
- }
242
- ```
243
-
244
- ## Output
245
-
246
- ### Code Generated
247
- - Clean, production-ready code
248
- - Following project conventions
249
- - With proper error handling
250
- - Type-safe and secure
251
-
252
- ### Tests Suggested
253
- - Unit tests for business logic
254
- - Integration tests for APIs
255
- - Edge cases covered
256
-
257
- ### Documentation Added
258
- - Function/class comments
259
- - Usage examples
260
- - API endpoint docs (if applicable)
261
-
262
- ## Next Steps
263
-
264
- After `/ai-sprint-code` completion:
265
- 1. Review generated code
266
- 2. Run `/ai-sprint-test` to generate tests
267
- 3. Run `/ai-sprint-review` for quality check
268
- 4. Run `/ai-sprint-secure` for security scan
269
- 5. Commit changes
270
-
271
- ## Common Use Cases
272
-
273
- ### New Features
274
- ```
275
- /ai-sprint-code "add pagination to the products API"
276
- /ai-sprint-code "implement password reset functionality"
277
- /ai-sprint-code "create admin dashboard with user management"
278
- ```
279
-
280
- ### Refactoring
281
- ```
282
- /ai-sprint-code "convert class components to functional components"
283
- /ai-sprint-code "split this 500-line file into smaller modules"
284
- /ai-sprint-code "replace REST with GraphQL for user API"
285
- ```
286
-
287
- ### Bug Fixes
288
- ```
289
- /ai-sprint-code "fix the race condition in payment processing"
290
- /ai-sprint-code "resolve memory leak in WebSocket handler"
291
- ```
292
-
293
- ### Performance
294
- ```
295
- /ai-sprint-code "optimize this N+1 query problem"
296
- /ai-sprint-code "add caching to frequently accessed data"
297
- /ai-sprint-code "implement lazy loading for images"
298
- ```
299
-
300
- ## Remember
301
-
302
- **Code generation follows:**
303
- - Security-first approach
304
- - YAGNI, KISS, DRY principles
305
- - Production-grade quality
306
- - Comprehensive error handling
307
- - Type safety
308
- - Performance optimization
309
- - Best practices (2025)
310
-
311
- **Never generates:**
312
- - Hardcoded secrets
313
- - Unsafe SQL queries
314
- - Unvalidated user inputs
315
- - Missing error handling
316
- - Type-unsafe code