stack/packages/stack-cli
Bilal Godil a29d93ed92 refactor(cli): address review feedback on auto-update
Correctness:
- killLocalDashboard now waits for the process to actually exit (not just
  for /health to stop answering) before returning, so the replacement
  dashboard doesn't hit EADDRINUSE while the old socket is still held.
- Bail out without waiting/SIGKILL when the recorded pid is gone (ESRCH) or
  owned by another process (EPERM, i.e. pid was recycled), avoiding a hang
  and reducing the chance of signalling an unrelated process.

Quality / dedup:
- Extract shared helpers: lib/own-package.ts (single source for reading the
  CLI's own package.json + bin resolution; now used by index.ts, sentry.ts,
  self-update.ts — was duplicated 3x) and lib/child-process.ts
  (forwardSignals, used by dev.ts, emulator.ts, self-update.ts).
- Extract pure decision functions for testability: decideReexec() and
  shouldRestartDashboard()/processExists().
- Fix a stale comment that claimed jsdom is the test env (it's node).

Tests: +35 cases — decideReexec branches, resolveBinName/parseOwnPackage,
isVersionNewer edges (v-prefix, x.y, both-prerelease, large nums),
resolveLatestVersion (TTL boundary, malformed/non-string body, fetch URL,
npm_config_registry), buildNpxInvocation (windows, spaced/dashed args),
shouldRestartDashboard table, killLocalDashboard early returns,
dev-env-state back-compat + clobber. 167 pass.
2026-05-29 11:29:19 -07:00
..
scripts Merge branch 'cl/romantic-mendel-5a2c25' into cl/hexclave-pr3 2026-05-26 10:15:27 -07:00
src refactor(cli): address review feedback on auto-update 2026-05-29 11:29:19 -07:00
.eslintrc.cjs Stack CLI (#1227) 2026-03-09 13:24:15 -07:00
package.json chore(hexclave): point repository URLs at hexclave/hexclave ahead of repo rename 2026-05-28 18:54:26 -07:00
tsconfig.json Stack CLI (#1227) 2026-03-09 13:24:15 -07:00
tsdown.config.ts stack-cli: cloud/local init flow, auto-create on empty projects, post-setup next-steps (#1383) 2026-05-08 10:47:49 -07:00
vitest.config.ts Fast-start local emulator via RAM snapshot + live secret rotation (#1340) 2026-04-20 14:24:49 -07:00