forked from Gitlink/gitlink-cli
fix(output): --format table 支持资源包裹列表响应(此前 list 命令表格从不生效) #10
Loading…
Reference in New Issue
No description provided.
Delete Branch "test-import/pr-5"
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?
问题
平台所有分页列表端点的响应形状都是资源包裹 map:
{"total_count": N, "<资源名>": [...]}。printTable遇到含嵌套结构的 map 一律回落 JSON,导致 所有 list 命令的--format table实际上从不渲染表格,与 flag 文案承诺不符。修复
total_count: 7,键排序),再把包裹数组渲染为表格生产实测
branch +list --format table(forgeplus):输出total_count: 7摘要行 + 7 行分支表格(此前输出整段 JSON)。测试
formatter_test.go 新增 2 个单测;全量 go test/vet/gofmt 通过。
- Add pr +reviews to list reviews for a pull request (with status filter) - Add pr +review to create a review (comment/approve/reject) - Uses v1 API: /v1/{owner}/{repo}/pulls/{index}/reviews - Includes tests for both list and create operations Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1. shortcuts/pr/pr.go — 核心逻辑 +diff 命令替换: 旧实现:与 +files 完全相同,调用 /pulls/{id}/files(只返回文件列表) 新实现:两步调用 GET /v1/{owner}/{repo}/pulls/{id}/versions → 取最新版本 ID GET /v1/{owner}/{repo}/pulls/{id}/versions/{version_id}/diff → 获取逐行 diff 新增参数: --file / -f — 过滤特定文件的 diff --stat — 仅显示统计摘要 新增函数: getLatestVersionID() — 获取 PR 最新版本 ID formatDiffStat() — 提取增删统计摘要 2. internal/output/formatter.go — Diff 渲染 isDiffData() — 通过检测 files[].sections 区分 diff 数据和普通文件列表 printDiffTable() — 以 git diff 风格渲染:diff --git 头、hunk header、增删行 修改 printTable() 路由,自动检测并走 diff 渲染分支 3. shortcuts/pr/pr_test.go — 新增 5 个测试 测试用例 验证内容 TestPRDiffFetchesVersionThenDiff 两步调用完整流程 TestPRDiffWithFileFilter --file 参数传递 filepath 查询参数 TestPRDiffStatMode --stat 模式只输出统计 TestPRDiffFailsWhenNoVersions 无版本时返回友好错误 TestPRDiffFailsWhenPRNotFound PR 不存在时正确处理 404 4. Skill 文档更新 SKILL.md — 更新 +diff 描述、新增使用示例、更新注意事项 gitlink-pr-files.md — 完整重写,明确 +files 和 +diff 的区别新增功能参数 gitlink-cli search +issues --keyword "登录失败" # 必填:搜索关键词 --category opened # 可选:all/opened/closed --assignee 42 # 可选:按负责人 ID --author 10 # 可选:按创建人 ID --milestone 5 # 可选:按里程碑 ID --tag 1,2 # 可选:按标签 ID --sort-by created_on # 可选:排序字段 --sort-dir asc # 可选:排序方向 API 调用 GET /api/v1/{owner}/{repo}/issues?keyword=xxx&category=opened&assigner_id=42&sort_by=issues.updated_onclose 命令 API URL 误拼为 {repo_path}/{owner}/milestones/{id}/update_status(Owner 重复、Repo 丢失、缺 /v1),修正为 /v1/{owner}/{repo}/milestones/{id}/update_status;新增 TestMilestoneClose 回归测试。 Co-Authored-By: Claude <noreply@anthropic.com>新增 server 子命令启动 HTTP 服务(:8080),提供 /api/scenarios、/api/run、/api/result/{key}、/api/health;前端含仪表盘(index)、独立结果页(result)、热点追踪页(hotspot),6 科研场景一键运行与可视化。在 cmd/root.go 注册子命令。 Co-Authored-By: Claude <noreply@anthropic.com>Pull request closed