MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / derive_intent_prefix

Method derive_intent_prefix

atomic-core/src/pristine/vault.rs:359–366  ·  view source on GitHub ↗

Derive an intent prefix from a project directory name. Takes the first 4 alphanumeric characters and uppercases them. Examples: "pi-mono-rs" → "PIMO", "atomic" → "ATOM", "my-app" → "MYAP"

(project_name: &str)

Source from the content-addressed store, hash-verified

357 /// Takes the first 4 alphanumeric characters and uppercases them.
358 /// Examples: "pi-mono-rs" → "PIMO", "atomic" → "ATOM", "my-app" → "MYAP"
359 pub fn derive_intent_prefix(project_name: &str) -> String {
360 project_name
361 .chars()
362 .filter(|c| c.is_alphanumeric())
363 .take(4)
364 .collect::<String>()
365 .to_uppercase()
366 }
367
368 /// Get the next intent ID and advance the counter.
369 /// Returns a string like "PIMO-1", "ATOM-42".

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected