mix metastatic.analyze (Metastatic v0.21.0)

View Source

Analyze MetaAST structure and provide detailed metrics.

Pipeline

flowchart LR
    File["Source file"] --> Lang{"Detect<br/>language"}
    Lang --> Build["Builder.from_source<br/>Source -> M1 -> M2"]
    Build --> Doc["Document"]
    Doc --> Inspect["Inspector<br/>layer, depth,<br/>nodes, vars"]
    Doc --> Validate["Validator<br/>mode: strict /<br/>standard / permissive"]
    Inspect --> Report["Metrics Report"]
    Validate --> Report

Usage

mix metastatic.analyze FILE [OPTIONS]

Arguments

  • FILE - Source file to analyze

Options

  • --validate MODE - Validation mode (strict, standard, permissive) [default: standard]
  • --language LANG - Source language (optional, auto-detected from extension)

Examples

Analyze a Python file with standard validation:

mix metastatic.analyze hello.py

Use strict validation (no language_specific nodes allowed):

mix metastatic.analyze hello.py --validate strict

Use permissive validation (allow all constructs):

mix metastatic.analyze hello.py --validate permissive

Metrics Reported

  • Language - Source language
  • Layer - Deepest layer used (core, extended, native)
  • Depth - Maximum AST depth
  • Node Count - Total number of AST nodes
  • Variable Count - Number of unique variables
  • Validation - Conformance status and warnings

Validation Modes

  • strict - No language_specific nodes allowed, must be pure M2
  • standard - Allow language_specific but warn (default)
  • permissive - Allow all constructs without warnings