graph

package
v0.1.0-dev.20260129080746 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 2 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)

NOT YET IMPLEMENTED

This package is a stub. The following must be implemented:

  • BuildFromManifest: Parse packages-manifest.yaml, resolve packages from registry, produce install/configure/verify nodes

  • BuildFromPackages: Resolve package names to registry entries, produce install/configure/verify nodes

  • Package operations: install, configure, verify (as engine.Direct operations)

  • Registry integration: Resolve package names to installation instructions for the current platform

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("Package Graph Builder not yet implemented")

ErrNotImplemented is returned by stub functions that are not yet implemented.

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-arm64").
	// If empty, auto-detected.
	Platform string

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

	// DryRun prevents actual installation when true.
	DryRun bool
}

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.

NOT YET IMPLEMENTED: Returns ErrNotImplemented.

When implemented, this function will:

  1. Parse the manifest or resolve package names
  2. Query the registry for installation instructions
  3. Produce install/configure/verify nodes for each package
  4. Add dependency edges between nodes

func BuildFromManifest

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

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

NOT YET IMPLEMENTED: Returns ErrNotImplemented.

This is the entry point used by writ when it encounters a packages-manifest.yaml file during deployment. The resulting graph is merged with writ's file graph and executed by the shared engine.

func BuildFromPackages

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

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

NOT YET IMPLEMENTED: Returns ErrNotImplemented.

This is the entry point used by "lore deploy <package>..." when installing packages directly without a manifest file.

Jump to

Keyboard shortcuts

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