@ateriss_/aiv-cli 0.1.0 → 1.0.1

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