Expand description
What runs around an agent’s git commit and git push when its GitHub access goes through
AgentMux.
git-hook <name>: the two hooks srv installs for the agent (pre-push,prepare-commit-msg). Each runs the repository’s own hook of the same name first, so a repository’s husky or pre-commit setup keeps working, then does AgentMux’s part: the push scan (secret_scan.rs), theAgent:andCo-authored-by:trailers.git-env -- <git args>: asked by thegitshell function before a push or a command that makes commits. It refuses what would skip the hooks (git push --no-verify, a-c core.hooksPathof its own) and prints the environment a commit needs: the App’s bot as author and committer, and who the agent works for, for the trailer.
Enums§
- Plan
- What
git <args>needs from AgentMux.
Constants§
- AGENTMUX_
HOOKS_ DIR - What srv calls its hooks directory (
identity/github_hooks.rs). - COMMIT_
COMMANDS 🔒 - Subcommands that create commits under the agent’s name.
- GIT_
HOST_ ENV - The machine AgentMux runs on, for the commit trailer’s
agent@host(set by srv with the git setup). - OWNER_
ID_ 🔒ENV - Who the agent works for, for the commit trailer (set by
git-env, read by the hook). - OWNER_
LOGIN_ 🔒ENV
Functions§
- commit_
env - The environment a commit made for
grantedneeds: the App’s bot as author and committer when srv said who the bot is, and the owner for the trailer when it said who the agent works for. Each is on its own: a token without the bot’s user id still carries the owner’s credit. - configured_
hooks_ 🔒dir - The hooks directory the person or the repository configured:
core.hooksPathfrom the repository (husky), else the person’s global or system configuration. Onegit configcall lists every scope; the environment’s own value (commandscope: AgentMux’s directory, set throughGIT_CONFIG_*) is not consulted, and an AgentMux directory found in a file is passed over. - forward_
to_ 🔒repo_ hook - Any other hook: the repository’s own, with git’s arguments and standard input as they came. The hooks directory stands in for the repository’s, so each hook the repository has must still run.
- git_
output 🔒 - hooks_
dir_ 🔒from - The winning
core.hooksPathingit config --show-scope --get-regexpoutput (<scope>\t<key> <value>per line, the lowest-precedence scope first). - is_
executable 🔒 - Git skips a hook that isn’t executable; so does this.
- is_
no_ 🔒verify - Whether
argis--no-verify, or an abbreviation git accepts for it (--no-verif,--no-v: long options may be shortened while they stay unambiguous). - plan_
for - What
git <args>is, and whether it may run.Erris what to tell the agent. - pre_
push 🔒 pre-push <remote> <url>, the refs on stdin.- prepare_
commit_ 🔒msg prepare-commit-msg <file> [source] [sha].- push_
diff 🔒 - The diff of what pushing
localoverremote_shaadds,-U0;Nonewhen git can’t produce it. - repo_
own_ 🔒hook - The repository’s own hook
name, if it has one: from the configured hooks directory, else.git/hooks. - run_
git_ env git-env -- <git args>: refuse, or printKEY=VALUElines for the shell function to run git with.- run_
git_ hook git-hook <name> <git's arguments>.- run_
script 🔒 - trailers
- The trailers a commit of an agent carries: who wrote it, and whose agent that is.