source2rosetta/src/lib.rs
Kamal Tufekcic 22ab973f0c
All checks were successful
CI / lint (push) Successful in 16s
CI / fuzz (push) Successful in 2m3s
CI / test (push) Successful in 25s
minor tweaks
2026-08-03 03:59:53 +03:00

63 lines
3.5 KiB
Rust

//! source2rosetta — library crate: the reusable derivation/verification engine behind the CLI.
//!
//! The `source2rosetta` binary (`src/main.rs`) is a thin clap front-end over these modules. Keeping the
//! logic in a library lets the CI pipeline (and tests) link and call it directly instead of shelling
//! out and scraping stdout.
//!
//! # Supported API surface
//! A fork or embedder calls into these. Every engine entry point that needs game-specific knowledge takes
//! an explicit `&profile::GameProfile` — there is NO process-global, so CS2 and Dota can be derived in the
//! same process. (`classify_change_cmd` is the one exception, and takes none because it needs none: it
//! compares two builds of one named library and reads nothing game-specific.)
//! - [`pipeline`] — the pure OFFLINE derivation engine (nothing here attaches to a running server):
//! `corpus_model_cmd` (distill the corpus model, taking a [`pipeline::ClassScope`]), `fold_model_cmd`
//! (roll model N → N+1, over a [`pipeline::CorpusModel`] that [`pipeline::load_model`] reads off disk —
//! the only way to build its first argument), `backfill_cmd` (cross-build name/offset timelines). The
//! derive that consumes a corpus source is reached through `produce::produce_cmd`, which builds one
//! internally from its `--corpus` / `--corpus-model` arguments — `CorpusSource` itself is crate-private.
//! - [`produce`] — CI orchestration + the LIVE half (everything that drives a running server): `produce_cmd`
//! (the whole per-game build — boots its own bots server for validate-live + typed netvars when a game is
//! given), `integration_test_cmd` (the standalone live oracle), `classify_change_cmd` / `filter_corpus_cmd`
//! (the CI branch primitives), `unpack_seed`.
//! - [`profile`] — the per-game knobs: [`profile::GameProfile`] plus the `CS2` / `DOTA` consts. Adding a game is a const here.
//! - [`model`] / [`render`] (re-exported from `source2rosetta-core`) — the canonical derived-gamedata model and its
//! format emitters; the standalone `source2rosetta-gen` binary links just `core`.
//!
//! # Low-level engine (implementation detail)
//! The modules below are the building blocks the API composes (ELF/RTTI/SchemaSystem readers, the fingerprint
//! metric, the sig/abi machinery, the data-parallel primitive). They stay `pub` for the fuzz harness and
//! advanced embedders, but carry NO stability promise — treat them as internal. The name taxonomy is NOT
//! among them: it is crate-private, because the knob a fork retunes is the `GameProfile` vocabulary block
//! those predicates read, not the predicates.
// ---- supported API ----
pub mod pipeline;
pub mod produce;
pub mod profile;
// ---- low-level engine (implementation detail; `pub` only for the fuzz harness, not a stable surface) ----
pub mod abi;
pub mod concmd;
pub mod elf;
pub mod emit;
pub mod fingerprint;
pub mod live;
pub mod locate;
pub mod par;
pub mod prototypes;
pub mod pulse;
pub mod rtti;
pub mod schema;
pub mod sig;
pub mod valvetab;
pub mod vscript;
pub mod xref;
// ---- crate-private ----
// The name taxonomy: every item is `pub(crate)`, so publishing the module published an empty page. The
// per-game vocabulary it reads is the fork-retunable part, and that is already `pub` on `GameProfile`.
mod taxonomy;
// The canonical model + emitters live in the deriver-free `source2rosetta-core` crate; re-export them so
// existing `source2rosetta::{model, render}` paths keep resolving.
pub use source2rosetta_core::{model, render};