feat: dont include chatgpt_config.yaml in file list

This commit is contained in:
2025-02-13 11:54:27 +01:00
parent 1deae056b7
commit a5bad60d8e
2 changed files with 14 additions and 10 deletions

View File

@@ -148,7 +148,9 @@ function M.get_project_files(directories, conf)
local rel_files = {}
for _, f in ipairs(all_files) do
local rel = vim.fn.fnamemodify(f, ":.")
table.insert(rel_files, rel)
if not rel:match("^%.?chatgpt_config%.yaml$") then
table.insert(rel_files, rel)
end
end
if conf.debug then

View File

@@ -122,15 +122,17 @@ local function build_prompt(user_input, dirs, conf)
-- 4.1) Dynamic file inclusion via @ operator in user_input
local dynamic_files = {}
for file in user_input:gmatch("@([^%s]+)") do
local already_included = false
for _, existing in ipairs(initial_files) do
if existing == file then
already_included = true
break
if file ~= "chatgpt_config.yaml" and file ~= ".chatgpt_config.yaml" then
local already_included = false
for _, existing in ipairs(initial_files) do
if existing == file then
already_included = true
break
end
end
if not already_included then
table.insert(dynamic_files, file)
end
end
if not already_included then
table.insert(dynamic_files, file)
end
end
@@ -173,7 +175,7 @@ local function build_prompt(user_input, dirs, conf)
table.insert(final_sections, table.concat(env_lines, "\n"))
local final_prompt = table.concat(final_sections, "\n\n")
final_prompt = final_prompt:gsub("%%PROJECT_NAME%%", conf.project_name)
final_prompt = final_prompt:gsub("%chatgpt.vim%", conf.project_name)
return final_prompt
end