# CLI reference

> Abstract: `cursor-review` runs one bounded review and writes a JSON report to stdout. Exactly one of `--change`, `--base` or `--ci` chooses what to review. This page lists every flag, the other commands the image provides, and what each exit status means.

## The four commands

| Command | Runs |
|---|---|
| `cursor-review` | One bounded review. Writes a JSON report to stdout. |
| `cursor-review-poll` | The poller loop, which waits for `/review` and reviews each request. |
| `cursor-review-container` | The image's entry point. Its first word selects what to run. |
| `cursor-review-setup` | The setup wizard, in the terminal. |

```sh
cursor-review --help
```

`cursor-review-container` takes one word:

| Word | Runs |
|---|---|
| `manage` | The setup manager, a console that opens the browser wizard |
| `setup` | The setup wizard |
| `login` | A sign-in with the configured provider CLI |
| `sync` | The checkout sync loop |
| anything else | The poller |

Compose's three services run `manage`, `sync` and the poller.

## Choosing what to review

Exactly one of these is required, and they cannot be combined:

| Option | Reviews |
|---|---|
| `--change 'org/repo#42'` | A GitHub pull request or GitLab merge request, through Assay's configured backend |
| `--base main` | A local branch, from the merge base to the committed `HEAD` |
| `--ci` | A local branch, taking its base and head from the pipeline event |

## Every flag of `cursor-review`

| Flag | Takes | Meaning |
|---|---|---|
| `--change` | An address such as `org/repo#42` | An Assay-configured GitHub PR or GitLab MR |
| `--base` | A revision | The local base revision to compare against |
| `--ci` | Nothing | Use the provider CI event's SHAs in the checkout |
| `--expected-change-url` | A URL | Require this exact open forge change before reviewing |
| `--head` | A revision | The local head revision. `HEAD` by default with `--base`. |
| `--repo` | A path | The checkout for local Git and scanners. The current directory by default. |
| `--path` | A changed path. Repeat it. | Limit the review to an exact changed path |
| `--go-analysis-producer` | A workflow or job | A trusted CI producer, for use with `--expected-change-url` |
| `--go-report` | A path | Assay `go-analysis/v1` JSON for this head |
| `--scanner-ci` | JSON | Per-tool trusted CI report settings, for a forge change |
| `--qualgen-store` | A path | The poller's mined Qualgen history for this project |
| `--model` | A model name | An explicit provider model. Otherwise the CLI's default. |
| `--max-input-tokens` | An integer | The estimate limit. 6000 by default, or the saved `REVIEW_MAX_INPUT_TOKENS` setting. |
| `--estimate` | Nothing | Prepare the inputs and report the cost estimate, without calling the model |
| `--cache-dir` | A path | Where results are cached: `$XDG_CACHE_HOME/cursor-pr-review`, else `~/.cache/cursor-pr-review` |
| `--post` | Nothing | Publish a head-bound summary, with `--change` |

## Which flags go together

- `--head` needs `--base`.
- `--post` needs `--change`, and cannot be combined with `--estimate`.
- `--expected-change-url` needs `--change`.
- `--go-analysis-producer` needs `--expected-change-url`, and excludes `--go-report`.
- `--path` must name a file the change touches.
- `--max-input-tokens` must be at least 1.

A request that breaks one of these rules ends with a message on stderr and exit status 2.

## The poller

| Flag | Default | Meaning |
|---|---|---|
| `--state-dir` | `REVIEW_STATE_DIR`, else `~/.local/state/cursor-review` | The state volume |
| `--interval` | `REVIEW_POLL_SECONDS`, else 120 | Seconds to wait after each cycle |

The poller stops with exit status 2 if its configuration is invalid, before it polls anything.

## Setup and sign-in

| Command and flag | Meaning |
|---|---|
| `container setup --state-dir <path>` | Use this state directory |
| `container setup --reauth` | Run a fresh provider sign-in |
| `container setup --web` | Open the local browser wizard |
| `container login --state-dir <path>` | Use this state directory |
| `container login --force` | Sign in again even if the current session is valid |

Each is written in full as `cursor-review-container setup` or `cursor-review-container login`.

The manager console takes four keys: **Enter** opens the browser setup, **r** runs a fresh sign-in, **t** runs the terminal setup, and **q** quits.

## Exit status

| Command | Status | Meaning |
|---|---|---|
| `cursor-review` | 0 | The review or estimate completed in full |
| `cursor-review` | 2 | `over-budget`, `model-unavailable` or `partial`, a failed publication, or any error |
| `cursor-review-poll` | 2 | The configuration is invalid |
| `setup` | 0 | Saved, or quit |
| `setup` | 1 | Cancelled with Ctrl-C |
| `setup` | 2 | No terminal to ask on, or the setup failed |
| `setup` | 20 | Quit from the manager |
| `login` | 2 | The sign-in failed |

> When `cursor-review` catches an error it prints `cursor-review: <message>` on stderr and nothing on stdout. A pipeline that reads the report should treat an empty file as a failure.

[Output and exit codes](output.md) lists the six states behind the first two rows. [Settings reference](settings.md) lists every environment variable.

---

Source of this page: https://pr-agent.assay.guide/cli
