tokmd-core
Clap-free library facade for embedding tokmd workflows in Rust or through FFI-friendly JSON calls.
Overview
This is the Tier 4 crate that exposes the binding-friendly workflow layer. Use it when you want deterministic receipts without depending on the CLI crate or on lower-tier scan/model internals directly.
Installation
For core receipt workflows only:
[]
= "1.8"
If you also want analysis or cockpit workflows, enable the corresponding features:
[]
= { = "1.8", = ["analysis", "cockpit"] }
Rust Workflow Example
#
With the analysis feature enabled, the same facade can drive the effort-aware analysis path:
#
Main Workflows
lang_workflow(scan, lang) -> LangReceiptmodule_workflow(scan, module) -> ModuleReceiptexport_workflow(scan, export) -> ExportReceiptdiff_workflow(settings) -> DiffReceiptanalyze_workflow(scan, analyze) -> AnalysisReceiptwithanalysisfeaturecockpit_workflow(settings) -> CockpitReceiptwithcockpitfeature
All workflows use pure settings types from tokmd_core::settings, so they stay free of clap-specific argument structures.
FFI JSON API
tokmd-core also exposes a single JSON entrypoint for bindings:
#
Supported run_json modes are lang, module, export, analyze, diff, cockpit, and version.
Response shape:
- Success:
{"ok": true, "data": {...}} - Error:
{"ok": false, "error": {"code": "...", "message": "..."}}
Re-exports
For convenience, the crate re-exports:
pub use tokmd_config as config;
pub use tokmd_types as types;
When to Use
- Embedding
tokmdin another Rust tool - Reusing the receipt workflows without the CLI
- Driving the JSON envelope API from Python, Node, or another FFI layer
- Accessing
estimateanalysis or cockpit workflows from Rust with explicit feature flags
License
MIT OR Apache-2.0