walk

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Overview

Package walk provides a visitor/walker pattern for traversing solution structures. It eliminates duplicated traversal logic across lint, dependency extraction, explain, and MCP tools by providing a single canonical Walk function with composable visitor callbacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(sol *solution.Solution, v *Visitor) error

Walk traverses the solution tree calling visitor callbacks in depth-first order. Map iterations (resolvers, actions, tests) are sorted by key for deterministic traversal.

Types

type Visitor

type Visitor struct {
	Solution           func(sol *solution.Solution) error
	Metadata           func(path string, meta *solution.Metadata) error
	Catalog            func(path string, cat *solution.Catalog) error
	Spec               func(path string, sp *solution.Spec) error
	Resolver           func(path, name string, r *resolver.Resolver) error
	ResolvePhase       func(path, resolverName string, rp *resolver.ResolvePhase) error
	TransformPhase     func(path, resolverName string, tp *resolver.TransformPhase) error
	ValidatePhase      func(path, resolverName string, vp *resolver.ValidatePhase) error
	ProviderSource     func(path string, ps *resolver.ProviderSource) error
	ProviderTransform  func(path string, pt *resolver.ProviderTransform) error
	ProviderValidation func(path string, pv *resolver.ProviderValidation) error
	Action             func(path, name, section string, act *action.Action) error
	Workflow           func(path string, w *action.Workflow) error
	ValueRef           func(path string, vr *spec.ValueRef) error
	Condition          func(path, conditionKind string, expr *celexp.Expression) error
	ForEach            func(path string, fe *spec.ForEachClause) error
	TestSuite          func(path string, ts *soltesting.TestSuite) error
	TestCase           func(path, name string, tc *soltesting.TestCase) error
}

Visitor defines optional callbacks for each node type in the solution tree. All fields are optional -- set only the callbacks you need. Return a non-nil error from any callback to abort the walk immediately.

Jump to

Keyboard shortcuts

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