mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	assistant/codecompanion-nvim: init (#707)
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Set up binary cache / cachix (default) (push) Waiting to run
				
			
		
			
				
	
				Set up binary cache / cachix (maximal) (push) Waiting to run
				
			
		
			
				
	
				Set up binary cache / cachix (nix) (push) Waiting to run
				
			
		
			
				
	
				Validate flake & check formatting / Validate Flake (push) Waiting to run
				
			
		
			
				
	
				Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
				
			
		
			
				
	
				Build and deploy documentation / Check latest commit (push) Waiting to run
				
			
		
			
				
	
				Build and deploy documentation / publish (push) Blocked by required conditions
				
			
		
			
				
	
				Check for typos in the source tree / check-typos (push) Waiting to run
				
			
		
			
				
	
				Validate flake & check documentation / Validate Flake Documentation (push) Has been cancelled
				
			
		
			
				
	
				Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Has been cancelled
				
			
		
		
	
	
		
	
		
			Some checks failed
		
		
	
	Set up binary cache / cachix (default) (push) Waiting to run
				
			Set up binary cache / cachix (maximal) (push) Waiting to run
				
			Set up binary cache / cachix (nix) (push) Waiting to run
				
			Validate flake & check formatting / Validate Flake (push) Waiting to run
				
			Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
				
			Build and deploy documentation / Check latest commit (push) Waiting to run
				
			Build and deploy documentation / publish (push) Blocked by required conditions
				
			Check for typos in the source tree / check-typos (push) Waiting to run
				
			Validate flake & check documentation / Validate Flake Documentation (push) Has been cancelled
				
			Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Has been cancelled
				
			* assistant/codecompanion-nvim: init * assistant/codecompanion-nvim: PR review revisions --------- Co-authored-by: raf <me@notashelf.dev>
This commit is contained in:
		
					parent
					
						
							
								54311277fc
							
						
					
				
			
			
				commit
				
					
						2d5ff939b0
					
				
			
		
					 7 changed files with 327 additions and 0 deletions
				
			
		|  | @ -234,6 +234,7 @@ isMaximal: { | ||||||
|         enable = false; |         enable = false; | ||||||
|         cmp.enable = isMaximal; |         cmp.enable = isMaximal; | ||||||
|       }; |       }; | ||||||
|  |       codecompanion-nvim.enable = false; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     session = { |     session = { | ||||||
|  |  | ||||||
|  | @ -167,10 +167,12 @@ | ||||||
| [ARCIII](https://github.com/ArmandoCIII): | [ARCIII](https://github.com/ArmandoCIII): | ||||||
| 
 | 
 | ||||||
| [leetcode.nvim]: https://github.com/kawre/leetcode.nvim | [leetcode.nvim]: https://github.com/kawre/leetcode.nvim | ||||||
|  | [codecompanion-nvim]: https://github.com/olimorris/codecompanion.nvim | ||||||
| 
 | 
 | ||||||
| - Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code | - Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code | ||||||
|   Inspiration from `vim.languages.clang.dap` implementation. |   Inspiration from `vim.languages.clang.dap` implementation. | ||||||
| - Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`. | - Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`. | ||||||
|  | - Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`. | ||||||
| 
 | 
 | ||||||
| [nezia1](https://github.com/nezia1): | [nezia1](https://github.com/nezia1): | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										278
									
								
								modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										278
									
								
								modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,278 @@ | ||||||
|  | {lib, ...}: let | ||||||
|  |   inherit (lib.options) mkOption mkEnableOption; | ||||||
|  |   inherit (lib.types) int str enum nullOr attrs; | ||||||
|  |   inherit (lib.nvim.types) mkPluginSetupOption luaInline; | ||||||
|  | in { | ||||||
|  |   options.vim.assistant = { | ||||||
|  |     codecompanion-nvim = { | ||||||
|  |       enable = mkEnableOption "complementary neovim plugin for codecompanion.nvim"; | ||||||
|  | 
 | ||||||
|  |       setupOpts = mkPluginSetupOption "codecompanion-nvim" { | ||||||
|  |         opts = { | ||||||
|  |           send_code = mkEnableOption "code from being sent to the LLM."; | ||||||
|  | 
 | ||||||
|  |           log_level = mkOption { | ||||||
|  |             type = enum ["DEBUG" "INFO" "ERROR" "TRACE"]; | ||||||
|  |             default = "ERROR"; | ||||||
|  |             description = "Change the level of logging."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           language = mkOption { | ||||||
|  |             type = str; | ||||||
|  |             default = "English"; | ||||||
|  |             description = "Specify which language an LLM should respond in."; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         display = { | ||||||
|  |           diff = { | ||||||
|  |             enabled = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = true; | ||||||
|  |                 description = "a diff view to see the changes made by the LLM."; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |             close_chat_at = mkOption { | ||||||
|  |               type = int; | ||||||
|  |               default = 240; | ||||||
|  |               description = '' | ||||||
|  |                 Close an open chat buffer if the | ||||||
|  |                 total columns of your display are less than... | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             layout = mkOption { | ||||||
|  |               type = enum ["vertical" "horizontal"]; | ||||||
|  |               default = "vertical"; | ||||||
|  |               description = "Type of split for default provider."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             provider = mkOption { | ||||||
|  |               type = enum ["default" "mini_diff"]; | ||||||
|  |               default = "default"; | ||||||
|  |               description = "The preferred kind of provider."; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           inline = { | ||||||
|  |             layout = mkOption { | ||||||
|  |               type = enum ["vertical" "horizontal" "buffer"]; | ||||||
|  |               default = "vertical"; | ||||||
|  |               description = "Customize how output is created in new buffer."; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           chat = { | ||||||
|  |             auto_scroll = mkEnableOption "automatic page scrolling."; | ||||||
|  | 
 | ||||||
|  |             show_settings = mkEnableOption '' | ||||||
|  |               LLM settings to appear at the top of the chat buffer. | ||||||
|  |             ''; | ||||||
|  | 
 | ||||||
|  |             start_in_insert_mode = mkEnableOption '' | ||||||
|  |               opening the chat buffer in insert mode. | ||||||
|  |             ''; | ||||||
|  | 
 | ||||||
|  |             show_header_separator = mkEnableOption '' | ||||||
|  |               header separators in the chat buffer. | ||||||
|  | 
 | ||||||
|  |               Set this to false if you're using an | ||||||
|  |               external markdown formatting plugin. | ||||||
|  |             ''; | ||||||
|  | 
 | ||||||
|  |             show_references = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = true; | ||||||
|  |                 description = "references in the chat buffer."; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |             show_token_count = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = true; | ||||||
|  |                 description = "the token count for each response."; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |             intro_message = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "Welcome to CodeCompanion ✨! Press ? for options."; | ||||||
|  |               description = "Message to appear in chat buffer."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             separator = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "─"; | ||||||
|  |               description = '' | ||||||
|  |                 The separator between the | ||||||
|  |                 different messages in the chat buffer. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             icons = { | ||||||
|  |               pinned_buffer = mkOption { | ||||||
|  |                 type = str; | ||||||
|  |                 default = " "; | ||||||
|  |                 description = "The icon to represent a pinned buffer."; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |               watched_buffer = mkOption { | ||||||
|  |                 type = str; | ||||||
|  |                 default = "👀 "; | ||||||
|  |                 description = "The icon to represent a watched buffer."; | ||||||
|  |               }; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           action_palette = { | ||||||
|  |             width = mkOption { | ||||||
|  |               type = int; | ||||||
|  |               default = 95; | ||||||
|  |               description = "Width of the action palette."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             height = mkOption { | ||||||
|  |               type = int; | ||||||
|  |               default = 10; | ||||||
|  |               description = "Height of the action palette."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             prompt = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "Prompt "; | ||||||
|  |               description = "Prompt used for interactive LLM calls."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             provider = mkOption { | ||||||
|  |               type = enum ["default" "telescope" "mini_pick"]; | ||||||
|  |               default = "default"; | ||||||
|  |               description = "Provider used for the action palette."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             opts = { | ||||||
|  |               show_default_actions = | ||||||
|  |                 mkEnableOption "" | ||||||
|  |                 // { | ||||||
|  |                   default = true; | ||||||
|  |                   description = "showing default actions in the action palette."; | ||||||
|  |                 }; | ||||||
|  | 
 | ||||||
|  |               show_default_prompt_library = | ||||||
|  |                 mkEnableOption "" | ||||||
|  |                 // { | ||||||
|  |                   default = true; | ||||||
|  |                   description = '' | ||||||
|  |                     showing default prompt library in the action palette. | ||||||
|  |                   ''; | ||||||
|  |                 }; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         adapters = mkOption { | ||||||
|  |           type = nullOr luaInline; | ||||||
|  |           default = null; | ||||||
|  |           description = "An adapter is what connects Neovim to an LLM."; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         strategies = { | ||||||
|  |           chat = { | ||||||
|  |             adapter = mkOption { | ||||||
|  |               type = nullOr str; | ||||||
|  |               default = null; | ||||||
|  |               description = "Adapter used for the chat strategy."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             keymaps = mkOption { | ||||||
|  |               type = nullOr attrs; | ||||||
|  |               default = null; | ||||||
|  |               description = "Define or override the default keymaps."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             variables = mkOption { | ||||||
|  |               type = nullOr luaInline; | ||||||
|  |               default = null; | ||||||
|  |               description = '' | ||||||
|  |                 Define your own variables | ||||||
|  |                 to share specific content. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             slash_commands = mkOption { | ||||||
|  |               type = nullOr luaInline; | ||||||
|  |               default = null; | ||||||
|  |               description = '' | ||||||
|  |                 Slash Commands (invoked with /) let you dynamically | ||||||
|  |                 insert context into the chat buffer, | ||||||
|  |                 such as file contents or date/time. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             tools = mkOption { | ||||||
|  |               type = nullOr attrs; | ||||||
|  |               default = null; | ||||||
|  |               description = '' | ||||||
|  |                 Configure tools to perform specific | ||||||
|  |                 tasks when invoked by an LLM. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             roles = mkOption { | ||||||
|  |               type = nullOr luaInline; | ||||||
|  |               default = null; | ||||||
|  |               description = '' | ||||||
|  |                 The chat buffer places user and LLM responses under a H2 header. | ||||||
|  |                 These can be customized in the configuration. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           inline = { | ||||||
|  |             adapter = mkOption { | ||||||
|  |               type = nullOr str; | ||||||
|  |               default = null; | ||||||
|  |               description = "Adapter used for the inline strategy."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             variables = mkOption { | ||||||
|  |               type = nullOr luaInline; | ||||||
|  |               default = null; | ||||||
|  |               description = '' | ||||||
|  |                 Define your own variables | ||||||
|  |                 to share specific content. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             keymaps = { | ||||||
|  |               accept_change = { | ||||||
|  |                 n = mkOption { | ||||||
|  |                   type = str; | ||||||
|  |                   default = "ga"; | ||||||
|  |                   description = "Accept the suggested change."; | ||||||
|  |                 }; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |               reject_change = { | ||||||
|  |                 n = mkOption { | ||||||
|  |                   type = str; | ||||||
|  |                   default = "gr"; | ||||||
|  |                   description = "Reject the suggested change."; | ||||||
|  |                 }; | ||||||
|  |               }; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         prompt_library = mkOption { | ||||||
|  |           type = nullOr attrs; | ||||||
|  |           default = null; | ||||||
|  |           description = '' | ||||||
|  |             A prompt library is a collection of prompts | ||||||
|  |             that can be used in the action palette. | ||||||
|  |           ''; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										27
									
								
								modules/plugins/assistant/codecompanion/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								modules/plugins/assistant/codecompanion/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   inherit (lib.modules) mkIf; | ||||||
|  | 
 | ||||||
|  |   cfg = config.vim.assistant.codecompanion-nvim; | ||||||
|  | in { | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     vim = { | ||||||
|  |       startPlugins = [ | ||||||
|  |         "plenary-nvim" | ||||||
|  |       ]; | ||||||
|  | 
 | ||||||
|  |       lazy.plugins = { | ||||||
|  |         codecompanion-nvim = { | ||||||
|  |           package = "codecompanion-nvim"; | ||||||
|  |           setupModule = "codecompanion"; | ||||||
|  |           inherit (cfg) setupOpts; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       treesitter.enable = true; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								modules/plugins/assistant/codecompanion/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/plugins/assistant/codecompanion/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | { | ||||||
|  |   imports = [ | ||||||
|  |     ./config.nix | ||||||
|  |     ./codecompanion-nvim.nix | ||||||
|  |   ]; | ||||||
|  | } | ||||||
|  | @ -2,5 +2,6 @@ | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./chatgpt |     ./chatgpt | ||||||
|     ./copilot |     ./copilot | ||||||
|  |     ./codecompanion | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -243,6 +243,18 @@ | ||||||
|       "url": "https://github.com/ray-x/cmp-treesitter/archive/958fcfa0d8ce46d215e19cc3992c542f576c4123.tar.gz", |       "url": "https://github.com/ray-x/cmp-treesitter/archive/958fcfa0d8ce46d215e19cc3992c542f576c4123.tar.gz", | ||||||
|       "hash": "05as01c2f7i20zkzpqbq9n8ji9bcwd678ixmxnrz9vmz5zsj8q7i" |       "hash": "05as01c2f7i20zkzpqbq9n8ji9bcwd678ixmxnrz9vmz5zsj8q7i" | ||||||
|     }, |     }, | ||||||
|  |     "codecompanion-nvim": { | ||||||
|  |       "type": "Git", | ||||||
|  |       "repository": { | ||||||
|  |         "type": "GitHub", | ||||||
|  |         "owner": "olimorris", | ||||||
|  |         "repo": "codecompanion.nvim" | ||||||
|  |       }, | ||||||
|  |       "branch": "main", | ||||||
|  |       "revision": "dd81bd9176daba9ea507cd0457f662c0a15c001f", | ||||||
|  |       "url": "https://github.com/olimorris/codecompanion.nvim/archive/dd81bd9176daba9ea507cd0457f662c0a15c001f.tar.gz", | ||||||
|  |       "hash": "09a20q1hshp07nf9n8w4cxpa8s32vwyd4ya0gdnx5jp7g00dksrg" | ||||||
|  |     }, | ||||||
|     "codewindow-nvim": { |     "codewindow-nvim": { | ||||||
|       "type": "Git", |       "type": "Git", | ||||||
|       "repository": { |       "repository": { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 ARCIII
				ARCIII