16 lines
2.2 KiB
Markdown
16 lines
2.2 KiB
Markdown
# Tasks — add-currency-provider-coinmarketcap
|
|
|
|
- [x] Scaffold `packages/finance/currency-provider-coinmarketcap/` (package.json `0.1.0`, tsconfig, vite, vitest, README, polyfills setup).
|
|
- [x] 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`.
|
|
- [x] Wire `fetchRates(options?)` through the shared `httpRequest()` helper with `X-CMC_PRO_API_KEY` + `Accept: application/json` headers; forward caller `signal`.
|
|
- [x] 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.
|
|
- [x] Sibling `.md` files for every implementation `.ts` (Purpose / Features / Basic / Advanced / API Reference / Implementation Notes — ≥200 words excluding code).
|
|
- [x] 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 }`.
|
|
- [x] Runner imports from `@suaveplan/testing/runner` only (zero `from "vitest"` / `from "bun:test"`).
|
|
- [x] Subpath exports for `.` and `./coinmarketcap/coinmarketcap`.
|
|
- [x] 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.
|
|
- [x] Banned-pattern scan zero; barrel-shape scan zero; runner-import scan zero; missing-`.md` scan zero.
|
|
- [x] Refresh `MANIFEST.md` (`bun scripts/folder-reorg/generate-manifest.ts`), `MISSING.yml` (`bun scripts/generate-missing.ts`), `STATUS.md`, `SUMMARY.md`.
|
|
- [x] Run `bunx markdownlint-cli2 --fix`; verify clean.
|
|
- [x] Fold `specs/currency-provider-coinmarketcap/spec.md` into `openspec/specs/currency-provider-coinmarketcap/spec.md` and archive change folder.
|