Skip to main content

run

Function run 

Source
pub fn run(
    args: Vec<String>,
    ctx: Option<Context>,
) -> Pin<Box<dyn Future<Output = Result<RunStream, Error>> + Send>>
Expand description

Run the CLI command tree.

Clap-parse argv against the SDK’s top-level command surface; TryFrom it into [Request]; resolve Context (caller- supplied or built from env); dispatch through the in-process crate::executor::CliCommandExecutor via the SDK root execute / execute_transform (the latter when the request carries an output transform). Returns a RunStream whose variant reflects that choice.

The instance subprocess subcommand is not handled here — it has its own entry point at [crate::instance::run] because its wire shape (InstanceEmission) differs from ResponseItem. main.rs routes argv[1] == “instance” to that entry directly and writes its own ndjson; ordinary command flows go through this function.

Pre-dispatch failures (clap parse error, arg-conversion error, context build) and child-function errors propagate as the outer Err. On success the caller consumes the stream.