import { describe, expect, it } from "vitest"; import { searchRunnerApi } from "./runner-api-catalog.js"; describe("runner API skill reference enrichment", () => { it("tells agents that the issue count route requires the blocked attention filter", () => { const operationId = "GET /api/companies/{companyId}/issues/count"; const match = searchRunnerApi({ query: "count issues", limit: 10 }).results .find((entry) => entry.operationId === operationId); expect(match?.skillReference?.description).toContain("`?attention=blocked` is required"); expect(match?.skillReference?.description).toContain("rejects `?limit=` and `?offset=`"); expect(match?.skillReference?.description).toContain("page through `GET /api/companies/:companyId/issues`"); }); it("exposes full OpenAPI requestBody schemas and skillReference examples for headless structured coordination routes", () => { const kvLabelsOp = searchRunnerApi({ query: "PATCH /api/issues/{id}/kv-labels", limit: 5, }).results.find((entry) => entry.operationId === "PATCH /api/issues/{id}/kv-labels"); expect(kvLabelsOp).toBeDefined(); const kvBodySchema = kvLabelsOp?.requestBody?.content?.["application/json"]?.schema; expect(kvBodySchema?.properties).toMatchObject({ set: expect.any(Object), unset: expect.any(Object), if: expect.any(Object), }); expect(kvLabelsOp?.skillReference?.examples?.length).toBeGreaterThan(0); for (const opId of [ "POST /api/companies/{companyId}/channels/posts", "POST /api/companies/{companyId}/schemas", "POST /api/companies/{companyId}/issues/batch", ]) { const op = searchRunnerApi({ query: opId, limit: 5 }).results.find( (entry) => entry.operationId === opId, ); expect(op, opId).toBeDefined(); expect( op?.requestBody?.content?.["application/json"]?.schema?.type, opId, ).toBe("object"); expect(op?.skillReference?.examples?.length, opId).toBeGreaterThan(0); } const listIssuesOp = searchRunnerApi({ query: "GET /api/companies/{companyId}/issues", limit: 5, }).results.find( (entry) => entry.operationId === "GET /api/companies/{companyId}/issues", ); const paramNames = (listIssuesOp?.parameters ?? []).map((p) => p.name); expect(paramNames).toEqual(expect.arrayContaining(["channel", "kvLabel"])); }); });