forked from bchanot/claude
feat(toggle): higgsfield and higgsfield-websites toggles
This commit is contained in:
@@ -164,5 +164,153 @@ expect no-cli "$(probe "$CLEAN" higgsfield_cli_ok)" "rc=127"
|
||||
expect no-timeout "$(probe "$BIN:$CLEAN" higgsfield_cli_ok)" "rc=0"
|
||||
verdict PROBES_SILENT
|
||||
|
||||
# ── toggle ──────────────────────────────────────────────────
|
||||
# mk_toggle_fx <dir> [skill...] — fixture repo: the toggle script plus one
|
||||
# skills-external source per named skill (none → installed-nothing tree).
|
||||
mk_toggle_fx() {
|
||||
local fx="$1" s; shift
|
||||
mkdir -p "$fx/lib" "$fx/skills"
|
||||
cp "$ROOT/lib/toggle-external.sh" "$ROOT/lib/gstack-removed.sh" "$fx/lib/"
|
||||
for s in "$@"; do
|
||||
mkdir -p "$fx/skills-external/$s"
|
||||
echo "---" > "$fx/skills-external/$s/SKILL.md"
|
||||
done
|
||||
}
|
||||
PACK=(higgsfield-generate higgsfield-soul-id higgsfield-websites)
|
||||
|
||||
# tog <fixture> <args...> — run the fixture's toggle script, fake CLIs first.
|
||||
tog() {
|
||||
local fx="$1"; shift
|
||||
TOGGLE_EXTERNAL_REPO_OVERRIDE="$fx" PATH="$BIN:$PATH" \
|
||||
bash "$fx/lib/toggle-external.sh" "$@" 2>&1
|
||||
}
|
||||
# list_row <fixture> <tool> — the status column of `list` for one tool.
|
||||
list_row() { tog "$1" list | awk -v t="$2" '$1 == t { print $2 }'; }
|
||||
|
||||
F0="$WORK/f0"; mk_toggle_fx "$F0"
|
||||
F1="$WORK/f1"; mk_toggle_fx "$F1" "${PACK[@]}"
|
||||
expect pack-missing "$(tog "$F0" status higgsfield)" missing
|
||||
expect web-missing "$(tog "$F0" status higgsfield-websites)" missing
|
||||
expect pack-disabled "$(tog "$F1" status higgsfield)" disabled
|
||||
expect web-disabled "$(tog "$F1" status higgsfield-websites)" disabled
|
||||
ln -s "$F1/skills-external/higgsfield-generate" "$F1/skills/higgsfield-generate"
|
||||
expect pack-partial "$(tog "$F1" status higgsfield)" enabled
|
||||
expect web-apart "$(tog "$F1" status higgsfield-websites)" disabled
|
||||
expect list-pack "$(list_row "$F1" higgsfield)" enabled
|
||||
expect list-web "$(list_row "$F1" higgsfield-websites)" disabled
|
||||
verdict STATUS_STATES
|
||||
|
||||
F2="$WORK/f2"; mk_toggle_fx "$F2" "${PACK[@]}"
|
||||
out="$(tog "$F2" enable higgsfield)"; rc=$?
|
||||
expect rc "$rc" 0
|
||||
expect generate "$(readlink "$F2/skills/higgsfield-generate")" \
|
||||
"$F2/skills-external/higgsfield-generate"
|
||||
expect soul-id "$(readlink "$F2/skills/higgsfield-soul-id")" \
|
||||
"$F2/skills-external/higgsfield-soul-id"
|
||||
expect no-websites "$(yn test -e "$F2/skills/higgsfield-websites")" no
|
||||
expect_has count "$out" "higgsfield enabled (2 skills: 0 restored, 2 linked)"
|
||||
out="$(tog "$F2" enable higgsfield)"; rc=$?
|
||||
expect again-rc "$rc" 0
|
||||
expect_has again "$out" "higgsfield already enabled"
|
||||
verdict ENABLE_PACK_EXCLUDES_WEBSITES
|
||||
|
||||
# The media pack is an allowlist: a synced skill nobody listed is reported,
|
||||
# never linked; neither is a listed name whose directory holds no SKILL.md.
|
||||
F8="$WORK/f8"; mk_toggle_fx "$F8" "${PACK[@]}" higgsfield-newcomer
|
||||
mkdir -p "$F8/skills-external/higgsfield-brandkit" \
|
||||
"$F8/skills-external/higgsfield-noskill"
|
||||
out="$(tog "$F8" enable higgsfield)"; rc=$?
|
||||
expect rc "$rc" 0
|
||||
expect_has count "$out" "higgsfield enabled (2 skills: 0 restored, 2 linked)"
|
||||
expect newcomer-off "$(yn test -e "$F8/skills/higgsfield-newcomer")" no
|
||||
expect brandkit-off "$(yn test -e "$F8/skills/higgsfield-brandkit")" no
|
||||
expect_has reported "$out" "higgsfield-newcomer"
|
||||
expect_not noskill-quiet "$out" "higgsfield-noskill"
|
||||
expect links "$(entries "$F8/skills")" 2
|
||||
verdict UNLISTED_NOT_LINKED
|
||||
|
||||
F3="$WORK/f3"; mk_toggle_fx "$F3" "${PACK[@]}"
|
||||
out="$(tog "$F3" enable higgsfield-websites)"; rc=$?
|
||||
expect rc "$rc" 0
|
||||
expect link "$(readlink "$F3/skills/higgsfield-websites")" \
|
||||
"$F3/skills-external/higgsfield-websites"
|
||||
expect no-generate "$(yn test -e "$F3/skills/higgsfield-generate")" no
|
||||
expect pack-status "$(tog "$F3" status higgsfield)" disabled
|
||||
expect web-status "$(tog "$F3" status higgsfield-websites)" enabled
|
||||
tog "$F3" disable higgsfield-websites >/dev/null
|
||||
out="$(FAKE_HF_SESSION=out tog "$F3" enable higgsfield-websites)"; rc=$?
|
||||
expect hint-rc "$rc" 0
|
||||
expect_has web-hint "$out" "higgsfield auth login"
|
||||
verdict ENABLE_WEBSITES_ALONE
|
||||
|
||||
# Continues on F2: the pack is enabled, websites is not.
|
||||
tog "$F2" enable higgsfield-websites >/dev/null
|
||||
out="$(tog "$F2" disable higgsfield)"; rc=$?
|
||||
expect rc "$rc" 0
|
||||
expect_has msg "$out" "higgsfield disabled (2 skills parked)"
|
||||
expect parked "$(yn test -L "$F2/skills-disabled/higgsfield-generate")" yes
|
||||
expect unlinked "$(yn test -e "$F2/skills/higgsfield-generate")" no
|
||||
expect web-untouched "$(yn test -e "$F2/skills/higgsfield-websites")" yes
|
||||
out="$(tog "$F2" enable higgsfield)"
|
||||
expect_has restored "$out" "2 restored, 0 linked"
|
||||
tog "$F2" disable higgsfield-websites >/dev/null
|
||||
expect web-parked "$(yn test -L "$F2/skills-disabled/higgsfield-websites")" yes
|
||||
expect pack-on "$(tog "$F2" status higgsfield)" enabled
|
||||
verdict DISABLE_PARKS
|
||||
|
||||
F4="$WORK/f4"; mk_toggle_fx "$F4" "${PACK[@]}"
|
||||
out="$(FAKE_HF_SESSION=out tog "$F4" enable higgsfield)"; rc=$?
|
||||
expect out-rc "$rc" 0
|
||||
expect out-linked "$(yn test -e "$F4/skills/higgsfield-generate")" yes
|
||||
expect_has out-hint "$out" "higgsfield auth login"
|
||||
F5="$WORK/f5"; mk_toggle_fx "$F5" "${PACK[@]}"
|
||||
out="$(FAKE_HF_SESSION=in tog "$F5" enable higgsfield)"
|
||||
expect_not in-quiet "$out" "auth login"
|
||||
expect_not in-no-token "$out" "fixture-token"
|
||||
F6="$WORK/f6"; mk_toggle_fx "$F6" "${PACK[@]}"
|
||||
out="$(TOGGLE_EXTERNAL_REPO_OVERRIDE="$F6" PATH="$CLEAN" \
|
||||
bash "$F6/lib/toggle-external.sh" enable higgsfield 2>&1)"; rc=$?
|
||||
expect absent-rc "$rc" 0
|
||||
expect absent-linked "$(yn test -e "$F6/skills/higgsfield-generate")" yes
|
||||
expect_has absent-hint "$out" "not on PATH"
|
||||
F9="$WORK/f9"; mk_toggle_fx "$F9" "${PACK[@]}"
|
||||
out="$(FAKE_HF_BINARY=missing tog "$F9" enable higgsfield)"; rc=$?
|
||||
expect shim-rc "$rc" 0
|
||||
expect_has shim-hint "$out" "does not answer"
|
||||
expect_not shim-not-login "$out" "auth login"
|
||||
verdict SIGNED_OUT_WARNS
|
||||
|
||||
out="$(tog "$F0" enable higgsfield)"; rc=$?
|
||||
expect pack-rc "$rc" 1
|
||||
expect_has pack-path "$out" "$F0/skills-external"
|
||||
out="$(tog "$F0" enable higgsfield-websites)"; rc=$?
|
||||
expect web-rc "$rc" 1
|
||||
expect_has web-path "$out" "$F0/skills-external/higgsfield-websites"
|
||||
verdict ENABLE_MISSING_ERRS
|
||||
|
||||
# The pack arms are shared with 21st: its behaviour must not move.
|
||||
F7="$WORK/f7"; mk_toggle_fx "$F7" 21st-one 21st-two
|
||||
expect off "$(tog "$F7" status 21st)" disabled
|
||||
out="$(tog "$F7" enable 21st)"
|
||||
expect_has on "$out" "21st enabled (2 skills: 0 restored, 2 linked)"
|
||||
expect_not quiet "$out" "21st login"
|
||||
expect hf-apart "$(tog "$F7" status higgsfield)" missing
|
||||
out="$(tog "$F7" disable 21st)"
|
||||
expect_has parked "$out" "21st disabled (2 skills parked)"
|
||||
verdict PACK_21ST_UNCHANGED
|
||||
|
||||
# ── wiring ──────────────────────────────────────────────────
|
||||
# count <file> <fixed string> — matching lines (0 when none).
|
||||
count() { grep -cF -- "$2" "$ROOT/$1"; }
|
||||
|
||||
# Positive control first: the pattern does bite on a line that carries it.
|
||||
expect control "$(echo 'higgsfield-x external' | grep -cF higgsfield)" 1
|
||||
expect link-sh "$(count link.sh higgsfield)" 0
|
||||
expect profile-sh "$(count lib/profile.sh higgsfield)" 0
|
||||
expect profiles \
|
||||
"$(cat "$ROOT"/lib/profiles/*.profile | grep -cF higgsfield)" 0
|
||||
expect pins-map "$(count lib/effort-pins.txt higgsfield)" 0
|
||||
verdict OFF_BY_DEFAULT_WIRING
|
||||
|
||||
# ── tally ───────────────────────────────────────────────────
|
||||
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
|
||||
|
||||
+107
-26
@@ -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 @@ warn() { echo -e "${YELLOW}⚠${NC} $1"; }
|
||||
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,87 @@ twentyfirst_skills() {
|
||||
done
|
||||
}
|
||||
|
||||
# Media skills of the "higgsfield" pack: an explicit allowlist. Upstream is
|
||||
# unpinned, so a skill it adds or renames must never be linked by
|
||||
# `enable higgsfield` without an edit here (default deny).
|
||||
# higgsfield-websites is its own tool: landing-page aid, named ask only.
|
||||
HIGGSFIELD_MEDIA_SKILLS=(higgsfield-generate higgsfield-soul-id
|
||||
higgsfield-product-photoshoot higgsfield-brandkit
|
||||
higgsfield-marketplace-cards higgsfield-video-explainer
|
||||
higgsfield-youtube-thumbnail)
|
||||
|
||||
# Prints the allowlisted media skills synced under skills-external/.
|
||||
higgsfield_skills() {
|
||||
local name
|
||||
for name in "${HIGGSFIELD_MEDIA_SKILLS[@]}"; do
|
||||
[ -f "$REPO/skills-external/$name/SKILL.md" ] && echo "$name"
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Prints the synced higgsfield-* skills no tool owns: neither on the media
|
||||
# allowlist nor higgsfield-websites. Upstream added or renamed something.
|
||||
higgsfield_unlisted() {
|
||||
local d name
|
||||
for d in "$REPO"/skills-external/higgsfield-*/; do
|
||||
[ -f "${d}SKILL.md" ] || continue
|
||||
name="$(basename "$d")"
|
||||
case " ${HIGGSFIELD_MEDIA_SKILLS[*]} higgsfield-websites " in
|
||||
*" $name "*) ;;
|
||||
*) echo "$name" ;;
|
||||
esac
|
||||
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
|
||||
}
|
||||
|
||||
# bounded <cmd...> — run a CLI probe silently, 15 s at most when `timeout`
|
||||
# exists: a closed-source binary must never hang a toggle, and what it
|
||||
# prints (a token) must never reach the terminal. Twin of
|
||||
# _higgsfield_probe in lib/higgsfield-skills.sh, kept here because this
|
||||
# script takes no extra `source` (the fixture suites copy it alone).
|
||||
bounded() {
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout 15 "$@" </dev/null >/dev/null 2>&1
|
||||
else
|
||||
"$@" </dev/null >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# Post-enable notes for a pack. Its skills shell out to a 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_hints() {
|
||||
local name
|
||||
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)
|
||||
if ! command -v higgsfield >/dev/null 2>&1; then
|
||||
warn "the \`higgsfield\` CLI is not on PATH — run: make plugin"
|
||||
elif ! bounded higgsfield version; then
|
||||
warn "the \`higgsfield\` CLI does not answer (npm shim without its binary) — run: make plugin"
|
||||
elif ! bounded higgsfield auth token; then
|
||||
warn "not signed in to Higgsfield — generation needs: higgsfield auth login"
|
||||
fi
|
||||
while read -r name; do
|
||||
warn "$name is synced but on no allowlist, not linked — see HIGGSFIELD_MEDIA_SKILLS in lib/toggle-external.sh"
|
||||
done < <(higgsfield_unlisted)
|
||||
;;
|
||||
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 +179,7 @@ status_tool() {
|
||||
;;
|
||||
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 +187,12 @@ status_tool() {
|
||||
[ -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 +220,8 @@ disable_tool() {
|
||||
;;
|
||||
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 +230,7 @@ disable_tool() {
|
||||
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 +239,11 @@ disable_tool() {
|
||||
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 +280,8 @@ enable_tool() {
|
||||
;;
|
||||
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" ;;
|
||||
@@ -213,8 +300,9 @@ enable_tool() {
|
||||
err "$tool not installed at $src — run: make plugin"
|
||||
return 1
|
||||
fi
|
||||
if [ "$tool" = "higgsfield-websites" ]; then pack_hints higgsfield; fi
|
||||
;;
|
||||
21st)
|
||||
21st|higgsfield)
|
||||
local restored=0 linked=0
|
||||
while read -r name; do
|
||||
if [ -e "$DISABLED_DIR/$name" ]; then
|
||||
@@ -227,24 +315,17 @@ enable_tool() {
|
||||
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_hints "$tool"
|
||||
;;
|
||||
*) err "Unknown tool: $tool"; return 1 ;;
|
||||
esac
|
||||
@@ -259,7 +340,7 @@ list_all() {
|
||||
}
|
||||
|
||||
usage() {
|
||||
sed -n '3,23p' "$0" | sed 's/^# \?//'
|
||||
sed -n '3,26p' "$0" | sed 's/^# \?//'
|
||||
exit "${1:-0}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user