Expand description
Git hook management — sync, execution, and validation.
Keeps .githooks/ in sync with the hooks section of sr.yaml and
provides the runtime for executing configured hook entries.
Functions§
- build_
hook_ json - Build a JSON context object for a git hook based on its name and positional args.
- needs_
sync - Check whether hooks need syncing (cheap hash comparison).
- run_
hook - Run all entries for a configured git hook.
- run_
shell - Run a shell command (
sh -c), optionally piping data to stdin and/or injecting environment variables. Returns an error if the command exits non-zero. - sync_
hooks - Sync
.githooks/with the hooks config. ReturnsOk(true)if changes were made. - validate_
commit_ msg - Validate a commit message file against the configured conventional commit pattern and types. Reads hook JSON from stdin to get the message_file path.