feat: add skills

This commit is contained in:
Prad Nukala committed 2026-08-26 10:35:34 -04:00
1 parent 6984212b17
commit c50aa92862
150 files changed
+12702

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import { join } from "path";
const CLI_PATH = join(import.meta.dir, "../src/cli.ts");
export interface CLIResult {
stdout: string;
stderr: string;
exitCode: number;
}
export async function runCLI(args: string[]): Promise<CLIResult> {
const proc = Bun.spawn(["bun", "run", CLI_PATH, ...args], {
stdout: "pipe",
stderr: "pipe",
});
const [stdout, stderr, exitCode] = await Promise.all([
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
proc.exited,
]);
return { stdout: stdout.trim(), stderr: stderr.trim(), exitCode };
}
export function parseJSON<T = unknown>(result: CLIResult): T {
if (result.exitCode !== 0) {
throw new Error(
`CLI exited with code ${result.exitCode}. stderr: ${result.stderr}`
);
}
try {
return JSON.parse(result.stdout) as T;
} catch {
throw new Error(
`Failed to parse JSON. stdout: ${result.stdout}\nstderr: ${result.stderr}`
);
}
}
+23
View File
@@ -0,0 +1,23 @@
import { describe, expect, test } from "bun:test"
import { runCLI, parseJSON } from "./helpers"
describe("wellfound-cli", () => {
test("search returns real results for a common role", async () => {
const res = await runCLI(["search", "-q", "senior software engineer", "--location", "new-york", "--limit", "5", "--no-description"])
expect(res.exitCode).toBe(0)
const json = parseJSON<{ meta: { count: number }; results: { id: string; title: string; company: string | null; location: string | null; date: string | null; url: string }[] }>(res)
expect(json.results.length).toBeGreaterThan(0)
for (const r of json.results) {
expect(r.id).toBeTruthy(); expect(r.title).toBeTruthy(); expect(r.url).toContain("wellfound.com/jobs/")
expect(r).toHaveProperty("company"); expect(r).toHaveProperty("location"); expect(r).toHaveProperty("date")
}
})
test("bogus flag exits 1 with JSON error on stderr", async () => {
const res = await runCLI(["search", "-q", "x", "--bogus"])
expect(res.exitCode).toBe(1); expect(JSON.parse(res.stderr)).toHaveProperty("error")
})
test("missing query exits 1 with JSON error", async () => {
const res = await runCLI(["search"])
expect(res.exitCode).toBe(1); expect(JSON.parse(res.stderr).code).toBe("NO_QUERY")
})
})