fix(toggle-external): idempotent enable/disable — clobber stale destination before mv
gstack ./setup now creates skills/<name>/ as directories (with a SKILL.md symlink inside) rather than top-level symlinks. A second disable call used to nest the new dir inside the existing one (gstack__<name>/<name>/), producing "mv: cannot overwrite … Directory not empty" on the third call and breaking `make install` under set -euo pipefail. rm -rf the destination first — contents are symlinks into the submodule and are regenerated by gstack ./setup, so clobbering is safe. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a0fe840743
commit
1017cb549e
@ -78,6 +78,11 @@ disable_tool() {
|
||||
local moved=0
|
||||
while read -r name; do
|
||||
[ -e "$SKILLS_DIR/$name" ] || continue
|
||||
# Clobber any stale destination. gstack ./setup now 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.
|
||||
rm -rf "$DISABLED_DIR/gstack__$name"
|
||||
mv "$SKILLS_DIR/$name" "$DISABLED_DIR/gstack__$name"
|
||||
moved=$((moved + 1))
|
||||
done < <(gstack_skills)
|
||||
@ -85,6 +90,7 @@ disable_tool() {
|
||||
;;
|
||||
emil-design-eng|darwin-skill|find-skills)
|
||||
if [ -e "$SKILLS_DIR/$tool" ]; then
|
||||
rm -rf "${DISABLED_DIR:?}/${tool:?}"
|
||||
mv "$SKILLS_DIR/$tool" "$DISABLED_DIR/$tool"
|
||||
ok "$tool disabled"
|
||||
else
|
||||
@ -105,6 +111,7 @@ enable_tool() {
|
||||
[ -e "$entry" ] || continue
|
||||
local name
|
||||
name="$(basename "$entry" | sed 's/^gstack__//')"
|
||||
rm -rf "${SKILLS_DIR:?}/${name:?}"
|
||||
mv "$entry" "$SKILLS_DIR/$name"
|
||||
moved=$((moved + 1))
|
||||
done
|
||||
@ -117,6 +124,7 @@ enable_tool() {
|
||||
;;
|
||||
emil-design-eng|darwin-skill|find-skills)
|
||||
if [ -e "$DISABLED_DIR/$tool" ]; then
|
||||
rm -rf "${SKILLS_DIR:?}/${tool:?}"
|
||||
mv "$DISABLED_DIR/$tool" "$SKILLS_DIR/$tool"
|
||||
ok "$tool enabled"
|
||||
elif [ -e "$SKILLS_DIR/$tool" ]; then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user