Skip to main content

CLI & Dispatch Layer

Architectural Layer: L9 CLI / Interface
Source Directory: src/cli
File Count: 6 source files

Clap 4 argument hierarchy, output formatters, exit codes, and runtime command dispatch.

Module Files & Detailed Reference​

Source FileLinesKey TypesResponsibility
args.rs505AgentArgs, ArtifactArgs, CapabilityArgsClap 4 CLI Command & Argument Hierarchy (CLI-01, CLI-02).
dispatch.rs2301CliDispatcher, CliOutput, CliErrorShared Runtime Application Command Dispatch Layer (CLI-01, CLI-04, D-1...
doctor.rs541DeploymentProbe, DoctorReport, DoctorRunnerModular Doctor Environment Diagnostics Probes (CLI-01, D-20).
exit_codes.rs68M31aExitCodeStable Documented Exit Code Taxonomy (CLI-03, D-18).
mod.rs17Functions/TraitsCLI Command Suite & Application Runtime Interface (CLI-01–CLI-04).
output.rs89NdjsonStreamWriter, TerminalFrame, CliStreamMessageNDJSON Streaming Output & Envelope Formatting (CLI-02, D-18).

src/cli/args.rs​

  • Source Link: src/cli/args.rs on GitHub
  • Lines of Code: 505 (13952 bytes)
  • Runtime Properties: πŸ›‘οΈ Enforces Policy Gate | πŸ›‘ Supports Cancellation Tokens

Primary Responsibility​

Clap 4 CLI Command & Argument Hierarchy (CLI-01, CLI-02).

Types & Trait Declarations​

  • Structs (19): AgentArgs, ArtifactArgs, CapabilityArgs, CheckpointArgs, Cli, ConfigArgs, DeploymentArgs, DoctorArgs, EvalArgs, ExecutionArgs, InitArgs, PolicyArgs, RollbackArgs, RunArgs, SessionArgs, TaskArgs, TelemetryArgs, UpdateArgs, VersionArgs
  • Enums (13): AgentCommands, ArtifactCommands, CapabilityCommands, CheckpointCommands, Commands, ConfigCommands, EvalCommands, ExecutionCommands, OutputFormat, PolicyCommands, SessionCommands, TaskCommands, TelemetryCommands

src/cli/dispatch.rs​

  • Source Link: src/cli/dispatch.rs on GitHub
  • Lines of Code: 2301 (100944 bytes)
  • Runtime Properties: πŸ’Ύ Interacts with SQLite Persistence | πŸ›‘οΈ Enforces Policy Gate | πŸ›‘ Supports Cancellation Tokens

Primary Responsibility​

Shared Runtime Application Command Dispatch Layer (CLI-01, CLI-04, D-18).

Types & Trait Declarations​

  • Structs (2): CliDispatcher, CliOutput
  • Enums (2): CliError, RuntimeCommand

Key Functions & Signatures (15 shown)​

// pub
fn success(text: impl Into<String>, data: serde_json::Value) -> Self;
// pub
fn with_exit_code(mut self, code: i32) -> Self;
// private
fn from(r: crate::telemetry::TelemetryInspectionReport) -> Self;
// private
fn default() -> Self;
// pub
fn new() -> Self;
// pub
fn with_policy_gate(mut self, gate: Arc<dyn PolicyGate>) -> Self;
// pub
fn with_capabilities(mut self, reg: Arc<CapabilityRegistry>) -> Self;
// pub
fn with_event_bus(mut self, bus: Arc<BroadcastEventBus>) -> Self;
// pub
fn with_pool(mut self, pool: SqlitePool) -> Self;
// pub
fn with_mission_repo(mut self, repo: Arc<dyn MissionRepository>) -> Self;
// pub
fn with_execution_run_repo(mut self, repo: Arc<dyn ExecutionRunRepository>) -> Self;
// pub
fn with_checkpoint_manager(mut self, mgr: Arc<CheckpointManager>) -> Self;
// pub
fn with_artifact_store(mut self, store: Arc<dyn ArtifactStore>) -> Self;
// pub
fn with_approval_coordinator(mut self, coord: Arc<ApprovalCoordinator>) -> Self;
// pub
fn with_runtime(mut self, rt: Arc<crate::runtime::AppRuntime>) -> Self;

src/cli/doctor.rs​

Primary Responsibility​

Modular Doctor Environment Diagnostics Probes (CLI-01, D-20).

Types & Trait Declarations​

  • Structs (11): DeploymentProbe, DoctorReport, DoctorRunner, EnvironmentProbe, GitProbe, ModelsProbe, NetworkMcpProbe, PlatformProbe, ProbeResult, SandboxProbe, StorageProbe
  • Enums (2): ProbeCategory, ProbeStatus
  • Traits (1): DoctorProbe

Key Functions & Signatures (15 shown)​

// pub
fn as_str(&self) -> &'static str;
// pub
fn ok(category: ProbeCategory,
name: impl Into<String>,
message: impl Into<String>,) -> Self;
// pub
fn warning(category: ProbeCategory,
name: impl Into<String>,
message: impl Into<String>,
remedia;
// pub
fn error(category: ProbeCategory,
name: impl Into<String>,
message: impl Into<String>,
remediati;
// private
fn category(&self) -> ProbeCategory;
// private
fn name(&self) -> &str;
// private
async fn check(&self) -> ProbeResult;
// private
fn category(&self) -> ProbeCategory;
// private
fn name(&self) -> &str;
// private
async fn check(&self) -> ProbeResult;
// private
fn category(&self) -> ProbeCategory;
// private
fn name(&self) -> &str;
// private
async fn check(&self) -> ProbeResult;
// private
fn category(&self) -> ProbeCategory;
// private
fn name(&self) -> &str;

src/cli/exit_codes.rs​

Primary Responsibility​

Stable Documented Exit Code Taxonomy (CLI-03, D-18).

Types & Trait Declarations​

  • Enums (1): M31aExitCode

Key Functions & Signatures (4 shown)​

// pub
fn as_i32(self) -> i32;
// pub
fn description(&self) -> &'static str;
// private
fn from(code: M31aExitCode) -> Self;
// private
fn from(val: i32) -> Self;

src/cli/mod.rs​

Primary Responsibility​

CLI Command Suite & Application Runtime Interface (CLI-01–CLI-04).


src/cli/output.rs​

Primary Responsibility​

NDJSON Streaming Output & Envelope Formatting (CLI-02, D-18).

Types & Trait Declarations​

  • Structs (2): NdjsonStreamWriter, TerminalFrame
  • Enums (1): CliStreamMessage

Key Functions & Signatures (3 shown)​

// pub
fn new(writer: W) -> Self;
// pub
fn emit(&mut self, message: &CliStreamMessage) -> io::Result<()>;
// pub
fn is_sealed(&self) -> bool;