Skip to content

Commit 78c03e4

Browse files
committed
feat(docs): update docs and config for new git tool options
- document new git_read and git_edit operations in README and help - add buffer.skip_auto_generate_on_amend option to config and docs - set git_tool_auto_submit_success default to true in docs and examples - clarify feature toggles and buffer integration comments - expand usage examples for new git assistant features
1 parent 7783714 commit 78c03e4

File tree

3 files changed

+94
-54
lines changed

3 files changed

+94
-54
lines changed

README.md

Lines changed: 67 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A Neovim plugin extension for CodeCompanion that generates AI-powered Git commit
55
## ✨ Features
66

77
- 🤖 **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
99
- 🤖 **Git Assistant** - Intelligent Git workflow assistance via `@git_bot` combining read/write operations
1010
- 🌍 **Multi-language Support** - Generate commit messages in multiple languages
1111
- 📝 **Smart Buffer Integration** - Auto-generate commit messages in gitcommit buffers with configurable keymaps
@@ -36,19 +36,23 @@ require("codecompanion").setup({
3636

3737
-- Buffer integration
3838
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
4344
},
4445

4546
-- 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
5256
}
5357
}
5458
}
@@ -71,33 +75,53 @@ Use Git tools in CodeCompanion chat:
7175
#### 📖 Read-only Operations (`@git_read`)
7276

7377
```
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
8193
```
8294

8395
#### ✏️ Write Operations (`@git_edit`)
8496

8597
```
8698
@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"]
90100
@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"
92115
```
93116

94-
#### 🤖 Git Bot (`@git_bot`)
117+
#### 🤖 Git Assistant (`@git_bot`)
95118

96119
Use a comprehensive Git assistant that combines read and write operations:
97120

98121
```
99122
@git_bot Please help me create a new branch and push the current changes
100123
@git_bot Analyze recent commit history and summarize main changes
124+
@git_bot Help me organize the current workspace status
101125
```
102126

103127
### Basic Usage
@@ -114,11 +138,11 @@ Use a comprehensive Git assistant that combines read and write operations:
114138

115139
**3. Chat-based Git workflow:**
116140
```
117-
@git_read status # Check repository status
141+
@git_read status # Check repository status
118142
@git_edit stage --files ["file1.txt", "file2.txt"] # Stage files
119-
/gitcommit # Generate commit message in chat
143+
/gitcommit # Generate commit message in chat
120144
@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
122146
```
123147

124148
## ⚙️ Configuration Options
@@ -128,29 +152,30 @@ Use a comprehensive Git assistant that combines read and write operations:
128152

129153
```lua
130154
opts = {
131-
adapter = "openai", -- LLM adapter
132-
model = "gpt-4", -- Model name
155+
adapter = "openai", -- LLM adapter
156+
model = "gpt-4", -- Model name
133157
languages = { "English", "Chinese", "Japanese", "French" }, -- Supported languages list
134-
exclude_files = { -- Excluded file patterns
158+
exclude_files = { -- Excluded file patterns
135159
"*.pb.go", "*.min.js", "*.min.css",
136160
"package-lock.json", "yarn.lock", "*.log",
137161
"dist/*", "build/*", ".next/*",
138162
"node_modules/*", "vendor/*"
139163
},
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
149173
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
154179
}
155180
}
156181
```

config_example.lua

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,23 @@ return {
2626

2727
-- Buffer configuration
2828
buffer = {
29-
enabled = true,
30-
keymap = "<leader>gc",
31-
auto_generate = true,
32-
auto_generate_delay = 200,
29+
enabled = true, -- Enable buffer integration
30+
keymap = "<leader>gc", -- Keymap
31+
auto_generate = true, -- Auto-generate
32+
auto_generate_delay = 200, -- Auto-generation delay (ms)
33+
skip_auto_generate_on_amend = true, -- Skip auto-generation during git commit --amend
3334
},
3435

35-
-- Enable slash command in chat buffer
36-
add_slash_command = true,
36+
-- Feature toggles
37+
add_slash_command = true, -- Enable slash command in chat buffer
38+
add_git_tool = true, -- Add @git_read and @git_edit tools to CodeCompanion
39+
enable_git_read = true, -- Enable read-only Git operations
40+
enable_git_edit = true, -- Enable write-access Git operations
41+
enable_git_bot = true, -- Enable @git_bot tool group (requires both read/write enabled)
42+
add_git_commands = true, -- Add :CodeCompanionGitCommit commands
3743

3844
-- Git tool configuration
39-
add_git_tool = true, -- Add @git_bot tool to CodeCompanion
40-
add_git_commands = true, -- Add :CodeCompanionGit commands
41-
git_tool_auto_submit_errors = false, -- Don't auto-submit errors to LLM
42-
git_tool_auto_submit_success = false, -- Don't auto-submit success to LLM
43-
gitcommit_select_count = 100, -- Number of recent commits for /gitcommit slash command
45+
git_tool_auto_submit_errors = false, -- Don't auto-submit errors to LLM
46+
git_tool_auto_submit_success = true, -- Auto-submit success to LLM
47+
gitcommit_select_count = 100, -- Number of recent commits for /gitcommit slash command
4448
}

doc/codecompanion-gitcommit.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Add this extension to your CodeCompanion configuration:
8585
keymap = "<leader>gc", -- Keymap for generating commit messages
8686
auto_generate = true, -- Auto-generate on buffer enter
8787
auto_generate_delay = 200, -- Auto-generation delay (ms)
88+
skip_auto_generate_on_amend = true, -- Skip auto-generation during git commit --amend
8889
},
8990

9091
-- Feature toggles
@@ -94,6 +95,9 @@ Add this extension to your CodeCompanion configuration:
9495
enable_git_edit = true, -- Enable write-access Git operations
9596
enable_git_bot = true, -- Enable @git_bot tool group
9697
add_git_commands = true, -- Add :CodeCompanionGitCommit commands
98+
git_tool_auto_submit_errors = false, -- Auto-submit errors to LLM
99+
git_tool_auto_submit_success = true, -- Auto-submit success to LLM
100+
gitcommit_select_count = 100, -- Number of commits shown in /gitcommit
97101
}
98102
}
99103
}
@@ -160,6 +164,9 @@ Read-only operations (@git_read): *git_read*
160164
• tags - List all tags
161165
• gitignore_get - Get .gitignore content
162166
• gitignore_check - Check if a file is ignored
167+
• stash_list - List all stashes
168+
• diff_commits - Compare two commits
169+
• help - Show help information
163170

164171
Write operations (@git_edit): *git_edit*
165172

@@ -243,7 +250,7 @@ Safety features:
243250
When enabled, automatically submits git tool error messages back to
244251
the LLM for analysis.
245252

246-
*git_tool_auto_submit_success* Type: boolean, Default: false
253+
*git_tool_auto_submit_success* Type: boolean, Default: true
247254
When enabled, automatically submits git tool success messages back to
248255
the LLM to continue the workflow.
249256

@@ -261,9 +268,13 @@ Buffer configuration:
261268
*buffer.auto_generate_delay* Type: number, Default: 200
262269
The delay in milliseconds before triggering automatic generation.
263270

271+
*buffer.skip_auto_generate_on_amend* Type: boolean, Default: true
272+
Skip auto-generation during git commit --amend operations.
273+
264274
==============================================================================
265275
8. LICENSE *codecompanion-gitcommit-license*
266276

267277
MIT License
268278

279+
==============================================================================
269280
vim:tw=78:ts=8:ft=help:norl:

0 commit comments

Comments
 (0)