depsgraph

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder constructs a dependency graph for all workspaces

func NewBuilder

func NewBuilder(workspaces []string, logger *logrus.Logger) *Builder

NewBuilder creates a new dependency graph builder

func (*Builder) Build

func (b *Builder) Build() (*Graph, error)

Build constructs the dependency graph

type Graph

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

Graph represents the dependency graph of all modules

func BuildGraph

func BuildGraph(rootDir string, workspaces []string) (*Graph, error)

BuildGraph builds a dependency graph from the workspace

func NewGraph

func NewGraph() *Graph

NewGraph creates a new dependency graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to string)

AddEdge adds a directed edge from 'from' to 'to' (from depends on to)

func (*Graph) AddNode

func (g *Graph) AddNode(node *Node)

AddNode adds a node to the graph

func (*Graph) GetAllNodes

func (g *Graph) GetAllNodes() map[string]*Node

GetAllNodes returns all nodes in the graph

func (*Graph) GetDependencies

func (g *Graph) GetDependencies(module string) []string

GetDependencies returns the direct dependencies of a module

func (*Graph) GetDependents

func (g *Graph) GetDependents(module string) []string

GetDependents returns the modules that depend on the given module

func (*Graph) GetNode

func (g *Graph) GetNode(name string) (*Node, bool)

GetNode returns a node by name

func (*Graph) HasCycle

func (g *Graph) HasCycle() bool

HasCycle checks if the graph contains a cycle

func (*Graph) TopologicalSort

func (g *Graph) TopologicalSort() ([][]string, error)

TopologicalSort performs a topological sort of the graph using Kahn's algorithm Returns modules grouped by levels that can be released in parallel

func (*Graph) TopologicalSortWithFilter

func (g *Graph) TopologicalSortWithFilter(nodesToConsider map[string]bool) ([][]string, error)

TopologicalSortWithFilter performs a topological sort on a subset of nodes If nodesToConsider is nil, sorts the entire graph If nodesToConsider is provided, only considers dependencies within that set

type Node

type Node struct {
	Name    string   // Module name (e.g., "grove-core")
	Path    string   // Full module path (e.g., "github.com/grovetools/core")
	Dir     string   // Directory path
	Deps    []string // Direct dependencies (module paths)
	Version string   // Current version (if known)
}

Node represents a module in the dependency graph

Jump to

Keyboard shortcuts

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