Expand description
Main host-facing entrypoints, runtime state, and session types. The app module exists to turn the library pieces into a running program.
This is the process-facing layer of the crate. It wires together CLI
parsing, config loading, plugin/catalog setup, rendering, and REPL startup
into the public App entrypoints. Lower-level modules like
crate::config, crate::ui, and crate::repl stay reusable because
this module is where the product-level orchestration happens.
Contract:
- this is allowed to depend on the rest of the crate because it is the host composition layer
- the dependency should not point the other way; lower-level modules should
not import
crate::appto get work done
Public API shape:
- most callers should start with
ApporApp::builder - embedders may inspect runtime/session state, but the preferred
construction path still flows through a small number of builders and
constructors here such as
crate::app::AppStateBuilder - lower-level semantic payloads live in modules like
crate::guideandcrate::completion; this module owns the heavier host machinery
Use this module when you want:
- the full CLI / REPL host in-process
- the same dispatch/help/completion/config behavior as
osp - a wrapper crate that injects native commands or product defaults
Skip this module and start lower if you only need:
- LDAP service execution plus DSL stages:
crate::services - rendering rows/documents:
crate::ui - pure completion trees or guide payloads:
crate::completionorcrate::guide
Broad-strokes host flow:
argv / REPL request
│
▼ [ app ] build host state, load config, assemble command catalog
▼ [ dispatch ] choose native or plugin command, run it
▼ [ dsl ] apply trailing pipeline stages to command output
▼ [ ui ] render text to a UiSink or process stdioMost callers only need one of these shapes:
App::run_fromwhen they want a structuredResult<i32>App::run_processwhen they want process-style exit code conversionApp::with_sinkorApp::builderplusAppBuilder::build_with_sinkwhen a test or outer host wants captured stdout/stderr instead of touching process stdiocrate::serviceswhen this full host layer is more machinery than the integration needs
Downstream product-wrapper pattern:
- keep site-specific auth, policy, and integration state in the wrapper
crate rather than in
crate::app - build a
crate::NativeCommandRegistryfor product-specific commands - build one product-owned defaults layer under
extensions.<site>.* - inject both through
App::builder, thenAppBuilder::with_native_commandsandAppBuilder::with_product_defaults - expose a thin product-level
run_processorbuilder()API on top instead of forking generic host behavior
Structs§
- App
- Top-level application entrypoint for CLI and REPL execution.
- AppBuilder
- Builder for configuring an
Appbefore construction. - AppClients
- Long-lived client registries shared across command execution.
- AppRunner
- Reusable runner that keeps an
Apppaired with a borrowed UI sink. - AppRuntime
- Runtime-scoped application state shared across commands.
- AppSession
- Session-scoped REPL state, caches, and prompt metadata.
- AppSession
Builder - Builder for
AppSession. - AppState
- Aggregate application state shared between runtime and session logic.
- AppState
Builder - Builder for
AppState. - Auth
State - Authorization and command-visibility state derived from configuration.
- Buffered
UiSink - Sink that buffers stdout and stderr for assertions and snapshot tests.
- Config
State - Holds the current resolved config plus a monotonic in-memory revision.
- Debug
Timing Badge - Timing badge rendered in the prompt for the most recent command.
- Debug
Timing State - Shared prompt-timing storage that dispatch code can update and prompt rendering can read.
- Last
Failure - Summary of the last failed REPL command.
- Launch
Context - Startup inputs used to assemble runtime services and locate on-disk state.
- Repl
Scope Frame - One entered command scope inside the interactive REPL shell stack.
- Repl
Scope Stack - Nested REPL command-scope stack used for shell-style scoped interaction.
- Runtime
Context - Startup-time selection inputs that shape runtime config resolution.
- StdIo
UiSink - Sink that forwards output directly to the process stdio streams.
- UiState
- Derived presentation/runtime state for the active config snapshot.
Enums§
- Terminal
Kind - Identifies which top-level host surface is currently active.
Traits§
- UiSink
- Terminal-facing output sink for stdout/stderr emission.
Functions§
- run_
from - Runs the top-level CLI entrypoint from an argv-like iterator.
- run_
process - Runs the default application instance and returns a process exit code.
- run_
process_ with_ sink - Runs the default application instance with the provided sink.