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

176 天前
 TrafalgarLwa

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

功能

$ 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'

2527 次点击
所在节点    分享创造
3 条回复
HMYDK
175 天前
直接命令行还是很帅的。
用 jetbrains 的话可以看下我做的这个( https://ai-commit.com/)
zhaoyy0513
175 天前
@HMYDK 404 了哥们
qwwe01
173 天前
IDEA github copilot 也支持了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1121636

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX