@episoda/cli 0.2.199 → 0.2.201

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.
@@ -1,2 +1,17 @@
1
+ /**
2
+ * Episoda Daemon Process
3
+ *
4
+ * Main entry point for the persistent daemon that:
5
+ * - Maintains WebSocket connections to multiple projects
6
+ * - Listens for IPC commands from CLI
7
+ * - Handles graceful shutdown
8
+ * - Survives terminal close
9
+ *
10
+ * This file is spawned by daemon-manager.ts in detached mode.
11
+ */
12
+ /**
13
+ * Main entry point
14
+ */
15
+ declare function runDaemonProcess(): Promise<void>;
1
16
 
2
- export { }
17
+ export { runDaemonProcess };
@@ -9,6 +9,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __commonJS = (cb, mod) => function __require() {
10
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
11
  };
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
12
16
  var __copyProps = (to, from, except, desc) => {
13
17
  if (from && typeof from === "object" || typeof from === "function") {
14
18
  for (let key of __getOwnPropNames(from))
@@ -25,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
29
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
30
  mod
27
31
  ));
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
33
 
29
34
  // ../core/dist/command-protocol.js
30
35
  var require_command_protocol = __commonJS({
@@ -3046,7 +3051,7 @@ var require_package = __commonJS({
3046
3051
  "package.json"(exports2, module2) {
3047
3052
  module2.exports = {
3048
3053
  name: "@episoda/cli",
3049
- version: "0.2.199",
3054
+ version: "0.2.201",
3050
3055
  description: "CLI tool for Episoda local development workflow orchestration",
3051
3056
  main: "dist/index.js",
3052
3057
  types: "dist/index.d.ts",
@@ -3111,6 +3116,13 @@ var require_package = __commonJS({
3111
3116
  }
3112
3117
  });
3113
3118
 
3119
+ // src/daemon/daemon-process.ts
3120
+ var daemon_process_exports = {};
3121
+ __export(daemon_process_exports, {
3122
+ runDaemonProcess: () => runDaemonProcess
3123
+ });
3124
+ module.exports = __toCommonJS(daemon_process_exports);
3125
+
3114
3126
  // src/daemon/machine-id.ts
3115
3127
  var fs = __toESM(require("fs"));
3116
3128
  var path = __toESM(require("path"));
@@ -15370,6 +15382,9 @@ async function configureGitUser(projectPath, userId, workspaceId, machineId, pro
15370
15382
  const { execSync: execSync11 } = await import("child_process");
15371
15383
  const { gitDir, workDir } = getGitDirs(projectPath);
15372
15384
  const gitCmd = gitDir ? `git --git-dir="${gitDir}"` : "git";
15385
+ const gitEmailDomain = process.env.EPISODA_AGENT_GIT_EMAIL_DOMAIN || "users.episoda.dev";
15386
+ const gitIdentityName = `Episoda ${userId}`;
15387
+ const gitIdentityEmail = `${userId}@${gitEmailDomain}`;
15373
15388
  execSync11(`${gitCmd} config episoda.userId ${userId}`, {
15374
15389
  cwd: workDir,
15375
15390
  encoding: "utf8",
@@ -15397,7 +15412,17 @@ async function configureGitUser(projectPath, userId, workspaceId, machineId, pro
15397
15412
  stdio: "pipe"
15398
15413
  });
15399
15414
  }
15400
- console.log(`[Daemon] Configured git for project: episoda.userId=${userId}, machineId=${machineId}, projectId=${projectId}${machineUuid ? `, machineUuid=${machineUuid}` : ""}`);
15415
+ execSync11(`${gitCmd} config user.name "${gitIdentityName.replace(/"/g, '\\"')}"`, {
15416
+ cwd: workDir,
15417
+ encoding: "utf8",
15418
+ stdio: "pipe"
15419
+ });
15420
+ execSync11(`${gitCmd} config user.email ${gitIdentityEmail}`, {
15421
+ cwd: workDir,
15422
+ encoding: "utf8",
15423
+ stdio: "pipe"
15424
+ });
15425
+ console.log(`[Daemon] Configured git for project: episoda.userId=${userId}, machineId=${machineId}, projectId=${projectId}, gitIdentity=${gitIdentityEmail}${machineUuid ? `, machineUuid=${machineUuid}` : ""}`);
15401
15426
  } catch (error) {
15402
15427
  console.warn(`[Daemon] Failed to configure git user for ${projectPath}:`, error instanceof Error ? error.message : error);
15403
15428
  }
@@ -15653,6 +15678,9 @@ var Daemon = class _Daemon {
15653
15678
  */
15654
15679
  async start() {
15655
15680
  console.log("[Daemon] Starting Episoda daemon...");
15681
+ if (process.env.EPISODA_DAEMON_SUPERVISED) {
15682
+ console.log("[Daemon] EP1477: Running in supervised foreground mode");
15683
+ }
15656
15684
  this.machineId = await getMachineId();
15657
15685
  console.log(`[Daemon] Machine ID: ${this.machineId}`);
15658
15686
  const config = await (0, import_core22.loadConfig)();
@@ -17179,7 +17207,7 @@ process.on("uncaughtException", (error) => {
17179
17207
  logCrashDiagnostics("Uncaught exception", error);
17180
17208
  process.exit(1);
17181
17209
  });
17182
- async function main() {
17210
+ async function runDaemonProcess() {
17183
17211
  if (!process.env.EPISODA_DAEMON_MODE) {
17184
17212
  console.error("This script should only be run by daemon-manager");
17185
17213
  process.exit(1);
@@ -17189,8 +17217,14 @@ async function main() {
17189
17217
  await new Promise(() => {
17190
17218
  });
17191
17219
  }
17192
- main().catch((error) => {
17193
- console.error("[Daemon] Fatal error:", error);
17194
- process.exit(1);
17220
+ if (require.main === module) {
17221
+ runDaemonProcess().catch((error) => {
17222
+ console.error("[Daemon] Fatal error:", error);
17223
+ process.exit(1);
17224
+ });
17225
+ }
17226
+ // Annotate the CommonJS export names for ESM import in node:
17227
+ 0 && (module.exports = {
17228
+ runDaemonProcess
17195
17229
  });
17196
17230
  //# sourceMappingURL=daemon-process.js.map