Skip to content

Bobby-Gray/rehearse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

              ╭─────────────────────────────────────────────────────╮
             ╱  ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___      ╲
            ╱  /   \/   \/   \/   \/   \/   \/   \/   \/   \/   \     ╲
           │     ❀    ❀    ❀    ❀    ❀    ❀    ❀    ❀    ❀    ❀       │
           │                                                           │
           │   )))                                              (((    │
           │   ))))                █                           ((((    │
           │   ))))                ██                          ((((    │
           │   ))))                ███                         ((((    │
           │   ))))                ████                        ((((    │
           │   ))))                █████                       ((((    │
           │   ))))                ██████                      ((((    │
           │   ))))                ████                        ((((    │
           │   ))))                ██ ██                       ((((    │
           │   ))))                   ██                       ((((    │
           │   ))))                   ██                       ((((    │
           │   ))))                    █                       ((((    │
           │   ))))                    │                       ((((    │
           │   ))))                    o                       ((((    │
           │   ))))                   ╱│                       ((((    │
           │   ))))                    │                       ((((    │
           │   ))))                   ╱ ╲                      ((((    │
           │___________________________________________________________│
                 ✦   ✦   ✦   ✦   ✦   ✦   ✦   ✦   ✦   ✦   ✦   ✦   ✦   ✦
                          rehearse production before
                              your users do.

rehearse

A Playwright-backed CLI for Claude (and humans) that diagnoses, validates, and health-checks deployed web apps — from behind Cloudflare Access, GCP IAP, or your app's own auth layer.

The name plays on Playwright: you write the play, then you rehearse it against the real stage before opening night.

What it's for

When something breaks in prod and the only way to know what's happening is to look at the browser, rehearse is the look. Fetch HTML, query the DOM, capture console + network, screenshot, evaluate arbitrary JS, plus drive multi-step interactions — all against a live deploy without leaving the terminal.

Built originally for an agent-driven SRE workflow: deploy gates, 15-min canaries, breakglass triage, and runbook automation. Works equally well for a human at a keyboard.

Features

  • Diagnostic verbs (read-only): fetch, dom, console, network, eval, shot, doctor.
  • Action verbs (drive interactions): click, fill, press, multi-step act scripts in YAML.
  • Declarative flow suites with a tiered methodology (post-deploy gate → 15-min canary → hourly → daily → breakglass) and a real assertion DSL.
  • Cloudflare Access route-scoping — service-token headers attach only to requests for the protected origin, so OAuth providers and CDN preflight don't break.
  • Persistent per-host auth state via rehearse login (system Chrome for OAuth-friendly flows), with a rehearse import-cookies fallback for when Google bot-flags your Playwright Chromium.
  • Stable JSON output on every verb — designed for cron, CI, and agent runners.
  • Plays nicely with curl-based fetches (shells out to bypass Python TLS fingerprinting on Cloudflare WAFs).

Install

Option 1 — Claude Code plugin (recommended)

/plugin marketplace add Bobby-Gray/rehearse
/plugin install rehearse@rehearse

Then make the CLI callable:

mkdir -p ~/.local/bin
ln -sf ~/.claude/plugins/marketplaces/rehearse/skills/rehearse/scripts/rehearse.py ~/.local/bin/rehearse
chmod +x ~/.claude/plugins/marketplaces/rehearse/skills/rehearse/scripts/rehearse.py

Option 2 — Manual install (skill folder only)

git clone https://github.com/Bobby-Gray/rehearse.git /tmp/rehearse
mkdir -p ~/.claude/skills
cp -r /tmp/rehearse/skills/rehearse ~/.claude/skills/
ln -sf ~/.claude/skills/rehearse/scripts/rehearse.py ~/.local/bin/rehearse
chmod +x ~/.claude/skills/rehearse/scripts/rehearse.py
rm -rf /tmp/rehearse

Playwright

Both paths require Playwright + Chromium (once per machine):

pip install playwright pyyaml browser-cookie3
playwright install chromium

browser-cookie3 is only needed if you'll use rehearse import-cookies.

Quick start

# Tell rehearse where prod lives.
export REHEARSE_BASE_URL="https://prod.example.com"
# If you're behind Cloudflare Access:
export REHEARSE_CF_ACCESS_CLIENT_ID=""
export REHEARSE_CF_ACCESS_CLIENT_SECRET=""

# Sanity check the harness.
rehearse doctor

# Look at production.
rehearse fetch /
rehearse dom /dashboard "[data-testid='card']"
rehearse console /broken-route --for 8s
rehearse eval / "document.documentElement.dataset.buildSha"
rehearse shot /dashboard -o /tmp/dashboard.png

# Capture auth state once, then everything below this is authenticated.
rehearse login

# Run a tiered health-flow suite (looks in .rehearse/flows.yaml).
rehearse flow --tier 0          # post-deploy gate
rehearse flow --all             # everything except breakglass
rehearse flow shtf-user-broken --var user_id=abc123    # parametric triage

Full setup walk-through: skills/rehearse/docs/setup.md.

The verbs at a glance

rehearse doctor [--detect-dev]                      # env + Playwright self-check
rehearse fetch /path                                # HTML body, no browser (curl)
rehearse dom /path "selector"                       # innerHTML / attrs of matched nodes
rehearse console /path [--for 5s] [--filter regex]  # capture console.{log,warn,error}
rehearse network /path [--for 5s] [--filter regex]  # capture matching requests + statuses
rehearse eval /path "expression"                    # JSON-stringified result of arbitrary JS
rehearse shot /path [-o /tmp/page.png]              # full-page screenshot
rehearse login                                      # interactive auth capture (one-time)
rehearse import-cookies [--profile NAME]            # pull session cookies from existing Chrome
rehearse flow [name|--tier N|--all] [--var k=v]     # run a declarative health-check suite

# Action verbs — drive interactions; mutate live state.
rehearse click /path "selector" [--wait-before 1s] [--wait-after 5s] [--save-state]
rehearse fill  /path "selector" "value"
rehearse press /path "selector" "Enter"
rehearse act   script.yaml [--var k=v] [--save-state]

Every verb supports --base <url>, --no-cf, --timeout <ms>, and --json. Browser-based verbs additionally support --headed and --slow-mo <duration> for interactive debugging.

Tiered health-flow methodology

rehearse flow runs YAML-defined assertion suites organized by tier. The tier system maps to rehearsal stages — a useful mental model for when each tier runs:

Tier Stage analogue Cadence Failure response
0 Dress rehearsal Post-deploy gate Block traffic shift
1 Warm-up before curtain Every 15 min Page on-call
2 Mid-run check Hourly Open an issue / ticket
3 Final-night review Daily Info-level alert
breakglass Emergency run-through On-demand only Manual triage

Flows live in <project>/.rehearse/flows.yaml. Start from skills/rehearse/flows/_template.yaml.

Full assertion DSL + authoring guide: skills/rehearse/docs/flows.md.

A note on playwright-skill: I discovered playwright-skill only after rehearse had been built and was already in use against real prod traffic. Rehearse grew organically from the specific use cases I hit while operating a CF-Access-fronted SaaS — not as a response to any existing tool. I haven't used playwright-skill personally, so the comparison below is based on reading its source. It looks to be the earlier-released and more popular project, so being explicit about when each tool fits seemed more useful than pretending they don't overlap.

Both wrap Playwright for Claude. They solve different problems:

playwright-skill rehearse
Model Claude writes custom code per task and runs it via a universal executor Pre-built verbs Claude composes
Browsers chromium / firefox / webkit chromium only
Auth gates single global header env var CF Access route-scoping, persistent per-host auth state, Chrome cookie import
Assertions bring-your-own (console.log / expect) declarative DSL (status_in, count_max, no_url_pattern, …)
Cadence story per-script tiered flow suites (post-deploy gate → breakglass)
Output bring-your-own structured --json on every verb
Distribution Claude Code plugin marketplace Claude Code plugin marketplace (this repo)

Use playwright-skill when: testing a localhost dev server, exercising arbitrary browser-automation tasks Claude needs to compose on the fly, working across multiple browser engines, or doing visual / responsive testing that doesn't have a recurring shape.

Use rehearse when: the target is a deployed SaaS behind an enterprise auth gate (Cloudflare Access, GCP IAP, AWS+Cognito), you want a recurring health-check methodology with tiered cadences, or you're wiring browser diagnostics into CI / cron / an agent runner where stable JSON-emitting verbs matter more than per-task code flexibility.

They're complementary, not competitive. If you're testing localhost, use playwright-skill. If you're SRE-ing production, use rehearse.

Docs

Limits / non-goals

  • Not a load tester. One browser, one page, one verb at a time.
  • Not a synthetic monitor. For SLA pinging, reach for Hyperping / Better Stack / Pingdom. rehearse is for exploratory diagnostic when you already know something is wrong (or want to confirm a hypothesis), and for repeatable health flows tied to a known invariant.
  • Headless only by default. Pass --headed for login (must be interactive) and for video-capture-style debugging.
  • Chromium only. Multi-browser support hasn't paid for itself yet given the scope. If you need Firefox / WebKit, use playwright-skill.

Contributing

PRs welcome. Particularly interested in:

  • Linux + Windows cookie-import support (today: macOS Chrome only).
  • First-class GCP IAP bearer-token wiring (today: works via shim env var).
  • More worked examples/act/*.yaml patterns.

Versioning

Current version lives in VERSION; release history in CHANGELOG.md. Pre-1.0 semver: minor bumps may break behavior as the skill stabilizes. Any PR that changes user-visible behavior should bump VERSION and add a CHANGELOG.md entry in the same change.

License

MIT — copy it, fork it, ship it.

About

A Playwright-backed CLI for Claude that diagnoses, validates, and health-checks deployed web apps from behind enterprise auth gates.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages