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 ¶
- type Option
- func WithAuthRegistry(r *auth.Registry) Option
- func WithGetter(g get.Interface) Option
- func WithLockPlugins(plugins []bundler.LockPlugin) Option
- func WithMetrics(out io.Writer) Option
- func WithNoCache() Option
- func WithPluginFetcher(f *plugin.Fetcher) Option
- func WithRegistry(r *provider.Registry) Option
- func WithStdin(r io.Reader) Option
- type Result
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 ¶
WithAuthRegistry provides an auth handler registry for registering auth handler plugins. If not set, auth handler plugin loading is skipped.
func WithGetter ¶
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 ¶
WithMetrics enables metrics collection and specifies where to write metrics output.
func WithNoCache ¶ added in v0.6.0
func WithNoCache() Option
WithNoCache disables artifact caching when loading solutions from the catalog. When set, the catalog is always queried directly, bypassing the filesystem cache.
func WithPluginFetcher ¶
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 ¶
WithRegistry provides a custom provider registry. If not set, builtin.DefaultRegistry is used.
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 ¶
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.