#!/bin/bash
# hoardom app launcher - opens Terminal with TUI
SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
HOARDOM="/usr/local/bin/hoardom"

# try installed binary first, fall back to bundled copy
if [ ! -x "$HOARDOM" ]; then
    HOARDOM="$SELF_DIR/hoardom-bin"
fi

if [ -x "$HOARDOM" ]; then
    osascript \
        -e 'tell application "Terminal"' \
        -e '  activate' \
        -e "  do script \"'$HOARDOM' --tui\"" \
        -e 'end tell'
else
    osascript -e 'display dialog "hoardom binary not found" buttons {"OK"} default button "OK"'
fi
