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, unified
--cursor-line <style>current-line marker: row, number, off
--theme <theme>named theme override
--agent-context <path>JSON sidecar with agent rationale
--pageruse pager-style chrome
--experimentalenable experimental features (currently STML agent-note markup)
--fastexperimentally offload eligible syntax highlighting
--line-numbersshow line numbers
--no-line-numbershide line numbers
-x, --tab-width <columns>tab stop width: 1-16 Default: 4.
--file-gap <rows>file separator rows, including the ─ rule: 0-8 Default: 1.
--hunk-gap <rows>blank rows before each later hunk: 0-8 Default: 0.
--wrapwrap long diff lines
--no-wraptruncate long diff lines to one row
--hunk-headersshow hunk metadata rows
--no-hunk-headershide hunk metadata rows
--sidebarshow files pane
--no-sidebarhide files pane
--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 <from> <to> [-- <pathspec...>]
hunk diff --staged [-- <pathspec...>]
hunk diff --files <left> <right>

Two positional arguments always name revision endpoints, even when matching files exist on disk.

Use --files <left> <right> for concrete-file comparison; this replaces the former filesystem-existence disambiguation.

OptionDescription
--files <paths...>compare exactly two concrete files: --files <left> <right>
--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 a bundled Hunk skill path

Terminal window
hunk skill path [name]

install a shared extension from a git repository

Terminal window
hunk extension install <owner>/<repo>[@ref]
hunk extension install git:<host>/<path>[@ref]
hunk extension install <git-url or local path>[@ref]

Aliases: hunk ext install.

OptionDescription
--yesskip the confirmation prompt (required without a TTY)

list extensions installed with hunk extension install

Terminal window
hunk extension list

Aliases: hunk ext list.

re-clone managed extension installs from their recorded sources

Terminal window
hunk extension update [name]

Aliases: hunk ext update.

remove one managed extension install

Terminal window
hunk extension remove <name>

Aliases: hunk ext remove.

update Hunk with the package manager that installed it

Terminal window
hunk update [version]
hunk update --check
hunk update --method <npm|brew|curl>
OptionDescription
--method <method>install method instead of the detected one: npm, brew, curl
--checkreport the installed and available versions without installing

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.

report the running session daemon's build, uptime, and attached windows

Terminal window
hunk daemon status [--json]

After a Hunk upgrade, a daemon from the previous build keeps running while any window holds it open, and windows or hunk session commands from the new build cannot attach to it. status shows which build the daemon is, how it compares to this CLI, and which windows are attached; attached windows are marked (older build) when they could not reconnect to a daemon started from this CLI.

A daemon from a Hunk release before this command cannot report its build; status then shows what its launch metadata recorded.

OptionDescription
--jsonprint the status as JSON

stop the running session daemon and start one from this Hunk build

Terminal window
hunk daemon restart [--yes] [--json]

Prints the same summary as status, asks for confirmation, stops the daemon, and starts a replacement from this CLI's binary. Windows from this build that could not attach register with the replacement on their own; windows from the old build are disconnected and must be relaunched, which loses their in-window notes. The daemon is never replaced automatically.

A daemon from a Hunk release before this command cannot be asked to stop; restart then asks separately before sending SIGTERM to the pid its launch metadata recorded.

OptionDescription
--yesskip the confirmation prompts (required when stdin is not a terminal)
--jsonprint the result as JSON

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>) --comment <id> [--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
--comment <id>jump to the live comment with this id
--next-commentjump to the next annotated hunk
--prev-commentjump to the previous annotated hunk
--jsonemit structured JSON

Positionals: [sessionId].

Constraints: for --file navigation, 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 . --comment comment-1
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>) (--reply-to <note-id> | --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
--reply-to <note-id>reply to an existing note at its anchor
--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].

Examples:

Terminal window
hunk session comment add --repo . --file README.md --new-line 103 --summary "Tighten this wording"
hunk session comment add --repo . --reply-to user:123 --summary "Addressed in the latest revision"

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"
},
{
"replyTo": "user:123",
"summary": "Addressed in the latest revision"
}
]
}
Each item is either a reply with `replyTo`, or a root with `filePath` and one target.

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].

paint one attention mark inside a diff line

Terminal window
hunk session highlight add (<session-id> | --repo <path>) --file <path> (--old-line <n> | --new-line <n>) --start <n> --end <n> [--tone <tone>] [--focus] [--json]
OptionDescription
--file <path>diff file path as shown by Hunk Required.
--start <n>0-based inclusive start offset into the line's text (UTF-16 code units) Required.
--end <n>exclusive end offset; must be greater than --start 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
--tone <tone>mark tone: match, current, info, warning, error, dim (default match)
--focusadd the mark and land the viewport on its line
--jsonemit structured JSON

Positionals: [sessionId].

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

Examples:

Terminal window
hunk session highlight add --repo . --file src/App.tsx --new-line 42 --start 6 --end 19
hunk session highlight add --repo . --file src/App.tsx --new-line 42 --start 6 --end 19 --tone warning --focus

clear agent attention marks

Terminal window
hunk session highlight clear (<session-id> | --repo <path>) [--file <path>] [--json]
OptionDescription
--repo <path>target the live session whose repo root matches this path
--file <path>clear only one diff file's marks
--jsonemit structured JSON

Positionals: [sessionId].

Examples:

Terminal window
hunk session highlight clear --repo .