execute

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package execute provides business logic for validating and executing solutions. This package is the shared domain layer used by CLI, MCP, and future API consumers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildExecutionData

func BuildExecutionData(
	resolverCtx *resolver.Context,
	resolvers []*resolver.Resolver,
	totalElapsed time.Duration,
) map[string]any

BuildExecutionData constructs structured execution metadata from resolver results. The returned map is extensible — new top-level sections can be added without breaking consumers (e.g. "diagrams", "timeline", "warnings").

func BuildProviderSummary

func BuildProviderSummary(
	resolverCtx *resolver.Context,
	resolvers []*resolver.Resolver,
) map[string]any

BuildProviderSummary aggregates per-provider usage statistics from resolver execution.

func CalculateValueSize

func CalculateValueSize(value any) int64

CalculateValueSize estimates the size of a value in bytes by JSON-marshalling it.

func FilterResolversWithDependencies

func FilterResolversWithDependencies(resolvers []*resolver.Resolver, targetNames []string, lookup resolver.DescriptorLookup) []*resolver.Resolver

FilterResolversWithDependencies returns the specified resolvers and all their dependencies. When targetNames is empty, all resolvers are returned. Uses resolver.ExtractDependencies to detect dependencies from CEL expressions, Go templates, explicit rslvr: references, and provider-specific extraction.

func RenderGraph

func RenderGraph(w io.Writer, graph GraphRenderer, data any, format string) error

RenderGraph renders a graph in the specified format using the GraphRenderer interface.

func ResolverProviderName

func ResolverProviderName(r *resolver.Resolver) string

ResolverProviderName extracts the primary provider name from a resolver.

Types

type GraphRenderer

type GraphRenderer interface {
	RenderASCII(w io.Writer) error
	RenderDOT(w io.Writer) error
	RenderMermaid(w io.Writer) error
}

GraphRenderer defines the interface for types that can render as ASCII, DOT, and Mermaid.

type ResolverExecutionConfig

type ResolverExecutionConfig struct {
	// Timeout is the default timeout per resolver.
	Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty" doc:"Default timeout per resolver"`

	// PhaseTimeout is the timeout for each execution phase.
	PhaseTimeout time.Duration `json:"phaseTimeout,omitempty" yaml:"phaseTimeout,omitempty" doc:"Timeout for each execution phase"`

	// MaxConcurrency limits concurrent resolver execution (0=unlimited).
	MaxConcurrency int `json:"maxConcurrency,omitempty" yaml:"maxConcurrency,omitempty" doc:"Maximum concurrent resolvers"`

	// WarnValueSize triggers a warning when resolver values exceed this size in bytes.
	WarnValueSize int64 `json:"warnValueSize,omitempty" yaml:"warnValueSize,omitempty" doc:"Warn when value exceeds this size"`

	// MaxValueSize rejects resolver values exceeding this size in bytes.
	MaxValueSize int64 `json:"maxValueSize,omitempty" yaml:"maxValueSize,omitempty" doc:"Reject values exceeding this size"`

	// ValidateAll validates all resolvers even if some fail.
	ValidateAll bool `json:"validateAll,omitempty" yaml:"validateAll,omitempty" doc:"Validate all resolvers even on failure"`

	// SkipValidation skips resolver validation.
	SkipValidation bool `json:"skipValidation,omitempty" yaml:"skipValidation,omitempty" doc:"Skip resolver validation"`

	// SkipTransform skips resolver transforms.
	SkipTransform bool `json:"skipTransform,omitempty" yaml:"skipTransform,omitempty" doc:"Skip resolver transforms"`

	// DryRun enables dry-run mode: providers return mock/no-op outputs
	// instead of performing real side effects.
	DryRun bool `json:"dryRun,omitempty" yaml:"dryRun,omitempty" doc:"Enable dry-run mode (providers return mock outputs)"`
}

ResolverExecutionConfig holds resolver execution parameters decoupled from CLI types. This allows the MCP server to configure resolver execution without constructing fake CLI scaffolding (IOStreams, flag sets, etc.).

func ResolverExecutionConfigFromContext

func ResolverExecutionConfigFromContext(ctx context.Context) ResolverExecutionConfig

ResolverExecutionConfigFromContext creates a ResolverExecutionConfig from the application config stored in context, providing sensible defaults.

type ResolverExecutionResult

type ResolverExecutionResult struct {
	// Data contains the resolved values keyed by resolver name.
	Data map[string]any `json:"data" yaml:"data" doc:"Resolved values"`

	// Context is the resolver execution context with full metadata.
	// Only available when execution succeeds.
	Context *resolver.Context `json:"-" yaml:"-"`
}

ResolverExecutionResult holds the structured output of resolver execution.

func Resolvers

Resolvers runs the resolver execution pipeline on the given solution. This standalone function decouples resolver execution from CLI-specific types (IOStreams, progress bars, output formatting). The MCP server uses this to execute resolvers and return structured results.

type ResolverRegistryAdapter

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

ResolverRegistryAdapter adapts provider.Registry to resolver.RegistryInterface.

func NewResolverRegistryAdapter

func NewResolverRegistryAdapter(registry *provider.Registry) *ResolverRegistryAdapter

NewResolverRegistryAdapter creates a new ResolverRegistryAdapter wrapping the given provider.Registry.

func (*ResolverRegistryAdapter) DescriptorLookup

func (r *ResolverRegistryAdapter) DescriptorLookup() resolver.DescriptorLookup

func (*ResolverRegistryAdapter) Get

func (*ResolverRegistryAdapter) List

func (*ResolverRegistryAdapter) Register

type SolutionValidationResult

type SolutionValidationResult struct {
	// Valid is true when the solution passes all validation checks.
	Valid bool `json:"valid" yaml:"valid" doc:"Whether the solution is valid"`

	// HasResolvers indicates whether the solution defines resolvers.
	HasResolvers bool `json:"hasResolvers" yaml:"hasResolvers" doc:"Whether the solution has resolvers"`

	// HasWorkflow indicates whether the solution defines an action workflow.
	HasWorkflow bool `json:"hasWorkflow" yaml:"hasWorkflow" doc:"Whether the solution has a workflow"`

	// Errors contains any validation errors found.
	Errors []string `json:"errors,omitempty" yaml:"errors,omitempty" doc:"Validation errors"`
}

SolutionValidationResult holds the structured results of validating a solution.

func ValidateSolution

ValidateSolution validates a loaded solution and its workflow against the given provider registry. This standalone function can be called from both the CLI and the MCP server without requiring CLI-specific types.

Jump to

Keyboard shortcuts

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