Skip to main content

Crate locode_exec

Crate locode_exec 

Source
Expand description

locode-exec — the minimal headless CLI (Task 14, ADR-0009), as a library.

The crate ships both a binary (the stock CLI) and this lib target so downstream binary crates can reuse the entire CLI — flags, session assembly, stdout discipline, exit codes — while injecting custom providers (ADR-0015):

use locode_exec::{ProviderRegistry, main_with};

fn main() -> std::process::ExitCode {
    main_with(ProviderRegistry::builtin() /* .register("my-wire", …) */)
}

Stdout discipline: stdout carries exactly one machine-readable artifact (the JSON report, the final message, or the JSONL event stream — by --output-format), enforced structurally: the workspace denies print_stdout/print_stderr, and the ONLY allows live in output.rs (Codex-exec’s pattern). All diagnostics go to stderr; exit codes map the run’s terminal status (0 = structured, 1 = fatal, 2 = usage via clap).

Re-exports§

pub use cli::Cli;
pub use cli::Harness;
pub use cli::OutputFormat;

Modules§

cli
clap surface (plan §3.1 + the positional-prompt addendum).
run
Session assembly + drive (plan §3.2): resolve inputs, build host/pack/ provider through the facade, run the engine, emit per --output-format.

Structs§

ProviderRegistry
The --api-schema name space: ordered name → factory entries.

Functions§

main_with
Parse the CLI, install logging, and drive one session to its exit code — the whole binary, minus fn main. Custom providers come in through registry; the stock binary passes ProviderRegistry::builtin.
run_headless
Drive one headless run from an already-parsed Cli — installs logging, builds the runtime, runs the engine, and emits per --output-format.