Unofficial CLI + TypeScript client for the BLS API v2 (Bureau of Labor Statistics).
npm run build # tsc -> dist/
npm test # unit tests (mocked HTTP)
npm run test:integration # live API tests (needs BLS_API_KEY)
npm run dev -- <args> # run CLI directly via tsxsrc/api/client.ts—BlsClientclass, uses nativefetch, POST requests for timeseries datasrc/api/types.ts— all TypeScript types for BLS API requests/responsessrc/api/shortcuts.ts— well-known series ID mappings (cpi, unemployment, jobs)src/cli.ts— CLI entry point, routes commands to handlerssrc/commands/— one file per command group (series, popular, surveys, shortcuts)src/cli/— parseArgs configs, formatters (json/csv/table), help textsrc/tests/— node:test runner, fixtures intests/fixtures/
- Zero runtime dependencies (Node 18+ native fetch, parseArgs, test runner)
- ESM (
"type": "module") with.jsimport extensions - BLS API uses POST with JSON body for timeseries data, GET for surveys/popular
- CLI flags use kebab-case, API params use camelCase in request body
- JSON output includes
_truncatedand_next_offsetwhen results are paginated - Tests mock
global.fetch— no external mock libraries - Mock tests verify POST method, Content-Type header, and request body