import { z } from 'zod'; import type { ToolDef, ToolContext } from './types.js'; import { queueDelete } from '../pending_changes.js'; const DeleteFileInput = z.object({ file_path: z.string().min(1), }); type DeleteFileInputT = z.infer; export const deleteFileTool: ToolDef = { name: 'delete_file', description: 'Queue deletion of a file. ' + 'The change is staged in pending_changes and must be applied explicitly.', inputSchema: DeleteFileInput, jsonSchema: { type: 'function', function: { name: 'delete_file', description: 'Queue deletion of a file. ' + 'The change is staged in pending_changes and must be applied explicitly.', parameters: { type: 'object', properties: { file_path: { type: 'string', description: 'Path to the file to delete (relative to project root or absolute)' }, }, required: ['file_path'], }, }, }, async execute(input: DeleteFileInputT, projectRoot: string, context: ToolContext): Promise { const change = await queueDelete( context.sql, context.sessionId, context.taskId, input.file_path, projectRoot, ); return { status: 'queued', change_id: change.id, file_path: change.file_path, operation: 'delete', message: `File deletion queued: ${change.file_path}. Use apply_pending to write changes to disk.`, }; }, };