@patricksardinha/agentkit-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +2 -0
- package/.github/workflows/release.yml +31 -0
- package/AGENT_WORKFLOW.md +55 -0
- package/CLAUDE.md +45 -0
- package/README.md +327 -0
- package/dist/cli.cjs +1079 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1056 -0
- package/dist/cli.js.map +1 -0
- package/package.json +45 -0
- package/src/cli.ts +18 -0
- package/src/commands/add.ts +166 -0
- package/src/commands/init.ts +130 -0
- package/src/commands/status.ts +57 -0
- package/src/detectors/gitDetector.ts +11 -0
- package/src/detectors/stackDetector.ts +88 -0
- package/src/generators/claudeMdGenerator.ts +42 -0
- package/src/generators/playbookGenerator.ts +76 -0
- package/src/generators/skillsGenerator.ts +56 -0
- package/src/generators/workflowGenerator.ts +62 -0
- package/src/templates/express.ts +64 -0
- package/src/templates/fastapi.ts +63 -0
- package/src/templates/nextjs.ts +63 -0
- package/src/templates/node.ts +54 -0
- package/src/templates/react.ts +61 -0
- package/src/templates/tauri.ts +65 -0
- package/src/templates/unknown.ts +45 -0
- package/src/types/agent.ts +9 -0
- package/src/types/inquirer.d.ts +36 -0
- package/src/utils/agentParser.ts +67 -0
- package/src/utils/blueprintParser.ts +28 -0
- package/src/utils/logger.ts +16 -0
- package/tests/commands/add.test.ts +130 -0
- package/tests/detectors/fixtures/express-app/package.json +9 -0
- package/tests/detectors/fixtures/fastapi-app/requirements.txt +3 -0
- package/tests/detectors/fixtures/nextjs-app/package.json +13 -0
- package/tests/detectors/fixtures/no-git/README.md +2 -0
- package/tests/detectors/fixtures/react-app/package.json +10 -0
- package/tests/detectors/fixtures/tauri-app/package.json +10 -0
- package/tests/detectors/fixtures/tauri-app/src-tauri/tauri.conf.json +12 -0
- package/tests/detectors/gitDetector.test.ts +29 -0
- package/tests/detectors/stackDetector.test.ts +50 -0
- package/tests/generators/blueprintSupport.test.ts +130 -0
- package/tests/generators/claudeMdGenerator.test.ts +86 -0
- package/tests/generators/playbookGenerator.test.ts +152 -0
- package/tests/generators/skillsGenerator.test.ts +94 -0
- package/tests/generators/workflowGenerator.test.ts +84 -0
- package/tsconfig.json +19 -0
- package/tsup.config.ts +11 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
import { parseBlueprint } from '../utils/blueprintParser.js'
|
|
3
|
+
import * as react from '../templates/react.js'
|
|
4
|
+
import * as nextjs from '../templates/nextjs.js'
|
|
5
|
+
import * as tauri from '../templates/tauri.js'
|
|
6
|
+
import * as fastapi from '../templates/fastapi.js'
|
|
7
|
+
import * as express from '../templates/express.js'
|
|
8
|
+
import * as node from '../templates/node.js'
|
|
9
|
+
import * as unknown from '../templates/unknown.js'
|
|
10
|
+
|
|
11
|
+
export function generateClaudeMd(stack: StackInfo, blueprintContent?: string): string {
|
|
12
|
+
let base: string
|
|
13
|
+
switch (stack.framework) {
|
|
14
|
+
case 'react': base = react.claudeMd(stack); break
|
|
15
|
+
case 'nextjs': base = nextjs.claudeMd(stack); break
|
|
16
|
+
case 'tauri': base = tauri.claudeMd(stack); break
|
|
17
|
+
case 'fastapi': base = fastapi.claudeMd(stack); break
|
|
18
|
+
case 'express': base = express.claudeMd(stack); break
|
|
19
|
+
case 'node': base = node.claudeMd(stack); break
|
|
20
|
+
default: base = unknown.claudeMd(stack)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!blueprintContent) return base
|
|
24
|
+
|
|
25
|
+
const features = parseBlueprint(blueprintContent)
|
|
26
|
+
if (features.length === 0) return base
|
|
27
|
+
|
|
28
|
+
const featureLines = features
|
|
29
|
+
.map((f, i) => {
|
|
30
|
+
const sub = f.items.length > 0 ? '\n' + f.items.map((it) => ` - ${it}`).join('\n') : ''
|
|
31
|
+
return `${i + 1}. **${f.name}**${sub}`
|
|
32
|
+
})
|
|
33
|
+
.join('\n')
|
|
34
|
+
|
|
35
|
+
const featureSection = `\n## Features (Blueprint)\n\n${featureLines}\n`
|
|
36
|
+
|
|
37
|
+
const conventionsIdx = base.indexOf('\n## Conventions')
|
|
38
|
+
if (conventionsIdx !== -1) {
|
|
39
|
+
return base.slice(0, conventionsIdx) + featureSection + base.slice(conventionsIdx)
|
|
40
|
+
}
|
|
41
|
+
return base + featureSection
|
|
42
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Agent } from '../types/agent.js'
|
|
2
|
+
|
|
3
|
+
export interface PlaybookInput {
|
|
4
|
+
agents: Agent[]
|
|
5
|
+
projectName: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function generatePlaybook({ agents, projectName }: PlaybookInput): string {
|
|
9
|
+
const agentBlocks = agents.map((a) => agentBlock(a)).join('\n---\n\n')
|
|
10
|
+
|
|
11
|
+
return `# PLAYBOOK.md — ${projectName}
|
|
12
|
+
|
|
13
|
+
> Donne cette instruction à Claude Code : 'Lis PLAYBOOK.md et exécute la procédure.'
|
|
14
|
+
|
|
15
|
+
## Règles d'exécution globales
|
|
16
|
+
|
|
17
|
+
Avant chaque agent :
|
|
18
|
+
1. Lire \`CLAUDE.md\`
|
|
19
|
+
2. Lire \`agents/agent-{N}-{slug}/skills.md\` (le fichier de l'agent courant)
|
|
20
|
+
|
|
21
|
+
Après chaque agent :
|
|
22
|
+
- Exécuter le critère de succès
|
|
23
|
+
- Si succès → annoncer "✅ Agent N terminé" et passer au suivant
|
|
24
|
+
- Si échec → analyser la cause racine, corriger, réexécuter (max 3 tentatives)
|
|
25
|
+
- Après 3 échecs consécutifs → pause et demander validation humaine
|
|
26
|
+
- **Ne jamais passer à l'agent suivant sans critère validé**
|
|
27
|
+
|
|
28
|
+
## Agents
|
|
29
|
+
|
|
30
|
+
${agentBlocks}
|
|
31
|
+
|
|
32
|
+
## Itérations futures
|
|
33
|
+
|
|
34
|
+
Lorsqu'un nouvel agent est ajouté via \`agentkit add --feature <description>\` :
|
|
35
|
+
1. Un nouveau bloc agent est ajouté à la fin de \`AGENT_WORKFLOW.md\`
|
|
36
|
+
2. Le dossier \`agents/agent-{N}-{slug}/\` est créé avec \`skills.md\` et \`context.md\`
|
|
37
|
+
3. Ce \`PLAYBOOK.md\` est régénéré automatiquement pour inclure le nouvel agent
|
|
38
|
+
4. L'exécution reprend à ce nouvel agent uniquement — les agents précédents ne sont pas réexécutés
|
|
39
|
+
|
|
40
|
+
## Validation humaine requise
|
|
41
|
+
|
|
42
|
+
Les cas suivants nécessitent une pause et une confirmation humaine avant de continuer :
|
|
43
|
+
- **3 échecs consécutifs** sur le critère de succès d'un agent
|
|
44
|
+
- **Dépendance externe manquante** : clé API, variable d'environnement non définie, service tiers inaccessible
|
|
45
|
+
- **Conflit** entre le blueprint fourni (\`--blueprint\`) et la stack détectée automatiquement
|
|
46
|
+
`
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function agentBlock(agent: Agent): string {
|
|
50
|
+
const skillsPath = `agents/agent-${agent.number}-${agent.slug}/skills.md`
|
|
51
|
+
const outputLines =
|
|
52
|
+
agent.outputs.length > 0
|
|
53
|
+
? agent.outputs.map((o) => `- ${o}`).join('\n')
|
|
54
|
+
: '- (voir skills.md pour le détail)'
|
|
55
|
+
|
|
56
|
+
return `### ${agent.fullName}
|
|
57
|
+
|
|
58
|
+
**Périmètre** : ${agent.scope}
|
|
59
|
+
|
|
60
|
+
**Skills** : \`${skillsPath}\`
|
|
61
|
+
|
|
62
|
+
**Fichiers produits** :
|
|
63
|
+
${outputLines}
|
|
64
|
+
|
|
65
|
+
**Critère de succès** :
|
|
66
|
+
\`\`\`bash
|
|
67
|
+
${agent.criterion || 'npm run build && npm test'}
|
|
68
|
+
\`\`\`
|
|
69
|
+
|
|
70
|
+
**En cas d'échec** :
|
|
71
|
+
1. Analyser le message d'erreur complet
|
|
72
|
+
2. Corriger la cause racine (pas les symptômes)
|
|
73
|
+
3. Réexécuter le critère (max 3 tentatives)
|
|
74
|
+
4. Après 3 échecs → demander validation humaine
|
|
75
|
+
`
|
|
76
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises'
|
|
2
|
+
import { join } from 'node:path'
|
|
3
|
+
import type { Agent } from '../types/agent.js'
|
|
4
|
+
|
|
5
|
+
export async function generateSkills(agents: Agent[], outputDir: string): Promise<void> {
|
|
6
|
+
for (const agent of agents) {
|
|
7
|
+
const agentDir = join(outputDir, 'agents', `agent-${agent.number}-${agent.slug}`)
|
|
8
|
+
await mkdir(agentDir, { recursive: true })
|
|
9
|
+
await writeFile(join(agentDir, 'skills.md'), skillsMd(agent), 'utf-8')
|
|
10
|
+
await writeFile(join(agentDir, 'context.md'), contextMd(agent), 'utf-8')
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function skillsMd(agent: Agent): string {
|
|
15
|
+
return `# Skills — ${agent.fullName}
|
|
16
|
+
|
|
17
|
+
> Ce fichier est lu par l'agent avant de commencer.
|
|
18
|
+
|
|
19
|
+
## Contexte technique
|
|
20
|
+
|
|
21
|
+
<!-- À remplir : bibliothèques, versions, décisions d'architecture spécifiques à cet agent -->
|
|
22
|
+
|
|
23
|
+
## Documentation de référence
|
|
24
|
+
|
|
25
|
+
<!-- À remplir : liens vers docs, exemples, ADRs pertinents -->
|
|
26
|
+
|
|
27
|
+
## Conventions spécifiques
|
|
28
|
+
|
|
29
|
+
<!-- À remplir : règles propres à cet agent (naming, patterns, structure de fichiers) -->
|
|
30
|
+
`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function contextMd(agent: Agent): string {
|
|
34
|
+
const outputLines =
|
|
35
|
+
agent.outputs.length > 0
|
|
36
|
+
? agent.outputs.map((o) => `- ${o}`).join('\n')
|
|
37
|
+
: '- (voir AGENT_WORKFLOW.md)'
|
|
38
|
+
|
|
39
|
+
return `# Context — ${agent.fullName}
|
|
40
|
+
|
|
41
|
+
> Ce fichier fournit le contexte additionnel à l'agent avant exécution.
|
|
42
|
+
> À compléter avant de lancer cet agent.
|
|
43
|
+
|
|
44
|
+
## Périmètre
|
|
45
|
+
|
|
46
|
+
${agent.scope}
|
|
47
|
+
|
|
48
|
+
## Fichiers produits attendus
|
|
49
|
+
|
|
50
|
+
${outputLines}
|
|
51
|
+
|
|
52
|
+
## Critère de succès
|
|
53
|
+
|
|
54
|
+
\`${agent.criterion || 'npm run build && npm test'}\`
|
|
55
|
+
`
|
|
56
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
import { parseBlueprint } from '../utils/blueprintParser.js'
|
|
3
|
+
import { toSlug } from '../utils/agentParser.js'
|
|
4
|
+
import * as react from '../templates/react.js'
|
|
5
|
+
import * as nextjs from '../templates/nextjs.js'
|
|
6
|
+
import * as tauri from '../templates/tauri.js'
|
|
7
|
+
import * as fastapi from '../templates/fastapi.js'
|
|
8
|
+
import * as express from '../templates/express.js'
|
|
9
|
+
import * as node from '../templates/node.js'
|
|
10
|
+
import * as unknown from '../templates/unknown.js'
|
|
11
|
+
|
|
12
|
+
export function generateWorkflow(stack: StackInfo, blueprintContent?: string): string {
|
|
13
|
+
if (blueprintContent) return blueprintWorkflow(stack, blueprintContent)
|
|
14
|
+
|
|
15
|
+
switch (stack.framework) {
|
|
16
|
+
case 'react': return react.workflow(stack)
|
|
17
|
+
case 'nextjs': return nextjs.workflow(stack)
|
|
18
|
+
case 'tauri': return tauri.workflow(stack)
|
|
19
|
+
case 'fastapi': return fastapi.workflow(stack)
|
|
20
|
+
case 'express': return express.workflow(stack)
|
|
21
|
+
case 'node': return node.workflow(stack)
|
|
22
|
+
default: return unknown.workflow(stack)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function blueprintWorkflow(stack: StackInfo, blueprintContent: string): string {
|
|
27
|
+
const features = parseBlueprint(blueprintContent)
|
|
28
|
+
|
|
29
|
+
const agentBlocks = features.map((feature, i) => {
|
|
30
|
+
const n = i + 1
|
|
31
|
+
const slug = toSlug(feature.name)
|
|
32
|
+
const outputLines =
|
|
33
|
+
feature.items.length > 0
|
|
34
|
+
? feature.items.map((item) => ` - ${item}`).join('\n')
|
|
35
|
+
: ` - src/${slug}/`
|
|
36
|
+
return `### Agent ${n} · ${feature.name}
|
|
37
|
+
Périmètre : Implémenter la fonctionnalité ${feature.name.toLowerCase()}
|
|
38
|
+
Produit :
|
|
39
|
+
${outputLines}
|
|
40
|
+
Critère : npm test (tests ${feature.name.toLowerCase()} passent)`
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const ciN = features.length + 1
|
|
44
|
+
agentBlocks.push(
|
|
45
|
+
`### Agent ${ciN} · Tests & CI
|
|
46
|
+
Périmètre : Couverture de tests complète et configuration du pipeline CI
|
|
47
|
+
Produit :
|
|
48
|
+
- tests/
|
|
49
|
+
- .github/workflows/
|
|
50
|
+
Critère : npm test passe, pipeline CI vert`,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return `# Agent Workflow — ${stack.framework} (Blueprint)
|
|
54
|
+
|
|
55
|
+
## Stack détectée
|
|
56
|
+
Framework: ${stack.framework} | Language: ${stack.language}
|
|
57
|
+
|
|
58
|
+
## Agents
|
|
59
|
+
|
|
60
|
+
${agentBlocks.join('\n\n')}
|
|
61
|
+
`
|
|
62
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
|
|
3
|
+
export function claudeMd(stack: StackInfo): string {
|
|
4
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
5
|
+
const hasPrisma = stack.extras.includes('prisma')
|
|
6
|
+
return `# CLAUDE.md — Express Project
|
|
7
|
+
|
|
8
|
+
## Stack
|
|
9
|
+
- Framework : Express (${lang})
|
|
10
|
+
- Language : ${lang}
|
|
11
|
+
- Runtime : Node.js 20+
|
|
12
|
+
${hasPrisma ? '- Database : Prisma ORM\n' : ''}
|
|
13
|
+
## Commands
|
|
14
|
+
- \`npm run dev\` — development server (nodemon)
|
|
15
|
+
- \`npm run build\` — compile TypeScript
|
|
16
|
+
- \`npm start\` — production server
|
|
17
|
+
- \`npm test\` — run tests
|
|
18
|
+
|
|
19
|
+
## Structure
|
|
20
|
+
src/
|
|
21
|
+
routes/ ← Express routers (one per domain)
|
|
22
|
+
controllers/ ← request handlers
|
|
23
|
+
services/ ← business logic
|
|
24
|
+
middleware/ ← Express middleware
|
|
25
|
+
utils/ ← shared helpers
|
|
26
|
+
|
|
27
|
+
## Conventions
|
|
28
|
+
1. Routes grouped by domain in \`src/routes/\`
|
|
29
|
+
2. Business logic in \`src/services/\`, not in controllers
|
|
30
|
+
3. Middleware for cross-cutting concerns (auth, validation)
|
|
31
|
+
4. Tout output console passe par un logger centralisé
|
|
32
|
+
`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function workflow(stack: StackInfo): string {
|
|
36
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
37
|
+
return `# Agent Workflow — Express Project
|
|
38
|
+
|
|
39
|
+
## Stack détectée
|
|
40
|
+
Framework: Express | Language: ${lang}
|
|
41
|
+
|
|
42
|
+
## Agents
|
|
43
|
+
|
|
44
|
+
### Agent 1 · Data & Models
|
|
45
|
+
Périmètre : modèles de données, accès DB
|
|
46
|
+
Produit : src/models/, src/services/db.ts
|
|
47
|
+
Critère : connexion DB fonctionnelle
|
|
48
|
+
|
|
49
|
+
### Agent 2 · Services
|
|
50
|
+
Périmètre : logique métier
|
|
51
|
+
Produit : src/services/
|
|
52
|
+
Critère : services testés unitairement
|
|
53
|
+
|
|
54
|
+
### Agent 3 · Routes & Controllers
|
|
55
|
+
Périmètre : routes Express, validation, auth
|
|
56
|
+
Produit : src/routes/, src/controllers/, src/middleware/
|
|
57
|
+
Critère : endpoints répondent correctement
|
|
58
|
+
|
|
59
|
+
### Agent 4 · Tests & CI
|
|
60
|
+
Périmètre : tests d'intégration, configuration CI
|
|
61
|
+
Produit : tests/, .github/workflows/
|
|
62
|
+
Critère : npm test passe
|
|
63
|
+
`
|
|
64
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
|
|
3
|
+
export function claudeMd(_stack: StackInfo): string {
|
|
4
|
+
return `# CLAUDE.md — FastAPI Project
|
|
5
|
+
|
|
6
|
+
## Stack
|
|
7
|
+
- Framework : FastAPI (Python)
|
|
8
|
+
- Language : Python 3.11+
|
|
9
|
+
- Server : Uvicorn
|
|
10
|
+
- Validation: Pydantic v2
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
- \`uvicorn main:app --reload\` — development server (http://localhost:8000)
|
|
14
|
+
- \`pytest\` — run tests
|
|
15
|
+
- \`pip install -r requirements.txt\` — install dependencies
|
|
16
|
+
|
|
17
|
+
## Structure
|
|
18
|
+
app/
|
|
19
|
+
main.py ← FastAPI app entry point
|
|
20
|
+
routers/ ← API route groups
|
|
21
|
+
models/ ← Pydantic models
|
|
22
|
+
services/ ← business logic
|
|
23
|
+
dependencies/ ← FastAPI dependencies (DI)
|
|
24
|
+
tests/ ← pytest tests
|
|
25
|
+
|
|
26
|
+
## Conventions
|
|
27
|
+
1. Routers grouped by domain in \`app/routers/\`
|
|
28
|
+
2. Pydantic models for all request/response bodies
|
|
29
|
+
3. Business logic in \`app/services/\`, not in routes
|
|
30
|
+
4. Async endpoints by default (\`async def\`)
|
|
31
|
+
5. Environment variables via \`python-dotenv\` + \`pydantic-settings\`
|
|
32
|
+
`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function workflow(_stack: StackInfo): string {
|
|
36
|
+
return `# Agent Workflow — FastAPI Project
|
|
37
|
+
|
|
38
|
+
## Stack détectée
|
|
39
|
+
Framework: FastAPI | Language: Python
|
|
40
|
+
|
|
41
|
+
## Agents
|
|
42
|
+
|
|
43
|
+
### Agent 1 · Models & Schemas
|
|
44
|
+
Périmètre : modèles Pydantic, schémas DB (SQLAlchemy/SQLModel)
|
|
45
|
+
Produit : app/models/
|
|
46
|
+
Critère : modèles validés, migrations propres
|
|
47
|
+
|
|
48
|
+
### Agent 2 · Services
|
|
49
|
+
Périmètre : logique métier, accès base de données
|
|
50
|
+
Produit : app/services/
|
|
51
|
+
Critère : services testés unitairement (pytest)
|
|
52
|
+
|
|
53
|
+
### Agent 3 · Routers & API
|
|
54
|
+
Périmètre : routes FastAPI, dépendances, auth
|
|
55
|
+
Produit : app/routers/, app/dependencies/
|
|
56
|
+
Critère : endpoints documentés (OpenAPI), tests d'intégration
|
|
57
|
+
|
|
58
|
+
### Agent 4 · Tests & CI
|
|
59
|
+
Périmètre : couverture pytest, configuration CI
|
|
60
|
+
Produit : tests/, .github/workflows/
|
|
61
|
+
Critère : \`pytest\` passe à 100%
|
|
62
|
+
`
|
|
63
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
|
|
3
|
+
export function claudeMd(stack: StackInfo): string {
|
|
4
|
+
const hasTailwind = stack.extras.includes('tailwind')
|
|
5
|
+
const hasPrisma = stack.extras.includes('prisma')
|
|
6
|
+
return `# CLAUDE.md — Next.js Project
|
|
7
|
+
|
|
8
|
+
## Stack
|
|
9
|
+
- Framework : Next.js (TypeScript)
|
|
10
|
+
- Rendering : App Router (RSC + Client Components)
|
|
11
|
+
- Styling : ${hasTailwind ? 'Tailwind CSS' : 'CSS Modules'}
|
|
12
|
+
${hasPrisma ? '- Database : Prisma ORM\n' : ''}
|
|
13
|
+
## Commands
|
|
14
|
+
- \`npm run dev\` — development server (http://localhost:3000)
|
|
15
|
+
- \`npm run build\` — production build
|
|
16
|
+
- \`npm start\` — production server
|
|
17
|
+
- \`npm test\` — run tests
|
|
18
|
+
|
|
19
|
+
## Structure
|
|
20
|
+
src/
|
|
21
|
+
app/ ← App Router pages and layouts
|
|
22
|
+
components/ ← shared UI components
|
|
23
|
+
lib/ ← server utilities, db clients
|
|
24
|
+
utils/ ← shared helpers
|
|
25
|
+
|
|
26
|
+
## Conventions
|
|
27
|
+
1. Server Components by default, \`'use client'\` only when needed
|
|
28
|
+
2. API routes in \`src/app/api/\`
|
|
29
|
+
3. Environment variables via \`src/env.ts\` (validated)
|
|
30
|
+
4. Tout output console passe par un logger centralisé
|
|
31
|
+
`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function workflow(stack: StackInfo): string {
|
|
35
|
+
const hasPrisma = stack.extras.includes('prisma')
|
|
36
|
+
return `# Agent Workflow — Next.js Project
|
|
37
|
+
|
|
38
|
+
## Stack détectée
|
|
39
|
+
Framework: Next.js | Language: TypeScript
|
|
40
|
+
|
|
41
|
+
## Agents
|
|
42
|
+
|
|
43
|
+
### Agent 1 · Data Layer
|
|
44
|
+
Périmètre : schéma${hasPrisma ? ' Prisma' : ''}, types, server actions
|
|
45
|
+
Produit : src/lib/, ${hasPrisma ? 'prisma/schema.prisma' : 'src/types/'}
|
|
46
|
+
Critère : types compilent, migrations propres
|
|
47
|
+
|
|
48
|
+
### Agent 2 · UI Components
|
|
49
|
+
Périmètre : composants réutilisables (Server + Client)
|
|
50
|
+
Produit : src/components/
|
|
51
|
+
Critère : composants rendus sans erreur
|
|
52
|
+
|
|
53
|
+
### Agent 3 · Pages & Layout
|
|
54
|
+
Périmètre : App Router, layouts, pages
|
|
55
|
+
Produit : src/app/
|
|
56
|
+
Critère : navigation fonctionnelle, build passe
|
|
57
|
+
|
|
58
|
+
### Agent 4 · API & Tests
|
|
59
|
+
Périmètre : API routes, tests e2e/unitaires
|
|
60
|
+
Produit : src/app/api/, tests/
|
|
61
|
+
Critère : npm test passe
|
|
62
|
+
`
|
|
63
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
|
|
3
|
+
export function claudeMd(stack: StackInfo): string {
|
|
4
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
5
|
+
return `# CLAUDE.md — Node.js Project
|
|
6
|
+
|
|
7
|
+
## Stack
|
|
8
|
+
- Runtime : Node.js 20+
|
|
9
|
+
- Language : ${lang}
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
- \`npm run dev\` — development (with watch)
|
|
13
|
+
- \`npm run build\` — compile${stack.hasTypeScript ? ' TypeScript' : ''}
|
|
14
|
+
- \`npm start\` — run production build
|
|
15
|
+
- \`npm test\` — run tests
|
|
16
|
+
|
|
17
|
+
## Structure
|
|
18
|
+
src/
|
|
19
|
+
index.ts ← entry point
|
|
20
|
+
lib/ ← core library code
|
|
21
|
+
utils/ ← shared helpers
|
|
22
|
+
|
|
23
|
+
## Conventions
|
|
24
|
+
1. Modules follow single-responsibility principle
|
|
25
|
+
2. Async/await over callbacks
|
|
26
|
+
3. Tout output console passe par un logger centralisé
|
|
27
|
+
`
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function workflow(stack: StackInfo): string {
|
|
31
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
32
|
+
return `# Agent Workflow — Node.js Project
|
|
33
|
+
|
|
34
|
+
## Stack détectée
|
|
35
|
+
Runtime: Node.js | Language: ${lang}
|
|
36
|
+
|
|
37
|
+
## Agents
|
|
38
|
+
|
|
39
|
+
### Agent 1 · Core Library
|
|
40
|
+
Périmètre : logique principale
|
|
41
|
+
Produit : src/lib/
|
|
42
|
+
Critère : module fonctionne et testé
|
|
43
|
+
|
|
44
|
+
### Agent 2 · CLI / API
|
|
45
|
+
Périmètre : interface utilisateur (CLI ou API)
|
|
46
|
+
Produit : src/index.ts, src/cli.ts
|
|
47
|
+
Critère : commandes fonctionnelles
|
|
48
|
+
|
|
49
|
+
### Agent 3 · Tests & CI
|
|
50
|
+
Périmètre : couverture de tests, configuration CI
|
|
51
|
+
Produit : tests/, .github/workflows/
|
|
52
|
+
Critère : npm test passe
|
|
53
|
+
`
|
|
54
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
|
|
3
|
+
export function claudeMd(stack: StackInfo): string {
|
|
4
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
5
|
+
const testLine = stack.extras.includes('testing') ? '- `npm test` — run tests\n' : ''
|
|
6
|
+
return `# CLAUDE.md — React Project
|
|
7
|
+
|
|
8
|
+
## Stack
|
|
9
|
+
- Framework : React (${lang})
|
|
10
|
+
- Language : ${lang}
|
|
11
|
+
- Build : Vite
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
- \`npm run dev\` — development server
|
|
15
|
+
- \`npm run build\` — production build
|
|
16
|
+
${testLine}
|
|
17
|
+
## Structure
|
|
18
|
+
src/
|
|
19
|
+
components/ ← UI components (PascalCase)
|
|
20
|
+
hooks/ ← custom hooks (prefix: use*)
|
|
21
|
+
pages/ ← page-level components
|
|
22
|
+
utils/ ← shared helpers
|
|
23
|
+
|
|
24
|
+
## Conventions
|
|
25
|
+
1. Components in PascalCase
|
|
26
|
+
2. Hooks prefixed with \`use\`
|
|
27
|
+
3. Props interfaces named \`*Props\`
|
|
28
|
+
4. Tout output console passe par un logger centralisé
|
|
29
|
+
`
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function workflow(stack: StackInfo): string {
|
|
33
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
34
|
+
return `# Agent Workflow — React Project
|
|
35
|
+
|
|
36
|
+
## Stack détectée
|
|
37
|
+
Framework: React | Language: ${lang}
|
|
38
|
+
|
|
39
|
+
## Agents
|
|
40
|
+
|
|
41
|
+
### Agent 1 · Components
|
|
42
|
+
Périmètre : composants UI réutilisables
|
|
43
|
+
Produit : src/components/
|
|
44
|
+
Critère : composants documentés et testés
|
|
45
|
+
|
|
46
|
+
### Agent 2 · State & Hooks
|
|
47
|
+
Périmètre : state management, hooks personnalisés
|
|
48
|
+
Produit : src/hooks/
|
|
49
|
+
Critère : hooks testés unitairement
|
|
50
|
+
|
|
51
|
+
### Agent 3 · Pages & Routing
|
|
52
|
+
Périmètre : assemblage des pages, react-router
|
|
53
|
+
Produit : src/pages/
|
|
54
|
+
Critère : navigation fonctionnelle
|
|
55
|
+
|
|
56
|
+
### Agent 4 · Tests & CI
|
|
57
|
+
Périmètre : couverture de tests, configuration CI
|
|
58
|
+
Produit : tests/, .github/workflows/
|
|
59
|
+
Critère : npm test passe
|
|
60
|
+
`
|
|
61
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
|
|
3
|
+
export function claudeMd(stack: StackInfo): string {
|
|
4
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
5
|
+
return `# CLAUDE.md — Tauri Project
|
|
6
|
+
|
|
7
|
+
## Stack
|
|
8
|
+
- Framework : Tauri (Rust + ${lang} frontend)
|
|
9
|
+
- Language : Rust (backend) + ${lang} (frontend)
|
|
10
|
+
- Build : Cargo + Vite
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
- \`npm run tauri dev\` — development (hot reload)
|
|
14
|
+
- \`npm run tauri build\` — production bundle
|
|
15
|
+
- \`npm run build\` — frontend only
|
|
16
|
+
- \`npm test\` — run tests
|
|
17
|
+
|
|
18
|
+
## Structure
|
|
19
|
+
src/ ← frontend (${lang})
|
|
20
|
+
components/
|
|
21
|
+
utils/
|
|
22
|
+
src-tauri/ ← Rust backend
|
|
23
|
+
src/
|
|
24
|
+
main.rs ← Tauri entry point
|
|
25
|
+
commands.rs ← Tauri commands (IPC)
|
|
26
|
+
tauri.conf.json
|
|
27
|
+
|
|
28
|
+
## Conventions
|
|
29
|
+
1. IPC commands defined in \`src-tauri/src/commands.rs\`
|
|
30
|
+
2. Frontend invokes via \`@tauri-apps/api/tauri\`
|
|
31
|
+
3. No direct filesystem access from frontend
|
|
32
|
+
4. Tout output console passe par un logger centralisé
|
|
33
|
+
`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function workflow(stack: StackInfo): string {
|
|
37
|
+
const lang = stack.hasTypeScript ? 'TypeScript' : 'JavaScript'
|
|
38
|
+
return `# Agent Workflow — Tauri Project
|
|
39
|
+
|
|
40
|
+
## Stack détectée
|
|
41
|
+
Framework: Tauri | Language: Rust + ${lang}
|
|
42
|
+
|
|
43
|
+
## Agents
|
|
44
|
+
|
|
45
|
+
### Agent 1 · Rust Commands
|
|
46
|
+
Périmètre : commandes Tauri (IPC), permissions
|
|
47
|
+
Produit : src-tauri/src/commands.rs, tauri.conf.json
|
|
48
|
+
Critère : \`cargo build\` passe
|
|
49
|
+
|
|
50
|
+
### Agent 2 · Frontend UI
|
|
51
|
+
Périmètre : interface ${lang}, intégration IPC
|
|
52
|
+
Produit : src/components/, src/utils/
|
|
53
|
+
Critère : appels IPC fonctionnels
|
|
54
|
+
|
|
55
|
+
### Agent 3 · Build & Packaging
|
|
56
|
+
Périmètre : configuration build, icônes, installeurs
|
|
57
|
+
Produit : src-tauri/tauri.conf.json, icons/
|
|
58
|
+
Critère : \`npm run tauri build\` produit un bundle
|
|
59
|
+
|
|
60
|
+
### Agent 4 · Tests
|
|
61
|
+
Périmètre : tests Rust + tests frontend
|
|
62
|
+
Produit : src-tauri/tests/, tests/
|
|
63
|
+
Critère : \`cargo test\` + \`npm test\` passent
|
|
64
|
+
`
|
|
65
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StackInfo } from '../detectors/stackDetector.js'
|
|
2
|
+
|
|
3
|
+
export function claudeMd(_stack: StackInfo): string {
|
|
4
|
+
return `# CLAUDE.md
|
|
5
|
+
|
|
6
|
+
## Stack
|
|
7
|
+
Stack non détectée automatiquement — à remplir manuellement.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
- À définir selon le projet
|
|
11
|
+
|
|
12
|
+
## Structure
|
|
13
|
+
src/ ← code source
|
|
14
|
+
tests/ ← tests
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
1. Tout output console passe par un logger centralisé
|
|
18
|
+
2. À compléter selon les conventions du projet
|
|
19
|
+
`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function workflow(_stack: StackInfo): string {
|
|
23
|
+
return `# Agent Workflow
|
|
24
|
+
|
|
25
|
+
## Stack détectée
|
|
26
|
+
Stack inconnue — workflow générique.
|
|
27
|
+
|
|
28
|
+
## Agents
|
|
29
|
+
|
|
30
|
+
### Agent 1 · Setup
|
|
31
|
+
Périmètre : configuration initiale du projet
|
|
32
|
+
Produit : structure de base
|
|
33
|
+
Critère : projet compilable
|
|
34
|
+
|
|
35
|
+
### Agent 2 · Core
|
|
36
|
+
Périmètre : logique principale
|
|
37
|
+
Produit : src/
|
|
38
|
+
Critère : fonctionnalités principales opérationnelles
|
|
39
|
+
|
|
40
|
+
### Agent 3 · Tests
|
|
41
|
+
Périmètre : couverture de tests
|
|
42
|
+
Produit : tests/
|
|
43
|
+
Critère : tests passent
|
|
44
|
+
`
|
|
45
|
+
}
|