Expand description
The gh and git shell functions of an agent whose GitHub access goes through AgentMux Cloud.
srv puts them in the agent’s environment under the name bash imports exported functions from,
so they reach every bash the agent runs, whichever provider CLI started it. Both do their work
through agentmux-bashwrap (crates/bashwrap/src/github.rs, git_hooks.rs).
Constants§
- GH_
FUNCTION_ BODY gh, for an agent whose person connected GitHub through AgentMux Cloud (srv setsAGENTMUX_GITHUB_BROKERfor those): the command runs with the GitHub App’s token for the repository it is about, or with no token at all, never with one the environment happened to carry. What agh pr,gh issue,gh releaseorgh apicommand sends is scanned for credentials first (github-text-guard: a hit refuses the command, a stdin body reachesghas a file), andgh pr createandgh pr editcarry the owner tag in the PR’s body.gh auth statussays so, instead of “not logged into any GitHub hosts” (the bare command only: with flags such as--jsonit is gh’s own output a caller parses). A container’sgh pr merge,gh releaseandgh apifirst go throughgithub-container: srv does the merge for it, and the API writes its token cannot make are refused with what to do (crates/bashwrap/src/container_verbs.rs). The command word is read after a leading-R/--repo(gh -R o/r pr merge 7), for the container step, the text check and the owner tag alike. Without the variable it is plaingh. The realghit runs is told (AGENTMUX_GH_SHIM_DONE) that these steps are done: in a container’s imageghon PATH isagentmux-bashwraptoo (crates/bashwrap/src/gh_shim.rs, fortimeout gh,xargs gh, scripts), and it does the same steps, once, for a caller that did not come through this function.- GH_
FUNCTION_ NAME - The name bash gives an exported
ghfunction. - GIT_
FUNCTION_ BODY git, for the same agents: a push or a command that makes commits first asksagentmux-bashwrap git-env, which refuses what would skip the hooks (git push --no-verify) and names the App’s bot as the commit’s author. Any other git command is plaingit.- GIT_
FUNCTION_ NAME - The name bash gives an exported
gitfunction.