2025-07-07 16:45:44 -04:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2026-03-11 23:20:42 +05:30
|
|
|
import { CommandKind, type SlashCommand } from './types.js';
|
2025-08-04 09:53:50 -07:00
|
|
|
import { MessageType, type HistoryItemHelp } from '../types.js';
|
2026-06-09 14:29:16 -07:00
|
|
|
import { getAntigravityInstallInfo } from '../utils/antigravityUtils.js';
|
2025-07-07 16:45:44 -04:00
|
|
|
|
|
|
|
|
export const helpCommand: SlashCommand = {
|
|
|
|
|
name: 'help',
|
2025-07-20 16:57:34 -04:00
|
|
|
kind: CommandKind.BUILT_IN,
|
2025-10-17 13:20:15 -07:00
|
|
|
description: 'For help on gemini-cli',
|
2025-12-01 12:29:03 -05:00
|
|
|
autoExecute: true,
|
2026-06-09 14:29:16 -07:00
|
|
|
action: async (context, args) => {
|
|
|
|
|
const lowerArgs = args?.toLowerCase() || '';
|
|
|
|
|
const hasAntigravity = lowerArgs.includes('antigravity');
|
|
|
|
|
const hasInstallOrMigrate =
|
|
|
|
|
lowerArgs.includes('install') || lowerArgs.includes('migrate');
|
|
|
|
|
|
|
|
|
|
if (hasAntigravity && hasInstallOrMigrate) {
|
|
|
|
|
const info = getAntigravityInstallInfo();
|
|
|
|
|
|
|
|
|
|
if (info) {
|
|
|
|
|
context.ui.addItem({
|
|
|
|
|
type: MessageType.INFO,
|
|
|
|
|
text: `To install the Antigravity CLI on ${info.platformName}, run the following command:\n\n'${info.installCmd}'`,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
context.ui.addItem({
|
|
|
|
|
type: MessageType.INFO,
|
|
|
|
|
text: `Learn more about Antigravity CLI at https://antigravity.google/docs/cli-getting-started`,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-04 09:53:50 -07:00
|
|
|
const helpItem: Omit<HistoryItemHelp, 'id'> = {
|
|
|
|
|
type: MessageType.HELP,
|
|
|
|
|
timestamp: new Date(),
|
2025-07-07 16:45:44 -04:00
|
|
|
};
|
2025-08-04 09:53:50 -07:00
|
|
|
|
2026-01-13 14:15:04 -05:00
|
|
|
context.ui.addItem(helpItem);
|
2025-07-07 16:45:44 -04:00
|
|
|
},
|
|
|
|
|
};
|