2026-04-27 13:22:16 +02:00
# chat-cli
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
A terminal chat application built on top of libchat. End-to-end encrypted messaging in your terminal.
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
## Building
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
[logos-delivery ](https://github.com/logos-messaging/logos-delivery ) is exposed as a Nix package.
Build it once, then point `LOGOS_DELIVERY_LIB_DIR` at the result:
2026-04-17 14:43:04 +08:00
```bash
2026-04-27 13:22:16 +02:00
nix build .#logos -delivery
LOGOS_DELIVERY_LIB_DIR=./result/lib cargo build --release -p chat-cli
2026-04-17 14:43:04 +08:00
```
2026-04-27 13:22:16 +02:00
The binary lands at `target/release/chat-cli` .
2026-05-12 15:33:50 +02:00
## Transports
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
Both transports are compiled into the binary and selected at runtime via `--transport` :
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
| Value (`--transport` ) | Description |
|-----------------------|-------------|
| `logos-delivery` (default) | Embedded Waku node on the logos.dev network |
| `file` | Shared directory; no network needed — great for local testing |
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
## Quick start
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
Run two instances in separate terminals:
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
```bash
# Terminal 1
cargo run -p chat-cli -- --name alice --port 60001
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
# Terminal 2
cargo run -p chat-cli -- --name bob --port 60002
```
For local-only testing without any network dependency, use the file transport:
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
```bash
# Terminal 1
2026-05-12 15:33:50 +02:00
cargo run -p chat-cli -- --name alice --transport file
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
# Terminal 2
2026-05-12 15:33:50 +02:00
cargo run -p chat-cli -- --name bob --transport file
2026-04-27 13:22:16 +02:00
```
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
### Establishing a connection
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
1. In Alice's terminal, type `/intro` — the bundle is copied to your clipboard automatically.
2. In Bob's terminal, type `/connect <paste bundle here>` .
3. Bob's "Hello!" message appears in Alice's terminal. Both can now chat.
2026-04-17 14:43:04 +08:00
2026-06-04 10:09:29 +08:00
### Optional: KeyPackage registry
When `--registry-url <url>` is set, the client publishes its MLS KeyPackage
2026-06-11 21:07:11 +08:00
to the [keypackage-registry ](https://github.com/logos-messaging/chat-store )
service on startup so other clients can later fetch it by `account_id` . Without
the flag, an in-memory registry is used and is only visible inside the local
process.
2026-06-04 10:09:29 +08:00
```bash
2026-06-11 21:07:11 +08:00
# Terminal 1 — registry server (from a chat-store checkout)
cargo run -- --bind 127.0.0.1:18080
2026-06-04 10:09:29 +08:00
# Terminal 2 / 3 — chat clients pointing at it
cargo run -p chat-cli -- --name alice --transport file \
--registry-url http://127.0.0.1:18080
cargo run -p chat-cli -- --name bob --transport file \
--registry-url http://127.0.0.1:18080
```
The registry is a throwaway testnet helper; v0.3 replaces it with a
λLEZ-based discovery service.
2026-05-12 15:33:50 +02:00
## Options
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
| Flag | Default | Description |
|------|---------|-------------|
2026-05-12 15:33:50 +02:00
| `--transport <kind>` | `logos-delivery` | Transport to use (`logos-delivery` or `file` ) |
| `--data <dir>` | `tmp/chat-cli-data` | Data directory (UI state and default SQLite path) |
| `--db <path>` | `<data>/<name>.db` | SQLite file for persistent identity |
| `--preset <name>` | `logos.dev` | logos-delivery network preset |
2026-04-27 13:22:16 +02:00
| `--port <n>` | `60000` | TCP port for the embedded logos-delivery node |
2026-06-11 21:07:11 +08:00
| `--registry-url <url>` | *(unset)* | Use the HTTP-backed [keypackage-registry ](https://github.com/logos-messaging/chat-store ) at this URL instead of the in-memory registry |
2026-04-27 13:22:16 +02:00
| `--log-file <path>` | *(stderr, off)* | Write logs to a file instead of stderr |
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
## Commands
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
| Command | Description |
|---------|-------------|
| `/help` | Show available commands |
| `/intro` | Generate your introduction bundle (copies to clipboard) |
| `/connect <bundle>` | Connect to a user using their introduction bundle |
| `/chats` | List all established chats |
| `/switch <user>` | Switch active chat |
| `/delete <user>` | Delete a chat session |
| `/status` | Show identity and connection info |
| `/clear` | Clear current chat's message history |
| `/quit` · `Esc` · `Ctrl+C` | Exit |
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
## Storage
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
All data lives under `tmp/chat-cli-data/` by default (override with `--data` ):
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
| Path | Contents |
|------|----------|
| `<name>.db` | SQLite — identity keys, ratchet state, chat metadata (encrypted) |
| `<name>_state.json` | UI state — message history, active chat |
2026-05-12 15:33:50 +02:00
| `transport/<name>/` | Inbox directory watched for incoming messages (file transport only) |
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
The SQLite database can be inspected with *DB Browser for SQLite* : password `chat-cli` , cipher `SQLCipher 4 defaults` .
2026-04-17 14:43:04 +08:00
## Architecture
```
2026-04-27 13:22:16 +02:00
bin/chat-cli/
2026-04-17 14:43:04 +08:00
├── src/
2026-05-12 15:33:50 +02:00
│ ├── main.rs entry point, CLI arg parsing, runtime transport dispatch
2026-04-27 13:22:16 +02:00
│ ├── app.rs application state and command handling
│ ├── ui.rs ratatui terminal UI
│ ├── utils.rs shared helpers
│ ├── transport.rs module declarations
│ └── transport/
│ ├── file.rs file-based transport
│ └── logos_delivery.rs logos-delivery (Waku) transport + FFI
2026-05-12 15:33:50 +02:00
└── build.rs links liblogosdelivery (LOGOS_DELIVERY_LIB_DIR required)
2026-04-17 14:43:04 +08:00
```