Skip to content
426 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"
AI Gateway: your own code calls models with a workspace token28 | "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 = [
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily35 { scope: "repo:read", description: "See repositories, their settings, labels, timelines and security alerts, and search" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step36 { scope: "repo:write", description: "Create repositories, rename branches and change how pull requests merge" },
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily37 { scope: "repo:admin", description: "Rename, archive, transfer, delete or change who can see a repository, 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" },
API: pinned projects over REST and MCP54 { scope: "account:read", description: "Read your email addresses, invites, invitations and pinned projects" },
55 { scope: "account:write", description: "Change your email addresses, make invites, answer invitations and pin projects" },
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 branch 'worktree-agent-ad7c6d88d93adc817'58 { scope: "workspace:read", description: "Read workspace settings, invites, integrations, model routes and teams" },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar59 { scope: "workspace:admin", description: "Create and delete workspaces, invite members, connect integrations, and create, change and delete teams" },
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" },
AI Gateway: your own code calls models with a workspace token70 { 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" },
AI Gateway: your own code calls models with a workspace token95 { 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: [
AI Gateway: your own code calls models with a workspace token149 "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: [
AI Gateway: your own code calls models with a workspace token152 "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"],
193 ["unpin_project", "account:write"],
194 ["reorder_pinned_projects", "account:write"],
API: notifications over REST and MCP, with notifications scopes195 // Your inbox: notifications, subscriptions and watching.
196 ["list_notifications", "notifications:read"],
197 ["get_notification_thread", "notifications:read"],
198 ["get_thread_subscription", "notifications:read"],
199 ["get_repo_subscription", "notifications:read"],
200 ["list_watched_repos", "notifications:read"],
201 ["mark_notifications_read", "notifications:write"],
202 ["mark_thread_read", "notifications:write"],
203 ["mark_thread_done", "notifications:write"],
204 ["save_thread", "notifications:write"],
205 ["snooze_thread", "notifications:write"],
206 ["set_thread_subscription", "notifications:write"],
207 ["delete_thread_subscription", "notifications:write"],
208 ["set_repo_subscription", "notifications:write"],
209 ["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 step210 ["create_workspace", "workspace:admin"],
211 ["delete_workspace", "workspace:admin"],
Merge branch 'worktree-agent-ad7c6d88d93adc817'212 ["get_workspace", "workspace:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily213 ["update_workspace", "workspace:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step214 ["list_workspace_invites", "workspace:read"],
215 ["invite_member", "workspace:admin"],
216 ["revoke_workspace_invite", "workspace:admin"],
217 ["list_integrations", "workspace:read"],
218 ["connect_integration", "workspace:admin"],
219 ["disconnect_integration", "workspace:admin"],
220 ["test_integration", "workspace:admin"],
221 ["get_model_routes", "workspace:read"],
222 ["set_model_routes", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar223 ["list_teams", "workspace:read"],
224 ["get_team", "workspace:read"],
225 ["list_team_members", "workspace:read"],
226 ["list_child_teams", "workspace:read"],
227 ["list_team_repos", "workspace:read"],
228 ["list_user_teams", "workspace:read"],
229 ["create_team", "workspace:admin"],
230 ["update_team", "workspace:admin"],
231 ["delete_team", "workspace:admin"],
232 ["set_team_member", "workspace:admin"],
233 ["remove_team_member", "workspace:admin"],
234 ["set_team_review_assignment", "workspace:admin"],
Usage, Billing settings and prepaid AI credit; fixes from the UX audit235 // A workspace's billing: usage, budget, AI credit and invoices.
236 ["get_usage", "billing:read"],
237 ["get_budget", "billing:read"],
238 ["get_ai_credit", "billing:read"],
239 ["list_invoices", "billing:read"],
240 ["get_billing_details", "billing:read"],
241 ["set_budget", "billing:write"],
242 ["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 step243 ["list_repos", "repo:read"],
244 ["get_repo", "repo:read"],
245 ["search", "repo:read"],
246 ["list_events", "repo:read"],
247 ["list_labels", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar248 ["list_milestones", "repo:read"],
249 ["get_milestone", "repo:read"],
250 ["create_label", "issues:write"],
251 ["update_label", "issues:write"],
252 ["delete_label", "issues:write"],
253 ["add_default_labels", "issues:write"],
254 ["create_milestone", "issues:write"],
255 ["update_milestone", "issues:write"],
256 ["delete_milestone", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step257 ["get_repo_settings", "repo:read"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents258 ["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 step259 ["list_deleted_repos", "repo:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily260 ["list_security_alerts", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar261 ["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 step262 ["create_repo", "repo:write"],
263 ["update_repo", "repo:write"],
264 ["update_repo_settings", "repo:write"],
265 ["rename_branch", "repo:write"],
266 ["rename_repo", "repo:admin"],
267 ["transfer_repo", "repo:admin"],
268 ["archive_repo", "repo:admin"],
269 ["unarchive_repo", "repo:admin"],
270 ["set_repo_visibility", "repo:admin"],
271 ["delete_repo", "repo:admin"],
272 ["restore_repo", "repo:admin"],
273 ["purge_repo", "repo:admin"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily274 ["dismiss_security_alert", "repo:admin"],
275 ["reopen_security_alert", "repo:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar276 // The security suite.
277 ["list_secret_scanning_alerts", "security:read"],
278 ["get_secret_scanning_alert", "security:read"],
279 ["list_secret_scanning_locations", "security:read"],
280 ["list_bypass_requests", "security:read"],
281 ["list_custom_patterns", "security:read"],
282 ["list_code_scanning_alerts", "security:read"],
283 ["get_code_scanning_alert", "security:read"],
284 ["list_code_scanning_analyses", "security:read"],
285 ["get_sarif_upload", "security:read"],
286 ["list_vulnerability_alerts", "security:read"],
287 ["get_vulnerability_alert", "security:read"],
288 ["get_dependency_graph", "security:read"],
289 ["get_sbom", "security:read"],
290 ["compare_dependencies", "security:read"],
291 ["get_security_settings", "security:read"],
292 ["get_workspace_security_settings", "security:read"],
293 ["get_security_overview", "security:read"],
294 ["update_secret_scanning_alert", "security:write"],
295 ["bypass_push_protection", "security:write"],
296 ["check_secret_validity", "security:write"],
297 ["review_bypass_request", "security:write"],
298 ["create_custom_pattern", "security:write"],
299 ["update_custom_pattern", "security:write"],
300 ["delete_custom_pattern", "security:write"],
301 ["dry_run_custom_pattern", "security:write"],
302 ["update_code_scanning_alert", "security:write"],
303 ["upload_sarif", "security:write"],
304 ["update_vulnerability_alert", "security:write"],
305 ["fix_security_alert", "security:write"],
306 ["update_security_settings", "security:write"],
307 ["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 step308 ["list_issues", "issues:read"],
309 ["get_issue", "issues:read"],
310 ["get_plan", "issues:read"],
311 ["create_issue", "issues:write"],
312 ["update_issue", "issues:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar313 ["list_issue_labels", "issues:read"],
314 ["add_issue_labels", "issues:write"],
315 ["set_issue_labels", "issues:write"],
316 ["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 step317 ["close_issue", "issues:write"],
318 ["reopen_issue", "issues:write"],
319 ["add_comment", "issues:write"],
320 ["import_issue", "issues:write"],
321 ["apply_plan", "issues:write"],
322 ["list_pull_requests", "pull_requests:read"],
323 ["get_pull_request", "pull_requests:read"],
324 ["get_pull_request_changes", "pull_requests:read"],
325 ["read_session", "pull_requests:read"],
326 ["get_merge_queue", "pull_requests:read"],
327 ["create_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar328 ["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 step329 ["record_session", "pull_requests:write"],
330 ["mark_pull_request_ready", "pull_requests:write"],
331 ["close_pull_request", "pull_requests:write"],
332 ["review_pull_request", "pull_requests:write"],
333 ["merge_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar334 ["request_reviewers", "pull_requests:write"],
335 ["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 step336 ["assign_issue", "agents:run"],
337 ["delegate", "agents:run"],
338 ["plan_work", "agents:run"],
339 ["message_agent", "agents:run"],
340 ["answer_message", "agents:run"],
341 ["take_messages", "agents:run"],
342 ["list_workflows", "workflows:read"],
343 ["list_workflow_runs", "workflows:read"],
344 ["get_workflow_run", "workflows:read"],
345 ["get_job_logs", "workflows:read"],
346 ["dispatch_workflow", "workflows:write"],
347 ["cancel_workflow_run", "workflows:write"],
348 ["rerun_workflow_run", "workflows:write"],
349 ["update_workflow", "workflows:write"],
350 ["recall", "memory:read"],
351 ["search_context", "memory:read"],
352 ["get_entity", "memory:read"],
353 ["get_context", "memory:read"],
354 ["remember", "memory:write"],
355 ["list_collaborators", "access:read"],
356 ["get_collaborator_permission", "access:read"],
357 ["list_repo_invitations", "access:read"],
358 ["list_outside_collaborators", "access:read"],
359 ["add_collaborator", "access:admin"],
360 ["update_collaborator", "access:admin"],
361 ["remove_collaborator", "access:admin"],
362 ["revoke_repo_invitation", "access:admin"],
363 ["set_base_permission", "access:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar364 ["set_team_repo", "access:admin"],
365 ["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 step366 ["list_webhooks", "webhooks:read"],
367 ["list_webhook_deliveries", "webhooks:read"],
368 ["create_webhook", "webhooks:admin"],
369 ["update_webhook", "webhooks:admin"],
370 ["delete_webhook", "webhooks:admin"],
371 ["ping_webhook", "webhooks:admin"],
372 ["redeliver_webhook", "webhooks:admin"],
373 ["list_actions_secrets", "secrets:read"],
374 ["list_actions_variables", "secrets:read"],
375 ["set_actions_secret", "secrets:admin"],
376 ["delete_actions_secret", "secrets:admin"],
377 ["set_actions_variable", "secrets:admin"],
378 ["delete_actions_variable", "secrets:admin"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents379 // Self-hosted runners.
380 ["list_runners", "runners:read"],
381 ["list_runner_groups", "runners:read"],
382 ["get_runner_settings", "runners:read"],
383 ["create_runner_registration_token", "runners:admin"],
384 ["remove_runner", "runners:admin"],
385 ["create_runner_group", "runners:admin"],
386 ["update_runner_group", "runners:admin"],
387 ["delete_runner_group", "runners:admin"],
388 ["update_runner_settings", "runners:admin"],
AI Gateway: your own code calls models with a workspace token389 // The AI Gateway. Sending a request to a model needs `models:write`,
390 // checked by the model proxy at models.g1t.sh.
391 ["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 step392] as const;
393
394/**
395 * The scopes a token or grant holds, as stored: null for full access, or
396 * the list. `legacy` marks a token made before scopes, which has full
397 * access until someone narrows it.
398 */
399export type TokenScopes = {
400 scopes: Scope[] | null;
401 legacy: boolean;
402};
403
404/**
405 * How settings group scopes into a checklist: each group's scopes, least
406 * first. Admin scopes are not here; they are under "Dangerous" on their
407 * own (see `DANGEROUS_SCOPES`). Every other scope is in exactly one group.
408 */
409export const SCOPE_GROUPS: { id: string; label: string; scopes: Scope[] }[] = [
410 { 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 bar411 { 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 member412 { 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 step413 { id: "work", label: "Issues & pull requests", scopes: ["issues:read", "issues:write", "pull_requests:read", "pull_requests:write"] },
414 { id: "agents", label: "Agents", scopes: ["agents:run"] },
415 { id: "workflows", label: "Workflows", scopes: ["workflows:read", "workflows:write"] },
416 { id: "memory", label: "Memory & search", scopes: ["memory:read", "memory:write"] },
417 { id: "account", label: "Account", scopes: ["account:read", "account:write"] },
API: notifications over REST and MCP, with notifications scopes418 { 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 step419 { id: "workspace", label: "Workspace", scopes: ["workspace:read", "access:read", "webhooks:read", "secrets:read"] },
Usage, Billing settings and prepaid AI credit; fixes from the UX audit420 { id: "billing", label: "Billing", scopes: ["billing:read", "billing:write"] },
Fast pages, required checks on the branch, self-hosted runners, honest incidents421 { id: "runners", label: "Runners", scopes: ["runners:read"] },
AI Gateway: your own code calls models with a workspace token422 { 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 step423];
424
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member425/** 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 step426export 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.