Skip to content

Commit 15298b2

Browse files
authored
feat(acp): add support for /about command (#24649)
1 parent 7311e24 commit 15298b2

3 files changed

Lines changed: 79 additions & 0 deletions

File tree

packages/cli/src/acp/commandHandler.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ describe('CommandHandler', () => {
2626

2727
const init = parse('/init');
2828
expect(init.commandToExecute?.name).toBe('init');
29+
30+
const about = parse('/about');
31+
expect(about.commandToExecute?.name).toBe('about');
2932
});
3033
});

packages/cli/src/acp/commandHandler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { MemoryCommand } from './commands/memory.js';
1010
import { ExtensionsCommand } from './commands/extensions.js';
1111
import { InitCommand } from './commands/init.js';
1212
import { RestoreCommand } from './commands/restore.js';
13+
import { AboutCommand } from './commands/about.js';
1314

1415
export class CommandHandler {
1516
private registry: CommandRegistry;
@@ -24,6 +25,7 @@ export class CommandHandler {
2425
registry.register(new ExtensionsCommand());
2526
registry.register(new InitCommand());
2627
registry.register(new RestoreCommand());
28+
registry.register(new AboutCommand());
2729
return registry;
2830
}
2931

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* @license
3+
* Copyright 2026 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {
8+
IdeClient,
9+
UserAccountManager,
10+
getVersion,
11+
} from '@google/gemini-cli-core';
12+
import type {
13+
Command,
14+
CommandContext,
15+
CommandExecutionResponse,
16+
} from './types.js';
17+
import process from 'node:process';
18+
19+
export class AboutCommand implements Command {
20+
readonly name = 'about';
21+
readonly description = 'Show version and environment info';
22+
23+
async execute(
24+
context: CommandContext,
25+
_args: string[] = [],
26+
): Promise<CommandExecutionResponse> {
27+
const osVersion = process.platform;
28+
let sandboxEnv = 'no sandbox';
29+
if (process.env['SANDBOX'] && process.env['SANDBOX'] !== 'sandbox-exec') {
30+
sandboxEnv = process.env['SANDBOX'];
31+
} else if (process.env['SANDBOX'] === 'sandbox-exec') {
32+
sandboxEnv = `sandbox-exec (${
33+
process.env['SEATBELT_PROFILE'] || 'unknown'
34+
})`;
35+
}
36+
const modelVersion = context.agentContext.config.getModel() || 'Unknown';
37+
const cliVersion = await getVersion();
38+
const selectedAuthType =
39+
context.settings.merged?.security?.auth?.selectedType ?? '';
40+
const gcpProject = process.env['GOOGLE_CLOUD_PROJECT'] || '';
41+
const ideClient = await getIdeClientName(context);
42+
43+
const userAccountManager = new UserAccountManager();
44+
const cachedAccount = userAccountManager.getCachedGoogleAccount();
45+
const userEmail = cachedAccount ?? 'Unknown';
46+
47+
const tier = context.agentContext.config.getUserTierName() || 'Unknown';
48+
49+
const info = [
50+
`- Version: ${cliVersion}`,
51+
`- OS: ${osVersion}`,
52+
`- Sandbox: ${sandboxEnv}`,
53+
`- Model: ${modelVersion}`,
54+
`- Auth Type: ${selectedAuthType}`,
55+
`- GCP Project: ${gcpProject}`,
56+
`- IDE Client: ${ideClient}`,
57+
`- User Email: ${userEmail}`,
58+
`- Tier: ${tier}`,
59+
].join('\n');
60+
61+
return {
62+
name: this.name,
63+
data: `Gemini CLI Info:\n${info}`,
64+
};
65+
}
66+
}
67+
68+
async function getIdeClientName(context: CommandContext) {
69+
if (!context.agentContext.config.getIdeMode()) {
70+
return '';
71+
}
72+
const ideClient = await IdeClient.getInstance();
73+
return ideClient?.getDetectedIdeDisplayName() ?? '';
74+
}

0 commit comments

Comments
 (0)