Files
James 5ed196c53a refactor: address simplify review feedback on registry module
Applied a pass of review feedback that concentrates on correctness,
shared constants, and cleanup.

- Lift ITEM_TYPE_DIRS to @hyperframes/core/registry. Replaces an
  exhaustiveness-fragile switch in remote.ts and the hardcoded
  "examples" literal in scripts/generate-registry-items.ts. One
  constant, three consumers, checked against the ItemType union.
- remote.ts readCache: drop existsSync pre-check (TOCTOU double
  syscall) and rely on the existing try/catch for cache miss.
- templates/remote.ts: hoist the listRegistryItems/loadAllItems
  dynamic import to static — had no reason to be async-lazy.
- resolver.ts loadAllItems: accept an optional onWarn callback
  instead of calling console.warn directly. Default writes to stderr
  with a "hyperframes:registry" prefix so structured output (JSON,
  clack prompts) can opt in to silence.
- Scrub PR-number references from inline comments in the registry
  and compat-shim files. Intent language instead ("future item types",
  "compat shim for legacy init.ts callers").
- Fix stale test description in remote.test.ts that claimed PR 3
  renamed MANIFEST_FILENAME to registry.json (the rename didn't
  happen — the filename stays templates.json for the compat shim).

Skipped (documented as intentional in PR thread):
- Lifting assertSafeTarget to @hyperframes/core — CLI-specific
  concern, keeps core lean
- Extracting readCache/writeCache to utils/cache.ts — one consumer
  today; revisit when the CLI gets a second
- Hashing the cache-key slug — theoretical collision for a single-
  digit registry count; revisit when PR 14 adds custom registries
- Removing assertSafeTarget's layered checks — reviewer confirmed
  defense-in-depth is worth keeping for diagnostic clarity

Core: 452 tests pass. CLI: 70 tests pass (4 pre-existing failures
unchanged, unrelated to this PR). Format + lint clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 03:22:25 +00:00
..