diff options
Diffstat (limited to 'packages/cli/src/ui/commands/aboutCommand.ts')
| -rw-r--r-- | packages/cli/src/ui/commands/aboutCommand.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/cli/src/ui/commands/aboutCommand.ts b/packages/cli/src/ui/commands/aboutCommand.ts new file mode 100644 index 00000000..3cb8c2f6 --- /dev/null +++ b/packages/cli/src/ui/commands/aboutCommand.ts @@ -0,0 +1,43 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { getCliVersion } from '../../utils/version.js'; +import { SlashCommand } from './types.js'; +import process from 'node:process'; +import { MessageType, type HistoryItemAbout } from '../types.js'; + +export const aboutCommand: SlashCommand = { + name: 'about', + description: 'show version info', + 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') { + sandboxEnv = `sandbox-exec (${ + process.env.SEATBELT_PROFILE || 'unknown' + })`; + } + const modelVersion = context.services.config?.getModel() || 'Unknown'; + const cliVersion = await getCliVersion(); + const selectedAuthType = + context.services.settings.merged.selectedAuthType || ''; + const gcpProject = process.env.GOOGLE_CLOUD_PROJECT || ''; + + const aboutItem: Omit<HistoryItemAbout, 'id'> = { + type: MessageType.ABOUT, + cliVersion, + osVersion, + sandboxEnv, + modelVersion, + selectedAuthType, + gcpProject, + }; + + context.ui.addItem(aboutItem, Date.now()); + }, +}; |
