Use IdeClient directly instead of config.ideClient (#7627)

This commit is contained in:
Tommaso Sciortino
2025-09-04 09:32:09 -07:00
committed by GitHub
parent 45d494a8d8
commit cb43bb9ca4
24 changed files with 288 additions and 217 deletions

View File

@@ -5,10 +5,11 @@
*/
import { getCliVersion } from '../../utils/version.js';
import type { SlashCommand } from './types.js';
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';
export const aboutCommand: SlashCommand = {
name: 'about',
@@ -29,10 +30,7 @@ export const aboutCommand: SlashCommand = {
const selectedAuthType =
context.services.settings.merged.security?.auth?.selectedType || '';
const gcpProject = process.env['GOOGLE_CLOUD_PROJECT'] || '';
const ideClient =
(context.services.config?.getIdeMode() &&
context.services.config?.getIdeClient()?.getDetectedIdeDisplayName()) ||
'';
const ideClient = await getIdeClientName(context);
const aboutItem: Omit<HistoryItemAbout, 'id'> = {
type: MessageType.ABOUT,
@@ -48,3 +46,11 @@ export const aboutCommand: SlashCommand = {
context.ui.addItem(aboutItem, Date.now());
},
};
async function getIdeClientName(context: CommandContext) {
if (!context.services.config?.getIdeMode()) {
return '';
}
const ideClient = await IdeClient.getInstance();
return ideClient?.getDetectedIdeDisplayName() ?? '';
}