Files
2026-05-27 23:29:53 +01:00

2.2 KiB

Tasks — add-currency-provider-coinmarketcap

  • Scaffold packages/finance/currency-provider-coinmarketcap/ (package.json 0.1.0, tsconfig, vite, vitest, README, polyfills setup).
  • Implement src/coinmarketcap/coinmarketcap.ts — CoinMarketCapProvider class implementing CurrencyProvider, constructor accepts ApiKeyConfig, validates apiKey non-empty (MISSING_CONFIG), exposes name = "coinmarketcap", supportsCrypto = true, supportsFiat = false.
  • Wire fetchRates(options?) through the shared httpRequest() helper with X-CMC_PRO_API_KEY + Accept: application/json headers; forward caller signal.
  • Parse upstream JSON, invert prices (1/price) into the rate map, raise PARSE_ERROR on malformed shape, raise UPSTREAM_ERROR on status.error_code, raise UNKNOWN_CURRENCY when no requested symbol resolved.
  • Sibling .md files for every implementation .ts (Purpose / Features / Basic / Advanced / API Reference / Implementation Notes — ≥200 words excluding code).
  • Tests in src/coinmarketcap/coinmarketcap.test.ts covering: happy path, default target list, custom base + targets, missing apiKey, HTTP error mapping, parse-error (invalid JSON, non-object data), upstream-error (status.error_code populated), unknown-currency (no symbol resolved), abort-signal forwarding, default baseUrl, default globalThis.fetch fallback. All it() blocks carry { timeout: 5000 }.
  • Runner imports from @suaveplan/testing/runner only (zero from "vitest" / from "bun:test").
  • Subpath exports for . and ./coinmarketcap/coinmarketcap.
  • Pre-publish gate green: bunx turbo lint typecheck test --filter=@suaveplan/currency-provider-coinmarketcap AND bunx turbo test:coverage --filter=@suaveplan/currency-provider-coinmarketcap at 100/100/100/100.
  • Banned-pattern scan zero; barrel-shape scan zero; runner-import scan zero; missing-.md scan zero.
  • Refresh MANIFEST.md (bun scripts/folder-reorg/generate-manifest.ts), MISSING.yml (bun scripts/generate-missing.ts), STATUS.md, SUMMARY.md.
  • Run bunx markdownlint-cli2 --fix; verify clean.
  • Fold specs/currency-provider-coinmarketcap/spec.md into openspec/specs/currency-provider-coinmarketcap/spec.md and archive change folder.