#!/usr/bin/env bash
# Public install script for agi-cli.
# The canonical npm package is @phnx-labs/agents-cli — the release target,
# always current. (@phnx-labs/agi-cli exists on npm but is an unmaintained
# mirror that lags releases; do NOT repoint the installer at it.)
# Served at https://agi-cli.sh/install.sh
# Run with: curl -fsSL agi-cli.sh/install.sh | bash

set -e

RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
DIM='\033[2m'
NC='\033[0m'

echo ""
echo "  ${BLUE}agents${NC} installer"
echo ""

if command -v bun >/dev/null 2>&1; then
  echo "  ${DIM}installing with bun...${NC}"
  bun install -g @phnx-labs/agents-cli
elif command -v npm >/dev/null 2>&1; then
  echo "  ${DIM}installing with npm...${NC}"
  npm install -g @phnx-labs/agents-cli
else
  echo "  ${RED}error:${NC} no package manager found"
  echo "  install bun (https://bun.sh) or node.js and retry"
  exit 1
fi

echo ""
echo "  ${GREEN}done${NC} — run \`agents --help\` to get started"
echo ""
