Skip to main content

Module shape

Module shape 

Source
Expand description

aver shape — module-shape presentation layer.

Stage 1 of issue #232 (0.23 “Shape”) split this file into two tiers:

  • Recognition (aver::analysis::shape) — per-fn facts walk, archetype classifier, call-graph SCC. Stable typed primitives.
  • Presentation (this module) — ModuleShape vector + Kind + verify report + histogram + Layer fingerprint distance + corpus walker + renderer + aver.toml [[shape.layer]] / [[shape.expected]] bridges. Everything the CLI / LSP / JSON consumers see.

The recognition primitives are re-exported below so existing callers (and the research test) keep working through this module during the transition; downstream stages will migrate them to import directly from aver::analysis::shape.

Structs§

CorpusSummary
Per-Kind / per-Layer aggregate over a corpus.
FnShape
Histogram
LayerFingerprint
LayerVerdict
ModuleShape
RenderOptions
ShapeReport
VerifyReport

Enums§

ApiShape
Bucket
Five-bucket histogram a Layer fingerprint is defined against. Mapped from the 14 archetype labels via archetype_to_bucket.
CorpusEntry
Outcome of analyzing a single file inside a corpus walk. Files that fail typecheck or parse get the error attached instead of being silently skipped — the corpus view should show what’s broken.
Entry
Kind
Layer
Purity
StateShape
TypeSurface
VerifyLevel

Functions§

analyze_dir
Walk a directory recursively and analyze every .av file. root is also used as the default module_root for dep resolution — callers that want a different module root can pass it explicitly.
analyze_path
analyze_path_with
Same as analyze_path but lets the caller supply a custom layer fingerprint table + basis label (used by the CLI when aver.toml has [[shape.layer]] overrides).
analyze_source_with
Analyze a source string directly, without touching the filesystem for the entry file. Used by the LSP (editor buffer may differ from on-disk content) and any future embedder that holds the program in memory. module_root resolves depends [...]; file_label is the path string surfaced in the report’s file field; fallback_module_name is used when the source has no module declaration.
archetype_to_bucket
builtin_v0_layer_fingerprints
classify_layer
Nearest fingerprint by Euclidean distance over bucket %. Confidence is (max_dist - chosen_dist) / max_dist, penalized by small total_fns (< 5 fns flattens confidence regardless of fit).
derive_kind
fingerprints_from_config
Built-in v0 fingerprints sourced from the casual single-author corpus measurement that landed on the tweet. Concrete numbers:
render_corpus_json
render_corpus_text
render_json
render_text
summarize_corpus