Put git-guardrails on exec form, and say what monitors do instead - #10
Merged
Conversation
git-guardrails was merged the same day the exec-form rule was written, and kept the shell form it was authored with. It is now the only hook not following its own CONTRIBUTING, so this moves it over: python3 in `command`, the script in `args`. The rule was also easy to read as applying to monitors, which cannot follow it. A monitors.json entry is name, command, description and an optional `when`; there is no `args`, and `command` is always handed to a shell — the upstream reference documents exactly the quoted form the monitors here use. So the bullet now says which of the two applies where, rather than leaving every monitor looking like it is out of line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Two leftovers from the merges of the last few days, both about the same rule.
git-guardrailswas the last hook on shell formIt was merged the same day the exec-form rule was written, so it kept the form it was authored with. Every other hook has since moved over, which left it as the only one in the repo not following its own CONTRIBUTING.
{ "type": "command", "command": "python3", "args": ["${CLAUDE_PLUGIN_ROOT}/scripts/git-guardrails.py"], "if": "Bash(git *)", "timeout": 10 }ifandtimeoutare untouched.Monitors cannot follow that rule, and the wording did not say so
The bullet reads as applying to everything a plugin here ships. A monitor cannot comply: a
monitors.jsonentry isname,command,descriptionand an optionalwhen. There is noargs, andcommandis always handed to a shell — the plugins reference documents exactly the quoted"${CLAUDE_PLUGIN_ROOT}"/scripts/...form both monitors here already use.So every monitor in the repo looked like it was out of line with a rule it had no way to satisfy. The bullet now splits into the hook case and the monitor case, and gives the monitor form its own example. No monitor changes.
Testing
./scripts/validate.shand./scripts/pr-policy.shpass; pr-policy reports one hook touched, as an edit.Exec form runs
python3 <script>rather than the path alone, so the hook was exercised that way:Still blocks, still exit 2.
Review notes
The hook change is behaviour-preserving in principle — same interpreter, same script, one less trip through
sh -c. Worth confirming with/hooksafter install that it still registers, since that is the one thing a local run cannot show.🤖 Generated with Claude Code