workflow

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package workflow provides workflow orchestration for multi-step releases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Dir         string            // Working directory
	Version     string            // Target version
	DryRun      bool              // If true, don't make changes
	Verbose     bool              // Show detailed output
	Interactive bool              // Enable interactive mode
	JSONOutput  bool              // Output JSON for Claude Code
	SkipChecks  bool              // Skip validation checks
	SkipCI      bool              // Skip CI wait
	Data        map[string]string // Arbitrary data passed between steps
	Output      *strings.Builder  // Captured output
}

Context provides context for step execution.

func NewContext

func NewContext(dir string, version string) *Context

NewContext creates a new workflow context.

func (*Context) Log

func (c *Context) Log(format string, args ...interface{})

Log writes a message to the context output.

type JSONResult

type JSONResult struct {
	Type         string           `json:"type" toon:"type"`
	WorkflowName string           `json:"workflow_name" toon:"workflow_name"`
	Success      bool             `json:"success" toon:"success"`
	Duration     string           `json:"duration" toon:"duration"`
	Steps        []JSONStepResult `json:"steps" toon:"steps"`
}

JSONResult represents a workflow result in structured format.

type JSONStepResult

type JSONStepResult struct {
	Name     string           `json:"name" toon:"name"`
	Success  bool             `json:"success" toon:"success"`
	Skipped  bool             `json:"skipped,omitempty" toon:"skipped,omitempty"`
	Error    string           `json:"error,omitempty" toon:"error,omitempty"`
	Duration string           `json:"duration" toon:"duration"`
	SubSteps []JSONStepResult `json:"sub_steps,omitempty" toon:"sub_steps,omitempty"`
}

JSONStepResult represents a step result in structured format.

type Runner

type Runner struct {
	DryRun      bool
	Verbose     bool
	Interactive bool
	JSONOutput  bool
}

Runner executes workflows.

func NewRunner

func NewRunner() *Runner

NewRunner creates a new workflow runner.

func (*Runner) Run

func (r *Runner) Run(w *Workflow, ctx *Context) *WorkflowResult

Run executes a workflow and returns the results.

type Step

type Step struct {
	Name        string   // Step name for display
	Description string   // Human-readable description
	Type        StepType // Step type
	Required    bool     // If true, workflow fails if step fails
	Func        StepFunc // Function to execute (for StepTypeFunc)
	SubSteps    []Step   // Sub-steps (for StepTypeComposite)
}

Step represents a single step in a workflow.

type StepFunc

type StepFunc func(ctx *Context) error

StepFunc is a function that executes a step. It receives the context and returns an error if the step fails.

type StepResult

type StepResult struct {
	Name     string
	Success  bool
	Skipped  bool
	Error    error
	Output   string
	Duration time.Duration
	SubSteps []StepResult // Results of sub-steps (for composite)
}

StepResult represents the result of a step execution.

type StepType

type StepType int

StepType defines the type of workflow step.

const (
	// StepTypeFunc is a step that runs a function.
	StepTypeFunc StepType = iota
	// StepTypeComposite is a step that contains sub-steps.
	StepTypeComposite
)

type Workflow

type Workflow struct {
	Name        string
	Description string
	Steps       []Step
}

Workflow defines a sequence of steps.

func ReleaseWorkflow

func ReleaseWorkflow(version string) *Workflow

ReleaseWorkflow creates a workflow for releasing a new version.

type WorkflowResult

type WorkflowResult struct {
	Name     string
	Success  bool
	Steps    []StepResult
	Duration time.Duration
	Output   string
}

WorkflowResult represents the result of a workflow execution.

func (*WorkflowResult) Summary

func (wr *WorkflowResult) Summary() string

Summary returns a summary of the workflow result.

func (*WorkflowResult) ToJSON

func (wr *WorkflowResult) ToJSON() JSONResult

ToJSON converts the workflow result to a JSON-serializable structure.

Jump to

Keyboard shortcuts

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