stim 1.5.0 → 1.7.0

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.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/dist/{android-DJWiTBkz.mjs → android-DWssqHQ8.mjs} +165 -661
  3. package/dist/{android-sobvO9ia.mjs → android-Da-G_o3n.mjs} +646 -548
  4. package/dist/{android-BW8i_YxU.mjs → android-DeYdjjBP.mjs} +6 -2
  5. package/dist/{android-cas-CSS8gjR7.mjs → android-cas-SWIjzeuL.mjs} +54 -18
  6. package/dist/android-cas-compiler.mjs +1 -1
  7. package/dist/{app-install--PAocWvq.mjs → app-install-DJg7bVv-.mjs} +36 -10
  8. package/dist/build-lock-CgtsB6TV.mjs +604 -0
  9. package/dist/{build-slots-CuPszJDu.mjs → build-slots-C-oAHRT1.mjs} +2 -2
  10. package/dist/{cache-manifest-uoOKhgUD.mjs → cache-manifest-CYJi8-Hx.mjs} +2 -2
  11. package/dist/cache-manifest.d.mts +1 -1
  12. package/dist/cache-manifest.mjs +1 -1
  13. package/dist/cli.mjs +14 -14
  14. package/dist/collector-run.d.mts +2 -0
  15. package/dist/collector-run.mjs +7 -7
  16. package/dist/{command-output-BuIb_ZOI.mjs → command-output-B3ycpsYv.mjs} +2 -2
  17. package/dist/{config-DMP7L7H6.mjs → config-B7iyKWkL.mjs} +56 -16
  18. package/dist/{dependency-state-CTL8A9p3.mjs → dependency-state-D0M7oKA7.mjs} +2 -2
  19. package/dist/{deps-BAGOnrc7.mjs → deps-oCXVNEqQ.mjs} +6 -6
  20. package/dist/detached-entry-Bpo6ZY_I.mjs +65 -0
  21. package/dist/{dev-client-BoifdqkU.mjs → dev-client-DDUkWgJL.mjs} +12 -12
  22. package/dist/{device-BUw4JBuH.mjs → device-CBSaC6BU.mjs} +7 -7
  23. package/dist/{device-DvKJ454A.mjs → device-CLeDp-KH.mjs} +17 -15
  24. package/dist/{device-lease-r7yEQ1R8.mjs → device-lease-Ffz_M5t0.mjs} +3 -3
  25. package/dist/{device-pool-DU4FQKp5.mjs → device-pool-DNSHL5z8.mjs} +4 -4
  26. package/dist/{device-remote-BTUqbl0i.mjs → device-remote-BprxZp-m.mjs} +11 -11
  27. package/dist/{doctor-Di_B26uh.mjs → doctor-CTAx9gMu.mjs} +90 -46
  28. package/dist/{error-diagnostics-CTePWAzW.mjs → error-diagnostics-D1Kaf-eT.mjs} +23 -17
  29. package/dist/{exec-CyylIdq9.mjs → exec-B29XNuhP.mjs} +14 -2
  30. package/dist/{gc-C20dWw_8.mjs → gc-CX0KRfLG.mjs} +17 -16
  31. package/dist/{guide-sAnoty2y.mjs → guide-CPmAG9me.mjs} +61 -22
  32. package/dist/{guide-status-BF6RsJJp.mjs → guide-status-Craq9z0t.mjs} +3 -3
  33. package/dist/{ios-BdpkncL6.mjs → ios-BRXYSxSc.mjs} +34 -37
  34. package/dist/{ios-device-DJOi9FR5.mjs → ios-device-CDbvn5H2.mjs} +2 -2
  35. package/dist/{ios-device-D3pzTKQE.mjs → ios-device-CFXA46ez.mjs} +1 -1
  36. package/dist/{ios-Deh5js5V.mjs → ios-lEJ5pKsq.mjs} +3 -3
  37. package/dist/{logs-BfQdIhiF.mjs → logs-CakdBTtm.mjs} +6 -6
  38. package/dist/{logs-query-Cdp5aaCH.mjs → logs-query-BGL-Pl12.mjs} +1 -1
  39. package/dist/metro-C7bcJ0uo.mjs +233 -0
  40. package/dist/{named-ports-DH9SXd0f.mjs → named-ports-DzMOlmaX.mjs} +57 -42
  41. package/dist/{ownership-CD_XnpDu.mjs → ownership-Cp52QAK1.mjs} +3 -3
  42. package/dist/{ownership-CVY9cqCr.mjs → ownership-D5vkdm8H.mjs} +13 -13
  43. package/dist/{ports-A6uTJSPj.mjs → ports-BIbJaKNW.mjs} +3 -3
  44. package/dist/{process-output-C7IlIzd7.mjs → process-output-Dl5uKE03.mjs} +1 -1
  45. package/dist/{project-B_SDt4ip.mjs → project-DDZWf_16.mjs} +3 -3
  46. package/dist/{reclaim-C_rB25f4.mjs → reclaim-D614jI6_.mjs} +11 -11
  47. package/dist/{reload-CYBJbJfI.mjs → reload-ChW46VDb.mjs} +9 -9
  48. package/dist/{server-bare-H3pAhbMs.mjs → server-bare-BQkyxa_b.mjs} +1 -1
  49. package/dist/{server-expo-Ds8_mfng.mjs → server-expo-BVAA1OqJ.mjs} +23 -11
  50. package/dist/server-expo-YDDG3eP7.mjs +2 -0
  51. package/dist/{settings-kO2ZqIKy.mjs → settings-BXXorVM2.mjs} +8 -5
  52. package/dist/{slot-launch-BpHiHH6A.mjs → slot-launch-DbLvyrup.mjs} +4 -4
  53. package/dist/{start-DiEfqEWk.mjs → start-TTVILlUi.mjs} +111 -38
  54. package/dist/{state-CnWzvCWP.mjs → state-DZobzxLW.mjs} +2 -2
  55. package/dist/{stats-Fo9ACIv7.mjs → stats-BYcZ6n1h.mjs} +1 -1
  56. package/dist/{stats-DHrO0frH.mjs → stats-CLg5RuDS.mjs} +4 -4
  57. package/dist/{status-J5LAXpag.mjs → status-DUNy_HZs.mjs} +14 -15
  58. package/dist/{stop-CM1fejKW.mjs → stop-CnUpnFT5.mjs} +2 -2
  59. package/dist/{stop-0jJNahwN.mjs → stop-ZrfODZ51.mjs} +13 -13
  60. package/dist/supervisor-run.mjs +7 -5
  61. package/dist/{teardown-CAVcWeRD.mjs → teardown-5J5UXz2P.mjs} +14 -17
  62. package/dist/{workspace-process-lock-Bz19_R9R.mjs → workspace-process-lock-BYfZz_S-.mjs} +1 -1
  63. package/dist/{workspace-state-WVwWw_hB.mjs → workspace-state-BT5E3SA2.mjs} +3 -3
  64. package/dist/{worktree-CeUKDAQw.mjs → worktree-BfE4lzHK.mjs} +21 -16
  65. package/dist/{worktree-DJnBbQZ9.mjs → worktree-FG_ZKKdb.mjs} +13 -9
  66. package/dist/{xcode-BqDeRkpT.mjs → xcode-B6YaWeg0.mjs} +92 -17
  67. package/package.json +12 -8
  68. package/shim/android-optimizations.gradle +6 -0
  69. package/dist/metro-ato6ef3J.mjs +0 -99
  70. package/dist/ports-BZprTJRa.mjs +0 -90
  71. package/dist/server-expo-CSwUVYOa.mjs +0 -2
@@ -1,20 +1,21 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports } from "./config-DMP7L7H6.mjs";
3
- import { _ as workspaceLogsDir, c as ensureWorkspaceStorage, f as supervisorLogFile, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
4
- import { g as repoRoot, s as gitCommonDir } from "./worktree-DJnBbQZ9.mjs";
5
- import { a as findProjectRoot, i as detectIsExpo, n as detectAndroidPackage, r as detectBundleId, t as appProjectProblem } from "./project-B_SDt4ip.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
3
+ import { _ as workspaceLogsDir, c as ensureWorkspaceStorage, f as supervisorLogFile, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
4
+ import { g as repoRoot, s as gitCommonDir } from "./worktree-FG_ZKKdb.mjs";
5
+ import { a as findProjectRoot, i as detectIsExpo, n as detectAndroidPackage, r as detectBundleId, t as appProjectProblem } from "./project-DDZWf_16.mjs";
6
6
  import { n as supervisorError } from "./errors-B6W7FkxQ.mjs";
7
- import { i as clearManagedMetroTunnel, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-CnWzvCWP.mjs";
8
- import { r as reserveMetroPort } from "./ports-BZprTJRa.mjs";
9
- import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-ato6ef3J.mjs";
10
- import { g as stepTimer, l as phaseLine } from "./command-output-BuIb_ZOI.mjs";
11
- import { A as resolveSettings, D as remoteDeviceSettingError, E as remoteAndroidSetting, F as tunnelModeSetting, I as unknownSettingKeys, L as PUBLIC_METRO_ENV, N as settingShapeErrors, O as remoteIosSetting, R as detectProviders, S as ngrokUrlSetting, T as publicUrlSetting, a as SETTING_SHAPE_REMEDY, b as metroTunnelSettingError, d as cacheProviderSettingError, k as resolveCacheProviderConfig, z as planMetroReach } from "./settings-kO2ZqIKy.mjs";
12
- import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-Bz19_R9R.mjs";
7
+ import { n as windowsLauncherArgs } from "./detached-entry-Bpo6ZY_I.mjs";
8
+ import { i as clearManagedMetroTunnel, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-DZobzxLW.mjs";
9
+ import { a as resolveProjectMetro, i as pidExists, l as reserveMetroPort, n as killMetroTree, o as signalProcessTree } from "./metro-C7bcJ0uo.mjs";
10
+ import { A as resolveSettings, D as remoteDeviceSettingError, E as remoteAndroidSetting, F as tunnelModeSetting, I as unknownSettingKeys, L as PUBLIC_METRO_ENV, N as settingShapeErrors, O as remoteIosSetting, R as detectProviders, S as ngrokUrlSetting, T as publicUrlSetting, a as SETTING_SHAPE_REMEDY, b as metroTunnelSettingError, d as cacheProviderSettingError, k as resolveCacheProviderConfig, z as planMetroReach } from "./settings-BXXorVM2.mjs";
11
+ import { g as stepTimer, l as phaseLine } from "./command-output-B3ycpsYv.mjs";
12
+ import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-BYfZz_S-.mjs";
13
13
  import { t as spawnEntry } from "./spawn-entry-nCE6m770.mjs";
14
- import { c as queryLogs } from "./logs-query-Cdp5aaCH.mjs";
15
- import { a as withManagedRemoteWorktreeLock, i as terminateChild, n as startTunnelSequence, r as stopTunnel, s as withManagedTunnelLock, t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
16
- import { mkdirSync, openSync, readFileSync } from "node:fs";
14
+ import { c as queryLogs } from "./logs-query-BGL-Pl12.mjs";
15
+ import { a as withManagedRemoteWorktreeLock, i as terminateChild, n as startTunnelSequence, r as stopTunnel, s as withManagedTunnelLock, t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
16
+ import { appendFileSync, mkdirSync, openSync, readFileSync } from "node:fs";
17
17
  import { dirname } from "node:path";
18
+ import { EventEmitter } from "node:events";
18
19
  import { CACHE_PROVIDER_ENV, cacheProviderEnv } from "@stim-cli/cache";
19
20
  import chalk from "chalk";
20
21
  //#region src/supervisor/cache-reset.ts
@@ -104,10 +105,20 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
104
105
  function startCommand(program) {
105
106
  registerStart(program);
106
107
  }
108
+ function recordedSupervisorProcess(pid) {
109
+ return Object.assign(new EventEmitter(), {
110
+ pid,
111
+ stdout: null,
112
+ stderr: null,
113
+ kill: (signal = "SIGTERM") => pid !== void 0 && signalProcessTree(pid, typeof signal === "number" ? "SIGTERM" : signal),
114
+ unref() {}
115
+ });
116
+ }
117
+ const RECORDED_SUPERVISOR_WAIT_MS = 15e3;
107
118
  function providersOnPath() {
108
119
  return detectProviders((bin) => {
109
120
  try {
110
- return Boolean(getExecutor().runQuiet(`command -v ${bin}`, { timeoutMs: 5e3 }));
121
+ return Boolean(getExecutor().findExecutable(bin));
111
122
  } catch {
112
123
  return false;
113
124
  }
@@ -129,7 +140,8 @@ const DEFAULT_START_DEPS = {
129
140
  }),
130
141
  withWorktreeLock: withManagedRemoteWorktreeLock,
131
142
  withTunnelLock: withManagedTunnelLock,
132
- clearTunnelRecord: clearManagedMetroTunnel
143
+ clearTunnelRecord: clearManagedMetroTunnel,
144
+ platform: process.platform
133
145
  };
134
146
  function normalizeManagedTunnelUrl(url) {
135
147
  return url.trim().replace(/\/+$/, "");
@@ -272,27 +284,8 @@ function registerStart(program, overrides = {}) {
272
284
  let spawnedChild = null;
273
285
  let spawnedTs = null;
274
286
  let childExit = null;
275
- const spawnSupervisor = (origin) => {
276
- mkdirSync(logsDir, { recursive: true });
287
+ const spawnDirect = (supervisorArgs, childEnv) => {
277
288
  const fd = openSync(logFile, "a");
278
- spawnedTs = Date.now();
279
- const supervisorArgs = [
280
- supervisorEntry(),
281
- "--root",
282
- root,
283
- "--port",
284
- String(port),
285
- ...tunnel ? ["--tunnel"] : [],
286
- ...opts.resetCache ? ["--reset-cache"] : []
287
- ];
288
- const childEnv = {
289
- ...process.env,
290
- ...origin ? {
291
- [PUBLIC_METRO_ENV]: origin,
292
- EXPO_PACKAGER_PROXY_URL: origin
293
- } : {}
294
- };
295
- childEnv[CACHE_PROVIDER_ENV] = cacheProviderEnv(cacheProvider);
296
289
  const child = getExecutor().spawn(process.execPath, supervisorArgs, {
297
290
  cwd: root,
298
291
  detached: true,
@@ -317,6 +310,86 @@ function registerStart(program, overrides = {}) {
317
310
  error: err
318
311
  };
319
312
  });
313
+ return child;
314
+ };
315
+ const recordedSupervisorPid = async (since) => {
316
+ const deadline = Date.now() + RECORDED_SUPERVISOR_WAIT_MS;
317
+ while (Date.now() < deadline) {
318
+ const record = readWorkspaceState(root)?.supervisor;
319
+ if (record?.pid && record.port === port && Date.parse(String(record.startedAt)) >= since && pidExists(record.pid)) return record.pid;
320
+ await sleep(25);
321
+ }
322
+ return null;
323
+ };
324
+ const spawnThroughWindowsShell = async (supervisorArgs, childEnv) => {
325
+ const [entry, ...args] = supervisorArgs;
326
+ const launcher = windowsLauncherArgs({
327
+ entry,
328
+ args,
329
+ cwd: root,
330
+ logFile
331
+ });
332
+ const since = Date.now();
333
+ const shell = getExecutor().spawn(launcher.file, launcher.args, {
334
+ cwd: root,
335
+ stdio: [
336
+ "ignore",
337
+ "ignore",
338
+ "pipe"
339
+ ],
340
+ env: {
341
+ ...childEnv,
342
+ ...launcher.env
343
+ },
344
+ windowsHide: true
345
+ });
346
+ const stderr = [];
347
+ shell.stderr?.on("data", (chunk) => stderr.push(String(chunk)));
348
+ const exit = await new Promise((resolve) => {
349
+ shell.on?.("close", (code, signal) => resolve({
350
+ code,
351
+ signal
352
+ }));
353
+ shell.on?.("error", (error) => resolve({
354
+ code: null,
355
+ signal: null,
356
+ error
357
+ }));
358
+ });
359
+ const launcherFailed = exit.code !== 0 || exit.error;
360
+ const pid = launcherFailed ? null : await recordedSupervisorPid(since);
361
+ if (pid === null) {
362
+ const reason = launcherFailed ? `the supervisor launcher exited (${exit.error ? exit.error.message : `code ${exit.code}`})` : `the supervisor did not record itself within ${RECORDED_SUPERVISOR_WAIT_MS / 1e3}s`;
363
+ appendFileSync(logFile, `Stim start: ${reason}.\n${stderr.join("")}`);
364
+ childExit = {
365
+ code: exit.code,
366
+ signal: exit.signal,
367
+ ...exit.error ? { error: exit.error } : {}
368
+ };
369
+ }
370
+ return recordedSupervisorProcess(pid ?? void 0);
371
+ };
372
+ const spawnSupervisor = async (origin) => {
373
+ mkdirSync(logsDir, { recursive: true });
374
+ spawnedTs = Date.now();
375
+ const supervisorArgs = [
376
+ supervisorEntry(),
377
+ "--root",
378
+ root,
379
+ "--port",
380
+ String(port),
381
+ ...tunnel ? ["--tunnel"] : [],
382
+ ...opts.resetCache ? ["--reset-cache"] : []
383
+ ];
384
+ const childEnv = {
385
+ ...process.env,
386
+ ...origin ? {
387
+ [PUBLIC_METRO_ENV]: origin,
388
+ EXPO_PACKAGER_PROXY_URL: origin
389
+ } : {}
390
+ };
391
+ childEnv[CACHE_PROVIDER_ENV] = cacheProviderEnv(cacheProvider);
392
+ const child = d.platform === "win32" ? await spawnThroughWindowsShell(supervisorArgs, childEnv) : spawnDirect(supervisorArgs, childEnv);
320
393
  out(chalk.dim(phaseLine("metro", `starting on port ${port} (${isExpo ? "expo-child" : "bare-inproc"}, supervisor pid ${child.pid})`)));
321
394
  spawnedChild = child;
322
395
  return child;
@@ -476,7 +549,7 @@ function registerStart(program, overrides = {}) {
476
549
  }
477
550
  let child;
478
551
  try {
479
- child = spawnSupervisor(tracking.record.url);
552
+ child = await spawnSupervisor(tracking.record.url);
480
553
  } catch (err) {
481
554
  return { failed: {
482
555
  code: "STIM_SUPERVISOR_EXITED",
@@ -648,7 +721,7 @@ function registerStart(program, overrides = {}) {
648
721
  return;
649
722
  }
650
723
  if (managedTunnelExited()) return failExitedManagedTunnel();
651
- const child = spawnedChild ?? spawnSupervisor(publicOrigin);
724
+ const child = spawnedChild ?? await spawnSupervisor(publicOrigin);
652
725
  const attemptStartedTs = spawnedTs ?? Date.now();
653
726
  if (!await waitForMetro({
654
727
  root,
@@ -1,5 +1,5 @@
1
- import { I as parseDeviceSlotKey, P as deviceSlotKey, w as process_identity_exports } from "./config-DMP7L7H6.mjs";
2
- import { a as withWorkspaceStateLock, i as updateWorkspaceState, p as supervisorPidFile, r as readWorkspaceState, t as clearWorkspaceStateKey, y as workspaceStateFile } from "./workspace-state-WVwWw_hB.mjs";
1
+ import { F as deviceSlotKey, L as parseDeviceSlotKey, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
2
+ import { a as withWorkspaceStateLock, i as updateWorkspaceState, p as supervisorPidFile, r as readWorkspaceState, t as clearWorkspaceStateKey, y as workspaceStateFile } from "./workspace-state-BT5E3SA2.mjs";
3
3
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { dirname } from "node:path";
5
5
  //#region src/supervisor/state.ts
@@ -1,4 +1,4 @@
1
- import { C as withConfigLock, u as getConfigDir } from "./config-DMP7L7H6.mjs";
1
+ import { C as withConfigLock, u as getConfigDir } from "./config-B7iyKWkL.mjs";
2
2
  import { readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { basename, dirname, join, relative, resolve } from "node:path";
4
4
  const PLATFORMS = ["ios", "android"];
@@ -1,7 +1,7 @@
1
- import { g as repoRoot, s as gitCommonDir } from "./worktree-DJnBbQZ9.mjs";
2
- import { a as findProjectRoot } from "./project-B_SDt4ip.mjs";
3
- import { o as formatLongDuration } from "./command-output-BuIb_ZOI.mjs";
4
- import { a as statsProjectKey, r as readStats } from "./stats-Fo9ACIv7.mjs";
1
+ import { g as repoRoot, s as gitCommonDir } from "./worktree-FG_ZKKdb.mjs";
2
+ import { a as findProjectRoot } from "./project-DDZWf_16.mjs";
3
+ import { o as formatLongDuration } from "./command-output-B3ycpsYv.mjs";
4
+ import { a as statsProjectKey, r as readStats } from "./stats-BYcZ6n1h.mjs";
5
5
  import chalk from "chalk";
6
6
  //#region src/commands/stats.ts
7
7
  const PLATFORMS = ["ios", "android"];
@@ -1,18 +1,17 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { L as projectDeviceSlots, M as volumeRootFor, g as loadConfig, u as getConfigDir } from "./config-DMP7L7H6.mjs";
3
- import { _ as workspaceLogsDir } from "./workspace-state-WVwWw_hB.mjs";
4
- import { v as resolveSourceCheckout } from "./worktree-DJnBbQZ9.mjs";
5
- import { a as findProjectRoot, c as projectShortcut } from "./project-B_SDt4ip.mjs";
6
- import { t as isMetroRunning } from "./ports-BZprTJRa.mjs";
7
- import { i as resolveProjectMetro } from "./metro-ato6ef3J.mjs";
8
- import { a as formatElapsed, r as clockTime, u as plural } from "./command-output-BuIb_ZOI.mjs";
9
- import { N as resolveOwnedAvdSerial } from "./android-DJWiTBkz.mjs";
10
- import { a as POOL_SETTING_REMEDY, l as parkedMaxSetting, u as readParked } from "./teardown-CAVcWeRD.mjs";
11
- import { u as listAllIosSims } from "./ios-Deh5js5V.mjs";
12
- import { i as listLeaseFiles } from "./device-lease-r7yEQ1R8.mjs";
13
- import { c as queryLogs } from "./logs-query-Cdp5aaCH.mjs";
14
- import { t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
15
- import { i as readSupervisorState } from "./stop-0jJNahwN.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { M as volumeRootFor, R as projectDeviceSlots, g as loadConfig, u as getConfigDir } from "./config-B7iyKWkL.mjs";
3
+ import { _ as workspaceLogsDir } from "./workspace-state-BT5E3SA2.mjs";
4
+ import { v as resolveSourceCheckout } from "./worktree-FG_ZKKdb.mjs";
5
+ import { a as findProjectRoot, c as projectShortcut } from "./project-DDZWf_16.mjs";
6
+ import { a as resolveProjectMetro, s as isMetroRunning } from "./metro-C7bcJ0uo.mjs";
7
+ import { I as resolveOwnedAvdSerial } from "./android-DWssqHQ8.mjs";
8
+ import { a as formatElapsed, r as clockTime, u as plural } from "./command-output-B3ycpsYv.mjs";
9
+ import { a as POOL_SETTING_REMEDY, l as parkedMaxSetting, u as readParked } from "./teardown-5J5UXz2P.mjs";
10
+ import { u as listAllIosSims } from "./ios-lEJ5pKsq.mjs";
11
+ import { i as listLeaseFiles } from "./device-lease-Ffz_M5t0.mjs";
12
+ import { c as queryLogs } from "./logs-query-BGL-Pl12.mjs";
13
+ import { t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
14
+ import { i as readSupervisorState } from "./stop-ZrfODZ51.mjs";
16
15
  import { existsSync } from "fs";
17
16
  import { totalmem } from "os";
18
17
  import chalk from "chalk";
@@ -1,3 +1,3 @@
1
- import { t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
2
- import { a as resolveCollectorTargets, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-0jJNahwN.mjs";
1
+ import { t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
2
+ import { a as resolveCollectorTargets, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-ZrfODZ51.mjs";
3
3
  export { clearCollectorState, clearSupervisorState, stopCommand as default, readCollectorState, readSupervisorState, resolveCollectorTargets, resolveSupervisorTarget, runStop };
@@ -1,15 +1,15 @@
1
- import { C as withConfigLock, F as deviceSlotPlatforms, I as parseDeviceSlotKey, L as projectDeviceSlots, S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports, z as validateDeviceSlot } from "./config-DMP7L7H6.mjs";
2
- import { a as withWorkspaceStateLock, h as workspaceDir, n as clearWorkspaceStateKeys, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
3
- import { a as findProjectRoot } from "./project-B_SDt4ip.mjs";
4
- import { a as clearRemoteSession, i as clearManagedMetroTunnel, l as readRemoteSession, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-CnWzvCWP.mjs";
5
- import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-ato6ef3J.mjs";
6
- import { n as verifyCollectorOwnership } from "./ownership-CD_XnpDu.mjs";
7
- import { f as releasedLeaseFact, l as phaseLine, u as plural } from "./command-output-BuIb_ZOI.mjs";
8
- import { S as resolveEasCliBin, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-CAVcWeRD.mjs";
9
- import { t as withWorkspaceProcessLock } from "./workspace-process-lock-Bz19_R9R.mjs";
10
- import { l as releaseWorkspaceLeases } from "./device-lease-r7yEQ1R8.mjs";
11
- import { i as endRecordedSession } from "./device-remote-BTUqbl0i.mjs";
12
- import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
1
+ import { B as validateDeviceSlot, C as withConfigLock, I as deviceSlotPlatforms, L as parseDeviceSlotKey, R as projectDeviceSlots, S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
2
+ import { a as withWorkspaceStateLock, h as workspaceDir, n as clearWorkspaceStateKeys, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
3
+ import { a as findProjectRoot } from "./project-DDZWf_16.mjs";
4
+ import { a as clearRemoteSession, i as clearManagedMetroTunnel, l as readRemoteSession, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-DZobzxLW.mjs";
5
+ import { a as resolveProjectMetro, i as pidExists, n as killMetroTree, o as signalProcessTree } from "./metro-C7bcJ0uo.mjs";
6
+ import { n as verifyCollectorOwnership } from "./ownership-Cp52QAK1.mjs";
7
+ import { f as releasedLeaseFact, l as phaseLine, u as plural } from "./command-output-B3ycpsYv.mjs";
8
+ import { S as resolveEasCliBin, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-5J5UXz2P.mjs";
9
+ import { t as withWorkspaceProcessLock } from "./workspace-process-lock-BYfZz_S-.mjs";
10
+ import { l as releaseWorkspaceLeases } from "./device-lease-Ffz_M5t0.mjs";
11
+ import { i as endRecordedSession } from "./device-remote-BprxZp-m.mjs";
12
+ import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
13
13
  import chalk from "chalk";
14
14
  //#region src/commands/stop.ts
15
15
  const DEFAULT_WAIT_MS = 1e4;
@@ -143,7 +143,7 @@ async function runStop(options) {
143
143
  result.summary = summarize(root, result.outcomes, result.ok);
144
144
  return result;
145
145
  }
146
- async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => process.kill(pid, "SIGTERM"), verifyCollector = verifyCollectorOwnership, clearCollectors = clearCollectorState, isAlive = pidExists, killGroup = killMetroTree, inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = resolveProjectMetro, teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, remoteDevice = void 0, teardownRemoteSession = defaultTeardownRemoteSession, metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeases, freePort = defaultFreePort, clearRegistration = defaultClearRegistration, clearState = clearSupervisorState, report = (line) => console.error(line) }) {
146
+ async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => signalProcessTree(pid), verifyCollector = verifyCollectorOwnership, clearCollectors = clearCollectorState, isAlive = pidExists, killGroup = killMetroTree, inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = resolveProjectMetro, teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, remoteDevice = void 0, teardownRemoteSession = defaultTeardownRemoteSession, metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeases, freePort = defaultFreePort, clearRegistration = defaultClearRegistration, clearState = clearSupervisorState, report = (line) => console.error(line) }) {
147
147
  const proj = project === void 0 ? getProject(root) : project;
148
148
  const sup = state === void 0 ? readSupervisorState(root) : state;
149
149
  const collectorRecords = collectors === void 0 ? readCollectorState(root) : collectors;
@@ -1,9 +1,10 @@
1
- import { a as clearSupervisor, w as process_identity_exports, x as setSupervisor } from "./config-DMP7L7H6.mjs";
1
+ import { a as clearSupervisor, w as process_identity_exports, x as setSupervisor } from "./config-B7iyKWkL.mjs";
2
2
  import { r as createNdjsonWriter } from "./ndjson-BZwI1NBv.mjs";
3
- import { _ as workspaceLogsDir, a as withWorkspaceStateLock, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
4
- import { i as detectIsExpo } from "./project-B_SDt4ip.mjs";
3
+ import { _ as workspaceLogsDir, a as withWorkspaceStateLock, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
4
+ import { i as detectIsExpo } from "./project-DDZWf_16.mjs";
5
5
  import { t as describeError } from "./errors-B6W7FkxQ.mjs";
6
- import { c as readPidFile, f as writePidFile, n as MODE_EXPO, o as clearWorkspaceSupervisor, r as clearExpoMetroTunnel, t as MODE_BARE } from "./state-CnWzvCWP.mjs";
6
+ import { t as relaunchWithLogFile } from "./detached-entry-Bpo6ZY_I.mjs";
7
+ import { c as readPidFile, f as writePidFile, n as MODE_EXPO, o as clearWorkspaceSupervisor, r as clearExpoMetroTunnel, t as MODE_BARE } from "./state-DZobzxLW.mjs";
7
8
  import { existsSync, realpathSync } from "node:fs";
8
9
  import { isAbsolute, join, resolve } from "node:path";
9
10
  import { fileURLToPath } from "node:url";
@@ -104,7 +105,7 @@ async function runSupervisor({ root, port, tunnel = false, resetCache = false, i
104
105
  };
105
106
  let server;
106
107
  try {
107
- server = await (mode === "expo-child" ? startExpo || (await import("./server-expo-CSwUVYOa.mjs")).startExpoServer : startBare || (await import("./server-bare-H3pAhbMs.mjs")).startBareServer)({
108
+ server = await (mode === "expo-child" ? startExpo || (await import("./server-expo-YDDG3eP7.mjs")).startExpoServer : startBare || (await import("./server-bare-BQkyxa_b.mjs")).startBareServer)({
108
109
  root,
109
110
  port,
110
111
  logsDir,
@@ -179,6 +180,7 @@ async function runSupervisor({ root, port, tunnel = false, resetCache = false, i
179
180
  };
180
181
  }
181
182
  async function main(argv = process.argv.slice(2)) {
183
+ if (relaunchWithLogFile(argv)) return;
182
184
  const parsed = parseArgs(argv);
183
185
  if (parsed.error) {
184
186
  console.error(`Stim supervisor: ${parsed.error}`);
@@ -1,13 +1,13 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { C as withConfigLock, E as ownership_claim_exports, F as deviceSlotPlatforms, L as projectDeviceSlots, N as assignSlotDevice, R as removeSlotDevice, T as acquireAvdClaim, d as getConfigPath, g as loadConfig, s as ensureConfig, u as getConfigDir, y as saveConfig } from "./config-DMP7L7H6.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { C as withConfigLock, E as ownership_claim_exports, I as deviceSlotPlatforms, N as assignSlotDevice, R as projectDeviceSlots, T as acquireAvdClaim, d as getConfigPath, g as loadConfig, s as ensureConfig, u as getConfigDir, y as saveConfig, z as removeSlotDevice } from "./config-B7iyKWkL.mjs";
3
3
  import { r as createNdjsonWriter } from "./ndjson-BZwI1NBv.mjs";
4
- import { _ as workspaceLogsDir } from "./workspace-state-WVwWw_hB.mjs";
5
- import { l as resolvePackageJson } from "./project-B_SDt4ip.mjs";
6
- import { n as stripAnsi } from "./process-output-C7IlIzd7.mjs";
7
- import { l as phaseLine } from "./command-output-BuIb_ZOI.mjs";
8
- import { E as ownedAvdMatchesConfiguration, F as shutdownAndroidEmulator, I as waitForAndroidEmulatorShutdown, N as resolveOwnedAvdSerial, O as ownedAvdSystemImage, S as listOrphanedAvdDirectories, T as ownedAvdDirectory, l as avdStorageRoots, o as assertOwnedAvdStopped, p as deleteAvd, s as avdPathExists } from "./android-DJWiTBkz.mjs";
9
- import { n as expoBinFromPackage, r as expoBinPath, s as findBinUpward } from "./server-expo-Ds8_mfng.mjs";
10
- import { C as shutdownIosSim, _ as renameIosSim, a as deleteIosSim, d as listIosDeviceTypes, g as parseRuntimeVersion, h as parkedSimName, o as deleteParkedIosSim, r as clearAppDataContainer, s as findAppDataContainer, x as resolveOwnedIosSim } from "./ios-Deh5js5V.mjs";
4
+ import { _ as workspaceLogsDir } from "./workspace-state-BT5E3SA2.mjs";
5
+ import { l as resolvePackageJson } from "./project-DDZWf_16.mjs";
6
+ import { n as stripAnsi } from "./process-output-Dl5uKE03.mjs";
7
+ import { I as resolveOwnedAvdSerial, O as ownedAvdDirectory, R as shutdownAndroidEmulator, T as listOrphanedAvdDirectories, c as assertOwnedAvdStopped, d as avdStorageRoots, h as deleteAvd, j as ownedAvdSystemImage, k as ownedAvdMatchesConfiguration, l as avdPathExists, z as waitForAndroidEmulatorShutdown } from "./android-DWssqHQ8.mjs";
8
+ import { l as phaseLine } from "./command-output-B3ycpsYv.mjs";
9
+ import { n as expoBinFromPackage, r as expoBinPath, s as findBinUpward } from "./server-expo-BVAA1OqJ.mjs";
10
+ import { C as shutdownIosSim, _ as renameIosSim, a as deleteIosSim, d as listIosDeviceTypes, g as parseRuntimeVersion, h as parkedSimName, o as deleteParkedIosSim, r as clearAppDataContainer, s as findAppDataContainer, x as resolveOwnedIosSim } from "./ios-lEJ5pKsq.mjs";
11
11
  import { createRequire } from "node:module";
12
12
  import { existsSync, lstatSync, readFileSync, renameSync, rmSync } from "node:fs";
13
13
  import { randomUUID } from "node:crypto";
@@ -202,7 +202,7 @@ function easAuthNote(status) {
202
202
  if (code === "wrong-account") return `eas is authenticated as ${account}, and this project's owner is ${owner} -- run \`eas login\` as a member of ${owner} (or set EXPO_TOKEN); consulting the EAS cache anyway`;
203
203
  return null;
204
204
  }
205
- function resolveEasCliBin(projectRoot, { lookupPath = null, timeoutMs = 5e3 } = {}) {
205
+ function resolveEasCliBin(projectRoot, { lookupPath = null } = {}) {
206
206
  const fromPackage = expoBinFromPackage(resolvePackageJson(projectRoot, EAS_CLI_PACKAGE), EAS_CLI_BIN);
207
207
  if (fromPackage) return {
208
208
  file: fromPackage,
@@ -213,7 +213,7 @@ function resolveEasCliBin(projectRoot, { lookupPath = null, timeoutMs = 5e3 } =
213
213
  file: shim,
214
214
  source: "project"
215
215
  };
216
- const onPath = lookupPath ? lookupPath() : getExecutor().runQuiet(`command -v ${EAS_CLI_BIN}`, { timeoutMs });
216
+ const onPath = lookupPath ? lookupPath() : getExecutor().findExecutable(EAS_CLI_BIN);
217
217
  const file = (String(onPath || "").split("\n")[0] ?? "").trim();
218
218
  return file ? {
219
219
  file,
@@ -720,7 +720,7 @@ function dropParked(platform, udid) {
720
720
  return removeParkedAfter(platform, udid, () => {}) !== null;
721
721
  }
722
722
  //#endregion
723
- //#region src/agent-device-cleanup.ts
723
+ //#region src/devices/agent-device-cleanup.ts
724
724
  function parseAgentDeviceSessions(output) {
725
725
  const result = JSON.parse(output);
726
726
  if (result?.success !== true || !Array.isArray(result.data?.sessions)) throw new Error("agent-device did not return a successful session list");
@@ -763,10 +763,7 @@ function closeOwnedDeviceSessions(device, stillOwned) {
763
763
  "stim-teardown-inventory"
764
764
  ]));
765
765
  try {
766
- if (!exec.runQuiet("command -v agent-device", {
767
- timeoutMs: 2e3,
768
- killSignal: "SIGKILL"
769
- })) return;
766
+ if (!exec.findExecutable("agent-device")) return;
770
767
  const sessions = list().filter((session) => session.platform === device.platform && session.id === device.id);
771
768
  for (const session of sessions) try {
772
769
  if (!list().some((current) => current.name === session.name && current.platform === session.platform && current.id === session.id && current.createdAt === session.createdAt)) continue;
@@ -791,7 +788,7 @@ function closeOwnedDeviceSessions(device, stillOwned) {
791
788
  }
792
789
  }
793
790
  //#endregion
794
- //#region src/teardown.ts
791
+ //#region src/devices/teardown.ts
795
792
  function teardownParkedAvd(avdName) {
796
793
  try {
797
794
  return removeParkedAfter("android", avdName, () => {
@@ -1,4 +1,4 @@
1
- import { E as ownership_claim_exports } from "./config-DMP7L7H6.mjs";
1
+ import { E as ownership_claim_exports } from "./config-B7iyKWkL.mjs";
2
2
  import { join } from "node:path";
3
3
  //#region src/engine/workspace-process-lock.ts
4
4
  const DEFAULT_WAIT_MS = 6e4;
@@ -1,9 +1,9 @@
1
- import { D as withDirLock, u as getConfigDir } from "./config-DMP7L7H6.mjs";
1
+ import { D as withDirLock, u as getConfigDir } from "./config-B7iyKWkL.mjs";
2
2
  import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { dirname } from "node:path";
4
4
  import { join as join$1, resolve as resolve$1 } from "path";
5
5
  import { buildCacheRoot as sharedBuildCache, workspaceId, workspaceName as workspaceName$1, workspaceStateDir as workspaceDir } from "@stim-cli/core";
6
- //#region src/paths.ts
6
+ //#region src/workspace/paths.ts
7
7
  const WORKSPACE_METADATA_FILE_NAME = "workspace.json";
8
8
  function workspaceMetadataFile(projectRoot) {
9
9
  return join$1(workspaceDir(projectRoot), WORKSPACE_METADATA_FILE_NAME);
@@ -66,7 +66,7 @@ function sharedCcache() {
66
66
  return join$1(getConfigDir(), "ccache");
67
67
  }
68
68
  //#endregion
69
- //#region src/workspace-state.ts
69
+ //#region src/workspace/workspace-state.ts
70
70
  function readWorkspaceState(root) {
71
71
  try {
72
72
  const parsed = JSON.parse(readFileSync(workspaceStateFile(root), "utf-8"));
@@ -1,16 +1,16 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { E as ownership_claim_exports, S as upsertProject, f as getProject, g as loadConfig, h as isPathPrefix, u as getConfigDir, v as removeProject, w as process_identity_exports } from "./config-DMP7L7H6.mjs";
3
- import { S as warmWorktreePaths, _ as resolveFullRef, b as sourceCheckoutOf, c as hasRemote, d as listWorktrees, f as locallyKnownUpstream, h as removeWorktree, i as depsOutOfSync, l as hasUncommittedWork, m as readWorktreeExclude, n as cloneIgnoredEntries, o as dirtyPaths, p as podsOutOfSync, r as deleteBranch, s as gitCommonDir, t as branchExists, u as isPodInstallChurn, x as unpushedCommits, y as restoreFile } from "./worktree-DJnBbQZ9.mjs";
4
- import { a as findProjectRoot } from "./project-B_SDt4ip.mjs";
5
- import { l as readRemoteSession, s as readMetroTunnel } from "./state-CnWzvCWP.mjs";
6
- import { a as formatElapsed, f as releasedLeaseFact, i as formatDuration, l as phaseLine, m as shortUdid, u as plural } from "./command-output-BuIb_ZOI.mjs";
7
- import { A as resolveSettings, I as unknownSettingKeys, N as settingShapeErrors, a as SETTING_SHAPE_REMEDY } from "./settings-kO2ZqIKy.mjs";
8
- import { a as POOL_SETTING_REMEDY, l as parkedMaxSetting } from "./teardown-CAVcWeRD.mjs";
9
- import { h as podInstallCommand, n as HEARTBEAT_INTERVAL_MS } from "./xcode-BqDeRkpT.mjs";
10
- import { n as hasInstalledDependencies, r as installedNpmTreeIsValid, t as dependencyState } from "./dependency-state-CTL8A9p3.mjs";
11
- import { c as withManagedTunnelRemovalLock, o as withManagedRemoteWorktreeRemovalLock } from "./ownership-CVY9cqCr.mjs";
12
- import { n as reclaimProject } from "./reclaim-C_rB25f4.mjs";
13
- import { a as runPodInstall, i as runCaptured, n as podsAreStale, r as readPodState, t as DEPS_ERROR } from "./deps-BAGOnrc7.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { E as ownership_claim_exports, S as upsertProject, f as getProject, g as loadConfig, h as isPathPrefix, u as getConfigDir, v as removeProject, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
3
+ import { S as warmWorktreePaths, _ as resolveFullRef, b as sourceCheckoutOf, c as hasRemote, d as listWorktrees, f as locallyKnownUpstream, h as removeWorktree, i as depsOutOfSync, l as hasUncommittedWork, m as readWorktreeExclude, n as cloneIgnoredEntries, o as dirtyPaths, p as podsOutOfSync, r as deleteBranch, s as gitCommonDir, t as branchExists, u as isPodInstallChurn, x as unpushedCommits, y as restoreFile } from "./worktree-FG_ZKKdb.mjs";
4
+ import { a as findProjectRoot } from "./project-DDZWf_16.mjs";
5
+ import { l as readRemoteSession, s as readMetroTunnel } from "./state-DZobzxLW.mjs";
6
+ import { A as resolveSettings, I as unknownSettingKeys, N as settingShapeErrors, a as SETTING_SHAPE_REMEDY } from "./settings-BXXorVM2.mjs";
7
+ import { a as formatElapsed, f as releasedLeaseFact, i as formatDuration, l as phaseLine, m as shortUdid, u as plural } from "./command-output-B3ycpsYv.mjs";
8
+ import { a as POOL_SETTING_REMEDY, l as parkedMaxSetting } from "./teardown-5J5UXz2P.mjs";
9
+ import { h as podInstallCommand, n as HEARTBEAT_INTERVAL_MS } from "./xcode-B6YaWeg0.mjs";
10
+ import { n as hasInstalledDependencies, r as installedNpmTreeIsValid, t as dependencyState } from "./dependency-state-D0M7oKA7.mjs";
11
+ import { c as withManagedTunnelRemovalLock, o as withManagedRemoteWorktreeRemovalLock } from "./ownership-D5vkdm8H.mjs";
12
+ import { n as reclaimProject } from "./reclaim-D614jI6_.mjs";
13
+ import { a as runPodInstall, i as runCaptured, n as podsAreStale, r as readPodState, t as DEPS_ERROR } from "./deps-oCXVNEqQ.mjs";
14
14
  import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
15
15
  import { createHash, randomUUID } from "node:crypto";
16
16
  import { join, relative } from "node:path";
@@ -198,7 +198,7 @@ async function withWarmClaim(options, fn) {
198
198
  }
199
199
  }
200
200
  //#endregion
201
- //#region src/worktree-refresh.ts
201
+ //#region src/workspace/worktree-refresh.ts
202
202
  const DIRTY_PATHS_SHOWN = 5;
203
203
  const FETCH_TIMEOUT_MS = 12e4;
204
204
  function mainCheckoutRefusal(root, state) {
@@ -1278,9 +1278,14 @@ async function runRemove(target, opts = {}) {
1278
1278
  }
1279
1279
  restorePodChurn(path, inspection.podChurn);
1280
1280
  try {
1281
- removeWorktree(path, { force: opts.force });
1281
+ removeWorktree(path, {
1282
+ from: source.path,
1283
+ force: opts.force
1284
+ });
1282
1285
  } catch (error) {
1283
- console.error(chalk.red(`git worktree remove failed: ${String(error?.message || error)}`));
1286
+ const message = String(error?.message || error);
1287
+ console.error(chalk.red(`git worktree remove failed: ${message}`));
1288
+ if (process.platform === "win32" && /Permission denied/i.test(message)) console.error(chalk.dim("Another process holds a file or directory inside the worktree. An adb server or emulator started from it keeps its working directory open; `adb kill-server` releases the server, and Sysinternals handle.exe lists other holders."));
1284
1289
  console.error(chalk.dim(`The directory and Stim ownership record for ${path} were kept.`));
1285
1290
  printRemovalCleanup(result, true);
1286
1291
  process.exitCode = 1;
@@ -1,5 +1,5 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { g as loadConfig, u as getConfigDir } from "./config-DMP7L7H6.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { g as loadConfig, u as getConfigDir } from "./config-B7iyKWkL.mjs";
3
3
  import { accessSync, chmodSync, constants, lstatSync, mkdirSync, mkdtempSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
4
4
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
5
5
  import { chmodSync as chmodSync$1, existsSync as existsSync$1, lstatSync as lstatSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, realpathSync as realpathSync$1, utimesSync } from "fs";
@@ -84,7 +84,7 @@ function removeTemporaryEntry(path) {
84
84
  });
85
85
  }
86
86
  //#endregion
87
- //#region src/worktree.ts
87
+ //#region src/workspace/worktree.ts
88
88
  const CARRY_SKIP_BASENAMES = /* @__PURE__ */ new Set([
89
89
  ".DerivedData",
90
90
  ".DS_Store",
@@ -93,6 +93,9 @@ const CARRY_SKIP_BASENAMES = /* @__PURE__ */ new Set([
93
93
  function isCarrySkipped(rel) {
94
94
  return /(^|\/)android\/build\/generated\/autolinking(\/|$)/.test(rel) || String(rel).split("/").some((seg) => CARRY_SKIP_BASENAMES.has(seg));
95
95
  }
96
+ function nativePath(path) {
97
+ return sep$1 === "/" ? path : path.replaceAll("/", sep$1);
98
+ }
96
99
  function gitCommonDir(cwd) {
97
100
  const out = getExecutor().runFileQuiet("git", [
98
101
  "-C",
@@ -101,7 +104,7 @@ function gitCommonDir(cwd) {
101
104
  "--path-format=absolute",
102
105
  "--git-common-dir"
103
106
  ]);
104
- return out ? out.trim() : null;
107
+ return out ? nativePath(out.trim()) : null;
105
108
  }
106
109
  function repoRoot(cwd) {
107
110
  const out = getExecutor().runFileQuiet("git", [
@@ -110,7 +113,7 @@ function repoRoot(cwd) {
110
113
  "rev-parse",
111
114
  "--show-toplevel"
112
115
  ]);
113
- return out ? out.trim() : null;
116
+ return out ? nativePath(out.trim()) : null;
114
117
  }
115
118
  function locallyKnownUpstream(projectRoot) {
116
119
  try {
@@ -440,7 +443,7 @@ function isPodInstallChurn(paths) {
440
443
  if (!paths || paths.length === 0) return false;
441
444
  return paths.every((line) => /(?:^|\/)(?:Podfile\.lock|project\.pbxproj)$/.test(line.slice(3).trim()));
442
445
  }
443
- const SAFE_BRANCH_NAME = /^[A-Za-z0-9._/-]+$/;
446
+ const SAFE_BRANCH_NAME = /^[A-Za-z0-9@._/-]+$/;
444
447
  function unpushedCommits(dir) {
445
448
  const exec = getExecutor();
446
449
  const branch = exec.runFileQuiet("git", [
@@ -511,10 +514,11 @@ function resolveFullRef(cwd, ref) {
511
514
  return null;
512
515
  }
513
516
  }
514
- function removeWorktree(path, { force = false } = {}) {
517
+ function removeWorktree(path, { from, force = false, platform = process.platform }) {
515
518
  const args = [
519
+ ...platform === "win32" ? ["-c", "core.longpaths=true"] : [],
516
520
  "-C",
517
- path,
521
+ from,
518
522
  "worktree",
519
523
  "remove",
520
524
  ...force ? ["--force"] : [],
@@ -539,7 +543,7 @@ function parseWorktrees(out) {
539
543
  let current = {};
540
544
  for (const line of out.split("\n")) if (line.startsWith("worktree ")) {
541
545
  if (current.path) entries.push(current);
542
- current = { path: line.slice(9) };
546
+ current = { path: nativePath(line.slice(9)) };
543
547
  } else if (line.startsWith("branch ")) current.branch = line.slice(7).replace("refs/heads/", "");
544
548
  else if (line === "prunable" || line.startsWith("prunable ")) current.prunable = true;
545
549
  else if (line === "bare") current.bare = true;