@ariacode/cli 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 +21 -0
- package/README.md +404 -0
- package/dist/actions.d.ts +271 -0
- package/dist/actions.js +1809 -0
- package/dist/actions.js.map +1 -0
- package/dist/agent.d.ts +26 -0
- package/dist/agent.js +182 -0
- package/dist/agent.js.map +1 -0
- package/dist/app.d.ts +14 -0
- package/dist/app.js +83 -0
- package/dist/app.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +157 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +170 -0
- package/dist/config.js +291 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +58 -0
- package/dist/context.js +44 -0
- package/dist/context.js.map +1 -0
- package/dist/parser.d.ts +39 -0
- package/dist/parser.js +323 -0
- package/dist/parser.js.map +1 -0
- package/dist/prompts/ask.md +20 -0
- package/dist/prompts/explore.md +38 -0
- package/dist/prompts/patch.md +27 -0
- package/dist/prompts/plan.md +41 -0
- package/dist/prompts/prompts/ask.md +20 -0
- package/dist/prompts/prompts/explore.md +38 -0
- package/dist/prompts/prompts/patch.md +27 -0
- package/dist/prompts/prompts/plan.md +41 -0
- package/dist/prompts/prompts/review.md +33 -0
- package/dist/prompts/review.md +33 -0
- package/dist/provider.d.ts +148 -0
- package/dist/provider.js +486 -0
- package/dist/provider.js.map +1 -0
- package/dist/repo.d.ts +22 -0
- package/dist/repo.js +154 -0
- package/dist/repo.js.map +1 -0
- package/dist/safety.d.ts +48 -0
- package/dist/safety.js +140 -0
- package/dist/safety.js.map +1 -0
- package/dist/storage.d.ts +133 -0
- package/dist/storage.js +300 -0
- package/dist/storage.js.map +1 -0
- package/dist/tools.d.ts +70 -0
- package/dist/tools.js +654 -0
- package/dist/tools.js.map +1 -0
- package/dist/ui.d.ts +203 -0
- package/dist/ui.js +410 -0
- package/dist/ui.js.map +1 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aria Code
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
# @ariacode/cli
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="./media/aria.jpg" alt="Aria Code" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://github.com/ariacodeai/ariacode/actions)
|
|
10
|
+
[](https://www.npmjs.com/package/@ariacode/cli)
|
|
11
|
+
|
|
12
|
+
A predictable, terminal-native coding agent for Next.js, Nest.js, Prisma and Node.js projects.
|
|
13
|
+
|
|
14
|
+
Aria reads your repository, generates safe diffs with preview and tracks every mutation in a local SQLite history — no surprises.
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Node.js 20+
|
|
19
|
+
- `git` (for `review` command)
|
|
20
|
+
- `ripgrep` (for `search_code` tool — fast code search)
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @ariacode/cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
After installation the `aria` binary is available globally.
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Ask a question about your codebase
|
|
34
|
+
aria ask "How is authentication handled in this project?"
|
|
35
|
+
|
|
36
|
+
# Generate an implementation plan (read-only, no changes)
|
|
37
|
+
aria plan "Add rate limiting to the API routes"
|
|
38
|
+
|
|
39
|
+
# Preview a patch before applying
|
|
40
|
+
aria patch "Rename GeoPage to LandingPage" --dry-run
|
|
41
|
+
|
|
42
|
+
# Apply a patch with confirmation prompt
|
|
43
|
+
aria patch "Add error boundary to the root layout"
|
|
44
|
+
|
|
45
|
+
# Review staged git changes
|
|
46
|
+
aria review
|
|
47
|
+
|
|
48
|
+
# Explore an unfamiliar codebase
|
|
49
|
+
aria explore
|
|
50
|
+
|
|
51
|
+
# Check your environment
|
|
52
|
+
aria doctor
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Commands
|
|
56
|
+
|
|
57
|
+
### `aria ask <question>`
|
|
58
|
+
|
|
59
|
+
Ask a read-only question about the repository. The agent uses `read_file`, `list_directory`, and `search_code` to explore the codebase and answer your question.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
aria ask "<question>" [--session <id>] [--max-tokens <n>] [--quiet]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
| Flag | Description |
|
|
66
|
+
|------|-------------|
|
|
67
|
+
| `--session <id>` | Resume an existing session |
|
|
68
|
+
| `--max-tokens <n>` | Override max tokens for this response |
|
|
69
|
+
| `--quiet` | Suppress non-essential output |
|
|
70
|
+
|
|
71
|
+
### `aria plan <goal>`
|
|
72
|
+
|
|
73
|
+
Generate a structured implementation plan without making any changes. Returns steps, affected files, risks, and implementation notes.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
aria plan "<goal>" [--session <id>] [--output <path>]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
| Flag | Description |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| `--session <id>` | Resume an existing session |
|
|
82
|
+
| `--output <path>` | Save the plan as a markdown file |
|
|
83
|
+
|
|
84
|
+
### `aria patch <description>`
|
|
85
|
+
|
|
86
|
+
Analyze the repository, propose a unified diff, show a preview, and apply changes atomically after confirmation.
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
aria patch "<description>" [--dry-run] [--yes] [--session <id>]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Flag | Description |
|
|
93
|
+
|------|-------------|
|
|
94
|
+
| `--dry-run` | Preview the diff without applying changes |
|
|
95
|
+
| `--yes` | Skip the confirmation prompt |
|
|
96
|
+
| `--session <id>` | Resume an existing session |
|
|
97
|
+
|
|
98
|
+
### `aria review`
|
|
99
|
+
|
|
100
|
+
Review git changes with AI assistance. Reads staged changes by default and returns a structured review with summary, issues, and suggestions.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
aria review [--unstaged] [--branch <base>] [--format text|json]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
| Flag | Description |
|
|
107
|
+
|------|-------------|
|
|
108
|
+
| `--unstaged` | Review unstaged changes instead of staged |
|
|
109
|
+
| `--branch <base>` | Compare current branch to a base branch |
|
|
110
|
+
| `--format json` | Output the review as JSON |
|
|
111
|
+
|
|
112
|
+
### `aria explore`
|
|
113
|
+
|
|
114
|
+
Scan the repository structure, detect frameworks and entry points, and summarize architectural patterns.
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
aria explore [--depth <n>] [--save]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Flag | Description |
|
|
121
|
+
|------|-------------|
|
|
122
|
+
| `--depth <n>` | Limit directory traversal depth |
|
|
123
|
+
| `--save` | Save the summary to `./.aria/explore.md` |
|
|
124
|
+
|
|
125
|
+
### `aria history`
|
|
126
|
+
|
|
127
|
+
Inspect past sessions stored in the local SQLite database.
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
aria history [--limit <n>] [--session <id>] [--tree]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
| Flag | Description |
|
|
134
|
+
|------|-------------|
|
|
135
|
+
| `--limit <n>` | Limit the number of sessions shown |
|
|
136
|
+
| `--session <id>` | Show the full log for a specific session |
|
|
137
|
+
| `--tree` | Render the tool execution tree |
|
|
138
|
+
|
|
139
|
+
### `aria config`
|
|
140
|
+
|
|
141
|
+
View and manage configuration.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
aria config # Show effective config with sources
|
|
145
|
+
aria config get <key> # Display a specific value
|
|
146
|
+
aria config set <key> <value> # Write to ~/.aria/config.toml
|
|
147
|
+
aria config path # Show config file resolution paths
|
|
148
|
+
aria config init # Create ./.aria.toml with defaults
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`config set` and `config init` support `--dry-run` and `--yes`.
|
|
152
|
+
|
|
153
|
+
### `aria doctor`
|
|
154
|
+
|
|
155
|
+
Run environment diagnostics: Node.js version, git, ripgrep, config validity, history DB, provider API keys, and project detection.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
aria doctor [--format text|json]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Configuration
|
|
162
|
+
|
|
163
|
+
Aria loads configuration from multiple sources in this precedence order (highest wins):
|
|
164
|
+
|
|
165
|
+
1. CLI flags
|
|
166
|
+
2. Environment variables
|
|
167
|
+
3. `./.aria.toml` (project-level)
|
|
168
|
+
4. `~/.aria/config.toml` (user-level)
|
|
169
|
+
5. Built-in defaults
|
|
170
|
+
|
|
171
|
+
### Configuration File Format
|
|
172
|
+
|
|
173
|
+
```toml
|
|
174
|
+
[provider]
|
|
175
|
+
default = "anthropic" # anthropic | openai | ollama | openrouter
|
|
176
|
+
model = "claude-sonnet-4-6"
|
|
177
|
+
max_tokens = 4096
|
|
178
|
+
|
|
179
|
+
[agent]
|
|
180
|
+
max_iterations = 25
|
|
181
|
+
mode = "build" # build | plan
|
|
182
|
+
timeout_seconds = 120
|
|
183
|
+
|
|
184
|
+
[safety]
|
|
185
|
+
require_confirm_for_shell = true
|
|
186
|
+
allowed_shell_commands = ["npm", "pnpm", "yarn", "npx", "git", "prisma", "tsc", "node"]
|
|
187
|
+
max_file_size_kb = 1024
|
|
188
|
+
max_files_per_patch = 50
|
|
189
|
+
|
|
190
|
+
[ui]
|
|
191
|
+
color = "auto" # auto | always | never
|
|
192
|
+
quiet = false
|
|
193
|
+
|
|
194
|
+
[history]
|
|
195
|
+
retain_days = 90
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Run `aria config init` to generate a `.aria.toml` in the current directory.
|
|
199
|
+
|
|
200
|
+
### Environment Variables
|
|
201
|
+
|
|
202
|
+
| Variable | Description |
|
|
203
|
+
|----------|-------------|
|
|
204
|
+
| `ANTHROPIC_API_KEY` | API key for Anthropic provider |
|
|
205
|
+
| `OPENAI_API_KEY` | API key for OpenAI provider |
|
|
206
|
+
| `OPENROUTER_API_KEY` | API key for OpenRouter provider |
|
|
207
|
+
| `ARIA_PROVIDER` | Override default provider |
|
|
208
|
+
| `ARIA_MODEL` | Override model name |
|
|
209
|
+
| `ARIA_MAX_TOKENS` | Override max tokens |
|
|
210
|
+
| `ARIA_MAX_ITERATIONS` | Override max agent iterations |
|
|
211
|
+
| `ARIA_TIMEOUT_SECONDS` | Override request timeout |
|
|
212
|
+
| `ARIA_COLOR` | Override color mode (`auto`/`always`/`never`) |
|
|
213
|
+
| `ARIA_QUIET` | Set to `true` to suppress non-essential output |
|
|
214
|
+
| `ARIA_RETAIN_DAYS` | Override session retention period |
|
|
215
|
+
| `DEBUG` | Set to `1` to show stack traces on errors |
|
|
216
|
+
|
|
217
|
+
## Providers
|
|
218
|
+
|
|
219
|
+
Aria supports four provider backends. Anthropic is the default. OpenRouter gives you access to virtually every hosted model from a single API key.
|
|
220
|
+
|
|
221
|
+
### Anthropic (default)
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
225
|
+
aria ask "What does this project do?"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
| Model | ID |
|
|
229
|
+
|-------|----|
|
|
230
|
+
| Claude Opus 4.6 | `claude-opus-4-6` |
|
|
231
|
+
| Claude Sonnet 4.6 *(default)* | `claude-sonnet-4-6` |
|
|
232
|
+
| Claude Haiku 3.5 | `claude-haiku-3-5` |
|
|
233
|
+
|
|
234
|
+
### OpenAI
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
export OPENAI_API_KEY=sk-...
|
|
238
|
+
aria config set provider.default openai
|
|
239
|
+
aria config set provider.model gpt-4o
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
| Model | ID |
|
|
243
|
+
|-------|----|
|
|
244
|
+
| GPT-5 | `gpt-5` |
|
|
245
|
+
| GPT-5.1 | `gpt-5.1` |
|
|
246
|
+
| GPT-4o | `gpt-4o` |
|
|
247
|
+
| GPT-4o mini | `gpt-4o-mini` |
|
|
248
|
+
| o3 | `o3` |
|
|
249
|
+
| o4-mini | `o4-mini` |
|
|
250
|
+
|
|
251
|
+
### Ollama (local, no API key required)
|
|
252
|
+
|
|
253
|
+
Run any model locally — no API key needed.
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Pull a model first, then point Aria at it
|
|
257
|
+
ollama pull llama4
|
|
258
|
+
aria config set provider.default ollama
|
|
259
|
+
aria config set provider.model llama4
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Popular models available via `ollama pull`:
|
|
263
|
+
|
|
264
|
+
| Model | ID |
|
|
265
|
+
|-------|----|
|
|
266
|
+
| Llama 4 | `llama4` |
|
|
267
|
+
| Llama 3.3 | `llama3.3` |
|
|
268
|
+
| Mistral | `mistral` |
|
|
269
|
+
| Qwen 2.5 Coder | `qwen2.5-coder` |
|
|
270
|
+
| DeepSeek Coder V2 | `deepseek-coder-v2` |
|
|
271
|
+
| Phi-4 | `phi4` |
|
|
272
|
+
| Gemma 3 | `gemma3` |
|
|
273
|
+
|
|
274
|
+
See the full list at [ollama.com/library](https://ollama.com/library).
|
|
275
|
+
|
|
276
|
+
### OpenRouter
|
|
277
|
+
|
|
278
|
+
Access hundreds of hosted models from a single API key — including Claude, GPT, Gemini, Mistral, DeepSeek, Qwen, MiniMax, and more.
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
export OPENROUTER_API_KEY=sk-or-...
|
|
282
|
+
aria config set provider.default openrouter
|
|
283
|
+
aria config set provider.model deepseek/deepseek-r1
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Anthropic via OpenRouter**
|
|
287
|
+
|
|
288
|
+
| Model | ID |
|
|
289
|
+
|-------|----|
|
|
290
|
+
| Claude Sonnet 4.5 | `anthropic/claude-sonnet-4-5` |
|
|
291
|
+
| Claude Opus 4 | `anthropic/claude-opus-4` |
|
|
292
|
+
| Claude Haiku 3.5 | `anthropic/claude-haiku-3-5` |
|
|
293
|
+
|
|
294
|
+
**OpenAI via OpenRouter**
|
|
295
|
+
|
|
296
|
+
| Model | ID |
|
|
297
|
+
|-------|----|
|
|
298
|
+
| GPT-5 | `openai/gpt-5` |
|
|
299
|
+
| GPT-5.1 | `openai/gpt-5.1` |
|
|
300
|
+
| GPT-4o | `openai/gpt-4o` |
|
|
301
|
+
| o3 | `openai/o3` |
|
|
302
|
+
| o4-mini | `openai/o4-mini` |
|
|
303
|
+
|
|
304
|
+
**Google via OpenRouter**
|
|
305
|
+
|
|
306
|
+
| Model | ID |
|
|
307
|
+
|-------|----|
|
|
308
|
+
| Gemini 3.1 Pro | `google/gemini-3.1-pro-preview` |
|
|
309
|
+
| Gemini 3.1 Flash | `google/gemini-3.1-flash-preview` |
|
|
310
|
+
| Gemini 2.5 Pro | `google/gemini-2.5-pro-preview` |
|
|
311
|
+
| Gemini 2.5 Flash | `google/gemini-2.5-flash-preview` |
|
|
312
|
+
|
|
313
|
+
**DeepSeek via OpenRouter**
|
|
314
|
+
|
|
315
|
+
| Model | ID |
|
|
316
|
+
|-------|----|
|
|
317
|
+
| DeepSeek R1 | `deepseek/deepseek-r1` |
|
|
318
|
+
| DeepSeek V3 | `deepseek/deepseek-chat` |
|
|
319
|
+
| DeepSeek Coder V2 | `deepseek/deepseek-coder` |
|
|
320
|
+
|
|
321
|
+
**Mistral via OpenRouter**
|
|
322
|
+
|
|
323
|
+
| Model | ID |
|
|
324
|
+
|-------|----|
|
|
325
|
+
| Mistral Large | `mistralai/mistral-large` |
|
|
326
|
+
| Mistral Small | `mistralai/mistral-small` |
|
|
327
|
+
| Codestral | `mistralai/codestral-2501` |
|
|
328
|
+
|
|
329
|
+
**Qwen via OpenRouter**
|
|
330
|
+
|
|
331
|
+
| Model | ID |
|
|
332
|
+
|-------|----|
|
|
333
|
+
| Qwen3 235B | `qwen/qwen3-235b-a22b` |
|
|
334
|
+
| Qwen2.5 Coder 32B | `qwen/qwen-2.5-coder-32b-instruct` |
|
|
335
|
+
| QwQ 32B | `qwen/qwq-32b` |
|
|
336
|
+
|
|
337
|
+
**Xiaomi MiMo via OpenRouter**
|
|
338
|
+
|
|
339
|
+
| Model | ID |
|
|
340
|
+
|-------|----|
|
|
341
|
+
| MiMo V2 Pro *(1T params, 1M ctx)* | `xiaomi/mimo-v2-pro` |
|
|
342
|
+
| MiMo V2 Omni *(multimodal)* | `xiaomi/mimo-v2-omni` |
|
|
343
|
+
| MiMo V2 Flash *(open-source, fast)* | `xiaomi/mimo-v2-flash` |
|
|
344
|
+
|
|
345
|
+
**MiniMax via OpenRouter**
|
|
346
|
+
|
|
347
|
+
| Model | ID |
|
|
348
|
+
|-------|----|
|
|
349
|
+
| MiniMax M1 | `minimax/minimax-m1` |
|
|
350
|
+
| MiniMax Text 01 | `minimax/minimax-01` |
|
|
351
|
+
|
|
352
|
+
**Meta via OpenRouter**
|
|
353
|
+
|
|
354
|
+
| Model | ID |
|
|
355
|
+
|-------|----|
|
|
356
|
+
| Llama 4 Maverick | `meta-llama/llama-4-maverick` |
|
|
357
|
+
| Llama 4 Scout | `meta-llama/llama-4-scout` |
|
|
358
|
+
| Llama 3.3 70B | `meta-llama/llama-3.3-70b-instruct` |
|
|
359
|
+
|
|
360
|
+
See the full model catalogue at [openrouter.ai/models](https://openrouter.ai/models).
|
|
361
|
+
|
|
362
|
+
## Exit Codes
|
|
363
|
+
|
|
364
|
+
| Code | Meaning |
|
|
365
|
+
|------|---------|
|
|
366
|
+
| `0` | Success |
|
|
367
|
+
| `1` | Generic error |
|
|
368
|
+
| `2` | Invalid arguments |
|
|
369
|
+
| `3` | Configuration error |
|
|
370
|
+
| `4` | Provider error (e.g. missing API key) |
|
|
371
|
+
| `5` | Project detection error |
|
|
372
|
+
| `130` | User cancelled (Ctrl+C or declined confirmation) |
|
|
373
|
+
|
|
374
|
+
## Session History
|
|
375
|
+
|
|
376
|
+
Every command execution is logged to `~/.aria/history.db` (SQLite). Sessions record messages, tool executions, and mutations. The database is created automatically on first run with permissions set to `600` (user-only).
|
|
377
|
+
|
|
378
|
+
View recent sessions:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
aria history
|
|
382
|
+
aria history --limit 10
|
|
383
|
+
aria history --session <id>
|
|
384
|
+
aria history --session <id> --tree
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Sessions older than `retain_days` (default: 90) are cleaned up automatically.
|
|
388
|
+
|
|
389
|
+
## Safety
|
|
390
|
+
|
|
391
|
+
- All file operations are validated against the project root — no writes outside the project directory
|
|
392
|
+
- Path traversal attempts (`../`) and symlink escapes are rejected
|
|
393
|
+
- Shell commands are restricted to an explicit allowlist
|
|
394
|
+
- `.env` files and `node_modules` are excluded from directory listings by default
|
|
395
|
+
- API keys are never logged to the history database or terminal output
|
|
396
|
+
- All mutations require confirmation unless `--yes` is passed
|
|
397
|
+
|
|
398
|
+
## Contributing
|
|
399
|
+
|
|
400
|
+
Contributions are welcome. Please open an issue or pull request at [github.com/ariacodeai/ariacode](https://github.com/ariacodeai/ariacode).
|
|
401
|
+
|
|
402
|
+
## License
|
|
403
|
+
|
|
404
|
+
MIT — see [LICENSE](./LICENSE)
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command implementations for Aria Code CLI
|
|
3
|
+
*
|
|
4
|
+
* Each exported function corresponds to a CLI command and orchestrates:
|
|
5
|
+
* - Configuration loading
|
|
6
|
+
* - Project detection
|
|
7
|
+
* - Session management
|
|
8
|
+
* - Agent loop execution
|
|
9
|
+
* - Terminal output
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Options parsed from CLI flags for the ask command.
|
|
13
|
+
*/
|
|
14
|
+
export interface AskOptions {
|
|
15
|
+
/** The question to ask (required) */
|
|
16
|
+
question: string;
|
|
17
|
+
/** Resume an existing session by ID */
|
|
18
|
+
session?: string;
|
|
19
|
+
/** Override max tokens for this invocation */
|
|
20
|
+
maxTokens?: number;
|
|
21
|
+
/** Suppress non-essential output */
|
|
22
|
+
quiet?: boolean;
|
|
23
|
+
/** Project root (defaults to process.cwd()) */
|
|
24
|
+
projectRoot?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Execute the ask command.
|
|
28
|
+
*
|
|
29
|
+
* Flow:
|
|
30
|
+
* 1. Load configuration and detect project type (Req 9.1)
|
|
31
|
+
* 2. Create or resume session with mode: "plan" (Req 9.2, 9.9)
|
|
32
|
+
* 3. Build system prompt from ask.md template (Req 9.3)
|
|
33
|
+
* 4. Expose only read-only tools (Req 9.4)
|
|
34
|
+
* 5. Execute agent loop (Req 9.5, 9.6)
|
|
35
|
+
* 6. Render response to terminal (Req 9.7)
|
|
36
|
+
* 7. Persist session to database (Req 9.8)
|
|
37
|
+
*
|
|
38
|
+
* Requirements: 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9
|
|
39
|
+
*/
|
|
40
|
+
export declare function runAsk(options: AskOptions): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Options parsed from CLI flags for the plan command.
|
|
43
|
+
*/
|
|
44
|
+
export interface PlanOptions {
|
|
45
|
+
/** The implementation goal (required) */
|
|
46
|
+
goal: string;
|
|
47
|
+
/** Resume an existing session by ID */
|
|
48
|
+
session?: string;
|
|
49
|
+
/** Save plan as markdown file at specified path */
|
|
50
|
+
output?: string;
|
|
51
|
+
/** Suppress non-essential output */
|
|
52
|
+
quiet?: boolean;
|
|
53
|
+
/** Project root (defaults to process.cwd()) */
|
|
54
|
+
projectRoot?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Execute the plan command.
|
|
58
|
+
*
|
|
59
|
+
* Flow:
|
|
60
|
+
* 1. Load configuration and detect project type (Req 10.1)
|
|
61
|
+
* 2. Create or resume session with mode: "plan" (Req 10.2, 10.8)
|
|
62
|
+
* 3. Build system prompt from plan.md template (Req 10.3)
|
|
63
|
+
* 4. Expose only read-only tools (Req 10.4)
|
|
64
|
+
* 5. Execute agent loop (Req 10.5)
|
|
65
|
+
* 6. Render structured plan to terminal (Req 10.6)
|
|
66
|
+
* 7. Save to file if --output flag provided (Req 10.7)
|
|
67
|
+
* 8. Persist session to database (Req 10.8)
|
|
68
|
+
*
|
|
69
|
+
* Requirements: 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
|
|
70
|
+
*/
|
|
71
|
+
export declare function runPlan(options: PlanOptions): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Options parsed from CLI flags for the patch command.
|
|
74
|
+
*/
|
|
75
|
+
export interface PatchOptions {
|
|
76
|
+
/** Description of the changes to make (required) */
|
|
77
|
+
description: string;
|
|
78
|
+
/** Preview changes without applying them */
|
|
79
|
+
dryRun?: boolean;
|
|
80
|
+
/** Skip confirmation prompt */
|
|
81
|
+
yes?: boolean;
|
|
82
|
+
/** Resume an existing session by ID */
|
|
83
|
+
session?: string;
|
|
84
|
+
/** Suppress non-essential output */
|
|
85
|
+
quiet?: boolean;
|
|
86
|
+
/** Project root (defaults to process.cwd()) */
|
|
87
|
+
projectRoot?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Execute the patch command.
|
|
91
|
+
*
|
|
92
|
+
* Flow:
|
|
93
|
+
* 1. Load configuration and detect project type (Req 11.1)
|
|
94
|
+
* 2. Create session with mode: "build" (Req 11.2)
|
|
95
|
+
* 3. Build system prompt from patch.md template (Req 11.3)
|
|
96
|
+
* 4. Expose read-only + mutation tools (Req 11.4)
|
|
97
|
+
* 5. Execute agent loop — agent calls propose_diff (Req 11.4, 11.5)
|
|
98
|
+
* 6. Render diff preview with syntax highlighting (Req 11.6)
|
|
99
|
+
* 7. Render mutation summary (Req 11.7)
|
|
100
|
+
* 8. If --dry-run, exit with code 0 (Req 11.8, 17.3, 17.4)
|
|
101
|
+
* 9. If not --yes, prompt for confirmation (Req 11.9, 17.5)
|
|
102
|
+
* 10. Agent calls apply_diff atomically (Req 11.10, 11.11, 11.12)
|
|
103
|
+
* 11. Log mutation to database (Req 11.11)
|
|
104
|
+
* 12. Display rollback hints (Req 11.12, 17.9)
|
|
105
|
+
* 13. Persist session to database (Req 11.13)
|
|
106
|
+
*
|
|
107
|
+
* Requirements: 11.1–11.13, 17.1–17.9
|
|
108
|
+
*/
|
|
109
|
+
export declare function runPatch(options: PatchOptions): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Options parsed from CLI flags for the review command.
|
|
112
|
+
*/
|
|
113
|
+
export interface ReviewOptions {
|
|
114
|
+
/** Read unstaged changes instead of staged */
|
|
115
|
+
unstaged?: boolean;
|
|
116
|
+
/** Compare current branch to specified base branch */
|
|
117
|
+
branch?: string;
|
|
118
|
+
/** Output format: "text" (default) or "json" */
|
|
119
|
+
format?: "text" | "json";
|
|
120
|
+
/** Suppress non-essential output */
|
|
121
|
+
quiet?: boolean;
|
|
122
|
+
/** Project root (defaults to process.cwd()) */
|
|
123
|
+
projectRoot?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Structured review returned by the provider.
|
|
127
|
+
*/
|
|
128
|
+
export interface ReviewResult {
|
|
129
|
+
summary: string;
|
|
130
|
+
issues: Array<{
|
|
131
|
+
severity: "HIGH" | "MEDIUM" | "LOW";
|
|
132
|
+
description: string;
|
|
133
|
+
}>;
|
|
134
|
+
suggestions: string[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Execute the review command.
|
|
138
|
+
*
|
|
139
|
+
* Flow:
|
|
140
|
+
* 1. Parse flags and load configuration (Req 12.1)
|
|
141
|
+
* 2. Detect project type (Req 12.1)
|
|
142
|
+
* 3. Create session with mode: "plan" (Req 12.2)
|
|
143
|
+
* 4. Read git diff (staged / unstaged / branch) (Req 12.3, 12.4, 12.5)
|
|
144
|
+
* 5. Build system prompt from review.md template (Req 12.6)
|
|
145
|
+
* 6. Send diff + project context to provider (Req 12.6)
|
|
146
|
+
* 7. Parse structured review (summary, issues, suggestions) (Req 12.7)
|
|
147
|
+
* 8. Render review to terminal (Req 12.8)
|
|
148
|
+
* 9. Output JSON if --format json (Req 12.9)
|
|
149
|
+
* 10. Persist session to database (Req 12.10)
|
|
150
|
+
*
|
|
151
|
+
* Requirements: 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 12.10
|
|
152
|
+
*/
|
|
153
|
+
export declare function runReview(options: ReviewOptions): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Options parsed from CLI flags for the explore command.
|
|
156
|
+
*/
|
|
157
|
+
export interface ExploreOptions {
|
|
158
|
+
/** Limit directory traversal depth */
|
|
159
|
+
depth?: number;
|
|
160
|
+
/** Save exploration summary to ./.aria/explore.md */
|
|
161
|
+
save?: boolean;
|
|
162
|
+
/** Suppress non-essential output */
|
|
163
|
+
quiet?: boolean;
|
|
164
|
+
/** Project root (defaults to process.cwd()) */
|
|
165
|
+
projectRoot?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Execute the explore command.
|
|
169
|
+
*
|
|
170
|
+
* Flow:
|
|
171
|
+
* 1. Parse flags and load configuration (Req 13.1)
|
|
172
|
+
* 2. Detect project type (Req 13.1)
|
|
173
|
+
* 3. Create session with mode: "plan" (Req 13.2)
|
|
174
|
+
* 4. Scan repository structure respecting .gitignore (Req 13.3)
|
|
175
|
+
* 5. Detect frameworks and key configuration files (Req 13.4)
|
|
176
|
+
* 6. Identify entry points based on project type (Req 13.5)
|
|
177
|
+
* 7. Build system prompt from explore.md template (Req 13.3–13.6)
|
|
178
|
+
* 8. Execute agent loop to summarize structure/patterns (Req 13.6)
|
|
179
|
+
* 9. Render exploration summary to terminal (Req 13.7)
|
|
180
|
+
* 10. Save to ./.aria/explore.md if --save flag (Req 13.8)
|
|
181
|
+
* 11. Persist session to database (Req 13.10)
|
|
182
|
+
*
|
|
183
|
+
* Requirements: 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 13.10
|
|
184
|
+
*/
|
|
185
|
+
export declare function runExplore(options: ExploreOptions): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Options parsed from CLI flags for the history command.
|
|
188
|
+
*/
|
|
189
|
+
export interface HistoryOptions {
|
|
190
|
+
/** Limit number of sessions listed */
|
|
191
|
+
limit?: number;
|
|
192
|
+
/** Show full log for a specific session ID */
|
|
193
|
+
session?: string;
|
|
194
|
+
/** Render tool execution tree */
|
|
195
|
+
tree?: boolean;
|
|
196
|
+
/** Suppress non-essential output */
|
|
197
|
+
quiet?: boolean;
|
|
198
|
+
/** Project root (defaults to process.cwd()) */
|
|
199
|
+
projectRoot?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Execute the history command.
|
|
203
|
+
*
|
|
204
|
+
* Flow:
|
|
205
|
+
* 1. If no --session flag: list recent sessions in a table (Req 14.2, 14.3, 14.4)
|
|
206
|
+
* 2. If --session flag: display full session log (Req 14.5)
|
|
207
|
+
* 3. If --tree flag: render tool execution tree (Req 14.6)
|
|
208
|
+
* 4. Format timestamps in human-readable format (Req 14.7)
|
|
209
|
+
* 5. Support pagination for large result sets (Req 14.8)
|
|
210
|
+
*
|
|
211
|
+
* Requirements: 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8
|
|
212
|
+
*/
|
|
213
|
+
export declare function runHistory(options: HistoryOptions): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Options parsed from CLI flags for the config command.
|
|
216
|
+
*/
|
|
217
|
+
export interface ConfigOptions {
|
|
218
|
+
/** Subcommand: get, set, path, init */
|
|
219
|
+
subcommand?: "get" | "set" | "path" | "init";
|
|
220
|
+
/** Configuration key (for get/set) */
|
|
221
|
+
key?: string;
|
|
222
|
+
/** Configuration value (for set) */
|
|
223
|
+
value?: string;
|
|
224
|
+
/** Preview changes without writing */
|
|
225
|
+
dryRun?: boolean;
|
|
226
|
+
/** Skip confirmation prompt */
|
|
227
|
+
yes?: boolean;
|
|
228
|
+
/** Suppress non-essential output */
|
|
229
|
+
quiet?: boolean;
|
|
230
|
+
/** Project root (defaults to process.cwd()) */
|
|
231
|
+
projectRoot?: string;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Execute the config command.
|
|
235
|
+
*
|
|
236
|
+
* Subcommands:
|
|
237
|
+
* - (none): Display effective configuration with precedence sources (Req 15.2)
|
|
238
|
+
* - get <key>: Display value for specified key (Req 15.3)
|
|
239
|
+
* - set <key> <value>: Write key-value to ~/.aria/config.toml (Req 15.4–15.6, 15.10)
|
|
240
|
+
* - path: Display configuration file resolution paths (Req 15.7)
|
|
241
|
+
* - init: Create ./.aria.toml with default values (Req 15.8, 15.9)
|
|
242
|
+
*
|
|
243
|
+
* Requirements: 15.1–15.10
|
|
244
|
+
*/
|
|
245
|
+
export declare function runConfig(options: ConfigOptions): Promise<void>;
|
|
246
|
+
/**
|
|
247
|
+
* Options parsed from CLI flags for the doctor command.
|
|
248
|
+
*/
|
|
249
|
+
export interface DoctorOptions {
|
|
250
|
+
/** Output format: "text" (default) or "json" */
|
|
251
|
+
format?: "text" | "json";
|
|
252
|
+
/** Project root (defaults to process.cwd()) */
|
|
253
|
+
projectRoot?: string;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* A single diagnostic check result.
|
|
257
|
+
*/
|
|
258
|
+
export interface DiagnosticCheck {
|
|
259
|
+
name: string;
|
|
260
|
+
status: "pass" | "fail" | "warn";
|
|
261
|
+
message: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Execute the doctor command.
|
|
265
|
+
*
|
|
266
|
+
* Runs a series of environment diagnostic checks and reports results.
|
|
267
|
+
* Exits with code 1 if any critical check fails.
|
|
268
|
+
*
|
|
269
|
+
* Requirements: 16.1–16.13
|
|
270
|
+
*/
|
|
271
|
+
export declare function runDoctor(options?: DoctorOptions): Promise<void>;
|