Summary
Add an architecture/import-graph visualization and a directory debt-heatmap treemap to the HTML report, reusing the module graph the import-cycle detector already builds.
Motivation
import-cycle (src/detectors/importCycle.ts) already constructs the relative-import module graph, but that structure is only used to report cycles. Rendering the graph (with cycles highlighted) and a directory treemap weighted by debt density gives teams an at-a-glance architectural view — high adoption value with much of the data already computed.
Proposed behavior
debtlens scan --format html (or a --graph flag) emits, in addition to the findings list:
- an interactive import-graph SVG with cycle edges highlighted;
- a debt treemap where rectangle size = file/dir size (or file count) and color = debt density/severity.
- Self-contained HTML (inline SVG + minimal vanilla JS, no external/CDN assets).
Implementation surface
- Expose the import graph computed in
src/detectors/importCycle.ts via a reusable helper (e.g. extract into src/core/importGraph.ts) so the reporter can consume it without re-parsing.
- Extend
src/reporters/htmlReporter.ts (or add src/reporters/graphReporter.ts) to render SVG graph + treemap.
- Aggregate per-directory debt via
src/core/issueAggregates.ts.
- Tests: graph extraction correctness, HTML smoke (valid, self-contained, no external refs).
Acceptance criteria
Difficulty: medium.
Summary
Add an architecture/import-graph visualization and a directory debt-heatmap treemap to the HTML report, reusing the module graph the
import-cycledetector already builds.Motivation
import-cycle(src/detectors/importCycle.ts) already constructs the relative-import module graph, but that structure is only used to report cycles. Rendering the graph (with cycles highlighted) and a directory treemap weighted by debt density gives teams an at-a-glance architectural view — high adoption value with much of the data already computed.Proposed behavior
debtlens scan --format html(or a--graphflag) emits, in addition to the findings list:Implementation surface
src/detectors/importCycle.tsvia a reusable helper (e.g. extract intosrc/core/importGraph.ts) so the reporter can consume it without re-parsing.src/reporters/htmlReporter.ts(or addsrc/reporters/graphReporter.ts) to render SVG graph + treemap.src/core/issueAggregates.ts.Acceptance criteria
docs/report-gallery.md) + CHANGELOG updated.npm run test:allpasses.Difficulty: medium.