Skip to content
54 linesCodeBlameRaw

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.

Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request1import type { Route } from "./+types/code";
2import { TreeView } from "../../components/repo-view";
Search across all of g1t, Explore, and a command palette3import { page } from "../../lib/meta";
Merge checks: statuses and check runs on every commit4import { commitChecksFor } from "../../lib/commit-checks.server";
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb975import { aboutFor } from "../../lib/about.server";
6import { environmentsFor } from "../../lib/deployments.server";
Last commits read trees two dozen commits at a time, and the file list waits at most 3 s for them7import { lastCommitsFor } from "../../lib/last-commits.server";
Merge commit authors and hovercards: commits show their accounts, every name opens a card (repos 0016)8import { showOneCommit } from "../../lib/commit-people.server";
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request9import { repos } from "../../lib/services.server";
10import { getViewer, unwrap } from "../../lib/session.server";
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9711import { projectHomepage } from "../../lib/about";
12import { useProject } from "./layout";
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request13
Search across all of g1t, Explore, and a command palette14export function meta({ params, ...args }: Route.MetaArgs) {
15 return page(args, { title: `Code · ${params.owner}/${params.repo} · g1t` });
16}
17
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request18export async function loader({ params, context }: Route.LoaderArgs) {
19 const path = { namespace: params.owner, name: params.repo };
The code page reads like a forge: a branch menu, search and a Code button above the files20 const viewer = getViewer(context);
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9721 const [tree, branches, environments] = await Promise.all([
The code page reads like a forge: a branch menu, search and a Code button above the files22 repos.tree(path, viewer, null, ""),
23 // For the branch menu; the page still shows without it.
24 repos.branches(path, viewer).catch(() => null),
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9725 // For the About sidebar's Deployments panel; null without any.
26 environmentsFor(path, viewer),
The code page reads like a forge: a branch menu, search and a Code button above the files27 ]);
Branches and Tags pages, each file's last commit, and the branch menu on files28 // Each entry's last commit walks history: streamed in after the list.
Last commits read trees two dozen commits at a time, and the file list waits at most 3 s for them29 const lastCommits = lastCommitsFor(path, viewer, null, "");
Merge commit authors and hovercards: commits show their accounts, every name opens a card (repos 0016)30 const found = unwrap(tree);
31 // The latest commit's author, as their account where there is one.
32 const value = { ...found, head: await showOneCommit(found.head) };
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9733 // The About beside the files, streamed in after them.
34 const about = value.head ? aboutFor(path, viewer, value.repo.id) : null;
Merge checks: statuses and check runs on every commit35 // The latest commit's checks: streamed in beside it.
36 const checks = commitChecksFor(path, viewer, [value.head?.hash]);
37 return { tree: value, branches: branches?.ok ? branches.value : null, lastCommits, about, deployments: environments, checks };
Search across all of g1t, Explore, and a command palette38}
39
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request40export default function Code({ loaderData }: Route.ComponentProps) {
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9741 const project = useProject();
42 return (
43 <TreeView
44 tree={loaderData.tree}
45 branches={loaderData.branches}
46 lastCommits={loaderData.lastCommits}
Merge checks: statuses and check runs on every commit47 checks={loaderData.checks}
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9748 about={loaderData.about}
49 canPush={Boolean(project?.access.can.push)}
50 homepage={projectHomepage(project?.project ?? null)}
51 deployments={loaderData.deployments}
52 />
53 );
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request54}

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