loaderkit

package
v0.2026210.625 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 20 Imported by: 19 modules, 19 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

directives.go — the loaderkit-local WALK-only directives: MaxIncludeDepth, namespaceAliasRe, and validateNamespaceAlias. The kind-blind document directives (ImportList/ImportEntry, DiscoverConfig/ScanSpec, anchorScanSpecs, docShape/classifyDoc) relocated to sdk/kit (loader_directives.go + loader_classify.go) so charly core AND sdk/loaderkit share ONE copy (R3) — see kit.ImportList / kit.DiscoverConfig / kit.AnchorScanSpecs / kit.ClassifyDoc.

discover.go — the K1 port of charly/unified.go's discover walk (ApplyDiscover / applyDiscoveredManifest): scans each `discover:` spec for directories carrying its manifest (via the shared kit.FindEntityDirs primitive) and PARSES every document each discovered manifest contains into a spec.DiscoveredManifest. Faithful port, MINUS the host-only candy-image lazy-ref registration + the per-node materialize FOLD (candy/plugin-loader's own Materializer seam, K1 unit 1 — the not-found policy lives there too now; only the ACTUAL registry resolve + provider dispatch stays host-side, boundary law clause M) — this file only WALKS + PARSES, exactly like the rest of loaderkit.

load_unified.go — the K1 keystone (task #24 unit 2) port of charly's TOP-LEVEL LoadUnified ORCHESTRATION out of charly core. This is the entry point every command (build/deploy/check/validate) calls to load a project's charly.yml — the sequence of steps (bootstrap phase, early + post-merge schema gate, kind-blind walk, registry materialize, venue flatten, member fold, descent stamp, the validation chain) now lives here, kind-blind, exactly as charly/unified.go's former inline body did. Every step that touches the provider registry, the build-vocabulary plugins, or a standing K5-final-decision core file (bundle_members.go's foldMembers/validateMembers) is a SEAM CALLBACK the host supplies via LoadSeams — the same injected-seam pattern spec.WalkSeams/ spec.MaterializeSeams already established (#46); LoadUnified itself never touches the registry. charly-core's own LoadUnified(dir) becomes a thin wrapper that builds a LoadSeams from its existing host-coupled functions and delegates here.

materialize.go — the K1 unit-1 port of charly's per-node kind-decode DISPATCH POLICY (charly/node_normalize.go's former normalizeNodeInto) out of charly core. Materialize decides what to do with ONE parsed entity node: if the provider registry resolves its discriminator, the host-supplied DecodeEntity seam callback has already folded it (clause M stays host-side, unchanged — provider_registry.go / provider_kind_invoke.go are the TRUE mechanism, this package never touches the registry); otherwise Materialize applies the NOT-FOUND policy purely from the host-threaded spec.Threaded snapshot (clause D) plus two small state-check callbacks — a recognized-but-unconnected external deploy substrate routes to the bundle builder, a declared- but-unconnected kind is deferred (mid re-entrant connect pass) or warned-and-skipped, and a truly unrecognized discriminator is a hard load error. This is the exact fallback branch normalizeNodeInto's "not found" arm ran, faithfully ported (the former in-proc KindProvider fast path is NOT ported — it was dead code: spec.KindWords is permanently empty, so no real provider has ever satisfied ClassKind + KindProvider; the DecodeEntity seam callback always dispatches via the JSON-envelope path now, exactly as it already did in production).

materialize_project.go — the K1 task #48 port of charly's per-document/per-namespace MATERIALIZE + root-wins MERGE ORCHESTRATION (charly/materialize.go's former materializeLoadedProject) out of charly core. This is the kind-blind walk+merge MECHANISM: which document, which discovered node, root-wins merge, namespace fold + byID pointer-identity — none of it touches the provider registry. The three genuinely host-/registry-/bootstrap-coupled leaf legs (the per-document registry kind-decode, the bootstrap-candy-routed discovered-manifest fold, the binary-embedded default vocabulary) are reached through MaterializeProjectSeams, the same injected-seam pattern LoadSeams / spec.WalkSeams / spec.MaterializeSeams already established (#46/#47) — so this orchestration runs plugin-side (in loaderkit) exactly as LoadUnified does, calling back for only the coupled leaves. charly's hostMaterializeProjectSeams is the sole host constructor.

Package loaderkit is the importable form of charly's unified-config PARSE — the parse half of LoadUnified relocated out of charly core (P6). It decomposes one node-form YAML document into the generic, sdk-expressible spec.ParsedProject the host MATERIALIZES into the typed *UnifiedFile. Shared by the loader plugin candy (candy/plugin-loader, its OpLoad) and, during the transition, by charly core — the SAME parse, one copy (R3), the way sdk/kit is the one copy of the check walk.

The parse consults ONLY spec vocabulary (CUE-sourced) + yaml + host-threaded kind-recognition DATA (Threaded) — never the provider registry directly. The registry is core fabric; the host snapshots which words it recognizes (kinds / deploy substrates / structural / scalar-sugar primaries) into Threaded before the parse, and the re-entrant connect-then-reload re-parses with an updated snapshot. That keeps the parse a kind-blind mechanism (boundary law clause D).

walk.go — the K1 port of charly's unified-config loader ORCHESTRATION: the kind-blind WALK+PARSE half of LoadUnified (charly/unified.go) relocated out of charly core. Walk drives the import queue + discover + namespaced-import mounts and PARSES every document (via the existing loaderkit.ParseDoc, P6) into a generic spec.LoadedProject envelope — it does NO materialize (registry kind-decode) and NO merge (root-wins field folding) into a typed *UnifiedFile; the host replays materialize+merge over the returned spec.LoadedProject to reconstruct that, exactly as it did inline before.

Everything registry-coupled or host-coupled (the parse pre-scan + connect-declared-kind-plugins side effects, the #NodeDoc CUE validate-before-execute gate, remote-ref resolution + the project-repo cache, and the repo-identity cycle-break) is a SEAM CALLBACK the host supplies via spec.WalkSeams (#46 — the seam contract lives in sdk/spec, not here, so charly core references it without importing this package) — Walk itself calls the seam and never does the coupled work directly (boundary law clause D: Walk consults host-threaded DATA, never the provider registry).

Faithful-port mapping (see charly/unified.go + charly/ns_identity.go):

LoadUnified (the walk portion only)      → Walk
loadUnifiedInto                          → (*walker).walkFile
mergeUnifiedDocs (the parse portion)     → (*walker).parseDocs (materialize/mergeUnified excluded)
loadNamespaceCached                      → (*walker).walkNamespace
the per-project "load + discover" body   → (*walker).walkProject
ApplyDiscover/…                          → discover.go

The kind-blind document DIRECTIVES (kit.ImportList/kit.DiscoverConfig/kit.ClassifyDoc/ kit.FindEntityDirs/…) live in sdk/kit (loader_directives.go/loader_classify.go/ loader_discover.go), shared with charly core (R3) — this package keeps only its own walk-scoped namespace-alias validation (directives.go).

Index

Constants

View Source
const MaxIncludeDepth = 8

MaxIncludeDepth caps recursive include resolution. A cycle or excessive depth raises a clear error with the offending file path.

Variables

This section is empty.

Functions

func CompleteCandyRunOps added in v0.2026209.2002

func CompleteCandyRunOps(m *spec.CandyModel, v *spec.CandyView)

CompleteCandyRunOps finishes the ONE host-completed predicate scanFromParsed's own doc comment flags as not scan-computable standalone: RunOps needs the op-context classifier (registry-adjacent D-data, reached via deploykit.OpInContext — task #39), so a single candy's scan can't derive it — this runs the SAME live-compute the pre-move *Candy.runOps() did (a `run:` step passes unless it is PURELY runtime-context), then OR-completes HasInstallFiles/HasContent with it (+ the already-known InitSystems term, when PopulateCandyInitSystem has run for this candy) — the associative-OR completion the scan-time partial computation deliberately deferred. MUST run on the mutable pre-wrap (Model, View) pair, before FinalizeCandyRefs+NewSpecCandyModel (a spec.CandyReader is read-only after that).

func DecodePluginKindMap added in v0.2026206.1046

func DecodePluginKindMap[T any](uf *UnifiedFile, kind string) map[string]*T

DecodePluginKindMap reconstructs the typed name-keyed map[string]*T for a plugin kind from uf.PluginKinds[kind] (each body the canonical spec.T JSON the kind plugin's Invoke produced) via a PLAIN json.Unmarshal — no plugin OpResolve round-trip, for a kind whose body is already self-contained (Builder). Compare ResolvePluginKindViaPlugin above, its sibling for kinds that DO need a plugin-side resolve leg. A bad entry is skipped rather than poisoning the whole vocabulary. Returns nil when the kind has no entities.

func EncodeInlineCandy added in v0.2026206.1046

func EncodeInlineCandy(il *InlineCandy) json.RawMessage

EncodeInlineCandy marshals a loader InlineCandy into its opaque body.

func FinalizeScannedCandies added in v0.2026209.2002

func FinalizeScannedCandies(scanned map[string]spec.ScannedCandy, initCfg *buildkit.InitConfig) map[string]spec.CandyReader

FinalizeScannedCandies is the SOLE choke point that produces a spec.CandyReader: every construction path (ScanCandy, legacyScanCandiesDirScanned via scanLocalCandies, (*loaderkit.UnifiedFile).projectCandiesScanned via scanLocalCandies, and ScanAllCandyWithConfigOpts over its combined local+remote set) funnels through here, so no path can ever wrap a candy with a term (InitSystems, RunOps) still missing — there is no OTHER way to obtain a spec.CandyReader. Order: InitSystems (initCfg-gated; a nil initCfg is a documented no-op) THEN RunOps + the HasInstallFiles/HasContent OR-fold (unconditional) THEN FinalizeCandyRefs (bare-string the refs) THEN wrap — since a CandyReader is read-only from the wrap onward. Does NOT mutate its input map: PopulateCandyInitSystem mutates `scanned` in place when initCfg is non-nil, but every OTHER step below operates on a range-loop COPY, so calling this twice against the SAME map with different initCfg values (the throwaway nil-initCfg call ScanAllCandyWithConfigOpts makes for CollectRemoteRefsOpts's edge-walk, then the real opts.InitCfg call at the end) is safe.

func FlattenBundleVenues added in v0.2026209.2002

func FlattenBundleVenues(uf *UnifiedFile) error

FlattenBundleVenues stamps venue + hoists plan steps for every top-level bundle in uf. Idempotent on an already-flattened tree (members/children have empty Plan after the first pass, so re-running hoists nothing). Must run before FoldMembers (which promotes members to top-level, mutating the map) and before validateCheckBeds/validateIterateBed (which count root Plan checks).

func FoldMembers added in v0.2026209.2002

func FoldMembers(uf *UnifiedFile) error

FoldMembers copies every deploy node's `peer:` entries into the Bundle map as top-level addressable entries (MemberOf set, disposability inherited), so every deploy verb resolves a member by name through the same path as any deploy. Runs BEFORE validateDeploymentTree (so folded members get the same deploy validation); a check bed is itself a `disposable: true` bundle, so a bed's members fold the same way. A member name colliding with any existing deploy/member entry is a hard error.

func GateSchemaVersion added in v0.2026206.1046

func GateSchemaVersion(root, version string) error

GateSchemaVersion enforces the load-time schema-version contract: a config NEWER than this binary supports → "update charly"; an OLDER/absent/non-CalVer version → the `charly migrate` hint. Shared by the early pre-parse gate (root's raw version) and the post-merge gate (merged version) so both speak identically. Pure — kit.ParseCalVer/kit.LatestSchemaVersion carry no registry coupling.

func GitRemoteIdentity added in v0.2026198.2057

func GitRemoteIdentity(dir string) string

GitRemoteIdentity returns the normalized `host/owner/repo` identity of dir's git `origin` remote, or "" when dir is not a git repo / has no origin / git is unavailable.

func MarshalMaterialized added in v0.2026209.2002

func MarshalMaterialized(uf *UnifiedFile) ([]byte, error)

MarshalMaterialized serializes a materialized UnifiedFile for a reverse-leg []byte payload, PRESERVING PluginKinds (which a plain json.Marshal drops). Use it on EVERY loader leg that sends a materialized UnifiedFile across the wire (the loader-materialize reply + the loader-*-validate requests).

func Materialize added in v0.2026206.837

Materialize folds ONE parsed entity node into acc via the registered Materializer plugin's not-found policy, calling back into the host-supplied seams for everything registry-coupled.

func MaterializeLoadedProject added in v0.2026209.2002

func MaterializeLoadedProject(lp *spec.LoadedProject, merged *UnifiedFile, byID map[int64]*UnifiedFile, seams MaterializeProjectSeams) error

MaterializeLoadedProject replays the per-document/per-namespace MATERIALIZE + root-wins MERGE over a walk envelope, reconstructing the typed *UnifiedFile identically to charly's former inline loadUnifiedInto:

  1. each document (root file + flat imports, in walk order) — decode its reserved directives into a fresh sub UnifiedFile, materialize its parsed nodes (registry kind-decode, via the seam), then root-wins merge the sub into merged (first-seen wins → root wins);
  2. the discovered manifests — register a lazy layer-candy `From:` reference OR materialize the node, explicit-entry-wins (via the seam, the SAME per-node handler ApplyDiscover uses, R3);
  3. the binary-embedded default vocabulary (project-wins, via the seam);
  4. the mounted namespace subtrees — recurse into merged.Namespaces[alias].

func MergePluginKindsMap added in v0.2026209.2002

func MergePluginKindsMap(dst *map[string]map[string]json.RawMessage, src map[string]map[string]json.RawMessage)

MergePluginKindsMap merges plugin-contributed kind entities (uf.PluginKinds: kind word → entity NAME → canonical entity JSON) across every merged document/file. Root-wins NAME-KEYED OVERRIDE, byte-identical in spirit to the build-vocab map merges (mergeDistroMap et al.): for each kind, an existing dst entry for a given name is PRESERVED and src fills only the names dst does not have. So a project's entity overrides an embedded/imported one of the same name (one entry, not two) — the property the agent + sidecar extractions rely on (a project's `sidecar: tailscale` overriding the binary-embedded one, merged in via applyEmbeddedDefaults). Without this, plugin-kind entities decoded into a per-document `sub` UnifiedFile are silently dropped at MergeUnified (every document flows through here).

func MergeUnified added in v0.2026209.2002

func MergeUnified(dst, src *UnifiedFile, srcDir string)

MergeUnified merges src into dst such that dst's existing values WIN on conflict at the same leaf (root-wins). This means when MaterializeLoadedProject replays the walk's documents in order (the root file first, then its flat imports), the root file's values are already present before any import's fields are considered, so root wins.

For included files: the same MergeUnified is called but dst already contains the root's values, so those fields stay untouched. src's fields that aren't present in dst get copied over. That's the desired semantics.

func NormalizeGitRemoteURL added in v0.2026198.2057

func NormalizeGitRemoteURL(raw string) string

NormalizeGitRemoteURL strips the scheme / `git@` / `.git` decorations from a git remote URL, leaving `host/owner/repo`. scp-style (`git@host:owner/repo`) and scheme URLs (`https://`, `ssh://`, `git://`, with optional `user@`) are both handled. A value already in `host/owner/repo` (or bare `owner/repo`) form passes through unchanged.

func NormalizeRepoIdentity added in v0.2026198.2057

func NormalizeRepoIdentity(s string) string

NormalizeRepoIdentity normalizes an explicit `repo:` value (which may be a full git URL, an scp-style ref, or a bare `owner/repo`) to the `host/owner/repo` form ParseRemoteRef produces — so an explicit declaration and a remote `@`-ref compare equal. Reuses NormalizeRepoSpec's bare-`owner/repo` → github.com rule.

func NormalizeRepoSpec added in v0.2026198.2057

func NormalizeRepoSpec(spc string) (repoPath, version string)

NormalizeRepoSpec turns a user-supplied --repo spec into a (repoPath, version) pair suitable for a repo-cache download. Spec formats:

"default"               → (spec.DefaultProjectRepo, "")
"owner/repo"            → ("github.com/owner/repo", "")
"owner/repo@ref"        → ("github.com/owner/repo", "ref")
"host/owner/repo[@ref]" → used literally

An empty version means "resolve to default branch at lookup time".

func NormalizeV4Aliases added in v0.2026206.1046

func NormalizeV4Aliases(u *UnifiedFile)

NormalizeV4Aliases — RETIRED by the field-singular cutover (2026-05). Dual Images/ImageSingular and Deploys/DeploySingular fields collapsed into single canonical singular fields with matching yaml tags. Function kept as a no-op so external callers don't break; remove on next refactor pass.

func ParseDoc

func ParseDoc(doc *yaml.Node, t spec.Threaded) (directives map[string]*yaml.Node, pp spec.ParsedProject, err error)

ParseDoc decomposes a node-form document mapping into its reserved directives + the generic spec.ParsedProject (its top-level entity nodes, each with the opaque JSON body the host materializes). Faithful port of core's parseNodeTree + genericNodeToParsed.

func PopulateCandyInitSystem added in v0.2026209.2002

func PopulateCandyInitSystem(scanned map[string]spec.ScannedCandy, initCfg *buildkit.InitConfig)

PopulateCandyInitSystem sets the per-candy CandyView.InitSystems map based on the init config — the cross-candy host-completion pass (#67 pattern): scanning a SINGLE candy can't know the project's init vocabulary, so this runs once, after EVERY candy in the project has been scanned, over the mutable pre-wrap map[string]spec.ScannedCandy (a spec.CandyReader is read-only from here, so this MUST run before the final FinalizeCandyRefs+NewSpecCandyModel wrap — see ResolveOpts.InitCfg's doc comment). Byte-identical logic to the pre-move *Candy.InitSystems population, retargeted at scanned[name].Model.Service / .Model.SourceDir / .View.InitSystems.

func ProjectBuilderConfig added in v0.2026209.2002

func ProjectBuilderConfig(uf *UnifiedFile) *buildkit.BuilderConfig

ProjectBuilderConfig reconstructs the *buildkit.BuilderConfig (builder: section) from uf. The builder bodies decode purely (DecodePluginKindMap) — no OpResolve callback needed. Nil when no builders are configured.

func ProjectDistroConfig added in v0.2026209.2002

func ProjectDistroConfig(uf *UnifiedFile, resolveDistro func(json.RawMessage) (*spec.ResolvedDistro, error)) *buildkit.DistroConfig

ProjectDistroConfig reconstructs the *buildkit.DistroConfig (distro: section) from uf, resolving each opaque `distro` body via the caller-supplied resolveDistro callback (the distro plugin's OpResolve leg). Nil when no distros are configured.

func ProjectInitConfig added in v0.2026209.2002

func ProjectInitConfig(uf *UnifiedFile, resolveInit func(json.RawMessage) (*spec.ResolvedInit, error)) *buildkit.InitConfig

ProjectInitConfig reconstructs the *buildkit.InitConfig (init: section) from uf, resolving each opaque `init` body via the caller-supplied resolveInit callback (the init plugin's OpResolve config leg). Nil when no init systems are configured.

func ProjectResolvedProject added in v0.2026209.2002

func ProjectResolvedProject(cfg *spec.Config, layers map[string]spec.CandyReader, uf *UnifiedFile, distroCfg *buildkit.DistroConfig, builderCfg *buildkit.BuilderConfig, initCfg *buildkit.InitConfig, dir, version, calver string, seams ResolveProjectSeams, diags *spec.Diagnostics, preResolvedBoxes map[string]*buildkit.ResolvedBox) (*spec.ResolvedProject, error)

ProjectResolvedProject assembles the spec.ResolvedProject from already-loaded resolve-engine outputs — a DATA projection over the seams, no resolution logic of its own. boxes come from seams.ResolveBox (or preResolvedBoxes), candies from the scanned layers map, deploy from the folded uf.Bundle tree, calver is the wall-clock build tag threaded by the caller. When diags is nil it is FAIL-FAST (a per-box ResolveBox failure aborts with an error). When diags is non-nil it is ERROR-TOLERANT (the validate-project path): a ResolveBox failure appends a spec.Diagnostic and SKIPS that box.

preResolvedBoxes (the build-prep seam path) supplies boxes AS-IS — skipping the ResolveBox loop — so the render-prep caches (BakedMetadata/RenderCandyOrder/InitSystem/InitDef/ActiveInits/CandyCaps) are preserved on the ResolvedBoxView. nil (validate/inspect) resolves boxes fresh.

func ProjectTemplates added in v0.2026209.2002

func ProjectTemplates(uf *UnifiedFile) *spec.ProjectTemplates

ProjectTemplates decodes the uf.Local/K8s/Pod/VM/Android raw template maps (map[string]json.RawMessage) into the existing spec kind types — the resolved kind-template maps validate/check-include/status read. Returns nil when no template kind is present. ALSO recurses into uf.Namespaces, mirroring FillBoxPlans's prefix-accumulation pattern exactly, so a namespace-qualified template ref (`local: <ns>.<tmpl>`, `kind:k8s` entity `<ns>.<name>`, …) is visible in the envelope too — previously only root-level names were. Purely ADDITIVE (qualified keys never collide with a bare name, since a bare name can never contain "."), so every existing root-scoped consumer is unaffected.

func QualifyRemoteSiblingDeps added in v0.2026198.2057

func QualifyRemoteSiblingDeps(repoPath, subPathPrefix string, refs *spec.CandyRefs)

QualifyRemoteSiblingDeps records, for a freshly-scanned remote candy, the fully-qualified "<repo>/<subpathprefix><dep>" map key of each plain-name require:/candy:/bake_plugin: dep — the same form the fetched-sibling scan keys under. It sets each ref's resolved key (CandyRefEntry.Resolved) and leaves CandyRefEntry.Raw intact, so the graph resolves on .Bare() (qualified) while the transitive fetch loop still keys on the original .Raw plain name. @-ref deps are left untouched — their bare path already resolves directly. Ported verbatim from the pre-move charly/layers.go qualifyRemoteSiblingDeps, retargeted at the CandyRefs carrier (the live *Candy's Require/IncludedCandy/BakePlugin fields this mutated in place pre-move).

func RepoIdentity added in v0.2026198.2057

func RepoIdentity(ref, baseDir string) string

RepoIdentity returns the canonical repo identity of an import ref, or "" when it can't be determined (in which case the loader degrades to version-keyed behavior). A remote `@host/org/repo[/sub]:ver` ref yields `host/org/repo` directly (no fetch, no git); a local path yields the git `origin` identity of the target directory.

func ResolveAndroidViaExecutor added in v0.2026209.2002

func ResolveAndroidViaExecutor(ctx context.Context, ex *sdk.Executor) func(json.RawMessage) (*spec.ResolvedAndroid, error)

ResolveAndroidViaExecutor builds the resolveAndroid callback ValidateAndroidDevices needs, dispatching each opaque android body to the substrate plugin's OpResolve leg (any of its 5 substrate words serves; "local" is the canonical entry, mirroring the host's invokeSubstrateTemplateResolve).

func ResolvePluginKindViaPlugin added in v0.2026206.1046

func ResolvePluginKindViaPlugin[T any](uf *UnifiedFile, kind string, resolve func(json.RawMessage) (*T, error)) map[string]*T

ResolvePluginKindViaPlugin projects uf.PluginKinds[kind] (opaque bodies) into *T value envelopes via resolve, a per-body plugin OpResolve leg — the ONE shared loop every "resolve a plugin-kind catalog through its OpResolve leg" accessor uses (charly-core's Distros/Builders/ resolveResources/resolveAndroids/resolveInits each supply their own registry-coupled resolve callback; this loop itself touches no registry). A bad entry is skipped rather than poisoning the whole vocabulary.

func ResolveResourceViaExecutor added in v0.2026209.2002

func ResolveResourceViaExecutor(ctx context.Context, ex *sdk.Executor) func(json.RawMessage) (*spec.ResolvedResource, error)

ResolveResourceViaExecutor builds the resolveResource callback ValidatePreemptible needs, dispatching each opaque resource body to the resource kind's OpResolve leg over InvokeProvider.

func ResolveVmViaExecutor added in v0.2026209.2002

func ResolveVmViaExecutor(ctx context.Context, ex *sdk.Executor) func(json.RawMessage) (*vmshared.VmSpec, error)

ResolveVmViaExecutor builds the resolveVm callback ValidatePreemptible needs. Returns nil for an empty/absent body (matching the host resolveVmViaPlugin).

func RootRepoIdentity added in v0.2026198.2057

func RootRepoIdentity(dir string) string

RootRepoIdentity determines the local root project's own repo identity for cycle-break registration. An explicit `repo:` field in charly.yml is authoritative; otherwise it falls back to the `git remote origin` identity of the working tree. Returns "" when neither is available (the loader then behaves exactly as before — version-keyed, no self-identity short-circuit).

func RunDiscover added in v0.2026206.1046

func RunDiscover(rootDir string, specs []kit.ScanSpec, seams spec.WalkSeams) ([]spec.DiscoveredManifest, error)

RunDiscover is the STANDALONE discover-only entry point (K1 keystone, task #24 unit 3): charly's ApplyDiscover (unified.go) calls this directly — reusing the SAME runDiscover/ parseDiscoveredManifest walker mechanism the whole-project Walk drives internally for its own depth-0 discover pass — rather than duplicating the walk+parse logic. Bypasses the spec.ProjectWalker plugin-swap indirection deliberately: ApplyDiscover has never gone through the whole-project walker (it talks to the parser/threaded seam primitives directly, mirroring Walk's OWN internal discover call), so a custom loader plugin overriding Walk's discover behavior was never honored by ApplyDiscover before this move either — this preserves that pre-existing scope exactly.

func ScanCandyFromLocal added in v0.2026209.2002

func ScanCandyFromLocal(localScanned map[string]spec.ScannedCandy, initCfg *buildkit.InitConfig, seams ScanSeams) (map[string]spec.CandyReader, error)

ScanCandyFromLocal is the scan pipeline's step-2-onward body (remote-ref collect, fix-point fetch, per-entity-version arbitration, host-completion + finalize), relocated verbatim from charly/layers.go's scanCandyFromLocal. A caller that already has a source of localScanned (the root project scan, or a namespace's own projectCandiesScanned set) reaches the SAME pipeline by supplying the seams. Behavior-identical to the pre-move function: same steps 2-5, same order. initCfg is the project init: vocabulary threaded into the FINAL finalize choke point (nil for a non-generate caller — matches the pre-move opts.InitCfg).

func ScanCandyManifest added in v0.2026198.2057

func ScanCandyManifest(path, name, manifestName string, parseDoc func(path string) (*spec.CandyYAML, error)) (spec.CandyModel, spec.CandyView, spec.CandyRefs, error)

ScanCandyManifest scans a single candy DIRECTORY (the `from:`-directory / legacy-discovered-candy path) and returns its two resolved envelope views. Named distinctly from the ESTABLISHED exported charly.ScanCandy(dir) (the whole-project scan-all-candies entry point) to avoid confusion between the two similarly-shaped-but-different scans while both exist side by side during the cutover. parseDoc is the injected per-document parse seam (charly's parseCandyYAML — registry-coupled, so it stays host-side; see the CandyScanner interface doc in sdk/spec/loader_seam.go).

func ScanInlineCandy added in v0.2026198.2057

func ScanInlineCandy(name, sourceDir string, ly *spec.CandyYAML) (spec.CandyModel, spec.CandyView, spec.CandyRefs)

ScanInlineCandy builds the two resolved envelope views + the rich pre-qualification refs for a candy declared INLINE in a unified charly.yml (no separate manifest file — ly is already the parsed body). sourceDir is the charly.yml's own directory (an inline candy's SourceDir always equals its declaring file's dir). Mirrors the pre-move charly/unified.go synthesizeInlineCandy, which called the SAME populateCandyFromYAML + fs-probe pair scanCandy did — the two paths can never drift because they share this one function.

func ScanRemoteCandy added in v0.2026198.2057

func ScanRemoteCandy(repoDir, repoPath string, wantRefs map[string]bool, parseDoc func(path string) (*spec.CandyYAML, error)) (map[string]spec.ScannedCandy, error)

ScanRemoteCandy scans specific candies out of a downloaded remote repository directory — only the bare refs in wantRefs (each "github.com/org/repo/candy/name" form, keyed by that same bare ref in the returned map). Ported verbatim from the pre-move charly/layers.go ScanRemoteCandy: for each wanted ref, ScanCandyManifest the candy dir, then set the resulting CandyView's Remote/RepoPath/SubPathPrefix (the post-scan "construct-then-mutate" step scan-time cannot do itself — a candy doesn't know it's REMOTE until the fetch layer resolves it there) and qualify its plain-name sibling deps (QualifyRemoteSiblingDeps) so the dependency graph + validator can resolve a remote candy's transitive deps against siblings pulled from the same repo, without per-call-site repo-path plumbing.

func SortedDeployKeys added in v0.2026209.2002

func SortedDeployKeys(m map[string]spec.BundleNode) []string

SortedDeployKeys returns a Bundle map's keys in deterministic (name) order. A generic Bundle-map helper with no kind-specific logic, shared by FoldMembers / FlattenBundleVenues / VenueIsAgentProvisioned here and by charly's DEPLOY-half owner-walk (R3, one shared abstraction).

func SortedMemberKeys added in v0.2026209.2002

func SortedMemberKeys(members map[string]*spec.BundleNode) []string

SortedMemberKeys returns the member keys of a node in deterministic order.

func StampBundleDescents added in v0.2026209.2002

func StampBundleDescents(uf *UnifiedFile, t spec.Threaded)

StampBundleDescents stamps every deploy node's venue-hop descent descriptor from the DeployTraits DATA snapshot, replacing the former registry-live charly stampBundleDescents. Idempotent.

func UnmarshalMaterialized added in v0.2026209.2002

func UnmarshalMaterialized(data []byte, uf *UnifiedFile) error

UnmarshalMaterialized reconstructs a materialized UnifiedFile from a MarshalMaterialized payload INTO uf, re-attaching PluginKinds at every namespace level so the result is byte-identical to the source. uf must be non-nil (the leg's own `merged`/scratch UnifiedFile).

func ValidateAndroidDevices added in v0.2026209.2002

func ValidateAndroidDevices(uf *UnifiedFile, resolveAndroid func(json.RawMessage) (*spec.ResolvedAndroid, error)) error

ValidateAndroidDevices enforces the kind:android device source invariant: a device is EXACTLY ONE of an in-pod emulator (box:) XOR a remote/physical adb endpoint (adb:) — never both, never neither. This is the entity-level XOR the #Android CUE schema formerly expressed via a trailing `& ({box:_} | {adb:_})` disjunction (dropped because gengotypes collapses an entity-level disjunction to an empty struct — see schema/android.cue). Runs at LOAD time so EVERY command that resolves a device (charly bundle add android:, charly check run, charly box validate, …) sees the same friendly error. resolveAndroid projects one opaque android template body into its *spec.ResolvedAndroid via the registry (host-threaded).

func ValidateCheckBeds added in v0.2026209.2002

func ValidateCheckBeds(uf *UnifiedFile, t spec.Threaded) error

ValidateCheckBeds enforces the kind:check bed-specific invariants beyond the generic deploy validation (which already runs on the folded beds via ValidateDeploymentTree, covering the pod `box:` requirement). Runs at LOAD time so EVERY command that resolves a bed (charly check run, charly bundle add, charly config, charly box validate, …) sees the same friendly error.

func ValidateEphemeralOnNode added in v0.2026209.2002

func ValidateEphemeralOnNode(name string, node *spec.BundleNode, t spec.Threaded, d *spec.Diagnostics)

ValidateEphemeralOnNode applies all ephemeral-related invariants to a single BundleNode, reading the substrate's DECLARED #DeployTraits from the DATA snapshot t (never the registry). Errors accumulate into d. Byte-equivalent to the former charly ValidateEphemeralOnNode.

func ValidateEphemeralUnified added in v0.2026209.2002

func ValidateEphemeralUnified(uf *UnifiedFile, t spec.Threaded) error

ValidateEphemeralUnified is the LoadSeams.ValidateEphemeral entry point: it auto-promotes disposable:true on ephemeral entries and validates the ephemeral / vm-naming invariants across the UnifiedFile's Bundle map, reading the DeployTraits DATA snapshot t. Moved verbatim (behaviour- preserving) from charly's validateEphemeralUnified.

func ValidateIterateBed added in v0.2026209.2002

func ValidateIterateBed(uf *UnifiedFile, name string, node *spec.BundleNode) error

ValidateIterateBed enforces the iterate: benchmark invariants (replaces the former validateScoreNode/validateHarnessSemantics). An iterate bed is exempt from the deterministic R10 bed rules (target/disposable/cross-ref); instead: every iterate.agent[] references an entry in the `agent:` catalog; iterate.sandbox names a deployment (non-empty); and the bed's plan: carries at least one direct `check:` step. Pure — reads uf.PluginKinds["agent"] + node.Iterate + node.Plan.

func ValidateMembers added in v0.2026209.2002

func ValidateMembers(uf *UnifiedFile) error

ValidateMembers enforces the member-specific invariants beyond the generic deploy validation (which already runs on the folded members): member keys carry no `.` (dots are reserved for nested dotted-path addressing) and reference a valid target kind. Pod-target members get the required-image: check via the generic validateDeploymentTree on the folded entry. Registry-free: the valid-target set is the CUE-derived spec.ResourceKinds (minus the targetless "group") — the SAME derivation the host's deployTargetWords uses (R3) — so a new deploy substrate is a valid member target without a core edit (boundary law clause D).

func ValidatePreemptible added in v0.2026209.2002

func ValidatePreemptible(uf *UnifiedFile,
	resolveResource func(json.RawMessage) (*spec.ResolvedResource, error),
	resolveVm func(json.RawMessage) (*spec.ResolvedVm, error),
) error

ValidatePreemptible validates preemptible / requires_exclusive / requires_shared across a unified project's deploy map (which includes folded kind:check beds), plus the resource-vocabulary cross-check, returning the first batch of errors for the LoadUnified hard-fail path. resolveResource / resolveVm project the opaque resource: / vm: plugin-kind bodies into their resolved envelopes via the registry (host-threaded).

func ValidatePreemptibleOnNode added in v0.2026209.2002

func ValidatePreemptibleOnNode(name string, node *spec.BundleNode, d *spec.Diagnostics)

ValidatePreemptibleOnNode checks one deploy node's preemptible + requires_exclusive/requires_shared fields and accumulates problems into d:

  • preemptible.holds must be non-empty (a holder that holds nothing is meaningless — nothing for a claimant to contend over).
  • preemptible.stop must be "shutdown" (the ONLY mechanism that frees a VFIO passthrough device; pause/managedsave/destroy are rejected with a reason).
  • preemptible.restore must be "always" or "on-success".
  • requires_exclusive / requires_shared entries must be non-empty strings.
  • a node may not claim a resource BOTH exclusively and shared, nor both hold and require/share the SAME token (self-contention).

func ValidateVmNamingGuard added in v0.2026209.2002

func ValidateVmNamingGuard(name string, d *spec.Diagnostics)

ValidateVmNamingGuard enforces the reserved -eph- infix on user-authored entity names.

func VenueIsAgentProvisioned added in v0.2026209.2002

func VenueIsAgentProvisioned(uf *UnifiedFile, venue string) bool

VenueIsAgentProvisioned reports whether the bare top-level venue name resolves to an agent-provisioned member/child anywhere in uf's bundle trees. Used by the host-target image preflight to SKIP venues whose image the AI builds in-run (they are not pullable). Agent-provisioned members are not folded to top-level, so the lookup walks each bed's in-tree members/children.

func Walk added in v0.2026194.1400

func Walk(rootDir string, rootData []byte, rootIdentity string, seams spec.WalkSeams) (spec.LoadedProject, error)

Walk walks a project rooted at rootDir and returns its kind-blind parse envelope. rootData is the (possibly bootstrap-transformed) bytes of the root charly.yml — used for the root file instead of re-reading; pass nil for a namespace child (read from disk). rootIdentity is the root project's own repo identity (the host's rootRepoIdentity), seeded into the cycle-break so a transitive self-import resolves to the in-progress root — mirrors LoadUnified seeding loadingRepos[rootRepoIdentity(dir)] = merged BEFORE the walk starts.

Types

type CandyCandidate added in v0.2026209.2002

type CandyCandidate struct {
	Scanned spec.ScannedCandy
	Version string // per-entity version (Scanned.Model.Version) — mandatory, never ""
	GitTag  string // fetch coordinate (the @github :vTAG)
	Source  string // "<repo>@<git-tag>" for warning attribution
}

CandyCandidate is one fetched materialization of a bare candy ref. The git tag is the fetch coordinate; Version is the candy's own per-entity `version:`.

func PickCandyVersion added in v0.2026209.2002

func PickCandyVersion(bareRef string, cands []CandyCandidate) CandyCandidate

PickCandyVersion arbitrates the candidates of ONE bare ref by per-entity version. Same per-entity version across different git tags => NO warning, the newest git tag wins (freshness). Different per-entity versions => warn once (naming the winner + a loser) and the newest per-entity version wins. This is the sole candy-version arbiter — direct and transitive refs both flow through it. cands is non-empty.

type InlineCandy added in v0.2026206.1046

type InlineCandy struct {
	From           string `yaml:"from,omitempty" json:"from,omitempty"`
	spec.CandyYAML `yaml:",inline"`
	// Manifest carries the discovery manifest filename for a `From:` directory so the candy
	// scan reads the right file. Not YAML-authored; carried through the opaque candy-map fold
	// via JSON, hence exported + json-tagged.
	Manifest string `yaml:"-" json:"__manifest,omitempty"`
}

InlineCandy is a candy declared inline in the unified file's `candy:` map. Mutually exclusive options: `from:` points at a directory to scan (the loader's CandyScanner seam), OR the inline body defines the candy (same fields as the candy manifest, flattened via yaml:",inline").

func DecodeInlineCandy added in v0.2026206.1046

func DecodeInlineCandy(raw json.RawMessage) (*InlineCandy, bool)

DecodeInlineCandy decodes one opaque layer body into the InlineCandy loader shape.

type LoadSeams added in v0.2026206.1046

type LoadSeams struct {
	// RunBootstrapPhase invokes every registered bootstrap-phase plugin
	// (sdk.PhaseBootstrap) on the raw root config bytes, returning the
	// (possibly transformed) bytes. A no-op seam returns data unchanged.
	RunBootstrapPhase func(data []byte) []byte
	// WalkProject runs the kind-blind import/discover/namespace walk (the
	// registered spec.ProjectWalker, reached via the host's spec.WalkSeams) and
	// returns the generic spec.LoadedProject envelope — no materialize, no merge.
	WalkProject func(dir string, rootData []byte) (spec.LoadedProject, error)
	// MaterializeLoadedProject replays the host's per-document/per-namespace
	// MATERIALIZE + root-wins MERGE over the walk envelope, reconstructing merged
	// (registry kind-decode via the registered spec.Materializer).
	MaterializeLoadedProject func(lp *spec.LoadedProject, merged *UnifiedFile, byID map[int64]*UnifiedFile) error
	// FlattenBundleVenues stamps every plan step's execution venue from its
	// bundle-tree position and hoists member/child steps into the root Plan.
	FlattenBundleVenues func(uf *UnifiedFile) error
	// FoldMembers copies every deploy node's `peer:` entries into the Bundle map
	// as top-level addressable entries. Its relocation (if any) is a FINAL/K5
	// decision (bundle_members.go) — it stays host-resident, reached only via
	// this seam.
	FoldMembers func(uf *UnifiedFile) error
	// StampBundleDescents stamps every deploy node's venue-hop descent
	// descriptor (P9 DeployTraits, resolved from the provider registry).
	StampBundleDescents func(uf *UnifiedFile)
	// ValidateEphemeral auto-promotes disposable:true on ephemeral entries and
	// validates the ephemeral / vm-naming invariants.
	ValidateEphemeral func(uf *UnifiedFile) error
	// ValidateCheckBeds enforces the kind:check bed invariants (disposable,
	// cross-ref, external-substrate recognition via the provider registry).
	ValidateCheckBeds func(uf *UnifiedFile) error
	// ValidateAndroidDevices enforces the kind:android box⊻adb XOR (resolves
	// android templates via the plugin-substrate provider).
	ValidateAndroidDevices func(uf *UnifiedFile) error
	// ValidateMembers enforces the member-specific invariants beyond the generic
	// deploy validation. Paired with FoldMembers under the same FINAL/K5 ruling.
	ValidateMembers func(uf *UnifiedFile) error
	// ValidatePreemptible validates preemptible/requires_exclusive/requires_shared
	// across the deploy map, including the resource-vocabulary cross-check
	// (resolves the `resource:` plugin kind via the provider registry).
	ValidatePreemptible func(uf *UnifiedFile) error
}

LoadSeams bundles every registry-coupled or standing-core-resident step LoadUnified's orchestration calls out to. A nil field panics on use — the host wrapper (charly/unified.go) is the SOLE constructor and always populates every field before calling LoadUnified.

func LoadSeamsFromExecutor added in v0.2026209.2002

func LoadSeamsFromExecutor(exec LoaderExecutor) LoadSeams

LoadSeamsFromExecutor builds a LoadSeams from a LoaderExecutor: the PURE, registry-free LOAD-half seams (relocated into loaderkit, K1-LOADER RELOCATION) are wired DIRECTLY; the registry-/host- coupled seams dispatch through exec. The DATA seams (descent stamp + ephemeral / check-bed validators) call exec.LoaderThreaded() FRESH inside their closures — matching charly's former per-seam loaderThreaded() calls, because the walk's connect pass mutates the registry mid-load so a build-time snapshot would be stale. This is the seam constructor a PLUGIN uses to run loaderkit.LoadUnified without importing charly core.

type LoaderExecutor added in v0.2026209.2002

type LoaderExecutor interface {
	// LoaderThreaded returns the CURRENT registry-derived snapshot (recognized kinds / deploy
	// substrates / DeployTraits / ExternalDeploySubstrates / …). Called FRESH at each DATA-seam
	// invocation — NEVER cached at seam-build time — because the walk's connect-declared-kind pass
	// mutates the registry BETWEEN seam construction and the post-walk validators, so a build-time
	// snapshot would be stale (matches charly's former per-seam loaderThreaded() calls exactly).
	LoaderThreaded() spec.Threaded
	// RunBootstrapPhase invokes every registered bootstrap-phase plugin on the raw root bytes,
	// returning the (possibly transformed) bytes.
	RunBootstrapPhase(data []byte) []byte
	// WalkProject runs the kind-blind import/discover/namespace walk (the registered
	// spec.ProjectWalker, reached via the host's spec.WalkSeams) → the generic spec.LoadedProject
	// envelope. The host #NodeDoc CUE gate (WalkSeams.GateDoc) runs INSIDE this walk.
	WalkProject(dir string, rootData []byte) (spec.LoadedProject, error)
	// MaterializeLoadedProject replays the host's per-document/per-namespace MATERIALIZE + root-wins
	// MERGE over the walk envelope (registry kind-decode via the registered spec.Materializer).
	// RULING 1: a TRANSITIONAL host leg — the whole embed+parser+registry orchestration stays
	// host-side until task #48 relocates it into loaderkit.
	MaterializeLoadedProject(lp *spec.LoadedProject, merged *UnifiedFile, byID map[int64]*UnifiedFile) error
	// ValidateAndroidDevices enforces the kind:android box⊻adb XOR — resolves android templates via
	// the provider registry (host-coupled), so a leg, not a pure loaderkit move.
	ValidateAndroidDevices(uf *UnifiedFile) error
	// ValidatePreemptible validates preemptible / requires_exclusive / requires_shared across the
	// deploy map, including the resource-vocabulary cross-check (resolves the resource plugin kind +
	// vm/resource entities via the registry) — host-coupled, so a leg.
	ValidatePreemptible(uf *UnifiedFile) error
}

LoaderExecutor is the typed host-leg contract for the registry-/host-coupled loader steps LoadUnified cannot do kind-blind: the bootstrap-phase plugin invocation, the registry-coupled import/discover walk, the materialize kind-decode + merge, and the two registry-resolving validators. Because the methods are TYPED, a compiled-in placement pays no envelope tax; only a true out-of-module plugin marshals (the existing spec.LoadedProject / UnifiedFile envelopes).

type MaterializeProjectSeams added in v0.2026209.2002

type MaterializeProjectSeams struct {
	// MaterializeProject folds ONE document's parsed entity nodes into uf via the registered
	// spec.Materializer (registry kind-decode + the per-node not-found policy). uf already carries
	// the document's decoded reserved directives; this adds the Box/Candy/Bundle/PluginKinds
	// entities, accumulating across the document's node list.
	MaterializeProject func(pp *spec.ParsedProject, uf *UnifiedFile) error
	// FoldDiscoveredManifests folds every discovered manifest's parsed nodes into uf — a LAYER
	// candy registers a lazy `From:` reference (the bootstrap-critical candyIsImage box⊻layer
	// routing stays host-side), every other kind materializes via the registered spec.Materializer.
	// Shared host-side with charly's ApplyDiscover (R3), so it stays one host leaf.
	FoldDiscoveredManifests func(dms []spec.DiscoveredManifest, uf *UnifiedFile) error
	// ApplyEmbeddedDefaults merges the binary-embedded build vocabulary + sidecar templates UNDER
	// uf's own entries (project-wins). Host-resident: the embedded bytes and the host node-form
	// parser are charly's.
	ApplyEmbeddedDefaults func(uf *UnifiedFile) error
}

MaterializeProjectSeams bundles the host-coupled leaf legs MaterializeLoadedProject's kind-blind orchestration calls out to. Each is registry-/host-/bootstrap-coupled and CANNOT run kind-blind inside loaderkit; the host wrapper (charly's hostMaterializeProjectSeams) is the sole constructor and always populates every field. A nil field panics on use.

type RemoteDownload added in v0.2026209.2002

type RemoteDownload struct {
	RepoPath string
	Version  string
	Refs     []string // bare refs to import (e.g. "github.com/org/repo/candy/name")
}

RemoteDownload represents a unique (repo, version) pair to download, along with the specific bare refs needed from it.

type ResolveOpts added in v0.2026209.2002

type ResolveOpts struct {
	IncludeDisabled      bool            // skip the `enabled: false` check
	IncludeDisabledNames map[string]bool // when non-empty, scope IncludeDisabled to these names only
	// RequestedBoxes are the explicit build targets (`charly box build <name>`). A qualified name
	// here (e.g. `charly.arch-builder`) is pulled into the resolved set even when it isn't reachable
	// as a base/builder of a root image — so a namespaced image can be an on-demand build target, not
	// only a transitive base. Bare names are ignored here (they resolve through the root loop).
	RequestedBoxes []string
	// ExtraCandyRefs are candy refs to collect IN ADDITION to the image/builder/kind:local-template
	// closure — specifically a DEPLOY's `add_candy:` candies. The image-closure walk (collectBox)
	// never reaches them, so a bed that add_candy's a host-side PLUGIN candy must pass its add_candy
	// refs here, or the plugin never enters the candy scan and loadProjectPlugins can't build/connect
	// it. NEVER read by the moved buildkit resolvers — consumed solely by the candy scan.
	ExtraCandyRefs []string
	// InitCfg is the project init: vocabulary (W9), threaded through so the candy scan can run the
	// cross-candy init-system host-completion pass (PopulateCandyInitSystem) BEFORE wrapping each
	// candy into the FINAL spec.CandyReader. A caller that leaves this nil skips the pass (correct
	// only for a caller with no init-aware consumer downstream). NEVER read by the buildkit resolvers.
	InitCfg *buildkit.InitConfig
	// DistroCfg / BuilderCfg are the project's build vocabulary (distro:/builder:), threaded through
	// so a resolve does not re-run the project load on every call (a caller with the triple, or a
	// multi-box loop, sets it once and skips the redundant reload; nil is byte-identical fallback).
	DistroCfg  *buildkit.DistroConfig
	BuilderCfg *buildkit.BuilderConfig
}

ResolveOpts carries the scan/load options threaded through the candy scan + project resolution.

func (ResolveOpts) ShouldIncludeDisabled added in v0.2026209.2002

func (opts ResolveOpts) ShouldIncludeDisabled(name string) bool

ShouldIncludeDisabled reports whether name's disabled gate should be bypassed under opts. Centralizes the IncludeDisabled + IncludeDisabledNames interaction so call sites stay simple.

type ResolveProjectSeams added in v0.2026209.2002

type ResolveProjectSeams struct {
	// ResolveBox resolves ONE box. The host closure captures the ResolveOpts (incl. the pre-filled
	// DistroCfg/BuilderCfg that short-circuit fillBuildConfigFallback), so the assembler passes no opts.
	ResolveBox func(cfg *spec.Config, name, calver, dir string) (*buildkit.ResolvedBox, error)
	// FillNamespacedBoxes folds each import namespace's boxes (qualified) + their OWN candy sets into rp.
	// HOST (embeds a per-namespace scan + render-prep); becomes pre-computed inputs at U5.
	FillNamespacedBoxes func(uf *UnifiedFile, initCfg *buildkit.InitConfig, prefix, calver, dir string, rp *spec.ResolvedProject, visited map[*UnifiedFile]bool)
	// ResolveResources projects uf's `resource:` kind entities. HOST (per-node registry resolve);
	// becomes an InvokeProvider(ClassKind,"resource") leg at U5.
	ResolveResources func(uf *UnifiedFile) map[string]*spec.ResolvedResource
	// ShouldIncludeDisabled reports whether a disabled box's `enabled: false` gate is bypassed (host opts).
	ShouldIncludeDisabled func(name string) bool
	// ComputeIntermediates adds auto-generated intermediate images (host: lifts cfg.Defaults).
	ComputeIntermediates func(boxes map[string]*buildkit.ResolvedBox, layers map[string]spec.CandyReader, cfg *spec.Config, tag string) (map[string]*buildkit.ResolvedBox, error)
	// ExternalizedBuilders is the registry D-FACT (which builder words are served out-of-process). A fixed
	// compiled-in constant, threaded so the assembler stays free of the package-main var.
	ExternalizedBuilders map[string]bool
}

ResolveProjectSeams carries the host-coupled legs the envelope assembler cannot run itself. Each is a closure the caller builds — the host over its in-proc ResolveOpts/registry, the plugin over its reverse channel. None inspects a concrete ResolveOpts here, so the assembler stays opts-agnostic.

type ScanSeams added in v0.2026209.2002

type ScanSeams struct {
	// CollectRemoteRefs runs the reachability-scoped remote-ref walk over the project's boxes +
	// this local candy set, returning each distinct (repo, git-tag) to fetch. Host closure:
	// CollectRemoteRefsOpts(cfg, FinalizeScannedCandies(localScanned, nil), withLocalRawRefs(opts, localScanned)).
	CollectRemoteRefs func(localScanned map[string]spec.ScannedCandy) ([]RemoteDownload, error)
	// EnsureRepo resolves a (repoPath, version) to a local cache directory, fetching + auto-migrating
	// on a cache miss (host closure: EnsureRepoDownloaded).
	EnsureRepo func(repoPath, version string) (string, error)
	// ScanRemote scans the wanted bare refs out of a downloaded repo cache dir (host closure:
	// requireCandyScanner().ScanRemoteCandy(cacheDir, repoPath, wantRefs, parseCandyYAML)).
	ScanRemote func(cacheDir, repoPath string, wantRefs map[string]bool) (map[string]spec.ScannedCandy, error)
}

ScanSeams carries the host-coupled legs ScanCandyFromLocal reaches for the fetch fix-point. The caller builds these as closures capturing its config/opts + host mechanisms (registry, refs backend); the pure fix-point below never inspects a package-main type.

type UnifiedFile added in v0.2026206.1046

type UnifiedFile struct {
	Version string `yaml:"version,omitempty" json:"version,omitempty"`
	// Repo is this project's canonical repo identity (e.g. "github.com/opencharly/charly").
	// Optional; only meaningful on the ROOT file. See repo_identity.go.
	Repo string `yaml:"repo,omitempty" json:"repo,omitempty"`
	// Import is the SINGLE composition statement. A list whose items are either a bare string
	// (flat import into THIS root namespace) or a single-key map `alias: ref` (a namespaced
	// child import). See ImportList (directives.go).
	Import   kit.ImportList     `yaml:"import,omitempty" json:"import,omitempty"`
	Discover kit.DiscoverConfig `yaml:"discover,omitempty" json:"discover,omitempty"`
	// Defaults carries the `defaults:` block (BoxConfig-shaped inheritance defaults).
	Defaults spec.BoxConfig `yaml:"defaults,omitempty" json:"defaults,omitempty"`
	// Box is the generic kind-keyed IMAGE map (P6): name → opaque marshaled spec.BoxConfig.
	Box spec.BoxMap `yaml:"box,omitempty" json:"box,omitempty"`
	// Candy is the generic kind-keyed LAYER map: name → opaque marshaled InlineCandy.
	Candy map[string]json.RawMessage `yaml:"candy,omitempty" json:"candy,omitempty"`
	// Bundle is the flat name-keyed deploy map (the canonical `deploy:` surface).
	Bundle   map[string]spec.BundleNode `yaml:"deploy,omitempty" json:"deploy,omitempty"`
	Provides *deploykit.ProvidesConfig  `yaml:"provides,omitempty" json:"provides,omitempty"`

	// PluginKinds holds entities of KINDS contributed by plugins (a kind the core has no typed
	// map for). NAME-KEYED: kind word → entity NAME → canonical body (opaque JSON). Built-in
	// kinds decode into their typed maps above. Host-internal — never serialized.
	PluginKinds map[string]map[string]json.RawMessage `yaml:"-" json:"-"`

	// Namespaces holds child namespaces mounted by namespaced `import:` entries (alias →
	// fully-resolved isolated UnifiedFile). NOT authored directly — populated by the
	// materialize pass. Entries are referenced qualified, e.g. `base: cachyos.cachyos`.
	Namespaces map[string]*UnifiedFile `yaml:"-"`

	// RootDir is this UnifiedFile's OWN base directory — the dir its root document's SrcDir
	// names. Set once per materialize, for both the top-level project and each mounted
	// namespace. Empty for a project-less / synthetic UnifiedFile.
	RootDir string `yaml:"-"`
}

UnifiedFile is the full schema of a single unified-format YAML document. Every field is optional — a file with only `distro:` is valid (typical for the embedded build vocabulary); a file with only `deploy:` is valid; etc.

func LoadUnified added in v0.2026206.1046

func LoadUnified(dir string, seams LoadSeams) (*UnifiedFile, bool, error)

LoadUnified reads <dir>/charly.yml and returns the fully loaded, validated *UnifiedFile — the kind-blind orchestration ported verbatim from charly's former inline LoadUnified body. Every registry-coupled or standing-core- resident step is reached through seams; LoadUnified itself never imports or touches the provider registry.

func (*UnifiedFile) Android added in v0.2026206.1046

func (uf *UnifiedFile) Android() map[string]json.RawMessage

func (*UnifiedFile) BoxConfig added in v0.2026206.1046

func (uf *UnifiedFile) BoxConfig(name string) (spec.BoxConfig, bool)

BoxConfig decodes the authored image config for name; ok=false when absent.

func (*UnifiedFile) BoxNames added in v0.2026206.1046

func (uf *UnifiedFile) BoxNames() []string

BoxNames returns the image names, sorted.

func (*UnifiedFile) CheckBeds added in v0.2026206.1046

func (uf *UnifiedFile) CheckBeds() map[string]spec.BundleNode

CheckBeds returns the disposable R10 beds keyed by name. In the unified node-form model a bed IS a `disposable: true` bundle, so the bed set is derived directly from the disposable bundles in the Bundle map. Members are instruments (brought up alongside a driver), never standalone beds. Single enumeration source for `charly check run <bed>` (and the /verify-beds fan-out).

func (*UnifiedFile) HasBox added in v0.2026206.1046

func (uf *UnifiedFile) HasBox(name string) bool

HasBox reports whether an image named name is present.

func (*UnifiedFile) K8s added in v0.2026206.1046

func (uf *UnifiedFile) K8s() map[string]json.RawMessage

func (*UnifiedFile) Local added in v0.2026206.1046

func (uf *UnifiedFile) Local() map[string]json.RawMessage

func (*UnifiedFile) Pod added in v0.2026206.1046

func (uf *UnifiedFile) Pod() map[string]json.RawMessage

func (*UnifiedFile) ProjectBundleConfig added in v0.2026206.1046

func (uf *UnifiedFile) ProjectBundleConfig() *deploykit.BundleConfig

ProjectBundleConfig returns the *deploykit.BundleConfig equivalent (deployments: section of the authored file, independent of any per-machine ~/.config/charly/charly.yml, which remains loaded separately by deploykit.LoadBundleConfig).

func (*UnifiedFile) ProjectConfig added in v0.2026206.1046

func (uf *UnifiedFile) ProjectConfig() *spec.Config

ProjectConfig returns the *spec.Config equivalent of uf (the box config view).

func (*UnifiedFile) SetBox added in v0.2026206.1046

func (uf *UnifiedFile) SetBox(name string, b spec.BoxConfig)

SetBox stores an authored image config under name (marshaling it opaque).

func (*UnifiedFile) SetCandy added in v0.2026206.1046

func (uf *UnifiedFile) SetCandy(name string, il *InlineCandy)

SetCandy stores a layer under name (marshaling it opaque).

func (*UnifiedFile) VM added in v0.2026206.1046

func (uf *UnifiedFile) VM() map[string]json.RawMessage

VM/Pod/K8s/Local/Android are DERIVED accessors over uf.PluginKinds[disc] — the 5 standalone-substrate-TEMPLATE kinds fold into PluginKinds generically (no per-kind-word switch). Each returns the opaque name→body map for its kind (nil when none configured); the kernel never decodes the bodies itself — consuming PLUGINS decode a body into the concrete kind they need.

type ValidationError added in v0.2026209.2002

type ValidationError struct {
	Errors []string
}

ValidationError accumulates project/candy validation error messages (the loader validation accumulator, distinct from the richer spec.Diagnostics — a plain []string collector).

func (*ValidationError) Add added in v0.2026209.2002

func (e *ValidationError) Add(format string, args ...any)

Add adds an error to the collection.

func (*ValidationError) Error added in v0.2026209.2002

func (e *ValidationError) Error() string

func (*ValidationError) HasErrors added in v0.2026209.2002

func (e *ValidationError) HasErrors() bool

HasErrors returns true if there are any errors.

Jump to

Keyboard shortcuts

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