forked from Gitlink/gitlink-cli
feat(research): 统一全链路科研分析页面 — 搜索驱动 + 多维度 Tab 结果 + 学术化输出 #42
Loading…
Reference in New Issue
No description provided.
Delete Branch "test-import/pr-1"
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?
一、概述
本次 PR 将原有的 12 个零散科研场景卡片整合为统一的全链路科研分析页面,实现「输入关键词 → 勾选分析维度 → 指定目标仓库 → 一键触发多维度分析」的完整链路闭环,并遵循科学严谨的学术输出规范。
二、架构变更
2.1 后端新增(
cmd/server/server.go)GET /api/dimensionsPOST /api/chain{dimensions, keyword, category, owner, repo},串行运行选中脚本并聚合结果|
dimensionDef+dimensions注册表 | 9 个维度 → Python 脚本映射 ||
buildDimensionArgs()| 维度 needs → Python CLI 参数自动转换 |2.2 前端重写(
cmd/server/static/index.html)2.3 维度覆盖
2.4 其他文件
cmd/server/static/hotspot.htmlDockerfile--trusted-host+--retries 5(修复 CI/CD 超时)scripts/research/inspire.pyscripts/research/llm.pyscripts/research/profile.pyscripts/research/research.pyshortcuts/explore/explore.goexplore +categories/explore +pinned(GitLink 分类精选数据源)三、测试验证
go build编译通���GET /api/dimensions返回 9 个维度POST /api/chain校验 + 串行执行 + 聚合结果正常POST /api/run旧端点向后兼容四、涉及文件清单
cmd/server/server.gocmd/server/static/index.htmlcmd/server/static/hotspot.htmlDockerfilescripts/research/inspire.pyscripts/research/llm.pyscripts/research/profile.pyscripts/research/research.pyshortcuts/explore/explore.go+_test.goshortcuts/register.go- 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>Rewrite the wiki section of community_ops_sweep.py to match the current gitlink-cli wiki commands (shortcuts/wiki/wiki.go), replacing the obsolete --page-name/--title/--project-id/--gateway flags. New flow in _publish_report_to_wiki: 1. bootstrap _Sidebar on cold-start (empty wiki had no sidebar → mkdir/ create -d 404'd) 2. ensure the report directory exists (idempotent +mkdir) 3. wiki +create -d, letting the CLI maintain the sidebar link Drops the hand-rolled _Sidebar parser (now built into the CLI) and the unreliable create→update fallback (create always returns 201). Handles the .- sub_url suffix: page name uses an ASCII slug; the CLI (after the cleanSidebar fix) auto-cleans the link on delete. Verified end-to-end with --apply on baoerjun/gitlink-cli: report page created, _Sidebar directory structure correct, dry-run path intact.Pull request closed