WORK-121
ID:WORK-121Status:done

Add component interface view to refrakt inspect

Priority:mediumComplexity:simpleMilestone:v1.0.0Source:ADR-008
changeset-release/main View source
Branches 3
History 6
  1. f2b3512
    Content editedby Claude
    Add {ID}-{slug}.md filename convention + migrate filenames subcommand
  2. 1676387
    Content editedby Claude
    Accept SPEC-037 and break into work items; fix plan validation issues
  3. f262d7b
    Content editedby Claude
    Backfill source attributes on all 123 work items
  4. c435d57
    Content editedby Claude
    Mark ADR-008 work items WORK-117 through WORK-122 as done
  5. dca6250
    Content editedby Claude
    Assign WORK-117 through WORK-122 to milestone v1.0.0
  6. ece282c
    Created (done)by Claude
    Add work items WORK-117 through WORK-122 for ADR-008 implementation

Summary

Extend refrakt inspect to show the component override interface for a rune — what props and slots a component would receive. This makes the contract discoverable from the CLI without reading source code.

Acceptance Criteria

  • refrakt inspect <rune> --interface (or similar flag) outputs the component interface
  • Output shows property names with their types (string, number, union values)
  • Output shows slot names (top-level ref names)
  • Output shows which slots are always present vs conditional
  • Works for both core and community package runes
  • --json flag produces machine-readable output of the interface

Approach

  1. After running the identity transform for the inspected rune, call the extraction utility on the output
  2. Collect property names from properties keys, types from schema attribute definitions
  3. Collect slot names from top-level refs keys
  4. Format and display

Resolution

Completed: 2026-04-04

Branch: claude/adr-008-implementation-nBN9K

What was done

  • Added --interface flag to packages/cli/src/bin.ts argument parser
  • Added showComponentInterface() function in packages/cli/src/commands/inspect.ts
  • Added findRuneTag() and findFirstRuneTag() helpers for tree search
  • Human-readable output shows Properties, Slots, and Svelte 5 Usage example
  • JSON output includes rune name, typeName, properties with types/examples, slots, and hasAnonymousContent
  • Updated CLI help text with --interface flag and example

Notes

  • Uses the serialized (pre-identity-transform) tree since properties are consumed by the engine
  • Falls back to findFirstRuneTag when data-rune doesn't match CLI name (e.g., tabs → tab-group)
  • Schema attribute types used for richer type info in output (union literals for enum matches)