ID:WORK-113Status:readyPriority:mediumComplexity:moderateMilestone:v1.0.0
Add repeated element generation to structure entries
Extend StructureEntry with a repeat field that generates N copies of a template element, with optional filled/unfilled distinction. Eliminates the testimonial rune's postTransform for star ratings.
Acceptance Criteria
StructureEntryinpackages/transform/src/types.tshas arepeatfield withcount(modifier name),max(cap, default 10),filled(optional modifier name),element(template), andfilledElement(optional template)- The engine's
buildStructureElementgeneratescountcopies whenrepeatis present - When
filledis specified, the first N elements getdata-filled="true"(or usefilledElement), the rest getdata-filled="false"(or useelement) - The
maxcap prevents runaway generation - Non-numeric or missing count values produce zero elements (no crash)
- Unit tests cover: basic repetition, filled/unfilled split, max cap, edge cases (0, negative, non-numeric)
- TypeScript compiles cleanly
- All existing tests pass
Approach
- Add the
repeatinterface toStructureEntryin types - In the engine's structure element building, detect
repeatand generate child elements in a loop - Read count and filled values from the modifier map (already resolved at that point)
- Apply the filled/unfilled logic
- Write tests
References
- SPEC-033 (Feature 3 — Repeated Elements)
- WORK-112 (slots should land first so repeat can target slots)