flagon-io/g1t

public

Git for AI scale: a forge for thousands of agents working on the same code at once.

g1t/apps/web/app/routes/workspace/layout.tsx

145 lines6,065 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.

Integrations: your own model provider, alerts that open issues, tickets agents read1import { CreditCard, KeyRound, LayoutGrid, Plug, Plus, Settings, Users } from "lucide-react";
A catalogue of model providers, and settings that feel like settings2import { Outlet, data, useLocation, useRouteLoaderData } from "react-router";
Agents as a team: lifecycle, merge queue, billing and a new shell3
4import type { Route } from "./+types/layout";
Social cards for every page: og.g1t.sh5import { page } from "../../lib/meta";
Agents as a team: lifecycle, merge queue, billing and a new shell6import { Avatar, ButtonLink, Pill, TabLink } from "../../components/ui";
Agents and memory, checks and conflicts, profiles, slug renames, custom domains7import { redirectIfRenamed } from "../../lib/renamed.server";
Agents as a team: lifecycle, merge queue, billing and a new shell8import { identity } from "../../lib/services.server";
9import { getViewer, roleIn } from "../../lib/session.server";
10
Social cards for every page: og.g1t.sh11export function meta({ loaderData, params, ...args }: Route.MetaArgs) {
12 return page(args, { title: `${loaderData?.workspace.name ?? params.owner} · g1t` });
Agents as a team: lifecycle, merge queue, billing and a new shell13}
14
Agents and memory, checks and conflicts, profiles, slug renames, custom domains15export async function loader({ params, context, request }: Route.LoaderArgs) {
Agents as a team: lifecycle, merge queue, billing and a new shell16 const workspace = await identity.getWorkspace(params.owner);
Agents and memory, checks and conflicts, profiles, slug renames, custom domains17 if (!workspace) {
18 // A workspace's old name, after a rename: its pages are at the new one.
19 await redirectIfRenamed(request, params.owner);
20 throw data(null, { status: 404 });
21 }
Agents as a team: lifecycle, merge queue, billing and a new shell22 return { workspace, role: roleIn(getViewer(context), workspace.slug) };
23}
24
A catalogue of model providers, and settings that feel like settings25/** A workspace's own pages, each with its title and what it is for. */
26const PAGES: Record<string, { title: string; about: string }> = {
Workspace names and icons, and a component kit for every control27 settings: { title: "General", about: "The workspace's name, icon, address and description." },
A catalogue of model providers, and settings that feel like settings28 people: {
29 title: "Members",
30 about: "Members create repositories, push, manage issues and merge pull requests. Owners also manage members, tokens, billing and integrations.",
31 },
32 tokens: {
33 title: "Access tokens",
34 about: "Tokens that belong to the workspace, not a person: for CI, integrations and agents that work for the whole team.",
35 },
36 usage: { title: "Usage", about: "What the workspace's agents cost, run by run, by repository, pull request and model." },
Secrets and variables: one list, rows per environment, for workflows and deployments37 billing: { title: "Billing and plans", about: "Paid plans, agent credit, and every charge against it." },
Agents and memory, checks and conflicts, profiles, slug renames, custom domains38 agents: {
39 title: "Agent fleet",
40 about: "Every agent at work across the workspace's projects: what each holds, what it is doing now, and what it has cost.",
41 },
42 memory: {
43 title: "Workspace memory",
44 about: "What holds across all of the workspace's projects, given to every agent in every one of them, beside each project's own memory.",
45 },
Webhooks: every event, to your own addresses, signed and retried46 webhooks: {
47 title: "Webhooks",
48 about: "Every repository's events, sent to your own addresses as they happen. A repository can also have its own, under its settings.",
49 },
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs50 secrets: {
51 title: "Secrets and variables",
Secrets and variables: one list, rows per environment, for workflows and deployments52 about: "Shared with every repository, or the ones you link: read by workflows, deployments, or both. A repository's own row of the same key wins.",
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs53 },
A catalogue of model providers, and settings that feel like settings54 integrations: {
55 title: "Integrations",
56 about: "Model providers, alerts and trackers. Secrets are sealed when saved, and agents never see them.",
57 },
58};
59
Agents as a team: lifecycle, merge queue, billing and a new shell60export default function WorkspaceLayout({ loaderData }: Route.ComponentProps) {
61 const { workspace, role } = loaderData;
62 const base = `/${workspace.slug}`;
63 const signedIn = useRouteLoaderData("root")?.user != null;
A catalogue of model providers, and settings that feel like settings64 // The sidebar finds the workspace's pages for someone signed in, so its
65 // pages need a title, not the workspace's whole header again.
66 const page = PAGES[useLocation().pathname.split("/-/")[1]?.split("/")[0] ?? ""];
67 if (signedIn && page) {
68 return (
69 <div className="mx-auto max-w-5xl px-4 py-10 sm:px-8">
70 <header className="mb-8 border-b border-line pb-6">
71 <h1 className="text-2xl font-semibold tracking-tight">{page.title}</h1>
72 <p className="mt-1.5 text-sm text-muted">{page.about}</p>
73 </header>
74 <Outlet />
75 </div>
76 );
77 }
Agents as a team: lifecycle, merge queue, billing and a new shell78 return (
79 <>
80 {/* The workspace's own header band, under the site header. */}
81 <div className="border-b border-line bg-surface/60">
82 <div className="mx-auto max-w-6xl px-4 pt-8">
83 <div className="flex flex-wrap items-center gap-4">
Workspace names and icons, and a component kit for every control84 <Avatar name={workspace.slug} image={workspace.avatar} size={52} square />
Agents as a team: lifecycle, merge queue, billing and a new shell85 <div className="min-w-0 grow">
86 <div className="flex flex-wrap items-center gap-2.5">
87 <h1 className="truncate text-2xl font-semibold tracking-tight">
88 {workspace.name}
89 </h1>
90 {role && <Pill>{role}</Pill>}
91 </div>
92 <p className="font-mono text-sm text-muted">g1t.sh/{workspace.slug}</p>
93 </div>
94 {role && (
95 <ButtonLink to={`/new?workspace=${workspace.slug}`}>
96 <Plus size={15} />
Projects live: fixes from walking them end to end97 New project
Agents as a team: lifecycle, merge queue, billing and a new shell98 </ButtonLink>
99 )}
100 </div>
101 {workspace.description && (
102 <p className="mt-4 max-w-2xl text-sm text-muted">{workspace.description}</p>
103 )}
104 {signedIn ? (
105 <div className="pb-8" />
106 ) : (
107 <nav className="mt-6 flex flex-wrap gap-x-6">
108 <TabLink to={base} end icon={<LayoutGrid size={15} />}>
109 Overview
110 </TabLink>
111 {role && (
112 <>
113 <TabLink
114 to={`${base}/-/people`}
115 icon={<Users size={15} />}
116 count={workspace.memberCount}
117 >
Secrets and variables: one list, rows per environment, for workflows and deployments118 Members
Agents as a team: lifecycle, merge queue, billing and a new shell119 </TabLink>
120 <TabLink to={`${base}/-/tokens`} icon={<KeyRound size={15} />}>
121 Access tokens
122 </TabLink>
123 <TabLink to={`${base}/-/billing`} icon={<CreditCard size={15} />}>
124 Billing
125 </TabLink>
Integrations: your own model provider, alerts that open issues, tickets agents read126 <TabLink to={`${base}/-/integrations`} icon={<Plug size={15} />}>
127 Integrations
128 </TabLink>
Agents as a team: lifecycle, merge queue, billing and a new shell129 </>
130 )}
131 {role === "owner" && (
132 <TabLink to={`${base}/-/settings`} icon={<Settings size={15} />}>
133 Settings
134 </TabLink>
135 )}
136 </nav>
137 )}
138 </div>
139 </div>
140 <div className="mx-auto max-w-6xl px-4 py-8">
141 <Outlet />
142 </div>
143 </>
144 );
145}