Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/cli/src/ui/commands/aboutCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('[email protected]'),
})),
};
});

Expand Down Expand Up @@ -98,6 +101,7 @@ describe('aboutCommand', () => {
selectedAuthType: 'test-auth',
gcpProject: 'test-gcp-project',
ideClient: 'test-ide',
userEmail: '[email protected]',
},
expect.any(Number),
);
Expand Down
14 changes: 13 additions & 1 deletion packages/cli/src/ui/commands/aboutCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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<HistoryItemAbout, 'id'> = {
type: MessageType.ABOUT,
cliVersion,
Expand All @@ -41,6 +52,7 @@ export const aboutCommand: SlashCommand = {
selectedAuthType,
gcpProject,
ideClient,
userEmail,
};

context.ui.addItem(aboutItem, Date.now());
Expand Down
14 changes: 14 additions & 0 deletions packages/cli/src/ui/components/AboutBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface AboutBoxProps {
selectedAuthType: string;
gcpProject: string;
ideClient: string;
userEmail?: string;
}

export const AboutBox: React.FC<AboutBoxProps> = ({
Expand All @@ -27,6 +28,7 @@ export const AboutBox: React.FC<AboutBoxProps> = ({
selectedAuthType,
gcpProject,
ideClient,
userEmail,
}) => (
<Box
borderStyle="round"
Expand Down Expand Up @@ -105,6 +107,18 @@ export const AboutBox: React.FC<AboutBoxProps> = ({
</Text>
</Box>
</Box>
{userEmail && (
<Box flexDirection="row">
<Box width="35%">
<Text bold color={theme.text.link}>
User Email
</Text>
</Box>
<Box>
<Text color={theme.text.primary}>{userEmail}</Text>
</Box>
</Box>
)}
{gcpProject && (
<Box flexDirection="row">
<Box width="35%">
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/ui/components/HistoryItemDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
selectedAuthType={itemForDisplay.selectedAuthType}
gcpProject={itemForDisplay.gcpProject}
ideClient={itemForDisplay.ideClient}
userEmail={itemForDisplay.userEmail}
/>
)}
{itemForDisplay.type === 'help' && commands && (
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export type HistoryItemAbout = HistoryItemBase & {
selectedAuthType: string;
gcpProject: string;
ideClient: string;
userEmail?: string;
};

export type HistoryItemHelp = HistoryItemBase & {
Expand Down Expand Up @@ -302,6 +303,7 @@ export type Message =
selectedAuthType: string;
gcpProject: string;
ideClient: string;
userEmail?: string;
content?: string; // Optional content, not really used for ABOUT
}
| {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down