From 244cb646771dfe594b10e6031cc176df4f1ef560 Mon Sep 17 00:00:00 2001 From: AshritVerma <71358894+AshritVerma@users.noreply.github.com> Date: Fri, 20 Nov 2026 21:19:18 -0500 Subject: [PATCH] fix(setup): list supported clients instead of a suggestion for an empty client name An empty or whitespace-only --client or --skill-client value normalizes to an empty key, which is a prefix of every id, so suggestion ranking named an arbitrary client. Skip the suggestion for an empty key and report the supported list. --- src/cli/clientNameInput.ts | 4 +++- tests/boundary/cli/clientNameInput.test.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/cli/clientNameInput.ts b/src/cli/clientNameInput.ts index 9f0da4e2b1..c3f7c84119 100644 --- a/src/cli/clientNameInput.ts +++ b/src/cli/clientNameInput.ts @@ -39,7 +39,9 @@ const unknownClientMessage = ( candidates: readonly string[], ): string | undefined => { if (typeof input !== "string") return undefined; - const suggestion = suggestCommand(normalizedClientName(input), candidates); + const key = normalizedClientName(input); + // An empty key is a prefix of every id, so ranking would name an arbitrary one. + const suggestion = key === "" ? undefined : suggestCommand(key, candidates); return suggestion === undefined ? `Unknown client '${input}'. Supported clients: ${candidates.join(", ")}.` : `Unknown client '${input}'. Did you mean '${suggestion}'?`; diff --git a/tests/boundary/cli/clientNameInput.test.ts b/tests/boundary/cli/clientNameInput.test.ts index 49767dfdd4..e84d389740 100644 --- a/tests/boundary/cli/clientNameInput.test.ts +++ b/tests/boundary/cli/clientNameInput.test.ts @@ -74,4 +74,17 @@ describe("client option schemas", () => { /^Unknown client 'zzzz'\. Supported clients: shared, claude_code, /u, ); }); + + it.each(["", " ", "\t"])( + "lists the supported clients instead of a suggestion for %j", + (input) => { + const [issue] = failure({ client: [input] }); + expect(issue?.path).toEqual(["client", 0]); + expect(issue?.message).not.toContain("Did you mean"); + expect(issue?.message).toMatch(/Supported clients: claude_code, /u); + const [skill] = failure({ skillClient: [input] }); + expect(skill?.message).not.toContain("Did you mean"); + expect(skill?.message).toMatch(/Supported clients: shared, /u); + }, + ); });