Install the CLI
Install the Rehearsal CLI from npm and check that it works.
The Rehearsal CLI runs your saved tests, reads their results and connects an app on your computer to Rehearsal. You create tests in the app, with Re:agent.
The CLI needs Node.js 24 or newer. Check your version with node --version.
Install Link to Install
npm install -g @rehearsal-labs/cliThis installs two commands, rehearsal and rhl. They are the same program, and rhl is shorter to type. Help, examples and JSON output always say rehearsal.
Other package managers Link to Other package managers
| Package manager | Command |
|---|---|
| pnpm | pnpm add -g @rehearsal-labs/cli |
| Yarn 1 | yarn global add @rehearsal-labs/cli |
| Bun | bun add -g @rehearsal-labs/cli |
The CLI runs on Node.js whichever one installs it, so it still needs Node.js 24 or newer.
Check that it works Link to Check that it works
rehearsal --versionThis prints the version you installed. To see every command, run rehearsal help. Help works offline and without signing in.
rehearsal helprehearsal help runsrehearsal help agent-workflowrehearsal help agent-workflow is a page written for coding agents. It tells an agent how to find your tests, run them and read the results.
Log in Link to Log in
rehearsal loginYour browser opens. Approve the request there, and the CLI is signed in. On a machine without a browser, run rehearsal login --no-browser. It prints a link that you open somewhere else.
Update Link to Update
Run the install command again. npm replaces the version you have with the newest one.
npm install -g @rehearsal-labs/clirehearsal --versionRemove Link to Remove
Log out first. That ends the sign-in and deletes the file that holds it. Then remove the package.
rehearsal logoutnpm uninstall -g @rehearsal-labs/cliThe CLI keeps your sign-in in ~/.config/rehearsal/credentials.json, or under $XDG_CONFIG_HOME when that is set. Only your user account can read the file.
Next steps Link to Next steps
- Log in with only the access a task needs.
- Connect a local app so Rehearsal can test it.
- Run tests from the terminal and read their results.