g1t/packages/contracts/src/names.ts
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.
| Initial g1t: services, event bus, intents and attempts | 1 | // Namespaces follow GitHub's rules (no leading, trailing or doubled hyphens), |
| 2 | // so "--" can never appear inside one. | |
| 3 | const NAMESPACE = /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$/; | |
| 4 | const REPO_NAME = /^[a-z0-9._-]{1,100}$/; | |
| 5 | ||
| 6 | /** Routes and reserved words that may not be registered as usernames. */ | |
| 7 | const RESERVED = new Set([ | |
| 8 | "api", "mcp", "login", "logout", "register", "new", "settings", "search", | |
| Workspace names and icons, and a component kit for every control | 9 | "admin", "auth", "pulls", "issues", "verify", "forgot", "reset", "device", "workspaces", "u", "oauth", "assets", "avatars", "docs", "explore", "g1t", "about", "pricing", |
| Initial g1t: services, event bus, intents and attempts | 10 | ]); |
| 11 | ||
| 12 | export function isValidNamespace(value: string): boolean { | |
| 13 | return NAMESPACE.test(value) && !RESERVED.has(value); | |
| 14 | } | |
| 15 | ||
| 16 | export function isValidRepoName(value: string): boolean { | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 17 | return ( |
| 18 | REPO_NAME.test(value) && | |
| 19 | !value.startsWith(".") && | |
| 20 | !value.endsWith(".git") && | |
| 21 | // `/<workspace>/-/…` holds the workspace's own pages. | |
| 22 | value !== "-" | |
| 23 | ); | |
| Initial g1t: services, event bus, intents and attempts | 24 | } |