Skip to content

Script Picker

tavlean edited this page May 28, 2026 · 2 revisions

Script Picker

pickDevScript(cwd) in src/servers.ts picks which package.json script to run.

Algorithm

  1. Canonical name chain: devstartdevelop. First match wins.
  2. If none, walk scripts in declared order and inspect each value against a token list. First match wins.
  3. If still none, throw, which surfaces in the launcher as a clear error toast.

Token list

Catches monorepo conventions like dev:web, start:dev, framework-specific scripts:

vite, next dev, astro dev, nuxt dev, webpack-dev-server, webpack serve,
parcel, gatsby develop, remix dev / remix vite:dev, turbo dev,
bun --watch / --hot / run dev, nodemon, tsx watch, ts-node-dev,
serve, http-server, live-server

Patterns are conservative: \bvite\b(?!\s+(?:build|preview|optimize)) excludes obvious non-dev usages so a build:vite-config doesn't get picked.

Determinism

V8 preserves object insertion order, so the same package.json always picks the same script. No flakiness across runs.

Future scope

  • Per-project script override. Some users may want to pin a specific script per project even if the heuristic picks another. Would need a small preference store keyed by canonical cwd. Not yet implemented because real-world need hasn't shown up.
  • New dev-server tools land regularly; the token list will need occasional updates. Adding a token is a one-line change.

Clone this wiki locally