@acemarke/diffloupe 0.5.0 → 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 +11 -7
- package/dist/index.js +214 -214
- 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
|
|
|
@@ -192,7 +192,7 @@ Runs are stored under `$XDG_DATA_HOME/diffloupe/runs/<id>/` (`~/.local/share/dif
|
|
|
192
192
|
|
|
193
193
|
### `diffloupe doctor`
|
|
194
194
|
|
|
195
|
-
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
196
|
|
|
197
197
|
### `diffloupe gate`
|
|
198
198
|
|
|
@@ -402,7 +402,9 @@ Every field is optional.
|
|
|
402
402
|
| Cost limit (USD) | `maxCostUsd` | | `--max-cost` | | none |
|
|
403
403
|
| Server address | `host`, `port` | | `--host`, `--port` | | `127.0.0.1:4517` |
|
|
404
404
|
|
|
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
|
|
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.
|
|
406
408
|
|
|
407
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.
|
|
408
410
|
|
|
@@ -420,7 +422,9 @@ Each review agent runs OpenCode with its own data directory, so DiffLoupe has to
|
|
|
420
422
|
2. `apiKeys.<provider>` in `~/.config/diffloupe/config.json`. It is passed to the OpenCode processes only, not to DiffLoupe's own environment.
|
|
421
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.
|
|
422
424
|
|
|
423
|
-
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.
|
|
424
428
|
|
|
425
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.
|
|
426
430
|
|