merge: PR #271 - fix: add --local flag for project-scoped gstack install

This commit is contained in:
Garry Tan
2026-03-22 22:46:16 -07:00
+21 -2
View File
@@ -20,12 +20,14 @@ case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*|Windows_NT) IS_WINDOWS=1 ;;
esac
# ─── Parse --host flag ─────────────────────────────────────────
# ─── Parse flags ──────────────────────────────────────────────
HOST="claude"
LOCAL_INSTALL=0
while [ $# -gt 0 ]; do
case "$1" in
--host) [ -z "$2" ] && echo "Missing value for --host (expected claude, codex, kiro, or auto)" >&2 && exit 1; HOST="$2"; shift 2 ;;
--host=*) HOST="${1#--host=}"; shift ;;
--local) LOCAL_INSTALL=1; shift ;;
*) shift ;;
esac
done
@@ -35,6 +37,18 @@ case "$HOST" in
*) echo "Unknown --host value: $HOST (expected claude, codex, kiro, or auto)" >&2; exit 1 ;;
esac
# --local: install to .claude/skills/ in the current working directory
if [ "$LOCAL_INSTALL" -eq 1 ]; then
if [ "$HOST" = "codex" ]; then
echo "Error: --local is only supported for Claude Code (not Codex)." >&2
exit 1
fi
INSTALL_SKILLS_DIR="$(pwd)/.claude/skills"
mkdir -p "$INSTALL_SKILLS_DIR"
HOST="claude"
INSTALL_CODEX=0
fi
# For auto: detect which agents are installed
INSTALL_CLAUDE=0
INSTALL_CODEX=0
@@ -339,7 +353,12 @@ fi
if [ "$INSTALL_CLAUDE" -eq 1 ]; then
if [ "$SKILLS_BASENAME" = "skills" ]; then
link_claude_skill_dirs "$SOURCE_GSTACK_DIR" "$INSTALL_SKILLS_DIR"
echo "gstack ready (claude)."
if [ "$LOCAL_INSTALL" -eq 1 ]; then
echo "gstack ready (project-local)."
echo " skills: $INSTALL_SKILLS_DIR"
else
echo "gstack ready (claude)."
fi
echo " browse: $BROWSE_BIN"
else
echo "gstack ready (claude)."