Spacedrive CLI
A comprehensive command-line interface for managing Spacedrive Core with full daemon architecture, real-time monitoring, and cross-device file management.Features
- ️ Daemon Architecture: Background daemon with client-server communication
- Library Management: Create, open, switch, and manage multiple libraries
- Location Management: Add, remove, and monitor indexed locations with real-time watching
- ️ Job Management: View, monitor, and control background jobs with live progress
- Real-time Monitoring: Beautiful TUI for monitoring job progress and system events
- Indexing Control: Start indexing jobs with different modes (shallow/content/deep)
- Networking Support: Device pairing, file sharing via Spacedrop
- Multiple Instances: Run isolated daemon instances for different use cases
- Comprehensive Logging: Built-in logging with file output for debugging
- ️ Cross-platform: Works on macOS, Linux, and Windows
- Rich UI: Colored output, progress bars, and formatted tables
New Modular Architecture Benefits
The refactored daemon architecture provides:- Maintainability: Each domain (library, location, job, etc.) is isolated in its own handler module
- Extensibility: New commands can be added by simply creating a new handler
- Type Safety: All commands and responses are strongly typed
- Code Organization: Clear separation between command handling, business logic, and transport
- Testability: Individual handlers can be unit tested in isolation
- Performance: Efficient command routing through handler registry
Installation
sd or spacedrive.
Example for sd:
Quick Start
./target/debug/sd-cli or ./target/release/sd-cli instead of sd.
Usage
Daemon Management
Daemon Auto-Start (macOS)
Set up the daemon to start automatically on login:~/Library/Application Support/spacedrive/logs/. This works with multiple instances by passing --instance before the daemon command.
Auto-start is currently macOS-only. Linux systemd support is planned.
Multiple Daemon Instances
The CLI supports running multiple isolated daemon instances:Basic Commands
Library Management
Location Management
Enhanced Indexing
The new indexing system supports different scopes and persistence modes:current: Index only the specified directory (single level)recursive: Index the directory and all subdirectories
shallow: Metadata only (fastest)content: Metadata + content hashing (moderate)deep: Full analysis including media metadata (slowest)
- UI Navigation:
quick-scan --scope currentfor instant directory viewing - External Browsing:
browse --ephemeralfor exploring non-managed paths - Location Updates:
location --scope currentto refresh specific directories
Job Management
- Live progress bars for running jobs
- Color-coded status (running: yellow, completed: green, failed: red)
- ️ Real-time updates every second
- Automatic cleanup of completed jobs
- ️ Ctrl+C to exit gracefully
File Operations
System Commands
Networking & Device Management
Real-time Job Monitor
The job monitor provides live progress tracking with beautiful visual indicators:Monitor Features
- Multi-job tracking: Monitor all running jobs simultaneously
- Progress bars: Visual progress indicators with percentage
- Color coding: Status-based colors (yellow=running, green=completed, red=failed)
- Real-time updates: Updates every second with latest progress
- Smart cleanup: Completed jobs automatically marked and removed
- Job filtering: Option to monitor specific jobs
Sample Output
Indexing Modes
- Shallow: Fast metadata-only indexing (file names, sizes, dates)
- Content: Standard indexing with content hashing for deduplication
- Deep: Comprehensive analysis including media metadata extraction
Examples
Complete Workflow
Multiple Libraries
Batch Indexing
Architecture
The CLI follows a modular architecture with clear separation of concerns:- Client: Lightweight CLI that communicates with daemon
- Daemon: Long-running background service managing Core
- Handlers: Modular command processors for each domain
- Transport: JSON-RPC communication over Unix socket
- Core: Spacedrive Core library for all operations
Benefits
- Performance: Daemon keeps Core loaded in memory
- Persistence: Operations continue after CLI exits
- Concurrency: Multiple CLI clients can connect
- Monitoring: Real-time tracking of background tasks
- Isolation: Multiple instances for testing
