mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
Everything this stack adds now carries issue in its file name, workflow name and job id, so one search finds all of it: ls .github/workflows/issue_* grep -ril issue scripts .github/prompts .github/*.json Renames: label_sync.yml -> issue_label_sync.yml, label_claude_code.yml -> issue_label_claude_code.yml, .github/labels.json -> .github/issue-labels.json, scripts/sync-labels(.test).ts -> scripts/sync-issue-labels(.test).ts. Job ids now match the script they run: classify-issue-tests, classify-issue, label-issue, sync-issue-labels-tests, sync-issue-labels, label-claude-code
32 lines
1 KiB
TypeScript
32 lines
1 KiB
TypeScript
import manifest from "../.github/issue-labels.json";
|
|
|
|
export const NAMESPACES = ["domain", "provider", "kind", "priority", "lift", "needs"] as const;
|
|
export type Namespace = (typeof NAMESPACES)[number];
|
|
|
|
export interface LabelSpec {
|
|
readonly color: string;
|
|
readonly description: string;
|
|
}
|
|
|
|
export type Manifest = Readonly<Record<Namespace, Readonly<Record<string, LabelSpec>>>>;
|
|
|
|
export interface ManifestLabel extends LabelSpec {
|
|
readonly name: string;
|
|
}
|
|
|
|
export const MANIFEST: Manifest = manifest;
|
|
|
|
export function labelName(namespace: Namespace, value: string): string {
|
|
return `${namespace}:${value}`;
|
|
}
|
|
|
|
export function namespaceOf(label: string): Namespace | undefined {
|
|
const prefix = label.split(":")[0];
|
|
return NAMESPACES.find((namespace) => namespace === prefix);
|
|
}
|
|
|
|
export function manifestLabels(source: Manifest): readonly ManifestLabel[] {
|
|
return NAMESPACES.flatMap((namespace) =>
|
|
Object.entries(source[namespace]).map(([value, spec]) => ({ name: labelName(namespace, value), ...spec })),
|
|
);
|
|
}
|