npm 安装需 Node.js 22+,独立二进制安装则不需要 Node.js;Windows on arm64 和 musl 系 Linux(如 Alpine)没有预编译二进制;曾用 modem-dev/tap 安装的需先 brew uninstall 再装;代理注释默认隐藏,需按 a 显示。
curl -fsSL https://hunk.dev/install.sh | sh
npm i -g hunkdiffmacOS(arm64/x64)、Linux(arm64/x64,glibc)或 Windows(x64);x86-64 需支持 SSE4.2,arm64 无 CPU 特性要求。README 未提及显存或 GPU 要求,纯终端工具。
面向 AI 编程代理的终端 diff 审查器,把代码改动和代理注释放在一起看
面向 AI 编程代理的终端 diff 查看器,以审查优先的方式展示代码改动,方便在命令行里逐块检查 agent 生成的补丁。
核心能力
- 多文件审查流配合侧边栏导航
- 在代码旁内联显示 AI 与代理注释
- 支持分栏、统一和自适应自动布局
- watch 模式自动重载文件与 Git 审查
- 可作 Git difftool 并兼容 pager 输出
容易踩的坑
- v0.24.1最新正式版2026-10-25 · 2026-10-25 01:00 UTC
What's Changed
- docs(release): publish stable 0.24.0 notes by @benvinegar in https://github.com/modem-dev/hunk/pull/1206
- fix(website): clean vector brand exports, plus a reusable release-video kit by @benvinegar in https://github.com/modem-dev/hunk/pull/1208
- fix(search): stop at every match instead of one per hunk by @HackAttack in https://github.com/modem-dev/hunk/pull/1212
- fix(nix): bundle the syntax-highlighting worker by @matthew-hre in https://github.com/modem-dev/hunk/pull/1211
- build: test that the Nix package compiles every Bun entrypoint by @elucid in https://github.com/modem-dev/hunk/pull/1213
- build(nix): compile through build-bin.ts with Bun's baseline x64 runtime by @elucid in https://github.com/modem-dev/hunk/pull/1214
- build(nix): distrust compromised eMudhra CAs via Node 24.22.1 and Bun 1.4.4 by @elucid in https://github.com/modem-dev/hunk/pull/1218
- fix(ci): use available QEMU user package on Ubuntu by @benvinegar in https://github.com/modem-dev/hunk/pull/1224
- chore(release): prepare 0.24.1 by @benvinegar in https://github.com/modem-dev/hunk/pull/1226
- fix(ci): keep baseline CPU probes on compatible cloud runners by @benvinegar in https://github.com/modem-dev/hunk/pull/1227
Full Changelog: https://github.com/modem-dev/hunk/compare/v0.24.0...v0.24.1
- v0.24.02026-10-19 · 2026-10-19 12:38 UTC
查看更新说明
Hunk 0.24: beyond the diff
Hunk 0.24 brings complete-file and directory browsing, a live workspace compass, npm-installed extensions, and version-matched agent skills into your terminal review workspace. Worker highlighting makes startup interaction smoother, while a round of memory fixes keeps large reviews and long-running sessions leaner.
For npm- and curl-managed installs:
hunk update 0.24.0 npm install -g [email protected]Homebrew availability will be verified after publication; until then, Homebrew propagation is pending. The commands above select the exact release for npm- and curl-managed installations.
Explore the source and find your next review
hunk openshows complete syntax-highlighted files and browses directories with lazy loading, live refresh, and keyboard or mouse navigation. Inspect the surrounding source without manufacturing a diff. The new read-only workspace status view brings together staging state, tracked and untracked changes, and sibling worktrees, with navigation into history and full diff reviews. Static and versioned JSON status output are available too. #1148, #1067Automatic diff layout now uses the space actually left after side panes and padding: opening a pane can switch to unified, and closing it can restore split.
auto_split_min_widthcontrols the threshold, whilescroll_offkeeps surrounding context visible during line navigation. Binary files remain reachable through file navigation and sidebar clicks, and the sidebar follows held file-navigation keys without overriding ordinary manual scrolling. #1170, #1109, #1178, #1085Keep reviews responsive—and let old reviews go
Syntax highlighting runs in a worker by default, with grammar warmup during startup to reduce the input stall after the review first appears. Large-diff highlight failures use bounded retries rather than restarting on every scroll. #1105, #785
Live reloads no longer retain every previous review's files and render state. Nonwrapped reviews reuse geometry across terminal resizes, and keyboard navigation leaves copy-selection content lazy rather than materializing it eagerly. Sessions also stop repeatedly submitting a rejected review to an unchanged daemon while retaining recovery when the review or daemon changes. #1201, #1200, #1202, #1199
Review reliability improves too: wheel scrolling no longer leaves comments targeting stale lines, notes survive reloads that temporarily omit their files, suspended windows keep their sessions registered, and terminal-editor handoffs release Hunk's stdin reader before launching the editor. #1143, #1164, #1131, #1134, #1165
Performance note: release benchmarks have no gated regressions against 0.23.0 or beta.1. The known sidebar-follow tradeoff from beta.1 remains relative to beta.0: navigation p95 is 42.74 ms versus beta.0's 36.35 ms, beta.1's 44.55 ms, and 0.23.0's 46.32 ms. This preserves correct sidebar following during held navigation and resizing.
Easier extensions, agent setup, and shell navigation
hunk extension installaccepts npm packages—including scopes, versions, ranges, and tags—alongside Git sources, without running npm lifecycle scripts. Fold - v0.24.0-beta.1pre-release2026-10-15 · 2026-10-15 17:26 UTC
查看更新说明
What's Changed
- fix(ui): keep binary files reachable by file navigation and clicks by @bottercode in https://github.com/modem-dev/hunk/pull/1178
- fix(cli): reject unrecognized nonempty patch input by @benvinegar in https://github.com/modem-dev/hunk/pull/1183
- Add hunk-why to hunk-extension marketplace by @benvinegar in https://github.com/modem-dev/hunk/pull/1179
- fix(ui): distinguish empty reviews from filtered files by @benvinegar in https://github.com/modem-dev/hunk/pull/1182
- fix(ui): keep the selected file visible in the sidebar during held navigation by @Lawgk in https://github.com/modem-dev/hunk/pull/1085
- test(website): allow published prereleases in changelog smoke by @benvinegar in https://github.com/modem-dev/hunk/pull/1185
- docs: correct stale facts and fill gaps across hunk.dev docs by @benvinegar in https://github.com/modem-dev/hunk/pull/1186
- chore(release): prepare 0.24.0-beta.1 by @benvinegar in https://github.com/modem-dev/hunk/pull/1187
New Contributors
- @Lawgk made their first contribution in https://github.com/modem-dev/hunk/pull/1085
Full Changelog: https://github.com/modem-dev/hunk/compare/v0.24.0-beta.0...v0.24.0-beta.1
- v0.24.0-beta.0pre-release2026-10-13 · 2026-10-13 04:21 UTC
查看更新说明
Hunk 0.24 beta: beyond the diff
This first 0.24 beta brings complete-file and directory browsing, a live workspace compass, and easier extension and agent setup into the same terminal workspace as your reviews. It also moves syntax highlighting into a worker by default and makes automatic diff layout respond to the space left by your side panes.
For npm- and curl-managed installs, select this beta explicitly:
hunk update 0.24.0-beta.0 npm install -g [email protected]This is a prerelease. Stable installs continue to use 0.23.0; Homebrew does not distribute this beta.
Browse the whole file, then find your next review
hunk openshows complete syntax-highlighted files and browses directories with lazy loading, live refresh, and keyboard or mouse navigation. You can inspect the surrounding source without manufacturing a diff. #1148The new read-only workspace status view makes tracked and untracked changes, staging state, and sibling worktrees easy to inspect, with navigation into history and full diff reviews. Static and versioned JSON output are available too. #1067
A review that follows your workspace
Syntax highlighting now runs in a worker by default, with grammar warmup during startup to reduce the input stall after the first review frame appears. Large-diff highlight failures use bounded retries rather than restarting on every scroll. #1105, #785
Automatic layout now considers the available diff width after side panes and padding, so opening a pane can switch the review to unified and closing it can restore split.
auto_split_min_widthlets you choose that threshold.scroll_offkeeps context around the current line, and the note composer's save shortcut is remappable. #1170, #1109, #962This beta also fixes comment targets drifting after wheel scrolling, preserves notes across reloads that temporarily omit their files, and keeps live sessions registered while a window is suspended. #1143, #1164, #1131, #1134
Easier extensions, agent setup, and shell navigation
hunk extension installnow accepts npm packages—including scopes, versions, ranges, and tags—alongside Git sources, without running npm lifecycle scripts. Folder-local package imports also work in compiled Hunk binaries. Extensions gain generation-scoped presentation filters and independent left/right pane controls. #1162, #1163, #1118, #1171Install agent pointer skills through the skills CLI;
hunk skill showsupplies the full instructions matched to your installed Hunk version. Bash and Zsh completions help discover commands, flags, and supported values. #1167, #1157Compatibility notes
- Layout defaults: auto mode now uses a threshold of 160 available diff columns. Explicit
splitandunifiedmodes still override automatic selection; configureauto_split_min_widthto change the threshold. - Navigation defaults:
scroll_offdefaults to five context rows. Setscroll_off = 0or pass--scroll-off 0to restore edge-only scrolling. - Highlighting:
--fastis now a no-op and will be removed in a later release. Windows compiled binaries and custom themes withsyntax_scopescontinue to highlight inline. - **Ex
- Layout defaults: auto mode now uses a threshold of 160 available diff columns. Explicit
- v0.23.02026-09-30 · 2026-09-30 17:06 UTC
查看更新说明
What's Changed
- fix(ui): open help and menus without first-use suspension by @elucid in https://github.com/modem-dev/hunk/pull/1079
- test(pty): synchronize inputs on committed screen state by @elucid in https://github.com/modem-dev/hunk/pull/1083
- perf(highlight): load Shiki WASM bytes without base64 decoding by @elucid in https://github.com/modem-dev/hunk/pull/1078
- docs(release): publish v0.22.0 notes by @benvinegar in https://github.com/modem-dev/hunk/pull/1087
- perf(test): reduce fixture process overhead by @benvinegar in https://github.com/modem-dev/hunk/pull/1092
- feat(ui): host-owned status line with inline prompts, exposed to extensions by @elucid in https://github.com/modem-dev/hunk/pull/1095
- feat(search):
/searches diff content via a bundled search extension by @elucid in https://github.com/modem-dev/hunk/pull/1096 - Make daemon/client build skew visible and resolvable with hunk daemon status/restart by @elucid in https://github.com/modem-dev/hunk/pull/1099
- feat(config): make wheel scrolling configurable by @benvinegar in https://github.com/modem-dev/hunk/pull/853
- feat(extensions): add host-owned file-view syntax highlighting by @benvinegar in https://github.com/modem-dev/hunk/pull/1053
- feat(ui): add support line number in "Open file in editor" for zed by @seiichi1101 in https://github.com/modem-dev/hunk/pull/1073
- Add hunk-triage to hunk-extension marketplace by @benvinegar in https://github.com/modem-dev/hunk/pull/1113
- test(pty): speed up integration synchronization by @benvinegar in https://github.com/modem-dev/hunk/pull/1098
- fix(nix): install hunkdiff alias so hunk patch works by @schickling-assistant in https://github.com/modem-dev/hunk/pull/1108
- fix(test): compare install VM paths in one spelling so symlinked tmpdirs pass by @shashank-100 in https://github.com/modem-dev/hunk/pull/1120
- fix(cli): resolve bundled skills by proximity, not candidate order by @shashank-100 in https://github.com/modem-dev/hunk/pull/1116
- docs(release): gate Homebrew availability claims by @benvinegar in https://github.com/modem-dev/hunk/pull/1088
- fix(ui): register one terminal blur listener per diff pane by @speedsharmaai in https://github.com/modem-dev/hunk/pull/1111
- fix(nix): use stdenv.hostPlatform.isLinux by @patrickhaahr in https://github.com/modem-dev/hunk/pull/1101
- Add hunk-starlark to extension marketplace by @HackAttack in https://github.com/modem-dev/hunk/pull/1124
- feat(theme): add a default terminal theme that follows terminal colors by @dhh in https://github.com/modem-dev/hunk/pull/1128
- feat(extensions): bundle GitHub review commands by @benvinegar in https://github.com/modem-dev/hunk/pull/1129
- chore(release): prepare v0.23.0 by @benvinegar in https://github.com/modem-dev/hunk/pull/1133
New Contributors
- @seiichi1101 made their first contribution in https://github.com/modem-dev/hunk/pull/1073
- @schickling-assistant made their first contribution in https://github.com/modem-dev/hunk/pull/1108
- @shashank-100 made their first contribution in https://github.com/modem-dev/hunk/pull/1120
- @speedsharmaai made their first contribution in https://github.com/modem-dev/hunk/pull/1111
- @patrickhaahr made their first contribution in https://github.com/modem-dev/hunk/pull/1101
- @dhh made their first contribution in https://github.com/modem-dev/hunk/pull/1128
Full Changelog: https://github.com/modem-dev/hunk/compare/v0.22.0...v0.23.0
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
hunk
Hunk is an interactive terminal diff viewer for reviewing code changes, built on OpenTUI and Pierre diffs.
- multi-file review stream with sidebar navigation
- inline AI and agent annotations beside the code
- split, unified, and responsive auto layouts
- watch mode for auto-reloading file and Git-backed reviews
- keyboard, mouse, pager, and Git difftool support
Install
On macOS and Linux, install the standalone binary:
curl -fsSL https://hunk.dev/install.sh | sh
Windows users can install with npm or mise. Other installation methods are also available:
npm i -g hunkdiff # macOS, Linux, or Windows; requires Node.js 22+
brew install hunk # macOS or Linux
mise use -g hunk # macOS, Linux, or Windows
[!NOTE] If you previously installed hunk via
modem-dev/tap, be sure to uninstall it first withbrew uninstall modem-dev/tap/hunk.
Windows requires mise 2026.8.6 or newer. Nix users can use the default package exported in flake.nix; see the Nix guide for details. Hunk also ships as a default tool in Omarchy, installed through mise.
Requirements:
- macOS (arm64, x64), Linux (arm64, x64; glibc), or Windows (x64); prebuilt binaries are not published for Windows on arm64 or musl-based Linux such as Alpine
- On x86-64, a CPU with SSE4.2 (Intel Nehalem 2008+, AMD Bulldozer 2011+); arm64 has no CPU feature floor
- Node.js 22+ for the npm install; the install script, Homebrew, mise, and Nix ship a standalone binary that does not require Node.js
- Git recommended for most workflows
Update Hunk
For npm, Homebrew, and default install-script installs (Hunk 0.20+):
hunk update # install the newest release
hunk update --check # check without installing
hunk update 0.20.0 # select an exact npm or default install-script release
On an older release, update once with the installer or package manager that installed Hunk, then use hunk update going forward. Custom HUNK_INSTALL_DIR installs must re-run the installer with the same directory; mise, Nix, and source installs use their owning tools instead.
Quick start
hunk # show help
hunk --version # print the installed version
Working with Git
Use familiar Git commands to open changes in Hunk:
hunk diff # review current repo changes, including untracked files
hunk diff --watch # auto-reload as the working tree changes
hunk show # review the latest commit
hunk show HEAD~1 # review an earlier commit
hunk log # browse history on a terminal; print when redirected
hunk log --static # force static output, paging when needed
hunk status # view workspace status and sibling worktrees (Git)
hunk status --static # print one read-only workspace snapshot
hunk status --json # emit one versioned workspace snapshot
hunk status is read-only: it does not fetch or change the repository. See workspace status for details.
hunk log opens an interactive history browser in a terminal and prints text when piped or redirected. Use --oneline for compact output. In the browser, enable Graph view from the View menu to see commit branches, or press v to select a commit range. Quit a commit review to return to history.
Working with GitHub
Hunk bundles hunk gh, so pull requests, commits, and comparisons open directly without the
GitHub CLI or a separate extension:
hunk gh pr # infer the open PR for the current branch
hunk gh pr 123 # infer the repository from origin
hunk gh pr 'modem-dev/hunk#123' # quote this form for shells that treat # as a comment
hunk gh commit a1b2c3d --repo modem-dev/hunk
hunk gh compare main...feature --repo modem-dev/hunk
Public repositories work anonymously. Set GH_TOKEN, or GITHUB_TOKEN when it is absent, for
private repositories and higher API limits. GitHub Enterprise is not currently supported.
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. hunk log --vcs jj also reads JJ history directly, including in a non-colocated workspace. To override VCS detection, set vcs = "git" or vcs = "jj" or vcs = "sl" in config.
Viewing complete files and browsing directories
hunk open # browse the current directory
hunk open README.md # view a complete, syntax-highlighted document
hunk open path/to/project # browse another directory without requiring a repository
Use arrows and Enter to navigate, Tab to switch focus, i to show hidden/Git-ignored entries, and e to edit the displayed file in $EDITOR. See the open workflow for details and file limits.
Working with raw files and patches
hunk diff --files before.ts after.ts # compare two files directly
hunk diff --files before.ts after.ts --watch # auto-reload when either file changes
git diff --no-color | hunk patch - # review a patch from stdin
Working with agents
- Install the review skill once:
npx skills add modem-dev/hunk -g --skill hunk-review. - Open Hunk in another terminal with
hunk difforhunk show. - Ask your agent to use the hunk-review skill against the live Hunk session.
- Press
ain Hunk to show agent notes; they start hidden.
If your agent has no skill system, ask it to run hunk skill show and follow the output.
See Review with an agent for live sessions, --agent-context, and experimental rich notes.
Feature comparison
| Capability | hunk | lumen | difftastic | delta | diff-so-fancy | diff |
|---|---|---|---|---|---|---|
| Review-first interactive UI | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Multi-file review stream + sidebar | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Inline agent / AI annotations | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Responsive auto split/unified layout | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Mouse support inside the viewer | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Runtime view toggles | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Syntax highlighting | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
| Structural diffing | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
| Pager-compatible mode | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
Advanced
Config
You can persist preferences to a config file:
$XDG_CONFIG_HOME/hunk/config.toml(default~/.config/hunk/config.toml).hunk/config.tomlin a repository
Persistent state uses $XDG_STATE_HOME/hunk/state.json when the variable is
absolute, or ~/.local/state/hunk/state.json otherwise. Hunk preserves existing
state by copying the old config-directory file on first use, keeping the original
and falling back to it if migration fails. Global extension paths are unchanged.
For example:
theme = "github-dark-default"
mode = "auto" # auto, split, unified
auto_split_min_width = 160 # minimum available diff columns for split in auto mode
line_numbers = true
wrap_lines = false
See the configuration guide for command overrides and examples, the full reference for every option, or the theme guide to customize colors.
Keybindings
Remap shortcuts with a [keybindings] table in your user config. See the keybinding guide for available commands, default keys, and examples.
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 diffworking-tree loader. If you opengit diffthroughhunk 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:
git config --global alias.hdiff "-c core.pager=\"hunk pager\" diff"
git config --global alias.hshow "-c core.pager=\"hunk pager\" show"
Jujutsu pager integration
To use Hunk as jj's pager, run jj config edit --user and update:
[ui]
pager = ["hunk", "pager"]
diff-formatter = ":git"
Sapling pager integration
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.
Extensions can add commands, themes, VCS backends, custom sidebars, and more. For example, filter lockfiles out of a review:
// ~/.config/hunk/extensions/collapse-lockfiles.ts
import type { HunkExtensionAPI } from "hunkdiff/extension";
export default function (hunk: HunkExtensionAPI) {
hunk.transformChangeset((changeset, ctx) => {
const files = changeset.files.filter((file) => !file.path.endsWith(".lock"));
ctx.notify(`Collapsed ${changeset.files.length - files.length} lockfiles`);
return { ...changeset, files };
});
}
Extensions shared as git repositories install straight from their host, and a
hunk-extension GitHub topic marks community ones:
hunk extension install acme/[email protected] # or git:host/path, a URL, a local path
hunk extension list # then update [name] / remove <name>
Browse community extensions at github.com/topics/hunk-extension; publish yours by pushing the extension to a repository root and adding that topic.
See the extension guide for the API, configuration, and publishing instructions. Installable examples include review triage, review snapshot export, an optional rendered Markdown file view, and a Vim navigation mode built from public semantic commands.
OpenTUI component
Hunk also publishes HunkDiffView and lower-level primitives from hunkdiff/opentui for embedding the same diff renderer in your own OpenTUI app.
See the OpenTUI component guide for install, API, and runnable examples.
Examples
Ready-to-run demo diffs live in the examples directory.
Each example includes the exact command to run from the repository root.
Contributing
💬 Chat with users/contributors on the Modem Discord server
See CONTRIBUTING.md for development setup and contribution guidelines.
Sponsor
Sponsored by Modem.