#!/bin/bash
set -e

echo "Running pre-push hooks..."

# 1. Rust tests and build
echo "Running Rust tests and creating release build..."
cargo test --all-features
cargo build --release --all-features

# 2. Rust documentation check
echo "Checking Rust documentation..."
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features

# 3. Node.js build and tests
echo "Building and testing Node.js bindings..."
cd bindings/nodejs
npm install
npx napi build --platform --release
npm test
cd ../..

# 4. Go tests
echo "Running Go tests..."
cd bindings/go
go test ./...
cd ../..

echo "Pre-push hooks passed! ✓"
