Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lua/codecompanion/_extensions/vectorcode/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local logger = vc_config.logger

---@type VectorCode.CodeCompanion.ExtensionOpts|{}
local default_extension_opts = {
tool_opts = { ls = {}, query = {}, vectorise = {} },
tool_opts = { ls = {}, query = {}, vectorise = { requires_approval = true } },
tool_group = { enabled = true, collapse = true, extras = {} },
}

Expand Down Expand Up @@ -50,6 +50,7 @@ local M = {
cc_config.strategies.chat.tools[tool_name] = {
description = string.format("Run VectorCode %s tool", sub_cmd),
callback = cc_integration.make_tool(sub_cmd, opts.tool_opts[sub_cmd]),
opts = { requires_approval = opts.tool_opts[sub_cmd].requires_approval },
}
logger.info(string.format("%s tool has been created.", tool_name))
end
Expand Down
2 changes: 1 addition & 1 deletion lua/vectorcode/integrations/codecompanion/query_tool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ For example, you should include `parameter`, `arguments` and `return value` for
},
project_root = {
type = "string",
description = "Project path to search within (must be from 'ls' results or user instructions). Use empty string for the current project.",
description = "Project path to search within (must be from 'ls' results or user instructions). Use empty string for the current project. If the user did not specify a project, assume that they're referring to the current project and use an empty string for this parameter. If this fails, use the `vectorcode_ls` tool and ask the user to clarify the project.",
},
},
required = { "query", "count", "project_root" },
Expand Down
6 changes: 5 additions & 1 deletion lua/vectorcode/integrations/codecompanion/vectorise_tool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ return function(opts)
},
project_root = {
type = "string",
description = "The project that the files belong to. Either use a path from the `vectorcode_ls` tool, or leave empty to use the current git project.",
description = "The project that the files belong to. Either use a path from the `vectorcode_ls` tool, or leave empty to use the current git project. If the user did not specify a path, use empty string for this parameter.",
},
},
required = { "paths", "project_root" },
Expand Down Expand Up @@ -99,6 +99,10 @@ return function(opts)
end,
},
output = {
---@param self CodeCompanion.Agent.Tool
prompt = function(self, _)
return string.format("Vectorise %d files with VectorCode?", #self.args.paths)
end,
---@param self CodeCompanion.Agent.Tool
---@param agent CodeCompanion.Agent
---@param stdout VectorCode.VectoriseResult[]
Expand Down
1 change: 1 addition & 0 deletions lua/vectorcode/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
---@class VectorCode.CodeCompanion.ToolOpts
--- Whether to use the LSP backend. Default: `false`
---@field use_lsp boolean?
---@field requires_approval boolean?

---@class VectorCode.CodeCompanion.LsToolOpts: VectorCode.CodeCompanion.ToolOpts

Expand Down