Repository navigation
Description
Context
#1438 added local release build scripts (merged in #2630). Tier 2 (`bun run build:windows`, Parallels VM automation) was explicitly documented as verified only structurally, not against a real VM — no VM exists on the machine it was built on. A code-review pass that landed after #2630 merged found several genuine correctness/robustness gaps in that unverified path. Filing to track and fix them.
Findings to fix
- `buildRemoteScript()` interpolates `repoPath` unquoted into `cd ${repoPath}`, sent as one command line over ssh with no escaping. A repo path containing a space (a real shape — the tests already exercise `/c/Users/build/nodespace-core`-style paths) breaks the remote `cd`.
- `SSH_HOST`/`SSH_USER`/`REPO_PATH` use `process.env.X ?? 'default'`, which only falls back on null/undefined, not on an explicitly-empty-string override — a misconfigured `NODESPACE_WIN_VM_REPO_PATH=` silently produces a bare `cd` with no argument instead of failing or using the default.
- `isVmRunning()`'s `JSON.parse(listing)` has no try/catch, unlike the near-identical call in `checkPrerequisites()` which is guarded — an unexpected `prlctl list --json` shape throws uncaught with a raw parse error instead of an actionable message.
- `copyArtifactsBack()` hardcodes the literal `'x86_64-pc-windows-msvc'` instead of using the file's own `TARGET` constant, which `buildRemoteScript()` correctly uses everywhere else — a real DRY/maintenance hazard if a second Windows target is ever added.
- `await
$`prlctl stop $ {VM_NAME}`.nothrow();` in the `finally` block discards the stop command's exit code entirely — a failed stop (wedged VM) prints the same "Stopping VM..." message as a successful one, so a failure is silently indistinguishable from success. - `prlctl start` runs before the `try` block whose `finally` is the only code responsible for stopping the VM — if `start` rejects after the VM has actually begun starting, the finally never runs and the VM is left running with nothing telling the user.
Out of scope (lower-priority / dormant, not fixing here)
Several DRY/duplication observations (target triple repeated across files, sidecar build+copy pattern duplicated, `commandExists()` duplicated between build-windows.ts and build-windows-quick.ts) and two dormant gaps with no live caller that triggers them (`build-skill.ts`'s `--target` bypassing the platform gate, `parseTargetArg` not validating the value isn't another flag). Left as documented tech debt rather than a larger refactor.
Activity