feat(git): refuse git push to main with a PreToolUse hook

An agent on main can push straight to it when the server does not protect the branch. The git
plugin now ships a Claude Code hook that refuses such a push before it runs. It fails open, does
nothing on other runtimes, and has an opt-out read only from the hook's own environment.

Closes: #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-12-04 21:18:09 +00:00
1 parent 55da336298
commit 77642183c2
8 files changed
+451 -6

No files matched your search

+2 -1
View File
@@ -1357,7 +1357,8 @@ every key stays an accurate record of what was approved.
It covers every plugin that ships executables, not one named package. The script scans
`plugins/*/` and treats a plugin as shipping executables when `plugins/<name>/.apm/hooks/` or
`plugins/<name>/bin/` exists — kyberforge ships both, delivery ships a guard hook. For each one it
`plugins/<name>/bin/` exists — kyberforge ships both, delivery ships a guard hook,
git ships a hook that refuses a push to `main`. For each one it
reads `name:` and `version:` from `plugins/<name>/apm.yml` and asserts root `apm.yml` carries the
`<identity>#<version>` key under `executables.allow`. The `name:` must equal the directory name, so
one that differs fails rather than being guessed at. Every failing package is