lim 0.34.0-rc.1 → 0.35.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 (121) hide show
  1. package/README.md +6 -5
  2. package/dist/base-command.d.ts +12 -18
  3. package/dist/base-command.d.ts.map +1 -1
  4. package/dist/base-command.js +74 -133
  5. package/dist/base-command.js.map +1 -1
  6. package/dist/base-command.xcode-selection.test.js +27 -20
  7. package/dist/base-command.xcode-selection.test.js.map +1 -1
  8. package/dist/commands/android/create.d.ts.map +1 -1
  9. package/dist/commands/android/create.js +3 -2
  10. package/dist/commands/android/create.js.map +1 -1
  11. package/dist/commands/android/tunnel/index.d.ts +6 -7
  12. package/dist/commands/android/tunnel/index.d.ts.map +1 -1
  13. package/dist/commands/android/tunnel/index.js +8 -64
  14. package/dist/commands/android/tunnel/index.js.map +1 -1
  15. package/dist/commands/android/tunnel/index.test.js +12 -45
  16. package/dist/commands/android/tunnel/index.test.js.map +1 -1
  17. package/dist/commands/android/tunnel/status.d.ts.map +1 -1
  18. package/dist/commands/android/tunnel/status.js +0 -2
  19. package/dist/commands/android/tunnel/status.js.map +1 -1
  20. package/dist/commands/ios/attach-xcode.d.ts.map +1 -1
  21. package/dist/commands/ios/attach-xcode.js +1 -1
  22. package/dist/commands/ios/attach-xcode.js.map +1 -1
  23. package/dist/commands/ios/create.d.ts.map +1 -1
  24. package/dist/commands/ios/create.js +2 -4
  25. package/dist/commands/ios/create.js.map +1 -1
  26. package/dist/commands/ios/get.d.ts.map +1 -1
  27. package/dist/commands/ios/get.js +0 -3
  28. package/dist/commands/ios/get.js.map +1 -1
  29. package/dist/commands/ios/maestro.d.ts.map +1 -1
  30. package/dist/commands/ios/maestro.js +2 -1
  31. package/dist/commands/ios/maestro.js.map +1 -1
  32. package/dist/commands/ios/tunnel/index.d.ts +7 -2
  33. package/dist/commands/ios/tunnel/index.d.ts.map +1 -1
  34. package/dist/commands/ios/tunnel/index.js +19 -6
  35. package/dist/commands/ios/tunnel/index.js.map +1 -1
  36. package/dist/commands/session/start.d.ts.map +1 -1
  37. package/dist/commands/session/start.js +3 -3
  38. package/dist/commands/session/start.js.map +1 -1
  39. package/dist/commands/session/status.d.ts.map +1 -1
  40. package/dist/commands/session/status.js +0 -7
  41. package/dist/commands/session/status.js.map +1 -1
  42. package/dist/commands/xcode/attach-simulator.d.ts.map +1 -1
  43. package/dist/commands/xcode/attach-simulator.js +1 -1
  44. package/dist/commands/xcode/attach-simulator.js.map +1 -1
  45. package/dist/commands/xcode/build.d.ts +0 -1
  46. package/dist/commands/xcode/build.d.ts.map +1 -1
  47. package/dist/commands/xcode/build.js +5 -27
  48. package/dist/commands/xcode/build.js.map +1 -1
  49. package/dist/commands/xcode/create.d.ts.map +1 -1
  50. package/dist/commands/xcode/create.js +3 -2
  51. package/dist/commands/xcode/create.js.map +1 -1
  52. package/dist/commands/xcode/delete.d.ts.map +1 -1
  53. package/dist/commands/xcode/delete.js +1 -3
  54. package/dist/commands/xcode/delete.js.map +1 -1
  55. package/dist/commands/xcode/get.d.ts.map +1 -1
  56. package/dist/commands/xcode/get.js +0 -24
  57. package/dist/commands/xcode/get.js.map +1 -1
  58. package/dist/commands/xcode/logs.d.ts.map +1 -1
  59. package/dist/commands/xcode/logs.js +2 -16
  60. package/dist/commands/xcode/logs.js.map +1 -1
  61. package/dist/commands/xcode/logs.test.js +3 -12
  62. package/dist/commands/xcode/logs.test.js.map +1 -1
  63. package/dist/commands/xcode/rbe/index.d.ts.map +1 -1
  64. package/dist/commands/xcode/rbe/index.js +3 -4
  65. package/dist/commands/xcode/rbe/index.js.map +1 -1
  66. package/dist/commands/xcode/set-instance.d.ts.map +1 -1
  67. package/dist/commands/xcode/set-instance.js +2 -2
  68. package/dist/commands/xcode/set-instance.js.map +1 -1
  69. package/dist/commands/xcode/sync.d.ts.map +1 -1
  70. package/dist/commands/xcode/sync.js +2 -2
  71. package/dist/commands/xcode/sync.js.map +1 -1
  72. package/dist/commands/xcode/version/index.d.ts.map +1 -1
  73. package/dist/commands/xcode/version/index.js +4 -4
  74. package/dist/commands/xcode/version/index.js.map +1 -1
  75. package/dist/commands/xcode/version/list.d.ts.map +1 -1
  76. package/dist/commands/xcode/version/list.js +11 -7
  77. package/dist/commands/xcode/version/list.js.map +1 -1
  78. package/dist/commands/xcode/version/set.d.ts +1 -1
  79. package/dist/commands/xcode/version/set.d.ts.map +1 -1
  80. package/dist/commands/xcode/version/set.js +13 -7
  81. package/dist/commands/xcode/version/set.js.map +1 -1
  82. package/dist/commands/xcode/version/unset.d.ts.map +1 -1
  83. package/dist/commands/xcode/version/unset.js +3 -2
  84. package/dist/commands/xcode/version/unset.js.map +1 -1
  85. package/dist/lib/build-use-command.js +6 -6
  86. package/dist/lib/build-use-command.js.map +1 -1
  87. package/dist/lib/build-use-command.test.js +8 -2
  88. package/dist/lib/build-use-command.test.js.map +1 -1
  89. package/dist/lib/config.d.ts +5 -8
  90. package/dist/lib/config.d.ts.map +1 -1
  91. package/dist/lib/config.js +17 -88
  92. package/dist/lib/config.js.map +1 -1
  93. package/dist/lib/instance-client-factory.d.ts.map +1 -1
  94. package/dist/lib/instance-client-factory.js +3 -3
  95. package/dist/lib/instance-client-factory.js.map +1 -1
  96. package/dist/lib/tunnel-command.d.ts +5 -14
  97. package/dist/lib/tunnel-command.d.ts.map +1 -1
  98. package/dist/lib/tunnel-command.js +13 -13
  99. package/dist/lib/tunnel-command.js.map +1 -1
  100. package/dist/lib/tunnel-command.test.js +1 -0
  101. package/dist/lib/tunnel-command.test.js.map +1 -1
  102. package/dist/lib/tunnel-inspection-flags.d.ts +33 -0
  103. package/dist/lib/tunnel-inspection-flags.d.ts.map +1 -0
  104. package/dist/lib/tunnel-inspection-flags.js +64 -0
  105. package/dist/lib/tunnel-inspection-flags.js.map +1 -0
  106. package/dist/lib/tunnel-process.d.ts.map +1 -1
  107. package/dist/lib/tunnel-process.js +6 -17
  108. package/dist/lib/tunnel-process.js.map +1 -1
  109. package/dist/lib/tunnel-process.test.js +14 -2
  110. package/dist/lib/tunnel-process.test.js.map +1 -1
  111. package/dist/lib/xcode-version.d.ts +34 -9
  112. package/dist/lib/xcode-version.d.ts.map +1 -1
  113. package/dist/lib/xcode-version.js +73 -18
  114. package/dist/lib/xcode-version.js.map +1 -1
  115. package/dist/lib/xcode-version.test.js +54 -10
  116. package/dist/lib/xcode-version.test.js.map +1 -1
  117. package/package.json +2 -2
  118. package/dist/lib/xcode-sandbox.d.ts +0 -2
  119. package/dist/lib/xcode-sandbox.d.ts.map +0 -1
  120. package/dist/lib/xcode-sandbox.js +0 -7
  121. package/dist/lib/xcode-sandbox.js.map +0 -1
package/README.md CHANGED
@@ -481,7 +481,7 @@ lim xcode get <ID> # Get details of a specific instance
481
481
  lim xcode delete <ID> # Delete an instance
482
482
  lim xcode attach-simulator <IOS_ID> --id <XCODE_ID>
483
483
  lim xcode version # Xcode the sandbox builds with
484
- lim xcode use xcode@27 # Prefer an Xcode major for this workspace (switches the sandbox now)
484
+ lim xcode use xcode@27 # Prefer an Xcode version for this workspace (switches the sandbox now)
485
485
  lim xcode version list # Xcode versions the sandbox can build with
486
486
  ```
487
487
 
@@ -527,10 +527,11 @@ LIM_WEBHOOK_URL=https://ci.example.com/hooks/limrun \
527
527
  # Attach an existing simulator so builds auto-install there
528
528
  lim xcode attach-simulator ios_abc123 --id sandbox_def456
529
529
 
530
- # Pick the Xcode major for this workspace once; builds, tests, runs, syncs, RBE and new sandboxes follow it
530
+ # Pick the Xcode for this workspace once; builds, tests, runs, syncs, RBE and new sandboxes follow it.
531
+ # A bare major selects that major's GA release; a major.minor pins an exact version, typically a beta.
531
532
  lim xcode use xcode@27
532
- lim xcode build ./MyProject # builds with Xcode 27
533
- lim xcode build ./MyProject --xcode-version 26 # one-off override, not remembered
533
+ lim xcode build ./MyProject # builds with the Xcode 27 GA
534
+ lim xcode build ./MyProject --xcode-version 27.1 # one-off override to the 27.1 beta, not remembered
534
535
  lim xcode version unset # forget the preference; the sandbox goes back to the node default
535
536
 
536
537
  # Tune sync cache or ignore additional paths
@@ -817,7 +818,7 @@ lim xcode run -- mise use --pin node@24.5.0
817
818
 
818
819
  `lim xcode tools install` syncs the project and runs `mise install` in that sandbox. Use `--no-sync` to install its current selections without syncing, `--cwd apps/mobile` for a nested project, and `--id` to choose an existing sandbox. The command never creates or replaces an instance.
819
820
 
820
- `lim xcode use xcode@27` is equivalent to `lim xcode version set 27`: it remembers the workspace Xcode major and switches the existing sandbox. With no sandbox, it saves the preference for the next one. You can combine requests, for example `lim xcode use xcode@27 node@24`; only the other tools go into mise. Xcode requires a bare major. `--cwd` applies only to mise tools; `--workspace` chooses the Limrun workspace preference.
821
+ `lim xcode use xcode@27` is equivalent to `lim xcode version set 27`: it remembers the workspace Xcode version and switches the existing sandbox. With no sandbox, it saves the preference for the next one. You can combine requests, for example `lim xcode use xcode@27 node@24`; only the other tools go into mise. Xcode takes a major (`27`, the GA of that major) or a major.minor (`27.1`, an exact version). `--cwd` applies only to mise tools; `--workspace` chooses the Limrun workspace preference.
821
822
 
822
823
  `lim xcode use` selects tools in an existing sandbox after project sync. Mise installs a requested version if needed; use `lim xcode tools install` to install tools declared by synced project files. Use `--cwd apps/mobile` for a nested project. Sandbox selections take precedence over synced project tool requests and apply to later runs and builds.
823
824
 
@@ -4,7 +4,7 @@ import { type LastAndroidInstance, type LastIosInstance, type LastXcodeInstance,
4
4
  import type { XcodeCacheConfig, XcodeCacheFollowResult, XcodeClient, XcodeSelectResult } from '@limrun/api';
5
5
  import { type RequestedXcodeVersion } from './lib/xcode-version';
6
6
  import type { TunnelCommandIO } from './lib/tunnel-command';
7
- type XcodeTarget = LastIosInstance | LastXcodeInstance;
7
+ type XcodeTarget = LastXcodeInstance;
8
8
  type CachePublicationFollow = {
9
9
  start: number;
10
10
  result: XcodeCacheFollowResult;
@@ -76,7 +76,7 @@ export declare abstract class BaseCommand extends Command {
76
76
  protected signedStreamUrl(status: {
77
77
  signedStreamUrl?: string;
78
78
  } | undefined): string | undefined;
79
- protected resolveXcodeClient(target: string | XcodeTarget): Promise<Limrun.XcodeClient>;
79
+ protected resolveXcodeClient(target: XcodeTarget): Promise<Limrun.XcodeClient>;
80
80
  private tryResolveAndroidInstance;
81
81
  protected resolveAndroidInstance(providedId: string | undefined): LastAndroidInstance;
82
82
  protected resolveAndroidInstanceOrCreate(providedId: string | undefined): Promise<LastAndroidInstance>;
@@ -105,7 +105,7 @@ export declare abstract class BaseCommand extends Command {
105
105
  * instance is perfectly usable. A restore that genuinely broke removes the instance, since
106
106
  * the caller asked for a warm workspace and handing back a silently cold one is worse.
107
107
  */
108
- protected awaitCacheRestore(cacheInstanceId: string, removeInstance: () => Promise<unknown>): Promise<void>;
108
+ protected awaitCacheRestore(instanceId: string, removeInstance: () => Promise<unknown>): Promise<void>;
109
109
  /**
110
110
  * Applies cache flags to a target a command is about to build on. An instance this
111
111
  * invocation created already carries the whole configuration from its create, so all that is
@@ -114,7 +114,7 @@ export declare abstract class BaseCommand extends Command {
114
114
  */
115
115
  protected applyBuildCacheToTarget(target: XcodeTarget, cache: XcodeCacheConfig | undefined): Promise<void>;
116
116
  /**
117
- * Binds the sandbox to an Xcode major when the caller asked for one and the sandbox is on
117
+ * Binds the sandbox to an Xcode version when the caller asked for one and the sandbox is on
118
118
  * another. The version is a property of the sandbox, not of this invocation: nothing is
119
119
  * remembered locally, and a later run without the flag keeps building with the switched
120
120
  * Xcode. Refusals from the daemon (not installed, busy) surface with its message.
@@ -126,12 +126,11 @@ export declare abstract class BaseCommand extends Command {
126
126
  protected tryResolveXcodeTarget(providedId: string | undefined): Promise<XcodeTarget | undefined>;
127
127
  private notFound;
128
128
  /**
129
- * The error a /xcode 404 deserves when the sandbox behind the target no longer exists, else
129
+ * The error a /xcode 404 deserves when the target no longer exists, else
130
130
  * undefined. A cached target is trusted without a round-trip, so the SDK's "daemon predates
131
131
  * selection" reading of a 404 is also what a deleted sandbox produces; the API tells the two
132
132
  * apart. Sandboxes this run created, or pinned through the environment (synthetic ids), are
133
- * taken at their word. A standalone sandbox is a NotFoundError like anywhere else; one behind a
134
- * live simulator is not, because withAuth would then forget and replace the simulator itself.
133
+ * taken at their word.
135
134
  */
136
135
  private vanishedXcodeSandboxError;
137
136
  /**
@@ -145,36 +144,31 @@ export declare abstract class BaseCommand extends Command {
145
144
  * /xcode; undefined when nothing names a sandbox or the remembered one is gone.
146
145
  */
147
146
  protected tryReadXcodeStatus(providedId: string | undefined): Promise<{
148
- target: XcodeTarget;
147
+ target: LastXcodeInstance;
149
148
  client: Limrun.XcodeClient;
150
149
  status: Limrun.XcodeStatus;
151
150
  } | undefined>;
152
151
  /** Save the workspace preference and switch its existing sandbox when available. */
153
- protected setPreferredXcodeVersion(major: string, providedId?: string): Promise<void>;
152
+ protected setPreferredXcodeVersion(version: string, providedId?: string): Promise<void>;
154
153
  /** setXcode with the daemon's own refusal message instead of the transport's wrapping. */
155
- protected selectXcode(xcodeClient: XcodeClient, major: string): Promise<XcodeSelectResult>;
154
+ protected selectXcode(xcodeClient: XcodeClient, version: string): Promise<XcodeSelectResult>;
156
155
  private readXcodeSelection;
157
156
  /** The daemon's own words when it refused an Xcode selection (400 not available, 409 busy). */
158
157
  protected xcodeRefusal(err: unknown): {
159
158
  status: 400 | 409;
160
159
  message: string;
161
160
  } | undefined;
162
- /**
163
- * The id the cache endpoints take. For an iOS-backed target that is its Xcode sandbox, which
164
- * is the instance that owns the workspace.
165
- */
166
- protected cacheInstanceId(target: XcodeTarget): string;
167
161
  /**
168
162
  * Binds the key an existing instance publishes under. The build happens now and publication
169
163
  * only at termination, possibly long after this process is gone, so the key has to live on
170
164
  * the instance rather than in this invocation.
171
165
  */
172
- protected bindCacheKey(cacheInstanceId: string, key: string): Promise<void>;
166
+ protected bindCacheKey(instanceId: string, key: string): Promise<void>;
173
167
  /**
174
168
  * Starts following an instance's cache publication before it is deleted, so a publication
175
169
  * that finishes quickly is still seen. Never rejects; the caller renders the result.
176
170
  */
177
- protected startCachePublicationFollow(cacheInstanceId: string): CachePublicationWatch;
171
+ protected startCachePublicationFollow(instanceId: string): CachePublicationWatch;
178
172
  /** Prints how a publication ended. Returns false when it did not publish what it should have. */
179
173
  protected renderCachePublication(watch: CachePublicationWatch): Promise<boolean>;
180
174
  /**
@@ -203,7 +197,7 @@ export declare abstract class BaseCommand extends Command {
203
197
  target: LastGradleInstance;
204
198
  client: import("@limrun/api").GradleClient;
205
199
  } | {
206
- target: XcodeTarget;
200
+ target: LastXcodeInstance;
207
201
  client: Limrun.XcodeClient;
208
202
  }>;
209
203
  private createStandaloneGradleInstance;
@@ -1 +1 @@
1
- {"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../src/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAC7C,OAAO,MAMN,MAAM,aAAa,CAAC;AACrB,OAAO,EAgBL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAkBtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE5G,OAAO,EAA6C,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAQ5D,KAAK,WAAW,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAEvD,KAAK,sBAAsB,GACvB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GACjD;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AACtC;;;;GAIG;AACH,KAAK,qBAAqB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAAE,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E,MAAM,EACX,IAAI,GAAE,MAAM,GAAG,UAAmB;;;;;;;YAkBtB,8BAA8B;CAa7C"}
@@ -261,56 +261,18 @@ class BaseCommand extends core_1.Command {
261
261
  return status?.signedStreamUrl;
262
262
  }
263
263
  async resolveXcodeClient(target) {
264
- const resolvedTarget = typeof target === 'string' ? this.xcodeTargetFromId(target) : target;
265
- const id = resolvedTarget.id;
266
- if (resolvedTarget.type === 'ios') {
267
- if (resolvedTarget.sandboxXcodeUrl && resolvedTarget.token) {
268
- try {
269
- return await this.client.xcodeInstances.createClient({
270
- apiUrl: resolvedTarget.sandboxXcodeUrl,
271
- token: resolvedTarget.token,
272
- });
273
- }
274
- catch (err) {
275
- if (this.isCachedXcodeClientNotFound(err)) {
276
- throw this.notFound(id);
277
- }
278
- throw err;
279
- }
280
- }
281
- const instance = await this.client.iosInstances.get(id);
282
- let sandboxUrl = instance.status.sandbox?.xcode?.url;
283
- let token = instance.status.token;
284
- (0, config_1.registerCreatedInstance)(instance, ['xcode']);
285
- if (!sandboxUrl) {
286
- if (resolvedTarget.sandboxXcodeUrl) {
287
- sandboxUrl = resolvedTarget.sandboxXcodeUrl;
288
- token = resolvedTarget.token || token;
289
- }
290
- }
291
- if (!sandboxUrl) {
292
- this.error(`iOS instance ${id} does not have an Xcode sandbox. Create one and attach the simulator with: lim xcode create --attach --simulator-id ${id}`);
293
- }
294
- return this.client.xcodeInstances.createClient({
295
- apiUrl: sandboxUrl,
296
- token,
297
- });
298
- }
299
- if (resolvedTarget.apiUrl && resolvedTarget.token) {
264
+ if (target.apiUrl && target.token) {
300
265
  try {
301
- return await this.client.xcodeInstances.createClient({
302
- apiUrl: resolvedTarget.apiUrl,
303
- token: resolvedTarget.token,
304
- });
266
+ return await this.client.xcodeInstances.createClient({ apiUrl: target.apiUrl, token: target.token });
305
267
  }
306
268
  catch (err) {
307
269
  if (this.isCachedXcodeClientNotFound(err)) {
308
- throw this.notFound(id);
270
+ throw this.notFound(target.id);
309
271
  }
310
272
  throw err;
311
273
  }
312
274
  }
313
- const instance = await this.client.xcodeInstances.get(id);
275
+ const instance = await this.client.xcodeInstances.get(target.id);
314
276
  (0, config_1.registerCreatedInstance)(instance);
315
277
  return this.client.xcodeInstances.createClient({ instance });
316
278
  }
@@ -489,7 +451,7 @@ class BaseCommand extends core_1.Command {
489
451
  // A requested creation-time timeout cannot be applied to an existing
490
452
  // instance. Skip the cached target so headless one-shot commands get a
491
453
  // fresh instance with the requested lifecycle.
492
- if (target?.type === 'xcode' && !this.autoCreateInactivityTimeout()) {
454
+ if (target && !this.autoCreateInactivityTimeout()) {
493
455
  this._lastResolvedInstanceId = target.id;
494
456
  return target;
495
457
  }
@@ -508,8 +470,8 @@ class BaseCommand extends core_1.Command {
508
470
  const id = this._overrideInstanceId ?? providedId;
509
471
  if (id) {
510
472
  const target = this.xcodeTargetFromId(id);
511
- if (target.type === 'xcode' && !(await this.xcodeTargetHasAttachedSimulator(target))) {
512
- throw new Error(`--ios requires an iOS-backed Xcode target or an Xcode instance with an attached simulator, got ${id}`);
473
+ if (!(await this.xcodeTargetHasAttachedSimulator(target))) {
474
+ throw new Error(`--ios requires an Xcode instance with an attached simulator, got ${id}`);
513
475
  }
514
476
  this._lastResolvedInstanceId = target.id;
515
477
  return target;
@@ -530,15 +492,11 @@ class BaseCommand extends core_1.Command {
530
492
  }
531
493
  const target = (0, config_1.loadLastXcodeInstance)();
532
494
  const forceFresh = Boolean(this.autoCreateInactivityTimeout());
533
- if (target?.type === 'ios' && !forceFresh) {
534
- this._lastResolvedInstanceId = target.id;
535
- return target;
536
- }
537
495
  // The recorded Xcode target wins even when it has no simulator yet:
538
496
  // attach one instead of abandoning it for a fresh sandbox, so a prior
539
497
  // `lim xcode sync` or `lim xcode create` keeps all commands pointed at
540
498
  // the same instance. Only a dead target falls through to creation.
541
- if (target?.type === 'xcode' && !forceFresh) {
499
+ if (target && !forceFresh) {
542
500
  try {
543
501
  const xcodeClient = await this.resolveXcodeClient(target);
544
502
  const status = await xcodeClient.getSimulator();
@@ -551,7 +509,7 @@ class BaseCommand extends core_1.Command {
551
509
  // attachNewSimulator deletes the simulator itself when the attach fails.
552
510
  const { simulator } = await xcodeClient.attachNewSimulator();
553
511
  this._instancesCreatedThisRun.add(simulator.metadata.id);
554
- saveLastCreatedInstance(simulator);
512
+ (0, config_1.registerCreatedInstance)(simulator);
555
513
  this.info(`Attached new simulator ${simulator.metadata.id} to Xcode target ${target.id}.`);
556
514
  }
557
515
  this._lastResolvedInstanceId = target.id;
@@ -642,12 +600,12 @@ class BaseCommand extends core_1.Command {
642
600
  async createIosInstance() {
643
601
  const instance = await this.client.iosInstances.create({ wait: true, spec: {} });
644
602
  this._instancesCreatedThisRun.add(instance.metadata.id);
645
- return saveLastCreatedInstance(instance);
603
+ return (0, config_1.registerCreatedInstance)(instance);
646
604
  }
647
605
  async createAndroidInstance() {
648
606
  const instance = await this.client.androidInstances.create({ wait: true, spec: {} });
649
607
  this._instancesCreatedThisRun.add(instance.metadata.id);
650
- return saveLastCreatedInstance(instance);
608
+ return (0, config_1.registerCreatedInstance)(instance);
651
609
  }
652
610
  /** Whether `id` is a server-side instance THIS invocation auto-created. */
653
611
  wasCreatedThisRun(id) {
@@ -671,12 +629,12 @@ class BaseCommand extends core_1.Command {
671
629
  * instance is perfectly usable. A restore that genuinely broke removes the instance, since
672
630
  * the caller asked for a warm workspace and handing back a silently cold one is worse.
673
631
  */
674
- async awaitCacheRestore(cacheInstanceId, removeInstance) {
632
+ async awaitCacheRestore(instanceId, removeInstance) {
675
633
  const start = Date.now();
676
634
  this.info('Restoring build cache...');
677
635
  let result;
678
636
  try {
679
- result = await this.client.xcodeInstances.followCache(cacheInstanceId, {
637
+ result = await this.client.xcodeInstances.followCache(instanceId, {
680
638
  onUpdate: (cache) => {
681
639
  const line = (0, cache_1.restoreProgressLine)(cache);
682
640
  if (line)
@@ -687,19 +645,19 @@ class BaseCommand extends core_1.Command {
687
645
  catch (err) {
688
646
  if (err instanceof api_1.XcodeCacheGoneError) {
689
647
  // Not a wait that broke but an instance that ended, so there is nothing to keep or check.
690
- throw new Error(`Instance ${cacheInstanceId} was collected before its cache restore started.`);
648
+ throw new Error(`Instance ${instanceId} was collected before its cache restore started.`);
691
649
  }
692
650
  // The restore may well still be running, so the instance stays: deleting it over a
693
651
  // client-side wait that broke would throw away a workspace that is probably fine.
694
- throw new Error(`Could not follow the cache restore of ${cacheInstanceId}: ${err instanceof Error ? err.message : String(err)}\n` + `The instance is still there. Check it with: lim xcode get ${cacheInstanceId}`);
652
+ throw new Error(`Could not follow the cache restore of ${instanceId}: ${err instanceof Error ? err.message : String(err)}\n` + `The instance is still there. Check it with: lim xcode get ${instanceId}`);
695
653
  }
696
654
  if (result.gone) {
697
- throw new Error(`Instance ${cacheInstanceId} was gone before its cache restore finished (last phase: ${result.cache.restore.phase}).`);
655
+ throw new Error(`Instance ${instanceId} was gone before its cache restore finished (last phase: ${result.cache.restore.phase}).`);
698
656
  }
699
657
  const outcome = (0, cache_1.restoreOutcome)(result.cache, Date.now() - start);
700
658
  if (outcome.failed) {
701
659
  await removeInstance();
702
- throw new Error(`${outcome.line}\nRemoved instance ${cacheInstanceId}.`);
660
+ throw new Error(`${outcome.line}\nRemoved instance ${instanceId}.`);
703
661
  }
704
662
  this.info(outcome.line);
705
663
  if (result.cache.restore.phase !== 'restored') {
@@ -722,11 +680,11 @@ class BaseCommand extends core_1.Command {
722
680
  this.info(`Cache: instance ${target.id} already exists, so its restore keys and paths stay as they were created.`);
723
681
  }
724
682
  if (cache.key) {
725
- await this.bindCacheKey(this.cacheInstanceId(target), cache.key);
683
+ await this.bindCacheKey(target.id, cache.key);
726
684
  }
727
685
  }
728
686
  /**
729
- * Binds the sandbox to an Xcode major when the caller asked for one and the sandbox is on
687
+ * Binds the sandbox to an Xcode version when the caller asked for one and the sandbox is on
730
688
  * another. The version is a property of the sandbox, not of this invocation: nothing is
731
689
  * remembered locally, and a later run without the flag keeps building with the switched
732
690
  * Xcode. Refusals from the daemon (not installed, busy) surface with its message.
@@ -735,26 +693,37 @@ class BaseCommand extends core_1.Command {
735
693
  if (!requested)
736
694
  return;
737
695
  // One round trip: the daemon answers alreadyBound for a no-op, before any busy check, so
738
- // the steady state (sandbox already on the preferred major) costs no switch and no 409.
696
+ // the steady state (sandbox already on the preferred version) costs no switch and no 409.
739
697
  let result;
740
698
  try {
741
- result = await this.readXcodeSelection(() => xcodeClient.setXcode(requested.major));
699
+ result = await xcodeClient.setXcode(requested.version);
742
700
  }
743
701
  catch (err) {
744
- if (!(err instanceof api_1.XcodeSelectionUnsupportedError))
702
+ if (err instanceof api_1.XcodeSelectionUnsupportedError) {
703
+ // A vanished sandbox must stay a NotFoundError (withAuth clears the cache and recreates),
704
+ // not a claim that the daemon predates selection.
705
+ const gone = await this.vanishedXcodeSandboxError(target);
706
+ if (gone)
707
+ throw gone;
708
+ // The workspace preference is a standing wish, not this command's request: on a daemon
709
+ // that cannot honour it, say so and build with what the sandbox has.
710
+ if (requested.source === 'workspace') {
711
+ this.warn(`${err.message} Building with the sandbox's current Xcode.`);
712
+ return;
713
+ }
745
714
  throw err;
746
- // A vanished sandbox must stay a NotFoundError (withAuth clears the cache and recreates),
747
- // not a claim that the daemon predates selection.
748
- const gone = await this.vanishedXcodeSandboxError(target);
749
- if (gone)
750
- throw gone;
751
- // The workspace preference is a standing wish, not this command's request: on a daemon
752
- // that cannot honour it, say so and build with what the sandbox has.
753
- if (requested.source === 'workspace') {
754
- this.warn(`${err.message} Building with the sandbox's current Xcode.`);
755
- return;
756
715
  }
757
- throw err;
716
+ const refusal = this.xcodeRefusal(err);
717
+ if (!refusal)
718
+ throw err;
719
+ // A saved minor outlives the beta it named once the fleet retires it; the fix is a local
720
+ // command, so name it. A flag is this command's own request and gets the daemon's words.
721
+ if (refusal.status === 400 && requested.source === 'workspace') {
722
+ this.error(`${refusal.message}. This workspace prefers Xcode ${requested.version}; pick an installed version with ` +
723
+ '`lim xcode version set <version>` (a bare major such as 27 selects the GA) or drop the preference with ' +
724
+ '`lim xcode version unset`.');
725
+ }
726
+ this.error(refusal.message);
758
727
  }
759
728
  if (result.alreadyBound)
760
729
  return;
@@ -778,30 +747,24 @@ class BaseCommand extends core_1.Command {
778
747
  return new api_1.NotFoundError(404, { message: `Instance ${id} was not found` }, undefined, new Headers());
779
748
  }
780
749
  /**
781
- * The error a /xcode 404 deserves when the sandbox behind the target no longer exists, else
750
+ * The error a /xcode 404 deserves when the target no longer exists, else
782
751
  * undefined. A cached target is trusted without a round-trip, so the SDK's "daemon predates
783
752
  * selection" reading of a 404 is also what a deleted sandbox produces; the API tells the two
784
753
  * apart. Sandboxes this run created, or pinned through the environment (synthetic ids), are
785
- * taken at their word. A standalone sandbox is a NotFoundError like anywhere else; one behind a
786
- * live simulator is not, because withAuth would then forget and replace the simulator itself.
754
+ * taken at their word.
787
755
  */
788
756
  async vanishedXcodeSandboxError(target) {
789
- if (this.wasCreatedThisRun(target.id) || (0, set_instance_1.envInstanceTarget)(target.type)?.id === target.id)
790
- return undefined;
791
- const sandboxId = (0, config_1.xcodeSandboxIdOf)(target);
792
- if (!sandboxId)
757
+ if (this.wasCreatedThisRun(target.id) || (0, set_instance_1.envInstanceTarget)('xcode')?.id === target.id)
793
758
  return undefined;
794
759
  try {
795
- await this.client.xcodeInstances.get(sandboxId);
760
+ await this.client.xcodeInstances.get(target.id);
796
761
  return undefined;
797
762
  }
798
763
  catch (err) {
799
764
  if (!(err instanceof api_1.NotFoundError))
800
765
  throw err;
801
766
  }
802
- if (target.type !== 'ios')
803
- return this.notFound(target.id);
804
- return new Error(`Xcode sandbox ${sandboxId} behind simulator ${target.id} no longer exists; attach a new one with: lim xcode create --attach --simulator-id ${target.id}`);
767
+ return this.notFound(target.id);
805
768
  }
806
769
  /**
807
770
  * Runs a /xcode call on a target. A remembered standalone sandbox that no longer exists is
@@ -818,7 +781,7 @@ class BaseCommand extends core_1.Command {
818
781
  const gone = await this.vanishedXcodeSandboxError(target);
819
782
  if (!gone)
820
783
  throw err;
821
- if (this._lastResolvedXcodeSource !== 'memory' || target.type === 'ios')
784
+ if (this._lastResolvedXcodeSource !== 'memory')
822
785
  throw gone;
823
786
  (0, daemon_1.stopDaemon)(target.id);
824
787
  (0, config_1.clearLastInstanceId)(target.id);
@@ -839,12 +802,12 @@ class BaseCommand extends core_1.Command {
839
802
  return status ? { target, client, status } : undefined;
840
803
  }
841
804
  /** Save the workspace preference and switch its existing sandbox when available. */
842
- async setPreferredXcodeVersion(major, providedId) {
805
+ async setPreferredXcodeVersion(version, providedId) {
843
806
  const previous = (0, config_1.loadXcodeVersionPreference)();
844
- // Keep the workspace preference on transient failures, but reject majors the node cannot provide.
807
+ // Keep the workspace preference on transient failures, but reject versions the node cannot provide.
845
808
  const record = () => {
846
- (0, config_1.setXcodeVersionPreference)(major);
847
- this.info(`Xcode ${major} is now the preferred version${this.scopeSuffix()}.`);
809
+ (0, config_1.setXcodeVersionPreference)(version);
810
+ this.info(`Xcode ${version} is now the preferred version${this.scopeSuffix()}.`);
848
811
  };
849
812
  await this.withAuth(async () => {
850
813
  const target = await this.tryResolveXcodeTarget(providedId);
@@ -852,14 +815,14 @@ class BaseCommand extends core_1.Command {
852
815
  try {
853
816
  result =
854
817
  target ?
855
- await this.readXcodeSelectionOrForget(target, async () => (await this.resolveXcodeClient(target)).setXcode(major))
818
+ await this.readXcodeSelectionOrForget(target, async () => (await this.resolveXcodeClient(target)).setXcode(version))
856
819
  : undefined;
857
820
  }
858
821
  catch (err) {
859
822
  const refusal = this.xcodeRefusal(err);
860
823
  if (refusal?.status === 400) {
861
- if (previous === major) {
862
- this.error(`${refusal.message}. This workspace already prefers Xcode ${major}; drop it with: lim xcode version unset`);
824
+ if (previous === version) {
825
+ this.error(`${refusal.message}. This workspace already prefers Xcode ${version}; drop it with: lim xcode version unset`);
863
826
  }
864
827
  this.error(`${refusal.message}. The workspace preference stays ${previous ? `Xcode ${previous}` : 'unset'}.`);
865
828
  }
@@ -871,13 +834,13 @@ class BaseCommand extends core_1.Command {
871
834
  record();
872
835
  if (!target || !result) {
873
836
  if (this.isJsonEnabled())
874
- this.outputJson({ preferred: major });
837
+ this.outputJson({ preferred: version });
875
838
  else
876
839
  this.output(`No sandbox instance found${this.scopeSuffix()}; the next one uses it.`);
877
840
  return;
878
841
  }
879
842
  if (this.isJsonEnabled()) {
880
- this.outputJson({ instanceId: target.id, preferred: major, ...result });
843
+ this.outputJson({ instanceId: target.id, preferred: version, ...result });
881
844
  return;
882
845
  }
883
846
  const verb = result.alreadyBound ? 'already uses' : 'now uses';
@@ -888,8 +851,8 @@ class BaseCommand extends core_1.Command {
888
851
  }, { createReplacement: false });
889
852
  }
890
853
  /** setXcode with the daemon's own refusal message instead of the transport's wrapping. */
891
- async selectXcode(xcodeClient, major) {
892
- return this.readXcodeSelection(() => xcodeClient.setXcode(major));
854
+ async selectXcode(xcodeClient, version) {
855
+ return this.readXcodeSelection(() => xcodeClient.setXcode(version));
893
856
  }
894
857
  async readXcodeSelection(call) {
895
858
  try {
@@ -915,21 +878,14 @@ class BaseCommand extends core_1.Command {
915
878
  }
916
879
  return { status: err.status, message };
917
880
  }
918
- /**
919
- * The id the cache endpoints take. For an iOS-backed target that is its Xcode sandbox, which
920
- * is the instance that owns the workspace.
921
- */
922
- cacheInstanceId(target) {
923
- return (0, config_1.xcodeSandboxIdOf)(target) ?? target.id;
924
- }
925
881
  /**
926
882
  * Binds the key an existing instance publishes under. The build happens now and publication
927
883
  * only at termination, possibly long after this process is gone, so the key has to live on
928
884
  * the instance rather than in this invocation.
929
885
  */
930
- async bindCacheKey(cacheInstanceId, key) {
886
+ async bindCacheKey(instanceId, key) {
931
887
  try {
932
- await this.client.xcodeInstances.bindCacheKey(cacheInstanceId, key);
888
+ await this.client.xcodeInstances.bindCacheKey(instanceId, key);
933
889
  this.info(`Cache: publishing this workspace under ${key} when the instance terminates.`);
934
890
  }
935
891
  catch (err) {
@@ -944,14 +900,14 @@ class BaseCommand extends core_1.Command {
944
900
  * Starts following an instance's cache publication before it is deleted, so a publication
945
901
  * that finishes quickly is still seen. Never rejects; the caller renders the result.
946
902
  */
947
- startCachePublicationFollow(cacheInstanceId) {
903
+ startCachePublicationFollow(instanceId) {
948
904
  const start = Date.now();
949
905
  let open = () => { };
950
906
  const opened = new Promise((resolve) => {
951
907
  open = resolve;
952
908
  });
953
909
  const done = this.client.xcodeInstances
954
- .followCache(cacheInstanceId, {
910
+ .followCache(instanceId, {
955
911
  side: 'save',
956
912
  onOpen: open,
957
913
  onUpdate: (cache) => {
@@ -1008,20 +964,10 @@ class BaseCommand extends core_1.Command {
1008
964
  return (this.id ?? '').split(/[: ]+/).filter(Boolean);
1009
965
  }
1010
966
  xcodeTargetFromId(id) {
1011
- const type = (0, instance_client_factory_1.detectInstanceType)(id);
1012
- if (type === 'ios') {
1013
- const cached = (0, config_1.loadIosInstanceCache)(id);
1014
- if (cached)
1015
- return cached;
1016
- return { id, type: 'ios' };
1017
- }
1018
- if (type === 'xcode') {
1019
- const cached = (0, config_1.loadXcodeInstanceCache)(id);
1020
- if (cached)
1021
- return cached;
1022
- return { id, type: 'xcode' };
967
+ if ((0, instance_client_factory_1.detectInstanceType)(id) !== 'xcode') {
968
+ throw new Error(`Expected an Xcode instance (sandbox_...), got ${id}`);
1023
969
  }
1024
- throw new Error(`Expected an iOS or Xcode target, got ${id}`);
970
+ return (0, config_1.loadXcodeInstanceCache)(id) ?? { id, type: 'xcode' };
1025
971
  }
1026
972
  androidInstanceFromId(id) {
1027
973
  const type = (0, instance_client_factory_1.detectInstanceType)(id);
@@ -1038,9 +984,7 @@ class BaseCommand extends core_1.Command {
1038
984
  return (0, config_1.loadIosInstanceCache)(id) ?? { id, type: 'ios' };
1039
985
  }
1040
986
  // Creates a standalone Xcode instance plus a fresh simulator and attaches
1041
- // them, replacing the legacy server-side paired creation
1042
- // (spec.sandbox.xcode.enabled). Separate creation keeps the two lifecycles
1043
- // independent and is the supported way to get a simulator-backed target.
987
+ // them. Separate creation keeps the two lifecycles independent.
1044
988
  // The simulator keeps the org-default inactivity timeout on purpose: a
1045
989
  // build-scoped --inactivity-timeout (e.g. 3s) belongs to the build sandbox,
1046
990
  // and a simulator carrying it would idle out before the build finishes.
@@ -1057,7 +1001,7 @@ class BaseCommand extends core_1.Command {
1057
1001
  throw err;
1058
1002
  }
1059
1003
  this._instancesCreatedThisRun.add(simulator.metadata.id);
1060
- saveLastCreatedInstance(simulator);
1004
+ (0, config_1.registerCreatedInstance)(simulator);
1061
1005
  return target;
1062
1006
  }
1063
1007
  async createStandaloneXcodeInstance() {
@@ -1071,12 +1015,12 @@ class BaseCommand extends core_1.Command {
1071
1015
  },
1072
1016
  });
1073
1017
  this._instancesCreatedThisRun.add(instance.metadata.id);
1074
- saveLastCreatedInstance(instance);
1018
+ (0, config_1.registerCreatedInstance)(instance);
1075
1019
  if ((0, cache_1.wantsRestore)(cache)) {
1076
1020
  await this.awaitCacheRestore(instance.metadata.id, () => this.deleteCreatedInstance(instance.metadata.id));
1077
1021
  }
1078
1022
  const target = (0, config_1.loadLastXcodeInstance)();
1079
- if (!target || target.type !== 'xcode') {
1023
+ if (!target) {
1080
1024
  throw new Error(`Created Xcode instance ${instance.metadata.id}, but failed to load it from local cache.`);
1081
1025
  }
1082
1026
  return target;
@@ -1145,7 +1089,7 @@ class BaseCommand extends core_1.Command {
1145
1089
  return this.client.gradleInstances.createClient({ apiUrl: target.apiUrl, token: target.token });
1146
1090
  }
1147
1091
  const instance = await this.client.gradleInstances.get(target.id);
1148
- saveLastCreatedInstance(instance);
1092
+ (0, config_1.registerCreatedInstance)(instance);
1149
1093
  return this.client.gradleInstances.createClient({ instance });
1150
1094
  }
1151
1095
  async resolveBuildToolClient(platform, id, mode = 'work') {
@@ -1172,7 +1116,7 @@ class BaseCommand extends core_1.Command {
1172
1116
  this._instancesCreatedThisRun.add(instance.metadata.id);
1173
1117
  // The save path builds the record from the instance we just created, so
1174
1118
  // the returned union member is necessarily the gradle shape.
1175
- return saveLastCreatedInstance(instance);
1119
+ return (0, config_1.registerCreatedInstance)(instance);
1176
1120
  }
1177
1121
  }
1178
1122
  exports.BaseCommand = BaseCommand;
@@ -1211,7 +1155,4 @@ BaseCommand.readOnlyFlags = {
1211
1155
  quiet: BaseCommand.baseFlags.quiet,
1212
1156
  workspace: BaseCommand.baseFlags.workspace,
1213
1157
  };
1214
- function saveLastCreatedInstance(instanceOrId, relatedTypes = []) {
1215
- return (0, config_1.registerCreatedInstance)(instanceOrId, relatedTypes);
1216
- }
1217
1158
  //# sourceMappingURL=base-command.js.map