Result of analyze, analyzeFromFiles, and AnalysisSession.query.
Modules sorted alphabetically by path. Diagnostics are query-time
(analysis-pass) diagnostics only when produced by session.query; one-shot
wrappers concatenate ingest + query diagnostics into this same array.
Schema-validated round-trip
The envelope is a Zod schema (AnalyzeResultJson) — both fields default to
[], so JSON.stringify(result, compactReplacer) strips empty arrays on
the wire and AnalyzeResultJson.parse(JSON.parse(json)) restores them.
Consumers programmatically ingesting analysis JSON should parse through the
schema to get defaults restored; raw-JSON consumers (e.g., jq) treat
missing keys as null-equivalent (jq '.diagnostics | length' returns 0
on {}) and don't need the parse step.
Construction sites (one-shot wrappers, session.query) hand back hand-built
objects without re-running .parse() — the inner modules and
diagnostics arrays are already Zod-validated upstream, and the envelope
schema is the type contract, not a validation gate.
See AnalyzeResultJsonWire for the serialized input-side shape published on
virtual:svelte-docinfo.