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

@@ -10,6 +10,7 @@
export const GLOB_TOOL_NAME = 'glob';
export const WRITE_TODOS_TOOL_NAME = 'write_todos';
export const WRITE_FILE_TOOL_NAME = 'write_file';
// TODO: Migrate other tool names here to follow this pattern and prevent future circular dependencies.
// Candidates for migration:

View File

@@ -7,6 +7,7 @@
import fs from 'node:fs';
import path from 'node:path';
import * as Diff from 'diff';
import { WRITE_FILE_TOOL_NAME } from './tool-names.js';
import type { Config } from '../config/config.js';
import { ApprovalMode } from '../config/config.js';
import type {
@@ -389,7 +390,7 @@ export class WriteFileTool
extends BaseDeclarativeTool<WriteFileToolParams, ToolResult>
implements ModifiableDeclarativeTool<WriteFileToolParams>
{
static readonly Name: string = 'write_file';
static readonly Name: string = WRITE_FILE_TOOL_NAME;
constructor(private readonly config: Config) {
super(