/**
* @license
* Copyright 2025 Vybestack LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
import { Box, Text } from 'ink';
import { Colors } from '../colors.js';
import type { SlashCommand } from '../commands/types.js';
import { KEYBOARD_SHORTCUTS_URL } from '../constants.js';
import { getBorderStyle } from '../contexts/UnicodeRenderingContext.js';
interface HelpProps {
commands: readonly SlashCommand[];
}
const BasicsSection: React.FC = () => (
<>
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
).
>
);
interface CommandsSectionProps {
commands: readonly SlashCommand[];
}
const CommandsSection: React.FC = ({ commands }) => (
<>
Commands:
{commands
.filter((command) => command.description)
.map((command: SlashCommand) => (
{' '}
/{command.name}
{command.description && ' - ' + command.description}
{command.subCommands?.map((subCommand) => (
{' '}
{subCommand.name}
{subCommand.description && ' - ' + subCommand.description}
))}
))}
{' '}
!{' '}
- shell command
>
);
/**
* On Windows the console reports Ctrl+Enter and Ctrl+J as the same byte, so the
* newline key is labelled Ctrl+Enter there and inserts a newline while the
* agent is idle, or while streaming when there is nothing to steer (empty
* input and no queued messages) — see issue #2951.
*/
function newlineShortcutDescription(platform: NodeJS.Platform): string {
if (platform === 'win32')
return '- New line (while idle, or when there is nothing to steer)';
if (platform === 'linux')
return '- New line (Alt+Enter works for certain linux distros)';
return '- New line';
}
const KeyboardShortcutsPart1: React.FC = () => (
<>
Keyboard Shortcuts:
Alt+Left/Right
{' '}
- Jump through words in the input
Ctrl+C
{' '}
- Quit application
{process.platform === 'win32' ? 'Ctrl+Enter' : 'Ctrl+J'}
{' '}
{newlineShortcutDescription(process.platform)}
Ctrl+L
{' '}
- Clear the screen
Ctrl+\
{' '}
- Toggle mouse tracking
Ctrl+X
{' '}
- Open input in external editor
>
);
const KeyboardShortcutsPart2: React.FC = () => (
<>
Ctrl+Y
{' '}
- Toggle YOLO mode
Enter
{' '}
- Send message
Ctrl+Enter
{' '}
- Steer the agent (or the queued messages) while it is responding
Esc
{' '}
- Cancel operation / Clear input (double press)
Shift+Tab
{' '}
- Toggle auto-accepting edits
Up/Down
{' '}
- Cycle through your prompt history
For a full list of shortcuts, see{' '}
{KEYBOARD_SHORTCUTS_URL}
>
);
const KeyboardShortcutsSection: React.FC = () => (
<>
>
);
export const Help: React.FC = ({ commands }) => (
);