-
Notifications
You must be signed in to change notification settings - Fork 37.3k
Add preventShellHistory feature #285599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add preventShellHistory feature #285599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new preventShellHistory feature to prevent AI-executed terminal commands from being saved in the user's shell history. The implementation prefixes commands with a space and configures shells to ignore space-prefixed commands.
Key Changes
- Adds a new
PreventShellHistoryconfiguration setting (default:true) that controls whether commands executed by the terminal tool are excluded from shell history - Implements space-prefixing of commands across all execution strategies and the background terminal execution
- Adds shell integration script modifications to configure bash, zsh, fish, and PowerShell to ignore space-prefixed commands
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| terminalChatAgentToolsConfiguration.ts | Adds the PreventShellHistory configuration setting with markdown description |
| runInTerminalTool.ts | Adds preventShellHistory parameter to BackgroundTerminalExecution and prefixes commands with space when enabled |
| toolTerminalCreator.ts | Sets VSCODE_EXCLUDE_FROM_HISTORY environment variable for supported shells when feature is enabled |
| richExecuteStrategy.ts | Reads configuration and prefixes commands with space before execution |
| noneExecuteStrategy.ts | Reads configuration and prefixes commands with space before execution |
| basicExecuteStrategy.ts | Reads configuration and prefixes commands with space before execution |
| shellIntegration.ps1 | Configures PSReadLine's AddToHistoryHandler to ignore space-prefixed commands |
| shellIntegration.fish | Enables fish_private_mode when VSCODE_EXCLUDE_FROM_HISTORY is set |
| shellIntegration-rc.zsh | Sets HIST_IGNORE_SPACE option when VSCODE_EXCLUDE_FROM_HISTORY is set |
| shellIntegration-bash.sh | Sets HISTCONTROL=ignorespace when VSCODE_EXCLUDE_FROM_HISTORY is set |
src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
Outdated
Show resolved
Hide resolved
...kbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.ts
Outdated
Show resolved
Hide resolved
...kbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.ts
Outdated
Show resolved
Hide resolved
...bench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh
Outdated
Show resolved
Hide resolved
…ion.ps1 Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
Outdated
Show resolved
Hide resolved
...ontrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Outdated
Show resolved
Hide resolved
|
this is pretty cool 🚀 |
Fixes #276716
Verified: