Skip to content

CLI reference

This reference is generated from the command metadata used by Hunk itself. Run hunk --help or hunk <command> --help to inspect the installed version.

OptionDescription
-h, --helpShow top-level or command-specific help.
-v, --versionPrint the installed Hunk version.
OptionDescription
--mode <mode>layout mode: auto, split, stack
--theme <theme>named theme override
--agent-context <path>JSON sidecar with agent rationale
--pageruse pager-style chrome and controls
--experimentalenable experimental features (currently STML agent-note markup)
--line-numbersshow line numbers
--no-line-numbershide line numbers
-x, --tab-width <columns>tab stop width: 1-16 Default: 4.
--wrapwrap long diff lines
--no-wraptruncate long diff lines to one row
--hunk-headersshow hunk metadata rows
--no-hunk-headershide hunk metadata rows
--agent-notesshow agent notes by default
--no-agent-noteshide agent notes by default
--transparent-bglet terminal background show through Hunk surfaces
--no-transparent-bgpaint Hunk surfaces with the active theme
--extension <path>load an extension entry file or directory (repeatable)
--no-extensionsdisable user extensions for this run

--experimental may also be placed before the review command, as in hunk --experimental diff.

review diffs or compare two concrete files

Terminal window
hunk diff [target] [-- <pathspec...>]
hunk diff --staged [-- <pathspec...>]
hunk diff <left> <right>
OptionDescription
--stagedshow staged changes instead of the working tree
--cachedalias for --staged
--exclude-untrackedexclude untracked files from working tree reviews
--no-exclude-untrackedinclude untracked files in working tree reviews Compatibility inverse; omitted from --help.

Also accepts --watch: auto-reload when the current diff input changes.

Also accepts every common review option.

review the last commit or a given ref

Terminal window
hunk show [target] [-- <pathspec...>]

Also accepts --watch: auto-reload when the current diff input changes.

Also accepts every common review option.

review a stash entry as a full Hunk changeset

Terminal window
hunk stash show [ref]

Also accepts --watch: auto-reload when the current diff input changes.

Also accepts every common review option.

review a patch file, or read a patch from stdin

Terminal window
hunk patch [file]

Also accepts --watch: auto-reload when the current diff input changes.

Also accepts every common review option.

general Git pager wrapper with diff detection

Terminal window
hunk pager

Also accepts every common review option.

review Git difftool file pairs

Terminal window
hunk difftool <left> <right> [path]

Also accepts --watch: auto-reload when the current diff input changes.

Also accepts every common review option.

preview experimental STML markup as terminal text

Terminal window
hunk markup render (<file> | -) [options]
OptionDescription
--width <n>layout width in columns Default: 56.
--color <mode>auto, always, or never Default: auto.
--theme <id>hunk theme used to resolve colors
--jsonemit structured JSON

print the experimental STML authoring guide

Terminal window
hunk markup guide

print the bundled Hunk review skill path

Terminal window
hunk skill path

run the local Hunk session daemon and websocket session broker

Terminal window
hunk daemon serve

Aliases: hunk mcp serve.

VariablePurpose
HUNK_MCP_HOSTBind host; defaults to loopback 127.0.0.1.
HUNK_MCP_PORTBind port; defaults to 47657.
HUNK_MCP_UNSAFE_ALLOW_REMOTESet to 1 to allow unsafe non-loopback binding.

Inspect and control live Hunk review sessions through the loopback daemon. Select a session by id or with --repo <path> where shown.

list live Hunk sessions

Terminal window
hunk session list [--json]
OptionDescription
--jsonemit structured JSON

show one live Hunk session

Terminal window
hunk session get (<session-id> | --repo <path>) [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--jsonemit structured JSON

Positionals: [sessionId].

show the selected file and hunk for one live Hunk session

Terminal window
hunk session context (<session-id> | --repo <path>) [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--jsonemit structured JSON

Positionals: [sessionId].

export the live review model for one Hunk session

Terminal window
hunk session review (<session-id> | --repo <path>) [--include-patch] [--include-notes] [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--include-patchinclude raw unified diff text for each file in review output
--include-notesinclude live review notes in review output
--jsonemit structured JSON

Positionals: [sessionId].

move a live Hunk session to one diff hunk

Terminal window
hunk session navigate (<session-id> | --repo <path>) --file <path> (--hunk <n> | --old-line <n> | --new-line <n>) [--json]
hunk session navigate (<session-id> | --repo <path>) (--next-comment | --prev-comment) [--json]
OptionDescription
--file <path>diff file path as shown by Hunk
--repo <path>target the live session whose repo root matches this path
--hunk <n>1-based hunk number within the file
--old-line <n>1-based line number on the old side
--new-line <n>1-based line number on the new side
--next-commentjump to the next annotated hunk
--prev-commentjump to the previous annotated hunk
--jsonemit structured JSON

Positionals: [sessionId].

Constraints: exactly one of --hunk <n>, --old-line <n>, --new-line <n>; at most one of --next-comment, --prev-comment.

Examples:

Terminal window
hunk session navigate --repo . --file src/App.tsx --hunk 2
hunk session navigate --repo . --file src/App.tsx --new-line 372
hunk session navigate --repo . --file src/App.tsx --old-line 355
hunk session navigate --repo . --next-comment
hunk session navigate --repo . --prev-comment

replace the contents of one live Hunk session

Terminal window
hunk session reload (<session-id> | --repo <path> | --session-path <path>) [--source <path>] [--json] -- diff [ref] [-- <pathspec...>]
hunk session reload (<session-id> | --repo <path> | --session-path <path>) [--source <path>] [--json] -- show [ref] [-- <pathspec...>]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--session-path <path>target a live session rooted at a different path
--source <path>load the diff from this directory instead of the session's own
--jsonemit structured JSON

Positionals: [sessionId].

Examples:

Terminal window
hunk session reload --repo . -- diff
hunk session reload --repo . -- diff main...feature -- src/ui
hunk session reload --repo . -- show HEAD~1
hunk session reload --repo . -- show HEAD~1 -- README.md
hunk session reload --repo /path/to/worktree -- diff
hunk session reload --session-path /path/to/live-window --source /path/to/other-checkout -- diff

attach one live inline review note

Terminal window
hunk session comment add (<session-id> | --repo <path>) --file <path> (--old-line <n> | --new-line <n>) --summary <text> [--rationale <text>] [--author <name>] [--markup <stml>] [--focus] [--json]
OptionDescription
--file <path>diff file path as shown by Hunk Required.
--summary <text>short review note Required.
--repo <path>target the live session whose repo root matches this path
--old-line <n>1-based line number on the old side
--new-line <n>1-based line number on the new side
--rationale <text>optional longer explanation
--markup <stml>experimental STML body (target session must opt in)
--author <name>optional author label
--focusadd the note and focus the viewport on it
--jsonemit structured JSON

Positionals: [sessionId].

Constraints: exactly one of --old-line <n>, --new-line <n>.

Examples:

Terminal window
hunk session comment add --repo . --file README.md --new-line 103 --summary "Tighten this wording"

apply many live inline review notes from stdin JSON

Terminal window
hunk session comment apply (<session-id> | --repo <path>) --stdin [--focus] [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--stdinread the comment batch from stdin as JSON
--focusapply the batch and focus the first note
--jsonemit structured JSON

Positionals: [sessionId].

Examples:

Terminal window
printf '%s\n' '{"comments":[{"filePath":"README.md","newLine":103,"summary":"Tighten this wording"}]}' | hunk session comment apply --repo . --stdin

Additional input contract:

Stdin JSON shape:
{
"comments": [
{
"filePath": "README.md",
"hunk": 2,
"summary": "Explain this hunk",
"rationale": "Optional detail",
"author": "Pi"
}
]
}

list live inline review notes

Terminal window
hunk session comment list (<session-id> | --repo <path>) [--file <path>] [--type <live|all|ai|agent|user>] [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--file <path>filter comments to one diff file
--type <type>filter to live, all, ai, agent, or user comments
--jsonemit structured JSON

Positionals: [sessionId].

remove one inline review note

Terminal window
hunk session comment rm (<session-id> | --repo <path>) <comment-id> [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--jsonemit structured JSON

Positionals: [targets...] — <session-id> <comment-id>, or <comment-id> with --repo.

clear inline review notes

Terminal window
hunk session comment clear (<session-id> | --repo <path>) [--file <path>] [--include-user|--all] --yes [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--file <path>clear only one diff file's comments
--include-useralso clear human notes created with the TUI c action
--allclear both live agent comments and human user notes
--yesconfirm destructive comment clearing
--jsonemit structured JSON

Positionals: [sessionId].