episoda 0.2.102 → 0.2.103
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/dist/daemon/daemon-process.js +1 -1
- package/dist/daemon/daemon-process.js.map +1 -1
- package/dist/index.js +40 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4044,39 +4044,52 @@ async function daemonCommand(options = {}) {
|
|
|
4044
4044
|
status.error("Daemon is running but not responding. Try: episoda stop && episoda dev");
|
|
4045
4045
|
process.exit(1);
|
|
4046
4046
|
}
|
|
4047
|
+
let connectId;
|
|
4048
|
+
let connectPath;
|
|
4047
4049
|
if (projectPath && config.project_id) {
|
|
4050
|
+
connectId = config.project_id;
|
|
4051
|
+
connectPath = projectPath;
|
|
4048
4052
|
status.info("Connecting project to Episoda...");
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
} catch (error) {
|
|
4064
|
-
lastError = error instanceof Error ? error.message : String(error);
|
|
4065
|
-
}
|
|
4053
|
+
} else if (isCloudMode && config.workspace_id) {
|
|
4054
|
+
connectId = config.workspace_id;
|
|
4055
|
+
connectPath = process.env.HOME || "/home/episoda";
|
|
4056
|
+
status.info("Connecting workspace to Episoda...");
|
|
4057
|
+
} else {
|
|
4058
|
+
status.error("Cannot connect: missing project_id (local) or workspace_id (cloud)");
|
|
4059
|
+
process.exit(1);
|
|
4060
|
+
}
|
|
4061
|
+
let connected = false;
|
|
4062
|
+
let lastError;
|
|
4063
|
+
for (let retry = 0; retry < CONNECTION_MAX_RETRIES && !connected; retry++) {
|
|
4064
|
+
if (retry > 0) {
|
|
4065
|
+
status.info(`Retrying connection (attempt ${retry + 1}/${CONNECTION_MAX_RETRIES})...`);
|
|
4066
|
+
await new Promise((resolve5) => setTimeout(resolve5, 1e3));
|
|
4066
4067
|
}
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4068
|
+
try {
|
|
4069
|
+
const result = await addProject(connectId, connectPath);
|
|
4070
|
+
if (result.connected) {
|
|
4071
|
+
connected = true;
|
|
4072
|
+
} else {
|
|
4073
|
+
lastError = result.error || "Connection failed";
|
|
4074
|
+
}
|
|
4075
|
+
} catch (error) {
|
|
4076
|
+
lastError = error instanceof Error ? error.message : String(error);
|
|
4071
4077
|
}
|
|
4078
|
+
}
|
|
4079
|
+
if (!connected) {
|
|
4080
|
+
status.error(`Failed to connect: ${lastError}`);
|
|
4081
|
+
status.info("Check server status at https://episoda.dev/api/system/health");
|
|
4082
|
+
process.exit(1);
|
|
4083
|
+
}
|
|
4084
|
+
if (isCloudMode && !config.project_id) {
|
|
4085
|
+
status.success("Connected to Episoda (workspace mode)");
|
|
4086
|
+
} else {
|
|
4072
4087
|
status.success("Connected to Episoda");
|
|
4073
|
-
} else if (isCloudMode) {
|
|
4074
|
-
status.success("Daemon started in cloud mode (awaiting project)");
|
|
4075
4088
|
}
|
|
4076
4089
|
if (options.foreground) {
|
|
4077
4090
|
status.info("");
|
|
4078
|
-
if (isCloudMode
|
|
4079
|
-
status.info("Daemon
|
|
4091
|
+
if (isCloudMode) {
|
|
4092
|
+
status.info("Daemon connected in cloud mode. Ready for worktree commands.");
|
|
4080
4093
|
} else {
|
|
4081
4094
|
status.info("Daemon connected! Dev servers start automatically when you begin work on a module.");
|
|
4082
4095
|
}
|
|
@@ -4096,8 +4109,8 @@ Received ${signal}. Daemon continues running in background.`);
|
|
|
4096
4109
|
});
|
|
4097
4110
|
} else {
|
|
4098
4111
|
status.info("");
|
|
4099
|
-
if (isCloudMode
|
|
4100
|
-
status.info("Daemon running in cloud mode.
|
|
4112
|
+
if (isCloudMode) {
|
|
4113
|
+
status.info("Daemon running in cloud mode. Use `episoda status` to check connection.");
|
|
4101
4114
|
} else {
|
|
4102
4115
|
status.info("Daemon running in background. Use `episoda status` to check connection.");
|
|
4103
4116
|
}
|