execution

package
v0.1.0-dev.20260214154750 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package execution provides the core execution graph primitives and executor shared by writ (configuration deployment) and lore (package management).

Core Types

  • Graph: A directed graph of nodes and edges representing work to be done
  • Node: A single unit of work with operations to execute
  • Edge: A dependency relationship between nodes

Execution Model

  • GraphBuilder: Interface for building graphs (implementations in tools)
  • GraphExecutor: Runs graphs by executing operations on nodes
  • OperationRegistry: Maps operation names to implementations

Operations

Each operation implements Operation.Execute(ctx, node). Content ops use ctx.ContentFor(node) and ctx.StoreContent(node, data) internally.

Graph Lifecycle

The Graph represents both plans (before execution) and receipts (after execution):

  • Before Run(): State is "pending", nodes describe what will happen
  • After Run(): State is "executed", nodes describe what happened
  • Serialized before execution: "dry-run" or "purchase order"
  • Serialized after execution: "receipt"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChecksumBytes

func ChecksumBytes(content []byte) string

ChecksumBytes computes SHA256 of content and returns "sha256:<hex>".

func ChecksumFile

func ChecksumFile(path string) string

ChecksumFile computes SHA256 of a file and returns "sha256:<hex>". Returns empty string if the file cannot be read.

func ExpandDelegates

func ExpandDelegates(ctx context.Context, graph *Graph, builder SubgraphBuilder, opts BuildOptions) error

ExpandDelegates replaces delegate nodes in the graph with subgraphs produced by the given builder. Delegate nodes are identified by having "delegate" as their sole operation.

The expanded subgraph's nodes and edges are appended to the parent graph. An ordering edge is added from the delegate node to each root node of the subgraph.

The original delegate node is removed from the graph after expansion.

func GitStyleChecksum

func GitStyleChecksum(objectType, basename string, content []byte) string

GitStyleChecksum computes a git-style checksum. Format: SHA256("<type> <basename> <len>\0<content>") Returns format "sha256:<hex>".

Types

type Attempt

type Attempt struct {
	// Number is the 1-based attempt number.
	Number int `json:"number" yaml:"number"`

	// Status is "completed" or "failed".
	Status string `json:"status" yaml:"status"`

	// Error is the error message if the attempt failed.
	Error string `json:"error,omitempty" yaml:"error,omitempty"`

	// Timestamp is when this attempt completed (RFC3339).
	Timestamp string `json:"timestamp" yaml:"timestamp"`
}

Attempt records one execution attempt of a phase.

type BackoffStrategy

type BackoffStrategy string

BackoffStrategy defines how delays increase between retries.

const (
	BackoffNone        BackoffStrategy = "none"
	BackoffLinear      BackoffStrategy = "linear"
	BackoffExponential BackoffStrategy = "exponential"
)

type BuildOptions

type BuildOptions struct {
	// DryRun prevents the builder from making filesystem queries with side effects.
	DryRun bool

	// Features lists enabled features (e.g., "rootless", "compose").
	Features []string

	// Data holds tool context: platform info, environment, segments.
	Data map[string]any
}

BuildOptions configures subgraph building behavior.

type Collision

type Collision struct {
	Target            string `json:"target" yaml:"target"`
	Winner            string `json:"winner" yaml:"winner"`
	WinnerLayer       string `json:"winner_layer,omitempty" yaml:"winner_layer,omitempty"`
	WinnerSpecificity int    `json:"winner_specificity,omitempty" yaml:"winner_specificity,omitempty"`
	Loser             string `json:"loser" yaml:"loser"`
	LoserLayer        string `json:"loser_layer,omitempty" yaml:"loser_layer,omitempty"`
	LoserSpecificity  int    `json:"loser_specificity,omitempty" yaml:"loser_specificity,omitempty"`
}

Collision records a source conflict resolved during tree building (writ-specific).

type Conflict

type Conflict struct {
	Node         *Node
	Type         ConflictType
	ExistingPath string // For symlinks, where it points
	Message      string
}

Conflict represents a pre-flight detected conflict.

type ConflictResolution

type ConflictResolution int

ConflictResolution specifies how to handle conflicts during execution.

const (
	// ResolutionStop aborts execution on first conflict.
	ResolutionStop ConflictResolution = iota
	// ResolutionBackup moves conflicting files to timestamped backups.
	ResolutionBackup
	// ResolutionOverwrite removes conflicting files without backup.
	ResolutionOverwrite
	// ResolutionSkip skips conflicting files and continues.
	ResolutionSkip
)

type ConflictType

type ConflictType int

ConflictType describes the kind of conflict at a target path.

const (
	// ConflictNone indicates no conflict exists.
	ConflictNone ConflictType = iota
	// ConflictRegularFile indicates a regular file exists at target.
	ConflictRegularFile
	// ConflictDirectory indicates a directory exists at target.
	ConflictDirectory
	// ConflictForeignSymlink indicates a symlink pointing elsewhere exists.
	ConflictForeignSymlink
	// ConflictOurSymlink indicates our symlink already exists (no action needed).
	ConflictOurSymlink
)

type Context

type Context struct {
	context.Context

	// DryRun prevents filesystem modifications when true.
	DryRun bool

	// Logger receives operation output messages.
	Logger io.Writer

	// Data holds tool-provided context: template variables, SOPS config,
	// identities, segment maps, etc. Each tool populates this before
	// calling GraphExecutor.Run().
	Data map[string]any

	// Content pipeline (set by executor before each execution loop).
	Edges   []Edge
	Outputs map[string][]byte

	// Per-node checksums (written by ops, read by executor).
	SourceChecksum string
	TargetChecksum string
}

Context provides execution context to operations.

func (*Context) ContentFor

func (c *Context) ContentFor(node *Node) ([]byte, error)

ContentFor resolves input content for a node. It checks the upstream chain via edges first, then falls back to reading the source file.

func (*Context) StoreContent

func (c *Context) StoreContent(node *Node, data []byte)

StoreContent stores output content for a node so downstream nodes can read it.

type DependencyView

type DependencyView struct {
	// contains filtered or unexported fields
}

DependencyView provides dependency analysis for a single execution graph. It indexes the graph's edges to enable efficient dependency queries.

func NewDependencyView

func NewDependencyView(g *Graph) *DependencyView

NewDependencyView creates a DependencyView for the given graph.

func (*DependencyView) AllDependencies

func (v *DependencyView) AllDependencies(nodeID string) []string

AllDependencies returns the transitive closure of dependencies for a node. This includes all nodes that must complete before this node can start.

func (*DependencyView) AllDependents

func (v *DependencyView) AllDependents(nodeID string) []string

AllDependents returns the transitive closure of dependents for a node. This includes all nodes that directly or indirectly depend on this node.

func (*DependencyView) CriticalPath

func (v *DependencyView) CriticalPath() []string

CriticalPath returns the longest dependency chain in the graph. This represents the minimum sequential execution path.

func (*DependencyView) Dependents

func (v *DependencyView) Dependents(nodeID string) []string

Dependents returns the direct dependents of a node (nodes that wait for this one).

func (*DependencyView) DependsOn

func (v *DependencyView) DependsOn(nodeID string) []string

DependsOn returns the direct dependencies of a node (nodes that must complete first).

func (*DependencyView) EdgeCount

func (v *DependencyView) EdgeCount() int

EdgeCount returns the number of edges in the graph.

func (*DependencyView) Graph

func (v *DependencyView) Graph() *Graph

Graph returns the underlying graph.

func (*DependencyView) HasCycle

func (v *DependencyView) HasCycle() bool

HasCycle returns true if the graph contains a cycle.

func (*DependencyView) IndependentSets

func (v *DependencyView) IndependentSets() [][]string

IndependentSets returns groups of nodes that have no dependencies between them. Each set can be executed fully in parallel with other sets.

func (*DependencyView) Leaves

func (v *DependencyView) Leaves() []string

Leaves returns nodes with no dependents (final nodes in the graph).

func (*DependencyView) Node

func (v *DependencyView) Node(id string) *Node

Node returns the node with the given ID, or nil if not found.

func (*DependencyView) NodeCount

func (v *DependencyView) NodeCount() int

NodeCount returns the number of nodes in the graph.

func (*DependencyView) ParallelLevels

func (v *DependencyView) ParallelLevels() [][]string

ParallelLevels returns nodes grouped by execution level. Level 0 contains roots (can execute immediately). Level N contains nodes whose dependencies are all in levels < N. Within each level, nodes can execute in parallel.

func (*DependencyView) PathBetween

func (v *DependencyView) PathBetween(source, target string) []string

PathBetween returns the shortest path from source to target, or nil if none exists.

func (*DependencyView) Roots

func (v *DependencyView) Roots() []string

Roots returns nodes with no dependencies (can execute immediately).

func (*DependencyView) Subgraph

func (v *DependencyView) Subgraph(nodeIDs []string) *DependencyView

Subgraph returns a new DependencyView containing only the specified nodes and the edges between them.

func (*DependencyView) TopologicalOrder

func (v *DependencyView) TopologicalOrder() []string

TopologicalOrder returns nodes in a valid execution order. Nodes appear after all their dependencies. Returns nil if the graph has a cycle.

type Edge

type Edge struct {
	From string `json:"from" yaml:"from"`
	To   string `json:"to" yaml:"to"`
}

Edge represents a dependency relationship between two nodes. From must complete before To can begin execution.

type Encoder

type Encoder interface {
	Encode(v any) error
}

Encoder is the interface for graph serialization. Both *json.Encoder and *yaml.Encoder satisfy this interface.

type EncryptionDecryptOp

type EncryptionDecryptOp struct {
	// contains filtered or unexported fields
}

EncryptionDecryptOp decrypts content using the configured decryptor (transformer: reads content, stores decrypted result).

func (*EncryptionDecryptOp) Execute

func (o *EncryptionDecryptOp) Execute(ctx *Context, node *Node) error

func (*EncryptionDecryptOp) Name

func (o *EncryptionDecryptOp) Name() string

type EncryptionService

type EncryptionService struct{}

EncryptionService provides encryption and decryption operations. The actual crypto backend (SOPS, age, etc.) is injected via function parameters, keeping this service independent of specific libraries.

func (*EncryptionService) Decrypt

func (e *EncryptionService) Decrypt(decryptor func(string, []byte) ([]byte, error), source string, content []byte) ([]byte, error)

Decrypt decrypts content using the provided decryptor function. The source path enables format detection (e.g., .sops.yaml vs .age). Returns the decrypted bytes.

type EntryType

type EntryType string

EntryType distinguishes between package and file entries.

const (
	// EntryPackage represents a lore package lifecycle entry.
	EntryPackage EntryType = "package"
	// EntryFile represents a project file entry (link/copy/expand/decrypt).
	EntryFile EntryType = "file"
)

type ExecutorOptions

type ExecutorOptions struct {
	// DryRun prevents filesystem modifications.
	DryRun bool

	// Logger receives operation output.
	Logger io.Writer

	// Data holds tool-provided context (template vars, SOPS config, etc.).
	Data map[string]any

	// ConflictResolution specifies how to handle conflicts detected during preflight.
	ConflictResolution ConflictResolution

	// BackupSuffix is appended to backup filenames (default: ".writ-backup").
	BackupSuffix string
}

ExecutorOptions configures GraphExecutor behavior.

type FileBackupOp

type FileBackupOp struct {
	// contains filtered or unexported fields
}

FileBackupOp moves the existing file at node's "path" slot to a timestamped backup. The backup path is stored in node.Annotations["backup_path"] after execution.

func (*FileBackupOp) Execute

func (o *FileBackupOp) Execute(ctx *Context, node *Node) error

func (*FileBackupOp) Name

func (o *FileBackupOp) Name() string

type FileCopyOp

type FileCopyOp struct {
	// contains filtered or unexported fields
}

FileCopyOp writes content to node's "path" slot (consumer: reads content, checksums).

func (*FileCopyOp) Execute

func (o *FileCopyOp) Execute(ctx *Context, node *Node) error

func (*FileCopyOp) Name

func (o *FileCopyOp) Name() string

type FileEntry

type FileEntry struct {
	// Target is the relative target path (e.g., ".bashrc").
	Target string `json:"target" yaml:"target"`

	// Source is the absolute source path.
	Source string `json:"source" yaml:"source"`

	// Project this file belongs to.
	Project string `json:"project" yaml:"project"`

	// Layer is the repository layer (base, team, personal).
	Layer string `json:"layer,omitempty" yaml:"layer,omitempty"`

	// History of deployment operations, ordered by time.
	History []HistoryRecord `json:"history" yaml:"history"`
}

FileEntry represents a project file's deployment history.

func (*FileEntry) IsCopied

func (e *FileEntry) IsCopied() bool

IsCopied returns true if the latest operation was a copy (not symlink).

func (*FileEntry) IsLinked

func (e *FileEntry) IsLinked() bool

IsLinked returns true if the latest operation was a symlink.

func (*FileEntry) LastOp

func (e *FileEntry) LastOp() string

LastOp returns the operation from the latest deployment.

func (*FileEntry) LastOperation

func (e *FileEntry) LastOperation() *HistoryRecord

LastOperation returns the most recent operation, or nil if no history.

func (*FileEntry) SourceChecksum

func (e *FileEntry) SourceChecksum() string

SourceChecksum returns the source checksum from the latest operation.

func (*FileEntry) TargetChecksum

func (e *FileEntry) TargetChecksum() string

TargetChecksum returns the target checksum from the latest operation.

type FileLinkOp

type FileLinkOp struct {
	// contains filtered or unexported fields
}

FileLinkOp creates a symlink from node's "path" slot pointing to "source" slot.

func (*FileLinkOp) Execute

func (o *FileLinkOp) Execute(ctx *Context, node *Node) error

func (*FileLinkOp) Name

func (o *FileLinkOp) Name() string

type FileMoveOp

type FileMoveOp struct {
	// contains filtered or unexported fields
}

FileMoveOp moves a file from node's "source" slot to "path" slot.

func (*FileMoveOp) Execute

func (o *FileMoveOp) Execute(ctx *Context, node *Node) error

func (*FileMoveOp) Name

func (o *FileMoveOp) Name() string

type FileRemoveOp

type FileRemoveOp struct {
	// contains filtered or unexported fields
}

FileRemoveOp deletes the file at node's "path" slot.

func (*FileRemoveOp) Execute

func (o *FileRemoveOp) Execute(ctx *Context, node *Node) error

func (*FileRemoveOp) Name

func (o *FileRemoveOp) Name() string

type FileRenderOp

type FileRenderOp struct {
	// contains filtered or unexported fields
}

FileRenderOp processes content as a Go text/template (transformer: reads content, stores result).

func (*FileRenderOp) Execute

func (o *FileRenderOp) Execute(ctx *Context, node *Node) error

func (*FileRenderOp) Name

func (o *FileRenderOp) Name() string

type FileService

type FileService struct{}

FileService provides file system operations. Each method receives all inputs as parameters — no execution context, no node access. These methods are the source of truth for the code generator.

func (*FileService) Backup

func (f *FileService) Backup(path, backupSuffix string) (string, error)

Backup moves the file at path to a timestamped backup location. Returns the backup path.

func (*FileService) Copy

func (f *FileService) Copy(path string, mode os.FileMode, content []byte) (string, error)

Copy writes content to path with the given mode. Returns the SHA256 checksum of the written content.

func (f *FileService) Link(source, path string) error

Link creates a symlink at path pointing to source. Idempotent: if the symlink already points correctly, it's a no-op.

func (*FileService) Move

func (f *FileService) Move(gitMv func(src, dst string) error, source, path string) error

Move moves a file from source to path. Uses gitMv if provided (preserves git history), falling back to os.Rename.

func (*FileService) Remove

func (f *FileService) Remove(path string, prune bool, pruneBoundary string) error

Remove deletes the file at path. If prune is true and pruneBoundary is set, empty parent directories are removed up to the boundary.

func (*FileService) Render

func (f *FileService) Render(templateData map[string]any, source, path, project string, content []byte) ([]byte, error)

Render processes content as a Go text/template. Returns the rendered bytes.

func (f *FileService) Unlink(path string, prune bool, pruneBoundary string) error

Unlink removes a symlink at path. If prune is true and pruneBoundary is set, empty parent directories are removed up to the boundary.

func (*FileService) Write

func (f *FileService) Write(content, path string, mode os.FileMode) error

Write writes inline content to path with the given mode.

type FileTree

type FileTree struct {
	// Root is the target root path (e.g., $HOME).
	Root string `json:"root" yaml:"root"`

	// Entries provides flat lookup by relative target path.
	Entries map[string]*FileEntry `json:"entries" yaml:"entries"`

	// Tree is the hierarchical view.
	Tree *FileTreeNode `json:"tree" yaml:"tree"`
}

FileTree provides both flat and hierarchical access to files.

func (*FileTree) CopiedFiles

func (t *FileTree) CopiedFiles() map[string]*FileEntry

CopiedFiles returns all entries that were copied (not symlinked).

func (*FileTree) ForProject

func (t *FileTree) ForProject(project string) map[string]*FileEntry

ForProject returns all file entries for a specific project.

func (*FileTree) LinkedFiles

func (t *FileTree) LinkedFiles() map[string]*FileEntry

LinkedFiles returns all entries that are symlinks.

func (*FileTree) Projects

func (t *FileTree) Projects() []string

Projects returns a list of all projects with files in the tree.

type FileTreeNode

type FileTreeNode struct {
	// Name is the filename or directory name.
	Name string `json:"name" yaml:"name"`

	// IsDir is true if this is a directory.
	IsDir bool `json:"is_dir" yaml:"is_dir"`

	// Entry is the file entry (nil for directories).
	Entry *FileEntry `json:"entry,omitempty" yaml:"entry,omitempty"`

	// Children are the child nodes (nil for files).
	Children map[string]*FileTreeNode `json:"children,omitempty" yaml:"children,omitempty"`
}

FileTreeNode represents a node in the target filesystem tree.

type FileUnlinkOp

type FileUnlinkOp struct {
	// contains filtered or unexported fields
}

FileUnlinkOp removes a symlink at node's "path" slot.

func (*FileUnlinkOp) Execute

func (o *FileUnlinkOp) Execute(ctx *Context, node *Node) error

func (*FileUnlinkOp) Name

func (o *FileUnlinkOp) Name() string

type FileWriteOp

type FileWriteOp struct {
	// contains filtered or unexported fields
}

FileWriteOp writes content from node's "content" slot to node's "path" slot.

func (*FileWriteOp) Execute

func (o *FileWriteOp) Execute(ctx *Context, node *Node) error

func (*FileWriteOp) Name

func (o *FileWriteOp) Name() string

type Graph

type Graph struct {
	// Version is the graph format version.
	Version string `json:"version" yaml:"version"`

	// Tool identifies which tool created this graph ("writ" or "lore").
	Tool string `json:"tool" yaml:"tool"`

	// Timestamp is when the graph was created/executed.
	Timestamp time.Time `json:"timestamp" yaml:"timestamp"`

	// State is the execution state (pending, executed, failed).
	State GraphState `json:"state" yaml:"state"`

	// Platform records the OS and architecture.
	Platform Platform `json:"platform" yaml:"platform"`

	// Context contains tool-specific metadata.
	Context GraphContext `json:"context" yaml:"context"`

	// Nodes are the operations to perform/performed.
	Nodes []*Node `json:"nodes" yaml:"nodes"`

	// Edges are the dependencies between nodes.
	Edges []Edge `json:"edges,omitempty" yaml:"edges,omitempty"`

	// Phases defines the ordered lifecycle phases (nil for non-phased graphs).
	// When present, the executor uses phase-aware execution with retry and rollback.
	// When nil, the executor falls back to flat node execution.
	Phases []*Phase `json:"phases,omitempty" yaml:"phases,omitempty"`

	// Collisions records source conflicts resolved during tree building (writ-specific).
	Collisions []Collision `json:"collisions,omitempty" yaml:"collisions,omitempty"`

	// Summary contains execution statistics (populated after Run).
	Summary Summary `json:"summary,omitempty" yaml:"summary,omitempty"`

	// Rollback records compensating actions executed during rollback (populated on failure).
	Rollback []RollbackEntry `json:"rollback,omitempty" yaml:"rollback,omitempty"`

	// Checksum is the git-style integrity hash.
	Checksum string `json:"checksum,omitempty" yaml:"checksum,omitempty"`

	// Signature contains the cryptographic signature (optional).
	Signature *Signature `json:"signature,omitempty" yaml:"signature,omitempty"`
}

Graph represents an execution graph containing nodes and edges. This is THE graph used by both writ and lore - they differ only in content.

Before Run(): State is "pending", represents the plan After Run(): State is "executed", represents the receipt

func (*Graph) ApplyResults

func (g *Graph) ApplyResults(results []*Result)

ApplyResults updates node states from execution results.

func (*Graph) CanonicalContent

func (g *Graph) CanonicalContent() ([]byte, error)

CanonicalContent returns the graph serialized as YAML without checksum and signature. This is used for computing checksums and verifying signatures.

func (*Graph) ComputeSummary

func (g *Graph) ComputeSummary()

ComputeSummary calculates summary statistics from nodes. For phased graphs, node statuses reflect the phase execution outcome (nodes in rolled-back phases may show as completed from before rollback).

func (*Graph) Filename

func (g *Graph) Filename() string

Filename returns the standard filename for this graph. Format: "<tool>-<timestamp>.yaml"

func (*Graph) PhaseByID

func (g *Graph) PhaseByID(id string) *Phase

PhaseByID returns the phase with the given ID, or nil if not found.

func (*Graph) Serialize

func (g *Graph) Serialize(enc Encoder) error

Serialize writes the graph to the given encoder. The checksum is computed before encoding.

Usage:

enc := yaml.NewEncoder(file)
enc.SetIndent(2)
defer enc.Close()
g.Serialize(enc)

type GraphBuilder

type GraphBuilder interface {
	// Build creates an execution graph.
	// Implementations hold their configuration internally (set at construction).
	Build(ctx context.Context) (*Graph, error)
}

GraphBuilder is the interface for building execution graphs. Implementations are provided by tools (writ, lore) and create graphs from their respective inputs (file trees, package manifests, etc.).

type GraphContext

type GraphContext struct {
	// SourceRoot is the source directory (writ: repo path, lore: registry cache).
	SourceRoot string `json:"source_root,omitempty" yaml:"source_root,omitempty"`

	// TargetRoot is the target directory (typically $HOME).
	TargetRoot string `json:"target_root,omitempty" yaml:"target_root,omitempty"`

	// Projects lists the projects included (writ-specific).
	Projects []string `json:"projects,omitempty" yaml:"projects,omitempty"`

	// Packages lists the packages included (lore-specific).
	Packages []string `json:"packages,omitempty" yaml:"packages,omitempty"`

	// Segments contains platform segment values (writ-specific).
	Segments map[string]string `json:"segments,omitempty" yaml:"segments,omitempty"`

	// Layers lists repository layers used (writ-specific).
	Layers []string `json:"layers,omitempty" yaml:"layers,omitempty"`

	// Platform is the target platform string (lore-specific, e.g., "Darwin", "Linux.Debian").
	TargetPlatform string `json:"target_platform,omitempty" yaml:"target_platform,omitempty"`

	// Features enabled for package installation (lore-specific).
	Features []string `json:"features,omitempty" yaml:"features,omitempty"`

	// Settings for package installation (lore-specific).
	Settings map[string]string `json:"settings,omitempty" yaml:"settings,omitempty"`
}

GraphContext contains tool-specific metadata stored in the graph. Both writ and lore populate this with their relevant context.

type GraphExecutor

type GraphExecutor struct {
	// contains filtered or unexported fields
}

GraphExecutor executes operation graphs.

func NewGraphExecutor

func NewGraphExecutor(registry *OperationRegistry, opts ExecutorOptions) *GraphExecutor

NewGraphExecutor creates an executor with the given registry and options.

func (*GraphExecutor) ExecutePhaseInner

func (e *GraphExecutor) ExecutePhaseInner(ctx *Context, g *Graph, phase *Phase) error

ExecutePhaseInner runs all inner nodes of a phase using the executor. It extracts the phase's nodes from the graph and runs them in topological order. Any node failure immediately fails the phase.

func (*GraphExecutor) Run

func (e *GraphExecutor) Run(ctx context.Context, g *Graph) error

Run executes all nodes in the graph, respecting ordering constraints. When the graph has phases, execution is delegated to RunPhased which implements the saga pattern with retry and rollback. Otherwise, nodes are processed in topological order (flat execution).

func (*GraphExecutor) RunNodes

func (e *GraphExecutor) RunNodes(ctx context.Context, nodes []*Node, edges []Edge) ([]*Result, error)

RunNodes executes a slice of nodes with the given edges. This is a lower-level API for callers that don't have a full Graph.

func (*GraphExecutor) RunPhased

func (e *GraphExecutor) RunPhased(ctx context.Context, g *Graph) error

RunPhased executes a phased graph using the saga pattern. Phases are executed in order. Each phase runs its inner nodes via topological sort. On failure, completed phases are compensated in LIFO order (rollback).

Phases referenced as compensating actions (via Compensate fields) are skipped during the forward pass — they execute only during rollback.

type GraphState

type GraphState string

GraphState represents the execution state of the graph.

const (
	StatePending  GraphState = "pending"
	StateExecuted GraphState = "executed"
	StateFailed   GraphState = "failed"
)

type HistoryRecord

type HistoryRecord struct {
	// Timestamp is when this operation occurred.
	Timestamp time.Time `json:"timestamp" yaml:"timestamp"`

	// Receipt is the filename of the receipt that recorded this.
	Receipt string `json:"receipt" yaml:"receipt"`

	// Tool is which tool created this record ("lore" or "writ").
	Tool string `json:"tool" yaml:"tool"`

	// Operation performed: link, copy, render, decrypt, install, etc.
	Operation string `json:"operation" yaml:"operation"`

	// Status of this operation: completed, skipped, failed.
	Status NodeStatus `json:"status" yaml:"status"`

	// SourceChecksum is the SHA256 of the source at operation time.
	SourceChecksum string `json:"source_checksum,omitempty" yaml:"source_checksum,omitempty"`

	// TargetChecksum is the SHA256 of the target after operation.
	TargetChecksum string `json:"target_checksum,omitempty" yaml:"target_checksum,omitempty"`
}

HistoryRecord represents a single operation on an entry from a receipt.

type Node

type Node struct {
	// ID is the unique identifier (typically relative target path or package name).
	ID string `json:"id" yaml:"id"`

	// Operation to perform: link, copy, render, decrypt, install, etc.
	Operation string `json:"operation" yaml:"operation"`

	// Status of this node: pending, completed, skipped, failed.
	Status NodeStatus `json:"status" yaml:"status"`

	// Timestamp is when this operation completed.
	Timestamp string `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`

	// Slots holds input values for this node. Each slot can be:
	// - Immediate: value known at analysis time
	// - Promise: reference to another node's output (creates edge)
	Slots map[string]SlotValue `json:"slots,omitempty" yaml:"slots,omitempty"`

	// Project this node belongs to.
	Project string `json:"project,omitempty" yaml:"project,omitempty"`

	// Layer is the repository layer (base, team, personal).
	Layer string `json:"layer,omitempty" yaml:"layer,omitempty"`

	// Mode is the file permissions to set.
	Mode os.FileMode `json:"-" yaml:"-"`

	// SourceChecksum is the SHA256 of the source file at deploy time.
	SourceChecksum string `json:"source_checksum,omitempty" yaml:"source_checksum,omitempty"`

	// TargetChecksum is the SHA256 of the target file after deployment.
	TargetChecksum string `json:"target_checksum,omitempty" yaml:"target_checksum,omitempty"`

	// Error message if status is failed.
	Error string `json:"error,omitempty" yaml:"error,omitempty"`

	// Annotations holds extensible metadata (serialized to receipts).
	Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}

Node represents a single unit of work in an execution graph.

func (*Node) GetID

func (n *Node) GetID() string

GetID returns the node's unique identifier.

func (*Node) GetMode

func (n *Node) GetMode() os.FileMode

GetMode returns the file mode.

func (*Node) GetOperation

func (n *Node) GetOperation() string

GetOperation returns the operation to perform.

func (*Node) GetProject

func (n *Node) GetProject() string

GetProject returns the project name.

func (*Node) GetSlot

func (n *Node) GetSlot(name string) any

GetSlot returns the resolved value of a slot. If the slot is a promise, returns nil (must be resolved by executor).

func (*Node) RequireStringSlot

func (n *Node) RequireStringSlot(name string) (string, error)

RequireStringSlot returns the string value of a required slot. Returns an error if the slot is not set, or holds a non-string value. An empty string is valid — use GetSlot for optional slots where zero value is acceptable.

func (*Node) SetSlotImmediate

func (n *Node) SetSlotImmediate(name string, value any)

SetSlotImmediate sets a slot to an immediate value.

func (*Node) SetSlotPromise

func (n *Node) SetSlotPromise(name, nodeRef, slot string)

SetSlotPromise sets a slot to a promise (reference to another node).

type NodeStatus

type NodeStatus string

NodeStatus represents the execution status of a node.

const (
	StatusPending   NodeStatus = "pending"
	StatusCompleted NodeStatus = "completed"
	StatusSkipped   NodeStatus = "skipped"
	StatusFailed    NodeStatus = "failed"
)

type Operation

type Operation interface {
	// Name returns the operation identifier (e.g., "file.link", "file.decrypt").
	Name() string

	// Execute performs the operation using context and node state.
	Execute(ctx *Context, node *Node) error
}

Operation is the interface for all executable actions. Each operation is self-contained: it reads its own inputs via ctx and node, performs its work, and stores any outputs back on ctx.

func AllOps

func AllOps() []Operation

AllOps returns all operations for registration. Both writ and lore use this to ensure the same operations are available.

func EncryptionOps

func EncryptionOps(impl *EncryptionService) []Operation

EncryptionOps returns all encryption operations backed by the given EncryptionService.

func FileOps

func FileOps(impl *FileService) []Operation

FileOps returns all file operations backed by the given FileService.

func PackageOps

func PackageOps(impl *PackageService) []Operation

PackageOps returns all package operations backed by the given PackageService.

func ServiceManagerOps

func ServiceManagerOps(impl *ServiceManagerService) []Operation

ServiceManagerOps returns all service manager operations backed by the given ServiceManagerService.

func ShellOps

func ShellOps(impl *ShellService) []Operation

ShellOps returns all shell operations backed by the given ShellService.

type OperationRegistry

type OperationRegistry struct {
	// contains filtered or unexported fields
}

OperationRegistry maps operation names to their implementations. Each tool registers its operations before calling GraphExecutor.Run().

func NewOperationRegistry

func NewOperationRegistry() *OperationRegistry

NewOperationRegistry creates an empty operation registry.

func (*OperationRegistry) Get

func (r *OperationRegistry) Get(name string) (Operation, bool)

Get returns the operation registered under the given name.

func (*OperationRegistry) Names

func (r *OperationRegistry) Names() []string

Names returns all registered operation names.

func (*OperationRegistry) Register

func (r *OperationRegistry) Register(op Operation)

Register adds an operation to the registry. If an operation with the same name already exists, it is replaced.

type PackageEntry

type PackageEntry struct {
	// Name is the package name (e.g., "docker").
	Name string `json:"name" yaml:"name"`

	// History of lifecycle operations, ordered by time.
	History []HistoryRecord `json:"history" yaml:"history"`
}

PackageEntry represents a lore package's lifecycle history.

func (*PackageEntry) LastOperation

func (e *PackageEntry) LastOperation() *HistoryRecord

LastOperation returns the most recent operation, or nil if no history.

type PackageInstallOp

type PackageInstallOp struct {
	// contains filtered or unexported fields
}

PackageInstallOp installs packages using the platform's package manager.

func (*PackageInstallOp) Execute

func (o *PackageInstallOp) Execute(ctx *Context, node *Node) error

func (*PackageInstallOp) Name

func (o *PackageInstallOp) Name() string

type PackageRemoveOp

type PackageRemoveOp struct {
	// contains filtered or unexported fields
}

PackageRemoveOp removes packages using the platform's package manager.

func (*PackageRemoveOp) Execute

func (o *PackageRemoveOp) Execute(ctx *Context, node *Node) error

func (*PackageRemoveOp) Name

func (o *PackageRemoveOp) Name() string

type PackageService

type PackageService struct{}

PackageService provides platform-independent package management. The package manager is resolved at runtime via host.PackageManager().

func (*PackageService) Install

func (p *PackageService) Install(packages []string, manager string, cask bool) error

Install installs packages using the platform's package manager.

func (*PackageService) Remove

func (p *PackageService) Remove(packages []string, manager string, cask bool) error

Remove removes packages using the platform's package manager.

func (*PackageService) Update

func (p *PackageService) Update(manager string) error

Update refreshes the package manager index.

func (*PackageService) Upgrade

func (p *PackageService) Upgrade(packages []string, manager string, cask bool) error

Upgrade upgrades packages using the platform's package manager.

type PackageUpdateOp

type PackageUpdateOp struct {
	// contains filtered or unexported fields
}

PackageUpdateOp refreshes the package manager index.

func (*PackageUpdateOp) Execute

func (o *PackageUpdateOp) Execute(ctx *Context, node *Node) error

func (*PackageUpdateOp) Name

func (o *PackageUpdateOp) Name() string

type PackageUpgradeOp

type PackageUpgradeOp struct {
	// contains filtered or unexported fields
}

PackageUpgradeOp upgrades packages using the platform's package manager.

func (*PackageUpgradeOp) Execute

func (o *PackageUpgradeOp) Execute(ctx *Context, node *Node) error

func (*PackageUpgradeOp) Name

func (o *PackageUpgradeOp) Name() string

type Phase

type Phase struct {
	// ID is the unique identifier (e.g., "phase.install").
	ID string `json:"id" yaml:"id"`

	// Name is the phase name (e.g., "install").
	Name string `json:"name" yaml:"name"`

	// Status of this phase: pending, completed, failed, rolled_back, skipped.
	Status PhaseStatus `json:"status" yaml:"status"`

	// Retry governs retry behavior when inner nodes fail.
	Retry *RetryPolicy `json:"retry,omitempty" yaml:"retry,omitempty"`

	// NodeIDs lists the IDs of inner nodes belonging to this phase.
	NodeIDs []string `json:"nodes,omitempty" yaml:"nodes,omitempty"`

	// Compensate is the ID of the compensating action for rollback.
	Compensate string `json:"compensate,omitempty" yaml:"compensate,omitempty"`

	// Attempts records retry history (populated during execution).
	Attempts []Attempt `json:"attempts,omitempty" yaml:"attempts,omitempty"`

	// State holds execution metadata captured during the forward action.
	// The compensating action reads this to know what to undo.
	State map[string]any `json:"state,omitempty" yaml:"state,omitempty"`
}

Phase represents a lifecycle phase in the execution graph. Each phase owns a set of inner nodes and acts as an error boundary with retry and compensating action support (the Saga Pattern).

type PhaseStatus

type PhaseStatus string

PhaseStatus represents the execution state of a phase.

const (
	PhasePending    PhaseStatus = "pending"
	PhaseCompleted  PhaseStatus = "completed"
	PhaseFailed     PhaseStatus = "failed"
	PhaseRolledBack PhaseStatus = "rolled_back"
	PhaseSkipped    PhaseStatus = "skipped"
)

type Plan

type Plan struct {
	// contains filtered or unexported fields
}

Plan provides binding functions for building an execution graph. Graph producers (writ tree builder, lore pipeline executor, LLM graph builder) use Plan to add operations to the graph. Each method returns the created node for edge construction.

In Starlark scripts, the plan object is passed to each phase function:

def install(system, package, plan):
    plan.mkdir("/usr/local/bin")
    plan.link("/usr/local/bin/foo", source="/path/to/foo")

func NewPlan

func NewPlan(project string) *Plan

NewPlan creates a new plan for building an execution graph.

func (*Plan) Backup

func (p *Plan) Backup(path string) *Node

Backup adds a backup operation for an existing file.

func (*Plan) Copy

func (p *Plan) Copy(source, path string, transforms ...string) *Node

Copy adds a file copy operation. Transforms (decrypt, render) create a chain of nodes connected by edges, with content flowing between them.

func (*Plan) CopyWithMode

func (p *Plan) CopyWithMode(source, path string, mode os.FileMode, transforms ...string) *Node

CopyWithMode adds a file copy operation with explicit permissions.

func (*Plan) DependsOn

func (p *Plan) DependsOn(from, to *Node)

DependsOn adds an ordering edge: from must complete before to begins.

func (*Plan) Graph

func (p *Plan) Graph() *Graph

Graph returns the built execution graph.

func (p *Plan) Link(source, path string) *Node

Link adds a symlink creation operation.

func (*Plan) Mkdir

func (p *Plan) Mkdir(path string) *Node

Mkdir adds a directory creation operation.

func (*Plan) Orders

func (p *Plan) Orders(from, to *Node)

Orders adds an ordering constraint between nodes.

func (*Plan) Remove

func (p *Plan) Remove(path string) *Node

Remove adds a file/directory removal operation.

func (*Plan) Rename

func (p *Plan) Rename(source, path string) *Node

Rename adds a file/directory move operation (git mv when possible).

func (p *Plan) Unlink(path string) *Node

Unlink adds a symlink removal operation.

func (*Plan) Validate

func (p *Plan) Validate(check, message string) *Node

Validate adds a precondition check operation.

type Platform

type Platform struct {
	OS   string `json:"os" yaml:"os"`
	Arch string `json:"arch" yaml:"arch"`
}

Platform records the OS and architecture.

type PowerShellOp

type PowerShellOp struct {
	// contains filtered or unexported fields
}

PowerShellOp executes a PowerShell command from node's "command" slot (Windows).

func (*PowerShellOp) Execute

func (o *PowerShellOp) Execute(ctx *Context, node *Node) error

func (*PowerShellOp) Name

func (o *PowerShellOp) Name() string

type PreflightResult

type PreflightResult struct {
	Conflicts   []Conflict
	AlreadyDone []Conflict // Symlinks that already point correctly
	Ready       []*Node    // Nodes ready to deploy (no conflict)
}

PreflightResult contains the results of pre-flight conflict detection.

func Preflight

func Preflight(graph *Graph) *PreflightResult

Preflight performs pre-flight conflict detection without modifying anything. Only applies to nodes with file operations (link, copy).

func (*PreflightResult) HasConflicts

func (p *PreflightResult) HasConflicts() bool

HasConflicts returns true if any conflicts were detected.

type RecoveryEntry

type RecoveryEntry struct {
	// PhaseID is the unique identifier of the completed phase.
	PhaseID string

	// PhaseName is the human-readable phase name.
	PhaseName string

	// Compensate is the function to execute for rollback.
	// It receives the execution context and returns any error.
	Compensate func(ctx *Context) error

	// State holds the execution metadata captured during the forward action.
	// Passed to the compensating action so it knows what to undo.
	State map[string]any
}

RecoveryEntry represents a completed phase and its compensating action. The executor pushes entries as phases complete successfully, and pops them in LIFO order during rollback.

type RecoveryStack

type RecoveryStack struct {
	// contains filtered or unexported fields
}

RecoveryStack is a LIFO stack of recovery entries. The executor pushes entries as phases complete and unwinds (pops + executes compensating actions) on failure.

func (*RecoveryStack) Entries

func (s *RecoveryStack) Entries() []RecoveryEntry

Entries returns a copy of the stack entries (bottom to top). Used for inspection and serialization.

func (*RecoveryStack) Len

func (s *RecoveryStack) Len() int

Len returns the number of entries on the stack.

func (*RecoveryStack) Push

func (s *RecoveryStack) Push(entry RecoveryEntry)

Push adds a recovery entry to the top of the stack.

func (*RecoveryStack) Unwind

func (s *RecoveryStack) Unwind(ctx *Context) []error

Unwind executes all compensating actions in LIFO order. Returns a slice of errors from compensating actions that failed. Compensating action failures do not stop the unwind — all entries are processed regardless of individual failures.

type Result

type Result struct {
	NodeID         string
	Status         ResultStatus
	Error          error
	Message        string
	SourceChecksum string
	TargetChecksum string
}

Result represents the outcome of executing a single node.

type ResultStatus

type ResultStatus int

ResultStatus represents the execution status of a node.

const (
	// ResultPending means the node has not been processed yet.
	ResultPending ResultStatus = iota
	// ResultRunning means the node is currently executing.
	ResultRunning
	// ResultCompleted means the node executed successfully.
	ResultCompleted
	// ResultFailed means the node encountered an error.
	ResultFailed
	// ResultSkipped means the node was skipped (conflict, already deployed, etc.).
	ResultSkipped
)

func (ResultStatus) String

func (s ResultStatus) String() string

String returns a human-readable status label.

type RetryPolicy

type RetryPolicy struct {
	// MaxAttempts is the maximum number of retries (0 = no retry, fail immediately).
	MaxAttempts int `json:"max_attempts" yaml:"max_attempts"`

	// Backoff is the delay strategy: none, linear, exponential.
	Backoff BackoffStrategy `json:"backoff" yaml:"backoff"`

	// InitialDelay is the delay before the first retry (Go duration string, e.g. "1s").
	InitialDelay string `json:"initial_delay,omitempty" yaml:"initial_delay,omitempty"`

	// MaxDelay caps the delay between retries (Go duration string, e.g. "30s").
	MaxDelay string `json:"max_delay,omitempty" yaml:"max_delay,omitempty"`
}

RetryPolicy configures retry behavior for a phase.

func (*RetryPolicy) ComputeDelay

func (r *RetryPolicy) ComputeDelay(attempt int) time.Duration

ComputeDelay returns the delay for a given attempt number (0-based).

func (*RetryPolicy) ParseInitialDelay

func (r *RetryPolicy) ParseInitialDelay() time.Duration

ParseInitialDelay parses the InitialDelay string into a time.Duration. Returns 0 if the string is empty or unparseable.

func (*RetryPolicy) ParseMaxDelay

func (r *RetryPolicy) ParseMaxDelay() time.Duration

ParseMaxDelay parses the MaxDelay string into a time.Duration. Returns 0 if the string is empty or unparseable.

type RollbackEntry

type RollbackEntry struct {
	// Phase is the phase name that was rolled back.
	Phase string `json:"phase" yaml:"phase"`

	// Compensate is the ID of the compensating action.
	Compensate string `json:"compensate" yaml:"compensate"`

	// Status is "completed" or "failed".
	Status string `json:"status" yaml:"status"`

	// Error is the error message if the compensating action failed.
	Error string `json:"error,omitempty" yaml:"error,omitempty"`
}

RollbackEntry records a compensating action executed during rollback.

type ServiceManagerDisableOp

type ServiceManagerDisableOp struct {
	// contains filtered or unexported fields
}

ServiceManagerDisableOp disables a service from starting at boot.

func (*ServiceManagerDisableOp) Execute

func (o *ServiceManagerDisableOp) Execute(ctx *Context, node *Node) error

func (*ServiceManagerDisableOp) Name

func (o *ServiceManagerDisableOp) Name() string

type ServiceManagerEnableOp

type ServiceManagerEnableOp struct {
	// contains filtered or unexported fields
}

ServiceManagerEnableOp enables a service to start at boot.

func (*ServiceManagerEnableOp) Execute

func (o *ServiceManagerEnableOp) Execute(ctx *Context, node *Node) error

func (*ServiceManagerEnableOp) Name

func (o *ServiceManagerEnableOp) Name() string

type ServiceManagerRestartOp

type ServiceManagerRestartOp struct {
	// contains filtered or unexported fields
}

ServiceManagerRestartOp restarts a service.

func (*ServiceManagerRestartOp) Execute

func (o *ServiceManagerRestartOp) Execute(ctx *Context, node *Node) error

func (*ServiceManagerRestartOp) Name

func (o *ServiceManagerRestartOp) Name() string

type ServiceManagerService

type ServiceManagerService struct{}

ServiceManagerService provides platform-agnostic service management. Platform detection happens at runtime — callers don't need to know whether launchd, systemd, or Windows services are being used.

func (*ServiceManagerService) Disable

func (s *ServiceManagerService) Disable(name string, output io.Writer) error

Disable disables a service from starting at boot.

func (*ServiceManagerService) Enable

func (s *ServiceManagerService) Enable(name string, output io.Writer) error

Enable enables a service to start at boot.

func (*ServiceManagerService) Restart

func (s *ServiceManagerService) Restart(name string, output io.Writer) error

Restart restarts a service.

func (*ServiceManagerService) Start

func (s *ServiceManagerService) Start(name string, output io.Writer) error

Start starts a service.

func (*ServiceManagerService) Stop

func (s *ServiceManagerService) Stop(name string, output io.Writer) error

Stop stops a service.

type ServiceManagerStartOp

type ServiceManagerStartOp struct {
	// contains filtered or unexported fields
}

ServiceManagerStartOp starts a service.

func (*ServiceManagerStartOp) Execute

func (o *ServiceManagerStartOp) Execute(ctx *Context, node *Node) error

func (*ServiceManagerStartOp) Name

func (o *ServiceManagerStartOp) Name() string

type ServiceManagerStopOp

type ServiceManagerStopOp struct {
	// contains filtered or unexported fields
}

ServiceManagerStopOp stops a service.

func (*ServiceManagerStopOp) Execute

func (o *ServiceManagerStopOp) Execute(ctx *Context, node *Node) error

func (*ServiceManagerStopOp) Name

func (o *ServiceManagerStopOp) Name() string

type ShellOp

type ShellOp struct {
	// contains filtered or unexported fields
}

ShellOp executes a POSIX shell command from node's "command" slot.

func (*ShellOp) Execute

func (o *ShellOp) Execute(ctx *Context, node *Node) error

func (*ShellOp) Name

func (o *ShellOp) Name() string

type ShellService

type ShellService struct{}

ShellService provides shell command execution.

func (*ShellService) PowerShell

func (s *ShellService) PowerShell(command string, output io.Writer) error

PowerShell executes a PowerShell command (Windows).

func (*ShellService) Shell

func (s *ShellService) Shell(command string, output io.Writer) error

Shell executes a POSIX shell command.

type Signature

type Signature struct {
	// Method is the signing method used (gpg, aws_kms, gcp_kms, azure_kv).
	Method string `json:"method" yaml:"method"`

	// Value is the signature data (base64-encoded).
	Value string `json:"value" yaml:"value"`

	// KeyID identifies the key used for signing.
	// For GPG: fingerprint, for KMS: key ARN/ID/URL.
	KeyID string `json:"key_id" yaml:"key_id"`
}

Signature contains the cryptographic signature of a graph.

type SlotValue

type SlotValue struct {
	// Immediate is the direct value (any type, known at analysis time).
	Immediate any `json:"immediate,omitempty" yaml:"immediate,omitempty"`

	// NodeRef is the ID of the node that produces this value (promise).
	NodeRef string `json:"node_ref,omitempty" yaml:"node_ref,omitempty"`

	// Slot is which output slot of the referenced node (empty = default output).
	Slot string `json:"slot,omitempty" yaml:"slot,omitempty"`
}

SlotValue represents a value that fills a slot in a node. Either Immediate is set (direct value) or NodeRef is set (promise from upstream node).

func (SlotValue) IsImmediate

func (s SlotValue) IsImmediate() bool

IsImmediate returns true if this slot value is an immediate value.

func (SlotValue) IsPromise

func (s SlotValue) IsPromise() bool

IsPromise returns true if this slot value is a promise (reference to another node).

type StateView

type StateView struct {
	// Since is the start of the time window (inclusive).
	Since time.Time `json:"since" yaml:"since"`

	// Until is the end of the time window (inclusive).
	Until time.Time `json:"until" yaml:"until"`

	// ReceiptCount is the number of receipts included in this view.
	ReceiptCount int `json:"receipt_count" yaml:"receipt_count"`

	// Packages maps package names to their lifecycle history.
	Packages map[string]*PackageEntry `json:"packages" yaml:"packages"`

	// Files provides file entry access (flat and tree).
	Files *FileTree `json:"files" yaml:"files"`
}

StateView is a read-only view over multiple execution graphs. It represents "what we believe happened" over a time interval.

func (*StateView) Summary

func (v *StateView) Summary() (packages, links, copied int)

Summary returns counts of packages, linked files, and copied files.

type StateViewBuilder

type StateViewBuilder struct {
	// contains filtered or unexported fields
}

StateViewBuilder creates StateViews from receipts.

func NewStateViewBuilder

func NewStateViewBuilder(opts ViewOptions) *StateViewBuilder

NewStateViewBuilder creates a new builder with the given options.

func (*StateViewBuilder) Build

func (b *StateViewBuilder) Build(receiptsDir string) (*StateView, error)

Build loads all receipts from the directory and builds a StateView.

func (*StateViewBuilder) BuildFrom

func (b *StateViewBuilder) BuildFrom(graphs []*Graph) *StateView

BuildFrom creates a StateView from the given graphs.

type SubgraphBuilder

type SubgraphBuilder interface {
	// BuildSubgraph creates a graph from a manifest file path.
	BuildSubgraph(ctx context.Context, manifestPath string, opts BuildOptions) (*Graph, error)
}

SubgraphBuilder builds subgraphs from manifest files during delegate expansion. This is used when a node with operation "delegate" is encountered, causing the referenced manifest to be expanded into a subgraph.

type Summary

type Summary struct {
	TotalFiles int `json:"total_files,omitempty" yaml:"total_files,omitempty"`
	Links      int `json:"links,omitempty" yaml:"links,omitempty"`
	Copies     int `json:"copies,omitempty" yaml:"copies,omitempty"`
	Templates  int `json:"templates,omitempty" yaml:"templates,omitempty"`
	Secrets    int `json:"secrets,omitempty" yaml:"secrets,omitempty"`
	Packages   int `json:"packages,omitempty" yaml:"packages,omitempty"`
	Skipped    int `json:"skipped,omitempty" yaml:"skipped,omitempty"`
	Failed     int `json:"failed,omitempty" yaml:"failed,omitempty"`
	BackedUp   int `json:"backed_up,omitempty" yaml:"backed_up,omitempty"`
}

Summary contains execution statistics.

func (Summary) String

func (s Summary) String() string

String returns a human-readable summary.

type ValidateOp

type ValidateOp struct{}

ValidateOp checks a precondition and fails with a message if unmet. The check function is retrieved from ctx.Data["validators"][node's "check" slot].

func (*ValidateOp) Execute

func (o *ValidateOp) Execute(ctx *Context, node *Node) error

func (*ValidateOp) Name

func (o *ValidateOp) Name() string

type ViewOptions

type ViewOptions struct {
	// Since filters to receipts after this time (zero = no lower bound).
	Since time.Time

	// Until filters to receipts before this time (zero = no upper bound).
	Until time.Time

	// Tools filters to specific tools (empty = all tools).
	Tools []string
}

ViewOptions configures how the view is built.

Jump to

Keyboard shortcuts

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