Skip to content
Back to search

hunk

Review-first terminal diff viewer for agentic coders

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/modem-dev/hunk with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/modem-dev/hunk'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/modem-dev-hunk/badge.svg)](/listings/modem-dev-hunk)

HTML

<a href="/listings/modem-dev-hunk"><img src="/api/listings/modem-dev-hunk/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

The default installation method on macOS and Linux downloads a standalone binary and installs it into `~/.hunk`. It checks the archive against the release checksum when both `SHA256SUMS` and a supported checksum tool are available, and warns otherwise. Release discovery uses Hunk's anonymous aggregate endpoint with direct GitHub fallback:

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 with `brew 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](https://github.com/modem-dev/hunk/blob/main/nix/README.md) for details. Hunk also ships as a default tool in [Omarchy](https://omarchy.org), installed through mise.

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 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

Starting with Hunk 0.20, npm, Homebrew, and default install-script installs use Hunk’s canonical update command:

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.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 324 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <h1 align="center">
  2. <picture>
  3. <source media="(prefers-color-scheme: dark)" srcset="https://hunk.dev/brand/downloads/logo-lockup-paper.svg">
  4. <img src="https://hunk.dev/brand/logo-lockup.svg" alt="hunk" width="300">
  5. </picture>
  6. </h1>
  7. Hunk is an interactive terminal diff viewer for reviewing code changes, built on [OpenTUI](https://github.com/anomalyco/opentui) and [Pierre diffs](https://www.npmjs.com/package/@pierre/diffs).
  8. **[hunk.dev](https://hunk.dev)** · [Documentation](https://hunk.dev/docs/)
  9. [![CI status](https://img.shields.io/github/actions/workflow/status/modem-dev/hunk/ci.yml?branch=main&style=for-the-badge&label=CI)](https://github.com/modem-dev/hunk/actions/workflows/ci.yml?branch=main)
  10. [![Latest release](https://img.shields.io/github/v/release/modem-dev/hunk?style=for-the-badge)](https://github.com/modem-dev/hunk/releases)
  11. [![MIT License](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](LICENSE)
  12. [![Join the Discord community](https://img.shields.io/badge/Discord-Join%20community-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/WZFjaP6Gt8)
  13. - multi-file review stream with sidebar navigation
  14. - inline AI and agent annotations beside the code
  15. - split, unified, and responsive auto layouts
  16. - watch mode for auto-reloading file and Git-backed reviews
  17. - browser review: the same stream in a local web page, with mouse line-range notes
  18. - keyboard, mouse, pager, and Git difftool support
  19. <table>
  20. <tr>
  21. <td width="60%" align="center">
  22. <img width="845" alt="image" src="https://raw.githubusercontent.com/modem-dev/hunk/refs/heads/main/website/public/docs/images/review-stream.webp" />
  23. <br />
  24. <sub>Split view with sidebar and inline AI notes</sub>
  25. </td>
  26. <td width="40%" align="center">
  27. <img width="507"alt="image" src="https://raw.githubusercontent.com/modem-dev/hunk/refs/heads/main/website/public/docs/images/agent-comments.webp" />
  28. <br />
  29. <sub>Unified view and mouse-selectable menus</sub>
  30. </td>
  31. </tr>
  32. </table>
  33. ## Install
  34. On macOS and Linux, install the standalone binary:
  35. ```bash
  36. curl -fsSL https://hunk.dev/install.sh | sh
  37. ```
  38. Windows users can install with npm or mise. Other installation methods are also available:
  39. ```bash
  40. npm i -g hunkdiff # macOS, Linux, or Windows; requires Node.js 22+
  41. brew install hunk # macOS or Linux
  42. mise use -g hunk # macOS, Linux, or Windows
  43. ```
  44. > [!NOTE]
  45. > If you previously installed hunk via `modem-dev/tap`, be sure to uninstall it first with `brew uninstall modem-dev/tap/hunk`.
  46. Windows requires mise 2026.8.6 or newer. Nix users can use the `default` package exported in `flake.nix`; see [the Nix guide](https://github.com/modem-dev/hunk/blob/main/nix/README.md) for details. Hunk also ships as a default tool in [Omarchy](https://omarchy.org), installed through mise.
  47. Requirements:
  48. - 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
  49. - On x86-64, a CPU with SSE4.2 (Intel Nehalem 2008+, AMD Bulldozer 2011+); arm64 has no CPU feature floor
  50. - Node.js 22+ for the npm install; the install script, Homebrew, mise, and Nix ship a standalone binary that does not require Node.js
  51. - Git recommended for most workflows
  52. ### Update Hunk
  53. For npm, Homebrew, and default install-script installs (Hunk 0.20+):
  54. ```bash
  55. hunk update # install the newest release
  56. hunk update --check # check without installing
  57. hunk update 0.20.0 # select an exact npm or default install-script release
  58. ```
  59. 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.
  60. ## Quick start
  61. ```bash
  62. hunk # show help
  63. hunk --version # print the installed version
  64. ```
  65. ### Working with Git
  66. Use familiar Git commands to open changes in Hunk:
  67. ```bash
  68. hunk diff # review current repo changes, including untracked files
  69. hunk diff --watch # auto-reload as the working tree changes
  70. hunk diff --web # review in your browser instead of the terminal
  71. hunk show # review the latest commit
  72. hunk show HEAD~1 # review an earlier commit
  73. hunk log # browse history on a terminal; print when redirected
  74. hunk log --static # force static output, paging when needed
  75. hunk status # view workspace status and sibling worktrees (Git)
  76. hunk status --static # print one read-only workspace snapshot
  77. hunk status --json # emit one versioned workspace snapshot
  78. ```
  79. `hunk diff --web` (also `show`, `stash show`, `patch`, and `difftool`) serves the review to a page on your machine and runs until Ctrl+C; `hunk session open` opens the page for a review already running in a terminal. See [browser review](https://hunk.dev/docs/workflows/browser-review/).
  80. `hunk status` is read-only: it does not fetch or change the repository. See [workspace status](docs/status.md) for details.
  81. `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.
  82. ### Working with GitHub
  83. Hunk bundles `hunk gh`, so pull requests, commits, and comparisons open directly without the
  84. GitHub CLI or a separate extension:
  85. ```bash
  86. hunk gh pr # infer the open PR for the current branch
  87. hunk gh pr 123 # infer the repository from origin
  88. hunk gh pr 'modem-dev/hunk#123' # quote this form for shells that treat # as a comment
  89. hunk gh commit a1b2c3d --repo modem-dev/hunk
  90. hunk gh compare main...feature --repo modem-dev/hunk
  91. ```
  92. Public repositories work anonymously. Set `GH_TOKEN`, or `GITHUB_TOKEN` when it is absent, for
  93. private repositories and higher API limits. GitHub Enterprise is not currently supported.
  94. ### Working with Jujutsu and Sapling
  95. 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](#config).
  96. ### Viewing complete files and browsing directories
  97. ```bash
  98. hunk open # browse the current directory
  99. hunk open README.md # view a complete, syntax-highlighted document
  100. hunk open path/to/project # browse another directory without requiring a repository
  101. ```
  102. 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](docs/open.md) for details and file limits.
  103. ### Working with raw files and patches
  104. ```bash
  105. hunk diff --files before.ts after.ts # compare two files directly
  106. hunk diff --files before.ts after.ts --watch # auto-reload when either file changes
  107. git diff --no-color | hunk patch - # review a patch from stdin
  108. ```
  109. ### Working with agents
  110. 1. Install the review skill once: `npx skills add modem-dev/hunk -g --skill hunk-review`.
  111. 2. Open Hunk in another terminal with `hunk diff` or `hunk show`.
  112. 3. Ask your agent to use the hunk-review skill against the live Hunk session.
  113. 4. Press `a` in Hunk to show agent notes; they start hidden.
  114. If your agent has no skill system, ask it to run `hunk skill show` and follow the output.
  115. See [Review with an agent](https://hunk.dev/docs/agents/review-with-an-agent/) for live sessions, `--agent-context`, and experimental rich notes.
  116. ## Feature comparison
  117. | Capability | [hunk](https://github.com/modem-dev/hunk) | [lumen](https://github.com/jnsahaj/lumen) | [difftastic](https://github.com/Wilfred/difftastic) | [delta](https://github.com/dandavison/delta) | [diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) | [diff](https://www.gnu.org/software/diffutils/) |
  118. | ------------------------------------ | ----------------------------------------- | ----------------------------------------- | --------------------------------------------------- | -------------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------- |
  119. | Review-first interactive UI | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
  120. | Multi-file review stream + sidebar | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
  121. | Inline agent / AI annotations | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
  122. | Responsive auto split/unified layout | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
  123. | Mouse support inside the viewer | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
  124. | Runtime view toggles | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
  125. | Syntax highlighting | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
  126. | Structural diffing | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
  127. | Pager-compatible mode | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
  128. ## Advanced
  129. ### Config
  130. You can persist preferences to a config file:
  131. - `$XDG_CONFIG_HOME/hunk/config.toml` (default `~/.config/hunk/config.toml`)
  132. - `.hunk/config.toml` in a repository
  133. Persistent state uses `$XDG_STATE_HOME/hunk/state.json` when the variable is
  134. absolute, or `~/.local/state/hunk/state.json` otherwise. Hunk preserves existing
  135. state by copying the old config-directory file on first use, keeping the original
  136. and falling back to it if migration fails. Global extension paths are unchanged.
  137. For example:
  138. ```toml
  139. theme = "github-dark-default"
  140. mode = "auto" # auto, split, unified
  141. auto_split_min_width = 160 # minimum available diff columns for split in auto mode
  142. line_numbers = true
  143. wrap_lines = false
  144. ```
  145. See the [configuration guide](https://hunk.dev/docs/configure/configuration/) for command overrides and examples, the [full reference](https://hunk.dev/docs/reference/config/) for every option, or the [theme guide](https://hunk.dev/docs/configure/themes/) to customize colors.
  146. ### Keybindings
  147. Remap shortcuts with a `[keybindings]` table in your user config. See [the keybinding guide](https://hunk.dev/docs/configure/keybindings/) for available commands, default keys, and examples.
  148. ### Git integration
  149. Set Hunk as your Git pager so `git diff` and `git show` open in Hunk automatically:
  150. > [!NOTE]
  151. > 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.
  152. ```bash
  153. git config --global core.pager "hunk pager"
  154. ```
  155. Or in your Git config:
  156. ```ini
  157. [core]
  158. pager = hunk pager
  159. ```
  160. If you want to keep Git's default pager and add opt-in aliases instead:
  161. ```bash
  162. git config --global alias.hdiff "-c core.pager=\"hunk pager\" diff"
  163. git config --global alias.hshow "-c core.pager=\"hunk pager\" show"
  164. ```
  165. ### Jujutsu pager integration
  166. To use Hunk as jj's pager, run `jj config edit --user` and update:
  167. ```toml
  168. [ui]
  169. pager = ["hunk", "pager"]
  170. diff-formatter = ":git"
  171. ```
  172. ### Sapling pager integration
  173. To use Hunk as Sapling's pager, run `sl config -u` and update:
  174. ```ini
  175. [pager]
  176. pager = hunk pager
  177. ```
  178. ### Extensions (experimental)
  179. The extension API is experimental and may change in breaking ways between
  180. minor releases while it stabilizes; breaking changes are called out in
  181. release notes.
  182. Hunk loads plain TypeScript extensions from `~/.config/hunk/extensions/`, from a
  183. repository's `.hunk/extensions/` (after you explicitly trust that repository),
  184. and from `--extension <path>` for development. `--no-extensions` turns those off
  185. for one run; Hunk's own bundled backends (Git, Jujutsu, and Sapling) stay loaded.
  186. Extensions can add commands, themes, VCS backends, custom sidebars, and more. For example, filter lockfiles out of a review:
  187. ```ts
  188. // ~/.config/hunk/extensions/collapse-lockfiles.ts
  189. import type { HunkExtensionAPI } from "hunkdiff/extension";
  190. export default function (hunk: HunkExtensionAPI) {
  191. hunk.transformChangeset((changeset, ctx) => {
  192. const files = changeset.files.filter((file) => !file.path.endsWith(".lock"));
  193. ctx.notify(`Collapsed ${changeset.files.length - files.length} lockfiles`);
  194. return { ...changeset, files };
  195. });
  196. }
  197. ```
  198. Extensions shared as git repositories install straight from their host, and a
  199. `hunk-extension` GitHub topic marks community ones:
  200. ```bash
  201. hunk extension install acme/hunk-word-diff@v1.2.0 # or git:host/path, a URL, a local path
  202. hunk extension list # then update [name] / remove <name>
  203. ```
  204. Browse community extensions at
  205. [github.com/topics/hunk-extension](https://github.com/topics/hunk-extension);
  206. publish yours by pushing the extension to a repository root and adding that
  207. topic.
  208. See [the extension guide](https://hunk.dev/docs/extend/extensions/) for the API, configuration, and publishing instructions.
  209. Installable examples include
  210. [review triage](https://github.com/modem-dev/hunk/tree/main/examples/extensions/review-triage),
  211. [review snapshot export](https://github.com/modem-dev/hunk/tree/main/examples/extensions/review-snapshot-export), an optional
  212. [rendered Markdown file view](https://github.com/modem-dev/hunk/tree/main/examples/extensions/rendered-markdown), and a
  213. [Vim navigation mode](https://github.com/modem-dev/hunk/tree/main/examples/extensions/vim-navigation) built from public semantic commands.
  214. ### OpenTUI component
  215. Hunk also publishes `HunkDiffView` and lower-level primitives from `hunkdiff/opentui` for embedding the same diff renderer in your own OpenTUI app.
  216. See [the OpenTUI component guide](https://hunk.dev/docs/reference/opentui-components/) for install, API, and runnable examples.
  217. ## Examples
  218. Ready-to-run demo diffs live in [the examples directory](https://github.com/modem-dev/hunk/tree/main/examples).
  219. Each example includes the exact command to run from the repository root.
  220. ## Contributing
  221. 💬 _Chat with users/contributors on the [Modem Discord server](https://discord.gg/WZFjaP6Gt8)_
  222. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and contribution guidelines.
  223. ## Sponsor
  224. Sponsored by [Modem](https://modem.dev?utm_source=github&utm_medium=oss&utm_campaign=oss_hunk&utm_content=readme_footer).
  225. <a href="https://modem.dev?utm_source=github&utm_medium=oss&utm_campaign=oss_hunk&utm_content=readme_footer">
  226. <picture>
  227. <source media="(prefers-color-scheme: dark)" srcset="https://modem.dev/images/logo/svg/modem-combined-white.svg">
  228. <source media="(prefers-color-scheme: light)" srcset="https://modem.dev/images/logo/svg/modem-combined-black.svg">
  229. <img src="https://modem.dev/images/logo/svg/modem-combined-black.svg" alt="Modem" width="220">
  230. </picture>
  231. </a>
  232. ## License
  233. [MIT](https://github.com/modem-dev/hunk/blob/main/LICENSE)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.