tree

package
v0.1.0-dev.20260222205529 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackagesManifestFiles = []string{
	"packages-manifest.yaml",
	"packages-manifest.json",
}

PackagesManifestFiles are filenames that contain package specifications. These files are processed by the Package Graph Builder to produce package installation nodes in the execution graph.

Functions

func ProcessingPipeline

func ProcessingPipeline(filename string) (targetName string, actions []string)

ProcessingPipeline determines the action pipeline from a filename. Extensions are processed outside-in (like .tar.gz).

Examples:

"foo"                     → "foo",                     ["file.link"]
"foo.template"            → "foo",                     ["template.render", "file.copy"]
"foo.sops"                → "foo",                     ["encryption.decrypt", "file.copy"]
"foo.template.sops"       → "foo",                     ["encryption.decrypt", "template.render", "file.copy"]
"packages-manifest.yaml"  → "packages-manifest.yaml",  ["manifest.resolve"]

Types

type BuildConfig

type BuildConfig struct {
	// SourceRoot is the source directory for single-source mode.
	// For multi-layer support, use Sources instead.
	SourceRoot string

	// TargetRoot is the target directory (e.g., $HOME).
	// Used as default when Sources is empty.
	TargetRoot string

	// Sources are the layer sources for multi-source mode.
	// If empty, falls back to single-source mode using SourceRoot/TargetRoot.
	Sources []LayerSource

	// Projects to include (e.g., ["all", "noblefactor"]).
	Projects []string

	// Segments for platform matching.
	Segments segment.Segments
}

BuildConfig holds configuration for building a deployment graph.

type BuildResult

type BuildResult struct {
	// Files are the file entries discovered.
	Files []*FileEntry

	// SourceRoot is the source root directory (for single-source mode).
	SourceRoot string

	// TargetRoot is the target root directory.
	TargetRoot string

	// Sources are the layer sources processed (for multi-source mode).
	Sources []LayerSource

	// Projects included in this build.
	Projects []string

	// MatchedDirs are the directories that matched the segments.
	MatchedDirs []segment.MatchResult

	// Collisions are files where a more specific source overrode a less specific one.
	Collisions []Collision
}

BuildResult contains the built file entries and build-time metadata.

func Build

func Build(cfg BuildConfig) (*BuildResult, error)

Build creates an execution graph from the given configuration. Supports both single-source mode (SourceRoot) and multi-source mode (Sources).

func (*BuildResult) CompactString

func (r *BuildResult) CompactString() string

CompactString returns a compact summary of the build result.

func (*BuildResult) FileCount

func (r *BuildResult) FileCount() int

FileCount returns the number of files discovered.

func (*BuildResult) HasCollisions

func (r *BuildResult) HasCollisions() bool

HasCollisions returns true if there were file collisions during build.

func (*BuildResult) LinkCount

func (r *BuildResult) LinkCount() int

LinkCount returns the number of simple symlink files.

func (*BuildResult) PackagesCount

func (r *BuildResult) PackagesCount() int

PackagesCount returns the number of packages-manifest entries.

func (*BuildResult) SecretCount

func (r *BuildResult) SecretCount() int

SecretCount returns the number of encrypted files.

func (*BuildResult) String

func (r *BuildResult) String() string

String returns a human-readable representation of the build result.

func (*BuildResult) TemplateCount

func (r *BuildResult) TemplateCount() int

TemplateCount returns the number of template files.

type Collision

type Collision struct {
	// Target is the relative target path that had a collision.
	Target string

	// Winner is the source that won (more specific or higher layer).
	Winner string

	// WinnerSpecificity is the number of suffixes on the winning directory.
	WinnerSpecificity int

	// WinnerLayer is the layer of the winner (empty for single-source mode).
	WinnerLayer string

	// Loser is the source that was overridden (less specific or lower layer).
	Loser string

	// LoserSpecificity is the number of suffixes on the losing directory.
	LoserSpecificity int

	// LoserLayer is the layer of the loser (empty for single-source mode).
	LoserLayer string
}

Collision records when a more specific file overrides a less specific one.

type FileEntry

type FileEntry struct {
	// ID is the relative target path (unique identifier).
	ID string

	// Operations is the pipeline of operations to perform.
	// Examples: ["link"], ["decrypt", "render", "copy"].
	Operations []string

	// Source is the absolute path to the source file.
	Source string

	// Target is the absolute path to the target file.
	Target string

	// Project this file belongs to.
	Project string

	// Layer is the repository layer (base, team, personal).
	Layer string

	// Mode is the file permissions to set (0 means default 0644).
	Mode os.FileMode
}

FileEntry represents a file discovered during tree walking. This is pure file metadata - no execution state.

type LayerSource

type LayerSource struct {
	Layer      string // "base", "team", or "personal"
	Path       string // Repo root path
	Order      int    // 0=base, 1=team, 2=personal (for precedence sorting)
	SourceRoot string // Full path to source directory (e.g., /path/to/repo/Home)
	TargetRoot string // Target root (e.g., $HOME or /)
	TargetName string // "System" or "Home"
}

LayerSource represents a repository layer with its path and precedence order.

Jump to

Keyboard shortcuts

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