MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / write_callflow_html

Function write_callflow_html

graphify/callflow_html.py:1621–2027  ·  view source on GitHub ↗

Generate call-flow architecture HTML from graphify output files.

(
    project: str | Path | None = None,
    *,
    graphify_out: str | Path | None = None,
    graph: str | Path | None = None,
    report: str | Path | None = None,
    labels: str | Path | None = None,
    sections: str | Path | None = None,
    output: str | Path | None = None,
    lang: str = "auto",
    max_sections: int = 15,
    diagram_scale: float = 1.0,
    max_diagram_nodes: int = 18,
    max_diagram_edges: int = 24,
    verbose: bool = False,
)

Source from the content-addressed store, hash-verified

1619
1620
1621def write_callflow_html(
1622 project: str | Path | None = None,
1623 *,
1624 graphify_out: str | Path | None = None,
1625 graph: str | Path | None = None,
1626 report: str | Path | None = None,
1627 labels: str | Path | None = None,
1628 sections: str | Path | None = None,
1629 output: str | Path | None = None,
1630 lang: str = "auto",
1631 max_sections: int = 15,
1632 diagram_scale: float = 1.0,
1633 max_diagram_nodes: int = 18,
1634 max_diagram_edges: int = 24,
1635 verbose: bool = False,
1636) -> Path:
1637 """Generate call-flow architecture HTML from graphify output files."""
1638 args = CallflowOptions(
1639 project,
1640 graphify_out=graphify_out,
1641 graph=graph,
1642 report=report,
1643 labels=labels,
1644 sections=sections,
1645 output=output,
1646 lang=lang,
1647 max_sections=max_sections,
1648 diagram_scale=diagram_scale,
1649 max_diagram_nodes=max_diagram_nodes,
1650 max_diagram_edges=max_diagram_edges,
1651 )
1652
1653 paths = resolve_graphify_paths(args)
1654 if not paths["graph"].exists():
1655 raise FileNotFoundError(
1656 f"graphify output not found: {paths['graph']}. "
1657 "Run graphify first or pass --graph /path/to/graph.json."
1658 )
1659
1660 # Load data
1661 nodes, edges, hyperedges, meta = load_graph(paths["graph"])
1662 labels = load_labels(paths["labels"])
1663 lang = detect_lang(args.lang, nodes, labels)
1664 if paths["sections"]:
1665 sections = load_sections(paths["sections"])
1666 else:
1667 sections = derive_sections_from_communities(nodes, labels, lang, args.max_sections)
1668 sections = normalize_sections(sections, lang)
1669 report_text = load_report(paths["report"])
1670
1671 if not nodes:
1672 raise ValueError("graph.json contains 0 nodes")
1673 if len(sections) <= 1:
1674 raise ValueError("no sections defined")
1675
1676 if verbose and len(nodes) >= 5000:
1677 print("WARNING: Large graph -- Mermaid rendering may be slow. Consider --max-sections 5.", file=sys.stderr)
1678

Calls 15

CallflowOptionsClass · 0.85
resolve_graphify_pathsFunction · 0.85
load_labelsFunction · 0.85
detect_langFunction · 0.85
load_sectionsFunction · 0.85
normalize_sectionsFunction · 0.85
load_reportFunction · 0.85
infer_project_nameFunction · 0.85
safe_filenameFunction · 0.85
build_community_indexFunction · 0.85
build_section_node_mapFunction · 0.85