review

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFileReviewPrompt

func BuildFileReviewPrompt(
	batch FileBatch,
	walkthroughSummary string,
	branchName string,
	strictness string,
	guidelines string,
) string

BuildFileReviewPrompt builds the pass-2 prompt that asks for detailed per-file review of a batch of enriched files.

func BuildWalkthroughPrompt

func BuildWalkthroughPrompt(
	branchName, baseBranch string,
	files []CategorizedFile,
	diffStat string,
	strictness string,
	guidelines string,
) string

BuildWalkthroughPrompt builds the pass-1 prompt that asks the AI for a high-level walkthrough summary of all changes.

func FormatBranchReview

func FormatBranchReview(result *BranchReviewResult) string

FormatBranchReview formats a BranchReviewResult into CLI-friendly markdown.

Types

type BranchReviewResult

type BranchReviewResult struct {
	BranchName     string
	BaseBranch     string
	Walkthrough    WalkthroughResult
	FileReviews    []FileReviewResult
	TotalFiles     int
	TotalAdditions int
	TotalDeletions int
}

BranchReviewResult is the complete output of a branch review.

func RunBranchReview

func RunBranchReview(
	ctx context.Context,
	aiProvider provider.AIProvider,
	repoPath string,
	branchName string,
	baseBranch string,
	cfg ReviewConfig,
	onProgress ProgressCallback,
) (*BranchReviewResult, error)

RunBranchReview executes the full two-pass review pipeline.

type CategorizedFile

type CategorizedFile struct {
	diffparse.EnrichedFileChange
	Category string // "New", "Modified", "Deleted", "Renamed", "Binary"
	Group    string // "tests", "commands", "core", "docs", "dependencies", "ci/config"
}

CategorizedFile is an enriched file change with category and group metadata.

func CategorizeChanges

func CategorizeChanges(changes []diffparse.EnrichedFileChange) []CategorizedFile

CategorizeChanges assigns category and group to each enriched file change.

type FileBatch

type FileBatch struct {
	Files       []CategorizedFile
	TotalTokens int
	// contains filtered or unexported fields
}

FileBatch is a group of files that fit within the token budget.

func BatchFiles

func BatchFiles(files []CategorizedFile, maxTokens int) []FileBatch

BatchFiles groups categorized files into batches that fit within maxTokens. Uses first-fit-decreasing bin packing.

type FileReviewResult

type FileReviewResult struct {
	FilePath string
	Comments []core.FileComment
	Summary  string
}

FileReviewResult holds the review output for a single file.

type ProgressCallback

type ProgressCallback func(stage string, current, total int)

ProgressCallback reports pipeline progress to the CLI.

type ReviewConfig

type ReviewConfig struct {
	ContextLines   int    // default 10
	MaxBatchTokens int    // default 80000
	Strictness     string // "strict"/"normal"/"lenient"
	CommitByCommit bool
	SerenaMode     string // "auto"/"on"/"off"
	Guidelines     string // repository-specific review instructions
	Debug          bool
}

ReviewConfig holds configuration for the branch review pipeline.

func DefaultReviewConfig

func DefaultReviewConfig() ReviewConfig

DefaultReviewConfig returns a ReviewConfig with sensible defaults.

type WalkthroughResult

type WalkthroughResult struct {
	Summary      string
	ChangesTable string
	RawContent   string
}

WalkthroughResult holds the pass-1 walkthrough summary.

Jump to

Keyboard shortcuts

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