ai-cli 0.0.12 → 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/package.json +33 -34
- package/src/cli.test.ts +95 -0
- package/src/commands/completions.ts +296 -0
- package/src/commands/image.ts +132 -0
- package/src/commands/models.ts +117 -0
- package/src/commands/text.ts +113 -0
- package/src/commands/video.ts +109 -0
- package/src/index.ts +30 -0
- package/src/lib/color.ts +5 -0
- package/src/lib/h264-wasm.ts +164 -0
- package/src/lib/h264.test.ts +48 -0
- package/src/lib/jobs.ts +192 -0
- package/src/lib/kitty.ts +55 -0
- package/src/lib/models.test.ts +197 -0
- package/src/lib/models.ts +163 -0
- package/src/lib/mp4.test.ts +231 -0
- package/src/lib/mp4.ts +560 -0
- package/src/lib/openh264.d.mts +28 -0
- package/src/lib/openh264.mjs +423 -0
- package/src/lib/openh264.wasm +0 -0
- package/src/lib/openh264.wasm.d.ts +2 -0
- package/src/lib/output.ts +97 -0
- package/src/lib/p-map.test.ts +63 -0
- package/src/lib/p-map.ts +30 -0
- package/src/lib/parse.test.ts +114 -0
- package/src/lib/parse.ts +44 -0
- package/src/lib/png.test.ts +104 -0
- package/src/lib/png.ts +90 -0
- package/src/lib/progress.ts +214 -0
- package/src/lib/shimmer.test.ts +39 -0
- package/src/lib/shimmer.ts +42 -0
- package/src/lib/stdin.ts +31 -0
- package/README.md +0 -298
- package/dist/ai.mjs +0 -627
package/README.md
DELETED
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
# ai-cli
|
|
2
|
-
|
|
3
|
-
Minimal terminal AI assistant.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g ai-cli
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Setup
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
ai init
|
|
15
|
-
```
|
|
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)
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
ai # interactive mode
|
|
23
|
-
ai "hello" # single message
|
|
24
|
-
ai -m gpt-5 "hello" # use specific model
|
|
25
|
-
ai --image ./img.png "what?" # analyze image (single message)
|
|
26
|
-
ai -l # list models
|
|
27
|
-
echo "explain this" | ai # pipe input
|
|
28
|
-
ai --system "respond in Spanish" "hola" # custom system prompt
|
|
29
|
-
|
|
30
|
-
# in interactive mode, ctrl+v to paste image from clipboard
|
|
31
|
-
```
|
|
32
|
-
|
|
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
|
|
77
|
-
|
|
78
|
-
- `-m, --model` - model (default: anthropic/claude-sonnet-4.5)
|
|
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)
|
|
89
|
-
- `-l, --list` - list models
|
|
90
|
-
- `--no-color` - disable color output
|
|
91
|
-
- `-v, --version` - show version
|
|
92
|
-
- `-h, --help` - help
|
|
93
|
-
|
|
94
|
-
## Commands
|
|
95
|
-
|
|
96
|
-
### Chat
|
|
97
|
-
- `/new` - new chat
|
|
98
|
-
- `/chats` - list chats
|
|
99
|
-
- `/chat <n>` - load chat
|
|
100
|
-
- `/delete` - delete chat
|
|
101
|
-
- `/clear` - clear screen
|
|
102
|
-
|
|
103
|
-
### Files
|
|
104
|
-
- `/copy` - copy response
|
|
105
|
-
- `/rollback` - undo changes
|
|
106
|
-
|
|
107
|
-
### Context
|
|
108
|
-
- `/usage` - token usage and cost
|
|
109
|
-
- `/compress` - compress history
|
|
110
|
-
- `/plan` - toggle plan mode (think before acting)
|
|
111
|
-
- `/review` - review loop (auto-reviews changes for bugs)
|
|
112
|
-
|
|
113
|
-
### Model
|
|
114
|
-
- `/model` - select model interactively
|
|
115
|
-
- `/model <query>` - switch to matching model
|
|
116
|
-
|
|
117
|
-
### System
|
|
118
|
-
- `/info` - version, model, balance, storage
|
|
119
|
-
- `/processes` - background processes
|
|
120
|
-
- `/memory` - saved memories
|
|
121
|
-
- `/mcp` - mcp servers
|
|
122
|
-
- `/settings` - preferences
|
|
123
|
-
- `/permissions` - tool permission rules
|
|
124
|
-
- `/alias` - shortcuts
|
|
125
|
-
- `/purge` - delete all chats
|
|
126
|
-
- `/help` - commands
|
|
127
|
-
|
|
128
|
-
## Skills
|
|
129
|
-
|
|
130
|
-
Skills extend the AI with specialized capabilities. They follow the [Agent Skills](https://agentskills.io) open standard.
|
|
131
|
-
|
|
132
|
-
### Managing Skills
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
/skills # list installed
|
|
136
|
-
/skills add <url> # install from git
|
|
137
|
-
/skills remove <name> # uninstall
|
|
138
|
-
/skills show <name> # view content
|
|
139
|
-
/skills create <name> # create new
|
|
140
|
-
/skills path # show directory
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Installing Skills
|
|
144
|
-
|
|
145
|
-
Shorthand (like skills.sh):
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
/skills add vercel-labs/agent-skills/skills/react-best-practices
|
|
149
|
-
/skills add anthropics/skills/skills/pdf
|
|
150
|
-
/skills add owner/repo
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Full GitHub URL:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
/skills add https://github.com/anthropics/skills/tree/main/skills/pdf
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Local path:
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
/skills add /path/to/skill
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Creating Skills
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
/skills create my-skill
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Creates `~/.ai-cli/skills/my-skill/SKILL.md`
|
|
172
|
-
|
|
173
|
-
## Rules
|
|
174
|
-
|
|
175
|
-
Custom instructions loaded into every conversation:
|
|
176
|
-
|
|
177
|
-
- `~/.ai-cli/AGENTS.md` - global rules
|
|
178
|
-
- `./AGENTS.md` - project rules
|
|
179
|
-
|
|
180
|
-
Manage with `/rules`:
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
/rules show # view rules
|
|
184
|
-
/rules edit # open in editor
|
|
185
|
-
/rules clear # remove rules
|
|
186
|
-
/rules path # show path
|
|
187
|
-
```
|
|
188
|
-
|
|
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
|
|
215
|
-
|
|
216
|
-
The AI can:
|
|
217
|
-
|
|
218
|
-
**files** - read, write, edit, delete, copy, rename, search
|
|
219
|
-
|
|
220
|
-
**commands** - run shell commands, background processes
|
|
221
|
-
|
|
222
|
-
**memory** - save facts across sessions ("remember X")
|
|
223
|
-
|
|
224
|
-
**web** - search, fetch urls, check weather
|
|
225
|
-
|
|
226
|
-
## MCP
|
|
227
|
-
|
|
228
|
-
Connect to external tools via [Model Context Protocol](https://modelcontextprotocol.io):
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
/mcp # list servers
|
|
232
|
-
/mcp add weather http https://mcp.example.com
|
|
233
|
-
/mcp add db stdio npx @example/mcp-db
|
|
234
|
-
/mcp remove weather # remove server
|
|
235
|
-
/mcp reload # reconnect all
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### Transports
|
|
239
|
-
|
|
240
|
-
- **http** - HTTP endpoint
|
|
241
|
-
- **sse** - server-sent events
|
|
242
|
-
- **stdio** - spawn local process
|
|
243
|
-
|
|
244
|
-
### Config
|
|
245
|
-
|
|
246
|
-
Servers stored in `~/.ai-cli/mcp.json`:
|
|
247
|
-
|
|
248
|
-
```json
|
|
249
|
-
{
|
|
250
|
-
"servers": {
|
|
251
|
-
"weather": {
|
|
252
|
-
"type": "http",
|
|
253
|
-
"url": "https://mcp.example.com"
|
|
254
|
-
},
|
|
255
|
-
"db": {
|
|
256
|
-
"type": "stdio",
|
|
257
|
-
"command": "npx",
|
|
258
|
-
"args": ["@example/mcp-db"]
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
Environment variables expand with `${VAR}` or `${VAR:-default}`.
|
|
265
|
-
|
|
266
|
-
MCP tools are prefixed with server name (e.g., `weather_get_forecast`).
|
|
267
|
-
|
|
268
|
-
## Models
|
|
269
|
-
|
|
270
|
-
Supports fuzzy matching:
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
ai -m claude-4 # → anthropic/claude-sonnet-4
|
|
274
|
-
ai -m gpt-5 # → openai/gpt-5
|
|
275
|
-
ai -m sonnet # → finds sonnet model
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
## Storage
|
|
279
|
-
|
|
280
|
-
All data in `~/.ai-cli/`:
|
|
281
|
-
|
|
282
|
-
```
|
|
283
|
-
~/.ai-cli/
|
|
284
|
-
├── config.json # settings and api key
|
|
285
|
-
├── mcp.json # mcp servers
|
|
286
|
-
├── chats/ # chat history
|
|
287
|
-
├── memories.json # saved memories
|
|
288
|
-
├── skills/ # installed skills
|
|
289
|
-
└── AGENTS.md # global rules
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
## Environment
|
|
293
|
-
|
|
294
|
-
Alternatively set your API key:
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
export AI_GATEWAY_API_KEY=your-key
|
|
298
|
-
```
|