feat(repo): 新增 repo +tree 文件树查询命令 #143
Loading…
Reference in New Issue
No description provided.
Delete Branch "ohanabi/gitlink-cli:feat/repo-tree-shortcut-final"
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?
背景
gitlink-cli repo已经提供仓库信息、README、语言统计、贡献者等查询能力,但缺少一个直接查看仓库目录结构的 Shortcut。在 AI Agent 自动化、科研仓库复现性检查、开源合规检查等场景中,Agent 需要频繁判断仓库根目录或指定目录下是否存在 README、LICENSE、依赖清单、测试目录、文档目录等文件。此前只能手动调用 Raw API
/sub_entries,使用门槛较高,也不利于在 Skill 和工作流中复用。实现内容
本 PR 新增
gitlink-cli repo +tree,将仓库文件树查询封装为 repo 域的一等 Shortcut。具体实现:
repo +treeShortcutGET /{owner}/{repo}/sub_entries获取仓库文件和目录列表--path, -p指定要查看的目录,默认查看仓库根目录--ref, -r指定分支、标签或提交,默认masterResolveOwnerRepo、CallAPIWithQuery和统一输出逻辑交付内容
shortcuts/repo/repo.goshortcuts/repo/repo_test.goREADME.md、README.zh-CN.md、skills/gitlink-repo/SKILL.md、skills/gitlink-repo/references/gitlink-repo-tree.mddoc/changes/repo-tree-shortcut.md使用示例
价值
repo +readme、repo +languages、repo +contributors等能力形成互补测试
测试结果:通过,实际执行
go test -race ./...。兼容性
该改动只新增 Shortcut、单元测试和文档,不修改已有命令参数或输出结构,对现有功能无破坏性影响。