V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
handsomebro
V2EX  ›  分享创造

写了一个 VS Code 插件:极简 AI 自动生成 Commit Message,支持自定义 OpenAI 兼容接口

  •  
  •   handsomebro · 1 天前 · 455 次点击

    大家好,

    主要想分享一个刚刚肝出来的 VS Code 插件:WTF Commit

    起因: 最近想找个 VS Code 插件来自动生成 Git Commit Message 。试了好几个热门插件,发现大多数都有几个问题:

    1. 太重了:很多都要在侧边栏占个位置,或者强行绑定一堆我不用的功能。
    2. 模型支持有限:我想用 DeepSeek 或者 Moonshot (Kimi) 这种便宜又好用的国产模型,但很多插件只写死了 OpenAI 或 Anthropic ,不支持自定义 Base URL ,或者配置起来非常麻烦。

    本来想给某个开源插件提 PR 增加自定义功能,结果发现老代码改起来太痛苦,各种依赖报错。一气之下,决定遵循“奥卡姆剃刀”原则,从零开发一个只做这一件事的极简插件。

    核心功能 & 特点:

    • 极致简约:没有侧边栏 Webview ,入口直接集成在 Source Control 面板的标题栏(一个小星星图标 ✨)。
    • 模型自由:内置了 DeepSeek / Moonshot (Kimi) / 智谱 GLM 的预设,同时也支持 Custom 模式。只要是兼容 OpenAI 格式的接口(包括本地的 Ollama )都能用。
    • 安全第一:API Key 不会明文存在 settings.json 里,而是走 VS Code 原生的 SecretStorage 安全存储。
    • 懒人模式:支持配置快捷键(默认 Cmd+Opt+G),可选开启 Auto CommitAuto Push。按一下,直接生成 -> 提交 -> 推送一条龙。

    插件名字由来: 起名废,写代码时就在想 "What The F**k should I name this commit?",于是就叫 WTF Commit 了。希望它能帮你解决写 Commit 时的抓狂。

    链接:

    代码完全开源,基于 TypeScript 开发,目前非常轻量。如果你也有类似的需求,欢迎试用,也欢迎提 Issue 或 PR !

    8 条回复    2026-01-13 18:43:38 +08:00
    jeffw
        1
    jeffw  
       1 天前
    vscode 不是自带这个功能吗?
    ewiglicht
        2
    ewiglicht  
       1 天前
    @jeffw 这其实是 copilot 的功能。不过确实 copilot 基本是 vscode 的标配了。
    aarontian
        3
    aarontian  
       1 天前
    @jeffw 自带的要付费吧
    aarontian
        4
    aarontian  
       1 天前
    能配置 commit message 风格提示词吗,我之前在用一个能配的,不过只支持 Anthropic
    handsomebro
        5
    handsomebro  
    OP
       1 天前
    @aarontian 支持自定义 SYSTEM PROMPT ,也就是你说的:commit message 风格提示词
    handsomebro
        6
    handsomebro  
    OP
       1 天前
    @jeffw 之前一直在 GitHub Desktop 上使用,但免费版有次数限制,而且不支持自定义语言(中文)。
    jukanntenn
        7
    jukanntenn  
       8 小时 3 分钟前
    我添加了 GLM 的 key ,依然提示错误:OpenAI key not set
    jukanntenn
        8
    jukanntenn  
       7 小时 55 分钟前
    好像 custom 有些 bug ,我接入英伟达的接口,模型 minimax2.1 ,返回的结果:

    ```
    <think>The changes are:
    1. In `src/pool.rs`:
    - Added `use log::error;` import
    - Changed two `self.ticks.update(...)` calls from using the try operator (`?`) to using `match` expressions that log an error and return the error if one occurs.

    2. In `src/quoter.rs`:
    - Added `use log::error;` import
    - Changed the `pool.get_output_amount(...)` call from using the try operator (`?`) to using a `match` expression that logs an error and returns the error if one occurs.

    The changes are about error handling and logging. They are making the error handling more explicit by logging errors before returning them.

    The most significant change is the addition of error logging in both files. This is a fix in the sense that it improves error reporting, but it doesn't fix a bug per se. It's more of a refactor to add logging.

    The conventional commit type for such changes would be either `fix` (if we consider it as fixing the lack of logging) or `refactor` (if we consider it as refactoring the error handling). However, since the primary purpose is to add logging for better error reporting, I think `
    ```
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1090 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:39 · PVG 02:39 · LAX 10:39 · JFK 13:39
    ♥ Do have faith in what you're doing.