agent-code-review

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2026 License: MIT

README ΒΆ

Agent Code Review

Go CI Go Lint Go SAST Go Report Card Docs Visualization License Powered by Claude

AI-powered code review agent for GitHub Pull Requests.

Overview

Agent Code Review is a tool for posting AI-assisted code reviews to GitHub PRs. It supports three usage modes:

  1. Go SDK β€” Programmatic access for integration into other tools
  2. CLI β€” Command-line interface for scripts and manual use
  3. MCP Server β€” Model Context Protocol server for Claude Code integration

Reviews are posted as a GitHub App, appearing as PlexusOne Code Review[bot], clearly distinguishing AI-assisted reviews from human reviews.

Note: This is a community project by PlexusOne. It is not an official Anthropic product.

Features

  • πŸ€– GitHub App Integration β€” Reviews posted as a bot, not your personal account
  • πŸ“¦ Go SDK β€” Programmatic API via pkg/review
  • ⌨️ CLI β€” Full-featured command-line interface
  • πŸ”Œ MCP Server β€” Native integration with Claude Code
  • πŸ“‹ Multi-Agent Spec β€” Agent definition follows the multi-agent-spec format

Installation

CLI
go install github.com/plexusone/agent-code-review/cmd/acr@latest
Go SDK
go get github.com/plexusone/agent-code-review

Prerequisites

  1. Create a GitHub App (see GitHub App Setup)

  2. Configure authentication:

    export GITHUB_APP_ID=123456
    export GITHUB_INSTALLATION_ID=12345678
    export GITHUB_PRIVATE_KEY_PATH=~/.config/gogithub/private-key.pem
    

    Or create ~/.config/gogithub/app.json:

    {
      "app_id": 123456,
      "installation_id": 12345678,
      "private_key_path": "~/.config/gogithub/private-key.pem"
    }
    
Option 2: Personal Access Token
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx

CLI Usage

# List open PRs
acr list -o owner -r repo

# Get PR details
acr get 123 -o owner -r repo

# Get PR diff
acr diff 123 -o owner -r repo

# Post a review
acr review 123 -o owner -r repo -e APPROVE -b "LGTM!"
acr review 123 -o owner -r repo -e REQUEST_CHANGES -f review.md
echo "Great work!" | acr review 123 -o owner -r repo -e COMMENT

# Add a comment
acr comment 123 -o owner -r repo -b "Thanks for the contribution!"

# Run as MCP server
acr serve
Environment Variables
Variable Description
GITHUB_OWNER Default repository owner
GITHUB_REPO Default repository name
GITHUB_TOKEN Personal access token (fallback auth)
GITHUB_APP_ID GitHub App ID
GITHUB_INSTALLATION_ID GitHub App installation ID
GITHUB_PRIVATE_KEY_PATH Path to GitHub App private key

Go SDK Usage

package main

import (
    "context"
    "log"

    "github.com/grokify/gogithub/auth"
    "github.com/plexusone/agent-code-review/pkg/review"
)

func main() {
    ctx := context.Background()

    // Create client with GitHub App auth
    cfg, _ := auth.LoadAppConfig()
    client, _ := review.NewClientFromAppConfig(ctx, cfg)

    // Or with token auth
    // client := review.NewClientFromToken(ctx, "ghp_xxxx")

    // Post a review
    result, err := client.CreateReview(ctx, &review.ReviewInput{
        Owner:    "owner",
        Repo:     "repo",
        PRNumber: 123,
        Event:    review.EventApprove,
        Body:     "LGTM! Great work.",
    })
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("Review posted: %s", result.HTMLURL)
}

MCP Server Usage

Add to your Claude Code MCP configuration:

{
  "mcpServers": {
    "code-review": {
      "command": "acr",
      "args": ["serve"]
    }
  }
}
MCP Tools
Tool Description
review_pr Post a full code review (approve/comment/request-changes)
comment_pr Add a general comment to a PR
line_comment Comment on a specific line in the diff
get_pr_diff Fetch PR diff for analysis
get_pr Get PR metadata
list_prs List open PRs in a repository

GitHub App Setup

  1. Go to Settings β†’ Developer settings β†’ GitHub Apps β†’ New GitHub App

  2. Configure:

    Field Value
    Name PlexusOne Code Review (or your preferred name)
    Homepage URL https://github.com/plexusone/agent-code-review
    Webhook Disable (not needed for local use)
  3. Set permissions:

    Permission Access
    Pull requests Read & Write
    Contents Read
    Metadata Read
  4. Generate and download a private key

  5. Install the app on your repositories

  6. Note your App ID and Installation ID

Review Output Format

Reviews include a footer for transparency:

## Code Review Summary

[Review content...]

---
πŸ€– Powered by Claude β€’ PlexusOne Code Review

Project Structure

agent-code-review/
β”œβ”€β”€ cmd/acr/                 # CLI application
β”‚   β”œβ”€β”€ main.go
β”‚   └── cmd/
β”‚       β”œβ”€β”€ root.go
β”‚       β”œβ”€β”€ review.go
β”‚       β”œβ”€β”€ comment.go
β”‚       β”œβ”€β”€ diff.go
β”‚       β”œβ”€β”€ get.go
β”‚       β”œβ”€β”€ list.go
β”‚       └── serve.go
β”œβ”€β”€ pkg/review/              # Go SDK
β”‚   └── review.go
β”œβ”€β”€ internal/mcp/            # MCP server implementation
β”‚   └── server.go
β”œβ”€β”€ specs/agents/            # Agent definition (multi-agent-spec)
β”‚   └── code-reviewer.md
β”œβ”€β”€ go.mod
β”œβ”€β”€ go.sum
β”œβ”€β”€ LICENSE
└── README.md

Dependencies

  • gogithub β€” GitHub API wrapper with App authentication
  • go-sdk β€” Official MCP Go SDK
  • cobra β€” CLI framework

License

MIT


πŸ€– Powered by Claude β€” Built by PlexusOne

Directories ΒΆ

Path Synopsis
cmd
acr command
Package main provides the entry point for the agent-code-review CLI.
Package main provides the entry point for the agent-code-review CLI.
acr/cmd
Package cmd provides the CLI commands for agent-code-review.
Package cmd provides the CLI commands for agent-code-review.
internal
mcp
Package mcp provides the Model Context Protocol server implementation.
Package mcp provides the Model Context Protocol server implementation.
pkg
aireview
Package aireview provides AI-powered code review functionality.
Package aireview provides AI-powered code review functionality.
config
Package config provides configuration resolution for agent-code-review.
Package config provides configuration resolution for agent-code-review.
input
Package input provides input parsing utilities for agent-code-review.
Package input provides input parsing utilities for agent-code-review.
review
Package review provides a high-level API for GitHub code reviews.
Package review provides a high-level API for GitHub code reviews.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL