#!/usr/bin/env sh
set -eu

PACKAGE_URL="${GAMEGMETA_CLI_PACKAGE:-https://gamegmeta.pages.dev/downloads/gamegmeta-0.1.0.tgz}"

if ! command -v npm >/dev/null 2>&1; then
  echo "GameGmeta CLI requires Node.js and npm."
  echo "Install Node.js from https://nodejs.org/ and run this script again."
  exit 1
fi

echo "Installing GameGmeta CLI from:"
echo "  ${PACKAGE_URL}"
npm install -g "${PACKAGE_URL}"

echo ""
echo "GameGmeta CLI installed."
echo "Start the local Agent Bridge:"
echo "  gamegmeta start --open"
