stack/packages/stack-cli
Bilal Godil d3f0581251 fix(cli): address PR review — pid recycling, cache validation, fail-open
Three unresolved review findings on the auto-update feature:

- killLocalDashboard (greptile P1): after SIGTERM, the wait loop gated on
  processExists(pid), which false-positives if the dashboard exits and its pid
  is recycled onto another same-user process — spinning the full timeout and
  then SIGKILLing the unrelated process. Gate purely on the port being freed
  (the property that actually lets the replacement bind). SIGKILL is now only
  reached when the port is still occupied, i.e. the process is still up and the
  pid is necessarily valid.
- dev-env-state (greptile P2): validate the on-disk cliUpdateCheck cache shape
  on read; a non-string latestVersion would otherwise reach version parsing and
  throw. Malformed entries are treated as "no cache".
- maybeReexecToLatest (cubic P2): documented "fail open" but readDevEnvState
  could throw (corrupt/bad-permission state file) and crash `stack dev`. Wrap
  the body in try/catch so any unexpected error falls through to the installed
  CLI.

Tests: +4 — recycled-pid early-return without SIGKILL, malformed/well-formed
cache read, and fail-open on a corrupt state file. 170 pass.
2026-05-29 12:42:00 -07:00
..
scripts Merge branch 'cl/romantic-mendel-5a2c25' into cl/hexclave-pr3 2026-05-26 10:15:27 -07:00
src fix(cli): address PR review — pid recycling, cache validation, fail-open 2026-05-29 12:42:00 -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