# VaultLink Local CLI A standalone command-line interface for syncing VaultLink vaults to your local filesystem. This CLI wraps the VaultLink sync client and provides file watching capabilities for real-time synchronization. ## Features - Real-time bidirectional sync between local filesystem and VaultLink server - File watching with automatic change detection - Cross-platform support (Linux, macOS, Windows) - Configuration via command-line arguments or JSON file - Comprehensive error handling and logging - Graceful shutdown on SIGINT/SIGTERM ## Installation ### Using Docker (Recommended) The easiest way to run VaultLink CLI is using Docker: ```bash docker pull ghcr.io/schmelczer/vault-link-cli:latest # Run with all options via command line docker run -v /path/to/vault:/vault \ ghcr.io/schmelczer/vault-link-cli:latest \ -l /vault \ -r https://sync.example.com \ -t your-auth-token \ -v default # Or use a config file docker run -v /path/to/vault:/vault \ -v /path/to/config.json:/config.json \ ghcr.io/schmelczer/vault-link-cli:latest \ -l /vault \ -c /config.json ``` ### Using Docker Compose ```yaml version: '3.8' services: vaultlink-cli: image: ghcr.io/schmelczer/vault-link-cli:latest volumes: - ./vault:/vault - ./config.json:/config.json command: -l /vault -c /config.json restart: unless-stopped ``` ### From npm Package ```bash npm install -g @schmelczer/local-client-cli vaultlink --help ``` ### From Source ```bash cd frontend/local-client-cli npm install npm run build node dist/cli.js --help ``` ## Usage ### Basic Usage ```bash vaultlink \ --local-path ./my-vault \ --remote-uri https://sync.example.com \ --token your-auth-token \ --vault-name default ``` ### Using a Configuration File Create a `config.json` file: ```json { "remoteUri": "https://sync.example.com", "token": "your-auth-token", "vaultName": "default", "syncConcurrency": 1, "maxFileSizeMB": 10, "ignorePatterns": [".git/**", "*.tmp"], "webSocketRetryIntervalMs": 3500 } ``` Then run: ```bash vaultlink --local-path ./my-vault --config config.json ``` ### Command-Line Options #### Required Arguments - `-l, --local-path ` - Local directory path to sync - `-r, --remote-uri ` - Remote server URI (unless using --config) - `-t, --token ` - Authentication token (unless using --config) - `-v, --vault-name ` - Vault name (unless using --config) #### Optional Arguments - `-c, --config ` - Load configuration from JSON file - `--sync-concurrency ` - Number of concurrent sync operations (default: 1) - `--max-file-size-mb ` - Maximum file size in MB (default: 10) - `--ignore-pattern ` - Pattern to ignore (can be used multiple times) - `--websocket-retry-interval-ms ` - WebSocket retry interval in ms (default: 3500) - `-h, --help` - Print help message - `-V, --version` - Print version ### Ignore Patterns Ignore patterns support glob syntax. The CLI automatically ignores: - `.vaultlink/**` - Internal sync data directory - `.git/**` - Git repository files You can add additional patterns: ```bash vaultlink \ --local-path ./my-vault \ --remote-uri https://sync.example.com \ --token mytoken \ --vault-name default \ --ignore-pattern "*.tmp" \ --ignore-pattern ".DS_Store" \ --ignore-pattern "node_modules/**" ``` ## Docker Deployment ### Self-Hosting with Docker The CLI is designed to run as a long-lived container: ```bash # Create a vault directory mkdir -p ./vault # Create config.json cat > config.json <