GIM发布新版本了 (附rust CLI制作brew bottle流程)

GIM 发布新版本了!现在1.3.0版本可用了 https://github.com/davelet/git-intelligence-message/releases/tag/v1.3.0 。可以通过brew upgrade git-intelligence-message升级。

初次安装需要先执行 brew tap davelet/gim

GIM 是一个根据git仓库内文件变更自动生成git提交消息的命令行工具,参考前文《GIM: 根据代码变更自动生成git提交消息的工具》。

在最近的版本中主要三个新能力:

  • 不再依赖rust而是安装二进制包
  • 自动探测新版本并提示更新
  • 用户可自主调整生成提示(AI prompt)

此外还内置了更多大模型的 API 调用地址。

二进制安装

GIM 现在不依赖 rust 环境了,改为通过brew bottle安装了。即下即用,不用编译安装,立刻节省5G磁盘。

为了保证效果,推荐重装:

bash 复制代码
brew uninstall git-intelligence-message
brew cleanup
brew update
brew install git-intelligence-message

升级 GIM 版本

软件执行时会主动探测是否有新版本。发现后(会有提示)可以执行

bash 复制代码
gim update

来升级。如果提示了5次依然没升级则一个月内不会再提示。

调整AI提示词

可以自主设置提示词了。通过命令 gim prompt查看默认提示词,通过gim prompt -e可进行提示词更新。

完整命令可参考项目文档 https://github.com/davelet/git-intelligence-message/blob/main/README.md 或者帮助文档:

bash 复制代码
gim prompt -h
Manage ai model prompt files. Show content when no options specified

Usage: gim prompt [OPTIONS]

Options:
  -e, --edit             Optional: Edit the prompt files
  -t, --prompt <PROMPT>  Optional: Specify which prompt to edit (d or diff or diff_prompt or subject_prompt)
  -o, --editor <EDITOR>  Optional: Specify the editor to use (e.g., vim, code, nano)
  -h, --help             Print help

内置大模型地址清单

现在内置了一下8中大模型的API地址:

Model Prefix Service Provider Default Endpoint
gpt-* OpenAI https://api.openai.com/v1/chat/completions
moonshot-* Moonshot AI https://api.moonshot.cn/v1/chat/completions
qwen-* Alibaba Qwen https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
gemini-* Google Gemini https://generativelanguage.googleapis.com/v1beta/openai/
doubao-* ByteDance Doubao https://ark.cn-beijing.volces.com/api/v3/chat/completions
glm-* THUDM GLM https://open.bigmodel.cn/api/paas/v4/chat/completions
deepseek-* DeepSeek https://api.deepseek.com/chat/completions
qianfan-* Baidu Qianfan https://qianfan.baidubce.com/v2/chat/completions

所以如果你要用的模型是在这清单里可以不用使用gim ai --url来配置。

使用流程

  1. 通过homebrew安装
  2. 设置大模型token参考 gim ai -h
  3. 切换目录到某个git 仓库
  4. 执行gim -a (这就是GIM提供的核心能力)
  5. (可选)执行git push推送提交


bottle 制作流程

1. 新建 tap 分支

我给 https://github.com/davelet/homebrew-gim 拉了新分支 dep-cargo-install。这个分支保持通过cargo 安装。
main 分支后续更新成bottle安装方式,供用户使用。

2. 本地使用 tap 新分支

有多种方式切换分支,最直观的是

bash 复制代码
cd "$(brew --repo davelet/gim)"
git checkout dep-cargo-install
git pull
brew install --build-bottle davelet/gim/git-intelligence-message

这样会通过新分支的旧方式安装软件。

必须指定参数 --build-bottle 告诉 brew 这个软件要用来制作bottle

3. 制作 bottle

找个目录执行

bash 复制代码
brew bottle git-intelligence-message

会在当前目录生成一个bottle文件(结尾是 bottle.1.tar.gz)并提示一段代码:

rb 复制代码
  bottle do
    rebuild 1
    sha256 cellar: :any_skip_relocation, sonoma: "b478f239a65b704c85cc59b1a50fcde797bbbf9c142972c08f529e5bea3f5b7a"
  end

4. 上传文件

把上一步生成的文件重命名,里面的 -- 改成 -,上传到仓库的Release里面,比如
https://github.com/davelet/git-intelligence-message/releases/tag/v1.2.2

把上传好的文件链接复制出来。

5. 更新 Formulae

最后一步,回到 tap 主分支 https://github.com/davelet/homebrew-gim/blob/main/Formula/git-intelligence-message.rb ,把这个文件里的 depends_on 那一行删掉,改成第三步的代码。

然后在 bottle do 这个块里增加root_url,值就是上一步复制的地址去掉最后的文件名。

大功告成。

最后的小提示:源文件计算sha256 shasum -a 256 <下载到本地的tar.gz>

相关推荐
ModestCoder_1 天前
Git 忽略所有 `.xlsx`,但保留指定 Excel 文件的方法
git·excel
techdashen1 天前
用 Rust 写生产级服务要踩多少坑——Cloudflare 把答案做成了一个开源库
开发语言·rust·开源
数据智能老司机1 天前
Rust 设计模式与最佳实践——不要和借用检查器对抗
rust
阡陌..1 天前
202605新版git_2.54.0常用操作指令
大数据·git·elasticsearch
Rust研习社1 天前
你为什么总是入门 Rust 失败
开发语言·后端·rust
techdashen1 天前
等了两年,Cloudflare 终于给规则引擎加上了通配符
服务器·rust
会笑的小熊1 天前
VScode项目推送到git仓库
ide·git·vscode
zhangfeng11331 天前
宝塔服务器完全可以安装 Git,进行版本管理,而且非常简单
运维·服务器·人工智能·git·编程
芳草萋萋鹦鹉洲哦1 天前
【tauri】为什么接口通信选择invoke而不是Axios
rust·axios·tauri·invoke
Bdygsl1 天前
Git(1)—— 基本理解与使用
git