Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/lib/agentSkills/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,3 @@ export const GenerateBodySchema = z.object({
prune: z.boolean().default(false),
onlyIds: z.array(z.string()).optional(),
});

export type AgentSkillT = z.infer<typeof AgentSkillSchema>;
export type SkillCoverageT = z.infer<typeof SkillCoverageSchema>;
export type ListQueryT = z.infer<typeof ListQuerySchema>;
export type GenerateBodyT = z.infer<typeof GenerateBodySchema>;
24 changes: 23 additions & 1 deletion tests/unit/agentSkills-schemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ import assert from "node:assert/strict";
const { AgentSkillSchema, SkillCoverageSchema, ListQuerySchema, GenerateBodySchema } =
await import("../../src/lib/agentSkills/schemas.ts");

test("agent skills schemas module exposes runtime validators", async () => {
const schemas = await import("../../src/lib/agentSkills/schemas.ts");

for (const key of [
"AgentSkillSchema",
"GenerateBodySchema",
"ListQuerySchema",
"SkillCategorySchema",
"SkillCoverageSchema",
]) {
assert.equal(typeof schemas[key].safeParse, "function", `${key} should stay exported`);
}
});

// ─── AgentSkillSchema ─────────────────────────────────────────────────────────

test("AgentSkillSchema — valid api skill parses successfully", () => {
Expand Down Expand Up @@ -105,7 +119,15 @@ test("AgentSkillSchema — optional fields absent parses successfully", () => {

test("AgentSkillSchema — .parse throws on invalid input", () => {
assert.throws(() => {
AgentSkillSchema.parse({ id: "bad id", name: "", description: "", category: "api", area: "x", rawUrl: "x", githubUrl: "x" });
AgentSkillSchema.parse({
id: "bad id",
name: "",
description: "",
category: "api",
area: "x",
rawUrl: "x",
githubUrl: "x",
});
});
});

Expand Down
Loading