Skip to content

Commit 1f855be

Browse files
committed
refactor!: extract devframe to standalone repo + bump to v0.2.0
Devframe now lives at github.com/devframes/devframe; this monorepo consumes it as `devframe` from npm via `catalog:deps` and keeps a git submodule at `devframe/` (tag-pinned, never a branch) as a checked-in reference. `scripts/sync.ts` (run via `pnpm sync`) aligns the submodule with the catalog version and is hooked into `postinstall` so fresh clones init automatically. Drops 43 `devframe/*` path aliases, turbo tasks, vitest projects, and the merged docs section.
1 parent 2b913cd commit 1f855be

296 files changed

Lines changed: 390 additions & 20404 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v5
17+
with:
18+
submodules: recursive
1719

1820
- name: Install pnpm
1921
uses: pnpm/action-setup@v4
@@ -49,6 +51,8 @@ jobs:
4951

5052
steps:
5153
- uses: actions/checkout@v5
54+
with:
55+
submodules: recursive
5256

5357
- name: Install pnpm
5458
uses: pnpm/action-setup@v4

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ packages/rolldown/src/public/fonts
1515
packages/rolldown/src/app/public/fonts
1616
packages/rolldown/runtime
1717
packages/kit/skills
18-
devframe/packages/devframe/skills
1918
.rolldown
2019
*.tsbuildinfo
2120
**/.vitepress/cache

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "devframe"]
2+
path = devframe
3+
url = https://github.com/devframes/devframe.git

AGENTS.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Two layers, one mental model:
66

7-
- **`devframe`***the container for one devtool integration, portable across viewers.* Build a single tool (its RPC, its SPA, its diagnostics, its CLI/build/spa/embedded outputs) without caring how it'll be displayed. A devframe app runs standalone (CLI, static deploy, embedded SPA) just as well as it mounts inside a hub.
7+
- **`devframe`***the container for one devtool integration, portable across viewers.* External project; lives at [`github.com/devframes/devframe`](https://github.com/devframes/devframe), docs at [`devfra.me`](https://devfra.me). Consumed here as an npm dependency (`catalog:deps`). A checked-in submodule at `devframe/` mirrors the source at the pinned tag for browsing and upstream contributions.
88
- **`@vitejs/devtools-kit`***the hub that unites many devtools integrations.* Owns docking, the command palette, toasts, terminal sessions — anything that only makes sense when more than one tool shares a UI. Provides `createPluginFromDevframe(devframeApp)` so a portable devframe definition drops into Vite DevTools as a Vite plugin, with the dock entry auto-derived from the definition's metadata.
99

10-
When deciding where something belongs: if a single-app standalone CLI would still need it, it lives in devframe; if it only matters once you have multiple integrations or a host UI, it lives in the kit.
10+
When deciding where something belongs: if a single-app standalone CLI would still need it, it belongs upstream in devframe; if it only matters once you have multiple integrations or a host UI, it lives in the kit.
1111

1212
## Stack & Structure
1313

@@ -17,7 +17,6 @@ Monorepo (`pnpm` workspaces + `turbo`). ESM TypeScript; bundled with `tsdown`. P
1717

1818
| Package | npm | Description |
1919
|---------|-----|-------------|
20-
| `devframe/packages/devframe` | `devframe` | Framework-neutral container for one devtool integration. RPC layer (birpc + valibot + WS presets), `createHostContext`, six deployment adapters at `devframe/adapters/*` (cli/dev/build/vite/embedded/mcp), `connectDevframe` client. No docks, no terminals, no command palette — those are hub concerns. |
2120
| `packages/kit` | `@vitejs/devtools-kit` | The hub. `createKitContext` wraps devframe's context with `docks` / `terminals` / `messages` / `commands` host subsystems plus the Vite-augmented context type. `createPluginFromDevframe` bridges a portable devframe app into a `Plugin.devtools.setup` Vite plugin, auto-deriving its iframe dock entry from the definition. |
2221
| `packages/core` | `@vitejs/devtools` | Vite plugin + CLI + standalone/webcomponents client for Vite DevTools itself. Calls kit's `createKitContext`, scans Vite plugins for `.devtools.setup`, and serves the dock UI. |
2322
| `packages/ui` | `@vitejs/devtools-ui` | Shared UI components, composables, and UnoCSS preset (`presetDevToolsUI`). Private, not published. |
@@ -29,6 +28,8 @@ Monorepo (`pnpm` workspaces + `turbo`). ESM TypeScript; bundled with `tsdown`. P
2928
Other top-level directories:
3029
- `docs/` — VitePress docs; guides in `docs/guide/`
3130
- `skills/` — Agent skill files generated from docs via [Agent Skills](https://agentskills.io/home). Structured references (RPC patterns, dock types, shared state, project structure) for AI agent context.
31+
- `devframe/` — Git submodule pinned to the `devframe` version in `catalogs.deps`. Run `pnpm sync` to align with the catalog; `pnpm sync <version>` or `pnpm sync --latest` to bump.
32+
- `scripts/sync.ts` — Submodule pin manager (see `pnpm sync --help`).
3233

3334
```mermaid
3435
flowchart TD
@@ -43,13 +44,13 @@ flowchart TD
4344

4445
## Dep Boundary
4546

46-
`devframe/packages/devframe` is the lowest-level package in this monorepo and is positioned to be extracted into its own repo. It MUST NOT import from `vite`, `@vitejs/*`, or any hub-only concept (docks, terminals, messages, commands) — not as a `dependencies` entry, not as an inlined dep, not as a source import. `packages/kit` and above build on top of devframe; never the reverse. If a feature requires multi-integration awareness, it goes in kit.
47+
`devframe` is an external package consumed via `catalog:deps` — contribute upstream at [github.com/devframes/devframe](https://github.com/devframes/devframe). `packages/kit` and above build on top of it. Features that require multi-integration awareness (docks, terminals, messages, commands) belong in kit.
4748

48-
`devframe/node/internal` is a marked-internal subpath that exposes a small set of helpers (`getInternalContext`, `resolveBasePath`) for first-party adapters that need to reach into devframe's private machinery — kit's relocated `DocksHost` uses it for remote-dock token allocation. End users should not import it.
49+
`devframe/node/internal` is a marked-internal subpath exposing a small set of helpers (`getInternalContext`, `resolveBasePath`) for first-party adapters reaching into devframe's private machinery — kit's `DocksHost` uses it for remote-dock token allocation. End users should not import it.
4950

5051
## Architecture
5152

52-
- **Devframe context** (`devframe/packages/devframe/src/node/context.ts`): `createHostContext` returns a `DevToolsNodeContext` carrying `rpc`, `views` (HTTP file-serving via `hostStatic`), `diagnostics`, `agent`, plus `cwd`/`workspaceRoot`/`mode`/`host`. No docks, no terminals, no json-render.
53+
- **Devframe context** (external — see [devfra.me](https://devfra.me)): `createHostContext` returns a `DevToolsNodeContext` carrying `rpc`, `views` (HTTP file-serving via `hostStatic`), `diagnostics`, `agent`, plus `cwd`/`workspaceRoot`/`mode`/`host`. No docks, no terminals, no json-render.
5354
- **Kit context** (`packages/kit/src/node/context.ts`): `createKitContext` wraps `createHostContext` and attaches the four hub hosts — `docks`, `terminals`, `messages`, `commands` — plus the `createJsonRenderer` factory. Optionally surfaces `viteConfig`/`viteServer` when mounted inside Vite DevTools. Wires the `'devframe:docks'` / `'devframe:commands'` shared-state sync.
5455
- **Bridge** (`packages/kit/src/node/create-plugin-from-devframe.ts`): `createPluginFromDevframe(d, opts?)` returns `PluginWithDevTools`; in its `setup`, mounts the SPA via `views.hostStatic`, auto-registers an iframe dock entry from `id`/`name`/`icon`/`basePath`, runs `d.setup(ctx)` for the devframe-level wiring, then runs `opts.setup?.(ctx)` for kit-only extensions.
5556
- **Vite DevTools entry** (`packages/core/src/node/context.ts`): `createDevToolsContext` calls `createKitContext`, registers Vite-specific commands (`vite:open-in-editor`, `vite:open-in-finder`), then scans Vite plugins for `.devtools.setup` hooks (which now receive the kit-augmented context).
@@ -80,16 +81,7 @@ pnpm -C docs run docs # docs dev server
8081
- Shared UI components/preset in `packages/ui`; use `presetDevToolsUI` from `@vitejs/devtools-ui/unocss`.
8182
- Currently focused on Rolldown build-mode analysis; dev-mode support is deferred.
8283

83-
### Devframe design principles
84-
85-
These apply to everything inside `devframe/packages/devframe` and reinforce its positioning as "the container for one devtool integration, portable to multiple viewers". When in doubt, err on the side of "devframe provides primitives, the hub provides UX".
86-
87-
- **Single-integration scope.** Devframe describes one tool. If a feature only makes sense when multiple tools share a UI — docking, a unified command palette, cross-tool toasts, terminal aggregation — it lives in `@vitejs/devtools-kit`, not here.
88-
- **Headless by default.** No default startup banners, no opinionated logging to stdout, no default styling. Provide hooks (`onReady`, `cli.configure`, etc.); let the application print its own branding. Structured diagnostics via `logs-sdk` are fine — ad-hoc `console.log`s baked into adapters are not.
89-
- **File watching is the app's job, not devframe's.** Don't add a generic watcher primitive. Authors wire chokidar / fs.watch / watchman themselves and signal change via `ctx.rpc.sharedState.set(...)` or event-type RPCs. devframe stays out of the filesystem-observation business.
90-
- **Mount path depends on adapter context.** Given `id: 'foo'`, the default mount path is `/__foo/` for *hosted* adapters (`vite`, `embedded`, kit's `createPluginFromDevframe`) and `/` for *standalone* adapters (`cli`, `spa`, `build`). Authors override via `DevframeDefinition.basePath`. Don't hardcode `DEVTOOLS_MOUNT_PATH` in adapter code paths that may run standalone.
91-
- **SPAs own their basePath at runtime.** Build SPAs with relative asset paths (`vite.base: './'`); discover the effective base in the browser from the executing script's location / `document.baseURI`. `createBuild` / `createSpa` copy SPA output verbatim — no HTML rewriting, no build-time `--base` injection. The client (`connectDevframe`) resolves `.connection.json` relative to the runtime base automatically.
92-
- **CLI flags compose from both sides.** The `cac` instance backing `createCli` is exposed both to the `DevframeDefinition` (`cli.configure(cli)`) — for capabilities contributed by the tool itself — and to the `createCli` caller — for flags added at the final assembly stage. Parsed flag values are forwarded to `setup(ctx, { flags })`. Never hardcode domain-specific flags into `createCli`.
84+
Devframe's internal design principles (single-integration scope, headless-by-default, mount-path / SPA-basePath conventions, CLI flag composition) live in its own AGENTS.md upstream. Read them at [github.com/devframes/devframe/blob/main/AGENTS.md](https://github.com/devframes/devframe/blob/main/AGENTS.md) before contributing patches.
9385

9486
### Kit design principles
9587

@@ -107,11 +99,12 @@ All node-side warnings and errors use structured diagnostics via [`logs-sdk`](ht
10799

108100
| Prefix | Package(s) | Diagnostics file |
109101
|--------|-----------|-----------------|
110-
| `DF` | `devframe/packages/devframe` | `devframe/packages/devframe/src/node/diagnostics.ts`, `devframe/packages/devframe/src/rpc/diagnostics.ts` |
111102
| `DTK` | `packages/kit` + `packages/core` (shared codespace, hub-side) | `packages/kit/src/node/diagnostics.ts`, `packages/core/src/node/diagnostics.ts` |
112103
| `RDDT` | `packages/rolldown` | `packages/rolldown/src/node/diagnostics.ts` |
113104
| `VDT` | `packages/vite` (reserved) ||
114105

106+
`DF` codes belong to the upstream devframe project — file new ones there.
107+
115108
`DTK` is shared between core and kit because they're sibling layers of the Vite DevTools hub. Coordinate code numbers across both files: kit currently reserves `DTK0050+`; core's existing codes top out below that.
116109

117110
Codes are sequential 4-digit numbers per prefix (e.g. `DTK0033`, `RDDT0003`). Check the existing diagnostics file to find the next available number.
@@ -168,7 +161,7 @@ Codes are sequential 4-digit numbers per prefix (e.g. `DTK0033`, `RDDT0003`). Ch
168161

169162
4. **Update the index** at `docs/errors/index.md` — add a row with `Code | Level | Title` (no Package column).
170163

171-
The sidebar in `docs/.vitepress/config.ts` (and `devframe/docs/.vitepress/config.ts` for `DF` codes) globs the `errors/` directory by prefix, so the new page is picked up automatically — no sidebar edit needed.
164+
The sidebar in `docs/.vitepress/config.ts` globs the `errors/` directory by prefix, so the new page is picked up automatically — no sidebar edit needed.
172165

173166
### Scope
174167

@@ -185,7 +178,7 @@ Follow conventional commits (`feat:`, `fix:`, etc.).
185178

186179
## Documentation style
187180

188-
These rules apply to every Markdown file under `docs/` and `devframe/docs/` (the error reference pages are template-driven and exempt). Apply them on every doc edit, not just dedicated revision passes.
181+
These rules apply to every Markdown file under `docs/` (the error reference pages are template-driven and exempt). Apply them on every doc edit, not just dedicated revision passes.
189182

190183
### 1. Positive framing
191184

@@ -207,9 +200,7 @@ Callouts (`> [!NOTE]`, `> [!TIP]`, `> [!INFO]`, `::: tip`, etc.) interrupt the r
207200

208201
### 3. Kit-first in `/docs/`
209202

210-
The main docs site is for **Vite DevTools** and **`@vitejs/devtools-kit`** users. Devframe is the framework-neutral foundation underneath; mention it where relevant ("Kit is built on Devframe; standalone tools can use Devframe directly — see [Devframe](https://devfra.me/guide/)") but lead examples and guides with the Kit / Vite plugin path.
211-
212-
`devframe/docs/` is the inverse: Devframe-first, with cross-links to Kit for hub-only features (docks, terminals, messages, commands).
203+
The main docs site is for **Vite DevTools** and **`@vitejs/devtools-kit`** users. Devframe is the framework-neutral foundation underneath; link to [`devfra.me`](https://devfra.me/guide/) for its docs and lead examples and guides with the Kit / Vite plugin path.
213204

214205
### 4. Concise and precise
215206

alias.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,8 @@ import { join, relative } from 'pathe'
44

55
const root = fileURLToPath(new URL('.', import.meta.url))
66
const r = (path: string) => fileURLToPath(new URL(`./packages/${path}`, import.meta.url))
7-
const df = (path: string) => fileURLToPath(new URL(`./devframe/packages/${path}`, import.meta.url))
87

98
export const alias = {
10-
'devframe/rpc/transports/ws-server': df('devframe/src/rpc/transports/ws-server.ts'),
11-
'devframe/rpc/transports/ws-client': df('devframe/src/rpc/transports/ws-client.ts'),
12-
'devframe/rpc/client': df('devframe/src/rpc/client.ts'),
13-
'devframe/rpc/server': df('devframe/src/rpc/server.ts'),
14-
'devframe/rpc': df('devframe/src/rpc'),
15-
'devframe/types': df('devframe/src/types/index.ts'),
16-
'devframe/node/auth': df('devframe/src/node/auth/index.ts'),
17-
'devframe/node/internal': df('devframe/src/node/internal/index.ts'),
18-
'devframe/node': df('devframe/src/node/index.ts'),
19-
'devframe/constants': df('devframe/src/constants.ts'),
20-
'devframe/utils/colors': df('devframe/src/utils/colors.ts'),
21-
'devframe/utils/events': df('devframe/src/utils/events.ts'),
22-
'devframe/utils/hash': df('devframe/src/utils/hash.ts'),
23-
'devframe/utils/human-id': df('devframe/src/utils/human-id.ts'),
24-
'devframe/utils/launch-editor': df('devframe/src/utils/launch-editor.ts'),
25-
'devframe/utils/nanoid': df('devframe/src/utils/nanoid.ts'),
26-
'devframe/utils/open': df('devframe/src/utils/open.ts'),
27-
'devframe/utils/promise': df('devframe/src/utils/promise.ts'),
28-
'devframe/utils/serve-static': df('devframe/src/utils/serve-static.ts'),
29-
'devframe/utils/shared-state': df('devframe/src/utils/shared-state.ts'),
30-
'devframe/utils/streaming-channel': df('devframe/src/utils/streaming-channel.ts'),
31-
'devframe/utils/structured-clone': df('devframe/src/utils/structured-clone.ts'),
32-
'devframe/utils/when': df('devframe/src/utils/when.ts'),
33-
'devframe/adapters/cli': df('devframe/src/adapters/cli.ts'),
34-
'devframe/adapters/dev': df('devframe/src/adapters/dev.ts'),
35-
'devframe/adapters/build': df('devframe/src/adapters/build.ts'),
36-
'devframe/adapters/vite': df('devframe/src/adapters/vite.ts'),
37-
'devframe/adapters/embedded': df('devframe/src/adapters/embedded.ts'),
38-
'devframe/adapters/mcp': df('devframe/src/adapters/mcp.ts'),
39-
'@devframes/nuxt/runtime/plugin.client': df('nuxt/src/runtime/plugin.client.ts'),
40-
'@devframes/nuxt': df('nuxt/src/index.ts'),
41-
'devframe/recipes/open-helpers': df('devframe/src/recipes/open-helpers.ts'),
42-
'devframe/client': df('devframe/src/client/index.ts'),
43-
'devframe': df('devframe/src'),
449
'@vitejs/devtools-kit/node': r('kit/src/node/index.ts'),
4510
'@vitejs/devtools-kit/client': r('kit/src/client/index.ts'),
4611
'@vitejs/devtools-kit/constants': r('kit/src/constants.ts'),

devframe

Submodule devframe added at a6c0cfe

devframe/README.md

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)