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

# CLI reference

> Complete golain command reference with examples.

All commands accept global flags: `--profile`, `--output` (`table`|`json`|`jsonl`), `--yes`.

`<name-or-id>` accepts human-readable names or UUIDs.

The binary is **`golain`**; **`platform-tui`** remains a symlink for back-compat.

## Organizations

```bash theme={null}
golain orgs list [--page=N] [--limit=N]
```

## Projects

```bash theme={null}
golain projects list
golain projects create --name=myproject [--region=us-east-1] [--hosting-platform=aws]
```

## Fleets

```bash theme={null}
golain fleets list [--page=N] [--limit=N]
golain fleets create --name=myfleet [--description="..."]
golain fleets delete <name-or-id> [--yes]
```

## Devices

```bash theme={null}
golain devices list --fleet=<name-or-id> [--connected=true|false] [--page=N] [--limit=N]
golain devices get <name-or-id> --fleet=<name-or-id>
golain devices create --name=sensor-01 --fleet=<name-or-id> [--type=mqtt]
golain devices delete <name-or-id> --fleet=<name-or-id> [--yes]
golain devices mqtt-details <name-or-id> --fleet=<name-or-id>
golain devices issue-cert <name-or-id> --fleet=<name-or-id> [--algorithm=rsa|ecdsa] [--output-dir=PATH]

# Device tags
golain devices tags list <device> --fleet=<name-or-id>
golain devices tags add  <device> --fleet=<name-or-id> --tags=prod,region-eu
golain devices tags remove <device> --fleet=<name-or-id> --tags=prod
```

## Tags

```bash theme={null}
golain tags list [--page=N] [--limit=N]
golain tags create --name=prod
golain tags delete <name-or-id> [--yes]
```

## OTA

```bash theme={null}
golain ota releases list [--page=N] [--limit=N]
golain ota releases create --name=v1.2.0 [--device-types=esp32,stm32]
golain ota releases delete <name-or-id> [--yes]

golain ota deployments list --release=<name-or-id> [--page=N] [--limit=N]
golain ota deployments create --name=deploy-01 --release=<name-or-id> \
  [--target-tags=prod,eu] [--target-fleets=fleet-a] [--target-devices=dev-01] \
  [--max-retries=3] [--retry-interval=60] [--scheduled-at=2025-06-01T00:00:00Z]

golain ota deployments trigger <name-or-id> --release=<name-or-id> [--yes]
golain ota deployments cancel  <name-or-id> --release=<name-or-id> [--yes]
golain ota deployments delete  <name-or-id> --release=<name-or-id> [--yes]
```

## Integrations

```bash theme={null}
golain integrations accounts list [--page=N] [--limit=N]
golain integrations bindings list [--page=N] [--limit=N]
```

## Users

```bash theme={null}
golain users list [--email=user@example.com] [--permission=owner|admin|member|viewer] [--page=N] [--limit=N]
```

## Events

**Snapshots:**

```bash theme={null}
golain events list                            # audit (default)
golain events list --source=mqtt
golain events list --source=tsdb
golain events list --source=audit --page=2 --limit=100
```

**Live SSE** (blocks until Ctrl-C):

```bash theme={null}
golain events watch
golain events watch --device=<uuid>
golain events watch --replay-since=2025-06-01T00:00:00Z
```

## Omega edge deploy

```bash theme={null}
golain omega scaffold \
  --device=<name-or-id> \
  --fleet=<name-or-id> \
  [--org --project --arch --db-path --sample-db --verify-tables --out --channel --transport]
```

Downloads Omega + SQLite deps from CDN, issues MQTT certs, writes `omega-config.yaml` and `omega-env.sh`. See [Omega deploy](/tools/platform-tui/omega-deploy).

## Edge sync (TUI)

Edge SQLite replication governance has **no dedicated CLI subcommand** — use the interactive TUI (**Project menu → Edge Sync**) or the [HTTP API](/edge/data-sync/api-reference).

Requires project context:

```bash theme={null}
golain context set --org=my-org --project=my-project
golain    # TUI → Edge Sync
```

| TUI screen         | Purpose                                                                                        |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| **Lineages**       | Per-device table pipelines; `d` staged rows, `w` mirror rows, `x` reset materialization        |
| **Schema Reviews** | **Registry** reviews (v2); `c` claim, `a` approve (auto PATCH policy + column map), `x` reject |

Scriptable alternatives today — curl against `/edge/registry-reviews` and `/edge/lineages` (same routes the TUI calls):

```bash theme={null}
# List registry schema reviews (v2 primary path)
curl -s -H "Authorization: Bearer $TOKEN" -H "ORG-ID: $ORG_ID" \
  "$API/core/api/v1/projects/$PROJECT_ID/edge/registry-reviews?status=queued"

# Claim + approve (production: supply full column_actions from registry schema)
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "ORG-ID: $ORG_ID" \
  -H "Idempotency-Key: $(uuidgen)" \
  "$API/core/api/v1/projects/$PROJECT_ID/edge/registry-reviews/$REVIEW_ID/claim"
```

→ Full operator walkthrough: [golain Edge Sync](/edge/data-sync/platform-tui-guide)

## Release and diagnostics

```bash theme={null}
golain version [--check]
golain upgrade [--force] [--allow-downgrade]
golain channel get
golain channel set --name=stable|latest|dev
golain doctor
golain report [--open]
```

## Utility

```bash theme={null}
golain completions bash|zsh|fish
golain login [--profile=NAME]
golain logout [--profile=NAME]
golain whoami
golain profiles
golain context set --org=X [--project=Y]
golain context get
golain context unset [--org] [--project]
golain env get
golain env set --name=production|staging|local
```

## Agent / CI patterns

```bash theme={null}
# JSON lines for jq processing
golain --output=jsonl devices list --fleet=sensors

# Create and capture ID
ID=$(golain --output=json devices create --name=test-01 --fleet=sensors | jq -r .id)

# Non-interactive destructive ops
golain --yes ota deployments trigger my-deployment --release=v1.2.0

# Scaffold Omega for CI (requires stored credentials)
golain omega scaffold --device=$ID --fleet=sensors --verify-tables --transport=tls --sample-db
```

Environment overrides: `GOLAIN_TOKEN`, `GOLAIN_API_URL`, `GOLAIN_ZITADEL_*` (legacy `PLATFORM_*` aliases still work).

→ [TUI guide](/tools/platform-tui/tui-guide) · [Omega deploy](/tools/platform-tui/omega-deploy)
