@uipath/cli 1.195.1 → 1.196.1
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.
- package/dist/index.js +2477 -1023
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -946,6 +946,32 @@ function settlePromiseLike(thenable) {
|
|
|
946
946
|
}
|
|
947
947
|
|
|
948
948
|
// ../common/src/error-handler.ts
|
|
949
|
+
function describeConnectivityError(error) {
|
|
950
|
+
let current = error;
|
|
951
|
+
for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
|
|
952
|
+
const cur = current;
|
|
953
|
+
const code = typeof cur.code === "string" ? cur.code : undefined;
|
|
954
|
+
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
955
|
+
if (code && TLS_ERROR_CODES.has(code)) {
|
|
956
|
+
return {
|
|
957
|
+
code,
|
|
958
|
+
kind: "tls",
|
|
959
|
+
message: message ?? code,
|
|
960
|
+
instructions: TLS_INSTRUCTIONS
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
if (code && NETWORK_ERROR_CODES.has(code)) {
|
|
964
|
+
return {
|
|
965
|
+
code,
|
|
966
|
+
kind: "network",
|
|
967
|
+
message: message ?? code,
|
|
968
|
+
instructions: NETWORK_INSTRUCTIONS
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
current = cur.cause;
|
|
972
|
+
}
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
949
975
|
function extractErrorMessageSync(error) {
|
|
950
976
|
if (error instanceof Error) {
|
|
951
977
|
return error.message;
|
|
@@ -960,8 +986,32 @@ function extractErrorMessageSync(error) {
|
|
|
960
986
|
}
|
|
961
987
|
return String(error);
|
|
962
988
|
}
|
|
963
|
-
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
|
|
964
|
-
var init_error_handler = () => {
|
|
989
|
+
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.", NETWORK_ERROR_CODES, TLS_ERROR_CODES, TLS_INSTRUCTIONS, NETWORK_INSTRUCTIONS;
|
|
990
|
+
var init_error_handler = __esm(() => {
|
|
991
|
+
NETWORK_ERROR_CODES = new Set([
|
|
992
|
+
"ECONNREFUSED",
|
|
993
|
+
"ECONNRESET",
|
|
994
|
+
"ENOTFOUND",
|
|
995
|
+
"EAI_AGAIN",
|
|
996
|
+
"ETIMEDOUT",
|
|
997
|
+
"EPIPE",
|
|
998
|
+
"EHOSTUNREACH",
|
|
999
|
+
"ENETUNREACH",
|
|
1000
|
+
"EAI_FAIL"
|
|
1001
|
+
]);
|
|
1002
|
+
TLS_ERROR_CODES = new Set([
|
|
1003
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
1004
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
1005
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
1006
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
1007
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
1008
|
+
"CERT_HAS_EXPIRED",
|
|
1009
|
+
"CERT_UNTRUSTED",
|
|
1010
|
+
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
1011
|
+
]);
|
|
1012
|
+
TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
1013
|
+
NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
1014
|
+
});
|
|
965
1015
|
|
|
966
1016
|
// ../common/src/attachment-binding.ts
|
|
967
1017
|
var init_attachment_binding = __esm(() => {
|
|
@@ -3242,111 +3292,6 @@ var init_completer = __esm(() => {
|
|
|
3242
3292
|
COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
3243
3293
|
});
|
|
3244
3294
|
|
|
3245
|
-
// ../common/src/console-guard.ts
|
|
3246
|
-
function format(first, ...rest) {
|
|
3247
|
-
if (typeof first !== "string") {
|
|
3248
|
-
if (first === undefined && rest.length === 0)
|
|
3249
|
-
return "";
|
|
3250
|
-
return [first, ...rest].map(String).join(" ");
|
|
3251
|
-
}
|
|
3252
|
-
let i = 0;
|
|
3253
|
-
const result = first.replace(/%[sdifjoO%]/g, (spec) => {
|
|
3254
|
-
if (spec === "%%")
|
|
3255
|
-
return "%";
|
|
3256
|
-
if (i >= rest.length)
|
|
3257
|
-
return spec;
|
|
3258
|
-
const arg = rest[i++];
|
|
3259
|
-
switch (spec) {
|
|
3260
|
-
case "%s":
|
|
3261
|
-
return String(arg);
|
|
3262
|
-
case "%d":
|
|
3263
|
-
case "%i":
|
|
3264
|
-
return String(parseInt(String(arg), 10));
|
|
3265
|
-
case "%f":
|
|
3266
|
-
return String(parseFloat(String(arg)));
|
|
3267
|
-
case "%j":
|
|
3268
|
-
case "%o":
|
|
3269
|
-
case "%O":
|
|
3270
|
-
try {
|
|
3271
|
-
return JSON.stringify(arg);
|
|
3272
|
-
} catch {
|
|
3273
|
-
return String(arg);
|
|
3274
|
-
}
|
|
3275
|
-
default:
|
|
3276
|
-
return spec;
|
|
3277
|
-
}
|
|
3278
|
-
});
|
|
3279
|
-
const extra = rest.slice(i);
|
|
3280
|
-
if (extra.length > 0) {
|
|
3281
|
-
return result + " " + extra.map(String).join(" ");
|
|
3282
|
-
}
|
|
3283
|
-
return result;
|
|
3284
|
-
}
|
|
3285
|
-
function formatArgs(args) {
|
|
3286
|
-
return `${format(args[0], ...args.slice(1))}
|
|
3287
|
-
`;
|
|
3288
|
-
}
|
|
3289
|
-
function installConsoleGuard() {
|
|
3290
|
-
if (guardInstalledSlot.get(false))
|
|
3291
|
-
return;
|
|
3292
|
-
const originals = {
|
|
3293
|
-
log: console.log,
|
|
3294
|
-
info: console.info,
|
|
3295
|
-
warn: console.warn,
|
|
3296
|
-
error: console.error,
|
|
3297
|
-
debug: console.debug
|
|
3298
|
-
};
|
|
3299
|
-
savedOriginalsSlot.set(originals);
|
|
3300
|
-
let reentrant = false;
|
|
3301
|
-
function guardedWriter(original) {
|
|
3302
|
-
return (...args) => {
|
|
3303
|
-
if (reentrant) {
|
|
3304
|
-
original.apply(console, args);
|
|
3305
|
-
return;
|
|
3306
|
-
}
|
|
3307
|
-
reentrant = true;
|
|
3308
|
-
try {
|
|
3309
|
-
getOutputSink().writeErr(formatArgs(args));
|
|
3310
|
-
} finally {
|
|
3311
|
-
reentrant = false;
|
|
3312
|
-
}
|
|
3313
|
-
};
|
|
3314
|
-
}
|
|
3315
|
-
console.log = guardedWriter(originals.log);
|
|
3316
|
-
console.info = guardedWriter(originals.info);
|
|
3317
|
-
console.warn = guardedWriter(originals.warn);
|
|
3318
|
-
console.error = guardedWriter(originals.error);
|
|
3319
|
-
console.debug = guardedWriter(originals.debug);
|
|
3320
|
-
guardInstalledSlot.set(true);
|
|
3321
|
-
}
|
|
3322
|
-
var guardInstalledSlot, savedOriginalsSlot;
|
|
3323
|
-
var init_console_guard = __esm(() => {
|
|
3324
|
-
init_output_context();
|
|
3325
|
-
init_singleton();
|
|
3326
|
-
guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
3327
|
-
savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
3328
|
-
});
|
|
3329
|
-
|
|
3330
|
-
// ../common/src/constants.ts
|
|
3331
|
-
var UIPATH_HOME_DIR = ".uipath", CONFIG_FILENAME = "config.json", DEFAULT_AUTH_TIMEOUT_MS, DEFAULT_FETCH_TIMEOUT_MS = 30000;
|
|
3332
|
-
var init_constants = __esm(() => {
|
|
3333
|
-
DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
3334
|
-
});
|
|
3335
|
-
|
|
3336
|
-
// ../common/src/env-reference.ts
|
|
3337
|
-
function resolveEnvReference(value) {
|
|
3338
|
-
if (value == null)
|
|
3339
|
-
return value;
|
|
3340
|
-
if (value.startsWith("env.")) {
|
|
3341
|
-
const name = value.slice(4);
|
|
3342
|
-
const resolved = process.env[name];
|
|
3343
|
-
if (!resolved) {
|
|
3344
|
-
throw new Error(`Environment variable "${name}" is not set`);
|
|
3345
|
-
}
|
|
3346
|
-
return resolved;
|
|
3347
|
-
}
|
|
3348
|
-
return value;
|
|
3349
|
-
}
|
|
3350
3295
|
// ../../node_modules/@jmespath-community/jmespath/dist/index.mjs
|
|
3351
3296
|
function compile(expression, options) {
|
|
3352
3297
|
const nodeTree = Parser_default.parse(expression, options);
|
|
@@ -8244,8 +8189,8 @@ var init_logger = __esm(() => {
|
|
|
8244
8189
|
});
|
|
8245
8190
|
|
|
8246
8191
|
// ../common/src/output-format-context.ts
|
|
8247
|
-
function setOutputFormat(
|
|
8248
|
-
formatSlot.set(
|
|
8192
|
+
function setOutputFormat(format) {
|
|
8193
|
+
formatSlot.set(format);
|
|
8249
8194
|
}
|
|
8250
8195
|
function getOutputFormat() {
|
|
8251
8196
|
return formatSlot.get("json");
|
|
@@ -8400,6 +8345,20 @@ class NodeContextStorage {
|
|
|
8400
8345
|
}
|
|
8401
8346
|
var init_node_context_storage = () => {};
|
|
8402
8347
|
|
|
8348
|
+
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
8349
|
+
function setGlobalTelemetryProperties(properties) {
|
|
8350
|
+
const existing = getGlobalTelemetryProperties();
|
|
8351
|
+
telemetryPropsSlot.set({ ...existing, ...properties });
|
|
8352
|
+
}
|
|
8353
|
+
function getGlobalTelemetryProperties() {
|
|
8354
|
+
return telemetryPropsSlot.get();
|
|
8355
|
+
}
|
|
8356
|
+
var telemetryPropsSlot;
|
|
8357
|
+
var init_global_telemetry_properties = __esm(() => {
|
|
8358
|
+
init_singleton();
|
|
8359
|
+
telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
8360
|
+
});
|
|
8361
|
+
|
|
8403
8362
|
// ../common/src/telemetry/telemetry-service.ts
|
|
8404
8363
|
class TelemetryService {
|
|
8405
8364
|
telemetryProvider;
|
|
@@ -8417,7 +8376,7 @@ class TelemetryService {
|
|
|
8417
8376
|
this.telemetryProvider = provider;
|
|
8418
8377
|
}
|
|
8419
8378
|
setDefaultProperties(properties) {
|
|
8420
|
-
this.defaultProperties = properties;
|
|
8379
|
+
this.defaultProperties = properties === undefined ? undefined : { ...this.defaultProperties, ...properties };
|
|
8421
8380
|
}
|
|
8422
8381
|
trackEvent(name, properties) {
|
|
8423
8382
|
const context = this.getCurrentContext();
|
|
@@ -8479,6 +8438,7 @@ class TelemetryService {
|
|
|
8479
8438
|
}
|
|
8480
8439
|
enrichPropertiesWithContext(properties, context) {
|
|
8481
8440
|
return {
|
|
8441
|
+
...getGlobalTelemetryProperties(),
|
|
8482
8442
|
...this.defaultProperties,
|
|
8483
8443
|
...properties,
|
|
8484
8444
|
...context
|
|
@@ -8488,12 +8448,16 @@ class TelemetryService {
|
|
|
8488
8448
|
return crypto.randomUUID().replaceAll("-", "");
|
|
8489
8449
|
}
|
|
8490
8450
|
}
|
|
8451
|
+
var init_telemetry_service = __esm(() => {
|
|
8452
|
+
init_global_telemetry_properties();
|
|
8453
|
+
});
|
|
8491
8454
|
|
|
8492
8455
|
// ../common/src/telemetry/node.ts
|
|
8493
8456
|
var init_node2 = __esm(() => {
|
|
8494
8457
|
init_debug_telemetry_provider();
|
|
8495
8458
|
init_detect_agent();
|
|
8496
8459
|
init_node_context_storage();
|
|
8460
|
+
init_telemetry_service();
|
|
8497
8461
|
});
|
|
8498
8462
|
|
|
8499
8463
|
// ../../node_modules/applicationinsights/out/Library/FileSystemHelper.js
|
|
@@ -21735,12 +21699,12 @@ var require_common2 = __commonJS((exports, module) => {
|
|
|
21735
21699
|
args.unshift("%O");
|
|
21736
21700
|
}
|
|
21737
21701
|
let index = 0;
|
|
21738
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match,
|
|
21702
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
21739
21703
|
if (match === "%%") {
|
|
21740
21704
|
return "%";
|
|
21741
21705
|
}
|
|
21742
21706
|
index++;
|
|
21743
|
-
const formatter = createDebug.formatters[
|
|
21707
|
+
const formatter = createDebug.formatters[format];
|
|
21744
21708
|
if (typeof formatter === "function") {
|
|
21745
21709
|
const val = args[index];
|
|
21746
21710
|
match = formatter.call(self2, val);
|
|
@@ -21865,7 +21829,7 @@ var require_common2 = __commonJS((exports, module) => {
|
|
|
21865
21829
|
|
|
21866
21830
|
// ../../node_modules/debug/src/browser.js
|
|
21867
21831
|
var require_browser = __commonJS((exports, module) => {
|
|
21868
|
-
exports.formatArgs =
|
|
21832
|
+
exports.formatArgs = formatArgs;
|
|
21869
21833
|
exports.save = save;
|
|
21870
21834
|
exports.load = load2;
|
|
21871
21835
|
exports.useColors = useColors;
|
|
@@ -21967,7 +21931,7 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
21967
21931
|
let m;
|
|
21968
21932
|
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
21969
21933
|
}
|
|
21970
|
-
function
|
|
21934
|
+
function formatArgs(args) {
|
|
21971
21935
|
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
21972
21936
|
if (!this.useColors) {
|
|
21973
21937
|
return;
|
|
@@ -22138,7 +22102,7 @@ var require_node5 = __commonJS((exports, module) => {
|
|
|
22138
22102
|
var util = __require("util");
|
|
22139
22103
|
exports.init = init;
|
|
22140
22104
|
exports.log = log;
|
|
22141
|
-
exports.formatArgs =
|
|
22105
|
+
exports.formatArgs = formatArgs;
|
|
22142
22106
|
exports.save = save;
|
|
22143
22107
|
exports.load = load2;
|
|
22144
22108
|
exports.useColors = useColors;
|
|
@@ -22249,7 +22213,7 @@ var require_node5 = __commonJS((exports, module) => {
|
|
|
22249
22213
|
function useColors() {
|
|
22250
22214
|
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
22251
22215
|
}
|
|
22252
|
-
function
|
|
22216
|
+
function formatArgs(args) {
|
|
22253
22217
|
const { namespace: name, useColors: useColors2 } = this;
|
|
22254
22218
|
if (useColors2) {
|
|
22255
22219
|
const c = this.color;
|
|
@@ -29024,9 +28988,9 @@ var require_stack_chain = __commonJS((exports, module) => {
|
|
|
29024
28988
|
};
|
|
29025
28989
|
}
|
|
29026
28990
|
SHORTCIRCUIT_FORMATER = true;
|
|
29027
|
-
var
|
|
28991
|
+
var format = chain.format._formater(error, frames);
|
|
29028
28992
|
SHORTCIRCUIT_FORMATER = false;
|
|
29029
|
-
return
|
|
28993
|
+
return format;
|
|
29030
28994
|
}
|
|
29031
28995
|
Object.defineProperty(Error, "prepareStackTrace", {
|
|
29032
28996
|
get: function() {
|
|
@@ -37129,11 +37093,11 @@ var require_bytesEncoding = __commonJS((exports, module) => {
|
|
|
37129
37093
|
uint8ArrayToString: () => uint8ArrayToString2
|
|
37130
37094
|
});
|
|
37131
37095
|
module.exports = __toCommonJS(bytesEncoding_exports);
|
|
37132
|
-
function uint8ArrayToString2(bytes,
|
|
37133
|
-
return Buffer.from(bytes).toString(
|
|
37096
|
+
function uint8ArrayToString2(bytes, format) {
|
|
37097
|
+
return Buffer.from(bytes).toString(format);
|
|
37134
37098
|
}
|
|
37135
|
-
function stringToUint8Array2(value,
|
|
37136
|
-
return Buffer.from(value,
|
|
37099
|
+
function stringToUint8Array2(value, format) {
|
|
37100
|
+
return Buffer.from(value, format);
|
|
37137
37101
|
}
|
|
37138
37102
|
});
|
|
37139
37103
|
|
|
@@ -37570,11 +37534,11 @@ var require_commonjs4 = __commonJS((exports) => {
|
|
|
37570
37534
|
exports.isNodeRuntime = tspRuntime.isNodeRuntime;
|
|
37571
37535
|
exports.isReactNative = tspRuntime.isReactNative;
|
|
37572
37536
|
exports.isWebWorker = tspRuntime.isWebWorker;
|
|
37573
|
-
function uint8ArrayToString2(bytes,
|
|
37574
|
-
return tspRuntime.uint8ArrayToString(bytes,
|
|
37537
|
+
function uint8ArrayToString2(bytes, format) {
|
|
37538
|
+
return tspRuntime.uint8ArrayToString(bytes, format);
|
|
37575
37539
|
}
|
|
37576
|
-
function stringToUint8Array2(value,
|
|
37577
|
-
return tspRuntime.stringToUint8Array(value,
|
|
37540
|
+
function stringToUint8Array2(value, format) {
|
|
37541
|
+
return tspRuntime.stringToUint8Array(value, format);
|
|
37578
37542
|
}
|
|
37579
37543
|
});
|
|
37580
37544
|
|
|
@@ -43453,13 +43417,6 @@ var require_applicationinsights2 = __commonJS((exports) => {
|
|
|
43453
43417
|
});
|
|
43454
43418
|
|
|
43455
43419
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
43456
|
-
function setGlobalTelemetryProperties(properties) {
|
|
43457
|
-
const existing = getGlobalTelemetryProperties();
|
|
43458
|
-
telemetryPropsSlot.set({ ...existing, ...properties });
|
|
43459
|
-
}
|
|
43460
|
-
function getGlobalTelemetryProperties() {
|
|
43461
|
-
return telemetryPropsSlot.get();
|
|
43462
|
-
}
|
|
43463
43420
|
function toOperationUrn(name) {
|
|
43464
43421
|
if (URL.canParse(name))
|
|
43465
43422
|
return name;
|
|
@@ -43722,11 +43679,12 @@ async function getOrCreateProvider(connectionString) {
|
|
|
43722
43679
|
providerSlot.set(initPromise);
|
|
43723
43680
|
return initPromise;
|
|
43724
43681
|
}
|
|
43725
|
-
var
|
|
43682
|
+
var providerSlot, APPINSIGHTS_BATCH_INTERVAL_MS = 1000;
|
|
43726
43683
|
var init_node_appinsights_telemetry_provider = __esm(() => {
|
|
43727
43684
|
init_logger();
|
|
43728
43685
|
init_singleton();
|
|
43729
|
-
|
|
43686
|
+
init_global_telemetry_properties();
|
|
43687
|
+
init_global_telemetry_properties();
|
|
43730
43688
|
providerSlot = singleton("TelemetryProvider");
|
|
43731
43689
|
});
|
|
43732
43690
|
|
|
@@ -43935,12 +43893,12 @@ function normalizeOutputKeys(data) {
|
|
|
43935
43893
|
}
|
|
43936
43894
|
return result;
|
|
43937
43895
|
}
|
|
43938
|
-
function printOutput(data,
|
|
43896
|
+
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
43939
43897
|
if (!data) {
|
|
43940
43898
|
logFn("Empty response object. No data to display.");
|
|
43941
43899
|
return;
|
|
43942
43900
|
}
|
|
43943
|
-
switch (
|
|
43901
|
+
switch (format) {
|
|
43944
43902
|
case "json": {
|
|
43945
43903
|
const json = JSON.stringify(data, null, 2);
|
|
43946
43904
|
logFn(asciiSafe ? escapeNonAscii(json) : json);
|
|
@@ -43977,9 +43935,9 @@ function printOutput(data, format2 = "json", logFn, asciiSafe = false) {
|
|
|
43977
43935
|
}
|
|
43978
43936
|
}
|
|
43979
43937
|
}
|
|
43980
|
-
function logOutput(data,
|
|
43938
|
+
function logOutput(data, format = "json") {
|
|
43981
43939
|
const sink = getOutputSink();
|
|
43982
|
-
printOutput(data,
|
|
43940
|
+
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
43983
43941
|
`), needsAsciiSafeJson(sink));
|
|
43984
43942
|
}
|
|
43985
43943
|
function cellToString(val) {
|
|
@@ -44133,7 +44091,32 @@ function applyFilter(data, filter) {
|
|
|
44133
44091
|
return result;
|
|
44134
44092
|
return { Value: result };
|
|
44135
44093
|
}
|
|
44136
|
-
|
|
44094
|
+
function defaultErrorCodeForResult(result) {
|
|
44095
|
+
switch (result) {
|
|
44096
|
+
case RESULTS.AuthenticationError:
|
|
44097
|
+
return "authentication_required";
|
|
44098
|
+
case RESULTS.ConfigError:
|
|
44099
|
+
return "configuration_error";
|
|
44100
|
+
case RESULTS.ValidationError:
|
|
44101
|
+
return "invalid_argument";
|
|
44102
|
+
case RESULTS.TimeoutError:
|
|
44103
|
+
return "timeout";
|
|
44104
|
+
default:
|
|
44105
|
+
return "unknown_error";
|
|
44106
|
+
}
|
|
44107
|
+
}
|
|
44108
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
44109
|
+
switch (errorCode) {
|
|
44110
|
+
case "network_error":
|
|
44111
|
+
case "rate_limited":
|
|
44112
|
+
case "server_error":
|
|
44113
|
+
case "timeout":
|
|
44114
|
+
return "RetryLater";
|
|
44115
|
+
default:
|
|
44116
|
+
return "RetryWillNotFix";
|
|
44117
|
+
}
|
|
44118
|
+
}
|
|
44119
|
+
var CLI_ERROR_CODES, RETRY_HINTS, RESULTS, EXIT_CODES, FilterEvaluationError, OutputFormatter;
|
|
44137
44120
|
var init_formatter = __esm(() => {
|
|
44138
44121
|
init_dist();
|
|
44139
44122
|
init_js_yaml();
|
|
@@ -44142,6 +44125,27 @@ var init_formatter = __esm(() => {
|
|
|
44142
44125
|
init_output_format_context();
|
|
44143
44126
|
init_telemetry_events();
|
|
44144
44127
|
init_telemetry_init();
|
|
44128
|
+
CLI_ERROR_CODES = [
|
|
44129
|
+
"invalid_argument",
|
|
44130
|
+
"authentication_required",
|
|
44131
|
+
"permission_denied",
|
|
44132
|
+
"not_found",
|
|
44133
|
+
"rate_limited",
|
|
44134
|
+
"network_error",
|
|
44135
|
+
"timeout",
|
|
44136
|
+
"server_error",
|
|
44137
|
+
"method_not_allowed",
|
|
44138
|
+
"configuration_error",
|
|
44139
|
+
"unknown_error"
|
|
44140
|
+
];
|
|
44141
|
+
RETRY_HINTS = [
|
|
44142
|
+
"RetryWillNotFix",
|
|
44143
|
+
"RetryLater",
|
|
44144
|
+
"RetryAfter1Second",
|
|
44145
|
+
"RetryAfter10Seconds",
|
|
44146
|
+
"RetryAfter30Seconds",
|
|
44147
|
+
"RetryAfter60Seconds"
|
|
44148
|
+
];
|
|
44145
44149
|
RESULTS = {
|
|
44146
44150
|
Success: "Success",
|
|
44147
44151
|
Failure: "Failure",
|
|
@@ -44161,7 +44165,9 @@ var init_formatter = __esm(() => {
|
|
|
44161
44165
|
FilterEvaluationError = class FilterEvaluationError extends Error {
|
|
44162
44166
|
__brand = "FilterEvaluationError";
|
|
44163
44167
|
filter;
|
|
44168
|
+
errorCode = "invalid_argument";
|
|
44164
44169
|
instructions;
|
|
44170
|
+
retry = "RetryWillNotFix";
|
|
44165
44171
|
result = RESULTS.ValidationError;
|
|
44166
44172
|
constructor(filter, cause) {
|
|
44167
44173
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -44188,9 +44194,13 @@ var init_formatter = __esm(() => {
|
|
|
44188
44194
|
OutputFormatter.success = success;
|
|
44189
44195
|
function error(data) {
|
|
44190
44196
|
data.Log ??= getLogFilePath() || undefined;
|
|
44197
|
+
data.ErrorCode ??= defaultErrorCodeForResult(data.Result);
|
|
44198
|
+
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
44191
44199
|
process.exitCode = EXIT_CODES[data.Result] ?? 1;
|
|
44192
44200
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
44193
44201
|
result: data.Result,
|
|
44202
|
+
errorCode: data.ErrorCode,
|
|
44203
|
+
retry: data.Retry,
|
|
44194
44204
|
message: data.Message
|
|
44195
44205
|
});
|
|
44196
44206
|
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
@@ -44212,10 +44222,10 @@ var init_formatter = __esm(() => {
|
|
|
44212
44222
|
}
|
|
44213
44223
|
OutputFormatter.emitList = emitList;
|
|
44214
44224
|
function log(data) {
|
|
44215
|
-
const
|
|
44225
|
+
const format = getOutputFormat();
|
|
44216
44226
|
const sink = getOutputSink();
|
|
44217
44227
|
const normalized = toPascalCaseData(data);
|
|
44218
|
-
if (
|
|
44228
|
+
if (format === "json") {
|
|
44219
44229
|
const json = JSON.stringify(normalized);
|
|
44220
44230
|
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json) : json;
|
|
44221
44231
|
sink.writeErr(`${safe}
|
|
@@ -44249,9 +44259,391 @@ var init_formatter = __esm(() => {
|
|
|
44249
44259
|
})(OutputFormatter ||= {});
|
|
44250
44260
|
});
|
|
44251
44261
|
|
|
44262
|
+
// ../common/src/telemetry/pii-redactor.ts
|
|
44263
|
+
function shortHash(input) {
|
|
44264
|
+
let hash = 2166136261;
|
|
44265
|
+
for (let i = 0;i < input.length; i++) {
|
|
44266
|
+
hash ^= input.charCodeAt(i);
|
|
44267
|
+
hash = Math.imul(hash, 16777619);
|
|
44268
|
+
}
|
|
44269
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
44270
|
+
}
|
|
44271
|
+
function redactUrl(raw) {
|
|
44272
|
+
try {
|
|
44273
|
+
const url = new URL(raw);
|
|
44274
|
+
return `${url.protocol}//${url.host}`;
|
|
44275
|
+
} catch {
|
|
44276
|
+
return `url#${shortHash(raw)}`;
|
|
44277
|
+
}
|
|
44278
|
+
}
|
|
44279
|
+
function redactValueDetectors(value) {
|
|
44280
|
+
let out = value;
|
|
44281
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
44282
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
44283
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
44284
|
+
const core = trailing ? match.slice(0, -trailing.length) : match;
|
|
44285
|
+
return `${redactUrl(core)}${trailing}`;
|
|
44286
|
+
});
|
|
44287
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
44288
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
44289
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
44290
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
44291
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
44292
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
44293
|
+
}
|
|
44294
|
+
return out;
|
|
44295
|
+
}
|
|
44296
|
+
function nameTokens(name) {
|
|
44297
|
+
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);
|
|
44298
|
+
}
|
|
44299
|
+
function isSensitiveName(name) {
|
|
44300
|
+
const tokens = nameTokens(name);
|
|
44301
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
44302
|
+
const token = tokens[i];
|
|
44303
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
44304
|
+
return true;
|
|
44305
|
+
}
|
|
44306
|
+
if (token === "key" || token === "keys") {
|
|
44307
|
+
const prev = tokens[i - 1];
|
|
44308
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
44309
|
+
return true;
|
|
44310
|
+
}
|
|
44311
|
+
}
|
|
44312
|
+
}
|
|
44313
|
+
return false;
|
|
44314
|
+
}
|
|
44315
|
+
function redactProperty(name, value) {
|
|
44316
|
+
if (value === undefined || value === null) {
|
|
44317
|
+
return;
|
|
44318
|
+
}
|
|
44319
|
+
if (isSensitiveName(name)) {
|
|
44320
|
+
return REDACTED;
|
|
44321
|
+
}
|
|
44322
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
44323
|
+
return value;
|
|
44324
|
+
}
|
|
44325
|
+
if (typeof value !== "string") {
|
|
44326
|
+
return "[OBJECT]";
|
|
44327
|
+
}
|
|
44328
|
+
return redactValueDetectors(value);
|
|
44329
|
+
}
|
|
44330
|
+
function redactProperties(properties) {
|
|
44331
|
+
const out = {};
|
|
44332
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
44333
|
+
const redacted = redactProperty(name, value);
|
|
44334
|
+
if (redacted !== undefined) {
|
|
44335
|
+
out[name] = redacted;
|
|
44336
|
+
}
|
|
44337
|
+
}
|
|
44338
|
+
return out;
|
|
44339
|
+
}
|
|
44340
|
+
var REDACTED = "[REDACTED]", MAX_VALUE_LENGTH = 200, SENSITIVE_NAME_TOKENS, SENSITIVE_KEY_PREFIXES, UUID_PATTERN, EMAIL_PATTERN, JWT_PATTERN, LONG_TOKEN_PATTERN, USER_HOME_PATTERN, URL_PATTERN, URL_TRAILING_PUNCT;
|
|
44341
|
+
var init_pii_redactor = __esm(() => {
|
|
44342
|
+
SENSITIVE_NAME_TOKENS = new Set([
|
|
44343
|
+
"token",
|
|
44344
|
+
"tokens",
|
|
44345
|
+
"secret",
|
|
44346
|
+
"secrets",
|
|
44347
|
+
"password",
|
|
44348
|
+
"passwords",
|
|
44349
|
+
"pwd",
|
|
44350
|
+
"credential",
|
|
44351
|
+
"credentials",
|
|
44352
|
+
"auth",
|
|
44353
|
+
"authentication",
|
|
44354
|
+
"authorization",
|
|
44355
|
+
"authority",
|
|
44356
|
+
"cert",
|
|
44357
|
+
"certificate",
|
|
44358
|
+
"certificates"
|
|
44359
|
+
]);
|
|
44360
|
+
SENSITIVE_KEY_PREFIXES = new Set([
|
|
44361
|
+
"api",
|
|
44362
|
+
"access",
|
|
44363
|
+
"client",
|
|
44364
|
+
"private",
|
|
44365
|
+
"public",
|
|
44366
|
+
"signing",
|
|
44367
|
+
"encryption",
|
|
44368
|
+
"session",
|
|
44369
|
+
"master",
|
|
44370
|
+
"shared",
|
|
44371
|
+
"root",
|
|
44372
|
+
"ssh",
|
|
44373
|
+
"rsa",
|
|
44374
|
+
"aes",
|
|
44375
|
+
"hmac",
|
|
44376
|
+
"oauth"
|
|
44377
|
+
]);
|
|
44378
|
+
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;
|
|
44379
|
+
EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
44380
|
+
JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
44381
|
+
LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
44382
|
+
USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
44383
|
+
URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
44384
|
+
URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
44385
|
+
});
|
|
44386
|
+
|
|
44387
|
+
// ../common/src/trackedAction.ts
|
|
44388
|
+
function setProcessContextPollSignal(signal) {
|
|
44389
|
+
pollSignalSlot.set(signal);
|
|
44390
|
+
}
|
|
44391
|
+
function extractCommandParams(cmd) {
|
|
44392
|
+
const params = {};
|
|
44393
|
+
const registered = cmd.registeredArguments ?? [];
|
|
44394
|
+
const processed = cmd.processedArgs ?? [];
|
|
44395
|
+
for (let i = 0;i < registered.length; i++) {
|
|
44396
|
+
const value = processed[i];
|
|
44397
|
+
if (value === undefined) {
|
|
44398
|
+
continue;
|
|
44399
|
+
}
|
|
44400
|
+
const name = registered[i].name();
|
|
44401
|
+
if (name) {
|
|
44402
|
+
params[name] = value;
|
|
44403
|
+
}
|
|
44404
|
+
}
|
|
44405
|
+
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
44406
|
+
if (value !== undefined) {
|
|
44407
|
+
params[key] = value;
|
|
44408
|
+
}
|
|
44409
|
+
}
|
|
44410
|
+
return params;
|
|
44411
|
+
}
|
|
44412
|
+
function deriveCommandPath(cmd) {
|
|
44413
|
+
const parts = [];
|
|
44414
|
+
let current = cmd;
|
|
44415
|
+
while (current) {
|
|
44416
|
+
const name = current.name();
|
|
44417
|
+
if (name) {
|
|
44418
|
+
parts.unshift(name);
|
|
44419
|
+
}
|
|
44420
|
+
current = current.parent;
|
|
44421
|
+
}
|
|
44422
|
+
if (parts.length > 1) {
|
|
44423
|
+
parts.shift();
|
|
44424
|
+
}
|
|
44425
|
+
return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
|
|
44426
|
+
}
|
|
44427
|
+
function isCliErrorCode(value) {
|
|
44428
|
+
return typeof value === "string" && cliErrorCodeValues.has(value);
|
|
44429
|
+
}
|
|
44430
|
+
function isRetryHint(value) {
|
|
44431
|
+
return typeof value === "string" && retryHintValues.has(value);
|
|
44432
|
+
}
|
|
44433
|
+
function isErrorContext(value) {
|
|
44434
|
+
return value !== null && typeof value === "object";
|
|
44435
|
+
}
|
|
44436
|
+
function commandHelpHint(commandPath) {
|
|
44437
|
+
const command = commandPath.replace(/\./g, " ");
|
|
44438
|
+
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
44439
|
+
}
|
|
44440
|
+
var pollSignalSlot, cliErrorCodeValues, retryHintValues, processContext;
|
|
44441
|
+
var init_trackedAction = __esm(() => {
|
|
44442
|
+
init_esm();
|
|
44443
|
+
init_formatter();
|
|
44444
|
+
init_logger();
|
|
44445
|
+
init_singleton();
|
|
44446
|
+
init_pii_redactor();
|
|
44447
|
+
init_telemetry_init();
|
|
44448
|
+
pollSignalSlot = singleton("PollSignal");
|
|
44449
|
+
cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
44450
|
+
retryHintValues = new Set(RETRY_HINTS);
|
|
44451
|
+
processContext = {
|
|
44452
|
+
exit: (code) => {
|
|
44453
|
+
process.exitCode = code;
|
|
44454
|
+
},
|
|
44455
|
+
get pollSignal() {
|
|
44456
|
+
return pollSignalSlot.get();
|
|
44457
|
+
}
|
|
44458
|
+
};
|
|
44459
|
+
Command.prototype.trackedAction = function(context, fn, properties) {
|
|
44460
|
+
const command = this;
|
|
44461
|
+
return this.action(async (...args) => {
|
|
44462
|
+
const telemetryName = deriveCommandPath(command);
|
|
44463
|
+
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
44464
|
+
const startTime = performance.now();
|
|
44465
|
+
let errorMessage;
|
|
44466
|
+
const [error] = await catchError(fn(...args));
|
|
44467
|
+
if (error) {
|
|
44468
|
+
errorMessage = error instanceof Error ? error.message : String(error);
|
|
44469
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
44470
|
+
const typed = error;
|
|
44471
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
44472
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
44473
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
44474
|
+
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
44475
|
+
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
44476
|
+
const typedRetry = typed.retry ?? typed.Retry;
|
|
44477
|
+
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
44478
|
+
const typedContext = typed.context ?? typed.Context;
|
|
44479
|
+
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
44480
|
+
OutputFormatter.error({
|
|
44481
|
+
Result: finalResult,
|
|
44482
|
+
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
44483
|
+
Message: errorMessage,
|
|
44484
|
+
Instructions: customInstructions ?? commandHelpHint(telemetryName),
|
|
44485
|
+
...customRetry ? { Retry: customRetry } : {},
|
|
44486
|
+
...customContext ? { Context: customContext } : {}
|
|
44487
|
+
});
|
|
44488
|
+
context.exit(EXIT_CODES[finalResult]);
|
|
44489
|
+
}
|
|
44490
|
+
const durationMs = performance.now() - startTime;
|
|
44491
|
+
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
44492
|
+
telemetry.trackEvent(telemetryName, redactProperties({
|
|
44493
|
+
...extractCommandParams(command),
|
|
44494
|
+
...props,
|
|
44495
|
+
command: "true",
|
|
44496
|
+
duration: String(durationMs),
|
|
44497
|
+
success: String(success),
|
|
44498
|
+
...errorMessage ? { errorMessage } : {}
|
|
44499
|
+
}));
|
|
44500
|
+
});
|
|
44501
|
+
};
|
|
44502
|
+
});
|
|
44503
|
+
|
|
44504
|
+
// ../common/src/confirmation.ts
|
|
44505
|
+
var init_confirmation = __esm(() => {
|
|
44506
|
+
init_formatter();
|
|
44507
|
+
init_trackedAction();
|
|
44508
|
+
});
|
|
44509
|
+
|
|
44510
|
+
// ../common/src/console-guard.ts
|
|
44511
|
+
function format(first, ...rest) {
|
|
44512
|
+
if (typeof first !== "string") {
|
|
44513
|
+
if (first === undefined && rest.length === 0)
|
|
44514
|
+
return "";
|
|
44515
|
+
return [first, ...rest].map(String).join(" ");
|
|
44516
|
+
}
|
|
44517
|
+
let i = 0;
|
|
44518
|
+
const result = first.replace(/%[sdifjoO%]/g, (spec) => {
|
|
44519
|
+
if (spec === "%%")
|
|
44520
|
+
return "%";
|
|
44521
|
+
if (i >= rest.length)
|
|
44522
|
+
return spec;
|
|
44523
|
+
const arg = rest[i++];
|
|
44524
|
+
switch (spec) {
|
|
44525
|
+
case "%s":
|
|
44526
|
+
return String(arg);
|
|
44527
|
+
case "%d":
|
|
44528
|
+
case "%i":
|
|
44529
|
+
return String(parseInt(String(arg), 10));
|
|
44530
|
+
case "%f":
|
|
44531
|
+
return String(parseFloat(String(arg)));
|
|
44532
|
+
case "%j":
|
|
44533
|
+
case "%o":
|
|
44534
|
+
case "%O":
|
|
44535
|
+
try {
|
|
44536
|
+
return JSON.stringify(arg);
|
|
44537
|
+
} catch {
|
|
44538
|
+
return String(arg);
|
|
44539
|
+
}
|
|
44540
|
+
default:
|
|
44541
|
+
return spec;
|
|
44542
|
+
}
|
|
44543
|
+
});
|
|
44544
|
+
const extra = rest.slice(i);
|
|
44545
|
+
if (extra.length > 0) {
|
|
44546
|
+
return result + " " + extra.map(String).join(" ");
|
|
44547
|
+
}
|
|
44548
|
+
return result;
|
|
44549
|
+
}
|
|
44550
|
+
function formatArgs(args) {
|
|
44551
|
+
return `${format(args[0], ...args.slice(1))}
|
|
44552
|
+
`;
|
|
44553
|
+
}
|
|
44554
|
+
function installConsoleGuard() {
|
|
44555
|
+
if (guardInstalledSlot.get(false))
|
|
44556
|
+
return;
|
|
44557
|
+
const originals = {
|
|
44558
|
+
log: console.log,
|
|
44559
|
+
info: console.info,
|
|
44560
|
+
warn: console.warn,
|
|
44561
|
+
error: console.error,
|
|
44562
|
+
debug: console.debug
|
|
44563
|
+
};
|
|
44564
|
+
savedOriginalsSlot.set(originals);
|
|
44565
|
+
let reentrant = false;
|
|
44566
|
+
function guardedWriter(original) {
|
|
44567
|
+
return (...args) => {
|
|
44568
|
+
if (reentrant) {
|
|
44569
|
+
original.apply(console, args);
|
|
44570
|
+
return;
|
|
44571
|
+
}
|
|
44572
|
+
reentrant = true;
|
|
44573
|
+
try {
|
|
44574
|
+
getOutputSink().writeErr(formatArgs(args));
|
|
44575
|
+
} finally {
|
|
44576
|
+
reentrant = false;
|
|
44577
|
+
}
|
|
44578
|
+
};
|
|
44579
|
+
}
|
|
44580
|
+
console.log = guardedWriter(originals.log);
|
|
44581
|
+
console.info = guardedWriter(originals.info);
|
|
44582
|
+
console.warn = guardedWriter(originals.warn);
|
|
44583
|
+
console.error = guardedWriter(originals.error);
|
|
44584
|
+
console.debug = guardedWriter(originals.debug);
|
|
44585
|
+
guardInstalledSlot.set(true);
|
|
44586
|
+
}
|
|
44587
|
+
var guardInstalledSlot, savedOriginalsSlot;
|
|
44588
|
+
var init_console_guard = __esm(() => {
|
|
44589
|
+
init_output_context();
|
|
44590
|
+
init_singleton();
|
|
44591
|
+
guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
44592
|
+
savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
44593
|
+
});
|
|
44594
|
+
|
|
44595
|
+
// ../common/src/constants.ts
|
|
44596
|
+
var UIPATH_HOME_DIR = ".uipath", CONFIG_FILENAME = "config.json", DEFAULT_AUTH_TIMEOUT_MS, DEFAULT_FETCH_TIMEOUT_MS = 30000;
|
|
44597
|
+
var init_constants = __esm(() => {
|
|
44598
|
+
DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
44599
|
+
});
|
|
44600
|
+
// ../common/src/env-reference.ts
|
|
44601
|
+
function resolveEnvReference(value) {
|
|
44602
|
+
if (value == null)
|
|
44603
|
+
return value;
|
|
44604
|
+
if (value.startsWith("env.")) {
|
|
44605
|
+
const name = value.slice(4);
|
|
44606
|
+
const resolved = process.env[name];
|
|
44607
|
+
if (!resolved) {
|
|
44608
|
+
throw new Error(`Environment variable "${name}" is not set`);
|
|
44609
|
+
}
|
|
44610
|
+
return resolved;
|
|
44611
|
+
}
|
|
44612
|
+
return value;
|
|
44613
|
+
}
|
|
44614
|
+
|
|
44615
|
+
// ../common/src/error-instructions.ts
|
|
44616
|
+
var init_error_instructions = __esm(() => {
|
|
44617
|
+
init_error_handler();
|
|
44618
|
+
});
|
|
44619
|
+
|
|
44252
44620
|
// ../common/src/guid.ts
|
|
44253
44621
|
var init_guid = () => {};
|
|
44254
44622
|
|
|
44623
|
+
// ../common/src/interactivity-context.ts
|
|
44624
|
+
function setInteractivityMode(mode) {
|
|
44625
|
+
modeSlot.set(mode);
|
|
44626
|
+
}
|
|
44627
|
+
function getInteractivityMode() {
|
|
44628
|
+
return modeSlot.get("never") ?? "never";
|
|
44629
|
+
}
|
|
44630
|
+
function canPrompt() {
|
|
44631
|
+
const mode = getInteractivityMode();
|
|
44632
|
+
if (mode === "always") {
|
|
44633
|
+
return true;
|
|
44634
|
+
}
|
|
44635
|
+
if (mode === "never") {
|
|
44636
|
+
return false;
|
|
44637
|
+
}
|
|
44638
|
+
return getOutputSink().capabilities.isInteractive;
|
|
44639
|
+
}
|
|
44640
|
+
var modeSlot;
|
|
44641
|
+
var init_interactivity_context = __esm(() => {
|
|
44642
|
+
init_output_context();
|
|
44643
|
+
init_singleton();
|
|
44644
|
+
modeSlot = singleton("InteractivityMode");
|
|
44645
|
+
});
|
|
44646
|
+
|
|
44255
44647
|
// ../../node_modules/jsonpath-plus/dist/index-node-esm.js
|
|
44256
44648
|
import vm from "vm";
|
|
44257
44649
|
|
|
@@ -45799,7 +46191,6 @@ var init_sdk_user_agent = __esm(() => {
|
|
|
45799
46191
|
init_singleton();
|
|
45800
46192
|
sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
45801
46193
|
});
|
|
45802
|
-
|
|
45803
46194
|
// ../common/src/tool-provider.ts
|
|
45804
46195
|
function setPackagerFactoryProvider(provider) {
|
|
45805
46196
|
factorySlot.set(provider);
|
|
@@ -45810,223 +46201,6 @@ var init_tool_provider = __esm(() => {
|
|
|
45810
46201
|
factorySlot = singleton("PackagerFactoryProvider");
|
|
45811
46202
|
});
|
|
45812
46203
|
|
|
45813
|
-
// ../common/src/telemetry/pii-redactor.ts
|
|
45814
|
-
function shortHash(input) {
|
|
45815
|
-
let hash = 2166136261;
|
|
45816
|
-
for (let i = 0;i < input.length; i++) {
|
|
45817
|
-
hash ^= input.charCodeAt(i);
|
|
45818
|
-
hash = Math.imul(hash, 16777619);
|
|
45819
|
-
}
|
|
45820
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
45821
|
-
}
|
|
45822
|
-
function redactUrl(raw) {
|
|
45823
|
-
try {
|
|
45824
|
-
const url = new URL(raw);
|
|
45825
|
-
return `${url.protocol}//${url.host}`;
|
|
45826
|
-
} catch {
|
|
45827
|
-
return `url#${shortHash(raw)}`;
|
|
45828
|
-
}
|
|
45829
|
-
}
|
|
45830
|
-
function redactValueDetectors(value) {
|
|
45831
|
-
let out = value;
|
|
45832
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
45833
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
45834
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
45835
|
-
const core = trailing ? match.slice(0, -trailing.length) : match;
|
|
45836
|
-
return `${redactUrl(core)}${trailing}`;
|
|
45837
|
-
});
|
|
45838
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
45839
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
45840
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
45841
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
45842
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
45843
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
45844
|
-
}
|
|
45845
|
-
return out;
|
|
45846
|
-
}
|
|
45847
|
-
function nameTokens(name) {
|
|
45848
|
-
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);
|
|
45849
|
-
}
|
|
45850
|
-
function isSensitiveName(name) {
|
|
45851
|
-
const tokens = nameTokens(name);
|
|
45852
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
45853
|
-
const token = tokens[i];
|
|
45854
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
45855
|
-
return true;
|
|
45856
|
-
}
|
|
45857
|
-
if (token === "key" || token === "keys") {
|
|
45858
|
-
const prev = tokens[i - 1];
|
|
45859
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
45860
|
-
return true;
|
|
45861
|
-
}
|
|
45862
|
-
}
|
|
45863
|
-
}
|
|
45864
|
-
return false;
|
|
45865
|
-
}
|
|
45866
|
-
function redactProperty(name, value) {
|
|
45867
|
-
if (value === undefined || value === null) {
|
|
45868
|
-
return;
|
|
45869
|
-
}
|
|
45870
|
-
if (isSensitiveName(name)) {
|
|
45871
|
-
return REDACTED;
|
|
45872
|
-
}
|
|
45873
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
45874
|
-
return value;
|
|
45875
|
-
}
|
|
45876
|
-
if (typeof value !== "string") {
|
|
45877
|
-
return "[OBJECT]";
|
|
45878
|
-
}
|
|
45879
|
-
return redactValueDetectors(value);
|
|
45880
|
-
}
|
|
45881
|
-
function redactProperties(properties) {
|
|
45882
|
-
const out = {};
|
|
45883
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
45884
|
-
const redacted = redactProperty(name, value);
|
|
45885
|
-
if (redacted !== undefined) {
|
|
45886
|
-
out[name] = redacted;
|
|
45887
|
-
}
|
|
45888
|
-
}
|
|
45889
|
-
return out;
|
|
45890
|
-
}
|
|
45891
|
-
var REDACTED = "[REDACTED]", MAX_VALUE_LENGTH = 200, SENSITIVE_NAME_TOKENS, SENSITIVE_KEY_PREFIXES, UUID_PATTERN, EMAIL_PATTERN, JWT_PATTERN, LONG_TOKEN_PATTERN, USER_HOME_PATTERN, URL_PATTERN, URL_TRAILING_PUNCT;
|
|
45892
|
-
var init_pii_redactor = __esm(() => {
|
|
45893
|
-
SENSITIVE_NAME_TOKENS = new Set([
|
|
45894
|
-
"token",
|
|
45895
|
-
"tokens",
|
|
45896
|
-
"secret",
|
|
45897
|
-
"secrets",
|
|
45898
|
-
"password",
|
|
45899
|
-
"passwords",
|
|
45900
|
-
"pwd",
|
|
45901
|
-
"credential",
|
|
45902
|
-
"credentials",
|
|
45903
|
-
"auth",
|
|
45904
|
-
"authentication",
|
|
45905
|
-
"authorization",
|
|
45906
|
-
"authority",
|
|
45907
|
-
"cert",
|
|
45908
|
-
"certificate",
|
|
45909
|
-
"certificates"
|
|
45910
|
-
]);
|
|
45911
|
-
SENSITIVE_KEY_PREFIXES = new Set([
|
|
45912
|
-
"api",
|
|
45913
|
-
"access",
|
|
45914
|
-
"client",
|
|
45915
|
-
"private",
|
|
45916
|
-
"public",
|
|
45917
|
-
"signing",
|
|
45918
|
-
"encryption",
|
|
45919
|
-
"session",
|
|
45920
|
-
"master",
|
|
45921
|
-
"shared",
|
|
45922
|
-
"root",
|
|
45923
|
-
"ssh",
|
|
45924
|
-
"rsa",
|
|
45925
|
-
"aes",
|
|
45926
|
-
"hmac",
|
|
45927
|
-
"oauth"
|
|
45928
|
-
]);
|
|
45929
|
-
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;
|
|
45930
|
-
EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
45931
|
-
JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
45932
|
-
LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
45933
|
-
USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
45934
|
-
URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
45935
|
-
URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
45936
|
-
});
|
|
45937
|
-
|
|
45938
|
-
// ../common/src/trackedAction.ts
|
|
45939
|
-
function setProcessContextPollSignal(signal) {
|
|
45940
|
-
pollSignalSlot.set(signal);
|
|
45941
|
-
}
|
|
45942
|
-
function extractCommandParams(cmd) {
|
|
45943
|
-
const params = {};
|
|
45944
|
-
const registered = cmd.registeredArguments ?? [];
|
|
45945
|
-
const processed = cmd.processedArgs ?? [];
|
|
45946
|
-
for (let i = 0;i < registered.length; i++) {
|
|
45947
|
-
const value = processed[i];
|
|
45948
|
-
if (value === undefined) {
|
|
45949
|
-
continue;
|
|
45950
|
-
}
|
|
45951
|
-
const name = registered[i].name();
|
|
45952
|
-
if (name) {
|
|
45953
|
-
params[name] = value;
|
|
45954
|
-
}
|
|
45955
|
-
}
|
|
45956
|
-
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
45957
|
-
if (value !== undefined) {
|
|
45958
|
-
params[key] = value;
|
|
45959
|
-
}
|
|
45960
|
-
}
|
|
45961
|
-
return params;
|
|
45962
|
-
}
|
|
45963
|
-
function deriveCommandPath(cmd) {
|
|
45964
|
-
const parts = [];
|
|
45965
|
-
let current = cmd;
|
|
45966
|
-
while (current) {
|
|
45967
|
-
const name = current.name();
|
|
45968
|
-
if (name) {
|
|
45969
|
-
parts.unshift(name);
|
|
45970
|
-
}
|
|
45971
|
-
current = current.parent;
|
|
45972
|
-
}
|
|
45973
|
-
if (parts.length > 1) {
|
|
45974
|
-
parts.shift();
|
|
45975
|
-
}
|
|
45976
|
-
return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
|
|
45977
|
-
}
|
|
45978
|
-
var pollSignalSlot, processContext;
|
|
45979
|
-
var init_trackedAction = __esm(() => {
|
|
45980
|
-
init_esm();
|
|
45981
|
-
init_formatter();
|
|
45982
|
-
init_logger();
|
|
45983
|
-
init_singleton();
|
|
45984
|
-
init_pii_redactor();
|
|
45985
|
-
init_telemetry_init();
|
|
45986
|
-
pollSignalSlot = singleton("PollSignal");
|
|
45987
|
-
processContext = {
|
|
45988
|
-
exit: (code) => {
|
|
45989
|
-
process.exitCode = code;
|
|
45990
|
-
},
|
|
45991
|
-
get pollSignal() {
|
|
45992
|
-
return pollSignalSlot.get();
|
|
45993
|
-
}
|
|
45994
|
-
};
|
|
45995
|
-
Command.prototype.trackedAction = function(context, fn, properties) {
|
|
45996
|
-
const command = this;
|
|
45997
|
-
return this.action(async (...args) => {
|
|
45998
|
-
const telemetryName = deriveCommandPath(command);
|
|
45999
|
-
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
46000
|
-
const startTime = performance.now();
|
|
46001
|
-
let errorMessage;
|
|
46002
|
-
const [error] = await catchError(fn(...args));
|
|
46003
|
-
if (error) {
|
|
46004
|
-
errorMessage = error instanceof Error ? error.message : String(error);
|
|
46005
|
-
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
46006
|
-
const typed = error;
|
|
46007
|
-
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
46008
|
-
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
46009
|
-
const finalResult = customResult ?? RESULTS.Failure;
|
|
46010
|
-
OutputFormatter.error({
|
|
46011
|
-
Result: finalResult,
|
|
46012
|
-
Message: errorMessage,
|
|
46013
|
-
Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
|
|
46014
|
-
});
|
|
46015
|
-
context.exit(EXIT_CODES[finalResult]);
|
|
46016
|
-
}
|
|
46017
|
-
const durationMs = performance.now() - startTime;
|
|
46018
|
-
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
46019
|
-
telemetry.trackEvent(telemetryName, redactProperties({
|
|
46020
|
-
...extractCommandParams(command),
|
|
46021
|
-
...props,
|
|
46022
|
-
duration: String(durationMs),
|
|
46023
|
-
success: String(success),
|
|
46024
|
-
...errorMessage ? { errorMessage } : {}
|
|
46025
|
-
}));
|
|
46026
|
-
});
|
|
46027
|
-
};
|
|
46028
|
-
});
|
|
46029
|
-
|
|
46030
46204
|
// ../common/src/index.ts
|
|
46031
46205
|
var init_src2 = __esm(() => {
|
|
46032
46206
|
init_console_guard();
|
|
@@ -46035,10 +46209,13 @@ var init_src2 = __esm(() => {
|
|
|
46035
46209
|
init_command_examples();
|
|
46036
46210
|
init_command_help();
|
|
46037
46211
|
init_completer();
|
|
46212
|
+
init_confirmation();
|
|
46038
46213
|
init_constants();
|
|
46039
46214
|
init_error_handler();
|
|
46215
|
+
init_error_instructions();
|
|
46040
46216
|
init_formatter();
|
|
46041
46217
|
init_guid();
|
|
46218
|
+
init_interactivity_context();
|
|
46042
46219
|
init_jsonpath();
|
|
46043
46220
|
init_logger();
|
|
46044
46221
|
init_option_aliases();
|
|
@@ -46063,7 +46240,7 @@ var init_package = __esm(() => {
|
|
|
46063
46240
|
package_default = {
|
|
46064
46241
|
name: "@uipath/cli",
|
|
46065
46242
|
license: "MIT",
|
|
46066
|
-
version: "1.
|
|
46243
|
+
version: "1.196.1",
|
|
46067
46244
|
description: "Cross platform CLI for UiPath",
|
|
46068
46245
|
repository: {
|
|
46069
46246
|
type: "git",
|
|
@@ -46112,7 +46289,7 @@ var init_package = __esm(() => {
|
|
|
46112
46289
|
"@uipath/filesystem": "workspace:*",
|
|
46113
46290
|
applicationinsights: "^2.9.8",
|
|
46114
46291
|
commander: "^14.0.3",
|
|
46115
|
-
esbuild: "^0.
|
|
46292
|
+
esbuild: "^0.28.1",
|
|
46116
46293
|
"js-yaml": "^4.1.0",
|
|
46117
46294
|
ora: "^9.3.0",
|
|
46118
46295
|
"path-browserify": "^1.0.1",
|
|
@@ -46177,115 +46354,156 @@ var init_storage = __esm(() => {
|
|
|
46177
46354
|
});
|
|
46178
46355
|
|
|
46179
46356
|
// src/utils/globalOptions.ts
|
|
46180
|
-
function
|
|
46181
|
-
|
|
46182
|
-
|
|
46183
|
-
|
|
46184
|
-
|
|
46185
|
-
|
|
46186
|
-
|
|
46187
|
-
|
|
46188
|
-
|
|
46189
|
-
|
|
46190
|
-
|
|
46191
|
-
|
|
46192
|
-
|
|
46193
|
-
|
|
46194
|
-
|
|
46195
|
-
|
|
46196
|
-
|
|
46197
|
-
|
|
46198
|
-
|
|
46199
|
-
|
|
46200
|
-
|
|
46201
|
-
|
|
46202
|
-
|
|
46203
|
-
|
|
46204
|
-
|
|
46205
|
-
|
|
46206
|
-
|
|
46207
|
-
|
|
46357
|
+
function tryParseOutputFilter(state, args, i) {
|
|
46358
|
+
if (args[i] === "--output-filter" && i + 1 < args.length) {
|
|
46359
|
+
state.filter = args[i + 1];
|
|
46360
|
+
return { consumed: true, advance: 1 };
|
|
46361
|
+
}
|
|
46362
|
+
if (args[i]?.startsWith("--output-filter=")) {
|
|
46363
|
+
state.filter = args[i].substring("--output-filter=".length);
|
|
46364
|
+
return { consumed: true, advance: 0 };
|
|
46365
|
+
}
|
|
46366
|
+
return NOT_CONSUMED;
|
|
46367
|
+
}
|
|
46368
|
+
function tryParseJson(state, args, i) {
|
|
46369
|
+
if (args[i] !== "--json") {
|
|
46370
|
+
return NOT_CONSUMED;
|
|
46371
|
+
}
|
|
46372
|
+
state.sawJsonAlias = true;
|
|
46373
|
+
state.format = "json";
|
|
46374
|
+
state.formatWasExplicit = true;
|
|
46375
|
+
if (state.sawOutputOption) {
|
|
46376
|
+
state.outputConflict = true;
|
|
46377
|
+
}
|
|
46378
|
+
return { consumed: true, advance: 0 };
|
|
46379
|
+
}
|
|
46380
|
+
function applyOutputValue(state, value) {
|
|
46381
|
+
if (!state.sawJsonAlias) {
|
|
46382
|
+
state.format = value;
|
|
46383
|
+
}
|
|
46384
|
+
state.formatWasExplicit = true;
|
|
46385
|
+
}
|
|
46386
|
+
function tryParseOutputSpace(state, args, i) {
|
|
46387
|
+
if (args[i] !== "--output") {
|
|
46388
|
+
return NOT_CONSUMED;
|
|
46389
|
+
}
|
|
46390
|
+
state.sawOutputOption = true;
|
|
46391
|
+
if (state.sawJsonAlias) {
|
|
46392
|
+
state.outputConflict = true;
|
|
46393
|
+
}
|
|
46394
|
+
if (i + 1 < args.length) {
|
|
46395
|
+
const v = args[i + 1];
|
|
46396
|
+
if (VALID_FORMATS.includes(v)) {
|
|
46397
|
+
applyOutputValue(state, v);
|
|
46398
|
+
return { consumed: true, advance: 1 };
|
|
46208
46399
|
}
|
|
46209
|
-
if (
|
|
46210
|
-
|
|
46211
|
-
if (sawJsonAlias) {
|
|
46212
|
-
outputConflict = true;
|
|
46213
|
-
}
|
|
46214
|
-
if (i + 1 < args.length) {
|
|
46215
|
-
const v = args[i + 1];
|
|
46216
|
-
if (VALID_FORMATS.includes(v)) {
|
|
46217
|
-
if (!sawJsonAlias) {
|
|
46218
|
-
format2 = v;
|
|
46219
|
-
}
|
|
46220
|
-
formatWasExplicit = true;
|
|
46221
|
-
i++;
|
|
46222
|
-
continue;
|
|
46223
|
-
}
|
|
46224
|
-
if (sawJsonAlias) {
|
|
46225
|
-
i++;
|
|
46226
|
-
continue;
|
|
46227
|
-
}
|
|
46228
|
-
}
|
|
46229
|
-
if (sawJsonAlias) {
|
|
46230
|
-
continue;
|
|
46231
|
-
}
|
|
46400
|
+
if (state.sawJsonAlias) {
|
|
46401
|
+
return { consumed: true, advance: 1 };
|
|
46232
46402
|
}
|
|
46233
|
-
|
|
46234
|
-
|
|
46235
|
-
|
|
46236
|
-
|
|
46237
|
-
|
|
46238
|
-
|
|
46239
|
-
|
|
46240
|
-
|
|
46241
|
-
|
|
46242
|
-
|
|
46243
|
-
|
|
46244
|
-
|
|
46245
|
-
|
|
46246
|
-
|
|
46247
|
-
|
|
46248
|
-
|
|
46403
|
+
}
|
|
46404
|
+
if (state.sawJsonAlias) {
|
|
46405
|
+
return { consumed: true, advance: 0 };
|
|
46406
|
+
}
|
|
46407
|
+
return NOT_CONSUMED;
|
|
46408
|
+
}
|
|
46409
|
+
function tryParseOutputEquals(state, args, i) {
|
|
46410
|
+
if (!args[i]?.startsWith("--output=")) {
|
|
46411
|
+
return NOT_CONSUMED;
|
|
46412
|
+
}
|
|
46413
|
+
state.sawOutputOption = true;
|
|
46414
|
+
if (state.sawJsonAlias) {
|
|
46415
|
+
state.outputConflict = true;
|
|
46416
|
+
}
|
|
46417
|
+
const v = args[i].substring("--output=".length);
|
|
46418
|
+
if (VALID_FORMATS.includes(v)) {
|
|
46419
|
+
applyOutputValue(state, v);
|
|
46420
|
+
return { consumed: true, advance: 0 };
|
|
46421
|
+
}
|
|
46422
|
+
if (state.sawJsonAlias) {
|
|
46423
|
+
return { consumed: true, advance: 0 };
|
|
46424
|
+
}
|
|
46425
|
+
return NOT_CONSUMED;
|
|
46426
|
+
}
|
|
46427
|
+
function tryParseLogLevel(state, args, i) {
|
|
46428
|
+
if (args[i] === "--log-level" && i + 1 < args.length) {
|
|
46429
|
+
const parsed = VALID_LOG_LEVELS[args[i + 1].toLowerCase()];
|
|
46430
|
+
if (parsed !== undefined) {
|
|
46431
|
+
state.logLevel = parsed;
|
|
46249
46432
|
}
|
|
46250
|
-
|
|
46251
|
-
|
|
46252
|
-
|
|
46253
|
-
|
|
46254
|
-
|
|
46255
|
-
|
|
46256
|
-
continue;
|
|
46433
|
+
return { consumed: true, advance: 1 };
|
|
46434
|
+
}
|
|
46435
|
+
if (args[i]?.startsWith("--log-level=")) {
|
|
46436
|
+
const parsed = VALID_LOG_LEVELS[args[i].substring("--log-level=".length).toLowerCase()];
|
|
46437
|
+
if (parsed !== undefined) {
|
|
46438
|
+
state.logLevel = parsed;
|
|
46257
46439
|
}
|
|
46258
|
-
|
|
46259
|
-
|
|
46260
|
-
|
|
46261
|
-
|
|
46440
|
+
return { consumed: true, advance: 0 };
|
|
46441
|
+
}
|
|
46442
|
+
return NOT_CONSUMED;
|
|
46443
|
+
}
|
|
46444
|
+
function tryParseLogFile(state, args, i) {
|
|
46445
|
+
if (args[i] === "--log-file" && i + 1 < args.length) {
|
|
46446
|
+
state.logFile = args[i + 1];
|
|
46447
|
+
return { consumed: true, advance: 1 };
|
|
46448
|
+
}
|
|
46449
|
+
if (args[i]?.startsWith("--log-file=")) {
|
|
46450
|
+
state.logFile = args[i].substring("--log-file=".length);
|
|
46451
|
+
return { consumed: true, advance: 0 };
|
|
46452
|
+
}
|
|
46453
|
+
return NOT_CONSUMED;
|
|
46454
|
+
}
|
|
46455
|
+
function tryParseInteractive(state, args, i) {
|
|
46456
|
+
if (args[i] === "--interactive") {
|
|
46457
|
+
state.interactive = "always";
|
|
46458
|
+
return { consumed: true, advance: 0 };
|
|
46459
|
+
}
|
|
46460
|
+
if (args[i] === "--no-interactive") {
|
|
46461
|
+
state.interactive = "never";
|
|
46462
|
+
return { consumed: true, advance: 0 };
|
|
46463
|
+
}
|
|
46464
|
+
return NOT_CONSUMED;
|
|
46465
|
+
}
|
|
46466
|
+
function stripGlobalOptions(args) {
|
|
46467
|
+
const state = {
|
|
46468
|
+
cleaned: [],
|
|
46469
|
+
format: undefined,
|
|
46470
|
+
formatWasExplicit: false,
|
|
46471
|
+
sawJsonAlias: false,
|
|
46472
|
+
sawOutputOption: false,
|
|
46473
|
+
outputConflict: false,
|
|
46474
|
+
filter: undefined,
|
|
46475
|
+
logLevel: undefined,
|
|
46476
|
+
logFile: undefined,
|
|
46477
|
+
interactive: undefined
|
|
46478
|
+
};
|
|
46479
|
+
for (let i = 0;i < args.length; i++) {
|
|
46480
|
+
let matched = false;
|
|
46481
|
+
for (const matcher of MATCHERS) {
|
|
46482
|
+
const result = matcher(state, args, i);
|
|
46483
|
+
if (result.consumed) {
|
|
46484
|
+
i += result.advance;
|
|
46485
|
+
matched = true;
|
|
46486
|
+
break;
|
|
46262
46487
|
}
|
|
46263
|
-
continue;
|
|
46264
46488
|
}
|
|
46265
|
-
if (
|
|
46266
|
-
|
|
46267
|
-
i++;
|
|
46268
|
-
continue;
|
|
46269
|
-
}
|
|
46270
|
-
if (args[i]?.startsWith("--log-file=")) {
|
|
46271
|
-
logFile = args[i].substring("--log-file=".length);
|
|
46272
|
-
continue;
|
|
46489
|
+
if (!matched) {
|
|
46490
|
+
state.cleaned.push(args[i]);
|
|
46273
46491
|
}
|
|
46274
|
-
cleaned.push(args[i]);
|
|
46275
46492
|
}
|
|
46276
46493
|
const envDefault = process.env?.UIP_DEFAULT_OUTPUT;
|
|
46277
|
-
const resolvedFormat =
|
|
46494
|
+
const resolvedFormat = state.format ?? (envDefault && VALID_FORMATS.includes(envDefault) ? envDefault : "json");
|
|
46278
46495
|
return {
|
|
46279
|
-
args: cleaned,
|
|
46496
|
+
args: state.cleaned,
|
|
46280
46497
|
format: resolvedFormat,
|
|
46281
|
-
formatWasExplicit,
|
|
46282
|
-
outputConflict,
|
|
46283
|
-
filter,
|
|
46284
|
-
logLevel,
|
|
46285
|
-
logFile
|
|
46498
|
+
formatWasExplicit: state.formatWasExplicit,
|
|
46499
|
+
outputConflict: state.outputConflict,
|
|
46500
|
+
filter: state.filter,
|
|
46501
|
+
logLevel: state.logLevel,
|
|
46502
|
+
logFile: state.logFile,
|
|
46503
|
+
interactive: state.interactive
|
|
46286
46504
|
};
|
|
46287
46505
|
}
|
|
46288
|
-
var VALID_FORMATS, VALID_LOG_LEVELS;
|
|
46506
|
+
var VALID_FORMATS, VALID_LOG_LEVELS, NOT_CONSUMED, MATCHERS;
|
|
46289
46507
|
var init_globalOptions = __esm(() => {
|
|
46290
46508
|
VALID_FORMATS = ["table", "json", "yaml", "plain"];
|
|
46291
46509
|
VALID_LOG_LEVELS = {
|
|
@@ -46294,6 +46512,16 @@ var init_globalOptions = __esm(() => {
|
|
|
46294
46512
|
warn: 2,
|
|
46295
46513
|
error: 3
|
|
46296
46514
|
};
|
|
46515
|
+
NOT_CONSUMED = { consumed: false, advance: 0 };
|
|
46516
|
+
MATCHERS = [
|
|
46517
|
+
tryParseOutputFilter,
|
|
46518
|
+
tryParseJson,
|
|
46519
|
+
tryParseOutputSpace,
|
|
46520
|
+
tryParseOutputEquals,
|
|
46521
|
+
tryParseLogLevel,
|
|
46522
|
+
tryParseLogFile,
|
|
46523
|
+
tryParseInteractive
|
|
46524
|
+
];
|
|
46297
46525
|
});
|
|
46298
46526
|
|
|
46299
46527
|
// src/utils/helpFormatter.ts
|
|
@@ -46620,6 +46848,12 @@ function buildTableHelpSections(cmd, helper) {
|
|
|
46620
46848
|
Lines: buildExampleLines(baseHelp.Examples, contentWidth)
|
|
46621
46849
|
});
|
|
46622
46850
|
}
|
|
46851
|
+
if (isRootCommand(cmd)) {
|
|
46852
|
+
sections.push({
|
|
46853
|
+
Title: "Getting started",
|
|
46854
|
+
Lines: renderRows(GETTING_STARTED_ROWS, contentWidth)
|
|
46855
|
+
});
|
|
46856
|
+
}
|
|
46623
46857
|
return sections;
|
|
46624
46858
|
}
|
|
46625
46859
|
function renderTableHelp(cmd, helper) {
|
|
@@ -46647,15 +46881,25 @@ function createHelpConfiguration(isBrowser2) {
|
|
|
46647
46881
|
return renderTableHelp(cmd, helper);
|
|
46648
46882
|
}
|
|
46649
46883
|
const baseHelp = extractCommandHelp(cmd, helper);
|
|
46650
|
-
const subcommands = helper.visibleCommands(cmd).map((sub2) =>
|
|
46651
|
-
|
|
46652
|
-
|
|
46653
|
-
|
|
46884
|
+
const subcommands = helper.visibleCommands(cmd).map((sub2) => {
|
|
46885
|
+
const entry = {
|
|
46886
|
+
Name: sub2.name(),
|
|
46887
|
+
Description: helper.subcommandDescription(sub2)
|
|
46888
|
+
};
|
|
46889
|
+
const aliases = sub2.aliases();
|
|
46890
|
+
if (aliases.length > 0) {
|
|
46891
|
+
entry.Aliases = aliases;
|
|
46892
|
+
}
|
|
46893
|
+
return entry;
|
|
46894
|
+
});
|
|
46654
46895
|
const helpData = {
|
|
46655
46896
|
...baseHelp,
|
|
46656
46897
|
Subcommands: subcommands,
|
|
46657
46898
|
GlobalOptions: GLOBAL_OPTIONS
|
|
46658
46899
|
};
|
|
46900
|
+
if (isRootCommand(cmd)) {
|
|
46901
|
+
helpData.GettingStarted = GETTING_STARTED_ROWS;
|
|
46902
|
+
}
|
|
46659
46903
|
const output = {
|
|
46660
46904
|
Result: RESULTS.Success,
|
|
46661
46905
|
Code: "Help",
|
|
@@ -46677,7 +46921,7 @@ function createHelpConfiguration(isBrowser2) {
|
|
|
46677
46921
|
}
|
|
46678
46922
|
return config;
|
|
46679
46923
|
}
|
|
46680
|
-
var GLOBAL_OPTIONS, BUILT_IN_ROOT_COMMANDS;
|
|
46924
|
+
var GLOBAL_OPTIONS, BUILT_IN_ROOT_COMMANDS, GETTING_STARTED_ROWS;
|
|
46681
46925
|
var init_helpFormatter = __esm(() => {
|
|
46682
46926
|
init_src2();
|
|
46683
46927
|
GLOBAL_OPTIONS = [
|
|
@@ -46708,16 +46952,49 @@ var init_helpFormatter = __esm(() => {
|
|
|
46708
46952
|
"feedback",
|
|
46709
46953
|
"help"
|
|
46710
46954
|
];
|
|
46955
|
+
GETTING_STARTED_ROWS = [
|
|
46956
|
+
{
|
|
46957
|
+
Label: "uip login",
|
|
46958
|
+
Description: "Authenticate against the UiPath Platform"
|
|
46959
|
+
},
|
|
46960
|
+
{
|
|
46961
|
+
Label: "uip <command> --help",
|
|
46962
|
+
Description: "Show help for any command"
|
|
46963
|
+
},
|
|
46964
|
+
{
|
|
46965
|
+
Label: "uip skills install",
|
|
46966
|
+
Description: "Install AI-agent skills for this CLI"
|
|
46967
|
+
}
|
|
46968
|
+
];
|
|
46711
46969
|
});
|
|
46712
46970
|
|
|
46713
46971
|
// src/utils/parseError.ts
|
|
46972
|
+
function helpInstructions(cleanedArgs) {
|
|
46973
|
+
const commandParts = [];
|
|
46974
|
+
const userArgs = cleanedArgs.slice(2);
|
|
46975
|
+
for (let i = 0;i < userArgs.length; i++) {
|
|
46976
|
+
const arg = userArgs[i];
|
|
46977
|
+
if (arg === "--") {
|
|
46978
|
+
break;
|
|
46979
|
+
}
|
|
46980
|
+
if (arg.startsWith("-")) {
|
|
46981
|
+
if (!arg.includes("=") && i + 1 < userArgs.length && !userArgs[i + 1].startsWith("-")) {
|
|
46982
|
+
i++;
|
|
46983
|
+
}
|
|
46984
|
+
continue;
|
|
46985
|
+
}
|
|
46986
|
+
commandParts.push(arg);
|
|
46987
|
+
}
|
|
46988
|
+
const command = ["uip", ...commandParts].join(" ");
|
|
46989
|
+
return `Run '${command} --help' for usage information.`;
|
|
46990
|
+
}
|
|
46714
46991
|
function instructionsForUnknownCommand(cleanedArgs) {
|
|
46715
46992
|
const firstUserToken = cleanedArgs.slice(2).find((a) => !a.startsWith("-"));
|
|
46716
46993
|
const flagHint = firstUserToken && FLAG_HINTS[firstUserToken];
|
|
46717
46994
|
if (flagHint) {
|
|
46718
46995
|
return `Did you mean \`${flagHint}\`? Use --help for usage information.`;
|
|
46719
46996
|
}
|
|
46720
|
-
return
|
|
46997
|
+
return "Run 'uip --help' to list available commands.";
|
|
46721
46998
|
}
|
|
46722
46999
|
async function handleParseError(error, cleanedArgs, context) {
|
|
46723
47000
|
const isObj = error !== null && typeof error === "object";
|
|
@@ -46734,11 +47011,13 @@ async function handleParseError(error, cleanedArgs, context) {
|
|
|
46734
47011
|
context.exit(exitCode ?? 0);
|
|
46735
47012
|
return;
|
|
46736
47013
|
}
|
|
46737
|
-
const instructions = code === "commander.unknownCommand" ? instructionsForUnknownCommand(cleanedArgs) :
|
|
47014
|
+
const instructions = code === "commander.unknownCommand" ? instructionsForUnknownCommand(cleanedArgs) : helpInstructions(cleanedArgs);
|
|
46738
47015
|
OutputFormatter.error({
|
|
46739
47016
|
Result: RESULTS.ValidationError,
|
|
47017
|
+
ErrorCode: "invalid_argument",
|
|
46740
47018
|
Message: message,
|
|
46741
|
-
Instructions: instructions
|
|
47019
|
+
Instructions: instructions,
|
|
47020
|
+
Retry: "RetryWillNotFix"
|
|
46742
47021
|
});
|
|
46743
47022
|
await telemetryFlushAndShutdown();
|
|
46744
47023
|
context.exit(process.exitCode ? Number(process.exitCode) : 1);
|
|
@@ -46747,7 +47026,7 @@ async function handleParseError(error, cleanedArgs, context) {
|
|
|
46747
47026
|
await telemetryFlushAndShutdown();
|
|
46748
47027
|
context.exit(process.exitCode ? Number(process.exitCode) : 1);
|
|
46749
47028
|
}
|
|
46750
|
-
var FLAG_HINTS
|
|
47029
|
+
var FLAG_HINTS;
|
|
46751
47030
|
var init_parseError = __esm(() => {
|
|
46752
47031
|
init_src2();
|
|
46753
47032
|
FLAG_HINTS = {
|
|
@@ -46813,7 +47092,8 @@ async function initProgram(context, hooks2 = {}) {
|
|
|
46813
47092
|
outputConflict,
|
|
46814
47093
|
filter,
|
|
46815
47094
|
logLevel,
|
|
46816
|
-
logFile
|
|
47095
|
+
logFile,
|
|
47096
|
+
interactive
|
|
46817
47097
|
} = globalOptions;
|
|
46818
47098
|
context.args = cleanedArgs;
|
|
46819
47099
|
const overrides = hooks2.beforeLoggerConfigure ? await hooks2.beforeLoggerConfigure({
|
|
@@ -46822,6 +47102,7 @@ async function initProgram(context, hooks2 = {}) {
|
|
|
46822
47102
|
}) : {};
|
|
46823
47103
|
const effectiveFormat = formatWasExplicit ? helpFormat : overrides.outputFormat ?? helpFormat;
|
|
46824
47104
|
const effectiveLogLevel = logLevel !== undefined ? logLevel : overrides.level;
|
|
47105
|
+
setInteractivityMode(interactive ?? overrides.interactivityMode ?? "never");
|
|
46825
47106
|
setOutputFormat(!formatWasExplicit && cleanedArgs.some((arg) => HELP_FLAGS.has(arg)) ? "table" : effectiveFormat);
|
|
46826
47107
|
setOutputFormatExplicit(formatWasExplicit);
|
|
46827
47108
|
configureLogger({
|
|
@@ -50969,6 +51250,7 @@ var init_tools_whitelist = __esm(() => {
|
|
|
50969
51250
|
["@uipath/solution-tool", "solution"],
|
|
50970
51251
|
["@uipath/agent-tool", "agent"],
|
|
50971
51252
|
["@uipath/agenthub-tool", "agenthub"],
|
|
51253
|
+
["@uipath/conversational-tool", "conversational"],
|
|
50972
51254
|
["@uipath/codedagent-tool", "codedagent"],
|
|
50973
51255
|
["@uipath/context-grounding-tool", "context-grounding"],
|
|
50974
51256
|
["@uipath/functions-tool", "functions"],
|
|
@@ -50977,7 +51259,6 @@ var init_tools_whitelist = __esm(() => {
|
|
|
50977
51259
|
["@uipath/orchestrator-tool", "or"],
|
|
50978
51260
|
["@uipath/rpa-tool", "rpa"],
|
|
50979
51261
|
["@uipath/test-manager-tool", "tm"],
|
|
50980
|
-
["@uipath/resource-tool", "resource"],
|
|
50981
51262
|
["@uipath/api-workflow-tool", "api-workflow"],
|
|
50982
51263
|
["@uipath/maestro-tool", "maestro"],
|
|
50983
51264
|
["@uipath/docsai-tool", "docsai"],
|
|
@@ -50991,6 +51272,7 @@ var init_tools_whitelist = __esm(() => {
|
|
|
50991
51272
|
["@uipath/tasks-tool", "tasks"],
|
|
50992
51273
|
["@uipath/aops-tool", "aops"],
|
|
50993
51274
|
["@uipath/llmgw-tool", "llm-configuration"],
|
|
51275
|
+
["@uipath/model-hub-tool", "model-hub"],
|
|
50994
51276
|
["@uipath/platform-tool", "platform"]
|
|
50995
51277
|
]);
|
|
50996
51278
|
COMMAND_ALIASES = new Map([
|
|
@@ -51020,167 +51302,6 @@ var init_tools_whitelist = __esm(() => {
|
|
|
51020
51302
|
]));
|
|
51021
51303
|
});
|
|
51022
51304
|
|
|
51023
|
-
// src/utils/npmrc.ts
|
|
51024
|
-
var exports_npmrc = {};
|
|
51025
|
-
__export(exports_npmrc, {
|
|
51026
|
-
findNpmrcConfig: () => findNpmrcConfig
|
|
51027
|
-
});
|
|
51028
|
-
function expandEnvVars(raw) {
|
|
51029
|
-
let hasMissing = false;
|
|
51030
|
-
const expanded = raw.replace(/\$\{([^}]+)\}/g, (_, v) => {
|
|
51031
|
-
const val = process.env[v];
|
|
51032
|
-
if (val === undefined) {
|
|
51033
|
-
hasMissing = true;
|
|
51034
|
-
logger.warn(`Warning: .npmrc references \${${v}} but it is not set.`);
|
|
51035
|
-
return "";
|
|
51036
|
-
}
|
|
51037
|
-
return val;
|
|
51038
|
-
});
|
|
51039
|
-
return hasMissing ? undefined : expanded;
|
|
51040
|
-
}
|
|
51041
|
-
function parseNpmrc(content) {
|
|
51042
|
-
const result = { tokensByHost: new Map };
|
|
51043
|
-
for (const line of content.split(`
|
|
51044
|
-
`)) {
|
|
51045
|
-
const trimmed = line.trim();
|
|
51046
|
-
if (!trimmed || trimmed.startsWith(";") || trimmed.startsWith("#"))
|
|
51047
|
-
continue;
|
|
51048
|
-
const tokenMatch = trimmed.match(/^\/\/([^/]+)\/:_authToken=(.+)$/);
|
|
51049
|
-
if (tokenMatch) {
|
|
51050
|
-
const host = tokenMatch[1];
|
|
51051
|
-
const raw = tokenMatch[2].trim();
|
|
51052
|
-
const expanded = expandEnvVars(raw);
|
|
51053
|
-
if (expanded) {
|
|
51054
|
-
result.tokensByHost.set(host, expanded);
|
|
51055
|
-
}
|
|
51056
|
-
}
|
|
51057
|
-
const prefixMatch = trimmed.match(/^prefix=(.+)$/);
|
|
51058
|
-
if (prefixMatch)
|
|
51059
|
-
result.prefix = prefixMatch[1].trim();
|
|
51060
|
-
const scopedMatch = trimmed.match(/^@uipath:registry=(.+)$/);
|
|
51061
|
-
if (scopedMatch)
|
|
51062
|
-
result.scopedRegistry = scopedMatch[1].trim();
|
|
51063
|
-
}
|
|
51064
|
-
return result;
|
|
51065
|
-
}
|
|
51066
|
-
function registryHost(url) {
|
|
51067
|
-
const [error, parsed] = catchError(() => new URL(url));
|
|
51068
|
-
if (error)
|
|
51069
|
-
return;
|
|
51070
|
-
return parsed.host;
|
|
51071
|
-
}
|
|
51072
|
-
function getNpmGlobalPrefix() {
|
|
51073
|
-
const fromEnv = process.env.PREFIX ?? process.env.npm_config_prefix ?? process.env.NPM_CONFIG_PREFIX;
|
|
51074
|
-
if (fromEnv)
|
|
51075
|
-
return fromEnv;
|
|
51076
|
-
const fs7 = getFileSystem();
|
|
51077
|
-
const execPath = process.execPath;
|
|
51078
|
-
if (process.platform === "win32")
|
|
51079
|
-
return fs7.path.dirname(execPath);
|
|
51080
|
-
return fs7.path.dirname(fs7.path.dirname(execPath));
|
|
51081
|
-
}
|
|
51082
|
-
function getBuiltinNpmrcPath(prefix) {
|
|
51083
|
-
const fs7 = getFileSystem();
|
|
51084
|
-
if (process.platform === "win32") {
|
|
51085
|
-
return fs7.path.join(prefix, "node_modules", "npm", "npmrc");
|
|
51086
|
-
}
|
|
51087
|
-
return fs7.path.join(prefix, "lib", "node_modules", "npm", "npmrc");
|
|
51088
|
-
}
|
|
51089
|
-
function readEnvSource() {
|
|
51090
|
-
const result = { tokensByHost: new Map };
|
|
51091
|
-
for (const [key, value] of Object.entries(process.env)) {
|
|
51092
|
-
if (value === undefined)
|
|
51093
|
-
continue;
|
|
51094
|
-
const match = key.match(/^npm_config_(.+)$/i);
|
|
51095
|
-
if (!match)
|
|
51096
|
-
continue;
|
|
51097
|
-
const configKey = match[1];
|
|
51098
|
-
const lower2 = configKey.toLowerCase();
|
|
51099
|
-
if (lower2 === "@uipath:registry") {
|
|
51100
|
-
result.scopedRegistry = value;
|
|
51101
|
-
continue;
|
|
51102
|
-
}
|
|
51103
|
-
if (lower2 === "prefix") {
|
|
51104
|
-
result.prefix = value;
|
|
51105
|
-
continue;
|
|
51106
|
-
}
|
|
51107
|
-
const tokenMatch = configKey.match(/^\/\/([^/]+)\/:_authToken$/);
|
|
51108
|
-
if (tokenMatch) {
|
|
51109
|
-
result.tokensByHost.set(tokenMatch[1], value);
|
|
51110
|
-
}
|
|
51111
|
-
}
|
|
51112
|
-
return result;
|
|
51113
|
-
}
|
|
51114
|
-
async function readNpmrcFile(path6, seen) {
|
|
51115
|
-
if (seen.has(path6))
|
|
51116
|
-
return null;
|
|
51117
|
-
seen.add(path6);
|
|
51118
|
-
const fs7 = getFileSystem();
|
|
51119
|
-
const [readError, content] = await catchError(fs7.readFile(path6, "utf-8"));
|
|
51120
|
-
if (readError || !content)
|
|
51121
|
-
return null;
|
|
51122
|
-
logger.debug(`Found .npmrc at ${path6}`);
|
|
51123
|
-
return parseNpmrc(content);
|
|
51124
|
-
}
|
|
51125
|
-
async function findNpmrcConfig() {
|
|
51126
|
-
const fs7 = getFileSystem();
|
|
51127
|
-
const sources = [];
|
|
51128
|
-
const seen = new Set;
|
|
51129
|
-
sources.push(readEnvSource());
|
|
51130
|
-
let dir = fs7.env.cwd();
|
|
51131
|
-
for (let i = 0;i < 20; i++) {
|
|
51132
|
-
const parsed = await readNpmrcFile(fs7.path.join(dir, ".npmrc"), seen);
|
|
51133
|
-
if (parsed)
|
|
51134
|
-
sources.push(parsed);
|
|
51135
|
-
const parent = fs7.path.dirname(dir);
|
|
51136
|
-
if (parent === dir)
|
|
51137
|
-
break;
|
|
51138
|
-
dir = parent;
|
|
51139
|
-
}
|
|
51140
|
-
const userConfigPath = process.env.NPM_CONFIG_USERCONFIG ?? process.env.npm_config_userconfig ?? fs7.path.join(fs7.env.homedir(), ".npmrc");
|
|
51141
|
-
const userParsed = await readNpmrcFile(userConfigPath, seen);
|
|
51142
|
-
if (userParsed)
|
|
51143
|
-
sources.push(userParsed);
|
|
51144
|
-
const prefix = getNpmGlobalPrefix();
|
|
51145
|
-
const globalConfigPath = process.env.NPM_CONFIG_GLOBALCONFIG ?? process.env.npm_config_globalconfig ?? fs7.path.join(prefix, "etc", "npmrc");
|
|
51146
|
-
const globalParsed = await readNpmrcFile(globalConfigPath, seen);
|
|
51147
|
-
if (globalParsed)
|
|
51148
|
-
sources.push(globalParsed);
|
|
51149
|
-
const builtinParsed = await readNpmrcFile(getBuiltinNpmrcPath(prefix), seen);
|
|
51150
|
-
if (builtinParsed)
|
|
51151
|
-
sources.push(builtinParsed);
|
|
51152
|
-
logger.debug(`Resolved npm config from ${sources.length} source(s) (env + ${seen.size} npmrc path(s) probed)`);
|
|
51153
|
-
let scopedRegistry;
|
|
51154
|
-
let prefixValue;
|
|
51155
|
-
const tokensByHost = new Map;
|
|
51156
|
-
for (const src of sources) {
|
|
51157
|
-
if (src.scopedRegistry && !scopedRegistry) {
|
|
51158
|
-
scopedRegistry = src.scopedRegistry;
|
|
51159
|
-
logger.debug(`@uipath:registry = ${scopedRegistry}`);
|
|
51160
|
-
}
|
|
51161
|
-
if (src.prefix && !prefixValue)
|
|
51162
|
-
prefixValue = src.prefix;
|
|
51163
|
-
for (const [host, token] of src.tokensByHost) {
|
|
51164
|
-
if (!tokensByHost.has(host)) {
|
|
51165
|
-
tokensByHost.set(host, token);
|
|
51166
|
-
logger.debug(`Auth token found for host '${host}'`);
|
|
51167
|
-
}
|
|
51168
|
-
}
|
|
51169
|
-
}
|
|
51170
|
-
let authToken;
|
|
51171
|
-
if (scopedRegistry) {
|
|
51172
|
-
const host = registryHost(scopedRegistry);
|
|
51173
|
-
if (host) {
|
|
51174
|
-
authToken = tokensByHost.get(host);
|
|
51175
|
-
}
|
|
51176
|
-
}
|
|
51177
|
-
return { scopedRegistry, authToken, prefix: prefixValue };
|
|
51178
|
-
}
|
|
51179
|
-
var init_npmrc = __esm(() => {
|
|
51180
|
-
init_src2();
|
|
51181
|
-
init_src();
|
|
51182
|
-
});
|
|
51183
|
-
|
|
51184
51305
|
// src/services/toolService.ts
|
|
51185
51306
|
function isValidSemver(v) {
|
|
51186
51307
|
return SEMVER_RE.test(v);
|
|
@@ -51233,6 +51354,26 @@ function compareSemver(a, b) {
|
|
|
51233
51354
|
}
|
|
51234
51355
|
return 0;
|
|
51235
51356
|
}
|
|
51357
|
+
function loadChildProcess() {
|
|
51358
|
+
childProcessModulePromise ??= import("node:child_process");
|
|
51359
|
+
return childProcessModulePromise;
|
|
51360
|
+
}
|
|
51361
|
+
async function isBunOnPath() {
|
|
51362
|
+
if (cachedBunOnPath !== undefined)
|
|
51363
|
+
return cachedBunOnPath;
|
|
51364
|
+
const [error, result] = await catchError((async () => {
|
|
51365
|
+
const { spawn } = await loadChildProcess();
|
|
51366
|
+
const isWindows = process.platform === "win32";
|
|
51367
|
+
const cmd = isWindows ? "where" : "which";
|
|
51368
|
+
return await new Promise((resolve2) => {
|
|
51369
|
+
const proc = spawn(cmd, ["bun"], { stdio: "ignore" });
|
|
51370
|
+
proc.on("error", () => resolve2(false));
|
|
51371
|
+
proc.on("close", (code) => resolve2(code === 0));
|
|
51372
|
+
});
|
|
51373
|
+
})());
|
|
51374
|
+
cachedBunOnPath = !error && result === true;
|
|
51375
|
+
return cachedBunOnPath;
|
|
51376
|
+
}
|
|
51236
51377
|
function validatePackageSpec(spec) {
|
|
51237
51378
|
if (!SAFE_PACKAGE_SPEC.test(spec)) {
|
|
51238
51379
|
throw new Error(`Invalid package specifier: '${spec}'. Only alphanumeric characters, dots, hyphens, underscores, slashes, and @ are allowed.`);
|
|
@@ -51256,11 +51397,9 @@ function parsePackageSpec(spec) {
|
|
|
51256
51397
|
version: spec.slice(versionSeparator + 1) || undefined
|
|
51257
51398
|
};
|
|
51258
51399
|
}
|
|
51259
|
-
function
|
|
51260
|
-
const
|
|
51261
|
-
|
|
51262
|
-
return null;
|
|
51263
|
-
return `${match[1]}.${match[2]}.0`;
|
|
51400
|
+
function scopeRegistryEnv(packageName, registry2) {
|
|
51401
|
+
const scope = packageName.split("/")[0];
|
|
51402
|
+
return { [`npm_config_${scope}:registry`]: registry2 };
|
|
51264
51403
|
}
|
|
51265
51404
|
function pickForChannel(versions, channel) {
|
|
51266
51405
|
if (channel === "stable") {
|
|
@@ -51269,6 +51408,20 @@ function pickForChannel(versions, channel) {
|
|
|
51269
51408
|
const tag = `-${channel}.`;
|
|
51270
51409
|
return versions.find((v) => v.includes(tag)) ?? null;
|
|
51271
51410
|
}
|
|
51411
|
+
function channelFallbacks(channel) {
|
|
51412
|
+
if (channel === "beta") {
|
|
51413
|
+
return ["beta", "alpha", "stable"];
|
|
51414
|
+
}
|
|
51415
|
+
return [channel];
|
|
51416
|
+
}
|
|
51417
|
+
function pickForChannelWithFallback(versions, channel) {
|
|
51418
|
+
for (const candidate of channelFallbacks(channel)) {
|
|
51419
|
+
const picked = pickForChannel(versions, candidate);
|
|
51420
|
+
if (picked)
|
|
51421
|
+
return picked;
|
|
51422
|
+
}
|
|
51423
|
+
return null;
|
|
51424
|
+
}
|
|
51272
51425
|
async function isDevMode() {
|
|
51273
51426
|
const [error, result] = await catchError((async () => {
|
|
51274
51427
|
const fs7 = getFileSystem();
|
|
@@ -51308,7 +51461,7 @@ function isPermissionError(err) {
|
|
|
51308
51461
|
const msg = err.message.toLowerCase();
|
|
51309
51462
|
return PERMISSION_ERROR_MARKERS.some((m) => msg.includes(m.toLowerCase()));
|
|
51310
51463
|
}
|
|
51311
|
-
async function spawnPackageManager(executable, args, cwd, label) {
|
|
51464
|
+
async function spawnPackageManager(executable, args, cwd, label, extraEnv) {
|
|
51312
51465
|
if (!SHELL_SAFE_ARG.test(executable)) {
|
|
51313
51466
|
throw new Error(`Unsafe executable: '${executable}'`);
|
|
51314
51467
|
}
|
|
@@ -51317,8 +51470,9 @@ async function spawnPackageManager(executable, args, cwd, label) {
|
|
|
51317
51470
|
throw new Error(`Unsafe argument: '${arg}'`);
|
|
51318
51471
|
}
|
|
51319
51472
|
}
|
|
51320
|
-
const { spawn } = await
|
|
51473
|
+
const { spawn } = await loadChildProcess();
|
|
51321
51474
|
const isWindows = process.platform === "win32";
|
|
51475
|
+
const envOpt = extraEnv ? { env: { ...process.env, ...extraEnv } } : {};
|
|
51322
51476
|
return new Promise((resolve2, reject) => {
|
|
51323
51477
|
let proc;
|
|
51324
51478
|
if (isWindows) {
|
|
@@ -51329,12 +51483,14 @@ async function spawnPackageManager(executable, args, cwd, label) {
|
|
|
51329
51483
|
proc = spawn(commandLine, [], {
|
|
51330
51484
|
stdio: ["inherit", "pipe", "pipe"],
|
|
51331
51485
|
shell: true,
|
|
51332
|
-
cwd
|
|
51486
|
+
cwd,
|
|
51487
|
+
...envOpt
|
|
51333
51488
|
});
|
|
51334
51489
|
} else {
|
|
51335
51490
|
proc = spawn(executable, args, {
|
|
51336
51491
|
stdio: ["inherit", "pipe", "pipe"],
|
|
51337
|
-
cwd
|
|
51492
|
+
cwd,
|
|
51493
|
+
...envOpt
|
|
51338
51494
|
});
|
|
51339
51495
|
}
|
|
51340
51496
|
let stderr = "";
|
|
@@ -51361,7 +51517,7 @@ async function spawnPackageManager(executable, args, cwd, label) {
|
|
|
51361
51517
|
});
|
|
51362
51518
|
});
|
|
51363
51519
|
}
|
|
51364
|
-
async function runPackageManager(args, cwd) {
|
|
51520
|
+
async function runPackageManager(args, cwd, extraEnv) {
|
|
51365
51521
|
for (const arg of args) {
|
|
51366
51522
|
if (arg !== "-g" && !arg.startsWith("--")) {
|
|
51367
51523
|
validatePackageSpec(arg);
|
|
@@ -51371,67 +51527,169 @@ async function runPackageManager(args, cwd) {
|
|
|
51371
51527
|
const pm = useBun ? "bun" : "npm";
|
|
51372
51528
|
logger.debug(`Running package manager: ${pm} ${args.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
|
|
51373
51529
|
const pmArgs = useBun ? args.filter((a) => a !== "-g").map((a) => a === "uninstall" ? "remove" : a) : args;
|
|
51374
|
-
await spawnPackageManager(pm, pmArgs, cwd, `${pm} ${pmArgs[0]}
|
|
51375
|
-
}
|
|
51376
|
-
async function
|
|
51377
|
-
|
|
51378
|
-
|
|
51379
|
-
|
|
51380
|
-
|
|
51381
|
-
logger.debug(`Registry URL: ${registryUrl}${config.scopedRegistry ? " (from .npmrc)" : " (default)"}`);
|
|
51382
|
-
const [urlError] = catchError(() => new URL(registryUrl));
|
|
51383
|
-
if (urlError) {
|
|
51384
|
-
throw new Error(`Invalid @uipath:registry URL in .npmrc: "${registryUrl}"`);
|
|
51530
|
+
await spawnPackageManager(pm, pmArgs, cwd, `${pm} ${pmArgs[0]}`, extraEnv);
|
|
51531
|
+
}
|
|
51532
|
+
async function runPackageManagerWithBun(args, cwd, extraEnv) {
|
|
51533
|
+
for (const arg of args) {
|
|
51534
|
+
if (arg !== "-g" && !arg.startsWith("--")) {
|
|
51535
|
+
validatePackageSpec(arg);
|
|
51536
|
+
}
|
|
51385
51537
|
}
|
|
51386
|
-
const
|
|
51387
|
-
|
|
51388
|
-
|
|
51389
|
-
|
|
51390
|
-
|
|
51538
|
+
const pmArgs = args.filter((a) => a !== "-g").map((a) => a === "uninstall" ? "remove" : a);
|
|
51539
|
+
logger.debug(`Running package manager: bun ${pmArgs.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
|
|
51540
|
+
await spawnPackageManager("bun", pmArgs, cwd, `bun ${pmArgs[0]}`, extraEnv);
|
|
51541
|
+
}
|
|
51542
|
+
function validateTarballUrl(tarballUrl, registryUrl) {
|
|
51543
|
+
const [err, parsed] = catchError(() => {
|
|
51544
|
+
const url = new URL(tarballUrl);
|
|
51545
|
+
const registry2 = new URL(registryUrl);
|
|
51546
|
+
if (url.hostname !== registry2.hostname || url.protocol !== registry2.protocol) {
|
|
51547
|
+
throw new Error(`refusing tarball from '${url.protocol}//${url.hostname}'; expected '${registry2.protocol}//${registry2.hostname}'`);
|
|
51548
|
+
}
|
|
51549
|
+
return url;
|
|
51550
|
+
});
|
|
51551
|
+
if (err || !parsed) {
|
|
51552
|
+
throw new Error(`Invalid tarball URL '${tarballUrl}': ${err ? err.message : "unparseable"}`);
|
|
51553
|
+
}
|
|
51554
|
+
return parsed;
|
|
51555
|
+
}
|
|
51556
|
+
function extractTarEntry(tar, entryName) {
|
|
51557
|
+
const decoder = new TextDecoder;
|
|
51558
|
+
let offset = 0;
|
|
51559
|
+
while (offset + 512 <= tar.length) {
|
|
51560
|
+
const header = tar.subarray(offset, offset + 512);
|
|
51561
|
+
if (header.every((b) => b === 0))
|
|
51562
|
+
break;
|
|
51563
|
+
const name = decoder.decode(header.subarray(0, 100)).split("\x00", 1)[0];
|
|
51564
|
+
const sizeField = decoder.decode(header.subarray(124, 136)).split("\x00", 1)[0].trim();
|
|
51565
|
+
const size = Number.parseInt(sizeField, 8);
|
|
51566
|
+
if (Number.isNaN(size) || size < 0) {
|
|
51567
|
+
throw new Error(`Corrupt tar header at offset ${offset}`);
|
|
51568
|
+
}
|
|
51569
|
+
const typeflag = header[156];
|
|
51570
|
+
if ((typeflag === 0 || typeflag === 48) && name === entryName) {
|
|
51571
|
+
return decoder.decode(tar.subarray(offset + 512, offset + 512 + size));
|
|
51572
|
+
}
|
|
51573
|
+
offset += 512 + Math.ceil(size / 512) * 512;
|
|
51391
51574
|
}
|
|
51392
|
-
return
|
|
51575
|
+
return null;
|
|
51393
51576
|
}
|
|
51394
51577
|
|
|
51395
51578
|
class NodeToolService {
|
|
51396
|
-
async
|
|
51397
|
-
|
|
51398
|
-
const
|
|
51399
|
-
|
|
51400
|
-
const
|
|
51401
|
-
|
|
51402
|
-
|
|
51403
|
-
|
|
51404
|
-
|
|
51405
|
-
|
|
51406
|
-
|
|
51579
|
+
async npmView(packageName, timeoutMs = NPM_VIEW_TIMEOUT_MS, registry2) {
|
|
51580
|
+
validatePackageSpec(packageName);
|
|
51581
|
+
const args = ["view", packageName, "--json"];
|
|
51582
|
+
const { spawn } = await loadChildProcess();
|
|
51583
|
+
const isWindows = process.platform === "win32";
|
|
51584
|
+
const spawnOpts = registry2 ? {
|
|
51585
|
+
env: {
|
|
51586
|
+
...process.env,
|
|
51587
|
+
...scopeRegistryEnv(packageName, registry2)
|
|
51588
|
+
}
|
|
51589
|
+
} : {};
|
|
51590
|
+
const { stdout } = await new Promise((resolve2, reject) => {
|
|
51591
|
+
let proc;
|
|
51592
|
+
if (isWindows) {
|
|
51593
|
+
if (!SHELL_SAFE_ARG.test("npm")) {
|
|
51594
|
+
reject(new Error("Unsafe executable: 'npm'"));
|
|
51595
|
+
return;
|
|
51596
|
+
}
|
|
51597
|
+
for (const arg of args) {
|
|
51598
|
+
if (!SHELL_SAFE_ARG.test(arg)) {
|
|
51599
|
+
reject(new Error(`Unsafe argument: '${arg}'`));
|
|
51600
|
+
return;
|
|
51601
|
+
}
|
|
51602
|
+
}
|
|
51603
|
+
const commandLine = ["npm", ...args].join(" ");
|
|
51604
|
+
if (!SHELL_SAFE_COMMAND_LINE.test(commandLine)) {
|
|
51605
|
+
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
51606
|
+
return;
|
|
51607
|
+
}
|
|
51608
|
+
proc = spawn(commandLine, [], {
|
|
51609
|
+
shell: true,
|
|
51610
|
+
...spawnOpts
|
|
51611
|
+
});
|
|
51612
|
+
} else {
|
|
51613
|
+
proc = spawn("npm", args, spawnOpts);
|
|
51614
|
+
}
|
|
51615
|
+
let out = "";
|
|
51616
|
+
let err = "";
|
|
51617
|
+
const MAX_STDERR = 65536;
|
|
51618
|
+
proc.stdout?.on("data", (d) => {
|
|
51619
|
+
out += d.toString();
|
|
51620
|
+
});
|
|
51621
|
+
proc.stderr?.on("data", (d) => {
|
|
51622
|
+
if (err.length < MAX_STDERR) {
|
|
51623
|
+
err += d.toString();
|
|
51624
|
+
}
|
|
51625
|
+
});
|
|
51626
|
+
const timer = setTimeout(() => {
|
|
51627
|
+
proc.kill("SIGTERM");
|
|
51628
|
+
reject(new Error(`npm view ${packageName} timed out after ${timeoutMs / 1000}s`));
|
|
51629
|
+
}, timeoutMs);
|
|
51630
|
+
proc.on("error", (spawnErr) => {
|
|
51631
|
+
clearTimeout(timer);
|
|
51632
|
+
reject(this.mapNpmViewError(packageName, err, spawnErr));
|
|
51633
|
+
});
|
|
51634
|
+
proc.on("close", (code) => {
|
|
51635
|
+
clearTimeout(timer);
|
|
51636
|
+
if (code === 0) {
|
|
51637
|
+
resolve2({ stdout: out });
|
|
51638
|
+
} else {
|
|
51639
|
+
reject(this.mapNpmViewError(packageName, err, code));
|
|
51640
|
+
}
|
|
51641
|
+
});
|
|
51407
51642
|
});
|
|
51408
|
-
|
|
51409
|
-
|
|
51410
|
-
|
|
51411
|
-
|
|
51412
|
-
|
|
51643
|
+
const [parseError, parsed] = catchError(() => JSON.parse(stdout));
|
|
51644
|
+
if (parseError) {
|
|
51645
|
+
throw new Error(`Unexpected npm view output for ${packageName}`);
|
|
51646
|
+
}
|
|
51647
|
+
const data = parsed;
|
|
51648
|
+
const latestVersion = data["dist-tags"]?.latest ?? data.version;
|
|
51649
|
+
const rawVersions = Array.isArray(data.versions) ? data.versions : data.versions ? [data.versions] : [];
|
|
51650
|
+
const availableVersions = rawVersions.filter(isValidSemver).sort((a, b) => compareSemver(b, a));
|
|
51651
|
+
let registryLabel;
|
|
51652
|
+
if (data.dist?.tarball) {
|
|
51653
|
+
const tarball = data.dist.tarball;
|
|
51654
|
+
const [urlError, parsedUrl] = catchError(() => new URL(tarball));
|
|
51655
|
+
registryLabel = urlError ? undefined : parsedUrl.host;
|
|
51413
51656
|
}
|
|
51414
|
-
const data = await response.json();
|
|
51415
|
-
const latestVersion = data["dist-tags"]?.latest;
|
|
51416
|
-
const [labelError, parsedUrl] = catchError(() => new URL(registryUrl));
|
|
51417
|
-
const registryLabel = labelError ? registryUrl : parsedUrl.host;
|
|
51418
|
-
const availableVersions = Object.keys(data.versions || {}).filter(isValidSemver).sort((a, b) => compareSemver(b, a));
|
|
51419
51657
|
logger.debug(`Package '${packageName}': latest=${latestVersion ?? "unknown"}, ${availableVersions.length} versions available`);
|
|
51420
51658
|
return {
|
|
51421
|
-
name: data.name,
|
|
51659
|
+
name: data.name ?? packageName,
|
|
51422
51660
|
version: latestVersion || "latest",
|
|
51423
51661
|
description: data.description || "",
|
|
51424
51662
|
availableVersions,
|
|
51425
51663
|
registry: registryLabel
|
|
51426
51664
|
};
|
|
51427
51665
|
}
|
|
51666
|
+
mapNpmViewError(packageName, stderr, codeOrError) {
|
|
51667
|
+
if (/E404/.test(stderr) || /404/.test(stderr)) {
|
|
51668
|
+
return new Error(`Package ${packageName} not found in the registry`);
|
|
51669
|
+
}
|
|
51670
|
+
if (/E401|E403|ENEEDAUTH|need(s)? auth|authentication/i.test(stderr)) {
|
|
51671
|
+
return new Error(`Authentication required for ${packageName} (configure a token in .npmrc)`);
|
|
51672
|
+
}
|
|
51673
|
+
const detail = stderr.trim() || (codeOrError instanceof Error ? codeOrError.message : `exit ${codeOrError}`);
|
|
51674
|
+
return new Error(`npm view ${packageName} failed: ${detail}`);
|
|
51675
|
+
}
|
|
51676
|
+
async fetchPublicPackument(packageName, timeoutMs = DEFAULT_FETCH_TIMEOUT_MS) {
|
|
51677
|
+
validatePackageSpec(packageName);
|
|
51678
|
+
const encodedName = packageName.replaceAll("/", "%2f");
|
|
51679
|
+
const url = `${NPMJS_REGISTRY}/${encodedName}`;
|
|
51680
|
+
logger.debug(`Fetching package info: ${url}`);
|
|
51681
|
+
const response = await fetch(url, {
|
|
51682
|
+
headers: { Accept: "application/json" },
|
|
51683
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
51684
|
+
});
|
|
51685
|
+
if (!response.ok) {
|
|
51686
|
+
throw new Error(`Registry ${NPMJS_REGISTRY} returned ${response.status} ${response.statusText} for ${packageName}`);
|
|
51687
|
+
}
|
|
51688
|
+
return await response.json();
|
|
51689
|
+
}
|
|
51428
51690
|
async search(query) {
|
|
51429
|
-
const { registryUrl, authToken } = await resolveRegistry();
|
|
51430
|
-
const headers = {};
|
|
51431
|
-
if (authToken)
|
|
51432
|
-
headers.Authorization = `Bearer ${authToken}`;
|
|
51433
51691
|
const packages = [...TOOLS_WHITELIST.keys()];
|
|
51434
|
-
const settled = await Promise.allSettled(packages.map((name) => this.
|
|
51692
|
+
const settled = await Promise.allSettled(packages.map((name) => this.npmView(name)));
|
|
51435
51693
|
const results = [];
|
|
51436
51694
|
const errors4 = [];
|
|
51437
51695
|
for (const r of settled) {
|
|
@@ -51442,7 +51700,7 @@ class NodeToolService {
|
|
|
51442
51700
|
}
|
|
51443
51701
|
}
|
|
51444
51702
|
if (results.length === 0) {
|
|
51445
|
-
throw new Error(`All ${packages.length} package lookups
|
|
51703
|
+
throw new Error(`All ${packages.length} package lookups failed:
|
|
51446
51704
|
${errors4.map((e) => ` - ${e}`).join(`
|
|
51447
51705
|
`)}`);
|
|
51448
51706
|
}
|
|
@@ -51455,53 +51713,90 @@ ${errors4.map((e) => ` - ${e}`).join(`
|
|
|
51455
51713
|
async searchLatestVersion(packageName, versionPrefix, options) {
|
|
51456
51714
|
const channel = options?.channel ?? "stable";
|
|
51457
51715
|
logger.debug(`Searching latest version of '${packageName}'${versionPrefix ? ` with prefix '${versionPrefix}'` : ""} (channel: ${channel})`);
|
|
51458
|
-
const
|
|
51459
|
-
const headers = {};
|
|
51460
|
-
if (authToken)
|
|
51461
|
-
headers.Authorization = `Bearer ${authToken}`;
|
|
51462
|
-
const info = await this.fetchPackageInfo(registryUrl, packageName, headers, options?.timeoutMs);
|
|
51716
|
+
const info = await this.npmView(packageName, options?.timeoutMs);
|
|
51463
51717
|
if (options?.exact !== undefined && info.availableVersions?.includes(options.exact)) {
|
|
51464
51718
|
logger.debug(`Resolved version: ${options.exact} (exact pin match)`);
|
|
51465
51719
|
return options.exact;
|
|
51466
51720
|
}
|
|
51467
51721
|
if (versionPrefix && info.availableVersions) {
|
|
51468
51722
|
const matching = info.availableVersions.filter((v) => v.startsWith(versionPrefix));
|
|
51469
|
-
const picked =
|
|
51723
|
+
const picked = pickForChannelWithFallback(matching, channel);
|
|
51470
51724
|
if (picked) {
|
|
51471
51725
|
logger.debug(`Resolved version: ${picked} (${channel}, prefix match)`);
|
|
51472
51726
|
return picked;
|
|
51473
51727
|
}
|
|
51474
|
-
if (options?.allowLowerFallback) {
|
|
51475
|
-
const ceiling = parsePrefixCeiling(versionPrefix);
|
|
51476
|
-
if (ceiling) {
|
|
51477
|
-
const lower2 = info.availableVersions.filter((v) => compareSemver(v, ceiling) < 0);
|
|
51478
|
-
const pickedLower = pickForChannel(lower2, channel);
|
|
51479
|
-
if (pickedLower) {
|
|
51480
|
-
logger.debug(`Resolved version: ${pickedLower} (${channel}, lower fallback below ${ceiling})`);
|
|
51481
|
-
return pickedLower;
|
|
51482
|
-
}
|
|
51483
|
-
}
|
|
51484
|
-
}
|
|
51485
51728
|
logger.debug(`No ${channel} version found matching prefix '${versionPrefix}'`);
|
|
51486
51729
|
return null;
|
|
51487
51730
|
}
|
|
51488
51731
|
if (channel !== "stable" && info.availableVersions) {
|
|
51489
|
-
const picked =
|
|
51732
|
+
const picked = pickForChannelWithFallback(info.availableVersions, channel);
|
|
51490
51733
|
logger.debug(`Resolved version: ${picked ?? "null"} (${channel}, no prefix)`);
|
|
51491
51734
|
return picked;
|
|
51492
51735
|
}
|
|
51493
51736
|
logger.debug(`Resolved version: ${info.version ?? "null"} (latest)`);
|
|
51494
51737
|
return info.version ?? null;
|
|
51495
51738
|
}
|
|
51739
|
+
async resolveInstallCandidate(packageName, versionPrefix) {
|
|
51740
|
+
for (const registry2 of REGISTRY_PREFERENCE) {
|
|
51741
|
+
const [err, info] = await catchError(this.npmView(packageName, undefined, registry2));
|
|
51742
|
+
if (err) {
|
|
51743
|
+
logger.debug(`Skipping ${registry2} for '${packageName}': ${extractErrorMessageSync(err)}`);
|
|
51744
|
+
continue;
|
|
51745
|
+
}
|
|
51746
|
+
const onLine = (info.availableVersions ?? []).filter((v) => v.startsWith(versionPrefix));
|
|
51747
|
+
for (const channel of CHANNEL_PREFERENCE) {
|
|
51748
|
+
const version = pickForChannel(onLine, channel);
|
|
51749
|
+
if (version) {
|
|
51750
|
+
logger.debug(`Resolved '${packageName}@${version}' from ${registry2} (${channel})`);
|
|
51751
|
+
return { version, registry: registry2 };
|
|
51752
|
+
}
|
|
51753
|
+
}
|
|
51754
|
+
}
|
|
51755
|
+
return null;
|
|
51756
|
+
}
|
|
51757
|
+
async downloadPackageFile(packageName, fileName, options) {
|
|
51758
|
+
validatePackageSpec(packageName);
|
|
51759
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
|
|
51760
|
+
const packument = await this.fetchPublicPackument(packageName, timeoutMs);
|
|
51761
|
+
const latest = packument["dist-tags"]?.latest;
|
|
51762
|
+
const tarballUrl = latest ? packument.versions?.[latest]?.dist?.tarball : undefined;
|
|
51763
|
+
if (!tarballUrl) {
|
|
51764
|
+
throw new Error(`No tarball URL for ${packageName}@${latest ?? "latest"} on ${NPMJS_REGISTRY}`);
|
|
51765
|
+
}
|
|
51766
|
+
const tarball = validateTarballUrl(tarballUrl, NPMJS_REGISTRY);
|
|
51767
|
+
logger.debug(`Downloading tarball: ${tarball.href}`);
|
|
51768
|
+
const response = await fetch(tarball, {
|
|
51769
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
51770
|
+
});
|
|
51771
|
+
if (!response.ok) {
|
|
51772
|
+
throw new Error(`Tarball download for ${packageName} returned ${response.status} ${response.statusText}`);
|
|
51773
|
+
}
|
|
51774
|
+
const { gunzipSync } = await import("node:zlib");
|
|
51775
|
+
const tar = gunzipSync(new Uint8Array(await response.arrayBuffer()));
|
|
51776
|
+
const content = extractTarEntry(tar, `package/${fileName}`);
|
|
51777
|
+
if (content === null) {
|
|
51778
|
+
throw new Error(`File '${fileName}' not found in ${packageName}@${latest} tarball`);
|
|
51779
|
+
}
|
|
51780
|
+
return content;
|
|
51781
|
+
}
|
|
51496
51782
|
async install(packageName, destination, options) {
|
|
51497
51783
|
validatePackageSpec(packageName);
|
|
51498
51784
|
const baseArgs = options?.global ? ["install", "-g", packageName] : ["install", packageName];
|
|
51785
|
+
const extraEnv = options?.registry ? scopeRegistryEnv(packageName, options.registry) : undefined;
|
|
51499
51786
|
for (let attempt = 0;attempt <= NPM_MAX_RETRIES; attempt++) {
|
|
51500
|
-
const [err] = await catchError(runPackageManager(baseArgs, destination));
|
|
51787
|
+
const [err] = await catchError(runPackageManager(baseArgs, destination, extraEnv));
|
|
51501
51788
|
if (!err) {
|
|
51502
51789
|
return;
|
|
51503
51790
|
}
|
|
51504
51791
|
const msg = extractErrorMessageSync(err);
|
|
51792
|
+
if (msg.includes(UNSUPPORTED_PROTOCOL_MARKER)) {
|
|
51793
|
+
if (await isBunOnPath()) {
|
|
51794
|
+
logger.warn(`npm install failed with ${UNSUPPORTED_PROTOCOL_MARKER} — ` + `the published package contains 'workspace:' deps that npm cannot resolve. Retrying with bun.`);
|
|
51795
|
+
await runPackageManagerWithBun(baseArgs, destination, extraEnv);
|
|
51796
|
+
return;
|
|
51797
|
+
}
|
|
51798
|
+
throw new Error(`Installation of '${packageName}' failed with ${UNSUPPORTED_PROTOCOL_MARKER}: the published package contains 'workspace:' deps that npm cannot resolve. Install bun (https://bun.sh) and rerun to enable automatic fallback, or use a pre-bundled CLI distribution. Original error: ${msg}`);
|
|
51799
|
+
}
|
|
51505
51800
|
const isTransient = TRANSIENT_NPM_ERRORS.some((code) => msg.includes(code));
|
|
51506
51801
|
if (!isTransient || attempt === NPM_MAX_RETRIES) {
|
|
51507
51802
|
throw err;
|
|
@@ -51573,7 +51868,7 @@ function truncateVersionsForDisplay(versions) {
|
|
|
51573
51868
|
}
|
|
51574
51869
|
return result;
|
|
51575
51870
|
}
|
|
51576
|
-
var SEMVER_RE, SAFE_PACKAGE_SPEC, SAFE_VERSION, SHELL_SAFE_ARG, SHELL_SAFE_COMMAND_LINE, NPM_TIMEOUT_MS = 180000, NPM_MAX_RETRIES = 2, TRANSIENT_NPM_ERRORS,
|
|
51871
|
+
var SEMVER_RE, SAFE_PACKAGE_SPEC, SAFE_VERSION, SHELL_SAFE_ARG, SHELL_SAFE_COMMAND_LINE, NPM_TIMEOUT_MS = 180000, NPM_VIEW_TIMEOUT_MS = 30000, NPM_MAX_RETRIES = 2, TRANSIENT_NPM_ERRORS, UNSUPPORTED_PROTOCOL_MARKER = "EUNSUPPORTEDPROTOCOL", cachedBunOnPath, childProcessModulePromise, NPMJS_REGISTRY = "https://registry.npmjs.org", GITHUB_REGISTRY = "https://npm.pkg.github.com", REGISTRY_PREFERENCE, CHANNEL_PREFERENCE, PERMISSION_ERROR_MARKERS, toolService;
|
|
51577
51872
|
var init_toolService = __esm(() => {
|
|
51578
51873
|
init_src2();
|
|
51579
51874
|
init_src();
|
|
@@ -51586,6 +51881,11 @@ var init_toolService = __esm(() => {
|
|
|
51586
51881
|
SHELL_SAFE_ARG = /^[a-zA-Z0-9@/._-]+$/;
|
|
51587
51882
|
SHELL_SAFE_COMMAND_LINE = /^[a-zA-Z0-9@/._\- ]+$/;
|
|
51588
51883
|
TRANSIENT_NPM_ERRORS = ["ENOTEMPTY", "EPERM", "EBUSY"];
|
|
51884
|
+
REGISTRY_PREFERENCE = [
|
|
51885
|
+
NPMJS_REGISTRY,
|
|
51886
|
+
GITHUB_REGISTRY
|
|
51887
|
+
];
|
|
51888
|
+
CHANNEL_PREFERENCE = ["stable", "alpha"];
|
|
51589
51889
|
PERMISSION_ERROR_MARKERS = ["EACCES", "permission denied"];
|
|
51590
51890
|
toolService = new NodeToolService;
|
|
51591
51891
|
});
|
|
@@ -52634,7 +52934,7 @@ function registerCompletionCommand(program2, discovered, context) {
|
|
|
52634
52934
|
handlePrint(target);
|
|
52635
52935
|
return;
|
|
52636
52936
|
}
|
|
52637
|
-
if (shellArg || !
|
|
52937
|
+
if (shellArg || !canPrompt()) {
|
|
52638
52938
|
context.output.writeOut(target.scriptContent ?? target.content);
|
|
52639
52939
|
return;
|
|
52640
52940
|
}
|
|
@@ -67249,7 +67549,26 @@ var init_zod = __esm(() => {
|
|
|
67249
67549
|
init_external();
|
|
67250
67550
|
});
|
|
67251
67551
|
|
|
67552
|
+
// src/services/channels.ts
|
|
67553
|
+
var CHANNELS, VALID_CHANNELS;
|
|
67554
|
+
var init_channels = __esm(() => {
|
|
67555
|
+
CHANNELS = ["stable", "alpha", "beta", "preview"];
|
|
67556
|
+
VALID_CHANNELS = new Set(CHANNELS);
|
|
67557
|
+
});
|
|
67558
|
+
|
|
67252
67559
|
// src/config/loadConfig.ts
|
|
67560
|
+
var exports_loadConfig = {};
|
|
67561
|
+
__export(exports_loadConfig, {
|
|
67562
|
+
setCoreConfigValuesAsync: () => setCoreConfigValuesAsync,
|
|
67563
|
+
resolveConfigFilePathAsync: () => resolveConfigFilePathAsync,
|
|
67564
|
+
loadConfigAsync: () => loadConfigAsync,
|
|
67565
|
+
invalidateConfigCache: () => invalidateConfigCache,
|
|
67566
|
+
getCachedConfig: () => getCachedConfig,
|
|
67567
|
+
VERSION_PIN_RE: () => VERSION_PIN_RE,
|
|
67568
|
+
SECRET_FIELD_PATHS: () => SECRET_FIELD_PATHS,
|
|
67569
|
+
ConfigValidationError: () => ConfigValidationError
|
|
67570
|
+
});
|
|
67571
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
67253
67572
|
var VERSION_PIN_RE, ConfigSchema, SECRET_FIELD_PATHS, formatZodError = (error51) => {
|
|
67254
67573
|
const issues = error51.issues.map((issue2) => {
|
|
67255
67574
|
const path6 = issue2.path.join(".") || "config";
|
|
@@ -67276,7 +67595,37 @@ Please check your config file and fix the errors above.`;
|
|
|
67276
67595
|
throw new ConfigValidationError(formatZodError(result.error));
|
|
67277
67596
|
}
|
|
67278
67597
|
return result.data;
|
|
67279
|
-
}, cachedConfig = null, getCachedConfig = () => cachedConfig ?? {},
|
|
67598
|
+
}, cachedConfig = null, getCachedConfig = () => cachedConfig ?? {}, invalidateConfigCache = () => {
|
|
67599
|
+
cachedConfig = null;
|
|
67600
|
+
}, setCoreConfigValuesAsync = async (values) => {
|
|
67601
|
+
const fs7 = await getFs();
|
|
67602
|
+
const { absolutePath } = await resolveConfigFilePathAsync();
|
|
67603
|
+
const targetPath = absolutePath ?? fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, CONFIG_FILENAME);
|
|
67604
|
+
let raw = {};
|
|
67605
|
+
const [, content] = await catchError(fs7.readFile(targetPath, "utf-8"));
|
|
67606
|
+
if (content) {
|
|
67607
|
+
const [, parsed] = catchError(() => JSON.parse(content));
|
|
67608
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
67609
|
+
raw = parsed;
|
|
67610
|
+
}
|
|
67611
|
+
}
|
|
67612
|
+
const existingCore = raw.core;
|
|
67613
|
+
const core2 = existingCore !== null && typeof existingCore === "object" && !Array.isArray(existingCore) ? existingCore : {};
|
|
67614
|
+
for (const [key, value] of Object.entries(values)) {
|
|
67615
|
+
core2[key] = value;
|
|
67616
|
+
}
|
|
67617
|
+
raw.core = core2;
|
|
67618
|
+
await fs7.mkdir(fs7.path.dirname(targetPath));
|
|
67619
|
+
const tempPath = `${targetPath}.${randomUUID3()}.tmp`;
|
|
67620
|
+
await fs7.writeFile(tempPath, JSON.stringify(raw, null, 4));
|
|
67621
|
+
const [renameErr] = await catchError(fs7.rename(tempPath, targetPath));
|
|
67622
|
+
if (renameErr) {
|
|
67623
|
+
await catchError(fs7.rm(tempPath));
|
|
67624
|
+
throw renameErr;
|
|
67625
|
+
}
|
|
67626
|
+
invalidateConfigCache();
|
|
67627
|
+
await loadConfigAsync();
|
|
67628
|
+
}, getFs = async () => {
|
|
67280
67629
|
const { getFileSystemAsync: getFileSystemAsync2 } = await Promise.resolve().then(() => (init_src(), exports_src));
|
|
67281
67630
|
return getFileSystemAsync2();
|
|
67282
67631
|
}, LOCAL_CONFIG_REL, resolveConfigFilePathAsync = async (explicitPath) => {
|
|
@@ -67345,13 +67694,17 @@ Please ensure your config file contains valid JSON.`);
|
|
|
67345
67694
|
var init_loadConfig = __esm(() => {
|
|
67346
67695
|
init_src2();
|
|
67347
67696
|
init_zod();
|
|
67697
|
+
init_channels();
|
|
67348
67698
|
VERSION_PIN_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
|
|
67349
67699
|
ConfigSchema = exports_external.object({
|
|
67350
67700
|
core: exports_external.object({
|
|
67351
67701
|
output: exports_external.enum(["table", "json", "yaml", "plain", "text"]).transform((v) => v === "text" ? "plain" : v).optional(),
|
|
67352
67702
|
logLevel: exports_external.enum(["error", "warn", "info", "debug"]).optional(),
|
|
67353
|
-
|
|
67354
|
-
|
|
67703
|
+
interactive: exports_external.enum(["never", "auto", "always"]).optional(),
|
|
67704
|
+
updateChannel: exports_external.enum(CHANNELS).optional(),
|
|
67705
|
+
version: exports_external.string().regex(VERSION_PIN_RE, "must be major.minor or major.minor.patch (e.g. 1.2 or 1.2.3)").optional(),
|
|
67706
|
+
autoVersionSync: exports_external.enum(["true", "false"]).optional(),
|
|
67707
|
+
versionSource: exports_external.enum(["environment", "manual"]).optional()
|
|
67355
67708
|
}).optional(),
|
|
67356
67709
|
auth: exports_external.object({
|
|
67357
67710
|
clientId: exports_external.string().min(1).optional(),
|
|
@@ -67394,6 +67747,13 @@ function parseVersionPin(raw) {
|
|
|
67394
67747
|
pin.patch = Number(match[3]);
|
|
67395
67748
|
return pin;
|
|
67396
67749
|
}
|
|
67750
|
+
function majorMinorPinOf(version2) {
|
|
67751
|
+
const [rawMajor, rawMinor] = version2.trim().split(/[.\-+]/);
|
|
67752
|
+
if (rawMajor === undefined || rawMinor === undefined || !/^\d+$/.test(rawMajor) || !/^\d+$/.test(rawMinor)) {
|
|
67753
|
+
return null;
|
|
67754
|
+
}
|
|
67755
|
+
return { major: Number(rawMajor), minor: Number(rawMinor) };
|
|
67756
|
+
}
|
|
67397
67757
|
function resolvePinnedVersion() {
|
|
67398
67758
|
return parseVersionPin(getCachedConfig().core?.version);
|
|
67399
67759
|
}
|
|
@@ -67411,7 +67771,7 @@ var init_versionPin = __esm(() => {
|
|
|
67411
67771
|
});
|
|
67412
67772
|
|
|
67413
67773
|
// src/commands/config.ts
|
|
67414
|
-
import { randomUUID as
|
|
67774
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
67415
67775
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
67416
67776
|
async function resolveForRead(explicit) {
|
|
67417
67777
|
const r = await resolveConfigFilePathAsync(explicit);
|
|
@@ -67483,7 +67843,7 @@ async function writeConfigFileAt(path6, config2) {
|
|
|
67483
67843
|
const fs7 = getFileSystem();
|
|
67484
67844
|
const dir = fs7.path.dirname(path6);
|
|
67485
67845
|
await fs7.mkdir(dir);
|
|
67486
|
-
const tempPath = `${path6}.${
|
|
67846
|
+
const tempPath = `${path6}.${randomUUID4()}.tmp`;
|
|
67487
67847
|
await fs7.writeFile(tempPath, JSON.stringify(config2, null, 4));
|
|
67488
67848
|
const [renameErr] = await catchError(fs7.rename(tempPath, path6));
|
|
67489
67849
|
if (renameErr) {
|
|
@@ -67629,6 +67989,9 @@ function registerConfigCommand(program2, context) {
|
|
|
67629
67989
|
const [opErr] = await catchError(withConfigLock(target.path, async () => {
|
|
67630
67990
|
const rawConfig = await readConfigFileAt(target.path);
|
|
67631
67991
|
setNestedValue(rawConfig, def.path, value);
|
|
67992
|
+
if (key === "version") {
|
|
67993
|
+
setNestedValue(rawConfig, ["core", "versionSource"], "manual");
|
|
67994
|
+
}
|
|
67632
67995
|
await writeConfigFileAt(target.path, rawConfig);
|
|
67633
67996
|
}));
|
|
67634
67997
|
if (opErr) {
|
|
@@ -67651,11 +68014,12 @@ function registerConfigCommand(program2, context) {
|
|
|
67651
68014
|
});
|
|
67652
68015
|
});
|
|
67653
68016
|
}
|
|
67654
|
-
var CONFIG_KEYS, VALID_KEY_NAMES, CONFIG_GET_EXAMPLES, CONFIG_SET_EXAMPLES, LOCK_STALE_MS2 = 1000, LOCK_RETRY_MS = 50, LOCK_TIMEOUT_MS = 1e4, LOCK_VERIFY_DELAY_MS = 25, lockToken = () => `${process.pid ?? 0}.${
|
|
68017
|
+
var CONFIG_KEYS, VALID_KEY_NAMES, CONFIG_GET_EXAMPLES, CONFIG_SET_EXAMPLES, LOCK_STALE_MS2 = 1000, LOCK_RETRY_MS = 50, LOCK_TIMEOUT_MS = 1e4, LOCK_VERIFY_DELAY_MS = 25, lockToken = () => `${process.pid ?? 0}.${randomUUID4()}`, SECRET_WORD_TOKENS, REDACTED_VALUE = "<redacted>", SECRET_PATH_SET;
|
|
67655
68018
|
var init_config = __esm(() => {
|
|
67656
68019
|
init_src2();
|
|
67657
68020
|
init_src();
|
|
67658
68021
|
init_loadConfig();
|
|
68022
|
+
init_channels();
|
|
67659
68023
|
init_versionPin();
|
|
67660
68024
|
CONFIG_KEYS = {
|
|
67661
68025
|
output: {
|
|
@@ -67668,9 +68032,14 @@ var init_config = __esm(() => {
|
|
|
67668
68032
|
validValues: ["error", "warn", "info", "debug"],
|
|
67669
68033
|
description: "Default log level"
|
|
67670
68034
|
},
|
|
68035
|
+
interactive: {
|
|
68036
|
+
path: ["core", "interactive"],
|
|
68037
|
+
validValues: ["never", "auto", "always"],
|
|
68038
|
+
description: "When the CLI may show interactive prompts (default: never)"
|
|
68039
|
+
},
|
|
67671
68040
|
updateChannel: {
|
|
67672
68041
|
path: ["core", "updateChannel"],
|
|
67673
|
-
validValues: [
|
|
68042
|
+
validValues: [...CHANNELS],
|
|
67674
68043
|
description: "Release channel used to resolve tool updates"
|
|
67675
68044
|
},
|
|
67676
68045
|
version: {
|
|
@@ -67679,6 +68048,11 @@ var init_config = __esm(() => {
|
|
|
67679
68048
|
validate: (v) => isValidVersionPin(v),
|
|
67680
68049
|
valueHint: "Use major.minor or major.minor.patch (e.g. 1.2 or 1.2.3).",
|
|
67681
68050
|
description: "Pinned platform version enforced by 'uip update' (CLI + tools)"
|
|
68051
|
+
},
|
|
68052
|
+
autoVersionSync: {
|
|
68053
|
+
path: ["core", "autoVersionSync"],
|
|
68054
|
+
validValues: ["true", "false"],
|
|
68055
|
+
description: "Daily environment-pinned CLI/tools version sync (set 'false' to disable)"
|
|
67682
68056
|
}
|
|
67683
68057
|
};
|
|
67684
68058
|
VALID_KEY_NAMES = Object.keys(CONFIG_KEYS);
|
|
@@ -86890,11 +87264,11 @@ var DEFAULT_TIMEOUT_MS = 1000, CLOSE_TIMEOUT_MS = 500, NOTICE_SENTINEL, printNot
|
|
|
86890
87264
|
if (error51 || !parsed)
|
|
86891
87265
|
return;
|
|
86892
87266
|
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
86893
|
-
|
|
86894
|
-
|
|
86895
|
-
|
|
86896
|
-
|
|
86897
|
-
|
|
87267
|
+
return {
|
|
87268
|
+
baseUrl: parsed.origin,
|
|
87269
|
+
organizationName: segments[0],
|
|
87270
|
+
tenantName: segments[1]
|
|
87271
|
+
};
|
|
86898
87272
|
}, defaultLoadModule = async () => {
|
|
86899
87273
|
const [error51, mod2] = await catchError2(() => Promise.resolve().then(() => __toESM(require_dist4(), 1)));
|
|
86900
87274
|
if (error51 || !mod2) {
|
|
@@ -86943,6 +87317,7 @@ var DEFAULT_TIMEOUT_MS = 1000, CLOSE_TIMEOUT_MS = 500, NOTICE_SENTINEL, printNot
|
|
|
86943
87317
|
}
|
|
86944
87318
|
let organizationIdFromToken;
|
|
86945
87319
|
let tenantIdFromToken;
|
|
87320
|
+
let issuerFromToken;
|
|
86946
87321
|
const [jwtError, claims] = catchError2(() => parseJWT(accessToken));
|
|
86947
87322
|
if (!jwtError && claims) {
|
|
86948
87323
|
const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
|
|
@@ -86953,6 +87328,10 @@ var DEFAULT_TIMEOUT_MS = 1000, CLOSE_TIMEOUT_MS = 500, NOTICE_SENTINEL, printNot
|
|
|
86953
87328
|
if (typeof tenantClaim === "string" && tenantClaim.length > 0) {
|
|
86954
87329
|
tenantIdFromToken = tenantClaim;
|
|
86955
87330
|
}
|
|
87331
|
+
const issClaim = claims.iss;
|
|
87332
|
+
if (typeof issClaim === "string" && issClaim.length > 0) {
|
|
87333
|
+
issuerFromToken = issClaim;
|
|
87334
|
+
}
|
|
86956
87335
|
}
|
|
86957
87336
|
printNoticeOnce();
|
|
86958
87337
|
return {
|
|
@@ -86961,7 +87340,8 @@ var DEFAULT_TIMEOUT_MS = 1000, CLOSE_TIMEOUT_MS = 500, NOTICE_SENTINEL, printNot
|
|
|
86961
87340
|
organizationName: parsedUrl.organizationName,
|
|
86962
87341
|
organizationId: organizationIdFromToken ?? parsedUrl.organizationName,
|
|
86963
87342
|
tenantName: parsedUrl.tenantName,
|
|
86964
|
-
tenantId: tenantIdFromToken
|
|
87343
|
+
tenantId: tenantIdFromToken,
|
|
87344
|
+
issuer: issuerFromToken
|
|
86965
87345
|
};
|
|
86966
87346
|
} catch {
|
|
86967
87347
|
return;
|
|
@@ -87057,7 +87437,7 @@ var DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, KNOWN_ERROR_CODES, errorCode =
|
|
|
87057
87437
|
}
|
|
87058
87438
|
};
|
|
87059
87439
|
}
|
|
87060
|
-
}, resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
|
|
87440
|
+
}, resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
87061
87441
|
const fs7 = getFileSystem();
|
|
87062
87442
|
if (fs7.path.isAbsolute(envFilePath)) {
|
|
87063
87443
|
const probe2 = await probeAsync(fs7, envFilePath);
|
|
@@ -87068,7 +87448,7 @@ var DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, KNOWN_ERROR_CODES, errorCode =
|
|
|
87068
87448
|
...probe2.unusable ? { unusable: probe2.unusable } : {}
|
|
87069
87449
|
};
|
|
87070
87450
|
}
|
|
87071
|
-
const cwd = fs7.env.cwd();
|
|
87451
|
+
const cwd = opts?.cwd ?? fs7.env.cwd();
|
|
87072
87452
|
let searchDir = cwd;
|
|
87073
87453
|
while (true) {
|
|
87074
87454
|
const candidate = fs7.path.join(searchDir, envFilePath);
|
|
@@ -87097,8 +87477,8 @@ var DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, KNOWN_ERROR_CODES, errorCode =
|
|
|
87097
87477
|
source: "default",
|
|
87098
87478
|
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
87099
87479
|
};
|
|
87100
|
-
}, resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
|
|
87101
|
-
const location = await resolveEnvFileLocationAsync(envFilePath);
|
|
87480
|
+
}, resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
87481
|
+
const location = await resolveEnvFileLocationAsync(envFilePath, opts);
|
|
87102
87482
|
if (location.exists) {
|
|
87103
87483
|
return { absolutePath: location.absolutePath };
|
|
87104
87484
|
}
|
|
@@ -87342,6 +87722,7 @@ var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {})
|
|
|
87342
87722
|
organizationId: robotCreds.organizationId,
|
|
87343
87723
|
tenantName: robotCreds.tenantName,
|
|
87344
87724
|
tenantId: robotCreds.tenantId,
|
|
87725
|
+
issuer: robotCreds.issuer,
|
|
87345
87726
|
expiration: expiration2,
|
|
87346
87727
|
source: "robot" /* Robot */
|
|
87347
87728
|
};
|
|
@@ -87363,6 +87744,7 @@ var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {})
|
|
|
87363
87744
|
organizationId: robotCreds.organizationId,
|
|
87364
87745
|
tenantName: robotCreds.tenantName,
|
|
87365
87746
|
tenantId: robotCreds.tenantId,
|
|
87747
|
+
issuer: robotCreds.issuer,
|
|
87366
87748
|
expiration: expiration2,
|
|
87367
87749
|
source: "robot" /* Robot */
|
|
87368
87750
|
};
|
|
@@ -87531,7 +87913,8 @@ var init_loginStatus = __esm(() => {
|
|
|
87531
87913
|
// ../auth/src/authContext.ts
|
|
87532
87914
|
var getAuthContext = async (options = {}) => {
|
|
87533
87915
|
const status = await getLoginStatusAsync({
|
|
87534
|
-
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes
|
|
87916
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
87917
|
+
envFilePath: options.envFilePath
|
|
87535
87918
|
});
|
|
87536
87919
|
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
87537
87920
|
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
@@ -87557,6 +87940,33 @@ var getAuthContext = async (options = {}) => {
|
|
|
87557
87940
|
tenantId: status.tenantId,
|
|
87558
87941
|
tenantName
|
|
87559
87942
|
};
|
|
87943
|
+
}, getAuthEnv = async (options = {}) => {
|
|
87944
|
+
const authEnv = {};
|
|
87945
|
+
let status;
|
|
87946
|
+
try {
|
|
87947
|
+
status = await getLoginStatusAsync(options);
|
|
87948
|
+
} catch {
|
|
87949
|
+
return { authEnv };
|
|
87950
|
+
}
|
|
87951
|
+
if (status.loginStatus === "Logged in" && status.accessToken) {
|
|
87952
|
+
authEnv.UIPATH_ACCESS_TOKEN = status.accessToken;
|
|
87953
|
+
if (status.baseUrl) {
|
|
87954
|
+
const org = status.organizationName || status.organizationId;
|
|
87955
|
+
const tenant = status.tenantName || status.tenantId;
|
|
87956
|
+
if (org && tenant) {
|
|
87957
|
+
authEnv.UIPATH_URL = `${status.baseUrl.replace(/\/+$/, "")}/${org}/${tenant}`;
|
|
87958
|
+
}
|
|
87959
|
+
}
|
|
87960
|
+
if (status.organizationId)
|
|
87961
|
+
authEnv.UIPATH_ORGANIZATION_ID = status.organizationId;
|
|
87962
|
+
if (status.organizationName)
|
|
87963
|
+
authEnv.UIPATH_ORGANIZATION_NAME = status.organizationName;
|
|
87964
|
+
if (status.tenantId)
|
|
87965
|
+
authEnv.UIPATH_TENANT_ID = status.tenantId;
|
|
87966
|
+
if (status.tenantName)
|
|
87967
|
+
authEnv.UIPATH_TENANT_NAME = status.tenantName;
|
|
87968
|
+
}
|
|
87969
|
+
return { authEnv, loginStatus: status };
|
|
87560
87970
|
};
|
|
87561
87971
|
var init_authContext = __esm(() => {
|
|
87562
87972
|
init_loginStatus();
|
|
@@ -87700,7 +88110,8 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
87700
88110
|
tenant,
|
|
87701
88111
|
organization,
|
|
87702
88112
|
interactive,
|
|
87703
|
-
onEvent
|
|
88113
|
+
onEvent,
|
|
88114
|
+
timeoutMs
|
|
87704
88115
|
} = options;
|
|
87705
88116
|
const emit = (event) => {
|
|
87706
88117
|
if (!onEvent)
|
|
@@ -87728,7 +88139,8 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
87728
88139
|
clientId,
|
|
87729
88140
|
clientSecret,
|
|
87730
88141
|
scope,
|
|
87731
|
-
organization
|
|
88142
|
+
organization,
|
|
88143
|
+
timeoutMs
|
|
87732
88144
|
});
|
|
87733
88145
|
return {
|
|
87734
88146
|
UIPATH_ACCESS_TOKEN: authTokens.accessToken,
|
|
@@ -88128,7 +88540,7 @@ __export(exports_browser_strategy, {
|
|
|
88128
88540
|
});
|
|
88129
88541
|
|
|
88130
88542
|
class BrowserAuthStrategy {
|
|
88131
|
-
async execute(url2, _redirectUri, expectedState) {
|
|
88543
|
+
async execute(url2, _redirectUri, expectedState, _opts) {
|
|
88132
88544
|
const global5 = getGlobalThis();
|
|
88133
88545
|
if (!global5?.window) {
|
|
88134
88546
|
throw new Error("Browser environment required for authentication");
|
|
@@ -88203,10 +88615,11 @@ __export(exports_node_strategy, {
|
|
|
88203
88615
|
});
|
|
88204
88616
|
|
|
88205
88617
|
class NodeAuthStrategy {
|
|
88206
|
-
async execute(url2, redirectUri, expectedState) {
|
|
88618
|
+
async execute(url2, redirectUri, expectedState, opts) {
|
|
88207
88619
|
const fs7 = getFileSystem();
|
|
88208
88620
|
const callbackUrl = await startServer({
|
|
88209
88621
|
redirectUri,
|
|
88622
|
+
timeoutMs: opts?.timeoutMs,
|
|
88210
88623
|
onListening: async () => {
|
|
88211
88624
|
let safeUrl = "";
|
|
88212
88625
|
for (const ch of url2) {
|
|
@@ -88270,6 +88683,7 @@ __export(exports_src2, {
|
|
|
88270
88683
|
interactiveLogin: () => interactiveLogin,
|
|
88271
88684
|
getLoginStatusWithDeps: () => getLoginStatusWithDeps,
|
|
88272
88685
|
getLoginStatusAsync: () => getLoginStatusAsync,
|
|
88686
|
+
getAuthEnv: () => getAuthEnv,
|
|
88273
88687
|
getAuthContext: () => getAuthContext,
|
|
88274
88688
|
fetchTenantsAndOrganizations: () => fetchTenantsAndOrganizations,
|
|
88275
88689
|
clientCredentialsLogin: () => clientCredentialsLogin,
|
|
@@ -88291,7 +88705,8 @@ var authenticate = async ({
|
|
|
88291
88705
|
clientSecret,
|
|
88292
88706
|
redirectUri,
|
|
88293
88707
|
scope,
|
|
88294
|
-
organization
|
|
88708
|
+
organization,
|
|
88709
|
+
timeoutMs
|
|
88295
88710
|
}) => {
|
|
88296
88711
|
const config2 = await resolveConfigAsync({
|
|
88297
88712
|
customAuthority: baseUrl,
|
|
@@ -88341,7 +88756,7 @@ var authenticate = async ({
|
|
|
88341
88756
|
const { NodeAuthStrategy: NodeAuthStrategy2 } = await Promise.resolve().then(() => (init_node_strategy(), exports_node_strategy));
|
|
88342
88757
|
strategy = new NodeAuthStrategy2;
|
|
88343
88758
|
}
|
|
88344
|
-
const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state);
|
|
88759
|
+
const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, { timeoutMs });
|
|
88345
88760
|
return await exchangeCodeForTokens({
|
|
88346
88761
|
code,
|
|
88347
88762
|
codeVerifier: code_verifier,
|
|
@@ -88388,6 +88803,11 @@ var init_promptSelect = __esm(() => {
|
|
|
88388
88803
|
});
|
|
88389
88804
|
|
|
88390
88805
|
// src/services/auth.ts
|
|
88806
|
+
var exports_auth = {};
|
|
88807
|
+
__export(exports_auth, {
|
|
88808
|
+
auth: () => auth
|
|
88809
|
+
});
|
|
88810
|
+
|
|
88391
88811
|
class NodeAuth {
|
|
88392
88812
|
async interactiveLogin(options) {
|
|
88393
88813
|
const { interactiveLogin: interactiveLogin2 } = await Promise.resolve().then(() => (init_src3(), exports_src2));
|
|
@@ -88473,24 +88893,44 @@ var AuthTelemetryEvents, getUserIdFromToken = (accessToken) => {
|
|
|
88473
88893
|
} catch {
|
|
88474
88894
|
return;
|
|
88475
88895
|
}
|
|
88476
|
-
},
|
|
88896
|
+
}, readAuthIdentity = async (deps) => {
|
|
88897
|
+
const envAuthEnabled = deps.isEnvAuthEnabled ?? isEnvAuthEnabled;
|
|
88898
|
+
const readEnv = deps.readAuthFromEnv ?? readAuthFromEnv;
|
|
88477
88899
|
const resolveEnvFilePath = deps.resolveEnvFilePath ?? resolveEnvFilePathAsync;
|
|
88478
88900
|
const loadEnvFile = deps.loadEnvFile ?? loadEnvFileAsync;
|
|
88901
|
+
if (envAuthEnabled()) {
|
|
88902
|
+
const [error51, status] = catchError(() => readEnv());
|
|
88903
|
+
if (error51 || !status)
|
|
88904
|
+
return;
|
|
88905
|
+
return {
|
|
88906
|
+
accessToken: status.accessToken,
|
|
88907
|
+
tenantId: status.tenantId,
|
|
88908
|
+
organizationId: status.organizationId
|
|
88909
|
+
};
|
|
88910
|
+
}
|
|
88479
88911
|
const [resolveError, resolved] = await catchError(resolveEnvFilePath(DEFAULT_ENV_FILENAME));
|
|
88480
88912
|
if (resolveError || !resolved?.absolutePath)
|
|
88481
88913
|
return;
|
|
88482
88914
|
const [loadError, credentials] = await catchError(loadEnvFile({ envPath: resolved.absolutePath }));
|
|
88483
88915
|
if (loadError || !credentials)
|
|
88484
88916
|
return;
|
|
88485
|
-
|
|
88486
|
-
|
|
88917
|
+
return {
|
|
88918
|
+
accessToken: credentials.UIPATH_ACCESS_TOKEN,
|
|
88919
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
88920
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID
|
|
88921
|
+
};
|
|
88922
|
+
}, populateTelemetryAuthContext = async (deps = {}) => {
|
|
88923
|
+
const identity = await readAuthIdentity(deps);
|
|
88924
|
+
if (!identity)
|
|
88487
88925
|
return;
|
|
88488
|
-
const userId = getUserIdFromToken(accessToken);
|
|
88926
|
+
const userId = identity.accessToken ? getUserIdFromToken(identity.accessToken) : undefined;
|
|
88489
88927
|
const defaultProps = {
|
|
88490
88928
|
...userId ? { CloudUserId: userId } : {},
|
|
88491
|
-
...
|
|
88492
|
-
...
|
|
88929
|
+
...identity.tenantId ? { CloudTenantId: identity.tenantId } : {},
|
|
88930
|
+
...identity.organizationId ? { CloudOrganizationId: identity.organizationId } : {}
|
|
88493
88931
|
};
|
|
88932
|
+
if (Object.keys(defaultProps).length === 0)
|
|
88933
|
+
return;
|
|
88494
88934
|
setGlobalTelemetryProperties(defaultProps);
|
|
88495
88935
|
telemetry.setDefaultProperties(defaultProps);
|
|
88496
88936
|
logger.debug("[Telemetry] auth context populated at startup");
|
|
@@ -88553,12 +88993,28 @@ function instructionsForLoginError(error51, message) {
|
|
|
88553
88993
|
if (code === AUTH_TIMEOUT_ERROR_CODE) {
|
|
88554
88994
|
return `The browser did not return an authorization code within the timeout. Make sure your default browser opened, complete the sign-in, then retry. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
88555
88995
|
}
|
|
88996
|
+
const connectivity = describeConnectivityError(error51);
|
|
88997
|
+
if (connectivity) {
|
|
88998
|
+
return connectivity.instructions;
|
|
88999
|
+
}
|
|
88556
89000
|
return `Inspect command arguments and message and try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
88557
89001
|
}
|
|
89002
|
+
function loginErrorMessage(error51) {
|
|
89003
|
+
const base = error51 instanceof Error ? error51.message : String(error51);
|
|
89004
|
+
const connectivity = describeConnectivityError(error51);
|
|
89005
|
+
if (connectivity && connectivity.message !== base) {
|
|
89006
|
+
return `${base}: ${connectivity.message}`;
|
|
89007
|
+
}
|
|
89008
|
+
return base;
|
|
89009
|
+
}
|
|
88558
89010
|
function instructionsForStatusError(err) {
|
|
88559
89011
|
if (err instanceof EnvAuthConfigError) {
|
|
88560
89012
|
return "Check the UIPATH_CLI_* environment variables and re-run.";
|
|
88561
89013
|
}
|
|
89014
|
+
const connectivity = describeConnectivityError(err);
|
|
89015
|
+
if (connectivity) {
|
|
89016
|
+
return connectivity.instructions;
|
|
89017
|
+
}
|
|
88562
89018
|
return "Failed to read login status. Check your credentials file.";
|
|
88563
89019
|
}
|
|
88564
89020
|
function buildRefreshData(status) {
|
|
@@ -88622,7 +89078,7 @@ function defaultRefreshFailureInstructions(status) {
|
|
|
88622
89078
|
}
|
|
88623
89079
|
}
|
|
88624
89080
|
function registerLoginCommand(program2, context) {
|
|
88625
|
-
const loginCommand = program2.command("login").description("Login to UiPath Cloud").option("-f, --file <folder>", "Path to credentials folder").option("--authority <url>", "Custom authority URL").option("--client-id <id>", "Client Id or Application Id. Use env.ENV_NAME to read from an environment variable").option("--client-secret <secret>", "Client Secret or Application Secret. Use env.ENV_NAME to read from an environment variable").option("-s, --scope <scopes>", "Custom scopes or Application scopes (External Apps). Space separated values.").option("-t, --tenant <name>", "Tenant name (non-interactive mode)").option("--organization <name>", "Organization logical name to pre-select during browser login (bypasses the org picker for users in multiple organizations)").
|
|
89081
|
+
const loginCommand = program2.command("login").description("Login to UiPath Cloud").option("-f, --file <folder>", "Path to credentials folder").option("--authority <url>", "Custom authority URL").option("--client-id <id>", "Client Id or Application Id. Use env.ENV_NAME to read from an environment variable").option("--client-secret <secret>", "Client Secret or Application Secret. Use env.ENV_NAME to read from an environment variable").option("-s, --scope <scopes>", "Custom scopes or Application scopes (External Apps). Space separated values.").option("-t, --tenant <name>", "Tenant name (non-interactive mode)").option("--organization <name>", "Organization logical name to pre-select during browser login (bypasses the org picker for users in multiple organizations)").examples(LOGIN_EXAMPLES).trackedAction(context, async (options) => {
|
|
88626
89082
|
const envFilePath = resolveAuthFilePath(options.file);
|
|
88627
89083
|
let clientId;
|
|
88628
89084
|
let clientSecret;
|
|
@@ -88669,11 +89125,11 @@ function registerLoginCommand(program2, context) {
|
|
|
88669
89125
|
scope: options.scope ? options.scope.split(" ") : undefined,
|
|
88670
89126
|
tenant: options.tenant,
|
|
88671
89127
|
organization: options.organization,
|
|
88672
|
-
interactive:
|
|
89128
|
+
interactive: canPrompt(),
|
|
88673
89129
|
onEvent: handleAuthEvent
|
|
88674
89130
|
}));
|
|
88675
89131
|
if (error51) {
|
|
88676
|
-
const message =
|
|
89132
|
+
const message = loginErrorMessage(error51);
|
|
88677
89133
|
trackAuthLogin(authFlow, {
|
|
88678
89134
|
success: false,
|
|
88679
89135
|
errorMessage: message
|
|
@@ -88732,7 +89188,7 @@ function registerLoginCommand(program2, context) {
|
|
|
88732
89188
|
hasClientCredentials: !!(options.clientId && options.clientSecret),
|
|
88733
89189
|
hasTenant: !!options.tenant,
|
|
88734
89190
|
hasOrganization: !!options.organization,
|
|
88735
|
-
interactive:
|
|
89191
|
+
interactive: canPrompt()
|
|
88736
89192
|
}));
|
|
88737
89193
|
loginCommand.command("status").description("Show current login status and session information").examples(LOGIN_STATUS_EXAMPLES).trackedAction(context, async () => {
|
|
88738
89194
|
const [statusError, status] = await catchError(auth.getLoginStatus({
|
|
@@ -88741,7 +89197,7 @@ function registerLoginCommand(program2, context) {
|
|
|
88741
89197
|
if (statusError) {
|
|
88742
89198
|
OutputFormatter.error({
|
|
88743
89199
|
Result: RESULTS.ConfigError,
|
|
88744
|
-
Message: statusError
|
|
89200
|
+
Message: loginErrorMessage(statusError),
|
|
88745
89201
|
Instructions: instructionsForStatusError(statusError)
|
|
88746
89202
|
});
|
|
88747
89203
|
return;
|
|
@@ -88782,7 +89238,7 @@ function registerLoginCommand(program2, context) {
|
|
|
88782
89238
|
if (statusError) {
|
|
88783
89239
|
OutputFormatter.error({
|
|
88784
89240
|
Result: RESULTS.AuthenticationError,
|
|
88785
|
-
Message: `Could not read credentials: ${statusError
|
|
89241
|
+
Message: `Could not read credentials: ${loginErrorMessage(statusError)}`,
|
|
88786
89242
|
Instructions: instructionsForStatusError(statusError)
|
|
88787
89243
|
});
|
|
88788
89244
|
context.exit(2);
|
|
@@ -88810,7 +89266,7 @@ function registerLoginCommand(program2, context) {
|
|
|
88810
89266
|
if (statusError) {
|
|
88811
89267
|
OutputFormatter.error({
|
|
88812
89268
|
Result: RESULTS.ConfigError,
|
|
88813
|
-
Message: statusError
|
|
89269
|
+
Message: loginErrorMessage(statusError),
|
|
88814
89270
|
Instructions: instructionsForStatusError(statusError)
|
|
88815
89271
|
});
|
|
88816
89272
|
return;
|
|
@@ -88826,10 +89282,11 @@ function registerLoginCommand(program2, context) {
|
|
|
88826
89282
|
}
|
|
88827
89283
|
const [fetchError, data] = await catchError(auth.fetchTenants(status.baseUrl, status.accessToken, status.organizationId));
|
|
88828
89284
|
if (fetchError) {
|
|
89285
|
+
const connectivity = describeConnectivityError(fetchError);
|
|
88829
89286
|
OutputFormatter.error({
|
|
88830
89287
|
Result: RESULTS.Failure,
|
|
88831
|
-
Message: fetchError
|
|
88832
|
-
Instructions: "Failed to fetch tenants. Check your network connection and try again."
|
|
89288
|
+
Message: loginErrorMessage(fetchError),
|
|
89289
|
+
Instructions: connectivity?.instructions ?? "Failed to fetch tenants. Check your network connection and try again."
|
|
88833
89290
|
});
|
|
88834
89291
|
return;
|
|
88835
89292
|
}
|
|
@@ -88887,7 +89344,7 @@ function registerLoginCommand(program2, context) {
|
|
|
88887
89344
|
if (statusError) {
|
|
88888
89345
|
OutputFormatter.error({
|
|
88889
89346
|
Result: RESULTS.ConfigError,
|
|
88890
|
-
Message: statusError
|
|
89347
|
+
Message: loginErrorMessage(statusError),
|
|
88891
89348
|
Instructions: instructionsForStatusError(statusError)
|
|
88892
89349
|
});
|
|
88893
89350
|
return;
|
|
@@ -105111,48 +105568,131 @@ var init_send_feedback = __esm(() => {
|
|
|
105111
105568
|
];
|
|
105112
105569
|
});
|
|
105113
105570
|
|
|
105571
|
+
// src/commands/skills/agents/detect.ts
|
|
105572
|
+
import { spawn } from "node:child_process";
|
|
105573
|
+
function windowsExts() {
|
|
105574
|
+
const fs7 = getFileSystem();
|
|
105575
|
+
const raw = fs7.env.getenv("PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
|
|
105576
|
+
return raw.split(";").map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
105577
|
+
}
|
|
105578
|
+
async function commandOnPath(...names) {
|
|
105579
|
+
const isWin = process.platform === "win32";
|
|
105580
|
+
const fs7 = getFileSystem();
|
|
105581
|
+
const pathVar = fs7.env.getenv("PATH") ?? "";
|
|
105582
|
+
if (!pathVar)
|
|
105583
|
+
return false;
|
|
105584
|
+
const dirs = pathVar.split(isWin ? ";" : ":").filter(Boolean);
|
|
105585
|
+
const exts = isWin ? ["", ...windowsExts()] : [""];
|
|
105586
|
+
for (const dir of dirs) {
|
|
105587
|
+
for (const name of names) {
|
|
105588
|
+
for (const ext of exts) {
|
|
105589
|
+
const candidate = fs7.path.join(dir, `${name}${ext}`);
|
|
105590
|
+
const [, exists] = await catchError(fs7.exists(candidate));
|
|
105591
|
+
if (exists)
|
|
105592
|
+
return true;
|
|
105593
|
+
}
|
|
105594
|
+
}
|
|
105595
|
+
}
|
|
105596
|
+
return false;
|
|
105597
|
+
}
|
|
105598
|
+
function runVersion(command, args, timeoutMs = VERSION_TIMEOUT_MS) {
|
|
105599
|
+
return new Promise((resolve2) => {
|
|
105600
|
+
const proc = process.platform === "win32" ? spawn([command, ...args].join(" "), [], {
|
|
105601
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
105602
|
+
shell: true
|
|
105603
|
+
}) : spawn(command, [...args], {
|
|
105604
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
105605
|
+
});
|
|
105606
|
+
let out = "";
|
|
105607
|
+
let settled = false;
|
|
105608
|
+
const finish = (value) => {
|
|
105609
|
+
if (settled)
|
|
105610
|
+
return;
|
|
105611
|
+
settled = true;
|
|
105612
|
+
clearTimeout(timer);
|
|
105613
|
+
resolve2(value);
|
|
105614
|
+
};
|
|
105615
|
+
const timer = setTimeout(() => {
|
|
105616
|
+
proc.kill();
|
|
105617
|
+
finish(null);
|
|
105618
|
+
}, timeoutMs);
|
|
105619
|
+
proc.stdout?.on("data", (d) => {
|
|
105620
|
+
out += d.toString();
|
|
105621
|
+
});
|
|
105622
|
+
proc.stderr?.on("data", (d) => {
|
|
105623
|
+
out += d.toString();
|
|
105624
|
+
});
|
|
105625
|
+
proc.on("error", () => finish(null));
|
|
105626
|
+
proc.on("close", () => finish(out || null));
|
|
105627
|
+
});
|
|
105628
|
+
}
|
|
105629
|
+
async function verifiedCommandOnPath(names, signature, versionArgs = ["--version"]) {
|
|
105630
|
+
for (const name of names) {
|
|
105631
|
+
if (!await commandOnPath(name))
|
|
105632
|
+
continue;
|
|
105633
|
+
const out = await runVersion(name, versionArgs);
|
|
105634
|
+
if (out && signature.test(out))
|
|
105635
|
+
return true;
|
|
105636
|
+
}
|
|
105637
|
+
return false;
|
|
105638
|
+
}
|
|
105639
|
+
async function homePathExists(...segments) {
|
|
105640
|
+
const fs7 = getFileSystem();
|
|
105641
|
+
const [, exists] = await catchError(fs7.exists(fs7.path.join(fs7.env.homedir(), ...segments)));
|
|
105642
|
+
return exists ?? false;
|
|
105643
|
+
}
|
|
105644
|
+
var VERSION_TIMEOUT_MS = 5000;
|
|
105645
|
+
var init_detect = __esm(() => {
|
|
105646
|
+
init_src2();
|
|
105647
|
+
init_src();
|
|
105648
|
+
});
|
|
105649
|
+
|
|
105114
105650
|
// src/commands/skills/agents/autopilot.ts
|
|
105115
105651
|
var def;
|
|
105116
105652
|
var init_autopilot = __esm(() => {
|
|
105653
|
+
init_detect();
|
|
105117
105654
|
def = {
|
|
105118
|
-
localSubdir: [".autopilot", "skills"]
|
|
105655
|
+
localSubdir: [".autopilot", "skills"],
|
|
105656
|
+
detect: () => homePathExists(".autopilot")
|
|
105119
105657
|
};
|
|
105120
105658
|
});
|
|
105121
105659
|
|
|
105122
105660
|
// src/commands/skills/contentStore.ts
|
|
105123
|
-
import {
|
|
105124
|
-
import {
|
|
105125
|
-
|
|
105661
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
105662
|
+
import { gunzipSync } from "node:zlib";
|
|
105663
|
+
function loadChildProcess2() {
|
|
105664
|
+
childProcessModulePromise2 ??= import("node:child_process");
|
|
105665
|
+
return childProcessModulePromise2;
|
|
105666
|
+
}
|
|
105667
|
+
async function fetchSkillsTo(targetPath, _rootDir) {
|
|
105126
105668
|
const fs7 = getFileSystem();
|
|
105127
|
-
|
|
105128
|
-
|
|
105129
|
-
|
|
105130
|
-
|
|
105131
|
-
|
|
105132
|
-
|
|
105133
|
-
|
|
105134
|
-
|
|
105135
|
-
}
|
|
105669
|
+
const packageInfo = await fetchMatchingSkillsPackageInfo();
|
|
105670
|
+
logger.info(`Downloading ${SKILLS_PACKAGE_NAME}@${packageInfo.version} content store...`);
|
|
105671
|
+
const tmpPath = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-store-${randomUUID5()}`);
|
|
105672
|
+
const manifestPath = fs7.path.join(targetPath, MANIFEST_NAME);
|
|
105673
|
+
let savedManifest = null;
|
|
105674
|
+
if (await fs7.exists(targetPath)) {
|
|
105675
|
+
savedManifest = await fs7.readFile(manifestPath, {
|
|
105676
|
+
encoding: "utf-8"
|
|
105677
|
+
});
|
|
105136
105678
|
}
|
|
105137
|
-
|
|
105138
|
-
|
|
105139
|
-
|
|
105140
|
-
|
|
105679
|
+
try {
|
|
105680
|
+
await fs7.mkdir(tmpPath);
|
|
105681
|
+
await downloadAndExtractPackage(packageInfo, tmpPath);
|
|
105682
|
+
if (!await fs7.exists(fs7.path.join(tmpPath, "skills"))) {
|
|
105683
|
+
throw new Error(`${SKILLS_PACKAGE_NAME}@${packageInfo.version} does not contain a skills/ directory`);
|
|
105684
|
+
}
|
|
105685
|
+
await writeSourceMarker(tmpPath, packageInfo);
|
|
105141
105686
|
if (await fs7.exists(targetPath)) {
|
|
105142
|
-
savedManifest = await fs7.readFile(manifestPath, {
|
|
105143
|
-
encoding: "utf-8"
|
|
105144
|
-
});
|
|
105145
105687
|
await fs7.rm(targetPath);
|
|
105146
105688
|
}
|
|
105147
105689
|
await fs7.mkdir(targetPath);
|
|
105148
|
-
|
|
105149
|
-
if (cloneError) {
|
|
105150
|
-
logger.info("git clone failed, falling back to zip download...");
|
|
105151
|
-
await downloadAndExtractZip(targetPath);
|
|
105152
|
-
}
|
|
105690
|
+
await fs7.copyDirectory(tmpPath, targetPath);
|
|
105153
105691
|
if (savedManifest !== null) {
|
|
105154
105692
|
await fs7.writeFile(manifestPath, savedManifest);
|
|
105155
105693
|
}
|
|
105694
|
+
} finally {
|
|
105695
|
+
await catchError(fs7.rm(tmpPath));
|
|
105156
105696
|
}
|
|
105157
105697
|
}
|
|
105158
105698
|
async function getContentStore(rootDir) {
|
|
@@ -105274,88 +105814,543 @@ async function removeFromManifest(storePath, skillNames, agents) {
|
|
|
105274
105814
|
}
|
|
105275
105815
|
await writeManifest(storePath, manifest);
|
|
105276
105816
|
}
|
|
105277
|
-
function
|
|
105278
|
-
return
|
|
105279
|
-
|
|
105280
|
-
|
|
105281
|
-
|
|
105282
|
-
|
|
105283
|
-
|
|
105284
|
-
|
|
105285
|
-
|
|
105286
|
-
|
|
105287
|
-
|
|
105817
|
+
function registryPackagePath(packageName) {
|
|
105818
|
+
return packageName.replaceAll("/", "%2f");
|
|
105819
|
+
}
|
|
105820
|
+
function trimTrailingSlashes(value) {
|
|
105821
|
+
let end = value.length;
|
|
105822
|
+
while (end > 0 && value.codePointAt(end - 1) === 47) {
|
|
105823
|
+
end--;
|
|
105824
|
+
}
|
|
105825
|
+
return value.slice(0, end);
|
|
105826
|
+
}
|
|
105827
|
+
function asRecord(value) {
|
|
105828
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
105829
|
+
return;
|
|
105830
|
+
}
|
|
105831
|
+
return value;
|
|
105832
|
+
}
|
|
105833
|
+
function isDecimalInteger(value) {
|
|
105834
|
+
return value.length > 0 && Array.from(value).every((char) => char >= "0" && char <= "9");
|
|
105835
|
+
}
|
|
105836
|
+
function isSemverIdentifierChar(char) {
|
|
105837
|
+
const code = char.codePointAt(0);
|
|
105838
|
+
return code !== undefined && (code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || char === "-");
|
|
105839
|
+
}
|
|
105840
|
+
function isSemverIdentifierList(value) {
|
|
105841
|
+
return value.length > 0 && value.split(".").every((part) => part.length > 0 && Array.from(part).every(isSemverIdentifierChar));
|
|
105842
|
+
}
|
|
105843
|
+
function stripSemverBuild(version2) {
|
|
105844
|
+
const parts = version2.split("+");
|
|
105845
|
+
if (parts.length > 2)
|
|
105846
|
+
return null;
|
|
105847
|
+
const build = parts[1];
|
|
105848
|
+
if (build !== undefined && !isSemverIdentifierList(build))
|
|
105849
|
+
return null;
|
|
105850
|
+
return parts[0];
|
|
105851
|
+
}
|
|
105852
|
+
function splitSemverPrerelease(version2) {
|
|
105853
|
+
const prereleaseSeparator = version2.indexOf("-");
|
|
105854
|
+
if (prereleaseSeparator === -1) {
|
|
105855
|
+
return { core: version2 };
|
|
105856
|
+
}
|
|
105857
|
+
const prerelease = version2.slice(prereleaseSeparator + 1);
|
|
105858
|
+
if (!isSemverIdentifierList(prerelease))
|
|
105859
|
+
return null;
|
|
105860
|
+
return {
|
|
105861
|
+
core: version2.slice(0, prereleaseSeparator),
|
|
105862
|
+
prerelease
|
|
105863
|
+
};
|
|
105864
|
+
}
|
|
105865
|
+
function parseSemver(version2) {
|
|
105866
|
+
const versionWithoutBuild = stripSemverBuild(version2);
|
|
105867
|
+
if (!versionWithoutBuild)
|
|
105868
|
+
return null;
|
|
105869
|
+
const parsed = splitSemverPrerelease(versionWithoutBuild);
|
|
105870
|
+
if (!parsed)
|
|
105871
|
+
return null;
|
|
105872
|
+
const coreParts = parsed.core.split(".");
|
|
105873
|
+
if (coreParts.length !== 3 || !coreParts.every(isDecimalInteger)) {
|
|
105874
|
+
return null;
|
|
105875
|
+
}
|
|
105876
|
+
return {
|
|
105877
|
+
major: Number.parseInt(coreParts[0], 10),
|
|
105878
|
+
minor: Number.parseInt(coreParts[1], 10),
|
|
105879
|
+
patch: Number.parseInt(coreParts[2], 10),
|
|
105880
|
+
...parsed.prerelease ? { prerelease: parsed.prerelease } : {}
|
|
105881
|
+
};
|
|
105882
|
+
}
|
|
105883
|
+
function parsePrereleasePart(value) {
|
|
105884
|
+
if (!isDecimalInteger(value))
|
|
105885
|
+
return { value };
|
|
105886
|
+
return { value, numericValue: Number.parseInt(value, 10) };
|
|
105887
|
+
}
|
|
105888
|
+
function comparePrereleasePart(left, right) {
|
|
105889
|
+
const leftNumericValue = left.numericValue;
|
|
105890
|
+
const rightNumericValue = right.numericValue;
|
|
105891
|
+
const leftIsNumeric = leftNumericValue !== undefined;
|
|
105892
|
+
const rightIsNumeric = rightNumericValue !== undefined;
|
|
105893
|
+
if (leftNumericValue !== undefined && rightNumericValue !== undefined) {
|
|
105894
|
+
const numericDiff = leftNumericValue - rightNumericValue;
|
|
105895
|
+
if (numericDiff !== 0)
|
|
105896
|
+
return numericDiff;
|
|
105897
|
+
}
|
|
105898
|
+
if (leftIsNumeric !== rightIsNumeric) {
|
|
105899
|
+
return leftIsNumeric ? -1 : 1;
|
|
105900
|
+
}
|
|
105901
|
+
if (left.value === right.value)
|
|
105902
|
+
return 0;
|
|
105903
|
+
return left.value.localeCompare(right.value);
|
|
105904
|
+
}
|
|
105905
|
+
function compareOptionalPrereleasePart(left, right) {
|
|
105906
|
+
if (left === undefined)
|
|
105907
|
+
return right === undefined ? 0 : -1;
|
|
105908
|
+
if (right === undefined)
|
|
105909
|
+
return 1;
|
|
105910
|
+
return comparePrereleasePart(parsePrereleasePart(left), parsePrereleasePart(right));
|
|
105911
|
+
}
|
|
105912
|
+
function comparePrerelease(a, b) {
|
|
105913
|
+
const aParts = a.split(".");
|
|
105914
|
+
const bParts = b.split(".");
|
|
105915
|
+
const length = Math.max(aParts.length, bParts.length);
|
|
105916
|
+
for (let i = 0;i < length; i++) {
|
|
105917
|
+
const comparison = compareOptionalPrereleasePart(aParts[i], bParts[i]);
|
|
105918
|
+
if (comparison !== 0)
|
|
105919
|
+
return comparison;
|
|
105920
|
+
}
|
|
105921
|
+
return 0;
|
|
105922
|
+
}
|
|
105923
|
+
function compareSemver2(a, b) {
|
|
105924
|
+
const left = parseSemver(a);
|
|
105925
|
+
const right = parseSemver(b);
|
|
105926
|
+
if (!left || !right)
|
|
105927
|
+
return a.localeCompare(b);
|
|
105928
|
+
const coreDiff = left.major - right.major || left.minor - right.minor || left.patch - right.patch;
|
|
105929
|
+
if (coreDiff !== 0)
|
|
105930
|
+
return coreDiff;
|
|
105931
|
+
if (!left.prerelease && !right.prerelease)
|
|
105932
|
+
return 0;
|
|
105933
|
+
if (!left.prerelease)
|
|
105934
|
+
return 1;
|
|
105935
|
+
if (!right.prerelease)
|
|
105936
|
+
return -1;
|
|
105937
|
+
return comparePrerelease(left.prerelease, right.prerelease);
|
|
105938
|
+
}
|
|
105939
|
+
function matchesCliVersionLine(version2, cliVersion) {
|
|
105940
|
+
const parsed = parseSemver(version2);
|
|
105941
|
+
if (!parsed)
|
|
105942
|
+
return false;
|
|
105943
|
+
if (parsed.major !== cliVersion.major || parsed.minor !== cliVersion.minor) {
|
|
105944
|
+
return false;
|
|
105945
|
+
}
|
|
105946
|
+
return true;
|
|
105947
|
+
}
|
|
105948
|
+
function isStableVersion(version2) {
|
|
105949
|
+
return parseSemver(version2)?.prerelease === undefined;
|
|
105950
|
+
}
|
|
105951
|
+
function getGhNpmRegistryToken() {
|
|
105952
|
+
const envToken = globalThis.process?.env?.GH_NPM_REGISTRY_TOKEN;
|
|
105953
|
+
return envToken || undefined;
|
|
105954
|
+
}
|
|
105955
|
+
function validateNpmArgument(arg) {
|
|
105956
|
+
if (!SHELL_SAFE_ARG2.test(arg)) {
|
|
105957
|
+
throw new Error(`Unsafe npm argument: '${arg}'`);
|
|
105958
|
+
}
|
|
105959
|
+
}
|
|
105960
|
+
function validateNpmArguments(args) {
|
|
105961
|
+
for (const arg of args) {
|
|
105962
|
+
validateNpmArgument(arg);
|
|
105963
|
+
}
|
|
105964
|
+
}
|
|
105965
|
+
function packageFetchHeaders(accept, authToken) {
|
|
105966
|
+
return {
|
|
105967
|
+
Accept: accept,
|
|
105968
|
+
...authToken ? { Authorization: `Bearer ${authToken}` } : {}
|
|
105969
|
+
};
|
|
105970
|
+
}
|
|
105971
|
+
async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
105972
|
+
validateNpmArguments(args);
|
|
105973
|
+
const { spawn: spawn2 } = await loadChildProcess2();
|
|
105974
|
+
const isWindows = process.platform === "win32";
|
|
105975
|
+
return await new Promise((resolve2, reject) => {
|
|
105976
|
+
let proc;
|
|
105977
|
+
if (isWindows) {
|
|
105978
|
+
if (!SHELL_SAFE_ARG2.test("npm")) {
|
|
105979
|
+
reject(new Error("Unsafe executable: 'npm'"));
|
|
105980
|
+
return;
|
|
105981
|
+
}
|
|
105982
|
+
const commandLine = ["npm", ...args].join(" ");
|
|
105983
|
+
if (!SHELL_SAFE_COMMAND_LINE2.test(commandLine)) {
|
|
105984
|
+
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
105985
|
+
return;
|
|
105986
|
+
}
|
|
105987
|
+
proc = spawn2(commandLine, [], { cwd, shell: true });
|
|
105988
|
+
} else {
|
|
105989
|
+
proc = spawn2("npm", args, { cwd });
|
|
105990
|
+
}
|
|
105288
105991
|
let stdout = "";
|
|
105289
105992
|
let stderr = "";
|
|
105290
|
-
|
|
105291
|
-
|
|
105993
|
+
const MAX_STDERR = 65536;
|
|
105994
|
+
proc.stdout?.on("data", (data) => {
|
|
105995
|
+
stdout += data.toString();
|
|
105292
105996
|
});
|
|
105293
|
-
proc.stderr?.on("data", (
|
|
105294
|
-
stderr
|
|
105997
|
+
proc.stderr?.on("data", (data) => {
|
|
105998
|
+
if (stderr.length < MAX_STDERR) {
|
|
105999
|
+
stderr += data.toString();
|
|
106000
|
+
}
|
|
105295
106001
|
});
|
|
105296
106002
|
const timer = setTimeout(() => {
|
|
105297
106003
|
proc.kill("SIGTERM");
|
|
105298
|
-
reject(new Error(`
|
|
105299
|
-
},
|
|
105300
|
-
proc.on("error", (
|
|
106004
|
+
reject(new Error(`npm ${label} timed out after ${timeoutMs / 1000}s`));
|
|
106005
|
+
}, timeoutMs);
|
|
106006
|
+
proc.on("error", (error51) => {
|
|
105301
106007
|
clearTimeout(timer);
|
|
105302
|
-
reject(
|
|
106008
|
+
reject(mapNpmError(label, stderr, error51));
|
|
105303
106009
|
});
|
|
105304
106010
|
proc.on("close", (code) => {
|
|
105305
106011
|
clearTimeout(timer);
|
|
105306
|
-
code === 0
|
|
106012
|
+
if (code === 0) {
|
|
106013
|
+
resolve2(stdout);
|
|
106014
|
+
return;
|
|
106015
|
+
}
|
|
106016
|
+
reject(mapNpmError(label, stderr, code));
|
|
105307
106017
|
});
|
|
105308
106018
|
});
|
|
105309
106019
|
}
|
|
105310
|
-
|
|
105311
|
-
|
|
105312
|
-
|
|
106020
|
+
function mapNpmError(label, stderr, codeOrError) {
|
|
106021
|
+
if (/E404/.test(stderr) || /404/.test(stderr)) {
|
|
106022
|
+
return new Error(`${SKILLS_PACKAGE_NAME} not found in the registry`);
|
|
106023
|
+
}
|
|
106024
|
+
if (/E401|E403|ENEEDAUTH|need(s)? auth|authentication/i.test(stderr)) {
|
|
106025
|
+
return new Error(`Authentication required for ${SKILLS_PACKAGE_NAME} (configure @uipath:registry and an auth token in .npmrc, or set GH_NPM_REGISTRY_TOKEN)`);
|
|
106026
|
+
}
|
|
106027
|
+
const detail = stderr.trim() || (codeOrError instanceof Error ? codeOrError.message : `exit ${codeOrError}`);
|
|
106028
|
+
return new Error(`npm ${label} failed: ${detail}`);
|
|
106029
|
+
}
|
|
106030
|
+
function parseNpmJson(stdout, label) {
|
|
106031
|
+
const [parseError, parsed] = catchError(() => JSON.parse(stdout));
|
|
106032
|
+
if (parseError) {
|
|
106033
|
+
throw new Error(`Unexpected npm ${label} output`);
|
|
106034
|
+
}
|
|
106035
|
+
return parsed;
|
|
106036
|
+
}
|
|
106037
|
+
async function npmViewJson(args) {
|
|
106038
|
+
const stdout = await runNpmCommand(["view", ...args, "--json"], `view ${args.join(" ")}`, NPM_VIEW_TIMEOUT_MS2);
|
|
106039
|
+
return parseNpmJson(stdout, "view");
|
|
106040
|
+
}
|
|
106041
|
+
function normalizeVersionList(value) {
|
|
106042
|
+
if (Array.isArray(value)) {
|
|
106043
|
+
return value.filter((version2) => {
|
|
106044
|
+
return typeof version2 === "string";
|
|
106045
|
+
});
|
|
106046
|
+
}
|
|
106047
|
+
if (typeof value === "string") {
|
|
106048
|
+
return [value];
|
|
106049
|
+
}
|
|
106050
|
+
return [];
|
|
106051
|
+
}
|
|
106052
|
+
function requireString(value, message) {
|
|
106053
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
106054
|
+
throw new Error(message);
|
|
106055
|
+
}
|
|
106056
|
+
return value;
|
|
106057
|
+
}
|
|
106058
|
+
function registryFromTarball(tarballUrl) {
|
|
106059
|
+
const [urlError, parsedUrl] = catchError(() => new URL(tarballUrl));
|
|
106060
|
+
return urlError ? SKILLS_REGISTRY_URL : parsedUrl.origin;
|
|
106061
|
+
}
|
|
106062
|
+
async function fetchJson(url2, authToken) {
|
|
106063
|
+
const response = await fetch(url2, {
|
|
106064
|
+
headers: packageFetchHeaders("application/json", authToken),
|
|
106065
|
+
signal: AbortSignal.timeout(60000)
|
|
106066
|
+
});
|
|
106067
|
+
if (!response.ok) {
|
|
106068
|
+
throw new Error(`Registry returned ${response.status} ${response.statusText} for ${SKILLS_PACKAGE_NAME}`);
|
|
106069
|
+
}
|
|
106070
|
+
const data = asRecord(await response.json());
|
|
106071
|
+
if (!data) {
|
|
106072
|
+
throw new Error(`Registry returned invalid metadata for ${SKILLS_PACKAGE_NAME}`);
|
|
106073
|
+
}
|
|
106074
|
+
return data;
|
|
106075
|
+
}
|
|
106076
|
+
async function fetchMatchingSkillsPackageInfo() {
|
|
106077
|
+
const cliVersion = parseSemver(package_default.version);
|
|
106078
|
+
if (!cliVersion) {
|
|
106079
|
+
throw new Error(`Invalid CLI version ${package_default.version}; expected semantic version major.minor.patch`);
|
|
106080
|
+
}
|
|
106081
|
+
const ghToken = getGhNpmRegistryToken();
|
|
106082
|
+
if (ghToken) {
|
|
106083
|
+
logger.debug(`GH_NPM_REGISTRY_TOKEN found; using ${SKILLS_GITHUB_REGISTRY_URL}`);
|
|
106084
|
+
return await fetchMatchingSkillsPackageInfoFromRegistry(cliVersion, SKILLS_GITHUB_REGISTRY_URL, ghToken);
|
|
106085
|
+
}
|
|
106086
|
+
return await fetchMatchingSkillsPackageInfoWithNpm(cliVersion);
|
|
106087
|
+
}
|
|
106088
|
+
function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
106089
|
+
const matchingVersions = versions2.filter((version2) => matchesCliVersionLine(version2, cliVersion));
|
|
106090
|
+
const preferredVersions = cliVersion.prerelease === undefined ? matchingVersions.filter(isStableVersion) : matchingVersions;
|
|
106091
|
+
const selectedVersion = (preferredVersions.length > 0 ? preferredVersions : matchingVersions).sort((a, b) => compareSemver2(b, a))[0];
|
|
106092
|
+
if (!selectedVersion) {
|
|
106093
|
+
throw new Error(`${SKILLS_PACKAGE_NAME} has no published version matching CLI ${cliVersion.major}.${cliVersion.minor}.x`);
|
|
106094
|
+
}
|
|
106095
|
+
return selectedVersion;
|
|
106096
|
+
}
|
|
106097
|
+
async function fetchMatchingSkillsPackageInfoWithNpm(cliVersion) {
|
|
106098
|
+
const versions2 = normalizeVersionList(await npmViewJson([SKILLS_PACKAGE_NAME, "versions"]));
|
|
106099
|
+
const selectedVersion = pickMatchingSkillsVersion(versions2, cliVersion);
|
|
106100
|
+
const tarballUrl = requireString(await npmViewJson([
|
|
106101
|
+
`${SKILLS_PACKAGE_NAME}@${selectedVersion}`,
|
|
106102
|
+
"dist.tarball"
|
|
106103
|
+
]), `${SKILLS_PACKAGE_NAME}@${selectedVersion} does not declare dist.tarball`);
|
|
106104
|
+
return {
|
|
106105
|
+
version: selectedVersion,
|
|
106106
|
+
tarballUrl,
|
|
106107
|
+
registryUrl: registryFromTarball(tarballUrl)
|
|
106108
|
+
};
|
|
106109
|
+
}
|
|
106110
|
+
async function fetchMatchingSkillsPackageInfoFromRegistry(cliVersion, registryUrl, authToken) {
|
|
106111
|
+
const [urlError] = catchError(() => new URL(registryUrl));
|
|
106112
|
+
if (urlError) {
|
|
106113
|
+
throw new Error(`Invalid registry URL: "${registryUrl}"`);
|
|
106114
|
+
}
|
|
106115
|
+
const url2 = `${trimTrailingSlashes(registryUrl)}/${registryPackagePath(SKILLS_PACKAGE_NAME)}`;
|
|
106116
|
+
const data = await fetchJson(url2, authToken);
|
|
106117
|
+
const versions2 = asRecord(data.versions);
|
|
106118
|
+
const selectedVersion = pickMatchingSkillsVersion(Object.keys(versions2 ?? {}), cliVersion);
|
|
106119
|
+
const selectedPackageVersion = asRecord(versions2?.[selectedVersion]);
|
|
106120
|
+
const dist = asRecord(selectedPackageVersion?.dist);
|
|
106121
|
+
const tarballUrl = typeof dist?.tarball === "string" ? dist.tarball : undefined;
|
|
106122
|
+
if (!tarballUrl) {
|
|
106123
|
+
throw new Error(`${SKILLS_PACKAGE_NAME}@${selectedVersion} does not declare dist.tarball`);
|
|
106124
|
+
}
|
|
106125
|
+
return {
|
|
106126
|
+
version: selectedVersion,
|
|
106127
|
+
tarballUrl,
|
|
106128
|
+
registryUrl,
|
|
106129
|
+
authToken
|
|
106130
|
+
};
|
|
106131
|
+
}
|
|
106132
|
+
async function downloadAndExtractPackage(packageInfo, destinationPath) {
|
|
106133
|
+
if (!packageInfo.authToken) {
|
|
106134
|
+
await packAndExtractPackage(packageInfo, destinationPath);
|
|
106135
|
+
return;
|
|
106136
|
+
}
|
|
106137
|
+
const response = await fetch(packageInfo.tarballUrl, {
|
|
106138
|
+
headers: packageFetchHeaders("application/octet-stream", packageInfo.authToken),
|
|
105313
106139
|
signal: AbortSignal.timeout(60000)
|
|
105314
106140
|
});
|
|
105315
106141
|
if (!response.ok) {
|
|
105316
|
-
throw new Error(`Failed to download
|
|
106142
|
+
throw new Error(`Failed to download ${SKILLS_PACKAGE_NAME}@${packageInfo.version}: ${response.status} ${response.statusText}`);
|
|
105317
106143
|
}
|
|
105318
|
-
const zipPath = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-${randomUUID4()}.zip`);
|
|
105319
106144
|
const arrayBuffer = await response.arrayBuffer();
|
|
105320
|
-
|
|
106145
|
+
const tarData = gunzipSync(new Uint8Array(arrayBuffer));
|
|
106146
|
+
await extractNpmTarballToDir(tarData, destinationPath);
|
|
106147
|
+
}
|
|
106148
|
+
async function packAndExtractPackage(packageInfo, destinationPath) {
|
|
106149
|
+
const fs7 = getFileSystem();
|
|
106150
|
+
const packDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pack-${randomUUID5()}`);
|
|
105321
106151
|
try {
|
|
105322
|
-
|
|
105323
|
-
|
|
105324
|
-
|
|
105325
|
-
|
|
105326
|
-
|
|
105327
|
-
|
|
105328
|
-
|
|
105329
|
-
|
|
105330
|
-
|
|
105331
|
-
|
|
105332
|
-
|
|
105333
|
-
|
|
105334
|
-
|
|
105335
|
-
|
|
105336
|
-
|
|
105337
|
-
|
|
105338
|
-
|
|
105339
|
-
|
|
106152
|
+
await fs7.mkdir(packDir);
|
|
106153
|
+
const stdout = await runNpmCommand(["pack", `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, "--json"], `pack ${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, NPM_PACK_TIMEOUT_MS, packDir);
|
|
106154
|
+
const packOutput = parseNpmJson(stdout, "pack");
|
|
106155
|
+
const packedFile = readPackedFileName(packOutput);
|
|
106156
|
+
const packedPath = fs7.path.join(packDir, packedFile);
|
|
106157
|
+
const packedContent = await fs7.readFile(packedPath);
|
|
106158
|
+
if (!packedContent) {
|
|
106159
|
+
throw new Error(`npm pack did not create ${packedFile}`);
|
|
106160
|
+
}
|
|
106161
|
+
const tarData = gunzipSync(new Uint8Array(packedContent));
|
|
106162
|
+
await extractNpmTarballToDir(tarData, destinationPath);
|
|
106163
|
+
} finally {
|
|
106164
|
+
await catchError(fs7.rm(packDir));
|
|
106165
|
+
}
|
|
106166
|
+
}
|
|
106167
|
+
function readPackedFileName(packOutput) {
|
|
106168
|
+
if (!Array.isArray(packOutput)) {
|
|
106169
|
+
throw new TypeError(`Unexpected npm pack output for ${SKILLS_PACKAGE_NAME}`);
|
|
106170
|
+
}
|
|
106171
|
+
const firstEntry = asRecord(packOutput[0]);
|
|
106172
|
+
const filename = typeof firstEntry?.filename === "string" ? firstEntry.filename : undefined;
|
|
106173
|
+
if (!filename) {
|
|
106174
|
+
throw new TypeError(`Unexpected npm pack output for ${SKILLS_PACKAGE_NAME}`);
|
|
106175
|
+
}
|
|
106176
|
+
if (filename.includes("/") || filename.includes("\\")) {
|
|
106177
|
+
throw new Error(`Unsafe npm pack filename for ${SKILLS_PACKAGE_NAME}`);
|
|
106178
|
+
}
|
|
106179
|
+
return filename;
|
|
106180
|
+
}
|
|
106181
|
+
async function writeSourceMarker(storePath, packageInfo) {
|
|
106182
|
+
const fs7 = getFileSystem();
|
|
106183
|
+
const marker = {
|
|
106184
|
+
source: "npm",
|
|
106185
|
+
package: SKILLS_PACKAGE_NAME,
|
|
106186
|
+
version: packageInfo.version,
|
|
106187
|
+
registry: packageInfo.registryUrl,
|
|
106188
|
+
tarball: packageInfo.tarballUrl,
|
|
106189
|
+
fetchedAt: new Date().toISOString()
|
|
106190
|
+
};
|
|
106191
|
+
await fs7.writeFile(fs7.path.join(storePath, SOURCE_MARKER_NAME), `${JSON.stringify(marker, null, 4)}
|
|
106192
|
+
`);
|
|
106193
|
+
}
|
|
106194
|
+
function readTarString(data, offset, length) {
|
|
106195
|
+
const field = data.subarray(offset, offset + length);
|
|
106196
|
+
const nullIndex = field.indexOf(0);
|
|
106197
|
+
const end = nullIndex >= 0 ? nullIndex : field.length;
|
|
106198
|
+
return Buffer.from(field.subarray(0, end)).toString("utf-8");
|
|
106199
|
+
}
|
|
106200
|
+
function readTarOctal(data, offset, length) {
|
|
106201
|
+
const raw = readTarString(data, offset, length).trim();
|
|
106202
|
+
if (!raw)
|
|
106203
|
+
return 0;
|
|
106204
|
+
const parsed = Number.parseInt(raw, 8);
|
|
106205
|
+
if (Number.isNaN(parsed)) {
|
|
106206
|
+
throw new TypeError(`Invalid tar numeric field: ${raw}`);
|
|
106207
|
+
}
|
|
106208
|
+
return parsed;
|
|
106209
|
+
}
|
|
106210
|
+
function readTarPath(data, headerOffset) {
|
|
106211
|
+
const name = readTarString(data, headerOffset, 100);
|
|
106212
|
+
const prefix = readTarString(data, headerOffset + 345, 155);
|
|
106213
|
+
return prefix ? `${prefix}/${name}` : name;
|
|
106214
|
+
}
|
|
106215
|
+
function isZeroBlock(data, offset) {
|
|
106216
|
+
for (let i = offset;i < offset + TAR_BLOCK_SIZE; i++) {
|
|
106217
|
+
if (data[i] !== 0)
|
|
106218
|
+
return false;
|
|
106219
|
+
}
|
|
106220
|
+
return true;
|
|
106221
|
+
}
|
|
106222
|
+
function parsePaxAttributes(data) {
|
|
106223
|
+
const text = Buffer.from(data).toString("utf-8");
|
|
106224
|
+
const attributes = {};
|
|
106225
|
+
let offset = 0;
|
|
106226
|
+
while (offset < text.length) {
|
|
106227
|
+
const spaceIndex = text.indexOf(" ", offset);
|
|
106228
|
+
if (spaceIndex === -1)
|
|
106229
|
+
break;
|
|
106230
|
+
const lengthText = text.slice(offset, spaceIndex);
|
|
106231
|
+
const recordLength = Number.parseInt(lengthText, 10);
|
|
106232
|
+
if (!Number.isFinite(recordLength) || recordLength <= 0)
|
|
106233
|
+
break;
|
|
106234
|
+
const record3 = text.slice(spaceIndex + 1, offset + recordLength);
|
|
106235
|
+
const equalsIndex = record3.indexOf("=");
|
|
106236
|
+
if (equalsIndex > 0) {
|
|
106237
|
+
const key = record3.slice(0, equalsIndex);
|
|
106238
|
+
const rawValue = record3.slice(equalsIndex + 1);
|
|
106239
|
+
const value = rawValue.endsWith(`
|
|
106240
|
+
`) ? rawValue.slice(0, -1) : rawValue;
|
|
106241
|
+
attributes[key] = value;
|
|
106242
|
+
}
|
|
106243
|
+
offset += recordLength;
|
|
106244
|
+
}
|
|
106245
|
+
return attributes;
|
|
106246
|
+
}
|
|
106247
|
+
function stripNpmPackageRoot(entryName) {
|
|
106248
|
+
const normalized = entryName.replaceAll("\\", "/");
|
|
106249
|
+
if (normalized === "package" || normalized === "package/")
|
|
106250
|
+
return "";
|
|
106251
|
+
if (!normalized.startsWith("package/")) {
|
|
106252
|
+
throw new Error(`Unexpected tarball root entry: ${entryName}`);
|
|
106253
|
+
}
|
|
106254
|
+
return normalized.slice("package/".length);
|
|
106255
|
+
}
|
|
106256
|
+
function resolveTarEntryPath(fs7, destinationDir, entryName) {
|
|
106257
|
+
if (entryName.includes("\x00")) {
|
|
106258
|
+
throw new Error(`Invalid tar entry path: ${entryName}`);
|
|
106259
|
+
}
|
|
106260
|
+
if (entryName.startsWith("/")) {
|
|
106261
|
+
throw new Error(`Unsafe absolute tar entry path: ${entryName}`);
|
|
106262
|
+
}
|
|
106263
|
+
const root = fs7.path.resolve(destinationDir);
|
|
106264
|
+
const target = fs7.path.resolve(root, entryName);
|
|
106265
|
+
const relative2 = fs7.path.relative(root, target);
|
|
106266
|
+
if (relative2.startsWith("..") || fs7.path.isAbsolute(relative2)) {
|
|
106267
|
+
throw new Error(`Unsafe tar entry path: ${entryName}`);
|
|
106268
|
+
}
|
|
106269
|
+
return target;
|
|
106270
|
+
}
|
|
106271
|
+
function readNullTerminatedUtf8(data) {
|
|
106272
|
+
const nullIndex = data.indexOf(0);
|
|
106273
|
+
const end = nullIndex >= 0 ? nullIndex : data.length;
|
|
106274
|
+
return Buffer.from(data.subarray(0, end)).toString("utf-8");
|
|
106275
|
+
}
|
|
106276
|
+
function readTarEntry(tarData, headerOffset) {
|
|
106277
|
+
const typeFlag = String.fromCodePoint(tarData[headerOffset + 156] || 0);
|
|
106278
|
+
const size = readTarOctal(tarData, headerOffset + 124, 12);
|
|
106279
|
+
const dataOffset = headerOffset + TAR_BLOCK_SIZE;
|
|
106280
|
+
const dataEnd = dataOffset + size;
|
|
106281
|
+
if (dataEnd > tarData.length) {
|
|
106282
|
+
throw new Error("Invalid tarball: entry extends past archive end");
|
|
106283
|
+
}
|
|
106284
|
+
const padding = (TAR_BLOCK_SIZE - size % TAR_BLOCK_SIZE) % TAR_BLOCK_SIZE;
|
|
106285
|
+
return {
|
|
106286
|
+
typeFlag,
|
|
106287
|
+
headerPath: readTarPath(tarData, headerOffset),
|
|
106288
|
+
entryData: tarData.subarray(dataOffset, dataEnd),
|
|
106289
|
+
nextOffset: dataEnd + padding
|
|
106290
|
+
};
|
|
106291
|
+
}
|
|
106292
|
+
function readTarPathOverride(typeFlag, entryData) {
|
|
106293
|
+
if (typeFlag === "x")
|
|
106294
|
+
return parsePaxAttributes(entryData).path;
|
|
106295
|
+
if (typeFlag === "L")
|
|
106296
|
+
return readNullTerminatedUtf8(entryData);
|
|
106297
|
+
return;
|
|
106298
|
+
}
|
|
106299
|
+
function isTarPathOverrideEntry(typeFlag) {
|
|
106300
|
+
return typeFlag === "x" || typeFlag === "L";
|
|
106301
|
+
}
|
|
106302
|
+
function isTarDirectoryEntry(typeFlag, entryName) {
|
|
106303
|
+
return typeFlag === "5" || entryName.endsWith("/");
|
|
106304
|
+
}
|
|
106305
|
+
function isTarRegularFileEntry(typeFlag) {
|
|
106306
|
+
return typeFlag === "0" || typeFlag === "\x00";
|
|
106307
|
+
}
|
|
106308
|
+
async function extractTarEntry2(fs7, destinationDir, entryName, entry) {
|
|
106309
|
+
if (isTarDirectoryEntry(entry.typeFlag, entryName)) {
|
|
106310
|
+
await fs7.mkdir(resolveTarEntryPath(fs7, destinationDir, entryName));
|
|
106311
|
+
return;
|
|
106312
|
+
}
|
|
106313
|
+
if (!isTarRegularFileEntry(entry.typeFlag)) {
|
|
106314
|
+
logger.debug(`Skipping unsupported tar entry type '${entry.typeFlag}' for ${entryName}`);
|
|
106315
|
+
return;
|
|
106316
|
+
}
|
|
106317
|
+
const target = resolveTarEntryPath(fs7, destinationDir, entryName);
|
|
106318
|
+
await fs7.writeFile(target, entry.entryData);
|
|
106319
|
+
}
|
|
106320
|
+
async function extractNpmTarballToDir(tarData, destinationDir) {
|
|
106321
|
+
const fs7 = getFileSystem();
|
|
106322
|
+
await fs7.mkdir(destinationDir);
|
|
106323
|
+
let offset = 0;
|
|
106324
|
+
let nextPath;
|
|
106325
|
+
while (offset + TAR_BLOCK_SIZE <= tarData.length) {
|
|
106326
|
+
if (isZeroBlock(tarData, offset))
|
|
106327
|
+
break;
|
|
106328
|
+
const entry = readTarEntry(tarData, offset);
|
|
106329
|
+
offset = entry.nextOffset;
|
|
106330
|
+
if (isTarPathOverrideEntry(entry.typeFlag)) {
|
|
106331
|
+
nextPath = readTarPathOverride(entry.typeFlag, entry.entryData);
|
|
106332
|
+
continue;
|
|
105340
106333
|
}
|
|
105341
|
-
|
|
105342
|
-
|
|
105343
|
-
const entries = await fs7.readdir(nestedDir);
|
|
105344
|
-
for (const entry of entries) {
|
|
105345
|
-
await fs7.rename(fs7.path.join(nestedDir, entry), fs7.path.join(storePath, entry));
|
|
105346
|
-
}
|
|
105347
|
-
await fs7.rm(nestedDir);
|
|
106334
|
+
if (entry.typeFlag === "g") {
|
|
106335
|
+
continue;
|
|
105348
106336
|
}
|
|
105349
|
-
|
|
105350
|
-
|
|
106337
|
+
const rawPath = nextPath ?? entry.headerPath;
|
|
106338
|
+
nextPath = undefined;
|
|
106339
|
+
const entryName = stripNpmPackageRoot(rawPath);
|
|
106340
|
+
if (!entryName)
|
|
106341
|
+
continue;
|
|
106342
|
+
await extractTarEntry2(fs7, destinationDir, entryName, entry);
|
|
105351
106343
|
}
|
|
105352
106344
|
}
|
|
105353
|
-
var
|
|
106345
|
+
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org", SKILLS_GITHUB_REGISTRY_URL = "https://npm.pkg.github.com/", REPO_URL = "https://www.npmjs.com/package/@uipath/skills", SOURCE_MARKER_NAME = ".uipath-skills-source.json", STORE_NAME, TAR_BLOCK_SIZE = 512, NPM_VIEW_TIMEOUT_MS2 = 30000, NPM_PACK_TIMEOUT_MS = 60000, SHELL_SAFE_ARG2, SHELL_SAFE_COMMAND_LINE2, childProcessModulePromise2, MANIFEST_NAME = "manifest.json";
|
|
105354
106346
|
var init_contentStore = __esm(() => {
|
|
105355
106347
|
init_src2();
|
|
105356
106348
|
init_src();
|
|
105357
106349
|
init_js_yaml();
|
|
106350
|
+
init_package();
|
|
105358
106351
|
STORE_NAME = `${UIPATH_HOME_DIR}/.skills`;
|
|
106352
|
+
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._-]+$/;
|
|
106353
|
+
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._\- ]+$/;
|
|
105359
106354
|
});
|
|
105360
106355
|
|
|
105361
106356
|
// src/commands/skills/agents/claude.ts
|
|
@@ -105453,11 +106448,13 @@ var init_claude = __esm(() => {
|
|
|
105453
106448
|
init_src2();
|
|
105454
106449
|
init_src();
|
|
105455
106450
|
init_contentStore();
|
|
106451
|
+
init_detect();
|
|
105456
106452
|
PLUGIN_REF = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
|
|
105457
106453
|
def2 = {
|
|
105458
106454
|
localSubdir: [".claude", "skills"],
|
|
105459
106455
|
globalOnly: true,
|
|
105460
106456
|
destinationHint: () => "installed via `claude plugin install`",
|
|
106457
|
+
detect: () => verifiedCommandOnPath(["claude"], /Claude Code/i),
|
|
105461
106458
|
install: async ({ storePath, rootDir }) => {
|
|
105462
106459
|
await removeLegacySkillCopies(storePath, rootDir);
|
|
105463
106460
|
await runClaude(["plugin", "marketplace", "add", MARKETPLACE_SOURCE]);
|
|
@@ -105483,48 +106480,68 @@ var init_claude = __esm(() => {
|
|
|
105483
106480
|
// src/commands/skills/agents/codex.ts
|
|
105484
106481
|
var def3;
|
|
105485
106482
|
var init_codex = __esm(() => {
|
|
106483
|
+
init_detect();
|
|
105486
106484
|
def3 = {
|
|
105487
|
-
localSubdir: [".agents", "skills"]
|
|
106485
|
+
localSubdir: [".agents", "skills"],
|
|
106486
|
+
detect: () => verifiedCommandOnPath(["codex"], /codex[- ]?cli/i)
|
|
105488
106487
|
};
|
|
105489
106488
|
});
|
|
105490
106489
|
|
|
105491
106490
|
// src/commands/skills/agents/copilot.ts
|
|
105492
106491
|
var def4;
|
|
105493
106492
|
var init_copilot = __esm(() => {
|
|
106493
|
+
init_detect();
|
|
105494
106494
|
def4 = {
|
|
105495
|
-
localSubdir: [".github", "skills"]
|
|
106495
|
+
localSubdir: [".github", "skills"],
|
|
106496
|
+
detect: () => verifiedCommandOnPath(["copilot"], /GitHub Copilot/i)
|
|
105496
106497
|
};
|
|
105497
106498
|
});
|
|
105498
106499
|
|
|
105499
106500
|
// src/commands/skills/agents/cursor.ts
|
|
105500
106501
|
var def5;
|
|
105501
106502
|
var init_cursor = __esm(() => {
|
|
106503
|
+
init_detect();
|
|
105502
106504
|
def5 = {
|
|
105503
|
-
localSubdir: [".cursor", "skills"]
|
|
106505
|
+
localSubdir: [".cursor", "skills"],
|
|
106506
|
+
detect: () => verifiedCommandOnPath(["cursor-agent", "agent"], /cursor/i, ["--help"])
|
|
105504
106507
|
};
|
|
105505
106508
|
});
|
|
105506
106509
|
|
|
105507
106510
|
// src/commands/skills/agents/gemini.ts
|
|
105508
106511
|
var def6;
|
|
105509
106512
|
var init_gemini = __esm(() => {
|
|
106513
|
+
init_detect();
|
|
105510
106514
|
def6 = {
|
|
105511
|
-
localSubdir: [".gemini", "skills"]
|
|
106515
|
+
localSubdir: [".gemini", "skills"],
|
|
106516
|
+
detect: () => verifiedCommandOnPath(["gemini"], /Gemini CLI/i, ["--help"])
|
|
105512
106517
|
};
|
|
105513
106518
|
});
|
|
105514
106519
|
|
|
105515
|
-
// src/commands/skills/agents/
|
|
106520
|
+
// src/commands/skills/agents/kiro.ts
|
|
105516
106521
|
var def7;
|
|
105517
|
-
var
|
|
106522
|
+
var init_kiro = __esm(() => {
|
|
106523
|
+
init_detect();
|
|
105518
106524
|
def7 = {
|
|
106525
|
+
localSubdir: [".kiro", "skills"],
|
|
106526
|
+
detect: () => homePathExists(".kiro")
|
|
106527
|
+
};
|
|
106528
|
+
});
|
|
106529
|
+
|
|
106530
|
+
// src/commands/skills/agents/opencode.ts
|
|
106531
|
+
var def8;
|
|
106532
|
+
var init_opencode = __esm(() => {
|
|
106533
|
+
init_detect();
|
|
106534
|
+
def8 = {
|
|
105519
106535
|
localSubdir: [".opencode", "skills"],
|
|
105520
|
-
globalSubdir: [".config", "opencode", "skills"]
|
|
106536
|
+
globalSubdir: [".config", "opencode", "skills"],
|
|
106537
|
+
detect: () => verifiedCommandOnPath(["opencode"], /opencode/i, ["--help"])
|
|
105521
106538
|
};
|
|
105522
106539
|
});
|
|
105523
106540
|
|
|
105524
106541
|
// src/commands/skills/agents/index.ts
|
|
105525
106542
|
function subdirFor(agent, isLocal) {
|
|
105526
|
-
const
|
|
105527
|
-
return isLocal ?
|
|
106543
|
+
const def9 = AGENT_DEFS[agent];
|
|
106544
|
+
return isLocal ? def9.localSubdir : def9.globalSubdir ?? def9.localSubdir;
|
|
105528
106545
|
}
|
|
105529
106546
|
function getSkillsDir(agent, rootDir, isLocal) {
|
|
105530
106547
|
const fs7 = getFileSystem();
|
|
@@ -105575,6 +106592,7 @@ var init_agents = __esm(() => {
|
|
|
105575
106592
|
init_copilot();
|
|
105576
106593
|
init_cursor();
|
|
105577
106594
|
init_gemini();
|
|
106595
|
+
init_kiro();
|
|
105578
106596
|
init_opencode();
|
|
105579
106597
|
AGENT_DEFS = {
|
|
105580
106598
|
claude: def2,
|
|
@@ -105582,13 +106600,14 @@ var init_agents = __esm(() => {
|
|
|
105582
106600
|
copilot: def4,
|
|
105583
106601
|
gemini: def6,
|
|
105584
106602
|
codex: def3,
|
|
105585
|
-
opencode:
|
|
105586
|
-
autopilot: def
|
|
106603
|
+
opencode: def8,
|
|
106604
|
+
autopilot: def,
|
|
106605
|
+
kiro: def7
|
|
105587
106606
|
};
|
|
105588
106607
|
});
|
|
105589
106608
|
|
|
105590
106609
|
// src/commands/skills/skillCatalog.ts
|
|
105591
|
-
function
|
|
106610
|
+
function asRecord2(value) {
|
|
105592
106611
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
105593
106612
|
return;
|
|
105594
106613
|
}
|
|
@@ -105628,7 +106647,7 @@ async function readSkillMetadata(skill) {
|
|
|
105628
106647
|
} : parseSkillMd(content);
|
|
105629
106648
|
const name = typeof parsed.meta.name === "string" && parsed.meta.name.trim() ? parsed.meta.name.trim() : skill.name;
|
|
105630
106649
|
const description = typeof parsed.meta.description === "string" ? parsed.meta.description.trim() : skill.description ?? "";
|
|
105631
|
-
const metadata =
|
|
106650
|
+
const metadata = asRecord2(parsed.meta.metadata);
|
|
105632
106651
|
return {
|
|
105633
106652
|
name,
|
|
105634
106653
|
description,
|
|
@@ -105885,7 +106904,7 @@ async function loadCatalogOrReport(options) {
|
|
|
105885
106904
|
OutputFormatter.error({
|
|
105886
106905
|
Result: RESULTS.Failure,
|
|
105887
106906
|
Message: `Failed to load skills catalog: ${error51.message}`,
|
|
105888
|
-
Instructions: "Check network connectivity and try again. Ensure
|
|
106907
|
+
Instructions: "Check network connectivity and try again. Ensure the @uipath/skills package is available from the configured npm registry."
|
|
105889
106908
|
});
|
|
105890
106909
|
processContext.exit(1);
|
|
105891
106910
|
return null;
|
|
@@ -106054,7 +107073,8 @@ var init_prompt = __esm(() => {
|
|
|
106054
107073
|
"gemini",
|
|
106055
107074
|
"codex",
|
|
106056
107075
|
"opencode",
|
|
106057
|
-
"autopilot"
|
|
107076
|
+
"autopilot",
|
|
107077
|
+
"kiro"
|
|
106058
107078
|
];
|
|
106059
107079
|
AGENT_DISPLAY_NAMES = {
|
|
106060
107080
|
claude: "Claude Code (Plugin)",
|
|
@@ -106063,7 +107083,8 @@ var init_prompt = __esm(() => {
|
|
|
106063
107083
|
gemini: "Gemini CLI",
|
|
106064
107084
|
codex: "Codex",
|
|
106065
107085
|
opencode: "OpenCode",
|
|
106066
|
-
autopilot: "UiPath Autopilot"
|
|
107086
|
+
autopilot: "UiPath Autopilot",
|
|
107087
|
+
kiro: "Kiro (Amazon Q)"
|
|
106067
107088
|
};
|
|
106068
107089
|
});
|
|
106069
107090
|
|
|
@@ -106086,7 +107107,7 @@ async function resolveSkillsContext(options, operation) {
|
|
|
106086
107107
|
OutputFormatter.error({
|
|
106087
107108
|
Result: RESULTS.ConfigError,
|
|
106088
107109
|
Message: "No skills found in content store.",
|
|
106089
|
-
Instructions: "Check that the skills
|
|
107110
|
+
Instructions: "Check that the @uipath/skills package contains skills in the skills/ directory."
|
|
106090
107111
|
});
|
|
106091
107112
|
return null;
|
|
106092
107113
|
}
|
|
@@ -106105,17 +107126,42 @@ async function resolveSkillsContext(options, operation) {
|
|
|
106105
107126
|
return null;
|
|
106106
107127
|
agents = [agent];
|
|
106107
107128
|
} else {
|
|
106108
|
-
const
|
|
106109
|
-
if (
|
|
106110
|
-
|
|
106111
|
-
|
|
107129
|
+
const detected = await detectInstalledAgents(isLocal);
|
|
107130
|
+
if (detected.length > 0) {
|
|
107131
|
+
logger.info(`Detected installed agents: ${detected.join(", ")}. ` + "Installing skills for all of them. Pass --agent to target one.");
|
|
107132
|
+
agents = detected;
|
|
107133
|
+
} else if (!canPrompt()) {
|
|
107134
|
+
OutputFormatter.error({
|
|
107135
|
+
Result: RESULTS.Failure,
|
|
107136
|
+
Message: "No agents detected and prompting is disabled.",
|
|
107137
|
+
Instructions: `No supported agent was found on PATH. Pass --agent <agent> (one of: ${ALL_AGENTS.join(", ")}), or re-run with --interactive to select.`
|
|
107138
|
+
});
|
|
107139
|
+
processContext.exit(1);
|
|
107140
|
+
return null;
|
|
107141
|
+
} else {
|
|
107142
|
+
const [agentErr, selected] = await catchError(promptAgentSelection(operation, isLocal));
|
|
107143
|
+
if (agentErr)
|
|
107144
|
+
handlePromptCancellation(agentErr, operation);
|
|
107145
|
+
agents = selected;
|
|
107146
|
+
}
|
|
106112
107147
|
}
|
|
106113
107148
|
return { rootDir, storePath, selectedSkills, agents, isLocal };
|
|
106114
107149
|
}
|
|
107150
|
+
async function detectInstalledAgents(isLocal) {
|
|
107151
|
+
const candidates = ALL_AGENTS.filter((a) => !(isLocal && AGENT_DEFS[a].globalOnly));
|
|
107152
|
+
const results = await Promise.all(candidates.map(async (a) => {
|
|
107153
|
+
const detect = AGENT_DEFS[a].detect;
|
|
107154
|
+
if (!detect)
|
|
107155
|
+
return null;
|
|
107156
|
+
const [, found] = await catchError(detect());
|
|
107157
|
+
return found ? a : null;
|
|
107158
|
+
}));
|
|
107159
|
+
return results.filter((a) => a !== null);
|
|
107160
|
+
}
|
|
106115
107161
|
async function runOneAgent(agent, operation, resolved) {
|
|
106116
107162
|
const { rootDir, storePath, selectedSkills, isLocal } = resolved;
|
|
106117
|
-
const
|
|
106118
|
-
const customHook = operation === "update" ?
|
|
107163
|
+
const def9 = AGENT_DEFS[agent];
|
|
107164
|
+
const customHook = operation === "update" ? def9.update ?? def9.install : def9.install;
|
|
106119
107165
|
if (customHook) {
|
|
106120
107166
|
const [installError] = await catchError(customHook({ skills: selectedSkills, rootDir, storePath, isLocal }));
|
|
106121
107167
|
if (installError) {
|
|
@@ -106219,7 +107265,7 @@ var init_skillsService = __esm(() => {
|
|
|
106219
107265
|
|
|
106220
107266
|
// src/commands/skills/install.ts
|
|
106221
107267
|
function registerInstallCommand(skillsCommand) {
|
|
106222
|
-
skillsCommand.command("install").description("Download skills from
|
|
107268
|
+
skillsCommand.command("install").description("Download UiPath skills from the configured npm registry and install them for your coding agents.").option("--agent <agent>", `Target agent: ${ALL_AGENTS.join(", ")}`).option("--local", "Install to current project instead of globally").examples(SKILLS_INSTALL_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
106223
107269
|
const [contextError, resolved] = await catchError(resolveSkillsContext(options, "install"));
|
|
106224
107270
|
if (contextError || !resolved) {
|
|
106225
107271
|
if (contextError) {
|
|
@@ -106230,7 +107276,7 @@ function registerInstallCommand(skillsCommand) {
|
|
|
106230
107276
|
OutputFormatter.error({
|
|
106231
107277
|
Result: RESULTS.Failure,
|
|
106232
107278
|
Message: `Failed to install skills: ${contextError.message}`,
|
|
106233
|
-
Instructions: "Check network connectivity and try again. Ensure
|
|
107279
|
+
Instructions: "Check network connectivity and try again. Ensure the @uipath/skills package is available from the configured npm registry."
|
|
106234
107280
|
});
|
|
106235
107281
|
}
|
|
106236
107282
|
return;
|
|
@@ -106280,103 +107326,129 @@ var init_install2 = __esm(() => {
|
|
|
106280
107326
|
});
|
|
106281
107327
|
|
|
106282
107328
|
// src/commands/skills/uninstall.ts
|
|
107329
|
+
async function resolveAgents(options, isLocal) {
|
|
107330
|
+
if (options.agent) {
|
|
107331
|
+
const agent = options.agent.trim().toLowerCase();
|
|
107332
|
+
if (!ALL_AGENTS.includes(agent)) {
|
|
107333
|
+
OutputFormatter.error({
|
|
107334
|
+
Result: RESULTS.ValidationError,
|
|
107335
|
+
Message: `Unknown agent: ${agent}`,
|
|
107336
|
+
Instructions: `Available agents: ${ALL_AGENTS.join(", ")}`
|
|
107337
|
+
});
|
|
107338
|
+
return HANDLED;
|
|
107339
|
+
}
|
|
107340
|
+
if (rejectIfGlobalOnly(agent, isLocal, "uninstall"))
|
|
107341
|
+
return HANDLED;
|
|
107342
|
+
return [agent];
|
|
107343
|
+
}
|
|
107344
|
+
if (!canPrompt()) {
|
|
107345
|
+
OutputFormatter.error({
|
|
107346
|
+
Result: RESULTS.Failure,
|
|
107347
|
+
Message: "No agent specified and prompting is disabled.",
|
|
107348
|
+
Instructions: `Pass --agent <agent> (one of: ${ALL_AGENTS.join(", ")}), or re-run with --interactive to select.`
|
|
107349
|
+
});
|
|
107350
|
+
processContext.exit(1);
|
|
107351
|
+
return HANDLED;
|
|
107352
|
+
}
|
|
107353
|
+
const [agentErr, selected] = await catchError(promptAgentSelection("uninstall", isLocal));
|
|
107354
|
+
if (agentErr) {
|
|
107355
|
+
if (agentErr instanceof Error && agentErr.name === "ExitPromptError") {
|
|
107356
|
+
processContext.exit(130);
|
|
107357
|
+
return HANDLED;
|
|
107358
|
+
}
|
|
107359
|
+
throw agentErr;
|
|
107360
|
+
}
|
|
107361
|
+
return selected;
|
|
107362
|
+
}
|
|
107363
|
+
async function readSkillNames(storePath) {
|
|
107364
|
+
const [manifestErr, manifest] = await catchError(readManifest(storePath));
|
|
107365
|
+
if (manifestErr || !manifest) {
|
|
107366
|
+
OutputFormatter.error({
|
|
107367
|
+
Result: RESULTS.ConfigError,
|
|
107368
|
+
Message: `Failed to read manifest: ${manifestErr?.message ?? "unknown error"}`,
|
|
107369
|
+
Instructions: "The manifest file may be missing or corrupted. Try reinstalling with 'uipath skills install'."
|
|
107370
|
+
});
|
|
107371
|
+
return HANDLED;
|
|
107372
|
+
}
|
|
107373
|
+
const skillNames = Object.keys(manifest.skills);
|
|
107374
|
+
if (skillNames.length === 0) {
|
|
107375
|
+
OutputFormatter.error({
|
|
107376
|
+
Result: RESULTS.ConfigError,
|
|
107377
|
+
Message: "No skills found to uninstall.",
|
|
107378
|
+
Instructions: "No skills are currently installed. Use 'uipath skills install' to install them first."
|
|
107379
|
+
});
|
|
107380
|
+
return HANDLED;
|
|
107381
|
+
}
|
|
107382
|
+
return skillNames;
|
|
107383
|
+
}
|
|
107384
|
+
async function uninstallForAgent(targetAgent, ctx, uninstalled) {
|
|
107385
|
+
const { skillNames, rootDir, storePath, isLocal } = ctx;
|
|
107386
|
+
const def9 = AGENT_DEFS[targetAgent];
|
|
107387
|
+
if (def9.uninstall) {
|
|
107388
|
+
const [err] = await catchError(def9.uninstall({ skillNames, rootDir, storePath, isLocal }));
|
|
107389
|
+
if (err) {
|
|
107390
|
+
OutputFormatter.error({
|
|
107391
|
+
Result: RESULTS.Failure,
|
|
107392
|
+
Message: `Failed to uninstall skills for ${targetAgent}: ${err.message}`,
|
|
107393
|
+
Instructions: "Check that the agent's CLI is installed and on PATH, and that you have permission to modify its configuration."
|
|
107394
|
+
});
|
|
107395
|
+
processContext.exit(1);
|
|
107396
|
+
return HANDLED;
|
|
107397
|
+
}
|
|
107398
|
+
for (const name of skillNames) {
|
|
107399
|
+
uninstalled.push(`${targetAgent}:${name}`);
|
|
107400
|
+
}
|
|
107401
|
+
return;
|
|
107402
|
+
}
|
|
107403
|
+
const skillsDir = getSkillsDir(targetAgent, rootDir, isLocal);
|
|
107404
|
+
for (const name of skillNames) {
|
|
107405
|
+
const [uninstallError] = await catchError(uninstallSkill(name, skillsDir));
|
|
107406
|
+
if (uninstallError) {
|
|
107407
|
+
OutputFormatter.error({
|
|
107408
|
+
Result: RESULTS.Failure,
|
|
107409
|
+
Message: `Failed to uninstall ${name} for ${targetAgent}: ${uninstallError.message}`,
|
|
107410
|
+
Instructions: "Check that the skill files exist and you have write permissions."
|
|
107411
|
+
});
|
|
107412
|
+
return HANDLED;
|
|
107413
|
+
}
|
|
107414
|
+
uninstalled.push(`${targetAgent}:${name}`);
|
|
107415
|
+
}
|
|
107416
|
+
const [catalogError] = await catchError(removeSkillCatalog(skillsDir));
|
|
107417
|
+
if (catalogError) {
|
|
107418
|
+
OutputFormatter.error({
|
|
107419
|
+
Result: RESULTS.Failure,
|
|
107420
|
+
Message: `Failed to remove skill catalog for ${targetAgent}: ${catalogError.message}`,
|
|
107421
|
+
Instructions: "Check that the skill destination is writable and try again."
|
|
107422
|
+
});
|
|
107423
|
+
processContext.exit(1);
|
|
107424
|
+
return HANDLED;
|
|
107425
|
+
}
|
|
107426
|
+
return;
|
|
107427
|
+
}
|
|
106283
107428
|
function registerUninstallCommand(skillsCommand) {
|
|
106284
107429
|
skillsCommand.command("uninstall").description("Remove previously installed skills from agent configurations.").option("--agent <agent>", `Target agent: ${ALL_AGENTS.join(", ")}`).option("--local", "Uninstall from current project instead of globally").examples(SKILLS_UNINSTALL_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
106285
107430
|
const isLocal = !!options.local;
|
|
106286
107431
|
const fs7 = getFileSystem();
|
|
106287
107432
|
const rootDir = isLocal ? fs7.env.cwd() : fs7.env.homedir();
|
|
106288
107433
|
const storePath = fs7.path.join(rootDir, STORE_NAME);
|
|
106289
|
-
|
|
106290
|
-
if (
|
|
106291
|
-
const agent = options.agent.trim().toLowerCase();
|
|
106292
|
-
if (!ALL_AGENTS.includes(agent)) {
|
|
106293
|
-
OutputFormatter.error({
|
|
106294
|
-
Result: RESULTS.ValidationError,
|
|
106295
|
-
Message: `Unknown agent: ${agent}`,
|
|
106296
|
-
Instructions: `Available agents: ${ALL_AGENTS.join(", ")}`
|
|
106297
|
-
});
|
|
106298
|
-
return;
|
|
106299
|
-
}
|
|
106300
|
-
if (rejectIfGlobalOnly(agent, isLocal, "uninstall"))
|
|
106301
|
-
return;
|
|
106302
|
-
agents = [agent];
|
|
106303
|
-
} else {
|
|
106304
|
-
const [agentErr, selected] = await catchError(promptAgentSelection("uninstall", isLocal));
|
|
106305
|
-
if (agentErr) {
|
|
106306
|
-
if (agentErr instanceof Error && agentErr.name === "ExitPromptError") {
|
|
106307
|
-
processContext.exit(130);
|
|
106308
|
-
return;
|
|
106309
|
-
}
|
|
106310
|
-
throw agentErr;
|
|
106311
|
-
}
|
|
106312
|
-
agents = selected;
|
|
106313
|
-
}
|
|
106314
|
-
const [manifestErr, manifest] = await catchError(readManifest(storePath));
|
|
106315
|
-
if (manifestErr || !manifest) {
|
|
106316
|
-
OutputFormatter.error({
|
|
106317
|
-
Result: RESULTS.ConfigError,
|
|
106318
|
-
Message: `Failed to read manifest: ${manifestErr?.message ?? "unknown error"}`,
|
|
106319
|
-
Instructions: "The manifest file may be missing or corrupted. Try reinstalling with 'uipath skills install'."
|
|
106320
|
-
});
|
|
107434
|
+
const agents = await resolveAgents(options, isLocal);
|
|
107435
|
+
if (agents === HANDLED)
|
|
106321
107436
|
return;
|
|
106322
|
-
|
|
106323
|
-
|
|
106324
|
-
if (skillNames.length === 0) {
|
|
106325
|
-
OutputFormatter.error({
|
|
106326
|
-
Result: RESULTS.ConfigError,
|
|
106327
|
-
Message: "No skills found to uninstall.",
|
|
106328
|
-
Instructions: "No skills are currently installed. Use 'uipath skills install' to install them first."
|
|
106329
|
-
});
|
|
107437
|
+
const skillNames = await readSkillNames(storePath);
|
|
107438
|
+
if (skillNames === HANDLED)
|
|
106330
107439
|
return;
|
|
106331
|
-
}
|
|
106332
107440
|
logger.info(`Uninstalling ${skillNames.length} skill(s) for ${agents.join(", ")}`);
|
|
106333
107441
|
const uninstalled = [];
|
|
107442
|
+
const ctx = {
|
|
107443
|
+
skillNames,
|
|
107444
|
+
rootDir,
|
|
107445
|
+
storePath,
|
|
107446
|
+
isLocal
|
|
107447
|
+
};
|
|
106334
107448
|
for (const targetAgent of agents) {
|
|
106335
|
-
const
|
|
106336
|
-
if (
|
|
106337
|
-
const [err] = await catchError(def8.uninstall({
|
|
106338
|
-
skillNames,
|
|
106339
|
-
rootDir,
|
|
106340
|
-
storePath,
|
|
106341
|
-
isLocal
|
|
106342
|
-
}));
|
|
106343
|
-
if (err) {
|
|
106344
|
-
OutputFormatter.error({
|
|
106345
|
-
Result: RESULTS.Failure,
|
|
106346
|
-
Message: `Failed to uninstall skills for ${targetAgent}: ${err.message}`,
|
|
106347
|
-
Instructions: "Check that the agent's CLI is installed and on PATH, and that you have permission to modify its configuration."
|
|
106348
|
-
});
|
|
106349
|
-
processContext.exit(1);
|
|
106350
|
-
return;
|
|
106351
|
-
}
|
|
106352
|
-
for (const name of skillNames) {
|
|
106353
|
-
uninstalled.push(`${targetAgent}:${name}`);
|
|
106354
|
-
}
|
|
106355
|
-
continue;
|
|
106356
|
-
}
|
|
106357
|
-
const skillsDir = getSkillsDir(targetAgent, rootDir, isLocal);
|
|
106358
|
-
for (const name of skillNames) {
|
|
106359
|
-
const [uninstallError] = await catchError(uninstallSkill(name, skillsDir));
|
|
106360
|
-
if (uninstallError) {
|
|
106361
|
-
OutputFormatter.error({
|
|
106362
|
-
Result: RESULTS.Failure,
|
|
106363
|
-
Message: `Failed to uninstall ${name} for ${targetAgent}: ${uninstallError.message}`,
|
|
106364
|
-
Instructions: "Check that the skill files exist and you have write permissions."
|
|
106365
|
-
});
|
|
106366
|
-
return;
|
|
106367
|
-
}
|
|
106368
|
-
uninstalled.push(`${targetAgent}:${name}`);
|
|
106369
|
-
}
|
|
106370
|
-
const [catalogError] = await catchError(removeSkillCatalog(skillsDir));
|
|
106371
|
-
if (catalogError) {
|
|
106372
|
-
OutputFormatter.error({
|
|
106373
|
-
Result: RESULTS.Failure,
|
|
106374
|
-
Message: `Failed to remove skill catalog for ${targetAgent}: ${catalogError.message}`,
|
|
106375
|
-
Instructions: "Check that the skill destination is writable and try again."
|
|
106376
|
-
});
|
|
106377
|
-
processContext.exit(1);
|
|
107449
|
+
const result = await uninstallForAgent(targetAgent, ctx, uninstalled);
|
|
107450
|
+
if (result === HANDLED)
|
|
106378
107451
|
return;
|
|
106379
|
-
}
|
|
106380
107452
|
}
|
|
106381
107453
|
const [manifestUpdateErr] = await catchError(removeFromManifest(storePath, skillNames, agents));
|
|
106382
107454
|
if (manifestUpdateErr) {
|
|
@@ -106399,7 +107471,7 @@ function registerUninstallCommand(skillsCommand) {
|
|
|
106399
107471
|
});
|
|
106400
107472
|
});
|
|
106401
107473
|
}
|
|
106402
|
-
var SKILLS_UNINSTALL_EXAMPLES;
|
|
107474
|
+
var SKILLS_UNINSTALL_EXAMPLES, HANDLED;
|
|
106403
107475
|
var init_uninstall = __esm(() => {
|
|
106404
107476
|
init_src2();
|
|
106405
107477
|
init_src();
|
|
@@ -106422,10 +107494,11 @@ var init_uninstall = __esm(() => {
|
|
|
106422
107494
|
}
|
|
106423
107495
|
}
|
|
106424
107496
|
];
|
|
107497
|
+
HANDLED = Symbol("handled");
|
|
106425
107498
|
});
|
|
106426
107499
|
|
|
106427
107500
|
// src/services/updateService.skills.ts
|
|
106428
|
-
import { randomUUID as
|
|
107501
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
106429
107502
|
async function runSkillsUpdate(opts) {
|
|
106430
107503
|
const fs7 = getFileSystem();
|
|
106431
107504
|
if (opts.agent !== undefined) {
|
|
@@ -106479,7 +107552,7 @@ async function runSkillsUpdate(opts) {
|
|
|
106479
107552
|
error: {
|
|
106480
107553
|
result: skillsErr?.result ?? "Failure",
|
|
106481
107554
|
message: sectionErr.message,
|
|
106482
|
-
instructions: skillsErr?.instructions ?? "Check network connectivity and try again. Ensure
|
|
107555
|
+
instructions: skillsErr?.instructions ?? "Check network connectivity and try again. Ensure the @uipath/skills package is available from the configured npm registry."
|
|
106483
107556
|
}
|
|
106484
107557
|
});
|
|
106485
107558
|
continue;
|
|
@@ -106516,7 +107589,7 @@ async function updateOneSection(opts, candidate) {
|
|
|
106516
107589
|
}
|
|
106517
107590
|
}
|
|
106518
107591
|
if (opts.dryRun) {
|
|
106519
|
-
const tmpRoot = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-dryrun-${
|
|
107592
|
+
const tmpRoot = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-dryrun-${randomUUID6()}`);
|
|
106520
107593
|
try {
|
|
106521
107594
|
await fs7.mkdir(tmpRoot);
|
|
106522
107595
|
const tmpStore = fs7.path.join(tmpRoot, "store");
|
|
@@ -106570,7 +107643,7 @@ var init_updateService_skills = __esm(() => {
|
|
|
106570
107643
|
|
|
106571
107644
|
// src/commands/skills/update.ts
|
|
106572
107645
|
function registerUpdateCommand(skillsCommand) {
|
|
106573
|
-
skillsCommand.command("update").description("Re-fetch skills from
|
|
107646
|
+
skillsCommand.command("update").description("Re-fetch UiPath skills from the configured npm registry and reinstall the latest patch matching this CLI version line.").option("--agent <agent>", `Target agent: ${ALL_AGENTS.join(", ")}`).option("--local", "Update in current project instead of globally").examples(SKILLS_UPDATE_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
106574
107647
|
const local = options.local === true;
|
|
106575
107648
|
const [err, report] = await catchError(runSkillsUpdate({
|
|
106576
107649
|
dryRun: false,
|
|
@@ -106581,7 +107654,7 @@ function registerUpdateCommand(skillsCommand) {
|
|
|
106581
107654
|
OutputFormatter.error({
|
|
106582
107655
|
Result: RESULTS.Failure,
|
|
106583
107656
|
Message: `Failed to update skills: ${err.message}`,
|
|
106584
|
-
Instructions: "Check network connectivity and try again. Ensure
|
|
107657
|
+
Instructions: "Check network connectivity and try again. Ensure the @uipath/skills package is available from the configured npm registry."
|
|
106585
107658
|
});
|
|
106586
107659
|
processContext.exit(EXIT_CODES.Failure);
|
|
106587
107660
|
return;
|
|
@@ -106624,7 +107697,7 @@ var init_update = __esm(() => {
|
|
|
106624
107697
|
init_prompt();
|
|
106625
107698
|
SKILLS_UPDATE_EXAMPLES = [
|
|
106626
107699
|
{
|
|
106627
|
-
Description: "Update skills for Claude Code to the latest
|
|
107700
|
+
Description: "Update skills for Claude Code to the latest matching CLI version line",
|
|
106628
107701
|
Command: "uip skills update --agent claude",
|
|
106629
107702
|
Output: {
|
|
106630
107703
|
Code: "SkillsUpdate",
|
|
@@ -106665,8 +107738,8 @@ function registerSkillsCommand(program2) {
|
|
|
106665
107738
|
const skillsCommand = program2.command("skills").description(`Install and manage UiPath skills for AI coding agents.
|
|
106666
107739
|
|
|
106667
107740
|
` + `Skills teach AI coding agents how to build UiPath automations, agents,
|
|
106668
|
-
` + `RPA workflows, flows, and orchestrations. They are fetched from the
|
|
106669
|
-
` +
|
|
107741
|
+
` + `RPA workflows, flows, and orchestrations. They are fetched from the
|
|
107742
|
+
` + `@uipath/skills npm package and installed for each agent.
|
|
106670
107743
|
` + getAgentsTable());
|
|
106671
107744
|
registerCatalogCommands(skillsCommand);
|
|
106672
107745
|
registerInstallCommand(skillsCommand);
|
|
@@ -106682,31 +107755,6 @@ var init_skills = __esm(() => {
|
|
|
106682
107755
|
init_update();
|
|
106683
107756
|
});
|
|
106684
107757
|
|
|
106685
|
-
// src/services/channel.ts
|
|
106686
|
-
function resolveChannel(cliVersion = package_default.version) {
|
|
106687
|
-
const fileChannel = getCachedConfig().core?.updateChannel;
|
|
106688
|
-
if (fileChannel && VALID_CHANNELS.has(fileChannel)) {
|
|
106689
|
-
return fileChannel;
|
|
106690
|
-
}
|
|
106691
|
-
const prerelease = parsePrereleaseTag(cliVersion);
|
|
106692
|
-
if (prerelease && VALID_CHANNELS.has(prerelease)) {
|
|
106693
|
-
return prerelease;
|
|
106694
|
-
}
|
|
106695
|
-
return "stable";
|
|
106696
|
-
}
|
|
106697
|
-
function parsePrereleaseTag(version2) {
|
|
106698
|
-
const dashIdx = version2.indexOf("-");
|
|
106699
|
-
if (dashIdx === -1)
|
|
106700
|
-
return;
|
|
106701
|
-
return version2.slice(dashIdx + 1).split(".")[0];
|
|
106702
|
-
}
|
|
106703
|
-
var VALID_CHANNELS;
|
|
106704
|
-
var init_channel = __esm(() => {
|
|
106705
|
-
init_package();
|
|
106706
|
-
init_loadConfig();
|
|
106707
|
-
VALID_CHANNELS = new Set(["alpha", "beta", "stable"]);
|
|
106708
|
-
});
|
|
106709
|
-
|
|
106710
107758
|
// src/commands/tools/install.ts
|
|
106711
107759
|
function registerInstallCommand2(toolsCommand, _context, state) {
|
|
106712
107760
|
const { resolveInstallPath, getCliVersionPrefix: getCliVersionPrefix2 } = state;
|
|
@@ -106732,21 +107780,21 @@ function registerInstallCommand2(toolsCommand, _context, state) {
|
|
|
106732
107780
|
const [error51] = await catchError((async () => {
|
|
106733
107781
|
const location = await resolveInstallPath(packageName);
|
|
106734
107782
|
let packageSpec;
|
|
107783
|
+
let registry3;
|
|
106735
107784
|
if (explicitVersion) {
|
|
106736
107785
|
packageSpec = `${packageName}@${explicitVersion}`;
|
|
106737
107786
|
} else {
|
|
106738
|
-
packageSpec = packageName;
|
|
106739
107787
|
const cliPrefix = getCliVersionPrefix2();
|
|
106740
|
-
const
|
|
106741
|
-
|
|
106742
|
-
|
|
106743
|
-
});
|
|
106744
|
-
if (version2) {
|
|
106745
|
-
packageSpec = `${packageName}@${version2}`;
|
|
107788
|
+
const candidate = await toolService.resolveInstallCandidate(packageName, cliPrefix);
|
|
107789
|
+
if (!candidate) {
|
|
107790
|
+
throw new Error(`No compatible version of '${packageName}' found for the CLI's ${cliPrefix}x line on npm or GitHub Packages.`);
|
|
106746
107791
|
}
|
|
107792
|
+
packageSpec = `${packageName}@${candidate.version}`;
|
|
107793
|
+
registry3 = candidate.registry;
|
|
106747
107794
|
}
|
|
106748
107795
|
await toolService.install(packageSpec, location.path, {
|
|
106749
|
-
global: location.global
|
|
107796
|
+
global: location.global,
|
|
107797
|
+
registry: registry3
|
|
106750
107798
|
});
|
|
106751
107799
|
logger.info(`Installed to ${location.path}`);
|
|
106752
107800
|
OutputFormatter.success({
|
|
@@ -106770,7 +107818,6 @@ function registerInstallCommand2(toolsCommand, _context, state) {
|
|
|
106770
107818
|
var TOOLS_INSTALL_EXAMPLES;
|
|
106771
107819
|
var init_install3 = __esm(() => {
|
|
106772
107820
|
init_src2();
|
|
106773
|
-
init_channel();
|
|
106774
107821
|
init_toolService();
|
|
106775
107822
|
TOOLS_INSTALL_EXAMPLES = [
|
|
106776
107823
|
{
|
|
@@ -109950,31 +110997,31 @@ class StdinDiscarder {
|
|
|
109950
110997
|
}
|
|
109951
110998
|
}
|
|
109952
110999
|
#realStart() {
|
|
109953
|
-
const { stdin } = process20;
|
|
109954
|
-
if (process20.platform === "win32" || !
|
|
111000
|
+
const { stdin: stdin2 } = process20;
|
|
111001
|
+
if (process20.platform === "win32" || !stdin2?.isTTY || typeof stdin2.setRawMode !== "function") {
|
|
109955
111002
|
this.#stdin = undefined;
|
|
109956
111003
|
return;
|
|
109957
111004
|
}
|
|
109958
|
-
this.#stdin =
|
|
109959
|
-
this.#stdinWasPaused =
|
|
109960
|
-
this.#stdinWasRaw = Boolean(
|
|
109961
|
-
|
|
109962
|
-
|
|
111005
|
+
this.#stdin = stdin2;
|
|
111006
|
+
this.#stdinWasPaused = stdin2.isPaused();
|
|
111007
|
+
this.#stdinWasRaw = Boolean(stdin2.isRaw);
|
|
111008
|
+
stdin2.setRawMode(true);
|
|
111009
|
+
stdin2.prependListener("data", this.#handleInputBound);
|
|
109963
111010
|
if (this.#stdinWasPaused) {
|
|
109964
|
-
|
|
111011
|
+
stdin2.resume();
|
|
109965
111012
|
}
|
|
109966
111013
|
}
|
|
109967
111014
|
#realStop() {
|
|
109968
111015
|
if (!this.#stdin) {
|
|
109969
111016
|
return;
|
|
109970
111017
|
}
|
|
109971
|
-
const
|
|
109972
|
-
|
|
109973
|
-
if (
|
|
109974
|
-
|
|
111018
|
+
const stdin2 = this.#stdin;
|
|
111019
|
+
stdin2.off("data", this.#handleInputBound);
|
|
111020
|
+
if (stdin2.isTTY) {
|
|
111021
|
+
stdin2.setRawMode?.(this.#stdinWasRaw);
|
|
109975
111022
|
}
|
|
109976
111023
|
if (this.#stdinWasPaused) {
|
|
109977
|
-
|
|
111024
|
+
stdin2.pause();
|
|
109978
111025
|
}
|
|
109979
111026
|
this.#stdin = undefined;
|
|
109980
111027
|
this.#stdinWasPaused = false;
|
|
@@ -110455,6 +111502,31 @@ var init_ora = __esm(() => {
|
|
|
110455
111502
|
validColors = new Set(["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray"]);
|
|
110456
111503
|
});
|
|
110457
111504
|
|
|
111505
|
+
// src/services/channel.ts
|
|
111506
|
+
function resolveChannel(cliVersion = package_default.version) {
|
|
111507
|
+
const fileChannel = getCachedConfig().core?.updateChannel;
|
|
111508
|
+
if (fileChannel && VALID_CHANNELS.has(fileChannel)) {
|
|
111509
|
+
return fileChannel;
|
|
111510
|
+
}
|
|
111511
|
+
const prerelease = parsePrereleaseTag(cliVersion);
|
|
111512
|
+
if (prerelease && VALID_CHANNELS.has(prerelease)) {
|
|
111513
|
+
return prerelease;
|
|
111514
|
+
}
|
|
111515
|
+
return "stable";
|
|
111516
|
+
}
|
|
111517
|
+
function parsePrereleaseTag(version2) {
|
|
111518
|
+
const dashIdx = version2.indexOf("-");
|
|
111519
|
+
if (dashIdx === -1)
|
|
111520
|
+
return;
|
|
111521
|
+
return version2.slice(dashIdx + 1).split(".")[0];
|
|
111522
|
+
}
|
|
111523
|
+
var init_channel = __esm(() => {
|
|
111524
|
+
init_package();
|
|
111525
|
+
init_loadConfig();
|
|
111526
|
+
init_channels();
|
|
111527
|
+
init_channels();
|
|
111528
|
+
});
|
|
111529
|
+
|
|
110458
111530
|
// src/services/updateService.tools.ts
|
|
110459
111531
|
async function runToolsUpdate(opts, state) {
|
|
110460
111532
|
const installed = getInstalledTools(state);
|
|
@@ -110529,7 +111601,6 @@ async function runToolsUpdate(opts, state) {
|
|
|
110529
111601
|
const exact = pin && isExactPin(pin) ? formatVersionPin(pin) : undefined;
|
|
110530
111602
|
const latest = await toolService.searchLatestVersion(fullName, prefix, {
|
|
110531
111603
|
channel: opts.channel,
|
|
110532
|
-
allowLowerFallback: pin === null,
|
|
110533
111604
|
exact
|
|
110534
111605
|
});
|
|
110535
111606
|
if (latest) {
|
|
@@ -110539,7 +111610,7 @@ async function runToolsUpdate(opts, state) {
|
|
|
110539
111610
|
name: tool.name,
|
|
110540
111611
|
status: "failed",
|
|
110541
111612
|
from: tool.version,
|
|
110542
|
-
error: pin ? `No version found matching pinned ${formatVersionPin(pin)} in the ${prefix}x line` : `No compatible ${opts.channel} version found
|
|
111613
|
+
error: pin ? `No version found matching pinned ${formatVersionPin(pin)} in the ${prefix}x line` : `No compatible ${opts.channel} version found in the CLI's v${prefix}x line`
|
|
110543
111614
|
});
|
|
110544
111615
|
return;
|
|
110545
111616
|
}
|
|
@@ -110790,22 +111861,23 @@ function detectCliInstallContext(execPath) {
|
|
|
110790
111861
|
return { kind: "npm" };
|
|
110791
111862
|
return { kind: "unknown" };
|
|
110792
111863
|
}
|
|
110793
|
-
function describeUpdateCommand(target, ctx) {
|
|
111864
|
+
function describeUpdateCommand(target, ctx, global6 = true) {
|
|
110794
111865
|
switch (ctx.kind) {
|
|
110795
111866
|
case "brew":
|
|
110796
111867
|
return `brew upgrade ${ctx.formula}`;
|
|
110797
111868
|
case "npm":
|
|
111869
|
+
return global6 ? `npm install -g ${target}` : `npm install ${target}`;
|
|
110798
111870
|
case "unknown":
|
|
110799
111871
|
return `npm install -g ${target}`;
|
|
110800
111872
|
}
|
|
110801
111873
|
}
|
|
110802
|
-
async function runCliSelfUpdate(target, ctx, installPath) {
|
|
111874
|
+
async function runCliSelfUpdate(target, ctx, installPath, global6) {
|
|
110803
111875
|
switch (ctx.kind) {
|
|
110804
111876
|
case "brew":
|
|
110805
111877
|
await spawnBrewUpgrade(ctx.formula);
|
|
110806
111878
|
return;
|
|
110807
111879
|
case "npm":
|
|
110808
|
-
await toolService.install(target, installPath, { global:
|
|
111880
|
+
await toolService.install(target, installPath, { global: global6 });
|
|
110809
111881
|
return;
|
|
110810
111882
|
}
|
|
110811
111883
|
}
|
|
@@ -110856,16 +111928,12 @@ async function checkCliVersion(opts) {
|
|
|
110856
111928
|
if (opts.isDev) {
|
|
110857
111929
|
return skipped(opts.cliPkgVersion, "dev mode");
|
|
110858
111930
|
}
|
|
110859
|
-
if (opts.isLocal) {
|
|
110860
|
-
return skipped(opts.cliPkgVersion, "local install");
|
|
110861
|
-
}
|
|
110862
111931
|
const pin = opts.pin ?? null;
|
|
110863
111932
|
const [err, latest] = await catchError(pin ? toolService.searchLatestVersion("@uipath/cli", pinnedPrefix(pin), {
|
|
110864
111933
|
channel: opts.channel,
|
|
110865
|
-
allowLowerFallback: false,
|
|
110866
111934
|
exact: isExactPin(pin) ? formatVersionPin(pin) : undefined,
|
|
110867
111935
|
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
110868
|
-
}) : toolService.searchLatestVersion("@uipath/cli",
|
|
111936
|
+
}) : toolService.searchLatestVersion("@uipath/cli", majorMinorPrefix(opts.cliPkgVersion), {
|
|
110869
111937
|
channel: opts.channel,
|
|
110870
111938
|
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
110871
111939
|
}));
|
|
@@ -110903,6 +111971,13 @@ async function checkCliVersion(opts) {
|
|
|
110903
111971
|
function skipped(current, reason) {
|
|
110904
111972
|
return { current, available: null, action: "skipped", reason };
|
|
110905
111973
|
}
|
|
111974
|
+
function majorMinorPrefix(version2) {
|
|
111975
|
+
const core2 = version2.split("-")[0];
|
|
111976
|
+
const [major, minor] = core2.split(".");
|
|
111977
|
+
if (!major || !minor)
|
|
111978
|
+
return;
|
|
111979
|
+
return `${major}.${minor}.`;
|
|
111980
|
+
}
|
|
110906
111981
|
var CLI_VERSION_PROBE_TIMEOUT_MS = 8000;
|
|
110907
111982
|
var init_updateService_cli = __esm(() => {
|
|
110908
111983
|
init_src2();
|
|
@@ -110911,6 +111986,10 @@ var init_updateService_cli = __esm(() => {
|
|
|
110911
111986
|
});
|
|
110912
111987
|
|
|
110913
111988
|
// src/services/updateService.ts
|
|
111989
|
+
var exports_updateService = {};
|
|
111990
|
+
__export(exports_updateService, {
|
|
111991
|
+
runUpdate: () => runUpdate
|
|
111992
|
+
});
|
|
110914
111993
|
async function runUpdate(options, state, cliEnv) {
|
|
110915
111994
|
const { sections, channel, dryRun } = options;
|
|
110916
111995
|
const errors7 = [];
|
|
@@ -110965,7 +112044,6 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
110965
112044
|
let cliReport = sections.cli ? await checkCliVersion({
|
|
110966
112045
|
channel,
|
|
110967
112046
|
cliPkgVersion: cliEnv.cliPkgVersion,
|
|
110968
|
-
isLocal: cliEnv.isLocal,
|
|
110969
112047
|
isDev: cliEnv.isDev,
|
|
110970
112048
|
pin: options.versionPin ?? null
|
|
110971
112049
|
}) : null;
|
|
@@ -110980,8 +112058,9 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
110980
112058
|
logger.info(`Downgrading @uipath/cli ${noticeReport.current} → ${available} to match the pinned version.`);
|
|
110981
112059
|
}
|
|
110982
112060
|
const target = `@uipath/cli@${available}`;
|
|
110983
|
-
const
|
|
110984
|
-
const
|
|
112061
|
+
const global6 = !cliEnv.isLocal;
|
|
112062
|
+
const manualCommand = describeUpdateCommand(target, installCtx, global6);
|
|
112063
|
+
const [installErr] = await catchError(runCliSelfUpdate(target, installCtx, cliEnv.installPath, global6));
|
|
110985
112064
|
if (installErr) {
|
|
110986
112065
|
const isWindows = process.platform === "win32";
|
|
110987
112066
|
const instructions = isPermissionError(installErr) ? isWindows ? "Re-run from an elevated terminal (right-click → Run as administrator): uip update" : "Re-run with elevated permissions, e.g. sudo uip update" : `Run manually: ${manualCommand}`;
|
|
@@ -111041,7 +112120,7 @@ var init_updateService = __esm(() => {
|
|
|
111041
112120
|
|
|
111042
112121
|
// src/commands/update.ts
|
|
111043
112122
|
function registerUpdateCommand3(program2, _context, state) {
|
|
111044
|
-
program2.command("update").description("Update installed UiPath tools and skills, and check for newer CLI").option("--dry-run", "Preview changes without applying them", false).option("--tools-only", "Skip skills section", false).option("--skills-only", "Skip tools section", false).option("--no-tools", "Do not update tools").option("--no-skills", "Do not update skills").option("--no-cli-check", "Do not probe for newer CLI version").option("--no-self", "Do not auto-update the CLI itself; only print a notice").option("--channel <channel>",
|
|
112123
|
+
program2.command("update").description("Update installed UiPath tools and skills, and check for newer CLI").option("--dry-run", "Preview changes without applying them", false).option("--tools-only", "Skip skills section", false).option("--skills-only", "Skip tools section", false).option("--no-tools", "Do not update tools").option("--no-skills", "Do not update skills").option("--no-cli-check", "Do not probe for newer CLI version").option("--no-self", "Do not auto-update the CLI itself; only print a notice").option("--channel <channel>", `Override channel: ${CHANNELS.join(" | ")}`).option("--name <scoped-tool-name>", "Restrict tool update to one tool").option("--agent <agent>", "Restrict skill update to one agent").option("--local", "Restrict skills update to local scope only").option("--no-local", "Restrict skills update to global scope only").examples(UPDATE_EXAMPLES).trackedAction(processContext, async (raw) => {
|
|
111045
112124
|
if (raw.toolsOnly && raw.skillsOnly) {
|
|
111046
112125
|
OutputFormatter.error({
|
|
111047
112126
|
Result: RESULTS.ValidationError,
|
|
@@ -111075,7 +112154,7 @@ function registerUpdateCommand3(program2, _context, state) {
|
|
|
111075
112154
|
OutputFormatter.error({
|
|
111076
112155
|
Result: RESULTS.ValidationError,
|
|
111077
112156
|
Message: `Invalid --channel value: ${raw.channel}`,
|
|
111078
|
-
Instructions:
|
|
112157
|
+
Instructions: `Valid values: ${CHANNELS.join(", ")}.`
|
|
111079
112158
|
});
|
|
111080
112159
|
processContext.exit(EXIT_CODES.ValidationError);
|
|
111081
112160
|
return;
|
|
@@ -111136,11 +112215,11 @@ function registerUpdateCommand3(program2, _context, state) {
|
|
|
111136
112215
|
function resolveChannelFlag(flag) {
|
|
111137
112216
|
if (!flag)
|
|
111138
112217
|
return resolveChannel();
|
|
111139
|
-
if (!
|
|
112218
|
+
if (!VALID_CHANNELS.has(flag))
|
|
111140
112219
|
return null;
|
|
111141
112220
|
return flag;
|
|
111142
112221
|
}
|
|
111143
|
-
var
|
|
112222
|
+
var UPDATE_EXAMPLES;
|
|
111144
112223
|
var init_update3 = __esm(() => {
|
|
111145
112224
|
init_src2();
|
|
111146
112225
|
init_package();
|
|
@@ -111149,11 +112228,6 @@ var init_update3 = __esm(() => {
|
|
|
111149
112228
|
init_toolService();
|
|
111150
112229
|
init_updateService();
|
|
111151
112230
|
init_versionPin();
|
|
111152
|
-
VALID_CHANNELS2 = new Set([
|
|
111153
|
-
"stable",
|
|
111154
|
-
"alpha",
|
|
111155
|
-
"beta"
|
|
111156
|
-
]);
|
|
111157
112231
|
UPDATE_EXAMPLES = [
|
|
111158
112232
|
{
|
|
111159
112233
|
Description: "Update everything that is installed (CLI auto-updates)",
|
|
@@ -111245,6 +112319,27 @@ var init_update3 = __esm(() => {
|
|
|
111245
112319
|
HasFailures: false
|
|
111246
112320
|
}
|
|
111247
112321
|
}
|
|
112322
|
+
},
|
|
112323
|
+
{
|
|
112324
|
+
Description: "Update on the preview channel",
|
|
112325
|
+
Command: "uip update --channel preview",
|
|
112326
|
+
Output: {
|
|
112327
|
+
Code: "UpdateResult",
|
|
112328
|
+
Data: {
|
|
112329
|
+
DryRun: false,
|
|
112330
|
+
Channel: "preview",
|
|
112331
|
+
Cli: {
|
|
112332
|
+
current: "1.4.3",
|
|
112333
|
+
available: "1.4.3",
|
|
112334
|
+
action: "none",
|
|
112335
|
+
reason: null
|
|
112336
|
+
},
|
|
112337
|
+
Tools: [],
|
|
112338
|
+
Skills: { Sections: [] },
|
|
112339
|
+
Errors: [],
|
|
112340
|
+
HasFailures: false
|
|
112341
|
+
}
|
|
112342
|
+
}
|
|
111248
112343
|
}
|
|
111249
112344
|
];
|
|
111250
112345
|
});
|
|
@@ -111425,16 +112520,16 @@ class ToolManager {
|
|
|
111425
112520
|
throw new Error(`Unknown tool verb '${verb}'.`);
|
|
111426
112521
|
}
|
|
111427
112522
|
logger.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
|
|
111428
|
-
const
|
|
111429
|
-
|
|
111430
|
-
|
|
111431
|
-
throw new Error(`No compatible ${channel} version of '${packageName}' found for CLI (needs ${this.cliVersionPrefix}x or lower).`);
|
|
112523
|
+
const candidate = await toolService.resolveInstallCandidate(packageName, this.cliVersionPrefix);
|
|
112524
|
+
if (!candidate) {
|
|
112525
|
+
throw new Error(`No compatible version of '${packageName}' found for the CLI's ${this.cliVersionPrefix}x line on npm or GitHub Packages.`);
|
|
111432
112526
|
}
|
|
111433
|
-
const packageSpec = `${packageName}@${
|
|
112527
|
+
const packageSpec = `${packageName}@${candidate.version}`;
|
|
111434
112528
|
const location = await this.resolveInstallPath();
|
|
111435
|
-
logger.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
|
|
112529
|
+
logger.debug(`Installing ${packageSpec} from ${candidate.registry} to ${location.path} (global: ${location.global})`);
|
|
111436
112530
|
await toolService.install(packageSpec, location.path, {
|
|
111437
|
-
global: location.global
|
|
112531
|
+
global: location.global,
|
|
112532
|
+
registry: candidate.registry
|
|
111438
112533
|
});
|
|
111439
112534
|
logger.info(`Installed ${packageSpec} successfully.`);
|
|
111440
112535
|
logger.debug(`Re-discovering tools in [${this.toolsDirs.join(", ")}]...`);
|
|
@@ -111446,8 +112541,331 @@ class ToolManager {
|
|
|
111446
112541
|
var init_tool_manager = __esm(() => {
|
|
111447
112542
|
init_src2();
|
|
111448
112543
|
init_toolLoader();
|
|
112544
|
+
init_toolService();
|
|
112545
|
+
});
|
|
112546
|
+
|
|
112547
|
+
// src/services/versionSync.ts
|
|
112548
|
+
async function maybeRunDailyVersionSync(context, state) {
|
|
112549
|
+
const [err, reexeced] = await catchError(runSync(context, state, { reexec: true, fromLogin: false }));
|
|
112550
|
+
if (err) {
|
|
112551
|
+
logger.debug(`Version sync skipped due to error: ${err.message}`);
|
|
112552
|
+
return false;
|
|
112553
|
+
}
|
|
112554
|
+
return reexeced;
|
|
112555
|
+
}
|
|
112556
|
+
async function runPostLoginVersionSync(context, state) {
|
|
112557
|
+
const verb = extractVerb(context.args);
|
|
112558
|
+
if (verb !== "login") {
|
|
112559
|
+
logger.debug(`Post-login sync: not a login command (verb=${verb})`);
|
|
112560
|
+
return;
|
|
112561
|
+
}
|
|
112562
|
+
if (process.exitCode) {
|
|
112563
|
+
logger.debug(`Post-login sync: login failed (exitCode=${String(process.exitCode)}); skipping`);
|
|
112564
|
+
return;
|
|
112565
|
+
}
|
|
112566
|
+
logger.debug("Post-login sync: login succeeded — checking env alignment");
|
|
112567
|
+
const [err] = await catchError(runSync(context, state, { reexec: false, fromLogin: true }));
|
|
112568
|
+
if (err) {
|
|
112569
|
+
logger.debug(`Post-login version sync skipped: ${err.message}`);
|
|
112570
|
+
}
|
|
112571
|
+
}
|
|
112572
|
+
async function runSync(context, state, opts) {
|
|
112573
|
+
const trigger = opts.fromLogin ? "post-login" : "startup";
|
|
112574
|
+
logger.debug(`Version sync evaluating (trigger=${trigger})`);
|
|
112575
|
+
if (context.capabilities.isBrowser) {
|
|
112576
|
+
logger.debug("Version sync skipped: browser environment");
|
|
112577
|
+
return false;
|
|
112578
|
+
}
|
|
112579
|
+
if (process.env[REEXEC_GUARD_ENV]) {
|
|
112580
|
+
logger.debug("Version sync skipped: re-exec child");
|
|
112581
|
+
return false;
|
|
112582
|
+
}
|
|
112583
|
+
if (isTruthyEnv(process.env[DISABLE_ENV])) {
|
|
112584
|
+
logger.debug(`Version sync skipped: ${DISABLE_ENV} is set`);
|
|
112585
|
+
return false;
|
|
112586
|
+
}
|
|
112587
|
+
if (getCachedConfig().core?.autoVersionSync === "false") {
|
|
112588
|
+
logger.debug("Version sync skipped: core.autoVersionSync=false");
|
|
112589
|
+
return false;
|
|
112590
|
+
}
|
|
112591
|
+
if (!opts.fromLogin) {
|
|
112592
|
+
const args = context.args;
|
|
112593
|
+
if (args.some((a) => VERSION_HELP_FLAGS.has(a))) {
|
|
112594
|
+
logger.debug("Version sync skipped: --version/--help");
|
|
112595
|
+
return false;
|
|
112596
|
+
}
|
|
112597
|
+
const verb = extractVerb(args);
|
|
112598
|
+
if (!verb || SKIP_VERBS.has(verb)) {
|
|
112599
|
+
logger.debug(`Version sync skipped: command '${verb}' is exempt`);
|
|
112600
|
+
return false;
|
|
112601
|
+
}
|
|
112602
|
+
}
|
|
112603
|
+
if (isEnvAuthEnabled()) {
|
|
112604
|
+
logger.debug("Version sync skipped: env-var auth (CI/headless)");
|
|
112605
|
+
return false;
|
|
112606
|
+
}
|
|
112607
|
+
if (await isDevMode()) {
|
|
112608
|
+
logger.debug("Version sync skipped: dev mode (monorepo checkout)");
|
|
112609
|
+
return false;
|
|
112610
|
+
}
|
|
112611
|
+
const fs7 = getFileSystem();
|
|
112612
|
+
return opts.fromLogin ? runLoginEnvSync(fs7) : runDailyAutoUpdate(state, fs7);
|
|
112613
|
+
}
|
|
112614
|
+
async function runLoginEnvSync(fs7) {
|
|
112615
|
+
const { auth: auth2 } = await Promise.resolve().then(() => (init_auth(), exports_auth));
|
|
112616
|
+
const [statusErr, status] = await catchError(auth2.getLoginStatus());
|
|
112617
|
+
if (statusErr || status.loginStatus !== "Logged in" || !status.baseUrl) {
|
|
112618
|
+
logger.debug(`Version sync skipped: not authenticated (status=${statusErr ? `error: ${statusErr.message}` : status.loginStatus})`);
|
|
112619
|
+
return false;
|
|
112620
|
+
}
|
|
112621
|
+
const environment = mapAuthorityToEnvironment(status.baseUrl);
|
|
112622
|
+
logger.debug(`Version sync: authority '${status.baseUrl}' → environment '${environment}'`);
|
|
112623
|
+
if (environment === "unknown") {
|
|
112624
|
+
logger.debug(`Authority '${status.baseUrl}' maps to no managed environment; skipping version sync`);
|
|
112625
|
+
return false;
|
|
112626
|
+
}
|
|
112627
|
+
logger.debug(`Version sync: downloading ${VERSIONS_FILENAME} from ${VERSIONS_PACKAGE}`);
|
|
112628
|
+
const versions2 = await downloadVersions();
|
|
112629
|
+
if (!versions2)
|
|
112630
|
+
return false;
|
|
112631
|
+
const parsed = VersionsSchema.safeParse(versions2);
|
|
112632
|
+
if (!parsed.success) {
|
|
112633
|
+
logger.debug("cli-versions.json failed schema validation; skipping");
|
|
112634
|
+
return false;
|
|
112635
|
+
}
|
|
112636
|
+
if (parsed.data.schemaVersion !== undefined && parsed.data.schemaVersion > SUPPORTED_SCHEMA_VERSION) {
|
|
112637
|
+
logger.debug(`cli-versions.json schemaVersion ${parsed.data.schemaVersion} is newer than supported ${SUPPORTED_SCHEMA_VERSION}; skipping`);
|
|
112638
|
+
return false;
|
|
112639
|
+
}
|
|
112640
|
+
const pinned = parsed.data.environments[environment]?.cliVersion;
|
|
112641
|
+
if (!pinned) {
|
|
112642
|
+
logger.debug(`No cliVersion pinned for '${environment}'; skipping`);
|
|
112643
|
+
return false;
|
|
112644
|
+
}
|
|
112645
|
+
if (!isValidVersionPin(pinned)) {
|
|
112646
|
+
logger.debug(`Pinned version '${pinned}' is not a valid pin; skipping`);
|
|
112647
|
+
return false;
|
|
112648
|
+
}
|
|
112649
|
+
const cfg = getCachedConfig().core;
|
|
112650
|
+
if (cfg?.versionSource === "manual") {
|
|
112651
|
+
logger.debug(`core.version is manually pinned (${cfg.version ?? "?"}); not overriding from environment`);
|
|
112652
|
+
return false;
|
|
112653
|
+
}
|
|
112654
|
+
if (cfg?.version !== pinned || cfg?.versionSource !== "environment") {
|
|
112655
|
+
logger.info(`Setting core.version=${pinned} (source=environment) for '${environment}'`);
|
|
112656
|
+
const { setCoreConfigValuesAsync: setCoreConfigValuesAsync2 } = await Promise.resolve().then(() => (init_loadConfig(), exports_loadConfig));
|
|
112657
|
+
await setCoreConfigValuesAsync2({
|
|
112658
|
+
version: pinned,
|
|
112659
|
+
versionSource: "environment"
|
|
112660
|
+
});
|
|
112661
|
+
} else {
|
|
112662
|
+
logger.debug(`core.version already ${pinned} (environment); re-checking alignment`);
|
|
112663
|
+
}
|
|
112664
|
+
await clearState(fs7);
|
|
112665
|
+
return false;
|
|
112666
|
+
}
|
|
112667
|
+
async function runDailyAutoUpdate(state, fs7) {
|
|
112668
|
+
const today = todayLocal();
|
|
112669
|
+
const prev = await readState(fs7);
|
|
112670
|
+
if (prev && prev.lastUpdateDate === today) {
|
|
112671
|
+
logger.debug("Daily auto-update already ran today; skipping");
|
|
112672
|
+
return false;
|
|
112673
|
+
}
|
|
112674
|
+
await writeState(fs7, { lastUpdateDate: today });
|
|
112675
|
+
let effectivePin = resolvePinnedVersion();
|
|
112676
|
+
if (effectivePin) {
|
|
112677
|
+
logger.debug(`Daily auto-update: respecting core.version pin ${formatVersionPin(effectivePin)}`);
|
|
112678
|
+
} else {
|
|
112679
|
+
const major = package_default.version.split(".")[0];
|
|
112680
|
+
const channel = resolveChannel();
|
|
112681
|
+
logger.debug(`Daily auto-update: resolving latest @uipath/cli in major ${major}.x (channel ${channel})`);
|
|
112682
|
+
const [resErr, latest] = await catchError(toolService.searchLatestVersion("@uipath/cli", `${major}.`, {
|
|
112683
|
+
channel,
|
|
112684
|
+
timeoutMs: DOWNLOAD_TIMEOUT_MS
|
|
112685
|
+
}));
|
|
112686
|
+
if (resErr || !latest) {
|
|
112687
|
+
logger.debug(`Daily auto-update: no @uipath/cli version found in major ${major}.x; skipping`);
|
|
112688
|
+
return false;
|
|
112689
|
+
}
|
|
112690
|
+
if (compareSemver(latest, package_default.version) <= 0) {
|
|
112691
|
+
logger.debug(`Daily auto-update: already at the latest minor in major ${major}.x (current ${package_default.version}, latest ${latest}); skipping`);
|
|
112692
|
+
return false;
|
|
112693
|
+
}
|
|
112694
|
+
effectivePin = majorMinorPinOf(latest);
|
|
112695
|
+
if (!effectivePin) {
|
|
112696
|
+
logger.debug(`Daily auto-update: could not parse resolved version '${latest}'; skipping`);
|
|
112697
|
+
return false;
|
|
112698
|
+
}
|
|
112699
|
+
logger.debug(`Daily auto-update: targeting latest minor ${formatVersionPin(effectivePin)}.x (resolved ${latest})`);
|
|
112700
|
+
}
|
|
112701
|
+
return applyUpdate(state, fs7, effectivePin, true);
|
|
112702
|
+
}
|
|
112703
|
+
async function applyUpdate(state, fs7, effectivePin, reexec) {
|
|
112704
|
+
const [locErr, location] = await catchError(state.resolveInstallPath());
|
|
112705
|
+
if (locErr || !location) {
|
|
112706
|
+
logger.debug(`Cannot resolve install location: ${String(locErr)}`);
|
|
112707
|
+
return false;
|
|
112708
|
+
}
|
|
112709
|
+
const { runUpdate: runUpdate2 } = await Promise.resolve().then(() => (init_updateService(), exports_updateService));
|
|
112710
|
+
const [updErr, report] = await catchError(runUpdate2({
|
|
112711
|
+
dryRun: false,
|
|
112712
|
+
channel: resolveChannel(),
|
|
112713
|
+
sections: { tools: true, skills: true, cli: true },
|
|
112714
|
+
tools: { name: undefined },
|
|
112715
|
+
skills: { agent: undefined, local: undefined },
|
|
112716
|
+
cli: { self: true },
|
|
112717
|
+
versionPin: effectivePin
|
|
112718
|
+
}, state, {
|
|
112719
|
+
cliPkgVersion: package_default.version,
|
|
112720
|
+
isLocal: !location.global,
|
|
112721
|
+
isDev: false,
|
|
112722
|
+
installPath: location.path
|
|
112723
|
+
}));
|
|
112724
|
+
if (updErr || !report) {
|
|
112725
|
+
logger.debug(`Version sync update failed: ${updErr ? updErr.message : "no report"}`);
|
|
112726
|
+
return false;
|
|
112727
|
+
}
|
|
112728
|
+
for (const e of report.Errors) {
|
|
112729
|
+
logger.debug(`[${e.Subsystem}] ${e.Message} ${e.Instructions}`);
|
|
112730
|
+
}
|
|
112731
|
+
const cliUpdated = report.Cli?.action === "updated";
|
|
112732
|
+
const toolsUpdated = !!report.Tools?.some((t) => t.status === "updated");
|
|
112733
|
+
if (!cliUpdated && !toolsUpdated) {
|
|
112734
|
+
logger.debug("Version sync: nothing changed; continuing in-process");
|
|
112735
|
+
return false;
|
|
112736
|
+
}
|
|
112737
|
+
if (!reexec) {
|
|
112738
|
+
logger.debug("Version sync applied; new version takes effect on the next run");
|
|
112739
|
+
return false;
|
|
112740
|
+
}
|
|
112741
|
+
return reexecOriginalCommand(fs7);
|
|
112742
|
+
}
|
|
112743
|
+
async function reexecOriginalCommand(fs7) {
|
|
112744
|
+
const { spawn: spawn3 } = await import("node:child_process");
|
|
112745
|
+
const userArgs = process.argv.slice(2);
|
|
112746
|
+
const env2 = { ...process.env, [REEXEC_GUARD_ENV]: "1" };
|
|
112747
|
+
logger.info("Re-running the requested command on the updated CLI…");
|
|
112748
|
+
const binName = process.argv[1] ? fs7.path.basename(process.argv[1]) : "uip";
|
|
112749
|
+
const [primErr, primCode] = await catchError(runChild(spawn3, binName, userArgs, env2));
|
|
112750
|
+
if (!primErr) {
|
|
112751
|
+
process.exitCode = primCode ?? 1;
|
|
112752
|
+
return true;
|
|
112753
|
+
}
|
|
112754
|
+
logger.debug(`Re-exec via PATH ('${binName}') failed: ${primErr.message}; trying node fallback`);
|
|
112755
|
+
const entry = process.argv[1];
|
|
112756
|
+
if (!entry)
|
|
112757
|
+
return false;
|
|
112758
|
+
const [fbErr, fbCode] = await catchError(runChild(spawn3, process.execPath, [entry, ...userArgs], env2));
|
|
112759
|
+
if (fbErr) {
|
|
112760
|
+
logger.debug(`Re-exec fallback failed: ${fbErr.message}`);
|
|
112761
|
+
return false;
|
|
112762
|
+
}
|
|
112763
|
+
process.exitCode = fbCode ?? 1;
|
|
112764
|
+
return true;
|
|
112765
|
+
}
|
|
112766
|
+
function runChild(spawnFn, command, args, env2) {
|
|
112767
|
+
return new Promise((resolve2, reject) => {
|
|
112768
|
+
const child = spawnFn(command, args, { stdio: "inherit", env: env2 });
|
|
112769
|
+
child.on("error", reject);
|
|
112770
|
+
child.on("close", (code) => resolve2(code));
|
|
112771
|
+
});
|
|
112772
|
+
}
|
|
112773
|
+
function mapAuthorityToEnvironment(baseUrl) {
|
|
112774
|
+
const [err, host] = catchError(() => new URL(baseUrl).hostname.toLowerCase());
|
|
112775
|
+
if (err || !host)
|
|
112776
|
+
return "unknown";
|
|
112777
|
+
if (host.includes("alpha"))
|
|
112778
|
+
return "alpha";
|
|
112779
|
+
if (host.includes("staging"))
|
|
112780
|
+
return "staging";
|
|
112781
|
+
if (host === "cloud.uipath.com")
|
|
112782
|
+
return "cloud";
|
|
112783
|
+
return "unknown";
|
|
112784
|
+
}
|
|
112785
|
+
function extractVerb(args) {
|
|
112786
|
+
for (const a of stripGlobalOptions(args.slice(2)).args) {
|
|
112787
|
+
if (a.startsWith("-"))
|
|
112788
|
+
continue;
|
|
112789
|
+
return a;
|
|
112790
|
+
}
|
|
112791
|
+
return;
|
|
112792
|
+
}
|
|
112793
|
+
function isTruthyEnv(value) {
|
|
112794
|
+
if (!value)
|
|
112795
|
+
return false;
|
|
112796
|
+
const v = value.trim().toLowerCase();
|
|
112797
|
+
return v !== "" && v !== "0" && v !== "false" && v !== "no";
|
|
112798
|
+
}
|
|
112799
|
+
function todayLocal() {
|
|
112800
|
+
const d = new Date;
|
|
112801
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
112802
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
112803
|
+
return `${d.getFullYear()}-${month}-${day}`;
|
|
112804
|
+
}
|
|
112805
|
+
function stateFilePath(fs7) {
|
|
112806
|
+
return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
|
|
112807
|
+
}
|
|
112808
|
+
async function readState(fs7) {
|
|
112809
|
+
const [readErr, raw] = await catchError(fs7.readFile(stateFilePath(fs7), "utf-8"));
|
|
112810
|
+
if (readErr || !raw)
|
|
112811
|
+
return null;
|
|
112812
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(raw));
|
|
112813
|
+
if (parseErr || typeof parsed?.lastUpdateDate !== "string") {
|
|
112814
|
+
return null;
|
|
112815
|
+
}
|
|
112816
|
+
return { lastUpdateDate: parsed.lastUpdateDate };
|
|
112817
|
+
}
|
|
112818
|
+
async function writeState(fs7, state) {
|
|
112819
|
+
await catchError(fs7.writeFile(stateFilePath(fs7), JSON.stringify(state, null, 2)));
|
|
112820
|
+
}
|
|
112821
|
+
async function clearState(fs7) {
|
|
112822
|
+
const [rmErr] = await catchError(fs7.rm(stateFilePath(fs7)));
|
|
112823
|
+
if (rmErr) {
|
|
112824
|
+
logger.debug(`Failed to clear version sync state: ${rmErr.message}`);
|
|
112825
|
+
}
|
|
112826
|
+
}
|
|
112827
|
+
async function downloadVersions() {
|
|
112828
|
+
const [dlErr, raw] = await catchError(toolService.downloadPackageFile(VERSIONS_PACKAGE, VERSIONS_FILENAME, {
|
|
112829
|
+
timeoutMs: DOWNLOAD_TIMEOUT_MS,
|
|
112830
|
+
forcePublicRegistry: true
|
|
112831
|
+
}));
|
|
112832
|
+
if (dlErr) {
|
|
112833
|
+
logger.debug(`Failed to download ${VERSIONS_FILENAME} from ${VERSIONS_PACKAGE}: ${dlErr.message}`);
|
|
112834
|
+
return null;
|
|
112835
|
+
}
|
|
112836
|
+
const [jsonErr, json2] = catchError(() => JSON.parse(raw));
|
|
112837
|
+
if (jsonErr) {
|
|
112838
|
+
logger.debug(`Failed to parse ${VERSIONS_FILENAME}: ${jsonErr.message}`);
|
|
112839
|
+
return null;
|
|
112840
|
+
}
|
|
112841
|
+
return json2;
|
|
112842
|
+
}
|
|
112843
|
+
var VERSIONS_PACKAGE = "@uipath/cli-meta", VERSIONS_FILENAME = "cli-versions.json", SUPPORTED_SCHEMA_VERSION = 1, DOWNLOAD_TIMEOUT_MS = 8000, STATE_FILENAME = "version-sync.json", REEXEC_GUARD_ENV = "UIPATH_CLI_VERSION_SYNC_REEXEC", DISABLE_ENV = "UIPATH_CLI_DISABLE_VERSION_SYNC", SKIP_VERBS, VERSION_HELP_FLAGS, VersionsSchema;
|
|
112844
|
+
var init_versionSync = __esm(() => {
|
|
112845
|
+
init_src3();
|
|
112846
|
+
init_src2();
|
|
112847
|
+
init_src();
|
|
112848
|
+
init_zod();
|
|
112849
|
+
init_package();
|
|
112850
|
+
init_loadConfig();
|
|
112851
|
+
init_globalOptions();
|
|
111449
112852
|
init_channel();
|
|
111450
112853
|
init_toolService();
|
|
112854
|
+
init_versionPin();
|
|
112855
|
+
SKIP_VERBS = new Set([
|
|
112856
|
+
"update",
|
|
112857
|
+
"login",
|
|
112858
|
+
"logout",
|
|
112859
|
+
"mcp",
|
|
112860
|
+
"completion",
|
|
112861
|
+
"config",
|
|
112862
|
+
"help"
|
|
112863
|
+
]);
|
|
112864
|
+
VERSION_HELP_FLAGS = new Set(["-v", "--version", "-h", "--help"]);
|
|
112865
|
+
VersionsSchema = exports_external.object({
|
|
112866
|
+
schemaVersion: exports_external.number().optional(),
|
|
112867
|
+
environments: exports_external.record(exports_external.string(), exports_external.object({ cliVersion: exports_external.string().min(1) }).passthrough())
|
|
112868
|
+
}).passthrough();
|
|
111451
112869
|
});
|
|
111452
112870
|
|
|
111453
112871
|
// src/utils/autoInstall.ts
|
|
@@ -111497,6 +112915,10 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
111497
112915
|
});
|
|
111498
112916
|
return;
|
|
111499
112917
|
}
|
|
112918
|
+
setGlobalTelemetryProperties({
|
|
112919
|
+
toolName: tool.metadata.commandPrefix,
|
|
112920
|
+
toolVersion: tool.metadata.version
|
|
112921
|
+
});
|
|
111500
112922
|
const idx = program2.commands.indexOf(toolCommand);
|
|
111501
112923
|
if (idx >= 0) {
|
|
111502
112924
|
program2.commands.splice(idx, 1);
|
|
@@ -111518,7 +112940,8 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
111518
112940
|
const prefixIdx = toolArgs.findIndex((a) => candidates.includes(a));
|
|
111519
112941
|
const positionals = prefixIdx >= 0 ? toolArgs.slice(prefixIdx + 1).filter((a) => !a.startsWith("-")) : [];
|
|
111520
112942
|
const unknownSub = findUnknownHelpCommand(realCommand, positionals, toolArgs);
|
|
111521
|
-
|
|
112943
|
+
const forwardsUnknownCommands = realCommand.listenerCount("command:*") > 0;
|
|
112944
|
+
if (unknownSub && !forwardsUnknownCommands) {
|
|
111522
112945
|
OutputFormatter.error({
|
|
111523
112946
|
Result: RESULTS.ValidationError,
|
|
111524
112947
|
Message: `error: unknown command '${unknownSub}'`,
|
|
@@ -111597,7 +113020,8 @@ async function buildNodeProgram(context) {
|
|
|
111597
113020
|
};
|
|
111598
113021
|
return {
|
|
111599
113022
|
outputFormat: !formatWasExplicit && config2.core?.output ? config2.core.output : undefined,
|
|
111600
|
-
level: !logLevelWasExplicit && config2.core?.logLevel ? levelMap[config2.core.logLevel] : undefined
|
|
113023
|
+
level: !logLevelWasExplicit && config2.core?.logLevel ? levelMap[config2.core.logLevel] : undefined,
|
|
113024
|
+
interactivityMode: config2.core?.interactive
|
|
111601
113025
|
};
|
|
111602
113026
|
},
|
|
111603
113027
|
afterTelemetryInit: populateTelemetryAuthContext
|
|
@@ -111647,7 +113071,7 @@ async function buildNodeProgram(context) {
|
|
|
111647
113071
|
discoveredTools
|
|
111648
113072
|
});
|
|
111649
113073
|
logger.debug("Node program built successfully — ready to parse args");
|
|
111650
|
-
return { program: program2, cleanedArgs };
|
|
113074
|
+
return { program: program2, cleanedArgs, updateState };
|
|
111651
113075
|
}
|
|
111652
113076
|
async function runNode(context) {
|
|
111653
113077
|
const built = await buildNodeProgram(context);
|
|
@@ -111655,7 +113079,13 @@ async function runNode(context) {
|
|
|
111655
113079
|
await telemetryFlushAndShutdown();
|
|
111656
113080
|
return;
|
|
111657
113081
|
}
|
|
113082
|
+
const reexeced = await maybeRunDailyVersionSync(context, built.updateState);
|
|
113083
|
+
if (reexeced) {
|
|
113084
|
+
await telemetryFlushAndShutdown();
|
|
113085
|
+
return;
|
|
113086
|
+
}
|
|
111658
113087
|
await parseAndExit(built.program, built.cleanedArgs, context);
|
|
113088
|
+
await runPostLoginVersionSync(context, built.updateState);
|
|
111659
113089
|
}
|
|
111660
113090
|
var init_cli_node = __esm(() => {
|
|
111661
113091
|
init_src2();
|
|
@@ -111674,6 +113104,7 @@ var init_cli_node = __esm(() => {
|
|
|
111674
113104
|
init_authTelemetry();
|
|
111675
113105
|
init_installPath();
|
|
111676
113106
|
init_tool_manager();
|
|
113107
|
+
init_versionSync();
|
|
111677
113108
|
init_autoInstall();
|
|
111678
113109
|
init_registerToolCommands();
|
|
111679
113110
|
init_resolveToolsDirectories();
|
|
@@ -111738,14 +113169,37 @@ class TerminalSink {
|
|
|
111738
113169
|
}
|
|
111739
113170
|
}
|
|
111740
113171
|
|
|
113172
|
+
// src/system-ca.ts
|
|
113173
|
+
import * as tls from "node:tls";
|
|
113174
|
+
function installSystemCaTrust(tlsModule = tls) {
|
|
113175
|
+
const getCertificates = tlsModule.getCACertificates;
|
|
113176
|
+
const setDefaultCertificates = tlsModule.setDefaultCACertificates;
|
|
113177
|
+
if (typeof getCertificates !== "function" || typeof setDefaultCertificates !== "function") {
|
|
113178
|
+
return "unsupported";
|
|
113179
|
+
}
|
|
113180
|
+
try {
|
|
113181
|
+
const system = getCertificates.call(tlsModule, "system");
|
|
113182
|
+
if (!Array.isArray(system) || system.length === 0) {
|
|
113183
|
+
return "empty";
|
|
113184
|
+
}
|
|
113185
|
+
const current = getCertificates.call(tlsModule, "default") ?? [];
|
|
113186
|
+
setDefaultCertificates.call(tlsModule, [...current, ...system]);
|
|
113187
|
+
return "applied";
|
|
113188
|
+
} catch {
|
|
113189
|
+
return "error";
|
|
113190
|
+
}
|
|
113191
|
+
}
|
|
113192
|
+
|
|
111741
113193
|
// index.ts
|
|
111742
113194
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
113195
|
+
var systemCaTrust = installSystemCaTrust();
|
|
111743
113196
|
process.stdout.on("error", (err) => {
|
|
111744
113197
|
if (err.code === "EPIPE")
|
|
111745
113198
|
process.exit(0);
|
|
111746
113199
|
});
|
|
111747
113200
|
process.stderr.on("error", () => {});
|
|
111748
113201
|
configureLogger({ sink: new TerminalSink });
|
|
113202
|
+
logger.debug(`OS certificate-store trust: ${systemCaTrust}`);
|
|
111749
113203
|
installConsoleGuard();
|
|
111750
113204
|
var pollController = createPollAbortController();
|
|
111751
113205
|
setProcessContextPollSignal(pollController.signal);
|