Analyse Issue
Overview
Fetch the issue details, verify repo alignment, and inspect the local codebase to confirm or refute the reported problem. Provide an evidence-backed analysis with clear next steps.
Workflow
1) Parse the issue input
- If input is a GitHub issue URL, extract owner/repo and issue number.
- If input is just a number, assume the current repo unless the user specifies another repo.
- If the provider is not GitHub or is unclear, ask for clarification before proceeding.
2) Verify local repo matches the issue
- Ensure the current directory is inside a git repo (
git rev-parse --show-toplevel).
- Identify the target remote (prefer
origin); normalize SSH/HTTPS to owner/repo.
- If the issue URL repo does not match the local
owner/repo, stop and ask the user to switch directories or confirm the target repo.
- If no remote or multiple candidates exist, ask the user which repo to use.
3) Fetch issue content
Prefer gh when available:
gh issue view <num> --json title,body,labels,comments,author,createdAt,updatedAt
- If URL provided, run against that repo:
gh issue view <num> -R owner/repo --json ...
Fallbacks:
gh api repos/{owner}/{repo}/issues/{num} and .../comments if you need more fields.
- If
gh is unavailable but GITHUB_TOKEN exists, use curl with the GitHub API.
- If neither works, ask the user to paste the issue content.
Capture at least: title, body, labels, environment details, repro steps, expected/actual behavior, and key comment insights.
4) Analyze the codebase
- Translate the issue into concrete signals (keywords, error messages, stack traces, config names).
- Use
rg to locate relevant code, tests, and configs.
- Trace the execution path: entry points -> core logic -> dependencies.
- Identify likely failure points: missing checks, edge cases, incorrect assumptions, data shape mismatches, concurrency/timing issues.
- If appropriate and safe, run focused tests; otherwise propose targeted tests to validate the hypothesis.
5) Confirm or qualify the issue
- Provide evidence with file references and reasoning.
- If you can only reason without running tests, state assumptions and confidence.
- If evidence is insufficient, list the exact missing info needed.
6) Respond with a structured analysis
Include:
- Issue summary (expected vs actual)
- Repo match verification
- Evidence (files/functions)
- Root-cause hypothesis or confirmed cause
- Suggested fix approach
- Questions or missing data
- Next steps (tests, logs, repro)
Output conventions
- Respond in the user's language when clear; default to Chinese for Chinese prompts.
- Keep analysis concise but include concrete file pointers and evidence.
- Do not claim confirmation without code-based evidence or reproduction.
1---2name: analyse-issue3description: Analyze a GitHub issue from an issue URL or number.4---56# Analyse Issue78## Overview910Fetch the issue details, verify repo alignment, and inspect the local codebase to confirm or refute the reported problem. Provide an evidence-backed analysis with clear next steps.1112## Workflow1314### 1) Parse the issue input1516- If input is a GitHub issue URL, extract owner/repo and issue number.17- If input is just a number, assume the current repo unless the user specifies another repo.18- If the provider is not GitHub or is unclear, ask for clarification before proceeding.1920### 2) Verify local repo matches the issue2122- Ensure the current directory is inside a git repo (`git rev-parse --show-toplevel`).23- Identify the target remote (prefer `origin`); normalize SSH/HTTPS to `owner/repo`.24- If the issue URL repo does not match the local `owner/repo`, stop and ask the user to switch directories or confirm the target repo.25- If no remote or multiple candidates exist, ask the user which repo to use.2627### 3) Fetch issue content2829Prefer `gh` when available:3031- `gh issue view <num> --json title,body,labels,comments,author,createdAt,updatedAt`32- If URL provided, run against that repo: `gh issue view <num> -R owner/repo --json ...`3334Fallbacks:3536- `gh api repos/{owner}/{repo}/issues/{num}` and `.../comments` if you need more fields.37- If `gh` is unavailable but `GITHUB_TOKEN` exists, use `curl` with the GitHub API.38- If neither works, ask the user to paste the issue content.3940Capture at least: title, body, labels, environment details, repro steps, expected/actual behavior, and key comment insights.4142### 4) Analyze the codebase4344- Translate the issue into concrete signals (keywords, error messages, stack traces, config names).45- Use `rg` to locate relevant code, tests, and configs.46- Trace the execution path: entry points -> core logic -> dependencies.47- Identify likely failure points: missing checks, edge cases, incorrect assumptions, data shape mismatches, concurrency/timing issues.48- If appropriate and safe, run focused tests; otherwise propose targeted tests to validate the hypothesis.4950### 5) Confirm or qualify the issue5152- Provide evidence with file references and reasoning.53- If you can only reason without running tests, state assumptions and confidence.54- If evidence is insufficient, list the exact missing info needed.5556### 6) Respond with a structured analysis5758Include:5960- Issue summary (expected vs actual)61- Repo match verification62- Evidence (files/functions)63- Root-cause hypothesis or confirmed cause64- Suggested fix approach65- Questions or missing data66- Next steps (tests, logs, repro)6768## Output conventions6970- Respond in the user's language when clear; default to Chinese for Chinese prompts.71- Keep analysis concise but include concrete file pointers and evidence.72- Do not claim confirmation without code-based evidence or reproduction.