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
package/README.md
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# AI Sprint
|
|
2
|
+
|
|
3
|
+
**One-command installer for Claude Code autonomous development framework**
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🤖 **9 Specialized Agents** - Planner, Implementer, Tester, Reviewer, Security, DevOps, Docs, Debugger, Researcher
|
|
8
|
+
- ⚡ **11 Essential Commands** - `/plan`, `/code`, `/test`, `/review`, `/secure`, `/deploy`, `/docs`, `/debug`, `/scan`, `/validate`, `/auto`
|
|
9
|
+
- 🔒 **Security-First** - Built-in SAST, secret detection, dependency scanning
|
|
10
|
+
- 🚀 **Production-Ready** - OWASP Top 10 compliance, security best practices
|
|
11
|
+
- 🎯 **Autonomous** - Full development cycle with human-in-the-loop gates
|
|
12
|
+
- 🧠 **Context Engineering** - Memory system for learning across sessions
|
|
13
|
+
- 📁 **Codebase Scanning** - Auto-scan existing code with 70% token compression
|
|
14
|
+
- 📊 **Custom Statusline** - Real-time context, cost, and session tracking
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### Quick Start (Recommended)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx ai-sprint init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Global Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g ai-sprint
|
|
28
|
+
ai-sprint init
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Options
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Install in specific directory
|
|
35
|
+
npx ai-sprint init --dir /path/to/project
|
|
36
|
+
|
|
37
|
+
# Force overwrite existing .claude/
|
|
38
|
+
npx ai-sprint init --force
|
|
39
|
+
|
|
40
|
+
# Skip Python dependencies
|
|
41
|
+
npx ai-sprint init --skip-install
|
|
42
|
+
|
|
43
|
+
# Scan existing codebase (auto-detected if source exists)
|
|
44
|
+
npx ai-sprint init --scan
|
|
45
|
+
|
|
46
|
+
# Skip codebase scanning
|
|
47
|
+
npx ai-sprint init --no-scan
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## What Gets Installed
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
your-project/
|
|
54
|
+
├── .claude/
|
|
55
|
+
│ ├── agents/ # 9 specialized agents
|
|
56
|
+
│ ├── commands/ # 11 slash commands
|
|
57
|
+
│ ├── skills/ # Security scanning scripts
|
|
58
|
+
│ ├── workflows/ # Development rules
|
|
59
|
+
│ ├── settings.json # Configuration
|
|
60
|
+
│ ├── statusline.sh # Terminal statusline script
|
|
61
|
+
│ └── .env.example # Environment template
|
|
62
|
+
├── ai_context/ # AI context & artifacts
|
|
63
|
+
│ ├── plans/ # Implementation plans
|
|
64
|
+
│ ├── docs/ # AI-generated docs
|
|
65
|
+
│ ├── reports/ # Agent outputs
|
|
66
|
+
│ ├── codebase/ # Scanned codebase context (if --scan)
|
|
67
|
+
│ └── memory/ # Learning & decisions
|
|
68
|
+
├── CLAUDE.md # Framework instructions
|
|
69
|
+
└── README.md # User guide
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Usage After Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Start Claude Code
|
|
76
|
+
claude
|
|
77
|
+
|
|
78
|
+
# Use commands
|
|
79
|
+
/plan "implement user authentication"
|
|
80
|
+
/code "build the authentication system"
|
|
81
|
+
/test "generate and run tests"
|
|
82
|
+
/secure "run security scans"
|
|
83
|
+
/auto "full autonomous cycle"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Agents
|
|
87
|
+
|
|
88
|
+
| Agent | Purpose |
|
|
89
|
+
|-------|---------|
|
|
90
|
+
| **planner** | Research & create implementation plans |
|
|
91
|
+
| **implementer** | Generate production-grade code |
|
|
92
|
+
| **tester** | Create and run automated tests |
|
|
93
|
+
| **reviewer** | Code quality and best practices review |
|
|
94
|
+
| **security** | SAST, secret detection, dependency scanning |
|
|
95
|
+
| **devops** | CI/CD setup and deployment |
|
|
96
|
+
| **docs** | Generate documentation |
|
|
97
|
+
| **debugger** | Root cause analysis and fixes |
|
|
98
|
+
| **researcher** | Technology research with web search |
|
|
99
|
+
|
|
100
|
+
## Commands
|
|
101
|
+
|
|
102
|
+
| Command | Description | Example |
|
|
103
|
+
|---------|-------------|---------|
|
|
104
|
+
| `/plan` | Create implementation plan | `/plan "add payment processing"` |
|
|
105
|
+
| `/code` | Generate/refactor code | `/code "implement OAuth2 login"` |
|
|
106
|
+
| `/test` | Generate and run tests | `/test` |
|
|
107
|
+
| `/review` | Code quality review | `/review src/` |
|
|
108
|
+
| `/secure` | Security scan | `/secure` |
|
|
109
|
+
| `/deploy` | CI/CD setup | `/deploy --platform github` |
|
|
110
|
+
| `/docs` | Generate documentation | `/docs` |
|
|
111
|
+
| `/debug` | Investigate issues | `/debug "500 error on login"` |
|
|
112
|
+
| `/scan` | Scan codebase for AI context | `/scan` |
|
|
113
|
+
| `/validate` | Pre-commit validation | `/validate` |
|
|
114
|
+
| `/auto` | Automatic full cycle | `/auto "build user dashboard"` |
|
|
115
|
+
|
|
116
|
+
## Security Features
|
|
117
|
+
|
|
118
|
+
### Built-in Scans
|
|
119
|
+
- ✅ **SAST** - Static application security testing
|
|
120
|
+
- ✅ **Secret Detection** - Find hardcoded credentials
|
|
121
|
+
- ✅ **Dependency Check** - Vulnerable packages
|
|
122
|
+
- ✅ **OWASP Top 10** - Compliance validation
|
|
123
|
+
|
|
124
|
+
### Security Tools (Optional)
|
|
125
|
+
```bash
|
|
126
|
+
# Install security scanning tools
|
|
127
|
+
pip install snyk semgrep detect-secrets safety
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Configuration
|
|
131
|
+
Set API tokens in `.env`:
|
|
132
|
+
```bash
|
|
133
|
+
SNYK_TOKEN=your_token
|
|
134
|
+
SEMGREP_APP_TOKEN=your_token
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## CLI Commands
|
|
138
|
+
|
|
139
|
+
### `ai-sprint init`
|
|
140
|
+
Install framework in current or specified directory
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Current directory
|
|
144
|
+
ai-sprint init
|
|
145
|
+
|
|
146
|
+
# Specific directory
|
|
147
|
+
ai-sprint init --dir /path/to/project
|
|
148
|
+
|
|
149
|
+
# Force overwrite
|
|
150
|
+
ai-sprint init --force
|
|
151
|
+
|
|
152
|
+
# Skip Python dependencies
|
|
153
|
+
ai-sprint init --skip-install
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### `ai-sprint scan`
|
|
157
|
+
Scan codebase and generate AI context documents
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Current directory
|
|
161
|
+
ai-sprint scan
|
|
162
|
+
|
|
163
|
+
# Specific directory
|
|
164
|
+
ai-sprint scan --dir /path/to/project
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Output:** `ai_context/codebase/` with overview.md, structure.md, repomix-output.xml
|
|
168
|
+
|
|
169
|
+
### `ai-sprint list`
|
|
170
|
+
Show available agents and commands
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
ai-sprint list
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Development
|
|
177
|
+
|
|
178
|
+
### Local Testing
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Clone repository
|
|
182
|
+
git clone https://github.com/yourusername/ai-sprint
|
|
183
|
+
cd ai-sprint
|
|
184
|
+
|
|
185
|
+
# Install dependencies
|
|
186
|
+
npm install
|
|
187
|
+
|
|
188
|
+
# Link locally
|
|
189
|
+
npm link
|
|
190
|
+
|
|
191
|
+
# Test installation
|
|
192
|
+
mkdir test-project
|
|
193
|
+
cd test-project
|
|
194
|
+
ai-sprint init
|
|
195
|
+
|
|
196
|
+
# Test with Claude Code
|
|
197
|
+
claude
|
|
198
|
+
/plan "test feature"
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Package Structure
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
ai-sprint/
|
|
205
|
+
├── bin/
|
|
206
|
+
│ └── cli.js # CLI entry point
|
|
207
|
+
├── lib/
|
|
208
|
+
│ ├── installer.js # Installation logic
|
|
209
|
+
│ └── scanner.js # Codebase scanning logic
|
|
210
|
+
├── templates/
|
|
211
|
+
│ ├── .claude/ # Framework templates
|
|
212
|
+
│ ├── CLAUDE.md # Instructions
|
|
213
|
+
│ └── README.md # User guide
|
|
214
|
+
├── package.json
|
|
215
|
+
└── README.md # This file
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Requirements
|
|
219
|
+
|
|
220
|
+
- Node.js >= 18.0.0
|
|
221
|
+
- Claude Code CLI
|
|
222
|
+
- Python 3.8+ (optional, for security skills)
|
|
223
|
+
|
|
224
|
+
## Examples
|
|
225
|
+
|
|
226
|
+
### Example 1: New Project Setup
|
|
227
|
+
```bash
|
|
228
|
+
mkdir my-project
|
|
229
|
+
cd my-project
|
|
230
|
+
npx ai-sprint init
|
|
231
|
+
claude
|
|
232
|
+
/auto "build REST API for todo app"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Example 2: Add to Existing Project
|
|
236
|
+
```bash
|
|
237
|
+
cd existing-project
|
|
238
|
+
npx ai-sprint init
|
|
239
|
+
claude
|
|
240
|
+
/secure # Scan existing code
|
|
241
|
+
/review # Review code quality
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Example 3: Security-Focused Development
|
|
245
|
+
```bash
|
|
246
|
+
npx ai-sprint init
|
|
247
|
+
claude
|
|
248
|
+
/plan "implement payment processing"
|
|
249
|
+
/code "implement with PCI DSS compliance"
|
|
250
|
+
/secure # Comprehensive security scan
|
|
251
|
+
/review # Security-focused review
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Troubleshooting
|
|
255
|
+
|
|
256
|
+
### "Command not found: ai-sprint"
|
|
257
|
+
```bash
|
|
258
|
+
# Use npx instead
|
|
259
|
+
npx ai-sprint init
|
|
260
|
+
|
|
261
|
+
# Or install globally
|
|
262
|
+
npm install -g ai-sprint
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### ".claude/ already exists"
|
|
266
|
+
```bash
|
|
267
|
+
# Use --force to overwrite
|
|
268
|
+
npx ai-sprint init --force
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### "Python dependencies failed"
|
|
272
|
+
```bash
|
|
273
|
+
# Install manually
|
|
274
|
+
cd .claude/skills
|
|
275
|
+
python3 -m venv .venv
|
|
276
|
+
source .venv/bin/activate # or .venv\Scripts\activate on Windows
|
|
277
|
+
pip install -r requirements.txt
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Contributing
|
|
281
|
+
|
|
282
|
+
Contributions welcome! Please:
|
|
283
|
+
1. Fork the repository
|
|
284
|
+
2. Create a feature branch
|
|
285
|
+
3. Make your changes
|
|
286
|
+
4. Submit a pull request
|
|
287
|
+
|
|
288
|
+
## License
|
|
289
|
+
|
|
290
|
+
MIT License - see LICENSE file
|
|
291
|
+
|
|
292
|
+
## Support
|
|
293
|
+
|
|
294
|
+
- Issues: [GitHub Issues](https://github.com/yourusername/ai-sprint/issues)
|
|
295
|
+
- Documentation: [Framework README](./templates/README.md)
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
**Made with ❤️ for autonomous developers**
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { program } = require('commander');
|
|
4
|
+
const chalk = require('chalk');
|
|
5
|
+
const { install, checkExisting } = require('../lib/installer');
|
|
6
|
+
const { scanCodebase, detectSourceCode } = require('../lib/scanner');
|
|
7
|
+
const packageJson = require('../package.json');
|
|
8
|
+
|
|
9
|
+
program
|
|
10
|
+
.name('ai-sprint')
|
|
11
|
+
.description('AI Sprint - Autonomous development framework for Claude Code')
|
|
12
|
+
.version(packageJson.version);
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.command('init')
|
|
16
|
+
.description('Initialize .claude/ directory with agents, commands, and skills')
|
|
17
|
+
.option('-d, --dir <directory>', 'Target directory (default: current directory)', process.cwd())
|
|
18
|
+
.option('-f, --force', 'Overwrite existing .claude/ directory', false)
|
|
19
|
+
.option('--skip-install', 'Skip npm install for skill dependencies', false)
|
|
20
|
+
.option('-s, --scan', 'Scan existing codebase after init', false)
|
|
21
|
+
.option('--no-scan', 'Skip automatic codebase scanning')
|
|
22
|
+
.action(async (options) => {
|
|
23
|
+
console.log(chalk.blue.bold('\n🚀 AI Sprint Installer\n'));
|
|
24
|
+
|
|
25
|
+
const targetDir = options.dir;
|
|
26
|
+
|
|
27
|
+
// Check if .claude/ already exists
|
|
28
|
+
const existing = await checkExisting(targetDir);
|
|
29
|
+
if (existing && !options.force) {
|
|
30
|
+
console.log(chalk.yellow('⚠️ .claude/ directory already exists!'));
|
|
31
|
+
console.log(chalk.gray('Use --force to overwrite\n'));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
await install(targetDir, {
|
|
37
|
+
force: options.force,
|
|
38
|
+
skipInstall: options.skipInstall
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
console.log(chalk.green.bold('\n✅ Installation complete!\n'));
|
|
42
|
+
|
|
43
|
+
// Handle codebase scanning
|
|
44
|
+
let shouldScan = options.scan;
|
|
45
|
+
|
|
46
|
+
// Auto-detect if neither --scan nor --no-scan specified
|
|
47
|
+
if (!options.scan && options.scan !== false) {
|
|
48
|
+
const hasSource = await detectSourceCode(targetDir);
|
|
49
|
+
if (hasSource) {
|
|
50
|
+
console.log(chalk.cyan('📁 Source code detected. Scanning codebase...\n'));
|
|
51
|
+
shouldScan = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (shouldScan) {
|
|
56
|
+
const result = await scanCodebase(targetDir);
|
|
57
|
+
if (result.success) {
|
|
58
|
+
console.log(chalk.gray(` Output: ai_context/codebase/\n`));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log(chalk.cyan('Next steps:'));
|
|
63
|
+
console.log(chalk.gray(' 1. Review .claude/README.md for framework overview'));
|
|
64
|
+
console.log(chalk.gray(' 2. Start Claude Code: claude'));
|
|
65
|
+
console.log(chalk.gray(' 3. Try commands: /plan, /code, /test, /secure'));
|
|
66
|
+
if (!shouldScan) {
|
|
67
|
+
console.log(chalk.gray(' 4. Run /scan to analyze existing codebase\n'));
|
|
68
|
+
} else {
|
|
69
|
+
console.log('');
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error(chalk.red.bold('\n❌ Installation failed:\n'));
|
|
73
|
+
console.error(chalk.red(error.message));
|
|
74
|
+
console.error(chalk.gray('\nStack trace:'));
|
|
75
|
+
console.error(chalk.gray(error.stack));
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
program
|
|
81
|
+
.command('scan')
|
|
82
|
+
.description('Scan codebase and generate AI context documents')
|
|
83
|
+
.option('-d, --dir <directory>', 'Target directory (default: current directory)', process.cwd())
|
|
84
|
+
.action(async (options) => {
|
|
85
|
+
console.log(chalk.blue.bold('\n📁 AI Sprint Codebase Scanner\n'));
|
|
86
|
+
|
|
87
|
+
const targetDir = options.dir;
|
|
88
|
+
|
|
89
|
+
const result = await scanCodebase(targetDir);
|
|
90
|
+
|
|
91
|
+
if (result.success) {
|
|
92
|
+
console.log(chalk.green.bold('\n✅ Scan complete!\n'));
|
|
93
|
+
console.log(chalk.gray(` Files: ${result.stats.totalFiles}`));
|
|
94
|
+
console.log(chalk.gray(` Duration: ${result.stats.scanDuration}s`));
|
|
95
|
+
console.log(chalk.gray(` Output: ai_context/codebase/\n`));
|
|
96
|
+
} else if (result.skipped) {
|
|
97
|
+
console.log(chalk.yellow(`\n⚠️ Scan skipped: ${result.reason}\n`));
|
|
98
|
+
} else {
|
|
99
|
+
console.error(chalk.red.bold('\n❌ Scan failed\n'));
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
program
|
|
105
|
+
.command('list')
|
|
106
|
+
.description('List available agents and commands')
|
|
107
|
+
.action(() => {
|
|
108
|
+
console.log(chalk.blue.bold('\n🚀 AI Sprint Framework\n'));
|
|
109
|
+
|
|
110
|
+
console.log(chalk.cyan('Agents (9):'));
|
|
111
|
+
console.log(chalk.gray(' • planner - Research & architecture'));
|
|
112
|
+
console.log(chalk.gray(' • implementer - Code generation & refactoring'));
|
|
113
|
+
console.log(chalk.gray(' • tester - Test generation & automation'));
|
|
114
|
+
console.log(chalk.gray(' • reviewer - Code quality review'));
|
|
115
|
+
console.log(chalk.gray(' • security - SAST, secrets, dependencies'));
|
|
116
|
+
console.log(chalk.gray(' • devops - CI/CD & deployment'));
|
|
117
|
+
console.log(chalk.gray(' • docs - Documentation generation'));
|
|
118
|
+
console.log(chalk.gray(' • debugger - Root cause analysis'));
|
|
119
|
+
console.log(chalk.gray(' • researcher - Technology research'));
|
|
120
|
+
|
|
121
|
+
console.log(chalk.cyan('\nCommands (11):'));
|
|
122
|
+
console.log(chalk.gray(' • /plan - Create implementation plan'));
|
|
123
|
+
console.log(chalk.gray(' • /code - Generate/refactor code'));
|
|
124
|
+
console.log(chalk.gray(' • /test - Generate and run tests'));
|
|
125
|
+
console.log(chalk.gray(' • /review - Code quality review'));
|
|
126
|
+
console.log(chalk.gray(' • /secure - Security scan (SAST + secrets + deps)'));
|
|
127
|
+
console.log(chalk.gray(' • /deploy - CI/CD setup and deployment'));
|
|
128
|
+
console.log(chalk.gray(' • /docs - Generate/update documentation'));
|
|
129
|
+
console.log(chalk.gray(' • /debug - Investigate issues'));
|
|
130
|
+
console.log(chalk.gray(' • /scan - Scan codebase for AI context'));
|
|
131
|
+
console.log(chalk.gray(' • /validate - Pre-commit validation'));
|
|
132
|
+
console.log(chalk.gray(' • /auto - Automatic full development cycle\n'));
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
program.parse();
|
package/lib/installer.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const ora = require('ora');
|
|
4
|
+
const chalk = require('chalk');
|
|
5
|
+
const execa = require('execa');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Check if .claude/ directory exists in target
|
|
9
|
+
*/
|
|
10
|
+
async function checkExisting(targetDir) {
|
|
11
|
+
const claudeDir = path.join(targetDir, '.claude');
|
|
12
|
+
return await fs.pathExists(claudeDir);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Install autonomous agent framework
|
|
17
|
+
*/
|
|
18
|
+
async function install(targetDir, options = {}) {
|
|
19
|
+
const { force = false, skipInstall = false } = options;
|
|
20
|
+
|
|
21
|
+
const templateDir = path.join(__dirname, '../templates');
|
|
22
|
+
const claudeDir = path.join(targetDir, '.claude');
|
|
23
|
+
|
|
24
|
+
// Remove existing if force flag
|
|
25
|
+
if (force && await fs.pathExists(claudeDir)) {
|
|
26
|
+
const spinner = ora('Removing existing .claude/ directory...').start();
|
|
27
|
+
await fs.remove(claudeDir);
|
|
28
|
+
spinner.succeed('Removed existing .claude/ directory');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Copy template directory
|
|
32
|
+
const spinner = ora('Installing framework...').start();
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
// Copy .claude/ directory
|
|
36
|
+
await fs.copy(
|
|
37
|
+
path.join(templateDir, '.claude'),
|
|
38
|
+
claudeDir,
|
|
39
|
+
{ overwrite: force }
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Copy root files (including MCP config template)
|
|
43
|
+
const rootFiles = ['CLAUDE.md', 'README.md', '.mcp.json.example'];
|
|
44
|
+
for (const file of rootFiles) {
|
|
45
|
+
const srcPath = path.join(templateDir, file);
|
|
46
|
+
const destPath = path.join(targetDir, file);
|
|
47
|
+
|
|
48
|
+
if (await fs.pathExists(srcPath)) {
|
|
49
|
+
// Only copy if doesn't exist or force flag
|
|
50
|
+
if (!await fs.pathExists(destPath) || force) {
|
|
51
|
+
await fs.copy(srcPath, destPath);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Copy docs directory (user guide)
|
|
57
|
+
const docsDir = path.join(templateDir, 'docs');
|
|
58
|
+
if (await fs.pathExists(docsDir)) {
|
|
59
|
+
await fs.copy(docsDir, path.join(targetDir, 'docs'), { overwrite: force });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
spinner.succeed('Framework installed');
|
|
63
|
+
|
|
64
|
+
// Install skill dependencies
|
|
65
|
+
if (!skipInstall) {
|
|
66
|
+
await installSkillDependencies(claudeDir);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Create initial directories
|
|
70
|
+
await createInitialDirs(targetDir);
|
|
71
|
+
|
|
72
|
+
} catch (error) {
|
|
73
|
+
spinner.fail('Installation failed');
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Install Python dependencies for skills
|
|
80
|
+
*/
|
|
81
|
+
async function installSkillDependencies(claudeDir) {
|
|
82
|
+
const skillsDir = path.join(claudeDir, 'skills');
|
|
83
|
+
const requirementsPath = path.join(skillsDir, 'requirements.txt');
|
|
84
|
+
|
|
85
|
+
if (!await fs.pathExists(requirementsPath)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const spinner = ora('Installing skill dependencies...').start();
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
// Check if Python 3 is available
|
|
93
|
+
try {
|
|
94
|
+
await execa('python3', ['--version']);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
spinner.warn('Python 3 not found. Skipping skill dependencies.');
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Create virtual environment
|
|
101
|
+
const venvDir = path.join(skillsDir, '.venv');
|
|
102
|
+
if (!await fs.pathExists(venvDir)) {
|
|
103
|
+
await execa('python3', ['-m', 'venv', '.venv'], {
|
|
104
|
+
cwd: skillsDir
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Install requirements
|
|
109
|
+
const pythonPath = process.platform === 'win32'
|
|
110
|
+
? path.join(venvDir, 'Scripts', 'python.exe')
|
|
111
|
+
: path.join(venvDir, 'bin', 'python3');
|
|
112
|
+
|
|
113
|
+
await execa(pythonPath, ['-m', 'pip', 'install', '-r', 'requirements.txt'], {
|
|
114
|
+
cwd: skillsDir
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
spinner.succeed('Skill dependencies installed');
|
|
118
|
+
} catch (error) {
|
|
119
|
+
spinner.warn('Failed to install skill dependencies. You can install manually later.');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Create initial project directories
|
|
125
|
+
*/
|
|
126
|
+
async function createInitialDirs(targetDir) {
|
|
127
|
+
const dirs = [
|
|
128
|
+
'ai_context',
|
|
129
|
+
'ai_context/plans',
|
|
130
|
+
'ai_context/docs',
|
|
131
|
+
'ai_context/reports',
|
|
132
|
+
'ai_context/memory',
|
|
133
|
+
'docs',
|
|
134
|
+
'plans',
|
|
135
|
+
'plans/reports'
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
for (const dir of dirs) {
|
|
139
|
+
const dirPath = path.join(targetDir, dir);
|
|
140
|
+
await fs.ensureDir(dirPath);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Create initial memory files
|
|
144
|
+
const memoryFiles = {
|
|
145
|
+
'ai_context/memory/learning.md': `# Learning Log
|
|
146
|
+
|
|
147
|
+
Lessons learned from past development sessions.
|
|
148
|
+
|
|
149
|
+
## Format
|
|
150
|
+
|
|
151
|
+
\`\`\`markdown
|
|
152
|
+
### [Date] - Lesson Title
|
|
153
|
+
**Context:** What happened
|
|
154
|
+
**Lesson:** What we learned
|
|
155
|
+
**Action:** How to avoid/apply in future
|
|
156
|
+
\`\`\`
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
_No lessons recorded yet._
|
|
161
|
+
`,
|
|
162
|
+
'ai_context/memory/decisions.md': `# Architecture Decisions
|
|
163
|
+
|
|
164
|
+
Key technical and design decisions made during development.
|
|
165
|
+
|
|
166
|
+
## Format
|
|
167
|
+
|
|
168
|
+
\`\`\`markdown
|
|
169
|
+
### [Date] - Decision Title
|
|
170
|
+
**Context:** Why this decision was needed
|
|
171
|
+
**Decision:** What was decided
|
|
172
|
+
**Consequences:** Trade-offs and implications
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
_No decisions recorded yet._
|
|
178
|
+
`,
|
|
179
|
+
'ai_context/memory/active.md': `# Active Session Context
|
|
180
|
+
|
|
181
|
+
Current development focus and session state.
|
|
182
|
+
|
|
183
|
+
## Current Focus
|
|
184
|
+
_Not set_
|
|
185
|
+
|
|
186
|
+
## Recent Actions
|
|
187
|
+
_None_
|
|
188
|
+
|
|
189
|
+
## Next Steps
|
|
190
|
+
_None_
|
|
191
|
+
`
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
for (const [file, content] of Object.entries(memoryFiles)) {
|
|
195
|
+
const filePath = path.join(targetDir, file);
|
|
196
|
+
if (!await fs.pathExists(filePath)) {
|
|
197
|
+
await fs.writeFile(filePath, content);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
module.exports = {
|
|
203
|
+
install,
|
|
204
|
+
checkExisting
|
|
205
|
+
};
|