@patricksardinha/agentkit-cli 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_WORKFLOW.md +129 -55
- package/CLAUDE.md +70 -45
- package/LICENSE +21 -0
- package/PLAYBOOK.md +192 -0
- package/PROJECT_BLUEPRINT.md +52 -0
- package/README.md +435 -327
- package/agents/agent-1-infra/skills.md +46 -0
- package/agents/agent-2-detectors/skills.md +38 -0
- package/agents/agent-3-generators/skills.md +43 -0
- package/agents/agent-4-commands/skills.md +37 -0
- package/dist/cli.cjs +149 -49
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +149 -49
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/add.ts +22 -15
- package/src/commands/init.ts +1 -1
- package/src/generators/playbookGenerator.ts +136 -36
- package/tests/commands/add.test.ts +1 -1
- package/tests/generators/playbookGenerator.test.ts +140 -48
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Skills — Agent 1 · Infra & Setup
|
|
2
|
+
|
|
3
|
+
> This file is read by Agent 1 before starting its work.
|
|
4
|
+
> It contains project-specific context that enriches the agent's understanding
|
|
5
|
+
> beyond what is in CLAUDE.md.
|
|
6
|
+
|
|
7
|
+
## Technical context
|
|
8
|
+
|
|
9
|
+
- Package name : @patricksardinha/agentkit-cli
|
|
10
|
+
- Node.js target : 20+
|
|
11
|
+
- Output formats : ESM + CJS (tsup dual build)
|
|
12
|
+
- Binary name : `agentkit` (mapped in package.json `bin` field)
|
|
13
|
+
- Registry : npm (scoped, public)
|
|
14
|
+
|
|
15
|
+
## publishConfig requirement
|
|
16
|
+
|
|
17
|
+
The package.json must include:
|
|
18
|
+
```json
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
Without this, npm treats scoped packages as private and blocks publishing.
|
|
24
|
+
|
|
25
|
+
## GitHub Actions release trigger
|
|
26
|
+
|
|
27
|
+
The workflow must trigger on `v*` tags only (not branch pushes).
|
|
28
|
+
The npm publish step must use:
|
|
29
|
+
```yaml
|
|
30
|
+
- run: npm publish --access public
|
|
31
|
+
env:
|
|
32
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
33
|
+
```
|
|
34
|
+
The NPM_TOKEN must be an Automation token (not Granular) to bypass 2FA.
|
|
35
|
+
|
|
36
|
+
## tsup configuration
|
|
37
|
+
|
|
38
|
+
Dual output is required for compatibility:
|
|
39
|
+
```ts
|
|
40
|
+
export default defineConfig({
|
|
41
|
+
entry: ['src/cli.ts'],
|
|
42
|
+
format: ['esm', 'cjs'],
|
|
43
|
+
dts: true,
|
|
44
|
+
clean: true,
|
|
45
|
+
})
|
|
46
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Skills — Agent 2 · Detectors
|
|
2
|
+
|
|
3
|
+
> This file is read by Agent 2 before starting its work.
|
|
4
|
+
|
|
5
|
+
## StackInfo type
|
|
6
|
+
|
|
7
|
+
The detector must return this exact shape:
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export interface StackInfo {
|
|
11
|
+
framework: 'react' | 'nextjs' | 'tauri' | 'fastapi' | 'express' | 'node' | 'unknown'
|
|
12
|
+
hasTypeScript: boolean
|
|
13
|
+
extras: string[] // e.g. ['tailwind', 'prisma', 'testing']
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Detection priority
|
|
18
|
+
|
|
19
|
+
Frameworks are detected in this order (first match wins):
|
|
20
|
+
1. tauri — `src-tauri/` directory exists
|
|
21
|
+
2. nextjs — `next` key in package.json dependencies
|
|
22
|
+
3. react — `react` key in package.json dependencies
|
|
23
|
+
4. fastapi — `fastapi` in requirements.txt
|
|
24
|
+
5. express — `express` key in package.json dependencies
|
|
25
|
+
6. node — package.json exists (fallback)
|
|
26
|
+
7. unknown — nothing found
|
|
27
|
+
|
|
28
|
+
## Extras detection
|
|
29
|
+
|
|
30
|
+
- typescript : `typescript` in devDependencies OR tsconfig.json exists
|
|
31
|
+
- tailwind : `tailwindcss` in dependencies or devDependencies
|
|
32
|
+
- prisma : `prisma` in devDependencies OR prisma/ directory exists
|
|
33
|
+
- testing : `vitest` or `jest` in devDependencies
|
|
34
|
+
|
|
35
|
+
## Test fixtures
|
|
36
|
+
|
|
37
|
+
Use in-memory mock file systems for tests — do not read the actual
|
|
38
|
+
agentkit-cli project files as fixtures, as this creates circular dependencies.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Skills — Agent 3 · Generators & Templates
|
|
2
|
+
|
|
3
|
+
> This file is read by Agent 3 before starting its work.
|
|
4
|
+
|
|
5
|
+
## Template function signature
|
|
6
|
+
|
|
7
|
+
Every template file must export exactly these two functions:
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export function claudeMd(stack: StackInfo): string
|
|
11
|
+
export function workflow(stack: StackInfo): string
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The `workflow()` function returns a markdown string. The workflowGenerator
|
|
15
|
+
is responsible for parsing that string into an `Agent[]` array.
|
|
16
|
+
|
|
17
|
+
## Agent type
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
export interface Agent {
|
|
21
|
+
number: number // 1, 2, 3…
|
|
22
|
+
slug: string // 'infra', 'auth', 'features'…
|
|
23
|
+
name: string // 'Infra & Setup', 'Auth & Supabase'…
|
|
24
|
+
scope: string // one-line description
|
|
25
|
+
outputs: string[]
|
|
26
|
+
criterion: string // the runnable bash command
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Blueprint parsing
|
|
31
|
+
|
|
32
|
+
When `blueprintContent` is provided, parse `## Feature` sections
|
|
33
|
+
using simple line splitting — no external markdown parser needed.
|
|
34
|
+
Extract bullet points under each `##` heading and use them to name
|
|
35
|
+
and scope the generated agents.
|
|
36
|
+
|
|
37
|
+
## playbookGenerator rules
|
|
38
|
+
|
|
39
|
+
The PLAYBOOK.md must always start with the one-instruction block:
|
|
40
|
+
> "Read PLAYBOOK.md and execute the procedure."
|
|
41
|
+
|
|
42
|
+
The retry limit is always 3. The escalation section is always present.
|
|
43
|
+
Do not make these values configurable — consistency is the point.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Skills — Agent 4 · Commands CLI
|
|
2
|
+
|
|
3
|
+
> This file is read by Agent 4 before starting its work.
|
|
4
|
+
|
|
5
|
+
## Commander.js setup
|
|
6
|
+
|
|
7
|
+
The CLI binary is `agentkit`. The three subcommands are:
|
|
8
|
+
- `init [options]` with `--blueprint <path>`
|
|
9
|
+
- `add [options]` with `--feature <description>`
|
|
10
|
+
- `status`
|
|
11
|
+
|
|
12
|
+
## init command behavior
|
|
13
|
+
|
|
14
|
+
1. Run gitDetector — warn but don't block if not a git repo
|
|
15
|
+
2. Run stackDetector on process.cwd()
|
|
16
|
+
3. If --blueprint provided: read file, warn if path doesn't exist
|
|
17
|
+
4. Call claudeMdGenerator(stack, blueprintContent?)
|
|
18
|
+
5. Call workflowGenerator(stack, blueprintContent?) → { markdown, agents }
|
|
19
|
+
6. Call playbookGenerator(agents, projectName)
|
|
20
|
+
7. Call skillsGenerator(agents)
|
|
21
|
+
8. Write all files — never overwrite existing files without --force flag
|
|
22
|
+
|
|
23
|
+
## add command behavior
|
|
24
|
+
|
|
25
|
+
1. Check AGENT_WORKFLOW.md exists — error if not (run init first)
|
|
26
|
+
2. Parse existing agents to find the last number
|
|
27
|
+
3. Generate new agent block from --feature description
|
|
28
|
+
4. Append to AGENT_WORKFLOW.md
|
|
29
|
+
5. Create agents/agent-{N+1}-{slug}/skills.md
|
|
30
|
+
6. Regenerate PLAYBOOK.md entirely (not append — full regeneration)
|
|
31
|
+
|
|
32
|
+
## Output rules
|
|
33
|
+
|
|
34
|
+
- Use logger.ts for all output — never console.log directly
|
|
35
|
+
- Use ora spinner during file generation
|
|
36
|
+
- Use chalk.green for success, chalk.yellow for warnings, chalk.red for errors
|
|
37
|
+
- Always print a summary of generated files at the end of init
|
package/dist/cli.cjs
CHANGED
|
@@ -684,67 +684,163 @@ ${agentBlocks.join("\n\n")}
|
|
|
684
684
|
}
|
|
685
685
|
|
|
686
686
|
// src/generators/playbookGenerator.ts
|
|
687
|
-
function generatePlaybook({ agents, projectName }) {
|
|
687
|
+
function generatePlaybook({ agents, projectName, hasBlueprint }) {
|
|
688
688
|
const agentBlocks = agents.map((a) => agentBlock(a)).join("\n---\n\n");
|
|
689
|
+
const phase0 = hasBlueprint ? `## Phase 0 \u2014 Agent Decomposition (run this first)
|
|
690
|
+
|
|
691
|
+
> A \`PROJECT_BLUEPRINT.md\` was provided.
|
|
692
|
+
> Claude Code reads it and decomposes the project into specialized agents
|
|
693
|
+
> before writing a single line of code.
|
|
694
|
+
|
|
695
|
+
**Read these files in order:**
|
|
696
|
+
1. \`CLAUDE.md\`
|
|
697
|
+
2. \`PROJECT_BLUEPRINT.md\`
|
|
698
|
+
|
|
699
|
+
**Then decompose the project into agents** following these rules:
|
|
700
|
+
|
|
701
|
+
- One agent = one coherent technical layer (never mix two layers)
|
|
702
|
+
- Each agent must have a runnable success criterion (\`npm test\`, \`cargo build\`\u2026)
|
|
703
|
+
- Agents must be ordered by dependency (no feature without infra first)
|
|
704
|
+
- Maximum 6 agents \u2014 if you have more, group related ones
|
|
705
|
+
- Always respect this order:
|
|
706
|
+
1. Infra & Configuration
|
|
707
|
+
2. Data layer (DB schema, models, services)
|
|
708
|
+
3. External integrations (auth, APIs, local services like Ollama)
|
|
709
|
+
4. UI & pages
|
|
710
|
+
5. Advanced features (RAG, export, realtime\u2026)
|
|
711
|
+
6. Build & release (CI/CD, packaging, installers)
|
|
712
|
+
|
|
713
|
+
**Write the result directly into \`AGENT_WORKFLOW.md\`** \u2014 replace its current
|
|
714
|
+
content with your decomposition.
|
|
715
|
+
|
|
716
|
+
**Then ask for human validation:**
|
|
717
|
+
> "I have decomposed the project into N agents: [list them].
|
|
718
|
+
> Should I proceed with execution?"
|
|
719
|
+
|
|
720
|
+
Wait for confirmation before moving to Phase 1.
|
|
721
|
+
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
` : `## Phase 0 \u2014 Project Discovery (run this first)
|
|
725
|
+
|
|
726
|
+
> No \`PROJECT_BLUEPRINT.md\` was provided.
|
|
727
|
+
> Before writing any code, Claude Code asks the user what they want to build,
|
|
728
|
+
> then decomposes the project into agents \u2014 exactly as if a blueprint had been provided.
|
|
729
|
+
|
|
730
|
+
**Ask the user these questions and wait for their answers:**
|
|
731
|
+
|
|
732
|
+
1. What is this project? (one sentence describing the goal)
|
|
733
|
+
2. What are the main features you want to build? (list them)
|
|
734
|
+
3. Are there any tech constraints or architecture preferences?
|
|
735
|
+
(e.g. offline-only, specific DB, no auth, specific framework)
|
|
736
|
+
|
|
737
|
+
**Once you have the answers, decompose the project into agents**
|
|
738
|
+
following these rules:
|
|
739
|
+
|
|
740
|
+
- One agent = one coherent technical layer (never mix two layers)
|
|
741
|
+
- Each agent must have a runnable success criterion (\`npm test\`, \`cargo build\`\u2026)
|
|
742
|
+
- Agents must be ordered by dependency (no feature without infra first)
|
|
743
|
+
- Maximum 6 agents \u2014 if you have more, group related ones
|
|
744
|
+
- Always respect this order:
|
|
745
|
+
1. Infra & Configuration
|
|
746
|
+
2. Data layer (DB schema, models, services)
|
|
747
|
+
3. External integrations (auth, APIs, local services like Ollama)
|
|
748
|
+
4. UI & pages
|
|
749
|
+
5. Advanced features (RAG, export, realtime\u2026)
|
|
750
|
+
6. Build & release (CI/CD, packaging, installers)
|
|
751
|
+
|
|
752
|
+
**Write the result directly into \`AGENT_WORKFLOW.md\`** \u2014 replace its current
|
|
753
|
+
content with your decomposition.
|
|
754
|
+
|
|
755
|
+
**Then ask for human validation:**
|
|
756
|
+
> "I have decomposed the project into N agents: [list them].
|
|
757
|
+
> Should I proceed with execution?"
|
|
758
|
+
|
|
759
|
+
Wait for confirmation before moving to Phase 1.
|
|
760
|
+
|
|
761
|
+
---
|
|
762
|
+
|
|
763
|
+
`;
|
|
689
764
|
return `# PLAYBOOK.md \u2014 ${projectName}
|
|
690
765
|
|
|
691
|
-
>
|
|
766
|
+
> **One instruction to give Claude Code:**
|
|
767
|
+
> "Read PLAYBOOK.md and execute the procedure."
|
|
768
|
+
>
|
|
769
|
+
> Claude Code handles the rest autonomously \u2014 project discovery or blueprint reading,
|
|
770
|
+
> agent decomposition, execution, success validation, retries, and human escalation.
|
|
771
|
+
> No API key required. No additional cost beyond your LLM subscription.
|
|
692
772
|
|
|
693
|
-
|
|
773
|
+
---
|
|
694
774
|
|
|
695
|
-
|
|
696
|
-
1. Lire \`CLAUDE.md\`
|
|
697
|
-
2. Lire \`agents/agent-{N}-{slug}/skills.md\` (le fichier de l'agent courant)
|
|
775
|
+
## Global Execution Rules
|
|
698
776
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
- Apr\xE8s 3 \xE9checs cons\xE9cutifs \u2192 pause et demander validation humaine
|
|
704
|
-
- **Ne jamais passer \xE0 l'agent suivant sans crit\xE8re valid\xE9**
|
|
777
|
+
Before each agent:
|
|
778
|
+
1. Read \`CLAUDE.md\`
|
|
779
|
+
2. Read \`agents/agent-{N}-{slug}/skills.md\` (current agent's file)
|
|
780
|
+
3. Read the agent's section in \`AGENT_WORKFLOW.md\`
|
|
705
781
|
|
|
706
|
-
|
|
782
|
+
After each agent:
|
|
783
|
+
- Run the success criterion command
|
|
784
|
+
- \u2705 Passes \u2192 announce "\u2705 Agent N complete" and move to the next
|
|
785
|
+
- \u274C Fails \u2192 analyze the root cause, fix, rerun (max 3 attempts)
|
|
786
|
+
- After 3 consecutive failures \u2192 stop and ask for human validation
|
|
787
|
+
|
|
788
|
+
**Never move to the next agent without a passing success criterion.**
|
|
789
|
+
**Stay strictly within your current agent's defined scope.**
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
${phase0}## Phase 1 \u2014 Execution
|
|
707
794
|
|
|
708
795
|
${agentBlocks}
|
|
709
796
|
|
|
710
|
-
|
|
797
|
+
---
|
|
798
|
+
|
|
799
|
+
## Future Iterations
|
|
711
800
|
|
|
712
|
-
|
|
713
|
-
1.
|
|
714
|
-
2.
|
|
715
|
-
3.
|
|
716
|
-
4.
|
|
801
|
+
When a new agent is added via \`agentkit add --feature <description>\`:
|
|
802
|
+
1. A new agent block is appended to \`AGENT_WORKFLOW.md\`
|
|
803
|
+
2. The folder \`agents/agent-{N}-{slug}/\` is created with \`skills.md\`
|
|
804
|
+
3. This \`PLAYBOOK.md\` is regenerated to include the new agent
|
|
805
|
+
4. Execution resumes at the new agent only \u2014 completed agents are not rerun
|
|
717
806
|
|
|
718
|
-
|
|
807
|
+
When you receive the instruction to continue after an iteration:
|
|
808
|
+
> "Read PLAYBOOK.md and execute only the agents that haven't been completed yet."
|
|
719
809
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
810
|
+
---
|
|
811
|
+
|
|
812
|
+
## Human Validation Required
|
|
813
|
+
|
|
814
|
+
Stop and wait for confirmation in these situations:
|
|
815
|
+
- **3 consecutive failures** on the same success criterion
|
|
816
|
+
- **Missing external dependency**: API key, env variable, unavailable service
|
|
817
|
+
- **Conflict** between the detected stack and the user's stated constraints
|
|
818
|
+
- **Destructive operation**: overwriting files not listed in deliverables
|
|
819
|
+
- **End of Phase 0**: agent decomposition must be validated before execution
|
|
724
820
|
`;
|
|
725
821
|
}
|
|
726
822
|
function agentBlock(agent) {
|
|
727
823
|
const skillsPath = `agents/agent-${agent.number}-${agent.slug}/skills.md`;
|
|
728
|
-
const outputLines = agent.outputs.length > 0 ? agent.outputs.map((o) => `- ${o}`).join("\n") : "- (
|
|
729
|
-
return `### ${agent.
|
|
824
|
+
const outputLines = agent.outputs.length > 0 ? agent.outputs.map((o) => `- ${o}`).join("\n") : "- (see skills.md for details)";
|
|
825
|
+
return `### Agent ${agent.number} \xB7 ${agent.name}
|
|
730
826
|
|
|
731
|
-
**
|
|
827
|
+
**Scope**: ${agent.scope}
|
|
732
828
|
|
|
733
|
-
**Skills
|
|
829
|
+
**Skills**: \`${skillsPath}\`
|
|
734
830
|
|
|
735
|
-
**
|
|
831
|
+
**Deliverables**:
|
|
736
832
|
${outputLines}
|
|
737
833
|
|
|
738
|
-
**
|
|
834
|
+
**Success criterion**:
|
|
739
835
|
\`\`\`bash
|
|
740
836
|
${agent.criterion || "npm run build && npm test"}
|
|
741
837
|
\`\`\`
|
|
742
838
|
|
|
743
|
-
**
|
|
744
|
-
1.
|
|
745
|
-
2.
|
|
746
|
-
3.
|
|
747
|
-
4.
|
|
839
|
+
**On failure**:
|
|
840
|
+
1. Read the full error output
|
|
841
|
+
2. Fix the root cause \u2014 not the symptoms
|
|
842
|
+
3. Rerun the success criterion (max 3 attempts)
|
|
843
|
+
4. After 3 failures \u2192 ask for human validation
|
|
748
844
|
`;
|
|
749
845
|
}
|
|
750
846
|
|
|
@@ -899,7 +995,7 @@ function registerInit(program2) {
|
|
|
899
995
|
const claudeMdContent = generateClaudeMd(stack, blueprintContent);
|
|
900
996
|
const workflowContent = generateWorkflow(stack, blueprintContent);
|
|
901
997
|
const agents = extractAgentsFromWorkflow(workflowContent);
|
|
902
|
-
const playbookContent = generatePlaybook({ agents, projectName });
|
|
998
|
+
const playbookContent = generatePlaybook({ agents, projectName, hasBlueprint: !!blueprintContent });
|
|
903
999
|
await (0, import_promises4.writeFile)(claudeMdPath, claudeMdContent, "utf-8");
|
|
904
1000
|
await (0, import_promises4.writeFile)(workflowPath, workflowContent, "utf-8");
|
|
905
1001
|
await (0, import_promises4.writeFile)(playbookPath, playbookContent, "utf-8");
|
|
@@ -927,7 +1023,7 @@ async function addFeatureToProject(description, projectDir) {
|
|
|
927
1023
|
try {
|
|
928
1024
|
workflowContent = await (0, import_promises5.readFile)(workflowPath, "utf-8");
|
|
929
1025
|
} catch {
|
|
930
|
-
throw new Error(`AGENT_WORKFLOW.md
|
|
1026
|
+
throw new Error(`AGENT_WORKFLOW.md not found in ${projectDir} \u2014 run agentkit init first`);
|
|
931
1027
|
}
|
|
932
1028
|
const existingAgents = extractAgentsFromWorkflow(workflowContent);
|
|
933
1029
|
const nextNumber = existingAgents.length + 1;
|
|
@@ -961,7 +1057,11 @@ Crit\xE8re : npm run build && npm test
|
|
|
961
1057
|
} catch {
|
|
962
1058
|
}
|
|
963
1059
|
const allAgents = [...existingAgents, newAgent];
|
|
964
|
-
const playbookContent = generatePlaybook({
|
|
1060
|
+
const playbookContent = generatePlaybook({
|
|
1061
|
+
agents: allAgents,
|
|
1062
|
+
projectName,
|
|
1063
|
+
hasBlueprint: false
|
|
1064
|
+
});
|
|
965
1065
|
await (0, import_promises5.writeFile)(playbookPath, playbookContent, "utf-8");
|
|
966
1066
|
return {
|
|
967
1067
|
agent: newAgent,
|
|
@@ -969,13 +1069,13 @@ Crit\xE8re : npm run build && npm test
|
|
|
969
1069
|
};
|
|
970
1070
|
}
|
|
971
1071
|
function registerAdd(program2) {
|
|
972
|
-
const addCmd = program2.command("add").description("
|
|
1072
|
+
const addCmd = program2.command("add").description("Add resources to the agentkit project").option("--feature <description>", "Add an agent from a feature description and regenerate PLAYBOOK.md").action(async (options) => {
|
|
973
1073
|
if (options.feature) {
|
|
974
1074
|
try {
|
|
975
1075
|
const result = await addFeatureToProject(options.feature, process.cwd());
|
|
976
|
-
logger.success(`Agent
|
|
977
|
-
logger.success(`
|
|
978
|
-
logger.success("PLAYBOOK.md :
|
|
1076
|
+
logger.success(`Agent added : ${result.agent.fullName}`);
|
|
1077
|
+
logger.success(`Folder created : agents/agent-${result.agent.number}-${result.agent.slug}/`);
|
|
1078
|
+
logger.success("PLAYBOOK.md : regenerated");
|
|
979
1079
|
} catch (err) {
|
|
980
1080
|
logger.error(err instanceof Error ? err.message : String(err));
|
|
981
1081
|
process.exit(1);
|
|
@@ -984,14 +1084,14 @@ function registerAdd(program2) {
|
|
|
984
1084
|
addCmd.help();
|
|
985
1085
|
}
|
|
986
1086
|
});
|
|
987
|
-
addCmd.command("agent").description("
|
|
1087
|
+
addCmd.command("agent").description("Add a new agent to AGENT_WORKFLOW.md (interactive)").action(async () => {
|
|
988
1088
|
const cwd = process.cwd();
|
|
989
1089
|
const workflowPath = (0, import_node_path6.join)(cwd, "AGENT_WORKFLOW.md");
|
|
990
1090
|
let existing = "";
|
|
991
1091
|
try {
|
|
992
1092
|
existing = await (0, import_promises5.readFile)(workflowPath, "utf-8");
|
|
993
1093
|
} catch {
|
|
994
|
-
logger.error("AGENT_WORKFLOW.md
|
|
1094
|
+
logger.error("AGENT_WORKFLOW.md not found \u2014 run agentkit init first");
|
|
995
1095
|
process.exit(1);
|
|
996
1096
|
}
|
|
997
1097
|
const agentCount = (existing.match(/^### Agent \d+/gm) ?? []).length;
|
|
@@ -1000,23 +1100,23 @@ function registerAdd(program2) {
|
|
|
1000
1100
|
{
|
|
1001
1101
|
type: "input",
|
|
1002
1102
|
name: "name",
|
|
1003
|
-
message: `
|
|
1103
|
+
message: `Agent name (e.g. "Agent ${nextNumber} \xB7 Feature X"):`,
|
|
1004
1104
|
default: `Agent ${nextNumber}`
|
|
1005
1105
|
},
|
|
1006
1106
|
{
|
|
1007
1107
|
type: "input",
|
|
1008
1108
|
name: "scope",
|
|
1009
|
-
message: "
|
|
1109
|
+
message: "Scope (one sentence):"
|
|
1010
1110
|
},
|
|
1011
1111
|
{
|
|
1012
1112
|
type: "input",
|
|
1013
1113
|
name: "outputs",
|
|
1014
|
-
message: "
|
|
1114
|
+
message: "Deliverables (comma-separated):"
|
|
1015
1115
|
},
|
|
1016
1116
|
{
|
|
1017
1117
|
type: "input",
|
|
1018
1118
|
name: "criterion",
|
|
1019
|
-
message: "
|
|
1119
|
+
message: "Success criterion:"
|
|
1020
1120
|
}
|
|
1021
1121
|
]);
|
|
1022
1122
|
const outputLines = answers.outputs.split(",").map((o) => ` - ${o.trim()}`).join("\n");
|
|
@@ -1028,7 +1128,7 @@ ${outputLines}
|
|
|
1028
1128
|
Crit\xE8re : ${answers.criterion}
|
|
1029
1129
|
`;
|
|
1030
1130
|
await (0, import_promises5.writeFile)(workflowPath, existing + agentSection, "utf-8");
|
|
1031
|
-
logger.success(`Agent "${answers.name}"
|
|
1131
|
+
logger.success(`Agent "${answers.name}" added to AGENT_WORKFLOW.md`);
|
|
1032
1132
|
});
|
|
1033
1133
|
}
|
|
1034
1134
|
|