#!/bin/sh
# Pre-push hook: ensure code passes CI checks before pushing.
set -e

echo "pre-push: checking format..."
cargo fmt --all -- --check || {
    echo "ERROR: cargo fmt check failed. Run 'cargo fmt --all' and commit."
    exit 1
}

echo "pre-push: running clippy..."
cargo clippy --all-features --all-targets -- -D warnings || {
    echo "ERROR: clippy failed. Fix warnings before pushing."
    exit 1
}

echo "pre-push: running cargo audit..."
cargo audit --quiet || {
    echo "WARNING: cargo audit found issues (non-blocking)."
}

echo "pre-push: all checks passed ✓"
