episoda 0.2.42 → 0.2.44
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.
|
@@ -2682,7 +2682,7 @@ var require_package = __commonJS({
|
|
|
2682
2682
|
"package.json"(exports2, module2) {
|
|
2683
2683
|
module2.exports = {
|
|
2684
2684
|
name: "episoda",
|
|
2685
|
-
version: "0.2.
|
|
2685
|
+
version: "0.2.44",
|
|
2686
2686
|
description: "CLI tool for Episoda local development workflow orchestration",
|
|
2687
2687
|
main: "dist/index.js",
|
|
2688
2688
|
types: "dist/index.d.ts",
|
|
@@ -3977,7 +3977,7 @@ var os2 = __toESM(require("os"));
|
|
|
3977
3977
|
|
|
3978
3978
|
// src/tunnel/tunnel-api.ts
|
|
3979
3979
|
var import_core6 = __toESM(require_dist());
|
|
3980
|
-
async function provisionNamedTunnel(moduleId) {
|
|
3980
|
+
async function provisionNamedTunnel(moduleId, port = 3e3) {
|
|
3981
3981
|
const config = await (0, import_core6.loadConfig)();
|
|
3982
3982
|
if (!config?.access_token) {
|
|
3983
3983
|
return { success: false, error: "Not authenticated" };
|
|
@@ -3990,7 +3990,8 @@ async function provisionNamedTunnel(moduleId) {
|
|
|
3990
3990
|
"Authorization": `Bearer ${config.access_token}`,
|
|
3991
3991
|
"Content-Type": "application/json"
|
|
3992
3992
|
},
|
|
3993
|
-
|
|
3993
|
+
// EP1027: Include port for ingress configuration
|
|
3994
|
+
body: JSON.stringify({ module_id: moduleId, port })
|
|
3994
3995
|
});
|
|
3995
3996
|
const data = await response.json();
|
|
3996
3997
|
if (!response.ok) {
|
|
@@ -4011,7 +4012,7 @@ async function provisionNamedTunnel(moduleId) {
|
|
|
4011
4012
|
};
|
|
4012
4013
|
}
|
|
4013
4014
|
}
|
|
4014
|
-
async function provisionNamedTunnelByUid(moduleUid) {
|
|
4015
|
+
async function provisionNamedTunnelByUid(moduleUid, port = 3e3) {
|
|
4015
4016
|
const config = await (0, import_core6.loadConfig)();
|
|
4016
4017
|
if (!config?.access_token) {
|
|
4017
4018
|
return { success: false, error: "Not authenticated" };
|
|
@@ -4037,7 +4038,7 @@ async function provisionNamedTunnelByUid(moduleUid) {
|
|
|
4037
4038
|
error: `Module ${moduleUid} has no ID (response keys: ${JSON.stringify(Object.keys(moduleData))})`
|
|
4038
4039
|
};
|
|
4039
4040
|
}
|
|
4040
|
-
return provisionNamedTunnel(moduleId);
|
|
4041
|
+
return provisionNamedTunnel(moduleId, port);
|
|
4041
4042
|
} catch (error) {
|
|
4042
4043
|
return {
|
|
4043
4044
|
success: false,
|
|
@@ -4759,8 +4760,9 @@ var TunnelManager = class extends import_events.EventEmitter {
|
|
|
4759
4760
|
}
|
|
4760
4761
|
const mode = resolvedOptions.mode || "named";
|
|
4761
4762
|
if (mode === "named" && !resolvedOptions.tunnelToken && moduleUid !== "LOCAL") {
|
|
4762
|
-
|
|
4763
|
-
|
|
4763
|
+
const port2 = resolvedOptions.port || 3e3;
|
|
4764
|
+
console.log(`[Tunnel] EP948: Provisioning Named Tunnel for ${moduleUid} on port ${port2}...`);
|
|
4765
|
+
const provisionResult = await provisionNamedTunnelByUid(moduleUid, port2);
|
|
4764
4766
|
if (provisionResult.success && provisionResult.tunnel) {
|
|
4765
4767
|
console.log(`[Tunnel] EP948: Named Tunnel provisioned: ${provisionResult.tunnel.preview_url}`);
|
|
4766
4768
|
resolvedOptions = {
|
|
@@ -8824,67 +8826,9 @@ var Daemon = class _Daemon {
|
|
|
8824
8826
|
throw error;
|
|
8825
8827
|
}
|
|
8826
8828
|
}
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
* Runs asynchronously to reduce burden on the state change handler.
|
|
8831
|
-
* Steps:
|
|
8832
|
-
* 1. Stop dev server for the module
|
|
8833
|
-
* 2. Log worktree path for potential removal (actual removal TBD)
|
|
8834
|
-
*
|
|
8835
|
-
* Note: Worktree removal requires git worktree remove command, which
|
|
8836
|
-
* needs careful handling to avoid data loss. For now, just stop the
|
|
8837
|
-
* dev server and log the path.
|
|
8838
|
-
*/
|
|
8839
|
-
async cleanupModuleWorktree(moduleUid) {
|
|
8840
|
-
console.log(`[Daemon] EP956: Starting async cleanup for ${moduleUid}`);
|
|
8841
|
-
try {
|
|
8842
|
-
await stopDevServer(moduleUid);
|
|
8843
|
-
console.log(`[Daemon] EP956: Dev server stopped for ${moduleUid}`);
|
|
8844
|
-
const worktree = await getWorktreeInfoForModule(moduleUid);
|
|
8845
|
-
if (worktree?.exists && worktree.path) {
|
|
8846
|
-
console.log(`[Daemon] EP994: Removing worktree for ${moduleUid} at ${worktree.path}`);
|
|
8847
|
-
const projectRoot = await findProjectRoot(worktree.path);
|
|
8848
|
-
if (projectRoot) {
|
|
8849
|
-
const manager = new WorktreeManager(projectRoot);
|
|
8850
|
-
if (await manager.initialize()) {
|
|
8851
|
-
const result = await manager.removeWorktree(moduleUid, true);
|
|
8852
|
-
if (result.success) {
|
|
8853
|
-
console.log(`[Daemon] EP994: Successfully removed worktree for ${moduleUid}`);
|
|
8854
|
-
} else {
|
|
8855
|
-
console.warn(`[Daemon] EP994: Could not remove worktree for ${moduleUid}: ${result.error}`);
|
|
8856
|
-
}
|
|
8857
|
-
} else {
|
|
8858
|
-
console.warn(`[Daemon] EP994: Could not initialize WorktreeManager for ${moduleUid}`);
|
|
8859
|
-
}
|
|
8860
|
-
} else {
|
|
8861
|
-
console.warn(`[Daemon] EP994: Could not find project root for ${moduleUid} worktree`);
|
|
8862
|
-
}
|
|
8863
|
-
} else {
|
|
8864
|
-
console.log(`[Daemon] EP994: No worktree to remove for ${moduleUid}`);
|
|
8865
|
-
}
|
|
8866
|
-
try {
|
|
8867
|
-
const cleanupConfig = await (0, import_core11.loadConfig)();
|
|
8868
|
-
const cleanupApiUrl = cleanupConfig?.api_url || "https://episoda.dev";
|
|
8869
|
-
await fetchWithAuth(`${cleanupApiUrl}/api/modules/${moduleUid}`, {
|
|
8870
|
-
method: "PATCH",
|
|
8871
|
-
headers: { "Content-Type": "application/json" },
|
|
8872
|
-
body: JSON.stringify({
|
|
8873
|
-
worktree_status: null,
|
|
8874
|
-
worktree_path: null,
|
|
8875
|
-
worktree_error: null
|
|
8876
|
-
})
|
|
8877
|
-
});
|
|
8878
|
-
console.log(`[Daemon] EP995: Cleared worktree status for ${moduleUid}`);
|
|
8879
|
-
} catch (clearError) {
|
|
8880
|
-
console.warn(`[Daemon] EP995: Failed to clear worktree status for ${moduleUid}:`, clearError);
|
|
8881
|
-
}
|
|
8882
|
-
console.log(`[Daemon] EP956: Async cleanup complete for ${moduleUid}`);
|
|
8883
|
-
} catch (error) {
|
|
8884
|
-
console.error(`[Daemon] EP956: Cleanup error for ${moduleUid}:`, error instanceof Error ? error.message : error);
|
|
8885
|
-
throw error;
|
|
8886
|
-
}
|
|
8887
|
-
}
|
|
8829
|
+
// EP1025: Removed cleanupModuleWorktree - was dead code (never called).
|
|
8830
|
+
// Worktree cleanup is handled by server's cleanupWorktreeAsync which sends
|
|
8831
|
+
// worktree_remove command via WebSocket, handled by GitExecutor.executeWorktreeRemove.
|
|
8888
8832
|
/**
|
|
8889
8833
|
* EP1002: Handle worktree_setup command from server
|
|
8890
8834
|
* This provides a unified setup flow for both local and cloud environments.
|