feat: Add unrag doctor command for installation validation and troubleshooting #15
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
This PR introduces the
unrag doctorcommand, a comprehensive diagnostic tool for validating Unrag installations, detecting configuration issues, and troubleshooting common problems before they become production issues.Motivation
Unrag is vendored source code, meaning users own and can modify it. This flexibility comes with a trade-off: there's no central registry tracking what's installed or whether it's configured correctly. Users might add an extractor but forget to register it, set up a database schema but miss an important index, or misconfigure environment variables.
The doctor command addresses this by providing automated validation that surfaces issues early.
Features
Static Checks (default)
Database Checks (--db flag)
Setup Wizard (doctor setup subcommand)
.unrag/doctor.jsonwith project-specific settingsunrag:doctor- run static checksunrag:doctor:db- run with database checksunrag:doctor:ci- strict mode with JSON output for CI pipelinesCLI Options
Exit Codes
Files Changed
cli/commands/doctor.ts- main doctor command implementationcli/commands/doctor-setup.ts- setup wizard implementationcli/lib/doctor/- supporting modules:types.ts- shared types and provider configurationsinfer.ts- installation state inferencestaticChecks.ts- static validation checksconfigScan.ts- configuration coherence analysisdbChecks.ts- database validation checksdoctorConfig.ts- config file handlingenv.ts- environment file loadingoutput.ts- report formattingcli/run.ts- registered doctor commanddocs/guides/doctor.mdxTesting
test/doctor-setup.test.tswith comprehensive test coverage for the setup wizard