Skip to content

Commit 1450d77

Browse files
author
Zhe Yu
committed
fix(nvim): Normalise and absolute project root for codecompanion tools
1 parent 0fcf31d commit 1450d77

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lua/vectorcode/integrations/codecompanion/query_tool.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ return check_cli_wrap(function(opts)
7474
vim.uv.fs_stat(action.project_root) ~= nil
7575
and vim.uv.fs_stat(action.project_root).type == "directory"
7676
then
77+
action.project_root = vim.fs.abspath(vim.fs.normalize(action.project_root))
7778
vim.list_extend(args, { "--project_root", action.project_root })
7879
else
7980
return {

lua/vectorcode/integrations/codecompanion/vectorise_tool.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ return function(opts)
5050
---@return nil|{ status: string, data: string }
5151
function(agent, action, _, cb)
5252
local args = { "vectorise", "--pipe" }
53-
local project_root = action.project_root or ""
53+
local project_root = vim.fs.abspath(vim.fs.normalize(action.project_root or ""))
5454
if project_root ~= "" then
5555
local stat = vim.uv.fs_stat(project_root)
5656
if stat and stat.type == "directory" then
@@ -59,8 +59,8 @@ return function(opts)
5959
return { status = "error", data = "Invalid path " .. project_root }
6060
end
6161
else
62-
project_root = vim.fs.root(".", { ".vectorcode", ".git" })
63-
if project_root == nil then
62+
project_root = vim.fs.root(".", { ".vectorcode", ".git" }) or ""
63+
if project_root == "" then
6464
return {
6565
status = "error",
6666
data = "Please specify a project root. You may use the `vectorcode_ls` tool to find a list of existing projects.",

0 commit comments

Comments
 (0)