Skip to content

g1t/apps/web/app/routes/repo/code.tsx

51 lines2,242 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 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";
Rust repos service with shipping; pull requests kept in the model8import { repos } from "../../lib/services.server";
Initial g1t: services, event bus, intents and attempts9import { getViewer, unwrap } from "../../lib/session.server";
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9710import { projectHomepage } from "../../lib/about";
11import { useProject } from "./layout";
Initial g1t: services, event bus, intents and attempts12
Search across all of g1t, Explore, and a command palette13export function meta({ params, ...args }: Route.MetaArgs) {
14 return page(args, { title: `Code · ${params.owner}/${params.repo} · g1t` });
15}
16
Initial g1t: services, event bus, intents and attempts17export async function loader({ params, context }: Route.LoaderArgs) {
18 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 files19 const viewer = getViewer(context);
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9720 const [tree, branches, environments] = await Promise.all([
The code page reads like a forge: a branch menu, search and a Code button above the files21 repos.tree(path, viewer, null, ""),
22 // For the branch menu; the page still shows without it.
23 repos.branches(path, viewer).catch(() => null),
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9724 // For the About sidebar's Deployments panel; null without any.
25 environmentsFor(path, viewer),
The code page reads like a forge: a branch menu, search and a Code button above the files26 ]);
Branches and Tags pages, each file's last commit, and the branch menu on files27 // 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 them28 const lastCommits = lastCommitsFor(path, viewer, null, "");
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9729 const value = unwrap(tree);
30 // The About beside the files, streamed in after them.
31 const about = value.head ? aboutFor(path, viewer, value.repo.id) : null;
Merge checks: statuses and check runs on every commit32 // The latest commit's checks: streamed in beside it.
33 const checks = commitChecksFor(path, viewer, [value.head?.hash]);
34 return { tree: value, branches: branches?.ok ? branches.value : null, lastCommits, about, deployments: environments, checks };
Search across all of g1t, Explore, and a command palette35}
36
Initial g1t: services, event bus, intents and attempts37export default function Code({ loaderData }: Route.ComponentProps) {
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9738 const project = useProject();
39 return (
40 <TreeView
41 tree={loaderData.tree}
42 branches={loaderData.branches}
43 lastCommits={loaderData.lastCommits}
Merge checks: statuses and check runs on every commit44 checks={loaderData.checks}
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9745 about={loaderData.about}
46 canPush={Boolean(project?.access.can.push)}
47 homepage={projectHomepage(project?.project ?? null)}
48 deployments={loaderData.deployments}
49 />
50 );
Initial g1t: services, event bus, intents and attempts51}

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