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
Blocked by
None - can start immediately
What to build
Add a
RouteKindsymbol brand to the framework's route module system.definePage,defineHandler, anddefineErrorPagestamp aRouteKindsymbol on the config they return, enabling nominal type discrimination instead of structural checks ("template" in module).RouteKind = Symbol.for("sundayceo.routeKind")exported fromcore/index.tsPageModuletype includes[RouteKind]: "page"HandlerModuletype includes[RouteKind]: "handler""page"(they are pages from the pipeline's perspective)definePage,defineHandler,defineErrorPagestop being identity functions — they spread the input and stamp the brandRouteKindexported fromindex.tsThis is additive — existing named exports still work after this slice. The switch to
export defaultand updated dispatch logic comes in the next slice.Acceptance criteria
RouteKindsymbol defined and exported fromcore/index.tsPageModuletype includes[RouteKind]: "page"HandlerModuletype includes[RouteKind]: "handler"definePagestamps[RouteKind]: "page"on returned configdefineHandlerstamps[RouteKind]: "handler"on returned configdefineErrorPagestamps[RouteKind]: "page"on returned configRouteKindre-exported from packageindex.tsBlocked by
None - can start immediately