Expand description
Global git hooks that book a commit when the runner has no prompt hook.
When core.hooksPath is unset, install writes a stub for every
standard git hook and points the global config at ljos’s directory. The
stub calls ljos git-hook <name>, then runs the repository’s
.git/hooks/<name> or the previous path an older install recorded, with
the same arguments. post-rewrite copies stdin first, so ljos git-hook
and the chained hook both see the old and new shas.
When core.hooksPath already names a directory, install leaves that
setting alone and appends a delimited block to each hook there. The
block calls ljos git-hook <name>. A missing hook file is created
executable. Text that was already in the file is kept. Uninstall removes
only that block, and deletes a file that held nothing else.
post-commit and post-rewrite book the commit. Booking never fails
the hook. pre-commit and pre-push run the sitting gate under an
agent runner: a commit needs a live sitting, and a push onto a
protected branch also needs the sitting’s ticket to clear it. That
refusal fails the hook. pre-push also refuses a commit it would
send whose message has a by-trailer, a made-with line, or a
generated line, and it refuses when those commits cannot be read.
A Tests paragraph is not that line. The check runs with or without
a runner. pre-push copies stdin like post-rewrite.
pre-commit install follows core.hooksPath and would replace stubs
ljos owns. Install the framework into the repository, then let the stub
chain to it:
dir=$(git rev-parse --git-dir)
git config --local core.hooksPath "$dir/hooks"
pre-commit install
git config --local --unset core.hooksPathA commit is booked only when a seat resolves from LJOS_SEAT, then an
agy or opencode conversation id. A conversation id does not name a seat.
The process tree is not a seat.
The holder is SEAT@TAG, the same name ljos claim uses. Paths in
[git_hooks] skip of ljos.toml, plus /tmp, /var/tmp, /dev/shm,
the tracker, CLAIMDAG_DIR and the deedar store, are not booked.
An amend or a rebase moves the citation onto the new sha.
Constants§
- HOOKS_
ENV_ LINE - The
LJOS_GIT_HOOKSlineljos onboardwrites into a shell runner’s env file. It names the same directoryinstallwrites. - HOOKS_
FIX - The one command that installs the hooks doctor checks.
- HOOKS_
UNSET - The start of the doctor’s
git hooksstate whencore.hooksPathis unset. That row isinfo: a seat that has not onboarded books no commits, and nothing else is wrong.
Functions§
- doctor_
row - The doctor’s
git hooksrow. It passes whenljos git-hookruns from the directorycore.hooksPathnames: ljos’s own stubs, or a block in each hook of a directory the user already set. Thepre-commitandpre-pushthere must carry this build’s block, so that a refusal fails the hook; the other hooks only book. It does not ask to take that path over. An env file that setsLJOS_GIT_HOOKSto another directory fails the row. - doctor_
state doctor_rowfor a chosen hooks directory, the globalcore.hooksPath, and the config directory that holds env files.- env_
hooks_ drift - An env file under
config_dirthat setsLJOS_GIT_HOOKSto a directory other thanonboard_dir. The expressionHOOKS_ENV_LINEwrites is the same directory and is not a mismatch.Nonewhen every assignment agrees. - hooks_
state doctor_row’s verdict for the onboard hooks atoursand the globalcore.hooksPathgit reports.- install
- Install the hooks
ljos doctorchecks. - run
install,uninstall, orstatus.- run_
git_ commit - Book the commit that just landed. Always succeeds: the commit stands.
- run_
named - Run the ljos part of git hook
name. - status
- Where the hooks are, and what
core.hooksPathsays. - uninstall
- Remove ljos from the hooks git runs.