Documentation
¶
Overview ¶
Package starlark provides the Starlark scripting runtime for devlore.
Index ¶
- type BindingSet
- func (bs *BindingSet) BuildGlobals(graph *op.Graph, project string, reg *op.ActionRegistry) starlark.StringDict
- func (bs *BindingSet) ConfigureThread(thread *starlark.Thread, graph *op.Graph, project string, ...)
- func (bs *BindingSet) NewPopulatedRegistry() *op.ActionRegistry
- func (bs *BindingSet) RegisterActions(reg *op.ActionRegistry)
- func (bs *BindingSet) With(names ...string) *BindingSet
- type PackageContext
- type PhaseContext
- type PlanRoot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindingSet ¶
type BindingSet struct {
// contains filtered or unexported fields
}
BindingSet selects which provider bindings a consumer uses and builds Starlark globals from them. Consumers call With() to include specific providers as pre-injected globals. All other providers remain available via load("@devlore//name", "name") in scripts.
func NewBindingSet ¶
func NewBindingSet(cfg op.BindingConfig) *BindingSet
NewBindingSet creates a BindingSet with the given configuration. No providers are included as globals by default.
func (*BindingSet) BuildGlobals ¶
func (bs *BindingSet) BuildGlobals(graph *op.Graph, project string, reg *op.ActionRegistry) starlark.StringDict
BuildGlobals constructs the Starlark globals dict for a consumer. Only providers named in With() appear as globals. If "plan" was included via With(), a PlanRoot is built from all registered PlannedFactory bindings.
func (*BindingSet) ConfigureThread ¶
func (bs *BindingSet) ConfigureThread(thread *starlark.Thread, graph *op.Graph, project string, reg *op.ActionRegistry)
ConfigureThread sets thread.Load to the @devlore// module loader. The loader resolves provider names from the binding registry and caches instances on the BindingSet. Must be called before starlark.ExecFileOptions.
func (*BindingSet) NewPopulatedRegistry ¶
func (bs *BindingSet) NewPopulatedRegistry() *op.ActionRegistry
NewPopulatedRegistry creates an ActionRegistry with all provider actions registered. Shorthand for NewActionRegistry() + RegisterActions().
func (*BindingSet) RegisterActions ¶
func (bs *BindingSet) RegisterActions(reg *op.ActionRegistry)
RegisterActions registers all providers' actions with the registry. All providers' actions are always registered regardless of With() selections — the action registry is for the executor, not the script environment.
func (*BindingSet) With ¶
func (bs *BindingSet) With(names ...string) *BindingSet
With includes one or more providers as pre-injected globals. "plan" is a special name that includes the PlanRoot aggregate. Returns the BindingSet for chaining.
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 PlanRoot ¶
type PlanRoot struct {
// contains filtered or unexported fields
}
PlanRoot implements the top-level plan namespace using the slot-based model. Sub-namespaces are populated from PlannedFactory functions selected by BindingSet. Flow actions (choose, source, gather) are built-in.
func NewPlanRootFromFactories ¶
func NewPlanRootFromFactories(graph *op.Graph, project string, reg *op.ActionRegistry, factories map[string]op.PlannedFactory) *PlanRoot
NewPlanRootFromFactories creates a PlanRoot using filtered PlannedFactory functions from the binding registry. Consumers select providers via BindingSet, which passes the filtered factory map here.