Expand description
gh as a program, for the callers the gh shell function never reaches.
An agent’s gh is a bash function (agentmux_common::github_broker_shim::GH_FUNCTION_BODY) that asks this
wrapper for the token of the repository the command is about. A function exists only in the bash that imported
it: timeout 60 gh pr create, xargs gh, env gh, make, a script with a #!/bin/sh line or a Python
subprocess all start the real gh binary, which has no login in a container and says “gh auth login”.
In a container’s image this wrapper is also installed as /usr/local/bin/gh (a symlink, ahead of the real gh
on PATH). Started under that name it does what the function does, with the function’s own text, and then runs
the real gh. No token is stored: each call asks for one, as the function does.
Constants§
- BROKER_
ENV 🔒 - Set by srv for an agent whose GitHub access goes through AgentMux.
- DONE_
ENV 🔒 - Set by the function when it runs
gh, so this program does not do the same work a second time. - REAL_
GH_ 🔒ENV - Where the function body finds the real
gh(it sayscommand ghin a shell, which would find this program).
Functions§
- command_
for 🔒 - The command that runs
ghwithargs: through the function’s steps when the agent’s GitHub access is brokered and the function has not run them already, else the realghas it is. - invoked_
as_ 🔒gh - Whether the program was started as
gh(orgh.exe). - launch 🔒
- real_
gh_ 🔒in - The first
ghonpaththat is notme(this program, which the symlink makes one of them). - run_
if_ 🔒invoked_ as_ gh - When this program was started as
gh: runghand give the exit code.Nonefor any other name. - script 🔒
- The shell text that is the function, calling the real
ghby the path inREAL_GH_ENV, then running it.