#!/bin/bash
# Send a message to Hermes Agent
# Usage: ./send-to-hermes.sh "Your message here"

source ~/.zshrc

MESSAGE="${1:-What E2E testing skills do you have for Nxtgauge?}"

# Create a temporary script to send to hermes
cat > /tmp/hermes-prompt.txt << 'PROMPT'
PROMPT

echo "$MESSAGE" >> /tmp/hermes-prompt.txt

# Try using expect or script to create a pseudo-TTY
if command -v expect &> /dev/null; then
    expect -c "
        spawn hermes
        send \"$MESSAGE\r\"
        expect \"Goodbye\"
        exit 0
    " 2>&1
else
    # Fallback: just open terminal and copy message
    echo "Please run these commands in a new terminal:"
    echo ""
    echo "Terminal 1:"
    echo "  source ~/.zshrc && hermes"
    echo ""
    echo "Then type this message:"
    echo "  $MESSAGE"
fi
