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

# CLI

> Trace CLI Documentation

The Trace CLI (`trace`) is your terminal-based intelligence engine. It allows you to debug deployed sites, local servers, and production apps directly from your command line.

## 🚀 Installation

```bash theme={null}
# Install globally
npm install -g @probebrowser/cli

# Or run just-in-time
npx @probebrowser/cli <command>
```

## 🔑 Authentication

Most advanced features (AI Analysis) require an API key.

```bash theme={null}
export TRACE_API_KEY=sk_live_...

# OR pass it explicitly
trace analyze https://example.com --api-key sk_live_...
```

## 🛠️ Main Commands

### 1. `trace analyze <url>` (Alias: `a`)

The most powerful command. It connects to the page, plans a debugging strategy, and executes it using AI.

```bash theme={null}
trace analyze http://localhost:3000
```

**Options:**

* `-q, --query <text>`: Ask a specific question (e.g., "Why is the cart empty?").
* `--no-headless`: Watch the browser interactions in real-time.
* `--json`: Output raw JSON for CI/CD pipelines.

### 2. `trace repl <url>` (Alias: `r`)

Starts an **Interactive Debugging Session**. You can type questions to the AI or run slash commands.

```bash theme={null}
trace repl http://localhost:3000
```

**REPL Commands:**

* `/debug`: Run a full scan.
* `/errors`: Show console errors.
* `/eval <js>`: Run JavaScript in the browser context.
* `/screenshot`: Capture the current view.
* *Why is the font wrong?*: Ask the AI directly.

### 3. `trace debug <url>` (Alias: `d`)

Runs a standard comprehensive scan (Console + Network + DOM) without a specific user query.

```bash theme={null}
trace debug https://staging.myapp.com
```

## ⚡ Quick Tools

### Console & Errors

Check for runtime exceptions.

```bash theme={null}
trace errors http://localhost:3000
```

### Network Analysis

Find failed requests (404, 500) and performance bottlenecks.

```bash theme={null}
trace network http://localhost:3000 --failed
```

### Performance

Get Core Web Vitals (FCP, LCP) and a breakdown of JS heap usage.

```bash theme={null}
trace perf http://localhost:3000
```

### Accessibility

Run an automated a11y audit (contrast, aria labels).

```bash theme={null}
trace a11y http://localhost:3000
```

### Health Check

Simple pass/fail check for CI/CD. Returns exit code 0 (Healthy) or 1 (Issues).

```bash theme={null}
trace health http://localhost:3000
```

## 🔍 Inspection

### Inspect Element

Get the DOM properties, visibility, and calculated styles of an element.

```bash theme={null}
trace inspect http://localhost:3000 "#submit-btn"
```

### List All Tools

See the full list of 96+ variable tools available to the engine.

```bash theme={null}
trace tools
```
