WORK-020
ID:WORK-020Status:done

Add Entity Registration to @refrakt-md/plan

Priority:mediumComplexity:unknownSource:ADR-001,SPEC-002,SPEC-008

Criteria completion

Criteria completion: 4 of 7 (57%) checked; history from Mar 22 to Mar 230%25%50%75%100%Mar 22Mar 23
Branches 3
History 4
  1. e900a90
    Created (done)by bjornolofandersson
  2. f262d7b
    Content editedby Claude
  3. bcb01d8
    • ☑ Plan package exports `pipelineHooks` with a `register()` hook
    • ☑ The hook registers entities for all five rune types: `spec`, `work`, `bug`, `decision`, `milestone`
    • ☑ Each entity includes: `id`, `title` (from heading), `url` (page URL), `status`, and type-specific fields
    • ☑ Tests cover registration and resolution of all five entity types
    by Claude
  4. 6424098
    Created (pending)by Claude
    Add work items for plan xref integration

Summary

The @refrakt-md/plan package defines five rune types (spec, work, bug, decision, milestone), each with an id attribute — but the package has no pipelineHooks. This means plan entities are invisible to the xref resolution pipeline.

Add a register() hook to the plan package that scans transformed pages for plan runes and registers them in the EntityRegistry. Once registered, any page can use {% xref "SPEC-008" /%} or {% xref "WORK-015" /%} to link to plan documents.

Acceptance Criteria

  • Plan package exports pipelineHooks with a register() hook
  • The hook registers entities for all five rune types: spec, work, bug, decision, milestone
  • Each entity includes: id, title (from heading), url (page URL), status, and type-specific fields
  • {% xref "SPEC-008" /%} resolves to a link when plan content is in the pipeline
  • {% xref "WORK-015" /%} resolves with type work
  • Type hints work: {% xref "ADR-001" type="decision" /%} narrows the search
  • Tests cover registration and resolution of all five entity types

Approach

Follow the pattern in corePipelineHooks.register (packages/runes/src/config.ts). Walk each page's renderable tree, find nodes with typeof matching plan schema types (Spec, Work, Bug, Decision, Milestone), extract the id property meta tag, and call registry.register() with the appropriate entity type and data fields.