| Crates.io | amaters-cli |
| lib.rs | amaters-cli |
| version | 0.1.0 |
| created_at | 2026-01-19 01:44:40.813149+00 |
| updated_at | 2026-01-19 01:44:40.813149+00 |
| description | Command-line interface for AmateRS |
| homepage | |
| repository | https://github.com/cool-japan/amaters |
| max_upload_size | |
| id | 2053527 |
| size | 162,818 |
Command-line interface for AmateRS
amaters-cli provides a convenient command-line tool for interacting with AmateRS servers. It's useful for administration, debugging, and quick operations.
Current Status: Phase 1-6 implemented - Basic commands (Set, Get, Delete), Query commands (Range, Filter), Key Management, Server Management, Administration, Configuration management, and Output formatting (JSON, YAML, Table) with progress bars are fully functional.
# Build from source
cargo install --path crates/amaters-cli
# Or use cargo install (once published)
cargo install amaters-cli
# Initialize configuration (optional)
amaters-cli config init
# Set environment variables (optional)
export AMATERS_SERVER_URL="http://localhost:50051"
export AMATERS_COLLECTION="default"
export AMATERS_OUTPUT_FORMAT="table"
# Set a value
amaters-cli set my_key "my encrypted value"
# Get a value
amaters-cli get my_key
# Delete a value
amaters-cli delete my_key
# Range query
amaters-cli range start_key end_key
# Query with filter (API ready, needs SDK implementation)
amaters-cli query "age > 18"
# Show configuration
amaters-cli config show
# Set a key-value pair
amaters-cli set <key> <value>
# Get a value by key
amaters-cli get <key>
# Delete a key
amaters-cli delete <key>
# Range query
amaters-cli range <start-key> <end-key>
# Execute filter query (API ready, needs SDK implementation)
amaters-cli query <filter-expression>
# Initialize configuration file
amaters-cli config init
# Show current configuration
amaters-cli config show
# Generate new FHE keys
amaters-cli key generate <key-name> --description "My key"
# Import key from file
amaters-cli key import <key-name> --file <path> --description "Imported key"
# Export key to file
amaters-cli key export <key-name> --file <output-path>
# List all keys
amaters-cli key list
# Delete a key
amaters-cli key delete <key-name>
# Show detailed server status
amaters-cli server status
# Perform health check
amaters-cli server health
# Show server metrics
amaters-cli server metrics
# Show cluster information
amaters-cli server cluster
# Show node information
amaters-cli server nodes
# Create a database backup
amaters-cli admin backup <destination-dir> [--incremental]
# Restore from backup
amaters-cli admin restore <source-dir>
# Trigger manual compaction
amaters-cli admin compact [--collection <name>]
# Show database statistics
amaters-cli admin stats
# Verify database integrity
amaters-cli admin verify
# Show server logs
amaters-cli admin logs [-n <lines>] [--follow]
Configuration file is automatically created at ~/.amaters/config.toml:
server_url = "http://localhost:50051"
default_collection = "default"
output_format = "table"
color = true
[tls]
enabled = false
# ca_cert = "/path/to/ca.pem"
# client_cert = "/path/to/client.pem"
# client_key = "/path/to/client-key.pem"
You can initialize it with:
amaters-cli config init
Override configuration with flags:
amaters-cli -s <server-url> -c <collection> -f <format> <command>
Options:
-s, --server <URL>: Server URL-c, --collection <NAME>: Collection name-f, --format <FORMAT>: Output format (json, yaml, table)Environment variables override config file:
# Server URL
export AMATERS_SERVER_URL="http://localhost:50051"
# Default collection
export AMATERS_COLLECTION="default"
# Output format
export AMATERS_OUTPUT_FORMAT="json"
# Enable/disable color
export AMATERS_COLOR="true"
amaters-cli get my_key
# Or explicitly:
amaters-cli -f table get my_key
Output:
┌────────────┬──────────────────────┐
│ Property │ Value │
├────────────┼──────────────────────┤
│ Key │ my_key │
│ Size │ 1024 bytes │
│ Checksum │ 0xa1b2c3d4 │
│ Created At │ 2026-01-17T12:00:00Z │
└────────────┴──────────────────────┘
amaters-cli -f json get my_key
Output:
{
"status": "success",
"operation": "get",
"key": "my_key",
"value": {
"size": 1024,
"checksum": 2712847316,
"created_at": "2026-01-17T12:00:00Z"
}
}
amaters-cli -f yaml get my_key
Output:
status: success
operation: get
key: my_key
value:
size: 1024
checksum: 2712847316
created_at: '2026-01-17T12:00:00Z'
# Set a value
amaters-cli set user:123 "John Doe"
# ✓ Successfully set key: user:123
# Get a value
amaters-cli get user:123
# Shows detailed table
# Delete a value
amaters-cli delete user:123
# ✓ Successfully deleted key: user:123
# JSON output
amaters-cli -f json get user:123
# Table output (default)
amaters-cli get user:123
# Query a range of keys
amaters-cli range user:000 user:999
# With JSON output
amaters-cli -f json range user:000 user:999
# Initialize config
amaters-cli config init
# ✓ Configuration initialized at: ~/.amaters/config.toml
# View config
amaters-cli config show
# Override server URL
export AMATERS_SERVER_URL="http://production.example.com:50051"
amaters-cli get user:123
# Override collection
export AMATERS_COLLECTION="production"
amaters-cli set key value
# Generate a new key
amaters-cli key generate my_key --description "Production key"
# ⠋ Generating FHE keys (this may take a while)...
# ✓ Generated key 'my_key' (12345 bytes)
# List all keys
amaters-cli key list
# Shows JSON/YAML/Table with all keys
# Export a key
amaters-cli key export my_key --file ./backup/my_key.key
# ✓ Exported key 'my_key' to "./backup/my_key.key"
# Import a key
amaters-cli key import restored_key --file ./backup/my_key.key
# ✓ Imported key 'restored_key' from "./backup/my_key.key"
# Delete a key
amaters-cli key delete old_key
# ✓ Deleted key 'old_key'
# Check server status
amaters-cli server status
# Shows version, uptime, connections, memory usage, etc.
# Health check
amaters-cli server health
# Shows database, consensus, and network health
# View metrics
amaters-cli server metrics
# Shows QPS, latency, cache hit rate, etc.
# Cluster information
amaters-cli server cluster
# Shows cluster ID, nodes, leader, replication factor
# Node information
amaters-cli server nodes
# Shows details about each node in the cluster
# Create a backup
amaters-cli admin backup /backups/db_$(date +%Y%m%d)
# ⠋ Creating backup...
# Shows backup metadata (ID, size, key count, etc.)
# Create incremental backup
amaters-cli admin backup /backups/incremental --incremental
# Restore from backup
amaters-cli admin restore /backups/db_20260117
# ⠋ Restoring from backup...
# Shows restore result (keys restored, duration, etc.)
# Trigger compaction
amaters-cli admin compact
# ⠋ Running compaction...
# Shows compaction result (bytes reclaimed, duration, etc.)
# Compact specific collection
amaters-cli admin compact --collection users
# View database statistics
amaters-cli admin stats
# Shows detailed DB stats (SSTables, memtables, WAL, compaction)
# Verify database integrity
amaters-cli admin verify
# ⠋ Verifying database integrity...
# Shows verification result (verified keys, errors found, etc.)
# View server logs
amaters-cli admin logs
# Shows last 100 lines
# View last 500 lines
amaters-cli admin logs -n 500
# Follow logs (tail -f style)
amaters-cli admin logs --follow
Shell completion will be available in a future release.
Licensed under MIT OR Apache-2.0
COOLJAPAN OU (Team KitaSan)