@pablocm90/visual-review
v0.69.0
Published
Structural review pages for pull requests, ranges and uncommitted work
Readme
visual-review
Draws what a change did to the structure of a repo: the Rust crates and their dependencies, the web modules and files and their imports, the classes of a Rails app in a box per layer, and the web calls to API routes, before and after, with added, removed and modified parts coloured. A renamed crate, module or file is one node that says what it was called ("was domain"), and a test that moved to another file says where it went. Changed files outside those (tools, plans, CI, config) are listed below the graph with their patches.
What it reads
Out of the box, it reads these, with nothing to configure:
| Language | Detected from | Drawn as | Edges | Tests compared |
|---|---|---|---|---|
| Rust | a Cargo workspace at the repo root | crates, holding their modules | crate dependencies, and the modules' use paths | #[test] functions, in #[cfg(test)] modules too |
| TypeScript and JavaScript | every package.json whose source root holds TS/JS files | one box per first folder under the source root (or per boxes glob), holding its files | imports, including a sibling package's by its name, and through a tsconfig's or jsconfig's paths | test/it calls, grouped by describe, in *.test.* and *.spec.* files |
| Ruby on Rails | every config/application.rb outside vendor/, node_modules/, test/ and spec/ | one box per app/ layer (models, controllers…) and lib (or per boxes glob), holding its classes | the constants a class names, and model associations | Minitest under test/, RSpec under spec/ |
Across stacks, fetch calls in TS/JS are linked to the routes of Rust crates that use axum.
A TS/JS stack's tsconfig.json, or its jsconfig.json where it has no tsconfig.json, is read for its paths and baseUrl, through extends, as TypeScript resolves them: the longest prefix wins, an exact name matches only itself and goes ahead of a wildcard of its length, and a place that holds no file gives way to the next. A root that holds no files itself (files or include said, both empty) and has no paths through extends takes them whole from the first project it references that has them, read as that folder's tsconfig.json, as in Vite's template; a project's references aren't read otherwise, nor from a config it extends. An extends naming a package isn't read, since a checkout has no node_modules. Whatever an import resolves to outside the checkout is neither read nor drawn, and one landing in a sibling stack draws the edge to that stack.
The review data (the .json beside the page) measures the files of changed nodes and their neighbours: lines of code, and each Rust or TS/JS function's or Rails method's cyclomatic complexity and ABC size. A Rust ? isn't a branch there: each function's ?s are its earlyReturns, listed beside its cyclomatic in cyclomatic.byFunction. Test files aren't measured.
In changed TS/JS, Rails and Rust files it also reads the symbols, functions, methods, getters, setters, classes, types, interfaces and enums, on both sides (in Rails, classes and modules with their methods, attrs, delegates and scopes, public or not as Ruby's private and its kin say; in Rust, functions, the methods of impls and traits, and structs, enums, unions, traits and type aliases as types, exported only when exactly pub, a private field left out of a struct's signature), and pairs them: added, removed, edited, formatting only, renamed (by an equal body, or "probably" by a similar one) or moved to another changed file. Each file's change gets a kind: an API change when its exports or an exported signature changed, else a logic change, else formatting only. Test files aren't read for symbols, nor is Rust's #[test] and #[cfg(test)] code, though a Rust file whose inline tests alone changed reads as a logic change. For an edited or renamed TS/JS or Rust function or method, or Rails method or class, it also lists its logic: its decisions (guards, ifs, ternaries, loops, cases, &&/||/??, catches, early returns and throws), each added, removed, changed or the same, by their source text with comments and spacing ignored. A decision it lost that another symbol gained, in any changed file read, reads moved, found by that text alone. Rails has no decisions of its own kinds, but some are found by name, and a lost one says so: a conditional head, render or redirect_to is a guard, an each, each_with_index, each_slice, find_each, find_in_batches, times or loop block is a loop, and in a class body a before_action-family or model callback or a validation is a guard on the class, beside rescue_from as a catch. A changed Rails file naming define_method, method_missing, send, public_send, class_eval or instance_eval raises one finding for information, since the logic behind them isn't read. In Rust, let … else is a guard, Err in a match arm or an if let is a catch, and a ? is a decision of its own kind, turning into an .unwrap() for information only; ensure!, assert!, assert_eq! and assert_ne! are guards and bail!, panic!, unreachable!, todo! and unimplemented! throws, found by name. A macro's insides aren't read, so a changed Rust file with any other macro, or a macro_rules!, holding a ?, return or if raises that finding too, as test code doesn't, and a function nested in another reads no logic.
Each language is read as text, with no compiler or runtime for it, except Rust's crate list, which comes from cargo metadata. Ruby doesn't need to be installed, and nothing in the reviewed repo is built or run. Other languages are planned.
Before the first run
- Node
^22.20.0 || >=24.8.0. - macOS or Linux. It doesn't run on Windows yet.
git2.38 or newer.cargoon yourPATHfor Rust crates, which come fromcargo metadata. Without it, the Rust stacks are skipped and the page says so. cargo reads only what the checkout holds: a stack whose manifests name a path, workspace or member outside it, or that cargo can't read within 60 s (or 2 GB of memory, on Linux), is listed as not read, with the reason, and the review goes on.- For PRs, the GitHub CLI, logged in with
gh auth login, and a git remote that points at the PR's repository. Any name works, so a fork'soriginbeside anupstreamis fine.
Nothing needs installing in the reviewed repo.
Run it
In Claude Code, add the plugin once:
/plugin marketplace add pablocm90/visual-review
/plugin install visual-review@pablocm90Each plugin release pins the CLI version it runs, so a new release reaches you only once you update the plugin. Run this in your shell, and the next session uses it:
claude plugin update visual-review@pablocm90Or, in /plugin, pick the pablocm90 marketplace and enable auto-update.
Then, from anywhere in the repo (as /visual-review:visual-review when another skill or command already takes the name):
| Command | Reviews |
|---|---|
| /visual-review 42 | PR #42, from where it branched off its base to its head |
| /visual-review main..my-branch | a range of commits |
| /visual-review | your uncommitted work against HEAD |
Claude builds the page, writes notes and flags onto it, and serves it in your browser. Send your review from the page (Your review) and Claude acts on its verdict and on each comment's kind: on Request changes it does each Change this and Fix this, answers each Question and Explain, and takes or turns down each Suggestion; on Comment it replies to each and changes nothing; and on Approve it answers any comments and stops. Selecting a crate, module or file opens an inspector beside the graph with its note, metrics, patches and tests, and selecting an edge opens its note; drag the divider between them, or focus it and use the arrow keys, to give either side more room.
Without Claude, run the CLI with the same argument. It builds the page with no notes and prints its path:
npx @pablocm90/visual-review 42Reading the page
The header names the repo and the range, and is headed by the PR, linked, or else by the range ("Uncommitted work" for uncommitted work). Beside it, the tabs: Structure, which holds the graph and everything listed below, Tests, with how many tests changed, Schema, when the change holds a schema change, and Routes, when it holds a route change. The URL's hash (#structure, #tests, #schema, #routes) names the tab, so back and forward move between tabs. Above the graph, Colour by switches its fill, and the legend under it follows. On Change, green is added, red with a dashed outline is removed, amber is modified, and grey is unchanged. A modified crate, module, box or class has a changed file inside it. A renamed one is drawn once, with "was …" under its name.
- Reading order. The left column opens with the changed parts numbered in the order to read them: what the others depend on first, the removed parts after the rest, then the changed files outside the graph. Parts that depend on each other are read in name order, and the first of them says so. Each row is marked with its findings, a triangle when one needs a look, and the count. Click a part to start reading there; click an outside file to open its patches. Each drawn part carries its number at its top-left corner.
Amarks the selected part read, ticking its row, or unread again, and the header counts and bars the parts read, on every tab. The keys do nothing while you type in a comment or with Ctrl, ⌘ or Alt held. Your browser keeps the marks for the range, so a reload keeps them, but a page served again is at a new address and starts with none read. - Summary. With Claude's notes, a strip above the graph holds the change's summary. Click a line to go to the part it's about.
- Colour by Kind of change fills each changed part by the strongest kind of change in it: API change darkest, then logic change, then formatting only, faded. A changed part with no symbols read, such as a stylesheet or a test file, says "symbols not read" and stays neutral, as unchanged parts do. Hovering a part names its kind.
- Colour by Churn or Complexity fills each measured part from a four-step blue ramp, and the outline still shows the change. Churn counts the commits that touched it in the window before the head, or the base for a removed part (0–2, 3–5, 6–8, 9+); Complexity is the cyclomatic of its most complex function at the head (0–4, 5–7, 8–10, 11+). A part that wasn't measured stays neutral, and a box takes the highest inside it. Hovering a part shows its value.
- Colour by Logic, offered when a decision changed, fills each changed part from the same ramp by how many decisions changed in it (0, 1–3, 4–9, 10+). A box takes the sum of the files inside it, since the question is how much logic is in there. A part stays neutral when it's unchanged, added or removed, as only a decision read on both sides counts, or when its symbols weren't read. Hovering a part shows its count. On a shaded card, the strips sit on a plate so their marks stay readable.
- Findings. Everything review-wide worth a look is a finding: about one dimension (structure, metrics, routes…), and either needing a look (a triangle) or for information (a circle). The review raises them for the stacks that weren't read, the changed files outside every stack (tools, plans, CI, config), the
fetchcalls no axum route matches, each exported symbol removed, renamed, moved away or whose signature changed (needing a look) or added (for information), each of those TypeScript exports or exported classes' methods that unchanged files of any stack still use, found by name (needing a look), each guard or catch a function lost (needing a look) and each function's other decision changes, including a guard or catch that moved to another symbol (for information), each file whose logic changed with no test changed alongside it (needing a look), the files whose symbols wouldn't parse and the stacks whose symbols aren't read (for information), a change whose parts fall into separate groups with no edge between them, such asmay be 2 independent changes(for information), each edge at the head breaking one of the config'srules(needing a look when the change adds it, for information when it was already there), the Rails controller actions below that nothing authorizes, the lockfile changes below, and each threshold a file crosses at the head, such ascyclomatic 4 → 14, over 10, needing a look when the file is new, wasn't over on the base, or grew; each flag in Claude's notes is one too, needing a look.- Dependencies. A changed
pnpm-lock.yaml(lockfile version 9),package-lock.json(2 or 3),yarn.lock(v1),Cargo.lockorGemfile.lockraises a finding that needs a look for each direct package added, removed, major-bumped, newly direct or no longer direct, such aszod 3.25.0 → 4.6.7, and one for information per lockfile rolling up its transitive ones. A minor or patch bump raises nothing, and major follows^and Cargo:0.2.1to0.3.0is major. Local packages don't count, nor do lockfiles undernode_modules/,vendor/,test/,tests/,spec/,fixtures/or__fixtures__/. Moving package manager in one folder raises only what really moved. A lockfile that won't parse, or in an older format, raisesyarn.lock not read: Yarn 2+ format, needing a look. Inyarn.lock, direct means named by apackage.jsonat or under its folder, so a nested one that isn't a workspace counts too. A changed source at one version isn't compared, nor does anything go to the network: no licences or advisories. - Migrations. A Rails migration the change adds (
db/migrate, ordb/<name>_migratefor another database; a rename counts when its version changes, while a move that keeps it has already run) raises a finding that needs a look for each risky operation that runs going up: a column, reference or timestamps removed, a column renamed, a type changed, a column set tonull: false, a required column added with no default, and an index added withoutalgorithm: :concurrently, which is Postgres's rule, whether byadd_index, by a reference, which indexes unless toldindex: false, or by achange_tablecolumn'sindex: true. The finding says the line and why, and opens the file's patch. A table the same migration creates has no rows to protect, so its indexes, required columns andnull: falseraise nothing. Edited or deleted migrations aren't read, nor aredrop_table,rename_table, rawexecuteor what arevertblock runs. A migration that doesn't parse raises a finding saying it wasn't read. - Tables. A changed Rails schema dump raises a finding for information per changed table, summing up what changed in it (
users: 2 columns added, 1 removed), and one that needs a look per removed table. A dump added or removed whole raises one for information, for the file. A dump that doesn't parse raises a finding saying it wasn't read, ranked first. Each opens the Schema tab, at the table's card. - Routes. A change to
config/routes.rbor a file underconfig/routes/compares each side's routes as Rails would expand them, without running Ruby:resources,resource,namespace,scope,member,collection, nesting, the verbs,match,root,mount,loadanddraw. A removed route (DELETE /users/:id removed) or one that now goes elsewhere (GET /a now goes to b#c) raises a finding that needs a look, added routes raise one for information per file (3 routes added in config/routes.rb), and each opens the Routes tab, at the route's row or the file's section.PATCHandPUTof one path and target read as one line. What can't be expanded without guessing, such as anif, a loop,concern,shallow,path_names,devise_foror any other call, isn't read, nor is anything under it, and raises a finding that needs a look only when its text is added or removed, which opens that statement's line on the Routes tab. A route file that doesn't parse raises a finding saying it wasn't read, ranked first. Engines' own routes, and what guards a route, aren't read. - Security. When a change touches a Rails controller or a route, each public action of each controller is read for what authorizes it, without running Ruby: a
before_actionoraround_actionnaming an authorizing method (anafter_actionruns once the action has done its work, so only Pundit'sverify_authorizedcounts there), within itsonlyandexcept, from the controller, its parents in the app or a concern'sincludedblock, unless a laterskip_*removes it, or the action's own call of one, such as Pundit'sauthorize. An action with nothing authorizing it raises a finding that needs a look when it's new, lost its authorization, or a route the change adds now reaches it; one authorized only under anif:orunless:raises one for information. An action that was already unauthorized raises nothing. What couldn't be read, such asbefore_action *CALLBACKS, a block calling no authorizing method, a parent outsideapp/controllers, a controller that doesn't parse, or anopenglob matching no action, is listed under the security coverage. In a Rails method or scope, a risky call it gains raises a finding too: a key newly permitted,permit!, raw SQL, HTML marked safe, asendof a name it doesn't write; apermit(*FIELDS)it can't name is listed under the coverage. For every stack, a secret a line gains (a known key or token format, or a long, varied literal under a name likepassword) or a secret file the change adds needs a look, and its value is masked in the page and its.json. - Deploys. For every stack, an env variable or Rails credentials path a line the change adds to a code file reads by its literal name, and that the base doesn't know (an env key it names nowhere, a credentials path it reads in no form), needs a look, so it is set in every environment before the merge:
ENV["KEY"],ENV.fetch,process.env.KEY,import.meta.env.KEY,env::var("KEY"),env!, andRails.application.credentials.aws.keyorRails.application.credentials.dig(:aws, :key)read asaws.key. One read only in a test file or fixture is for information. A feature flag the change starts or stops reading raises one for information: Flipper's calls by default, or the calls the config'sdeploy.flagsnames (*a wildcard within a name), read from the range's base. An env key read through a variable is listed under the deploy coverage. - Lenses, above the graph, are five chips that group the dimensions: Behaviour, Contract, Risk, Shape and Context, each counting its findings for information and those needing a look. Click one to show only its findings in Start here and the rail and to dim the other badges; click it again to show them all. The graph itself is never filtered. A picked lens lists its dimensions under the chips, each with what it found,
checked, none, or why it wasn't read, such asRails onlyornot read for crates, and both when it was read in part. A lens with nothing found and nothing unread names what it checked on its chip, as inRisk · dependencies checked, nothing found, since only the dimensions a check raises are listed: Risk today checks dependencies, secrets in every stack and, in Rails, authorization and risky calls. It also speaks only for the stacks drawn: a changed file outside the graph has its own finding, and nothing in it was read. - Start here, under it, shows up to five lines, each gathering what one check found, such as
7 exported signatures changed · 4 files, and naming its lens and dimension, such asContract · api, those that need a look first. Within each level a line ranks by its best finding: what wasn't read first, then direct dependency changes, risky migrations, removed tables, removed routes and new targets, then the parts most depended on, then the most churned. Click a line of one finding to go to its part, its file's patch, its table's card, or its route's row. A line of several opens in place to list them, each going the same way, and a suggested split's line opens the rail, where its groups' buttons are. The heading says how many need a look, or that nothing does; All findings opens the rail, and the heading's title folds the section to one line. - The rail, a narrow strip beside the graph, counts the findings: the total, how many need a look and how many are for information, with a
!when a reader's tool is missing, such ascargo. Open it to list them grouped by dimension, the stacks not read on top. Click a finding to go to its part; the outside files open their patches beside the graph, and a dependency finding opens its lockfile's patch. A split finding has a button per group, naming its size and going to its first part in reading order. Groups are read from the edges between parts, so parts tied through an unchanged file, an edge between the boxes holding them (a dependency between two crates, say), a dynamic import or Ruby metaprogramming can look independent. Calls whose path is built at runtime aren't drawn.
- Dependencies. A changed
- Reading.
J,K, Start reading, a row of the reading order or a part's Next walk the parts one at a time. With no part selectedJstarts at the first part unread; from a selected partJgoes to the next andKgoes back. The left column narrows to numbered stops, a tick on each one read, the reading column takes the middle, and beside it the graph shrinks to a corner map, fitted, the current part ringed, a click on a node going to it. Under the map, Next to it lists the part's edges, changed or not, "imports x" or "imported by x" ("calls" or "called by" across stacks), marked added, removed and read, each going to its other end, and All findings returns to the graph whole with the lens cleared and the rail open. Open map or Escape outside a field returns to the graph whole, the part still selected; the column's×returns with nothing selected. In a narrow window the map and Next to it go below the column. A click in the graph, a finding or a line of Start here keeps the graph whole, with the column at its side. A reload starts with the graph whole.L, or the head's Next logic change, walks the changed decisions alone, across files in reading order, from the row you're on, else the selected part's first: it enters reading, opens the row's folds and outlines it, with focus on it soCcomments on it. There's no key back; past the last it stays. - Graph. Each stack is a box. Click
+on a crate, folder or layer to open it, and−to close it. Arrows are dependencies or references, dashed when removed. Dotted arrows arefetchcalls to routes. A badge at a closed part's top-right corner, or at an arrow's middle, marks its findings, and those of the parts closed inside it: red when one needs a look, grey when they're all for information. Hover it to read them; click it to select its part. - Zoom and pan. The graph opens fitted in a frame of its own, never above 100%. Drag anywhere in it, or use the wheel, to pan; at its edge, the wheel scrolls the page instead. Ctrl/⌘ + wheel or a trackpad pinch zooms at the pointer. The toolbar's − / + / Fit / 100% zoom about the centre, up to 400%. With the frame focused,
+and−zoom,0fits,1goes to 100% and the arrow keys pan. Opening or closing a box keeps it where it was on screen; going to a part centres it at 100%. - Show picks how much of the graph is drawn. Changes only, the default, draws the changed parts and both ends of each added or removed arrow. Logic only, offered when a decision changed, draws just the files holding one, their boxes open, with every arrow between them, each file a card with a strip of marks per function that changed: a click on a tick opens its row. A legend of the marks sits under Start here, whose first line counts those decisions and goes there. Changed + 1 hop adds every direct neighbour of a changed part. Everything draws it all. Since last review, offered once you have sent a review of an earlier head of the same PR, draws only what changed since in the files the PR changes at either head, so merging the base branch in counts only where it touches one of those files. A part reverted since is drawn as unchanged, and whatever the PR no longer holds (a part, symbol, test or file added then and gone since, or a file restored) is named in a line under Show. When that commit is no longer in your clone, as after a force-push and a prune, or can't be read, the header says so and the full review is shown. Going to a part that isn't drawn widens Show only as far as it needs.
- Last review, on a PR's later round, starts you from what you asked. The header names its verdict, and a section atop the left column holds your general comment, then each comment and finding answer, going to what it's on and marked Changed since, with the commits that touched its file, or As it was, with Claude's answer under it when its notes give one (Done with its commit, Answered or Declined), then the parts changed since with no comment on them, then what Claude also changed that nothing asked for. Each one also shows under its anchor: in the inspector's column, on a symbol, logic line or test, on a diff line (found by its text, since line numbers drift) or on a finding in the rail. On a served page each offers Resolve, nothing more asked of it, and Reply, a comment on what it was on, which takes the place of that anchor's Comment; a finding answer has no Reply, its buttons being one, and an It's fine has no Resolve. When the earlier head can't be compared, they show with no mark. A finding you called It's fine stays out of Start here on that PR and reads "called fine" in the rail, and the parts you marked read that are unchanged since start out ticked.
- All edges, unticked by default, keeps an opened box readable: unchanged edges between two boxes are merged into one box-to-box arrow, and unchanged edges inside a box are hidden. Edges that are added, removed, noted or touch a changed part are always drawn in full. Tick it to draw every edge as it is.
- Selecting a part opens the inspector, headed by its name, kind and stack, change, path and what it was renamed from. Under the head, Comment (or press
C) opens a comment on the part on a served page, Mark read (A) marks it read, Next (J) goes to the next part, and Next logic change (L), at the right, to the next changed decision while one lies ahead. Below it is the reading column: Claude's note, then What changed, its heading summing the logic it lists (14 functions decide differently, 45 decisions, 6 exits) and a legend of the marks under it when a strip shows, its changed symbols grouped by change, API changes first, each with Claude's note on it under its row when there is one, as a logic line and a test have, its unchanged and formatting-only ones folded under a count, a changed signature shown by the members that moved, one added+, one removed−and one changed~ base → head, those as they were folded under a count (a type's or interface's members, a function's parameters, a union's alternatives; one with no members to split, such asextends, shown base above head), a renamed one with what it was, a moved one with the file it went to or came from (click it to go there), an edited function's logic under it: a strip of marks, one tick per decision in source order (added, changed and moved above the baseline, removed below it, an unchanged one a flat dash, a moved one hollow, an exit taller), with how many changed and how many of those are exits, a click on a tick opening its row; then its rows, indented by depth, a changed one base then head, a moved one with the symbol it went to (click one that changed to see its line in Full diff, or the patch's top when git shows it no line), folded when the file holds more than 8 changed decisions and no row holds a comment or a change since your last review, and each run of unchanged ones folded under its count;Con a focused row comments on that row; and a Diff toggle opening the symbol's own lines of its file's patch in place, leaving out its neighbours' and those of the symbols inside it, from both files when it moved, saying so when git's hunks leave out its first line or hold no line of its own; on a box, each file inside it with symbol changes, and a file that wouldn't parse with the parser's message, then Why look, the findings on the part, each with its detail, then Tested by, the changed tests alongside it, at or under it or named after a file inside it (an unchanged one only when it holds a comment or changed since the last review, and the Tests tab lists a changed file's others; a file it can't read says so), with the finding when logic changed and no test did, then Reaches, the unchanged files that still use a TypeScript export or an exported class's method it changed, in any TypeScript stack, drawn or outside its source root such as atest/besidesrc/, or a Rails class or method it changed, among the classes drawn in its own Rails root, or a Rust item or method it changed, among the modules importing from its file and those of the crates depending on its crate, on a box those of the files inside it: each file's first use with its line of source, click a drawn one to go to it, a test file, or a Rust use in atests/folder or a#[test]or#[cfg(test)]item, markedtestand listed last, a dynamic import, a namespace passed along or a Rubysendordelegateof a name it can't read markedmay use it, not followed. Exports are found by name, not type-checked, a method by its class's name and the member's, so a.baron anything else in that file counts. A method read other than by.name(const { bar } = foo,foo['bar']) or without importing its class, a removedexport *, a package imported under another name, files under no stack, dot folders such as.storybook/and dot,.mtsand.ctsfiles outside the source root, and a stack's files outside its source root when it has over 5,000 aren't followed, nor, in Rails, views, tests, rake tasks and other files outsideapp/andlib/, another Rails root, a file defining a class another file defines too, a base class such asApplicationRecord, a class other than the one its file is drawn as in a file not naming that one, or a method called onselfor with no receiver, through a subclass, in a file not naming its class, bytry!,method(:x),public_method(:x),instance_method(:x),.()or as an operator, nor, in Rust, a module of its own crate with nouseinto its file, a crate named otherwise than by its package, such as through[lib] nameor a renamed dependency, a binary naming its own package's library, a name re-exported throughpub use, a path inside a macro, a method of animpl Trait for, or a method called on a value in a file not importing its type: the lens row says so when something was asked (a part with none of these says "No note"). At the column's foot sit two closed folds: Metrics, each measure before and after with the difference and a bar each (lines, functions, highest and total cyclomatic, ABC size, fan-out, fan-in, churn), a row over a threshold marked by its level, then its functions by cyclomatic, the most complex first; and Full diff, the patches of its files, which opens by itself when you land on a line or a patch holds a draft. Selecting an arrow shows its findings and note. On a PR's later round, a symbol, logic line, test or patch that changed since your last review is tagged "changed since", whatever Show holds. Close it with its×, and drag the divider, or focus it and use the arrow keys, to resize it.
The Tests tab lists the test files whose tests changed, under Claude's line on what they pin. All shows every one; while a part is selected on Structure, For that part shows those alongside it: at or under it, or named after a file inside it in the same stack (refund.test.ts beside refund.ts, test/models/user_test.rb beside app/models/user.rb). Beside them, the shown tests are counted by change: + added, ✎ edited, − removed, ↷ moved, a test moved between files counting once. Each file names its stack, says "new file" when the base had none, and shows its tests as a tree: + added, − removed, ✎ edited (its label too, or that of a group holding it), · unchanged, with "moved to" or "moved from" for a test that changed file. Changed nodes lists the added and modified parts with the changed tests alongside each, those with none first, marked as needing a look; click one to go to it on Structure.
The Schema tab shows what a change does to db/schema.rb, or db/<name>_schema.rb for another database, with a card per changed table, under its file's name. Each lists its added, removed and changed columns and indexes, and table options, before and after, every option as written. Columns and indexes pair by name, so a rename reads as one removed and one added, and column order is no change. A dump added or removed whole says so with its table count, rather than listing every table, and a dump that doesn't parse says so with the parser's message. A dump in which only version: changed shows nothing. Foreign keys, constraints, extensions, structure.sql and a Rails 4 dump's top-level add_index aren't read.
The Routes tab lists a Rails app's added, removed and changed routes under each route file's name, what's removed first, then what changed, then what's added. Each row shows the verb and path, the target before and after, and where it's written. The statements not read that were added or removed come above the rows, each with the namespace or module it sits under, and a route file that couldn't be read says so and why, naming the file that stopped the reading. Show patch beside a file's name opens its patch. A route under a statement not read isn't compared, so read that statement's patch to see what it draws.
When detection misreads a repo
Stacks are detected: a Cargo workspace at the repo root, every package.json whose source root holds TS/JS files, and every Rails app (a config/application.rb outside vendor/, node_modules/, test/ and spec/). A visual-review.config.json at the repo root overrides that. It is read from the reviewed head revision, or from your checkout when the head has none, and applies to both sides, all but its notes entry, which is read at the base (below).
{
"$schema": "https://unpkg.com/@pablocm90/[email protected]/dist/config.schema.json",
"stacks": {
"web": { "boxes": ["modules/*"], "label": "Web app" },
"e2e": false,
"api": { "reader": "rust", "root": "backend" },
"gen": { "reader": "typescript", "root": "tools/gen", "sourceRoot": "lib" }
},
"linkers": {
"fetch-axum": { "from": ["web"], "to": ["api"] }
},
"rules": {
"controllers-skip-billing": {
"from": "shop/layer/controllers",
"notTo": ["shop/layer/models/billing*", "shop/class/Billing::*"],
"reason": "Controllers reach billing through BillingService."
}
},
"notes": {
"guidance": "Say which bounded context each part belongs to; recommend a test for every changed controller.",
"why": true,
"recommendation": true
},
"security": {
"authorize": ["authorize", "verify_authorized", "authenticate_*!"],
"open": ["SessionsController#new", "Webhooks::*"]
},
"deploy": {
"flags": ["Flipper.enabled?", "Features.on?"]
}
}- Stacks are keyed by the id the page draws: a package's or Rails app's directory, a root package's name, the repo's folder name for a Rails app at the root, or
rust. falsedrops a stack, andlabelrelabels it.readerwithrootadds a stack that detection missed (rust,typescriptorrails).- TS stacks also take
sourceRoot, andboxes: folder globs under the source root, each matched folder one box. The deepest match wins, and other files keep one box per first folder. - Rails stacks take
boxestoo, as folder globs under the app root:["app/models/*"]putsapp/models/billing/invoice.rbin amodels/billingbox. Other classes keep their layer's box (models,lib). metrics.churnDayssets how many days before each side's commit the review data's churn counts commits over (90 when left out).metrics.cyclomatic(10),metrics.hotspot({ "churn": 6, "cyclomatic": 8 }),metrics.linesandmetrics.abc(off unless set) are the thresholds the review's metrics findings are raised against.metrics.splitParts(4) is the number of parts a group of connected changes must reach to count: two such groups raise the split finding, and smaller groups are only counted in its detail.linkers.fetch-axumdraws thefetchcalls of TS stacks to the routes of Rust crates that depend on axum, and lists calls no route matches.fromandtolimit it to those stacks, andfalseturns it off.rulesare architecture rules by name: no edge from a nodefrommatches to a nodenotTomatches. Each takes a node id glob or a list of them,*stopping at/and**taking a whole tree, and a node matches when it or a box holding it does, so a layer's glob holds for its classes. An edge whose start matchesnotTotoo breaks nothing, so a rule doesn't fire inside the area it guards. Each head edge breaking a rule is a finding on that edge,breaks <name>with thereason, needing a look when the change adds the edge and for information when it was already there. With no rules, the rules coverage saysnone configured; a glob that matches no node at the head is listed there, so a typo doesn't read as a clean check.notes.guidanceis free text on what Claude's notes should say and where, which the skill follows when it writes them, within the notes format. It is read from the range's base, the PR's merge base, and only from the file committed there, so a change can't rewrite what reviews it: guidance added or changed by a PR applies once it has merged. Only thenotes,securityanddeployentries are checked at the base, and a base file that isn't JSON reads as their defaults, so a PR repairing it can be reviewed.notes.whyandnotes.recommendationswitch those note fields off whenfalse(both on when left out). They are read at the base withguidance, the skill leaves a switched-off field out, and--notesrefuses a note carrying one, naming the field and the note's key.security.authorizenames the callbacks and calls that authorize a controller action,*a wildcard, replacing the defaults: Pundit'sauthorizeandverify_authorized, and CanCanCan'sauthorize!,load_and_authorize_resourceandauthorize_resource. Addauthenticate_*!to count Devise's sign-in check too.security.openlists the actions meant to be public, asController#actionglobs, which raise nothing. Both are read from the range's base, asnotesis, so a change can't open its own actions.deploy.flagsnames the calls that take a feature flag as their first argument (Features.on?(:checkout),Features.on? :checkout,Features[:checkout]),*a wildcard within a name, replacing Flipper's (Flipper.enabled?,Flipper.enable,Flipper.disable,Flipper[:name]). It is read from the range's base, so a change can't hide its own flags.
A key that names no detected stack, an unknown field, or a field the stack's reader doesn't take fails the review, naming the file and the field.
Notes
A notes file is JSON in notes version 2, whose schema is notes.schema.json (give that URL as $schema). Beside version, summary holds a few { text, target? } items on the change as a whole and tests a sentence on what the tests pin; notes maps a key naming what the note is on, part <node id>, edge <from> -> <to>, symbol <id> for a function, method, class or type, decision <id> for one of its logic lines, test <id> for a test or line <file>@<base|head>:<n> for one row of a patch, a removed row by its base number and any other by its head's, each id as a comment's anchor of that kind, to { text, why?, recommendation?, flag?, dimension? }, where why says why it changed this way, shown under the text, recommendation what to do about it, shown under that, which Take on a served page puts in that part's, edge's, symbol's, logic line's, test's or diff line's comment field as a Change this draft, flag labels a concern, shown as a finding in dimension (structure when left out) on the node holding what the note is on, going to its row, and answered as notes:<key>, and may be left out when there is nothing to note. A symbol's note shows under its row in What changed, a decision's under its logic line there, a test's under its test in Tested by and on the Tests tab, and a line's under its row in Full diff, which opens for it, in a symbol's Diff and in the files outside the graph. On a PR's later round answers maps a comment's or finding answer's anchor in the last review, as <kind> <id>, to { status: 'done', commit, text }, { status: 'answered', text } or { status: 'declined', text }, and unasked maps a key, as notes does, to { text }, a change nothing asked for. Both may be left out.
--notes <file> with the same argument fills the notes into the page already written for it. A missing or unknown version, a key of another kind, a key or summary target naming nothing on the page, a changed part or edge without a note, an answer whose anchor the last review doesn't hold, or unasked on a page with no last review fails it, naming the file.
Your review
serve <page.html> serves a page that's already written and opens it in your browser; serve --no-open <page.html> serves it without opening anything, for when something else hands the URL to a browser:
npx @pablocm90/visual-review serve .reviews/<sha>..<sha>.htmlIt listens on 127.0.0.1 at a free port and prints the page's URL on stderr; the URL holds a token made for this serve, and any other path or host is refused with 403. On the served page, a part's head has a Comment button (or press C) opening a Your comment field, a selected edge has that field in the inspector, a Comment toggle opens one on each symbol and logic line under What changed, Full diff, a symbol's Diff and the changed files outside the graph one on each line of a patch, and Tested by and the Tests screen one on each test, the same comment in both, under its kind, Change this, Question (picked until another is) or Suggestion, each finding, in the left rail and in the column, offers Fix this, It's fine (with an optional why) and Explain, one answer per finding, the last one pressed, withdrawn by pressing it again, and the review tray, a bar at the page's foot on every tab, counts what you've drafted by kind ("2 drafted · 1 change · 1 question") and what you've resolved. Its Review button opens it: your comments, those on parts in reading order first, then your answers, by the finding's title, each going to what it is on, what you resolved, how many parts of the reading order you marked read and which of them you read with nothing to say, a General comment on the whole change, a verdict, Approve, Comment or Request changes, with one marked suggested from your drafts (Request changes once there is a Change this or a Fix this, else Comment once there is a Question or an Explain, else Approve) and picked until you pick another, which then holds, a What Claude gets preview of the review as lines, and a Send to Claude button, enabled once the general comment or a comment holds more than blanks or a finding has an answer, or at once for an Approve. Sending writes the verdict, the general comment, the parts read, what you resolved, the comments and the answers beside the page as <name>.review.json, prints that file's path on stdout, and ends serve with exit 0. Nothing is sent until then. A page opened as a file has neither the field, the answers nor the tray.
In an Amp orb, serve --amp <page.html> (usually with --no-open) also opens an Amp portal to the server with amp orb portal, and prints the portal's URL with the token instead, so you review from the thread's Portal tab. Through the portal, only a visitor Amp marks as a collaborator on the thread (collaborator=yes in X-Amp-Authenticated) gets the page or can send a review; anyone else is refused with 403, even when the portal is made public. The portal's root, which the Portal tab links to, sends a collaborator on to the page. The Portal tab lists the portals registered from the orb's workspace root, and amp orb portal registers from the git root of the directory serve runs in, so when the repository is nested inside the workspace, run serve --amp from the workspace root with the page's absolute path. Amp's own review widget is turned off on the page, so it doesn't cover the Review panel. When amp is missing or refuses the portal, serve --amp exits 1 saying so. Without --amp the portal's host is refused like any other.
While the page is open, its tab pings serve every 30 seconds. serve waits up to a day for the first ping, so a page can wait until you get to it, then ten minutes after the last one: when either runs out, the tab never opened or closed, serve exits 1 with No review sent on stderr, so nothing is left running. One page has one server: serve writes a lock under ~/.cache/visual-review/serve/ (its pid, port, token and URL, readable by you only) and removes it on exit, and serving a page that is already served opens the live one and exits 0 with nothing on stdout. With --no-open, serving a page that is already served prints the live one's URL on stderr instead of opening it. A lock whose server no longer answers is replaced. serve exits 1 if your home isn't an absolute path or it can't write the lock there. VISUAL_REVIEW_IDLE_MS changes the ten minutes, and VISUAL_REVIEW_FIRST_PING_MS the day, both in milliseconds.
A review file is JSON in review version 6, whose schema is review.schema.json: verdict is approve, comment or request-changes, body, when there is one, is the general comment, reviewed is what the page was drawn for, { range, pullRequest? }, its PR by number, read lists the ids of the parts marked read, in reading order, resolved the anchors of the last review's comments and answers closed, as they were said, and comments lists one entry per anchor: the comments, { anchor, kind: 'change' | 'question' | 'suggestion', text }, their anchor { kind: 'part' | 'edge', id }, its id a node id, or <from> -> <to> for an edge, as notes are keyed, { kind: 'symbol', id } for a function, method or class, <file node id>#<scope.name>, #<n> after it from the second of that name in the file on, { kind: 'decision', id, text } for a logic line of one, <symbol id>#<text>, #<n> after it from the second line reading the same on, and the line's text, { kind: 'test', id } for a test, <test file>#<heading › … › name>, #<n> after it from the second of those headings and that name in the file on, or { kind: 'line', id, text } for a diff line, <file>@<base|head>:<n> and the line's text, then the answers to findings, { anchor: { kind: 'finding', id }, kind: 'fix' | 'fine' | 'explain', text? }, their id the finding's, text optional, which the page sends only as a fine's why.
Where pages go
Pages go to .reviews/ at the repo root, which git ignores. Each page is named by its range, for example <sha>..<sha>.html for a PR, with its data (.json), Claude's notes (.notes.json) and your review (.review.json) beside it. Only the 20 most recently written pages are kept, plus each PR's newest review, which its next round compares against. A review file git tracks is never compared against, since it came with the code rather than from you. Pages aren't hosted: each person runs the review they want to see.
Contributing
See CONTRIBUTING.md to set up the repo, run its checks, and add a reader for another language. Report a vulnerability privately, as SECURITY.md says. What changed in each release is in CHANGELOG.md.
License
MIT
