Expand description
The git-templates hook logic: registry, dispatchers and every check.
This is a library so that more than one binary can hold the same truth about
what a hook IS. amont (the commit path) executes the checks;
amont-fleet reports on how they are installed across the fleet. Before
the split there was no lib target at all, which is why cargo test --lib
failed outright.
This crate must never gain an external dependency. The hook binary
depends on it, so anything added here reaches every commit transitively —
and the entire Rust migration existed to remove exactly that kind of
requirement. ratatui and friends belong in amont-fleet.
Hooks are invoked through a thin sh shim at each hook path, which passes
the hooks directory it lives in:
amont --hooks-dir <dir> pre-commit [args…]Modules§
- agents_
md amont agents-md— a self-verifying pointer for coding agents.- check
- What a check IS, as one value rather than four tables.
- commit_
style - What
commit-msgenforces, and how it decorates — as fourgit configkeys. - config
- Reading configuration — and reading it the way git itself does.
- dispatch
- The two dispatchers.
- git
- Thin wrappers over the
gitcalls the hooks make. - hookfile
- The single owner of every “is this file ours, and may we touch it?” answer.
- hooks
- One module per ported hook. Phase 1 of docs/rust-migration.md moves them across one at a time; each keeps a shim at its original path so the existing .zsh suite exercises the Rust implementation unchanged.
- install
amont install— put the binary somewhere stable and wire up the shims.- json
- A minimal JSON emitter for
amont list --json. - manifest
amont.conf— checks a repository declares for itself.- pushed_
tree - Run a pre-push check against what is being PUSHED.
- pushrefs
- The refs git feeds
pre-pushon stdin, read ONCE and shared. - registry
- The hook registry — one table, one signature.
- setup
amont setup— choose whatcommit-msgenforces, once.- staged_
only - Make the checks see what is being committed.
- trust
- Whether this repository’s
amont.confmay run. - ui
- The signs the hooks print.
- vocabulary
- The project’s vocabulary: commit types and branch prefixes, in one place.
Structs§
- Check
Listing - One check, as reported by
amont list. - List
Options
Enums§
- Match
- How specifically a configured value names a check.
- Source
- Status
- The four states the text output’s glyphs already named. Not called
Outcome— that type means what a check concluded when it RAN; this means whether it would run at all, the same questionScope::matchesanswers.
Constants§
- TRIGGERS
git config --get-all hook.skip, or empty when unset/unavailable. The two triggers a check can be attached to, as they are spelled in config.
Functions§
- cherry_
pick_ in_ progress - True during a cherry-pick, where the zsh
pre-commitexited 0 immediately. Superseded internally bygit_states_in_progress; kept for whatever still calls it directly. See that function for why this asks git rather than deriving a path fromhooks_dir. - configured_
skips - gather_
checks - Every check that would be considered for
stage_filter(or both stages, whenNone), evaluated againstpaths. - git_
states_ in_ progress - Which git operations are part-way through, from the markers in
$GIT_DIR. - list_
checks amont list: what would run here, and why — as prose, or as--jsonfor a reader that wants to parse it.- names_
check - Does
pattern, as written inhook.skiporamont.severity.<pattern>, namecheck? - print_
commit_ style - What
commit-msgwill enforce here, and where each answer came from. - print_
json {"stage_filter": ..., "pushed": ..., "checks": [...]}— an object, not a bare array, so a field can be added later without changing the top-level shape.- print_
text - BYTE-IDENTICAL to what
list_checksprinted before it grew--json.listingsis already stage-grouped (gather_checksiterates stage by stage), so a heading prints exactly once per stage encountered, in the same order. - short_
name - A check’s id without its trigger —
pre-commit-clippy→clippy. - skip_
suppresses - Does
skip, as configured inhook.skip, suppresscheck?