dependencies

package
v1.222.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package dependencies builds and renders the Atmos component dependency graph for the `atmos list dependencies` command. Unlike the execution-ordering graph used by the scheduler (which rejects cycles), this builder is cycle-tolerant so the command can visualize circular dependencies instead of failing on them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGraph

func BuildGraph(stacks map[string]any) (*dependency.Graph, error)

BuildGraph constructs a cycle-tolerant dependency graph from the described stacks map. It adds a node for every concrete (non-abstract, enabled) terraform component and an edge for every component-to-component dependency declared via either `dependencies.components` (preferred) or the legacy `settings.depends_on`. Edges to targets that are not present in the graph (e.g. disabled or filtered-out components) are skipped.

func NodeID

func NodeID(component, stack string) string

NodeID returns the canonical, collision-safe node ID for a component in a stack. It uses a length-prefixed encoding so that component/stack names containing the delimiter character never produce the same ID for distinct (component, stack) pairs (e.g. "app-prod"+"us" vs "app"+"prod-us").

func Render

func Render(graph *dependency.Graph, opts Options) (string, error)

Render produces the dependency output for the given graph and options.

Types

type Direction

type Direction string

Direction selects which dependency edges to display.

const (
	// DirectionBoth shows both what a component depends on and what depends on it.
	DirectionBoth Direction = "both"
	// DirectionForward shows what a component depends on.
	DirectionForward Direction = "forward"
	// DirectionReverse shows what depends on a component (its dependents).
	DirectionReverse Direction = "reverse"
)

type Options

type Options struct {
	// Format is the output format: tree (default), json, or yaml.
	Format string
	// Direction selects forward, reverse, or both edge directions.
	Direction Direction
	// Component optionally filters the top-level entries to a single component.
	Component string
	// Stack optionally filters the top-level entries to a single stack.
	Stack string
}

Options configures dependency rendering.

Jump to

Keyboard shortcuts

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