@episoda/cli 0.2.161 → 0.2.162

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/index.js CHANGED
@@ -2141,7 +2141,7 @@ var require_websocket_client = __commonJS({
2141
2141
  * @param url - WebSocket URL (wss://episoda.dev/cli)
2142
2142
  * @param token - OAuth access token
2143
2143
  * @param machineId - Optional machine identifier for multi-machine support
2144
- * @param deviceInfo - Optional device information (hostname, OS, daemonPid)
2144
+ * @param deviceInfo - Optional device information (hostname, OS, daemonPid, cliVersion)
2145
2145
  * EP1119: Added environment and containerId for cloud routing
2146
2146
  */
2147
2147
  async connect(url, token, machineId, deviceInfo) {
@@ -2152,6 +2152,7 @@ var require_websocket_client = __commonJS({
2152
2152
  this.osPlatform = deviceInfo?.osPlatform;
2153
2153
  this.osArch = deviceInfo?.osArch;
2154
2154
  this.daemonPid = deviceInfo?.daemonPid;
2155
+ this.cliVersion = deviceInfo?.cliVersion;
2155
2156
  this.environment = deviceInfo?.environment;
2156
2157
  this.containerId = deviceInfo?.containerId;
2157
2158
  this.isDisconnecting = false;
@@ -2190,7 +2191,7 @@ var require_websocket_client = __commonJS({
2190
2191
  this.send({
2191
2192
  type: "auth",
2192
2193
  token,
2193
- version: version_1.VERSION,
2194
+ version: this.cliVersion || version_1.VERSION,
2194
2195
  environment: this.environment,
2195
2196
  machineId,
2196
2197
  containerId: this.containerId,
@@ -2509,6 +2510,7 @@ var require_websocket_client = __commonJS({
2509
2510
  osPlatform: this.osPlatform,
2510
2511
  osArch: this.osArch,
2511
2512
  daemonPid: this.daemonPid,
2513
+ cliVersion: this.cliVersion,
2512
2514
  environment: this.environment,
2513
2515
  containerId: this.containerId
2514
2516
  }).then(() => {
@@ -6209,6 +6211,7 @@ async function checkoutCommand(moduleUid, options = {}) {
6209
6211
  );
6210
6212
  }
6211
6213
  const apiUrl = options.apiUrl || config.api_url || "https://episoda.dev";
6214
+ const machineUuid = config.machine_uuid || config.device_id;
6212
6215
  const worktreeManager = new WorktreeManager(projectRoot);
6213
6216
  const initialized = await worktreeManager.initialize();
6214
6217
  if (!initialized) {
@@ -6227,7 +6230,8 @@ The .bare directory or .episoda/config.json may be missing.`
6227
6230
  config.access_token,
6228
6231
  void 0,
6229
6232
  // Don't update branch name
6230
- existing.worktreePath
6233
+ existing.worktreePath,
6234
+ machineUuid || void 0
6231
6235
  );
6232
6236
  } catch {
6233
6237
  }
@@ -6304,7 +6308,8 @@ The .bare directory or .episoda/config.json may be missing.`
6304
6308
  moduleDetails.id,
6305
6309
  config.access_token,
6306
6310
  branchWasGenerated ? branchName : void 0,
6307
- result.worktreePath
6311
+ result.worktreePath,
6312
+ machineUuid || void 0
6308
6313
  );
6309
6314
  } catch (error) {
6310
6315
  status.warning("Could not update server with checkout status");
@@ -6355,7 +6360,7 @@ ${errorBody}`
6355
6360
  }
6356
6361
  return moduleRecord;
6357
6362
  }
6358
- async function updateModuleCheckout(apiUrl, moduleId, accessToken, branchName, worktreePath) {
6363
+ async function updateModuleCheckout(apiUrl, moduleId, accessToken, branchName, worktreePath, machineUuid) {
6359
6364
  const url = `${apiUrl}/api/modules/${moduleId}/checkout`;
6360
6365
  const body = {
6361
6366
  checked_out: true,
@@ -6368,11 +6373,15 @@ async function updateModuleCheckout(apiUrl, moduleId, accessToken, branchName, w
6368
6373
  body.worktree_path = worktreePath;
6369
6374
  body.worktree_status = "ready";
6370
6375
  }
6376
+ if (machineUuid) {
6377
+ body.checkout_machine_id = machineUuid;
6378
+ }
6371
6379
  await fetchWithRetry(url, {
6372
6380
  method: "POST",
6373
6381
  headers: {
6374
6382
  "Authorization": `Bearer ${accessToken}`,
6375
- "Content-Type": "application/json"
6383
+ "Content-Type": "application/json",
6384
+ ...machineUuid ? { "x-machine-uuid": machineUuid } : {}
6376
6385
  },
6377
6386
  body: JSON.stringify(body)
6378
6387
  });