WORK-112
ID:WORK-112Status:done

Implement named slots with ordering for structure entries

Add a slots array to RuneConfig and slot/order fields to StructureEntry. The engine assembles children by iterating slots in declared order instead of using binary before/after placement. This is the core structural change in SPEC-033 that enables multi-zone layouts.

Priority:highComplexity:moderateMilestone:v1.0.0Source:SPEC-033
changeset-release/main View source

Criteria completion

No incremental history — criteria tracking started on Apr 19.

Branches 3
History 5
  1. f2b3512
    Content editedby Claude
    Add {ID}-{slug}.md filename convention + migrate filenames subcommand
  2. 59ded4a
    Content editedby Claude
    Implement SPEC-037 plan package hardening: all 7 work items
  3. f262d7b
    Content editedby Claude
    Backfill source attributes on all 123 work items
  4. da12420
    Content editedby Claude
    Update 8 work items to done status
  5. 41d5c52
    Created (done)by Claude
    Accept SPEC-033 and break down into work items WORK-110–116

Acceptance Criteria

  • RuneConfig in packages/transform/src/types.ts has slots?: string[]
  • StructureEntry has slot?: string and order?: number fields
  • When slots is declared, the engine assembles children by iterating slots in order, collecting structure entries per slot sorted by order, and placing content children at the 'content' slot
  • When slots is not declared, existing before/after behavior is unchanged (backward compatible)
  • When slots is declared, before: true maps to the first non-content slot and before: false maps to the last non-content slot
  • Explicit slot assignments take precedence over before mapping
  • mergeThemeConfig merges slots arrays (theme replaces base) and structure entries with slot assignments
  • Unit tests cover: slot assembly ordering, order within slots, content slot placement, backward compat without slots, before-to-slot mapping, merge behavior
  • TypeScript compiles cleanly across all packages
  • All existing tests pass

Approach

  1. Add interface changes to packages/transform/src/types.ts
  2. Modify the engine's child assembly logic in packages/transform/src/engine.ts to support slot-based ordering when slots is present
  3. Implement the backward-compat mapping from before to slot positions
  4. Update mergeThemeConfig in packages/transform/src/merge.ts
  5. Write comprehensive tests for slot assembly, ordering, and backward compat

References

  • SPEC-033 (Feature 1 — Named Slots with Ordering)
  • WORK-110 (value mapping should land first)
  • WORK-111 (density contexts should land first)