committing-to-git
Committing to Git
Parse JSON status, phase, terminalDisposition, and exit class; keep transaction opaque; show displayText verbatim. Stderr is not the result.
Treat the user's hint as a hypothesis. Use policy, task evidence, and Git facts to correct type and scope, sharpen the outcome, and add useful rationale or user-experience consequences. Do not ask for wording when evidence can improve it.
For a known-context transport-safe subject, the route is workflow prepare -> exact approval and commit authorization -> workflow commit, with no artifact access between helper calls. Drafting authorizes neither staging nor committing; pushing needs separate authorization.
Derive exact scope from task lineage and Git state, never a semantic hint used as a glob, pathspec, prefix, or fuzzy selector. Ask only when two materially different scopes remain plausible. Never autocorrect unmatched selectors.
Prepare
Git 2.45+ lets the helper preflight --no-lazy-fetch and enforce GIT_NO_LAZY_FETCH=1. For a declared read-only .git, request narrow metadata capability before actual preparation or commit. Never delete a live index lock.
| Intent | Mode | Scope |
|---|---|---|
| Propose without changing the real index | draft |
staged, full, or paths |
| Stage for an authorized workflow | actual |
staged, full, or paths |