基于 .NET 10 + Avalonia UI 的跨平台桌面工具:读取本地 Git Commit / Diff,通过 双层 AI 调度 自动生成专业 Release Version 描述(Release Notes)。
表现层 (Avalonia Views / MVVM)
│
业务控制层 (ViewModels)
│
核心领域层 (GitScribeAI.Core)
│
基础设施层 (Git CLI / OpenAI HttpClient / 加密配置)
| 项目 | 职责 |
|---|---|
GitScribeAI.Core |
领域模型、接口、Prompt 模板 |
GitScribeAI.Infrastructure |
Git CLI、OpenAI 兼容客户端、双层编排、加密设置 |
GitScribeAI.Desktop |
Avalonia 桌面 UI、DI 引导 |
- Map:对每条 commit 的 message + diff 并行调用大模型,提炼
[Category] 一句话摘要(SemaphoreSlim控频)。 - Reduce:将全部摘要注入全局 Prompt,去重分类,生成 Markdown Release Notes。
- .NET 10 SDK
- 本机已安装
git并在 PATH 中 - 任意 OpenAI 兼容 API(OpenAI / DeepSeek / Azure OpenAI / Ollama 等)
cd AutoMadeVersionDescribe
dotnet restore
dotnet build
dotnet run --project src/GitScribeAI.Desktop# macOS Apple Silicon
dotnet publish src/GitScribeAI.Desktop/GitScribeAI.Desktop.csproj \
-c Release -r osx-arm64 --self-contained true -o ./publish/osx-arm64
# Windows x64
dotnet publish src/GitScribeAI.Desktop/GitScribeAI.Desktop.csproj \
-c Release -r win-x64 --self-contained true -o ./publish/win-x64仓库已配置 Actions 工作流:.github/workflows/release.yml。
仅当推送符合 v*.*.* 的 tag 时触发(例如 v1.0.0、v1.2.3)。
git add .
git commit -m "chore: prepare release"
git tag v1.0.0
git push origin main
git push origin v1.0.0成功后将在 GitHub → Releases 生成:
| 资源 | 说明 |
|---|---|
GitScribeAI-v1.0.0-win-x64.zip |
Windows x64 |
GitScribeAI-v1.0.0-win-arm64.zip |
Windows ARM64 |
GitScribeAI-v1.0.0-osx-arm64.tar.gz |
macOS Apple Silicon |
GitScribeAI-v1.0.0-osx-x64.tar.gz |
macOS Intel |
产物为 self-contained(无需目标机器安装 .NET)。
权限:workflow 使用内置 GITHUB_TOKEN 写 Release,需仓库已启用 Actions。
- 浏览选择本地 Git 仓库,点 刷新 加载 Commit 列表与历史 Tag。
- 当前要生成的版本:可「自定义版本号」,或从 git tags 列表选择历史版本。
- Since / Until:从下拉列表可视化选择(显示短哈希、提交说明、时间、作者)。
- 右上角 用户设置:配置 AI 接入与可编辑 Prompt 模板;配置写入
appsettings.json。 - 点击 生成 Release Notes,完成后复制 Markdown 结果。
配置文件位置(appsettings.json):
- macOS:
~/Library/Application Support/GitScribeAI/appsettings.json - Linux:
~/.config/GitScribeAI/appsettings.json(随 XDG) - Windows:
%APPDATA%\GitScribeAI\appsettings.json
JSON 结构概要:
{
"ai": { "apiBaseUrl": "...", "encryptedApiKey": "...", "model": "...", ... },
"git": { "defaultMaxCommits": 50, "lastRepositoryPath": "..." },
"prompts": {
"stage1System": "...",
"stage1UserTemplate": "...含 {hash} {diff} 等...",
"stage2System": "...含 {version}...",
"stage2UserTemplate": "...含 {summaries}..."
}
}- 非阻塞 UI:Git 与网络全部
async/await,可取消。 - 凭证隔离:API Key 禁止明文落盘。
- 进程安全:Git 调用使用
ProcessStartInfo.ArgumentList,禁止 shell 拼接。 - Token 防护:超长 Diff 变更行采样 + 字符硬截断。
- 弹性网关:
IChatCompletionService抽象,换厂商无需改 UI。
# macOS Apple Silicon
dotnet publish src/GitScribeAI.Desktop/GitScribeAI.Desktop.csproj \
-c Release -r osx-arm64 --self-contained true -o ./publish/osx-arm64
# Windows x64
dotnet publish src/GitScribeAI.Desktop/GitScribeAI.Desktop.csproj \
-c Release -r win-x64 --self-contained true -o ./publish/win-x64仓库已配置 Actions 工作流:.github/workflows/release.yml。
仅当推送符合 v*.*.* 的 tag 时触发(例如 v1.0.0、v1.2.3)。
git add .
git commit -m "chore: prepare release"
git tag v1.0.0
git push origin main
git push origin v1.0.0
## 发布产物
构建产物(self-contained)
┌────────────────────────────────────┬─────────────────────┐
│ 包名 │ 平台 │
├────────────────────────────────────┼─────────────────────┤
│ GitScribeAI-<tag>-win-x64.zip │ Windows x64 │
├────────────────────────────────────┼─────────────────────┤
│ GitScribeAI-<tag>-win-arm64.zip │ Windows ARM64 │
├────────────────────────────────────┼─────────────────────┤
│ GitScribeAI-<tag>-osx-arm64.tar.gz │ macOS Apple Silicon │
├────────────────────────────────────┼─────────────────────┤
│ GitScribeAI-<tag>-osx-x64.tar.gz │ macOS Intel │
└────────────────────────────────────┴─────────────────────┘
## 许可证
内部工具 / 按需调整。