Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(api): accept the skills param on developer search
Karan Lokchandanidd24ea0af211
diff --git a/apps/api/src/controllers/v2/research-proxy.test.ts b/apps/api/src/controllers/v2/research-proxy.test.tsnew file mode 100644index 000000000..a3f324a14--- /dev/null+++ b/apps/api/src/controllers/v2/research-proxy.test.ts@@ -0,0 +1,43 @@+import {+ DEVELOPER_SEARCH_QUERY_KEYS,+ developerSearchSchema,+} from "./research-proxy";++describe("developer search upstream contract", () => {+ it("forwards exactly the upstream parameter surface", () => {+ expect(DEVELOPER_SEARCH_QUERY_KEYS).toEqual([+ "query",+ "k",+ "types",+ "repos",+ "sources",+ "passages",+ "language",+ "topic",+ "license",+ "min_stars",+ "max_stars",+ "archived",+ "fork",+ "skills",+ ]);+ });++ it("keeps the schema and the forwarded key list in step", () => {+ expect(Object.keys(developerSearchSchema.shape).sort()).toEqual(+ [...DEVELOPER_SEARCH_QUERY_KEYS, "origin", "integration"].sort(),+ );+ });++ it("takes skills=only and refuses any other value", () => {+ expect(+ developerSearchSchema.safeParse({ query: "q", skills: "only" }).success,+ ).toBe(true);+ expect(+ developerSearchSchema.safeParse({ query: "q", skills: "true" }).success,+ ).toBe(false);+ expect(+ developerSearchSchema.safeParse({ query: "q", skills: "" }).success,+ ).toBe(false);+ });+});diff --git a/apps/api/src/controllers/v2/research-proxy.ts b/apps/api/src/controllers/v2/research-proxy.tsindex 4ee0b3682..d9ef0bbdc 100644--- a/apps/api/src/controllers/v2/research-proxy.ts+++ b/apps/api/src/controllers/v2/research-proxy.ts@@ -95,7 +95,7 @@ const booleanFlag = zvalue === undefined ? undefined : value === true || value === "true",);-const developerSearchSchema = z.strictObject({+export const developerSearchSchema = z.strictObject({query: z.string().min(1),k: kSchema(100),types: multiString,@@ -109,10 +109,11 @@ const developerSearchSchema = z.strictObject({max_stars: starsSchema,archived: booleanFlag,fork: booleanFlag,+ skills: z.enum(["only"]).optional(),...commonQuery,});-const DEVELOPER_SEARCH_QUERY_KEYS = [+export const DEVELOPER_SEARCH_QUERY_KEYS = ["query","k","types",@@ -126,6 +127,7 @@ const DEVELOPER_SEARCH_QUERY_KEYS = ["max_stars","archived","fork",+ "skills",];type ResearchEndpointConfig = {diff --git a/apps/api/src/search/developer.test.ts b/apps/api/src/search/developer.test.tsindex 3a8b94281..55e5a9869 100644--- a/apps/api/src/search/developer.test.ts+++ b/apps/api/src/search/developer.test.ts@@ -53,6 +53,7 @@ describe("searchDeveloperCategory", () => {expect(url.searchParams.get("query")).toBe('"exact phrase" retries');expect(url.searchParams.get("k")).toBe("7");expect([...url.searchParams.keys()]).toEqual(["query", "k"]);+ expect(url.searchParams.has("skills")).toBe(false);expect(firstCall()[1].method).toBe("GET");expect(firstCall()[1].headers).toEqual({ "firecrawl-team-id": "t1" });});