Skip to main content

CLI: Library Sync Setup Commands

Overview

After pairing two devices, use these commands to set up library synchronization between them.

Prerequisites

  1. Devices must be paired - Use sd network pair generate and sd network pair join first
  2. At least one library exists - Use sd library list to see available libraries
  3. Networking must be running - Check with sd network status
  4. Know the device IDs - Use sd network devices to list paired devices

Commands

0. List Paired Devices (Get Device IDs)

First, you need to know the device ID of the paired device.
Options:
  • --connected - Show only currently connected devices
Example:
JSON Output:
Filter Connected Only:

1. Discover Remote Libraries

Discover what libraries are available on a paired device.
Arguments:
  • <DEVICE_ID> - UUID of the paired device
Example:
JSON Output:

2. Setup Library Sync

Configure library sync between local and remote devices.
Required Arguments:
  • --local-library - UUID of your local library
  • --remote-device - UUID of the paired device
Optional Arguments:
  • --remote-library - UUID of the remote library to sync with (optional for register-only)
  • --action - Sync action type (default: register-only)
    • register-only - Just register devices (Phase 1)
    • merge-into-local - Future (Phase 3)
    • merge-into-remote - Future (Phase 3)
    • create-shared - Future (Phase 3)
  • --leader - Which device is the sync leader (default: local)
    • local - This device is the leader
    • remote - Remote device is the leader
  • --local-device - Override auto-detected local device ID
Example:

Complete Workflow Example

Here’s a complete workflow for pairing devices and setting up library sync:

Device A (CLI Daemon)

Device B (iOS)

Output Formats

All commands support --output flag:

Common Use Cases

Scenario 1: Simple Two-Device Setup

You have a desktop and a phone, both with “My Library” auto-created.

Scenario 2: Multiple Libraries

You want to choose which libraries to sync.

Scenario 3: One-Way Registration

Register your device in their library without syncing data.

Troubleshooting

”Device not paired"

"Device offline"

"Library not found"

"Context not available”

Integration with Other Commands

List Paired Devices

Verify Registration

After setup, the remote device should appear in your library’s device list:

Advanced Usage

Custom Device ID

If you need to override the auto-detected local device ID:

Specify Remote as Leader

If the remote device should be the sync leader:

Future Commands (Phase 3)

When full sync is implemented, additional actions will be available:

See Also

  • Pairing: sd network pair --help
  • Devices: sd network devices --help
  • Libraries: sd library --help
  • Networking: sd network --help
  • Design: docs/core/LIBRARY_SYNC_SETUP.md

Quick Command Reference