@bugbug-io/cli 14.4.3 → 14.6.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.
@@ -62,7 +62,7 @@ import {
62
62
  waitForSuiteRun,
63
63
  waitForTestRun,
64
64
  writeReportXml
65
- } from "./chunk-H5R2GMRL.js";
65
+ } from "./chunk-RONAEYWS.js";
66
66
  import "./chunk-XLIBEETK.js";
67
67
  import "./chunk-3PJ4ZE2N.js";
68
68
  import {
@@ -11130,5 +11130,5 @@ react-router/dist/development/index.mjs:
11130
11130
  * @license MIT
11131
11131
  *)
11132
11132
  */
11133
- //# sourceMappingURL=NavigatorApp-UUXFK5JW.js.map
11133
+ //# sourceMappingURL=NavigatorApp-5E5EE7CU.js.map
11134
11134
  //# debugId=9e90a61c-d567-5034-bd9e-55c33ff018a1
@@ -12,7 +12,7 @@ var startNavigator = async (opts = {}) => {
12
12
  const [{ render }, React, { NavigatorApp }] = await Promise.all([
13
13
  import("./render-CSMURV5U.js"),
14
14
  importReact(),
15
- import("./NavigatorApp-UUXFK5JW.js")
15
+ import("./NavigatorApp-5E5EE7CU.js")
16
16
  ]);
17
17
  const element = React.createElement(
18
18
  NavigatorApp,
@@ -27,5 +27,5 @@ var startNavigator = async (opts = {}) => {
27
27
  export {
28
28
  startNavigator
29
29
  };
30
- //# sourceMappingURL=app-MSVLIJL3.js.map
30
+ //# sourceMappingURL=app-RFZH4MU7.js.map
31
31
  //# debugId=cecc8c80-302a-54e0-a1fb-74d6bb70c0a1
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="dc8a69a7-6baa-5132-bf11-2057ae61bff0")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2c40ab42-03d3-514a-a95d-bd3f25f12c2c")}catch(e){}}();
3
3
  import { createRequire as __nodeCreateRequire } from 'node:module';
4
4
  const require = __nodeCreateRequire(import.meta.url);
5
5
  import {
@@ -8930,7 +8930,7 @@ var require_main = __commonJS({
8930
8930
  // ../core/package.json
8931
8931
  var package_default = {
8932
8932
  name: "@bugbug-io/core",
8933
- version: "14.4.3",
8933
+ version: "14.6.0",
8934
8934
  private: true,
8935
8935
  type: "module",
8936
8936
  main: "dist/index.js",
@@ -48402,6 +48402,44 @@ var analytics = {
48402
48402
  }
48403
48403
  };
48404
48404
 
48405
+ // src/utils/exit.ts
48406
+ var EXIT_OK = 0;
48407
+ var EXIT_GENERAL_ERROR = 1;
48408
+ var EXIT_FAILED = 2;
48409
+ var EXIT_STOPPED = 3;
48410
+ var EXIT_AUTH_ERROR = 1;
48411
+ var EXIT_USAGE_ERROR = 64;
48412
+ var exitCodeForStatus = (status) => {
48413
+ switch (status) {
48414
+ case "passed":
48415
+ return EXIT_OK;
48416
+ case "failed":
48417
+ return EXIT_FAILED;
48418
+ case "stopped":
48419
+ return EXIT_STOPPED;
48420
+ default:
48421
+ return EXIT_GENERAL_ERROR;
48422
+ }
48423
+ };
48424
+ var emitError = (mode, envelope) => {
48425
+ if (mode === "json") {
48426
+ process.stderr.write(`${JSON.stringify(envelope, null, 2)}
48427
+ `);
48428
+ return;
48429
+ }
48430
+ process.stderr.write(`Error: ${envelope.error}
48431
+ `);
48432
+ };
48433
+ var exitWith = (code) => {
48434
+ try {
48435
+ process.exit(code);
48436
+ } catch (err) {
48437
+ process.exitCode = code;
48438
+ throw err;
48439
+ }
48440
+ return void 0;
48441
+ };
48442
+
48405
48443
  // ../sdk/dist/index.js
48406
48444
  import { createRequire as createRequire2 } from "module";
48407
48445
  import { existsSync as existsSync32, readFileSync as readFileSync32 } from "fs";
@@ -58224,7 +58262,7 @@ var readEnvFiles2 = (cwd) => {
58224
58262
  var buildUserAgent2 = (clientType, version) => `BugBug ${clientType.toUpperCase()} ${version}`;
58225
58263
  var package_default2 = {
58226
58264
  name: "@bugbug-io/core",
58227
- version: "14.4.3",
58265
+ version: "14.6.0",
58228
58266
  private: true,
58229
58267
  type: "module",
58230
58268
  main: "dist/index.js",
@@ -58450,12 +58488,15 @@ var RATE_LIMIT_MIN_WINDOW_MS = 1e3;
58450
58488
  var RATE_LIMIT_MAX_WINDOW_MS = 6e4;
58451
58489
  var RateLimiter = class {
58452
58490
  #requests = [];
58491
+ #activeRequests = 0;
58492
+ #slotQueue = [];
58453
58493
  #config;
58454
58494
  constructor(config) {
58455
58495
  this.#warnIfUnsupportedConfig(config);
58456
58496
  this.#config = {
58457
58497
  maxRequests: config.maxRequests,
58458
58498
  windowMs: config.windowMs,
58499
+ maxConcurrentRequests: config.maxConcurrentRequests ?? Number.POSITIVE_INFINITY,
58459
58500
  retryAfter: config.retryAfter || 1e3,
58460
58501
  retryServer429: config.retryServer429 ?? true,
58461
58502
  exponentialBackoff: {
@@ -58493,51 +58534,67 @@ var RateLimiter = class {
58493
58534
  * @throws {RateLimitError} When retries are exhausted or `retryServer429` is
58494
58535
  * disabled and the server returned 429.
58495
58536
  */
58496
- async execute(fn) {
58537
+ async execute(fn, options = {}) {
58538
+ const retryServer429 = options.retryServer429 ?? this.#config.retryServer429;
58497
58539
  let lastError = null;
58498
- for (let attempt = 0; attempt <= this.#config.exponentialBackoff.maxRetries; attempt++) {
58499
- if (!this.#canMakeRequest()) {
58500
- const waitTime = this.#getWaitTime();
58501
- const gateError = new RateLimitError(
58502
- waitTime,
58503
- `Rate limit exceeded. Wait ${waitTime}ms before retrying.`
58504
- );
58505
- lastError = gateError;
58506
- if (attempt === this.#config.exponentialBackoff.maxRetries) {
58507
- throw gateError;
58508
- }
58509
- await this.#sleep(this.#computeBackoff(attempt, gateError.retryAfter));
58510
- continue;
58511
- }
58512
- const stamp = this.#recordRequest();
58513
- try {
58514
- return await fn();
58515
- } catch (fnError) {
58516
- this.#releaseRequest(stamp);
58517
- if (!(fnError instanceof RateLimitError)) {
58518
- throw fnError;
58519
- }
58520
- lastError = fnError;
58521
- if (!this.#config.retryServer429) {
58522
- throw fnError;
58540
+ await this.#acquireSlot();
58541
+ try {
58542
+ for (let attempt = 0; attempt <= this.#config.exponentialBackoff.maxRetries; attempt++) {
58543
+ if (!this.#canMakeRequest()) {
58544
+ const waitTime = this.#getWaitTime();
58545
+ const gateError = new RateLimitError(
58546
+ waitTime,
58547
+ `Rate limit exceeded. Wait ${waitTime}ms before retrying.`
58548
+ );
58549
+ lastError = gateError;
58550
+ if (attempt === this.#config.exponentialBackoff.maxRetries) {
58551
+ throw gateError;
58552
+ }
58553
+ await this.#sleep(this.#computeBackoff(attempt, gateError.retryAfter));
58554
+ continue;
58523
58555
  }
58524
- if (attempt === this.#config.exponentialBackoff.maxRetries) {
58525
- throw fnError;
58556
+ const stamp = this.#recordRequest();
58557
+ try {
58558
+ return await fn();
58559
+ } catch (fnError) {
58560
+ this.#releaseRequest(stamp);
58561
+ if (!(fnError instanceof RateLimitError)) {
58562
+ throw fnError;
58563
+ }
58564
+ lastError = fnError;
58565
+ if (!retryServer429) {
58566
+ throw fnError;
58567
+ }
58568
+ if (attempt === this.#config.exponentialBackoff.maxRetries) {
58569
+ throw fnError;
58570
+ }
58571
+ await this.#sleep(this.#computeBackoff(attempt, fnError.retryAfter));
58526
58572
  }
58527
- await this.#sleep(this.#computeBackoff(attempt, fnError.retryAfter));
58528
58573
  }
58574
+ throw lastError || new Error("Max retries exceeded");
58575
+ } finally {
58576
+ this.#releaseSlot();
58529
58577
  }
58530
- throw lastError || new Error("Max retries exceeded");
58531
58578
  }
58532
58579
  #computeBackoff = (attempt, retryAfter) => {
58533
- const baseDelay = retryAfter || this.#config.exponentialBackoff.baseDelay;
58534
- const delay = Math.min(
58535
- baseDelay * Math.pow(2, attempt),
58536
- this.#config.exponentialBackoff.maxDelay
58537
- );
58580
+ const baseDelay = retryAfter ?? this.#config.exponentialBackoff.baseDelay;
58581
+ const computedDelay = baseDelay * Math.pow(2, attempt);
58582
+ const delay = retryAfter !== void 0 ? Math.max(retryAfter, computedDelay) : Math.min(computedDelay, this.#config.exponentialBackoff.maxDelay);
58538
58583
  const jitter = Math.random() * 0.1 * delay;
58539
58584
  return delay + jitter;
58540
58585
  };
58586
+ async #acquireSlot() {
58587
+ while (this.#activeRequests >= this.#config.maxConcurrentRequests) {
58588
+ await new Promise((resolve42) => {
58589
+ this.#slotQueue.push(resolve42);
58590
+ });
58591
+ }
58592
+ this.#activeRequests++;
58593
+ }
58594
+ #releaseSlot() {
58595
+ this.#activeRequests = Math.max(0, this.#activeRequests - 1);
58596
+ this.#slotQueue.shift()?.();
58597
+ }
58541
58598
  /**
58542
58599
  * Sleep utility
58543
58600
  */
@@ -58742,6 +58799,16 @@ var BugBugApiClient = class {
58742
58799
  const resolved = resolveEnvConfig2({
58743
58800
  overrides: { token: config.apiToken, apiUrl: config.apiUrl, projectId: config.projectId }
58744
58801
  });
58802
+ const rateLimit = config.rateLimit || {
58803
+ maxRequests: 100,
58804
+ windowMs: 6e4,
58805
+ exponentialBackoff: {
58806
+ baseDelay: 1e3,
58807
+ maxDelay: 3e4,
58808
+ maxRetries: 3
58809
+ }
58810
+ };
58811
+ const rateLimiter = config.rateLimiter ?? new RateLimiter(rateLimit);
58745
58812
  this.#config = {
58746
58813
  apiToken: resolved.token ?? "",
58747
58814
  projectId: resolved.projectId ?? "",
@@ -58750,15 +58817,7 @@ var BugBugApiClient = class {
58750
58817
  verbose: config.verbose || false,
58751
58818
  logLevel: config.logLevel || "info",
58752
58819
  timeout: config.timeout || 3e4,
58753
- rateLimit: config.rateLimit || {
58754
- maxRequests: 100,
58755
- windowMs: 6e4,
58756
- exponentialBackoff: {
58757
- baseDelay: 1e3,
58758
- maxDelay: 3e4,
58759
- maxRetries: 3
58760
- }
58761
- },
58820
+ rateLimit,
58762
58821
  requestHeaders: {
58763
58822
  "User-Agent": buildUserAgent2("sdk", getVersion2()),
58764
58823
  ...config.requestHeaders
@@ -58768,11 +58827,12 @@ var BugBugApiClient = class {
58768
58827
  onAfterRequest: config.onAfterRequest || (() => {
58769
58828
  }),
58770
58829
  onRequestError: config.onRequestError || (() => {
58771
- })
58830
+ }),
58831
+ rateLimiter
58772
58832
  };
58773
58833
  this.#validateConfig();
58774
58834
  this.#client = this.#createApiClient();
58775
- this.#rateLimiter = new RateLimiter(this.#config.rateLimit);
58835
+ this.#rateLimiter = rateLimiter;
58776
58836
  }
58777
58837
  #createApiClient = () => createClient({
58778
58838
  baseUrl: this.#config.apiUrl,
@@ -58852,71 +58912,75 @@ var BugBugApiClient = class {
58852
58912
  headers: customHeaders
58853
58913
  };
58854
58914
  this.#config.onBeforeRequest(requestData);
58855
- return this.#rateLimiter.execute(async () => {
58856
- const abortContext = this.#createAbortContext(signal, timeout);
58857
- try {
58858
- if (this.#config.verbose) {
58859
- this.#log("debug", `\u2192 ${method} ${path3}`, { params, body });
58860
- }
58861
- const requestOptions = {
58862
- signal: abortContext.signal,
58863
- headers: {
58864
- ...customHeaders,
58865
- ...this.#identityHeaders()
58915
+ return this.#rateLimiter.execute(
58916
+ async () => {
58917
+ const abortContext = this.#createAbortContext(signal, timeout);
58918
+ try {
58919
+ this.#throwIfAlreadyAborted(abortContext, requestOrigin);
58920
+ if (this.#config.verbose) {
58921
+ this.#log("debug", `\u2192 ${method} ${path3}`, { params, body });
58922
+ }
58923
+ const requestOptions = {
58924
+ signal: abortContext.signal,
58925
+ headers: {
58926
+ ...customHeaders,
58927
+ ...this.#identityHeaders()
58928
+ }
58929
+ };
58930
+ if (scopedParams) {
58931
+ requestOptions.params = scopedParams;
58866
58932
  }
58867
- };
58868
- if (scopedParams) {
58869
- requestOptions.params = scopedParams;
58870
- }
58871
- if (body !== void 0) {
58872
- requestOptions.body = body;
58873
- }
58874
- let response;
58875
- switch (method) {
58876
- case "GET":
58877
- response = await this.#client.GET(path3, requestOptions);
58878
- break;
58879
- case "POST":
58880
- response = await this.#client.POST(path3, requestOptions);
58881
- break;
58882
- case "PUT":
58883
- response = await this.#client.PUT(path3, requestOptions);
58884
- break;
58885
- case "DELETE":
58886
- response = await this.#client.DELETE(path3, requestOptions);
58887
- break;
58888
- case "PATCH":
58889
- response = await this.#client.PATCH(path3, requestOptions);
58890
- break;
58891
- default:
58892
- throw new ValidationError(`Unsupported HTTP method: ${method}`);
58893
- }
58894
- abortContext.clear();
58895
- if (this.#config.verbose) {
58896
- this.#log("debug", `\u2190 ${response.response?.status} ${method} ${path3}`, {
58897
- status: response.response?.status,
58898
- statusText: response.response?.statusText
58899
- });
58900
- }
58901
- if (response.error) {
58902
- this.#config.onRequestError(requestData, response.response, response.error);
58903
- await this.#handleOpenApiError(response.error, response.response, requestOrigin);
58904
- }
58905
- const result = response.data;
58906
- this.#config.onAfterRequest(requestData);
58907
- return result;
58908
- } catch (error3) {
58909
- abortContext.clear();
58910
- if (error3 instanceof SyntaxError) {
58911
- throw new UnexpectedResponseError(
58912
- formatUnexpectedResponseMessage(error3, method, requestUrl),
58913
- error3,
58914
- requestOrigin
58915
- );
58933
+ if (body !== void 0) {
58934
+ requestOptions.body = body;
58935
+ }
58936
+ let response;
58937
+ switch (method) {
58938
+ case "GET":
58939
+ response = await this.#client.GET(path3, requestOptions);
58940
+ break;
58941
+ case "POST":
58942
+ response = await this.#client.POST(path3, requestOptions);
58943
+ break;
58944
+ case "PUT":
58945
+ response = await this.#client.PUT(path3, requestOptions);
58946
+ break;
58947
+ case "DELETE":
58948
+ response = await this.#client.DELETE(path3, requestOptions);
58949
+ break;
58950
+ case "PATCH":
58951
+ response = await this.#client.PATCH(path3, requestOptions);
58952
+ break;
58953
+ default:
58954
+ throw new ValidationError(`Unsupported HTTP method: ${method}`);
58955
+ }
58956
+ abortContext.clear();
58957
+ if (this.#config.verbose) {
58958
+ this.#log("debug", `\u2190 ${response.response?.status} ${method} ${path3}`, {
58959
+ status: response.response?.status,
58960
+ statusText: response.response?.statusText
58961
+ });
58962
+ }
58963
+ if (response.error) {
58964
+ this.#config.onRequestError(requestData, response.response, response.error);
58965
+ await this.#handleOpenApiError(response.error, response.response, requestOrigin);
58966
+ }
58967
+ const result = response.data;
58968
+ this.#config.onAfterRequest(requestData);
58969
+ return result;
58970
+ } catch (error3) {
58971
+ abortContext.clear();
58972
+ if (error3 instanceof SyntaxError) {
58973
+ throw new UnexpectedResponseError(
58974
+ formatUnexpectedResponseMessage(error3, method, requestUrl),
58975
+ error3,
58976
+ requestOrigin
58977
+ );
58978
+ }
58979
+ throw this.#toTransportError(error3, requestOrigin, abortContext);
58916
58980
  }
58917
- throw this.#toTransportError(error3, requestOrigin, abortContext);
58918
- }
58919
- });
58981
+ },
58982
+ { retryServer429: this.#canRetryServer429(method) }
58983
+ );
58920
58984
  };
58921
58985
  /**
58922
58986
  * Handle OpenAPI fetch errors. Always reads the real `response.status` so
@@ -59224,46 +59288,59 @@ var BugBugApiClient = class {
59224
59288
  };
59225
59289
  const requestOrigin = { method, url };
59226
59290
  this.#config.onBeforeRequest(requestData);
59227
- return this.#rateLimiter.execute(async () => {
59228
- const abortContext = this.#createAbortContext(signal, timeout);
59229
- try {
59230
- if (this.#config.verbose) {
59231
- this.#log("debug", `\u2192 ${method} ${path3} (raw)`, { queryParams, pathParams });
59232
- }
59233
- const response = await fetch(url, {
59234
- method,
59235
- redirect,
59236
- headers: {
59237
- // Caller headers go first so the SDK's auth + identification
59238
- // headers always win — a stray `Authorization` in caller-supplied
59239
- // headers would otherwise silently replace the SDK token.
59240
- ...customHeaders,
59241
- ...authenticated ? this.#identityHeaders() : this.#requestHeaders(),
59242
- ...contentType ? { "Content-Type": contentType } : {}
59243
- },
59244
- ...body !== void 0 ? { body } : {},
59245
- signal: abortContext.signal
59246
- });
59247
- abortContext.clear();
59248
- if (this.#config.verbose) {
59249
- this.#log("debug", `\u2190 ${response.status} ${method} ${path3}`, {
59250
- status: response.status,
59251
- statusText: response.statusText
59291
+ return this.#rateLimiter.execute(
59292
+ async () => {
59293
+ const abortContext = this.#createAbortContext(signal, timeout);
59294
+ try {
59295
+ this.#throwIfAlreadyAborted(abortContext, requestOrigin);
59296
+ if (this.#config.verbose) {
59297
+ this.#log("debug", `\u2192 ${method} ${path3} (raw)`, { queryParams, pathParams });
59298
+ }
59299
+ const response = await fetch(url, {
59300
+ method,
59301
+ redirect,
59302
+ headers: {
59303
+ // Caller headers go first so the SDK's auth + identification
59304
+ // headers always win — a stray `Authorization` in caller-supplied
59305
+ // headers would otherwise silently replace the SDK token.
59306
+ ...customHeaders,
59307
+ ...authenticated ? this.#identityHeaders() : this.#requestHeaders(),
59308
+ ...contentType ? { "Content-Type": contentType } : {}
59309
+ },
59310
+ ...body !== void 0 ? { body } : {},
59311
+ signal: abortContext.signal
59252
59312
  });
59313
+ abortContext.clear();
59314
+ if (this.#config.verbose) {
59315
+ this.#log("debug", `\u2190 ${response.status} ${method} ${path3}`, {
59316
+ status: response.status,
59317
+ statusText: response.statusText
59318
+ });
59319
+ }
59320
+ if (!response.ok && !(acceptRedirect && response.status >= 300 && response.status < 400)) {
59321
+ const errorText = await response.text();
59322
+ this.#config.onRequestError(requestData, response, new Error(errorText));
59323
+ await this.#handleOpenApiError(errorText, response, requestOrigin);
59324
+ }
59325
+ const result = await readBody(response);
59326
+ this.#config.onAfterRequest(requestData);
59327
+ return result;
59328
+ } catch (error3) {
59329
+ abortContext.clear();
59330
+ throw this.#toTransportError(error3, requestOrigin, abortContext);
59253
59331
  }
59254
- if (!response.ok && !(acceptRedirect && response.status >= 300 && response.status < 400)) {
59255
- const errorText = await response.text();
59256
- this.#config.onRequestError(requestData, response, new Error(errorText));
59257
- await this.#handleOpenApiError(errorText, response, requestOrigin);
59258
- }
59259
- const result = await readBody(response);
59260
- this.#config.onAfterRequest(requestData);
59261
- return result;
59262
- } catch (error3) {
59263
- abortContext.clear();
59264
- throw this.#toTransportError(error3, requestOrigin, abortContext);
59265
- }
59266
- });
59332
+ },
59333
+ { retryServer429: this.#canRetryServer429(method) }
59334
+ );
59335
+ };
59336
+ #canRetryServer429 = (method) => method === "GET" && this.#config.rateLimit.retryServer429 !== false;
59337
+ #throwIfAlreadyAborted = (abortContext, requestOrigin) => {
59338
+ if (!abortContext.signal.aborted) return;
59339
+ throw this.#toTransportError(
59340
+ new DOMException("The operation was aborted.", "AbortError"),
59341
+ requestOrigin,
59342
+ abortContext
59343
+ );
59267
59344
  };
59268
59345
  #createAbortContext = (signal, timeout) => {
59269
59346
  const controller = new AbortController();
@@ -59328,9 +59405,12 @@ var BugBugApiClient = class {
59328
59405
  if (updates.apiToken || updates.apiUrl) {
59329
59406
  this.#client = this.#createApiClient();
59330
59407
  }
59331
- if (updates.rateLimit) {
59408
+ if (updates.rateLimiter) {
59409
+ this.#rateLimiter = updates.rateLimiter;
59410
+ } else if (updates.rateLimit) {
59332
59411
  this.#rateLimiter = new RateLimiter(this.#config.rateLimit);
59333
59412
  }
59413
+ this.#config.rateLimiter = this.#rateLimiter;
59334
59414
  };
59335
59415
  /**
59336
59416
  * Snapshot of the in-process rate-limiter state.
@@ -64164,11 +64244,11 @@ Upgrade your plan: ${error3.upgradeUrl}` : headline;
64164
64244
  }
64165
64245
  return lines.join("\n");
64166
64246
  };
64167
- var showError = (message, exitCode = 1) => {
64247
+ var showError = (message, exitCode = EXIT_GENERAL_ERROR) => {
64168
64248
  if (!isInteractive()) {
64169
64249
  process.stderr.write(`Error: ${message}
64170
64250
  `);
64171
- process.exit(exitCode);
64251
+ exitWith(exitCode);
64172
64252
  }
64173
64253
  void renderInteractiveError(message, exitCode);
64174
64254
  };
@@ -64185,42 +64265,10 @@ var renderInteractiveError = async (message, exitCode) => {
64185
64265
  );
64186
64266
  setTimeout(() => {
64187
64267
  unmount();
64188
- process.exit(exitCode);
64268
+ exitWith(exitCode);
64189
64269
  }, 100);
64190
64270
  };
64191
64271
 
64192
- // src/utils/exit.ts
64193
- var EXIT_OK = 0;
64194
- var EXIT_GENERAL_ERROR = 1;
64195
- var EXIT_FAILED = 2;
64196
- var EXIT_STOPPED = 3;
64197
- var EXIT_AUTH_ERROR = 1;
64198
- var EXIT_USAGE_ERROR = 64;
64199
- var exitCodeForStatus = (status) => {
64200
- switch (status) {
64201
- case "passed":
64202
- return EXIT_OK;
64203
- case "failed":
64204
- return EXIT_FAILED;
64205
- case "stopped":
64206
- return EXIT_STOPPED;
64207
- default:
64208
- return EXIT_GENERAL_ERROR;
64209
- }
64210
- };
64211
- var emitError = (mode, envelope) => {
64212
- if (mode === "json") {
64213
- process.stderr.write(`${JSON.stringify(envelope, null, 2)}
64214
- `);
64215
- return;
64216
- }
64217
- process.stderr.write(`Error: ${envelope.error}
64218
- `);
64219
- };
64220
- var exitWith = (code) => {
64221
- process.exit(code);
64222
- };
64223
-
64224
64272
  // src/utils/sdk.ts
64225
64273
  var cached2;
64226
64274
  var createCliSdk = (overrides = {}) => {
@@ -64910,5 +64958,5 @@ export {
64910
64958
  formatErrorMessage,
64911
64959
  showError
64912
64960
  };
64913
- //# sourceMappingURL=chunk-H5R2GMRL.js.map
64914
- //# debugId=dc8a69a7-6baa-5132-bf11-2057ae61bff0
64961
+ //# sourceMappingURL=chunk-RONAEYWS.js.map
64962
+ //# debugId=2c40ab42-03d3-514a-a95d-bd3f25f12c2c
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="544ba384-9e50-5f6e-8092-ee763d03e7a5")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3568797f-f45b-54bd-bfb8-2f70f433660f")}catch(e){}}();
4
4
  import { createRequire as __nodeCreateRequire } from 'node:module';
5
5
  const require = __nodeCreateRequire(import.meta.url);
6
6
  import {
@@ -55,7 +55,7 @@ import {
55
55
  waitForSuiteRun,
56
56
  waitForTestRun,
57
57
  writeReportXml
58
- } from "./chunk-H5R2GMRL.js";
58
+ } from "./chunk-RONAEYWS.js";
59
59
  import "./chunk-XLIBEETK.js";
60
60
  import "./chunk-3PJ4ZE2N.js";
61
61
  import {
@@ -4177,18 +4177,17 @@ var getStartupMode = (argv) => {
4177
4177
  };
4178
4178
 
4179
4179
  // src/index.ts
4180
- process.on("uncaughtException", async (err) => {
4181
- captureException(err);
4180
+ var isExitingAfterFatalError = false;
4181
+ var handleFatalError = async (error) => {
4182
+ if (isExitingAfterFatalError) return;
4183
+ isExitingAfterFatalError = true;
4184
+ captureException(error);
4182
4185
  await closeSentry();
4183
- showError(formatErrorMessage(err));
4184
- process.exit(1);
4185
- });
4186
- process.on("unhandledRejection", async (reason) => {
4187
- captureException(reason);
4188
- await closeSentry();
4189
- showError(formatErrorMessage(reason));
4190
- process.exit(1);
4191
- });
4186
+ showError(formatErrorMessage(error));
4187
+ exitWith(EXIT_GENERAL_ERROR);
4188
+ };
4189
+ process.on("uncaughtException", handleFatalError);
4190
+ process.on("unhandledRejection", handleFatalError);
4192
4191
  var isRunCommand = (actionCommand) => {
4193
4192
  const commandName = actionCommand.name();
4194
4193
  const parentName = actionCommand.parent?.name();
@@ -4236,7 +4235,7 @@ program2.exitOverride();
4236
4235
  });
4237
4236
  analytics.trackEvent("cli_session_started");
4238
4237
  if (startupMode.type === "commandline" && await shouldRedirectUnauthenticatedCommandToInit(process.argv, hasUsableSession)) {
4239
- const { startNavigator } = await import("./app-MSVLIJL3.js");
4238
+ const { startNavigator } = await import("./app-RFZH4MU7.js");
4240
4239
  await startNavigator({
4241
4240
  initialRoute: "/init",
4242
4241
  initialRouteState: {
@@ -4248,7 +4247,7 @@ program2.exitOverride();
4248
4247
  return;
4249
4248
  }
4250
4249
  if (startupMode.type === "navigator") {
4251
- const { startNavigator } = await import("./app-MSVLIJL3.js");
4250
+ const { startNavigator } = await import("./app-RFZH4MU7.js");
4252
4251
  await startNavigator({
4253
4252
  initialRoute: startupMode.route,
4254
4253
  token: config.token,
@@ -4276,13 +4275,13 @@ program2.exitOverride();
4276
4275
  } catch (err) {
4277
4276
  analytics.trackEvent("cli_session_ended", { success: false });
4278
4277
  if (err instanceof CommanderError) {
4279
- process.exit(err.exitCode);
4278
+ exitWith(err.exitCode);
4280
4279
  }
4281
4280
  captureException(err);
4282
4281
  await closeSentry();
4283
4282
  showError(formatErrorMessage(err));
4284
- process.exit(1);
4283
+ exitWith(EXIT_GENERAL_ERROR);
4285
4284
  }
4286
4285
  })();
4287
4286
  //# sourceMappingURL=index.js.map
4288
- //# debugId=544ba384-9e50-5f6e-8092-ee763d03e7a5
4287
+ //# debugId=3568797f-f45b-54bd-bfb8-2f70f433660f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bugbug-io/cli",
3
- "version": "14.4.3",
3
+ "version": "14.6.0",
4
4
  "description": "BugBug CLI for test automation, CI workflows, and AI-agent plugin installation",
5
5
  "type": "module",
6
6
  "bin": {