Grepedia
HU

hunk

Hunk is a review-first terminal diff viewer for developers and AI agents, offering multi-file streams, inline annotations, and seamless Git/Jujutsu integration.

Score0
About

Hunk is a high-performance, review-first terminal diff viewer designed for both human developers and autonomous AI agents. Built with a focus on readability and speed, it allows users to review complete changesets in a single, continuous stream, eliminating the need to toggle between individual file views. Hunk provides a robust environment where code changes and agent-authored rationale coexist, ensuring context is never lost during the review process.

Functionality includes powerful navigation across multi-file changesets, built-in support for agent annotations, and compatibility with major version control systems like Git, Jujutsu, and Sapling. Hunk excels in modern development workflows by offering real-time updates via watch mode, configurable layouts, and an extensible plugin system written in TypeScript.

Some of the key features are:

  • Multi-File Review Stream: View entire changesets in a single vertical stream, navigable by keyboard shortcuts or mouse interaction.
  • Agent-First Annotations: Seamlessly integrate AI reasoning and feedback directly into the diff, with annotations appearing alongside the specific code hunks they describe.
  • Keyboard-Driven Workflow: Navigate, filter, and modify views using intuitive keyboard controls, or use the mouse for rapid browsing.
  • Responsive Layouts: Automatically switches between side-by-side or stacked views based on terminal width, with manual overrides available.
  • Extensible API: Customize functionality and add new features using TypeScript plugins without requiring complex build steps.
  • Watch Mode: Automatically reloads the review interface when the underlying source tree or files change, facilitating iterative development.
  • Theme Support: Includes a variety of built-in syntax highlighting themes and supports custom palette definitions.
  • VCS Integration: First-class support for Git, Jujutsu, and Sapling, with tools to review working trees, specific commits, and stashes.

Operating Hunk is straightforward, starting with simple CLI commands such as hunk diff for active work or hunk show for committed changes. The interface is highly configurable through local and global TOML files, allowing users to define personal keybindings, custom themes, and layout preferences. The tool functions as a standalone viewer or can be integrated directly into your workflow as a Git pager or external difftool. Advanced users can leverage the extension system to automate common tasks, such as filtering out generated files or integrating proprietary review tools.

Some common use cases include:

  • Agent Collaboration: Reviewing code generated by autonomous AI agents, using the inline annotation feature to verify reasoning against the resulting diff.
  • Large Codebase Audits: Quickly scanning through multi-file changesets in a single session rather than flipping through individual file views.
  • Iterative Development: Utilizing watch mode to maintain a live review view that updates in real-time as you refine your code in the terminal.
  • VCS Paging: Configuring Hunk as the default pager for Git or other systems to improve the default diff viewing experience.