@uipath/cli 1.197.0-preview.68 → 1.197.0-preview.71
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.browser.js +19 -19
- package/dist/index.js +222 -161
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -45866,7 +45866,7 @@ var init_package = __esm(() => {
|
|
|
45866
45866
|
package_default = {
|
|
45867
45867
|
name: "@uipath/cli",
|
|
45868
45868
|
license: "MIT",
|
|
45869
|
-
version: "1.197.0-preview.
|
|
45869
|
+
version: "1.197.0-preview.71",
|
|
45870
45870
|
description: "Cross platform CLI for UiPath",
|
|
45871
45871
|
repository: {
|
|
45872
45872
|
type: "git",
|
|
@@ -107468,42 +107468,72 @@ var init_autopilot = __esm(() => {
|
|
|
107468
107468
|
|
|
107469
107469
|
// src/commands/skills/contentStore.ts
|
|
107470
107470
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
107471
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
107472
|
+
import { dirname as dirname2 } from "node:path";
|
|
107471
107473
|
import { gunzipSync } from "node:zlib";
|
|
107472
107474
|
function loadChildProcess2() {
|
|
107473
107475
|
childProcessModulePromise2 ??= import("node:child_process");
|
|
107474
107476
|
return childProcessModulePromise2;
|
|
107475
107477
|
}
|
|
107476
|
-
async function
|
|
107477
|
-
const
|
|
107478
|
-
const
|
|
107479
|
-
|
|
107480
|
-
|
|
107478
|
+
async function resolveLocalSkillsStore(fs7) {
|
|
107479
|
+
const hasSkillsDir = async (d) => !!d && await fs7.exists(fs7.path.join(d, "skills"));
|
|
107480
|
+
const envDir = process.env.UIPATH_SKILLS_LOCAL_DIR?.trim();
|
|
107481
|
+
if (envDir && await hasSkillsDir(envDir))
|
|
107482
|
+
return envDir;
|
|
107483
|
+
const [reqErr, require2] = catchError(() => createRequire2(import.meta.url));
|
|
107484
|
+
if (reqErr || !require2)
|
|
107485
|
+
return;
|
|
107486
|
+
const [resErr, pkgJsonPath] = catchError(() => require2.resolve(`${SKILLS_PACKAGE_NAME}/package.json`));
|
|
107487
|
+
if (resErr || !pkgJsonPath)
|
|
107488
|
+
return;
|
|
107489
|
+
const dir = dirname2(pkgJsonPath);
|
|
107490
|
+
return await hasSkillsDir(dir) ? dir : undefined;
|
|
107491
|
+
}
|
|
107492
|
+
async function copySkillsStore(fs7, sourceDir, targetPath) {
|
|
107481
107493
|
const manifestPath = fs7.path.join(targetPath, MANIFEST_NAME);
|
|
107482
107494
|
let savedManifest = null;
|
|
107483
107495
|
if (await fs7.exists(targetPath)) {
|
|
107484
|
-
savedManifest = await fs7.readFile(manifestPath, {
|
|
107485
|
-
|
|
107486
|
-
|
|
107496
|
+
savedManifest = await fs7.readFile(manifestPath, { encoding: "utf-8" });
|
|
107497
|
+
await fs7.rm(targetPath);
|
|
107498
|
+
}
|
|
107499
|
+
await fs7.mkdir(targetPath);
|
|
107500
|
+
await fs7.copyDirectory(sourceDir, targetPath);
|
|
107501
|
+
if (savedManifest !== null) {
|
|
107502
|
+
await fs7.writeFile(manifestPath, savedManifest);
|
|
107487
107503
|
}
|
|
107504
|
+
}
|
|
107505
|
+
async function fetchSkillsTo(targetPath, _rootDir) {
|
|
107506
|
+
const fs7 = getFileSystem();
|
|
107507
|
+
const [infoErr, resolved] = await catchError(resolveSkillsDownload());
|
|
107508
|
+
if (infoErr || !resolved) {
|
|
107509
|
+
const localStore = await resolveLocalSkillsStore(fs7);
|
|
107510
|
+
if (localStore) {
|
|
107511
|
+
logger.info(`Could not resolve ${SKILLS_PACKAGE_NAME} from a registry (${infoErr?.message ?? "unknown error"}); using the locally-installed package at ${localStore}.`);
|
|
107512
|
+
await copySkillsStore(fs7, localStore, targetPath);
|
|
107513
|
+
return;
|
|
107514
|
+
}
|
|
107515
|
+
throw infoErr ?? new Error(`Could not resolve ${SKILLS_PACKAGE_NAME}.`);
|
|
107516
|
+
}
|
|
107517
|
+
const { pm, packageInfo } = resolved;
|
|
107518
|
+
logger.info(`Downloading ${SKILLS_PACKAGE_NAME}@${packageInfo.version} content store with ${pm}...`);
|
|
107519
|
+
const tmpPath = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-store-${randomUUID5()}`);
|
|
107488
107520
|
try {
|
|
107489
107521
|
await fs7.mkdir(tmpPath);
|
|
107490
|
-
await
|
|
107522
|
+
await materializePackage(pm, packageInfo, tmpPath);
|
|
107491
107523
|
if (!await fs7.exists(fs7.path.join(tmpPath, "skills"))) {
|
|
107492
107524
|
throw new Error(`${SKILLS_PACKAGE_NAME}@${packageInfo.version} does not contain a skills/ directory`);
|
|
107493
107525
|
}
|
|
107494
107526
|
await writeSourceMarker(tmpPath, packageInfo);
|
|
107495
|
-
|
|
107496
|
-
await fs7.rm(targetPath);
|
|
107497
|
-
}
|
|
107498
|
-
await fs7.mkdir(targetPath);
|
|
107499
|
-
await fs7.copyDirectory(tmpPath, targetPath);
|
|
107500
|
-
if (savedManifest !== null) {
|
|
107501
|
-
await fs7.writeFile(manifestPath, savedManifest);
|
|
107502
|
-
}
|
|
107527
|
+
await copySkillsStore(fs7, tmpPath, targetPath);
|
|
107503
107528
|
} finally {
|
|
107504
107529
|
await catchError(fs7.rm(tmpPath));
|
|
107505
107530
|
}
|
|
107506
107531
|
}
|
|
107532
|
+
async function resolveSkillsDownload() {
|
|
107533
|
+
const pm = await resolvePackageManager();
|
|
107534
|
+
const packageInfo = await fetchMatchingSkillsPackageInfo(pm);
|
|
107535
|
+
return { pm, packageInfo };
|
|
107536
|
+
}
|
|
107507
107537
|
async function getContentStore(rootDir) {
|
|
107508
107538
|
const fs7 = getFileSystem();
|
|
107509
107539
|
const storePath = fs7.path.join(rootDir, STORE_NAME);
|
|
@@ -107623,16 +107653,6 @@ async function removeFromManifest(storePath, skillNames, agents) {
|
|
|
107623
107653
|
}
|
|
107624
107654
|
await writeManifest(storePath, manifest);
|
|
107625
107655
|
}
|
|
107626
|
-
function registryPackagePath(packageName) {
|
|
107627
|
-
return packageName.replaceAll("/", "%2f");
|
|
107628
|
-
}
|
|
107629
|
-
function trimTrailingSlashes(value) {
|
|
107630
|
-
let end = value.length;
|
|
107631
|
-
while (end > 0 && value.codePointAt(end - 1) === 47) {
|
|
107632
|
-
end--;
|
|
107633
|
-
}
|
|
107634
|
-
return value.slice(0, end);
|
|
107635
|
-
}
|
|
107636
107656
|
function asRecord(value) {
|
|
107637
107657
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
107638
107658
|
return;
|
|
@@ -107757,45 +107777,57 @@ function matchesCliVersionLine(version2, cliVersion) {
|
|
|
107757
107777
|
function isStableVersion(version2) {
|
|
107758
107778
|
return parseSemver(version2)?.prerelease === undefined;
|
|
107759
107779
|
}
|
|
107760
|
-
function
|
|
107761
|
-
|
|
107762
|
-
return envToken || undefined;
|
|
107780
|
+
function isPackageManager(value) {
|
|
107781
|
+
return PM_PREFERENCE.includes(value);
|
|
107763
107782
|
}
|
|
107764
|
-
function
|
|
107783
|
+
async function resolvePackageManager() {
|
|
107784
|
+
const override = getFileSystem().env.getenv(PM_OVERRIDE_ENV)?.toLowerCase();
|
|
107785
|
+
if (override) {
|
|
107786
|
+
if (!isPackageManager(override)) {
|
|
107787
|
+
throw new Error(`${PM_OVERRIDE_ENV}="${override}" is not supported. Use one of: ${PM_PREFERENCE.join(", ")}.`);
|
|
107788
|
+
}
|
|
107789
|
+
return override;
|
|
107790
|
+
}
|
|
107791
|
+
if (!cachedPackageManager) {
|
|
107792
|
+
cachedPackageManager = detectPackageManager();
|
|
107793
|
+
}
|
|
107794
|
+
return cachedPackageManager;
|
|
107795
|
+
}
|
|
107796
|
+
async function detectPackageManager() {
|
|
107797
|
+
for (const pm of PM_PREFERENCE) {
|
|
107798
|
+
if (await commandOnPath(pm)) {
|
|
107799
|
+
logger.debug(`Using ${pm} to download ${SKILLS_PACKAGE_NAME}`);
|
|
107800
|
+
return pm;
|
|
107801
|
+
}
|
|
107802
|
+
}
|
|
107803
|
+
throw new Error(`No supported package manager found on PATH to download ${SKILLS_PACKAGE_NAME}. Install one of: ${PM_PREFERENCE.join(", ")}.`);
|
|
107804
|
+
}
|
|
107805
|
+
function validatePmArgument(arg) {
|
|
107765
107806
|
if (!SHELL_SAFE_ARG2.test(arg)) {
|
|
107766
|
-
throw new Error(`Unsafe
|
|
107807
|
+
throw new Error(`Unsafe package-manager argument: '${arg}'`);
|
|
107767
107808
|
}
|
|
107768
107809
|
}
|
|
107769
|
-
function
|
|
107810
|
+
function validatePmArguments(args) {
|
|
107770
107811
|
for (const arg of args) {
|
|
107771
|
-
|
|
107812
|
+
validatePmArgument(arg);
|
|
107772
107813
|
}
|
|
107773
107814
|
}
|
|
107774
|
-
function
|
|
107775
|
-
|
|
107776
|
-
Accept: accept,
|
|
107777
|
-
...authToken ? { Authorization: `Bearer ${authToken}` } : {}
|
|
107778
|
-
};
|
|
107779
|
-
}
|
|
107780
|
-
async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
107781
|
-
validateNpmArguments(args);
|
|
107815
|
+
async function runPmCommand(pm, args, label, timeoutMs, cwd, extraEnv) {
|
|
107816
|
+
validatePmArguments(args);
|
|
107782
107817
|
const { spawn: spawn2 } = await loadChildProcess2();
|
|
107783
107818
|
const isWindows = process.platform === "win32";
|
|
107819
|
+
const env = extraEnv ? { ...process.env, ...extraEnv } : undefined;
|
|
107784
107820
|
return await new Promise((resolve2, reject) => {
|
|
107785
107821
|
let proc;
|
|
107786
107822
|
if (isWindows) {
|
|
107787
|
-
|
|
107788
|
-
reject(new Error("Unsafe executable: 'npm'"));
|
|
107789
|
-
return;
|
|
107790
|
-
}
|
|
107791
|
-
const commandLine = ["npm", ...args].join(" ");
|
|
107823
|
+
const commandLine = [pm, ...args].join(" ");
|
|
107792
107824
|
if (!SHELL_SAFE_COMMAND_LINE2.test(commandLine)) {
|
|
107793
107825
|
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
107794
107826
|
return;
|
|
107795
107827
|
}
|
|
107796
|
-
proc = spawn2(commandLine, [], { cwd, shell: true });
|
|
107828
|
+
proc = spawn2(commandLine, [], { cwd, shell: true, env });
|
|
107797
107829
|
} else {
|
|
107798
|
-
proc = spawn2(
|
|
107830
|
+
proc = spawn2(pm, args, { cwd, env });
|
|
107799
107831
|
}
|
|
107800
107832
|
let stdout = "";
|
|
107801
107833
|
let stderr = "";
|
|
@@ -107810,11 +107842,11 @@ async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
|
107810
107842
|
});
|
|
107811
107843
|
const timer = setTimeout(() => {
|
|
107812
107844
|
proc.kill("SIGTERM");
|
|
107813
|
-
reject(new Error(
|
|
107845
|
+
reject(new Error(`${pm} ${label} timed out after ${timeoutMs / 1000}s`));
|
|
107814
107846
|
}, timeoutMs);
|
|
107815
107847
|
proc.on("error", (error51) => {
|
|
107816
107848
|
clearTimeout(timer);
|
|
107817
|
-
reject(
|
|
107849
|
+
reject(mapPmError(pm, label, stderr, error51));
|
|
107818
107850
|
});
|
|
107819
107851
|
proc.on("close", (code) => {
|
|
107820
107852
|
clearTimeout(timer);
|
|
@@ -107822,41 +107854,95 @@ async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
|
107822
107854
|
resolve2(stdout);
|
|
107823
107855
|
return;
|
|
107824
107856
|
}
|
|
107825
|
-
reject(
|
|
107857
|
+
reject(mapPmError(pm, label, stderr, code));
|
|
107826
107858
|
});
|
|
107827
107859
|
});
|
|
107828
107860
|
}
|
|
107829
|
-
function
|
|
107830
|
-
if (/E404
|
|
107861
|
+
function mapPmError(pm, label, stderr, codeOrError) {
|
|
107862
|
+
if (/E404|\b404\b|not found|Couldn't find|no matching version/i.test(stderr)) {
|
|
107831
107863
|
return new Error(`${SKILLS_PACKAGE_NAME} not found in the registry`);
|
|
107832
107864
|
}
|
|
107833
|
-
if (/E401|E403|ENEEDAUTH|need(s)? auth|authentication/i.test(stderr)) {
|
|
107834
|
-
return new Error(`Authentication required for ${SKILLS_PACKAGE_NAME}
|
|
107865
|
+
if (/E401|E403|\b401\b|\b403\b|ENEEDAUTH|unauthor|forbidden|need(s)? auth|authentication/i.test(stderr)) {
|
|
107866
|
+
return new Error(`Authentication required for ${SKILLS_PACKAGE_NAME}. ${REGISTRY_AUTH_HINT}`);
|
|
107835
107867
|
}
|
|
107836
107868
|
const detail = stderr.trim() || (codeOrError instanceof Error ? codeOrError.message : `exit ${codeOrError}`);
|
|
107837
|
-
return new Error(
|
|
107869
|
+
return new Error(`${pm} ${label} failed: ${detail}`);
|
|
107838
107870
|
}
|
|
107839
|
-
function
|
|
107871
|
+
function parsePmJson(pm, stdout, label) {
|
|
107840
107872
|
const [parseError, parsed] = catchError(() => JSON.parse(stdout));
|
|
107841
107873
|
if (parseError) {
|
|
107842
|
-
throw new Error(`Unexpected
|
|
107874
|
+
throw new Error(`Unexpected ${pm} ${label} output`);
|
|
107843
107875
|
}
|
|
107844
107876
|
return parsed;
|
|
107845
107877
|
}
|
|
107846
|
-
async function
|
|
107847
|
-
const
|
|
107848
|
-
|
|
107878
|
+
async function pmViewJson(pm, args) {
|
|
107879
|
+
const label = `view ${args.join(" ")}`;
|
|
107880
|
+
const pmArgs = pm === "bun" ? ["info", ...args, "--json"] : ["view", ...args, "--json"];
|
|
107881
|
+
return await withTempProject(async (dir) => {
|
|
107882
|
+
const stdout = await runPmCommand(pm, pmArgs, label, NPM_VIEW_TIMEOUT_MS2, dir);
|
|
107883
|
+
return parseViewOutput(pm, stdout);
|
|
107884
|
+
});
|
|
107849
107885
|
}
|
|
107850
|
-
function
|
|
107851
|
-
if (
|
|
107852
|
-
return
|
|
107853
|
-
|
|
107854
|
-
|
|
107886
|
+
function parseViewOutput(pm, stdout) {
|
|
107887
|
+
if (!stdout.trim())
|
|
107888
|
+
return;
|
|
107889
|
+
return parsePmJson(pm, stdout, "view");
|
|
107890
|
+
}
|
|
107891
|
+
async function yarnInfo(args) {
|
|
107892
|
+
const label = `info ${args.join(" ")}`;
|
|
107893
|
+
const stdout = await withTempProject((dir) => runPmCommand("yarn", ["info", ...args, "--json"], label, NPM_VIEW_TIMEOUT_MS2, dir));
|
|
107894
|
+
if (!stdout.trim())
|
|
107895
|
+
return;
|
|
107896
|
+
for (const line of stdout.split(`
|
|
107897
|
+
`)) {
|
|
107898
|
+
const trimmed = line.trim();
|
|
107899
|
+
if (!trimmed)
|
|
107900
|
+
continue;
|
|
107901
|
+
const [, parsed] = catchError(() => JSON.parse(trimmed));
|
|
107902
|
+
const record3 = asRecord(parsed);
|
|
107903
|
+
if (record3 && "data" in record3) {
|
|
107904
|
+
return record3.data;
|
|
107905
|
+
}
|
|
107855
107906
|
}
|
|
107856
|
-
|
|
107857
|
-
|
|
107907
|
+
throw new Error(`Unexpected yarn ${label} output`);
|
|
107908
|
+
}
|
|
107909
|
+
async function queryVersions(pm, spec) {
|
|
107910
|
+
const raw = pm === "yarn" ? await yarnInfo([spec, "versions"]) : await pmViewJson(pm, [spec, "versions"]);
|
|
107911
|
+
return normalizeVersionList(raw);
|
|
107912
|
+
}
|
|
107913
|
+
async function pmListVersions(pm, cliVersion) {
|
|
107914
|
+
const primary = await queryVersions(pm, SKILLS_PACKAGE_NAME);
|
|
107915
|
+
if (primary.length > 0)
|
|
107916
|
+
return primary;
|
|
107917
|
+
const lineSpec = `${SKILLS_PACKAGE_NAME}@~${cliVersion.major}.${cliVersion.minor}.0-0`;
|
|
107918
|
+
const [err, versions2] = await catchError(queryVersions(pm, lineSpec));
|
|
107919
|
+
if (err) {
|
|
107920
|
+
logger.debug(`Line-scoped version lookup for ${lineSpec} failed: ${err.message}`);
|
|
107921
|
+
return [];
|
|
107922
|
+
}
|
|
107923
|
+
return versions2;
|
|
107924
|
+
}
|
|
107925
|
+
async function pmResolveTarball(pm, version2) {
|
|
107926
|
+
const spec = `${SKILLS_PACKAGE_NAME}@${version2}`;
|
|
107927
|
+
const [error51, value] = await catchError(pm === "yarn" ? yarnInfo([spec, "dist.tarball"]) : pmViewJson(pm, [spec, "dist.tarball"]));
|
|
107928
|
+
if (error51) {
|
|
107929
|
+
logger.debug(`Could not resolve dist.tarball for ${spec}: ${error51}`);
|
|
107930
|
+
return;
|
|
107858
107931
|
}
|
|
107859
|
-
return
|
|
107932
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
107933
|
+
}
|
|
107934
|
+
function normalizeVersionList(value) {
|
|
107935
|
+
const collected = new Set;
|
|
107936
|
+
const walk = (node2) => {
|
|
107937
|
+
if (typeof node2 === "string") {
|
|
107938
|
+
collected.add(node2);
|
|
107939
|
+
} else if (Array.isArray(node2)) {
|
|
107940
|
+
for (const child of node2)
|
|
107941
|
+
walk(child);
|
|
107942
|
+
}
|
|
107943
|
+
};
|
|
107944
|
+
walk(value);
|
|
107945
|
+
return [...collected];
|
|
107860
107946
|
}
|
|
107861
107947
|
function requireString(value, message) {
|
|
107862
107948
|
if (typeof value !== "string" || value.length === 0) {
|
|
@@ -107868,31 +107954,22 @@ function registryFromTarball(tarballUrl) {
|
|
|
107868
107954
|
const [urlError, parsedUrl] = catchError(() => new URL(tarballUrl));
|
|
107869
107955
|
return urlError ? SKILLS_REGISTRY_URL : parsedUrl.origin;
|
|
107870
107956
|
}
|
|
107871
|
-
async function
|
|
107872
|
-
const response = await fetch(url2, {
|
|
107873
|
-
headers: packageFetchHeaders("application/json", authToken),
|
|
107874
|
-
signal: AbortSignal.timeout(60000)
|
|
107875
|
-
});
|
|
107876
|
-
if (!response.ok) {
|
|
107877
|
-
throw new Error(`Registry returned ${response.status} ${response.statusText} for ${SKILLS_PACKAGE_NAME}`);
|
|
107878
|
-
}
|
|
107879
|
-
const data = asRecord(await response.json());
|
|
107880
|
-
if (!data) {
|
|
107881
|
-
throw new Error(`Registry returned invalid metadata for ${SKILLS_PACKAGE_NAME}`);
|
|
107882
|
-
}
|
|
107883
|
-
return data;
|
|
107884
|
-
}
|
|
107885
|
-
async function fetchMatchingSkillsPackageInfo() {
|
|
107957
|
+
async function fetchMatchingSkillsPackageInfo(pm) {
|
|
107886
107958
|
const cliVersion = parseSemver(package_default.version);
|
|
107887
107959
|
if (!cliVersion) {
|
|
107888
107960
|
throw new Error(`Invalid CLI version ${package_default.version}; expected semantic version major.minor.patch`);
|
|
107889
107961
|
}
|
|
107890
|
-
const
|
|
107891
|
-
|
|
107892
|
-
|
|
107893
|
-
|
|
107894
|
-
|
|
107895
|
-
|
|
107962
|
+
const versions2 = await pmListVersions(pm, cliVersion);
|
|
107963
|
+
const selectedVersion = pickMatchingSkillsVersion(versions2, cliVersion);
|
|
107964
|
+
const tarballUrl = pm === "npm" || pm === "pnpm" ? requireString(await pmViewJson(pm, [
|
|
107965
|
+
`${SKILLS_PACKAGE_NAME}@${selectedVersion}`,
|
|
107966
|
+
"dist.tarball"
|
|
107967
|
+
]), `${SKILLS_PACKAGE_NAME}@${selectedVersion} does not declare dist.tarball`) : await pmResolveTarball(pm, selectedVersion);
|
|
107968
|
+
return {
|
|
107969
|
+
version: selectedVersion,
|
|
107970
|
+
tarballUrl: tarballUrl ?? "",
|
|
107971
|
+
registryUrl: tarballUrl ? registryFromTarball(tarballUrl) : SKILLS_REGISTRY_URL
|
|
107972
|
+
};
|
|
107896
107973
|
}
|
|
107897
107974
|
function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
107898
107975
|
const matchingVersions = versions2.filter((version2) => matchesCliVersionLine(version2, cliVersion));
|
|
@@ -107903,64 +107980,32 @@ function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
|
107903
107980
|
}
|
|
107904
107981
|
return selectedVersion;
|
|
107905
107982
|
}
|
|
107906
|
-
async function
|
|
107907
|
-
const
|
|
107908
|
-
const
|
|
107909
|
-
|
|
107910
|
-
|
|
107911
|
-
"
|
|
107912
|
-
|
|
107913
|
-
|
|
107914
|
-
|
|
107915
|
-
|
|
107916
|
-
registryUrl: registryFromTarball(tarballUrl)
|
|
107917
|
-
};
|
|
107918
|
-
}
|
|
107919
|
-
async function fetchMatchingSkillsPackageInfoFromRegistry(cliVersion, registryUrl, authToken) {
|
|
107920
|
-
const [urlError] = catchError(() => new URL(registryUrl));
|
|
107921
|
-
if (urlError) {
|
|
107922
|
-
throw new Error(`Invalid registry URL: "${registryUrl}"`);
|
|
107923
|
-
}
|
|
107924
|
-
const url2 = `${trimTrailingSlashes(registryUrl)}/${registryPackagePath(SKILLS_PACKAGE_NAME)}`;
|
|
107925
|
-
const data = await fetchJson(url2, authToken);
|
|
107926
|
-
const versions2 = asRecord(data.versions);
|
|
107927
|
-
const selectedVersion = pickMatchingSkillsVersion(Object.keys(versions2 ?? {}), cliVersion);
|
|
107928
|
-
const selectedPackageVersion = asRecord(versions2?.[selectedVersion]);
|
|
107929
|
-
const dist = asRecord(selectedPackageVersion?.dist);
|
|
107930
|
-
const tarballUrl = typeof dist?.tarball === "string" ? dist.tarball : undefined;
|
|
107931
|
-
if (!tarballUrl) {
|
|
107932
|
-
throw new Error(`${SKILLS_PACKAGE_NAME}@${selectedVersion} does not declare dist.tarball`);
|
|
107983
|
+
async function withTempProject(fn) {
|
|
107984
|
+
const fs7 = getFileSystem();
|
|
107985
|
+
const projectDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pm-${randomUUID5()}`);
|
|
107986
|
+
try {
|
|
107987
|
+
await fs7.mkdir(projectDir);
|
|
107988
|
+
await fs7.writeFile(fs7.path.join(projectDir, "package.json"), `${JSON.stringify({ name: "uipath-skills-fetch", version: "0.0.0", private: true }, null, 2)}
|
|
107989
|
+
`);
|
|
107990
|
+
return await fn(projectDir);
|
|
107991
|
+
} finally {
|
|
107992
|
+
await catchError(fs7.rm(projectDir));
|
|
107933
107993
|
}
|
|
107934
|
-
return {
|
|
107935
|
-
version: selectedVersion,
|
|
107936
|
-
tarballUrl,
|
|
107937
|
-
registryUrl,
|
|
107938
|
-
authToken
|
|
107939
|
-
};
|
|
107940
107994
|
}
|
|
107941
|
-
async function
|
|
107942
|
-
if (
|
|
107943
|
-
await
|
|
107995
|
+
async function materializePackage(pm, packageInfo, destinationPath) {
|
|
107996
|
+
if (pm === "npm") {
|
|
107997
|
+
await packAndExtractWithNpm(packageInfo, destinationPath);
|
|
107944
107998
|
return;
|
|
107945
107999
|
}
|
|
107946
|
-
|
|
107947
|
-
headers: packageFetchHeaders("application/octet-stream", packageInfo.authToken),
|
|
107948
|
-
signal: AbortSignal.timeout(60000)
|
|
107949
|
-
});
|
|
107950
|
-
if (!response.ok) {
|
|
107951
|
-
throw new Error(`Failed to download ${SKILLS_PACKAGE_NAME}@${packageInfo.version}: ${response.status} ${response.statusText}`);
|
|
107952
|
-
}
|
|
107953
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
107954
|
-
const tarData = gunzipSync(new Uint8Array(arrayBuffer));
|
|
107955
|
-
await extractNpmTarballToDir(tarData, destinationPath);
|
|
108000
|
+
await addAndCopyPackage(pm, packageInfo, destinationPath);
|
|
107956
108001
|
}
|
|
107957
|
-
async function
|
|
108002
|
+
async function packAndExtractWithNpm(packageInfo, destinationPath) {
|
|
107958
108003
|
const fs7 = getFileSystem();
|
|
107959
108004
|
const packDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pack-${randomUUID5()}`);
|
|
107960
108005
|
try {
|
|
107961
108006
|
await fs7.mkdir(packDir);
|
|
107962
|
-
const stdout = await
|
|
107963
|
-
const packOutput =
|
|
108007
|
+
const stdout = await runPmCommand("npm", ["pack", `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, "--json"], `pack ${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, NPM_PACK_TIMEOUT_MS, packDir);
|
|
108008
|
+
const packOutput = parsePmJson("npm", stdout, "pack");
|
|
107964
108009
|
const packedFile = readPackedFileName(packOutput);
|
|
107965
108010
|
const packedPath = fs7.path.join(packDir, packedFile);
|
|
107966
108011
|
const packedContent = await fs7.readFile(packedPath);
|
|
@@ -107973,6 +108018,20 @@ async function packAndExtractPackage(packageInfo, destinationPath) {
|
|
|
107973
108018
|
await catchError(fs7.rm(packDir));
|
|
107974
108019
|
}
|
|
107975
108020
|
}
|
|
108021
|
+
async function addAndCopyPackage(pm, packageInfo, destinationPath) {
|
|
108022
|
+
const fs7 = getFileSystem();
|
|
108023
|
+
const spec = `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`;
|
|
108024
|
+
const extraEnv = pm === "yarn" ? { YARN_NODE_LINKER: "node-modules" } : undefined;
|
|
108025
|
+
await withTempProject(async (projectDir) => {
|
|
108026
|
+
await runPmCommand(pm, ["add", spec, "--ignore-scripts"], `add ${spec}`, NPM_PACK_TIMEOUT_MS, projectDir, extraEnv);
|
|
108027
|
+
const installed = fs7.path.join(projectDir, "node_modules", SKILLS_PACKAGE_NAME);
|
|
108028
|
+
if (!await fs7.exists(installed)) {
|
|
108029
|
+
throw new Error(`${pm} add did not install ${SKILLS_PACKAGE_NAME}`);
|
|
108030
|
+
}
|
|
108031
|
+
const realInstalled = await fs7.realpath(installed);
|
|
108032
|
+
await fs7.copyDirectory(realInstalled, destinationPath);
|
|
108033
|
+
});
|
|
108034
|
+
}
|
|
107976
108035
|
function readPackedFileName(packOutput) {
|
|
107977
108036
|
if (!Array.isArray(packOutput)) {
|
|
107978
108037
|
throw new TypeError(`Unexpected npm pack output for ${SKILLS_PACKAGE_NAME}`);
|
|
@@ -108151,15 +108210,17 @@ async function extractNpmTarballToDir(tarData, destinationDir) {
|
|
|
108151
108210
|
await extractTarEntry2(fs7, destinationDir, entryName, entry);
|
|
108152
108211
|
}
|
|
108153
108212
|
}
|
|
108154
|
-
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org",
|
|
108213
|
+
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org", 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, PM_PREFERENCE, PM_OVERRIDE_ENV = "UIP_SKILLS_PM", childProcessModulePromise2, MANIFEST_NAME = "manifest.json", cachedPackageManager = null, REGISTRY_AUTH_HINT = "The package manager could not authenticate to the registry. If you are installing an alpha/internal build from GitHub Packages, add to your .npmrc: '@uipath:registry=https://npm.pkg.github.com/' and '//npm.pkg.github.com/:_authToken=<token>', where <token> is a GitHub PAT with the 'read:packages' scope, authorized for the UiPath org via 'Configure SSO'. This is a different credential from your 'uip login' token.";
|
|
108155
108214
|
var init_contentStore = __esm(() => {
|
|
108156
108215
|
init_src2();
|
|
108157
108216
|
init_src();
|
|
108158
108217
|
init_js_yaml();
|
|
108159
108218
|
init_package();
|
|
108219
|
+
init_detect();
|
|
108160
108220
|
STORE_NAME = `${UIPATH_HOME_DIR}/.skills`;
|
|
108161
|
-
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._
|
|
108162
|
-
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._
|
|
108221
|
+
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._~-]+$/;
|
|
108222
|
+
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._~\- ]+$/;
|
|
108223
|
+
PM_PREFERENCE = ["npm", "pnpm", "bun", "yarn"];
|
|
108163
108224
|
});
|
|
108164
108225
|
|
|
108165
108226
|
// src/commands/skills/agents/claude.ts
|
|
@@ -108956,17 +109017,6 @@ async function resolveSkillsContext(options, operation) {
|
|
|
108956
109017
|
const isLocal = !!options.local;
|
|
108957
109018
|
const fs7 = getFileSystem();
|
|
108958
109019
|
const rootDir = isLocal ? fs7.env.cwd() : fs7.env.homedir();
|
|
108959
|
-
const storePath = await getContentStore(rootDir);
|
|
108960
|
-
const availableSkills = await getAvailableSkills(storePath);
|
|
108961
|
-
const selectedSkills = availableSkills.filter((skill) => skill.name !== SKILL_CATALOG_SKILL_NAME);
|
|
108962
|
-
if (selectedSkills.length === 0) {
|
|
108963
|
-
OutputFormatter.error({
|
|
108964
|
-
Result: RESULTS.ConfigError,
|
|
108965
|
-
Message: "No skills found in content store.",
|
|
108966
|
-
Instructions: "Check that the @uipath/skills package contains skills in the skills/ directory."
|
|
108967
|
-
});
|
|
108968
|
-
return null;
|
|
108969
|
-
}
|
|
108970
109020
|
let agents;
|
|
108971
109021
|
if (options.agent) {
|
|
108972
109022
|
const agent = options.agent.trim().toLowerCase();
|
|
@@ -109001,6 +109051,17 @@ async function resolveSkillsContext(options, operation) {
|
|
|
109001
109051
|
agents = selected;
|
|
109002
109052
|
}
|
|
109003
109053
|
}
|
|
109054
|
+
const storePath = await getContentStore(rootDir);
|
|
109055
|
+
const availableSkills = await getAvailableSkills(storePath);
|
|
109056
|
+
const selectedSkills = availableSkills.filter((skill) => skill.name !== SKILL_CATALOG_SKILL_NAME);
|
|
109057
|
+
if (selectedSkills.length === 0) {
|
|
109058
|
+
OutputFormatter.error({
|
|
109059
|
+
Result: RESULTS.ConfigError,
|
|
109060
|
+
Message: "No skills found in content store.",
|
|
109061
|
+
Instructions: "Check that the @uipath/skills package contains skills in the skills/ directory."
|
|
109062
|
+
});
|
|
109063
|
+
return null;
|
|
109064
|
+
}
|
|
109004
109065
|
return { rootDir, storePath, selectedSkills, agents, isLocal };
|
|
109005
109066
|
}
|
|
109006
109067
|
async function detectInstalledAgents(isLocal) {
|
|
@@ -115086,16 +115147,16 @@ async function resolveToolsDirectories(context) {
|
|
|
115086
115147
|
return { toolsDirs, toolsDir };
|
|
115087
115148
|
}
|
|
115088
115149
|
logger.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
|
|
115089
|
-
const { dirname:
|
|
115150
|
+
const { dirname: dirname3, join: join2 } = fs7.path;
|
|
115090
115151
|
const isInstalledPackage = process.execPath.includes(join2("@uipath", "cli", "dist", "uip"));
|
|
115091
115152
|
if (isInstalledPackage) {
|
|
115092
|
-
const execDir =
|
|
115093
|
-
const packageDir =
|
|
115094
|
-
const fallbackDir2 =
|
|
115153
|
+
const execDir = dirname3(process.execPath);
|
|
115154
|
+
const packageDir = dirname3(execDir);
|
|
115155
|
+
const fallbackDir2 = dirname3(packageDir);
|
|
115095
115156
|
logger.debug(`Fallback (installed package): ${fallbackDir2}`);
|
|
115096
115157
|
return { toolsDirs: [fallbackDir2], toolsDir: fallbackDir2 };
|
|
115097
115158
|
}
|
|
115098
|
-
const fallbackDir = join2(
|
|
115159
|
+
const fallbackDir = join2(dirname3(currentFilePath), "..");
|
|
115099
115160
|
logger.debug(`Fallback (development mode): ${fallbackDir}`);
|
|
115100
115161
|
return { toolsDirs: [fallbackDir], toolsDir: fallbackDir };
|
|
115101
115162
|
}
|
|
@@ -115356,4 +115417,4 @@ export {
|
|
|
115356
115417
|
ready
|
|
115357
115418
|
};
|
|
115358
115419
|
|
|
115359
|
-
//# debugId=
|
|
115420
|
+
//# debugId=48870C304BA2D49064756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/cli",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.197.0-preview.
|
|
4
|
+
"version": "1.197.0-preview.71",
|
|
5
5
|
"description": "Cross platform CLI for UiPath",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"mihaigirleanu",
|
|
35
35
|
"vlad-uipath"
|
|
36
36
|
],
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "3cb058aea3fcde38dd3811ebba5eae53851de17c"
|
|
38
38
|
}
|