Skip to content

feat: add quorum doctor command#61

Open
Solvely-Colin wants to merge 1 commit intomainfrom
feat/doctor-command
Open

feat: add quorum doctor command#61
Solvely-Colin wants to merge 1 commit intomainfrom
feat/doctor-command

Conversation

@Solvely-Colin
Copy link
Copy Markdown
Owner

Summary

Adds a quorum doctor command that validates the user's Quorum setup in one command.

What it checks

  1. Config β€” ~/.quorum/config.yaml exists and parses correctly
  2. Node.js β€” version β‰₯20
  3. Quorum version β€” current vs latest on npm
  4. Providers β€” lightweight API probe (generates ~5 tokens) to verify auth works for each configured provider

Output format

βœ… Config    ~/.quorum/config.yaml found and valid
βœ… Node.js   v25.5.0 (requires β‰₯20)
βœ… Quorum    v0.13.0 (latest)
βœ… kimi      k2p5 β€” authenticated, 1598ms
❌ ollama    qwen2.5:14b β€” connection refused (is ollama running?)

4 healthy, 1 error

Error diagnosis

Provides actionable messages for common failures: 401 (bad key), 402 (no balance), ECONNREFUSED (service down), ENOTFOUND (DNS), timeouts.

Exit codes

  • 0 β€” all checks pass (warnings ok)
  • 1 β€” any errors

Tests

5 unit tests covering: all-pass, missing config, auth failure, connection refused, mixed results.

Files changed

  • src/cli/doctor.ts β€” new command implementation
  • src/cli/doctor.test.ts β€” tests
  • src/cli/index.ts β€” register the command

Validates the user's Quorum setup in one command:
- Config file exists and parses correctly (YAML validation)
- Node.js version compatibility (requires β‰₯20)
- Quorum version (current vs latest on npm)
- Each configured provider: lightweight API probe to verify auth

Output uses βœ…/❌/⚠️ icons with a summary line.
Exit code 1 if any errors, 0 otherwise.
Copy link
Copy Markdown
Owner Author

@Solvely-Colin Solvely-Colin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean implementation β€” good separation per check, parallel system checks, actionable error messages, sensible exit codes. Tests cover the important failure paths.

A few small things:

  1. npm registry URL: https://registry.npmjs.org/quorum-ai/latest β€” confirm this is the published package name. If the npm package is named differently the version check will silently return a warn on every run.

  2. package.json path: new URL("../../package.json", import.meta.url) works in src/ but verify the relative path holds in the compiled dist/ layout. A subtle breakage if the dist depth differs.

  3. Provider probe cost: noted in the PR and acceptable for a diagnostic command β€” just worth a one-liner in the help text so users know it fires a real token call.

Otherwise looks good to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant