diff options
| author | Miguel Solorio <[email protected]> | 2025-05-23 10:34:15 -0700 |
|---|---|---|
| committer | N. Taylor Mullen <[email protected]> | 2025-05-23 16:14:37 -0700 |
| commit | 221370acc5147cb4e91b2b65bf933c56e0d3a85e (patch) | |
| tree | a7b08a51c8563084a948ed77636d17b2f1f9233e /packages/cli/src/ui/hooks/slashCommandProcessor.ts | |
| parent | 4a6833ef4990801304f3c88f0dcae403f3ea4358 (diff) | |
Add `/about` command
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/slashCommandProcessor.ts | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 82d1fc7a..e25d7139 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -9,7 +9,7 @@ import { type PartListUnion } from '@google/genai'; import open from 'open'; import { UseHistoryManagerReturn } from './useHistoryManager.js'; import { Config } from '@gemini-code/server'; -import { Message, MessageType, HistoryItemWithoutId } from '../types.js'; +import { Message, MessageType, HistoryItemWithoutId } from '../types.js'; // Removed HistoryItem import { createShowMemoryAction } from './useShowMemoryCommand.js'; export interface SlashCommandActionReturn { @@ -47,10 +47,25 @@ export const useSlashCommandProcessor = ( ) => { const addMessage = useCallback( (message: Message) => { - const historyItemContent: HistoryItemWithoutId = { - type: message.type, - text: message.content, - }; + // Convert Message to HistoryItemWithoutId + let historyItemContent: HistoryItemWithoutId; + if (message.type === MessageType.ABOUT) { + historyItemContent = { + type: 'about', + cliVersion: message.cliVersion, + osVersion: message.osVersion, + sandboxEnv: message.sandboxEnv, + modelVersion: message.modelVersion, + }; + } else { + historyItemContent = { + type: message.type as + | MessageType.INFO + | MessageType.ERROR + | MessageType.USER, + text: message.content, + }; + } addItem(historyItemContent, message.timestamp.getTime()); }, [addItem], @@ -150,6 +165,29 @@ export const useSlashCommandProcessor = ( }, }, { + name: 'about', + description: 'Show version info', + action: (_mainCommand, _subCommand, _args) => { + const osVersion = `${process.platform} ${process.version}`; + let sandboxEnv = 'no sandbox'; + if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') { + sandboxEnv = process.env.SANDBOX.replace(/^gemini-(?:code-)?/, ''); + } else if (process.env.SANDBOX === 'sandbox-exec') { + sandboxEnv = `sandbox-exec (${process.env.SEATBELT_PROFILE || 'unknown'})`; + } + const modelVersion = config?.getModel() || 'Unknown'; + + addMessage({ + type: MessageType.ABOUT, + timestamp: new Date(), + cliVersion, + osVersion, + sandboxEnv, + modelVersion, + }); + }, + }, + { name: 'bug', description: 'Submit a bug report.', action: (_mainCommand, _subCommand, args) => { |
