Skip to content
609 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 *
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers6 * A token's permissions are its scopes read per resource: each resource
7 * at none or one level, such as issues: write. What a request may do is
8 * the intersection of the owner's role, the token's reach (the workspace
9 * it is made for, and its repositories) and its permissions.
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step10 */
11
12export type ScopeResource =
13 | "repo"
14 | "code"
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar15 | "security"
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member16 | "packages"
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step17 | "issues"
18 | "pull_requests"
19 | "agents"
20 | "workflows"
Token reach: workflow_files scope, fine-grained reach, workspace token cap21 | "workflow_files"
Merge checks: statuses and check runs on every commit22 | "checks"
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9723 | "deployments"
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step24 | "memory"
25 | "account"
API: notifications over REST and MCP, with notifications scopes26 | "notifications"
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step27 | "workspace"
Usage, Billing settings and prepaid AI credit; fixes from the UX audit28 | "billing"
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step29 | "access"
30 | "webhooks"
Fast pages, required checks on the branch, self-hosted runners, honest incidents31 | "secrets"
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens32 | "runners"
33 | "models";
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step34
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member35export 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 step36
37/** Every scope, grouped by resource, least first. */
38export const SCOPES = [
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9739 { scope: "repo:read", description: "See repositories, their settings, labels, timelines, releases, languages, contributors and security alerts, and search" },
40 { 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 merge41 { 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 step42 { scope: "code:read", description: "Clone and fetch private repositories with git" },
43 { scope: "code:write", description: "Push commits with git" },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar44 { scope: "security:read", description: "See secret scanning, code scanning and vulnerability alerts, custom patterns, the dependency graph and SBOM, and security settings" },
45 { 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 member46 { scope: "packages:read", description: "Pull container images and install private packages" },
47 { scope: "packages:write", description: "Push container images and publish packages" },
Merge packages: roles, Actions access, source label, soft delete, API48 { scope: "packages:delete", description: "Delete and restore packages and their versions" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step49 { scope: "issues:read", description: "Read issues, comments and plans" },
50 { scope: "issues:write", description: "Open, edit, close and comment on issues" },
51 { scope: "pull_requests:read", description: "Read pull requests, their changes, sessions and merge queues" },
52 { scope: "pull_requests:write", description: "Open, review, close and merge pull requests" },
53 { scope: "agents:run", description: "Put g1t agents to work and message them, which uses the workspace's money" },
54 { scope: "workflows:read", description: "Read workflows, runs and logs" },
55 { scope: "workflows:write", description: "Run, cancel, rerun and turn workflows on or off" },
Token reach: workflow_files scope, fine-grained reach, workspace token cap56 { scope: "workflow_files:write", description: "Add, change and delete workflow files under .g1t/workflows and .github/workflows, with git or the API" },
Merge checks: statuses and check runs on every commit57 { scope: "checks:read", description: "Read commits' statuses, check runs, check suites and annotations" },
58 { scope: "checks:write", description: "Report statuses and check runs on commits, and ask for checks to run again" },
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9759 { scope: "deployments:read", description: "See deployments, their statuses and environments" },
60 { scope: "deployments:write", description: "Report deployments and their statuses, from any CI" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step61 { scope: "memory:read", description: "Recall memory and search the workspace's context" },
62 { scope: "memory:write", description: "Save memory for the next agent" },
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9763 { scope: "account:read", description: "Read your email addresses, invites, invitations, pinned projects and stars" },
64 { 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 scopes65 { scope: "notifications:read", description: "See your inbox, its threads, and what you subscribe to and watch" },
66 { 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 merge67 { scope: "workspace:read", description: "Read workspace settings, invites, integrations, model routes, teams and rulesets" },
68 { 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 audit69 { scope: "billing:read", description: "See a workspace's usage, budget, AI credit and invoices" },
70 { 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 step71 { 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 bar72 { 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 step73 { scope: "webhooks:read", description: "See webhooks and their deliveries" },
74 { scope: "webhooks:admin", description: "Create, change and delete webhooks" },
75 { scope: "secrets:read", description: "List secrets (never their values) and read variables" },
76 { scope: "secrets:admin", description: "Set and delete secrets and variables" },
Fast pages, required checks on the branch, self-hosted runners, honest incidents77 { scope: "runners:read", description: "See self-hosted runners, their groups and where agents run" },
78 { 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 tokens79 { scope: "models:read", description: "See the workspace's AI Gateway requests: their models, tokens, cost and status" },
80 { 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 step81] as const;
82
83export type Scope = (typeof SCOPES)[number]["scope"];
84
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers85/** Where a resource sits on the token form; only a person's token may hold account ones. */
86export type ResourceGroup = "repository" | "workspace" | "account";
87
88/** Resources in the order settings show them, with their names for people and their group. */
89export const SCOPE_RESOURCES: { resource: ScopeResource; label: string; group: ResourceGroup }[] = [
90 { resource: "repo", label: "Repositories", group: "repository" },
91 { resource: "code", label: "Code", group: "repository" },
92 { resource: "security", label: "Security", group: "repository" },
93 { resource: "packages", label: "Packages", group: "repository" },
94 { resource: "issues", label: "Issues", group: "repository" },
95 { resource: "pull_requests", label: "Pull requests", group: "repository" },
96 { resource: "agents", label: "g1t agents", group: "repository" },
97 { resource: "workflows", label: "Workflows", group: "repository" },
98 { resource: "workflow_files", label: "Workflow files", group: "repository" },
99 { resource: "checks", label: "Checks and statuses", group: "repository" },
100 { resource: "deployments", label: "Deployments", group: "repository" },
101 { resource: "memory", label: "Memory and context", group: "repository" },
102 { resource: "account", label: "Your account", group: "account" },
103 { resource: "notifications", label: "Notifications", group: "account" },
104 { resource: "workspace", label: "Workspaces", group: "workspace" },
105 { resource: "billing", label: "Billing", group: "workspace" },
106 { resource: "access", label: "Who has access", group: "repository" },
107 { resource: "webhooks", label: "Webhooks", group: "repository" },
108 { resource: "secrets", label: "Secrets and variables", group: "repository" },
109 { resource: "runners", label: "Self-hosted runners", group: "workspace" },
110 { resource: "models", label: "AI Gateway", group: "workspace" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step111];
112
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member113const 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 step114
115export function scopeResource(scope: Scope): ScopeResource {
116 return scope.split(":")[0] as ScopeResource;
117}
118
119export function scopeLevel(scope: Scope): ScopeLevel {
120 return scope.split(":")[1] as ScopeLevel;
121}
122
123export function isScope(text: string): text is Scope {
124 return SCOPES.some((row) => row.scope === text);
125}
126
127/** Changes that are hard to undo, or decide who can reach what. */
128export function isDangerous(scope: Scope): boolean {
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member129 const level = scopeLevel(scope);
130 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 step131}
132
133export function describeScope(scope: Scope): string {
134 return SCOPES.find((row) => row.scope === scope)?.description ?? scope;
135}
136
137/** Whether holding `held` gives `needed`: the same resource, at its level or lower. */
138export function scopeIncludes(held: Scope, needed: Scope): boolean {
139 return (
140 scopeResource(held) === scopeResource(needed) &&
141 LEVEL_ORDER[scopeLevel(held)] >= LEVEL_ORDER[scopeLevel(needed)]
142 );
143}
144
145/** The levels a resource has, least first. */
146export function levelsOf(resource: ScopeResource): ScopeLevel[] {
147 return SCOPES.filter((row) => scopeResource(row.scope) === resource).map((row) => scopeLevel(row.scope));
148}
149
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers150/** The token form's groups, in order. */
151export const RESOURCE_GROUPS: { group: ResourceGroup; label: string; about: string }[] = [
152 { group: "repository", label: "Repository permissions", about: "What it may do in the repositories it reaches." },
153 { group: "workspace", label: "Workspace permissions", about: "What it may do with the workspaces it reaches themselves." },
154 { group: "account", label: "Account permissions", about: "What it may do with your own account. Personal tokens only." },
155];
156
157/** A token's permissions: each resource held, at its highest level; left out is none. */
158export type Permissions = Partial<Record<ScopeResource, ScopeLevel>>;
159
160/** Scopes as permissions. Null scopes (full access) are every resource at its highest. */
161export function permissionsOf(scopes: readonly string[] | null): Permissions {
162 const permissions: Permissions = {};
163 const held = scopes === null ? SCOPES.map((row) => row.scope) : parseScopes(scopes.join(" "));
164 for (const scope of held) {
165 const resource = scopeResource(scope);
166 const now = permissions[resource];
167 if (!now || LEVEL_ORDER[scopeLevel(scope)] > LEVEL_ORDER[now]) permissions[resource] = scopeLevel(scope);
168 }
169 return permissions;
170}
171
172/** Permissions as the scopes a token stores: the highest of each resource, in table order. */
173export function scopesOfPermissions(permissions: Permissions): Scope[] {
174 const wanted = new Set(
175 Object.entries(permissions)
176 .filter(([, level]) => level)
177 .map(([resource, level]) => `${resource}:${level}`),
178 );
179 return SCOPES.map((row) => row.scope).filter((scope) => wanted.has(scope));
180}
181
182/** The longest a token with an expiry may last, in days. */
183export const MAX_TOKEN_LIFETIME_DAYS = 366;
184
185/** The most repositories a token may select. */
186export const MAX_SELECTED_REPOSITORIES = 50;
187
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step188/** Scopes from text separated by spaces or commas, in table order; unknown ones are left out. */
189export function parseScopes(text: string): Scope[] {
190 const given = new Set(text.split(/[\s,]+/).map((part) => part.trim().toLowerCase()));
191 return SCOPES.map((row) => row.scope).filter((scope) => given.has(scope));
192}
193
194/** What a token stores for full access. */
195export const FULL_ACCESS = "*";
196
197export type PresetId = "read_only" | "agent" | "ci" | "full";
198
199/** Starting points for choosing scopes. `*` is full access. */
200export const PRESET_SCOPES = {
201 read_only: [
Merge checks: statuses and check runs on every commit202 "repo:read", "code:read", "security:read", "packages:read", "issues:read", "pull_requests:read", "workflows:read", "checks:read", "deployments: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 step203 ] as const,
204 agent: [
Merge checks: statuses and check runs on every commit205 "repo:read", "code:read", "code:write", "security:read", "packages:read", "issues:read", "issues:write", "pull_requests:read", "pull_requests:write", "agents:run", "workflows:read", "checks:read", "deployments: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 step206 ] as const,
207 ci: [
Merge checks: statuses and check runs on every commit208 "repo:read", "code:read", "code:write", "packages:read", "packages:write", "workflows:read", "workflows:write", "checks:read", "checks:write", "deployments:read", "deployments:write",
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step209 ] as const,
210 full: [
211 "*",
212 ] as const,
213};
214
215export const PRESETS: { id: PresetId; label: string; description: string }[] = [
216 { id: "read_only", label: "Read only", description: "Read everything you can read; change nothing." },
217 { id: "agent", label: "Agent", description: "Read everything, work on issues and pull requests, push code and run g1t agents." },
Merge checks: statuses and check runs on every commit218 { id: "ci", label: "CI", description: "Clone and push code, push and pull packages, run workflows, and report checks and deployments." },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step219 { id: "full", label: "Full access", description: "Everything you can do, including deleting repositories and changing who has access." },
220];
221
222/** The scopes of a preset, or null for full access. */
223export function presetScopes(id: PresetId): Scope[] | null {
224 if (id === "full") return null;
225 return [...PRESET_SCOPES[id]] as Scope[];
226}
227
228/** What an OAuth client gets when it asks for nothing in particular. */
229export const OAUTH_DEFAULT_SCOPES: Scope[] = [...PRESET_SCOPES.agent];
230
231/** The operation each scope gates, by the API's operation names. */
232export const OPERATION_SCOPES = [
233 ["list_emails", "account:read"],
234 ["add_email", "account:write"],
Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036)235 ["confirm_email", "account:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step236 ["remove_email", "account:write"],
237 ["update_email_settings", "account:write"],
238 ["list_invites", "account:read"],
239 ["create_invite", "account:write"],
240 ["revoke_invite", "account:write"],
Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)241 ["list_invitations", "account:read"],
242 ["accept_invitation", "account:write"],
243 ["decline_invitation", "account:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step244 ["list_my_repo_invitations", "account:read"],
245 ["accept_repo_invitation", "account:write"],
246 ["decline_repo_invitation", "account:write"],
API: pinned projects over REST and MCP247 // Your pinned projects: a preference of your account.
248 ["list_pinned_projects", "account:read"],
249 ["pin_project", "account:write"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97250 // Your stars: a preference of your account.
251 ["list_starred", "account:read"],
252 ["check_starred", "account:read"],
253 ["star_repo", "account:write"],
254 ["unstar_repo", "account:write"],
API: pinned projects over REST and MCP255 ["unpin_project", "account:write"],
256 ["reorder_pinned_projects", "account:write"],
API: notifications over REST and MCP, with notifications scopes257 // Your inbox: notifications, subscriptions and watching.
258 ["list_notifications", "notifications:read"],
259 ["get_notification_thread", "notifications:read"],
260 ["get_thread_subscription", "notifications:read"],
261 ["get_repo_subscription", "notifications:read"],
262 ["list_watched_repos", "notifications:read"],
263 ["mark_notifications_read", "notifications:write"],
264 ["mark_thread_read", "notifications:write"],
265 ["mark_thread_done", "notifications:write"],
266 ["save_thread", "notifications:write"],
267 ["snooze_thread", "notifications:write"],
268 ["set_thread_subscription", "notifications:write"],
269 ["delete_thread_subscription", "notifications:write"],
270 ["set_repo_subscription", "notifications:write"],
271 ["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 step272 ["create_workspace", "workspace:admin"],
273 ["delete_workspace", "workspace:admin"],
Merge branch 'worktree-agent-ad7c6d88d93adc817'274 ["get_workspace", "workspace:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily275 ["update_workspace", "workspace:admin"],
Merge main (membership, two-factor, GitHub repo roles) into tokens276 ["list_members", "workspace:read"],
277 ["update_member", "workspace:admin"],
278 ["remove_member", "workspace:admin"],
279 ["transfer_ownership", "workspace:admin"],
280 ["leave_workspace", "account:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step281 ["list_workspace_invites", "workspace:read"],
282 ["invite_member", "workspace:admin"],
283 ["revoke_workspace_invite", "workspace:admin"],
284 ["list_integrations", "workspace:read"],
285 ["connect_integration", "workspace:admin"],
AI Gateway: OpenAI's format, open models, and your own providers286 ["update_integration", "workspace:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step287 ["disconnect_integration", "workspace:admin"],
288 ["test_integration", "workspace:admin"],
289 ["get_model_routes", "workspace:read"],
290 ["set_model_routes", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar291 ["list_teams", "workspace:read"],
292 ["get_team", "workspace:read"],
293 ["list_team_members", "workspace:read"],
294 ["list_child_teams", "workspace:read"],
295 ["list_team_repos", "workspace:read"],
296 ["list_user_teams", "workspace:read"],
297 ["create_team", "workspace:admin"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge298 ["list_workspace_rulesets", "workspace:read"],
299 ["get_workspace_ruleset", "workspace:read"],
300 ["list_workspace_rule_evaluations", "workspace:read"],
301 ["create_workspace_ruleset", "workspace:admin"],
302 ["update_workspace_ruleset", "workspace:admin"],
303 ["delete_workspace_ruleset", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar304 ["update_team", "workspace:admin"],
305 ["delete_team", "workspace:admin"],
306 ["set_team_member", "workspace:admin"],
307 ["remove_team_member", "workspace:admin"],
308 ["set_team_review_assignment", "workspace:admin"],
Usage, Billing settings and prepaid AI credit; fixes from the UX audit309 // A workspace's billing: usage, budget, AI credit and invoices.
310 ["get_usage", "billing:read"],
311 ["get_budget", "billing:read"],
312 ["get_ai_credit", "billing:read"],
313 ["list_invoices", "billing:read"],
314 ["get_billing_details", "billing:read"],
315 ["set_budget", "billing:write"],
316 ["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 step317 ["list_repos", "repo:read"],
318 ["get_repo", "repo:read"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97319 // Projects follow their repositories.
320 ["list_projects", "repo:read"],
321 ["get_project", "repo:read"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step322 ["search", "repo:read"],
323 ["list_events", "repo:read"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97324 // What the default branch says about a repository, who starred it, and
325 // its releases.
326 ["get_languages", "repo:read"],
327 ["list_contributors", "repo:read"],
328 ["get_license", "repo:read"],
329 ["list_stargazers", "repo:read"],
330 ["list_releases", "repo:read"],
331 ["get_latest_release", "repo:read"],
332 ["get_release_by_tag", "repo:read"],
333 ["get_release", "repo:read"],
334 ["create_release", "repo:write"],
335 ["update_release", "repo:write"],
336 ["delete_release", "repo:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step337 ["list_labels", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar338 ["list_milestones", "repo:read"],
339 ["get_milestone", "repo:read"],
340 ["create_label", "issues:write"],
341 ["update_label", "issues:write"],
342 ["delete_label", "issues:write"],
343 ["add_default_labels", "issues:write"],
344 ["create_milestone", "issues:write"],
345 ["update_milestone", "issues:write"],
346 ["delete_milestone", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step347 ["get_repo_settings", "repo:read"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents348 ["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 step349 ["list_deleted_repos", "repo:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily350 ["list_security_alerts", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar351 ["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 step352 ["create_repo", "repo:write"],
353 ["update_repo", "repo:write"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97354 ["update_project", "repo:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step355 ["update_repo_settings", "repo:write"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge356 ["list_repo_rulesets", "repo:read"],
357 ["get_repo_ruleset", "repo:read"],
358 ["get_branch_rules", "repo:read"],
359 ["list_rule_evaluations", "repo:read"],
360 ["create_repo_ruleset", "repo:admin"],
361 ["update_repo_ruleset", "repo:admin"],
362 ["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 step363 ["rename_branch", "repo:write"],
364 ["rename_repo", "repo:admin"],
365 ["transfer_repo", "repo:admin"],
366 ["archive_repo", "repo:admin"],
367 ["unarchive_repo", "repo:admin"],
368 ["set_repo_visibility", "repo:admin"],
369 ["delete_repo", "repo:admin"],
370 ["restore_repo", "repo:admin"],
371 ["purge_repo", "repo:admin"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily372 ["dismiss_security_alert", "repo:admin"],
373 ["reopen_security_alert", "repo:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar374 // The security suite.
375 ["list_secret_scanning_alerts", "security:read"],
376 ["get_secret_scanning_alert", "security:read"],
377 ["list_secret_scanning_locations", "security:read"],
378 ["list_bypass_requests", "security:read"],
379 ["list_custom_patterns", "security:read"],
380 ["list_code_scanning_alerts", "security:read"],
381 ["get_code_scanning_alert", "security:read"],
382 ["list_code_scanning_analyses", "security:read"],
383 ["get_sarif_upload", "security:read"],
384 ["list_vulnerability_alerts", "security:read"],
385 ["get_vulnerability_alert", "security:read"],
386 ["get_dependency_graph", "security:read"],
387 ["get_sbom", "security:read"],
388 ["compare_dependencies", "security:read"],
389 ["get_security_settings", "security:read"],
390 ["get_workspace_security_settings", "security:read"],
391 ["get_security_overview", "security:read"],
392 ["update_secret_scanning_alert", "security:write"],
393 ["bypass_push_protection", "security:write"],
394 ["check_secret_validity", "security:write"],
395 ["review_bypass_request", "security:write"],
396 ["create_custom_pattern", "security:write"],
397 ["update_custom_pattern", "security:write"],
398 ["delete_custom_pattern", "security:write"],
399 ["dry_run_custom_pattern", "security:write"],
400 ["update_code_scanning_alert", "security:write"],
401 ["upload_sarif", "security:write"],
402 ["update_vulnerability_alert", "security:write"],
403 ["fix_security_alert", "security:write"],
404 ["update_security_settings", "security:write"],
405 ["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 step406 ["list_issues", "issues:read"],
407 ["get_issue", "issues:read"],
408 ["get_plan", "issues:read"],
409 ["create_issue", "issues:write"],
410 ["update_issue", "issues:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar411 ["list_issue_labels", "issues:read"],
412 ["add_issue_labels", "issues:write"],
413 ["set_issue_labels", "issues:write"],
414 ["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 step415 ["close_issue", "issues:write"],
416 ["reopen_issue", "issues:write"],
417 ["add_comment", "issues:write"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts418 ["edit_comment", "issues:write"],
419 ["delete_comment", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step420 ["import_issue", "issues:write"],
421 ["apply_plan", "issues:write"],
422 ["list_pull_requests", "pull_requests:read"],
423 ["get_pull_request", "pull_requests:read"],
424 ["get_pull_request_changes", "pull_requests:read"],
425 ["read_session", "pull_requests:read"],
426 ["get_merge_queue", "pull_requests:read"],
427 ["create_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar428 ["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 step429 ["record_session", "pull_requests:write"],
430 ["mark_pull_request_ready", "pull_requests:write"],
431 ["close_pull_request", "pull_requests:write"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts432 ["reopen_pull_request", "pull_requests:write"],
433 ["convert_pull_request_to_draft", "pull_requests:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step434 ["review_pull_request", "pull_requests:write"],
435 ["merge_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar436 ["request_reviewers", "pull_requests:write"],
437 ["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 step438 ["assign_issue", "agents:run"],
439 ["delegate", "agents:run"],
440 ["plan_work", "agents:run"],
441 ["message_agent", "agents:run"],
442 ["answer_message", "agents:run"],
443 ["take_messages", "agents:run"],
444 ["list_workflows", "workflows:read"],
445 ["list_workflow_runs", "workflows:read"],
446 ["get_workflow_run", "workflows:read"],
447 ["get_job_logs", "workflows:read"],
448 ["dispatch_workflow", "workflows:write"],
449 ["cancel_workflow_run", "workflows:write"],
450 ["rerun_workflow_run", "workflows:write"],
451 ["update_workflow", "workflows:write"],
Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2452 ["list_artifacts", "workflows:read"],
453 ["list_workflow_run_artifacts", "workflows:read"],
454 ["get_artifact", "workflows:read"],
455 ["download_artifact", "workflows:read"],
456 ["get_artifact_retention", "workflows:read"],
457 ["delete_artifact", "workflows:write"],
458 ["set_artifact_retention", "workflows:write"],
Merge checks: statuses and check runs on every commit459 ["list_commit_statuses", "checks:read"],
460 ["get_combined_status", "checks:read"],
461 ["list_check_runs_for_ref", "checks:read"],
462 ["get_check_run", "checks:read"],
463 ["list_check_run_annotations", "checks:read"],
464 ["list_check_suites_for_ref", "checks:read"],
465 ["get_check_suite", "checks:read"],
466 ["create_commit_status", "checks:write"],
467 ["create_check_run", "checks:write"],
468 ["update_check_run", "checks:write"],
469 ["rerequest_check_run", "checks:write"],
470 ["rerequest_check_suite", "checks:write"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97471 // Deployments, wherever they run: reading them, and reporting them.
472 ["list_deployments", "deployments:read"],
473 ["get_deployment", "deployments:read"],
474 ["list_deployment_statuses", "deployments:read"],
475 ["list_environments", "deployments:read"],
476 ["get_environment", "deployments:read"],
477 ["create_deployment", "deployments:write"],
478 ["create_deployment_status", "deployments:write"],
Merge branch 'worktree-agent-a3abfcce648e87dca'479 // What keeps runs safe: the runs environments hold and reviewing them,
480 // approving a pull request's run, and a repository's own rules for its
481 // environments and tokens, which are an admin's.
482 ["get_pending_deployments", "workflows:read"],
483 ["review_pending_deployments", "workflows:write"],
484 ["approve_workflow_run", "workflows:write"],
485 ["get_workflow_permissions", "repo:read"],
486 ["get_fork_pr_approval", "repo:read"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts487 ["get_actions_access", "repo:read"],
Merge branch 'worktree-agent-a3abfcce648e87dca'488 ["update_environment", "repo:admin"],
489 ["delete_environment", "repo:admin"],
490 ["set_workflow_permissions", "repo:admin"],
491 ["set_fork_pr_approval", "repo:admin"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts492 ["set_actions_access", "repo:admin"],
Merge branch 'worktree-agent-a3abfcce648e87dca'493 // Starting workflows from outside, as a push would.
494 ["create_repository_dispatch", "code:write"],
495 // A workspace's policy for its repositories' tokens.
496 ["get_workspace_workflow_permissions", "workspace:read"],
497 ["set_workspace_workflow_permissions", "workspace:admin"],
API and MCP for a workspace's personal access token rules, members' tokens and approvals498 // A workspace's rules for personal access tokens, and its members' tokens.
499 ["get_token_policy", "workspace:read"],
500 ["set_token_policy", "workspace:admin"],
501 ["list_member_tokens", "access:read"],
502 ["list_token_requests", "access:read"],
503 ["review_token_request", "access:admin"],
504 ["revoke_member_token", "access:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step505 ["recall", "memory:read"],
506 ["search_context", "memory:read"],
507 ["get_entity", "memory:read"],
508 ["get_context", "memory:read"],
509 ["remember", "memory:write"],
510 ["list_collaborators", "access:read"],
511 ["get_collaborator_permission", "access:read"],
512 ["list_repo_invitations", "access:read"],
513 ["list_outside_collaborators", "access:read"],
514 ["add_collaborator", "access:admin"],
515 ["update_collaborator", "access:admin"],
516 ["remove_collaborator", "access:admin"],
517 ["revoke_repo_invitation", "access:admin"],
518 ["set_base_permission", "access:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar519 ["set_team_repo", "access:admin"],
520 ["remove_team_repo", "access:admin"],
Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca521 ["list_deploy_keys", "access:read"],
522 ["get_deploy_key", "access:read"],
523 ["create_deploy_key", "access:admin"],
524 ["delete_deploy_key", "access:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step525 ["list_webhooks", "webhooks:read"],
526 ["list_webhook_deliveries", "webhooks:read"],
527 ["create_webhook", "webhooks:admin"],
528 ["update_webhook", "webhooks:admin"],
529 ["delete_webhook", "webhooks:admin"],
530 ["ping_webhook", "webhooks:admin"],
531 ["redeliver_webhook", "webhooks:admin"],
532 ["list_actions_secrets", "secrets:read"],
533 ["list_actions_variables", "secrets:read"],
534 ["set_actions_secret", "secrets:admin"],
535 ["delete_actions_secret", "secrets:admin"],
536 ["set_actions_variable", "secrets:admin"],
537 ["delete_actions_variable", "secrets:admin"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents538 // Self-hosted runners.
539 ["list_runners", "runners:read"],
540 ["list_runner_groups", "runners:read"],
541 ["get_runner_settings", "runners:read"],
542 ["create_runner_registration_token", "runners:admin"],
543 ["remove_runner", "runners:admin"],
544 ["create_runner_group", "runners:admin"],
545 ["update_runner_group", "runners:admin"],
546 ["delete_runner_group", "runners:admin"],
547 ["update_runner_settings", "runners:admin"],
Merge packages: roles, Actions access, source label, soft delete, API548 // Packages: reading them, their versions and who may use them needs
549 // `packages:read`; changing their settings, access and Manage Actions
550 // access `packages:write` (and the Admin role on the package, which the
551 // packages service checks); deleting and restoring packages and
552 // versions `packages:delete`, as the registries' own deletes do.
553 ["list_packages", "packages:read"],
554 ["get_package", "packages:read"],
555 ["list_package_versions", "packages:read"],
556 ["get_package_version", "packages:read"],
557 ["list_package_access", "packages:read"],
558 ["list_package_actions_access", "packages:read"],
559 ["update_package", "packages:write"],
560 ["link_package", "packages:write"],
561 ["unlink_package", "packages:write"],
562 ["set_package_access", "packages:write"],
563 ["remove_package_access", "packages:write"],
564 ["set_package_actions_access", "packages:write"],
565 ["remove_package_actions_access", "packages:write"],
566 ["delete_package", "packages:delete"],
567 ["restore_package", "packages:delete"],
568 ["delete_package_version", "packages:delete"],
569 ["restore_package_version", "packages:delete"],
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens570 // The AI Gateway. Sending a request to a model needs `models:write`,
571 // checked by the model proxy at models.g1t.sh.
572 ["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 step573] as const;
574
575/**
576 * The scopes a token or grant holds, as stored: null for full access, or
577 * the list. `legacy` marks a token made before scopes, which has full
578 * access until someone narrows it.
579 */
580export type TokenScopes = {
581 scopes: Scope[] | null;
582 legacy: boolean;
583};
584
585/**
586 * How settings group scopes into a checklist: each group's scopes, least
587 * first. Admin scopes are not here; they are under "Dangerous" on their
588 * own (see `DANGEROUS_SCOPES`). Every other scope is in exactly one group.
589 */
590export const SCOPE_GROUPS: { id: string; label: string; scopes: Scope[] }[] = [
591 { 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 bar592 { 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 member593 { 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 step594 { id: "work", label: "Issues & pull requests", scopes: ["issues:read", "issues:write", "pull_requests:read", "pull_requests:write"] },
595 { id: "agents", label: "Agents", scopes: ["agents:run"] },
Token reach: workflow_files scope, fine-grained reach, workspace token cap596 { id: "workflows", label: "Workflows", scopes: ["workflows:read", "workflows:write", "workflow_files:write"] },
Merge checks: statuses and check runs on every commit597 { id: "checks", label: "Checks", scopes: ["checks:read", "checks:write"] },
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97598 { id: "deployments", label: "Deployments", scopes: ["deployments:read", "deployments:write"] },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step599 { id: "memory", label: "Memory & search", scopes: ["memory:read", "memory:write"] },
600 { id: "account", label: "Account", scopes: ["account:read", "account:write"] },
API: notifications over REST and MCP, with notifications scopes601 { 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 step602 { id: "workspace", label: "Workspace", scopes: ["workspace:read", "access:read", "webhooks:read", "secrets:read"] },
Usage, Billing settings and prepaid AI credit; fixes from the UX audit603 { id: "billing", label: "Billing", scopes: ["billing:read", "billing:write"] },
Fast pages, required checks on the branch, self-hosted runners, honest incidents604 { id: "runners", label: "Runners", scopes: ["runners:read"] },
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens605 { 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 step606];
607
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member608/** 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 step609export 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.