Documentation
¶
Overview ¶
Package builder provides the build pipeline for composing, discovering, vendoring, and bundling solution artifacts. This 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 FormatByteSize ¶
FormatByteSize formats bytes as a human-readable string.
func ParseByteSize ¶
ParseByteSize parses a human-readable byte size string (e.g., "50MB", "100KB").
Types ¶
type BuildBundleOptions ¶
type BuildBundleOptions struct {
// BundleMaxSize is the maximum total size for bundled files (e.g., "50MB").
BundleMaxSize string `json:"bundleMaxSize,omitempty" yaml:"bundleMaxSize,omitempty" doc:"Maximum total size for bundled files"`
// NoVendor skips catalog dependency vendoring.
NoVendor bool `json:"noVendor,omitempty" yaml:"noVendor,omitempty" doc:"Skip catalog dependency vendoring"`
// NoCache skips the build cache and forces a full rebuild.
NoCache bool `json:"noCache,omitempty" yaml:"noCache,omitempty" doc:"Skip build cache and force a full rebuild"`
// DryRun previews what would be bundled without writing anything.
DryRun bool `json:"dryRun,omitempty" yaml:"dryRun,omitempty" doc:"Show what would be bundled without storing"`
// Dedupe enables content-addressable deduplication.
Dedupe bool `json:"dedupe,omitempty" yaml:"dedupe,omitempty" doc:"Enable content-addressable deduplication"`
// DedupeThreshold is the minimum file size for individual layer extraction.
DedupeThreshold string `json:"dedupeThreshold,omitempty" yaml:"dedupeThreshold,omitempty" doc:"Minimum file size for individual layer extraction"`
// Logger is used for structured logging during the build.
Logger logr.Logger
}
BuildBundleOptions holds configuration for the build bundle pipeline.
type BuildResult ¶
type BuildResult struct {
// TarData is the traditional single tar archive (v1).
TarData []byte
// Dedup is the content-addressable dedup result (v2).
Dedup *bundler.DedupeResult
// CacheHit indicates the build was served from the build cache.
// When true, the artifact already exists in the catalog and no store is needed.
CacheHit bool
// CacheEntry contains the cache metadata when CacheHit is true.
CacheEntry *bundler.BuildCacheEntry
// BuildFingerprint is the computed fingerprint for cache write after a successful build.
BuildFingerprint string
// BuildCacheDir is the directory where build cache entries are stored.
BuildCacheDir string
// InputFileCount is the number of input files that contributed to the fingerprint.
InputFileCount int
// ResolvedPlugins holds plugin lock entries from VendorPlugins,
// to be merged into the lock file during the store step.
ResolvedPlugins []bundler.LockPlugin
// Discovery holds the file discovery results (always populated).
Discovery *bundler.DiscoveryResult
// Messages collects human-readable progress messages generated during
// the pipeline. CLI consumers should display these to the user.
Messages []string
}
BuildResult holds the output of the build bundle pipeline.
func BuildBundle ¶
func BuildBundle(ctx context.Context, sol *solution.Solution, solutionContent []byte, bundleRoot string, opts BuildBundleOptions) (*BuildResult, error)
BuildBundle runs the compose → discover → vendor → tar/dedup pipeline.
The solution (sol) may be mutated by the compose step. solutionContent is the raw YAML bytes of the original solution file. bundleRoot is the directory containing the solution file.
type CatalogPluginResolver ¶
CatalogPluginResolver adapts a catalog.Catalog to the bundler.PluginResolver interface.
func (*CatalogPluginResolver) ResolvePlugin ¶
func (r *CatalogPluginResolver) ResolvePlugin(ctx context.Context, name string, kind catalog.ArtifactKind, _ string) (catalog.ArtifactInfo, error)
ResolvePlugin resolves a plugin artifact from the catalog by name and kind.
type RegistryFetcherAdapter ¶
RegistryFetcherAdapter adapts a catalog.Registry to the bundler.CatalogFetcher interface. It supports both exact version fetches and listing all versions for constraint resolution.
func (*RegistryFetcherAdapter) FetchSolution ¶
func (a *RegistryFetcherAdapter) FetchSolution(ctx context.Context, nameWithVersion string) ([]byte, catalog.ArtifactInfo, error)
FetchSolution retrieves a solution by name[@version] from the registry.
func (*RegistryFetcherAdapter) ListSolutions ¶
func (a *RegistryFetcherAdapter) ListSolutions(ctx context.Context, name string) ([]catalog.ArtifactInfo, error)
ListSolutions returns all available versions of a named solution artifact.