pub fn validate_module_id(module_id: &str) -> Result<(), CliError>Expand description
Validate a module identifier.
§Rules
- Maximum 192 characters (PROTOCOL_SPEC §2.7)
- Matches
^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$ - No leading/trailing dots, no consecutive dots
- Must not start with a digit or uppercase letter
§Errors
Returns CliError::InvalidModuleId on any violation. Top-level CLI
dispatch maps that to exit code 2 (EXIT_INVALID_INPUT).
Cross-SDK note (D10-004): Python validate_module_id calls sys.exit(2)
directly; TypeScript calls process.exit(2). Rust keeps the Result form
so callers can compose with other validation (and so this function is
testable). Production code SHOULD prefer
validate_module_id_or_exit which mirrors the Python/TS observable
behavior — callers that ignore a Result here would silently pass
invalid IDs downstream.