Help us shape the future of Go! Take the 2026 Go Developer Survey

stepflow

package
v0.243.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package stepflow executes transport-agnostic ordered step sequences. A dialect resolves its authorized leaves into Steps and supplies a Runner; stepflow preserves their order and threads explicit `as` bindings between them. It deliberately does not attach deployment policy to a sequence.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsetOptional = errors.New("optional input was not supplied")

ErrUnsetOptional reports a `$name` naming an input the caller omitted. Build validation rejects an undeclared ref, so a caller may drop the arg. #326.

Functions

func CoerceScalar

func CoerceScalar(s string) any

CoerceScalar lowers numeric inputs to the JSON number shape used by JMESPath.

func CondScope

func CondScope(jmesVars, bindings map[string]any) map[string]any

CondScope merges coerced inputs with completed step bindings. A binding wins over an equally named input.

func PlanCalls

func PlanCalls(ctx context.Context, steps []Step, resolve Resolve, sliceOf SliceOf, r Runner) ([]any, error)

PlanCalls renders each step for a dry run. Data-flow references are resolved by the supplied resolver, which normally preserves future bindings as hints.

func ResolveArg

func ResolveArg(value string, inputs map[string]string, bindings map[string]any) (string, error)

ResolveArg resolves a step argument: a literal, a `$input`, or a `$step.field` projection from a completed step response.

func ResolveArgDry

func ResolveArgDry(value string, inputs map[string]string) string

ResolveArgDry resolves an argument for a dry-run plan. Unavailable step output is left as a `${ref}` placeholder.

func Run

func Run(ctx context.Context, c *cli.Command, steps []Step, strVars map[string]string, sliceVars map[string][]string, r Runner) (bindings map[string]any, lastRaw []byte, err error)

Run executes steps in order and returns the successfully completed prefix. A failure stops the sequence; it does not infer a recovery action.

func ScalarToString

func ScalarToString(v any) string

ScalarToString renders a JMESPath scalar for a later argument.

func UnsetInputRef

func UnsetInputRef(value string, inputs map[string]string) bool

UnsetInputRef reports whether value is a bare `$name` naming an input the caller did not supply, so a dry plan can drop it exactly as a live call does.

Types

type Leaf

type Leaf interface {
	Label() string
}

Leaf is one resolved, authorized step target. The Runner that resolved it knows its concrete type (for example, an HTTP operation or exec grant).

type Resolve

type Resolve func(string) (string, error)

Resolve maps one argument value (a literal, $input, or $step.field) to its current bound string.

type Runner

type Runner interface {
	Fire(ctx context.Context, c *cli.Command, leaf Leaf, args []guardfile.ArgBind,
		resolve Resolve, sliceOf SliceOf) (decoded any, raw []byte, err error)
	Plan(ctx context.Context, leaf Leaf, args []guardfile.ArgBind,
		resolve Resolve, sliceOf SliceOf) (map[string]any, error)
}

Runner fires or plans one already-resolved step.

type SliceOf

type SliceOf func(string) ([]string, bool)

SliceOf reports whether an argument value references a list-valued input, and with what elements. Consulted before Resolve, so no list reaches scalar path.

func SliceRefs

func SliceRefs(sliceVars map[string][]string) SliceOf

SliceRefs builds a SliceOf over the list-valued inputs bound for this run. A step-output reference (`$step.field`) is never a list, only a declared array.

type Step

type Step struct {
	Leaf Leaf
	Args []guardfile.ArgBind
	As   string
}

Step is one resolved call in sequence order. As makes its decoded response available to later arguments as `$as.field`.

Jump to

Keyboard shortcuts

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