# Setup

> Abstract: The setup wizard takes the projects to review, the accounts allowed to request reviews, the forge credentials and the review provider. Run it in the browser from the Compose setup service, or in a terminal with plain Docker.

## What the wizard asks for

- **Projects.** The forge, its full HTTPS URL, and a checkout path inside the container, or a managed clone.
- **Who may request reviews.** GitHub or GitLab usernames, or numeric account IDs. Setup looks the numeric IDs up on the forge. With both forges configured, enter the operator as `username:numeric-id`.
- **The operator.** The account the posted comment acts for.
- **Credentials** for each forge you selected.
- **The review provider**, and whether it signs in with an account or uses an API key.

You can accept the defaults of 120 seconds between polls, 6,000 estimated input tokens per review and the selected provider's default model. Each of them can be changed later.

> Usernames are resolved by the wizard and stored as numeric IDs. A project list supplied by hand, in `REVIEW_PROJECTS` or `projects.json`, must already contain the IDs.

## GitHub

Choose **create** and register the private App under the personal or organization account that owns the repositories. Approve the permissions on GitHub, return to setup, and install the App on the selected repositories.

The installer exchanges the single-use manifest code for the App ID and private key, and verifies the installation ID against each repository. It requests contents and Actions read access, and pull request write access. Review discovery still uses polling. Choose **existing** to import an App you already have. The registration follows GitHub's [manifest flow](https://docs.github.com/en/apps/sharing-github-apps/registering-a-github-app-from-a-manifest).

> Pull request write access is what posting a comment needs, and Actions read access is what reading a CI report needs. A review writes nothing but its one comment.

## GitLab

Enter the HTTPS **base URL** of the instance, `https://gitlab.com` by default, including its port or installation path: `https://git.example:8443/gitlab`, for instance. Enter each project as `group/project`.

Choose **create** and supply an authorized personal access token with `api` scope once. Setup creates a Reporter project access token, or a group access token for several projects in the same group, with `api` and `read_repository` scopes. Creating a project token requires a Maintainer or Owner, creating a group token requires a group Owner, and the instance must support access tokens.

The reviewer stores the resulting service token. The token you supplied is used for creation only. For projects that span groups, choose **existing** and supply a token with the access they need. GitLab applies its own token expiry policy. See the GitLab guides for [project access tokens](https://docs.gitlab.com/api/project_access_tokens/) and [group access tokens](https://docs.gitlab.com/api/group_access_tokens/).

> If setup stops after creating a remote credential, choose **create** again for the same scope to resume from the protected state volume. Replacing an active credential creates a new one. Once both workers have switched, revoke the old token or retire the old App in the forge.

### A GitLab instance with private TLS

Import a PEM private CA bundle if the instance uses a private PKI. You can also import a PEM X.509 certificate revocation list.

Setup applies that trust to token creation, API reads and artifacts. Assay's tools and git-sync reach the configured instance through a container-local HAProxy TLS connection, which verifies the hostname, the chain and the revocation list.

> A missing, expired or otherwise inapplicable revocation list blocks the verified connection. Replace the list in the manager before it expires. If a TLS setting arrives through a mounted file, roll both workers after replacing the file.

## Credentials in the terminal wizard

The browser wizard is the default with Compose. In the terminal wizard, choose for each credential how it reaches the container:

- **paste**, to type it with terminal echo disabled.
- **import**, to copy a readable file into the state volume.
- **mount**, to keep using a file that stays outside it.

For import or mount, add the source volume to the setup command, for example `-v /path/to/secrets:/run/secrets:ro`, and enter the file's absolute path inside the container. With **mount**, supply the same file path whenever the service runs. With **import**, the source mount is needed only during setup.

## Where the settings live

The active settings, and any imported or pasted credential, are in `/state/setup/`. Credential files are plaintext, readable and writable by their owner only (0600), inside a private directory (0700). Protect the volume and its backups.

Setup checks local files and credential formats. Choosing a Cursor team needs access to Cursor's account service. Forge access is checked by the poller during normal operation.

To change settings or rotate a credential, run setup again, or run `docker exec -it <container> cursor-review-setup`. Existing settings and credentials can be kept without displaying their values. The Compose workers reload on save; with plain Docker, restart the sync and reviewer containers.

> Cancelling before the save keeps the previous configuration active. An explicit environment setting takes precedence over its saved value.

## Setup by environment alone

A deployment with no one to answer a wizard is configured by environment variables instead: the projects, the credentials and the provider. [Settings reference](settings.md) lists every variable and the shape of a project entry.

With a provider chosen and `REVIEW_AUTH_MODE=login`, run the image once with `-it`, the persistent volumes and the `login` command before starting the reviewer. For unattended provisioning with API keys, leave `REVIEW_AUTH_MODE` at its default of `api-key`.

> On an unconfigured interactive first start, the container runs setup before polling. A deployment that already has an Assay reviewer configuration can mount it at `/home/reviewer/.config/assay` and omit the standalone variables. Supplied credentials then follow that roster's own repository and identity rules.

---

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