feat(opencode): add opencode doctor diagnostic command#21270
Open
katipally wants to merge 2 commits intoanomalyco:devfrom
Open
feat(opencode): add opencode doctor diagnostic command#21270katipally wants to merge 2 commits intoanomalyco:devfrom
opencode doctor diagnostic command#21270katipally wants to merge 2 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
1 task
Add a comprehensive diagnostic command that checks 13 aspects of an OpenCode installation: - Environment (version, Bun, Git) - Updates (auto-update status, latest version) - Configuration (load/validate, error detection) - Providers & Models (multi-provider auth matrix, default model, model DB) - Agents (native/custom listing, model binding validation) - Tools & Permissions (tool count, disabled tools, permission rules) - LSP Servers (connection status) - MCP Servers (status, tool count, error messages) - Formatters (enabled formatters, file extension coverage) - Plugins (load status) - Context Analysis (description sizes, MCP tool count pressure) - Environment Variables (OPENCODE_* flag validation) - Paths (directory existence and writability) Supports --json for machine-readable output and --verbose for full details. Each section is independently error-handled so one failure never blocks the rest. Closes anomalyco#21269 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c1982ef to
3d45215
Compare
Author
|
Rebased on latest Quick summary for reviewers:
Ready for review whenever convenient. Happy to address any feedback! |
Follows the convention of brew doctor/flutter doctor — return non-zero exit code when failures are detected, making the command usable in CI pipelines and scripts. Warnings still exit 0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Issue for this PR
Closes #21269
Type of change
What does this PR do?
Adds
opencode doctor— a diagnostic command that checks your entire OpenCode setup and reports issues with color-coded output.The problem: OpenCode supports 100+ providers, MCP/LSP servers, agents, formatters, and plugins. When something breaks, users have to run
debug config,debug lsp, check env vars manually, etc. There is no single command to verify everything works.The solution:
opencode doctorruns 13 independent diagnostic sections across the full stack:Each section is independently error-handled — one failure never blocks the rest.
Flags:
--jsonfor machine-readable output,--verbosefor full details.Scope: 2 files only.
packages/opencode/src/cli/cmd/doctor.ts(~500 lines)packages/opencode/src/index.ts(2 lines: import + command registration)Not a duplicate of #17164 — that issue proposed a narrow
opencode config doctorfocused only on config merge precedence and was closed asnot_planned. This is a full-stack diagnostic.How did you verify your code works?
All three variants produce expected output.
bun typecheckconfirms zero new type errors. Ran./script/format.tsand./script/generate.ts— no changes needed.Screenshots / recordings
Default output (
opencode doctor):JSON output (
opencode doctor --json):{ "version": "1.3.2", "channel": "latest", "summary": { "pass": 17, "warn": 4, "fail": 0 }, "sections": [ { "title": "Environment", "checks": [...] }, { "title": "Providers & Models", "checks": [...] }, ... ] }Checklist