Expand description
osp-cli exists to keep the canonical osp product surface in one crate.
The point of this crate is not just packaging. It is the place where the product’s main concerns meet: CLI host orchestration, layered config resolution, rendering, REPL integration, completion, plugins, and the pipeline DSL. Keeping those boundaries visible in one crate makes rustdoc a real architecture map instead of a thin wrapper over several mirrored packages.
Start here depending on what you need:
appexists to turn the lower-level pieces into a running CLI or REPL process.cliexists to model the public command-line grammar.configexists to answer what values are legal, where they came from, and what finally wins.completionexists to rank suggestions without depending on terminal state or editor code.replexists to own the interactive shell boundary.dslexists to provide the canonical document-first pipeline language.uiexists to lower structured output into terminal-facing text.pluginexists to treat external command providers as part of the same command surface.servicesandportsexist for smaller embeddable integrations that do not want the whole host stack.apiprovides test-friendly fixtures and lightweight helper adapters rather than a second full integration surface.
Architecture contracts worth keeping stable:
- lower-level modules should not depend on
app completionstays pure and should not start doing network, plugin discovery, or terminal I/Ouirenders structured input but should not become a config-resolver or service-execution layerclidescribes the grammar of the program but does not execute itconfigowns precedence and legality rules so callers do not invent their own merge semantics
Public API shape:
- semantic payload modules such as
guideand most ofcompletionstay intentionally cheap to compose and inspect - host machinery such as
app::App,app::AppBuilder, and runtime state is guided through constructors/builders/accessors rather than compatibility shims or open-ended assembly - each public concept should have one canonical home; duplicate aliases and mirrored module paths are treated as API debt
Guided construction naming:
Type::new(...)is the exact constructor when the caller already knows the required inputsType::builder(...)starts guided construction for heavier host/runtime objects and returns a concreteTypeBuilder- builder setters use
with_*and the terminal step is alwaysbuild() Type::from_*andType::detect()are reserved for derived/probing factories- semantic DSLs may keep domain verbs such as
arg,flag, orsubcommand; thewith_*rule is for guided host configuration, not for every fluent API - avoid abstract “factory builder” layers in the public API; callers should see concrete type-named builders and factories directly
For embedders:
- use
app::Apporapp::AppBuilderfor the full CLI/REPL host - use
app::AppState::builderwhen you need a manual runtime/session snapshot - use
app::UiState::builderandapp::LaunchContext::builderfor the heavier host-building blocks - use
repl::ReplRunConfig::builderandrepl::HistoryConfig::builderwhen embedding the REPL editor surface directly - use
guide::GuideViewandcompletion::CompletionTreeBuilderfor semantic payload generation - use
servicesandportswhen you want narrower integrations instead of the whole host stack
The root crate module tree is the only supported code path. Older mirrored layouts have been removed so rustdoc and the source tree describe the same architecture.
Re-exports§
pub use crate::app::App;pub use crate::app::AppBuilder;pub use crate::app::AppRunner;pub use crate::app::run_from;pub use crate::app::run_process;pub use crate::core::command_policy;
Modules§
- api
- Test-friendly API adapters and mock implementations. Small public fixtures and helpers for embedding and examples.
- app
- Main host-facing entrypoints, runtime state, and session types. The app module exists to turn the library pieces into a running program.
- cli
- Command-line argument types and CLI parsing helpers.
The CLI module exists to define the public command-line grammar of
osp. - completion
- Structured command and pipe completion types. Completion exists to turn a partially typed line plus cursor position into a ranked suggestion set.
- config
- Layered configuration schema, loading, and resolution. Configuration exists so the app can answer three questions consistently: what keys are legal, which source wins, and what file edits are allowed.
- core
- Shared command, output, row, and protocol primitives. Core primitives shared across the rest of the crate.
- dsl
- Canonical pipeline parsing and execution. Canonical document-first pipeline DSL.
- guide
- Structured help/guide view models and conversions. Structured help and guide payload model.
- plugin
- External plugin discovery, protocol, and dispatch support.
The plugin module exists so external commands can participate in
ospwithout becoming a separate execution model everywhere else in the app. - ports
- Service-layer ports used by command execution. Small service-layer ports and helpers.
- repl
- The REPL module exists to own interactive shell behavior that the ordinary CLI host should not know about.
- services
- Library-level service entrypoints built on the core ports. Small embeddable service-layer command surface.
- ui
- Rendering, theming, and structured output helpers. The UI module exists to turn structured output into predictable terminal text, while keeping rendering decisions separate from business logic.
Macros§
Structs§
- Native
Command Catalog Entry - Public metadata snapshot for one registered native command.
- Native
Command Context - Runtime context passed to native command implementations.
- Native
Command Registry - Registry of in-process native commands exposed alongside plugin commands.
Enums§
- Native
Command Outcome - Result of executing a native command.
Traits§
- Native
Command - Trait implemented by in-process commands registered alongside plugins.