docs: worktree + submodule support, project vs user-level paths

SKILL.md now checks project-level (.claude/skills/) first, then
user-level (~/.claude/skills/). Auto-detects uninitialized submodules
and runs git submodule update --init. README explains worktree behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-11 16:01:08 -07:00
parent 8499173120
commit 16a2fb1abe
2 changed files with 28 additions and 9 deletions
+6 -2
View File
@@ -120,23 +120,27 @@ The browser **persists between calls**. Navigate once, then query as many times
## Install
Just clone it. Claude handles the rest on first use (installs dependencies, compiles the binary).
Just clone it. Claude handles the rest on first use (installs dependencies, compiles the binary, ~10 seconds).
### Option A: Project-level (recommended for teams)
Run this from the root of your git project:
```bash
git submodule add https://github.com/garrytan/gstack-browse.git .claude/skills/gstack-browse
```
Commit the submodule. Everyone who clones your repo gets the browser.
**Worktrees**: New worktrees need `git submodule update --init .claude/skills/gstack-browse` to populate the directory. Claude's auto-setup handles this — it detects an empty submodule and runs the init for you.
### Option B: User-level (personal)
```bash
git clone https://github.com/garrytan/gstack-browse.git ~/.claude/skills/gstack-browse
```
That's it. Next time Claude needs to browse a page, it'll detect the skill, ask to run setup (~10 seconds), and you're live.
Available across all your projects. No per-repo setup.
**Prerequisite**: [Bun](https://bun.sh/) v1.0+ (Claude will tell you if it's missing).
+22 -7
View File
@@ -20,25 +20,40 @@ Every subsequent call: ~100-200ms. Auto-shuts down after 30 min idle.
## SETUP (run this check BEFORE any browse command)
Before using any browse command, check if the binary exists:
Before using any browse command, find the skill and check if the binary exists:
```bash
test -x ~/.claude/skills/gstack-browse/dist/browse && echo "READY" || echo "NEEDS_SETUP"
# Check project-level first, then user-level
if test -x .claude/skills/gstack-browse/dist/browse; then
echo "READY_PROJECT"
elif test -x ~/.claude/skills/gstack-browse/dist/browse; then
echo "READY_USER"
else
echo "NEEDS_SETUP"
fi
```
Set `B` to whichever path is READY and use it for all commands. Prefer project-level if both exist.
If `NEEDS_SETUP`:
1. Tell the user: "gstack-browse needs a one-time setup (bun install + compile CLI binary). This takes ~10 seconds. OK to proceed?" Then STOP and wait for their response.
2. If they approve, run:
1. Tell the user: "gstack-browse needs a one-time setup (~10 seconds). OK to proceed?" Then STOP and wait for their response.
2. If they approve, determine the skill directory (project-level `.claude/skills/gstack-browse` or user-level `~/.claude/skills/gstack-browse`) and run:
```bash
cd ~/.claude/skills/gstack-browse && bun install && bun run build
SKILL_DIR=<whichever path exists>
# If submodule exists but isn't initialized (empty dir, no package.json):
test -f "$SKILL_DIR/package.json" || git submodule update --init "$SKILL_DIR"
# Install and build
cd "$SKILL_DIR" && bun install && bun run build
```
3. If `bun` is not installed, tell the user to install it: `curl -fsSL https://bun.sh/install | bash`
Once setup is done, it never needs to run again (the compiled binary persists).
Once setup is done, it never needs to run again (the compiled binary persists across worktrees that share the same checkout).
## IMPORTANT
- Use `~/.claude/skills/gstack-browse/dist/browse` (compiled binary) via Bash.
- Use the compiled binary via Bash: `.claude/skills/gstack-browse/dist/browse` (project) or `~/.claude/skills/gstack-browse/dist/browse` (user).
- NEVER use `mcp__claude-in-chrome__*` tools. They are slow and unreliable.
- The browser persists between calls — cookies, tabs, and state carry over.
- The server auto-starts on first command. No setup needed.