hunk

Terminal diff viewer for reviewing Git, GitHub, Jujutsu, and Sapling changesets, with inline agent annotations, split/unified layouts, and watch mode.

install

Hunk is a terminal diff viewer for reviewing changesets, particularly ones written by coding agents. It mirrors Git's diff-style commands but opens the result in a review UI: a multi-file review stream with sidebar navigation, split, unified, or responsive auto layouts, and inline AI or agent annotations beside the code. It is built on OpenTUI and Pierre diffs, and supports keyboard, mouse, pager, and Git difftool use.

It covers several sources of changes. hunk diff reviews working-tree changes including untracked files, hunk show reviews a commit, and hunk log browses history (interactive on a terminal, static output when piped, with optional graph view and commit range selection). hunk gh pr, hunk gh commit, and hunk gh compare open GitHub pull requests, commits, and comparisons without the GitHub CLI; GH_TOKEN or GITHUB_TOKEN is used for private repos. It auto-detects Jujutsu and Sapling checkouts and uses native revsets there. Raw inputs work too: hunk diff --files before.ts after.ts or git diff --no-color | hunk patch -. The --watch flag reloads the review as files or the working tree change.

For agent workflows, a review can be left open in one terminal while an agent loads the skill file from hunk skill path and works against the live session, adding annotations. Hunk ships as a standalone binary (no Node.js needed except for the npm install) on macOS, Linux, and Windows, and updates itself with hunk update. It suits developers who review AI-generated or large multi-file diffs from the terminal.

Installation

# via Install script
curl -fsSL https://hunk.dev/install.sh | sh
# via Homebrew
brew install hunk
# via npm
npm i -g hunkdiff

Hunk split view with sidebar and inline AI notes

Hunk unified view with mouse-selectable menus

Alternatives & related tools

add a badge to your README

Maintain hunk? Show that it's featured on trmn. The badge links back to this page.

Featured on trmn
Markdown
[![Featured on trmn](https://www.trmn.sh/badge/hunk.svg)](https://www.trmn.sh/tools/hunk?utm_source=badge)
HTML
<a href="https://www.trmn.sh/tools/hunk?utm_source=badge"><img src="https://www.trmn.sh/badge/hunk.svg" alt="Featured on trmn" height="20"></a>