Fetch a GitHub issue by number or URL and reformat it according to the Kibana bug report or feature request template. Classifies the issue type automatically, then rewrites the body and updates it via the GitHub CLI.
Fetch a GitHub issue and reformat its body to match the appropriate Kibana issue template.
The user provides either:
12345)https://github.com/elastic/kibana/issues/12345)Extract the issue number from whichever form was provided.
gh issue view <NUMBER> --repo elastic/kibana --json number,title,body,labels
Read the title, body, and labels fields from the output.
Determine whether the issue is a bug report or a :
labels array first. If any label contains bug (case-insensitive), treat it as a bug. If any label contains enhancement or feature (case-insensitive), treat it as a feature request.title and body:
Using the original title and body as source material, map existing content to the appropriate template fields. For feature requests, look for scope boundaries, current workarounds, target user, and any mentioned blockers or dependencies. Leave fields blank where no information is available in the original issue.
*** Bug report *** Read .github/ISSUE_TEMPLATE/Bug_report.md to get the required fields.
*** Feature request *** Read .github/ISSUE_TEMPLATE/Feature_request.yml to get the required fields.
After extracting what you can, identify which fields are still empty. Ask the first empty field's question, then end your response and wait for the user to reply. Do not ask the next question or proceed to Step 5 until the user has answered.
Guidelines:
For feature requests, also probe for these common gaps (even if the field is not empty, ensure the draft addresses them):
Display the proposed new body to the user and ask for confirmation before making any changes. End your response and wait for the user to explicitly confirm before proceeding to Step 6.
After the user confirms, update the issue body:
gh issue edit <NUMBER> --repo elastic/kibana --body "<NEW_BODY>"
Pass the body via a shell variable or heredoc to avoid quoting issues:
NEW_BODY=$(cat <<'EOF'
<reformatted body here>
EOF
)
gh issue edit <NUMBER> --repo elastic/kibana --body "$NEW_BODY"
Confirm success by reporting the issue URL.