mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-12 01:00:21 +02:00
feat: Phase 3.5 — cookie import, QA testing, team retro (v0.3.1) (#29)
* Phase 2: Enhanced browser — dialog handling, upload, state checks, snapshots - CircularBuffer O(1) ring buffer for console/network/dialog (was O(n) array+shift) - Async buffer flush with Bun.write() (was appendFileSync) - Dialog auto-accept/dismiss with buffer + prompt text support - File upload command (upload <sel> <file...>) - Element state checks (is visible/hidden/enabled/disabled/checked/editable/focused) - Annotated screenshots with ref labels overlaid (-a flag) - Snapshot diffing against previous snapshot (-D flag) - Cursor-interactive element scan for non-ARIA clickables (-C flag) - Snapshot scoping depth limit (-d N flag) - Health check with page.evaluate + 2s timeout - Playwright error wrapping — actionable messages for AI agents - Fix useragent — context recreation preserves cookies/storage/URLs - wait --networkidle / --load / --domcontentloaded flags - console --errors filter (error + warning only) - cookie-import <json-file> with auto-fill domain from page URL - 166 integration tests (was ~63) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Phase 2: Rewrite SKILL.md as QA playbook + command reference Reorient SKILL.md files from raw command reference to QA-first playbook with 10 workflow patterns (test user flows, verify deployments, dogfood features, responsive layouts, file upload, forms, dialogs, compare pages). Compact command reference tables at the bottom. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Phase 3: /qa skill — systematic QA testing with health scores New /qa skill for systematic web app QA testing. Three modes: - full: 5-10 documented issues with screenshots and repro steps - quick: 30-second smoke test with health score - regression: compare against saved baseline Includes issue taxonomy (7 categories, 4 severity levels), structured report template, health score rubric (weighted across 7 categories), framework detection guidance (Next.js, Rails, WordPress, SPA). Also adds browse/bin/find-browse (DRY binary discovery using git rev-parse), .gstack/ to .gitignore, and updated TODO roadmap. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Bump to v0.3.0 — Phase 2 + Phase 3 changelog Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: cookie-import-browser — Chromium cookie decryption module + tests Pure logic module for reading and decrypting cookies from macOS Chromium browsers (Comet, Chrome, Arc, Brave, Edge). Supports v10 AES-128-CBC encryption with macOS Keychain access, PBKDF2 key derivation, and per-browser key caching. 18 unit tests with encrypted cookie fixtures. * feat: cookie picker web UI + route handler Two-panel dark-theme picker served from the browse server. Left panel shows source browser domains with search and import buttons. Right panel shows imported domains with trash buttons. No cookie values exposed. 6 API endpoints, importedDomains Set tracking, inline clearCookies. * feat: wire cookie-import-browser into browse server Add cookie-picker route dispatch (no auth, localhost-only), add cookie-import-browser to WRITE_COMMANDS and CHAIN_WRITE, add serverPort property to BrowserManager, add write command with two modes (picker UI vs --domain direct import), update CLI help text. * chore: /setup-browser-cookies skill + docs (Phase 3.5) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: bump version and changelog (v0.3.1) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * security: redact sensitive values from command output (PR #21) type no longer echoes text (reports character count), cookie redacts value with ****, header redacts Authorization/Cookie/X-API-Key/X-Auth-Token, storage set drops value, forms redacts password fields. Prevents secrets from persisting in LLM transcripts. 7 new tests. Credit: fredluz (PR #21) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * security: path traversal prevention for screenshot/pdf/eval (PR #26) Add validateOutputPath() for screenshot/pdf/responsive (restricts to /tmp and cwd) and validateReadPath() for eval (blocks .. sequences and absolute paths outside safe dirs). 7 new tests. Credit: Jah-yee (PR #26) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: auto-install Playwright Chromium in setup (PR #22) Setup now verifies Playwright can launch Chromium, and auto-installs it via `bunx playwright install chromium` if missing. Exits non-zero if build or Chromium launch fails. Credit: AkbarDevop (PR #22) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * security: fix path validation bypass, CORS restriction, cookie-import path check - startsWith('/tmp') matched '/tmpevil' — now requires trailing slash - CORS Access-Control-Allow-Origin changed from * to http://127.0.0.1:<port> - cookie-import now validates file paths (was missing validateReadPath) - 3 new tests for prefix collision and cookie-import path traversal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address review informational issues + add regression tests - Add cookie-import to CHAIN_WRITE set for chain command routing - Add path validation to snapshot -a -o output path - Fix package.json version to match 0.3.1 - Use crypto.randomUUID() for temp DB paths (unpredictable filenames) - Add regression tests for chain cookie-import and snapshot path validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add /qa, /setup-browser-cookies to README + update BROWSER.md - Add /qa and /setup-browser-cookies to skills table, install/update/uninstall blurbs - Add dedicated README sections for both new skills with usage examples - Update demo workflow to show cookie import → QA → browse flow - Update BROWSER.md: cookie import commands, new source files, test count (203) - Update skill count from 6 to 8 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: team-aware /retro v2.0 — per-person praise and growth opportunities - Identify current user via git config, orient narrative as "you" vs teammates - Add per-author metrics: commits, LOC, focus areas, commit type mix, sessions - New "Your Week" section with personal deep-dive for whoever runs the command - New "Team Breakdown" with per-person praise and growth opportunities - Track AI-assisted commits via Co-Authored-By trailers - Personal + team shipping streaks - Tone: praise like a 1:1, growth like investment advice, never compare negatively Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Conductor parallel sessions section to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
1b317aae9a
commit
f7b95329c1
+87
-213
@@ -1,254 +1,128 @@
|
||||
---
|
||||
name: browse
|
||||
version: 1.0.0
|
||||
version: 1.1.0
|
||||
description: |
|
||||
Fast web browsing for Claude Code via persistent headless Chromium daemon. Navigate to any URL,
|
||||
read page content, click elements, fill forms, run JavaScript, take screenshots,
|
||||
inspect CSS/DOM, capture console/network logs, and more. ~100ms per command after
|
||||
first call. Use when you need to check a website, verify a deployment, read docs,
|
||||
or interact with any web page. No MCP, no Chrome extension — just fast CLI.
|
||||
Fast headless browser for QA testing and site dogfooding. Navigate any URL, interact with
|
||||
elements, verify page state, diff before/after actions, take annotated screenshots, check
|
||||
responsive layouts, test forms and uploads, handle dialogs, and assert element states.
|
||||
~100ms per command. Use when you need to test a feature, verify a deployment, dogfood a
|
||||
user flow, or file a bug with evidence.
|
||||
allowed-tools:
|
||||
- Bash
|
||||
- Read
|
||||
|
||||
---
|
||||
|
||||
# gstack: Persistent Browser for Claude Code
|
||||
# browse: QA Testing & Dogfooding
|
||||
|
||||
Persistent headless Chromium daemon. First call auto-starts the server (~3s).
|
||||
Every subsequent call: ~100-200ms. Auto-shuts down after 30 min idle.
|
||||
Persistent headless Chromium. First call auto-starts (~3s), then ~100ms per command.
|
||||
State persists between calls (cookies, tabs, login sessions).
|
||||
|
||||
## SETUP (run this check BEFORE any browse command)
|
||||
|
||||
Before using any browse command, find the skill and check if the binary exists:
|
||||
## Core QA Patterns
|
||||
|
||||
### 1. Verify a page loads correctly
|
||||
```bash
|
||||
# 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
|
||||
$B goto https://yourapp.com
|
||||
$B text # content loads?
|
||||
$B console # JS errors?
|
||||
$B network # failed requests?
|
||||
$B is visible ".main-content" # key elements present?
|
||||
```
|
||||
|
||||
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 build (~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` or user-level `~/.claude/skills/gstack`) and run:
|
||||
### 2. Test a user flow
|
||||
```bash
|
||||
cd <SKILL_DIR> && ./setup
|
||||
$B goto https://app.com/login
|
||||
$B snapshot -i # see all interactive elements
|
||||
$B fill @e3 "user@test.com"
|
||||
$B fill @e4 "password"
|
||||
$B click @e5 # submit
|
||||
$B snapshot -D # diff: what changed after submit?
|
||||
$B is visible ".dashboard" # success state present?
|
||||
```
|
||||
3. If `bun` is not installed, tell the user to install it: `curl -fsSL https://bun.sh/install | bash`
|
||||
4. Verify the `.gitignore` in the skill directory contains `browse/dist/` and `node_modules/`. If either line is missing, add it.
|
||||
|
||||
Once setup is done, it never needs to run again (the compiled binary persists).
|
||||
|
||||
## IMPORTANT
|
||||
|
||||
- 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.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### 3. Verify an action worked
|
||||
```bash
|
||||
B=~/.claude/skills/gstack/browse/dist/browse
|
||||
|
||||
# Navigate to a page
|
||||
$B goto https://example.com
|
||||
|
||||
# Read cleaned page text
|
||||
$B text
|
||||
|
||||
# Take a screenshot (then Read the image)
|
||||
$B screenshot /tmp/page.png
|
||||
|
||||
# Snapshot: accessibility tree with refs
|
||||
$B snapshot -i
|
||||
|
||||
# Click by ref (after snapshot)
|
||||
$B click @e3
|
||||
|
||||
# Fill by ref
|
||||
$B fill @e4 "test@test.com"
|
||||
|
||||
# Run JavaScript
|
||||
$B js "document.title"
|
||||
|
||||
# Get all links
|
||||
$B links
|
||||
|
||||
# Click by CSS selector
|
||||
$B click "button.submit"
|
||||
|
||||
# Fill a form by CSS selector
|
||||
$B fill "#email" "test@test.com"
|
||||
$B fill "#password" "abc123"
|
||||
$B click "button[type=submit]"
|
||||
|
||||
# Get HTML of an element
|
||||
$B html "main"
|
||||
|
||||
# Get computed CSS
|
||||
$B css "body" "font-family"
|
||||
|
||||
# Get element attributes
|
||||
$B attrs "nav"
|
||||
|
||||
# Wait for element to appear
|
||||
$B wait ".loaded"
|
||||
|
||||
# Accessibility tree
|
||||
$B accessibility
|
||||
|
||||
# Set viewport
|
||||
$B viewport 375x812
|
||||
|
||||
# Set cookies / headers
|
||||
$B cookie "session=abc123"
|
||||
$B header "Authorization:Bearer token123"
|
||||
$B snapshot # baseline
|
||||
$B click @e3 # do something
|
||||
$B snapshot -D # unified diff shows exactly what changed
|
||||
```
|
||||
|
||||
## Command Reference
|
||||
|
||||
### Navigation
|
||||
```
|
||||
browse goto <url> Navigate current tab
|
||||
browse back Go back
|
||||
browse forward Go forward
|
||||
browse reload Reload page
|
||||
browse url Print current URL
|
||||
### 4. Visual evidence for bug reports
|
||||
```bash
|
||||
$B snapshot -i -a -o /tmp/annotated.png # labeled screenshot
|
||||
$B screenshot /tmp/bug.png # plain screenshot
|
||||
$B console # error log
|
||||
```
|
||||
|
||||
### Content extraction
|
||||
```
|
||||
browse text Cleaned page text (no scripts/styles)
|
||||
browse html [selector] innerHTML of element, or full page HTML
|
||||
browse links All links as "text → href"
|
||||
browse forms All forms + fields as JSON
|
||||
browse accessibility Accessibility tree snapshot (ARIA)
|
||||
### 5. Find all clickable elements (including non-ARIA)
|
||||
```bash
|
||||
$B snapshot -C # finds divs with cursor:pointer, onclick, tabindex
|
||||
$B click @c1 # interact with them
|
||||
```
|
||||
|
||||
### Snapshot (ref-based element selection)
|
||||
```
|
||||
browse snapshot Full accessibility tree with @refs
|
||||
browse snapshot -i Interactive elements only (buttons, links, inputs)
|
||||
browse snapshot -c Compact (no empty structural elements)
|
||||
browse snapshot -d <N> Limit depth to N levels
|
||||
browse snapshot -s <sel> Scope to CSS selector
|
||||
### 6. Assert element states
|
||||
```bash
|
||||
$B is visible ".modal"
|
||||
$B is enabled "#submit-btn"
|
||||
$B is disabled "#submit-btn"
|
||||
$B is checked "#agree-checkbox"
|
||||
$B is editable "#name-field"
|
||||
$B is focused "#search-input"
|
||||
$B js "document.body.textContent.includes('Success')"
|
||||
```
|
||||
|
||||
After snapshot, use @refs as selectors in any command:
|
||||
```
|
||||
browse click @e3 Click the element assigned ref @e3
|
||||
browse fill @e4 "value" Fill the input assigned ref @e4
|
||||
browse hover @e1 Hover the element assigned ref @e1
|
||||
browse html @e2 Get innerHTML of ref @e2
|
||||
browse css @e5 "color" Get computed CSS of ref @e5
|
||||
browse attrs @e6 Get attributes of ref @e6
|
||||
### 7. Test responsive layouts
|
||||
```bash
|
||||
$B responsive /tmp/layout # mobile + tablet + desktop screenshots
|
||||
$B viewport 375x812 # or set specific viewport
|
||||
$B screenshot /tmp/mobile.png
|
||||
```
|
||||
|
||||
Refs are invalidated on navigation — run `snapshot` again after `goto`.
|
||||
|
||||
### Interaction
|
||||
```
|
||||
browse click <selector> Click element (CSS selector or @ref)
|
||||
browse fill <selector> <value> Fill input field
|
||||
browse select <selector> <val> Select dropdown value
|
||||
browse hover <selector> Hover over element
|
||||
browse type <text> Type into focused element
|
||||
browse press <key> Press key (Enter, Tab, Escape, etc.)
|
||||
browse scroll [selector] Scroll element into view, or page bottom
|
||||
browse wait <selector> Wait for element to appear (max 10s)
|
||||
browse viewport <WxH> Set viewport size (e.g. 375x812)
|
||||
### 8. Test file uploads
|
||||
```bash
|
||||
$B upload "#file-input" /path/to/file.pdf
|
||||
$B is visible ".upload-success"
|
||||
```
|
||||
|
||||
### Inspection
|
||||
```
|
||||
browse js <expression> Run JS, print result
|
||||
browse eval <js-file> Run JS file against page
|
||||
browse css <selector> <prop> Get computed CSS property
|
||||
browse attrs <selector> Get element attributes as JSON
|
||||
browse console Dump captured console messages
|
||||
browse console --clear Clear console buffer
|
||||
browse network Dump captured network requests
|
||||
browse network --clear Clear network buffer
|
||||
browse cookies Dump all cookies as JSON
|
||||
browse storage localStorage + sessionStorage as JSON
|
||||
browse storage set <key> <val> Set localStorage value
|
||||
browse perf Page load performance timings
|
||||
### 9. Test dialogs
|
||||
```bash
|
||||
$B dialog-accept "yes" # set up handler
|
||||
$B click "#delete-button" # trigger dialog
|
||||
$B dialog # see what appeared
|
||||
$B snapshot -D # verify deletion happened
|
||||
```
|
||||
|
||||
### Visual
|
||||
```
|
||||
browse screenshot [path] Screenshot (default: /tmp/browse-screenshot.png)
|
||||
browse pdf [path] Save as PDF
|
||||
browse responsive [prefix] Screenshots at mobile/tablet/desktop
|
||||
### 10. Compare environments
|
||||
```bash
|
||||
$B diff https://staging.app.com https://prod.app.com
|
||||
```
|
||||
|
||||
### Compare
|
||||
## Snapshot Flags
|
||||
|
||||
```
|
||||
browse diff <url1> <url2> Text diff between two pages
|
||||
-i Interactive elements only (buttons, links, inputs)
|
||||
-c Compact (no empty structural nodes)
|
||||
-d <N> Limit depth
|
||||
-s <sel> Scope to CSS selector
|
||||
-D Diff against previous snapshot
|
||||
-a Annotated screenshot with ref labels
|
||||
-o <path> Output path for screenshot
|
||||
-C Cursor-interactive elements (@c refs)
|
||||
```
|
||||
|
||||
### Multi-step (chain)
|
||||
```
|
||||
echo '[["goto","https://example.com"],["snapshot","-i"],["click","@e1"],["screenshot","/tmp/result.png"]]' | browse chain
|
||||
```
|
||||
Combine: `$B snapshot -i -a -C -o /tmp/annotated.png`
|
||||
|
||||
### Tabs
|
||||
```
|
||||
browse tabs List tabs (id, url, title)
|
||||
browse tab <id> Switch to tab
|
||||
browse newtab [url] Open new tab
|
||||
browse closetab [id] Close tab
|
||||
```
|
||||
Use @refs after snapshot: `$B click @e3`, `$B fill @e4 "value"`, `$B click @c1`
|
||||
|
||||
### Server management
|
||||
```
|
||||
browse status Server health, uptime, tab count
|
||||
browse stop Shutdown server
|
||||
browse restart Kill + restart server
|
||||
```
|
||||
## Full Command List
|
||||
|
||||
## Speed Rules
|
||||
|
||||
1. **Navigate once, query many times.** `goto` loads the page; then `text`, `js`, `css`, `screenshot` all run against the loaded page instantly.
|
||||
2. **Use `snapshot -i` for interaction.** Get refs for all interactive elements, then click/fill by ref. No need to guess CSS selectors.
|
||||
3. **Use `js` for precision.** `js "document.querySelector('.price').textContent"` is faster than parsing full page text.
|
||||
4. **Use `links` to survey.** Faster than `text` when you just need navigation structure.
|
||||
5. **Use `chain` for multi-step flows.** Avoids CLI overhead per step.
|
||||
6. **Use `responsive` for layout checks.** One command = 3 viewport screenshots.
|
||||
|
||||
## When to Use What
|
||||
|
||||
| Task | Commands |
|
||||
|------|----------|
|
||||
| Read a page | `goto <url>` then `text` |
|
||||
| Interact with elements | `snapshot -i` then `click @e3` |
|
||||
| Check if element exists | `js "!!document.querySelector('.thing')"` |
|
||||
| Extract specific data | `js "document.querySelector('.price').textContent"` |
|
||||
| Visual check | `screenshot /tmp/x.png` then Read the image |
|
||||
| Fill and submit form | `snapshot -i` → `fill @e4 "val"` → `click @e5` → `screenshot` |
|
||||
| Check CSS | `css "selector" "property"` or `css @e3 "property"` |
|
||||
| Inspect DOM | `html "selector"` or `attrs @e3` |
|
||||
| Debug console errors | `console` |
|
||||
| Check network requests | `network` |
|
||||
| Check local dev | `goto http://127.0.0.1:3000` |
|
||||
| Compare two pages | `diff <url1> <url2>` |
|
||||
| Mobile layout check | `responsive /tmp/prefix` |
|
||||
| Multi-step flow | `echo '[...]' \| browse chain` |
|
||||
|
||||
## Architecture
|
||||
|
||||
- Persistent Chromium daemon on localhost (port 9400-9410)
|
||||
- Bearer token auth per session
|
||||
- State file: `/tmp/browse-server.json`
|
||||
- Console log: `/tmp/browse-console.log`
|
||||
- Network log: `/tmp/browse-network.log`
|
||||
- Auto-shutdown after 30 min idle
|
||||
- Chromium crash → server exits → auto-restarts on next command
|
||||
**Navigate:** goto, back, forward, reload, url
|
||||
**Read:** text, html, links, forms, accessibility
|
||||
**Snapshot:** snapshot (with flags above)
|
||||
**Interact:** click, fill, select, hover, type, press, scroll, wait, wait --networkidle, wait --load, viewport, upload, cookie-import, dialog-accept, dialog-dismiss
|
||||
**Inspect:** js, eval, css, attrs, is, console, console --errors, network, dialog, cookies, storage, perf
|
||||
**Visual:** screenshot, pdf, responsive
|
||||
**Compare:** diff
|
||||
**Multi-step:** chain (pipe JSON array)
|
||||
**Tabs:** tabs, tab, newtab, closetab
|
||||
**Server:** status, stop, restart
|
||||
|
||||
Reference in New Issue
Block a user