# CLI overview

> Every command group, the flags every command takes, and how to get help without signing in.

Source: https://rehearsal.dev/docs/reference/cli

Every part of the CLI runs under one command, `rehearsal`, which is the only name it installs. These reference pages list every command it has, with the arguments, flags and examples its own help prints, so you can look up what a command takes. If you are new to the CLI, start with [Install and sign in](https://rehearsal.dev/docs/cli/install.md), which takes you through the first commands in order.

## Get help in the terminal

Help works without signing in and without reaching Rehearsal, because the CLI carries the description of every command with it. `rehearsal help` lists the command groups, `rehearsal help <group>` lists the commands in one group, and `--help` after any command prints its usage, flags and examples. A coding agent can read the same description as JSON with `rehearsal help <command> --json`, or read `rehearsal help agent-workflow`, a page written for agents.

```sh
rehearsal help
rehearsal help do
rehearsal run wait --help
rehearsal help run wait --json
```

## Command groups

Every command belongs to one group, and `rehearsal help <group>` takes the names in the first column. The last column links to the page that documents the group's commands.

| Group | What it covers | Page |
| --- | --- | --- |
| `do` | Start work. Type the word alone and it asks what it needs. | [Run commands](https://rehearsal.dev/docs/reference/cli-runs.md) |
| `results` | Read what the work found. | [Test commands](https://rehearsal.dev/docs/reference/cli-tests.md) |
| `your project` | See what the work runs on. | [Project commands](https://rehearsal.dev/docs/reference/cli-projects.md) |
| `you and setup` | Sign in and choose what this repository works on. | CLI overview |

## Flags for every command

Every command takes these flags as well as its own, so the tables on the other reference pages leave them out.

| Flag | Description |
| --- | --- |
| `--json` | Print one JSON object, ask nothing, and open no browser. `REHEARSAL_OUTPUT`=json does the same for every command. |
| `--fields <name>` | With `--json`, keep only these fields of the answer, or of each item in a list. Give a comma list or repeat it. Every field is kept by default. |
| `--no-input` | Never ask a question. A missing choice becomes an error. |
| `--request-timeout <time>` | How long to wait for each answer from Rehearsal, such as 15s or 500ms. The default is 15s, at most 5m. |
| `--api <url>` | Use another Rehearsal API. |
| `--help`, `-h` | Show how to use a command. |
| `--version`, `-v` | Show the installed version. |

## Output and exit codes

With `--json`, a command prints one JSON object instead of text, and its exit code tells a script how it ended. [JSON output and exit codes](https://rehearsal.dev/docs/reference/json-output.md) describes that object and what each exit code means.

`REHEARSAL_OUTPUT=json` does what `--json` does, for every command. `--fields` keeps only the fields of the answer you name. A command that starts paid work or changes something takes `--dry-run`, which checks it and does nothing. [JSON output](https://rehearsal.dev/docs/reference/json-output.md) shows both.

## rehearsal help

Show how to use Rehearsal.

Help works offline and without signing in. With `--json`, a command's help is its full description for a script: its flags and their values, the questions it asks, and its effect.

```sh
rehearsal help [topic...]
```

| Argument | Description |
| --- | --- |
| `[topic...]` | A group, a command, or agent-workflow. |

```sh
# See every group
rehearsal help

# Learn one command
rehearsal help run

# Describe a command for a script
rehearsal help run --json

# Read the page written for coding agents
rehearsal help agent-workflow
```
