Help us shape the future of Go! Take the 2026 Go Developer Survey

fmesh-export

module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT

README

fmesh-export

Export an F-Mesh mesh as a diagram. One Go module, one package per format:

Format Package Render with
Graphviz DOT dot dot -Tpng, edotor.net
Mermaid mermaid GitHub markdown, mermaid.live
D2 d2 d2, play.d2lang.com
PlantUML plantuml plantuml -tpng, plantuml.com server

JSON export is bundled with fmesh itself: plugin/jsonexport.

Install

go get github.com/hovsep/fmesh-export/mermaid  # or /dot, /d2, /plantuml

Usage

Every format has the same shape. Each exporter is an fmesh plugin:

import "github.com/hovsep/fmesh-export/mermaid"

chart := mermaid.New(mermaid.WithCycles())
fm, err := fmesh.New("mesh", fmesh.WithPlugins(chart))
if err != nil {
    return err
}
// ... add components and pipes, seed, fm.Run(ctx) ...

static, err := chart.Export()       // the structure
cycles, err := chart.ExportCycles() // one diagram per cycle, colored by activation result
  • New(opts...) creates the plugin; attach it with fmesh.WithPlugins. One plugin serves one mesh.
  • Export() returns the structure: components, ports, pipes, descriptions.
  • WithCycles() records every cycle of the next run; ExportCycles() then returns one diagram per cycle, with components colored by their activation result.
  • <pkg>.Export(fm, opts...) exports a mesh that was built without the plugin.
  • Options set one thing on top of the defaults; anything you do not set keeps its default. See each package's README.

Live examples

After every merge, CI renders the showcase mesh in internal/cmd/showcase (fan-out, fan-in, an error and a wait) in every format, and shows the pictures on the run's summary page. One workflow per format: DOT, Mermaid, D2, PlantUML.

Format Structure Run replay
DOT DOT structure DOT cycles
Mermaid Mermaid structure Mermaid cycles
D2 D2 structure D2 cycles
PlantUML PlantUML structure PlantUML cycles

Run it locally: go run ./internal/cmd/showcase -format d2 out.

License

See LICENSE.

Directories

Path Synopsis
Package d2 provides Plugin, a mesh plugin that exports an fmesh mesh as D2 diagram source: the static structure, and optionally one diagram per cycle with components colored by their activation result.
Package d2 provides Plugin, a mesh plugin that exports an fmesh mesh as D2 diagram source: the static structure, and optionally one diagram per cycle with components colored by their activation result.
Package dot provides Plugin, a mesh plugin that exports an fmesh mesh as a Graphviz DOT graph: the static structure, and optionally one graph per cycle.
Package dot provides Plugin, a mesh plugin that exports an fmesh mesh as a Graphviz DOT graph: the static structure, and optionally one graph per cycle.
internal
cmd/showcase command
Command showcase builds and runs an order-processing mesh, then writes its graphs in one export format to a directory: static.<ext> and one cycle-NNN.<ext> per cycle.
Command showcase builds and runs an order-processing mesh, then writes its graphs in one export format to a directory: static.<ext> and one cycle-NNN.<ext> per cycle.
Package mermaid provides Plugin, a mesh plugin that exports an fmesh mesh as a Mermaid flowchart: the static structure, and optionally one chart per cycle with components colored by their activation result.
Package mermaid provides Plugin, a mesh plugin that exports an fmesh mesh as a Mermaid flowchart: the static structure, and optionally one chart per cycle with components colored by their activation result.
Package plantuml provides Plugin, a mesh plugin that exports an fmesh mesh as a PlantUML component diagram: the static structure, and optionally one diagram per cycle with components colored by their activation result.
Package plantuml provides Plugin, a mesh plugin that exports an fmesh mesh as a PlantUML component diagram: the static structure, and optionally one diagram per cycle with components colored by their activation result.

Jump to

Keyboard shortcuts

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