npm package: @reportei/cli
Description: Reportei CLI — Terminal interface for the Reportei platform
Latest version: 0.4.2

# Reportei CLI

Terminal interface for the [Reportei](https://reportei.com) platform. Manage projects, reports, dashboards, integrations, metrics and more — all from the command line.

Built on the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) over Streamable HTTP, the CLI communicates with the same server that powers Reportei's AI integrations.

## Requirements

- **Node.js** >= 24.0.0

## Installation

```bash
npm install -g @reportei/cli
```

After installing, the `reportei` command is available system-wide.

## Authentication

The CLI authenticates via **OAuth 2.0 Device Authorization Grant** — the same secure flow used by tools like the GitHub CLI. No passwords are typed into the terminal.

```bash
reportei auth login
```

1. A URL and a one-time code are displayed.
2. Your browser opens the Reportei authorization page.
3. Enter the code and approve.
4. The CLI stores the token locally in `~/.reportei/config.json`.

Check your current auth state or log out:

```bash
reportei auth status
reportei auth logout
```

## Usage

```
reportei <command> [subcommand] [options]
```

### Global options

| Flag | Description |
|---|---|
| `--profile <name>` | Use a specific configuration profile |
| `--json` | Output as JSON |
| `--csv` | Output as CSV |
| `--raw` | Output raw response data |
| `-V, --version` | Print version |
| `-h, --help` | Print help |

### Commands

| Command | Description |
|---|---|
| `auth` | `login`, `status`, `logout` — manage authentication |
| `config` | `set`, `get`, `list`, `default`, `profiles` — manage CLI configuration |
| `myCompany` | Show company/account information (alias: `my-company`) |
| `projects` | `list`, `show` — manage projects |
| `project` | `use`, `clear`, `current` — set a default project for subsequent commands |
| `integrations` | `list`, `show`, `catalog` — manage connected integrations |
| `metrics` | `list`, `get` — list available metrics and fetch metric data |
| `reports` | `list`, `show`, `create` — manage reports |
| `dashboards` | `list`, `show`, `create` — manage dashboards |
| `templates` | `list`, `show` — manage report templates |
| `timeline` | `list`, `show`, `create`, `update`, `delete` — manage timeline events |
| `webhooks` | `list`, `create`, `delete` — manage webhook subscriptions |
| `automations` | `list`, `show`, `create`, `toggle` — manage report automations |
| `goals` | `list`, `progress`, `create` — manage goals and KPIs |
| `analyze` | `performance`, `channels`, `campaigns`, `content` — AI-powered analysis |
| `compare` | Compare metrics across two date ranges |
| `prompt` | `marketing-review`, `social-audit`, `campaign-analysis`, `seo-check`, `monthly-report`, `list` — execute MCP prompts |
| `prompts` | `list` — list available MCP prompt templates |
| `interactive` | Start an interactive REPL session |

### Examples

```bash
# List all projects
reportei projects list

# Show a specific project
reportei projects show 42

# List integrations for a project
reportei integrations list --project-id 42

# List available metrics for Facebook Ads
reportei metrics list --integration-slug facebook_ads

# Fetch metric data for a date range
reportei metrics get \
  --integration-id 123 \
  --start 2026-01-01 \
  --end 2026-01-31 \
  --metrics '[{"id":"...","reference_key":"spend","component":"summary","metrics":["spend"]}]'

# Create a report (interactive prompts fill missing fields)
reportei reports create --project-id 42

# List reports as JSON
reportei reports list --json

# Start interactive mode
reportei interactive
```

## Configuration

Settings are stored at `~/.reportei/config.json` and managed through the `config` command:

```bash
# View current config
reportei config list

# Set output format
reportei config set output_format json

# Set the default profile
reportei config default staging

# List all profiles
reportei config profiles
```

### Profiles

The CLI supports multiple profiles so you can switch between accounts or environments:

```bash
# Login to a different profile
reportei --profile staging auth login

# Set the default profile
reportei config default staging

# List all profiles
reportei config profiles
```

Profile-specific settings (token, output format) are resolved in this order:

1. CLI flag (`--json`, `--csv`, `--raw`, `--profile`)
2. Environment variable (`REPORTEI_PROFILE`)
3. Active profile config
4. Defaults

The base URL defaults to the production Reportei server. It can be overridden via the `REPORTEI_BASE_URL` environment variable for development purposes.

## Output formats

All list/show commands support four output modes:

| Format | Flag | Description |
|---|---|---|
| Table | *(default)* | Human-readable table with pagination info |
| JSON | `--json` | Structured JSON, ideal for piping to `jq` |
| CSV | `--csv` | Comma-separated values for spreadsheets |
| Raw | `--raw` | Unformatted response body |

## License

Proprietary — internal use only.