feat: router adapters — React Router + Next.js routes → page components (B4)#18
Merged
officialCodeWork merged 1 commit intoJul 14, 2026
Conversation
…ts (B4) Step 3.1. RouteNode (path/router/layout/guards) + routes-to edge in core; parser adapters for createBrowserRouter object trees and <Route> JSX trees (nested paths, index routes, pathless guard routes, inline guard wrappers, lazy route modules) and Next.js file-based routing (app router with [param]/ [...catchAll]/(group) segments and nearest layout.tsx, pages router with _app/api exclusions — gated on next.config/next dependency so plain repos with a pages/ folder don't sprout fake routes). Unresolvable pages emit flagged route nodes, never silence. Eval: routes + forbiddenRoutes checks; fixtures b4-react-router, b4-nextjs-approuter — scorecard 161/0/0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 3.1 — Router adapters (Phase 3 opener, failure mode B4)
Routes are the journey graph's entry points: this step teaches the graph which page component every URL renders.
Core
RouteNode—{ path, router, layout, guards }, path patterns in:paramform (catch-alls as:param*) so step 3.2'snavigate(...)effects join on the same shape.routes-toedge: route → page component definition (its instances form the page tree).Parser —
routes.tscreateBrowserRouter/createHashRouter/createMemoryRouterobject trees and<Route>JSX trees (incl.createRoutesFromElements). Nested path joining, index routes, pathless guard routes, inline guard wrappers (element={<RequireAuth><AuditLog/></RequireAuth>}),Componentprop, and lazy routes — bothlazy: () => import(...)(moduleComponent/default export) andReact.lazyvariables.[param]→:param,[...catchAll]→:catchAll*,(group)dropped, nearest ancestorlayout.tsxrecorded) and pages router (indexcollapse,_app/_document/api/**excluded). Gated onnext.config.*or anextdependency so a plain React repo with apages/folder doesn't sprout fake routes.Require*/Protected*/Private*/;*Guardare guards; other wrappers are the nearest layout. Unresolvable pages emit route nodes flaggedunresolved-page— visible, never silent.Eval
routes+forbiddenRoutesgolden checks (forbidden routes never xfail, like poison attributions).b4-react-router(8 routes across both declaration styles) andb4-nextjs-approuter(6 routes incl. a pages-router leftover).Acceptance
TRACKER updated: 3.1 done, next 3.2 (action effects).
🤖 Generated with Claude Code