Skip to main content

Module auto_push

Module auto_push 

Source
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§

AutoPushResult
What: The result of one auto-push attempt. Why: shown is what the terminal received, so tests compare the surfaced text directly.

Enums§

AutoPushOutcome
What: Which branch the auto-push took. Why: Skipped covers 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 HEAD needs 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.