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.
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 1 | import { isCodeownersPath } from "@g1t/contracts"; |
| 2 | ||
| Initial g1t: services, event bus, intents and attempts | 3 | import type { Route } from "./+types/blob"; |
| Social cards for every page: og.g1t.sh | 4 | import { page } from "../../lib/meta"; |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 5 | import { CodeownersFileErrors } from "../../components/codeowners"; |
| Initial g1t: services, event bus, intents and attempts | 6 | import { BlobView } from "../../components/repo-view"; |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 7 | import { highlightLines } from "../../lib/highlight.server"; |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 8 | import { repos, work } from "../../lib/services.server"; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 9 | import { redirectIfBranchRenamed } from "../../lib/branch-redirect.server"; |
| Initial g1t: services, event bus, intents and attempts | 10 | import { getViewer, unwrap } from "../../lib/session.server"; |
| 11 | ||
| Social cards for every page: og.g1t.sh | 12 | export function meta({ params, ...args }: Route.MetaArgs) { |
| 13 | return page(args, { title: `${params["*"]} · ${params.owner}/${params.repo} · g1t` }); | |
| Initial g1t: services, event bus, intents and attempts | 14 | } |
| 15 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 16 | export async function loader({ params, context, request }: Route.LoaderArgs) { |
| 17 | const viewer = getViewer(context); | |
| Initial g1t: services, event bus, intents and attempts | 18 | const path = { namespace: params.owner, name: params.repo }; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 19 | const file = params["*"] ?? ""; |
| 20 | const wantsBlame = new URL(request.url).searchParams.has("blame"); | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 21 | const [found, blame, list, checked] = await Promise.all([ |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 22 | repos.blob(path, viewer, params.ref, file), |
| 23 | wantsBlame ? repos.blame(path, viewer, params.ref, file) : null, | |
| Branches and Tags pages, each file's last commit, and the branch menu on files | 24 | // For the branch menu; the page still shows without it. |
| 25 | repos.branches(path, viewer).catch(() => null), | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 26 | // A CODEOWNERS file is checked as it is shown; the file shows without it. |
| 27 | isCodeownersPath(file) ? work.codeownersErrors(path, viewer, params.ref).catch(() => null) : null, | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 28 | ]); |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 29 | const codeowners = checked?.ok ? checked.value : null; |
| Branches and Tags pages, each file's last commit, and the branch menu on files | 30 | const branches = list?.ok ? list.value : null; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 31 | // A branch that was renamed: the same file on its new name. |
| 32 | if (!found.ok && found.error.code === "not_found") await redirectIfBranchRenamed(request, path, viewer, params.ref); | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 33 | const blob = unwrap(found); |
| 34 | if (blame?.ok && blob.text != null) { | |
| 35 | return { | |
| 36 | blob, | |
| 37 | html: null, | |
| 38 | blame: { blame: blame.value, lines: await highlightLines(blob.path, blob.text) }, | |
| Branches and Tags pages, each file's last commit, and the branch menu on files | 39 | branches, |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 40 | codeowners, |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 41 | }; |
| 42 | } | |
| API and MCP server, Rust identity service, registration, site redesign | 43 | return { |
| 44 | blob, | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 45 | html: blob.text == null ? null : await highlightLines(blob.path, blob.text), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 46 | blame: null, |
| Branches and Tags pages, each file's last commit, and the branch menu on files | 47 | branches, |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 48 | codeowners, |
| API and MCP server, Rust identity service, registration, site redesign | 49 | }; |
| Initial g1t: services, event bus, intents and attempts | 50 | } |
| 51 | ||
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 52 | export default function Blob({ loaderData, params }: Route.ComponentProps) { |
| 53 | const { codeowners, blob } = loaderData; | |
| 54 | // Its errors' lines are marked, when they are this file's. | |
| 55 | const own = codeowners != null && codeowners.path === blob.path; | |
| 56 | return ( | |
| 57 | <BlobView | |
| 58 | blob={blob} | |
| 59 | html={loaderData.html} | |
| 60 | blame={loaderData.blame} | |
| 61 | branches={loaderData.branches} | |
| 62 | notice={ | |
| 63 | codeowners && ( | |
| 64 | <CodeownersFileErrors report={codeowners} path={blob.path} base={`/${params.owner}/${params.repo}`} /> | |
| 65 | ) | |
| 66 | } | |
| 67 | marked={own ? codeowners.errors.map((error) => error.line).filter((line) => line > 0) : undefined} | |
| 68 | /> | |
| 69 | ); | |
| Initial g1t: services, event bus, intents and attempts | 70 | } |