gk ai compose collect
Index changed hunks for an agent-authored commit plan (no AI)
Synopsis
Collect the working-tree changes as an index of hunks so you can author the commit plan yourself. Read-only: nothing in the repository is modified, and no AI model is called.
Step 1 of collect -> read -> commit. The output has:
based_on A token bound to these exact changes. Pass it verbatim to read and commit with –based-on. files[] Changed files with their hunks: index, header, +/- counts. instructions Guidance for authoring the plan.
Use –staged-only, –no-untracked, –include and –exclude to narrow the collection. If you did not write these changes yourself, run “gk ai compose read” for the hunks you need before authoring. Then run “gk ai compose commit”.
To have AI plan the commits instead, use “gk ai compose plan” or “gk ai compose apply”.
gk ai compose collect [flags]
Examples
gk ai compose collect --json --workdir /path/to/repo
gk ai compose collect --staged-only --workdir /path/to/repo
gk ai compose collect --include 'src/**' --exclude '**/*_test.go' --workdir /path/to/repo
Options
--exclude strings Glob of files to skip, matched against the full path (repeatable). Same syntax as --include.
-h, --help help for collect
--include strings Glob of files to collect, matched against the full path (repeatable). Supports * (single path segment), ** (any number of segments, e.g. src/**/*.ts), and ? (single char). Brace {a,b} and bracket [abc] groups are not supported.
--no-untracked Exclude untracked files
--staged-only Only collect staged changes
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