Skip to content

Commit 5775cd3

Browse files
authored
fix(cli): explain empty capability listings (#128852)
1 parent 3a17d59 commit 5775cd3

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎src/cli/capability-cli.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,16 @@ describe("capability cli", () => {
875875
});
876876
});
877877

878+
it("renders an explicit empty model list without changing JSON output", async () => {
879+
mocks.loadModelCatalog.mockResolvedValue([]);
880+
881+
await runCapability("model", "list", "--json");
882+
expect(mocks.runtime.writeJson).toHaveBeenCalledWith([]);
883+
884+
await runCapability("model", "list");
885+
expect(mocks.runtime.log).toHaveBeenCalledWith("No results found.");
886+
});
887+
878888
it("reports model providers configured through their environment key", async () => {
879889
vi.stubEnv("OPENAI_API_KEY", "test-openai-key");
880890

‎src/cli/capability-cli/shared.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function formatEnvelopeForText(value: unknown): string {
9090

9191
export function providerSummaryText(value: unknown): string {
9292
const providers = value as Array<Record<string, unknown>>;
93-
return providers.map((entry) => JSON.stringify(entry)).join("\n");
93+
return providers.map((entry) => JSON.stringify(entry)).join("\n") || "No results found.";
9494
}
9595

9696
function hasOwnKeys(value: unknown): boolean {

0 commit comments

Comments
 (0)