Test Hooks — Enforcement Hook Smoke Tests
Smoke-test all enforcement hooks by feeding known good and bad inputs and verifying exit codes.
Command
/test-hooks
Workflow
ADR Immutability Guard (plugins/principled-docs/hooks/scripts/check-adr-immutability.sh)
Run these test cases:
Accepted ADR — should block (exit 2): For each file in
docs/decisions/withstatus: accepted, feed its path:echo '{"tool_input":{"file_path":"<path>"}}' | bash plugins/principled-docs/hooks/scripts/check-adr-immutability.shExpected: exit code 2.
Non-decision file — should allow (exit 0):
echo '{"tool_input":{"file_path":"CLAUDE.md"}}' | bash plugins/principled-docs/hooks/scripts/check-adr-immutability.shExpected: exit code 0.
Non-existent file — should allow (exit 0):
echo '{"tool_input":{"file_path":"docs/decisions/999-nonexistent.md"}}' | bash plugins/principled-docs/hooks/scripts/check-adr-immutability.shExpected: exit code 0.
Proposal Lifecycle Guard (plugins/principled-docs/hooks/scripts/check-proposal-lifecycle.sh)
Run these test cases:
Accepted proposal — should block (exit 2): For each file in
docs/proposals/with statusaccepted,rejected, orsuperseded, feed its path. Expected: exit code 2.Draft proposal — should allow (exit 0): For each file in
docs/proposals/with statusdraft, feed its path. Expected: exit code 0.Non-proposal file — should allow (exit 0):
echo '{"tool_input":{"file_path":"CLAUDE.md"}}' | bash plugins/principled-docs/hooks/scripts/check-proposal-lifecycle.shExpected: exit code 0.
Manifest Integrity Advisory (plugins/principled-implementation/hooks/scripts/check-manifest-integrity.sh)
Run these test cases:
Manifest file edit — should warn but allow (exit 0):
echo '{"tool_input":{"file_path":".impl/manifest.json"}}' | bash plugins/principled-implementation/hooks/scripts/check-manifest-integrity.shExpected: exit code 0, with advisory message on stderr.
Unrelated file — should pass silently (exit 0):
echo '{"tool_input":{"file_path":"src/index.ts"}}' | bash plugins/principled-implementation/hooks/scripts/check-manifest-integrity.shExpected: exit code 0, no output.
Missing JSON input — should allow (exit 0):
echo '{}' | bash plugins/principled-implementation/hooks/scripts/check-manifest-integrity.shExpected: exit code 0 (guard scripts default to allow).
PR Reference Advisory (plugins/principled-github/hooks/scripts/check-pr-references.sh)
Run these test cases:
gh pr createcommand — should warn but allow (exit 0):echo '{"tool_input":{"command":"gh pr create --title \"test\" --body \"test\""}}' | bash plugins/principled-github/hooks/scripts/check-pr-references.shExpected: exit code 0, with advisory message on stderr.
Unrelated command — should pass silently (exit 0):
echo '{"tool_input":{"command":"git status"}}' | bash plugins/principled-github/hooks/scripts/check-pr-references.shExpected: exit code 0, no output.
Missing JSON input — should allow (exit 0):
echo '{}' | bash plugins/principled-github/hooks/scripts/check-pr-references.shExpected: exit code 0 (guard scripts default to allow).
Review Checklist Advisory (plugins/principled-quality/hooks/scripts/check-review-checklist.sh)
Run these test cases:
gh pr reviewcommand — should warn but allow (exit 0):echo '{"tool_input":{"command":"gh pr review 42"}}' | bash plugins/principled-quality/hooks/scripts/check-review-checklist.shExpected: exit code 0, with advisory message on stderr.
gh pr mergecommand — should warn but allow (exit 0):echo '{"tool_input":{"command":"gh pr merge 42"}}' | bash plugins/principled-quality/hooks/scripts/check-review-checklist.shExpected: exit code 0, with advisory message on stderr.
Unrelated command — should pass silently (exit 0):
echo '{"tool_input":{"command":"git status"}}' | bash plugins/principled-quality/hooks/scripts/check-review-checklist.shExpected: exit code 0, no output.
Release Readiness Advisory (plugins/principled-release/hooks/scripts/check-release-readiness.sh)
Run these test cases:
git tagcommand — should warn but allow (exit 0):echo '{"tool_input":{"command":"git tag v1.0.0"}}' | bash plugins/principled-release/hooks/scripts/check-release-readiness.shExpected: exit code 0, with advisory message on stderr.
git tag -lcommand — should pass silently (exit 0):echo '{"tool_input":{"command":"git tag -l"}}' | bash plugins/principled-release/hooks/scripts/check-release-readiness.shExpected: exit code 0, no advisory (listing tags is not a release action).
Unrelated command — should pass silently (exit 0):
echo '{"tool_input":{"command":"git status"}}' | bash plugins/principled-release/hooks/scripts/check-release-readiness.shExpected: exit code 0, no output.
Reporting
For each test case, report PASS or FAIL with the actual vs expected exit code. Provide a summary at the end with total pass/fail counts.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.