Expand description
§sdivi-core
Pure-compute facade for the Structural Divergence Indexer (sdivi-rust).
This crate is the stable, WASM-compatible public surface for embedding the
analysis pipeline in Rust programs, WASM bindings, and language bindings.
It has no I/O, no clock, no tree-sitter, and no std::fs — callers
supply pre-extracted data via the *Input struct family and receive
plain serde result types.
Embedders that need the full FS-orchestrated pipeline (parsing, snapshot
writes, retention) should use sdivi-pipeline instead.
§Quick start
use sdivi_core::ExitCode;
assert_eq!(ExitCode::Success as i32, 0);§Pure-compute example
use sdivi_core::compute::coupling::compute_coupling_topology;
use sdivi_core::input::DependencyGraphInput;
let g = DependencyGraphInput { nodes: vec![], edges: vec![] };
let result = compute_coupling_topology(&g).unwrap();
assert_eq!(result.node_count, 0);Re-exports§
pub use categories::list_categories;pub use categories::CategoryCatalog;pub use categories::CategoryInfo;pub use categories::CATEGORIES;pub use error::AnalysisError;pub use exit_code::ExitCode;pub use input::edge_weight_key;pub use input::split_edge_weight_key;pub use input::validate_node_id;pub use input::BoundaryDefInput;pub use input::BoundarySpecInput;pub use input::ChangeCouplingConfigInput;pub use input::CoChangeEventInput;pub use input::DependencyGraphInput;pub use input::EdgeInput;pub use input::LeidenConfigInput;pub use input::NodeInput;pub use input::NormalizeNode;pub use input::PatternInstanceInput;pub use input::PatternLocationInput;pub use input::PriorPartition;pub use input::QualityFunctionInput;pub use input::ThresholdOverrideInput;pub use input::ThresholdsInput;pub use compute::boundaries::compute_boundary_violations;pub use compute::boundaries::detect_boundaries;pub use compute::boundaries::BoundaryDetectionResult;pub use compute::boundaries::BoundaryViolationResult;pub use compute::change_coupling::compute_change_coupling;pub use compute::coupling::compute_coupling_topology;pub use compute::coupling::CouplingTopologyResult;pub use compute::normalize::normalize_and_hash;pub use compute::patterns::compute_pattern_metrics;pub use compute::patterns::compute_pattern_metrics_from_catalog;pub use compute::thresholds::compute_thresholds_check;pub use compute::thresholds::AppliedOverrideInfo;pub use compute::thresholds::ThresholdBreachInfo;pub use compute::thresholds::ThresholdCheckResult;pub use compute::thresholds::THRESHOLD_EPSILON;
Modules§
- categories
- Pattern category contract — canonical category list and runtime discovery via
list_categories. Canonical pattern-category contract for sdivi-rustsnapshot_version "1.0". - compute
- Pure-compute functions over
inputstructs. Pure-compute functions — all referentially transparent, WASM-compatible. - error
- Errors produced by the sdivi-core pure-compute API.
- exit_
code - Exit codes for the
sdivibinary — public API, adding variants is a breaking change. - facade
- Re-exports of snapshot assembly, delta, trend, and boundary inference from
sdivi-snapshot. Re-exports of snapshot-layer functions for convenience. - input
- Input structs for the pure-compute API (WASM-safe serde types). Input structs for the pure-compute API.
- prelude
- Commonly-imported items from sdivi-core.
Structs§
- Boundary
Inference Result - Result of
infer_boundaries. - Boundary
Proposal - A proposed boundary derived from consecutive-snapshot community stability.
- Change
Coupling Result - Result of the change-coupling analysis for one snapshot.
- CoChange
Pair - A single file-pair that co-changes above the configured minimum frequency.
- Divergence
Summary - Per-dimension divergence between two consecutive
Snapshots. - Graph
Metrics - Graph metrics summary — re-exported from
sdivi-graphfor WASM embedders. Summary metrics for aDependencyGraph. - Intent
Divergence Info - Intent-divergence summary derived from the caller’s boundary representation.
- Leiden
Partition - Leiden community detection result — re-exported from
sdivi-detectionfor WASM embedders. The result of a Leiden community detection run. - Pattern
Catalog - Pattern fingerprint catalog — re-exported from
sdivi-patternsfor WASM embedders. Per-category pattern catalog keyed byPatternFingerprint. - Pattern
Fingerprint - Pattern fingerprint type — re-exported from
sdivi-patternsfor WASM embedders. A keyed blake3 digest representing the structural shape of a pattern. - Pattern
Hint Input - Input struct for
classify_hint— re-exported fromsdivi-patternsfor WASM embedders. - Pattern
Metrics Result - Pattern metrics derived from the catalog — carried in every snapshot.
- Pattern
Stats - Pattern fingerprint catalog — re-exported from
sdivi-patternsfor WASM embedders. Aggregated statistics for a single pattern fingerprint within one category. - Snapshot
- A versioned snapshot of all pipeline stage outputs for one point in time.
- Snapshot
Prior Partition - A prior partition supplied to boundary inference.
- Trend
Result - Per-dimension trend data over a window of consecutive snapshots.
Constants§
- FINGERPRINT_
KEY - The fixed
blake3key used for all pattern fingerprints. - SNAPSHOT_
VERSION - Snapshot schema version emitted by sdivi-rust.
Functions§
- assemble_
snapshot - Assemble a
crate::Snapshotfrom pipeline stage outputs. - classify_
hint - Callee-text-aware classification — re-exported from
sdivi-patterns::queries. - compute_
delta - Compute per-dimension divergence between two snapshots.
- compute_
trend - Compute trend statistics over a slice of snapshots.
- infer_
boundaries - Infer boundary proposals from a sequence of prior partitions.
- null_
summary - Return a
crate::DivergenceSummarywith all fieldsNone(first-snapshot path).