Skip to content

g1t/apps/web/app/root.tsx

629 lines25,470 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";
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put53import { readCookie } from "./lib/mission";
54import { WORKSPACE_COOKIE, workspaceFor } from "./lib/workspace-choice";
55import { NotFound } from "./components/not-found";
56import { usesAppShell } from "./lib/chrome";
Usage, Billing settings and prepaid AI credit; fixes from the UX audit57import { 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 all58import { billing, inbox, projects } from "./lib/services.server";
Fast pages, required checks on the branch, self-hosted runners, honest incidents59import { countsFor, readableRepos } from "./lib/access.server";
60import { shortCache } from "./lib/cache.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look61import { getViewer, viewerMiddleware } from "./lib/session.server";
Navigation: the workspace's own page with tabs, pins and recent in the sidebar62import { shortcutOf, workspaceProjects } from "./lib/workspace-projects.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look63import { registrationMode } from "./lib/registration.server";
Merge branch 'worktree-agent-aaf03bdceac799c89'64import { addresses } from "./lib/addresses.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look65import { useSignUpCopy } from "./lib/registration";
Usage, Billing settings and prepaid AI credit; fixes from the UX audit66import { RELOADED_KEY, reloadFixes } from "./lib/stale-build";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look67
Initial g1t: services, event bus, intents and attempts68
69export const links: Route.LinksFunction = () => [
The fleet: g1t's new mark70 { rel: "icon", href: "/favicon.ico", sizes: "32x32" },
Initial g1t: services, event bus, intents and attempts71 { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
The fleet: g1t's new mark72 { rel: "icon", type: "image/png", sizes: "192x192", href: "/icon-192.png" },
73 { rel: "apple-touch-icon", href: "/apple-touch-icon.png" },
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look74 // The text and headline faces are wanted on every page, so they start
75 // loading with the stylesheet; mono waits until something uses it.
76 { rel: "preload", href: sansFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
77 { rel: "preload", href: displayFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
Initial g1t: services, event bus, intents and attempts78];
79
80export const middleware: Route.MiddlewareFunction[] = [viewerMiddleware];
81
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put82export async function loader({ context, params, request }: Route.LoaderArgs) {
Agents as a team: lifecycle, merge queue, billing and a new shell83 const user = getViewer(context);
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put84 const chosen = readCookie(request.headers.get("cookie"), WORKSPACE_COOKIE);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look85 // What sign-up buttons say: Request access while g1t is invite-only.
86 const [shell, mode] = await Promise.all([
Usage, Billing settings and prepaid AI credit; fixes from the UX audit87 user
88 ? shellFor(user, params, chosen, context).catch((error: unknown) => {
89 // A sidebar that could not be read is no reason to lose the page,
90 // or to draw it as if they were signed out.
91 console.error("root: the sidebar could not be read", error);
92 return bareShell(user, params, chosen);
93 })
94 : visitorShell(params, context),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look95 user ? Promise.resolve(null) : registrationMode(),
96 ]);
Merge branch 'worktree-agent-aaf03bdceac799c89'97 // Where this g1t lives, for clone lines, agent setup and link previews.
98 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 put99}
100
101/**
102 * The sidebar for someone not signed in: nothing of their own, only the
103 * open counts of the project being looked at. One call, and only in a
104 * project; it answers the same for a private project as a missing one.
105 */
Fast pages, required checks on the branch, self-hosted runners, honest incidents106async 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 put107 const path = params.owner && params.repo ? { namespace: params.owner, name: params.repo } : null;
Fast pages, required checks on the branch, self-hosted runners, honest incidents108 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 put109 return {
110 workspace: null,
111 repos: [],
112 repo: path && counts?.ok ? { ...path, member: false, issues: counts.value.issues, pulls: counts.value.pulls } : null,
113 limit: null,
114 monthUsageMicros: null,
115 };
Initial g1t: services, event bus, intents and attempts116}
117
Usage, Billing settings and prepaid AI credit; fixes from the UX audit118/** The sidebar from what the session already says, with no service asked. */
119function bareShell(user: User, params: { owner?: string; repo?: string }, chosen: string | null): ShellData {
120 return {
121 workspace: workspaceFor(user.workspaces ?? [], chosen, params),
122 repos: [],
123 repo: null,
124 limit: null,
125 monthUsageMicros: null,
126 };
127}
128
Agents as a team: lifecycle, merge queue, billing and a new shell129/**
130 * The sidebar only changes with the workspace or repository being looked
131 * at, or after something was submitted: not on every page within them.
132 */
133export function shouldRevalidate({
134 currentParams,
135 nextParams,
136 formMethod,
137 defaultShouldRevalidate,
138}: ShouldRevalidateFunctionArgs) {
139 if (formMethod && formMethod !== "GET") return defaultShouldRevalidate;
140 return currentParams.owner !== nextParams.owner || currentParams.repo !== nextParams.repo;
141}
142
143/**
Usage, Billing settings and prepaid AI credit; fixes from the UX audit144 * The sidebar: the workspace whose pages or project these are when it is
145 * one of yours, else the one you chose (lib/workspace-choice.ts); its
146 * projects; and the repository being looked at.
Agents as a team: lifecycle, merge queue, billing and a new shell147 */
148async function shellFor(
149 user: User,
150 params: { owner?: string; repo?: string },
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put151 chosen: string | null,
Fast pages, required checks on the branch, self-hosted runners, honest incidents152 context: Route.LoaderArgs["context"],
Agents as a team: lifecycle, merge queue, billing and a new shell153): Promise<ShellData> {
154 const memberships = user.workspaces ?? [];
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put155 const workspace = workspaceFor(memberships, chosen, params);
Agents as a team: lifecycle, merge queue, billing and a new shell156 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 request157 const now = new Date();
158 const monthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)).toISOString();
Fast pages, required checks on the branch, self-hosted runners, honest incidents159 // What the sidebar shows of the workspace changes rarely: kept for a few
160 // seconds per person and workspace, except just after they changed
161 // something (lib/cache.server.ts).
162 const kept = <T,>(what: string, load: () => Promise<T>) =>
163 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 sidebar164 const [listed, counts, status, usage, limit, entitlements, shared, unread, shortcuts] = await Promise.all([
165 // Every project, for the palette and the count; the sidebar lists only
166 // the person's pinned and recent ones (lib/pins.ts).
167 workspace ? workspaceProjects(workspace.slug, user) : Promise.resolve(null),
Fast pages, required checks on the branch, self-hosted runners, honest incidents168 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 processor169 // Whether billing is on, without reading the account: that asks the
170 // card processor about the workspace's cards, too slow for every page.
171 kept("status", () => billing.status()).catch(() => null),
Usage, Billing settings and prepaid AI credit; fixes from the UX audit172 kept(`usage:${monthStart}`, () => billing.usage(workspace!.slug, user, monthStart)).catch(() => null),
Fast pages, required checks on the branch, self-hosted runners, honest incidents173 kept("limit", () => billing.limit(workspace!.slug, user)).catch(() => null),
174 kept("entitlements", () => billing.entitlements(workspace!.slug)).catch(() => null),
175 sharedRepos(user),
Inbox: a bell in the top bar opens it beside the page, and /inbox holds it all176 // The bell's count: one query, never kept, so marking an item shows at once.
177 inbox.counts(user.username).catch(() => null),
Navigation: the workspace's own page with tabs, pins and recent in the sidebar178 // Never kept: opening a project moves it up Recent.
179 workspace ? projects.shortcuts(workspace.slug, user).catch(() => null) : Promise.resolve(null),
Agents as a team: lifecycle, merge queue, billing and a new shell180 ]);
181 return {
182 workspace,
Projects: what a workspace builds and runs, first on every page183 // 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 sidebar184 repos: listed?.ok ? listed.value.map(shortcutOf) : [],
185 pinned: (shortcuts?.pinned ?? []).map(shortcutOf),
186 recent: (shortcuts?.recent ?? []).map(shortcutOf),
Agents as a team: lifecycle, merge queue, billing and a new shell187 repo:
188 path && counts?.ok
189 ? {
190 ...path,
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look191 // Until the repository's own page says what their role is.
192 member: hasAccessIn(user, path.namespace),
Agents as a team: lifecycle, merge queue, billing and a new shell193 issues: counts.value.issues,
194 pulls: counts.value.pulls,
195 }
196 : null,
Billing accounts, terms and enterprises; g1t is no longer free197 // Where the workspace stands against its usage limit, once billing is on.
198 limit:
The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor199 status?.enabled && limit?.ok
Billing accounts, terms and enterprises; g1t is no longer free200 ? {
201 exposureMicros: limit.value.exposureMicros,
202 ceilingMicros: limit.value.ceilingMicros,
203 state: limit.value.state,
204 comped: limit.value.trust === "internal",
205 }
206 : null,
The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor207 free: Boolean(status?.free),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look208 // A spend spike or a hold pauses new compute: the shell says so on every page.
209 compute:
210 workspace && entitlements && (entitlements.paused || entitlements.spike?.status === "open")
211 ? { paused: entitlements.paused, spike: entitlements.spike ?? null, owner: workspace.role === "owner" }
212 : null,
213 shared,
Inbox: a bell in the top bar opens it beside the page, and /inbox holds it all214 inbox: unread,
Usage while free is shown at cost; agents get rustfmt and clippy215 // 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 audit216 // Usage at price, the one figure every page shows.
217 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 shell218 };
219}
220
Usage, Billing settings and prepaid AI credit; fixes from the UX audit221/**
222 * How long the sidebar's workspace answers are kept: as long as someone's
223 * own changes read fresh anyway (lib/perf.ts `PRIMARY_WINDOW_SECONDS`).
224 */
225const SHELL_TTL_MS = 30_000;
Fast pages, required checks on the branch, self-hosted runners, honest incidents226
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look227/** Most repositories listed under Shared with you. */
228const MAX_SHARED = 20;
229
230/**
231 * Repositories shared with the user in workspaces they do not belong to,
232 * by their grants: only those, never the workspace's other repositories.
233 */
234async function sharedRepos(user: User): Promise<ShellData["shared"]> {
235 const outside = new Set(sharedWorkspaces(user));
236 if (outside.size === 0) return [];
237 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 incidents238 const found = await readableRepos(ids, user);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look239 return found
Fast pages, required checks on the branch, self-hosted runners, honest incidents240 .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 look241 .sort((a, b) => `${a.namespace}/${a.name}`.localeCompare(`${b.namespace}/${b.name}`));
242}
243
API and MCP server, Rust identity service, registration, site redesign244function HeaderLink({ to, children }: { to: string; children: React.ReactNode }) {
245 return (
246 <NavLink
247 to={to}
248 className={({ isActive }) =>
249 `rounded-md px-2.5 py-1.5 text-sm transition-colors hover:bg-raised hover:text-fg ${
250 isActive ? "text-fg" : "text-muted"
251 }`
252 }
253 >
254 {children}
255 </NavLink>
256 );
257}
258
Search across all of g1t, Explore, and a command palette259/** What the palette offers someone without the app's sidebar. */
260const PUBLIC_COMMANDS: PaletteCommand[] = [
261 { label: "Explore", hint: "Public projects", to: "/explore", icon: <Compass size={15} /> },
262 { label: "Search g1t", hint: "Repositories, code, issues, people", to: "/search", icon: <Search size={15} /> },
263 { label: "Pricing", to: "/pricing", icon: <CreditCard size={15} /> },
264 { label: "Documentation", to: "https://docs.g1t.sh/", icon: <BookOpen size={15} /> },
265 { label: "Sign in", to: "/login", icon: <LogIn size={15} /> },
266 { label: "Sign up", to: "/register", icon: <Plus size={15} /> },
267];
268
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look269/** Sign up, or Request access while g1t is invite-only. */
270function SignUpButton() {
271 const copy = useSignUpCopy();
272 return <ButtonLink to="/register">{copy.primary}</ButtonLink>;
273}
274
Email verification, password reset, and Git for AI scale positioning275function Header({ user }: { user: User | null | undefined }) {
Acceptance checks in sandboxes, line comments and review verdicts276 const submit = useSubmit();
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look277 const signUp = useSignUpCopy();
Search across all of g1t, Explore, and a command palette278 const [palette, setPalette] = useState(false);
279 usePaletteShortcut(() => setPalette((open) => !open));
280 const params = useParams();
281 const repo = params.owner && params.repo ? `${params.owner}/${params.repo}` : null;
API and MCP server, Rust identity service, registration, site redesign282 return (
283 <header className="sticky top-0 z-40 border-b border-line bg-surface/85 backdrop-blur">
284 <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 look285 <Link to="/" aria-label="g1t home" className="mr-2 flex">
API and MCP server, Rust identity service, registration, site redesign286 <Logo />
287 </Link>
288 <Form action="/search" role="search" className="relative hidden grow sm:block sm:max-w-xs">
289 <Search
290 size={14}
291 className="pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-faint"
292 />
293 <input
294 name="q"
Agents as a team: lifecycle, merge queue, billing and a new shell295 {...notACredential()}
Search across all of g1t, Explore, and a command palette296 placeholder="Search g1t"
297 aria-label="Search g1t"
298 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 redesign299 />
Usage, Billing settings and prepaid AI credit; fixes from the UX audit300 <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 redesign301 </Form>
Search across all of g1t, Explore, and a command palette302 <button
303 type="button"
304 aria-label="Search g1t"
305 onClick={() => setPalette(true)}
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look306 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 palette307 >
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look308 <Search size={18} />
Search across all of g1t, Explore, and a command palette309 </button>
310 <CommandPalette
311 open={palette}
312 onOpenChange={setPalette}
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look313 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 palette314 repo={repo}
315 />
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look316 <nav aria-label="Main" className="hidden items-center gap-0.5 sm:flex">
API and MCP server, Rust identity service, registration, site redesign317 <HeaderLink to="/explore">Explore</HeaderLink>
Prices keep themselves current with what g1t pays318 <HeaderLink to="/pricing">Pricing</HeaderLink>
Docs as their own app; shared theme package319 <HeaderLink to="https://docs.g1t.sh/">Docs</HeaderLink>
API and MCP server, Rust identity service, registration, site redesign320 </nav>
321 <div className="ml-auto flex items-center gap-2">
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look322 {/* On a phone the links fold into one menu, so the bar fits. */}
323 <DropdownMenu>
324 <DropdownMenuTrigger
325 aria-label="Menu"
Usage, Billing settings and prepaid AI credit; fixes from the UX audit326 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 look327 >
328 <Menu size={18} />
329 </DropdownMenuTrigger>
330 <DropdownMenuContent align="end" className="w-52">
331 <DropdownMenuItem asChild className="min-h-11">
332 <Link to="/explore">
333 <Compass />
334 Explore
335 </Link>
336 </DropdownMenuItem>
337 <DropdownMenuItem asChild className="min-h-11">
338 <Link to="/pricing">
339 <CreditCard />
340 Pricing
341 </Link>
342 </DropdownMenuItem>
343 <DropdownMenuItem asChild className="min-h-11">
344 <Link to="https://docs.g1t.sh/">
345 <BookOpen />
346 Docs
347 </Link>
348 </DropdownMenuItem>
349 {!user && (
350 <>
351 <DropdownMenuSeparator />
352 <DropdownMenuItem asChild className="min-h-11">
353 <Link to="/login">
354 <LogIn />
355 Sign in
356 </Link>
357 </DropdownMenuItem>
358 </>
359 )}
360 </DropdownMenuContent>
361 </DropdownMenu>
API and MCP server, Rust identity service, registration, site redesign362 {user ? (
363 <>
364 <Link
365 to="/new"
Projects live: fixes from walking them end to end366 aria-label="New project"
API and MCP server, Rust identity service, registration, site redesign367 className="rounded-md border border-line p-1.5 text-muted transition-colors hover:border-line-strong hover:text-fg"
368 >
369 <Plus size={16} />
370 </Link>
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)371 <DropdownMenu>
372 <DropdownMenuTrigger
373 aria-label="Account menu"
Usage, Billing settings and prepaid AI credit; fixes from the UX audit374 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 redesign375 >
Workspace names and icons, and a component kit for every control376 <Avatar name={user.username} image={user.avatar} size={24} />
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)377 <ChevronDown size={14} className="text-faint" />
378 </DropdownMenuTrigger>
379 <DropdownMenuContent align="end" className="w-56">
380 <DropdownMenuLabel>
381 Signed in as{" "}
382 <span className="font-mono font-medium text-fg">
383 {user.username}
384 </span>
385 </DropdownMenuLabel>
386 <DropdownMenuSeparator />
Workspaces own repositories387 {(user.workspaces ?? []).map((membership) => (
388 <DropdownMenuItem asChild key={membership.slug}>
389 <Link to={`/${membership.slug}`}>
Workspace names and icons, and a component kit for every control390 <Avatar name={membership.slug} image={membership.avatar} size={16} square />
391 <span className="min-w-0 truncate">{membership.name || membership.slug}</span>
Workspaces own repositories392 </Link>
393 </DropdownMenuItem>
394 ))}
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)395 <DropdownMenuItem asChild>
Workspaces own repositories396 <Link to="/workspaces/new">
397 <Plus />
398 New workspace
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)399 </Link>
400 </DropdownMenuItem>
Workspaces own repositories401 <DropdownMenuSeparator />
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)402 <DropdownMenuItem asChild>
403 <Link to="/">
404 <LayoutDashboard />
405 Mission control
406 </Link>
407 </DropdownMenuItem>
408 <DropdownMenuItem asChild>
409 <Link to="/new">
410 <Plus />
Projects live: fixes from walking them end to end411 New project
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)412 </Link>
413 </DropdownMenuItem>
414 <DropdownMenuSeparator />
415 <DropdownMenuItem asChild>
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas416 <Link to="/settings/profile">
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)417 <Settings />
418 Settings
419 </Link>
420 </DropdownMenuItem>
421 <DropdownMenuItem asChild>
Docs as their own app; shared theme package422 <Link to="https://docs.g1t.sh/quickstart/">
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)423 <BookOpen />
424 Documentation
425 </Link>
426 </DropdownMenuItem>
427 <DropdownMenuSeparator />
Acceptance checks in sandboxes, line comments and review verdicts428 {/* Submitted from here: the menu closes on select, and a button
429 that has left the page cannot submit a form. */}
430 <DropdownMenuItem
431 onSelect={() => submit(null, { method: "post", action: "/logout" })}
432 >
433 <LogOut />
434 Sign out
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)435 </DropdownMenuItem>
436 </DropdownMenuContent>
437 </DropdownMenu>
API and MCP server, Rust identity service, registration, site redesign438 </>
439 ) : (
440 <>
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look441 <span className="hidden sm:contents">
442 <HeaderLink to="/login">Sign in</HeaderLink>
443 </span>
444 <SignUpButton />
API and MCP server, Rust identity service, registration, site redesign445 </>
446 )}
447 </div>
448 </div>
449 </header>
450 );
451}
452
Usage, Billing settings and prepaid AI credit; fixes from the UX audit453/**
454 * The root's data as the browser last had it. When a navigation fails in a
455 * way that takes the root's data with it, the error is still drawn in the
456 * person's own frame, signed in, not the visitor's. Never kept on the
457 * server, where one module serves everyone.
458 */
459let lastRoot: Awaited<ReturnType<typeof loader>> | undefined;
460
Initial g1t: services, event bus, intents and attempts461export function Layout({ children }: { children: React.ReactNode }) {
462 // Undefined when the root loader itself failed.
Usage, Billing settings and prepaid AI credit; fixes from the UX audit463 const loaded = useRouteLoaderData<typeof loader>("root");
464 const inBrowser = typeof document !== "undefined";
465 if (loaded && inBrowser) lastRoot = loaded;
466 const root = loaded ?? (inBrowser ? lastRoot : undefined);
Agents as a team: lifecycle, merge queue, billing and a new shell467 const user = root?.user;
Merge branch 'worktree-agent-a985c01f43538af01'468 const { pathname, search } = useLocation();
469 // /verify lands here with ?sent=1 once it has sent the link again.
470 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 quotas471 // Drawn around the error page too: a 404 keeps the sidebar out of a
472 // project or workspace the viewer cannot see.
473 const error = useRouteError();
474 const missing = isRouteErrorResponse(error) && error.status === 404;
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look475 // The billing page shows the full banner itself.
476 const paused = root?.shell?.compute && root.shell.workspace && !pathname.endsWith("/-/billing") && (
Fast pages, required checks on the branch, self-hosted runners, honest incidents477 <SpikeBanner
478 compact
479 slug={root.shell.workspace.slug}
480 entitlements={{ paused: root.shell.compute.paused, spike: root.shell.compute.spike }}
481 owner={root.shell.compute.owner}
482 />
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look483 );
484 const verify = user && !user.verified && (
Agents as a team: lifecycle, merge queue, billing and a new shell485 <Form
486 method="post"
487 action="/verify"
488 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"
489 >
Merge branch 'worktree-agent-a985c01f43538af01'490 <span role="status">
491 {sentAgain
492 ? "We sent the link again. It can take a minute to arrive."
493 : "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 shell494 </span>
Merge branch 'worktree-agent-a985c01f43538af01'495 <SubmitButton
496 name="intent"
497 value="resend-verification"
498 pending="Sending…"
499 className="inline-flex items-center gap-1.5 font-medium underline underline-offset-4 disabled:opacity-50"
500 >
501 {sentAgain ? "Send another" : "Send it again"}
502 </SubmitButton>
Agents as a team: lifecycle, merge queue, billing and a new shell503 </Form>
504 );
Merge branch 'worktree-agent-aca4790ea223aa235'505 const leaving = useLeaving();
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look506 const banner =
507 paused || verify ? (
508 <>
509 {paused}
510 {verify}
511 </>
512 ) : null;
Initial g1t: services, event bus, intents and attempts513 return (
514 <html lang="en">
515 <head>
516 <meta charSet="utf-8" />
517 <meta name="viewport" content="width=device-width, initial-scale=1" />
Dark gray base with lavender as an accent, and a live outcome view for plans518 <meta name="theme-color" content="#0f0f11" />
Put the stylesheet at the top of the head, before React Router's preloads519 {/* The stylesheet before everything React Router preloads, so a slow
520 connection paints sooner (docs/research/css-shipping.md). */}
Give the stylesheet a precedence so React places it before preloads521 <link rel="stylesheet" href={appCss} precedence="default" />
Initial g1t: services, event bus, intents and attempts522 <Meta />
523 <Links />
524 </head>
API and MCP server, Rust identity service, registration, site redesign525 <body className="flex min-h-screen flex-col">
Usage, Billing settings and prepaid AI credit; fixes from the UX audit526 {/* The first stop for the keyboard: past the menus, to the page. */}
527 <a
528 href="#content"
529 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]"
530 >
531 Skip to content
532 </a>
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put533 {root?.shell && usesAppShell(pathname, user != null) ? (
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas534 <AppShell user={user ?? null} shell={root.shell} missing={missing} banner={banner}>
Agents as a team: lifecycle, merge queue, billing and a new shell535 {children}
536 </AppShell>
537 ) : (
538 <>
539 <Progress />
540 <Header user={user} />
541 {banner}
Usage, Billing settings and prepaid AI credit; fixes from the UX audit542 <div id="content" tabIndex={-1} {...leaving} className={`grow outline-none ${leaving.className}`}>
Merge branch 'worktree-agent-aca4790ea223aa235'543 {children}
544 </div>
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look545 <SiteFooter user={user} />
Agents as a team: lifecycle, merge queue, billing and a new shell546 </>
Email verification, password reset, and Git for AI scale positioning547 )}
Initial g1t: services, event bus, intents and attempts548 <ScrollRestoration />
549 <Scripts />
550 </body>
551 </html>
552 );
553}
554
555export default function App() {
556 return <Outlet />;
557}
558
559export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
Usage, Billing settings and prepaid AI credit; fixes from the UX audit560 const location = useLocation();
561 const matches = useMatches();
562 // A tab left open across a deploy: load the address again as a whole
563 // page, once, rather than show an error the reload fixes.
564 const reload = reloadFixes({
565 error,
566 status: isRouteErrorResponse(error) ? error.status : undefined,
567 // The first page a tab loads has the key "default"; a client navigation's is its own.
568 clientNavigation: location.key !== "default",
569 caughtByCatchAll: matches.at(-1)?.id === "routes/not-found",
570 });
571 const href = location.pathname + location.search + location.hash;
572 useEffect(() => {
573 if (!reload) return;
574 try {
575 if (sessionStorage.getItem(RELOADED_KEY) === href) return;
576 sessionStorage.setItem(RELOADED_KEY, href);
577 } catch {
578 // No session storage: reload anyway; a document load never asks again.
579 }
580 window.location.assign(href);
581 }, [reload, href]);
582 if (reload) {
583 return (
584 <main className="mx-auto max-w-xl px-4 py-32 text-center text-sm text-muted" aria-busy="true">
585 <title>Loading · g1t</title>
586 Loading the latest version of g1t…
587 </main>
588 );
589 }
590
API and MCP server, Rust identity service, registration, site redesign591 let title = "Something went wrong";
592 let details = "An unexpected error occurred. Try again in a moment.";
Initial g1t: services, event bus, intents and attempts593 let stack: string | undefined;
594
595 if (isRouteErrorResponse(error)) {
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put596 // The same page for something private and something missing.
Usage, Billing settings and prepaid AI credit; fixes from the UX audit597 if (error.status === 404) {
598 return (
599 <>
600 <title>Not found · g1t</title>
601 <NotFound data={error.data} />
602 </>
603 );
604 }
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put605 if (typeof error.data === "string" && error.data) {
API and MCP server, Rust identity service, registration, site redesign606 details = error.data;
607 }
608 } else if (import.meta.env.DEV && error instanceof Error) {
Initial g1t: services, event bus, intents and attempts609 details = error.message;
610 stack = error.stack;
611 }
612
613 return (
API and MCP server, Rust identity service, registration, site redesign614 <main className="mx-auto max-w-xl px-4 py-32 text-center">
615 <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
616 <p className="mt-3 text-muted">{details}</p>
617 <div className="mt-8">
618 <ButtonLink to="/" variant="quiet">
619 Back to home
620 </ButtonLink>
621 </div>
Initial g1t: services, event bus, intents and attempts622 {stack && (
API and MCP server, Rust identity service, registration, site redesign623 <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 attempts624 <code>{stack}</code>
625 </pre>
626 )}
627 </main>
628 );
629}

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