feat: rename execute_command tool, improve go prompt
This commit is contained in:
@@ -4,7 +4,7 @@ M.run = function(tool_call, conf, prompt_user_tool_accept, is_subpath, read_file
|
||||
-- Validate the command exists
|
||||
local cmd = tool_call.command
|
||||
if not cmd then
|
||||
return "[executeCommand] Missing 'command'."
|
||||
return "[execute_command] Missing 'command'."
|
||||
end
|
||||
|
||||
-- Capture stderr and stdout together by redirecting stderr to stdout
|
||||
@@ -14,7 +14,7 @@ M.run = function(tool_call, conf, prompt_user_tool_accept, is_subpath, read_file
|
||||
-- Attempt to popen the command
|
||||
local handle = io.popen(cmd, "r")
|
||||
if not handle then
|
||||
return string.format("Tool [executeCommand '%s'] FAILED to popen.", cmd)
|
||||
return string.format("Tool [execute_command '%s'] FAILED to popen.", cmd)
|
||||
end
|
||||
|
||||
-- Read the full output (stdout + stderr)
|
||||
@@ -25,7 +25,7 @@ M.run = function(tool_call, conf, prompt_user_tool_accept, is_subpath, read_file
|
||||
|
||||
-- Provide a richer summary including exit code and reason
|
||||
return string.format(
|
||||
"Tool [executeCommand '%s'] exited with code %s (%s)\n%s",
|
||||
"Tool [execute_command '%s'] exited with code %s (%s)\n%s",
|
||||
cmd,
|
||||
tostring(exit_code),
|
||||
tostring(exit_reason),
|
||||
|
||||
@@ -23,8 +23,8 @@ M.available_tools = {
|
||||
explanation = "Use this to apply incremental changes without fully overwriting the file."
|
||||
},
|
||||
{
|
||||
name = "executeCommand",
|
||||
usage = "Run a shell command. Provide { tool='executeCommand', command='...' }",
|
||||
name = "execute_command",
|
||||
usage = "Run a shell command. Provide { tool='execute_command', command='...' }",
|
||||
explanation = "Just run one single command per tool invocation, without comment. It must be a single line. Use with caution, especially for destructive operations (rm, sudo, etc.)."
|
||||
},
|
||||
}
|
||||
@@ -33,7 +33,7 @@ M.tools_by_name = {
|
||||
read_file = read_file_tool,
|
||||
edit_file = edit_file_tool,
|
||||
replace_in_file = replace_in_file_tool,
|
||||
executeCommand = execute_command_tool
|
||||
execute_command = execute_command_tool
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -16,8 +16,8 @@ end
|
||||
local function prompt_user_tool_accept(tool_call, conf)
|
||||
local auto_accept = conf.tool_auto_accept[tool_call.tool]
|
||||
|
||||
-- If this is an executeCommand and we see it's destructive, force a user prompt
|
||||
if tool_call.tool == "executeCommand" and auto_accept then
|
||||
-- If this is an execute_command and we see it's destructive, force a user prompt
|
||||
if tool_call.tool == "execute_command" and auto_accept then
|
||||
if is_destructive_command(tool_call.command) then
|
||||
auto_accept = false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user