feat(devtools)!: reuse the built-in Terminals dock via ctx.terminals#1026
Open
antfubot wants to merge 1 commit into
Open
feat(devtools)!: reuse the built-in Terminals dock via ctx.terminals#1026antfubot wants to merge 1 commit into
antfubot wants to merge 1 commit into
Conversation
Retire Nuxt DevTools' bespoke @xterm terminal UI + RPC and surface terminal sessions through the Vite DevTools terminals host (ctx.terminals), so they render in the built-in Terminals dock. Existing modules keep working: the devtools:terminal:* hooks are bridged onto ctx.terminals as read-only registered sessions (module still owns the process and streams output). A new opt-in interactive PTY path is added via a devtools:terminal:spawn hook and the startDevToolsTerminal() helper. Exit-driven cleanup for the internal module-install / analyze-build / npm-update flows is preserved by broadcasting terminal exits from their startChildProcess producers. Created with the help of an agent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements plan
02-terminals-reusefrom the Vite DevTools integration series. Nuxt DevTools stops shipping its own@xtermterminal UI + RPC and instead surfaces terminal sessions through the devframe terminals host (ctx.terminals), so they render in Vite DevTools' built-in Terminals dock (which auto-hides when empty). The Nuxt "Terminals" tab is removed.Existing modules keep working via a compat shim, and a new opt-in interactive PTY path is added.
What changed
Server bridge (
server-rpc/terminals.ts, rewritten)devtools:terminal:*hooks ontoctx.terminalsinstead of maintaining its ownMap+ RPC:register→ a read-onlyDevframeTerminalSessioncarrying aReadableStream(registered viactx.terminals.register). Re-registration resets/clears in place, sostartSubprocess().clear()/restart()still work.write→controller.enqueue(data);exit→ close stream +update(status);remove→ dispose + remove the session.devtools:terminal:spawnhook →ctx.terminals.startChildProcess(output-only) orctx.terminals.startPtySession(interactive PTY,zigptywith graceful pipe fallback).devtools:readycallback.Kit surface (
@nuxt/devtools-kit)SpawnTerminalOptions, thedevtools:terminal:spawnhook, and astartDevToolsTerminal()helper (opt-in PTY).getTerminals/getTerminalDetail/runTerminalAction+onTerminalDatafrom the RPC types (keptonTerminalExit).TerminalState/TerminalInfo/TerminalActionand thedevtools:terminal:*module-facing hooks are preserved.Internal producers — module-install / analyze-build / npm-update already spawn via
startChildProcess; they now broadcastonTerminalExiton process exit so their transient UI state (installing-modules, "Building…", update spinner) still clears. Exit-driven cleanup is not lost.Client — deleted the
terminals.vuetab,TerminalPage.vue,TerminalView.vue; removeduseTerminals,useCurrentTerminalId, theonTerminalDatahandler, and all/modules/terminalsnavigation (replaced with a "follow the output in the Terminals dock" hint). Removed the@xterm/*deps frompackage.json,pnpm-workspace.yaml, and the clientnuxt.config.tsbundling/optimizeDeps; refreshed the lockfile.Docs — documented
startDevToolsTerminal()and refreshed the "Terminals tab" references.Notes / breaking changes
getTerminals/getTerminalDetail/runTerminalAction) and the@xtermUI are removed. Module-facing hooks (devtools:terminal:register/write/remove/exit) andstartSubprocess()continue to work via the shim.startSubprocess/getProcess()deprecation codes (NDT_DEP_0004/0001) already shipped; this PR swaps the underlying implementation rather than adding new codes.Verification
pnpm lint,pnpm typecheck,pnpm build, andpnpm test:unitall pass.This PR was created with the help of an agent.