deps

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package deps provides cross-project dependency tracking for VisionSpec.

This package enables projects to declare dependencies on other projects, track dependency versions, and detect conflicts or circular dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Project     string            `json:"project" yaml:"project"`
	Version     string            `json:"version,omitempty" yaml:"version,omitempty"`
	Type        DependencyType    `json:"type" yaml:"type"`
	Required    bool              `json:"required" yaml:"required"`
	Description string            `json:"description,omitempty" yaml:"description,omitempty"`
	Specs       []string          `json:"specs,omitempty" yaml:"specs,omitempty"` // Which specs are affected
	Metadata    map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}

Dependency represents a dependency on another project.

type DependencyEdge

type DependencyEdge struct {
	From     string         `json:"from"`
	To       string         `json:"to"`
	Type     DependencyType `json:"type"`
	Required bool           `json:"required"`
}

DependencyEdge represents a directed edge in the dependency graph.

type DependencyGraph

type DependencyGraph struct {
	Projects map[string]*ProjectNode `json:"projects"`
	Edges    []DependencyEdge        `json:"edges"`
}

DependencyGraph represents the full dependency graph across projects.

func (*DependencyGraph) DetectCycles

func (g *DependencyGraph) DetectCycles() [][]string

DetectCycles detects circular dependencies in the graph.

func (*DependencyGraph) ExportJSON

func (g *DependencyGraph) ExportJSON() ([]byte, error)

ExportJSON exports the dependency graph as JSON.

func (*DependencyGraph) ExportMermaid

func (g *DependencyGraph) ExportMermaid() string

ExportMermaid exports the dependency graph as Mermaid diagram.

func (*DependencyGraph) GenerateReport

func (g *DependencyGraph) GenerateReport() *DependencyReport

GenerateReport creates a dependency report from the graph.

func (*DependencyGraph) GetAffectedProjects

func (g *DependencyGraph) GetAffectedProjects(projectName string) []string

GetAffectedProjects returns all projects affected by changes to a given project.

func (*DependencyGraph) TopologicalSort

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

TopologicalSort returns projects in dependency order.

func (*DependencyGraph) Validate

func (g *DependencyGraph) Validate() *ValidationResult

Validate checks the dependency graph for issues.

type DependencyReport

type DependencyReport struct {
	GeneratedAt      time.Time         `json:"generated_at"`
	TotalProjects    int               `json:"total_projects"`
	TotalEdges       int               `json:"total_edges"`
	Cycles           [][]string        `json:"cycles,omitempty"`
	CriticalPath     []string          `json:"critical_path,omitempty"`
	OrphanProjects   []string          `json:"orphan_projects,omitempty"` // No deps and no dependents
	LeafProjects     []string          `json:"leaf_projects,omitempty"`   // No dependents
	RootProjects     []string          `json:"root_projects,omitempty"`   // No dependencies
	ValidationResult *ValidationResult `json:"validation,omitempty"`
}

DependencyReport contains a summary of project dependencies.

type DependencyType

type DependencyType string

DependencyType categorizes the nature of the dependency.

const (
	// DepTypeBlocks indicates this project blocks the dependent project.
	DepTypeBlocks DependencyType = "blocks"
	// DepTypeRequires indicates this project requires the dependency.
	DepTypeRequires DependencyType = "requires"
	// DepTypeExtends indicates this project extends the dependency.
	DepTypeExtends DependencyType = "extends"
	// DepTypeRelated indicates projects are related but not strictly dependent.
	DepTypeRelated DependencyType = "related"
)

type Manager

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

Manager handles dependency operations for a project.

func NewManager

func NewManager(projectPath string) *Manager

NewManager creates a new dependency manager.

func (*Manager) AddDependency

func (m *Manager) AddDependency(dep Dependency) error

AddDependency adds a dependency to the project's visionspec.yaml.

func (*Manager) BuildGraph

func (m *Manager) BuildGraph() (*DependencyGraph, error)

BuildGraph builds the full dependency graph across all projects.

func (*Manager) GetDependencies

func (m *Manager) GetDependencies() ([]Dependency, error)

GetDependencies returns the dependencies declared in visionspec.yaml.

func (*Manager) RemoveDependency

func (m *Manager) RemoveDependency(projectName string) error

RemoveDependency removes a dependency from the project's visionspec.yaml.

type ProjectNode

type ProjectNode struct {
	Name         string       `json:"name"`
	Path         string       `json:"path"`
	Version      string       `json:"version,omitempty"`
	Status       string       `json:"status,omitempty"` // draft, approved, completed
	Dependencies []Dependency `json:"dependencies,omitempty"`
	Dependents   []string     `json:"dependents,omitempty"` // Projects that depend on this
}

ProjectNode represents a project in the dependency graph.

type ValidationError

type ValidationError struct {
	Type    string `json:"type"`
	Project string `json:"project"`
	Message string `json:"message"`
}

ValidationError represents a dependency validation issue.

type ValidationResult

type ValidationResult struct {
	Valid    bool              `json:"valid"`
	Errors   []ValidationError `json:"errors,omitempty"`
	Warnings []ValidationError `json:"warnings,omitempty"`
}

Validate checks for dependency issues.

Jump to

Keyboard shortcuts

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