用途:自动处理 GitHub 开放 issue——抓取 issue、实现修复、以 PR 形式提交,并可监控 PR 评审评论。触发场景为用户说出“fix…”等指令时。
前置条件:需安装并认证 gh CLI(brew install gh && gh auth login),或设置 GH_TOKEN 环境变量。
处理流程:先抓取 issue,如 gh issue list --repo <owner/repo> --label bug --limit 5 --json number,title,body,labels。然后对每个 issue 阅读正文与评论中的复现步骤,克隆/进入仓库,创建分支 git checkout -b fix/issue-<number>,实现修复并读取代码理解上下文,运行可用测试,提交信息为 fix: <description> (closes #<number>),推送并创建 PR:gh pr create --repo <owner/repo> --title "fix: <title>" --body "Closes #<number>\n\n## Changes\n- <description>"。可选 --watch 监控评审评论,用 gh pr view <number> --repo <owner/repo> --json reviewDecision,reviews,comments 查看并处理反馈后推送更新。
命令参考:gh issue list 列出开放 issue;gh issue view N 读取详情;gh pr create 创建 PR;gh pr view N 查看评审与评论;gh pr merge N --squash 合并 PR(需用户批准)。
用法示例:/gh-issues octocat/hello-world --label bug --limit 3;/gh-issues my-org/api --label "good first issue" --dry-run;/gh-issues owner/repo --watch。
规则与限制:先检查 gh 是否安装;未经用户明确批准绝不合并 PR;每个 issue 创建一个 PR(不批量);创建 PR 前运行现有测试;若修复不明确,应在 issue 上评论请求澄清而非猜测;dry-run 模式仅展示将执行的操作而不做更改。收费、价格、平台与效果等资料暂未提供。