Skip to content

Share the console route tree across hosts via TanStack virtual file routes - #954

Merged
RhysSullivan merged 1 commit into
mainfrom
claude/console-route-contract
Jun 11, 2026
Merged

Share the console route tree across hosts via TanStack virtual file routes#954
RhysSullivan merged 1 commit into
mainfrom
claude/console-route-contract

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

The shared console routes (integrations, policies, secrets, tools, resume, plugins) were re-declared file-by-file in every console app and drifted: the Cloudflare host still registered /sources/* while the shared shell, command palette, and the SDK's credential-handoff URLs all point at /integrations/* — so on that host those links landed on the router's not-found page.

This makes the route contract executable and typed, owned by the package that links to it:

  • packages/react/src/routes/ holds the canonical route files, next to the pages they bind.
  • consoleRoutes({ dir, exclude }) exposes them as TanStack virtual file route nodes. An app's vite config composes them into its virtualRouteConfig, keeping its own __root (the auth shell is what genuinely differs per app) plus app-specific routes via a physical() mount. exclude is for apps with an intentionally different surface for a shared path.
  • The package registers its own generated console route tree (console-router.ts, regenerated with bun run routes:gen), so every Link/navigate in the shared pages and shell typechecks against the contract instead of being a loose string — a link to a nonexistent shared route is now a compile error in the package that owns it.

host-cloudflare is the first consumer: its routes directory shrinks to just __root.tsx, the old /sources/* paths are dropped, and /integrations/* now resolves. Verified by driving the built SPA in a browser against wrangler dev: the integrations detail/add pages render and unknown paths still show not-found.

One dependency note: zod is pinned to exactly 4.3.6 in host-mcp, plugin-mcp, and test-servers. The new dev dependencies make bun re-resolve those workspaces, which otherwise drift to zod 4.4.x while the hoisted zod (shared with @modelcontextprotocol/sdk) stays at 4.3.6 — and mixed zod instances break the SDK's schema typings. The pins keep every package on the instance the SDK uses.

TanStack Start supports the same composition (tanstackStart({ router: { virtualRouteConfig } }), covered by an upstream e2e), so the remaining apps follow in the next PR.

Stack

  1. Share the console route tree across hosts via TanStack virtual file routes #954 👈 current
  2. Migrate the remaining console apps onto the shared route tree #955

@RhysSullivan
RhysSullivan force-pushed the claude/console-route-contract branch 2 times, most recently from 0ea4fd0 to 4c7fa3a Compare June 11, 2026 22:38
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 9321b63 Commit Preview URL

Branch Preview URL
Jun 11 2026, 11:12 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 9321b63 Jun 11 2026, 11:14 PM

@RhysSullivan
RhysSullivan force-pushed the claude/console-route-contract branch 3 times, most recently from 44ee726 to a50c721 Compare June 11, 2026 23:00
@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@954

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@954

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@954

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@954

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@954

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@954

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@954

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@954

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@954

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@954

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@954

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@954

executor

npm i https://pkg.pr.new/executor@954

commit: 9321b63

…outes

The shared console routes (integrations, policies, secrets, tools, resume,
plugins) were re-declared file-by-file in every app and drifted: this host
still registered /sources/* while the shared shell, command palette, and the
SDK's credential-handoff URLs all point at /integrations/*, so those links
landed on the router's not-found page.

packages/react now owns the contract it links to:

- src/routes/ holds the canonical route files, next to the pages they bind.
- consoleRoutes() (src/console-routes.ts) exposes them as virtual file route
  nodes; an app's vite config composes them into its virtualRouteConfig,
  keeping its own __root (the auth shell is what genuinely differs) and its
  app-specific routes. Apps with an intentionally different surface for a
  shared path exclude it and register their own file.
- The package registers its own generated console route tree
  (console-router.ts + routes/routeTree.gen.ts, regenerated with
  `bun run routes:gen`), so every Link/navigate in the shared pages and shell
  typechecks against the contract instead of being a loose string.

host-cloudflare is the first consumer: its route dir shrinks to just __root,
the old /sources/* paths are dropped, and /integrations/* now resolves
(verified by driving the SPA in a browser against wrangler dev: integrations
detail/add render and unknown paths still 404). TanStack Start supports the
same composition via tanstackStart({ router: { virtualRouteConfig } }), so
cloud, host-selfhost, and packages/app can follow.

zod is pinned to exactly 4.3.6 in host-mcp, plugin-mcp, and test-servers:
the new dev dependencies make bun re-resolve those workspaces, which
otherwise drift to zod 4.4.x while the hoisted zod (shared with
@modelcontextprotocol/sdk) stays at 4.3.6 — mixed zod instances break the
SDK's schema typings. The exact pins keep every executor package on the
same instance the SDK uses.
@RhysSullivan
RhysSullivan force-pushed the claude/console-route-contract branch from a50c721 to 9321b63 Compare June 11, 2026 23:10
@RhysSullivan
RhysSullivan merged commit d5eb3d7 into main Jun 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant