Skip to main content

Crate amont_runtime

Crate amont_runtime 

Source
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-msg enforces, and how it decorates — as four git config keys.
config
Reading configuration — and reading it the way git itself does.
dispatch
The two dispatchers.
git
Thin wrappers over the git calls 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-push on stdin, read ONCE and shared.
registry
The hook registry — one table, one signature.
setup
amont setup — choose what commit-msg enforces, once.
staged_only
Make the checks see what is being committed.
trust
Whether this repository’s amont.conf may run.
ui
The signs the hooks print.
vocabulary
The project’s vocabulary: commit types and branch prefixes, in one place.

Structs§

CheckListing
One check, as reported by amont list.
ListOptions

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 question Scope::matches answers.

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-commit exited 0 immediately. Superseded internally by git_states_in_progress; kept for whatever still calls it directly. See that function for why this asks git rather than deriving a path from hooks_dir.
configured_skips
gather_checks
Every check that would be considered for stage_filter (or both stages, when None), evaluated against paths.
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 --json for a reader that wants to parse it.
names_check
Does pattern, as written in hook.skip or amont.severity.<pattern>, name check?
print_commit_style
What commit-msg will 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_checks printed before it grew --json. listings is already stage-grouped (gather_checks iterates 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-clippyclippy.
skip_suppresses
Does skip, as configured in hook.skip, suppress check?