ai-cli 0.0.2-beta.0 → 0.0.4
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 +165 -85
- package/dist/ai.mjs +409 -530
- package/package.json +30 -25
package/README.md
CHANGED
|
@@ -1,145 +1,225 @@
|
|
|
1
1
|
# ai-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
minimal terminal AI assistant
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g ai-cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## setup
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
ai init
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
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
|
-
##
|
|
19
|
+
## usage
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
ai # interactive mode
|
|
23
23
|
ai "hello" # single message
|
|
24
24
|
ai -m gpt-5 "hello" # use specific model
|
|
25
|
-
ai --image ./img.png "what?" # analyze image
|
|
26
|
-
ai -l # list
|
|
25
|
+
ai --image ./img.png "what?" # analyze image (single message)
|
|
26
|
+
ai -l # list models
|
|
27
27
|
echo "explain this" | ai # pipe input
|
|
28
|
+
|
|
29
|
+
# in interactive mode, ctrl+v to paste image from clipboard
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
##
|
|
32
|
+
## options
|
|
31
33
|
|
|
32
34
|
- `-m, --model` - model (default: anthropic/claude-sonnet-4.5)
|
|
33
|
-
- `--image` - attach image file
|
|
34
|
-
- `-l, --list` - list
|
|
35
|
+
- `--image` - attach image file
|
|
36
|
+
- `-l, --list` - list models
|
|
35
37
|
- `-h, --help` - help
|
|
36
38
|
|
|
37
|
-
##
|
|
39
|
+
## commands
|
|
40
|
+
|
|
41
|
+
### chat
|
|
42
|
+
- `/new` - new chat
|
|
43
|
+
- `/chats` - list chats
|
|
44
|
+
- `/chat <n>` - load chat
|
|
45
|
+
- `/delete` - delete chat
|
|
46
|
+
- `/clear` - clear screen
|
|
47
|
+
|
|
48
|
+
### files
|
|
49
|
+
- `/copy` - copy response
|
|
50
|
+
- `/rollback` - undo changes
|
|
51
|
+
|
|
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
|
|
63
|
+
- `/usage` - token usage and cost
|
|
64
|
+
- `/compress` - compress history
|
|
65
|
+
|
|
66
|
+
### model
|
|
67
|
+
- `/model` - select model interactively
|
|
68
|
+
- `/model <query>` - switch to matching model
|
|
69
|
+
|
|
70
|
+
### system
|
|
71
|
+
- `/info` - version, model, balance, storage
|
|
72
|
+
- `/processes` - background processes
|
|
73
|
+
- `/memory` - saved memories
|
|
74
|
+
- `/mcp` - mcp servers
|
|
75
|
+
- `/settings` - preferences
|
|
76
|
+
- `/alias` - shortcuts
|
|
77
|
+
- `/purge` - delete all chats
|
|
78
|
+
- `/help` - commands
|
|
79
|
+
|
|
80
|
+
## skills
|
|
38
81
|
|
|
39
|
-
|
|
82
|
+
skills extend the AI with specialized capabilities. they follow the [Agent Skills](https://agentskills.io) open standard.
|
|
40
83
|
|
|
41
|
-
###
|
|
84
|
+
### managing skills
|
|
42
85
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
86
|
+
```bash
|
|
87
|
+
/skills # list installed
|
|
88
|
+
/skills add <url> # install from git
|
|
89
|
+
/skills remove <name> # uninstall
|
|
90
|
+
/skills show <name> # view content
|
|
91
|
+
/skills create <name> # create new
|
|
92
|
+
/skills path # show directory
|
|
93
|
+
```
|
|
50
94
|
|
|
51
|
-
|
|
52
|
-
- `/copy` - copy last response to clipboard
|
|
53
|
-
- `/rollback` - view/undo file changes
|
|
54
|
-
- `/diff` - view recent file changes
|
|
95
|
+
### installing skills
|
|
55
96
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
97
|
+
shorthand (like skills.sh):
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
/skills add vercel-labs/agent-skills/skills/react-best-practices
|
|
101
|
+
/skills add anthropics/skills/skills/pdf
|
|
102
|
+
/skills add owner/repo
|
|
103
|
+
```
|
|
60
104
|
|
|
61
|
-
|
|
62
|
-
- `/list` - select model (with search)
|
|
63
|
-
- `/model` - show current model
|
|
105
|
+
full github url:
|
|
64
106
|
|
|
65
|
-
|
|
66
|
-
|
|
107
|
+
```bash
|
|
108
|
+
/skills add https://github.com/anthropics/skills/tree/main/skills/pdf
|
|
109
|
+
```
|
|
67
110
|
|
|
68
|
-
|
|
69
|
-
- `/memory` - view saved memories
|
|
70
|
-
- `/memory clear` - clear all memories
|
|
111
|
+
local path:
|
|
71
112
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- `/init` - setup api key
|
|
76
|
-
- `/credits` - show balance
|
|
77
|
-
- `/storage` - show storage info
|
|
78
|
-
- `/version` - show version
|
|
79
|
-
- `/help` - show commands
|
|
113
|
+
```bash
|
|
114
|
+
/skills add /path/to/skill
|
|
115
|
+
```
|
|
80
116
|
|
|
81
|
-
|
|
82
|
-
- `exit` or `quit`
|
|
117
|
+
### creating skills
|
|
83
118
|
|
|
84
|
-
|
|
119
|
+
```bash
|
|
120
|
+
/skills create my-skill
|
|
121
|
+
```
|
|
85
122
|
|
|
86
|
-
|
|
123
|
+
creates `~/.ai-cli/skills/my-skill/SKILL.md`
|
|
87
124
|
|
|
88
|
-
|
|
89
|
-
- `CLAUDE.local.md` - local instructions (not committed)
|
|
90
|
-
- `AGENTS.md` - agent-specific instructions
|
|
91
|
-
- `.cursorrules` - cursor rules
|
|
92
|
-
- `.cursor/rules/*.md` - cursor rule files (supports globs and alwaysApply)
|
|
93
|
-
- `~/CLAUDE.md` - global instructions
|
|
125
|
+
## rules
|
|
94
126
|
|
|
95
|
-
|
|
127
|
+
custom instructions loaded into every conversation:
|
|
96
128
|
|
|
97
|
-
|
|
129
|
+
- `~/.ai-cli/AGENTS.md` - global rules
|
|
130
|
+
- `./AGENTS.md` - project rules
|
|
98
131
|
|
|
99
|
-
|
|
132
|
+
manage with `/rules`:
|
|
100
133
|
|
|
101
134
|
```bash
|
|
102
|
-
/
|
|
103
|
-
/
|
|
104
|
-
/
|
|
105
|
-
/
|
|
106
|
-
/alias # list all aliases
|
|
135
|
+
/rules show # view rules
|
|
136
|
+
/rules edit # open in editor
|
|
137
|
+
/rules clear # remove rules
|
|
138
|
+
/rules path # show path
|
|
107
139
|
```
|
|
108
140
|
|
|
109
|
-
|
|
141
|
+
## tools
|
|
142
|
+
|
|
143
|
+
the AI can:
|
|
110
144
|
|
|
111
|
-
|
|
145
|
+
**files** - read, write, edit, delete, copy, rename, search
|
|
112
146
|
|
|
113
|
-
|
|
147
|
+
**commands** - run shell commands, background processes
|
|
114
148
|
|
|
115
|
-
**
|
|
116
|
-
- read/write/edit files
|
|
117
|
-
- create folders
|
|
118
|
-
- rename/move/copy/delete files
|
|
119
|
-
- search in files
|
|
120
|
-
- find files by pattern
|
|
149
|
+
**memory** - save facts across sessions ("remember X")
|
|
121
150
|
|
|
122
|
-
**
|
|
123
|
-
- run shell commands (build, test, install)
|
|
124
|
-
- start background processes (dev servers)
|
|
125
|
-
- manage running processes
|
|
151
|
+
**web** - search, fetch urls, check weather
|
|
126
152
|
|
|
127
|
-
|
|
128
|
-
- say "remember X" to save facts across sessions
|
|
129
|
-
- ask "what do you remember" to recall
|
|
153
|
+
## mcp
|
|
130
154
|
|
|
131
|
-
|
|
155
|
+
connect to external tools via [model context protocol](https://modelcontextprotocol.io):
|
|
132
156
|
|
|
133
|
-
|
|
157
|
+
```bash
|
|
158
|
+
/mcp # list servers
|
|
159
|
+
/mcp add weather http https://mcp.example.com
|
|
160
|
+
/mcp add db stdio npx @example/mcp-db
|
|
161
|
+
/mcp remove weather # remove server
|
|
162
|
+
/mcp reload # reconnect all
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### transports
|
|
166
|
+
|
|
167
|
+
- **http** - HTTP endpoint
|
|
168
|
+
- **sse** - server-sent events
|
|
169
|
+
- **stdio** - spawn local process
|
|
170
|
+
|
|
171
|
+
### config
|
|
172
|
+
|
|
173
|
+
servers stored in `~/.ai-cli/mcp.json`:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"servers": {
|
|
178
|
+
"weather": {
|
|
179
|
+
"type": "http",
|
|
180
|
+
"url": "https://mcp.example.com"
|
|
181
|
+
},
|
|
182
|
+
"db": {
|
|
183
|
+
"type": "stdio",
|
|
184
|
+
"command": "npx",
|
|
185
|
+
"args": ["@example/mcp-db"]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
environment variables expand with `${VAR}` or `${VAR:-default}`.
|
|
192
|
+
|
|
193
|
+
mcp tools are prefixed with server name (e.g., `weather_get_forecast`).
|
|
194
|
+
|
|
195
|
+
## models
|
|
196
|
+
|
|
197
|
+
supports fuzzy matching:
|
|
134
198
|
|
|
135
199
|
```bash
|
|
136
200
|
ai -m claude-4 # → anthropic/claude-sonnet-4
|
|
137
201
|
ai -m gpt-5 # → openai/gpt-5
|
|
138
|
-
ai -m sonnet # → finds
|
|
202
|
+
ai -m sonnet # → finds sonnet model
|
|
139
203
|
```
|
|
140
204
|
|
|
141
|
-
##
|
|
205
|
+
## storage
|
|
142
206
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
207
|
+
all data in `~/.ai-cli/`:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
~/.ai-cli/
|
|
211
|
+
├── config.json # settings and api key
|
|
212
|
+
├── mcp.json # mcp servers
|
|
213
|
+
├── chats/ # chat history
|
|
214
|
+
├── memories.json # saved memories
|
|
215
|
+
├── skills/ # installed skills
|
|
216
|
+
└── AGENTS.md # global rules
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## environment
|
|
220
|
+
|
|
221
|
+
alternatively set your API key:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
export AI_GATEWAY_API_KEY=your-key
|
|
225
|
+
```
|