CLI
Every command line starts with rehearse, then the command, then its words and flags.
rehearse <command> [options]The examples on this page ran in the shop fixture from Rehearse’s repository (test/fixtures/shop): a small API with
seven calls, and a report script with one file scenario. Its main branch is the base; a change branch is the head.
Its folder is shown as /work/shop. JSON prints on one line; here it is indented.
Commands
Section titled “Commands”The commands, in the order rehearse --help lists them, each with the JSON contract schema it
prints with --json.
| Command | What it does | JSON |
|---|---|---|
init |
Writes a starter rehearse.yaml in this folder, every block commented. Added in: v0.1.0 |
init |
check |
Checks rehearse.yaml and reads every scenario file, saying what it can’t read and where. Added in: v0.1.0 |
check |
services |
What can come up, how Rehearse knows it is ready, and what is up now. Added in: v0.1.0 | services |
people |
Who you can sign in as, and how real each person is. Tokens are printed only with --json. Added in: v0.1.0 |
people |
worlds |
The named starting states, each with the chain it is built from. Added in: v0.1.0 | worlds |
list |
Lists the scenarios, or, with --affected, those a change reaches and why. Added in: v0.2.0 |
list |
up |
Brings services up and leaves them running, with a world built on them. Added in: v0.2.0 | up |
down |
Stops services Rehearse brought up: in one checkout, or everywhere with --all. Added in: v0.2.0 |
up |
run |
Runs one scenario on a checkout and prints what it observed. Added in: v0.2.0 | observation |
compare |
Runs scenarios on the base and on the head, compares them, and sorts each into a verdict. Added in: v0.2.0 | comparison |
drive |
Drives the product one step at a time for an agent: click, type, key, fill, snapshot, screenshot, stop. Added in: v0.3.0 | drive |
stage |
Serves the stage: every scenario on one page, in Base, Head and Diff, with Works, Doesn’t and a note. Added in: v0.4.0 | stage |
open |
Prints the stage’s address for a scenario, starting the stage when none is running. Added in: v0.4.0 | open |
clean |
Removes base checkouts beyond the budget, and runs and comparisons older than a week. Keeps the cache. Added in: v0.2.0 | clean |
validate |
Checks a JSON or YAML file (or stdin) against one of Rehearse’s schemas, and says what is wrong where. Added in: v0.1.0 | validate |
Flags every command takes
Section titled “Flags every command takes”| Flag | Type | What it does |
|---|---|---|
--json |
switch | Prints one JSON object (schema/v1/<command>.schema.json), and nothing else on stdout. Added in: v0.1.0 |
--manifest |
<file> |
The rehearse.yaml to read. Default: $REHEARSE_MANIFEST, then rehearse.yaml here or above. Added in: v0.1.0 |
--help |
switch | Says how to use the command. Added in: v0.1.0 |
--version |
switch | Given alone, as rehearse --version, prints the version. Added in: v0.1.0 |
rehearse, rehearse help and rehearse --help list the commands. rehearse version is the same as
rehearse --version. With --json, help prints {"v": 1, "usage": "…"} and the version prints
{"v": 1, "version": "…"}.
A flag takes its value as --name value or --name=value. Given twice, the last value counts, except for a flag
marked repeatable, which keeps every value. -- ends the flags: every word after it is a word, not a flag.
A flag a command doesn’t take is a usage error, and the command’s usage follows.
$ rehearse list --foorehearse list takes no `--foo`. It takes --on, --since, --manifest, --affected, --json, --help.
Lists the scenarios, or, with --affected, those a change reaches and why.
Usage: rehearse list [--affected <file>… | --since <ref>] [--on <checkout>] [--json]Which manifest
Section titled “Which manifest”Every command but init reads one rehearse.yaml. Rehearse takes the first of these:
--manifest <file>, relative to the current folder;$REHEARSE_MANIFEST;rehearse.yamlin the current folder, then in each folder above it.
When none is found, the command refuses with the code no_manifest. With --json, it prints the refusal as one
object.
{ "v": 1, "ok": false, "error": { "code": "no_manifest", "says": "No rehearse.yaml here or in a folder above /tmp. Write one with `rehearse init`, or name one with --manifest." }}Rehearse validates the manifest before anything runs, and names a mistake with its line.
$ rehearse checkrehearse.yaml:5: services.api has no field “readdy”.Which checkout
Section titled “Which checkout”A checkout is the product’s folder at one commit. When you don’t name one, Rehearse runs in the first of these:
- the manifest’s
checkout, relative torehearse.yaml; - the top of the git repository that holds
rehearse.yaml; - the folder that holds
rehearse.yaml.
--on on check, people, list, up, down and drive start names a folder.
run --on, and --base and --head on compare and stage, take a folder or a git ref. A value that starts with
./, ../, / or ~/ is a folder. Anything else is a ref: Rehearse checks its commit out as a detached git worktree
under .rehearse/checkouts/<commit>, runs the manifest’s prepare in it once, and reuses it after that. To mean a
folder called main, write ./main.
Output and exit codes
Section titled “Output and exit codes”- stdout gets the command’s answer: words, or one JSON object with
--json. It does so whatever the exit code. - stderr gets progress (a checkout, a service coming up) and, without
--json, a refusal’s words. - With
--json, a refusal is a JSON object on stdout:{"v": 1, "ok": false, "error": {"code", "says"}}. Seeerror.
| Exit | Means |
|---|---|
| 0 | It did what was asked. For compare, the comparison is ok. |
| 1 | It failed: a refusal, a scenario that fails, a file check can’t read, a comparison that isn’t ok. |
| 2 | Usage: a flag, a word or a value it doesn’t take, or one it needs and didn’t get. The usage follows in text. |
When you stop a command with Ctrl-C (or SIGTERM), Rehearse stops the services that command brought up and hasn’t
handed over, then exits 130 (or 143). Services that rehearse up or run --keep left running stay up.
Set REHEARSE_DEBUG=1 to see the stack trace of an error Rehearse didn’t expect (code crashed).
Writes a starter rehearse.yaml in this folder, every block commented.
rehearse init --help prints how to use it.
$ rehearse init --helpWrites a starter rehearse.yaml in this folder, every block commented.
Usage: rehearse init [--force] [--json]It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
--force |
switch; default off | Replaces a rehearse.yaml that is already there. Added in: v0.1.0 |
With --json it prints one init object.
init writes into the current folder. It doesn’t look for a manifest above it.
It exits 0 when it wrote the file, and 1 when a rehearse.yaml is already there and --force isn’t given (code
exists).
The following runs init three times in an empty folder, shown as /work/demo.
$ rehearse initWrote /work/demo/rehearse.yaml.Keep the blocks this repository has, then run `rehearse check`.
$ rehearse init/work/demo/rehearse.yaml is already there. Give --force to replace it.
$ rehearse init --force --json{"v":1,"file":"/work/demo/rehearse.yaml","replaced":true}Checks rehearse.yaml and reads every scenario file, saying what it can’t read and where.
rehearse check --help prints how to use it.
$ rehearse check --helpChecks rehearse.yaml and reads every scenario file, saying what it can't read and where.
Usage: rehearse check [--on <checkout>] [--json]It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
--on |
<checkout>; default the checkout |
The folder to read scenario files from. Added in: v0.1.0 |
With --json it prints one check object.
check reads rehearse.yaml and every scenario file its globs find. It exits 0 when every file reads, and 1 when a
scenario file is refused, or the manifest is.
In the shop fixture, every file reads.
$ rehearse check/work/shop/rehearse.yaml reads well. base main services 1 people 2 worlds 2 stand-ins 1 pieces 0 flows 0 calls 7 files 1In a repository with three files Rehearse can’t read, check lists each, with its line when it knows it, and exits 1.
✗ flows/settings.reach.ts: Rehearse reads a flow module’s default export as plain data, and couldn’t: line 3: “name” needs a value after a colon (a shorthand is code, not a literal).✗ calls/items.hurl:5: the filter nth isn’t read by Rehearse✗ calls/login.hurl:3: [FormParams] isn’t read by Rehearse: it reads Hurl’s plain partservices
Section titled “services”What can come up, how Rehearse knows it is ready, and what is up now.
rehearse services --help prints how to use it.
$ rehearse services --helpWhat can come up, how Rehearse knows it is ready, and what is up now.
Usage: rehearse services [--json]It takes only the flags every command takes.
With --json it prints one services object.
services lists every service in every checkout. Its up and url are shown before their placeholders are filled,
and running lists each copy that is up, one per checkout. It exits 0.
In the shop fixture, with the API up, services prints the following.
$ rehearse servicesapi `node packages/api/server.mjs --port {{port}}` at http://127.0.0.1:{{port}} up: http://127.0.0.1:35245 (/work/shop) stand-ins: paymentsWith --json, it prints the same as one object.
{ "v": 1, "services": [ { "name": "api", "describe": null, "up": "node packages/api/server.mjs --port {{port}}", "cwd": null, "url": "http://127.0.0.1:{{port}}", "port": "auto", "ready": { "http": "http://127.0.0.1:{{port}}/health" }, "down": null, "isolate": { "env": "SHOP_STATE" }, "drive": null, "standins": ["payments"], "running": [ { "checkout": "/work/shop", "url": "http://127.0.0.1:35245", "port": 35245, "pid": 404192, "since": "2026-12-03T20:57:01.677Z" } ] } ]}people
Section titled “people”Who you can sign in as, and how real each person is. Tokens are printed only with --json.
rehearse people --help prints how to use it.
$ rehearse people --helpWho you can sign in as, and how real each person is. Tokens are printed only with --json.
Usage: rehearse people [--on <checkout>] [--json]It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
--on |
<checkout>; default the checkout |
The checkout the sign-in runs in, and whose running services it uses. Added in: v0.1.0 |
With --json it prints one people object.
To learn who gets a token, people runs the manifest’s signIn, then each person’s own token. It prints tokens
only with --json. When signIn names a service that isn’t up in that checkout, people doesn’t run the sign-in
and says why: bring the service up first with rehearse up.
It exits 0, even when the sign-in fails: the reason is in said.
In the shop fixture, people names everyone before the API is up, then signs them in once it is.
$ rehearse peopleowner (default) — local: Runs the shopmember — local: A customer with an accountThe sign-in needs the service api up in /work/shop: `rehearse up api`.
$ rehearse up api…$ rehearse peopleowner (default) — local: Runs the shop · token (16 characters, hidden; --json prints it)member — local: A customer with an account · token (17 characters, hidden; --json prints it)variables: owner_role, member_role, shopWith --json, it prints the tokens too.
{ "v": 1, "people": { "owner": { "role": "owner", "token": "local-owner-0001" }, "member": { "role": "member", "token": "local-member-0002" } }, "variables": { "owner_role": "owner", "member_role": "member", "shop": "main-street" }, "about": { "owner": { "real": "local", "default": true, "describe": "Runs the shop", "signedIn": true }, "member": { "real": "local", "default": false, "describe": "A customer with an account", "signedIn": true } }, "signedIn": true, "said": null}worlds
Section titled “worlds”The named starting states, each with the chain it is built from.
rehearse worlds --help prints how to use it.
$ rehearse worlds --helpThe named starting states, each with the chain it is built from.
Usage: rehearse worlds [--json]It takes only the flags every command takes.
With --json it prints one worlds object.
worlds lists each world with the chain of worlds it is built from. It exits 0.
The shop fixture has two worlds.
$ rehearse worldsempty — No itemsstocked (default) — Three items in stock built from empty → stockedWith --json, it prints the same as one object.
{ "v": 1, "worlds": [ { "name": "empty", "describe": "No items", "extends": null, "chain": ["empty"], "add": null, "default": false }, { "name": "stocked", "describe": "Three items in stock", "extends": "empty", "chain": ["empty", "stocked"], "add": "node seed.mjs {{api_url}}", "default": true } ]}Lists the scenarios, or, with --affected, those a change reaches and why.
rehearse list --help prints how to use it.
$ rehearse list --helpLists the scenarios, or, with --affected, those a change reaches and why.
Usage: rehearse list [--affected <file>… | --since <ref>] [--on <checkout>] [--json]It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
<file>… |
words | With --affected, the files the change touches, relative to the checkout. Added in: v0.2.0 |
--affected |
switch; default off | Lists only the scenarios the files after it reach, each with why. Added in: v0.2.0 |
--since |
<ref> |
Takes the files that differ between <ref> and the checkout, committed, staged, unstaged and untracked. It implies --affected, and adds to any files you name. Added in: v0.2.0 |
--on |
<checkout>; default the checkout |
The folder to read scenarios from. Added in: v0.2.0 |
With --json it prints one list object.
list groups the scenarios by area. With --affected or --since, it lists only those a change reaches.
A change reaches a scenario in these ways:
- The covering rule, for one file: the scenario is reached when the file is its own file, when the file is in the
scenario’s package or in its service’s package, or when the file matches the scenario’s
coversglobs. - With an import graph (the manifest’s
affected.graph, or Ashlar when the checkout has anashlar.config.*and Ashlar is innode_modules/.binor onPATH): the rule applies to each changed file, and to every file the graph says depends on it, directly or not. A changed file the graph doesn’t hold is read as below. - Without a graph, or when the graph fails (
saidsays why): the rule applies to each changed file, and a scenario is also reached when its package, or its service’s package, depends on the changed file’s package, directly or not, in a pnpm, npm or yarn workspace. - A changed file outside every package (a lockfile,
rehearse.yaml) reaches every scenario, unless an import graph holds it: then the graph says what it reaches. - A scenario read beside the manifest that names no
coversis always reached.
A package is the nearest folder with package.json, pyproject.toml, Cargo.toml or go.mod. Workspace links are
read for JavaScript packages only.
It exits 0; 2 when you name files without --affected, or give --affected with no files; and 1 when git can’t find
the --since ref (code git).
In the shop fixture, list shows the seven calls and the file scenario.
$ rehearse list@shop/api call packages/api/items.hurl#The shop says it is up call packages/api/items.hurl#The shop names itself call packages/api/items.hurl#The owner sees every item call packages/api/items.hurl#A member isn't told the admin page exists call packages/api/items.hurl#The count is right call packages/api/items.hurl#The owner finds items by name call packages/api/items.hurl#Nobody is let in without a token
@shop/report file packages/report/weekly.rehearse.yamlA change to the report script reaches only the report’s scenario.
$ rehearse list --affected packages/report/report.mjs1 of 8 scenarios are reached by 1 file.No import graph is here (no Ashlar, no affected.graph), so Rehearse took the touched packages and the packages that depend on them. v1 reads workspace links for JavaScript packages only: other languages’ packages count as folders. file packages/report/weekly.rehearse.yaml it is in @shop/report, which the change touchesWith --json, each scenario carries reachedBy. The following is one entry of rehearse list --since main --json.
{ "id": "packages/report/weekly.rehearse.yaml", "kind": "file", "name": "The weekly stock report lists every item with its price", "file": "packages/report/weekly.rehearse.yaml", "area": "@shop/report", "from": "checkout", "definition": "87bd6a4c805db977", "world": "stocked", "person": "owner", "service": null, "reachedBy": [ "it is in @shop/report, which depends on @shop/api", "it is in @shop/report, which the change touches" ]}Brings services up and leaves them running, with a world built on them.
rehearse up --help prints how to use it.
$ rehearse up --helpBrings services up and leaves them running, with a world built on them.
Usage: rehearse up [<service>…] [--on <checkout>] [--world <name>] [--real <stand-in>]… [--json]It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
<service>… |
words; default every service | The services to bring up. Added in: v0.2.0 |
--on |
<checkout>; default the checkout |
The folder to bring them up in. Added in: v0.2.0 |
--world |
<name>; default defaults.world, else the world marked default |
The world to build. Added in: v0.2.0 |
--real |
<stand-in>, repeatable |
Uses the real dependency in place of that stand-in. The stand-in needs a real entry. Added in: v0.2.0 |
With --json it prints one up object.
In order, up does these things:
- copies the manifest’s
overlayinto the checkout; - keeps to
budget.services: it stops services up in other checkouts until there is room; - runs each world’s
before, from the root of the chain, when a service is coming up; - brings each service up and waits until it is ready;
- runs each world’s
add, from the root of the chain.
A world’s commands get $REHEARSE_URL, the default service’s URL once it is up, as they do in a run or a comparison,
so a world written with worldMain needs no --url. A service already up in that
checkout is left as it is, and the world isn’t built again on it.
It exits 0. It exits 1 when a service doesn’t come up (code service), a world doesn’t build (world) or isn’t
declared (no_world), a service isn’t declared (no_service), or a stand-in has no real one (no_real). It exits 2
when --real names no stand-in.
In the shop fixture, up brings the API up with its default world.
$ rehearse upapi is up at http://127.0.0.1:35245 (pid 404192)World: stocked.Stop with `rehearse down`.Progress goes to stderr: Bringing api up in /work/shop: node packages/api/server.mjs --port 35245, then
api is ready at http://127.0.0.1:35245 (268 ms).
The following is rehearse up api --world empty --real payments --json. A stand-in replaced by the real one shows as
<name>:real.
{ "v": 1, "checkout": "/work/shop", "world": "empty", "services": [ { "name": "api", "checkout": "/work/shop", "url": "http://127.0.0.1:43679", "port": 43679, "pid": 405692, "since": "2026-12-03T20:57:47.052Z", "standins": ["payments:real"] } ]}Stops services Rehearse brought up: in one checkout, or everywhere with --all.
rehearse down --help prints how to use it.
$ rehearse down --helpStops services Rehearse brought up: in one checkout, or everywhere with --all.
Usage: rehearse down [<service>…] [--on <checkout>] [--all] [--json]It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
<service>… |
words; default every one up in the checkout | The services to stop. Added in: v0.2.0 |
--on |
<checkout>; default the checkout |
The checkout to stop them in. Added in: v0.2.0 |
--all |
switch; default off | Stops what Rehearse brought up in every checkout. Added in: v0.2.0 |
With --json it prints one up object.
To stop a service, Rehearse runs its down command when it has one, ends its process group (SIGTERM, then SIGKILL
after 5 seconds), and removes its scratch folder. With --json and --all, checkout is null; world is always
null. It exits 0.
The following stops the shop’s API, then finds nothing left to stop.
$ rehearse downapi is down (/work/shop)
$ rehearse downNothing Rehearse brought up is running.Runs one scenario on a checkout and prints what it observed.
rehearse run --help prints how to use it.
$ rehearse run --helpRuns one scenario on a checkout and prints what it observed.
Usage: rehearse run <scenario> [--on <checkout|ref>] [--world <name>] [--as <person>] [--real <stand-in>]… [--keep] [--json]It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
<scenario> |
word, required | The scenario’s id, as rehearse list shows it. When no id matches, the first scenario whose id ends with it, or whose name is it, runs. Added in: v0.2.0 |
--on |
<checkout|ref>; default the checkout |
Where to run it. A ref is checked out under .rehearse/checkouts/. Added in: v0.2.0 |
--world |
<name>; default the scenario’s own |
Runs it from this world. Added in: v0.2.0 |
--as |
<person>; default the scenario’s own |
Runs it as this person. Added in: v0.2.0 |
--real |
<stand-in>, repeatable |
Uses the real dependency in place of that stand-in. Added in: v0.2.0 |
--keep |
switch; default off | Leaves the services it brought up running. Stop them with rehearse down. Added in: v0.2.0 |
With --json it prints one observation object.
run copies the overlay in, brings up the services the scenario needs (all of them when its world adds anything, and
the sign-in’s service), builds the world, signs in, runs the scenario, and stops what it brought up. It uses services
already up in that checkout when they hold the same world. When they hold another world, it doesn’t run the scenario
and says so: stop them with rehearse down, or give --world.
Rehearse keeps an observation of a clean commit in the baseline cache, so a later compare can read it.
It exits 0 when the scenario passes; 1 when it fails or couldn’t run, or no scenario has that id (code
no_scenario); and 2 when no scenario is named.
The following runs one call that passes and one that fails.
$ rehearse run "packages/api/items.hurl#The owner sees every item"✓ The owner sees every item (packages/api/items.hurl#The owner sees every item) on /work/shop at bfa1a3d5b868 · world stocked · as owner GET /items as owner → 200 stand-ins: payments (fake)
$ rehearse run "packages/api/items.hurl#The count is right"✗ The count is right (packages/api/items.hurl#The count is right) on /work/shop at bfa1a3d5b868 · world stocked · as owner GET /items/count as owner → 200 stand-ins: payments (fake) line 30: jsonpath "$.count" == 3 expected 3, got 2With --json, the failing run prints this observation.
{ "v": 1, "ok": false, "scenario": { "id": "packages/api/items.hurl#The count is right", "kind": "call", "name": "The count is right", "file": "packages/api/items.hurl", "line": 26, "area": "@shop/api", "from": "checkout", "definition": "aa6cb16c288d575a" }, "checkout": { "path": "/work/shop", "ref": null, "commit": "bfa1a3d5b868111551e3b7912257f1390d5efd7e", "dirty": false }, "world": "stocked", "person": "owner", "standins": [ { "name": "payments", "replaces": "The payment provider", "by": "packages/api/server.mjs (its fake provider)", "fidelity": "fake", "real": false } ], "failures": [{ "line": 30, "text": "jsonpath \"$.count\" == 3", "expected": "3", "got": "2" }], "broke": null, "observed": { "kind": "call", "request": "GET /items/count", "who": "owner", "status": 200, "contentType": "application/json", "body": { "count": 2 }, "tries": [], "before": 4 }, "artifacts": [], "ms": 27, "at": "2026-12-03T20:57:37.295Z", "rehearse": "1.0.0", "runner": "call/2", "cacheKey": null, "cached": false}before: 4 says four earlier calls in the file ran first, since a call’s answer can depend on what they did.
cacheKey is null here because the run used a service someone else left up: Rehearse can’t vouch for its state, so
it doesn’t cache what ran on it.
compare
Section titled “compare”Runs scenarios on the base and on the head, compares them, and sorts each into a verdict.
rehearse compare --help prints how to use it.
$ rehearse compare --helpRuns scenarios on the base and on the head, compares them, and sorts each into a verdict.
Usage: rehearse compare [<scenario>…] [--affected] [--base <ref|checkout>] [--head <ref|checkout>] [--announce <file>] [--said <scenario>]… [--world <name>] [--as <person>] [--real <stand-in>]… [--fresh] [--json]
The base defaults to the manifest's base branch; the head to this checkout as it is now.Scenario ids may be globs: 'apps/api/**'. It exits 0 when nothing fails on the head or changed without saying so.It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
<scenario>… |
words; default every scenario | Scenario ids, or globs over ids (* stops at /, ** doesn’t): 'packages/api/**'. Added in: v0.2.0 |
--affected |
switch; default off | Compares only the scenarios the change between base and head reaches, as list --affected decides, with the files git says differ (untracked ones too). Added in: v0.2.0 |
--base |
<ref|checkout>; default the manifest’s base |
The base. Added in: v0.2.0 |
--head |
<ref|checkout>; default this checkout as it is now, uncommitted changes included |
The head. Added in: v0.2.0 |
--announce |
<file>; default .rehearse/announce.yaml beside rehearse.yaml, when it is there |
The announcement to read, relative to the current folder. Added in: v0.2.0 |
--said |
<scenario>, repeatable |
Counts a scenario (an id or a glob) as announced, with the line “Said on the command line.” Added in: v0.2.0 |
--world |
<name>; default each scenario’s own |
Runs every scenario from this world. Added in: v0.2.0 |
--as |
<person>; default each scenario’s own |
Runs every scenario as this person. Added in: v0.2.0 |
--real |
<stand-in>, repeatable |
Uses the real dependency in place of that stand-in, on both sides. Added in: v0.2.0 |
--fresh |
switch; default off | Doesn’t read the cache: both sides run again. Added in: v0.2.0 |
With --json it prints one comparison object.
Each scenario gets one verdict. When more than one applies, the first in this list wins.
| Verdict | Words | Means |
|---|---|---|
fails |
fails on the head | Its own checks fail on the head. failsOnBase says it fails on the base too. |
new |
new | The base doesn’t have it. |
unsaid |
changed without saying so | What it observed changed, and nothing said it would. |
said |
changed and said so | It changed, and the change announced it, or its own definition was edited. |
same |
as on the base | Nothing it observed changed. |
A comparison runs this way:
- The head’s
rehearse.yamldrives both sides. Its commands run in each checkout. - The base is checked out under
.rehearse/checkouts/<commit>and prepared once. If it can’t be checked out or prepared, or its services don’t come up, the comparison says so once (base.ok: false) and gives no verdicts. - The base runs first, and runs only the scenarios the head still has. One gone from the head is listed under
gone, never run. - Observations of a clean commit are cached under
.rehearse/cache/. A later comparison reads them instead of running them again, and says so. A side with uncommitted changes is never cached. Scenarios that share services in one world are cached, and run, as a group. - A scenario read beside the manifest (a path starting with
./) is the same file on both sides: it is nevernewand never edited. Only an announcement says it changed.
Rehearse keeps each comparison in .rehearse/compare/<time>/comparison.json, with each observation beside it, and in
.rehearse/compare/latest.json. When you name scenarios or give --affected, it goes to latest-partial.json
instead, never to latest.json, even when the base doesn’t come up. The stage reads both, and for each scenario shows
the newer.
A comparison of every scenario also checks the announcement. An entry that names no scenario at all (none compared,
gone or not run) is listed under refused, with “The announcement names X, which matches no scenario compared.” It
doesn’t change the exit code.
It exits 0 when the comparison is ok: both sides came up, every scenario ran, and nothing fails on the head or changed without saying so. It exits 1 otherwise, including for a scenario that fails on both sides, and 2 when the base and the head are the same checkout.
In the shop fixture, the change branch slips twice, edits two calls, adds one, drops one and breaks one.
$ rehearse compare2 as on the base · 1 new · 2 changed and said so (2 edited) · 2 changed without saying so · 1 fails on the head · 1 gone
changed without saying so: The owner sees every item (packages/api/items.hurl:14) $.items[*].price: 3.5 → "3.50" (3 places) The weekly stock report lists every item with its price (packages/report/weekly.rehearse.yaml) weekly.csv column 3 "price": "3.5" → "3.50" (2 places)
fails on the head: The count is right (packages/api/items.hurl:26) $.count: 3 → 2 line 30: jsonpath "$.count" == 3 · expected 3, got 2
changed and said so: The shop names itself (packages/api/items.hurl:8) — its definition was edited $.name: "Shop" → "The Shop" A member isn't told the admin page exists (packages/api/items.hurl:21) — its definition was edited status: 404 → 403 $.error.code: "not_found" → "forbidden"
new: The owner finds items by name (packages/api/items.hurl:33)
unannounced, by what changed: $.items[*].price — in 1 scenario weekly.csv column 3 "price" — in 1 scenario
gone from the head: The legacy ping answers (packages/api/items.hurl)
8 ids, times and opaque values were set aside before comparing.Stand-ins: payments (fake, for The payment provider).The following .rehearse/announce.yaml announces the two price changes, and names one scenario that stays as it is.
changes: - scenario: 'packages/api/items.hurl#The owner sees every item' why: Prices are now strings with two decimals. - scenario: 'packages/report/*.rehearse.yaml' why: The weekly report prints prices with two decimals. - scenario: 'packages/api/items.hurl#Nobody is let in without a token' why: Checking that this one stays as it is.The next comparison reads the base from the cache.
$ rehearse compare2 as on the base · 1 new · 4 changed and said so (2 announced, 2 edited) · 1 fails on the head · 1 gone
fails on the head: The count is right (packages/api/items.hurl:26) $.count: 3 → 2 line 30: jsonpath "$.count" == 3 · expected 3, got 2
changed and said so: The shop names itself (packages/api/items.hurl:8) — its definition was edited $.name: "Shop" → "The Shop" The owner sees every item (packages/api/items.hurl:14) — announced: Prices are now strings with two decimals. $.items[*].price: 3.5 → "3.50" (3 places) A member isn't told the admin page exists (packages/api/items.hurl:21) — its definition was edited status: 404 → 403 $.error.code: "not_found" → "forbidden" The weekly stock report lists every item with its price (packages/report/weekly.rehearse.yaml) — announced: The weekly report prints prices with two decimals. weekly.csv column 3 "price": "3.5" → "3.50" (2 places)
new: The owner finds items by name (packages/api/items.hurl:33)
gone from the head: The legacy ping answers (packages/api/items.hurl)
announced, but as on the base: packages/api/items.hurl#Nobody is let in without a token — Checking that this one stays as it is.
8 ids, times and opaque values were set aside before comparing.Stand-ins: payments (fake, for The payment provider).7 base observations came from the cache (dd60eefb0253).It still exits 1: one scenario fails on the head. The following is the JSON of a smaller comparison,
rehearse compare 'packages/api/items.hurl#The count is right' 'packages/report/**' --json.
{ "v": 1, "ok": false, "base": { "checkout": { "path": "/work/shop/.rehearse/checkouts/dd60eefb0253", "ref": "main", "commit": "dd60eefb025321602821762eeddfc9c06d3485e6", "dirty": false }, "ok": true, "step": null, "says": null, "cached": 1 }, "head": { "checkout": { "path": "/work/shop", "ref": null, "commit": "bfa1a3d5b868111551e3b7912257f1390d5efd7e", "dirty": false }, "ok": true, "step": null, "says": null, "cached": 1 }, "line": "0 as on the base · 1 changed and said so (1 announced) · 1 fails on the head", "counts": { "same": 0, "said": 1, "announced": 1, "edited": 0, "unsaid": 0, "new": 0, "fails": 1, "failsOnBoth": 0, "gone": 0, "notRun": 0 }, "scenarios": [ { "scenario": { "id": "packages/api/items.hurl#The count is right", "kind": "call", "name": "The count is right", "file": "packages/api/items.hurl", "line": 26, "area": "@shop/api", "from": "checkout", "definition": "aa6cb16c288d575a" }, "verdict": "fails", "changed": true, "said": null, "edited": false, "why": null, "failsOnBase": false, "failsOnHead": true, "differences": [{ "path": "$.count", "base": "3", "head": "2", "count": 1 }], "setAside": {}, "failures": [{ "line": 30, "text": "jsonpath \"$.count\" == 3", "expected": "3", "got": "2" }], "baseFailures": [], "cached": false, "observations": { "base": "/work/shop/.rehearse/compare/2026-12-03T20-58-05-772Z/base/258686013d015253.json", "head": "/work/shop/.rehearse/compare/2026-12-03T20-58-05-772Z/head/258686013d015253.json" } }, { "scenario": { "id": "packages/report/weekly.rehearse.yaml", "kind": "file", "name": "The weekly stock report lists every item with its price", "file": "packages/report/weekly.rehearse.yaml", "area": "@shop/report", "from": "checkout", "definition": "87bd6a4c805db977" }, "verdict": "said", "changed": true, "said": "announced", "edited": false, "why": "The weekly report prints prices with two decimals.", "failsOnBase": false, "failsOnHead": false, "differences": [ { "path": "weekly.csv column 3 \"price\"", "base": "\"3.5\"", "head": "\"3.50\"", "count": 2 } ], "setAside": {}, "failures": [], "baseFailures": [], "cached": true, "observations": { "base": "/work/shop/.rehearse/compare/2026-12-03T20-58-05-772Z/base/0b004100d6c5506a.json", "head": "/work/shop/.rehearse/compare/2026-12-03T20-58-05-772Z/head/0b004100d6c5506a.json" } } ], "notRun": [], "gone": [], "announcedUnchanged": [], "byChange": [], "standins": [ { "name": "payments", "replaces": "The payment provider", "by": "packages/api/server.mjs (its fake provider)", "fidelity": "fake", "real": false } ], "refused": [], "ms": 1226}Drives the product one step at a time for an agent: click, type, key, fill, snapshot, screenshot, stop.
rehearse drive --help prints how to use it.
$ rehearse drive --helpDrives the product one step at a time for an agent: click, type, key, fill, snapshot, screenshot, stop.
Usage: rehearse drive <step> [--json]
rehearse drive start [--service <name> | --piece <id>] [--world <name>] [--as <person>] [--on <checkout>] [--start <path>] [--scheme light|dark] Brings the service up and opens it, signed in as the person; it stays up until stop. A service with its own driver (drive: in rehearse.yaml) is driven through it. rehearse drive click --name <name> [--role <role>] rehearse drive fill --name <name> [--role <role>] --with <text> rehearse drive type <text> rehearse drive key <key> Enter, Escape, Meta+k, ControlOrMeta+j… rehearse drive snapshot [--name <name> [--role <role>]] rehearse drive screenshot <file.png> rehearse drive stop
Each answers in the drive result shape (schema/v1/drive.schema.json): 0 done, 1 failed, 2 usage.It takes one step at a time.
| Step | Takes | What it does |
|---|---|---|
start |
--service, --piece, --world, --as, --on, --start, --scheme |
Brings the service up, opens it signed in as the person, and keeps it open until stop. Added in: v0.3.0 |
click |
--name, --role |
Clicks the one element with that accessible name. Added in: v0.3.0 |
type |
<text> |
Types the text into whatever has focus. Added in: v0.3.0 |
key |
<key> |
Presses one key, named as Playwright names it: Enter, Escape, Meta+k, ControlOrMeta+j. Added in: v0.3.0 |
fill |
--name, --role, --with |
Fills a field by its name. Rehearse’s browser only: a service’s own driver refuses it. Added in: v0.3.0 |
snapshot |
--name, --role |
Prints the accessibility tree: of the whole page, or of the one element named. Added in: v0.3.0 |
screenshot |
<file.png> |
Saves a PNG, relative to the folder you ran the command in. Added in: v0.3.0 |
record |
<file.webm> |
Passed to a service’s own driver. Rehearse’s browser refuses it: it doesn’t record video yet. Added in: v0.3.0 |
stop |
nothing | Closes the browser and stops what start brought up. Added in: v0.3.0 |
The steps take these flags.
| Flag | Type and default | What it does |
|---|---|---|
--service |
<name>; default scenarios.flows.service, else the default service |
The service to drive. Added in: v0.3.0 |
--piece |
<id> |
Drives that piece’s canvas, in Rehearse’s browser, instead of a service. Added in: v0.3.0 |
--world |
<name>; default defaults.world |
The world to build when start brings the service up. Added in: v0.3.0 |
--as |
<person>; default defaults.person |
The person to sign in as. Added in: v0.3.0 |
--on |
<checkout>; default the checkout |
The folder to drive. Added in: v0.3.0 |
--start |
<path>; default / |
The path start opens. Added in: v0.3.0 |
--scheme |
light|dark; default $DRIVE_SCHEME, else light |
Drives Rehearse’s browser in the light or dark colour scheme. A service’s own driver may read DRIVE_SCHEME too. Added in: v0.5.0 |
--name |
<name> |
The element’s accessible name. Added in: v0.3.0 |
--role |
<role> |
Narrows --name to an ARIA role, such as button, link or textbox, so it needs --name. Added in: v0.3.0 |
--with |
<text> |
The text fill puts in the field. Added in: v0.3.0 |
With --json it prints one drive object.
A name matches when it is the same once spaces are tidied; case counts. When nothing matches, the answer lists up to
five names close to it. When more than one element matches, give --role.
start drives one of these:
- With
--piece <id>: that piece’s canvas, in Rehearse’s browser. - Otherwise the service named by
--service, elsescenarios.flows.service, else the default service. When that service has adrivecommand, each step goes through it: Rehearse runs<drive> <step> … --jsonin the service’s folder and reads the last line it prints. Such a driver can’t sign in as a person: the answer says so insaid. - Otherwise Rehearse’s browser: a headless Chromium kept open by a small daemon on 127.0.0.1.
startbrings the service up when it isn’t up in that checkout (running the world’sbefore, then itsadd), signs in as--aswith the person’sbrowserentry, fixes the clock at 2026-01-15T12:00:00Z, and opens--start. It waits up to 120 seconds; its log is.rehearse/logs/drive.log.
One drive runs at a time per manifest.
Every step answers in the drive shape, even a usage error: {ok, command, ms, file, tree}
or {ok: false, command, ms, failure, says}, plus v and driver. A refusal outside the steps, such as a manifest
Rehearse can’t read or a service that doesn’t come up for its own driver, prints the
error shape. It exits 0 when the step is done; 1 when it failed (not_found, ambiguous,
not_running, timed_out, crashed); and 2 for usage.
The shop’s API has no web page, so the following opens one of its JSON answers.
$ rehearse drive start --service api --start /about$ rehearse drive snapshot- text: "{\"name\":\"The Shop\",\"payments\":\"fake\"}"$ rehearse drive click --name SaveNothing on screen is named “Save”.start prints nothing in words when it succeeds, and click exits 1. The same steps, and more, print the following
with --json.
$ rehearse drive snapshot --json{"v":1,"ok":true,"command":"snapshot","ms":150,"file":null,"tree":"- text: \"{\\\"name\\\":\\\"The Shop\\\",\\\"payments\\\":\\\"fake\\\"}\"","driver":"browser"}$ rehearse drive click --name Save --json{"v":1,"ok":false,"command":"click","ms":7,"failure":"not_found","says":"Nothing on screen is named “Save”.","driver":"browser"}$ rehearse drive screenshot ../about.png --json{"v":1,"ok":true,"command":"screenshot","ms":23,"file":"/work/about.png","tree":null,"driver":"browser"}$ rehearse drive key Ctrl+k --json{"v":1,"ok":false,"command":"key","ms":0,"failure":"usage","says":"Drive can't press Ctrl+k: name it as Playwright does, such as Enter or Meta+k.","driver":null}$ rehearse drive start --json{"v":1,"ok":false,"command":"start","ms":63,"failure":"usage","says":"Rehearse is already driving api in /work/shop: `rehearse drive stop` first.","driver":"browser"}$ rehearse drive stop --json{"v":1,"ok":true,"command":"stop","ms":0,"file":null,"tree":null,"driver":"browser"}$ rehearse drive snapshot --json{"v":1,"ok":false,"command":"snapshot","ms":72,"failure":"not_running","says":"Nothing is being driven: start with `rehearse drive start`.","driver":null}$ rehearse drive stop --json{"v":1,"ok":true,"command":"stop","ms":61,"file":null,"tree":null,"driver":null,"said":null}A usage error names its step in command when the first word is one (key above), else null. stop with nothing
driven is done, with driver: null, so an agent can stop first to start clean.
Serves the stage: every scenario on one page, in Base, Head and Diff, with Works, Doesn’t and a note.
rehearse stage --help prints how to use it.
$ rehearse stage --helpServes the stage: every scenario on one page, in Base, Head and Diff, with Works, Doesn't and a note.
Usage: rehearse stage [--base <ref|checkout>] [--head <ref|checkout>] [--port <port>]
It runs until you stop it (Ctrl-C), and stops the services it brought up.It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
--base |
<ref|checkout>; default the manifest’s base |
The base. Added in: v0.4.0 |
--head |
<ref|checkout>; default this checkout as it is now |
The head. Added in: v0.4.0 |
--port |
<port>; default 4400, or a free port when 4400 is taken |
The port, from 1 to 65535. A port given that is taken is refused. Added in: v0.4.0 |
With --json it prints one stage object.
The stage listens on 127.0.0.1 only, and runs until you stop it with Ctrl-C or kill <pid>. It then stops the
services and piece servers it started. One stage runs per repository: a second is refused, naming the first one’s
address and pid.
While it runs, .rehearse/stage.json holds its address and pid, so open finds it. It shows the verdicts of
the latest comparison of every scenario (.rehearse/compare/latest.json), with any later comparison of a few
(latest-partial.json) folded over it: for each scenario, the newer counts. Only a comparison of this base and this
head counts. With no comparison of every scenario, its top line reads “3 of 8 compared · …”. Each Works or Doesn’t is
added as one line to .rehearse/tries.jsonl (schema try).
With --json, it prints the stage object once it listens, and keeps running after it. When you stop it, it exits
as an interrupted command does (130, or 143 for kill). It exits 1 when it can’t start: the port given is taken, or a
stage already runs for this repository (code stage). It exits 2 when --port isn’t a port.
The following starts the stage, stops it, starts it with --json, then tries a second one.
$ rehearse stageThe stage is at http://127.0.0.1:4400/Stop it with Ctrl-C, or kill 453619.^CStopping what Rehearse brought up (SIGINT).
$ rehearse stage --json{"v":1,"url":"http://127.0.0.1:4400/","port":4400,"pid":453848}
$ rehearse stageA stage already runs for this repository at http://127.0.0.1:4400/ (pid 453848). Open it, or stop it with kill 453848.The stage’s API
Section titled “The stage’s API”The stage’s page talks to it through a small JSON API at the same address. The API is for that page only:
- A request whose
Hostisn’t127.0.0.1:<port>orlocalhost:<port>, or whoseOriginis another site, is refused with 403. - Another site may link to the stage’s page, but can’t ask its API or its files anything, even by
GET: a request that a browser marks as coming from another site is refused with 403, unless it is aGETof the page. - A
POSTwhose body isn’tapplication/jsonis refused with 415. - A refusal is the
errorshape, with codes such asrefused,usage,no_scenario,no_world(a world the manifest doesn’t declare) andno_person(a person it doesn’t declare). - A call you edit and send on the stage goes only to the product’s own services that are up, so a person’s token
never leaves them. A line Rehearse can’t read is answered with 400 and
Line N: …. - Files are shown only from the checkouts it compares and from
.rehearse, never through a link out of them, and never from.git. - Runs, comparisons and sends happen one at a time, on one set of services.
Prints the stage’s address for a scenario, starting the stage when none is running.
rehearse open --help prints how to use it.
$ rehearse open --helpPrints the stage's address for a scenario, starting the stage when none is running.
Usage: rehearse open <scenario> [--no-start] [--port <port>] [--json]
The address is the link a pull request carries.It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
<scenario> |
word, required | The scenario’s id, exactly as rehearse list shows it. Added in: v0.4.0 |
--no-start |
switch; default off | Never starts a stage: with none running, open refuses. Added in: v0.4.0 |
--port |
<port>; default as stage chooses |
The port, from 1 to 65535, for a stage it starts. Added in: v0.4.0 |
With --json it prints one open object.
A stage that open starts runs on after it returns, and open says its pid: stop it with kill <pid>. Its log is
.rehearse/logs/stage.log.
It exits 0. It exits 1 when no scenario has that id (code no_scenario), when no stage runs and --no-start is
given, or when the stage didn’t start within 60 seconds (both code stage). It exits 2 when no scenario is named or
--port isn’t a port.
The following opens one call, starting the stage, then asks again with --json.
$ rehearse open "packages/api/items.hurl#The count is right"http://127.0.0.1:4400/?s=packages%2Fapi%2Fitems.hurl%23The%20count%20is%20rightThe stage started for it; stop it with kill 454227.
$ rehearse open "packages/api/items.hurl#The count is right" --json{"v":1,"url":"http://127.0.0.1:4400/?s=packages%2Fapi%2Fitems.hurl%23The%20count%20is%20right","scenario":"packages/api/items.hurl#The count is right","started":false}With no stage running, --no-start refuses.
$ rehearse open "packages/api/items.hurl#The count is right" --no-startNo stage is running for this repository: run rehearse stage, or open without --no-start.Removes base checkouts beyond the budget, and runs and comparisons older than a week. Keeps the cache.
rehearse clean --help prints how to use it.
$ rehearse clean --helpRemoves base checkouts beyond the budget, and runs and comparisons older than a week. Keeps the cache.
Usage: rehearse clean [--all] [--json]
--all also removes every base checkout and the baseline cache.It takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
--all |
switch; default off | Removes every base checkout, every run and comparison, and the baseline cache. Added in: v0.2.0 |
With --json it prints one clean object.
Without --all, clean keeps the newest budget.checkouts base checkouts (default 3). Either way it keeps
.rehearse/compare/latest.json and latest-partial.json. Rehearse also removes base checkouts beyond the budget each
time it makes a new one. It exits 0.
In a folder with nothing old, clean removes nothing.
$ rehearse cleanNothing to remove.validate
Section titled “validate”Checks a JSON or YAML file (or stdin) against one of Rehearse’s schemas, and says what is wrong where.
rehearse validate --help prints how to use it.
$ rehearse validate --helpChecks a JSON or YAML file (or stdin) against one of Rehearse's schemas, and says what is wrong where.
Usage: rehearse validate <schema> [<file>] [--json]
Schemas: manifest, flow, file-scenario, announce, services, people, worlds, list, observation, comparison, drive, open, stage, try, error, dependents, check, init, validate, up, clean.With no file, it reads stdin: rehearse services --json | rehearse validate servicesIt takes these words and flags, besides the flags every command takes.
| Word or flag | Type and default | What it does |
|---|---|---|
<schema> |
word, required | The schema to check against, one of those its usage lists. Added in: v0.1.0 |
<file> |
word; default stdin | The JSON or YAML file to check. Added in: v0.1.0 |
With --json it prints one validate object.
Each error names where it is and, when the text has more than one line, its line. validate exits 0 when the file
meets the schema, 1 when it doesn’t, and 2 when the schema isn’t one of Rehearse’s.
The following checks the output of services, then a manifest with a mistake, in words and in JSON.
$ rehearse services --json | rehearse validate servicesIt meets the services schema.
$ rehearse validate manifest rehearse.yaml✗ line 5: services.api has no field “readdy”.
$ rehearse validate manifest rehearse.yaml --json{"v":1,"ok":false,"schema":"manifest","file":"rehearse.yaml","errors":[{"at":"services.api","line":5,"says":"services.api has no field “readdy”."}]}The .rehearse folder
Section titled “The .rehearse folder”Rehearse keeps its state in .rehearse/, beside rehearse.yaml. Add it to .gitignore. Rehearse never counts it as
a change to the checkout.
| Path | What it holds |
|---|---|
announce.yaml |
The default announcement. |
checkouts/<commit>/ |
Base checkouts, as git worktrees, each prepared once. |
cache/<commit>/ |
Observations of clean commits, by cache key. |
compare/<time>/ |
Each comparison and its observations; latest.json, latest-partial.json. |
runs/ |
What runs made: screenshots, file outputs. |
services/ |
What Rehearse brought up and that still runs. |
scratch/ |
Each running service’s scratch folder. |
logs/ |
Each service’s output (<name>@<hash>.log), drive.log, stage.log. |
stage.json, drive.json |
The running stage and the running drive. |
tries.jsonl |
Each Works or Doesn’t said on the stage. |