Unofficial CLI + TypeScript client for the US Treasury Fiscal Data API.
npm run build # tsc -> dist/
npm test # unit tests (mocked HTTP)
npm run test:integration # live API tests (no auth needed — API is open)
npm run dev -- <args> # run CLI directly via tsxsrc/api/client.ts—TreasuryClientclass, one method per API endpoint, uses nativefetchsrc/api/types.ts— all TypeScript types for Treasury API requests/responsessrc/cli.ts— CLI entry point, routes commands to handlerssrc/commands/— one file per command group (debt, dts, mts, exchange, query)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 - All API params use snake_case (matching Treasury API), CLI flags use kebab-case
- JSON output includes
_truncatedand_next_offsetwhen results are paginated - Tests mock
global.fetch— no external mock libraries - No API key required — Treasury Fiscal Data API is completely open