新增 export 命令组(issues/prs/contributors 导出 CSV/JSON) #389

Closed
wyxttn wants to merge 0 commits from jiangtx/gitlink-cli:pr-shortcut-export into master
Contributor

背景

gitlink-cli 目前缺少仓库数据导出能力,做离线分析、科研数据抽取或外部报表时只能手工拼接 Raw API 并自行处理分页。本 PR 新增 export 命令组,将其提升为一等命令。

改动内容

新增 shortcuts/export/ 命令组(3 条子命令):

  • export +issues — 导出 Issue 列表,支持 --state open|closed|all 过滤与分页
  • export +prs — 导出 PR 列表,支持状态过滤与分页
  • export +contributors — 导出贡献者统计

统一参数:--format csv|json(默认 csv)、--output 输出路径。CSV 表头固定,便于直接导入 Excel/pandas;JSON 保留原始字段供二次处理。

对应 OpenAPI

  • GET /v1/:owner/:repo/issues
  • GET /v1/:owner/:repo/pulls
  • GET /:owner/:repo/contributors

测试

shortcuts/export/export_test.go(6 个测试):覆盖 HTTP 方法/路径/查询参数、CSV 与 JSON 写入、不支持的格式报错。

## 背景 gitlink-cli 目前缺少仓库数据导出能力,做离线分析、科研数据抽取或外部报表时只能手工拼接 Raw API 并自行处理分页。本 PR 新增 `export` 命令组,将其提升为一等命令。 ## 改动内容 新增 `shortcuts/export/` 命令组(3 条子命令): - `export +issues` — 导出 Issue 列表,支持 `--state open|closed|all` 过滤与分页 - `export +prs` — 导出 PR 列表,支持状态过滤与分页 - `export +contributors` — 导出贡献者统计 统一参数:`--format csv|json`(默认 csv)、`--output` 输出路径。CSV 表头固定,便于直接导入 Excel/pandas;JSON 保留原始字段供二次处理。 ## 对应 OpenAPI - GET `/v1/:owner/:repo/issues` - GET `/v1/:owner/:repo/pulls` - GET `/:owner/:repo/contributors` ## 测试 `shortcuts/export/export_test.go`(6 个测试):覆盖 HTTP 方法/路径/查询参数、CSV 与 JSON 写入、不支持的格式报错。
wyxttn added 1 commit 2026-07-09 21:40:58 +08:00
d33c3c9316 feat(shortcut): add export command group (issues/prs/contributors → CSV/JSON)
新增 export 命令组,将仓库数据导出为 CSV/JSON 文件,支撑离线分析与科研数据抽取:

- export +issues    导出 Issue 列表 (GET /v1/:owner/:repo/issues)
- export +prs       导出 PR 列表 (GET /v1/:owner/:repo/pulls)
- export +contributors 导出贡献者统计 (GET /:owner/:repo/contributors)

统一 --format csv|json 与 --output,issues/prs 支持 --state 过滤与分页。
含单元测试(HTTP 方法/路径/参数/CSV·JSON 写入,6 测试)、
帮助文档 doc/commands/export.md、变更说明 doc/changes/export-shortcut.md。

背景:此前仓库数据导出只能手工拼 Raw API;export 组将其提升为一等命令。
来源:GitLink 大赛 2026 子赛题一。
wbtiger closed this pull request 2026-07-14 22:56:09 +08:00
wbtiger reopened this pull request 2026-07-14 23:01:51 +08:00
wbtiger closed this pull request 2026-07-14 23:04:36 +08:00

Pull request closed

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#389
No description provided.