// ZSH-GIT-ACP — ENGINEERING REPORT

git add + commit + push as a single ZLE widget · Ctrl-S no-check · Ctrl-F Ctrl-S diff-confirm · 159 git aliases · setopt noflowcontrol to unlock Ctrl-S

>_EXECUTIVE SUMMARY

zsh-git-acp compresses the most-frequent inner loop of an active engineer — git pull && git add . && git commit -m "..." && git push — into a single ZLE keystroke. The current $BUFFER becomes the commit message; Ctrl-S dispatches zsh-gacp-NoCheck (fire-and-forget), Ctrl-F Ctrl-S dispatches zsh-gacp-CheckDiff (side-by-side diff piped to less, single-key confirmation). To free Ctrl-S from the terminal-driver flow-control trap, the plugin runs setopt noflowcontrol at load. Both widgets respect $ZSH_GACP_BLACKLISTED_DIRECTORIES — the user's /etc, ~/.ssh, or any other “do not auto-commit here” path opts out. Source: 510 zsh lines across a 268-line plugin entry + 6 autoloaded helper functions. The plugin also ships 159 git aliases — the curated “everything you actually type” shorthand set. Pinned by 35 @test blocks across 6 zunit files.

510
Zsh Lines
159
Git Aliases
35
@test Blocks (zunit)
6
Test Files
2
ZLE Widgets
6
Autoload Helpers
6
Bindkeys (2 widgets × 3 keymaps)
1
setopt unlock (noflowcontrol)

~ARCHITECTURE

FileLinesRole
zsh-git-acp.plugin.zsh 268 Plugin entry. Declares the 159 git aliases (branch / checkout / diff / log / merge / rebase / push / pull / stash / submodule / worktree / cherry-pick / reset / show / status / tag families — with origin/upstream-aware variants like gbuom/gbuod/gbuum/gbuud, gmom/gmod/gmum/gmud, gdom/gdod/gdum/gdud). Provides fall-back stub definitions for zpwrLoggErr / zpwrCommandExists / zpwrIsGitDir / zpwrLoggNotGit when zpwr is not loaded. Runs the Zsh Plugin Standard 0= header. Prepends ${0:h}/autoload to fpath, autoloads all 6 helper functions, registers the two ZLE widgets, runs setopt noflowcontrol, binds Ctrl-S and Ctrl-F Ctrl-S in all three keymaps.
autoload/zsh-gacp-CommitAndPush 45 The shared backend. Validates commit message, validates git-dir, validates blacklist, validates a non-empty staged diff (nothing to commit guard), enumerates remotes, performs git add . && git commit -m "..." && git push across each remote. If no remote is configured, the pull and push steps are skipped — useful for local-only repos.
autoload/zsh-gacp-CheckDiff 80 Diff-confirm widget. Validates blacklist + git-dir + non-empty buffer, then pipes git diff --staged through less -R, asks for a single-key Y/N confirmation via zle -R + read -k 1, dispatches zsh-gacp-CommitAndPush on Y. Largest single autoload file because it carries the inline-confirmation UX.
autoload/zsh-gacp-NoCheck 52 Fire-and-forget widget. Validates blacklist + git-dir + non-empty buffer, dispatches zsh-gacp-CommitAndPush with $BUFFER as the message. No confirmation prompt — one keystroke to ship.
autoload/zsh-gacp-mainBranch 25 Detect the main branch on the named remote (default origin). Tries master first, then main — returns the first one that exists as refs/remotes/$remote/$branch. Powers the gbuom / gmom / gdom / gcm alias family.
autoload/zsh-gacp-devBranch 26 Detect the dev branch on the named remote. Same shape as mainBranch but probes dev / develop / development. Powers gbuod / gmod / gdod / gcd.
autoload/zsh-gacp-CommitCount 14 Returns the count of commits on the current branch — used by the diff-confirm widget to render a status line.
Total source 510 1 entry + 6 autoload helpers · pure zsh

#TEST COVERAGE

FileTestsPins
t-aliases.zsh13The 159-alias surface enumerated against expected git ... bodies (sampling-based since 159 individual @test blocks would be wasteful); branch-aware aliases evaluate their $(zsh-gacp-mainBranch) / $(zsh-gacp-devBranch) sub-shell calls correctly.
t-syntax.zsh2zsh -n over plugin entry + autoload tree.
t-contract.zsh3Entrypoint stem matches dir basename; entrypoint parses; every _* completion file in the repo starts with #compdef.
t-contract2.zsh7fpath augmentation uses ${0:h}/autoload (portable across zinit / OMZ / antibody / antigen / bare-source); autoload loop uses (.:t); widget names match autoload file names; bindkey lines are present for all three keymaps.
t-contract3.zsh5Zinit install path; setopt noflowcontrol runs at source-time; the two widgets register exactly once; double-source is idempotent.
t-contract4.zsh5OMZ install path; zpwrLogg* stub definitions only register when zpwr is absent (no clobber); $ZSH_GACP_BLACKLISTED_DIRECTORIES respected when empty.
Total356 zunit files · alias-surface + widget-contract + install-contract

/INTEGRATION

Bindkey across three keymaps

Both widgets are bound in viins + vicmd + emacs. Vim-emulation users hit Ctrl-S from insert OR command mode; emacs-mode users hit it directly. Ctrl-F Ctrl-S is the safer two-key escape for diff-confirm.

setopt noflowcontrol

By default the terminal driver eats Ctrl-S as XOFF and Ctrl-Q as XON — the keystroke never reaches ZLE. The plugin runs setopt noflowcontrol at source time to release the binding, then ZLE sees the raw Ctrl-S. Side effect: Ctrl-Q is also freed and available for user binding.

Buffer as commit message

The pre-press $BUFFER — whatever the user has typed at the prompt — becomes the literal commit message via git commit -m "$BUFFER". No editor pop-up, no $EDITOR dance. Type the message, hit Ctrl-S, ship.

Blacklist guard

ZSH_GACP_BLACKLISTED_DIRECTORIES=(/etc ~/.ssh /var/log/repo) opts out per directory. Both widgets check $(pwd -P) against the array before any git side effects. Inverse of opt-in: blacklist is empty by default; users add the few paths they want to protect, not the many they want to ship from.

Multi-remote push

zsh-gacp-CommitAndPush enumerates git remote and pushes to each — works in setups with both origin and upstream wired up. No-remote setups skip push entirely, so the widget is still safe for local-only experiments.

Branch detection is dynamic

The gbuom / gcm / gmom / gdom aliases call $(zsh-gacp-mainBranch) at expansion time — the result is whatever main-or-master ref the current repo has on its remote. Same plugin works against a legacy master-named repo AND against a freshly-renamed main repo with zero re-config.


!DESIGN DECISIONS

Two widgets, not a flag

NoCheck and CheckDiff are separate widgets, separate bindings, separate code paths. The user picks the safety level at keystroke time rather than at ~/.zshrc time. The 2-character difference between Ctrl-S and Ctrl-F Ctrl-S is the entire UX of "I trust this" vs "show me first."

noflowcontrol as side effect, not opt-in

Many plugins document the setopt noflowcontrol requirement and leave it to the user. zsh-git-acp just runs it at source time — the binding doesn't work without it, so making it opt-in would guarantee broken installs. The cost is one global side effect; the gain is "it just works after zinit load."

Stub fallbacks for zpwr helpers

The plugin defines zpwrLoggErr, zpwrCommandExists, zpwrIsGitDir, zpwrLoggNotGit ONLY when they don't already exist ((( $+functions[...] )) guard). Loaded under zpwr, the real implementations win; loaded standalone, the stubs keep the widgets working.

Single-key confirmation, not Y/N

The diff-confirm widget uses read -k 1 — one keystroke commits or aborts. No y+Enter dance. Aligns with the “every keystroke costs” ethos of the rest of the plugin.

159 aliases as a curated set, not auto-generated

Each alias is hand-chosen for the “I type this multiple times an hour” threshold. Branch-aware variants (gbuom, gmom, gdom) handle the four combos of {origin, upstream} × {main, dev} explicitly — no per-alias config required.

Helper-as-file

Each of the 6 helper functions is its own file under autoload/, lazy-loaded via autoload -Uz "${0:h}/autoload/"*(.:t). Cold-startup cost is the 268-line entry parse only — the widgets and helpers are parsed on first call.


@FOOTPRINT