#!/bin/sh
# Argoni's Claude Code hook relay. Always exits 0: it never blocks Claude Code.
# It runs on every tool call of every Claude Code session, so it does nothing at all while
# Argoni is not running: no socket, no Python. With Argoni there, it
# runs argoni-hook.py beside it only when Python is really there (on a Mac without the
# command line tools, /usr/bin/python3 would open an install dialog instead).
# A Debug build has its own bundle id and container (.debug), so its socket is looked for too.
C="$HOME/Library/Containers/io.github.makariim.argoni"
[ -S "$C/Data/argoni.sock" ] || [ -S "$C.debug/Data/argoni.sock" ] || exit 0
HOOK_DIR="$(dirname "$0")"
if xcode-select -p >/dev/null 2>&1; then
    out=$(/usr/bin/python3 "$HOOK_DIR/argoni-hook.py" "$@" 2>/dev/null)
    [ -n "$out" ] && printf '%s\n' "$out"
fi
exit 0
