Skip to content

g1t/packages/contracts/src/scopes.ts

443 lines21,412 bytesCodeBlame

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 = [
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" },
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" },
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 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"],
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"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge230 ["list_workspace_rulesets", "workspace:read"],
231 ["get_workspace_ruleset", "workspace:read"],
232 ["list_workspace_rule_evaluations", "workspace:read"],
233 ["create_workspace_ruleset", "workspace:admin"],
234 ["update_workspace_ruleset", "workspace:admin"],
235 ["delete_workspace_ruleset", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar236 ["update_team", "workspace:admin"],
237 ["delete_team", "workspace:admin"],
238 ["set_team_member", "workspace:admin"],
239 ["remove_team_member", "workspace:admin"],
240 ["set_team_review_assignment", "workspace:admin"],
Usage, Billing settings and prepaid AI credit; fixes from the UX audit241 // A workspace's billing: usage, budget, AI credit and invoices.
242 ["get_usage", "billing:read"],
243 ["get_budget", "billing:read"],
244 ["get_ai_credit", "billing:read"],
245 ["list_invoices", "billing:read"],
246 ["get_billing_details", "billing:read"],
247 ["set_budget", "billing:write"],
248 ["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 step249 ["list_repos", "repo:read"],
250 ["get_repo", "repo:read"],
Merge branch 'projects-kind-and-links'251 // Projects follow their repositories.
252 ["list_projects", "repo:read"],
253 ["get_project", "repo:read"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step254 ["search", "repo:read"],
255 ["list_events", "repo:read"],
256 ["list_labels", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar257 ["list_milestones", "repo:read"],
258 ["get_milestone", "repo:read"],
259 ["create_label", "issues:write"],
260 ["update_label", "issues:write"],
261 ["delete_label", "issues:write"],
262 ["add_default_labels", "issues:write"],
263 ["create_milestone", "issues:write"],
264 ["update_milestone", "issues:write"],
265 ["delete_milestone", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step266 ["get_repo_settings", "repo:read"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents267 ["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 step268 ["list_deleted_repos", "repo:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily269 ["list_security_alerts", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar270 ["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 step271 ["create_repo", "repo:write"],
272 ["update_repo", "repo:write"],
Merge branch 'projects-kind-and-links'273 ["update_project", "repo:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step274 ["update_repo_settings", "repo:write"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge275 ["list_repo_rulesets", "repo:read"],
276 ["get_repo_ruleset", "repo:read"],
277 ["get_branch_rules", "repo:read"],
278 ["list_rule_evaluations", "repo:read"],
279 ["create_repo_ruleset", "repo:admin"],
280 ["update_repo_ruleset", "repo:admin"],
281 ["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 step282 ["rename_branch", "repo:write"],
283 ["rename_repo", "repo:admin"],
284 ["transfer_repo", "repo:admin"],
285 ["archive_repo", "repo:admin"],
286 ["unarchive_repo", "repo:admin"],
287 ["set_repo_visibility", "repo:admin"],
288 ["delete_repo", "repo:admin"],
289 ["restore_repo", "repo:admin"],
290 ["purge_repo", "repo:admin"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily291 ["dismiss_security_alert", "repo:admin"],
292 ["reopen_security_alert", "repo:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar293 // The security suite.
294 ["list_secret_scanning_alerts", "security:read"],
295 ["get_secret_scanning_alert", "security:read"],
296 ["list_secret_scanning_locations", "security:read"],
297 ["list_bypass_requests", "security:read"],
298 ["list_custom_patterns", "security:read"],
299 ["list_code_scanning_alerts", "security:read"],
300 ["get_code_scanning_alert", "security:read"],
301 ["list_code_scanning_analyses", "security:read"],
302 ["get_sarif_upload", "security:read"],
303 ["list_vulnerability_alerts", "security:read"],
304 ["get_vulnerability_alert", "security:read"],
305 ["get_dependency_graph", "security:read"],
306 ["get_sbom", "security:read"],
307 ["compare_dependencies", "security:read"],
308 ["get_security_settings", "security:read"],
309 ["get_workspace_security_settings", "security:read"],
310 ["get_security_overview", "security:read"],
311 ["update_secret_scanning_alert", "security:write"],
312 ["bypass_push_protection", "security:write"],
313 ["check_secret_validity", "security:write"],
314 ["review_bypass_request", "security:write"],
315 ["create_custom_pattern", "security:write"],
316 ["update_custom_pattern", "security:write"],
317 ["delete_custom_pattern", "security:write"],
318 ["dry_run_custom_pattern", "security:write"],
319 ["update_code_scanning_alert", "security:write"],
320 ["upload_sarif", "security:write"],
321 ["update_vulnerability_alert", "security:write"],
322 ["fix_security_alert", "security:write"],
323 ["update_security_settings", "security:write"],
324 ["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 step325 ["list_issues", "issues:read"],
326 ["get_issue", "issues:read"],
327 ["get_plan", "issues:read"],
328 ["create_issue", "issues:write"],
329 ["update_issue", "issues:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar330 ["list_issue_labels", "issues:read"],
331 ["add_issue_labels", "issues:write"],
332 ["set_issue_labels", "issues:write"],
333 ["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 step334 ["close_issue", "issues:write"],
335 ["reopen_issue", "issues:write"],
336 ["add_comment", "issues:write"],
337 ["import_issue", "issues:write"],
338 ["apply_plan", "issues:write"],
339 ["list_pull_requests", "pull_requests:read"],
340 ["get_pull_request", "pull_requests:read"],
341 ["get_pull_request_changes", "pull_requests:read"],
342 ["read_session", "pull_requests:read"],
343 ["get_merge_queue", "pull_requests:read"],
344 ["create_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar345 ["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 step346 ["record_session", "pull_requests:write"],
347 ["mark_pull_request_ready", "pull_requests:write"],
348 ["close_pull_request", "pull_requests:write"],
349 ["review_pull_request", "pull_requests:write"],
350 ["merge_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar351 ["request_reviewers", "pull_requests:write"],
352 ["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 step353 ["assign_issue", "agents:run"],
354 ["delegate", "agents:run"],
355 ["plan_work", "agents:run"],
356 ["message_agent", "agents:run"],
357 ["answer_message", "agents:run"],
358 ["take_messages", "agents:run"],
359 ["list_workflows", "workflows:read"],
360 ["list_workflow_runs", "workflows:read"],
361 ["get_workflow_run", "workflows:read"],
362 ["get_job_logs", "workflows:read"],
363 ["dispatch_workflow", "workflows:write"],
364 ["cancel_workflow_run", "workflows:write"],
365 ["rerun_workflow_run", "workflows:write"],
366 ["update_workflow", "workflows:write"],
367 ["recall", "memory:read"],
368 ["search_context", "memory:read"],
369 ["get_entity", "memory:read"],
370 ["get_context", "memory:read"],
371 ["remember", "memory:write"],
372 ["list_collaborators", "access:read"],
373 ["get_collaborator_permission", "access:read"],
374 ["list_repo_invitations", "access:read"],
375 ["list_outside_collaborators", "access:read"],
376 ["add_collaborator", "access:admin"],
377 ["update_collaborator", "access:admin"],
378 ["remove_collaborator", "access:admin"],
379 ["revoke_repo_invitation", "access:admin"],
380 ["set_base_permission", "access:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar381 ["set_team_repo", "access:admin"],
382 ["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 step383 ["list_webhooks", "webhooks:read"],
384 ["list_webhook_deliveries", "webhooks:read"],
385 ["create_webhook", "webhooks:admin"],
386 ["update_webhook", "webhooks:admin"],
387 ["delete_webhook", "webhooks:admin"],
388 ["ping_webhook", "webhooks:admin"],
389 ["redeliver_webhook", "webhooks:admin"],
390 ["list_actions_secrets", "secrets:read"],
391 ["list_actions_variables", "secrets:read"],
392 ["set_actions_secret", "secrets:admin"],
393 ["delete_actions_secret", "secrets:admin"],
394 ["set_actions_variable", "secrets:admin"],
395 ["delete_actions_variable", "secrets:admin"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents396 // Self-hosted runners.
397 ["list_runners", "runners:read"],
398 ["list_runner_groups", "runners:read"],
399 ["get_runner_settings", "runners:read"],
400 ["create_runner_registration_token", "runners:admin"],
401 ["remove_runner", "runners:admin"],
402 ["create_runner_group", "runners:admin"],
403 ["update_runner_group", "runners:admin"],
404 ["delete_runner_group", "runners:admin"],
405 ["update_runner_settings", "runners:admin"],
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens406 // The AI Gateway. Sending a request to a model needs `models:write`,
407 // checked by the model proxy at models.g1t.sh.
408 ["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 step409] as const;
410
411/**
412 * The scopes a token or grant holds, as stored: null for full access, or
413 * the list. `legacy` marks a token made before scopes, which has full
414 * access until someone narrows it.
415 */
416export type TokenScopes = {
417 scopes: Scope[] | null;
418 legacy: boolean;
419};
420
421/**
422 * How settings group scopes into a checklist: each group's scopes, least
423 * first. Admin scopes are not here; they are under "Dangerous" on their
424 * own (see `DANGEROUS_SCOPES`). Every other scope is in exactly one group.
425 */
426export const SCOPE_GROUPS: { id: string; label: string; scopes: Scope[] }[] = [
427 { 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 bar428 { 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 member429 { 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 step430 { id: "work", label: "Issues & pull requests", scopes: ["issues:read", "issues:write", "pull_requests:read", "pull_requests:write"] },
431 { id: "agents", label: "Agents", scopes: ["agents:run"] },
432 { id: "workflows", label: "Workflows", scopes: ["workflows:read", "workflows:write"] },
433 { id: "memory", label: "Memory & search", scopes: ["memory:read", "memory:write"] },
434 { id: "account", label: "Account", scopes: ["account:read", "account:write"] },
API: notifications over REST and MCP, with notifications scopes435 { 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 step436 { id: "workspace", label: "Workspace", scopes: ["workspace:read", "access:read", "webhooks:read", "secrets:read"] },
Usage, Billing settings and prepaid AI credit; fixes from the UX audit437 { id: "billing", label: "Billing", scopes: ["billing:read", "billing:write"] },
Fast pages, required checks on the branch, self-hosted runners, honest incidents438 { id: "runners", label: "Runners", scopes: ["runners:read"] },
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens439 { 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 step440];
441
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member442/** 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 step443export 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.