@andre-barbosa/opencode-commitOpenCode plugin that generates Conventional Commit messages and split commit plans via /commit using a configured model
0
82
近 7 天 22
28.5
生态多维模型
2 个月前
2026-06-15
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@andre-barbosa/opencode-commit@0.1.9"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@andre-barbosa/opencode-commit@0.1.9"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @andre-barbosa/opencode-commitopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode plugin that generates Conventional Commits messages or split commit plans from uncommitted git changes using a model you choose.
Run /commit in the OpenCode TUI to get a suggested message like feat(auth): add oauth login flow — copy it and commit manually.
Features
/commitslash command (suggest only, no auto-commit)- Copy the generated message or plan to the system clipboard from the result dialog
- Request a fresh suggestion with the same input
- Split commit planning with
/commit splitand/commit split <folder...> - Dedicated model for commit message generation
- Conventional Commits format enforced (
feat(scope): ...,fix(scope): ..., etc.) - Optional hint:
/commit emphasize breaking API change - Uses staged diffs, unstaged diffs, non-ignored untracked filenames, branch name, and recent commit subjects for context
Requirements
- OpenCode with plugin support
- A git repository with uncommitted changes
Installation
Configure the plugin
Local development (this repo):
Build the plugin first:
npm run build
Create or edit .opencode/tui.json (or a top-level tui.json) in the project where you want to use /commit:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": [
[
"file:///C:/absolute/path/to/opencode-commit",
{
"model": "opencode-go/deepseek-v4-flash",
"maxDiffChars": 12000
}
]
]
}
From npm:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": [
["@andre-barbosa/opencode-commit", { "model": "opencode-go/deepseek-v4-flash" }]
]
}
See tui.example.json for a full example.
Run opencode models to list available models.
Restart OpenCode after editing config.
When testing local changes, run npm run build again before restarting OpenCode.
/commit is a TUI slash command. Invoke it from the command palette (Ctrl+Shift+P) or by typing / in the prompt and selecting commit. You can then enter an optional hint or split [folder...].
Usage
- Make changes in a git repository. Staging is optional.
- Open OpenCode in the project.
- Run the commit slash command (
/commit). - Choose an action from the result dialog:
- Copy message to clipboard
- Request new message to generate another suggestion
- Close
- Paste the copied message into
git commit -m "feat(scope): ...".
Optional extra instruction:
Run /commit, then enter:
focus on test coverage improvements
Split commit planning:
Run /commit, then enter:
split
This suggests one commit message per changed top-level folder. Files in the repo root are grouped under root.
split apps/web packages/api
This suggests one commit message for each requested folder with changes under that path.
Split mode only suggests a plan. It does not stage files and does not create commits. You can copy the plan to the clipboard or request a new plan from the result dialog.
Plugin options
When loading the plugin as a tuple [name, options]:
| Option | Default | Description |
|---|---|---|
model |
required | Model to use in provider/model-id format |
maxDiffChars |
12000 |
Max tracked diff characters sent across staged and unstaged diffs |
Change scope
/commit analyzes:
- Staged tracked changes from
git diff --staged - Unstaged tracked changes from
git diff - Changed-file metadata from
git diff --name-status - Non-ignored untracked filenames from
git ls-files --others --exclude-standard
It does not read untracked file contents and does not ask Git for ignored files.
Commit message format
Generated messages follow Conventional Commits:
type(scope): short imperative description
- optional bullet body
Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore.
Project layout
opencode-commit/
├── src/ # plugin source
│ ├── tui.ts # TUI slash command and result actions
│ ├── clipboard.ts # system clipboard helper
│ └── index.ts # server no-op entrypoint
├── tui.example.json # example TUI plugin config
└── README.md
License
MIT