#!/bin/sh
set -e

# ===========================================================================
# Tier 1: Deterministic checks (fast, all contributors)
# ===========================================================================

printf "pre-commit: linting with ruff...\n"
uv run ruff check

printf "pre-commit: refreshing generated docs and intake index...\n"
uv run python scripts/check_docs.py --refresh --stage-generated

printf "pre-commit: validating docs and intake index...\n"
uv run python scripts/check_docs.py --check

printf "pre-commit: checking architecture constraints...\n"
uv run python scripts/check_architecture_lints.py --all

printf "pre-commit: checking zero-copy compliance...\n"
uv run python scripts/check_zero_copy.py --all

printf "pre-commit: checking performance patterns...\n"
uv run python scripts/check_perf_patterns.py --all

printf "pre-commit: checking maintainability...\n"
uv run python scripts/check_maintainability.py --all

printf "pre-commit: checking import guards (numpy/shapely in GPU paths)...\n"
uv run python scripts/check_import_guard.py --all

# ===========================================================================
# Tier 2: AI review reminder
#
# The AI review skills ($gpu-code-review, $pre-land-review) are designed
# for interactive agent sessions, not automated pre-commit runs.
#
# This prints a non-blocking reminder visible in terminals and VS Code
# git output alike.  Suppress with VIBESPATIAL_SKIP_AI_REMINDER=1.
# ===========================================================================

if [ "${VIBESPATIAL_SKIP_AI_REMINDER:-0}" = "0" ]; then
    printf "\n"
    printf "%s\n" "Reminder: run $pre-land-review in Codex before landing."
    printf "  $pre-land-review  deterministic checks + AI review gate\n"
    printf "  $gpu-code-review  targeted GPU review when kernel code changes\n"
fi
