resolve

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package resolve merges profile layers into an execution plan.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fingerprint

func Fingerprint(p *profile.Profile, f *facts.Facts) string

Fingerprint returns a stable, human-readable string that identifies the current selection and the facts that produced it.

func SplitEditTarget added in v0.17.0

func SplitEditTarget(key string) (file, id string)

SplitEditTarget splits an edit-entry key into file path and edit id at the last slash: "~/.zshrc/activate" → ("~/.zshrc", "activate"). No slash → ("", key); validation reports it. The map key for an edit entry is the full "<file-path>/<edit-id>" string, so per-key winner merging is already by (file, id) — this helper is for validation and drift, not for merging.

Types

type DotfileEntry

type DotfileEntry struct {
	Target string
	Source string
	Mode   string
	// Edit-entry fields (empty for whole-file entries). See profile.Dotfile.
	Line     string
	Block    string
	Comment  string
	Template string
	// EditSource is the resolved source path of a mode = "edit" entry —
	// the file whose contents were inlined into Block at resolve time
	// (Source is cleared downstream). Kept so status can attribute the
	// authored file to this entry (orphan scan) instead of flagging it.
	EditSource string
	Module     string
	Layer      string
	Scope      string
}

DotfileEntry is a single resolved dotfile target.

func (DotfileEntry) IsEdit added in v0.17.0

func (e DotfileEntry) IsEdit() bool

IsEdit reports whether the entry is a partial edit (line/block/template-edit) rather than a whole-file entry. Mirrors profile.Dotfile.IsEdit.

type DotfilesStep

type DotfilesStep struct {
	Entries []DotfileEntry
}

DotfilesStep lists managed dotfile entries.

type HooksStep

type HooksStep struct {
	Pre  []profile.HookCommand
	Post []profile.HookCommand
}

HooksStep lists the pre/post apply hook commands aggregated across all selected modules. Hooks are ordered sequences: per module the layers append base → host → user, and modules aggregate in selection order.

type MountEntry added in v0.2.0

type MountEntry struct {
	Name   string
	Spec   profile.MountSpec
	Module string
	Layer  string
	Scope  string
}

MountEntry is a single resolved mount: the winning layer's MountSpec plus the provenance (module, winning layer, module scope) the apply steps need.

type MountsStep added in v0.2.0

type MountsStep struct {
	Entries []MountEntry
}

MountsStep is the plan aggregate of mount entries across all selected modules, sorted by (Module, Name) for deterministic output.

type PackagesStep

type PackagesStep struct {
	Install []string
	Remove  []string
	// PresentModules maps each install package to the module IDs that declare
	// it present. Status attribution only; not convergence-relevant.
	PresentModules map[string][]string
	// AbsentModules maps each remove package to the module IDs that declare
	// it absent.
	AbsentModules map[string][]string
}

PackagesStep lists packages that should be present or removed from the system.

type Plan

type Plan struct {
	Packages PackagesStep
	Tools    ToolsStep
	Dotfiles DotfilesStep
	Hooks    HooksStep
	Mounts   MountsStep
	Smb      SmbStep
}

Plan is the resolved, side-effect-free execution plan for a profile.

func Resolve

func Resolve(p *profile.Profile, f *facts.Facts) (*Plan, error)

Resolve builds a Plan by merging base, host, and user overlays for each selected module. Precedence is user > host > base.

type SmbModuleSpec added in v0.2.0

type SmbModuleSpec struct {
	Module string
	Spec   profile.SmbSpec
}

SmbModuleSpec is one contributing module's merged smb spec. Modules lists which module contributed; the spec itself carries group/users/avahi and the merged shares. Sorted by Module for deterministic output.

type SmbStep added in v0.2.0

type SmbStep struct {
	Modules []SmbModuleSpec
}

SmbStep aggregates each contributing module's merged smb spec. A module with no [smb] content in any layer contributes nothing.

type ToolsStep

type ToolsStep struct {
	Versions map[string]string
	// ToolModules maps each tool name to the module IDs that declare it.
	ToolModules map[string][]string
}

ToolsStep lists required tool versions.

Jump to

Keyboard shortcuts

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