fix(agents): harden GitHub mutation guards

Merged
SH
3mo ago
+813-50

Summary

  • harden protected-branch push detection across explicit, implicit, force, refspec, default-branch, and Git-alias forms
  • block repository control-plane mutations through gh, GraphQL, curl, HTTPie, xh, and wget while preserving ordinary PR, issue, comment, and read operations
  • document shared Codex, Claude, Cursor, Copilot, and Grok hook contracts and structurally assert all five clients remain wired

Validation

  • shellspec spec/block_git_push_spec.sh spec/block_gh_settings_spec.sh spec/agent_github_hook_wiring_spec.sh (83 examples)
  • shellcheck on all changed shell scripts and specs
  • make shell-test-dev (1,805 ShellSpec examples and 422 Fish tests)
  • make shell-check-dev
  • make nix-format-check
  • git diff --check

Security boundary

These local hooks are bypassable defense-in-depth guardrails. Restricted GitHub credentials and server-side rulesets remain authoritative.