@uigraph/lens
v1.0.0
Published
Review GitHub pull requests with UIGraph Lens.
Readme
Lens reviews a GitHub pull request, or the difference between two branches, to help you understand the change. A coding agent you already use (Claude Code, Codex, OpenCode, Pi or Cursor) reads the change and the code around it, and Lens shows the result in the UIGraph viewer.
This repository is the Lens engine and review UI. You run it through the uigraph CLI.
Lens is open source.
Quick start
Install UIGraph:
npm install -g uigraphReview a pull request:
uigraph lens https://github.com/owner/repo/pull/123
uigraph lens owner/repo#123
uigraph lens 123 # inside a clone whose origin is on GitHubOr two branches in the current repository:
uigraph lens --base main --target feature/loginLens reviews the commits on --target since it split from --base, the same changes a pull request would show. Uncommitted changes are not included. Branch reviews read your repository with git and do not use GitHub.
The review opens in the viewer. If no viewer is running, the command starts one in this terminal. Reviews are listed under Lens in the sidebar.
Every run is saved in ~/.uigraph/lens/runs. A completed run for the same pull request, base and head commit is reused unless you pass --regenerate.
| Option | Effect |
| ------------------- | --------------------------------------------------- |
| --base <branch> | Branch or commit to compare against |
| --target <branch> | Branch or commit to review |
| --regenerate | Run a new review instead of reusing a completed one |
| --agent <name> | Agent to use. Without it, UIGraph asks |
| --model <name> | Model to use, in the agent's own format |
| --port <number> | Viewer port |
| --no-open | Do not open a browser |
What a review shows
| Step | Shows | | ------------------ | -------------------------------------------------------------- | | Changed flows | Before and after diagrams of the runtime flow | | What was asked | How the change compares with its issue, description or commits | | Choices to confirm | Values the code picked, such as limits and timeouts | | Impact | Other services the change affects | | Test coverage | Which new behavior has a test | | Rollout | A safe order to ship and checks before you deploy |
Each step can be turned off. See Customize.
Agents
Lens uses your own login for the agent you pick:
- Claude Code: your Claude login or
ANTHROPIC_API_KEY. - Codex:
codex loginorCODEX_API_KEY. - OpenCode: provider keys such as
ANTHROPIC_API_KEYorOPENAI_API_KEY. - Pi:
~/.pi/agent/auth.jsonor provider keys such asANTHROPIC_API_KEY. - Cursor:
CURSOR_API_KEY. Without--model, Cursor picks the model.
A review sends the change and the code it reads to the model provider of the agent you pick.
GitHub access
Pull request reviews need a GitHub token. Branch reviews do not. Lens looks for one in this order:
GITHUB_TOKENGH_TOKEN- The token from
gh auth token
The viewer process reads the token. It is not sent to the browser.
Customize
Select Customize in a review to set a focus, for example "look for double charges", to turn review steps on or off, to pick how many flow diagrams Lens draws (1 to 10), and to choose the agent and model for reviews started from the viewer. Lens saves these settings in ~/.uigraph/lens/settings.json.
A repository can set the same options for everyone who reviews it, in a .uigraph.lens.yml file at its root:
focus: |
Payments code. Look for double charges and wrong refund amounts.
steps:
impact: false
diagrams: 2Lens reads this file from the base branch, so a pull request cannot change how it is reviewed. The repository focus is used together with your own focus. Steps and diagrams in the file replace your settings.
License
UIGraph Lens is licensed under the Apache License 2.0.
