Skip to content

feat(code-server): multi-backend + tunnel, reuse/startOnBoot, Vue launcher#117

Merged
antfu merged 3 commits into
mainfrom
feat/code-server-backends-vue
Jul 22, 2026
Merged

feat(code-server): multi-backend + tunnel, reuse/startOnBoot, Vue launcher#117
antfu merged 3 commits into
mainfrom
feat/code-server-backends-vue

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

What & why

Brings @devframes/plugin-code-server toward Nuxt DevTools feature parity (items 1, 3, 4, 5 from the research pass) and rewrites its launcher on the shared @antfu/design Vue stack so it looks and behaves like the other devframe surfaces. Legacy options/tools support was intentionally dropped.

Feature parity

  • Multiple backends — Coder code-server (password + session cookie, kept) and Microsoft code serve-web (connection token via ?tkn=). Pick with backend, or leave unset to auto-detect (code-servercode serve-web).
  • Tunnel modemode: 'tunnel' runs code tunnel and embeds vscode.dev, surfacing the device-login prompt (verification URL + code) while it authenticates. start() resolves as soon as the login prompt or the tunnel URL appears, so it never blocks on interactive auth.
  • reuseExistingServer — adopts a server already answering a health probe on the target port instead of spawning (auto-auth only applies to servers we launch).
  • startOnBoot — launches during setup instead of waiting for the launcher button.

The auth handoff is generalized into a backend-aware CodeServerConnect (session cookie / query token / absolute tunnel URL), returned only from start/status and never published to shared state. Detection now reports backend + mode.

Vue rewrite

The vanilla-DOM launcher (view.ts, design.ts, connection-state.ts, iframe-pane) is replaced by a Vue SPA under src/spa/App.vue (smart) plus presentational LauncherView.vue / EditorFrame.vue / ConnectionOverlay.vue and rpc/code-server composables, importing @antfu/design components directly like the inspect plugin. The persistent iframe survives transient restarts via v-show; the port-agnostic cookie trick is retained. Storybook moves to @storybook/vue3-vite with per-phase stories. The /client entry is now a thin connectCodeServer connector.

Core typing fix

Indexing the key-remapped Scoped{Server,Client}Functions<NS> maps with a generic tripped TS2536 once a plugin augmented the RPC registry (which every real plugin does) — surfacing as 8 pre-existing errors in code-server's typecheck. Resolved by looking the scoped name back up through the plain registry behind a keyof guard (ScopedRpcFn), keeping scope call ergonomics intact.

Verification

  • pnpm build (tsdown + Vite SPA) ✓ · pnpm build-storybook
  • pnpm typecheck (full repo) ✓ 15/15 · pnpm lint
  • code-server tests ✓ 13/13 (new coverage: serve-web token, reuse, startOnBoot, tunnel login/ready)
  • tsnapi API snapshots regenerated
  • Runtime smoke: Vite dev server transforms the SFCs + @antfu/design components and serves __connection.json (no browser available on the ARM64 sandbox for a screenshot)

This PR was created with the help of an agent.

…ncher

Bring the code-server plugin toward Nuxt DevTools feature parity and rewrite
its launcher on the shared @antfu/design Vue stack.

- backends: Coder `code-server` (session cookie) and Microsoft `code serve-web`
  (connection token via ?tkn=), selected by `backend` or auto-detected
- tunnel mode: `code tunnel` embedding vscode.dev, surfacing the device-login
  prompt while it authenticates
- `reuseExistingServer` adopts a server already answering on the target port
- `startOnBoot` launches during setup instead of on demand
- generalize the auth handoff into a backend-aware `CodeServerConnect`
  (cookie / query token / absolute URL); detection now reports backend + mode
- rewrite the launcher as a Vue SPA (App/LauncherView/EditorFrame/
  ConnectionOverlay + composables), dropping the vanilla-DOM view and
  iframe-pane; Storybook moves to @storybook/vue3-vite

Also fix a pre-existing devframe core typing bug: indexing the key-remapped
`Scoped{Server,Client}Functions<NS>` maps with a generic tripped TS2536 once a
plugin augmented the RPC registry. Resolve the scoped name through the plain
registry behind a keyof guard (`ScopedRpcFn`), restoring code-server's
typecheck without changing scope call ergonomics.

Created with the help of an agent.
@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 91bb572
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a60096214f1eb0008de2071
😎 Deploy Preview https://deploy-preview-117--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu
antfu merged commit 57f3ef2 into main Jul 22, 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.

2 participants