From bec85a69e013c510ec967d80682d01dbc2d6c689 Mon Sep 17 00:00:00 2001 From: Gregory Gauthier Date: Wed, 4 Mar 2026 12:24:23 +0000 Subject: [PATCH] refactor(chat): remove temporary overrides for edit and scaffold tools Simplify tool call handling by eliminating global overrides for instructions and descriptions, directly executing commands with provided arguments. --- cmd/chat.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/cmd/chat.go b/cmd/chat.go index 6c44b6c..171f33a 100644 --- a/cmd/chat.go +++ b/cmd/chat.go @@ -183,21 +183,14 @@ func handleToolCall(reply string, history *[]map[string]string) { switch tc.Tool { case "edit": - if tc.File != "" && tc.Instruction != "" { - // Pass the instruction directly to the edit command + if tc.File != "" { editCmd.SetArgs([]string{tc.File}) - // We set a temporary global so the edit command can pick up the instruction - // (this is the simplest way without refactoring every command) - editInstructionOverride = tc.Instruction _ = editCmd.Execute() - editInstructionOverride = "" // reset } case "scaffold": - if tc.Path != "" && tc.Description != "" { + if tc.Path != "" { scaffoldCmd.SetArgs([]string{tc.Path}) - scaffoldDescriptionOverride = tc.Description _ = scaffoldCmd.Execute() - scaffoldDescriptionOverride = "" } case "testgen": if tc.File != "" { @@ -219,9 +212,3 @@ func handleToolCall(reply string, history *[]map[string]string) { *history = append(*history, map[string]string{"role": "assistant", "content": reply}) } - -// Temporary overrides so the existing command logic can pick up the instruction from the agent -var ( - editInstructionOverride string - scaffoldDescriptionOverride string -)