ai-cli 0.0.10 → 0.0.12

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.
Files changed (3) hide show
  1. package/README.md +122 -49
  2. package/dist/ai.mjs +377 -238
  3. package/package.json +17 -14
package/README.md CHANGED
@@ -1,22 +1,22 @@
1
1
  # ai-cli
2
2
 
3
- minimal terminal AI assistant
3
+ Minimal terminal AI assistant.
4
4
 
5
- ## install
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  npm install -g ai-cli
9
9
  ```
10
10
 
11
- ## setup
11
+ ## Setup
12
12
 
13
13
  ```bash
14
14
  ai init
15
15
  ```
16
16
 
17
- get your API key from [Vercel AI Gateway](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys&title=Go+to+AI+Gateway)
17
+ Get your API key from [Vercel AI Gateway](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys&title=Go+to+AI+Gateway)
18
18
 
19
- ## usage
19
+ ## Usage
20
20
 
21
21
  ```bash
22
22
  ai # interactive mode
@@ -25,63 +25,111 @@ ai -m gpt-5 "hello" # use specific model
25
25
  ai --image ./img.png "what?" # analyze image (single message)
26
26
  ai -l # list models
27
27
  echo "explain this" | ai # pipe input
28
+ ai --system "respond in Spanish" "hola" # custom system prompt
28
29
 
29
30
  # in interactive mode, ctrl+v to paste image from clipboard
30
31
  ```
31
32
 
32
- ## options
33
+ ## Headless Mode
34
+
35
+ Run the full agent non-interactively. Useful for CI pipelines, scripts, and automation.
36
+
37
+ ```bash
38
+ ai -p "explain this codebase" # output to stdout
39
+ ai -p --json "write tests for src/auth.ts" > result.json # structured JSON
40
+ ai -p --force "fix all type errors" # skip confirmations
41
+ ai -p --no-save "what dependencies are outdated?" # ephemeral (no history)
42
+ git diff | ai -p "review this for bugs" # pipe + headless
43
+ ai -p -m gpt-5 --force "refactor the database layer" # combine flags
44
+ ai -p --plan "how should I refactor auth?" # plan mode (read-only)
45
+ ai -p -r <chatId> "continue" # resume a session
46
+ ai -p --timeout 60 "fix type errors" # abort after 60s
47
+ ai -p -q "explain this codebase" # suppress stderr status
48
+ ```
49
+
50
+ Exit codes: `0` success, `1` error, `2` agent stuck.
51
+
52
+ **Note:** When `--timeout` fires during a tool execution (e.g., mid-file-write), the agent is interrupted immediately. The workspace may contain partial changes. Combine with version control or review the working tree after a timeout.
53
+
54
+ JSON output format:
55
+
56
+ ```json
57
+ {
58
+ "output": "...",
59
+ "model": "anthropic/claude-sonnet-4.5",
60
+ "tokens": 1234,
61
+ "cost": 0.05,
62
+ "exitCode": 0,
63
+ "chatId": "abc123",
64
+ "usage": {
65
+ "inputTokens": 800,
66
+ "outputTokens": 434,
67
+ "cacheReadTokens": 0,
68
+ "cacheWriteTokens": 0,
69
+ "reasoningTokens": 0
70
+ }
71
+ }
72
+ ```
73
+
74
+ On error, includes an `error` field with the message.
75
+
76
+ ## Options
33
77
 
34
78
  - `-m, --model` - model (default: anthropic/claude-sonnet-4.5)
35
79
  - `--image` - attach image file
80
+ - `-r, --resume` - resume a previous chat by ID
81
+ - `--plan` - start in plan mode (think before acting)
82
+ - `-p, --print` - headless mode: full agent, output to stdout, then exit
83
+ - `--json` - structured JSON output (implies --print)
84
+ - `--system` - append custom text to the system prompt
85
+ - `--force` - auto-approve all tool actions (--print only)
86
+ - `--no-save` - don't persist the chat to history (--print only)
87
+ - `--timeout` - abort after N seconds (--print only)
88
+ - `-q, --quiet` - suppress stderr status output (--print only)
36
89
  - `-l, --list` - list models
90
+ - `--no-color` - disable color output
91
+ - `-v, --version` - show version
37
92
  - `-h, --help` - help
38
93
 
39
- ## commands
94
+ ## Commands
40
95
 
41
- ### chat
96
+ ### Chat
42
97
  - `/new` - new chat
43
98
  - `/chats` - list chats
44
99
  - `/chat <n>` - load chat
45
100
  - `/delete` - delete chat
46
101
  - `/clear` - clear screen
47
102
 
48
- ### files
103
+ ### Files
49
104
  - `/copy` - copy response
50
105
  - `/rollback` - undo changes
51
106
 
52
- ### git
53
- - `/git status` - file status
54
- - `/git diff` - unstaged changes
55
- - `/git staged` - staged changes
56
- - `/git branch` - list/switch branches
57
- - `/git commit` - ai-generated commit message
58
- - `/git push` - push to remote
59
- - `/git log` - recent commits
60
- - `/git stash` - stash/pop changes
61
-
62
- ### context
107
+ ### Context
63
108
  - `/usage` - token usage and cost
64
109
  - `/compress` - compress history
110
+ - `/plan` - toggle plan mode (think before acting)
111
+ - `/review` - review loop (auto-reviews changes for bugs)
65
112
 
66
- ### model
113
+ ### Model
67
114
  - `/model` - select model interactively
68
115
  - `/model <query>` - switch to matching model
69
116
 
70
- ### system
117
+ ### System
71
118
  - `/info` - version, model, balance, storage
72
119
  - `/processes` - background processes
73
120
  - `/memory` - saved memories
74
121
  - `/mcp` - mcp servers
75
122
  - `/settings` - preferences
123
+ - `/permissions` - tool permission rules
76
124
  - `/alias` - shortcuts
77
125
  - `/purge` - delete all chats
78
126
  - `/help` - commands
79
127
 
80
- ## skills
128
+ ## Skills
81
129
 
82
- skills extend the AI with specialized capabilities. they follow the [Agent Skills](https://agentskills.io) open standard.
130
+ Skills extend the AI with specialized capabilities. They follow the [Agent Skills](https://agentskills.io) open standard.
83
131
 
84
- ### managing skills
132
+ ### Managing Skills
85
133
 
86
134
  ```bash
87
135
  /skills # list installed
@@ -92,9 +140,9 @@ skills extend the AI with specialized capabilities. they follow the [Agent Skill
92
140
  /skills path # show directory
93
141
  ```
94
142
 
95
- ### installing skills
143
+ ### Installing Skills
96
144
 
97
- shorthand (like skills.sh):
145
+ Shorthand (like skills.sh):
98
146
 
99
147
  ```bash
100
148
  /skills add vercel-labs/agent-skills/skills/react-best-practices
@@ -102,34 +150,34 @@ shorthand (like skills.sh):
102
150
  /skills add owner/repo
103
151
  ```
104
152
 
105
- full github url:
153
+ Full GitHub URL:
106
154
 
107
155
  ```bash
108
156
  /skills add https://github.com/anthropics/skills/tree/main/skills/pdf
109
157
  ```
110
158
 
111
- local path:
159
+ Local path:
112
160
 
113
161
  ```bash
114
162
  /skills add /path/to/skill
115
163
  ```
116
164
 
117
- ### creating skills
165
+ ### Creating Skills
118
166
 
119
167
  ```bash
120
168
  /skills create my-skill
121
169
  ```
122
170
 
123
- creates `~/.ai-cli/skills/my-skill/SKILL.md`
171
+ Creates `~/.ai-cli/skills/my-skill/SKILL.md`
124
172
 
125
- ## rules
173
+ ## Rules
126
174
 
127
- custom instructions loaded into every conversation:
175
+ Custom instructions loaded into every conversation:
128
176
 
129
177
  - `~/.ai-cli/AGENTS.md` - global rules
130
178
  - `./AGENTS.md` - project rules
131
179
 
132
- manage with `/rules`:
180
+ Manage with `/rules`:
133
181
 
134
182
  ```bash
135
183
  /rules show # view rules
@@ -138,9 +186,34 @@ manage with `/rules`:
138
186
  /rules path # show path
139
187
  ```
140
188
 
141
- ## tools
189
+ ## Review Loop
190
+
191
+ After the coding agent finishes making file changes, a separate review agent automatically inspects all modifications for severe and high-priority bugs. If it finds issues, it fixes them and re-reviews, up to a configurable number of passes.
192
+
193
+ The review agent runs in its own isolated context with a strict system prompt -- it has no attachment to the code it's reviewing and is intentionally more critical than the coding agent.
194
+
195
+ Enabled by default. Toggle with:
196
+
197
+ ```bash
198
+ /review on # enable
199
+ /review off # disable
200
+ /review # show status
201
+ ```
202
+
203
+ Configure max iterations in `~/.ai-cli/config.json`:
204
+
205
+ ```json
206
+ {
207
+ "review": {
208
+ "enabled": true,
209
+ "maxIterations": 3
210
+ }
211
+ }
212
+ ```
213
+
214
+ ## Tools
142
215
 
143
- the AI can:
216
+ The AI can:
144
217
 
145
218
  **files** - read, write, edit, delete, copy, rename, search
146
219
 
@@ -150,9 +223,9 @@ the AI can:
150
223
 
151
224
  **web** - search, fetch urls, check weather
152
225
 
153
- ## mcp
226
+ ## MCP
154
227
 
155
- connect to external tools via [model context protocol](https://modelcontextprotocol.io):
228
+ Connect to external tools via [Model Context Protocol](https://modelcontextprotocol.io):
156
229
 
157
230
  ```bash
158
231
  /mcp # list servers
@@ -162,15 +235,15 @@ connect to external tools via [model context protocol](https://modelcontextproto
162
235
  /mcp reload # reconnect all
163
236
  ```
164
237
 
165
- ### transports
238
+ ### Transports
166
239
 
167
240
  - **http** - HTTP endpoint
168
241
  - **sse** - server-sent events
169
242
  - **stdio** - spawn local process
170
243
 
171
- ### config
244
+ ### Config
172
245
 
173
- servers stored in `~/.ai-cli/mcp.json`:
246
+ Servers stored in `~/.ai-cli/mcp.json`:
174
247
 
175
248
  ```json
176
249
  {
@@ -188,13 +261,13 @@ servers stored in `~/.ai-cli/mcp.json`:
188
261
  }
189
262
  ```
190
263
 
191
- environment variables expand with `${VAR}` or `${VAR:-default}`.
264
+ Environment variables expand with `${VAR}` or `${VAR:-default}`.
192
265
 
193
- mcp tools are prefixed with server name (e.g., `weather_get_forecast`).
266
+ MCP tools are prefixed with server name (e.g., `weather_get_forecast`).
194
267
 
195
- ## models
268
+ ## Models
196
269
 
197
- supports fuzzy matching:
270
+ Supports fuzzy matching:
198
271
 
199
272
  ```bash
200
273
  ai -m claude-4 # → anthropic/claude-sonnet-4
@@ -202,9 +275,9 @@ ai -m gpt-5 # → openai/gpt-5
202
275
  ai -m sonnet # → finds sonnet model
203
276
  ```
204
277
 
205
- ## storage
278
+ ## Storage
206
279
 
207
- all data in `~/.ai-cli/`:
280
+ All data in `~/.ai-cli/`:
208
281
 
209
282
  ```
210
283
  ~/.ai-cli/
@@ -216,9 +289,9 @@ all data in `~/.ai-cli/`:
216
289
  └── AGENTS.md # global rules
217
290
  ```
218
291
 
219
- ## environment
292
+ ## Environment
220
293
 
221
- alternatively set your API key:
294
+ Alternatively set your API key:
222
295
 
223
296
  ```bash
224
297
  export AI_GATEWAY_API_KEY=your-key