prereview

command module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 36 Imported by: 0

README

prereview

Review your own changes — per line — before you push, and hand the comments to an LLM to act on.

Select a line range, leave a comment, hand the CSV to Claude.

A tiny local webapp for per-line review of your working tree — no commit, no PR, no GitHub round-trip. Run prereview in your repo, click the lines you want changed, comment; a CSV is written that you (or an LLM) can act on. It ships as a Claude Code skill, so /prereview launches a session, you comment, hit "Hand off → Claude", and Claude applies the changes. On a remote box it auto-binds your Tailscale address — review from the Claude mobile app over the tailnet, before anything is pushed.

Status: core flow (review → hand-off → LLM applies) works end-to-end and is in daily use; UI still being polished.

Features

  • Comment per line, range, file, or image region — two-click range select; whole-file comments; drag a box on a binary image.
  • Annotate a live local site (--external) — proxy a running dev server and drag a box on any page to comment.
  • Markdown & HTML render — formatted by default, but comments anchor to real source lines and round-trip with the raw view.
  • One CSV, atomically written — the source of truth; read it any time without a torn file.
  • The hand-off loop — "Hand off → Claude" writes a marker; the skill reads the CSV and applies your comments without leaving the chat.
  • Phone-friendly + Tailscale-aware — on a remote box it binds your tailnet address (never the public internet); review from your phone.
  • Single Go binary — every asset embedded; no Node, no JS runtime.

Install

prereview is a single static binary. Prerequisite: git on your $PATH. Pick one:

# Quick install (macOS / Linux) — downloads the latest release, checksum-verified
curl -fsSL https://raw.githubusercontent.com/livetemplate/prereview/main/install.sh | sh
# Homebrew (macOS / Linux)
brew tap livetemplate/prereview https://github.com/livetemplate/prereview
brew trust --formula livetemplate/prereview/prereview   # one-time: brew requires trusting third-party taps
brew install livetemplate/prereview/prereview
# Windows (Scoop)
scoop bucket add prereview https://github.com/livetemplate/prereview
scoop install prereview/prereview
# Go toolchain
go install github.com/livetemplate/prereview@latest

Quick-install knobs: PREREVIEW_INSTALL_DIR=/path, PREREVIEW_VERSION=v0.4.0.

Behind a corporate proxy, upgrading, or uninstalling

Go install with the module proxy blocked, in order: default (uses proxy.golang.org) → GOPROXY=direct GOSUMDB=off go install …@latest (still needs every dependency's VCS host) → an internal GOPROXY=… → fully air-gapped, use the Quick install script or Homebrew (a single prebuilt binary, no module fetching).

Upgrade: brew upgrade prereview · scoop update prereview · re-run the install script · or prereview --update (curl/go install binaries self-update hourly; disable with --no-update / PREREVIEW_NO_UPDATE=1).

Uninstall (your .prereview/ comments are never touched): brew uninstall prereview · scoop uninstall prereview · prereview --uninstall (defers to brew/scoop if one owns it) · rm "$(go env GOPATH)/bin/prereview". Leftovers you can delete by hand: the skill at ~/.claude/skills/prereview/ and the update-check cache.

Claude Code skill (for the LLM-driven flow)

The binary embeds the skill — install it with one command:

prereview --install-skill   # → ~/.claude/skills/prereview/SKILL.md (+ reference.md)

Re-run after upgrading to refresh it. Then invoke with /prereview or "review my changes". (If it reports "unknown skill", run /reload.)

Manual / project-scoped install

From a clone, copy it yourself (e.g. project-scoped so it ships with the repo):

mkdir -p .claude/skills/prereview
cp skill/SKILL.md .claude/skills/prereview/SKILL.md

The filename must be exactly SKILL.md — uppercase. A lowercase skill.md is silently ignored. skill/reference.md (full CSV schema + filesystem contract) is optional but handy to copy alongside.

Quick start

cd <your-repo>
prereview                 # standalone: prints READY <url>, shows a Quit button

Open the URL, comment, click Quit. Comments live in .prereview/comments.csv.

prereview --skill "$(pwd)" &   # what the Claude skill runs for you

In skill mode the UI shows "Hand off → Claude": clicking it writes .prereview/DONE; the skill polls for it, reads the CSV, and acts. Or just tell Claude "review my changes" and it drives the whole loop. See skill/SKILL.md and skill/reference.md.

CLI usage

The review target is the positional path (default: current dir); everything else has a sane default, so a bare prereview just works.

prereview                                # current dir (git repo or not) — just works
prereview ./PLAN.md                      # a single file
prereview ./design-docs                  # a non-git directory — every file shown whole
prereview --base origin/main ../service  # a different git repo vs a ref (flags BEFORE the path)
prereview --external http://localhost:5173 --out ./review   # annotate a live local site (dev server)
prereview --skill                        # LLM hand-off mode (path defaults to .)

A non-git directory or single file is auto-detected: it's shown whole (every line commentable), with no diff and no base picker. Flags must come before the path. Full reference — every flag, mode, and combination — in docs/cli.md.

Usage

Comment on lines. Tap a line to anchor, tap another to extend the range (tap again to reseat), then type and save. The gutter line numbers are permalinks — the URL hash tracks your selection so you can share or reopen it.

Comment on a whole file with the Comment on file button — handy for binary, deleted, or unchanged files where no line is clickable. The file drawer defaults to changed files only; the show all toggle exposes the full tree when you want to comment on something that didn't change.

A file-level comment shown above the diff

Comment a whole file — changed or not.

Annotate an image region. On a binary image, drag a rectangle to select an area and comment on it; the box is stored as fractions, so it survives re-encoding.

A rectangle drawn on an image with a paired area comment

Drag a box on an image to annotate a region.

Markdown & HTML render by default; tap a rendered block (heading, paragraph, list…) to select its source lines, so the comment anchors to real line numbers and round-trips with the raw view. A Preview ⇄ Raw toggle switches to source. Long docs get a table-of-contents sidebar.

A rendered Markdown file with a table-of-contents sidebar

Markdown renders with a TOC; comment a block, it anchors to source lines.

See every comment in one place — the All comments chip lists comments across all files (line, file, and area kinds), each with a jump back to its source.

The all-comments overview listing line, file, and area comments across files

Every comment across files in one list.

Review from your phone. On a remote box prereview binds your Tailscale IP, so the same review + hand-off works from the Claude mobile app over the tailnet.

prereview reviewing a diff on a phone-sized screen

Review and hand off from your phone.

More: Diff ⇄ File toggles changed-hunks-with-context vs the whole file (line numbers match, so comments resolve across both) · the base dropdown picks HEAD~N, branches, or remotes (pass anything else via --base) · each comment has Edit / Resolve / Delete (Resolve keeps an audit trail; Delete has Undo) · Esc clears a selection.

Output

<repo>/.prereview/comments.csv is the source of truth — RFC-4180 quoted, 13 columns, one row per comment:

id,file,from_line,to_line,side,body,created_at,resolved,anchor,anchor_status,kind,area,url

kind is line (default), file, area, or region (a live-site rectangle from --external, anchored to a url); area carries the rectangle as {x,y,w,h} fractions. See skill/reference.md for the full column docs.

Architecture (at a glance)

  • Single binary, embeds all assets (incl. the livetemplate client JS) via //go:embed.
  • State held server-side in livetemplate's session storage; WebSocket-driven UI patches. Pure Go server; no Node/npm.
  • Atomic CSV writes via tmp+fsync+rename — read at any time without a torn file.
  • Server-side syntax highlighting via chroma, cached per file path.

Development

git clone https://github.com/livetemplate/prereview
cd prereview
make sync-client   # copies the latest livetemplate-client.js into internal/assets/client/
go build .
./prereview

E2E tests use chromedp + headless chromium: go test -tags=browser ./.... Regenerate the README screenshots with make screenshots.

License

MIT.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
screenshot command
Screenshot dev helper.
Screenshot dev helper.
Package csv writes comment rows to a CSV file that the launching Claude skill consumes.
Package csv writes comment rows to a CSV file that the launching Claude skill consumes.
Package gitdiff — deeplink.go centralises the prereview URL-hash grammar so every consumer (the SetURLHash action, the markdown + HTML link rewriters, the line-gutter permalink template) shares one parser and one stringifier.
Package gitdiff — deeplink.go centralises the prereview URL-hash grammar so every consumer (the SetURLHash action, the markdown + HTML link rewriters, the line-gutter permalink template) shares one parser and one stringifier.
internal
assets
Package assets embeds the livetemplate client browser bundle (JS + CSS) and the JetBrains Mono webfont so prereview ships as a self-contained binary with no CDN dependency (it is reviewed over Tailscale/devbox, often offline).
Package assets embeds the livetemplate client browser bundle (JS + CSS) and the JetBrains Mono webfont so prereview ships as a self-contained binary with no CDN dependency (it is reviewed over Tailscale/devbox, often offline).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL