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

4.3 KiB

Tasks — Add @suaveplan/money

1. Spec authoring

  • 1.1 Read ../suaveplan/enterprise/money.md end-to-end
  • 1.2 Read openspec/specs/money/spec.md (does not exist — this is a new package)
  • 1.3 Read openspec/AGENTS.md Sections 13 and 14
  • 1.4 Draft proposal.md from openspec/templates/proposal.md
  • 1.5 Fill in ## Source mapping table — every requirement cites a line range OR appears in the "no source line" table with justification
  • 1.6 Draft specs/money/spec.md from openspec/templates/spec-delta.md
  • 1.7 Every requirement in the spec delta carries a **Verified by:** line naming concrete it(...) titles

2. Implementation

  • 2.1 Scaffold packages/finance/money/ (package.json, tsconfig.json, tsconfig.lib.json, vite.config.ts, vitest.config.ts, tests/setup/polyfills.ts)
  • 2.2 Implement src/error-codes/error-codes.ts (MONEY_CODES registry + MoneyError class)
  • 2.3 Implement src/types/common.ts (re-export of all public types)
  • 2.4 Implement src/currencies/currencies.ts (registry + 30 fiat + 5 crypto built-ins + helpers)
  • 2.5 Implement src/money/money.ts (Money class + applyRounding + hardened parseDecimalString)
  • 2.6 Implement src/formatter/formatter.ts (formatMoney + formatMoneyCompact)
  • 2.7 Implement src/allocator/allocator.ts (allocators + aggregators)
  • 2.8 Write root src/index.ts barrel with explicit named re-exports
  • 2.9 Write per-feature index.ts barrels with explicit named re-exports

3. Tests

  • 3.1 src/error-codes/error-codes.test.ts — every MONEY.* code reachable from a real call site
  • 3.2 src/money/money.test.ts — constructors, arithmetic, comparison, conversion, JSON round-trip, rounding modes, parse error
  • 3.3 src/currencies/currencies.test.ts — lookup, registration, virtual-currency helpers, unknown-currency raise
  • 3.4 src/formatter/formatter.test.ts — locale matrix, options matrix, compact formatter
  • 3.5 src/allocator/allocator.test.ts — total-preservation invariant, all raise cases, aggregator cross-currency raise
  • 3.6 Every it(...) carries { timeout: 5000 }
  • 3.7 Every test imports runner primitives from @suaveplan/testing/runner

4. Documentation

  • 4.1 Sibling .md for every implementation .ts (≥200 words, basic + advanced examples, full API reference)
  • 4.2 README at package root linking every co-located .md under ## Modules
  • 4.3 Update root STATUS.md and SUMMARY.md rows for @suaveplan/money (Pending → Completed)

5. Pre-archive verification (the 5-gate triple)

  • 5.1 bun run check — Biome clean across touched files
  • 5.2 bunx turbo lint typecheck test --filter=@suaveplan/money — green
  • 5.3 bunx turbo test:coverage --filter=@suaveplan/money — 100/100/100/100
  • 5.4 Spec-conformance: every requirement in spec.md has a real test that pins it
  • 5.5 bunx turbo build --filter=@suaveplan/money — green

6. Pre-archive 9-row checklist (SKILL.md Step 7)

  • 6.1 Generics threaded; expectTypeOf assertions where literal types matter (N/A — package surface is value-level, not type-level beyond standard generics)
  • 6.2 Zod schemas wired at every declared boundary (N/A — package has no network boundary; explicitly deferred to @suaveplan/api-schemas)
  • 6.3 Every error code in MONEY_CODES thrown by at least one production path
  • 6.4 Strict-mode behaviors tested both on and off (N/A — package has no strict-mode toggle)
  • 6.5 OTel instruments emitted from production paths (N/A — universal-tier package; no observability surface in this migration)
  • 6.6 Lifecycle dedup tested where claimed (N/A — package is stateless aside from the module-level currency map, which has its own tests)
  • 6.7 No retroactive tick — every box above reflects work done in this change
  • 6.8 No export * in any feature-module barrel (verified by §13 step 4a)
  • 6.9 No direct vitest / bun:test imports in test files (verified by §13 step 4b)

7. Archive

  • 7.1 Fold spec delta into openspec/specs/money/spec.md
  • 7.2 Move openspec/changes/add-money/ → openspec/archive/2026-05-17-add-money/
  • 7.3 Refresh MANIFEST.md via bun scripts/folder-reorg/generate-manifest.ts
  • 7.4 Refresh MISSING.yml via bun scripts/generate-missing.ts (if applicable)