diff --git a/lua/plugins/codecompanion.lua b/lua/plugins/codecompanion.lua new file mode 100644 index 0000000..0e4db39 --- /dev/null +++ b/lua/plugins/codecompanion.lua @@ -0,0 +1,86 @@ +return { + "olimorris/codecompanion.nvim", + version = "^19.0.0", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + opts = { + adapters = { + acp = { + hermes = function() + local adapter = require("codecompanion.adapters").extend("codex", { + name = "hermes", + formatted_name = "Hermes", + commands = { + default = { + vim.fn.exepath("hermes") ~= "" and vim.fn.exepath("hermes") or "hermes", + "acp", + }, + }, + defaults = { + auth_method = "openai-codex", + timeout = 20000, + mcpServers = {}, + }, + }) + + -- Hermes resolves credentials from its own configuration. + adapter.env = {} + return adapter + end, + extend = { + codex = { + defaults = { + auth_method = "chat-gpt", + }, + }, + }, + }, + http = { + extend = { + openai_responses = { + schema = { + model = { + default = "gpt-5.6-terra", + }, + }, + }, + }, + openai_terra = function() + return require("codecompanion.adapters").extend("openai_responses", { + name = "openai_terra", + formatted_name = "OpenAI: GPT-5.6 Terra", + schema = { + model = { + default = "gpt-5.6-terra", + }, + }, + }) + end, + openai_luna = function() + return require("codecompanion.adapters").extend("openai_responses", { + name = "openai_luna", + formatted_name = "OpenAI: GPT-5.6 Luna", + schema = { + model = { + default = "gpt-5.6-luna", + }, + }, + }) + end, + }, + }, + interactions = { + chat = { + adapter = "hermes", + }, + inline = { + adapter = { + name = "openai_responses", + model = "gpt-5.6-terra", + }, + }, + }, + }, +}