stim 1.8.0 → 1.10.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 (91) hide show
  1. package/README.md +23 -155
  2. package/dist/{android-DWssqHQ8.mjs → android-787HhP5w.mjs} +168 -39
  3. package/dist/{android-BRgBYzU0.mjs → android-DBkeHwpm.mjs} +250 -200
  4. package/dist/{android-DeYdjjBP.mjs → android-DPov-fv2.mjs} +2 -2
  5. package/dist/{android-cas-SWIjzeuL.mjs → android-cas-CITmIeWY.mjs} +22 -14
  6. package/dist/android-cas-compiler.mjs +2 -2
  7. package/dist/app-install-CrJ6t_bv.mjs +819 -0
  8. package/dist/budget-BP4jZZL4.mjs +620 -0
  9. package/dist/build-progress-BXx-ZBe4.mjs +512 -0
  10. package/dist/{cache-manifest-CYJi8-Hx.mjs → cache-manifest-Pubfp8wV.mjs} +4 -4
  11. package/dist/cache-manifest.mjs +1 -1
  12. package/dist/cli.mjs +22 -19
  13. package/dist/collector-run.d.mts +7 -1
  14. package/dist/collector-run.mjs +10 -9
  15. package/dist/{command-output-B3ycpsYv.mjs → command-output-D5z2_bcF.mjs} +11 -2
  16. package/dist/{config-B7iyKWkL.mjs → config-BEq0Qw_a.mjs} +134 -121
  17. package/dist/{dependency-state-D0M7oKA7.mjs → dependency-state-r9UesA9a.mjs} +2 -2
  18. package/dist/{deps-oCXVNEqQ.mjs → deps-DP4eWqea.mjs} +8 -5
  19. package/dist/{detached-entry-Bpo6ZY_I.mjs → detached-entry-DJHoca49.mjs} +1 -1
  20. package/dist/{device-BUoZyMoR.mjs → dev-client-92U593KT.mjs} +1090 -660
  21. package/dist/{device-RdujjHLB.mjs → device-DhTZe7L4.mjs} +13 -20
  22. package/dist/{build-lock-CgtsB6TV.mjs → device-lease-CbEaIk7b.mjs} +481 -27
  23. package/dist/{device-pool-BxRwdufO.mjs → device-pool-Di8Q-9Ro.mjs} +7 -7
  24. package/dist/{device-remote-ByN8P6CB.mjs → device-remote-Dy1jGj3U.mjs} +645 -119
  25. package/dist/{doctor-BMt156qe.mjs → doctor-B-inAJmt.mjs} +137 -113
  26. package/dist/{error-diagnostics-D1Kaf-eT.mjs → error-diagnostics-xxWKNO3-.mjs} +22 -17
  27. package/dist/exec-DK8KaVHK.mjs +133 -0
  28. package/dist/{gc-v2YcoJvm.mjs → gc-ChPFZMRC.mjs} +836 -813
  29. package/dist/{guide-BTAlD1_y.mjs → guide-DwmaD_Wa.mjs} +953 -209
  30. package/dist/guide-status-CWvti2Lg.mjs +125 -0
  31. package/dist/idle-DpRLp5lj.mjs +157 -0
  32. package/dist/{build-slots-C-oAHRT1.mjs → in-use-CjUluqIX.mjs} +102 -8
  33. package/dist/{ios-BcCiI4TS.mjs → ios-B2Fpqvlb.mjs} +60 -71
  34. package/dist/{ios-BP04pY5f.mjs → ios-Dd-hYJBh.mjs} +241 -234
  35. package/dist/{ios-device-CFXA46ez.mjs → ios-device-BiOsSVzd.mjs} +3 -2
  36. package/dist/{ios-device-CauFJiYx.mjs → ios-device-CtRdEVjx.mjs} +149 -52
  37. package/dist/launch-verify-CQS_Kg-C.mjs +365 -0
  38. package/dist/{logs-CakdBTtm.mjs → logs-MARIy6m9.mjs} +20 -15
  39. package/dist/metro-BWLOJ_Wr.mjs +409 -0
  40. package/dist/{named-ports-DzMOlmaX.mjs → named-ports-DiTfSz6p.mjs} +4 -4
  41. package/dist/{ndjson-BZwI1NBv.mjs → ndjson-CDY9IkVC.mjs} +23 -43
  42. package/dist/{ndjson-DvHSsNU9.d.mts → ndjson-Du3j0AQ9.d.mts} +1 -0
  43. package/dist/{ownership-Cp52QAK1.mjs → ownership-D2xbLVoz.mjs} +2 -3
  44. package/dist/{teardown-BJqEzPo_.mjs → ownership-DZjdx8Gq.mjs} +664 -612
  45. package/dist/{ports-BIbJaKNW.mjs → ports-CLSSFOuz.mjs} +3 -3
  46. package/dist/{process-output-Dl5uKE03.mjs → process-output-Fpl8PYi8.mjs} +1 -1
  47. package/dist/{project-DDZWf_16.mjs → project-BXZzOABt.mjs} +8 -3
  48. package/dist/{reload-BdypPbjM.mjs → reload-DoETJ3rl.mjs} +11 -13
  49. package/dist/{server-bare-BQkyxa_b.mjs → server-bare-DVbb7kXH.mjs} +2 -2
  50. package/dist/{server-expo-BVAA1OqJ.mjs → server-expo-BvOCeakp.mjs} +8 -7
  51. package/dist/server-expo-DBVTdult.mjs +2 -0
  52. package/dist/{settings-BXXorVM2.mjs → settings-DOugPlPz.mjs} +59 -159
  53. package/dist/settings-EWYNwe72.mjs +378 -0
  54. package/dist/settings.schema.json +1064 -0
  55. package/dist/simslim-Ca3487H6.mjs +436 -0
  56. package/dist/{slot-launch-ZUUe0TQP.mjs → slot-launch-C5cg0fmk.mjs} +4 -4
  57. package/dist/spawn-claims-CUleC2cM.mjs +49 -0
  58. package/dist/{start-CmxtOKjU.mjs → start-F9gv5dcC.mjs} +159 -114
  59. package/dist/start-VoFsPSes.mjs +2 -0
  60. package/dist/{state-DZobzxLW.mjs → state-WGdIbi_d.mjs} +5 -3
  61. package/dist/{stats-BYcZ6n1h.mjs → stats-BAgJaLA4.mjs} +66 -5
  62. package/dist/{stats-CLg5RuDS.mjs → stats-DBYJ5bxL.mjs} +4 -4
  63. package/dist/status-DLCD-o3s.mjs +764 -0
  64. package/dist/status-Dr4fRkym.mjs +216 -0
  65. package/dist/{guide-status-Craq9z0t.mjs → stim-installations-CINXy_su.mjs} +3 -122
  66. package/dist/{stop-C8JW6kKp.mjs → stop-Dj4pfmyv.mjs} +111 -31
  67. package/dist/{stop-B1kOpYei.mjs → stop-ZvOeTmKb.mjs} +2 -2
  68. package/dist/supervisor-run.d.mts +11 -2
  69. package/dist/supervisor-run.mjs +228 -42
  70. package/dist/{workspace-process-lock-BYfZz_S-.mjs → workspace-process-lock-BXA96myD.mjs} +14 -9
  71. package/dist/workspaces-BTUyFfkv.mjs +1003 -0
  72. package/dist/worktree-4aZg2NnI.mjs +2 -0
  73. package/dist/{worktree-CFLA-6MX.mjs → worktree-BMS7GeqB.mjs} +523 -61
  74. package/dist/{worktree-FG_ZKKdb.mjs → worktree-BlizKDpZ.mjs} +200 -54
  75. package/dist/{xcode-B6YaWeg0.mjs → xcode-B2tBkf0m.mjs} +66 -57
  76. package/package.json +6 -6
  77. package/skill/SKILL.md +2 -0
  78. package/dist/app-install-BDbsSgCl.mjs +0 -1175
  79. package/dist/dev-client-BmT-ioFI.mjs +0 -797
  80. package/dist/device-lease-Ffz_M5t0.mjs +0 -359
  81. package/dist/exec-B29XNuhP.mjs +0 -77
  82. package/dist/logs-query-BGL-Pl12.mjs +0 -290
  83. package/dist/metro-C7bcJ0uo.mjs +0 -233
  84. package/dist/ownership-wolE-0Do.mjs +0 -470
  85. package/dist/public-http-probe-CyMDrQ3c.mjs +0 -61
  86. package/dist/reclaim-KJ-0uWEF.mjs +0 -361
  87. package/dist/server-expo-YDDG3eP7.mjs +0 -2
  88. package/dist/spawn-entry-nCE6m770.mjs +0 -14
  89. package/dist/status-DdkLki47.mjs +0 -426
  90. package/dist/workspace-state-BT5E3SA2.mjs +0 -146
  91. package/dist/{metro-store-CDDZHtPl.mjs → metro-store-DzeWkfqW.mjs} +1 -1
@@ -1,17 +1,16 @@
1
- import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
- import { D as withDirLock, F as deviceSlotKey, I as deviceSlotPlatforms, f as getProject } from "./config-B7iyKWkL.mjs";
3
- import { r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
4
- import { d as readWorkspaceLaunches } from "./state-DZobzxLW.mjs";
5
- import { n as deviceConsoleLevel } from "./ios-device-CFXA46ez.mjs";
6
- import { a as resolveProjectMetro } from "./metro-C7bcJ0uo.mjs";
7
- import { r as androidHome, s as androidToolCwd } from "./android-DWssqHQ8.mjs";
8
- import { n as parseLogcatLine, t as androidClockOffset } from "./android-DeYdjjBP.mjs";
9
- import { _ as launchErrorPreview } from "./command-output-B3ycpsYv.mjs";
10
- import { a as parseLease, n as fileLeaseIo, t as deviceLeasePath } from "./device-lease-Ffz_M5t0.mjs";
11
- import { l as readLogRecords, t as attachExpoErrorContext } from "./logs-query-BGL-Pl12.mjs";
1
+ import { R as deviceSlotKey, f as getProject, z as deviceSlotPlatforms } from "./config-BEq0Qw_a.mjs";
2
+ import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
3
+ import { P as withDirLock, m as readWorkspaceState$1, s as resolveProjectMetro } from "./metro-BWLOJ_Wr.mjs";
4
+ import { d as readWorkspaceLaunches } from "./state-WGdIbi_d.mjs";
5
+ import { v as launchErrorPreview } from "./command-output-D5z2_bcF.mjs";
6
+ import { a as parseLease, n as fileLeaseIo, t as deviceLeasePath } from "./device-lease-CbEaIk7b.mjs";
7
+ import { r as androidHome, s as androidToolCwd } from "./android-787HhP5w.mjs";
8
+ import { r as deviceConsoleLevel } from "./ios-device-BiOsSVzd.mjs";
9
+ import { n as parseLogcatLine, t as androidClockOffset } from "./android-DPov-fv2.mjs";
12
10
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
13
- import { createHash, randomUUID } from "node:crypto";
11
+ import { attachExpoErrorContext, readLogRecords, sortByTs } from "@stim-cli/core/state";
14
12
  import { basename, dirname, join, resolve, sep } from "node:path";
13
+ import { createHash, randomUUID } from "node:crypto";
15
14
  import { homedir } from "node:os";
16
15
  //#region src/diagnostics/diagnostic-store.ts
17
16
  /** Publishes an immutable diagnostic snapshot atomically; existing evidence wins. */
@@ -35,6 +34,7 @@ function writeDiagnosticOnce(path, content) {
35
34
  }
36
35
  //#endregion
37
36
  //#region src/diagnostics/native-crash.ts
37
+ const CRASH_LOG_PREFIX = "native-crash-";
38
38
  const IOS_CRASH_REPORT_RETRY = "iOS crash reports can take about a minute or longer to appear. Run `stim logs --errors` again for the native stack.";
39
39
  /** Accepts only a report for this app, simulator and launch window. */
40
40
  function parseIosCrash(text, target) {
@@ -346,7 +346,7 @@ function captureNativeCrashes(target, logsDir) {
346
346
  record.incident ?? record.deviceTs,
347
347
  record.rawReport
348
348
  ])).digest("hex");
349
- writeDiagnosticOnce(join(logsDir, `native-crash-${key}.ndjson`), `${JSON.stringify(record)}\n`);
349
+ writeDiagnosticOnce(join(logsDir, `${CRASH_LOG_PREFIX}${key}.ndjson`), `${JSON.stringify(record)}\n`);
350
350
  } catch {}
351
351
  }
352
352
  return records;
@@ -355,8 +355,10 @@ function printNativeCrashReport(target, logsDir, emit, remote) {
355
355
  if (remote) return;
356
356
  for (const line of launchErrorPreview(captureNativeCrashes(target, logsDir), target.root)) emit(line);
357
357
  }
358
+ /** Captures native crash reports for this workspace's current launches and returns the whole timeline. */
358
359
  function captureWorkspaceCrashes(root, logsDir) {
359
- const attempts = readLogRecords(logsDir).filter((record) => record.event === "launch_attempt");
360
+ const timeline = readLogRecords(logsDir, (name) => !isCrashLog(name));
361
+ const attempts = timeline.filter((record) => record.event === "launch_attempt");
360
362
  const launches = readWorkspaceLaunches(root);
361
363
  const latest = /* @__PURE__ */ new Map();
362
364
  for (const attempt of attempts) if (attempt.platform === "ios" || attempt.platform === "android") latest.set(deviceSlotKey(attempt.platform, String(attempt.slot ?? "default")), attempt);
@@ -402,10 +404,14 @@ function captureWorkspaceCrashes(root, logsDir) {
402
404
  since: Number(since),
403
405
  until,
404
406
  physical: attempt?.physical === true,
405
- appPath: attempt?.appPath ?? readWorkspaceState(root)?.lastBuild?.appPath
407
+ appPath: attempt?.appPath ?? readWorkspaceState$1(root)?.lastBuild?.appPath
406
408
  }, logsDir);
407
409
  } catch {}
408
410
  }
411
+ return sortByTs([...timeline, ...readLogRecords(logsDir, isCrashLog)]);
412
+ }
413
+ function isCrashLog(name) {
414
+ return name.startsWith(CRASH_LOG_PREFIX);
409
415
  }
410
416
  //#endregion
411
417
  //#region src/diagnostics/error-symbolication.ts
@@ -583,8 +589,7 @@ function mergeErrorCopies(records, root) {
583
589
  return result;
584
590
  }
585
591
  /** Keeps symbolicated launch evidence stable when Metro later rebuilds or stops. */
586
- async function errorDiagnostics(input, { root, logsDir, port, allowRequest = false }) {
587
- const timeline = readLogRecords(logsDir);
592
+ async function errorDiagnostics(input, { root, logsDir, port, allowRequest = false, timeline = readLogRecords(logsDir) }) {
588
593
  const records = attachDeviceErrorContext(timeline, attachExpoErrorContext(timeline, input.map((record) => ({
589
594
  ...record,
590
595
  src: typeof record.src === "string" ? record.src : void 0,
@@ -0,0 +1,133 @@
1
+ import { execSync } from "child_process";
2
+ import spawn from "cross-spawn";
3
+ import which from "which";
4
+ //#region src/exec.ts
5
+ const MAX_BUFFER = 67108864;
6
+ function nameTimeout(error, command, timeoutMs) {
7
+ if (error?.code === "ETIMEDOUT" && error instanceof Error) error.message = `Command timed out after ${timeoutMs}ms: ${command}`;
8
+ return error;
9
+ }
10
+ let active = {
11
+ run(cmd, { timeoutMs, killSignal, cwd } = {}) {
12
+ const opts = {
13
+ encoding: "utf-8",
14
+ stdio: [
15
+ "pipe",
16
+ "pipe",
17
+ "pipe"
18
+ ],
19
+ maxBuffer: MAX_BUFFER
20
+ };
21
+ if (timeoutMs) opts.timeout = timeoutMs;
22
+ if (killSignal) opts.killSignal = killSignal;
23
+ if (cwd) opts.cwd = cwd;
24
+ try {
25
+ return String(execSync(cmd, opts)).trim();
26
+ } catch (error) {
27
+ throw nameTimeout(error, cmd, timeoutMs);
28
+ }
29
+ },
30
+ runFile(file, args = [], { timeoutMs, killSignal, cwd, env, omitEnv, input, untrimmed } = {}) {
31
+ const opts = {
32
+ encoding: "utf-8",
33
+ stdio: [
34
+ "pipe",
35
+ "pipe",
36
+ "pipe"
37
+ ],
38
+ maxBuffer: MAX_BUFFER
39
+ };
40
+ if (timeoutMs) opts.timeout = timeoutMs;
41
+ if (killSignal) opts.killSignal = killSignal;
42
+ if (cwd) opts.cwd = cwd;
43
+ if (input !== void 0) opts.input = input;
44
+ if (env || omitEnv?.length) {
45
+ const childEnv = {
46
+ ...process.env,
47
+ ...env
48
+ };
49
+ for (const key of omitEnv ?? []) delete childEnv[key];
50
+ opts.env = childEnv;
51
+ }
52
+ const result = spawn.sync(file, args, opts);
53
+ if (result.error) throw nameTimeout(Object.assign(result.error, result), [file, ...args].join(" "), timeoutMs);
54
+ if (result.status !== 0) {
55
+ const stderr = String(result.stderr ?? "");
56
+ const message = `Command failed: ${[file, ...args].join(" ")}${stderr ? `\n${stderr}` : ""}`;
57
+ throw Object.assign(new Error(message), result);
58
+ }
59
+ return untrimmed ? String(result.stdout) : String(result.stdout).trim();
60
+ },
61
+ runFileAsync(file, args = [], { timeoutMs, killSignal, cwd, env, omitEnv } = {}) {
62
+ const command = [file, ...args].join(" ");
63
+ return new Promise((resolve, reject) => {
64
+ const opts = { stdio: [
65
+ "ignore",
66
+ "pipe",
67
+ "pipe"
68
+ ] };
69
+ if (cwd) opts.cwd = cwd;
70
+ if (env || omitEnv?.length) {
71
+ const childEnv = {
72
+ ...process.env,
73
+ ...env
74
+ };
75
+ for (const key of omitEnv ?? []) delete childEnv[key];
76
+ opts.env = childEnv;
77
+ }
78
+ const child = spawn(file, args, opts);
79
+ const stdout = [];
80
+ const stderr = [];
81
+ let timedOut = false;
82
+ const timer = timeoutMs ? setTimeout(() => {
83
+ timedOut = true;
84
+ child.kill(killSignal ?? "SIGTERM");
85
+ }, timeoutMs) : void 0;
86
+ child.stdout?.on("data", (chunk) => stdout.push(chunk));
87
+ child.stderr?.on("data", (chunk) => stderr.push(chunk));
88
+ child.on("error", (error) => {
89
+ clearTimeout(timer);
90
+ reject(error);
91
+ });
92
+ child.on("close", (status, signal) => {
93
+ clearTimeout(timer);
94
+ const out = Buffer.concat(stdout).toString("utf-8");
95
+ const err = Buffer.concat(stderr).toString("utf-8");
96
+ const result = {
97
+ status,
98
+ signal,
99
+ stdout: out,
100
+ stderr: err
101
+ };
102
+ if (timedOut) reject(nameTimeout(Object.assign(new Error(command), result, { code: "ETIMEDOUT" }), command, timeoutMs));
103
+ else if (status !== 0) reject(Object.assign(/* @__PURE__ */ new Error(`Command failed: ${command}${err ? `\n${err}` : ""}`), result));
104
+ else resolve(out.trim());
105
+ });
106
+ });
107
+ },
108
+ runQuiet(cmd, opts) {
109
+ try {
110
+ return this.run(cmd, opts);
111
+ } catch {
112
+ return null;
113
+ }
114
+ },
115
+ runFileQuiet(file, args, opts) {
116
+ try {
117
+ return this.runFile(file, args, opts);
118
+ } catch {
119
+ return null;
120
+ }
121
+ },
122
+ spawn(cmd, args = [], opts = {}) {
123
+ return spawn(cmd, args, opts);
124
+ },
125
+ findExecutable(name) {
126
+ return which.sync(name, { nothrow: true });
127
+ }
128
+ };
129
+ function getExecutor() {
130
+ return active;
131
+ }
132
+ //#endregion
133
+ export { getExecutor as t };