@uipath/cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +83 -70
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47604,7 +47604,7 @@ var package_default;
|
|
|
47604
47604
|
var init_package = __esm(() => {
|
|
47605
47605
|
package_default = {
|
|
47606
47606
|
name: "@uipath/cli",
|
|
47607
|
-
version: "0.2.
|
|
47607
|
+
version: "0.2.2",
|
|
47608
47608
|
description: "Cross platform CLI for UiPath",
|
|
47609
47609
|
repository: {
|
|
47610
47610
|
type: "git",
|
|
@@ -82938,6 +82938,70 @@ Supported agents:
|
|
|
82938
82938
|
` + " Codex .agents/skills/<skill>/";
|
|
82939
82939
|
});
|
|
82940
82940
|
|
|
82941
|
+
// src/utils/globalNpmRoot.ts
|
|
82942
|
+
async function getGlobalNpmUipathDir() {
|
|
82943
|
+
if (cachedLookup)
|
|
82944
|
+
return cachedLookup;
|
|
82945
|
+
cachedLookup = resolveGlobalNpmUipathDir();
|
|
82946
|
+
return cachedLookup;
|
|
82947
|
+
}
|
|
82948
|
+
async function resolveGlobalNpmUipathDir() {
|
|
82949
|
+
const root = await runNpmRootGlobal();
|
|
82950
|
+
if (!root) {
|
|
82951
|
+
logger.debug("npm root -g lookup failed; skipping global plugin fallback");
|
|
82952
|
+
return null;
|
|
82953
|
+
}
|
|
82954
|
+
const fs7 = getFileSystem();
|
|
82955
|
+
const candidate = fs7.path.join(root, "@uipath");
|
|
82956
|
+
const [existsError, exists] = await catchError(fs7.exists(candidate));
|
|
82957
|
+
if (existsError) {
|
|
82958
|
+
logger.debug(`fs.exists check failed for ${candidate}: ${String(existsError)}`);
|
|
82959
|
+
return null;
|
|
82960
|
+
}
|
|
82961
|
+
if (!exists) {
|
|
82962
|
+
logger.debug(`Global @uipath not present at ${candidate}`);
|
|
82963
|
+
return null;
|
|
82964
|
+
}
|
|
82965
|
+
logger.debug(`Global @uipath resolved via npm root -g: ${candidate}`);
|
|
82966
|
+
return candidate;
|
|
82967
|
+
}
|
|
82968
|
+
async function runNpmRootGlobal() {
|
|
82969
|
+
const { spawn: spawn2 } = await import("node:child_process");
|
|
82970
|
+
const isWindows = process.platform === "win32";
|
|
82971
|
+
return new Promise((resolve2) => {
|
|
82972
|
+
const proc = isWindows ? spawn2("npm", ["root", "-g"], {
|
|
82973
|
+
shell: true,
|
|
82974
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
82975
|
+
windowsHide: true
|
|
82976
|
+
}) : spawn2("npm", ["root", "-g"], {
|
|
82977
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
82978
|
+
});
|
|
82979
|
+
let stdout = "";
|
|
82980
|
+
proc.stdout?.on("data", (d) => {
|
|
82981
|
+
stdout += d.toString();
|
|
82982
|
+
});
|
|
82983
|
+
proc.stderr?.on("data", () => {});
|
|
82984
|
+
const timer = setTimeout(() => {
|
|
82985
|
+
proc.kill("SIGTERM");
|
|
82986
|
+
resolve2(null);
|
|
82987
|
+
}, NPM_ROOT_TIMEOUT_MS);
|
|
82988
|
+
proc.on("error", () => {
|
|
82989
|
+
clearTimeout(timer);
|
|
82990
|
+
resolve2(null);
|
|
82991
|
+
});
|
|
82992
|
+
proc.on("close", (code) => {
|
|
82993
|
+
clearTimeout(timer);
|
|
82994
|
+
const trimmed = stdout.trim();
|
|
82995
|
+
resolve2(code === 0 && trimmed ? trimmed : null);
|
|
82996
|
+
});
|
|
82997
|
+
});
|
|
82998
|
+
}
|
|
82999
|
+
var NPM_ROOT_TIMEOUT_MS = 5000, cachedLookup = null;
|
|
83000
|
+
var init_globalNpmRoot = __esm(() => {
|
|
83001
|
+
init_src();
|
|
83002
|
+
init_src2();
|
|
83003
|
+
});
|
|
83004
|
+
|
|
82941
83005
|
// src/services/tools-whitelist.ts
|
|
82942
83006
|
var TOOLS_WHITELIST, WHITELIST_BY_COMMAND, WHITELIST_BY_SHORT_NAME;
|
|
82943
83007
|
var init_tools_whitelist = __esm(() => {
|
|
@@ -83346,13 +83410,25 @@ ${errors5.map((e) => ` - ${e}`).join(`
|
|
|
83346
83410
|
}
|
|
83347
83411
|
async uninstall(packageName, destination, options) {
|
|
83348
83412
|
const fs7 = getFileSystem();
|
|
83349
|
-
|
|
83350
|
-
|
|
83351
|
-
if (
|
|
83352
|
-
|
|
83413
|
+
let containerDir;
|
|
83414
|
+
let relativeName;
|
|
83415
|
+
if (options?.global) {
|
|
83416
|
+
const globalUipathDir = await getGlobalNpmUipathDir();
|
|
83417
|
+
if (!globalUipathDir) {
|
|
83418
|
+
throw new Error(`Cannot locate '${packageName}': npm root -g unavailable`);
|
|
83419
|
+
}
|
|
83420
|
+
containerDir = globalUipathDir;
|
|
83421
|
+
relativeName = packageName.replace(/^@uipath\//, "");
|
|
83422
|
+
} else {
|
|
83423
|
+
containerDir = fs7.path.resolve(destination, "node_modules");
|
|
83424
|
+
relativeName = packageName;
|
|
83425
|
+
}
|
|
83426
|
+
const packageDir = fs7.path.resolve(fs7.path.join(containerDir, relativeName));
|
|
83427
|
+
if (!packageDir.startsWith(`${containerDir}/`) && !packageDir.startsWith(`${containerDir}\\`)) {
|
|
83428
|
+
throw new Error(`Refusing to uninstall '${packageName}': resolved path escapes ${containerDir}`);
|
|
83353
83429
|
}
|
|
83354
83430
|
if (!await fs7.exists(packageDir)) {
|
|
83355
|
-
throw new Error(`Package '${packageName}' is not installed at ${
|
|
83431
|
+
throw new Error(`Package '${packageName}' is not installed at ${packageDir}`);
|
|
83356
83432
|
}
|
|
83357
83433
|
const [statError, stat2] = await catchError(fs7.stat(packageDir));
|
|
83358
83434
|
if (!statError && !stat2) {
|
|
@@ -83398,6 +83474,7 @@ var SEMVER_RE, SAFE_PACKAGE_SPEC, SAFE_VERSION, NPM_TIMEOUT_MS = 180000, NPM_MAX
|
|
|
83398
83474
|
var init_toolService = __esm(() => {
|
|
83399
83475
|
init_src();
|
|
83400
83476
|
init_src2();
|
|
83477
|
+
init_globalNpmRoot();
|
|
83401
83478
|
init_tools_whitelist();
|
|
83402
83479
|
init_tools_whitelist();
|
|
83403
83480
|
SEMVER_RE = /^\d+\.\d+\.\d+(-[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?(\+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?$/;
|
|
@@ -83867,70 +83944,6 @@ var init_storage = __esm(() => {
|
|
|
83867
83944
|
storage = new GeneralizedStorage;
|
|
83868
83945
|
});
|
|
83869
83946
|
|
|
83870
|
-
// src/utils/globalNpmRoot.ts
|
|
83871
|
-
async function getGlobalNpmUipathDir() {
|
|
83872
|
-
if (cachedLookup)
|
|
83873
|
-
return cachedLookup;
|
|
83874
|
-
cachedLookup = resolveGlobalNpmUipathDir();
|
|
83875
|
-
return cachedLookup;
|
|
83876
|
-
}
|
|
83877
|
-
async function resolveGlobalNpmUipathDir() {
|
|
83878
|
-
const root = await runNpmRootGlobal();
|
|
83879
|
-
if (!root) {
|
|
83880
|
-
logger.debug("npm root -g lookup failed; skipping global plugin fallback");
|
|
83881
|
-
return null;
|
|
83882
|
-
}
|
|
83883
|
-
const fs7 = getFileSystem();
|
|
83884
|
-
const candidate = fs7.path.join(root, "@uipath");
|
|
83885
|
-
const [existsError, exists] = await catchError(fs7.exists(candidate));
|
|
83886
|
-
if (existsError) {
|
|
83887
|
-
logger.debug(`fs.exists check failed for ${candidate}: ${String(existsError)}`);
|
|
83888
|
-
return null;
|
|
83889
|
-
}
|
|
83890
|
-
if (!exists) {
|
|
83891
|
-
logger.debug(`Global @uipath not present at ${candidate}`);
|
|
83892
|
-
return null;
|
|
83893
|
-
}
|
|
83894
|
-
logger.debug(`Global @uipath resolved via npm root -g: ${candidate}`);
|
|
83895
|
-
return candidate;
|
|
83896
|
-
}
|
|
83897
|
-
async function runNpmRootGlobal() {
|
|
83898
|
-
const { spawn: spawn2 } = await import("node:child_process");
|
|
83899
|
-
const isWindows = process.platform === "win32";
|
|
83900
|
-
return new Promise((resolve2) => {
|
|
83901
|
-
const proc = isWindows ? spawn2("npm", ["root", "-g"], {
|
|
83902
|
-
shell: true,
|
|
83903
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
83904
|
-
windowsHide: true
|
|
83905
|
-
}) : spawn2("npm", ["root", "-g"], {
|
|
83906
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
83907
|
-
});
|
|
83908
|
-
let stdout = "";
|
|
83909
|
-
proc.stdout?.on("data", (d) => {
|
|
83910
|
-
stdout += d.toString();
|
|
83911
|
-
});
|
|
83912
|
-
proc.stderr?.on("data", () => {});
|
|
83913
|
-
const timer = setTimeout(() => {
|
|
83914
|
-
proc.kill("SIGTERM");
|
|
83915
|
-
resolve2(null);
|
|
83916
|
-
}, NPM_ROOT_TIMEOUT_MS);
|
|
83917
|
-
proc.on("error", () => {
|
|
83918
|
-
clearTimeout(timer);
|
|
83919
|
-
resolve2(null);
|
|
83920
|
-
});
|
|
83921
|
-
proc.on("close", (code) => {
|
|
83922
|
-
clearTimeout(timer);
|
|
83923
|
-
const trimmed = stdout.trim();
|
|
83924
|
-
resolve2(code === 0 && trimmed ? trimmed : null);
|
|
83925
|
-
});
|
|
83926
|
-
});
|
|
83927
|
-
}
|
|
83928
|
-
var NPM_ROOT_TIMEOUT_MS = 5000, cachedLookup = null;
|
|
83929
|
-
var init_globalNpmRoot = __esm(() => {
|
|
83930
|
-
init_src();
|
|
83931
|
-
init_src2();
|
|
83932
|
-
});
|
|
83933
|
-
|
|
83934
83947
|
// src/utils/toolLoader.ts
|
|
83935
83948
|
function isRunningFromSource() {
|
|
83936
83949
|
const [error48, mainUrl] = catchError(() => import.meta.url);
|