- Add catch-all email group with admin-adam@modelcontextprotocol.io - Add onlyOnPlatforms configuration to restrict groups to specific platforms - Set antitrust and catch-all groups to Google only - Groups default to all platforms when onlyOnPlatforms is not specified
43 lines
No EOL
1,011 B
TypeScript
43 lines
No EOL
1,011 B
TypeScript
import type { GROUPS } from './groups';
|
|
|
|
function isValidGroupName(name: string): boolean {
|
|
return /^[a-z][a-z0-9-]*[a-z]$/.test(name);
|
|
}
|
|
|
|
export type Platform = 'github' | 'google';
|
|
|
|
export function defineGroups<
|
|
const T extends readonly {
|
|
name: Lowercase<string>;
|
|
description: string;
|
|
memberOf?: readonly (T[number]['name'])[];
|
|
isEmailGroup?: boolean;
|
|
onlyOnPlatforms?: readonly Platform[];
|
|
}[]
|
|
>(groups: T) {
|
|
for (const group of groups) {
|
|
if (!isValidGroupName(group.name)) {
|
|
throw new Error(
|
|
`Invalid group name: ${group.name}. Must be lowercase alphanumeric with dashes, starting with a letter.`
|
|
);
|
|
}
|
|
}
|
|
|
|
return groups;
|
|
}
|
|
|
|
export type GroupKey = (typeof GROUPS)[number]['name'];
|
|
|
|
export interface Group {
|
|
name: GroupKey;
|
|
description: string;
|
|
memberOf?: readonly GroupKey[];
|
|
isEmailGroup?: boolean;
|
|
onlyOnPlatforms?: readonly Platform[];
|
|
}
|
|
|
|
export interface Member {
|
|
github?: string;
|
|
email?: string;
|
|
memberOf: readonly GroupKey[];
|
|
} |