Skip to content

feat(visualize): add a D2 emitter behind the graph emitter seam#558

Draft
joshua-temple wants to merge 2 commits into
mainfrom
feat/viz-d2-emitter
Draft

feat(visualize): add a D2 emitter behind the graph emitter seam#558
joshua-temple wants to merge 2 commits into
mainfrom
feat/viz-d2-emitter

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

cascade graph renders only Mermaid. A high-fidelity, branded rendering path (the crucible teal-dark style) needs D2 source as its boundary, emitted by the main binary so a sidecar renderer can turn it into SVG or PNG.

Fix

Add a D2Emitter behind the existing visualize.Emitter seam and select it with cascade graph --format d2. It is stdlib-only string generation (no D2 dependency in the main binary), mirroring the Mermaid emitter:

  • Crucible shape vocabulary per node kind: 3d state slabs (validate/build/stage), hexagon deploy invokes, rounded dashed environment plates, red hotfix slabs, small entry and double terminal markers, opaque external-repo nodes.
  • Distinct edge classes for flow, promotion, optional, external, notify, and hotfix divergence/rejoin.
  • Cross-repo groups render as D2 containers with container-qualified edge endpoints.
  • Deterministic output (ranges ordered slices, never a map). The branded palette is fixed; the Mermaid path stays the theme-driven, GitHub-native renderer.

Verification

  • Golden-output unit tests across all four granularities and topologies (jobs, stages, env with divergence, cross-repo), plus determinism, structural-validity, and error-path tests.
  • graph --format d2 command tests, including the JSON envelope and cross-repo lanes.
  • New e2e scenario 58-graph-d2-render exercises cascade graph --format d2 end to end (deterministic source, read-only).
  • go build ./..., go test ./..., and golangci-lint run ./... clean on both the root and e2e modules.

Draft: opened for maintainer review. Sidecar binary, ephemeral install, and release publishing are intentionally out of scope here.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant