diff --git a/src/frontends/tui/commands.test.ts b/src/frontends/tui/commands.test.ts index eca95e8..d2b0996 100644 --- a/src/frontends/tui/commands.test.ts +++ b/src/frontends/tui/commands.test.ts @@ -245,6 +245,18 @@ describe('getCommandCompletions', () => { const completions = getCommandCompletions('/ru'); expect(completions).toContain('/runtime'); }); + + it('completes /login mode values', () => { + const completions = getCommandCompletions('/login anthropic mode '); + expect(completions).toContain('/login anthropic mode api_key'); + expect(completions).toContain('/login anthropic mode oauth'); + expect(completions).toContain('/login anthropic mode auto'); + }); + + it('filters mode completions by partial input', () => { + const completions = getCommandCompletions('/login anthropic mode o'); + expect(completions).toEqual(['/login anthropic mode oauth']); + }); }); describe('isToolInventoryQuery', () => { diff --git a/src/frontends/tui/commands.ts b/src/frontends/tui/commands.ts index b675a0f..c67f0f3 100644 --- a/src/frontends/tui/commands.ts +++ b/src/frontends/tui/commands.ts @@ -368,6 +368,20 @@ export function getCommandCompletions(partial: string): string[] { return []; } + // Complete /login mode + if (trimmed.startsWith('/login ')) { + const rest = trimmed.slice('/login '.length).trim(); + const parts = rest.split(/\s+/); + // /login mode + if (parts.length >= 2 && parts[1] === 'mode') { + const partial = (parts[2] ?? '').toLowerCase(); + const modes = ['api_key', 'oauth', 'auto']; + return modes + .filter(m => m.startsWith(partial)) + .map(m => `/login ${parts[0]} mode ${m}`); + } + } + // Complete /model if (trimmed.startsWith('/model ')) { const args = trimmed.slice('/model '.length).trim();