More on the topic...
Generating detailed summary...
Failed to generate summary. Please try again.
Hunk is a terminal-based diff viewer built on OpenTUI and Pierre diffs that turns your Git (or Jujutsu, Sapling) changesets into an interactive review session. Instead of piping raw text to your screen, you get a multi-file stream with a sidebar for navigation, split or stacked layouts that adapt to your window, and inline AI or agent annotations next to the code. You can run watch mode to auto-reload when files change, hook it up as your Git pager (git config core.pager "hunk pager"), or launch it directly with commands like `hunk diff`, `hunk show HEAD~1`, or even `git diff --no-color | hunk patch -` to review a patch from stdin.
Installing takes seconds via npm (`npm i -g hunkdiff`) or Homebrew (`brew install modem-dev/tap/hunk`). It needs Node.js 18+ on macOS, Linux, or Windows; Git’s recommended for full working-tree reviews. Out of the box, Hunk mirrors Git’s CLI syntax: `hunk diff before.ts after.ts --watch` reloads two files on change, while `hunk show` spins up an interface instead of raw diff. It auto-detects VCS—use `vcs = "jj"` or `vcs = "sl"` in your config to override—and supports native revsets for Jujutsu and Sapling.
Under the hood you can tweak everything in `~/.config/hunk/config.toml`: pick themes (“github-dark-default”, “auto”), switch modes (split, stack, auto), turn line numbers, wrapping, agent notes, or transparency on and off. You can even write a custom theme by inheriting built-ins and overriding hex colors under `[custom_theme.syntax]`. Press t or choose View → Themes in the app to bring up the selector.
A comparison table pits Hunk against tools like lumen, difftastic, delta, and diff-so-fancy. Hunk is the only one offering inline AI annotations, responsive layouts, runtime toggles and a true multi-file review experience. If you’re building your own OpenTUI application, Hunk publishes HunkDiffView and low-level primitives in hunkdiff/opentui so you can embed the same renderer. Examples with exact commands live in the examples/ folder and you can find API docs in docs/opentui-component.md.
Questions about this article
No questions yet.