### Install agent-reviews CLI (npm) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Installs the agent-reviews command-line interface globally using npm. This command is used for direct terminal interaction with GitHub PR review comments. ```bash npm install -g agent-reviews ``` -------------------------------- ### GitHub Authentication and Repository Utilities Source: https://context7.com/pbakaus/agent-reviews/llms.txt Provides functions for obtaining GitHub authentication tokens, detecting repository information, and getting the current branch. It handles proxy configurations automatically and resolves tokens from environment variables, .env files, or the GitHub CLI. ```javascript const { getProxyFetch, getGitHubToken, getRepoInfo, getCurrentBranch, } = require("agent-reviews/lib/github"); // Get proxy-aware fetch function (handles HTTPS_PROXY automatically) const proxyFetch = getProxyFetch(); // Resolve GitHub token from env vars, .env.local, or gh CLI const token = getGitHubToken(); // Returns: "ghp_xxxxxxxxxxxx" or null // Get repository owner and name from git remote or GH_REPO env const repoInfo = getRepoInfo(); // Returns: { owner: "pbakaus", repo: "agent-reviews" } or null // Get current git branch name const branch = getCurrentBranch(); // Returns: "feature/add-dark-mode" or null ``` -------------------------------- ### Filter Meta-Comments with JavaScript Source: https://context7.com/pbakaus/agent-reviews/llms.txt Demonstrates how to use the `isMetaComment` function to identify and filter out non-actionable bot comments. It includes examples of default filters and how to apply custom filters for specific bot messages. ```javascript const { isMetaComment, DEFAULT_META_FILTERS } = require("agent-reviews/lib/comments"); // Default filters exclude: // - Vercel deployment status ([vc]:...) // - Supabase branch status ([supa]:...) // - Cursor Bugbot review summaries // - Copilot PR review overviews // - CodeRabbit walkthroughs and summaries // - Sourcery reviewer guides // - Codacy analysis summaries // - SonarCloud Quality Gate summaries // Check if a comment is a meta-comment isMetaComment("vercel[bot]", "[vc]: Deployment ready"); // true isMetaComment("cursor[bot]", "Missing null check..."); // false (actionable) // Custom meta-comment filters const customFilters = [ ...DEFAULT_META_FILTERS, (user, body) => user === "my-bot" && body.includes("Status:"), ]; const processed = processComments(rawData, { metaFilters: customFilters }); ``` -------------------------------- ### Get Full Comment Detail Source: https://context7.com/pbakaus/agent-reviews/llms.txt Retrieves complete details for a specific comment using its ID. This includes the full body, code context (diff hunk), and any replies. The output can be formatted as plain text or JSON for scripting. ```bash # Get full detail for a specific comment by ID agent-reviews --detail 12345678 agent-reviews -d 12345678 # Output: # === Comment [12345678] === # Type: CODE | By: cursor[bot] | Status: ○ no reply # File: src/lib/utils.ts:42 # URL: https://github.com/owner/repo/pull/123#discussion_r12345678 # # --- Code Context --- # @@ -40,6 +40,8 @@ export function processData(input) { # const result = input.data; # + const value = result.nested.property; # return value; # --- End Code Context --- # # The variable `result.nested` could be undefined. Consider adding a null check # before accessing the `property` field to prevent runtime errors. # Get detail as JSON for scripting agent-reviews --detail 12345678 --json ``` -------------------------------- ### Get Comment Detail (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Retrieves detailed information for a specific review comment, including the associated diff hunk and any replies. Requires the comment ID. ```bash agent-reviews --detail 12345678 ``` -------------------------------- ### List All Review Comments Source: https://context7.com/pbakaus/agent-reviews/llms.txt Fetches and displays all review comments (inline code comments, issue comments, and reviews) from the current branch's PR. This is the default command when agent-reviews is run without arguments. ```bash # List all comments on the current branch's PR agent-reviews # Output: # Found 3 comments # # [12345678] CODE by cursor[bot] ○ no reply # src/lib/utils.ts:42 # Missing null check on potentially undefined value... # # [12345679] CODE by @reviewer ✓ replied # src/components/Button.tsx:15 # Consider using useMemo here for performance... # # [12345680] COMMENT by copilot-pull-request-reviewer[bot] ○ no reply # This function could benefit from better error handling... ``` -------------------------------- ### Expanded List View for Comments Source: https://context7.com/pbakaus/agent-reviews/llms.txt Displays all comments in list mode with their full details (body, diff hunk, replies) included directly in the output. This is useful for AI agents that need to process multiple comments without individual fetches. ```bash # Show all unanswered bot comments with full detail agent-reviews --unanswered --bots-only --expanded agent-reviews -a -b -e # Output includes complete body, code context, and replies for each comment # Useful for AI agents to process multiple comments in one call ``` -------------------------------- ### Fetch Bot Comments Source: https://github.com/pbakaus/agent-reviews/blob/main/skills/resolve-agent-reviews/SKILL.md Fetches all unanswered bot comments from the current PR in an expanded format. This command requires the GitHub CLI and proper authentication. ```bash npx agent-reviews --bots-only --unanswered --expanded ``` -------------------------------- ### Commit and Push Fixes Source: https://github.com/pbakaus/agent-reviews/blob/main/skills/resolve-agent-reviews/SKILL.md Stages, commits, and pushes the resolved code changes to the repository. This step should be performed after evaluating all findings. ```bash git add -A git commit -m "fix: address PR review bot findings\n\n{List of bugs fixed, grouped by bot}" git push ``` -------------------------------- ### Style layout and terminal interface with CSS Source: https://github.com/pbakaus/agent-reviews/blob/main/website/og-template.html Defines the responsive layout for the Agent Reviews dashboard and the color-coded terminal output. It uses Flexbox for positioning and specific classes to style terminal command output, errors, and status indicators. ```css * { margin: 0; padding: 0; box-sizing: border-box; } body { width: 1200px; height: 630px; background: #13131a; font-family: 'Sora', system-ui, sans-serif; display: flex; overflow: hidden; position: relative; } .left { flex: 0 0 420px; display: flex; flex-direction: column; justify-content: space-between; padding: 56px 48px 48px; position: relative; } .left::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: #c43a28; } .terminal { flex: 1; background: #0d0d12; margin: 32px 32px 32px 0; border-radius: 10px; padding: 24px 28px; font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace; font-size: 13.5px; line-height: 1.9; overflow: hidden; border: 1px solid #1e1e28; } .cmd { color: #f0ece4; font-weight: 600; } .err { color: #f5827a; } .ok { color: #7ee68a; } ``` -------------------------------- ### List All Review Comments (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Lists all review comments on the current branch's pull request using the agent-reviews CLI. This is the default command when no flags are provided. ```bash agent-reviews ``` -------------------------------- ### Reply to a Comment (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Allows you to reply to a specific review comment with a given message. Requires the comment ID and the reply text. ```bash agent-reviews --reply 12345678 "Fixed in abc1234" ``` -------------------------------- ### Reply to Review Comments Source: https://context7.com/pbakaus/agent-reviews/llms.txt Posts a reply to a specific comment identified by its ID. Optionally, the command can resolve the review thread along with the reply. This is used for addressing comments or dismissing false positives. ```bash # Reply to a comment agent-reviews --reply 12345678 "Fixed in abc1234. Added null check for nested property." agent-reviews -r 12345678 "Fixed in abc1234" # Output: # ✓ Reply posted successfully # https://github.com/owner/repo/pull/123#discussion_r12345679 # Reply and resolve the review thread agent-reviews --reply 12345678 "Fixed in abc1234" --resolve # Output: # ✓ Reply posted successfully # https://github.com/owner/repo/pull/123#discussion_r12345679 # ✓ Thread resolved # Dismiss a false positive agent-reviews --reply 12345678 "Won't fix: This is intentional behavior for backward compatibility." --resolve ``` -------------------------------- ### JSON Output for Scripting (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Outputs the review comments in JSON format, suitable for use in scripts or by AI agents that can parse structured data. This facilitates programmatic access to review data. ```bash agent-reviews --json ``` -------------------------------- ### PR Comment Operations: Fetching, Processing, and Replying Source: https://context7.com/pbakaus/agent-reviews/llms.txt Enables fetching, processing, filtering, and replying to pull request comments. It supports finding PRs, handling paginated comment data, unifying comment formats, filtering by various criteria, and resolving comment threads. ```javascript const { findPRForBranch, fetchPRComments, processComments, filterComments, replyToComment, resolveThread, isBot, } = require("agent-reviews/lib/comments"); const proxyFetch = getProxyFetch(); const token = getGitHubToken(); // Find the open PR for a branch const pr = await findPRForBranch("owner", "repo", "feature-branch", token, proxyFetch); // Returns: { number: 123, html_url: "https://github.com/..." } or null // Fetch all comment types from a PR (paginated automatically) const rawData = await fetchPRComments("owner", "repo", 123, token, proxyFetch); // Returns: { reviewComments: [...], issueComments: [...], reviews: [...] } // Process raw comments into unified format with reply tracking const processed = processComments(rawData); // Returns array of: // { // id: 12345678, // type: "review_comment" | "issue_comment" | "review", // user: "cursor[bot]", // isBot: true, // path: "src/file.ts", // line: 42, // diffHunk: "@@ -40,6 +40,8 @@...", // body: "Comment text...", // replies: [{ id, user, body, isBot }], // hasHumanReply: false, // hasAnyReply: false, // isResolved: false // } // Filter comments by criteria const filtered = filterComments(processed, { botsOnly: true, filter: "unanswered", // or "unresolved" }); // Reply to a comment (tries review comment reply, falls back to issue comment) const reply = await replyToComment( "owner", "repo", 123, "12345678", "Fixed in abc1234", token, proxyFetch ); // Returns: { id: 12345679, html_url: "https://github.com/..." } // Resolve a review thread via GraphQL const result = await resolveThread("owner", "repo", 123, "12345678", token, proxyFetch); // Returns: { resolved: true, threadId: "..." } // or: { alreadyResolved: true, threadId: "..." } // or: { skipped: true, reason: "not a review comment thread" } // Check if a username is a known bot isBot("cursor[bot]"); // true isBot("copilot-pull-request-reviewer"); // true isBot("@reviewer"); // false ``` -------------------------------- ### Reply to Bot Comments Source: https://github.com/pbakaus/agent-reviews/blob/main/skills/resolve-agent-reviews/SKILL.md Posts a reply to a specific bot comment and marks the thread as resolved. The command varies based on whether the finding was a true positive, false positive, or skipped. ```bash npx agent-reviews --reply "Fixed in {hash}. {Brief description of the fix}" --resolve npx agent-reviews --reply "Won't fix: {reason}. {Explanation of why this is intentional or not applicable}" --resolve npx agent-reviews --reply "Skipped per user request" --resolve ``` -------------------------------- ### Watch for New Comments (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Enables a watch mode that polls for new review comments at a specified interval. It automatically stops after a period of inactivity. This is useful for continuous monitoring. ```bash agent-reviews --watch --bots-only ``` -------------------------------- ### List Unresolved Comments (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Filters the list of review comments to show only those that are unresolved or pending. This helps focus on comments that still require action. ```bash agent-reviews --unresolved ``` -------------------------------- ### Watch for New Comments Source: https://context7.com/pbakaus/agent-reviews/llms.txt Enables a watch mode that polls for new comments on a PR at a configurable interval. The process exits automatically after a period of inactivity or when new comments are detected, useful for monitoring active PRs. ```bash # Watch for new bot comments (polls every 30s, exits after 10 min idle) agent-reviews --watch --bots-only agent-reviews -w -b # Output: # === PR Comments Watch Mode === # PR #123: https://github.com/owner/repo/pull/123 # Polling every 30s, exit after 600s of inactivity # Filters: bots-only, all comments # Started at 2024-01-15 10:30:00 # # [2024-01-15 10:30:00] Initial state: 5 existing comments tracked # [2024-01-15 10:30:30] Poll #1: No new comments (30s/600s idle) # [2024-01-15 10:31:00] Poll #2: No new comments (60s/600s idle) # ``` -------------------------------- ### List Unanswered Bot Comments (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Filters review comments to display only those originating from bots and that have not yet received any replies. Useful for prioritizing bot feedback. ```bash agent-reviews --unanswered --bots-only ``` -------------------------------- ### Terminal Output Formatting with ANSI Colors Source: https://context7.com/pbakaus/agent-reviews/llms.txt Provides utilities for formatting output to the terminal using ANSI escape codes for colors and styles. It includes functions to format individual comments and entire comment arrays for display, with options for JSON output and expanded views. ```javascript const { colors, formatComment, formatDetailedComment, formatOutput, } = require("agent-reviews/lib/format"); // ANSI color codes console.log(`${colors.green}Success${colors.reset}`); console.log(`${colors.red}Error${colors.reset}`); console.log(`${colors.yellow}Warning${colors.reset}`); console.log(`${colors.bright}Bold${colors.reset}`); console.log(`${colors.dim}Muted${colors.reset}`); // Format a single comment for list view const listLine = formatComment(comment); // Output: "[12345678] CODE by cursor[bot] ○ no reply\n src/file.ts:42\n Comment preview..." // Format a comment with full detail const detail = formatDetailedComment(comment); // Output: "=== Comment [12345678] ===\nType: CODE | By: cursor[bot]...\n--- Code Context ---\n..." // Format array of comments for output const output = formatOutput(comments, { json: false, expanded: false }); // Returns formatted string ready for console.log // JSON output mode const jsonOutput = formatOutput(comments, { json: true }); // Returns JSON string ``` -------------------------------- ### Add agent-reviews Agent Skill Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Adds an agent skill for automating PR review resolution workflows. This command integrates with agents that support Agent Skills (e.g., Claude Code, Cursor). Replace `resolve-agent-reviews` with the desired skill. ```bash npx skills add pbakaus/agent-reviews@resolve-agent-reviews ``` -------------------------------- ### Filter Review Comments Source: https://context7.com/pbakaus/agent-reviews/llms.txt Filters review comments based on their resolution or reply status. Options include filtering for unresolved comments, comments with no human replies, or combinations with bot/human-only filters. ```bash # Only unresolved comments (no human reply) agent-reviews --unresolved agent-reviews -u # Only comments with no replies at all agent-reviews --unanswered agent-reviews -a # Combine with bot/human filters agent-reviews --unanswered --bots-only agent-reviews -a -b # Only human comments that need attention agent-reviews --unanswered --humans-only agent-reviews -a -H ``` -------------------------------- ### Target Specific PR (CLI) Source: https://github.com/pbakaus/agent-reviews/blob/main/README.md Specifies a particular pull request to operate on, overriding the default behavior of auto-detecting from the current branch. Requires the PR number. ```bash agent-reviews --pr 42 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.