Orion Variate Engineering
Use this skill for source-accurate work with orion-variate, the Orion crate for variable/value management and environment interpolation.
First Checks
- Locate the crate root. In this workspace it is usually
orion-variate/. - Treat
src/vars/*, crate-root re-exports insrc/lib.rs, and tests as source of truth. AGENTS.mdappears stale for this crate; it mentions modules that are not present. Do not follow it blindly.- Prefer importing public crate-root items:
use orion_variate::{ValueDict, ValueType, EnvEvaluable, ...};. - Verify behavior changes from
orion-variate/withcargo test --all-features -- --test-threads=1.
Current API Facts
- Package version observed:
0.11.2, Rust edition2024. - Core modules are under
src/vars:types,dict,definition,collection,origin,env_eval,global,constraint, anderror. ValueTypeis an untagged serde enum:String,Bool,Number(u64),Float(f64),Ip,Obj(IndexMap<String, ValueType>), andList(Vec<ValueType>).ValueDictstores keys asUpperKey, so insertion normalizes keys to uppercase and lookups are case-insensitive when usingget_case_insensitive.EnvDictis a type alias forValueDict; dictionary variables take precedence over system environment variables.EnvEvaluableconsumesself. Clone first if the original value/dict must be retained.VarCollectiongroups variables byMutability:Immutable,System, andModule(default).VarsResult<T>isResult<T, StructError<VarsReason>>fromorion-error.
Common Workflow
- Use
ValueType::from(...)for simple values andValueObj/ValueVecfor nested structures. - Store config/env values in
ValueDictorEnvDict; useget_case_insensitivefor user-facing keys. - Before interpolation, use
needs_env_eval()andlist_env_vars()when you need validation or diagnostics. - Use
.env_eval(&env_dict)forString,Option<String>,ValueType,ValueDict,OriginValue, andOriginDict. - Use
VarDefinition::from((name, value))plus.with_mut_immutable(),.with_mut_system(), or.with_mut_module()to define configuration variables. - Use
VarCollection::define(vars)to classify variables, thenvalue_dict()and optionally.env_eval(...). - Use
OriginDictwhen source labels and mutability-aware merge behavior matter. - Use
CwdGuard::change(path)for temporary current-directory changes andfind_project_root(_from)for_gal/project.tomldiscovery.
Migration Guardrails
- Prefer
CwdGuardover deprecatedWorkDir. - Prefer
get_case_insensitiveover deprecateducase_get. - Prefer
ValueType::variant_nameover deprecatedtype_name. - Prefer
ValueType::update_from_strover deprecatedupdate_by_str. - Prefer
EnvEvaluableover deprecatedEnvEvalable. - Prefer
find_project_rootandfind_project_root_fromover olderfind_project_definenames. - Prefer
Mutability::module()over deprecatedmodel(). - Prefer
desc()/with_desc(...)over deprecateddesp().
Important Semantics
- Placeholder syntax is
${VAR}and${VAR:default}. A colon in the resolved value, such aspostgresql://..., is valid and must not be treated as a default separator. - Unresolved
${VAR}stays unchanged if no default is provided. ValueMap/ValueDictinterpolation is sequential: later values can reference earlier values added during the same evaluation.ValueDict::merge(&other)does not overwrite existing keys.VarCollection::merge(other)does not overwrite immutable variables, but latersystemandmodulevariables with the same name override within their own group.VarCollection::value_dict()inserts inimmutable -> system -> moduleorder; duplicate names across groups are overwritten by later groups.OriginDict::merge(&other)overwrites an existing value only if the existing value is mutable.- In Rust 2024,
std::env::set_varandremove_varare unsafe; preferEnvDictin examples and tests unless system env interaction is the point.
References
Read references/patterns.md when you need copyable Rust templates, merge examples, or validation commands.