diff --git a/src/resources/extensions/gsd/commands-handlers.ts b/src/resources/extensions/gsd/commands-handlers.ts index 1797b2cd9..25074d634 100644 --- a/src/resources/extensions/gsd/commands-handlers.ts +++ b/src/resources/extensions/gsd/commands-handlers.ts @@ -78,6 +78,10 @@ export function parseDoctorArgs(args: string) { return { jsonMode, dryRun, fixFlag, includeBuild, includeTests, mode, requestedScope }; } +export function isDoctorHealActionable(issue: { fixable: boolean; severity: string }): boolean { + return issue.fixable && issue.severity !== "info"; +} + export async function handleDoctor(args: string, ctx: ExtensionCommandContext, pi: ExtensionAPI): Promise { const { jsonMode, dryRun, fixFlag, includeBuild, includeTests, mode, requestedScope } = parseDoctorArgs(args); const scope = await selectDoctorScope(projectRoot(), requestedScope); @@ -109,7 +113,7 @@ export async function handleDoctor(args: string, ctx: ExtensionCommandContext, p scope: effectiveScope, includeWarnings: true, }); - const actionable = unresolved.filter(issue => issue.severity === "error"); + const actionable = unresolved.filter(isDoctorHealActionable); if (actionable.length === 0) { ctx.ui.notify("Doctor heal found nothing actionable to hand off to the LLM.", "info"); return; diff --git a/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts b/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts new file mode 100644 index 000000000..718e06f7b --- /dev/null +++ b/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts @@ -0,0 +1,14 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { isDoctorHealActionable } from "../commands-handlers.js"; + +test("doctor heal actionable filter keeps fixable warnings and errors", () => { + assert.equal(isDoctorHealActionable({ fixable: true, severity: "warning" }), true); + assert.equal(isDoctorHealActionable({ fixable: true, severity: "error" }), true); +}); + +test("doctor heal actionable filter excludes info and non-fixable issues", () => { + assert.equal(isDoctorHealActionable({ fixable: true, severity: "info" }), false); + assert.equal(isDoctorHealActionable({ fixable: false, severity: "warning" }), false); + assert.equal(isDoctorHealActionable({ fixable: false, severity: "error" }), false); +});