v3.2.2
Performance and two silent-failure fixes. No CLI surface change — go install github.com/lockyc/docgraph/v3@latest and existing hooks pick it up as-is.
leaks no longer dominates the run
The leaks check was ~98% of docgraph's runtime on a large repo, which made the
whole pre-push gate feel slow and hid how cheap the doc-graph work actually is.
Measured on a 9.7k-file repo (~1GB tracked, ~14M lines, 14 deny rules): ~25s →
~6s, with the six doc-graph checks at ~0.3s combined either way. Output is
byte-identical.
scanLine was running one FindAllStringIndex per rule per line — ~250M regexp
calls on that repo — and looksBinary only ever inspects a file's first 8000
bytes but was handed the whole file, so every vendored archive was read in full
on every run. Now:
- a whole-file prefilter answers "could any rule match here" in one pass, so the
per-line loop runs only on files with a candidate; - binary-ness is decided from an 8000-byte prefix before the rest is read;
- allow spans are computed on the first deny hit rather than eagerly per line.
The prefilter is deliberately superset-only — narrowing it would mean a missed
leak with a green gate — and three new tests pin that (casing, non-ASCII
literals, matches past the probe window).
Flags after the path are no longer silently dropped
docgraph . --skip leaks parsed . as the path and then ignored --skip and
leaks entirely: the check ran anyway, with no error. Go's flag stops at the
first non-flag argument, and every subcommand had the shape — --range after the
path on footgun-drift / covers-drift / doc-drift, --json / --ref on
graph, --ignore on the views. Generated hooks were unaffected (they put flags
first), but anything hand-typed or scripted was. Flags now parse in either
position.
footgun-drift prints the payload, not the paragraph
The nag echoed each added declaration line verbatim, and a footgun declaration is
often a whole CLAUDE.md paragraph. On one real push, nine findings printed 6.1k
characters of prose around ~270 characters of file:line. The echo only ever
said which declaration — you open the file to judge one — so it is now capped
at 100 runes and the repeated two-question preamble is folded into the header.
Same findings, 7314 → 1767 characters, and they now fit on screen at once.