#!/usr/bin/env bash
# Git pre-push hook
# Copy to .git/hooks/pre-push and make executable: chmod +x .git/hooks/pre-push
# Budget: under 60 seconds total

set -euo pipefail

echo "Running pre-push quality checks..."

# 1. Type checking with mypy
echo "[1/3] Running mypy type checks..."
mypy app/ --strict --no-error-summary
echo "  mypy passed."

# 2. Unit tests (fail-fast, no slow/integration tests)
echo "[2/3] Running unit tests..."
pytest tests/unit/ -x -q --no-header --tb=short
echo "  tests passed."

# 3. Security-focused lint rules
echo "[3/3] Running ruff security checks..."
ruff check app/ --select S --no-fix --quiet
echo "  security lint passed."

echo "All pre-push checks passed."
