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.
| Pull requests from branches | 1 | import { Bot, GitBranch, Plus } from "lucide-react"; |
| Issues and pull requests replace intents and attempts | 2 | import { Link } from "react-router"; |
| 3 | ||
| 4 | import type { Route } from "./+types/pulls"; | |
| Social cards for every page: og.g1t.sh | 5 | import { page } from "../../lib/meta"; |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 6 | import { openedBy } from "../../lib/opened-by"; |
| Pull requests from branches | 7 | import { ButtonLink, EmptyState, TimeAgo } from "../../components/ui"; |
| Acceptance checks in sandboxes, line comments and review verdicts | 8 | import { CheckBadge } from "../../components/checks"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 9 | import { ChangeSize, PullIcon, StateTabs } from "../../components/work"; |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 10 | import { AgentBadge, useActiveRuns } from "../../components/agents"; |
| Merge branch 'worktree-agent-aca4790ea223aa235' | 11 | import { accessTo } from "../../lib/access.server"; |
| 12 | import { agents, work } from "../../lib/services.server"; | |
| Issues and pull requests replace intents and attempts | 13 | import { getViewer, unwrap } from "../../lib/session.server"; |
| 14 | ||
| Social cards for every page: og.g1t.sh | 15 | export function meta({ params, ...args }: Route.MetaArgs) { |
| 16 | return page(args, { title: `Pull requests · ${params.owner}/${params.repo} · g1t` }); | |
| Issues and pull requests replace intents and attempts | 17 | } |
| 18 | ||
| 19 | export async function loader({ params, context, request }: Route.LoaderArgs) { | |
| 20 | const path = { namespace: params.owner, name: params.repo }; | |
| Merge branch 'worktree-agent-aca4790ea223aa235' | 21 | const viewer = getViewer(context); |
| Issues and pull requests replace intents and attempts | 22 | const state = |
| 23 | new URL(request.url).searchParams.get("state") === "closed" ? "closed" : "open"; | |
| Merge branch 'worktree-agent-aca4790ea223aa235' | 24 | // Which an agent is working on, beside the list, so its badges come with it. |
| 25 | const [pulls, active, { can }] = await Promise.all([ | |
| 26 | work.listPulls(path, viewer, state), | |
| 27 | agents.listRuns(viewer, { repo: path, active: true, limit: 100 }).catch(() => null), | |
| 28 | accessTo(context, params), | |
| 29 | ]); | |
| Issues and pull requests replace intents and attempts | 30 | return { |
| Merge branch 'worktree-agent-aca4790ea223aa235' | 31 | pulls: unwrap(pulls), |
| Issues and pull requests replace intents and attempts | 32 | state, |
| Merge branch 'worktree-agent-aca4790ea223aa235' | 33 | // As the project's agents.json has them; left out, the list fetches them. |
| 34 | active: active?.ok ? { runs: active.value, member: can.run } : undefined, | |
| Issues and pull requests replace intents and attempts | 35 | } as const; |
| 36 | } | |
| 37 | ||
| 38 | export default function Pulls({ loaderData, params }: Route.ComponentProps) { | |
| Merge branch 'worktree-agent-aca4790ea223aa235' | 39 | const { pulls, state, active } = loaderData; |
| Issues and pull requests replace intents and attempts | 40 | const base = `/${params.owner}/${params.repo}`; |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 41 | // Which pull requests an agent is working on this minute, and at what. |
| Merge branch 'worktree-agent-aca4790ea223aa235' | 42 | const working = useActiveRuns(params.owner, params.repo, active); |
| Issues and pull requests replace intents and attempts | 43 | return ( |
| 44 | <div> | |
| Pull requests from branches | 45 | <StateTabs |
| 46 | to={`${base}/pulls`} | |
| 47 | state={state} | |
| 48 | action={ | |
| 49 | <ButtonLink to={`${base}/pulls/new`}> | |
| 50 | <Plus size={15} /> | |
| 51 | New pull request | |
| 52 | </ButtonLink> | |
| 53 | } | |
| 54 | /> | |
| Issues and pull requests replace intents and attempts | 55 | <div className="mt-4"> |
| 56 | {pulls.length === 0 ? ( | |
| 57 | <EmptyState | |
| 58 | title={state === "open" ? "No open pull requests" : "No closed pull requests"} | |
| 59 | > | |
| Pull requests from branches | 60 | A pull request proposes a change. Assign agents to an issue and |
| 61 | each opens one in its own fork, or push a branch and open one | |
| 62 | yourself. | |
| Issues and pull requests replace intents and attempts | 63 | </EmptyState> |
| 64 | ) : ( | |
| 65 | <ul className="divide-y divide-line overflow-hidden rounded-xl border border-line"> | |
| 66 | {pulls.map((pull) => ( | |
| 67 | <li key={pull.id}> | |
| 68 | <Link | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 69 | prefetch="intent" |
| Issues and pull requests replace intents and attempts | 70 | to={`${base}/pull/${pull.number}`} |
| 71 | className="flex items-start gap-3 px-4 py-3 transition-colors hover:bg-surface" | |
| 72 | > | |
| 73 | <span className="mt-0.5"> | |
| 74 | <PullIcon status={pull.status} /> | |
| 75 | </span> | |
| 76 | <span className="min-w-0 grow"> | |
| 77 | <span className="flex items-center gap-2"> | |
| 78 | <span className="truncate font-medium">{pull.title}</span> | |
| 79 | {pull.status === "draft" && ( | |
| 80 | <span className="shrink-0 rounded-full border border-line px-1.5 py-px text-[0.6875rem] text-faint"> | |
| 81 | draft | |
| 82 | </span> | |
| 83 | )} | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 84 | <AgentBadge run={working.get(pull.number)} /> |
| Issues and pull requests replace intents and attempts | 85 | </span> |
| 86 | <span className="mt-0.5 block text-xs text-faint"> | |
| 87 | #{pull.number} opened <TimeAgo at={pull.createdAt} /> by{" "} | |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 88 | {openedBy(pull).name} |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 89 | {pull.requestedBy && <> for {pull.requestedBy.username}</>} |
| Issues and pull requests replace intents and attempts | 90 | {pull.issue != null && <> · for #{pull.issue}</>} |
| 91 | {pull.supersededBy != null && <> · superseded by #{pull.supersededBy}</>} | |
| 92 | </span> | |
| 93 | </span> | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 94 | <span className="mt-0.5 hidden sm:block"> |
| 95 | <ChangeSize files={pull.files} /> | |
| 96 | </span> | |
| Acceptance checks in sandboxes, line comments and review verdicts | 97 | <span className="mt-0.5"> |
| 98 | <CheckBadge status={pull.checkStatus} /> | |
| 99 | </span> | |
| Issues and pull requests replace intents and attempts | 100 | <span className="mt-0.5 flex shrink-0 items-center gap-1 font-mono text-xs text-muted"> |
| Pull requests from branches | 101 | {pull.branch ? <GitBranch size={13} /> : <Bot size={13} />} |
| 102 | {pull.branch ?? pull.agent} | |
| Issues and pull requests replace intents and attempts | 103 | </span> |
| 104 | </Link> | |
| 105 | </li> | |
| 106 | ))} | |
| 107 | </ul> | |
| 108 | )} | |
| 109 | </div> | |
| 110 | </div> | |
| 111 | ); | |
| 112 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.