#!/usr/bin/env bash
# Prefer $0 launcher — uses local venv if present.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
PY="${ROOT}/.venv/bin/python"
if [[ ! -x "$PY" ]]; then
  PY="${PYTHON:-python3}"
fi
# Load Falcon Prefer-$0 env if present (secrets stay out of git)
ENV_FILE="${ETC_FALCON_ENV_FILE:-/home/box/.config/falcon-mcp/.env}"
if [[ -f "$ENV_FILE" ]]; then
  set -a
  # shellcheck disable=SC1090
  source "$ENV_FILE"
  set +a
fi
exec "$PY" "$ROOT/endpoint_truth_check.py" "$@"
