Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>AI Commit by daysvNew to Visual Studio Code? Get it now.
AI Commit by daysv

AI Commit by daysv

days_v

| (1) | Free
One-click AI commit messages in the Git (Source Control) panel: analyzes your staged changes and the repository's commit style, calls a configurable LLM, and fills a spec-compliant commit message into the input box.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AI Commit by daysv

One-click AI commit messages in the Git panel — generated from your staged changes, following your repository's own commit conventions.

GitHub stars Version License

AI Commit adds a ✨ button above the commit input box in the Source Control (Git) panel. One click: it analyzes your staged diff plus recent commit history, asks a configurable LLM (any OpenAI-compatible Chat Completions endpoint) for a commit message that mimics your repo's existing style — then fills it straight into the input box.


✨ English (EN)

Features

  • ✨ scm/title button (near the Commit input box) + AI Commit: Generate Commit Message command.
  • Follows your repo's conventions: reads recent history, infers prefix style (feat:/fix:/…), language, single-line vs. body, and imitates it.
  • Only your diff is sent — never whole file contents. Untracked files appear as names only.
  • Streaming by default: text is typed into the input box in real time (auto-falls back to one-shot if the server has no SSE).
  • Broad gateway/model compatibility with automatic fallbacks (see below).
  • Fast: configurable historyCount (0 = fastest, style-hint only) and smart diff trimming (maxDiffChars).
  • i18n: UI and settings are available in English and Simplified Chinese, switched automatically by your VS Code display language.

Install

  • From the marketplace or by packaging: vsce package → code --install-extension vscode-ai-commit-*.vsix --force, then reload the window.

Usage

  1. Open the Source Control view of a Git repo with staged changes.
  2. Click the ✨ button (or run AI Commit: Generate Commit Message).
  3. If nothing is staged, choose Stage all & generate or generate from unstaged changes.
  4. The generated message appears in the commit input box — review and adjust it freely.

Configuration (aiCommit.*)

Setting Meaning Default
baseUrl OpenAI-compatible Chat Completions base URL (e.g. https://api.openai.com/v1, https://api.deepseek.com, DashScope compatible-mode, http://127.0.0.1:11434/v1 for Ollama) https://api.openai.com/v1
apiKey API key; falls back to AICOMMIT_API_KEY / OPENAI_API_KEY env vars; leave empty for local servers ""
model Model name, e.g. gpt-4o-mini, deepseek-chat, qwen-plus gpt-4o-mini
historyCount Recent commit samples sent to the model (compressed). 0 = fastest mode, style-hint only 8
maxDiffChars Diff size cap; smart trim keeps smaller files whole 30000
language auto (imitate history) / zh / en auto
extraInstructions Extra prompt rules (ticket numbers, forbidden words…) ""
requestTimeoutMs Request timeout 120000
stream Stream into the input box while generating true
disableThinking Try to turn off deep thinking for reasoning models (Qwen3/DeepSeek-R1…), tries common parameter variants automatically false
extraBody Extra JSON body parameters for gateway-specific flags (e.g. {"enable_thinking": false}); rejected params are auto-dropped and retried ""
maxTokens Max output tokens (reasoning models need headroom for “thinking”) 4096

Reasoning models & “deep thinking”

Qwen3 / DeepSeek-R1 style models may first emit a long reasoning_content, which can make replies slow — or even leave content empty when maxTokens is too small. The extension:

  1. detects “only thinking, no answer” and auto-retries without the token cap (and shows “Model is thinking…” while streaming);
  2. can disable thinking: enable aiCommit.disableThinking, or set the exact parameter your gateway needs via aiCommit.extraBody;
  3. keeps working with plain models — every fallback is opt-in/opt-out safe and never changes requests for normal models.

Gateway/model compatibility (automatic fallbacks)

  • Streaming not supported / ignored → retry as one-shot.
  • max_tokens (or other params) rejected → drop the offending parameter and retry once.
  • enable_thinking/reasoning_effort rejected → try the next common variant.
  • Content inside 200-with-error / array content / NDJSON rows (Ollama) / old text fields → parsed.
  • Empty or unparseable response → the error dialog includes the HTTP status, Content-Type and a response snippet so you can adapt or report it.

Privacy

Only diffs of the changes being committed plus lightweight history samples are sent to the model (see maxDiffChars); full file contents are never read. Your API key never leaves your machine — it is read from settings/env only at request time. HTTP keep-alive connections are released on extension deactivate.

Development & tests

npm test            # unit tests (git porcelain/diff/style/HTTP/streaming/i18n …)
node --check extension.js && node --check utils.js

E2E runs in a real VS Code extension host against a local mock AI server (test/e2e.js, launched via the repo's test harness scripts).

Publishing to the Marketplace

Repo: https://github.com/daysv/vscode-ai-commit (branch main). CI workflows in .github/workflows/ run tests on push/PR and publish a tagged release automatically.

Before your first vsce publish:

  1. Register a VS Marketplace publisher at https://marketplace.visualstudio.com/manage and replace "publisher": "local" in package.json with your publisher id (e.g. daysv).
  2. Update the extension id in the localizations[0].translations[0].id field to yourpublisher.daysv-ai-commit.
  3. Create a Personal Access Token with Marketplace Manage scope and either run vsce login <publisher>, or export VSCE_PAT and add it as a GitHub secret (Settings → Secrets → Actions → VSCE_PAT) for the release workflow.
  4. Tag a release:
    git tag v1.0.0 && git push origin v1.0.0
    
    or publish manually: npx @vscode/vsce publish (npx @vscode/vsce publish patch for patches).

npx @vscode/vsce package and npx @vscode/vsce ls are handy pre-flight checks. Generated *.vsix files are git-ignored.

License

MIT — see LICENSE.


中文说明

简介

AI Commit 在 Git「源代码管理」面板的提交输入框上方加一个 ✨ 按钮:一键分析已暂存(staged)的 diff 与仓库最近提交历史,调用你配置的大模型(任意 OpenAI 兼容 Chat Completions 服务),严格模仿仓库既有提交规范生成提交信息并填入输入框。

特性

  • SCM 面板 ✨ 按钮 + 命令 AI Commit: Generate Commit Message;
  • 风格跟随:自动从历史归纳 conventional 前缀、语言、标题/正文习惯并模仿;
  • 只发差异、绝不发整文件:未跟踪的新文件只以文件名出现;
  • 默认流式:文字边生成边实时填入(服务端不支持 SSE 时自动一次性回退);
  • 广泛兼容各类网关/模型,自动回退不报错(详见下);
  • 快:historyCount=0 最快模式、超限 diff 智能裁剪(maxDiffChars);
  • i18n:界面与设置中英双语,随 VS Code 界面语言自动切换。

使用

  1. 打开某 Git 仓库的「源代码管理」视图并已暂存改动;
  2. 点击 ✨(或命令面板执行生成提交信息);
  3. 若未暂存任何改动,可选择“全部暂存并生成”或“仅基于未暂存改动生成”;
  4. 生成结果自动填入提交输入框,可自行修改后提交。

主要配置(aiCommit.*)

设置 说明 默认
baseUrl OpenAI 兼容 Chat Completions 地址(OpenAI / DeepSeek / DashScope compatible-mode / Ollama http://127.0.0.1:11434/v1 等) https://api.openai.com/v1
apiKey API Key;留空依次读 AICOMMIT_API_KEY、OPENAI_API_KEY;本地服务可留空 ""
model 模型名,如 gpt-4o-mini、deepseek-chat、qwen-plus gpt-4o-mini
historyCount 发给模型的历史样本条数(轻量压缩);0 = 最快模式只发风格提示 8
maxDiffChars diff 大小上限;超限按文件粒度智能裁剪 30000
language 生成语言:auto(模仿历史)/ zh / en auto
extraInstructions 附加指令(单号规则、禁用词等) ""
requestTimeoutMs 请求超时(毫秒) 120000
stream 流式生成实时填入输入框 true
disableThinking 尝试关闭深度思考/推理(自动尝试多种常见参数写法) false
extraBody 附加 JSON 请求参数(网关专属写法);被拒参数自动剔除重试 ""
maxTokens 最大输出 token(推理模型需给“思考”留预算) 4096

推理模型与深度思考

Qwen3 / DeepSeek-R1 系会先输出 reasoning_content(思考)。扩展会:识别“只思考、未答复”并自动去掉 token 上限重试(流式时提示“模型思考中…”);需要时可用 aiCommit.disableThinking 或 aiCommit.extraBody 关闭思考;普通模型完全不受影响。

隐私

只发送待提交改动的 diff 与轻量历史样本(上限 maxDiffChars),从不读取整文件内容;API Key 仅请求时从设置/环境变量读取,不落盘;停用扩展时释放 keep-alive 连接。

开发与测试

npm test                       # 单元测试(git/风格/HTTP/流式/i18n 等)
vsce package && vsce ls        # 打包预检

E2E:在真实 VS Code 扩展宿主 + 本地 mock AI 服务中跑通「点击生成 → 输入框写入」全链路。

发布到 VS Code 扩展商城

仓库:**https://github.com/daysv/vscode-ai-commit**(分支 main)。.github/workflows/ 内含 CI(push/PR 跑测试)与 tag 自动发布工作流。

首次 vsce publish 前:

  1. 在 https://marketplace.visualstudio.com/manage 注册 publisher,并把 package.json 的 "publisher": "local" 换成你的 publisher id(例如 daysv);
  2. 同步修改 localizations[0].translations[0].id 为 你的publisher.daysv-ai-commit;
  3. 创建带 Marketplace Manage 权限的 PAT:本地用 vsce login <publisher>,或导出 VSCE_PAT 并加入 GitHub Actions Secrets(Settings → Secrets → Actions → VSCE_PAT)以启用自动发布;
  4. 打 tag 触发发布:git tag v1.0.0 && git push origin v1.0.0;或手动 npx @vscode/vsce publish(补丁 ... publish patch)。

打包预检用 npx @vscode/vsce package / npx @vscode/vsce ls。生成的 *.vsix 已加入 .gitignore。

许可证

MIT,见 LICENSE。

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft