Expand description
The hook registry — one table, one signature.
Before this, dispatch was a 20-arm match in main.rs and handlers had four
different signatures (run(&args), run(&hook, &args), argo_lint(&args),
…). Two costs, one of them real:
- adding a hook meant touching a match arm, a module, and remembering which signature that one used;
- the hook NAME was written twice — in the arm and as the shim’s filename — with nothing checking they agree. A shim the binary does not recognise exits 2 and blocks the commit; a handler with no shim is dead code. The consistency test below turns that pairing into something enforced.
Structs§
- Ctx
- Everything a hook is given. One shape for all of them, so a handler that needs the invoked name (ban-terms excludes its own source by it) or the hooks directory (the dispatchers glob it) does not need its own signature.
- Overrides
- Every severity override visible here, resolved the way
--getresolves it.
Enums§
- Source
- Where an override came from — machine config or the repository’s
committed policy.
amont listreports it; nothing on the commit path consults it.
Constants§
- CHECKS
- ENTRYPOINTS
- name → handler. The single place a hook is registered.
The six hook names git itself invokes. Everything else is a
Check.
Functions§
- all_
stage_ checks - Every check for one stage — built-ins first, then whatever this repository
declares in
amont.conf. - effective_
key - Which configured KEY applies to
checkhere, if any. - effective_
override - The override git would actually apply for
check, orNoneif there is none (or the value is not one this understands). - lookup
- one_
named - One check by name, whichever kind it is. Built-ins are searched first, which
costs nothing because
manifest::parserefuses a name a built-in already holds — the two guards together mean neither kind can shadow the other. - push_
twin_ scope - The scope of the built-in pre-push gate that a commit-time declaration
named
shortstands in for: the gate of that short name (cargo-test), or, for a script the npm push gate runs (typecheck,test), that gate’s.Nonewhen no built-in gate is its twin. A declared pre-push twin is found by the manifest itself (manifest::attach_twin_scopes). Returns the gate’s id with its scope, so a commit can say which gate reads the files it tests. - severity_
key - The config key a severity override lives under.
- severity_
of - A check’s severity, after any per-repository override.
- stage_
checks - Built-in checks for one stage, in declared order.