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

5.6 KiB
Raw Permalink Blame History

Tasks — split-font-compress

Every checkbox MUST reflect work actually done in this change.

1. Spec authoring

  • 1.1 Read openspec/AGENTS.md §0, §0a, §0c, §6a, §7, §13, §14
  • 1.2 Audit current packages/fonts/font-compress/src/ — every TS file enumerated; cross-module imports mapped
  • 1.3 Audit current consumers monorepo-wide — verified zero TS importers of @suaveplan/font-compress
  • 1.4 Draft proposal.md covering scope, source mapping, parity, affected dependents
  • 1.5 Draft design.md covering file layout for both packages, constant duplication, error-code split
  • 1.6 Draft specs/font-decompress/spec.md — new capability, post-split shape
  • 1.7 Draft specs/font-compress/spec.md — first canonical, post-split shape
  • 1.8 Every requirement carries **Verified by:** line at draft time
  • 1.9 openspec validate split-font-compress clean

2. Create @suaveplan/font-decompress

  • 2.1 mkdir -p packages/fonts/font-decompress/{src/{constants,utils,unpacker/binary-font-unpacker},tests/setup}
  • 2.2 Write package.json v0.0.0 with subpath exports and deps
  • 2.3 Write tsconfig.json, tsconfig.lib.json, vite.config.ts, vitest.config.ts, tests/setup/polyfills.ts, README.md (≥ 200 words, all required sections)
  • 2.4 Copy src/constants/index.ts verbatim from font-compress
  • 2.5 Author src/error-codes.ts — FONT_DECOMPRESS_CODES = { UNPACK_FAILED, INVALID_DATA }, FontDecompressError extends SuaveplanError<FontDecompressErrorCode>
  • 2.6 Author src/error-codes.test.ts — every code reachable, cause chain preserved
  • 2.7 Author src/error-codes.md
  • 2.8 Move decodeString from font-compress's utils/encode-string.ts to new src/utils/decode-string.ts (separate file per CLAUDE.md per-feature layout)
  • 2.9 Author src/utils/decode-string.test.ts — round-trip with known vectors
  • 2.10 Author src/utils/decode-string.md
  • 2.11 Move binary-font-unpacker.ts (+ test, + .md, + index.ts) from font-compress's unpacker/binary-font-unpacker/ to new src/unpacker/binary-font-unpacker/
  • 2.12 Update internal imports in the moved files to point at the new package-local error registry and constants module
  • 2.13 Author src/index.ts root barrel with explicit named exports
  • 2.14 bun install to register the new workspace
  • 2.15 bunx biome check --write --unsafe src/ clean
  • 2.16 bunx tsc --noEmit -p tsconfig.lib.json clean
  • 2.17 bunx vitest run --coverage with 100/100/100/100 Istanbul thresholds clean
  • 2.18 bun run ../../../scripts/docs-check.ts . 100%

3. Trim @suaveplan/font-compress

  • 3.1 Delete src/unpacker/ directory in font-compress
  • 3.2 Trim src/utils/encode-string.ts to encodeString only; update test file accordingly; update sibling .md
  • 3.3 Trim src/error-codes.ts — remove UNPACK_FAILED from FONT_COMPRESS_CODES. Update the error-codes test and .md.
  • 3.4 Remove the BinaryFontUnpacker + createBinaryFontUnpacker exports from src/index.ts
  • 3.5 Remove the ./unpacker/binary-font-unpacker subpath export from package.json
  • 3.6 Update README.md to reflect packer-only scope (≥ 200 words, all required sections)
  • 3.7 bunx biome check --write --unsafe src/ clean
  • 3.8 bunx tsc --noEmit -p tsconfig.lib.json clean
  • 3.9 bunx vitest run --coverage with 100/100/100/100 Istanbul thresholds clean
  • 3.10 bun run ../../../scripts/docs-check.ts . 100%

4. Cross-package verification

  • 4.1 bunx turbo lint typecheck test --filter=@suaveplan/font-compress green
  • 4.2 bunx turbo lint typecheck test --filter=@suaveplan/font-decompress green
  • 4.3 bunx turbo test:coverage --filter=@suaveplan/font-compress 100/100/100/100
  • 4.4 bunx turbo test:coverage --filter=@suaveplan/font-decompress 100/100/100/100
  • 4.5 bunx turbo build --filter=@suaveplan/font-compress succeeds; dist contains the trimmed subpath set
  • 4.6 bunx turbo build --filter=@suaveplan/font-decompress succeeds; dist contains advertised subpaths
  • 4.7 grep -rE "from ['\"](vitest|bun:test)['\"]" packages/fonts/font-compress/src/ packages/fonts/font-decompress/src/ → zero matches (rule §7)
  • 4.8 grep -rE "^export \*" packages/fonts/font-compress/src/ packages/fonts/font-decompress/src/ → only root barrels and exempt forms (rule §6a)
  • 4.9 grep -rE "from ['\"](node:|bun:|fs|path|stream|net|http)['\"]" packages/fonts/font-compress/src/ packages/fonts/font-decompress/src/ → zero matches (universal tier)
  • 4.10 grep -rE "@deprecated|TODO|FIXME|ts-ignore|ts-expect-error|\\.skip|\\.only|\\bany\\b|console\\.log" packages/fonts/font-compress/src/ packages/fonts/font-decompress/src/ --include="*.ts" → zero matches

5. Fold + archive

  • 5.1 Fold specs/font-compress/spec.md into openspec/specs/font-compress/spec.md (new canonical for an existing package — converts ADDED → Requirements, prepends Purpose)
  • 5.2 Fold specs/font-decompress/spec.md into openspec/specs/font-decompress/spec.md (new canonical for the new package)
  • 5.3 openspec validate font-compress and openspec validate font-decompress both clean
  • 5.4 Move openspec/changes/split-font-compress/ → openspec/archive/$(date +%Y-%m-%d)-split-font-compress/
  • 5.5 bun scripts/folder-reorg/generate-manifest.ts — MANIFEST.md reflects both packages
  • 5.6 STATUS.md rows updated: @suaveplan/font-compress description trimmed to packer-only; @suaveplan/font-decompress flipped from – to ✅
  • 5.7 Commit per CLAUDE.md style; no push without explicit user approval