#!/usr/bin/env bash # # Install Domna's curated skill set into the current repo. # # Run from the root of the target repo: # curl -fsSL https://raw.githubusercontent.com/Hestia-Homes/agentic-toolkit/main/setup.sh | bash # Or, if you've cloned agentic-toolkit: # bash /path/to/agentic-toolkit/setup.sh # # What this does: # 1. Drops the pinned skills-lock.json from agentic-toolkit into the target repo. # 2. Runs `skills experimental_install` to restore the exact pinned versions # of Matt Pocock's skills + Domna's own skills (Hestia-Homes/agentic-toolkit). # # To upgrade skills across all Domna repos: # - In agentic-toolkit, re-install the skills you want, then commit the # resulting skills-lock.json (this script reads from that file). # - Devs re-run setup.sh in their target repos. # set -euo pipefail # --- config -------------------------------------------------------------------- LOCK_URL="https://raw.githubusercontent.com/Hestia-Homes/agentic-toolkit/main/skills-lock.json" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd || true)" LOCAL_LOCK="${SCRIPT_DIR:+$SCRIPT_DIR/skills-lock.json}" # --- guards -------------------------------------------------------------------- if ! command -v npx >/dev/null 2>&1; then echo "error: npx is required (install Node.js >= 20)." >&2 exit 1 fi if [[ ! -d .git ]]; then echo "error: run this script from the root of a git repository." >&2 exit 1 fi # --- stage skills-lock.json ---------------------------------------------------- LOCK_FILE="$(mktemp -t skills-lock.XXXXXX.json)" trap 'rm -f "$LOCK_FILE"' EXIT if [[ -n "$LOCAL_LOCK" && -f "$LOCAL_LOCK" ]]; then echo "==> Using local skills-lock.json from $LOCAL_LOCK" cp "$LOCAL_LOCK" "$LOCK_FILE" else echo "==> Fetching skills-lock.json from $LOCK_URL" if command -v curl >/dev/null 2>&1; then curl -fsSL "$LOCK_URL" -o "$LOCK_FILE" elif command -v wget >/dev/null 2>&1; then wget -qO "$LOCK_FILE" "$LOCK_URL" else echo "error: need curl or wget to fetch skills-lock.json." >&2 exit 1 fi fi AGENT_TARGET="claude-code" # --- install (globally, grouped by source) ------------------------------------- # `skills experimental_install` only restores at project scope. Domna installs # globally (~/.claude), so we parse the lock and call `skills add` per source # with the explicit skill list from the lock file. echo "==> Installing skills globally (~/.claude) from skills-lock.json" # Group skills by source -> "sourceskill1,skill2,..." GROUPS="$(node -e ' const lock = JSON.parse(require("fs").readFileSync(process.argv[1], "utf8")); const bySource = new Map(); for (const [name, entry] of Object.entries(lock.skills || {})) { if (!entry.source) continue; if (!bySource.has(entry.source)) bySource.set(entry.source, []); bySource.get(entry.source).push(name); } for (const [src, names] of bySource) { process.stdout.write(src + "\t" + names.join(",") + "\n"); } ' "$LOCK_FILE")" if [[ -z "$GROUPS" ]]; then echo "error: no skills found in lock file." >&2 exit 1 fi while IFS=$'\t' read -r SOURCE SKILLS; do [[ -z "$SOURCE" ]] && continue echo "==> $SOURCE :: $SKILLS" npx --yes skills@latest add "$SOURCE" \ --skill "$SKILLS" \ --agent "$AGENT_TARGET" \ --copy \ --global \ --yes done <<< "$GROUPS" # --- post-install reminder ----------------------------------------------------- cat <<'EOF' ==> Done. Next steps: 1. Run /setup-matt-pocock-skills (one-time per repo) to record the issue tracker, triage labels, and domain-doc layout. EOF