Files
ai-job-search/.agents/skills/freehire-search/cli/README.md
T
Ilya Strelov e3af401087 feat(freehire-search): search returns each hit's full description (#251)
The skill queried /api/v1/jobs/search, whose `description` is the search
index's truncated preview — and the CLI dropped it entirely, so a result
carried only title/company/location/date/url. Reading a posting therefore
meant a `detail` call per hit, which is exactly what job-scraper's Step 2
prescribes: "fetch full detail with that portal's `detail` command".

freehire exposes a search endpoint for programmatic consumers,
/api/v1/agent/jobs/search: same query, ranking, facets and pagination, but
asked to (`include_description=true`) it replaces the preview with the
posting's full description read from the database, rendered as
`description_format=markdown|text|html`. Reproduce the difference:

  curl -s "https://freehire.me/api/v1/jobs/search?q=golang&limit=1" \
    | jq -r '.data[0].description | length'          # preview, capped
  curl -s "https://freehire.me/api/v1/agent/jobs/search?q=golang&limit=1\
&include_description=true&description_format=markdown" \
    | jq -r '.data[0].description | length'          # full text

So `search` now calls that endpoint, always asking for full descriptions,
and each JSON result carries `description` verbatim — no client-side HTML
stripping, since the API already rendered it. Markdown is the default
because it preserves the headings and requirement lists /rank reasons over;
`--description-format text|html` selects the others. The flag is validated
client-side: the API answers an unrecognized format with raw HTML rather
than an error, so a typo would silently change the output instead of
failing.

`table` and `plain` stay description-free — a full posting body would swamp
a scannable list — and `detail` is untouched, for looking one posting up by
slug (including a closed one, absent from search).

One behaviour change beyond the endpoint: a 404 from the search path used
to be folded into an empty result set. On the agent endpoint a 404 means
the instance predates it — a self-hosted freehire behind FREEHIRE_API_URL —
so it is now reported as an error naming the path, instead of a plausible
"no results" that hides the misconfiguration.

Tests cover the requested URL and params, verbatim (unstripped) markdown,
the null-when-absent case, the 404-is-an-error contract, and the flag
validation. All network-free.
2026-07-28 21:19:24 +02:00

3.9 KiB

freehire-cli

CLI for searching the freehire.me job aggregator across many markets (tech-focused), via its public JSON API.

Data source: freehire.me REST API (/api/v1/agent/jobs/search, /api/v1/jobs/facets, /api/v1/jobs/{slug}). Authentication: None required — reads are public (only tracking mutations need a key, and those are out of scope here). Dependencies: None (plain bun + fetch). bun install is optional and only pulls dev type defs.

Hosted-service dependency. This skill talks to freehire.me, a personal project maintained on a best-effort basis with no formal SLA. If the API is unreachable the CLI exits non-zero with a clear error rather than hanging, so an outage degrades gracefully instead of breaking the caller. Point FREEHIRE_API_URL at a self-hosted freehire backend to swap the source.

Installation

cd .agents/skills/freehire-search/cli
bun install   # optional — only installs TypeScript dev types

The CLI runs without any install because it has zero runtime dependencies.

Self-hosting / base URL

The base URL defaults to https://freehire.me and is overridable with an env var:

FREEHIRE_API_URL=http://localhost:8080 bun run src/cli.ts search -q "go"

The freehire backend is MIT-licensed and stands up with one command via Docker Compose (make up → API on :8080, same /api/v1/... paths).

Commands

Command Description
search Search jobs by keyword and facet filters
detail Fetch full detail for a single job by its slug

search accepts --format json|table|plain (default json); detail accepts --format json|plain. All errors are written to stderr as { "error": "...", "code": "..." } with exit code 1.

search hits the API's agent endpoint, so every JSON result already carries the posting's full description (Markdown by default, --description-format text|html to change it). detail remains for looking a single posting up by slug — including a closed one, which search does not return.

Quick examples

# Senior backend roles, table view
bun run src/cli.ts search -q "backend engineer" --seniority senior --limit 10 --format table

# Remote React roles in the EU
bun run src/cli.ts search -q "react" --remote remote --region eu --format table

# DevOps roles in Germany posted in the last 14 days
bun run src/cli.ts search --category devops --country DE --jobage 14 --format table

# Full detail for one job (slug from a search result's id)
bun run src/cli.ts detail golang-zensar-2bxu6dxm --format plain

See ../SKILL.md for the full flag reference and the hosted-dependency note.

Search flags

Flag Alias Description
--query -q Keywords (title / skill / role). Full-text; optional.
--jobage Posted within N days (posted_within_days).
--page 1-indexed page. Default 1.
--limit -n Results per page (API limit). Default 25.
--region Macro-region(s), comma = OR (e.g. eu,us).
--country ISO-3166 alpha-2 code(s).
--city City name(s).
--seniority Seniority level(s).
--category Role category(ies).
--skill Canonical skill(s).
--company Company slug.
--remote remote | hybrid | onsite (work_mode).
--facet Any other facet as key=value (repeatable).
--format json | table | plain.
--description-format markdown (default) | text | html — how each result's full description is rendered (json output only).

Facet values come from freehire's controlled vocabularies. Discover the live values (with counts) for a market at /api/v1/jobs/facets, or narrow it, e.g. https://freehire.me/api/v1/jobs/facets?q=react.