run

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidOutputTypes = kvx.BaseOutputFormats()

ValidOutputTypes defines the supported output formats

Functions

func CommandProvider added in v0.2.0

func CommandProvider(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandProvider creates the 'run provider' subcommand

func CommandResolver added in v0.2.0

func CommandResolver(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandResolver creates the 'run resolver' subcommand

func CommandRun

func CommandRun(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandRun creates the 'run' command that executes solutions and other runnable artifacts.

func CommandSolution

func CommandSolution(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandSolution creates the 'run solution' subcommand

func LoadParameterFile

func LoadParameterFile(path string) (map[string]any, error)

LoadParameterFile loads parameters from a YAML or JSON file. The file format is auto-detected based on extension, or by trying YAML first then JSON if the extension is not recognized.

func ParseResolverFlags

func ParseResolverFlags(values []string) (map[string]any, error)

ParseResolverFlags parses -r flag values, handling both key=value syntax and @file.yaml syntax for loading parameters from files.

Supported formats:

  • key=value: Simple key-value pair
  • key=value1,value2: Multiple values (becomes an array)
  • @file.yaml: Load all parameters from a YAML file
  • @file.json: Load all parameters from a JSON file

Multiple values for the same key are automatically combined into an array.

Types

type ActionProgressCallback

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

ActionProgressCallback implements action.ProgressCallback for CLI output

func NewActionProgressCallback

func NewActionProgressCallback(out io.Writer) *ActionProgressCallback

NewActionProgressCallback creates a new action progress callback

func (*ActionProgressCallback) OnActionCancelled

func (a *ActionProgressCallback) OnActionCancelled(actionName string)

func (*ActionProgressCallback) OnActionComplete

func (a *ActionProgressCallback) OnActionComplete(actionName string, _ any)

func (*ActionProgressCallback) OnActionFailed

func (a *ActionProgressCallback) OnActionFailed(actionName string, err error)

func (*ActionProgressCallback) OnActionSkipped

func (a *ActionProgressCallback) OnActionSkipped(actionName, reason string)

func (*ActionProgressCallback) OnActionStart

func (a *ActionProgressCallback) OnActionStart(actionName string)

func (*ActionProgressCallback) OnActionTimeout

func (a *ActionProgressCallback) OnActionTimeout(actionName string, timeout time.Duration)

func (*ActionProgressCallback) OnFinallyComplete

func (a *ActionProgressCallback) OnFinallyComplete()

func (*ActionProgressCallback) OnFinallyStart

func (a *ActionProgressCallback) OnFinallyStart()

func (*ActionProgressCallback) OnForEachProgress

func (a *ActionProgressCallback) OnForEachProgress(actionName string, completed, total int)

func (*ActionProgressCallback) OnPhaseComplete

func (a *ActionProgressCallback) OnPhaseComplete(phase int)

func (*ActionProgressCallback) OnPhaseStart

func (a *ActionProgressCallback) OnPhaseStart(phase int, actionNames []string)

func (*ActionProgressCallback) OnRetryAttempt

func (a *ActionProgressCallback) OnRetryAttempt(actionName string, attempt, maxAttempts int, err error)

type ProgressCallback

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

ProgressCallback provides a callback interface that can be used with the executor. This allows the progress reporter to be notified of execution events.

func NewProgressCallback

func NewProgressCallback(reporter *ProgressReporter) *ProgressCallback

NewProgressCallback creates a new progress callback wrapping the given reporter.

func (*ProgressCallback) OnPhaseStart

func (c *ProgressCallback) OnPhaseStart(phaseNum int, resolverNames []string)

OnPhaseStart is called when a new execution phase begins.

func (*ProgressCallback) OnResolverComplete

func (c *ProgressCallback) OnResolverComplete(resolverName string)

OnResolverComplete is called when a resolver completes successfully.

func (*ProgressCallback) OnResolverFailed

func (c *ProgressCallback) OnResolverFailed(resolverName string, err error)

OnResolverFailed is called when a resolver fails.

func (*ProgressCallback) OnResolverSkipped

func (c *ProgressCallback) OnResolverSkipped(resolverName string)

OnResolverSkipped is called when a resolver is skipped.

type ProgressReporter

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

ProgressReporter outputs execution progress using mpb. It provides visual feedback during resolver execution by displaying progress bars for each resolver in the current phase.

func NewProgressReporter

func NewProgressReporter(writer io.Writer, total int) *ProgressReporter

NewProgressReporter creates a new progress reporter writing to the given output. The total parameter indicates the total number of resolvers to be executed.

func (*ProgressReporter) Complete

func (p *ProgressReporter) Complete(resolverName string)

Complete marks a resolver as successfully completed.

func (*ProgressReporter) Failed

func (p *ProgressReporter) Failed(resolverName string, _ error)

Failed marks a resolver as failed with the given error.

func (*ProgressReporter) Skipped

func (p *ProgressReporter) Skipped(resolverName string)

Skipped marks a resolver as skipped (e.g., due to when condition).

func (*ProgressReporter) StartPhase

func (p *ProgressReporter) StartPhase(phaseNum int, resolverNames []string)

StartPhase creates progress bars for all resolvers in a phase. This should be called at the beginning of each execution phase.

func (*ProgressReporter) TotalDuration

func (p *ProgressReporter) TotalDuration() time.Duration

TotalDuration returns the elapsed time since the reporter was created.

func (*ProgressReporter) Wait

func (p *ProgressReporter) Wait() time.Duration

Wait waits for all progress bars to complete and returns the total duration.

type ProviderOptions added in v0.2.0

type ProviderOptions struct {
	IOStreams *terminal.IOStreams
	CliParams *settings.Run

	// kvx output integration
	flags.KvxOutputFlags

	// ProviderName is the name of the provider to execute (positional arg).
	ProviderName string

	// InputParams are the provider input parameters (--input key=value or --input @file.yaml).
	InputParams []string

	// Capability specifies which capability to execute.
	// Defaults to the first capability declared by the provider.
	Capability string

	// DryRun shows what would be executed without running the provider.
	DryRun bool

	// PluginDirs are directories to scan for plugin providers.
	PluginDirs []string

	// ShowMetrics shows provider execution metrics after completion.
	ShowMetrics bool

	// Redact redacts sensitive fields in the output.
	Redact bool
}

ProviderOptions holds configuration for the run provider command

func (*ProviderOptions) Run added in v0.2.0

func (o *ProviderOptions) Run(ctx context.Context) error

Run executes a single provider directly

type ResolverOptions added in v0.2.0

type ResolverOptions struct {

	// Names is the list of resolver names to execute (positional args).
	// If empty, all resolvers are executed.
	Names []string

	// SkipTransform skips the transform and validation phases,
	// returning raw resolved values.
	SkipTransform bool

	// DryRun shows the execution plan without running providers.
	DryRun bool

	// Graph renders the resolver dependency graph instead of executing.
	Graph bool

	// GraphFormat controls the graph rendering format (ascii, dot, mermaid, json).
	GraphFormat string

	// Snapshot saves an execution snapshot to a file instead of normal output.
	Snapshot bool

	// SnapshotFile is the path to write the snapshot file.
	SnapshotFile string

	// Redact redacts sensitive values in the snapshot.
	Redact bool
	// contains filtered or unexported fields
}

ResolverOptions holds configuration for the run resolver command

func (*ResolverOptions) Run added in v0.2.0

func (o *ResolverOptions) Run(ctx context.Context) error

Run executes the resolver-only flow

type SolutionOptions

type SolutionOptions struct {

	// Action execution options
	ActionTimeout        time.Duration
	MaxActionConcurrency int
	DryRun               bool

	// ShowExecution enables __execution metadata in output
	ShowExecution bool
	// contains filtered or unexported fields
}

SolutionOptions holds configuration for the run solution command

func (*SolutionOptions) Run

func (o *SolutionOptions) Run(ctx context.Context) error

Run executes the solution

Jump to

Keyboard shortcuts

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