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

Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step1/**
2 * Scopes: what an access token may do on its owner's behalf. Mirrors
3 * `crates/contracts/src/scopes.rs`, which is the source of truth; a Rust
4 * test keeps the tables here the same.
5 *
6 * A token reaches whatever its owner can reach (a workspace's token, that
7 * workspace); what a request may do is the intersection of the owner's
8 * role and the token's scopes.
9 */
10
11export type ScopeResource =
12 | "repo"
13 | "code"
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar14 | "security"
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member15 | "packages"
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step16 | "issues"
17 | "pull_requests"
18 | "agents"
19 | "workflows"
20 | "memory"
21 | "account"
API: notifications over REST and MCP, with notifications scopes22 | "notifications"
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step23 | "workspace"
Usage, Billing settings and prepaid AI credit; fixes from the UX audit24 | "billing"
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step25 | "access"
26 | "webhooks"
Fast pages, required checks on the branch, self-hosted runners, honest incidents27 | "secrets"
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens28 | "runners"
29 | "models";
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step30
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member31export type ScopeLevel = "read" | "write" | "run" | "delete" | "admin";
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step32
33/** Every scope, grouped by resource, least first. */
34export const SCOPES = [
About: license, languages, contributors, stars, releases and activity beside the files35 { scope: "repo:read", description: "See repositories, their settings, labels, timelines, releases, languages, contributors and security alerts, and search" },
36 { scope: "repo:write", description: "Create repositories, rename branches, change how pull requests merge and publish releases" },
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge37 { scope: "repo:admin", description: "Rename, archive, transfer, delete or change who can see a repository, change its rulesets, and dismiss security alerts" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step38 { scope: "code:read", description: "Clone and fetch private repositories with git" },
39 { scope: "code:write", description: "Push commits with git" },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar40 { scope: "security:read", description: "See secret scanning, code scanning and vulnerability alerts, custom patterns, the dependency graph and SBOM, and security settings" },
41 { scope: "security:write", description: "Dismiss and reopen alerts, bypass push protection, review bypass requests, manage custom patterns, upload SARIF and change security settings" },
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member42 { scope: "packages:read", description: "Pull container images and install private packages" },
43 { scope: "packages:write", description: "Push container images and publish packages" },
44 { scope: "packages:delete", description: "Delete packages and their versions" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step45 { scope: "issues:read", description: "Read issues, comments and plans" },
46 { scope: "issues:write", description: "Open, edit, close and comment on issues" },
47 { scope: "pull_requests:read", description: "Read pull requests, their changes, sessions and merge queues" },
48 { scope: "pull_requests:write", description: "Open, review, close and merge pull requests" },
49 { scope: "agents:run", description: "Put g1t agents to work and message them, which uses the workspace's money" },
50 { scope: "workflows:read", description: "Read workflows, runs and logs" },
51 { scope: "workflows:write", description: "Run, cancel, rerun and turn workflows on or off" },
52 { scope: "memory:read", description: "Recall memory and search the workspace's context" },
53 { scope: "memory:write", description: "Save memory for the next agent" },
About: license, languages, contributors, stars, releases and activity beside the files54 { scope: "account:read", description: "Read your email addresses, invites, invitations, pinned projects and stars" },
55 { scope: "account:write", description: "Change your email addresses, make invites, answer invitations, pin projects and star repositories" },
API: notifications over REST and MCP, with notifications scopes56 { scope: "notifications:read", description: "See your inbox, its threads, and what you subscribe to and watch" },
57 { scope: "notifications:write", description: "Mark notifications read, done, saved or snoozed, subscribe to threads and watch repositories" },
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge58 { scope: "workspace:read", description: "Read workspace settings, invites, integrations, model routes, teams and rulesets" },
59 { scope: "workspace:admin", description: "Create and delete workspaces, invite members, connect integrations, create, change and delete teams, and change the workspace's rulesets" },
Usage, Billing settings and prepaid AI credit; fixes from the UX audit60 { scope: "billing:read", description: "See a workspace's usage, budget, AI credit and invoices" },
61 { scope: "billing:write", description: "Change a workspace's budget and buy AI credit" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step62 { scope: "access:read", description: "See who has access to repositories" },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar63 { scope: "access:admin", description: "Give and take away access to repositories, a team's included" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step64 { scope: "webhooks:read", description: "See webhooks and their deliveries" },
65 { scope: "webhooks:admin", description: "Create, change and delete webhooks" },
66 { scope: "secrets:read", description: "List secrets (never their values) and read variables" },
67 { scope: "secrets:admin", description: "Set and delete secrets and variables" },
Fast pages, required checks on the branch, self-hosted runners, honest incidents68 { scope: "runners:read", description: "See self-hosted runners, their groups and where agents run" },
69 { scope: "runners:admin", description: "Register and remove self-hosted runners, change their groups and settings" },
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens70 { scope: "models:read", description: "See the workspace's AI Gateway requests: their models, tokens, cost and status" },
71 { scope: "models:write", description: "Send model requests through the AI Gateway, which uses the workspace's AI credit" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step72] as const;
73
74export type Scope = (typeof SCOPES)[number]["scope"];
75
76/** Resources in the order settings show them, with their names for people. */
77export const SCOPE_RESOURCES: { resource: ScopeResource; label: string }[] = [
78 { resource: "repo", label: "Repositories" },
79 { resource: "code", label: "Code" },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar80 { resource: "security", label: "Security" },
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member81 { resource: "packages", label: "Packages" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step82 { resource: "issues", label: "Issues" },
83 { resource: "pull_requests", label: "Pull requests" },
84 { resource: "agents", label: "g1t agents" },
85 { resource: "workflows", label: "Workflows" },
86 { resource: "memory", label: "Memory and context" },
87 { resource: "account", label: "Your account" },
API: notifications over REST and MCP, with notifications scopes88 { resource: "notifications", label: "Notifications" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step89 { resource: "workspace", label: "Workspaces" },
Usage, Billing settings and prepaid AI credit; fixes from the UX audit90 { resource: "billing", label: "Billing" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step91 { resource: "access", label: "Who has access" },
92 { resource: "webhooks", label: "Webhooks" },
93 { resource: "secrets", label: "Secrets and variables" },
Fast pages, required checks on the branch, self-hosted runners, honest incidents94 { resource: "runners", label: "Self-hosted runners" },
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens95 { resource: "models", label: "AI Gateway" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step96];
97
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member98const LEVEL_ORDER: Record<ScopeLevel, number> = { read: 0, write: 1, run: 2, delete: 3, admin: 4 };
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step99
100export function scopeResource(scope: Scope): ScopeResource {
101 return scope.split(":")[0] as ScopeResource;
102}
103
104export function scopeLevel(scope: Scope): ScopeLevel {
105 return scope.split(":")[1] as ScopeLevel;
106}
107
108export function isScope(text: string): text is Scope {
109 return SCOPES.some((row) => row.scope === text);
110}
111
112/** Changes that are hard to undo, or decide who can reach what. */
113export function isDangerous(scope: Scope): boolean {
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member114 const level = scopeLevel(scope);
115 return level === "admin" || level === "delete";
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step116}
117
118export function describeScope(scope: Scope): string {
119 return SCOPES.find((row) => row.scope === scope)?.description ?? scope;
120}
121
122/** Whether holding `held` gives `needed`: the same resource, at its level or lower. */
123export function scopeIncludes(held: Scope, needed: Scope): boolean {
124 return (
125 scopeResource(held) === scopeResource(needed) &&
126 LEVEL_ORDER[scopeLevel(held)] >= LEVEL_ORDER[scopeLevel(needed)]
127 );
128}
129
130/** The levels a resource has, least first. */
131export function levelsOf(resource: ScopeResource): ScopeLevel[] {
132 return SCOPES.filter((row) => scopeResource(row.scope) === resource).map((row) => scopeLevel(row.scope));
133}
134
135/** Scopes from text separated by spaces or commas, in table order; unknown ones are left out. */
136export function parseScopes(text: string): Scope[] {
137 const given = new Set(text.split(/[\s,]+/).map((part) => part.trim().toLowerCase()));
138 return SCOPES.map((row) => row.scope).filter((scope) => given.has(scope));
139}
140
141/** What a token stores for full access. */
142export const FULL_ACCESS = "*";
143
144export type PresetId = "read_only" | "agent" | "ci" | "full";
145
146/** Starting points for choosing scopes. `*` is full access. */
147export const PRESET_SCOPES = {
148 read_only: [
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens149 "repo:read", "code:read", "security:read", "packages:read", "issues:read", "pull_requests:read", "workflows:read", "memory:read", "account:read", "notifications:read", "workspace:read", "billing:read", "access:read", "webhooks:read", "secrets:read", "runners:read", "models:read",
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step150 ] as const,
151 agent: [
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens152 "repo:read", "code:read", "code:write", "security:read", "packages:read", "issues:read", "issues:write", "pull_requests:read", "pull_requests:write", "agents:run", "workflows:read", "memory:read", "memory:write", "account:read", "notifications:read", "notifications:write", "workspace:read", "billing:read", "access:read", "webhooks:read", "secrets:read", "models:read",
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step153 ] as const,
154 ci: [
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member155 "repo:read", "code:read", "code:write", "packages:read", "packages:write", "workflows:read", "workflows:write",
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step156 ] as const,
157 full: [
158 "*",
159 ] as const,
160};
161
162export const PRESETS: { id: PresetId; label: string; description: string }[] = [
163 { id: "read_only", label: "Read only", description: "Read everything you can read; change nothing." },
164 { id: "agent", label: "Agent", description: "Read everything, work on issues and pull requests, push code and run g1t agents." },
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member165 { id: "ci", label: "CI", description: "Clone and push code, push and pull packages, and run workflows." },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step166 { id: "full", label: "Full access", description: "Everything you can do, including deleting repositories and changing who has access." },
167];
168
169/** The scopes of a preset, or null for full access. */
170export function presetScopes(id: PresetId): Scope[] | null {
171 if (id === "full") return null;
172 return [...PRESET_SCOPES[id]] as Scope[];
173}
174
175/** What an OAuth client gets when it asks for nothing in particular. */
176export const OAUTH_DEFAULT_SCOPES: Scope[] = [...PRESET_SCOPES.agent];
177
178/** The operation each scope gates, by the API's operation names. */
179export const OPERATION_SCOPES = [
180 ["list_emails", "account:read"],
181 ["add_email", "account:write"],
182 ["remove_email", "account:write"],
183 ["update_email_settings", "account:write"],
184 ["list_invites", "account:read"],
185 ["create_invite", "account:write"],
186 ["revoke_invite", "account:write"],
187 ["list_my_repo_invitations", "account:read"],
188 ["accept_repo_invitation", "account:write"],
189 ["decline_repo_invitation", "account:write"],
API: pinned projects over REST and MCP190 // Your pinned projects: a preference of your account.
191 ["list_pinned_projects", "account:read"],
192 ["pin_project", "account:write"],
About: license, languages, contributors, stars, releases and activity beside the files193 // Your stars: a preference of your account.
194 ["list_starred", "account:read"],
195 ["check_starred", "account:read"],
196 ["star_repo", "account:write"],
197 ["unstar_repo", "account:write"],
API: pinned projects over REST and MCP198 ["unpin_project", "account:write"],
199 ["reorder_pinned_projects", "account:write"],
API: notifications over REST and MCP, with notifications scopes200 // Your inbox: notifications, subscriptions and watching.
201 ["list_notifications", "notifications:read"],
202 ["get_notification_thread", "notifications:read"],
203 ["get_thread_subscription", "notifications:read"],
204 ["get_repo_subscription", "notifications:read"],
205 ["list_watched_repos", "notifications:read"],
206 ["mark_notifications_read", "notifications:write"],
207 ["mark_thread_read", "notifications:write"],
208 ["mark_thread_done", "notifications:write"],
209 ["save_thread", "notifications:write"],
210 ["snooze_thread", "notifications:write"],
211 ["set_thread_subscription", "notifications:write"],
212 ["delete_thread_subscription", "notifications:write"],
213 ["set_repo_subscription", "notifications:write"],
214 ["delete_repo_subscription", "notifications:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step215 ["create_workspace", "workspace:admin"],
216 ["delete_workspace", "workspace:admin"],
Merge branch 'worktree-agent-ad7c6d88d93adc817'217 ["get_workspace", "workspace:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily218 ["update_workspace", "workspace:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step219 ["list_workspace_invites", "workspace:read"],
220 ["invite_member", "workspace:admin"],
221 ["revoke_workspace_invite", "workspace:admin"],
222 ["list_integrations", "workspace:read"],
223 ["connect_integration", "workspace:admin"],
224 ["disconnect_integration", "workspace:admin"],
225 ["test_integration", "workspace:admin"],
226 ["get_model_routes", "workspace:read"],
227 ["set_model_routes", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar228 ["list_teams", "workspace:read"],
229 ["get_team", "workspace:read"],
230 ["list_team_members", "workspace:read"],
231 ["list_child_teams", "workspace:read"],
232 ["list_team_repos", "workspace:read"],
233 ["list_user_teams", "workspace:read"],
234 ["create_team", "workspace:admin"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge235 ["list_workspace_rulesets", "workspace:read"],
236 ["get_workspace_ruleset", "workspace:read"],
237 ["list_workspace_rule_evaluations", "workspace:read"],
238 ["create_workspace_ruleset", "workspace:admin"],
239 ["update_workspace_ruleset", "workspace:admin"],
240 ["delete_workspace_ruleset", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar241 ["update_team", "workspace:admin"],
242 ["delete_team", "workspace:admin"],
243 ["set_team_member", "workspace:admin"],
244 ["remove_team_member", "workspace:admin"],
245 ["set_team_review_assignment", "workspace:admin"],
Usage, Billing settings and prepaid AI credit; fixes from the UX audit246 // A workspace's billing: usage, budget, AI credit and invoices.
247 ["get_usage", "billing:read"],
248 ["get_budget", "billing:read"],
249 ["get_ai_credit", "billing:read"],
250 ["list_invoices", "billing:read"],
251 ["get_billing_details", "billing:read"],
252 ["set_budget", "billing:write"],
253 ["buy_ai_credit", "billing:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step254 ["list_repos", "repo:read"],
255 ["get_repo", "repo:read"],
256 ["search", "repo:read"],
257 ["list_events", "repo:read"],
About: license, languages, contributors, stars, releases and activity beside the files258 // What the default branch says about a repository, who starred it, and
259 // its releases.
260 ["get_languages", "repo:read"],
261 ["list_contributors", "repo:read"],
262 ["get_license", "repo:read"],
263 ["list_stargazers", "repo:read"],
264 ["list_releases", "repo:read"],
265 ["get_latest_release", "repo:read"],
266 ["get_release_by_tag", "repo:read"],
267 ["get_release", "repo:read"],
268 ["create_release", "repo:write"],
269 ["update_release", "repo:write"],
270 ["delete_release", "repo:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step271 ["list_labels", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar272 ["list_milestones", "repo:read"],
273 ["get_milestone", "repo:read"],
274 ["create_label", "issues:write"],
275 ["update_label", "issues:write"],
276 ["delete_label", "issues:write"],
277 ["add_default_labels", "issues:write"],
278 ["create_milestone", "issues:write"],
279 ["update_milestone", "issues:write"],
280 ["delete_milestone", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step281 ["get_repo_settings", "repo:read"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents282 ["list_check_names", "repo:read"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step283 ["list_deleted_repos", "repo:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily284 ["list_security_alerts", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar285 ["get_codeowners_errors", "repo:read"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step286 ["create_repo", "repo:write"],
287 ["update_repo", "repo:write"],
288 ["update_repo_settings", "repo:write"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge289 ["list_repo_rulesets", "repo:read"],
290 ["get_repo_ruleset", "repo:read"],
291 ["get_branch_rules", "repo:read"],
292 ["list_rule_evaluations", "repo:read"],
293 ["create_repo_ruleset", "repo:admin"],
294 ["update_repo_ruleset", "repo:admin"],
295 ["delete_repo_ruleset", "repo:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step296 ["rename_branch", "repo:write"],
297 ["rename_repo", "repo:admin"],
298 ["transfer_repo", "repo:admin"],
299 ["archive_repo", "repo:admin"],
300 ["unarchive_repo", "repo:admin"],
301 ["set_repo_visibility", "repo:admin"],
302 ["delete_repo", "repo:admin"],
303 ["restore_repo", "repo:admin"],
304 ["purge_repo", "repo:admin"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily305 ["dismiss_security_alert", "repo:admin"],
306 ["reopen_security_alert", "repo:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar307 // The security suite.
308 ["list_secret_scanning_alerts", "security:read"],
309 ["get_secret_scanning_alert", "security:read"],
310 ["list_secret_scanning_locations", "security:read"],
311 ["list_bypass_requests", "security:read"],
312 ["list_custom_patterns", "security:read"],
313 ["list_code_scanning_alerts", "security:read"],
314 ["get_code_scanning_alert", "security:read"],
315 ["list_code_scanning_analyses", "security:read"],
316 ["get_sarif_upload", "security:read"],
317 ["list_vulnerability_alerts", "security:read"],
318 ["get_vulnerability_alert", "security:read"],
319 ["get_dependency_graph", "security:read"],
320 ["get_sbom", "security:read"],
321 ["compare_dependencies", "security:read"],
322 ["get_security_settings", "security:read"],
323 ["get_workspace_security_settings", "security:read"],
324 ["get_security_overview", "security:read"],
325 ["update_secret_scanning_alert", "security:write"],
326 ["bypass_push_protection", "security:write"],
327 ["check_secret_validity", "security:write"],
328 ["review_bypass_request", "security:write"],
329 ["create_custom_pattern", "security:write"],
330 ["update_custom_pattern", "security:write"],
331 ["delete_custom_pattern", "security:write"],
332 ["dry_run_custom_pattern", "security:write"],
333 ["update_code_scanning_alert", "security:write"],
334 ["upload_sarif", "security:write"],
335 ["update_vulnerability_alert", "security:write"],
336 ["fix_security_alert", "security:write"],
337 ["update_security_settings", "security:write"],
338 ["update_workspace_security_settings", "security:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step339 ["list_issues", "issues:read"],
340 ["get_issue", "issues:read"],
341 ["get_plan", "issues:read"],
342 ["create_issue", "issues:write"],
343 ["update_issue", "issues:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar344 ["list_issue_labels", "issues:read"],
345 ["add_issue_labels", "issues:write"],
346 ["set_issue_labels", "issues:write"],
347 ["remove_issue_labels", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step348 ["close_issue", "issues:write"],
349 ["reopen_issue", "issues:write"],
350 ["add_comment", "issues:write"],
351 ["import_issue", "issues:write"],
352 ["apply_plan", "issues:write"],
353 ["list_pull_requests", "pull_requests:read"],
354 ["get_pull_request", "pull_requests:read"],
355 ["get_pull_request_changes", "pull_requests:read"],
356 ["read_session", "pull_requests:read"],
357 ["get_merge_queue", "pull_requests:read"],
358 ["create_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar359 ["update_pull_request", "pull_requests:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step360 ["record_session", "pull_requests:write"],
361 ["mark_pull_request_ready", "pull_requests:write"],
362 ["close_pull_request", "pull_requests:write"],
363 ["review_pull_request", "pull_requests:write"],
364 ["merge_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar365 ["request_reviewers", "pull_requests:write"],
366 ["remove_requested_reviewers", "pull_requests:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step367 ["assign_issue", "agents:run"],
368 ["delegate", "agents:run"],
369 ["plan_work", "agents:run"],
370 ["message_agent", "agents:run"],
371 ["answer_message", "agents:run"],
372 ["take_messages", "agents:run"],
373 ["list_workflows", "workflows:read"],
374 ["list_workflow_runs", "workflows:read"],
375 ["get_workflow_run", "workflows:read"],
376 ["get_job_logs", "workflows:read"],
377 ["dispatch_workflow", "workflows:write"],
378 ["cancel_workflow_run", "workflows:write"],
379 ["rerun_workflow_run", "workflows:write"],
380 ["update_workflow", "workflows:write"],
381 ["recall", "memory:read"],
382 ["search_context", "memory:read"],
383 ["get_entity", "memory:read"],
384 ["get_context", "memory:read"],
385 ["remember", "memory:write"],
386 ["list_collaborators", "access:read"],
387 ["get_collaborator_permission", "access:read"],
388 ["list_repo_invitations", "access:read"],
389 ["list_outside_collaborators", "access:read"],
390 ["add_collaborator", "access:admin"],
391 ["update_collaborator", "access:admin"],
392 ["remove_collaborator", "access:admin"],
393 ["revoke_repo_invitation", "access:admin"],
394 ["set_base_permission", "access:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar395 ["set_team_repo", "access:admin"],
396 ["remove_team_repo", "access:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step397 ["list_webhooks", "webhooks:read"],
398 ["list_webhook_deliveries", "webhooks:read"],
399 ["create_webhook", "webhooks:admin"],
400 ["update_webhook", "webhooks:admin"],
401 ["delete_webhook", "webhooks:admin"],
402 ["ping_webhook", "webhooks:admin"],
403 ["redeliver_webhook", "webhooks:admin"],
404 ["list_actions_secrets", "secrets:read"],
405 ["list_actions_variables", "secrets:read"],
406 ["set_actions_secret", "secrets:admin"],
407 ["delete_actions_secret", "secrets:admin"],
408 ["set_actions_variable", "secrets:admin"],
409 ["delete_actions_variable", "secrets:admin"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents410 // Self-hosted runners.
411 ["list_runners", "runners:read"],
412 ["list_runner_groups", "runners:read"],
413 ["get_runner_settings", "runners:read"],
414 ["create_runner_registration_token", "runners:admin"],
415 ["remove_runner", "runners:admin"],
416 ["create_runner_group", "runners:admin"],
417 ["update_runner_group", "runners:admin"],
418 ["delete_runner_group", "runners:admin"],
419 ["update_runner_settings", "runners:admin"],
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens420 // The AI Gateway. Sending a request to a model needs `models:write`,
421 // checked by the model proxy at models.g1t.sh.
422 ["list_gateway_requests", "models:read"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step423] as const;
424
425/**
426 * The scopes a token or grant holds, as stored: null for full access, or
427 * the list. `legacy` marks a token made before scopes, which has full
428 * access until someone narrows it.
429 */
430export type TokenScopes = {
431 scopes: Scope[] | null;
432 legacy: boolean;
433};
434
435/**
436 * How settings group scopes into a checklist: each group's scopes, least
437 * first. Admin scopes are not here; they are under "Dangerous" on their
438 * own (see `DANGEROUS_SCOPES`). Every other scope is in exactly one group.
439 */
440export const SCOPE_GROUPS: { id: string; label: string; scopes: Scope[] }[] = [
441 { id: "code", label: "Repositories & code", scopes: ["repo:read", "repo:write", "code:read", "code:write"] },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar442 { id: "security", label: "Security", scopes: ["security:read", "security:write"] },
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member443 { id: "packages", label: "Packages", scopes: ["packages:read", "packages:write"] },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step444 { id: "work", label: "Issues & pull requests", scopes: ["issues:read", "issues:write", "pull_requests:read", "pull_requests:write"] },
445 { id: "agents", label: "Agents", scopes: ["agents:run"] },
446 { id: "workflows", label: "Workflows", scopes: ["workflows:read", "workflows:write"] },
447 { id: "memory", label: "Memory & search", scopes: ["memory:read", "memory:write"] },
448 { id: "account", label: "Account", scopes: ["account:read", "account:write"] },
API: notifications over REST and MCP, with notifications scopes449 { id: "notifications", label: "Notifications", scopes: ["notifications:read", "notifications:write"] },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step450 { id: "workspace", label: "Workspace", scopes: ["workspace:read", "access:read", "webhooks:read", "secrets:read"] },
Usage, Billing settings and prepaid AI credit; fixes from the UX audit451 { id: "billing", label: "Billing", scopes: ["billing:read", "billing:write"] },
Fast pages, required checks on the branch, self-hosted runners, honest incidents452 { id: "runners", label: "Runners", scopes: ["runners:read"] },
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens453 { id: "models", label: "AI Gateway", scopes: ["models:read", "models:write"] },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step454];
455
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member456/** The admin and delete scopes, shown under "Dangerous" behind a warning. */
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step457export const DANGEROUS_SCOPES: Scope[] = SCOPES.map((row) => row.scope).filter(isDangerous);

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