Skip to content
1,263 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.

API and MCP server in Rust; a public index at the API root1//! REST: each route maps an HTTP request onto one operation.
2
3use serde_json::{Map, Value};
4
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb975use crate::about::AboutOp;
Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R26use crate::artifacts::ArtifactsOp;
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb977use crate::deployments::DeploymentsOp;
API and MCP server in Rust; a public index at the API root8use crate::operations::Op;
Merge checks: statuses and check runs on every commit9use crate::checks::ChecksOp;
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge10use crate::rules::RulesOp;
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar11use crate::security::SecurityOp;
API and MCP server in Rust; a public index at the API root12
13pub struct Route {
14 pub method: &'static str,
15 /// Segments starting with `:` are parameters.
16 pub path: &'static str,
17 pub op: Op,
18 /// Query parameters the route reads, as `(name in the URL, input name)`.
19 pub query: &'static [(&'static str, &'static str)],
20}
21
22const fn route(
23 method: &'static str,
24 path: &'static str,
25 op: Op,
26 query: &'static [(&'static str, &'static str)],
27) -> Route {
28 Route {
29 method,
30 path,
31 op,
32 query,
33 }
34}
35
36pub const ROUTES: &[Route] = &[
Agents as a team: lifecycle, merge queue, billing and a new shell37 route("GET", "/user", Op::Whoami, &[]),
38 route("POST", "/workspaces", Op::CreateWorkspace, &[]),
Merge branch 'worktree-agent-ad7c6d88d93adc817'39 route("GET", "/workspaces/:workspace", Op::GetWorkspace, &[]),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look40 route("DELETE", "/workspaces/:workspace", Op::DeleteWorkspace, &[]),
41 route("GET", "/user/emails", Op::ListEmails, &[]),
42 route("POST", "/user/emails", Op::AddEmail, &[]),
43 route("DELETE", "/user/emails/:email", Op::RemoveEmail, &[]),
44 route("PATCH", "/user/email-settings", Op::UpdateEmailSettings, &[]),
45 route("GET", "/user/invites", Op::ListInvites, &[]),
46 route("POST", "/user/invites", Op::CreateInvite, &[]),
47 route("DELETE", "/user/invites/:id", Op::RevokeInvite, &[]),
48 route("GET", "/workspaces/:workspace/invitations", Op::ListWorkspaceInvites, &[]),
49 route("POST", "/workspaces/:workspace/invitations", Op::InviteMember, &[]),
50 route("DELETE", "/workspaces/:workspace/invitations/:id", Op::RevokeWorkspaceInvite, &[]),
51 // Who has access. GitHub's addresses, but for adding someone, which
52 // takes an email address as well as a username.
53 route("GET", "/repos/:owner/:name/collaborators", Op::ListCollaborators, &[]),
54 route("POST", "/repos/:owner/:name/collaborators", Op::AddCollaborator, &[]),
55 route("PATCH", "/repos/:owner/:name/collaborators/:username", Op::UpdateCollaborator, &[]),
56 route("DELETE", "/repos/:owner/:name/collaborators/:username", Op::RemoveCollaborator, &[]),
57 route(
58 "GET",
59 "/repos/:owner/:name/collaborators/:username/permission",
60 Op::GetCollaboratorPermission,
61 &[],
62 ),
63 route("GET", "/repos/:owner/:name/invitations", Op::ListRepoInvitations, &[]),
64 route("DELETE", "/repos/:owner/:name/invitations/:id", Op::RevokeRepoInvitation, &[]),
65 route("GET", "/user/repository_invitations", Op::ListMyRepoInvitations, &[]),
API: notifications over REST and MCP, with notifications scopes66 // Your notifications: threads, marking them, and what you subscribe
67 // to and watch. GitHub's addresses, with g1t's saved and snoozed.
68 route("GET", "/notifications", Op::ListNotifications, &[("all", "all"), ("participating", "participating"), ("view", "view"), ("reason", "reason"), ("severity", "severity"), ("since", "since"), ("before", "before"), ("cursor", "cursor"), ("per_page", "per_page")]),
69 route("PUT", "/notifications", Op::MarkNotificationsRead, &[]),
70 route("GET", "/notifications/threads/:id", Op::GetNotificationThread, &[]),
71 route("PATCH", "/notifications/threads/:id", Op::MarkThreadRead, &[]),
72 route("DELETE", "/notifications/threads/:id", Op::MarkThreadDone, &[]),
73 route("PUT", "/notifications/threads/:id/saved", Op::SaveThread, &[]),
74 route("DELETE", "/notifications/threads/:id/saved", Op::SaveThread, &[]),
75 route("PUT", "/notifications/threads/:id/snooze", Op::SnoozeThread, &[]),
76 route("DELETE", "/notifications/threads/:id/snooze", Op::SnoozeThread, &[]),
77 route("GET", "/notifications/threads/:id/subscription", Op::GetThreadSubscription, &[]),
78 route("PUT", "/notifications/threads/:id/subscription", Op::SetThreadSubscription, &[]),
79 route("DELETE", "/notifications/threads/:id/subscription", Op::DeleteThreadSubscription, &[]),
80 route("GET", "/repos/:owner/:name/notifications", Op::ListNotifications, &[("all", "all"), ("participating", "participating"), ("view", "view"), ("reason", "reason"), ("severity", "severity"), ("since", "since"), ("before", "before"), ("cursor", "cursor"), ("per_page", "per_page")]),
81 route("PUT", "/repos/:owner/:name/notifications", Op::MarkNotificationsRead, &[]),
82 route("GET", "/repos/:owner/:name/subscription", Op::GetRepoSubscription, &[]),
83 route("PUT", "/repos/:owner/:name/subscription", Op::SetRepoSubscription, &[]),
84 route("DELETE", "/repos/:owner/:name/subscription", Op::DeleteRepoSubscription, &[]),
85 route("GET", "/repos/:owner/:name/issues/:number/subscription", Op::GetThreadSubscription, &[]),
86 route("PUT", "/repos/:owner/:name/issues/:number/subscription", Op::SetThreadSubscription, &[]),
87 route("DELETE", "/repos/:owner/:name/issues/:number/subscription", Op::DeleteThreadSubscription, &[]),
88 route("GET", "/user/subscriptions", Op::ListWatchedRepos, &[]),
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9789 // Stars: yours, and who starred a repository.
90 route("GET", "/user/starred", Op::About(AboutOp::ListStarred), &[]),
91 route("GET", "/user/starred/:owner/:name", Op::About(AboutOp::CheckStarred), &[]),
92 route("PUT", "/user/starred/:owner/:name", Op::About(AboutOp::Star), &[]),
93 route("DELETE", "/user/starred/:owner/:name", Op::About(AboutOp::Unstar), &[]),
94 route("GET", "/repos/:owner/:name/stargazers", Op::About(AboutOp::ListStargazers), &[("page", "page")]),
95 // What the default branch says about a repository, kept by commit.
96 route("GET", "/repos/:owner/:name/languages", Op::About(AboutOp::GetLanguages), &[]),
97 route("GET", "/repos/:owner/:name/contributors", Op::About(AboutOp::ListContributors), &[]),
98 route("GET", "/repos/:owner/:name/license", Op::About(AboutOp::GetLicense), &[]),
99 // Releases: `latest` and `tags/…` before an id.
100 route("GET", "/repos/:owner/:name/releases", Op::About(AboutOp::ListReleases), &[]),
101 route("POST", "/repos/:owner/:name/releases", Op::About(AboutOp::CreateRelease), &[]),
102 route("GET", "/repos/:owner/:name/releases/latest", Op::About(AboutOp::GetLatestRelease), &[]),
103 route("GET", "/repos/:owner/:name/releases/tags/:tag", Op::About(AboutOp::GetReleaseByTag), &[]),
104 route("GET", "/repos/:owner/:name/releases/:id", Op::About(AboutOp::GetRelease), &[]),
105 route("PATCH", "/repos/:owner/:name/releases/:id", Op::About(AboutOp::UpdateRelease), &[]),
106 route("DELETE", "/repos/:owner/:name/releases/:id", Op::About(AboutOp::DeleteRelease), &[]),
API: pinned projects over REST and MCP107 // Your pinned projects in a workspace, in your order.
108 route("GET", "/user/pinned_projects/:workspace", Op::ListPinnedProjects, &[]),
109 route("PUT", "/user/pinned_projects/:workspace", Op::ReorderPinnedProjects, &[]),
110 route("PUT", "/user/pinned_projects/:workspace/:project", Op::PinProject, &[]),
111 route("DELETE", "/user/pinned_projects/:workspace/:project", Op::UnpinProject, &[]),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look112 route("PATCH", "/user/repository_invitations/:id", Op::AcceptRepoInvitation, &[]),
113 route("DELETE", "/user/repository_invitations/:id", Op::DeclineRepoInvitation, &[]),
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily114 route("PATCH", "/workspaces/:workspace", Op::UpdateWorkspace, &[]),
Membership as GitHub has it: owners, roles, member privileges, 2FA115 // Members and owners: GitHub's organization members, by username.
116 route("GET", "/workspaces/:workspace/members", Op::ListMembers, &[]),
117 route("PATCH", "/workspaces/:workspace/members/:username", Op::UpdateMember, &[]),
118 route("DELETE", "/workspaces/:workspace/members/:username", Op::RemoveMember, &[]),
119 route("POST", "/workspaces/:workspace/transfer_ownership", Op::TransferOwnership, &[]),
120 route("DELETE", "/user/memberships/:workspace", Op::LeaveWorkspace, &[]),
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97121 // A workspace's projects: what each is, where it runs, its links.
122 route("GET", "/workspaces/:workspace/projects", Op::ListProjects, &[]),
123 route("GET", "/workspaces/:workspace/projects/:project", Op::GetProject, &[]),
124 route("PATCH", "/workspaces/:workspace/projects/:project", Op::UpdateProject, &[]),
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily125 route("PUT", "/workspaces/:workspace/base_permission", Op::SetBasePermission, &[]),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look126 route(
127 "GET",
128 "/workspaces/:workspace/outside_collaborators",
129 Op::ListOutsideCollaborators,
130 &[],
131 ),
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar132 // Teams: a workspace's groups of members, with roles on repositories.
133 route("GET", "/workspaces/:workspace/teams", Op::ListTeams, &[("q", "query")]),
134 route("POST", "/workspaces/:workspace/teams", Op::CreateTeam, &[]),
135 route("GET", "/workspaces/:workspace/teams/:team", Op::GetTeam, &[]),
136 route("PATCH", "/workspaces/:workspace/teams/:team", Op::UpdateTeam, &[]),
137 route("DELETE", "/workspaces/:workspace/teams/:team", Op::DeleteTeam, &[]),
138 route(
139 "GET",
140 "/workspaces/:workspace/teams/:team/members",
141 Op::ListTeamMembers,
142 &[("include_child_teams", "include_child_teams")],
143 ),
144 route("PUT", "/workspaces/:workspace/teams/:team/members/:username", Op::SetTeamMember, &[]),
145 route("DELETE", "/workspaces/:workspace/teams/:team/members/:username", Op::RemoveTeamMember, &[]),
146 route("GET", "/workspaces/:workspace/teams/:team/teams", Op::ListChildTeams, &[]),
147 route("GET", "/workspaces/:workspace/teams/:team/repos", Op::ListTeamRepos, &[]),
148 route("PUT", "/workspaces/:workspace/teams/:team/repos/:repo", Op::SetTeamRepo, &[]),
149 route("DELETE", "/workspaces/:workspace/teams/:team/repos/:repo", Op::RemoveTeamRepo, &[]),
150 route(
151 "PUT",
152 "/workspaces/:workspace/teams/:team/review_assignment",
153 Op::SetTeamReviewAssignment,
154 &[],
155 ),
156 route("GET", "/workspaces/:workspace/members/:username/teams", Op::ListUserTeams, &[]),
Usage, Billing settings and prepaid AI credit; fixes from the UX audit157 // A workspace's billing: usage, budget, AI credit and invoices.
158 route(
159 "GET",
160 "/workspaces/:workspace/usage",
161 Op::GetUsage,
162 &[("from", "from"), ("until", "until"), ("products", "products"), ("projects", "projects"), ("group_by", "group_by")],
163 ),
164 route("GET", "/workspaces/:workspace/budget", Op::GetBudget, &[]),
165 route("PUT", "/workspaces/:workspace/budget", Op::SetBudget, &[]),
166 route("GET", "/workspaces/:workspace/ai_credit", Op::GetAiCredit, &[]),
167 route("POST", "/workspaces/:workspace/ai_credit/checkout", Op::BuyAiCredit, &[]),
168 route("GET", "/workspaces/:workspace/invoices", Op::ListInvoices, &[]),
169 route("GET", "/workspaces/:workspace/billing_details", Op::GetBillingDetails, &[]),
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens170 // The AI Gateway's log of a workspace's requests.
171 route("GET", "/workspaces/:workspace/gateway/requests", Op::ListGatewayRequests, &[("limit", "limit"), ("before", "before")]),
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar172 // Code owners: the CODEOWNERS file, checked.
173 route("GET", "/repos/:owner/:name/codeowners/errors", Op::GetCodeownersErrors, &[("ref", "ref")]),
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily174 // Security alerts: secrets and vulnerable dependencies.
175 route(
176 "GET",
177 "/repos/:owner/:name/security/alerts",
178 Op::ListSecurityAlerts,
179 &[("state", "state"), ("kind", "kind")],
180 ),
181 route("POST", "/repos/:owner/:name/security/alerts/:id/dismiss", Op::DismissSecurityAlert, &[]),
182 route("POST", "/repos/:owner/:name/security/alerts/:id/reopen", Op::ReopenSecurityAlert, &[]),
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar183 // The security suite: secret scanning, code scanning, vulnerability
184 // alerts and the supply chain, at the common addresses.
185 route("GET", "/repos/:owner/:name/secret-scanning/alerts", Op::Security(SecurityOp::ListSecretAlerts), &[("state", "state"), ("secret_type", "secret_type"), ("validity", "validity"), ("bypassed", "bypassed")]),
186 route("GET", "/workspaces/:workspace/secret-scanning/alerts", Op::Security(SecurityOp::ListSecretAlerts), &[("state", "state"), ("secret_type", "secret_type"), ("validity", "validity"), ("bypassed", "bypassed")]),
187 route("GET", "/repos/:owner/:name/secret-scanning/alerts/:id", Op::Security(SecurityOp::GetSecretAlert), &[]),
188 route("PATCH", "/repos/:owner/:name/secret-scanning/alerts/:id", Op::Security(SecurityOp::UpdateSecretAlert), &[]),
189 route("GET", "/repos/:owner/:name/secret-scanning/alerts/:id/locations", Op::Security(SecurityOp::ListSecretLocations), &[]),
190 route("POST", "/repos/:owner/:name/secret-scanning/alerts/:id/bypass", Op::Security(SecurityOp::BypassPushProtection), &[]),
191 route("POST", "/repos/:owner/:name/secret-scanning/alerts/:id/validity", Op::Security(SecurityOp::CheckSecretValidity), &[]),
192 route("GET", "/workspaces/:workspace/secret-scanning/bypass-requests", Op::Security(SecurityOp::ListBypassRequests), &[("state", "state"), ("repo", "repo")]),
193 route("PATCH", "/workspaces/:workspace/secret-scanning/bypass-requests/:id", Op::Security(SecurityOp::ReviewBypassRequest), &[]),
194 route("POST", "/repos/:owner/:name/secret-scanning/custom-patterns/dry-run", Op::Security(SecurityOp::DryRunCustomPattern), &[]),
195 route("POST", "/workspaces/:workspace/secret-scanning/custom-patterns/dry-run", Op::Security(SecurityOp::DryRunCustomPattern), &[]),
196 route("GET", "/repos/:owner/:name/secret-scanning/custom-patterns", Op::Security(SecurityOp::ListCustomPatterns), &[]),
197 route("GET", "/workspaces/:workspace/secret-scanning/custom-patterns", Op::Security(SecurityOp::ListCustomPatterns), &[]),
198 route("POST", "/repos/:owner/:name/secret-scanning/custom-patterns", Op::Security(SecurityOp::CreateCustomPattern), &[]),
199 route("POST", "/workspaces/:workspace/secret-scanning/custom-patterns", Op::Security(SecurityOp::CreateCustomPattern), &[]),
200 route("PATCH", "/repos/:owner/:name/secret-scanning/custom-patterns/:id", Op::Security(SecurityOp::UpdateCustomPattern), &[]),
201 route("PATCH", "/workspaces/:workspace/secret-scanning/custom-patterns/:id", Op::Security(SecurityOp::UpdateCustomPattern), &[]),
202 route("DELETE", "/repos/:owner/:name/secret-scanning/custom-patterns/:id", Op::Security(SecurityOp::DeleteCustomPattern), &[]),
203 route("DELETE", "/workspaces/:workspace/secret-scanning/custom-patterns/:id", Op::Security(SecurityOp::DeleteCustomPattern), &[]),
204 route("GET", "/repos/:owner/:name/code-scanning/alerts", Op::Security(SecurityOp::ListCodeAlerts), &[("state", "state"), ("severity", "severity"), ("tool", "tool"), ("rule_id", "rule_id")]),
205 route("GET", "/workspaces/:workspace/code-scanning/alerts", Op::Security(SecurityOp::ListCodeAlerts), &[("state", "state"), ("severity", "severity"), ("tool", "tool"), ("rule_id", "rule_id")]),
206 route("GET", "/repos/:owner/:name/code-scanning/alerts/:number", Op::Security(SecurityOp::GetCodeAlert), &[]),
207 route("PATCH", "/repos/:owner/:name/code-scanning/alerts/:number", Op::Security(SecurityOp::UpdateCodeAlert), &[]),
208 route("GET", "/repos/:owner/:name/code-scanning/analyses", Op::Security(SecurityOp::ListAnalyses), &[]),
209 route("POST", "/repos/:owner/:name/code-scanning/sarifs", Op::Security(SecurityOp::UploadSarif), &[]),
210 route("GET", "/repos/:owner/:name/code-scanning/sarifs/:id", Op::Security(SecurityOp::GetSarifUpload), &[]),
211 route("GET", "/repos/:owner/:name/vulnerability-alerts", Op::Security(SecurityOp::ListVulnerabilityAlerts), &[("state", "state"), ("severity", "severity"), ("ecosystem", "ecosystem"), ("package", "package")]),
212 route("GET", "/workspaces/:workspace/vulnerability-alerts", Op::Security(SecurityOp::ListVulnerabilityAlerts), &[("state", "state"), ("severity", "severity"), ("ecosystem", "ecosystem"), ("package", "package")]),
213 route("GET", "/repos/:owner/:name/vulnerability-alerts/:id", Op::Security(SecurityOp::GetVulnerabilityAlert), &[]),
214 route("PATCH", "/repos/:owner/:name/vulnerability-alerts/:id", Op::Security(SecurityOp::UpdateVulnerabilityAlert), &[]),
215 route("POST", "/repos/:owner/:name/security/alerts/:id/fix", Op::Security(SecurityOp::FixAlert), &[]),
216 route("GET", "/repos/:owner/:name/dependency-graph", Op::Security(SecurityOp::GetDependencyGraph), &[]),
217 route("GET", "/repos/:owner/:name/dependency-graph/sbom", Op::Security(SecurityOp::GetSbom), &[]),
218 route("GET", "/repos/:owner/:name/dependency-graph/compare/:basehead", Op::Security(SecurityOp::CompareDependencies), &[]),
219 route("GET", "/repos/:owner/:name/security/settings", Op::Security(SecurityOp::GetSettings), &[]),
220 route("PATCH", "/repos/:owner/:name/security/settings", Op::Security(SecurityOp::UpdateSettings), &[]),
221 route("GET", "/workspaces/:workspace/security/settings", Op::Security(SecurityOp::GetWorkspaceSettings), &[]),
222 route("PATCH", "/workspaces/:workspace/security/settings", Op::Security(SecurityOp::UpdateWorkspaceSettings), &[]),
223 route("GET", "/workspaces/:workspace/security/overview", Op::Security(SecurityOp::GetOverview), &[("days", "days")]),
Agents as a team: lifecycle, merge queue, billing and a new shell224 route("GET", "/repos", Op::ListRepos, &[("q", "query")]),
Search across all of g1t, Explore, and a command palette225 route(
226 "GET",
227 "/search",
228 Op::Search,
229 &[("q", "query"), ("type", "type"), ("page", "page"), ("per_page", "per_page")],
230 ),
Agents as a team: lifecycle, merge queue, billing and a new shell231 route("POST", "/repos", Op::CreateRepo, &[]),
232 route("GET", "/repos/:owner/:name", Op::GetRepo, &[]),
233 route("PATCH", "/repos/:owner/:name", Op::UpdateRepo, &[]),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look234 route("POST", "/repos/:owner/:name/transfer", Op::TransferRepo, &[]),
235 route("DELETE", "/repos/:owner/:name", Op::DeleteRepo, &[]),
236 route(
237 "GET",
238 "/workspaces/:workspace/repos/deleted",
239 Op::ListDeletedRepos,
240 &[],
241 ),
242 route("POST", "/repos/:owner/:name/restore", Op::RestoreRepo, &[]),
243 route("POST", "/repos/:owner/:name/purge", Op::PurgeRepo, &[]),
244 route("POST", "/repos/:owner/:name/rename", Op::RenameRepo, &[]),
245 route("POST", "/repos/:owner/:name/archive", Op::ArchiveRepo, &[]),
246 route("POST", "/repos/:owner/:name/unarchive", Op::UnarchiveRepo, &[]),
247 route(
248 "POST",
249 "/repos/:owner/:name/visibility",
250 Op::SetRepoVisibility,
251 &[],
252 ),
253 route(
254 "POST",
255 "/repos/:owner/:name/branches/:branch/rename",
256 Op::RenameBranch,
257 &[],
258 ),
Agents as a team: lifecycle, merge queue, billing and a new shell259 route(
260 "GET",
261 "/repos/:owner/:name/settings",
262 Op::GetRepoSettings,
263 &[],
264 ),
265 route(
266 "PATCH",
267 "/repos/:owner/:name/settings",
268 Op::UpdateRepoSettings,
269 &[],
270 ),
Fast pages, required checks on the branch, self-hosted runners, honest incidents271 route("GET", "/repos/:owner/:name/check-names", Op::ListCheckNames, &[]),
Merge checks: statuses and check runs on every commit272 // Checks: GitHub's addresses for statuses, check runs and check suites.
273 route("POST", "/repos/:owner/:name/statuses/:sha", Op::Checks(ChecksOp::CreateCommitStatus), &[]),
274 route("GET", "/repos/:owner/:name/commits/:ref/statuses", Op::Checks(ChecksOp::ListCommitStatuses), &[]),
275 route("GET", "/repos/:owner/:name/commits/:ref/status", Op::Checks(ChecksOp::GetCombinedStatus), &[]),
276 route(
277 "GET",
278 "/repos/:owner/:name/commits/:ref/check-runs",
279 Op::Checks(ChecksOp::ListCheckRunsForRef),
280 &[("check_name", "check_name"), ("status", "status"), ("app", "app"), ("filter", "filter")],
281 ),
282 route(
283 "GET",
284 "/repos/:owner/:name/commits/:ref/check-suites",
285 Op::Checks(ChecksOp::ListCheckSuitesForRef),
286 &[("app", "app"), ("check_name", "check_name")],
287 ),
288 route("POST", "/repos/:owner/:name/check-runs", Op::Checks(ChecksOp::CreateCheckRun), &[]),
289 route("GET", "/repos/:owner/:name/check-runs/:id", Op::Checks(ChecksOp::GetCheckRun), &[]),
290 route("PATCH", "/repos/:owner/:name/check-runs/:id", Op::Checks(ChecksOp::UpdateCheckRun), &[]),
291 route("GET", "/repos/:owner/:name/check-runs/:id/annotations", Op::Checks(ChecksOp::ListCheckRunAnnotations), &[]),
292 route("POST", "/repos/:owner/:name/check-runs/:id/rerequest", Op::Checks(ChecksOp::RerequestCheckRun), &[]),
293 route("GET", "/repos/:owner/:name/check-suites/:id", Op::Checks(ChecksOp::GetCheckSuite), &[]),
294 route("POST", "/repos/:owner/:name/check-suites/:id/rerequest", Op::Checks(ChecksOp::RerequestCheckSuite), &[]),
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge295 // Rulesets: a repository's, a workspace's, the rules of one branch,
296 // and how they judged pushes and merges.
297 route("GET", "/repos/:owner/:name/rulesets", Op::Rules(RulesOp::ListRepoRulesets), &[("include_parents", "include_parents")]),
298 route("POST", "/repos/:owner/:name/rulesets", Op::Rules(RulesOp::CreateRepoRuleset), &[]),
299 route("GET", "/repos/:owner/:name/rulesets/:id", Op::Rules(RulesOp::GetRepoRuleset), &[]),
300 route("PUT", "/repos/:owner/:name/rulesets/:id", Op::Rules(RulesOp::UpdateRepoRuleset), &[]),
301 route("DELETE", "/repos/:owner/:name/rulesets/:id", Op::Rules(RulesOp::DeleteRepoRuleset), &[]),
302 route("GET", "/repos/:owner/:name/rules/branches/:branch", Op::Rules(RulesOp::GetBranchRules), &[("target", "target")]),
303 route(
304 "GET",
305 "/repos/:owner/:name/rules/evaluations",
306 Op::Rules(RulesOp::ListRuleEvaluations),
307 &[("ruleset_id", "ruleset_id"), ("verdict", "verdict"), ("problems_only", "problems_only"), ("before", "before"), ("limit", "limit")],
308 ),
309 route("GET", "/workspaces/:workspace/rulesets", Op::Rules(RulesOp::ListWorkspaceRulesets), &[]),
310 route("POST", "/workspaces/:workspace/rulesets", Op::Rules(RulesOp::CreateWorkspaceRuleset), &[]),
311 route("GET", "/workspaces/:workspace/rulesets/:id", Op::Rules(RulesOp::GetWorkspaceRuleset), &[]),
312 route("PUT", "/workspaces/:workspace/rulesets/:id", Op::Rules(RulesOp::UpdateWorkspaceRuleset), &[]),
313 route("DELETE", "/workspaces/:workspace/rulesets/:id", Op::Rules(RulesOp::DeleteWorkspaceRuleset), &[]),
314 route(
315 "GET",
316 "/workspaces/:workspace/rules/evaluations",
317 Op::Rules(RulesOp::ListWorkspaceRuleEvaluations),
318 &[("ruleset_id", "ruleset_id"), ("verdict", "verdict"), ("problems_only", "problems_only"), ("before", "before"), ("limit", "limit")],
319 ),
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97320 // Deployments wherever they run, their statuses, and environments.
321 route(
322 "GET",
323 "/repos/:owner/:name/deployments",
324 Op::Deployments(DeploymentsOp::ListDeployments),
325 &[("environment", "environment"), ("ref", "ref"), ("sha", "sha"), ("task", "task"), ("state", "state"), ("source", "source"), ("creator", "creator"), ("page", "page"), ("per_page", "per_page")],
326 ),
327 route("POST", "/repos/:owner/:name/deployments", Op::Deployments(DeploymentsOp::CreateDeployment), &[]),
328 route("GET", "/repos/:owner/:name/deployments/:id", Op::Deployments(DeploymentsOp::GetDeployment), &[]),
329 route("GET", "/repos/:owner/:name/deployments/:id/statuses", Op::Deployments(DeploymentsOp::ListDeploymentStatuses), &[]),
330 route("POST", "/repos/:owner/:name/deployments/:id/statuses", Op::Deployments(DeploymentsOp::CreateDeploymentStatus), &[]),
331 route("GET", "/repos/:owner/:name/environments", Op::Deployments(DeploymentsOp::ListEnvironments), &[]),
332 route("GET", "/repos/:owner/:name/environments/:environment", Op::Deployments(DeploymentsOp::GetEnvironment), &[]),
Agents as a team: lifecycle, merge queue, billing and a new shell333 route("GET", "/repos/:owner/:name/queue", Op::GetMergeQueue, &[]),
API and MCP server in Rust; a public index at the API root334 route(
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request335 "POST",
336 "/repos/:owner/:name/pulls/:number/messages",
337 Op::MessageAgent,
338 &[],
339 ),
340 route(
341 "POST",
342 "/repos/:owner/:name/pulls/:number/messages/take",
343 Op::TakeMessages,
344 &[],
345 ),
346 route(
Docs worth reading, and kept that way347 "POST",
348 "/repos/:owner/:name/messages/:id/answer",
349 Op::AnswerMessage,
350 &[],
351 ),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains352 route("POST", "/repos/:owner/:name/memory", Op::Remember, &[]),
353 route(
354 "GET",
355 "/repos/:owner/:name/memory",
356 Op::Recall,
357 &[("q", "query"), ("limit", "limit")],
358 ),
Docs worth reading, and kept that way359 route(
API and MCP server in Rust; a public index at the API root360 "GET",
Agents as a team: lifecycle, merge queue, billing and a new shell361 "/repos/:owner/:name/events",
API and MCP server in Rust; a public index at the API root362 Op::ListEvents,
363 &[("before", "before")],
364 ),
Agents as a team: lifecycle, merge queue, billing and a new shell365 route("GET", "/repos/:owner/:name/labels", Op::ListLabels, &[]),
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar366 route("POST", "/repos/:owner/:name/labels", Op::CreateLabel, &[]),
367 route("POST", "/repos/:owner/:name/labels/defaults", Op::AddDefaultLabels, &[]),
368 route("PATCH", "/repos/:owner/:name/labels/:label", Op::UpdateLabel, &[]),
369 route("DELETE", "/repos/:owner/:name/labels/:label", Op::DeleteLabel, &[]),
370 route("GET", "/repos/:owner/:name/issues/:number/labels", Op::ListIssueLabels, &[]),
371 route("POST", "/repos/:owner/:name/issues/:number/labels", Op::AddIssueLabels, &[]),
372 route("PUT", "/repos/:owner/:name/issues/:number/labels", Op::SetIssueLabels, &[]),
373 route("DELETE", "/repos/:owner/:name/issues/:number/labels", Op::RemoveIssueLabels, &[]),
374 route("DELETE", "/repos/:owner/:name/issues/:number/labels/:label", Op::RemoveIssueLabels, &[]),
375 route("GET", "/repos/:owner/:name/milestones", Op::ListMilestones, &[("state", "state")]),
376 route("POST", "/repos/:owner/:name/milestones", Op::CreateMilestone, &[]),
377 route("GET", "/repos/:owner/:name/milestones/:milestone", Op::GetMilestone, &[]),
378 route("PATCH", "/repos/:owner/:name/milestones/:milestone", Op::UpdateMilestone, &[]),
379 route("DELETE", "/repos/:owner/:name/milestones/:milestone", Op::DeleteMilestone, &[]),
API and MCP server in Rust; a public index at the API root380 route(
381 "GET",
Agents as a team: lifecycle, merge queue, billing and a new shell382 "/repos/:owner/:name/issues",
API and MCP server in Rust; a public index at the API root383 Op::ListIssues,
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar384 &[("state", "state"), ("label", "label"), ("milestone", "milestone")],
API and MCP server in Rust; a public index at the API root385 ),
Agents as a team: lifecycle, merge queue, billing and a new shell386 route("POST", "/repos/:owner/:name/issues", Op::CreateIssue, &[]),
API and MCP server in Rust; a public index at the API root387 route(
388 "GET",
Agents as a team: lifecycle, merge queue, billing and a new shell389 "/repos/:owner/:name/issues/:number",
API and MCP server in Rust; a public index at the API root390 Op::GetIssue,
391 &[],
392 ),
393 route(
394 "PATCH",
Agents as a team: lifecycle, merge queue, billing and a new shell395 "/repos/:owner/:name/issues/:number",
API and MCP server in Rust; a public index at the API root396 Op::UpdateIssue,
397 &[],
398 ),
399 route(
400 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell401 "/repos/:owner/:name/issues/:number/close",
API and MCP server in Rust; a public index at the API root402 Op::CloseIssue,
403 &[],
404 ),
405 route(
406 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell407 "/repos/:owner/:name/issues/:number/reopen",
API and MCP server in Rust; a public index at the API root408 Op::ReopenIssue,
409 &[],
410 ),
411 route(
412 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell413 "/repos/:owner/:name/issues/:number/assign",
414 Op::AssignIssue,
415 &[],
416 ),
Integrations: your own model provider, alerts that open issues, tickets agents read417 route(
418 "POST",
419 "/repos/:owner/:name/issues/import",
420 Op::ImportIssue,
421 &[],
422 ),
423 route(
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step424 "POST",
425 "/repos/:owner/:name/issues/delegate",
426 Op::Delegate,
427 &[],
428 ),
429 route(
Integrations: your own model provider, alerts that open issues, tickets agents read430 "GET",
431 "/repos/:owner/:name/context",
432 Op::GetContext,
433 &[("reference", "reference")],
434 ),
435 route(
436 "GET",
Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API437 "/workspaces/:workspace/context/search",
438 Op::SearchContext,
439 &[("q", "query"), ("project", "project"), ("kinds", "kinds"), ("limit", "limit")],
440 ),
441 route(
442 "GET",
443 "/workspaces/:workspace/context/:kind/:id",
444 Op::GetEntity,
445 &[],
446 ),
447 route(
448 "GET",
Integrations: your own model provider, alerts that open issues, tickets agents read449 "/workspaces/:workspace/integrations",
450 Op::ListIntegrations,
451 &[],
452 ),
453 route(
454 "POST",
455 "/workspaces/:workspace/integrations",
456 Op::ConnectIntegration,
457 &[],
458 ),
459 route(
Models per workspace: several providers, routed by kind of work460 "GET",
Webhooks: every event, to your own addresses, signed and retried461 "/repos/:owner/:name/hooks",
462 Op::ListWebhooks,
463 &[],
464 ),
465 route(
466 "POST",
467 "/repos/:owner/:name/hooks",
468 Op::CreateWebhook,
469 &[],
470 ),
471 route(
472 "PATCH",
473 "/repos/:owner/:name/hooks/:id",
474 Op::UpdateWebhook,
475 &[],
476 ),
477 route(
478 "DELETE",
479 "/repos/:owner/:name/hooks/:id",
480 Op::DeleteWebhook,
481 &[],
482 ),
483 route(
484 "POST",
485 "/repos/:owner/:name/hooks/:id/pings",
486 Op::PingWebhook,
487 &[],
488 ),
489 route(
490 "GET",
491 "/repos/:owner/:name/hooks/:id/deliveries",
492 Op::ListWebhookDeliveries,
493 &[],
494 ),
495 route(
496 "POST",
497 "/repos/:owner/:name/hooks/:id/deliveries/:delivery/redeliver",
498 Op::RedeliverWebhook,
499 &[],
500 ),
501 route(
502 "GET",
503 "/workspaces/:workspace/hooks",
504 Op::ListWebhooks,
505 &[],
506 ),
507 route(
508 "POST",
509 "/workspaces/:workspace/hooks",
510 Op::CreateWebhook,
511 &[],
512 ),
513 route(
514 "PATCH",
515 "/workspaces/:workspace/hooks/:id",
516 Op::UpdateWebhook,
517 &[],
518 ),
519 route(
520 "DELETE",
521 "/workspaces/:workspace/hooks/:id",
522 Op::DeleteWebhook,
523 &[],
524 ),
525 route(
526 "POST",
527 "/workspaces/:workspace/hooks/:id/pings",
528 Op::PingWebhook,
529 &[],
530 ),
531 route(
532 "GET",
533 "/workspaces/:workspace/hooks/:id/deliveries",
534 Op::ListWebhookDeliveries,
535 &[],
536 ),
537 route(
538 "POST",
539 "/workspaces/:workspace/hooks/:id/deliveries/:delivery/redeliver",
540 Op::RedeliverWebhook,
541 &[],
542 ),
543 route(
544 "GET",
Models per workspace: several providers, routed by kind of work545 "/workspaces/:workspace/model-routes",
546 Op::GetModelRoutes,
547 &[],
548 ),
549 route(
550 "PUT",
551 "/workspaces/:workspace/model-routes",
552 Op::SetModelRoutes,
553 &[],
554 ),
555 route(
AI Gateway: OpenAI's format, open models, and your own providers556 "PATCH",
557 "/workspaces/:workspace/integrations/:id",
558 Op::UpdateIntegration,
559 &[],
560 ),
561 route(
Integrations: your own model provider, alerts that open issues, tickets agents read562 "DELETE",
563 "/workspaces/:workspace/integrations/:id",
564 Op::DisconnectIntegration,
565 &[],
566 ),
567 route(
568 "POST",
569 "/workspaces/:workspace/integrations/:id/test",
570 Op::TestIntegration,
571 &[],
572 ),
Automations: rules in .g1t/automations that act when something happens573 route(
574 "GET",
GitHub Actions on g1t, part two: running workflows575 "/repos/:owner/:name/actions/workflows",
576 Op::ListWorkflows,
577 &[],
578 ),
579 route(
580 "GET",
581 "/repos/:owner/:name/actions/workflows/:workflow/runs",
582 Op::ListWorkflowRuns,
583 &[("branch", "branch"), ("event", "event"), ("per_page", "limit")],
584 ),
585 route(
586 "POST",
587 "/repos/:owner/:name/actions/workflows/:workflow/dispatches",
588 Op::DispatchWorkflow,
589 &[],
590 ),
591 route(
592 "PATCH",
593 "/repos/:owner/:name/actions/workflows/:workflow",
594 Op::UpdateWorkflow,
595 &[],
596 ),
597 route(
598 "PUT",
599 "/repos/:owner/:name/actions/workflows/:workflow/enable",
600 Op::UpdateWorkflow,
601 &[],
602 ),
603 route(
604 "PUT",
605 "/repos/:owner/:name/actions/workflows/:workflow/disable",
606 Op::UpdateWorkflow,
607 &[],
608 ),
609 route(
610 "GET",
611 "/repos/:owner/:name/actions/runs",
612 Op::ListWorkflowRuns,
613 &[("workflow", "workflow"), ("branch", "branch"), ("event", "event"), ("pull", "pull"), ("head_sha", "sha"), ("per_page", "limit")],
614 ),
615 route(
616 "GET",
617 "/repos/:owner/:name/actions/runs/:id",
618 Op::GetWorkflowRun,
619 &[],
620 ),
621 route(
622 "POST",
623 "/repos/:owner/:name/actions/runs/:id/cancel",
624 Op::CancelWorkflowRun,
625 &[],
626 ),
627 route(
628 "POST",
629 "/repos/:owner/:name/actions/runs/:id/rerun",
630 Op::RerunWorkflowRun,
631 &[],
632 ),
633 route(
634 "POST",
635 "/repos/:owner/:name/actions/runs/:id/rerun-failed-jobs",
636 Op::RerunWorkflowRun,
637 &[],
638 ),
639 route(
640 "GET",
641 "/repos/:owner/:name/actions/jobs/:job/logs",
642 Op::GetJobLogs,
643 &[("after", "after")],
644 ),
Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2645 // Artifacts, at GitHub's addresses. `…/zip` answers with a redirect to
646 // a signed link (lib.rs).
647 route("GET", "/repos/:owner/:name/actions/artifacts", Op::Artifacts(ArtifactsOp::ListArtifacts), &[("name", "name"), ("page", "page"), ("per_page", "per_page")]),
648 route("GET", "/repos/:owner/:name/actions/runs/:id/artifacts", Op::Artifacts(ArtifactsOp::ListRunArtifacts), &[("name", "name")]),
649 route("GET", "/repos/:owner/:name/actions/artifacts/:id", Op::Artifacts(ArtifactsOp::GetArtifact), &[]),
650 route("GET", "/repos/:owner/:name/actions/artifacts/:id/zip", Op::Artifacts(ArtifactsOp::DownloadArtifact), &[]),
651 route("DELETE", "/repos/:owner/:name/actions/artifacts/:id", Op::Artifacts(ArtifactsOp::DeleteArtifact), &[]),
652 route("GET", "/repos/:owner/:name/actions/permissions/artifact-and-log-retention", Op::Artifacts(ArtifactsOp::GetArtifactRetention), &[]),
653 route("PUT", "/repos/:owner/:name/actions/permissions/artifact-and-log-retention", Op::Artifacts(ArtifactsOp::SetArtifactRetention), &[]),
GitHub Actions on g1t, part two: running workflows654 route(
655 "GET",
656 "/repos/:owner/:name/actions/secrets",
657 Op::ListActionsSecrets,
658 &[],
659 ),
660 route(
661 "PUT",
662 "/repos/:owner/:name/actions/secrets/:setting",
663 Op::SetActionsSecret,
664 &[],
665 ),
666 route(
667 "DELETE",
668 "/repos/:owner/:name/actions/secrets/:setting",
669 Op::DeleteActionsSecret,
670 &[],
671 ),
672 route(
673 "GET",
674 "/repos/:owner/:name/actions/variables",
675 Op::ListActionsVariables,
676 &[],
677 ),
678 route(
679 "POST",
680 "/repos/:owner/:name/actions/variables",
681 Op::SetActionsVariable,
682 &[],
683 ),
684 route(
685 "PATCH",
686 "/repos/:owner/:name/actions/variables/:setting",
687 Op::SetActionsVariable,
688 &[],
689 ),
690 route(
691 "DELETE",
692 "/repos/:owner/:name/actions/variables/:setting",
693 Op::DeleteActionsVariable,
694 &[],
695 ),
696 route(
697 "GET",
698 "/workspaces/:workspace/actions/secrets",
699 Op::ListActionsSecrets,
700 &[],
701 ),
702 route(
703 "PUT",
704 "/workspaces/:workspace/actions/secrets/:setting",
705 Op::SetActionsSecret,
706 &[],
707 ),
708 route(
709 "DELETE",
710 "/workspaces/:workspace/actions/secrets/:setting",
711 Op::DeleteActionsSecret,
712 &[],
713 ),
714 route(
715 "GET",
716 "/workspaces/:workspace/actions/variables",
717 Op::ListActionsVariables,
718 &[],
719 ),
720 route(
721 "POST",
722 "/workspaces/:workspace/actions/variables",
723 Op::SetActionsVariable,
724 &[],
725 ),
726 route(
727 "PATCH",
728 "/workspaces/:workspace/actions/variables/:setting",
729 Op::SetActionsVariable,
730 &[],
731 ),
732 route(
733 "DELETE",
734 "/workspaces/:workspace/actions/variables/:setting",
735 Op::DeleteActionsVariable,
736 &[],
737 ),
Fast pages, required checks on the branch, self-hosted runners, honest incidents738 // Self-hosted runners: a repository's own, or a workspace's.
739 route("GET", "/repos/:owner/:name/actions/runners", Op::ListRunners, &[]),
740 route("POST", "/repos/:owner/:name/actions/runners/registration-token", Op::CreateRunnerRegistrationToken, &[]),
741 route("DELETE", "/repos/:owner/:name/actions/runners/:id", Op::RemoveRunner, &[]),
742 route("GET", "/repos/:owner/:name/actions/runner-settings", Op::GetRunnerSettings, &[]),
743 route("PATCH", "/repos/:owner/:name/actions/runner-settings", Op::UpdateRunnerSettings, &[]),
744 route("GET", "/workspaces/:workspace/actions/runners", Op::ListRunners, &[]),
745 route("POST", "/workspaces/:workspace/actions/runners/registration-token", Op::CreateRunnerRegistrationToken, &[]),
746 route("DELETE", "/workspaces/:workspace/actions/runners/:id", Op::RemoveRunner, &[]),
747 route("GET", "/workspaces/:workspace/actions/runner-settings", Op::GetRunnerSettings, &[]),
748 route("PATCH", "/workspaces/:workspace/actions/runner-settings", Op::UpdateRunnerSettings, &[]),
749 route("GET", "/workspaces/:workspace/actions/runner-groups", Op::ListRunnerGroups, &[]),
750 route("POST", "/workspaces/:workspace/actions/runner-groups", Op::CreateRunnerGroup, &[]),
751 route("PATCH", "/workspaces/:workspace/actions/runner-groups/:id", Op::UpdateRunnerGroup, &[]),
752 route("DELETE", "/workspaces/:workspace/actions/runner-groups/:id", Op::DeleteRunnerGroup, &[]),
Agents as a team: lifecycle, merge queue, billing and a new shell753 route("POST", "/repos/:owner/:name/plans", Op::PlanWork, &[]),
754 route("GET", "/repos/:owner/:name/plans/:plan", Op::GetPlan, &[]),
755 route(
756 "POST",
757 "/repos/:owner/:name/plans/:plan/apply",
758 Op::ApplyPlan,
759 &[],
760 ),
761 route(
762 "POST",
763 "/repos/:owner/:name/issues/:number/comments",
API and MCP server in Rust; a public index at the API root764 Op::AddComment,
765 &[],
766 ),
767 route(
768 "GET",
Agents as a team: lifecycle, merge queue, billing and a new shell769 "/repos/:owner/:name/pulls",
API and MCP server in Rust; a public index at the API root770 Op::ListPullRequests,
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar771 &[("state", "state"), ("label", "label"), ("milestone", "milestone"), ("base", "base")],
API and MCP server in Rust; a public index at the API root772 ),
773 route(
774 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell775 "/repos/:owner/:name/pulls",
API and MCP server in Rust; a public index at the API root776 Op::CreatePullRequest,
777 &[],
778 ),
779 route(
780 "GET",
Agents as a team: lifecycle, merge queue, billing and a new shell781 "/repos/:owner/:name/pulls/:number",
API and MCP server in Rust; a public index at the API root782 Op::GetPullRequest,
783 &[],
784 ),
785 route(
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar786 "PATCH",
787 "/repos/:owner/:name/pulls/:number",
788 Op::UpdatePullRequest,
789 &[],
790 ),
791 route(
API and MCP server in Rust; a public index at the API root792 "GET",
Agents as a team: lifecycle, merge queue, billing and a new shell793 "/repos/:owner/:name/pulls/:number/changes",
API and MCP server in Rust; a public index at the API root794 Op::GetPullRequestChanges,
795 &[],
796 ),
797 route(
Acceptance checks in sandboxes, line comments and review verdicts798 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell799 "/repos/:owner/:name/pulls/:number/reviews",
Acceptance checks in sandboxes, line comments and review verdicts800 Op::ReviewPullRequest,
801 &[],
802 ),
803 route(
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar804 "POST",
805 "/repos/:owner/:name/pulls/:number/requested_reviewers",
806 Op::RequestReviewers,
807 &[],
808 ),
809 route(
810 "DELETE",
811 "/repos/:owner/:name/pulls/:number/requested_reviewers",
812 Op::RemoveRequestedReviewers,
813 &[],
814 ),
815 route(
API and MCP server in Rust; a public index at the API root816 "GET",
Agents as a team: lifecycle, merge queue, billing and a new shell817 "/repos/:owner/:name/pulls/:number/session",
API and MCP server in Rust; a public index at the API root818 Op::ReadSession,
819 &[("after", "after")],
820 ),
821 route(
822 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell823 "/repos/:owner/:name/pulls/:number/session",
API and MCP server in Rust; a public index at the API root824 Op::RecordSession,
825 &[],
826 ),
827 route(
828 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell829 "/repos/:owner/:name/pulls/:number/ready",
API and MCP server in Rust; a public index at the API root830 Op::MarkPullRequestReady,
831 &[],
832 ),
833 route(
834 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell835 "/repos/:owner/:name/pulls/:number/close",
API and MCP server in Rust; a public index at the API root836 Op::ClosePullRequest,
837 &[],
838 ),
839 route(
840 "POST",
Agents as a team: lifecycle, merge queue, billing and a new shell841 "/repos/:owner/:name/pulls/:number/merge",
API and MCP server in Rust; a public index at the API root842 Op::MergePullRequest,
843 &[],
844 ),
845];
846
847impl Route {
848 /// The names of the route's path parameters, in order.
849 pub fn params(&self) -> impl Iterator<Item = &'static str> {
850 self.path
851 .split('/')
852 .filter_map(|segment| segment.strip_prefix(':'))
853 }
854
855 /// The values of the path parameters, if `path` is this route's.
856 fn matches<'a>(&self, path: &'a str) -> Option<Vec<(&'static str, &'a str)>> {
857 let mut values = Vec::new();
858 let mut actual = path.trim_end_matches('/').split('/');
859 for expected in self.path.split('/') {
860 let segment = actual.next()?;
861 match expected.strip_prefix(':') {
862 Some(name) if !segment.is_empty() => values.push((name, segment)),
863 Some(_) => return None,
864 None if expected == segment => {}
865 None => return None,
866 }
867 }
868 actual.next().is_none().then_some(values)
869 }
870}
871
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look872/// A path segment with its `%XX` escapes decoded; as given when that is not
873/// UTF-8.
874fn percent_decoded(segment: &str) -> String {
875 let bytes = segment.as_bytes();
876 let mut out = Vec::with_capacity(bytes.len());
877 let mut i = 0;
878 while i < bytes.len() {
879 let escaped = (bytes[i] == b'%')
880 .then(|| segment.get(i + 1..i + 3))
881 .flatten()
882 .filter(|hex| hex.bytes().all(|byte| byte.is_ascii_hexdigit()))
883 .and_then(|hex| u8::from_str_radix(hex, 16).ok());
884 match escaped {
885 Some(byte) => {
886 out.push(byte);
887 i += 3;
888 }
889 None => {
890 out.push(bytes[i]);
891 i += 1;
892 }
893 }
894 }
895 String::from_utf8(out).unwrap_or_else(|_| segment.to_owned())
896}
897
API and MCP server in Rust; a public index at the API root898/// The route for a request, and the operation input it describes.
899///
900/// The input is the JSON body, overlaid with the query parameters the route
901/// reads and then with what the path names: `owner` and `name` become
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar902/// `repo`, as does a team's `repo` with its `workspace`, and `number`
903/// becomes an integer.
API and MCP server in Rust; a public index at the API root904pub fn resolve(
905 method: &str,
906 path: &str,
907 query: &[(String, String)],
908 body: Value,
909) -> Option<(&'static Route, Value)> {
910 let (route, params) = ROUTES
911 .iter()
912 .filter(|route| route.method == method)
913 .find_map(|route| Some((route, route.matches(path)?)))?;
914
915 let mut input = match body {
916 Value::Object(fields) => fields,
917 _ => Map::new(),
918 };
919 for (name, key) in route.query {
920 if let Some((_, value)) = query.iter().find(|(query_name, _)| query_name == name) {
921 input.insert((*key).to_owned(), Value::String(value.clone()));
922 }
923 }
924 let param = |wanted: &str| {
925 params
926 .iter()
927 .find(|(name, _)| *name == wanted)
928 .map(|(_, value)| *value)
929 };
930 if let (Some(owner), Some(name)) = (param("owner"), param("name")) {
931 input.insert("repo".to_owned(), Value::String(format!("{owner}/{name}")));
932 }
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97933 // Every other name the path gives, under that name; the ones below that
934 // need more (a repository, a number, an encoded name) are set after.
935 for (key, value) in &params {
936 if !matches!(*key, "owner" | "name") {
937 input.insert((*key).to_owned(), Value::String(percent_decoded(value)));
Docs worth reading, and kept that way938 }
Agents as a team: lifecycle, merge queue, billing and a new shell939 }
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar940 // A repository of a team's workspace, named by itself.
941 if let (Some(workspace), Some(name)) = (param("workspace"), param("repo")) {
942 input.insert("repo".to_owned(), Value::String(format!("{workspace}/{name}")));
943 }
944 // A branch name may hold slashes, sent URL-encoded as one segment, and
945 // a label's name spaces.
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look946 if let Some(branch) = param("branch") {
947 input.insert("branch".to_owned(), Value::String(percent_decoded(branch)));
948 }
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97949 // An environment's name may hold slashes and spaces, URL-encoded.
950 if let Some(environment) = param("environment") {
951 input.insert("environment".to_owned(), Value::String(percent_decoded(environment)));
952 }
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar953 if let Some(label) = param("label") {
954 input.insert("label".to_owned(), Value::String(percent_decoded(label)));
955 }
956 if let Some(milestone) = param("milestone") {
957 // Not a number: zero, which no milestone has.
958 input.insert("milestone".to_owned(), milestone.parse::<u32>().unwrap_or(0).into());
959 }
GitHub Actions on g1t, part two: running workflows960 // GitHub says some things with the path alone.
961 if route.path.ends_with("/enable") || route.path.ends_with("/disable") {
962 input.insert("enabled".to_owned(), Value::Bool(route.path.ends_with("/enable")));
963 }
964 if route.path.ends_with("/rerun-failed-jobs") {
965 input.insert("failed_only".to_owned(), Value::Bool(true));
966 }
API: notifications over REST and MCP, with notifications scopes967 // Unsaving and waking a thread are a DELETE of what PUT made.
968 if route.method == "DELETE" && route.path.ends_with("/saved") {
969 input.insert("saved".to_owned(), Value::Bool(false));
970 }
971 if route.method == "DELETE" && route.path.ends_with("/snooze") {
972 input.remove("until");
973 }
API and MCP server in Rust; a public index at the API root974 if let Some(number) = param("number") {
975 // Not a number: zero, which no issue or pull request has.
976 input.insert(
977 "number".to_owned(),
978 number.parse::<u32>().unwrap_or(0).into(),
979 );
980 }
981 Some((route, Value::Object(input)))
982}
983
984#[cfg(test)]
985mod tests {
986 use serde_json::json;
987
988 use super::*;
989
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97990 /// Every name a route's path gives reaches the operation: a name left
991 /// off the lists above is dropped, and the operation answers that it
992 /// was not given (the project routes were, until this test).
993 #[test]
994 fn every_path_parameter_reaches_the_input() {
995 for route in ROUTES.iter() {
996 let names: Vec<&str> = route.path.split('/').filter_map(|part| part.strip_prefix(':')).collect();
997 if names.is_empty() {
998 continue;
999 }
1000 let path: String = route
1001 .path
1002 .split('/')
1003 .map(|part| match part.strip_prefix(':') {
1004 Some("number" | "milestone") => "7".to_owned(),
1005 Some(name) => format!("{name}-x"),
1006 None => part.to_owned(),
1007 })
1008 .collect::<Vec<_>>()
1009 .join("/");
1010 let (found, input) = resolve(route.method, &path, &[], json!({})).unwrap();
1011 // A path two routes could take is checked under the first.
1012 if found.path != route.path {
1013 continue;
1014 }
1015 for name in names {
1016 let key = match name {
1017 "owner" | "name" => "repo",
1018 "repo" if names_has_workspace(route.path) => "repo",
1019 other => other,
1020 };
1021 assert!(
1022 input.get(key).is_some_and(|value| !value.is_null()),
1023 "{} {}: :{name} does not reach the input",
1024 route.method,
1025 route.path
1026 );
1027 }
1028 }
1029 }
1030
1031 fn names_has_workspace(path: &str) -> bool {
1032 path.split('/').any(|part| part == ":workspace")
1033 }
1034
API and MCP server in Rust; a public index at the API root1035 #[test]
1036 fn a_path_resolves_to_its_operation_and_input() {
1037 let (route, input) = resolve(
1038 "POST",
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look1039 "/repos/flagon-io/hello/pulls/14/merge",
API and MCP server in Rust; a public index at the API root1040 &[],
1041 json!({ "keep_issue_open": true, "number": 99, "repo": "someone/else" }),
1042 )
1043 .unwrap();
1044 assert_eq!(route.op, Op::MergePullRequest);
1045 // What the path names wins over the body.
1046 assert_eq!(
1047 input,
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look1048 json!({ "keep_issue_open": true, "number": 14, "repo": "flagon-io/hello" })
API and MCP server in Rust; a public index at the API root1049 );
1050 }
1051
1052 #[test]
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look1053 fn a_branch_with_slashes_is_one_encoded_segment() {
1054 let (route, input) = resolve(
1055 "POST",
1056 "/repos/flagon-io/hello/branches/feature%2Flogin/rename",
1057 &[],
1058 json!({ "new_name": "feature/sign-in" }),
1059 )
1060 .unwrap();
1061 assert_eq!(route.op, Op::RenameBranch);
1062 assert_eq!(
1063 input,
1064 json!({ "new_name": "feature/sign-in", "branch": "feature/login", "repo": "flagon-io/hello" })
1065 );
1066 assert_eq!(percent_decoded("100%"), "100%");
1067 assert_eq!(percent_decoded("a%2bb%zz"), "a+b%zz");
1068 }
1069
1070 #[test]
1071 fn a_collaborator_is_named_by_username() {
1072 let (route, input) = resolve(
1073 "PATCH",
1074 "/repos/flagon-io/hello/collaborators/ada",
1075 &[],
1076 json!({ "role": "maintain" }),
1077 )
1078 .unwrap();
1079 assert_eq!(route.op, Op::UpdateCollaborator);
1080 assert_eq!(input, json!({ "role": "maintain", "username": "ada", "repo": "flagon-io/hello" }));
1081 let (route, input) = resolve("DELETE", "/user/repository_invitations/rin_1", &[], Value::Null).unwrap();
1082 assert_eq!(route.op, Op::DeclineRepoInvitation);
1083 assert_eq!(input, json!({ "id": "rin_1" }));
1084 }
1085
1086 #[test]
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar1087 fn teams_are_addressed_by_workspace_and_slug() {
1088 let query = [("q".to_owned(), "back".to_owned())];
1089 let (route, input) = resolve("GET", "/workspaces/acme/teams", &query, Value::Null).unwrap();
1090 assert_eq!(route.op, Op::ListTeams);
1091 assert_eq!(input, json!({ "query": "back", "workspace": "acme" }));
1092 let (route, input) = resolve("PATCH", "/workspaces/acme/teams/backend", &[], json!({ "name": "Back end" })).unwrap();
1093 assert_eq!(route.op, Op::UpdateTeam);
1094 assert_eq!(input, json!({ "name": "Back end", "workspace": "acme", "team": "backend" }));
1095 let (route, input) =
1096 resolve("PUT", "/workspaces/acme/teams/backend/members/ana", &[], json!({ "role": "maintainer" })).unwrap();
1097 assert_eq!(route.op, Op::SetTeamMember);
1098 assert_eq!(input, json!({ "role": "maintainer", "workspace": "acme", "team": "backend", "username": "ana" }));
1099 let query = [("include_child_teams".to_owned(), "true".to_owned())];
1100 let (route, input) = resolve("GET", "/workspaces/acme/teams/backend/members", &query, Value::Null).unwrap();
1101 assert_eq!(route.op, Op::ListTeamMembers);
1102 assert_eq!(input, json!({ "include_child_teams": "true", "workspace": "acme", "team": "backend" }));
1103 // A repository is named by itself, in the team's workspace.
1104 let (route, input) =
1105 resolve("PUT", "/workspaces/acme/teams/backend/repos/rocket", &[], json!({ "role": "write" })).unwrap();
1106 assert_eq!(route.op, Op::SetTeamRepo);
1107 assert_eq!(input, json!({ "role": "write", "workspace": "acme", "team": "backend", "repo": "acme/rocket" }));
1108 let op = |method: &str, path: &str| resolve(method, path, &[], Value::Null).unwrap().0.op;
1109 assert_eq!(op("DELETE", "/workspaces/acme/teams/backend/repos/rocket"), Op::RemoveTeamRepo);
1110 assert_eq!(op("GET", "/workspaces/acme/teams/backend/teams"), Op::ListChildTeams);
1111 assert_eq!(op("GET", "/workspaces/acme/teams/backend/repos"), Op::ListTeamRepos);
1112 assert_eq!(op("PUT", "/workspaces/acme/teams/backend/review_assignment"), Op::SetTeamReviewAssignment);
1113 assert_eq!(op("DELETE", "/workspaces/acme/teams/backend"), Op::DeleteTeam);
1114 assert_eq!(op("POST", "/workspaces/acme/teams"), Op::CreateTeam);
1115 assert_eq!(op("GET", "/workspaces/acme/teams/backend"), Op::GetTeam);
1116 assert_eq!(op("DELETE", "/workspaces/acme/teams/backend/members/ana"), Op::RemoveTeamMember);
1117 let (route, input) = resolve("GET", "/workspaces/acme/members/ana/teams", &[], Value::Null).unwrap();
1118 assert_eq!(route.op, Op::ListUserTeams);
1119 assert_eq!(input, json!({ "workspace": "acme", "username": "ana" }));
1120 }
1121
1122 #[test]
1123 fn reviewers_are_requested_and_code_owners_checked_on_a_repository() {
1124 let body = json!({ "reviewers": ["ana"], "team_reviewers": ["backend"] });
1125 let (route, input) = resolve("POST", "/repos/acme/rocket/pulls/7/requested_reviewers", &[], body.clone()).unwrap();
1126 assert_eq!(route.op, Op::RequestReviewers);
1127 assert_eq!(
1128 input,
1129 json!({ "reviewers": ["ana"], "team_reviewers": ["backend"], "repo": "acme/rocket", "number": 7 })
1130 );
1131 let (route, _) = resolve("DELETE", "/repos/acme/rocket/pulls/7/requested_reviewers", &[], body).unwrap();
1132 assert_eq!(route.op, Op::RemoveRequestedReviewers);
1133 let query = [("ref".to_owned(), "main".to_owned())];
1134 let (route, input) = resolve("GET", "/repos/acme/rocket/codeowners/errors", &query, Value::Null).unwrap();
1135 assert_eq!(route.op, Op::GetCodeownersErrors);
1136 assert_eq!(input, json!({ "ref": "main", "repo": "acme/rocket" }));
1137 }
1138
1139 #[test]
API: notifications over REST and MCP, with notifications scopes1140 fn notifications_are_addressed_as_threads_and_by_issue() {
1141 let (route, input) = resolve("DELETE", "/notifications/threads/ntf_1", &[], Value::Null).unwrap();
1142 assert_eq!(route.op, Op::MarkThreadDone);
1143 assert_eq!(input, json!({ "id": "ntf_1" }));
1144 let (route, input) = resolve("DELETE", "/notifications/threads/ntf_1/saved", &[], Value::Null).unwrap();
1145 assert_eq!(route.op, Op::SaveThread);
1146 assert_eq!(input, json!({ "id": "ntf_1", "saved": false }));
1147 let (route, input) = resolve("DELETE", "/notifications/threads/ntf_1/snooze", &[], json!({ "until": "x" })).unwrap();
1148 assert_eq!(route.op, Op::SnoozeThread);
1149 assert_eq!(input, json!({ "id": "ntf_1" }));
1150 let query = [("all".to_owned(), "true".to_owned()), ("per_page".to_owned(), "50".to_owned())];
1151 let (route, input) = resolve("GET", "/repos/acme/rocket/notifications", &query, Value::Null).unwrap();
1152 assert_eq!(route.op, Op::ListNotifications);
1153 assert_eq!(input, json!({ "all": "true", "per_page": "50", "repo": "acme/rocket" }));
1154 let (route, input) = resolve("PUT", "/repos/acme/rocket/issues/7/subscription", &[], json!({ "ignored": true })).unwrap();
1155 assert_eq!(route.op, Op::SetThreadSubscription);
1156 assert_eq!(input, json!({ "ignored": true, "number": 7, "repo": "acme/rocket" }));
1157 assert_eq!(resolve("GET", "/user/subscriptions", &[], Value::Null).unwrap().0.op, Op::ListWatchedRepos);
1158 }
1159
1160 #[test]
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar1161 fn labels_and_milestones_are_named_in_the_path() {
1162 let (route, input) = resolve("PATCH", "/repos/acme/web/labels/good%20first%20issue", &[], json!({ "color": "7057ff" })).unwrap();
1163 assert_eq!(route.op, Op::UpdateLabel);
1164 assert_eq!(input, json!({ "color": "7057ff", "label": "good first issue", "repo": "acme/web" }));
1165 let (route, input) = resolve("DELETE", "/repos/acme/web/issues/7/labels/bug", &[], Value::Null).unwrap();
1166 assert_eq!(route.op, Op::RemoveIssueLabels);
1167 assert_eq!(input, json!({ "label": "bug", "number": 7, "repo": "acme/web" }));
1168 let (route, input) = resolve("DELETE", "/repos/acme/web/issues/7/labels", &[], Value::Null).unwrap();
1169 assert_eq!(route.op, Op::RemoveIssueLabels);
1170 assert_eq!(input, json!({ "number": 7, "repo": "acme/web" }));
1171 let (route, _) = resolve("POST", "/repos/acme/web/labels/defaults", &[], Value::Null).unwrap();
1172 assert_eq!(route.op, Op::AddDefaultLabels);
1173 let (route, input) = resolve("PATCH", "/repos/acme/web/milestones/3", &[], json!({ "state": "closed" })).unwrap();
1174 assert_eq!(route.op, Op::UpdateMilestone);
1175 assert_eq!(input, json!({ "state": "closed", "milestone": 3, "repo": "acme/web" }));
1176 let (route, input) = resolve("PATCH", "/repos/acme/web/pulls/9", &[], json!({ "base": "release" })).unwrap();
1177 assert_eq!(route.op, Op::UpdatePullRequest);
1178 assert_eq!(input, json!({ "base": "release", "number": 9, "repo": "acme/web" }));
1179 }
1180
1181 #[test]
Usage, Billing settings and prepaid AI credit; fixes from the UX audit1182 fn billing_is_addressed_by_workspace() {
1183 let query = [("from".to_owned(), "2026-10-01".to_owned()), ("products".to_owned(), "agent,sandboxes".to_owned())];
1184 let (route, input) = resolve("GET", "/workspaces/acme/usage", &query, Value::Null).unwrap();
1185 assert_eq!(route.op, Op::GetUsage);
1186 assert_eq!(input, json!({ "from": "2026-10-01", "products": "agent,sandboxes", "workspace": "acme" }));
1187 let (route, input) = resolve("PUT", "/workspaces/acme/budget", &[], json!({ "alerts": [50] })).unwrap();
1188 assert_eq!(route.op, Op::SetBudget);
1189 assert_eq!(input, json!({ "alerts": [50], "workspace": "acme" }));
1190 let op = |method: &str, path: &str| resolve(method, path, &[], Value::Null).unwrap().0.op;
1191 assert_eq!(op("GET", "/workspaces/acme/budget"), Op::GetBudget);
1192 assert_eq!(op("GET", "/workspaces/acme/ai_credit"), Op::GetAiCredit);
1193 assert_eq!(op("POST", "/workspaces/acme/ai_credit/checkout"), Op::BuyAiCredit);
1194 assert_eq!(op("GET", "/workspaces/acme/invoices"), Op::ListInvoices);
1195 assert_eq!(op("GET", "/workspaces/acme/billing_details"), Op::GetBillingDetails);
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens1196 assert_eq!(op("GET", "/workspaces/acme/gateway/requests"), Op::ListGatewayRequests);
Usage, Billing settings and prepaid AI credit; fixes from the UX audit1197 }
1198
1199 #[test]
Merge checks: statuses and check runs on every commit1200 fn checks_are_at_githubs_addresses() {
1201 let sha = "a".repeat(40);
1202 let body = json!({ "state": "success", "context": "ci/build" });
1203 let (route, input) = resolve("POST", &format!("/repos/acme/web/statuses/{sha}"), &[], body).unwrap();
1204 assert_eq!(route.op, Op::Checks(ChecksOp::CreateCommitStatus));
1205 assert_eq!(input, json!({ "state": "success", "context": "ci/build", "sha": sha, "repo": "acme/web" }));
1206 let (route, input) = resolve("GET", "/repos/acme/web/commits/release%2F1.x/status", &[], Value::Null).unwrap();
1207 assert_eq!(route.op, Op::Checks(ChecksOp::GetCombinedStatus));
1208 assert_eq!(input, json!({ "ref": "release/1.x", "repo": "acme/web" }));
1209 let query = [("check_name".to_owned(), "lint".to_owned())];
1210 let (route, input) = resolve("GET", "/repos/acme/web/commits/main/check-runs", &query, Value::Null).unwrap();
1211 assert_eq!(route.op, Op::Checks(ChecksOp::ListCheckRunsForRef));
1212 assert_eq!(input, json!({ "check_name": "lint", "ref": "main", "repo": "acme/web" }));
1213 let (route, input) = resolve("PATCH", "/repos/acme/web/check-runs/cr_1", &[], json!({ "conclusion": "success" })).unwrap();
1214 assert_eq!(route.op, Op::Checks(ChecksOp::UpdateCheckRun));
1215 assert_eq!(input, json!({ "conclusion": "success", "id": "cr_1", "repo": "acme/web" }));
1216 let op = |method: &str, path: &str| resolve(method, path, &[], Value::Null).unwrap().0.op;
1217 assert_eq!(op("POST", "/repos/acme/web/check-runs"), Op::Checks(ChecksOp::CreateCheckRun));
1218 assert_eq!(op("GET", "/repos/acme/web/check-runs/cr_1/annotations"), Op::Checks(ChecksOp::ListCheckRunAnnotations));
1219 assert_eq!(op("POST", "/repos/acme/web/check-suites/cs_1/rerequest"), Op::Checks(ChecksOp::RerequestCheckSuite));
1220 assert_eq!(op("GET", "/repos/acme/web/commits/main/check-suites"), Op::Checks(ChecksOp::ListCheckSuitesForRef));
1221 }
1222
1223 #[test]
API and MCP server in Rust; a public index at the API root1224 fn query_parameters_are_renamed() {
1225 let query = [
1226 ("q".to_owned(), "parser".to_owned()),
1227 ("x".to_owned(), "y".to_owned()),
1228 ];
Agents as a team: lifecycle, merge queue, billing and a new shell1229 let (route, input) = resolve("GET", "/repos", &query, Value::Null).unwrap();
API and MCP server in Rust; a public index at the API root1230 assert_eq!(route.op, Op::ListRepos);
1231 assert_eq!(input, json!({ "query": "parser" }));
1232 }
1233
1234 #[test]
1235 fn method_and_shape_must_match() {
Agents as a team: lifecycle, merge queue, billing and a new shell1236 assert!(resolve("GET", "/repos/a/b/issues/1/close", &[], Value::Null).is_none());
1237 assert!(resolve("GET", "/repos/a", &[], Value::Null).is_none());
1238 assert!(resolve("GET", "/repos/a/b/issues/1/extra", &[], Value::Null).is_none());
1239 assert!(resolve("GET", "/repos/a/b/", &[], Value::Null).is_some());
API and MCP server in Rust; a public index at the API root1240 }
1241
1242 #[test]
1243 fn every_parameter_and_query_name_is_an_input() {
1244 for route in ROUTES {
1245 let properties = route.op.properties();
1246 for (_, key) in route.query {
1247 assert!(properties.contains_key(*key), "{}: {key}", route.path);
1248 }
1249 for name in route.params() {
1250 let covered = matches!(name, "owner" | "name") && properties.contains_key("repo")
1251 || properties.contains_key(name);
1252 assert!(covered, "{}: {name}", route.path);
1253 }
1254 }
1255 }
1256
1257 #[test]
1258 fn every_operation_has_a_route() {
1259 for op in Op::ALL {
1260 assert!(ROUTES.iter().any(|route| route.op == op), "{}", op.name());
1261 }
1262 }
1263}

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