chunk is a terminal diff reviewer for Git repositories. It shows a tree file
list beside a syntax-highlighted unified diff, with live worktree refresh,
file/hunk staging, guarded discard actions, mouse support, and optional AI
actions through OpenCode, Claude Code, or Codex.
- Rust 2024 toolchain
- Git
- OpenCode, Claude Code, or Codex for Ask AI actions
- A Nerd Font for file/status glyphs
Run inside a Git worktree:
cargo run -- diff # live worktree review; also the default command
cargo run -- pr [base] # branch review from merge-base(base, HEAD) to HEAD
cargo run -- diff --jsondiff reviews staged, unstaged, mixed, and untracked changes against HEAD and
live-refreshes as the worktree changes.
pr is read-only: no live refresh, staging, or discard. Without a base ref it
tries origin/HEAD, then main, then master.
diff --json prints one worktree snapshot for external frontends instead of
starting the terminal UI. The output includes title, source_label, and
files; each file includes paths, status, stage, line counts, binary state, and
hunks with stable old/new ranges and diff lines.
These are the default keys. Most single-character actions can be remapped in
[keybinds]; special keys and Ctrl-* combos stay fixed.
| Keys | Action |
|---|---|
j / k |
Move in the focused list or scroll the diff |
Tab / Shift-Tab, Left, Right, Enter |
Change focus between panes |
f |
Toggle the file list |
/, n, N |
Search the selected file; jump next/previous match or hunk |
PageDown / Ctrl-d, PageUp / Ctrl-u |
Page the diff |
g / Home, G / End |
Jump to top or bottom |
? |
Toggle in-app help |
a, x, u |
Ask AI, explain selection, or summarize unpublished changes |
F2 |
Configure the AI harness, model, and effort; persist to config.toml |
y, Y |
Copy the focused path, branch, commit, or hunk; or the selected file diff |
r |
Toggle reviewed state for the selected file |
Space |
Stage/unstage the selected file or hunk in diff mode |
d |
Discard unstaged file/folder/hunk changes after confirmation in diff mode |
e |
Open the selected file in $EDITOR near its first changed line |
| Custom command keys | Run configured shell commands from the Git root |
q / Ctrl-c |
Quit |
Mouse hover changes focus. Click files, folders, branches, commits, and hunks to select or expand them; use the wheel to move or scroll the pointed pane. Drag visible text to copy it.
Command output and Ask AI panes use the same scroll keys; close them with Esc
or q. Ask AI answers can be copied with y.
chunk reads ${XDG_CONFIG_HOME:-$HOME/.config}/chunk/config.toml when it
exists.
theme = "github-dark"
harness = "codex"
opencode_model = "opencode/claude-fable-5"
opencode_variant = "xhigh"
claude_model = "fable"
claude_effort = "xhigh"
codex_model = "gpt-5.6-sol"
codex_effort = "high"
[keybinds]
quit = "Q"
discard = "D"
[[commands]]
key = "C"
label = "commit and push"
command = "git add . && com && git push"Supported themes are gruvbox (default) and github-dark.
Supported AI harnesses are opencode (default), claude-code, and codex.
Press F2 to configure and persist separate model/effort profiles for each:
- OpenCode uses
provider/modelnames and calls effort a modelvariant. Presets include current Claude 5 and GPT-5.6 models; custom config values are also accepted because available models and variants are provider-specific. - Claude Code presets use its rolling
fable,best,opus,sonnet, andhaikualiases. Its effort names arelow,medium,high,xhigh, andmax. - Codex presets are
gpt-5.6-sol,gpt-5.6-terra, andgpt-5.6-luna. Its picker useslow,medium,high,xhigh,max, and, where supported,ultra.
Leaving a model or effort unset inherits that harness's own default.
Keybind values must be single characters; use a literal space for Space.
Unknown actions, invalid keys, conflicting keys, and duplicate custom command
keys are rejected at startup. Remapping a built-in frees its default key for a
custom command.
Custom commands run from the Git root through the user shell. After they finish,
chunk shows stdout, stderr, and exit status, then reloads the review source.
cargo fmt --check
cargo test
cargo clippy --all-targets -- -D warnings