diff --git a/.github/prompts/shared/03-comment-hygiene.md b/.github/prompts/shared/03-comment-hygiene.md index 3fd22f1..9002a86 100644 --- a/.github/prompts/shared/03-comment-hygiene.md +++ b/.github/prompts/shared/03-comment-hygiene.md @@ -4,18 +4,32 @@ feedback.** Skipping cleanup leaves stale comments and dismissed reviews with outdated text visible on the PR timeline. -### 0a. List everything you previously posted +### 0a. List all existing feedback -Run all three: +First, get your own bot identity: ```sh -gh api repos/${REPO}/pulls/${PR_NUMBER}/reviews --jq '.[] | select(.user.login == "claude[bot]") | {id, state, body}' -gh api repos/${REPO}/pulls/${PR_NUMBER}/comments --jq '.[] | select(.user.login == "claude[bot]") | {id, path, body}' -gh api repos/${REPO}/issues/${PR_NUMBER}/comments --jq '.[] | select(.user.login == "claude[bot]") | {id, body}' +BOT_LOGIN=$(gh api graphql -f query='{ viewer { login } }' --jq '.data.viewer.login') ``` -Also list reviews and comments from other authors so you understand context — -but never modify items you did not author. +List **all** reviews and comments to understand context and avoid duplicating +feedback from others: + +```sh +gh api repos/${REPO}/pulls/${PR_NUMBER}/reviews --jq '.[] | {user: .user.login, state, body}' +gh api repos/${REPO}/pulls/${PR_NUMBER}/comments --jq '.[] | {user: .user.login, path, body}' +gh api repos/${REPO}/issues/${PR_NUMBER}/comments --jq '.[] | {user: .user.login, body}' +``` + +Identify your own previous activity (these are the only items you can modify): + +```sh +gh api repos/${REPO}/pulls/${PR_NUMBER}/reviews --jq ".[] | select(.user.login == \"$BOT_LOGIN\") | {id, state, body}" +gh api repos/${REPO}/pulls/${PR_NUMBER}/comments --jq ".[] | select(.user.login == \"$BOT_LOGIN\") | {id, path, body}" +gh api repos/${REPO}/issues/${PR_NUMBER}/comments --jq ".[] | select(.user.login == \"$BOT_LOGIN\") | {id, body}" +``` + +Do not modify items you did not author. ### 0b. Clean up stale reviews