From b6d00c6d7f2b22ef1e8568dbbcd9baa1dbc4efbc Mon Sep 17 00:00:00 2001 From: luojiyin Date: Wed, 8 Jul 2026 10:11:17 +0800 Subject: [PATCH 1/2] feat(debug): add close() method to DebugSession type --- src/output/debug.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/output/debug.ts b/src/output/debug.ts index deb832b7..1479d2ea 100644 --- a/src/output/debug.ts +++ b/src/output/debug.ts @@ -6,6 +6,7 @@ export type DebugLogger = (message: string, details?: unknown) => void; export type DebugSession = { log: DebugLogger; announcePath: () => void; + close: () => void; }; export function createDebugLogger(enabled: boolean): DebugSession { @@ -13,6 +14,7 @@ export function createDebugLogger(enabled: boolean): DebugSession { return { log: () => {}, announcePath: () => {}, + close: () => {}, }; } @@ -35,7 +37,7 @@ export function createDebugLogger(enabled: boolean): DebugSession { console.error(`[debug] Writing debug log to ./${filename}`); }; - return { log, announcePath }; + return { log, announcePath, close: () => {} }; } function formatJson(details: unknown): string { From 35519fb138b581a2c964f2479f7e7d10f1317acc Mon Sep 17 00:00:00 2001 From: luojiyin Date: Wed, 8 Jul 2026 20:09:24 +0800 Subject: [PATCH 2/2] test: cover debug session close no-op --- tests/output.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/output.test.ts b/tests/output.test.ts index 48127baf..4db38304 100644 --- a/tests/output.test.ts +++ b/tests/output.test.ts @@ -159,6 +159,11 @@ describe("output formatters", () => { } }); + it("close is callable for enabled and disabled debug sessions", () => { + expect(createDebugLogger(false).close()).toBeUndefined(); + expect(createDebugLogger(true).close()).toBeUndefined(); + }); + it("getPrimaryParent returns null for paths shorter than 3 nodes", () => { const shortPath = createFinding({ dependencyPaths: [["project", "lodash"]],