Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
1,401 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.

README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise1//! The OpenAPI document, generated from the same list the routes are.
2//!
3//! The docs site builds its API reference from a copy of this document,
4//! `apps/docs/src/data/openapi.json`. A test keeps the copy current: run
5//! `G1T_WRITE_OPENAPI=1 cargo test -p g1t-api openapi` to rewrite it.
6
7use g1t_contracts::scopes::scope_for;
8use serde_json::{Map, Value, json};
9
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9710use crate::about::AboutOp;
The artifacts service is services/artifacts, the Worker g1t-artifacts, bound as ARTIFACTS by the API, the site and the agents; its live rooms move to it with a Durable Object transfer from g1t-docs-service, and its database, bucket, indexes and queue keep their names. The git store's binding and settings are GITSTORE, its ops scripts gitstore-*, and workflow run artifacts keep their compatible API under run_artifacts modules. The deploy tool puts a Worker that has never deployed before the Workers in its stage that bind to it, and the deploy guide gives the cutover runbook.11use crate::run_artifacts::ArtifactsOp;
Merge branch 'worktree-agent-a3b9b1f730f55b5bf'12use crate::caches::CachesOp;
Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's.13use crate::archives::ArchiveOp;
Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca14use crate::deploy_keys::DeployKeysOp;
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9715use crate::deployments::DeploymentsOp;
Projects have Observability: their requests, logs, traces, metrics and errors, from apps on g1t.page with nothing to set up, and from software anywhere else over OpenTelemetry.16use crate::telemetry::TelemetryOp;
Merge packages: roles, Actions access, source label, soft delete, API17use crate::packages::PackagesOp;
Merge main into Artifacts Phase 218use crate::folios::FoliosOp;
Merge branch 'worktree-agent-a6ec0a89d7fe7a9ae'19use crate::coordination::CoordinationOp;
Merge branch 'worktree-agent-a3abfcce648e87dca'20use crate::protection::ProtectionOp;
API and MCP for a workspace's personal access token rules, members' tokens and approvals21use crate::token_policy::TokenOp;
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise22use crate::operations::Op;
Merge checks: statuses and check runs on every commit23use crate::checks::ChecksOp;
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge24use crate::rules::RulesOp;
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar25use crate::security::SecurityOp;
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise26use crate::rest::{ROUTES, Route};
27
28/// The sections of the API reference: a name, what it covers, and its
29/// operations in the order a reader meets them.
30const SECTIONS: &[(&str, &str, &[Op])] = &[
31 (
32 "Accounts",
33 "Signing in from a tool, who a token acts as, and your email addresses.",
Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036)34 &[Op::Whoami, Op::ListEmails, Op::AddEmail, Op::ConfirmEmail, Op::RemoveEmail, Op::UpdateEmailSettings],
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise35 ),
36 (
API: notifications over REST and MCP, with notifications scopes37 "Notifications",
38 "Your inbox: a thread for each thing you were told about (an issue, a pull request, a workflow on a branch, a deployment), why you were told, and what you subscribe to and watch. Your own: personal tokens and sessions only.",
39 &[
40 Op::ListNotifications,
41 Op::MarkNotificationsRead,
42 Op::GetNotificationThread,
43 Op::MarkThreadRead,
44 Op::MarkThreadDone,
45 Op::SaveThread,
46 Op::SnoozeThread,
47 Op::GetThreadSubscription,
48 Op::SetThreadSubscription,
49 Op::DeleteThreadSubscription,
50 Op::GetRepoSubscription,
51 Op::SetRepoSubscription,
52 Op::DeleteRepoSubscription,
53 Op::ListWatchedRepos,
54 ],
55 ),
56 (
API: pinned projects over REST and MCP57 "Pinned projects",
58 "The projects you keep at the top of a workspace's sidebar, in your order, up to eight a workspace. Your own: personal tokens and sessions only.",
59 &[Op::ListPinnedProjects, Op::PinProject, Op::UnpinProject, Op::ReorderPinnedProjects],
60 ),
61 (
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9762 "Projects",
63 "A project is what a workspace builds and runs, from a repository or a root directory in one. Each says what it is, where it runs and where to find it: its homepage, docs and other links.",
64 &[Op::ListProjects, Op::GetProject, Op::UpdateProject],
65 ),
66 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise67 "Workspaces",
68 "A workspace owns repositories and is the first part of their address. People and agents work in workspaces.",
g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other.69 &[Op::GetWorkspace, Op::CreateWorkspace, Op::UpdateWorkspace, Op::DeleteWorkspace, Op::GetWorkspaceActivity],
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise70 ),
71 (
API and MCP for a workspace's personal access token rules, members' tokens and approvals72 "Personal access tokens",
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers73 "A workspace's rules for its members' personal access tokens: whether tokens made for all of a member's workspaces reach it, whether tokens may be made for it alone and wait for an owner's approval, and how long a token may last; the tokens that reach it, approving or denying the ones that wait, and revoking one there. Owners only, as people.",
API and MCP for a workspace's personal access token rules, members' tokens and approvals74 &[
75 Op::Tokens(TokenOp::GetTokenPolicy),
76 Op::Tokens(TokenOp::SetTokenPolicy),
77 Op::Tokens(TokenOp::ListMemberTokens),
78 Op::Tokens(TokenOp::ListTokenRequests),
79 Op::Tokens(TokenOp::ReviewTokenRequest),
80 Op::Tokens(TokenOp::RevokeMemberToken),
81 ],
82 ),
83 (
Merge main (membership, two-factor, GitHub repo roles) into tokens84 "Members",
85 "A workspace's members and owners: who belongs to it, their roles (owner or member, with billing manager and security manager on top), handing it to another member, and leaving it.",
86 &[Op::ListMembers, Op::UpdateMember, Op::RemoveMember, Op::TransferOwnership, Op::LeaveWorkspace],
87 ),
88 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise89 "Invites",
Merge main into rm-agents: mirroring removal, open signups, free-tier limits, the g1t CLI and runner fixes, with the agent removal kept. The CLI's table of operations is regenerated from the API without the agent, customize and AI credit operations; no CLI command used them.90 "Inviting people into a workspace by username or email, and answering the invitations to workspaces sent to you.",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise91 &[
92 Op::ListWorkspaceInvites,
93 Op::InviteMember,
94 Op::RevokeWorkspaceInvite,
Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)95 Op::ListInvitations,
96 Op::AcceptInvitation,
97 Op::DeclineInvitation,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise98 ],
99 ),
100 (
Usage, Billing settings and prepaid AI credit; fixes from the UX audit101 "Billing",
Billing, integrations, security and identity no longer serve g1t's own agents. Billing stops metering agent runs, model tokens and AI Gateway requests, drops its model catalogue and price-keeper model prices, and stops selling AI credit, which only ever paid for those; credit bought earlier still pays toward what is owed. A usage report, statement or invoice that holds an old agent or model meter shows it as "Other usage" rather than failing, and the get_ai_credit and buy_ai_credit API operations and MCP billing actions go. Integrations no longer connects model providers or routes models, and no longer assigns imported issues or alerts to g1t; a model provider already connected can still be disconnected. Security drops "Fix with g1t". Identity no longer creates agent tokens or puts agents on teams, a team's lead is a person, and run credentials are issued only for checks, the merge queue, merge checks, deployments and bumps; tokens and credentials already issued keep working until they expire. The reserved names g1t and g1t-agent stay reserved. No tables are dropped.102 "A workspace's usage, its budget and its invoices. Members read them; owners change the budget, as people. A run's token never changes billing.",
Usage, Billing settings and prepaid AI credit; fixes from the UX audit103 &[
104 Op::GetUsage,
105 Op::GetBudget,
106 Op::SetBudget,
107 Op::ListInvoices,
108 Op::GetBillingDetails,
109 ],
110 ),
111 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise112 "Repositories",
Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's.113 "A repository, how it handles pull requests, and its timeline: renaming, archiving, moving and deleting it; and its files at a branch, tag or commit as a tarball or zipball.",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise114 &[
115 Op::ListRepos,
116 Op::CreateRepo,
117 Op::GetRepo,
g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other.118 Op::GetContents,
119 Op::ListCommits,
Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's.120 Op::Archives(ArchiveOp::DownloadTarball),
121 Op::Archives(ArchiveOp::DownloadZipball),
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise122 Op::UpdateRepo,
123 Op::RenameRepo,
124 Op::RenameBranch,
The Branches page does things to branches now. It has tabs (Overview, Yours, Active, Stale, All, kept in the address as ?tab=) and search; Overview shows the default branch, then the first five of your branches, the active ones and the stale ones, each linking to the rest. Each branch is a row with its name in a code chip with a copy button, who made its latest commit and when, that commit's checks, behind and ahead counts with bars drawn against the largest shown, and its pull request (the open one, else the newest merged or closed) with its state; on a phone the columns fold under the name. Yours is branches whose latest commit is the viewer's; stale is no commit in 90 days.125 Op::CreateBranch,
126 Op::DeleteBranch,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise127 Op::SetRepoVisibility,
128 Op::ArchiveRepo,
129 Op::UnarchiveRepo,
130 Op::TransferRepo,
131 Op::DeleteRepo,
132 Op::ListDeletedRepos,
133 Op::RestoreRepo,
134 Op::PurgeRepo,
135 Op::GetRepoSettings,
136 Op::UpdateRepoSettings,
137 Op::ListCheckNames,
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar138 Op::GetCodeownersErrors,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise139 Op::ListEvents,
140 ],
141 ),
142 (
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97143 "Repository insights",
144 "What a repository's default branch says about it, read in the background and kept by commit: the languages it is written in, who made it, and its license.",
145 &[Op::About(AboutOp::GetLanguages), Op::About(AboutOp::ListContributors), Op::About(AboutOp::GetLicense)],
146 ),
147 (
148 "Stars",
149 "Starring a repository, to keep it and to say you like it: who starred one, and what you starred.",
150 &[
151 Op::About(AboutOp::ListStargazers),
152 Op::About(AboutOp::ListStarred),
153 Op::About(AboutOp::CheckStarred),
154 Op::About(AboutOp::Star),
155 Op::About(AboutOp::Unstar),
156 ],
157 ),
158 (
159 "Releases",
160 "A release is a tag published with a title and notes. The latest is the newest published one that is neither a draft nor a prerelease.",
161 &[
162 Op::About(AboutOp::ListReleases),
163 Op::About(AboutOp::CreateRelease),
164 Op::About(AboutOp::GetLatestRelease),
165 Op::About(AboutOp::GetReleaseByTag),
166 Op::About(AboutOp::GetRelease),
167 Op::About(AboutOp::UpdateRelease),
168 Op::About(AboutOp::DeleteRelease),
169 ],
170 ),
171 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise172 "Access",
Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca173 "Who can do what in a repository: repository roles, people given a role on one repository (outside collaborators when they are not members), invitations, a workspace's base permission, and deploy keys: SSH keys that reach one repository.",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise174 &[
175 Op::ListCollaborators,
176 Op::AddCollaborator,
177 Op::UpdateCollaborator,
178 Op::RemoveCollaborator,
179 Op::GetCollaboratorPermission,
180 Op::ListRepoInvitations,
181 Op::RevokeRepoInvitation,
182 Op::ListMyRepoInvitations,
183 Op::AcceptRepoInvitation,
184 Op::DeclineRepoInvitation,
185 Op::SetBasePermission,
186 Op::ListOutsideCollaborators,
Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca187 Op::DeployKeys(DeployKeysOp::ListDeployKeys),
188 Op::DeployKeys(DeployKeysOp::GetDeployKey),
189 Op::DeployKeys(DeployKeysOp::CreateDeployKey),
190 Op::DeployKeys(DeployKeysOp::DeleteDeployKey),
Merge branch 'mirroring' into artifacts-mode191 ],
192 ),
193 (
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar194 "Teams",
195 "Groups of a workspace's members: given a role on repositories together, mentioned together as @workspace/team, and asked to review together. Any member may create a team; the workspace's owners and the team's maintainers manage it.",
196 &[
197 Op::ListTeams,
198 Op::CreateTeam,
199 Op::GetTeam,
200 Op::UpdateTeam,
201 Op::DeleteTeam,
202 Op::ListTeamMembers,
203 Op::SetTeamMember,
204 Op::RemoveTeamMember,
205 Op::ListChildTeams,
206 Op::ListTeamRepos,
207 Op::SetTeamRepo,
208 Op::RemoveTeamRepo,
209 Op::SetTeamReviewAssignment,
210 Op::ListUserTeams,
211 ],
212 ),
213 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise214 "Security",
215 "Secrets found in what is pushed and in a repository's history, and dependencies with known vulnerabilities: listing the alerts, and dismissing or reopening them.",
216 &[Op::ListSecurityAlerts, Op::DismissSecurityAlert, Op::ReopenSecurityAlert],
217 ),
218 (
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar219 "Secret scanning",
220 "Secrets found in pushes and history, where each one is, pushing past push protection with a reason (and asking for approval when the workspace delegates bypasses), checking with a secret's issuer whether it still works, and custom patterns.",
221 &[
222 Op::Security(SecurityOp::ListSecretAlerts),
223 Op::Security(SecurityOp::GetSecretAlert),
224 Op::Security(SecurityOp::UpdateSecretAlert),
225 Op::Security(SecurityOp::ListSecretLocations),
226 Op::Security(SecurityOp::BypassPushProtection),
227 Op::Security(SecurityOp::CheckSecretValidity),
228 Op::Security(SecurityOp::ListBypassRequests),
229 Op::Security(SecurityOp::ReviewBypassRequest),
230 Op::Security(SecurityOp::ListCustomPatterns),
231 Op::Security(SecurityOp::CreateCustomPattern),
232 Op::Security(SecurityOp::UpdateCustomPattern),
233 Op::Security(SecurityOp::DeleteCustomPattern),
234 Op::Security(SecurityOp::DryRunCustomPattern),
235 ],
236 ),
237 (
238 "Code scanning",
239 "Results of static analysis tools, uploaded as SARIF: alerts on the default branch, the analyses that made them, uploads, and putting g1t on an alert to fix it.",
240 &[
241 Op::Security(SecurityOp::ListCodeAlerts),
242 Op::Security(SecurityOp::GetCodeAlert),
243 Op::Security(SecurityOp::UpdateCodeAlert),
244 Op::Security(SecurityOp::ListAnalyses),
245 Op::Security(SecurityOp::UploadSarif),
246 Op::Security(SecurityOp::GetSarifUpload),
247 ],
248 ),
249 (
250 "Supply chain",
251 "What a repository depends on: vulnerability alerts, the dependency graph, an SPDX SBOM of it, and comparing two commits' dependencies as dependency review does.",
252 &[
253 Op::Security(SecurityOp::ListVulnerabilityAlerts),
254 Op::Security(SecurityOp::GetVulnerabilityAlert),
255 Op::Security(SecurityOp::UpdateVulnerabilityAlert),
256 Op::Security(SecurityOp::GetDependencyGraph),
257 Op::Security(SecurityOp::GetSbom),
258 Op::Security(SecurityOp::CompareDependencies),
259 ],
260 ),
261 (
262 "Security settings",
263 "When pull request checks fail, dependency review's policy, delegated bypass and validity checks, and a workspace's security overview.",
264 &[
265 Op::Security(SecurityOp::GetSettings),
266 Op::Security(SecurityOp::UpdateSettings),
267 Op::Security(SecurityOp::GetWorkspaceSettings),
268 Op::Security(SecurityOp::UpdateWorkspaceSettings),
269 Op::Security(SecurityOp::GetOverview),
270 ],
271 ),
272 (
Merge remote-tracking branch 'origin/claude/cool-newton-7nm8r9' into claude/cool-newton-7nm8r9273 "Security advisories",
274 "What a repository says about vulnerabilities in what it ships: advisories drafted, published and withdrawn by its maintainers, and the vulnerability reports people send them privately when the repository takes them.",
275 &[
276 Op::Security(SecurityOp::ListAdvisories),
277 Op::Security(SecurityOp::CreateAdvisory),
278 Op::Security(SecurityOp::GetAdvisory),
279 Op::Security(SecurityOp::UpdateAdvisory),
280 Op::Security(SecurityOp::SetAdvisoryState),
281 Op::Security(SecurityOp::ListReports),
282 Op::Security(SecurityOp::ReportVulnerability),
283 Op::Security(SecurityOp::ReviewReport),
284 ],
285 ),
286 (
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge287 "Rules",
288 "Rulesets: what may happen to a repository's branches and tags and what a pull request needs before it merges, for a repository or across a workspace; the rules that hold for one branch; and how they judged each push and merge, with insights.",
289 &[
290 Op::Rules(RulesOp::ListRepoRulesets),
291 Op::Rules(RulesOp::CreateRepoRuleset),
292 Op::Rules(RulesOp::GetRepoRuleset),
293 Op::Rules(RulesOp::UpdateRepoRuleset),
294 Op::Rules(RulesOp::DeleteRepoRuleset),
295 Op::Rules(RulesOp::GetBranchRules),
296 Op::Rules(RulesOp::ListRuleEvaluations),
297 Op::Rules(RulesOp::ListWorkspaceRulesets),
298 Op::Rules(RulesOp::CreateWorkspaceRuleset),
299 Op::Rules(RulesOp::GetWorkspaceRuleset),
300 Op::Rules(RulesOp::UpdateWorkspaceRuleset),
301 Op::Rules(RulesOp::DeleteWorkspaceRuleset),
302 Op::Rules(RulesOp::ListWorkspaceRuleEvaluations),
303 ],
304 ),
305 (
Merge checks: statuses and check runs on every commit306 "Checks",
307 "What CI, integrations and g1t Actions say about a commit, in the shapes CI tools already send: statuses (a state per context) and check runs (a lifecycle, a conclusion, a Markdown report, annotations on lines and buttons), grouped per reporter into check suites. g1t Actions jobs are check runs too. Required checks are met by either.",
308 &[
309 Op::Checks(ChecksOp::CreateCommitStatus),
310 Op::Checks(ChecksOp::ListCommitStatuses),
311 Op::Checks(ChecksOp::GetCombinedStatus),
312 Op::Checks(ChecksOp::CreateCheckRun),
313 Op::Checks(ChecksOp::UpdateCheckRun),
314 Op::Checks(ChecksOp::GetCheckRun),
315 Op::Checks(ChecksOp::ListCheckRunAnnotations),
316 Op::Checks(ChecksOp::RerequestCheckRun),
317 Op::Checks(ChecksOp::ListCheckRunsForRef),
318 Op::Checks(ChecksOp::ListCheckSuitesForRef),
319 Op::Checks(ChecksOp::GetCheckSuite),
320 Op::Checks(ChecksOp::RerequestCheckSuite),
321 ],
322 ),
323 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise324 "Issues",
325 "What should change in a repository, with labels and comments. Issues and pull requests share one sequence of numbers.",
326 &[
327 Op::ListIssues,
328 Op::CreateIssue,
329 Op::GetIssue,
330 Op::UpdateIssue,
331 Op::CloseIssue,
332 Op::ReopenIssue,
333 Op::AddComment,
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts334 Op::EditComment,
335 Op::DeleteComment,
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar336 Op::ListIssueLabels,
337 Op::AddIssueLabels,
338 Op::SetIssueLabels,
339 Op::RemoveIssueLabels,
340 ],
341 ),
342 (
Merge branch 'worktree-agent-a6ec0a89d7fe7a9ae'343 "Claims and work",
344 "Coordinating work on issues: an advisory, expiring claim that says you are on one (never a lock), handing it off with a note, and everything an agent needs before starting on an issue in one call. What an issue is blocked by is set with update_issue.",
345 &[
346 Op::Coordination(CoordinationOp::GetWork),
347 Op::Coordination(CoordinationOp::ClaimIssue),
348 Op::Coordination(CoordinationOp::ReleaseClaim),
349 Op::Coordination(CoordinationOp::HandOffIssue),
350 Op::Coordination(CoordinationOp::ListClaims),
351 ],
352 ),
353 (
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar354 "Labels and milestones",
355 "A repository's labels, which issues and pull requests carry by name, and its milestones, which gather them under a goal and a due date.",
356 &[
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise357 Op::ListLabels,
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar358 Op::CreateLabel,
359 Op::UpdateLabel,
360 Op::DeleteLabel,
361 Op::AddDefaultLabels,
362 Op::ListMilestones,
363 Op::CreateMilestone,
364 Op::GetMilestone,
365 Op::UpdateMilestone,
366 Op::DeleteMilestone,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise367 ],
368 ),
369 (
370 "Pull requests",
371 "A proposed change in its own fork or on a branch. Several can be made for one issue; the one merged resolves it.",
372 &[
373 Op::ListPullRequests,
374 Op::CreatePullRequest,
375 Op::GetPullRequest,
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar376 Op::UpdatePullRequest,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise377 Op::GetPullRequestChanges,
378 Op::MarkPullRequestReady,
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts379 Op::ConvertPullRequestToDraft,
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar380 Op::RequestReviewers,
381 Op::RemoveRequestedReviewers,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise382 Op::ReviewPullRequest,
383 Op::MergePullRequest,
384 Op::ClosePullRequest,
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts385 Op::ReopenPullRequest,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise386 Op::GetMergeQueue,
387 ],
388 ),
389 (
390 "Sessions",
g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other.391 "Who is working on what, and how a pull request was made. A session is one run of your own harness (a Claude Code session, a Codex run) on a repository: started once, kept alive by heartbeats, attached to an issue and a pull request, and recording prompts, reasoning, the tools that ran, the skills used and what it touched. Each subagent is a session of its own under the one that started it. A pull request's session shows what was recorded on it. A session can also be started on an issue in your own Claude, on the workspace's Anthropic account.",
Merge branch 'worktree-agent-a6ec0a89d7fe7a9ae'392 &[
393 Op::Coordination(CoordinationOp::StartSession),
394 Op::Coordination(CoordinationOp::UpdateSession),
395 Op::Coordination(CoordinationOp::EndSession),
396 Op::Coordination(CoordinationOp::GetSession),
397 Op::Coordination(CoordinationOp::ListSessions),
398 Op::Coordination(CoordinationOp::RecordSessionEntries),
g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other.399 Op::Coordination(CoordinationOp::StartAgentSession),
Merge branch 'worktree-agent-a6ec0a89d7fe7a9ae'400 Op::ReadSession,
401 Op::RecordSession,
402 ],
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise403 ),
404 (
Merge branch 'worktree-agent-ab8033ab973f8d99a'405 "Decisions and why",
406 "Decision records: why the work is the way it is, and how sure that is (claimed, tested by a check or the merge queue, or approved by a person). And why a line of code is the way it is: its commit, pull request, issue, decisions and session.",
407 &[Op::ListDecisions, Op::RecordDecision, Op::Why],
408 ),
409 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise410 "Memory",
The API and MCP server no longer offer g1t's own agents. g1t is what your coding agents work against, not an agent of its own, so the operations that drove hosted agents are gone: messaging an agent on a pull request (message_agent, take_messages, answer_message), assigning or delegating an issue to g1t (assign_issue, delegate), plans (plan_work, get_plan, apply_plan), the context hub (search_context, get_entity), model routes, agents' computers, AI Gateway requests, "Fix with g1t" on a security alert, and every Customize route (marketplaces, plugins, connectors). The callbacks the agent sandbox reported through (/agent-runs/*, /runs/:id/usage, /plans/:id, /reviews/:id) go with them, update_repo_settings stops accepting agent_review, max_revisions and hold_low_confidence, import_issue stops accepting assign, and an old agent token with no run behind it is refused.411 "What agents and people learned that the next agent should know, for one project or across a workspace. Members only; never a secret.",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise412 &[Op::Remember, Op::Recall],
413 ),
414 (
415 "Search",
416 "One search across all of g1t: repositories, code, issues, pull requests, people and workspaces. Public content for everyone, and private content in workspaces you belong to.",
417 &[Op::Search],
418 ),
419 (
420 "Actions",
Merge branch 'worktree-agent-a3b9b1f730f55b5bf'421 "GitHub Actions workflows in .g1t/workflows, their runs, their jobs' logs, their artifacts, and the repository's actions/cache entries.",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise422 &[
423 Op::ListWorkflows,
Merge branch 'worktree-agent-a4db4b523bb973765'424 Op::GetWorkflow,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise425 Op::ListWorkflowRuns,
426 Op::GetWorkflowRun,
427 Op::GetJobLogs,
428 Op::DispatchWorkflow,
429 Op::CancelWorkflowRun,
430 Op::RerunWorkflowRun,
431 Op::UpdateWorkflow,
Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2432 Op::Artifacts(ArtifactsOp::ListArtifacts),
433 Op::Artifacts(ArtifactsOp::ListRunArtifacts),
434 Op::Artifacts(ArtifactsOp::GetArtifact),
435 Op::Artifacts(ArtifactsOp::DownloadArtifact),
436 Op::Artifacts(ArtifactsOp::DeleteArtifact),
437 Op::Artifacts(ArtifactsOp::GetArtifactRetention),
438 Op::Artifacts(ArtifactsOp::SetArtifactRetention),
Merge branch 'worktree-agent-a3b9b1f730f55b5bf'439 Op::Caches(CachesOp::ListCaches),
440 Op::Caches(CachesOp::GetCacheUsage),
441 Op::Caches(CachesOp::DeleteCachesByKey),
442 Op::Caches(CachesOp::DeleteCache),
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise443 ],
444 ),
445 (
Merge packages: roles, Actions access, source label, soft delete, API446 "Packages",
447 "A workspace's packages in every registry: their versions and download counts, deleting and restoring them within 30 days, their visibility and repository, the people and teams with a role on them, and which repositories' workflows may use them (Manage Actions access). A package is named by its type and its name, URL-encoded where it holds a slash.",
448 &[
449 Op::Packages(PackagesOp::ListPackages),
450 Op::Packages(PackagesOp::GetPackage),
451 Op::Packages(PackagesOp::UpdatePackage),
452 Op::Packages(PackagesOp::DeletePackage),
453 Op::Packages(PackagesOp::RestorePackage),
454 Op::Packages(PackagesOp::ListVersions),
455 Op::Packages(PackagesOp::GetVersion),
456 Op::Packages(PackagesOp::DeleteVersion),
457 Op::Packages(PackagesOp::RestoreVersion),
458 Op::Packages(PackagesOp::LinkPackage),
459 Op::Packages(PackagesOp::UnlinkPackage),
460 Op::Packages(PackagesOp::ListAccess),
461 Op::Packages(PackagesOp::SetAccess),
462 Op::Packages(PackagesOp::RemoveAccess),
463 Op::Packages(PackagesOp::ListActionsAccess),
464 Op::Packages(PackagesOp::SetActionsAccess),
465 Op::Packages(PackagesOp::RemoveActionsAccess),
466 ],
467 ),
468 (
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97469 "Deployments",
470 "A repository's deployments wherever they run: reported from any CI with these routes, made by g1t Actions jobs with an `environment:`, or built on g1t.page. Each has statuses, shows on its commit as the check `deploy / <environment>`, and belongs to an environment.",
471 &[
472 Op::Deployments(DeploymentsOp::ListDeployments),
473 Op::Deployments(DeploymentsOp::CreateDeployment),
474 Op::Deployments(DeploymentsOp::GetDeployment),
475 Op::Deployments(DeploymentsOp::ListDeploymentStatuses),
476 Op::Deployments(DeploymentsOp::CreateDeploymentStatus),
477 Op::Deployments(DeploymentsOp::ListEnvironments),
478 Op::Deployments(DeploymentsOp::GetEnvironment),
Merge branch 'worktree-agent-a4d35ee70c50683d0' into claude/cool-newton-7nm8r9479 Op::Deployments(DeploymentsOp::StartDeploymentBuild),
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97480 ],
481 ),
482 (
Projects have Observability: their requests, logs, traces, metrics and errors, from apps on g1t.page with nothing to set up, and from software anywhere else over OpenTelemetry.483 "Observability",
484 "What a project's running software did: its requests, logs, traces, grouped errors and metrics, from its apps on g1t.page with nothing to set up and from OpenTelemetry (OTLP over HTTP) sent from anywhere with an ingest token. Reading needs a role of your own on the project's repository; resolving errors, Triage; settings, ingest tokens, exports and usage, Admin.",
485 &[
486 Op::Telemetry(TelemetryOp::GetOverview),
487 Op::Telemetry(TelemetryOp::ListRequests),
488 Op::Telemetry(TelemetryOp::GetRequest),
489 Op::Telemetry(TelemetryOp::ListLogs),
490 Op::Telemetry(TelemetryOp::ListTraces),
491 Op::Telemetry(TelemetryOp::GetTrace),
492 Op::Telemetry(TelemetryOp::ListErrors),
493 Op::Telemetry(TelemetryOp::UpdateError),
494 Op::Telemetry(TelemetryOp::ListMetrics),
495 Op::Telemetry(TelemetryOp::GetMetric),
496 Op::Telemetry(TelemetryOp::GetSettings),
497 Op::Telemetry(TelemetryOp::UpdateSettings),
498 Op::Telemetry(TelemetryOp::ListTokens),
499 Op::Telemetry(TelemetryOp::CreateToken),
500 Op::Telemetry(TelemetryOp::DeleteToken),
501 Op::Telemetry(TelemetryOp::ListExports),
502 Op::Telemetry(TelemetryOp::CreateExport),
503 Op::Telemetry(TelemetryOp::UpdateExport),
504 Op::Telemetry(TelemetryOp::DeleteExport),
505 Op::Telemetry(TelemetryOp::GetUsage),
506 ],
507 ),
508 (
Merge branch 'worktree-agent-a3abfcce648e87dca'509 "Run protection",
510 "What keeps workflow runs safe: environments' protection rules (required reviewers, a wait timer, which branches may deploy) and the reviews of the jobs they hold, approving a pull request's run from outside, what a job's token gets when its workflow writes no `permissions:`, and repository_dispatch, which a job's own token may send.",
511 &[
512 Op::Protection(ProtectionOp::UpdateEnvironment),
513 Op::Protection(ProtectionOp::DeleteEnvironment),
514 Op::Protection(ProtectionOp::GetPendingDeployments),
515 Op::Protection(ProtectionOp::ReviewPendingDeployments),
516 Op::Protection(ProtectionOp::ApproveWorkflowRun),
517 Op::Protection(ProtectionOp::GetWorkflowPermissions),
518 Op::Protection(ProtectionOp::SetWorkflowPermissions),
519 Op::Protection(ProtectionOp::GetForkPrApproval),
520 Op::Protection(ProtectionOp::SetForkPrApproval),
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts521 Op::Protection(ProtectionOp::GetActionsAccess),
522 Op::Protection(ProtectionOp::SetActionsAccess),
Merge branch 'worktree-agent-a3abfcce648e87dca'523 Op::Protection(ProtectionOp::CreateRepositoryDispatch),
524 Op::Protection(ProtectionOp::GetWorkspaceWorkflowPermissions),
525 Op::Protection(ProtectionOp::SetWorkspaceWorkflowPermissions),
Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's.526 Op::Protection(ProtectionOp::ListWorkspaceManagedWorkflows),
527 Op::Protection(ProtectionOp::CreateWorkspaceManagedWorkflow),
528 Op::Protection(ProtectionOp::UpdateWorkspaceManagedWorkflow),
529 Op::Protection(ProtectionOp::DeleteWorkspaceManagedWorkflow),
Merge branch 'worktree-agent-a3abfcce648e87dca'530 ],
531 ),
532 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise533 "Secrets and variables",
534 "Values that workflows and deployments read, per repository or for a whole workspace, with a row per environment.",
535 &[
536 Op::ListActionsSecrets,
537 Op::SetActionsSecret,
538 Op::DeleteActionsSecret,
539 Op::ListActionsVariables,
540 Op::SetActionsVariable,
541 Op::DeleteActionsVariable,
542 ],
543 ),
544 (
545 "Runners",
The API and MCP server no longer offer g1t's own agents. g1t is what your coding agents work against, not an agent of its own, so the operations that drove hosted agents are gone: messaging an agent on a pull request (message_agent, take_messages, answer_message), assigning or delegating an issue to g1t (assign_issue, delegate), plans (plan_work, get_plan, apply_plan), the context hub (search_context, get_entity), model routes, agents' computers, AI Gateway requests, "Fix with g1t" on a security alert, and every Customize route (marketplaces, plugins, connectors). The callbacks the agent sandbox reported through (/agent-runs/*, /runs/:id/usage, /plans/:id, /reviews/:id) go with them, update_repo_settings stops accepting agent_review, max_revisions and hold_low_confidence, import_issue stops accepting assign, and an old agent token with no run behind it is refused.546 "Self-hosted runners: your own machines, which run your workflow jobs for $0 of g1t compute. They register with a short-lived token and only ever connect out.",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise547 &[
548 Op::ListRunners,
549 Op::CreateRunnerRegistrationToken,
550 Op::RemoveRunner,
551 Op::ListRunnerGroups,
552 Op::CreateRunnerGroup,
553 Op::UpdateRunnerGroup,
554 Op::DeleteRunnerGroup,
555 Op::GetRunnerSettings,
556 Op::UpdateRunnerSettings,
Every agent can have its own computer. A session that needs one wakes it: a home of its own on g1t cloud, one per agent and never shared, where it runs commands, reads and writes files and keeps what it made, with each session working in its own folder under a shared home; after ten idle minutes it sleeps, its home kept as a snapshot and restored when it wakes, and Reset wipes the home while memory and artifacts stay. Its shell and files are abilities with the usual choices, Alone, Alone when asked, Ask first or Never, offered only inside sessions and never to a chat reply; every command shows on the session with its output, and the agent's new Computer tab shows the state, the disk used of the five gigabytes included, the recent commands, and Wake, Put to sleep and Reset. Machine time counts only while it is awake, on the sandbox lines of the ledger that name the agent and who asked, held to the same spend caps as the session; the disk itself costs nothing in this version. The runner gained a long-lived supervisor that answers the computer's requests inside the container, and the runner service a computer per agent that keeps its snapshot in the agent homes bucket when one is attached, and says so when none is. The REST API and the agent tool can read a computer, wake it, put it to sleep and reset it. The agents, abilities, sessions, runners, billing and deploy guides say how it works and what an operator sets up; pinning a computer to your own runner, its browser and take-over come next.557 ],
558 ),
559 (
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise560 "Webhooks",
561 "Signed HTTPS requests sent to your own address as things happen, for a repository or a whole workspace.",
562 &[
563 Op::ListWebhooks,
564 Op::CreateWebhook,
565 Op::UpdateWebhook,
566 Op::DeleteWebhook,
567 Op::PingWebhook,
568 Op::ListWebhookDeliveries,
569 Op::RedeliverWebhook,
570 ],
571 ),
572 (
573 "Integrations",
The contracts no longer describe g1t's own agents, and workspaces can keep their AI providers. Every consumer had already stopped using them, so the TypeScript and Rust contracts drop the workspace-agent, ability, look, skill-library, context, runner-agent and mention modules, the chat and docs RPCs agents posted and read through, the folio agent methods, the agent_waiting notification, agent.asked and memory.changed events, AI credit, token and gateway billing types, model routes and sessions, team agents, agent tokens, plan, review, message and confidence types, command rules, cost caps and confidence rules. The agents:run and models:* scopes are no longer offered by any preset, OAuth default or permission form, but a stored token or grant that names them still reads; and the removed operations are gone from the scope table, so the API's check that every operation has exactly one scope is strict again. What stored data needs in order to parse (old run and credential kinds, an agent team lead, retired rules and webhook events, old guardrail and integration settings) still parses, and a run's token is still PrincipalKind::Agent, which now means a run's token and the @g1t rows written before. The customize, marketplace, skills and claude-plugin contracts stay only until the mobile app drops its Customize screens.574 "A workspace's connections to outside systems: AI providers, alert sources and issue trackers.",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise575 &[
576 Op::ListIntegrations,
577 Op::ConnectIntegration,
AI Gateway: OpenAI's format, open models, and your own providers578 Op::UpdateIntegration,
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise579 Op::DisconnectIntegration,
580 Op::TestIntegration,
581 Op::GetContext,
582 Op::ImportIssue,
Merge remote-tracking branch 'origin/claude/cool-newton-7nm8r9' into claude/cool-newton-7nm8r9583 ],
584 ),
585 (
Merge main into Artifacts Phase 2586 "Artifacts",
587 "A workspace's docs, slides, designs and dashboards (Artifacts mode): listing and searching the ones you can open, reading and editing their content in Markdown, making, moving, trashing and restoring them, their versions, and who can open them. Each answers for your own role on it. Not workflow runs' artifacts, which are under Actions. Slides, designs and dashboards answer that they are not here yet.",
588 &[
589 Op::Folios(FoliosOp::List),
590 Op::Folios(FoliosOp::Search),
591 Op::Folios(FoliosOp::Get),
592 Op::Folios(FoliosOp::GetContent),
593 Op::Folios(FoliosOp::ListVersions),
594 Op::Folios(FoliosOp::GetAccess),
595 Op::Folios(FoliosOp::ListTemplates),
596 Op::Folios(FoliosOp::ListSpaces),
597 Op::Folios(FoliosOp::QueryDataset),
598 Op::Folios(FoliosOp::Create),
599 Op::Folios(FoliosOp::Update),
600 Op::Folios(FoliosOp::Edit),
601 Op::Folios(FoliosOp::Trash),
602 Op::Folios(FoliosOp::Restore),
603 Op::Folios(FoliosOp::RestoreVersion),
604 Op::Folios(FoliosOp::SetAccess),
605 Op::Folios(FoliosOp::Purge),
606 ],
607 ),
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise608];
609
610/// The section of the API reference an operation is listed under.
611fn tag(op: Op) -> &'static str {
612 SECTIONS
613 .iter()
614 .find(|(_, _, ops)| ops.contains(&op))
615 .map_or("Repositories", |(name, _, _)| name)
616}
617
618/// What an operation's page is called, as a short sentence.
619fn title(op: Op) -> &'static str {
620 match op {
621 Op::Whoami => "Get the current user",
Merge branch 'worktree-agent-ad7c6d88d93adc817'622 Op::GetWorkspace => "Get a workspace",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise623 Op::CreateWorkspace => "Create a workspace",
624 Op::DeleteWorkspace => "Delete a workspace",
625 Op::UpdateWorkspace => "Update a workspace",
Merge main (membership, two-factor, GitHub repo roles) into tokens626 Op::ListMembers => "List a workspace's members",
627 Op::UpdateMember => "Change a member's role",
628 Op::RemoveMember => "Remove a member",
629 Op::TransferOwnership => "Transfer a workspace's ownership",
630 Op::LeaveWorkspace => "Leave a workspace",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise631 Op::ListEmails => "List your email addresses",
632 Op::AddEmail => "Add an email address",
Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036)633 Op::ConfirmEmail => "Confirm an email address",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise634 Op::RemoveEmail => "Remove an email address",
635 Op::UpdateEmailSettings => "Change your email settings",
636 Op::ListWorkspaceInvites => "List a workspace's invites",
637 Op::InviteMember => "Invite someone to a workspace",
Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)638 Op::ListInvitations => "List your workspace invitations",
639 Op::AcceptInvitation => "Accept a workspace invitation",
640 Op::DeclineInvitation => "Decline a workspace invitation",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise641 Op::RevokeWorkspaceInvite => "Revoke a workspace's invite",
642 Op::TransferRepo => "Transfer a repository",
643 Op::RenameRepo => "Rename a repository",
644 Op::RenameBranch => "Rename a branch",
The Branches page does things to branches now. It has tabs (Overview, Yours, Active, Stale, All, kept in the address as ?tab=) and search; Overview shows the default branch, then the first five of your branches, the active ones and the stale ones, each linking to the rest. Each branch is a row with its name in a code chip with a copy button, who made its latest commit and when, that commit's checks, behind and ahead counts with bars drawn against the largest shown, and its pull request (the open one, else the newest merged or closed) with its state; on a phone the columns fold under the name. Yours is branches whose latest commit is the viewer's; stale is no commit in 90 days.645 Op::CreateBranch => "Create a branch",
646 Op::DeleteBranch => "Delete a branch",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise647 Op::ArchiveRepo => "Archive a repository",
648 Op::UnarchiveRepo => "Unarchive a repository",
649 Op::SetRepoVisibility => "Change a repository's visibility",
650 Op::DeleteRepo => "Delete a repository",
651 Op::ListDeletedRepos => "List recently deleted repositories",
652 Op::RestoreRepo => "Restore a deleted repository",
653 Op::PurgeRepo => "Purge a deleted repository",
654 Op::ListRepos => "List repositories",
655 Op::GetRepo => "Get a repository",
656 Op::CreateRepo => "Create a repository",
657 Op::UpdateRepo => "Update a repository",
658 Op::GetRepoSettings => "Get repository settings",
659 Op::UpdateRepoSettings => "Update repository settings",
660 Op::ListCheckNames => "List check names",
661 Op::GetMergeQueue => "Get the merge queue",
662 Op::Remember => "Remember something",
663 Op::Recall => "Recall memory",
664 Op::Search => "Search g1t",
665 Op::ListIssues => "List issues",
666 Op::GetIssue => "Get an issue",
667 Op::CreateIssue => "Create an issue",
668 Op::UpdateIssue => "Update an issue",
669 Op::CloseIssue => "Close an issue",
670 Op::ReopenIssue => "Reopen an issue",
671 Op::ListLabels => "List labels",
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar672 Op::CreateLabel => "Create a label",
673 Op::UpdateLabel => "Update a label",
674 Op::DeleteLabel => "Delete a label",
675 Op::AddDefaultLabels => "Add the default labels",
676 Op::ListIssueLabels => "List an issue's labels",
677 Op::AddIssueLabels => "Add labels to an issue",
678 Op::SetIssueLabels => "Set an issue's labels",
679 Op::RemoveIssueLabels => "Remove labels from an issue",
680 Op::ListMilestones => "List milestones",
681 Op::GetMilestone => "Get a milestone",
682 Op::CreateMilestone => "Create a milestone",
683 Op::UpdateMilestone => "Update a milestone",
684 Op::DeleteMilestone => "Delete a milestone",
685 Op::UpdatePullRequest => "Update a pull request",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise686 Op::AddComment => "Add a comment",
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts687 Op::EditComment => "Edit a comment",
688 Op::DeleteComment => "Delete a comment",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise689 Op::ReviewPullRequest => "Review a pull request",
690 Op::ListPullRequests => "List pull requests",
691 Op::GetPullRequest => "Get a pull request",
692 Op::CreatePullRequest => "Create a pull request",
693 Op::RecordSession => "Record session entries",
694 Op::ReadSession => "Read a session",
Merge branch 'worktree-agent-ab8033ab973f8d99a'695 Op::RecordDecision => "Record a decision",
696 Op::ListDecisions => "List a pull request's decisions",
697 Op::Why => "Explain a line",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise698 Op::MarkPullRequestReady => "Mark a pull request ready",
699 Op::ClosePullRequest => "Close a pull request",
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts700 Op::ReopenPullRequest => "Reopen a pull request",
701 Op::ConvertPullRequestToDraft => "Convert a pull request to a draft",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise702 Op::GetPullRequestChanges => "Get a pull request's changes",
703 Op::MergePullRequest => "Merge a pull request",
704 Op::ListEvents => "List repository events",
705 Op::ListIntegrations => "List integrations",
706 Op::ConnectIntegration => "Connect an integration",
AI Gateway: OpenAI's format, open models, and your own providers707 Op::UpdateIntegration => "Update an integration",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise708 Op::DisconnectIntegration => "Disconnect an integration",
709 Op::TestIntegration => "Test an integration",
710 Op::GetContext => "Look up a ticket",
711 Op::ImportIssue => "Import an issue",
712 Op::ListWebhooks => "List webhooks",
713 Op::CreateWebhook => "Create a webhook",
714 Op::UpdateWebhook => "Update a webhook",
715 Op::DeleteWebhook => "Delete a webhook",
716 Op::PingWebhook => "Ping a webhook",
717 Op::ListWebhookDeliveries => "List webhook deliveries",
718 Op::RedeliverWebhook => "Redeliver a webhook delivery",
719 Op::ListWorkflows => "List workflows",
Merge branch 'worktree-agent-a4db4b523bb973765'720 Op::GetWorkflow => "Get a workflow",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise721 Op::ListWorkflowRuns => "List workflow runs",
722 Op::GetWorkflowRun => "Get a workflow run",
723 Op::GetJobLogs => "Get a job's log",
724 Op::DispatchWorkflow => "Run a workflow",
725 Op::CancelWorkflowRun => "Cancel a workflow run",
726 Op::RerunWorkflowRun => "Re-run a workflow run",
727 Op::UpdateWorkflow => "Turn a workflow on or off",
728 Op::ListActionsSecrets => "List secrets",
729 Op::SetActionsSecret => "Set a secret",
730 Op::DeleteActionsSecret => "Delete a secret",
731 Op::ListActionsVariables => "List variables",
732 Op::SetActionsVariable => "Set a variable",
733 Op::DeleteActionsVariable => "Delete a variable",
734 Op::ListRunners => "List self-hosted runners",
735 Op::ListRunnerGroups => "List runner groups",
736 Op::GetRunnerSettings => "Get runner settings",
737 Op::CreateRunnerRegistrationToken => "Create a runner registration token",
738 Op::RemoveRunner => "Remove a self-hosted runner",
739 Op::CreateRunnerGroup => "Create a runner group",
740 Op::UpdateRunnerGroup => "Change a runner group",
741 Op::DeleteRunnerGroup => "Delete a runner group",
742 Op::UpdateRunnerSettings => "Change runner settings",
743 Op::ListCollaborators => "List who has access",
744 Op::AddCollaborator => "Add a collaborator",
745 Op::UpdateCollaborator => "Change a collaborator's role",
746 Op::RemoveCollaborator => "Remove a collaborator",
747 Op::GetCollaboratorPermission => "Get someone's permission",
748 Op::ListRepoInvitations => "List a repository's invitations",
749 Op::RevokeRepoInvitation => "Revoke a repository invitation",
750 Op::ListMyRepoInvitations => "List your repository invitations",
751 Op::AcceptRepoInvitation => "Accept a repository invitation",
752 Op::DeclineRepoInvitation => "Decline a repository invitation",
753 Op::SetBasePermission => "Set the base permission",
754 Op::ListOutsideCollaborators => "List outside collaborators",
755 Op::ListSecurityAlerts => "List security alerts",
756 Op::DismissSecurityAlert => "Dismiss a security alert",
757 Op::ReopenSecurityAlert => "Reopen a security alert",
API: notifications over REST and MCP, with notifications scopes758 Op::ListNotifications => "List notifications",
759 Op::MarkNotificationsRead => "Mark notifications read",
760 Op::GetNotificationThread => "Get a thread",
761 Op::MarkThreadRead => "Mark a thread read",
762 Op::MarkThreadDone => "Mark a thread done",
763 Op::SaveThread => "Save a thread",
764 Op::SnoozeThread => "Snooze a thread",
765 Op::GetThreadSubscription => "Get a thread subscription",
766 Op::SetThreadSubscription => "Set a thread subscription",
767 Op::DeleteThreadSubscription => "Unsubscribe from a thread",
768 Op::GetRepoSubscription => "Get how you watch a repository",
769 Op::SetRepoSubscription => "Watch a repository",
770 Op::DeleteRepoSubscription => "Stop watching a repository",
771 Op::ListWatchedRepos => "List repositories you watch",
API: pinned projects over REST and MCP772 Op::ListPinnedProjects => "List your pinned projects",
Usage, Billing settings and prepaid AI credit; fixes from the UX audit773 Op::GetUsage => "Get a workspace's usage",
774 Op::GetBudget => "Get a workspace's budget",
775 Op::SetBudget => "Change a workspace's budget",
776 Op::ListInvoices => "List a workspace's invoices",
777 Op::GetBillingDetails => "Get a workspace's billing details",
API: pinned projects over REST and MCP778 Op::PinProject => "Pin a project",
779 Op::UnpinProject => "Unpin a project",
780 Op::ReorderPinnedProjects => "Reorder your pinned projects",
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97781 Op::ListProjects => "List a workspace's projects",
g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other.782 Op::GetWorkspaceActivity => "Get a workspace's activity",
783 Op::GetContents => "Get repository contents",
784 Op::ListCommits => "List commits",
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97785 Op::GetProject => "Get a project",
786 Op::UpdateProject => "Update a project",
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar787 Op::ListTeams => "List teams",
788 Op::GetTeam => "Get a team",
789 Op::CreateTeam => "Create a team",
790 Op::UpdateTeam => "Update a team",
791 Op::DeleteTeam => "Delete a team",
792 Op::ListTeamMembers => "List a team's members",
793 Op::SetTeamMember => "Add or change a team member",
794 Op::RemoveTeamMember => "Remove a team member",
795 Op::ListChildTeams => "List child teams",
796 Op::ListTeamRepos => "List a team's repositories",
797 Op::SetTeamRepo => "Give a team a role on a repository",
798 Op::RemoveTeamRepo => "Remove a team from a repository",
799 Op::SetTeamReviewAssignment => "Set a team's review assignment",
800 Op::ListUserTeams => "List someone's teams",
801 Op::RequestReviewers => "Request reviewers",
802 Op::RemoveRequestedReviewers => "Remove requested reviewers",
803 Op::GetCodeownersErrors => "List CODEOWNERS errors",
804 Op::Security(op) => op.title(),
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge805 Op::Rules(op) => op.title(),
Merge checks: statuses and check runs on every commit806 Op::Checks(op) => op.title(),
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97807 Op::About(op) => op.title(),
808 Op::Deployments(op) => op.title(),
Projects have Observability: their requests, logs, traces, metrics and errors, from apps on g1t.page with nothing to set up, and from software anywhere else over OpenTelemetry.809 Op::Telemetry(op) => op.title(),
Merge branch 'worktree-agent-a3abfcce648e87dca'810 Op::Protection(op) => op.title(),
API and MCP for a workspace's personal access token rules, members' tokens and approvals811 Op::Tokens(op) => op.title(),
Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2812 Op::Artifacts(op) => op.title(),
Merge branch 'worktree-agent-a3b9b1f730f55b5bf'813 Op::Caches(op) => op.title(),
Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's.814 Op::Archives(op) => op.title(),
Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca815 Op::DeployKeys(op) => op.title(),
Merge packages: roles, Actions access, source label, soft delete, API816 Op::Packages(op) => op.title(),
Merge main into Artifacts Phase 2817 Op::Folios(op) => op.title(),
Merge branch 'worktree-agent-a6ec0a89d7fe7a9ae'818 Op::Coordination(op) => op.title(),
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise819 }
820}
821
822/// Why an operation can be refused with `402 payment_required`, if it
The API and MCP server no longer offer g1t's own agents. g1t is what your coding agents work against, not an agent of its own, so the operations that drove hosted agents are gone: messaging an agent on a pull request (message_agent, take_messages, answer_message), assigning or delegating an issue to g1t (assign_issue, delegate), plans (plan_work, get_plan, apply_plan), the context hub (search_context, get_entity), model routes, agents' computers, AI Gateway requests, "Fix with g1t" on a security alert, and every Customize route (marketplaces, plugins, connectors). The callbacks the agent sandbox reported through (/agent-runs/*, /runs/:id/usage, /plans/:id, /reviews/:id) go with them, update_repo_settings stops accepting agent_review, max_revisions and hold_low_confidence, import_issue stops accepting assign, and an old agent token with no run behind it is refused.823/// can: the ones that make a repository private in a workspace, when a
824/// free workspace's private storage has no room for it.
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise825fn may_need_payment(op: Op) -> Option<&'static str> {
826 match op {
827 Op::UpdateRepo | Op::SetRepoVisibility | Op::TransferRepo => Some(
828 "A free workspace's private storage has no room for this private repository.",
829 ),
830 _ => None,
831 }
832}
833
834/// What the reference says beyond each operation's own description, keyed
835/// by operation id, written by hand from what the services return: `notes`
836/// (Markdown, added to the description) and example `params` (path),
837/// `query`, `request` (body) and `response`.
838const REFERENCE: &str = include_str!("reference.json");
839
840fn examples() -> Map<String, Value> {
841 match serde_json::from_str(REFERENCE) {
842 Ok(Value::Object(examples)) => examples,
843 _ => Map::new(),
844 }
845}
846
847/// `/repos/:owner/:name` as OpenAPI writes it: `/repos/{owner}/{name}`.
848fn openapi_path(route: &Route) -> String {
849 route
850 .path
851 .split('/')
852 .map(|segment| match segment.strip_prefix(':') {
853 Some(name) => format!("{{{name}}}"),
854 None => segment.to_owned(),
855 })
856 .collect::<Vec<_>>()
857 .join("/")
858}
859
860fn error_response(description: &str) -> Value {
861 json!({
862 "description": description,
863 "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } },
864 })
865}
866
867/// A parameter in the path or the query, described by the operation's
868/// input schema where it has the same name.
869fn parameter(name: &str, place: &str, required: bool, schema: Option<&Value>) -> Value {
870 let mut schema = schema.cloned().unwrap_or_else(|| json!({ "type": "string" }));
871 let description = match name {
872 "owner" => Some(Value::from("The workspace that owns the repository.")),
873 "name" => Some(Value::from("The repository's name.")),
874 _ => schema.as_object_mut().and_then(|schema| schema.remove("description")),
875 };
876 let mut parameter = json!({
877 "name": name,
878 "in": place,
879 "required": required,
880 "schema": schema,
881 });
882 if let Some(description) = description {
883 parameter["description"] = description;
884 }
885 parameter
886}
887
888/// The operation id of a route. An operation reached at a workspace's
889/// address as well as a repository's is documented once for each, with its
890/// own id; GitHub's alternative addresses for one operation keep GitHub's
891/// names.
892fn operation_id(route: &Route) -> String {
893 let op = route.op;
894 let base = match (route.method, route.path.rsplit('/').next().unwrap_or_default()) {
895 ("PUT", "enable") => "enable_workflow".to_owned(),
896 ("PUT", "disable") => "disable_workflow".to_owned(),
897 ("POST", "rerun-failed-jobs") => "rerun_failed_jobs".to_owned(),
Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009)898 ("POST", "rerun") if route.path.contains("/jobs/:job/") => "rerun_job".to_owned(),
899 ("POST", "force-cancel") => "force_cancel_workflow_run".to_owned(),
900 ("GET", ":attempt") => "get_workflow_run_attempt".to_owned(),
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise901 ("PATCH", ":setting") => "update_actions_variable".to_owned(),
902 ("GET", "runs") if route.path.contains("/workflows/:workflow/") => "list_runs_of_workflow".to_owned(),
API: notifications over REST and MCP, with notifications scopes903 // One repository's notifications, and an issue's subscription by
904 // its number rather than a thread's id.
905 (_, "notifications") if route.path.starts_with("/repos/") => match op {
906 Op::ListNotifications => "list_repo_notifications".to_owned(),
907 _ => "mark_repo_notifications_read".to_owned(),
908 },
909 (method, "subscription") if route.path.contains("/issues/:number/") => match method {
910 "GET" => "get_issue_subscription".to_owned(),
911 "PUT" => "set_issue_subscription".to_owned(),
912 _ => "delete_issue_subscription".to_owned(),
913 },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar914 // One label off an issue, by its name in the path.
915 ("DELETE", ":label") if route.path.contains("/issues/:number/") => "remove_issue_label".to_owned(),
API: notifications over REST and MCP, with notifications scopes916 ("DELETE", "saved") => "unsave_thread".to_owned(),
917 ("DELETE", "snooze") => "unsnooze_thread".to_owned(),
Merge branch 'worktree-agent-ab8033ab973f8d99a'918 // An issue's decisions, by its number.
919 ("GET", "decisions") if route.path.contains("/issues/:number/") => "list_issue_decisions".to_owned(),
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise920 _ => op.name().to_owned(),
921 };
922 if route.path.starts_with("/workspaces/") && ROUTES.iter().any(|other| other.op == op && other.path.starts_with("/repos/")) {
923 format!("{base}_for_workspace")
924 } else {
925 base
926 }
927}
928
929/// The summary of a route: its operation's title, or for one of GitHub's
930/// alternative addresses, what that address does.
931fn summary(route: &Route, id: &str) -> String {
932 let base = match id.trim_end_matches("_for_workspace") {
933 "enable_workflow" => "Turn a workflow on",
934 "disable_workflow" => "Turn a workflow off",
935 "rerun_failed_jobs" => "Re-run failed jobs",
Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009)936 "rerun_job" => "Re-run a job",
937 "force_cancel_workflow_run" => "Force-cancel a workflow run",
938 "get_workflow_run_attempt" => "Get a workflow run attempt",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise939 "update_actions_variable" => "Update a variable",
940 "list_runs_of_workflow" => "List a workflow's runs",
API: notifications over REST and MCP, with notifications scopes941 "list_repo_notifications" => "List a repository's notifications",
942 "mark_repo_notifications_read" => "Mark a repository's notifications read",
943 "get_issue_subscription" => "Get your subscription to an issue",
944 "set_issue_subscription" => "Subscribe to an issue",
945 "delete_issue_subscription" => "Unsubscribe from an issue",
946 "unsave_thread" => "Unsave a thread",
947 "unsnooze_thread" => "Bring a snoozed thread back",
Merge branch 'worktree-agent-ab8033ab973f8d99a'948 "list_issue_decisions" => "List an issue's decisions",
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise949 _ => title(route.op),
950 };
951 if id.ends_with("_for_workspace") {
952 format!("{base} for a workspace")
953 } else {
954 base.to_owned()
955 }
956}
957
958fn operation(route: &Route) -> Value {
959 let op = route.op;
960 let path_params: Vec<&str> = route.params().collect();
Merge checks: statuses and check runs on every commit961 // `owner` and `name` in the path stand for the operation's `repo` input,
962 // so a `name` in the body, such as a check run's, is the body's own.
963 let stands_for_repo =
964 |name: &str| matches!(name, "owner" | "name") && path_params.contains(&"owner") && path_params.contains(&"name");
965 let covered = |name: &str| name == "repo" || (path_params.contains(&name) && !stands_for_repo(name));
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise966 let all_properties = op.properties();
967 let mut properties = all_properties.clone();
968 properties.retain(|name, _| !covered(name));
969 let required: Vec<String> = op
970 .required()
971 .into_iter()
972 .filter(|name| !covered(name))
973 .collect();
974
975 let mut parameters: Vec<Value> = path_params
976 .iter()
Merge checks: statuses and check runs on every commit977 .map(|name| parameter(name, "path", true, if stands_for_repo(name) { None } else { all_properties.get(*name) }))
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise978 .collect();
979 let mut body = Value::Null;
980 if route.method == "GET" {
981 for (name, key) in route.query {
982 parameters.push(parameter(
983 name,
984 "query",
985 required.iter().any(|required| required == key),
986 properties.get(*key),
987 ));
988 }
989 } else if !properties.is_empty() {
990 let mut schema = json!({ "type": "object", "properties": properties });
991 if !required.is_empty() {
992 schema["required"] = json!(required);
993 }
994 body = json!({
995 "required": !required.is_empty(),
996 "content": { "application/json": { "schema": schema } },
997 });
998 }
999
1000 let id = operation_id(route);
1001 let mut responses = Map::new();
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts1002 if route.no_content() {
1003 responses.insert("204".into(), json!({ "description": "Success. There is no body." }));
1004 } else {
1005 responses.insert(
1006 "200".into(),
1007 json!({
1008 "description": "Success.",
1009 "content": { "application/json": { "schema": {} } },
1010 }),
1011 );
1012 }
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise1013 responses.insert(
1014 "401".into(),
1015 error_response("A token is required, or the one sent is not valid."),
1016 );
1017 if let Some(reason) = may_need_payment(op) {
1018 responses.insert("402".into(), error_response(reason));
1019 }
1020 responses.insert(
1021 "403".into(),
1022 error_response("Signed in, but not allowed to do this: the role you have is not enough, or the token lacks the scope it needs, which `needed_scope` names."),
1023 );
1024 if !matches!(op, Op::Whoami | Op::ListRepos | Op::Search) {
1025 responses.insert("404".into(), error_response("It does not exist, or you cannot see it."));
1026 }
1027 if route.method != "GET" {
1028 responses.insert(
1029 "409".into(),
1030 error_response("The request conflicts with the current state."),
1031 );
1032 }
1033 if op != Op::Whoami {
1034 responses.insert("422".into(), error_response("The input is not valid."));
1035 }
1036 // Public data can be read without a token; everything else needs one.
1037 let scope: Vec<&str> = scope_for(op.name()).map(|scope| scope.as_str()).into_iter().collect();
1038 let security = if op.needs_user() {
1039 json!([{ "token": scope }])
1040 } else {
1041 json!([{ "token": scope }, {}])
1042 };
1043 let (tool, action) = crate::tools::TOOLS
1044 .iter()
1045 .find_map(|tool| {
1046 tool.actions
1047 .iter()
1048 .find(|action| action.op == op)
1049 .map(|action| (tool.name, action.name))
1050 })
1051 .unwrap_or_default();
1052 let mut described = json!({
1053 "operationId": id,
1054 "tags": [tag(op)],
1055 "summary": summary(route, &id),
1056 "description": op.description(),
1057 "x-operation": op.name(),
1058 "x-mcp-tool": tool,
1059 "x-mcp-action": action,
1060 "x-scope": scope.first().copied(),
1061 "security": security,
1062 "parameters": parameters,
1063 "responses": responses,
1064 });
1065 if !body.is_null() {
1066 described["requestBody"] = body;
1067 }
1068 described
1069}
1070
1071/// Entries for device sign-in, which is not an operation.
1072fn onboarding() -> Map<String, Value> {
1073 let paths = json!({
1074 "/device/code": {
1075 "post": {
1076 "operationId": "device_code",
1077 "tags": ["Accounts"],
1078 "summary": "Start signing in",
1079 "description": "Begins a device sign-in. Show the person `verification_uri_complete` and have them open it in a browser, where they sign in or register and approve the code. Then poll `/device/token`.",
1080 "security": [],
1081 "requestBody": {
1082 "content": { "application/json": { "schema": {
1083 "type": "object",
1084 "properties": {
1085 "client_name": {
1086 "type": "string",
1087 "description": "What is asking, shown to the person approving. For example, Claude Code.",
1088 },
1089 },
1090 } } },
1091 },
1092 "responses": { "200": {
1093 "description": "The codes for this sign-in.",
1094 "content": { "application/json": { "schema": {
1095 "type": "object",
1096 "properties": {
1097 "device_code": { "type": "string", "description": "Secret. Send it to /device/token." },
1098 "user_code": { "type": "string", "description": "Shown to the person, like WDJB-MJHT." },
1099 "verification_uri": { "type": "string" },
1100 "verification_uri_complete": {
1101 "type": "string",
1102 "description": "The link to give the person; it carries the code.",
1103 },
1104 "expires_in": { "type": "integer", "description": "Seconds until the codes expire." },
1105 "interval": { "type": "integer", "description": "Seconds to wait between polls." },
1106 },
1107 } } },
1108 } },
1109 },
1110 },
1111 "/device/token": {
1112 "post": {
1113 "operationId": "device_token",
1114 "tags": ["Accounts"],
1115 "summary": "Finish signing in",
1116 "description": "Asks whether the person has approved. Poll no faster than the interval. The token is returned once.",
1117 "security": [],
1118 "requestBody": {
1119 "required": true,
1120 "content": { "application/json": { "schema": {
1121 "type": "object",
1122 "required": ["device_code"],
1123 "properties": { "device_code": { "type": "string" } },
1124 } } },
1125 },
1126 "responses": { "200": {
1127 "description": "The state of the sign-in.",
1128 "content": { "application/json": { "schema": {
1129 "type": "object",
1130 "required": ["status"],
1131 "properties": {
1132 "status": { "type": "string", "enum": ["pending", "approved", "denied", "expired"] },
1133 "token": { "type": "string", "description": "Present when approved." },
Cards you act on in chat; agents comment and review as themselves; names shown cleanly; commits on the calendar1134 "username": { "type": "string", "description": "Lowercased: what the account is found and linked by." },
1135 "display_username": { "type": "string", "description": "The username as its owner wrote it; the same as username when they chose no case." },
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise1136 "verified": {
1137 "type": "boolean",
1138 "description": "Whether the account's email is confirmed.",
1139 },
1140 },
1141 } } },
1142 } },
1143 },
1144 },
1145 });
1146 match paths {
1147 Value::Object(paths) => paths,
1148 _ => Map::new(),
1149 }
1150}
1151
1152
1153/// Puts each operation's examples, where it has them, into its request
1154/// and response. Path and query values go under `x-example-params` and
1155/// `x-example-query`, which tools that build a request can use.
1156fn attach_examples(paths: &mut Map<String, Value>) {
1157 let examples = examples();
1158 for methods in paths.values_mut() {
1159 let Some(methods) = methods.as_object_mut() else { continue };
1160 for operation in methods.values_mut() {
1161 let id = operation["operationId"].as_str().unwrap_or_default().to_owned();
1162 let name = operation["x-operation"].as_str().unwrap_or_default().to_owned();
1163 let Some(example) = examples.get(&id).or_else(|| examples.get(&name)) else {
1164 continue;
1165 };
1166 if let Some(notes) = example.get("notes").and_then(Value::as_str) {
1167 let description = operation["description"].as_str().unwrap_or_default();
1168 operation["description"] = json!(format!("{description}\n\n{notes}"));
1169 }
1170 if let Some(response) = example.get("response") {
1171 let content = &mut operation["responses"]["200"]["content"]["application/json"];
1172 if content.is_object() {
1173 content["example"] = response.clone();
1174 }
1175 }
1176 if let Some(request) = example.get("request") {
1177 let content = &mut operation["requestBody"]["content"]["application/json"];
1178 if content.is_object() {
1179 content["example"] = request.clone();
1180 }
1181 }
1182 for (key, extension) in [("params", "x-example-params"), ("query", "x-example-query")] {
1183 if let Some(values) = example.get(key) {
1184 operation[extension] = values.clone();
1185 }
1186 }
1187 }
1188 }
1189}
1190
1191pub fn document() -> Value {
1192 let mut paths = onboarding();
1193 for route in ROUTES {
1194 let entry = paths
1195 .entry(openapi_path(route))
1196 .or_insert_with(|| json!({}));
1197 entry[route.method.to_lowercase()] = operation(route);
1198 }
1199 attach_examples(&mut paths);
1200 let tags: Vec<Value> = SECTIONS
1201 .iter()
1202 .map(|(name, description, ops)| {
1203 json!({
1204 "name": name,
1205 "description": description,
1206 // The section's operations in reading order, by MCP tool name.
1207 "x-tools": ops.iter().map(|op| op.name()).collect::<Vec<_>>(),
1208 })
1209 })
1210 .collect();
1211 let codes = ["unauthenticated", "payment_required", "forbidden", "not_found", "conflict", "invalid"];
1212 json!({
1213 "openapi": "3.1.0",
1214 "info": {
1215 "title": "g1t API",
1216 "version": "1",
1217 "description": "The REST API for g1t, a git forge built for agents. The same operations are available to agents as MCP tools at https://mcp.g1t.sh. Every name in a request or response body is `snake_case`; names you chose, such as a workflow's inputs or a secret's name, are returned as you wrote them.",
1218 "license": { "name": "MIT", "identifier": "MIT" },
1219 },
1220 "servers": [{ "url": "https://api.g1t.sh" }],
1221 "security": [{ "token": [] }, {}],
1222 "tags": tags,
1223 "paths": paths,
1224 "components": {
1225 "securitySchemes": {
1226 "token": {
1227 "type": "http",
1228 "scheme": "bearer",
1229 "description": "An access token, `g1t_…`. Public data needs none. Each operation names the scope a token needs for it; see https://docs.g1t.sh/guides/authentication/#scopes.",
1230 },
1231 },
1232 "schemas": {
1233 "Error": {
1234 "type": "object",
1235 "required": ["error"],
1236 "properties": {
1237 "error": {
1238 "type": "object",
1239 "required": ["code", "message"],
1240 "properties": {
1241 "code": { "type": "string", "enum": codes },
1242 "message": { "type": "string" },
1243 "needed_scope": {
1244 "type": "string",
1245 "description": "On a 403 for an access token without the scope the call needs: that scope, such as `issues:write`.",
1246 },
1247 },
1248 },
1249 },
1250 },
1251 },
1252 },
1253 })
1254}
1255
1256#[cfg(test)]
1257mod tests {
1258 use super::*;
1259
1260 #[test]
1261 fn every_route_is_documented_once() {
1262 let document = document();
1263 let mut ids = Vec::new();
1264 for (_, methods) in document["paths"].as_object().unwrap() {
1265 for (_, operation) in methods.as_object().unwrap() {
1266 ids.push(operation["operationId"].as_str().unwrap().to_owned());
1267 }
1268 }
1269 for op in Op::ALL {
1270 assert_eq!(
1271 ids.iter().filter(|id| *id == op.name()).count(),
1272 1,
1273 "{}",
1274 op.name()
1275 );
1276 }
1277 let mut unique = ids.clone();
1278 unique.sort();
1279 unique.dedup();
1280 assert_eq!(unique.len(), ids.len(), "operation ids repeat");
1281 }
1282
1283 #[test]
1284 fn path_and_query_inputs_are_not_repeated_in_the_body() {
1285 let document = document();
1286 let merge = &document["paths"]["/repos/{owner}/{name}/pulls/{number}/merge"]["post"];
1287 let body = &merge["requestBody"]["content"]["application/json"]["schema"]["properties"];
1288 assert!(body.get("keep_issue_open").is_some());
1289 assert!(body.get("repo").is_none() && body.get("number").is_none());
1290 let list = &document["paths"]["/repos"]["get"];
1291 assert_eq!(list["parameters"][0]["name"], "q");
1292 assert!(list.get("requestBody").is_none());
1293 }
1294
1295 #[test]
1296 fn every_operation_is_in_one_section() {
1297 for op in Op::ALL {
1298 let sections = SECTIONS
1299 .iter()
1300 .filter(|(_, _, ops)| ops.contains(&op))
1301 .count();
1302 assert_eq!(sections, 1, "{}", op.name());
1303 }
1304 }
1305
1306 #[test]
1307 fn titles_read_as_sentences() {
1308 assert_eq!(title(Op::CreateIssue), "Create an issue");
1309 assert_eq!(title(Op::Whoami), "Get the current user");
1310 }
1311
1312 #[test]
1313 fn every_operation_has_an_example_response() {
1314 let examples = examples();
1315 assert!(!examples.is_empty(), "reference.json does not parse");
1316 let document = document();
1317 let mut known = Vec::new();
1318 for (path, methods) in document["paths"].as_object().unwrap() {
1319 for (method, operation) in methods.as_object().unwrap() {
1320 known.push(operation["operationId"].as_str().unwrap().to_owned());
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts1321 // Nothing to show for a success without a body.
1322 if operation["responses"]["204"].is_object() {
1323 continue;
1324 }
README: run the core forge locally with Docker Compose; forks described as copies, not copy-on-write, until Cloudflare says otherwise1325 let example = &operation["responses"]["200"]["content"]["application/json"]["example"];
1326 assert!(!example.is_null(), "{method} {path} has no example response");
1327 }
1328 }
1329 for id in examples.keys() {
1330 assert!(known.contains(id), "reference.json names {id}, which is not an operation");
1331 }
1332 }
1333
1334 #[test]
1335 fn example_requests_send_only_what_the_body_takes() {
1336 let document = document();
1337 for (path, methods) in document["paths"].as_object().unwrap() {
1338 for (method, operation) in methods.as_object().unwrap() {
1339 let content = &operation["requestBody"]["content"]["application/json"];
1340 let Some(example) = content["example"].as_object() else { continue };
1341 let properties = &content["schema"]["properties"];
1342 for key in example.keys() {
1343 assert!(!properties[key].is_null(), "{method} {path}: {key} is not in the body");
1344 }
1345 }
1346 }
1347 }
1348
1349 /// The docs site's copy of the document. Run with `G1T_WRITE_OPENAPI=1`
1350 /// to rewrite it after changing an operation.
1351 #[test]
1352 fn the_docs_copy_is_current() {
1353 let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../docs/src/data/openapi.json");
1354 let current = serde_json::to_string_pretty(&document()).unwrap() + "\n";
1355 if std::env::var_os("G1T_WRITE_OPENAPI").is_some() {
1356 std::fs::write(path, &current).unwrap();
1357 return;
1358 }
1359 let copy = std::fs::read_to_string(path).unwrap_or_default().replace("\r\n", "\n");
1360 assert!(
1361 copy == current,
1362 "apps/docs/src/data/openapi.json is out of date: run G1T_WRITE_OPENAPI=1 cargo test -p g1t-api openapi"
1363 );
1364 }
1365
1366 /// The reference shows responses as they are sent: `snake_case`.
1367 #[test]
1368 fn example_responses_are_snake_case() {
1369 let document = document();
1370 for (path, methods) in document["paths"].as_object().unwrap() {
1371 for (method, operation) in methods.as_object().unwrap() {
1372 let example = &operation["responses"]["200"]["content"]["application/json"]["example"];
1373 let leaked = g1t_kit::wire::camel_case_keys(example);
1374 assert!(leaked.is_empty(), "{method} {path} shows {leaked:?}");
1375 }
1376 }
1377 }
1378
1379 /// Examples never hold anything that reads as a real credential, which
1380 /// secret scanners rightly flag in a public repository: they end in `…`
1381 /// after the prefix, as `whsec_…` and `g1t_…` do.
1382 #[test]
1383 fn examples_hold_no_real_looking_secrets() {
1384 let prefixes = ["whsec_", "g1t_", "g1tr_", "g1trt_", "sk_live_", "sk_test_", "ghp_", "github_pat_", "xoxb-", "AKIA"];
1385 for (line, text) in REFERENCE.lines().enumerate() {
1386 for prefix in prefixes {
1387 let mut rest = text;
1388 while let Some(at) = rest.find(prefix) {
1389 let after = &rest[at + prefix.len()..];
1390 let run = after.chars().take_while(|c| c.is_ascii_alphanumeric()).count();
1391 assert!(
1392 run < 12,
1393 "reference.json line {}: `{prefix}` followed by {run} characters reads as a real secret; write `{prefix}…`",
1394 line + 1
1395 );
1396 rest = after;
1397 }
1398 }
1399 }
1400 }
1401}

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