#!/usr/bin/env bash
# Pre-push hook that mirrors the CI `ci / Check & Test` job so
# contributors catch lint drift before it hits the runner.
#
# Install once per clone:
#
#   git config core.hooksPath .githooks
#
# Skip for a single push:
#
#   git push --no-verify

set -euo pipefail

echo "── pre-push: cargo fmt --check ──────────────────────────────"
cargo fmt --all --check

echo "── pre-push: cargo clippy --all-targets --all-features ──────"
cargo clippy --all-targets --all-features --workspace -- -D warnings

echo "── pre-push: cargo test ─────────────────────────────────────"
cargo test --workspace --all-features --no-fail-fast

echo "✓ pre-push checks passed"
