From 43d6dc36686cdec6276e5852a1f63b6f52dd1bda Mon Sep 17 00:00:00 2001 From: Preston Holmes Date: Wed, 19 Nov 2025 19:46:21 -0800 Subject: [PATCH] Add User email detail to about box (#13459) --- packages/cli/src/ui/commands/aboutCommand.test.ts | 4 ++++ packages/cli/src/ui/commands/aboutCommand.ts | 14 +++++++++++++- packages/cli/src/ui/components/AboutBox.tsx | 14 ++++++++++++++ .../cli/src/ui/components/HistoryItemDisplay.tsx | 1 + packages/cli/src/ui/types.ts | 2 ++ packages/core/src/index.ts | 1 + 6 files changed, 35 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/commands/aboutCommand.test.ts b/packages/cli/src/ui/commands/aboutCommand.test.ts index 673efe45c0..be066783c8 100644 --- a/packages/cli/src/ui/commands/aboutCommand.test.ts +++ b/packages/cli/src/ui/commands/aboutCommand.test.ts @@ -22,6 +22,9 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => { getDetectedIdeDisplayName: vi.fn().mockReturnValue('test-ide'), }), }, + UserAccountManager: vi.fn().mockImplementation(() => ({ + getCachedGoogleAccount: vi.fn().mockReturnValue('test-email@example.com'), + })), }; }); @@ -98,6 +101,7 @@ describe('aboutCommand', () => { selectedAuthType: 'test-auth', gcpProject: 'test-gcp-project', ideClient: 'test-ide', + userEmail: 'test-email@example.com', }, expect.any(Number), ); diff --git a/packages/cli/src/ui/commands/aboutCommand.ts b/packages/cli/src/ui/commands/aboutCommand.ts index 447c3dd753..fad66a119e 100644 --- a/packages/cli/src/ui/commands/aboutCommand.ts +++ b/packages/cli/src/ui/commands/aboutCommand.ts @@ -9,7 +9,11 @@ import type { CommandContext, SlashCommand } from './types.js'; import { CommandKind } from './types.js'; import process from 'node:process'; import { MessageType, type HistoryItemAbout } from '../types.js'; -import { IdeClient } from '@google/gemini-cli-core'; +import { + IdeClient, + UserAccountManager, + debugLogger, +} from '@google/gemini-cli-core'; export const aboutCommand: SlashCommand = { name: 'about', @@ -32,6 +36,13 @@ export const aboutCommand: SlashCommand = { const gcpProject = process.env['GOOGLE_CLOUD_PROJECT'] || ''; const ideClient = await getIdeClientName(context); + const userAccountManager = new UserAccountManager(); + const cachedAccount = userAccountManager.getCachedGoogleAccount(); + debugLogger.log('AboutCommand: Retrieved cached Google account', { + cachedAccount, + }); + const userEmail = cachedAccount ?? undefined; + const aboutItem: Omit = { type: MessageType.ABOUT, cliVersion, @@ -41,6 +52,7 @@ export const aboutCommand: SlashCommand = { selectedAuthType, gcpProject, ideClient, + userEmail, }; context.ui.addItem(aboutItem, Date.now()); diff --git a/packages/cli/src/ui/components/AboutBox.tsx b/packages/cli/src/ui/components/AboutBox.tsx index 129ed30351..b14b814f03 100644 --- a/packages/cli/src/ui/components/AboutBox.tsx +++ b/packages/cli/src/ui/components/AboutBox.tsx @@ -17,6 +17,7 @@ interface AboutBoxProps { selectedAuthType: string; gcpProject: string; ideClient: string; + userEmail?: string; } export const AboutBox: React.FC = ({ @@ -27,6 +28,7 @@ export const AboutBox: React.FC = ({ selectedAuthType, gcpProject, ideClient, + userEmail, }) => ( = ({ + {userEmail && ( + + + + User Email + + + + {userEmail} + + + )} {gcpProject && ( diff --git a/packages/cli/src/ui/components/HistoryItemDisplay.tsx b/packages/cli/src/ui/components/HistoryItemDisplay.tsx index 6ef94a6659..a5f3668345 100644 --- a/packages/cli/src/ui/components/HistoryItemDisplay.tsx +++ b/packages/cli/src/ui/components/HistoryItemDisplay.tsx @@ -108,6 +108,7 @@ export const HistoryItemDisplay: React.FC = ({ selectedAuthType={itemForDisplay.selectedAuthType} gcpProject={itemForDisplay.gcpProject} ideClient={itemForDisplay.ideClient} + userEmail={itemForDisplay.userEmail} /> )} {itemForDisplay.type === 'help' && commands && ( diff --git a/packages/cli/src/ui/types.ts b/packages/cli/src/ui/types.ts index fc8008ad6a..ff8f550f18 100644 --- a/packages/cli/src/ui/types.ts +++ b/packages/cli/src/ui/types.ts @@ -131,6 +131,7 @@ export type HistoryItemAbout = HistoryItemBase & { selectedAuthType: string; gcpProject: string; ideClient: string; + userEmail?: string; }; export type HistoryItemHelp = HistoryItemBase & { @@ -302,6 +303,7 @@ export type Message = selectedAuthType: string; gcpProject: string; ideClient: string; + userEmail?: string; content?: string; // Optional content, not really used for ABOUT } | { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 67e80a7692..fe34a98cac 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -54,6 +54,7 @@ export * from './utils/gitIgnoreParser.js'; export * from './utils/gitUtils.js'; export * from './utils/editor.js'; export * from './utils/quotaErrorDetection.js'; +export * from './utils/userAccountManager.js'; export * from './utils/googleQuotaErrors.js'; export * from './utils/fileUtils.js'; export * from './utils/retry.js';