AimDB CLI
Command-line interface for introspecting and managing running AimDB instances.
Overview
The AimDB CLI is a thin client over the AimX v1 remote access protocol, providing intuitive commands for:
- Discovering running AimDB instances
- Listing and inspecting records
- Getting current record values
- Watching records in real-time
- Setting writable record values
Installation
Build from source:
The binary will be available at target/release/aimdb.
Quick Start
1. Discover Running Instances
Example output:
┌──────────────────────┬────────────────┬──────────┬─────────┬──────────┬───────────────┐
│ Socket Path │ Server Version │ Protocol │ Records │ Writable │ Authenticated │
├──────────────────────┼────────────────┼──────────┼─────────┼──────────┼───────────────┤
│ /tmp/aimdb-demo.sock │ aimdb │ 1.0 │ 2 │ 0 │ no │
└──────────────────────┴────────────────┴──────────┴─────────┴──────────┴───────────────┘
2. List All Records
Example output:
┌──────────────────────┬────────────────────────────────────────────┬───────────────┬───────────┬───────────┬──────────┐
│ Name │ Type ID │ Buffer Type │ Producers │ Consumers │ Writable │
├──────────────────────┼────────────────────────────────────────────┼───────────────┼───────────┼───────────┼──────────┤
│ server::Temperature │ TypeId(0xaee15e261d918c67cee5a96c2f604ce0) │ single_latest │ 1 │ 2 │ no │
│ server::Config │ TypeId(0xc2af5c8376864a24e916c87f88505fac) │ mailbox │ 0 │ 3 │ yes │
└──────────────────────┴────────────────────────────────────────────┴───────────────┴───────────┴───────────┴──────────┘
3. Get Current Record Value
Example output:
4. Watch a Record in Real-Time
Example output:
📡 Watching record: server::Temperature (subscription: sub-123)
Press Ctrl+C to stop
2025-11-02 10:30:45.123 | seq:42 | {"celsius":23.5,"sensor_id":"sensor-001","timestamp":1730379296}
2025-11-02 10:30:47.456 | seq:43 | {"celsius":23.6,"sensor_id":"sensor-001","timestamp":1730379298}
2025-11-02 10:30:49.789 | seq:44 | {"celsius":23.7,"sensor_id":"sensor-001","timestamp":1730379300}
^C
✅ Stopped watching
5. Set a Writable Record
Command Reference
Instance Commands
instance list
List all running AimDB instances by scanning for Unix domain socket files.
Options:
-f, --format <FORMAT>: Output format (table, json, json-compact, yaml)
instance info
Show detailed information about a specific instance.
Options:
-s, --socket <PATH>: Socket path (uses auto-discovery if not specified)
instance ping
Test connection to an instance.
Record Commands
record list
List all registered records in an AimDB instance.
Options:
-s, --socket <PATH>: Socket path (uses auto-discovery if not specified)-f, --format <FORMAT>: Output format (table, json, json-compact, yaml)-w, --writable: Show only writable records
record get
Get the current value of a specific record.
Arguments:
<RECORD>: Record name (e.g.,server::Temperature)
Options:
-s, --socket <PATH>: Socket path-f, --format <FORMAT>: Output format (default: json)
record set
Set the value of a writable record.
Arguments:
<NAME>: Record name<VALUE>: JSON value to set
Options:
-s, --socket <PATH>: Socket path--dry-run: Validate but don't actually set
Note: Only records without producers can be set remotely.
Watch Command
watch
Watch a record in real-time, displaying updates as they arrive.
Arguments:
<RECORD>: Record name to watch
Options:
-s, --socket <PATH>: Socket path-q, --queue-size <SIZE>: Subscription queue size (default: 100)-c, --count <N>: Maximum number of events to receive (0 = unlimited)-f, --full: Show full pretty-printed JSON for each event
Press Ctrl+C to stop watching and unsubscribe cleanly.
Output Formats
The CLI supports multiple output formats:
- table (default for lists): Human-readable formatted tables
- json: Pretty-printed JSON with indentation
- json-compact: Single-line JSON for scripting
- yaml: YAML format (requires
yamlfeature)
Socket Discovery
The CLI automatically discovers running AimDB instances by scanning:
/tmpdirectory/var/run/aimdbdirectory
Socket files must have a .sock extension.
You can override auto-discovery by specifying --socket <PATH> for any command.
Error Handling
The CLI provides clear, actionable error messages:
Error: Connection failed: /tmp/aimdb.sock
Reason: connection timeout
Hint: Check if AimDB instance is running
Error: Permission denied: record.set
Record 'server::Temperature' is not writable
Hint: Check 'writable' column in 'aimdb record list'
Examples
Health Check Workflow
# Discover instances
# Check connectivity
# List all records
# Get specific values
Debugging Workflow
# Find writable records
# Watch live updates
# Update configuration
# Verify change
Monitoring Integration
# Export metrics as JSON
# Check specific value in script
TEMP=
if ; then
fi
# Continuous monitoring
Protocol
The CLI uses the AimX v1 remote access protocol over Unix domain sockets with NDJSON message format.
See docs/design/008-M3-remote-access.md for the full protocol specification.
Development
Run tests:
Run with logging:
RUST_LOG=debug
License
See LICENSE file.