g1t/apps/web/app/routes/repo/blob.tsx
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 attempts | 1 | import type { Route } from "./+types/blob"; |
| Social cards for every page: og.g1t.sh | 2 | import { page } from "../../lib/meta"; |
| Initial g1t: services, event bus, intents and attempts | 3 | import { BlobView } from "../../components/repo-view"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 4 | import { highlight, highlightLines } from "../../lib/highlight.server"; |
| Rust repos service with shipping; pull requests kept in the model | 5 | import { repos } from "../../lib/services.server"; |
| Initial g1t: services, event bus, intents and attempts | 6 | import { getViewer, unwrap } from "../../lib/session.server"; |
| 7 | ||
| Social cards for every page: og.g1t.sh | 8 | export function meta({ params, ...args }: Route.MetaArgs) { |
| 9 | return page(args, { title: `${params["*"]} · ${params.owner}/${params.repo} · g1t` }); | |
| Initial g1t: services, event bus, intents and attempts | 10 | } |
| 11 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 12 | export async function loader({ params, context, request }: Route.LoaderArgs) { |
| 13 | const viewer = getViewer(context); | |
| Initial g1t: services, event bus, intents and attempts | 14 | const path = { namespace: params.owner, name: params.repo }; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 15 | const file = params["*"] ?? ""; |
| 16 | const wantsBlame = new URL(request.url).searchParams.has("blame"); | |
| 17 | const [found, blame] = await Promise.all([ | |
| 18 | repos.blob(path, viewer, params.ref, file), | |
| 19 | wantsBlame ? repos.blame(path, viewer, params.ref, file) : null, | |
| 20 | ]); | |
| 21 | const blob = unwrap(found); | |
| 22 | if (blame?.ok && blob.text != null) { | |
| 23 | return { | |
| 24 | blob, | |
| 25 | html: null, | |
| 26 | blame: { blame: blame.value, lines: await highlightLines(blob.path, blob.text) }, | |
| 27 | }; | |
| 28 | } | |
| API and MCP server, Rust identity service, registration, site redesign | 29 | return { |
| 30 | blob, | |
| 31 | html: blob.text == null ? null : await highlight(blob.path, blob.text), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 32 | blame: null, |
| API and MCP server, Rust identity service, registration, site redesign | 33 | }; |
| Initial g1t: services, event bus, intents and attempts | 34 | } |
| 35 | ||
| 36 | export default function Blob({ loaderData }: Route.ComponentProps) { | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 37 | return <BlobView blob={loaderData.blob} html={loaderData.html} blame={loaderData.blame} />; |
| Initial g1t: services, event bus, intents and attempts | 38 | } |