#!/usr/bin/env bash
# Refresh the kyberforge plugin cache after every push
set -euo pipefail

echo "→ Refreshing holocron marketplace clone..."
if git -C ~/.claude/plugins/marketplaces/holocron pull --quiet; then
  echo "→ Updating kyberforge plugin cache..."
  if claude plugin update kyberforge; then
    echo "✓ kyberforge cache updated"
  else
    echo "⚠ claude plugin update kyberforge failed — run it manually" >&2
  fi
else
  echo "⚠ Failed to pull holocron marketplace clone — run 'git -C ~/.claude/plugins/marketplaces/holocron pull' manually" >&2
fi

exit 0
