#!/bin/sh # Guard against committing local planning/scratch documents into this (public) repo. # Catches force-added files and anything that looks like an ephemeral plan, even if # it slipped past .gitignore. Bypass intentionally with: git commit --no-verify # # This hook is local (.git/hooks is not cloned). Reinstall on a fresh clone with # scripts/install-hooks.sh. blocked=$(git diff --cached --name-only --diff-filter=AM | grep -E \ -e '(^|/)notes/' \ -e '_PLAN\.md$' \ -e '-plan\.md$' \ -e '\.plan\.md$' \ -e '\.scratch\.md$' \ -e '(^|/)SCRATCH_.*\.md$') if [ -n "$blocked" ]; then echo "pre-commit: refusing to commit local planning/scratch docs:" >&2 echo "$blocked" | sed 's/^/ /' >&2 echo >&2 echo " These belong under notes/ (git-ignored) and should not be published." >&2 echo " If this is deliberate, re-run with: git commit --no-verify" >&2 exit 1 fi