#!/bin/bash
# Self-PR Skill Installer
# Usage: curl -sL https://self-pr-skills.agentbayou.com/self-pr/install.sh | bash
#
# Installs Self-PR into the current workspace's skills/ directory

set -e

SKILL_NAME="self-pr"
BASE_URL="https://self-pr-skills.agentbayou.com/self-pr"
INSTALL_DIR="skills/${SKILL_NAME}"

echo "🧠 Installing Self-PR — Self Principled Robotics"
echo ""

# Create directory
mkdir -p "${INSTALL_DIR}"

# Download bundle
echo "📦 Downloading skill bundle..."
curl -sL "${BASE_URL}/bundle.tar.gz" | tar xz -C "${INSTALL_DIR}"

echo ""
echo "✅ Self-PR installed to ${INSTALL_DIR}/"
echo ""
echo "Quick start:"
echo "  # Check an action against guardrails"
echo "  uv run --with pyyaml python3 ${INSTALL_DIR}/engine/guardrails.py check \"your action here\""
echo ""
echo "  # View all rules"
echo "  uv run --with pyyaml python3 ${INSTALL_DIR}/engine/guardrails.py stats"
echo ""
echo "  # Launch dashboard"
echo "  cd ${INSTALL_DIR}/dashboard && python3 -m http.server 8077"
echo ""
echo "📖 Read ${INSTALL_DIR}/SKILL.md for full documentation"
