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

# CLI Wizard

> Set up Tranthor in any custom website or app with one command

The `@tranthor/wizard` CLI configures Tranthor in your codebase with a single command.

```bash theme={null}
npx @tranthor/wizard@latest
```

## What It Does

1. **Authenticates your workspace** in the browser and fetches your public write key.
2. **Detects your stack** (Next.js App & Pages Router, React/Vite, Remix, Astro, SvelteKit, Nuxt/Vue, HTML/Blade/ERB templates, Node.js, iOS Swift, Android Kotlin, React Native).
3. **Configures your project**:
   * Writes your public write key to `.env` or `.env.local`.
   * Adds the `<script id="tr-tracker">` snippet (with automatic page and SPA route tracking) to your root layout.
   * Generates a zero-dependency typed helper (`src/lib/tranthor.ts` or `.js`) for `identify`, `reset`, canonical **Commerce events** (`Product Viewed`, `Product Added`, `Cart Viewed`, `Checkout Started`, `Order Placed`, `Order Paid`, `TRANSACTION`), and mobile push registration.
4. **Proposes event instrumentation diffs** for your auth and checkout handlers, gated behind your confirmation in the terminal.
5. **Sends and verifies a test event** end-to-end.

## Commands & Flags

| Command | Description |
| - | - |
| `npx @tranthor/wizard@latest` | Default guided setup flow. |
| `npx @tranthor/wizard@latest --no-ai` | Deterministic local setup only (writes `.env`, snippet, and typed helper without AI code scanning). |
| `npx @tranthor/wizard@latest --npm` | Installs `@tranthor/sdk-web` or `@tranthor/sdk-node` via your package manager instead of the script snippet. |
| `npx @tranthor/wizard@latest doctor` | Verifies API reachability, write key validity, CORS preflight, `.env`, and helper files. |
| `npx @tranthor/wizard@latest mcp [cursor\|claude\|windsurf]` | Configures Tranthor's **Outside assistant** in Cursor, Claude Code, or Windsurf. |

## Using the Generated Helper

```typescript theme={null}
import { tranthor } from "@/lib/tranthor";

// Identify a signed-in customer
tranthor.identify({
  userId: "user-123",
  traits: {
    email: "alex@example.com",
    name: "Alex Smith",
  },
});

// Track a canonical Commerce event
tranthor.trackCommerce("Order Paid", {
  orderId: "ORD-789",
  revenue: 99.99,
});

// Clear identity on logout
tranthor.reset();
```


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