diff options
Diffstat (limited to 'packages/cli/src/ui/commands')
| -rw-r--r-- | packages/cli/src/ui/commands/settingsCommand.test.ts | 36 | ||||
| -rw-r--r-- | packages/cli/src/ui/commands/settingsCommand.ts | 17 | ||||
| -rw-r--r-- | packages/cli/src/ui/commands/types.ts | 3 |
3 files changed, 55 insertions, 1 deletions
diff --git a/packages/cli/src/ui/commands/settingsCommand.test.ts b/packages/cli/src/ui/commands/settingsCommand.test.ts new file mode 100644 index 00000000..96d0d511 --- /dev/null +++ b/packages/cli/src/ui/commands/settingsCommand.test.ts @@ -0,0 +1,36 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { describe, it, expect, beforeEach } from 'vitest'; +import { settingsCommand } from './settingsCommand.js'; +import { type CommandContext } from './types.js'; +import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; + +describe('settingsCommand', () => { + let mockContext: CommandContext; + + beforeEach(() => { + mockContext = createMockCommandContext(); + }); + + it('should return a dialog action to open the settings dialog', () => { + if (!settingsCommand.action) { + throw new Error('The settings command must have an action.'); + } + const result = settingsCommand.action(mockContext, ''); + expect(result).toEqual({ + type: 'dialog', + dialog: 'settings', + }); + }); + + it('should have the correct name and description', () => { + expect(settingsCommand.name).toBe('settings'); + expect(settingsCommand.description).toBe( + 'View and edit Gemini CLI settings', + ); + }); +}); diff --git a/packages/cli/src/ui/commands/settingsCommand.ts b/packages/cli/src/ui/commands/settingsCommand.ts new file mode 100644 index 00000000..26807852 --- /dev/null +++ b/packages/cli/src/ui/commands/settingsCommand.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { CommandKind, OpenDialogActionReturn, SlashCommand } from './types.js'; + +export const settingsCommand: SlashCommand = { + name: 'settings', + description: 'View and edit Gemini CLI settings', + kind: CommandKind.BUILT_IN, + action: (_context, _args): OpenDialogActionReturn => ({ + type: 'dialog', + dialog: 'settings', + }), +}; diff --git a/packages/cli/src/ui/commands/types.ts b/packages/cli/src/ui/commands/types.ts index 529f4eb8..d4f0b454 100644 --- a/packages/cli/src/ui/commands/types.ts +++ b/packages/cli/src/ui/commands/types.ts @@ -102,7 +102,8 @@ export interface MessageActionReturn { */ export interface OpenDialogActionReturn { type: 'dialog'; - dialog: 'auth' | 'theme' | 'editor' | 'privacy'; + + dialog: 'help' | 'auth' | 'theme' | 'editor' | 'privacy' | 'settings'; } /** |
