WORK-111
ID:WORK-111Status:done

Replace hardcoded density contexts with configurable childDensity

Remove the hardcoded COMPACT_CONTEXTS and MINIMAL_CONTEXTS sets from the identity transform engine and replace them with a childDensity field on RuneConfig. This lets community packages declare density behavior without modifying the engine.

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

Criteria completion

No incremental history — criteria tracking started on Apr 19.

Branches 3
History 4
  1. 59ded4a
    Content editedby Claude
    Implement SPEC-037 plan package hardening: all 7 work items
  2. f262d7b
    Content editedby Claude
    Backfill source attributes on all 123 work items
  3. da12420
    Content editedby Claude
    Update 8 work items to done status
  4. 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 childDensity?: 'compact' | 'minimal' field
  • The engine in packages/transform/src/engine.ts reads childDensity from the parent rune's config instead of checking hardcoded sets
  • data-density attribute is applied to child runes identically to current behavior
  • Core config in packages/runes/src/config.ts declares childDensity for Grid, Bento, Gallery, Showcase, Split (compact) and Backlog, DecisionLog (minimal)
  • Hardcoded COMPACT_CONTEXTS and MINIMAL_CONTEXTS sets are removed from the engine
  • Community packages can declare childDensity in their RunePackage.theme.runes config
  • All existing tests pass — HTML output is identical before and after
  • TypeScript compiles cleanly

Approach

  1. Add childDensity to RuneConfig in types
  2. Add childDensity entries to the 7 core runes in packages/runes/src/config.ts
  3. Modify the engine's density resolution to look up the parent's RuneConfig.childDensity from the theme config map
  4. Remove the hardcoded sets
  5. Verify with refrakt inspect that output is unchanged for affected runes

References

  • SPEC-033 (Feature 4 — Configurable Density Contexts)