Documentation
¶
Overview ¶
Package lore provides the runtime types and execution engine for the lore CLI.
Package lore implements the lore CLI commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRootCmd ¶
NewRootCmd creates the root lore command with all subcommands.
Returns:
- *cobra.Command: configured lore command with registry flag and all subcommands
Types ¶
type BuildConfig ¶
type BuildConfig struct {
// ManifestPath is the path to a packages-manifest.yaml file. Mutually exclusive with Packages.
ManifestPath string
// Packages is a list of package names to install. Mutually exclusive with ManifestPath.
Packages []string
// Platform is the target platform (e.g., "Darwin", "Linux.Debian"). If empty, auto-detected.
Platform string
// Features are optional feature flags to enable.
Features []string
// Settings are key-value configuration settings.
Settings map[string]string
// DryRun prevents actual installation when true.
DryRun bool
// RegistryClient provides access to the package registry. If nil, a default client is created.
RegistryClient *lorepackage.Registry
}
BuildConfig holds configuration for building a package graph.
type BuildResult ¶
type BuildResult struct {
// Graph is the execution graph ready for execution.
Graph *op.Graph
// Packages lists the resolved package names.
Packages []string
// Platform is the detected or specified platform.
Platform string
}
BuildResult contains the built execution graph and metadata for packages.
func Build ¶
func Build(cfg BuildConfig) (*BuildResult, error)
Build creates an execution graph from the given configuration.
One shared op.RuntimeEnvironment backs the whole build: lore's Go-side native-software invocations and the `.star` phase scripts both register into the environment's cached plan.Provider, so they pool in one invocation ledger. Each lifecycle phase becomes a subgraph of that phase's contributions; the phase subgraphs are the roots of the returned graph, stamped with a lore op.Origin.
Parameters:
- `cfg`: the build configuration (manifest path or package list, platform, options).
Returns:
- `*BuildResult`: the execution graph and metadata.
- `error`: non-nil if the configuration is invalid or graph building fails.
func BuildFromManifest ¶
func BuildFromManifest(manifestPath, targetPlatform string) (*BuildResult, error)
BuildFromManifest creates an execution graph from a packages-manifest.yaml file.
Parameters:
- `manifestPath`: the path to the packages-manifest file.
- `targetPlatform`: the platform string (empty for auto-detect).
Returns:
- `*BuildResult`: the execution graph and metadata.
- `error`: non-nil if graph building fails.
func BuildFromPackages ¶
func BuildFromPackages(packages []string, targetPlatform string) (*BuildResult, error)
BuildFromPackages creates an execution graph from a list of package names.
Parameters:
- `packages`: the package names to resolve and install.
- `targetPlatform`: the platform string (empty for auto-detect).
Returns:
- `*BuildResult`: the execution graph and metadata.
- `error`: non-nil if graph building fails.
type Origin ¶
Origin is lore's typed, read-only view over a graph's op.Origin.
It wraps the framework op.Origin (rather than embedding op.OriginBase) so the view survives a load round-trip: the stored concrete type is always op.OriginBase, and wrapping the interface keeps the projection valid whether the origin was freshly built or decoded from a persisted graph. The projected accessors read lore's stamped annotation keys — `packages`, `platform`, `features`, `settings` — coercing the decoded `[]any` / `map[string]any` shapes back to their typed forms.
func NewOrigin ¶
NewOrigin wraps a framework op.Origin in lore's typed view.
Parameters:
- `origin`: the graph origin to project (typically `graph.Origin()`).
Returns:
- `Origin`: the lore view.
func (Origin) Features ¶
Features returns the lore feature flags stamped on the origin.
Returns:
- `[]string`: the enabled features; nil when none were stamped.
func (Origin) Packages ¶
Packages returns the package names the graph deploys.
Returns:
- `[]string`: the package names; nil when none were stamped.
type PackageContext ¶
type PackageContext struct {
// Name is the package name being deployed.
Name string
// Version is the version being deployed.
Version string
// Features are the enabled feature flags for this deployment.
Features []string
// Settings are key-value configuration settings.
Settings map[string]string
// DryRun indicates this is a preview (no actual changes).
DryRun bool
// SourceRoot is the package source directory in the registry cache.
SourceRoot string
// TargetRoot is the deployment target directory (usually $HOME).
TargetRoot string
}
PackageContext provides information about the package being deployed. Passed to phase scripts as the first argument.
func (*PackageContext) HasFeature ¶
func (p *PackageContext) HasFeature(name string) bool
HasFeature checks if a feature is enabled.
func (*PackageContext) Setting ¶
func (p *PackageContext) Setting(key string) string
Setting returns a setting value, or empty string if not set.
func (*PackageContext) ToStarlark ¶
func (p *PackageContext) ToStarlark() starlark.Value
ToStarlark converts the PackageContext to a Starlark receiver.
type PhaseContext ¶
type PhaseContext struct {
// PhaseName is the lifecycle phase (e.g., "install", "provision").
PhaseName string
// Action is the lifecycle action (e.g., "deploy", "remove").
Action string
// Retry holds the retry policy configured by the script.
Retry *op.RetryPolicy
}
PhaseContext provides phase metadata to lifecycle scripts.
Passed as the second call argument: def install(package, phase):
Starlark API:
phase.name # Phase name (e.g., "install", "provision") phase.action # Lifecycle action (e.g., "deploy", "remove") phase.retry(max_attempts=3, backoff="exponential") # Configures retry policy
func (*PhaseContext) ToStarlark ¶
func (c *PhaseContext) ToStarlark() starlark.Value
ToStarlark returns a Starlark value exposing phase.name, phase.action, phase.retry().
type Planner ¶
type Planner struct {
Platform string
RegistryClient *lorepackage.Registry
Features []string
Settings map[string]string
DryRun bool
}
Planner resolves packages and plans their lifecycle phases against a shared plan.Provider.
One Planner drives one build: every package and every phase registers its invocations into the same provider's session ledger, and the phases are grouped into subgraphs by [Planner.buildPackage].
func (*Planner) PlanByName ¶
func (p *Planner) PlanByName( provider *plan.Provider, sharedEnvironment *op.RuntimeEnvironment, packages []string, ) ([]string, []op.ExecutableUnit, error)
PlanByName resolves explicit package names and plans their phases into `provider`.
Parameters:
- `provider`: the shared plan provider all invocations register into.
- `sharedEnvironment`: the shared runtime environment the phase scripts run against.
- `packages`: the package names to resolve and plan.
Returns:
- `[]string`: the resolved package names.
- `[]op.ExecutableUnit`: the phase subgraphs, in build order.
- `error`: non-nil if any package resolution or phase building fails.
func (*Planner) PlanPackages ¶
func (p *Planner) PlanPackages( provider *plan.Provider, sharedEnvironment *op.RuntimeEnvironment, manifestPath string, ) ([]string, []op.ExecutableUnit, error)
PlanPackages parses a packages-manifest file and plans every package's phases into `provider`.
Parameters:
- `provider`: the shared plan provider all invocations register into.
- `sharedEnvironment`: the shared runtime environment the phase scripts run against.
- `manifestPath`: the path to the packages-manifest file.
Returns:
- `[]string`: the resolved package names.
- `[]op.ExecutableUnit`: the phase subgraphs, in build order.
- `error`: non-nil if manifest parsing, package resolution, or phase building fails.