deploykit

package
v0.2026194.1400 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 19 Imported by: 19 modules, 18 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

quadlet.go — the POD config-WRITE mechanism, relocated out of charly core (P11a). GenerateQuadlet + its pure closure render a systemd quadlet .container file from a QuadletConfig; the compiled-in candy/plugin-deploy-pod builds the QuadletConfig from the host config-resolve seam and calls this. A PURE render mechanism (M under the kernel/plugin boundary law): no host I/O, no globals — byte-identical to the former core generateQuadlet (S4 parity spike). VolumeMount is a resolved runtime type owned in this package (deploy_volume.go); the tunnel wire types are spec.TunnelConfig/TunnelPort (CUE-sourced, P11 wire-mandate repair); SecurityConfig is vmshared's; ResolvedSidecar is the host-adapted deploykit runtime type (defined below), not spec's wire ResolvedSidecar.

quadlet_pod.go — the pod + sidecar quadlet content generators, relocated from charly core (P11 config-write move); a compiled-in deploy:pod plugin calls them to write the .pod + sidecar .container files.

Package deploykit holds the InstallPlan step VOCABULARY — the 13 concrete InstallStep implementations + their field-structs + the pure classification helpers — that any deploy front-end (charly's host engine, an out-of-tree deploy plugin) imports. Each concrete step implements spec.InstallStep (homed in sdk/spec with the IR enums + the InstallPlan container). deploykit imports spec; the aliases below let the moved code read unchanged.

Index

Constants

View Source
const (
	VenueLocal = kit.VenueLocal

	JumpPodmanExec   = kit.JumpPodmanExec
	JumpDockerExec   = kit.JumpDockerExec
	JumpPodmanRun    = kit.JumpPodmanRun
	JumpDockerRun    = kit.JumpDockerRun
	JumpSSH          = kit.JumpSSH
	JumpVirshConsole = kit.JumpVirshConsole
)
View Source
const (
	PreemptStopShutdown  = spec.PreemptStopShutdown
	PreemptRestoreAlways = spec.PreemptRestoreAlways
)
View Source
const (
	ScopeSystem      = spec.ScopeSystem
	ScopeUser        = spec.ScopeUser
	ScopeUserProfile = spec.ScopeUserProfile

	PhasePrepare = spec.PhasePrepare
	PhaseInstall = spec.PhaseInstall
	PhaseCleanup = spec.PhaseCleanup

	VenueHostNative       = spec.VenueHostNative
	VenueContainerBuilder = spec.VenueContainerBuilder
	VenueSkip             = spec.VenueSkip

	GateNone             = spec.GateNone
	GateAllowRepoChanges = spec.GateAllowRepoChanges
	GateAllowRootTasks   = spec.GateAllowRootTasks
	GateWithServices     = spec.GateWithServices

	StepKindSystemPackages  = spec.StepKindSystemPackages
	StepKindBuilder         = spec.StepKindBuilder
	StepKindOp              = spec.StepKindOp
	StepKindFile            = spec.StepKindFile
	StepKindServicePackaged = spec.StepKindServicePackaged
	StepKindServiceCustom   = spec.StepKindServiceCustom
	StepKindShellHook       = spec.StepKindShellHook
	StepKindShellSnippet    = spec.StepKindShellSnippet
	StepKindRepoChange      = spec.StepKindRepoChange
	StepKindApkInstall      = spec.StepKindApkInstall
	StepKindLocalPkgInstall = spec.StepKindLocalPkgInstall
	StepKindReboot          = spec.StepKindReboot
	StepKindExternalPlugin  = spec.StepKindExternalPlugin

	ReverseOpCoprDisable    = spec.ReverseOpCoprDisable
	ReverseOpPackageRemove  = spec.ReverseOpPackageRemove
	ReverseOpRemoveDropin   = spec.ReverseOpRemoveDropin
	ReverseOpRemoveEnvdFile = spec.ReverseOpRemoveEnvdFile
	ReverseOpRemoveManaged  = spec.ReverseOpRemoveManaged
	ReverseOpRemoveRepoFile = spec.ReverseOpRemoveRepoFile
	ReverseOpRestoreEnabled = spec.ReverseOpRestoreEnabled
	ReverseOpRmFileSystem   = spec.ReverseOpRmFileSystem
	ReverseOpRmFileUser     = spec.ReverseOpRmFileUser
	ReverseOpServiceDisable = spec.ReverseOpServiceDisable
	ReverseOpServiceRemove  = spec.ReverseOpServiceRemove
)
View Source
const ExternalStepKindPrefix = "external:"

ExternalStepKindPrefix marks a StepKind string as an external (plugin-contributed) kind.

View Source
const HomeToken = "{{.Home}}"

HomeToken is the deferred-home placeholder resolved by ResolveHome at emit time.

Variables

View Source
var (
	ExpandPath = kit.ExpandPath

	KwRun = kit.KwRun
)

AllStepKinds is the fixed InstallStep IR vocabulary — the 13 compiled-in concrete step kinds (external:<word> kinds are dynamic and not listed).

View Source
var CompileActOp func(op *Op, layer CandyModel, img *ResolvedBox) InstallStep

CompileActOp lowers a `run:` act op (install verb or `plugin:` verb) into an InstallStep. Provider-coupled (kernel provider registry), so charly owns it and injects it; the compiler calls the seam.

View Source
var CompileServiceSteps func(layer CandyModel, img *ResolvedBox, hostCtx HostContext) []InstallStep

CompileServiceSteps lowers a candy's service: list into install steps. Loader- and service-render-coupled (LoadBuildConfigForBox + RenderService live in charly), so charly owns it and injects it.

View Source
var OpInContext func(op *Op, ctx ExecContext) bool

OpInContext reports whether an op runs in the given exec context. Its fallback consults the kernel VerbCatalog (charly), so charly injects the impl at init.

View Source
var ShellAllowlist = map[string]bool{"bash": true, "zsh": true, "fish": true, "sh": true}

ShellAllowlist enumerates valid per-shell sub-block keys inside `shell:`.

View Source
var TaskAutoExports = map[string]bool{
	"USER":       true,
	"UID":        true,
	"GID":        true,
	"HOME":       true,
	"ARCH":       true,
	"BUILD_ARCH": true,
}

TaskAutoExports are the auto-exported variable names reserved for the generator; `vars:` entries may not shadow these, and every `${VAR}` reference resolves against (auto-exports ∪ candy.Vars).

View Source
var TaskVarRefPattern = regexp.MustCompile(`\$\{([A-Z_][A-Z0-9_]*)\}`)

TaskVarRefPattern matches ${NAME} references in task fields.

View Source
var VmSshAlias = kit.VmSshAlias

Functions

func AbsoluteCandySequence added in v0.2026193.1801

func AbsoluteCandySequence(boxName string, boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel, globalOrder []string) []string

AbsoluteCandySequence returns an image's complete candy set (own + entire base chain) as a subsequence of the global order.

func AddTransitiveDeps added in v0.2026193.1801

func AddTransitiveDeps(candyName string, layers map[string]CandyModel, needed map[string]bool, excluded map[string]bool)

AddTransitiveDeps adds all transitive dependencies of a candy to the needed set.

func AppendOrReplaceEnv added in v0.2026190.848

func AppendOrReplaceEnv(envs []string, entry string) []string

AppendOrReplaceEnv adds or replaces an env var entry (KEY=VALUE) in a slice. If the key already exists, the value is replaced in-place.

func AppendShellPathLines added in v0.2026190.848

func AppendShellPathLines(body string, paths []string, shell, home string) string

AppendShellPathLines appends path_append entries to the snippet body using shell-appropriate syntax. bash/zsh/sh use POSIX `PATH=$PATH:X` exports; fish uses `fish_add_path X`. Idempotent: if body already ends with a newline, no extra blank line is inserted.

func ArgHasImageTag added in v0.2026190.848

func ArgHasImageTag(arg string) bool

ArgHasImageTag reports whether arg's trailing path segment carries a ":tag" — the marker of a registry IMAGE ref (ghcr.io/org/image:tag), as opposed to a github REPO ref (which pins with @version) or a dotted-path deploy address. Shared by CanonicalizeDeployArg + the deploy-name guard (R3).

func BareRef added in v0.2026190.848

func BareRef(ref string) string

BareRef returns the map-key form of a ref (no @ prefix, no :version).

func BareVolumeName added in v0.2026194.615

func BareVolumeName(volumeName, boxName, instance string) string

BareVolumeName strips the "charly-<box>[-<instance>]-" prefix from a resolved volume name.

func BedCheckLiveRefs added in v0.2026190.848

func BedCheckLiveRefs(name string, children map[string]*BundleNode) []string

SortedNestedKeys returns the keys of a children map in deterministic order so traversal produces stable output across runs. BedCheckLiveRefs returns the ordered `charly check live` targets for a bed: the substrate itself first, then each nested child as a sorted dotted path. This is the pure list `charly check run` walks so a nested pod's BAKED candy/box check (e.g. the selkies candy's encoder + frame checks on a nested selkies-kde pod) is exercised against its real venue through the chain — not just the parent substrate. Without the nested entries, `charly check run` deploys nested children but never evaluates them. Pure + unit-tested.

func BoxDirectDeps added in v0.2026192.1709

func BoxDirectDeps(name string, img *buildkit.ResolvedBox, boxes map[string]*buildkit.ResolvedBox, includeFormatBuilders bool) []string

BoxDirectDeps returns the direct box-build dependencies of img:

  • Base (when not an external OCI ref)
  • Builder.AllBuilder() format-builder boxes (only when includeFormatBuilders)
  • BootstrapBuilderImage (the `from: builder:pacstrap` / debootstrap source)

Self-refs and refs to boxes not in the map (for builder + bootstrap builder) are filtered out. Base is appended unconditionally when not external.

One helper, three callers (ResolveBoxOrder, ResolveBoxLevels, filterBox in build.go) so adding a future edge kind lands in one place.

func BoxNeedsBuilder added in v0.2026192.1709

func BoxNeedsBuilder(img *buildkit.ResolvedBox, boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel) bool

BoxNeedsBuilder returns true if any of the box's own resolved candies (excluding parent-provided) have pixi.toml, package.json, or Cargo.toml. When candies is nil, falls back to unconditional builder dependency.

func BuildArchExports added in v0.2026192.1709

func BuildArchExports() string

BuildArchExports emits the shell prelude that maps `uname -m` to a Go-style ARCH (amd64/arm64/arm) for download/build steps.

func BuilderCtxKey added in v0.2026190.848

func BuilderCtxKey(candy, builder string) string

BuilderCtxKey keys the per-(candy,builder) pre-resolved builder context.

func BundleWalkPostOrder added in v0.2026190.848

func BundleWalkPostOrder(n *BundleNode, path string, fn func(path string, node *BundleNode) error) error

WalkPostOrder invokes fn on every child (recursively, post-order) before invoking fn on this node. Post-order is the delete-order semantic: a child must be torn down while its parent environment is still alive, so the caller reverses leaves first.

func BundleWalkPreOrder added in v0.2026190.848

func BundleWalkPreOrder(n *BundleNode, path string, fn func(path string, node *BundleNode) error) error

WalkPreOrder invokes fn on this node, then recurses into every child in sorted key order. Pre-order is the add-order semantic: a parent's environment must exist before its children can run inside it, so the caller applies deploys root-first.

fn receives the full dotted path to each node (e.g. "stack.web.db"). The root path argument is prepended; callers pass the node's own key as `path`.

When fn returns a non-nil error, traversal stops immediately and the error propagates.

func CandyMapKey added in v0.2026192.1709

func CandyMapKey(layer CandyModel) string

CandyMapKey returns the candy's map key: the full @github ref for a remote candy (RepoPath/SubPathPrefix+Name), else the bare Name. Relocated from charly (P8).

func CandyNeedsBuilderStep added in v0.2026190.848

func CandyNeedsBuilderStep(layer CandyModel, bDef *BuilderDef) bool

CandyNeedsBuilderStep mirrors Generator.candyNeedsBuilder without requiring a Generator receiver — the compiler doesn't have one.

func CandyProvidedByBox added in v0.2026192.1709

func CandyProvidedByBox(boxName string, boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel) (map[string]bool, error)

CandyProvidedByBox returns the set of candies installed by a box (including those inherited from parent boxes via base chain)

func CandyStageDirName added in v0.2026192.1709

func CandyStageDirName(layer CandyModel) string

CandyStageDirName returns the content-addressed staging dir name for a remote candy's copied tree (name.version). Relocated from charly (P8); byte-identical.

func CanonicalizeDeployArg added in v0.2026190.848

func CanonicalizeDeployArg(arg, instance string) (box, inst string)

CanonicalizeDeployArg splits Pattern A "<base>/<instance>" CLI positional args into their component (image, instance) pair. Idempotent: if the input is already split (instance != "") or contains no slash, returns as-is. Pattern B (FQ ref containing "/") is identified by presence of "@" or ":" suffix on the leftmost segment OR a registry-host pattern (contains "." before the first "/") and passed through untouched.

MUST be called at the top of every CLI verb that takes a positional deploy-arg (`charly config`, `charly start`, `charly stop`, `charly shell`, `charly logs`, `charly update`, `charly status`, `charly remove`) — before any downstream code reads c.Image or c.Instance. Without this, Pattern A instance deploys leak past the canonicalization boundary and downstream code conflates the deploy key with the image short-name (see Bug 2/3 RCA notes — MergeDeployOntoMetadata composes wrong key, port/env overlays drop).

func CascadeTagChain added in v0.2026190.848

func CascadeTagChain(img *ResolvedBox) []string

ResolveCascadePackages is THE single distro-specificity cascade resolver, shared by EVERY package-emitting path — the deploy compiler (CompileSystemPackageSteps) AND the image-build Containerfile emitter (generate.go writeCandySteps). There is exactly one resolution so build and deploy can never diverge.

It computes the primary-format package set for a candy on an image: the candy's top-level `package:` BASE, UNION every matching distro tag section walked most-specific-first over img.Distro (deduped), with the Raw extras repo/copr/options/exclude/module resolved MOST-SPECIFIC-WINS. Returns the package list, the rendered Raw install context (including the unioned `package` list), and whether any tag section matched. CascadeTagChain returns the full per-candy cascade tag chain MOST-SPECIFIC FIRST: the image's distro chain (e.g. [debian:13, debian]) followed by the package-format FAMILY tag (img.Pkg = deb/pac/rpm) as the LEAST-specific level. A `distro: deb:` candy block therefore applies to EVERY deb-format distro (debian + ubuntu + their versions), `pac:` to arch + cachyos, `rpm:` to fedora — the family-generic level of the YAML-configured deb/pac/rpm → distro → version hierarchy. img.Pkg is the primary package format declared by the embedded vocabulary (charly/charly.yml), so the hierarchy lives entirely in YAML.

Distro INHERITANCE is the complementary YAML mechanism: img.Distro is already expanded (at resolve time, ExpandPackageInheritance) to include any `inherit_packages: true` ancestor, so a cachyos image/VM carries [cachyos, …, arch] and a `distro: arch:` block DOES reach cachyos — while ubuntu (no flag) stays isolated from debian. Both knobs live entirely in the embedded vocabulary (charly/charly.yml).

func ClassifyTarget added in v0.2026190.848

func ClassifyTarget(node *BundleNode) string

ClassifyTarget normalizes the Target field for dispatch. Empty Target falls back to "pod" (the default for named deploys); otherwise Target is the canonical source of truth (pod|vm|k8s|local|android — set from the node-form kind by bundleTargetForDisc; no name-prefix heuristic).

func CollectAllBoxCandies added in v0.2026192.1709

func CollectAllBoxCandies(boxName string, boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel) []string

CollectAllBoxCandies returns an image's complete candy set (its own resolved candies plus every candy inherited through the full base chain), in first-seen order. Relocated from charly core (P8); byte-identical to the former charly/intermediates.go collectAllBoxCandies.

walked is an IMAGE-visited guard for the base-chain recursion: a base edge may form a cycle (A.base=B, B.base=A) — caught + reported by ResolveBoxOrder, but without this guard the walk recurses a cyclic chain until the stack overflows. Re-visiting a base also can't add new candies, so skipping it is correct for the acyclic case too.

func CollectSubtreeBoxes added in v0.2026193.1801

func CollectSubtreeBoxes(node *TrieNode) []string

CollectSubtreeBoxes returns every terminal user image in the subtree rooted at node — the images terminating at node plus all images in descendant nodes. These are exactly the images that will base, directly or transitively, on an auto-intermediate created at this node, so they define the union of build formats / distro tags the intermediate must carry (see createIntermediate).

func ComputeDeployID added in v0.2026190.848

func ComputeDeployID(box string, layers, addCandies []string) string

ComputeDeployID returns a deterministic hex hash that identifies a specific deploy (image + ordered candy set + add_candy). Used as the ledger key so re-deploys of the same config are recognizable and candy-refcount bookkeeping is stable.

func ComputeEffectiveVersions added in v0.2026192.1709

func ComputeEffectiveVersions(boxes map[string]*buildkit.ResolvedBox, candies map[string]CandyModel) error

ComputeEffectiveVersions assigns ResolvedBox.EffectiveVersion for every image in the build graph. EffectiveVersion is the content-derived identity emitted as the ai.opencharly.version OCI label. Relocated from charly core (P8); byte-identical.

  1. the image's dedicated `version:` (img.Version) if set; else
  2. the highest candy `version:` across its full candy set (CollectAllBoxCandies spans the entire base chain); else
  3. the internal base image's EffectiveVersion (recurse); else
  4. a HARD ERROR — there is NO build-timestamp fallback.

Run AFTER ComputeIntermediates + GlobalCandyOrder so the base chain and the auto-intermediate images are fully materialized in boxes.

func ComputeOwnCandies added in v0.2026193.1801

func ComputeOwnCandies(parentName string, pathCandies []string, result map[string]*buildkit.ResolvedBox, layers map[string]CandyModel, globalOrder []string, pixiBound map[string]bool) []string

ComputeOwnCandies determines which candies an intermediate needs to install (pathCandies minus what the parent already provides).

func DeployKey added in v0.2026190.848

func DeployKey(boxName, instance string) string

DeployKey returns the charly.yml map key for an image, optionally qualified by instance. Base images use just the image name; instances use "image/instance".

func DeployStorageDir added in v0.2026193.1222

func DeployStorageDir(deployKey, instance string) string

DeployStorageDir is the per-deploy directory component for bind-auto paths and encrypted-volume directories. Like DeployVolumePrefix it is unique per deploy (base vs instance vs Pattern-B vs bed). For a base deploy with no instance it is just the deploy key; an instance appends "-<instance>".

func DeployVolumePrefix added in v0.2026193.1222

func DeployVolumePrefix(deployKey, instance string) string

DeployVolumePrefix is the named-volume prefix for a deploy: the deploy's container name plus a dash, so EVERY distinctly-named deploy (base, Pattern-B, instance, or kind:check bed) gets its own volume namespace. Two deploys never share a named volume unless they share a container name (which they can't). Single source of truth for volume naming — ResolveVolumeBacking, removeVolumes, and scopeVolumesToDeployKey all key off it.

func DescribePlan added in v0.2026190.848

func DescribePlan(p *InstallPlan) string

DescribePlan returns a short human-readable summary of a plan. Used by --dry-run table output and by TestDescribePlan for golden comparison.

func DropMappingKey added in v0.2026190.848

func DropMappingKey(m *yaml.Node, key string)

marshalBundleNodeLegacy yaml-marshals a BundleNode into the LEGACY struct body shape — re-injecting the now-yaml:"-" structural fields (`target:`, `nested:`, `peer:`) that no longer marshal off the struct. This reproduces exactly the input migrateDeployEntity expects (the body it converts into node-form tree children), so the per-host overlay writer round-trips the deployment tree even though Target/Children/Members are no longer authored/marshaled fields (Risk 5a). Recurses so nested children + members at every depth are preserved. DropMappingKey removes a key (and its value) from a YAML mapping node in place.

func EmitCmd added in v0.2026192.1709

func EmitCmd(b *strings.Builder, t vmshared.Op, layerStage string, img *buildkit.ResolvedBox, userIsRoot bool)

EmitCmd emits a single RUN for a cmd task, with the layer-stage /ctx bind mount plus cache mounts appropriate to the user (distro format caches for root, npm cache for non-root). Shell is bash via a single-quoted heredoc so authors' $(cmd) / ${VAR} stay intact for bash; BUILD_ARCH is injected as a shell var.

func EmitCopy added in v0.2026192.1709

func EmitCopy(b *strings.Builder, t vmshared.Op, layerStage string, img *buildkit.ResolvedBox)

EmitCopy emits a COPY --from=<layer-stage> for an existing file in the candy dir.

func EmitDownload added in v0.2026192.1709

func EmitDownload(b *strings.Builder, t vmshared.Op, img *buildkit.ResolvedBox) error

EmitDownload emits one RUN per download task: fetch to a content-addressed /tmp/downloads cache, then extract. Honors candy-declared `cache:` mounts.

func EmitLinkBatch added in v0.2026192.1709

func EmitLinkBatch(b *strings.Builder, tasks []vmshared.Op, img *buildkit.ResolvedBox)

EmitLinkBatch emits a single RUN with chained ln -sf for a batch of adjacent same-user link tasks.

func EmitMkdirBatch added in v0.2026192.1709

func EmitMkdirBatch(b *strings.Builder, tasks []vmshared.Op, img *buildkit.ResolvedBox)

EmitMkdirBatch emits a single RUN mkdir -p for a batch of adjacent same-user mkdir tasks, splitting per-mode chmod at the tail when modes differ.

func EmitSetcapBatch added in v0.2026192.1709

func EmitSetcapBatch(b *strings.Builder, tasks []vmshared.Op, img *buildkit.ResolvedBox)

EmitSetcapBatch emits a single RUN setcap … for a batch of adjacent setcap tasks (strip via -r for empty caps, set otherwise), chained with &&.

func EmitVarsEnv added in v0.2026192.1709

func EmitVarsEnv(b *strings.Builder, vars map[string]string)

EmitVarsEnv writes ENV directives for candy.Vars and the build-arg-sourced ARCH auto-export. Sorts vars by key for deterministic output; emitted once per candy.

func EmitWrite added in v0.2026192.1709

func EmitWrite(b *strings.Builder, t vmshared.Op, srcPath string, img *buildkit.ResolvedBox)

EmitWrite emits a COPY from the staged inline-content dir to the destination.

func EncryptedCipherDir added in v0.2026194.615

func EncryptedCipherDir(storagePath, boxName, name string) string

EncryptedCipherDir returns the cipher (encrypted-blob) directory for an encrypted bind mount: <storagePath>/<EncryptedVolumeName>/cipher.

func EncryptedPlainDir added in v0.2026194.615

func EncryptedPlainDir(storagePath, boxName, name string) string

EncryptedPlainDir returns the plain (FUSE mount-point) directory for an encrypted bind mount: <storagePath>/<EncryptedVolumeName>/plain.

func EncryptedVolumeName added in v0.2026194.615

func EncryptedVolumeName(boxName, name string) string

EncryptedVolumeName returns the directory name for an encrypted volume: charly-<box>-<name>.

func EnsureServiceSuffix added in v0.2026190.848

func EnsureServiceSuffix(unit string) string

EnsureServiceSuffix adds `.service` if missing. Distinguishes unit types: if the caller already included a suffix (e.g. "foo.timer", "foo.socket"), leave it alone.

func EnvKey added in v0.2026190.848

func EnvKey(entry string) string

EnvKey extracts the KEY part from a KEY=VALUE string.

func ExpandCandy added in v0.2026192.1709

func ExpandCandy(requested []string, layers map[string]CandyModel) ([]string, error)

ExpandCandy expands candy composition references (candy: field in the candy manifest). For each candy that has IncludedCandies, recursively inserts them into the result. Candies without content (no install files, no env/ports/etc.) are omitted. Returns a flat, deduplicated candy list.

func ExtractStringSlice added in v0.2026190.848

func ExtractStringSlice(m map[string]any, key string) []string

ExtractStringSlice returns m[key] as []string or nil if absent. Accepts []string and []interface{} (as produced by yaml.v3) inputs.

func FormatCPUQuota added in v0.2026194.615

func FormatCPUQuota(cpus string) string

FormatCPUQuota converts a podman --cpus value ("2.5") to systemd's CPUQuota percentage form ("250%"); empty/unparseable → "" (skip the directive).

func GateEnabled added in v0.2026190.848

func GateEnabled(g Gate, opts EmitOpts) bool

GateEnabled returns whether the given gate is permitted under opts. GateNone is always enabled; named gates require the corresponding opt-in flag.

func GeneratePodQuadlet added in v0.2026194.615

func GeneratePodQuadlet(cfg QuadletConfig) string

GeneratePodQuadlet produces the contents of a quadlet .pod file. The pod owns the shared network namespace: ports, network, and Tailscale tun interface.

Dual networking: the pod stays on the "charly" bridge (reachable by other containers) while the Tailscale sidecar adds a tun interface for exit node routing. --exit-node-allow-lan-access exempts bridge subnets from the tunnel.

func GenerateQuadlet added in v0.2026194.615

func GenerateQuadlet(cfg QuadletConfig) string

GenerateQuadlet produces the contents of a quadlet .container file. Pure.

func GenerateSidecarQuadlet added in v0.2026194.615

func GenerateSidecarQuadlet(sc ResolvedSidecar, podName string) string

GenerateSidecarQuadlet produces the contents of a sidecar .container file.

func GenerateTunnelUnit added in v0.2026194.615

func GenerateTunnelUnit(cfg QuadletConfig, cfgPath string) string

GenerateTunnelUnit produces the companion systemd .service unit for a cloudflare tunnel. Relocated from charly core with the P11 config-write move (the deploy:pod plugin writes it); cfgPath (the cloudflared config path) is passed in by the host — the resolution helper tunnelConfigPath stays core, so this generator is pure. Returns "" for a non-cloudflare (or nil) tunnel. Byte-identical to the former core generateTunnelUnit given the same cfgPath.

func GlobalCandyOrder added in v0.2026193.1801

func GlobalCandyOrder(boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel) ([]string, error)

GlobalCandyOrder computes a global topological order of all candies across all enabled images, using popularity (number of images needing each candy) as the primary tie-breaker and lexicographic as secondary.

func GraphReaches added in v0.2026193.1801

func GraphReaches(graph map[string][]string, from, to string) bool

GraphReaches reports whether `to` is reachable from `from` by following dependency edges (graph[x] lists the candies x depends on). Used to keep authored-list-order edge insertion cycle-safe in GlobalCandyOrder.

func InitHasRelayTemplate added in v0.2026192.1709

func InitHasRelayTemplate(def *spec.ResolvedInit) bool

InitHasRelayTemplate reports whether this init definition has a relay template. Relocated from charly (P8).

func InitRenderAssemblyTemplate added in v0.2026192.1709

func InitRenderAssemblyTemplate(def *spec.ResolvedInit) (string, error)

InitRenderAssemblyTemplate renders an init system's assembly_template (the step that assembles contributed unit fragments). Relocated from charly (P8).

func InitRenderPostAssemblyTemplate added in v0.2026192.1709

func InitRenderPostAssemblyTemplate(def *spec.ResolvedInit) (string, error)

InitRenderPostAssemblyTemplate renders the post_assembly_template (e.g. bootc container lint). Relocated from charly (P8).

func InitRenderRelayTemplate added in v0.2026192.1709

func InitRenderRelayTemplate(def *spec.ResolvedInit, port int, candyName string, index int) (string, error)

InitRenderRelayTemplate renders the relay_template for a port relay. Relocated from charly (P8).

func InitRenderStageFragmentCopy added in v0.2026192.1709

func InitRenderStageFragmentCopy(def *spec.ResolvedInit, boxName, fileName string) (string, error)

InitRenderStageFragmentCopy renders the stage_fragment_copy template. Relocated from charly (P8).

func InitRenderSystemEnableTemplate added in v0.2026192.1709

func InitRenderSystemEnableTemplate(def *spec.ResolvedInit, units []string) (string, error)

InitRenderSystemEnableTemplate renders the system_enable_template for the given distro-shipped units. Relocated from charly (P8).

func IntersectPlatforms added in v0.2026193.1801

func IntersectPlatforms(parent, defaults []string) []string

IntersectPlatforms returns platforms present in both slices. If the intersection is empty, returns parent (the more restrictive set).

func IpcModeBlocksShmSize added in v0.2026194.615

func IpcModeBlocksShmSize(ipcMode string) bool

IpcModeBlocksShmSize reports whether an IPC mode makes podman reject ShmSize.

func IsAutoVmDeployEntry added in v0.2026190.848

func IsAutoVmDeployEntry(entry BundleNode) bool

IsAutoVmDeployEntry reports whether a VM deploy entry carries NOTHING beyond the fields saveVmDeployState auto-sets — target: vm, vm:, and vm_state. Such an entry is a pure runtime-state record (e.g. a disposable check-bed VM) that `charly vm destroy` should delete so it doesn't accumulate. Any OTHER non-zero field means operator-authored per-host config (preemptible, env, tunnel, port, security, …) that MUST survive a destroy→create cycle. Compares against the zero node after blanking the three auto-set fields, so a newly-added per-host field is covered automatically (no remembered append — same drift-proof discipline as MergeBundleNode).

func IsExternalStepKind added in v0.2026190.848

func IsExternalStepKind(k StepKind) bool

IsExternalStepKind reports whether k is an external (plugin-contributed) step kind.

func IsRemoteCandyRef added in v0.2026190.848

func IsRemoteCandyRef(ref string) bool

IsRemoteCandyRef reports whether a ref is an @-prefixed remote ref.

func IsTCPFamily added in v0.2026194.615

func IsTCPFamily(scheme string) bool

IsTCPFamily reports whether a scheme uses TCP-style forwarding.

func LocalizePort added in v0.2026194.615

func LocalizePort(mapping string, bindAddr string) string

LocalizePort applies a host bind address to a port mapping.

func MapToKeyValueSlice added in v0.2026192.1709

func MapToKeyValueSlice(m map[string]string) []spec.KeyValue

MapToKeyValueSlice deterministically sorts a map into []spec.KeyValue for template iteration. Matches the ServiceRenderContext contract. Relocated (P8).

func MergeEnvVars added in v0.2026190.848

func MergeEnvVars(existing, newVars map[string]string) map[string]string

MergeEnvVars merges new env vars into existing ones (upsert by key). New vars override existing vars with the same key.

func NormalizeCgroupSize added in v0.2026194.615

func NormalizeCgroupSize(s string) string

NormalizeCgroupSize converts a podman-style size ("6g") to systemd's required uppercase suffix ("6G"); systemd silently rejects lowercase on Memory* caps.

func ParentDirForDest added in v0.2026192.1709

func ParentDirForDest(dest string) string

ParentDirForDest returns the parent directory of a copy/write destination, or "" when it is the root or current dir (no auto-mkdir needed).

func ParseDeployKey added in v0.2026190.848

func ParseDeployKey(key string) (boxName, instance string)

ParseDeployKey splits a charly.yml map key back into image name and instance. "selkies-desktop" → ("selkies-desktop", "") "selkies-desktop/foo" → ("selkies-desktop", "foo")

func PathIsSystemScoped

func PathIsSystemScoped(p string) bool

PathIsSystemScoped returns true for paths under /etc, /usr, /var, /opt, /root, /boot and similar system locations. Used to classify FileStep scope when the compiler hasn't explicitly tagged it.

func PixiBoundCandies added in v0.2026193.1801

func PixiBoundCandies(layers map[string]CandyModel) map[string]bool

PixiBoundCandies identifies candies that have install files (user.yml/root.yml) but depend on a pixi environment from their including parent meta-candy. These candies must NOT be extracted into auto-intermediates because the intermediate won't have the pixi environment they need.

A candy is pixi-bound if: 1. It has install files (user.yml or root.yml) 2. It does NOT have its own pixi manifest (pixi.toml/pyproject.toml/environment.yml) 3. It is included via candy: by another candy that DOES have a pixi manifest

func PreemptEffectiveRestore added in v0.2026190.848

func PreemptEffectiveRestore(p *PreemptibleConfig) string

EffectiveRestore returns the configured restore policy with the default.

func PreemptEffectiveStop added in v0.2026190.848

func PreemptEffectiveStop(p *PreemptibleConfig) string

EffectiveStop returns the configured stop mechanism with the default.

func PrimaryDistroTag added in v0.2026190.848

func PrimaryDistroTag(img *ResolvedBox, hostCtx HostContext) string

PrimaryDistroTag picks the distro tag this plan is materialized against. img.Distro is the AUTHORITATIVE deploy-target distro chain and always wins: syntheticHostBox sets the operator host's tags, syntheticVmBox the GUEST's, and ResolveBox the image's — so a vm deploy resolves the guest distro, a host deploy the operator's, a pod/image deploy the image's. For a host deploy img.Distro[0] == hostCtx.Distro (both from DetectHostDistro; PrimaryTag() == Tags[0]), so this is byte-identical to the old host path while fixing vm deploys (whose hostCtx.Distro is the OPERATOR's distro, NOT the guest's — the detectHostContext default). hostCtx.Distro is only a fallback when img carries no distro. (Package resolution already uses img via CompileSystemPackageSteps, so making the plan's distro img-authoritative also removes a latent inconsistency, never introduces one.)

func RejectImageRefAsDeployName added in v0.2026190.848

func RejectImageRefAsDeployName(box string) error

RejectImageRefAsDeployName fails a deploy-CREATION command (config setup / start) whose positional is a tagged registry image ref used AS the deploy NAME. The ref's registry-host dots make an invalid charly.yml deploy key (dots are reserved for dotted-path addressing), so the deploy would save and the NEXT config load would hard-fail (the 2026-07 `charly config ghcr.io/…:tag` corruption). A registry image needs an explicit short deploy name. Gated on BOTH a dot (invalid key) AND an image `:tag` (so a github repo ref, which pins with @version, and a bare dotted-path address are untouched).

func RelativeCandySequence added in v0.2026193.1801

func RelativeCandySequence(boxName string, parentProvided map[string]bool, boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel, globalOrder []string, pixiBound map[string]bool) []string

RelativeCandySequence returns an image's candies minus what the parent provides, ordered according to the global candy order.

func RemoveBoxDeploy added in v0.2026193.1222

func RemoveBoxDeploy(dc *BundleConfig, boxName string)

RemoveBoxDeploy removes an image's entry from a deploy config.

func RenderDnfConfWrite added in v0.2026192.1709

func RenderDnfConfWrite(d *spec.Dnf) string

RenderDnfConfWrite renders the dnf download-tuning conf snippet (appended to /etc/dnf/dnf.conf before the bootstrap install). Relocated from charly (P8).

func ResolveBoxLevels added in v0.2026192.1709

func ResolveBoxLevels(boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel) ([][]string, error)

ResolveBoxLevels resolves box dependencies and returns them grouped by build level. Boxes at the same level can be built concurrently.

func ResolveBoxOrder added in v0.2026192.1709

func ResolveBoxOrder(boxes map[string]*buildkit.ResolvedBox, layers map[string]CandyModel) ([]string, error)

ResolveBoxOrder resolves box dependencies and returns them in build order. Boxes that reference other boxes via `base` create dependencies. Each box's Builder field determines its builder dependency. Pass candies to enable conditional builder dependency; nil for unconditional.

func ResolveCandyOrder added in v0.2026192.1709

func ResolveCandyOrder(requested []string, layers map[string]CandyModel, parentCandies map[string]bool) ([]string, error)

ResolveCandyOrder resolves candy dependencies and returns them in topological order. It takes the explicitly requested candies and the full candy map, then: 1. Expands candy composition (candy: field) 2. Transitively resolves all dependencies 3. Topologically sorts the result 4. Returns candies in install order (dependencies before dependents)

parentCandies contains candies already installed by parent boxes (via base chain). These are excluded from the returned order.

func ResolveCascadePackages added in v0.2026190.848

func ResolveCascadePackages(layer CandyModel, img *ResolvedBox) (pkgs []string, raw map[string]any, matched bool)

func ResolveDeployChain added in v0.2026190.848

func ResolveDeployChain(roots map[string]BundleNode, dotted string, root DeployExecutor) (*BundleNode, DeployExecutor, error)

ResolveDeployChain walks `dotted` through `roots` (typically the merged deployment tree from resolveTreeRoot) and returns the leaf BundleNode + a composed DeployExecutor chain that reaches it from `root`.

`root` is typically &ShellExecutor{} (the operator's host, or the harness-sandbox context the harness loop runs in). Pass nil to substitute ShellExecutor.

For each path segment, a single hop is added based on the node's target classification:

target: pod / container → NestedExecutor with JumpPodmanExec /
                          JumpDockerExec into "charly-<flat-path>".
                          Container name flattens dot-separated
                          paths to underscore-separated to remain
                          a legal podman container name.
target: vm              → plain SSHExecutor when the parent chain
                          is local (no wrapper overhead), otherwise
                          NestedExecutor with JumpSSH on top.
target: host            → no hop (host nodes share the parent
                          venue).
target: k8s             → error (k8s manifests are leaves; not
                          traversable as exec targets).

Returns clear errors with available-name hints when a segment fails to resolve.

func ResolveHome added in v0.2026190.848

func ResolveHome(p *spec.InstallPlan, home string)

ResolveHome substitutes the deferred HomeToken with a concrete home in every home-bearing step field, in place. Each DeployTarget calls this once at emit time with the home of its real destination: img.Home for the OCI/pod-overlay build, the host home for the external local deploy, the GUEST home (SSH executor ResolveHome) for the external vm deploy. Idempotent — fields without the token are left untouched, so a second call is a no-op.

Covered fields: ShellHookStep env values + PathAdd, ShellSnippetStep Snippet + Destination + PathAppend, FileStep.Dest. OpStep cmd/content bodies are intentionally NOT touched — `~`/`$HOME` there shell-expand at runtime on the destination as the deploy user, which is already correct on every venue. BuilderStep is also untouched — its home is resolved separately by renderBuilderScript against the builder/guest home (see execBuilder).

A free function (not a method on spec.InstallPlan) because it type-switches the concrete step vocabulary, which lives in deploykit.

func ResolveNodePath added in v0.2026190.848

func ResolveNodePath(roots map[string]BundleNode, path string) (*BundleNode, []*BundleNode, error)

ResolveNodePath walks roots[path0].Children[path1]...[pathN] and returns the targeted node plus its parent chain (root-first, excluding the target itself). Returns a descriptive error when any path segment is missing so the user sees which segment doesn't exist.

An empty path is invalid — callers dispatch to WalkPreOrder/WalkPostOrder against a named root instead of resolving "".

func ResolveUserSpec added in v0.2026192.1709

func ResolveUserSpec(userField string, img *buildkit.ResolvedBox) (directive, chown string)

ResolveUserSpec converts a task's `user:` field to (userDirective, chownPair).

func ResolveVolumeBacking added in v0.2026194.615

func ResolveVolumeBacking(boxName, instance string, labelVolumes []VolumeMount, deployVolumes []vmshared.DeployVolumeConfig, home string, encStoragePath string, volumesPath string) ([]VolumeMount, []ResolvedBindMount)

ResolveVolumeBacking splits image volumes into named volumes and bind mounts based on the deploy's charly.yml volume configuration. Volumes without a deploy override stay named volumes; a type=bind/encrypted override becomes a ResolvedBindMount; deploy-only volumes (carrying Path, absent from any label) are added as binds. PURE — the host resolves labelVolumes (ExtractMetadata) + deployVolumes (charly.yml) and calls this in the config-resolve seam; the pod plugin consumes the result.

func ResolveWorkingDir added in v0.2026194.615

func ResolveWorkingDir(volumes []VolumeMount, bindMounts []ResolvedBindMount, home, boxName, instance string) string

ResolveWorkingDir returns the container working directory — the "workspace" volume/bind's container path if declared, else home.

func SchemeTarget added in v0.2026194.615

func SchemeTarget(scheme string, port int) string

SchemeTarget returns the backend URL for a tunnel scheme + port.

func ServiceEntryAppliesToDistro added in v0.2026190.848

func ServiceEntryAppliesToDistro(entry *ServiceEntry, distros []string) bool

ServiceEntryAppliesToDistro reports whether a service entry should render for the given distro tag chain. An entry with an EMPTY distro: list applies to EVERY distro (the backward-compatible default — every pre-existing candy's services keep rendering everywhere). A non-empty list restricts the entry to the named distros, matched against either a bare distro name ("debian") or a full versioned tag ("debian:13") anywhere in the chain. This is the service analogue of a check step's exclude_distros: — the mechanism that lets ONE candy carry per-distro-divergent packaged units (modular virtqemud.socket on Fedora/Arch vs monolithic libvirtd.socket on Debian/Ubuntu) without a <name>-host sibling candy (CLAUDE.md R3).

func ServiceRenderDistros added in v0.2026190.848

func ServiceRenderDistros(img *ResolvedBox, hostCtx HostContext) []string

compileServiceSteps turns the candy's service declarations into IR steps. Preference order:

  1. Unified `services:` list (Task 6) — preferred when present. Each entry becomes either a ServicePackagedStep (use_packaged:) or a ServiceCustomStep (full spec).

compileServiceSteps — unified schema only. Each ServiceEntry becomes either a ServicePackagedStep (use_packaged:) or a ServiceCustomStep (custom exec). Legacy fields (raw-INI service:, system_services:) are gone — external candies must run `charly migrate`.

**Init-system polymorphism filter (2026-05).** When a candy declares the same service `name:` twice — once with `use_packaged:` and once with custom `exec:` (the mixed-entry polymorphism pattern documented in CLAUDE.md "Init-system polymorphism via mixed `service:` entries" and `/charly-build:layer` "Service Declaration") — the compiler picks ONE based on the target's init system:

  • systemd target (host / vm) → emit the packaged form, SKIP the custom-exec sibling (the packaged unit handles the daemon).
  • supervisord target (oci/pod build) → SKIP the packaged form (supervisord can't consume systemd units), emit the custom form.

For singleton entries (no mixed pair), each entry renders as-is on the matching init system; mismatched singletons (e.g. a lone `use_packaged:` entry on a supervisord target) are silently skipped.

For systemd targets, the compiler ALSO pre-populates UnitText/UnitPath on the ServiceCustomStep by calling RenderService, so executors don't need a runtime lazy-render step. This consolidates what used to live in three different places (the deleted in-proc VM-target lazy fallback, the OCI build's per-entry routing, and the legacy nothing-rendered path on the local deploy target) into ONE compile-time filter. ServiceRenderDistros returns the distro tag chain a service entry's distro: filter is matched against for a deploy target. img.Distro is the AUTHORITATIVE deploy-target chain and always wins (mirrors PrimaryDistroTag): syntheticVmBox sets the GUEST chain (e.g. ["debian:13","debian"]), syntheticHostBox the operator host's, ResolveBox the image's. Using hostCtx.Distro here was the bug that made a vm deploy filter services against the OPERATOR's distro (arch) instead of the guest's (debian) — detectHostContext defaults hostCtx.MachineVenue=true + the operator distro even for a vm deploy, so a hostCtx-wins rule mis-scoped every vm/pod service. For a host deploy img.Distro is the operator's own tag chain (a SUPERSET of the single PrimaryTag, so arch-derivative hosts like cachyos now also match `arch:` entries). hostCtx.Distro is only a fallback when img carries no distro.

func SortByPopularity added in v0.2026193.1801

func SortByPopularity(s []string, popularity map[string]int)

SortByPopularity sorts by descending popularity, then lexicographic ascending.

func SortedKeys added in v0.2026193.1801

func SortedKeys(m map[string]*TrieNode) []string

SortedKeys returns sorted keys from a trie-node map.

func SortedNestedKeys added in v0.2026190.848

func SortedNestedKeys(children map[string]*BundleNode) []string

func SplitDottedPath added in v0.2026190.848

func SplitDottedPath(path string) []string

SplitDottedPath splits a dotted deployment path into segments. An empty input or a path with any empty segment (leading/trailing/ doubled dots) yields nil so callers can flag the error at their layer with the original offending path string.

func StageInlineContent added in v0.2026192.1709

func StageInlineContent(buildDir, contextRelPrefix, candyName, content string) (string, error)

StageInlineContent writes a write-task's inline content to <buildDir>/_inline/<candy>/<sha256> on disk and returns the build-context-relative path suitable for COPY. Writes are idempotent — repeated calls with identical content are no-ops via content-addressed filenames. Relocated from charly (P8).

func StepToView added in v0.2026190.848

func StepToView(step InstallStep) spec.InstallStepView

StepToView projects one concrete InstallStep onto its serializable wire view.

func StepsToView added in v0.2026190.848

func StepsToView(steps []InstallStep) []spec.InstallStepView

StepsToView / stepsFromView convert a whole ordered slice. Order is preserved (the InstallPlan's step ordering is load-bearing — see ResolveHome / StepsByVenue).

func StringSliceFromYAML added in v0.2026190.848

func StringSliceFromYAML(v any) ([]string, bool)

StringSliceFromYAML coerces a YAML-decoded value into []string. The decoder produces []interface{} for sequences; we tolerate already- stringified slices for callers that pre-process.

func StripSecretEnvNames added in v0.2026190.848

func StripSecretEnvNames(env map[string]string, blocked []string) map[string]string

StripSecretEnvNames removes any KEY=VAL entries from env whose KEY is in the blocked list. The blocked list is expected to be short (one entry per secret_* declaration on the image), so a per-entry delete is fine.

func StripVersion added in v0.2026190.848

func StripVersion(ref string) (string, string)

StripVersion splits an @-prefixed ref into its bare form and pinned version. A non-@ ref returns (ref, "").

func TailscaleFlag added in v0.2026194.615

func TailscaleFlag(scheme string) string

TailscaleFlag returns the tailscale serve/funnel flag for a scheme.

func TaskCacheMounts added in v0.2026192.1709

func TaskCacheMounts(t vmshared.Op, img *buildkit.ResolvedBox) []string

TaskCacheMounts renders a task's candy-declared `cache:` paths as BuildKit cache-mount flags. Ownership follows the task's user (root → shared, non-root → uid/gid-owned).

func TaskCoalescesWith added in v0.2026192.1709

func TaskCoalescesWith(current, next vmshared.Op, currentVerb string) bool

TaskCoalescesWith returns true if next can be batched with current under the adjacent-coalescing rule: same verb, same user, both verbs support batching.

func TaskKnownNames added in v0.2026192.1709

func TaskKnownNames(vars map[string]string) map[string]bool

TaskKnownNames returns the ${NAME} references that resolve cleanly for this candy: auto-exports ∪ candy.Vars keys.

func TaskSubstAutoExports added in v0.2026192.1709

func TaskSubstAutoExports(s string, img *buildkit.ResolvedBox) string

TaskSubstAutoExports substitutes the image-level auto-exports (USER/UID/GID/HOME) in s. ARCH/BUILD_ARCH are NOT substituted here.

func TaskSubstPath added in v0.2026192.1709

func TaskSubstPath(p string, img *buildkit.ResolvedBox) string

TaskSubstPath resolves a destination/path field: auto-export substitution plus leading ~/ expansion to the resolved HOME.

func TaskUnresolvedRefs added in v0.2026192.1709

func TaskUnresolvedRefs(s string, known map[string]bool) []string

TaskUnresolvedRefs returns the names of ${VAR} references in s not in known.

func TopoSortByPopularity added in v0.2026193.1801

func TopoSortByPopularity(graph map[string][]string, popularity map[string]int) ([]string, error)

TopoSortByPopularity performs topological sort with popularity tie-breaking. Higher popularity candies come first among zero-in-degree candidates.

func TunnelServiceFilename added in v0.2026194.615

func TunnelServiceFilename(boxName string) string

TunnelServiceFilename returns the systemd service filename for a cloudflare tunnel companion unit.

func UpdateBoxBase added in v0.2026193.1801

func UpdateBoxBase(imgName, parentName string, result map[string]*buildkit.ResolvedBox)

UpdateBoxBase updates an image's Base to point to the given parent.

func WalkDeploymentTree added in v0.2026190.848

func WalkDeploymentTree(rootPath string, root *BundleNode, parentExec DeployExecutor, visit DeployTreeVisitor) error

WalkDeploymentTree performs a pre-order walk rooted at the given node, calling visit on each node. Dotted-path accumulation is handled internally: the root's `rootPath` argument seeds the identifier; children are rendered as `<parent>.<childKey>`.

Errors short-circuit: as soon as any visit call returns a non-nil error, the walk stops and that error propagates.

func WireView added in v0.2026190.848

func WireView(p *spec.InstallPlan) spec.InstallPlanView

WireView projects the rich in-core spec.InstallPlan onto the JSON-roundtrippable spec.InstallPlanView the host marshals into an external deploy/step provider's op.Params. The Steps interface slice round-trips through the SINGLE StepsToView / stepsFromView converter (step_view.go) — an external deploy/step plugin walks the same ordered step IR the in-proc DeployTargets walk and EXECUTES it on the venue (R3; proven by the step-IR round-trip test). The remaining fields are identity + provenance.

A free function (not a method on spec.InstallPlan) because it type-switches the concrete step vocabulary via StepsToView — that lives in deploykit, so spec never imports deploykit.

Types

type AliasYAML added in v0.2026190.848

type AliasYAML = spec.AliasYAML

type ApkInstallStep

type ApkInstallStep struct {
	Packages  []ApkPackageSpec
	CandyName string
	CandyDir  string // candy source dir — anchors relative committed-APK paths
}

ApkInstallStep installs Android apps onto a `kind: android` device. It is the IR form of a candy's `apk:` package section — the apk "package format" (parallel to SystemPackagesStep for rpm/deb/pac, and BuilderStep for aur).

Unlike every other step, an apk install lands on a RUNNING Android device, not the build/host filesystem. `target: android` is an EXTERNAL deploy substrate (F1): NO in-proc DeployTarget executes this step — the host-side android deploy preresolver (collectAndroidInstalls, android_deploy_preresolve.go) READS it to collect the apk install specs and ships them to the deploy:android plugin (candy/plugin-adb: apkeep + adb), which drives the device. Every DeployTarget SKIPS it — OCITarget emits nothing (no device at image-build time), and Local/Vm/Pod targets record a skip (a host/VM/pod is not an Android device). This is the same "wrong venue → skip" shape `aur:` uses off-Arch, expressed as a clean recorded skip rather than an error (an image legitimately builds without installing apps).

func (*ApkInstallStep) Kind

func (s *ApkInstallStep) Kind() StepKind

func (*ApkInstallStep) RequiresGate

func (s *ApkInstallStep) RequiresGate() Gate

func (*ApkInstallStep) Reverse

func (s *ApkInstallStep) Reverse() []ReverseOp

Reverse returns no STATIC ledger ops — Android teardown ops are DYNAMIC, recorded from the deploy:android plugin's OpExecute reply (the uninstall reverse ops) at deploy time, replayed at `charly bundle del` like any external deploy substrate.

func (*ApkInstallStep) Scope

func (s *ApkInstallStep) Scope() Scope

Scope is system — installing an app mutates device-global package state.

func (*ApkInstallStep) Venue

func (s *ApkInstallStep) Venue() Venue

Venue is host-native — the android deploy preresolver reads this step from the host (the install itself runs in the deploy:android plugin over the wire).

type ApkPackageSpec

type ApkPackageSpec = spec.ApkPackageSpec

type ArtifactRef

type ArtifactRef struct {
	ContainerPath string // path inside the builder stage/container
	HostPath      string // path on the deploy target (host fs or final-image fs)
	Chown         bool   // whether to re-own to the target user
}

ArtifactRef describes an output path from a builder that needs to be extracted back to the host or copied into the final OCI image.

For user-scope pixi/npm/cargo on the host target: the host path is bind-mounted into the builder, so there's no "extraction" — the Artifacts list is empty because the bind-mount already put the files in place. For aur: the list contains /tmp/aur-pkgs/*.pkg.tar.zst, which the host target pulls out to a staging dir then hands to pacman.

type BuilderDef

type BuilderDef = spec.BuilderDef

type BuilderPreresolved added in v0.2026190.848

type BuilderPreresolved struct {
	Context map[string]any
	Reverse []ReverseOp
}

BuilderPreresolved is one candy×builder's pre-resolved payload. The Candy-coupled functions that BUILD it stay in charly; the compiler only reads it.

type BuilderRunOpts added in v0.2026190.848

type BuilderRunOpts = spec.BuilderRunOpts

type BuilderStep

type BuilderStep struct {
	Builder      string        // "pixi" | "npm" | "cargo" | "aur"
	BuilderImage string        // resolved image ref (e.g. "fedora-builder:2026.04")
	CandyName    string        // layer that triggered this builder (for ledger)
	CandyDir     string        // absolute layer source path (bind-mounted as /work)
	Phase        Phase         // typically PhaseInstall
	Artifacts    []ArtifactRef // outputs to extract (empty for user-scope pixi/npm/cargo; populated for aur)

	// Builder-specific template context — the compiler populates this from
	// the candy's manifest files + the embedded builder definition (charly/charly.yml).
	RawStageContext map[string]any

	// LocalPkg is the package format's localpkg contract, populated by the
	// compiler for the `aur` builder only. The aur builder produces package
	// files (.pkg.tar.zst) that the host/VM deploy targets install onto the
	// venue via the SAME config-driven transfer+install leg the localpkg step
	// uses (R3) — so the install command + package glob come from
	// the embedded `pac.local_pkg` vocabulary, never a hardcoded literal. Nil for
	// pixi/npm/cargo (home-artifact builders, no package-file install).
	LocalPkg *LocalPkgDef

	// BuilderDef is the resolved builder definition from the embedded build vocabulary (charly/charly.yml) for this builder
	// (img.BuilderConfig.Builder[Builder]), populated by the compiler. The
	// host-venue deploy targets render its phase.install.host cell via
	// renderBuilderScript — the plain-shell analog of the container stage — so the
	// host build script is config-driven, not hardcoded Go. nil only on
	// synthetic test paths that don't supply a BuilderConfig.
	BuilderDef *BuilderDef

	// PreResolvedReverse is the builder's teardown ops, resolved HOST-SIDE in the build
	// PRE-PASS (builder_preresolve.go → the externalized builder plugin's OpReverse) and stashed
	// here so Reverse() is a PURE getter — the per-builder reverse-op KIND (pixi-env-remove /
	// package-remove / …) is exactly the logic externalized out-of-process, and Reverse() runs
	// host-side (step-view projection + RunHostStep) with no registry handle. Carried across the
	// wire on InstallStepView.ReverseOps (the host-computed teardown field) and restored by
	// stepFromView. Nil for a custom candy builder / a direct compile with no pre-pass.
	PreResolvedReverse []ReverseOp
}

BuilderStep runs a multi-stage builder (pixi/npm/cargo/aur). On the OCI target this emits a FROM + RUN stage plus a final-stage COPY --from. On the host target this emits a `podman run <builder>` with HOME-remap and appropriate bind-mounts.

func (*BuilderStep) Kind

func (s *BuilderStep) Kind() StepKind

func (*BuilderStep) RequiresGate

func (s *BuilderStep) RequiresGate() Gate

func (*BuilderStep) Reverse

func (s *BuilderStep) Reverse() []ReverseOp

func (*BuilderStep) Scope

func (s *BuilderStep) Scope() Scope

func (*BuilderStep) Venue

func (s *BuilderStep) Venue() Venue

type BundleConfig added in v0.2026190.848

type BundleConfig struct {
	Provides *ProvidesConfig       `yaml:"provides,omitempty" json:"provides,omitempty"`
	Bundle   map[string]BundleNode `yaml:"deploy" json:"deploy"`
	// Sidecar carries the project's sidecar-template library as OPAQUE bodies
	// (the raw PluginKinds["sidecar"] map). candy/plugin-sidecar's OpResolve merges
	// these UNDER each deploy node's own overrides; the kernel reads no fields
	// (the sidecar de-type, Cutover D).
	Sidecar map[string]json.RawMessage `yaml:"sidecar,omitempty" json:"sidecar,omitempty"`
}

--- BundleConfig state container (moved from charly/deploy.go, P4) --- BundleConfig represents per-machine deployment overrides (~/.config/charly/charly.yml). Only runtime/deployment fields are supported — build-time fields are structurally excluded.

Schema v4: the top-level map key is `deployment:` (singular, flat). The legacy `images:` / `deployments.images.*` nesting is gone — all target kinds (host / vm / pod / k8s) live under the single `deployment:` map.

func LoadDeployFile added in v0.2026193.1222

func LoadDeployFile(path string) (*BundleConfig, error)

LoadDeployFile reads a charly.yml from an arbitrary path into a BundleConfig.

func MergeDeployConfigs added in v0.2026190.848

func MergeDeployConfigs(configs ...*BundleConfig) *BundleConfig

MergeDeployConfigs merges multiple DeployConfigs left-to-right. Later configs take precedence (field-level replace per image). The merge walks every yaml-tagged field of BundleNode via reflect: a field copies from src → dst when src's value is non-zero (string != "", slice/map/ptr not nil, bool != false, numeric != 0). This makes adding a new field to BundleNode automatically merge-correct — the pre-2026-05 hand-rolled per-field merge silently dropped 19+ fields (ResolvedPort, Description, Secret, Sidecar, Shell, Kubernetes, ForwardGpgAgent, ForwardSshAgent, Kind, Replica, Restart, Schedule, Resources, Expose, Storage, Probes, Cpus, Ram, DiskSize) whenever any merge → save cycle ran.

The yaml tag `-` (currently only BundleNode.Inside, a derived runtime field) skips the merge. Untagged fields are also skipped.

func (*BundleConfig) DeployedContainerNames added in v0.2026190.848

func (dc *BundleConfig) DeployedContainerNames() []string

DeployedContainerNames returns the sorted, de-duplicated container names for every bundle entry.

func (*BundleConfig) GlobalEnvForImage added in v0.2026190.848

func (dc *BundleConfig) GlobalEnvForImage(consumerKey, ctrName string, acceptedEnv map[string]bool) []string

GlobalEnvForImage builds the env-var injection list for a consumer container from the deploy state's env + MCP provides, filtered by the consumer's accepts.

func (*BundleConfig) Lookup added in v0.2026190.848

func (dc *BundleConfig) Lookup(deployName, instance string) (BundleNode, bool)

Lookup returns the BundleNode for (deployName, instance), or (zero, false) when the entry is absent. Safe to call on a nil *BundleConfig — lets callers chain `loadDeployConfigForRead(...).Lookup(deployName, instance)` without a separate nil check. deployName is the charly.yml key base the caller is operating on (typically c.Image), NOT the baked image short-name — for a kind:check bed or Pattern-B deploy the two differ. Pass the deploy key, never a value derived from an image label (see MergeDeployOntoMetadata).

func (*BundleConfig) LookupKey added in v0.2026190.848

func (dc *BundleConfig) LookupKey(key string) (BundleNode, bool)

LookupKey looks up a deploy entry by its full charly.yml key (e.g. "foo", "foo/instance", "vm:name"). Safe on nil receiver.

func (*BundleConfig) OccupiedHostPorts added in v0.2026190.848

func (dc *BundleConfig) OccupiedHostPorts(excludeKey string) map[int]bool

OccupiedHostPorts returns the set of host ports already claimed by bundle entries other than excludeKey (resolved pins preferred over authored).

type BundleNode added in v0.2026190.848

type BundleNode = spec.BundleNode

func FindVmDeployNode added in v0.2026190.848

func FindVmDeployNode(deploys map[string]BundleNode, name, vmName string) (BundleNode, bool)

FindVmDeployNode finds the BundleNode for a vm-target deploy. It is THE shared "which deploy entry backs this VM" lookup used by both `charly bundle add` (artifact-env collection) and `charly check live` (tests overlay), so the two never diverge. Resolution order:

  1. by deploy NAME (the entry key) — the precise match;
  2. by the legacy "vm:<name>" key form;
  3. by scanning for any target:vm entry whose `vm:` field == vmName (or == name) — the fallback when the caller only knows the vm entity.

Keying by the deploy NAME first is load-bearing: a bed whose key differs from its vm entity (e.g. check-k3s-vm -> vm: k3s-vm) is found by its key, not mis-resolved via the vm entity name.

func MergeBundleNode added in v0.2026190.848

func MergeBundleNode(dst, src BundleNode) BundleNode

MergeBundleNode applies non-zero fields from `src` onto `dst` and returns the merged copy. Walks every yaml-tagged field via reflect; the yaml `-` tag (derived/runtime-only fields) is skipped. Same precedence rule as the underlying merge: src non-zero wins, otherwise dst passes through. Per R3 the single helper replaces the hand-rolled per-field merges that previously lived in MergeDeployConfigs (drift-prone — every new struct field needed a remembered append, and 19+ were missed).

type CacheMountDef

type CacheMountDef = spec.CacheMount

type CacheMountSpec

type CacheMountSpec struct {
	Dst     string
	Sharing string // "locked" | "private" | "shared" | ""
}

CacheMountSpec mirrors the BuildKit cache-mount configuration carried in the embedded build vocabulary's format/builder definitions (charly/charly.yml). The OCI target renders these as `--mount=type=cache,...`; the host target ignores them.

type CandyArtifact added in v0.2026190.848

type CandyArtifact = vmshared.CandyArtifact

type CandyCapabilities added in v0.2026190.848

type CandyCapabilities = spec.CandyCapabilities

type CandyModel added in v0.2026190.848

type CandyModel interface {
	GetName() string
	GetSourceDir() string
	GetVersion() string
	Vars() map[string]string
	PlanSteps() []Step
	Reboot() bool
	Apk() []ApkPackageSpec
	EnvConfig() (*EnvConfig, error)
	Service() []ServiceEntry
	Shell() *ShellConfig
	TopPackages() []string
	FormatSection(name string) *PackageSection
	LocalPkg(format string) string
	TagSection(tag string) *TagPkgConfig
	HasFile(filename string) bool

	// P8 render-delta accessors (build-mode graph/render surface). Field-backed
	// members use Get* to avoid a field/method name collision on the charly *Candy
	// implementer; the three already-methods keep their names.
	GetIncludedCandy() []CandyRef // candy: composition refs (splicing)
	GetRequire() []CandyRef       // require: deps (ordering + resolution)
	HasContent() bool
	HasInstallFiles() bool // at least one install file (drives pixi-bound detection)
	PixiManifest() string
	GetHasPackageJson() bool
	GetHasCargoToml() bool
	HasFormatPackages() bool
	GetRemote() bool // true if the candy came from a remote repo
	HasExtract() bool
	Extract() []ExtractYAML
	HasData() bool
	Data() []DataYAML
	GetHasPixiLock() bool
	GetRepoPath() string
	GetSubPathPrefix() string
	HasEnv() bool
	HasRoute() bool
	Route() (*RouteConfig, error)

	// P8 init-cluster accessors (emitInitAssembly/emitInitFragmentStages/
	// generateInitFragments). RelayPorts wraps the field-backed PortRelayPorts to
	// avoid a field/method name collision on the charly *Candy implementer.
	HasInit(initName string) bool // this candy contributes to the named init system
	ServiceFiles() []string       // file_copy-model service unit paths (globbed)
	RelayPorts() []int            // port_relay: ports (init-agnostic)

	// P8 writeCandySteps accessors.
	HasTasks() bool        // the candy has any tasks: (runOps non-empty)
	RunOps() []vmshared.Op // the candy's plan lowered to build-mode run ops
}

candy_model.go — CandyModel, the read-only view of a runtime candy that the deploy-plan compiler (BuildDeployPlan) consumes. The concrete runtime Candy lives in charly and implements this interface; the compiler depends on the abstraction (kernel/plugin boundary law: a Mechanism consumes an interface, the concrete kind implements it), so the candy struct + its whole test suite stay in charly with zero cross-package churn.

type CandyPluginDecl added in v0.2026190.848

type CandyPluginDecl = vmshared.CandyPluginDecl

type CandyRef added in v0.2026190.848

type CandyRef struct {
	Raw string // original ref, e.g. "@github.com/org/repo/candy/x:v1" or bare "x"
	// Resolved is the qualified candy-map key assigned when a freshly-fetched
	// remote candy's plain-name sibling deps are qualified to
	// "<repo>/<subpathprefix><name>" (qualifyRemoteSiblingDeps). Empty for every
	// other ref, where the map key derives from Raw.
	Resolved string
}

CandyRef is a single candy reference as authored in the candy manifest `require:` / `candy:` (or charly.yml `candy:`). It carries the ORIGINAL ref string — with any `@repo` prefix and `:version` suffix — as the single source of truth; the bare map-key form (.Bare()) and the pinned version (.Version()) are DERIVED on demand, so a ref's identity and its version can never drift apart.

func ToCandyRefs added in v0.2026190.848

func ToCandyRefs(raw []string) []CandyRef

ToCandyRefs wraps raw ref strings into CandyRef values. Returns nil for a nil/empty input so an absent list stays absent.

func (CandyRef) Bare added in v0.2026190.848

func (r CandyRef) Bare() string

Bare returns the candy-map key (no @ prefix, no :version) — the form used for dependency resolution and graph keying.

func (CandyRef) IsRemote added in v0.2026190.848

func (r CandyRef) IsRemote() bool

IsRemote reports whether this is an @-prefixed remote ref.

func (CandyRef) Version added in v0.2026190.848

func (r CandyRef) Version() string

Version returns the pinned version (the ":vX" suffix), or "" for an unpinned remote ref or a local (bare-name) ref.

type CandyYAML added in v0.2026190.848

type CandyYAML = spec.Candy

type CollectedSecret added in v0.2026194.615

type CollectedSecret struct {
	Name           string // podman secret name: "charly-<image>-<name>"
	Target         string // container mount path
	Env            string // env var name INSIDE the container
	HostEnv        string // env var name on the HOST to read the value from
	SecretName     string // original secret name from the candy manifest
	Service        string // credential store service override
	Key            string // credential store key override
	RotateOnConfig bool   // bypass podmanSecretExists short-circuit (rotate every config)
}

CollectedSecret is a fully resolved secret ready for provisioning + quadlet emission (the Secret= directive). Resolved runtime state (ruling C: the plugin builds it internally), not a wire type — owned here as a plain struct.

type CycleError added in v0.2026192.1709

type CycleError struct {
	Cycle []string
}

CycleError represents a circular dependency error

func (*CycleError) Error added in v0.2026192.1709

func (e *CycleError) Error() string

type DataYAML added in v0.2026190.848

type DataYAML = spec.DataYAML

type DeployExecutor added in v0.2026190.848

type DeployExecutor = spec.DeployExecutor

func AppendHopForFlatPath added in v0.2026190.848

func AppendHopForFlatPath(chain DeployExecutor, node *BundleNode, flatPath, leaf string) (DeployExecutor, error)

AppendHopForFlatPath stacks one executor hop so commands land inside `node`'s substrate. flatPath is the dotted path with dots replaced by underscores — the host-side container name suffix; leaf is the final path segment (the node's own key), used for a pod deployed STANDALONE inside a VM guest (which has no parent-path concept — see the pod case).

func ContainerChain added in v0.2026190.848

func ContainerChain(engine, containerName string) DeployExecutor

ContainerChain returns a one-hop chain that exec's into a single named running container (`<engine> exec <name> bash`). Convenience for the simple `charly check live <name>` path where there is no nested dotted path to walk — equivalent to ResolveDeployChain on a single-segment dotted path that resolves to a pod node, but skips the tree lookup.

func ImageChain added in v0.2026190.848

func ImageChain(engine, imageRef string) DeployExecutor

ImageChain builds a one-hop chain that runs commands inside a freshly- spawned disposable container (`<engine> run --rm <imageRef> bash`). Used by `charly check box --section box` to replace the deleted ImageExecutor — same semantics, expressed via the unified chain primitive.

engine defaults to "podman" when empty. imageRef is passed verbatim (full registry refs and short local names both work as long as `<engine> run --rm` accepts them).

func RootExecutorForDeployNode added in v0.2026190.848

func RootExecutorForDeployNode(node *BundleNode) (DeployExecutor, error)

RootExecutorForDeployNode selects the ROOT DeployExecutor for a `target: local` deployment node from its `host:` field — the single source of truth for "where does a local deploy's work run?", shared by `charly bundle add` (the local deploy target.Add) and `charly check live` (runLocalCheck) so neither re-implements the selection (R3):

host: ""  / "local"        → ShellExecutor{} (this machine, direct shell)
host: "<user>@<machine>"   → &SSHExecutor{User, Host, Port, …}
host: "<machine>" + user:  → SSHExecutor with User from node.User

It does NOT handle the nested-inside-a-parent case (opts.ParentExec); that stays in the local deploy target.Add because it's deploy-execution-specific. Returns ShellExecutor{} for a nil node.

func VmChildExecutor added in v0.2026190.848

func VmChildExecutor(parentExec DeployExecutor, deployName string) (DeployExecutor, error)

VmChildExecutor wraps parentExec with an SSH jump into the VM represented by this node. At the root (parentExec == nil or ShellExecutor), the child gets a plain SSHExecutor — no nesting overhead for the common case of a VM on localhost.

The SSH alias keys off the per-deploy DOMAIN IDENTITY (charly-<VmDomainIdentity(deployName)>), NOT node.From (the shared kind:vm entity) — `charly vm create <entity> --domain <deploy>` writes the managed stanza under `charly-<deploy>` (P33). Several beds may share one entity via `from:`, so an entity-keyed alias collides them on ONE stanza (the R10 defect where sibling beds both derived `charly-eval-vm`); keying by the deploy makes the alias distinct per bed and matches the stanza vm create actually wrote. A direct create (deploy == entity) resolves to `charly-<entity>` naturally, and VmDomainIdentity flattens a dotted member path consistently with the domain the lifecycle named (bundle_members.go's `vmDomainIdentity(memberKey)`).

type DeployTarget added in v0.2026190.848

type DeployTarget = spec.DeployTarget

type DeployTreePhase added in v0.2026190.848

type DeployTreePhase int

DeployTreePhase indicates which lifecycle phase the walker is in. Pre-order for add; teardown walks the flat-path chain (deploy_chain.go).

const (
	DeployTreePhaseAdd DeployTreePhase = iota
	DeployTreePhaseDel
)

type DeployTreeVisitor added in v0.2026190.848

type DeployTreeVisitor func(path string, node *BundleNode, parentExec DeployExecutor) (childExec DeployExecutor, err error)

DeployTreeVisitor is invoked once per node in the walk. It receives the node's dotted path, the node itself, and the parent executor (nil at the root). The return value is the DeployExecutor that this node's CHILDREN should use as their parent. A host-target node returns the same executor it was given (candies applied in-place on the parent venue); a container or vm node returns a NestedExecutor that drills into the newly-created environment.

Returning (nil, nil) for a node with children is an error — it means "cannot compute child executor", which the walker surfaces with the offending path.

type EmitOpts added in v0.2026190.848

type EmitOpts = spec.EmitOpts

func InstallOptsApplyTo added in v0.2026190.848

func InstallOptsApplyTo(o *InstallOptsConfig, opts EmitOpts) EmitOpts

ApplyTo merges install_opts settings into an EmitOpts. CLI flags still win — charly.yml provides defaults, not overrides. Nil receiver is a no-op.

type EnvConfig added in v0.2026190.848

type EnvConfig = kit.EnvConfig

type EnvDependency added in v0.2026190.848

type EnvDependency = vmshared.EnvDependency

type EnvProvideEntry added in v0.2026190.848

type EnvProvideEntry struct {
	Name   string `yaml:"name" json:"name"`
	Value  string `yaml:"value" json:"value"`
	Source string `yaml:"source" json:"source"`
}

EnvProvideEntry is a resolved env_provides entry in charly.yml.

func PodAwareEnvProvides added in v0.2026190.848

func PodAwareEnvProvides(entries []EnvProvideEntry, consumerKey, ctrName string) []EnvProvideEntry

PodAwareEnvProvides rewrites same-deploy env values to localhost and dedups cross-deploy entries by name (local wins).

func (EnvProvideEntry) GetName added in v0.2026190.848

func (e EnvProvideEntry) GetName() string

func (EnvProvideEntry) GetSource added in v0.2026190.848

func (e EnvProvideEntry) GetSource() string

type ExecContext added in v0.2026190.848

type ExecContext string

ExecContext + Ctx consts — the op-context classification enum, moved from charly with the compiler.

const (
	CtxBuild   ExecContext = "build"
	CtxDeploy  ExecContext = "deploy"
	CtxRuntime ExecContext = "runtime"
)

type ExternalPluginStep

type ExternalPluginStep struct {
	Op           *Op      // the run: step op — Plugin (verb word) + PluginInput + RunAs
	CandyName    string   // owning candy (provenance + the ledger CandyRecord key)
	ResolvedUser string   // uid:gid or "root" after resolveUserSpec — drives Scope
	Distros      []string // the image's distro tag chain (img.Tags) for the build-emit BuildEnv
}

ExternalPluginStep is the install-timeline IR node for a `run: plugin: <verb>` step whose verb is served by an EXTERNAL (out-of-process) plugin — a grpcProvider, not a built-in TypedStepProvider (package/service) or ProvisionActor (the state-provision shell verbs) or the `command` install verb. compileActOp routes it here; the Invoke op is picked per venue, placement-agnostic above the registry:

  • the DEPLOY venue (the install runs ON the target, not into an image): BOTH target:local AND target:vm externalized, so an ExternalPluginStep on a deploy is reached by the external local/vm plugin's kit.WalkPlans, which routes it through the host's RunHostStep (the nested ExternalPluginStep case) → executeExternalPluginStep → Invoke(OpExecute) WITH the live DeployExecutor on the go-plugin broker (the E3b reverse channel), so the plugin runs its deploy-context effect (RunSystem/RunUser) on the real venue and RETURNS its teardown ReverseOps which the host records into the ledger (record-and-replay — only recorded ops are reversed at `charly bundle del`). This is the deploy-context counterpart of the build-context OpEmit leg (tasks.go emitPluginFragment), reusing the SAME spec.DeployReply / ReverseOp wire as the external deploy TARGET (deploy_target_external.go) — R3.
  • EmitOCI (a BUILD venue — the pod-overlay Containerfile): Invoke(OpEmit) via the SHARED emitPluginFragment, splicing the plugin's Containerfile FRAGMENT verbatim — it cannot deploy-execute at build (no live venue). Identical behaviour to the box-build path (writeCandySteps → emitTasks `case "plugin"`), just relocated. EmitOCI is the ONLY in-proc Emit* this provider still implements.

Reverse() is static-nil: the reversal ops are DYNAMIC — they come from the plugin's OpExecute reply at emit time, recorded by the host's RunHostStep handler into the CandyRecord (the externalDeployTarget record-and-replay pattern).

func (*ExternalPluginStep) Kind

func (s *ExternalPluginStep) Kind() StepKind

func (*ExternalPluginStep) RequiresGate

func (s *ExternalPluginStep) RequiresGate() Gate

RequiresGate is GateNone — an external plugin verb-step is operator-authorized build/deploy-time plugin execution (the candy author opted into it), mirroring the external deploy TARGET which is ungated; the plugin picks its own privilege via RunSystem/RunUser on the reverse channel.

func (*ExternalPluginStep) Reverse

func (s *ExternalPluginStep) Reverse() []ReverseOp

Reverse is static-nil: the teardown ops are recorded DYNAMICALLY from the plugin's OpExecute DeployReply at emit time (EmitLocal/EmitVM append reply.ReverseOps to the CandyRecord), exactly like the external deploy target — never recomputed.

func (*ExternalPluginStep) Scope

func (s *ExternalPluginStep) Scope() Scope

Scope classifies by the step's user context — the SAME rule OpStep uses (OpStepScope): root/empty → system, a named/numeric non-root user → user. The plugin then chooses RunSystem vs RunUser on the reverse channel per its own effect; this scope drives only the ledger reverse-op privilege bookkeeping.

func (*ExternalPluginStep) Venue

func (s *ExternalPluginStep) Venue() Venue

type ExternalStep added in v0.2026190.848

type ExternalStep struct {
	Word       string          // the reserved step word; Kind() = "external:" + Word
	ScopeV     Scope           // plugin-declared (StepContract.scope)
	VenueV     Venue           // plugin-declared (StepContract.venue)
	GateV      Gate            // plugin-declared (StepContract.gate) — the step SKIPs if the gate is not enabled
	Payload    json.RawMessage // opaque per-kind input — the OpExecute params
	CandyName  string          // owning candy (provenance + the ledger CandyRecord key)
	ReverseOps []ReverseOp     // set DYNAMICALLY from the plugin's OpExecute reply (record-and-replay)
}

ExternalStep is an EXTERNAL, plugin-CONTRIBUTED install-step KIND: a step whose Kind() is "external:<word>", carried OPAQUELY (Payload) and whose Scope/Venue/Gate come from the serving class:step plugin's DECLARED StepContract. Its host EXECUTION funnels through the OpExecute-to-the-serving-plugin path; teardown ops are DYNAMIC (recorded from the OpExecute reply), so Reverse() returns the recorded slice.

func (*ExternalStep) Kind added in v0.2026190.848

func (s *ExternalStep) Kind() StepKind

func (*ExternalStep) RequiresGate added in v0.2026190.848

func (s *ExternalStep) RequiresGate() Gate

func (*ExternalStep) Reverse added in v0.2026190.848

func (s *ExternalStep) Reverse() []ReverseOp

func (*ExternalStep) Scope added in v0.2026190.848

func (s *ExternalStep) Scope() Scope

func (*ExternalStep) Venue added in v0.2026190.848

func (s *ExternalStep) Venue() Venue

type ExtractYAML added in v0.2026190.848

type ExtractYAML = spec.ExtractYAML

type FileStep

type FileStep struct {
	Source    string      // path to source content (under layer dir or .build/_inline/)
	Dest      string      // absolute destination path
	Mode      os.FileMode // permissions
	Owner     string      // "root" or "uid:gid" or the invoking user's name
	CandyName string      // for ledger
}

FileStep places a single file. The compiler may emit these for candy-declared file directives that aren't wrapped as tasks (e.g. supervisord fragment assembly). Today's tasks.go handles most file placement via OpStep; FileStep exists for cases where the compiler synthesizes file writes that weren't in the candy manifest (e.g. service unit files, managed-block contents).

func (*FileStep) Kind

func (s *FileStep) Kind() StepKind

func (*FileStep) RequiresGate

func (s *FileStep) RequiresGate() Gate

func (*FileStep) Reverse

func (s *FileStep) Reverse() []ReverseOp

func (*FileStep) Scope

func (s *FileStep) Scope() Scope

func (*FileStep) Venue

func (s *FileStep) Venue() Venue

type Gate

type Gate = spec.Gate

type Generator added in v0.2026192.1709

type Generator struct {
	Dir            string
	Candies        map[string]CandyModel
	Tag            string
	Boxes          map[string]*buildkit.ResolvedBox
	BuildDir       string
	Containerfiles map[string]string // cached content per image (build pipes via stdin)
	GlobalOrder    []string          // popularity-weighted global candy order for cache reuse
	RequestedBoxes []string          // scopes which Containerfiles Generate() writes; empty = all

	// DevLocalPkg makes localpkg candies (the charly toolchain) build from LOCAL
	// in-development source instead of the published release — set ONLY for
	// disposable check-bed image builds. See renderLocalPkgImageInstall.
	DevLocalPkg bool

	// EmitPluginOp dispatches a non-"command" plugin verb op through the core
	// Provider registry: a ProvisionActor returns (script, true, nil) so emitTasks
	// emits it via EmitCmd; any other provider returns (fragment, false, nil) so
	// emitTasks writes it verbatim. The Provider registry + OpEmit dispatch (and its
	// error strings) STAY CORE; charly's toDeploykit() wires this closure. Op =
	// vmshared.Op = spec.Op.
	EmitPluginOp func(op *spec.Op, img *buildkit.ResolvedBox) (out string, isScript bool, err error)

	// CollectBoxPorts returns an image's aggregated exposed ports. Wraps the core
	// CollectBoxPorts(cfg, layers, boxName) aggregator (which reads the core Config
	// + Candy graph — RESOLVE-side, stays core). The first of the Collect* label
	// seams; the others (volumes/shell/security/hooks/descriptions/alias/caps) land
	// as their return types relocate to sdk (the writeLabels type-cascade).
	CollectBoxPorts func(boxName string) ([]string, error)

	// ValidateEgress gates a hand-built config (traefik routes, …) against the
	// egress CUE schemas before it is written into the build context. Wraps core
	// ValidateEgress (the egress validation stays core / its plugin).
	ValidateEgress func(kind, label string, data []byte) error

	// RenderService materializes a ServiceEntry into a RenderedService via
	// candy/plugin-init's OpResolve (the init-system template knowledge lives in
	// the plugin) and egress-gates the unit text. The plugin Invoke + the egress
	// gate STAY CORE; charly's toDeploykit() wires core RenderService here. Used by
	// GenerateInitFragments (fragment_assembly model).
	RenderService func(entry *spec.ServiceEntry, def *spec.ResolvedInit, ctx spec.ServiceRenderContext) (*spec.RenderedService, error)

	// RewriteHeaderCopyForRemote rewrites a stage_header_copy COPY line so its
	// source points at a materialized remote build-config asset (host fs write).
	// Wraps core rewriteHeaderCopyForRemote → materializeBuildConfigAsset (host
	// fs, stays core). Used by EmitInitFragmentStages.
	RewriteHeaderCopyForRemote func(headerCopy string) (string, error)

	// ExternalizedBuilders is the set of builder words whose inline render crosses
	// to a plugin's OpResolve (vs the embedded builder: vocabulary install_template).
	// Wired from core's externalizedBuilders registry fact. Read by WriteCandySteps
	// to pick the inline-builder branch.
	ExternalizedBuilders map[string]bool

	// RenderLocalPkgImageInstall renders a candy's localpkg OS-package install for
	// the image build. The PRODUCTION path is pure render (a curl+install RUN); the
	// DevLocalPkg path builds the in-development package on the HOST (makepkg). Wraps
	// core renderLocalPkgImageInstall (host-coupled dev leg stays core). Used by
	// WriteCandySteps.
	RenderLocalPkgImageInstall func(step *LocalPkgInstallStep, devLocalPkg bool, imageDir, boxName string) (string, error)

	// ResolveInlineBuilder connects + OpResolves an externalized INLINE builder and
	// returns its in-candy fragment (C10 InlineFragment). Wraps the core builder-emit
	// cluster (ensureBuildersConnected + registry ResolveBuilder + resolveBuilderStage;
	// registry-coupled, stays core), preserving its per-failure error strings. Used by
	// WriteCandySteps.
	ResolveInlineBuilder func(candyName, builderName string, bDef *buildkit.BuilderDef, ctx *spec.BuildStageContext, img *buildkit.ResolvedBox) (inlineFragment string, err error)
	// contains filtered or unexported fields
}

Generator is the build-mode RENDER engine, homed in sdk/deploykit (P8).

WHY deploykit and not buildkit: the render calls the build-compile helpers resolveCascadePackages / compileLocalPkgStep / compileShellSnippetSteps (sdk/deploykit/install_build.go) and reads deploykit.CandyModel. The import DAG is one-way deploykit→buildkit, so a buildkit-hosted render would cycle. deploykit already holds the build-compile foundation, so the render belongs here; buildkit stays the low keystone layer (ResolvedBox, RenderTemplate).

The render operates over CandyModel (never the charly-side *Candy) and over buildkit.ResolvedBox. Every host-coupled dependency the render needs — the Config/Candy-graph label aggregators (CollectBox*/Collect*/Aggregate*), init resolution (ActiveInit/ResolveInitSystem), the registry/plugin Invoke legs (ensureBuildersConnected, OpResolve/OpEmit), the registry image probe (InspectImageUser), and the few Config.Defaults/BoxConfig reads — is threaded in as a function-value SEAM field (added compiler-driven as each render method is relocated onto this type). The charly-side resolve half (NewGenerator: LoadConfig/ScanAllCandy/loadProjectPlugins/ResolveAllBox/ ComputeIntermediates/GlobalCandyOrder) constructs this value and wires the seams from the existing core functions; the podman orchestration (runBoxBuild/runBoxGenerate/push/retry/manifest) lives in candy/plugin-build and drives the build, calling back HostBuild for this host-side render.

func NewRenderGenerator added in v0.2026192.1709

func NewRenderGenerator() *Generator

NewRenderGenerator constructs a render Generator with its unexported per-image reply caches initialized. The caller (charly's g.toDeploykit()) sets the exported data fields + seam function values directly on the returned value — the caches cannot be set cross-package, which is the whole reason this constructor exists.

func (*Generator) BuildStageContext added in v0.2026192.1709

func (g *Generator) BuildStageContext(layer CandyModel, builderName string, builderDef *buildkit.BuilderDef, img *buildkit.ResolvedBox, builderRef string) *spec.BuildStageContext

BuildStageContext builds the render context for a candy's builder stage: stage names, copy source, user, cache mounts, detected manifest + lockfile-aware install command, manylinux fix, build script, and config-detected packages. Relocated from charly (P8); byte-identical.

func (*Generator) BuilderRefForFormat added in v0.2026192.1709

func (g *Generator) BuilderRefForFormat(boxName, format string) string

BuilderRefForFormat returns the full tag of the builder image for a format, or "" when there is no distinct builder. Relocated from charly (P8).

func (*Generator) CandyCopySource added in v0.2026192.1709

func (g *Generator) CandyCopySource(candyRef string) string

CandyCopySource returns the build-context path a candy's files are COPYed from: the staged _candy dir for a remote candy, the default candy/<name>/ for a local candy at the default location, else the relative SourceDir. Relocated (P8).

func (*Generator) CandyNeedsBuilder added in v0.2026192.1709

func (g *Generator) CandyNeedsBuilder(img *buildkit.ResolvedBox, layer CandyModel, builderDef *buildkit.BuilderDef) bool

CandyNeedsBuilder returns true if a candy triggers a builder: a DetectFiles match always triggers; a DetectConfig match triggers only when the image's build formats include that format (a config-only detection is distro-coupled — the IR compiler only emits install steps for formats in img.BuildFormats). Relocated from charly (P8); byte-identical (buildFormatsInclude inlined as slices.Contains).

func (*Generator) CollectBuilderRuntimeEnv added in v0.2026192.1709

func (g *Generator) CollectBuilderRuntimeEnv(candyOrder []string, img *buildkit.ResolvedBox) []*kit.EnvConfig

CollectBuilderRuntimeEnv gathers the runtime env + PATH contributions declared by each builder a candy in the image triggers (via CandyNeedsBuilder). Relocated (P8).

func (*Generator) EmitBaseBootstrap added in v0.2026192.1709

func (g *Generator) EmitBaseBootstrap(b *strings.Builder, boxName string, img *buildkit.ResolvedBox)

EmitBaseBootstrap emits the base-stage bootstrap: a builder-rootfs ADD for a `from: builder:` base, then either the full WriteBootstrap (external base) or a USER root reset (internal base). Relocated from charly (P8); byte-identical.

func (*Generator) EmitExtractStages added in v0.2026192.1709

func (g *Generator) EmitExtractStages(b *strings.Builder, candyOrder []string)

EmitExtractStages emits a `FROM <source> AS <candy>-extract-<i>` stage per candy extract directive (the source images files are extracted from). (P8).

func (*Generator) EmitExtractedFiles added in v0.2026192.1709

func (g *Generator) EmitExtractedFiles(b *strings.Builder, img *buildkit.ResolvedBox, candyOrder []string)

EmitExtractedFiles emits the COPY --from=<extract-stage> directives that pull extracted files into the image (chowned to the image user). (P8).

func (*Generator) EmitInitAssembly added in v0.2026192.1709

func (g *Generator) EmitInitAssembly(b *strings.Builder, img *buildkit.ResolvedBox, candyOrder []string, activeInits map[string]*spec.ResolvedInit, initHasFragments map[string]bool) error

EmitInitAssembly emits the assembly_template, system_enable_template, and post_assembly_template RUN steps for each active init system. Relocated from charly (P8); byte-identical. initHasFragments gates the assembly step (a fragment-less init contributed no scratch stage to bind-mount from).

func (*Generator) EmitInitFragmentStages added in v0.2026192.1709

func (g *Generator) EmitInitFragmentStages(b *strings.Builder, boxName string, img *buildkit.ResolvedBox, candyOrder []string, activeInits map[string]*spec.ResolvedInit) (map[string]bool, error)

EmitInitFragmentStages emits the per-init scratch stages that COPY service fragments, relay configs, and detected service files, and returns the per-init map of whether any fragment content was contributed (consumed by EmitInitAssembly). Relocated from charly (P8); byte-identical.

func (*Generator) EmitScratchStages added in v0.2026192.1709

func (g *Generator) EmitScratchStages(b *strings.Builder, candyOrder []string)

EmitScratchStages emits a `FROM scratch AS <candy>` + `COPY <src>/ /` per candy, staging each candy's files in its own scratch layer. Relocated (P8).

func (*Generator) EmitTasks added in v0.2026192.1709

func (g *Generator) EmitTasks(b *strings.Builder, layer CandyModel, img *buildkit.ResolvedBox, ops []vmshared.Op, buildDir, contextRelPrefix string) (string, error)

emitTasks renders a candy's tasks to b in strict order, with adjacent-coalescing for mkdir/link/setcap batches, parent-dir auto-insertion for copy/write, USER switches on user change, and implicit build-task auto-append. Returns the final USER (so writeCandySteps knows whether to reset the candy boundary). Relocated from charly core (P8); byte-identical. The `plugin` verb case is the ONLY host seam — dispatched through g.EmitPluginOp (the Provider registry stays core).

func (*Generator) EmitTraefikRouteStage added in v0.2026192.1709

func (g *Generator) EmitTraefikRouteStage(b *strings.Builder, boxName string, img *buildkit.ResolvedBox, candyOrder []string) (hasRoutes, hasTraefik bool, err error)

EmitTraefikRouteStage emits the traefik-routes scratch stage when the image has route candies AND traefik, generating the routes file. Returns (hasRoutes, hasTraefik). Relocated from charly (P8); byte-identical.

func (*Generator) GenerateInitFragments added in v0.2026192.1709

func (g *Generator) GenerateInitFragments(boxName, initName string, def *spec.ResolvedInit, candyOrder []string) error

GenerateInitFragments writes init system config fragments to .build/<image>/<fragmentDir>/. Schema-driven: iterates each candy's service: list and renders every entry that binds to this init via per-entry routing (use_packaged → systemd; custom exec → any init with a service_template). Relocated from charly (P8); byte-identical. The service render itself crosses to candy/plugin-init via the RenderService seam.

func (*Generator) GenerateTraefikRoutes added in v0.2026192.1709

func (g *Generator) GenerateTraefikRoutes(boxName string, candyOrder []string, _ *buildkit.ResolvedBox) error

GenerateTraefikRoutes writes the image's traefik dynamic-config (routers + services) to .build/<box>/traefik-routes.yml, egress-gated before write. Relocated from charly (P8); byte-identical.

func (*Generator) GlobalOrderForBox added in v0.2026192.1709

func (g *Generator) GlobalOrderForBox(imageCandies []string, parentCandies map[string]bool) ([]string, error)

GlobalOrderForBox returns the candy order for an image by filtering the global order to only the image's needed candies (expanded + transitively resolved). Shared candies keep the same cross-image order, maximizing cache reuse. Any needed candy missing from the global order is appended in resolution order (a safety net that shouldn't trigger). Relocated from charly core (P8); byte-identical.

func (*Generator) ResolveBaseImage added in v0.2026192.1709

func (g *Generator) ResolveBaseImage(img *buildkit.ResolvedBox) string

ResolveBaseImage returns the base image ref for img: the external OCI ref when external, else the parent image's full CalVer tag. Relocated from charly (P8).

func (*Generator) WriteBootstrap added in v0.2026192.1709

func (g *Generator) WriteBootstrap(b *strings.Builder, img *buildkit.ResolvedBox)

WriteBootstrap emits the base-image bootstrap block: cache mounts, dnf tuning, bootstrap package install, distro workarounds, the go-task install, user/group creation (or adoption), and WORKDIR. Relocated from charly (P8); byte-identical.

func (*Generator) WriteCandyEnv added in v0.2026192.1709

func (g *Generator) WriteCandyEnv(b *strings.Builder, candyOrder []string, img *buildkit.ResolvedBox)

WriteCandyEnv emits the merged candy env + builder runtime env as sorted ENV directives (plus a PATH-append). Relocated from charly (P8); byte-identical (sortStrings → slices.Sort is the same lexicographic order).

func (*Generator) WriteCandySteps added in v0.2026192.1709

func (g *Generator) WriteCandySteps(b *strings.Builder, candyName string, img *buildkit.ResolvedBox, skipRootReset bool) (bool, error)

WriteCandySteps writes the RUN steps for a single candy (the per-candy render call-graph: ENV/packages/localpkg/tasks/builders/shell/user-reset sharing the asUser state). Relocated from charly (P8); byte-identical. skipRootReset prevents emitting USER root after user-mode steps (the last candy when no post-candy root steps follow); returns true if the candy ended in user mode.

func (*Generator) WriteDataStaging added in v0.2026192.1709

func (g *Generator) WriteDataStaging(b *strings.Builder, candyOrder []string, img *buildkit.ResolvedBox)

WriteDataStaging emits COPY --from=<candy-scratch-stage> directives that stage a candy's data/ tree under /data/<volume>/[dest] for deploy-time provisioning into bind-backed volumes. Uses the short stage alias (GetName) — a remote candy's map key is not a valid build-stage ref. Relocated from charly (P8); byte-identical.

func (*Generator) WriteExpose added in v0.2026192.1709

func (g *Generator) WriteExpose(b *strings.Builder, boxName string)

WriteExpose emits EXPOSE directives for an image's aggregated ports (via the CollectBoxPorts seam). Relocated from charly (P8); byte-identical.

type HooksConfig added in v0.2026190.848

type HooksConfig = spec.HooksConfig

type HostContext added in v0.2026190.848

type HostContext struct {
	// MachineVenue selects compilation mode (P9): false (zero value) → compile for a
	// CONTAINER image build (the pod overlay / OCI target); true → compile for a MACHINE
	// venue with a system init (a target:local / target:vm deploy — services render as
	// systemd units, home is deferred via {{.Home}}). detectHostContext sets it true for a
	// host deploy; the OCI/pod-overlay compile passes the zero value. It replaced the former
	// string Target ("host"/"vm"/"oci"), whose "vm" arm was dead (a vm deploy compiles with
	// the host detectHostContext) — the machine-vs-container distinction IS the trait.
	MachineVenue bool

	// Distro is the resolved host distro tag, e.g. "fedora:43". Used to
	// pick the right format section when compiling for a host target
	// whose distro differs from the image's primary distro.
	Distro string

	// GlibcVersion is the host's glibc major.minor as reported by
	// `ldd --version`. Used by the host target's preflight check against
	// the selected builder image. Optional; empty means skip the check.
	GlibcVersion string

	// BuilderImage overrides the default builder-image selection for
	// VenueContainerBuilder steps. Populated from --builder-image. ""
	// means "use the embedded build vocabulary's default".
	BuilderImage string

	// BuilderContext carries the host-side build PRE-PASS result: each externalized
	// detection-builder's per-candy stage context + teardown ops, keyed by
	// BuilderCtxKey(candy, builder). Populated by preresolveBuilderContexts BEFORE
	// this pure compile (the deploy command path); read by collectBuilderContext +
	// compileBuilderSteps so the compiler NEVER dials a builder plugin (purity). Nil
	// when no pre-pass ran (a direct BuildDeployPlan caller / test) or no externalized
	// builder is triggered → the affected builder gets base-only context, no teardown.
	BuilderContext map[string]BuilderPreresolved
}

HostContext carries host-side information the compiler needs to decide (a) which format section to pick for the host target, (b) which builder image to run user-scope builders in, (c) whether to gate AUR-specific steps, etc. For the OCI target, the caller passes a zero-value HostContext (the compiler ignores host-only choices when MachineVenue is false).

type InstallOptsConfig added in v0.2026190.848

type InstallOptsConfig = vmshared.InstallOptsConfig

type InstallPlan added in v0.2026190.848

type InstallPlan = spec.InstallPlan

func BuildDeployPlan added in v0.2026190.848

func BuildDeployPlan(layer CandyModel, img *ResolvedBox, hostCtx HostContext) (*InstallPlan, error)

BuildDeployPlan compiles one Candy into an InstallPlan.

For whole-image deploys, the caller iterates the ordered candy list (from ResolveCandyOrder) and builds one plan per candy, then merges them. Keeping one plan per candy makes refcounting trivial in the ledger: each candy's teardown is independent.

func MergePlan added in v0.2026190.848

func MergePlan(plans []*InstallPlan, image string, addCandies []string) *InstallPlan

MergePlan combines a list of per-candy plans into one whole-image plan. Used by deploy targets that want to see all steps in one sequence (for sudo batching, overall dry-run display, etc.) while preserving per-candy provenance for the ledger.

type InstallStep added in v0.2026190.848

type InstallStep = spec.InstallStep

func CompileApkStep added in v0.2026190.848

func CompileApkStep(layer CandyModel) InstallStep

CompileApkStep turns a candy's `apk:` package list into a single ApkInstallStep, or nil if the candy declares no apk packages. The `apk` format is target-agnostic at compile time — the step carries the specs and each DeployTarget decides whether to execute (android) or skip (everything else), exactly as the IR intends for venue-specific work.

func CompileLocalPkgStep added in v0.2026190.848

func CompileLocalPkgStep(layer CandyModel, img *ResolvedBox, _ HostContext) InstallStep

CompileLocalPkgStep turns a candy's `localpkg:` field into a single LocalPkgInstallStep, or nil if the candy declares none. Like CompileApkStep it is target-agnostic at compile time — the step carries the author's PKGBUILD hint plus the candy dir AND the deploy project dir (os.Getwd, the same handle compileServiceSteps reads) as the two anchors the emit-time walk-up search uses to locate the PKGBUILD. Each DeployTarget decides whether to build+install (localpkg-capable host/guest), skip (image build, non-pac targets, android, k8s).

The localpkg mechanism is fully config-driven: the format's `local_pkg:` block (resolved here via DistroDef.LocalPkgFormat, the SAME DistroDef the system-package steps read) supplies the build/install templates, package glob, foreign-deps query, probe, and dependency-builder name. BuilderImage is resolved for that block's DepBuilder the same way builder steps resolve theirs (resolveBuilderImage) so the executor can build the package's dependency closure through the EXISTING builder before installing. When the distro declares no localpkg-capable format, LocalPkg is nil and the executor skips; when no dep builder resolves, BuilderImage is "" and the dep-build is skipped with a clear log (the candy's own curl/COPY fallback still covers non-localpkg targets).

func CompileOpSteps added in v0.2026190.848

func CompileOpSteps(layer CandyModel, img *ResolvedBox) []InstallStep

CompileOpSteps turns the candy's install timeline into InstallSteps. The timeline is the candy's `plan:` `run:` steps (StepKind()==KwRun) whose context includes build/deploy, in declared (cache-stable) order — the fold that retired the separate `task:` list. Each run op either LOWERS into an existing typed step (the `plugin: package` verb → SystemPackagesStep and the `plugin: service` verb → ServicePackagedStep, each via its TypedStepProvider) so emit + reversal are REUSED, or stays a generic OpStep (install verbs + command + the RenderProvisionScript plugin verbs). A run: step scoped runtime-only is plan-runtime provisioning the check Runner executes — NOT the install timeline — and is skipped here (avoids double-execution); check:/agent-*/ include: steps are never lowered.

func CompileShellSnippetSteps added in v0.2026190.848

func CompileShellSnippetSteps(layer CandyModel, img *ResolvedBox, hostCtx HostContext) []InstallStep

CompileShellSnippetSteps returns one ShellSnippetStep per (candy, shell) pair the candy contributes. Selection rule (mirrors TagPkgConfig):

  1. If layer.Shell.ByShell[shell] exists, render it.
  2. Else if layer.Shell.Init is non-empty, render the generic body with ${SHELL_NAME} substituted to the active shell name.
  3. Else this shell gets nothing from this candy.

path_append entries are rendered into the snippet body using shell-appropriate syntax (PATH=... for bash/zsh/sh, fish_add_path for fish) before the step is emitted, so each DeployTarget emitter can write the snippet bytes verbatim.

Destination resolution is target-aware:

  • Container build (hostCtx.MachineVenue == false): system-wide drop-in (/etc/profile.d/charly-<candy>-<shell>.sh, /etc/fish/conf.d/ charly-<candy>.fish). UseDropin=true.
  • target:local, target:vm (hostCtx.MachineVenue == true): bash/zsh/sh → managed-block append in the user's rc file (UseDropin =false); fish → per-candy drop-in in ~/.config/fish/conf.d/ (UseDropin=true).

Returns nil when the candy has no shell: block.

func CompileSystemPackageSteps added in v0.2026190.848

func CompileSystemPackageSteps(layer CandyModel, img *ResolvedBox, _ HostContext) []InstallStep

CompileSystemPackageSteps emits SystemPackagesStep(s) for the candy's package sections, honoring the distro-tag-wins-over-build-format rule from today's writeCandySteps.

Phase 1: walk img.Distro tags in order; first match wins. If a tag section is found, emit ONE install step using that section and stop.

Phase 2: if no tag matched, walk img.BuildFormats in order; emit one install step per format section that has packages. (Today's writeCandySteps does this to support images that install both rpm and aur packages, for example.)

For the IR we additionally break each install into the three-phase structure (prepare/install/cleanup) so the host target can gate PhasePrepare on --allow-repo-changes. The embedded vocabulary (charly/charly.yml) currently has only one phase per format (the monolithic install_template); Task 4 will split templates into phases. Until then, we emit everything as PhaseInstall. CompileSystemPackageSteps resolves a candy's package surface for an image via the distro-specificity CASCADE and emits ONE SystemPackagesStep for the image's primary format. img.Distro is the most-specific-first tag chain (e.g. [debian:13, debian] or [ubuntu:24.04, ubuntu]); the candy's top-level package: list (layer.TopPackages) is the always-included BASE.

  • packages = UNION of the base + every matching tag section's packages (dedup), so a shared package at one level plus extras at another accumulate.
  • repo/copr/options/exclude/module = the MOST-SPECIFIC matching level that declares the field wins (a version's repo overrides the bare distro's).

img.Distro is most-specific-first, so iterating it in REVERSE (least → most specific) and letting later writes win yields most-specific-wins for the Raw extras while packages union regardless of order. fedora/arch reach their packages via the bare-distro tag (img.Distro = [fedora] / [arch]); there is no format-section fallback — the deb collapse that caused non-deterministic repo selection is gone (per-distro tag sections never share a mutable section).

func StepFromView added in v0.2026190.848

func StepFromView(v spec.InstallStepView) (InstallStep, error)

StepFromView reconstructs the concrete InstallStep a view projects. An unknown Kind is a hard error (the wire carried a step kind this charly does not know — a genuine version/contract breach, never silently dropped).

type JumpKind added in v0.2026190.848

type JumpKind = kit.JumpKind

type LocalPkgDef

type LocalPkgDef = spec.LocalPkg

type LocalPkgInstallStep

type LocalPkgInstallStep struct {
	PkgbuildRef string // the layer's `localpkg:` value (e.g. "pkg/arch") — a hint, resolved at emit
	CandyName   string
	CandyDir    string // layer source dir — one anchor for the relative PKGBUILD search
	ProjectDir  string // the deploy project dir (os.Getwd() at deploy time) — the other anchor

	// Format is the package-format name whose `local_pkg:` config drives this
	// step (e.g. "pac"). "" when the target distro declares no localpkg-capable
	// format — the executor then treats the step as a clean no-op.
	Format string

	// LocalPkg is the format's localpkg contract resolved from the embedded build vocabulary (charly/charly.yml) at
	// compile time (DistroDef.LocalPkgFormat). It carries the build/install
	// templates, package glob, source-dir sentinel, and probe command — so the
	// executor renders every package-manager command from config instead of
	// hardcoding build/install/glob literals. The install command auto-resolves
	// the package's dependencies from the target's repos (pacman -U / dnf
	// install / apt-get install), so there is no dep-closure builder. Nil when
	// Format == "".
	LocalPkg *LocalPkgDef
}

--------------------------------------------------------------------------- LocalPkgInstallStep — build a bundled PKGBUILD on the host (makepkg) and install the resulting `.pkg.tar.zst` onto a pac-based deploy target. ---------------------------------------------------------------------------

LocalPkgInstallStep is the IR form of a candy's `localpkg:` field — a pointer at a bundled Arch PKGBUILD directory (relative to the candy dir or the project root). It is the proper-package counterpart of the charly candy's ad-hoc curl-a-binary `cmd:` task: on an Arch/CachyOS DEPLOY target the package is built from the repo's bundled PKGBUILD on the HOST (`makepkg`), the resulting artifact is transferred to the target, and `pacman -U`-installed — so `charly` lands as the tracked `opencharly-git` package at /usr/bin/charly rather than an untracked binary at /usr/local/bin/charly.

Like ApkInstallStep, the step is compiled REGARDLESS of target and each DeployTarget decides whether to execute or skip:

  • the external local deploy (Arch/CachyOS host) and external vm deploy (Arch/CachyOS guest) EXECUTE it via the RunHostStep host-engine leg (build on host → transfer → pacman -U on the target).
  • On a NON-pac deploy target the executor records a clean skip (a Fedora / Debian host has no pacman; the candy's own `cmd:` task curls the binary there as the documented fallback).
  • The IMAGE build (generate.go writeCandySteps) AND the pod-overlay build-emit RENDER the localpkg IMAGE install via renderLocalPkgImageInstall: a PRODUCTION box DOWNLOADS the published release, a DISPOSABLE check bed BUILDS the in-development package on the host and COPYs it in (both install via the SAME dep-resolving install template). The pod-overlay build-emit routes through candy/plugin-installstep's `step:local-pkg-install` OpEmit, which calls back the host `step-emit` seam (stepEmitLocalPkgInstall) — the build engine stays in core. A distro with no localpkg-capable format (LocalPkg==nil) renders nothing; the candy's own COPY/curl `cmd:` task is the fallback there.
  • the android / k8s substrates (external) SKIP it (no Arch package surface).

The PKGBUILD location is resolved at EMIT time (not compile time), so the step carries only the author's hint (`PkgbuildRef`) plus the candy's source dir + the deploy project dir for the walk-up search. When no PKGBUILD is found the step is a no-op (the candy's existing curl/COPY task is the fallback).

func (*LocalPkgInstallStep) Kind

func (s *LocalPkgInstallStep) Kind() StepKind

func (*LocalPkgInstallStep) RequiresGate

func (s *LocalPkgInstallStep) RequiresGate() Gate

func (*LocalPkgInstallStep) Reverse

func (s *LocalPkgInstallStep) Reverse() []ReverseOp

Reverse returns no ledger ops — the package is the deploy substrate's own pacman-tracked package, removed (if ever) via `pacman -R opencharly-git` by the operator, not by deploy teardown. Mirrors ApkInstallStep's empty Reverse.

func (*LocalPkgInstallStep) Scope

func (s *LocalPkgInstallStep) Scope() Scope

Scope is system — installing a pacman package mutates global package state.

func (*LocalPkgInstallStep) Venue

func (s *LocalPkgInstallStep) Venue() Venue

Venue is host-native — makepkg runs on the host (like the aur builder), then the artifact is shipped to the target and installed via pacman.

type MCPProvideEntry added in v0.2026190.848

type MCPProvideEntry = spec.MCPProvideEntry

type MCPServerYAML added in v0.2026190.848

type MCPServerYAML = spec.MCPServerYAML

type NestedExecutor added in v0.2026190.848

type NestedExecutor = kit.NestedExecutor

type NestedJump added in v0.2026190.848

type NestedJump = kit.NestedJump

type Op

type Op = spec.Op

type OpStep

type OpStep struct {
	Op           *Op
	CandyName    string
	CandyDir     string
	CtxPath      string // absolute layer-dir path replacing "/ctx/" on host
	ResolvedUser string // uid:gid or "root" after resolveUserSpec

	// To is the home-resolved copy/download destination for the DEPLOY path.
	// The compiler tokenizes the task's `to:` (~ / ${HOME} / $HOME → {{.Home}})
	// here; InstallPlan.ResolveHome substitutes the destination's real home at
	// emit. execTask uses this (not the raw Task.To) for PutFile, so a
	// `copy: to: ${HOME}/...` lands in the actual guest/host home instead of a
	// literal "${HOME}" directory under sudo (HOME=/root). Empty when the task
	// has no `to:`. The OCI build emitter reads Task.To directly (build-time
	// ENV expands ${HOME}), so it is unaffected by this field.
	To string

	// CandyVars are the candy manifest `vars:` map propagated into the task
	// script as exports. Build-time gets these via Containerfile ENV
	// directives (emitVarsEnv); host/local-deploy time has no equivalent
	// mechanism, so the renderer emits `export K=V` lines from this field.
	// Without this, candies like `kubernetes` whose download URLs reference
	// ${K3D_VERSION} fetched an empty path-component at deploy time and
	// curl 404'd.
	CandyVars map[string]string

	// Distros is the image's distro tag chain (img.Tags), carried so the act-emit
	// enabler can pass it to a state-provision plugin verb's RenderProvisionScript
	// (e.g. the cross-distro package resolution). Empty for non-plugin ops; the
	// unix_group act ignores it, but a future package/service state-provision plugin
	// reads it.
	Distros []string
}

OpStep wraps a raw Op so the IR compiler doesn't have to transform it further. The OCI target and host target both understand Op shapes (cmd / mkdir / copy / write / link / download / setcap / build) and emit the appropriate directives. CtxPath substitutes for /ctx/ in cmd bodies on the host target (container RUN directives keep /ctx via bind-mount, which doesn't exist on the host).

func (*OpStep) Kind

func (s *OpStep) Kind() StepKind

func (*OpStep) RequiresGate

func (s *OpStep) RequiresGate() Gate

func (*OpStep) Reverse

func (s *OpStep) Reverse() []ReverseOp

func (*OpStep) Scope

func (s *OpStep) Scope() Scope

func (*OpStep) Venue

func (s *OpStep) Venue() Venue

type PackageItem added in v0.2026190.848

type PackageItem = vmshared.PackageItem

type PackageSection added in v0.2026190.848

type PackageSection struct {
	FormatName string         // "rpm", "deb", "pac", "aur", etc.
	Packages   []string       // extracted from Raw["package"] for quick access
	Raw        map[string]any // all fields from YAML, passed to templates
}

PackageSection represents a generic format-specific package config in the candy manifest. All fields from the YAML section are available in Raw for template rendering.

type Phase

type Phase = spec.Phase

type PortSpec added in v0.2026190.848

type PortSpec = spec.PortSpec

type PreemptibleConfig added in v0.2026190.848

type PreemptibleConfig = spec.PreemptibleConfig

type ProvidesConfig added in v0.2026190.848

type ProvidesConfig struct {
	Env []EnvProvideEntry `yaml:"env,omitempty" json:"env,omitempty"`
	MCP []MCPProvideEntry `yaml:"mcp,omitempty" json:"mcp,omitempty"`
}

ProvidesConfig holds all resolved provides entries in charly.yml.

type QuadletConfig added in v0.2026194.615

type QuadletConfig struct {
	BoxName         string
	ImageRef        string
	Home            string
	Ports           []string
	Volumes         []VolumeMount
	BindMounts      []ResolvedBindMount
	GPU             bool
	BindAddress     string
	Tunnel          *spec.TunnelConfig
	UID             int
	GID             int
	Env             []string
	EnvFile         string
	Instance        string
	Security        vmshared.SecurityConfig
	Network         string
	Version         string
	Status          string
	Info            string
	Secrets         []CollectedSecret
	Entrypoint      []string
	CharlyBin       string
	EncryptedMounts bool
	KeyringBackend  bool
	PodName         string
	Sidecar         []ResolvedSidecar
}

QuadletConfig holds the parameters for generating a quadlet .container file. An INTERNAL library type (ruling C): the plugin constructs + consumes it in one process (built from config-resolve data), so it never crosses the host↔plugin boundary and needs no CUE-sourcing.

type RebootStep

type RebootStep struct {
	CandyName string
}

RebootStep requests a reboot of the deploy target after this candy's steps. It is emitted (last in the candy) when a candy declares `reboot: true` — the canonical case is a kernel-module candy (e.g. nvidia-open-dkms) whose module only loads on a fresh boot with nouveau blacklisted.

Only a rebootable venue acts on it: the external vm deploy reboots the guest over SSH (the host's RunHostStep RebootStep handler, gated on the rebootable-venue flag the vm substrate sets) and waits for the boot_id to change. OCITarget / PodDeployTarget have no machine to reboot at build time and skip it (the external k8s substrate does not consume the IR at all); the external local deploy refuses to reboot the host venue unattended (skip + note). Mirrors the ApkInstallStep "only one target executes" pattern.

func (*RebootStep) Kind

func (s *RebootStep) Kind() StepKind

func (*RebootStep) RequiresGate

func (s *RebootStep) RequiresGate() Gate

func (*RebootStep) Reverse

func (s *RebootStep) Reverse() []ReverseOp

Reverse is empty — a reboot is not a persistent artifact to undo.

func (*RebootStep) Scope

func (s *RebootStep) Scope() Scope

func (*RebootStep) Venue

func (s *RebootStep) Venue() Venue

type RelayContext added in v0.2026192.1709

type RelayContext struct {
	Port      int
	CandyName string
	Index     int
}

RelayContext is the template context for relay_template rendering.

type RepoChangeStep

type RepoChangeStep struct {
	Format    string // "rpm" | "deb" | "pac"
	File      string // absolute path of the repo file
	Content   string // rendered repo file body
	Checksum  string // sha256 of Content, for idempotency check at install
	CandyName string
}

RepoChangeStep records a repo config file mutation (e.g. adding rpmfusion-free.repo to /etc/yum.repos.d/). Distinct from SystemPackagesStep's PhasePrepare because the compiler often synthesizes these from `cmd:` tasks that happen to install a -release.rpm — we want them tracked separately so `charly bundle del` can reverse them precisely.

func (*RepoChangeStep) Kind

func (s *RepoChangeStep) Kind() StepKind

func (*RepoChangeStep) RequiresGate

func (s *RepoChangeStep) RequiresGate() Gate

func (*RepoChangeStep) Reverse

func (s *RepoChangeStep) Reverse() []ReverseOp

func (*RepoChangeStep) Scope

func (s *RepoChangeStep) Scope() Scope

func (*RepoChangeStep) Venue

func (s *RepoChangeStep) Venue() Venue

type RepoSpec

type RepoSpec struct {
	// Fields captured verbatim from the candy manifest. Different formats use
	// different subsets (rpm has url/id/key; deb has suite/components;
	// pac has url/keys). Carried as map so the template-rendered host
	// and container forms can pick what they need.
	Raw map[string]any
}

type ResolvedBindMount added in v0.2026194.615

type ResolvedBindMount struct {
	Name      string // e.g. "secrets"
	HostPath  string // effective host path (plain: expanded host, encrypted: plain dir)
	ContPath  string // container path (expanded)
	Encrypted bool   // for status/mount checks
}

ResolvedBindMount is a deploy-time resolved bind mount (host-path state). Runtime-only (never baked into an OCI label — LabelVolumeEntry is the label type), so it lives here as a plain deploykit struct (no CUE). Relocated from charly/enc.go with the P11 enc-model move.

type ResolvedBox added in v0.2026190.848

type ResolvedBox = buildkit.ResolvedBox

type ResolvedSidecar added in v0.2026194.615

type ResolvedSidecar struct {
	Name     string                  // sidecar key (e.g., "tailscale")
	Image    string                  // resolved OCI image ref
	Env      map[string]string       // merged env vars
	Secret   []CollectedSecret       // provisioned podman secrets
	Volume   []VolumeMount           // resolved named volumes
	Security vmshared.SecurityConfig // merged security config
}

ResolvedSidecar is a fully-resolved sidecar ready for quadlet generation — the host-adapted form (the sidecar plugin's spec.ResolvedSidecar wire type is adapted on the host into these deploykit/vmshared runtime types). Resolved runtime state (ruling C), not a wire type, so it lives here as a plain struct beside the other pod config-write inputs. Consumed by the pod quadlet generators (generatePodQuadlet / generateSidecarQuadlet) that assemble the .pod + sidecar .container files.

type ReverseOp

type ReverseOp = spec.ReverseOp

type ReverseOpKind

type ReverseOpKind = spec.ReverseOpKind

type RouteConfig added in v0.2026190.848

type RouteConfig struct {
	Host string
	Port string
}

RouteConfig represents a route file declaration.

type SSHExecutor added in v0.2026190.848

type SSHExecutor = kit.SSHExecutor

func SSHParamsForVm added in v0.2026190.848

func SSHParamsForVm(domainID string) *SSHExecutor

SSHParamsForVm returns an SSHExecutor pointing at the VM's managed ssh-config alias (charly-<domainID>) — the caller passes the per-deploy DOMAIN IDENTITY (VmDomainIdentity of the deploy), NOT the shared kind:vm entity (P33). All connection details — User, Port, IdentityFile, host-key checking — live in the Host stanza that `charly vm create` / `charly bundle add` published into ~/.config/charly/ssh_config; ssh(1) reads them from there. Our SSHExecutor needs only the alias as Host.

type Scope

type Scope = spec.Scope

func OpStepScope

func OpStepScope(userDir string) Scope

func ScopeFromName added in v0.2026190.848

func ScopeFromName(name string) Scope

type SecretYAML added in v0.2026190.848

type SecretYAML = spec.SecretYAML

type SecurityConfig added in v0.2026190.848

type SecurityConfig = spec.SecurityConfig

type ServiceCustomStep

type ServiceCustomStep struct {
	Name        string // e.g. "charly-ollama-ollama"
	UnitText    string // fully rendered unit content
	UnitPath    string // absolute install path
	TargetScope Scope  // ScopeSystem or ScopeUser
	Enable      bool
	CandyName   string
}

ServiceCustomStep writes and enables a full service definition. The unit text is already rendered by the compiler from the candy's generic `services:` entry via the target init system's service_template.

func (*ServiceCustomStep) Kind

func (s *ServiceCustomStep) Kind() StepKind

func (*ServiceCustomStep) RequiresGate

func (s *ServiceCustomStep) RequiresGate() Gate

func (*ServiceCustomStep) Reverse

func (s *ServiceCustomStep) Reverse() []ReverseOp

func (*ServiceCustomStep) Scope

func (s *ServiceCustomStep) Scope() Scope

func (*ServiceCustomStep) Venue

func (s *ServiceCustomStep) Venue() Venue

type ServiceEntry added in v0.2026190.848

type ServiceEntry = spec.ServiceEntry

type ServicePackagedStep

type ServicePackagedStep struct {
	Unit          string // e.g. "postgresql.service"
	TargetScope   Scope  // ScopeSystem → /etc/systemd/system/; ScopeUser → ~/.config/systemd/user/
	Enable        bool
	OverridesText string // rendered drop-in (.conf) content; "" if no overrides
	OverridesPath string // computed absolute path for the drop-in file
	CandyName     string // for ledger + drop-in naming
	PriorEnabled  bool   // populated at install time (before enable); used for teardown restore
}

ServicePackagedStep enables a systemd unit that arrived via a distro package (e.g. postgresql.service). Optional drop-in overrides are written alongside the packaged unit without touching it. This step is only emitted when rendering to a systemd-based init system; supervisord targets emit a warning-and-skip.

func (*ServicePackagedStep) Kind

func (s *ServicePackagedStep) Kind() StepKind

func (*ServicePackagedStep) RequiresGate

func (s *ServicePackagedStep) RequiresGate() Gate

func (*ServicePackagedStep) Reverse

func (s *ServicePackagedStep) Reverse() []ReverseOp

func (*ServicePackagedStep) Scope

func (s *ServicePackagedStep) Scope() Scope

func (*ServicePackagedStep) Venue

func (s *ServicePackagedStep) Venue() Venue

type ShellConfig added in v0.2026190.848

type ShellConfig = vmshared.ShellConfig

type ShellExecutor added in v0.2026190.848

type ShellExecutor = kit.ShellExecutor

type ShellHookStep

type ShellHookStep struct {
	CandyName string
	EnvVars   map[string]string
	PathAdd   []string // already {{.Home}}-substituted to absolute paths
	EnvFile   string   // computed path (~/.config/opencharly/env.d/<candy>.env); populated at install
}

ShellHookStep records the env vars and PATH contributions a candy makes to the user's shell environment. On the OCI target these translate to `ENV K=V` directives in the Containerfile. On the host target they become `~/.config/opencharly/env.d/<candy>.env` plus a managed block in the user's shell init that sources the env.d directory.

func CompileShellHookStep added in v0.2026190.848

func CompileShellHookStep(layer CandyModel, _ *ResolvedBox) *ShellHookStep

CompileShellHookStep returns a ShellHookStep for the candy's env: and path_append: fields, or nil if the candy contributes neither.

Home resolution is DEFERRED: `~`/`$HOME` are rewritten to the literal `{{.Home}}` token rather than expanded against img.Home. Each DeployTarget resolves the token at emit time against the home of the actual deploy destination — img.Home for the OCI/pod-overlay build, the host home for the local deploy target, and the GUEST home (via the SSH executor's ResolveHome) for the vm deploy. Baking img.Home here was wrong for VM deploys: the synthetic plan's Home was the host operator's home, so env.d on the guest pointed at /home/<operator> instead of /home/<guest-user>. See InstallPlan.ResolveHome.

func (*ShellHookStep) Kind

func (s *ShellHookStep) Kind() StepKind

func (*ShellHookStep) RequiresGate

func (s *ShellHookStep) RequiresGate() Gate

func (*ShellHookStep) Reverse

func (s *ShellHookStep) Reverse() []ReverseOp

func (*ShellHookStep) Scope

func (s *ShellHookStep) Scope() Scope

func (*ShellHookStep) Venue

func (s *ShellHookStep) Venue() Venue

type ShellSnippetStep

type ShellSnippetStep struct {
	CandyName   string   // candy this snippet belongs to (also Marker source)
	Origin      string   // "<candy>" or "box" or "deploy" (for ledger refcount + LabelShell origin)
	Shell       string   // bash | zsh | fish | sh
	Snippet     string   // rendered body, ${SHELL_NAME}-substituted, ready to write
	PathAppend  []string // already rendered into Snippet by the compiler; tracked here for label round-trip / overlay
	Destination string   // resolved per-target at compile time; absolute path on the target
	Marker      string   // managed-block marker tag (= CandyName) — consumed by the kit walk's managed-block splice (sdk/kit/profile.go)
	UseDropin   bool     // true: write whole file (fish, container drop-in); false: managed-block append into existing rc file
	Priority    int      // load-order hint, 0 = default
}

ShellSnippetStep records a per-(candy, shell) init snippet emitted from a candy's `shell:` block. The compiler emits one step per (candy, shell) pair after applying the selection rule (per-shell ByShell entry wins over generic, with ${SHELL_NAME} substitution).

Per-target rendering:

  • OCITarget: snippet bytes are content-address-staged and COPYed to a system-wide drop-in (/etc/profile.d/charly-<candy>.sh for bash/zsh/sh, /etc/fish/conf.d/charly-<candy>.fish for fish).
  • the external local / vm deploy (kit.WalkPlans on the venue): managed-block append to the user's rc file (~/.bashrc, ~/.zshrc, ~/.profile) keyed by `# opencharly:begin <Marker>` fence; for fish, a per-candy drop-in at ~/.config/fish/conf.d/charly-<candy>.fish (no fence needed, file IS the unit). UseDropin discriminates the two paths.
  • the external k8s substrate: does not consume the InstallPlan IR at all (the host generates a Kustomize tree separately — no shell snippet).

func (*ShellSnippetStep) Kind

func (s *ShellSnippetStep) Kind() StepKind

func (*ShellSnippetStep) RequiresGate

func (s *ShellSnippetStep) RequiresGate() Gate

func (*ShellSnippetStep) Reverse

func (s *ShellSnippetStep) Reverse() []ReverseOp

func (*ShellSnippetStep) Scope

func (s *ShellSnippetStep) Scope() Scope

Scope: SnippetStep is system-wide for build-mode (Container drop-ins live under /etc/profile.d/ — root-owned), and user-profile for host/vm deploy- mode (managed block in ~/.bashrc etc.). The compiler picks the right Scope when constructing the step based on the destination path; the step records the choice so each emitter doesn't have to re-derive it.

func (*ShellSnippetStep) Venue

func (s *ShellSnippetStep) Venue() Venue

type ShellSpec added in v0.2026190.848

type ShellSpec = vmshared.ShellSpec

func ResolveShellSpec added in v0.2026190.848

func ResolveShellSpec(cfg *ShellConfig, shell string) (*ShellSpec, string, []string, bool)

ResolveShellSpec applies the per-shell-wins-over-generic selection rule. Returns the resolved spec, the rendered init body (with ${SHELL_NAME} substituted for the generic case), the path_append slice, and whether the shell has anything to contribute. Generic init wins when no per-shell override exists; per-shell wins otherwise.

type SiblingKey added in v0.2026193.1801

type SiblingKey struct {
	Base string
	UID  int
}

SiblingKey identifies a sibling-grouping equivalence class for intermediate computation. Grouping by (Base, UID) — not just Base — ensures that images with different user contexts (e.g. uid=1000 default vs. uid=0 root) don't share an auto-intermediate. Sharing would bake one group's HOME-relative paths (path_append `~/.foo/bin`, env vars using `~` or `$HOME`) into the intermediate's `ENV PATH` directives, leaving the other group with dead PATH entries that can't be overridden by its own ENV emission.

func SortedSiblingKeys added in v0.2026193.1801

func SortedSiblingKeys(m map[SiblingKey][]string) []SiblingKey

SortedSiblingKeys returns the sibling-group keys in a deterministic order — by base name, then UID. Used to make auto-intermediate creation independent of Go's randomized map iteration (see ComputeIntermediates).

type StageFragmentContext added in v0.2026192.1709

type StageFragmentContext struct {
	BoxName     string
	FragmentDir string
	FileName    string
}

StageFragmentContext is the template context for stage_fragment_copy rendering.

type Step added in v0.2026190.848

type Step = vmshared.Step

type StepBatch added in v0.2026190.848

type StepBatch = spec.StepBatch

type StepKind

type StepKind = spec.StepKind

type SystemEnableContext added in v0.2026192.1709

type SystemEnableContext struct {
	Units []string
}

SystemEnableContext is the render context for an init system's system_enable_template (the distro-shipped units to enable). Relocated (P8).

type SystemPackagesStep

type SystemPackagesStep struct {
	Format   string     // "rpm" | "deb" | "pac"
	Phase    Phase      // PhasePrepare | PhaseInstall | PhaseCleanup
	Packages []string   // package names (for Reverse)
	Repos    []RepoSpec // repository entries from the candy manifest (drives PhasePrepare)
	Options  []string   // format-specific install flags
	Copr     []string   // RPM-only: COPR repos to enable/disable
	Modules  []string   // RPM-only: DNF modules to enable
	Exclude  []string   // RPM-only: packages to exclude
	Keys     []string   // PAC-only: GPG keys to trust

	// CacheMounts and RawInstallContext are passed to template rendering.
	// These are populated by the compiler and consumed by the OCI target;
	// the host target ignores CacheMounts (no BuildKit outside containers).
	CacheMount        []CacheMountSpec
	RawInstallContext map[string]any
}

SystemPackagesStep installs packages via a distro package manager. One step typically expands to (PhasePrepare + PhaseInstall + PhaseCleanup) stages; the compiler emits one SystemPackagesStep per phase so the host target can gate PhasePrepare on --allow-repo-changes.

func BuildSystemPackagesStep added in v0.2026190.848

func BuildSystemPackagesStep(format string, phase Phase, packages []string, raw map[string]any, cacheMounts []CacheMountDef) *SystemPackagesStep

BuildSystemPackagesStep constructs a SystemPackagesStep from a PackageSection's Raw map, extracting the well-known structured fields (repos, options, copr, modules, exclude, keys) for gate checkuation while also preserving the full Raw map for template rendering later.

func (*SystemPackagesStep) Kind

func (s *SystemPackagesStep) Kind() StepKind

func (*SystemPackagesStep) RequiresGate

func (s *SystemPackagesStep) RequiresGate() Gate

func (*SystemPackagesStep) Reverse

func (s *SystemPackagesStep) Reverse() []ReverseOp

func (*SystemPackagesStep) Scope

func (s *SystemPackagesStep) Scope() Scope

func (*SystemPackagesStep) Venue

func (s *SystemPackagesStep) Venue() Venue

type TagPkgConfig added in v0.2026190.848

type TagPkgConfig struct {
	Package []string       `yaml:"package,omitempty" json:"package,omitempty"`
	Raw     map[string]any `yaml:"-"`
}

TagPkgConfig is a distro/version-specific package config (e.g. `debian:13:`, `ubuntu:24.04:`, `fedora:43:`). Packages are installed using the primary format's tool (dnf, apt, pacman). Raw captures the full YAML so that tag sections can carry `repos:`, `options:`, `keys:` — the same schema as the generic format section — for version-specific upstream repo configurations.

type TrieNode added in v0.2026193.1801

type TrieNode struct {
	Layer    string               // layer at this position ("" for root)
	Children map[string]*TrieNode // layer name → child node
	Boxes    []string             // user-defined images terminating here
}

TrieNode represents a node in the candy prefix trie.

func NewTrieNode added in v0.2026193.1801

func NewTrieNode(layer string) *TrieNode

NewTrieNode returns an empty trie node labeled with layer.

type Venue

type Venue = spec.Venue

type VolumeMount added in v0.2026193.1222

type VolumeMount struct {
	VolumeName    string // e.g. "charly-openclaw-data"
	ContainerPath string // e.g. "/home/user/.openclaw" (~ expanded)
}

VolumeMount is a resolved named-volume mount (charly-<deploy>-<name> → container path).

type VolumeYAML added in v0.2026190.848

type VolumeYAML = spec.VolumeYAML

Jump to

Keyboard shortcuts

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