> ## 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 Command Reference

> Complete command-line interface documentation for scandrix review, rules, dry-run, and authentication.

The `scandrix` command-line interface provides developers and CI/CD pipelines with local access to the AST parsing engine, custom rules, interactive Bubble Tea TUI, and review pipeline.

## Global flags

All commands accept the following persistent flags:

| Flag | Shorthand | Description |
| - | - | - |
| `--format <fmt>` | `-f` | Output format: `terminal`, `json`, `markdown`, `sarif`, `agent`, `prompt`. |
| `--json` | — | Output result as JSON (shorthand for `--format json`). |
| `--output <path>` | `-o` | Write formatted report (`json`, `markdown`, `sarif`) to file. |
| `--verbose` | `-v` | Enable verbose debug logging. |
| `--quiet` | `-q` | Quiet mode (errors only). |
| `--agent` | — | Wrap output in deterministic Schema v1.0 agent JSON envelope. |
| `--help` | `-h` | Display contextual help and flag descriptions. |

***

## `scandrix auth login`

Authenticate the local developer terminal with your ScanDrix account:

```bash theme={null}
scandrix auth login
```

* Uses interactive browser device/loopback authorization.
* Stores credentials locally in `~/.scandrix/credentials.json` (`0600` permissions).

For headless environments or CI, export an API key or set it non-interactively:

```bash theme={null}
export SCANDRIX_API_KEY="scandrix_..."
# or SCANDRIX_TEAM_KEY / SCANDRIX_TOKEN
```

***

## `scandrix review`

Run a code review on working tree changes, staged diffs, branches, commits, or patch files:

```bash theme={null}
# Review staged git changes before committing
scandrix review --staged

# Compare current changes against main
scandrix review --branch main

# Review specific files or a commit SHA
scandrix review src/auth.go src/config.go
scandrix review --commit HEAD~1

# Fail CI if findings meet or exceed critical severity
scandrix review --staged --fail-on critical

# Override API endpoint or Team API key per invocation
scandrix review --server https://api.scandrix.dev --key "$SCANDRIX_API_KEY"
```

### Exit codes

* `0`: Clean review, or findings remain below `--fail-on`.
* `1`: Findings meet or exceed the `--fail-on` severity threshold (`info`, `warning`, `error`, `critical`).
* `2` / non-zero error: Network, authentication, or parsing error.

***

## `scandrix rules`

Manage and validate custom Drixy rules:

```bash theme={null}
# List active rules
scandrix rules list

# Validate a rule file locally
scandrix rules validate ./rules/no-raw-sql.yaml

# Initialize starter rules directory
scandrix rules init
```

***

## `scandrix dry-run`

Preview review rules locally without posting PR comments or updating cloud state (`exitCode = 0`):

```bash theme={null}
scandrix dry-run --staged
scandrix dry-run --base-branch main --min-severity warning
```


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