Show HN: acmsg - 自动化 Commit Message 生成器
`acmsg` 是一个用 `Python` 编写的命令行工具,利用 `OpenRouter API` 和 `AI` 模型自动生成 `git commit message`。它能分析暂存的更改,生成上下文相关的提交信息,并支持多种 `AI` 模型选择和编辑功能。用户需配置 `OpenRouter API Key`。安装方式包括 `pipx` 和 `nix`。配置文件位于 `~/.config/acmsg/config.yaml`。该工具使用 `MIT` 许可证。
quinneden/acmsg
一个使用 OpenRouter API
自动生成 git commit message
的工具。
介绍
这是一个用 Python
编写的命令行工具,它使用 OpenRouter API
通过 AI
模型生成 git commit message
。
功能特性
- 分析
git
仓库中暂存的更改。 - 使用
AI
生成上下文相关的commit message
。 - 支持通过
OpenRouter
使用多种AI
模型。 - 可以选择编辑生成的
commit message
。 - 如果确认,会自动提交更改以及生成的
message
。
前置条件
OpenRouter API Key
安装
使用 pipx
:
pipx install acmsg
使用 nix
:
使用 flakes
(例如:nixos/nix-darwin/home-manager):
# 将 `acmsg` 添加到你的 flake inputs
inputs.acmsg.url = "github:quinneden/acmsg";
# 添加 nixpkgs overlay 并将 package 包含在你的配置中
nixpkgs.overlays = [ inputs.acmsg.overlays.default ];
environment.systemPackages = [ pkgs.acmsg ];
# 或者 home.packages = [ pkgs.acmsg ];
# 也可以直接从 inputs 中包含 package
environment.systemPackages = [ inputs.acmsg.packages.${pkgs.system}.acmsg ];
使用独立的 profile:
$ nix profile install "github:quinneden/acmsg"
配置
配置文件位于 ~/.config/acmsg/config.yaml
。
首次运行 acmsg
时,会提示你配置 OpenRouter API token
。你也可以运行以下命令:
$ acmsg config set api_token <your_api_token>
用法
usage: acmsg [-h] [--version] {commit,config} ...
Automated commit message generator
positional arguments:
{commit,config} Commands
commit generate a commit message
config manage configuration settings
options:
-h, --help show this help message and exit
--version display the program version and exit
许可证
acmsg
使用 MIT
许可证,许可证文件包含在 LICENSE
文件中。