#!/usr/bin/env bash
# Live-smoke wrapper for the `warp` CLI.
#
# Why this exists:
#   `~/Documents/code_projects/Personal/Wick/.venv/lib/python3.12/site-packages/*.pth`
#   files are continuously re-flagged UF_HIDDEN by iCloud sync (within ~1s of
#   any `chflags nohidden`). Python's site.py skips hidden .pth files at
#   startup, so the editable install never registers and `.venv/bin/warp`
#   raises ModuleNotFoundError: warp. Setting PYTHONPATH bypasses .pth
#   processing entirely. See Weft memory weft-28022917 for the full story.
#
#   This wrapper also sources `.env` from the repo root if present, so
#   WARP_ANTHROPIC_API_KEY (and any other live-smoke credentials) are loaded
#   into the warp process environment. The credential broker
#   (security_spec.md §1) will replace `.env` once it lands; this wrapper's
#   interface stays the same.
#
# Usage:
#   bin/warp-smoke run classify --input '{"text":"hi","categories":["a","b"]}'
#   bin/warp-smoke status
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
if [ -f "$REPO_ROOT/.env" ]; then
  set -a
  # shellcheck disable=SC1091
  . "$REPO_ROOT/.env"
  set +a
fi
exec env "PYTHONPATH=$REPO_ROOT" "$REPO_ROOT/.venv/bin/warp" "$@"
