flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/packages/contracts/src/names.ts

28 lines1,167 bytesCodeBlame

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 attempts1// Namespaces follow GitHub's rules (no leading, trailing or doubled hyphens),
2// so "--" can never appear inside one.
3const NAMESPACE = /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$/;
4const REPO_NAME = /^[a-z0-9._-]{1,100}$/;
5
6/** Routes and reserved words that may not be registered as usernames. */
7const RESERVED = new Set([
8 "api", "mcp", "login", "logout", "register", "new", "settings", "search",
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look9 "admin", "auth", "integrations", "pulls", "issues", "verify", "forgot", "reset", "device", "workspaces", "u", "oauth", "assets", "avatars", "docs", "explore", "g1t", "about", "pricing",
10 // Trust pages on g1t.sh, and names kept for them.
11 "policies", "security", "support", "status", "terms", "privacy", "help", "blog",
12 // Invite links, and the waitlist.
13 "invite", "invites", "waitlist",
Initial g1t: services, event bus, intents and attempts14]);
15
16export function isValidNamespace(value: string): boolean {
17 return NAMESPACE.test(value) && !RESERVED.has(value);
18}
19
20export function isValidRepoName(value: string): boolean {
Agents as a team: lifecycle, merge queue, billing and a new shell21 return (
22 REPO_NAME.test(value) &&
23 !value.startsWith(".") &&
24 !value.endsWith(".git") &&
25 // `/<workspace>/-/…` holds the workspace's own pages.
26 value !== "-"
27 );
Initial g1t: services, event bus, intents and attempts28}