ID:WORK-051Status:in-progressPriority:highComplexity:complexMilestone:v0.9.0
Editor Package Awareness
Summary
The editor (packages/editor/) only sees core runes. It doesn't load community or official packages from refrakt.config.json, so package runes don't appear in the palette, fail to parse in preview, and can't be edited. This gap existed before the official packages breakout but is now critical — official @refrakt-md/* runes like hero, character, and api are invisible to the editor.
The SvelteKit plugin (packages/sveltekit/src/plugin.ts) and CLI inspect command already load packages via loadRunePackage() + mergePackages(). The editor needs the same treatment.
Acceptance Criteria
- Editor loads packages from
refrakt.config.jsonon startup usingloadRunePackage()+mergePackages() - Package runes appear in the rune palette (
/api/runesendpoint) - Package runes parse and render correctly in the preview panel
- Rune palette groups package runes by package name (using
RunePackage.displayName) CHILD_RUNESset is derived from rune schemas rather than hardcodedRUNE_CATEGORIESmap uses packagedisplayNamefor package runes instead of hardcoded categories- Package
RuneConfigentries are included in the theme config sent to the client for preview rendering - Package
postTransformhooks survive the server→client serialisation boundary
Approach
- Pass
RefraktConfig(orconfig.packages) through tostartEditor()viaEditorOptions - Call
loadRunePackage()+mergePackages()inpackages/editor/src/server.tson startup - Feed merged tags into
Markdoc.transform()inpackages/editor/src/preview.ts - Feed merged rune metadata into the
/api/runesresponse - Feed merged
RuneConfigentries into thethemeConfigsent to the client - Replace hardcoded
CHILD_RUNESwith schema-derived detection (runes with a parent tag are children) - Replace hardcoded
RUNE_CATEGORIESwith dynamic grouping: core runes keep functional categories, package runes useRunePackage.displayName
References
- SPEC-001 (Community Runes — Product Boundaries)
- WORK-001 (Official Rune Packages — Editor impact section)