mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-29 19:34:29 +01:00
gstack's shipping skill now installs as `/gstack-ship`, because Claude Code keeps the name `/ship` for its own built-in and silently drops gstack's. Upgrading removes gstack's old `ship` entry and leaves your own `ship` skill alone. The resume command and most recovery messages now say `/gstack-ship`; nothing to do but upgrade. This replaces #4813, which ran out of budget before its last fixes. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p2/adversarial-native#1 reader=adversarial-native Review-Finding: p2/outside-voice#3 reader=outside-voice Review-Finding: p2/outside-voice#4 reader=outside-voice Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#2 reader=outside-voice Review-Finding: p2/red-team#1 reader=red-team Review-Finding: p3/outside-voice#1 reader=outside-voice Review-Finding: p3/outside-voice#3 reader=outside-voice Review-Finding: p7/outside-voice#1 reader=outside-voice
45 lines
1.7 KiB
Bash
Executable File
45 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# gstack-patch-names — patch name: field in SKILL.md frontmatter for prefix mode
|
|
# Usage: gstack-patch-names <gstack-dir> <true|false|1|0>
|
|
set -euo pipefail
|
|
|
|
GSTACK_DIR="$1"
|
|
DO_PREFIX="$2"
|
|
|
|
# Normalize prefix arg
|
|
case "$DO_PREFIX" in true|1) DO_PREFIX=1 ;; *) DO_PREFIX=0 ;; esac
|
|
# Names are read with a bash builtin loop: no process per skill (#2120).
|
|
. "$(dirname "$0")/gstack-skill-name.sh"
|
|
# GSTACK_PREFIXED_SKILLS: skills whose name keeps gstack- in both modes (#4775).
|
|
if [ -f "$(dirname "$0")/gstack-install-registry.sh" ]; then . "$(dirname "$0")/gstack-install-registry.sh"; fi
|
|
|
|
PATCHED=0
|
|
for skill_dir in "$GSTACK_DIR"/*/; do
|
|
[ -f "$skill_dir/SKILL.md" ] || continue
|
|
dir_name=${skill_dir%/}; dir_name=${dir_name##*/}
|
|
[ "$dir_name" = "node_modules" ] && continue
|
|
gstack_skill_md_name "$skill_dir/SKILL.md"; cur=$GSTACK_SKILL_NAME
|
|
[ -z "$cur" ] && continue
|
|
[ "$cur" = "gstack" ] && continue # never prefix root skill
|
|
if [ "$DO_PREFIX" -eq 1 ]; then
|
|
case "$cur" in gstack-*) continue ;; esac
|
|
new="gstack-$cur"
|
|
else
|
|
case " ${GSTACK_PREFIXED_SKILLS:-} " in
|
|
*" $dir_name "*) # always prefixed (ship, #4775), even from an older render
|
|
case "$cur" in gstack-*) continue ;; esac
|
|
new="gstack-$cur" ;;
|
|
*)
|
|
case "$cur" in gstack-*) ;; *) continue ;; esac
|
|
[ "$dir_name" = "$cur" ] && continue # inherently prefixed (gstack-upgrade)
|
|
new="${cur#gstack-}" ;;
|
|
esac
|
|
fi
|
|
tmp="$(mktemp "${skill_dir}/SKILL.md.XXXXXX")"
|
|
sed "1,/^---$/s/^name:[[:space:]]*${cur}/name: ${new}/" "$skill_dir/SKILL.md" > "$tmp" && mv "$tmp" "$skill_dir/SKILL.md"
|
|
PATCHED=$((PATCHED + 1))
|
|
done
|
|
if [ "$PATCHED" -gt 0 ]; then
|
|
echo " patched name: field in $PATCHED skills"
|
|
fi
|