towishy_Owen-Graphite/dev/scripts/hooks/pre-commit

26 lines
783 B
Bash
Executable file

#!/bin/sh
# Owen Graphite v3 pre-commit hook
# - verifies dist/theme-v3.css matches a fresh bundle of src/ (--check)
# * if stale, aborts the commit so the dev can rebuild + restage
# - runs the Live Preview hit-routing audit
# - runs the duplicate-selector audit (informational)
# Install with:
# ln -sf ../../dev/scripts/hooks/pre-commit .git/hooks/pre-commit
# chmod +x dev/scripts/hooks/pre-commit
set -e
repo_root=$(git rev-parse --show-toplevel)
cd "$repo_root"
if [ -x .venv/bin/python ]; then
PY=.venv/bin/python
elif [ -x .venv/Scripts/python.exe ]; then
PY=.venv/Scripts/python.exe
else
PY=python3
fi
"$PY" dev/scripts/bundle_v3.py --check
"$PY" dev/scripts/audit_v3_hit_routing.py
"$PY" dev/scripts/v3_audit_duplicate_selectors.py >/dev/null || true