Files
t3code/apps/mobile/src/features/threads/composerSlashSkillSearch.ts
T
e723501227 feat(composer): list skills with slash commands (#7737)
Co-authored-by: maria-rcks <[email protected]>
Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com>
2026-08-20 21:27:36 -04:00

17 lines
611 B
TypeScript

import type { ServerProviderSkill } from "@t3tools/contracts";
export function matchesSlashSkillQuery(skill: ServerProviderSkill, query: string): boolean {
if (!skill.enabled) return false;
const normalizedQuery = query.toLowerCase();
const skillQuery =
normalizedQuery === "skill"
? ""
: normalizedQuery.startsWith("skill:")
? normalizedQuery.slice("skill:".length)
: normalizedQuery;
if (!skillQuery) return true;
return [skill.name, skill.displayName, skill.shortDescription, skill.description].some((value) =>
value?.toLowerCase().includes(skillQuery),
);
}