modem-dev/hunk

Review-first terminal diff viewer for agentic coders

hunk – a terminal diff viewer with AI‑ready annotations

What it is – hunk is a command‑line tool that replaces the plain‑text output of git diff, git show or similar commands with an interactive, pane‑based UI. It lets you scroll through a whole changeset, jump between files via a sidebar, and view the diff in split‑view or unified mode. The UI is built on the OpenTUI framework and uses the @pierre/diffs library for the underlying diff rendering.

Why it matters for AI/agents – The viewer has a dedicated “inline AI and agent annotations” column. An external AI‑agent can be given a skill (a small executable script) that talks to a running hunk session, allowing the agent to add notes, suggestions, or automated fixes directly inside the review UI. This makes hunk a natural front‑end for AI‑assisted code review workflows.

Key features

  • Multi‑file review stream with a navigation sidebar.
  • Split, unified and responsive auto layouts.
  • Live‑watch mode that reloads the view as files or the Git working tree change.
  • Full keyboard, mouse, pager and Git‑difftool integration.
  • Inline AI/agent notes and an experimental rich‑text note format.
  • Extensible via TypeScript extensions (e.g., collapsing lockfiles, custom themes, extra VCS back‑ends).
  • Works with Git, Jujutsu and Sapling repositories; can also diff arbitrary files or patches.

Installation – A single‑command installer (curl … | sh) drops a pre‑built binary into ~/.hunk. Packages are also available via npm (npm i -g hunkdiff), Homebrew, mise, or Nix. Windows users install via npm or mise.

Typical workflow

# review the current working tree
hunk diff

# watch for changes while you edit
hunk diff --watch

# open a specific commit or PR (GitHub integration)
hunk show HEAD~2
hunk gh pr 123

You can also set hunk pager as Git’s core pager so any git diff or git show automatically launches the UI.

Extensibility – Extensions are plain TypeScript files placed in ~/.config/hunk/extensions/ (or a repo‑local .hunk/extensions/). They can transform the changeset, add new commands, supply themes, or embed custom React components. Community extensions are discoverable via the GitHub hunk‑extension topic.

Who might use it – Developers who spend a lot of time reviewing pull‑requests, teams building AI‑driven code‑review bots, or anyone who prefers a richer terminal UI over raw diff text.

License – MIT.

Related

  • Project
  • Project
  • Project
  • Dispatch
  • Project