Expand description
Post-commit auto-push of a landed commit: the push argv, the surfaced output and the failure reporting.
What:
Post-commit auto-push of a landed commit: which push runs, what its output shows,
and how a coordination failure is reported without failing the commit.
Why:
Every commit in this repository is backed up (AGENTS.md rule APG),
and the incumbent’s src/auto-push.ts decides the push argv from the upstream state,
prints only GitHub remote: lines on success and the full output on failure,
and keeps the commit’s exit status when the push fails.
The landed commit is an input, so the integrator can call this after any landing.
In TS you’d write (pseudocode):
await autoPush({ gitPath, cwd, landedOid });Structs§
- Auto
Push Result - What:
The result of one auto-push attempt.
Why:
shownis what the terminal received, so tests compare the surfaced text directly.
Enums§
- Auto
Push Outcome - What:
Which branch the auto-push took.
Why:
Skippedcovers both “nowhere to back up to” and “detached HEAD”; both exit 0 silently or with a note.
Constants§
- DETACHED_
HEAD_ NOTE - Note printed when HEAD is detached: pushing
HEADneeds a branch. - PUSH_
FAILED_ NOTE - Note printed after every failed push, owned or joined: the commit stays local.
Functions§
- auto_
push - What:
Back up a landed commit by pushing its branch, single-flight per branch.
Why:
The commit has happened by the time this runs and Git ignores a post-commit hook’s status,
so a failed push or a failed coordination is printed and returned as
Failed, and never fails the commit. Failures before the push decision (an unreadable repository, a Git that cannot start) are returned as errors. - filter_
push_ output - What:
Select the output a push shows: only
remote:lines after a clean push, everything after a failure. Why: A rejection, a hook refusal or an offline error stays diagnosable only when the full output shows.