Skip to content

Repository files navigation

AI Gen Commit

✨ One click in the Source Control panel → an AI-generated Conventional Commits message, in any language you choose, powered by your own OpenAI-compatible API (DeepSeek, Qwen, Kimi, Ollama, OpenRouter, corporate gateways…). No Copilot, no quota, your data goes only to the endpoint you configure.

English | 简体中文

AI Gen Commit demo

Why

  • Copilot's "Generate Commit Message" breaks with custom instructions. Since late July 2026, setting github.copilot.chat.commitMessageGeneration.instructions (e.g. to get non-English messages) makes the Copilot backend reject every request as prompt injection — 422 promptFiltered, the button silently does nothing (microsoft/vscode#327959). Free/student plans can't work around it via model selection.
  • Language choice. Copilot generates English only (unless you use the very instructions that trigger the bug above). Here, one language setting: 简体中文, 日本語, Français — any language name works.
  • No lock-in. Uses no Copilot quota, needs no GitKraken account, works with any OpenAI-compatible endpoint including a local Ollama.

Quick start

  1. Install the extension.
  2. Open Settings (Ctrl+, / ⌘,), search aiGenCommit, fill in:
"aiGenCommit.apiUrl": "https://api.deepseek.com/chat/completions",
"aiGenCommit.apiKey": "sk-your-key",
"aiGenCommit.model": "deepseek-chat",
"aiGenCommit.language": "English" // or 简体中文 / 日本語 / …
  1. Make some changes, click the gold ✨ icon in the Source Control panel title bar (or run "Generate Commit Message with AI"). The message lands in the commit input box. Staged changes are used when present, otherwise the whole working tree.

Local Ollama: "aiGenCommit.apiUrl": "http://localhost:11434/v1/chat/completions", leave the key empty.

Settings

Setting Default Description
aiGenCommit.apiUrl Full URL of an OpenAI-compatible endpoint (including /chat/completions)
aiGenCommit.apiKey Sent as Authorization: Bearer <key>; empty = header omitted
aiGenCommit.model Model name; empty if your gateway doesn't need one
aiGenCommit.language English Output language of the commit message, any language name
aiGenCommit.customInstructions [] Extra rules appended to the prompt, e.g. "Keep the title under 50 chars", "Title only, no body"
aiGenCommit.systemPromptOverride Advanced: fully replaces the built-in prompt when non-empty
aiGenCommit.maxDiffChars 50000 Diff longer than this is truncated before sending

FAQ

Where is the button? In the Source Control panel title bar — the gold ✨ (colored on purpose so it stands out among the monochrome icons), not inside the input box: that inner spot is reserved for VS Code's built-in AI.

Where are the logs? Output panel → "AI Gen Commit" channel: full request/response details.

Is my key safe? It's stored in plain text in your local settings.json and only ever sent to the apiUrl you configured. Prefer a revocable low-quota key, and mind Settings Sync.

Does it upload my code? The changed-file list and the diff are sent to your configured endpoint — nowhere else. For company code, use an endpoint your company allows.


简体中文

在源代码管理面板加一个 ✨ 按钮,调用你自己的 OpenAI 兼容 API,一键生成 Conventional Commits 提交信息,语言随你设置(中文、English、日本語……),结果直接填进提交输入框。

解决什么问题

1. Copilot「生成提交信息」的 422 bug。 2026 年 7 月底起,只要配置了 github.copilot.chat.commitMessageGeneration.instructions 自定义指令(比如要求生成中文),Copilot 服务端就会把请求误判为 prompt 注入,返回 422 promptFiltered,按钮点了毫无反应(microsoft/vscode#327959)。Free / 学生套餐还无法通过指定模型绕过。

2. 提交信息的语言。 Copilot 默认只生成英文,想要中文只能靠上面那个会触发 bug 的自定义指令,等于死锁。本扩展一个 language 设置搞定,任意语言都行。

3. 额度与账号束缚。 Copilot 生成消耗 Chat 额度;GitLens 的 AI 生成要求登录 GitKraken 账号。本扩展用你自己的 API,DeepSeek、通义千问、Kimi、智谱、OpenRouter、本地 Ollama、公司网关都可以,数据只流向你配置的地址。

快速开始

  1. 安装扩展;
  2. 打开设置(⌘,)搜索 aiGenCommit,填入:
"aiGenCommit.apiUrl": "https://api.deepseek.com/chat/completions",
"aiGenCommit.apiKey": "sk-你的key",
"aiGenCommit.model": "deepseek-chat",
"aiGenCommit.language": "简体中文"
  1. 改完代码,点源代码管理面板右上角标题栏金色 ✨ 图标(或命令面板执行「AI 生成提交信息」)。有暂存改动时基于暂存区生成,否则基于工作区全部改动。

定制

  • 语言aiGenCommit.language,如 简体中文繁體中文日本語English
  • 追加规则aiGenCommit.customInstructions(数组,每条一行),如 "标题不超过 50 个字符""只要标题不要正文""scope 用小写英文"
  • 完全自定义aiGenCommit.systemPromptOverride 非空时整体替换内置提示词,格式完全自己说了算。

常见问题

按钮在哪? 源代码管理面板右上角标题栏的金色 ✨——特意做成彩色,在一排灰色图标里一眼就能认出来;不在输入框内部,输入框内的位置是 VS Code 保留给内置 AI 的,第三方扩展进不去。

出错了去哪看? 输出面板 → 「AI Gen Commit」频道,有完整请求与响应日志。

API Key 安全吗? 明文保存在你本机 settings.json,只会发给你自己填的 apiUrl。建议用可随时吊销的低额度 Key,并留意 VS Code 设置同步。

会上传我的代码吗? 生成时会把变更文件列表和 diff 发送到你配置的 API 地址(仅此一处)。公司代码请使用公司允许的接口。

原理

点击按钮 → 通过 VS Code 内置 Git 扩展 API 读取 git diff → 拼上提示词 POST 到你的 API → 把返回的消息写入提交输入框(repository.inputBox.value)。单文件约 250 行,零依赖。

License

MIT

About

VS Code extension: generate commit messages in any language with your own OpenAI-compatible API (DeepSeek/Qwen/Kimi/Ollama). 用自有 API 生成任意语言的 Conventional Commits 提交信息

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages