feat(profile): 新增用户画像统计快捷命令 #241

Merged
wbtiger merged 1 commits from luwanzhou/gitlink-cli:feat/profile-shortcuts into master 2026-06-14 18:32:04 +08:00
Contributor

合并请求描述

新增 profile 命令组,封装 GitLink 平台用户画像统计 API。此前这些接口无任何 shortcut 封装,gitlink-contributor-insight Skill 甚至将 user +stats/user +heatmap 标注为"不可用",只能用 PR 时间戳手工推算。本 PR 直接暴露平台原生画像数据,为"科研主体画像"等场景提供数据底座。

相关Issue

关联Issue编号:#暂无

变更内容

1. 新增 profile 命令组及 5 个子命令

命令 功能 API 端点
profile +ability 开发能力评分(影响力/贡献度/活跃度/项目经验/语言能力)及语言分布 GET /users/{user}/statistics/develop
profile +role 角色定位 GET /users/{user}/statistics/role
profile +major 专业/学科定位(如深度学习、量子计算) GET /users/{user}/statistics/major
profile +activity 近期活动统计(每日疑修/合并请求/提交数量) GET /users/{user}/statistics/activity
profile +contribution 贡献热力图 GET /users/{user}/headmaps

2. 实现了 --user 自动回退机制

省略 --user/-u 时自动调用 /users/me 解析当前认证用户,无需手动指定用户名即可查询自身画像数据。

3. 支持时间窗口与年份筛选参数

  • +ability/+role/+major 支持 --start-time/--end-time(Unix 时间戳)按时间窗口查询
  • +contribution 支持 --year 按年份筛选

4. 补全国际化翻译

更新 internal/i18n/locales/ 中英文翻译文件,覆盖所有新增命令描述和参数提示。

5. 新增变更文档与使用说明

  • 新增 doc/changes/profile-shortcuts.md 功能变更文档
  • 更新 README.md / README.zh-CN.md 使用说明

6. 补全单元测试

覆盖端点路径正确性、参数映射、用户自动回退、缺失 login 字段错误处理、HTTP 错误响应处理。

使用示例

# 查看指定用户的开发能力评分
gitlink-cli profile +ability --user luwanzhou

# 省略 --user 自动解析为当前登录用户
gitlink-cli profile +ability

# 按时间窗口查询开发能力(Unix 时间戳)
gitlink-cli profile +ability --user luwanzhou --start-time 1704067200 --end-time 1735689600

# 查看用户角色定位
gitlink-cli profile +role --user luwanzhou

# 查看用户专业/学科定位
gitlink-cli profile +major --user luwanzhou

# 查看用户近期活动统计
gitlink-cli profile +activity --user luwanzhou

# 查看用户贡献热力图
gitlink-cli profile +contribution --user luwanzhou

# 按年份查询贡献热力图
gitlink-cli profile +contribution --user luwanzhou --year 2025
## 合并请求描述 新增 `profile` 命令组,封装 GitLink 平台用户画像统计 API。此前这些接口无任何 shortcut 封装,`gitlink-contributor-insight` Skill 甚至将 `user +stats`/`user +heatmap` 标注为"不可用",只能用 PR 时间戳手工推算。本 PR 直接暴露平台原生画像数据,为"科研主体画像"等场景提供数据底座。 ## 相关Issue 关联Issue编号:#暂无 ## 变更内容 ### 1. 新增 `profile` 命令组及 5 个子命令 | 命令 | 功能 | API 端点 | |------|------|----------| | `profile +ability` | 开发能力评分(影响力/贡献度/活跃度/项目经验/语言能力)及语言分布 | `GET /users/{user}/statistics/develop` | | `profile +role` | 角色定位 | `GET /users/{user}/statistics/role` | | `profile +major` | 专业/学科定位(如深度学习、量子计算) | `GET /users/{user}/statistics/major` | | `profile +activity` | 近期活动统计(每日疑修/合并请求/提交数量) | `GET /users/{user}/statistics/activity` | | `profile +contribution` | 贡献热力图 | `GET /users/{user}/headmaps` | ### 2. 实现了 `--user` 自动回退机制 省略 `--user`/`-u` 时自动调用 `/users/me` 解析当前认证用户,无需手动指定用户名即可查询自身画像数据。 ### 3. 支持时间窗口与年份筛选参数 - `+ability`/`+role`/`+major` 支持 `--start-time`/`--end-time`(Unix 时间戳)按时间窗口查询 - `+contribution` 支持 `--year` 按年份筛选 ### 4. 补全国际化翻译 更新 `internal/i18n/locales/` 中英文翻译文件,覆盖所有新增命令描述和参数提示。 ### 5. 新增变更文档与使用说明 - 新增 `doc/changes/profile-shortcuts.md` 功能变更文档 - 更新 `README.md` / `README.zh-CN.md` 使用说明 ### 6. 补全单元测试 覆盖端点路径正确性、参数映射、用户自动回退、缺失 login 字段错误处理、HTTP 错误响应处理。 ## 使用示例 ```bash # 查看指定用户的开发能力评分 gitlink-cli profile +ability --user luwanzhou # 省略 --user 自动解析为当前登录用户 gitlink-cli profile +ability # 按时间窗口查询开发能力(Unix 时间戳) gitlink-cli profile +ability --user luwanzhou --start-time 1704067200 --end-time 1735689600 # 查看用户角色定位 gitlink-cli profile +role --user luwanzhou # 查看用户专业/学科定位 gitlink-cli profile +major --user luwanzhou # 查看用户近期活动统计 gitlink-cli profile +activity --user luwanzhou # 查看用户贡献热力图 gitlink-cli profile +contribution --user luwanzhou # 按年份查询贡献热力图 gitlink-cli profile +contribution --user luwanzhou --year 2025
luwanzhou added 1 commit 2026-06-14 03:01:50 +08:00
da4c8c0d10 feat(profile): 新增用户画像统计快捷命令
新增只读 profile 命令组,封装此前无 shortcut 覆盖的
GitLink 用户画像统计接口:

profile +ability      -> /users/{user}/statistics/develop
profile +role         -> /users/{user}/statistics/role
profile +major        -> /users/{user}/statistics/major
profile +activity     -> /users/{user}/statistics/activity
profile +contribution -> /users/{user}/headmaps

省略 --user 时默认通过 /users/me 解析当前认证用户。
统计命令支持 --start-time/--end-time 时间窗口,
+contribution 支持 --year 参数。

包含单元测试、中英双语 i18n 帮助文本、README 更新
及变更说明文档。
wbtiger merged commit 8c29d98a57 into master 2026-06-14 18:32:04 +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#241
No description provided.