#!/bin/sh set -e # Prefer the repo venv: a bare `python` resolves to system Python in normal # shells and fails collection (no pydantic). Windows venv layout first. if [ -x ".venv/Scripts/python.exe" ]; then PY=".venv/Scripts/python.exe"; elif [ -x ".venv/bin/python" ]; then PY=".venv/bin/python"; else PY="python"; fi CHANGED=$(git diff --cached --name-only --diff-filter=ACM || true) CHANGED_PY=$(echo "$CHANGED" | grep '\.py$' || true) if [ -n "$CHANGED_PY" ]; then "$PY" scripts/guards/no_raw_clients.py $CHANGED_PY; fi # Mojibake lives in string content, not Python syntax — scan all staged text files. if [ -n "$CHANGED" ]; then "$PY" scripts/guards/no_mojibake.py $CHANGED; fi "$PY" -m ruff check . "$PY" -m pytest -q