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

terminal
# 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 interactive operator playbook.

terminal

Interactive REPL

Prompt cameodb@<host> ▶, history tracking, Rustyline editing + Ctrl-R search.

keyboard_tab

Index-aware completions

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

sync

Smart cache refresh

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

lightbulb

Query hints

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

inventory_2

Single binary

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

security

Safe async/runtime

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

table_chart

Data & schema helpers

Built-ins for schema detect and data load handle CSV/TSV, auto-detect delimiters, and skip headers.

palette

Readable output

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

history

Persistent history

Sessions persist to ~/.cameodb/client_history with reverse search to keep your muscle memory.

play_arrow Client Quickstart

Launch the client

# Single binary distribution includes the client
cargo run --bin cameodb -- client -i

# Once built/installed, run the binary directly
./target/debug/cameodb client -i

# Or you can run using downloaded file
./cameodb client -i

Flags: --connect http://host:port (default localhost:9480), -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 for complete statistics and active schemas.

  3. 3

    Query with hints

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

Command Palette

Everything you need, directly inside the REPL.

Download 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).
schema load <index> <file> Detect schema and apply it directly to an index.
data load <index> <file> Ingest CSV/TSV data in batches; skips header row if present.
connect <host[:port]> Switch targets and instantly refresh the schema cache.
help Display the embedded reference.
exit / quit / \q Leave the REPL gracefully.

keyboard_tab Completions & Metadata Cache

Completion & History

  • check Empty prompt suggestions keep newcomers oriented to available commands.
  • check list <TAB> reveals indexes or index.
  • check search books <TAB> surfaces fields with active [type] badges.
  • check History lives at ~/.cameodb/client_history and supports Ctrl-R reverse search.

Index metadata cache

Session-scoped cache stores fields + types to power the completion engine without making network calls on every keystroke:

Arc<RwLock<HashMap<String, IndexMetadata>>>
  • Refreshes on startup, connect, and list indexes.
  • Guarantees completions + hints match current schemas.
  • Fetches happen off-lock, then cleanly swap into the cache.

Query Syntax Assistance

The REPL mirrors Tantivy's query parser and helps you write advanced queries quickly.

Syntax Type Example REPL Notes
Field scoping title:rust Supports dotted JSON paths (cart.product_id).
Phrase "hybrid search" Requires positional indexes enabled on schema.
Boolean foo AND -bar Unary modifiers (+/-) preserved during completions.
Range price:[10 TO 20] Hints ignore comparison symbols so completions still trigger.
Prefix tag:rust* Type wildcards manually after field completion.
Boost title:rust^2 REPL leaves caret syntax untouched.

developer_mode Architecture & Development

Async + Blocking Safety

  • check HTTP layer stays fully async through reqwest::Client.
  • check Rustyline read-loop runs strictly inside tokio::task::spawn_blocking to prevent starving the runtime.
  • check Cache rebuilds fetch data first, then write into the RwLock.

Developer workflows

# Lint the client crate exclusively
cargo clippy -p client --all-targets

# Run the client test suite
cargo test -p client

Reference files: crates/client/src/cli.rs, crates/client/src/sdk.rs