ID:WORK-042Status:donePriority:mediumComplexity:moderate
Config-aware theme resolution for plan site
Update the plan site's resolveThemeCss() to read refrakt.config.json when no --theme flag is provided, so the plan site automatically uses the project's installed theme.
When a theme package is specified in config, resolve its CSS (design tokens + base styles) and layer it under the plan rune CSS. When resolution fails or no config exists, fall back to the built-in default theme.
Acceptance Criteria
- When
--themeis omitted andrefrakt.config.jsonexists with athemefield, that theme is used - Theme package is resolved via its npm package exports (
package/htmlorpackage/base.css) --themeflag still overrides config when provided--theme defaultand--theme minimalstill use built-in themes regardless of config- When config exists but theme resolution fails, falls back to built-in default with a warning
- When no config exists, uses built-in default (standalone mode unchanged)
--theme luminaworks as shorthand for@refrakt-md/lumina
Approach
- In
resolveThemeCss(), check if--themewas explicitly provided - If not, look for
refrakt.config.jsonin the working directory (or--configpath) - If config has
theme, attempt to resolve it as an npm package - Load the theme's
ThemeConfigfrompackage/transformexport and merge with plan rune configs - Load CSS from the theme package's base export
- Fall back gracefully on any error
References
- ADR-004 (Plan Site Theme Resolution)
- SPEC-014 (Plan Site via HTML Adapter)
- WORK-039 (the refactored pipeline this builds on)