refactor(tools): Migrate shell tool name to a centralized constant (#11418)

This commit is contained in:
Abhi
2025-10-17 21:07:26 -04:00
committed by GitHub
parent cedf0235a1
commit 2ef38065c7
8 changed files with 38 additions and 33 deletions

View File

@@ -29,10 +29,10 @@ import {
DEFAULT_GEMINI_EMBEDDING_MODEL,
DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
FileDiscoveryService,
ShellTool,
EditTool,
WRITE_FILE_TOOL_NAME,
SHELL_TOOL_NAMES,
SHELL_TOOL_NAME,
resolveTelemetrySettings,
FatalConfigError,
getPty,
@@ -352,7 +352,7 @@ function createToolExclusionFilter(
allowedToolsSet: Set<string>,
) {
return (tool: string): boolean => {
if (tool === ShellTool.Name) {
if (tool === SHELL_TOOL_NAME) {
// If any of the allowed tools is ShellTool (even with subcommands), don't exclude it.
return !allowedTools.some((allowed) =>
SHELL_TOOL_NAMES.some((shellName) => allowed.startsWith(shellName)),
@@ -505,11 +505,11 @@ export async function loadCliConfig(
const extraExcludes: string[] = [];
if (!interactive && !argv.experimentalAcp) {
const defaultExcludes = [
ShellTool.Name,
SHELL_TOOL_NAME,
EditTool.Name,
WRITE_FILE_TOOL_NAME,
];
const autoEditExcludes = [ShellTool.Name];
const autoEditExcludes = [SHELL_TOOL_NAME];
const toolExclusionFilter = createToolExclusionFilter(
allowedTools,