hew
A fast, review-first terminal patch viewer, in Rust.
hew reads a unified diff and opens it in an interactive review UI where you
can attach GitHub-PR-style threaded comments. Source selection (working tree,
revs, two files) is delegated to git — you just pipe a diff in.
hew = to cut/shape a block with an axe. Same "chunk/block" lineage as a diff
hunk. Three letters, fast to type. Inspired by hunk, rebuilt from zero as a native single binary.
Install
# or
Usage
hew consumes a unified patch and nothing else — from a file, or stdin:
| | |
Load review comments from a sidecar JSON file:
Options
| Flag | Meaning |
|---|---|
FILE (positional) |
Patch file to review. Omit or use - for stdin. |
--comments <FILE> |
Sidecar JSON of review comments to load. |
--json |
Print the parsed changeset as JSON and exit (no TUI). |
Keys
| Key | Action |
|---|---|
j / k (or ↓/↑) |
Move selection |
g / G |
Jump to top / bottom |
V |
Start a range selection |
c |
Comment on the selected line/range |
r |
Reply to the thread |
R |
Toggle resolve |
d |
Delete thread |
n / N |
Jump to next / previous comment |
Esc |
Cancel input |
q |
Quit |
Comments live in memory only — nothing is written back to the patch or to disk.
Comment sidecar format
side:"new"(added/context, RIGHT) or"old"(removed, LEFT)range: a single line usesstart == endcomments[0]is the thread root; the rest are repliesauthor,resolved,id,created_atare optional (sensible defaults)
A bare [ ...threads... ] array is also accepted.
Examples
Real {patch + comments} from public PRs live in examples/:
See examples/README.md for how to fetch more.
Design & roadmap
hew is intentionally a read-only viewer: no persistence, no GitHub/network
integration, no patch apply/edit/merge, no structural (AST) diff. Today it is a
single-pane unified viewer with threaded comments.
Planned: split/stack layouts and a file sidebar, syntax highlighting (syntect →
tree-sitter), --watch reload, and a loopback session server so an agent/CLI can
drive a running TUI.
Note: hew parses plain unified diffs, not git format-patch mailbox output
(gh pr diff --patch). Use a .diff/git diff stream instead.