Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/auth/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export function oauthClientSecret(): string {

// Full set of permission scopes requested by the CLI.
export const DEFAULT_SCOPES = [
'agent_tools:read',
'agent_tools:write',
'analytics:export',
'analytics:read',
'api_keys:delete',
Expand All @@ -62,6 +64,9 @@ export const DEFAULT_SCOPES = [
'integrations:delete',
'integrations:read',
'integrations:write',
'issues:delete',
'issues:read',
'issues:write',
'labels:delete',
'labels:read',
'labels:write',
Expand All @@ -74,6 +79,8 @@ export const DEFAULT_SCOPES = [
'oauth_clients:delete',
'oauth_clients:read',
'oauth_clients:write',
'pages:delete',
'pages:read',
'ratings:write',
'repositories:delete',
'repositories:read',
Expand Down
17 changes: 16 additions & 1 deletion test/oauth-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ import assert from 'node:assert/strict';
delete process.env.POLYLANE_OAUTH_CLIENT_ID;
delete process.env.POLYLANE_OAUTH_CLIENT_SECRET;

const { oauthClientId, oauthClientSecret } = await import('../src/auth/oauth');
const { DEFAULT_SCOPES, oauthClientId, oauthClientSecret } = await import('../src/auth/oauth');

it('requests the issue, agent tool, and page scopes the CLI exposes', () => {
const scopes = new Set(DEFAULT_SCOPES.split(' '));
for (const scope of [
'agent_tools:read',
'agent_tools:write',
'issues:delete',
'issues:read',
'issues:write',
'pages:delete',
'pages:read',
]) {
assert.ok(scopes.has(scope), `${scope} is missing from CLI OAuth login`);
}
});

describe('oauth client resolution', () => {
beforeEach(() => {
Expand Down
Loading