#!/usr/bin/env bash
set -euo pipefail

# Windows-only guard: ensure we run only on Windows hosts
if [ "${OS:-}" != "Windows_NT" ]; then
  echo "[pre-push] Windows-only hooks. Detected non-Windows OS: $(uname -s). Aborting." >&2
  exit 1
fi

# Prefer PowerShell on Windows if available, otherwise use Bash variant.
if command -v pwsh >/dev/null 2>&1; then
  echo "[pre-push] Running scripts/ci-local.ps1 via PowerShell"
  pwsh -NoProfile -File scripts/ci-local.ps1
elif command -v bash >/dev/null 2>&1; then
  echo "[pre-push] Running scripts/ci-local.sh (Bash)"
  bash scripts/ci-local.sh
else
  echo "[pre-push] Neither pwsh nor bash found; skipping local CI. Use --no-verify to bypass." >&2
fi
