You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A console needs a way in before it needs screens, and the table list is already in _meta. This adds the one part of auto-admin that needs no query runtime: navigation as a document.
The lowering is a pure function in meta-to-blocks (src/nav.ts), so a sidebar follows the database instead of a hand-maintained route list:
one NavGroup per schemaName (titleized, count of its links), or flat: true for a single group;
junction tables are dropped — they are discovered from table.relations.manyToMany[].junctionTable.name, not by name heuristics — unless includeJunctionTables is set;
href, label, tables / omitTables, tableOrder, schemaLabels, and per-table overrides (label, href, icon, omit) are the customization surface; the default route is `/${table.name}`.
blocks-ui registers the three types. NavLink is a plain anchor and takes its current state from the scope rather than a second source of truth:
A node with a click action gets preventDefault + onAction, so a host keeps client-side routing either through actions or by overriding NavLink with its framework's Link.
Nav, NavGroup, NavLink join BLOCK_NODE_TYPES in blocks-schema, which is additive — the vocabulary is a superset, so existing documents and registries are unaffected.
Rendering
/blocks/documents gains a "Navigation from database metadata" section: six fixture tables across two schemas render as a live sidebar next to the generated JSON, with a scope.pathname selector so the active-link behavior is visible. The join table (post_categories) is absent from the nav by construction. Docs links are hash-based to keep the static-page reference check satisfied; the code sample shows the real /admin/:schema/:table route builder.
Verification
pnpm check and pnpm build:pages pass. 8 new tests (5 lowering, 3 rendering).
This PR introduces an end-to-end navigation feature across three packages plus docs and demos. packages/blocks-schema/src/node.ts registers Nav, NavGroup, and NavLink in BLOCK_NODE_TYPES. packages/meta-to-blocks adds nav.ts/types.ts/index.ts exposing metaToNavNodes, parseNavDocument, and NavOptions/NavTableOverride, lowering _meta tables (with join-table omission, schema grouping, and per-table label/href/omit overrides) into a nav document. packages/blocks-ui adds nav.tsx (active-link highlighting, click-action deferral, aria-current), registry.ts, and index exports for the new Nav block, with tests in both packages. apps/blocks adds a documents page and showcase demo; READMEs and package manifests are updated. Review found no findings meeting the confidence threshold; several candidate issues (href scheme sanitization, flat-mode <li> wrapping, junction schema-qualification, CHILD_BEARING_BLOCKS coverage) were verified but fell below the keep threshold and are noted as lower-confidence considerations rather than blocking findings.
Files
Change
packages/blocks-schema/src/node.ts
Registers Nav/NavGroup/NavLink block node types.
packages/meta-to-blocks/src/{nav,types,index}.ts
Adds _meta-table-to-nav-document lowering with NavOptions/NavTableOverride.
post_categories (the manyToMany junction) appears nowhere: 0 occurrences in the rendered DOM, absent from the generated JSON, absent from the scope.pathname select (5 options).
JSON panel renders Page > Nav > NavGroup(count) > NavLink(href/table/schemaName/description) and scrolls inside its own box.
scope.pathname drives the active link
#app_private/feature_flags
#app_public/categories
Each change moves both the accent highlight and aria-current="page"; exactly one nav-demo anchor is current at a time.
Light theme
No console errors or hydration warnings.
Labels are sentence case ("Audit log entries") because they go through the existing titleize in meta-to-blocks, which is what form labels and column headers already use — left as-is for consistency rather than special-cased for nav.
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
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.
Summary
A console needs a way in before it needs screens, and the table list is already in
_meta. This adds the one part of auto-admin that needs no query runtime: navigation as a document.The lowering is a pure function in
meta-to-blocks(src/nav.ts), so a sidebar follows the database instead of a hand-maintained route list:NavGroupperschemaName(titleized,countof its links), orflat: truefor a single group;table.relations.manyToMany[].junctionTable.name, not by name heuristics — unlessincludeJunctionTablesis set;href,label,tables/omitTables,tableOrder,schemaLabels, and per-table overrides (label,href,icon,omit) are the customization surface; the default route is`/${table.name}`.blocks-uiregisters the three types.NavLinkis a plain anchor and takes its current state from the scope rather than a second source of truth:A node with a
clickaction getspreventDefault+onAction, so a host keeps client-side routing either through actions or by overridingNavLinkwith its framework'sLink.Nav,NavGroup,NavLinkjoinBLOCK_NODE_TYPESinblocks-schema, which is additive — the vocabulary is a superset, so existing documents and registries are unaffected.Rendering
/blocks/documentsgains a "Navigation from database metadata" section: six fixture tables across two schemas render as a live sidebar next to the generated JSON, with ascope.pathnameselector so the active-link behavior is visible. The join table (post_categories) is absent from the nav by construction. Docs links are hash-based to keep the static-page reference check satisfied; the code sample shows the real/admin/:schema/:tableroute builder.Verification
pnpm checkandpnpm build:pagespass. 8 new tests (5 lowering, 3 rendering).Link to Devin session: https://app.devin.ai/sessions/027937d092794c92a31c6ee49c513f59
Requested by: @pyramation