/** * Board card categories. Derived from the source kind (for work items) or * hardcoded as 'plan' (for plan cards). Categories are data, not hard-coded * per repo. */ export const CATEGORIES = [ 'plan', 'github-issue', 'friction', 'sentry', 'discord', 'cleanup', 'ship-pr', 'generic', ] as const export type Category = (typeof CATEGORIES)[number] export const CATEGORY_LABELS: Record = { plan: 'Plan', 'github-issue': 'GitHub issue', friction: 'Friction', sentry: 'Sentry', discord: 'Discord', cleanup: 'Cleanup', 'ship-pr': 'Ship PR', generic: 'Generic', } export const CATEGORY_COLORS: Record = { plan: '#6d28d9', 'github-issue': '#334155', friction: '#b45309', sentry: '#6d28d9', discord: '#4338ca', cleanup: '#15803d', 'ship-pr': '#0f766e', generic: '#475569', } export function categoryFromSource(source: string): Category { switch (source) { case 'github-issues': return 'github-issue' case 'friction': return 'friction' case 'sentry': return 'sentry' case 'discord': return 'discord' case 'ci-failure': return 'cleanup' case 'run-error': return 'cleanup' case 'x': return 'generic' case 'email': return 'generic' case 'feedback': return 'generic' case 'manual': return 'generic' case 'intent': return 'generic' default: return 'generic' } } export function categoryFromLabels(labels: string[]): Category | null { for (const label of labels) { const lower = label.toLowerCase() if (lower === 'ship-pr') return 'ship-pr' if (lower === 'cleanup' || lower === 'legacy-reaper' || lower === 'docs-freshness' || lower === 'keep-tests-tight') return 'cleanup' } return null } export function deriveCategory(source: string, labels: string[]): Category { return categoryFromLabels(labels) ?? categoryFromSource(source) }