graph

package
v0.14.0-rc.0 Latest Latest
Warning

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

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

Documentation

Overview

Package graph drives the cascade visualizer from the command line. It loads a manifest, builds the generated-pipeline dependency graph, projects it into a render-agnostic view model, and emits a diagram to an output stream. The package owns only the orchestration and flag contract; the projection and the diagram syntax live in internal/visualize, so a richer renderer or projection is added there without reshaping this command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

NewCommand creates the graph command, a read-only renderer that turns the manifest's generated pipeline into a Mermaid diagram on stdout. The verb is "graph" because cascade renders a graph; it does not collide with "plan" (the textual change preview) or "status" (the live environment view). "visualize" was the considered alternative; "graph" is shorter and names the artifact rather than the act.

func Run

func Run(o Options, stdout io.Writer) error

Run renders the manifest's pipeline graph to stdout. It validates the presentation flags before touching the filesystem so an unsupported format, granularity, or theme fails fast with a clear message and writes nothing. A missing or invalid manifest, a cyclic graph, or a render failure surfaces as a wrapped error; a well-formed manifest always emits.

Types

type Granularity

type Granularity string

Granularity selects which projection of the pipeline the graph renders. Each value maps to a distinct view-model build feeding the same emitter: jobs is the full job DAG, stages is the coarse lifecycle flow, and env is the promotion state machine with its hotfix divergence and rejoin.

const (
	GranularityJobs      Granularity = "jobs"
	GranularityStages    Granularity = "stages"
	GranularityEnv       Granularity = "env"
	GranularityCrossRepo Granularity = "cross-repo"
)

Granularity values.

type Options

type Options struct {
	// ConfigPath is the manifest path. Empty auto-detects .github/manifest.yaml.
	ConfigPath string
	// ManifestKey is the top-level manifest key holding the CI config. Empty
	// selects the default key.
	ManifestKey string
	// Granularity selects the projection. Empty selects jobs.
	Granularity string
	// Format selects the diagram syntax. Empty selects mermaid.
	Format string
	// Theme selects diagram styling. Empty selects the default theme.
	Theme string
	// JSON, when true, wraps the diagram string in a JSON envelope instead of
	// printing the raw diagram, so callers piping structured output get the
	// format, granularity, theme, and diagram in one object.
	JSON bool
}

Options carries the inputs to a graph render. ConfigPath and ManifestKey locate the manifest the same way the sibling read-only commands do. The empty value of each presentation field selects its default, so Run is usable directly in tests without a cobra layer applying defaults.

Jump to

Keyboard shortcuts

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