ai-commit - 让 AI 为你主动生 conventional 格局的提交信息

源码

https://github.com/guanguans/ai-commit

性能

  • 默认生成 conventional 格局的提交信息
  • 可自定义生成信息的 AI 驱动(目前仅反对 Open AI)
  • 可自定义生成待选提交信息的数量
  • 可自定义生成信息的提醒模板

装置

间接下载 ai-commit 文件

curl 'https://raw.githubusercontent.com/guanguans/ai-commit/main/builds/ai-commit' -o ai-commit --progresschmod +x ai-commit

通过 Composer 装置

# 全局composer global require guanguans/ai-commit --dev -v# 本地composer require guanguans/ai-commit --dev -v

应用

配置 OpenAI API key

./ai-commit config set generators.openai.api_key sk-... --global

生成且提交信息

./ai-commit commit
╰─ ./ai-commit commit                                                                                  ─╯1. Checking run environment: ✔2. Generating commit messages: generating...[    {        "id": 1,        "subject": "Docs(README): Configure OpenAI API key",        "body": "- Update README-zh_CN.md\n- Update README.md\n- Explain how to configure OpenAI API key"    },    {        "id": 2,        "subject": "Install(Composer): Add global and local install instructions",        "body": "- Update README.md\n- Add instructions for global and local install via Composer"    },    {        "id": 3,        "subject": "Usage(Commit Messages): Add best practices",        "body": "- Update README.md\n- Add best practices for writing commit messages"    }]2. Generating commit messages: ✔3. Choosing commit message: choosing... Please choice a commit message:  [1] Docs(README): Configure OpenAI API key  [2] Install(Composer): Add global and local install instructions  [3] Usage(Commit Messages): Add best practices >