#!/usr/bin/env bash
# Standalone ASR post-processing entrypoint.
#
# Independent of Claude Code / opencode / any agent runtime: it uses its own venv
# and talks to the model provider over plain HTTPS. Safe to call from systemd,
# cron, or a shell that has nothing but bash.
set -euo pipefail
ROOT="$(cd "$(dirname "$(readlink -f "$0")")/.." && pwd)"
PY="$ROOT/.venv/bin/python"
if [ ! -x "$PY" ]; then
  echo "venv missing at $PY" >&2
  echo "create it with:" >&2
  echo "  uv venv $ROOT/.venv --python 3.13" >&2
  echo "  uv pip install --python $PY pypinyin rapidfuzz numpy" >&2
  exit 2
fi
export PYTHONPATH="$ROOT${PYTHONPATH:+:$PYTHONPATH}"
export PYTHONUNBUFFERED=1
exec "$PY" -m asrpipe.cli "$@"
