@patricksardinha/agentkit-cli 0.4.0 → 0.5.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/dist/cli.cjs +53 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +53 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/init.ts +45 -4
- package/src/generators/claudeMdGenerator.ts +18 -1
- package/tests/commands/init.test.ts +145 -0
package/dist/cli.cjs
CHANGED
|
@@ -523,7 +523,18 @@ Crit\xE8re : tests passent
|
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
// src/generators/claudeMdGenerator.ts
|
|
526
|
-
|
|
526
|
+
var STACK_NOT_CONFIGURED_WARNING = `
|
|
527
|
+
## \u26A0\uFE0F Stack not configured
|
|
528
|
+
AgentKit could not detect your stack and no stack was selected.
|
|
529
|
+
Before running Claude Code, fill in the following sections:
|
|
530
|
+
- Stack (framework, runtime, DB, tools)
|
|
531
|
+
- Commands (dev, build, test)
|
|
532
|
+
- Structure (folder layout)
|
|
533
|
+
|
|
534
|
+
Once filled, give Claude Code this instruction:
|
|
535
|
+
"Read PLAYBOOK.md and execute the procedure."
|
|
536
|
+
`;
|
|
537
|
+
function generateClaudeMd(stack, blueprintContent, stackNotConfigured) {
|
|
527
538
|
let base;
|
|
528
539
|
switch (stack.framework) {
|
|
529
540
|
case "react":
|
|
@@ -547,6 +558,10 @@ function generateClaudeMd(stack, blueprintContent) {
|
|
|
547
558
|
default:
|
|
548
559
|
base = claudeMd7(stack);
|
|
549
560
|
}
|
|
561
|
+
if (stackNotConfigured) {
|
|
562
|
+
const firstNewline = base.indexOf("\n");
|
|
563
|
+
base = base.slice(0, firstNewline + 1) + STACK_NOT_CONFIGURED_WARNING + base.slice(firstNewline + 1);
|
|
564
|
+
}
|
|
550
565
|
if (!blueprintContent) return base;
|
|
551
566
|
const blueprintNote = "\n> A PROJECT_BLUEPRINT.md is present \u2014 Claude Code will read it during Phase 0.\n";
|
|
552
567
|
const conventionsIdx = base.indexOf("\n## Conventions");
|
|
@@ -874,6 +889,38 @@ var FRAMEWORK_LABELS = {
|
|
|
874
889
|
node: "Node.js",
|
|
875
890
|
unknown: "Unknown (generic)"
|
|
876
891
|
};
|
|
892
|
+
var STACK_CHOICES = [
|
|
893
|
+
{ name: "React + Vite", value: "react" },
|
|
894
|
+
{ name: "Next.js", value: "nextjs" },
|
|
895
|
+
{ name: "Tauri v2 (React + Rust)", value: "tauri" },
|
|
896
|
+
{ name: "FastAPI (Python)", value: "fastapi" },
|
|
897
|
+
{ name: "Express (Node.js)", value: "express" },
|
|
898
|
+
{ name: "Node.js (generic)", value: "node" },
|
|
899
|
+
{ name: "None of the above \u2014 generate a generic CLAUDE.md to fill manually", value: "none" }
|
|
900
|
+
];
|
|
901
|
+
async function resolveStack(detected) {
|
|
902
|
+
if (detected.framework !== "unknown") {
|
|
903
|
+
return { stack: detected, stackNotConfigured: false };
|
|
904
|
+
}
|
|
905
|
+
logger.warn("Stack not detected automatically.");
|
|
906
|
+
const { selectedFramework } = await import_inquirer.default.prompt([
|
|
907
|
+
{
|
|
908
|
+
type: "list",
|
|
909
|
+
name: "selectedFramework",
|
|
910
|
+
message: "Stack not detected automatically. Please select your stack:",
|
|
911
|
+
choices: STACK_CHOICES
|
|
912
|
+
}
|
|
913
|
+
]);
|
|
914
|
+
if (selectedFramework === "none") {
|
|
915
|
+
return { stack: detected, stackNotConfigured: true };
|
|
916
|
+
}
|
|
917
|
+
const framework = selectedFramework;
|
|
918
|
+
const language = framework === "fastapi" ? "python" : "javascript";
|
|
919
|
+
return {
|
|
920
|
+
stack: { ...detected, framework, language, hasTypeScript: false },
|
|
921
|
+
stackNotConfigured: false
|
|
922
|
+
};
|
|
923
|
+
}
|
|
877
924
|
async function fileExists(path) {
|
|
878
925
|
try {
|
|
879
926
|
await (0, import_promises4.readFile)(path);
|
|
@@ -891,8 +938,9 @@ function registerInit(program2) {
|
|
|
891
938
|
if (!isGit) {
|
|
892
939
|
logger.warn("Ce dossier n'est pas un repo git \u2014 lancez git init si n\xE9cessaire");
|
|
893
940
|
}
|
|
894
|
-
const
|
|
895
|
-
|
|
941
|
+
const { stack: resolvedStack, stackNotConfigured } = await resolveStack(stack);
|
|
942
|
+
const label = FRAMEWORK_LABELS[resolvedStack.framework];
|
|
943
|
+
logger.info(`Stack : ${label} (${resolvedStack.language})`);
|
|
896
944
|
const { confirmed } = await import_inquirer.default.prompt([
|
|
897
945
|
{
|
|
898
946
|
type: "confirm",
|
|
@@ -944,8 +992,8 @@ function registerInit(program2) {
|
|
|
944
992
|
}
|
|
945
993
|
}
|
|
946
994
|
const genSpinner = (0, import_ora.default)("G\xE9n\xE9ration des fichiers\u2026").start();
|
|
947
|
-
const claudeMdContent = generateClaudeMd(
|
|
948
|
-
const workflowContent = generateWorkflow(
|
|
995
|
+
const claudeMdContent = generateClaudeMd(resolvedStack, blueprintContent, stackNotConfigured);
|
|
996
|
+
const workflowContent = generateWorkflow(resolvedStack, blueprintContent, projectName);
|
|
949
997
|
const agents = extractAgentsFromWorkflow(workflowContent);
|
|
950
998
|
const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent });
|
|
951
999
|
await (0, import_promises4.writeFile)(claudeMdPath, claudeMdContent, "utf-8");
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/commands/init.ts","../src/detectors/stackDetector.ts","../src/detectors/gitDetector.ts","../src/templates/react.ts","../src/templates/nextjs.ts","../src/templates/tauri.ts","../src/templates/fastapi.ts","../src/templates/express.ts","../src/templates/node.ts","../src/templates/unknown.ts","../src/generators/claudeMdGenerator.ts","../src/generators/workflowGenerator.ts","../src/generators/playbookGenerator.ts","../src/generators/skillsGenerator.ts","../src/utils/agentParser.ts","../src/utils/logger.ts","../src/commands/add.ts","../src/commands/status.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander'\nimport { registerInit } from './commands/init.js'\nimport { registerAdd } from './commands/add.js'\nimport { registerStatus } from './commands/status.js'\n\nconst program = new Command()\n\nprogram\n .name('agentkit')\n .description('Scaffolder des workflows multi-agents Claude Code')\n .version('0.1.0')\n\nregisterInit(program)\nregisterAdd(program)\nregisterStatus(program)\n\nprogram.parse()\n","import type { Command } from 'commander'\nimport { writeFile, readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport inquirer from 'inquirer'\nimport ora from 'ora'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { generateClaudeMd } from '../generators/claudeMdGenerator.js'\nimport { generateWorkflow } from '../generators/workflowGenerator.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport { extractAgentsFromWorkflow } from '../utils/agentParser.js'\nimport { logger } from '../utils/logger.js'\nimport type { StackInfo } from '../detectors/stackDetector.js'\nimport { basename } from 'node:path'\n\nconst FRAMEWORK_LABELS: Record<StackInfo['framework'], string> = {\n react: 'React',\n nextjs: 'Next.js',\n tauri: 'Tauri',\n fastapi: 'FastAPI (Python)',\n express: 'Express',\n node: 'Node.js',\n unknown: 'Unknown (generic)',\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await readFile(path)\n return true\n } catch {\n return false\n }\n}\n\nexport function registerInit(program: Command): void {\n program\n .command('init')\n .description('Génère CLAUDE.md et AGENT_WORKFLOW.md dans le dossier courant')\n .option('-f, --force', 'Écrase les fichiers existants sans confirmation')\n .option('--blueprint <path>', 'Fichier blueprint .md à utiliser pour personnaliser les fichiers générés')\n .action(async (options: { force?: boolean; blueprint?: string }) => {\n const cwd = process.cwd()\n\n const spinner = ora('Détection de la stack…').start()\n const [stack, isGit] = await Promise.all([detectStack(cwd), isGitRepo(cwd)])\n spinner.stop()\n\n if (!isGit) {\n logger.warn('Ce dossier n\\'est pas un repo git — lancez git init si nécessaire')\n }\n\n const label = FRAMEWORK_LABELS[stack.framework]\n logger.info(`Stack détectée : ${label} (${stack.language})`)\n\n const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([\n {\n type: 'confirm',\n name: 'confirmed',\n message: `Générer les fichiers pour ${label} ?`,\n default: true,\n },\n ])\n\n if (!confirmed) {\n logger.warn('Annulé.')\n return\n }\n\n const claudeMdPath = join(cwd, 'CLAUDE.md')\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n const playbookPath = join(cwd, 'PLAYBOOK.md')\n\n // Resolve project name from package.json or directory name\n let projectName = basename(cwd)\n try {\n const pkg = JSON.parse(await readFile(join(cwd, 'package.json'), 'utf-8')) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* fallback to dirname */ }\n\n if (!options.force) {\n const existing: string[] = []\n if (await fileExists(claudeMdPath)) existing.push('CLAUDE.md')\n if (await fileExists(workflowPath)) existing.push('AGENT_WORKFLOW.md')\n if (await fileExists(playbookPath)) existing.push('PLAYBOOK.md')\n\n if (existing.length > 0) {\n const { overwrite } = await inquirer.prompt<{ overwrite: boolean }>([\n {\n type: 'confirm',\n name: 'overwrite',\n message: `${existing.join(' et ')} existe déjà. Écraser ?`,\n default: false,\n },\n ])\n if (!overwrite) {\n logger.warn('Annulé.')\n return\n }\n }\n }\n\n // Load blueprint if provided\n let blueprintContent: string | undefined\n if (options.blueprint) {\n try {\n blueprintContent = await readFile(options.blueprint, 'utf-8')\n } catch {\n logger.error(`Blueprint introuvable : ${options.blueprint}`)\n process.exit(1)\n }\n }\n\n const genSpinner = ora('Génération des fichiers…').start()\n const claudeMdContent = generateClaudeMd(stack, blueprintContent)\n const workflowContent = generateWorkflow(stack, blueprintContent, projectName)\n const agents = extractAgentsFromWorkflow(workflowContent)\n const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent })\n await writeFile(claudeMdPath, claudeMdContent, 'utf-8')\n await writeFile(workflowPath, workflowContent, 'utf-8')\n await writeFile(playbookPath, playbookContent, 'utf-8')\n await generateSkills(agents, cwd)\n genSpinner.succeed('Fichiers générés')\n\n logger.success('CLAUDE.md → créé')\n logger.success('AGENT_WORKFLOW.md → créé')\n logger.success('PLAYBOOK.md → créé')\n logger.success(`agents/ → ${agents.length} dossier(s) créé(s)`)\n })\n}\n","import { readFile, access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport interface StackInfo {\n framework: 'react' | 'nextjs' | 'tauri' | 'fastapi' | 'express' | 'node' | 'unknown'\n language: 'typescript' | 'javascript' | 'python' | 'unknown'\n hasTypeScript: boolean\n extras: string[]\n}\n\nasync function pathExists(p: string): Promise<boolean> {\n try {\n await access(p)\n return true\n } catch {\n return false\n }\n}\n\nasync function readJson(p: string): Promise<Record<string, unknown> | null> {\n try {\n const raw = await readFile(p, 'utf-8')\n return JSON.parse(raw) as Record<string, unknown>\n } catch {\n return null\n }\n}\n\nasync function readText(p: string): Promise<string | null> {\n try {\n return await readFile(p, 'utf-8')\n } catch {\n return null\n }\n}\n\nexport async function detectStack(projectPath: string): Promise<StackInfo> {\n const info: StackInfo = {\n framework: 'unknown',\n language: 'unknown',\n hasTypeScript: false,\n extras: [],\n }\n\n const packageJson = await readJson(join(projectPath, 'package.json'))\n const requirementsTxt = await readText(join(projectPath, 'requirements.txt'))\n const hasTauriDir = await pathExists(join(projectPath, 'src-tauri'))\n const hasTsConfig = await pathExists(join(projectPath, 'tsconfig.json'))\n\n if (packageJson !== null) {\n const deps = (packageJson.dependencies as Record<string, string>) ?? {}\n const devDeps = (packageJson.devDependencies as Record<string, string>) ?? {}\n const allDeps = { ...deps, ...devDeps }\n\n info.hasTypeScript = 'typescript' in allDeps || hasTsConfig\n info.language = info.hasTypeScript ? 'typescript' : 'javascript'\n\n // Order matters: most specific first\n if ('next' in allDeps) {\n info.framework = 'nextjs'\n } else if (hasTauriDir || '@tauri-apps/api' in allDeps || '@tauri-apps/cli' in allDeps) {\n info.framework = 'tauri'\n } else if ('react' in allDeps) {\n info.framework = 'react'\n } else if ('express' in allDeps) {\n info.framework = 'express'\n } else {\n info.framework = 'node'\n }\n\n if ('vitest' in allDeps || 'jest' in allDeps) info.extras.push('testing')\n if ('prisma' in allDeps || '@prisma/client' in allDeps) info.extras.push('prisma')\n if ('tailwindcss' in allDeps) info.extras.push('tailwind')\n }\n\n if (requirementsTxt !== null && info.framework === 'unknown') {\n info.language = 'python'\n if (/\\bfastapi\\b/i.test(requirementsTxt)) {\n info.framework = 'fastapi'\n }\n }\n\n if (hasTauriDir && info.framework === 'unknown') {\n info.framework = 'tauri'\n }\n\n return info\n}\n","import { access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport async function isGitRepo(projectPath: string): Promise<boolean> {\n try {\n await access(join(projectPath, '.git'))\n return true\n } catch {\n return false\n }\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const testLine = stack.extras.includes('testing') ? '- `npm test` — run tests\\n' : ''\n return `# CLAUDE.md — React Project\n\n## Stack\n- Framework : React (${lang})\n- Language : ${lang}\n- Build : Vite\n\n## Commands\n- \\`npm run dev\\` — development server\n- \\`npm run build\\` — production build\n${testLine}\n## Structure\nsrc/\n components/ ← UI components (PascalCase)\n hooks/ ← custom hooks (prefix: use*)\n pages/ ← page-level components\n utils/ ← shared helpers\n\n## Conventions\n1. Components in PascalCase\n2. Hooks prefixed with \\`use\\`\n3. Props interfaces named \\`*Props\\`\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — React Project\n\n## Stack détectée\nFramework: React | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Components\nPérimètre : composants UI réutilisables\nProduit : src/components/\nCritère : composants documentés et testés\n\n### Agent 2 · State & Hooks\nPérimètre : state management, hooks personnalisés\nProduit : src/hooks/\nCritère : hooks testés unitairement\n\n### Agent 3 · Pages & Routing\nPérimètre : assemblage des pages, react-router\nProduit : src/pages/\nCritère : navigation fonctionnelle\n\n### Agent 4 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const hasTailwind = stack.extras.includes('tailwind')\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Next.js Project\n\n## Stack\n- Framework : Next.js (TypeScript)\n- Rendering : App Router (RSC + Client Components)\n- Styling : ${hasTailwind ? 'Tailwind CSS' : 'CSS Modules'}\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (http://localhost:3000)\n- \\`npm run build\\` — production build\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n app/ ← App Router pages and layouts\n components/ ← shared UI components\n lib/ ← server utilities, db clients\n utils/ ← shared helpers\n\n## Conventions\n1. Server Components by default, \\`'use client'\\` only when needed\n2. API routes in \\`src/app/api/\\`\n3. Environment variables via \\`src/env.ts\\` (validated)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const hasPrisma = stack.extras.includes('prisma')\n return `# Agent Workflow — Next.js Project\n\n## Stack détectée\nFramework: Next.js | Language: TypeScript\n\n## Agents\n\n### Agent 1 · Data Layer\nPérimètre : schéma${hasPrisma ? ' Prisma' : ''}, types, server actions\nProduit : src/lib/, ${hasPrisma ? 'prisma/schema.prisma' : 'src/types/'}\nCritère : types compilent, migrations propres\n\n### Agent 2 · UI Components\nPérimètre : composants réutilisables (Server + Client)\nProduit : src/components/\nCritère : composants rendus sans erreur\n\n### Agent 3 · Pages & Layout\nPérimètre : App Router, layouts, pages\nProduit : src/app/\nCritère : navigation fonctionnelle, build passe\n\n### Agent 4 · API & Tests\nPérimètre : API routes, tests e2e/unitaires\nProduit : src/app/api/, tests/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Tauri Project\n\n## Stack\n- Framework : Tauri (Rust + ${lang} frontend)\n- Language : Rust (backend) + ${lang} (frontend)\n- Build : Cargo + Vite\n\n## Commands\n- \\`npm run tauri dev\\` — development (hot reload)\n- \\`npm run tauri build\\` — production bundle\n- \\`npm run build\\` — frontend only\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/ ← frontend (${lang})\n components/\n utils/\nsrc-tauri/ ← Rust backend\n src/\n main.rs ← Tauri entry point\n commands.rs ← Tauri commands (IPC)\n tauri.conf.json\n\n## Conventions\n1. IPC commands defined in \\`src-tauri/src/commands.rs\\`\n2. Frontend invokes via \\`@tauri-apps/api/tauri\\`\n3. No direct filesystem access from frontend\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Tauri Project\n\n## Stack détectée\nFramework: Tauri | Language: Rust + ${lang}\n\n## Agents\n\n### Agent 1 · Rust Commands\nPérimètre : commandes Tauri (IPC), permissions\nProduit : src-tauri/src/commands.rs, tauri.conf.json\nCritère : \\`cargo build\\` passe\n\n### Agent 2 · Frontend UI\nPérimètre : interface ${lang}, intégration IPC\nProduit : src/components/, src/utils/\nCritère : appels IPC fonctionnels\n\n### Agent 3 · Build & Packaging\nPérimètre : configuration build, icônes, installeurs\nProduit : src-tauri/tauri.conf.json, icons/\nCritère : \\`npm run tauri build\\` produit un bundle\n\n### Agent 4 · Tests\nPérimètre : tests Rust + tests frontend\nProduit : src-tauri/tests/, tests/\nCritère : \\`cargo test\\` + \\`npm test\\` passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md — FastAPI Project\n\n## Stack\n- Framework : FastAPI (Python)\n- Language : Python 3.11+\n- Server : Uvicorn\n- Validation: Pydantic v2\n\n## Commands\n- \\`uvicorn main:app --reload\\` — development server (http://localhost:8000)\n- \\`pytest\\` — run tests\n- \\`pip install -r requirements.txt\\` — install dependencies\n\n## Structure\napp/\n main.py ← FastAPI app entry point\n routers/ ← API route groups\n models/ ← Pydantic models\n services/ ← business logic\n dependencies/ ← FastAPI dependencies (DI)\ntests/ ← pytest tests\n\n## Conventions\n1. Routers grouped by domain in \\`app/routers/\\`\n2. Pydantic models for all request/response bodies\n3. Business logic in \\`app/services/\\`, not in routes\n4. Async endpoints by default (\\`async def\\`)\n5. Environment variables via \\`python-dotenv\\` + \\`pydantic-settings\\`\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow — FastAPI Project\n\n## Stack détectée\nFramework: FastAPI | Language: Python\n\n## Agents\n\n### Agent 1 · Models & Schemas\nPérimètre : modèles Pydantic, schémas DB (SQLAlchemy/SQLModel)\nProduit : app/models/\nCritère : modèles validés, migrations propres\n\n### Agent 2 · Services\nPérimètre : logique métier, accès base de données\nProduit : app/services/\nCritère : services testés unitairement (pytest)\n\n### Agent 3 · Routers & API\nPérimètre : routes FastAPI, dépendances, auth\nProduit : app/routers/, app/dependencies/\nCritère : endpoints documentés (OpenAPI), tests d'intégration\n\n### Agent 4 · Tests & CI\nPérimètre : couverture pytest, configuration CI\nProduit : tests/, .github/workflows/\nCritère : \\`pytest\\` passe à 100%\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Express Project\n\n## Stack\n- Framework : Express (${lang})\n- Language : ${lang}\n- Runtime : Node.js 20+\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (nodemon)\n- \\`npm run build\\` — compile TypeScript\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n routes/ ← Express routers (one per domain)\n controllers/ ← request handlers\n services/ ← business logic\n middleware/ ← Express middleware\n utils/ ← shared helpers\n\n## Conventions\n1. Routes grouped by domain in \\`src/routes/\\`\n2. Business logic in \\`src/services/\\`, not in controllers\n3. Middleware for cross-cutting concerns (auth, validation)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Express Project\n\n## Stack détectée\nFramework: Express | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Data & Models\nPérimètre : modèles de données, accès DB\nProduit : src/models/, src/services/db.ts\nCritère : connexion DB fonctionnelle\n\n### Agent 2 · Services\nPérimètre : logique métier\nProduit : src/services/\nCritère : services testés unitairement\n\n### Agent 3 · Routes & Controllers\nPérimètre : routes Express, validation, auth\nProduit : src/routes/, src/controllers/, src/middleware/\nCritère : endpoints répondent correctement\n\n### Agent 4 · Tests & CI\nPérimètre : tests d'intégration, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Node.js Project\n\n## Stack\n- Runtime : Node.js 20+\n- Language : ${lang}\n\n## Commands\n- \\`npm run dev\\` — development (with watch)\n- \\`npm run build\\` — compile${stack.hasTypeScript ? ' TypeScript' : ''}\n- \\`npm start\\` — run production build\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n index.ts ← entry point\n lib/ ← core library code\n utils/ ← shared helpers\n\n## Conventions\n1. Modules follow single-responsibility principle\n2. Async/await over callbacks\n3. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Node.js Project\n\n## Stack détectée\nRuntime: Node.js | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Core Library\nPérimètre : logique principale\nProduit : src/lib/\nCritère : module fonctionne et testé\n\n### Agent 2 · CLI / API\nPérimètre : interface utilisateur (CLI ou API)\nProduit : src/index.ts, src/cli.ts\nCritère : commandes fonctionnelles\n\n### Agent 3 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md\n\n## Stack\nStack non détectée automatiquement — à remplir manuellement.\n\n## Commands\n- À définir selon le projet\n\n## Structure\nsrc/ ← code source\ntests/ ← tests\n\n## Conventions\n1. Tout output console passe par un logger centralisé\n2. À compléter selon les conventions du projet\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow\n\n## Stack détectée\nStack inconnue — workflow générique.\n\n## Agents\n\n### Agent 1 · Setup\nPérimètre : configuration initiale du projet\nProduit : structure de base\nCritère : projet compilable\n\n### Agent 2 · Core\nPérimètre : logique principale\nProduit : src/\nCritère : fonctionnalités principales opérationnelles\n\n### Agent 3 · Tests\nPérimètre : couverture de tests\nProduit : tests/\nCritère : tests passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nexport function generateClaudeMd(stack: StackInfo, blueprintContent?: string): string {\n let base: string\n switch (stack.framework) {\n case 'react': base = react.claudeMd(stack); break\n case 'nextjs': base = nextjs.claudeMd(stack); break\n case 'tauri': base = tauri.claudeMd(stack); break\n case 'fastapi': base = fastapi.claudeMd(stack); break\n case 'express': base = express.claudeMd(stack); break\n case 'node': base = node.claudeMd(stack); break\n default: base = unknown.claudeMd(stack)\n }\n\n if (!blueprintContent) return base\n\n const blueprintNote = '\\n> A PROJECT_BLUEPRINT.md is present — Claude Code will read it during Phase 0.\\n'\n\n const conventionsIdx = base.indexOf('\\n## Conventions')\n if (conventionsIdx !== -1) {\n return base.slice(0, conventionsIdx) + blueprintNote + base.slice(conventionsIdx)\n }\n return base + blueprintNote\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nexport function generateWorkflow(stack: StackInfo, blueprintContent?: string, projectName?: string): string {\n if (blueprintContent) return blueprintPlaceholder(projectName ?? stack.framework)\n\n switch (stack.framework) {\n case 'react': return react.workflow(stack)\n case 'nextjs': return nextjs.workflow(stack)\n case 'tauri': return tauri.workflow(stack)\n case 'fastapi': return fastapi.workflow(stack)\n case 'express': return express.workflow(stack)\n case 'node': return node.workflow(stack)\n default: return unknown.workflow(stack)\n }\n}\n\nfunction blueprintPlaceholder(projectName: string): string {\n return `# AGENT_WORKFLOW.md — ${projectName}\n\n> This file will be filled in by Claude Code during Phase 0.\n> Claude Code will read PROJECT_BLUEPRINT.md, propose a decomposition,\n> and replace this content after human validation.\n\n---\n\n*Waiting for Phase 0 decomposition...*\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport interface PlaybookInput {\n agents: Agent[]\n projectName: string\n hasBlueprint: boolean\n}\n\nexport function generatePlaybook({ agents, projectName, hasBlueprint }: PlaybookInput): string {\n const agentBlocks = agents.map((a) => agentBlock(a)).join('\\n---\\n\\n')\n\n const phase0 = hasBlueprint\n ? `## Phase 0 — Agent Decomposition (run this first)\n\n> A \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Claude Code reads it and decomposes the project into specialized agents\n> before writing a single line of code.\n\n**Read these files in order:**\n1. \\`CLAUDE.md\\`\n2. \\`PROJECT_BLUEPRINT.md\\`\n\n**Then decompose the project into agents** following these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n : `## Phase 0 — Project Discovery (run this first)\n\n> No \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Before writing any code, Claude Code asks the user what they want to build,\n> then decomposes the project into agents — exactly as if a blueprint had been provided.\n\n**Ask the user these questions and wait for their answers:**\n\n1. What is this project? (one sentence describing the goal)\n2. What are the main features you want to build? (list them)\n3. Are there any tech constraints or architecture preferences?\n (e.g. offline-only, specific DB, no auth, specific framework)\n\n**Once you have the answers, decompose the project into agents**\nfollowing these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n\n return `# PLAYBOOK.md — ${projectName}\n\n> **One instruction to give Claude Code:**\n> \"Read PLAYBOOK.md and execute the procedure.\"\n>\n> Claude Code handles the rest autonomously — project discovery or blueprint reading,\n> agent decomposition, execution, success validation, retries, and human escalation.\n> No API key required. No additional cost beyond your LLM subscription.\n\n---\n\n## Global Execution Rules\n\nBefore each agent:\n1. Read \\`CLAUDE.md\\`\n2. Read \\`agents/agent-{N}-{slug}/skills.md\\` (current agent's file)\n3. Read the agent's section in \\`AGENT_WORKFLOW.md\\`\n\nAfter each agent:\n- Run the success criterion command\n- ✅ Passes → announce \"✅ Agent N complete\" and move to the next\n- ❌ Fails → analyze the root cause, fix, rerun (max 3 attempts)\n- After 3 consecutive failures → stop and ask for human validation\n\n**Never move to the next agent without a passing success criterion.**\n**Stay strictly within your current agent's defined scope.**\n\n---\n\n${phase0}## Phase 1 — Execution\n\n${agentBlocks}\n\n---\n\n## Future Iterations\n\nWhen a new agent is added via \\`agentkit add --feature <description>\\`:\n1. A new agent block is appended to \\`AGENT_WORKFLOW.md\\`\n2. The folder \\`agents/agent-{N}-{slug}/\\` is created with \\`skills.md\\`\n3. This \\`PLAYBOOK.md\\` is regenerated to include the new agent\n4. Execution resumes at the new agent only — completed agents are not rerun\n\nWhen you receive the instruction to continue after an iteration:\n> \"Read PLAYBOOK.md and execute only the agents that haven't been completed yet.\"\n\n---\n\n## Human Validation Required\n\nStop and wait for confirmation in these situations:\n- **3 consecutive failures** on the same success criterion\n- **Missing external dependency**: API key, env variable, unavailable service\n- **Conflict** between the detected stack and the user's stated constraints\n- **Destructive operation**: overwriting files not listed in deliverables\n- **End of Phase 0**: agent decomposition must be validated before execution\n`\n}\n\nfunction agentBlock(agent: Agent): string {\n const skillsPath = `agents/agent-${agent.number}-${agent.slug}/skills.md`\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (see skills.md for details)'\n\n return `### Agent ${agent.number} · ${agent.name}\n\n**Scope**: ${agent.scope}\n\n**Skills**: \\`${skillsPath}\\`\n\n**Deliverables**:\n${outputLines}\n\n**Success criterion**:\n\\`\\`\\`bash\n${agent.criterion || 'npm run build && npm test'}\n\\`\\`\\`\n\n**On failure**:\n1. Read the full error output\n2. Fix the root cause — not the symptoms\n3. Rerun the success criterion (max 3 attempts)\n4. After 3 failures → ask for human validation\n`\n}","import { mkdir, writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport type { Agent } from '../types/agent.js'\n\nexport async function generateSkills(agents: Agent[], outputDir: string): Promise<void> {\n for (const agent of agents) {\n const agentDir = join(outputDir, 'agents', `agent-${agent.number}-${agent.slug}`)\n await mkdir(agentDir, { recursive: true })\n await writeFile(join(agentDir, 'skills.md'), skillsMd(agent), 'utf-8')\n await writeFile(join(agentDir, 'context.md'), contextMd(agent), 'utf-8')\n }\n}\n\nfunction skillsMd(agent: Agent): string {\n return `# Skills — ${agent.fullName}\n\n> Ce fichier est lu par l'agent avant de commencer.\n\n## Contexte technique\n\n<!-- À remplir : bibliothèques, versions, décisions d'architecture spécifiques à cet agent -->\n\n## Documentation de référence\n\n<!-- À remplir : liens vers docs, exemples, ADRs pertinents -->\n\n## Conventions spécifiques\n\n<!-- À remplir : règles propres à cet agent (naming, patterns, structure de fichiers) -->\n`\n}\n\nfunction contextMd(agent: Agent): string {\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (voir AGENT_WORKFLOW.md)'\n\n return `# Context — ${agent.fullName}\n\n> Ce fichier fournit le contexte additionnel à l'agent avant exécution.\n> À compléter avant de lancer cet agent.\n\n## Périmètre\n\n${agent.scope}\n\n## Fichiers produits attendus\n\n${outputLines}\n\n## Critère de succès\n\n\\`${agent.criterion || 'npm run build && npm test'}\\`\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport function toSlug(name: string): string {\n return name\n .toLowerCase()\n .replace(/[·•&]/g, ' ')\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n}\n\nfunction getFieldValue(lines: string[], pattern: RegExp): string {\n for (const line of lines) {\n const m = line.match(pattern)\n if (m) return (m[1] ?? '').trim()\n }\n return ''\n}\n\nexport function extractAgentsFromWorkflow(content: string): Agent[] {\n const agents: Agent[] = []\n\n // Split into blocks starting with \"### Agent N\"\n const blocks = content\n .split(/(?=^### Agent \\d)/m)\n .filter((b) => /^### Agent \\d/.test(b.trimStart()))\n\n for (const block of blocks) {\n const lines = block.split('\\n')\n\n const headerMatch = lines[0].match(/^### Agent (\\d+)\\s*[·•]\\s*(.+)$/)\n if (!headerMatch) continue\n\n const number = parseInt(headerMatch[1], 10)\n const name = headerMatch[2].trim()\n const fullName = `Agent ${number} · ${name}`\n const slug = toSlug(name)\n\n const scope = getFieldValue(lines, /Périmètre\\s*:\\s*(.+)/)\n const criterion = getFieldValue(lines, /Critère[s]?\\s*:\\s*(.+)/)\n\n // Outputs: may be inline or multi-line (indented \"- item\")\n const outputs: string[] = []\n const produitIdx = lines.findIndex((l) => /Produit\\s*:/.test(l))\n if (produitIdx !== -1) {\n const inlineVal = (lines[produitIdx].match(/Produit\\s*:\\s*(.+)/)?.[1] ?? '').trim()\n if (inlineVal) {\n outputs.push(inlineVal)\n } else {\n for (let i = produitIdx + 1; i < lines.length; i++) {\n const line = lines[i]\n if (/^\\s+[-]/.test(line)) {\n outputs.push(line.trim().replace(/^-\\s*/, ''))\n } else if (line.trim() !== '' && !/^\\s/.test(line)) {\n break\n }\n }\n }\n }\n\n agents.push({ number, name, fullName, slug, scope, outputs, criterion })\n }\n\n return agents\n}\n","import chalk from 'chalk'\n\nexport const logger = {\n info: (message: string): void => {\n process.stdout.write(chalk.blue('ℹ') + ' ' + message + '\\n')\n },\n success: (message: string): void => {\n process.stdout.write(chalk.green('✔') + ' ' + message + '\\n')\n },\n warn: (message: string): void => {\n process.stdout.write(chalk.yellow('⚠') + ' ' + message + '\\n')\n },\n error: (message: string): void => {\n process.stderr.write(chalk.red('✖') + ' ' + message + '\\n')\n },\n}\n","import type { Command } from 'commander'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport { join, basename } from 'node:path'\nimport inquirer from 'inquirer'\nimport { logger } from '../utils/logger.js'\nimport { extractAgentsFromWorkflow, toSlug } from '../utils/agentParser.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport type { Agent } from '../types/agent.js'\n\nfunction featureToAgentName(description: string): string {\n const clean = description\n .replace(/^(add|implement|create|build|integrate|setup|configure|refactor|improve)\\s+/i, '')\n .trim()\n return clean.replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport interface AddFeatureResult {\n agent: Agent\n agentDirPath: string\n}\n\nexport async function addFeatureToProject(\n description: string,\n projectDir: string,\n): Promise<AddFeatureResult> {\n const workflowPath = join(projectDir, 'AGENT_WORKFLOW.md')\n const playbookPath = join(projectDir, 'PLAYBOOK.md')\n\n let workflowContent = ''\n try {\n workflowContent = await readFile(workflowPath, 'utf-8')\n } catch {\n throw new Error(`AGENT_WORKFLOW.md not found in ${projectDir} — run agentkit init first`)\n }\n\n const existingAgents = extractAgentsFromWorkflow(workflowContent)\n const nextNumber = existingAgents.length + 1\n const name = featureToAgentName(description)\n const slug = toSlug(name)\n const fullName = `Agent ${nextNumber} · ${name}`\n\n const newAgent: Agent = {\n number: nextNumber,\n name,\n fullName,\n slug,\n scope: description,\n outputs: [`agents/agent-${nextNumber}-${slug}/`],\n criterion: 'npm run build && npm test',\n }\n\n const agentBlock = `\n### ${fullName}\nPérimètre : ${description}\nProduit :\n - agents/agent-${nextNumber}-${slug}/\nCritère : npm run build && npm test\n`\n\n await writeFile(workflowPath, workflowContent + agentBlock, 'utf-8')\n await generateSkills([newAgent], projectDir)\n\n let projectName = basename(projectDir)\n try {\n const pkg = JSON.parse(\n await readFile(join(projectDir, 'package.json'), 'utf-8'),\n ) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* use dirname fallback */ }\n\n const allAgents = [...existingAgents, newAgent]\n\n // When adding a feature iteration, hasBlueprint is false —\n // Phase 0 decomposition only runs during the initial init with --blueprint.\n const playbookContent = generatePlaybook({\n agents: allAgents,\n projectName,\n hasBlueprint: false,\n })\n await writeFile(playbookPath, playbookContent, 'utf-8')\n\n return {\n agent: newAgent,\n agentDirPath: join(projectDir, 'agents', `agent-${nextNumber}-${slug}`),\n }\n}\n\nexport function registerAdd(program: Command): void {\n const addCmd = program\n .command('add')\n .description('Add resources to the agentkit project')\n .option('--feature <description>', 'Add an agent from a feature description and regenerate PLAYBOOK.md')\n .action(async (options: { feature?: string }) => {\n if (options.feature) {\n try {\n const result = await addFeatureToProject(options.feature, process.cwd())\n logger.success(`Agent added : ${result.agent.fullName}`)\n logger.success(`Folder created : agents/agent-${result.agent.number}-${result.agent.slug}/`)\n logger.success('PLAYBOOK.md : regenerated')\n } catch (err) {\n logger.error(err instanceof Error ? err.message : String(err))\n process.exit(1)\n }\n } else {\n addCmd.help()\n }\n })\n\n addCmd\n .command('agent')\n .description('Add a new agent to AGENT_WORKFLOW.md (interactive)')\n .action(async () => {\n const cwd = process.cwd()\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n\n let existing = ''\n try {\n existing = await readFile(workflowPath, 'utf-8')\n } catch {\n logger.error('AGENT_WORKFLOW.md not found — run agentkit init first')\n process.exit(1)\n }\n\n const agentCount = (existing.match(/^### Agent \\d+/gm) ?? []).length\n const nextNumber = agentCount + 1\n\n const answers = await inquirer.prompt<{\n name: string\n scope: string\n outputs: string\n criterion: string\n }>([\n {\n type: 'input',\n name: 'name',\n message: `Agent name (e.g. \"Agent ${nextNumber} · Feature X\"):`,\n default: `Agent ${nextNumber}`,\n },\n {\n type: 'input',\n name: 'scope',\n message: 'Scope (one sentence):',\n },\n {\n type: 'input',\n name: 'outputs',\n message: 'Deliverables (comma-separated):',\n },\n {\n type: 'input',\n name: 'criterion',\n message: 'Success criterion:',\n },\n ])\n\n const outputLines = answers.outputs\n .split(',')\n .map((o: string) => ` - ${o.trim()}`)\n .join('\\n')\n\n const agentSection = `\n### ${answers.name}\nPérimètre : ${answers.scope}\nProduit :\n${outputLines}\nCritère : ${answers.criterion}\n`\n\n await writeFile(workflowPath, existing + agentSection, 'utf-8')\n logger.success(`Agent \"${answers.name}\" added to AGENT_WORKFLOW.md`)\n })\n}","import type { Command } from 'commander'\nimport { readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { logger } from '../utils/logger.js'\n\nexport function registerStatus(program: Command): void {\n program\n .command('status')\n .description('Affiche l\\'état du workflow agentkit dans le dossier courant')\n .action(async () => {\n const cwd = process.cwd()\n\n const [stack, isGit, claudeMd, workflow] = await Promise.all([\n detectStack(cwd),\n isGitRepo(cwd),\n readFile(join(cwd, 'CLAUDE.md'), 'utf-8').catch(() => null),\n readFile(join(cwd, 'AGENT_WORKFLOW.md'), 'utf-8').catch(() => null),\n ])\n\n process.stdout.write('\\n' + chalk.bold('AgentKit Status') + '\\n')\n process.stdout.write('─'.repeat(40) + '\\n')\n\n process.stdout.write(\n chalk.bold('Git repo : ') +\n (isGit ? chalk.green('✔ oui') : chalk.red('✖ non')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('Stack : ') + chalk.cyan(stack.framework) + ' (' + stack.language + ')\\n',\n )\n\n process.stdout.write(\n chalk.bold('CLAUDE.md : ') +\n (claudeMd !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('AGENT_WORKFLOW.md : ') +\n (workflow !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n if (workflow !== null) {\n const agentMatches = workflow.match(/^### Agent \\d+/gm) ?? []\n process.stdout.write(\n chalk.bold('Agents définis : ') + chalk.cyan(String(agentMatches.length)) + '\\n',\n )\n }\n\n process.stdout.write('─'.repeat(40) + '\\n\\n')\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uBAAwB;;;ACAxB,IAAAA,mBAAoC;AACpC,IAAAC,oBAAqB;AACrB,sBAAqB;AACrB,iBAAgB;;;ACJhB,sBAAiC;AACjC,uBAAqB;AASrB,eAAe,WAAW,GAA6B;AACrD,MAAI;AACF,cAAM,wBAAO,CAAC;AACd,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,SAAS,GAAoD;AAC1E,MAAI;AACF,UAAM,MAAM,UAAM,0BAAS,GAAG,OAAO;AACrC,WAAO,KAAK,MAAM,GAAG;AAAA,EACvB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,SAAS,GAAmC;AACzD,MAAI;AACF,WAAO,UAAM,0BAAS,GAAG,OAAO;AAAA,EAClC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,YAAY,aAAyC;AACzE,QAAM,OAAkB;AAAA,IACtB,WAAW;AAAA,IACX,UAAU;AAAA,IACV,eAAe;AAAA,IACf,QAAQ,CAAC;AAAA,EACX;AAEA,QAAM,cAAc,MAAM,aAAS,uBAAK,aAAa,cAAc,CAAC;AACpE,QAAM,kBAAkB,MAAM,aAAS,uBAAK,aAAa,kBAAkB,CAAC;AAC5E,QAAM,cAAc,MAAM,eAAW,uBAAK,aAAa,WAAW,CAAC;AACnE,QAAM,cAAc,MAAM,eAAW,uBAAK,aAAa,eAAe,CAAC;AAEvE,MAAI,gBAAgB,MAAM;AACxB,UAAM,OAAQ,YAAY,gBAA2C,CAAC;AACtE,UAAM,UAAW,YAAY,mBAA8C,CAAC;AAC5E,UAAM,UAAU,EAAE,GAAG,MAAM,GAAG,QAAQ;AA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Aa,OAAO,cAAAC,QAAM,MAAM,mBAAW,IAAI,cAAAA,QAAM,OAAO,2CAAiC,KAC9F;AAAA,IACJ;AAEA,QAAID,cAAa,MAAM;AACrB,YAAM,eAAeA,UAAS,MAAM,kBAAkB,KAAK,CAAC;AAC5D,cAAQ,OAAO;AAAA,QACb,cAAAC,QAAM,KAAK,wBAAqB,IAAI,cAAAA,QAAM,KAAK,OAAO,aAAa,MAAM,CAAC,IAAI;AAAA,MAChF;AAAA,IACF;AAEA,YAAQ,OAAO,MAAM,SAAI,OAAO,EAAE,IAAI,MAAM;AAAA,EAC9C,CAAC;AACL;;;AlBlDA,IAAM,UAAU,IAAI,yBAAQ;AAE5B,QACG,KAAK,UAAU,EACf,YAAY,mDAAmD,EAC/D,QAAQ,OAAO;AAElB,aAAa,OAAO;AACpB,YAAY,OAAO;AACnB,eAAe,OAAO;AAEtB,QAAQ,MAAM;","names":["import_promises","import_node_path","import_promises","import_node_path","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","import_promises","import_node_path","chalk","import_node_path","program","ora","inquirer","import_promises","import_node_path","import_inquirer","agentBlock","program","inquirer","import_promises","import_node_path","import_chalk","program","claudeMd","workflow","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/commands/init.ts","../src/detectors/stackDetector.ts","../src/detectors/gitDetector.ts","../src/templates/react.ts","../src/templates/nextjs.ts","../src/templates/tauri.ts","../src/templates/fastapi.ts","../src/templates/express.ts","../src/templates/node.ts","../src/templates/unknown.ts","../src/generators/claudeMdGenerator.ts","../src/generators/workflowGenerator.ts","../src/generators/playbookGenerator.ts","../src/generators/skillsGenerator.ts","../src/utils/agentParser.ts","../src/utils/logger.ts","../src/commands/add.ts","../src/commands/status.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander'\nimport { registerInit } from './commands/init.js'\nimport { registerAdd } from './commands/add.js'\nimport { registerStatus } from './commands/status.js'\n\nconst program = new Command()\n\nprogram\n .name('agentkit')\n .description('Scaffolder des workflows multi-agents Claude Code')\n .version('0.1.0')\n\nregisterInit(program)\nregisterAdd(program)\nregisterStatus(program)\n\nprogram.parse()\n","import type { Command } from 'commander'\nimport { writeFile, readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport inquirer from 'inquirer'\nimport ora from 'ora'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { generateClaudeMd } from '../generators/claudeMdGenerator.js'\nimport { generateWorkflow } from '../generators/workflowGenerator.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport { extractAgentsFromWorkflow } from '../utils/agentParser.js'\nimport { logger } from '../utils/logger.js'\nimport type { StackInfo } from '../detectors/stackDetector.js'\nimport { basename } from 'node:path'\n\nconst FRAMEWORK_LABELS: Record<StackInfo['framework'], string> = {\n react: 'React',\n nextjs: 'Next.js',\n tauri: 'Tauri',\n fastapi: 'FastAPI (Python)',\n express: 'Express',\n node: 'Node.js',\n unknown: 'Unknown (generic)',\n}\n\nconst STACK_CHOICES = [\n { name: 'React + Vite', value: 'react' },\n { name: 'Next.js', value: 'nextjs' },\n { name: 'Tauri v2 (React + Rust)', value: 'tauri' },\n { name: 'FastAPI (Python)', value: 'fastapi' },\n { name: 'Express (Node.js)', value: 'express' },\n { name: 'Node.js (generic)', value: 'node' },\n { name: 'None of the above — generate a generic CLAUDE.md to fill manually', value: 'none' },\n]\n\nexport async function resolveStack(\n detected: StackInfo,\n): Promise<{ stack: StackInfo; stackNotConfigured: boolean }> {\n if (detected.framework !== 'unknown') {\n return { stack: detected, stackNotConfigured: false }\n }\n\n logger.warn('Stack not detected automatically.')\n const { selectedFramework } = await inquirer.prompt<{ selectedFramework: string }>([\n {\n type: 'list',\n name: 'selectedFramework',\n message: 'Stack not detected automatically. Please select your stack:',\n choices: STACK_CHOICES as unknown as string[],\n },\n ])\n\n if (selectedFramework === 'none') {\n return { stack: detected, stackNotConfigured: true }\n }\n\n const framework = selectedFramework as StackInfo['framework']\n const language: StackInfo['language'] = framework === 'fastapi' ? 'python' : 'javascript'\n return {\n stack: { ...detected, framework, language, hasTypeScript: false },\n stackNotConfigured: false,\n }\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await readFile(path)\n return true\n } catch {\n return false\n }\n}\n\nexport function registerInit(program: Command): void {\n program\n .command('init')\n .description('Génère CLAUDE.md et AGENT_WORKFLOW.md dans le dossier courant')\n .option('-f, --force', 'Écrase les fichiers existants sans confirmation')\n .option('--blueprint <path>', 'Fichier blueprint .md à utiliser pour personnaliser les fichiers générés')\n .action(async (options: { force?: boolean; blueprint?: string }) => {\n const cwd = process.cwd()\n\n const spinner = ora('Détection de la stack…').start()\n const [stack, isGit] = await Promise.all([detectStack(cwd), isGitRepo(cwd)])\n spinner.stop()\n\n if (!isGit) {\n logger.warn('Ce dossier n\\'est pas un repo git — lancez git init si nécessaire')\n }\n\n const { stack: resolvedStack, stackNotConfigured } = await resolveStack(stack)\n\n const label = FRAMEWORK_LABELS[resolvedStack.framework]\n logger.info(`Stack : ${label} (${resolvedStack.language})`)\n\n const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([\n {\n type: 'confirm',\n name: 'confirmed',\n message: `Générer les fichiers pour ${label} ?`,\n default: true,\n },\n ])\n\n if (!confirmed) {\n logger.warn('Annulé.')\n return\n }\n\n const claudeMdPath = join(cwd, 'CLAUDE.md')\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n const playbookPath = join(cwd, 'PLAYBOOK.md')\n\n // Resolve project name from package.json or directory name\n let projectName = basename(cwd)\n try {\n const pkg = JSON.parse(await readFile(join(cwd, 'package.json'), 'utf-8')) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* fallback to dirname */ }\n\n if (!options.force) {\n const existing: string[] = []\n if (await fileExists(claudeMdPath)) existing.push('CLAUDE.md')\n if (await fileExists(workflowPath)) existing.push('AGENT_WORKFLOW.md')\n if (await fileExists(playbookPath)) existing.push('PLAYBOOK.md')\n\n if (existing.length > 0) {\n const { overwrite } = await inquirer.prompt<{ overwrite: boolean }>([\n {\n type: 'confirm',\n name: 'overwrite',\n message: `${existing.join(' et ')} existe déjà. Écraser ?`,\n default: false,\n },\n ])\n if (!overwrite) {\n logger.warn('Annulé.')\n return\n }\n }\n }\n\n // Load blueprint if provided\n let blueprintContent: string | undefined\n if (options.blueprint) {\n try {\n blueprintContent = await readFile(options.blueprint, 'utf-8')\n } catch {\n logger.error(`Blueprint introuvable : ${options.blueprint}`)\n process.exit(1)\n }\n }\n\n const genSpinner = ora('Génération des fichiers…').start()\n const claudeMdContent = generateClaudeMd(resolvedStack, blueprintContent, stackNotConfigured)\n const workflowContent = generateWorkflow(resolvedStack, blueprintContent, projectName)\n const agents = extractAgentsFromWorkflow(workflowContent)\n const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent })\n await writeFile(claudeMdPath, claudeMdContent, 'utf-8')\n await writeFile(workflowPath, workflowContent, 'utf-8')\n await writeFile(playbookPath, playbookContent, 'utf-8')\n await generateSkills(agents, cwd)\n genSpinner.succeed('Fichiers générés')\n\n logger.success('CLAUDE.md → créé')\n logger.success('AGENT_WORKFLOW.md → créé')\n logger.success('PLAYBOOK.md → créé')\n logger.success(`agents/ → ${agents.length} dossier(s) créé(s)`)\n })\n}\n","import { readFile, access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport interface StackInfo {\n framework: 'react' | 'nextjs' | 'tauri' | 'fastapi' | 'express' | 'node' | 'unknown'\n language: 'typescript' | 'javascript' | 'python' | 'unknown'\n hasTypeScript: boolean\n extras: string[]\n}\n\nasync function pathExists(p: string): Promise<boolean> {\n try {\n await access(p)\n return true\n } catch {\n return false\n }\n}\n\nasync function readJson(p: string): Promise<Record<string, unknown> | null> {\n try {\n const raw = await readFile(p, 'utf-8')\n return JSON.parse(raw) as Record<string, unknown>\n } catch {\n return null\n }\n}\n\nasync function readText(p: string): Promise<string | null> {\n try {\n return await readFile(p, 'utf-8')\n } catch {\n return null\n }\n}\n\nexport async function detectStack(projectPath: string): Promise<StackInfo> {\n const info: StackInfo = {\n framework: 'unknown',\n language: 'unknown',\n hasTypeScript: false,\n extras: [],\n }\n\n const packageJson = await readJson(join(projectPath, 'package.json'))\n const requirementsTxt = await readText(join(projectPath, 'requirements.txt'))\n const hasTauriDir = await pathExists(join(projectPath, 'src-tauri'))\n const hasTsConfig = await pathExists(join(projectPath, 'tsconfig.json'))\n\n if (packageJson !== null) {\n const deps = (packageJson.dependencies as Record<string, string>) ?? {}\n const devDeps = (packageJson.devDependencies as Record<string, string>) ?? {}\n const allDeps = { ...deps, ...devDeps }\n\n info.hasTypeScript = 'typescript' in allDeps || hasTsConfig\n info.language = info.hasTypeScript ? 'typescript' : 'javascript'\n\n // Order matters: most specific first\n if ('next' in allDeps) {\n info.framework = 'nextjs'\n } else if (hasTauriDir || '@tauri-apps/api' in allDeps || '@tauri-apps/cli' in allDeps) {\n info.framework = 'tauri'\n } else if ('react' in allDeps) {\n info.framework = 'react'\n } else if ('express' in allDeps) {\n info.framework = 'express'\n } else {\n info.framework = 'node'\n }\n\n if ('vitest' in allDeps || 'jest' in allDeps) info.extras.push('testing')\n if ('prisma' in allDeps || '@prisma/client' in allDeps) info.extras.push('prisma')\n if ('tailwindcss' in allDeps) info.extras.push('tailwind')\n }\n\n if (requirementsTxt !== null && info.framework === 'unknown') {\n info.language = 'python'\n if (/\\bfastapi\\b/i.test(requirementsTxt)) {\n info.framework = 'fastapi'\n }\n }\n\n if (hasTauriDir && info.framework === 'unknown') {\n info.framework = 'tauri'\n }\n\n return info\n}\n","import { access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport async function isGitRepo(projectPath: string): Promise<boolean> {\n try {\n await access(join(projectPath, '.git'))\n return true\n } catch {\n return false\n }\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const testLine = stack.extras.includes('testing') ? '- `npm test` — run tests\\n' : ''\n return `# CLAUDE.md — React Project\n\n## Stack\n- Framework : React (${lang})\n- Language : ${lang}\n- Build : Vite\n\n## Commands\n- \\`npm run dev\\` — development server\n- \\`npm run build\\` — production build\n${testLine}\n## Structure\nsrc/\n components/ ← UI components (PascalCase)\n hooks/ ← custom hooks (prefix: use*)\n pages/ ← page-level components\n utils/ ← shared helpers\n\n## Conventions\n1. Components in PascalCase\n2. Hooks prefixed with \\`use\\`\n3. Props interfaces named \\`*Props\\`\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — React Project\n\n## Stack détectée\nFramework: React | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Components\nPérimètre : composants UI réutilisables\nProduit : src/components/\nCritère : composants documentés et testés\n\n### Agent 2 · State & Hooks\nPérimètre : state management, hooks personnalisés\nProduit : src/hooks/\nCritère : hooks testés unitairement\n\n### Agent 3 · Pages & Routing\nPérimètre : assemblage des pages, react-router\nProduit : src/pages/\nCritère : navigation fonctionnelle\n\n### Agent 4 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const hasTailwind = stack.extras.includes('tailwind')\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Next.js Project\n\n## Stack\n- Framework : Next.js (TypeScript)\n- Rendering : App Router (RSC + Client Components)\n- Styling : ${hasTailwind ? 'Tailwind CSS' : 'CSS Modules'}\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (http://localhost:3000)\n- \\`npm run build\\` — production build\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n app/ ← App Router pages and layouts\n components/ ← shared UI components\n lib/ ← server utilities, db clients\n utils/ ← shared helpers\n\n## Conventions\n1. Server Components by default, \\`'use client'\\` only when needed\n2. API routes in \\`src/app/api/\\`\n3. Environment variables via \\`src/env.ts\\` (validated)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const hasPrisma = stack.extras.includes('prisma')\n return `# Agent Workflow — Next.js Project\n\n## Stack détectée\nFramework: Next.js | Language: TypeScript\n\n## Agents\n\n### Agent 1 · Data Layer\nPérimètre : schéma${hasPrisma ? ' Prisma' : ''}, types, server actions\nProduit : src/lib/, ${hasPrisma ? 'prisma/schema.prisma' : 'src/types/'}\nCritère : types compilent, migrations propres\n\n### Agent 2 · UI Components\nPérimètre : composants réutilisables (Server + Client)\nProduit : src/components/\nCritère : composants rendus sans erreur\n\n### Agent 3 · Pages & Layout\nPérimètre : App Router, layouts, pages\nProduit : src/app/\nCritère : navigation fonctionnelle, build passe\n\n### Agent 4 · API & Tests\nPérimètre : API routes, tests e2e/unitaires\nProduit : src/app/api/, tests/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Tauri Project\n\n## Stack\n- Framework : Tauri (Rust + ${lang} frontend)\n- Language : Rust (backend) + ${lang} (frontend)\n- Build : Cargo + Vite\n\n## Commands\n- \\`npm run tauri dev\\` — development (hot reload)\n- \\`npm run tauri build\\` — production bundle\n- \\`npm run build\\` — frontend only\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/ ← frontend (${lang})\n components/\n utils/\nsrc-tauri/ ← Rust backend\n src/\n main.rs ← Tauri entry point\n commands.rs ← Tauri commands (IPC)\n tauri.conf.json\n\n## Conventions\n1. IPC commands defined in \\`src-tauri/src/commands.rs\\`\n2. Frontend invokes via \\`@tauri-apps/api/tauri\\`\n3. No direct filesystem access from frontend\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Tauri Project\n\n## Stack détectée\nFramework: Tauri | Language: Rust + ${lang}\n\n## Agents\n\n### Agent 1 · Rust Commands\nPérimètre : commandes Tauri (IPC), permissions\nProduit : src-tauri/src/commands.rs, tauri.conf.json\nCritère : \\`cargo build\\` passe\n\n### Agent 2 · Frontend UI\nPérimètre : interface ${lang}, intégration IPC\nProduit : src/components/, src/utils/\nCritère : appels IPC fonctionnels\n\n### Agent 3 · Build & Packaging\nPérimètre : configuration build, icônes, installeurs\nProduit : src-tauri/tauri.conf.json, icons/\nCritère : \\`npm run tauri build\\` produit un bundle\n\n### Agent 4 · Tests\nPérimètre : tests Rust + tests frontend\nProduit : src-tauri/tests/, tests/\nCritère : \\`cargo test\\` + \\`npm test\\` passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md — FastAPI Project\n\n## Stack\n- Framework : FastAPI (Python)\n- Language : Python 3.11+\n- Server : Uvicorn\n- Validation: Pydantic v2\n\n## Commands\n- \\`uvicorn main:app --reload\\` — development server (http://localhost:8000)\n- \\`pytest\\` — run tests\n- \\`pip install -r requirements.txt\\` — install dependencies\n\n## Structure\napp/\n main.py ← FastAPI app entry point\n routers/ ← API route groups\n models/ ← Pydantic models\n services/ ← business logic\n dependencies/ ← FastAPI dependencies (DI)\ntests/ ← pytest tests\n\n## Conventions\n1. Routers grouped by domain in \\`app/routers/\\`\n2. Pydantic models for all request/response bodies\n3. Business logic in \\`app/services/\\`, not in routes\n4. Async endpoints by default (\\`async def\\`)\n5. Environment variables via \\`python-dotenv\\` + \\`pydantic-settings\\`\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow — FastAPI Project\n\n## Stack détectée\nFramework: FastAPI | Language: Python\n\n## Agents\n\n### Agent 1 · Models & Schemas\nPérimètre : modèles Pydantic, schémas DB (SQLAlchemy/SQLModel)\nProduit : app/models/\nCritère : modèles validés, migrations propres\n\n### Agent 2 · Services\nPérimètre : logique métier, accès base de données\nProduit : app/services/\nCritère : services testés unitairement (pytest)\n\n### Agent 3 · Routers & API\nPérimètre : routes FastAPI, dépendances, auth\nProduit : app/routers/, app/dependencies/\nCritère : endpoints documentés (OpenAPI), tests d'intégration\n\n### Agent 4 · Tests & CI\nPérimètre : couverture pytest, configuration CI\nProduit : tests/, .github/workflows/\nCritère : \\`pytest\\` passe à 100%\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Express Project\n\n## Stack\n- Framework : Express (${lang})\n- Language : ${lang}\n- Runtime : Node.js 20+\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (nodemon)\n- \\`npm run build\\` — compile TypeScript\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n routes/ ← Express routers (one per domain)\n controllers/ ← request handlers\n services/ ← business logic\n middleware/ ← Express middleware\n utils/ ← shared helpers\n\n## Conventions\n1. Routes grouped by domain in \\`src/routes/\\`\n2. Business logic in \\`src/services/\\`, not in controllers\n3. Middleware for cross-cutting concerns (auth, validation)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Express Project\n\n## Stack détectée\nFramework: Express | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Data & Models\nPérimètre : modèles de données, accès DB\nProduit : src/models/, src/services/db.ts\nCritère : connexion DB fonctionnelle\n\n### Agent 2 · Services\nPérimètre : logique métier\nProduit : src/services/\nCritère : services testés unitairement\n\n### Agent 3 · Routes & Controllers\nPérimètre : routes Express, validation, auth\nProduit : src/routes/, src/controllers/, src/middleware/\nCritère : endpoints répondent correctement\n\n### Agent 4 · Tests & CI\nPérimètre : tests d'intégration, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Node.js Project\n\n## Stack\n- Runtime : Node.js 20+\n- Language : ${lang}\n\n## Commands\n- \\`npm run dev\\` — development (with watch)\n- \\`npm run build\\` — compile${stack.hasTypeScript ? ' TypeScript' : ''}\n- \\`npm start\\` — run production build\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n index.ts ← entry point\n lib/ ← core library code\n utils/ ← shared helpers\n\n## Conventions\n1. Modules follow single-responsibility principle\n2. Async/await over callbacks\n3. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Node.js Project\n\n## Stack détectée\nRuntime: Node.js | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Core Library\nPérimètre : logique principale\nProduit : src/lib/\nCritère : module fonctionne et testé\n\n### Agent 2 · CLI / API\nPérimètre : interface utilisateur (CLI ou API)\nProduit : src/index.ts, src/cli.ts\nCritère : commandes fonctionnelles\n\n### Agent 3 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md\n\n## Stack\nStack non détectée automatiquement — à remplir manuellement.\n\n## Commands\n- À définir selon le projet\n\n## Structure\nsrc/ ← code source\ntests/ ← tests\n\n## Conventions\n1. Tout output console passe par un logger centralisé\n2. À compléter selon les conventions du projet\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow\n\n## Stack détectée\nStack inconnue — workflow générique.\n\n## Agents\n\n### Agent 1 · Setup\nPérimètre : configuration initiale du projet\nProduit : structure de base\nCritère : projet compilable\n\n### Agent 2 · Core\nPérimètre : logique principale\nProduit : src/\nCritère : fonctionnalités principales opérationnelles\n\n### Agent 3 · Tests\nPérimètre : couverture de tests\nProduit : tests/\nCritère : tests passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nconst STACK_NOT_CONFIGURED_WARNING = `\n## ⚠️ Stack not configured\nAgentKit could not detect your stack and no stack was selected.\nBefore running Claude Code, fill in the following sections:\n- Stack (framework, runtime, DB, tools)\n- Commands (dev, build, test)\n- Structure (folder layout)\n\nOnce filled, give Claude Code this instruction:\n\"Read PLAYBOOK.md and execute the procedure.\"\n`\n\nexport function generateClaudeMd(stack: StackInfo, blueprintContent?: string, stackNotConfigured?: boolean): string {\n let base: string\n switch (stack.framework) {\n case 'react': base = react.claudeMd(stack); break\n case 'nextjs': base = nextjs.claudeMd(stack); break\n case 'tauri': base = tauri.claudeMd(stack); break\n case 'fastapi': base = fastapi.claudeMd(stack); break\n case 'express': base = express.claudeMd(stack); break\n case 'node': base = node.claudeMd(stack); break\n default: base = unknown.claudeMd(stack)\n }\n\n if (stackNotConfigured) {\n const firstNewline = base.indexOf('\\n')\n base = base.slice(0, firstNewline + 1) + STACK_NOT_CONFIGURED_WARNING + base.slice(firstNewline + 1)\n }\n\n if (!blueprintContent) return base\n\n const blueprintNote = '\\n> A PROJECT_BLUEPRINT.md is present — Claude Code will read it during Phase 0.\\n'\n\n const conventionsIdx = base.indexOf('\\n## Conventions')\n if (conventionsIdx !== -1) {\n return base.slice(0, conventionsIdx) + blueprintNote + base.slice(conventionsIdx)\n }\n return base + blueprintNote\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nexport function generateWorkflow(stack: StackInfo, blueprintContent?: string, projectName?: string): string {\n if (blueprintContent) return blueprintPlaceholder(projectName ?? stack.framework)\n\n switch (stack.framework) {\n case 'react': return react.workflow(stack)\n case 'nextjs': return nextjs.workflow(stack)\n case 'tauri': return tauri.workflow(stack)\n case 'fastapi': return fastapi.workflow(stack)\n case 'express': return express.workflow(stack)\n case 'node': return node.workflow(stack)\n default: return unknown.workflow(stack)\n }\n}\n\nfunction blueprintPlaceholder(projectName: string): string {\n return `# AGENT_WORKFLOW.md — ${projectName}\n\n> This file will be filled in by Claude Code during Phase 0.\n> Claude Code will read PROJECT_BLUEPRINT.md, propose a decomposition,\n> and replace this content after human validation.\n\n---\n\n*Waiting for Phase 0 decomposition...*\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport interface PlaybookInput {\n agents: Agent[]\n projectName: string\n hasBlueprint: boolean\n}\n\nexport function generatePlaybook({ agents, projectName, hasBlueprint }: PlaybookInput): string {\n const agentBlocks = agents.map((a) => agentBlock(a)).join('\\n---\\n\\n')\n\n const phase0 = hasBlueprint\n ? `## Phase 0 — Agent Decomposition (run this first)\n\n> A \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Claude Code reads it and decomposes the project into specialized agents\n> before writing a single line of code.\n\n**Read these files in order:**\n1. \\`CLAUDE.md\\`\n2. \\`PROJECT_BLUEPRINT.md\\`\n\n**Then decompose the project into agents** following these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n : `## Phase 0 — Project Discovery (run this first)\n\n> No \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Before writing any code, Claude Code asks the user what they want to build,\n> then decomposes the project into agents — exactly as if a blueprint had been provided.\n\n**Ask the user these questions and wait for their answers:**\n\n1. What is this project? (one sentence describing the goal)\n2. What are the main features you want to build? (list them)\n3. Are there any tech constraints or architecture preferences?\n (e.g. offline-only, specific DB, no auth, specific framework)\n\n**Once you have the answers, decompose the project into agents**\nfollowing these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n\n return `# PLAYBOOK.md — ${projectName}\n\n> **One instruction to give Claude Code:**\n> \"Read PLAYBOOK.md and execute the procedure.\"\n>\n> Claude Code handles the rest autonomously — project discovery or blueprint reading,\n> agent decomposition, execution, success validation, retries, and human escalation.\n> No API key required. No additional cost beyond your LLM subscription.\n\n---\n\n## Global Execution Rules\n\nBefore each agent:\n1. Read \\`CLAUDE.md\\`\n2. Read \\`agents/agent-{N}-{slug}/skills.md\\` (current agent's file)\n3. Read the agent's section in \\`AGENT_WORKFLOW.md\\`\n\nAfter each agent:\n- Run the success criterion command\n- ✅ Passes → announce \"✅ Agent N complete\" and move to the next\n- ❌ Fails → analyze the root cause, fix, rerun (max 3 attempts)\n- After 3 consecutive failures → stop and ask for human validation\n\n**Never move to the next agent without a passing success criterion.**\n**Stay strictly within your current agent's defined scope.**\n\n---\n\n${phase0}## Phase 1 — Execution\n\n${agentBlocks}\n\n---\n\n## Future Iterations\n\nWhen a new agent is added via \\`agentkit add --feature <description>\\`:\n1. A new agent block is appended to \\`AGENT_WORKFLOW.md\\`\n2. The folder \\`agents/agent-{N}-{slug}/\\` is created with \\`skills.md\\`\n3. This \\`PLAYBOOK.md\\` is regenerated to include the new agent\n4. Execution resumes at the new agent only — completed agents are not rerun\n\nWhen you receive the instruction to continue after an iteration:\n> \"Read PLAYBOOK.md and execute only the agents that haven't been completed yet.\"\n\n---\n\n## Human Validation Required\n\nStop and wait for confirmation in these situations:\n- **3 consecutive failures** on the same success criterion\n- **Missing external dependency**: API key, env variable, unavailable service\n- **Conflict** between the detected stack and the user's stated constraints\n- **Destructive operation**: overwriting files not listed in deliverables\n- **End of Phase 0**: agent decomposition must be validated before execution\n`\n}\n\nfunction agentBlock(agent: Agent): string {\n const skillsPath = `agents/agent-${agent.number}-${agent.slug}/skills.md`\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (see skills.md for details)'\n\n return `### Agent ${agent.number} · ${agent.name}\n\n**Scope**: ${agent.scope}\n\n**Skills**: \\`${skillsPath}\\`\n\n**Deliverables**:\n${outputLines}\n\n**Success criterion**:\n\\`\\`\\`bash\n${agent.criterion || 'npm run build && npm test'}\n\\`\\`\\`\n\n**On failure**:\n1. Read the full error output\n2. Fix the root cause — not the symptoms\n3. Rerun the success criterion (max 3 attempts)\n4. After 3 failures → ask for human validation\n`\n}","import { mkdir, writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport type { Agent } from '../types/agent.js'\n\nexport async function generateSkills(agents: Agent[], outputDir: string): Promise<void> {\n for (const agent of agents) {\n const agentDir = join(outputDir, 'agents', `agent-${agent.number}-${agent.slug}`)\n await mkdir(agentDir, { recursive: true })\n await writeFile(join(agentDir, 'skills.md'), skillsMd(agent), 'utf-8')\n await writeFile(join(agentDir, 'context.md'), contextMd(agent), 'utf-8')\n }\n}\n\nfunction skillsMd(agent: Agent): string {\n return `# Skills — ${agent.fullName}\n\n> Ce fichier est lu par l'agent avant de commencer.\n\n## Contexte technique\n\n<!-- À remplir : bibliothèques, versions, décisions d'architecture spécifiques à cet agent -->\n\n## Documentation de référence\n\n<!-- À remplir : liens vers docs, exemples, ADRs pertinents -->\n\n## Conventions spécifiques\n\n<!-- À remplir : règles propres à cet agent (naming, patterns, structure de fichiers) -->\n`\n}\n\nfunction contextMd(agent: Agent): string {\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (voir AGENT_WORKFLOW.md)'\n\n return `# Context — ${agent.fullName}\n\n> Ce fichier fournit le contexte additionnel à l'agent avant exécution.\n> À compléter avant de lancer cet agent.\n\n## Périmètre\n\n${agent.scope}\n\n## Fichiers produits attendus\n\n${outputLines}\n\n## Critère de succès\n\n\\`${agent.criterion || 'npm run build && npm test'}\\`\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport function toSlug(name: string): string {\n return name\n .toLowerCase()\n .replace(/[·•&]/g, ' ')\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n}\n\nfunction getFieldValue(lines: string[], pattern: RegExp): string {\n for (const line of lines) {\n const m = line.match(pattern)\n if (m) return (m[1] ?? '').trim()\n }\n return ''\n}\n\nexport function extractAgentsFromWorkflow(content: string): Agent[] {\n const agents: Agent[] = []\n\n // Split into blocks starting with \"### Agent N\"\n const blocks = content\n .split(/(?=^### Agent \\d)/m)\n .filter((b) => /^### Agent \\d/.test(b.trimStart()))\n\n for (const block of blocks) {\n const lines = block.split('\\n')\n\n const headerMatch = lines[0].match(/^### Agent (\\d+)\\s*[·•]\\s*(.+)$/)\n if (!headerMatch) continue\n\n const number = parseInt(headerMatch[1], 10)\n const name = headerMatch[2].trim()\n const fullName = `Agent ${number} · ${name}`\n const slug = toSlug(name)\n\n const scope = getFieldValue(lines, /Périmètre\\s*:\\s*(.+)/)\n const criterion = getFieldValue(lines, /Critère[s]?\\s*:\\s*(.+)/)\n\n // Outputs: may be inline or multi-line (indented \"- item\")\n const outputs: string[] = []\n const produitIdx = lines.findIndex((l) => /Produit\\s*:/.test(l))\n if (produitIdx !== -1) {\n const inlineVal = (lines[produitIdx].match(/Produit\\s*:\\s*(.+)/)?.[1] ?? '').trim()\n if (inlineVal) {\n outputs.push(inlineVal)\n } else {\n for (let i = produitIdx + 1; i < lines.length; i++) {\n const line = lines[i]\n if (/^\\s+[-]/.test(line)) {\n outputs.push(line.trim().replace(/^-\\s*/, ''))\n } else if (line.trim() !== '' && !/^\\s/.test(line)) {\n break\n }\n }\n }\n }\n\n agents.push({ number, name, fullName, slug, scope, outputs, criterion })\n }\n\n return agents\n}\n","import chalk from 'chalk'\n\nexport const logger = {\n info: (message: string): void => {\n process.stdout.write(chalk.blue('ℹ') + ' ' + message + '\\n')\n },\n success: (message: string): void => {\n process.stdout.write(chalk.green('✔') + ' ' + message + '\\n')\n },\n warn: (message: string): void => {\n process.stdout.write(chalk.yellow('⚠') + ' ' + message + '\\n')\n },\n error: (message: string): void => {\n process.stderr.write(chalk.red('✖') + ' ' + message + '\\n')\n },\n}\n","import type { Command } from 'commander'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport { join, basename } from 'node:path'\nimport inquirer from 'inquirer'\nimport { logger } from '../utils/logger.js'\nimport { extractAgentsFromWorkflow, toSlug } from '../utils/agentParser.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport type { Agent } from '../types/agent.js'\n\nfunction featureToAgentName(description: string): string {\n const clean = description\n .replace(/^(add|implement|create|build|integrate|setup|configure|refactor|improve)\\s+/i, '')\n .trim()\n return clean.replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport interface AddFeatureResult {\n agent: Agent\n agentDirPath: string\n}\n\nexport async function addFeatureToProject(\n description: string,\n projectDir: string,\n): Promise<AddFeatureResult> {\n const workflowPath = join(projectDir, 'AGENT_WORKFLOW.md')\n const playbookPath = join(projectDir, 'PLAYBOOK.md')\n\n let workflowContent = ''\n try {\n workflowContent = await readFile(workflowPath, 'utf-8')\n } catch {\n throw new Error(`AGENT_WORKFLOW.md not found in ${projectDir} — run agentkit init first`)\n }\n\n const existingAgents = extractAgentsFromWorkflow(workflowContent)\n const nextNumber = existingAgents.length + 1\n const name = featureToAgentName(description)\n const slug = toSlug(name)\n const fullName = `Agent ${nextNumber} · ${name}`\n\n const newAgent: Agent = {\n number: nextNumber,\n name,\n fullName,\n slug,\n scope: description,\n outputs: [`agents/agent-${nextNumber}-${slug}/`],\n criterion: 'npm run build && npm test',\n }\n\n const agentBlock = `\n### ${fullName}\nPérimètre : ${description}\nProduit :\n - agents/agent-${nextNumber}-${slug}/\nCritère : npm run build && npm test\n`\n\n await writeFile(workflowPath, workflowContent + agentBlock, 'utf-8')\n await generateSkills([newAgent], projectDir)\n\n let projectName = basename(projectDir)\n try {\n const pkg = JSON.parse(\n await readFile(join(projectDir, 'package.json'), 'utf-8'),\n ) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* use dirname fallback */ }\n\n const allAgents = [...existingAgents, newAgent]\n\n // When adding a feature iteration, hasBlueprint is false —\n // Phase 0 decomposition only runs during the initial init with --blueprint.\n const playbookContent = generatePlaybook({\n agents: allAgents,\n projectName,\n hasBlueprint: false,\n })\n await writeFile(playbookPath, playbookContent, 'utf-8')\n\n return {\n agent: newAgent,\n agentDirPath: join(projectDir, 'agents', `agent-${nextNumber}-${slug}`),\n }\n}\n\nexport function registerAdd(program: Command): void {\n const addCmd = program\n .command('add')\n .description('Add resources to the agentkit project')\n .option('--feature <description>', 'Add an agent from a feature description and regenerate PLAYBOOK.md')\n .action(async (options: { feature?: string }) => {\n if (options.feature) {\n try {\n const result = await addFeatureToProject(options.feature, process.cwd())\n logger.success(`Agent added : ${result.agent.fullName}`)\n logger.success(`Folder created : agents/agent-${result.agent.number}-${result.agent.slug}/`)\n logger.success('PLAYBOOK.md : regenerated')\n } catch (err) {\n logger.error(err instanceof Error ? err.message : String(err))\n process.exit(1)\n }\n } else {\n addCmd.help()\n }\n })\n\n addCmd\n .command('agent')\n .description('Add a new agent to AGENT_WORKFLOW.md (interactive)')\n .action(async () => {\n const cwd = process.cwd()\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n\n let existing = ''\n try {\n existing = await readFile(workflowPath, 'utf-8')\n } catch {\n logger.error('AGENT_WORKFLOW.md not found — run agentkit init first')\n process.exit(1)\n }\n\n const agentCount = (existing.match(/^### Agent \\d+/gm) ?? []).length\n const nextNumber = agentCount + 1\n\n const answers = await inquirer.prompt<{\n name: string\n scope: string\n outputs: string\n criterion: string\n }>([\n {\n type: 'input',\n name: 'name',\n message: `Agent name (e.g. \"Agent ${nextNumber} · Feature X\"):`,\n default: `Agent ${nextNumber}`,\n },\n {\n type: 'input',\n name: 'scope',\n message: 'Scope (one sentence):',\n },\n {\n type: 'input',\n name: 'outputs',\n message: 'Deliverables (comma-separated):',\n },\n {\n type: 'input',\n name: 'criterion',\n message: 'Success criterion:',\n },\n ])\n\n const outputLines = answers.outputs\n .split(',')\n .map((o: string) => ` - ${o.trim()}`)\n .join('\\n')\n\n const agentSection = `\n### ${answers.name}\nPérimètre : ${answers.scope}\nProduit :\n${outputLines}\nCritère : ${answers.criterion}\n`\n\n await writeFile(workflowPath, existing + agentSection, 'utf-8')\n logger.success(`Agent \"${answers.name}\" added to AGENT_WORKFLOW.md`)\n })\n}","import type { Command } from 'commander'\nimport { readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { logger } from '../utils/logger.js'\n\nexport function registerStatus(program: Command): void {\n program\n .command('status')\n .description('Affiche l\\'état du workflow agentkit dans le dossier courant')\n .action(async () => {\n const cwd = process.cwd()\n\n const [stack, isGit, claudeMd, workflow] = await Promise.all([\n detectStack(cwd),\n isGitRepo(cwd),\n readFile(join(cwd, 'CLAUDE.md'), 'utf-8').catch(() => null),\n readFile(join(cwd, 'AGENT_WORKFLOW.md'), 'utf-8').catch(() => null),\n ])\n\n process.stdout.write('\\n' + chalk.bold('AgentKit Status') + '\\n')\n process.stdout.write('─'.repeat(40) + '\\n')\n\n process.stdout.write(\n chalk.bold('Git repo : ') +\n (isGit ? chalk.green('✔ oui') : chalk.red('✖ non')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('Stack : ') + chalk.cyan(stack.framework) + ' (' + stack.language + ')\\n',\n )\n\n process.stdout.write(\n chalk.bold('CLAUDE.md : ') +\n (claudeMd !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('AGENT_WORKFLOW.md : ') +\n (workflow !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n if (workflow !== null) {\n const agentMatches = workflow.match(/^### Agent \\d+/gm) ?? []\n process.stdout.write(\n chalk.bold('Agents définis : ') + chalk.cyan(String(agentMatches.length)) + '\\n',\n )\n }\n\n process.stdout.write('─'.repeat(40) + '\\n\\n')\n })\n}\n"],"mappings":";;;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,cAAAC,QAAM,KAAK,wBAAqB,IAAI,cAAAA,QAAM,KAAK,OAAO,aAAa,MAAM,CAAC,IAAI;AAAA,MAChF;AAAA,IACF;AAEA,YAAQ,OAAO,MAAM,SAAI,OAAO,EAAE,IAAI,MAAM;AAAA,EAC9C,CAAC;AACL;;;AlBlDA,IAAM,UAAU,IAAI,yBAAQ;AAE5B,QACG,KAAK,UAAU,EACf,YAAY,mDAAmD,EAC/D,QAAQ,OAAO;AAElB,aAAa,OAAO;AACpB,YAAY,OAAO;AACnB,eAAe,OAAO;AAEtB,QAAQ,MAAM;","names":["import_promises","import_node_path","import_promises","import_node_path","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","import_promises","import_node_path","chalk","import_node_path","inquirer","program","ora","import_promises","import_node_path","import_inquirer","agentBlock","program","inquirer","import_promises","import_node_path","import_chalk","program","claudeMd","workflow","chalk"]}
|
package/dist/cli.js
CHANGED
|
@@ -500,7 +500,18 @@ Crit\xE8re : tests passent
|
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
// src/generators/claudeMdGenerator.ts
|
|
503
|
-
|
|
503
|
+
var STACK_NOT_CONFIGURED_WARNING = `
|
|
504
|
+
## \u26A0\uFE0F Stack not configured
|
|
505
|
+
AgentKit could not detect your stack and no stack was selected.
|
|
506
|
+
Before running Claude Code, fill in the following sections:
|
|
507
|
+
- Stack (framework, runtime, DB, tools)
|
|
508
|
+
- Commands (dev, build, test)
|
|
509
|
+
- Structure (folder layout)
|
|
510
|
+
|
|
511
|
+
Once filled, give Claude Code this instruction:
|
|
512
|
+
"Read PLAYBOOK.md and execute the procedure."
|
|
513
|
+
`;
|
|
514
|
+
function generateClaudeMd(stack, blueprintContent, stackNotConfigured) {
|
|
504
515
|
let base;
|
|
505
516
|
switch (stack.framework) {
|
|
506
517
|
case "react":
|
|
@@ -524,6 +535,10 @@ function generateClaudeMd(stack, blueprintContent) {
|
|
|
524
535
|
default:
|
|
525
536
|
base = claudeMd7(stack);
|
|
526
537
|
}
|
|
538
|
+
if (stackNotConfigured) {
|
|
539
|
+
const firstNewline = base.indexOf("\n");
|
|
540
|
+
base = base.slice(0, firstNewline + 1) + STACK_NOT_CONFIGURED_WARNING + base.slice(firstNewline + 1);
|
|
541
|
+
}
|
|
527
542
|
if (!blueprintContent) return base;
|
|
528
543
|
const blueprintNote = "\n> A PROJECT_BLUEPRINT.md is present \u2014 Claude Code will read it during Phase 0.\n";
|
|
529
544
|
const conventionsIdx = base.indexOf("\n## Conventions");
|
|
@@ -851,6 +866,38 @@ var FRAMEWORK_LABELS = {
|
|
|
851
866
|
node: "Node.js",
|
|
852
867
|
unknown: "Unknown (generic)"
|
|
853
868
|
};
|
|
869
|
+
var STACK_CHOICES = [
|
|
870
|
+
{ name: "React + Vite", value: "react" },
|
|
871
|
+
{ name: "Next.js", value: "nextjs" },
|
|
872
|
+
{ name: "Tauri v2 (React + Rust)", value: "tauri" },
|
|
873
|
+
{ name: "FastAPI (Python)", value: "fastapi" },
|
|
874
|
+
{ name: "Express (Node.js)", value: "express" },
|
|
875
|
+
{ name: "Node.js (generic)", value: "node" },
|
|
876
|
+
{ name: "None of the above \u2014 generate a generic CLAUDE.md to fill manually", value: "none" }
|
|
877
|
+
];
|
|
878
|
+
async function resolveStack(detected) {
|
|
879
|
+
if (detected.framework !== "unknown") {
|
|
880
|
+
return { stack: detected, stackNotConfigured: false };
|
|
881
|
+
}
|
|
882
|
+
logger.warn("Stack not detected automatically.");
|
|
883
|
+
const { selectedFramework } = await inquirer.prompt([
|
|
884
|
+
{
|
|
885
|
+
type: "list",
|
|
886
|
+
name: "selectedFramework",
|
|
887
|
+
message: "Stack not detected automatically. Please select your stack:",
|
|
888
|
+
choices: STACK_CHOICES
|
|
889
|
+
}
|
|
890
|
+
]);
|
|
891
|
+
if (selectedFramework === "none") {
|
|
892
|
+
return { stack: detected, stackNotConfigured: true };
|
|
893
|
+
}
|
|
894
|
+
const framework = selectedFramework;
|
|
895
|
+
const language = framework === "fastapi" ? "python" : "javascript";
|
|
896
|
+
return {
|
|
897
|
+
stack: { ...detected, framework, language, hasTypeScript: false },
|
|
898
|
+
stackNotConfigured: false
|
|
899
|
+
};
|
|
900
|
+
}
|
|
854
901
|
async function fileExists(path) {
|
|
855
902
|
try {
|
|
856
903
|
await readFile2(path);
|
|
@@ -868,8 +915,9 @@ function registerInit(program2) {
|
|
|
868
915
|
if (!isGit) {
|
|
869
916
|
logger.warn("Ce dossier n'est pas un repo git \u2014 lancez git init si n\xE9cessaire");
|
|
870
917
|
}
|
|
871
|
-
const
|
|
872
|
-
|
|
918
|
+
const { stack: resolvedStack, stackNotConfigured } = await resolveStack(stack);
|
|
919
|
+
const label = FRAMEWORK_LABELS[resolvedStack.framework];
|
|
920
|
+
logger.info(`Stack : ${label} (${resolvedStack.language})`);
|
|
873
921
|
const { confirmed } = await inquirer.prompt([
|
|
874
922
|
{
|
|
875
923
|
type: "confirm",
|
|
@@ -921,8 +969,8 @@ function registerInit(program2) {
|
|
|
921
969
|
}
|
|
922
970
|
}
|
|
923
971
|
const genSpinner = ora("G\xE9n\xE9ration des fichiers\u2026").start();
|
|
924
|
-
const claudeMdContent = generateClaudeMd(
|
|
925
|
-
const workflowContent = generateWorkflow(
|
|
972
|
+
const claudeMdContent = generateClaudeMd(resolvedStack, blueprintContent, stackNotConfigured);
|
|
973
|
+
const workflowContent = generateWorkflow(resolvedStack, blueprintContent, projectName);
|
|
926
974
|
const agents = extractAgentsFromWorkflow(workflowContent);
|
|
927
975
|
const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent });
|
|
928
976
|
await writeFile2(claudeMdPath, claudeMdContent, "utf-8");
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/commands/init.ts","../src/detectors/stackDetector.ts","../src/detectors/gitDetector.ts","../src/templates/react.ts","../src/templates/nextjs.ts","../src/templates/tauri.ts","../src/templates/fastapi.ts","../src/templates/express.ts","../src/templates/node.ts","../src/templates/unknown.ts","../src/generators/claudeMdGenerator.ts","../src/generators/workflowGenerator.ts","../src/generators/playbookGenerator.ts","../src/generators/skillsGenerator.ts","../src/utils/agentParser.ts","../src/utils/logger.ts","../src/commands/add.ts","../src/commands/status.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander'\nimport { registerInit } from './commands/init.js'\nimport { registerAdd } from './commands/add.js'\nimport { registerStatus } from './commands/status.js'\n\nconst program = new Command()\n\nprogram\n .name('agentkit')\n .description('Scaffolder des workflows multi-agents Claude Code')\n .version('0.1.0')\n\nregisterInit(program)\nregisterAdd(program)\nregisterStatus(program)\n\nprogram.parse()\n","import type { Command } from 'commander'\nimport { writeFile, readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport inquirer from 'inquirer'\nimport ora from 'ora'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { generateClaudeMd } from '../generators/claudeMdGenerator.js'\nimport { generateWorkflow } from '../generators/workflowGenerator.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport { extractAgentsFromWorkflow } from '../utils/agentParser.js'\nimport { logger } from '../utils/logger.js'\nimport type { StackInfo } from '../detectors/stackDetector.js'\nimport { basename } from 'node:path'\n\nconst FRAMEWORK_LABELS: Record<StackInfo['framework'], string> = {\n react: 'React',\n nextjs: 'Next.js',\n tauri: 'Tauri',\n fastapi: 'FastAPI (Python)',\n express: 'Express',\n node: 'Node.js',\n unknown: 'Unknown (generic)',\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await readFile(path)\n return true\n } catch {\n return false\n }\n}\n\nexport function registerInit(program: Command): void {\n program\n .command('init')\n .description('Génère CLAUDE.md et AGENT_WORKFLOW.md dans le dossier courant')\n .option('-f, --force', 'Écrase les fichiers existants sans confirmation')\n .option('--blueprint <path>', 'Fichier blueprint .md à utiliser pour personnaliser les fichiers générés')\n .action(async (options: { force?: boolean; blueprint?: string }) => {\n const cwd = process.cwd()\n\n const spinner = ora('Détection de la stack…').start()\n const [stack, isGit] = await Promise.all([detectStack(cwd), isGitRepo(cwd)])\n spinner.stop()\n\n if (!isGit) {\n logger.warn('Ce dossier n\\'est pas un repo git — lancez git init si nécessaire')\n }\n\n const label = FRAMEWORK_LABELS[stack.framework]\n logger.info(`Stack détectée : ${label} (${stack.language})`)\n\n const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([\n {\n type: 'confirm',\n name: 'confirmed',\n message: `Générer les fichiers pour ${label} ?`,\n default: true,\n },\n ])\n\n if (!confirmed) {\n logger.warn('Annulé.')\n return\n }\n\n const claudeMdPath = join(cwd, 'CLAUDE.md')\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n const playbookPath = join(cwd, 'PLAYBOOK.md')\n\n // Resolve project name from package.json or directory name\n let projectName = basename(cwd)\n try {\n const pkg = JSON.parse(await readFile(join(cwd, 'package.json'), 'utf-8')) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* fallback to dirname */ }\n\n if (!options.force) {\n const existing: string[] = []\n if (await fileExists(claudeMdPath)) existing.push('CLAUDE.md')\n if (await fileExists(workflowPath)) existing.push('AGENT_WORKFLOW.md')\n if (await fileExists(playbookPath)) existing.push('PLAYBOOK.md')\n\n if (existing.length > 0) {\n const { overwrite } = await inquirer.prompt<{ overwrite: boolean }>([\n {\n type: 'confirm',\n name: 'overwrite',\n message: `${existing.join(' et ')} existe déjà. Écraser ?`,\n default: false,\n },\n ])\n if (!overwrite) {\n logger.warn('Annulé.')\n return\n }\n }\n }\n\n // Load blueprint if provided\n let blueprintContent: string | undefined\n if (options.blueprint) {\n try {\n blueprintContent = await readFile(options.blueprint, 'utf-8')\n } catch {\n logger.error(`Blueprint introuvable : ${options.blueprint}`)\n process.exit(1)\n }\n }\n\n const genSpinner = ora('Génération des fichiers…').start()\n const claudeMdContent = generateClaudeMd(stack, blueprintContent)\n const workflowContent = generateWorkflow(stack, blueprintContent, projectName)\n const agents = extractAgentsFromWorkflow(workflowContent)\n const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent })\n await writeFile(claudeMdPath, claudeMdContent, 'utf-8')\n await writeFile(workflowPath, workflowContent, 'utf-8')\n await writeFile(playbookPath, playbookContent, 'utf-8')\n await generateSkills(agents, cwd)\n genSpinner.succeed('Fichiers générés')\n\n logger.success('CLAUDE.md → créé')\n logger.success('AGENT_WORKFLOW.md → créé')\n logger.success('PLAYBOOK.md → créé')\n logger.success(`agents/ → ${agents.length} dossier(s) créé(s)`)\n })\n}\n","import { readFile, access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport interface StackInfo {\n framework: 'react' | 'nextjs' | 'tauri' | 'fastapi' | 'express' | 'node' | 'unknown'\n language: 'typescript' | 'javascript' | 'python' | 'unknown'\n hasTypeScript: boolean\n extras: string[]\n}\n\nasync function pathExists(p: string): Promise<boolean> {\n try {\n await access(p)\n return true\n } catch {\n return false\n }\n}\n\nasync function readJson(p: string): Promise<Record<string, unknown> | null> {\n try {\n const raw = await readFile(p, 'utf-8')\n return JSON.parse(raw) as Record<string, unknown>\n } catch {\n return null\n }\n}\n\nasync function readText(p: string): Promise<string | null> {\n try {\n return await readFile(p, 'utf-8')\n } catch {\n return null\n }\n}\n\nexport async function detectStack(projectPath: string): Promise<StackInfo> {\n const info: StackInfo = {\n framework: 'unknown',\n language: 'unknown',\n hasTypeScript: false,\n extras: [],\n }\n\n const packageJson = await readJson(join(projectPath, 'package.json'))\n const requirementsTxt = await readText(join(projectPath, 'requirements.txt'))\n const hasTauriDir = await pathExists(join(projectPath, 'src-tauri'))\n const hasTsConfig = await pathExists(join(projectPath, 'tsconfig.json'))\n\n if (packageJson !== null) {\n const deps = (packageJson.dependencies as Record<string, string>) ?? {}\n const devDeps = (packageJson.devDependencies as Record<string, string>) ?? {}\n const allDeps = { ...deps, ...devDeps }\n\n info.hasTypeScript = 'typescript' in allDeps || hasTsConfig\n info.language = info.hasTypeScript ? 'typescript' : 'javascript'\n\n // Order matters: most specific first\n if ('next' in allDeps) {\n info.framework = 'nextjs'\n } else if (hasTauriDir || '@tauri-apps/api' in allDeps || '@tauri-apps/cli' in allDeps) {\n info.framework = 'tauri'\n } else if ('react' in allDeps) {\n info.framework = 'react'\n } else if ('express' in allDeps) {\n info.framework = 'express'\n } else {\n info.framework = 'node'\n }\n\n if ('vitest' in allDeps || 'jest' in allDeps) info.extras.push('testing')\n if ('prisma' in allDeps || '@prisma/client' in allDeps) info.extras.push('prisma')\n if ('tailwindcss' in allDeps) info.extras.push('tailwind')\n }\n\n if (requirementsTxt !== null && info.framework === 'unknown') {\n info.language = 'python'\n if (/\\bfastapi\\b/i.test(requirementsTxt)) {\n info.framework = 'fastapi'\n }\n }\n\n if (hasTauriDir && info.framework === 'unknown') {\n info.framework = 'tauri'\n }\n\n return info\n}\n","import { access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport async function isGitRepo(projectPath: string): Promise<boolean> {\n try {\n await access(join(projectPath, '.git'))\n return true\n } catch {\n return false\n }\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const testLine = stack.extras.includes('testing') ? '- `npm test` — run tests\\n' : ''\n return `# CLAUDE.md — React Project\n\n## Stack\n- Framework : React (${lang})\n- Language : ${lang}\n- Build : Vite\n\n## Commands\n- \\`npm run dev\\` — development server\n- \\`npm run build\\` — production build\n${testLine}\n## Structure\nsrc/\n components/ ← UI components (PascalCase)\n hooks/ ← custom hooks (prefix: use*)\n pages/ ← page-level components\n utils/ ← shared helpers\n\n## Conventions\n1. Components in PascalCase\n2. Hooks prefixed with \\`use\\`\n3. Props interfaces named \\`*Props\\`\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — React Project\n\n## Stack détectée\nFramework: React | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Components\nPérimètre : composants UI réutilisables\nProduit : src/components/\nCritère : composants documentés et testés\n\n### Agent 2 · State & Hooks\nPérimètre : state management, hooks personnalisés\nProduit : src/hooks/\nCritère : hooks testés unitairement\n\n### Agent 3 · Pages & Routing\nPérimètre : assemblage des pages, react-router\nProduit : src/pages/\nCritère : navigation fonctionnelle\n\n### Agent 4 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const hasTailwind = stack.extras.includes('tailwind')\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Next.js Project\n\n## Stack\n- Framework : Next.js (TypeScript)\n- Rendering : App Router (RSC + Client Components)\n- Styling : ${hasTailwind ? 'Tailwind CSS' : 'CSS Modules'}\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (http://localhost:3000)\n- \\`npm run build\\` — production build\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n app/ ← App Router pages and layouts\n components/ ← shared UI components\n lib/ ← server utilities, db clients\n utils/ ← shared helpers\n\n## Conventions\n1. Server Components by default, \\`'use client'\\` only when needed\n2. API routes in \\`src/app/api/\\`\n3. Environment variables via \\`src/env.ts\\` (validated)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const hasPrisma = stack.extras.includes('prisma')\n return `# Agent Workflow — Next.js Project\n\n## Stack détectée\nFramework: Next.js | Language: TypeScript\n\n## Agents\n\n### Agent 1 · Data Layer\nPérimètre : schéma${hasPrisma ? ' Prisma' : ''}, types, server actions\nProduit : src/lib/, ${hasPrisma ? 'prisma/schema.prisma' : 'src/types/'}\nCritère : types compilent, migrations propres\n\n### Agent 2 · UI Components\nPérimètre : composants réutilisables (Server + Client)\nProduit : src/components/\nCritère : composants rendus sans erreur\n\n### Agent 3 · Pages & Layout\nPérimètre : App Router, layouts, pages\nProduit : src/app/\nCritère : navigation fonctionnelle, build passe\n\n### Agent 4 · API & Tests\nPérimètre : API routes, tests e2e/unitaires\nProduit : src/app/api/, tests/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Tauri Project\n\n## Stack\n- Framework : Tauri (Rust + ${lang} frontend)\n- Language : Rust (backend) + ${lang} (frontend)\n- Build : Cargo + Vite\n\n## Commands\n- \\`npm run tauri dev\\` — development (hot reload)\n- \\`npm run tauri build\\` — production bundle\n- \\`npm run build\\` — frontend only\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/ ← frontend (${lang})\n components/\n utils/\nsrc-tauri/ ← Rust backend\n src/\n main.rs ← Tauri entry point\n commands.rs ← Tauri commands (IPC)\n tauri.conf.json\n\n## Conventions\n1. IPC commands defined in \\`src-tauri/src/commands.rs\\`\n2. Frontend invokes via \\`@tauri-apps/api/tauri\\`\n3. No direct filesystem access from frontend\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Tauri Project\n\n## Stack détectée\nFramework: Tauri | Language: Rust + ${lang}\n\n## Agents\n\n### Agent 1 · Rust Commands\nPérimètre : commandes Tauri (IPC), permissions\nProduit : src-tauri/src/commands.rs, tauri.conf.json\nCritère : \\`cargo build\\` passe\n\n### Agent 2 · Frontend UI\nPérimètre : interface ${lang}, intégration IPC\nProduit : src/components/, src/utils/\nCritère : appels IPC fonctionnels\n\n### Agent 3 · Build & Packaging\nPérimètre : configuration build, icônes, installeurs\nProduit : src-tauri/tauri.conf.json, icons/\nCritère : \\`npm run tauri build\\` produit un bundle\n\n### Agent 4 · Tests\nPérimètre : tests Rust + tests frontend\nProduit : src-tauri/tests/, tests/\nCritère : \\`cargo test\\` + \\`npm test\\` passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md — FastAPI Project\n\n## Stack\n- Framework : FastAPI (Python)\n- Language : Python 3.11+\n- Server : Uvicorn\n- Validation: Pydantic v2\n\n## Commands\n- \\`uvicorn main:app --reload\\` — development server (http://localhost:8000)\n- \\`pytest\\` — run tests\n- \\`pip install -r requirements.txt\\` — install dependencies\n\n## Structure\napp/\n main.py ← FastAPI app entry point\n routers/ ← API route groups\n models/ ← Pydantic models\n services/ ← business logic\n dependencies/ ← FastAPI dependencies (DI)\ntests/ ← pytest tests\n\n## Conventions\n1. Routers grouped by domain in \\`app/routers/\\`\n2. Pydantic models for all request/response bodies\n3. Business logic in \\`app/services/\\`, not in routes\n4. Async endpoints by default (\\`async def\\`)\n5. Environment variables via \\`python-dotenv\\` + \\`pydantic-settings\\`\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow — FastAPI Project\n\n## Stack détectée\nFramework: FastAPI | Language: Python\n\n## Agents\n\n### Agent 1 · Models & Schemas\nPérimètre : modèles Pydantic, schémas DB (SQLAlchemy/SQLModel)\nProduit : app/models/\nCritère : modèles validés, migrations propres\n\n### Agent 2 · Services\nPérimètre : logique métier, accès base de données\nProduit : app/services/\nCritère : services testés unitairement (pytest)\n\n### Agent 3 · Routers & API\nPérimètre : routes FastAPI, dépendances, auth\nProduit : app/routers/, app/dependencies/\nCritère : endpoints documentés (OpenAPI), tests d'intégration\n\n### Agent 4 · Tests & CI\nPérimètre : couverture pytest, configuration CI\nProduit : tests/, .github/workflows/\nCritère : \\`pytest\\` passe à 100%\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Express Project\n\n## Stack\n- Framework : Express (${lang})\n- Language : ${lang}\n- Runtime : Node.js 20+\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (nodemon)\n- \\`npm run build\\` — compile TypeScript\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n routes/ ← Express routers (one per domain)\n controllers/ ← request handlers\n services/ ← business logic\n middleware/ ← Express middleware\n utils/ ← shared helpers\n\n## Conventions\n1. Routes grouped by domain in \\`src/routes/\\`\n2. Business logic in \\`src/services/\\`, not in controllers\n3. Middleware for cross-cutting concerns (auth, validation)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Express Project\n\n## Stack détectée\nFramework: Express | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Data & Models\nPérimètre : modèles de données, accès DB\nProduit : src/models/, src/services/db.ts\nCritère : connexion DB fonctionnelle\n\n### Agent 2 · Services\nPérimètre : logique métier\nProduit : src/services/\nCritère : services testés unitairement\n\n### Agent 3 · Routes & Controllers\nPérimètre : routes Express, validation, auth\nProduit : src/routes/, src/controllers/, src/middleware/\nCritère : endpoints répondent correctement\n\n### Agent 4 · Tests & CI\nPérimètre : tests d'intégration, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Node.js Project\n\n## Stack\n- Runtime : Node.js 20+\n- Language : ${lang}\n\n## Commands\n- \\`npm run dev\\` — development (with watch)\n- \\`npm run build\\` — compile${stack.hasTypeScript ? ' TypeScript' : ''}\n- \\`npm start\\` — run production build\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n index.ts ← entry point\n lib/ ← core library code\n utils/ ← shared helpers\n\n## Conventions\n1. Modules follow single-responsibility principle\n2. Async/await over callbacks\n3. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Node.js Project\n\n## Stack détectée\nRuntime: Node.js | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Core Library\nPérimètre : logique principale\nProduit : src/lib/\nCritère : module fonctionne et testé\n\n### Agent 2 · CLI / API\nPérimètre : interface utilisateur (CLI ou API)\nProduit : src/index.ts, src/cli.ts\nCritère : commandes fonctionnelles\n\n### Agent 3 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md\n\n## Stack\nStack non détectée automatiquement — à remplir manuellement.\n\n## Commands\n- À définir selon le projet\n\n## Structure\nsrc/ ← code source\ntests/ ← tests\n\n## Conventions\n1. Tout output console passe par un logger centralisé\n2. À compléter selon les conventions du projet\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow\n\n## Stack détectée\nStack inconnue — workflow générique.\n\n## Agents\n\n### Agent 1 · Setup\nPérimètre : configuration initiale du projet\nProduit : structure de base\nCritère : projet compilable\n\n### Agent 2 · Core\nPérimètre : logique principale\nProduit : src/\nCritère : fonctionnalités principales opérationnelles\n\n### Agent 3 · Tests\nPérimètre : couverture de tests\nProduit : tests/\nCritère : tests passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nexport function generateClaudeMd(stack: StackInfo, blueprintContent?: string): string {\n let base: string\n switch (stack.framework) {\n case 'react': base = react.claudeMd(stack); break\n case 'nextjs': base = nextjs.claudeMd(stack); break\n case 'tauri': base = tauri.claudeMd(stack); break\n case 'fastapi': base = fastapi.claudeMd(stack); break\n case 'express': base = express.claudeMd(stack); break\n case 'node': base = node.claudeMd(stack); break\n default: base = unknown.claudeMd(stack)\n }\n\n if (!blueprintContent) return base\n\n const blueprintNote = '\\n> A PROJECT_BLUEPRINT.md is present — Claude Code will read it during Phase 0.\\n'\n\n const conventionsIdx = base.indexOf('\\n## Conventions')\n if (conventionsIdx !== -1) {\n return base.slice(0, conventionsIdx) + blueprintNote + base.slice(conventionsIdx)\n }\n return base + blueprintNote\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nexport function generateWorkflow(stack: StackInfo, blueprintContent?: string, projectName?: string): string {\n if (blueprintContent) return blueprintPlaceholder(projectName ?? stack.framework)\n\n switch (stack.framework) {\n case 'react': return react.workflow(stack)\n case 'nextjs': return nextjs.workflow(stack)\n case 'tauri': return tauri.workflow(stack)\n case 'fastapi': return fastapi.workflow(stack)\n case 'express': return express.workflow(stack)\n case 'node': return node.workflow(stack)\n default: return unknown.workflow(stack)\n }\n}\n\nfunction blueprintPlaceholder(projectName: string): string {\n return `# AGENT_WORKFLOW.md — ${projectName}\n\n> This file will be filled in by Claude Code during Phase 0.\n> Claude Code will read PROJECT_BLUEPRINT.md, propose a decomposition,\n> and replace this content after human validation.\n\n---\n\n*Waiting for Phase 0 decomposition...*\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport interface PlaybookInput {\n agents: Agent[]\n projectName: string\n hasBlueprint: boolean\n}\n\nexport function generatePlaybook({ agents, projectName, hasBlueprint }: PlaybookInput): string {\n const agentBlocks = agents.map((a) => agentBlock(a)).join('\\n---\\n\\n')\n\n const phase0 = hasBlueprint\n ? `## Phase 0 — Agent Decomposition (run this first)\n\n> A \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Claude Code reads it and decomposes the project into specialized agents\n> before writing a single line of code.\n\n**Read these files in order:**\n1. \\`CLAUDE.md\\`\n2. \\`PROJECT_BLUEPRINT.md\\`\n\n**Then decompose the project into agents** following these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n : `## Phase 0 — Project Discovery (run this first)\n\n> No \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Before writing any code, Claude Code asks the user what they want to build,\n> then decomposes the project into agents — exactly as if a blueprint had been provided.\n\n**Ask the user these questions and wait for their answers:**\n\n1. What is this project? (one sentence describing the goal)\n2. What are the main features you want to build? (list them)\n3. Are there any tech constraints or architecture preferences?\n (e.g. offline-only, specific DB, no auth, specific framework)\n\n**Once you have the answers, decompose the project into agents**\nfollowing these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n\n return `# PLAYBOOK.md — ${projectName}\n\n> **One instruction to give Claude Code:**\n> \"Read PLAYBOOK.md and execute the procedure.\"\n>\n> Claude Code handles the rest autonomously — project discovery or blueprint reading,\n> agent decomposition, execution, success validation, retries, and human escalation.\n> No API key required. No additional cost beyond your LLM subscription.\n\n---\n\n## Global Execution Rules\n\nBefore each agent:\n1. Read \\`CLAUDE.md\\`\n2. Read \\`agents/agent-{N}-{slug}/skills.md\\` (current agent's file)\n3. Read the agent's section in \\`AGENT_WORKFLOW.md\\`\n\nAfter each agent:\n- Run the success criterion command\n- ✅ Passes → announce \"✅ Agent N complete\" and move to the next\n- ❌ Fails → analyze the root cause, fix, rerun (max 3 attempts)\n- After 3 consecutive failures → stop and ask for human validation\n\n**Never move to the next agent without a passing success criterion.**\n**Stay strictly within your current agent's defined scope.**\n\n---\n\n${phase0}## Phase 1 — Execution\n\n${agentBlocks}\n\n---\n\n## Future Iterations\n\nWhen a new agent is added via \\`agentkit add --feature <description>\\`:\n1. A new agent block is appended to \\`AGENT_WORKFLOW.md\\`\n2. The folder \\`agents/agent-{N}-{slug}/\\` is created with \\`skills.md\\`\n3. This \\`PLAYBOOK.md\\` is regenerated to include the new agent\n4. Execution resumes at the new agent only — completed agents are not rerun\n\nWhen you receive the instruction to continue after an iteration:\n> \"Read PLAYBOOK.md and execute only the agents that haven't been completed yet.\"\n\n---\n\n## Human Validation Required\n\nStop and wait for confirmation in these situations:\n- **3 consecutive failures** on the same success criterion\n- **Missing external dependency**: API key, env variable, unavailable service\n- **Conflict** between the detected stack and the user's stated constraints\n- **Destructive operation**: overwriting files not listed in deliverables\n- **End of Phase 0**: agent decomposition must be validated before execution\n`\n}\n\nfunction agentBlock(agent: Agent): string {\n const skillsPath = `agents/agent-${agent.number}-${agent.slug}/skills.md`\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (see skills.md for details)'\n\n return `### Agent ${agent.number} · ${agent.name}\n\n**Scope**: ${agent.scope}\n\n**Skills**: \\`${skillsPath}\\`\n\n**Deliverables**:\n${outputLines}\n\n**Success criterion**:\n\\`\\`\\`bash\n${agent.criterion || 'npm run build && npm test'}\n\\`\\`\\`\n\n**On failure**:\n1. Read the full error output\n2. Fix the root cause — not the symptoms\n3. Rerun the success criterion (max 3 attempts)\n4. After 3 failures → ask for human validation\n`\n}","import { mkdir, writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport type { Agent } from '../types/agent.js'\n\nexport async function generateSkills(agents: Agent[], outputDir: string): Promise<void> {\n for (const agent of agents) {\n const agentDir = join(outputDir, 'agents', `agent-${agent.number}-${agent.slug}`)\n await mkdir(agentDir, { recursive: true })\n await writeFile(join(agentDir, 'skills.md'), skillsMd(agent), 'utf-8')\n await writeFile(join(agentDir, 'context.md'), contextMd(agent), 'utf-8')\n }\n}\n\nfunction skillsMd(agent: Agent): string {\n return `# Skills — ${agent.fullName}\n\n> Ce fichier est lu par l'agent avant de commencer.\n\n## Contexte technique\n\n<!-- À remplir : bibliothèques, versions, décisions d'architecture spécifiques à cet agent -->\n\n## Documentation de référence\n\n<!-- À remplir : liens vers docs, exemples, ADRs pertinents -->\n\n## Conventions spécifiques\n\n<!-- À remplir : règles propres à cet agent (naming, patterns, structure de fichiers) -->\n`\n}\n\nfunction contextMd(agent: Agent): string {\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (voir AGENT_WORKFLOW.md)'\n\n return `# Context — ${agent.fullName}\n\n> Ce fichier fournit le contexte additionnel à l'agent avant exécution.\n> À compléter avant de lancer cet agent.\n\n## Périmètre\n\n${agent.scope}\n\n## Fichiers produits attendus\n\n${outputLines}\n\n## Critère de succès\n\n\\`${agent.criterion || 'npm run build && npm test'}\\`\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport function toSlug(name: string): string {\n return name\n .toLowerCase()\n .replace(/[·•&]/g, ' ')\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n}\n\nfunction getFieldValue(lines: string[], pattern: RegExp): string {\n for (const line of lines) {\n const m = line.match(pattern)\n if (m) return (m[1] ?? '').trim()\n }\n return ''\n}\n\nexport function extractAgentsFromWorkflow(content: string): Agent[] {\n const agents: Agent[] = []\n\n // Split into blocks starting with \"### Agent N\"\n const blocks = content\n .split(/(?=^### Agent \\d)/m)\n .filter((b) => /^### Agent \\d/.test(b.trimStart()))\n\n for (const block of blocks) {\n const lines = block.split('\\n')\n\n const headerMatch = lines[0].match(/^### Agent (\\d+)\\s*[·•]\\s*(.+)$/)\n if (!headerMatch) continue\n\n const number = parseInt(headerMatch[1], 10)\n const name = headerMatch[2].trim()\n const fullName = `Agent ${number} · ${name}`\n const slug = toSlug(name)\n\n const scope = getFieldValue(lines, /Périmètre\\s*:\\s*(.+)/)\n const criterion = getFieldValue(lines, /Critère[s]?\\s*:\\s*(.+)/)\n\n // Outputs: may be inline or multi-line (indented \"- item\")\n const outputs: string[] = []\n const produitIdx = lines.findIndex((l) => /Produit\\s*:/.test(l))\n if (produitIdx !== -1) {\n const inlineVal = (lines[produitIdx].match(/Produit\\s*:\\s*(.+)/)?.[1] ?? '').trim()\n if (inlineVal) {\n outputs.push(inlineVal)\n } else {\n for (let i = produitIdx + 1; i < lines.length; i++) {\n const line = lines[i]\n if (/^\\s+[-]/.test(line)) {\n outputs.push(line.trim().replace(/^-\\s*/, ''))\n } else if (line.trim() !== '' && !/^\\s/.test(line)) {\n break\n }\n }\n }\n }\n\n agents.push({ number, name, fullName, slug, scope, outputs, criterion })\n }\n\n return agents\n}\n","import chalk from 'chalk'\n\nexport const logger = {\n info: (message: string): void => {\n process.stdout.write(chalk.blue('ℹ') + ' ' + message + '\\n')\n },\n success: (message: string): void => {\n process.stdout.write(chalk.green('✔') + ' ' + message + '\\n')\n },\n warn: (message: string): void => {\n process.stdout.write(chalk.yellow('⚠') + ' ' + message + '\\n')\n },\n error: (message: string): void => {\n process.stderr.write(chalk.red('✖') + ' ' + message + '\\n')\n },\n}\n","import type { Command } from 'commander'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport { join, basename } from 'node:path'\nimport inquirer from 'inquirer'\nimport { logger } from '../utils/logger.js'\nimport { extractAgentsFromWorkflow, toSlug } from '../utils/agentParser.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport type { Agent } from '../types/agent.js'\n\nfunction featureToAgentName(description: string): string {\n const clean = description\n .replace(/^(add|implement|create|build|integrate|setup|configure|refactor|improve)\\s+/i, '')\n .trim()\n return clean.replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport interface AddFeatureResult {\n agent: Agent\n agentDirPath: string\n}\n\nexport async function addFeatureToProject(\n description: string,\n projectDir: string,\n): Promise<AddFeatureResult> {\n const workflowPath = join(projectDir, 'AGENT_WORKFLOW.md')\n const playbookPath = join(projectDir, 'PLAYBOOK.md')\n\n let workflowContent = ''\n try {\n workflowContent = await readFile(workflowPath, 'utf-8')\n } catch {\n throw new Error(`AGENT_WORKFLOW.md not found in ${projectDir} — run agentkit init first`)\n }\n\n const existingAgents = extractAgentsFromWorkflow(workflowContent)\n const nextNumber = existingAgents.length + 1\n const name = featureToAgentName(description)\n const slug = toSlug(name)\n const fullName = `Agent ${nextNumber} · ${name}`\n\n const newAgent: Agent = {\n number: nextNumber,\n name,\n fullName,\n slug,\n scope: description,\n outputs: [`agents/agent-${nextNumber}-${slug}/`],\n criterion: 'npm run build && npm test',\n }\n\n const agentBlock = `\n### ${fullName}\nPérimètre : ${description}\nProduit :\n - agents/agent-${nextNumber}-${slug}/\nCritère : npm run build && npm test\n`\n\n await writeFile(workflowPath, workflowContent + agentBlock, 'utf-8')\n await generateSkills([newAgent], projectDir)\n\n let projectName = basename(projectDir)\n try {\n const pkg = JSON.parse(\n await readFile(join(projectDir, 'package.json'), 'utf-8'),\n ) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* use dirname fallback */ }\n\n const allAgents = [...existingAgents, newAgent]\n\n // When adding a feature iteration, hasBlueprint is false —\n // Phase 0 decomposition only runs during the initial init with --blueprint.\n const playbookContent = generatePlaybook({\n agents: allAgents,\n projectName,\n hasBlueprint: false,\n })\n await writeFile(playbookPath, playbookContent, 'utf-8')\n\n return {\n agent: newAgent,\n agentDirPath: join(projectDir, 'agents', `agent-${nextNumber}-${slug}`),\n }\n}\n\nexport function registerAdd(program: Command): void {\n const addCmd = program\n .command('add')\n .description('Add resources to the agentkit project')\n .option('--feature <description>', 'Add an agent from a feature description and regenerate PLAYBOOK.md')\n .action(async (options: { feature?: string }) => {\n if (options.feature) {\n try {\n const result = await addFeatureToProject(options.feature, process.cwd())\n logger.success(`Agent added : ${result.agent.fullName}`)\n logger.success(`Folder created : agents/agent-${result.agent.number}-${result.agent.slug}/`)\n logger.success('PLAYBOOK.md : regenerated')\n } catch (err) {\n logger.error(err instanceof Error ? err.message : String(err))\n process.exit(1)\n }\n } else {\n addCmd.help()\n }\n })\n\n addCmd\n .command('agent')\n .description('Add a new agent to AGENT_WORKFLOW.md (interactive)')\n .action(async () => {\n const cwd = process.cwd()\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n\n let existing = ''\n try {\n existing = await readFile(workflowPath, 'utf-8')\n } catch {\n logger.error('AGENT_WORKFLOW.md not found — run agentkit init first')\n process.exit(1)\n }\n\n const agentCount = (existing.match(/^### Agent \\d+/gm) ?? []).length\n const nextNumber = agentCount + 1\n\n const answers = await inquirer.prompt<{\n name: string\n scope: string\n outputs: string\n criterion: string\n }>([\n {\n type: 'input',\n name: 'name',\n message: `Agent name (e.g. \"Agent ${nextNumber} · Feature X\"):`,\n default: `Agent ${nextNumber}`,\n },\n {\n type: 'input',\n name: 'scope',\n message: 'Scope (one sentence):',\n },\n {\n type: 'input',\n name: 'outputs',\n message: 'Deliverables (comma-separated):',\n },\n {\n type: 'input',\n name: 'criterion',\n message: 'Success criterion:',\n },\n ])\n\n const outputLines = answers.outputs\n .split(',')\n .map((o: string) => ` - ${o.trim()}`)\n .join('\\n')\n\n const agentSection = `\n### ${answers.name}\nPérimètre : ${answers.scope}\nProduit :\n${outputLines}\nCritère : ${answers.criterion}\n`\n\n await writeFile(workflowPath, existing + agentSection, 'utf-8')\n logger.success(`Agent \"${answers.name}\" added to AGENT_WORKFLOW.md`)\n })\n}","import type { Command } from 'commander'\nimport { readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { logger } from '../utils/logger.js'\n\nexport function registerStatus(program: Command): void {\n program\n .command('status')\n .description('Affiche l\\'état du workflow agentkit dans le dossier courant')\n .action(async () => {\n const cwd = process.cwd()\n\n const [stack, isGit, claudeMd, workflow] = await Promise.all([\n detectStack(cwd),\n isGitRepo(cwd),\n readFile(join(cwd, 'CLAUDE.md'), 'utf-8').catch(() => null),\n readFile(join(cwd, 'AGENT_WORKFLOW.md'), 'utf-8').catch(() => null),\n ])\n\n process.stdout.write('\\n' + chalk.bold('AgentKit Status') + '\\n')\n process.stdout.write('─'.repeat(40) + '\\n')\n\n process.stdout.write(\n chalk.bold('Git repo : ') +\n (isGit ? chalk.green('✔ oui') : chalk.red('✖ non')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('Stack : ') + chalk.cyan(stack.framework) + ' (' + stack.language + ')\\n',\n )\n\n process.stdout.write(\n chalk.bold('CLAUDE.md : ') +\n (claudeMd !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('AGENT_WORKFLOW.md : ') +\n (workflow !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n if (workflow !== null) {\n const agentMatches = workflow.match(/^### Agent \\d+/gm) ?? []\n process.stdout.write(\n chalk.bold('Agents définis : ') + chalk.cyan(String(agentMatches.length)) + '\\n',\n )\n }\n\n process.stdout.write('─'.repeat(40) + '\\n\\n')\n })\n}\n"],"mappings":";;;AACA,SAAS,eAAe;;;ACAxB,SAAS,aAAAA,YAAW,YAAAC,iBAAgB;AACpC,SAAS,QAAAC,aAAY;AACrB,OAAO,cAAc;AACrB,OAAO,SAAS;;;ACJhB,SAAS,UAAU,cAAc;AACjC,SAAS,YAAY;AASrB,eAAe,WAAW,GAA6B;AACrD,MAAI;AACF,UAAM,OAAO,CAAC;AACd,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,SAAS,GAAoD;AAC1E,MAAI;AACF,UAAM,MAAM,MAAM,SAAS,GAAG,OAAO;AACrC,WAAO,KAAK,MAAM,GAAG;AAAA,EACvB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,SAAS,GAAmC;AACzD,MAAI;AACF,WAAO,MAAM,SAAS,GAAG,OAAO;AAAA,EAClC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,YAAY,aAAyC;AACzE,QAAM,OAAkB;AAAA,IACtB,WAAW;AAAA,IACX,UAAU;AAAA,IACV,eAAe;AAAA,IACf,QAAQ,CAAC;AAAA,EACX;AAEA,QAAM,cAAc,MAAM,SAAS,KAAK,aAAa,cAAc,CAAC;AACpE,QAAM,kBAAkB,MAAM,SAAS,KAAK,aAAa,kBAAkB,CAAC;AAC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MACbA,OAAM,KAAK,iBAAiB,KACzBJ,cAAa,OAAOI,OAAM,MAAM,mBAAW,IAAIA,OAAM,OAAO,2CAAiC,KAC9F;AAAA,IACJ;AAEA,YAAQ,OAAO;AAAA,MACbA,OAAM,KAAK,sBAAsB,KAC9BH,cAAa,OAAOG,OAAM,MAAM,mBAAW,IAAIA,OAAM,OAAO,2CAAiC,KAC9F;AAAA,IACJ;AAEA,QAAIH,cAAa,MAAM;AACrB,YAAM,eAAeA,UAAS,MAAM,kBAAkB,KAAK,CAAC;AAC5D,cAAQ,OAAO;AAAA,QACbG,OAAM,KAAK,wBAAqB,IAAIA,OAAM,KAAK,OAAO,aAAa,MAAM,CAAC,IAAI;AAAA,MAChF;AAAA,IACF;AAEA,YAAQ,OAAO,MAAM,SAAI,OAAO,EAAE,IAAI,MAAM;AAAA,EAC9C,CAAC;AACL;;;AlBlDA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,UAAU,EACf,YAAY,mDAAmD,EAC/D,QAAQ,OAAO;AAElB,aAAa,OAAO;AACpB,YAAY,OAAO;AACnB,eAAe,OAAO;AAEtB,QAAQ,MAAM;","names":["writeFile","readFile","join","access","join","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","join","readFile","program","join","writeFile","readFile","writeFile","join","basename","inquirer","join","readFile","agentBlock","writeFile","basename","program","inquirer","readFile","join","chalk","program","claudeMd","workflow","readFile","join","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/commands/init.ts","../src/detectors/stackDetector.ts","../src/detectors/gitDetector.ts","../src/templates/react.ts","../src/templates/nextjs.ts","../src/templates/tauri.ts","../src/templates/fastapi.ts","../src/templates/express.ts","../src/templates/node.ts","../src/templates/unknown.ts","../src/generators/claudeMdGenerator.ts","../src/generators/workflowGenerator.ts","../src/generators/playbookGenerator.ts","../src/generators/skillsGenerator.ts","../src/utils/agentParser.ts","../src/utils/logger.ts","../src/commands/add.ts","../src/commands/status.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander'\nimport { registerInit } from './commands/init.js'\nimport { registerAdd } from './commands/add.js'\nimport { registerStatus } from './commands/status.js'\n\nconst program = new Command()\n\nprogram\n .name('agentkit')\n .description('Scaffolder des workflows multi-agents Claude Code')\n .version('0.1.0')\n\nregisterInit(program)\nregisterAdd(program)\nregisterStatus(program)\n\nprogram.parse()\n","import type { Command } from 'commander'\nimport { writeFile, readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport inquirer from 'inquirer'\nimport ora from 'ora'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { generateClaudeMd } from '../generators/claudeMdGenerator.js'\nimport { generateWorkflow } from '../generators/workflowGenerator.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport { extractAgentsFromWorkflow } from '../utils/agentParser.js'\nimport { logger } from '../utils/logger.js'\nimport type { StackInfo } from '../detectors/stackDetector.js'\nimport { basename } from 'node:path'\n\nconst FRAMEWORK_LABELS: Record<StackInfo['framework'], string> = {\n react: 'React',\n nextjs: 'Next.js',\n tauri: 'Tauri',\n fastapi: 'FastAPI (Python)',\n express: 'Express',\n node: 'Node.js',\n unknown: 'Unknown (generic)',\n}\n\nconst STACK_CHOICES = [\n { name: 'React + Vite', value: 'react' },\n { name: 'Next.js', value: 'nextjs' },\n { name: 'Tauri v2 (React + Rust)', value: 'tauri' },\n { name: 'FastAPI (Python)', value: 'fastapi' },\n { name: 'Express (Node.js)', value: 'express' },\n { name: 'Node.js (generic)', value: 'node' },\n { name: 'None of the above — generate a generic CLAUDE.md to fill manually', value: 'none' },\n]\n\nexport async function resolveStack(\n detected: StackInfo,\n): Promise<{ stack: StackInfo; stackNotConfigured: boolean }> {\n if (detected.framework !== 'unknown') {\n return { stack: detected, stackNotConfigured: false }\n }\n\n logger.warn('Stack not detected automatically.')\n const { selectedFramework } = await inquirer.prompt<{ selectedFramework: string }>([\n {\n type: 'list',\n name: 'selectedFramework',\n message: 'Stack not detected automatically. Please select your stack:',\n choices: STACK_CHOICES as unknown as string[],\n },\n ])\n\n if (selectedFramework === 'none') {\n return { stack: detected, stackNotConfigured: true }\n }\n\n const framework = selectedFramework as StackInfo['framework']\n const language: StackInfo['language'] = framework === 'fastapi' ? 'python' : 'javascript'\n return {\n stack: { ...detected, framework, language, hasTypeScript: false },\n stackNotConfigured: false,\n }\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await readFile(path)\n return true\n } catch {\n return false\n }\n}\n\nexport function registerInit(program: Command): void {\n program\n .command('init')\n .description('Génère CLAUDE.md et AGENT_WORKFLOW.md dans le dossier courant')\n .option('-f, --force', 'Écrase les fichiers existants sans confirmation')\n .option('--blueprint <path>', 'Fichier blueprint .md à utiliser pour personnaliser les fichiers générés')\n .action(async (options: { force?: boolean; blueprint?: string }) => {\n const cwd = process.cwd()\n\n const spinner = ora('Détection de la stack…').start()\n const [stack, isGit] = await Promise.all([detectStack(cwd), isGitRepo(cwd)])\n spinner.stop()\n\n if (!isGit) {\n logger.warn('Ce dossier n\\'est pas un repo git — lancez git init si nécessaire')\n }\n\n const { stack: resolvedStack, stackNotConfigured } = await resolveStack(stack)\n\n const label = FRAMEWORK_LABELS[resolvedStack.framework]\n logger.info(`Stack : ${label} (${resolvedStack.language})`)\n\n const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([\n {\n type: 'confirm',\n name: 'confirmed',\n message: `Générer les fichiers pour ${label} ?`,\n default: true,\n },\n ])\n\n if (!confirmed) {\n logger.warn('Annulé.')\n return\n }\n\n const claudeMdPath = join(cwd, 'CLAUDE.md')\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n const playbookPath = join(cwd, 'PLAYBOOK.md')\n\n // Resolve project name from package.json or directory name\n let projectName = basename(cwd)\n try {\n const pkg = JSON.parse(await readFile(join(cwd, 'package.json'), 'utf-8')) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* fallback to dirname */ }\n\n if (!options.force) {\n const existing: string[] = []\n if (await fileExists(claudeMdPath)) existing.push('CLAUDE.md')\n if (await fileExists(workflowPath)) existing.push('AGENT_WORKFLOW.md')\n if (await fileExists(playbookPath)) existing.push('PLAYBOOK.md')\n\n if (existing.length > 0) {\n const { overwrite } = await inquirer.prompt<{ overwrite: boolean }>([\n {\n type: 'confirm',\n name: 'overwrite',\n message: `${existing.join(' et ')} existe déjà. Écraser ?`,\n default: false,\n },\n ])\n if (!overwrite) {\n logger.warn('Annulé.')\n return\n }\n }\n }\n\n // Load blueprint if provided\n let blueprintContent: string | undefined\n if (options.blueprint) {\n try {\n blueprintContent = await readFile(options.blueprint, 'utf-8')\n } catch {\n logger.error(`Blueprint introuvable : ${options.blueprint}`)\n process.exit(1)\n }\n }\n\n const genSpinner = ora('Génération des fichiers…').start()\n const claudeMdContent = generateClaudeMd(resolvedStack, blueprintContent, stackNotConfigured)\n const workflowContent = generateWorkflow(resolvedStack, blueprintContent, projectName)\n const agents = extractAgentsFromWorkflow(workflowContent)\n const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent })\n await writeFile(claudeMdPath, claudeMdContent, 'utf-8')\n await writeFile(workflowPath, workflowContent, 'utf-8')\n await writeFile(playbookPath, playbookContent, 'utf-8')\n await generateSkills(agents, cwd)\n genSpinner.succeed('Fichiers générés')\n\n logger.success('CLAUDE.md → créé')\n logger.success('AGENT_WORKFLOW.md → créé')\n logger.success('PLAYBOOK.md → créé')\n logger.success(`agents/ → ${agents.length} dossier(s) créé(s)`)\n })\n}\n","import { readFile, access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport interface StackInfo {\n framework: 'react' | 'nextjs' | 'tauri' | 'fastapi' | 'express' | 'node' | 'unknown'\n language: 'typescript' | 'javascript' | 'python' | 'unknown'\n hasTypeScript: boolean\n extras: string[]\n}\n\nasync function pathExists(p: string): Promise<boolean> {\n try {\n await access(p)\n return true\n } catch {\n return false\n }\n}\n\nasync function readJson(p: string): Promise<Record<string, unknown> | null> {\n try {\n const raw = await readFile(p, 'utf-8')\n return JSON.parse(raw) as Record<string, unknown>\n } catch {\n return null\n }\n}\n\nasync function readText(p: string): Promise<string | null> {\n try {\n return await readFile(p, 'utf-8')\n } catch {\n return null\n }\n}\n\nexport async function detectStack(projectPath: string): Promise<StackInfo> {\n const info: StackInfo = {\n framework: 'unknown',\n language: 'unknown',\n hasTypeScript: false,\n extras: [],\n }\n\n const packageJson = await readJson(join(projectPath, 'package.json'))\n const requirementsTxt = await readText(join(projectPath, 'requirements.txt'))\n const hasTauriDir = await pathExists(join(projectPath, 'src-tauri'))\n const hasTsConfig = await pathExists(join(projectPath, 'tsconfig.json'))\n\n if (packageJson !== null) {\n const deps = (packageJson.dependencies as Record<string, string>) ?? {}\n const devDeps = (packageJson.devDependencies as Record<string, string>) ?? {}\n const allDeps = { ...deps, ...devDeps }\n\n info.hasTypeScript = 'typescript' in allDeps || hasTsConfig\n info.language = info.hasTypeScript ? 'typescript' : 'javascript'\n\n // Order matters: most specific first\n if ('next' in allDeps) {\n info.framework = 'nextjs'\n } else if (hasTauriDir || '@tauri-apps/api' in allDeps || '@tauri-apps/cli' in allDeps) {\n info.framework = 'tauri'\n } else if ('react' in allDeps) {\n info.framework = 'react'\n } else if ('express' in allDeps) {\n info.framework = 'express'\n } else {\n info.framework = 'node'\n }\n\n if ('vitest' in allDeps || 'jest' in allDeps) info.extras.push('testing')\n if ('prisma' in allDeps || '@prisma/client' in allDeps) info.extras.push('prisma')\n if ('tailwindcss' in allDeps) info.extras.push('tailwind')\n }\n\n if (requirementsTxt !== null && info.framework === 'unknown') {\n info.language = 'python'\n if (/\\bfastapi\\b/i.test(requirementsTxt)) {\n info.framework = 'fastapi'\n }\n }\n\n if (hasTauriDir && info.framework === 'unknown') {\n info.framework = 'tauri'\n }\n\n return info\n}\n","import { access } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nexport async function isGitRepo(projectPath: string): Promise<boolean> {\n try {\n await access(join(projectPath, '.git'))\n return true\n } catch {\n return false\n }\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const testLine = stack.extras.includes('testing') ? '- `npm test` — run tests\\n' : ''\n return `# CLAUDE.md — React Project\n\n## Stack\n- Framework : React (${lang})\n- Language : ${lang}\n- Build : Vite\n\n## Commands\n- \\`npm run dev\\` — development server\n- \\`npm run build\\` — production build\n${testLine}\n## Structure\nsrc/\n components/ ← UI components (PascalCase)\n hooks/ ← custom hooks (prefix: use*)\n pages/ ← page-level components\n utils/ ← shared helpers\n\n## Conventions\n1. Components in PascalCase\n2. Hooks prefixed with \\`use\\`\n3. Props interfaces named \\`*Props\\`\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — React Project\n\n## Stack détectée\nFramework: React | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Components\nPérimètre : composants UI réutilisables\nProduit : src/components/\nCritère : composants documentés et testés\n\n### Agent 2 · State & Hooks\nPérimètre : state management, hooks personnalisés\nProduit : src/hooks/\nCritère : hooks testés unitairement\n\n### Agent 3 · Pages & Routing\nPérimètre : assemblage des pages, react-router\nProduit : src/pages/\nCritère : navigation fonctionnelle\n\n### Agent 4 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const hasTailwind = stack.extras.includes('tailwind')\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Next.js Project\n\n## Stack\n- Framework : Next.js (TypeScript)\n- Rendering : App Router (RSC + Client Components)\n- Styling : ${hasTailwind ? 'Tailwind CSS' : 'CSS Modules'}\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (http://localhost:3000)\n- \\`npm run build\\` — production build\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n app/ ← App Router pages and layouts\n components/ ← shared UI components\n lib/ ← server utilities, db clients\n utils/ ← shared helpers\n\n## Conventions\n1. Server Components by default, \\`'use client'\\` only when needed\n2. API routes in \\`src/app/api/\\`\n3. Environment variables via \\`src/env.ts\\` (validated)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const hasPrisma = stack.extras.includes('prisma')\n return `# Agent Workflow — Next.js Project\n\n## Stack détectée\nFramework: Next.js | Language: TypeScript\n\n## Agents\n\n### Agent 1 · Data Layer\nPérimètre : schéma${hasPrisma ? ' Prisma' : ''}, types, server actions\nProduit : src/lib/, ${hasPrisma ? 'prisma/schema.prisma' : 'src/types/'}\nCritère : types compilent, migrations propres\n\n### Agent 2 · UI Components\nPérimètre : composants réutilisables (Server + Client)\nProduit : src/components/\nCritère : composants rendus sans erreur\n\n### Agent 3 · Pages & Layout\nPérimètre : App Router, layouts, pages\nProduit : src/app/\nCritère : navigation fonctionnelle, build passe\n\n### Agent 4 · API & Tests\nPérimètre : API routes, tests e2e/unitaires\nProduit : src/app/api/, tests/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Tauri Project\n\n## Stack\n- Framework : Tauri (Rust + ${lang} frontend)\n- Language : Rust (backend) + ${lang} (frontend)\n- Build : Cargo + Vite\n\n## Commands\n- \\`npm run tauri dev\\` — development (hot reload)\n- \\`npm run tauri build\\` — production bundle\n- \\`npm run build\\` — frontend only\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/ ← frontend (${lang})\n components/\n utils/\nsrc-tauri/ ← Rust backend\n src/\n main.rs ← Tauri entry point\n commands.rs ← Tauri commands (IPC)\n tauri.conf.json\n\n## Conventions\n1. IPC commands defined in \\`src-tauri/src/commands.rs\\`\n2. Frontend invokes via \\`@tauri-apps/api/tauri\\`\n3. No direct filesystem access from frontend\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Tauri Project\n\n## Stack détectée\nFramework: Tauri | Language: Rust + ${lang}\n\n## Agents\n\n### Agent 1 · Rust Commands\nPérimètre : commandes Tauri (IPC), permissions\nProduit : src-tauri/src/commands.rs, tauri.conf.json\nCritère : \\`cargo build\\` passe\n\n### Agent 2 · Frontend UI\nPérimètre : interface ${lang}, intégration IPC\nProduit : src/components/, src/utils/\nCritère : appels IPC fonctionnels\n\n### Agent 3 · Build & Packaging\nPérimètre : configuration build, icônes, installeurs\nProduit : src-tauri/tauri.conf.json, icons/\nCritère : \\`npm run tauri build\\` produit un bundle\n\n### Agent 4 · Tests\nPérimètre : tests Rust + tests frontend\nProduit : src-tauri/tests/, tests/\nCritère : \\`cargo test\\` + \\`npm test\\` passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md — FastAPI Project\n\n## Stack\n- Framework : FastAPI (Python)\n- Language : Python 3.11+\n- Server : Uvicorn\n- Validation: Pydantic v2\n\n## Commands\n- \\`uvicorn main:app --reload\\` — development server (http://localhost:8000)\n- \\`pytest\\` — run tests\n- \\`pip install -r requirements.txt\\` — install dependencies\n\n## Structure\napp/\n main.py ← FastAPI app entry point\n routers/ ← API route groups\n models/ ← Pydantic models\n services/ ← business logic\n dependencies/ ← FastAPI dependencies (DI)\ntests/ ← pytest tests\n\n## Conventions\n1. Routers grouped by domain in \\`app/routers/\\`\n2. Pydantic models for all request/response bodies\n3. Business logic in \\`app/services/\\`, not in routes\n4. Async endpoints by default (\\`async def\\`)\n5. Environment variables via \\`python-dotenv\\` + \\`pydantic-settings\\`\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow — FastAPI Project\n\n## Stack détectée\nFramework: FastAPI | Language: Python\n\n## Agents\n\n### Agent 1 · Models & Schemas\nPérimètre : modèles Pydantic, schémas DB (SQLAlchemy/SQLModel)\nProduit : app/models/\nCritère : modèles validés, migrations propres\n\n### Agent 2 · Services\nPérimètre : logique métier, accès base de données\nProduit : app/services/\nCritère : services testés unitairement (pytest)\n\n### Agent 3 · Routers & API\nPérimètre : routes FastAPI, dépendances, auth\nProduit : app/routers/, app/dependencies/\nCritère : endpoints documentés (OpenAPI), tests d'intégration\n\n### Agent 4 · Tests & CI\nPérimètre : couverture pytest, configuration CI\nProduit : tests/, .github/workflows/\nCritère : \\`pytest\\` passe à 100%\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n const hasPrisma = stack.extras.includes('prisma')\n return `# CLAUDE.md — Express Project\n\n## Stack\n- Framework : Express (${lang})\n- Language : ${lang}\n- Runtime : Node.js 20+\n${hasPrisma ? '- Database : Prisma ORM\\n' : ''}\n## Commands\n- \\`npm run dev\\` — development server (nodemon)\n- \\`npm run build\\` — compile TypeScript\n- \\`npm start\\` — production server\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n routes/ ← Express routers (one per domain)\n controllers/ ← request handlers\n services/ ← business logic\n middleware/ ← Express middleware\n utils/ ← shared helpers\n\n## Conventions\n1. Routes grouped by domain in \\`src/routes/\\`\n2. Business logic in \\`src/services/\\`, not in controllers\n3. Middleware for cross-cutting concerns (auth, validation)\n4. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Express Project\n\n## Stack détectée\nFramework: Express | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Data & Models\nPérimètre : modèles de données, accès DB\nProduit : src/models/, src/services/db.ts\nCritère : connexion DB fonctionnelle\n\n### Agent 2 · Services\nPérimètre : logique métier\nProduit : src/services/\nCritère : services testés unitairement\n\n### Agent 3 · Routes & Controllers\nPérimètre : routes Express, validation, auth\nProduit : src/routes/, src/controllers/, src/middleware/\nCritère : endpoints répondent correctement\n\n### Agent 4 · Tests & CI\nPérimètre : tests d'intégration, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# CLAUDE.md — Node.js Project\n\n## Stack\n- Runtime : Node.js 20+\n- Language : ${lang}\n\n## Commands\n- \\`npm run dev\\` — development (with watch)\n- \\`npm run build\\` — compile${stack.hasTypeScript ? ' TypeScript' : ''}\n- \\`npm start\\` — run production build\n- \\`npm test\\` — run tests\n\n## Structure\nsrc/\n index.ts ← entry point\n lib/ ← core library code\n utils/ ← shared helpers\n\n## Conventions\n1. Modules follow single-responsibility principle\n2. Async/await over callbacks\n3. Tout output console passe par un logger centralisé\n`\n}\n\nexport function workflow(stack: StackInfo): string {\n const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'\n return `# Agent Workflow — Node.js Project\n\n## Stack détectée\nRuntime: Node.js | Language: ${lang}\n\n## Agents\n\n### Agent 1 · Core Library\nPérimètre : logique principale\nProduit : src/lib/\nCritère : module fonctionne et testé\n\n### Agent 2 · CLI / API\nPérimètre : interface utilisateur (CLI ou API)\nProduit : src/index.ts, src/cli.ts\nCritère : commandes fonctionnelles\n\n### Agent 3 · Tests & CI\nPérimètre : couverture de tests, configuration CI\nProduit : tests/, .github/workflows/\nCritère : npm test passe\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\n\nexport function claudeMd(_stack: StackInfo): string {\n return `# CLAUDE.md\n\n## Stack\nStack non détectée automatiquement — à remplir manuellement.\n\n## Commands\n- À définir selon le projet\n\n## Structure\nsrc/ ← code source\ntests/ ← tests\n\n## Conventions\n1. Tout output console passe par un logger centralisé\n2. À compléter selon les conventions du projet\n`\n}\n\nexport function workflow(_stack: StackInfo): string {\n return `# Agent Workflow\n\n## Stack détectée\nStack inconnue — workflow générique.\n\n## Agents\n\n### Agent 1 · Setup\nPérimètre : configuration initiale du projet\nProduit : structure de base\nCritère : projet compilable\n\n### Agent 2 · Core\nPérimètre : logique principale\nProduit : src/\nCritère : fonctionnalités principales opérationnelles\n\n### Agent 3 · Tests\nPérimètre : couverture de tests\nProduit : tests/\nCritère : tests passent\n`\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nconst STACK_NOT_CONFIGURED_WARNING = `\n## ⚠️ Stack not configured\nAgentKit could not detect your stack and no stack was selected.\nBefore running Claude Code, fill in the following sections:\n- Stack (framework, runtime, DB, tools)\n- Commands (dev, build, test)\n- Structure (folder layout)\n\nOnce filled, give Claude Code this instruction:\n\"Read PLAYBOOK.md and execute the procedure.\"\n`\n\nexport function generateClaudeMd(stack: StackInfo, blueprintContent?: string, stackNotConfigured?: boolean): string {\n let base: string\n switch (stack.framework) {\n case 'react': base = react.claudeMd(stack); break\n case 'nextjs': base = nextjs.claudeMd(stack); break\n case 'tauri': base = tauri.claudeMd(stack); break\n case 'fastapi': base = fastapi.claudeMd(stack); break\n case 'express': base = express.claudeMd(stack); break\n case 'node': base = node.claudeMd(stack); break\n default: base = unknown.claudeMd(stack)\n }\n\n if (stackNotConfigured) {\n const firstNewline = base.indexOf('\\n')\n base = base.slice(0, firstNewline + 1) + STACK_NOT_CONFIGURED_WARNING + base.slice(firstNewline + 1)\n }\n\n if (!blueprintContent) return base\n\n const blueprintNote = '\\n> A PROJECT_BLUEPRINT.md is present — Claude Code will read it during Phase 0.\\n'\n\n const conventionsIdx = base.indexOf('\\n## Conventions')\n if (conventionsIdx !== -1) {\n return base.slice(0, conventionsIdx) + blueprintNote + base.slice(conventionsIdx)\n }\n return base + blueprintNote\n}\n","import type { StackInfo } from '../detectors/stackDetector.js'\nimport * as react from '../templates/react.js'\nimport * as nextjs from '../templates/nextjs.js'\nimport * as tauri from '../templates/tauri.js'\nimport * as fastapi from '../templates/fastapi.js'\nimport * as express from '../templates/express.js'\nimport * as node from '../templates/node.js'\nimport * as unknown from '../templates/unknown.js'\n\nexport function generateWorkflow(stack: StackInfo, blueprintContent?: string, projectName?: string): string {\n if (blueprintContent) return blueprintPlaceholder(projectName ?? stack.framework)\n\n switch (stack.framework) {\n case 'react': return react.workflow(stack)\n case 'nextjs': return nextjs.workflow(stack)\n case 'tauri': return tauri.workflow(stack)\n case 'fastapi': return fastapi.workflow(stack)\n case 'express': return express.workflow(stack)\n case 'node': return node.workflow(stack)\n default: return unknown.workflow(stack)\n }\n}\n\nfunction blueprintPlaceholder(projectName: string): string {\n return `# AGENT_WORKFLOW.md — ${projectName}\n\n> This file will be filled in by Claude Code during Phase 0.\n> Claude Code will read PROJECT_BLUEPRINT.md, propose a decomposition,\n> and replace this content after human validation.\n\n---\n\n*Waiting for Phase 0 decomposition...*\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport interface PlaybookInput {\n agents: Agent[]\n projectName: string\n hasBlueprint: boolean\n}\n\nexport function generatePlaybook({ agents, projectName, hasBlueprint }: PlaybookInput): string {\n const agentBlocks = agents.map((a) => agentBlock(a)).join('\\n---\\n\\n')\n\n const phase0 = hasBlueprint\n ? `## Phase 0 — Agent Decomposition (run this first)\n\n> A \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Claude Code reads it and decomposes the project into specialized agents\n> before writing a single line of code.\n\n**Read these files in order:**\n1. \\`CLAUDE.md\\`\n2. \\`PROJECT_BLUEPRINT.md\\`\n\n**Then decompose the project into agents** following these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n : `## Phase 0 — Project Discovery (run this first)\n\n> No \\`PROJECT_BLUEPRINT.md\\` was provided.\n> Before writing any code, Claude Code asks the user what they want to build,\n> then decomposes the project into agents — exactly as if a blueprint had been provided.\n\n**Ask the user these questions and wait for their answers:**\n\n1. What is this project? (one sentence describing the goal)\n2. What are the main features you want to build? (list them)\n3. Are there any tech constraints or architecture preferences?\n (e.g. offline-only, specific DB, no auth, specific framework)\n\n**Once you have the answers, decompose the project into agents**\nfollowing these rules:\n\n- One agent = one coherent technical layer (never mix two layers)\n- Each agent must have a runnable success criterion (\\`npm test\\`, \\`cargo build\\`…)\n- Agents must be ordered by dependency (no feature without infra first)\n- Maximum 6 agents — if you have more, group related ones\n- Always respect this order:\n 1. Infra & Configuration\n 2. Data layer (DB schema, models, services)\n 3. External integrations (auth, APIs, local services like Ollama)\n 4. UI & pages\n 5. Advanced features (RAG, export, realtime…)\n 6. Build & release (CI/CD, packaging, installers)\n\n**Write the result directly into \\`AGENT_WORKFLOW.md\\`** — replace its current\ncontent with your decomposition.\n\n**Then ask for human validation:**\n> \"I have decomposed the project into N agents: [list them].\n> Should I proceed with execution?\"\n\nWait for confirmation before moving to Phase 1.\n\n---\n\n`\n\n return `# PLAYBOOK.md — ${projectName}\n\n> **One instruction to give Claude Code:**\n> \"Read PLAYBOOK.md and execute the procedure.\"\n>\n> Claude Code handles the rest autonomously — project discovery or blueprint reading,\n> agent decomposition, execution, success validation, retries, and human escalation.\n> No API key required. No additional cost beyond your LLM subscription.\n\n---\n\n## Global Execution Rules\n\nBefore each agent:\n1. Read \\`CLAUDE.md\\`\n2. Read \\`agents/agent-{N}-{slug}/skills.md\\` (current agent's file)\n3. Read the agent's section in \\`AGENT_WORKFLOW.md\\`\n\nAfter each agent:\n- Run the success criterion command\n- ✅ Passes → announce \"✅ Agent N complete\" and move to the next\n- ❌ Fails → analyze the root cause, fix, rerun (max 3 attempts)\n- After 3 consecutive failures → stop and ask for human validation\n\n**Never move to the next agent without a passing success criterion.**\n**Stay strictly within your current agent's defined scope.**\n\n---\n\n${phase0}## Phase 1 — Execution\n\n${agentBlocks}\n\n---\n\n## Future Iterations\n\nWhen a new agent is added via \\`agentkit add --feature <description>\\`:\n1. A new agent block is appended to \\`AGENT_WORKFLOW.md\\`\n2. The folder \\`agents/agent-{N}-{slug}/\\` is created with \\`skills.md\\`\n3. This \\`PLAYBOOK.md\\` is regenerated to include the new agent\n4. Execution resumes at the new agent only — completed agents are not rerun\n\nWhen you receive the instruction to continue after an iteration:\n> \"Read PLAYBOOK.md and execute only the agents that haven't been completed yet.\"\n\n---\n\n## Human Validation Required\n\nStop and wait for confirmation in these situations:\n- **3 consecutive failures** on the same success criterion\n- **Missing external dependency**: API key, env variable, unavailable service\n- **Conflict** between the detected stack and the user's stated constraints\n- **Destructive operation**: overwriting files not listed in deliverables\n- **End of Phase 0**: agent decomposition must be validated before execution\n`\n}\n\nfunction agentBlock(agent: Agent): string {\n const skillsPath = `agents/agent-${agent.number}-${agent.slug}/skills.md`\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (see skills.md for details)'\n\n return `### Agent ${agent.number} · ${agent.name}\n\n**Scope**: ${agent.scope}\n\n**Skills**: \\`${skillsPath}\\`\n\n**Deliverables**:\n${outputLines}\n\n**Success criterion**:\n\\`\\`\\`bash\n${agent.criterion || 'npm run build && npm test'}\n\\`\\`\\`\n\n**On failure**:\n1. Read the full error output\n2. Fix the root cause — not the symptoms\n3. Rerun the success criterion (max 3 attempts)\n4. After 3 failures → ask for human validation\n`\n}","import { mkdir, writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport type { Agent } from '../types/agent.js'\n\nexport async function generateSkills(agents: Agent[], outputDir: string): Promise<void> {\n for (const agent of agents) {\n const agentDir = join(outputDir, 'agents', `agent-${agent.number}-${agent.slug}`)\n await mkdir(agentDir, { recursive: true })\n await writeFile(join(agentDir, 'skills.md'), skillsMd(agent), 'utf-8')\n await writeFile(join(agentDir, 'context.md'), contextMd(agent), 'utf-8')\n }\n}\n\nfunction skillsMd(agent: Agent): string {\n return `# Skills — ${agent.fullName}\n\n> Ce fichier est lu par l'agent avant de commencer.\n\n## Contexte technique\n\n<!-- À remplir : bibliothèques, versions, décisions d'architecture spécifiques à cet agent -->\n\n## Documentation de référence\n\n<!-- À remplir : liens vers docs, exemples, ADRs pertinents -->\n\n## Conventions spécifiques\n\n<!-- À remplir : règles propres à cet agent (naming, patterns, structure de fichiers) -->\n`\n}\n\nfunction contextMd(agent: Agent): string {\n const outputLines =\n agent.outputs.length > 0\n ? agent.outputs.map((o) => `- ${o}`).join('\\n')\n : '- (voir AGENT_WORKFLOW.md)'\n\n return `# Context — ${agent.fullName}\n\n> Ce fichier fournit le contexte additionnel à l'agent avant exécution.\n> À compléter avant de lancer cet agent.\n\n## Périmètre\n\n${agent.scope}\n\n## Fichiers produits attendus\n\n${outputLines}\n\n## Critère de succès\n\n\\`${agent.criterion || 'npm run build && npm test'}\\`\n`\n}\n","import type { Agent } from '../types/agent.js'\n\nexport function toSlug(name: string): string {\n return name\n .toLowerCase()\n .replace(/[·•&]/g, ' ')\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n}\n\nfunction getFieldValue(lines: string[], pattern: RegExp): string {\n for (const line of lines) {\n const m = line.match(pattern)\n if (m) return (m[1] ?? '').trim()\n }\n return ''\n}\n\nexport function extractAgentsFromWorkflow(content: string): Agent[] {\n const agents: Agent[] = []\n\n // Split into blocks starting with \"### Agent N\"\n const blocks = content\n .split(/(?=^### Agent \\d)/m)\n .filter((b) => /^### Agent \\d/.test(b.trimStart()))\n\n for (const block of blocks) {\n const lines = block.split('\\n')\n\n const headerMatch = lines[0].match(/^### Agent (\\d+)\\s*[·•]\\s*(.+)$/)\n if (!headerMatch) continue\n\n const number = parseInt(headerMatch[1], 10)\n const name = headerMatch[2].trim()\n const fullName = `Agent ${number} · ${name}`\n const slug = toSlug(name)\n\n const scope = getFieldValue(lines, /Périmètre\\s*:\\s*(.+)/)\n const criterion = getFieldValue(lines, /Critère[s]?\\s*:\\s*(.+)/)\n\n // Outputs: may be inline or multi-line (indented \"- item\")\n const outputs: string[] = []\n const produitIdx = lines.findIndex((l) => /Produit\\s*:/.test(l))\n if (produitIdx !== -1) {\n const inlineVal = (lines[produitIdx].match(/Produit\\s*:\\s*(.+)/)?.[1] ?? '').trim()\n if (inlineVal) {\n outputs.push(inlineVal)\n } else {\n for (let i = produitIdx + 1; i < lines.length; i++) {\n const line = lines[i]\n if (/^\\s+[-]/.test(line)) {\n outputs.push(line.trim().replace(/^-\\s*/, ''))\n } else if (line.trim() !== '' && !/^\\s/.test(line)) {\n break\n }\n }\n }\n }\n\n agents.push({ number, name, fullName, slug, scope, outputs, criterion })\n }\n\n return agents\n}\n","import chalk from 'chalk'\n\nexport const logger = {\n info: (message: string): void => {\n process.stdout.write(chalk.blue('ℹ') + ' ' + message + '\\n')\n },\n success: (message: string): void => {\n process.stdout.write(chalk.green('✔') + ' ' + message + '\\n')\n },\n warn: (message: string): void => {\n process.stdout.write(chalk.yellow('⚠') + ' ' + message + '\\n')\n },\n error: (message: string): void => {\n process.stderr.write(chalk.red('✖') + ' ' + message + '\\n')\n },\n}\n","import type { Command } from 'commander'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport { join, basename } from 'node:path'\nimport inquirer from 'inquirer'\nimport { logger } from '../utils/logger.js'\nimport { extractAgentsFromWorkflow, toSlug } from '../utils/agentParser.js'\nimport { generatePlaybook } from '../generators/playbookGenerator.js'\nimport { generateSkills } from '../generators/skillsGenerator.js'\nimport type { Agent } from '../types/agent.js'\n\nfunction featureToAgentName(description: string): string {\n const clean = description\n .replace(/^(add|implement|create|build|integrate|setup|configure|refactor|improve)\\s+/i, '')\n .trim()\n return clean.replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport interface AddFeatureResult {\n agent: Agent\n agentDirPath: string\n}\n\nexport async function addFeatureToProject(\n description: string,\n projectDir: string,\n): Promise<AddFeatureResult> {\n const workflowPath = join(projectDir, 'AGENT_WORKFLOW.md')\n const playbookPath = join(projectDir, 'PLAYBOOK.md')\n\n let workflowContent = ''\n try {\n workflowContent = await readFile(workflowPath, 'utf-8')\n } catch {\n throw new Error(`AGENT_WORKFLOW.md not found in ${projectDir} — run agentkit init first`)\n }\n\n const existingAgents = extractAgentsFromWorkflow(workflowContent)\n const nextNumber = existingAgents.length + 1\n const name = featureToAgentName(description)\n const slug = toSlug(name)\n const fullName = `Agent ${nextNumber} · ${name}`\n\n const newAgent: Agent = {\n number: nextNumber,\n name,\n fullName,\n slug,\n scope: description,\n outputs: [`agents/agent-${nextNumber}-${slug}/`],\n criterion: 'npm run build && npm test',\n }\n\n const agentBlock = `\n### ${fullName}\nPérimètre : ${description}\nProduit :\n - agents/agent-${nextNumber}-${slug}/\nCritère : npm run build && npm test\n`\n\n await writeFile(workflowPath, workflowContent + agentBlock, 'utf-8')\n await generateSkills([newAgent], projectDir)\n\n let projectName = basename(projectDir)\n try {\n const pkg = JSON.parse(\n await readFile(join(projectDir, 'package.json'), 'utf-8'),\n ) as { name?: string }\n if (pkg.name) projectName = pkg.name\n } catch { /* use dirname fallback */ }\n\n const allAgents = [...existingAgents, newAgent]\n\n // When adding a feature iteration, hasBlueprint is false —\n // Phase 0 decomposition only runs during the initial init with --blueprint.\n const playbookContent = generatePlaybook({\n agents: allAgents,\n projectName,\n hasBlueprint: false,\n })\n await writeFile(playbookPath, playbookContent, 'utf-8')\n\n return {\n agent: newAgent,\n agentDirPath: join(projectDir, 'agents', `agent-${nextNumber}-${slug}`),\n }\n}\n\nexport function registerAdd(program: Command): void {\n const addCmd = program\n .command('add')\n .description('Add resources to the agentkit project')\n .option('--feature <description>', 'Add an agent from a feature description and regenerate PLAYBOOK.md')\n .action(async (options: { feature?: string }) => {\n if (options.feature) {\n try {\n const result = await addFeatureToProject(options.feature, process.cwd())\n logger.success(`Agent added : ${result.agent.fullName}`)\n logger.success(`Folder created : agents/agent-${result.agent.number}-${result.agent.slug}/`)\n logger.success('PLAYBOOK.md : regenerated')\n } catch (err) {\n logger.error(err instanceof Error ? err.message : String(err))\n process.exit(1)\n }\n } else {\n addCmd.help()\n }\n })\n\n addCmd\n .command('agent')\n .description('Add a new agent to AGENT_WORKFLOW.md (interactive)')\n .action(async () => {\n const cwd = process.cwd()\n const workflowPath = join(cwd, 'AGENT_WORKFLOW.md')\n\n let existing = ''\n try {\n existing = await readFile(workflowPath, 'utf-8')\n } catch {\n logger.error('AGENT_WORKFLOW.md not found — run agentkit init first')\n process.exit(1)\n }\n\n const agentCount = (existing.match(/^### Agent \\d+/gm) ?? []).length\n const nextNumber = agentCount + 1\n\n const answers = await inquirer.prompt<{\n name: string\n scope: string\n outputs: string\n criterion: string\n }>([\n {\n type: 'input',\n name: 'name',\n message: `Agent name (e.g. \"Agent ${nextNumber} · Feature X\"):`,\n default: `Agent ${nextNumber}`,\n },\n {\n type: 'input',\n name: 'scope',\n message: 'Scope (one sentence):',\n },\n {\n type: 'input',\n name: 'outputs',\n message: 'Deliverables (comma-separated):',\n },\n {\n type: 'input',\n name: 'criterion',\n message: 'Success criterion:',\n },\n ])\n\n const outputLines = answers.outputs\n .split(',')\n .map((o: string) => ` - ${o.trim()}`)\n .join('\\n')\n\n const agentSection = `\n### ${answers.name}\nPérimètre : ${answers.scope}\nProduit :\n${outputLines}\nCritère : ${answers.criterion}\n`\n\n await writeFile(workflowPath, existing + agentSection, 'utf-8')\n logger.success(`Agent \"${answers.name}\" added to AGENT_WORKFLOW.md`)\n })\n}","import type { Command } from 'commander'\nimport { readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { detectStack } from '../detectors/stackDetector.js'\nimport { isGitRepo } from '../detectors/gitDetector.js'\nimport { logger } from '../utils/logger.js'\n\nexport function registerStatus(program: Command): void {\n program\n .command('status')\n .description('Affiche l\\'état du workflow agentkit dans le dossier courant')\n .action(async () => {\n const cwd = process.cwd()\n\n const [stack, isGit, claudeMd, workflow] = await Promise.all([\n detectStack(cwd),\n isGitRepo(cwd),\n readFile(join(cwd, 'CLAUDE.md'), 'utf-8').catch(() => null),\n readFile(join(cwd, 'AGENT_WORKFLOW.md'), 'utf-8').catch(() => null),\n ])\n\n process.stdout.write('\\n' + chalk.bold('AgentKit Status') + '\\n')\n process.stdout.write('─'.repeat(40) + '\\n')\n\n process.stdout.write(\n chalk.bold('Git repo : ') +\n (isGit ? chalk.green('✔ oui') : chalk.red('✖ non')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('Stack : ') + chalk.cyan(stack.framework) + ' (' + stack.language + ')\\n',\n )\n\n process.stdout.write(\n chalk.bold('CLAUDE.md : ') +\n (claudeMd !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n process.stdout.write(\n chalk.bold('AGENT_WORKFLOW.md : ') +\n (workflow !== null ? chalk.green('✔ présent') : chalk.yellow('✖ absent — lancez agentkit init')) +\n '\\n',\n )\n\n if (workflow !== null) {\n const agentMatches = workflow.match(/^### Agent \\d+/gm) ?? []\n process.stdout.write(\n chalk.bold('Agents définis : ') + chalk.cyan(String(agentMatches.length)) + '\\n',\n )\n }\n\n process.stdout.write('─'.repeat(40) + '\\n\\n')\n })\n}\n"],"mappings":";;;AACA,SAAS,eAAe;;;ACAxB,SAAS,aAAAA,YAAW,YAAAC,iBAAgB;AACpC,SAAS,QAAAC,aAAY;AACrB,OAAO,cAAc;AACrB,OAAO,SAAS;;;ACJhB,SAAS,UAAU,cAAc;AACjC,SAAS,YAAY;AASrB,eAAe,WAAW,GAA6B;AACrD,MAAI;AACF,UAAM,OAAO,CAAC;AACd,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,SAAS,GAAoD;AAC1E,MAAI;AACF,UAAM,MAAM,MAAM,SAAS,GAAG,OAAO;AACrC,WAAO,KAAK,MAAM,GAAG;AAAA,EACvB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,SAAS,GAAmC;AACzD,MAAI;AACF,WAAO,MAAM,SAAS,GAAG,OAAO;AAAA,EAClC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,YAAY,aAAyC;AACzE,QAAM,OAAkB;AAAA,IACtB,WAAW;AAAA,IACX,UAAU;AAAA,IACV,eAAe;AAAA,IACf,QAAQ,CAAC;AAAA,EACX;AAEA,QAAM,cAAc,MAAM,SAAS,KAAK,aAAa,cAAc,CAAC;AACpE,QAAM,kBAAkB,MAAM,SAAS,KAAK,aAAa,kBAAkB,CAAC;AAC5E,QAAM,cAAc,MAAM,WAAW,KAAK,aAAa,WAAW,CAAC;AACnE,QAAM,cAAc,MAAM,WAAW,KAAK,aAAa,eAAe,CAAC;AAEvE,MAAI,gBAAgB,MAAM;AACxB,UAAM,OAAQ,YAAY,gBAA2C,CAAC;AACtE,UAAM,UAAW,YAAY,mBAA8C,CAAC;AAC5E,UAAM,UAAU,EAAE,GAAG,MAAM,GAAG,QAAQ;AAEtC,SAAK,gBAAgB,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kB,KAAK,CAAC;AAC5D,cAAQ,OAAO;AAAA,QACbG,OAAM,KAAK,wBAAqB,IAAIA,OAAM,KAAK,OAAO,aAAa,MAAM,CAAC,IAAI;AAAA,MAChF;AAAA,IACF;AAEA,YAAQ,OAAO,MAAM,SAAI,OAAO,EAAE,IAAI,MAAM;AAAA,EAC9C,CAAC;AACL;;;AlBlDA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,UAAU,EACf,YAAY,mDAAmD,EAC/D,QAAQ,OAAO;AAElB,aAAa,OAAO;AACpB,YAAY,OAAO;AACnB,eAAe,OAAO;AAEtB,QAAQ,MAAM;","names":["writeFile","readFile","join","access","join","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","claudeMd","workflow","join","readFile","program","join","writeFile","readFile","writeFile","join","basename","inquirer","join","readFile","agentBlock","writeFile","basename","program","inquirer","readFile","join","chalk","program","claudeMd","workflow","readFile","join","chalk"]}
|
package/package.json
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -24,6 +24,45 @@ const FRAMEWORK_LABELS: Record<StackInfo['framework'], string> = {
|
|
|
24
24
|
unknown: 'Unknown (generic)',
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
const STACK_CHOICES = [
|
|
28
|
+
{ name: 'React + Vite', value: 'react' },
|
|
29
|
+
{ name: 'Next.js', value: 'nextjs' },
|
|
30
|
+
{ name: 'Tauri v2 (React + Rust)', value: 'tauri' },
|
|
31
|
+
{ name: 'FastAPI (Python)', value: 'fastapi' },
|
|
32
|
+
{ name: 'Express (Node.js)', value: 'express' },
|
|
33
|
+
{ name: 'Node.js (generic)', value: 'node' },
|
|
34
|
+
{ name: 'None of the above — generate a generic CLAUDE.md to fill manually', value: 'none' },
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
export async function resolveStack(
|
|
38
|
+
detected: StackInfo,
|
|
39
|
+
): Promise<{ stack: StackInfo; stackNotConfigured: boolean }> {
|
|
40
|
+
if (detected.framework !== 'unknown') {
|
|
41
|
+
return { stack: detected, stackNotConfigured: false }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
logger.warn('Stack not detected automatically.')
|
|
45
|
+
const { selectedFramework } = await inquirer.prompt<{ selectedFramework: string }>([
|
|
46
|
+
{
|
|
47
|
+
type: 'list',
|
|
48
|
+
name: 'selectedFramework',
|
|
49
|
+
message: 'Stack not detected automatically. Please select your stack:',
|
|
50
|
+
choices: STACK_CHOICES as unknown as string[],
|
|
51
|
+
},
|
|
52
|
+
])
|
|
53
|
+
|
|
54
|
+
if (selectedFramework === 'none') {
|
|
55
|
+
return { stack: detected, stackNotConfigured: true }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const framework = selectedFramework as StackInfo['framework']
|
|
59
|
+
const language: StackInfo['language'] = framework === 'fastapi' ? 'python' : 'javascript'
|
|
60
|
+
return {
|
|
61
|
+
stack: { ...detected, framework, language, hasTypeScript: false },
|
|
62
|
+
stackNotConfigured: false,
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
27
66
|
async function fileExists(path: string): Promise<boolean> {
|
|
28
67
|
try {
|
|
29
68
|
await readFile(path)
|
|
@@ -50,8 +89,10 @@ export function registerInit(program: Command): void {
|
|
|
50
89
|
logger.warn('Ce dossier n\'est pas un repo git — lancez git init si nécessaire')
|
|
51
90
|
}
|
|
52
91
|
|
|
53
|
-
const
|
|
54
|
-
|
|
92
|
+
const { stack: resolvedStack, stackNotConfigured } = await resolveStack(stack)
|
|
93
|
+
|
|
94
|
+
const label = FRAMEWORK_LABELS[resolvedStack.framework]
|
|
95
|
+
logger.info(`Stack : ${label} (${resolvedStack.language})`)
|
|
55
96
|
|
|
56
97
|
const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([
|
|
57
98
|
{
|
|
@@ -112,8 +153,8 @@ export function registerInit(program: Command): void {
|
|
|
112
153
|
}
|
|
113
154
|
|
|
114
155
|
const genSpinner = ora('Génération des fichiers…').start()
|
|
115
|
-
const claudeMdContent = generateClaudeMd(
|
|
116
|
-
const workflowContent = generateWorkflow(
|
|
156
|
+
const claudeMdContent = generateClaudeMd(resolvedStack, blueprintContent, stackNotConfigured)
|
|
157
|
+
const workflowContent = generateWorkflow(resolvedStack, blueprintContent, projectName)
|
|
117
158
|
const agents = extractAgentsFromWorkflow(workflowContent)
|
|
118
159
|
const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent })
|
|
119
160
|
await writeFile(claudeMdPath, claudeMdContent, 'utf-8')
|
|
@@ -7,7 +7,19 @@ import * as express from '../templates/express.js'
|
|
|
7
7
|
import * as node from '../templates/node.js'
|
|
8
8
|
import * as unknown from '../templates/unknown.js'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const STACK_NOT_CONFIGURED_WARNING = `
|
|
11
|
+
## ⚠️ Stack not configured
|
|
12
|
+
AgentKit could not detect your stack and no stack was selected.
|
|
13
|
+
Before running Claude Code, fill in the following sections:
|
|
14
|
+
- Stack (framework, runtime, DB, tools)
|
|
15
|
+
- Commands (dev, build, test)
|
|
16
|
+
- Structure (folder layout)
|
|
17
|
+
|
|
18
|
+
Once filled, give Claude Code this instruction:
|
|
19
|
+
"Read PLAYBOOK.md and execute the procedure."
|
|
20
|
+
`
|
|
21
|
+
|
|
22
|
+
export function generateClaudeMd(stack: StackInfo, blueprintContent?: string, stackNotConfigured?: boolean): string {
|
|
11
23
|
let base: string
|
|
12
24
|
switch (stack.framework) {
|
|
13
25
|
case 'react': base = react.claudeMd(stack); break
|
|
@@ -19,6 +31,11 @@ export function generateClaudeMd(stack: StackInfo, blueprintContent?: string): s
|
|
|
19
31
|
default: base = unknown.claudeMd(stack)
|
|
20
32
|
}
|
|
21
33
|
|
|
34
|
+
if (stackNotConfigured) {
|
|
35
|
+
const firstNewline = base.indexOf('\n')
|
|
36
|
+
base = base.slice(0, firstNewline + 1) + STACK_NOT_CONFIGURED_WARNING + base.slice(firstNewline + 1)
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
if (!blueprintContent) return base
|
|
23
40
|
|
|
24
41
|
const blueprintNote = '\n> A PROJECT_BLUEPRINT.md is present — Claude Code will read it during Phase 0.\n'
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
2
|
+
import type { StackInfo } from '../../src/detectors/stackDetector.js'
|
|
3
|
+
|
|
4
|
+
vi.mock('inquirer', () => ({
|
|
5
|
+
default: {
|
|
6
|
+
prompt: vi.fn(),
|
|
7
|
+
},
|
|
8
|
+
}))
|
|
9
|
+
|
|
10
|
+
vi.mock('../../src/utils/logger.js', () => ({
|
|
11
|
+
logger: {
|
|
12
|
+
info: vi.fn(),
|
|
13
|
+
success: vi.fn(),
|
|
14
|
+
warn: vi.fn(),
|
|
15
|
+
error: vi.fn(),
|
|
16
|
+
},
|
|
17
|
+
}))
|
|
18
|
+
|
|
19
|
+
import inquirer from 'inquirer'
|
|
20
|
+
import { resolveStack } from '../../src/commands/init.js'
|
|
21
|
+
import { generateClaudeMd } from '../../src/generators/claudeMdGenerator.js'
|
|
22
|
+
|
|
23
|
+
function makeStack(
|
|
24
|
+
framework: StackInfo['framework'],
|
|
25
|
+
opts: Partial<Omit<StackInfo, 'framework'>> = {},
|
|
26
|
+
): StackInfo {
|
|
27
|
+
return {
|
|
28
|
+
framework,
|
|
29
|
+
language: framework === 'fastapi' ? 'python' : opts.hasTypeScript ? 'typescript' : 'javascript',
|
|
30
|
+
hasTypeScript: opts.hasTypeScript ?? false,
|
|
31
|
+
extras: opts.extras ?? [],
|
|
32
|
+
...opts,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe('resolveStack', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
vi.clearAllMocks()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('returns detected stack unchanged when framework is not unknown — no prompt shown', async () => {
|
|
42
|
+
const detected = makeStack('react', { hasTypeScript: true })
|
|
43
|
+
const result = await resolveStack(detected)
|
|
44
|
+
|
|
45
|
+
expect(result.stack).toEqual(detected)
|
|
46
|
+
expect(result.stackNotConfigured).toBe(false)
|
|
47
|
+
expect(vi.mocked(inquirer.prompt)).not.toHaveBeenCalled()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('does not prompt for any known framework', async () => {
|
|
51
|
+
const frameworks: StackInfo['framework'][] = ['nextjs', 'tauri', 'fastapi', 'express', 'node']
|
|
52
|
+
for (const framework of frameworks) {
|
|
53
|
+
vi.clearAllMocks()
|
|
54
|
+
const result = await resolveStack(makeStack(framework))
|
|
55
|
+
expect(result.stackNotConfigured).toBe(false)
|
|
56
|
+
expect(vi.mocked(inquirer.prompt)).not.toHaveBeenCalled()
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('prompts for stack selection when framework is unknown', async () => {
|
|
61
|
+
vi.mocked(inquirer.prompt).mockResolvedValueOnce({ selectedFramework: 'tauri' })
|
|
62
|
+
|
|
63
|
+
const result = await resolveStack(makeStack('unknown'))
|
|
64
|
+
|
|
65
|
+
expect(vi.mocked(inquirer.prompt)).toHaveBeenCalledOnce()
|
|
66
|
+
expect(result.stack.framework).toBe('tauri')
|
|
67
|
+
expect(result.stack.language).toBe('javascript')
|
|
68
|
+
expect(result.stackNotConfigured).toBe(false)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('unknown + user selects Tauri → stack.framework is tauri', async () => {
|
|
72
|
+
vi.mocked(inquirer.prompt).mockResolvedValueOnce({ selectedFramework: 'tauri' })
|
|
73
|
+
|
|
74
|
+
const result = await resolveStack(makeStack('unknown'))
|
|
75
|
+
|
|
76
|
+
expect(result.stack.framework).toBe('tauri')
|
|
77
|
+
expect(result.stackNotConfigured).toBe(false)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('unknown + user selects FastAPI → language is python', async () => {
|
|
81
|
+
vi.mocked(inquirer.prompt).mockResolvedValueOnce({ selectedFramework: 'fastapi' })
|
|
82
|
+
|
|
83
|
+
const result = await resolveStack(makeStack('unknown'))
|
|
84
|
+
|
|
85
|
+
expect(result.stack.framework).toBe('fastapi')
|
|
86
|
+
expect(result.stack.language).toBe('python')
|
|
87
|
+
expect(result.stackNotConfigured).toBe(false)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it('unknown + user selects "None of the above" → stackNotConfigured is true, framework stays unknown', async () => {
|
|
91
|
+
vi.mocked(inquirer.prompt).mockResolvedValueOnce({ selectedFramework: 'none' })
|
|
92
|
+
|
|
93
|
+
const result = await resolveStack(makeStack('unknown'))
|
|
94
|
+
|
|
95
|
+
expect(result.stack.framework).toBe('unknown')
|
|
96
|
+
expect(result.stackNotConfigured).toBe(true)
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
describe('generateClaudeMd — stackNotConfigured warning', () => {
|
|
101
|
+
it('includes warning block when stackNotConfigured is true', () => {
|
|
102
|
+
const result = generateClaudeMd(makeStack('unknown'), undefined, true)
|
|
103
|
+
expect(result).toContain('⚠️ Stack not configured')
|
|
104
|
+
expect(result).toContain('AgentKit could not detect your stack')
|
|
105
|
+
expect(result).toContain('Stack (framework, runtime, DB, tools)')
|
|
106
|
+
expect(result).toContain('Read PLAYBOOK.md and execute the procedure.')
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('does not include warning block when stackNotConfigured is false', () => {
|
|
110
|
+
const result = generateClaudeMd(makeStack('unknown'), undefined, false)
|
|
111
|
+
expect(result).not.toContain('⚠️ Stack not configured')
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('does not include warning block when stackNotConfigured is omitted', () => {
|
|
115
|
+
const result = generateClaudeMd(makeStack('unknown'))
|
|
116
|
+
expect(result).not.toContain('⚠️ Stack not configured')
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it('unknown + None selected → uses unknown template content', () => {
|
|
120
|
+
const result = generateClaudeMd(makeStack('unknown'), undefined, true)
|
|
121
|
+
expect(result).toContain('## Stack')
|
|
122
|
+
expect(result).toContain('## Commands')
|
|
123
|
+
expect(result).toContain('## Conventions')
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it('unknown + Tauri selected → resolveStack returns tauri, generateClaudeMd uses tauri template', async () => {
|
|
127
|
+
vi.mocked(inquirer.prompt).mockResolvedValueOnce({ selectedFramework: 'tauri' })
|
|
128
|
+
|
|
129
|
+
const { stack, stackNotConfigured } = await resolveStack(makeStack('unknown'))
|
|
130
|
+
const result = generateClaudeMd(stack, undefined, stackNotConfigured)
|
|
131
|
+
|
|
132
|
+
expect(stack.framework).toBe('tauri')
|
|
133
|
+
expect(stackNotConfigured).toBe(false)
|
|
134
|
+
expect(result).toContain('Tauri')
|
|
135
|
+
expect(result).toContain('Rust')
|
|
136
|
+
expect(result).not.toContain('⚠️ Stack not configured')
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('warning block still present alongside blueprint note when both are set', () => {
|
|
140
|
+
const blueprint = '# My App\n\n## Goal\nSomething\n'
|
|
141
|
+
const result = generateClaudeMd(makeStack('unknown'), blueprint, true)
|
|
142
|
+
expect(result).toContain('⚠️ Stack not configured')
|
|
143
|
+
expect(result).toContain('PROJECT_BLUEPRINT.md is present')
|
|
144
|
+
})
|
|
145
|
+
})
|