From 6e258e28508e2862c0a7f7be40b5ab6fd725f453 Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Tue, 15 Jul 2025 02:22:46 -0400 Subject: migrate /about (#4207) --- .../cli/src/ui/hooks/slashCommandProcessor.test.ts | 83 ---------------------- packages/cli/src/ui/hooks/slashCommandProcessor.ts | 30 -------- 2 files changed, 113 deletions(-) (limited to 'packages/cli/src/ui/hooks') diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts index d920117d..6946bde0 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts @@ -277,89 +277,6 @@ describe('useSlashCommandProcessor', () => { }); }); - describe('/about command', () => { - it('should show the about box with all details including auth and project', async () => { - // Arrange - mockGetCliVersionFn.mockResolvedValue('test-version'); - process.env.SANDBOX = 'gemini-sandbox'; - process.env.GOOGLE_CLOUD_PROJECT = 'test-gcp-project'; - vi.mocked(mockConfig.getModel).mockReturnValue('test-model-from-config'); - - const settings = { - merged: { - selectedAuthType: 'test-auth-type', - contextFileName: 'GEMINI.md', - }, - } as unknown as LoadedSettings; - - const { result } = renderHook(() => - useSlashCommandProcessor( - mockConfig, - settings, - [], - mockAddItem, - mockClearItems, - mockLoadHistory, - mockRefreshStatic, - mockSetShowHelp, - mockOnDebugMessage, - mockOpenThemeDialog, - mockOpenAuthDialog, - mockOpenEditorDialog, - mockCorgiMode, - false, - mockSetQuittingMessages, - vi.fn(), // mockOpenPrivacyNotice - ), - ); - - // Act - await act(async () => { - await result.current.handleSlashCommand('/about'); - }); - - // Assert - expect(mockAddItem).toHaveBeenCalledTimes(2); // user message + about message - expect(mockAddItem).toHaveBeenNthCalledWith( - 2, - expect.objectContaining({ - type: 'about', - cliVersion: 'test-version', - osVersion: 'test-platform', - sandboxEnv: 'gemini-sandbox', - modelVersion: 'test-model-from-config', - selectedAuthType: 'test-auth-type', - gcpProject: 'test-gcp-project', - }), - expect.any(Number), - ); - }); - - it('should show sandbox-exec profile when applicable', async () => { - // Arrange - mockGetCliVersionFn.mockResolvedValue('test-version'); - process.env.SANDBOX = 'sandbox-exec'; - process.env.SEATBELT_PROFILE = 'test-profile'; - vi.mocked(mockConfig.getModel).mockReturnValue('test-model-from-config'); - - const { result } = getProcessorHook(); - - // Act - await act(async () => { - await result.current.handleSlashCommand('/about'); - }); - - // Assert - expect(mockAddItem).toHaveBeenNthCalledWith( - 2, - expect.objectContaining({ - sandboxEnv: 'sandbox-exec (test-profile)', - }), - expect.any(Number), - ); - }); - }); - describe('Other commands', () => { it('/editor should open editor dialog and return handled', async () => { const { handleSlashCommand } = getProcessor(); diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 6465a49d..e8d773b4 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -584,35 +584,6 @@ export const useSlashCommandProcessor = ( toggleCorgiMode(); }, }, - { - name: 'about', - description: 'show version info', - action: async (_mainCommand, _subCommand, _args) => { - const osVersion = process.platform; - let sandboxEnv = 'no sandbox'; - if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') { - sandboxEnv = process.env.SANDBOX; - } else if (process.env.SANDBOX === 'sandbox-exec') { - sandboxEnv = `sandbox-exec (${ - process.env.SEATBELT_PROFILE || 'unknown' - })`; - } - const modelVersion = config?.getModel() || 'Unknown'; - const cliVersion = await getCliVersion(); - const selectedAuthType = settings.merged.selectedAuthType || ''; - const gcpProject = process.env.GOOGLE_CLOUD_PROJECT || ''; - addMessage({ - type: MessageType.ABOUT, - timestamp: new Date(), - cliVersion, - osVersion, - sandboxEnv, - modelVersion, - selectedAuthType, - gcpProject, - }); - }, - }, { name: 'bug', description: 'submit a bug report', @@ -1021,7 +992,6 @@ export const useSlashCommandProcessor = ( toggleCorgiMode, savedChatTags, config, - settings, showToolDescriptions, session, gitService, -- cgit v1.2.3