# zaun-host command line

> Every zaun-host command and option, with what it reads, writes and prints.

```
zaun-host <command> [--config F | --data-dir D] …
```

The configuration defaults to `$ZAUN_HOST_CONFIG`, else `/etc/zaun-host/zaun-host.toml`; with
`--data-dir D` it is `D/zaun-host.toml`. The store passphrase comes from `$ZAUN_HOST_PASSPHRASE` or
the passphrase file, never the configuration. No command prints keys, passphrases or message content.

## Setup and serving

| Command | What it does |
|---|---|
| `init --data-dir D [--smp smp://…]… [--xftp xftp://…]… [--config F]` | Creates `D` with `host.key` and `simplex.key` (mode 0600), `host.db` and a configuration. Refuses to overwrite. Without `--smp`, the official SimpleX servers. `D` defaults to `$ZAUN_HOST_DATA_DIR`. |
| `run` (alias `serve`) | Serves until stopped (SIGTERM is safe). Writes the address to `D/address`. A second `run` on the same store is refused. |
| `address` | Prints the SimpleX address (after one run). |
| `id` | Prints the host id and public key, for owners creating a community. |
| `status` | Checks the configuration, files and permissions; non-zero exit on a failure. |
| `doctor` | Offline, read-only checks (configuration, directory modes, keys, lock, database schema and integrity, SimpleX store, relays, memory), each ok / warn / FAIL; non-zero exit on any FAIL. Safe while `run` is serving. |
| `help`, `version` | As named. |

## Moving communities

| Command | What it does |
|---|---|
| `export --community ID --out FILE --passphrase-file P` | Writes one community (members, roles, channels, bans, admission policy, history, audit log, stored attachments) to a new bundle, signed by this host and encrypted with the passphrase in `P` (mode 0600, at least 16 bytes). Invitation secrets never leave. Stop `run` first. |
| `import --passphrase-file P [--descriptor F] FILE` | Loads a bundle after checking every signature and hash. The owner's delegation must name this host: it is in the bundle when published before the export, otherwise give it as `F` (JSON with `descriptor` and `delegation`). Stop `run` first. |

## Bots

These talk to the running host through `D/control.sock`. Every one also takes `--config F | --data-dir D`.

| Command | What it does |
|---|---|
| `bot install --community ID [--grant-all \| --grant CAP,…] [--yes] FILE` | Installs a `.zbot` package. Shows what it asks for in plain words and asks first, unless `--yes`. |
| `bot list [--community ID]` | The installed bots and their state. |
| `bot info --community ID BOT` | One bot's card, including what its manifest asks for. |
| `bot update --community ID BOT FILE` | Installs a newer version (same publisher, higher version). Wider requests wait for approval. |
| `bot grant --community ID BOT [--permissions DECIMAL] [--capabilities CAP,…]` | Replaces the bot's grants, within its request and the host's ceiling. |
| `bot enable` / `bot disable` / `bot remove --community ID BOT` | As named. Removing deletes its role, commands and storage. |

`CAP` is a permission name (`SEND_MESSAGES`) or a capability: `message_content`, `members`,
`presence`, `timers`, `attachments`, `storage:<MiB>`, `network:<host>`.

> **Note: Planned**
>
> `bot logs`, `bot update --all` and installing from an `https://` URL are accepted by the parser but not
> yet implemented by the host.
