Skip to content

feat: add RouteKind symbol brand to core types and define functions #158

@qantrepreneur

Description

@qantrepreneur

What to build

Add a RouteKind symbol brand to the framework's route module system. definePage, defineHandler, and defineErrorPage stamp a RouteKind symbol on the config they return, enabling nominal type discrimination instead of structural checks ("template" in module).

  • RouteKind = Symbol.for("sundayceo.routeKind") exported from core/index.ts
  • PageModule type includes [RouteKind]: "page"
  • HandlerModule type includes [RouteKind]: "handler"
  • Error pages are branded "page" (they are pages from the pipeline's perspective)
  • definePage, defineHandler, defineErrorPage stop being identity functions — they spread the input and stamp the brand
  • RouteKind exported from index.ts

This is additive — existing named exports still work after this slice. The switch to export default and updated dispatch logic comes in the next slice.

Acceptance criteria

  • RouteKind symbol defined and exported from core/index.ts
  • PageModule type includes [RouteKind]: "page"
  • HandlerModule type includes [RouteKind]: "handler"
  • definePage stamps [RouteKind]: "page" on returned config
  • defineHandler stamps [RouteKind]: "handler" on returned config
  • defineErrorPage stamps [RouteKind]: "page" on returned config
  • RouteKind re-exported from package index.ts
  • Type tests updated
  • All existing tests pass

Blocked by

None - can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentTriaged and ready for implementationready-for-reviewPR is up, CI green, needs human review

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions