graph

package
v0.1.0-dev.20260129231750 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package graph provides the Package Graph Builder for lore.

Architecture

The Package Graph Builder produces execution graph nodes for software package operations. It shares the execution engine with writ's File Tree Builder:

┌─────────────────────────────────────────────────────────────┐
│                    Execution Engine                         │
│                  (internal/engine)                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────────┐          ┌─────────────────┐          │
│  │  File Tree      │          │  Package Graph  │          │
│  │  Builder        │          │  Builder        │          │
│  │  (writ/tree)    │          │  (lore/graph)   │          │
│  └────────┬────────┘          └────────┬────────┘          │
│           │                            │                    │
│           │    ┌──────────────────┐    │                    │
│           └───►│ Execution Graph  │◄───┘                    │
│                │ (engine.Graph)   │                         │
│                └────────┬─────────┘                         │
│                         │                                   │
│                         ▼                                   │
│                ┌──────────────────┐                         │
│                │   Engine.Run()   │                         │
│                └──────────────────┘                         │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Usage

When writ encounters a packages-manifest.yaml file, it calls BuildFromManifest to produce package nodes that are merged into the execution graph:

// In writ deploy:
fileResult, _ := tree.Build(fileCfg)

// For each packages-manifest.yaml found:
pkgResult, _ := graph.BuildFromManifest(manifestPath, platform)

// Merge into single graph:
combinedGraph := engine.MergeGraphs(fileResult.Graph, pkgResult.Graph)

// Run unified graph:
results, _ := eng.Run(ctx, combinedGraph)

When lore is invoked directly, it uses the same builder:

// In lore deploy:
pkgResult, _ := graph.BuildFromPackages(packageNames, platform)
results, _ := eng.Run(ctx, pkgResult.Graph)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildConfig

type BuildConfig struct {
	// ManifestPath is the path to a packages-manifest.yaml file.
	// Mutually exclusive with Packages.
	ManifestPath string

	// Packages is a list of package names to install.
	// Mutually exclusive with ManifestPath.
	Packages []string

	// Platform is the target platform (e.g., "Darwin", "Linux.Debian").
	// If empty, auto-detected.
	Platform string

	// Features are optional feature flags to enable.
	Features []string

	// Settings are key-value configuration settings.
	Settings map[string]string

	// DryRun prevents actual installation when true.
	DryRun bool

	// RegistryClient provides access to the package registry.
	// If nil, a default client is created.
	RegistryClient *registry.Client
}

BuildConfig holds configuration for building a package graph.

type BuildResult

type BuildResult struct {
	// Graph is the execution graph ready for the engine.
	Graph *engine.Graph

	// Packages lists the resolved package names.
	Packages []string

	// Platform is the detected or specified platform.
	Platform string
}

BuildResult contains the built execution graph and metadata for packages.

func Build

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

Build creates an execution graph from the given configuration.

func BuildFromManifest

func BuildFromManifest(manifestPath, plat string) (*BuildResult, error)

BuildFromManifest creates an execution graph from a packages-manifest.yaml file.

func BuildFromPackages

func BuildFromPackages(packages []string, plat string) (*BuildResult, error)

BuildFromPackages creates an execution graph from a list of package names.

Jump to

Keyboard shortcuts

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