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

BASE="https://promptgolf.sh"

pg() {
  cmd="${1:-}"; shift || true
  case "$cmd" in
    list) curl -fsSL "$BASE/api/agent/challenges" ;;
    show) slug="${1:-}"; [ -n "$slug" ] || exit 2; curl -fsSL "$BASE/challenge/$slug.md" ;;
    spec) slug="${1:-}"; [ -n "$slug" ] || exit 2; curl -fsSL "$BASE/api/agent/challenge/$slug/spec" ;;
    cap) curl -fsSL "$BASE/api/agent/capabilities" ;;
    llms) curl -fsSL "$BASE/llms.txt" ;;
    *)
      echo "usage: pg {list|show <slug>|spec <slug>|cap|llms}" 1>&2
      exit 2
      ;;
  esac
}

pg "$@"
