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.
| Redraw the opening artwork | 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", | |
| Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036) | 9 | "admin", "auth", "integrations", "pulls", "issues", "verify", "confirm-email", "forgot", "reset", "device", "workspaces", "u", "oauth", "assets", "avatars", "docs", "explore", "about", "pricing", |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 10 | // g1t itself, and the name its agent once went by: everything g1t does is |
| Merge account deletion: soft delete for 30 days, staff restore and purge, ghost for what remains (identity 0037) | 11 | // shown as `g1t`, so nobody else may be called either. `ghost` wrote what |
| 12 | // a deleted account wrote (`GHOST_USERNAME`). | |
| 13 | "g1t", "g1t-agent", "ghost", | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 14 | // Trust pages on g1t.sh, and names kept for them. |
| 15 | "policies", "security", "support", "status", "terms", "privacy", "help", "blog", | |
| 16 | // Invite links, and the waitlist. | |
| 17 | "invite", "invites", "waitlist", | |
| Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040) | 18 | // g1t.sh/invitations: the workspace invitations waiting for an answer. |
| 19 | "invitations", | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 20 | // The container registry, at g1t.sh/v2/. |
| 21 | "v2", | |
| Inbox: a bell in the top bar opens it beside the page, and /inbox holds it all | 22 | // g1t.sh/inbox, and the name it might also go by. |
| 23 | "inbox", "notifications", | |
| Redraw the opening artwork | 24 | ]); |
| 25 | ||
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 26 | /** Whether `value`, whatever its case, is a name nobody can register: a route, or g1t's own. */ |
| 27 | export function isReservedName(value: string): boolean { | |
| 28 | return RESERVED.has(value.trim().toLowerCase()); | |
| 29 | } | |
| 30 | ||
| Redraw the opening artwork | 31 | export function isValidNamespace(value: string): boolean { |
| Merge branch 'worktree-agent-a8385d293d42c913a' | 32 | return isNamespaceShaped(value) && !isReservedName(value); |
| 33 | } | |
| 34 | ||
| 35 | /** | |
| 36 | * Whether `value` has a namespace's shape, reserved or not: what a | |
| 37 | * workspace's old name or an alias staff set (such as `g1t`) can be. | |
| 38 | */ | |
| 39 | export function isNamespaceShaped(value: string): boolean { | |
| 40 | return NAMESPACE.test(value); | |
| Redraw the opening artwork | 41 | } |
| 42 | ||
| One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers | 43 | /** |
| 44 | * Usernames: letters of either case, digits and single hyphens, not | |
| 45 | * starting or ending with a hyphen, 1 to 39 characters, never reserved in | |
| 46 | * any case. The case is kept for showing; everything finds a person by the | |
| 47 | * name lowercased (`canonicalUsername`), so `Ana` and `ana` are one name. | |
| 48 | */ | |
| 49 | const USERNAME = /^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/; | |
| 50 | ||
| 51 | /** The `pattern` a username field takes in a form: the same rule, for the browser. */ | |
| 52 | export const USERNAME_PATTERN = "[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9]))*"; | |
| 53 | ||
| 54 | export function isValidUsername(value: string): boolean { | |
| 55 | const name = value.trim(); | |
| 56 | return USERNAME.test(name) && !isReservedName(name); | |
| 57 | } | |
| 58 | ||
| 59 | /** The name a person is found, linked and mentioned by: lowercased. */ | |
| 60 | export function canonicalUsername(value: string): string { | |
| 61 | return value.trim().toLowerCase(); | |
| 62 | } | |
| 63 | ||
| 64 | /** How a person's username shows: as they wrote it, or as it is kept. */ | |
| 65 | export function shownUsername(person: { username: string; display_username?: string | null; displayUsername?: string | null }): string { | |
| 66 | const display = person.display_username ?? person.displayUsername; | |
| 67 | return display && display.toLowerCase() === person.username.toLowerCase() ? display : person.username; | |
| 68 | } | |
| 69 | ||
| Redraw the opening artwork | 70 | export function isValidRepoName(value: string): boolean { |
| 71 | return ( | |
| 72 | REPO_NAME.test(value) && | |
| 73 | !value.startsWith(".") && | |
| 74 | !value.endsWith(".git") && | |
| 75 | // `/<workspace>/-/…` holds the workspace's own pages. | |
| 76 | value !== "-" | |
| 77 | ); | |
| 78 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.