Add rw config doctor command for configuration diagnostics#89
Merged
shadowhand merged 1 commit intomainfrom Apr 28, 2026
Merged
Add rw config doctor command for configuration diagnostics#89shadowhand merged 1 commit intomainfrom
rw config doctor command for configuration diagnostics#89shadowhand merged 1 commit intomainfrom
Conversation
5ec666e to
debe8aa
Compare
Runs four checks against the active profile (or `--profile`) and reports each as pass/warn/fail/skip/info: 1. profile — resolves to organization + stage 2. auth — credentials exist and (for bearer) aren't expired 3. api — `GET /clinicians/me` returns 2xx, with status + latency 4. defaults — lists configured `config default` keys (informational) Later checks skip when an earlier dependency fails. Exits non-zero if any check fails. Emits structured output under `--json`.
debe8aa to
9a77d13
Compare
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.
Resolves CL-4
Summary
Adds a new
rw config doctorcommand that runs a fixed sequence of diagnostic checks against the active profile's configuration, credentials, and API connectivity. The command helps users identify and troubleshoot setup issues.Key Changes
New
doctormodule (src/commands/config/doctor.rs): Implements four sequential checks:profile: Verifies a profile is selected and resolves to an organization + stageauth: Checks that stored credentials exist and (for bearer tokens) aren't expiredapi: Makes a test request toGET /clinicians/meand reports HTTP status + latencydefaults: Lists configured default values (informational only)Check status levels: Introduced
CheckStatusenum with five states (Pass,Warn,Fail,Skip,Info) and visual glyphs (✓, ⚠, ✗, -, ℹ)Structured output:
Cascading logic: Later checks are skipped when earlier dependencies fail (e.g., API check skipped if auth check fails)
Direct HTTP client: Uses
reqwest::Clientdirectly instead ofApiClientto handle broken/missing config and surface non-2xx responses as check failures rather than errorsCLI integration: Added
Doctorvariant toConfigCommandsenum; updatedconfig::dispatchto be asyncComprehensive tests: 72 test cases covering profile resolution, auth validation (basic + bearer tokens), API reachability, defaults listing, and integration scenarios
Documentation: Updated README with usage examples and check descriptions
Notable Implementation Details
--profileflag is supportedhttps://claude.ai/code/session_01Fj5s8uKf3wiYXUF7oBJBFS