Skip to main content

hematite/tools/
health.rs

1use chrono;
2use serde_json::{json, Value};
3
4pub async fn execute(_args: &Value) -> Result<String, String> {
5    let now = chrono::Utc::now();
6    let file_count = std::fs::read_dir("src/")
7        .map_err(|e| e.to_string())?
8        .filter(|e| e.is_ok())
9        .count();
10    Ok(json!({
11        "status": "healthy",
12        "engine": "Hematite",
13        "version": crate::HEMATITE_VERSION,
14        "build": crate::hematite_build_descriptor(),
15        "time": format!("{}", now.format("%Y-%m-%d %H:%M:%S UTC")),
16        "src_file_count": file_count
17    })
18    .to_string())
19}