Skip to main content

Crate ortho_config

Crate ortho_config 

Source
Expand description

Core crate for the OrthoConfig configuration framework.

Defines the OrthoConfig trait, error types and sanitization helpers used to layer configuration from the CLI, files and environment. The derive macro lives in the companion ortho_config_macros crate.

Re-exports§

pub use crate::subcommand::SubcmdConfigMerge;serde_json
pub use agent_context::json::serialize_agent_context;serde_json
pub use agent_context::json::serialize_agent_context_pretty;serde_json
pub use agent_context::AGENT_CONTEXT_KIND_SUFFIX;
pub use agent_context::AgentCommand;
pub use agent_context::AgentContext;
pub use agent_context::AgentExample;
pub use agent_context::AgentInput;
pub use agent_context::AgentPolicy;
pub use agent_context::AsyncSubmission;
pub use agent_context::AsyncSubmissionMode;
pub use agent_context::DeliveryRoute;
pub use agent_context::InteractionMode;
pub use agent_context::MutationEffect;
pub use agent_context::ORTHO_AGENT_CONTEXT_SCHEMA_VERSION;
pub use agent_context::PaginationContract;
pub use agent_context::PolicyMode;
pub use agent_context::SkillCommandRef;
pub use agent_context::SkillManifest;
pub use agent_context::SupportDeclaration;
pub use agent_context::agent_context_kind;
pub use docs::CliMetadata;
pub use docs::ConfigDiscoveryMeta;
pub use docs::ConfigFormat;
pub use docs::DefaultValue;
pub use docs::Deprecation;
pub use docs::DocMetadata;
pub use docs::EnvMetadata;
pub use docs::Example;
pub use docs::FieldMetadata;
pub use docs::FileMetadata;
pub use docs::HeadingIds;
pub use docs::Note;
pub use docs::ORTHO_DOCS_IR_VERSION;
pub use docs::OrthoConfigDocs;
pub use docs::OrthoConfigSubcommandDocs;
pub use docs::PathPattern;
pub use docs::PrecedenceMeta;
pub use docs::SectionsMetadata;
pub use docs::SourceKind;
pub use docs::ValueType;
pub use docs::WindowsMetadata;
pub use subcommand::LoadGlobalsAndSelectedSubcommandError;serde_json
pub use subcommand::SelectedSubcommandMerge;serde_json
pub use subcommand::SelectedSubcommandMergeError;serde_json
pub use subcommand::load_globals_and_merge_selected_subcommand;serde_json
pub use subcommand::load_and_merge_subcommand;serde_json
pub use subcommand::load_and_merge_subcommand_for;serde_json
pub use subcommand::load_and_merge_subcommand_for_with_matches;serde_json
pub use subcommand::load_and_merge_subcommand_with_matches;serde_json
pub use declarative::DeclarativeMerge;serde_json
pub use declarative::MergeComposer;serde_json
pub use declarative::MergeLayer;serde_json
pub use declarative::MergeProvenance;serde_json
pub use discovery::ConfigDiscovery;
pub use discovery::ConfigDiscoveryBuilder;
pub use discovery::DiscoveryLayersOutcome;
pub use discovery::DiscoveryLoadOutcome;
pub use discovery::LayerDiscoveryOutcome;
pub use file::FileLayerChain;
pub use file::load_config_file;
pub use file::load_config_file_as_chain;
pub use figment;
pub use serde_json;serde_json
pub use toml;toml
pub use uncased;
pub use xdg;Redox OS or Unix

Modules§

agent_context
Compact machine-readable command context for agent-native CLIs.
declarativeserde_json
Declarative merging primitives used by the derive macro.
discovery
Cross-platform configuration file discovery helpers.
docs
Documentation metadata for OrthoConfig.
file
Helpers for reading configuration files into Figment.
subcommand
Utilities for loading configuration for individual subcommands.

Macros§

langid

Structs§

CsvEnv
Environment provider with CSV list support.
FluentLocalizer
Fluent-powered localiser that layers consumer bundles over embedded defaults.
FluentLocalizerBuilder
Builds a FluentLocalizer.
FormattingIssue
Captures formatting failures encountered when resolving Fluent patterns.
LanguageIdentifier
LanguageIdentifier is a core struct representing a Unicode Language Identifier.
MapEnv
Environment source backed by a fixed set of values.
NoOpLocalizer
Default localiser that declines to translate messages.
PostMergeContext
Context provided to post-merge hooks.
ProcessEnv
Environment source backed by the live process environment.
WithBase
Carrier returned by LocalizeCmd::with_base.

Enums§

FluentBundleSource
Denotes which bundle produced a localisation attempt.
FluentLocalizerError
Errors surfaced when constructing a FluentLocalizer.
OrthoError
Errors that can occur while loading configuration.

Traits§

CliValueExtractorserde_json
Re-export sanitization helpers used to strip None fields and produce a Figment provider.
EnvSource
Read-only environment access used during configuration discovery.
IntoFigmentError
Convert shared Ortho errors into figment::Error for interop in tests and integrations that expect Figment’s error type.
LocalizeCmd
Extension trait that applies a Localizer to a clap::Command tree.
LocalizedParse
Blanket extension trait for parsing any clap::Parser type with localized command metadata and errors.
Localizer
Provides localised strings for user-facing CLI output.
OrthoConfig
Trait implemented for structs that represent application configuration.
OrthoJsonMergeExtserde_json
Extension tailored to mapping serde_json::Error into a merge failure.
OrthoMergeExt
Extension tailored to mapping figment::Error into a merge failure.
OrthoResultExt
Generic extension for mapping any Result<T, E> with E: Into<OrthoError> into an OrthoResult<T>.
PostMergeHook
Hook invoked after declarative layer merging completes.
ResultIntoFigment
Extension to convert Result<T, Arc<OrthoError>> into Result<T, figment::Error>.

Functions§

clap_error_formatter
Builds a formatter suitable for clap::Command::try_get_matches error handling.
is_display_request
Returns true when a clap::Error corresponds to --help or --version.
localize_clap_error
Rewrites a clap error message using the provided localizer.
localize_clap_error_with_command
Rewrites a clap error message, enriching localization arguments with details from the provided ClapCommand where possible.
message_id_for
Builds the Fluent identifier for a command path and suffix.
normalize_prefix
Normalize a prefix by trimming trailing underscores and converting to lowercase ASCII.
parse_localized_command
Parses arguments with a pre-built localized command and localizes parse errors through the supplied localizer.
process_env_source
Return the default process-backed environment source.
sanitize_valueserde_json
Re-export sanitization helpers used to strip None fields and produce a Figment provider.
sanitized_providerserde_json
Re-export sanitization helpers used to strip None fields and produce a Figment provider.
value_without_nonesserde_json
Re-export sanitization helpers used to strip None fields and produce a Figment provider.

Type Aliases§

LocalizationArgs
Arguments forwarded to localisation lookups.
OrthoResult
Canonical result type for public APIs in this crate.
SharedEnvSource
Shorthand for a shared environment source.

Derive Macros§

OrthoConfig
Derive macro for the OrthoConfig trait.
OrthoConfigSubcommandDocs
Derive macro for the ortho_config::docs::OrthoConfigSubcommandDocs trait.