# CLI reference

> Every command and flag of Relia's command-line tools for Node.js, Python and Laravel.

Section: Reference · Page: https://tryrelia.com/docs/cli · Last checked against the product: 2026-11-01

Relia's command-line tool comes with the `relia-sdk` package (npm and PyPI) and, for Laravel, as an Artisan command in `tryrelia/relia`.

> **Important:** always run the npm CLI as `npx relia-sdk@latest …`. The npm name `relia` belongs to someone else. Inside a project that has `relia-sdk` installed, scripts in `package.json` can call the local binary `relia` (this is what `init` writes into build scripts).

## Node.js CLI (`npx relia-sdk@latest`)

| Command | What it does |
|---|---|
| `init` | Sets up Relia in the current folder (see [init](#init)). Also runs when you give no command. |
| `token` | Writes the upload-only `RELIA_TOKEN` for this folder's project to `.env.local` (see [token](#token)). |
| `sourcemaps upload <folder>` | Uploads a build's source maps to Relia, then removes them from the folder (see [sourcemaps upload](#sourcemaps-upload)). |
| `mcp` | Runs Relia's MCP connector over stdio. AI tools start this in token mode; you don't run it yourself. `mcp serve` and `mcp start` do the same. |
| `mcp install` | Adds Relia to every AI tool found on this computer (see [mcp](#mcp)). |
| `mcp uninstall` | Removes Relia from those tools and forgets the saved MCP token. |
| `mcp status` | Shows the saved token (last 4 characters), the Relia address, and per tool: **set up**, **not installed** or **installed, Relia not added**. |
| `mcp help` | Prints the `mcp` usage and the tool ids. |
| `system` | Runs a standalone reporter for this machine's CPU, memory and disk (see [system](#system)). |
| `whoami` | Shows who the CLI is signed in as. |
| `logout` | Signs the CLI out (removes `~/.relia/auth.json`). |

### init

```bash
npx relia-sdk@latest init
```

No flags. It asks:

1. **How to sign in** (first time only): e-mail and password in the terminal, or an access token copied from the app. The login is saved in `~/.relia/auth.json`.
2. **What should Relia set up?** The first choice, **Everything Relia found here: …**, sets up every part it detected (an API, a web app, Next.js, AI SDK calls), also in `backend/` and `frontend/` style subfolders. Or pick one kind: log & API monitoring, session monitoring, or agent monitoring. (Not asked in a Laravel app.)
3. **Which project**: one of yours, a new one (name defaults to the folder), or a project id typed by hand.
4. **What to record in a browser app**: 1) clicks, pages and errors (default), 2) the same plus screen replays, 3) page views only.
5. **Tell Relia who your users are?** (default yes): prints the lines to add where your app knows the signed-in user.

It then writes the config files (`relia.tracing.js`, `instrumentation.ts`, `src/relia.ts`, `relia.agent.js`…), patches your entry files, installs `relia-sdk`, writes `RELIA_*` values to `.env.local` for agent monitoring, and for web apps wires source maps and writes the upload token. In a Laravel app it runs `composer require tryrelia/relia` and `php artisan relia:install` for you. Answers can be piped in (CI).

### token

```bash
npx relia-sdk@latest token [--project-id <id>]
```

| Flag | What it does | Default |
|---|---|---|
| `--project-id <id>` | The project the token is for. | `RELIA_PROJECT_ID`, else the project id found in the folder's Relia files |

The token can only upload source maps for that one project. A new one replaces your previous upload token for that project. Signs you in first if needed.

### sourcemaps upload

```bash
npx relia-sdk@latest sourcemaps upload ./dist --project-id <id>
```

| Argument or flag | What it does | Default |
|---|---|---|
| `<folder>` | Build output to scan for `.map` files (recursively). | `dist` |
| `--project-id <id>` | The Relia project. | `RELIA_PROJECT_ID` |
| `--release <name>` | A release name. Optional: maps are matched by the bundle's file name. | `RELIA_RELEASE` |
| `--keep` | Keep the `.map` files in the folder after uploading. | Off: they are deleted |
| `--api-url <url>` | Relia's API address. | `RELIA_API_URL`, else Relia's cloud |
| `--build-step` | For use inside a build script: a failed upload prints a warning and exits 0, and the maps are still removed. | Off |

Flags also accept `--flag=value`. Token: `RELIA_TOKEN` (from the environment, or from `.env.local` / `.env` in the current folder), else the login saved by `init`.

### mcp

```bash
npx -y relia-sdk@latest mcp install [--only <ids>] [--url <address>] [--token <token>]
```

| Flag | What it does | Default |
|---|---|---|
| `--only <ids>` | Comma-separated tool ids: `claude-code`, `cursor`, `vscode`, `windsurf`, `codex`, `antigravity`, `gemini-cli`, `claude-desktop`. | Every tool found |
| `--url <address>` | Relia's MCP address. | `RELIA_MCP_URL`, else `RELIA_API_URL` + `/mcp`, else `https://devreliaapi.tryrelia.com/mcp` |
| `--token <token>` | Token mode: checks the `relia_mcp_…` token, saves it in `~/.relia/mcp.json`, and each tool starts the connector. Without it, each tool signs in with Relia in the browser. | `RELIA_MCP_TOKEN`, else sign-in mode |

In sign-in mode, Claude Desktop gets **one step left**: add Relia under **Settings → Connectors**. See [Connect your AI assistant](https://tryrelia.com/docs/connect-ai-assistant.md).

### system

```bash
npx relia-sdk@latest system --project-id <id>
```

| Flag | What it does | Default |
|---|---|---|
| `--project-id <id>` | The Relia project (required). | `RELIA_PROJECT_ID` |
| `--service-name <name>` | The name shown in Relia. | `RELIA_SERVICE_NAME`, else the machine's host name |
| `--interval <seconds>` | How often to report (at least 5). | `RELIA_SYSTEM_INTERVAL`, else 30 |
| `--otlp-endpoint <url>` | Where to send the data. | `RELIA_OTLP_ENDPOINT`, else Relia's cloud |

It runs until you stop it (Ctrl+C). The Node.js and Python SDKs already report the machine they run on; use this for a machine without them.

### Settings the CLI reads

| Variable | What it does |
|---|---|
| `RELIA_API_URL` | Relia's API address (default: Relia's cloud). |
| `RELIA_APP_URL` | Relia's app address used in printed links (default `https://app.tryrelia.com`). |
| `RELIA_OTLP_ENDPOINT`, `RELIA_SESSION_ENDPOINT`, `RELIA_AGENT_ENDPOINT` | Addresses `init` writes into the generated files instead of the cloud defaults. |

All other variables are in [Environment variables](https://tryrelia.com/docs/environment-variables.md).

## Python CLI (`relia`)

Install with `pip install relia-sdk`. The package adds the commands `relia` and `relia-system-monitor`.

| Command | What it does |
|---|---|
| `relia init` (or `relia`, or `python -m relia`) | Sets up Relia in the current folder: signs in, picks or creates the project and service, writes `RELIA_PROJECT_ID`, `RELIA_KEY`, `RELIA_SERVICE_NAME` and `RELIA_OTLP_ENDPOINT` to `.env` (or `.env.local` when only that exists), generates `relia_tracing.py`, patches your entry file, and asks whether to tell Relia who your users are. For agent monitoring it writes `RELIA_PROJECT_ID`, `RELIA_KEY`, `RELIA_AGENT_ID`, `RELIA_AGENT_NAME` and `RELIA_AGENT_ENDPOINT` and generates `relia_agent.py` instead. |
| `relia mcp install [--only <ids>] [--url <address>] [--token <token>]` | Same as the Node.js `mcp install`. Without Python installed globally: `uvx --from relia-sdk@latest relia mcp install`. |
| `relia mcp uninstall` | Removes Relia from your AI tools and forgets the saved token. |
| `relia mcp status` | Shows the saved token and, per tool, **installed** or **not installed**. |
| `relia mcp` | Runs the MCP connector over stdio (`serve` and `start` do the same). |
| `relia whoami` | Shows who the CLI is signed in as. |
| `relia logout` | Signs the CLI out. |
| `relia help` (or `--help`, `-h`) | Lists the commands. |
| `relia-system-monitor` (or `python -m relia.system`) | Standalone CPU, memory and disk reporter. Flags `--project-id` (required, default `RELIA_PROJECT_ID`), `--service-name` (default `RELIA_SERVICE_NAME`, else `OTEL_SERVICE_NAME`, else `backend`), `--interval` (seconds, at least 5; default `RELIA_SYSTEM_INTERVAL`, else 30), `--otlp-endpoint` (default `RELIA_OTLP_ENDPOINT`, else Relia's cloud). |

## Laravel (`php artisan relia:install`)

After `composer require tryrelia/relia`:

```bash
php artisan relia:install --project=<id> --key=<relia_live_…> --service=<name>
```

| Option | What it does | Default |
|---|---|---|
| `--project=` | Your Relia project id (24 characters; on your project page under **Setup Guide & SDK**). | Asked |
| `--key=` | The project key (`relia_live_…`, same place). | Asked; Enter skips it |
| `--service=` | The name shown in Relia. | Your `app.name`, lower-case with dashes |

It writes `RELIA_PROJECT_ID`, `RELIA_KEY` and `RELIA_SERVICE_NAME` to `.env` (replacing existing `RELIA_*` lines, touching nothing else), adds the same names to `.env.example` without the key, and prints how to add the browser part (`Relia.init` in `resources/js/app.js`, or `@reliaScript` in your main Blade layout).

## Next

- [Environment variables](https://tryrelia.com/docs/environment-variables.md)
- [Upload source maps](https://tryrelia.com/docs/source-maps.md)
- [Connect your AI assistant](https://tryrelia.com/docs/connect-ai-assistant.md)
- [Monitor a Laravel or PHP app](https://tryrelia.com/docs/laravel-php-setup.md)

---
All Relia docs for AI assistants: https://tryrelia.com/llms.txt (index) · https://tryrelia.com/llms-full.txt (everything in one file)
