Files
vue-tui/packages/cli
Yunfei He 900e4176f9 fix(cli): guard reload against shutdown to prevent orphan child (#183)
A vue-tui:request-reload arriving during the Ctrl+C shutdown window
spawned an orphan child the parent never kills. The reload path and the
shutdown path did not compose: handleReloadRequest only consulted the 3s
startup gate, never isShuttingDown, so a reload accepted during the
pm.shutdown() teardown window ran extractBundle then pm.restart() — which
schedules a fresh 100ms restartTimer. pm.shutdown() had already cleared
its own restartTimer at entry, so nothing cancels the new one; it fires
doSpawn() and creates a brand-new child after the parent has exited.

Fix mirrors respawnTick's existing two-check guard:
- Fast gate: compose shouldAccept as
  `() => acceptReloads && !shutdown.isShuttingDown()` so reloads are
  ignored once Ctrl+C teardown begins.
- Post-await guard (load-bearing): thread isShuttingDown into
  ReloadRequestDeps and re-check it after `await extractBundle` and
  before pm.setBundlePath/pm.restart, covering the case where shutdown
  starts mid-extraction.

The hot handler registration is moved after createShutdown() so the
forward reference resolves (closures read at event time regardless).
Scope is only this reload-vs-shutdown guard; respawnTick, createShutdown
internals, process-manager.ts, and bundle-extractor.ts are unchanged.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 22:44:15 +08:00
..

@vue-tui/cli

Early stage — under active development. Bug reports welcome, but not recommended for production use yet.

Development server for vue-tui — Vite-powered HMR for Vue 3 terminal apps.

npm version npm downloads

Why

  • Terminal HMR — edit a .vue file, see the terminal update instantly
  • Works with your Vite config — just run vue-tui dev in a project with index.html and your existing Vite plugins
  • Crash recovery — auto-restarts the process after a crash

Built on Vite's bundledDev mode. Bundles your vue-tui app into a single Node.js process with hot module replacement — the same edit-save-see loop you get with Vite on the web, but for TUI development.

Install

npm install -D @vue-tui/cli

Usage

vue-tui dev

Starts a Vite dev server in bundledDev mode, builds your app, and runs it in a managed child process. Most file changes are applied via HMR; changes that require a full reload restart the process automatically.

package.json script

{
  "scripts": {
    "dev": "vue-tui dev"
  }
}

License

MIT