Files
gstack/setup
T
Garry Tan e9fbb664f8 refactor: reorganize codebase — move browse CLI to browse/ directory
Restructure project layout: src/ → browse/src/, test/ → browse/test/. Add snapshot testing. Update docs, package.json, and skills integration. Add setup script and TODO tracking.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-11 19:28:50 -07:00

41 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# gstack setup — build browser binary + register all skills with Claude Code
set -e
GSTACK_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILLS_DIR="$(dirname "$GSTACK_DIR")"
# 1. Build browse binary if needed
if [ ! -x "$GSTACK_DIR/browse/dist/browse" ]; then
echo "Building browse binary..."
cd "$GSTACK_DIR" && bun install && bun run build
fi
# 2. Only create skill symlinks if we're inside a .claude/skills directory
SKILLS_BASENAME="$(basename "$SKILLS_DIR")"
if [ "$SKILLS_BASENAME" = "skills" ]; then
linked=()
for skill_dir in "$GSTACK_DIR"/*/; do
if [ -f "$skill_dir/SKILL.md" ]; then
skill_name="$(basename "$skill_dir")"
# Skip browse (handled by root SKILL.md) and node_modules
[ "$skill_name" = "browse" ] || [ "$skill_name" = "node_modules" ] && continue
target="$SKILLS_DIR/$skill_name"
if [ ! -e "$target" ]; then
ln -s "$skill_dir" "$target"
linked+=("$skill_name")
fi
fi
done
echo "gstack ready."
echo " browse: $GSTACK_DIR/browse/dist/browse"
if [ ${#linked[@]} -gt 0 ]; then
echo " linked skills: ${linked[*]}"
fi
else
echo "gstack ready."
echo " browse: $GSTACK_DIR/browse/dist/browse"
echo " (skipped skill symlinks — not inside .claude/skills/)"
fi