feat(user): add user statistics shortcuts #323
Loading…
Reference in New Issue
No description provided.
Delete Branch "ohanabi/gitlink-cli:feat/user-statistics-shortcuts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
合并请求描述
本次合并请求为 user 模块新增用户统计类快捷命令,覆盖贡献热力图、用户聚合统计和项目趋势查询,减少 Agent 和用户对 Raw API 的依赖,并补齐贡献
者洞察工作流中此前标记为不可用的 user 统计能力。
相关Issue
关联Issue编号:暂无
变更内容
1. 新增用户统计快捷命令
user +heatmap,调用GET /users/{user}/headmaps。user +statistics,调用GET /users/{user}/statistics。user +project-trends,调用GET /users/{user}/project_trends。user +stats和user +trends,兼容贡献者分析 Skill 中的既有表达。2. 支持当前用户回退和查询参数
--user可省略,省略时通过/users/me解析当前认证用户。user +heatmap支持--year。user +statistics/user +project-trends支持--start-time和--end-time。3. 补充测试和 i18n
4. 完善 README 与 Skill 文档
skills/README.md和skills/gitlink-user/SKILL.md。gitlink-user三个参考页:heatmap、statistics、project-trends。doc/changes/user-statistics-shortcuts.md。问题描述
当前
gitlink-userSkill 中,用户贡献热力图、用户统计、项目趋势仍通过 Raw API 示例暴露;gitlink-contributor-insight也将user +heatmap、user +stats、user +trends标记为不可用,导致贡献者分析只能从 PR/Issue 列表中近似推算贡献频率、产出和趋势。问题复现步骤
skills/gitlink-user/SKILL.md。gitlink-cli api GET /users/:user_id/...。skills/gitlink-contributor-insight/SKILL.md。user +heatmap、user +stats、user +trends被标记为不可用。根本原因
user shortcut 当前只覆盖
user +me和user +info,没有把 GitLink 已有的用户统计类只读接口沉淀为高层命令。相关 Skill 因此只能保留 RawAPI 或替代推算流程,降低了 Agent 工作流的准确性和一致性。
修复方案
在
shortcuts/user中新增热力图、统计、项目趋势三个只读 shortcut,并加入stats/trends短别名。复用统一的用户解析逻辑:显式传入--user时直接使用目标用户;省略时调用/users/me获取当前登录用户。同步补充测试、i18n、README、Skill 文档和变更说明,并将相关贡献者洞察Skill 从“命令不可用”更新为优先使用新快捷命令。
验证
gofmt -w shortcuts/user/user.go shortcuts/user/user_test.gogit diff --checkgo run ./internal/i18n/cmd/checkgo test ./shortcuts/user ./shortcutsgo test ./...Pull request closed