use anyhow::Result;
use clap::{Args, Subcommand};
#[derive(Args)]
pub struct SelfcheckArgs {
#[command(subcommand)]
check: Check,
}
#[derive(Subcommand)]
enum Check {
Ssr,
}
pub fn run(args: SelfcheckArgs) -> Result<()> {
match args.check {
Check::Ssr => ssr(),
}
}
#[cfg(feature = "ssr")]
fn ssr() -> Result<()> {
use anyhow::Context;
let runtime =
crate::ssr_runtime::SsrRuntime::start(Vec::new()).context("booting the SSR isolate")?;
runtime.shutdown();
println!("mesofact selfcheck: ssr isolate booted");
Ok(())
}
#[cfg(not(feature = "ssr"))]
fn ssr() -> Result<()> {
anyhow::bail!(
"this mesofact was built without the `ssr` feature — there is no V8 tier to check"
)
}