memstead_cli/commands/gates.rs
1//! `memstead gates` — render the gates brief: the standing of every
2//! schema-declared `transition_requires_checks` gate across the
3//! workspace's mounted mems. The renderer is the shared engine entry
4//! point `Engine::render_gates_brief`, so every consuming surface
5//! serves byte-identical content — the due-brief precedent. There is
6//! deliberately no MCP tool (briefs are the CLI family).
7
8use clap::Args as ClapArgs;
9use serde_json::json;
10
11use crate::output::{print_json, print_markdown};
12use crate::setup::CliContext;
13
14#[derive(ClapArgs, Debug)]
15pub struct Args {
16 /// Restrict the brief to one mem (default: every mounted mem whose
17 /// schema declares a gated transition).
18 #[arg(long)]
19 pub mem: Option<String>,
20}
21
22pub fn run(ctx: &CliContext, args: Args) -> anyhow::Result<()> {
23 let engine = ctx.cli_engine()?;
24 let brief = engine.base().render_gates_brief(args.mem.as_deref());
25 if ctx.json {
26 print_json(&json!({
27 "mem": args.mem,
28 "brief": brief,
29 }))?;
30 } else {
31 print_markdown(&brief);
32 }
33 Ok(())
34}