@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.
Files changed (3) hide show
  1. package/README.md +308 -315
  2. package/dist/index.js +1 -1
  3. 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-aivconfig-yml)
26
- - [Repo Config](#repo-config-aivconfigyml)
27
- - [Rules](#rules-aivrules-yml)
28
- - [Context](#context-aivcontextmd)
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 provider, GitHub accounts)
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. List open pull requests:**
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
- **4. Review a PR:**
106
+ **5. Review a PR:**
95
107
 
96
108
  ```bash
97
109
  aiv review 42
98
110
  ```
99
111
 
100
- That's it. The three agents run in parallel and print a full report.
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
- | Long form | Short alias | Description |
109
- |----------------------------------------|---------------|---------------------------------------------------|
110
- | `aiv init` | `aiv i` | Initialize aiv in the current repo |
111
- | `aiv prs` | `aiv p` | List open PRs and optionally review one |
112
- | `aiv review [pr-number]` | `aiv r` | Review a PR or pick one interactively |
113
- | `aiv context refresh` | `aiv ctx refresh` | Rebuild `context.md` and `tree.json` |
114
- | `aiv context show` | `aiv ctx show` | Print current `context.md` |
115
- | `aiv config show` | `aiv cf show` | Show global and repo config |
116
- | `aiv config set-provider <provider>` | `aiv cf set-provider` | Switch AI provider |
117
- | `aiv config set-repo <owner> <repo>` | `aiv cf set-repo` | Set GitHub owner/repo in repo config |
118
- | `aiv config set-lang <lang>` | `aiv cf set-lang` | Change display language (`en` / `es`) |
119
- | `aiv config rules` | `aiv cf rules` | Print `rules.yml` |
120
- | `aiv config accounts` | `aiv cf accounts` | List GitHub accounts |
121
- | `aiv config add-account <name>` | `aiv cf add-account` | Add a GitHub account |
122
- | `aiv config remove-account <name>` | `aiv cf remove-account` | Remove a GitHub account |
123
- | `aiv config default-account <name>` | `aiv cf default-account` | Set global default account |
124
- | `aiv config use-account <name>` | `aiv cf use-account` | Use an account for this repo |
125
- | `aiv agents` | `aiv a` | List available agents and their focus areas |
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 in any order — if `~/.aiv/config.yml` already exists it is preserved. Re-running `init` inside a repo always rebuilds `context.md` and `tree.json` to reflect the current state of the project.
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 and displays open pull requests in a table, then opens an interactive selector.
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
- The table shows PR number, title, author, branch, diff size (`+additions/-deletions`), and creation date. After the table, an interactive prompt lets you select a PR and launch a review without typing a number.
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. Accepts a PR number directly or launches an interactive selector if omitted.
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
- # Interactive selector (fetches open PRs first)
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
- Available agents: `business`, `architecture`, `security`. All three run in parallel by default.
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
- # Rebuild context.md and tree.json from the current directory
200
- aiv context refresh
220
+ aiv context refresh # rebuild from codebase (static analysis)
201
221
  aiv ctx refresh
202
222
 
203
- # Print the current context.md
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
- All configuration subcommands. Running `aiv config` or `aiv cf` alone prints help.
215
-
216
- ```bash
217
- # Show global and repo config files
218
- aiv config show
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 | Focus areas |
248
- |--------------|--------------------------------------------------------------------------|
249
- | business | Business logic, domain invariants, rule violations, functional regressions |
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 | Auth bypass, injection, data leakage, OWASP Top 10, sensitive data handling |
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 | Scope | Purpose |
260
- |-----------------------|--------|---------------------------------------------------|
261
- | `~/.aiv/config.yml` | Global | AI providers, GitHub accounts, default settings |
262
- | `.aiv/config.yml` | Repo | Owner/repo override, account override, token limits |
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-level settings always override global defaults.
261
+ Repo settings always override global defaults.
265
262
 
266
263
  ---
267
264
 
268
- ### Global Config (`~/.aiv/config.yml`)
265
+ ### Global Config
269
266
 
270
- Created automatically by `aiv init`. Edit manually or use `aiv config` subcommands.
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 # 'claude', 'openai', or 'mock'
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 # env var holding your Anthropic 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 # env var holding your OpenAI 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 # max tokens sent to the model per agent
288
- max_findings: 20 # max findings returned per review
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 (`.aiv/config.yml`)
324
+ ### Repo Config
306
325
 
307
- Created in each repository by `aiv init`. Overrides global defaults for that repo.
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 (`.aiv/rules.yml`)
341
+ ### Rules
325
342
 
326
- Defines custom rules that all agents respect. Edit after `aiv init`.
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 (`.aiv/context.md`)
367
+ ### Context
368
+
369
+ `.aiv/context.md` — project background that agents read before analyzing the diff.
353
370
 
354
- Auto-generated by `aiv init` and `aiv context refresh`. Contains a summary of the project that agents use as background knowledge before reading the diff. You can append custom sections manually — they are preserved on the next refresh.
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
- This is an e-commerce platform handling real-money transactions.
360
- All changes touching `src/payments/` must include an audit log entry.
361
- The `UserBalance` model must never be modified outside the `billing` module.
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
- Cross-layer imports are forbidden; services must not import from handlers.
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 account"
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
- ### List accounts
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
- When aiv needs a GitHub token it checks:
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 listed in `~/.aiv/config.yml`
436
- 4. Fallback to `GITHUB_TOKEN` env var directly
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, configured in `~/.aiv/config.yml` |
447
- | **OpenAI-compatible** | Kimi, Groq, Mistral, DeepSeek, Ollama, Together AI, … | Any new provider with a compatible endpoint — no code changes |
448
- | **Mock** | — | Deterministic offline responses for testing |
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 without editing the file:
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 (no extra SDK required).
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 (custom)
493
+ ### OpenAI-compatible providers
514
494
 
515
- Any provider that exposes an OpenAI-compatible API can be registered with one command. This includes every new provider that adopts the OpenAI spec — no code changes or updates needed.
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 needed)
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
- Once registered, use any custom provider exactly like a built-in:
559
-
560
- ```bash
561
- aiv config set-provider kimi
562
- aiv config set-agent-provider security groq/llama-3.3-70b-versatile
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
- Manage custom providers:
541
+ Once registered, custom providers work exactly like built-ins:
567
542
 
568
543
  ```bash
569
- aiv config list-providers # show all built-in + custom
570
- aiv config remove-provider kimi # remove a custom provider
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
- Run each agent with a different provider or model:
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 an override (reverts to default)
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 a provider hits a rate limit or quota error, aiv automatically switches to the next in the chain:
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
- # Try openai first, then gemini, then kimi
601
- aiv config set-fallback openai gemini kimi
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, aiv prints:
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 locally without consuming API credits.
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
- Retry attempts do not include an idempotency key, allowing
653
- the payment provider to process the same charge multiple times.
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
- ### JSON output
658
+ Computed as `max_score × 0.6 + average_score × 0.4` across all agents.
687
659
 
688
- Use `--json` to get the full structured result for scripts or CI pipelines:
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
- The JSON shape matches the `ReviewResult` type: `prNumber`, `prTitle`, `riskScore`, `riskLabel`, `executiveSummary`, `agents[]`, `securityIssues[]`, `businessRisks[]`, `architectureIssues[]`, `possibleRegressions[]`.
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
- ## Multi-language
673
+ ## Post-review Actions
674
+
675
+ After every review in an interactive terminal, aiv asks:
700
676
 
701
- aiv supports English and Spanish. All terminal output — errors, spinners, table headers, severity labels — follows the configured language.
677
+ ```
678
+ ? What would you like to do with this PR?
679
+ ❯ ✔ Approve PR
680
+ ⚑ Request Changes
681
+ ────────────────────────────────────────
682
+ ↩ Skip
683
+ ```
702
684
 
703
- ### Switch language
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
- # Per-session via env var (overrides config)
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
- ### Language detection order
704
+ ### Detection order
716
705
 
717
706
  1. `AIV_LANG` environment variable
718
707
  2. `lang` in `~/.aiv/config.yml`
719
- 3. System `LANG` environment variable (auto-detected `es_*` locales use Spanish)
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 | Required | Description |
727
- |-----------------------|----------|------------------------------------------------------|
728
- | `GITHUB_TOKEN` | Yes | GitHub personal access token (default account) |
729
- | `CLAUDE_API_KEY` | Yes* | Anthropic API key (*required when using Claude) |
730
- | `OPENAI_API_KEY` | Yes* | OpenAI API key (*required when using OpenAI) |
731
- | `AIV_LANG` | No | Override display language (`en` or `es`) |
732
- | `LANG` | No | System locale (auto-detected by aiv) |
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 additional GitHub accounts, the env var name is whatever you passed to `--token-env`:
724
+ For custom providers, the env var name is whatever you passed to `--api-key-env`:
735
725
 
736
726
  ```bash
737
- export GITHUB_TOKEN_WORK=ghp_...
738
- aiv config add-account work --token-env GITHUB_TOKEN_WORK
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
- You ran a command that requires `.aiv/config.yml` but it doesn't exist in the current directory.
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 in the environment.
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 to OpenAI
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
- ### `Could not detect GitHub owner/repo.`
769
+ ### `Unknown provider: "xyz".`
788
770
 
789
- aiv could not parse the GitHub owner and repo from `git remote get-url origin`. This happens when the remote is not a GitHub URL, the repo has no remote, or the remote uses an unsupported format.
771
+ A provider name was used that isn't registered.
790
772
 
791
- Fix — pass flags directly:
792
773
  ```bash
793
- aiv prs --owner myorg --repo myrepo
794
- aiv review 42 --owner myorg --repo myrepo
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
- ### `Account "xyz" not found.`
780
+ ### `Could not detect GitHub owner/repo.`
805
781
 
806
- You referenced an account name that doesn't exist in `~/.aiv/config.yml`.
782
+ The git remote is missing or not a GitHub URL.
807
783
 
808
784
  ```bash
809
- aiv config accounts # list what's available
810
- aiv config add-account xyz --token-env MY_TOKEN # add the missing account
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" already exists. Use --force to overwrite.`
792
+ ### `Account "xyz" not found.`
816
793
 
817
794
  ```bash
818
- aiv config add-account xyz --token-env NEW_VAR --force
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
- Network or GitHub API error. Common causes:
826
-
827
- - Token lacks `repo` scope regenerate with full repo permissions
828
- - PR number does not exist in the target repository
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 limitwait 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
- The AI provider returned an error. Common causes:
837
-
838
- - API key is invalid or expired
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
- ### Fill in context before the first review
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
- After `aiv init`, open `.aiv/context.md` and describe your project: what it does, which modules are critical, invariants that must never be violated. This is the single most impactful thing you can do to improve finding accuracy.
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
- ### Define rules for your domain
836
+ ### Keep rules.yml current
857
837
 
858
- Add a rule every time your team agrees on a pattern that reviews should enforce. Rules are passed to every agent on every review — they act as a live checklist that doesn't drift.
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
- - validateInventory
865
- forbidden_patterns:
866
- - skipFraudCheck
843
+ required_calls: [validateInventory]
844
+ forbidden_patterns: [skipFraudCheck]
867
845
  ```
868
846
 
869
- ### Refresh context after major changes
847
+ ### Refresh context after structural changes
870
848
 
871
849
  ```bash
872
850
  aiv context refresh
873
851
  ```
874
852
 
875
- Run this after merging a large refactor, adding a new module, or changing the project structure significantly. Stale context silently reduces finding quality.
853
+ Run after merging large refactors, adding modules, or changing the project layout.
876
854
 
877
- ### Use `--agent` to narrow the focus
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 review 101 --agent security
883
- aiv review 202 --agent business architecture
858
+ aiv config set-fallback openai gemini
884
859
  ```
885
860
 
886
- Fewer agents means faster results and lower API cost.
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
- ### Use named accounts from day one
865
+ Use a fast/cheap model for straightforward agents and a powerful one for the critical ones:
889
866
 
890
- Even with a single GitHub account, naming it makes configuration explicit and makes it trivial to add a second account later:
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 config add-account personal \
894
- --token-env GITHUB_TOKEN \
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 without any manual setup. Add only `tree.json` to `.gitignore` since it's a generated snapshot:
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 entry automatically.
891
+ `aiv init` adds this automatically.
909
892
 
910
- ### Integrate into CI with `--json`
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 before merge"
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 or formatter — it won't tell you about semicolons
923
- - Not a replacement for static analysis tools (ESLint, SonarQube)
924
- - Not checking code style
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 what automated tools miss — business rule violations, architectural drift, and security risks that only make sense in context.
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 (extend BaseAgent)
917
+ agents/ — business, architecture, security reviewers
935
918
  cli/
936
- commands/ — one file per command (init, prs, review, config, context, agents)
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/ — project tree scanner and context builder
942
- git/ GitHub REST client and git remote detection
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/ — Claude, OpenAI, Mock AI client wrappers
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 (Commander root)
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:"0.1.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
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ateriss_/aiv-cli",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "AI-powered PR reviewer CLI — local-first, multi-agent semantic analysis",
5
5
  "main": "dist/index.js",
6
6
  "bin": {