lvd-diagram: A Layer Diagram You Cannot Flatter, and a Volatility Heatmap
lvd-diagram draws layer diagrams from the real dependency graph, and its heatmap overlays git history to show where code changes more than its layer predicts.
The urge on day one of a migration is to start moving files. Resist it. Without a measured picture of where the codebase stands, you cannot choose a first step, you cannot tell whether the second step helped, and you cannot answer the manager who asks how it is going. The book's assessment chapter is about producing that picture before any code moves.
The first task is to extract the dependency graph. Every import, every require call and every dynamic module resolution is an edge between files, or between packages if you prefer a coarser view. Tools such as madge, dependency-cruiser or the book's own lvd-lint can build this graph in minutes, even for codebases of several hundred thousand lines.
Three analyses then do most of the work.
The baselines are the quiet hero. Migration progress is measured against them, and the lvd-metrics trend reports later become the evidence that the effort is paying off.
With the current state written down, map every component to the layer it should live in, using its measured volatility. The gap analysis looks for four kinds of problem.
The result is a prioritised backlog, sequenced by three principles. The first is bottom-up extraction: Schema and Utils have the fewest dependencies and the lowest change rate, so they are the safest start, and each extracted layer is immediately useful to everything above it. The second is risk-adjusted scheduling: the riskier extractions, Resources and Tools, are scheduled when the team has some practice and when pressure to ship features is lowest. The third is continuous verification: after every step, run the linter, the metrics and the existing tests, and treat the step as unfinished until all of them pass.
The roadmap should also record who does the work, whether dedicated engineers or part-timers from feature teams, a calendar with milestones and some slack for surprises, and explicit rollback criteria. The book's examples of such criteria include a test failure rate above a stated limit, or a Change Impact Radius that rises instead of falling. Agreeing on the exit conditions in advance makes it far easier to reverse a step calmly.
An assessment turns "this codebase is a mess" into a list with numbers: how many cycles, which components are in the wrong place, which layers are missing. That list is both the plan and the yardstick. The plan itself is laid out in the nine-step roadmap, and the underlying idea of cycles is explored in detecting dependency cycles.