Add exporters, utils, and tests
Some checks failed
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
2026-01-30 05:30:56 +00:00
parent bbfcf43604
commit 449deab1e2

View File

@@ -0,0 +1,26 @@
"""Graphviz export functionality."""
from typing import List, Optional
class GraphvizExporter:
"""Exports diagrams to Graphviz format."""
def generate_dot(
self,
commands: List[str],
title: str = "Command Flow",
) -> str:
"""Generate DOT graph."""
lines = ["digraph {\n", f' label="{title}"\n', ' node [shape=box]\n\n']
for i, cmd in enumerate(commands):
safe_cmd = cmd.replace('"', '\\"')
lines.append(f' n{i} [label="{safe_cmd}"]\n')
if i > 0:
lines.append(f' n{{i-1}} -> n{{i}}\n')
lines.append("}\n")
return "".join(lines)