From f4f82a09d749da0bcd736600e621b0ed2a089635 Mon Sep 17 00:00:00 2001 From: Yomi Colledge <37376+baphled@users.noreply.github.com> Date: Tue, 22 Jul 2025 10:54:46 +0100 Subject: [PATCH] fix(llm_tools): Improve the permissions logic (#2506) Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- lua/avante/llm_tools/helpers.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/avante/llm_tools/helpers.lua b/lua/avante/llm_tools/helpers.lua index bd4e09b..3f0be92 100644 --- a/lua/avante/llm_tools/helpers.lua +++ b/lua/avante/llm_tools/helpers.lua @@ -111,7 +111,11 @@ end function M.has_permission_to_access(abs_path) if not Path:new(abs_path):is_absolute() then return false end local project_root = Utils.get_project_root() - if abs_path:sub(1, #project_root) ~= project_root then return false end + -- allow if inside project root OR inside user config dir + local config_dir = vim.fn.stdpath("config") + local in_project = abs_path:sub(1, #project_root) == project_root + local in_config = abs_path:sub(1, #config_dir) == config_dir + if not in_project and not in_config then return false end return not M.is_ignored(abs_path) end