WORK-059
ID:WORK-059Status:done

Metadata Dimensions on StructureEntry

Priority:highComplexity:moderateMilestone:v0.9.0Source:SPEC-024

Criteria completion

Criteria completion: 7 of 7 (100%) checked; history from Mar 24 to Mar 240%25%50%75%100%Mar 24Mar 24
Branches 3
History 5
  1. e900a90
    Created (done)by bjornolofandersson
  2. f262d7b
    Content editedby Claude
  3. 4954888
    • ☑ `StructureEntry` in `packages/transform/src/types.ts` gains `metaType`, `metaRank`, and `sentimentMap` optional fields
    • ☑ Identity transform engine emits `data-meta-type` when `metaType` is present on a structure entry child
    • ☑ Identity transform engine emits `data-meta-rank` when `metaRank` is present
    • ☑ Identity transform engine resolves sentiment by looking up the current modifier value in `sentimentMap`, emitting `data-meta-sentiment` when a match exists
    • ☑ Existing structure entries without metadata fields continue to work unchanged (backwards compatible)
    • ☑ `refrakt inspect` output shows the new data attributes on badge elements
    • ☑ Unit tests in `packages/transform/test/` verify metadata attribute emission for: status with sentiment, category without sentiment, temporal, quantity, tag, and id types
    by Claude
  4. a129a9e
    Content editedby Claude
  5. a333007
    Created (ready)by Claude
    Add work items for SPEC-024 (Metadata) and SPEC-025 (Universal Theming)

Summary

Add three semantic metadata fields to the StructureEntry interface: metaType, metaRank, and sentimentMap. The identity transform reads these from rune configs and emits data-meta-type, data-meta-rank, and data-meta-sentiment attributes on generated badge elements. This is the foundation that enables themes to style every metadata badge generically with ~18 CSS rules.

Acceptance Criteria

  • StructureEntry in packages/transform/src/types.ts gains metaType, metaRank, and sentimentMap optional fields
  • Identity transform engine emits data-meta-type when metaType is present on a structure entry child
  • Identity transform engine emits data-meta-rank when metaRank is present
  • Identity transform engine resolves sentiment by looking up the current modifier value in sentimentMap, emitting data-meta-sentiment when a match exists
  • Existing structure entries without metadata fields continue to work unchanged (backwards compatible)
  • refrakt inspect output shows the new data attributes on badge elements
  • Unit tests in packages/transform/test/ verify metadata attribute emission for: status with sentiment, category without sentiment, temporal, quantity, tag, and id types

Approach

  1. Extend StructureEntry interface in packages/transform/src/types.ts with the three optional fields
  2. In packages/transform/src/engine.ts, in the code path that processes structure entry children, add logic to: read metaType and emit data-meta-type, read metaRank and emit data-meta-rank, look up the current modifier value in sentimentMap and emit data-meta-sentiment if found
  3. The existing data-{modifier-name} attributes continue to be emitted as before — metadata attributes are additive

References

  • SPEC-024 (Metadata System — Extending StructureEntry, Identity Transform)