From a78bdb9b023de4823081e06004af29878ccf03e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 17 Apr 2026 01:10:49 -0400 Subject: [PATCH] refactor(automation): type DEPARTMENT_SKILL_KEYWORDS with DepartmentId enum Replaces Record with Record so future edits to the department taxonomy trigger TS errors for any keyword map that drifts. Cast at the lookup site reflects the fact that agent.department is a free-form string column that may hold legacy or custom values. --- src/main/automation/automation-skills.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/automation/automation-skills.ts b/src/main/automation/automation-skills.ts index d947051e..c4297c0b 100644 --- a/src/main/automation/automation-skills.ts +++ b/src/main/automation/automation-skills.ts @@ -1,7 +1,8 @@ import type { AppDatabase } from "../database"; import { roleMatchesLeadershipKeywords } from "../agent-role-helpers"; +import type { DepartmentId } from "@shared/types/enums"; -const DEPARTMENT_SKILL_KEYWORDS: Record = { +const DEPARTMENT_SKILL_KEYWORDS: Record = { engineering: ["code", "engineer", "develop", "program", "software", "api", "backend", "frontend", "full-stack", "fullstack", "devops", "infrastructure", "system", "architect", "debug", "test", "ci", "cd", "deploy", "docker", "kubernetes", "database", "sql", "git", "typescript", "javascript", "python", "rust", "go", "java", "react", "node", "css", "html", "web"], product: ["product", "feature", "requirement", "roadmap", "user story", "ux", "ui", "design", "prototype", "wireframe", "specification", "prd"], marketing: ["market", "content", "seo", "social media", "brand", "campaign", "analytics", "growth", "copywrite", "blog", "newsletter", "email"], @@ -35,7 +36,7 @@ function scoreSkillAgentMatch( let score = 0; - const dept = agent.department ?? ""; + const dept = (agent.department ?? "") as DepartmentId; const deptKeywords = DEPARTMENT_SKILL_KEYWORDS[dept] ?? []; for (const keyword of deptKeywords) { if (skillText.includes(keyword)) {