# CLI Reference

> Comprehensive CLI reference for the Cawide host, covering all commands, daemon controls, pairing options, agent hooks, and cloud profile flags.

Source: https://cawide.dev/docs/cli

This document provides a complete reference for all commands and options available in the Cawide host CLI (`cawide`).

The Cawide CLI is open source under Apache-2.0 at [github.com/Hermillon/cawide](https://github.com/Hermillon/cawide). This reference matches version 0.16.1.

## Command summary

| Command | Description |
| :--- | :--- |
| `cawide` | Show status if the daemon is running, otherwise start it in the background and print a pairing QR code |
| `cawide serve` | Run the Cawide host service (background by default) |
| `cawide start` | Start the background daemon service |
| `cawide restart` | Restart the background daemon service |
| `cawide stop` | Stop the background daemon service (alias: `quit`) |
| `cawide update` | Check for and install updates to the CLI |
| `cawide logs` | Inspect daemon and connection logs |
| `cawide pair` | Generate a single-use pairing QR code and link |
| `cawide status` | Check host daemon and network connectivity status |
| `cawide agent` | Launch Codex or OpenCode with live phone status |
| `cawide setup` | Install or remove the OMP extension |
| `cawide hook` | Internal entry point called by the OMP extension or launcher shim; you do not run it yourself |
| `cawide devices` | List all authorized iPhone devices |
| `cawide revoke` | Revoke access for an authorized device |
| `cawide open` | Open a local port or URL in the iPhone in-app browser |
| `cawide login` | Link this computer to your Cawide account (required for pairing and Cloud) |
| `cawide logout` | Sign this computer out of your Cawide account |
| `cawide unlink` | Unlink this computer from your Cawide account |
| `cawide profile` | Manage synchronized agent profiles on Cawide Cloud (coming soon) |

---

## Daemon commands

### `cawide serve`

Runs the Cawide host service. By default, this command spawns a background process and exits. Use `-f` or `--foreground` to run attached to your current terminal.

```bash
cawide serve [flags]
```

**Flags**:
- `-f`, `--foreground`: Run the host directly in the foreground instead of detaching.
- `--local-only`: Disable relay discovery; only accept connections over the local network.
- `--workdir <dir>`: Set the root directory for workspace file browsing and terminal sessions.
- `--command <cmd>`: Override the default shell command spawned for new terminal sessions.
- `--upload-dir <dir>`: Directory where file attachments uploaded from the phone are saved (uploads are capped at 8 MB).
- `--no-pair`: Do not allow new devices to initiate pairing handshakes.
- `--port <port>`: Listen on a specific UDP port for direct peer-to-peer QUIC connections.
- `--external-addr <addr>`: Explicit public IP address or hostname to advertise to peers.
- `--relay-url <url>`: Override the default Cawide relay server URL.

### `cawide start`

Starts the Cawide host background daemon.

```bash
cawide start
```

### `cawide restart`

Restarts the running Cawide host background daemon.

```bash
cawide restart
```

### `cawide stop`

Stops the running Cawide host daemon. You can also use the alias `cawide quit`.

```bash
cawide stop
cawide quit
```

### `cawide update`

Checks npm registry for newer releases of `cawide` and updates the package.

```bash
cawide update
```

### `cawide logs`

Streams or views historical logs from the daemon.

Alias: `cawide log`. `-n, --lines <N>` defaults to 50.

```bash
cawide logs [-f] [-n <count>]
```

**Flags**:
- `-f`: Follow log output in real time.
- `-n <count>`: Number of lines to show (default: 50).

### `cawide status`

Outputs current daemon health, uptime, listening UDP ports, relay connectivity, and number of connected sessions.

Add `--json` for machine-readable output.

```bash
cawide status
```

---

## Device pairing and security

### `cawide pair`

Generates an Ed25519 pairing keypair and outputs an ASCII QR code along with a fallback URL. The pairing secret expires after 5 minutes.

```bash
cawide pair
```

### `cawide devices`

Lists all paired iPhone devices authorized on this workstation, including device names, public key fingerprints, and last active timestamps.

```bash
cawide devices
```

### `cawide revoke`

Revokes an authorized device by ID or public key fingerprint.

```bash
cawide revoke <selector>
```

---

## Agent launcher and setup

### `cawide agent`

Launches Codex or OpenCode with live phone status and approval tracking.

```bash
cawide agent <codex|opencode> [args...]
```

**Arguments**:
- `codex`: Launch Codex with live phone status.
- `opencode`: Launch OpenCode with live phone status.
- `[args...]`: Optional arguments forwarded to the agent CLI.

### `cawide setup`

Installs or removes the OMP extension (`~/.omp/agent`).

```bash
cawide setup omp [--remove]
```

**Arguments**:
- `omp`: Install the extension for OMP (Oh My Pi). The daemon also installs it automatically on start if `~/.omp/agent` exists.

**Flags**:
- `--remove`: Remove the OMP extension and restore original configuration.

`cawide setup codex` and `cawide setup opencode` were removed (Codex and OpenCode are observed via their own servers and `cawide agent`). `cawide setup claude` requires no global setup because Claude Code uses an automatic POSIX launcher shim on macOS and Linux. On startup, the daemon cleans up legacy Claude, Codex, and OpenCode hooks.
---

## Dev server preview

### `cawide open`

Routes a local dev server port or full URL through the encrypted tunnel to the in-app browser on your paired iPhone.

While the daemon runs, it also sets `BROWSER` and `NPM_CONFIG_BROWSER` in Cawide sessions, so tools that open a browser open it in Cawide on your iPhone.

```bash
cawide open <port|url>
```

**Examples**:
```bash
cawide open 3000
cawide open http://localhost:8080/admin
```

---

## Cloud account and profiles

### `cawide login`

Links this computer to your Cawide account using device code authentication.

```bash
cawide login
```

### `cawide logout`

Signs this computer out of your Cawide account and removes stored authentication tokens.

```bash
cawide logout
```

### `cawide profile`

Manages agent settings and API keys synchronized with Cawide Cloud machines. Sign-in tokens are never uploaded.

```bash
cawide profile <subcommand>
```

**Subcommands**:
- `push [--dry-run]`: Upload local agent configs (Claude Code, Codex, OMP, OpenCode) to encrypted Cloud storage. Use `--dry-run` to inspect files before uploading.
- `status`: Show the last synchronized timestamp and list of stored agent profiles.
- `delete`: Delete all stored agent profiles from Cawide Cloud (coming soon).
- `cawide profile apply [--file <PATH>]`: apply a synced profile to this computer's agents, or one read from a file.
- `cawide profile push --dry-run --output <PATH>`: write the dry-run list to a file.

