/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import type React from 'react'; import { Box, Text } from 'ink'; import { theme } from '../semantic-colors.js'; import { type SlashCommand, CommandKind } from '../commands/types.js'; import { KEYBOARD_SHORTCUTS_URL } from '../constants.js'; import { sanitizeForDisplay } from '../utils/textUtils.js'; interface Help { commands: readonly SlashCommand[]; } export const Help: React.FC = ({ commands }) => ( {/* Basics */} Basics: Add context : Use{' '} @ {' '} to specify files for context (e.g.,{' '} @src/myFile.ts ) to target specific files or folders. Shell mode : Execute shell commands via{' '} ! {' '} (e.g.,{' '} !npm run start ) or use natural language (e.g.{' '} start server ). {/* Commands */} Commands: {commands .filter((command) => command.description && !command.hidden) .map((command: SlashCommand) => ( {' '} /{command.name} {command.kind === CommandKind.MCP_PROMPT && ( [MCP] )} {command.description && ' - ' + sanitizeForDisplay(command.description, 100)} {command.subCommands && command.subCommands .filter((subCommand) => !subCommand.hidden) .map((subCommand) => ( {' '} {subCommand.name} {subCommand.description && ' - ' + sanitizeForDisplay(subCommand.description, 100)} ))} ))} {' '} !{' '} - shell command [MCP] - Model Context Protocol command (from external servers) {/* Shortcuts */} Keyboard Shortcuts: Alt+Left/Right {' '} - Jump through words in the input Ctrl+C {' '} - Quit application {process.platform === 'win32' ? 'Ctrl+Enter' : 'Ctrl+J'} {' '} {process.platform === 'linux' ? '- New line (Alt+Enter works for certain linux distros)' : '- New line'} Ctrl+L {' '} - Clear the screen Ctrl+S {' '} - Enter selection mode to copy text Ctrl+X {' '} - Open input in external editor Ctrl+Y {' '} - Toggle YOLO mode Enter {' '} - Send message Esc {' '} - Cancel operation / Clear input (double press) Page Up/Down {' '} - Scroll page up/down Shift+Tab {' '} - Toggle auto-accepting edits Up/Down {' '} - Cycle through your prompt history For a full list of shortcuts, see{' '} {KEYBOARD_SHORTCUTS_URL} );