Files
claude_mac/docs/superpowers/plans/2026-09-30-higgsfield-pack.patches/03-toggle-external.patch
T

201 lines
8.1 KiB
Diff

--- a/lib/toggle-external.sh
+++ b/lib/toggle-external.sh
@@ -8,7 +8,8 @@
# as symlinks inside skills/. This script moves those symlinks
# to/from skills-disabled/ so Claude Code stops/starts scanning them.
#
-# A multi-skill pack (gstack, 21st) toggles all of its skills at once.
+# A multi-skill pack (gstack, 21st, higgsfield) toggles all of its skills
+# at once.
#
# Usage:
# toggle-external.sh list
@@ -21,6 +22,8 @@
# emil-design-eng — single symlink → skills-external/emil-design-eng
# darwin-skill — single symlink → ~/.agents/skills/darwin-skill
# 21st — 21st.dev skill pack (needs the `21st` CLI + login)
+# higgsfield — Higgsfield media pack (needs the `higgsfield` CLI)
+# higgsfield-websites — single skill, landing-page aid (named ask only)
# observability-and-instrumentation, deprecation-and-migration,
# ci-cd-and-automation — the agent-skills trio, same single-symlink shape
# as emil-design-eng (commit-pinned instead of main-branch tracking)
@@ -52,7 +55,8 @@
err() { echo -e "${RED}✗${NC} $1"; }
# All non-plugin tools this script can toggle.
-MANAGED_TOOLS=(gstack emil-design-eng darwin-skill 21st
+MANAGED_TOOLS=(gstack emil-design-eng darwin-skill 21st higgsfield
+ higgsfield-websites
observability-and-instrumentation deprecation-and-migration ci-cd-and-automation
scroll-world-storytelling build-threejs-scroll-worlds
scroll-scrubbed-visual-sequence scroll-scrubbed-word-reveal
@@ -69,6 +73,51 @@
done
}
+# Prints the skill names of the "higgsfield" media pack: every
+# skills-external/higgsfield-* synced by lib/higgsfield-skills.sh, minus
+# higgsfield-websites, which is its own tool (landing-page aid, named ask).
+higgsfield_skills() {
+ local d
+ for d in "$REPO"/skills-external/higgsfield-*/; do
+ [ -f "${d}SKILL.md" ] || continue
+ [ "$(basename "$d")" = "higgsfield-websites" ] && continue
+ basename "$d"
+ done
+}
+
+# Prints the member skills of a multi-skill pack tool (21st, higgsfield).
+pack_skills() {
+ case "$1" in
+ 21st) twentyfirst_skills ;;
+ higgsfield) higgsfield_skills ;;
+ esac
+}
+
+# The pack skills shell out to their CLI; without it (or without a session)
+# they can only report failure. Warn, never block: the pack is still
+# correctly wired and `make plugin` installs the CLI.
+pack_cli_hint() {
+ case "$1" in
+ 21st)
+ if ! command -v 21st >/dev/null 2>&1; then
+ warn "the \`21st\` CLI is not on PATH — install it: npm i -g @21st-dev/cli"
+ elif ! 21st whoami 2>/dev/null | grep -q '^Logged in as '; then
+ warn "not signed in to 21st — component retrieval and 21st AI need: 21st login"
+ fi
+ ;;
+ higgsfield)
+ # Same probe as higgsfield_signed_in (lib/higgsfield-skills.sh),
+ # inlined: this script takes no extra `source`, the fixture suites
+ # copy it alone. The token goes to /dev/null, never to the terminal.
+ if ! command -v higgsfield >/dev/null 2>&1; then
+ warn "the \`higgsfield\` CLI is not on PATH — run: make plugin"
+ elif ! higgsfield auth token </dev/null >/dev/null 2>&1; then
+ warn "not signed in to Higgsfield — generation needs: higgsfield auth login"
+ fi
+ ;;
+ esac
+}
+
# Prints the names (directory basenames) that belong to "gstack".
# Source of truth: skills-external/gstack/*/SKILL.md. The repo's
# skills/<name> symlinks are generated from these by gstack ./setup.
@@ -94,7 +143,7 @@
;;
emil-design-eng|observability-and-instrumentation|deprecation-and-migration|ci-cd-and-automation| \
scroll-world-storytelling|build-threejs-scroll-worlds|scroll-scrubbed-visual-sequence| \
- scroll-scrubbed-word-reveal|scroll-progress-timeline)
+ scroll-scrubbed-word-reveal|scroll-progress-timeline|higgsfield-websites)
[ -d "$REPO/skills-external/$tool" ] || { echo "missing"; return; }
[ -e "$SKILLS_DIR/$tool" ] && echo "enabled" || echo "disabled"
;;
@@ -102,12 +151,12 @@
[ -d "$HOME/.agents/skills/$tool" ] || { echo "missing"; return; }
[ -e "$SKILLS_DIR/$tool" ] && echo "enabled" || echo "disabled"
;;
- 21st)
+ 21st|higgsfield)
local installed=0
while read -r name; do
installed=1
[ -e "$SKILLS_DIR/$name" ] && { echo "enabled"; return; }
- done < <(twentyfirst_skills)
+ done < <(pack_skills "$tool")
[ "$installed" -eq 1 ] && echo "disabled" || echo "missing"
;;
*)
@@ -135,7 +184,8 @@
;;
emil-design-eng|darwin-skill|observability-and-instrumentation|deprecation-and-migration| \
ci-cd-and-automation|scroll-world-storytelling|build-threejs-scroll-worlds| \
- scroll-scrubbed-visual-sequence|scroll-scrubbed-word-reveal|scroll-progress-timeline)
+ scroll-scrubbed-visual-sequence|scroll-scrubbed-word-reveal|scroll-progress-timeline| \
+ higgsfield-websites)
if [ -e "$SKILLS_DIR/$tool" ]; then
rm -rf "${DISABLED_DIR:?}/${tool:?}"
mv "$SKILLS_DIR/$tool" "$DISABLED_DIR/$tool"
@@ -144,7 +194,7 @@
warn "$tool already disabled"
fi
;;
- 21st)
+ 21st|higgsfield)
# Parked under the plain skill name — same convention as the other
# externals, so profile.sh's park/restore path stays interoperable.
local parked=0
@@ -153,11 +203,11 @@
rm -rf "${DISABLED_DIR:?}/${name:?}"
mv "$SKILLS_DIR/$name" "$DISABLED_DIR/$name"
parked=$((parked + 1))
- done < <(twentyfirst_skills)
+ done < <(pack_skills "$tool")
if [ "$parked" -gt 0 ]; then
- ok "21st disabled ($parked skills parked)"
+ ok "$tool disabled ($parked skills parked)"
else
- warn "21st already disabled"
+ warn "$tool already disabled"
fi
;;
*) err "Unknown tool: $tool"; return 1 ;;
@@ -194,7 +244,8 @@
;;
emil-design-eng|darwin-skill|observability-and-instrumentation|deprecation-and-migration| \
ci-cd-and-automation|scroll-world-storytelling|build-threejs-scroll-worlds| \
- scroll-scrubbed-visual-sequence|scroll-scrubbed-word-reveal|scroll-progress-timeline)
+ scroll-scrubbed-visual-sequence|scroll-scrubbed-word-reveal|scroll-progress-timeline| \
+ higgsfield-websites)
local src
case "$tool" in
darwin-skill) src="$HOME/.agents/skills/$tool" ;;
@@ -214,7 +265,7 @@
return 1
fi
;;
- 21st)
+ 21st|higgsfield)
local restored=0 linked=0
while read -r name; do
if [ -e "$DISABLED_DIR/$name" ]; then
@@ -227,24 +278,17 @@
ln -sf "$REPO/skills-external/$name" "$SKILLS_DIR/$name"
linked=$((linked + 1))
fi
- done < <(twentyfirst_skills)
+ done < <(pack_skills "$tool")
if [ "$((restored + linked))" -eq 0 ]; then
- if [ "$(status_tool 21st)" = "missing" ]; then
- err "21st pack not installed in $REPO/skills-external — run: make plugin"
+ if [ "$(status_tool "$tool")" = "missing" ]; then
+ err "$tool pack not installed in $REPO/skills-external — run: make plugin"
return 1
fi
- warn "21st already enabled"
+ warn "$tool already enabled"
return 0
fi
- ok "21st enabled ($((restored + linked)) skills: $restored restored, $linked linked)"
- # The skills shell out to the CLI; without it (or without a session)
- # they can only report failure. Warn, never block — the pack is still
- # correctly wired and `make plugin` installs the CLI.
- if ! command -v 21st >/dev/null 2>&1; then
- warn "the \`21st\` CLI is not on PATH — install it: npm i -g @21st-dev/cli"
- elif ! 21st whoami 2>/dev/null | grep -q '^Logged in as '; then
- warn "not signed in to 21st — component retrieval and 21st AI need: 21st login"
- fi
+ ok "$tool enabled ($((restored + linked)) skills: $restored restored, $linked linked)"
+ pack_cli_hint "$tool"
;;
*) err "Unknown tool: $tool"; return 1 ;;
esac
@@ -259,7 +303,7 @@
}
usage() {
- sed -n '3,23p' "$0" | sed 's/^# \?//'
+ sed -n '3,26p' "$0" | sed 's/^# \?//'
exit "${1:-0}"
}