Skip to content

fix(devframe)!: decouple docks/terminals/messages/commands from devframe#317

Merged
antfu merged 3 commits into
mainfrom
antfu/decouple-docks-terminals
May 8, 2026
Merged

fix(devframe)!: decouple docks/terminals/messages/commands from devframe#317
antfu merged 3 commits into
mainfrom
antfu/decouple-docks-terminals

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented May 8, 2026

Description

Repositions devframe as the portable container for one devtool integration, and @vitejs/devtools-kit as the hub that unites many of them. DocksHost, TerminalsHost, MessagesHost, and CommandsHost (plus their built-in dock entries, types, client-side contexts, and the dock-related constants) move from devframe into the kit. Devframe's DevToolsNodeContext now exposes only rpc, views (HTTP file-serving), diagnostics, agent, host, and the JSON-render factory.

The kit gains:

  • createKitContext — wraps createHostContext and attaches the four hub hosts plus optional viteConfig / viteServer.
  • createPluginFromDevframe(d, opts?) — bridges a portable DevtoolDefinition into a Plugin.devtools.setup Vite plugin. Auto-mounts the SPA via views.hostStatic, synthesizes an iframe dock entry from id/name/icon/basePath, runs the devtool's own setup, then runs the optional kit-only opts.setup so authors can register terminals / commands / custom-render docks without polluting the portable definition.
  • A new DTK0050DTK0057 diagnostics range covering the relocated host operations (paired with new docs/errors/DTK00xx.md pages).

Devframe exposes a marked-internal devframe/internal subpath so kit's relocated DocksHost can reach getInternalContext and resolveBasePath without leaking those helpers into devframe's public API. The old devframe/adapters/kit is deleted; core's createDevToolsContext now calls createKitContext. Docs and skills are restructured to match the new positioning: AGENTS.md leads with the framing, the dock / terminals / messages / commands guide pages move from the devframe site into docs/kit/*, and the devframe skill is trimmed to only cover the portable surface (with cross-links into the vite-devtools-kit skill for hub features).

Linked Issues

Additional context

  • All four checks pass: pnpm lint, pnpm typecheck, pnpm test (450/450), pnpm build (9/9 packages).
  • Internal kit-plugins (packages/rolldown, packages/self-inspect) are unchanged at the source level — their Plugin.devtools.setup(ctx) callbacks now implicitly receive a KitNodeContext (which is a structural superset of the old DevToolsNodeContext).
  • This is a breaking change for anyone consuming devframe/adapters/kit directly; ported the devframe-files-inspector example to createPluginFromDevframe from @vitejs/devtools-kit/node.

🤖 Generated with Claude Code

antfu and others added 2 commits May 8, 2026 11:04
Reposition devframe as the portable container for one devtool
integration, and the kit as the hub that unites many of them.

- Move DocksHost, TerminalsHost, MessagesHost, CommandsHost (plus
  associated types and built-in dock entries) from `devframe` into
  `@vitejs/devtools-kit`. Devframe's `DevToolsNodeContext` now exposes
  only `rpc`, `views`, `diagnostics`, `agent`, `host`, and the JSON
  renderer factory.
- Add `createKitContext` (kit/node) that wraps `createHostContext` and
  attaches the four hub hosts plus optional `viteConfig`/`viteServer`.
- Add `createPluginFromDevframe(d, opts?)` (kit/node) — the bridge from
  a portable `DevtoolDefinition` into a `Plugin.devtools.setup` Vite
  plugin. Auto-mounts the SPA via `views.hostStatic`, synthesizes an
  iframe dock entry from `id`/`name`/`icon`/`basePath`, runs the
  devtool's own `setup`, then runs the optional kit-only `opts.setup`.
- Expose `devframe/internal` as a marked-internal subpath so kit's
  relocated `DocksHost` can reach `getInternalContext` and
  `resolveBasePath` without leaking into the public devframe API.
- Delete `devframe/adapters/kit` + its package export. Switch core's
  `createDevToolsContext` to call `createKitContext`. Add new kit-side
  diagnostics (`DTK0050`–`DTK0057`) for the relocated host operations.
- Move `ctx.utils.createSimpleClientScript` to a free function in
  `@vitejs/devtools-kit/node`; drop `ctx.utils` from devframe's
  context.
- Move `ClientScriptEntry`, `RemoteConnectionInfo`,
  `DEFAULT_CATEGORIES_ORDER`, `DEFAULT_STATE_USER_SETTINGS`, and the
  client-side dock contexts (`DocksContext`, `DockEntryState`, etc.)
  to the kit. Devframe keeps only the JSON-render types and the
  framework-neutral RPC/view surface.
- Update `AGENTS.md`/`CLAUDE.md` to lead with the devframe-vs-kit
  positioning. Migrate the Dock/Terminals/Commands/Messages docs and
  the corresponding error pages from the devframe site into the kit
  site (kit becomes the canonical home for hub-only references). Trim
  the `devframe` skill to the portable surface and point at the
  `vite-devtools-kit` skill for hub features.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…terminals

# Conflicts:
#	AGENTS.md
#	devframe/docs/.vitepress/sidebar.ts
#	devframe/docs/guide/devtool-definition.md
#	devframe/docs/guide/dock-system.md
#	devframe/docs/guide/index.md
#	devframe/skills/devframe/SKILL.md
#	docs/.vitepress/config.ts
@antfu antfu changed the title refactor: decouple docks/terminals/messages/commands from devframe fix(devframe)!: decouple docks/terminals/messages/commands from devframe May 8, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 8, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/devtools@317
npm i https://pkg.pr.new/@vitejs/devtools-kit@317
npm i https://pkg.pr.new/@vitejs/devtools-rolldown@317
npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@317

commit: 1a586cb

…terminals

# Conflicts:
#	devframe/docs/errors/DF0001.md
#	devframe/docs/errors/DF0002.md
#	devframe/docs/errors/DF0003.md
#	devframe/docs/errors/DF0004.md
#	devframe/docs/errors/DF0005.md
#	devframe/docs/errors/DF0009.md
#	devframe/docs/errors/DF0010.md
#	devframe/docs/errors/DF0011.md
#	devframe/docs/errors/DF0018.md
#	devframe/docs/errors/index.md
#	docs/errors/index.md
@antfu antfu merged commit f14817a into main May 8, 2026
8 of 9 checks passed
@antfu antfu deleted the antfu/decouple-docks-terminals branch May 8, 2026 03:06
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