pipeline

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pipeline implements the pipeline stage engine for task workflow orchestration.

Plane: shared

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Pipelines map[string]Pipeline
}

Config holds all pipeline definitions.

func Load

func Load(configDir string) (*Config, error)

Load reads pipelines.toml from the ttal config directory. Uses toml.DecodeFile (NOT toml.Unmarshal which does not exist in BurntSushi/toml v1.x). Uses os.IsNotExist for missing file check (same pattern as internal/config/config.go).

func (*Config) HasReviewer added in v1.8.0

func (c *Config) HasReviewer(agentName string) bool

HasReviewer returns true if agentName is configured as a reviewer in any pipeline stage.

func (*Config) MatchPipeline

func (c *Config) MatchPipeline(taskTags []string) (string, *Pipeline, error)

MatchPipeline returns the pipeline name and definition matching the given task tags. Returns ("", nil, nil) if no pipeline matches. Returns an error if multiple pipelines match (tag overlap).

func (*Config) ReviewerForStage added in v1.7.1

func (c *Config) ReviewerForStage(taskTags []string, assigneeRole string) string

ReviewerForStage returns the Reviewer field of the first stage whose Assignee matches assigneeRole in the pipeline matching taskTags. Returns "" if no pipeline matches or no stage has the given assignee.

func (*Config) ReviewerNotifyTarget added in v1.7.1

func (c *Config) ReviewerNotifyTarget(agentName string) NotifyTarget

ReviewerNotifyTarget scans all pipelines to determine what notification target an agent maps to based on the stage type they review. Returns NotifyTargetCoder if the agent is a reviewer for a "coder" stage. Returns NotifyTargetDesigner if the agent is a reviewer for any other stage. Returns NotifyTargetNone if the agent is not a reviewer in any pipeline. If the agent reviews both coder and non-coder stages, NotifyTargetCoder wins.

func (*Config) SortedNames added in v1.9.0

func (c *Config) SortedNames() []string

SortedNames returns pipeline names in alphabetical order.

func (*Config) Summary added in v1.9.0

func (c *Config) Summary() string

Summary returns a formatted string listing all pipelines and their tags. Used in error messages to help agents pick the right pipeline tag.

type NotifyTarget added in v1.7.1

type NotifyTarget int

NotifyTarget represents the notification counterpart for a reviewer agent.

const (
	NotifyTargetNone     NotifyTarget = iota
	NotifyTargetCoder                 // reviewer reviews coder stages → notify coder
	NotifyTargetDesigner              // reviewer reviews non-coder stages → notify designer
)

type Pipeline

type Pipeline struct {
	Description string   `toml:"description"`
	Tags        []string `toml:"tags"` // task tags that select this pipeline
	Stages      []Stage  `toml:"stages"`
}

Pipeline defines a named pipeline with tag filters and stages.

func (*Pipeline) CurrentStage

func (p *Pipeline) CurrentStage(taskTags []string) (int, *Stage, error)

CurrentStage determines which pipeline stage is currently active by looking for monotonic stage tags. Each stage adds +<stagename> on entry and +<stagename>_lgtm on reviewer approval. The active stage is the latest stage tag without a corresponding _lgtm tag.

taskTags is the list of tags on the task.

Returns (stageIndex, *Stage, nil) if a stage is found. Returns (-1, nil, nil) if no stage tag matches — task not started.

func (*Pipeline) LastStage added in v1.8.0

func (p *Pipeline) LastStage() *Stage

LastStage returns the final stage in the pipeline.

func (*Pipeline) StageIndexForRole added in v1.9.0

func (p *Pipeline) StageIndexForRole(role string) int

StageIndexForRole returns the highest stage index whose Assignee matches the given role. "Highest" is intentional: the guard fires only when all stages for this role are behind the task's current stage. Using the last match ensures a role that spans multiple stages is not rejected until the task has passed every stage it owns. Returns -1 if no stage matches.

type Stage

type Stage struct {
	Name     string   `toml:"name"`
	Assignee string   `toml:"assignee"` // role from roles.toml (e.g. "designer") or "coder" (special)
	Gate     string   `toml:"gate"`     // "human" or "auto"
	Reviewer string   `toml:"reviewer"` // reviewer agent name (e.g. "plan-review-lead"), optional
	Skills   []string `toml:"skills"`   // skill names loaded via ttal skill get (optional)
}

Stage defines a single stage in a pipeline.

func (*Stage) StageLGTMTag added in v1.8.0

func (s *Stage) StageLGTMTag() string

StageLGTMTag returns the lgtm tag for this stage (<stagename>_lgtm).

func (*Stage) StageTag added in v1.8.0

func (s *Stage) StageTag() string

StageTag returns the lowercased stage name used as a taskwarrior tag.

Jump to

Keyboard shortcuts

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