logo
0
0
WeChat Login
🔧 chore(ci): rust image rust:1.88-bullseye → rust:latest

cnb-stats

Git commit 统计可视化 dashboard — cnb-rs 的官方 extension。

基于本地 git log 数据,用 ratatui 渲染:

  • 左侧:历史提交排行榜(按 author 统计 commit 数,Top 13)
  • 右侧:过去 80 周提交趋势折线图

qCtrl+C 退出。

安装

需要先安装 cnb-rs v0.13+(含 extension 系统):

cnb-rs ext install cnb-stats
# 或完整路径
cnb-rs ext install wwvo/cnb-rs/cnb-stats

用法

在任意 git 仓库目录下:

cnb-rs stats

cnb-rs 会通过 Commands::External 自动 dispatch 到本 extension binary。

设计

  • 零 cnb-rs 内部 crate 依赖:不引 cnb-core / cnb-tui / cnb-api,独立编译、独立发版
  • 只依赖 git CLI:通过 git log 子进程获取提交数据,不调任何 CNB OpenAPI(stats 是纯本地分析)
  • subprocess 隔离:作为独立 binary 被 cnb-rs spawn,崩溃不影响主进程

发版方式(本地构建 + cnb-rs 上传)

本仓库不使用 CNB 远程构建流水线(design.md §10 的 build-multiarch stage)。 Release 工作流:

  1. 本地多平台 cargo build --release --target <triple>
  2. 重命名 binary 为 cnb-stats-<os>-<arch>[.exe] + 生成 .sha256
  3. cnb-rs release create <tag> 建 release
  4. cnb-rs release asset-upload <tag> <file> 上传 binary + sha256

.cnb.yml 只跑 CI(lint / clippy / test / build verify),不跑 release stage。

开发

cargo build --release
./target/release/cnb-stats   # 在 git 仓库目录下直接跑

License

Apache-2.0(继承自 cnb-rs)

About

Git commit 统计可视化 dashboard — cnb-rs extension

396.00 KiB
0 forks0 stars1 branches4 TagREADMEApache-2.0 license
Language
Rust100%