Skip to main content

ergo_runtime/common/
mod.rs

1pub mod doc_anchor;
2pub mod effect;
3pub mod error_info;
4pub mod errors;
5pub mod intent_id;
6pub mod manifest;
7pub mod value;
8
9pub use doc_anchor::doc_anchor_for_rule;
10pub use effect::{ActionEffect, EffectWrite, IntentField, IntentRecord};
11pub use error_info::{ErrorInfo, Phase, RuleViolation};
12pub use errors::ValidationError;
13pub use intent_id::derive_intent_id;
14pub use manifest::{resolve_manifest_name, ManifestNameError};
15pub use value::{PrimitiveKind, Value, ValueType};
16
17/// Validate that an identifier follows the naming convention:
18/// starts with lowercase ASCII letter, followed by lowercase ASCII
19/// letters, digits, or underscores.
20///
21/// Used across all four registry crates (source, compute, trigger, action)
22/// for primitive ID and version validation.
23pub fn is_valid_id(id: &str) -> bool {
24    let mut chars = id.chars();
25    let Some(first) = chars.next() else {
26        return false;
27    };
28    if !first.is_ascii_lowercase() {
29        return false;
30    }
31    chars.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_')
32}