Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e7b8a34
feat(gitcommit): add remote, fetch, pull support
jinzhongjia Dec 21, 2025
5996fe8
feat(gitcommit): add cherry-pick/merge abort/continue
jinzhongjia Dec 21, 2025
60a1f20
feat(gitcommit): add merge conflict detection
jinzhongjia Dec 21, 2025
9a9335b
refactor(gitcommit): flatten tool response structures
jinzhongjia Dec 21, 2025
daf9886
test(gitcommit): add comprehensive test suite
jinzhongjia Dec 21, 2025
b745a78
Merge branch 'main' into feat/git-remote
jinzhongjia Dec 21, 2025
e985f22
chore: add mise.toml with development tasks
jinzhongjia Dec 21, 2025
6e42609
chore: remove Makefile
jinzhongjia Dec 21, 2025
93cb3d8
fix(mise): add cross-platform support with run_windows
jinzhongjia Dec 21, 2025
540cf27
fix(mise): use pwsh for Windows shell commands
jinzhongjia Dec 21, 2025
ef9156b
refactor(gitcommit): extract utility functions
jinzhongjia Dec 21, 2025
c547a8e
test(git,ui): add unit tests for Git and UI modules
jinzhongjia Dec 21, 2025
88cb9cb
test(release-notes): add unit tests for prompts/release_notes.lua
jinzhongjia Dec 21, 2025
804ecc8
feat(config): add configuration validation with helpful error messages
jinzhongjia Dec 21, 2025
ba78aed
fix(gitcommit): resolve bugs found by Gemini code review
jinzhongjia Dec 21, 2025
f7e17e9
test(robustness): add comprehensive edge case and property tests
jinzhongjia Dec 21, 2025
36e69bf
refactor(gitcommit): address Gemini code review feedback
jinzhongjia Dec 22, 2025
37be0d9
chore: remove configuration example files
jinzhongjia Dec 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .styluaignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dependencies
deps/
18 changes: 13 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,23 @@ Same pattern as read operations, but in `git_edit.lua`. Remember:

## Testing & Development

### Running Style Checks
### Available Mise Tasks
```bash
stylua --check . # Check formatting (used in CI)
stylua . # Auto-fix formatting
mise run deps # Install test dependencies (mini.nvim)
mise run test # Run all unit tests
mise run test:file file=tests/test_validation.lua # Run specific test file
mise run lint # Check code formatting with stylua
mise run fmt # Format code with stylua
mise run doc # Download latest CodeCompanion documentation
```

### Available Make Commands
### Running Style Checks
```bash
make doc # Download latest CodeCompanion documentation
stylua --check . # Check formatting (used in CI)
stylua . # Auto-fix formatting
# Or via mise:
mise run lint # Check formatting
mise run fmt # Auto-fix formatting
```

### Development Setup
Expand Down
32 changes: 0 additions & 32 deletions Makefile

This file was deleted.

51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ A Neovim plugin extension for CodeCompanion that generates AI-powered Git commit
- 📚 **Commit History Context** - Use recent commit history to maintain consistent styling and patterns
- 🔌 **Programmatic API** - Full API for external integrations and custom workflows
- ⚡ **Async Operations** - Non-blocking Git operations with proper error handling
- 🛡️ **Config Validation** - Automatic validation of configuration options with helpful error messages

## 📦 Installation

Expand Down Expand Up @@ -278,6 +279,56 @@ The AI will analyze your commits to:
- **Repository validation** ensures operations in valid Git repositories
- **Comprehensive error handling** with helpful error messages

## 🛡️ Configuration Validation

The extension automatically validates your configuration options at startup and provides helpful feedback:

### Validation Types

| Type | Behavior |
|------|----------|
| **Type errors** | Warns when a config option has the wrong type (e.g., string instead of boolean) |
| **Unknown options** | Warns about typos or unsupported configuration options |
| **Nested validation** | Validates nested options like `buffer.enabled`, `buffer.keymap`, etc. |

### Example Output

If you have configuration errors, you'll see helpful messages:

```
[codecompanion-gitcommit] config.adapter: expected string (optional), got number
[codecompanion-gitcommit] config.languges: unknown configuration option
[codecompanion-gitcommit] config.buffer.enabled: expected boolean (optional), got string
```

### Validation Behavior

- **Non-blocking**: Invalid config produces warnings but doesn't prevent the extension from loading
- **Helpful messages**: Each message includes the field path and expected type
- **Typo detection**: Unknown fields are flagged as warnings to help catch typos

### Programmatic Validation

You can also validate configuration programmatically:

```lua
local ConfigValidation = require("codecompanion._extensions.gitcommit.config_validation")

-- Validate custom options
local result = ConfigValidation.validate({
adapter = "openai",
buffer = { enabled = true },
})

if result.valid then
print("Config is valid!")
else
for _, issue in ipairs(result.issues) do
print(issue.field .. ": " .. issue.message)
end
end
```

## 📄 License

MIT License
51 changes: 51 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- 📚 **提交历史上下文** - 使用最近的提交历史来保持一致的风格和模式
- 🔌 **编程 API** - 为外部集成和自定义工作流提供完整的 API
- ⚡ **异步操作** - 非阻塞的 Git 操作,具有适当的错误处理
- 🛡️ **配置验证** - 自动验证配置选项,并提供有用的错误信息

## 📦 安装

Expand Down Expand Up @@ -278,6 +279,56 @@ AI 将分析你的提交以:
- **仓库验证**确保操作在有效的 Git 仓库中进行
- **全面的错误处理**提供有用的错误信息

## 🛡️ 配置验证

扩展会在启动时自动验证配置选项,并提供有用的反馈:

### 验证类型

| 类型 | 行为 |
|------|----------|
| **类型错误** | 当配置选项类型错误时警告(例如,应为布尔值却传了字符串) |
| **未知选项** | 警告拼写错误或不支持的配置选项 |
| **嵌套验证** | 验证嵌套选项如 `buffer.enabled`、`buffer.keymap` 等 |

### 输出示例

如果配置有错误,你会看到有用的提示信息:

```
[codecompanion-gitcommit] config.adapter: expected string (optional), got number
[codecompanion-gitcommit] config.languges: unknown configuration option
[codecompanion-gitcommit] config.buffer.enabled: expected boolean (optional), got string
```

### 验证行为

- **非阻塞**:无效配置会产生警告,但不会阻止扩展加载
- **有用的信息**:每条信息包含字段路径和预期类型
- **拼写检测**:未知字段会被标记为警告,帮助发现拼写错误

### 编程式验证

你也可以通过编程方式验证配置:

```lua
local ConfigValidation = require("codecompanion._extensions.gitcommit.config_validation")

-- 验证自定义选项
local result = ConfigValidation.validate({
adapter = "openai",
buffer = { enabled = true },
})

if result.valid then
print("配置有效!")
else
for _, issue in ipairs(result.issues) do
print(issue.field .. ": " .. issue.message)
end
end
```

## 📄 许可证

MIT 许可证
48 changes: 0 additions & 48 deletions config_example.lua

This file was deleted.

64 changes: 0 additions & 64 deletions config_example_with_history.lua

This file was deleted.

1 change: 1 addition & 0 deletions deps/mini.nvim
Submodule mini.nvim added at 6acb62
Loading
Loading