Relationships
Branches 1
History 1
3091366Created (proposed)
Context
Site templates (SPEC-109) package a purpose-built site — a content tree plus a config fragment and a recommended theme. A foundational question shapes the whole format: when an author "uses" a template, does its content become part of their project (copied in, owned, edited freely), or does it stay a dependency resolved from node_modules and rendered in place?
The answer cuts across the rest of the design: how the content is delivered, whether and how it updates, how it composes with the framework starter and theme, and what the install/scaffold command actually does. It also needs to sit coherently beside themes, which are live dependencies (ADR-009) precisely because their value is in receiving updates.
The two layers have opposite editing models. A theme is something an author configures and otherwise leaves alone; shipping fixes/improvements to it via a version bump is a feature. A template's content is the first thing an author rewrites — it is a starting point, not a managed surface. That asymmetry is the crux.
Decision
Adopt Option 2: templates are scaffold-copied. The content tree is copied into the new project and owned by the author; the configFragment is merged into the generated config; the recommended theme and required plugins are pinned as live dependencies. Templates are not served from, or updated via, node_modules.
Rationale
The decision follows from the editing model of what each layer delivers. Content is rewritten; themes are configured and left alone. Delivering rewritable content as an auto-updating dependency creates a merge problem with no good resolution, while delivering it as a copy matches exactly how every template marketplace and starter kit already works — you get a copy and make it yours.
Keeping the theme and plugins as live dependencies preserves the one update path that is valuable (ADR-009 made themes framework-agnostic packages specifically so they could evolve independently), and it produces a crisp, teachable distinction: theme = live dependency, template = one-time copy. That distinction also disambiguates the shared install surface (SPEC-110): source resolution is common, but the apply step is "add dependency" for a theme and "copy + merge" for a template.
Consequences
create-refraktcomposes three inputs — framework starter, copied template content, and a pinned theme dependency — merging the template's framework-agnosticconfigFragmentinto the generatedrefrakt.config.jsonand injecting frameworktarget/dependency wiring.- Templates carry no post-scaffold update channel for their content; improvements reach authors as new templates to scaffold from, not as updates to existing projects.
- Because copied content references rune syntax that evolves, every first-party template must be scaffold-built in CI (and, where applicable, visually regressed via the SPEC-094 harness) so rune-syntax drift can't silently rot a template.
- The shared install/resolution helper (SPEC-110) branches on artifact kind: dependency-add for themes, scaffold-copy for templates.
- Section/page-level templates, if introduced later, inherit the same copy semantics (a one-page template is still copied, not depended upon).
References
- Site templates spec: SPEC-109.
- Shared install robustness (resolution vs. apply semantics): SPEC-110.
- Framework-agnostic theme packages (why themes are live dependencies): ADR-009.
- Theme system foundations (CI gallery/visual-regression harness): SPEC-094.
- Scaffolding today:
packages/create-refrakt/src/scaffold.ts,packages/create-refrakt/src/bin.ts.