agent-reviews

repository·main·Indexed 42 days ago

https://github.com/pbakaus/agent-reviews

CLI and agent skills for managing GitHub PR review comments. Version 1.1.0 provides tools to list, filter, reply to, and watch for bot and human findings. It includes specialized skills like resolve-reviews, resolve-agent-reviews, and resolve-human-reviews for AI agents supporting Agent Skills (e.g., Claude Code, Cursor, Codex) to automate the triage-fix-reply loop.

Tokens
5.9K
Snippets
25
Records
31
Agent score
55%

What's inside agent-reviews

  1. How the resolve-reviews workflow works

    main

    The resolve-reviews skill follows a two-phase process to automate PR maintenance:

    Phase 1: FETCH & FIX (Synchronous)

    1. Fetch: Retrieve all unanswered comments using --unanswered --expanded.
    2. Evaluate: Determine if each comment is a True Positive (fix it), False Positive (dismiss it), Discussion (ask user), or Already Addressed.
    3. Fix & Commit: Apply code changes, run lint/type-checks, and push a single commit containing all fixes.
    4. Reply: Post responses to every comment. Use --resolve only for closing threads (e.g., false positives), not for new fixes that require verification.

    Phase 2: POLL FOR NEW COMMENTS (Looping)

    After Phase 1, start a watcher loop using npx agent-reviews --watch --unanswered. This monitors the PR for new comments. If new comments appear, the watcher exits with EXITING WITH NEW COMMENTS, prompting you to repeat the Fetch/Fix/Reply cycle until the watcher reports WATCH COMPLETE.

  2. How agent-reviews skills automate PR resolution

    main

    Agent skills automate the entire triage-fix-reply loop for PR reviews. The workflow follows these steps:

    1. Fetch: Retrieves unanswered comments (filtered by all, bot-only, or human-only).
    2. Evaluate: Analyzes each finding (e.g., true positive, false positive, actionable).
    3. Fix: Applies fixes for real issues and runs lint/type-checks.
    4. Dismiss: Dismisses false positives with an explanation.
    5. Reply: Responds to every comment with the outcome (e.g., Fixed in {commit} for true positives or Won't fix: {reason} for false positives).
    6. Watch: Enters a watch mode to poll for new comments and repeats the cycle until no new comments appear for 10 minutes.
    7. Report: Provides a summary of all actions taken.

    All fixes are batched into a single commit before the polling phase begins.

  3. Use the different agent-reviews skills

    main

    The agent-reviews package provides three distinct skills tailored for different workflows. Instead of a single tool, you choose a skill based on whether you want to address human feedback, bot feedback, or both:

    • resolve-reviews: Resolves all comments (both human and bot).
    • resolve-agent-reviews: Resolves bot comments only.
    • resolve-human-reviews: Resolves human comments only.

    These skills are compatible with any agent that supports Agent Skills, such as Claude Code, Cursor, or Codex.

  4. How the resolve-agent-reviews workflow works

    main

    The resolve-agent-reviews skill follows a two-phase lifecycle to automate PR maintenance:

    Phase 1: FETCH & FIX (Synchronous)

    1. Fetch: Retrieve all unanswered bot comments using --expanded.
    2. Evaluate: Categorize findings as TRUE POSITIVE (fix it), FALSE POSITIVE (dismiss it), or UNCERTAIN (ask the user).
    3. Fix & Commit: Apply code changes, run lint/type-checks, and push a single commit containing all fixes.
    4. Reply: Respond to every comment. Use --resolve only for false positives or skipped items to ensure reviewers can still verify actual fixes.

    Phase 2: POLL FOR NEW COMMENTS (Looping)

    After Phase 1, start a watcher loop using --watch. This phase runs until the watcher exits with WATCH COMPLETE, indicating no new bot findings were posted within the timeout period.

    npx agent-reviews --bots-only --unanswered --expanded
  5. Use the agent-reviews CLI for PR reviews

    main

    The agent-reviews CLI allows you to list, filter, reply to, and watch PR review comments.

    Common Commands:

    • List all comments on current PR: agent-reviews
    • Filter by status:
      • Unresolved: agent-reviews --unresolved
      • Unanswered bot comments: agent-reviews --unanswered --bots-only
    • Get details for a specific comment: agent-reviews --detail <id>
    • Reply to a comment:
      • Inline: agent-reviews --reply <id> "Your message"
      • From a file: agent-reviews --reply <id> --body-file path/to/body.md
      • With resolution: agent-reviews --reply <id> "Fixed" --resolve
    • Watch for new comments (polling): agent-reviews --watch --bots-only
    • Target a specific PR: agent-reviews --pr <number>
    • Output JSON for scripting: agent-reviews --json

    Note on inline replies: If your reply starts with a dash, use the -- separator to ensure the message is treated as literal text: agent-reviews --reply 12345 -- "- Fixed the issue"

    # List all review comments on the current branch's PR
    agent-reviews
    
    # Only unresolved comments
    agent-reviews --unresolved
    
    # Only unanswered bot comments
    agent-reviews --unanswered --bots-only
    
    # Full detail for a specific comment (diff hunk + replies)
    agent-reviews --detail 12345678
    
    # Reply to a comment
    agent-reviews --reply 12345678 "Fixed in abc1234"
    agent-reviews --reply 12345678 --body-file body.md
    
    # JSON output for scripting / AI agents
    agent-reviews --json
    
    # Watch for new comments (polls every 30s, exits after 10 min idle)
    agent-reviews --watch --bots-only
    
    # Target a specific PR (otherwise auto-detects from branch)
    agent-reviews --pr 42
  6. Prerequisites for the resolve-reviews skill

    main

    To use the resolve-reviews skill, ensure the following are installed and configured:

    • Tools: git, gh (GitHub CLI), and Node.js.
    • Package Manager: You can use npx, pnpm dlx, yarn dlx, or bunx to run agent-reviews commands.
    • Cloud Environments: If running in a remote environment (like Codespaces), verify your git identity by running git config --global --get user.email. If it is empty or a placeholder, set it manually so commits map to your user.

    Note: In local environments, you can skip the git identity check.

    git config --global --get user.email
  7. Prerequisites for the resolve-human-reviews skill

    main

    To use the resolve-human-reviews skill, ensure the following are installed and configured:

    • Tools: git, gh (GitHub CLI), and Node.js.
    • Package Manager: You can use npx, pnpm dlx, yarn dlx, or bunx to run agent-reviews commands.
    • Cloud Environments (Codespaces/Remote Agents): You must verify your git author identity so CI can map commits to you. Check your email with git config --global --get user.email. If it is empty or a placeholder, set it manually before proceeding.

    Note: In local environments, the git identity check can be skipped.

    git config --global --get user.email
  8. Prerequisites for resolve-agent-reviews skill

    main

    To use the resolve-agent-reviews workflow, ensure the following are installed and configured:

    • Tools: git, gh (GitHub CLI), and Node.js.
    • Package Manager: You can use npx, pnpm dlx, yarn dlx, or bunx to run agent-reviews commands.
    • Git Identity (Cloud/Remote environments only): In environments like Codespaces or remote agents, verify your git author identity so commits map to your user. If git config --global --get user.email is empty, set it manually.

    Note: Skip the git identity check if working in a local environment.

    git config --global user.email "your-email@example.com"
  9. Authenticate agent-reviews with GitHub

    main

    agent-reviews automatically detects authentication using the following resolution order (first match wins):

    1. GITHUB_TOKEN environment variable
    2. GH_TOKEN environment variable
    3. .env.local in the repository root
    4. gh auth token (via the GitHub CLI)

    If you are already logged in with gh auth login, no additional configuration is required. For cloud/remote environments or HTTPS proxy setups, providing GITHUB_TOKEN or GH_TOKEN is recommended. The tool also supports HTTPS_PROXY via undici ProxyAgent support.

  10. Add agent-reviews skills to AI agents

    main

    You can add agent-reviews as a slash command to any agent that supports Agent Skills (such as Claude Code, Cursor, or Codex). This allows the agent to automate the triage-fix-reply loop.

    Skills use npx agent-reviews at runtime, so the CLI is fetched automatically.

    Use the following command to add a skill:

    npx skills add pbakaus/agent-reviews@<skill-name>

    Available skills:

    • resolve-reviews: Resolves all comments (human + bot).
    • resolve-agent-reviews: Resolves bot comments only (Copilot, Cursor, etc.).
    • resolve-human-reviews: Resolves human comments only.
    npx skills add pbakaus/agent-reviews@resolve-agent-reviews
  11. Configure GitHub Enterprise Server or custom API hosts

    main

    You can redirect the tool to use GitHub Enterprise Server (GHES) or a local API-compatible server by setting the following environment variables:

    • GITHUB_API_URL: Sets the base URL for REST and GraphQL endpoints. For GHES, providing a URL ending in /api/v3 will automatically have the GraphQL endpoint rewritten to /api/graphql.
    • GITHUB_GRAPHQL_URL: An optional variable for specifying a custom GraphQL endpoint in unusual setups.
    • GH_TOKEN: An alternative to GITHUB_TOKEN for authentication.
    • GH_REPO: Used to target specific repositories when running in detached environments.