File size: 1,396 Bytes
52efc7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import { CommandKind, type SlashCommand } from './types.js';
import { MessageType, type HistoryItemHelp } from '../types.js';
import { getAntigravityInstallInfo } from '../utils/antigravityUtils.js';

export const helpCommand: SlashCommand = {
  name: 'help',
  kind: CommandKind.BUILT_IN,
  description: 'For help on gemini-cli',
  autoExecute: true,
  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;
    }

    const helpItem: Omit<HistoryItemHelp, 'id'> = {
      type: MessageType.HELP,
      timestamp: new Date(),
    };

    context.ui.addItem(helpItem);
  },
};