MCPcopy Create free account
hub / github.com/diillson/chatcli / RenderDOTToFile

Function RenderDOTToFile

cli/plugins/diagram_render_api.go:20–45  ·  view source on GitHub ↗

RenderDOTToFile renders DOT source to an image file using the diagram engine (embedded go-graphviz, with the system `dot` as an optional sharper backend per CHATCLI_DIAGRAM_BACKEND). format defaults to png and engine to dot when empty; dpi defaults to a legible 96 when not positive; output defaults

(ctx context.Context, dotSrc, format, engine, output string, dpi int)

Source from the content-addressed store, hash-verified

18// empty; dpi defaults to a legible 96 when not positive; output defaults to a
19// temp file when empty. Returns a human summary that includes the written path.
20func RenderDOTToFile(ctx context.Context, dotSrc, format, engine, output string, dpi int) (string, error) {
21 if format == "" {
22 format = "png"
23 }
24 if engine == "" {
25 engine = "dot"
26 }
27 if dpi <= 0 {
28 dpi = 96
29 }
30 cfg := diagramArgs{
31 Cmd: "render",
32 DOT: dotSrc,
33 Format: format,
34 Engine: engine,
35 Style: "dark",
36 Backend: configuredDiagramBackend(),
37 Output: output,
38 DPI: dpi,
39 }
40 cfg, err := finalizeDiagramArgs(cfg)
41 if err != nil {
42 return "", err
43 }
44 return diagramRenderAndWrite(ctx, dotSrc, cfg)
45}

Callers 2

handleGraphCommandMethod · 0.92

Calls 3

configuredDiagramBackendFunction · 0.85
finalizeDiagramArgsFunction · 0.85
diagramRenderAndWriteFunction · 0.85

Tested by 1