Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, Qoder, and Pi. 45 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.
fix(excalidraw): detect cycles through bidirectional arrows (#224)
kape2fec61434194
diff --git a/scripts/verify-excalidraw-import.py b/scripts/verify-excalidraw-import.pyindex 9a6681d..c140faa 100644--- a/scripts/verify-excalidraw-import.py+++ b/scripts/verify-excalidraw-import.py@@ -293,9 +293,47 @@ def check_arrow_directions(tmp: Path) -> None:analysis = payload["analysis"]if analysis["entry_points"] != entries or analysis["terminals"] != terminals:fail(f"{name} arrow produced incorrect entry/terminal analysis")+ if analysis["has_cycle"] is not bidir:+ fail(f"{name} arrow produced incorrect cycle analysis")ok("start-only, end-only, bidirectional, and undirected arrows keep their semantics")+def check_bidirectional_cycle(tmp: Path) -> None:+ board = tmp / "bidirectional-cycle.excalidraw"+ board.write_text(+ scene(+ "bidirectional-cycle",+ [+ {"id": node_id, "type": "rectangle"}+ for node_id in ("root", "a", "b")+ ]+ + [+ {+ "id": "entry",+ "type": "arrow",+ "startBinding": {"elementId": "root"},+ "endBinding": {"elementId": "a"},+ },+ {+ "id": "cycle",+ "type": "arrow",+ "startArrowhead": "arrow",+ "endArrowhead": "arrow",+ "startBinding": {"elementId": "a"},+ "endBinding": {"elementId": "b"},+ },+ ],+ ),+ encoding="utf-8",+ )+ analysis = json.loads(run_extract([str(board), "--json"]))["scene"]["analysis"]+ if not analysis["has_cycle"] or "tree" in analysis["type_candidates"]:+ fail("a rooted bidirectional cycle was offered as an acyclic tree")+ if "cycle: True" not in run_extract([str(board)]):+ fail("bidirectional cycle was not reported in the Markdown digest")+ ok("bidirectional cycles are reported and excluded from tree candidates")++def check_adversarial(tmp: Path) -> None:payload_text = run_extract([str(ADVERSARIAL), "--json"])payload = json.loads(payload_text)["scene"]@@ -672,6 +710,7 @@ def main() -> int:check_whiteboard()check_bindings_and_shapes(tmp)check_arrow_directions(tmp)+ check_bidirectional_cycle(tmp)check_adversarial(tmp)check_errors_and_limits(tmp)check_legacy_stdout_encoding(tmp)diff --git a/skills/diagram-design/scripts/excalidraw_extract.py b/skills/diagram-design/scripts/excalidraw_extract.pyindex 4178934..3b71db1 100644--- a/skills/diagram-design/scripts/excalidraw_extract.py+++ b/skills/diagram-design/scripts/excalidraw_extract.py@@ -377,6 +377,8 @@ def _has_cycle(nodes: list[Node], edges: list[Edge]) -> bool:for edge in edges:if edge.source and edge.target and edge.source in adjacency:adjacency[edge.source].append(edge.target)+ if edge.bidirectional and edge.target in adjacency:+ adjacency[edge.target].append(edge.source)WHITE, GREY, BLACK = 0, 1, 2color = {node.id: WHITE for node in nodes}