@acemarke/diffloupe 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,12 +15,16 @@ 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.** Each unit gets its own reviewer agent, which reads the surrounding code with [tilth](https://github.com/jahala/tilth) and reports findings with evidence. Up to six run at once.
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://github.com/jahala/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
 
22
22
  Each review is saved as a run that you can list and reopen. Reviewing the same target again links the new run to the previous one: findings that were fixed are listed as fixed, and ones still open are carried forward instead of being reported again.
23
23
 
24
+ A re-review (round 2 and later) only sends the files that changed since the previous run's head to the reviewers. Each of them sees the full diff plus what changed since the last review, and is told to focus on the new lines. The cap on new findings drops from 10 to 5. Grouping and the walkthrough still cover the whole change. If more than half the files changed, or the previous head is no longer available, the round falls back to a full review. `--full` forces one. From round 4 on, the CLI warns that later rounds mostly find smaller problems.
25
+
26
+ Findings about code the change did not add or modify are tagged **pre-existing**. They have their own cap of 3, so they never push findings on the new code out of the review. They are listed after the other findings, do not count toward merge risk, and are shown muted in the web UI.
27
+
24
28
  ## The web UI
25
29
 
26
30
  - **Summary** at the top, laid out like a GitHub review comment: merge risk and production risk, finding counts, findings grouped by file with links to their lines, whether the change matches its stated intent, what to focus on, and where to start.
@@ -40,7 +44,7 @@ Each review is saved as a run that you can list and reopen. Reviewing the same t
40
44
  |------|-------|
41
45
  | [Bun](https://bun.sh) 1.3 or later | Runs the CLI and the server. |
42
46
  | `git` | |
43
- | [OpenCode](https://opencode.ai) 2.x | Runs every agent (`npm i -g opencode-ai`). 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. |
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. |
44
48
  | [tilth](https://github.com/jahala/tilth) | Code reading tools for the reviewers (`cargo install tilth`). Tested with 0.9.0. |
45
49
  | [`gh`](https://cli.github.com) | Only for pull requests. Run `gh auth login` first. |
46
50
  | A model provider credential | See [Credentials](#credentials). |
@@ -49,7 +53,7 @@ Each review is saved as a run that you can list and reopen. Reviewing the same t
49
53
 
50
54
  Run `diffloupe doctor` to check all of this, along with which models a review will use and where each credential comes from.
51
55
 
52
- **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), 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.
53
57
 
54
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 not supported; use WSL.
55
59
 
@@ -126,14 +130,15 @@ diffloupe runs
126
130
  |--------|-------------|
127
131
  | `-C, --repo <path>` | Repository to review (default: current directory) |
128
132
  | `--base <ref>` | For `staged`/`worktree`: diff against `merge-base(<ref>, HEAD)` instead of HEAD |
129
- | `-i, --intent <text>` | Describe the intent of the changes |
133
+ | `-i, --intent <text>` | What the change should do. Every reviewer sees it labelled as yours, next to the PR description |
130
134
  | `--intent-file <path>` | Read the intent from a file |
131
- | `--model <stage=id>` | Model for a stage: `review`, `coordinator`, `walkthrough` (repeatable) |
135
+ | `--model <stage=id>` | Model for a stage: `review`, `coordinator`, `walkthrough`, `intent` (repeatable) |
132
136
  | `--effort <level>` | Reasoning effort: `low`, `medium`, `high` |
133
137
  | `--config <file>` | Per-repo review settings (see below) |
134
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. |
135
139
  | `--host <host>`, `--port <port>` | Server address (default `127.0.0.1:4517`, or the next free port) |
136
140
  | `--open` | Open the run in a browser. On WSL this opens the Windows browser. |
141
+ | `--full` | On a re-review, review every changed file instead of only the files changed since the last run |
137
142
  | `--headless` | Run without a server and print a summary to stdout |
138
143
  | `--markdown` | With `--headless`, print the full review markdown instead of the summary |
139
144
 
@@ -173,6 +178,7 @@ Runs the server until you stop it. `-C` sets the repository that runs use by def
173
178
  | `diffloupe runs [--kind review\|diff] [--json]` | List saved runs, newest first |
174
179
  | `diffloupe runs show <id> [--json]` | Show a run: groups with their files and findings, walkthrough stops, totals |
175
180
  | `diffloupe runs show <id> --markdown [--over-cap]` | Print the findings as markdown, the same text as Copy all in the UI |
181
+ | `diffloupe runs stats [--repo <path\|owner/name>] [--since 30d] [--by-version] [--json]` | For each chain of re-reviews of the same target: findings raised, carried and fixed per round, findings dismissed and still open, cost per fixed finding, and totals (resolution rate for findings on the change, mean rounds, share of chains past three rounds). `--by-version` splits the counts by the hash of the review prompts and of the repo's instructions, which each run records |
176
182
  | `diffloupe runs rm <id>` | Delete a run, its artifacts, its scratch files and the git refs that pin its commits |
177
183
  | `diffloupe runs prune [--older-than 30d] [--keep 20] [--kind review\|diff] [--yes]` | Delete runs older than the cutoff, except the newest `--keep`, plus scratch files no run owns. Lists what it would delete unless `--yes` is given |
178
184
 
@@ -207,7 +213,13 @@ Checks Bun, git, OpenCode, tilth and `gh`; prints the model for each stage and w
207
213
  "models": { "review": "...", "coordinator": "...", "walkthrough": "..." },
208
214
  "effort": "medium",
209
215
  "surfaces": { "deploy": ["^infra/"], "tooling": ["^docs/"] },
210
- "extraExcludes": ["vendor/openssl/"]
216
+ "extraExcludes": ["vendor/openssl/"],
217
+ "instructions": [
218
+ "## What failure looks like here",
219
+ "A change that breaks runs already saved on disk.",
220
+ "## Don't report",
221
+ "Styling in src/web/."
222
+ ]
211
223
  }
212
224
  ```
213
225
 
@@ -218,6 +230,7 @@ Every field is optional.
218
230
  | Reviewer model | `models.review` | `models.review` | `--model review=<id>` | `REVIEW_MODEL` | OpenCode default model, else `anthropic/claude-opus-5-5` |
219
231
  | Coordinator model | `models.coordinator` | `models.coordinator` | `--model coordinator=<id>` | `REVIEW_MODEL_MERGE` | OpenCode default model, else `anthropic/claude-opus-5-5` |
220
232
  | Walkthrough model | `models.walkthrough` | `models.walkthrough` | `--model walkthrough=<id>` | `REVIEW_MODEL_WALK` | OpenCode default model, else `anthropic/claude-sonnet-5-5` |
233
+ | Intent draft model | `models.intent` | `models.intent` | `--model intent=<id>` | `REVIEW_MODEL_INTENT` | `anthropic/claude-haiku-5-5` when the walkthrough model is Anthropic, else the walkthrough model |
221
234
  | Provider for bare model ids | `provider` | `provider` | | `REVIEW_PROVIDER` | `anthropic` |
222
235
  | Effort | `effort` | `effort` | `--effort` | `REVIEW_EFFORT`, `REVIEW_EFFORT_AUX` | `medium` for built-in default models only |
223
236
  | Use the OpenCode default model | `opencode.useDefaultModel` | | | | `true` |
@@ -231,6 +244,8 @@ Every field is optional.
231
244
 
232
245
  `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.
233
246
 
247
+ `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.
248
+
234
249
  ### Credentials
235
250
 
236
251
  Each review agent runs OpenCode with its own data directory, so DiffLoupe has to hand it a credential for every provider the chosen models use. For each provider, the first of these that exists is used: