#!/usr/bin/env bash
# chip-sourcing-skillpack installer — deploys the root strategy skill + every per-site sub-skill.
set -euo pipefail
DEST="${CLAUDE_SKILLS_DIR:-$HOME/.claude/skills}"
install_one(){ local name="$1" src="$2"; mkdir -p "$DEST/$name"; cp "$src" "$DEST/$name/SKILL.md"; echo "  installed $name"; }
echo "Installing chip-sourcing skillpack -> $DEST"
install_one "chip-sourcing" "SKILL.md"
for d in skills/*/; do
  s="$d/SKILL.md"; [ -f "$s" ] || continue
  base="$(basename "$d")"; [ "$base" = "_template" ] && continue
  install_one "chip-sourcing-$base" "$s"
done
echo "Done. Root skill: chip-sourcing. Add a site by copying skills/_template -> skills/<site> and reinstalling."