Hunk: Review-First Terminal Diff Viewer for Agentic Coders
文章目录
- Multi-file review with sidebar navigation — Browse entire changeset in a sidebar-driven TUI with split, stacked, and auto-responsive layouts. Keyboard navigation, mouse support, and Git difftool integration out of the box. Inline AI/agent annotations — Annotations from AI agents are rendered inline within the diff view, making it trivial to cross-reference agent reasoning with the actual code changes. Includes a built-in hunk skill for agent workflows. AST-aware structural diffing — A new structural diff mode analyzes TypeScript/JavaScript ASTs via the TypeScript compiler API, tagging diff rows with an S marker to distinguish structural from textual changes. Viewport-based row virtualization keeps large changesets rendering smoothly. Cross-platform: Linux, macOS, and Windows — Native Windows support added recently, including cross-platform path normalization and prebuilt binaries for x64 architectures.
- One of the best ways to gauge a project's health is to look at real discussions from its GitHub Issues. Hunk has an active community with meaningful conversations:
- Contributor @m4r1vs opened a PR to add first-class Nix flake support, including a package derivation, development shell, and direnv integration. Reviewer @elucid gave detailed feedback covering 7 points, including: not removing bun as a dependency, using Nix's own bun binary in the builder, removing an overly invasive postinstall hook, and fixing the flake devShell shape from devShell to devShells.${system}.default. The discussion evolved into a productive back-and-forth where @m4r1vs addressed all concerns, ultimately adding a dedicated bun run nix:update-lock script and CI checks for keeping the Nix lock in sync. @m4r1vs noted that a more idiomatic path for the hunk skill path would be $out/share, though this would require a corresponding change to src/core/paths.ts. "Having said that, you'll need to make some fixes before it can be merged... don't remove bun. hunk uses bun throughout the source/build/dev workflow... the postinstall hook is too invasive, remove it." — @elucid
- A large PR introduced AST-aware structural diffing, viewport virtualization, and Windows support simultaneously. Reviewer @benvinegar expressed enthusiasm but asked whether the Windows changes could be split into a separate PR for easier review. Contributor @clabby chimed in with an alternative approach: offloading structural diff to difftastic (whose CLI supports JSON output) instead of maintaining custom structural diff logic, referencing an open difftastic PR that would enable this. The bot @greptile-apps[bot] raised a significant flag: the --structural flag only works for hunk diff <file1> <file2> and silently does nothing for git/show/stash/patch modes, recommending either fixing the loader gap or adding a user-facing warning. "Would also love structural diff support. If we want to offload this to difftastic rather than having custom structural diff logic, the JSON output of the CLI paired with difftastic PR #936 would do the trick." — @clabby
- A PR introduced @hunkdiff/opentui, a reusable React component library entrypoint exposing HunkDiffView for embedding diff views directly in other OpenTUI applications. Reviewer @greptile-apps[bot] flagged two issues: @opentui/core, @opentui/react, and react appearing in both dependencies and peerDependencies, which risks duplicate React installations for library consumers; and TypeScript declaration files leaking internal type shapes. @tanvesh01 responded enthusiastically: "oooh nice! was gonna request this!" — a nice signal that the feature was highly anticipated.
- Hunk is a refreshing take on the terminal diff viewer — one that actually acknowledges the reality of modern AI-assisted coding. Its focus on agentic workflows, combined with a clean TUI and thoughtful integrations (Git, Jujutsu, Nix), makes it a tool worth watching. The community discussions show a healthy, collaborative culture with substantive code review going beyond surface-level feedback. If you're working with AI coding tools and find yourself reviewing agent-generated diffs in a basic git diff output, Hunk could significantly improve your workflow. Install: npm i -g hunkdiff
Hunk is a review-first terminal diff viewer purpose-built for AI-assisted and agentic coding workflows. Built on top of the OpenTUI framework and the Pierre diffs library, it brings a polished, keyboard-driven TUI to code review — something that has long been missing in the AI coding tooling space. Unlike traditional diff tools, Hunk is designed from the ground up to help developers review, annotate, and navigate changes generated by AI agents, with deep integrations for Git, Jujutsu (jj), and inline agent comments. It was created by the team at modem-dev and released under the MIT license.
Supporting 2,886 stars on GitHub, Hunk is actively developed with over 50 forks and regular pushes indicating a healthy upstream. Its topic tags — cli, code-review, diff, git, tui — reflect its focus on being a power-user tool for developers who live in the terminal.
- Multi-file review with sidebar navigation — Browse entire changeset in a sidebar-driven TUI with split, stacked, and auto-responsive layouts. Keyboard navigation, mouse support, and Git difftool integration out of the box.
- Inline AI/agent annotations — Annotations from AI agents are rendered inline within the diff view, making it trivial to cross-reference agent reasoning with the actual code changes. Includes a built-in
hunk skill for agent workflows.
- AST-aware structural diffing — A new structural diff mode analyzes TypeScript/JavaScript ASTs via the TypeScript compiler API, tagging diff rows with an
S marker to distinguish structural from textual changes. Viewport-based row virtualization keeps large changesets rendering smoothly.
- Cross-platform: Linux, macOS, and Windows — Native Windows support added recently, including cross-platform path normalization and prebuilt binaries for
x64 architectures.
hunk skill for agent workflows.S marker to distinguish structural from textual changes. Viewport-based row virtualization keeps large changesets rendering smoothly.x64 architectures.One of the best ways to gauge a project's health is to look at real discussions from its GitHub Issues. Hunk has an active community with meaningful conversations:
Contributor @m4r1vs opened a PR to add first-class Nix flake support, including a package derivation, development shell, and direnv integration. Reviewer @elucid gave detailed feedback covering 7 points, including: not removing bun as a dependency, using Nix's own bun binary in the builder, removing an overly invasive postinstall hook, and fixing the flake devShell shape from devShell to devShells.${system}.default. The discussion evolved into a productive back-and-forth where @m4r1vs addressed all concerns, ultimately adding a dedicated bun run nix:update-lock script and CI checks for keeping the Nix lock in sync. @m4r1vs noted that a more idiomatic path for the hunk skill path would be $out/share, though this would require a corresponding change to src/core/paths.ts.
"Having said that, you'll need to make some fixes before it can be merged... don't remove bun. hunk uses bun throughout the source/build/dev workflow... the postinstall hook is too invasive, remove it." — @elucid
A large PR introduced AST-aware structural diffing, viewport virtualization, and Windows support simultaneously. Reviewer @benvinegar expressed enthusiasm but asked whether the Windows changes could be split into a separate PR for easier review. Contributor @clabby chimed in with an alternative approach: offloading structural diff to difftastic (whose CLI supports JSON output) instead of maintaining custom structural diff logic, referencing an open difftastic PR that would enable this. The bot @greptile-apps[bot] raised a significant flag: the --structural flag only works for hunk diff <file1> <file2> and silently does nothing for git/show/stash/patch modes, recommending either fixing the loader gap or adding a user-facing warning.
"Would also love structural diff support. If we want to offload this to difftastic rather than having custom structural diff logic, the JSON output of the CLI paired with difftastic PR #936 would do the trick." — @clabby
A PR introduced @hunkdiff/opentui, a reusable React component library entrypoint exposing HunkDiffView for embedding diff views directly in other OpenTUI applications. Reviewer @greptile-apps[bot] flagged two issues: @opentui/core, @opentui/react, and react appearing in both dependencies and peerDependencies, which risks duplicate React installations for library consumers; and TypeScript declaration files leaking internal type shapes. @tanvesh01 responded enthusiastically: "oooh nice! was gonna request this!" — a nice signal that the feature was highly anticipated.
Hunk is a refreshing take on the terminal diff viewer — one that actually acknowledges the reality of modern AI-assisted coding. Its focus on agentic workflows, combined with a clean TUI and thoughtful integrations (Git, Jujutsu, Nix), makes it a tool worth watching. The community discussions show a healthy, collaborative culture with substantive code review going beyond surface-level feedback. If you're working with AI coding tools and find yourself reviewing agent-generated diffs in a basic git diff output, Hunk could significantly improve your workflow.
Install: npm i -g hunkdiff