#!/bin/bash
set -euo pipefail

TOKEN="${1:-}"
if [ -z "$TOKEN" ]; then
  echo "usage: quickstart.sh <pairing-code>"
  echo "  Get your pairing code from https://dashboard.aarvion.ai"
  exit 1
fi

echo "1/4 installing guard daemon..."
if ! command -v aarvion-guard &>/dev/null; then
  if command -v npx &>/dev/null; then
    npx @aarvionai/guard version
  else
    curl -fsSL https://get.aarvion.ai | sh
  fi
fi

echo "2/4 installing hermes plugin..."
pip install --quiet aarvion-guard-hermes

echo "3/4 pairing with Aarvion..."
aarvion-guard init "$TOKEN"

echo "4/4 registering plugin with Hermes..."
hermes plugins enable aarvion-guard 2>/dev/null || echo "  (register manually: hermes plugins enable aarvion-guard)"

echo ""
echo "done. start the guard and run your agent:"
echo "  aarvion-guard service start"
echo "  hermes run"
