Retour au classement

modem-dev/hunk

TypeScripthunk.dev

Review-first terminal diff viewer for agentic coders

clicode-reviewdiffgittui
Croissance des étoiles
Étoiles
7.6k
Forks
212
Croissance hebdomadaire
Issues
61
2k4k6k
mars 26avr. 26juin 26juil. 26
Artefactsnpmnpm install hunk
README

hunk

Hunk is a review-first terminal diff viewer for agent-authored changesets, built on OpenTUI and Pierre diffs.

CI status Latest release MIT License

  • multi-file review stream with sidebar navigation
  • inline AI and agent annotations beside the code
  • split, stack, and responsive auto layouts
  • watch mode for auto-reloading file and Git-backed reviews
  • keyboard, mouse, pager, and Git difftool support
image
Split view with sidebar and inline AI notes
image
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.

Requirements:

  • Node.js 18+
  • macOS, Linux, or Windows
  • Git recommended for most workflows

Nix users can use the default package exported in flake.nix instead. See nix/README.md for details.

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

  1. Open Hunk in another terminal with hunk diff or hunk show.
  2. Tell your agent to add the skill file returned by hunk skill path.
  3. 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.

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/stack layout
Mouse support inside the viewer
Runtime view toggles
Syntax highlighting
Structural diffing
Pager-compatible mode

Hunk is optimized for reviewing a full changeset interactively.

Advanced

Config

You can persist preferences to a config file:

  • ~/.config/hunk/config.toml
  • .hunk/config.toml

Example:

theme = "github-dark-default" # any built-in theme id, auto, or custom
mode = "auto"        # auto, split, stack
vcs = "git"          # git, jj, sl
watch = false
exclude_untracked = false
line_numbers = true
wrap_lines = false
menu_bar = true
agent_notes = false
prompt_save_view_preferences = true
transparent_background = false

theme = "auto" and --theme auto query the terminal background at startup, choose github-light-default for light backgrounds and github-dark-default for dark backgrounds, and fall back to github-dark-default if the terminal does not answer. Older theme ids such as graphite and paper remain accepted as compatibility aliases. exclude_untracked affects Git/Sapling working-tree hunk diff sessions only. prompt_save_view_preferences = false disables the quit prompt for saving changed view preferences. transparent_background can also be written as transparentBackground.

Custom themes can inherit from any built-in theme and override only the colors you care about:

theme = "custom"

[custom_theme]
base = "catppuccin-mocha"
label = "My Theme"
accent = "#7fd1ff"
panel = "#10161d"
noteBorder = "#c49bff"

[custom_theme.syntax_scopes]
"comment" = "#6e85a7"
"punctuation.definition.comment" = "#6e85a7"
"keyword.operator" = "#7fd1ff"
"entity.name.function" = "#8ed4ff"

syntax_scopes uses Shiki/TextMate scope selectors directly, so matching and precedence follow Shiki's theme rules without a Hunk-specific translation layer. Quote selectors containing dots. Declaration order is preserved; later rules win when matching selectors have equal specificity, while a more-specific base-theme selector beats a broader override. Add the grammar-specific selector when that happens. All custom theme colors must use #rrggbb hex values.

The former [custom_theme.syntax] role table is deprecated but temporarily translated into approximate scopes for compatibility. Both tables can coexist while migrating, and an exact syntax_scopes entry overrides a translated entry with the same selector. Because semantic roles have no one-to-one TextMate mapping, migrate when practical: for example, replace comment = "#ffffff" with both "comment" = "#ffffff" and "punctuation.definition.comment" = "#ffffff" under [custom_theme.syntax_scopes], adding language-specific selectors when a grammar uses more specific scopes. The compatibility table will be removed in the next major release.

Press t in the app, or choose View -> Themes…, to open the theme selector.

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:

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

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 docs/opentui-component.md for install, API, and runnable examples.

Examples

Ready-to-run demo diffs live in examples/.

Each example includes the exact command to run from the repository root.

Contributing

💬 Chat with users/contributors on the Modem Discord server

For source setup, tests, packaging checks, and repo architecture, see CONTRIBUTING.md.

Sponsored by Modem.

Modem

License

MIT

Dépôts similaires
n8n-io/n8n

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

TypeScriptnpmOtherautomationipaas
n8n.io
197.4k59.5k
ohmyzsh/ohmyzsh

🙃 A delightful community-driven (with 2,500+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community.

ShellMIT Licenseshellzsh-configuration
ohmyz.sh
188.7k26.5k
yt-dlp/yt-dlp

A feature-rich command-line audio/video downloader

PythonPyPIThe Unlicenseyoutube-dlpython
discord.gg/H5MNcFW63r
179.4k15.3k
google-gemini/gemini-cli

An open-source AI agent that brings the power of Gemini directly into your terminal.

TypeScriptnpmApache License 2.0geminigemini-api
geminicli.com
106.1k14.3k
sherlock-project/sherlock

Hunt down social media accounts by username across social networks

PythonPyPIMIT Licenseosintreconnaissance
sherlockproject.xyz
86.9k10.2k
junegunn/fzf

:cherry_blossom: A command-line fuzzy finder

GoGo ModulesMIT Licensefzfgo
junegunn.github.io/fzf/
81.9k2.8k
OpenHands/OpenHands

🙌 OpenHands: AI-Driven Development

PythonPyPIOtheragentartificial-intelligence
openhands.dev
81.6k10.4k
jesseduffield/lazygit

simple terminal UI for git commands

GoGo ModulesMIT Licensecligit
80.6k2.9k
rtk-ai/rtk

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies

Rustcrates.ioApache License 2.0agentic-codingai-coding
rtk-ai.app
72.4k4.5k
BurntSushi/ripgrep

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

Rustcrates.ioThe Unlicenseripgreprecursively-search
66.4k2.7k
tldr-pages/tldr

Collaborative cheatsheets for console commands 📚.

MarkdownOthershellman-page
tldr.sh
63.2k5.3k
santifer/career-ops

Open-source AI job search: scan job portals, evaluate listings with a structured A-F rubric into a 1.0-5.0 score, tailor your CV, track applications — runs locally in your AI coding CLI (Claude Code, Codex, OpenCode, Antigravity…)

JavaScriptnpmMIT Licenseai-agentanthropic
career-ops.org
60.9k12k