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
chore(api): fix knip unused-export failures; forbid bypassing knip
mogeryfe8d3581b2ca
diff --git a/CLAUDE.md b/CLAUDE.mdindex fb2ac4163..c5d5578a3 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -16,4 +16,6 @@ When making changes to the API, here are the general steps you should take:- `pnpm harness` is a command that gets the API server and workers up for you to run the tests. Don't try to `pnpm start` manually.- The full test suite takes a long time to run, so you should try to only execute the relevant tests locally, and let CI run the full test suite.4. Push to a branch, open a PR, and let CI run to verify your win condition.-Keep these steps in mind while building your TODO list.\ No newline at end of file+Keep these steps in mind while building your TODO list.++Never bypass `knip` failures (e.g. with `git commit --no-verify`). If the pre-commit `knip` check fails, fix the reported unused exports/files β even if they predate your change β before committing.\ No newline at end of filediff --git a/apps/api/src/lib/keyless.ts b/apps/api/src/lib/keyless.tsindex 25f88480b..3bdb6e2c1 100644--- a/apps/api/src/lib/keyless.ts+++ b/apps/api/src/lib/keyless.ts@@ -13,8 +13,8 @@ import { redisRateLimitClient } from "../services/rate-limiter";// the `keyless/consume` canonical log are the real abuse controls.// No defaults: the keyless free tier is OFF unless BOTH limits are configured.-export const KEYLESS_REQUESTS_PER_DAY = config.KEYLESS_REQUESTS_PER_DAY;-export const KEYLESS_CREDITS_PER_DAY = config.KEYLESS_CREDITS_PER_DAY;+const KEYLESS_REQUESTS_PER_DAY = config.KEYLESS_REQUESTS_PER_DAY;+const KEYLESS_CREDITS_PER_DAY = config.KEYLESS_CREDITS_PER_DAY;// The tier is "configured" when BOTH limits are set β even to 0. Unset means the// feature is off (callers get a plain Unauthorized); 0 means it's on but the@@ -31,13 +31,13 @@ const DAY_SECONDS = 86400;// Keyless teams reuse the `preview_` prefix so billing (autumn `isPreviewTeam`)// and GCS persistence are skipped automatically, with a dedicated infix so the// IP can be recovered when charging credits after a request completes.-export const KEYLESS_TEAM_PREFIX = "preview_keyless_";+const KEYLESS_TEAM_PREFIX = "preview_keyless_";export function keylessTeamId(ip: string): string {return `${KEYLESS_TEAM_PREFIX}${ip}`;}-export function keylessIpFromTeamId(teamId: string): string | null {+function keylessIpFromTeamId(teamId: string): string | null {return teamId.startsWith(KEYLESS_TEAM_PREFIX)? teamId.slice(KEYLESS_TEAM_PREFIX.length): null;@@ -72,16 +72,14 @@ export function keylessTeamUuid(* is treated as IPv4.*/export function isKeylessIpEligible(ip: string): boolean {- const normalized = ip.startsWith("::ffff:")- ? ip.slice("::ffff:".length)- : ip;+ const normalized = ip.startsWith("::ffff:") ? ip.slice("::ffff:".length) : ip;return isIPv4(normalized);}const requestsKey = (ip: string) => `keyless_requests:${ip}`;const creditsKey = (ip: string) => `keyless_credits:${ip}`;-export type KeylessConsumeResult = {+type KeylessConsumeResult = {ok: boolean;reason?: "requests" | "credits";requestsUsed: number;diff --git a/apps/api/src/services/posthog.ts b/apps/api/src/services/posthog.tsindex 0a92cecee..79eaa1338 100644--- a/apps/api/src/services/posthog.ts+++ b/apps/api/src/services/posthog.ts@@ -65,7 +65,7 @@ type RequestSurface =* practice. NOTE: confirm the exact strings sent by firecrawl-mcp and* firecrawl-cli β adjust the prefixes below if they differ.*/-export function originToSurface(origin?: string | null): RequestSurface {+function originToSurface(origin?: string | null): RequestSurface {const o = (origin ?? "").toLowerCase();if (o === "website" || o.includes("playground")) return "playground";if (o.startsWith("mcp")) return "mcp";