summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/ui/commands/ideCommand.test.ts9
-rw-r--r--packages/cli/src/ui/commands/ideCommand.ts36
2 files changed, 32 insertions, 13 deletions
diff --git a/packages/cli/src/ui/commands/ideCommand.test.ts b/packages/cli/src/ui/commands/ideCommand.test.ts
index 3c73549c..4f2b7af2 100644
--- a/packages/cli/src/ui/commands/ideCommand.test.ts
+++ b/packages/cli/src/ui/commands/ideCommand.test.ts
@@ -65,6 +65,7 @@ describe('ideCommand', () => {
vi.mocked(mockConfig.getIdeMode).mockReturnValue(true);
vi.mocked(mockConfig.getIdeClient).mockReturnValue({
getCurrentIde: () => DetectedIde.VSCode,
+ getDetectedIdeDisplayName: () => 'VS Code',
} as ReturnType<Config['getIdeClient']>);
const command = ideCommand(mockConfig);
expect(command).not.toBeNull();
@@ -82,6 +83,7 @@ describe('ideCommand', () => {
vi.mocked(mockConfig.getIdeClient).mockReturnValue({
getConnectionStatus: mockGetConnectionStatus,
getCurrentIde: () => DetectedIde.VSCode,
+ getDetectedIdeDisplayName: () => 'VS Code',
} as unknown as ReturnType<Config['getIdeClient']>);
});
@@ -96,7 +98,7 @@ describe('ideCommand', () => {
expect(result).toEqual({
type: 'message',
messageType: 'info',
- content: '🟢 Connected',
+ content: '🟢 Connected to VS Code',
});
});
@@ -155,6 +157,7 @@ describe('ideCommand', () => {
vi.mocked(mockConfig.getIdeClient).mockReturnValue({
getCurrentIde: () => DetectedIde.VSCode,
getConnectionStatus: vi.fn(),
+ getDetectedIdeDisplayName: () => 'VS Code',
} as unknown as ReturnType<Config['getIdeClient']>);
vi.mocked(core.getIdeInstaller).mockReturnValue({
install: mockInstall,
@@ -180,7 +183,7 @@ describe('ideCommand', () => {
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: 'info',
- text: `Installing IDE companion extension...`,
+ text: `Installing IDE companion...`,
}),
expect.any(Number),
);
@@ -210,7 +213,7 @@ describe('ideCommand', () => {
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: 'info',
- text: `Installing IDE companion extension...`,
+ text: `Installing IDE companion...`,
}),
expect.any(Number),
);
diff --git a/packages/cli/src/ui/commands/ideCommand.ts b/packages/cli/src/ui/commands/ideCommand.ts
index 1da7d6b0..c6d65264 100644
--- a/packages/cli/src/ui/commands/ideCommand.ts
+++ b/packages/cli/src/ui/commands/ideCommand.ts
@@ -6,6 +6,7 @@
import {
Config,
+ DetectedIde,
IDEConnectionStatus,
getIdeDisplayName,
getIdeInstaller,
@@ -19,12 +20,27 @@ import {
import { SettingScope } from '../../config/settings.js';
export const ideCommand = (config: Config | null): SlashCommand | null => {
- if (!config?.getIdeModeFeature()) {
+ if (!config || !config.getIdeModeFeature()) {
return null;
}
- const currentIDE = config.getIdeClient().getCurrentIde();
- if (!currentIDE) {
- return null;
+ const ideClient = config.getIdeClient();
+ const currentIDE = ideClient.getCurrentIde();
+ if (!currentIDE || !ideClient.getDetectedIdeDisplayName()) {
+ return {
+ name: 'ide',
+ description: 'manage IDE integration',
+ kind: CommandKind.BUILT_IN,
+ action: (): SlashCommandActionReturn =>
+ ({
+ type: 'message',
+ messageType: 'error',
+ content: `IDE integration is not supported in your current environment. To use this feature, run Gemini CLI in one of these supported IDEs: ${Object.values(
+ DetectedIde,
+ )
+ .map((ide) => getIdeDisplayName(ide))
+ .join(', ')}`,
+ }) as const,
+ };
}
const ideSlashCommand: SlashCommand = {
@@ -39,13 +55,13 @@ export const ideCommand = (config: Config | null): SlashCommand | null => {
description: 'check status of IDE integration',
kind: CommandKind.BUILT_IN,
action: (_context: CommandContext): SlashCommandActionReturn => {
- const connection = config.getIdeClient().getConnectionStatus();
- switch (connection?.status) {
+ const connection = ideClient.getConnectionStatus();
+ switch (connection.status) {
case IDEConnectionStatus.Connected:
return {
type: 'message',
messageType: 'info',
- content: `🟢 Connected`,
+ content: `🟢 Connected to ${ideClient.getDetectedIdeDisplayName()}`,
} as const;
case IDEConnectionStatus.Connecting:
return {
@@ -70,7 +86,7 @@ export const ideCommand = (config: Config | null): SlashCommand | null => {
const installCommand: SlashCommand = {
name: 'install',
- description: `install required IDE companion ${getIdeDisplayName(currentIDE)} extension `,
+ description: `install required IDE companion for ${ideClient.getDetectedIdeDisplayName()}`,
kind: CommandKind.BUILT_IN,
action: async (context) => {
const installer = getIdeInstaller(currentIDE);
@@ -78,7 +94,7 @@ export const ideCommand = (config: Config | null): SlashCommand | null => {
context.ui.addItem(
{
type: 'error',
- text: 'No installer available for your configured IDE.',
+ text: `No installer is available for ${ideClient.getDetectedIdeDisplayName()}. Please install the IDE companion manually from its marketplace.`,
},
Date.now(),
);
@@ -88,7 +104,7 @@ export const ideCommand = (config: Config | null): SlashCommand | null => {
context.ui.addItem(
{
type: 'info',
- text: `Installing IDE companion extension...`,
+ text: `Installing IDE companion...`,
},
Date.now(),
);