CLI Reference
The kfdb command-line tool provides an interactive shell and direct query execution.
Basic Usage
kfdb [OPTIONS] [COMMAND]
Commands
shell (default)
Start an interactive REPL:
kfdb
# or explicitly
kfdb shell
query
Execute a single query:
kfdb query "MATCH (f:File) RETURN f.path"
info
Show database information:
kfdb info
init
Initialize a new database:
kfdb init --force
Options
--storage <BACKEND>
Choose storage backend (default: rocksdb):
kfdb --storage memory
kfdb --storage rocksdb
kfdb --storage scylla
--db-path <PATH>
Set database path (default: ./data):
kfdb --db-path /var/lib/kfdb
--scylla-nodes <NODES>
ScyllaDB connection nodes (default: 127.0.0.1:9042):
kfdb --storage scylla --scylla-nodes "192.168.1.10:9042,192.168.1.11:9042"
--scylla-keyspace <NAME>
ScyllaDB keyspace (default: knowledgeflow):
kfdb --storage scylla --scylla-keyspace production
Meta Commands
Inside the interactive shell, use these commands:
.help
Show available commands:
kfdb> .help
.info
Show database information:
kfdb> .info
.examples
Show example queries:
kfdb> .examples
.exit
Exit the shell:
kfdb> .exit
Output Formats
Pretty Table (Default)
kfdb query "MATCH (f:File) RETURN f.path"
Output:
┌──────────────┐
│ f.path │
├──────────────┤
│ src/main.rs │
│ src/lib.rs │
└──────────────┘
JSON
kfdb --format json query "MATCH (f:File) RETURN f.path"
Output:
[
{"f.path": "src/main.rs"},
{"f.path": "src/lib.rs"}
]
Plain Text
kfdb --format plain query "MATCH (f:File) RETURN f.path"
Output:
f.path
src/main.rs
src/lib.rs
Examples
Query with filtering
kfdb query "MATCH (f:File) WHERE f.size > 1000 RETURN f.path, f.size"
Traverse relationships
kfdb query "MATCH (f:File)-[:DEFINES]->(fn:Function) RETURN f.path, fn.name"
Use ScyllaDB backend
docker-compose up -d
kfdb --storage scylla query "MATCH (f:File) RETURN f"
History
The CLI automatically saves command history to ~/.kfdb_history.
Use arrow keys to navigate history in the interactive shell.