diff --git a/docs/cli/configuration.md b/docs/cli/configuration.md index 1fe4df4788..9a2ce31fde 100644 --- a/docs/cli/configuration.md +++ b/docs/cli/configuration.md @@ -203,9 +203,9 @@ Settings are organized into categories. All settings should be placed within the - **Description:** Sandbox execution environment (can be a boolean or a path string). - **Default:** `undefined` -- **`tools.usePty`** (boolean): - - **Description:** Use node-pty for shell command execution. Fallback to child_process still applies. - - **Default:** `false` +- **`tools.shell.enableInteractiveShell`** (boolean): + + Use `node-pty` for an interactive shell experience. Fallback to `child_process` still applies. Defaults to `false`. - **`tools.core`** (array of strings): - **Description:** This can be used to restrict the set of built-in tools [with an allowlist](./enterprise.md#restricting-tool-access). See [Built-in Tools](../core/tools-api.md#built-in-tools) for a list of core tools. The match semantics are the same as `tools.allowed`. diff --git a/docs/tools/shell.md b/docs/tools/shell.md index 9382eedd3d..31ce3fed5f 100644 --- a/docs/tools/shell.md +++ b/docs/tools/shell.md @@ -4,7 +4,7 @@ This document describes the `run_shell_command` tool for the Gemini CLI. ## Description -Use `run_shell_command` to interact with the underlying system, run scripts, or perform command-line operations. `run_shell_command` executes a given shell command, including interactive commands that require user input (e.g., `vim`, `git rebase -i`) if the `tools.usePty` setting is set to `true`. +Use `run_shell_command` to interact with the underlying system, run scripts, or perform command-line operations. `run_shell_command` executes a given shell command, including interactive commands that require user input (e.g., `vim`, `git rebase -i`) if the `tools.shell.enableInteractiveShell` setting is set to `true`. On Windows, commands are executed with `cmd.exe /c`. On other platforms, they are executed with `bash -c`. @@ -61,21 +61,23 @@ You can configure the behavior of the `run_shell_command` tool by modifying your ### Enabling Interactive Commands -To enable interactive commands, you need to set the `tools.usePty` setting to `true`. This will use `node-pty` for shell command execution, which allows for interactive sessions. If `node-pty` is not available, it will fall back to the `child_process` implementation, which does not support interactive commands. +To enable interactive commands, you need to set the `tools.shell.enableInteractiveShell` setting to `true`. This will use `node-pty` for shell command execution, which allows for interactive sessions. If `node-pty` is not available, it will fall back to the `child_process` implementation, which does not support interactive commands. **Example `settings.json`:** ```json { "tools": { - "usePty": true + "shell": { + "enableInteractiveShell": true + } } } ``` ### Showing Color in Output -To show color in the shell output, you need to set the `tools.shell.showColor` setting to `true`. **Note: This setting only applies when `tools.usePty` is enabled.** +To show color in the shell output, you need to set the `tools.shell.showColor` setting to `true`. **Note: This setting only applies when `tools.shell.enableInteractiveShell` is enabled.** **Example `settings.json`:** @@ -91,7 +93,7 @@ To show color in the shell output, you need to set the `tools.shell.showColor` s ### Setting the Pager -You can set a custom pager for the shell output by setting the `tools.shell.pager` setting. The default pager is `cat`. **Note: This setting only applies when `tools.usePty` is enabled.** +You can set a custom pager for the shell output by setting the `tools.shell.pager` setting. The default pager is `cat`. **Note: This setting only applies when `tools.shell.enableInteractiveShell` is enabled.** **Example `settings.json`:** diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts index e2b8add3cf..bd7f7f5a9e 100755 --- a/packages/cli/src/config/config.ts +++ b/packages/cli/src/config/config.ts @@ -633,7 +633,7 @@ export async function loadCliConfig( interactive, trustedFolder, useRipgrep: settings.tools?.useRipgrep, - shouldUseNodePtyShell: settings.tools?.usePty, + shouldUseNodePtyShell: settings.tools?.shell?.enableInteractiveShell, skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck, enablePromptCompletion: settings.general?.enablePromptCompletion ?? false, truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold, diff --git a/packages/cli/src/config/settings.ts b/packages/cli/src/config/settings.ts index beaf1f4f29..a02e3928df 100644 --- a/packages/cli/src/config/settings.ts +++ b/packages/cli/src/config/settings.ts @@ -107,7 +107,7 @@ const MIGRATION_MAP: Record = { preferredEditor: 'general.preferredEditor', sandbox: 'tools.sandbox', selectedAuthType: 'security.auth.selectedType', - shouldUseNodePtyShell: 'tools.usePty', + shouldUseNodePtyShell: 'tools.shell.enableInteractiveShell', shellPager: 'tools.shell.pager', shellShowColor: 'tools.shell.showColor', skipNextSpeakerCheck: 'model.skipNextSpeakerCheck', diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index 4a4b3902e3..1cf1eae31a 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -639,16 +639,6 @@ const SETTINGS_SCHEMA = { 'Sandbox execution environment (can be a boolean or a path string).', showInDialog: false, }, - usePty: { - type: 'boolean', - label: 'Use node-pty for Shell Execution', - category: 'Tools', - requiresRestart: true, - default: false, - description: - 'Use node-pty for shell command execution. Fallback to child_process still applies.', - showInDialog: true, - }, shell: { type: 'object', label: 'Shell', @@ -658,6 +648,16 @@ const SETTINGS_SCHEMA = { description: 'Settings for shell execution.', showInDialog: false, properties: { + enableInteractiveShell: { + type: 'boolean', + label: 'Enable Interactive Shell', + category: 'Tools', + requiresRestart: true, + default: false, + description: + 'Use node-pty for an interactive shell experience. Fallback to child_process still applies.', + showInDialog: true, + }, pager: { type: 'string', label: 'Pager', diff --git a/packages/cli/src/ui/components/SettingsDialog.test.tsx b/packages/cli/src/ui/components/SettingsDialog.test.tsx index 9531a1e80c..f4d2547319 100644 --- a/packages/cli/src/ui/components/SettingsDialog.test.tsx +++ b/packages/cli/src/ui/components/SettingsDialog.test.tsx @@ -1262,7 +1262,7 @@ describe('SettingsDialog', () => { }, }, tools: { - usePty: true, + enableInteractiveShell: true, autoAccept: true, useRipgrep: true, }, @@ -1375,7 +1375,7 @@ describe('SettingsDialog', () => { }, tools: { useRipgrep: true, - usePty: false, + enableInteractiveShell: false, }, }, ); @@ -1449,7 +1449,7 @@ describe('SettingsDialog', () => { it('should render with tools and security settings', () => { const settings = createMockSettings({ tools: { - usePty: true, + enableInteractiveShell: true, autoAccept: false, useRipgrep: true, truncateToolOutputThreshold: 25000, @@ -1508,7 +1508,7 @@ describe('SettingsDialog', () => { }, }, tools: { - usePty: false, + enableInteractiveShell: false, autoAccept: false, useRipgrep: false, }, diff --git a/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts b/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts index ed5aba351f..fa4f69e381 100644 --- a/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts +++ b/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts @@ -238,7 +238,7 @@ describe('useShellCommandProcessor', () => { '/test/dir', expect.any(Function), expect.any(Object), - false, // usePty + false, // enableInteractiveShell expect.any(Object), );