Skip to content

g1t/apps/web/app/root.tsx

634 lines25,824 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 attempts1import {
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)2 BookOpen,
3 ChevronDown,
Search across all of g1t, Explore, and a command palette4 Compass,
5 CreditCard,
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)6 LayoutDashboard,
Search across all of g1t, Explore, and a command palette7 LogIn,
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)8 LogOut,
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look9 Menu,
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)10 Plus,
11 Search,
12 Settings,
13} from "lucide-react";
Usage, Billing settings and prepaid AI credit; fixes from the UX audit14import { useEffect, useState } from "react";
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)15import {
Initial g1t: services, event bus, intents and attempts16 Form,
17 isRouteErrorResponse,
18 Link,
19 Links,
20 Meta,
API and MCP server, Rust identity service, registration, site redesign21 NavLink,
Initial g1t: services, event bus, intents and attempts22 Outlet,
23 Scripts,
24 ScrollRestoration,
Agents as a team: lifecycle, merge queue, billing and a new shell25 type ShouldRevalidateFunctionArgs,
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put26 useLocation,
Usage, Billing settings and prepaid AI credit; fixes from the UX audit27 useMatches,
Search across all of g1t, Explore, and a command palette28 useParams,
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas29 useRouteError,
Initial g1t: services, event bus, intents and attempts30 useRouteLoaderData,
Acceptance checks in sandboxes, line comments and review verdicts31 useSubmit,
Initial g1t: services, event bus, intents and attempts32} from "react-router";
33
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look34import { type User, hasAccessIn, sharedWorkspaces } from "@g1t/contracts";
Email verification, password reset, and Git for AI scale positioning35
Initial g1t: services, event bus, intents and attempts36import type { Route } from "./+types/root";
Load the stylesheet first; plain legal contact details37import appCss from "./app.css?url";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look38import displayFont from "@g1t/theme/fonts/bricolage-grotesque-latin.woff2?url";
39import sansFont from "@g1t/theme/fonts/hanken-grotesk-latin.woff2?url";
Initial g1t: services, event bus, intents and attempts40import { Logo } from "./components/logo";
Merge branch 'worktree-agent-a985c01f43538af01'41import { Avatar, ButtonLink, SubmitButton, notACredential } from "./components/ui";
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)42import {
43 DropdownMenu,
44 DropdownMenuContent,
45 DropdownMenuItem,
46 DropdownMenuLabel,
47 DropdownMenuSeparator,
48 DropdownMenuTrigger,
49} from "./components/ui/dropdown-menu";
Merge branch 'worktree-agent-aca4790ea223aa235'50import { AppShell, Progress, type ShellData, useLeaving } from "./components/shell";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look51import { SiteFooter } from "./components/footer";
Fast pages, required checks on the branch, self-hosted runners, honest incidents52import { SpikeBanner } from "./components/spike-banner";
Merge membership: owners, org roles, GitHub's repo roles, privileges, 2FA53import { PolicyNotice } from "./components/policy-notice";
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put54import { readCookie } from "./lib/mission";
55import { WORKSPACE_COOKIE, workspaceFor } from "./lib/workspace-choice";
56import { NotFound } from "./components/not-found";
57import { usesAppShell } from "./lib/chrome";
Usage, Billing settings and prepaid AI credit; fixes from the UX audit58import { CommandPalette, type PaletteCommand, PaletteKey, usePaletteShortcut } from "./components/command-palette";
Inbox: a bell in the top bar opens it beside the page, and /inbox holds it all59import { billing, inbox, projects } from "./lib/services.server";
Fast pages, required checks on the branch, self-hosted runners, honest incidents60import { countsFor, readableRepos } from "./lib/access.server";
61import { shortCache } from "./lib/cache.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look62import { getViewer, viewerMiddleware } from "./lib/session.server";
Navigation: the workspace's own page with tabs, pins and recent in the sidebar63import { shortcutOf, workspaceProjects } from "./lib/workspace-projects.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look64import { registrationMode } from "./lib/registration.server";
Merge branch 'worktree-agent-aaf03bdceac799c89'65import { addresses } from "./lib/addresses.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look66import { useSignUpCopy } from "./lib/registration";
Usage, Billing settings and prepaid AI credit; fixes from the UX audit67import { RELOADED_KEY, reloadFixes } from "./lib/stale-build";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look68
Initial g1t: services, event bus, intents and attempts69
70export const links: Route.LinksFunction = () => [
The fleet: g1t's new mark71 { rel: "icon", href: "/favicon.ico", sizes: "32x32" },
Initial g1t: services, event bus, intents and attempts72 { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
The fleet: g1t's new mark73 { rel: "icon", type: "image/png", sizes: "192x192", href: "/icon-192.png" },
74 { rel: "apple-touch-icon", href: "/apple-touch-icon.png" },
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look75 // The text and headline faces are wanted on every page, so they start
76 // loading with the stylesheet; mono waits until something uses it.
77 { rel: "preload", href: sansFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
78 { rel: "preload", href: displayFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
Initial g1t: services, event bus, intents and attempts79];
80
81export const middleware: Route.MiddlewareFunction[] = [viewerMiddleware];
82
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put83export async function loader({ context, params, request }: Route.LoaderArgs) {
Agents as a team: lifecycle, merge queue, billing and a new shell84 const user = getViewer(context);
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put85 const chosen = readCookie(request.headers.get("cookie"), WORKSPACE_COOKIE);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look86 // What sign-up buttons say: Request access while g1t is invite-only.
87 const [shell, mode] = await Promise.all([
Usage, Billing settings and prepaid AI credit; fixes from the UX audit88 user
89 ? shellFor(user, params, chosen, context).catch((error: unknown) => {
90 // A sidebar that could not be read is no reason to lose the page,
91 // or to draw it as if they were signed out.
92 console.error("root: the sidebar could not be read", error);
93 return bareShell(user, params, chosen);
94 })
95 : visitorShell(params, context),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look96 user ? Promise.resolve(null) : registrationMode(),
97 ]);
Merge branch 'worktree-agent-aaf03bdceac799c89'98 // Where this g1t lives, for clone lines, agent setup and link previews.
99 return { user, shell, inviteOnly: mode !== "open", addresses: addresses() };
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put100}
101
102/**
103 * The sidebar for someone not signed in: nothing of their own, only the
104 * open counts of the project being looked at. One call, and only in a
105 * project; it answers the same for a private project as a missing one.
106 */
Fast pages, required checks on the branch, self-hosted runners, honest incidents107async function visitorShell(params: { owner?: string; repo?: string }, context: Route.LoaderArgs["context"]): Promise<ShellData> {
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put108 const path = params.owner && params.repo ? { namespace: params.owner, name: params.repo } : null;
Fast pages, required checks on the branch, self-hosted runners, honest incidents109 const counts = path ? await countsFor(context, params) : null;
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put110 return {
111 workspace: null,
112 repos: [],
113 repo: path && counts?.ok ? { ...path, member: false, issues: counts.value.issues, pulls: counts.value.pulls } : null,
114 limit: null,
115 monthUsageMicros: null,
116 };
Initial g1t: services, event bus, intents and attempts117}
118
Usage, Billing settings and prepaid AI credit; fixes from the UX audit119/** The sidebar from what the session already says, with no service asked. */
120function bareShell(user: User, params: { owner?: string; repo?: string }, chosen: string | null): ShellData {
121 return {
122 workspace: workspaceFor(user.workspaces ?? [], chosen, params),
123 repos: [],
124 repo: null,
125 limit: null,
126 monthUsageMicros: null,
127 };
128}
129
Agents as a team: lifecycle, merge queue, billing and a new shell130/**
131 * The sidebar only changes with the workspace or repository being looked
132 * at, or after something was submitted: not on every page within them.
133 */
134export function shouldRevalidate({
135 currentParams,
136 nextParams,
137 formMethod,
138 defaultShouldRevalidate,
139}: ShouldRevalidateFunctionArgs) {
140 if (formMethod && formMethod !== "GET") return defaultShouldRevalidate;
141 return currentParams.owner !== nextParams.owner || currentParams.repo !== nextParams.repo;
142}
143
144/**
Usage, Billing settings and prepaid AI credit; fixes from the UX audit145 * The sidebar: the workspace whose pages or project these are when it is
146 * one of yours, else the one you chose (lib/workspace-choice.ts); its
147 * projects; and the repository being looked at.
Agents as a team: lifecycle, merge queue, billing and a new shell148 */
149async function shellFor(
150 user: User,
151 params: { owner?: string; repo?: string },
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put152 chosen: string | null,
Fast pages, required checks on the branch, self-hosted runners, honest incidents153 context: Route.LoaderArgs["context"],
Agents as a team: lifecycle, merge queue, billing and a new shell154): Promise<ShellData> {
155 const memberships = user.workspaces ?? [];
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put156 const workspace = workspaceFor(memberships, chosen, params);
Agents as a team: lifecycle, merge queue, billing and a new shell157 const path = params.owner && params.repo ? { namespace: params.owner, name: params.repo } : null;
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request158 const now = new Date();
159 const monthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)).toISOString();
Fast pages, required checks on the branch, self-hosted runners, honest incidents160 // What the sidebar shows of the workspace changes rarely: kept for a few
161 // seconds per person and workspace, except just after they changed
162 // something (lib/cache.server.ts).
163 const kept = <T,>(what: string, load: () => Promise<T>) =>
164 workspace ? shortCache(`shell:${what}:${user.id}:${workspace.slug}`, SHELL_TTL_MS, load) : Promise.resolve(null);
Navigation: the workspace's own page with tabs, pins and recent in the sidebar165 const [listed, counts, status, usage, limit, entitlements, shared, unread, shortcuts] = await Promise.all([
166 // Every project, for the palette and the count; the sidebar lists only
167 // the person's pinned and recent ones (lib/pins.ts).
168 workspace ? workspaceProjects(workspace.slug, user) : Promise.resolve(null),
Fast pages, required checks on the branch, self-hosted runners, honest incidents169 path ? countsFor(context, params) : Promise.resolve(null),
The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor170 // Whether billing is on, without reading the account: that asks the
171 // card processor about the workspace's cards, too slow for every page.
172 kept("status", () => billing.status()).catch(() => null),
Usage, Billing settings and prepaid AI credit; fixes from the UX audit173 kept(`usage:${monthStart}`, () => billing.usage(workspace!.slug, user, monthStart)).catch(() => null),
Fast pages, required checks on the branch, self-hosted runners, honest incidents174 kept("limit", () => billing.limit(workspace!.slug, user)).catch(() => null),
175 kept("entitlements", () => billing.entitlements(workspace!.slug)).catch(() => null),
176 sharedRepos(user),
Inbox: a bell in the top bar opens it beside the page, and /inbox holds it all177 // The bell's count: one query, never kept, so marking an item shows at once.
178 inbox.counts(user.username).catch(() => null),
Navigation: the workspace's own page with tabs, pins and recent in the sidebar179 // Never kept: opening a project moves it up Recent.
180 workspace ? projects.shortcuts(workspace.slug, user).catch(() => null) : Promise.resolve(null),
Agents as a team: lifecycle, merge queue, billing and a new shell181 ]);
182 return {
183 workspace,
Projects: what a workspace builds and runs, first on every page184 // Projects are what the sidebar lists: what the workspace builds and runs.
Navigation: the workspace's own page with tabs, pins and recent in the sidebar185 repos: listed?.ok ? listed.value.map(shortcutOf) : [],
186 pinned: (shortcuts?.pinned ?? []).map(shortcutOf),
187 recent: (shortcuts?.recent ?? []).map(shortcutOf),
Agents as a team: lifecycle, merge queue, billing and a new shell188 repo:
189 path && counts?.ok
190 ? {
191 ...path,
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look192 // Until the repository's own page says what their role is.
193 member: hasAccessIn(user, path.namespace),
Agents as a team: lifecycle, merge queue, billing and a new shell194 issues: counts.value.issues,
195 pulls: counts.value.pulls,
196 }
197 : null,
Billing accounts, terms and enterprises; g1t is no longer free198 // Where the workspace stands against its usage limit, once billing is on.
199 limit:
The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor200 status?.enabled && limit?.ok
Billing accounts, terms and enterprises; g1t is no longer free201 ? {
202 exposureMicros: limit.value.exposureMicros,
203 ceilingMicros: limit.value.ceilingMicros,
204 state: limit.value.state,
205 comped: limit.value.trust === "internal",
206 }
207 : null,
The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor208 free: Boolean(status?.free),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look209 // A spend spike or a hold pauses new compute: the shell says so on every page.
210 compute:
211 workspace && entitlements && (entitlements.paused || entitlements.spike?.status === "open")
212 ? { paused: entitlements.paused, spike: entitlements.spike ?? null, owner: workspace.role === "owner" }
213 : null,
214 shared,
Inbox: a bell in the top bar opens it beside the page, and /inbox holds it all215 inbox: unread,
Usage while free is shown at cost; agents get rustfmt and clippy216 // While g1t is free every charge is zero, so usage is shown at cost.
Usage, Billing settings and prepaid AI credit; fixes from the UX audit217 // Usage at price, the one figure every page shows.
218 monthUsageMicros: usage?.ok ? (usage.value.free ? usage.value.usedMicros : (usage.value.priceMicros ?? usage.value.spentMicros)) : null,
Agents as a team: lifecycle, merge queue, billing and a new shell219 };
220}
221
Usage, Billing settings and prepaid AI credit; fixes from the UX audit222/**
223 * How long the sidebar's workspace answers are kept: as long as someone's
224 * own changes read fresh anyway (lib/perf.ts `PRIMARY_WINDOW_SECONDS`).
225 */
226const SHELL_TTL_MS = 30_000;
Fast pages, required checks on the branch, self-hosted runners, honest incidents227
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look228/** Most repositories listed under Shared with you. */
229const MAX_SHARED = 20;
230
231/**
232 * Repositories shared with the user in workspaces they do not belong to,
233 * by their grants: only those, never the workspace's other repositories.
234 */
235async function sharedRepos(user: User): Promise<ShellData["shared"]> {
236 const outside = new Set(sharedWorkspaces(user));
237 if (outside.size === 0) return [];
238 const ids = (user.grants ?? []).filter((grant) => outside.has(grant.workspace)).map((grant) => grant.repo_id).slice(0, MAX_SHARED);
Fast pages, required checks on the branch, self-hosted runners, honest incidents239 const found = await readableRepos(ids, user);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look240 return found
Fast pages, required checks on the branch, self-hosted runners, honest incidents241 .map((repo) => ({ namespace: repo.namespace, name: repo.name, isPrivate: repo.isPrivate }))
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look242 .sort((a, b) => `${a.namespace}/${a.name}`.localeCompare(`${b.namespace}/${b.name}`));
243}
244
API and MCP server, Rust identity service, registration, site redesign245function HeaderLink({ to, children }: { to: string; children: React.ReactNode }) {
246 return (
247 <NavLink
248 to={to}
249 className={({ isActive }) =>
250 `rounded-md px-2.5 py-1.5 text-sm transition-colors hover:bg-raised hover:text-fg ${
251 isActive ? "text-fg" : "text-muted"
252 }`
253 }
254 >
255 {children}
256 </NavLink>
257 );
258}
259
Search across all of g1t, Explore, and a command palette260/** What the palette offers someone without the app's sidebar. */
261const PUBLIC_COMMANDS: PaletteCommand[] = [
262 { label: "Explore", hint: "Public projects", to: "/explore", icon: <Compass size={15} /> },
263 { label: "Search g1t", hint: "Repositories, code, issues, people", to: "/search", icon: <Search size={15} /> },
264 { label: "Pricing", to: "/pricing", icon: <CreditCard size={15} /> },
265 { label: "Documentation", to: "https://docs.g1t.sh/", icon: <BookOpen size={15} /> },
266 { label: "Sign in", to: "/login", icon: <LogIn size={15} /> },
267 { label: "Sign up", to: "/register", icon: <Plus size={15} /> },
268];
269
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look270/** Sign up, or Request access while g1t is invite-only. */
271function SignUpButton() {
272 const copy = useSignUpCopy();
273 return <ButtonLink to="/register">{copy.primary}</ButtonLink>;
274}
275
Email verification, password reset, and Git for AI scale positioning276function Header({ user }: { user: User | null | undefined }) {
Acceptance checks in sandboxes, line comments and review verdicts277 const submit = useSubmit();
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look278 const signUp = useSignUpCopy();
Search across all of g1t, Explore, and a command palette279 const [palette, setPalette] = useState(false);
280 usePaletteShortcut(() => setPalette((open) => !open));
281 const params = useParams();
282 const repo = params.owner && params.repo ? `${params.owner}/${params.repo}` : null;
API and MCP server, Rust identity service, registration, site redesign283 return (
284 <header className="sticky top-0 z-40 border-b border-line bg-surface/85 backdrop-blur">
285 <div className="mx-auto flex h-14 max-w-6xl items-center gap-2 px-4">
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look286 <Link to="/" aria-label="g1t home" className="mr-2 flex">
API and MCP server, Rust identity service, registration, site redesign287 <Logo />
288 </Link>
289 <Form action="/search" role="search" className="relative hidden grow sm:block sm:max-w-xs">
290 <Search
291 size={14}
292 className="pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-faint"
293 />
294 <input
295 name="q"
Agents as a team: lifecycle, merge queue, billing and a new shell296 {...notACredential()}
Search across all of g1t, Explore, and a command palette297 placeholder="Search g1t"
298 aria-label="Search g1t"
299 className="w-full rounded-md border border-line bg-bg py-1.5 pr-12 pl-8 text-sm outline-none transition-colors placeholder:text-faint hover:border-line-strong focus:border-accent-dim"
API and MCP server, Rust identity service, registration, site redesign300 />
Usage, Billing settings and prepaid AI credit; fixes from the UX audit301 <PaletteKey className="pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded bg-raised px-1.5 font-mono text-[0.625rem] text-muted ring-1 ring-line" />
API and MCP server, Rust identity service, registration, site redesign302 </Form>
Search across all of g1t, Explore, and a command palette303 <button
304 type="button"
305 aria-label="Search g1t"
306 onClick={() => setPalette(true)}
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look307 className="flex size-10 items-center justify-center rounded-md text-muted transition-colors hover:bg-raised hover:text-fg sm:hidden"
Search across all of g1t, Explore, and a command palette308 >
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look309 <Search size={18} />
Search across all of g1t, Explore, and a command palette310 </button>
311 <CommandPalette
312 open={palette}
313 onOpenChange={setPalette}
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look314 commands={user ? [{ label: "Mission control", to: "/", icon: <LayoutDashboard size={15} /> }, ...PUBLIC_COMMANDS.slice(0, 4)] : PUBLIC_COMMANDS.map((command) => (command.to === "/register" ? { ...command, label: signUp.primary } : command))}
Search across all of g1t, Explore, and a command palette315 repo={repo}
316 />
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look317 <nav aria-label="Main" className="hidden items-center gap-0.5 sm:flex">
API and MCP server, Rust identity service, registration, site redesign318 <HeaderLink to="/explore">Explore</HeaderLink>
Prices keep themselves current with what g1t pays319 <HeaderLink to="/pricing">Pricing</HeaderLink>
Docs as their own app; shared theme package320 <HeaderLink to="https://docs.g1t.sh/">Docs</HeaderLink>
API and MCP server, Rust identity service, registration, site redesign321 </nav>
322 <div className="ml-auto flex items-center gap-2">
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look323 {/* On a phone the links fold into one menu, so the bar fits. */}
324 <DropdownMenu>
325 <DropdownMenuTrigger
326 aria-label="Menu"
Usage, Billing settings and prepaid AI credit; fixes from the UX audit327 className="flex size-10 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-raised hover:text-fg focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-raised data-[state=open]:text-fg sm:hidden"
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look328 >
329 <Menu size={18} />
330 </DropdownMenuTrigger>
331 <DropdownMenuContent align="end" className="w-52">
332 <DropdownMenuItem asChild className="min-h-11">
333 <Link to="/explore">
334 <Compass />
335 Explore
336 </Link>
337 </DropdownMenuItem>
338 <DropdownMenuItem asChild className="min-h-11">
339 <Link to="/pricing">
340 <CreditCard />
341 Pricing
342 </Link>
343 </DropdownMenuItem>
344 <DropdownMenuItem asChild className="min-h-11">
345 <Link to="https://docs.g1t.sh/">
346 <BookOpen />
347 Docs
348 </Link>
349 </DropdownMenuItem>
350 {!user && (
351 <>
352 <DropdownMenuSeparator />
353 <DropdownMenuItem asChild className="min-h-11">
354 <Link to="/login">
355 <LogIn />
356 Sign in
357 </Link>
358 </DropdownMenuItem>
359 </>
360 )}
361 </DropdownMenuContent>
362 </DropdownMenu>
API and MCP server, Rust identity service, registration, site redesign363 {user ? (
364 <>
365 <Link
366 to="/new"
Projects live: fixes from walking them end to end367 aria-label="New project"
API and MCP server, Rust identity service, registration, site redesign368 className="rounded-md border border-line p-1.5 text-muted transition-colors hover:border-line-strong hover:text-fg"
369 >
370 <Plus size={16} />
371 </Link>
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)372 <DropdownMenu>
373 <DropdownMenuTrigger
374 aria-label="Account menu"
Usage, Billing settings and prepaid AI credit; fixes from the UX audit375 className="flex items-center gap-1.5 rounded-md p-1 outline-none transition-colors hover:bg-raised focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-raised"
API and MCP server, Rust identity service, registration, site redesign376 >
Workspace names and icons, and a component kit for every control377 <Avatar name={user.username} image={user.avatar} size={24} />
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)378 <ChevronDown size={14} className="text-faint" />
379 </DropdownMenuTrigger>
380 <DropdownMenuContent align="end" className="w-56">
381 <DropdownMenuLabel>
382 Signed in as{" "}
383 <span className="font-mono font-medium text-fg">
384 {user.username}
385 </span>
386 </DropdownMenuLabel>
387 <DropdownMenuSeparator />
Workspaces own repositories388 {(user.workspaces ?? []).map((membership) => (
389 <DropdownMenuItem asChild key={membership.slug}>
390 <Link to={`/${membership.slug}`}>
Workspace names and icons, and a component kit for every control391 <Avatar name={membership.slug} image={membership.avatar} size={16} square />
392 <span className="min-w-0 truncate">{membership.name || membership.slug}</span>
Workspaces own repositories393 </Link>
394 </DropdownMenuItem>
395 ))}
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)396 <DropdownMenuItem asChild>
Workspaces own repositories397 <Link to="/workspaces/new">
398 <Plus />
399 New workspace
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)400 </Link>
401 </DropdownMenuItem>
Workspaces own repositories402 <DropdownMenuSeparator />
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)403 <DropdownMenuItem asChild>
404 <Link to="/">
405 <LayoutDashboard />
406 Mission control
407 </Link>
408 </DropdownMenuItem>
409 <DropdownMenuItem asChild>
410 <Link to="/new">
411 <Plus />
Projects live: fixes from walking them end to end412 New project
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)413 </Link>
414 </DropdownMenuItem>
415 <DropdownMenuSeparator />
416 <DropdownMenuItem asChild>
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas417 <Link to="/settings/profile">
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)418 <Settings />
419 Settings
420 </Link>
421 </DropdownMenuItem>
422 <DropdownMenuItem asChild>
Docs as their own app; shared theme package423 <Link to="https://docs.g1t.sh/quickstart/">
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)424 <BookOpen />
425 Documentation
426 </Link>
427 </DropdownMenuItem>
428 <DropdownMenuSeparator />
Acceptance checks in sandboxes, line comments and review verdicts429 {/* Submitted from here: the menu closes on select, and a button
430 that has left the page cannot submit a form. */}
431 <DropdownMenuItem
432 onSelect={() => submit(null, { method: "post", action: "/logout" })}
433 >
434 <LogOut />
435 Sign out
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)436 </DropdownMenuItem>
437 </DropdownMenuContent>
438 </DropdownMenu>
API and MCP server, Rust identity service, registration, site redesign439 </>
440 ) : (
441 <>
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look442 <span className="hidden sm:contents">
443 <HeaderLink to="/login">Sign in</HeaderLink>
444 </span>
445 <SignUpButton />
API and MCP server, Rust identity service, registration, site redesign446 </>
447 )}
448 </div>
449 </div>
450 </header>
451 );
452}
453
Usage, Billing settings and prepaid AI credit; fixes from the UX audit454/**
455 * The root's data as the browser last had it. When a navigation fails in a
456 * way that takes the root's data with it, the error is still drawn in the
457 * person's own frame, signed in, not the visitor's. Never kept on the
458 * server, where one module serves everyone.
459 */
460let lastRoot: Awaited<ReturnType<typeof loader>> | undefined;
461
Initial g1t: services, event bus, intents and attempts462export function Layout({ children }: { children: React.ReactNode }) {
463 // Undefined when the root loader itself failed.
Usage, Billing settings and prepaid AI credit; fixes from the UX audit464 const loaded = useRouteLoaderData<typeof loader>("root");
465 const inBrowser = typeof document !== "undefined";
466 if (loaded && inBrowser) lastRoot = loaded;
467 const root = loaded ?? (inBrowser ? lastRoot : undefined);
Agents as a team: lifecycle, merge queue, billing and a new shell468 const user = root?.user;
Merge branch 'worktree-agent-a985c01f43538af01'469 const { pathname, search } = useLocation();
470 // /verify lands here with ?sent=1 once it has sent the link again.
471 const sentAgain = new URLSearchParams(search).get("sent") === "1";
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas472 // Drawn around the error page too: a 404 keeps the sidebar out of a
473 // project or workspace the viewer cannot see.
474 const error = useRouteError();
475 const missing = isRouteErrorResponse(error) && error.status === 404;
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look476 // The billing page shows the full banner itself.
477 const paused = root?.shell?.compute && root.shell.workspace && !pathname.endsWith("/-/billing") && (
Fast pages, required checks on the branch, self-hosted runners, honest incidents478 <SpikeBanner
479 compact
480 slug={root.shell.workspace.slug}
481 entitlements={{ paused: root.shell.compute.paused, spike: root.shell.compute.spike }}
482 owner={root.shell.compute.owner}
483 />
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look484 );
485 const verify = user && !user.verified && (
Agents as a team: lifecycle, merge queue, billing and a new shell486 <Form
487 method="post"
488 action="/verify"
489 className="flex flex-wrap items-center justify-center gap-x-3 gap-y-1 border-b border-warn/30 bg-warn/10 px-4 py-2 text-sm"
490 >
Merge branch 'worktree-agent-a985c01f43538af01'491 <span role="status">
492 {sentAgain
493 ? "We sent the link again. It can take a minute to arrive."
494 : "Confirm your email address to create repositories and push. We sent you a link."}
Agents as a team: lifecycle, merge queue, billing and a new shell495 </span>
Merge branch 'worktree-agent-a985c01f43538af01'496 <SubmitButton
497 name="intent"
498 value="resend-verification"
499 pending="Sending…"
500 className="inline-flex items-center gap-1.5 font-medium underline underline-offset-4 disabled:opacity-50"
501 >
502 {sentAgain ? "Send another" : "Send it again"}
503 </SubmitButton>
Agents as a team: lifecycle, merge queue, billing and a new shell504 </Form>
505 );
Merge membership: owners, org roles, GitHub's repo roles, privileges, 2FA506 // A workspace that requires two-factor authentication of someone who
507 // has not turned it on: they keep their place, and cannot use it yet.
508 const held = user?.held && user.held.length > 0 && pathname !== "/settings/two-factor" && <PolicyNotice held={user.held} />;
Merge branch 'worktree-agent-aca4790ea223aa235'509 const leaving = useLeaving();
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look510 const banner =
Merge membership: owners, org roles, GitHub's repo roles, privileges, 2FA511 paused || verify || held ? (
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look512 <>
513 {paused}
514 {verify}
Merge membership: owners, org roles, GitHub's repo roles, privileges, 2FA515 {held}
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look516 </>
517 ) : null;
Initial g1t: services, event bus, intents and attempts518 return (
519 <html lang="en">
520 <head>
521 <meta charSet="utf-8" />
522 <meta name="viewport" content="width=device-width, initial-scale=1" />
Dark gray base with lavender as an accent, and a live outcome view for plans523 <meta name="theme-color" content="#0f0f11" />
Put the stylesheet at the top of the head, before React Router's preloads524 {/* The stylesheet before everything React Router preloads, so a slow
525 connection paints sooner (docs/research/css-shipping.md). */}
Give the stylesheet a precedence so React places it before preloads526 <link rel="stylesheet" href={appCss} precedence="default" />
Initial g1t: services, event bus, intents and attempts527 <Meta />
528 <Links />
529 </head>
API and MCP server, Rust identity service, registration, site redesign530 <body className="flex min-h-screen flex-col">
Usage, Billing settings and prepaid AI credit; fixes from the UX audit531 {/* The first stop for the keyboard: past the menus, to the page. */}
532 <a
533 href="#content"
534 className="sr-only rounded-md bg-fg px-3 py-2 text-sm font-medium text-bg focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70]"
535 >
536 Skip to content
537 </a>
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put538 {root?.shell && usesAppShell(pathname, user != null) ? (
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas539 <AppShell user={user ?? null} shell={root.shell} missing={missing} banner={banner}>
Agents as a team: lifecycle, merge queue, billing and a new shell540 {children}
541 </AppShell>
542 ) : (
543 <>
544 <Progress />
545 <Header user={user} />
546 {banner}
Usage, Billing settings and prepaid AI credit; fixes from the UX audit547 <div id="content" tabIndex={-1} {...leaving} className={`grow outline-none ${leaving.className}`}>
Merge branch 'worktree-agent-aca4790ea223aa235'548 {children}
549 </div>
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look550 <SiteFooter user={user} />
Agents as a team: lifecycle, merge queue, billing and a new shell551 </>
Email verification, password reset, and Git for AI scale positioning552 )}
Initial g1t: services, event bus, intents and attempts553 <ScrollRestoration />
554 <Scripts />
555 </body>
556 </html>
557 );
558}
559
560export default function App() {
561 return <Outlet />;
562}
563
564export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
Usage, Billing settings and prepaid AI credit; fixes from the UX audit565 const location = useLocation();
566 const matches = useMatches();
567 // A tab left open across a deploy: load the address again as a whole
568 // page, once, rather than show an error the reload fixes.
569 const reload = reloadFixes({
570 error,
571 status: isRouteErrorResponse(error) ? error.status : undefined,
572 // The first page a tab loads has the key "default"; a client navigation's is its own.
573 clientNavigation: location.key !== "default",
574 caughtByCatchAll: matches.at(-1)?.id === "routes/not-found",
575 });
576 const href = location.pathname + location.search + location.hash;
577 useEffect(() => {
578 if (!reload) return;
579 try {
580 if (sessionStorage.getItem(RELOADED_KEY) === href) return;
581 sessionStorage.setItem(RELOADED_KEY, href);
582 } catch {
583 // No session storage: reload anyway; a document load never asks again.
584 }
585 window.location.assign(href);
586 }, [reload, href]);
587 if (reload) {
588 return (
589 <main className="mx-auto max-w-xl px-4 py-32 text-center text-sm text-muted" aria-busy="true">
590 <title>Loading · g1t</title>
591 Loading the latest version of g1t…
592 </main>
593 );
594 }
595
API and MCP server, Rust identity service, registration, site redesign596 let title = "Something went wrong";
597 let details = "An unexpected error occurred. Try again in a moment.";
Initial g1t: services, event bus, intents and attempts598 let stack: string | undefined;
599
600 if (isRouteErrorResponse(error)) {
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put601 // The same page for something private and something missing.
Usage, Billing settings and prepaid AI credit; fixes from the UX audit602 if (error.status === 404) {
603 return (
604 <>
605 <title>Not found · g1t</title>
606 <NotFound data={error.data} />
607 </>
608 );
609 }
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put610 if (typeof error.data === "string" && error.data) {
API and MCP server, Rust identity service, registration, site redesign611 details = error.data;
612 }
613 } else if (import.meta.env.DEV && error instanceof Error) {
Initial g1t: services, event bus, intents and attempts614 details = error.message;
615 stack = error.stack;
616 }
617
618 return (
API and MCP server, Rust identity service, registration, site redesign619 <main className="mx-auto max-w-xl px-4 py-32 text-center">
620 <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
621 <p className="mt-3 text-muted">{details}</p>
622 <div className="mt-8">
623 <ButtonLink to="/" variant="quiet">
624 Back to home
625 </ButtonLink>
626 </div>
Initial g1t: services, event bus, intents and attempts627 {stack && (
API and MCP server, Rust identity service, registration, site redesign628 <pre className="mt-8 overflow-x-auto rounded-lg border border-line p-4 text-left text-xs">
Initial g1t: services, event bus, intents and attempts629 <code>{stack}</code>
630 </pre>
631 )}
632 </main>
633 );
634}

This file's history is long; its oldest lines are credited to the oldest commit read.