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

重复造轮子之写了一个基于 ai 生成 git 提交信息的命令行工具

  •  
  •   TrafalgarLwa ·
    mingeme · 4 天前 · 1027 次点击

    aicommit

    项目主页: https://github.com/mingeme/aicommit

    背景

    开发初衷是希望有个工具能一键生成 git 的提交信息,一开始是在 gpt 网页对话,复制粘贴,略显麻烦。github 关键字一搜 aicommit 也有很多项目,都能用,基于能自己造轮子就自己造轮子的心态,还是忍不住又复刻一遍,整个项目 95% 都通过 windsurf 生成,整体目标是尽量保证简单方便使用。

    mac 用户安装:

    brew install mingeme/tap/aicommit
    

    使用方式:

    $ # 使用阿里千问大模型,可以在百练申请 api 免费试用 180 天(不是广告),大家可以先尝试用我的体验一下
    $ aicommit auth add qwen sk-e6234945f70d48a6b1f1b5934ba6fd68
    $ git add .
    $ aicommit
    

    showcase

    功能

    • 支持自定义提示词
    • 忽略自定义文件的变更
    $ aicommit prompt init # 初始化配置文件在当前目录 .aicommit.yml
    $ aicommit prompt init -g # 初始化配置文件在全局目录 ~/.config/aicommit/.aicommit.yml
    

    这里贴出我的配置

    .aicommit.yml

    prompt:
      system: |
        You are a helpful assistant that generates clear and concise git commit messages. Follow conventional commits format. Disable markdown in the response.
      user: |
        Please generate a commit message for the following git diff:
    
        {{diff}}
    # 支持忽略自定义文件的变更
    exclude:
      - 'package-lock.json'
    
    
    3 条回复    2025-03-30 12:56:44 +08:00
    HMYDK
        1
    HMYDK  
       3 天前
    直接命令行还是很帅的。
    用 jetbrains 的话可以看下我做的这个( https://ai-commit.com/)
    zhaoyy0513
        2
    zhaoyy0513  
       3 天前
    @HMYDK 404 了哥们
    qwwe01
        3
    qwwe01  
       1 天前
    IDEA github copilot 也支持了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   967 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 18ms · UTC 21:25 · PVG 05:25 · LAX 14:25 · JFK 17:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.