fix(gsd): let doctor heal dispatch fixable warnings (#3875)
This commit is contained in:
parent
daef91f7b8
commit
a5b46eaca3
2 changed files with 19 additions and 1 deletions
|
|
@ -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<void> {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue