watch mode for auto-reloading file and Git-backed reviews
keyboard, mouse, pager, and Git difftool support
Split view with sidebar and inline AI notes
Stacked view and mouse-selectable menus
Install
npm i -g hunkdiff
Or with Homebrew:
brew install hunk
[!NOTE]
If you previously installed hunk via modem-dev/tap, be sure to uninstall it first with brew uninstall modem-dev/tap/hunk.
Or with mise (Windows requires mise 2026.8.6 or newer):
mise use -g hunk
Requirements:
macOS, Linux, or Windows
On x86-64, a CPU with SSE4.2 (Intel Nehalem 2008+, AMD Bulldozer 2011+); arm64 has no CPU feature floor
Node.js 18+ for the npm install; Homebrew, mise, and Nix ship a standalone binary
Git recommended for most workflows
Nix users can use the default package exported in flake.nix instead. See nix/README.md for details.
Hunk also ships as a default tool in Omarchy, installed through mise.
Quick start
hunk # show help
hunk --version # print the installed version
Working with Git
Hunk mirrors Git's diff-style commands, but opens the changeset in a review UI instead of plain text.
hunk diff # review current repo changes, including untracked files
hunk --fast # experimentally offload eligible large-diff highlighting
hunk diff --watch # auto-reload as the working tree changes
hunk show # review the latest commit
hunk show HEAD~1 # review an earlier commit
Working with Jujutsu and Sapling
Hunk auto-detects Jujutsu and Sapling checkouts, so hunk diff [revset] and hunk show [revset] use native revsets inside jj or Sapling workspaces. To override VCS detection, set vcs = "git" or vcs = "jj" or vcs = "sl" in config.
Working with raw files and patches
hunk diff before.ts after.ts # compare two files directly
hunk diff before.ts after.ts --watch # auto-reload when either file changes
git diff --no-color | hunk patch - # review a patch from stdin
Watch mode remains continuous. Direct-file and Git-backed reviews normally use filesystem observation to refresh promptly, with periodic polling retained as a fallback for missed events or unavailable watchers. Jujutsu and Sapling reviews currently use polling rather than filesystem observation.
Working with agents
Open Hunk in another terminal with hunk diff or hunk show.
Tell your agent to add the skill file returned by hunk skill path.
Ask your agent to use the skill against the live Hunk session.
A good generic prompt is:
Load the Hunk skill and use it for this review. Run `hunk skill path` to get the skill path.
For the full live-session and --agent-context workflow guide, see docs/agent-workflows.md. Experimental rich STML note bodies require starting the review with --experimental; plain agent notes remain the default.
Choose a built-in theme, auto, or a custom theme with theme. See
docs/themes.md for automatic selection, custom theme tables,
syntax scopes, and legacy syntax-table migration.
exclude_untracked affects Git/Sapling working-tree hunk diff sessions only.
tab_width controls source-code tab stops and can be overridden with -x4 or --tab-width 4.
prompt_save_view_preferences = false disables the quit prompt for saving changed view preferences.
transparent_background can also be written as transparentBackground.
Keybindings
Every keyboard shortcut is a named command, and a [keybindings] table in your
user config remaps command ids to the keys you want them on — several keys per
command, exclusive claims over defaults, and false to unbind. See
docs/keybindings.md for the rules, the chord grammar,
and the full table of built-in commands and their default keys.
Git integration
Set Hunk as your Git pager so git diff and git show open in Hunk automatically:
[!NOTE]
Untracked files are auto-included only for Hunk's own hunk diff working-tree loader. If you open git diff through hunk pager, Git still decides the patch contents, so untracked files will not appear there.
git config --global core.pager "hunk pager"
Or in your Git config:
[core]pager = hunk pager
If you want to keep Git's default pager and add opt-in aliases instead:
To use Hunk as Sapling's pager, run sl config -u and update:
[pager]pager = hunk pager
Extensions (experimental)
The extension API is experimental and may change in breaking ways between
minor releases while it stabilizes; breaking changes are called out in
release notes.
Hunk loads plain TypeScript extensions from ~/.config/hunk/extensions/, from a
repository's .hunk/extensions/ (after you explicitly trust that repository),
and from --extension <path> for development. --no-extensions turns those off
for one run; Hunk's own bundled backends (Git, Jujutsu, and Sapling) stay loaded.
A Phase 1 extension can contribute themes and file-extension → language
mappings, add a VCS backend, rewrite the changeset before review (collapse
lockfiles, reorder files by review priority), replace the file-navigation
sidebar with its own React component, react to lifecycle events, and show
transient messages:
Desktop-inspired terminal diff viewer for understanding agent-authored changesets.
The npm package hunkdiff receives a total of 4,129 weekly downloads. As such, hunkdiff popularity was classified as popular.
We found that hunkdiff demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Cursor removed a malicious Claude Code 2.1.313 extension from its marketplace. Socket examines registry records and the initial claims about its distribution.