refactor(doctor): redesign with 3-tier output and consolidated checks
Consolidate 16 separate checks into 5 (system, config, providers, tools, models). Add 3-tier formatting: default (problems-only), --status (dashboard), --verbose (deep diagnostics). Read actual loaded plugin version from opencode cache directory. Check environment variables for provider authentication.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import color from "picocolors"
|
||||
import type { DoctorResult } from "./types"
|
||||
import { SYMBOLS } from "./constants"
|
||||
import { formatHeader, formatIssue } from "./format-shared"
|
||||
|
||||
export function formatDefault(result: DoctorResult): string {
|
||||
const lines: string[] = []
|
||||
|
||||
lines.push(formatHeader())
|
||||
|
||||
const allIssues = result.results.flatMap((r) => r.issues)
|
||||
|
||||
if (allIssues.length === 0) {
|
||||
const opencodeVer = result.systemInfo.opencodeVersion ?? "unknown"
|
||||
const pluginVer = result.systemInfo.pluginVersion ?? "unknown"
|
||||
lines.push(
|
||||
` ${color.green(SYMBOLS.check)} ${color.green(
|
||||
`System OK (opencode ${opencodeVer} · oh-my-opencode ${pluginVer})`
|
||||
)}`
|
||||
)
|
||||
} else {
|
||||
const issueCount = allIssues.filter((i) => i.severity === "error").length
|
||||
const warnCount = allIssues.filter((i) => i.severity === "warning").length
|
||||
|
||||
const totalStr = `${issueCount + warnCount} ${issueCount + warnCount === 1 ? "issue" : "issues"}`
|
||||
lines.push(` ${color.yellow(SYMBOLS.warn)} ${totalStr} found:\n`)
|
||||
|
||||
allIssues.forEach((issue, index) => {
|
||||
lines.push(formatIssue(issue, index + 1))
|
||||
lines.push("")
|
||||
})
|
||||
}
|
||||
|
||||
return lines.join("\n")
|
||||
}
|
||||
Reference in New Issue
Block a user