#!/usr/bin/env bash # Pre-commit hook: ruff lint + auto-fix. # Install: make install-hooks set -euo pipefail REPO_ROOT="$(git rev-parse --show-toplevel)" RUFF="$REPO_ROOT/.venv/bin/ruff" if [[ ! -x "$RUFF" ]]; then echo "pre-commit: ruff not found at $RUFF — run 'uv sync' first" >&2 exit 1 fi echo "→ ruff check (root)" "$RUFF" check --fix "$REPO_ROOT" echo "→ ruff check (web/src web/tests)" "$RUFF" check --fix "$REPO_ROOT/web/src" "$REPO_ROOT/web/tests" \ --config "$REPO_ROOT/web/pyproject.toml" # Re-stage any files ruff fixed so they land in the commit. git diff --name-only | xargs -r git add