From 2e669c0697bc8d3a2f47928bf049d594af068bfc Mon Sep 17 00:00:00 2001 From: Dragon <52599892+DragonnZhang@users.noreply.github.com> Date: Thu, 2 Jul 2026 20:55:57 +0800 Subject: [PATCH] fix(cli): drop /effort tier autocompletion for an argument-hint placeholder (#6179) Bare /effort now reliably opens the picker dialog instead of letting Enter auto-select the first completed tier. The tiers are surfaced as a placeholder via argumentHint ([low|medium|high|xhigh|max]) rather than as submenu-like completion entries; typing /effort still sets one directly. --- .../cli/src/ui/commands/effort-command.test.ts | 15 +++++---------- packages/cli/src/ui/commands/effort-command.ts | 9 +++++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/cli/src/ui/commands/effort-command.test.ts b/packages/cli/src/ui/commands/effort-command.test.ts index 9a23998ad7..b14e49b6a7 100644 --- a/packages/cli/src/ui/commands/effort-command.test.ts +++ b/packages/cli/src/ui/commands/effort-command.test.ts @@ -106,15 +106,10 @@ describe('effortCommand', () => { expect(res).toMatchObject({ messageType: 'error' }); }); - it('completes tier prefixes', async () => { - expect(await effortCommand.completion!(context, 'hi')).toEqual(['high']); - expect(await effortCommand.completion!(context, 'x')).toEqual(['xhigh']); - expect(await effortCommand.completion!(context, '')).toEqual([ - 'low', - 'medium', - 'high', - 'xhigh', - 'max', - ]); + it('does not offer tier autocompletion (tiers are hinted via argumentHint)', () => { + // No completion so bare `/effort` opens the picker instead of auto-picking + // the first tier; `/effort ` still parses in the action above. + expect(effortCommand.completion).toBeUndefined(); + expect(effortCommand.argumentHint).toBe('[low|medium|high|xhigh|max]'); }); }); diff --git a/packages/cli/src/ui/commands/effort-command.ts b/packages/cli/src/ui/commands/effort-command.ts index 51cf439dd0..edf03c34c6 100644 --- a/packages/cli/src/ui/commands/effort-command.ts +++ b/packages/cli/src/ui/commands/effort-command.ts @@ -28,13 +28,14 @@ export const effortCommand: SlashCommand = { { tiers: TIER_LIST }, ); }, + // The tiers show up as a placeholder via argumentHint rather than as + // autocompletion suggestions: bare `/effort` should open the picker dialog + // (no tier auto-selected), while `/effort ` still sets one directly. A + // completion function would surface the tiers as submenu-like entries and let + // Enter auto-pick the first one, which we don't want here. argumentHint: '[low|medium|high|xhigh|max]', kind: CommandKind.BUILT_IN, supportedModes: ['interactive', 'non_interactive', 'acp'] as const, - completion: async (_context, partialArg) => { - const prefix = partialArg.trim().toLowerCase(); - return REASONING_EFFORT_TIERS.filter((tier) => tier.startsWith(prefix)); - }, action: async ( context: CommandContext, actionArgs: string,