#!/bin/sh
# Pre-commit hook to run rustfmt and clippy

set -e

echo "Running cargo fmt check..."
if ! cargo fmt --all -- --check; then
    echo "❌ Code formatting check failed. Please run 'cargo fmt' to fix."
    exit 1
fi

echo "Running cargo clippy..."
if ! cargo clippy --all-targets --all-features -- -D warnings; then
    echo "❌ Clippy check failed. Please fix the warnings above."
    exit 1
fi

echo "✅ All pre-commit checks passed!"
