Skip to main content

slugify

Function slugify 

Source
pub fn slugify(name: &str) -> String
Expand description

Turn a human name into a filename-safe slug: lowercase, runs of non-[a-z0-9] collapse to a single -, trimmed. Empty → “project”. Matches the supervisor’s filename-safe id alphabet so a project slug is a legal agent id too (Stage 2 derives agent ids from project slugs). Names longer than [SLUG_MAX_LEN] chars are truncated and suffixed with a digest of the full slug, so a long description always yields an id that every CAR surface accepts — including the 128-char peer-name rule registration enforces — and distinct long names stay distinct with collision-resistant odds.