Pr comments

From nudgebee/nudgebee · View interactive version

Pr comments is an AI agent skill from the GitHub repository nudgebee/nudgebee. Fetch PR review comments, display them, and optionally fix code issues raised by reviewers

How to use this skill

Skill file

PR Comments — Fetch, Display, and Fix

Fetch and display comments from the current branch's pull request. Optional argument: $ARGUMENTS can be a PR number, fix to automatically address review comments, or fix 12345 to fix comments on a specific PR.

Step 1: Determine the PR

# Extract PR number from arguments (handles "fix", "fix 12345", "12345", or empty)
PR_NUMBER=$(echo "$ARGUMENTS" | grep -o '[0-9]\+' | head -n 1)
if [[ -z "$PR_NUMBER" ]]; then
  PR_NUMBER=$(gh pr view --json number -q .number)
fi

If no PR is found, stop and tell the user: "No open PR found for the current branch. Usage: /pr-comments [PR_NUMBER]"

Step 2: Fetch All Comments

Run these commands to gather all comment types:

REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)

# PR-level comments (issue comments)
gh api /repos/${REPO}/issues/${PR_NUMBER}/comments

# Code review comments (inline on diff)
gh api /repos/${REPO}/pulls/${PR_NUMBER}/comments

Step 3: Display Comments

Format and display all comments in a readable way:

PR-level Comments

- @author (date):
  > comment body

Code Review Comments (inline)

- @author file.go#line:
  ```diff
  [diff_hunk]
  ```
  > comment body

Rules:

Step 4: Analyze and Fix (when `$ARGUMENTS` contains "fix")

If the user invoked /pr-comments fix or asks to fix the comments:

  1. Categorize each review comment:
  1. For each actionable comment:
  1. After all fixes:

```bash

git add <specific files>

git commit --amend --no-edit

git push --force-with-lease origin $(git branch --show-current)

```

  1. Post a reply on each addressed comment:

```bash

# For inline review comments (code review comments):

gh api /repos/${REPO}/pulls/${PR_NUMBER}/comments/${COMMENT_ID}/replies \

-f body="Fixed in $(git rev-parse --short HEAD)"

# For PR-level comments (issue comments):

gh api /repos/${REPO}/issues/${PR_NUMBER}/comments \

-f body="Addressed in $(git rev-parse --short HEAD)"

```

  1. Report to user:

```

Addressed N review comments:

Skipped M comments (questions/discussion):

Pushed commit: <sha>

```

Service Validation Map

| Path prefix | Validation command |

|---|---|

| api-server/services/ | cd api-server/services && make validate |

| ticket-server/ | cd ticket-server && make validate |

| collector-server/cloud-collector/ | cd collector-server/cloud-collector && make validate |

| collector-server/k8s-collector/relay-server/ | cd collector-server/k8s-collector/relay-server && make validate |

| collector-server/k8s-collector/app/ | cd collector-server/k8s-collector/app && make lint && make test |

| llm/code-analysis/ | cd llm/code-analysis && make check |

| llm/llm-server/ | cd llm/llm-server && make validate |

| llm/rag-server/ | cd llm/rag-server && make lint && make test |

| ml-k8s-server/ | cd ml-k8s-server && make lint && make test |

| auto-pilot/ | cd auto-pilot && poetry run black --check . && poetry run flake8 . |

| notifications-server/ | cd notifications-server && uv run black --check . && uv run flake8 . |

| app/ | cd app && npm run lint2 |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.