episoda 0.2.101 → 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 +74 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3977,40 +3977,54 @@ async function daemonCommand(options = {}) {
|
|
|
3977
3977
|
await new Promise((resolve5) => setTimeout(resolve5, 2e3));
|
|
3978
3978
|
}
|
|
3979
3979
|
}
|
|
3980
|
-
let projectPath;
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3980
|
+
let projectPath = null;
|
|
3981
|
+
if (!isCloudMode) {
|
|
3982
|
+
const serverPath = await fetchProjectPath(config, config.project_id);
|
|
3983
|
+
if (serverPath && fs4.existsSync(serverPath)) {
|
|
3984
|
+
projectPath = serverPath;
|
|
3985
|
+
status.debug(`Using server-synced project path: ${projectPath}`);
|
|
3986
|
+
} else {
|
|
3987
|
+
const detectedRoot = findGitRoot(options.cwd || process.cwd());
|
|
3988
|
+
projectPath = detectedRoot || path5.resolve(options.cwd || process.cwd());
|
|
3989
|
+
if (detectedRoot) {
|
|
3990
|
+
status.debug(`Detected project root: ${projectPath}`);
|
|
3991
|
+
} else {
|
|
3992
|
+
status.warning(`Could not detect git root, using: ${projectPath}`);
|
|
3993
|
+
}
|
|
3994
|
+
syncProjectPath(config, config.project_id, projectPath).catch(() => {
|
|
3995
|
+
});
|
|
3996
|
+
}
|
|
3997
|
+
const episodaProjectRoot = await findProjectRoot(projectPath);
|
|
3998
|
+
if (!episodaProjectRoot) {
|
|
3999
|
+
status.error("Not an Episoda project.");
|
|
4000
|
+
status.info("");
|
|
4001
|
+
status.info("Use `episoda clone {workspace}/{project}` to set up a project.");
|
|
4002
|
+
status.info("");
|
|
4003
|
+
process.exit(1);
|
|
4004
|
+
}
|
|
4005
|
+
projectPath = episodaProjectRoot;
|
|
4006
|
+
const isWorktree = await isWorktreeProject(projectPath);
|
|
4007
|
+
if (!isWorktree) {
|
|
4008
|
+
status.error("Invalid Episoda project configuration.");
|
|
4009
|
+
process.exit(1);
|
|
4010
|
+
}
|
|
4011
|
+
const bareRepoPath = path5.join(projectPath, ".bare");
|
|
4012
|
+
const scriptsExtracted = await extractBootstrapScripts(bareRepoPath, projectPath);
|
|
4013
|
+
if (scriptsExtracted) {
|
|
4014
|
+
status.success("Bootstrap scripts extracted");
|
|
4015
|
+
}
|
|
3985
4016
|
} else {
|
|
3986
4017
|
const detectedRoot = findGitRoot(options.cwd || process.cwd());
|
|
3987
|
-
projectPath = detectedRoot || path5.resolve(options.cwd || process.cwd());
|
|
3988
4018
|
if (detectedRoot) {
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
4019
|
+
const episodaProjectRoot = await findProjectRoot(detectedRoot);
|
|
4020
|
+
if (episodaProjectRoot) {
|
|
4021
|
+
projectPath = episodaProjectRoot;
|
|
4022
|
+
status.debug(`Cloud mode: Found project at ${projectPath}`);
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
if (!projectPath) {
|
|
4026
|
+
status.info("Cloud mode: No project detected. Daemon will wait for worktree creation.");
|
|
3992
4027
|
}
|
|
3993
|
-
syncProjectPath(config, config.project_id, projectPath).catch(() => {
|
|
3994
|
-
});
|
|
3995
|
-
}
|
|
3996
|
-
const episodaProjectRoot = await findProjectRoot(projectPath);
|
|
3997
|
-
if (!episodaProjectRoot) {
|
|
3998
|
-
status.error("Not an Episoda project.");
|
|
3999
|
-
status.info("");
|
|
4000
|
-
status.info("Use `episoda clone {workspace}/{project}` to set up a project.");
|
|
4001
|
-
status.info("");
|
|
4002
|
-
process.exit(1);
|
|
4003
|
-
}
|
|
4004
|
-
projectPath = episodaProjectRoot;
|
|
4005
|
-
const isWorktree = await isWorktreeProject(projectPath);
|
|
4006
|
-
if (!isWorktree) {
|
|
4007
|
-
status.error("Invalid Episoda project configuration.");
|
|
4008
|
-
process.exit(1);
|
|
4009
|
-
}
|
|
4010
|
-
const bareRepoPath = path5.join(projectPath, ".bare");
|
|
4011
|
-
const scriptsExtracted = await extractBootstrapScripts(bareRepoPath, projectPath);
|
|
4012
|
-
if (scriptsExtracted) {
|
|
4013
|
-
status.success("Bootstrap scripts extracted");
|
|
4014
4028
|
}
|
|
4015
4029
|
let daemonPid = isDaemonRunning();
|
|
4016
4030
|
if (!daemonPid) {
|
|
@@ -4030,7 +4044,20 @@ async function daemonCommand(options = {}) {
|
|
|
4030
4044
|
status.error("Daemon is running but not responding. Try: episoda stop && episoda dev");
|
|
4031
4045
|
process.exit(1);
|
|
4032
4046
|
}
|
|
4033
|
-
|
|
4047
|
+
let connectId;
|
|
4048
|
+
let connectPath;
|
|
4049
|
+
if (projectPath && config.project_id) {
|
|
4050
|
+
connectId = config.project_id;
|
|
4051
|
+
connectPath = projectPath;
|
|
4052
|
+
status.info("Connecting project to Episoda...");
|
|
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
|
+
}
|
|
4034
4061
|
let connected = false;
|
|
4035
4062
|
let lastError;
|
|
4036
4063
|
for (let retry = 0; retry < CONNECTION_MAX_RETRIES && !connected; retry++) {
|
|
@@ -4039,7 +4066,7 @@ async function daemonCommand(options = {}) {
|
|
|
4039
4066
|
await new Promise((resolve5) => setTimeout(resolve5, 1e3));
|
|
4040
4067
|
}
|
|
4041
4068
|
try {
|
|
4042
|
-
const result = await addProject(
|
|
4069
|
+
const result = await addProject(connectId, connectPath);
|
|
4043
4070
|
if (result.connected) {
|
|
4044
4071
|
connected = true;
|
|
4045
4072
|
} else {
|
|
@@ -4054,10 +4081,18 @@ async function daemonCommand(options = {}) {
|
|
|
4054
4081
|
status.info("Check server status at https://episoda.dev/api/system/health");
|
|
4055
4082
|
process.exit(1);
|
|
4056
4083
|
}
|
|
4057
|
-
|
|
4084
|
+
if (isCloudMode && !config.project_id) {
|
|
4085
|
+
status.success("Connected to Episoda (workspace mode)");
|
|
4086
|
+
} else {
|
|
4087
|
+
status.success("Connected to Episoda");
|
|
4088
|
+
}
|
|
4058
4089
|
if (options.foreground) {
|
|
4059
4090
|
status.info("");
|
|
4060
|
-
|
|
4091
|
+
if (isCloudMode) {
|
|
4092
|
+
status.info("Daemon connected in cloud mode. Ready for worktree commands.");
|
|
4093
|
+
} else {
|
|
4094
|
+
status.info("Daemon connected! Dev servers start automatically when you begin work on a module.");
|
|
4095
|
+
}
|
|
4061
4096
|
status.info("Press Ctrl+C to disconnect (daemon continues in background).");
|
|
4062
4097
|
status.info("");
|
|
4063
4098
|
const shutdownHandler = (signal) => {
|
|
@@ -4074,7 +4109,11 @@ Received ${signal}. Daemon continues running in background.`);
|
|
|
4074
4109
|
});
|
|
4075
4110
|
} else {
|
|
4076
4111
|
status.info("");
|
|
4077
|
-
|
|
4112
|
+
if (isCloudMode) {
|
|
4113
|
+
status.info("Daemon running in cloud mode. Use `episoda status` to check connection.");
|
|
4114
|
+
} else {
|
|
4115
|
+
status.info("Daemon running in background. Use `episoda status` to check connection.");
|
|
4116
|
+
}
|
|
4078
4117
|
process.exit(0);
|
|
4079
4118
|
}
|
|
4080
4119
|
} catch (error) {
|