prepare

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: 18 Imported by: 0

Documentation

Overview

Package prepare provides a standalone function for loading and preparing a solution for execution. It decouples solution preparation from CLI-specific types, making it reusable by both CLI commands and the MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*prepareConfig)

Option configures the PrepareSolution function.

func WithAuthRegistry

func WithAuthRegistry(r *auth.Registry) Option

WithAuthRegistry provides an auth handler registry for registering auth handler plugins. If not set, auth handler plugin loading is skipped.

func WithGetter

func WithGetter(g get.Interface) Option

WithGetter provides a custom solution getter. If not set, one is created from context (with catalog resolution support).

func WithLockPlugins

func WithLockPlugins(plugins []bundler.LockPlugin) Option

WithLockPlugins provides lock file plugin entries for reproducible plugin resolution. When provided, pinned versions and digests are used instead of resolving constraints against catalogs.

func WithMetrics

func WithMetrics(out io.Writer) Option

WithMetrics enables metrics collection and specifies where to write metrics output.

func WithPluginFetcher

func WithPluginFetcher(f *plugin.Fetcher) Option

WithPluginFetcher provides a plugin fetcher for auto-fetching plugin binaries from catalogs at runtime. If not set, plugin auto-fetching is skipped (plugins must be available via --plugin-dir).

func WithRegistry

func WithRegistry(r *provider.Registry) Option

WithRegistry provides a custom provider registry. If not set, builtin.DefaultRegistry is used.

func WithStdin

func WithStdin(r io.Reader) Option

WithStdin provides a reader for stdin-based solution loading (path == "-").

type Result

type Result struct {
	// Solution is the loaded and prepared solution.
	Solution *solution.Solution `json:"solution" yaml:"solution" doc:"The loaded solution"`
	// Registry is the provider registry with all providers registered,
	// including the solution provider.
	Registry *provider.Registry `json:"-" yaml:"-"`
	// Cleanup must be deferred by the caller. It handles temp directory
	// removal, working directory restoration, and metrics output.
	Cleanup func() `json:"-" yaml:"-"`
}

Result holds the output of PrepareSolution.

func Solution

func Solution(ctx context.Context, path string, opts ...Option) (*Result, error)

Solution loads a solution from the given path, extracts any bundle, merges plugin defaults, sets up the provider registry, and registers the solution provider. The returned Result.Cleanup function must be deferred.

This function is the standalone equivalent of the CLI's sharedResolverOptions.prepareSolutionForExecution method, decoupled from CLI-specific types so it can be used by the MCP server and other callers.

Jump to

Keyboard shortcuts

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