refactor(core): Centralize 'write_file' tool name (#10694)

This commit is contained in:
Abhi
2025-10-09 00:33:31 -04:00
committed by GitHub
parent 3ea5581ad7
commit 3d24575239
8 changed files with 24 additions and 16 deletions

View File

@@ -31,7 +31,7 @@ import {
FileDiscoveryService,
ShellTool,
EditTool,
WriteFileTool,
WRITE_FILE_TOOL_NAME,
SHELL_TOOL_NAMES,
resolveTelemetrySettings,
FatalConfigError,
@@ -605,7 +605,11 @@ export async function loadCliConfig(
// In non-interactive mode, exclude tools that require a prompt.
const extraExcludes: string[] = [];
if (!interactive && !argv.experimentalAcp) {
const defaultExcludes = [ShellTool.Name, EditTool.Name, WriteFileTool.Name];
const defaultExcludes = [
ShellTool.Name,
EditTool.Name,
WRITE_FILE_TOOL_NAME,
];
const autoEditExcludes = [ShellTool.Name];
const toolExclusionFilter = createToolExclusionFilter(

View File

@@ -20,7 +20,7 @@ import {
EditTool,
MemoryTool,
ShellTool,
WriteFileTool,
WRITE_FILE_TOOL_NAME,
WebFetchTool,
WebSearchTool,
} from '@google/gemini-cli-core';
@@ -48,7 +48,7 @@ const WRITE_TOOLS = new Set([
EditTool.Name,
MemoryTool.Name,
ShellTool.Name,
WriteFileTool.Name,
WRITE_FILE_TOOL_NAME,
WebFetchTool.Name,
]);

View File

@@ -33,6 +33,7 @@ import {
parseAndFormatApiError,
ToolConfirmationOutcome,
promptIdContext,
WRITE_FILE_TOOL_NAME,
} from '@google/gemini-cli-core';
import { type Part, type PartListUnion, FinishReason } from '@google/genai';
import type {
@@ -69,7 +70,7 @@ enum StreamProcessingStatus {
Error,
}
const EDIT_TOOL_NAMES = new Set(['replace', 'write_file']);
const EDIT_TOOL_NAMES = new Set(['replace', WRITE_FILE_TOOL_NAME]);
function showCitations(settings: LoadedSettings): boolean {
const enabled = settings?.merged?.ui?.showCitations;