pipeline

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pipeline provides the core pipeline engine for Simili-Bot. It defines the Step interface and Context structure used by all pipeline steps.

Package pipeline provides step registration and preset workflow building.

Index

Constants

This section is empty.

Variables

View Source
var ErrSkipPipeline = errors.New("skip remaining pipeline steps")

ErrSkipPipeline indicates that the pipeline should stop gracefully. This is not an error condition, just an early exit (e.g., cooldown, disabled repo).

View Source
var Presets = map[string][]string{

	"issue-triage": {
		"gatekeeper",
		"vectordb_prep",
		"similarity_search",
		"transfer_check",
		"triage",
		"response_builder",
		"action_executor",
		"pending_action_scheduler",
		"indexer",
	},

	"similarity-only": {
		"gatekeeper",
		"vectordb_prep",
		"similarity_search",
		"response_builder",
		"action_executor",
		"indexer",
	},

	"index-only": {
		"gatekeeper",
		"vectordb_prep",
		"indexer",
	},
}

Presets defines the built-in workflow presets.

Functions

func GetPreset

func GetPreset(name string) ([]string, bool)

GetPreset returns the step names for a preset workflow.

func ResolveSteps

func ResolveSteps(explicitSteps []string, workflow string) []string

ResolveSteps determines the steps to use based on config. Priority: explicit steps > workflow preset > default

Types

type Context

type Context struct {
	// Ctx is the Go context for cancellation and timeouts.
	Ctx context.Context

	// Issue is the issue being processed.
	Issue *Issue

	// Config is the loaded configuration.
	Config *config.Config

	// Result accumulates the processing results.
	Result *Result

	// SimilarIssues holds similar issues found by the similarity step.
	SimilarIssues []SimilarIssue

	// TransferTarget is the target repo if a transfer is determined.
	TransferTarget string

	// Metadata allows steps to pass arbitrary data to subsequent steps.
	Metadata map[string]interface{}
}

Context carries data through the pipeline steps.

func NewContext

func NewContext(ctx context.Context, issue *Issue, cfg *config.Config) *Context

NewContext creates a new pipeline context for an issue.

type Dependencies

type Dependencies struct {
	Embedder    *gemini.Embedder
	LLMClient   *gemini.LLMClient
	VectorStore qdrant.VectorStore
	GitHub      *github.Client
	DryRun      bool
}

Dependencies holds the dependencies that can be injected into steps.

func (*Dependencies) Close

func (d *Dependencies) Close() error

Close releases any resources held by the dependencies. It is safe to call multiple times; subsequent calls will be no-ops once all underlying resources have been closed.

type Issue

type Issue struct {
	Org    string
	Repo   string
	Number int
	Title  string
	Body   string
	State  string // "open" or "closed"
	Labels []string
	Author string
	URL    string
}

Issue represents a GitHub issue being processed.

type Pipeline

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

Pipeline executes a sequence of steps.

func New

func New(steps ...Step) *Pipeline

New creates a new pipeline with the given steps.

func (*Pipeline) AddStep

func (p *Pipeline) AddStep(step Step)

AddStep appends a step to the pipeline.

func (*Pipeline) Run

func (p *Pipeline) Run(ctx *Context) error

Run executes all steps in order. Stops on the first error (unless it's ErrSkipPipeline, which is graceful).

func (*Pipeline) Steps

func (p *Pipeline) Steps() []Step

Steps returns the list of steps (for introspection).

type Registry

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

Registry holds registered step factories. Step factories create Step instances, allowing for dependency injection.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new step registry.

func (*Registry) BuildFromNames

func (r *Registry) BuildFromNames(names []string, deps *Dependencies) (*Pipeline, error)

BuildFromNames creates a pipeline from a list of step names.

func (*Registry) Get

func (r *Registry) Get(name string) (StepFactory, bool)

Get retrieves a step factory by name.

func (*Registry) Register

func (r *Registry) Register(name string, factory StepFactory)

Register adds a step factory to the registry.

type Result

type Result struct {
	IssueNumber     int
	Skipped         bool
	SkipReason      string
	SimilarFound    []SimilarIssue
	TransferTarget  string
	Transferred     bool
	CommentPosted   bool
	Indexed         bool
	SuggestedLabels []string
	LabelsApplied   []string
	Errors          []error
}

Result holds the accumulated results from pipeline execution.

type SimilarIssue

type SimilarIssue struct {
	Number     int
	Title      string
	URL        string
	Similarity float64
	State      string
}

SimilarIssue represents an issue found to be similar.

type Step

type Step interface {
	// Name returns the unique identifier for this step.
	Name() string

	// Run executes the step's logic.
	// It should return ErrSkipPipeline to stop the pipeline gracefully,
	// or any other error to indicate failure.
	Run(ctx *Context) error
}

Step defines the interface that all pipeline steps must implement.

type StepFactory

type StepFactory func(deps *Dependencies) (Step, error)

StepFactory is a function that creates a Step. It receives dependencies (like clients, config) as parameters.

Jump to

Keyboard shortcuts

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