@episoda/cli 0.2.172 → 0.2.173

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.
@@ -2996,7 +2996,7 @@ var require_package = __commonJS({
2996
2996
  "package.json"(exports2, module2) {
2997
2997
  module2.exports = {
2998
2998
  name: "@episoda/cli",
2999
- version: "0.2.172",
2999
+ version: "0.2.173",
3000
3000
  description: "CLI tool for Episoda local development workflow orchestration",
3001
3001
  main: "dist/index.js",
3002
3002
  types: "dist/index.d.ts",
@@ -10929,17 +10929,13 @@ var DevServerRunner = class extends import_events2.EventEmitter {
10929
10929
  if (existingEntry) {
10930
10930
  if (existingEntry.worktreePath === projectPath && existingEntry.moduleUid === moduleUid) {
10931
10931
  const wsHealthy = await this.checkWsHealth(wsPort);
10932
- if (wsHealthy) {
10933
- console.log(`[DevServerRunner] EP1042: Correct server already running on port ${port} for ${moduleUid}`);
10934
- return { success: true, alreadyRunning: true };
10932
+ if (!wsHealthy) {
10933
+ console.warn(
10934
+ `[DevServerRunner] EP1412: Existing server for ${moduleUid} has unhealthy ws-server on ${wsPort}; preserving preview because app port ${port} is healthy`
10935
+ );
10935
10936
  }
10936
- console.warn(
10937
- `[DevServerRunner] EP1406: Existing dev server for ${moduleUid} has unhealthy ws-server on port ${wsPort}, restarting`
10938
- );
10939
- await this.killProcessOnPort(port);
10940
- await this.cleanupWsServerOnPort(wsPort, projectPath);
10941
- registry.unregister(existingEntry.moduleUid);
10942
- this.servers.delete(existingEntry.moduleUid);
10937
+ console.log(`[DevServerRunner] EP1042: Correct server already running on port ${port} for ${moduleUid}`);
10938
+ return { success: true, alreadyRunning: true };
10943
10939
  }
10944
10940
  if (existingEntry.worktreePath !== projectPath || existingEntry.moduleUid !== moduleUid) {
10945
10941
  console.log(`[DevServerRunner] EP1042: Port ${port} owned by ${existingEntry.moduleUid} (${existingEntry.worktreePath}), killing...`);
@@ -10963,15 +10959,13 @@ var DevServerRunner = class extends import_events2.EventEmitter {
10963
10959
  const existing = this.servers.get(moduleUid);
10964
10960
  if (existing && !existing.process.killed) {
10965
10961
  const wsHealthy = await this.checkWsHealth(existing.wsPort);
10966
- if (wsHealthy) {
10967
- console.log(`[DevServerRunner] Process already exists for ${moduleUid}`);
10968
- return { success: true, alreadyRunning: true };
10962
+ if (!wsHealthy) {
10963
+ console.warn(
10964
+ `[DevServerRunner] EP1412: In-memory server exists for ${moduleUid} with unhealthy ws-server (${existing.wsPort}); preserving running app process`
10965
+ );
10969
10966
  }
10970
- console.warn(
10971
- `[DevServerRunner] EP1406: In-memory process exists for ${moduleUid} but ws-server is unhealthy on ${existing.wsPort}, restarting`
10972
- );
10973
- await this.stop(moduleUid);
10974
- await this.wait(500);
10967
+ console.log(`[DevServerRunner] Process already exists for ${moduleUid}`);
10968
+ return { success: true, alreadyRunning: true };
10975
10969
  }
10976
10970
  console.log(`[DevServerRunner] Starting dev server for ${moduleUid} on port ${port} (ws:${wsPort})...`);
10977
10971
  const injectedEnvVars = await this.fetchEnvVars(projectPath);
@@ -11006,11 +11000,11 @@ var DevServerRunner = class extends import_events2.EventEmitter {
11006
11000
  console.log(`[DevServerRunner] Waiting for ws-server on port ${wsPort}...`);
11007
11001
  const wsReady = await this.waitForWsPort(wsPort, DEV_SERVER_CONSTANTS.STARTUP_TIMEOUT_MS);
11008
11002
  if (!wsReady) {
11009
- process2.kill();
11010
- this.servers.delete(moduleUid);
11011
11003
  const wsStartError = this.detectWsStartupError(logPath, wsPort);
11012
- this.writeToLog(logPath, wsStartError, true);
11013
- return { success: false, error: wsStartError };
11004
+ this.writeToLog(logPath, `WARN: ${wsStartError}`, true);
11005
+ console.warn(
11006
+ `[DevServerRunner] EP1412: ws-server did not become healthy on ${wsPort}; continuing because preview liveness is app/tunnel based`
11007
+ );
11014
11008
  }
11015
11009
  if (process2.pid) {
11016
11010
  registry.register({
@@ -11636,7 +11630,12 @@ var PreviewManager = class extends import_events3.EventEmitter {
11636
11630
  if (existing && (existing.state === "live" || existing.state === "running")) {
11637
11631
  const appHealthy = await this.devServer.isHealthy(moduleUid);
11638
11632
  const wsHealthy = await this.devServer.isWsHealthy(moduleUid);
11639
- if (appHealthy && wsHealthy) {
11633
+ if (appHealthy) {
11634
+ if (!wsHealthy) {
11635
+ console.warn(
11636
+ `[PreviewManager] EP1412: Preview app is healthy for ${moduleUid}; ws-server unhealthy (${existing.wsPort}) is diagnostics-only for preview liveness`
11637
+ );
11638
+ }
11640
11639
  console.log(`[PreviewManager] Preview already running for ${moduleUid}`);
11641
11640
  return {
11642
11641
  success: true,
@@ -11645,7 +11644,7 @@ var PreviewManager = class extends import_events3.EventEmitter {
11645
11644
  };
11646
11645
  }
11647
11646
  console.warn(
11648
- `[PreviewManager] EP1406: Existing preview for ${moduleUid} is unhealthy (app=${appHealthy}, ws=${wsHealthy}), restarting`
11647
+ `[PreviewManager] EP1412: Existing preview for ${moduleUid} is unhealthy (app=${appHealthy}, ws=${wsHealthy}); restarting due to app health failure`
11649
11648
  );
11650
11649
  await this.stopPreview(moduleUid);
11651
11650
  }