import type { DesignSystemRegistryEntry } from "@/lib/design-system/registry-types" import { DESIGN_SYSTEM_TIER_LABEL } from "@/lib/design-system/registry-types" /** * Agent-context rows are identified by their file, so `exxat-senior-ux` has to * find the skill even though the row is titled "Design brief protocol". * * Only these tiers: component import paths are all `@exxatdesignux/ui/...`, and * folding those in would make "exxat" and "components" match the whole catalog. */ const PATH_IS_THE_NAME = new Set(["rule", "skill", "agent"]) /** Inline filter for catalog registry rows (drill-in search + home grid). */ export function catalogEntryMatchesQuery( entry: DesignSystemRegistryEntry, query: string, ): boolean { const q = query.trim().toLowerCase() if (!q) return true const haystack = [ entry.name, entry.description, entry.group, entry.slug, entry.keywords ?? "", DESIGN_SYSTEM_TIER_LABEL[entry.tier], PATH_IS_THE_NAME.has(entry.tier) ? entry.importPath : "", ] .join(" ") .toLowerCase() return haystack.includes(q) }