Skip to content
124 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.

Merge branch 'main' into worktree-agent-a69aeabc4b0deeb971/**
2 * A repository's About, as its Files page shows it beside the files: its
3 * license, security policy and languages, its contributors, its stars and
4 * its releases. Mirrors `crates/contracts/src/about.rs`.
5 *
6 * What is read from files and history is worked out in the background for
7 * the default branch's head and kept by commit: an answer can be for an
8 * older commit (`commit` is not `head`) while the newer one is worked out,
9 * or `pending` when nothing has been worked out yet.
10 */
11import type { Repo } from "./repos";
12
13export type LanguageShare = {
14 name: string;
15 /** `#rrggbb`, the color it is known by. */
16 color: string | null;
17 bytes: number;
18 /** Of the bytes counted, to one decimal place. */
19 percent: number;
20};
21
22export type License = {
23 /** `MIT`, `Apache-2.0`; null when the text is not one g1t recognizes. */
24 spdxId: string | null;
25 /** "MIT License", or "Other". */
26 name: string;
27 /** The file it was read from: `LICENSE`. */
28 path: string;
29};
30
Coding agents show as themselves on commits and contributors: Claude, Codex, Copilot, Gemini, Jules, Cursor, Devin, Aider, Dependabot, Renovate and GitHub Actions are known by the address they write on their commits (never by name), shown with their maker's mark, their own name and an agent or bot label, and a card saying what each is. Anyone else not on g1t gets a card too, saying so and how to claim the commits by adding the address. Contributor lists are worked out again (stats version 2) so an agent counts once.31/** `user`: matched to an account. `g1t`: g1t itself. `agent`: a known coding agent or bot (./coding-agents.ts). `author`: the name on the commits. */
32export type ContributorKind = "user" | "g1t" | "agent" | "author";
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9733
34/** Commits in the week starting on Monday `week` (`YYYY-MM-DD`, UTC). */
35export type WeekCommits = { week: string; commits: number };
36
37export type Contributor = {
38 kind: ContributorKind;
39 name: string;
40 username?: string | null;
41 avatar?: string | null;
Coding agents show as themselves on commits and contributors: Claude, Codex, Copilot, Gemini, Jules, Cursor, Devin, Aider, Dependabot, Renovate and GitHub Actions are known by the address they write on their commits (never by name), shown with their maker's mark, their own name and an agent or bot label, and a card saying what each is. Anyone else not on g1t gets a card too, saying so and how to claim the commits by adding the address. Contributor lists are worked out again (stats version 2) so an agent counts once.42 /** The coding agent's id, for an `agent`. */
43 agent?: string | null;
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9744 commits: number;
45 firstAt: string;
46 lastAt: string;
47 /** Only for the most active contributors, on the Contributors page. */
48 weeks: WeekCommits[];
49};
50
51export type Freshness = {
52 /** The default branch's head; null for an empty repository. */
53 head: string | null;
54 /** The commit the answer was worked out for. */
55 commit: string | null;
56 computedAt: string | null;
57 /** Nothing worked out yet: ask again shortly. */
58 pending: boolean;
59 /** Too large to read in full: counts what was read. */
60 partial: boolean;
61};
62
63export type Languages = Freshness & { languages: LanguageShare[] };
64
65export type Contributors = Freshness & {
66 total: number;
67 /** The commits read. */
68 commits: number;
69 contributors: Contributor[];
70 /** Every commit read, by week, oldest first, empty weeks included. */
71 weeks: WeekCommits[];
72};
73
74export type Release = {
75 id: string;
76 tagName: string;
77 /** The commit the tag named. */
78 target: string;
79 name: string | null;
80 /** Markdown. */
81 body: string;
82 draft: boolean;
83 prerelease: boolean;
84 author: string | null;
85 createdAt: string;
86 /** Null while it is a draft. */
87 publishedAt: string | null;
88 latest: boolean;
89};
90
91export const MAX_RELEASE_NAME_CHARS = 200;
92export const MAX_RELEASE_BODY_CHARS = 125_000;
93
94export type Stargazer = { username: string; avatar: string | null; starredAt: string };
95export type StarredRepo = { repo: Repo; starredAt: string; stars: number };
96export type Stars = { starred: boolean; stars: number };
97
98export type RepoAbout = Freshness & {
99 license: License | null;
100 /** Path of SECURITY.md, when it has one. */
101 securityPolicy: string | null;
102 languages: LanguageShare[];
103 /** How many contributors there are. */
104 contributors: number;
105 /** The most active, without their weeks. */
106 topContributors: Contributor[];
107 stars: number;
108 starred: boolean;
109 /** Releases the viewer can see. */
110 releases: number;
111 latestRelease: Release | null;
112};
113
114export type NewRelease = {
115 tagName: string;
116 /** A branch or commit for a tag that does not exist yet; the default branch when absent. */
117 target?: string | null;
118 name?: string | null;
119 body?: string | null;
120 draft?: boolean;
121 prerelease?: boolean;
122};
123
124export type ReleaseChange = { name?: string; body?: string; draft?: boolean; prerelease?: boolean };

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