Expand description
§tokmd-core
Tier 4 (Library Facade)
This crate is the primary library interface for tokmd.
It coordinates scanning, aggregation, and modeling to produce code inventory receipts.
If you are embedding tokmd into another Rust application, depend on this crate
and tokmd-types. Avoid depending on tokmd-scan or tokmd-model directly unless necessary.
§What belongs here
- High-level workflow coordination
- Simplified API for library consumers
- Re-exports for convenience
- FFI-friendly JSON entrypoint
§What does NOT belong here
- CLI argument parsing (use tokmd crate)
- Low-level scanning logic (use tokmd-scan)
- Aggregation details (use tokmd-model)
§Example
use tokmd_core::{lang_workflow, settings::{ScanSettings, LangSettings}};
// Configure scan
let scan = ScanSettings::current_dir();
let lang = LangSettings {
top: 10,
files: true,
..Default::default()
};
// Run pipeline
let receipt = lang_workflow(&scan, &lang).expect("Scan failed");
println!("Scanned {} languages", receipt.report.rows.len());§JSON API (for bindings)
use tokmd_core::ffi::run_json;
let result = run_json("lang", r#"{"paths": ["."], "top": 10}"#);
println!("{}", result);Re-exports§
pub use tokmd_config as config;pub use tokmd_types as types;
Modules§
- error
- Structured error types for binding-friendly API.
- ffi
- FFI-friendly JSON entrypoint for language bindings.
- settings
- Pure settings types for binding-friendly API.
Constants§
- CORE_
SCHEMA_ VERSION - Re-export schema version for bindings.
Functions§
- diff_
workflow - Runs the diff workflow comparing two receipts or paths.
- export_
workflow - Runs the export workflow with pure settings types.
- lang_
workflow - Runs the language summary workflow with pure settings types.
- module_
workflow - Runs the module summary workflow with pure settings types.
- scan_
workflow - Runs the complete scan workflow: Scan -> Model -> Receipt.
- version
- Get the current tokmd version.