From ddcac4201d13bfa948c900f10f8c6cd227099c7b Mon Sep 17 00:00:00 2001 From: Harold Mciver Date: Wed, 16 Jul 2025 11:56:05 -0400 Subject: update `/docs` to new slash command arch (#4133) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/cli/src/ui/commands/docsCommand.ts | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 packages/cli/src/ui/commands/docsCommand.ts (limited to 'packages/cli/src/ui/commands/docsCommand.ts') diff --git a/packages/cli/src/ui/commands/docsCommand.ts b/packages/cli/src/ui/commands/docsCommand.ts new file mode 100644 index 00000000..e53a4a80 --- /dev/null +++ b/packages/cli/src/ui/commands/docsCommand.ts @@ -0,0 +1,37 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import open from 'open'; +import process from 'node:process'; +import { type CommandContext, type SlashCommand } from './types.js'; +import { MessageType } from '../types.js'; + +export const docsCommand: SlashCommand = { + name: 'docs', + description: 'open full Gemini CLI documentation in your browser', + action: async (context: CommandContext): Promise => { + const docsUrl = 'https://goo.gle/gemini-cli-docs'; + + if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') { + context.ui.addItem( + { + type: MessageType.INFO, + text: `Please open the following URL in your browser to view the documentation:\n${docsUrl}`, + }, + Date.now(), + ); + } else { + context.ui.addItem( + { + type: MessageType.INFO, + text: `Opening documentation in your browser: ${docsUrl}`, + }, + Date.now(), + ); + await open(docsUrl); + } + }, +}; -- cgit v1.2.3