Files
gemini-cli/packages/cli/src/ui/commands/aboutCommand.ts

58 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-07-15 02:22:46 -04:00
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { getCliVersion } from '../../utils/version.js';
import { CommandKind, SlashCommand } from './types.js';
2025-07-15 02:22:46 -04:00
import process from 'node:process';
import { MessageType, type HistoryItemAbout } from '../types.js';
export const aboutCommand: SlashCommand = {
name: 'about',
description: 'show version info',
kind: CommandKind.BUILT_IN,
2025-07-15 02:22:46 -04:00
action: async (context) => {
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') {
2025-07-15 02:22:46 -04:00
sandboxEnv = `sandbox-exec (${
process.env['SEATBELT_PROFILE'] || 'unknown'
2025-07-15 02:22:46 -04:00
})`;
}
const modelVersion = context.services.config?.getModel() || 'Unknown';
const cliVersion = await getCliVersion();
const selectedAuthType =
context.services.settings.merged.selectedAuthType || '';
// Only show GCP Project for auth types that actually use it
const gcpProject =
selectedAuthType === 'oauth-gca' ||
selectedAuthType === 'vertex-ai' ||
selectedAuthType === 'cloud-shell'
? process.env['GOOGLE_CLOUD_PROJECT'] || ''
: '';
const ideClient =
(context.services.config?.getIdeMode() &&
context.services.config?.getIdeClient()?.getDetectedIdeDisplayName()) ||
'';
const userTier = context.services.config?.getGeminiClient()?.getUserTier();
2025-07-15 02:22:46 -04:00
const aboutItem: Omit<HistoryItemAbout, 'id'> = {
type: MessageType.ABOUT,
cliVersion,
osVersion,
sandboxEnv,
modelVersion,
selectedAuthType,
gcpProject,
ideClient,
userTier,
2025-07-15 02:22:46 -04:00
};
context.ui.addItem(aboutItem, Date.now());
},
};