Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reviewer

A CLI that reviews a GitHub pull request using a local LLM — no API key, no cloud billing, runs entirely on your machine via Ollama.

reviewer review --pull-request-url https://github.com/owner/repo/pull/123

How it works

  • Fetches the PR diff using pure git over SSH — no GitHub API token needed. It uses your existing GitHub SSH key to fetch refs/pull/<N>/head and refs/pull/<N>/merge directly, falling back to diffing against the repo's default branch if the merge ref isn't available.
  • Sends the diff to a local model running in Ollama, in two stages: a free-form review pass (so the model can actually reason about the diff) followed by a cheap extraction pass into structured findings.
  • Prints the files reviewed, what was checked, the model's reasoning, and any findings — all to your terminal.

Because everything runs locally, the diff and review never leave your machine, and there's no per-review cost.

Requirements

  • Node.js >= 18
  • git, with SSH access to GitHub already configured (ssh -T git@github.com should work)
  • Ollama — no system install required; see setup below

Setup

npm install
npm run build
npm link          # makes the `reviewer` command available globally

Install Ollama (no sudo required)

mkdir -p ~/ollama-local
curl -sL https://github.com/ollama/ollama/releases/latest/download/ollama-linux-amd64.tar.zst -o /tmp/ollama.tar.zst
tar --zstd -C ~/ollama-local -xf /tmp/ollama.tar.zst

Pull a model

~/ollama-local/bin/ollama serve &   # one-time, to pull the model
~/ollama-local/bin/ollama pull qwen2.5-coder:3b

Usage

reviewer ollama start     # start the local model server (background, idempotent)
reviewer ollama stop      # stop it

reviewer review --pull-request-url <url> [--base-ref <branch>]
  • --base-ref <branch> — diff against this branch instead of auto-detecting the PR's base. Only needed if a PR targets a non-default branch and the automatic detection picks the wrong one (you'll see a warning when this happens).

Leave the Ollama server running between reviews — the first request after starting it pays a one-time model-load cost (tens of seconds); every request after that is fast.

Configuration

All optional, via environment variables:

Variable Default Purpose
OLLAMA_MODEL qwen2.5-coder:3b Which pulled model to use for reviews
OLLAMA_HOST http://127.0.0.1:11434 Where the Ollama server is listening
OLLAMA_BIN ~/ollama-local/bin/ollama Path to the Ollama binary, used by reviewer ollama start

Example output

Reviewing owner/repo#123 with a local model (this may take a while on CPU)...

Files reviewed (1):
  src/auth.js  +12 -3

Checked for:
  - Correctness bugs (logic errors, off-by-one, null/undefined handling, race conditions)
  - Security issues (injection, unsafe input handling, secrets)
  - Clear maintainability problems introduced by this diff

Review notes:
The diff adds a checkPassword function that compares passwords with ==
instead of a constant-time comparison, which is a timing-attack risk for
auth code.

src/auth.js:14 [WARNING] Password comparison uses == instead of a constant-time check.

1 finding (1 warning)

Known limitations

  • GitHub only for now — no Bitbucket/GitLab support.
  • Diff-only context — the model only sees the code diff, not the PR title, description, or discussion, since that would require the GitHub API (and a token) rather than plain git.
  • Model quality ceilingqwen2.5-coder:3b is small and fast but noticeably weaker than a hosted model like Claude; it can miss subtler bugs and occasionally contradicts itself between its reasoning and its conclusion. Swap in a larger model (e.g. qwen2.5-coder:7b) via OLLAMA_MODEL for better quality at the cost of speed and memory.
  • CPU inference is the bottleneck — review time is dominated by token generation speed, not the CLI itself. GPU offload was tested on integrated graphics and made no measurable difference; the effective levers are model size and response length.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages