@@ -5,7 +5,7 @@ A Neovim plugin extension for CodeCompanion that generates AI-powered Git commit
5
5
## ✨ Features
6
6
7
7
- 🤖 ** AI Commit Generation** - Generate Conventional Commits compliant messages using CodeCompanion's LLM adapters
8
- - 🛠️ ** Git Tool Integration** - Execute Git operations through ` @git_read ` (15 operations) and ` @git_edit ` (16 operations) tools in chat
8
+ - 🛠️ ** Git Tool Integration** - Execute Git operations through ` @git_read ` (15 read operations) and ` @git_edit ` (16 write operations) tools in chat
9
9
- 🤖 ** Git Assistant** - Intelligent Git workflow assistance via ` @git_bot ` combining read/write operations
10
10
- 🌍 ** Multi-language Support** - Generate commit messages in multiple languages
11
11
- 📝 ** Smart Buffer Integration** - Auto-generate commit messages in gitcommit buffers with configurable keymaps
@@ -36,19 +36,23 @@ require("codecompanion").setup({
36
36
37
37
-- Buffer integration
38
38
buffer = {
39
- enabled = true , -- Enable gitcommit buffer keymaps
40
- keymap = " <leader>gc" , -- Keymap for generating commit messages
41
- auto_generate = true , -- Auto-generate on buffer enter
42
- auto_generate_delay = 200 , -- Auto-generation delay (ms)
39
+ enabled = true , -- Enable gitcommit buffer keymaps
40
+ keymap = " <leader>gc" , -- Keymap for generating commit messages
41
+ auto_generate = true , -- Auto-generate on buffer enter
42
+ auto_generate_delay = 200 , -- Auto-generation delay (ms)
43
+ skip_auto_generate_on_amend = true , -- Skip auto-generation during git commit --amend
43
44
},
44
45
45
46
-- Feature toggles
46
- add_slash_command = true , -- Add /gitcommit slash command
47
- add_git_tool = true , -- Add @git_read and @git_edit tools
48
- enable_git_read = true , -- Enable read-only Git operations
49
- enable_git_edit = true , -- Enable write-access Git operations
50
- enable_git_bot = true , -- Enable @git_bot tool group (requires both read/write enabled)
51
- add_git_commands = true , -- Add :CodeCompanionGitCommit commands
47
+ add_slash_command = true , -- Add /gitcommit slash command
48
+ add_git_tool = true , -- Add @git_read and @git_edit tools
49
+ enable_git_read = true , -- Enable read-only Git operations
50
+ enable_git_edit = true , -- Enable write-access Git operations
51
+ enable_git_bot = true , -- Enable @git_bot tool group (requires both read/write enabled)
52
+ add_git_commands = true , -- Add :CodeCompanionGitCommit commands
53
+ git_tool_auto_submit_errors = false , -- Auto-submit errors to LLM
54
+ git_tool_auto_submit_success = true , -- Auto-submit success to LLM
55
+ gitcommit_select_count = 100 , -- Number of commits shown in /gitcommit
52
56
}
53
57
}
54
58
}
@@ -71,33 +75,53 @@ Use Git tools in CodeCompanion chat:
71
75
#### 📖 Read-only Operations (` @git_read ` )
72
76
73
77
```
74
- @git_read status # Show repository status
75
- @git_read log --count 5 # Show last 5 commits
76
- @git_read diff --staged # Show staged changes
77
- @git_read branch # List all branches
78
- @git_read contributors --count 10 # Show top 10 contributors
79
- @git_read tags # List all tags
80
- @git_read gitignore_get # Get .gitignore content
78
+ @git_read status # Show repository status
79
+ @git_read log --count 5 # Show last 5 commits
80
+ @git_read diff --staged # Show staged changes
81
+ @git_read branch # List all branches
82
+ @git_read contributors --count 10 # Show top 10 contributors
83
+ @git_read tags # List all tags
84
+ @git_read gitignore_get # Get .gitignore content
85
+ @git_read gitignore_check --gitignore_file "file.txt" # Check if file is ignored
86
+ @git_read show --commit_hash "abc123" # Show commit details
87
+ @git_read blame --file_path "src/main.lua" # Show file blame information
88
+ @git_read search_commits --pattern "fix:" # Search commits containing "fix:"
89
+ @git_read stash_list # List all stashes
90
+ @git_read diff_commits --commit1 "abc123" --commit2 "def456" # Compare two commits
91
+ @git_read remotes # Show remote repositories
92
+ @git_read help # Show help information
81
93
```
82
94
83
95
#### ✏️ Write Operations (` @git_edit ` )
84
96
85
97
```
86
98
@git_edit stage --files ["src/main.lua", "README.md"]
87
- @git_edit create_branch --branch_name "feature/new-ui"
88
- @git_edit stash --message "Work in progress"
89
- @git_edit checkout --target "main"
99
+ @git_edit unstage --files ["src/main.lua"]
90
100
@git_edit commit --commit_message "feat: add new feature"
91
- @git_edit push --remote "origin" --branch "main"
101
+ @git_edit commit # Auto-generate AI commit message
102
+ @git_edit create_branch --branch_name "feature/new-ui" --checkout true
103
+ @git_edit checkout --target "main"
104
+ @git_edit stash --message "Work in progress" --include_untracked true
105
+ @git_edit apply_stash --stash_ref "stash@{0}"
106
+ @git_edit reset --commit_hash "abc123" --mode "soft"
107
+ @git_edit gitignore_add --gitignore_rules ["*.log", "temp/*"]
108
+ @git_edit gitignore_remove --gitignore_rule "*.tmp"
109
+ @git_edit push --remote "origin" --branch "main" --set_upstream true
110
+ @git_edit cherry_pick --cherry_pick_commit_hash "abc123"
111
+ @git_edit revert --revert_commit_hash "abc123"
112
+ @git_edit create_tag --tag_name "v1.0.0" --tag_message "Release v1.0.0"
113
+ @git_edit delete_tag --tag_name "v0.9.0"
114
+ @git_edit merge --branch "feature/new-ui"
92
115
```
93
116
94
- #### 🤖 Git Bot (` @git_bot ` )
117
+ #### 🤖 Git Assistant (` @git_bot ` )
95
118
96
119
Use a comprehensive Git assistant that combines read and write operations:
97
120
98
121
```
99
122
@git_bot Please help me create a new branch and push the current changes
100
123
@git_bot Analyze recent commit history and summarize main changes
124
+ @git_bot Help me organize the current workspace status
101
125
```
102
126
103
127
### Basic Usage
@@ -114,11 +138,11 @@ Use a comprehensive Git assistant that combines read and write operations:
114
138
115
139
** 3. Chat-based Git workflow:**
116
140
```
117
- @git_read status # Check repository status
141
+ @git_read status # Check repository status
118
142
@git_edit stage --files ["file1.txt", "file2.txt"] # Stage files
119
- /gitcommit # Generate commit message in chat
143
+ /gitcommit # Generate commit message in chat
120
144
@git_edit commit --commit_message "feat: add new feature" # Commit
121
- @git_edit push --remote "origin" --branch "main" # Push changes
145
+ @git_edit push --remote "origin" --branch "main" # Push changes
122
146
```
123
147
124
148
## ⚙️ Configuration Options
@@ -128,29 +152,30 @@ Use a comprehensive Git assistant that combines read and write operations:
128
152
129
153
``` lua
130
154
opts = {
131
- adapter = " openai" , -- LLM adapter
132
- model = " gpt-4" , -- Model name
155
+ adapter = " openai" , -- LLM adapter
156
+ model = " gpt-4" , -- Model name
133
157
languages = { " English" , " Chinese" , " Japanese" , " French" }, -- Supported languages list
134
- exclude_files = { -- Excluded file patterns
158
+ exclude_files = { -- Excluded file patterns
135
159
" *.pb.go" , " *.min.js" , " *.min.css" ,
136
160
" package-lock.json" , " yarn.lock" , " *.log" ,
137
161
" dist/*" , " build/*" , " .next/*" ,
138
162
" node_modules/*" , " vendor/*"
139
163
},
140
- add_slash_command = true , -- Add /gitcommit command
141
- add_git_tool = true , -- Add Git tools
142
- enable_git_read = true , -- Enable read-only Git operations
143
- enable_git_edit = true , -- Enable write-access Git operations
144
- enable_git_bot = true , -- Enable Git bot (requires both read/write enabled)
145
- add_git_commands = true , -- Add Git commands
146
- gitcommit_select_count = 100 , -- Commits shown in /gitcommit
147
- git_tool_auto_submit_errors = false , -- Auto-submit errors to LLM
148
- git_tool_auto_submit_success = false , -- Auto-submit success to LLM
164
+ add_slash_command = true , -- Add /gitcommit command
165
+ add_git_tool = true , -- Add Git tools
166
+ enable_git_read = true , -- Enable read-only Git operations
167
+ enable_git_edit = true , -- Enable write-access Git operations
168
+ enable_git_bot = true , -- Enable Git bot (requires both read/write enabled)
169
+ add_git_commands = true , -- Add Git commands
170
+ gitcommit_select_count = 100 , -- Commits shown in /gitcommit
171
+ git_tool_auto_submit_errors = false , -- Auto-submit errors to LLM
172
+ git_tool_auto_submit_success = true , -- Auto-submit success to LLM
149
173
buffer = {
150
- enabled = true , -- Enable buffer integration
151
- keymap = " <leader>gc" , -- Keymap
152
- auto_generate = true , -- Auto-generate
153
- auto_generate_delay = 200 , -- Generation delay (ms)
174
+ enabled = true , -- Enable buffer integration
175
+ keymap = " <leader>gc" , -- Keymap
176
+ auto_generate = true , -- Auto-generate
177
+ auto_generate_delay = 200 , -- Generation delay (ms)
178
+ skip_auto_generate_on_amend = true , -- Skip auto-generation during amend
154
179
}
155
180
}
156
181
```
0 commit comments