Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bin/gstack-relink
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ for skill_dir in "$INSTALL_DIR"/*/; do
case "$skill" in bin|browse|design|docs|extension|lib|node_modules|scripts|test|.git|.github) continue ;; esac
[ -f "$skill_dir/SKILL.md" ] || continue

# Read current name: from frontmatter
current_name=$(grep -m1 '^name:' "$skill_dir/SKILL.md" 2>/dev/null | sed 's/^name:[[:space:]]*//' | tr -d '[:space:]')
[ -z "$current_name" ] && current_name="$skill"

if [ "$PREFIX" = "true" ]; then
# Don't double-prefix directories already named gstack-*
case "$skill" in
Expand All @@ -55,6 +59,7 @@ for skill_dir in "$INSTALL_DIR"/*/; do
# Remove old flat symlink if it exists (and isn't the same as the new link)
[ "$link_name" != "$skill" ] && [ -L "$SKILLS_DIR/$skill" ] && rm -f "$SKILLS_DIR/$skill"
else
link_name="$skill"
# Create flat symlink, remove gstack-* if exists
ln -sfn "$INSTALL_DIR/$skill" "$SKILLS_DIR/$skill"
# Don't remove gstack-* dirs that are their real name (e.g., gstack-upgrade)
Expand All @@ -63,6 +68,14 @@ for skill_dir in "$INSTALL_DIR"/*/; do
*) [ -L "$SKILLS_DIR/gstack-$skill" ] && rm -f "$SKILLS_DIR/gstack-$skill" ;;
esac
fi

# Patch SKILL.md name: field to match the linked name so the host agent
# registers the skill under the correct command (fixes #620)
if [ "$link_name" != "$current_name" ]; then
_tmp="$(mktemp)"
sed "1,/^---$/s/^name:.*$/name: $link_name/" "$skill_dir/SKILL.md" > "$_tmp" && mv "$_tmp" "$skill_dir/SKILL.md"
fi

SKILL_COUNT=$((SKILL_COUNT + 1))
done

Expand Down
6 changes: 6 additions & 0 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ link_claude_skill_dirs() {
ln -snf "gstack/$dir_name" "$target"
linked+=("$link_name")
fi
# Patch SKILL.md name: field to match the linked name so Claude Code
# registers the skill under the correct command (e.g., /gstack-qa not /qa)
if [ "$link_name" != "$skill_name" ]; then
_tmp="$(mktemp)"
sed "1,/^---$/s/^name:.*$/name: $link_name/" "$skill_dir/SKILL.md" > "$_tmp" && mv "$_tmp" "$skill_dir/SKILL.md"
fi
fi
done
if [ ${#linked[@]} -gt 0 ]; then
Expand Down