用途:读取 GitHub issue 和 PR。资料指出,直接运行 gh issue view <number> 或 gh pr view <number>(不带 --json)会触发关于已弃用 projectCards 字段(经典 Projects 下线)的 GraphQL 错误,即使数据可访问也会以退出码 1 失败,造成静默中断和重试浪费。
主要能力与用法:始终使用 --json 模式。读取 issue 用:gh issue view <number> --json title,body,state,labels,assignees,comments,number,url,author,createdAt,updatedAt。读取 PR 用:gh pr view <number> --json title,body,state,labels,assignees,comments,number,url,author,createdAt,updatedAt,mergeable,mergeStateStatus,headRefName,baseRefName,reviews。列表同样避免触及 projectCards 字段,例如 gh issue list --json number,title,state,labels,assignees,author,createdAt,url 与 gh pr list --json number,title,state,labels,assignees,author,createdAt,url,headRefName,baseRefName。
仓库识别:若不在带 GitHub remote 的 git 仓库中,或用户指定了仓库,可加 --repo owner/repo;自动检测当前仓库用 gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null,失败则询问用户 owner/repo。
输出展示:展示标题与 #编号(附 URL 链接)、状态与标签、作者与创建日期、正文(按 markdown 渲染)、评论(每条含作者、时间戳、正文,超过 5 条折叠并提供展开),不要把原始 JSON 直接丢给用户。
限制:资料未提供安装方式、定价、平台要求、性能数据或与其它技能的集成说明。