> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scandrix.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI & Team Keys

> Install the ScanDrix CLI, authenticate with team API keys, and run reviews locally or in CI.

The ScanDrix CLI runs the same AST + LLM review engine locally, in pre-commit/pre-push git hooks, via an interactive TUI, or inside any CI runner.

## Install

```bash theme={null}
curl -fsSL https://scandrix.dev/install | bash
```

The installer places `scandrix` on your `PATH` (macOS, Linux, WSL). Or build from source via `make build`. Verify:

```bash theme={null}
scandrix version
```

## Team API keys

CLI and CI runs authenticate via browser login (`scandrix auth login`) or **team API keys** generated in the dashboard under **Settings → API Keys** (`scandrix_*` prefix):

```bash theme={null}
# Export for the current shell (SCANDRIX_API_KEY, SCANDRIX_TEAM_KEY, or SCANDRIX_TOKEN)
export SCANDRIX_API_KEY="scandrix_..."
```

Or pass a key directly for a single run:

```bash theme={null}
scandrix review --key "scandrix_..." --staged
```

> [!WARNING]
>
> Treat team keys like passwords. Keep them in CI secret stores and untracked environment files only — never commit them to source code or client-side bundles. Rotate immediately from the dashboard if a key is exposed.

## Local reviews

Review your working tree or staging area before committing:

```bash theme={null}
scandrix review --staged
```

Other common invocations:

```bash theme={null}
# Review uncommitted changes against main
scandrix review --branch main

# Review using only deterministic + custom rules (no LLM calls)
scandrix review --rules-only --offline

# Inspect effective merged repository/global configuration
scandrix config show
```

Use `--json` for machine-readable output or `--prompt-only` for coding-agent prompts.

## CI usage

Run reviews headlessly in your pipeline using `scandrix ci run` or `scandrix review --fail-on`:

```yaml theme={null}
scandrix_review:
  stage: test
  image: alpine:latest
  only:
    - merge_requests
  before_script:
    - apk add --no-cache curl git bash
    - curl -fsSL https://scandrix.dev/install | bash
  script:
    - scandrix review --branch "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" --fail-on critical --json
  variables:
    SCANDRIX_API_KEY: $SCANDRIX_API_KEY
```

With `--fail-on`, the CLI exits with code `1` when findings meet or exceed the configured severity (`info`, `warning`, `error`, `critical`).

## Pre-commit & pre-push hooks

```bash theme={null}
scandrix hook install
```

This non-destructively installs delimited review guards in `.git/hooks/pre-commit` and `.git/hooks/pre-push`. Skip temporarily with `SCANDRIX_SKIP_HOOK=1` or `git commit --no-verify`.

## Command overview

| Command | Purpose |
| - | - |
| `scandrix review` | Review working tree, `--staged`, `--branch`, `--commit`, or `--file` diffs |
| `scandrix dry-run` | Preview findings without modifying PR/cloud state (`--base-branch`, `--staged`, `--commit`) |
| `scandrix ci run` | Headless CI runner exporting SARIF / JUnit / GitLab Code Quality |
| `scandrix rules list` | List configured rules (`validate`, `create`, `update`, `generate`, `init` also supported) |
| `scandrix config show` | Show effective global, repository, and environment configuration |
| `scandrix hook install` | Install pre-commit and pre-push git hooks |
| `scandrix auth login` | Interactive browser auth or `scandrix auth team-key` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.