Skip to content

feat(docs): move the editor to the ViteHub Console's signed calls - #409

Merged
onmax merged 1 commit into
mainfrom
feat/console-one-way-in
Nov 12, 2026
Merged

onmax merged 1 commit into
mainfrom
feat/console-one-way-in

Conversation

@onmax

@onmax onmax commented Nov 12, 2026

Copy link
Copy Markdown
Owner

The site still serves its own Console: auth: "app", embed: true, a Console MCP and consoleMcpOAuth(). Current ViteHub removed all of that, and a build with those options fails with VITE_HUB_B0020. Apps now serve one route, POST /_vitehub/rpc, and console.vitehub.dev signs every call with an Ed25519 key whose public half sits in a VITEHUB_CONSOLE_KEY_<NAME> Worker secret.

This moves the docs to that model and pins every ViteHub package to the pkg.pr.new build of vite-hub/vitehub main (869db474).

  • console: { authorize } plus publicUrl: "https://comark-ui.onmax.me". console-authorize.ts lets in a Console caller whose email is in utils/team.ts, and the CLI, whose keys we make ourselves. The signed Console user is { id, name, email } with an id of the Console's own, so inTeam() no longer looks people up by id: a site user (GitHub sign-in) counts by login, a Console user by email. The Console only signs for members of the team that linked the site and takes the email from GitHub verified, so a stranger needs both to get in.
  • The site keeps its own GitHub Auth, because Comments on the pages use it. Comments now have their own authorize (the Console no longer decides who comments), and the team signs in at /sign-in, since /_vitehub is gone.
  • Upgrade breaks fixed the way ViteHub's codemods do them: server/content.ts default-exports, documents comes from vite-hub/content/collections, the Database moved to server/databases/default/ with migrations in the Drizzle Kit 1.0 layout (vitehub database up, D1 keeps the same 0000_init.sql… names, so nothing re-runs), and vite.env moved into vitehub.env.
  • New migration 0004_comments-request-id, one nullable column and an index that Comments now needs.
  • Nuxt nightly goes to 2611111405 with Nitro 3.0.261103-rc. On the older nightly every signed call answered 400 Malformed Console request: two nuxt/server handlers from modules each wrapped the request in a body-buffering proxy, the second one's request.body check read the whole body, and the Console route found it already read. The site's own assets.ts middleware now uses Nitro's defineHandler for the same reason.
  • Two workarounds for @vite-hub/docs at this build, each with a removal note: its Tailwind @source points at dist/theme.js, which only re-exports a hashed chunk, so the header lost its grid (modules/docs-theme-source.ts); and DocsPage.vue names a docs-article layout this app never registers, which fails vue-tsc (app/types/vitehub-docs-layouts.d.ts).

Local checks on the rebased branch: pnpm build, pnpm docs:generate (416 pages, links), pnpm docs:links, the compat flag check, wrangler deploy --dry-run with the worker budget (6.94 MiB gzip), pnpm check, pnpm run doctor, and pnpm test (one remark-to-comark CLI test timed out under load and passes alone).

Against a local wrangler dev of the build with a local D1:

Call Result
Console-signed content.list, team email 200, the pages
Console-signed project.get, stranger email 403 CONSOLE_ACCESS_DENIED
Signed for the wrong origin, or with an unknown key 401
Unsigned 401 CONSOLE_SIGNATURE_MISSING
vitehub content list --url with a CLI key reaches the app, Content refuses it (no person)
Comments as a team session / another GitHub user / signed out thread created / 403 / 403

In Chromium, a team session on /zoom?vitehub gets the Comments toolbar and its Realtime socket stays open. The text of nine main pages matches a local build of main apart from the star count. The shell is the newer @vite-hub/docs one: before/after on Drop.

Not checked: the real Console against production (the link comes after deploy), a real GitHub sign-in at /sign-in (I only saw it redirect to GitHub), and the Console preview link. The build now binds a KV namespace without an id, which Wrangler creates on the first deploy. The jwks/oauth_* tables stay in D1 unused so the previous Worker can still be rolled back to.

Upstream: vitehub CLI commands in this app fail with ERR_SERVER_NOT_RUNNING (the @vite-hub/source close hook closes its server twice); I ran them with a preload that makes the second close a no-op.

Prepared with Claude Opus 5.5 in T3 Code.

The site no longer serves a Console, its sign-in, or its MCP. It serves one route,
POST /_vitehub/rpc, for calls that console.vitehub.dev signs with the key in a
VITEHUB_CONSOLE_KEY_<NAME> binding. console-authorize.ts lets in Console users
whose email is in utils/team.ts, and CLI keys.

- Pin every ViteHub package to vite-hub/vitehub main (869db474), Drizzle 1.0 RC,
  and Nuxt nightly 2611111405 with Nitro 3.0.261103, whose body buffering no
  longer drains the Console route's request.
- Remove auth: "app", embed, mcp and consoleMcpOAuth(); set publicUrl.
- Comments get their own team policy, and the team signs in at /sign-in.
- Move server/content.ts to a default export and the Database to
  server/databases/default/, with migrations in the Drizzle Kit 1.0 layout.
- Add migration 0004 for the request_id column of Comments threads.
- Work around two @vite-hub/docs gaps: its theme chunk is not a Tailwind source,
  and DocsPage.vue names a layout the module does not register here.
@pullfrog

pullfrog Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

This run was cancelled before it finished.

Pullfrog  | View workflow run | via Pullfrog

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-12T07:09:38.514141Z
We couldn’t complete this review. Comment @codex review to try again.
28d5bac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pkg-pr-new

pkg-pr-new Bot commented Nov 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@409

comark-badge

pnpm add https://pkg.pr.new/comark-badge@409

comark-cards

pnpm add https://pkg.pr.new/comark-cards@409

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@409

comark-cast

pnpm add https://pkg.pr.new/comark-cast@409

comark-charts

pnpm add https://pkg.pr.new/comark-charts@409

comark-chat

pnpm add https://pkg.pr.new/comark-chat@409

comark-chips

pnpm add https://pkg.pr.new/comark-chips@409

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@409

comark-code

pnpm add https://pkg.pr.new/comark-code@409

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@409

comark-colors

pnpm add https://pkg.pr.new/comark-colors@409

comark-comments

pnpm add https://pkg.pr.new/comark-comments@409

comark-critic

pnpm add https://pkg.pr.new/comark-critic@409

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@409

comark-details

pnpm add https://pkg.pr.new/comark-details@409

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@409

comark-diff

pnpm add https://pkg.pr.new/comark-diff@409

comark-embed

pnpm add https://pkg.pr.new/comark-embed@409

comark-fields

pnpm add https://pkg.pr.new/comark-fields@409

comark-figure

pnpm add https://pkg.pr.new/comark-figure@409

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@409

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@409

comark-github

pnpm add https://pkg.pr.new/comark-github@409

comark-icon

pnpm add https://pkg.pr.new/comark-icon@409

comark-include

pnpm add https://pkg.pr.new/comark-include@409

comark-keys

pnpm add https://pkg.pr.new/comark-keys@409

comark-links

pnpm add https://pkg.pr.new/comark-links@409

comark-linter

pnpm add https://pkg.pr.new/comark-linter@409

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@409

comark-mark

pnpm add https://pkg.pr.new/comark-mark@409

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@409

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@409

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@409

comark-media

pnpm add https://pkg.pr.new/comark-media@409

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@409

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@409

comark-outline

pnpm add https://pkg.pr.new/comark-outline@409

comark-properties

pnpm add https://pkg.pr.new/comark-properties@409

comark-qr

pnpm add https://pkg.pr.new/comark-qr@409

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@409

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@409

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@409

comark-sources

pnpm add https://pkg.pr.new/comark-sources@409

comark-steps

pnpm add https://pkg.pr.new/comark-steps@409

comark-table

pnpm add https://pkg.pr.new/comark-table@409

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@409

comark-tests

pnpm add https://pkg.pr.new/comark-tests@409

comark-time

pnpm add https://pkg.pr.new/comark-time@409

comark-ui

pnpm add https://pkg.pr.new/comark-ui@409

comark-xref

pnpm add https://pkg.pr.new/comark-xref@409

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@409

commit: 28d5bac

@onmax
onmax merged commit 153ed65 into main Nov 12, 2026
5 of 6 checks passed
@onmax
onmax deleted the feat/console-one-way-in branch November 12, 2026 07:31
This was referenced Nov 12, 2026
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