Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

Commit d4b975c

Browse files
committed
docs(gitcommit): update docs and config for new gitignore and commit selector features
- remove "🆕" and v2.0 markers from documentation and config comments - add documentation for gitignore management commands and workflows - introduce `gitcommit_select_count` option for commit selector in README, config, and docs - update language lists to use English names (e.g., "Chinese" instead of "简体中文") - clarify and expand git tool and chat integration documentation - update config examples to reflect new options and naming conventions
1 parent 69eef7a commit d4b975c

3 files changed

Lines changed: 78 additions & 30 deletions

File tree

README.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CodeCompanion Git Commit Extension
22

3-
### `tools/git.lua` (🆕)
3+
### `tools/git.lua`
44

55
Core git operations engine:
66

@@ -13,7 +13,7 @@ Core git operations engine:
1313
- Repository insights (contributors, remotes, commit search)
1414
- Reset operations with safety checks
1515

16-
### `tools/git_bot.lua` (🆕)
16+
### `tools/git_bot.lua`
1717

1818
CodeCompanion chat tool integration:
1919

@@ -39,7 +39,7 @@ A CodeCompanion extension that generates AI-powered git commit messages followin
3939
- 🔄 Support for both regular commits and `git commit --amend`
4040
- 📁 File filtering support with glob patterns to exclude files from diff analysis
4141

42-
### Git Tool Features (🆕 v2.0)
42+
### Git Tool Features
4343
- 🛠️ **@git_bot tool** - Advanced Git operations through CodeCompanion chat
4444
- 📊 **Git status and branch management** - Check status, create/switch branches
4545
- 🔍 **Advanced Git operations** - Diff, log, blame, stash operations
@@ -63,10 +63,11 @@ require("codecompanion").setup({
6363
add_slash_command = true, -- Optional: adds /gitcommit slash command
6464
adapter = "openai", -- Optional: specify LLM adapter (defaults to codecompanion chat adapter)
6565
model = "gpt-4", -- Optional: specify model (defaults to codecompanion chat model)
66-
languages = { "English", "简体中文", "日本語", "Français", "Español" }, -- Optional: list of languages for commit messages
66+
languages = { "English", "Chinese", "Japanese", "French", "Spanish" }, -- Optional: list of languages for commit messages
6767
exclude_files = { "*.pb.go", "*.min.js", "package-lock.json" }, -- Optional: exclude files from diff analysis
68-
add_git_tool = true, -- Optional: add @git_bot tool to CodeCompanion (default: true)
69-
add_git_commands = true, -- Optional: add :CodeCompanionGit commands (default: true)
68+
add_git_tool = true, -- Optional: add @git_bot tool to CodeCompanion (default: true)
69+
add_git_commands = true, -- Optional: add :CodeCompanionGit commands (default: true)
70+
gitcommit_select_count = 100, -- Optional: number of recent commits for /gitcommit slash command (default: 100)
7071
buffer = {
7172
enabled = true, -- Enable gitcommit buffer keymaps
7273
keymap = "<leader>gc", -- Keymap for generating commit message in gitcommit buffer
@@ -85,9 +86,9 @@ require("codecompanion").setup({
8586

8687
- `:CodeCompanionGitCommit` - Generate git commit message
8788
- `:CCGitCommit` - Short alias for the above command
88-
- `:CodeCompanionGit` - Open CodeCompanion chat with git assistant (🆕)
89-
- `:CCGit` - Short alias for git assistant (🆕)
90-
### Git Tool Operations (🆕 v2.0)
89+
- `:CodeCompanionGit` - Open CodeCompanion chat with git assistant
90+
- `:CCGit` - Short alias for git assistant
91+
### Git Tool Operations
9192

9293
#### Interactive Git Assistant
9394

@@ -140,6 +141,13 @@ In any CodeCompanion chat buffer, use the `@git_bot` tool to perform Git operati
140141
**Advanced Operations** (require approval)
141142
- `@git_bot reset --commit_hash HASH [--mode soft|mixed|hard]` - Reset to commit
142143

144+
**GitIgnore Management**
145+
- `@git_bot gitignore_get` - View current .gitignore content
146+
- `@git_bot gitignore_add --gitignore_rule "RULE"` - Add rule to .gitignore
147+
- `@git_bot gitignore_add --gitignore_rules ["rule1", "rule2"]` - Add multiple rules
148+
- `@git_bot gitignore_remove --gitignore_rule "RULE"` - Remove rule from .gitignore
149+
- `@git_bot gitignore_check --gitignore_file "FILE"` - Check if file is ignored
150+
143151
#### Safety Features
144152

145153
The git tool includes automatic safety features:
@@ -173,6 +181,15 @@ The git tool includes automatic safety features:
173181
@git_bot blame --file_path src/main.lua --line_start 50 --line_end 60
174182
```
175183

184+
**GitIgnore Management Workflow:**
185+
```
186+
@git_bot gitignore_get # View current .gitignore
187+
@git_bot gitignore_add --gitignore_rule "*.log" # Add single rule
188+
@git_bot gitignore_add --gitignore_rules ["dist/", "build/", "*.tmp"] # Add multiple rules
189+
@git_bot gitignore_check --gitignore_file "temp.log" # Check if file is ignored
190+
@git_bot gitignore_remove --gitignore_rule "*.log" # Remove rule
191+
```
192+
176193
### GitCommit Buffer Integration
177194

178195
When you run `git commit` or open a gitcommit buffer:
@@ -220,7 +237,7 @@ local success = gitcommit.commit_changes("feat: add new feature")
220237
-- Get buffer configuration
221238
local buffer_config = gitcommit.get_buffer_config()
222239

223-
-- Git Tool API (🆕)
240+
-- Git Tool API
224241
-- Basic operations
225242
local success, output = gitcommit.git_tool.status()
226243
local success, branches = gitcommit.git_tool.branches()
@@ -267,7 +284,7 @@ lua/codecompanion/_extensions/gitcommit/
267284
├── buffer.lua # GitCommit buffer keymap integration
268285
├── langs.lua # Language selection functionality
269286
├── types.lua # Type definitions and TypeScript-style annotations
270-
└── tools/ # Git tool implementations (🆕)
287+
└── tools/ # Git tool implementations
271288
├── git.lua # Core git operations and command execution
272289
└── git_bot.lua # CodeCompanion chat tool integration
273290
```
@@ -335,7 +352,7 @@ Main extension coordinator:
335352
- Command registration (`:CodeCompanionGitCommit`, `:CCGitCommit`)
336353
- Slash command integration
337354
- Extension exports for programmatic usage
338-
- Git tool integration and command setup (🆕)
355+
- Git tool integration and command setup
339356

340357
## Requirements
341358

@@ -393,12 +410,13 @@ opts = {
393410
add_slash_command = true, -- Add /gitcommit slash command to chat buffer
394411
adapter = "openai", -- LLM adapter to use (default: codecompanion chat adapter)
395412
model = "gpt-4", -- Model to use (default: codecompanion chat model)
396-
languages = { "English", "简体中文", "日本語", "Français", "Español" }, -- Languages for commit messages
413+
languages = { "English", "Chinese", "Japanese", "French", "Spanish" }, -- Languages for commit messages
397414
exclude_files = { "*.pb.go", "*.min.js", "package-lock.json" }, -- File patterns to exclude from diff analysis
398415
add_git_tool = true, -- Add @git_bot tool to CodeCompanion (default: true)
399416
add_git_commands = true, -- Add :CodeCompanionGit commands (default: true)
400417
git_tool_auto_submit_errors = false, -- Auto-submit git tool errors to LLM (default: false)
401418
git_tool_auto_submit_success = false, -- Auto-submit git tool success to LLM (default: false)
419+
gitcommit_select_count = 100, -- Number of recent commits for /gitcommit slash command (default: 100)
402420
buffer = {
403421
enabled = true, -- Enable gitcommit buffer keymaps (default: true)
404422
keymap = "<leader>gc", -- Keymap for generating commit message (default: "<leader>gc")
@@ -429,6 +447,10 @@ When enabled, automatically submits git tool error messages back to the LLM for
429447
#### `git_tool_auto_submit_success` (boolean, default: `false`)
430448

431449
When enabled, automatically submits git tool success messages back to the LLM to continue the workflow.
450+
451+
#### `gitcommit_select_count` (number, default: `100`)
452+
453+
Number of recent commits to show when using the `/gitcommit` slash command. This controls how many commits are available for selection in the interactive commit selector.
432454
#### `adapter` (string, optional)
433455

434456
The LLM adapter to use for generating commit messages. If not specified, defaults to the adapter configured for CodeCompanion's chat strategy.
@@ -444,7 +466,7 @@ A list of languages that can be used for generating commit messages. When specif
444466
Example:
445467

446468
```lua
447-
languages = { "English", "简体中文", "日本語", "Français", "Español" }
469+
languages = { "English", "Chinese", "Japanese", "French", "Spanish" }
448470
```
449471

450472
#### `exclude_files` (table, optional)

config_example.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
-- CodeCompanion GitCommit Extension Configuration Example
2-
-- This file demonstrates how to configure the enhanced GitCommit extension with git tools
2+
-- This file demonstrates how to configure the GitCommit extension with git tools
33

44
return {
55
-- Basic configuration
66
adapter = "anthropic", -- or "openai", "copilot", etc.
77
model = "claude-3-5-sonnet-20241022",
88

99
-- Languages for commit message generation
10-
languages = { "English", "中文", "日本語", "Français" },
10+
languages = { "English", "Chinese", "Japanese", "French" },
1111

1212
-- Files to exclude from git diff (supports glob patterns)
1313
exclude_files = {
@@ -35,9 +35,10 @@ return {
3535
-- Enable slash command in chat buffer
3636
add_slash_command = true,
3737

38-
-- Git tool configuration (NEW)
38+
-- Git tool configuration
3939
add_git_tool = true, -- Add @git_bot tool to CodeCompanion
4040
add_git_commands = true, -- Add :CodeCompanionGit commands
4141
git_tool_auto_submit_errors = false, -- Don't auto-submit errors to LLM
4242
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
4344
}

doc/codecompanion-gitcommit.txt

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ to generate meaningful git commit messages following the Conventional Commits
2929
specification. It integrates seamlessly with CodeCompanion's LLM adapters to
3030
analyze your staged changes and create appropriate commit messages.
3131

32-
Version 2.0 introduces comprehensive Git operations through the @git_bot tool,
33-
providing a natural language interface for Git workflow management within
32+
The extension provides comprehensive Git operations through the @git_bot tool,
33+
offering a natural language interface for Git workflow management within
3434
CodeCompanion chat buffers.
3535

3636
==============================================================================
@@ -47,7 +47,7 @@ CodeCompanion chat buffers.
4747
• Support for both regular commits and `git commit --amend`
4848
• File filtering support with glob patterns to exclude files from analysis
4949

50-
### Git Tool Features (🆕 v2.0)
50+
### Git Tool Features
5151
• @git_bot tool - Advanced Git operations through CodeCompanion chat
5252
• Git status and branch management - Check status, create/switch branches
5353
• Advanced Git operations - Diff, log, blame, stash operations
@@ -73,6 +73,7 @@ Add this extension to your CodeCompanion configuration:
7373
exclude_files = { "*.pb.go", "*.min.js", "package-lock.json" }, -- Optional: exclude files from diff analysis
7474
add_git_tool = true, -- Optional: add @git_bot tool to CodeCompanion (default: true)
7575
add_git_commands = true, -- Optional: add :CodeCompanionGit commands (default: true)
76+
gitcommit_select_count = 100, -- Optional: number of recent commits for /gitcommit slash command (default: 100)
7677
buffer = {
7778
enabled = true, -- Enable gitcommit buffer keymaps
7879
keymap = "<leader>gc", -- Keymap for generating commit message
@@ -94,12 +95,13 @@ opts = {
9495
add_slash_command = false, -- Add /gitcommit slash command to chat buffer
9596
adapter = "openai", -- LLM adapter to use (optional)
9697
model = "gpt-4", -- Model to use (optional)
97-
languages = { "English", "简体中文", "日本語" }, -- Languages for commit messages (optional)
98+
languages = { "English", "Chinese", "Japanese" }, -- Languages for commit messages (optional)
9899
exclude_files = { "*.pb.go", "*.min.js", "package-lock.json" }, -- File patterns to exclude from diff analysis (optional)
99100
add_git_tool = true, -- Add @git_bot tool to CodeCompanion (default: true)
100101
add_git_commands = true, -- Add :CodeCompanionGit commands (default: true)
101102
git_tool_auto_submit_errors = false, -- Auto-submit git tool errors to LLM (default: false)
102103
git_tool_auto_submit_success = false, -- Auto-submit git tool success to LLM (default: false)
104+
gitcommit_select_count = 100, -- Number of recent commits to show in /gitcommit slash command (default: 100)
103105
buffer = {
104106
enabled = true, -- Enable gitcommit buffer keymaps
105107
keymap = "<leader>gc", -- Keymap for generating commit message
@@ -137,7 +139,7 @@ languages *gitcommit-languages*
137139
before generating the commit message. If not provided or empty,
138140
commit messages will be generated in English by default.
139141

140-
Example: { "English", "简体中文", "日本語", "Français" }
142+
Example: { "English", "Chinese", "Japanese", "French" }
141143

142144
exclude_files *gitcommit-exclude-files*
143145
Type: table
@@ -176,6 +178,13 @@ git_tool_auto_submit_success *gitcommit-git-tool-auto-submit-success*
176178
When enabled, automatically submits git tool success messages back to
177179
the LLM to continue the workflow.
178180

181+
gitcommit_select_count *gitcommit-gitcommit-select-count*
182+
Type: number
183+
Default: 100
184+
Number of recent commits to show when using the /gitcommit slash command.
185+
This controls how many commits are available for selection in the
186+
interactive commit selector.
187+
179188
buffer.enabled *gitcommit-buffer-enabled*
180189
Type: boolean
181190
Default: true
@@ -216,8 +225,8 @@ Use the provided commands to generate commit messages:
216225
|:CCGitCommit| - Short alias for the above command
217226

218227
Use the provided commands for git operations:
219-
|:CodeCompanionGit| - Open CodeCompanion chat with git assistant (🆕)
220-
|:CCGit| - Short alias for git assistant (🆕)
228+
|:CodeCompanionGit| - Open CodeCompanion chat with git assistant
229+
|:CCGit| - Short alias for git assistant
221230

222231
5.2 GitCommit Buffer Integration *codecompanion-gitcommit-buffer*
223232

@@ -349,7 +358,7 @@ language commands within CodeCompanion chat buffers.
349358
7.1 Interactive Git Assistant *codecompanion-gitcommit-git-assistant*
350359

351360
Use |:CodeCompanionGit| or |:CCGit| to open a CodeCompanion chat buffer with
352-
the `@git_bot` tool pre-loaded. This gives you a natural language interface
361+
the `@git_bot` tool pre-loaded. This provides a natural language interface
353362
to Git operations.
354363

355364
7.2 Chat Integration *codecompanion-gitcommit-chat-integration*
@@ -399,6 +408,13 @@ Stash Operations~
399408
Advanced Operations~ (require approval)
400409
• `@git_bot reset --commit_hash HASH [--mode soft|mixed|hard]` - Reset to commit
401410

411+
GitIgnore Management~
412+
• `@git_bot gitignore_get` - View current .gitignore content
413+
• `@git_bot gitignore_add --gitignore_rule "RULE"` - Add rule to .gitignore
414+
• `@git_bot gitignore_add --gitignore_rules ["rule1", "rule2"]` - Add multiple rules
415+
• `@git_bot gitignore_remove --gitignore_rule "RULE"` - Remove rule from .gitignore
416+
• `@git_bot gitignore_check --gitignore_file "FILE"` - Check if file is ignored
417+
402418
7.4 Safety Features *codecompanion-gitcommit-safety*
403419

404420
The git tool includes automatic safety features:
@@ -432,6 +448,15 @@ Investigation Workflow:~
432448
@git_bot blame --file_path src/main.lua --line_start 50 --line_end 60
433449
<
434450

451+
GitIgnore Management Workflow:~
452+
>
453+
@git_bot gitignore_get # View current .gitignore
454+
@git_bot gitignore_add --gitignore_rule "*.log" # Add single rule
455+
@git_bot gitignore_add --gitignore_rules ["dist/", "build/", "*.tmp"] # Add multiple rules
456+
@git_bot gitignore_check --gitignore_file "temp.log" # Check if file is ignored
457+
@git_bot gitignore_remove --gitignore_rule "*.log" # Remove rule
458+
<
459+
435460
==============================================================================
436461
8. API *codecompanion-gitcommit-api*
437462

@@ -451,7 +476,7 @@ gitcommit.generate({lang}, {callback}) *gitcommit.generate()*
451476
local gitcommit = require("codecompanion").extensions.gitcommit
452477

453478
-- Generate with specific language
454-
gitcommit.generate("简体中文", function(result, error)
479+
gitcommit.generate("Chinese", function(result, error)
455480
if error then
456481
print("Error:", error)
457482
else
@@ -496,7 +521,7 @@ gitcommit.get_buffer_config() *gitcommit.get_buffer_config()*
496521
Returns:~
497522
table: Configuration table with buffer settings
498523

499-
Git Tool API (🆕) *gitcommit.git_tool_api()*
524+
Git Tool API *gitcommit.git_tool_api()*
500525
Access to git tool functions for programmatic usage.
501526

502527
gitcommit.git_tool.status() *gitcommit.git_tool.status()*
@@ -584,7 +609,7 @@ lua/codecompanion/_extensions/gitcommit/
584609
├── buffer.lua # GitCommit buffer keymap integration
585610
├── langs.lua # Language selection functionality
586611
├── types.lua # Type definitions and TypeScript-style annotations
587-
└── tools/ # Git tool implementations (🆕)
612+
└── tools/ # Git tool implementations
588613
├── git.lua # Core git operations and command execution
589614
└── git_bot.lua # CodeCompanion chat tool integration
590615

@@ -626,15 +651,15 @@ init.lua~
626651
extension exports for programmatic usage. Also manages git tool
627652
integration and command setup.
628653

629-
tools/git.lua~ (🆕)
654+
tools/git.lua~
630655
Core git operations engine providing safe git command execution with
631656
error handling, repository validation and detection, git status, log,
632657
diff, and branch operations, file staging/unstaging and blame information,
633658
stash management and commit operations, branch creation, checkout, and
634659
management, repository insights (contributors, remotes, commit search),
635660
and reset operations with safety checks.
636661

637-
tools/git_bot.lua~ (🆕)
662+
tools/git_bot.lua~
638663
CodeCompanion chat tool integration providing OpenAI-compatible function
639664
calling schema, natural language interface for git operations, comprehensive
640665
parameter validation and handling, formatted output for chat buffer display,

0 commit comments

Comments
 (0)