Skip to content
665 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"
Artifacts contracts: folios, their four kinds, dashboard datasets, folio events and the artifacts scopes are typed and validated the same in TypeScript and Rust, with nothing using them yet33 | "models"
34 | "artifacts";
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step35
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member36export 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 step37
38/** Every scope, grouped by resource, least first. */
39export const SCOPES = [
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9740 { scope: "repo:read", description: "See repositories, their settings, labels, timelines, releases, languages, contributors and security alerts, and search" },
41 { 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 merge42 { 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 step43 { scope: "code:read", description: "Clone and fetch private repositories with git" },
44 { scope: "code:write", description: "Push commits with git" },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar45 { scope: "security:read", description: "See secret scanning, code scanning and vulnerability alerts, custom patterns, the dependency graph and SBOM, and security settings" },
46 { 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 member47 { scope: "packages:read", description: "Pull container images and install private packages" },
48 { scope: "packages:write", description: "Push container images and publish packages" },
Merge packages: roles, Actions access, source label, soft delete, API49 { 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 step50 { scope: "issues:read", description: "Read issues, comments and plans" },
51 { scope: "issues:write", description: "Open, edit, close and comment on issues" },
52 { scope: "pull_requests:read", description: "Read pull requests, their changes, sessions and merge queues" },
53 { scope: "pull_requests:write", description: "Open, review, close and merge pull requests" },
54 { scope: "agents:run", description: "Put g1t agents to work and message them, which uses the workspace's money" },
55 { scope: "workflows:read", description: "Read workflows, runs and logs" },
56 { scope: "workflows:write", description: "Run, cancel, rerun and turn workflows on or off" },
Token reach: workflow_files scope, fine-grained reach, workspace token cap57 { 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 commit58 { scope: "checks:read", description: "Read commits' statuses, check runs, check suites and annotations" },
59 { scope: "checks:write", description: "Report statuses and check runs on commits, and ask for checks to run again" },
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9760 { scope: "deployments:read", description: "See deployments, their statuses and environments" },
61 { 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 step62 { scope: "memory:read", description: "Recall memory and search the workspace's context" },
63 { scope: "memory:write", description: "Save memory for the next agent" },
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9764 { scope: "account:read", description: "Read your email addresses, invites, invitations, pinned projects and stars" },
65 { 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 scopes66 { scope: "notifications:read", description: "See your inbox, its threads, and what you subscribe to and watch" },
67 { 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 merge68 { scope: "workspace:read", description: "Read workspace settings, invites, integrations, model routes, teams and rulesets" },
69 { 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 audit70 { scope: "billing:read", description: "See a workspace's usage, budget, AI credit and invoices" },
71 { 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 step72 { 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 bar73 { 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 step74 { scope: "webhooks:read", description: "See webhooks and their deliveries" },
75 { scope: "webhooks:admin", description: "Create, change and delete webhooks" },
76 { scope: "secrets:read", description: "List secrets (never their values) and read variables" },
77 { scope: "secrets:admin", description: "Set and delete secrets and variables" },
Fast pages, required checks on the branch, self-hosted runners, honest incidents78 { scope: "runners:read", description: "See self-hosted runners, their groups and where agents run" },
79 { 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 tokens80 { scope: "models:read", description: "See the workspace's AI Gateway requests: their models, tokens, cost and status" },
81 { scope: "models:write", description: "Send model requests through the AI Gateway, which uses the workspace's AI credit" },
Merge main into Artifacts Phase 282 { scope: "artifacts:read", description: "List, read and search artifacts you can see, their versions, and the numbers their dashboards show" },
83 { scope: "artifacts:write", description: "Create, rename, move, edit, trash and restore artifacts, and propose changes to them" },
84 { scope: "artifacts:admin", description: "Share artifacts, change who can open them, and delete them for good" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step85] as const;
86
Artifacts contracts: folios, their four kinds, dashboard datasets, folio events and the artifacts scopes are typed and validated the same in TypeScript and Rust, with nothing using them yet87/**
88 * Scopes of resources being built that tokens are not offered yet (Rust:
89 * `Resource::offered`). They parse in Rust and are typed here, but no
90 * preset, full access, OAuth request or token form hands them out, and no
91 * operation needs them. When one ships, its rows move to the end of
Merge main into Artifacts Phase 292 * `SCOPES` and `SCOPE_RESOURCES`. Empty now: Artifacts shipped last.
Artifacts contracts: folios, their four kinds, dashboard datasets, folio events and the artifacts scopes are typed and validated the same in TypeScript and Rust, with nothing using them yet93 */
Merge main into Artifacts Phase 294export const UPCOMING_SCOPES: readonly { scope: Scope; description: string }[] = [
Artifacts contracts: folios, their four kinds, dashboard datasets, folio events and the artifacts scopes are typed and validated the same in TypeScript and Rust, with nothing using them yet95] as const;
96
Merge main into Artifacts Phase 297export type Scope = (typeof SCOPES)[number]["scope"];
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step98
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers99/** Where a resource sits on the token form; only a person's token may hold account ones. */
100export type ResourceGroup = "repository" | "workspace" | "account";
101
102/** Resources in the order settings show them, with their names for people and their group. */
103export const SCOPE_RESOURCES: { resource: ScopeResource; label: string; group: ResourceGroup }[] = [
104 { resource: "repo", label: "Repositories", group: "repository" },
105 { resource: "code", label: "Code", group: "repository" },
106 { resource: "security", label: "Security", group: "repository" },
107 { resource: "packages", label: "Packages", group: "repository" },
108 { resource: "issues", label: "Issues", group: "repository" },
109 { resource: "pull_requests", label: "Pull requests", group: "repository" },
110 { resource: "agents", label: "g1t agents", group: "repository" },
111 { resource: "workflows", label: "Workflows", group: "repository" },
112 { resource: "workflow_files", label: "Workflow files", group: "repository" },
113 { resource: "checks", label: "Checks and statuses", group: "repository" },
114 { resource: "deployments", label: "Deployments", group: "repository" },
115 { resource: "memory", label: "Memory and context", group: "repository" },
116 { resource: "account", label: "Your account", group: "account" },
117 { resource: "notifications", label: "Notifications", group: "account" },
118 { resource: "workspace", label: "Workspaces", group: "workspace" },
119 { resource: "billing", label: "Billing", group: "workspace" },
120 { resource: "access", label: "Who has access", group: "repository" },
121 { resource: "webhooks", label: "Webhooks", group: "repository" },
122 { resource: "secrets", label: "Secrets and variables", group: "repository" },
123 { resource: "runners", label: "Self-hosted runners", group: "workspace" },
124 { resource: "models", label: "AI Gateway", group: "workspace" },
Merge main into Artifacts Phase 2125 { resource: "artifacts", label: "Artifacts", group: "workspace" },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step126];
127
Artifacts contracts: folios, their four kinds, dashboard datasets, folio events and the artifacts scopes are typed and validated the same in TypeScript and Rust, with nothing using them yet128/** Resources not offered yet, as `UPCOMING_SCOPES`: settings never show them. */
129export const UPCOMING_RESOURCES: { resource: ScopeResource; label: string; group: ResourceGroup }[] = [
130];
131
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member132const 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 step133
134export function scopeResource(scope: Scope): ScopeResource {
135 return scope.split(":")[0] as ScopeResource;
136}
137
138export function scopeLevel(scope: Scope): ScopeLevel {
139 return scope.split(":")[1] as ScopeLevel;
140}
141
142export function isScope(text: string): text is Scope {
143 return SCOPES.some((row) => row.scope === text);
144}
145
146/** Changes that are hard to undo, or decide who can reach what. */
147export function isDangerous(scope: Scope): boolean {
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member148 const level = scopeLevel(scope);
149 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 step150}
151
152export function describeScope(scope: Scope): string {
Artifacts contracts: folios, their four kinds, dashboard datasets, folio events and the artifacts scopes are typed and validated the same in TypeScript and Rust, with nothing using them yet153 return [...SCOPES, ...UPCOMING_SCOPES].find((row) => row.scope === scope)?.description ?? scope;
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step154}
155
156/** Whether holding `held` gives `needed`: the same resource, at its level or lower. */
157export function scopeIncludes(held: Scope, needed: Scope): boolean {
158 return (
159 scopeResource(held) === scopeResource(needed) &&
160 LEVEL_ORDER[scopeLevel(held)] >= LEVEL_ORDER[scopeLevel(needed)]
161 );
162}
163
164/** The levels a resource has, least first. */
165export function levelsOf(resource: ScopeResource): ScopeLevel[] {
166 return SCOPES.filter((row) => scopeResource(row.scope) === resource).map((row) => scopeLevel(row.scope));
167}
168
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers169/** The token form's groups, in order. */
170export const RESOURCE_GROUPS: { group: ResourceGroup; label: string; about: string }[] = [
171 { group: "repository", label: "Repository permissions", about: "What it may do in the repositories it reaches." },
172 { group: "workspace", label: "Workspace permissions", about: "What it may do with the workspaces it reaches themselves." },
173 { group: "account", label: "Account permissions", about: "What it may do with your own account. Personal tokens only." },
174];
175
176/** A token's permissions: each resource held, at its highest level; left out is none. */
177export type Permissions = Partial<Record<ScopeResource, ScopeLevel>>;
178
179/** Scopes as permissions. Null scopes (full access) are every resource at its highest. */
180export function permissionsOf(scopes: readonly string[] | null): Permissions {
181 const permissions: Permissions = {};
182 const held = scopes === null ? SCOPES.map((row) => row.scope) : parseScopes(scopes.join(" "));
183 for (const scope of held) {
184 const resource = scopeResource(scope);
185 const now = permissions[resource];
186 if (!now || LEVEL_ORDER[scopeLevel(scope)] > LEVEL_ORDER[now]) permissions[resource] = scopeLevel(scope);
187 }
188 return permissions;
189}
190
191/** Permissions as the scopes a token stores: the highest of each resource, in table order. */
192export function scopesOfPermissions(permissions: Permissions): Scope[] {
193 const wanted = new Set(
194 Object.entries(permissions)
195 .filter(([, level]) => level)
196 .map(([resource, level]) => `${resource}:${level}`),
197 );
198 return SCOPES.map((row) => row.scope).filter((scope) => wanted.has(scope));
199}
200
201/** The longest a token with an expiry may last, in days. */
202export const MAX_TOKEN_LIFETIME_DAYS = 366;
203
204/** The most repositories a token may select. */
205export const MAX_SELECTED_REPOSITORIES = 50;
206
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step207/** Scopes from text separated by spaces or commas, in table order; unknown ones are left out. */
208export function parseScopes(text: string): Scope[] {
209 const given = new Set(text.split(/[\s,]+/).map((part) => part.trim().toLowerCase()));
210 return SCOPES.map((row) => row.scope).filter((scope) => given.has(scope));
211}
212
213/** What a token stores for full access. */
214export const FULL_ACCESS = "*";
215
216export type PresetId = "read_only" | "agent" | "ci" | "full";
217
218/** Starting points for choosing scopes. `*` is full access. */
219export const PRESET_SCOPES = {
220 read_only: [
Merge main into Artifacts Phase 2221 "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", "artifacts:read",
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step222 ] as const,
223 agent: [
Merge main into Artifacts Phase 2224 "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", "artifacts:read",
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step225 ] as const,
226 ci: [
Merge checks: statuses and check runs on every commit227 "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 step228 ] as const,
229 full: [
230 "*",
231 ] as const,
232};
233
234export const PRESETS: { id: PresetId; label: string; description: string }[] = [
235 { id: "read_only", label: "Read only", description: "Read everything you can read; change nothing." },
236 { 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 commit237 { 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 step238 { id: "full", label: "Full access", description: "Everything you can do, including deleting repositories and changing who has access." },
239];
240
241/** The scopes of a preset, or null for full access. */
242export function presetScopes(id: PresetId): Scope[] | null {
243 if (id === "full") return null;
244 return [...PRESET_SCOPES[id]] as Scope[];
245}
246
247/** What an OAuth client gets when it asks for nothing in particular. */
248export const OAUTH_DEFAULT_SCOPES: Scope[] = [...PRESET_SCOPES.agent];
249
250/** The operation each scope gates, by the API's operation names. */
251export const OPERATION_SCOPES = [
252 ["list_emails", "account:read"],
253 ["add_email", "account:write"],
Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036)254 ["confirm_email", "account:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step255 ["remove_email", "account:write"],
256 ["update_email_settings", "account:write"],
257 ["list_invites", "account:read"],
258 ["create_invite", "account:write"],
259 ["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)260 ["list_invitations", "account:read"],
261 ["accept_invitation", "account:write"],
262 ["decline_invitation", "account:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step263 ["list_my_repo_invitations", "account:read"],
264 ["accept_repo_invitation", "account:write"],
265 ["decline_repo_invitation", "account:write"],
API: pinned projects over REST and MCP266 // Your pinned projects: a preference of your account.
267 ["list_pinned_projects", "account:read"],
268 ["pin_project", "account:write"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97269 // Your stars: a preference of your account.
270 ["list_starred", "account:read"],
271 ["check_starred", "account:read"],
272 ["star_repo", "account:write"],
273 ["unstar_repo", "account:write"],
API: pinned projects over REST and MCP274 ["unpin_project", "account:write"],
275 ["reorder_pinned_projects", "account:write"],
API: notifications over REST and MCP, with notifications scopes276 // Your inbox: notifications, subscriptions and watching.
277 ["list_notifications", "notifications:read"],
278 ["get_notification_thread", "notifications:read"],
279 ["get_thread_subscription", "notifications:read"],
280 ["get_repo_subscription", "notifications:read"],
281 ["list_watched_repos", "notifications:read"],
282 ["mark_notifications_read", "notifications:write"],
283 ["mark_thread_read", "notifications:write"],
284 ["mark_thread_done", "notifications:write"],
285 ["save_thread", "notifications:write"],
286 ["snooze_thread", "notifications:write"],
287 ["set_thread_subscription", "notifications:write"],
288 ["delete_thread_subscription", "notifications:write"],
289 ["set_repo_subscription", "notifications:write"],
290 ["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 step291 ["create_workspace", "workspace:admin"],
292 ["delete_workspace", "workspace:admin"],
Merge branch 'worktree-agent-ad7c6d88d93adc817'293 ["get_workspace", "workspace:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily294 ["update_workspace", "workspace:admin"],
Merge main (membership, two-factor, GitHub repo roles) into tokens295 ["list_members", "workspace:read"],
296 ["update_member", "workspace:admin"],
297 ["remove_member", "workspace:admin"],
298 ["transfer_ownership", "workspace:admin"],
299 ["leave_workspace", "account:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step300 ["list_workspace_invites", "workspace:read"],
301 ["invite_member", "workspace:admin"],
302 ["revoke_workspace_invite", "workspace:admin"],
303 ["list_integrations", "workspace:read"],
304 ["connect_integration", "workspace:admin"],
AI Gateway: OpenAI's format, open models, and your own providers305 ["update_integration", "workspace:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step306 ["disconnect_integration", "workspace:admin"],
307 ["test_integration", "workspace:admin"],
308 ["get_model_routes", "workspace:read"],
309 ["set_model_routes", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar310 ["list_teams", "workspace:read"],
311 ["get_team", "workspace:read"],
312 ["list_team_members", "workspace:read"],
313 ["list_child_teams", "workspace:read"],
314 ["list_team_repos", "workspace:read"],
315 ["list_user_teams", "workspace:read"],
316 ["create_team", "workspace:admin"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge317 ["list_workspace_rulesets", "workspace:read"],
318 ["get_workspace_ruleset", "workspace:read"],
319 ["list_workspace_rule_evaluations", "workspace:read"],
320 ["create_workspace_ruleset", "workspace:admin"],
321 ["update_workspace_ruleset", "workspace:admin"],
322 ["delete_workspace_ruleset", "workspace:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar323 ["update_team", "workspace:admin"],
324 ["delete_team", "workspace:admin"],
325 ["set_team_member", "workspace:admin"],
326 ["remove_team_member", "workspace:admin"],
327 ["set_team_review_assignment", "workspace:admin"],
Usage, Billing settings and prepaid AI credit; fixes from the UX audit328 // A workspace's billing: usage, budget, AI credit and invoices.
329 ["get_usage", "billing:read"],
330 ["get_budget", "billing:read"],
331 ["get_ai_credit", "billing:read"],
332 ["list_invoices", "billing:read"],
333 ["get_billing_details", "billing:read"],
334 ["set_budget", "billing:write"],
335 ["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 step336 ["list_repos", "repo:read"],
337 ["get_repo", "repo:read"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97338 // Projects follow their repositories.
339 ["list_projects", "repo:read"],
340 ["get_project", "repo:read"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step341 ["search", "repo:read"],
342 ["list_events", "repo:read"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97343 // What the default branch says about a repository, who starred it, and
344 // its releases.
345 ["get_languages", "repo:read"],
346 ["list_contributors", "repo:read"],
347 ["get_license", "repo:read"],
348 ["list_stargazers", "repo:read"],
349 ["list_releases", "repo:read"],
350 ["get_latest_release", "repo:read"],
351 ["get_release_by_tag", "repo:read"],
352 ["get_release", "repo:read"],
353 ["create_release", "repo:write"],
354 ["update_release", "repo:write"],
355 ["delete_release", "repo:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step356 ["list_labels", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar357 ["list_milestones", "repo:read"],
358 ["get_milestone", "repo:read"],
359 ["create_label", "issues:write"],
360 ["update_label", "issues:write"],
361 ["delete_label", "issues:write"],
362 ["add_default_labels", "issues:write"],
363 ["create_milestone", "issues:write"],
364 ["update_milestone", "issues:write"],
365 ["delete_milestone", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step366 ["get_repo_settings", "repo:read"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents367 ["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 step368 ["list_deleted_repos", "repo:read"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily369 ["list_security_alerts", "repo:read"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar370 ["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 step371 ["create_repo", "repo:write"],
372 ["update_repo", "repo:write"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97373 ["update_project", "repo:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step374 ["update_repo_settings", "repo:write"],
Merge rulesets: branch and tag rules, agent-first, enforced on push and merge375 ["list_repo_rulesets", "repo:read"],
376 ["get_repo_ruleset", "repo:read"],
377 ["get_branch_rules", "repo:read"],
378 ["list_rule_evaluations", "repo:read"],
379 ["create_repo_ruleset", "repo:admin"],
380 ["update_repo_ruleset", "repo:admin"],
381 ["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 step382 ["rename_branch", "repo:write"],
383 ["rename_repo", "repo:admin"],
384 ["transfer_repo", "repo:admin"],
385 ["archive_repo", "repo:admin"],
386 ["unarchive_repo", "repo:admin"],
387 ["set_repo_visibility", "repo:admin"],
388 ["delete_repo", "repo:admin"],
389 ["restore_repo", "repo:admin"],
390 ["purge_repo", "repo:admin"],
Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily391 ["dismiss_security_alert", "repo:admin"],
392 ["reopen_security_alert", "repo:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar393 // The security suite.
394 ["list_secret_scanning_alerts", "security:read"],
395 ["get_secret_scanning_alert", "security:read"],
396 ["list_secret_scanning_locations", "security:read"],
397 ["list_bypass_requests", "security:read"],
398 ["list_custom_patterns", "security:read"],
399 ["list_code_scanning_alerts", "security:read"],
400 ["get_code_scanning_alert", "security:read"],
401 ["list_code_scanning_analyses", "security:read"],
402 ["get_sarif_upload", "security:read"],
403 ["list_vulnerability_alerts", "security:read"],
404 ["get_vulnerability_alert", "security:read"],
405 ["get_dependency_graph", "security:read"],
406 ["get_sbom", "security:read"],
407 ["compare_dependencies", "security:read"],
408 ["get_security_settings", "security:read"],
409 ["get_workspace_security_settings", "security:read"],
410 ["get_security_overview", "security:read"],
411 ["update_secret_scanning_alert", "security:write"],
412 ["bypass_push_protection", "security:write"],
413 ["check_secret_validity", "security:write"],
414 ["review_bypass_request", "security:write"],
415 ["create_custom_pattern", "security:write"],
416 ["update_custom_pattern", "security:write"],
417 ["delete_custom_pattern", "security:write"],
418 ["dry_run_custom_pattern", "security:write"],
419 ["update_code_scanning_alert", "security:write"],
420 ["upload_sarif", "security:write"],
421 ["update_vulnerability_alert", "security:write"],
422 ["fix_security_alert", "security:write"],
423 ["update_security_settings", "security:write"],
424 ["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 step425 ["list_issues", "issues:read"],
426 ["get_issue", "issues:read"],
427 ["get_plan", "issues:read"],
428 ["create_issue", "issues:write"],
429 ["update_issue", "issues:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar430 ["list_issue_labels", "issues:read"],
431 ["add_issue_labels", "issues:write"],
432 ["set_issue_labels", "issues:write"],
433 ["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 step434 ["close_issue", "issues:write"],
435 ["reopen_issue", "issues:write"],
436 ["add_comment", "issues:write"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts437 ["edit_comment", "issues:write"],
438 ["delete_comment", "issues:write"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step439 ["import_issue", "issues:write"],
440 ["apply_plan", "issues:write"],
441 ["list_pull_requests", "pull_requests:read"],
442 ["get_pull_request", "pull_requests:read"],
443 ["get_pull_request_changes", "pull_requests:read"],
444 ["read_session", "pull_requests:read"],
445 ["get_merge_queue", "pull_requests:read"],
446 ["create_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar447 ["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 step448 ["record_session", "pull_requests:write"],
449 ["mark_pull_request_ready", "pull_requests:write"],
450 ["close_pull_request", "pull_requests:write"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts451 ["reopen_pull_request", "pull_requests:write"],
452 ["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 step453 ["review_pull_request", "pull_requests:write"],
454 ["merge_pull_request", "pull_requests:write"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar455 ["request_reviewers", "pull_requests:write"],
456 ["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 step457 ["assign_issue", "agents:run"],
458 ["delegate", "agents:run"],
459 ["plan_work", "agents:run"],
460 ["message_agent", "agents:run"],
461 ["answer_message", "agents:run"],
CI is green again: the agent computer landed with its five operations in the Rust scope table but not the TypeScript mirror, and with its shell and files switched on while the ability tests still expected every computer ability to be coming. The mirror lists them under agents:run, and the tests say what ships: commands run when asked for and files change on its own, while the browser and web search are still coming.462 // A workspace agent's own computer: waking it spends the workspace's
463 // money, so the same scope covers reading and managing it.
464 ["get_agent_computer", "agents:run"],
465 ["wake_agent_computer", "agents:run"],
466 ["sleep_agent_computer", "agents:run"],
467 ["reset_agent_computer", "agents:run"],
468 ["list_agent_computer_commands", "agents:run"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step469 ["take_messages", "agents:run"],
470 ["list_workflows", "workflows:read"],
471 ["list_workflow_runs", "workflows:read"],
472 ["get_workflow_run", "workflows:read"],
473 ["get_job_logs", "workflows:read"],
474 ["dispatch_workflow", "workflows:write"],
475 ["cancel_workflow_run", "workflows:write"],
476 ["rerun_workflow_run", "workflows:write"],
477 ["update_workflow", "workflows:write"],
Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2478 ["list_artifacts", "workflows:read"],
479 ["list_workflow_run_artifacts", "workflows:read"],
480 ["get_artifact", "workflows:read"],
481 ["download_artifact", "workflows:read"],
482 ["get_artifact_retention", "workflows:read"],
483 ["delete_artifact", "workflows:write"],
484 ["set_artifact_retention", "workflows:write"],
Merge checks: statuses and check runs on every commit485 ["list_commit_statuses", "checks:read"],
486 ["get_combined_status", "checks:read"],
487 ["list_check_runs_for_ref", "checks:read"],
488 ["get_check_run", "checks:read"],
489 ["list_check_run_annotations", "checks:read"],
490 ["list_check_suites_for_ref", "checks:read"],
491 ["get_check_suite", "checks:read"],
492 ["create_commit_status", "checks:write"],
493 ["create_check_run", "checks:write"],
494 ["update_check_run", "checks:write"],
495 ["rerequest_check_run", "checks:write"],
496 ["rerequest_check_suite", "checks:write"],
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97497 // Deployments, wherever they run: reading them, and reporting them.
498 ["list_deployments", "deployments:read"],
499 ["get_deployment", "deployments:read"],
500 ["list_deployment_statuses", "deployments:read"],
501 ["list_environments", "deployments:read"],
502 ["get_environment", "deployments:read"],
503 ["create_deployment", "deployments:write"],
504 ["create_deployment_status", "deployments:write"],
Merge branch 'worktree-agent-a3abfcce648e87dca'505 // What keeps runs safe: the runs environments hold and reviewing them,
506 // approving a pull request's run, and a repository's own rules for its
507 // environments and tokens, which are an admin's.
508 ["get_pending_deployments", "workflows:read"],
509 ["review_pending_deployments", "workflows:write"],
510 ["approve_workflow_run", "workflows:write"],
511 ["get_workflow_permissions", "repo:read"],
512 ["get_fork_pr_approval", "repo:read"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts513 ["get_actions_access", "repo:read"],
Merge branch 'worktree-agent-a3abfcce648e87dca'514 ["update_environment", "repo:admin"],
515 ["delete_environment", "repo:admin"],
516 ["set_workflow_permissions", "repo:admin"],
517 ["set_fork_pr_approval", "repo:admin"],
Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts518 ["set_actions_access", "repo:admin"],
Merge branch 'worktree-agent-a3abfcce648e87dca'519 // Starting workflows from outside, as a push would.
520 ["create_repository_dispatch", "code:write"],
521 // A workspace's policy for its repositories' tokens.
522 ["get_workspace_workflow_permissions", "workspace:read"],
523 ["set_workspace_workflow_permissions", "workspace:admin"],
API and MCP for a workspace's personal access token rules, members' tokens and approvals524 // A workspace's rules for personal access tokens, and its members' tokens.
525 ["get_token_policy", "workspace:read"],
526 ["set_token_policy", "workspace:admin"],
527 ["list_member_tokens", "access:read"],
528 ["list_token_requests", "access:read"],
529 ["review_token_request", "access:admin"],
530 ["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 step531 ["recall", "memory:read"],
532 ["search_context", "memory:read"],
533 ["get_entity", "memory:read"],
534 ["get_context", "memory:read"],
535 ["remember", "memory:write"],
536 ["list_collaborators", "access:read"],
537 ["get_collaborator_permission", "access:read"],
538 ["list_repo_invitations", "access:read"],
539 ["list_outside_collaborators", "access:read"],
540 ["add_collaborator", "access:admin"],
541 ["update_collaborator", "access:admin"],
542 ["remove_collaborator", "access:admin"],
543 ["revoke_repo_invitation", "access:admin"],
544 ["set_base_permission", "access:admin"],
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar545 ["set_team_repo", "access:admin"],
546 ["remove_team_repo", "access:admin"],
Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca547 ["list_deploy_keys", "access:read"],
548 ["get_deploy_key", "access:read"],
549 ["create_deploy_key", "access:admin"],
550 ["delete_deploy_key", "access:admin"],
Merge branch 'mirroring' into artifacts-mode551 ["get_mirror", "repo:read"],
552 ["sync_mirror", "code:write"],
553 ["get_hand_back_plan", "repo:admin"],
554 ["take_over_mirror", "repo:admin"],
555 ["set_ci_failover", "repo:admin"],
556 ["hand_back_mirror", "repo:admin"],
557 ["move_mirror_to_g1t", "repo:admin"],
558 ["add_mirror_remote", "repo:admin"],
559 ["update_mirror_remote", "repo:admin"],
560 ["remove_mirror_remote", "repo:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step561 ["list_webhooks", "webhooks:read"],
562 ["list_webhook_deliveries", "webhooks:read"],
563 ["create_webhook", "webhooks:admin"],
564 ["update_webhook", "webhooks:admin"],
565 ["delete_webhook", "webhooks:admin"],
566 ["ping_webhook", "webhooks:admin"],
567 ["redeliver_webhook", "webhooks:admin"],
568 ["list_actions_secrets", "secrets:read"],
569 ["list_actions_variables", "secrets:read"],
570 ["set_actions_secret", "secrets:admin"],
571 ["delete_actions_secret", "secrets:admin"],
572 ["set_actions_variable", "secrets:admin"],
573 ["delete_actions_variable", "secrets:admin"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents574 // Self-hosted runners.
575 ["list_runners", "runners:read"],
576 ["list_runner_groups", "runners:read"],
577 ["get_runner_settings", "runners:read"],
578 ["create_runner_registration_token", "runners:admin"],
579 ["remove_runner", "runners:admin"],
580 ["create_runner_group", "runners:admin"],
581 ["update_runner_group", "runners:admin"],
582 ["delete_runner_group", "runners:admin"],
583 ["update_runner_settings", "runners:admin"],
Merge packages: roles, Actions access, source label, soft delete, API584 // Packages: reading them, their versions and who may use them needs
585 // `packages:read`; changing their settings, access and Manage Actions
586 // access `packages:write` (and the Admin role on the package, which the
587 // packages service checks); deleting and restoring packages and
588 // versions `packages:delete`, as the registries' own deletes do.
589 ["list_packages", "packages:read"],
590 ["get_package", "packages:read"],
591 ["list_package_versions", "packages:read"],
592 ["get_package_version", "packages:read"],
593 ["list_package_access", "packages:read"],
594 ["list_package_actions_access", "packages:read"],
595 ["update_package", "packages:write"],
596 ["link_package", "packages:write"],
597 ["unlink_package", "packages:write"],
598 ["set_package_access", "packages:write"],
599 ["remove_package_access", "packages:write"],
600 ["set_package_actions_access", "packages:write"],
601 ["remove_package_actions_access", "packages:write"],
602 ["delete_package", "packages:delete"],
603 ["restore_package", "packages:delete"],
604 ["delete_package_version", "packages:delete"],
605 ["restore_package_version", "packages:delete"],
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens606 // The AI Gateway. Sending a request to a model needs `models:write`,
607 // checked by the model proxy at models.g1t.sh.
608 ["list_gateway_requests", "models:read"],
Merge main into Artifacts Phase 2609 // Artifacts mode's docs, slides, designs and dashboards (the `artifact`
The artifacts service is services/artifacts, the Worker g1t-artifacts, bound as ARTIFACTS by the API, the site and the agents; its live rooms move to it with a Durable Object transfer from g1t-docs-service, and its database, bucket, indexes and queue keep their names. The git store's binding and settings are GITSTORE, its ops scripts gitstore-*, and workflow run artifacts keep their compatible API under run_artifacts modules. The deploy tool puts a Worker that has never deployed before the Workers in its stage that bind to it, and the deploy guide gives the cutover runbook.610 // MCP tool). The artifacts service then checks the person's role on each.
Merge main into Artifacts Phase 2611 ["list_workspace_artifacts", "artifacts:read"],
612 ["search_workspace_artifacts", "artifacts:read"],
613 ["get_workspace_artifact", "artifacts:read"],
614 ["get_workspace_artifact_content", "artifacts:read"],
615 ["list_workspace_artifact_versions", "artifacts:read"],
616 ["get_workspace_artifact_access", "artifacts:read"],
617 ["list_workspace_artifact_templates", "artifacts:read"],
618 ["list_workspace_artifact_spaces", "artifacts:read"],
619 ["query_workspace_dataset", "artifacts:read"],
620 ["create_workspace_artifact", "artifacts:write"],
621 ["update_workspace_artifact", "artifacts:write"],
622 ["edit_workspace_artifact", "artifacts:write"],
623 ["trash_workspace_artifact", "artifacts:write"],
624 ["restore_workspace_artifact", "artifacts:write"],
625 ["restore_workspace_artifact_version", "artifacts:write"],
626 ["set_workspace_artifact_access", "artifacts:admin"],
627 ["purge_workspace_artifact", "artifacts:admin"],
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step628] as const;
629
630/**
631 * The scopes a token or grant holds, as stored: null for full access, or
632 * the list. `legacy` marks a token made before scopes, which has full
633 * access until someone narrows it.
634 */
635export type TokenScopes = {
636 scopes: Scope[] | null;
637 legacy: boolean;
638};
639
640/**
641 * How settings group scopes into a checklist: each group's scopes, least
642 * first. Admin scopes are not here; they are under "Dangerous" on their
643 * own (see `DANGEROUS_SCOPES`). Every other scope is in exactly one group.
644 */
645export const SCOPE_GROUPS: { id: string; label: string; scopes: Scope[] }[] = [
646 { 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 bar647 { 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 member648 { 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 step649 { id: "work", label: "Issues & pull requests", scopes: ["issues:read", "issues:write", "pull_requests:read", "pull_requests:write"] },
650 { id: "agents", label: "Agents", scopes: ["agents:run"] },
Token reach: workflow_files scope, fine-grained reach, workspace token cap651 { id: "workflows", label: "Workflows", scopes: ["workflows:read", "workflows:write", "workflow_files:write"] },
Merge checks: statuses and check runs on every commit652 { id: "checks", label: "Checks", scopes: ["checks:read", "checks:write"] },
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97653 { 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 step654 { id: "memory", label: "Memory & search", scopes: ["memory:read", "memory:write"] },
655 { id: "account", label: "Account", scopes: ["account:read", "account:write"] },
API: notifications over REST and MCP, with notifications scopes656 { 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 step657 { id: "workspace", label: "Workspace", scopes: ["workspace:read", "access:read", "webhooks:read", "secrets:read"] },
Usage, Billing settings and prepaid AI credit; fixes from the UX audit658 { id: "billing", label: "Billing", scopes: ["billing:read", "billing:write"] },
Fast pages, required checks on the branch, self-hosted runners, honest incidents659 { id: "runners", label: "Runners", scopes: ["runners:read"] },
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens660 { id: "models", label: "AI Gateway", scopes: ["models:read", "models:write"] },
Merge main into Artifacts Phase 2661 { id: "artifacts", label: "Artifacts", scopes: ["artifacts:read", "artifacts:write"] },
Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step662];
663
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member664/** 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 step665export 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.