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
refactor!: reframe devframe positioning + rename Vite integration (#2)
* refactor: reframe devframe positioning + rename Vite integration
Reframe the docs/skill to position devframe as a portable, framework-
and build-tool-agnostic asset rather than a single-tool surface that
"lacks" hub features. Vite DevTools is now described as one host
built on devframe, reached via the renamed `vite` adapter (was the
`kit` adapter); the docs no longer enumerate things devframe doesn't
provide and instead point at Vite DevTools or custom adapters as the
escape valve.
The previous `vite` SPA-mounting plugin is no longer an adapter — moved
to `devframe/helpers/vite` and the factory renamed `createVitePlugin`
→ `viteDevBridge`. Updated the `@devframes/nuxt` consumer, internal
JSDoc, error doc DF0033, tsnapi snapshots, `DevframeRuntime` type
literal, and rebranded the client-side `[Vite DevTools]` timeout error
to `[devframe]`. The `vite-devtools-auth` BroadcastChannel literal is
kept for cross-tab interop with the existing Vite DevTools auth page.
* fix: reorder tsnapi snapshot to match alphabetical interface order
tsnapi emits interfaces alphabetically; the hand-edited snapshot had
ViteDevBridgeOptions before DevframeVitePlugin, causing a snapshot
mismatch on all CI matrix jobs. Reordered to DevframeVitePlugin first.
Also picks up tsdown's idempotent re-sort of package.json exports
(./helpers/vite slotted between ./constants and ./node).
Copy file name to clipboardExpand all lines: docs/errors/DF0033.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ outline: deep
10
10
11
11
## Cause
12
12
13
-
`createVitePlugin({ devMiddleware })` could not bring up the bridge dev server that pairs a host-served SPA (Vite, Nuxt, Astro, etc.) with devframe's RPC backend. Common reasons:
13
+
`viteDevBridge({ devMiddleware })` could not bring up the bridge dev server that pairs a host-served SPA (Vite, Nuxt, Astro, etc.) with devframe's RPC backend. Common reasons:
14
14
15
15
- The preferred port is in use and no fallback range was configured.
16
16
- Calling `def.setup(ctx)` threw — the devframe's own setup logic surfaced an error.
@@ -20,10 +20,10 @@ This is a soft warning — the surrounding Vite dev server keeps running, but th
20
20
21
21
## Fix
22
22
23
-
- Pin a port via `cli.port` / `cli.portRange` on the devframe definition, or via `devMiddleware.port` on `createVitePlugin`.
23
+
- Pin a port via `cli.port` / `cli.portRange` on the devframe definition, or via `devMiddleware.port` on `viteDevBridge`.
24
24
- Inspect the `reason` (or the attached `cause`) for the underlying error — fix the setup function or free the port.
25
25
- For Nuxt: pass `devMiddleware: { port: <free-port> }` to the `@devframes/nuxt` module.
26
26
27
27
## Source
28
28
29
-
-[`packages/devframe/src/adapters/vite.ts`](https://github.com/vitejs/devtools/blob/main/devframe/packages/devframe/src/adapters/vite.ts) — `createVitePlugin({ devMiddleware })` logs `DF0033` when port resolution or `createDevServer` throws during `configureServer`.
29
+
-[`packages/devframe/src/helpers/vite.ts`](https://github.com/vitejs/devtools/blob/main/devframe/packages/devframe/src/helpers/vite.ts) — `viteDevBridge({ devMiddleware })` logs `DF0033` when port resolution or `createDevServer` throws during `configureServer`.
Copy file name to clipboardExpand all lines: docs/guide/adapters.md
+33-28Lines changed: 33 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,8 @@ Every adapter factory has the shape `createXxx(devframeDef, options?)`.
14
14
|---------|-------|---------|----------|
15
15
|[`cli`](#cli)|`devframe/adapters/cli`|`createCli(def, options?)`| Standalone tools run via `node ./my-tool.js`|
16
16
|[`dev`](#dev)|`devframe/adapters/dev`|`createDevServer(def, options?)`| Run the dev server programmatically — drive it from any CLI framework |
17
-
|[`vite`](#vite)|`devframe/adapters/vite`|`createVitePlugin(def, options?)`| Mount a tool's UI inside an existing Vite dev server |
18
17
|[`build`](#build)|`devframe/adapters/build`|`createBuild(def, options?)`| Offline reports, CI artifacts, deployable SPA snapshots |
19
-
|[`kit`](#kit)|`@vitejs/devtools-kit/node`|`createPluginFromDevframe(def, options?)`|Integrating into Vite DevTools Kit|
18
+
|[`vite`](#vite)|`@vitejs/devtools-kit/node`|`createPluginFromDevframe(def, options?)`|Mount the definition into Vite DevTools (or any compatible host)|
20
19
|[`embedded`](#embedded)|`devframe/adapters/embedded`|`createEmbedded(def, { ctx })`| Runtime registration into an already-running host |
21
20
|[`mcp`](#mcp)|`devframe/adapters/mcp`|`createMcpServer(def, options?)`| Exposing a devframe to coding agents |
22
21
@@ -180,7 +179,7 @@ A devframe's SPA basePath depends on which adapter is running it:
180
179
| Adapter kind | Default basePath | Reason |
181
180
|--------------|------------------|--------|
182
181
|`cli`, `spa`, `build` (standalone) |`/`| The devframe owns the origin. |
183
-
|`vite`, `kit`, `embedded` (hosted) |`/__<id>/`| The devframe shares the origin with a host app and namespaces itself. |
182
+
|`vite`, `embedded` (hosted) |`/__<id>/`| The devframe shares the origin with a host app and namespaces itself. |
184
183
185
184
Override either side explicitly with `DevframeDefinition.basePath`:
186
185
@@ -194,26 +193,6 @@ defineDevframe({
194
193
195
194
SPA authors should build with relative asset paths (`vite.base: './'`); the client resolves its connection descriptor relative to the page at runtime. See [Client](./client#runtime-basepath-discovery) for the discovery rules.
196
195
197
-
## Vite
198
-
199
-
A thin Vite plugin that mounts a devframe's SPA into an existing Vite dev server as a *hosted* adapter — the mount path defaults to `/__<id>/` to namespace away from the app. The plugin mounts the SPA only; for RPC, use `kit` or `cli`.
|`base`|`def.basePath ?? '/__<id>/'`| Mount path inside the Vite dev server. |
214
-
215
-
Use this adapter when a devframe's UI is purely static and you want to surface it during Vite `serve` without shipping a separate dev server. Set `DevframeDefinition.basePath` on the definition for a custom path that stays consistent across adapters.
216
-
217
196
## Build
218
197
219
198
Produces a self-contained static deploy of a devframe:
@@ -252,9 +231,9 @@ When `def.spa` is set on the definition, `createBuild` also writes `spa-loader.j
252
231
253
232
Deployed SPAs that use `setupBrowser` ship their own client entry that registers the handlers.
254
233
255
-
## Kit
234
+
## Vite
256
235
257
-
Wraps a `DevframeDefinition` so Vite DevTools Kit's plugin-scan picks it up. The factory lives in `@vitejs/devtools-kit/node`— kit owns docking and process management while devframe stays portable.
236
+
The Vite-DevTools adapter — wraps a `DevframeDefinition` so Vite DevTools' kit plugin-scan picks it up. The factory lives in `@vitejs/devtools-kit/node`so devframe itself stays free of any Vite or `@vitejs/*` dependency. The pattern (`definition → host plugin → mount`) is general; other hosts can implement equivalent bridges.
@@ -265,18 +244,18 @@ export default function myVitePlugin() {
265
244
}
266
245
```
267
246
268
-
The returned object has the shape `{ name, devtools: { setup, capabilities } }`. Use this adapter when your devframe should live inside the Vite DevTools dock alongside other integrations. Kit synthesises an iframe dock entry from the definition's `id` / `name` / `icon` / `basePath`; for richer kit-specific behaviour (extra terminals, commands, dock overrides) pass `options.setup`. See the [DevTools Kit → DevTools Plugin](https://devtools.vite.dev/kit/devtools-plugin) page for the Vite-specific guide.
247
+
The returned object has the shape `{ name, devtools: { setup, capabilities } }`. Use this adapter when your devframe should live inside the Vite DevTools dock alongside other integrations. The kit synthesises an iframe dock entry from the definition's `id` / `name` / `icon` / `basePath`; for richer host-side behaviour (extra terminals, commands, dock overrides) pass `options.setup`. See the [DevTools Kit → DevTools Plugin](https://devtools.vite.dev/kit/devtools-plugin) page for the Vite-specific guide.
269
248
270
249
| Option | Default | Description |
271
250
|--------|---------|-------------|
272
251
|`name`|`devframe:<id>`| Override the Vite plugin name. |
273
252
|`base`|`def.basePath ?? /.${id}/`| Mount path override. |
274
253
|`dock`|`{}`| Overrides for the synthesized iframe dock entry (category, icon, when). |
Register a devframe into an already-running context at runtime. Mirrors Kit's internal plugin-scan, but for callers that need dynamic, post-startup registration. The host decides the mount path; `embedded` is a hosted adapter and inherits the `/__<id>/` default when one is needed.
258
+
Register a devframe into an already-running context at runtime. Mirrors the `vite` adapter's plugin-scan, but for callers that need dynamic, post-startup registration. The host decides the mount path; `embedded` is a hosted adapter and inherits the `/__<id>/` default when one is needed.
`@modelcontextprotocol/sdk` is a peer dependency — install it when shipping MCP support. The current transport is `stdio`.
309
288
310
289
See the [Agent-Native](./agent-native) page for the full API, safety model, and Claude Desktop integration example.
290
+
291
+
## Helpers
292
+
293
+
These are not adapters — they're small utilities for integrating devframe into specific runtimes outside the adapter list.
294
+
295
+
### `devframe/helpers/vite`
296
+
297
+
A thin Vite plugin for mounting a devframe inside an existing Vite dev server, used by `@devframes/nuxt` and available for any Vite-based host (Astro, SolidStart, plain Vite apps). Two modes:
298
+
299
+
-**Static mount** (default) — mounts `def.cli.distDir` at `options.base` (`/__<id>/` by default). No RPC server.
300
+
-**Bridge mode** (`devMiddleware: true | {…}`) — skips the static mount; the host app owns the SPA. Devframe spawns a separate RPC + WS server and registers Vite middleware at `<base>__connection.json` so the host-served SPA can discover the WS endpoint.
Copy file name to clipboardExpand all lines: docs/guide/client.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ const ok = await rpc.requestTrustWithToken('another-token')
89
89
90
90
### Broadcast-channel sync
91
91
92
-
`connectDevframe` listens on `BroadcastChannel('vite-devtools-auth')` for `auth-update` messages. When an auth page in another tab announces a new token, every open client requests trust with it automatically — no reload required.
92
+
`connectDevframe` listens on a shared `BroadcastChannel` (named `vite-devtools-auth` for cross-tab handshake interop with Vite DevTools' auth page) for `auth-update` messages. When an auth page in another tab announces a new token, every open client requests trust with it automatically — no reload required.
93
93
94
94
## Calling functions
95
95
@@ -183,7 +183,7 @@ await connectDevframe({
183
183
184
184
## Remote docks
185
185
186
-
Remote docks are a kit-side feature (see [Vite DevTools Kit → Remote Client](https://devtools.vite.dev/kit/remote-client)). The kit injects a connection descriptor into the iframe URL; on the hosted page, `connectDevframe` auto-detects the descriptor from the URL fragment / query string — call it as usual:
186
+
Remote docks are a host-side feature — hosts that support them (Vite DevTools is one; see [its remote-client docs](https://devtools.vite.dev/kit/remote-client) for that implementation) inject a connection descriptor into the iframe URL. On the hosted page, `connectDevframe` auto-detects the descriptor from the URL fragment / query string — call it as usual:
Copy file name to clipboardExpand all lines: docs/guide/devframe-definition.md
+10-11Lines changed: 10 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ outline: deep
4
4
5
5
# Devframe Definition
6
6
7
-
Every Devframe tool starts with a single `defineDevframe` call. The returned `DevframeDefinition` is a portable value that any of the [adapters](./adapters) can consume — the same definition runs under `createCli`, `createBuild`, `createMcpServer`, kit's `createPluginFromDevframe`, and so on.
7
+
Every Devframe tool starts with a single `defineDevframe` call. The returned `DevframeDefinition` is a portable value that any of the [adapters](./adapters) can consume — the same definition runs under `createCli`, `createBuild`, `createMcpServer`, the `vite` adapter's `createPluginFromDevframe`, and so on.
8
8
9
9
## Minimal definition
10
10
@@ -28,7 +28,7 @@ export default defineDevframe({
28
28
})
29
29
```
30
30
31
-
When mounted into Vite DevTools via [`createPluginFromDevframe`](./adapters#kit), the dock entry and iframe mount are derived from `id`, `name`, `icon`, and `basePath` automatically. Hub-level features (`docks`, `terminals`, `messages`, `commands`) live on the kit-augmented context.
31
+
Host adapters (such as the [`vite` adapter](./adapters#vite) for Vite DevTools) derive their mount entry from `id`, `name`, `icon`, and `basePath` automatically.
32
32
33
33
## Definition fields
34
34
@@ -38,7 +38,7 @@ When mounted into Vite DevTools via [`createPluginFromDevframe`](./adapters#kit)
38
38
|`name`|`string`|**Required.** Display name shown in the dock and agent manifests. |
39
39
|`icon`|`string \| { light, dark }`| Optional Iconify name or URL; supports light/dark pairs. |
40
40
|`version`|`string`| Optional version string surfaced to clients. |
41
-
|`basePath`|`string`| Optional mount path override. Defaults depend on the adapter: `/` for standalone (`cli` / `spa` / `build`), `/.<id>/` for hosted (`vite` / `kit` / `embedded`). |
41
+
|`basePath`|`string`| Optional mount path override. Defaults depend on the adapter: `/` for standalone (`cli` / `spa` / `build`), `/.<id>/` for hosted (`vite` / `embedded`). |
42
42
|`capabilities`|`{ dev?, build?, spa? }`| Per-runtime feature flags. A `boolean` applies to the runtime as a whole; an object enables individual features. |
43
43
|`setup`|`(ctx, info?) => void \| Promise<void>`|**Required.** Server-side entry point. Runs in every runtime. The optional second argument carries runtime metadata — most notably the parsed CLI `flags` when running under `createCli`. |
44
44
|`setupBrowser`|`(ctx) => void \| Promise<void>`| Browser-only entry used by the SPA adapter. |
Hub-level subsystems — `docks`, `terminals`, `messages`, `commands`, `createJsonRenderer` — live on the kit-augmented context owned by `@vitejs/devtools-kit`. A devframe app that wants to register kit-only behavior does so through the optional `setup` hook on `createPluginFromDevframe`.
87
+
Host adapters can augment `ctx` with additional surfaces. For example, the [`vite` adapter](./adapters#vite) exposes Vite DevTools' dock, command, message, and terminal hosts via an optional `setup` hook on `createPluginFromDevframe` — consult the host's docs for those extras.
0 commit comments