builders

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: EUPL-1.2 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionServiceBuilder

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

ExecutionServiceBuilder provides a fluent API for constructing ExecutionService instances with sensible defaults, following the MockProvider pattern (ADR-003). Reduces test setup from 30+ lines to 2-3 lines (93% reduction). Thread-safe: uses sync.RWMutex to protect concurrent access.

func NewExecutionServiceBuilder

func NewExecutionServiceBuilder() *ExecutionServiceBuilder

NewExecutionServiceBuilder creates a new ExecutionServiceBuilder with default dependencies. All dependencies default to mock implementations suitable for testing.

func (*ExecutionServiceBuilder) Build

Build constructs the ExecutionService with the configured dependencies. Uses sensible defaults for any components not explicitly set. Returns a fully initialized ExecutionService ready for testing.

func (*ExecutionServiceBuilder) WithAgentRegistry

func (b *ExecutionServiceBuilder) WithAgentRegistry(registry ports.AgentRegistry) *ExecutionServiceBuilder

WithAgentRegistry configures the agent registry for the ExecutionService. If nil, a default AgentRegistry will be created.

func (*ExecutionServiceBuilder) WithEvaluator

func (b *ExecutionServiceBuilder) WithEvaluator(evaluator interface{}) *ExecutionServiceBuilder

WithEvaluator configures the expression evaluator for conditional transitions. Accepts application.ExpressionEvaluator interface for evaluating "when" clauses.

func (*ExecutionServiceBuilder) WithExecutor

WithExecutor configures the command executor for the ExecutionService. If nil, a default MockCommandExecutor will be used.

func (*ExecutionServiceBuilder) WithLogger

WithLogger configures the logger for the ExecutionService. If nil, a default MockLogger will be used.

func (*ExecutionServiceBuilder) WithOutputWriters

func (b *ExecutionServiceBuilder) WithOutputWriters(stdout, stderr io.Writer) *ExecutionServiceBuilder

WithOutputWriters configures stdout and stderr writers for the ExecutionService. If nil, default writers will be used (typically os.Stdout/os.Stderr).

func (*ExecutionServiceBuilder) WithStateStore

WithStateStore configures the state store for the ExecutionService. If nil, a default MockStateStore will be used.

func (*ExecutionServiceBuilder) WithValidator

WithValidator configures the expression validator for workflow validation. If nil, no expression validation will be performed (safe for tests not exercising ValidateWorkflow).

func (*ExecutionServiceBuilder) WithWorkflowRepository

func (b *ExecutionServiceBuilder) WithWorkflowRepository(repository ports.WorkflowRepository) *ExecutionServiceBuilder

WithWorkflowRepository configures the workflow repository for the ExecutionService. If nil, a default MockWorkflowRepository will be used.

type StepBuilder

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

StepBuilder provides a fluent API for constructing Step instances with sensible defaults for different step types. Supports all step types: command, parallel, terminal, for_each, while, operation, call_workflow, agent.

func NewCommandStep

func NewCommandStep(name, command string) *StepBuilder

NewCommandStep creates a new StepBuilder for a command step.

func NewParallelStep

func NewParallelStep(name string, branches ...string) *StepBuilder

NewParallelStep creates a new StepBuilder for a parallel step.

func NewStepBuilder

func NewStepBuilder(name string) *StepBuilder

NewStepBuilder creates a new StepBuilder with minimal defaults. Default step is a terminal step with success status.

func NewTerminalStep

func NewTerminalStep(name string, status workflow.TerminalStatus) *StepBuilder

NewTerminalStep creates a new StepBuilder for a terminal step.

func (*StepBuilder) Build

func (b *StepBuilder) Build() *workflow.Step

Build returns the constructed Step.

func (*StepBuilder) WithAgent

func (b *StepBuilder) WithAgent(agent *workflow.AgentConfig) *StepBuilder

WithAgent sets AI agent configuration for agent-type steps.

func (*StepBuilder) WithBranches

func (b *StepBuilder) WithBranches(branches ...string) *StepBuilder

WithBranches sets the branches for parallel-type steps.

func (*StepBuilder) WithCallWorkflow

func (b *StepBuilder) WithCallWorkflow(config *workflow.CallWorkflowConfig) *StepBuilder

WithCallWorkflow sets sub-workflow configuration for call_workflow steps.

func (*StepBuilder) WithCapture

func (b *StepBuilder) WithCapture(capture *workflow.CaptureConfig) *StepBuilder

WithCapture sets output capture configuration.

func (*StepBuilder) WithCommand

func (b *StepBuilder) WithCommand(command string) *StepBuilder

WithCommand sets the command for command-type steps.

func (*StepBuilder) WithContinueOnError

func (b *StepBuilder) WithContinueOnError(continueOnError bool) *StepBuilder

WithContinueOnError sets whether to continue on error.

func (*StepBuilder) WithDependsOn

func (b *StepBuilder) WithDependsOn(deps ...string) *StepBuilder

WithDependsOn sets step dependencies.

func (*StepBuilder) WithDescription

func (b *StepBuilder) WithDescription(description string) *StepBuilder

WithDescription sets the step description.

func (*StepBuilder) WithDir

func (b *StepBuilder) WithDir(dir string) *StepBuilder

WithDir sets the working directory for command execution.

func (*StepBuilder) WithExitCode

func (b *StepBuilder) WithExitCode(code int) *StepBuilder

WithExitCode sets the process exit code for terminal-type steps (FR-004). Defaults to 0; inline error terminals default to 1 at parse time.

func (*StepBuilder) WithLoop

func (b *StepBuilder) WithLoop(loop *workflow.LoopConfig) *StepBuilder

WithLoop sets loop configuration for for_each and while steps.

func (*StepBuilder) WithMaxConcurrent

func (b *StepBuilder) WithMaxConcurrent(maxConcurrent int) *StepBuilder

WithMaxConcurrent sets the maximum concurrent branches for parallel steps.

func (*StepBuilder) WithMessage

func (b *StepBuilder) WithMessage(message string) *StepBuilder

WithMessage sets the message template for terminal-type steps. The message is stored as-is and interpolated at runtime.

func (*StepBuilder) WithOnFailure

func (b *StepBuilder) WithOnFailure(nextState string) *StepBuilder

WithOnFailure sets the next state on failure (legacy).

func (*StepBuilder) WithOnSuccess

func (b *StepBuilder) WithOnSuccess(nextState string) *StepBuilder

WithOnSuccess sets the next state on success (legacy).

func (*StepBuilder) WithOperation

func (b *StepBuilder) WithOperation(operation string, inputs map[string]any) *StepBuilder

WithOperation sets operation details for operation-type steps.

func (*StepBuilder) WithRetry

func (b *StepBuilder) WithRetry(retry *workflow.RetryConfig) *StepBuilder

WithRetry sets retry configuration.

func (*StepBuilder) WithScriptFile

func (b *StepBuilder) WithScriptFile(scriptFile string) *StepBuilder

WithScriptFile sets the script_file field for the step.

func (*StepBuilder) WithStatus

func (b *StepBuilder) WithStatus(status workflow.TerminalStatus) *StepBuilder

WithStatus sets the terminal status for terminal-type steps.

func (*StepBuilder) WithStrategy

func (b *StepBuilder) WithStrategy(strategy string) *StepBuilder

WithStrategy sets the parallel execution strategy.

func (*StepBuilder) WithTimeout

func (b *StepBuilder) WithTimeout(seconds int) *StepBuilder

WithTimeout sets the step timeout in seconds.

func (*StepBuilder) WithTransitions

func (b *StepBuilder) WithTransitions(transitions workflow.Transitions) *StepBuilder

WithTransitions sets conditional transitions.

func (*StepBuilder) WithType

func (b *StepBuilder) WithType(stepType workflow.StepType) *StepBuilder

WithType sets the step type.

type WorkflowBuilder

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

WorkflowBuilder provides a fluent API for constructing Workflow instances with sensible defaults, following the builder pattern (ADR-003). Simplifies test workflow creation with progressive configuration.

func NewWorkflowBuilder

func NewWorkflowBuilder() *WorkflowBuilder

NewWorkflowBuilder creates a new WorkflowBuilder with sensible defaults. Default workflow has: - Name: "test-workflow" - Initial: "start" - One step named "start" of type terminal with success status

func (*WorkflowBuilder) Build

func (b *WorkflowBuilder) Build() *workflow.Workflow

Build returns the constructed Workflow.

func (*WorkflowBuilder) WithAuthor

func (b *WorkflowBuilder) WithAuthor(author string) *WorkflowBuilder

WithAuthor sets the workflow author.

func (*WorkflowBuilder) WithDescription

func (b *WorkflowBuilder) WithDescription(description string) *WorkflowBuilder

WithDescription sets the workflow description.

func (*WorkflowBuilder) WithEnv

func (b *WorkflowBuilder) WithEnv(vars ...string) *WorkflowBuilder

WithEnv adds required environment variables.

func (*WorkflowBuilder) WithInitial

func (b *WorkflowBuilder) WithInitial(initial string) *WorkflowBuilder

WithInitial sets the initial state name.

func (*WorkflowBuilder) WithInput

func (b *WorkflowBuilder) WithInput(input *workflow.Input) *WorkflowBuilder

WithInput adds an input parameter to the workflow.

func (*WorkflowBuilder) WithName

func (b *WorkflowBuilder) WithName(name string) *WorkflowBuilder

WithName sets the workflow name.

func (*WorkflowBuilder) WithStep

func (b *WorkflowBuilder) WithStep(step *workflow.Step) *WorkflowBuilder

WithStep adds a step to the workflow. If a step with the same name exists, it is replaced.

func (*WorkflowBuilder) WithSteps

func (b *WorkflowBuilder) WithSteps(steps ...*workflow.Step) *WorkflowBuilder

WithSteps adds multiple steps to the workflow.

func (*WorkflowBuilder) WithTags

func (b *WorkflowBuilder) WithTags(tags ...string) *WorkflowBuilder

WithTags sets the workflow tags.

func (*WorkflowBuilder) WithVersion

func (b *WorkflowBuilder) WithVersion(version string) *WorkflowBuilder

WithVersion sets the workflow version.

Jump to

Keyboard shortcuts

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