feat(user): add statistics shortcuts #238

Merged
wbtiger merged 1 commits from wangyue111/gitlink-cli:feat/user-statistics-shortcuts into master 2026-07-14 22:27:16 +08:00
Contributor

背景

GitLink OpenAPI 提供用户活跃度、贡献热力图、开发能力、角色分布和专业分类等统计接口,但当前 CLI 的 user 组只包含 +me+info,无法直接支持开源贡献画像、科研仓库成员分析或 Agent 自动报告。

新增功能

扩展 gitlink-cli user 命令组:

  • user +activity:近期用户活跃度统计
  • user +headmap:贡献热力图数据,支持 --year
  • user +develop:开发能力统计
  • user +role:项目角色分布统计
  • user +major:专业/项目分类统计

通用参数:

  • --login:目标用户,不传时优先使用 --owner,否则解析当前用户 /users/me
  • --start-time / --end-time:适用于 develop/role/major 的时间范围

安全与参数设计

  • 全部为只读 GET 操作,无远端写入风险
  • --year 校验为四位年份
  • --start-time / --end-time 校验为非负整数,并校验 start <= end
  • 默认支持 --format json,方便 Agent/脚本消费

OpenAPI 对齐

  • GET /users/{owner}/statistics/activity
  • GET /users/{owner}/headmaps
  • GET /users/{owner}/statistics/develop
  • GET /users/{owner}/statistics/role
  • GET /users/{owner}/statistics/major

测试

git diff --check
GOPROXY=https://goproxy.cn,direct go test ./shortcuts/user ./shortcuts
go vet ./shortcuts/user ./shortcuts
go run . user --help
GOPROXY=https://goproxy.cn,direct go test ./...
go vet ./...

文档

更新 README / README.zh-CN / skills/gitlink-user/SKILL.md,新增 doc/changes/user-statistics-shortcuts.md

## 背景 GitLink OpenAPI 提供用户活跃度、贡献热力图、开发能力、角色分布和专业分类等统计接口,但当前 CLI 的 `user` 组只包含 `+me` 和 `+info`,无法直接支持开源贡献画像、科研仓库成员分析或 Agent 自动报告。 ## 新增功能 扩展 `gitlink-cli user` 命令组: - `user +activity`:近期用户活跃度统计 - `user +headmap`:贡献热力图数据,支持 `--year` - `user +develop`:开发能力统计 - `user +role`:项目角色分布统计 - `user +major`:专业/项目分类统计 通用参数: - `--login`:目标用户,不传时优先使用 `--owner`,否则解析当前用户 `/users/me` - `--start-time` / `--end-time`:适用于 develop/role/major 的时间范围 ## 安全与参数设计 - 全部为只读 GET 操作,无远端写入风险 - `--year` 校验为四位年份 - `--start-time` / `--end-time` 校验为非负整数,并校验 start <= end - 默认支持 `--format json`,方便 Agent/脚本消费 ## OpenAPI 对齐 - `GET /users/{owner}/statistics/activity` - `GET /users/{owner}/headmaps` - `GET /users/{owner}/statistics/develop` - `GET /users/{owner}/statistics/role` - `GET /users/{owner}/statistics/major` ## 测试 ```bash git diff --check GOPROXY=https://goproxy.cn,direct go test ./shortcuts/user ./shortcuts go vet ./shortcuts/user ./shortcuts go run . user --help GOPROXY=https://goproxy.cn,direct go test ./... go vet ./... ``` ## 文档 更新 README / README.zh-CN / `skills/gitlink-user/SKILL.md`,新增 `doc/changes/user-statistics-shortcuts.md`。
wangyue111 force-pushed feat/user-statistics-shortcuts from 84bb6dfca7 to 74d36f3a22 2026-06-14 23:25:21 +08:00 Compare
wangyue111 force-pushed feat/user-statistics-shortcuts from 74d36f3a22 to a83b787a8c 2026-06-16 07:44:51 +08:00 Compare
wangyue111 force-pushed feat/user-statistics-shortcuts from a83b787a8c to 58982c2bb0 2026-06-22 12:32:23 +08:00 Compare
wbtiger merged commit 70dbdde1fc into master 2026-07-14 22:27:01 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Gitlink/gitlink-cli#238
No description provided.