feat: add shuttle doctor setup-diagnostics subcommand#20
Merged
Conversation
Defines CheckLevel/CheckResult/Report value types and RenderReport, the formatted checklist + tally output for shuttle doctor. Reuses render.go's colorize helper and ANSI constants; adds symbolWarn since the sync Status type has no warning state.
Add ConfigStatus, Diagnose, and supporting helpers to doctor.go. Config-load classification is pure logic over the passed-in ConfigStatus value (no file I/O in the engine). Tool checks use exec.LookPath plus version probes; absence severity is FAIL when the config uses that engine, WARN when it does not.
Add remoteChecks, listRcloneRemotes, filterFileChecks, and rcloneFilterFiles to Diagnose. Compares remote names against listremotes output in-process (no config value enters argv). Encrypted-config failure yields one-line WARN, skips per-remote checks, and leaks no credential reference.
Resolves config path at the CLI boundary, loads config, calls engine.Diagnose, renders the report, and returns errDoctorFailed (mapped to exit 2) when any check fails. Adds two integration tests covering the exit-zero and exit-two paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
shuttle doctorsubcommand that reports environment and config readiness as a ✓/⚠/✗ checklist (rsync/rclone presence and versions, config validity, whether each configured rclone remote exists inrclone listremotes, and filter-file existence), catching a mismatch between a config remote name and the user'srclone.confthat previously surfaced only mid-run. It runs locally with no network, never reads or prompts for the rclone password, and exits 2 on any failure (0 on pass or warn) soshuttle doctor && shuttle runworks as a precondition gate. Shared rclone filter-file resolution is consolidated into a singleconfig.RcloneFilterFilesused by both the runner and doctor.