g1t/crates/contracts/src/names.rs
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| API and MCP server, Rust identity service, registration, site redesign | 1 | /// Routes and reserved words that may not be registered as usernames. |
| 2 | const RESERVED: &[&str] = &[ | |
| Workspaces own repositories | 3 | "api", |
| 4 | "mcp", | |
| 5 | "login", | |
| 6 | "logout", | |
| 7 | "register", | |
| 8 | "new", | |
| 9 | "settings", | |
| 10 | "search", | |
| 11 | "admin", | |
| 12 | "auth", | |
| Issues and pull requests replace intents and attempts | 13 | "pulls", |
| 14 | "issues", | |
| Workspaces own repositories | 15 | "oauth", |
| 16 | "assets", | |
| Workspace names and icons, and a component kit for every control | 17 | "avatars", |
| Workspaces own repositories | 18 | "docs", |
| 19 | "explore", | |
| 20 | "g1t", | |
| 21 | "about", | |
| 22 | "pricing", | |
| 23 | "terms", | |
| 24 | "privacy", | |
| 25 | "help", | |
| 26 | "support", | |
| 27 | "status", | |
| 28 | "blog", | |
| 29 | "verify", | |
| 30 | "forgot", | |
| 31 | "reset", | |
| 32 | "device", | |
| 33 | "workspaces", | |
| 34 | "u", | |
| API and MCP server, Rust identity service, registration, site redesign | 35 | ]; |
| 36 | ||
| 37 | /// Namespaces follow GitHub's rules: letters, digits and single hyphens, | |
| 38 | /// not starting or ending with a hyphen, at most 39 characters. | |
| 39 | pub fn is_valid_namespace(value: &str) -> bool { | |
| 40 | let bytes = value.as_bytes(); | |
| 41 | !bytes.is_empty() | |
| 42 | && bytes.len() <= 39 | |
| 43 | && bytes | |
| 44 | .iter() | |
| 45 | .all(|byte| byte.is_ascii_lowercase() || byte.is_ascii_digit() || *byte == b'-') | |
| 46 | && !value.starts_with('-') | |
| 47 | && !value.ends_with('-') | |
| 48 | && !value.contains("--") | |
| 49 | && !RESERVED.contains(&value) | |
| 50 | } | |
| 51 | ||
| 52 | pub fn is_valid_repo_name(value: &str) -> bool { | |
| 53 | !value.is_empty() | |
| 54 | && value.len() <= 100 | |
| 55 | && value.bytes().all(|byte| { | |
| 56 | byte.is_ascii_lowercase() || byte.is_ascii_digit() || matches!(byte, b'.' | b'_' | b'-') | |
| 57 | }) | |
| 58 | && !value.starts_with('.') | |
| 59 | && !value.ends_with(".git") | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 60 | // `/<workspace>/-/…` holds the workspace's own pages. |
| 61 | && value != "-" | |
| API and MCP server, Rust identity service, registration, site redesign | 62 | } |