summaryrefslogtreecommitdiff
path: root/config/nvim/lua/plugins/codecompanion.lua
diff options
context:
space:
mode:
Diffstat (limited to 'config/nvim/lua/plugins/codecompanion.lua')
-rw-r--r--config/nvim/lua/plugins/codecompanion.lua89
1 files changed, 89 insertions, 0 deletions
diff --git a/config/nvim/lua/plugins/codecompanion.lua b/config/nvim/lua/plugins/codecompanion.lua
new file mode 100644
index 0000000..a657d09
--- /dev/null
+++ b/config/nvim/lua/plugins/codecompanion.lua
@@ -0,0 +1,89 @@
+return {
+ "olimorris/codecompanion.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-treesitter/nvim-treesitter",
+ {
+ "MeanderingProgrammer/render-markdown.nvim",
+ ft = { "markdown", "codecompanion" },
+ },
+ {
+ "ravitemer/mcphub.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ },
+ build = "npm install -g mcp-hub@latest",
+ config = function()
+ require("mcphub").setup()
+ end,
+ },
+ },
+ opts = {
+ opts = {
+ log_level = "DEBUG", -- or "TRACE"
+ },
+ extensions = {
+ mcphub = {
+ callback = "mcphub.extensions.codecompanion",
+ opts = {
+ make_tools = true, -- Make individual tools (@server__tool) and server groups (@server) from MCP servers
+ show_server_tools_in_chat = true, -- Show individual tools in chat completion (when make_tools=true)
+ add_mcp_prefix_to_tool_names = false, -- Add mcp__ prefix (e.g `@mcp__github`, `@mcp__neovim__list_issues`)
+ show_result_in_chat = true, -- Show tool results directly in chat buffer
+ format_tool = nil, -- function(tool_name:string, tool: CodeCompanion.Agent.Tool) : string Function to format tool names to show in the chat buffer
+ -- MCP Resources
+ make_vars = true, -- Convert MCP resources to #variables for prompts
+ -- MCP Prompts
+ make_slash_commands = true, -- Add MCP prompts as /slash commands
+ },
+ },
+ },
+ strategies = {
+ chat = {
+ adapter = "scbt",
+ tools = {
+ opts = {
+ default_tools = {
+ "full_stack_dev",
+ "mcp",
+ },
+ },
+ opts = {
+ system_promt = "Ты полезный ассистент в редакторе neovim в плагине codecompanion. Основной зык программирования - go. Отвечай всегда на русском языке.",
+ },
+ },
+ },
+ inline = {
+ adapter = "scbt",
+ },
+ },
+ memory = {
+ opts = {
+ chat = {
+ enabled = true,
+ },
+ },
+ },
+ adapters = {
+ http = {
+ scbt = function()
+ return require("codecompanion.adapters").extend("openai_compatible", {
+ env = {
+ api_key = "cmd: age -d -i ~/.ssh/id_ed25519 ~/.openai-api-key.age",
+ url = "http://localhost:8888/api",
+ },
+
+ schema = {
+ model = {
+ default = "qwen3-235b-it",
+ choices = {
+ "qwen3-235b-it",
+ },
+ },
+ },
+ })
+ end,
+ },
+ },
+ },
+}