#!/bin/sh
# Plugin entry point: find the outloud binary and hand it the hook's stdin.
# A hook must never break Claude Code, so this always exits 0.

# OUTLOUD_OFF=1 mutes the voice for one session. `outloud off` mutes it everywhere.
[ -n "$OUTLOUD_OFF" ] && exit 0

for bin in \
  "${CLAUDE_PLUGIN_ROOT:-.}/bin/outloud" \
  "$(command -v outloud 2>/dev/null)" \
  "$HOME/.cargo/bin/outloud"
do
  if [ -n "$bin" ] && [ -x "$bin" ]; then
    "$bin" "$@"
    exit 0
  fi
done

echo "outloud: binary not found. Install it with: cargo install outloud" >&2
exit 0
