gk ai compose read
Show the patch bodies of collected hunks (no AI)
Synopsis
Show the patch bodies of hunks listed by “gk ai compose collect”, so you can understand changes you did not write before authoring a plan. Read-only; no AI.
Select hunks with exactly one of –hunks (indices) or –file (paths). Output is capped at –max-bytes (default 50000, max 200000); omitted hunks are listed in omitted_indices (–json) so you can read them in another call. The first selected hunk is always returned.
Fails with details.reason “stale_collection” if the changes were edited since collect; run collect again.
–json returns {hunks[{index,file,header,content,binary}], truncated, omitted_indices}.
gk ai compose read [flags]
Examples
gk ai compose read --based-on <token> --hunks 0,1 --workdir /path/to/repo
gk ai compose read --based-on <token> --file src/main.go --json --workdir /path/to/repo
Options
--based-on string Token printed by collect, verbatim (required)
--file strings File path to read all hunks of, as listed by collect (repeatable); use this or --hunks
-h, --help help for read
--hunks ints Hunk indices to read, as listed by collect (repeatable or comma-separated); use this or --file
--max-bytes int Maximum patch bytes to return (max 200000); omitted hunks are listed so you can read them in another call (default 50000)
Options inherited from parent commands
--json Emit machine-readable JSON on stdout (GK_OUTPUT=json sets it session-wide)
--no-telemetry Disable telemetry (OTel spans, Sentry) for this invocation
--session string (Optional) Isolate auth and cache under a named session
--workdir string Path to the git repository to operate on (default: current directory)
SEE ALSO
- gk ai compose - Plan and create clean, atomic commits from your working tree changes using AI