code

package
v1.44.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package code configures and registers optional PR code reviews with GitHub verdicts. It owns the prompt, model, and schedule; workflow supplies the shared consent, source lookup, reply template, and publication safeguards.

Index

Constants

This section is empty.

Variables

Module registers the exact command and its optional independent queue job.

Functions

func Register added in v1.41.0

func Register(dispatcher *commands.Dispatcher, schedules *scheduler.Scheduler, command *Command) error

Register adds the concurrent code review handler and its independent, queue-triggered job before startup. A nil command only registers the disabled handler for rejection feedback.

Types

type Command

type Command struct {
	// Command supplies shared consent, source access, publication, and a queue dedicated to code reviews.
	*workflow.Command
	// contains filtered or unexported fields
}

Command keeps code review configuration and registration feature-owned. The embedded workflow command supplies consent checks and an independent queue.

func NewCommand

func NewCommand(params CommandParams) (*Command, error)

NewCommand constructs the optional code review using the shared workflow. Omitted configuration returns nil; enabled reviews require a provider.

func (*Command) Handle added in v0.53.0

func (c *Command) Handle(ctx context.Context, event *github.IssueCommentEvent) (bool, error)

Handle declines disabled reviews through a nil receiver, preserving command reaction feedback. Enabled commands delegate authorization to the workflow.

type CommandParams added in v0.53.0

type CommandParams struct {
	// In marks this struct as an injected dependency group.
	signal.In

	// Config enables code reviews and selects their model and schedule.
	Config *Config

	// Workflow constructs commands sharing source access and verdict publication.
	Workflow *workflow.Factory
}

CommandParams supplies code review configuration and shared workflow dependencies.

type Config

type Config struct {
	// ModelConfig selects the code review provider, model, and optional effort.
	ai.ModelConfig `yaml:",inline" json:",inline" toml:",inline"`

	// Config provides independent job timing; zero values use a thirty-second interval and two-minute timeout.
	scheduler.Config `yaml:",inline" json:",inline" toml:",inline"`
}

Config selects the code review model and independent job schedule. Omit the block to disable code reviews. Zero durations use 30s and 2m.

func (*Config) GetInterval

func (c *Config) GetInterval() time.Duration

GetInterval returns the code review interval, defaulting to thirty seconds when zero. Config must be non-nil.

func (*Config) GetTimeout

func (c *Config) GetTimeout() time.Duration

GetTimeout returns the complete code review job's timeout, defaulting to two minutes when zero. Config must be non-nil.

func (*Config) IsEnabled added in v0.53.0

func (c *Config) IsEnabled() bool

IsEnabled reports whether code review configuration is present.

Jump to

Keyboard shortcuts

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