(params: { workspaceId: string; includeBuiltins?: boolean })
| 40 | * skills via load_user_skill and never the code-only templates. |
| 41 | */ |
| 42 | export async function listSkills(params: { workspaceId: string; includeBuiltins?: boolean }) { |
| 43 | const dbRows = await db |
| 44 | .select() |
| 45 | .from(skill) |
| 46 | .where(eq(skill.workspaceId, params.workspaceId)) |
| 47 | .orderBy(desc(skill.createdAt)) |
| 48 | |
| 49 | if (params.includeBuiltins === false) { |
| 50 | return dbRows |
| 51 | } |
| 52 | |
| 53 | const dbNames = new Set(dbRows.map((r) => r.name.toLowerCase())) |
| 54 | const builtins = BUILTIN_SKILLS.filter((b) => !dbNames.has(b.name.toLowerCase())).map((b) => |
| 55 | builtinSkillRow(params.workspaceId, b) |
| 56 | ) |
| 57 | return [...builtins, ...dbRows] |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Fetch a single skill by id, scoped to a workspace. Built-in template skills |
no test coverage detected