Files
marqdo-view/src/lib.rs
T
marqdo-view dev df1cf9ec24 feat(PR-04): explicit-run flow, Trace v2 validation and run visualization
- trace.rs: strict Trace v2 validation (schema/product/root_id/analysis_digest,
  known module ids, increasing seq, span bounds) + run states and anchor summaries
- POST /api/run: explicit confirm, CSRF token, Origin/Host checks, JSON limits,
  pure-only mode, one active run, process-group timeout, in-memory run cache
- POST /api/clear-run: session cache cleanup without touching project files
- server-rendered run panel (escaped stdout/stderr, Core error code, public final
  value only, capped event list, truncation/stale/failure states) and inline chips
  anchored to real statement spans; no per-assignment values or memory claims
- page refresh/open never invokes run (tested 10x); rejected requests never spawn
- real Trace v2 goldens (ok/truncated/arity error) from frozen CLI + contract
  and raw-HTTP tests; ADR-0004; docs updated
2026-11-22 11:38:39 +08:00

38 lines
1.1 KiB
Rust

//! marqdo-view library: a single package with one presentation pipeline.
//!
//! Layer direction (RFC-VIEW-0001 §6.1):
//! `CLI/Server → Application → Domain → ProtocolAdapter`, and
//! `Application → Presentation → Renderer → Assets`.
//! `main.rs` is only a dispatcher; integration tests and future server code use
//! this library so there is never a second renderer or a second parser.
pub mod app;
pub mod assets;
pub mod cli;
pub mod core_client;
pub mod document;
pub mod error;
pub mod presentation;
pub mod project;
pub mod render;
pub mod semantic;
pub mod server;
pub mod source_map;
pub mod trace;
pub mod version;
pub use cli::Cli;
pub use error::{ViewError, ViewResult};
/// Dispatch a parsed CLI invocation. Returns the process exit code.
pub fn run(cli: Cli) -> ViewResult<i32> {
let opts = cli.runtime();
cli::validate_bind(&opts.host, opts.unsafe_expose)
.map_err(|detail| ViewError::BindDenied { detail })?;
match cli.command {
Some(cli::Command::Verify(args)) => app::verify(&opts, &args),
Some(cli::Command::Export(args)) => app::export(&opts, &args),
None => app::browse(&opts),
}
}