A first-class REPL bundled inside the CameoDB binary. Inspect clusters, explore indexes, or run searches with schema-aware completions, persistent history, and safe async orchestration.
# Launch interactive REPL with schema-aware hints
$ cameodb client --interactive
🛠️ CameoDB interactive client.
Type 'help' for supported commands, 'exit' to quit.
cameodb@localhost ▶ connect http://cluster-db:9480
↳ refreshed 8 indexes, 248 indexed fields
cameodb@cluster-db ▶ search books "science fiction" 5
↳ 5 hits · latency 16ms (scatter/gather)
Capabilities
Everything from the README, reimagined as an operator playbook.
Prompt cameodb@<host> ▶, history at ~/.cameodb/client_history, Rustyline editing + Ctrl-R search.
Suggestions for commands, indexes, and search <index> fields with `[type]` hints.
Schema metadata refreshes on startup and after connect, list indexes, or list index.
Field completions preserve modifiers (+/-/!) and show `[true/false]`, `[numeric]`, `[text]`, etc.
No extra crates to install—cameodb client ships with the main distribution.
Rustyline runs in spawn_blocking while HTTP requests stay async via reqwest.
Built-ins for schema detect|load and data load handle CSV/TSV (comma, tab, semicolon), auto-detect delimiters, and skip headers.
Colorized JSON responses by default with a plain fallback keep cluster responses legible.
Sessions persist to ~/.cameodb/client_history with Rustyline navigation and Ctrl-R reverse search, so you keep muscle memory across runs.
# Single binary distribution includes the client subcommand cargo run --bin cameodb -- client -i # Once built/installed, run the same binary directly ./target/debug/cameodb client -i
Flags: --connect http://host:port (default http://localhost:9480), --interactive/-i for REPL.
Connect
Point at a cluster with connect http://host:port; cache refreshes instantly.
Inspect indexes
Use list indexes or list index books for stats + schema.
Query with hints
search books author:doe 15 leverages completions, field types, and optional limit.
Stay productive
History, reverse search, and autoprompt keep your session stateful.
Command palette
| Command | Description |
|---|---|
| health | Fetch _cluster/health and pretty-print. |
| list indexes | Enumerate indexes with stats plus cached field names. |
| list index <name> | Drill into one index, showing schema + metadata. |
| search <index> <query> [limit] | Run hybrid search with optional result limit. |
| schema detect <file> [--delimiter ...] | Detect schema from CSV/TSV (auto or forced delimiter; supports comma, tab, semicolon). |
| schema load <index> <file> [--delimiter ...] | Detect schema and apply it to an index. |
| data load <index> <file> [--delimiter ...] | Ingest CSV/TSV data in batches; skips header row if present. |
| connect <host[:port]> | Switch targets and refresh the schema cache. |
| help | Display the embedded reference. |
| exit / quit / \q | Leave the REPL gracefully. |
list <TAB> reveals indexes / index.search books <TAB> surfaces fields with `[type]` badges.~/.cameodb/client_history and supports reverse search.Session-scoped cache (Arc<RwLock<HashMap<String, IndexMetadata>>>) stores fields + types:
connect, list indexes, list index.Query shortcuts
The REPL mirrors Tantivy's query parser and makes the syntax easy to remember.
| Syntax | Example | Notes |
|---|---|---|
| Field scoping | title:rust | Supports dotted JSON paths (cart.product_id). |
| Phrase | "hybrid search" | Requires positional indexes. |
| Boolean | foo AND -bar | Unary modifiers preserved in completions. |
| Range | price:[10 TO 20] | Hints ignore comparison symbols so completions still trigger. |
| Prefix | tag:rust* | Type wildcards manually after completion. |
| Boost | title:rust^2 | REPL leaves caret syntax untouched. |
reqwest::Client.tokio::task::spawn_blocking.RwLock.# Lint the client crate cargo clippy -p client --all-targets # Run tests cargo test -p client
Reference files: crates/client/src/cli.rs, crates/client/src/sdk.rs, crates/client/Cargo.toml.