feat: add local dev mode for testing skills from within the repo

bin/dev-setup creates .claude/skills/gstack symlink to the working tree
so Claude Code discovers skills locally. bin/dev-teardown cleans up.
DEVELOPING_GSTACK.md documents the workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-13 15:36:27 -07:00
parent d30d5eb56e
commit 4899b71e19
4 changed files with 169 additions and 0 deletions
Executable
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Set up gstack for local development — test skills from within this repo.
#
# Creates .claude/skills/gstack → (symlink to repo root) so Claude Code
# discovers skills from your working tree. Changes take effect immediately.
#
# Usage: bin/dev-setup # set up
# bin/dev-teardown # clean up
set -e
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# 1. Create .claude/skills/ inside the repo
mkdir -p "$REPO_ROOT/.claude/skills"
# 2. Symlink .claude/skills/gstack → repo root
# This makes setup think it's inside a real .claude/skills/ directory
GSTACK_LINK="$REPO_ROOT/.claude/skills/gstack"
if [ -L "$GSTACK_LINK" ]; then
echo "Updating existing symlink..."
rm "$GSTACK_LINK"
elif [ -d "$GSTACK_LINK" ]; then
echo "Error: .claude/skills/gstack is a real directory, not a symlink." >&2
echo "Remove it manually if you want to use dev mode." >&2
exit 1
fi
ln -s "$REPO_ROOT" "$GSTACK_LINK"
# 3. Run setup via the symlink so it detects .claude/skills/ as its parent
"$GSTACK_LINK/setup"
echo ""
echo "Dev mode active. Skills resolve from this working tree."
echo "Edit any SKILL.md and test immediately — no copy/deploy needed."
echo ""
echo "To tear down: bin/dev-teardown"
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Remove local dev skill symlinks. Restores global gstack as the active install.
set -e
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
SKILLS_DIR="$REPO_ROOT/.claude/skills"
if [ ! -d "$SKILLS_DIR" ]; then
echo "Nothing to tear down — .claude/skills/ doesn't exist."
exit 0
fi
# Remove individual skill symlinks
removed=()
for link in "$SKILLS_DIR"/*/; do
name="$(basename "$link")"
[ "$name" = "gstack" ] && continue
if [ -L "${link%/}" ]; then
rm "${link%/}"
removed+=("$name")
fi
done
# Remove the gstack symlink
if [ -L "$SKILLS_DIR/gstack" ]; then
rm "$SKILLS_DIR/gstack"
removed+=("gstack")
fi
# Clean up empty dirs
rmdir "$SKILLS_DIR" 2>/dev/null || true
rmdir "$REPO_ROOT/.claude" 2>/dev/null || true
if [ ${#removed[@]} -gt 0 ]; then
echo "Removed: ${removed[*]}"
else
echo "No symlinks found."
fi
echo "Dev mode deactivated. Global gstack (~/.claude/skills/gstack) is now active."