MCPcopy Create free account
hub / github.com/AIScientists-Dev/Flowtrace / main

Function main

crates/flowtrace-cli/src/main.rs:295–337  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

293fn ignore_sigpipe() {}
294
295fn main() -> Result<()> {
296 // A normal Unix CLI exits quietly when a downstream consumer closes the pipe
297 // early (a pager quitting, `head`, `| grep -q`); `serve` overrides this below.
298 restore_default_sigpipe();
299
300 let cli = Cli::parse();
301 match cli.cmd {
302 Cmd::DebugWatch { path, debounce_ms } => debug_watch::run(&path, debounce_ms),
303 Cmd::Validate => cmd_validate(),
304 Cmd::Lint => cmd_lint(),
305 Cmd::Show { fmt, downstream } => cmd_show(&fmt, downstream.as_deref()),
306 Cmd::Reply { run } => cmd_reply(run),
307 Cmd::Serve { scope, port, open } => {
308 // Unlike the one-shot CLI commands, the server must survive a client
309 // disconnecting mid-response, so keep SIGPIPE ignored.
310 ignore_sigpipe();
311 let runtime = tokio::runtime::Builder::new_multi_thread()
312 .enable_all()
313 .build()?;
314 runtime.block_on(serve::run(&scope, port, open))
315 }
316 Cmd::Completion { shell } => cmd_completion(&shell),
317 Cmd::Run { action } => cmd_run(action),
318 Cmd::Step {
319 step_id,
320 status,
321 message,
322 assets,
323 run,
324 } => cmd_step(step_id, status, message, assets, run),
325 Cmd::Deliverable {
326 status,
327 message,
328 assets,
329 run,
330 } => cmd_deliverable(status, message, assets, run),
331 Cmd::Explain { path, output } => {
332 print!("{}", explain::explain(&path, output)?);
333 Ok(())
334 }
335 Cmd::Init { slug } => cmd_init(&slug),
336 }
337}
338
339fn cmd_init(slug: &str) -> Result<()> {
340 validate_trace_id(slug)

Callers

nothing calls this directly

Calls 13

restore_default_sigpipeFunction · 0.85
parseFunction · 0.85
cmd_validateFunction · 0.85
cmd_lintFunction · 0.85
cmd_showFunction · 0.85
cmd_replyFunction · 0.85
ignore_sigpipeFunction · 0.85
cmd_completionFunction · 0.85
cmd_runFunction · 0.85
cmd_stepFunction · 0.85
cmd_deliverableFunction · 0.85
cmd_initFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…