Issue Hunter — Issue Analysis & Selection
Overview
Systematically analyze open issues in target repositories, score them by fixability, and select the best candidates to work on. Produces a structured analysis document with root cause hypotheses and fix approaches.
Use cases: Open-source contribution targeting, sprint planning, backlog grooming, bug triage.
Prerequisites
GitHub CLI must be authenticated — issue fetching relies on gh API calls:
CODEBLOCK0
If not configured, ask the user to provide:
- 1. GitHub username
- GitHub token — run
gh auth login or set INLINECODE2
Without auth, API rate limits will block bulk issue fetching.
Workflow
Step 1: Fetch Issues
For each target repository, fetch open issues:
CODEBLOCK1
If no label filtering works, fetch recent open issues:
CODEBLOCK2
Step 2: Score Each Issue
Rate each issue on these factors:
| Factor | 3 (High) | 2 (Medium) | 1 (Low) |
|---|
| Reproducibility | Clear repro steps, stack trace | Partial description | Vague "doesn't work" |
| Scope |
Single module/file | 2-3 files | Cross-cutting concern |
|
Complexity | Logic bug, missing check | Algorithm issue | Architecture redesign |
|
Community signal | Multiple reports, 👍 | Some engagement | Single report, no reaction |
|
Freshness | Recent, no PR attempts | Moderate age | Old, multiple failed PRs |
|
Testability | Can write automated test | Partially testable | Manual testing only |
Total score = sum of all factors (max 18).
Step 3: Select Candidates
Selection criteria (in priority order):
- 1. Clearly a bug (not a feature request in disguise)
- Self-contained (fixable without deep domain knowledge)
- Testable (can write automated tests to verify)
- No existing PR addressing it
- Score ≥ 12/18
Red flags — skip issues if:
- - Already has an open PR (check with
gh pr list --repo owner/repo --search "fixes #{number}") - Requires access to proprietary services/APIs
- Involves native/platform-specific code you can't test
- Maintainer has said "won't fix" or "by design"
Step 4: Deep-Dive Selected Issues
For each selected issue:
- 1. Read the full thread — comments often contain root cause hints or partial fixes
- Identify relevant source files — search the codebase for keywords from the issue
- Draft a root cause hypothesis — "I believe X happens because Y"
- Draft a fix approach — "I'll modify Z to handle the W case"
- Estimate effort — Low (< 1 hour), Medium (1-4 hours), High (4+ hours)
Step 5: Produce Analysis Document
Write {workspace}/issue-analysis.md:
CODEBLOCK3
Output
- -
{workspace}/issue-analysis.md — Per-repo issue analysis with selections
Tips
- - Pairs naturally with repo-scout (upstream) and repo-setup / dev-test (downstream).
- For sprint planning: use the scoring system on your own project's issues to prioritize.
- For backlog grooming: run periodically to re-score issues as new information appears.
- When analyzing a single repo, skip the summary table and go straight to detailed analysis.
Issue Hunter — 议题分析与选择
概述
系统性地分析目标仓库中的开放议题,根据可修复性进行评分,并选择最佳候选议题进行处理。生成包含根本原因假设和修复方案的结构化分析文档。
适用场景:开源贡献目标锁定、冲刺规划、待办事项整理、缺陷分类。
前置条件
必须完成GitHub CLI的身份认证——议题获取依赖于gh API调用:
bash
gh auth status # 必须显示Logged in
如果未配置,请要求用户提供:
- 1. GitHub用户名
- GitHub令牌 — 运行gh auth login或设置export GH_TOKEN=
未完成认证时,API速率限制将阻止批量议题获取。
工作流程
步骤1:获取议题
针对每个目标仓库,获取开放议题:
bash
获取带有bug标签的议题
gh issue list --repo {owner}/{repo} --label bug --state open --limit 30 \
--json number,title,body,labels,comments,createdAt,updatedAt
同时检查以下标签
gh issue list --repo {owner}/{repo} --label good first issue --state open --limit 10 \
--json number,title,body,labels,comments,createdAt
gh issue list --repo {owner}/{repo} --label help wanted --state open --limit 10 \
--json number,title,body,labels,comments,createdAt
如果标签筛选无效,获取最近的开放议题:
bash
gh issue list --repo {owner}/{repo} --state open --limit 50 \
--json number,title,body,labels,comments,createdAt
步骤2:为每个议题评分
根据以下因素对每个议题进行评分:
| 因素 | 3分(高) | 2分(中) | 1分(低) |
|---|
| 可复现性 | 清晰的复现步骤、堆栈跟踪 | 部分描述 | 模糊的无法运行 |
| 影响范围 |
单个模块/文件 | 2-3个文件 | 跨领域问题 |
|
复杂度 | 逻辑缺陷、缺失检查 | 算法问题 | 架构重新设计 |
|
社区信号 | 多个报告、👍 | 有一定参与度 | 单一报告、无反应 |
|
时效性 | 近期提出、无PR尝试 | 中等时效 | 陈旧、多个失败的PR |
|
可测试性 | 可编写自动化测试 | 部分可测试 | 仅能手动测试 |
总分 = 所有因素之和(最高18分)。
步骤3:选择候选议题
选择标准(按优先级排序):
- 1. 明确是缺陷(而非伪装的功能请求)
- 独立性强(无需深入领域知识即可修复)
- 可测试(可编写自动化测试进行验证)
- 无现有PR处理该议题
- 评分 ≥ 12/18
红旗警告 — 跳过以下议题:
- - 已有开放的PR(使用gh pr list --repo owner/repo --search fixes #{number}检查)
- 需要访问专有服务/API
- 涉及无法测试的原生/平台特定代码
- 维护者已声明不会修复或设计如此
步骤4:深入分析选定的议题
针对每个选定的议题:
- 1. 阅读完整讨论串 — 评论中常包含根本原因线索或部分修复方案
- 识别相关源文件 — 在代码库中搜索议题中的关键词
- 起草根本原因假设 — 我认为X发生是因为Y
- 起草修复方案 — 我将修改Z以处理W情况
- 评估工作量 — 低(< 1小时)、中(1-4小时)、高(4小时以上)
步骤5:生成分析文档
编写{workspace}/issue-analysis.md:
markdown
议题分析 — {仓库/活动名称}
生成日期:{date}
摘要
| # | 仓库 | 议题 | 标题 | 评分 | 工作量 | 状态 |
|---|
| 1 | owner/repo | #123 | 缺陷标题 | 16/18 | 低 | 已选定 |
| 2 |
owner/repo | #456 | 缺陷标题 | 12/18 | 中 | 已选定 |
| 3 | owner/repo | #789 | 缺陷标题 | 8/18 | 高 | 已跳过 |
详细分析
owner/repo — 已选定: #123 — 缺陷标题
- - 评分:16/18(可复现性:3,影响范围:3,复杂度:3,信号:2,时效性:3,可测试性:2)
- 根本原因:{假设}
- 修复方案:{描述}
- 需修改的文件:path/to/file.py、tests/test_file.py
- 工作量评估:低(< 1小时)
- 风险:低 — 直接的空值检查
- 依赖项:无
owner/repo — 已跳过: #789 — 缺陷标题
输出
- - {workspace}/issue-analysis.md — 按仓库划分的议题分析及选择结果
提示
- - 与repo-scout(上游)和repo-setup / dev-test(下游)自然搭配使用。
- 用于冲刺规划:将评分系统应用于自己项目的议题以确定优先级。
- 用于待办事项整理:定期运行以根据新信息重新评分。
- 分析单个仓库时,跳过摘要表格,直接进入详细分析。