@nicolasmondain/cli-agent 2.1.0 → 2.1.2

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # cli-agent
2
2
 
3
- > Bridge the gap between natural language and CLI commands
3
+ > A semantic command catalog for AI agents
4
4
 
5
- A CLI wrapper that enables AI agents to discover and execute commands through a semantic catalog. Define your commands once in JSON, and let both humans and AI agents use them seamlessly.
5
+ A CLI wrapper that enables AI agents to discover and execute commands through a structured catalog. Define your commands once in JSON, and let both humans and AI agents use them seamlessly.
6
6
 
7
7
  ## Why cli-agent?
8
8
 
@@ -16,40 +16,48 @@ AI agents can execute scripts, but they face challenges:
16
16
 
17
17
  ### The Solution
18
18
 
19
- cli-agent provides a **semantic catalog** of commands:
20
-
21
- ```
22
- ┌─────────────────────────────────────────────────────────────┐
23
- "Create a feature folder called user-profile" │ Natural Language
24
- └─────────────────────────────────────────────────────────────┘
25
-
26
-
27
- ┌─────────────────────────────────────────────────────────────┐
28
- │ .cli-agent.json │
29
- │ { │
30
- "commands": [{ │
31
- │ "name": "feature-folder", │
32
- │ "description": "Generate a new feature folder...", │ Semantic Catalog
33
- │ "arguments": [{ "name": "name", ... }] │
34
- }]
35
- │ } │
36
- └─────────────────────────────────────────────────────────────┘
37
-
38
-
39
- ┌─────────────────────────────────────────────────────────────┐
40
- │ cli-agent feature-folder user-profile --format json │ CLI Command
41
- └─────────────────────────────────────────────────────────────┘
42
-
43
-
44
- ┌─────────────────────────────────────────────────────────────┐
45
- │ {"success": true, "data": {"path": "./src/features/..."}} │ Structured Output
46
- └─────────────────────────────────────────────────────────────┘
19
+ cli-agent provides a **semantic catalog** of commands. AI agents read the catalog, match commands to user intent, and execute them one by one:
20
+
21
+ ```mermaid
22
+ flowchart TD
23
+ A["User: 'Set up my project with linting and tests'"] --> B[AI Agent]
24
+ B --> C["cli-agent list --format json"]
25
+ C --> D["Agent reads command catalog"]
26
+ D --> E["Agent matches intent to commands"]
27
+ E --> F["cli-agent init my-project --format json"]
28
+ F --> G{Success?}
29
+ G -->|Yes| H["cli-agent add-linting --format json"]
30
+ G -->|No| I["Agent stops and reports error"]
31
+ H --> J{Success?}
32
+ J -->|Yes| K["cli-agent add-testing --format json"]
33
+ J -->|No| I
34
+ K --> L["Agent reports combined results"]
47
35
  ```
48
36
 
37
+ ## How It Works
38
+
39
+ When an AI agent (like Claude) receives: **"Set up my project with linting and tests"**
40
+
41
+ 1. **Discovery**: The agent calls `cli-agent list --format json` to get the command catalog
42
+ 2. **Matching**: The agent reads command descriptions and matches them to user intent:
43
+ - `init` → "Initialize a new project with standard structure"
44
+ - `add-linting` → "Add ESLint configuration to the project"
45
+ - `add-testing` → "Add Jest/Vitest testing setup"
46
+ 3. **Execution**: The agent executes each command one by one:
47
+ ```bash
48
+ cli-agent init my-project --format json
49
+ cli-agent add-linting --format json
50
+ cli-agent add-testing --format json
51
+ ```
52
+ 4. **Error handling**: If any command fails, the agent stops the sequence and reports the error
53
+ 5. **Result**: The agent aggregates results and reports back to the user
54
+
55
+ **Note:** cli-agent itself has no AI capabilities. It's a tool catalog and executor. The AI agent (Claude, GPT, etc.) handles the natural language understanding and orchestration.
56
+
49
57
  ## Features
50
58
 
51
- - **Natural Language Mapping** — Command descriptions enable AI agents to match user intent to the right command
52
- - **Command Discovery** — `cli-agent list --format json` exposes all commands with their arguments and options
59
+ - **Semantic Catalog** — Command descriptions enable AI agents to match user intent
60
+ - **Command Discovery** — `cli-agent list --format json` exposes all commands with arguments and options
53
61
  - **MCP Integration** — Generate MCP tool manifests for native Claude Code integration
54
62
  - **Multi-runtime Support** — Execute JavaScript, TypeScript, and shell scripts
55
63
  - **AI-First Design** — JSON output, non-interactive execution, predictable exit codes
@@ -74,25 +82,42 @@ Create `.cli-agent.json` in your project root:
74
82
 
75
83
  ```json
76
84
  {
77
- "name": "my-cli",
78
- "description": "My project automation tools",
85
+ "name": "project-cli",
86
+ "description": "Project automation tools",
79
87
  "commands": [
80
88
  {
81
- "name": "feature-folder",
82
- "description": "Generate a new feature folder with component, hook, test, and type files",
83
- "script": "./scripts/generate-feature.js",
89
+ "name": "init",
90
+ "description": "Initialize a new project with standard folder structure and configuration files",
91
+ "script": "./scripts/init.js",
84
92
  "arguments": [
85
93
  {
86
94
  "name": "name",
87
- "description": "Feature name (e.g., 'user-profile', 'checkout')",
95
+ "description": "Project name",
88
96
  "required": true
89
97
  }
90
- ],
98
+ ]
99
+ },
100
+ {
101
+ "name": "add-linting",
102
+ "description": "Add ESLint and Prettier configuration to the project",
103
+ "script": "./scripts/add-linting.js",
104
+ "options": [
105
+ {
106
+ "flags": "--typescript",
107
+ "description": "Include TypeScript ESLint rules"
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ "name": "add-testing",
113
+ "description": "Add Jest or Vitest testing setup with example tests",
114
+ "script": "./scripts/add-testing.js",
91
115
  "options": [
92
116
  {
93
- "flags": "-p, --path <path>",
94
- "description": "Base path where to create the feature",
95
- "default": "./src/features"
117
+ "flags": "-r, --runner <runner>",
118
+ "description": "Test runner to use",
119
+ "choices": ["jest", "vitest"],
120
+ "default": "vitest"
96
121
  }
97
122
  ]
98
123
  }
@@ -100,37 +125,36 @@ Create `.cli-agent.json` in your project root:
100
125
  }
101
126
  ```
102
127
 
103
- ### 2. Create your script
128
+ ### 2. Create your scripts
104
129
 
105
- Create `scripts/generate-feature.js`:
130
+ Create `scripts/init.js`:
106
131
 
107
132
  ```javascript
108
133
  export default async function(context) {
109
134
  const name = context.args.name;
110
- const path = context.options.path;
111
135
 
112
- // Your logic here...
136
+ // Your initialization logic here...
113
137
 
114
138
  return {
115
139
  success: true,
116
- message: `Created feature: ${name}`,
140
+ message: `Initialized project: ${name}`,
117
141
  data: {
118
142
  name,
119
- path: `${path}/${name}`,
120
- files: ['index.ts', 'component.tsx', 'hook.ts', 'types.ts']
143
+ path: `./${name}`,
144
+ files: ['package.json', 'tsconfig.json', 'src/index.ts']
121
145
  }
122
146
  };
123
147
  }
124
148
  ```
125
149
 
126
- ### 3. Run your command
150
+ ### 3. Run your commands
127
151
 
128
152
  ```bash
129
153
  # Human-friendly output
130
- cli-agent feature-folder user-profile
154
+ cli-agent init my-project
131
155
 
132
156
  # JSON output for AI agents
133
- cli-agent feature-folder user-profile --format json
157
+ cli-agent init my-project --format json
134
158
  ```
135
159
 
136
160
  ## Command Discovery
@@ -142,7 +166,7 @@ cli-agent feature-folder user-profile --format json
142
166
  cli-agent list
143
167
 
144
168
  # Show help for a specific command
145
- cli-agent feature-folder --help
169
+ cli-agent init --help
146
170
  ```
147
171
 
148
172
  ### For AI Agents
@@ -157,13 +181,19 @@ Output:
157
181
  {
158
182
  "success": true,
159
183
  "data": {
160
- "name": "my-cli",
184
+ "name": "project-cli",
161
185
  "commands": [
162
186
  {
163
- "name": "feature-folder",
164
- "description": "Generate a new feature folder with component, hook, test, and type files",
165
- "arguments": [{ "name": "name", "description": "Feature name", "required": true }],
166
- "options": [{ "flags": "-p, --path <path>", "description": "Base path", "default": "./src/features" }]
187
+ "name": "init",
188
+ "description": "Initialize a new project with standard folder structure and configuration files",
189
+ "arguments": [{ "name": "name", "description": "Project name", "required": true }],
190
+ "options": []
191
+ },
192
+ {
193
+ "name": "add-linting",
194
+ "description": "Add ESLint and Prettier configuration to the project",
195
+ "arguments": [],
196
+ "options": [{ "flags": "--typescript", "description": "Include TypeScript ESLint rules" }]
167
197
  }
168
198
  ]
169
199
  }
@@ -187,13 +217,12 @@ Output:
187
217
  {
188
218
  "tools": [
189
219
  {
190
- "name": "feature-folder",
191
- "description": "Generate a new feature folder with component, hook, test, and type files",
220
+ "name": "init",
221
+ "description": "Initialize a new project with standard folder structure and configuration files",
192
222
  "inputSchema": {
193
223
  "type": "object",
194
224
  "properties": {
195
- "name": { "type": "string", "description": "Feature name" },
196
- "path": { "type": "string", "description": "Base path", "default": "./src/features" }
225
+ "name": { "type": "string", "description": "Project name" }
197
226
  },
198
227
  "required": ["name"]
199
228
  }
@@ -249,18 +278,18 @@ cli-agent looks for configuration in this order:
249
278
 
250
279
  ### Writing Effective Descriptions
251
280
 
252
- Good descriptions are crucial for AI agents to match user intent:
281
+ Good descriptions help AI agents match user intent to the right command:
253
282
 
254
283
  ```json
255
284
  {
256
- "name": "feature-folder",
257
- "description": "Generate a new feature folder with component, hook, test, and type files"
285
+ "name": "init",
286
+ "description": "Initialize a new project with standard folder structure and configuration files"
258
287
  }
259
288
  ```
260
289
 
261
290
  ```json
262
291
  {
263
- "name": "db:migrate",
292
+ "name": "db-migrate",
264
293
  "description": "Run database migrations to update schema to latest version"
265
294
  }
266
295
  ```
@@ -285,7 +314,7 @@ Scripts must export a default async function:
285
314
  */
286
315
  export default async function(context) {
287
316
  // context.args - positional arguments { name: 'value' }
288
- // context.options - command options { path: './src', verbose: true }
317
+ // context.options - command options { typescript: true, runner: 'vitest' }
289
318
  // context.cwd - current working directory
290
319
  // context.format - 'human' or 'json'
291
320
 
@@ -309,8 +338,8 @@ export default async function(context: ScriptContext): Promise<CommandResult> {
309
338
 
310
339
  return {
311
340
  success: true,
312
- message: `Hello, ${name}!`,
313
- data: { greeting: `Hello, ${name}!` }
341
+ message: `Initialized ${name}`,
342
+ data: { name }
314
343
  };
315
344
  }
316
345
  ```
@@ -330,13 +359,13 @@ Shell scripts receive context via environment variables:
330
359
  # CWD: CLI_AGENT_CWD
331
360
 
332
361
  NAME="${CLI_AGENT_ARG_NAME}"
333
- PATH_OPT="${CLI_AGENT_OPT_PATH:-./src/features}"
362
+ TYPESCRIPT="${CLI_AGENT_OPT_TYPESCRIPT:-false}"
334
363
 
335
364
  # Output JSON for structured response
336
365
  if [ "$CLI_AGENT_FORMAT" = "json" ]; then
337
- echo "{\"success\": true, \"data\": {\"name\": \"$NAME\", \"path\": \"$PATH_OPT\"}}"
366
+ echo "{\"success\": true, \"data\": {\"name\": \"$NAME\"}}"
338
367
  else
339
- echo "Created feature: $NAME at $PATH_OPT"
368
+ echo "Initialized project: $NAME"
340
369
  fi
341
370
  ```
342
371
 
@@ -358,6 +387,35 @@ All commands automatically have these options:
358
387
  | `list` | List all available commands |
359
388
  | `mcp:manifest` | Generate MCP tool manifest |
360
389
 
390
+ ## Multi-Command Orchestration
391
+
392
+ cli-agent is designed to be called multiple times by an AI agent. The **agent** orchestrates the execution flow based on user intent:
393
+
394
+ ```mermaid
395
+ sequenceDiagram
396
+ participant User
397
+ participant Agent as AI Agent
398
+ participant CLI as cli-agent
399
+
400
+ User->>Agent: "Set up my project with linting and tests"
401
+ Agent->>CLI: cli-agent list --format json
402
+ CLI-->>Agent: Command catalog (JSON)
403
+ Agent->>Agent: Match intent to commands
404
+ Agent->>CLI: cli-agent init my-project --format json
405
+ CLI-->>Agent: {"success": true, ...}
406
+ Agent->>CLI: cli-agent add-linting --format json
407
+ CLI-->>Agent: {"success": true, ...}
408
+ Agent->>CLI: cli-agent add-testing --format json
409
+ CLI-->>Agent: {"success": true, ...}
410
+ Agent->>User: "Project setup complete with linting and tests"
411
+ ```
412
+
413
+ **Key points:**
414
+ - The AI agent decides which commands to run and in what order
415
+ - cli-agent executes one command per invocation
416
+ - If a command fails, the agent can stop the sequence
417
+ - cli-agent provides discovery, execution, and structured output
418
+
361
419
  ## Using Utilities in Scripts
362
420
 
363
421
  cli-agent exports utility functions for use in your scripts:
@@ -396,85 +454,14 @@ export default async function(context) {
396
454
  }
397
455
  ```
398
456
 
399
- ## Example: Complete Feature Generator
400
-
401
- `.cli-agent.json`:
402
- ```json
403
- {
404
- "name": "project-cli",
405
- "commands": [
406
- {
407
- "name": "feature",
408
- "description": "Generate a new feature folder with React component, custom hook, tests, and TypeScript types",
409
- "script": "./scripts/generate-feature.js",
410
- "arguments": [
411
- { "name": "name", "description": "Feature name in kebab-case (e.g., 'user-profile')", "required": true }
412
- ],
413
- "options": [
414
- { "flags": "-p, --path <path>", "description": "Base path for features", "default": "./src/features" },
415
- { "flags": "--no-test", "description": "Skip test file generation" },
416
- { "flags": "--no-hook", "description": "Skip hook file generation" }
417
- ]
418
- }
419
- ]
420
- }
421
- ```
422
-
423
- `scripts/generate-feature.js`:
424
- ```javascript
425
- import { toKebabCase, toPascalCase, createDirectory, createFile, pathExists } from '@nicolasmondain/cli-agent';
426
- import { resolve } from 'node:path';
427
-
428
- export default async function(context) {
429
- const name = toKebabCase(context.args.name);
430
- const pascalName = toPascalCase(name);
431
- const basePath = context.options.path;
432
- const featurePath = resolve(context.cwd, basePath, name);
433
-
434
- if (await pathExists(featurePath)) {
435
- return { success: false, error: `Feature "${name}" already exists at ${featurePath}` };
436
- }
437
-
438
- const files = [];
439
-
440
- await createDirectory(featurePath);
441
-
442
- // Component
443
- await createFile(`${featurePath}/${pascalName}.tsx`, `export function ${pascalName}() {\n return <div>${pascalName}</div>;\n}\n`);
444
- files.push(`${pascalName}.tsx`);
445
-
446
- // Hook
447
- if (context.options.hook !== false) {
448
- await createFile(`${featurePath}/use${pascalName}.ts`, `export function use${pascalName}() {\n return {};\n}\n`);
449
- files.push(`use${pascalName}.ts`);
450
- }
451
-
452
- // Test
453
- if (context.options.test !== false) {
454
- await createFile(`${featurePath}/${pascalName}.test.tsx`, `import { ${pascalName} } from './${pascalName}';\n\ndescribe('${pascalName}', () => {\n it('renders', () => {});\n});\n`);
455
- files.push(`${pascalName}.test.tsx`);
456
- }
457
-
458
- // Index
459
- await createFile(`${featurePath}/index.ts`, `export * from './${pascalName}';\n`);
460
- files.push('index.ts');
461
-
462
- return {
463
- success: true,
464
- message: `Created feature "${name}" with ${files.length} files`,
465
- data: { name, path: featurePath, files }
466
- };
467
- }
468
- ```
469
-
470
457
  ## Project Structure
471
458
 
472
459
  ```
473
460
  your-project/
474
461
  ├── .cli-agent.json # CLI configuration
475
462
  ├── scripts/
476
- │ ├── generate-feature.js # JavaScript script
477
- │ ├── run-migrations.ts # TypeScript script
463
+ │ ├── init.js # JavaScript script
464
+ │ ├── add-linting.ts # TypeScript script
478
465
  │ └── deploy.sh # Shell script
479
466
  └── package.json
480
467
  ```
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-command.factory.d.ts","sourceRoot":"","sources":["../../src/command/dynamic-command.factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,4BAA4B,CAAC;AAShF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAgGT"}
1
+ {"version":3,"file":"dynamic-command.factory.d.ts","sourceRoot":"","sources":["../../src/command/dynamic-command.factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,4BAA4B,CAAC;AAShF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAiHT"}
@@ -45,12 +45,20 @@ export function createDynamicCommand(config, configDir) {
45
45
  }
46
46
  }
47
47
  }
48
- // Add standard options (always available for all commands)
49
- command
50
- .option("--format <format>", "Output format: human or json", "human")
51
- .option("--quiet", "Suppress all output except errors")
52
- .option("--verbose", "Show detailed output")
53
- .option("--debug", "Show debug information");
48
+ // Add standard options (only if not already defined in config)
49
+ const existingFlags = new Set((config.options ?? []).flatMap((opt) => opt.flags.split(",").map((f) => f.trim().split(/[\s<[]/)[0])));
50
+ if (!existingFlags.has("--format")) {
51
+ command.option("--format <format>", "Output format: human or json", "human");
52
+ }
53
+ if (!existingFlags.has("--quiet")) {
54
+ command.option("--quiet", "Suppress all output except errors");
55
+ }
56
+ if (!existingFlags.has("--verbose")) {
57
+ command.option("--verbose", "Show detailed output");
58
+ }
59
+ if (!existingFlags.has("--debug")) {
60
+ command.option("--debug", "Show debug information");
61
+ }
54
62
  // Add action handler
55
63
  command.action(async (...actionArgs) => {
56
64
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-command.factory.js","sourceRoot":"","sources":["../../src/command/dynamic-command.factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,aAAa,GAEd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGrE;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAqB,EACrB,SAAiB;IAEjB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzC,kBAAkB;IAClB,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAED,2BAA2B;IAC3B,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,cAAc;IACd,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBACjB,OAAO,CAAC,cAAc,CACpB,GAAG,CAAC,KAAK,EACT,GAAG,CAAC,WAAW,IAAI,EAAE,EACrB,GAAG,CAAC,OAAuC,CAC5C,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM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C,IAAI,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;gBAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,OAAgC;IACvD,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IAClC,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IAClC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,MAAc;IACpC,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AAC9C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicolasmondain/cli-agent",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Generic CLI wrapper for executing external scripts, designed for both human developers and AI agents (MCP compatible)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",