mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
fix(shell): update shell setting from usePty to enableInteractiveShell (#8726)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -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).
|
- **Description:** Sandbox execution environment (can be a boolean or a path string).
|
||||||
- **Default:** `undefined`
|
- **Default:** `undefined`
|
||||||
|
|
||||||
- **`tools.usePty`** (boolean):
|
- **`tools.shell.enableInteractiveShell`** (boolean):
|
||||||
- **Description:** Use node-pty for shell command execution. Fallback to child_process still applies.
|
|
||||||
- **Default:** `false`
|
Use `node-pty` for an interactive shell experience. Fallback to `child_process` still applies. Defaults to `false`.
|
||||||
|
|
||||||
- **`tools.core`** (array of strings):
|
- **`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`.
|
- **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`.
|
||||||
|
|||||||
+7
-5
@@ -4,7 +4,7 @@ This document describes the `run_shell_command` tool for the Gemini CLI.
|
|||||||
|
|
||||||
## Description
|
## 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`.
|
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
|
### 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`:**
|
**Example `settings.json`:**
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"tools": {
|
"tools": {
|
||||||
"usePty": true
|
"shell": {
|
||||||
|
"enableInteractiveShell": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Showing Color in Output
|
### 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`:**
|
**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
|
### 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`:**
|
**Example `settings.json`:**
|
||||||
|
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ export async function loadCliConfig(
|
|||||||
interactive,
|
interactive,
|
||||||
trustedFolder,
|
trustedFolder,
|
||||||
useRipgrep: settings.tools?.useRipgrep,
|
useRipgrep: settings.tools?.useRipgrep,
|
||||||
shouldUseNodePtyShell: settings.tools?.usePty,
|
shouldUseNodePtyShell: settings.tools?.shell?.enableInteractiveShell,
|
||||||
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
||||||
enablePromptCompletion: settings.general?.enablePromptCompletion ?? false,
|
enablePromptCompletion: settings.general?.enablePromptCompletion ?? false,
|
||||||
truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold,
|
truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ const MIGRATION_MAP: Record<string, string> = {
|
|||||||
preferredEditor: 'general.preferredEditor',
|
preferredEditor: 'general.preferredEditor',
|
||||||
sandbox: 'tools.sandbox',
|
sandbox: 'tools.sandbox',
|
||||||
selectedAuthType: 'security.auth.selectedType',
|
selectedAuthType: 'security.auth.selectedType',
|
||||||
shouldUseNodePtyShell: 'tools.usePty',
|
shouldUseNodePtyShell: 'tools.shell.enableInteractiveShell',
|
||||||
shellPager: 'tools.shell.pager',
|
shellPager: 'tools.shell.pager',
|
||||||
shellShowColor: 'tools.shell.showColor',
|
shellShowColor: 'tools.shell.showColor',
|
||||||
skipNextSpeakerCheck: 'model.skipNextSpeakerCheck',
|
skipNextSpeakerCheck: 'model.skipNextSpeakerCheck',
|
||||||
|
|||||||
@@ -639,16 +639,6 @@ const SETTINGS_SCHEMA = {
|
|||||||
'Sandbox execution environment (can be a boolean or a path string).',
|
'Sandbox execution environment (can be a boolean or a path string).',
|
||||||
showInDialog: false,
|
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: {
|
shell: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
label: 'Shell',
|
label: 'Shell',
|
||||||
@@ -658,6 +648,16 @@ const SETTINGS_SCHEMA = {
|
|||||||
description: 'Settings for shell execution.',
|
description: 'Settings for shell execution.',
|
||||||
showInDialog: false,
|
showInDialog: false,
|
||||||
properties: {
|
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: {
|
pager: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
label: 'Pager',
|
label: 'Pager',
|
||||||
|
|||||||
@@ -1262,7 +1262,7 @@ describe('SettingsDialog', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
tools: {
|
tools: {
|
||||||
usePty: true,
|
enableInteractiveShell: true,
|
||||||
autoAccept: true,
|
autoAccept: true,
|
||||||
useRipgrep: true,
|
useRipgrep: true,
|
||||||
},
|
},
|
||||||
@@ -1375,7 +1375,7 @@ describe('SettingsDialog', () => {
|
|||||||
},
|
},
|
||||||
tools: {
|
tools: {
|
||||||
useRipgrep: true,
|
useRipgrep: true,
|
||||||
usePty: false,
|
enableInteractiveShell: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -1449,7 +1449,7 @@ describe('SettingsDialog', () => {
|
|||||||
it('should render with tools and security settings', () => {
|
it('should render with tools and security settings', () => {
|
||||||
const settings = createMockSettings({
|
const settings = createMockSettings({
|
||||||
tools: {
|
tools: {
|
||||||
usePty: true,
|
enableInteractiveShell: true,
|
||||||
autoAccept: false,
|
autoAccept: false,
|
||||||
useRipgrep: true,
|
useRipgrep: true,
|
||||||
truncateToolOutputThreshold: 25000,
|
truncateToolOutputThreshold: 25000,
|
||||||
@@ -1508,7 +1508,7 @@ describe('SettingsDialog', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
tools: {
|
tools: {
|
||||||
usePty: false,
|
enableInteractiveShell: false,
|
||||||
autoAccept: false,
|
autoAccept: false,
|
||||||
useRipgrep: false,
|
useRipgrep: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ describe('useShellCommandProcessor', () => {
|
|||||||
'/test/dir',
|
'/test/dir',
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
false, // usePty
|
false, // enableInteractiveShell
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user