Files
chatgpt.vim/lua/chatgpt_nvim/tools/init.lua

40 lines
1.5 KiB
Lua

local read_file_tool = require("chatgpt_nvim.tools.read_file")
local edit_file_tool = require("chatgpt_nvim.tools.edit_file")
local replace_in_file_tool = require("chatgpt_nvim.tools.replace_in_file")
local execute_command_tool = require("chatgpt_nvim.tools.execute_command")
local M = {}
-- We can store a table of available tools here
M.available_tools = {
{
name = "read_file",
usage = "Retrieve the contents of a file. Provide { tool='read_file', path='...' }",
explanation = "Use this to read file content directly from the disk."
},
{
name = "edit_file",
usage = "Overwrite an entire file's content. Provide { tool='edit_file', path='...', content='...' }, Allways include the whole file content",
explanation = "Use this when you want to replace a file with new content."
},
{
name = "replace_in_file",
usage = "Perform a search-and-replace. Provide { tool='replace_in_file', path='...', replacements=[ { search='...', replace='...' }, ... ] }",
explanation = "Use this to apply incremental changes without fully overwriting the file."
},
{
name = "executeCommand",
usage = "Run a shell command. Provide { tool='executeCommand', 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.)."
},
}
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
}
return M