stack/packages/stack-cli
Bilal Godil d94aa661d8 capture emulator snapshot locally during pull instead of shipping from CI
QEMU migration state isn't portable across accelerators — a KVM-captured
snapshot won't resume under HVF, and `-cpu max` feature sets differ across
hosts. Instead of trying to match every (KVM/HVF/TCG, amd64/arm64)
combination in CI, capture the snapshot on the user's own machine during
`stack emulator pull`: download the qcow2, cold-boot once, wait for all
services, QMP migrate via mapped-ram + multifd, compress. Subsequent
`stack emulator start`s fast-resume in ~3-8s as before.

- Factor qmp_session + capture_vm_state out of build-image.sh into
  common.sh so run-emulator.sh can call them.
- Add cmd_capture to run-emulator.sh. build_qemu_cmd emits the
  resume-compatible device layout (phantom ISOs, no virtfs, fsdev +
  pcie-root-port, pinned 4096MB/4CPU) with -incoming defer gated on an
  actual snapshot being present, so capture mode reuses the same path.
- Capture regenerates runtime-config.iso with STACK_EMULATOR_VM_DIR_HOST
  empty — virtfs is detached for migration compat so /host isn't mounted;
  the `install internal-pck → /host/$VM_DIR_HOST` path would otherwise
  fail and restart-loop stack.service. Mirrors build-image.sh's CI
  runtime.env shape.
- stack-cli `pull` downloads only the qcow2 then invokes run-emulator.sh
  capture. Add --skip-snapshot for CI/debug. startEmulator auto-captures
  on the auto-pull fallback.
- Revert the arm64 CI split: delete qemu-emulator-build-arm64.yaml,
  restore arm64 to the unified matrix on ubicloud-standard-8 under
  cross-arch TCG (macOS HVF runner existed only to produce a portable
  snapshot; no longer needed). Drop savevm.zst from package/upload/publish
  steps; update release notes.

Verified end-to-end on an arm64 Mac under HVF: capture 50s, fast-resume
6.5s, all services green.
2026-04-16 11:12:42 -07:00
..
scripts local emulator security and features fixes (#1247) 2026-04-14 15:36:24 -07:00
src capture emulator snapshot locally during pull instead of shipping from CI 2026-04-16 11:12:42 -07:00
.eslintrc.cjs Stack CLI (#1227) 2026-03-09 13:24:15 -07:00
package.json Merge remote-tracking branch 'origin/dev' into local-emulator-qol-fixes 2026-04-15 14:08:00 -07:00
tsconfig.json Stack CLI (#1227) 2026-03-09 13:24:15 -07:00
tsdown.config.ts CLI init (#1242) 2026-03-13 10:55:22 -07:00
vitest.config.ts faster snapshot resume via mapped-ram + rotation opt-out 2026-04-15 13:04:15 -07:00