Built-in CLI · Zero deps

CameoDB Client CLI

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

Operator-ready ergonomics

Everything from the README, reimagined as an operator playbook.

Interactive REPL

Prompt cameodb@<host> ▶, history at ~/.cameodb/client_history, Rustyline editing + Ctrl-R search.

Index-aware completions

Suggestions for commands, indexes, and search <index> fields with `[type]` hints.

Smart cache refresh

Schema metadata refreshes on startup and after connect, list indexes, or list index.

Query hints

Field completions preserve modifiers (+/-/!) and show `[true/false]`, `[numeric]`, `[text]`, etc.

Single binary

No extra crates to install—cameodb client ships with the main distribution.

Safe async/runtime

Rustyline runs in spawn_blocking while HTTP requests stay async via reqwest.

Data & schema helpers

Built-ins for schema detect|load and data load handle CSV/TSV (comma, tab, semicolon), auto-detect delimiters, and skip headers.

Readable output

Colorized JSON responses by default with a plain fallback keep cluster responses legible.

Persistent history

Sessions persist to ~/.cameodb/client_history with Rustyline navigation and Ctrl-R reverse search, so you keep muscle memory across runs.

Launch the client

# 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.

Workflow at a glance

  1. 1.

    Connect

    Point at a cluster with connect http://host:port; cache refreshes instantly.

  2. 2.

    Inspect indexes

    Use list indexes or list index books for stats + schema.

  3. 3.

    Query with hints

    search books author:doe 15 leverages completions, field types, and optional limit.

  4. 4.

    Stay productive

    History, reverse search, and autoprompt keep your session stateful.

Command palette

Everything you need, one binary

Ship me the binary
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.

Completion & History

  • Empty prompt suggestions keep newcomers oriented.
  • list <TAB> reveals indexes / index.
  • search books <TAB> surfaces fields with `[type]` badges.
  • History lives at ~/.cameodb/client_history and supports reverse search.

Index metadata cache

Session-scoped cache (Arc<RwLock<HashMap<String, IndexMetadata>>>) stores fields + types:

  • Refresh on startup, connect, list indexes, list index.
  • Guarantees completions + hints match current schemas.
  • Fetches happen off-lock, then swap into the cache.

Query shortcuts

Tantivy-compatible parsing with assist

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.

Async + blocking safety

  • HTTP layer stays async through reqwest::Client.
  • Rustyline loop runs inside tokio::task::spawn_blocking.
  • Cache rebuilds fetch data first, then write into the RwLock.

Developer workflows

# 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.