#!/usr/bin/env bash
# Install the pup USER skillpack: the main `pup` skill + its focused user sub-skills.
# Per the Bridge SDK a pkg ships ONLY user skills; all skills listed here are user-facing.
# The DEV + PUBLISH maintainer skills are source-only (repo dev-skills/ + publish-skills/,
# NOT in package.json files[], never installed here). The bridge RUNTIME isn't here either
# — it ships in Adom Desktop + as the Releases zip. The AD CLI + core skills arrive via
# this pkg's dependencies:{ "adom/adom-desktop": "^1.9.x" } at `pkg install` time.
set -e
PKG_DIR="$(cd "$(dirname "$0")" && pwd)"

deploy_into() {
  local BASE="$1"
  install_skill() { mkdir -p "$BASE/$1"; cp "$PKG_DIR/$2" "$BASE/$1/SKILL.md"; }
  # main user skill (REQUIRED at repo root by the registry)
  install_skill adom-desktop-puppeteer-bridge SKILL.md
  # focused user sub-skills
  install_skill pup-windows-sessions-tabs  skills/pup-windows-sessions-tabs/SKILL.md
  install_skill pup-screenshots-recording  skills/pup-screenshots-recording/SKILL.md
  install_skill pup-browsers-and-chrome    skills/pup-browsers-and-chrome/SKILL.md
  install_skill pup-adom-wiki              skills/pup-adom-wiki/SKILL.md
  echo "  -> $BASE (pup + 4 sub-skills)"
}

echo "Installing adom-desktop-puppeteer-bridge skills:"
deploy_into "$HOME/.claude/skills"                          # Claude Code
[ -d "$HOME/.codex" ] && deploy_into "$HOME/.codex/skills"  # Codex (if present)
echo "Done. The pup skill calls the adom-desktop CLI; if the bridge isn't installed on Adom Desktop it self-installs on first use."