@patricksardinha/agentkit-cli 0.2.0 → 0.3.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/AGENT_WORKFLOW.md CHANGED
@@ -1,55 +1,129 @@
1
- # Agent Workflow AgentKit CLI
2
-
3
- ## Vue d'ensemble
4
- Ce projet est construit par 4 agents spécialisés en séquence.
5
- Chaque agent a un périmètre strict, des inputs définis, et un
6
- critère de succès vérifiable avant de passer au suivant.
7
-
8
- ## Phase 1 — Foundation
9
-
10
- ### Agent 1 · Infra & Setup
11
- Périmètre : scaffolding du projet Node.js/TS, configuration build
12
- Lit : CLAUDE.md section Stack
13
- Produit :
14
- - package.json (commander, inquirer, chalk, ora, tsup)
15
- - tsconfig.json + tsup.config.ts
16
- - .github/workflows/release.yml (npm publish on v*)
17
- - vitest.config.ts
18
- - src/utils/logger.ts
19
- Critère : npm run build passe, structure src/ conforme à CLAUDE.md
20
-
21
- ### Agent 2 · Detectors
22
- Dépend de : Agent 1
23
- Périmètre : détection automatique de la stack d'un projet cible
24
- Produit :
25
- - src/detectors/stackDetector.ts
26
- → détecte : React, Next.js, Tauri, Python/FastAPI, Node/Express
27
- → lit package.json, requirements.txt, src-tauri/
28
- - src/detectors/gitDetector.ts
29
- vérifie si le dossier est un repo git
30
- - tests/detectors/stackDetector.test.ts
31
- Critère : npm test passe sur des fixtures de projets types
32
-
33
- ## Phase 2 — Generators (parallélisables)
34
-
35
- ### Agent 3 · Generators
36
- Dépend de : Agent 2 (pour stackDetector)
37
- Périmètre : génération des fichiers CLAUDE.md et AGENT_WORKFLOW.md
38
- Produit :
39
- - src/generators/claudeMdGenerator.ts
40
- → prend StackInfo, retourne string CLAUDE.md adapté
41
- - src/generators/workflowGenerator.ts
42
- → prend StackInfo, retourne string AGENT_WORKFLOW.md adapté
43
- - src/templates/ (un template par stack détectée)
44
- - tests/generators/*.test.ts
45
- Critère : génère des fichiers valides pour chaque stack supportée
46
-
47
- ### Agent 4 · Commands CLI
48
- Dépend de : Agent 2 + Agent 3
49
- Périmètre : wiring des commandes CLI avec commander.js
50
- Produit :
51
- - src/commands/init.ts → npx agentkit init
52
- - src/commands/add.ts → npx agentkit add agent
53
- - src/commands/status.ts npx agentkit status
54
- - src/cli.ts → entry point
55
- Critère : npx agentkit --help affiche toutes les commandes
1
+ # AGENT_WORKFLOW.md@patricksardinha/agentkit-cli
2
+
3
+ > This file was filled in by Claude Code during Phase 0 — Agent Decomposition.
4
+ > It was proposed to the human and validated before execution began.
5
+ >
6
+ > Original proposal:
7
+ > "I have decomposed the project into 4 agents:
8
+ > 1. Infra & Setup
9
+ > 2. Detectors
10
+ > 3. Generators & Templates
11
+ > 4. Commands CLI
12
+ > Should I proceed?"
13
+ >
14
+ > Human: "Yes."
15
+
16
+ ---
17
+
18
+ ## Agent 1 · Infra & Setup
19
+
20
+ **Scope:** scaffold the Node.js/TypeScript project, configure all build
21
+ and test tooling, set up GitHub Actions for automated npm publishing.
22
+
23
+ **Depends on:** nothing this is the foundation
24
+
25
+ **Skills:** `agents/agent-1-infra/skills.md`
26
+
27
+ **Deliverables:**
28
+ - `package.json` with all dependencies (commander, inquirer, chalk, ora, tsup, vitest)
29
+ - `tsconfig.json` and `tsup.config.ts`
30
+ - `vitest.config.ts`
31
+ - `.github/workflows/release.yml` npm publish on `v*` tag push
32
+ - `src/utils/logger.ts` — chalk + ora output helpers
33
+
34
+ **Success criterion:**
35
+ ```bash
36
+ npm run build
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Agent 2 · Detectors
42
+
43
+ **Scope:** implement pure detection functions that read a target project
44
+ directory and return a typed `StackInfo` object. No filesystem writes,
45
+ no side effects.
46
+
47
+ **Depends on:** Agent 1
48
+
49
+ **Skills:** `agents/agent-2-detectors/skills.md`
50
+
51
+ **Deliverables:**
52
+ - `src/detectors/stackDetector.ts`
53
+ - Detects: react, nextjs, tauri, fastapi, express, node, unknown
54
+ - Detects extras: typescript, tailwind, prisma, testing
55
+ - Returns a typed `StackInfo` object
56
+ - `src/detectors/gitDetector.ts`
57
+ - Returns true if the target directory contains a `.git` folder
58
+ - `src/types/stack.ts` — `StackInfo` interface
59
+ - `tests/detectors/stackDetector.test.ts` — fixtures for each stack
60
+
61
+ **Success criterion:**
62
+ ```bash
63
+ npm test
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Agent 3 · Generators & Templates
69
+
70
+ **Scope:** implement one template per stack and four generators that compose
71
+ them into output files. The `playbookGenerator` is the core deliverable —
72
+ it generates Phase 0 (Discovery or Decomposition) and Phase 1 (execution loop).
73
+
74
+ **Depends on:** Agent 2
75
+
76
+ **Skills:** `agents/agent-3-generators/skills.md`
77
+
78
+ **Deliverables:**
79
+ - `src/templates/` — one file per stack: react, nextjs, tauri, fastapi, express, node, unknown
80
+ - Each exports `claudeMd(stack: StackInfo): string` and `workflow(stack: StackInfo): string`
81
+ - `src/generators/claudeMdGenerator.ts` — routes to the right template
82
+ - `src/generators/workflowGenerator.ts` — routes + returns `Agent[]`
83
+ - `src/generators/playbookGenerator.ts`
84
+ - `hasBlueprint: true` → Phase 0 reads PROJECT_BLUEPRINT.md
85
+ - `hasBlueprint: false` → Phase 0 asks the user three questions
86
+ - Phase 1 always present with retry logic and human escalation
87
+ - `src/generators/skillsGenerator.ts` — creates `agents/agent-N-slug/skills.md`
88
+ - `src/types/agent.ts` — `Agent` interface
89
+ - `tests/generators/*.test.ts` — one test file per generator
90
+
91
+ **Success criterion:**
92
+ ```bash
93
+ npm test
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Agent 4 · Commands CLI
99
+
100
+ **Scope:** wire all generators and detectors into the three CLI commands
101
+ using commander.js. This agent composes existing modules — it writes no
102
+ business logic.
103
+
104
+ **Depends on:** Agents 2 and 3
105
+
106
+ **Skills:** `agents/agent-4-commands/skills.md`
107
+
108
+ **Deliverables:**
109
+ - `src/commands/init.ts`
110
+ - Detects stack with `stackDetector`
111
+ - Accepts `--blueprint <path>` — reads file, warns if path missing
112
+ - Calls all four generators in order
113
+ - Writes CLAUDE.md, AGENT_WORKFLOW.md, PLAYBOOK.md to project root
114
+ - Calls `skillsGenerator` to create `agents/` folder structure
115
+ - Never overwrites existing files without `--force`
116
+ - `src/commands/add.ts`
117
+ - Accepts `--feature <description>`
118
+ - Reads existing AGENT_WORKFLOW.md to find last agent number
119
+ - Appends new agent block, creates `agents/agent-{N+1}-{slug}/skills.md`
120
+ - Regenerates PLAYBOOK.md **without Phase 0** (`hasBlueprint: false`)
121
+ - `src/commands/status.ts`
122
+ - Reads AGENT_WORKFLOW.md and displays current state
123
+ - `src/cli.ts` — registers all three commands with commander
124
+ - `tests/commands/init.test.ts`
125
+
126
+ **Success criterion:**
127
+ ```bash
128
+ npm run build && node dist/cli.js --help
129
+ ```
package/CLAUDE.md CHANGED
@@ -1,45 +1,70 @@
1
- # CLAUDE.md — AgentKit CLI
1
+ # CLAUDE.md — @patricksardinha/agentkit-cli
2
2
 
3
- ## Rôle de ce fichier
4
- Ce fichier est lu par tous les agents Claude Code avant toute action.
5
- Il définit les conventions, la stack, et les règles du projet.
3
+ > This file was generated by AgentKit from PROJECT_BLUEPRINT.md.
4
+ > It is read by every agent before starting its work.
6
5
 
7
- ## Projet
8
- Nom : agentkit-cli
9
- Type : CLI npm open-source (Node.js + TypeScript)
10
- Objectif : Scaffolder des workflows multi-agents Claude Code
11
- Public : Développeurs fullstack qui utilisent Claude Code
12
- Registry : npm (npx agentkit init)
6
+ ## Project
7
+
8
+ | Field | Value |
9
+ |------------|----------------------------------------------------|
10
+ | Name | @patricksardinha/agentkit-cli |
11
+ | Type | Open-source npm CLI (Node.js + TypeScript) |
12
+ | Goal | Scaffold AI-native orchestration layers for Claude Code |
13
+ | Audience | Fullstack developers using Claude Code |
14
+ | Registry | npm — `npx @patricksardinha/agentkit-cli init` |
13
15
 
14
16
  ## Stack
17
+
15
18
  - Runtime : Node.js 20+, TypeScript 5
16
19
  - CLI : commander.js + inquirer.js + chalk + ora
17
20
  - Build : tsup (ESM + CJS dual output)
18
21
  - Tests : Vitest
19
- - CI/CD : GitHub Actions → npm publish on tag v*
22
+ - CI/CD : GitHub Actions → npm publish on tag `v*`
23
+ - Package : scoped (`@patricksardinha/agentkit-cli`), public access
24
+
25
+ ## Project Structure
20
26
 
21
- ## Structure des fichiers
27
+ ```
22
28
  src/
23
29
  cli.ts ← entry point (commander setup)
24
- commands/ ← une commande = un fichier
25
- generators/ ← logique de génération des fichiers
26
- detectors/ ← détection de stack (package.json, etc.)
27
- templates/ ← templates CLAUDE.md, AGENT_WORKFLOW.md
28
- utils/ ← helpers partagés
29
- tests/ Vitest, miroir de src/
30
-
31
- ## Règles absolues
32
- 1. Chaque commande dans src/commands/ est indépendante
33
- 2. Les templates dans src/templates/ sont des fonctions TS, pas des fichiers .md statiques
34
- 3. Tout output CLI passe par src/utils/logger.ts (jamais console.log direct)
35
- 4. Chaque fichier généré doit avoir un test dans tests/generators/
36
- 5. Zéro dépendance non listée ici sans discussion
37
-
38
- ## Conventions de commit
39
- feat: / fix: / test: / docs: / chore: / release:
40
-
41
- ## Critères de succès (Definition of Done)
42
- - npx agentkit init fonctionne sur un repo vide
43
- - npx agentkit init détecte automatiquement React, Next.js, Tauri, Python
44
- - npm test passe sans erreur
45
- - npx tsc --noEmit passe sans erreur
30
+ commands/ ← one file per command (init, add, status)
31
+ generators/ ← file generation logic
32
+ detectors/ ← stack detection (pure functions, no side effects)
33
+ templates/ ← one file per stack (react, nextjs, tauri, fastapi, express, node, unknown)
34
+ types/ ← shared TypeScript interfaces (Agent, StackInfo…)
35
+ utils/ shared helpers (logger.ts)
36
+ tests/ ← Vitest, mirrors src/ structure
37
+ agents/ ← per-agent skills files (read by Claude Code)
38
+ ```
39
+
40
+ ## Absolute Rules
41
+
42
+ 1. Every command in `src/commands/` is self-contained — no shared mutable state
43
+ 2. Templates in `src/templates/` are TypeScript functions, never static `.md` files
44
+ 3. All terminal output goes through `src/utils/logger.ts` — never `console.log` directly
45
+ 4. Every generator has a corresponding test in `tests/generators/`
46
+ 5. Detectors are pure functions — they read the filesystem and return data, no writes
47
+ 6. Zero dependencies added without updating this file
48
+ 7. Never touch files outside your current agent's defined scope
49
+
50
+ ## Commands
51
+
52
+ | Command | Description |
53
+ |-----------------------|--------------------------------------------------|
54
+ | `npm run build` | Compile TypeScript → dist/ (tsup) |
55
+ | `npm test` | Run all tests (Vitest) |
56
+ | `npm run test:watch` | Watch mode |
57
+ | `npx tsc --noEmit` | Type check without emitting |
58
+ | `npm run lint` | ESLint on src/ and tests/ |
59
+
60
+ ## Commit Conventions
61
+
62
+ `feat:` / `fix:` / `test:` / `docs:` / `chore:` / `release:`
63
+
64
+ ## Definition of Done
65
+
66
+ - `npm run build` passes without error
67
+ - `npm test` passes without error
68
+ - `npx tsc --noEmit` passes without error
69
+ - `node dist/cli.js --help` shows all three commands
70
+ - Every new generator has a test file
package/PLAYBOOK.md ADDED
@@ -0,0 +1,192 @@
1
+ # PLAYBOOK.md — @patricksardinha/agentkit-cli
2
+
3
+ > **One instruction to give Claude Code:**
4
+ > "Read PLAYBOOK.md and execute the procedure."
5
+ >
6
+ > Claude Code handles the rest autonomously — blueprint reading, agent decomposition,
7
+ > execution, success validation, retries, and human escalation.
8
+ > No API key required. No additional cost beyond your LLM subscription.
9
+
10
+ ---
11
+
12
+ ## Global Execution Rules
13
+
14
+ Before each agent:
15
+ 1. Read `CLAUDE.md`
16
+ 2. Read `agents/agent-{N}-{slug}/skills.md` (current agent's file)
17
+ 3. Read the agent's section in `AGENT_WORKFLOW.md`
18
+
19
+ After each agent:
20
+ - Run the success criterion command
21
+ - ✅ Passes → announce "✅ Agent N complete" and move to the next
22
+ - ❌ Fails → analyze the root cause, fix, rerun (max 3 attempts)
23
+ - After 3 consecutive failures → stop and ask for human validation
24
+
25
+ **Never move to the next agent without a passing success criterion.**
26
+ **Stay strictly within your current agent's defined scope.**
27
+
28
+ ---
29
+
30
+ ## Phase 0 — Agent Decomposition (run this first)
31
+
32
+ > A `PROJECT_BLUEPRINT.md` was provided.
33
+ > Claude Code reads it and decomposes the project into specialized agents
34
+ > before writing a single line of code.
35
+
36
+ **Read these files in order:**
37
+ 1. `CLAUDE.md`
38
+ 2. `PROJECT_BLUEPRINT.md`
39
+
40
+ **Then decompose the project into agents** following these rules:
41
+
42
+ - One agent = one coherent technical layer (never mix two layers)
43
+ - Each agent must have a runnable success criterion (`npm test`, `cargo build`…)
44
+ - Agents must be ordered by dependency (no feature without infra first)
45
+ - Maximum 6 agents — if you have more, group related ones
46
+ - Always respect this order:
47
+ 1. Infra & Configuration
48
+ 2. Data layer (DB schema, models, services)
49
+ 3. External integrations (auth, APIs, local services like Ollama)
50
+ 4. UI & pages
51
+ 5. Advanced features (RAG, export, realtime…)
52
+ 6. Build & release (CI/CD, packaging, installers)
53
+
54
+ **Write the result directly into `AGENT_WORKFLOW.md`** — replace its current
55
+ content with your decomposition.
56
+
57
+ **Then ask for human validation:**
58
+ > "I have decomposed the project into N agents: [list them].
59
+ > Should I proceed with execution?"
60
+
61
+ Wait for confirmation before moving to Phase 1.
62
+
63
+ ---
64
+
65
+ ## Phase 1 — Execution
66
+
67
+ ### Agent 1 · Infra & Setup
68
+
69
+ **Scope**: scaffold the Node.js/TypeScript project, configure build and test tooling, set up GitHub Actions.
70
+
71
+ **Skills**: `agents/agent-1-infra/skills.md`
72
+
73
+ **Deliverables**:
74
+ - package.json (commander, inquirer, chalk, ora, tsup, vitest)
75
+ - tsconfig.json and tsup.config.ts
76
+ - vitest.config.ts
77
+ - .github/workflows/release.yml
78
+ - src/utils/logger.ts
79
+
80
+ **Success criterion**:
81
+ ```bash
82
+ npm run build
83
+ ```
84
+
85
+ **On failure**:
86
+ 1. Read the full error output
87
+ 2. Fix the root cause — not the symptoms
88
+ 3. Rerun the success criterion (max 3 attempts)
89
+ 4. After 3 failures → ask for human validation
90
+
91
+ ---
92
+
93
+ ### Agent 2 · Detectors
94
+
95
+ **Scope**: implement pure detection functions, no side effects.
96
+
97
+ **Skills**: `agents/agent-2-detectors/skills.md`
98
+
99
+ **Deliverables**:
100
+ - src/detectors/stackDetector.ts
101
+ - src/detectors/gitDetector.ts
102
+ - src/types/stack.ts
103
+ - tests/detectors/stackDetector.test.ts
104
+
105
+ **Success criterion**:
106
+ ```bash
107
+ npm test
108
+ ```
109
+
110
+ **On failure**:
111
+ 1. Read the full error output
112
+ 2. Fix the root cause — not the symptoms
113
+ 3. Rerun the success criterion (max 3 attempts)
114
+ 4. After 3 failures → ask for human validation
115
+
116
+ ---
117
+
118
+ ### Agent 3 · Generators & Templates
119
+
120
+ **Scope**: one template per stack, four generators composing them into output files.
121
+
122
+ **Skills**: `agents/agent-3-generators/skills.md`
123
+
124
+ **Deliverables**:
125
+ - src/templates/ (react, nextjs, tauri, fastapi, express, node, unknown)
126
+ - src/generators/claudeMdGenerator.ts
127
+ - src/generators/workflowGenerator.ts
128
+ - src/generators/playbookGenerator.ts
129
+ - src/generators/skillsGenerator.ts
130
+ - src/types/agent.ts
131
+ - tests/generators/*.test.ts
132
+
133
+ **Success criterion**:
134
+ ```bash
135
+ npm test
136
+ ```
137
+
138
+ **On failure**:
139
+ 1. Read the full error output
140
+ 2. Fix the root cause — not the symptoms
141
+ 3. Rerun the success criterion (max 3 attempts)
142
+ 4. After 3 failures → ask for human validation
143
+
144
+ ---
145
+
146
+ ### Agent 4 · Commands CLI
147
+
148
+ **Scope**: wire generators and detectors into CLI commands. No business logic — composition only.
149
+
150
+ **Skills**: `agents/agent-4-commands/skills.md`
151
+
152
+ **Deliverables**:
153
+ - src/commands/init.ts (--blueprint support)
154
+ - src/commands/add.ts (--feature support)
155
+ - src/commands/status.ts
156
+ - src/cli.ts
157
+ - tests/commands/init.test.ts
158
+
159
+ **Success criterion**:
160
+ ```bash
161
+ npm run build && node dist/cli.js --help
162
+ ```
163
+
164
+ **On failure**:
165
+ 1. Read the full error output
166
+ 2. Fix the root cause — not the symptoms
167
+ 3. Rerun the success criterion (max 3 attempts)
168
+ 4. After 3 failures → ask for human validation
169
+
170
+ ---
171
+
172
+ ## Future Iterations
173
+
174
+ When a new agent is added via `agentkit add --feature <description>`:
175
+ 1. A new agent block is appended to `AGENT_WORKFLOW.md`
176
+ 2. The folder `agents/agent-{N}-{slug}/` is created with `skills.md`
177
+ 3. This `PLAYBOOK.md` is regenerated to include the new agent — **without Phase 0**
178
+ 4. Execution resumes at the new agent only — completed agents are not rerun
179
+
180
+ When you receive the instruction to continue after an iteration:
181
+ > "Read PLAYBOOK.md and execute only the agents that haven't been completed yet."
182
+
183
+ ---
184
+
185
+ ## Human Validation Required
186
+
187
+ Stop and wait for confirmation in these situations:
188
+ - **3 consecutive failures** on the same success criterion
189
+ - **Missing external dependency**: API key, env variable, unavailable service
190
+ - **Conflict** between `PROJECT_BLUEPRINT.md` and the detected stack
191
+ - **Destructive operation**: overwriting files not listed in deliverables
192
+ - **End of Phase 0**: agent decomposition must be validated before execution
@@ -0,0 +1,52 @@
1
+ # AgentKit CLI — Project Blueprint
2
+
3
+ ## Goal
4
+
5
+ Build an open-source CLI tool that scaffolds an AI-native orchestration layer
6
+ on top of any project. Developers run one command and get a structured set of
7
+ files that tell Claude Code who to be, what to build, and how to divide work
8
+ across specialized agents — including a PLAYBOOK.md that Claude Code reads and
9
+ executes autonomously from start to finish, with no manual prompting between agents.
10
+
11
+ ## Features
12
+
13
+ - Detect the project stack automatically by reading package.json, Cargo.toml,
14
+ src-tauri/, and requirements.txt
15
+ - Generate CLAUDE.md adapted to the detected stack (conventions, commands, rules)
16
+ - Generate AGENT_WORKFLOW.md as a placeholder — Claude Code fills it during Phase 0
17
+ - Generate PLAYBOOK.md with two phases:
18
+ - Phase 0: if a blueprint is provided, Claude Code reads it and decomposes
19
+ the project into agents; if not, Claude Code asks the user three questions
20
+ and decomposes from the answers. Either way, decomposition is validated
21
+ by the human before execution begins.
22
+ - Phase 1: Claude Code executes each agent in sequence, validates success
23
+ criteria, retries on failure (max 3), and escalates to the human if blocked.
24
+ - Generate agents/agent-N-slug/ folders with skills.md templates for per-agent
25
+ context injection
26
+ - Support --blueprint flag to provide a PROJECT_BLUEPRINT.md
27
+ - Support agentkit add --feature to append a new agent and regenerate PLAYBOOK.md
28
+ without Phase 0 (decomposition is already done)
29
+ - Support agentkit status to display the current workflow state
30
+
31
+ ## Tech constraints
32
+
33
+ - Node.js 20+ CLI, published to npm as a scoped package (@patricksardinha/agentkit-cli)
34
+ - TypeScript 5, compiled with tsup (ESM + CJS dual output)
35
+ - commander.js for CLI parsing, inquirer.js for interactive prompts,
36
+ chalk + ora for terminal output
37
+ - Vitest for unit tests
38
+ - GitHub Actions for CI/CD — npm publish automatically on tag v*
39
+ - No API calls at runtime — all generation is local and static
40
+ - No AI integrated in the tool itself — AgentKit is purely structural
41
+
42
+ ## Architecture notes
43
+
44
+ - One file per command in src/commands/
45
+ - One file per stack in src/templates/ (each exports claudeMd(stack) and workflow(stack))
46
+ - Generators in src/generators/ compose templates into output files
47
+ - Detectors in src/detectors/ are pure functions with no side effects —
48
+ they read the filesystem and return a typed StackInfo object
49
+ - All user-facing output goes through src/utils/logger.ts (never console.log directly)
50
+ - Every generator has a corresponding test file in tests/generators/
51
+ - The stack detector enriches CLAUDE.md with the right commands and conventions —
52
+ the agent decomposition itself is always delegated to Claude Code via Phase 0