.cursor/commands/gh-debug-issue.md
Use the GH CLI to examine the GitHub issue for the current repository.
RUN gh issue view $1 --json title,body,comments,labels,assignees,milestone
If the Github issue has a discord link in the first message, ie https://discord.com/channels/GUILD_ID/<THREAD_ID>, grab the THREAD_ID off the URL to apply to the next command.
RUN curl -s -X GET -H "Authorization: Bot $MASTRA_DISCORD_BOT_TOKEN" "https://discord.com/api/v10/channels/<THREAD_ID>/messages?limit=100" > /tmp/discord_out.json && jq '[.[] | {timestamp, author: {username: .author.username, display_name: .author.global_name}, content, attachments: [.attachments[]? | {filename, url}], embeds: [.embeds[]? | {title, description, url}]}]' /tmp/discord_out.json ; rm -f /tmp/discord_out.json
If discord returns a 401, ignore it, the user hasn't set up the token yet, continue on without the discord messages.
IMPORTANT — Capture issue details immediately. After fetching the issue, before doing anything else:
Debugging Github issues has 3 stages. Each stage must be fully completed before moving on to the next.
Once you've analyzed the issue:
Now that we have a failing test, a summary of our findings, and you and the user are on the same page:
You MUST first reproduce the issue in a test file, make sure the new test is failing (IMPORTANT!) then finally add a code fix. If we don't first reproduce in a unit or integration test then we can't be sure we fixed the problem.