@ateriss_/aiv-cli 0.1.0 → 1.0.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/README.md +308 -315
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
A local-first, multi-agent CLI for reviewing GitHub pull requests using any supported AI provider. Runs three specialized agents in parallel (Business, Architecture, Security) and produces a structured risk report with findings, suggestions, and an executive summary.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
██║ ██║██║
|
|
11
|
-
╚═╝ ╚═╝╚═╝
|
|
12
|
-
|
|
13
|
-
by Ateriss
|
|
6
|
+
█████╗ ██╗██╗ ██╗
|
|
7
|
+
██╔══██╗██║██║ ██║
|
|
8
|
+
███████║██║██║ ██║
|
|
9
|
+
██╔══██║██║╚██╗ ██╔╝
|
|
10
|
+
██║ ██║██║ ╚████╔╝
|
|
11
|
+
╚═╝ ╚═╝╚═╝ ╚═══╝ by Ateriss
|
|
14
12
|
```
|
|
15
13
|
|
|
16
14
|
---
|
|
@@ -22,13 +20,21 @@ A local-first, multi-agent CLI for reviewing GitHub pull requests using any supp
|
|
|
22
20
|
- [Quick Start](#quick-start)
|
|
23
21
|
- [Commands Reference](#commands-reference)
|
|
24
22
|
- [Configuration](#configuration)
|
|
25
|
-
- [Global Config](#global-config
|
|
26
|
-
- [Repo Config](#repo-config
|
|
27
|
-
- [Rules](#rules
|
|
28
|
-
- [Context](#context
|
|
23
|
+
- [Global Config](#global-config)
|
|
24
|
+
- [Repo Config](#repo-config)
|
|
25
|
+
- [Rules](#rules)
|
|
26
|
+
- [Context](#context)
|
|
29
27
|
- [GitHub Account Management](#github-account-management)
|
|
30
28
|
- [AI Providers](#ai-providers)
|
|
29
|
+
- [Built-in: Claude](#claude-default)
|
|
30
|
+
- [Built-in: OpenAI](#openai)
|
|
31
|
+
- [Built-in: Gemini](#google-gemini)
|
|
32
|
+
- [OpenAI-compatible (custom)](#openai-compatible-providers)
|
|
33
|
+
- [Per-agent assignment](#per-agent-provider-assignment)
|
|
34
|
+
- [Fallback chain](#fallback-chain)
|
|
35
|
+
- [Mock](#mock-offline-testing)
|
|
31
36
|
- [Review Output](#review-output)
|
|
37
|
+
- [Post-review Actions](#post-review-actions)
|
|
32
38
|
- [Multi-language](#multi-language)
|
|
33
39
|
- [Environment Variables](#environment-variables)
|
|
34
40
|
- [Error Reference](#error-reference)
|
|
@@ -72,7 +78,7 @@ aiv init
|
|
|
72
78
|
```
|
|
73
79
|
|
|
74
80
|
This creates:
|
|
75
|
-
- `~/.aiv/config.yml` — global config (AI
|
|
81
|
+
- `~/.aiv/config.yml` — global config (AI providers, GitHub accounts)
|
|
76
82
|
- `.aiv/config.yml` — repo config (owner, repo, account override)
|
|
77
83
|
- `.aiv/rules.yml` — custom review rules for agents
|
|
78
84
|
- `.aiv/context.md` — auto-generated project context
|
|
@@ -85,19 +91,25 @@ export CLAUDE_API_KEY=sk-ant-...
|
|
|
85
91
|
export GITHUB_TOKEN=ghp_...
|
|
86
92
|
```
|
|
87
93
|
|
|
88
|
-
**3.
|
|
94
|
+
**3. (Optional) Let AI generate your context and rules:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
aiv context generate
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**4. List open pull requests:**
|
|
89
101
|
|
|
90
102
|
```bash
|
|
91
103
|
aiv prs
|
|
92
104
|
```
|
|
93
105
|
|
|
94
|
-
**
|
|
106
|
+
**5. Review a PR:**
|
|
95
107
|
|
|
96
108
|
```bash
|
|
97
109
|
aiv review 42
|
|
98
110
|
```
|
|
99
111
|
|
|
100
|
-
|
|
112
|
+
After the report, aiv asks if you want to **approve or request changes** directly on GitHub.
|
|
101
113
|
|
|
102
114
|
---
|
|
103
115
|
|
|
@@ -105,150 +117,135 @@ That's it. The three agents run in parallel and print a full report.
|
|
|
105
117
|
|
|
106
118
|
Every command has a short alias. Long and short forms are identical.
|
|
107
119
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
|
111
|
-
|
|
112
|
-
| `aiv
|
|
113
|
-
| `aiv
|
|
114
|
-
| `aiv
|
|
115
|
-
| `aiv
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
121
|
-
| `aiv
|
|
122
|
-
| `aiv
|
|
123
|
-
| `aiv
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
### Core
|
|
121
|
+
|
|
122
|
+
| Long form | Short | Description |
|
|
123
|
+
|-----------|-------|-------------|
|
|
124
|
+
| `aiv init` | `aiv i` | Initialize aiv globally and in the current repo |
|
|
125
|
+
| `aiv prs` | `aiv p` | List open PRs, then optionally review one |
|
|
126
|
+
| `aiv review [pr-number]` | `aiv r` | Review a PR or pick interactively |
|
|
127
|
+
| `aiv agents` | `aiv a` | List available agents and their focus areas |
|
|
128
|
+
|
|
129
|
+
### Context
|
|
130
|
+
|
|
131
|
+
| Long form | Short | Description |
|
|
132
|
+
|-----------|-------|-------------|
|
|
133
|
+
| `aiv context refresh` | `aiv ctx refresh` | Rebuild `context.md` and `tree.json` from the codebase |
|
|
134
|
+
| `aiv context show` | `aiv ctx show` | Print current `context.md` |
|
|
135
|
+
| `aiv context generate` | `aiv ctx generate` | Use AI to generate `context.md` and `rules.yml` |
|
|
136
|
+
|
|
137
|
+
### Config — general
|
|
138
|
+
|
|
139
|
+
| Long form | Short | Description |
|
|
140
|
+
|-----------|-------|-------------|
|
|
141
|
+
| `aiv config show` | `aiv cf show` | Show global and repo config files |
|
|
142
|
+
| `aiv config set-provider <name>` | `aiv cf set-provider` | Set default AI provider |
|
|
143
|
+
| `aiv config set-repo <owner> <repo>` | `aiv cf set-repo` | Set GitHub owner/repo in repo config |
|
|
144
|
+
| `aiv config set-lang <lang>` | `aiv cf set-lang` | Change display language (`en` / `es`) |
|
|
145
|
+
| `aiv config rules` | `aiv cf rules` | Print `rules.yml` |
|
|
146
|
+
|
|
147
|
+
### Config — providers
|
|
148
|
+
|
|
149
|
+
| Long form | Description |
|
|
150
|
+
|-----------|-------------|
|
|
151
|
+
| `aiv config add-provider <name>` | Add or update a provider (built-in or custom OpenAI-compatible) |
|
|
152
|
+
| `aiv config remove-provider <name>` | Remove a custom provider |
|
|
153
|
+
| `aiv config list-providers` | List all configured providers and their status |
|
|
154
|
+
| `aiv config set-agent-provider <agent> [spec]` | Assign a specific provider/model to one agent |
|
|
155
|
+
| `aiv config set-fallback [providers...]` | Set ordered fallback chain for quota/rate errors |
|
|
156
|
+
| `aiv config show-agents` | Show per-agent provider assignments and fallback chain |
|
|
157
|
+
|
|
158
|
+
### Config — GitHub accounts
|
|
159
|
+
|
|
160
|
+
| Long form | Description |
|
|
161
|
+
|-----------|-------------|
|
|
162
|
+
| `aiv config accounts` | List GitHub accounts |
|
|
163
|
+
| `aiv config add-account <name>` | Add a GitHub account |
|
|
164
|
+
| `aiv config remove-account <name>` | Remove a GitHub account |
|
|
165
|
+
| `aiv config default-account <name>` | Set global default account |
|
|
166
|
+
| `aiv config use-account <name>` | Use a specific account for this repo |
|
|
126
167
|
|
|
127
168
|
---
|
|
128
169
|
|
|
129
170
|
### `aiv init`
|
|
130
171
|
|
|
131
|
-
Initializes aiv globally and in the current repository.
|
|
132
|
-
|
|
133
172
|
```bash
|
|
134
173
|
aiv init
|
|
135
174
|
aiv i
|
|
136
175
|
```
|
|
137
176
|
|
|
138
|
-
Safe to run
|
|
177
|
+
Safe to re-run — if `~/.aiv/config.yml` already exists it is preserved. Re-running inside a repo always rebuilds `context.md` and `tree.json`.
|
|
139
178
|
|
|
140
179
|
---
|
|
141
180
|
|
|
142
181
|
### `aiv prs`
|
|
143
182
|
|
|
144
|
-
Fetches
|
|
183
|
+
Fetches open PRs in a table, then launches an interactive selector.
|
|
145
184
|
|
|
146
185
|
```bash
|
|
147
186
|
aiv prs
|
|
148
187
|
aiv p
|
|
149
188
|
|
|
150
|
-
# Limit results
|
|
151
189
|
aiv prs --limit 10
|
|
152
|
-
|
|
153
|
-
# Override repo auto-detection
|
|
154
190
|
aiv prs --owner myorg --repo myrepo
|
|
155
|
-
|
|
156
|
-
# List only, skip interactive selector
|
|
157
|
-
aiv prs --no-select
|
|
191
|
+
aiv prs --no-select # list only, skip selector
|
|
158
192
|
```
|
|
159
193
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
**Repo auto-detection:** aiv reads `git remote get-url origin` to detect the GitHub owner and repo. If the remote is not a GitHub URL or is missing, use `--owner`/`--repo` flags or configure them in `.aiv/config.yml`.
|
|
194
|
+
**Repo auto-detection:** reads `git remote get-url origin`. If it fails, pass `--owner`/`--repo` or set them with `aiv config set-repo`.
|
|
163
195
|
|
|
164
196
|
---
|
|
165
197
|
|
|
166
198
|
### `aiv review`
|
|
167
199
|
|
|
168
|
-
Reviews a pull request.
|
|
200
|
+
Reviews a pull request. Omit the number to pick interactively.
|
|
169
201
|
|
|
170
202
|
```bash
|
|
171
|
-
# Review by number
|
|
172
203
|
aiv review 42
|
|
173
204
|
aiv r 42
|
|
174
205
|
|
|
175
|
-
#
|
|
176
|
-
aiv review
|
|
177
|
-
aiv r
|
|
178
|
-
|
|
179
|
-
# Override repo
|
|
206
|
+
aiv review # interactive selector
|
|
180
207
|
aiv review 42 --owner myorg --repo myrepo
|
|
181
|
-
|
|
182
|
-
# Run specific agents only
|
|
183
208
|
aiv review 42 --agent security
|
|
184
209
|
aiv review 42 --agent business architecture
|
|
185
|
-
|
|
186
|
-
# Output raw JSON (useful for scripting and CI)
|
|
187
|
-
aiv review 42 --json
|
|
210
|
+
aiv review 42 --json # raw JSON, no interactive prompt
|
|
188
211
|
```
|
|
189
212
|
|
|
190
|
-
|
|
213
|
+
After the report prints, aiv asks whether to **approve**, **request changes**, or **skip** — and submits the decision directly to GitHub. If you approve, `context.md` and `tree.json` are refreshed automatically.
|
|
191
214
|
|
|
192
215
|
---
|
|
193
216
|
|
|
194
217
|
### `aiv context`
|
|
195
218
|
|
|
196
|
-
Manages the project context used by agents during reviews.
|
|
197
|
-
|
|
198
219
|
```bash
|
|
199
|
-
|
|
200
|
-
aiv context refresh
|
|
220
|
+
aiv context refresh # rebuild from codebase (static analysis)
|
|
201
221
|
aiv ctx refresh
|
|
202
222
|
|
|
203
|
-
|
|
204
|
-
aiv context show
|
|
223
|
+
aiv context show # print context.md
|
|
205
224
|
aiv ctx show
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Run `context refresh` after major structural changes to the project (new modules, new dependencies, large refactors) so agents have accurate background information.
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
### `aiv config`
|
|
213
225
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
aiv
|
|
219
|
-
aiv cf show
|
|
220
|
-
|
|
221
|
-
# Switch AI provider
|
|
222
|
-
aiv config set-provider openai
|
|
223
|
-
aiv cf set-provider claude
|
|
224
|
-
|
|
225
|
-
# Set repo owner/repo explicitly
|
|
226
|
-
aiv config set-repo myorg myrepo
|
|
227
|
-
|
|
228
|
-
# Change display language
|
|
229
|
-
aiv config set-lang es
|
|
230
|
-
aiv config set-lang en
|
|
231
|
-
|
|
232
|
-
# Show rules.yml
|
|
233
|
-
aiv config rules
|
|
226
|
+
aiv context generate # AI-powered generation
|
|
227
|
+
aiv ctx generate
|
|
228
|
+
aiv ctx generate --context-only
|
|
229
|
+
aiv ctx generate --rules-only
|
|
230
|
+
aiv ctx generate --force # overwrite without asking
|
|
234
231
|
```
|
|
235
232
|
|
|
233
|
+
`generate` uses the configured AI provider (or `providers.agents.context` if set) to analyze the project structure and produce a `context.md` and `rules.yml` tailored to your stack. Run it after `init` or whenever a new AI agent type is added — edit the output only where needed.
|
|
234
|
+
|
|
236
235
|
---
|
|
237
236
|
|
|
238
237
|
### `aiv agents`
|
|
239
238
|
|
|
240
|
-
Lists all available agents with their description and focus areas.
|
|
241
|
-
|
|
242
239
|
```bash
|
|
243
240
|
aiv agents
|
|
244
241
|
aiv a
|
|
245
242
|
```
|
|
246
243
|
|
|
247
|
-
| Agent
|
|
248
|
-
|
|
249
|
-
| business
|
|
244
|
+
| Agent | Focus areas |
|
|
245
|
+
|-------|-------------|
|
|
246
|
+
| business | Business logic, domain invariants, rule violations, functional regressions |
|
|
250
247
|
| architecture | Layer violations, coupling, SRP, dependency direction, abstraction quality |
|
|
251
|
-
| security
|
|
248
|
+
| security | Auth bypass, injection, data leakage, OWASP Top 10, sensitive data handling |
|
|
252
249
|
|
|
253
250
|
---
|
|
254
251
|
|
|
@@ -256,36 +253,58 @@ aiv a
|
|
|
256
253
|
|
|
257
254
|
aiv uses a two-level configuration system:
|
|
258
255
|
|
|
259
|
-
| File
|
|
260
|
-
|
|
261
|
-
| `~/.aiv/config.yml`
|
|
262
|
-
| `.aiv/config.yml`
|
|
256
|
+
| File | Scope | Purpose |
|
|
257
|
+
|------|-------|---------|
|
|
258
|
+
| `~/.aiv/config.yml` | Global | AI providers, GitHub accounts, defaults |
|
|
259
|
+
| `.aiv/config.yml` | Repo | Owner/repo override, account override, token limits |
|
|
263
260
|
|
|
264
|
-
Repo
|
|
261
|
+
Repo settings always override global defaults.
|
|
265
262
|
|
|
266
263
|
---
|
|
267
264
|
|
|
268
|
-
### Global Config
|
|
265
|
+
### Global Config
|
|
269
266
|
|
|
270
|
-
|
|
267
|
+
`~/.aiv/config.yml` — created by `aiv init`, shared across all repos.
|
|
271
268
|
|
|
272
269
|
```yaml
|
|
273
270
|
lang: en # 'en' or 'es'
|
|
274
271
|
|
|
275
272
|
providers:
|
|
276
|
-
default: claude #
|
|
277
|
-
|
|
273
|
+
default: claude # active provider
|
|
274
|
+
fallback: [openai, gemini] # tried in order on quota/rate errors
|
|
275
|
+
agents: # per-agent overrides (provider or provider/model)
|
|
276
|
+
business: claude/claude-sonnet-4-6
|
|
277
|
+
architecture: gemini/gemini-2.0-flash
|
|
278
|
+
security: openai/gpt-4.1
|
|
279
|
+
context: claude/claude-sonnet-4-6
|
|
280
|
+
|
|
281
|
+
# Built-in providers
|
|
278
282
|
claude:
|
|
279
283
|
model: claude-sonnet-4-6
|
|
280
|
-
api_key_env: CLAUDE_API_KEY
|
|
284
|
+
api_key_env: CLAUDE_API_KEY
|
|
281
285
|
|
|
282
286
|
openai:
|
|
283
287
|
model: gpt-4.1
|
|
284
|
-
api_key_env: OPENAI_API_KEY
|
|
288
|
+
api_key_env: OPENAI_API_KEY
|
|
289
|
+
|
|
290
|
+
gemini:
|
|
291
|
+
model: gemini-2.0-flash
|
|
292
|
+
api_key_env: GEMINI_API_KEY
|
|
293
|
+
|
|
294
|
+
# Custom OpenAI-compatible providers
|
|
295
|
+
custom_providers:
|
|
296
|
+
kimi:
|
|
297
|
+
base_url: https://api.moonshot.cn/v1
|
|
298
|
+
api_key_env: KIMI_API_KEY
|
|
299
|
+
model: moonshot-v1-8k
|
|
300
|
+
groq:
|
|
301
|
+
base_url: https://api.groq.com/openai/v1
|
|
302
|
+
api_key_env: GROQ_API_KEY
|
|
303
|
+
model: llama-3.3-70b-versatile
|
|
285
304
|
|
|
286
305
|
review:
|
|
287
|
-
max_tokens: 20000
|
|
288
|
-
max_findings: 20
|
|
306
|
+
max_tokens: 20000
|
|
307
|
+
max_findings: 20
|
|
289
308
|
|
|
290
309
|
github:
|
|
291
310
|
default_account: personal
|
|
@@ -302,9 +321,9 @@ github:
|
|
|
302
321
|
|
|
303
322
|
---
|
|
304
323
|
|
|
305
|
-
### Repo Config
|
|
324
|
+
### Repo Config
|
|
306
325
|
|
|
307
|
-
|
|
326
|
+
`.aiv/config.yml` — created per repository by `aiv init`.
|
|
308
327
|
|
|
309
328
|
```yaml
|
|
310
329
|
github:
|
|
@@ -317,13 +336,11 @@ review:
|
|
|
317
336
|
max_findings: 30
|
|
318
337
|
```
|
|
319
338
|
|
|
320
|
-
Leave any field out to inherit from global config. The `account` field references a named account defined in `~/.aiv/config.yml`.
|
|
321
|
-
|
|
322
339
|
---
|
|
323
340
|
|
|
324
|
-
### Rules
|
|
341
|
+
### Rules
|
|
325
342
|
|
|
326
|
-
|
|
343
|
+
`.aiv/rules.yml` — custom review rules passed to every agent on every review.
|
|
327
344
|
|
|
328
345
|
```yaml
|
|
329
346
|
sensitive_modules:
|
|
@@ -345,25 +362,25 @@ business_rules:
|
|
|
345
362
|
- directDbWrite
|
|
346
363
|
```
|
|
347
364
|
|
|
348
|
-
Rules are passed verbatim to every agent on every review. The business and security agents use them to flag violations explicitly.
|
|
349
|
-
|
|
350
365
|
---
|
|
351
366
|
|
|
352
|
-
### Context
|
|
367
|
+
### Context
|
|
368
|
+
|
|
369
|
+
`.aiv/context.md` — project background that agents read before analyzing the diff.
|
|
353
370
|
|
|
354
|
-
Auto-generated by `aiv init
|
|
371
|
+
Auto-generated by `aiv init`, `aiv context refresh`, and `aiv context generate`. You can edit it freely — custom sections are preserved on the next refresh.
|
|
355
372
|
|
|
356
373
|
```markdown
|
|
357
374
|
## Business Context
|
|
358
375
|
|
|
359
|
-
|
|
360
|
-
All changes
|
|
361
|
-
|
|
376
|
+
E-commerce platform handling real-money transactions.
|
|
377
|
+
All changes in `src/payments/` must include an audit log entry.
|
|
378
|
+
`UserBalance` must never be modified outside the `billing` module.
|
|
362
379
|
|
|
363
380
|
## Architecture
|
|
364
381
|
|
|
365
382
|
Three-layer: HTTP handlers → service layer → repositories.
|
|
366
|
-
|
|
383
|
+
Services must not import from handlers.
|
|
367
384
|
|
|
368
385
|
## Sensitive Zones
|
|
369
386
|
|
|
@@ -377,63 +394,32 @@ The richer this file, the more accurate the agent findings.
|
|
|
377
394
|
|
|
378
395
|
## GitHub Account Management
|
|
379
396
|
|
|
380
|
-
aiv supports multiple GitHub accounts (personal, work, CI bot) stored globally and activated per repo.
|
|
381
|
-
|
|
382
397
|
### Add accounts
|
|
383
398
|
|
|
384
399
|
```bash
|
|
385
|
-
# Minimum — just the env var name
|
|
386
400
|
aiv config add-account personal --token-env GITHUB_TOKEN
|
|
387
|
-
|
|
388
|
-
# With optional metadata
|
|
389
401
|
aiv config add-account work \
|
|
390
402
|
--token-env GITHUB_TOKEN_WORK \
|
|
391
403
|
--username alice-corp \
|
|
392
|
-
--description "Work GitHub
|
|
393
|
-
|
|
394
|
-
# Overwrite an existing account
|
|
395
|
-
aiv config add-account work --token-env NEW_VAR --force
|
|
404
|
+
--description "Work GitHub"
|
|
405
|
+
aiv config add-account work --token-env NEW_VAR --force # overwrite
|
|
396
406
|
```
|
|
397
407
|
|
|
398
|
-
###
|
|
399
|
-
|
|
400
|
-
```bash
|
|
401
|
-
aiv config accounts
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
Shows all configured accounts, their token env vars, which ones are set, and which is the global default.
|
|
405
|
-
|
|
406
|
-
### Set global default
|
|
407
|
-
|
|
408
|
-
```bash
|
|
409
|
-
aiv config default-account work
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
All repos without an explicit account override will use this account.
|
|
413
|
-
|
|
414
|
-
### Use a specific account for one repo
|
|
415
|
-
|
|
416
|
-
```bash
|
|
417
|
-
cd my-work-repo
|
|
418
|
-
aiv config use-account work
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
This writes `github.account: work` into `.aiv/config.yml`. Only affects the current repo.
|
|
422
|
-
|
|
423
|
-
### Remove an account
|
|
408
|
+
### Manage accounts
|
|
424
409
|
|
|
425
410
|
```bash
|
|
411
|
+
aiv config accounts # list all accounts + token status
|
|
412
|
+
aiv config default-account work # set global default
|
|
413
|
+
aiv config use-account work # use this account for current repo
|
|
426
414
|
aiv config remove-account old-account
|
|
427
415
|
```
|
|
428
416
|
|
|
429
417
|
### Account resolution order
|
|
430
418
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
1. `github.account` in `.aiv/config.yml` (repo-level override)
|
|
419
|
+
1. `github.account` in `.aiv/config.yml`
|
|
434
420
|
2. `github.default_account` in `~/.aiv/config.yml`
|
|
435
|
-
3. First account
|
|
436
|
-
4.
|
|
421
|
+
3. First account in `~/.aiv/config.yml`
|
|
422
|
+
4. `GITHUB_TOKEN` env var directly
|
|
437
423
|
|
|
438
424
|
---
|
|
439
425
|
|
|
@@ -443,9 +429,9 @@ aiv supports three kinds of providers:
|
|
|
443
429
|
|
|
444
430
|
| Type | Examples | Notes |
|
|
445
431
|
|------|----------|-------|
|
|
446
|
-
| **Built-in** | Claude, OpenAI, Gemini | Native adapters,
|
|
447
|
-
| **OpenAI-compatible** | Kimi, Groq, Mistral, DeepSeek, Ollama,
|
|
448
|
-
| **Mock** | — | Deterministic offline responses
|
|
432
|
+
| **Built-in** | Claude, OpenAI, Gemini | Native adapters, no extra setup |
|
|
433
|
+
| **OpenAI-compatible** | Kimi, Groq, Mistral, DeepSeek, Ollama, … | Any provider with a compatible endpoint |
|
|
434
|
+
| **Mock** | — | Deterministic offline responses |
|
|
449
435
|
|
|
450
436
|
---
|
|
451
437
|
|
|
@@ -456,7 +442,7 @@ export CLAUDE_API_KEY=sk-ant-...
|
|
|
456
442
|
aiv config set-provider claude
|
|
457
443
|
```
|
|
458
444
|
|
|
459
|
-
Update model or key env
|
|
445
|
+
Update model or key env:
|
|
460
446
|
|
|
461
447
|
```bash
|
|
462
448
|
aiv config add-provider claude --model claude-opus-4-7
|
|
@@ -464,7 +450,6 @@ aiv config add-provider claude --api-key-env MY_CLAUDE_KEY
|
|
|
464
450
|
```
|
|
465
451
|
|
|
466
452
|
```yaml
|
|
467
|
-
# ~/.aiv/config.yml
|
|
468
453
|
claude:
|
|
469
454
|
model: claude-sonnet-4-6
|
|
470
455
|
api_key_env: CLAUDE_API_KEY
|
|
@@ -489,17 +474,12 @@ openai:
|
|
|
489
474
|
|
|
490
475
|
### Google Gemini
|
|
491
476
|
|
|
492
|
-
Gemini uses a dedicated REST adapter
|
|
477
|
+
Gemini uses a dedicated REST adapter — no extra SDK or dependency required.
|
|
493
478
|
|
|
494
479
|
```bash
|
|
495
480
|
export GEMINI_API_KEY=AIza...
|
|
496
481
|
aiv config set-provider gemini
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
Update model:
|
|
500
|
-
|
|
501
|
-
```bash
|
|
502
|
-
aiv config add-provider gemini --model gemini-2.0-flash-exp
|
|
482
|
+
aiv config add-provider gemini --model gemini-2.0-flash-exp # change model
|
|
503
483
|
```
|
|
504
484
|
|
|
505
485
|
```yaml
|
|
@@ -510,27 +490,24 @@ gemini:
|
|
|
510
490
|
|
|
511
491
|
---
|
|
512
492
|
|
|
513
|
-
### OpenAI-compatible providers
|
|
493
|
+
### OpenAI-compatible providers
|
|
514
494
|
|
|
515
|
-
Any provider that exposes an OpenAI-compatible API can be registered with one command
|
|
495
|
+
Any provider that exposes an OpenAI-compatible API can be registered with one command — no code changes, no updates needed when new providers launch.
|
|
516
496
|
|
|
517
497
|
```bash
|
|
518
498
|
# Kimi (Moonshot AI)
|
|
519
|
-
export KIMI_API_KEY=sk-...
|
|
520
499
|
aiv config add-provider kimi \
|
|
521
500
|
--base-url https://api.moonshot.cn/v1 \
|
|
522
501
|
--api-key-env KIMI_API_KEY \
|
|
523
502
|
--model moonshot-v1-8k
|
|
524
503
|
|
|
525
504
|
# Groq
|
|
526
|
-
export GROQ_API_KEY=gsk_...
|
|
527
505
|
aiv config add-provider groq \
|
|
528
506
|
--base-url https://api.groq.com/openai/v1 \
|
|
529
507
|
--api-key-env GROQ_API_KEY \
|
|
530
508
|
--model llama-3.3-70b-versatile
|
|
531
509
|
|
|
532
510
|
# Mistral
|
|
533
|
-
export MISTRAL_API_KEY=...
|
|
534
511
|
aiv config add-provider mistral \
|
|
535
512
|
--base-url https://api.mistral.ai/v1 \
|
|
536
513
|
--api-key-env MISTRAL_API_KEY \
|
|
@@ -548,26 +525,25 @@ aiv config add-provider together \
|
|
|
548
525
|
--api-key-env TOGETHER_API_KEY \
|
|
549
526
|
--model meta-llama/Llama-3-70b-chat-hf
|
|
550
527
|
|
|
551
|
-
# Ollama (local, no key
|
|
528
|
+
# Ollama (local, no key required)
|
|
552
529
|
aiv config add-provider ollama \
|
|
553
530
|
--base-url http://localhost:11434/v1 \
|
|
554
531
|
--api-key-env OLLAMA_API_KEY \
|
|
555
532
|
--model llama3.2
|
|
556
|
-
```
|
|
557
533
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
aiv config set-fallback groq openai
|
|
534
|
+
# Any future provider that adopts the OpenAI spec
|
|
535
|
+
aiv config add-provider newprovider \
|
|
536
|
+
--base-url https://api.newprovider.com/v1 \
|
|
537
|
+
--api-key-env NEWPROVIDER_API_KEY \
|
|
538
|
+
--model their-model-name
|
|
564
539
|
```
|
|
565
540
|
|
|
566
|
-
|
|
541
|
+
Once registered, custom providers work exactly like built-ins:
|
|
567
542
|
|
|
568
543
|
```bash
|
|
569
|
-
aiv config
|
|
570
|
-
aiv config
|
|
544
|
+
aiv config set-provider kimi
|
|
545
|
+
aiv config list-providers # built-ins + custom
|
|
546
|
+
aiv config remove-provider kimi
|
|
571
547
|
aiv config add-provider kimi --model moonshot-v1-32k --force # update
|
|
572
548
|
```
|
|
573
549
|
|
|
@@ -575,36 +551,41 @@ aiv config add-provider kimi --model moonshot-v1-32k --force # update
|
|
|
575
551
|
|
|
576
552
|
### Per-agent provider assignment
|
|
577
553
|
|
|
578
|
-
|
|
554
|
+
Each agent (and the context generator) can use a different provider or model:
|
|
579
555
|
|
|
580
556
|
```bash
|
|
557
|
+
# Assign provider/model per agent
|
|
581
558
|
aiv config set-agent-provider business claude/claude-sonnet-4-6
|
|
582
559
|
aiv config set-agent-provider security openai/gpt-4.1
|
|
583
560
|
aiv config set-agent-provider architecture gemini/gemini-2.0-flash
|
|
584
561
|
aiv config set-agent-provider context kimi/moonshot-v1-8k
|
|
585
562
|
|
|
563
|
+
# Use just a provider name (uses that provider's default model)
|
|
564
|
+
aiv config set-agent-provider business groq
|
|
565
|
+
|
|
586
566
|
# View current assignments
|
|
587
567
|
aiv config show-agents
|
|
588
568
|
|
|
589
|
-
# Remove
|
|
569
|
+
# Remove override (reverts to default provider)
|
|
590
570
|
aiv config set-agent-provider business --clear
|
|
591
571
|
```
|
|
592
572
|
|
|
573
|
+
Valid agent roles: `business`, `architecture`, `security`, `context`.
|
|
574
|
+
|
|
575
|
+
The `context` role is used by `aiv context generate`. All other roles map to the review agents.
|
|
576
|
+
|
|
593
577
|
---
|
|
594
578
|
|
|
595
579
|
### Fallback chain
|
|
596
580
|
|
|
597
|
-
If
|
|
581
|
+
If any provider hits a rate limit or quota error (HTTP 429, overloaded, insufficient quota), aiv automatically switches to the next provider in the chain — for the rest of that run.
|
|
598
582
|
|
|
599
583
|
```bash
|
|
600
|
-
|
|
601
|
-
aiv config set-fallback
|
|
602
|
-
|
|
603
|
-
# Clear the chain
|
|
604
|
-
aiv config set-fallback
|
|
584
|
+
aiv config set-fallback openai gemini groq # try in this order
|
|
585
|
+
aiv config set-fallback # clear the chain
|
|
605
586
|
```
|
|
606
587
|
|
|
607
|
-
When a fallback fires
|
|
588
|
+
When a fallback fires:
|
|
608
589
|
|
|
609
590
|
```
|
|
610
591
|
⚡ "claude" quota/rate limit — switching to "openai"
|
|
@@ -618,17 +599,14 @@ When a fallback fires, aiv prints:
|
|
|
618
599
|
aiv config set-provider mock
|
|
619
600
|
```
|
|
620
601
|
|
|
621
|
-
Returns deterministic placeholder findings. Use this to test the CLI
|
|
602
|
+
Returns deterministic placeholder findings. Use this to test the CLI without consuming API credits.
|
|
622
603
|
|
|
623
604
|
---
|
|
624
605
|
|
|
625
606
|
## Review Output
|
|
626
607
|
|
|
627
|
-
A typical review looks like:
|
|
628
|
-
|
|
629
608
|
```
|
|
630
609
|
aiv review — PR #42
|
|
631
|
-
|
|
632
610
|
Account: personal (GITHUB_TOKEN)
|
|
633
611
|
|
|
634
612
|
✔ PR loaded: "Add payment retry logic" (8 files)
|
|
@@ -649,10 +627,8 @@ A typical review looks like:
|
|
|
649
627
|
───────────────
|
|
650
628
|
[HIGH] Missing idempotency key on retry
|
|
651
629
|
File: src/payments/retry.ts
|
|
652
|
-
|
|
653
|
-
the
|
|
654
|
-
Suggestion: Pass a stable idempotency key derived from the
|
|
655
|
-
original transaction ID.
|
|
630
|
+
Suggestion: Pass a stable idempotency key derived from
|
|
631
|
+
the original transaction ID.
|
|
656
632
|
|
|
657
633
|
Business Risks
|
|
658
634
|
──────────────
|
|
@@ -662,8 +638,6 @@ A typical review looks like:
|
|
|
662
638
|
Architecture Issues
|
|
663
639
|
───────────────────
|
|
664
640
|
[MEDIUM] Direct database write outside billing module
|
|
665
|
-
src/payments/retry.ts imports UserBalance from outside
|
|
666
|
-
the billing boundary.
|
|
667
641
|
|
|
668
642
|
Agent Summaries
|
|
669
643
|
───────────────
|
|
@@ -674,8 +648,6 @@ A typical review looks like:
|
|
|
674
648
|
|
|
675
649
|
### Risk score
|
|
676
650
|
|
|
677
|
-
Computed as `max_score × 0.6 + average_score × 0.4` across all agents.
|
|
678
|
-
|
|
679
651
|
| Score | Label |
|
|
680
652
|
|--------|----------|
|
|
681
653
|
| 0–25 | LOW |
|
|
@@ -683,62 +655,80 @@ Computed as `max_score × 0.6 + average_score × 0.4` across all agents.
|
|
|
683
655
|
| 51–75 | HIGH |
|
|
684
656
|
| 76–100 | CRITICAL |
|
|
685
657
|
|
|
686
|
-
|
|
658
|
+
Computed as `max_score × 0.6 + average_score × 0.4` across all agents.
|
|
687
659
|
|
|
688
|
-
|
|
660
|
+
### JSON output
|
|
689
661
|
|
|
690
662
|
```bash
|
|
691
663
|
aiv review 42 --json | jq '.riskScore'
|
|
692
664
|
aiv review 42 --json > review-42.json
|
|
693
665
|
```
|
|
694
666
|
|
|
695
|
-
|
|
667
|
+
Shape: `prNumber`, `prTitle`, `riskScore`, `riskLabel`, `executiveSummary`, `agents[]`, `securityIssues[]`, `businessRisks[]`, `architectureIssues[]`, `possibleRegressions[]`.
|
|
668
|
+
|
|
669
|
+
`--json` skips the post-review action prompt.
|
|
696
670
|
|
|
697
671
|
---
|
|
698
672
|
|
|
699
|
-
##
|
|
673
|
+
## Post-review Actions
|
|
674
|
+
|
|
675
|
+
After every review in an interactive terminal, aiv asks:
|
|
700
676
|
|
|
701
|
-
|
|
677
|
+
```
|
|
678
|
+
? What would you like to do with this PR?
|
|
679
|
+
❯ ✔ Approve PR
|
|
680
|
+
⚑ Request Changes
|
|
681
|
+
────────────────────────────────────────
|
|
682
|
+
↩ Skip
|
|
683
|
+
```
|
|
702
684
|
|
|
703
|
-
|
|
685
|
+
- **Approve** — submits an `APPROVE` review to GitHub, then auto-refreshes `context.md` and `tree.json`
|
|
686
|
+
- **Request Changes** — submits a `REQUEST_CHANGES` review to GitHub
|
|
687
|
+
- **Skip** — does nothing, exits cleanly
|
|
688
|
+
|
|
689
|
+
The context refresh on approval ensures agents have current information for future reviews of the same repo.
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## Multi-language
|
|
694
|
+
|
|
695
|
+
aiv supports English and Spanish. All output — errors, spinners, table headers, severity labels — follows the configured language.
|
|
704
696
|
|
|
705
697
|
```bash
|
|
706
|
-
# Permanently (saved to ~/.aiv/config.yml)
|
|
707
698
|
aiv config set-lang es
|
|
708
699
|
aiv config set-lang en
|
|
709
700
|
|
|
710
|
-
#
|
|
711
|
-
AIV_LANG=es aiv prs
|
|
712
|
-
AIV_LANG=en aiv review 42
|
|
701
|
+
AIV_LANG=es aiv prs # per-session override
|
|
713
702
|
```
|
|
714
703
|
|
|
715
|
-
###
|
|
704
|
+
### Detection order
|
|
716
705
|
|
|
717
706
|
1. `AIV_LANG` environment variable
|
|
718
707
|
2. `lang` in `~/.aiv/config.yml`
|
|
719
|
-
3. System `LANG`
|
|
708
|
+
3. System `LANG` variable (`es_*` locales → Spanish)
|
|
720
709
|
4. Default: `en`
|
|
721
710
|
|
|
722
711
|
---
|
|
723
712
|
|
|
724
713
|
## Environment Variables
|
|
725
714
|
|
|
726
|
-
| Variable
|
|
727
|
-
|
|
728
|
-
| `GITHUB_TOKEN`
|
|
729
|
-
| `CLAUDE_API_KEY`
|
|
730
|
-
| `OPENAI_API_KEY`
|
|
731
|
-
| `
|
|
732
|
-
| `
|
|
715
|
+
| Variable | Required | Description |
|
|
716
|
+
|----------|----------|-------------|
|
|
717
|
+
| `GITHUB_TOKEN` | Yes | GitHub personal access token (default account) |
|
|
718
|
+
| `CLAUDE_API_KEY` | Yes* | Anthropic API key (*when using Claude) |
|
|
719
|
+
| `OPENAI_API_KEY` | Yes* | OpenAI API key (*when using OpenAI) |
|
|
720
|
+
| `GEMINI_API_KEY` | Yes* | Google AI API key (*when using Gemini) |
|
|
721
|
+
| `AIV_LANG` | No | Override display language (`en` or `es`) |
|
|
722
|
+
| `LANG` | No | System locale (auto-detected by aiv) |
|
|
733
723
|
|
|
734
|
-
For
|
|
724
|
+
For custom providers, the env var name is whatever you passed to `--api-key-env`:
|
|
735
725
|
|
|
736
726
|
```bash
|
|
737
|
-
export
|
|
738
|
-
aiv config add-
|
|
727
|
+
export KIMI_API_KEY=sk-...
|
|
728
|
+
aiv config add-provider kimi --api-key-env KIMI_API_KEY ...
|
|
739
729
|
```
|
|
740
730
|
|
|
741
|
-
GitHub tokens require `repo` scope to read pull requests and diffs.
|
|
731
|
+
GitHub tokens require `repo` scope to read pull requests and diffs. To submit reviews (approve/request changes), the token also needs `pull_requests:write` scope.
|
|
742
732
|
|
|
743
733
|
---
|
|
744
734
|
|
|
@@ -746,26 +736,21 @@ GitHub tokens require `repo` scope to read pull requests and diffs.
|
|
|
746
736
|
|
|
747
737
|
### `Not initialized. Run aiv init first.`
|
|
748
738
|
|
|
749
|
-
|
|
739
|
+
`.aiv/config.yml` does not exist in the current directory.
|
|
750
740
|
|
|
751
741
|
```bash
|
|
752
|
-
cd your-repo
|
|
753
|
-
aiv init
|
|
742
|
+
cd your-repo && aiv init
|
|
754
743
|
```
|
|
755
744
|
|
|
756
745
|
---
|
|
757
746
|
|
|
758
747
|
### `Missing env var: GITHUB_TOKEN (account: default)`
|
|
759
748
|
|
|
760
|
-
The token env var for the active account is not set
|
|
749
|
+
The token env var for the active account is not set.
|
|
761
750
|
|
|
762
751
|
```bash
|
|
763
752
|
export GITHUB_TOKEN=ghp_...
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
If you use a named account with a different env var, check which account is active and what it expects:
|
|
767
|
-
|
|
768
|
-
```bash
|
|
753
|
+
# or check which account/var is active:
|
|
769
754
|
aiv config accounts
|
|
770
755
|
```
|
|
771
756
|
|
|
@@ -773,71 +758,60 @@ aiv config accounts
|
|
|
773
758
|
|
|
774
759
|
### `Missing env var: CLAUDE_API_KEY`
|
|
775
760
|
|
|
776
|
-
The AI provider API key is not set. Set the env var or switch providers:
|
|
777
|
-
|
|
778
761
|
```bash
|
|
779
762
|
export CLAUDE_API_KEY=sk-ant-...
|
|
780
|
-
# or switch
|
|
763
|
+
# or switch providers:
|
|
781
764
|
aiv config set-provider openai
|
|
782
|
-
export OPENAI_API_KEY=sk-...
|
|
783
765
|
```
|
|
784
766
|
|
|
785
767
|
---
|
|
786
768
|
|
|
787
|
-
### `
|
|
769
|
+
### `Unknown provider: "xyz".`
|
|
788
770
|
|
|
789
|
-
|
|
771
|
+
A provider name was used that isn't registered.
|
|
790
772
|
|
|
791
|
-
Fix — pass flags directly:
|
|
792
773
|
```bash
|
|
793
|
-
aiv
|
|
794
|
-
aiv
|
|
795
|
-
```
|
|
796
|
-
|
|
797
|
-
Fix — set permanently in repo config:
|
|
798
|
-
```bash
|
|
799
|
-
aiv config set-repo myorg myrepo
|
|
774
|
+
aiv config list-providers # see what's configured
|
|
775
|
+
aiv config add-provider xyz --base-url <url> --api-key-env XYZ_API_KEY --model <model>
|
|
800
776
|
```
|
|
801
777
|
|
|
802
778
|
---
|
|
803
779
|
|
|
804
|
-
### `
|
|
780
|
+
### `Could not detect GitHub owner/repo.`
|
|
805
781
|
|
|
806
|
-
|
|
782
|
+
The git remote is missing or not a GitHub URL.
|
|
807
783
|
|
|
808
784
|
```bash
|
|
809
|
-
aiv
|
|
810
|
-
|
|
785
|
+
aiv prs --owner myorg --repo myrepo
|
|
786
|
+
# or set permanently:
|
|
787
|
+
aiv config set-repo myorg myrepo
|
|
811
788
|
```
|
|
812
789
|
|
|
813
790
|
---
|
|
814
791
|
|
|
815
|
-
### `Account "xyz"
|
|
792
|
+
### `Account "xyz" not found.`
|
|
816
793
|
|
|
817
794
|
```bash
|
|
818
|
-
aiv config
|
|
795
|
+
aiv config accounts
|
|
796
|
+
aiv config add-account xyz --token-env MY_TOKEN
|
|
819
797
|
```
|
|
820
798
|
|
|
821
799
|
---
|
|
822
800
|
|
|
823
801
|
### `Failed to fetch PR: ...`
|
|
824
802
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
-
|
|
828
|
-
-
|
|
829
|
-
- GitHub rate limit hit — wait or switch to a token with higher limits
|
|
830
|
-
- Wrong `owner`/`repo` — verify with `aiv config show`
|
|
803
|
+
- Token lacks `repo` scope — regenerate
|
|
804
|
+
- PR number doesn't exist
|
|
805
|
+
- GitHub rate limit — wait or switch token
|
|
806
|
+
- Wrong owner/repo — check with `aiv config show`
|
|
831
807
|
|
|
832
808
|
---
|
|
833
809
|
|
|
834
810
|
### `Review failed: ...`
|
|
835
811
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
-
|
|
839
|
-
- Model quota exceeded
|
|
840
|
-
- Network timeout on a very large diff — reduce `max_tokens` in config:
|
|
812
|
+
- API key invalid or expired
|
|
813
|
+
- Model quota exceeded — configure a [fallback chain](#fallback-chain)
|
|
814
|
+
- Diff too large — reduce `max_tokens`:
|
|
841
815
|
|
|
842
816
|
```yaml
|
|
843
817
|
# .aiv/config.yml
|
|
@@ -849,81 +823,90 @@ review:
|
|
|
849
823
|
|
|
850
824
|
## Best Practices
|
|
851
825
|
|
|
852
|
-
###
|
|
826
|
+
### Let AI bootstrap your context and rules
|
|
827
|
+
|
|
828
|
+
Right after `aiv init`, run:
|
|
829
|
+
|
|
830
|
+
```bash
|
|
831
|
+
aiv context generate
|
|
832
|
+
```
|
|
853
833
|
|
|
854
|
-
|
|
834
|
+
This gives you a ready-to-edit `context.md` and `rules.yml` based on what the AI infers from your project. Tune what it gets wrong rather than writing from scratch.
|
|
855
835
|
|
|
856
|
-
###
|
|
836
|
+
### Keep rules.yml current
|
|
857
837
|
|
|
858
|
-
Add a rule
|
|
838
|
+
Add a rule whenever your team agrees on a pattern reviews should catch:
|
|
859
839
|
|
|
860
840
|
```yaml
|
|
861
841
|
business_rules:
|
|
862
842
|
orders:
|
|
863
|
-
required_calls:
|
|
864
|
-
|
|
865
|
-
forbidden_patterns:
|
|
866
|
-
- skipFraudCheck
|
|
843
|
+
required_calls: [validateInventory]
|
|
844
|
+
forbidden_patterns: [skipFraudCheck]
|
|
867
845
|
```
|
|
868
846
|
|
|
869
|
-
### Refresh context after
|
|
847
|
+
### Refresh context after structural changes
|
|
870
848
|
|
|
871
849
|
```bash
|
|
872
850
|
aiv context refresh
|
|
873
851
|
```
|
|
874
852
|
|
|
875
|
-
Run
|
|
853
|
+
Run after merging large refactors, adding modules, or changing the project layout.
|
|
876
854
|
|
|
877
|
-
### Use
|
|
878
|
-
|
|
879
|
-
Not every PR needs all three agents. If you're reviewing a dependency bump, only security matters. If it's a UI-only change, skip security and architecture:
|
|
855
|
+
### Use a fallback chain for reliability
|
|
880
856
|
|
|
881
857
|
```bash
|
|
882
|
-
aiv
|
|
883
|
-
aiv review 202 --agent business architecture
|
|
858
|
+
aiv config set-fallback openai gemini
|
|
884
859
|
```
|
|
885
860
|
|
|
886
|
-
|
|
861
|
+
If your primary provider is rate-limited mid-review, aiv switches automatically without losing the run.
|
|
862
|
+
|
|
863
|
+
### Match model to task with per-agent assignment
|
|
887
864
|
|
|
888
|
-
|
|
865
|
+
Use a fast/cheap model for straightforward agents and a powerful one for the critical ones:
|
|
889
866
|
|
|
890
|
-
|
|
867
|
+
```bash
|
|
868
|
+
aiv config set-agent-provider business claude/claude-haiku-4-5
|
|
869
|
+
aiv config set-agent-provider architecture claude/claude-haiku-4-5
|
|
870
|
+
aiv config set-agent-provider security claude/claude-sonnet-4-6 # strongest model here
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
### Use `--agent` to narrow focus
|
|
891
874
|
|
|
892
875
|
```bash
|
|
893
|
-
aiv
|
|
894
|
-
|
|
895
|
-
--username alice \
|
|
896
|
-
--description "Personal GitHub"
|
|
876
|
+
aiv review 101 --agent security # dependency bump
|
|
877
|
+
aiv review 202 --agent business architecture # domain change
|
|
897
878
|
```
|
|
898
879
|
|
|
880
|
+
Fewer agents = faster, cheaper, more focused output.
|
|
881
|
+
|
|
899
882
|
### Commit `.aiv/` to the repository
|
|
900
883
|
|
|
901
|
-
Committing `config.yml`, `rules.yml`, and `context.md` means every team member gets identical review behavior
|
|
884
|
+
Committing `config.yml`, `rules.yml`, and `context.md` means every team member gets identical review behavior with no setup. Only exclude `tree.json`:
|
|
902
885
|
|
|
903
886
|
```
|
|
904
887
|
# .gitignore
|
|
905
888
|
.aiv/tree.json
|
|
906
889
|
```
|
|
907
890
|
|
|
908
|
-
`aiv init` adds this
|
|
891
|
+
`aiv init` adds this automatically.
|
|
909
892
|
|
|
910
|
-
###
|
|
893
|
+
### CI integration with `--json`
|
|
911
894
|
|
|
912
895
|
```bash
|
|
913
896
|
SCORE=$(aiv review $PR_NUMBER --json | jq '.riskScore')
|
|
914
897
|
if [ "$SCORE" -gt 75 ]; then
|
|
915
|
-
echo "High-risk PR — human review required
|
|
898
|
+
echo "High-risk PR — human review required"
|
|
916
899
|
exit 1
|
|
917
900
|
fi
|
|
918
901
|
```
|
|
919
902
|
|
|
920
903
|
### What aiv is not
|
|
921
904
|
|
|
922
|
-
- Not a linter
|
|
923
|
-
- Not a replacement for static analysis
|
|
924
|
-
- Not
|
|
905
|
+
- Not a linter — it won't flag semicolons or indentation
|
|
906
|
+
- Not a replacement for static analysis (ESLint, SonarQube)
|
|
907
|
+
- Not a style checker
|
|
925
908
|
|
|
926
|
-
Its value is **semantic understanding**: catching
|
|
909
|
+
Its value is **semantic understanding**: catching business rule violations, architectural drift, and security risks that automated tools miss because they require project context to understand.
|
|
927
910
|
|
|
928
911
|
---
|
|
929
912
|
|
|
@@ -931,20 +914,30 @@ Its value is **semantic understanding**: catching what automated tools miss —
|
|
|
931
914
|
|
|
932
915
|
```
|
|
933
916
|
src/
|
|
934
|
-
agents/ — business, architecture, security
|
|
917
|
+
agents/ — business, architecture, security reviewers
|
|
935
918
|
cli/
|
|
936
|
-
commands/ —
|
|
919
|
+
commands/ — init, prs, review, config, context, agents
|
|
937
920
|
banner.ts — ASCII welcome banner
|
|
938
921
|
renderer.ts — review result pretty-printer
|
|
939
|
-
selector.ts — interactive PR picker (inquirer)
|
|
922
|
+
selector.ts — interactive PR/action picker (inquirer)
|
|
940
923
|
config/ — two-level config load/save/merge
|
|
941
|
-
context/
|
|
942
|
-
|
|
924
|
+
context/
|
|
925
|
+
builder.ts — static project analysis
|
|
926
|
+
generator.ts — AI-powered context + rules generation
|
|
927
|
+
manager.ts — context reader + refreshContextFiles helper
|
|
928
|
+
tree.ts — file tree scanner
|
|
929
|
+
git/ — GitHub REST client + remote detection
|
|
943
930
|
i18n/ — EN/ES translations (all user-facing strings)
|
|
944
931
|
orchestrator/ — runs agents in parallel, aggregates results
|
|
945
|
-
providers/
|
|
932
|
+
providers/
|
|
933
|
+
claude.ts — Anthropic adapter
|
|
934
|
+
openai.ts — OpenAI adapter (supports custom baseURL)
|
|
935
|
+
gemini.ts — Google Gemini REST adapter
|
|
936
|
+
fallback.ts — FallbackProvider (quota/rate pivot)
|
|
937
|
+
factory.ts — resolves provider by name or agent role
|
|
938
|
+
mock.ts — offline test provider
|
|
946
939
|
types.ts — shared TypeScript interfaces
|
|
947
|
-
index.ts — CLI entry point
|
|
940
|
+
index.ts — CLI entry point
|
|
948
941
|
```
|
|
949
942
|
|
|
950
943
|
---
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Ut=Object.create;var Ee=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty;var Jt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Vt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ht(t))!zt.call(e,i)&&i!==n&&Ee(e,i,{get:()=>t[i],enumerable:!(o=Bt(t,i))||o.enumerable});return e};var u=(e,t,n)=>(n=e!=null?Ut(qt(e)):{},Vt(t||!e||!e.__esModule?Ee(n,"default",{value:e,enumerable:!0}):n,e));var Be=Jt((Bn,Wt)=>{Wt.exports={name:"@ateriss_/aiv-cli",version:"
|
|
2
|
+
"use strict";var Ut=Object.create;var Ee=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty;var Jt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Vt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ht(t))!zt.call(e,i)&&i!==n&&Ee(e,i,{get:()=>t[i],enumerable:!(o=Bt(t,i))||o.enumerable});return e};var u=(e,t,n)=>(n=e!=null?Ut(qt(e)):{},Vt(t||!e||!e.__esModule?Ee(n,"default",{value:e,enumerable:!0}):n,e));var Be=Jt((Bn,Wt)=>{Wt.exports={name:"@ateriss_/aiv-cli",version:"1.0.0",description:"AI-powered PR reviewer CLI \u2014 local-first, multi-agent semantic analysis",main:"dist/index.js",bin:{aiv:"dist/index.js"},scripts:{build:"tsup",typecheck:"tsc",dev:"ts-node src/index.ts",start:"node dist/index.js",prepublishOnly:"npm run build"},keywords:["ai","pr-review","cli","github","claude","openai"],author:"",license:"MIT",dependencies:{"@anthropic-ai/sdk":"^0.37.0",chalk:"^5.3.0",commander:"^12.1.0",inquirer:"^9.3.7","js-yaml":"^4.1.0","node-fetch":"^3.3.2",ora:"^8.1.1",openai:"^4.77.0",table:"^6.8.2"},devDependencies:{"@types/inquirer":"^9.0.7","@types/js-yaml":"^4.0.9","@types/node":"^22.10.0","ts-node":"^10.9.2",tsup:"^8.3.5",typescript:"^5.7.2"},engines:{node:">=18.0.0"}}});var Ot=require("commander");var se=u(require("fs")),Ge=u(require("path")),Me=u(require("os"));var Ae={notInitialized:"Not initialized. Run `aiv init` first.",invalidProvider:"Invalid provider. Choose: claude, openai, mock",invalidPrNumber:"Invalid PR number.",repoNotDetected:"Could not detect GitHub owner/repo. Use --owner and --repo flags or configure in .aiv/config.yml",initAlreadyDone:"aiv is already initialized. Use --force to reinitialize.",initTitle:` aiv \u2014 AI PR Reviewer
|
|
3
3
|
`,initWritingGlobalConfig:"Writing global config (~/.aiv/config.yml)...",initGlobalConfigCreated:"Global config created (~/.aiv/config.yml)",initGlobalConfigExists:"Global config already exists (~/.aiv/config.yml)",initWritingConfig:"Writing repo config (.aiv/config.yml)...",initConfigCreated:"Repo config created (.aiv/config.yml)",initRulesCreated:"rules.yml created",initScanningTree:"Scanning project structure...",initTreeCreated:"tree.json created",initTreeSkipped:"tree.json skipped (could not scan)",initBuildingContext:"Building project context...",initContextCreated:"context.md created",initContextSkipped:"context.md skipped (could not analyze)",initGitignoreUpdated:".gitignore updated",initSuccessTitle:`
|
|
4
4
|
Initialized! Next steps:
|
|
5
5
|
`,initStep1:e=>` Set your API key: export ${e}=your-key`,initStep2:e=>` Set GitHub token: export ${e}=your-token`,initStep3:" List PRs: aiv prs",initStep4:" Review a PR: aiv review <pr-number>",initEditContext:e=>` Edit ${e} to add business context.`,initEditRules:e=>` Edit ${e} to define your rules.`,initGlobalHint:" Global config: ~/.aiv/config.yml",initAddAccountHint:" Add accounts: aiv config add-account <name> --token-env <VAR>",selectorSelectPR:"Select a PR to review:",selectorConfirmReview:"Review",selectorCancelled:` Cancelled.
|