review

package
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 Imports: 5 Imported by: 0

Documentation

Overview

Package review provides a high-level API for GitHub code reviews.

Index

Constants

View Source
const ReviewFooter = "\n\n---\n<sub>🤖 Powered by Claude • PlexusOne Code Review</sub>"

ReviewFooter is appended to all reviews for transparency.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides code review operations.

func NewClient

func NewClient(gh *github.Client) *Client

NewClient creates a new review client from a GitHub client.

func NewClientFromAppConfig

func NewClientFromAppConfig(ctx context.Context, cfg *auth.AppConfig) (*Client, error)

NewClientFromAppConfig creates a new review client using GitHub App authentication.

func NewClientFromToken

func NewClientFromToken(ctx context.Context, token string) *Client

NewClientFromToken creates a new review client using a personal access token.

func (*Client) Approve

func (c *Client) Approve(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)

Approve approves a pull request with an optional comment.

func (*Client) Comment

func (c *Client) Comment(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)

Comment adds a review comment without approval or rejection.

func (*Client) CreateComment

func (c *Client) CreateComment(ctx context.Context, input *CommentInput) (*CommentResult, error)

CreateComment adds a general comment to a pull request. The review footer is automatically appended to the body.

func (*Client) CreateLineComment

func (c *Client) CreateLineComment(ctx context.Context, input *LineCommentInput) (*CommentResult, error)

CreateLineComment adds a comment on a specific line in a PR diff.

func (*Client) CreateReview

func (c *Client) CreateReview(ctx context.Context, input *ReviewInput) (*ReviewResult, error)

CreateReview posts a code review to a pull request. The review footer is automatically appended to the body.

func (*Client) GetPR

func (c *Client) GetPR(ctx context.Context, owner, repo string, number int) (*PRInfo, error)

GetPR retrieves pull request details.

func (*Client) GetPRDiff

func (c *Client) GetPRDiff(ctx context.Context, owner, repo string, number int) (string, error)

GetPRDiff retrieves the diff for a pull request.

func (*Client) ListOpenPRs

func (c *Client) ListOpenPRs(ctx context.Context, owner, repo string) ([]PRSummary, error)

ListOpenPRs lists open pull requests in a repository.

func (*Client) RequestChanges

func (c *Client) RequestChanges(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)

RequestChanges requests changes on a pull request.

type CommentInput

type CommentInput struct {
	Owner    string
	Repo     string
	PRNumber int
	Body     string
}

CommentInput contains parameters for creating a PR comment.

type CommentResult

type CommentResult struct {
	ID      int64
	HTMLURL string
}

CommentResult contains the result of a comment operation.

type LineCommentInput

type LineCommentInput struct {
	Owner    string
	Repo     string
	PRNumber int
	CommitID string
	Path     string
	Line     int
	Body     string
}

LineCommentInput contains parameters for creating a line comment.

type PRInfo

type PRInfo struct {
	Number  int
	Title   string
	Body    string
	State   string
	Author  string
	Head    string
	Base    string
	Commits int
	HTMLURL string
}

PRInfo contains pull request information.

type PRSummary

type PRSummary struct {
	Number  int
	Title   string
	Author  string
	Head    string
	HTMLURL string
}

PRSummary contains basic pull request information for listings.

type ReviewEvent

type ReviewEvent string

ReviewEvent represents the type of review action.

const (
	// EventApprove approves the pull request.
	EventApprove ReviewEvent = "APPROVE"
	// EventRequestChanges requests changes to the pull request.
	EventRequestChanges ReviewEvent = "REQUEST_CHANGES"
	// EventComment adds a review comment without approval or rejection.
	EventComment ReviewEvent = "COMMENT"
)

type ReviewInput

type ReviewInput struct {
	Owner    string
	Repo     string
	PRNumber int
	Event    ReviewEvent
	Body     string
}

ReviewInput contains parameters for creating a review.

type ReviewResult

type ReviewResult struct {
	ID      int64
	HTMLURL string
}

ReviewResult contains the result of a review operation.

Jump to

Keyboard shortcuts

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