fix(cli): render verbose doctor check details

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
ricatix
2026-03-12 22:20:48 +07:00
parent 27538dcfe6
commit 63ac37cd29
2 changed files with 44 additions and 0 deletions

View File

@@ -57,6 +57,19 @@ export function formatVerbose(result: DoctorResult): string {
}
lines.push("")
for (const check of results) {
if (!check.details || check.details.length === 0) {
continue
}
lines.push(`${color.bold(check.name)}`)
lines.push(`${color.dim("\u2500".repeat(40))}`)
for (const detail of check.details) {
lines.push(detail)
}
lines.push("")
}
const allIssues = results.flatMap((r) => r.issues)
if (allIssues.length > 0) {
lines.push(`${color.bold("Issues")}`)

View File

@@ -51,6 +51,23 @@ function createDoctorResultWithIssues(): DoctorResult {
return base
}
function createDoctorResultWithDetails(): DoctorResult {
const base = createDoctorResult()
base.results = [
...base.results,
{
name: "Models",
status: "pass",
message: "2 agents, 1 category, 0 overrides",
details: ["Available models: openai/gpt-5.4", "Agent sisyphus -> openai/gpt-5.4"],
issues: [],
},
]
base.summary.total = 3
base.summary.passed = 2
return base
}
describe("formatDoctorOutput", () => {
describe("#given default mode", () => {
it("shows System OK when no issues", async () => {
@@ -137,6 +154,20 @@ describe("formatDoctorOutput", () => {
expect(output).toContain("0 failed")
expect(output).toContain("1 warnings")
})
it("renders check details sections such as Models", async () => {
//#given
const result = createDoctorResultWithDetails()
const { formatDoctorOutput } = await import(`./formatter?verbose-details-${Date.now()}`)
//#when
const output = stripAnsi(formatDoctorOutput(result, "verbose"))
//#then
expect(output).toContain("Models")
expect(output).toContain("Available models: openai/gpt-5.4")
expect(output).toContain("Agent sisyphus -> openai/gpt-5.4")
})
})
describe("formatJsonOutput", () => {