monopam: detect Dead_lib — libraries declared in dune but unused in source
A library listed in a stanza's [(libraries ...)] but never referenced
from any module in the same directory is dead — declared but unused.
This is the [hermest]-in-irmin case: dune compiles the stanza happily
(the lib is just transitive baggage) and the previous Missing/Unused
checks never flagged it.
The new check runs per stanza in each [library] / [executable] /
[executables]:
- Read all .ml/.mli files in the stanza's directory and collect
every capitalised-prefix identifier (potential module reference).
- For each [(libraries X)] entry, compute candidate module names:
capitalised name, last dotted segment, the dune internal-name
alias from a sibling [(library (name N) (public_name X))], and
archive-derived names from META (e.g. lambdasoup -> Soup).
- If none of the candidates appear in the source's module-ref set,
flag a Dead_lib issue.
Sub-libraries used only for link-time or setup side-effects are
allow-listed (fmt.tty / logs.cli / eio.unix / ptime.clock.os / wire.stubs
etc.) so they don't generate false positives.
The CLI grows a third "Dead lib" column / line item in the lint output;
summary parts now include "N dead-lib".
Three new tests cover (a) hermest-style dead lib flagged, (b) live lib
with module reference NOT flagged, (c) an existing test asserting
private-stanza missing-dep semantics is unchanged. 420 tests pass.