@ai-code-agents/cli 0.1.0-beta.1 → 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/LICENSE.md +7 -0
- package/README.md +175 -0
- package/dist/cli.cjs +378 -214
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +440 -216
- package/dist/cli.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -8
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 Felix Arntz
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# @ai-code-agents/cli
|
|
2
|
+
|
|
3
|
+
CLI for exploring the [ai-code-agents](https://www.npmjs.com/package/ai-code-agents) TypeScript SDK.
|
|
4
|
+
|
|
5
|
+
This package provides a command-line interface for running AI coding agents in various execution environments. It's designed for testing, experimentation, and exploring the capabilities of the AI Code Agents SDK.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @ai-code-agents/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run directly with npx:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @ai-code-agents/cli <command> [options]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
### `docker-code-agent`
|
|
22
|
+
|
|
23
|
+
Runs a code agent in a Docker container to perform a specified task.
|
|
24
|
+
|
|
25
|
+
**Options:**
|
|
26
|
+
|
|
27
|
+
| Option | Description | Required |
|
|
28
|
+
| ----------------------------- | ---------------------------------------------- | -------- |
|
|
29
|
+
| `-p, --prompt <prompt>` | Task prompt for the agent | Yes |
|
|
30
|
+
| `-m, --model <model>` | Model to use for the agent | Yes |
|
|
31
|
+
| `-d, --directory <directory>` | Directory with the project to work on | Yes |
|
|
32
|
+
| `-i, --container-id <id>` | ID of the Docker container | Yes |
|
|
33
|
+
| `-t, --tools <tools>` | Tools to allow (`readonly`, `basic`, or `all`) | No |
|
|
34
|
+
| `-s, --system <system>` | System instruction to guide the agent | No |
|
|
35
|
+
|
|
36
|
+
**Example:**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
ai-code-agents docker-code-agent \
|
|
40
|
+
--prompt "Create a simple Express server" \
|
|
41
|
+
--model "openai/gpt-4.1" \
|
|
42
|
+
--directory "/app" \
|
|
43
|
+
--container-id "my-container-id" \
|
|
44
|
+
--tools "all"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `just-bash-code-agent`
|
|
48
|
+
|
|
49
|
+
Runs a code agent using a simulated bash environment to perform a specified task. This uses the [just-bash](https://www.npmjs.com/package/just-bash) library for an in-memory virtual filesystem and bash shell.
|
|
50
|
+
|
|
51
|
+
**Options:**
|
|
52
|
+
|
|
53
|
+
| Option | Description | Required |
|
|
54
|
+
| ----------------------------------------- | ----------------------------------------------------------------------------------- | -------- |
|
|
55
|
+
| `-p, --prompt <prompt>` | Task prompt for the agent | Yes |
|
|
56
|
+
| `-m, --model <model>` | Model to use for the agent | Yes |
|
|
57
|
+
| `-d, --directory <directory>` | Working directory in the simulated bash environment | No |
|
|
58
|
+
| `-l, --local-directory <local-directory>` | Local directory to mount into the simulated environment (excludes gitignored files) | No |
|
|
59
|
+
| `-t, --tools <tools>` | Tools to allow (`readonly`, `basic`, or `all`) | No |
|
|
60
|
+
| `-s, --system <system>` | System instruction to guide the agent | No |
|
|
61
|
+
|
|
62
|
+
**Example:**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
ai-code-agents just-bash-code-agent \
|
|
66
|
+
--prompt "Create a Python script that prints hello world" \
|
|
67
|
+
--model "anthropic/claude-haiku-4-5" \
|
|
68
|
+
--directory "/home/user/project" \
|
|
69
|
+
--tools "basic"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Example with local directory:**
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
ai-code-agents just-bash-code-agent \
|
|
76
|
+
--prompt "Analyze the code structure and suggest improvements" \
|
|
77
|
+
--model "openai/gpt-4.1-mini" \
|
|
78
|
+
--local-directory "./my-project" \
|
|
79
|
+
--tools "readonly"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `mock-filesystem-code-agent`
|
|
83
|
+
|
|
84
|
+
Runs a code agent on a mock filesystem to perform a specified task. Useful for testing and experimentation without affecting real files.
|
|
85
|
+
|
|
86
|
+
**Options:**
|
|
87
|
+
|
|
88
|
+
| Option | Description | Required |
|
|
89
|
+
| ----------------------------- | ---------------------------------------------- | -------- |
|
|
90
|
+
| `-p, --prompt <prompt>` | Task prompt for the agent | Yes |
|
|
91
|
+
| `-m, --model <model>` | Model to use for the agent | Yes |
|
|
92
|
+
| `-d, --directory <directory>` | Directory with the project to work on | Yes |
|
|
93
|
+
| `-t, --tools <tools>` | Tools to allow (`readonly`, `basic`, or `all`) | No |
|
|
94
|
+
| `-s, --system <system>` | System instruction to guide the agent | No |
|
|
95
|
+
|
|
96
|
+
**Example:**
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
ai-code-agents mock-filesystem-code-agent \
|
|
100
|
+
--prompt "Create a README.md file for this project" \
|
|
101
|
+
--model "google/gemini-3-pro-preview" \
|
|
102
|
+
--directory "/workspace" \
|
|
103
|
+
--tools "basic"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `node-filesystem-code-agent`
|
|
107
|
+
|
|
108
|
+
Runs a code agent locally using Node.js filesystem operations. Recommended for read-only operations.
|
|
109
|
+
|
|
110
|
+
**Options:**
|
|
111
|
+
|
|
112
|
+
| Option | Description | Required |
|
|
113
|
+
| ----------------------------- | ---------------------------------------------- | -------- |
|
|
114
|
+
| `-p, --prompt <prompt>` | Task prompt for the agent | Yes |
|
|
115
|
+
| `-m, --model <model>` | Model to use for the agent | Yes |
|
|
116
|
+
| `-d, --directory <directory>` | Directory with the project to work on | Yes |
|
|
117
|
+
| `-t, --tools <tools>` | Tools to allow (`readonly`, `basic`, or `all`) | No |
|
|
118
|
+
| `-s, --system <system>` | System instruction to guide the agent | No |
|
|
119
|
+
|
|
120
|
+
**Example:**
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
ai-code-agents node-filesystem-code-agent \
|
|
124
|
+
--prompt "Analyze the project structure and list all TypeScript files" \
|
|
125
|
+
--model "openai/gpt-4.1" \
|
|
126
|
+
--directory "./my-project" \
|
|
127
|
+
--tools "readonly"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### `unsafe-local-code-agent`
|
|
131
|
+
|
|
132
|
+
Runs a code agent locally with full filesystem and command execution access. **Use with caution—this environment can modify your local files and execute arbitrary commands.**
|
|
133
|
+
|
|
134
|
+
**Options:**
|
|
135
|
+
|
|
136
|
+
| Option | Description | Required |
|
|
137
|
+
| ----------------------------- | ---------------------------------------------- | -------- |
|
|
138
|
+
| `-p, --prompt <prompt>` | Task prompt for the agent | Yes |
|
|
139
|
+
| `-m, --model <model>` | Model to use for the agent | Yes |
|
|
140
|
+
| `-d, --directory <directory>` | Directory with the project to work on | Yes |
|
|
141
|
+
| `-t, --tools <tools>` | Tools to allow (`readonly`, `basic`, or `all`) | No |
|
|
142
|
+
| `-s, --system <system>` | System instruction to guide the agent | No |
|
|
143
|
+
|
|
144
|
+
**Example:**
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
ai-code-agents unsafe-local-code-agent \
|
|
148
|
+
--prompt "Install dependencies and run the test suite" \
|
|
149
|
+
--model "anthropic/claude-sonnet-4-5" \
|
|
150
|
+
--directory "./my-project" \
|
|
151
|
+
--tools "all"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Tool Safety Levels
|
|
155
|
+
|
|
156
|
+
All commands support a `--tools` option to control which tools are available to the agent:
|
|
157
|
+
|
|
158
|
+
- **`readonly`** (default): Only read operations (safe for production). Includes `read_file`, `read_many_files`, `get_project_file_structure`, `glob`, `list_directory`.
|
|
159
|
+
- **`basic`**: Read and write operations, no deletions or commands. Adds `write_file`, `edit_file`, `move_file`, `copy_file`.
|
|
160
|
+
- **`all`**: Full access including deletions and command execution. Adds `delete_file`, `run_command`.
|
|
161
|
+
|
|
162
|
+
## Environment Variables
|
|
163
|
+
|
|
164
|
+
The CLI automatically loads environment variables from a `.env` file in your current directory. This is useful for configuring API keys:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# .env
|
|
168
|
+
OPENAI_API_KEY=sk-...
|
|
169
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
170
|
+
GOOGLE_GENERATIVE_AI_API_KEY=...
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Contributing
|
|
174
|
+
|
|
175
|
+
Contributions to the AI Code Agents SDK are welcome and highly appreciated. Please review the [contributing guidelines](https://github.com/felixarntz/ai-code-agents/blob/main/CONTRIBUTING.md) to learn more about how you can contribute.
|