Skip to content
Closed
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
21 changes: 21 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "gstack-marketplace",
"owner": {
"name": "Garry Tan",
"email": "garry@ycombinator.com"
},
"metadata": {
"description": "Garry's Stack — workflow skills for Claude Code. Plan review, code review, shipping, browser automation, and retrospectives.",
"version": "0.0.2"
},
"plugins": [
{
"name": "gstack",
"description": "Complete gstack bundle with all workflow skills: /plan-ceo-review (founder mode), /plan-eng-review (eng manager), /review (paranoid engineer), /ship (release automation), /browse (headless browser QA), /retro (weekly retrospective).",
"version": "0.0.2",
"homepage": "https://github.com/garrytan/gstack",
"license": "MIT",
"source": "./"
}
]
}
13 changes: 13 additions & 0 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "gstack",
"description": "Complete gstack bundle with all workflow skills: /plan-ceo-review (founder mode), /plan-eng-review (eng manager), /review (paranoid engineer), /ship (release automation), /browse (headless browser QA), /retro (weekly retrospective).",
"version": "0.0.2",
"author": {
"name": "Garry Tan",
"email": "garry@ycombinator.com"
},
"homepage": "https://github.com/garrytan/gstack",
"repository": "https://github.com/garrytan/gstack",
"license": "MIT",
"keywords": ["workflow", "planning", "review", "shipping", "browser", "qa", "retrospective"]
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules/
browse/dist/
skills/browse/dist/
/tmp/
*.log
bun.lock
Expand Down
46 changes: 18 additions & 28 deletions BROWSER.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gstack's browser is a compiled CLI binary that talks to a persistent local Chrom

### Lifecycle

1. **First call**: CLI checks `/tmp/browse-server.json` for a running server. None found — it spawns `bun run browse/src/server.ts` in the background. The server launches headless Chromium via Playwright, picks a port (9400-9410), generates a bearer token, writes the state file, and starts accepting HTTP requests. This takes ~3 seconds.
1. **First call**: CLI checks `/tmp/browse-server.json` for a running server. None found — it spawns `bun run skills/browse/src/server.ts` in the background. The server launches headless Chromium via Playwright, picks a port (9400-9410), generates a bearer token, writes the state file, and starts accepting HTTP requests. This takes ~3 seconds.

2. **Subsequent calls**: CLI reads the state file, sends an HTTP POST with the bearer token, prints the response. ~100-200ms round trip.

Expand All @@ -55,7 +55,7 @@ gstack's browser is a compiled CLI binary that talks to a persistent local Chrom
### Key components

```
browse/
skills/browse/
├── src/
│ ├── cli.ts # Thin client — reads state file, sends HTTP, prints response
│ ├── server.ts # Bun.serve HTTP server — routes commands to Playwright
Expand Down Expand Up @@ -160,12 +160,12 @@ The browser automation layer is built on [Playwright](https://playwright.dev/) b
bun install # install dependencies + Playwright Chromium
bun test # run integration tests (~3s)
bun run dev <cmd> # run CLI from source (no compile)
bun run build # compile to browse/dist/browse
bun run build # compile to skills/browse/dist/browse
```

### Dev mode vs compiled binary

During development, use `bun run dev` instead of the compiled binary. It runs `browse/src/cli.ts` directly with Bun, so you get instant feedback without a compile step:
During development, use `bun run dev` instead of the compiled binary. It runs `skills/browse/src/cli.ts` directly with Bun, so you get instant feedback without a compile step:

```bash
bun run dev goto https://example.com
Expand All @@ -174,45 +174,35 @@ bun run dev snapshot -i
bun run dev click @e3
```

The compiled binary (`bun run build`) is only needed for distribution. It produces a single ~58MB executable at `browse/dist/browse` using Bun's `--compile` flag.
The compiled binary (`bun run build`) is only needed for distribution. It produces a single ~58MB executable at `skills/browse/dist/browse` using Bun's `--compile` flag.

### Running tests

```bash
bun test # run all tests
bun test browse/test/commands # run command integration tests only
bun test browse/test/snapshot # run snapshot tests only
bun test # run all tests
bun test skills/browse/test/commands # run command integration tests only
bun test skills/browse/test/snapshot # run snapshot tests only
```

Tests spin up a local HTTP server (`browse/test/test-server.ts`) serving HTML fixtures from `browse/test/fixtures/`, then exercise the CLI commands against those pages. Tests take ~3 seconds.
Tests spin up a local HTTP server (`skills/browse/test/test-server.ts`) serving HTML fixtures from `skills/browse/test/fixtures/`, then exercise the CLI commands against those pages. Tests take ~3 seconds.

### Source map

| File | Role |
|------|------|
| `browse/src/cli.ts` | Entry point. Reads `/tmp/browse-server.json`, sends HTTP to the server, prints response. |
| `browse/src/server.ts` | Bun HTTP server. Routes commands to the right handler. Manages idle timeout. |
| `browse/src/browser-manager.ts` | Chromium lifecycle — launch, tab management, ref map, crash detection. |
| `browse/src/snapshot.ts` | Parses Playwright's accessibility tree, assigns `@ref` labels, builds Locator map. |
| `browse/src/read-commands.ts` | Non-mutating commands: `text`, `html`, `links`, `js`, `css`, `forms`, etc. |
| `browse/src/write-commands.ts` | Mutating commands: `goto`, `click`, `fill`, `select`, `scroll`, etc. |
| `browse/src/meta-commands.ts` | Server management: `status`, `stop`, `restart`. |
| `browse/src/buffers.ts` | In-memory + disk capture for console and network logs. |

### Deploying to the active skill

The active skill lives at `~/.claude/skills/gstack/`. After making changes:

1. Push your branch
2. Pull in the skill directory: `cd ~/.claude/skills/gstack && git pull`
3. Rebuild: `cd ~/.claude/skills/gstack && bun run build`

Or copy the binary directly: `cp browse/dist/browse ~/.claude/skills/gstack/browse/dist/browse`
| `skills/browse/src/cli.ts` | Entry point. Reads `/tmp/browse-server.json`, sends HTTP to the server, prints response. |
| `skills/browse/src/server.ts` | Bun HTTP server. Routes commands to the right handler. Manages idle timeout. |
| `skills/browse/src/browser-manager.ts` | Chromium lifecycle — launch, tab management, ref map, crash detection. |
| `skills/browse/src/snapshot.ts` | Parses Playwright's accessibility tree, assigns `@ref` labels, builds Locator map. |
| `skills/browse/src/read-commands.ts` | Non-mutating commands: `text`, `html`, `links`, `js`, `css`, `forms`, etc. |
| `skills/browse/src/write-commands.ts` | Mutating commands: `goto`, `click`, `fill`, `select`, `scroll`, etc. |
| `skills/browse/src/meta-commands.ts` | Server management: `status`, `stop`, `restart`. |
| `skills/browse/src/buffers.ts` | In-memory + disk capture for console and network logs. |

### Adding a new command

1. Add the handler in `read-commands.ts` (non-mutating) or `write-commands.ts` (mutating)
2. Register the route in `server.ts`
3. Add a test case in `browse/test/commands.test.ts` with an HTML fixture if needed
3. Add a test case in `skills/browse/test/commands.test.ts` with an HTML fixture if needed
4. Run `bun test` to verify
5. Run `bun run build` to compile
39 changes: 19 additions & 20 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,32 @@
bun install # install dependencies
bun test # run integration tests (browse + snapshot)
bun run dev <cmd> # run CLI in dev mode, e.g. bun run dev goto https://example.com
bun run build # compile binary to browse/dist/browse
bun run build # compile binary to skills/browse/dist/browse
```

## Project structure

```
gstack/
├── browse/ # Headless browser CLI (Playwright)
│ ├── src/ # CLI + server + commands
│ ├── test/ # Integration tests + fixtures
│ └── dist/ # Compiled binary
├── ship/ # Ship workflow skill
├── review/ # PR review skill
├── plan-ceo-review/ # /plan-ceo-review skill
├── plan-eng-review/ # /plan-eng-review skill
├── retro/ # Retrospective skill
├── setup # One-time setup: build binary + symlink skills
├── SKILL.md # Browse skill (Claude discovers this)
├── .claude-plugin/ # Plugin marketplace config
│ ├── plugin.json # Plugin manifest
│ └── marketplace.json
├── skills/ # All skills (auto-discovered by plugin system)
│ ├── browse/ # Headless browser CLI (Playwright)
│ │ ├── src/ # CLI + server + commands
│ │ ├── test/ # Integration tests + fixtures
│ │ └── dist/ # Compiled binary
│ ├── ship/ # Ship workflow skill
│ ├── review/ # PR review skill
│ ├── plan-ceo-review/ # /plan-ceo-review skill
│ ├── plan-eng-review/ # /plan-eng-review skill
│ └── retro/ # Retrospective skill
└── package.json # Build scripts for browse
```

## Deploying to the active skill
## Installation

The active skill lives at `~/.claude/skills/gstack/`. After making changes:

1. Push your branch
2. Fetch and reset in the skill directory: `cd ~/.claude/skills/gstack && git fetch origin && git reset --hard origin/main`
3. Rebuild: `cd ~/.claude/skills/gstack && bun run build`

Or copy the binary directly: `cp browse/dist/browse ~/.claude/skills/gstack/browse/dist/browse`
```
/plugin marketplace add garrytan/gstack
/plugin install gstack@gstack-marketplace
```
61 changes: 26 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,18 @@ This is not a prompt pack for beginners. It is an operating system for people wh

## Install

**Requirements:** [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Git](https://git-scm.com/), [Bun](https://bun.sh/) v1.0+. `/browse` compiles a native binary — works on macOS and Linux (x64 and arm64).
**Requirements:** [Claude Code](https://docs.anthropic.com/en/docs/claude-code) v1.0.33+, [Bun](https://bun.sh/) v1.0+ (for `/browse` binary compilation).

### Step 1: Install on your machine
In Claude Code, run:

Open Claude Code and paste this. Claude will do the rest.

> Install gstack: run `git clone https://github.com/garrytan/gstack.git ~/.claude/skills/gstack && cd ~/.claude/skills/gstack && ./setup` then add a "gstack" section to CLAUDE.md that says to use the /browse skill from gstack for all web browsing, never use mcp\_\_claude-in-chrome\_\_\* tools, and lists the available skills: /plan-ceo-review, /plan-eng-review, /review, /ship, /browse, /retro. Then ask the user if they also want to add gstack to the current project so teammates get it.

### Step 2: Add to your repo so teammates get it (optional)

> Add gstack to this project: run `cp -Rf ~/.claude/skills/gstack .claude/skills/gstack && rm -rf .claude/skills/gstack/.git && cd .claude/skills/gstack && ./setup` then add a "gstack" section to this project's CLAUDE.md that says to use the /browse skill from gstack for all web browsing, never use mcp\_\_claude-in-chrome\_\_\* tools, lists the available skills: /plan-ceo-review, /plan-eng-review, /review, /ship, /browse, /retro, and tells Claude that if gstack skills aren't working, run `cd .claude/skills/gstack && ./setup` to build the binary and register skills.

Real files get committed to your repo (not a submodule), so `git clone` just works. The binary and node\_modules are gitignored — teammates just need to run `cd .claude/skills/gstack && ./setup` once to build (or `/browse` handles it automatically on first use).

### What gets installed
```
/plugin marketplace add garrytan/gstack
/plugin install gstack@gstack-marketplace
```

- Skill files (Markdown prompts) in `~/.claude/skills/gstack/` (or `.claude/skills/gstack/` for project installs)
- Symlinks at `~/.claude/skills/browse`, `~/.claude/skills/review`, etc. pointing into the gstack directory
- Browser binary at `browse/dist/browse` (~58MB, gitignored)
- `node_modules/` (gitignored)
- `/retro` saves JSON snapshots to `.context/retros/` in your project for trend tracking
That's it. All six skills are available immediately. The `/browse` binary compiles automatically on first use (~10 seconds).

Everything lives inside `.claude/`. Nothing touches your PATH or runs in the background.
To get automatic updates, enable auto-update for the gstack marketplace: run `/plugin`, go to **Marketplaces**, select **gstack-marketplace**, and choose **Enable auto-update**.

---

Expand Down Expand Up @@ -385,31 +374,33 @@ It saves a JSON snapshot to `.context/retros/` so the next run can show trends.

## Troubleshooting

**Skill not showing up in Claude Code?**
Run `cd ~/.claude/skills/gstack && ./setup` (or `cd .claude/skills/gstack && ./setup` for project installs). This rebuilds symlinks so Claude can discover the skills.
**Skills not showing up?**
Run `/reload-plugins` in Claude Code. If that doesn't help, uninstall and reinstall:
```
/plugin uninstall gstack@gstack-marketplace
/plugin install gstack@gstack-marketplace
/reload-plugins
```

**`/browse` fails or binary not found?**
Run `cd ~/.claude/skills/gstack && bun install && bun run build`. This compiles the browser binary. Requires Bun v1.0+.

**Project copy is stale?**
Re-copy from global: `for s in browse plan-ceo-review plan-eng-review review ship retro; do rm -f .claude/skills/$s; done && rm -rf .claude/skills/gstack && cp -Rf ~/.claude/skills/gstack .claude/skills/gstack && rm -rf .claude/skills/gstack/.git && cd .claude/skills/gstack && ./setup`

**`bun` not installed?**
Install it: `curl -fsSL https://bun.sh/install | bash`
The binary compiles on first use. If it fails, make sure [Bun](https://bun.sh/) v1.0+ is installed: `curl -fsSL https://bun.sh/install | bash`

## Upgrading

Paste this into Claude Code:

> Update gstack: run `cd ~/.claude/skills/gstack && git fetch origin && git reset --hard origin/main && ./setup`. If this project also has gstack at .claude/skills/gstack, update it too: run `for s in browse plan-ceo-review plan-eng-review review ship retro; do rm -f .claude/skills/$s; done && rm -rf .claude/skills/gstack && cp -Rf ~/.claude/skills/gstack .claude/skills/gstack && rm -rf .claude/skills/gstack/.git && cd .claude/skills/gstack && ./setup`
```
/plugin marketplace update gstack-marketplace
/plugin update gstack@gstack-marketplace
/reload-plugins
```

The `setup` script rebuilds the browser binary and re-symlinks skills. It takes a few seconds.
Or enable auto-updates in the `/plugin` Marketplaces tab — Claude Code will update gstack at startup.

## Uninstalling

Paste this into Claude Code:

> Uninstall gstack: remove the skill symlinks by running `for s in browse plan-ceo-review plan-eng-review review ship retro; do rm -f ~/.claude/skills/$s; done` then run `rm -rf ~/.claude/skills/gstack` and remove the gstack section from CLAUDE.md. If this project also has gstack at .claude/skills/gstack, remove it by running `for s in browse plan-ceo-review plan-eng-review review ship retro; do rm -f .claude/skills/$s; done && rm -rf .claude/skills/gstack` and remove the gstack section from the project CLAUDE.md too.
```
/plugin uninstall gstack@gstack-marketplace
/plugin marketplace remove gstack-marketplace
```

## Development

Expand Down
Loading
Loading