Pluginize all 12 standalone hooks and retire hook-scripts/ - #43
Merged
Conversation
Every hook now installs as a one-command plugin. Each of the 12 standalone scripts moved into plugins/<name>/ with a plugin.json, hooks/hooks.json registration, its own README, and its full test suite. Scripts are logic-identical; the only functional addition is a HOOK_SAFETY_LEVEL env override for the hooks that had a hardcoded SAFETY_LEVEL constant, since plugin updates overwrite edited files. Marketplace grows from 7 to 19 entries (claude plugin validate passes). hook-scripts/ is deleted: the test-discovery guard moved to tests/, event-logger.py to utils/, and package.json, bench/run.mjs, README, CONTRIBUTING, the OWASP mapping, and the site catalog were rewired to the new layout. Tests: 1544 pass, 0 fail (was 1499; the new cases cover the env overrides). Generated with Claude Code
The move into plugins/ dropped the 755 mode the script had in hook-scripts/; restore it so the diff carries no mode change. Generated with Claude Code
A settings.json entry pointing into a clone's hook-scripts/ dies silently after this merge (a failing hook command is a non-blocking error, so the guard just stops enforcing), and a manual copy plus the plugin runs the hook twice. Say both out loud with the fix for each.
This was referenced Aug 18, 2026
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.
Summary
hook-scripts/into installable plugins, growing the marketplace from 7 to 19 entries; every hook now installs with/plugin install <name>@claude-code-hooksplugins/<name>/as git renames with logic untouched; the one functional addition is aHOOK_SAFETY_LEVELenv override on the six guards that had a hardcodedSAFETY_LEVELconstant (block-dangerous-commands, case-insensitive-guard, config-guard, git-safety, protect-secrets, protect-tests), since plugin updates overwrite edited fileshook-scripts/and rewires everything that referenced it:package.jsontest glob,bench/run.mjspaths, README, CONTRIBUTING, the OWASP mapping, and the site catalogclaude plugin validatepassesDetails
New plugins. Each of the 12 gets
.claude-plugin/plugin.json(v1.0.0),hooks/hooks.json, its script, a README documenting real behavior and every env var, and its full test suite undertests/. Registrations follow each script's own header:instructions-auditregisters all three arms (InstructionsLoaded + UserPromptSubmit + PreToolUse) in one install, replacing the three manual registrations the root README used to prescribe;session-loggerregisters SessionStart + async PostToolUse + SessionEnd; the PreToolUse guards stay synchronous so a deny lands before the tool runs.Script changes. Confined to the same two things per script (plus one analog: session-logger's
BASH_TRUNCATEconstant became theCC_SESSION_BASH_TRUNCATEenv override for the same frozen-file reason): the header's setup section now describes plugin install (with the classic copy path kept as an alternative), and theSAFETY_LEVELconstant became env-overridable with whitelist validation falling back to the original default. Patterns, messages, exit codes, and log paths are byte-identical; an adversarial per-plugin review diffed each against its original to confirm.Repo rewiring.
hook-scripts/tests/meta/test-discovery.test.jsmoves totests/with its shape regexes updated for the new layout;event-logger.pymoves toutils/unchanged;bench/run.mjspoints its 7 script paths at the plugin locations;.claude-plugin/marketplace.jsongains 12 entries in the existing style.Docs and site. README is rewritten plugin-first: the per-event hook tables now link to plugin dirs, the install table lists all 19 plugins, the Safety Levels section documents the env override, and the tests badge reflects the real 1544 total. CONTRIBUTING describes the plugin-shaped contribution flow. The OWASP mapping links and the GitHub Pages catalog point at the new paths.
Migration. The README gains a "Migrating from hook-scripts/" section covering the two upgrade hazards: a settings.json entry pointing into a clone's hook-scripts/ dies silently after this merge (a failing hook command is a non-blocking error), and a manual copy plus the plugin runs a hook twice.
Test plan
npm test: 1544 pass, 0 fail across Node 18/20/22 in CIclaude plugin validate .: marketplace manifest passesgrep -rn "hook-scripts" . --exclude-dir=.git: zero hits/plugin marketplace add karanb192/claude-code-hooksthen/plugin install instructions-audit@claude-code-hooks: all three arms register from one installGenerated with Claude Code