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 --progress
chmod +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
>