feat(profile): activate gstack skills on-demand per profile

gstack stays OFF by default (no per-skill symlink in skills/, zero context
cost). enable_skill now gains a gstack branch: a skill absent from skills/
and skills-disabled/ but present in the skills-external/gstack submodule is
symlinked in on demand when a profile lists it; disable_gstack_not_in()
parks it again on an unrelated profile.

This makes `set full` (which lists 35 gstack skills) work without 35 bogus
"missing — try: bash link.sh" warnings, without abandoning the OFF-by-default
policy. The old remedy message was wrong (link.sh never creates gstack
skills) and is replaced with submodule-aware messages.

Refs BDR-030.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169vjUD1sP9Nx4ZiCa8wvAw
This commit is contained in:
Bastien Chanot 2026-06-24 14:22:36 +02:00
parent 29c4c9ea67
commit 0b92935d6d

View File

@ -45,6 +45,7 @@ set -euo pipefail
REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SKILLS_DIR="$REPO/skills" SKILLS_DIR="$REPO/skills"
DISABLED_DIR="$REPO/skills-disabled" DISABLED_DIR="$REPO/skills-disabled"
GSTACK_SRC="$REPO/skills-external/gstack" # gstack submodule — source of truth for gstack skills
PROFILES_DIR="$REPO/lib/profiles" PROFILES_DIR="$REPO/lib/profiles"
TOGGLE_EXTERNAL="$REPO/lib/toggle-external.sh" TOGGLE_EXTERNAL="$REPO/lib/toggle-external.sh"
ACTIVE_CACHE="$REPO/.active-profile" # statusline reads this — keep fast (single-line file, profile name only) ACTIVE_CACHE="$REPO/.active-profile" # statusline reads this — keep fast (single-line file, profile name only)
@ -247,8 +248,19 @@ enable_skill() {
ok "enabled: $skill" ok "enabled: $skill"
elif [ -e "$SKILLS_DIR/$skill" ]; then elif [ -e "$SKILLS_DIR/$skill" ]; then
: # already enabled — silent : # already enabled — silent
elif [ -d "$GSTACK_SRC/$skill" ]; then
# gstack is OFF by default: its skills live only in the submodule,
# never pre-symlinked into skills/. A profile that lists this gstack
# skill activates it on demand by symlinking the submodule skill dir
# in. disable_gstack_not_in() parks it again when an unrelated profile
# is set. The gstack/bin + browse/dist infra it relies on is created
# by link.sh, independent of this.
ln -sf "$GSTACK_SRC/$skill" "$SKILLS_DIR/$skill"
ok "enabled: $skill (gstack on-demand)"
elif [ ! -d "$GSTACK_SRC" ]; then
warn "missing: $skill — gstack submodule absent, run: git submodule update --init"
else else
warn "missing: $skill — try: bash link.sh" warn "missing: $skillnot found in gstack submodule ($GSTACK_SRC)"
fi fi
;; ;;
external|personal) external|personal)