HtmlReportGenerator

Generates the self-contained Aalekh HTML interactive report.

The output is a single .html file with:

  • D3.js v7 force-directed graph inlined into a <script> tag from the bundled d3.min.js resource - no CDN, no network request when the report is opened

  • All graph data injected inline as typed <script type="application/json"> tags

  • System font stack; no Google Fonts dependency

  • Zero runtime server, zero external dependencies once the file is generated

Data injection

The template contains a stable HTML comment marker:

<!-- DATA INJECTED BY KOTLIN GENERATOR BEFORE THIS SCRIPT TAG -->

The generator replaces this marker with the two JSON <script> data tags, then the marker itself is removed. This approach is robust to any whitespace or formatting changes inside the template's JavaScript - it only depends on one unique HTML comment, not on matching JS source text.

D3 inlining

The placeholder {{D3_INLINE}} is substituted with the contents of the bundled d3.min.js resource so the resulting HTML works offline. Update D3 by replacing aalekh-report/src/main/resources/d3.min.js.

Functions

Link copied to clipboard
fun generate(projectName: String, graph: ModuleDependencyGraph, summary: GraphSummary, violations: List<Violation> = emptyList(), appliedRules: List<AppliedRule> = emptyList(), trendJson: String = "[]", teamOwners: Map<String, List<String>> = emptyMap(), mainSequence: List<ModuleMainSequence> = emptyList(), hiddenCoupling: List<CoChange> = emptyList(), churn: List<ModuleChurn> = emptyList(), layers: List<LayerSpec> = emptyList(), metrics: GraphMetricSet? = null, narrative: NarrativeReport = NarrativeReport.EMPTY, regions: RegionMap? = null, profile: PresentationProfile? = null): String

Generates the full HTML string for the interactive dependency report.