feat(kit): let launchers offer selectable launch roots#448
Merged
Conversation
Add an optional `roots` field to launcher dock entries so a process launcher can present a root picker before it spawns. The client renders a `<select>` above the launch button; the chosen root is forwarded through the on-launch bridge to the bound command and handed to the process factory as `payload.root` (used as the spawn cwd). The Vitest launcher populates its roots with the project root, workspace root, and every directory holding a Vitest/Vite config in the workspace.
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
A spawned child process has no TTY, so `vitest --ui` defaulted to a single
run and exited, tearing down the server before the embedded UI could open
its WebSocket ("Cannot connect to the server in 60 seconds"). Force
`--watch` so the server stays up. Also sort the config-derived launch
roots for a stable, predictable picker order.
Exclude the project root (cwd) from the launch-root picker unless it actually contains a Vitest/Vite config, since running Vitest from a config-less directory isn't meaningful.
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.
Description
Adds a launch-root picker to launcher docks. When a launcher offers more than the default working directory to run in, the user can now choose where it launches from a dropdown on the launcher card — instead of always spawning in the Vite project root.
What changed
createProcessLaunchergains an optionalrootsoption (DevToolsLaunchRoot[]={ value, label, description? }, wherevalueis the absolute path used as the spawncwd). The launcher entry type is augmented locally (DevToolsViewLauncher) withlauncher.roots; since it's optional, a plain hubDevframeViewLauncherstays assignable. Theprocessfactory now receives the launch payload and can readpayload.root.ViewLauncher.vuerenders a native<select>above the launch button whenever the entry carriesroots(first root selected by default, disabled while loading). The selection travels with the launch: thedevtoolskit:internal:docks:on-launchRPC now accepts a payload and forwards it to the bound command viacommands.execute(command, payload).vitest.config.*/vitest.workspace.*/vite.config.*in the workspace (deduped by absolute path).vitest --uithen spawns in the selected root.The selection is ephemeral client state — no persistence — kept intentionally small; a schema-driven /
json-renderform for richer launch inputs is left for a follow-up.Linked Issues
Additional context
Boundary note for reviewers:
rootslives on the hub-owned launcher entry type, augmented locally in kit for now rather than upstreamed to@devframes/hub— worth deciding whether it should move upstream.This PR was created with the help of an agent.