WORK-080
ID:WORK-080Status:done

Refactor Realm and Faction Transforms to Use Shared Utilities

Priority:highComplexity:moderateSource:SPEC-028
claude/file-naming-convention-LJdwR View source

Criteria completion

No incremental history — criteria tracking started on Apr 21.

Branches 2
claude/file-naming-convention-LJdwR current done
main donechangeset-release/main done
History 2
  1. bbbb94c
    Created (done)by bjornolofandersson
  2. f2b3512
    Content editedby Claude
    Add {ID}-{slug}.md filename convention + migrate filenames subcommand

Summary

Realm and Faction share ~90% identical transform code (scene image extraction, description rendering, layout meta tags, content building, createComponentRenderable structure). Refactor both to use the shared utilities from WORK-076 and WORK-077, align their section structure to the standard 3-section pattern, and fix Faction's missing mediaSlots config.

Acceptance Criteria

  • Realm transform uses shared buildLayoutMetas() from WORK-076
  • Faction transform uses shared buildLayoutMetas() from WORK-076
  • Both transforms use shared extractMediaImage() from WORK-077 (replacing ~15-line inline unwrap loops)
  • Shared storytelling helpers extracted for any remaining duplicated patterns between Realm and Faction
  • Faction config declares mediaSlots: { scene: 'cover' } and corresponding sections entry for scene: 'media'
  • Both runes follow standard 3-section structure (meta, content with preamble, media)
  • Realm config sections aligned to standard pattern (preamble inside content)
  • All existing tests pass (update snapshots if structure changes)

Approach

  1. Apply shared utilities from WORK-076 and WORK-077 to both transforms
  2. Extract any remaining duplicated storytelling-specific logic into package helpers
  3. Fix Faction's missing mediaSlots and sections config
  4. Align section structure to standard pattern
  5. Update test snapshots

References

  • SPEC-028 (Standard 2 — Preamble Groups with Content)
  • SPEC-028 (Standard 3 — Config Must Match Schema Capabilities)
  • SPEC-028 (Standard 4 — Avoid Duplicated Transform Logic)
  • WORK-076 (shared layout meta utility)
  • WORK-077 (shared media unwrap utility)