ai-development-framework 0.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/.claude/agents/_template/AGENT.md +36 -0
- package/.claude/agents/architect-agent/AGENT.md +60 -0
- package/.claude/agents/architect-agent/decisions/log.md +18 -0
- package/.claude/agents/architect-agent/frontend/.gitkeep +0 -0
- package/.claude/agents/architect-agent/index.md +32 -0
- package/.claude/agents/architect-agent/modules/.gitkeep +0 -0
- package/.claude/agents/architect-agent/shared/patterns.md +19 -0
- package/.claude/agents/mobile-tester-agent/AGENT.md +46 -0
- package/.claude/agents/mobile-tester-agent/screen-patterns.md +42 -0
- package/.claude/agents/tester-agent/AGENT.md +44 -0
- package/.claude/agents/tester-agent/auth-state.md +22 -0
- package/.claude/agents/tester-agent/test-patterns.md +36 -0
- package/.claude/agents/ui-ux-analyzer/AGENT.md +75 -0
- package/.claude/commands/create-prd.md +55 -0
- package/.claude/commands/evolve.md +84 -0
- package/.claude/commands/execute.md +76 -0
- package/.claude/commands/plan-feature.md +100 -0
- package/.claude/commands/plan-project.md +110 -0
- package/.claude/commands/prime.md +71 -0
- package/.claude/commands/setup.md +81 -0
- package/.claude/commands/ship.md +73 -0
- package/.claude/commands/start.md +63 -0
- package/.claude/commands/validate.md +72 -0
- package/.claude/hooks/architect-sync.sh +18 -0
- package/.claude/hooks/branch-guard.sh +15 -0
- package/.claude/hooks/evolve-reminder.sh +13 -0
- package/.claude/hooks/plan-required.sh +20 -0
- package/.claude/hooks/session-primer.sh +38 -0
- package/.claude/references/claude-md-template.md +90 -0
- package/.claude/references/code-patterns.md +37 -0
- package/.claude/references/issue-template.md +56 -0
- package/.claude/references/plan-template.md +92 -0
- package/.claude/references/prd-template.md +119 -0
- package/.claude/rules/_global.md +22 -0
- package/.claude/rules/_template.md +23 -0
- package/.claude/rules/backend.md +29 -0
- package/.claude/rules/database.md +28 -0
- package/.claude/rules/frontend.md +34 -0
- package/.claude/rules/mobile.md +33 -0
- package/.claude/rules/testing.md +37 -0
- package/.claude/settings.local.json +27 -0
- package/.claude/skills/e2e-test/SKILL.md +87 -0
- package/.claude/skills/playwright-cli/SKILL.md +97 -0
- package/CLAUDE.md +65 -0
- package/README.md +83 -0
- package/cli/index.js +35 -0
- package/cli/init.js +219 -0
- package/cli/update.js +120 -0
- package/docs/command-reference.md +41 -0
- package/docs/customization.md +33 -0
- package/docs/getting-started.md +68 -0
- package/docs/methodology.md +78 -0
- package/docs/plans/2026-03-30-ai-development-framework-design.md +483 -0
- package/docs/plugin-install-guide.md +66 -0
- package/docs/superpowers/plans/2026-03-30-framework-implementation.md +3462 -0
- package/package.json +28 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: e2e-test
|
|
3
|
+
description: End-to-end testing orchestration. Discovers user journeys, runs browser tests, validates database state, auto-fixes bugs found during testing, generates report.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# E2E Test Skill
|
|
7
|
+
|
|
8
|
+
Orchestrates a comprehensive end-to-end testing run across the application.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- After implementing a feature (before /ship)
|
|
13
|
+
- As part of /validate
|
|
14
|
+
- When verifying existing functionality still works
|
|
15
|
+
|
|
16
|
+
## Process
|
|
17
|
+
|
|
18
|
+
### Phase 1: Pre-flight
|
|
19
|
+
1. Check that the application is running (curl the base URL)
|
|
20
|
+
2. If not running, start it using the dev command from test-patterns.md
|
|
21
|
+
3. Verify agent-browser or playwright-cli is available
|
|
22
|
+
|
|
23
|
+
### Phase 2: Discovery
|
|
24
|
+
Launch 2-3 parallel sub-agents to gather intelligence:
|
|
25
|
+
|
|
26
|
+
**Agent 1 — App Structure:**
|
|
27
|
+
- Read tester-agent/test-patterns.md
|
|
28
|
+
- Identify all user-facing pages/routes
|
|
29
|
+
- Map critical user journeys (signup, login, use feature, logout)
|
|
30
|
+
|
|
31
|
+
**Agent 2 — Data Flows:**
|
|
32
|
+
- Read architect-agent knowledge base
|
|
33
|
+
- Identify data-modifying operations (create, update, delete)
|
|
34
|
+
- Note expected database state changes
|
|
35
|
+
|
|
36
|
+
**Agent 3 — Bug Hunting:**
|
|
37
|
+
- Read recent git changes (git diff main...HEAD)
|
|
38
|
+
- Identify areas most likely to have bugs
|
|
39
|
+
- Prioritize testing for changed code paths
|
|
40
|
+
|
|
41
|
+
### Phase 3: Test Execution
|
|
42
|
+
|
|
43
|
+
For each discovered user journey:
|
|
44
|
+
|
|
45
|
+
1. **Navigate** to the starting page
|
|
46
|
+
2. **Execute** each step in the journey
|
|
47
|
+
3. **Verify** UI state after each step (elements visible, correct content)
|
|
48
|
+
4. **Verify** database state after data-modifying steps (query DB directly)
|
|
49
|
+
5. **Test** at 3 viewports: desktop (1440px), tablet (768px), mobile (375px)
|
|
50
|
+
6. **Screenshot** on failures only
|
|
51
|
+
|
|
52
|
+
### Phase 4: Fix Loop
|
|
53
|
+
|
|
54
|
+
When a test fails:
|
|
55
|
+
1. Diagnose the root cause
|
|
56
|
+
2. Fix the code
|
|
57
|
+
3. Re-run the failing step
|
|
58
|
+
4. Screenshot the fix
|
|
59
|
+
5. Continue testing
|
|
60
|
+
|
|
61
|
+
### Phase 5: Report
|
|
62
|
+
|
|
63
|
+
Generate a test report:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
# E2E Test Report — YYYY-MM-DD
|
|
67
|
+
|
|
68
|
+
## Summary
|
|
69
|
+
- Journeys tested: N
|
|
70
|
+
- Steps executed: N
|
|
71
|
+
- Passed: N
|
|
72
|
+
- Failed: N (M auto-fixed)
|
|
73
|
+
|
|
74
|
+
## Journeys
|
|
75
|
+
|
|
76
|
+
### [Journey Name]
|
|
77
|
+
- Status: PASS / FAIL
|
|
78
|
+
- Steps: N/N passed
|
|
79
|
+
- Viewports: desktop, tablet, mobile
|
|
80
|
+
- Fixes applied: [list if any]
|
|
81
|
+
|
|
82
|
+
## Auto-Fixes Applied
|
|
83
|
+
- [File: change description]
|
|
84
|
+
|
|
85
|
+
## Remaining Issues
|
|
86
|
+
- [Issue description — create GitHub issue]
|
|
87
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playwright-cli
|
|
3
|
+
description: Browser automation command reference for playwright-cli. Navigation, interaction, screenshots, forms, state management, debugging.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Playwright CLI Reference
|
|
7
|
+
|
|
8
|
+
## Core Commands
|
|
9
|
+
|
|
10
|
+
### Navigation
|
|
11
|
+
```bash
|
|
12
|
+
npx playwright-cli open <url> # Open URL
|
|
13
|
+
npx playwright-cli navigate <url> # Navigate to URL
|
|
14
|
+
npx playwright-cli snapshot # Get DOM snapshot with element refs
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Interaction
|
|
18
|
+
```bash
|
|
19
|
+
npx playwright-cli click <ref> # Click element by ref from snapshot
|
|
20
|
+
npx playwright-cli fill <ref> <value> # Fill input field
|
|
21
|
+
npx playwright-cli select <ref> <value> # Select dropdown option
|
|
22
|
+
npx playwright-cli check <ref> # Check checkbox
|
|
23
|
+
npx playwright-cli uncheck <ref> # Uncheck checkbox
|
|
24
|
+
npx playwright-cli hover <ref> # Hover over element
|
|
25
|
+
npx playwright-cli press <key> # Press keyboard key
|
|
26
|
+
npx playwright-cli type <text> # Type text (character by character)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Screenshots and Recording
|
|
30
|
+
```bash
|
|
31
|
+
npx playwright-cli screenshot <path> # Take screenshot
|
|
32
|
+
npx playwright-cli screenshot --full <path> # Full page screenshot
|
|
33
|
+
npx playwright-cli video start <path> # Start recording
|
|
34
|
+
npx playwright-cli video stop # Stop recording
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Waiting
|
|
38
|
+
```bash
|
|
39
|
+
npx playwright-cli wait <ref> # Wait for element visible
|
|
40
|
+
npx playwright-cli wait-hidden <ref> # Wait for element hidden
|
|
41
|
+
npx playwright-cli wait-navigation # Wait for page navigation
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Dialog Handling
|
|
45
|
+
```bash
|
|
46
|
+
npx playwright-cli dialog accept # Accept alert/confirm/prompt
|
|
47
|
+
npx playwright-cli dialog dismiss # Dismiss dialog
|
|
48
|
+
npx playwright-cli dialog accept <text> # Accept prompt with text
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Session and State
|
|
52
|
+
```bash
|
|
53
|
+
npx playwright-cli storage save <path> # Save browser state (cookies, localStorage)
|
|
54
|
+
npx playwright-cli storage load <path> # Load saved state
|
|
55
|
+
npx playwright-cli cookies get # Get all cookies
|
|
56
|
+
npx playwright-cli cookies clear # Clear cookies
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Network
|
|
60
|
+
```bash
|
|
61
|
+
npx playwright-cli network intercept <pattern> <response-file> # Mock network request
|
|
62
|
+
npx playwright-cli network log # Show network requests
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Viewport
|
|
66
|
+
```bash
|
|
67
|
+
npx playwright-cli viewport <width> <height> # Set viewport size
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Common Patterns
|
|
71
|
+
|
|
72
|
+
### Login Flow
|
|
73
|
+
```bash
|
|
74
|
+
npx playwright-cli open http://localhost:3000/login
|
|
75
|
+
npx playwright-cli snapshot
|
|
76
|
+
npx playwright-cli fill ref:email "test@example.com"
|
|
77
|
+
npx playwright-cli fill ref:password "testpassword123"
|
|
78
|
+
npx playwright-cli click ref:submit
|
|
79
|
+
npx playwright-cli wait-navigation
|
|
80
|
+
npx playwright-cli snapshot # Verify dashboard loaded
|
|
81
|
+
npx playwright-cli storage save auth-state.json # Save for reuse
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Responsive Testing
|
|
85
|
+
```bash
|
|
86
|
+
# Desktop
|
|
87
|
+
npx playwright-cli viewport 1440 900
|
|
88
|
+
npx playwright-cli screenshot desktop.png
|
|
89
|
+
|
|
90
|
+
# Tablet
|
|
91
|
+
npx playwright-cli viewport 768 1024
|
|
92
|
+
npx playwright-cli screenshot tablet.png
|
|
93
|
+
|
|
94
|
+
# Mobile
|
|
95
|
+
npx playwright-cli viewport 375 812
|
|
96
|
+
npx playwright-cli screenshot mobile.png
|
|
97
|
+
```
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# AIDevelopmentFramework
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Open-source agentic AI coding framework built on the PIV+E loop (Plan, Implement, Validate, Evolve). Claude Code primary, methodology portable to any AI coding tool.
|
|
6
|
+
|
|
7
|
+
## Tech Stack
|
|
8
|
+
|
|
9
|
+
- Claude Code CLI (commands, agents, skills, rules, hooks)
|
|
10
|
+
- Node.js (CLI tool)
|
|
11
|
+
- GitHub (issues, milestones, PRs)
|
|
12
|
+
|
|
13
|
+
## Core Principles
|
|
14
|
+
|
|
15
|
+
1. **Context is precious** — manage it deliberately; recommend context resets for complex work
|
|
16
|
+
2. **Plans are artifacts** — they survive session boundaries and pass the "no prior knowledge" test
|
|
17
|
+
3. **Discipline scales with complexity** — XL features get full ceremony, S tweaks get fast-tracked
|
|
18
|
+
4. **The system self-improves** — every AI mistake becomes a rule, pattern, or guardrail
|
|
19
|
+
5. **Ship everything, install nothing** — framework works out of the box; external plugins stay fresh from source
|
|
20
|
+
|
|
21
|
+
## Pipeline Commands (PIV+E)
|
|
22
|
+
|
|
23
|
+
| Command | Phase | Purpose |
|
|
24
|
+
|---------|-------|---------|
|
|
25
|
+
| `/start` | Router | Detects scope level, routes to correct pipeline |
|
|
26
|
+
| `/prime` | Plan | Loads codebase context into session |
|
|
27
|
+
| `/create-prd` | Plan | Generates PRD from idea (includes brainstorming) |
|
|
28
|
+
| `/plan-project` | Plan | Decomposes PRD into GitHub milestones + issues |
|
|
29
|
+
| `/plan-feature` | Plan | Creates detailed implementation plan for a feature |
|
|
30
|
+
| `/execute` | Implement | Executes plan with TDD, domain skills, parallel agents |
|
|
31
|
+
| `/validate` | Validate | Runs verification, testing agents, code review |
|
|
32
|
+
| `/ship` | Validate | Commits, pushes, creates PR, finishes branch |
|
|
33
|
+
| `/evolve` | Evolve | Updates rules and knowledge base from learnings |
|
|
34
|
+
| `/setup` | Utility | Checks installed plugins/skills, reports health |
|
|
35
|
+
|
|
36
|
+
## Scope Levels
|
|
37
|
+
|
|
38
|
+
- **L0 (Project):** /brainstorm → /create-prd → /plan-project → /create-rules → per-issue L2
|
|
39
|
+
- **L1 (Feature):** /brainstorm → /plan-feature → creates issue(s) → per-issue L2
|
|
40
|
+
- **L2 (Issue):** gh issue view → /prime → /writing-plans → /execute → /validate → /ship
|
|
41
|
+
- **L3 (Bug):** gh issue view → /prime → /systematic-debugging → fix → /validate → /ship
|
|
42
|
+
|
|
43
|
+
## Mode Selection
|
|
44
|
+
|
|
45
|
+
For non-trivial tasks, choose your discipline level:
|
|
46
|
+
|
|
47
|
+
- **Superpowers Mode:** Full PIV+E pipeline — brainstorm → plan → TDD → execute → verify → review → ship → evolve
|
|
48
|
+
- **Standard Mode:** Lighter workflow — plan → implement → validate → ship
|
|
49
|
+
|
|
50
|
+
## Agents
|
|
51
|
+
|
|
52
|
+
- **architect-agent** — Codebase knowledge base. Call before structural changes (RETRIEVE/IMPACT/RECORD/PATTERN)
|
|
53
|
+
- **tester-agent** — Web browser testing via playwright-cli (VERIFY/FLOW)
|
|
54
|
+
- **mobile-tester-agent** — Mobile app testing via mobile-mcp (VERIFY/FLOW)
|
|
55
|
+
- **ui-ux-analyzer** — Design audit agent with screenshots and reports
|
|
56
|
+
|
|
57
|
+
## Rules & References
|
|
58
|
+
|
|
59
|
+
- Domain-specific rules auto-load from `.claude/rules/` based on file paths being edited
|
|
60
|
+
- Reference templates in `.claude/references/` are loaded on-demand by commands
|
|
61
|
+
- See `docs/customization.md` for adding custom rules and agents
|
|
62
|
+
|
|
63
|
+
## External Dependencies
|
|
64
|
+
|
|
65
|
+
Run `/setup` to check what's installed. See `docs/plugin-install-guide.md` for full list.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# AIDevelopmentFramework
|
|
2
|
+
|
|
3
|
+
The system around the AI that makes the AI reliable.
|
|
4
|
+
|
|
5
|
+
An open-source framework for structured AI-assisted software development. Built on the **PIV+E loop** (Plan, Implement, Validate, Evolve) — a methodology where the human owns planning and validation, the AI owns implementation, and the system gets smarter with every cycle.
|
|
6
|
+
|
|
7
|
+
## Why This Exists
|
|
8
|
+
|
|
9
|
+
AI coding assistants are powerful but unpredictable. They lose context, repeat mistakes, and produce code that looks right but isn't. The solution isn't a better AI — it's a better **system around the AI**: plans that survive session boundaries, rules that prevent known mistakes, agents that maintain architectural knowledge, and a self-improving feedback loop.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Existing Project
|
|
14
|
+
1. Copy `.claude/` into your project root
|
|
15
|
+
2. Run `/setup` to check installed plugins
|
|
16
|
+
3. Run `/prime` to load context
|
|
17
|
+
4. Run `/start` to begin
|
|
18
|
+
|
|
19
|
+
### New Project
|
|
20
|
+
1. Copy `.claude/` into your project root
|
|
21
|
+
2. Run `/setup` to install dependencies
|
|
22
|
+
3. Run `/start` and choose "Starting a new project"
|
|
23
|
+
|
|
24
|
+
## The PIV+E Loop
|
|
25
|
+
|
|
26
|
+
**Plan** — Brainstorm, write specs, decompose into issues
|
|
27
|
+
**Implement** — TDD, execute plans, use specialist agents
|
|
28
|
+
**Validate** — Automated checks, visual testing, code review
|
|
29
|
+
**Evolve** — Update rules and knowledge from what was learned
|
|
30
|
+
|
|
31
|
+
## Pipeline Commands
|
|
32
|
+
|
|
33
|
+
| Command | Phase | Purpose |
|
|
34
|
+
|---------|-------|---------|
|
|
35
|
+
| `/start` | Router | Detects what you're doing, routes to the right pipeline |
|
|
36
|
+
| `/prime` | Plan | Loads codebase context into session |
|
|
37
|
+
| `/create-prd` | Plan | Brainstorms and generates a PRD |
|
|
38
|
+
| `/plan-project` | Plan | Decomposes PRD into GitHub milestones and issues |
|
|
39
|
+
| `/plan-feature` | Plan | Creates detailed implementation plan |
|
|
40
|
+
| `/execute` | Implement | Executes plan with TDD, step by step |
|
|
41
|
+
| `/validate` | Validate | Runs lint, tests, visual testing, code review |
|
|
42
|
+
| `/ship` | Validate | Commits, pushes, creates PR |
|
|
43
|
+
| `/evolve` | Evolve | Updates rules and knowledge base |
|
|
44
|
+
| `/setup` | Utility | Checks framework health |
|
|
45
|
+
|
|
46
|
+
## What's Inside
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
.claude/
|
|
50
|
+
├── commands/ 10 pipeline commands (the workflow)
|
|
51
|
+
├── agents/ 4 specialist agents + template
|
|
52
|
+
├── skills/ Framework-specific skills
|
|
53
|
+
├── rules/ Auto-loading domain rules
|
|
54
|
+
├── references/ Templates (PRD, plan, issue, patterns)
|
|
55
|
+
└── hooks/ Guardrails (branch protection, reminders)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Scope Levels
|
|
59
|
+
|
|
60
|
+
| Level | Entry Point | Pipeline |
|
|
61
|
+
|-------|------------|---------|
|
|
62
|
+
| L0 | "I have an idea" | /create-prd then /plan-project then per-issue L2 |
|
|
63
|
+
| L1 | "I need a feature" | /plan-feature then per-issue L2 |
|
|
64
|
+
| L2 | "I have issue #42" | /prime then /plan then /execute then /validate then /ship |
|
|
65
|
+
| L3 | "There's a bug" | /prime then debug then fix then /validate then /ship |
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
- [Methodology](docs/methodology.md) — The PIV+E loop explained
|
|
70
|
+
- [Getting Started](docs/getting-started.md) — Setup and walkthrough
|
|
71
|
+
- [Command Reference](docs/command-reference.md) — All commands
|
|
72
|
+
- [Customization](docs/customization.md) — Adding agents, rules, skills
|
|
73
|
+
- [Plugin Install Guide](docs/plugin-install-guide.md) — Dependencies
|
|
74
|
+
|
|
75
|
+
## Credits
|
|
76
|
+
|
|
77
|
+
Synthesizes approaches from:
|
|
78
|
+
- [Cole Medin's AI Coding Summit Workshop](https://github.com/coleam00/ai-coding-summit-workshop-2) — PIV loop, context resets, plan-as-specification
|
|
79
|
+
- Real-world battle-tested Claude Code configurations from production development
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT
|
package/cli/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const command = process.argv[2];
|
|
4
|
+
|
|
5
|
+
switch (command) {
|
|
6
|
+
case 'init':
|
|
7
|
+
require('./init.js');
|
|
8
|
+
break;
|
|
9
|
+
case 'update':
|
|
10
|
+
require('./update.js');
|
|
11
|
+
break;
|
|
12
|
+
case '--version':
|
|
13
|
+
case '-v':
|
|
14
|
+
console.log(require('../package.json').version);
|
|
15
|
+
break;
|
|
16
|
+
case '--help':
|
|
17
|
+
case '-h':
|
|
18
|
+
case undefined:
|
|
19
|
+
console.log(`
|
|
20
|
+
AIDevelopmentFramework — The system around the AI that makes the AI reliable.
|
|
21
|
+
|
|
22
|
+
Usage:
|
|
23
|
+
npx ai-framework init Download and set up the framework in the current project
|
|
24
|
+
npx ai-framework update Update framework files to the latest version
|
|
25
|
+
npx ai-framework --version Show version
|
|
26
|
+
npx ai-framework --help Show this help message
|
|
27
|
+
|
|
28
|
+
Docs: https://github.com/cristian-robert/AIDevelopmentFramework
|
|
29
|
+
`);
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
console.error('Unknown command: ' + command);
|
|
33
|
+
console.log('Run "npx ai-framework --help" for usage information.');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
package/cli/init.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execFileSync } = require('child_process');
|
|
4
|
+
const readline = require('readline');
|
|
5
|
+
|
|
6
|
+
const REPO = 'cristian-robert/AIDevelopmentFramework';
|
|
7
|
+
const BRANCH = 'main';
|
|
8
|
+
const TARBALL_URL = 'https://github.com/' + REPO + '/archive/refs/heads/' + BRANCH + '.tar.gz';
|
|
9
|
+
|
|
10
|
+
const rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function ask(question) {
|
|
16
|
+
return new Promise(function (resolve) {
|
|
17
|
+
rl.question(question, resolve);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function copyDirRecursive(src, dest) {
|
|
22
|
+
if (!fs.existsSync(dest)) {
|
|
23
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
var entries = fs.readdirSync(src, { withFileTypes: true });
|
|
26
|
+
for (var i = 0; i < entries.length; i++) {
|
|
27
|
+
var entry = entries[i];
|
|
28
|
+
var srcPath = path.join(src, entry.name);
|
|
29
|
+
var destPath = path.join(dest, entry.name);
|
|
30
|
+
if (entry.isDirectory()) {
|
|
31
|
+
copyDirRecursive(srcPath, destPath);
|
|
32
|
+
} else {
|
|
33
|
+
fs.copyFileSync(srcPath, destPath);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function downloadFramework(targetDir) {
|
|
39
|
+
var tmpDir = path.join(require('os').tmpdir(), 'ai-framework-' + Date.now());
|
|
40
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
41
|
+
|
|
42
|
+
console.log('Downloading latest framework from GitHub...');
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
// Download and extract tarball
|
|
46
|
+
execFileSync('curl', ['-sL', TARBALL_URL, '-o', path.join(tmpDir, 'framework.tar.gz')]);
|
|
47
|
+
execFileSync('tar', ['-xzf', path.join(tmpDir, 'framework.tar.gz'), '-C', tmpDir, '--strip-components=1']);
|
|
48
|
+
|
|
49
|
+
// Copy .claude/ folder
|
|
50
|
+
var sourceClaudeDir = path.join(tmpDir, '.claude');
|
|
51
|
+
var targetClaudeDir = path.join(targetDir, '.claude');
|
|
52
|
+
|
|
53
|
+
if (fs.existsSync(sourceClaudeDir)) {
|
|
54
|
+
console.log('Installing .claude/ framework structure...');
|
|
55
|
+
copyDirRecursive(sourceClaudeDir, targetClaudeDir);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Copy docs/ folder
|
|
59
|
+
var sourceDocsDir = path.join(tmpDir, 'docs');
|
|
60
|
+
var targetDocsDir = path.join(targetDir, 'docs');
|
|
61
|
+
|
|
62
|
+
if (fs.existsSync(sourceDocsDir)) {
|
|
63
|
+
console.log('Installing docs/...');
|
|
64
|
+
copyDirRecursive(sourceDocsDir, targetDocsDir);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return true;
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.error('Download failed: ' + err.message);
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log('Falling back to local copy...');
|
|
72
|
+
return false;
|
|
73
|
+
} finally {
|
|
74
|
+
// Cleanup tmp
|
|
75
|
+
try {
|
|
76
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
77
|
+
} catch (e) {
|
|
78
|
+
// ignore cleanup errors
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function detectTechStack() {
|
|
84
|
+
var detected = [];
|
|
85
|
+
try {
|
|
86
|
+
var pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
|
87
|
+
var deps = Object.assign({}, pkg.dependencies, pkg.devDependencies);
|
|
88
|
+
if (deps['next']) detected.push('Next.js');
|
|
89
|
+
if (deps['react']) detected.push('React');
|
|
90
|
+
if (deps['vue']) detected.push('Vue');
|
|
91
|
+
if (deps['svelte'] || deps['@sveltejs/kit']) detected.push('Svelte');
|
|
92
|
+
if (deps['express']) detected.push('Express');
|
|
93
|
+
if (deps['@nestjs/core']) detected.push('NestJS');
|
|
94
|
+
if (deps['expo']) detected.push('Expo');
|
|
95
|
+
if (deps['@supabase/supabase-js']) detected.push('Supabase');
|
|
96
|
+
if (deps['tailwindcss']) detected.push('Tailwind');
|
|
97
|
+
if (deps['stripe']) detected.push('Stripe');
|
|
98
|
+
if (deps['prisma'] || deps['@prisma/client']) detected.push('Prisma');
|
|
99
|
+
if (deps['drizzle-orm']) detected.push('Drizzle');
|
|
100
|
+
if (deps['mongoose']) detected.push('MongoDB/Mongoose');
|
|
101
|
+
} catch (e) {
|
|
102
|
+
// No package.json or parse error
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (fs.existsSync('requirements.txt') || fs.existsSync('pyproject.toml')) {
|
|
106
|
+
detected.push('Python');
|
|
107
|
+
try {
|
|
108
|
+
var reqContent = '';
|
|
109
|
+
if (fs.existsSync('requirements.txt')) {
|
|
110
|
+
reqContent = fs.readFileSync('requirements.txt', 'utf-8');
|
|
111
|
+
} else if (fs.existsSync('pyproject.toml')) {
|
|
112
|
+
reqContent = fs.readFileSync('pyproject.toml', 'utf-8');
|
|
113
|
+
}
|
|
114
|
+
if (reqContent.includes('fastapi')) detected.push('FastAPI');
|
|
115
|
+
if (reqContent.includes('django')) detected.push('Django');
|
|
116
|
+
if (reqContent.includes('flask')) detected.push('Flask');
|
|
117
|
+
} catch (e) {
|
|
118
|
+
// ignore read errors
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (fs.existsSync('go.mod')) detected.push('Go');
|
|
122
|
+
if (fs.existsSync('Cargo.toml')) detected.push('Rust');
|
|
123
|
+
|
|
124
|
+
return detected;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function main() {
|
|
128
|
+
console.log('');
|
|
129
|
+
console.log(' AIDevelopmentFramework');
|
|
130
|
+
console.log(' The system around the AI that makes the AI reliable.');
|
|
131
|
+
console.log('');
|
|
132
|
+
|
|
133
|
+
var targetDir = process.cwd();
|
|
134
|
+
var hasGit = fs.existsSync('.git');
|
|
135
|
+
var hasClaudeDir = fs.existsSync('.claude');
|
|
136
|
+
|
|
137
|
+
// Check if .claude/ already exists
|
|
138
|
+
if (hasClaudeDir) {
|
|
139
|
+
var overwrite = await ask('.claude/ already exists. Overwrite? (yes/no): ');
|
|
140
|
+
if (overwrite.toLowerCase() !== 'yes' && overwrite.toLowerCase() !== 'y') {
|
|
141
|
+
console.log('Aborted. Use "npx ai-framework update" to update existing installation.');
|
|
142
|
+
rl.close();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Detect tech stack
|
|
148
|
+
var stack = detectTechStack();
|
|
149
|
+
if (stack.length > 0) {
|
|
150
|
+
console.log('Detected tech stack: ' + stack.join(', '));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Download from GitHub (latest version)
|
|
154
|
+
var downloaded = downloadFramework(targetDir);
|
|
155
|
+
|
|
156
|
+
// Fall back to local copy if download fails (when installed via npm)
|
|
157
|
+
if (!downloaded) {
|
|
158
|
+
var frameworkDir = path.join(__dirname, '..');
|
|
159
|
+
var localClaudeDir = path.join(frameworkDir, '.claude');
|
|
160
|
+
if (fs.existsSync(localClaudeDir)) {
|
|
161
|
+
console.log('Copying from local package...');
|
|
162
|
+
copyDirRecursive(localClaudeDir, path.join(targetDir, '.claude'));
|
|
163
|
+
|
|
164
|
+
var localDocsDir = path.join(frameworkDir, 'docs');
|
|
165
|
+
if (fs.existsSync(localDocsDir)) {
|
|
166
|
+
copyDirRecursive(localDocsDir, path.join(targetDir, 'docs'));
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
console.error('No local framework files found. Please check your installation.');
|
|
170
|
+
rl.close();
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Create docs/plans directory
|
|
176
|
+
var plansDir = path.join(targetDir, 'docs', 'plans');
|
|
177
|
+
if (!fs.existsSync(plansDir)) {
|
|
178
|
+
fs.mkdirSync(plansDir, { recursive: true });
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Init git if needed
|
|
182
|
+
if (!hasGit) {
|
|
183
|
+
var initGit = await ask('No git repo found. Initialize one? (yes/no): ');
|
|
184
|
+
if (initGit.toLowerCase() === 'yes' || initGit.toLowerCase() === 'y') {
|
|
185
|
+
try {
|
|
186
|
+
execFileSync('git', ['init']);
|
|
187
|
+
execFileSync('git', ['branch', '-m', 'main']);
|
|
188
|
+
console.log('Git repository initialized.');
|
|
189
|
+
} catch (e) {
|
|
190
|
+
console.log('Could not initialize git: ' + e.message);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
console.log('');
|
|
196
|
+
console.log('Setup complete!');
|
|
197
|
+
console.log('');
|
|
198
|
+
console.log('Installed:');
|
|
199
|
+
console.log(' .claude/commands/ 10 pipeline commands');
|
|
200
|
+
console.log(' .claude/agents/ 4 specialist agents + template');
|
|
201
|
+
console.log(' .claude/skills/ 2 framework skills');
|
|
202
|
+
console.log(' .claude/rules/ 6 domain rules + template');
|
|
203
|
+
console.log(' .claude/references/ 5 templates');
|
|
204
|
+
console.log(' .claude/hooks/ 5 guardrails');
|
|
205
|
+
console.log(' docs/ methodology + guides');
|
|
206
|
+
console.log('');
|
|
207
|
+
console.log('Next steps:');
|
|
208
|
+
console.log(' 1. Open Claude Code in this project');
|
|
209
|
+
console.log(' 2. Run /setup to check plugin dependencies');
|
|
210
|
+
console.log(' 3. Run /start to begin');
|
|
211
|
+
console.log('');
|
|
212
|
+
|
|
213
|
+
rl.close();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
main().catch(function (err) {
|
|
217
|
+
console.error('Error: ' + err.message);
|
|
218
|
+
process.exit(1);
|
|
219
|
+
});
|