Repository navigation
feat(guard): find the commands that the guard watches - #32
Merged
Merged
Conversation
internal/guard reads a bash call with internal/bash and gives each command that the guard watches, with its kind and name: outward (git's commands that send to another host, gh's commands but its reads, gh api, ssh, scp, sftp, acli, jira), control (tmux, osascript), another agent's CLI, baton with its command, and a program that only the run decides. It fails closed on a git command or option, or gh's first two words, that only the run decides. Decision 51 and fact 34 record the rules and git's and gh's facts. The guard now comes in three steps: guard, guard-http (curl, wget, gh api's reads) and guard-hook.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
internal/guard:guard.Commands(script)reads a bash call withinternal/bash(#31) and gives each command that the guard watches, with its kind and a name for a hook's reason (git push,gh pr merge,… push):push,send-email,send-pack,http-push,imap-send), past git's options and the values of those that take one;git-pushand the like;gh's commands but those that only read (so an alias counts too), andgh api;ssh,scp,sftp,acli,jira.tmux,osascript.aider,claude,codex,copilot,cursor-agent,gemini,opencode.batonwith its command, so each pane's hook can let its own commands through."$GIT" push,eval "$X",bash -c "$X").It fails closed on a git command or option, or gh's first two words, that only the run decides.
Nothing enforces it yet:
guard-hookwires it into the role panes'preToolUsehook.Split
The guard's rules came out at ~240 lines, so the step is now three, each near 150 lines:
guard(this PR): watched commands by program.guard-http: curl, wget andgh api, watched only when they send data. Until then,gh apicounts as a write and curl/wget aren't watched.guard-hook:baton hook guardand the plugin'spreToolUsehook.The docs' status table, decision 50's last sentence and the new decision 51 say so.
Docs
bash→ Done (feat(bash): read the commands that a bash script runs #31);guard→ In review (feat(guard): find the commands that the guard watches #32); new rowsguard-httpandguard-hook.git lfs push, tools it doesn't know (npm publish,docker push,rsyncto a host, cloud CLIs). Risk 2's second belt (belt) is for these.Checks
mise run check: green, total coverage 99.2%,internal/guard100%.guard.Commandsover 38 made-up role scripts in 0.3 s. The outward, control, agent, baton and dynamic cases were caught; reads (git status,gh pr view,gh pr checks,curlGET,go test, here-docs that mentiongit push) passed; an unterminated quote gave a parse error.