@nicolasmondain/cli-agent 2.1.1 → 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.
Potentially problematic release.
This version of @nicolasmondain/cli-agent might be problematic. Click here for more details.
- package/README.md +35 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# cli-agent
|
|
2
2
|
|
|
3
|
-
>
|
|
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
|
|
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,45 +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
|
|
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
20
|
|
|
21
21
|
```mermaid
|
|
22
22
|
flowchart TD
|
|
23
|
-
A["User: 'Set up my project with linting and tests'"] --> B[
|
|
23
|
+
A["User: 'Set up my project with linting and tests'"] --> B[AI Agent]
|
|
24
24
|
B --> C["cli-agent list --format json"]
|
|
25
|
-
C --> D["Agent
|
|
26
|
-
D --> E["
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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"]
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
## How It Works
|
|
36
38
|
|
|
37
|
-
When
|
|
39
|
+
When an AI agent (like Claude) receives: **"Set up my project with linting and tests"**
|
|
38
40
|
|
|
39
|
-
The
|
|
40
|
-
|
|
41
|
-
1. Reads `.cli-agent.json` (or runs `cli-agent list --format json`)
|
|
42
|
-
2. Matches command descriptions to your intent:
|
|
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
43
|
- `init` → "Initialize a new project with standard structure"
|
|
44
44
|
- `add-linting` → "Add ESLint configuration to the project"
|
|
45
45
|
- `add-testing` → "Add Jest/Vitest testing setup"
|
|
46
|
-
3.
|
|
46
|
+
3. **Execution**: The agent executes each command one by one:
|
|
47
47
|
```bash
|
|
48
48
|
cli-agent init my-project --format json
|
|
49
49
|
cli-agent add-linting --format json
|
|
50
50
|
cli-agent add-testing --format json
|
|
51
51
|
```
|
|
52
|
-
4.
|
|
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.
|
|
53
56
|
|
|
54
57
|
## Features
|
|
55
58
|
|
|
56
|
-
- **
|
|
57
|
-
- **Command Discovery** — `cli-agent list --format json` exposes all commands with
|
|
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
|
|
58
61
|
- **MCP Integration** — Generate MCP tool manifests for native Claude Code integration
|
|
59
62
|
- **Multi-runtime Support** — Execute JavaScript, TypeScript, and shell scripts
|
|
60
63
|
- **AI-First Design** — JSON output, non-interactive execution, predictable exit codes
|
|
@@ -275,7 +278,7 @@ cli-agent looks for configuration in this order:
|
|
|
275
278
|
|
|
276
279
|
### Writing Effective Descriptions
|
|
277
280
|
|
|
278
|
-
Good descriptions
|
|
281
|
+
Good descriptions help AI agents match user intent to the right command:
|
|
279
282
|
|
|
280
283
|
```json
|
|
281
284
|
{
|
|
@@ -386,12 +389,12 @@ All commands automatically have these options:
|
|
|
386
389
|
|
|
387
390
|
## Multi-Command Orchestration
|
|
388
391
|
|
|
389
|
-
cli-agent is designed to be called multiple times by an AI agent. The agent orchestrates the execution flow based on user intent:
|
|
392
|
+
cli-agent is designed to be called multiple times by an AI agent. The **agent** orchestrates the execution flow based on user intent:
|
|
390
393
|
|
|
391
394
|
```mermaid
|
|
392
395
|
sequenceDiagram
|
|
393
396
|
participant User
|
|
394
|
-
participant Agent
|
|
397
|
+
participant Agent as AI Agent
|
|
395
398
|
participant CLI as cli-agent
|
|
396
399
|
|
|
397
400
|
User->>Agent: "Set up my project with linting and tests"
|
|
@@ -399,19 +402,19 @@ sequenceDiagram
|
|
|
399
402
|
CLI-->>Agent: Command catalog (JSON)
|
|
400
403
|
Agent->>Agent: Match intent to commands
|
|
401
404
|
Agent->>CLI: cli-agent init my-project --format json
|
|
402
|
-
CLI-->>Agent: {"success": true,
|
|
405
|
+
CLI-->>Agent: {"success": true, ...}
|
|
403
406
|
Agent->>CLI: cli-agent add-linting --format json
|
|
404
|
-
CLI-->>Agent: {"success": true,
|
|
407
|
+
CLI-->>Agent: {"success": true, ...}
|
|
405
408
|
Agent->>CLI: cli-agent add-testing --format json
|
|
406
|
-
CLI-->>Agent: {"success": true,
|
|
409
|
+
CLI-->>Agent: {"success": true, ...}
|
|
407
410
|
Agent->>User: "Project setup complete with linting and tests"
|
|
408
411
|
```
|
|
409
412
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
-
|
|
413
|
-
-
|
|
414
|
-
-
|
|
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
|
|
415
418
|
|
|
416
419
|
## Using Utilities in Scripts
|
|
417
420
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nicolasmondain/cli-agent",
|
|
3
|
-
"version": "2.1.
|
|
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",
|