@pilatos/bitbucket-cli 1.13.1 → 1.13.2

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 (2) hide show
  1. package/dist/index.js +903 -737
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -12239,73 +12239,6 @@ var require_form_data = __commonJS((exports, module) => {
12239
12239
  module.exports = FormData2;
12240
12240
  });
12241
12241
 
12242
- // node_modules/proxy-from-env/index.js
12243
- var require_proxy_from_env = __commonJS((exports) => {
12244
- var parseUrl = __require("url").parse;
12245
- var DEFAULT_PORTS = {
12246
- ftp: 21,
12247
- gopher: 70,
12248
- http: 80,
12249
- https: 443,
12250
- ws: 80,
12251
- wss: 443
12252
- };
12253
- var stringEndsWith = String.prototype.endsWith || function(s) {
12254
- return s.length <= this.length && this.indexOf(s, this.length - s.length) !== -1;
12255
- };
12256
- function getProxyForUrl(url2) {
12257
- var parsedUrl = typeof url2 === "string" ? parseUrl(url2) : url2 || {};
12258
- var proto2 = parsedUrl.protocol;
12259
- var hostname = parsedUrl.host;
12260
- var port = parsedUrl.port;
12261
- if (typeof hostname !== "string" || !hostname || typeof proto2 !== "string") {
12262
- return "";
12263
- }
12264
- proto2 = proto2.split(":", 1)[0];
12265
- hostname = hostname.replace(/:\d*$/, "");
12266
- port = parseInt(port) || DEFAULT_PORTS[proto2] || 0;
12267
- if (!shouldProxy(hostname, port)) {
12268
- return "";
12269
- }
12270
- var proxy = getEnv("npm_config_" + proto2 + "_proxy") || getEnv(proto2 + "_proxy") || getEnv("npm_config_proxy") || getEnv("all_proxy");
12271
- if (proxy && proxy.indexOf("://") === -1) {
12272
- proxy = proto2 + "://" + proxy;
12273
- }
12274
- return proxy;
12275
- }
12276
- function shouldProxy(hostname, port) {
12277
- var NO_PROXY = (getEnv("npm_config_no_proxy") || getEnv("no_proxy")).toLowerCase();
12278
- if (!NO_PROXY) {
12279
- return true;
12280
- }
12281
- if (NO_PROXY === "*") {
12282
- return false;
12283
- }
12284
- return NO_PROXY.split(/[,\s]/).every(function(proxy) {
12285
- if (!proxy) {
12286
- return true;
12287
- }
12288
- var parsedProxy = proxy.match(/^(.+):(\d+)$/);
12289
- var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
12290
- var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
12291
- if (parsedProxyPort && parsedProxyPort !== port) {
12292
- return true;
12293
- }
12294
- if (!/^[.*]/.test(parsedProxyHostname)) {
12295
- return hostname !== parsedProxyHostname;
12296
- }
12297
- if (parsedProxyHostname.charAt(0) === "*") {
12298
- parsedProxyHostname = parsedProxyHostname.slice(1);
12299
- }
12300
- return !stringEndsWith.call(hostname, parsedProxyHostname);
12301
- });
12302
- }
12303
- function getEnv(key) {
12304
- return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
12305
- }
12306
- exports.getProxyForUrl = getProxyForUrl;
12307
- });
12308
-
12309
12242
  // node_modules/ms/index.js
12310
12243
  var require_ms = __commonJS((exports, module) => {
12311
12244
  var s = 1000;
@@ -13351,7 +13284,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
13351
13284
  removeMatchingHeaders(/^content-/i, this._options.headers);
13352
13285
  }
13353
13286
  var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
13354
- var currentUrlParts = parseUrl(this._currentUrl);
13287
+ var currentUrlParts = parseUrl2(this._currentUrl);
13355
13288
  var currentHost = currentHostHeader || currentUrlParts.host;
13356
13289
  var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url2.format(Object.assign(currentUrlParts, { host: currentHost }));
13357
13290
  var redirectUrl = resolveUrl(location, currentUrl);
@@ -13390,7 +13323,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
13390
13323
  if (isURL(input)) {
13391
13324
  input = spreadUrlObject(input);
13392
13325
  } else if (isString2(input)) {
13393
- input = spreadUrlObject(parseUrl(input));
13326
+ input = spreadUrlObject(parseUrl2(input));
13394
13327
  } else {
13395
13328
  callback = options;
13396
13329
  options = validateUrl(input);
@@ -13425,7 +13358,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
13425
13358
  return exports2;
13426
13359
  }
13427
13360
  function noop2() {}
13428
- function parseUrl(input) {
13361
+ function parseUrl2(input) {
13429
13362
  var parsed;
13430
13363
  if (useNativeURL) {
13431
13364
  parsed = new URL2(input);
@@ -13438,7 +13371,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
13438
13371
  return parsed;
13439
13372
  }
13440
13373
  function resolveUrl(relative, base) {
13441
- return useNativeURL ? new URL2(relative, base) : parseUrl(url2.resolve(base, relative));
13374
+ return useNativeURL ? new URL2(relative, base) : parseUrl2(url2.resolve(base, relative));
13442
13375
  }
13443
13376
  function validateUrl(input) {
13444
13377
  if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
@@ -14257,6 +14190,7 @@ class Container {
14257
14190
  }
14258
14191
  var ServiceTokens = {
14259
14192
  ConfigService: "ConfigService",
14193
+ CredentialStore: "CredentialStore",
14260
14194
  GitService: "GitService",
14261
14195
  ContextService: "ContextService",
14262
14196
  OutputService: "OutputService",
@@ -14320,7 +14254,7 @@ var ServiceTokens = {
14320
14254
  };
14321
14255
 
14322
14256
  // src/services/config.service.ts
14323
- import { join, win32 } from "path";
14257
+ import { posix, win32 } from "path";
14324
14258
  import { homedir } from "os";
14325
14259
 
14326
14260
  // src/types/errors.ts
@@ -14393,14 +14327,15 @@ class ConfigService {
14393
14327
  configCache = null;
14394
14328
  constructor(configDir, options = {}) {
14395
14329
  const platform = options.platform ?? process.platform;
14396
- const joinPath = platform === "win32" ? win32.join : join;
14330
+ const joinPath = platform === "win32" ? win32.join : posix.join;
14397
14331
  this.configDir = configDir ?? this.resolveDefaultConfigDir({ ...options, platform });
14398
14332
  this.configFile = joinPath(this.configDir, "config.json");
14399
14333
  }
14400
14334
  resolveDefaultConfigDir(options) {
14401
14335
  const platform = options.platform ?? process.platform;
14336
+ const isSimulatedPlatform = options.platform !== undefined;
14402
14337
  if (platform === "win32") {
14403
- const appDataDir = options.appData ?? process.env.APPDATA;
14338
+ const appDataDir = options.appData ?? (isSimulatedPlatform ? undefined : process.env.APPDATA);
14404
14339
  if (appDataDir) {
14405
14340
  return win32.join(appDataDir, "bb");
14406
14341
  }
@@ -14408,7 +14343,7 @@ class ConfigService {
14408
14343
  return win32.join(homeDir2, "AppData", "Roaming", "bb");
14409
14344
  }
14410
14345
  const homeDir = options.homeDir ?? homedir();
14411
- return join(homeDir, ".config", "bb");
14346
+ return posix.join(homeDir, ".config", "bb");
14412
14347
  }
14413
14348
  async ensureConfigDir() {
14414
14349
  try {
@@ -14635,14 +14570,14 @@ class ContextService {
14635
14570
  this.configService = configService;
14636
14571
  }
14637
14572
  parseRemoteUrl(url) {
14638
- const sshMatch = new RegExp(/git@bitbucket\.org:([^/]+)\/([^.]+)(?:\.git)?/).exec(url);
14573
+ const sshMatch = /git@bitbucket\.org:([^/]+)\/([^.]+)(?:\.git)?/.exec(url);
14639
14574
  if (sshMatch) {
14640
14575
  return {
14641
14576
  workspace: sshMatch[1],
14642
14577
  repoSlug: sshMatch[2]
14643
14578
  };
14644
14579
  }
14645
- const httpsMatch = new RegExp(/https?:\/\/(?:[^@]+@)?bitbucket\.org\/([^/]+)\/([^/.]+)(?:\.git)?/).exec(url);
14580
+ const httpsMatch = /https?:\/\/(?:[^@]+@)?bitbucket\.org\/([^/]+)\/([^/.]+)(?:\.git)?/.exec(url);
14646
14581
  if (httpsMatch) {
14647
14582
  return {
14648
14583
  workspace: httpsMatch[1],
@@ -14699,6 +14634,19 @@ class ContextService {
14699
14634
  }
14700
14635
  return context;
14701
14636
  }
14637
+ async requireWorkspace(explicit) {
14638
+ if (explicit && explicit.length > 0) {
14639
+ return explicit;
14640
+ }
14641
+ const config = await this.configService.getConfig();
14642
+ if (config.defaultWorkspace && config.defaultWorkspace.length > 0) {
14643
+ return config.defaultWorkspace;
14644
+ }
14645
+ throw new BBError({
14646
+ code: 6002 /* CONTEXT_WORKSPACE_NOT_FOUND */,
14647
+ message: "No workspace specified. Use --workspace option or set a default workspace with `bb config set defaultWorkspace <name>`."
14648
+ });
14649
+ }
14702
14650
  }
14703
14651
  // node_modules/chalk/source/vendor/ansi-styles/index.js
14704
14652
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -15584,16 +15532,40 @@ var isEmptyObject = (val) => {
15584
15532
  };
15585
15533
  var isDate = kindOfTest("Date");
15586
15534
  var isFile = kindOfTest("File");
15535
+ var isReactNativeBlob = (value) => {
15536
+ return !!(value && typeof value.uri !== "undefined");
15537
+ };
15538
+ var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
15587
15539
  var isBlob = kindOfTest("Blob");
15588
15540
  var isFileList = kindOfTest("FileList");
15589
15541
  var isStream = (val) => isObject(val) && isFunction(val.pipe);
15542
+ function getGlobal() {
15543
+ if (typeof globalThis !== "undefined")
15544
+ return globalThis;
15545
+ if (typeof self !== "undefined")
15546
+ return self;
15547
+ if (typeof window !== "undefined")
15548
+ return window;
15549
+ if (typeof global !== "undefined")
15550
+ return global;
15551
+ return {};
15552
+ }
15553
+ var G = getGlobal();
15554
+ var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : undefined;
15590
15555
  var isFormData = (thing) => {
15591
15556
  let kind;
15592
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
15557
+ return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
15593
15558
  };
15594
15559
  var isURLSearchParams = kindOfTest("URLSearchParams");
15595
- var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
15596
- var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
15560
+ var [isReadableStream, isRequest, isResponse, isHeaders] = [
15561
+ "ReadableStream",
15562
+ "Request",
15563
+ "Response",
15564
+ "Headers"
15565
+ ].map(kindOfTest);
15566
+ var trim = (str) => {
15567
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
15568
+ };
15597
15569
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
15598
15570
  if (obj === null || typeof obj === "undefined") {
15599
15571
  return;
@@ -15646,6 +15618,9 @@ function merge() {
15646
15618
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
15647
15619
  const result = {};
15648
15620
  const assignValue = (val, key) => {
15621
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
15622
+ return;
15623
+ }
15649
15624
  const targetKey = caseless && findKey(result, key) || key;
15650
15625
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
15651
15626
  result[targetKey] = merge(result[targetKey], val);
@@ -15665,9 +15640,19 @@ function merge() {
15665
15640
  var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
15666
15641
  forEach(b, (val, key) => {
15667
15642
  if (thisArg && isFunction(val)) {
15668
- a[key] = bind(val, thisArg);
15643
+ Object.defineProperty(a, key, {
15644
+ value: bind(val, thisArg),
15645
+ writable: true,
15646
+ enumerable: true,
15647
+ configurable: true
15648
+ });
15669
15649
  } else {
15670
- a[key] = val;
15650
+ Object.defineProperty(a, key, {
15651
+ value: val,
15652
+ writable: true,
15653
+ enumerable: true,
15654
+ configurable: true
15655
+ });
15671
15656
  }
15672
15657
  }, { allOwnKeys });
15673
15658
  return a;
@@ -15680,7 +15665,12 @@ var stripBOM = (content) => {
15680
15665
  };
15681
15666
  var inherits = (constructor, superConstructor, props, descriptors) => {
15682
15667
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
15683
- constructor.prototype.constructor = constructor;
15668
+ Object.defineProperty(constructor.prototype, "constructor", {
15669
+ value: constructor,
15670
+ writable: true,
15671
+ enumerable: false,
15672
+ configurable: true
15673
+ });
15684
15674
  Object.defineProperty(constructor, "super", {
15685
15675
  value: superConstructor.prototype
15686
15676
  });
@@ -15873,6 +15863,8 @@ var utils_default = {
15873
15863
  isUndefined,
15874
15864
  isDate,
15875
15865
  isFile,
15866
+ isReactNativeBlob,
15867
+ isReactNative,
15876
15868
  isBlob,
15877
15869
  isRegExp,
15878
15870
  isFunction,
@@ -15915,25 +15907,36 @@ var utils_default = {
15915
15907
  };
15916
15908
 
15917
15909
  // node_modules/axios/lib/core/AxiosError.js
15918
- function AxiosError(message, code, config, request, response) {
15919
- Error.call(this);
15920
- if (Error.captureStackTrace) {
15921
- Error.captureStackTrace(this, this.constructor);
15922
- } else {
15923
- this.stack = new Error().stack;
15924
- }
15925
- this.message = message;
15926
- this.name = "AxiosError";
15927
- code && (this.code = code);
15928
- config && (this.config = config);
15929
- request && (this.request = request);
15930
- if (response) {
15931
- this.response = response;
15932
- this.status = response.status ? response.status : null;
15910
+ class AxiosError extends Error {
15911
+ static from(error, code, config, request, response, customProps) {
15912
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
15913
+ axiosError.cause = error;
15914
+ axiosError.name = error.name;
15915
+ if (error.status != null && axiosError.status == null) {
15916
+ axiosError.status = error.status;
15917
+ }
15918
+ customProps && Object.assign(axiosError, customProps);
15919
+ return axiosError;
15920
+ }
15921
+ constructor(message, code, config, request, response) {
15922
+ super(message);
15923
+ Object.defineProperty(this, "message", {
15924
+ value: message,
15925
+ enumerable: true,
15926
+ writable: true,
15927
+ configurable: true
15928
+ });
15929
+ this.name = "AxiosError";
15930
+ this.isAxiosError = true;
15931
+ code && (this.code = code);
15932
+ config && (this.config = config);
15933
+ request && (this.request = request);
15934
+ if (response) {
15935
+ this.response = response;
15936
+ this.status = response.status;
15937
+ }
15933
15938
  }
15934
- }
15935
- utils_default.inherits(AxiosError, Error, {
15936
- toJSON: function toJSON() {
15939
+ toJSON() {
15937
15940
  return {
15938
15941
  message: this.message,
15939
15942
  name: this.name,
@@ -15948,44 +15951,19 @@ utils_default.inherits(AxiosError, Error, {
15948
15951
  status: this.status
15949
15952
  };
15950
15953
  }
15951
- });
15952
- var prototype = AxiosError.prototype;
15953
- var descriptors = {};
15954
- [
15955
- "ERR_BAD_OPTION_VALUE",
15956
- "ERR_BAD_OPTION",
15957
- "ECONNABORTED",
15958
- "ETIMEDOUT",
15959
- "ERR_NETWORK",
15960
- "ERR_FR_TOO_MANY_REDIRECTS",
15961
- "ERR_DEPRECATED",
15962
- "ERR_BAD_RESPONSE",
15963
- "ERR_BAD_REQUEST",
15964
- "ERR_CANCELED",
15965
- "ERR_NOT_SUPPORT",
15966
- "ERR_INVALID_URL"
15967
- ].forEach((code) => {
15968
- descriptors[code] = { value: code };
15969
- });
15970
- Object.defineProperties(AxiosError, descriptors);
15971
- Object.defineProperty(prototype, "isAxiosError", { value: true });
15972
- AxiosError.from = (error, code, config, request, response, customProps) => {
15973
- const axiosError = Object.create(prototype);
15974
- utils_default.toFlatObject(error, axiosError, function filter(obj) {
15975
- return obj !== Error.prototype;
15976
- }, (prop) => {
15977
- return prop !== "isAxiosError";
15978
- });
15979
- const msg = error && error.message ? error.message : "Error";
15980
- const errCode = code == null && error ? error.code : code;
15981
- AxiosError.call(axiosError, msg, errCode, config, request, response);
15982
- if (error && axiosError.cause == null) {
15983
- Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
15984
- }
15985
- axiosError.name = error && error.name || "Error";
15986
- customProps && Object.assign(axiosError, customProps);
15987
- return axiosError;
15988
- };
15954
+ }
15955
+ AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
15956
+ AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
15957
+ AxiosError.ECONNABORTED = "ECONNABORTED";
15958
+ AxiosError.ETIMEDOUT = "ETIMEDOUT";
15959
+ AxiosError.ERR_NETWORK = "ERR_NETWORK";
15960
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
15961
+ AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
15962
+ AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
15963
+ AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
15964
+ AxiosError.ERR_CANCELED = "ERR_CANCELED";
15965
+ AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
15966
+ AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
15989
15967
  var AxiosError_default = AxiosError;
15990
15968
 
15991
15969
  // node_modules/axios/lib/platform/node/classes/FormData.js
@@ -16053,6 +16031,10 @@ function toFormData(obj, formData, options) {
16053
16031
  }
16054
16032
  function defaultVisitor(value, key, path) {
16055
16033
  let arr = value;
16034
+ if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
16035
+ formData.append(renderKey(path, key, dots), convertValue(value));
16036
+ return false;
16037
+ }
16056
16038
  if (value && !path && typeof value === "object") {
16057
16039
  if (utils_default.endsWith(key, "{}")) {
16058
16040
  key = metaTokens ? key : key.slice(0, -2);
@@ -16119,11 +16101,11 @@ function AxiosURLSearchParams(params, options) {
16119
16101
  this._pairs = [];
16120
16102
  params && toFormData_default(params, this, options);
16121
16103
  }
16122
- var prototype2 = AxiosURLSearchParams.prototype;
16123
- prototype2.append = function append(name, value) {
16104
+ var prototype = AxiosURLSearchParams.prototype;
16105
+ prototype.append = function append(name, value) {
16124
16106
  this._pairs.push([name, value]);
16125
16107
  };
16126
- prototype2.toString = function toString2(encoder) {
16108
+ prototype.toString = function toString2(encoder) {
16127
16109
  const _encode = encoder ? function(value) {
16128
16110
  return encoder.call(this, value, encode);
16129
16111
  } : encode;
@@ -16142,17 +16124,15 @@ function buildURL(url, params, options) {
16142
16124
  return url;
16143
16125
  }
16144
16126
  const _encode = options && options.encode || encode2;
16145
- if (utils_default.isFunction(options)) {
16146
- options = {
16147
- serialize: options
16148
- };
16149
- }
16150
- const serializeFn = options && options.serialize;
16127
+ const _options = utils_default.isFunction(options) ? {
16128
+ serialize: options
16129
+ } : options;
16130
+ const serializeFn = _options && _options.serialize;
16151
16131
  let serializedParams;
16152
16132
  if (serializeFn) {
16153
- serializedParams = serializeFn(params, options);
16133
+ serializedParams = serializeFn(params, _options);
16154
16134
  } else {
16155
- serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, options).toString(_encode);
16135
+ serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, _options).toString(_encode);
16156
16136
  }
16157
16137
  if (serializedParams) {
16158
16138
  const hashmarkIndex = url.indexOf("#");
@@ -16202,7 +16182,8 @@ var InterceptorManager_default = InterceptorManager;
16202
16182
  var transitional_default = {
16203
16183
  silentJSONParsing: true,
16204
16184
  forcedJSONParsing: true,
16205
- clarifyTimeoutError: false
16185
+ clarifyTimeoutError: false,
16186
+ legacyInterceptorReqResOrdering: true
16206
16187
  };
16207
16188
 
16208
16189
  // node_modules/axios/lib/platform/node/index.js
@@ -16350,66 +16331,70 @@ function stringifySafely(rawValue, parser, encoder) {
16350
16331
  var defaults = {
16351
16332
  transitional: transitional_default,
16352
16333
  adapter: ["xhr", "http", "fetch"],
16353
- transformRequest: [function transformRequest(data, headers) {
16354
- const contentType = headers.getContentType() || "";
16355
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
16356
- const isObjectPayload = utils_default.isObject(data);
16357
- if (isObjectPayload && utils_default.isHTMLForm(data)) {
16358
- data = new FormData(data);
16359
- }
16360
- const isFormData2 = utils_default.isFormData(data);
16361
- if (isFormData2) {
16362
- return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
16363
- }
16364
- if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
16365
- return data;
16366
- }
16367
- if (utils_default.isArrayBufferView(data)) {
16368
- return data.buffer;
16369
- }
16370
- if (utils_default.isURLSearchParams(data)) {
16371
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
16372
- return data.toString();
16373
- }
16374
- let isFileList2;
16375
- if (isObjectPayload) {
16376
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
16377
- return toURLEncodedForm(data, this.formSerializer).toString();
16334
+ transformRequest: [
16335
+ function transformRequest(data, headers) {
16336
+ const contentType = headers.getContentType() || "";
16337
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
16338
+ const isObjectPayload = utils_default.isObject(data);
16339
+ if (isObjectPayload && utils_default.isHTMLForm(data)) {
16340
+ data = new FormData(data);
16341
+ }
16342
+ const isFormData2 = utils_default.isFormData(data);
16343
+ if (isFormData2) {
16344
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
16345
+ }
16346
+ if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
16347
+ return data;
16348
+ }
16349
+ if (utils_default.isArrayBufferView(data)) {
16350
+ return data.buffer;
16351
+ }
16352
+ if (utils_default.isURLSearchParams(data)) {
16353
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
16354
+ return data.toString();
16355
+ }
16356
+ let isFileList2;
16357
+ if (isObjectPayload) {
16358
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
16359
+ return toURLEncodedForm(data, this.formSerializer).toString();
16360
+ }
16361
+ if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
16362
+ const _FormData = this.env && this.env.FormData;
16363
+ return toFormData_default(isFileList2 ? { "files[]": data } : data, _FormData && new _FormData, this.formSerializer);
16364
+ }
16378
16365
  }
16379
- if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
16380
- const _FormData = this.env && this.env.FormData;
16381
- return toFormData_default(isFileList2 ? { "files[]": data } : data, _FormData && new _FormData, this.formSerializer);
16366
+ if (isObjectPayload || hasJSONContentType) {
16367
+ headers.setContentType("application/json", false);
16368
+ return stringifySafely(data);
16382
16369
  }
16383
- }
16384
- if (isObjectPayload || hasJSONContentType) {
16385
- headers.setContentType("application/json", false);
16386
- return stringifySafely(data);
16387
- }
16388
- return data;
16389
- }],
16390
- transformResponse: [function transformResponse(data) {
16391
- const transitional = this.transitional || defaults.transitional;
16392
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
16393
- const JSONRequested = this.responseType === "json";
16394
- if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
16395
16370
  return data;
16396
16371
  }
16397
- if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
16398
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
16399
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
16400
- try {
16401
- return JSON.parse(data, this.parseReviver);
16402
- } catch (e) {
16403
- if (strictJSONParsing) {
16404
- if (e.name === "SyntaxError") {
16405
- throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
16372
+ ],
16373
+ transformResponse: [
16374
+ function transformResponse(data) {
16375
+ const transitional = this.transitional || defaults.transitional;
16376
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
16377
+ const JSONRequested = this.responseType === "json";
16378
+ if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
16379
+ return data;
16380
+ }
16381
+ if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
16382
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
16383
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
16384
+ try {
16385
+ return JSON.parse(data, this.parseReviver);
16386
+ } catch (e) {
16387
+ if (strictJSONParsing) {
16388
+ if (e.name === "SyntaxError") {
16389
+ throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
16390
+ }
16391
+ throw e;
16406
16392
  }
16407
- throw e;
16408
16393
  }
16409
16394
  }
16395
+ return data;
16410
16396
  }
16411
- return data;
16412
- }],
16397
+ ],
16413
16398
  timeout: 0,
16414
16399
  xsrfCookieName: "XSRF-TOKEN",
16415
16400
  xsrfHeaderName: "X-XSRF-TOKEN",
@@ -16482,14 +16467,38 @@ var parseHeaders_default = (rawHeaders) => {
16482
16467
 
16483
16468
  // node_modules/axios/lib/core/AxiosHeaders.js
16484
16469
  var $internals = Symbol("internals");
16470
+ var isValidHeaderValue = (value) => !/[\r\n]/.test(value);
16471
+ function assertValidHeaderValue(value, header) {
16472
+ if (value === false || value == null) {
16473
+ return;
16474
+ }
16475
+ if (utils_default.isArray(value)) {
16476
+ value.forEach((v) => assertValidHeaderValue(v, header));
16477
+ return;
16478
+ }
16479
+ if (!isValidHeaderValue(String(value))) {
16480
+ throw new Error(`Invalid character in header content ["${header}"]`);
16481
+ }
16482
+ }
16485
16483
  function normalizeHeader(header) {
16486
16484
  return header && String(header).trim().toLowerCase();
16487
16485
  }
16486
+ function stripTrailingCRLF(str) {
16487
+ let end = str.length;
16488
+ while (end > 0) {
16489
+ const charCode = str.charCodeAt(end - 1);
16490
+ if (charCode !== 10 && charCode !== 13) {
16491
+ break;
16492
+ }
16493
+ end -= 1;
16494
+ }
16495
+ return end === str.length ? str : str.slice(0, end);
16496
+ }
16488
16497
  function normalizeValue(value) {
16489
16498
  if (value === false || value == null) {
16490
16499
  return value;
16491
16500
  }
16492
- return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
16501
+ return utils_default.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
16493
16502
  }
16494
16503
  function parseTokens(str) {
16495
16504
  const tokens = Object.create(null);
@@ -16547,6 +16556,7 @@ class AxiosHeaders {
16547
16556
  }
16548
16557
  const key = utils_default.findKey(self2, lHeader);
16549
16558
  if (!key || self2[key] === undefined || _rewrite === true || _rewrite === undefined && self2[key] !== false) {
16559
+ assertValidHeaderValue(_value, _header);
16550
16560
  self2[key || _header] = normalizeValue(_value);
16551
16561
  }
16552
16562
  }
@@ -16687,11 +16697,11 @@ class AxiosHeaders {
16687
16697
  accessors: {}
16688
16698
  };
16689
16699
  const accessors = internals.accessors;
16690
- const prototype3 = this.prototype;
16700
+ const prototype2 = this.prototype;
16691
16701
  function defineAccessor(_header) {
16692
16702
  const lHeader = normalizeHeader(_header);
16693
16703
  if (!accessors[lHeader]) {
16694
- buildAccessors(prototype3, _header);
16704
+ buildAccessors(prototype2, _header);
16695
16705
  accessors[lHeader] = true;
16696
16706
  }
16697
16707
  }
@@ -16699,7 +16709,14 @@ class AxiosHeaders {
16699
16709
  return this;
16700
16710
  }
16701
16711
  }
16702
- AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
16712
+ AxiosHeaders.accessor([
16713
+ "Content-Type",
16714
+ "Content-Length",
16715
+ "Accept",
16716
+ "Accept-Encoding",
16717
+ "User-Agent",
16718
+ "Authorization"
16719
+ ]);
16703
16720
  utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
16704
16721
  let mapped = key[0].toUpperCase() + key.slice(1);
16705
16722
  return {
@@ -16731,13 +16748,13 @@ function isCancel(value) {
16731
16748
  }
16732
16749
 
16733
16750
  // node_modules/axios/lib/cancel/CanceledError.js
16734
- function CanceledError(message, config, request) {
16735
- AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
16736
- this.name = "CanceledError";
16751
+ class CanceledError extends AxiosError_default {
16752
+ constructor(message, config, request) {
16753
+ super(message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
16754
+ this.name = "CanceledError";
16755
+ this.__CANCEL__ = true;
16756
+ }
16737
16757
  }
16738
- utils_default.inherits(CanceledError, AxiosError_default, {
16739
- __CANCEL__: true
16740
- });
16741
16758
  var CanceledError_default = CanceledError;
16742
16759
 
16743
16760
  // node_modules/axios/lib/core/settle.js
@@ -16752,6 +16769,9 @@ function settle(resolve, reject, response) {
16752
16769
 
16753
16770
  // node_modules/axios/lib/helpers/isAbsoluteURL.js
16754
16771
  function isAbsoluteURL(url2) {
16772
+ if (typeof url2 !== "string") {
16773
+ return false;
16774
+ }
16755
16775
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
16756
16776
  }
16757
16777
 
@@ -16769,8 +16789,74 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
16769
16789
  return requestedURL;
16770
16790
  }
16771
16791
 
16792
+ // node_modules/proxy-from-env/index.js
16793
+ var DEFAULT_PORTS = {
16794
+ ftp: 21,
16795
+ gopher: 70,
16796
+ http: 80,
16797
+ https: 443,
16798
+ ws: 80,
16799
+ wss: 443
16800
+ };
16801
+ function parseUrl(urlString) {
16802
+ try {
16803
+ return new URL(urlString);
16804
+ } catch {
16805
+ return null;
16806
+ }
16807
+ }
16808
+ function getProxyForUrl(url2) {
16809
+ var parsedUrl = (typeof url2 === "string" ? parseUrl(url2) : url2) || {};
16810
+ var proto2 = parsedUrl.protocol;
16811
+ var hostname = parsedUrl.host;
16812
+ var port = parsedUrl.port;
16813
+ if (typeof hostname !== "string" || !hostname || typeof proto2 !== "string") {
16814
+ return "";
16815
+ }
16816
+ proto2 = proto2.split(":", 1)[0];
16817
+ hostname = hostname.replace(/:\d*$/, "");
16818
+ port = parseInt(port) || DEFAULT_PORTS[proto2] || 0;
16819
+ if (!shouldProxy(hostname, port)) {
16820
+ return "";
16821
+ }
16822
+ var proxy = getEnv(proto2 + "_proxy") || getEnv("all_proxy");
16823
+ if (proxy && proxy.indexOf("://") === -1) {
16824
+ proxy = proto2 + "://" + proxy;
16825
+ }
16826
+ return proxy;
16827
+ }
16828
+ function shouldProxy(hostname, port) {
16829
+ var NO_PROXY = getEnv("no_proxy").toLowerCase();
16830
+ if (!NO_PROXY) {
16831
+ return true;
16832
+ }
16833
+ if (NO_PROXY === "*") {
16834
+ return false;
16835
+ }
16836
+ return NO_PROXY.split(/[,\s]/).every(function(proxy) {
16837
+ if (!proxy) {
16838
+ return true;
16839
+ }
16840
+ var parsedProxy = proxy.match(/^(.+):(\d+)$/);
16841
+ var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
16842
+ var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
16843
+ if (parsedProxyPort && parsedProxyPort !== port) {
16844
+ return true;
16845
+ }
16846
+ if (!/^[.*]/.test(parsedProxyHostname)) {
16847
+ return hostname !== parsedProxyHostname;
16848
+ }
16849
+ if (parsedProxyHostname.charAt(0) === "*") {
16850
+ parsedProxyHostname = parsedProxyHostname.slice(1);
16851
+ }
16852
+ return !hostname.endsWith(parsedProxyHostname);
16853
+ });
16854
+ }
16855
+ function getEnv(key) {
16856
+ return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
16857
+ }
16858
+
16772
16859
  // node_modules/axios/lib/adapters/http.js
16773
- var import_proxy_from_env = __toESM(require_proxy_from_env(), 1);
16774
16860
  var import_follow_redirects = __toESM(require_follow_redirects(), 1);
16775
16861
  import http from "http";
16776
16862
  import https from "https";
@@ -16779,7 +16865,7 @@ import util2 from "util";
16779
16865
  import zlib from "zlib";
16780
16866
 
16781
16867
  // node_modules/axios/lib/env/data.js
16782
- var VERSION = "1.13.2";
16868
+ var VERSION = "1.15.0";
16783
16869
 
16784
16870
  // node_modules/axios/lib/helpers/parseProtocol.js
16785
16871
  function parseProtocol(url2) {
@@ -17076,6 +17162,83 @@ var callbackify = (fn, reducer) => {
17076
17162
  };
17077
17163
  var callbackify_default = callbackify;
17078
17164
 
17165
+ // node_modules/axios/lib/helpers/shouldBypassProxy.js
17166
+ var DEFAULT_PORTS2 = {
17167
+ http: 80,
17168
+ https: 443,
17169
+ ws: 80,
17170
+ wss: 443,
17171
+ ftp: 21
17172
+ };
17173
+ var parseNoProxyEntry = (entry) => {
17174
+ let entryHost = entry;
17175
+ let entryPort = 0;
17176
+ if (entryHost.charAt(0) === "[") {
17177
+ const bracketIndex = entryHost.indexOf("]");
17178
+ if (bracketIndex !== -1) {
17179
+ const host = entryHost.slice(1, bracketIndex);
17180
+ const rest = entryHost.slice(bracketIndex + 1);
17181
+ if (rest.charAt(0) === ":" && /^\d+$/.test(rest.slice(1))) {
17182
+ entryPort = Number.parseInt(rest.slice(1), 10);
17183
+ }
17184
+ return [host, entryPort];
17185
+ }
17186
+ }
17187
+ const firstColon = entryHost.indexOf(":");
17188
+ const lastColon = entryHost.lastIndexOf(":");
17189
+ if (firstColon !== -1 && firstColon === lastColon && /^\d+$/.test(entryHost.slice(lastColon + 1))) {
17190
+ entryPort = Number.parseInt(entryHost.slice(lastColon + 1), 10);
17191
+ entryHost = entryHost.slice(0, lastColon);
17192
+ }
17193
+ return [entryHost, entryPort];
17194
+ };
17195
+ var normalizeNoProxyHost = (hostname) => {
17196
+ if (!hostname) {
17197
+ return hostname;
17198
+ }
17199
+ if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
17200
+ hostname = hostname.slice(1, -1);
17201
+ }
17202
+ return hostname.replace(/\.+$/, "");
17203
+ };
17204
+ function shouldBypassProxy(location) {
17205
+ let parsed;
17206
+ try {
17207
+ parsed = new URL(location);
17208
+ } catch (_err) {
17209
+ return false;
17210
+ }
17211
+ const noProxy = (process.env.no_proxy || process.env.NO_PROXY || "").toLowerCase();
17212
+ if (!noProxy) {
17213
+ return false;
17214
+ }
17215
+ if (noProxy === "*") {
17216
+ return true;
17217
+ }
17218
+ const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS2[parsed.protocol.split(":", 1)[0]] || 0;
17219
+ const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
17220
+ return noProxy.split(/[\s,]+/).some((entry) => {
17221
+ if (!entry) {
17222
+ return false;
17223
+ }
17224
+ let [entryHost, entryPort] = parseNoProxyEntry(entry);
17225
+ entryHost = normalizeNoProxyHost(entryHost);
17226
+ if (!entryHost) {
17227
+ return false;
17228
+ }
17229
+ if (entryPort && entryPort !== port) {
17230
+ return false;
17231
+ }
17232
+ if (entryHost.charAt(0) === "*") {
17233
+ entryHost = entryHost.slice(1);
17234
+ }
17235
+ if (entryHost.charAt(0) === ".") {
17236
+ return hostname.endsWith(entryHost);
17237
+ }
17238
+ return hostname === entryHost;
17239
+ });
17240
+ }
17241
+
17079
17242
  // node_modules/axios/lib/helpers/speedometer.js
17080
17243
  function speedometer(samplesCount, min) {
17081
17244
  samplesCount = samplesCount || 10;
@@ -17174,11 +17337,14 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
17174
17337
  };
17175
17338
  var progressEventDecorator = (total, throttled) => {
17176
17339
  const lengthComputable = total != null;
17177
- return [(loaded) => throttled[0]({
17178
- lengthComputable,
17179
- total,
17180
- loaded
17181
- }), throttled[1]];
17340
+ return [
17341
+ (loaded) => throttled[0]({
17342
+ lengthComputable,
17343
+ total,
17344
+ loaded
17345
+ }),
17346
+ throttled[1]
17347
+ ];
17182
17348
  };
17183
17349
  var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
17184
17350
 
@@ -17287,6 +17453,9 @@ class Http2Sessions {
17287
17453
  } else {
17288
17454
  entries.splice(i, 1);
17289
17455
  }
17456
+ if (!session.closed) {
17457
+ session.close();
17458
+ }
17290
17459
  return;
17291
17460
  }
17292
17461
  }
@@ -17315,10 +17484,7 @@ class Http2Sessions {
17315
17484
  };
17316
17485
  }
17317
17486
  session.once("close", removeSession);
17318
- let entry = [
17319
- session,
17320
- options
17321
- ];
17487
+ let entry = [session, options];
17322
17488
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
17323
17489
  return session;
17324
17490
  }
@@ -17335,9 +17501,11 @@ function dispatchBeforeRedirect(options, responseDetails) {
17335
17501
  function setProxy(options, configProxy, location) {
17336
17502
  let proxy = configProxy;
17337
17503
  if (!proxy && proxy !== false) {
17338
- const proxyUrl = import_proxy_from_env.default.getProxyForUrl(location);
17504
+ const proxyUrl = getProxyForUrl(location);
17339
17505
  if (proxyUrl) {
17340
- proxy = new URL(proxyUrl);
17506
+ if (!shouldBypassProxy(location)) {
17507
+ proxy = new URL(proxyUrl);
17508
+ }
17341
17509
  }
17342
17510
  }
17343
17511
  if (proxy) {
@@ -17345,8 +17513,11 @@ function setProxy(options, configProxy, location) {
17345
17513
  proxy.auth = (proxy.username || "") + ":" + (proxy.password || "");
17346
17514
  }
17347
17515
  if (proxy.auth) {
17348
- if (proxy.auth.username || proxy.auth.password) {
17516
+ const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
17517
+ if (validProxyAuth) {
17349
17518
  proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || "");
17519
+ } else if (typeof proxy.auth === "object") {
17520
+ throw new AxiosError_default("Invalid proxy authorization", AxiosError_default.ERR_BAD_OPTION, { proxy });
17350
17521
  }
17351
17522
  const base64 = Buffer.from(proxy.auth, "utf8").toString("base64");
17352
17523
  options.headers["Proxy-Authorization"] = "Basic " + base64;
@@ -17399,15 +17570,10 @@ var resolveFamily = ({ address, family }) => {
17399
17570
  var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
17400
17571
  var http2Transport = {
17401
17572
  request(options, cb) {
17402
- const authority = options.protocol + "//" + options.hostname + ":" + (options.port || 80);
17573
+ const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
17403
17574
  const { http2Options, headers } = options;
17404
17575
  const session = http2Sessions.getSession(authority, http2Options);
17405
- const {
17406
- HTTP2_HEADER_SCHEME,
17407
- HTTP2_HEADER_METHOD,
17408
- HTTP2_HEADER_PATH,
17409
- HTTP2_HEADER_STATUS
17410
- } = http2.constants;
17576
+ const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } = http2.constants;
17411
17577
  const http2Headers = {
17412
17578
  [HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
17413
17579
  [HTTP2_HEADER_METHOD]: options.method,
@@ -17594,9 +17760,12 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17594
17760
  if (!utils_default.isStream(data)) {
17595
17761
  data = stream3.Readable.from(data, { objectMode: false });
17596
17762
  }
17597
- data = stream3.pipeline([data, new AxiosTransformStream_default({
17598
- maxRate: utils_default.toFiniteNumber(maxUploadRate)
17599
- })], utils_default.noop);
17763
+ data = stream3.pipeline([
17764
+ data,
17765
+ new AxiosTransformStream_default({
17766
+ maxRate: utils_default.toFiniteNumber(maxUploadRate)
17767
+ })
17768
+ ], utils_default.noop);
17600
17769
  onUploadProgress && data.on("progress", flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress), false, 3))));
17601
17770
  }
17602
17771
  let auth = undefined;
@@ -17941,7 +18110,9 @@ function mergeConfig(config1, config2) {
17941
18110
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
17942
18111
  };
17943
18112
  utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
17944
- const merge2 = mergeMap[prop] || mergeDeepProperties;
18113
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype")
18114
+ return;
18115
+ const merge2 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
17945
18116
  const configValue = merge2(config1[prop], config2[prop], prop);
17946
18117
  utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
17947
18118
  });
@@ -18121,7 +18292,7 @@ var composeSignals = (signals, timeout) => {
18121
18292
  };
18122
18293
  let timer = timeout && setTimeout(() => {
18123
18294
  timer = null;
18124
- onabort(new AxiosError_default(`timeout ${timeout} of ms exceeded`, AxiosError_default.ETIMEDOUT));
18295
+ onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
18125
18296
  }, timeout);
18126
18297
  const unsubscribe = () => {
18127
18298
  if (signals) {
@@ -18225,10 +18396,7 @@ var globalFetchAPI = (({ Request, Response: Response2 }) => ({
18225
18396
  Request,
18226
18397
  Response: Response2
18227
18398
  }))(utils_default.global);
18228
- var {
18229
- ReadableStream: ReadableStream2,
18230
- TextEncoder: TextEncoder2
18231
- } = utils_default.global;
18399
+ var { ReadableStream: ReadableStream2, TextEncoder: TextEncoder2 } = utils_default.global;
18232
18400
  var test = (fn, ...args) => {
18233
18401
  try {
18234
18402
  return !!fn(...args);
@@ -18251,14 +18419,16 @@ var factory = (env2) => {
18251
18419
  const encodeText = isFetchSupported && (typeof TextEncoder2 === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder2) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
18252
18420
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
18253
18421
  let duplexAccessed = false;
18422
+ const body = new ReadableStream2;
18254
18423
  const hasContentType = new Request(platform_default.origin, {
18255
- body: new ReadableStream2,
18424
+ body,
18256
18425
  method: "POST",
18257
18426
  get duplex() {
18258
18427
  duplexAccessed = true;
18259
18428
  return "half";
18260
18429
  }
18261
18430
  }).headers.has("Content-Type");
18431
+ body.cancel();
18262
18432
  return duplexAccessed && !hasContentType;
18263
18433
  });
18264
18434
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response2("").body));
@@ -18387,11 +18557,11 @@ var factory = (env2) => {
18387
18557
  } catch (err) {
18388
18558
  unsubscribe && unsubscribe();
18389
18559
  if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
18390
- throw Object.assign(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request), {
18560
+ throw Object.assign(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request, err && err.response), {
18391
18561
  cause: err.cause || err
18392
18562
  });
18393
18563
  }
18394
- throw AxiosError_default.from(err, err && err.code, config, request);
18564
+ throw AxiosError_default.from(err, err && err.code, config, request, err && err.response);
18395
18565
  }
18396
18566
  };
18397
18567
  };
@@ -18399,11 +18569,7 @@ var seedCache = new Map;
18399
18569
  var getFetch = (config) => {
18400
18570
  let env2 = config && config.env || {};
18401
18571
  const { fetch: fetch2, Request, Response: Response2 } = env2;
18402
- const seeds = [
18403
- Request,
18404
- Response2,
18405
- fetch2
18406
- ];
18572
+ const seeds = [Request, Response2, fetch2];
18407
18573
  let len = seeds.length, i = len, seed, target, map = seedCache;
18408
18574
  while (i--) {
18409
18575
  seed = seeds[i];
@@ -18576,13 +18742,27 @@ class Axios {
18576
18742
  if (err instanceof Error) {
18577
18743
  let dummy = {};
18578
18744
  Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error;
18579
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
18745
+ const stack = (() => {
18746
+ if (!dummy.stack) {
18747
+ return "";
18748
+ }
18749
+ const firstNewlineIndex = dummy.stack.indexOf(`
18750
+ `);
18751
+ return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
18752
+ })();
18580
18753
  try {
18581
18754
  if (!err.stack) {
18582
18755
  err.stack = stack;
18583
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
18584
- err.stack += `
18756
+ } else if (stack) {
18757
+ const firstNewlineIndex = stack.indexOf(`
18758
+ `);
18759
+ const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf(`
18760
+ `, firstNewlineIndex + 1);
18761
+ const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
18762
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
18763
+ err.stack += `
18585
18764
  ` + stack;
18765
+ }
18586
18766
  }
18587
18767
  } catch (e) {}
18588
18768
  }
@@ -18602,7 +18782,8 @@ class Axios {
18602
18782
  validator_default.assertOptions(transitional2, {
18603
18783
  silentJSONParsing: validators2.transitional(validators2.boolean),
18604
18784
  forcedJSONParsing: validators2.transitional(validators2.boolean),
18605
- clarifyTimeoutError: validators2.transitional(validators2.boolean)
18785
+ clarifyTimeoutError: validators2.transitional(validators2.boolean),
18786
+ legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
18606
18787
  }, false);
18607
18788
  }
18608
18789
  if (paramsSerializer != null) {
@@ -18639,7 +18820,13 @@ class Axios {
18639
18820
  return;
18640
18821
  }
18641
18822
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
18642
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
18823
+ const transitional3 = config.transitional || transitional_default;
18824
+ const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
18825
+ if (legacyInterceptorReqResOrdering) {
18826
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
18827
+ } else {
18828
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
18829
+ }
18643
18830
  });
18644
18831
  const responseInterceptorChain = [];
18645
18832
  this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
@@ -18975,7 +19162,7 @@ function getRetryDelay(error, attempt) {
18975
19162
  function sleep(ms) {
18976
19163
  return new Promise((resolve) => setTimeout(resolve, ms));
18977
19164
  }
18978
- function createApiClient(configService, oauthService) {
19165
+ function createApiClient(credentialStore, oauthService) {
18979
19166
  const instance = axios_default.create({
18980
19167
  baseURL: BASE_URL,
18981
19168
  headers: {
@@ -18987,12 +19174,12 @@ function createApiClient(configService, oauthService) {
18987
19174
  if (process.env.DEBUG === "true") {
18988
19175
  console.debug(`[HTTP] ${config.method?.toUpperCase()} ${config.url}`);
18989
19176
  }
18990
- const authMethod = await configService.getAuthMethod();
19177
+ const authMethod = await credentialStore.getAuthMethod();
18991
19178
  if (authMethod === "oauth" && oauthService) {
18992
19179
  const accessToken = await oauthService.getValidAccessToken();
18993
19180
  config.headers.Authorization = `Bearer ${accessToken}`;
18994
19181
  } else {
18995
- const credentials = await configService.getCredentials();
19182
+ const credentials = await credentialStore.getCredentials();
18996
19183
  const authString = Buffer.from(`${credentials.username}:${credentials.apiToken}`).toString("base64");
18997
19184
  config.headers.Authorization = `Basic ${authString}`;
18998
19185
  }
@@ -19014,7 +19201,7 @@ function createApiClient(configService, oauthService) {
19014
19201
  if (error.response?.status === 401 && oauthService) {
19015
19202
  const config = error.config;
19016
19203
  if (config && !config.__tokenRefreshed) {
19017
- const authMethod = await configService.getAuthMethod();
19204
+ const authMethod = await credentialStore.getAuthMethod();
19018
19205
  if (authMethod === "oauth") {
19019
19206
  try {
19020
19207
  config.__tokenRefreshed = true;
@@ -19104,8 +19291,10 @@ function generateState() {
19104
19291
 
19105
19292
  class OAuthService {
19106
19293
  configService;
19107
- constructor(configService) {
19294
+ credentialStore;
19295
+ constructor(configService, credentialStore) {
19108
19296
  this.configService = configService;
19297
+ this.credentialStore = credentialStore;
19109
19298
  }
19110
19299
  async authorize(clientId, clientSecret) {
19111
19300
  const resolvedClientId = clientId ?? await this.getClientId();
@@ -19114,7 +19303,7 @@ class OAuthService {
19114
19303
  const { code } = await this.waitForCallback(authUrl, state);
19115
19304
  const tokenResponse = await this.exchangeCode(code, resolvedClientId, clientSecret);
19116
19305
  const expiresAt = Math.floor(Date.now() / 1000) + tokenResponse.expires_in;
19117
- await this.configService.setOAuthCredentials({
19306
+ await this.credentialStore.setOAuthCredentials({
19118
19307
  accessToken: tokenResponse.access_token,
19119
19308
  refreshToken: tokenResponse.refresh_token,
19120
19309
  expiresAt
@@ -19129,7 +19318,7 @@ class OAuthService {
19129
19318
  return userInfo;
19130
19319
  }
19131
19320
  async refreshAccessToken() {
19132
- const credentials = await this.configService.getOAuthCredentials();
19321
+ const credentials = await this.credentialStore.getOAuthCredentials();
19133
19322
  const clientId = await this.getClientId();
19134
19323
  const clientSecret = await this.getClientSecret();
19135
19324
  const params = new URLSearchParams({
@@ -19154,7 +19343,7 @@ class OAuthService {
19154
19343
  }
19155
19344
  const tokenResponse = await response.json();
19156
19345
  const expiresAt = Math.floor(Date.now() / 1000) + tokenResponse.expires_in;
19157
- await this.configService.setOAuthCredentials({
19346
+ await this.credentialStore.setOAuthCredentials({
19158
19347
  accessToken: tokenResponse.access_token,
19159
19348
  refreshToken: tokenResponse.refresh_token,
19160
19349
  expiresAt
@@ -19163,7 +19352,7 @@ class OAuthService {
19163
19352
  }
19164
19353
  async revokeToken() {
19165
19354
  try {
19166
- const credentials = await this.configService.getOAuthCredentials();
19355
+ const credentials = await this.credentialStore.getOAuthCredentials();
19167
19356
  const clientId = await this.getClientId();
19168
19357
  const clientSecret = await this.getClientSecret();
19169
19358
  const params = new URLSearchParams({
@@ -19180,11 +19369,11 @@ class OAuthService {
19180
19369
  } catch {}
19181
19370
  }
19182
19371
  async getValidAccessToken() {
19183
- const isExpired = await this.configService.isOAuthTokenExpired();
19372
+ const isExpired = await this.credentialStore.isOAuthTokenExpired();
19184
19373
  if (isExpired) {
19185
19374
  return this.refreshAccessToken();
19186
19375
  }
19187
- const credentials = await this.configService.getOAuthCredentials();
19376
+ const credentials = await this.credentialStore.getOAuthCredentials();
19188
19377
  return credentials.accessToken;
19189
19378
  }
19190
19379
  async getClientId() {
@@ -19479,21 +19668,6 @@ h1{
19479
19668
  `);
19480
19669
  }
19481
19670
  }
19482
- // src/services/workspace-resolver.ts
19483
- var NO_WORKSPACE_MESSAGE = "No workspace specified. Use --workspace option or set a default workspace with `bb config set defaultWorkspace <name>`.";
19484
- async function resolveWorkspace(configService, explicit) {
19485
- if (explicit && explicit.length > 0) {
19486
- return explicit;
19487
- }
19488
- const config = await configService.getConfig();
19489
- if (config.defaultWorkspace && config.defaultWorkspace.length > 0) {
19490
- return config.defaultWorkspace;
19491
- }
19492
- throw new BBError({
19493
- code: 6002 /* CONTEXT_WORKSPACE_NOT_FOUND */,
19494
- message: NO_WORKSPACE_MESSAGE
19495
- });
19496
- }
19497
19671
  // src/services/snippet-files.service.ts
19498
19672
  import fs6 from "fs";
19499
19673
  import path2 from "path";
@@ -19599,12 +19773,15 @@ async function updatePullRequestReviewers(pullrequestsApi, repoContext, prId, tr
19599
19773
  var DEFAULT_LIMIT = 25;
19600
19774
  var MAX_PAGE_LENGTH = 50;
19601
19775
  function parseLimit(limit, fallback = DEFAULT_LIMIT) {
19602
- if (!limit) {
19776
+ if (limit === undefined || limit === "") {
19603
19777
  return fallback;
19604
19778
  }
19605
19779
  const parsed = Number.parseInt(limit, 10);
19606
- if (Number.isNaN(parsed) || parsed <= 0) {
19607
- return fallback;
19780
+ if (!Number.isFinite(parsed) || parsed < 1) {
19781
+ throw new BBError({
19782
+ code: 5002 /* VALIDATION_INVALID */,
19783
+ message: "--limit must be a positive integer"
19784
+ });
19608
19785
  }
19609
19786
  return parsed;
19610
19787
  }
@@ -23528,14 +23705,14 @@ class BaseCommand {
23528
23705
 
23529
23706
  // src/commands/auth/login.command.ts
23530
23707
  class LoginCommand extends BaseCommand {
23531
- configService;
23708
+ credentialStore;
23532
23709
  usersApi;
23533
23710
  oauthService;
23534
23711
  name = "login";
23535
23712
  description = "Authenticate with Bitbucket";
23536
- constructor(configService, usersApi, oauthService, output) {
23713
+ constructor(credentialStore, usersApi, oauthService, output) {
23537
23714
  super(output);
23538
- this.configService = configService;
23715
+ this.credentialStore = credentialStore;
23539
23716
  this.usersApi = usersApi;
23540
23717
  this.oauthService = oauthService;
23541
23718
  }
@@ -23564,7 +23741,7 @@ class LoginCommand extends BaseCommand {
23564
23741
  }
23565
23742
  this.output.success(`Logged in as ${userInfo.displayName} (${userInfo.username})`);
23566
23743
  } catch (error) {
23567
- await this.configService.clearOAuthCredentials();
23744
+ await this.credentialStore.clearOAuthCredentials();
23568
23745
  throw error;
23569
23746
  }
23570
23747
  }
@@ -23583,8 +23760,8 @@ class LoginCommand extends BaseCommand {
23583
23760
  message: "API token is required. Use --password option or set BB_API_TOKEN environment variable."
23584
23761
  });
23585
23762
  }
23586
- await this.configService.clearOAuthCredentials();
23587
- await this.configService.setCredentials({ username, apiToken });
23763
+ await this.credentialStore.clearOAuthCredentials();
23764
+ await this.credentialStore.setCredentials({ username, apiToken });
23588
23765
  try {
23589
23766
  const response = await this.usersApi.userGet();
23590
23767
  const user = response.data;
@@ -23602,7 +23779,7 @@ class LoginCommand extends BaseCommand {
23602
23779
  }
23603
23780
  this.output.success(`Logged in as ${user.display_name} (${user.username})`);
23604
23781
  } catch (error) {
23605
- await this.configService.clearCredentials();
23782
+ await this.credentialStore.clearCredentials();
23606
23783
  throw new BBError({
23607
23784
  code: 1002 /* AUTH_INVALID */,
23608
23785
  message: `Authentication failed: ${error instanceof Error ? error.message : String(error)}`
@@ -23613,22 +23790,22 @@ class LoginCommand extends BaseCommand {
23613
23790
 
23614
23791
  // src/commands/auth/logout.command.ts
23615
23792
  class LogoutCommand extends BaseCommand {
23616
- configService;
23793
+ credentialStore;
23617
23794
  oauthService;
23618
23795
  name = "logout";
23619
23796
  description = "Log out of Bitbucket";
23620
- constructor(configService, oauthService, output) {
23797
+ constructor(credentialStore, oauthService, output) {
23621
23798
  super(output);
23622
- this.configService = configService;
23799
+ this.credentialStore = credentialStore;
23623
23800
  this.oauthService = oauthService;
23624
23801
  }
23625
23802
  async execute(_options, context) {
23626
- const authMethod = await this.configService.getAuthMethod();
23803
+ const authMethod = await this.credentialStore.getAuthMethod();
23627
23804
  if (authMethod === "oauth") {
23628
23805
  await this.oauthService.revokeToken();
23629
- await this.configService.clearOAuthCredentials();
23806
+ await this.credentialStore.clearOAuthCredentials();
23630
23807
  } else {
23631
- await this.configService.clearCredentials();
23808
+ await this.credentialStore.clearCredentials();
23632
23809
  }
23633
23810
  if (context.globalOptions.json) {
23634
23811
  this.output.json({ authenticated: false, success: true });
@@ -23641,17 +23818,19 @@ class LogoutCommand extends BaseCommand {
23641
23818
  // src/commands/auth/status.command.ts
23642
23819
  class StatusCommand extends BaseCommand {
23643
23820
  configService;
23821
+ credentialStore;
23644
23822
  usersApi;
23645
23823
  name = "status";
23646
23824
  description = "Show authentication status";
23647
- constructor(configService, usersApi, output) {
23825
+ constructor(configService, credentialStore, usersApi, output) {
23648
23826
  super(output);
23649
23827
  this.configService = configService;
23828
+ this.credentialStore = credentialStore;
23650
23829
  this.usersApi = usersApi;
23651
23830
  }
23652
23831
  async execute(_options, context) {
23653
23832
  const config = await this.configService.getConfig();
23654
- const authMethod = await this.configService.getAuthMethod();
23833
+ const authMethod = await this.credentialStore.getAuthMethod();
23655
23834
  const hasBasicAuth = config.username && config.apiToken;
23656
23835
  const hasOAuth = config.oauthAccessToken && config.oauthRefreshToken;
23657
23836
  if (!hasBasicAuth && !hasOAuth) {
@@ -23717,17 +23896,17 @@ class StatusCommand extends BaseCommand {
23717
23896
 
23718
23897
  // src/commands/auth/token.command.ts
23719
23898
  class TokenCommand extends BaseCommand {
23720
- configService;
23899
+ credentialStore;
23721
23900
  oauthService;
23722
23901
  name = "token";
23723
23902
  description = "Print the current access token";
23724
- constructor(configService, oauthService, output) {
23903
+ constructor(credentialStore, oauthService, output) {
23725
23904
  super(output);
23726
- this.configService = configService;
23905
+ this.credentialStore = credentialStore;
23727
23906
  this.oauthService = oauthService;
23728
23907
  }
23729
23908
  async execute(_options, context) {
23730
- const authMethod = await this.configService.getAuthMethod();
23909
+ const authMethod = await this.credentialStore.getAuthMethod();
23731
23910
  if (authMethod === "oauth") {
23732
23911
  const accessToken = await this.oauthService.getValidAccessToken();
23733
23912
  if (context.globalOptions.json) {
@@ -23737,7 +23916,7 @@ class TokenCommand extends BaseCommand {
23737
23916
  this.output.text(accessToken);
23738
23917
  return;
23739
23918
  }
23740
- const credentials = await this.configService.getCredentials();
23919
+ const credentials = await this.credentialStore.getCredentials();
23741
23920
  if (!credentials.username || !credentials.apiToken) {
23742
23921
  throw new BBError({
23743
23922
  code: 1001 /* AUTH_REQUIRED */,
@@ -23756,13 +23935,13 @@ class TokenCommand extends BaseCommand {
23756
23935
  // src/commands/repo/clone.command.ts
23757
23936
  class CloneCommand extends BaseCommand {
23758
23937
  gitService;
23759
- configService;
23938
+ contextService;
23760
23939
  name = "clone";
23761
23940
  description = "Clone a Bitbucket repository";
23762
- constructor(gitService, configService, output) {
23941
+ constructor(gitService, contextService, output) {
23763
23942
  super(output);
23764
23943
  this.gitService = gitService;
23765
- this.configService = configService;
23944
+ this.contextService = contextService;
23766
23945
  }
23767
23946
  async execute(options, context) {
23768
23947
  const { repository, directory } = options;
@@ -23788,7 +23967,7 @@ class CloneCommand extends BaseCommand {
23788
23967
  let workspace;
23789
23968
  let repoSlug;
23790
23969
  if (parts.length === 1) {
23791
- workspace = await resolveWorkspace(this.configService);
23970
+ workspace = await this.contextService.requireWorkspace();
23792
23971
  repoSlug = parts[0];
23793
23972
  } else if (parts.length === 2) {
23794
23973
  workspace = parts[0];
@@ -24101,19 +24280,19 @@ function parsePullrequestActivitiesPage(data) {
24101
24280
  // src/commands/repo/create.command.ts
24102
24281
  class CreateRepoCommand extends BaseCommand {
24103
24282
  repositoriesApi;
24104
- configService;
24283
+ contextService;
24105
24284
  name = "create";
24106
24285
  description = "Create a new repository";
24107
- constructor(repositoriesApi, configService, output) {
24286
+ constructor(repositoriesApi, contextService, output) {
24108
24287
  super(output);
24109
24288
  this.repositoriesApi = repositoriesApi;
24110
- this.configService = configService;
24289
+ this.contextService = contextService;
24111
24290
  }
24112
24291
  async execute(options, context) {
24113
24292
  const { description, project } = options;
24114
24293
  const name = this.requireOption(options.name, "name");
24115
24294
  const isPublic = options.public === true;
24116
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
24295
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
24117
24296
  const request = {
24118
24297
  type: "repository",
24119
24298
  scm: "git",
@@ -24149,16 +24328,16 @@ class CreateRepoCommand extends BaseCommand {
24149
24328
  // src/commands/repo/list.command.ts
24150
24329
  class ListReposCommand extends BaseCommand {
24151
24330
  repositoriesApi;
24152
- configService;
24331
+ contextService;
24153
24332
  name = "list";
24154
24333
  description = "List repositories";
24155
- constructor(repositoriesApi, configService, output) {
24334
+ constructor(repositoriesApi, contextService, output) {
24156
24335
  super(output);
24157
24336
  this.repositoriesApi = repositoriesApi;
24158
- this.configService = configService;
24337
+ this.contextService = contextService;
24159
24338
  }
24160
24339
  async execute(options, context) {
24161
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
24340
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
24162
24341
  const limit = parseLimit(options.limit);
24163
24342
  const repos = await collectPages({
24164
24343
  limit,
@@ -24555,6 +24734,9 @@ class CreatePRCommand extends BaseCommand {
24555
24734
  }
24556
24735
  }
24557
24736
 
24737
+ // src/types/pr.ts
24738
+ var PR_STATES = ["OPEN", "MERGED", "DECLINED", "SUPERSEDED"];
24739
+
24558
24740
  // src/commands/pr/list.command.ts
24559
24741
  class ListPRsCommand extends BaseCommand {
24560
24742
  pullrequestsApi;
@@ -24573,13 +24755,7 @@ class ListPRsCommand extends BaseCommand {
24573
24755
  ...context.globalOptions,
24574
24756
  ...options
24575
24757
  });
24576
- const ALLOWED_STATES = [
24577
- "OPEN",
24578
- "MERGED",
24579
- "DECLINED",
24580
- "SUPERSEDED"
24581
- ];
24582
- const state = options.state ? this.parseEnumOption(options.state, "state", ALLOWED_STATES) : "OPEN";
24758
+ const state = options.state ? this.parseEnumOption(options.state, "state", PR_STATES) : "OPEN";
24583
24759
  const limit = parseLimit(options.limit);
24584
24760
  const reviewerQuery = options.mine ? await this.buildMineFilter() : undefined;
24585
24761
  const values = await collectPages({
@@ -26002,16 +26178,16 @@ var VALID_ROLES = Object.values(SnippetsWorkspaceGetRoleEnum);
26002
26178
 
26003
26179
  class ListSnippetsCommand extends BaseCommand {
26004
26180
  snippetsApi;
26005
- configService;
26181
+ contextService;
26006
26182
  name = "list";
26007
26183
  description = "List snippets";
26008
- constructor(snippetsApi, configService, output) {
26184
+ constructor(snippetsApi, contextService, output) {
26009
26185
  super(output);
26010
26186
  this.snippetsApi = snippetsApi;
26011
- this.configService = configService;
26187
+ this.contextService = contextService;
26012
26188
  }
26013
26189
  async execute(options, context) {
26014
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26190
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26015
26191
  const limit = parseLimit(options.limit);
26016
26192
  const role = options.role ? this.parseEnumOption(options.role, "role", VALID_ROLES) : undefined;
26017
26193
  const snippets = await collectPages({
@@ -26053,17 +26229,17 @@ class ListSnippetsCommand extends BaseCommand {
26053
26229
  class ViewSnippetCommand extends BaseCommand {
26054
26230
  snippetsApi;
26055
26231
  snippetFilesService;
26056
- configService;
26232
+ contextService;
26057
26233
  name = "view";
26058
26234
  description = "View snippet details";
26059
- constructor(snippetsApi, snippetFilesService, configService, output) {
26235
+ constructor(snippetsApi, snippetFilesService, contextService, output) {
26060
26236
  super(output);
26061
26237
  this.snippetsApi = snippetsApi;
26062
26238
  this.snippetFilesService = snippetFilesService;
26063
- this.configService = configService;
26239
+ this.contextService = contextService;
26064
26240
  }
26065
26241
  async execute(options, context) {
26066
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26242
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26067
26243
  const response = await this.snippetsApi.snippetsWorkspaceEncodedIdGet({
26068
26244
  workspace,
26069
26245
  encodedId: options.id
@@ -26099,7 +26275,7 @@ class ViewSnippetCommand extends BaseCommand {
26099
26275
  for (const name of fileNames) {
26100
26276
  this.output.text("");
26101
26277
  this.output.text(this.output.bold(`\u2500\u2500 ${name} \u2500\u2500`));
26102
- this.output.text(contents[name]);
26278
+ this.output.text(contents[name] ?? "");
26103
26279
  }
26104
26280
  return;
26105
26281
  }
@@ -26155,16 +26331,16 @@ class ViewSnippetCommand extends BaseCommand {
26155
26331
  import fs8 from "fs";
26156
26332
  class CreateSnippetCommand extends BaseCommand {
26157
26333
  snippetFilesService;
26158
- configService;
26334
+ contextService;
26159
26335
  name = "create";
26160
26336
  description = "Create a snippet";
26161
- constructor(snippetFilesService, configService, output) {
26337
+ constructor(snippetFilesService, contextService, output) {
26162
26338
  super(output);
26163
26339
  this.snippetFilesService = snippetFilesService;
26164
- this.configService = configService;
26340
+ this.contextService = contextService;
26165
26341
  }
26166
26342
  async execute(options, context) {
26167
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26343
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26168
26344
  const title = this.requireOption(options.title, "title", "Snippet title is required. Use --title option.");
26169
26345
  if (!options.file || options.file.length === 0) {
26170
26346
  throw new BBError({
@@ -26211,16 +26387,16 @@ class CreateSnippetCommand extends BaseCommand {
26211
26387
  import fs9 from "fs";
26212
26388
  class EditSnippetCommand extends BaseCommand {
26213
26389
  snippetFilesService;
26214
- configService;
26390
+ contextService;
26215
26391
  name = "edit";
26216
26392
  description = "Edit a snippet";
26217
- constructor(snippetFilesService, configService, output) {
26393
+ constructor(snippetFilesService, contextService, output) {
26218
26394
  super(output);
26219
26395
  this.snippetFilesService = snippetFilesService;
26220
- this.configService = configService;
26396
+ this.contextService = contextService;
26221
26397
  }
26222
26398
  async execute(options, context) {
26223
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26399
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26224
26400
  const hasTitle = options.title !== undefined;
26225
26401
  const hasVisibility = options.private !== undefined || options.public !== undefined;
26226
26402
  const hasFiles = options.file !== undefined && options.file.length > 0;
@@ -26271,16 +26447,16 @@ class EditSnippetCommand extends BaseCommand {
26271
26447
  // src/commands/snippet/delete.command.ts
26272
26448
  class DeleteSnippetCommand extends BaseCommand {
26273
26449
  snippetsApi;
26274
- configService;
26450
+ contextService;
26275
26451
  name = "delete";
26276
26452
  description = "Delete a snippet";
26277
- constructor(snippetsApi, configService, output) {
26453
+ constructor(snippetsApi, contextService, output) {
26278
26454
  super(output);
26279
26455
  this.snippetsApi = snippetsApi;
26280
- this.configService = configService;
26456
+ this.contextService = contextService;
26281
26457
  }
26282
26458
  async execute(options, context) {
26283
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26459
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26284
26460
  if (!options.yes) {
26285
26461
  throw new BBError({
26286
26462
  code: 5001 /* VALIDATION_REQUIRED */,
@@ -26307,16 +26483,16 @@ class DeleteSnippetCommand extends BaseCommand {
26307
26483
  // src/commands/snippet/watch.command.ts
26308
26484
  class WatchSnippetCommand extends BaseCommand {
26309
26485
  snippetsApi;
26310
- configService;
26486
+ contextService;
26311
26487
  name = "watch";
26312
26488
  description = "Watch a snippet";
26313
- constructor(snippetsApi, configService, output) {
26489
+ constructor(snippetsApi, contextService, output) {
26314
26490
  super(output);
26315
26491
  this.snippetsApi = snippetsApi;
26316
- this.configService = configService;
26492
+ this.contextService = contextService;
26317
26493
  }
26318
26494
  async execute(options, context) {
26319
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26495
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26320
26496
  await this.snippetsApi.snippetsWorkspaceEncodedIdWatchPut({
26321
26497
  workspace,
26322
26498
  encodedId: options.id
@@ -26336,16 +26512,16 @@ class WatchSnippetCommand extends BaseCommand {
26336
26512
  // src/commands/snippet/unwatch.command.ts
26337
26513
  class UnwatchSnippetCommand extends BaseCommand {
26338
26514
  snippetsApi;
26339
- configService;
26515
+ contextService;
26340
26516
  name = "unwatch";
26341
26517
  description = "Stop watching a snippet";
26342
- constructor(snippetsApi, configService, output) {
26518
+ constructor(snippetsApi, contextService, output) {
26343
26519
  super(output);
26344
26520
  this.snippetsApi = snippetsApi;
26345
- this.configService = configService;
26521
+ this.contextService = contextService;
26346
26522
  }
26347
26523
  async execute(options, context) {
26348
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26524
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26349
26525
  await this.snippetsApi.snippetsWorkspaceEncodedIdWatchDelete({
26350
26526
  workspace,
26351
26527
  encodedId: options.id
@@ -26365,16 +26541,16 @@ class UnwatchSnippetCommand extends BaseCommand {
26365
26541
  // src/commands/snippet/comments.list.command.ts
26366
26542
  class ListSnippetCommentsCommand extends BaseCommand {
26367
26543
  snippetsApi;
26368
- configService;
26544
+ contextService;
26369
26545
  name = "list";
26370
26546
  description = "List comments on a snippet";
26371
- constructor(snippetsApi, configService, output) {
26547
+ constructor(snippetsApi, contextService, output) {
26372
26548
  super(output);
26373
26549
  this.snippetsApi = snippetsApi;
26374
- this.configService = configService;
26550
+ this.contextService = contextService;
26375
26551
  }
26376
26552
  async execute(options, context) {
26377
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26553
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26378
26554
  const limit = parseLimit(options.limit);
26379
26555
  const comments = await collectPages({
26380
26556
  limit,
@@ -26401,8 +26577,7 @@ class ListSnippetCommentsCommand extends BaseCommand {
26401
26577
  this.output.info("No comments found on this snippet");
26402
26578
  return;
26403
26579
  }
26404
- const record = comments;
26405
- const rows = record.map((comment) => {
26580
+ const rows = comments.map((comment) => {
26406
26581
  const content = getRawContent(comment.content) ?? "";
26407
26582
  return [
26408
26583
  String(comment.id ?? ""),
@@ -26418,16 +26593,16 @@ class ListSnippetCommentsCommand extends BaseCommand {
26418
26593
  // src/commands/snippet/comments.add.command.ts
26419
26594
  class AddSnippetCommentCommand extends BaseCommand {
26420
26595
  snippetsApi;
26421
- configService;
26596
+ contextService;
26422
26597
  name = "add";
26423
26598
  description = "Add a comment to a snippet";
26424
- constructor(snippetsApi, configService, output) {
26599
+ constructor(snippetsApi, contextService, output) {
26425
26600
  super(output);
26426
26601
  this.snippetsApi = snippetsApi;
26427
- this.configService = configService;
26602
+ this.contextService = contextService;
26428
26603
  }
26429
26604
  async execute(options, context) {
26430
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26605
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26431
26606
  const message = this.requireOption(options.message, "message", "Comment message is required. Use --message option.");
26432
26607
  const body = {
26433
26608
  type: "snippet_comment",
@@ -26457,16 +26632,16 @@ class AddSnippetCommentCommand extends BaseCommand {
26457
26632
  // src/commands/snippet/comments.edit.command.ts
26458
26633
  class EditSnippetCommentCommand extends BaseCommand {
26459
26634
  snippetsApi;
26460
- configService;
26635
+ contextService;
26461
26636
  name = "edit";
26462
26637
  description = "Edit a comment on a snippet";
26463
- constructor(snippetsApi, configService, output) {
26638
+ constructor(snippetsApi, contextService, output) {
26464
26639
  super(output);
26465
26640
  this.snippetsApi = snippetsApi;
26466
- this.configService = configService;
26641
+ this.contextService = contextService;
26467
26642
  }
26468
26643
  async execute(options, context) {
26469
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26644
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26470
26645
  const commentId = this.parseIntOption(options.commentId, "comment-id");
26471
26646
  const body = {
26472
26647
  type: "snippet_comment",
@@ -26495,16 +26670,16 @@ class EditSnippetCommentCommand extends BaseCommand {
26495
26670
  // src/commands/snippet/comments.delete.command.ts
26496
26671
  class DeleteSnippetCommentCommand extends BaseCommand {
26497
26672
  snippetsApi;
26498
- configService;
26673
+ contextService;
26499
26674
  name = "delete";
26500
26675
  description = "Delete a comment on a snippet";
26501
- constructor(snippetsApi, configService, output) {
26676
+ constructor(snippetsApi, contextService, output) {
26502
26677
  super(output);
26503
26678
  this.snippetsApi = snippetsApi;
26504
- this.configService = configService;
26679
+ this.contextService = contextService;
26505
26680
  }
26506
26681
  async execute(options, context) {
26507
- const workspace = await resolveWorkspace(this.configService, options.workspace ?? context.globalOptions.workspace);
26682
+ const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
26508
26683
  const commentId = this.parseIntOption(options.commentId, "comment-id");
26509
26684
  if (!options.yes) {
26510
26685
  throw new BBError({
@@ -26738,350 +26913,285 @@ class UninstallCompletionCommand extends BaseCommand {
26738
26913
  // src/bootstrap.ts
26739
26914
  var require2 = createRequire(import.meta.url);
26740
26915
  var pkg = require2("../package.json");
26916
+ function registerApiClient(container, token, ctor) {
26917
+ container.register(token, () => {
26918
+ const credentialStore = container.resolve(ServiceTokens.CredentialStore);
26919
+ const oauthService = container.resolve(ServiceTokens.OAuthService);
26920
+ const axiosInstance = createApiClient(credentialStore, oauthService);
26921
+ return new ctor(undefined, undefined, axiosInstance);
26922
+ });
26923
+ }
26924
+ function registerCommand(container, token, ctor, deps) {
26925
+ container.register(token, () => {
26926
+ const resolved = deps.map((dep) => container.resolve(dep));
26927
+ return new ctor(...resolved);
26928
+ });
26929
+ }
26741
26930
  function bootstrap(options = {}) {
26742
26931
  const container = Container.getInstance();
26743
26932
  container.register(ServiceTokens.ConfigService, () => new ConfigService);
26933
+ container.register(ServiceTokens.CredentialStore, () => container.resolve(ServiceTokens.ConfigService));
26744
26934
  container.register(ServiceTokens.GitService, () => new GitService);
26745
26935
  container.register(ServiceTokens.OutputService, () => new OutputService({ noColor: options.noColor }));
26746
- container.register(ServiceTokens.OAuthService, () => {
26747
- const configService = container.resolve(ServiceTokens.ConfigService);
26748
- return new OAuthService(configService);
26749
- });
26750
- container.register(ServiceTokens.PullrequestsApi, () => {
26751
- const configService = container.resolve(ServiceTokens.ConfigService);
26752
- const oauthService = container.resolve(ServiceTokens.OAuthService);
26753
- const axiosInstance = createApiClient(configService, oauthService);
26754
- return new PullrequestsApi(undefined, undefined, axiosInstance);
26755
- });
26756
- container.register(ServiceTokens.RepositoriesApi, () => {
26757
- const configService = container.resolve(ServiceTokens.ConfigService);
26758
- const oauthService = container.resolve(ServiceTokens.OAuthService);
26759
- const axiosInstance = createApiClient(configService, oauthService);
26760
- return new RepositoriesApi(undefined, undefined, axiosInstance);
26761
- });
26762
- container.register(ServiceTokens.UsersApi, () => {
26763
- const configService = container.resolve(ServiceTokens.ConfigService);
26764
- const oauthService = container.resolve(ServiceTokens.OAuthService);
26765
- const axiosInstance = createApiClient(configService, oauthService);
26766
- return new UsersApi(undefined, undefined, axiosInstance);
26767
- });
26768
- container.register(ServiceTokens.CommitStatusesApi, () => {
26769
- const configService = container.resolve(ServiceTokens.ConfigService);
26770
- const oauthService = container.resolve(ServiceTokens.OAuthService);
26771
- const axiosInstance = createApiClient(configService, oauthService);
26772
- return new CommitStatusesApi(undefined, undefined, axiosInstance);
26773
- });
26936
+ registerCommand(container, ServiceTokens.OAuthService, OAuthService, [
26937
+ ServiceTokens.ConfigService,
26938
+ ServiceTokens.CredentialStore
26939
+ ]);
26940
+ registerCommand(container, ServiceTokens.ContextService, ContextService, [
26941
+ ServiceTokens.GitService,
26942
+ ServiceTokens.ConfigService
26943
+ ]);
26944
+ registerApiClient(container, ServiceTokens.PullrequestsApi, PullrequestsApi);
26945
+ registerApiClient(container, ServiceTokens.RepositoriesApi, RepositoriesApi);
26946
+ registerApiClient(container, ServiceTokens.UsersApi, UsersApi);
26947
+ registerApiClient(container, ServiceTokens.CommitStatusesApi, CommitStatusesApi);
26774
26948
  container.register(ServiceTokens.SnippetsAxios, () => {
26775
- const configService = container.resolve(ServiceTokens.ConfigService);
26949
+ const credentialStore = container.resolve(ServiceTokens.CredentialStore);
26776
26950
  const oauthService = container.resolve(ServiceTokens.OAuthService);
26777
- return createApiClient(configService, oauthService);
26951
+ return createApiClient(credentialStore, oauthService);
26778
26952
  });
26779
26953
  container.register(ServiceTokens.SnippetsApi, () => {
26780
26954
  const axiosInstance = container.resolve(ServiceTokens.SnippetsAxios);
26781
26955
  return new SnippetsApi(undefined, undefined, axiosInstance);
26782
26956
  });
26783
- container.register(ServiceTokens.SnippetFilesService, () => {
26784
- const axiosInstance = container.resolve(ServiceTokens.SnippetsAxios);
26785
- return new SnippetFilesService(axiosInstance);
26786
- });
26787
- container.register(ServiceTokens.ContextService, () => {
26788
- const gitService = container.resolve(ServiceTokens.GitService);
26789
- const configService = container.resolve(ServiceTokens.ConfigService);
26790
- return new ContextService(gitService, configService);
26791
- });
26792
- container.register(ServiceTokens.LoginCommand, () => {
26793
- const configService = container.resolve(ServiceTokens.ConfigService);
26794
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26795
- const oauthService = container.resolve(ServiceTokens.OAuthService);
26796
- const output = container.resolve(ServiceTokens.OutputService);
26797
- return new LoginCommand(configService, usersApi, oauthService, output);
26798
- });
26799
- container.register(ServiceTokens.LogoutCommand, () => {
26800
- const configService = container.resolve(ServiceTokens.ConfigService);
26801
- const oauthService = container.resolve(ServiceTokens.OAuthService);
26802
- const output = container.resolve(ServiceTokens.OutputService);
26803
- return new LogoutCommand(configService, oauthService, output);
26804
- });
26805
- container.register(ServiceTokens.StatusCommand, () => {
26806
- const configService = container.resolve(ServiceTokens.ConfigService);
26807
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26808
- const output = container.resolve(ServiceTokens.OutputService);
26809
- return new StatusCommand(configService, usersApi, output);
26810
- });
26811
- container.register(ServiceTokens.TokenCommand, () => {
26812
- const configService = container.resolve(ServiceTokens.ConfigService);
26813
- const oauthService = container.resolve(ServiceTokens.OAuthService);
26814
- const output = container.resolve(ServiceTokens.OutputService);
26815
- return new TokenCommand(configService, oauthService, output);
26816
- });
26817
- container.register(ServiceTokens.CloneCommand, () => {
26818
- const gitService = container.resolve(ServiceTokens.GitService);
26819
- const configService = container.resolve(ServiceTokens.ConfigService);
26820
- const output = container.resolve(ServiceTokens.OutputService);
26821
- return new CloneCommand(gitService, configService, output);
26822
- });
26823
- container.register(ServiceTokens.CreateRepoCommand, () => {
26824
- const repositoriesApi = container.resolve(ServiceTokens.RepositoriesApi);
26825
- const configService = container.resolve(ServiceTokens.ConfigService);
26826
- const output = container.resolve(ServiceTokens.OutputService);
26827
- return new CreateRepoCommand(repositoriesApi, configService, output);
26828
- });
26829
- container.register(ServiceTokens.ListReposCommand, () => {
26830
- const repositoriesApi = container.resolve(ServiceTokens.RepositoriesApi);
26831
- const configService = container.resolve(ServiceTokens.ConfigService);
26832
- const output = container.resolve(ServiceTokens.OutputService);
26833
- return new ListReposCommand(repositoriesApi, configService, output);
26834
- });
26835
- container.register(ServiceTokens.ViewRepoCommand, () => {
26836
- const repositoriesApi = container.resolve(ServiceTokens.RepositoriesApi);
26837
- const contextService = container.resolve(ServiceTokens.ContextService);
26838
- const output = container.resolve(ServiceTokens.OutputService);
26839
- return new ViewRepoCommand(repositoriesApi, contextService, output);
26840
- });
26841
- container.register(ServiceTokens.DeleteRepoCommand, () => {
26842
- const repositoriesApi = container.resolve(ServiceTokens.RepositoriesApi);
26843
- const contextService = container.resolve(ServiceTokens.ContextService);
26844
- const output = container.resolve(ServiceTokens.OutputService);
26845
- return new DeleteRepoCommand(repositoriesApi, contextService, output);
26846
- });
26847
- container.register(ServiceTokens.DefaultReviewerService, () => {
26848
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26849
- return new DefaultReviewerService(pullrequestsApi);
26850
- });
26851
- container.register(ServiceTokens.ListDefaultReviewersCommand, () => {
26852
- const service = container.resolve(ServiceTokens.DefaultReviewerService);
26853
- const contextService = container.resolve(ServiceTokens.ContextService);
26854
- const output = container.resolve(ServiceTokens.OutputService);
26855
- return new ListDefaultReviewersCommand(service, contextService, output);
26856
- });
26857
- container.register(ServiceTokens.AddDefaultReviewerCommand, () => {
26858
- const service = container.resolve(ServiceTokens.DefaultReviewerService);
26859
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26860
- const contextService = container.resolve(ServiceTokens.ContextService);
26861
- const output = container.resolve(ServiceTokens.OutputService);
26862
- return new AddDefaultReviewerCommand(service, usersApi, contextService, output);
26863
- });
26864
- container.register(ServiceTokens.RemoveDefaultReviewerCommand, () => {
26865
- const service = container.resolve(ServiceTokens.DefaultReviewerService);
26866
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26867
- const contextService = container.resolve(ServiceTokens.ContextService);
26868
- const output = container.resolve(ServiceTokens.OutputService);
26869
- return new RemoveDefaultReviewerCommand(service, usersApi, contextService, output);
26870
- });
26871
- container.register(ServiceTokens.CreatePRCommand, () => {
26872
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26873
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26874
- const contextService = container.resolve(ServiceTokens.ContextService);
26875
- const gitService = container.resolve(ServiceTokens.GitService);
26876
- const defaultReviewerService = container.resolve(ServiceTokens.DefaultReviewerService);
26877
- const configService = container.resolve(ServiceTokens.ConfigService);
26878
- const output = container.resolve(ServiceTokens.OutputService);
26879
- return new CreatePRCommand(pullrequestsApi, usersApi, contextService, gitService, defaultReviewerService, configService, output);
26880
- });
26881
- container.register(ServiceTokens.ListPRsCommand, () => {
26882
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26883
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26884
- const contextService = container.resolve(ServiceTokens.ContextService);
26885
- const output = container.resolve(ServiceTokens.OutputService);
26886
- return new ListPRsCommand(pullrequestsApi, usersApi, contextService, output);
26887
- });
26888
- container.register(ServiceTokens.ViewPRCommand, () => {
26889
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26890
- const contextService = container.resolve(ServiceTokens.ContextService);
26891
- const output = container.resolve(ServiceTokens.OutputService);
26892
- return new ViewPRCommand(pullrequestsApi, contextService, output);
26893
- });
26894
- container.register(ServiceTokens.EditPRCommand, () => {
26895
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26896
- const contextService = container.resolve(ServiceTokens.ContextService);
26897
- const gitService = container.resolve(ServiceTokens.GitService);
26898
- const output = container.resolve(ServiceTokens.OutputService);
26899
- return new EditPRCommand(pullrequestsApi, contextService, gitService, output);
26900
- });
26901
- container.register(ServiceTokens.MergePRCommand, () => {
26902
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26903
- const contextService = container.resolve(ServiceTokens.ContextService);
26904
- const output = container.resolve(ServiceTokens.OutputService);
26905
- return new MergePRCommand(pullrequestsApi, contextService, output);
26906
- });
26907
- container.register(ServiceTokens.ApprovePRCommand, () => {
26908
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26909
- const contextService = container.resolve(ServiceTokens.ContextService);
26910
- const output = container.resolve(ServiceTokens.OutputService);
26911
- return new ApprovePRCommand(pullrequestsApi, contextService, output);
26912
- });
26913
- container.register(ServiceTokens.DeclinePRCommand, () => {
26914
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26915
- const contextService = container.resolve(ServiceTokens.ContextService);
26916
- const output = container.resolve(ServiceTokens.OutputService);
26917
- return new DeclinePRCommand(pullrequestsApi, contextService, output);
26918
- });
26919
- container.register(ServiceTokens.ReadyPRCommand, () => {
26920
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26921
- const contextService = container.resolve(ServiceTokens.ContextService);
26922
- const output = container.resolve(ServiceTokens.OutputService);
26923
- return new ReadyPRCommand(pullrequestsApi, contextService, output);
26924
- });
26925
- container.register(ServiceTokens.CheckoutPRCommand, () => {
26926
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26927
- const contextService = container.resolve(ServiceTokens.ContextService);
26928
- const gitService = container.resolve(ServiceTokens.GitService);
26929
- const output = container.resolve(ServiceTokens.OutputService);
26930
- return new CheckoutPRCommand(pullrequestsApi, contextService, gitService, output);
26931
- });
26932
- container.register(ServiceTokens.DiffPRCommand, () => {
26933
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26934
- const contextService = container.resolve(ServiceTokens.ContextService);
26935
- const gitService = container.resolve(ServiceTokens.GitService);
26936
- const output = container.resolve(ServiceTokens.OutputService);
26937
- return new DiffPRCommand(pullrequestsApi, contextService, gitService, output);
26938
- });
26939
- container.register(ServiceTokens.ActivityPRCommand, () => {
26940
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26941
- const contextService = container.resolve(ServiceTokens.ContextService);
26942
- const output = container.resolve(ServiceTokens.OutputService);
26943
- return new ActivityPRCommand(pullrequestsApi, contextService, output);
26944
- });
26945
- container.register(ServiceTokens.CommentPRCommand, () => {
26946
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26947
- const contextService = container.resolve(ServiceTokens.ContextService);
26948
- const output = container.resolve(ServiceTokens.OutputService);
26949
- return new CommentPRCommand(pullrequestsApi, contextService, output);
26950
- });
26951
- container.register(ServiceTokens.ListCommentsPRCommand, () => {
26952
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26953
- const contextService = container.resolve(ServiceTokens.ContextService);
26954
- const output = container.resolve(ServiceTokens.OutputService);
26955
- return new ListCommentsPRCommand(pullrequestsApi, contextService, output);
26956
- });
26957
- container.register(ServiceTokens.EditCommentPRCommand, () => {
26958
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26959
- const contextService = container.resolve(ServiceTokens.ContextService);
26960
- const output = container.resolve(ServiceTokens.OutputService);
26961
- return new EditCommentPRCommand(pullrequestsApi, contextService, output);
26962
- });
26963
- container.register(ServiceTokens.DeleteCommentPRCommand, () => {
26964
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26965
- const contextService = container.resolve(ServiceTokens.ContextService);
26966
- const output = container.resolve(ServiceTokens.OutputService);
26967
- return new DeleteCommentPRCommand(pullrequestsApi, contextService, output);
26968
- });
26969
- container.register(ServiceTokens.AddReviewerPRCommand, () => {
26970
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26971
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26972
- const contextService = container.resolve(ServiceTokens.ContextService);
26973
- const output = container.resolve(ServiceTokens.OutputService);
26974
- return new AddReviewerPRCommand(pullrequestsApi, usersApi, contextService, output);
26975
- });
26976
- container.register(ServiceTokens.RemoveReviewerPRCommand, () => {
26977
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26978
- const usersApi = container.resolve(ServiceTokens.UsersApi);
26979
- const contextService = container.resolve(ServiceTokens.ContextService);
26980
- const output = container.resolve(ServiceTokens.OutputService);
26981
- return new RemoveReviewerPRCommand(pullrequestsApi, usersApi, contextService, output);
26982
- });
26983
- container.register(ServiceTokens.ListReviewersPRCommand, () => {
26984
- const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
26985
- const contextService = container.resolve(ServiceTokens.ContextService);
26986
- const output = container.resolve(ServiceTokens.OutputService);
26987
- return new ListReviewersPRCommand(pullrequestsApi, contextService, output);
26988
- });
26989
- container.register(ServiceTokens.ChecksPRCommand, () => {
26990
- const commitStatusesApi = container.resolve(ServiceTokens.CommitStatusesApi);
26991
- const contextService = container.resolve(ServiceTokens.ContextService);
26992
- const output = container.resolve(ServiceTokens.OutputService);
26993
- return new ChecksPRCommand(commitStatusesApi, contextService, output);
26994
- });
26995
- container.register(ServiceTokens.ListSnippetsCommand, () => {
26996
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
26997
- const configService = container.resolve(ServiceTokens.ConfigService);
26998
- const output = container.resolve(ServiceTokens.OutputService);
26999
- return new ListSnippetsCommand(snippetsApi, configService, output);
27000
- });
27001
- container.register(ServiceTokens.ViewSnippetCommand, () => {
27002
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27003
- const snippetFilesService = container.resolve(ServiceTokens.SnippetFilesService);
27004
- const configService = container.resolve(ServiceTokens.ConfigService);
27005
- const output = container.resolve(ServiceTokens.OutputService);
27006
- return new ViewSnippetCommand(snippetsApi, snippetFilesService, configService, output);
27007
- });
27008
- container.register(ServiceTokens.CreateSnippetCommand, () => {
27009
- const snippetFilesService = container.resolve(ServiceTokens.SnippetFilesService);
27010
- const configService = container.resolve(ServiceTokens.ConfigService);
27011
- const output = container.resolve(ServiceTokens.OutputService);
27012
- return new CreateSnippetCommand(snippetFilesService, configService, output);
27013
- });
27014
- container.register(ServiceTokens.EditSnippetCommand, () => {
27015
- const snippetFilesService = container.resolve(ServiceTokens.SnippetFilesService);
27016
- const configService = container.resolve(ServiceTokens.ConfigService);
27017
- const output = container.resolve(ServiceTokens.OutputService);
27018
- return new EditSnippetCommand(snippetFilesService, configService, output);
27019
- });
27020
- container.register(ServiceTokens.DeleteSnippetCommand, () => {
27021
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27022
- const configService = container.resolve(ServiceTokens.ConfigService);
27023
- const output = container.resolve(ServiceTokens.OutputService);
27024
- return new DeleteSnippetCommand(snippetsApi, configService, output);
27025
- });
27026
- container.register(ServiceTokens.WatchSnippetCommand, () => {
27027
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27028
- const configService = container.resolve(ServiceTokens.ConfigService);
27029
- const output = container.resolve(ServiceTokens.OutputService);
27030
- return new WatchSnippetCommand(snippetsApi, configService, output);
27031
- });
27032
- container.register(ServiceTokens.UnwatchSnippetCommand, () => {
27033
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27034
- const configService = container.resolve(ServiceTokens.ConfigService);
27035
- const output = container.resolve(ServiceTokens.OutputService);
27036
- return new UnwatchSnippetCommand(snippetsApi, configService, output);
27037
- });
27038
- container.register(ServiceTokens.ListSnippetCommentsCommand, () => {
27039
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27040
- const configService = container.resolve(ServiceTokens.ConfigService);
27041
- const output = container.resolve(ServiceTokens.OutputService);
27042
- return new ListSnippetCommentsCommand(snippetsApi, configService, output);
27043
- });
27044
- container.register(ServiceTokens.AddSnippetCommentCommand, () => {
27045
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27046
- const configService = container.resolve(ServiceTokens.ConfigService);
27047
- const output = container.resolve(ServiceTokens.OutputService);
27048
- return new AddSnippetCommentCommand(snippetsApi, configService, output);
27049
- });
27050
- container.register(ServiceTokens.EditSnippetCommentCommand, () => {
27051
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27052
- const configService = container.resolve(ServiceTokens.ConfigService);
27053
- const output = container.resolve(ServiceTokens.OutputService);
27054
- return new EditSnippetCommentCommand(snippetsApi, configService, output);
27055
- });
27056
- container.register(ServiceTokens.DeleteSnippetCommentCommand, () => {
27057
- const snippetsApi = container.resolve(ServiceTokens.SnippetsApi);
27058
- const configService = container.resolve(ServiceTokens.ConfigService);
27059
- const output = container.resolve(ServiceTokens.OutputService);
27060
- return new DeleteSnippetCommentCommand(snippetsApi, configService, output);
27061
- });
27062
- container.register(ServiceTokens.GetConfigCommand, () => {
27063
- const configService = container.resolve(ServiceTokens.ConfigService);
27064
- const output = container.resolve(ServiceTokens.OutputService);
27065
- return new GetConfigCommand(configService, output);
27066
- });
27067
- container.register(ServiceTokens.SetConfigCommand, () => {
27068
- const configService = container.resolve(ServiceTokens.ConfigService);
27069
- const output = container.resolve(ServiceTokens.OutputService);
27070
- return new SetConfigCommand(configService, output);
27071
- });
27072
- container.register(ServiceTokens.ListConfigCommand, () => {
27073
- const configService = container.resolve(ServiceTokens.ConfigService);
27074
- const output = container.resolve(ServiceTokens.OutputService);
27075
- return new ListConfigCommand(configService, output);
27076
- });
27077
- container.register(ServiceTokens.InstallCompletionCommand, () => {
27078
- const output = container.resolve(ServiceTokens.OutputService);
27079
- return new InstallCompletionCommand(output);
27080
- });
27081
- container.register(ServiceTokens.UninstallCompletionCommand, () => {
27082
- const output = container.resolve(ServiceTokens.OutputService);
27083
- return new UninstallCompletionCommand(output);
27084
- });
26957
+ registerCommand(container, ServiceTokens.SnippetFilesService, SnippetFilesService, [ServiceTokens.SnippetsAxios]);
26958
+ registerCommand(container, ServiceTokens.DefaultReviewerService, DefaultReviewerService, [ServiceTokens.PullrequestsApi]);
26959
+ registerCommand(container, ServiceTokens.LoginCommand, LoginCommand, [
26960
+ ServiceTokens.CredentialStore,
26961
+ ServiceTokens.UsersApi,
26962
+ ServiceTokens.OAuthService,
26963
+ ServiceTokens.OutputService
26964
+ ]);
26965
+ registerCommand(container, ServiceTokens.LogoutCommand, LogoutCommand, [
26966
+ ServiceTokens.CredentialStore,
26967
+ ServiceTokens.OAuthService,
26968
+ ServiceTokens.OutputService
26969
+ ]);
26970
+ registerCommand(container, ServiceTokens.StatusCommand, StatusCommand, [
26971
+ ServiceTokens.ConfigService,
26972
+ ServiceTokens.CredentialStore,
26973
+ ServiceTokens.UsersApi,
26974
+ ServiceTokens.OutputService
26975
+ ]);
26976
+ registerCommand(container, ServiceTokens.TokenCommand, TokenCommand, [
26977
+ ServiceTokens.CredentialStore,
26978
+ ServiceTokens.OAuthService,
26979
+ ServiceTokens.OutputService
26980
+ ]);
26981
+ registerCommand(container, ServiceTokens.CloneCommand, CloneCommand, [
26982
+ ServiceTokens.GitService,
26983
+ ServiceTokens.ContextService,
26984
+ ServiceTokens.OutputService
26985
+ ]);
26986
+ registerCommand(container, ServiceTokens.CreateRepoCommand, CreateRepoCommand, [
26987
+ ServiceTokens.RepositoriesApi,
26988
+ ServiceTokens.ContextService,
26989
+ ServiceTokens.OutputService
26990
+ ]);
26991
+ registerCommand(container, ServiceTokens.ListReposCommand, ListReposCommand, [
26992
+ ServiceTokens.RepositoriesApi,
26993
+ ServiceTokens.ContextService,
26994
+ ServiceTokens.OutputService
26995
+ ]);
26996
+ registerCommand(container, ServiceTokens.ViewRepoCommand, ViewRepoCommand, [
26997
+ ServiceTokens.RepositoriesApi,
26998
+ ServiceTokens.ContextService,
26999
+ ServiceTokens.OutputService
27000
+ ]);
27001
+ registerCommand(container, ServiceTokens.DeleteRepoCommand, DeleteRepoCommand, [
27002
+ ServiceTokens.RepositoriesApi,
27003
+ ServiceTokens.ContextService,
27004
+ ServiceTokens.OutputService
27005
+ ]);
27006
+ registerCommand(container, ServiceTokens.ListDefaultReviewersCommand, ListDefaultReviewersCommand, [
27007
+ ServiceTokens.DefaultReviewerService,
27008
+ ServiceTokens.ContextService,
27009
+ ServiceTokens.OutputService
27010
+ ]);
27011
+ registerCommand(container, ServiceTokens.AddDefaultReviewerCommand, AddDefaultReviewerCommand, [
27012
+ ServiceTokens.DefaultReviewerService,
27013
+ ServiceTokens.UsersApi,
27014
+ ServiceTokens.ContextService,
27015
+ ServiceTokens.OutputService
27016
+ ]);
27017
+ registerCommand(container, ServiceTokens.RemoveDefaultReviewerCommand, RemoveDefaultReviewerCommand, [
27018
+ ServiceTokens.DefaultReviewerService,
27019
+ ServiceTokens.UsersApi,
27020
+ ServiceTokens.ContextService,
27021
+ ServiceTokens.OutputService
27022
+ ]);
27023
+ registerCommand(container, ServiceTokens.CreatePRCommand, CreatePRCommand, [
27024
+ ServiceTokens.PullrequestsApi,
27025
+ ServiceTokens.UsersApi,
27026
+ ServiceTokens.ContextService,
27027
+ ServiceTokens.GitService,
27028
+ ServiceTokens.DefaultReviewerService,
27029
+ ServiceTokens.ConfigService,
27030
+ ServiceTokens.OutputService
27031
+ ]);
27032
+ registerCommand(container, ServiceTokens.ListPRsCommand, ListPRsCommand, [
27033
+ ServiceTokens.PullrequestsApi,
27034
+ ServiceTokens.UsersApi,
27035
+ ServiceTokens.ContextService,
27036
+ ServiceTokens.OutputService
27037
+ ]);
27038
+ registerCommand(container, ServiceTokens.ViewPRCommand, ViewPRCommand, [
27039
+ ServiceTokens.PullrequestsApi,
27040
+ ServiceTokens.ContextService,
27041
+ ServiceTokens.OutputService
27042
+ ]);
27043
+ registerCommand(container, ServiceTokens.EditPRCommand, EditPRCommand, [
27044
+ ServiceTokens.PullrequestsApi,
27045
+ ServiceTokens.ContextService,
27046
+ ServiceTokens.GitService,
27047
+ ServiceTokens.OutputService
27048
+ ]);
27049
+ registerCommand(container, ServiceTokens.MergePRCommand, MergePRCommand, [
27050
+ ServiceTokens.PullrequestsApi,
27051
+ ServiceTokens.ContextService,
27052
+ ServiceTokens.OutputService
27053
+ ]);
27054
+ registerCommand(container, ServiceTokens.ApprovePRCommand, ApprovePRCommand, [
27055
+ ServiceTokens.PullrequestsApi,
27056
+ ServiceTokens.ContextService,
27057
+ ServiceTokens.OutputService
27058
+ ]);
27059
+ registerCommand(container, ServiceTokens.DeclinePRCommand, DeclinePRCommand, [
27060
+ ServiceTokens.PullrequestsApi,
27061
+ ServiceTokens.ContextService,
27062
+ ServiceTokens.OutputService
27063
+ ]);
27064
+ registerCommand(container, ServiceTokens.ReadyPRCommand, ReadyPRCommand, [
27065
+ ServiceTokens.PullrequestsApi,
27066
+ ServiceTokens.ContextService,
27067
+ ServiceTokens.OutputService
27068
+ ]);
27069
+ registerCommand(container, ServiceTokens.CheckoutPRCommand, CheckoutPRCommand, [
27070
+ ServiceTokens.PullrequestsApi,
27071
+ ServiceTokens.ContextService,
27072
+ ServiceTokens.GitService,
27073
+ ServiceTokens.OutputService
27074
+ ]);
27075
+ registerCommand(container, ServiceTokens.DiffPRCommand, DiffPRCommand, [
27076
+ ServiceTokens.PullrequestsApi,
27077
+ ServiceTokens.ContextService,
27078
+ ServiceTokens.GitService,
27079
+ ServiceTokens.OutputService
27080
+ ]);
27081
+ registerCommand(container, ServiceTokens.ActivityPRCommand, ActivityPRCommand, [
27082
+ ServiceTokens.PullrequestsApi,
27083
+ ServiceTokens.ContextService,
27084
+ ServiceTokens.OutputService
27085
+ ]);
27086
+ registerCommand(container, ServiceTokens.CommentPRCommand, CommentPRCommand, [
27087
+ ServiceTokens.PullrequestsApi,
27088
+ ServiceTokens.ContextService,
27089
+ ServiceTokens.OutputService
27090
+ ]);
27091
+ registerCommand(container, ServiceTokens.ListCommentsPRCommand, ListCommentsPRCommand, [
27092
+ ServiceTokens.PullrequestsApi,
27093
+ ServiceTokens.ContextService,
27094
+ ServiceTokens.OutputService
27095
+ ]);
27096
+ registerCommand(container, ServiceTokens.EditCommentPRCommand, EditCommentPRCommand, [
27097
+ ServiceTokens.PullrequestsApi,
27098
+ ServiceTokens.ContextService,
27099
+ ServiceTokens.OutputService
27100
+ ]);
27101
+ registerCommand(container, ServiceTokens.DeleteCommentPRCommand, DeleteCommentPRCommand, [
27102
+ ServiceTokens.PullrequestsApi,
27103
+ ServiceTokens.ContextService,
27104
+ ServiceTokens.OutputService
27105
+ ]);
27106
+ registerCommand(container, ServiceTokens.AddReviewerPRCommand, AddReviewerPRCommand, [
27107
+ ServiceTokens.PullrequestsApi,
27108
+ ServiceTokens.UsersApi,
27109
+ ServiceTokens.ContextService,
27110
+ ServiceTokens.OutputService
27111
+ ]);
27112
+ registerCommand(container, ServiceTokens.RemoveReviewerPRCommand, RemoveReviewerPRCommand, [
27113
+ ServiceTokens.PullrequestsApi,
27114
+ ServiceTokens.UsersApi,
27115
+ ServiceTokens.ContextService,
27116
+ ServiceTokens.OutputService
27117
+ ]);
27118
+ registerCommand(container, ServiceTokens.ListReviewersPRCommand, ListReviewersPRCommand, [
27119
+ ServiceTokens.PullrequestsApi,
27120
+ ServiceTokens.ContextService,
27121
+ ServiceTokens.OutputService
27122
+ ]);
27123
+ registerCommand(container, ServiceTokens.ChecksPRCommand, ChecksPRCommand, [
27124
+ ServiceTokens.CommitStatusesApi,
27125
+ ServiceTokens.ContextService,
27126
+ ServiceTokens.OutputService
27127
+ ]);
27128
+ registerCommand(container, ServiceTokens.ListSnippetsCommand, ListSnippetsCommand, [
27129
+ ServiceTokens.SnippetsApi,
27130
+ ServiceTokens.ContextService,
27131
+ ServiceTokens.OutputService
27132
+ ]);
27133
+ registerCommand(container, ServiceTokens.ViewSnippetCommand, ViewSnippetCommand, [
27134
+ ServiceTokens.SnippetsApi,
27135
+ ServiceTokens.SnippetFilesService,
27136
+ ServiceTokens.ContextService,
27137
+ ServiceTokens.OutputService
27138
+ ]);
27139
+ registerCommand(container, ServiceTokens.CreateSnippetCommand, CreateSnippetCommand, [
27140
+ ServiceTokens.SnippetFilesService,
27141
+ ServiceTokens.ContextService,
27142
+ ServiceTokens.OutputService
27143
+ ]);
27144
+ registerCommand(container, ServiceTokens.EditSnippetCommand, EditSnippetCommand, [
27145
+ ServiceTokens.SnippetFilesService,
27146
+ ServiceTokens.ContextService,
27147
+ ServiceTokens.OutputService
27148
+ ]);
27149
+ registerCommand(container, ServiceTokens.DeleteSnippetCommand, DeleteSnippetCommand, [
27150
+ ServiceTokens.SnippetsApi,
27151
+ ServiceTokens.ContextService,
27152
+ ServiceTokens.OutputService
27153
+ ]);
27154
+ registerCommand(container, ServiceTokens.WatchSnippetCommand, WatchSnippetCommand, [
27155
+ ServiceTokens.SnippetsApi,
27156
+ ServiceTokens.ContextService,
27157
+ ServiceTokens.OutputService
27158
+ ]);
27159
+ registerCommand(container, ServiceTokens.UnwatchSnippetCommand, UnwatchSnippetCommand, [
27160
+ ServiceTokens.SnippetsApi,
27161
+ ServiceTokens.ContextService,
27162
+ ServiceTokens.OutputService
27163
+ ]);
27164
+ registerCommand(container, ServiceTokens.ListSnippetCommentsCommand, ListSnippetCommentsCommand, [
27165
+ ServiceTokens.SnippetsApi,
27166
+ ServiceTokens.ContextService,
27167
+ ServiceTokens.OutputService
27168
+ ]);
27169
+ registerCommand(container, ServiceTokens.AddSnippetCommentCommand, AddSnippetCommentCommand, [
27170
+ ServiceTokens.SnippetsApi,
27171
+ ServiceTokens.ContextService,
27172
+ ServiceTokens.OutputService
27173
+ ]);
27174
+ registerCommand(container, ServiceTokens.EditSnippetCommentCommand, EditSnippetCommentCommand, [
27175
+ ServiceTokens.SnippetsApi,
27176
+ ServiceTokens.ContextService,
27177
+ ServiceTokens.OutputService
27178
+ ]);
27179
+ registerCommand(container, ServiceTokens.DeleteSnippetCommentCommand, DeleteSnippetCommentCommand, [
27180
+ ServiceTokens.SnippetsApi,
27181
+ ServiceTokens.ContextService,
27182
+ ServiceTokens.OutputService
27183
+ ]);
27184
+ registerCommand(container, ServiceTokens.GetConfigCommand, GetConfigCommand, [
27185
+ ServiceTokens.ConfigService,
27186
+ ServiceTokens.OutputService
27187
+ ]);
27188
+ registerCommand(container, ServiceTokens.SetConfigCommand, SetConfigCommand, [
27189
+ ServiceTokens.ConfigService,
27190
+ ServiceTokens.OutputService
27191
+ ]);
27192
+ registerCommand(container, ServiceTokens.ListConfigCommand, ListConfigCommand, [ServiceTokens.ConfigService, ServiceTokens.OutputService]);
27193
+ registerCommand(container, ServiceTokens.InstallCompletionCommand, InstallCompletionCommand, [ServiceTokens.OutputService]);
27194
+ registerCommand(container, ServiceTokens.UninstallCompletionCommand, UninstallCompletionCommand, [ServiceTokens.OutputService]);
27085
27195
  container.register(ServiceTokens.VersionService, () => {
27086
27196
  const configService = container.resolve(ServiceTokens.ConfigService);
27087
27197
  return new VersionService(configService, pkg.version);
@@ -27138,41 +27248,97 @@ function createHelpTextBuilder(noColor) {
27138
27248
  import tabtab3 from "tabtab";
27139
27249
  var require3 = createRequire2(import.meta.url);
27140
27250
  var pkg2 = require3("../package.json");
27251
+ function getCompletionParent(line, word) {
27252
+ if (typeof line !== "string") {
27253
+ return;
27254
+ }
27255
+ const tokens = line.split(/\s+/).filter(Boolean);
27256
+ const idx = tokens.lastIndexOf(word);
27257
+ if (idx <= 0) {
27258
+ return;
27259
+ }
27260
+ for (let i = idx - 1;i >= 0; i--) {
27261
+ const token = tokens[i];
27262
+ if (token && !token.startsWith("-")) {
27263
+ return token;
27264
+ }
27265
+ }
27266
+ return;
27267
+ }
27268
+ var ROOT_COMPLETIONS = [
27269
+ "auth",
27270
+ "repo",
27271
+ "pr",
27272
+ "snippet",
27273
+ "config",
27274
+ "completion",
27275
+ "--help",
27276
+ "--version",
27277
+ "--json",
27278
+ "--no-color",
27279
+ "--workspace",
27280
+ "--repo"
27281
+ ];
27282
+ var SUBCOMMAND_COMPLETIONS = new Map([
27283
+ ["auth", ["login", "logout", "status", "token"]],
27284
+ ["repo", ["clone", "create", "list", "view", "delete", "default-reviewers"]],
27285
+ ["default-reviewers", ["list", "add", "remove"]],
27286
+ [
27287
+ "pr",
27288
+ [
27289
+ "create",
27290
+ "list",
27291
+ "view",
27292
+ "activity",
27293
+ "checks",
27294
+ "edit",
27295
+ "merge",
27296
+ "approve",
27297
+ "decline",
27298
+ "ready",
27299
+ "checkout",
27300
+ "diff",
27301
+ "comments",
27302
+ "reviewers"
27303
+ ]
27304
+ ],
27305
+ ["reviewers", ["list", "add", "remove"]],
27306
+ [
27307
+ "snippet",
27308
+ [
27309
+ "list",
27310
+ "view",
27311
+ "create",
27312
+ "edit",
27313
+ "delete",
27314
+ "watch",
27315
+ "unwatch",
27316
+ "comments"
27317
+ ]
27318
+ ],
27319
+ ["config", ["get", "set", "list"]],
27320
+ ["completion", ["install", "uninstall"]]
27321
+ ]);
27322
+ var COMMENTS_SUBCOMMANDS = [
27323
+ "list",
27324
+ "add",
27325
+ "edit",
27326
+ "delete"
27327
+ ];
27141
27328
  if (process.argv.includes("--get-yargs-completions") || process.env.COMP_LINE) {
27142
27329
  const env2 = tabtab3.parseEnv(process.env);
27143
27330
  if (env2.complete) {
27144
- const completions = [
27145
- "auth",
27146
- "repo",
27147
- "pr",
27148
- "snippet",
27149
- "config",
27150
- "completion",
27151
- "--help",
27152
- "--version",
27153
- "--json",
27154
- "--no-color",
27155
- "--workspace",
27156
- "--repo"
27157
- ];
27158
- if (env2.prev === "auth") {
27159
- completions.push("login", "logout", "status", "token");
27160
- } else if (env2.prev === "repo") {
27161
- completions.push("clone", "create", "list", "view", "delete", "default-reviewers");
27162
- } else if (env2.prev === "default-reviewers") {
27163
- completions.push("list", "add", "remove");
27164
- } else if (env2.prev === "pr") {
27165
- completions.push("create", "list", "view", "activity", "checks", "edit", "merge", "approve", "decline", "ready", "checkout", "diff", "comments", "reviewers");
27166
- } else if (env2.prev === "reviewers") {
27167
- completions.push("list", "add", "remove");
27168
- } else if (env2.prev === "snippet") {
27169
- completions.push("list", "view", "create", "edit", "delete", "watch", "unwatch", "comments");
27170
- } else if (env2.prev === "comments" && typeof env2.line === "string" && env2.line.includes(" snippet ")) {
27171
- completions.push("list", "add", "edit", "delete");
27172
- } else if (env2.prev === "config") {
27173
- completions.push("get", "set", "list");
27174
- } else if (env2.prev === "completion") {
27175
- completions.push("install", "uninstall");
27331
+ const completions = [...ROOT_COMPLETIONS];
27332
+ if (env2.prev === "comments") {
27333
+ const parent = getCompletionParent(env2.line, "comments");
27334
+ if (parent === "snippet" || parent === "pr") {
27335
+ completions.push(...COMMENTS_SUBCOMMANDS);
27336
+ }
27337
+ } else {
27338
+ const subcommands = SUBCOMMAND_COMPLETIONS.get(env2.prev);
27339
+ if (subcommands) {
27340
+ completions.push(...subcommands);
27341
+ }
27176
27342
  }
27177
27343
  tabtab3.log(completions);
27178
27344
  process.exit(0);
@@ -27383,7 +27549,7 @@ prCmd.command("create").description("Create a pull request").option("-t, --title
27383
27549
  const context = createContext(cli);
27384
27550
  await runCommand(ServiceTokens.CreatePRCommand, withGlobalOptions(options, context), cli, context);
27385
27551
  });
27386
- prCmd.command("list").description("List pull requests").option("-s, --state <state>", "Filter by state (OPEN, MERGED, DECLINED, SUPERSEDED)", "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").option("--mine", "Show only PRs where you are a reviewer").addHelpText("after", buildHelpText({
27552
+ prCmd.command("list").description("List pull requests").option("-s, --state <state>", `Filter by state (${PR_STATES.join(", ")})`, "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").option("--mine", "Show only PRs where you are a reviewer").addHelpText("after", buildHelpText({
27387
27553
  examples: [
27388
27554
  "bb pr list",
27389
27555
  "bb pr list -s MERGED --limit 10",
@@ -27391,7 +27557,7 @@ prCmd.command("list").description("List pull requests").option("-s, --state <sta
27391
27557
  "bb pr list --json"
27392
27558
  ],
27393
27559
  validValues: {
27394
- "Valid states": ["OPEN", "MERGED", "DECLINED", "SUPERSEDED"]
27560
+ "Valid states": [...PR_STATES]
27395
27561
  },
27396
27562
  defaults: { state: "OPEN", limit: "25" }
27397
27563
  })).action(async (options) => {