Files
suaveplan/openspec/archive/2026-05-17-add-currency-provider-cryptocompare/tasks.md
2026-05-27 23:29:53 +01:00

89 lines
4.0 KiB
Markdown

# Tasks — Add @suaveplan/currency-provider-cryptocompare
## Spec-completeness preflight (AGENTS.md §12a)
- [x] Numbered checklist of every `### Requirement` and `#### Scenario`
drafted in `specs/currency-provider-cryptocompare/spec.md`
(4 requirements, 11 scenarios).
## Package scaffolding
- [x] Create `packages/finance/currency-provider-cryptocompare/` with
`package.json` (`0.1.0`, sibling deps on slim core / currency /
types / error / tslib), `tsconfig.json`, `tsconfig.lib.json`,
`vite.config.ts`, `vitest.config.ts`.
- [x] Create `tests/setup/polyfills.ts` no-op shim mirroring sibling
packages.
## Implementation
- [x] `src/cryptocompare/cryptocompare.ts` — `CryptoCompareConfig`
(extends `NoKeyConfig` with optional `apiKey`), `CryptoCompareProvider`
class implementing `CurrencyProvider`. Defaults: `name =
"cryptocompare"`, `supportsCrypto = true`, `supportsFiat = false`,
base `"USD"`, 15-symbol default `targets`.
- [x] Optional `apiKey` attached via `authorization: Apikey <key>` header
on every request when present and non-whitespace.
- [x] Error mapping: `HTTP_ERROR` (shared `httpRequest`), `PARSE_ERROR`
(invalid JSON / non-object payload), `UPSTREAM_ERROR`
(`Response === "Error"`), `UNKNOWN_CURRENCY` (no positive quotes).
- [x] `src/cryptocompare/index.ts` explicit-named barrel.
- [x] `src/index.ts` explicit-named root barrel.
## Tests
- [x] `src/cryptocompare/cryptocompare.test.ts` — runner imports from
`@suaveplan/testing/runner`, recording `FetchLike`, 14 cases
covering: metadata, default invert + zero-skip + USD default,
keyless vs keyed header, whitespace-only key treated as absent,
custom `baseUrl` + explicit targets, empty `targets` falls back to
defaults, `HTTP_ERROR`, `PARSE_ERROR` (invalid JSON), `PARSE_ERROR`
(non-object payload), `UPSTREAM_ERROR` (with `Message`),
`UPSTREAM_ERROR` (no `Message` → default message),
`UNKNOWN_CURRENCY` (empty map), `UNKNOWN_CURRENCY` (every quote
non-finite or non-positive), `AbortSignal` forwarding. Every test
carries `{ timeout: 5000 }`.
## Documentation
- [x] `src/cryptocompare/cryptocompare.md` sibling doc (≥200 words,
Purpose / Features / Usage Basic / Usage Advanced / API Reference /
Implementation Notes).
- [x] Root `README.md` (install, quick start, modules link, error table).
## Pre-archive gates (AGENTS.md §13)
- [x] Step 0 — spec reconciliation: every `### Requirement` and
`**Verified by:**` resolves to a real file + verbatim test name.
- [x] Step 1 — `bunx turbo lint typecheck test --filter=@suaveplan/currency-provider-cryptocompare`
green.
- [x] Step 2 — `bunx turbo test:coverage --filter=@suaveplan/currency-provider-cryptocompare`
reports 100/100/100/100 via istanbul.
- [x] Step 3 — `bunx turbo build --filter=@suaveplan/currency-provider-cryptocompare`
green.
- [x] Step 4 — banned-pattern grep returns zero.
- [x] Step 4a — barrel-shape grep returns zero (`src/index.ts` exempt).
- [x] Step 4b — test-runner-import grep returns zero.
- [x] Step 5 — missing-`.md` grep returns zero.
- [x] Step 6 — README present.
- [x] Step 7 — bare-version grep returns zero.
- [x] Step 8 — subpath-export count = 1 (`./cryptocompare/cryptocompare`).
- [x] Step 9 — security-scan grep returns zero.
- [x] Step 10 — no dependents (new package).
## Root-doc refresh (AGENTS.md §13b)
- [x] Re-run `bun scripts/folder-reorg/generate-manifest.ts` to refresh
`MANIFEST.md`.
- [x] Re-run `bun scripts/generate-missing.ts` to refresh `MISSING.yml`.
- [x] Update `STATUS.md` row for `@suaveplan/currency-provider-cryptocompare`.
- [x] Update `SUMMARY.md` row likewise.
- [x] `bunx markdownlint-cli2 --fix` across touched root + change files.
## Archive (AGENTS.md §14)
- [x] Fold `specs/currency-provider-cryptocompare/spec.md` into
`openspec/specs/currency-provider-cryptocompare/spec.md`.
- [x] Move change folder to
`openspec/archive/2026-05-17-add-currency-provider-cryptocompare/`.