From 66abea7a0e89df179b59d24ceecdf3d41d956cc2 Mon Sep 17 00:00:00 2001 From: jacob314 Date: Mon, 20 Apr 2026 11:50:24 -0700 Subject: [PATCH] fix(shell): explicitly set PAGER=cat when rcFile is not used --- docs/reference/configuration.md | 5 +++++ packages/core/src/tools/shell.ts | 2 ++ schemas/settings.schema.json | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index d0eb56938c..6c9dfff840 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -1452,6 +1452,11 @@ their corresponding top-level category object in your `settings.json` file. performance. - **Default:** `true` +- **`tools.shell.rcFile`** (string): + - **Description:** The path to a bash file (e.g., .bashrc) to source before + executing shell commands. + - **Default:** `undefined` + - **`tools.core`** (array): - **Description:** Restrict the set of built-in tools with an allowlist. Match semantics mirror tools.allowed; see the built-in tools documentation for diff --git a/packages/core/src/tools/shell.ts b/packages/core/src/tools/shell.ts index 90bca1a4be..049a03e369 100644 --- a/packages/core/src/tools/shell.ts +++ b/packages/core/src/tools/shell.ts @@ -466,6 +466,8 @@ export class ShellToolInvocation extends BaseToolInvocation< const rcFilePath = this.context.config.getShellToolRcFile(); if (rcFilePath) { strippedCommandWithRc = `source ${rcFilePath} && ${strippedCommand}`; + } else if (!isWindows) { + strippedCommandWithRc = `export PAGER=cat GIT_PAGER=cat; more() { cat "$@"; }; less() { cat "$@"; }; ${strippedCommand}`; } try { diff --git a/schemas/settings.schema.json b/schemas/settings.schema.json index 2a78cb7b82..7f1d1ce628 100644 --- a/schemas/settings.schema.json +++ b/schemas/settings.schema.json @@ -2509,6 +2509,12 @@ "markdownDescription": "Enable shell output efficiency optimizations for better performance.\n\n- Category: `Tools`\n- Requires restart: `no`\n- Default: `true`", "default": true, "type": "boolean" + }, + "rcFile": { + "title": "Shell Tool RC File", + "description": "The path to a bash file (e.g., .bashrc) to source before executing shell commands.", + "markdownDescription": "The path to a bash file (e.g., .bashrc) to source before executing shell commands.\n\n- Category: `Tools`\n- Requires restart: `no`", + "type": "string" } }, "additionalProperties": false