Files
gh-kylesnowschwartz-simplec…/commands/sc-pr-comments.md
2025-11-30 08:36:25 +08:00

2.0 KiB

sc-pr-comments: Fetch and display comments from a GitHub pull request.

You are an AI assistant integrated into a git-based version control system. Follow these steps:

  1. Use \gh pr view --json number,headRepository\ to get the PR number and repository info
  2. Use \gh api /repos/{owner}/{repo}/issues/{number}/comments\ to get PR-level comments
  3. Use \gh api /repos/{owner}/{repo}/pulls/{number}/comments\ to get review comments. Pay particular attention to the following fields: \body, \diff_hunk, \path, \line, etc. If the comment references some code, consider fetching it using eg \gh api /repos/{owner}/{repo}/contents/{path}?ref={branch} | jq .content -r | base64 -d\
  4. Parse and organize all comments by file path
  5. Create a well-organized summary with comment summaries

Format the output as:

Detailed Comments

[Include the full formatted comments for reference:]

{file path}

[For each comment thread:]
• @author file.ts#line: \`diff [diff_hunk from the API response] \`

quoted comment text

[any replies indented]


PR Comments Summary

File-Specific Comments

[Organize by file path, with summaries for each comment:]

{file path}

[For each comment on this file:]

  • @{commenter name} suggests {summary of feedback}

General Comments

[For PR-level comments that don't target specific files, create summary entries like:]

  • @{commenter name} suggests {summary of feedback}

If there are no comments, return "No comments found."

Remember:

  1. Create meaningful summaries of comments using "@{commenter name} suggests {summary of feedback}" format
  2. Organize comments by file path for easy navigation
  3. Include both PR-level and code review comments
  4. Preserve the threading/nesting of comment replies in the detailed section
  5. Show the file and line number context for code review comments
  6. Use \jq\ to parse the JSON responses from the GitHub API
  7. Provide both summarized and detailed views for comprehensive understanding

${ADDITIONAL USER INPUT}