diff options
Diffstat (limited to 'packages/core/src/tools')
| -rw-r--r-- | packages/core/src/tools/edit.test.ts | 9 | ||||
| -rw-r--r-- | packages/core/src/tools/edit.ts | 19 | ||||
| -rw-r--r-- | packages/core/src/tools/tools.ts | 5 |
3 files changed, 7 insertions, 26 deletions
diff --git a/packages/core/src/tools/edit.test.ts b/packages/core/src/tools/edit.test.ts index 8c351929..dd3b481d 100644 --- a/packages/core/src/tools/edit.test.ts +++ b/packages/core/src/tools/edit.test.ts @@ -32,7 +32,6 @@ import fs from 'fs'; import os from 'os'; import { ApprovalMode, Config } from '../config/config.js'; import { Content, Part, SchemaUnion } from '@google/genai'; -import { ToolConfirmationOutcome } from './tools.js'; describe('EditTool', () => { let tool: EditTool; @@ -634,7 +633,7 @@ describe('EditTool', () => { const result = await tool.onModify( params, new AbortController().signal, - ToolConfirmationOutcome.ModifyVSCode, + 'vscode', ); expect(mockOpenDiff).toHaveBeenCalledTimes(1); @@ -678,7 +677,7 @@ describe('EditTool', () => { const result = await tool.onModify( params, new AbortController().signal, - ToolConfirmationOutcome.ModifyVSCode, + 'vscode', ); expect(mockOpenDiff).toHaveBeenCalledTimes(1); @@ -711,7 +710,7 @@ describe('EditTool', () => { const result1 = await tool.onModify( params, new AbortController().signal, - ToolConfirmationOutcome.ModifyVSCode, + 'vscode', ); const firstCall = mockOpenDiff.mock.calls[0]; const firstOldPath = firstCall[0]; @@ -727,7 +726,7 @@ describe('EditTool', () => { const result2 = await tool.onModify( params, new AbortController().signal, - ToolConfirmationOutcome.ModifyVSCode, + 'vscode', ); const secondCall = mockOpenDiff.mock.calls[1]; const secondOldPath = secondCall[0]; diff --git a/packages/core/src/tools/edit.ts b/packages/core/src/tools/edit.ts index a49b8d83..39352121 100644 --- a/packages/core/src/tools/edit.ts +++ b/packages/core/src/tools/edit.ts @@ -432,19 +432,6 @@ Expectation for required parameters: } } - async getEditor(outcome: ToolConfirmationOutcome): Promise<EditorType> { - switch (outcome) { - case ToolConfirmationOutcome.ModifyVSCode: - return 'vscode'; - case ToolConfirmationOutcome.ModifyWindsurf: - return 'windsurf'; - case ToolConfirmationOutcome.ModifyCursor: - return 'cursor'; - default: - return 'vim'; - } - } - /** * Creates temp files for the current and proposed file contents and opens a diff tool. * When the diff tool is closed, the tool will check if the file has been modified and provide the updated params. @@ -453,7 +440,7 @@ Expectation for required parameters: async onModify( params: EditToolParams, _abortSignal: AbortSignal, - outcome: ToolConfirmationOutcome, + editorType: EditorType, ): Promise< { updatedParams: EditToolParams; updatedDiff: string } | undefined > { @@ -461,9 +448,7 @@ Expectation for required parameters: this.tempOldDiffPath = oldPath; this.tempNewDiffPath = newPath; - const editor = await this.getEditor(outcome); - - await openDiff(this.tempOldDiffPath, this.tempNewDiffPath, editor); + await openDiff(this.tempOldDiffPath, this.tempNewDiffPath, editorType); return await this.getUpdatedParamsIfModified(params, _abortSignal); } diff --git a/packages/core/src/tools/tools.ts b/packages/core/src/tools/tools.ts index e80047df..ced53995 100644 --- a/packages/core/src/tools/tools.ts +++ b/packages/core/src/tools/tools.ts @@ -232,9 +232,6 @@ export enum ToolConfirmationOutcome { ProceedAlways = 'proceed_always', ProceedAlwaysServer = 'proceed_always_server', ProceedAlwaysTool = 'proceed_always_tool', - ModifyVSCode = 'modify_vscode', - ModifyWindsurf = 'modify_windsurf', - ModifyCursor = 'modify_cursor', - ModifyVim = 'modify_vim', + ModifyWithEditor = 'modify_with_editor', Cancel = 'cancel', } |
