@acemarke/diffloupe 0.4.1 → 0.5.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 +100 -23
- package/dist/index.js +272 -227
- package/dist/review-core/opencode/governor.ts +65 -2
- package/dist/web/assets/{index-Df9HLSMX.js → index-DY3NZSRS.js} +9 -9
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ It is also a plain diff viewer. `diffloupe diff` shows the same grouped diff in
|
|
|
15
15
|
## How a review works
|
|
16
16
|
|
|
17
17
|
1. **Group.** The changed files are grouped into review units from links in the code: a name defined in one file and used in another, a test and its source, an import, a shared directory. Generated and lock files are skipped. Docs are listed but not reviewed in depth.
|
|
18
|
-
2. **Review.** A small model first reads the whole diff and drafts what the change is for, so each reviewer knows what the parts it cannot see are doing. Each unit then gets its own reviewer agent, which reads the surrounding code with [tilth](https://
|
|
18
|
+
2. **Review.** A small model first reads the whole diff and drafts what the change is for, so each reviewer knows what the parts it cannot see are doing. Each unit then gets its own reviewer agent, which reads the surrounding code with [tilth](https://crates.io/crates/tilth) and reports findings with evidence. Up to six run at once.
|
|
19
19
|
3. **Coordinate.** A coordinator merges and deduplicates the findings, drops the ones it cannot verify, and checks the change against its stated intent: the PR description, `--intent`, or the commit messages.
|
|
20
20
|
4. **Walk through.** A walkthrough pass orders the change into chapters and stops, with a "start here" list.
|
|
21
21
|
|
|
@@ -45,7 +45,7 @@ Findings about code the change did not add or modify are tagged **pre-existing**
|
|
|
45
45
|
| [Bun](https://bun.sh) 1.3 or later | Runs the CLI and the server. |
|
|
46
46
|
| `git` | |
|
|
47
47
|
| [OpenCode](https://opencode.ai) 2.x | Runs every agent (`npm i -g @opencode/cli`; the older `opencode-ai` package is 1.x). Tested with 2.0.26. DiffLoupe writes its own OpenCode config for each run, so your agents, plugins and MCP servers are not used. Your default model and your `providers` block are. |
|
|
48
|
-
| [tilth](https://
|
|
48
|
+
| [tilth](https://crates.io/crates/tilth) | Code reading tools for the reviewers (`cargo install tilth`). Tested with 0.9.0. |
|
|
49
49
|
| [`gh`](https://cli.github.com) | Only for pull requests. Run `gh auth login` first. |
|
|
50
50
|
| A model provider credential | See [Credentials](#credentials). |
|
|
51
51
|
|
|
@@ -53,9 +53,9 @@ Findings about code the change did not add or modify are tagged **pre-existing**
|
|
|
53
53
|
|
|
54
54
|
Run `diffloupe doctor` to check all of this, along with which models a review will use and where each credential comes from.
|
|
55
55
|
|
|
56
|
-
**Cost.** With the built-in defaults (Claude Opus 5.5 for the reviewers and the coordinator, Claude Sonnet 5.5 for the walkthrough and group naming, Claude Haiku 5.5 for the intent draft at about $0.01), real runs so far cost about $0.10 for a one-file commit, about $1 for a small PR, and $4–5 for a large one. If your OpenCode config sets a default model, DiffLoupe uses it for every stage instead, which changes the cost. Use `--max-cost` or `maxCostUsd` to set a limit. The run page and `diffloupe runs` show what each run cost. Models whose provider reports no price show "cost not reported", and `--max-cost` cannot be enforced for them.
|
|
56
|
+
**Cost.** With the built-in defaults (Claude Opus 5.5 for the reviewers and the coordinator, Claude Sonnet 5.5 for the walkthrough and group naming, Claude Haiku 5.5 for the intent draft at about $0.01), real runs so far cost about $0.10 for a one-file commit, about $1 for a small PR, and $4–5 for a large one. If your OpenCode config sets a default model, DiffLoupe uses it for every stage instead, which changes the cost. Use `--max-cost` or `maxCostUsd` to set a limit. The run page and `diffloupe runs` show what each run cost. Models whose provider reports no price show "cost not reported", and `--max-cost` cannot be enforced for them. Models run through a Claude subscription (`claude-agent`) report $0, so `--max-cost` does not limit them either.
|
|
57
57
|
|
|
58
|
-
**Platforms.** Developed and tested on Linux and WSL2. On WSL the server binds `127.0.0.1` and the Windows browser reaches it through `localhost`. macOS should work but has not been tried. Native Windows is
|
|
58
|
+
**Platforms.** Developed and tested on Linux and WSL2. On WSL the server binds `127.0.0.1` and the Windows browser reaches it through `localhost`. macOS should work but has not been tried. Native Windows works but is less tested than WSL. One known gap: cancelling a review on Windows stops the agents and their tilth servers, but a program an agent started through Git Bash can keep running until it finishes.
|
|
59
59
|
|
|
60
60
|
## Install
|
|
61
61
|
|
|
@@ -136,6 +136,7 @@ diffloupe runs
|
|
|
136
136
|
| `--effort <level>` | Reasoning effort: `low`, `medium`, `high` |
|
|
137
137
|
| `--config <file>` | Per-repo review settings (see below) |
|
|
138
138
|
| `--max-cost <usd>` | Stop starting new review slices once spending reaches this amount. Slices already running finish, so the total can go over: by up to six slices at $3 each, plus the coordinator and walkthrough. |
|
|
139
|
+
| `--max-rounds <n>` | Skip the review when it would be past round n. With `--github`, rounds are counted from the pull request's summary comment, and the payloads only add a notice to it saying why the push was not reviewed. With `--headless`, a skipped run exits 4. |
|
|
139
140
|
| `--host <host>`, `--port <port>` | Server address (default `127.0.0.1:4517`, or the next free port) |
|
|
140
141
|
| `--open` | Open the run in a browser. On WSL this opens the Windows browser. |
|
|
141
142
|
| `--full` | On a re-review, review every changed file instead of only the files changed since the last run |
|
|
@@ -191,7 +192,20 @@ Runs are stored under `$XDG_DATA_HOME/diffloupe/runs/<id>/` (`~/.local/share/dif
|
|
|
191
192
|
|
|
192
193
|
### `diffloupe doctor`
|
|
193
194
|
|
|
194
|
-
Checks Bun, git, OpenCode, tilth and `gh
|
|
195
|
+
Checks Bun, git, OpenCode, tilth and `gh` (and Claude Code when a `claude-agent` model is used); lists the OpenCode config files it found; prints the model for each stage and where it came from, and the source of each provider credential; and shows how much disk the data directory uses. Exits non-zero if a review could not run. `--config <file>` includes a per-repo settings file in the model lookup. `--strict` also exits non-zero on warnings, such as `gh` not being logged in or a model with no known cost. `--json` prints the checks as a JSON array of `{ name, status, detail }`.
|
|
196
|
+
|
|
197
|
+
### `diffloupe gate`
|
|
198
|
+
|
|
199
|
+
`diffloupe gate '#<n>' --fail-on <severity>` reads a pull request's comments on GitHub and lists the bot's findings that are still open. It exits 3 when one of them is at or above `--fail-on`, and 0 otherwise. It runs no model and needs only `gh`. `#<n>` takes the repository from the current checkout or `GH_REPO`; outside a checkout, pass `owner/repo#<n>`. See [Failing the check on findings](#failing-the-check-on-findings) for what counts as open.
|
|
200
|
+
|
|
201
|
+
| Option | Meaning |
|
|
202
|
+
|--------|---------|
|
|
203
|
+
| `--fail-on <severity>` | Required. `blocker`, `should-fix`, `nice-to-have` or `question` |
|
|
204
|
+
| `--json` | Print the result as JSON |
|
|
205
|
+
| `--status [sha]` | Also set the `diffloupe/gate` commit status on that commit, or on the PR head when no sha is given |
|
|
206
|
+
| `--override-label <name>` | Pass the gate when the PR has this label |
|
|
207
|
+
| `--count-author-resolved` | Treat a thread the PR author resolved as closed. By default the author's own resolutions do not close findings |
|
|
208
|
+
| `--review-missing` | Say that this push's review never reached the PR (the review or post job failed). The gate then fails when the bot has never reviewed the PR |
|
|
195
209
|
|
|
196
210
|
## Running in CI
|
|
197
211
|
|
|
@@ -207,6 +221,26 @@ Checks Bun, git, OpenCode, tilth and `gh`; prints the model for each stage and w
|
|
|
207
221
|
|
|
208
222
|
`--head` pins the review to the commit the workflow was triggered for, so a push during the run does not change what gets reviewed.
|
|
209
223
|
|
|
224
|
+
Review agents may not reach the network. DiffLoupe gathers the PR description and comments itself before any agent starts, the web tools are turned off, and shell commands such as `curl`, `wget`, `gh pr`, `gh api` and `git fetch` are refused, as is inline `node -e`/`bun -e`/`python -c` code that makes a request. That check reads command lines and can be got around, so on CI also limit outbound traffic from the review job to the model provider and GitHub, and keep tokens that can write to the repository out of the review step.
|
|
225
|
+
|
|
226
|
+
### Answering a finding
|
|
227
|
+
|
|
228
|
+
The PR author, or an agent fixing the PR for them, can answer a finding with a marker and a reason, either as a reply in the finding's thread or as a PR comment:
|
|
229
|
+
|
|
230
|
+
```markdown
|
|
231
|
+
<!-- ai-review-response fp=3f9c2a1b verdict=disputed -->
|
|
232
|
+
The value is validated in `parseInput` before it gets here.
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`fp` is the finding's fingerprint, from the `fp=` field of the marker on the bot's comment or summary bullet. `verdict` is `disputed` (the finding is wrong) or `fixed` (the code now handles it); `action` works in place of `verdict`. One comment can answer several findings with one marker per paragraph. Answers are read from any account, bots included.
|
|
236
|
+
|
|
237
|
+
On the next review the coordinator rules once on each disputed finding:
|
|
238
|
+
|
|
239
|
+
- **Withdrawn**: the bot replies in the thread and marks it settled, and the finding is never reported again on that PR.
|
|
240
|
+
- **Upheld**: the bot replies that the finding still stands and leaves the thread open for a human reviewer. It does not argue the point again.
|
|
241
|
+
|
|
242
|
+
Rulings are listed in a "Disputed findings" fold at the end of the summary comment, which is how later reviews remember them. A `fixed` answer is not a ruling: the coordinator checks the code and closes the finding out as usual if the fix is there. `run.json` lists each disputed finding under `disputes` with its outcome (`withdrawn`, `upheld`, or `unjudged` when the coordinator did not rule), and `diffloupe runs stats` counts them.
|
|
243
|
+
|
|
210
244
|
### Exit codes
|
|
211
245
|
|
|
212
246
|
| Code | Meaning |
|
|
@@ -214,7 +248,8 @@ Checks Bun, git, OpenCode, tilth and `gh`; prints the model for each stage and w
|
|
|
214
248
|
| 0 | The review finished, or was skipped because the change has no code files |
|
|
215
249
|
| 1 | The run failed, including a `gh` failure under `--github` |
|
|
216
250
|
| 2 | The run could not start: a bad flag, target, model or credential |
|
|
217
|
-
| 3 | `--fail-on` was given and a finding posted in this round is at or above that severity |
|
|
251
|
+
| 3 | `--fail-on` was given and a finding posted in this round is at or above that severity. For `diffloupe gate`: an open finding is at or above `--fail-on` |
|
|
252
|
+
| 4 | `--max-rounds` was given and this review would have been past that round, so it was skipped |
|
|
218
253
|
| 130 | The run was cancelled |
|
|
219
254
|
|
|
220
255
|
### `result.json`
|
|
@@ -241,43 +276,78 @@ Written to `--out` for every finished, failed, cancelled or skipped run, and pri
|
|
|
241
276
|
"findings": {
|
|
242
277
|
"total": 7,
|
|
243
278
|
"posted": 6,
|
|
279
|
+
"minor": 0,
|
|
244
280
|
"bySeverity": { "blocker": 0, "should-fix": 2, "nice-to-have": 3, "question": 1 }
|
|
245
281
|
},
|
|
282
|
+
"progress": {
|
|
283
|
+
"open": 1,
|
|
284
|
+
"fixed": 3,
|
|
285
|
+
"withdrawn": 1,
|
|
286
|
+
"upheld": 0,
|
|
287
|
+
"fixedThisRound": 2,
|
|
288
|
+
"withdrawnThisRound": 1,
|
|
289
|
+
"new": 6
|
|
290
|
+
},
|
|
246
291
|
"round": 2,
|
|
247
292
|
"incremental": false,
|
|
248
293
|
"version": "0.4.0"
|
|
249
294
|
}
|
|
250
295
|
```
|
|
251
296
|
|
|
252
|
-
`status` is `complete`, `failed`, `cancelled` or `skipped`. `skipReason` is `no-code-files` for a skipped run. `payloads` is `null` when there is nothing to post. `findings.posted` counts the findings in the comments; `total` adds the ones over the comment cap, and `bySeverity` counts
|
|
297
|
+
`status` is `complete`, `failed`, `cancelled` or `skipped`. `skipReason` is `no-code-files` or `round-limit` (from `--max-rounds`) for a skipped run. `payloads` is `null` when there is nothing to post. `findings.posted` counts the findings in the comments; `minor` counts the ones folded into the summary's "Minor findings" section by the `post.minSeverity` setting; `total` adds the ones over the comment cap, and `bySeverity` counts posted and minor findings. `artifactName` is the name the summary comment links to, so upload `--out` under that name.
|
|
298
|
+
|
|
299
|
+
`progress` says where the bot's findings from earlier rounds stand after this review, counted by their inline comments: `open` are still unresolved (upheld disputes included), `fixed` were closed out as fixed, `withdrawn` were withdrawn after a dispute, and `upheld` were disputed but still stand and wait for a human reviewer. The `ThisRound` counts are the part of `fixed` and `withdrawn` this review decided, and `new` is the number of findings this review raised. When `new` stays above zero round after round and `fixedThisRound` stays at zero, the rounds are not converging. `progress` is `null` when nothing was reviewed. `run.json` keeps the same counts under `roundProgress`.
|
|
253
300
|
|
|
254
301
|
`--out` also holds `review.md`, `payloads.json`, `findings.md`, `record.json`, `units.json`, `byClass.json`, `run.json` and the detail report `<run id>.detail.md`. Files a run did not produce are left out.
|
|
255
302
|
|
|
256
303
|
### Failing the check on findings
|
|
257
304
|
|
|
258
|
-
|
|
305
|
+
`--fail-on` on the review counts only the findings posted in this round. On a re-review, a finding already posted in an earlier round is not posted again, so a later push can pass while an earlier blocker is still unfixed. It suits a single job or a local script: it exits 3 after writing `--out`, and ignores findings over the comment cap.
|
|
306
|
+
|
|
307
|
+
To block merges until the findings are dealt with, run `diffloupe gate` in a job after the comments are posted, and make that job the required check. It reads the PR on GitHub, so it sees every round's findings:
|
|
259
308
|
|
|
260
309
|
```yaml
|
|
261
310
|
gate:
|
|
262
311
|
needs: [review, post]
|
|
263
|
-
if:
|
|
312
|
+
if: >-
|
|
313
|
+
!cancelled() && needs.post.result != 'cancelled' &&
|
|
314
|
+
(needs.review.result == 'success' || needs.review.result == 'failure')
|
|
264
315
|
runs-on: ubuntu-latest
|
|
316
|
+
permissions:
|
|
317
|
+
pull-requests: read
|
|
318
|
+
statuses: write
|
|
265
319
|
steps:
|
|
266
|
-
- uses:
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
320
|
+
- uses: oven-sh/setup-bun@v2
|
|
321
|
+
- run: npm install -g @acemarke/diffloupe
|
|
322
|
+
- env:
|
|
323
|
+
GH_TOKEN: ${{ github.token }}
|
|
324
|
+
PR: ${{ github.event.pull_request.number }}
|
|
325
|
+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
326
|
+
REVIEW_MISSING: >-
|
|
327
|
+
${{ (needs.review.result == 'failure' ||
|
|
328
|
+
(needs.review.outputs.reviewed == 'true' && needs.post.result == 'failure')) && 'yes' || '' }}
|
|
329
|
+
run: >-
|
|
330
|
+
diffloupe gate "$GITHUB_REPOSITORY#$PR"
|
|
331
|
+
--fail-on blocker
|
|
332
|
+
--override-label ai-review-max-rounds
|
|
333
|
+
--status "$HEAD_SHA"
|
|
334
|
+
${REVIEW_MISSING:+--review-missing}
|
|
276
335
|
```
|
|
277
336
|
|
|
278
|
-
|
|
337
|
+
[`examples/github-actions/review.yml`](examples/github-actions/review.yml) is a complete workflow with the review, post and gate jobs and the round limit described below.
|
|
338
|
+
|
|
339
|
+
A finding is open when:
|
|
340
|
+
|
|
341
|
+
- it has an inline thread from the bot that is not resolved and that the bot has not settled. The bot settles a thread when it closes the finding out as fixed or withdraws it after a dispute. An outdated thread still counts, since moving the code does not fix it.
|
|
342
|
+
- or it is listed in the bot's latest summary comment and was not withdrawn. With inline comments off, every finding is only in the summary. Earlier summary findings that a review does not post again are carried forward under "Still open from earlier reviews", so they keep counting. That covers files the review did not read (an incremental review of a later push, or a file past a budget or size cap) and findings it found again but cut at the posting cap.
|
|
343
|
+
|
|
344
|
+
A thread the PR author resolved still counts unless `--count-author-resolved` is given, so the author cannot clear a blocker by closing the thread. An upheld dispute stays open until someone other than the PR author resolves the thread. If an agent resolves threads with a different account than the one that opened the PR, those resolutions count as someone else's. Severity comes from the comment's marker; a finding whose severity cannot be read is listed as `unknown` and never fails the gate. Neither does a pre-existing finding, in code the change did not touch: the gate lists it but does not count it, since the author was not asked to fix it. `--override-label` passes the gate when the PR has that label, for a human to accept the open findings.
|
|
279
345
|
|
|
280
|
-
|
|
346
|
+
With `--status`, the gate also sets a `diffloupe/gate` commit status on the PR head. Make that status the required check if you rerun the gate outside the PR's workflow, for example on `pull_request_review` events or after a dispute is ruled on, since a status on the head commit is replaced by the latest run.
|
|
347
|
+
|
|
348
|
+
Gate on `blocker` only: findings vary between runs, and a lower threshold blocks merges on false positives. The `if:` above runs the gate even when the review or post job fails, since it reads the PR and sees whatever earlier rounds and this one did get posted. A failed review of a later push therefore does not clear open blockers from earlier rounds. If reviews keep failing, the PR stays blocked on those findings until they are resolved or a human adds the override label. The example workflow also passes `--review-missing` when this push's review or post job failed, so a PR whose first review broke fails the gate instead of merging unreviewed; a PR with an earlier review is judged on what that review left open. The gate is skipped only when the review job is skipped, and GitHub counts a skipped required job as passing. "Require conversation resolution before merging" in the branch protection rules is a simpler option. It blocks on any unresolved inline comment, from the bot or a person, at any severity, but misses findings that are only in the summary.
|
|
349
|
+
|
|
350
|
+
To stop an automated fix loop from running forever, pass `--max-rounds`. A review past that round is skipped before any model runs, exits 4 under `--headless`, and writes a `result.json` with `skipReason: "round-limit"`. Its `payloads.json` only updates the summary comment: a notice at the top says the push was not reviewed and why, and the rest of the comment, with its findings and rulings, stays as the last review left it. The example workflow posts that notice, labels the PR `ai-review-max-rounds`, and passes the gate with `--override-label`, so the PR can merge after a bounded number of fix attempts and the label marks the PRs that merged with findings still open. Treat exit 4 as success in the review job, and run the post job when `skipReason` is `round-limit` as well as when `reviewed` is true.
|
|
281
351
|
|
|
282
352
|
Run `diffloupe doctor --strict` before the review to fail fast on a missing tool or credential.
|
|
283
353
|
|
|
@@ -307,6 +377,7 @@ Run `diffloupe doctor --strict` before the review to fail fast on a missing tool
|
|
|
307
377
|
"effort": "medium",
|
|
308
378
|
"surfaces": { "deploy": ["^infra/"], "tooling": ["^docs/"] },
|
|
309
379
|
"extraExcludes": ["vendor/openssl/"],
|
|
380
|
+
"post": { "minSeverity": "should-fix", "questions": "drop" },
|
|
310
381
|
"instructions": [
|
|
311
382
|
"## What failure looks like here",
|
|
312
383
|
"A change that breaks runs already saved on disk.",
|
|
@@ -331,12 +402,16 @@ Every field is optional.
|
|
|
331
402
|
| Cost limit (USD) | `maxCostUsd` | | `--max-cost` | | none |
|
|
332
403
|
| Server address | `host`, `port` | | `--host`, `--port` | | `127.0.0.1:4517` |
|
|
333
404
|
|
|
334
|
-
**Model lookup.** Each stage is looked up on its own. `REVIEW_*` environment variables win, then command-line options, then the per-repo settings file, then the user config, then
|
|
405
|
+
**Model lookup.** Each stage is looked up on its own. `REVIEW_*` environment variables win, then command-line options, then the per-repo settings file, then the user config, then OpenCode's default `model`, then the built-in defaults. A model id without a `/` gets the provider prefix, so `claude-opus-5-5` means `anthropic/claude-opus-5-5`.
|
|
406
|
+
|
|
407
|
+
**OpenCode's default model** is read from the same config files OpenCode reads, in its order: the global config (`~/.config/opencode/opencode.json(c)`), `OPENCODE_CONFIG`, project files from the reviewed repo up to the filesystem root, `.opencode/` folders, `OPENCODE_CONFIG_CONTENT`, and last the system config (`C:\ProgramData\opencode` on Windows, `/Library/Application Support/opencode` on macOS, `/etc/opencode` elsewhere). The system config also applies inside reviewer runs. Custom `providers` are taken from every file except the project files and `.opencode/` folders, because those come from the checkout under review. If the default model's provider can't be used, the review stops and names the file the model came from; DiffLoupe does not fall back to its built-in models. `diffloupe doctor` lists the files it found and where each stage's model came from.
|
|
335
408
|
|
|
336
409
|
**Effort** is passed to OpenCode as the model variant (`provider/model#high`), so it must be a variant the model offers. It is only added when you set it, or when the model is a built-in default. A model from your OpenCode config runs without a variant unless you set an effort. A `#variant` written in the model id always wins.
|
|
337
410
|
|
|
338
411
|
`surfaces` are regex sources matched against repo-relative paths. They decide which findings count toward "prod risk": anything not matched as deploy or tooling counts as product code. `extraExcludes` are path substrings left out of the code map.
|
|
339
412
|
|
|
413
|
+
`post` decides what the posted review shows. Findings below `minSeverity` (order: `blocker`, `should-fix`, `nice-to-have`, `question`) get no inline comment and are listed in a collapsed "Minor findings" section of the summary. They don't count toward `findings.posted` in `result.json`; `findings.minor` counts them. `"questions": "drop"` leaves questions out of the review entirely, so they don't take slots under the findings cap. By default every finding is posted.
|
|
414
|
+
|
|
340
415
|
`instructions` is free text given to every reviewer and the coordinator, either one string or an array of lines. Keep it short and about what the code can't tell a reviewer: what counts as breaking in this repo, invariants that are easy to break and invisible in a diff, and what not to report. Where it conflicts with the built-in review guidance, it wins.
|
|
341
416
|
|
|
342
417
|
### Credentials
|
|
@@ -347,7 +422,9 @@ Each review agent runs OpenCode with its own data directory, so DiffLoupe has to
|
|
|
347
422
|
2. `apiKeys.<provider>` in `~/.config/diffloupe/config.json`. It is passed to the OpenCode processes only, not to DiffLoupe's own environment.
|
|
348
423
|
3. An API key you saved with `opencode auth login`. DiffLoupe reads it with `opencode auth export` and imports it into each agent's data directory, which is deleted when the agent exits.
|
|
349
424
|
|
|
350
|
-
OAuth logins (such as a
|
|
425
|
+
Other OAuth logins (such as a ChatGPT subscription) are not shared with the agents; use an API key for those providers. Providers that authenticate from the machine, such as Amazon Bedrock, Google Vertex, Ollama and LM Studio, are not checked. If a provider has no credential, the review stops before it starts and names the provider, the stage, and the ways to add one.
|
|
426
|
+
|
|
427
|
+
**Claude subscription (`claude-agent`).** OpenCode's `claude-agent` provider runs models through Claude Code with your Claude login. To use it, install Claude Code 2.1.248 or newer (`claude` on `PATH`, or `OPENCODE_CLAUDE_PATH`), connect Claude Agent in OpenCode with `/connect`, and pick a `claude-agent` model in OpenCode once so it saves Claude Code's model list. DiffLoupe copies that login and model list into each agent's data directory; the login holds no secret, since Claude Code keeps its own. These runs report a cost of $0, so `--max-cost` cannot limit them; the run prints a note when that applies. Each review slice is a separate Claude Code session, so large reviews count against your subscription's usage limits.
|
|
351
428
|
|
|
352
429
|
The `diffloupe` command does not load `.env` files, so a `.env` in the repo you review cannot supply or override a key. `diffloupe doctor` shows which source each provider's credential comes from.
|
|
353
430
|
|