Initial commit

This commit is contained in:
Adam Jones 2025-09-20 02:41:11 +00:00
commit e3f0af2f94
No known key found for this signature in database

37
src/config/utils.ts Normal file
View file

@ -0,0 +1,37 @@
import type { GROUPS } from './groups';
function isValidGroupName(name: string): boolean {
return /^[a-z][a-z0-9-]*[a-z]$/.test(name);
}
export function defineGroups<
const T extends readonly {
name: Lowercase<string>;
description: string;
memberOf?: readonly (T[number]['name'])[];
}[]
>(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[];
}
export interface Member {
github?: string;
email?: `${string}@modelcontextprotocol.io`;
memberOf: readonly GroupKey[];
}