@patricksardinha/agentkit-cli 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.
Files changed (52) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/workflows/release.yml +31 -0
  3. package/AGENT_WORKFLOW.md +55 -0
  4. package/CLAUDE.md +45 -0
  5. package/README.md +327 -0
  6. package/dist/cli.cjs +1079 -0
  7. package/dist/cli.cjs.map +1 -0
  8. package/dist/cli.d.cts +1 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +1056 -0
  11. package/dist/cli.js.map +1 -0
  12. package/package.json +45 -0
  13. package/src/cli.ts +18 -0
  14. package/src/commands/add.ts +166 -0
  15. package/src/commands/init.ts +130 -0
  16. package/src/commands/status.ts +57 -0
  17. package/src/detectors/gitDetector.ts +11 -0
  18. package/src/detectors/stackDetector.ts +88 -0
  19. package/src/generators/claudeMdGenerator.ts +42 -0
  20. package/src/generators/playbookGenerator.ts +76 -0
  21. package/src/generators/skillsGenerator.ts +56 -0
  22. package/src/generators/workflowGenerator.ts +62 -0
  23. package/src/templates/express.ts +64 -0
  24. package/src/templates/fastapi.ts +63 -0
  25. package/src/templates/nextjs.ts +63 -0
  26. package/src/templates/node.ts +54 -0
  27. package/src/templates/react.ts +61 -0
  28. package/src/templates/tauri.ts +65 -0
  29. package/src/templates/unknown.ts +45 -0
  30. package/src/types/agent.ts +9 -0
  31. package/src/types/inquirer.d.ts +36 -0
  32. package/src/utils/agentParser.ts +67 -0
  33. package/src/utils/blueprintParser.ts +28 -0
  34. package/src/utils/logger.ts +16 -0
  35. package/tests/commands/add.test.ts +130 -0
  36. package/tests/detectors/fixtures/express-app/package.json +9 -0
  37. package/tests/detectors/fixtures/fastapi-app/requirements.txt +3 -0
  38. package/tests/detectors/fixtures/nextjs-app/package.json +13 -0
  39. package/tests/detectors/fixtures/no-git/README.md +2 -0
  40. package/tests/detectors/fixtures/react-app/package.json +10 -0
  41. package/tests/detectors/fixtures/tauri-app/package.json +10 -0
  42. package/tests/detectors/fixtures/tauri-app/src-tauri/tauri.conf.json +12 -0
  43. package/tests/detectors/gitDetector.test.ts +29 -0
  44. package/tests/detectors/stackDetector.test.ts +50 -0
  45. package/tests/generators/blueprintSupport.test.ts +130 -0
  46. package/tests/generators/claudeMdGenerator.test.ts +86 -0
  47. package/tests/generators/playbookGenerator.test.ts +152 -0
  48. package/tests/generators/skillsGenerator.test.ts +94 -0
  49. package/tests/generators/workflowGenerator.test.ts +84 -0
  50. package/tsconfig.json +19 -0
  51. package/tsup.config.ts +11 -0
  52. package/vitest.config.ts +9 -0
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,31 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - uses: actions/setup-node@v4
15
+ with:
16
+ node-version: '20'
17
+ registry-url: 'https://registry.npmjs.org'
18
+
19
+ - name: Install dependencies
20
+ run: npm ci
21
+
22
+ - name: Build
23
+ run: npm run build
24
+
25
+ - name: Test
26
+ run: npm test
27
+
28
+ - name: Publish to npm
29
+ run: npm publish --access public
30
+ env:
31
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,55 @@
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
package/CLAUDE.md ADDED
@@ -0,0 +1,45 @@
1
+ # CLAUDE.md — AgentKit CLI
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.
6
+
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)
13
+
14
+ ## Stack
15
+ - Runtime : Node.js 20+, TypeScript 5
16
+ - CLI : commander.js + inquirer.js + chalk + ora
17
+ - Build : tsup (ESM + CJS dual output)
18
+ - Tests : Vitest
19
+ - CI/CD : GitHub Actions → npm publish on tag v*
20
+
21
+ ## Structure des fichiers
22
+ src/
23
+ 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
package/README.md ADDED
@@ -0,0 +1,327 @@
1
+ # AgentKit CLI
2
+
3
+ > Bootstrap your projects with an AI-native orchestration layer — like `create vite@latest`, but for agentic development with Claude Code.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/agentkit-cli)](https://www.npmjs.com/package/agentkit-cli)
6
+ [![license](https://img.shields.io/npm/l/agentkit-cli)](./LICENSE)
7
+ [![built with Claude Code](https://img.shields.io/badge/built%20with-Claude%20Code-7c3aed)](https://claude.ai/code)
8
+
9
+ ---
10
+
11
+ ## What is AgentKit?
12
+
13
+ When you run `npm create vite@latest`, it scaffolds a complete React (or Vue, Svelte…) project in seconds — giving you a working structure you can build on immediately instead of configuring everything from scratch.
14
+
15
+ **AgentKit does the same thing, but for AI-native development.**
16
+
17
+ It scaffolds the *orchestration layer* that sits on top of any project: the files that tell Claude Code **who** to be, **what** to build, and **how** to divide the work across specialized agents.
18
+
19
+ ```
20
+ Without AgentKit With AgentKit
21
+ ──────────────── ──────────────────────────────
22
+ my-project/ my-project/
23
+ ├── src/ ├── src/
24
+ ├── package.json ├── package.json
25
+ └── README.md ├── README.md
26
+ ├── CLAUDE.md ← generated
27
+ └── AGENT_WORKFLOW.md ← generated
28
+ ```
29
+
30
+ You open Claude Code, and instead of spending the first 30 minutes explaining your stack and conventions, you just say: **"Read CLAUDE.md and AGENT_WORKFLOW.md, then run Agent 1."**
31
+
32
+ ---
33
+
34
+ ## The Problem It Solves
35
+
36
+ Most developers using Claude Code today work with a single, long-running conversation. They describe what they want, Claude builds it, they correct, they prompt again. This works — but it has limits:
37
+
38
+ - **Context gets polluted** — one agent accumulates unrelated concerns
39
+ - **No reusability** — you re-explain conventions on every project
40
+ - **No parallelism** — everything is sequential because there's no coordination layer
41
+ - **No audit trail** — no document captures the decisions made
42
+
43
+ AgentKit introduces a **structured orchestration layer** that solves all four problems. Your project gets two new files — `CLAUDE.md` and `AGENT_WORKFLOW.md` — that act as standing instructions for a team of specialized agents.
44
+
45
+ ---
46
+
47
+ ## How It Works
48
+
49
+ ```
50
+ ┌─────────────────────────────────────────────────────────────────┐
51
+ │ Developer runs: npx agentkit init │
52
+ └─────────────────────────┬───────────────────────────────────────┘
53
+
54
+
55
+ ┌─────────────────────────────────────────────────────────────────┐
56
+ │ AgentKit CLI │
57
+ │ │
58
+ │ 1. Scans the project directory │
59
+ │ → reads package.json, Cargo.toml, requirements.txt… │
60
+ │ │
61
+ │ 2. Detects the stack │
62
+ │ → React · Next.js · Tauri · FastAPI · Express · Node │
63
+ │ → TypeScript? Tailwind? Prisma? Testing setup? │
64
+ │ │
65
+ │ 3. Generates adapted files │
66
+ │ → CLAUDE.md (conventions, stack, commands, rules) │
67
+ │ → AGENT_WORKFLOW.md (agents, scope, success criteria) │
68
+ └─────────────────────────┬───────────────────────────────────────┘
69
+
70
+
71
+ ┌─────────────────────────────────────────────────────────────────┐
72
+ │ Your project — ready for agentic development │
73
+ │ │
74
+ │ Developer opens Claude Code and runs agents one by one: │
75
+ │ │
76
+ │ Agent 1 → Infra & Setup (success: project builds) │
77
+ │ ↓ │
78
+ │ Agent 2 → Core Feature A (success: tests pass) │
79
+ │ ↓ │
80
+ │ Agent 3 → Core Feature B (success: tests pass) │
81
+ │ ↓ │
82
+ │ Agent 4 → Docs & Deploy (success: CI/CD green) │
83
+ │ │
84
+ │ Human validates each success criterion before the next agent. │
85
+ └─────────────────────────────────────────────────────────────────┘
86
+ ```
87
+
88
+ ### The two generated files
89
+
90
+ **`CLAUDE.md`** — the standing brief for every agent. It answers:
91
+ - What is this project and what stack does it use?
92
+ - What are the absolute rules (naming conventions, forbidden patterns, testing requirements)?
93
+ - What commands exist and what do they do?
94
+ - What does "done" look like?
95
+
96
+ **`AGENT_WORKFLOW.md`** — the project roadmap, broken into agent-sized tasks. Each agent entry specifies:
97
+ - Its scope (what it touches)
98
+ - Its dependencies (which agent must finish first)
99
+ - Its deliverables (what files it produces)
100
+ - Its success criterion (a verifiable, runnable check)
101
+
102
+ ---
103
+
104
+ ## Quickstart
105
+
106
+ ```bash
107
+ # In any project directory (empty or existing)
108
+ npx agentkit init
109
+ ```
110
+
111
+ That's it. AgentKit detects your stack and writes the two files.
112
+
113
+ ```bash
114
+ # Add a new specialized agent to an existing workflow
115
+ npx agentkit add agent
116
+
117
+ # Check the status of your agent workflow
118
+ npx agentkit status
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Supported Stacks
124
+
125
+ | Stack | Detected by | Template features |
126
+ |---|---|---|
127
+ | **React** | `react` in `package.json` | TypeScript/JS, Vite, testing setup |
128
+ | **Next.js** | `next` in `package.json` | App Router, Tailwind, Prisma (if present) |
129
+ | **Tauri** | `src-tauri/` directory | Rust backend, IPC commands, Tauri plugins |
130
+ | **FastAPI** | `fastapi` in `requirements.txt` | Python, Pydantic, async patterns |
131
+ | **Express** | `express` in `package.json` | REST API, middleware, auth patterns |
132
+ | **Node.js** | `package.json` (generic) | Scripts, modules, CI/CD |
133
+ | **Unknown** | fallback | Generic workflow, manually editable |
134
+
135
+ Stack detection is additive — extras like TypeScript, Tailwind, and Prisma are detected on top of the primary framework and enrich the generated templates accordingly.
136
+
137
+ ---
138
+
139
+ ## Example Output
140
+
141
+ ### For a React + TypeScript project
142
+
143
+ `npx agentkit init` in a React/TypeScript/Vite project generates:
144
+
145
+ ```markdown
146
+ # CLAUDE.md — my-app
147
+
148
+ ## Stack
149
+ - Framework : React (TypeScript)
150
+ - Language : TypeScript
151
+ - Build : Vite
152
+
153
+ ## Commands
154
+ - `npm run dev` — development server
155
+ - `npm run build` — production build
156
+ - `npm test` — run tests
157
+
158
+ ## Structure
159
+ src/
160
+ components/ ← UI components (PascalCase)
161
+ hooks/ ← custom hooks (prefix: use*)
162
+ pages/ ← page-level components
163
+ utils/ ← shared helpers
164
+
165
+ ## Conventions
166
+ 1. Components in PascalCase
167
+ 2. Hooks prefixed with `use`
168
+ 3. Props interfaces named `*Props`
169
+ 4. All console output through a centralized logger
170
+ ```
171
+
172
+ ```markdown
173
+ # Agent Workflow — my-app
174
+
175
+ ## Agents
176
+
177
+ ### Agent 1 · Components
178
+ Scope : reusable UI components
179
+ Delivers : src/components/
180
+ Criteria : components documented and tested
181
+
182
+ ### Agent 2 · State & Hooks
183
+ Scope : state management, custom hooks
184
+ Delivers : src/hooks/
185
+ Criteria : hooks unit-tested
186
+
187
+ ### Agent 3 · Pages & Routing
188
+ Scope : page assembly, react-router
189
+ Delivers : src/pages/
190
+ Criteria : navigation working
191
+
192
+ ### Agent 4 · Tests & CI
193
+ Scope : test coverage, CI configuration
194
+ Delivers : tests/, .github/workflows/
195
+ Criteria : npm test passes
196
+ ```
197
+
198
+ ### For a Tauri project (more complex detection)
199
+
200
+ A project with `src-tauri/` gets a richer workflow that accounts for the Rust/JS boundary, IPC commands, plugin permissions, and the dual build system:
201
+
202
+ ```markdown
203
+ # Agent Workflow — my-desktop-app
204
+
205
+ ### Agent 1 · Rust Commands
206
+ Scope : Tauri commands (IPC), permissions
207
+ Delivers : src-tauri/src/commands.rs, tauri.conf.json
208
+ Criteria : `cargo build` passes
209
+
210
+ ### Agent 2 · Frontend UI
211
+ Scope : TypeScript UI, IPC integration
212
+ Delivers : src/components/, src/utils/
213
+ Criteria : IPC calls functional
214
+
215
+ ### Agent 3 · Build & Packaging
216
+ Scope : build config, icons, installers
217
+ Delivers : src-tauri/tauri.conf.json, icons/
218
+ Criteria : `npm run tauri build` produces a bundle
219
+
220
+ ### Agent 4 · Tests
221
+ Scope : Rust tests + frontend tests
222
+ Delivers : src-tauri/tests/, tests/
223
+ Criteria : `cargo test` + `npm test` pass
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Design Philosophy
229
+
230
+ ### Why not just use a prompt template?
231
+
232
+ A prompt template lives in your head (or your notes). It gets copy-pasted, drifts between projects, and is lost the moment you close the conversation.
233
+
234
+ `CLAUDE.md` and `AGENT_WORKFLOW.md` are **project artifacts**. They live in the repo, they're versioned, they're readable by every agent in every session, and they can be reviewed in a pull request like any other code.
235
+
236
+ ### Why separate agents instead of one big conversation?
237
+
238
+ Each agent has a **bounded context** — it only knows what it needs to know. This has three effects:
239
+
240
+ 1. **Better output** — an agent focused solely on testing isn't distracted by infrastructure concerns
241
+ 2. **Human checkpoints** — you validate a success criterion before the next agent starts, catching errors early
242
+ 3. **Parallelism** — once dependencies are met, agents that don't depend on each other can run simultaneously
243
+
244
+ ### Why verifiable success criteria?
245
+
246
+ Every agent in `AGENT_WORKFLOW.md` ends with a criterion like `npm test passes` or `cargo build passes`. These aren't goals — they're **gates**. If the criterion isn't met, you don't prompt the next agent. This makes the workflow deterministic and auditable.
247
+
248
+ ---
249
+
250
+ ## Meta: How AgentKit Was Built
251
+
252
+ AgentKit CLI was built using the same workflow it generates.
253
+
254
+ The repo contains a `CLAUDE.md` and `AGENT_WORKFLOW.md` that describe how to build the CLI itself. Four specialized agents were used in sequence:
255
+
256
+ ```
257
+ Agent 1 · Infra & Setup
258
+ → package.json, tsconfig, tsup, vitest, GitHub Actions
259
+ → success: npm run build passes
260
+
261
+ Agent 2 · Detectors
262
+ → src/detectors/stackDetector.ts, gitDetector.ts
263
+ → success: npm test passes on project fixtures
264
+
265
+ Agent 3 · Generators & Templates
266
+ → src/generators/, src/templates/ (one per stack)
267
+ → success: valid files generated for each supported stack
268
+
269
+ Agent 4 · Commands CLI
270
+ → src/commands/init.ts, add.ts, status.ts, src/cli.ts
271
+ → success: npx agentkit --help shows all commands
272
+ ```
273
+
274
+ The `CLAUDE.md` and `AGENT_WORKFLOW.md` at the root of this repo are the exact files that drove this build process. They are not documentation added after the fact — they are the source of truth that was written first and executed against.
275
+
276
+ ---
277
+
278
+ ## Project Structure
279
+
280
+ ```
281
+ agentkit-cli/
282
+ ├── src/
283
+ │ ├── cli.ts ← entry point (commander.js)
284
+ │ ├── commands/
285
+ │ │ ├── init.ts ← npx agentkit init
286
+ │ │ ├── add.ts ← npx agentkit add agent
287
+ │ │ └── status.ts ← npx agentkit status
288
+ │ ├── detectors/
289
+ │ │ ├── stackDetector.ts ← reads package.json, Cargo.toml, etc.
290
+ │ │ └── gitDetector.ts ← checks for .git directory
291
+ │ ├── generators/
292
+ │ │ ├── claudeMdGenerator.ts ← routes to the right template
293
+ │ │ └── workflowGenerator.ts ← routes to the right template
294
+ │ ├── templates/
295
+ │ │ ├── react.ts ← React/Vite template
296
+ │ │ ├── nextjs.ts ← Next.js App Router template
297
+ │ │ ├── tauri.ts ← Tauri v2 template
298
+ │ │ ├── fastapi.ts ← FastAPI template
299
+ │ │ ├── express.ts ← Express.js template
300
+ │ │ ├── node.ts ← generic Node.js template
301
+ │ │ └── unknown.ts ← fallback for unknown stacks
302
+ │ └── utils/
303
+ │ └── logger.ts ← chalk + ora output helpers
304
+ ├── tests/
305
+ ├── CLAUDE.md ← agent brief for this repo
306
+ ├── AGENT_WORKFLOW.md ← agent workflow for this repo
307
+ ├── package.json
308
+ ├── tsconfig.json
309
+ └── tsup.config.ts
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Contributing
315
+
316
+ Pull requests are welcome. If you add a new stack template:
317
+
318
+ 1. Create `src/templates/your-stack.ts` — export `claudeMd(stack)` and `workflow(stack)`
319
+ 2. Add detection logic in `src/detectors/stackDetector.ts`
320
+ 3. Register the new case in `src/generators/claudeMdGenerator.ts` and `workflowGenerator.ts`
321
+ 4. Add fixtures in `tests/detectors/` and tests in `tests/generators/`
322
+
323
+ ---
324
+
325
+ ## License
326
+
327
+ MIT — © 2026