fix(coding-agent): respect quietStartup on /reload while keeping diagnostics (fixes #1336)

This commit is contained in:
Mario Zechner 2026-02-06 18:30:25 +01:00
parent e9f94ba6c3
commit fe6f4d3a9d
2 changed files with 197 additions and 96 deletions

View file

@ -9,6 +9,10 @@ function renderLastLine(container: Container, width = 120): string {
return last.render(width).join("\n");
}
function renderAll(container: Container, width = 120): string {
return container.children.flatMap((child) => child.render(width)).join("\n");
}
describe("InteractiveMode.showStatus", () => {
beforeAll(() => {
// showStatus uses the global theme instance
@ -55,3 +59,78 @@ describe("InteractiveMode.showStatus", () => {
expect(renderLastLine(fakeThis.chatContainer)).toContain("STATUS_TWO");
});
});
describe("InteractiveMode.showLoadedResources", () => {
beforeAll(() => {
initTheme("dark");
});
function createShowLoadedResourcesThis(options: {
quietStartup: boolean;
verbose?: boolean;
skills?: Array<{ filePath: string }>;
skillDiagnostics?: Array<{ type: "warning" | "error" | "collision"; message: string }>;
}) {
const fakeThis: any = {
options: { verbose: options.verbose ?? false },
chatContainer: new Container(),
settingsManager: {
getQuietStartup: () => options.quietStartup,
},
session: {
promptTemplates: [],
extensionRunner: undefined,
resourceLoader: {
getPathMetadata: () => new Map(),
getAgentsFiles: () => ({ agentsFiles: [] }),
getSkills: () => ({
skills: options.skills ?? [],
diagnostics: options.skillDiagnostics ?? [],
}),
getPrompts: () => ({ prompts: [], diagnostics: [] }),
getExtensions: () => ({ errors: [] }),
getThemes: () => ({ themes: [], diagnostics: [] }),
},
},
formatDisplayPath: (p: string) => p,
buildScopeGroups: () => [],
formatScopeGroups: () => "resource-list",
getShortPath: (p: string) => p,
formatDiagnostics: () => "diagnostics",
};
return fakeThis;
}
test("does not show verbose listing on quiet startup during reload", () => {
const fakeThis = createShowLoadedResourcesThis({
quietStartup: true,
skills: [{ filePath: "/tmp/skill/SKILL.md" }],
});
(InteractiveMode as any).prototype.showLoadedResources.call(fakeThis, {
extensionPaths: ["/tmp/ext/index.ts"],
force: false,
showDiagnosticsWhenQuiet: true,
});
expect(fakeThis.chatContainer.children).toHaveLength(0);
});
test("still shows diagnostics on quiet startup when requested", () => {
const fakeThis = createShowLoadedResourcesThis({
quietStartup: true,
skills: [{ filePath: "/tmp/skill/SKILL.md" }],
skillDiagnostics: [{ type: "warning", message: "duplicate skill name" }],
});
(InteractiveMode as any).prototype.showLoadedResources.call(fakeThis, {
force: false,
showDiagnosticsWhenQuiet: true,
});
const output = renderAll(fakeThis.chatContainer);
expect(output).toContain("[Skill conflicts]");
expect(output).not.toContain("[Skills]");
});
});