Skip to content

Feature: opendotsync doctor command for diagnosing setup issues #6

Description

@piranhap

Summary

New users frequently hit silent failures: missing rclone/git binaries, bad credentials, wrong repo URL format, missing SSH keys, uninitialised state. A doctor command that checks prerequisites and reports problems would dramatically reduce setup friction.

Proposed Output

opendotsync doctor

Checking configuration...
  ✓ Config file found: ~/.config/opendotsync/config.yaml
  ✓ Paths file found: ~/.config/opendotsync/paths.yaml
  ✓ State dir exists: ~/.local/share/opendotsync/

Checking backend (github)...
  ✓ git binary found: /usr/bin/git (version 2.47.1)
  ✓ Repo URL valid: https://github.com/user/repo.git
  ✓ Cache dir exists: ~/.local/share/opendotsync/github-cache/...
  ✓ Remote reachable: github.com (SSH)
  ✗ Push access: permission denied — check credentials or SSH key

Checking tracked paths...
  ✓ 2 files matched (703 B projected)
  ⚠ .zsh_history listed but file not found

Checking encryption...
  ✓ Encryption disabled

Local version: 4  Remote version: 4  (in sync)

Implementation Notes

  • Add Doctor variant to cli::Command in src/cli.rs
  • Add cmd_doctor() in src/sync.rs
  • Each backend should expose a check_connectivity() -> Result<(), BackendError> method on the StorageBackend trait
  • For the github backend: run git ls-remote <repo> to verify read access, attempt a dummy operation to check write access
  • For rclone: run rclone lsd <remote>:<path> to verify access

Affected Files

  • src/cli.rs — add Doctor command
  • src/sync.rs — add cmd_doctor()
  • src/backend/mod.rs — add check_connectivity() to trait
  • src/backend/github.rs, rclone.rs, local.rs — implement check_connectivity()
  • src/main.rs — wire dispatch

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions