#!/usr/bin/env bash # fj pre-push hook — local CI gate. # Runs fmt-check, clippy, tests, and a release build. With FJ_E2E=1 also # runs the live-API smoke suite against the currently signed-in host. set -euo pipefail cd "$(git rev-parse --show-toplevel)" # Allow skip in genuine emergencies. Don't use this unless you know why. if [[ "${FJ_SKIP_PREPUSH:-0}" = "1" ]]; then echo "fj pre-push: skipped (FJ_SKIP_PREPUSH=1)" exit 0 fi step() { printf '\n\033[1;34m== %s ==\033[0m\n' "$*" } step "cargo fmt --check" cargo fmt --all -- --check step "cargo clippy (deny warnings)" cargo clippy --all-targets --all-features -- -D warnings step "cargo test" cargo test --all --locked step "cargo build --release" cargo build --release --locked if [[ "${FJ_E2E:-0}" = "1" ]]; then step "E2E smoke (live API)" ./scripts/e2e-smoke.sh fi printf '\n\033[1;32m✓ pre-push checks passed\033[0m\n'