local M = {} local uv = vim.loop local ok_yaml, lyaml = pcall(require, "lyaml") local function get_config_path() local cwd = vim.fn.getcwd() local config_path = cwd .. "/.chatgpt_config.yaml" return config_path end function M.load() local path = get_config_path() local fd = uv.fs_open(path, "r", 438) if not fd then return { initial_prompt = "", directories = { "." }, } end local stat = uv.fs_fstat(fd) local data = uv.fs_read(fd, stat.size, 0) uv.fs_close(fd) if data and ok_yaml then local ok, result = pcall(lyaml.load, data) if ok and type(result) == "table" then local config = result[1] if type(config) == "table" then return { initial_prompt = config.initial_prompt or "", directories = config.directories or { "." }, } end end end return { initial_prompt = "", directories = { "." }, } end return M