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.
Files changed (59) hide show
  1. package/README.md +299 -0
  2. package/bin/cli.js +135 -0
  3. package/lib/installer.js +205 -0
  4. package/lib/scanner.js +341 -0
  5. package/package.json +55 -0
  6. package/templates/.claude/.env.example +13 -0
  7. package/templates/.claude/agents/debugger.md +667 -0
  8. package/templates/.claude/agents/devops.md +727 -0
  9. package/templates/.claude/agents/docs.md +661 -0
  10. package/templates/.claude/agents/implementer.md +235 -0
  11. package/templates/.claude/agents/planner.md +243 -0
  12. package/templates/.claude/agents/researcher.md +448 -0
  13. package/templates/.claude/agents/reviewer.md +610 -0
  14. package/templates/.claude/agents/security.md +202 -0
  15. package/templates/.claude/agents/tester.md +604 -0
  16. package/templates/.claude/commands/auto.md +85 -0
  17. package/templates/.claude/commands/code.md +301 -0
  18. package/templates/.claude/commands/debug.md +449 -0
  19. package/templates/.claude/commands/deploy.md +475 -0
  20. package/templates/.claude/commands/docs.md +519 -0
  21. package/templates/.claude/commands/plan.md +57 -0
  22. package/templates/.claude/commands/review.md +412 -0
  23. package/templates/.claude/commands/scan.md +146 -0
  24. package/templates/.claude/commands/secure.md +88 -0
  25. package/templates/.claude/commands/test.md +352 -0
  26. package/templates/.claude/commands/validate.md +238 -0
  27. package/templates/.claude/settings.json +27 -0
  28. package/templates/.claude/skills/codebase-context/SKILL.md +68 -0
  29. package/templates/.claude/skills/codebase-context/references/reading-context.md +68 -0
  30. package/templates/.claude/skills/codebase-context/references/refresh-triggers.md +82 -0
  31. package/templates/.claude/skills/implementation/SKILL.md +70 -0
  32. package/templates/.claude/skills/implementation/references/error-handling.md +106 -0
  33. package/templates/.claude/skills/implementation/references/security-patterns.md +73 -0
  34. package/templates/.claude/skills/implementation/references/validation-patterns.md +107 -0
  35. package/templates/.claude/skills/memory/SKILL.md +67 -0
  36. package/templates/.claude/skills/memory/references/decisions-format.md +68 -0
  37. package/templates/.claude/skills/memory/references/learning-format.md +74 -0
  38. package/templates/.claude/skills/planning/SKILL.md +72 -0
  39. package/templates/.claude/skills/planning/references/plan-templates.md +81 -0
  40. package/templates/.claude/skills/planning/references/research-phase.md +62 -0
  41. package/templates/.claude/skills/planning/references/solution-design.md +66 -0
  42. package/templates/.claude/skills/quality-assurance/SKILL.md +79 -0
  43. package/templates/.claude/skills/quality-assurance/references/review-checklist.md +72 -0
  44. package/templates/.claude/skills/quality-assurance/references/security-checklist.md +70 -0
  45. package/templates/.claude/skills/quality-assurance/references/testing-strategy.md +85 -0
  46. package/templates/.claude/statusline.sh +126 -0
  47. package/templates/.claude/workflows/development-rules.md +97 -0
  48. package/templates/.claude/workflows/orchestration-protocol.md +194 -0
  49. package/templates/.mcp.json.example +36 -0
  50. package/templates/CLAUDE.md +409 -0
  51. package/templates/README.md +331 -0
  52. package/templates/ai_context/codebase/.gitkeep +0 -0
  53. package/templates/ai_context/memory/active.md +15 -0
  54. package/templates/ai_context/memory/decisions.md +18 -0
  55. package/templates/ai_context/memory/learning.md +22 -0
  56. package/templates/ai_context/plans/.gitkeep +0 -0
  57. package/templates/ai_context/reports/.gitkeep +0 -0
  58. package/templates/docs/user-guide-th.md +454 -0
  59. package/templates/docs/user-guide.md +595 -0
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env bash
2
+ # AI Sprint Statusline
3
+ # Displays: directory, git branch, model, context usage, cost
4
+ # Requires: jq (optional - graceful fallback without it)
5
+
6
+ set -euo pipefail
7
+
8
+ # Check for jq
9
+ HAS_JQ=false
10
+ command -v jq >/dev/null 2>&1 && HAS_JQ=true
11
+
12
+ # Read JSON from stdin
13
+ INPUT=$(cat)
14
+
15
+ # Fallback without jq
16
+ if ! $HAS_JQ; then
17
+ echo "🚀 AI Sprint"
18
+ exit 0
19
+ fi
20
+
21
+ # --- Helper Functions ---
22
+
23
+ # Expand home directory to ~
24
+ expand_home() {
25
+ local path="$1"
26
+ echo "${path/#$HOME/~}"
27
+ }
28
+
29
+ # Get git branch
30
+ get_git_branch() {
31
+ if git rev-parse --git-dir >/dev/null 2>&1; then
32
+ git branch --show-current 2>/dev/null || git rev-parse --short HEAD 2>/dev/null || echo ""
33
+ fi
34
+ }
35
+
36
+ # Progress bar (12 chars): ▰▰▰▱▱▱▱▱▱▱▱▱
37
+ progress_bar() {
38
+ local percent=${1:-0}
39
+ local width=12
40
+
41
+ # Clamp to 0-100
42
+ (( percent < 0 )) && percent=0
43
+ (( percent > 100 )) && percent=100
44
+
45
+ local filled=$((percent * width / 100))
46
+ local empty=$((width - filled))
47
+
48
+ local bar=""
49
+ for ((i=0; i<filled; i++)); do bar+="▰"; done
50
+ for ((i=0; i<empty; i++)); do bar+="▱"; done
51
+
52
+ echo "$bar"
53
+ }
54
+
55
+ # Severity emoji based on percentage
56
+ severity_emoji() {
57
+ local percent=${1:-0}
58
+ if (( percent >= 90 )); then echo "🔴"
59
+ elif (( percent >= 70 )); then echo "🟡"
60
+ else echo "🟢"
61
+ fi
62
+ }
63
+
64
+ # --- Parse JSON ---
65
+
66
+ # Directory
67
+ CWD=$(echo "$INPUT" | jq -r '.workspace.current_dir // .cwd // "unknown"')
68
+ CWD=$(expand_home "$CWD")
69
+
70
+ # Model
71
+ MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "Claude"')
72
+
73
+ # Context window
74
+ INPUT_TOKENS=$(echo "$INPUT" | jq -r '.context_window.total_input_tokens // 0')
75
+ OUTPUT_TOKENS=$(echo "$INPUT" | jq -r '.context_window.total_output_tokens // 0')
76
+ CONTEXT_SIZE=$(echo "$INPUT" | jq -r '.context_window.context_window_size // 0')
77
+
78
+ CONTEXT_PCT=0
79
+ if (( CONTEXT_SIZE > 0 )); then
80
+ TOTAL_TOKENS=$((INPUT_TOKENS + OUTPUT_TOKENS))
81
+ CONTEXT_PCT=$((TOTAL_TOKENS * 100 / CONTEXT_SIZE))
82
+ fi
83
+
84
+ # Cost (optional)
85
+ COST=$(echo "$INPUT" | jq -r '.cost.total_cost_usd // empty')
86
+
87
+ # Lines changed
88
+ LINES_ADDED=$(echo "$INPUT" | jq -r '.cost.total_lines_added // 0')
89
+ LINES_REMOVED=$(echo "$INPUT" | jq -r '.cost.total_lines_removed // 0')
90
+
91
+ # --- Build Output ---
92
+
93
+ OUTPUT=""
94
+
95
+ # Directory
96
+ OUTPUT+="📁 $CWD"
97
+
98
+ # Git branch
99
+ GIT_BRANCH=$(get_git_branch)
100
+ if [[ -n "$GIT_BRANCH" ]]; then
101
+ OUTPUT+=" 🌿 $GIT_BRANCH"
102
+ fi
103
+
104
+ # Model
105
+ OUTPUT+=" 🤖 $MODEL"
106
+
107
+ # Context usage
108
+ if (( CONTEXT_PCT > 0 )); then
109
+ EMOJI=$(severity_emoji "$CONTEXT_PCT")
110
+ BAR=$(progress_bar "$CONTEXT_PCT")
111
+ OUTPUT+=" $EMOJI $BAR ${CONTEXT_PCT}%"
112
+ fi
113
+
114
+ # Cost (only show if non-zero)
115
+ if [[ -n "$COST" && "$COST" != "null" && "$COST" != "0" ]]; then
116
+ # Format to 4 decimal places
117
+ COST_FMT=$(printf "%.4f" "$COST" 2>/dev/null || echo "$COST")
118
+ OUTPUT+=" 💵 \$$COST_FMT"
119
+ fi
120
+
121
+ # Lines changed
122
+ if (( LINES_ADDED > 0 || LINES_REMOVED > 0 )); then
123
+ OUTPUT+=" 📝 +$LINES_ADDED -$LINES_REMOVED"
124
+ fi
125
+
126
+ echo "$OUTPUT"
@@ -0,0 +1,97 @@
1
+ # Development Rules
2
+
3
+ Core principles enforced across all agents and commands.
4
+
5
+ ## Core Principles
6
+
7
+ 1. **YAGNI** - You Aren't Gonna Need It
8
+ 2. **KISS** - Keep It Simple, Stupid
9
+ 3. **DRY** - Don't Repeat Yourself
10
+ 4. **Security-First** - Security in every layer
11
+
12
+ ## Date Handling
13
+
14
+ **CRITICAL**: Never guess dates. Always use bash:
15
+ ```bash
16
+ date "+%Y-%m-%d" # For reports: 2025-12-24
17
+ date "+%y%m%d-%H%M" # For filenames: 251224-2115
18
+ ```
19
+
20
+ ## Context Engineering
21
+
22
+ All AI context stored under `ai_context/`:
23
+ ```
24
+ ai_context/
25
+ ├── plans/ # Implementation plans
26
+ ├── docs/ # AI-specific documentation
27
+ ├── refs/ # Reference materials
28
+ ├── memory/ # Session memory
29
+ │ ├── learning.md # Retrospective lessons
30
+ │ ├── decisions.md # Key decisions log
31
+ │ └── active.md # Current session state
32
+ └── reports/ # Agent reports
33
+ ```
34
+
35
+ ## Memory Integration
36
+
37
+ Before any task:
38
+ - Check `ai_context/memory/learning.md` for past lessons
39
+
40
+ After any task:
41
+ - Update `ai_context/memory/learning.md` with new lessons
42
+ - Record decisions in `ai_context/memory/decisions.md`
43
+
44
+ ## Quality Gates
45
+
46
+ ### Code Quality
47
+ - [ ] All tests passing
48
+ - [ ] >80% code coverage
49
+ - [ ] No linting errors
50
+ - [ ] Types complete (TypeScript)
51
+
52
+ ### Security
53
+ - [ ] No hardcoded secrets
54
+ - [ ] Input validation present
55
+ - [ ] OWASP Top 10 compliant
56
+ - [ ] Security scan passed
57
+
58
+ ### Documentation
59
+ - [ ] Code comments where needed
60
+ - [ ] API documented
61
+ - [ ] README updated
62
+
63
+ ## Agent DO NOT Directives
64
+
65
+ Every agent must follow:
66
+ - DO NOT guess dates - use bash date command
67
+ - DO NOT hardcode secrets
68
+ - DO NOT skip security checks
69
+ - DO NOT leave failing tests
70
+ - DO NOT modify code without reading it first
71
+
72
+ ## Output Standards
73
+
74
+ ### Reports
75
+ - Save to `ai_context/reports/` with timestamped filename
76
+ - Use format: `{type}-{YYMMDD}-{slug}.md`
77
+ - Include date from bash command
78
+
79
+ ### Plans
80
+ - Save to `ai_context/plans/` with timestamped folder
81
+ - Use format: `{YYMMDD-HHMM}-{feature}/`
82
+ - Include phase files if complex
83
+
84
+ ## Review Before Commit
85
+
86
+ All code changes must pass:
87
+ 1. `/test` - All tests pass
88
+ 2. `/review` - Code quality check
89
+ 3. `/secure` - Security scan
90
+
91
+ ## Human-in-the-Loop Gates
92
+
93
+ Require user approval for:
94
+ - Production deployments
95
+ - Infrastructure changes
96
+ - Database migrations
97
+ - Security vulnerability fixes
@@ -0,0 +1,194 @@
1
+ # Orchestration Protocol
2
+
3
+ How agents coordinate and work together.
4
+
5
+ ## Agent Hierarchy
6
+
7
+ ```
8
+ Main Agent (Orchestrator)
9
+ ├── planner → Creates implementation plans
10
+ ├── implementer → Writes production code
11
+ ├── tester → Generates and runs tests
12
+ ├── reviewer → Reviews code quality
13
+ ├── security → Scans for vulnerabilities
14
+ ├── devops → Handles CI/CD and deployment
15
+ ├── docs → Creates documentation
16
+ ├── debugger → Investigates and fixes bugs
17
+ └── researcher → Researches technologies
18
+ ```
19
+
20
+ ## Delegation Pattern
21
+
22
+ ### 1. Task Analysis
23
+ Main agent analyzes request to determine:
24
+ - Complexity (simple/medium/complex)
25
+ - Required agents
26
+ - Execution order (sequential/parallel)
27
+
28
+ ### 2. Agent Selection
29
+ ```
30
+ Plan feature → planner
31
+ Write code → implementer
32
+ Generate tests → tester
33
+ Review quality → reviewer
34
+ Security scan → security
35
+ Deploy → devops
36
+ Write docs → docs
37
+ Debug issue → debugger
38
+ Research topic → researcher
39
+ ```
40
+
41
+ ### 3. Context Passing
42
+ Each agent receives:
43
+ - Task description
44
+ - Relevant files
45
+ - Memory context (`ai_context/memory/learning.md`)
46
+ - Quality requirements
47
+
48
+ ### 4. Result Collection
49
+ Main agent:
50
+ - Collects agent outputs
51
+ - Validates quality gates passed
52
+ - Aggregates reports
53
+ - Updates memory
54
+
55
+ ## Workflow Patterns
56
+
57
+ ### Sequential Workflow (Default)
58
+ ```
59
+ User Request
60
+
61
+ Plan → Code → Test → Review → Secure
62
+
63
+ Complete
64
+ ```
65
+
66
+ ### Parallel Workflow (Independent Tasks)
67
+ ```
68
+ User Request
69
+
70
+ ┌───────────┬───────────┐
71
+ │ Research │ Planning │
72
+ └─────┬─────┴─────┬─────┘
73
+ ↓ ↓
74
+ Combine Results
75
+ ```
76
+
77
+ ### Iterative Workflow (Fix Loop)
78
+ ```
79
+ Test → Fail → Debug → Fix → Test → Pass
80
+ ```
81
+
82
+ ## Quality Gates
83
+
84
+ Before proceeding to next stage:
85
+
86
+ ### After Planning
87
+ - [ ] Plan reviewed
88
+ - [ ] Risks identified
89
+ - [ ] Architecture approved
90
+
91
+ ### After Implementation
92
+ - [ ] Code follows standards
93
+ - [ ] No obvious bugs
94
+ - [ ] Error handling present
95
+
96
+ ### After Testing
97
+ - [ ] All tests pass
98
+ - [ ] >80% coverage
99
+ - [ ] Edge cases covered
100
+
101
+ ### After Review
102
+ - [ ] No critical issues
103
+ - [ ] Security checks passed
104
+ - [ ] Code quality approved
105
+
106
+ ### After Security Scan
107
+ - [ ] No critical vulnerabilities
108
+ - [ ] No secrets exposed
109
+ - [ ] Dependencies safe
110
+
111
+ ## Error Handling
112
+
113
+ ### Agent Failure
114
+ 1. Log error to `ai_context/reports/`
115
+ 2. Attempt self-correction (up to 3 times)
116
+ 3. Escalate to main agent
117
+ 4. Report to user if unresolved
118
+
119
+ ### Quality Gate Failure
120
+ 1. Identify failing checks
121
+ 2. Route to appropriate agent (debugger/implementer)
122
+ 3. Re-run quality checks
123
+ 4. Proceed when passed
124
+
125
+ ## Memory Sharing
126
+
127
+ All agents share context via:
128
+ ```
129
+ ai_context/memory/
130
+ ├── learning.md # Lessons learned (read before, update after)
131
+ ├── decisions.md # Key decisions (append only)
132
+ ├── active.md # Current session state
133
+ └── summary.md # Session summaries
134
+ ```
135
+
136
+ ### Before Task
137
+ ```
138
+ 1. Read learning.md for past mistakes
139
+ 2. Read decisions.md for relevant decisions
140
+ 3. Check active.md for current context
141
+ ```
142
+
143
+ ### After Task
144
+ ```
145
+ 1. Update learning.md with new lessons
146
+ 2. Append to decisions.md if made decisions
147
+ 3. Update active.md with new state
148
+ 4. Write report to reports/ folder
149
+ ```
150
+
151
+ ## Communication Protocol
152
+
153
+ ### Main → Agent
154
+ ```markdown
155
+ ## Task: [description]
156
+
157
+ ## Context
158
+ - Files: [relevant files]
159
+ - Memory: [past lessons]
160
+ - Requirements: [quality gates]
161
+
162
+ ## Expected Output
163
+ - [specific deliverables]
164
+ ```
165
+
166
+ ### Agent → Main
167
+ ```markdown
168
+ ## Result: [success/failure]
169
+
170
+ ## Deliverables
171
+ - [files created/modified]
172
+
173
+ ## Issues Encountered
174
+ - [any problems]
175
+
176
+ ## Recommendations
177
+ - [suggestions for improvement]
178
+ ```
179
+
180
+ ## Escalation Path
181
+
182
+ 1. Agent self-correction (3 attempts)
183
+ 2. Alternative approach
184
+ 3. Main agent intervention
185
+ 4. User consultation
186
+
187
+ ## Human-in-the-Loop
188
+
189
+ Pause for user approval:
190
+ - Before production deployment
191
+ - Before infrastructure changes
192
+ - Before database migrations
193
+ - When critical security issues found
194
+ - When blocking issues encountered
@@ -0,0 +1,36 @@
1
+ {
2
+ "mcpServers": {
3
+ "exa": {
4
+ "command": "npx",
5
+ "args": ["-y", "exa-mcp-server"],
6
+ "env": {
7
+ "EXA_API_KEY": "YOUR_EXA_API_KEY"
8
+ }
9
+ },
10
+ "context7": {
11
+ "command": "npx",
12
+ "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_CONTEXT7_API_KEY"]
13
+ },
14
+ "human-mcp": {
15
+ "command": "npx",
16
+ "args": ["@goonnguyen/human-mcp"],
17
+ "env": {
18
+ "GOOGLE_GEMINI_API_KEY": "YOUR_GEMINI_API_KEY"
19
+ }
20
+ },
21
+ "chrome-devtools": {
22
+ "command": "npx",
23
+ "args": ["-y", "chrome-devtools-mcp@latest"]
24
+ },
25
+ "sequential-thinking": {
26
+ "command": "npx",
27
+ "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
28
+ },
29
+ "time": {
30
+ "type": "stdio",
31
+ "command": "uvx",
32
+ "args": ["mcp-server-time", "--local-timezone=UTC"],
33
+ "env": {}
34
+ }
35
+ }
36
+ }