File size: 748 Bytes
0d8c22c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# G.U.I.D.E. pre-commit gate — runs the sanity suite (SPEC.md §3-4).
# No code may be committed while these fail. Bypass only with --no-verify.
set -euo pipefail

ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"

if [ -x ".venv/bin/python" ]; then
  PY=".venv/bin/python"
else
  PY="python3"
fi

echo "[pre-commit] Running G.U.I.D.E. sanity tests ($PY)…"
if ! "$PY" -m pytest tests/test_sanity.py -q; then
  echo ""
  echo "[pre-commit] ❌ Sanity tests failed — commit aborted (see SPEC.md)."
  echo "[pre-commit]    Fix the failures, or bypass with 'git commit --no-verify'"
  echo "[pre-commit]    (only in a genuine emergency; the change is then not Done)."
  exit 1
fi
echo "[pre-commit] ✅ Sanity tests passed."