Note: This code is 100% vibe coded.
A semantic git diff viewer that groups related changes (hunks) and explains what they do.
Instead of showing raw diffs, hnk uses Claude to analyze changes and present them as logical groups with explanations.
go install github.com/jm/hnk/cmd/hnk@latestOr build from source:
git clone https://github.com/jm/hnk
cd hnk
go install ./cmd/hnkRequires the Claude CLI to be installed and authenticated.
hnk # unstaged changes
hnk -s # staged changes
hnk HEAD~1 # show a specific commit
hnk main # compare against a branch
hnk --from HEAD~5 --to HEAD # range--staged, -s staged changes only
--ref, -r compare against ref
--from / --to range comparison
--model, -m claude model (haiku, sonnet, opus)
--light, -l force light mode
--dark force dark mode
--no-color disable colors
--no-line-numbers hide line numbers
--raw plain output
--style syntax theme (monokai, dracula, github, etc)
--tui, -i interactive TUI mode
Optional ~/.hnk file:
{
"theme": "auto",
"model": "sonnet",
"style": "monokai",
"line_numbers": true
}Theme can be auto (detects macOS appearance), light, or dark.
- Semantic grouping of related changes
- Syntax highlighting (50+ languages)
- Auto-detects macOS light/dark mode
- Line numbers with old/new file positions
- Interactive TUI mode with keyboard navigation
Run with --tui or -i for an interactive full-screen viewer:
hnk --tuiKeybindings:
←/→orh/l- navigate between groups↑/↓ork/j- scroll up/downSpace/PgDn- page downPgUp- page upg/G- jump to top/bottomq- quit