@uipath/rpa-tool 0.2.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +1430 -427
  2. package/dist/tool.js +68232 -57583
  3. package/package.json +10 -8
package/dist/index.js CHANGED
@@ -34,8 +34,8 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
34
34
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
35
35
 
36
36
  // node_modules/commander/lib/error.js
37
- var require_error2 = __commonJS((exports) => {
38
- class CommanderError2 extends Error {
37
+ var require_error = __commonJS((exports) => {
38
+ class CommanderError extends Error {
39
39
  constructor(exitCode, code, message) {
40
40
  super(message);
41
41
  Error.captureStackTrace(this, this.constructor);
@@ -46,22 +46,22 @@ var require_error2 = __commonJS((exports) => {
46
46
  }
47
47
  }
48
48
 
49
- class InvalidArgumentError2 extends CommanderError2 {
49
+ class InvalidArgumentError extends CommanderError {
50
50
  constructor(message) {
51
51
  super(1, "commander.invalidArgument", message);
52
52
  Error.captureStackTrace(this, this.constructor);
53
53
  this.name = this.constructor.name;
54
54
  }
55
55
  }
56
- exports.CommanderError = CommanderError2;
57
- exports.InvalidArgumentError = InvalidArgumentError2;
56
+ exports.CommanderError = CommanderError;
57
+ exports.InvalidArgumentError = InvalidArgumentError;
58
58
  });
59
59
 
60
60
  // node_modules/commander/lib/argument.js
61
- var require_argument2 = __commonJS((exports) => {
62
- var { InvalidArgumentError: InvalidArgumentError2 } = require_error2();
61
+ var require_argument = __commonJS((exports) => {
62
+ var { InvalidArgumentError } = require_error();
63
63
 
64
- class Argument2 {
64
+ class Argument {
65
65
  constructor(name, description) {
66
66
  this.description = description || "";
67
67
  this.variadic = false;
@@ -111,7 +111,7 @@ var require_argument2 = __commonJS((exports) => {
111
111
  this.argChoices = values.slice();
112
112
  this.parseArg = (arg, previous) => {
113
113
  if (!this.argChoices.includes(arg)) {
114
- throw new InvalidArgumentError2(`Allowed choices are ${this.argChoices.join(", ")}.`);
114
+ throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
115
115
  }
116
116
  if (this.variadic) {
117
117
  return this._collectValue(arg, previous);
@@ -133,15 +133,15 @@ var require_argument2 = __commonJS((exports) => {
133
133
  const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
134
134
  return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
135
135
  }
136
- exports.Argument = Argument2;
136
+ exports.Argument = Argument;
137
137
  exports.humanReadableArgName = humanReadableArgName;
138
138
  });
139
139
 
140
140
  // node_modules/commander/lib/help.js
141
- var require_help2 = __commonJS((exports) => {
142
- var { humanReadableArgName } = require_argument2();
141
+ var require_help = __commonJS((exports) => {
142
+ var { humanReadableArgName } = require_argument();
143
143
 
144
- class Help2 {
144
+ class Help {
145
145
  constructor() {
146
146
  this.helpWidth = undefined;
147
147
  this.minWidthToWrap = 40;
@@ -359,24 +359,24 @@ var require_help2 = __commonJS((exports) => {
359
359
  });
360
360
  output = output.concat(this.formatItemList("Global Options:", globalOptionList, helper));
361
361
  }
362
- const commandGroups = this.groupItems(cmd.commands, helper.visibleCommands(cmd), (sub2) => sub2.helpGroup() || "Commands:");
362
+ const commandGroups = this.groupItems(cmd.commands, helper.visibleCommands(cmd), (sub) => sub.helpGroup() || "Commands:");
363
363
  commandGroups.forEach((commands, group) => {
364
- const commandList = commands.map((sub2) => {
365
- return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(sub2)), helper.styleSubcommandDescription(helper.subcommandDescription(sub2)));
364
+ const commandList = commands.map((sub) => {
365
+ return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(sub)), helper.styleSubcommandDescription(helper.subcommandDescription(sub)));
366
366
  });
367
367
  output = output.concat(this.formatItemList(group, commandList, helper));
368
368
  });
369
369
  return output.join(`
370
370
  `);
371
371
  }
372
- displayWidth(str2) {
373
- return stripColor(str2).length;
372
+ displayWidth(str) {
373
+ return stripColor(str).length;
374
374
  }
375
- styleTitle(str2) {
376
- return str2;
375
+ styleTitle(str) {
376
+ return str;
377
377
  }
378
- styleUsage(str2) {
379
- return str2.split(" ").map((word) => {
378
+ styleUsage(str) {
379
+ return str.split(" ").map((word) => {
380
380
  if (word === "[options]")
381
381
  return this.styleOptionText(word);
382
382
  if (word === "[command]")
@@ -386,26 +386,26 @@ var require_help2 = __commonJS((exports) => {
386
386
  return this.styleCommandText(word);
387
387
  }).join(" ");
388
388
  }
389
- styleCommandDescription(str2) {
390
- return this.styleDescriptionText(str2);
389
+ styleCommandDescription(str) {
390
+ return this.styleDescriptionText(str);
391
391
  }
392
- styleOptionDescription(str2) {
393
- return this.styleDescriptionText(str2);
392
+ styleOptionDescription(str) {
393
+ return this.styleDescriptionText(str);
394
394
  }
395
- styleSubcommandDescription(str2) {
396
- return this.styleDescriptionText(str2);
395
+ styleSubcommandDescription(str) {
396
+ return this.styleDescriptionText(str);
397
397
  }
398
- styleArgumentDescription(str2) {
399
- return this.styleDescriptionText(str2);
398
+ styleArgumentDescription(str) {
399
+ return this.styleDescriptionText(str);
400
400
  }
401
- styleDescriptionText(str2) {
402
- return str2;
401
+ styleDescriptionText(str) {
402
+ return str;
403
403
  }
404
- styleOptionTerm(str2) {
405
- return this.styleOptionText(str2);
404
+ styleOptionTerm(str) {
405
+ return this.styleOptionText(str);
406
406
  }
407
- styleSubcommandTerm(str2) {
408
- return str2.split(" ").map((word) => {
407
+ styleSubcommandTerm(str) {
408
+ return str.split(" ").map((word) => {
409
409
  if (word === "[options]")
410
410
  return this.styleOptionText(word);
411
411
  if (word[0] === "[" || word[0] === "<")
@@ -413,26 +413,26 @@ var require_help2 = __commonJS((exports) => {
413
413
  return this.styleSubcommandText(word);
414
414
  }).join(" ");
415
415
  }
416
- styleArgumentTerm(str2) {
417
- return this.styleArgumentText(str2);
416
+ styleArgumentTerm(str) {
417
+ return this.styleArgumentText(str);
418
418
  }
419
- styleOptionText(str2) {
420
- return str2;
419
+ styleOptionText(str) {
420
+ return str;
421
421
  }
422
- styleArgumentText(str2) {
423
- return str2;
422
+ styleArgumentText(str) {
423
+ return str;
424
424
  }
425
- styleSubcommandText(str2) {
426
- return str2;
425
+ styleSubcommandText(str) {
426
+ return str;
427
427
  }
428
- styleCommandText(str2) {
429
- return str2;
428
+ styleCommandText(str) {
429
+ return str;
430
430
  }
431
431
  padWidth(cmd, helper) {
432
432
  return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
433
433
  }
434
- preformatted(str2) {
435
- return /\n[^\S\r\n]/.test(str2);
434
+ preformatted(str) {
435
+ return /\n[^\S\r\n]/.test(str);
436
436
  }
437
437
  formatItem(term, termWidth, description, helper) {
438
438
  const itemIndent = 2;
@@ -454,10 +454,10 @@ var require_help2 = __commonJS((exports) => {
454
454
  return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
455
455
  ${itemIndentStr}`);
456
456
  }
457
- boxWrap(str2, width) {
457
+ boxWrap(str, width) {
458
458
  if (width < this.minWidthToWrap)
459
- return str2;
460
- const rawLines = str2.split(/\r\n|\n/);
459
+ return str;
460
+ const rawLines = str.split(/\r\n|\n/);
461
461
  const chunkPattern = /[\s]*[^\s]+/g;
462
462
  const wrappedLines = [];
463
463
  rawLines.forEach((line) => {
@@ -486,19 +486,19 @@ ${itemIndentStr}`);
486
486
  `);
487
487
  }
488
488
  }
489
- function stripColor(str2) {
489
+ function stripColor(str) {
490
490
  const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
491
- return str2.replace(sgrPattern, "");
491
+ return str.replace(sgrPattern, "");
492
492
  }
493
- exports.Help = Help2;
493
+ exports.Help = Help;
494
494
  exports.stripColor = stripColor;
495
495
  });
496
496
 
497
497
  // node_modules/commander/lib/option.js
498
- var require_option2 = __commonJS((exports) => {
499
- var { InvalidArgumentError: InvalidArgumentError2 } = require_error2();
498
+ var require_option = __commonJS((exports) => {
499
+ var { InvalidArgumentError } = require_error();
500
500
 
501
- class Option2 {
501
+ class Option {
502
502
  constructor(flags, description) {
503
503
  this.flags = flags;
504
504
  this.description = description || "";
@@ -572,7 +572,7 @@ var require_option2 = __commonJS((exports) => {
572
572
  this.argChoices = values.slice();
573
573
  this.parseArg = (arg, previous) => {
574
574
  if (!this.argChoices.includes(arg)) {
575
- throw new InvalidArgumentError2(`Allowed choices are ${this.argChoices.join(", ")}.`);
575
+ throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
576
576
  }
577
577
  if (this.variadic) {
578
578
  return this._collectValue(arg, previous);
@@ -632,9 +632,9 @@ var require_option2 = __commonJS((exports) => {
632
632
  return option.negate === (negativeValue === value);
633
633
  }
634
634
  }
635
- function camelcase(str2) {
636
- return str2.split("-").reduce((str3, word) => {
637
- return str3 + word[0].toUpperCase() + word.slice(1);
635
+ function camelcase(str) {
636
+ return str.split("-").reduce((str2, word) => {
637
+ return str2 + word[0].toUpperCase() + word.slice(1);
638
638
  });
639
639
  }
640
640
  function splitOptionFlags(flags) {
@@ -674,34 +674,34 @@ var require_option2 = __commonJS((exports) => {
674
674
  throw new Error(`option creation failed due to no flags found in '${flags}'.`);
675
675
  return { shortFlag, longFlag };
676
676
  }
677
- exports.Option = Option2;
677
+ exports.Option = Option;
678
678
  exports.DualOptions = DualOptions;
679
679
  });
680
680
 
681
681
  // node_modules/commander/lib/suggestSimilar.js
682
- var require_suggestSimilar2 = __commonJS((exports) => {
682
+ var require_suggestSimilar = __commonJS((exports) => {
683
683
  var maxDistance = 3;
684
684
  function editDistance(a, b) {
685
685
  if (Math.abs(a.length - b.length) > maxDistance)
686
686
  return Math.max(a.length, b.length);
687
687
  const d = [];
688
- for (let i2 = 0;i2 <= a.length; i2++) {
689
- d[i2] = [i2];
688
+ for (let i = 0;i <= a.length; i++) {
689
+ d[i] = [i];
690
690
  }
691
691
  for (let j = 0;j <= b.length; j++) {
692
692
  d[0][j] = j;
693
693
  }
694
694
  for (let j = 1;j <= b.length; j++) {
695
- for (let i2 = 1;i2 <= a.length; i2++) {
695
+ for (let i = 1;i <= a.length; i++) {
696
696
  let cost = 1;
697
- if (a[i2 - 1] === b[j - 1]) {
697
+ if (a[i - 1] === b[j - 1]) {
698
698
  cost = 0;
699
699
  } else {
700
700
  cost = 1;
701
701
  }
702
- d[i2][j] = Math.min(d[i2 - 1][j] + 1, d[i2][j - 1] + 1, d[i2 - 1][j - 1] + cost);
703
- if (i2 > 1 && j > 1 && a[i2 - 1] === b[j - 2] && a[i2 - 2] === b[j - 1]) {
704
- d[i2][j] = Math.min(d[i2][j], d[i2 - 2][j - 2] + 1);
702
+ d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
703
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
704
+ d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
705
705
  }
706
706
  }
707
707
  }
@@ -752,19 +752,19 @@ var require_suggestSimilar2 = __commonJS((exports) => {
752
752
  });
753
753
 
754
754
  // node_modules/commander/lib/command.js
755
- var require_command2 = __commonJS((exports) => {
755
+ var require_command = __commonJS((exports) => {
756
756
  var EventEmitter = __require("node:events").EventEmitter;
757
757
  var childProcess = __require("node:child_process");
758
758
  var path = __require("node:path");
759
759
  var fs = __require("node:fs");
760
760
  var process2 = __require("node:process");
761
- var { Argument: Argument2, humanReadableArgName } = require_argument2();
762
- var { CommanderError: CommanderError2 } = require_error2();
763
- var { Help: Help2, stripColor } = require_help2();
764
- var { Option: Option2, DualOptions } = require_option2();
765
- var { suggestSimilar } = require_suggestSimilar2();
761
+ var { Argument, humanReadableArgName } = require_argument();
762
+ var { CommanderError } = require_error();
763
+ var { Help, stripColor } = require_help();
764
+ var { Option, DualOptions } = require_option();
765
+ var { suggestSimilar } = require_suggestSimilar();
766
766
 
767
- class Command2 extends EventEmitter {
767
+ class Command extends EventEmitter {
768
768
  constructor(name) {
769
769
  super();
770
770
  this.commands = [];
@@ -800,14 +800,14 @@ var require_command2 = __commonJS((exports) => {
800
800
  this._showSuggestionAfterError = true;
801
801
  this._savedState = null;
802
802
  this._outputConfiguration = {
803
- writeOut: (str2) => process2.stdout.write(str2),
804
- writeErr: (str2) => process2.stderr.write(str2),
805
- outputError: (str2, write) => write(str2),
803
+ writeOut: (str) => process2.stdout.write(str),
804
+ writeErr: (str) => process2.stderr.write(str),
805
+ outputError: (str, write) => write(str),
806
806
  getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
807
807
  getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
808
808
  getOutHasColors: () => useColor() ?? (process2.stdout.isTTY && process2.stdout.hasColors?.()),
809
809
  getErrHasColors: () => useColor() ?? (process2.stderr.isTTY && process2.stderr.hasColors?.()),
810
- stripColor: (str2) => stripColor(str2)
810
+ stripColor: (str) => stripColor(str)
811
811
  };
812
812
  this._hidden = false;
813
813
  this._helpOption = undefined;
@@ -867,10 +867,10 @@ var require_command2 = __commonJS((exports) => {
867
867
  return cmd;
868
868
  }
869
869
  createCommand(name) {
870
- return new Command2(name);
870
+ return new Command(name);
871
871
  }
872
872
  createHelp() {
873
- return Object.assign(new Help2, this.configureHelp());
873
+ return Object.assign(new Help, this.configureHelp());
874
874
  }
875
875
  configureHelp(configuration) {
876
876
  if (configuration === undefined)
@@ -913,7 +913,7 @@ var require_command2 = __commonJS((exports) => {
913
913
  return this;
914
914
  }
915
915
  createArgument(name, description) {
916
- return new Argument2(name, description);
916
+ return new Argument(name, description);
917
917
  }
918
918
  argument(name, description, parseArg, defaultValue) {
919
919
  const argument = this.createArgument(name, description);
@@ -1012,7 +1012,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1012
1012
  }
1013
1013
  _exit(exitCode, code, message) {
1014
1014
  if (this._exitCallback) {
1015
- this._exitCallback(new CommanderError2(exitCode, code, message));
1015
+ this._exitCallback(new CommanderError(exitCode, code, message));
1016
1016
  }
1017
1017
  process2.exit(exitCode);
1018
1018
  }
@@ -1032,7 +1032,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1032
1032
  return this;
1033
1033
  }
1034
1034
  createOption(flags, description) {
1035
- return new Option2(flags, description);
1035
+ return new Option(flags, description);
1036
1036
  }
1037
1037
  _callParseArg(target, value, previous, invalidArgumentMessage) {
1038
1038
  try {
@@ -1114,7 +1114,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1114
1114
  return this;
1115
1115
  }
1116
1116
  _optionEx(config, flags, description, fn, defaultValue) {
1117
- if (typeof flags === "object" && flags instanceof Option2) {
1117
+ if (typeof flags === "object" && flags instanceof Option) {
1118
1118
  throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
1119
1119
  }
1120
1120
  const option = this.createOption(flags, description);
@@ -1370,7 +1370,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1370
1370
  if (!exitCallback) {
1371
1371
  process2.exit(code);
1372
1372
  } else {
1373
- exitCallback(new CommanderError2(code, "commander.executeSubCommandAsync", "(close)"));
1373
+ exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
1374
1374
  }
1375
1375
  });
1376
1376
  proc.on("error", (err) => {
@@ -1382,7 +1382,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1382
1382
  if (!exitCallback) {
1383
1383
  process2.exit(1);
1384
1384
  } else {
1385
- const wrappedError = new CommanderError2(1, "commander.executeSubCommandAsync", "(error)");
1385
+ const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
1386
1386
  wrappedError.nestedError = err;
1387
1387
  exitCallback(wrappedError);
1388
1388
  }
@@ -1416,8 +1416,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1416
1416
  return this._dispatchSubcommand(subcommandName, [], [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? "--help"]);
1417
1417
  }
1418
1418
  _checkNumberOfArguments() {
1419
- this.registeredArguments.forEach((arg, i2) => {
1420
- if (arg.required && this.args[i2] == null) {
1419
+ this.registeredArguments.forEach((arg, i) => {
1420
+ if (arg.required && this.args[i] == null) {
1421
1421
  this.missingArgument(arg.name());
1422
1422
  }
1423
1423
  });
@@ -1439,11 +1439,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1439
1439
  };
1440
1440
  this._checkNumberOfArguments();
1441
1441
  const processedArgs = [];
1442
- this.registeredArguments.forEach((declaredArg, index2) => {
1442
+ this.registeredArguments.forEach((declaredArg, index) => {
1443
1443
  let value = declaredArg.defaultValue;
1444
1444
  if (declaredArg.variadic) {
1445
- if (index2 < this.args.length) {
1446
- value = this.args.slice(index2);
1445
+ if (index < this.args.length) {
1446
+ value = this.args.slice(index);
1447
1447
  if (declaredArg.parseArg) {
1448
1448
  value = value.reduce((processed, v) => {
1449
1449
  return myParseArg(declaredArg, v, processed);
@@ -1452,13 +1452,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1452
1452
  } else if (value === undefined) {
1453
1453
  value = [];
1454
1454
  }
1455
- } else if (index2 < this.args.length) {
1456
- value = this.args[index2];
1455
+ } else if (index < this.args.length) {
1456
+ value = this.args[index];
1457
1457
  if (declaredArg.parseArg) {
1458
1458
  value = myParseArg(declaredArg, value, declaredArg.defaultValue);
1459
1459
  }
1460
1460
  }
1461
- processedArgs[index2] = value;
1461
+ processedArgs[index] = value;
1462
1462
  });
1463
1463
  this.processedArgs = processedArgs;
1464
1464
  }
@@ -1470,16 +1470,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
1470
1470
  }
1471
1471
  _chainOrCallHooks(promise, event) {
1472
1472
  let result = promise;
1473
- const hooks2 = [];
1473
+ const hooks = [];
1474
1474
  this._getCommandAndAncestors().reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== undefined).forEach((hookedCommand) => {
1475
1475
  hookedCommand._lifeCycleHooks[event].forEach((callback) => {
1476
- hooks2.push({ hookedCommand, callback });
1476
+ hooks.push({ hookedCommand, callback });
1477
1477
  });
1478
1478
  });
1479
1479
  if (event === "postAction") {
1480
- hooks2.reverse();
1480
+ hooks.reverse();
1481
1481
  }
1482
- hooks2.forEach((hookDetail) => {
1482
+ hooks.forEach((hookDetail) => {
1483
1483
  result = this._chainOrCall(result, () => {
1484
1484
  return hookDetail.callback(hookDetail.hookedCommand, this);
1485
1485
  });
@@ -1616,14 +1616,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
1616
1616
  };
1617
1617
  let activeVariadicOption = null;
1618
1618
  let activeGroup = null;
1619
- let i2 = 0;
1620
- while (i2 < args.length || activeGroup) {
1621
- const arg = activeGroup ?? args[i2++];
1619
+ let i = 0;
1620
+ while (i < args.length || activeGroup) {
1621
+ const arg = activeGroup ?? args[i++];
1622
1622
  activeGroup = null;
1623
1623
  if (arg === "--") {
1624
1624
  if (dest === unknown)
1625
1625
  dest.push(arg);
1626
- dest.push(...args.slice(i2));
1626
+ dest.push(...args.slice(i));
1627
1627
  break;
1628
1628
  }
1629
1629
  if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
@@ -1635,14 +1635,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
1635
1635
  const option = this._findOption(arg);
1636
1636
  if (option) {
1637
1637
  if (option.required) {
1638
- const value = args[i2++];
1638
+ const value = args[i++];
1639
1639
  if (value === undefined)
1640
1640
  this.optionMissingArgument(option);
1641
1641
  this.emit(`option:${option.name()}`, value);
1642
1642
  } else if (option.optional) {
1643
1643
  let value = null;
1644
- if (i2 < args.length && (!maybeOption(args[i2]) || negativeNumberArg(args[i2]))) {
1645
- value = args[i2++];
1644
+ if (i < args.length && (!maybeOption(args[i]) || negativeNumberArg(args[i]))) {
1645
+ value = args[i++];
1646
1646
  }
1647
1647
  this.emit(`option:${option.name()}`, value);
1648
1648
  } else {
@@ -1665,10 +1665,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1665
1665
  }
1666
1666
  }
1667
1667
  if (/^--[^=]+=/.test(arg)) {
1668
- const index2 = arg.indexOf("=");
1669
- const option = this._findOption(arg.slice(0, index2));
1668
+ const index = arg.indexOf("=");
1669
+ const option = this._findOption(arg.slice(0, index));
1670
1670
  if (option && (option.required || option.optional)) {
1671
- this.emit(`option:${option.name()}`, arg.slice(index2 + 1));
1671
+ this.emit(`option:${option.name()}`, arg.slice(index + 1));
1672
1672
  continue;
1673
1673
  }
1674
1674
  }
@@ -1678,18 +1678,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
1678
1678
  if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
1679
1679
  if (this._findCommand(arg)) {
1680
1680
  operands.push(arg);
1681
- unknown.push(...args.slice(i2));
1681
+ unknown.push(...args.slice(i));
1682
1682
  break;
1683
1683
  } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
1684
- operands.push(arg, ...args.slice(i2));
1684
+ operands.push(arg, ...args.slice(i));
1685
1685
  break;
1686
1686
  } else if (this._defaultCommandName) {
1687
- unknown.push(arg, ...args.slice(i2));
1687
+ unknown.push(arg, ...args.slice(i));
1688
1688
  break;
1689
1689
  }
1690
1690
  }
1691
1691
  if (this._passThroughOptions) {
1692
- dest.push(arg, ...args.slice(i2));
1692
+ dest.push(arg, ...args.slice(i));
1693
1693
  break;
1694
1694
  }
1695
1695
  dest.push(arg);
@@ -1700,8 +1700,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1700
1700
  if (this._storeOptionsAsProperties) {
1701
1701
  const result = {};
1702
1702
  const len = this.options.length;
1703
- for (let i2 = 0;i2 < len; i2++) {
1704
- const key = this.options[i2].attributeName();
1703
+ for (let i = 0;i < len; i++) {
1704
+ const key = this.options[i].attributeName();
1705
1705
  result[key] = key === this._versionOptionName ? this._version : this[key];
1706
1706
  }
1707
1707
  return result;
@@ -1828,35 +1828,35 @@ Expecting one of '${allowedValues.join("', '")}'`);
1828
1828
  const message = `error: unknown command '${unknownName}'${suggestion}`;
1829
1829
  this.error(message, { code: "commander.unknownCommand" });
1830
1830
  }
1831
- version(str2, flags, description) {
1832
- if (str2 === undefined)
1831
+ version(str, flags, description) {
1832
+ if (str === undefined)
1833
1833
  return this._version;
1834
- this._version = str2;
1834
+ this._version = str;
1835
1835
  flags = flags || "-V, --version";
1836
1836
  description = description || "output the version number";
1837
1837
  const versionOption = this.createOption(flags, description);
1838
1838
  this._versionOptionName = versionOption.attributeName();
1839
1839
  this._registerOption(versionOption);
1840
1840
  this.on("option:" + versionOption.name(), () => {
1841
- this._outputConfiguration.writeOut(`${str2}
1841
+ this._outputConfiguration.writeOut(`${str}
1842
1842
  `);
1843
- this._exit(0, "commander.version", str2);
1843
+ this._exit(0, "commander.version", str);
1844
1844
  });
1845
1845
  return this;
1846
1846
  }
1847
- description(str2, argsDescription) {
1848
- if (str2 === undefined && argsDescription === undefined)
1847
+ description(str, argsDescription) {
1848
+ if (str === undefined && argsDescription === undefined)
1849
1849
  return this._description;
1850
- this._description = str2;
1850
+ this._description = str;
1851
1851
  if (argsDescription) {
1852
1852
  this._argsDescription = argsDescription;
1853
1853
  }
1854
1854
  return this;
1855
1855
  }
1856
- summary(str2) {
1857
- if (str2 === undefined)
1856
+ summary(str) {
1857
+ if (str === undefined)
1858
1858
  return this._summary;
1859
- this._summary = str2;
1859
+ this._summary = str;
1860
1860
  return this;
1861
1861
  }
1862
1862
  alias(alias) {
@@ -1882,8 +1882,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1882
1882
  aliases.forEach((alias) => this.alias(alias));
1883
1883
  return this;
1884
1884
  }
1885
- usage(str2) {
1886
- if (str2 === undefined) {
1885
+ usage(str) {
1886
+ if (str === undefined) {
1887
1887
  if (this._usage)
1888
1888
  return this._usage;
1889
1889
  const args = this.registeredArguments.map((arg) => {
@@ -1891,13 +1891,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1891
1891
  });
1892
1892
  return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
1893
1893
  }
1894
- this._usage = str2;
1894
+ this._usage = str;
1895
1895
  return this;
1896
1896
  }
1897
- name(str2) {
1898
- if (str2 === undefined)
1897
+ name(str) {
1898
+ if (str === undefined)
1899
1899
  return this._name;
1900
- this._name = str2;
1900
+ this._name = str;
1901
1901
  return this;
1902
1902
  }
1903
1903
  helpGroup(heading) {
@@ -1956,18 +1956,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
1956
1956
  let hasColors;
1957
1957
  let helpWidth;
1958
1958
  if (error) {
1959
- baseWrite = (str2) => this._outputConfiguration.writeErr(str2);
1959
+ baseWrite = (str) => this._outputConfiguration.writeErr(str);
1960
1960
  hasColors = this._outputConfiguration.getErrHasColors();
1961
1961
  helpWidth = this._outputConfiguration.getErrHelpWidth();
1962
1962
  } else {
1963
- baseWrite = (str2) => this._outputConfiguration.writeOut(str2);
1963
+ baseWrite = (str) => this._outputConfiguration.writeOut(str);
1964
1964
  hasColors = this._outputConfiguration.getOutHasColors();
1965
1965
  helpWidth = this._outputConfiguration.getOutHelpWidth();
1966
1966
  }
1967
- const write = (str2) => {
1967
+ const write = (str) => {
1968
1968
  if (!hasColors)
1969
- str2 = this._outputConfiguration.stripColor(str2);
1970
- return baseWrite(str2);
1969
+ str = this._outputConfiguration.stripColor(str);
1970
+ return baseWrite(str);
1971
1971
  };
1972
1972
  return { error, write, hasColors, helpWidth };
1973
1973
  }
@@ -2102,36 +2102,153 @@ Expecting one of '${allowedValues.join("', '")}'`);
2102
2102
  return true;
2103
2103
  return;
2104
2104
  }
2105
- exports.Command = Command2;
2105
+ exports.Command = Command;
2106
2106
  exports.useColor = useColor;
2107
2107
  });
2108
2108
 
2109
2109
  // node_modules/commander/index.js
2110
- var require_commander2 = __commonJS((exports) => {
2111
- var { Argument: Argument2 } = require_argument2();
2112
- var { Command: Command2 } = require_command2();
2113
- var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error2();
2114
- var { Help: Help2 } = require_help2();
2115
- var { Option: Option2 } = require_option2();
2116
- exports.program = new Command2;
2117
- exports.createCommand = (name) => new Command2(name);
2118
- exports.createOption = (flags, description) => new Option2(flags, description);
2119
- exports.createArgument = (name, description) => new Argument2(name, description);
2120
- exports.Command = Command2;
2121
- exports.Option = Option2;
2122
- exports.Argument = Argument2;
2123
- exports.Help = Help2;
2124
- exports.CommanderError = CommanderError2;
2125
- exports.InvalidArgumentError = InvalidArgumentError2;
2126
- exports.InvalidOptionArgumentError = InvalidArgumentError2;
2110
+ var require_commander = __commonJS((exports) => {
2111
+ var { Argument } = require_argument();
2112
+ var { Command } = require_command();
2113
+ var { CommanderError, InvalidArgumentError } = require_error();
2114
+ var { Help } = require_help();
2115
+ var { Option } = require_option();
2116
+ exports.program = new Command;
2117
+ exports.createCommand = (name) => new Command(name);
2118
+ exports.createOption = (flags, description) => new Option(flags, description);
2119
+ exports.createArgument = (name, description) => new Argument(name, description);
2120
+ exports.Command = Command;
2121
+ exports.Option = Option;
2122
+ exports.Argument = Argument;
2123
+ exports.Help = Help;
2124
+ exports.CommanderError = CommanderError;
2125
+ exports.InvalidArgumentError = InvalidArgumentError;
2126
+ exports.InvalidOptionArgumentError = InvalidArgumentError;
2127
2127
  });
2128
2128
 
2129
+ // src/safe-tmpdir.ts
2130
+ import {
2131
+ lstatSync,
2132
+ mkdirSync,
2133
+ readlinkSync,
2134
+ symlinkSync,
2135
+ unlinkSync
2136
+ } from "node:fs";
2137
+ import { tmpdir } from "node:os";
2138
+ var SHORT_TMPDIR_PREFIX = "/tmp/uip-";
2139
+ var MAX_SAFE_TMPDIR_LEN = 40;
2140
+ var cached;
2141
+ function safeTmpDir() {
2142
+ if (cached !== undefined)
2143
+ return cached;
2144
+ cached = computeSafeTmpDir();
2145
+ return cached;
2146
+ }
2147
+ function computeSafeTmpDir() {
2148
+ const real = tmpdir();
2149
+ if (process.platform === "win32" || real.length <= MAX_SAFE_TMPDIR_LEN) {
2150
+ return withTrailingSeparator(real);
2151
+ }
2152
+ const uid = typeof process.getuid === "function" ? process.getuid() : 0;
2153
+ const linkPath = `${SHORT_TMPDIR_PREFIX}${uid}`;
2154
+ try {
2155
+ ensureSymlink(linkPath, real);
2156
+ return withTrailingSeparator(linkPath);
2157
+ } catch {
2158
+ return withTrailingSeparator(real);
2159
+ }
2160
+ }
2161
+ function ensureSymlink(linkPath, target) {
2162
+ const normalizedTarget = target.replace(/[\\/]+$/, "");
2163
+ let st;
2164
+ try {
2165
+ st = lstatSync(linkPath);
2166
+ } catch {}
2167
+ if (st) {
2168
+ if (st.isSymbolicLink()) {
2169
+ const current = readlinkSync(linkPath).replace(/[\\/]+$/, "");
2170
+ if (current === normalizedTarget)
2171
+ return;
2172
+ unlinkSync(linkPath);
2173
+ } else {}
2174
+ }
2175
+ mkdirSync(target, { recursive: true });
2176
+ symlinkSync(normalizedTarget, linkPath, "dir");
2177
+ }
2178
+ function withTrailingSeparator(p) {
2179
+ return p.endsWith("/") || p.endsWith("\\") ? p : `${p}/`;
2180
+ }
2181
+
2182
+ // node_modules/commander/esm.mjs
2183
+ var import__ = __toESM(require_commander(), 1);
2184
+ var {
2185
+ program,
2186
+ createCommand,
2187
+ createArgument,
2188
+ createOption,
2189
+ CommanderError,
2190
+ InvalidArgumentError,
2191
+ InvalidOptionArgumentError,
2192
+ Command,
2193
+ Argument,
2194
+ Option,
2195
+ Help
2196
+ } = import__.default;
2197
+
2198
+ // src/commander-polyfill.ts
2199
+ if (!Command.prototype.trackedAction) {
2200
+ Command.prototype.trackedAction = function(context, fn) {
2201
+ return this.action(async (...args) => {
2202
+ try {
2203
+ await fn(...args);
2204
+ } catch (error) {
2205
+ const message = error instanceof Error ? error.message : String(error);
2206
+ process.stderr.write(`Result: Failure
2207
+ Message: ${message}
2208
+ `);
2209
+ context.exit(1);
2210
+ }
2211
+ });
2212
+ };
2213
+ }
2214
+
2129
2215
  // node_modules/@uipath/common/dist/index.js
2130
2216
  import { createRequire as createRequire2 } from "node:module";
2131
- import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
2132
- import { dirname } from "node:path";
2217
+ import { existsSync } from "node:fs";
2218
+ import * as fs6 from "node:fs/promises";
2219
+ import * as os2 from "node:os";
2220
+ import * as path2 from "node:path";
2221
+ import process8 from "node:process";
2222
+ import path from "node:path";
2223
+ import { fileURLToPath } from "node:url";
2224
+ import childProcess3 from "node:child_process";
2225
+ import fs5, { constants as fsConstants2 } from "node:fs/promises";
2226
+ import { promisify as promisify2 } from "node:util";
2227
+ import childProcess2 from "node:child_process";
2228
+ import fs4, { constants as fsConstants } from "node:fs/promises";
2229
+ import process2 from "node:process";
2230
+ import os from "node:os";
2231
+ import fs3 from "node:fs";
2232
+ import fs2 from "node:fs";
2233
+ import fs from "node:fs";
2234
+ import process3 from "node:process";
2235
+ import { Buffer as Buffer2 } from "node:buffer";
2236
+ import { promisify } from "node:util";
2237
+ import childProcess from "node:child_process";
2238
+ import { promisify as promisify6 } from "node:util";
2239
+ import process6 from "node:process";
2240
+ import { execFile as execFile6 } from "node:child_process";
2241
+ import { promisify as promisify3 } from "node:util";
2242
+ import process4 from "node:process";
2243
+ import { execFile as execFile3 } from "node:child_process";
2244
+ import process5 from "node:process";
2245
+ import { promisify as promisify4 } from "node:util";
2246
+ import { execFile as execFile4, execFileSync } from "node:child_process";
2247
+ import { promisify as promisify5 } from "node:util";
2248
+ import { execFile as execFile5 } from "node:child_process";
2249
+ import process7 from "node:process";
2250
+ import { execFileSync as execFileSync2 } from "node:child_process";
2133
2251
  import { AsyncLocalStorage } from "node:async_hooks";
2134
- import { execFileSync } from "node:child_process";
2135
2252
  import vm from "vm";
2136
2253
  var __create2 = Object.create;
2137
2254
  var __getProtoOf2 = Object.getPrototypeOf;
@@ -2147,9 +2264,9 @@ var __toESM2 = (mod, isNodeMode, target) => {
2147
2264
  var canCache = mod != null && typeof mod === "object";
2148
2265
  if (canCache) {
2149
2266
  var cache = isNodeMode ? __toESMCache_node2 ??= new WeakMap : __toESMCache_esm2 ??= new WeakMap;
2150
- var cached = cache.get(mod);
2151
- if (cached)
2152
- return cached;
2267
+ var cached2 = cache.get(mod);
2268
+ if (cached2)
2269
+ return cached2;
2153
2270
  }
2154
2271
  target = mod != null ? __create2(__getProtoOf2(mod)) : {};
2155
2272
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target;
@@ -2165,9 +2282,9 @@ var __toESM2 = (mod, isNodeMode, target) => {
2165
2282
  };
2166
2283
  var __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
2167
2284
  var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
2168
- var require_error = __commonJS2((exports) => {
2285
+ var require_error2 = __commonJS2((exports) => {
2169
2286
 
2170
- class CommanderError extends Error {
2287
+ class CommanderError2 extends Error {
2171
2288
  constructor(exitCode, code, message) {
2172
2289
  super(message);
2173
2290
  Error.captureStackTrace(this, this.constructor);
@@ -2178,20 +2295,20 @@ var require_error = __commonJS2((exports) => {
2178
2295
  }
2179
2296
  }
2180
2297
 
2181
- class InvalidArgumentError extends CommanderError {
2298
+ class InvalidArgumentError2 extends CommanderError2 {
2182
2299
  constructor(message) {
2183
2300
  super(1, "commander.invalidArgument", message);
2184
2301
  Error.captureStackTrace(this, this.constructor);
2185
2302
  this.name = this.constructor.name;
2186
2303
  }
2187
2304
  }
2188
- exports.CommanderError = CommanderError;
2189
- exports.InvalidArgumentError = InvalidArgumentError;
2305
+ exports.CommanderError = CommanderError2;
2306
+ exports.InvalidArgumentError = InvalidArgumentError2;
2190
2307
  });
2191
- var require_argument = __commonJS2((exports) => {
2192
- var { InvalidArgumentError } = require_error();
2308
+ var require_argument2 = __commonJS2((exports) => {
2309
+ var { InvalidArgumentError: InvalidArgumentError2 } = require_error2();
2193
2310
 
2194
- class Argument {
2311
+ class Argument2 {
2195
2312
  constructor(name, description) {
2196
2313
  this.description = description || "";
2197
2314
  this.variadic = false;
@@ -2241,7 +2358,7 @@ var require_argument = __commonJS2((exports) => {
2241
2358
  this.argChoices = values.slice();
2242
2359
  this.parseArg = (arg, previous) => {
2243
2360
  if (!this.argChoices.includes(arg)) {
2244
- throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
2361
+ throw new InvalidArgumentError2(`Allowed choices are ${this.argChoices.join(", ")}.`);
2245
2362
  }
2246
2363
  if (this.variadic) {
2247
2364
  return this._collectValue(arg, previous);
@@ -2263,13 +2380,13 @@ var require_argument = __commonJS2((exports) => {
2263
2380
  const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
2264
2381
  return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
2265
2382
  }
2266
- exports.Argument = Argument;
2383
+ exports.Argument = Argument2;
2267
2384
  exports.humanReadableArgName = humanReadableArgName;
2268
2385
  });
2269
- var require_help = __commonJS2((exports) => {
2270
- var { humanReadableArgName } = require_argument();
2386
+ var require_help2 = __commonJS2((exports) => {
2387
+ var { humanReadableArgName } = require_argument2();
2271
2388
 
2272
- class Help {
2389
+ class Help2 {
2273
2390
  constructor() {
2274
2391
  this.helpWidth = undefined;
2275
2392
  this.minWidthToWrap = 40;
@@ -2618,13 +2735,13 @@ ${itemIndentStr}`);
2618
2735
  const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
2619
2736
  return str.replace(sgrPattern, "");
2620
2737
  }
2621
- exports.Help = Help;
2738
+ exports.Help = Help2;
2622
2739
  exports.stripColor = stripColor;
2623
2740
  });
2624
- var require_option = __commonJS2((exports) => {
2625
- var { InvalidArgumentError } = require_error();
2741
+ var require_option2 = __commonJS2((exports) => {
2742
+ var { InvalidArgumentError: InvalidArgumentError2 } = require_error2();
2626
2743
 
2627
- class Option {
2744
+ class Option2 {
2628
2745
  constructor(flags, description) {
2629
2746
  this.flags = flags;
2630
2747
  this.description = description || "";
@@ -2698,7 +2815,7 @@ var require_option = __commonJS2((exports) => {
2698
2815
  this.argChoices = values.slice();
2699
2816
  this.parseArg = (arg, previous) => {
2700
2817
  if (!this.argChoices.includes(arg)) {
2701
- throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
2818
+ throw new InvalidArgumentError2(`Allowed choices are ${this.argChoices.join(", ")}.`);
2702
2819
  }
2703
2820
  if (this.variadic) {
2704
2821
  return this._collectValue(arg, previous);
@@ -2800,10 +2917,10 @@ var require_option = __commonJS2((exports) => {
2800
2917
  throw new Error(`option creation failed due to no flags found in '${flags}'.`);
2801
2918
  return { shortFlag, longFlag };
2802
2919
  }
2803
- exports.Option = Option;
2920
+ exports.Option = Option2;
2804
2921
  exports.DualOptions = DualOptions;
2805
2922
  });
2806
- var require_suggestSimilar = __commonJS2((exports) => {
2923
+ var require_suggestSimilar2 = __commonJS2((exports) => {
2807
2924
  var maxDistance = 3;
2808
2925
  function editDistance(a, b) {
2809
2926
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -2874,19 +2991,19 @@ var require_suggestSimilar = __commonJS2((exports) => {
2874
2991
  }
2875
2992
  exports.suggestSimilar = suggestSimilar;
2876
2993
  });
2877
- var require_command = __commonJS2((exports) => {
2994
+ var require_command2 = __commonJS2((exports) => {
2878
2995
  var EventEmitter = __require2("node:events").EventEmitter;
2879
- var childProcess = __require2("node:child_process");
2880
- var path = __require2("node:path");
2881
- var fs = __require2("node:fs");
2882
- var process2 = __require2("node:process");
2883
- var { Argument, humanReadableArgName } = require_argument();
2884
- var { CommanderError } = require_error();
2885
- var { Help, stripColor } = require_help();
2886
- var { Option, DualOptions } = require_option();
2887
- var { suggestSimilar } = require_suggestSimilar();
2996
+ var childProcess4 = __require2("node:child_process");
2997
+ var path3 = __require2("node:path");
2998
+ var fs7 = __require2("node:fs");
2999
+ var process22 = __require2("node:process");
3000
+ var { Argument: Argument2, humanReadableArgName } = require_argument2();
3001
+ var { CommanderError: CommanderError2 } = require_error2();
3002
+ var { Help: Help2, stripColor } = require_help2();
3003
+ var { Option: Option2, DualOptions } = require_option2();
3004
+ var { suggestSimilar } = require_suggestSimilar2();
2888
3005
 
2889
- class Command extends EventEmitter {
3006
+ class Command2 extends EventEmitter {
2890
3007
  constructor(name) {
2891
3008
  super();
2892
3009
  this.commands = [];
@@ -2922,13 +3039,13 @@ var require_command = __commonJS2((exports) => {
2922
3039
  this._showSuggestionAfterError = true;
2923
3040
  this._savedState = null;
2924
3041
  this._outputConfiguration = {
2925
- writeOut: (str) => process2.stdout.write(str),
2926
- writeErr: (str) => process2.stderr.write(str),
3042
+ writeOut: (str) => process22.stdout.write(str),
3043
+ writeErr: (str) => process22.stderr.write(str),
2927
3044
  outputError: (str, write) => write(str),
2928
- getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
2929
- getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
2930
- getOutHasColors: () => useColor() ?? (process2.stdout.isTTY && process2.stdout.hasColors?.()),
2931
- getErrHasColors: () => useColor() ?? (process2.stderr.isTTY && process2.stderr.hasColors?.()),
3045
+ getOutHelpWidth: () => process22.stdout.isTTY ? process22.stdout.columns : undefined,
3046
+ getErrHelpWidth: () => process22.stderr.isTTY ? process22.stderr.columns : undefined,
3047
+ getOutHasColors: () => useColor() ?? (process22.stdout.isTTY && process22.stdout.hasColors?.()),
3048
+ getErrHasColors: () => useColor() ?? (process22.stderr.isTTY && process22.stderr.hasColors?.()),
2932
3049
  stripColor: (str) => stripColor(str)
2933
3050
  };
2934
3051
  this._hidden = false;
@@ -2989,10 +3106,10 @@ var require_command = __commonJS2((exports) => {
2989
3106
  return cmd;
2990
3107
  }
2991
3108
  createCommand(name) {
2992
- return new Command(name);
3109
+ return new Command2(name);
2993
3110
  }
2994
3111
  createHelp() {
2995
- return Object.assign(new Help, this.configureHelp());
3112
+ return Object.assign(new Help2, this.configureHelp());
2996
3113
  }
2997
3114
  configureHelp(configuration) {
2998
3115
  if (configuration === undefined)
@@ -3035,7 +3152,7 @@ var require_command = __commonJS2((exports) => {
3035
3152
  return this;
3036
3153
  }
3037
3154
  createArgument(name, description) {
3038
- return new Argument(name, description);
3155
+ return new Argument2(name, description);
3039
3156
  }
3040
3157
  argument(name, description, parseArg, defaultValue) {
3041
3158
  const argument = this.createArgument(name, description);
@@ -3134,9 +3251,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3134
3251
  }
3135
3252
  _exit(exitCode, code, message) {
3136
3253
  if (this._exitCallback) {
3137
- this._exitCallback(new CommanderError(exitCode, code, message));
3254
+ this._exitCallback(new CommanderError2(exitCode, code, message));
3138
3255
  }
3139
- process2.exit(exitCode);
3256
+ process22.exit(exitCode);
3140
3257
  }
3141
3258
  action(fn) {
3142
3259
  const listener = (args) => {
@@ -3154,7 +3271,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3154
3271
  return this;
3155
3272
  }
3156
3273
  createOption(flags, description) {
3157
- return new Option(flags, description);
3274
+ return new Option2(flags, description);
3158
3275
  }
3159
3276
  _callParseArg(target, value, previous, invalidArgumentMessage) {
3160
3277
  try {
@@ -3236,7 +3353,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3236
3353
  return this;
3237
3354
  }
3238
3355
  _optionEx(config, flags, description, fn, defaultValue) {
3239
- if (typeof flags === "object" && flags instanceof Option) {
3356
+ if (typeof flags === "object" && flags instanceof Option2) {
3240
3357
  throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
3241
3358
  }
3242
3359
  const option = this.createOption(flags, description);
@@ -3333,16 +3450,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
3333
3450
  }
3334
3451
  parseOptions = parseOptions || {};
3335
3452
  if (argv === undefined && parseOptions.from === undefined) {
3336
- if (process2.versions?.electron) {
3453
+ if (process22.versions?.electron) {
3337
3454
  parseOptions.from = "electron";
3338
3455
  }
3339
- const execArgv = process2.execArgv ?? [];
3456
+ const execArgv = process22.execArgv ?? [];
3340
3457
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
3341
3458
  parseOptions.from = "eval";
3342
3459
  }
3343
3460
  }
3344
3461
  if (argv === undefined) {
3345
- argv = process2.argv;
3462
+ argv = process22.argv;
3346
3463
  }
3347
3464
  this.rawArgs = argv.slice();
3348
3465
  let userArgs;
@@ -3353,7 +3470,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3353
3470
  userArgs = argv.slice(2);
3354
3471
  break;
3355
3472
  case "electron":
3356
- if (process2.defaultApp) {
3473
+ if (process22.defaultApp) {
3357
3474
  this._scriptPath = argv[1];
3358
3475
  userArgs = argv.slice(2);
3359
3476
  } else {
@@ -3413,7 +3530,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3413
3530
  this.processedArgs = [];
3414
3531
  }
3415
3532
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
3416
- if (fs.existsSync(executableFile))
3533
+ if (fs7.existsSync(executableFile))
3417
3534
  return;
3418
3535
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
3419
3536
  const executableMissing = `'${executableFile}' does not exist
@@ -3427,12 +3544,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
3427
3544
  let launchWithNode = false;
3428
3545
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
3429
3546
  function findFile(baseDir, baseName) {
3430
- const localBin = path.resolve(baseDir, baseName);
3431
- if (fs.existsSync(localBin))
3547
+ const localBin = path3.resolve(baseDir, baseName);
3548
+ if (fs7.existsSync(localBin))
3432
3549
  return localBin;
3433
- if (sourceExt.includes(path.extname(baseName)))
3550
+ if (sourceExt.includes(path3.extname(baseName)))
3434
3551
  return;
3435
- const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
3552
+ const foundExt = sourceExt.find((ext) => fs7.existsSync(`${localBin}${ext}`));
3436
3553
  if (foundExt)
3437
3554
  return `${localBin}${foundExt}`;
3438
3555
  return;
@@ -3444,42 +3561,42 @@ Expecting one of '${allowedValues.join("', '")}'`);
3444
3561
  if (this._scriptPath) {
3445
3562
  let resolvedScriptPath;
3446
3563
  try {
3447
- resolvedScriptPath = fs.realpathSync(this._scriptPath);
3564
+ resolvedScriptPath = fs7.realpathSync(this._scriptPath);
3448
3565
  } catch {
3449
3566
  resolvedScriptPath = this._scriptPath;
3450
3567
  }
3451
- executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
3568
+ executableDir = path3.resolve(path3.dirname(resolvedScriptPath), executableDir);
3452
3569
  }
3453
3570
  if (executableDir) {
3454
3571
  let localFile = findFile(executableDir, executableFile);
3455
3572
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
3456
- const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
3573
+ const legacyName = path3.basename(this._scriptPath, path3.extname(this._scriptPath));
3457
3574
  if (legacyName !== this._name) {
3458
3575
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
3459
3576
  }
3460
3577
  }
3461
3578
  executableFile = localFile || executableFile;
3462
3579
  }
3463
- launchWithNode = sourceExt.includes(path.extname(executableFile));
3580
+ launchWithNode = sourceExt.includes(path3.extname(executableFile));
3464
3581
  let proc;
3465
- if (process2.platform !== "win32") {
3582
+ if (process22.platform !== "win32") {
3466
3583
  if (launchWithNode) {
3467
3584
  args.unshift(executableFile);
3468
- args = incrementNodeInspectorPort(process2.execArgv).concat(args);
3469
- proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
3585
+ args = incrementNodeInspectorPort(process22.execArgv).concat(args);
3586
+ proc = childProcess4.spawn(process22.argv[0], args, { stdio: "inherit" });
3470
3587
  } else {
3471
- proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
3588
+ proc = childProcess4.spawn(executableFile, args, { stdio: "inherit" });
3472
3589
  }
3473
3590
  } else {
3474
3591
  this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
3475
3592
  args.unshift(executableFile);
3476
- args = incrementNodeInspectorPort(process2.execArgv).concat(args);
3477
- proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
3593
+ args = incrementNodeInspectorPort(process22.execArgv).concat(args);
3594
+ proc = childProcess4.spawn(process22.execPath, args, { stdio: "inherit" });
3478
3595
  }
3479
3596
  if (!proc.killed) {
3480
3597
  const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
3481
3598
  signals.forEach((signal) => {
3482
- process2.on(signal, () => {
3599
+ process22.on(signal, () => {
3483
3600
  if (proc.killed === false && proc.exitCode === null) {
3484
3601
  proc.kill(signal);
3485
3602
  }
@@ -3490,9 +3607,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3490
3607
  proc.on("close", (code) => {
3491
3608
  code = code ?? 1;
3492
3609
  if (!exitCallback) {
3493
- process2.exit(code);
3610
+ process22.exit(code);
3494
3611
  } else {
3495
- exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
3612
+ exitCallback(new CommanderError2(code, "commander.executeSubCommandAsync", "(close)"));
3496
3613
  }
3497
3614
  });
3498
3615
  proc.on("error", (err) => {
@@ -3502,9 +3619,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3502
3619
  throw new Error(`'${executableFile}' not executable`);
3503
3620
  }
3504
3621
  if (!exitCallback) {
3505
- process2.exit(1);
3622
+ process22.exit(1);
3506
3623
  } else {
3507
- const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
3624
+ const wrappedError = new CommanderError2(1, "commander.executeSubCommandAsync", "(error)");
3508
3625
  wrappedError.nestedError = err;
3509
3626
  exitCallback(wrappedError);
3510
3627
  }
@@ -3851,11 +3968,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
3851
3968
  }
3852
3969
  _parseOptionsEnv() {
3853
3970
  this.options.forEach((option) => {
3854
- if (option.envVar && option.envVar in process2.env) {
3971
+ if (option.envVar && option.envVar in process22.env) {
3855
3972
  const optionKey = option.attributeName();
3856
3973
  if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
3857
3974
  if (option.required || option.optional) {
3858
- this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
3975
+ this.emit(`optionEnv:${option.name()}`, process22.env[option.envVar]);
3859
3976
  } else {
3860
3977
  this.emit(`optionEnv:${option.name()}`);
3861
3978
  }
@@ -4049,13 +4166,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
4049
4166
  cmd.helpGroup(this._defaultCommandGroup);
4050
4167
  }
4051
4168
  nameFromFilename(filename) {
4052
- this._name = path.basename(filename, path.extname(filename));
4169
+ this._name = path3.basename(filename, path3.extname(filename));
4053
4170
  return this;
4054
4171
  }
4055
- executableDir(path2) {
4056
- if (path2 === undefined)
4172
+ executableDir(path22) {
4173
+ if (path22 === undefined)
4057
4174
  return this._executableDir;
4058
- this._executableDir = path2;
4175
+ this._executableDir = path22;
4059
4176
  return this;
4060
4177
  }
4061
4178
  helpInformation(contextOptions) {
@@ -4152,7 +4269,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4152
4269
  }
4153
4270
  help(contextOptions) {
4154
4271
  this.outputHelp(contextOptions);
4155
- let exitCode = Number(process2.exitCode ?? 0);
4272
+ let exitCode = Number(process22.exitCode ?? 0);
4156
4273
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
4157
4274
  exitCode = 1;
4158
4275
  }
@@ -4218,47 +4335,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
4218
4335
  });
4219
4336
  }
4220
4337
  function useColor() {
4221
- if (process2.env.NO_COLOR || process2.env.FORCE_COLOR === "0" || process2.env.FORCE_COLOR === "false")
4338
+ if (process22.env.NO_COLOR || process22.env.FORCE_COLOR === "0" || process22.env.FORCE_COLOR === "false")
4222
4339
  return false;
4223
- if (process2.env.FORCE_COLOR || process2.env.CLICOLOR_FORCE !== undefined)
4340
+ if (process22.env.FORCE_COLOR || process22.env.CLICOLOR_FORCE !== undefined)
4224
4341
  return true;
4225
4342
  return;
4226
4343
  }
4227
- exports.Command = Command;
4344
+ exports.Command = Command2;
4228
4345
  exports.useColor = useColor;
4229
4346
  });
4230
- var require_commander = __commonJS2((exports) => {
4231
- var { Argument } = require_argument();
4232
- var { Command } = require_command();
4233
- var { CommanderError, InvalidArgumentError } = require_error();
4234
- var { Help } = require_help();
4235
- var { Option } = require_option();
4236
- exports.program = new Command;
4237
- exports.createCommand = (name) => new Command(name);
4238
- exports.createOption = (flags, description) => new Option(flags, description);
4239
- exports.createArgument = (name, description) => new Argument(name, description);
4240
- exports.Command = Command;
4241
- exports.Option = Option;
4242
- exports.Argument = Argument;
4243
- exports.Help = Help;
4244
- exports.CommanderError = CommanderError;
4245
- exports.InvalidArgumentError = InvalidArgumentError;
4246
- exports.InvalidOptionArgumentError = InvalidArgumentError;
4347
+ var require_commander2 = __commonJS2((exports) => {
4348
+ var { Argument: Argument2 } = require_argument2();
4349
+ var { Command: Command2 } = require_command2();
4350
+ var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error2();
4351
+ var { Help: Help2 } = require_help2();
4352
+ var { Option: Option2 } = require_option2();
4353
+ exports.program = new Command2;
4354
+ exports.createCommand = (name) => new Command2(name);
4355
+ exports.createOption = (flags, description) => new Option2(flags, description);
4356
+ exports.createArgument = (name, description) => new Argument2(name, description);
4357
+ exports.Command = Command2;
4358
+ exports.Option = Option2;
4359
+ exports.Argument = Argument2;
4360
+ exports.Help = Help2;
4361
+ exports.CommanderError = CommanderError2;
4362
+ exports.InvalidArgumentError = InvalidArgumentError2;
4363
+ exports.InvalidOptionArgumentError = InvalidArgumentError2;
4247
4364
  });
4365
+ function isPromiseLike(value) {
4366
+ return value !== null && typeof value === "object" && typeof value.then === "function";
4367
+ }
4248
4368
  function catchError(fnOrPromise) {
4249
- if (fnOrPromise instanceof Promise) {
4250
- return fnOrPromise.then((data) => [undefined, data]).catch((error) => [
4251
- error instanceof Error ? error : new Error(String(error)),
4252
- undefined
4253
- ]);
4369
+ if (isPromiseLike(fnOrPromise)) {
4370
+ return settlePromiseLike(fnOrPromise);
4254
4371
  }
4255
4372
  try {
4256
4373
  const result = fnOrPromise();
4257
- if (result instanceof Promise) {
4258
- return result.then((data) => [undefined, data]).catch((error) => [
4259
- error instanceof Error ? error : new Error(String(error)),
4260
- undefined
4261
- ]);
4374
+ if (isPromiseLike(result)) {
4375
+ return settlePromiseLike(result);
4262
4376
  }
4263
4377
  return [undefined, result];
4264
4378
  } catch (error) {
@@ -4268,20 +4382,31 @@ function catchError(fnOrPromise) {
4268
4382
  ];
4269
4383
  }
4270
4384
  }
4271
- var import__ = __toESM2(require_commander(), 1);
4385
+ function settlePromiseLike(thenable) {
4386
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
4387
+ error instanceof Error ? error : new Error(String(error)),
4388
+ undefined
4389
+ ]);
4390
+ }
4391
+ var import__2 = __toESM2(require_commander2(), 1);
4272
4392
  var {
4273
- program,
4274
- createCommand,
4275
- createArgument,
4276
- createOption,
4277
- CommanderError,
4278
- InvalidArgumentError,
4279
- InvalidOptionArgumentError,
4280
- Command,
4281
- Argument,
4282
- Option,
4283
- Help
4284
- } = import__.default;
4393
+ program: program2,
4394
+ createCommand: createCommand2,
4395
+ createArgument: createArgument2,
4396
+ createOption: createOption2,
4397
+ CommanderError: CommanderError2,
4398
+ InvalidArgumentError: InvalidArgumentError2,
4399
+ InvalidOptionArgumentError: InvalidOptionArgumentError2,
4400
+ Command: Command2,
4401
+ Argument: Argument2,
4402
+ Option: Option2,
4403
+ Help: Help2
4404
+ } = import__2.default;
4405
+ var examplesByCommand = new WeakMap;
4406
+ Command2.prototype.examples = function(examples) {
4407
+ examplesByCommand.set(this, examples);
4408
+ return this;
4409
+ };
4285
4410
  var isObject = (obj) => {
4286
4411
  return obj !== null && Object.prototype.toString.call(obj) === "[object Object]";
4287
4412
  };
@@ -8885,6 +9010,669 @@ var dump = dumper.dump;
8885
9010
  var safeLoad = renamed("safeLoad", "load");
8886
9011
  var safeLoadAll = renamed("safeLoadAll", "loadAll");
8887
9012
  var safeDump = renamed("safeDump", "dump");
9013
+ var isDockerCached;
9014
+ function hasDockerEnv() {
9015
+ try {
9016
+ fs.statSync("/.dockerenv");
9017
+ return true;
9018
+ } catch {
9019
+ return false;
9020
+ }
9021
+ }
9022
+ function hasDockerCGroup() {
9023
+ try {
9024
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
9025
+ } catch {
9026
+ return false;
9027
+ }
9028
+ }
9029
+ function isDocker() {
9030
+ if (isDockerCached === undefined) {
9031
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
9032
+ }
9033
+ return isDockerCached;
9034
+ }
9035
+ var cachedResult;
9036
+ var hasContainerEnv = () => {
9037
+ try {
9038
+ fs2.statSync("/run/.containerenv");
9039
+ return true;
9040
+ } catch {
9041
+ return false;
9042
+ }
9043
+ };
9044
+ function isInsideContainer() {
9045
+ if (cachedResult === undefined) {
9046
+ cachedResult = hasContainerEnv() || isDocker();
9047
+ }
9048
+ return cachedResult;
9049
+ }
9050
+ var isWsl = () => {
9051
+ if (process2.platform !== "linux") {
9052
+ return false;
9053
+ }
9054
+ if (os.release().toLowerCase().includes("microsoft")) {
9055
+ if (isInsideContainer()) {
9056
+ return false;
9057
+ }
9058
+ return true;
9059
+ }
9060
+ try {
9061
+ if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
9062
+ return !isInsideContainer();
9063
+ }
9064
+ } catch {}
9065
+ if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
9066
+ return !isInsideContainer();
9067
+ }
9068
+ return false;
9069
+ };
9070
+ var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
9071
+ var execFile = promisify(childProcess.execFile);
9072
+ var powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
9073
+ var executePowerShell = async (command, options = {}) => {
9074
+ const {
9075
+ powerShellPath: psPath,
9076
+ ...execFileOptions
9077
+ } = options;
9078
+ const encodedCommand = executePowerShell.encodeCommand(command);
9079
+ return execFile(psPath ?? powerShellPath(), [
9080
+ ...executePowerShell.argumentsPrefix,
9081
+ encodedCommand
9082
+ ], {
9083
+ encoding: "utf8",
9084
+ ...execFileOptions
9085
+ });
9086
+ };
9087
+ executePowerShell.argumentsPrefix = [
9088
+ "-NoProfile",
9089
+ "-NonInteractive",
9090
+ "-ExecutionPolicy",
9091
+ "Bypass",
9092
+ "-EncodedCommand"
9093
+ ];
9094
+ executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
9095
+ executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
9096
+ function parseMountPointFromConfig(content) {
9097
+ for (const line of content.split(`
9098
+ `)) {
9099
+ if (/^\s*#/.test(line)) {
9100
+ continue;
9101
+ }
9102
+ const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
9103
+ if (!match) {
9104
+ continue;
9105
+ }
9106
+ return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
9107
+ }
9108
+ }
9109
+ var execFile2 = promisify2(childProcess2.execFile);
9110
+ var wslDrivesMountPoint = (() => {
9111
+ const defaultMountPoint = "/mnt/";
9112
+ let mountPoint;
9113
+ return async function() {
9114
+ if (mountPoint) {
9115
+ return mountPoint;
9116
+ }
9117
+ const configFilePath = "/etc/wsl.conf";
9118
+ let isConfigFileExists = false;
9119
+ try {
9120
+ await fs4.access(configFilePath, fsConstants.F_OK);
9121
+ isConfigFileExists = true;
9122
+ } catch {}
9123
+ if (!isConfigFileExists) {
9124
+ return defaultMountPoint;
9125
+ }
9126
+ const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
9127
+ const parsedMountPoint = parseMountPointFromConfig(configContent);
9128
+ if (parsedMountPoint === undefined) {
9129
+ return defaultMountPoint;
9130
+ }
9131
+ mountPoint = parsedMountPoint;
9132
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
9133
+ return mountPoint;
9134
+ };
9135
+ })();
9136
+ var powerShellPathFromWsl = async () => {
9137
+ const mountPoint = await wslDrivesMountPoint();
9138
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
9139
+ };
9140
+ var powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
9141
+ var canAccessPowerShellPromise;
9142
+ var canAccessPowerShell = async () => {
9143
+ canAccessPowerShellPromise ??= (async () => {
9144
+ try {
9145
+ const psPath = await powerShellPath2();
9146
+ await fs4.access(psPath, fsConstants.X_OK);
9147
+ return true;
9148
+ } catch {
9149
+ return false;
9150
+ }
9151
+ })();
9152
+ return canAccessPowerShellPromise;
9153
+ };
9154
+ var wslDefaultBrowser = async () => {
9155
+ const psPath = await powerShellPath2();
9156
+ const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
9157
+ const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
9158
+ return stdout.trim();
9159
+ };
9160
+ var convertWslPathToWindows = async (path3) => {
9161
+ if (/^[a-z]+:\/\//i.test(path3)) {
9162
+ return path3;
9163
+ }
9164
+ try {
9165
+ const { stdout } = await execFile2("wslpath", ["-aw", path3], { encoding: "utf8" });
9166
+ return stdout.trim();
9167
+ } catch {
9168
+ return path3;
9169
+ }
9170
+ };
9171
+ function defineLazyProperty(object, propertyName, valueGetter) {
9172
+ const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
9173
+ Object.defineProperty(object, propertyName, {
9174
+ configurable: true,
9175
+ enumerable: true,
9176
+ get() {
9177
+ const result = valueGetter();
9178
+ define(result);
9179
+ return result;
9180
+ },
9181
+ set(value) {
9182
+ define(value);
9183
+ }
9184
+ });
9185
+ return object;
9186
+ }
9187
+ var execFileAsync = promisify3(execFile3);
9188
+ async function defaultBrowserId() {
9189
+ if (process4.platform !== "darwin") {
9190
+ throw new Error("macOS only");
9191
+ }
9192
+ const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
9193
+ const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
9194
+ const browserId = match?.groups.id ?? "com.apple.Safari";
9195
+ if (browserId === "com.apple.safari") {
9196
+ return "com.apple.Safari";
9197
+ }
9198
+ return browserId;
9199
+ }
9200
+ var execFileAsync2 = promisify4(execFile4);
9201
+ async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
9202
+ if (process5.platform !== "darwin") {
9203
+ throw new Error("macOS only");
9204
+ }
9205
+ const outputArguments = humanReadableOutput ? [] : ["-ss"];
9206
+ const execOptions = {};
9207
+ if (signal) {
9208
+ execOptions.signal = signal;
9209
+ }
9210
+ const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
9211
+ return stdout.trim();
9212
+ }
9213
+ async function bundleName(bundleId) {
9214
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
9215
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
9216
+ }
9217
+ var execFileAsync3 = promisify5(execFile5);
9218
+ var windowsBrowserProgIds = {
9219
+ MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
9220
+ MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
9221
+ MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
9222
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
9223
+ ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
9224
+ ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
9225
+ ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
9226
+ ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
9227
+ BraveHTML: { name: "Brave", id: "com.brave.Browser" },
9228
+ BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
9229
+ BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
9230
+ BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
9231
+ FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
9232
+ OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
9233
+ VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
9234
+ "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
9235
+ };
9236
+ var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
9237
+
9238
+ class UnknownBrowserError extends Error {
9239
+ }
9240
+ async function defaultBrowser(_execFileAsync = execFileAsync3) {
9241
+ const { stdout } = await _execFileAsync("reg", [
9242
+ "QUERY",
9243
+ " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
9244
+ "/v",
9245
+ "ProgId"
9246
+ ]);
9247
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
9248
+ if (!match) {
9249
+ throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
9250
+ }
9251
+ const { id } = match.groups;
9252
+ const dotIndex = id.lastIndexOf(".");
9253
+ const hyphenIndex = id.lastIndexOf("-");
9254
+ const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
9255
+ const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
9256
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
9257
+ }
9258
+ var execFileAsync4 = promisify6(execFile6);
9259
+ var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
9260
+ async function defaultBrowser2() {
9261
+ if (process6.platform === "darwin") {
9262
+ const id = await defaultBrowserId();
9263
+ const name = await bundleName(id);
9264
+ return { name, id };
9265
+ }
9266
+ if (process6.platform === "linux") {
9267
+ const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
9268
+ const id = stdout.trim();
9269
+ const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
9270
+ return { name, id };
9271
+ }
9272
+ if (process6.platform === "win32") {
9273
+ return defaultBrowser();
9274
+ }
9275
+ throw new Error("Only macOS, Linux, and Windows are supported");
9276
+ }
9277
+ var isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
9278
+ var is_in_ssh_default = isInSsh;
9279
+ var fallbackAttemptSymbol = Symbol("fallbackAttempt");
9280
+ var __dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
9281
+ var localXdgOpenPath = path.join(__dirname2, "xdg-open");
9282
+ var { platform, arch } = process8;
9283
+ var tryEachApp = async (apps, opener) => {
9284
+ if (apps.length === 0) {
9285
+ return;
9286
+ }
9287
+ const errors = [];
9288
+ for (const app of apps) {
9289
+ try {
9290
+ return await opener(app);
9291
+ } catch (error) {
9292
+ errors.push(error);
9293
+ }
9294
+ }
9295
+ throw new AggregateError(errors, "Failed to open in all supported apps");
9296
+ };
9297
+ var baseOpen = async (options) => {
9298
+ options = {
9299
+ wait: false,
9300
+ background: false,
9301
+ newInstance: false,
9302
+ allowNonzeroExitCode: false,
9303
+ ...options
9304
+ };
9305
+ const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
9306
+ delete options[fallbackAttemptSymbol];
9307
+ if (Array.isArray(options.app)) {
9308
+ return tryEachApp(options.app, (singleApp) => baseOpen({
9309
+ ...options,
9310
+ app: singleApp,
9311
+ [fallbackAttemptSymbol]: true
9312
+ }));
9313
+ }
9314
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
9315
+ appArguments = [...appArguments];
9316
+ if (Array.isArray(app)) {
9317
+ return tryEachApp(app, (appName) => baseOpen({
9318
+ ...options,
9319
+ app: {
9320
+ name: appName,
9321
+ arguments: appArguments
9322
+ },
9323
+ [fallbackAttemptSymbol]: true
9324
+ }));
9325
+ }
9326
+ if (app === "browser" || app === "browserPrivate") {
9327
+ const ids = {
9328
+ "com.google.chrome": "chrome",
9329
+ "google-chrome.desktop": "chrome",
9330
+ "com.brave.browser": "brave",
9331
+ "org.mozilla.firefox": "firefox",
9332
+ "firefox.desktop": "firefox",
9333
+ "com.microsoft.msedge": "edge",
9334
+ "com.microsoft.edge": "edge",
9335
+ "com.microsoft.edgemac": "edge",
9336
+ "microsoft-edge.desktop": "edge",
9337
+ "com.apple.safari": "safari"
9338
+ };
9339
+ const flags = {
9340
+ chrome: "--incognito",
9341
+ brave: "--incognito",
9342
+ firefox: "--private-window",
9343
+ edge: "--inPrivate"
9344
+ };
9345
+ let browser;
9346
+ if (is_wsl_default) {
9347
+ const progId = await wslDefaultBrowser();
9348
+ const browserInfo = _windowsBrowserProgIdMap.get(progId);
9349
+ browser = browserInfo ?? {};
9350
+ } else {
9351
+ browser = await defaultBrowser2();
9352
+ }
9353
+ if (browser.id in ids) {
9354
+ const browserName = ids[browser.id.toLowerCase()];
9355
+ if (app === "browserPrivate") {
9356
+ if (browserName === "safari") {
9357
+ throw new Error("Safari doesn't support opening in private mode via command line");
9358
+ }
9359
+ appArguments.push(flags[browserName]);
9360
+ }
9361
+ return baseOpen({
9362
+ ...options,
9363
+ app: {
9364
+ name: apps[browserName],
9365
+ arguments: appArguments
9366
+ }
9367
+ });
9368
+ }
9369
+ throw new Error(`${browser.name} is not supported as a default browser`);
9370
+ }
9371
+ let command;
9372
+ const cliArguments = [];
9373
+ const childProcessOptions = {};
9374
+ let shouldUseWindowsInWsl = false;
9375
+ if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
9376
+ shouldUseWindowsInWsl = await canAccessPowerShell();
9377
+ }
9378
+ if (platform === "darwin") {
9379
+ command = "open";
9380
+ if (options.wait) {
9381
+ cliArguments.push("--wait-apps");
9382
+ }
9383
+ if (options.background) {
9384
+ cliArguments.push("--background");
9385
+ }
9386
+ if (options.newInstance) {
9387
+ cliArguments.push("--new");
9388
+ }
9389
+ if (app) {
9390
+ cliArguments.push("-a", app);
9391
+ }
9392
+ } else if (platform === "win32" || shouldUseWindowsInWsl) {
9393
+ command = await powerShellPath2();
9394
+ cliArguments.push(...executePowerShell.argumentsPrefix);
9395
+ if (!is_wsl_default) {
9396
+ childProcessOptions.windowsVerbatimArguments = true;
9397
+ }
9398
+ if (is_wsl_default && options.target) {
9399
+ options.target = await convertWslPathToWindows(options.target);
9400
+ }
9401
+ const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
9402
+ if (options.wait) {
9403
+ encodedArguments.push("-Wait");
9404
+ }
9405
+ if (app) {
9406
+ encodedArguments.push(executePowerShell.escapeArgument(app));
9407
+ if (options.target) {
9408
+ appArguments.push(options.target);
9409
+ }
9410
+ } else if (options.target) {
9411
+ encodedArguments.push(executePowerShell.escapeArgument(options.target));
9412
+ }
9413
+ if (appArguments.length > 0) {
9414
+ appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
9415
+ encodedArguments.push("-ArgumentList", appArguments.join(","));
9416
+ }
9417
+ options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
9418
+ if (!options.wait) {
9419
+ childProcessOptions.stdio = "ignore";
9420
+ }
9421
+ } else {
9422
+ if (app) {
9423
+ command = app;
9424
+ } else {
9425
+ const isBundled = !__dirname2 || __dirname2 === "/";
9426
+ let exeLocalXdgOpen = false;
9427
+ try {
9428
+ await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
9429
+ exeLocalXdgOpen = true;
9430
+ } catch {}
9431
+ const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
9432
+ command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
9433
+ }
9434
+ if (appArguments.length > 0) {
9435
+ cliArguments.push(...appArguments);
9436
+ }
9437
+ if (!options.wait) {
9438
+ childProcessOptions.stdio = "ignore";
9439
+ childProcessOptions.detached = true;
9440
+ }
9441
+ }
9442
+ if (platform === "darwin" && appArguments.length > 0) {
9443
+ cliArguments.push("--args", ...appArguments);
9444
+ }
9445
+ if (options.target) {
9446
+ cliArguments.push(options.target);
9447
+ }
9448
+ const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
9449
+ if (options.wait) {
9450
+ return new Promise((resolve2, reject) => {
9451
+ subprocess.once("error", reject);
9452
+ subprocess.once("close", (exitCode) => {
9453
+ if (!options.allowNonzeroExitCode && exitCode !== 0) {
9454
+ reject(new Error(`Exited with code ${exitCode}`));
9455
+ return;
9456
+ }
9457
+ resolve2(subprocess);
9458
+ });
9459
+ });
9460
+ }
9461
+ if (isFallbackAttempt) {
9462
+ return new Promise((resolve2, reject) => {
9463
+ subprocess.once("error", reject);
9464
+ subprocess.once("spawn", () => {
9465
+ subprocess.once("close", (exitCode) => {
9466
+ subprocess.off("error", reject);
9467
+ if (exitCode !== 0) {
9468
+ reject(new Error(`Exited with code ${exitCode}`));
9469
+ return;
9470
+ }
9471
+ subprocess.unref();
9472
+ resolve2(subprocess);
9473
+ });
9474
+ });
9475
+ });
9476
+ }
9477
+ subprocess.unref();
9478
+ return new Promise((resolve2, reject) => {
9479
+ subprocess.once("error", reject);
9480
+ subprocess.once("spawn", () => {
9481
+ subprocess.off("error", reject);
9482
+ resolve2(subprocess);
9483
+ });
9484
+ });
9485
+ };
9486
+ var open = (target, options) => {
9487
+ if (typeof target !== "string") {
9488
+ throw new TypeError("Expected a `target`");
9489
+ }
9490
+ return baseOpen({
9491
+ ...options,
9492
+ target
9493
+ });
9494
+ };
9495
+ function detectArchBinary(binary2) {
9496
+ if (typeof binary2 === "string" || Array.isArray(binary2)) {
9497
+ return binary2;
9498
+ }
9499
+ const { [arch]: archBinary } = binary2;
9500
+ if (!archBinary) {
9501
+ throw new Error(`${arch} is not supported`);
9502
+ }
9503
+ return archBinary;
9504
+ }
9505
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
9506
+ if (wsl && is_wsl_default) {
9507
+ return detectArchBinary(wsl);
9508
+ }
9509
+ if (!platformBinary) {
9510
+ throw new Error(`${platform} is not supported`);
9511
+ }
9512
+ return detectArchBinary(platformBinary);
9513
+ }
9514
+ var apps = {
9515
+ browser: "browser",
9516
+ browserPrivate: "browserPrivate"
9517
+ };
9518
+ defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
9519
+ darwin: "google chrome",
9520
+ win32: "chrome",
9521
+ linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
9522
+ }, {
9523
+ wsl: {
9524
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
9525
+ x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
9526
+ }
9527
+ }));
9528
+ defineLazyProperty(apps, "brave", () => detectPlatformBinary({
9529
+ darwin: "brave browser",
9530
+ win32: "brave",
9531
+ linux: ["brave-browser", "brave"]
9532
+ }, {
9533
+ wsl: {
9534
+ ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
9535
+ x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
9536
+ }
9537
+ }));
9538
+ defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
9539
+ darwin: "firefox",
9540
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
9541
+ linux: "firefox"
9542
+ }, {
9543
+ wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
9544
+ }));
9545
+ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
9546
+ darwin: "microsoft edge",
9547
+ win32: "msedge",
9548
+ linux: ["microsoft-edge", "microsoft-edge-dev"]
9549
+ }, {
9550
+ wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
9551
+ }));
9552
+ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
9553
+ darwin: "Safari"
9554
+ }));
9555
+ var open_default = open;
9556
+
9557
+ class NodeFileSystem {
9558
+ path = {
9559
+ join: path2.join,
9560
+ resolve: path2.resolve,
9561
+ relative: path2.relative,
9562
+ dirname: path2.dirname,
9563
+ isAbsolute: path2.isAbsolute,
9564
+ basename: path2.basename
9565
+ };
9566
+ env = {
9567
+ cwd: process.cwd,
9568
+ homedir: os2.homedir,
9569
+ tmpdir: os2.tmpdir,
9570
+ getenv: (key) => process.env[key]
9571
+ };
9572
+ utils = {
9573
+ open: async (url) => {
9574
+ await open_default(url);
9575
+ }
9576
+ };
9577
+ async readFile(path3, options) {
9578
+ try {
9579
+ if (options) {
9580
+ return await fs6.readFile(path3, "utf-8");
9581
+ }
9582
+ return await fs6.readFile(path3);
9583
+ } catch (error) {
9584
+ if (this.isEnoent(error))
9585
+ return null;
9586
+ throw error;
9587
+ }
9588
+ }
9589
+ async writeFile(filePath, data) {
9590
+ const dir = path2.dirname(filePath);
9591
+ if (dir) {
9592
+ await fs6.mkdir(dir, { recursive: true });
9593
+ }
9594
+ await fs6.writeFile(filePath, data);
9595
+ }
9596
+ async appendFile(filePath, data) {
9597
+ const dir = path2.dirname(filePath);
9598
+ if (dir) {
9599
+ await fs6.mkdir(dir, { recursive: true });
9600
+ }
9601
+ await fs6.appendFile(filePath, data);
9602
+ }
9603
+ async readdir(dirPath) {
9604
+ try {
9605
+ return await fs6.readdir(dirPath);
9606
+ } catch (error) {
9607
+ if (this.isEnoent(error))
9608
+ return [];
9609
+ throw error;
9610
+ }
9611
+ }
9612
+ async stat(filePath) {
9613
+ try {
9614
+ const stats = await fs6.stat(filePath);
9615
+ return {
9616
+ isFile: () => stats.isFile(),
9617
+ isDirectory: () => stats.isDirectory(),
9618
+ size: stats.size,
9619
+ mtimeMs: stats.mtimeMs
9620
+ };
9621
+ } catch (error) {
9622
+ if (this.isEnoent(error))
9623
+ return null;
9624
+ throw error;
9625
+ }
9626
+ }
9627
+ async exists(filePath) {
9628
+ return existsSync(filePath);
9629
+ }
9630
+ async mkdir(dirPath) {
9631
+ await fs6.mkdir(dirPath, { recursive: true });
9632
+ }
9633
+ async rm(filePath) {
9634
+ await fs6.rm(filePath, { recursive: true, force: true });
9635
+ }
9636
+ async rename(oldPath, newPath) {
9637
+ await fs6.rename(oldPath, newPath);
9638
+ }
9639
+ async getTempDir() {
9640
+ return await fs6.mkdtemp(path2.join(os2.tmpdir(), "uipath-fs-"));
9641
+ }
9642
+ async copyDirectory(sourcePath, destPath) {
9643
+ const sourceStats = await this.stat(sourcePath);
9644
+ if (!sourceStats) {
9645
+ throw new Error(`Source directory does not exist: ${sourcePath}`);
9646
+ }
9647
+ if (!sourceStats.isDirectory()) {
9648
+ throw new Error(`Source path is not a directory: ${sourcePath}`);
9649
+ }
9650
+ await this.mkdir(destPath);
9651
+ const entries = await this.readdir(sourcePath);
9652
+ for (const entry of entries) {
9653
+ const srcEntry = path2.join(sourcePath, entry);
9654
+ const destEntry = path2.join(destPath, entry);
9655
+ const entryStats = await this.stat(srcEntry);
9656
+ if (!entryStats)
9657
+ continue;
9658
+ if (entryStats.isDirectory()) {
9659
+ await this.copyDirectory(srcEntry, destEntry);
9660
+ } else if (entryStats.isFile()) {
9661
+ const content = await this.readFile(srcEntry);
9662
+ if (content !== null) {
9663
+ await this.writeFile(destEntry, content);
9664
+ }
9665
+ }
9666
+ }
9667
+ }
9668
+ isEnoent(error) {
9669
+ return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
9670
+ }
9671
+ }
9672
+ var fsInstance = new NodeFileSystem;
9673
+ var getFileSystem = () => {
9674
+ return fsInstance;
9675
+ };
8888
9676
  var PREFIX = "@uipath/common/";
8889
9677
  var _g = globalThis;
8890
9678
  function singleton(ctorOrName) {
@@ -8915,7 +9703,7 @@ function singleton(ctorOrName) {
8915
9703
  }
8916
9704
  function createStorage() {
8917
9705
  const [error, mod2] = catchError(() => __require2("node:async_hooks"));
8918
- if (error) {
9706
+ if (error || typeof mod2?.AsyncLocalStorage !== "function") {
8919
9707
  return {
8920
9708
  getStore: () => {
8921
9709
  return;
@@ -8942,8 +9730,8 @@ function getOutputSink() {
8942
9730
  return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
8943
9731
  }
8944
9732
  var logFilePathSlot = singleton("logFilePath");
8945
- function setGlobalLogFilePath(path) {
8946
- logFilePathSlot.set(path);
9733
+ function setGlobalLogFilePath(path3) {
9734
+ logFilePathSlot.set(path3);
8947
9735
  }
8948
9736
  function getGlobalLogFilePath() {
8949
9737
  return logFilePathSlot.get("");
@@ -8962,6 +9750,8 @@ class SimpleLogger {
8962
9750
  level;
8963
9751
  logFilePath;
8964
9752
  fileLoggingEnabled;
9753
+ pendingWrites = Promise.resolve();
9754
+ pendingInit = Promise.resolve();
8965
9755
  constructor() {
8966
9756
  this.level = SimpleLogger.resolveLevel();
8967
9757
  this.logFilePath = "";
@@ -8976,7 +9766,7 @@ class SimpleLogger {
8976
9766
  static isNode = typeof process !== "undefined" && !!process.versions?.node;
8977
9767
  static resolveLevel() {
8978
9768
  if (SimpleLogger.isNode) {
8979
- const explicitLevel = SimpleLogger.parseLevel(process.env?.UIPCLI_LOG_LEVEL ?? "");
9769
+ const explicitLevel = SimpleLogger.parseLevel(process.env?.UIP_LOG_LEVEL ?? "");
8980
9770
  if (explicitLevel !== undefined)
8981
9771
  return explicitLevel;
8982
9772
  const debugVal = process.env?.DEBUG;
@@ -9016,11 +9806,14 @@ class SimpleLogger {
9016
9806
  return this.fileLoggingEnabled || !!getGlobalLogFilePath();
9017
9807
  }
9018
9808
  writeToFile(formatted) {
9019
- const path = this.logFilePath || getGlobalLogFilePath();
9020
- if (!path)
9809
+ const path3 = this.logFilePath || getGlobalLogFilePath();
9810
+ if (!path3)
9021
9811
  return;
9022
9812
  const timestamp2 = new Date().toISOString();
9023
- catchError(() => appendFileSync(path, `${timestamp2} ${formatted}`));
9813
+ this.pendingWrites = Promise.all([
9814
+ this.pendingWrites,
9815
+ this.pendingInit
9816
+ ]).then(() => getFileSystem().appendFile(path3, `${timestamp2} ${formatted}`).catch(() => {}));
9024
9817
  }
9025
9818
  debug(message, ...args) {
9026
9819
  if (this.level > 0)
@@ -9075,16 +9868,25 @@ class SimpleLogger {
9075
9868
  setGlobalLogFilePath("");
9076
9869
  }
9077
9870
  }
9078
- setLogFile(path) {
9079
- this.logFilePath = path;
9080
- setGlobalLogFilePath(path);
9081
- if (!path)
9871
+ setLogFile(path3) {
9872
+ this.logFilePath = path3;
9873
+ setGlobalLogFilePath(path3);
9874
+ if (!path3)
9082
9875
  return;
9083
- const [error] = catchError(() => {
9084
- mkdirSync(dirname(path), { recursive: true });
9085
- writeFileSync(path, "");
9086
- });
9087
- this.fileLoggingEnabled = !error;
9876
+ this.fileLoggingEnabled = true;
9877
+ const fs7 = getFileSystem();
9878
+ this.pendingInit = (async () => {
9879
+ const [error] = await catchError((async () => {
9880
+ await fs7.mkdir(fs7.path.dirname(path3));
9881
+ await fs7.writeFile(path3, "");
9882
+ })());
9883
+ if (error)
9884
+ this.fileLoggingEnabled = false;
9885
+ })();
9886
+ }
9887
+ async flushFile() {
9888
+ await this.pendingInit;
9889
+ await this.pendingWrites;
9088
9890
  }
9089
9891
  getLogFilePath() {
9090
9892
  return this.logFilePath || getGlobalLogFilePath();
@@ -9126,12 +9928,75 @@ function setOutputFormat(format) {
9126
9928
  formatSlot.set(format);
9127
9929
  }
9128
9930
  function getOutputFormat() {
9129
- return formatSlot.get("table");
9931
+ return formatSlot.get("json");
9130
9932
  }
9131
9933
  function getOutputFilter() {
9132
9934
  return filterSlot.get();
9133
9935
  }
9936
+ var CommonTelemetryEvents = {
9937
+ Error: "uip.error"
9938
+ };
9939
+ function readRegistryValue(keyPath, valueName) {
9940
+ if (process.platform !== "win32") {
9941
+ return "";
9942
+ }
9943
+ const [error, output] = catchError(() => execFileSync2("reg", ["query", keyPath, "/v", valueName], {
9944
+ encoding: "utf-8",
9945
+ stdio: ["pipe", "pipe", "pipe"]
9946
+ }));
9947
+ if (error) {
9948
+ return "";
9949
+ }
9950
+ const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
9951
+ return match?.[1]?.trim() ?? "";
9952
+ }
9134
9953
 
9954
+ class LoggerTelemetryProvider {
9955
+ analyticsUniqueId;
9956
+ constructor() {
9957
+ this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
9958
+ }
9959
+ enrich(properties) {
9960
+ return {
9961
+ ...properties,
9962
+ ...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
9963
+ };
9964
+ }
9965
+ async trackEvent(eventName, properties) {
9966
+ logger.debug(formatMessage("Event", eventName, this.enrich(properties)));
9967
+ }
9968
+ async trackException(error, properties) {
9969
+ logger.error(formatMessage("Exception", error.message, this.enrich({
9970
+ ...properties,
9971
+ stack: error.stack
9972
+ })));
9973
+ }
9974
+ async trackRequest(name, duration, success, properties) {
9975
+ logger.debug(formatMessage("Request", name, this.enrich({
9976
+ ...properties,
9977
+ duration: `${duration}ms`,
9978
+ success
9979
+ })));
9980
+ }
9981
+ async trackDependency(name, type2, duration, success, properties) {
9982
+ logger.debug(formatMessage("Dependency", name, this.enrich({
9983
+ ...properties,
9984
+ type: type2,
9985
+ duration: `${duration}ms`,
9986
+ success
9987
+ })));
9988
+ }
9989
+ }
9990
+ function formatMessage(category, name, properties) {
9991
+ let message = `[Telemetry] [${category}] ${name}`;
9992
+ if (properties && Object.keys(properties).length > 0) {
9993
+ const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
9994
+ if (propsStr) {
9995
+ message += ` | ${propsStr}`;
9996
+ }
9997
+ }
9998
+ return message;
9999
+ }
9135
10000
  class NodeContextStorage {
9136
10001
  storage = new AsyncLocalStorage;
9137
10002
  run(context, fn) {
@@ -9229,67 +10094,6 @@ class TelemetryService {
9229
10094
  return crypto.randomUUID().replaceAll("-", "");
9230
10095
  }
9231
10096
  }
9232
- function readRegistryValue(keyPath, valueName) {
9233
- if (process.platform !== "win32") {
9234
- return "";
9235
- }
9236
- const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
9237
- encoding: "utf-8",
9238
- stdio: ["pipe", "pipe", "pipe"]
9239
- }));
9240
- if (error) {
9241
- return "";
9242
- }
9243
- const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
9244
- return match?.[1]?.trim() ?? "";
9245
- }
9246
-
9247
- class LoggerTelemetryProvider {
9248
- analyticsUniqueId;
9249
- constructor() {
9250
- this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
9251
- }
9252
- enrich(properties) {
9253
- return {
9254
- ...properties,
9255
- ...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
9256
- };
9257
- }
9258
- async trackEvent(eventName, properties) {
9259
- logger.debug(formatMessage("Event", eventName, this.enrich(properties)));
9260
- }
9261
- async trackException(error, properties) {
9262
- logger.error(formatMessage("Exception", error.message, this.enrich({
9263
- ...properties,
9264
- stack: error.stack
9265
- })));
9266
- }
9267
- async trackRequest(name, duration, success, properties) {
9268
- logger.debug(formatMessage("Request", name, this.enrich({
9269
- ...properties,
9270
- duration: `${duration}ms`,
9271
- success
9272
- })));
9273
- }
9274
- async trackDependency(name, type2, duration, success, properties) {
9275
- logger.debug(formatMessage("Dependency", name, this.enrich({
9276
- ...properties,
9277
- type: type2,
9278
- duration: `${duration}ms`,
9279
- success
9280
- })));
9281
- }
9282
- }
9283
- function formatMessage(category, name, properties) {
9284
- let message = `[Telemetry] [${category}] ${name}`;
9285
- if (properties && Object.keys(properties).length > 0) {
9286
- const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
9287
- if (propsStr) {
9288
- message += ` | ${propsStr}`;
9289
- }
9290
- }
9291
- return message;
9292
- }
9293
10097
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
9294
10098
  var providerSlot = singleton("TelemetryProvider");
9295
10099
  function setGlobalTelemetryProperties(properties) {
@@ -9299,9 +10103,18 @@ function setGlobalTelemetryProperties(properties) {
9299
10103
  function getGlobalTelemetryProperties() {
9300
10104
  return telemetryPropsSlot.get();
9301
10105
  }
10106
+ function toOperationUrn(name) {
10107
+ if (URL.canParse(name))
10108
+ return name;
10109
+ const sanitized = encodeURIComponent(name).replace(/%2F/g, "/");
10110
+ return `urn:uip:${sanitized}`;
10111
+ }
9302
10112
  async function loadApplicationInsights() {
9303
10113
  const savedDebug = process.env.DEBUG;
9304
10114
  delete process.env.DEBUG;
10115
+ if (process.env.APPLICATION_INSIGHTS_DISABLE_WARNING_LOGS === undefined) {
10116
+ process.env.APPLICATION_INSIGHTS_DISABLE_WARNING_LOGS = "1";
10117
+ }
9305
10118
  const [error, mod2] = await catchError(import("applicationinsights"));
9306
10119
  if (savedDebug !== undefined) {
9307
10120
  process.env.DEBUG = savedDebug;
@@ -9340,6 +10153,11 @@ class NodeAppInsightsTelemetryProvider {
9340
10153
  getSessionId() {
9341
10154
  return this._sessionId;
9342
10155
  }
10156
+ setApplicationVersion(version) {
10157
+ if (!this.client)
10158
+ return;
10159
+ this.client.context.tags[this.client.context.keys.applicationVersion] = version;
10160
+ }
9343
10161
  mergeProperties(properties) {
9344
10162
  const globalProps = getGlobalTelemetryProperties();
9345
10163
  if (!globalProps && !properties)
@@ -9380,14 +10198,17 @@ class NodeAppInsightsTelemetryProvider {
9380
10198
  if (!client)
9381
10199
  return;
9382
10200
  const merged = this.mergeProperties(properties);
9383
- client.trackRequest({
10201
+ const [trackError] = catchError(() => client.trackRequest({
9384
10202
  name,
9385
- url: name,
10203
+ url: toOperationUrn(name),
9386
10204
  duration,
9387
10205
  resultCode: success ? "200" : "500",
9388
10206
  success,
9389
10207
  properties: merged
9390
- });
10208
+ }));
10209
+ if (trackError) {
10210
+ logger.debug(`[AppInsights] trackRequest failed for: ${name}`);
10211
+ }
9391
10212
  }
9392
10213
  async trackDependency(name, type2, duration, success, properties) {
9393
10214
  const client = this.client;
@@ -9409,18 +10230,18 @@ class NodeAppInsightsTelemetryProvider {
9409
10230
  logger.warn(`[AppInsights] flush error (non-fatal): nil client`);
9410
10231
  return;
9411
10232
  }
9412
- const [error] = await catchError(new Promise((resolve, reject) => {
10233
+ const [error] = await catchError(new Promise((resolve2, reject) => {
9413
10234
  client.flush({
9414
10235
  callback: (response) => {
9415
10236
  if (!response) {
9416
- resolve();
10237
+ resolve2();
9417
10238
  return;
9418
10239
  }
9419
10240
  const [parseError, parsed] = catchError(() => JSON.parse(response));
9420
10241
  if (parseError || parsed?.errors && parsed.errors.length > 0) {
9421
10242
  reject(new Error(response));
9422
10243
  } else {
9423
- resolve();
10244
+ resolve2();
9424
10245
  }
9425
10246
  }
9426
10247
  });
@@ -9466,7 +10287,7 @@ async function getOrCreateProvider(connectionString) {
9466
10287
  return initPromise;
9467
10288
  }
9468
10289
  var telemetryInstanceSlot = singleton("TelemetryService");
9469
- var DEFAULT_AI_CONNECTION_STRING = Buffer.from("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj", "base64").toString("utf-8");
10290
+ var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
9470
10291
  function getConnectionString() {
9471
10292
  return process.env.UIPATH_AI_CONNECTION_STRING || DEFAULT_AI_CONNECTION_STRING;
9472
10293
  }
@@ -9523,16 +10344,19 @@ var telemetry = new Proxy({}, {
9523
10344
  return typeof value === "function" ? value.bind(instance) : value;
9524
10345
  }
9525
10346
  });
9526
- async function telemetryInit(defaultProperties) {
10347
+ async function telemetryInit(options) {
9527
10348
  const { provider, name: providerName } = await createTelemetryProvider();
9528
10349
  const instance = new TelemetryService(provider, new NodeContextStorage);
9529
10350
  setGlobalTelemetryInstance(instance);
9530
10351
  _localTelemetryInstance = instance;
9531
- if (defaultProperties) {
9532
- setGlobalTelemetryProperties(defaultProperties);
9533
- telemetry.setDefaultProperties(defaultProperties);
9534
- }
9535
10352
  const isAppInsights = providerName === "NodeAppInsightsTelemetryProvider";
10353
+ if (options?.version && isAppInsights) {
10354
+ provider.setApplicationVersion(options.version);
10355
+ }
10356
+ if (options?.defaultProperties) {
10357
+ setGlobalTelemetryProperties(options.defaultProperties);
10358
+ telemetry.setDefaultProperties(options.defaultProperties);
10359
+ }
9536
10360
  if (!isAppInsights) {
9537
10361
  logger.debug(`[Telemetry] initialized with fallback provider (${providerName}). applicationinsights package not available.`);
9538
10362
  }
@@ -9542,8 +10366,8 @@ async function telemetryFlushAndShutdown() {
9542
10366
  if (telemetryProviderInstance && "shutdown" in telemetryProviderInstance) {
9543
10367
  const provider = telemetryProviderInstance;
9544
10368
  let timer;
9545
- const timeout = new Promise((resolve) => {
9546
- timer = setTimeout(() => resolve("timeout"), FLUSH_SHUTDOWN_TIMEOUT_MS);
10369
+ const timeout = new Promise((resolve2) => {
10370
+ timer = setTimeout(() => resolve2("timeout"), FLUSH_SHUTDOWN_TIMEOUT_MS);
9547
10371
  });
9548
10372
  const result = await Promise.race([
9549
10373
  provider.flush().then(() => provider.shutdown()).then(() => "done"),
@@ -9556,10 +10380,39 @@ async function telemetryFlushAndShutdown() {
9556
10380
  }
9557
10381
  }
9558
10382
  }
9559
- var CommonTelemetryEvents = {
9560
- Error: "uip.error"
10383
+ var RESULTS = {
10384
+ Success: "Success",
10385
+ Failure: "Failure",
10386
+ ConfigError: "ConfigError",
10387
+ AuthenticationError: "AuthenticationError",
10388
+ ValidationError: "ValidationError",
10389
+ TimeoutError: "TimeoutError"
9561
10390
  };
9562
- function printOutput(data, format = "table", logFn) {
10391
+ var EXIT_CODES = {
10392
+ Success: 0,
10393
+ Failure: 1,
10394
+ ConfigError: 1,
10395
+ AuthenticationError: 2,
10396
+ ValidationError: 3,
10397
+ TimeoutError: 4
10398
+ };
10399
+
10400
+ class SuccessOutput {
10401
+ Result = RESULTS.Success;
10402
+ Code;
10403
+ Data;
10404
+ Instructions;
10405
+ Log;
10406
+ constructor(code, data) {
10407
+ this.Code = code;
10408
+ this.Data = data;
10409
+ const logPath = getLogFilePath();
10410
+ if (logPath) {
10411
+ this.Log = logPath;
10412
+ }
10413
+ }
10414
+ }
10415
+ function printOutput(data, format = "json", logFn) {
9563
10416
  if (!data) {
9564
10417
  logFn("Empty response object. No data to display.");
9565
10418
  return;
@@ -9599,7 +10452,7 @@ function printOutput(data, format = "table", logFn) {
9599
10452
  }
9600
10453
  }
9601
10454
  }
9602
- function logOutput(data, format = "table") {
10455
+ function logOutput(data, format = "json") {
9603
10456
  const sink = getOutputSink();
9604
10457
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
9605
10458
  `));
@@ -9755,6 +10608,7 @@ var OutputFormatter;
9755
10608
  OutputFormatter2.success = success;
9756
10609
  function error(data) {
9757
10610
  data.Log ??= getLogFilePath() || undefined;
10611
+ process.exitCode = EXIT_CODES[data.Result] ?? 1;
9758
10612
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
9759
10613
  result: data.Result,
9760
10614
  message: data.Message
@@ -9762,6 +10616,21 @@ var OutputFormatter;
9762
10616
  logOutput(data, getOutputFormat());
9763
10617
  }
9764
10618
  OutputFormatter2.error = error;
10619
+ function emitList(code, items, opts) {
10620
+ const data = {
10621
+ Result: RESULTS.Success,
10622
+ Code: code,
10623
+ Data: items
10624
+ };
10625
+ if (items.length === 0 && opts?.emptyInstructions) {
10626
+ data.Instructions = opts.emptyInstructions;
10627
+ }
10628
+ if (opts?.warning) {
10629
+ data.Warning = opts.warning;
10630
+ }
10631
+ success(data);
10632
+ }
10633
+ OutputFormatter2.emitList = emitList;
9765
10634
  function log(data) {
9766
10635
  const format = getOutputFormat();
9767
10636
  const sink = getOutputSink();
@@ -9790,6 +10659,7 @@ var OutputFormatter;
9790
10659
  }
9791
10660
  OutputFormatter2.formatToString = formatToString;
9792
10661
  })(OutputFormatter ||= {});
10662
+ var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
9793
10663
  var guardInstalledSlot = singleton("ConsoleGuardInstalled");
9794
10664
  var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
9795
10665
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
@@ -10875,8 +11745,8 @@ JSONPath.prototype._getPreferredOutput = function(ea) {
10875
11745
  const resultType = this.currResultType;
10876
11746
  switch (resultType) {
10877
11747
  case "all": {
10878
- const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
10879
- ea.pointer = JSONPath.toPointer(path);
11748
+ const path3 = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
11749
+ ea.pointer = JSONPath.toPointer(path3);
10880
11750
  ea.path = typeof ea.path === "string" ? ea.path : JSONPath.toPathString(ea.path);
10881
11751
  return ea;
10882
11752
  }
@@ -10899,11 +11769,11 @@ JSONPath.prototype._handleCallback = function(fullRetObj, callback, type2) {
10899
11769
  callback(preferredOutput, type2, fullRetObj);
10900
11770
  }
10901
11771
  };
10902
- JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
11772
+ JSONPath.prototype._trace = function(expr, val, path3, parent, parentPropName, callback, hasArrExpr, literalPriority) {
10903
11773
  let retObj;
10904
11774
  if (!expr.length) {
10905
11775
  retObj = {
10906
- path,
11776
+ path: path3,
10907
11777
  value: val,
10908
11778
  parent,
10909
11779
  parentProperty: parentPropName,
@@ -10924,28 +11794,28 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
10924
11794
  }
10925
11795
  }
10926
11796
  if ((typeof loc !== "string" || literalPriority) && val && Object.hasOwn(val, loc)) {
10927
- addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr));
11797
+ addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr));
10928
11798
  } else if (loc === "*") {
10929
11799
  this._walk(val, (m) => {
10930
- addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));
11800
+ addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true, true));
10931
11801
  });
10932
11802
  } else if (loc === "..") {
10933
- addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));
11803
+ addRet(this._trace(x, val, path3, parent, parentPropName, callback, hasArrExpr));
10934
11804
  this._walk(val, (m) => {
10935
11805
  if (typeof val[m] === "object") {
10936
- addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));
11806
+ addRet(this._trace(expr.slice(), val[m], push(path3, m), val, m, callback, true));
10937
11807
  }
10938
11808
  });
10939
11809
  } else if (loc === "^") {
10940
11810
  this._hasParentSelector = true;
10941
11811
  return {
10942
- path: path.slice(0, -1),
11812
+ path: path3.slice(0, -1),
10943
11813
  expr: x,
10944
11814
  isParentSelector: true
10945
11815
  };
10946
11816
  } else if (loc === "~") {
10947
11817
  retObj = {
10948
- path: push(path, loc),
11818
+ path: push(path3, loc),
10949
11819
  value: parentPropName,
10950
11820
  parent,
10951
11821
  parentProperty: null
@@ -10953,9 +11823,9 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
10953
11823
  this._handleCallback(retObj, callback, "property");
10954
11824
  return retObj;
10955
11825
  } else if (loc === "$") {
10956
- addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));
11826
+ addRet(this._trace(x, val, path3, null, null, callback, hasArrExpr));
10957
11827
  } else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
10958
- addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));
11828
+ addRet(this._slice(loc, x, val, path3, parent, parentPropName, callback));
10959
11829
  } else if (loc.indexOf("?(") === 0) {
10960
11830
  if (this.currEval === false) {
10961
11831
  throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
@@ -10966,15 +11836,15 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
10966
11836
  this._walk(val, (m) => {
10967
11837
  const npath = [nested[2]];
10968
11838
  const nvalue = nested[1] ? val[m][nested[1]] : val[m];
10969
- const filterResults = this._trace(npath, nvalue, path, parent, parentPropName, callback, true);
11839
+ const filterResults = this._trace(npath, nvalue, path3, parent, parentPropName, callback, true);
10970
11840
  if (filterResults.length > 0) {
10971
- addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
11841
+ addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
10972
11842
  }
10973
11843
  });
10974
11844
  } else {
10975
11845
  this._walk(val, (m) => {
10976
- if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) {
10977
- addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
11846
+ if (this._eval(safeLoc, val[m], m, path3, parent, parentPropName)) {
11847
+ addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
10978
11848
  }
10979
11849
  });
10980
11850
  }
@@ -10982,7 +11852,7 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
10982
11852
  if (this.currEval === false) {
10983
11853
  throw new Error("Eval [(expr)] prevented in JSONPath expression.");
10984
11854
  }
10985
- addRet(this._trace(unshift(this._eval(loc, val, path.at(-1), path.slice(0, -1), parent, parentPropName), x), val, path, parent, parentPropName, callback, hasArrExpr));
11855
+ addRet(this._trace(unshift(this._eval(loc, val, path3.at(-1), path3.slice(0, -1), parent, parentPropName), x), val, path3, parent, parentPropName, callback, hasArrExpr));
10986
11856
  } else if (loc[0] === "@") {
10987
11857
  let addType = false;
10988
11858
  const valueType = loc.slice(1, -2);
@@ -11026,7 +11896,7 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
11026
11896
  }
11027
11897
  break;
11028
11898
  case "other":
11029
- addType = this.currOtherTypeCallback(val, path, parent, parentPropName);
11899
+ addType = this.currOtherTypeCallback(val, path3, parent, parentPropName);
11030
11900
  break;
11031
11901
  case "null":
11032
11902
  if (val === null) {
@@ -11038,7 +11908,7 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
11038
11908
  }
11039
11909
  if (addType) {
11040
11910
  retObj = {
11041
- path,
11911
+ path: path3,
11042
11912
  value: val,
11043
11913
  parent,
11044
11914
  parentProperty: parentPropName
@@ -11048,14 +11918,14 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
11048
11918
  }
11049
11919
  } else if (loc[0] === "`" && val && Object.hasOwn(val, loc.slice(1))) {
11050
11920
  const locProp = loc.slice(1);
11051
- addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));
11921
+ addRet(this._trace(x, val[locProp], push(path3, locProp), val, locProp, callback, hasArrExpr, true));
11052
11922
  } else if (loc.includes(",")) {
11053
11923
  const parts = loc.split(",");
11054
11924
  for (const part of parts) {
11055
- addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));
11925
+ addRet(this._trace(unshift(part, x), val, path3, parent, parentPropName, callback, true));
11056
11926
  }
11057
11927
  } else if (!literalPriority && val && Object.hasOwn(val, loc)) {
11058
- addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));
11928
+ addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr, true));
11059
11929
  }
11060
11930
  if (this._hasParentSelector) {
11061
11931
  for (let t = 0;t < ret.length; t++) {
@@ -11089,7 +11959,7 @@ JSONPath.prototype._walk = function(val, f) {
11089
11959
  });
11090
11960
  }
11091
11961
  };
11092
- JSONPath.prototype._slice = function(loc, expr, val, path, parent, parentPropName, callback) {
11962
+ JSONPath.prototype._slice = function(loc, expr, val, path3, parent, parentPropName, callback) {
11093
11963
  if (!Array.isArray(val)) {
11094
11964
  return;
11095
11965
  }
@@ -11099,14 +11969,14 @@ JSONPath.prototype._slice = function(loc, expr, val, path, parent, parentPropNam
11099
11969
  end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
11100
11970
  const ret = [];
11101
11971
  for (let i2 = start;i2 < end; i2 += step) {
11102
- const tmp = this._trace(unshift(i2, expr), val, path, parent, parentPropName, callback, true);
11972
+ const tmp = this._trace(unshift(i2, expr), val, path3, parent, parentPropName, callback, true);
11103
11973
  tmp.forEach((t) => {
11104
11974
  ret.push(t);
11105
11975
  });
11106
11976
  }
11107
11977
  return ret;
11108
11978
  };
11109
- JSONPath.prototype._eval = function(code, _v, _vname, path, parent, parentPropName) {
11979
+ JSONPath.prototype._eval = function(code, _v, _vname, path3, parent, parentPropName) {
11110
11980
  this.currSandbox._$_parentProperty = parentPropName;
11111
11981
  this.currSandbox._$_parent = parent;
11112
11982
  this.currSandbox._$_property = _vname;
@@ -11114,7 +11984,7 @@ JSONPath.prototype._eval = function(code, _v, _vname, path, parent, parentPropNa
11114
11984
  this.currSandbox._$_v = _v;
11115
11985
  const containsPath = code.includes("@path");
11116
11986
  if (containsPath) {
11117
- this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));
11987
+ this.currSandbox._$_path = JSONPath.toPathString(path3.concat([_vname]));
11118
11988
  }
11119
11989
  const scriptCacheKey = this.currEval + "Script:" + code;
11120
11990
  if (!JSONPath.cache[scriptCacheKey]) {
@@ -11219,7 +12089,150 @@ var ScreenLogger;
11219
12089
  ScreenLogger2.progress = progress;
11220
12090
  })(ScreenLogger ||= {});
11221
12091
  var factorySlot = singleton("PackagerFactoryProvider");
12092
+ var REDACTED = "[REDACTED]";
12093
+ var MAX_VALUE_LENGTH = 200;
12094
+ var SENSITIVE_NAME_TOKENS = new Set([
12095
+ "token",
12096
+ "tokens",
12097
+ "secret",
12098
+ "secrets",
12099
+ "password",
12100
+ "passwords",
12101
+ "pwd",
12102
+ "credential",
12103
+ "credentials",
12104
+ "auth",
12105
+ "authentication",
12106
+ "authorization",
12107
+ "authority",
12108
+ "cert",
12109
+ "certificate",
12110
+ "certificates"
12111
+ ]);
12112
+ var SENSITIVE_KEY_PREFIXES = new Set([
12113
+ "api",
12114
+ "access",
12115
+ "client",
12116
+ "private",
12117
+ "public",
12118
+ "signing",
12119
+ "encryption",
12120
+ "session",
12121
+ "master",
12122
+ "shared",
12123
+ "root",
12124
+ "ssh",
12125
+ "rsa",
12126
+ "aes",
12127
+ "hmac",
12128
+ "oauth"
12129
+ ]);
12130
+ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
12131
+ var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
12132
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
12133
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
12134
+ var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
12135
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
12136
+ var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
12137
+ function shortHash(input) {
12138
+ let hash = 2166136261;
12139
+ for (let i2 = 0;i2 < input.length; i2++) {
12140
+ hash ^= input.charCodeAt(i2);
12141
+ hash = Math.imul(hash, 16777619);
12142
+ }
12143
+ return (hash >>> 0).toString(16).padStart(8, "0");
12144
+ }
12145
+ function redactUrl(raw) {
12146
+ try {
12147
+ const url = new URL(raw);
12148
+ return `${url.protocol}//${url.host}`;
12149
+ } catch {
12150
+ return `url#${shortHash(raw)}`;
12151
+ }
12152
+ }
12153
+ function redactValueDetectors(value) {
12154
+ let out = value;
12155
+ out = out.replace(JWT_PATTERN, () => REDACTED);
12156
+ out = out.replace(URL_PATTERN, (match) => {
12157
+ const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
12158
+ const core2 = trailing ? match.slice(0, -trailing.length) : match;
12159
+ return `${redactUrl(core2)}${trailing}`;
12160
+ });
12161
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
12162
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
12163
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
12164
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
12165
+ if (out.length > MAX_VALUE_LENGTH) {
12166
+ out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
12167
+ }
12168
+ return out;
12169
+ }
12170
+ function nameTokens(name) {
12171
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((t) => t.toLowerCase()).filter(Boolean);
12172
+ }
12173
+ function isSensitiveName(name) {
12174
+ const tokens = nameTokens(name);
12175
+ for (let i2 = 0;i2 < tokens.length; i2++) {
12176
+ const token = tokens[i2];
12177
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
12178
+ return true;
12179
+ }
12180
+ if (token === "key" || token === "keys") {
12181
+ const prev = tokens[i2 - 1];
12182
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
12183
+ return true;
12184
+ }
12185
+ }
12186
+ }
12187
+ return false;
12188
+ }
12189
+ function redactProperty(name, value) {
12190
+ if (value === undefined || value === null) {
12191
+ return;
12192
+ }
12193
+ if (isSensitiveName(name)) {
12194
+ return REDACTED;
12195
+ }
12196
+ if (typeof value === "boolean" || typeof value === "number") {
12197
+ return value;
12198
+ }
12199
+ if (typeof value !== "string") {
12200
+ return "[OBJECT]";
12201
+ }
12202
+ return redactValueDetectors(value);
12203
+ }
12204
+ function redactProperties(properties) {
12205
+ const out = {};
12206
+ for (const [name, value] of Object.entries(properties)) {
12207
+ const redacted = redactProperty(name, value);
12208
+ if (redacted !== undefined) {
12209
+ out[name] = redacted;
12210
+ }
12211
+ }
12212
+ return out;
12213
+ }
11222
12214
  var pollSignalSlot = singleton("PollSignal");
12215
+ function extractCommandParams(cmd) {
12216
+ const params = {};
12217
+ const registered = cmd.registeredArguments ?? [];
12218
+ const processed = cmd.processedArgs ?? [];
12219
+ for (let i2 = 0;i2 < registered.length; i2++) {
12220
+ const value = processed[i2];
12221
+ if (value === undefined) {
12222
+ continue;
12223
+ }
12224
+ const name = registered[i2].name();
12225
+ if (name) {
12226
+ params[name] = value;
12227
+ }
12228
+ }
12229
+ for (const [key, value] of Object.entries(cmd.opts())) {
12230
+ if (value !== undefined) {
12231
+ params[key] = value;
12232
+ }
12233
+ }
12234
+ return params;
12235
+ }
11223
12236
  function deriveCommandPath(cmd) {
11224
12237
  const parts = [];
11225
12238
  let current = cmd;
@@ -11235,7 +12248,7 @@ function deriveCommandPath(cmd) {
11235
12248
  }
11236
12249
  return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
11237
12250
  }
11238
- Command.prototype.trackedAction = function(context, fn, properties) {
12251
+ Command2.prototype.trackedAction = function(context, fn, properties) {
11239
12252
  const command = this;
11240
12253
  return this.action(async (...args) => {
11241
12254
  const telemetryName = deriveCommandPath(command);
@@ -11247,7 +12260,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
11247
12260
  errorMessage = error instanceof Error ? error.message : String(error);
11248
12261
  logger.error(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
11249
12262
  OutputFormatter.error({
11250
- Result: "Failure",
12263
+ Result: RESULTS.Failure,
11251
12264
  Message: errorMessage,
11252
12265
  Instructions: "An unexpected error occurred. Run with --log-level debug for details."
11253
12266
  });
@@ -11255,31 +12268,16 @@ Command.prototype.trackedAction = function(context, fn, properties) {
11255
12268
  }
11256
12269
  const durationMs = performance.now() - startTime;
11257
12270
  const success = !error && (process.exitCode === undefined || process.exitCode === 0);
11258
- telemetry.trackEvent(telemetryName, {
12271
+ telemetry.trackEvent(telemetryName, redactProperties({
12272
+ ...extractCommandParams(command),
11259
12273
  ...props,
11260
12274
  duration: String(durationMs),
11261
12275
  success: String(success),
11262
12276
  ...errorMessage ? { errorMessage } : {}
11263
- });
12277
+ }));
11264
12278
  });
11265
12279
  };
11266
12280
 
11267
- // node_modules/commander/esm.mjs
11268
- var import__2 = __toESM(require_commander2(), 1);
11269
- var {
11270
- program: program2,
11271
- createCommand: createCommand2,
11272
- createArgument: createArgument2,
11273
- createOption: createOption2,
11274
- CommanderError: CommanderError2,
11275
- InvalidArgumentError: InvalidArgumentError2,
11276
- InvalidOptionArgumentError: InvalidOptionArgumentError2,
11277
- Command: Command2,
11278
- Argument: Argument2,
11279
- Option: Option2,
11280
- Help: Help2
11281
- } = import__2.default;
11282
-
11283
12281
  // src/argv.ts
11284
12282
  function extractArg(argv, name, defaultValue) {
11285
12283
  const prefix = `--${name}=`;
@@ -11345,10 +12343,11 @@ ${descIndent}${indentedDesc}`;
11345
12343
  // src/index.ts
11346
12344
  import { metadata, registerCommands } from "./tool.js";
11347
12345
  if (process.platform !== "win32") {
11348
- process.env.TMPDIR = "/tmp/";
12346
+ process.env.TMPDIR = safeTmpDir();
11349
12347
  }
11350
12348
  var projectDir = extractArg(process.argv, "project-dir", process.cwd());
11351
12349
  var studioDir = extractArg(process.argv, "studio-dir");
12350
+ var robotDir = extractArg(process.argv, "robot-dir");
11352
12351
  var timeoutRaw = extractArg(process.argv, "timeout", "300");
11353
12352
  var timeoutSeconds = parseInt(timeoutRaw ?? "300", 10);
11354
12353
  var verbose = hasFlag(process.argv, "verbose");
@@ -11361,16 +12360,20 @@ if (hasFlag(process.argv, "use-studio") && hostStudioPid) {
11361
12360
  if (format) {
11362
12361
  setOutputFormat(format);
11363
12362
  }
11364
- var program3 = new Command2;
12363
+ var program3 = new Command;
11365
12364
  configureHelpFormat(program3);
11366
- program3.name(metadata.name).version(metadata.version).description(metadata.description).option("--project-dir <path>", "Project directory to match against running Studio instances", process.cwd()).option("--studio-dir <path>", "Path to Studio installation directory (for starting a new instance)").option("--timeout <seconds>", "Timeout in seconds", "300").option("--verbose", "Enable verbose logging (debug level)").option("--format <format>", "Output format (table, json, yaml, plain)");
12365
+ program3.name(metadata.name).version(metadata.version).description(metadata.description).option("--project-dir <path>", "Project directory to match against running Studio instances", process.cwd()).option("--studio-dir <path>", "Path to Studio installation directory (for starting a new instance)").option("--robot-dir <path>", "Path to Robot installation directory (bypasses registry/bundle discovery)").option("--timeout <seconds>", "Timeout in seconds", "300").option("--verbose", "Enable verbose logging (debug level)").option("--format <format>", "Output format (table, json, yaml, plain)");
11367
12366
  if (verbose) {
11368
12367
  console.error(`rpa-tool v${metadata.version}`);
11369
12368
  }
11370
- await telemetryInit({ tool: "rpa-tool", version: metadata.version });
12369
+ await telemetryInit({
12370
+ version: metadata.version,
12371
+ defaultProperties: { tool: "rpa-tool" }
12372
+ });
11371
12373
  await registerCommands(program3, {
11372
12374
  projectDir: projectDir ?? process.cwd(),
11373
12375
  studioDir,
12376
+ robotDir,
11374
12377
  verbose,
11375
12378
  useStudio,
11376
12379
  hostStudioPid,