From d8cd2f94b58ad0d6799e81cac42384b851618c3a Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Mon, 22 Jun 2026 13:10:59 -0400 Subject: [PATCH] fix(cliproxy): keep --help working for all subcommands The earlier help-gating overcorrected: scoping global help to 'no real subcommand' meant 'cliproxy status --help' (and list/quota) ran the command and ignored --help. Restore global help on --help/-h anywhere (order-insensitive), carving out only 'routing affinity --help', which renders its own help. --- src/commands/cliproxy/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/cliproxy/index.ts b/src/commands/cliproxy/index.ts index 6382edda..8acaea13 100644 --- a/src/commands/cliproxy/index.ts +++ b/src/commands/cliproxy/index.ts @@ -146,12 +146,12 @@ export async function handleCliproxyCommand(args: string[]): Promise { const verbose = hasAnyFlag(remainingArgs, ['--verbose', '-v']); const command = remainingArgs[0]; - // Show global cliproxy help when there is no real subcommand (no args, or the - // first token is a flag) and --help/-h appears anywhere — order-insensitive, so - // `cliproxy --verbose --help` still works. Real subcommands (e.g. - // `routing affinity --help`) handle --help themselves after dispatch. - const hasRealSubcommand = typeof command === 'string' && !command.startsWith('-'); - if (!hasRealSubcommand && hasAnyFlag(remainingArgs, ['--help', '-h'])) { + // Show global cliproxy help whenever --help/-h appears (order-insensitive, so + // `cliproxy status --help` and `cliproxy --verbose --help` both work). The one + // exception is `routing affinity --help`, which renders affinity-specific help + // after dispatch (handled below). + const isRoutingAffinity = command === 'routing' && remainingArgs[1] === 'affinity'; + if (!isRoutingAffinity && hasAnyFlag(remainingArgs, ['--help', '-h'])) { await showHelp(); return; }