Expand description
CLI entry orchestrator. The main(args) function that:
- Parses argv (
crate::args::parse_args). - Handles
--help/--version+ parse errors + startup warnings. - Reads piped stdin (non-TTY ⇒ treat as the initial prompt text).
- Expands
@fileattachments into an initial-message text block ([build_initial_message]). - Resolves the provider + model + thinking level (
crate::provider::resolve). - Builds the harness (
crate::session::build). - Resolves the effective run mode (
crate::args::resolve_mode) and dispatches tocrate::modes(print/json/interactive), mapping the outcome to an exit code.
@file expansion covers text files; images are detected but not attached to
the prompt — the harness prompt_text accepts images, but this path does not
yet wire an image processor. Binary/non-UTF-8 files error.
Constants§
- EXIT_
RUNTIME - The exit code for a runtime failure (model-resolution, harness-build, or
run failure). Mirrors TS
process.exitCodeset fromrunPrintMode. - EXIT_
USAGE - The exit code for a usage/parse error. (TS
main.tsusesprocess.exit(1)for most error paths; v1 distinguishes usage errors with the conventional2so scripts can tell “bad invocation” from “run failed”.) - EXIT_
VETOED - The exit code when an extension vetoes startup at a lifecycle event
(e.g. a
BeforeTuiStarthandler returnsrpi_plugin_sdk::EVENT_HANDLER_ABORT). Distinct fromEXIT_RUNTIMEso scripts can tell “an extension refused to start” from “the run itself failed”.
Functions§
- run
- The v1 CLI entry point. Mirrors TS
export async function main(args).