agents

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeReviewer

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

CodeReviewer represents an AI-powered code reviewer agent. It uses large language models to provide intelligent code review feedback.

func NewCodeReviewer

func NewCodeReviewer() (*CodeReviewer, error)

NewCodeReviewer creates a new CodeReviewer instance with OpenRouter configuration. Requires OPENROUTER_API_KEY environment variable to be set.

func (*CodeReviewer) Review

func (cr *CodeReviewer) Review(
	cfg *config.Config, code string, filename string,
) (*ReviewResult, error)

Review performs a comprehensive code review on the provided code. Uses configured review guides and patterns to provide contextual feedback.

func (*CodeReviewer) ReviewDiff

func (cr *CodeReviewer) ReviewDiff(
	cfg *config.Config, diffData *git.DiffData, filename string,
) (*ReviewResult, error)

ReviewDiff performs a focused code review on the provided diff data. Analyzes only the changes rather than the full file, using diff-specific guides.

type ReviewResult

type ReviewResult struct {
	Suggestions  []Suggestion
	TokensUsed   int
	InputTokens  int
	OutputTokens int
	Cost         float64
}

ReviewResult holds the review content and token usage information from an LLM call. Provides details about the review content and associated costs.

type Suggestion added in v0.5.0

type Suggestion struct {
	ID         string `json:"id"`
	Title      string `json:"title"`
	Body       string `json:"body"`
	Original   string `json:"original,omitempty"`
	Suggestion string `json:"suggestion,omitempty"`
}

Suggestion represents a single review comment from the LLM.

Jump to

Keyboard shortcuts

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