haematite-cli 0.21.8

The haematite command: serve a store, its door and Studio, answer MCP, query with jq, and host the store's assistant seat
Documentation
use rustix::process::Signal;

pub(super) struct End {
    pub status: i32,
    pub reason: String,
}
impl End {
    pub fn exited(status: i32) -> Self {
        Self {
            status,
            reason: if status == 0 {
                "finished".to_owned()
            } else {
                format!("exited with code {status}")
            },
        }
    }
    pub fn signalled(number: i32) -> Self {
        let name = [
            (Signal::HUP, "SIGHUP"),
            (Signal::INT, "SIGINT"),
            (Signal::QUIT, "SIGQUIT"),
            (Signal::ILL, "SIGILL"),
            (Signal::TRAP, "SIGTRAP"),
            (Signal::ABORT, "SIGABRT"),
            (Signal::BUS, "SIGBUS"),
            (Signal::FPE, "SIGFPE"),
            (Signal::KILL, "SIGKILL"),
            (Signal::SEGV, "SIGSEGV"),
            (Signal::PIPE, "SIGPIPE"),
            (Signal::ALARM, "SIGALRM"),
            (Signal::TERM, "SIGTERM"),
            (Signal::CHILD, "SIGCHLD"),
            (Signal::CONT, "SIGCONT"),
            (Signal::STOP, "SIGSTOP"),
            (Signal::TSTP, "SIGTSTP"),
            (Signal::TTIN, "SIGTTIN"),
            (Signal::TTOU, "SIGTTOU"),
            (Signal::URG, "SIGURG"),
            (Signal::XCPU, "SIGXCPU"),
            (Signal::XFSZ, "SIGXFSZ"),
            (Signal::VTALARM, "SIGVTALRM"),
            (Signal::PROF, "SIGPROF"),
            (Signal::WINCH, "SIGWINCH"),
            (Signal::IO, "SIGIO"),
            (Signal::SYS, "SIGSYS"),
            (Signal::USR1, "SIGUSR1"),
            (Signal::USR2, "SIGUSR2"),
            #[cfg(target_os = "macos")]
            (Signal::EMT, "SIGEMT"),
            #[cfg(target_os = "macos")]
            (Signal::INFO, "SIGINFO"),
        ]
        .into_iter()
        .find_map(|(signal, name)| (signal.as_raw() == number).then_some(name));
        Self {
            status: 128 + number,
            reason: name.map_or_else(
                || format!("stopped by signal {number}"),
                |name| format!("stopped by {name}"),
            ),
        }
    }
    pub fn failed(error: &anyhow::Error) -> Self {
        Self {
            status: 1,
            reason: format!("the seat failed: {error}"),
        }
    }
}