episoda 0.2.92 → 0.2.93

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.
@@ -2786,7 +2786,7 @@ var require_package = __commonJS({
2786
2786
  "package.json"(exports2, module2) {
2787
2787
  module2.exports = {
2788
2788
  name: "episoda",
2789
- version: "0.2.92",
2789
+ version: "0.2.93",
2790
2790
  description: "CLI tool for Episoda local development workflow orchestration",
2791
2791
  main: "dist/index.js",
2792
2792
  types: "dist/index.d.ts",
@@ -6637,19 +6637,14 @@ var PreviewManager = class extends import_events3.EventEmitter {
6637
6637
  *
6638
6638
  * Must be called before starting any previews.
6639
6639
  * Initializes the tunnel manager (ensures cloudflared, cleans orphans).
6640
- * EP1119: Skips tunnel initialization in cloud mode - supervisord manages cloudflared there.
6640
+ * EP1148: TunnelManager initializes in both local and cloud modes for unified behavior.
6641
6641
  */
6642
6642
  async initialize() {
6643
6643
  if (this.initialized) {
6644
6644
  return;
6645
6645
  }
6646
6646
  console.log("[PreviewManager] Initializing...");
6647
- const modeConfig = getDaemonModeConfig();
6648
- if (modeConfig.mode === "cloud") {
6649
- console.log("[PreviewManager] EP1119: Skipping TunnelManager init in cloud mode");
6650
- } else {
6651
- await this.tunnel.initialize();
6652
- }
6647
+ await this.tunnel.initialize();
6653
6648
  this.initialized = true;
6654
6649
  console.log("[PreviewManager] Initialized");
6655
6650
  }
@@ -6666,7 +6661,7 @@ var PreviewManager = class extends import_events3.EventEmitter {
6666
6661
  * @returns Result with success status and preview URL
6667
6662
  */
6668
6663
  async startPreview(config) {
6669
- const { moduleUid, worktreePath, port = DEFAULT_PORT, customCommand, skipTunnel } = config;
6664
+ const { moduleUid, worktreePath, port = DEFAULT_PORT, customCommand } = config;
6670
6665
  if (!worktreePath) {
6671
6666
  return { success: false, error: "Worktree path is required" };
6672
6667
  }
@@ -6730,17 +6725,6 @@ var PreviewManager = class extends import_events3.EventEmitter {
6730
6725
  state.state = "running";
6731
6726
  this.emitStateChange(moduleUid, "running");
6732
6727
  console.log(`[PreviewManager] Dev server running on port ${port}`);
6733
- if (skipTunnel) {
6734
- console.log(`[PreviewManager] EP1119: Skipping tunnel management for ${moduleUid} (cloud mode)`);
6735
- state.state = "live";
6736
- this.emitStateChange(moduleUid, "live");
6737
- this.startingModules.delete(moduleUid);
6738
- return {
6739
- success: true,
6740
- previewUrl: void 0
6741
- // URL comes from Cloudflare Named Tunnel, not local
6742
- };
6743
- }
6744
6728
  console.log(`[PreviewManager] Starting Named Tunnel for ${moduleUid}...`);
6745
6729
  state.state = "tunneling";
6746
6730
  this.emitStateChange(moduleUid, "tunneling");
@@ -9850,9 +9834,7 @@ var Daemon = class _Daemon {
9850
9834
  moduleUid: cmd.moduleUid,
9851
9835
  worktreePath: worktree.path,
9852
9836
  port,
9853
- customCommand,
9854
- skipTunnel: modeConfig.mode === "cloud"
9855
- // EP1119: Cloud mode - supervisord handles cloudflared
9837
+ customCommand
9856
9838
  });
9857
9839
  if (startResult.success) {
9858
9840
  console.log(`[Daemon] EP1024: Preview started for ${cmd.moduleUid}: ${startResult.previewUrl}`);
@@ -10822,27 +10804,25 @@ var Daemon = class _Daemon {
10822
10804
  );
10823
10805
  const modeConfig = getDaemonModeConfig();
10824
10806
  if (modeConfig.mode === "cloud") {
10825
- console.log(`[Daemon] EP1122: Cloud mode - auto-starting dev server for ${moduleUid}`);
10807
+ console.log(`[Daemon] EP1148: Cloud mode - auto-starting preview for ${moduleUid}`);
10826
10808
  try {
10827
10809
  const previewManager = getPreviewManager();
10828
10810
  const customCommand = setupConfig?.worktree_dev_server_script;
10829
- const port = modeConfig.fixedPort || 3e3;
10811
+ const port = allocatePort(moduleUid);
10830
10812
  const startResult = await previewManager.startPreview({
10831
10813
  moduleUid,
10832
10814
  worktreePath,
10833
10815
  port,
10834
- customCommand,
10835
- skipTunnel: true
10836
- // Cloud mode - supervisord manages cloudflared
10816
+ customCommand
10837
10817
  });
10838
10818
  if (startResult.success) {
10839
- console.log(`[Daemon] EP1122: Dev server started on port ${port} for ${moduleUid}`);
10819
+ console.log(`[Daemon] EP1148: Preview started on port ${port} for ${moduleUid}: ${startResult.previewUrl}`);
10840
10820
  } else {
10841
- console.warn(`[Daemon] EP1122: Dev server start failed (non-fatal): ${startResult.error}`);
10821
+ console.warn(`[Daemon] EP1148: Preview start failed (non-fatal): ${startResult.error}`);
10842
10822
  }
10843
10823
  } catch (previewError) {
10844
10824
  const errMsg = previewError instanceof Error ? previewError.message : String(previewError);
10845
- console.warn(`[Daemon] EP1122: Dev server auto-start error (non-fatal): ${errMsg}`);
10825
+ console.warn(`[Daemon] EP1148: Preview auto-start error (non-fatal): ${errMsg}`);
10846
10826
  }
10847
10827
  }
10848
10828
  return {