diff --git a/CHANGELOG.md b/CHANGELOG.md index 86dc8f12..ac305a4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,25 @@ Full release notes with details on each version: [GitHub Releases](https://github.com/safishamsi/graphify/releases) +## Unreleased — `graphify tree` subcommand + +- **New:** `graphify tree` — emits a self-contained D3 v7 collapsible-tree HTML + view of `graph.json`. Expand-all / collapse-all / reset-view buttons; + multi-line `wrapText` labels with separately-coloured name + count; + depth-based colour palette; click-to-toggle subtree; hover inspector + showing top-K outbound edges per symbol. +- Hierarchy is built from `source_file` longest-common-prefix; symbols are + grouped by their containing module so the tree mirrors the on-disk layout. +- Configuration: `--graph PATH`, `--output HTML`, `--root PATH`, + `--max-children N` (default 200), `--top-k-edges N` (default 12), + `--label NAME`. +- Implementation: `graphify/tree_html.py` (575 LOC, no external runtime + dependencies — D3 v7 is loaded from cdn.jsdelivr.net). +- Security: `emit_html()` now `html.escape()`s the page title and header, + and JS-escapes ``, `

`, + or the ` + + + +""" + + +def emit_html( + tree: Dict[str, Any], + *, + title: str, + header: str, + svg_width: int = 6000, + svg_height: int = 8000, +) -> str: + # Escape sequences so embedded JSON cannot break out of the + #