From 8b4c96e6c6b3ed6806e4cd72b556b5db6114304a Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 11 Oct 2026 06:41:46 +0800 Subject: [PATCH] fix(cli): preserve native option descriptions in help Keep the optional address description visible to incur and describe the actual bundle plist default and absolute-path support. Extend the existing command help sweep instead of traversing the inventory a second time. Refs: #1418 Co-authored-by: Fazmin --- src/cli/coreNativeCommands.ts | 2 +- src/cli/utilityCommands.ts | 2 +- tests/boundary/cli/cliOptionAliases.test.ts | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cli/coreNativeCommands.ts b/src/cli/coreNativeCommands.ts index a00f41cdf..77ded7347 100644 --- a/src/cli/coreNativeCommands.ts +++ b/src/cli/coreNativeCommands.ts @@ -188,7 +188,7 @@ export const registerCoreNativeCommands = ( }), options: z.object({ type: z.string().optional().describe("Exact database type category path"), - address: z.string().describe("Exact native address").optional(), + address: z.string().optional().describe("Exact native address"), "target-format": formatSelectionOption, provider: providerSelectionOption, }), diff --git a/src/cli/utilityCommands.ts b/src/cli/utilityCommands.ts index 47cb9e5bc..9c380eaff 100644 --- a/src/cli/utilityCommands.ts +++ b/src/cli/utilityCommands.ts @@ -169,7 +169,7 @@ const registerNativeCommands = ( .string() .optional() .describe( - "Plist path relative to the app root (default: Contents/Info.plist)", + "Plist path relative to the app root, or an absolute path (default: the bundle's Info.plist)", ), }), run: ({ args, options }) => diff --git a/tests/boundary/cli/cliOptionAliases.test.ts b/tests/boundary/cli/cliOptionAliases.test.ts index 4bdedf2da..9e109aa2b 100644 --- a/tests/boundary/cli/cliOptionAliases.test.ts +++ b/tests/boundary/cli/cliOptionAliases.test.ts @@ -41,6 +41,7 @@ describe("CLI option aliases", () => { it("register only single-character short flags", async () => { const cli = createCli({}); const invalid: string[] = []; + const undescribed: string[] = []; for (const command of createCliInventory(cli).primary) { for (const [option, short] of Object.entries( registeredAliases(cli, command), @@ -52,8 +53,13 @@ describe("CLI option aliases", () => { const help = await serve(cli, [command, "--help"]); for (const match of help.stdout.matchAll(/(?:^|[\s,])-([a-z][\w-]+)/gmu)) invalid.push(`${command} help: -${match[1] ?? ""}`); + const options = /^Options:\n((?: {2}.*\n?)*)/mu.exec(help.stdout)?.[1]; + for (const line of options?.split("\n") ?? []) + if (/^ {2}--\S+(?: <[^>]+>)?\s*$/u.test(line)) + undescribed.push(`${command} ${line.trim()}`); } expect(invalid).toEqual([]); + expect(undescribed).toEqual([]); }); it("accepts kebab-case long options without registered aliases", async () => {