Harden hooks, add tests, and tighten agents#2
Merged
Conversation
Hook fixes (11 bugs, 36 regression fixtures, CI on Linux+macOS): - block-dangerous-commands: configurable protected branches via CLAUDE_PROTECTED_BRANCHES + init.defaultBranch; multi-statement SQL parsed per-statement; quoted rm -rf paths handled; chmod 0777/-R 777/a+rwx caught; /dev/null false-positive fixed; npm publish --dry-run allowed - protect-files: case-insensitive dotfile matching - New hooks/tests/ with run-all.sh runner honoring fixture env - New .github/workflows/hook-tests.yml Agents: confidence-gated reviews (>=8) with concrete failure scenarios, calibrated exclusion lists, and stack-aware conditional checks (Supabase/Stripe/JWT/RSC/etc). New "When to Invoke" matrix. Docs: README structure tree now lists all 9 hooks + tests/; hooks and agents READMEs rewritten; rules README adds database + error-handling sections; CONTRIBUTING requires fixtures for hook changes. setupdotclaude: stop editing the block-dangerous regex (now runtime- configurable); new Phase 3.8b adapts auto-test.sh; new Phase 3.8c customizes context-recovery.sh RULES per project; Phase 0 removes hooks/tests/ and stray CI file from user installs.
PoshanP
added a commit
that referenced
this pull request
May 5, 2026
Resolves 12 conflicts from main's PR #2 (hook hardening + tests + agent tightening) against this branch's marketplace + token-discipline work. Resolution rules: - agents/ (5 files), skills/setupdotclaude/SKILL.md, README.md, agents/README.md, hooks/README.md: kept ours. This branch's rewrites (operating principles, terse-by-default with verbose mode, Phase Init bootstrap, Phase 4 budget enforcement, marketplace-first README) are supersets of main's wording polishes. - hooks/protect-files.sh, hooks/block-dangerous-commands.sh: kept theirs (main's hardened logic) and re-applied em-dash strip to comments. - .gitignore: merged both additions (.devswarm-temp/ + the new hooks/*.html web-page-save patterns). - Auto-merged files (CONTRIBUTING.md, rules/README.md) had em-dashes reintroduced from main; re-stripped. New from main, untouched: - .github/workflows/hook-tests.yml (CI for hook tests) - hooks/tests/ (test fixtures + run-all.sh runner) Bundled template (plugins/setupdotclaude/template/) re-synced so the plugin install path picks up main's hardened hooks. Co-Authored-By: Claude Opus 4.7 (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.
Summary
block-dangerous-commands.shandprotect-files.shfixed; 36 fixtures underhooks/tests/with a plain-bash runner; CI on Linux + macOS (.github/workflows/hook-tests.yml).hooks/tests/; hooks/agents/rules READMEs rewritten to match what's actually on disk; CONTRIBUTING requires fixtures for any hook change.main|masterregex (no longer exists — hook readsgit config init.defaultBranchand honorsCLAUDE_PROTECTED_BRANCHES); new phases adaptauto-test.shrunner and customizecontext-recovery.shRULES per project; Phase 0 stripshooks/tests/and stray CI file from user installs.Notable hook bug fixes
2>/dev/nullno longer triggers the/dev/destructive-write rule (was blocking every stderr redirect).DELETE FROM a; SELECT ... WHERE xno longer bypasses the DELETE block via an unrelated laterWHERE— SQL is parsed per-statement.rm -rf "\$HOME/x"andrm -rf \$VARnow caught (quoted paths + unresolved expansions).chmod 0777,chmod -R 777,chmod a+rwxall blocked.git push upstream main(and any remote, not justorigin) now blocked.CLAUDE_PROTECTED_BRANCHESenv;develop/releasecan be added without editing the hook.npm publish --dry-runallowed.Test plan
bash hooks/tests/run-all.sh→ 36 passed, 0 failedhook-tests.ymlworkflow runs on push (Linux + macOS matrix)git push origin mainfrom a feature branch still blockedCLAUDE_PROTECTED_BRANCHES=main,developblocks push to develop/setupdotclaudeon a Next.js/Supabase project — verify Phase 3.8 / 3.8b / 3.8c behave as described