clm-kernel 0.0.22

Cubical Logic Model (CLM) sovereign execution engine, CPN-VM, and Cordis spatiotemporal substrate
Documentation
use std::io::Write;

const JSON_VERSION: &[u8] = concat!(
    "{\n  \"status\": \"success\",\n  \"data\": {\n    \"runtime\": \"rust\",\n    \"version\": \"",
    env!("CARGO_PKG_VERSION"),
    "\",\n    \"layers\": [0, 1, 2, 3, 4, 5],\n    \"blake3\": true,\n    \"features\": [\"cpn_vm\", \"baldwin_algebra\", \"tridb\"]\n  },\n  \"meta\": {\n    \"runtime\": \"rust\",\n    \"version\": \"",
    env!("CARGO_PKG_VERSION"),
    "\"\n  }\n}\n"
)
.as_bytes();

const TEXT_VERSION: &[u8] = concat!(
    "clm (runtime: rust, version: ",
    env!("CARGO_PKG_VERSION"),
    ", layers: [0, 1, 2, 3, 4, 5], blake3: true)\n"
)
.as_bytes();

const CLAP_VERSION: &[u8] = concat!("clm_rust_core ", env!("CARGO_PKG_VERSION"), "\n").as_bytes();

fn main() {
    let mut args = std::env::args_os();
    let _ = args.next();
    let a1 = args.next();
    let a2 = args.next();
    let a3 = args.next();
    let out = match (
        a1.as_deref().and_then(|s| s.to_str()),
        a2.as_deref().and_then(|s| s.to_str()),
        a3,
    ) {
        (Some("version"), Some("--json"), None) | (Some("--json"), Some("version"), None) => JSON_VERSION,
        (Some("version"), None, None) => TEXT_VERSION,
        (Some("--version") | Some("-V") | Some("-v"), None, None) => CLAP_VERSION,
        _ => std::process::exit(clm_rust_core::layer0::runtime_contract::ClmExitCode::ContentMissing.code()),
    };
    let _ = std::io::stdout().write_all(out);
}