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';
|
2025-07-20 16:57:34 -04:00
|
|
|
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',
|
2025-07-20 16:57:34 -04:00
|
|
|
kind: CommandKind.BUILT_IN,
|
2025-07-15 02:22:46 -04:00
|
|
|
action: async (context) => {
|
|
|
|
|
const osVersion = process.platform;
|
|
|
|
|
let sandboxEnv = 'no sandbox';
|
2025-08-17 12:43:21 -04:00
|
|
|
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 (${
|
2025-08-17 12:43:21 -04:00
|
|
|
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 || '';
|
2025-08-23 05:01:01 +09:00
|
|
|
// 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'] || ''
|
|
|
|
|
: '';
|
2025-08-15 12:32:15 -04:00
|
|
|
const ideClient =
|
2025-08-19 11:22:21 -07:00
|
|
|
(context.services.config?.getIdeMode() &&
|
|
|
|
|
context.services.config?.getIdeClient()?.getDetectedIdeDisplayName()) ||
|
2025-08-15 12:32:15 -04:00
|
|
|
'';
|
2025-08-23 05:01:01 +09:00
|
|
|
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,
|
2025-08-15 12:32:15 -04:00
|
|
|
ideClient,
|
2025-08-23 05:01:01 +09:00
|
|
|
userTier,
|
2025-07-15 02:22:46 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
context.ui.addItem(aboutItem, Date.now());
|
|
|
|
|
},
|
|
|
|
|
};
|