graphprint

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package graphprint renders a runtime DAG as either a human-readable indented listing or a Graphviz DOT document. Both unobin's stack binaries (via pkg/runner) and the dev CLI (cmd/unobin/root/print-graph) share these renderers so the two paths produce identical output for the same graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DOT

func DOT(out io.Writer, dag *runtime.DAG, name string)

DOT writes the DAG to out as a Graphviz directed graph named name. Edges to non-node addresses (like `input.X`) are skipped so the rendered graph contains only nodes the runtime actually executes.

func Text added in v0.11.0

func Text(out io.Writer, dag *runtime.DAG)

Text writes the DAG to out as an indented listing: one node per stanza, with each outgoing edge prefixed by "->". Addresses are sorted lexicographically so the output is stable across runs.

Types

type Binding added in v0.11.0

type Binding struct {
	LibraryPath *string `json:"library-path" ub:"library-path"`
	Alias       string  `json:"alias"        ub:"alias"`
	Export      string  `json:"export"       ub:"export"`
}

type Document added in v0.11.0

type Document struct {
	Kind          string                  `json:"kind"           ub:"kind"`
	FormatVersion int                     `json:"format-version" ub:"format-version"`
	Name          string                  `json:"name"           ub:"name"`
	Nodes         []Node                  `json:"nodes"          ub:"nodes"`
	Edges         []Edge                  `json:"edges"          ub:"edges"`
	Diagnostics   []diagnostic.Diagnostic `json:"diagnostics"    ub:"diagnostics"`
}

func BuildDocument added in v0.11.0

func BuildDocument(
	dag *runtime.DAG,
	name string,
	diagnostics []diagnostic.Diagnostic,
) Document

type Edge added in v0.11.0

type Edge struct {
	From string `json:"from" ub:"from"`
	To   string `json:"to"   ub:"to"`
}

type Format added in v0.11.0

type Format string
const (
	FormatText   Format = "text"
	FormatJSON   Format = "json"
	FormatUnobin Format = "unobin"
	FormatDOT    Format = "dot"
)

func ParseFormat added in v0.11.0

func ParseFormat(value string) (Format, error)

func (Format) Machine added in v0.11.0

func (f Format) Machine() bool

type Node added in v0.11.0

type Node struct {
	Address   string   `json:"address"   ub:"address"`
	Category  string   `json:"category"  ub:"category"`
	Binding   *Binding `json:"binding"   ub:"binding"`
	Composite bool     `json:"composite" ub:"composite"`
}

Jump to

Keyboard shortcuts

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