Intelligence
Artifacts
Browse the repository, read documents, and manage the governance folders. Source, runtime, and infrastructure are read-only.
Repository
repositories/aaf-holdings/hq01/lib/content/normalize.ts
1.1 KB
import type { Priority, Status } from "./types";
export function normalizeStatus(raw?: string): Status {
if (!raw) return "Unknown";
const v = raw.trim().toLowerCase();
if (/(in[\s-]?progress|wip|doing)/.test(v)) return "In Progress";
if (/(block|stuck|wait)/.test(v)) return "Blocked";
if (/(review|qa)/.test(v)) return "Review";
if (/(complete|completed)/.test(v)) return "Complete";
if (/(done|shipped|merged)/.test(v)) return "Done";
if (/(closed|archiv)/.test(v)) return "Closed";
if (/(backlog|queued|planned)/.test(v)) return "Backlog";
if (/(draft|proposal)/.test(v)) return "Draft";
if (/active/.test(v)) return "Active";
return "Unknown";
}
export function normalizePriority(raw?: string): Priority {
if (!raw) return "Unknown";
const m = raw.trim().toUpperCase().match(/P\s*([0-3])/);
if (m) return `P${m[1]}` as Priority;
const v = raw.trim().toLowerCase();
if (/(critical|urgent|highest)/.test(v)) return "P0";
if (/high/.test(v)) return "P1";
if (/(medium|normal)/.test(v)) return "P2";
if (/low/.test(v)) return "P3";
return "Unknown";
}
root · /srv/aaf