#!/usr/bin/env bash
set -euo pipefail

PACKAGE="@syner-code/assistant"
INSTALL_METHOD="${SYNER_INSTALL_METHOD:-npm}"

echo ""
echo "  Installing Syner Code..."
echo ""

install_with_npm() {
  if ! command -v npm >/dev/null 2>&1; then
    echo "  Error: npm is required. Install Node.js 18+ from https://nodejs.org"
    exit 1
  fi
  npm install -g "$PACKAGE"
}

install_with_npm

echo ""
echo "  Syner Code installed successfully!"
echo ""
echo "  Get started:"
echo "    syner setup     # First-time configuration"
echo "    syner           # Start interactive session"
echo "    syner run \"...\"  # Single prompt"
echo ""
