forked from bchanot/claude
refactor(toggle-external,profile): one tool roster, split arms, shared gstack helpers
code-clean B5 (enable_tool split into enable_gstack/ enable_external_single/enable_pack), B7 (enable_skill into enable_gstack_skill/enable_linked_skill/enable_plugin_skill), B9 (cmd_show into _show_entries/_show_plain/_show_grouped, `_show_plain` ends with an explicit return 0), B18 (locals), B19 (comment). /refactor C4: tool_kind/tool_source replace the 3 hand-copied name lists with the MANAGED_TOOLS roster (exact-match loop), and disable_* is split to mirror enable_*. /refactor C5: gstack_skills/gstack_parked_names/gstack_park/ gstack_unpark move into lib/gstack-removed.sh, the only sourced file the fixture suites copy, and profile.sh and toggle-external.sh both use them. 496-run golden capture identical; make test 47 green, shellcheck 0.
This commit is contained in:
1 parent
4c966ebdfc
commit
84446612ae
3 files changed
+347
-269
No files matched your search
@@ -19,6 +19,12 @@
|
||||
# house permissions.deny is stricter (BDR-095)
|
||||
# design-shotgun mockups need OPENAI_API_KEY, absent
|
||||
#
|
||||
# Also hosts the gstack helpers the two scripts share (gstack_skills and
|
||||
# the park/unpark moves below). They live in this file because it is the
|
||||
# only one the fixture suites copy next to profile.sh / toggle-external.sh:
|
||||
# a new sourced file would be missing there. Each takes its directories as
|
||||
# arguments (no reliance on the caller's globals).
|
||||
#
|
||||
# No `set -euo pipefail` here (sourced lib, mirrors lib/detect-plugins.sh).
|
||||
# ============================================================
|
||||
|
||||
@@ -33,3 +39,47 @@ gstack_is_removed() {
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# gstack_skills <gstack_src> — prints the directory basenames under
|
||||
# <gstack_src>/*/ that hold a SKILL.md; nothing when the dir is absent.
|
||||
# Source of truth for "which skills belong to gstack".
|
||||
gstack_skills() {
|
||||
local src="$1" d
|
||||
[ -d "$src" ] || return 0
|
||||
for d in "$src"/*/; do
|
||||
[ -f "${d}SKILL.md" ] || continue
|
||||
basename "$d"
|
||||
done
|
||||
}
|
||||
|
||||
# gstack_parked_names <disabled_dir> — prints <name> for every
|
||||
# <disabled_dir>/gstack__<name> entry (a dangling symlink is skipped).
|
||||
gstack_parked_names() {
|
||||
local entry
|
||||
[ -d "$1" ] || return 0
|
||||
for entry in "$1"/gstack__*; do
|
||||
[ -e "$entry" ] || continue
|
||||
basename "$entry" | sed 's/^gstack__//'
|
||||
done
|
||||
}
|
||||
|
||||
# gstack_park <skills_dir> <disabled_dir> <name> — moves skills/<name> to
|
||||
# skills-disabled/gstack__<name>. A stale destination is clobbered first:
|
||||
# gstack ./setup creates skills/<name>/ as directories, so mv onto an
|
||||
# existing dir would nest it (gstack__<name>/<name>/) instead of renaming.
|
||||
# Content is symlinks to the submodule, `gstack ./setup` regenerates it.
|
||||
# Call as a plain statement (never `|| …`, `if`, `!`): errexit must stay on.
|
||||
gstack_park() {
|
||||
local skills_dir="$1" disabled_dir="$2" name="$3"
|
||||
rm -rf "$disabled_dir/gstack__$name"
|
||||
mv "$skills_dir/$name" "$disabled_dir/gstack__$name"
|
||||
}
|
||||
|
||||
# gstack_unpark <skills_dir> <disabled_dir> <name> — moves
|
||||
# skills-disabled/gstack__<name> back to skills/<name>, replacing whatever
|
||||
# sits there. Same plain-statement rule as gstack_park.
|
||||
gstack_unpark() {
|
||||
local skills_dir="$1" disabled_dir="$2" name="$3"
|
||||
rm -rf "${skills_dir:?}/${name:?}"
|
||||
mv "$disabled_dir/gstack__$name" "$skills_dir/$name"
|
||||
}
|
||||
Reference in new issue
Block a user