feat(depgraph): dominator, zone-SCC, and cohesion report summaries
Summary
Part of #3283 (workstream 7 of the architecture-quality umbrella #3276). Adds three report-only fields to pnpm depgraph, stacked on #3275's @statelyai/graph migration:
dominatorSummary— dominator tree of one entry's eager-load closure over value edges only (defaultsrc/daemon.ts, override with--dominator-entry <path>). Reproduces #3276's own numbers against the current tree: 621/1837 eager files, withrequest-binding.ts/replay-device-selection.tspulling in all ofmaestroandprovider-device-runtimes.tspulling in all ofprovider-webdriver.zoneSccSummary— strongly connected components of the zone graph over value zone-pairs only (same edge kind R4 keeps acyclic at file level). Reproduces the quoted 9-zone cycle (cli, commands, core, daemon-client, daemon-server, remote, sdk, plugins, (root)).cohesionSummary— Louvain communities vs. declared zones scored withgetModularity, plus per-zone cohesion share. Reproduces 0.373 (declared) vs 0.564 (detected) modularity and the five lowest per-zone shares (kernel 26%, contracts 29%, sdk 31%, (root) 37%, host-kit 38%).
Nothing in scripts/layering/ or scripts/check-affected/ reads these fields — no gate behavior changed. getModularity wants Community<N> (full node objects) but getLouvainCommunities returns bare ids; computeCohesionSummary maps ids back onto the graph's own nodes once, in the owning module, rather than at each call site (this mismatch is also one of the four upstream @statelyai/graph issues deliverable 2 of #3283 covers — not yet filed this round, tracked separately in #3283).
7 files touched, +506/-10 lines (git diff --stat), within budget.
pnpm depgraph
pnpm depgraph --dominator-entry src/cli/entry.ts
Validation
Tested at 8368e7b67:
pnpm depgraph:test— 37/37 pass (newstructure-summary.test.tswired into the script's explicit file list).pnpm check:quick(lint + typecheck) — clean.pnpm check:affected --run— all runnable checks passed (includingfallow audit, which initially flaggedmain's cyclomatic complexity inbuild.ts; fixed by extracting aflagValuehelper, then clean).- Manual run of
pnpm depgraphagainst the current tree reproduces every number #3276 quotes, as evidence the new code measures what it claims to.
No device-facing or routing changes; docs-only risk is the README section added for the new fields.