@jhizzard/termdeck 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jhizzard/termdeck",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Browser-based terminal multiplexer with metadata overlays, panel flashback memory recall, and AI-aware session management",
5
5
  "bin": {
6
6
  "termdeck": "./packages/cli/src/index.js"
@@ -385,15 +385,32 @@ async function checkRumen() {
385
385
  // ── Step 4: TermDeck ────────────────────────────────────────────────
386
386
 
387
387
  function execTermDeck({ port, extra }) {
388
- // Rather than execve, just require() the existing CLI in-process. That
389
- // lets `termdeck stack` share signal handling with the server (Ctrl+C
390
- // shuts everything down, including the detached Mnestra if we own it).
388
+ // Spawn a fresh node process for the CLI rather than require()-ing it
389
+ // in-process. Two reasons:
390
+ // 1. require() hits Node's module cache after stack.js index.js
391
+ // stack.js bounces (the v0.5.0 auto-orchestrate path), so the
392
+ // cached index.js is a no-op and the server never starts. This
393
+ // manifested in `scripts/start.sh` which already exec'd node, then
394
+ // v0.5.0's auto-orchestrate routed it back through stack.js, then
395
+ // stack.js tried to re-require the (cached) CLI — silent exit.
396
+ // 2. Pass --no-stack on the way back so index.js definitively skips
397
+ // the auto-orchestrate detection. Defensive even with the spawn.
391
398
  const cliPath = path.join(__dirname, 'index.js');
392
- const argv = [];
399
+ const argv = [cliPath, '--no-stack'];
393
400
  if (port) argv.push('--port', String(port));
394
401
  argv.push(...extra);
395
- process.argv = [process.argv[0], cliPath, ...argv];
396
- require(cliPath);
402
+ const child = spawn(process.execPath, argv, {
403
+ stdio: 'inherit',
404
+ env: process.env,
405
+ });
406
+ child.on('exit', (code, signal) => {
407
+ if (signal) process.kill(process.pid, signal);
408
+ else process.exit(code == null ? 0 : code);
409
+ });
410
+ // Forward Ctrl+C cleanly so the spawned server can shut down.
411
+ for (const sig of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
412
+ process.on(sig, () => { try { child.kill(sig); } catch (_e) { /* gone */ } });
413
+ }
397
414
  }
398
415
 
399
416
  // ── Main ────────────────────────────────────────────────────────────