@uipath/cli 1.197.0-preview.68 → 1.197.0-preview.70
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 +212 -153
- 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.70",
|
|
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
|
-
|
|
107780
|
+
function isPackageManager(value) {
|
|
107781
|
+
return PM_PREFERENCE.includes(value);
|
|
107782
|
+
}
|
|
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;
|
|
107763
107795
|
}
|
|
107764
|
-
function
|
|
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,30 +107854,82 @@ 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
|
+
});
|
|
107885
|
+
}
|
|
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
|
+
}
|
|
107906
|
+
}
|
|
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;
|
|
107931
|
+
}
|
|
107932
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
107849
107933
|
}
|
|
107850
107934
|
function normalizeVersionList(value) {
|
|
107851
107935
|
if (Array.isArray(value)) {
|
|
@@ -107868,31 +107952,22 @@ function registryFromTarball(tarballUrl) {
|
|
|
107868
107952
|
const [urlError, parsedUrl] = catchError(() => new URL(tarballUrl));
|
|
107869
107953
|
return urlError ? SKILLS_REGISTRY_URL : parsedUrl.origin;
|
|
107870
107954
|
}
|
|
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() {
|
|
107955
|
+
async function fetchMatchingSkillsPackageInfo(pm) {
|
|
107886
107956
|
const cliVersion = parseSemver(package_default.version);
|
|
107887
107957
|
if (!cliVersion) {
|
|
107888
107958
|
throw new Error(`Invalid CLI version ${package_default.version}; expected semantic version major.minor.patch`);
|
|
107889
107959
|
}
|
|
107890
|
-
const
|
|
107891
|
-
|
|
107892
|
-
|
|
107893
|
-
|
|
107894
|
-
|
|
107895
|
-
|
|
107960
|
+
const versions2 = await pmListVersions(pm, cliVersion);
|
|
107961
|
+
const selectedVersion = pickMatchingSkillsVersion(versions2, cliVersion);
|
|
107962
|
+
const tarballUrl = pm === "npm" || pm === "pnpm" ? requireString(await pmViewJson(pm, [
|
|
107963
|
+
`${SKILLS_PACKAGE_NAME}@${selectedVersion}`,
|
|
107964
|
+
"dist.tarball"
|
|
107965
|
+
]), `${SKILLS_PACKAGE_NAME}@${selectedVersion} does not declare dist.tarball`) : await pmResolveTarball(pm, selectedVersion);
|
|
107966
|
+
return {
|
|
107967
|
+
version: selectedVersion,
|
|
107968
|
+
tarballUrl: tarballUrl ?? "",
|
|
107969
|
+
registryUrl: tarballUrl ? registryFromTarball(tarballUrl) : SKILLS_REGISTRY_URL
|
|
107970
|
+
};
|
|
107896
107971
|
}
|
|
107897
107972
|
function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
107898
107973
|
const matchingVersions = versions2.filter((version2) => matchesCliVersionLine(version2, cliVersion));
|
|
@@ -107903,64 +107978,32 @@ function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
|
107903
107978
|
}
|
|
107904
107979
|
return selectedVersion;
|
|
107905
107980
|
}
|
|
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`);
|
|
107981
|
+
async function withTempProject(fn) {
|
|
107982
|
+
const fs7 = getFileSystem();
|
|
107983
|
+
const projectDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pm-${randomUUID5()}`);
|
|
107984
|
+
try {
|
|
107985
|
+
await fs7.mkdir(projectDir);
|
|
107986
|
+
await fs7.writeFile(fs7.path.join(projectDir, "package.json"), `${JSON.stringify({ name: "uipath-skills-fetch", version: "0.0.0", private: true }, null, 2)}
|
|
107987
|
+
`);
|
|
107988
|
+
return await fn(projectDir);
|
|
107989
|
+
} finally {
|
|
107990
|
+
await catchError(fs7.rm(projectDir));
|
|
107933
107991
|
}
|
|
107934
|
-
return {
|
|
107935
|
-
version: selectedVersion,
|
|
107936
|
-
tarballUrl,
|
|
107937
|
-
registryUrl,
|
|
107938
|
-
authToken
|
|
107939
|
-
};
|
|
107940
107992
|
}
|
|
107941
|
-
async function
|
|
107942
|
-
if (
|
|
107943
|
-
await
|
|
107993
|
+
async function materializePackage(pm, packageInfo, destinationPath) {
|
|
107994
|
+
if (pm === "npm") {
|
|
107995
|
+
await packAndExtractWithNpm(packageInfo, destinationPath);
|
|
107944
107996
|
return;
|
|
107945
107997
|
}
|
|
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);
|
|
107998
|
+
await addAndCopyPackage(pm, packageInfo, destinationPath);
|
|
107956
107999
|
}
|
|
107957
|
-
async function
|
|
108000
|
+
async function packAndExtractWithNpm(packageInfo, destinationPath) {
|
|
107958
108001
|
const fs7 = getFileSystem();
|
|
107959
108002
|
const packDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pack-${randomUUID5()}`);
|
|
107960
108003
|
try {
|
|
107961
108004
|
await fs7.mkdir(packDir);
|
|
107962
|
-
const stdout = await
|
|
107963
|
-
const packOutput =
|
|
108005
|
+
const stdout = await runPmCommand("npm", ["pack", `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, "--json"], `pack ${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, NPM_PACK_TIMEOUT_MS, packDir);
|
|
108006
|
+
const packOutput = parsePmJson("npm", stdout, "pack");
|
|
107964
108007
|
const packedFile = readPackedFileName(packOutput);
|
|
107965
108008
|
const packedPath = fs7.path.join(packDir, packedFile);
|
|
107966
108009
|
const packedContent = await fs7.readFile(packedPath);
|
|
@@ -107973,6 +108016,20 @@ async function packAndExtractPackage(packageInfo, destinationPath) {
|
|
|
107973
108016
|
await catchError(fs7.rm(packDir));
|
|
107974
108017
|
}
|
|
107975
108018
|
}
|
|
108019
|
+
async function addAndCopyPackage(pm, packageInfo, destinationPath) {
|
|
108020
|
+
const fs7 = getFileSystem();
|
|
108021
|
+
const spec = `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`;
|
|
108022
|
+
const extraEnv = pm === "yarn" ? { YARN_NODE_LINKER: "node-modules" } : undefined;
|
|
108023
|
+
await withTempProject(async (projectDir) => {
|
|
108024
|
+
await runPmCommand(pm, ["add", spec, "--ignore-scripts"], `add ${spec}`, NPM_PACK_TIMEOUT_MS, projectDir, extraEnv);
|
|
108025
|
+
const installed = fs7.path.join(projectDir, "node_modules", SKILLS_PACKAGE_NAME);
|
|
108026
|
+
if (!await fs7.exists(installed)) {
|
|
108027
|
+
throw new Error(`${pm} add did not install ${SKILLS_PACKAGE_NAME}`);
|
|
108028
|
+
}
|
|
108029
|
+
const realInstalled = await fs7.realpath(installed);
|
|
108030
|
+
await fs7.copyDirectory(realInstalled, destinationPath);
|
|
108031
|
+
});
|
|
108032
|
+
}
|
|
107976
108033
|
function readPackedFileName(packOutput) {
|
|
107977
108034
|
if (!Array.isArray(packOutput)) {
|
|
107978
108035
|
throw new TypeError(`Unexpected npm pack output for ${SKILLS_PACKAGE_NAME}`);
|
|
@@ -108151,15 +108208,17 @@ async function extractNpmTarballToDir(tarData, destinationDir) {
|
|
|
108151
108208
|
await extractTarEntry2(fs7, destinationDir, entryName, entry);
|
|
108152
108209
|
}
|
|
108153
108210
|
}
|
|
108154
|
-
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org",
|
|
108211
|
+
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
108212
|
var init_contentStore = __esm(() => {
|
|
108156
108213
|
init_src2();
|
|
108157
108214
|
init_src();
|
|
108158
108215
|
init_js_yaml();
|
|
108159
108216
|
init_package();
|
|
108217
|
+
init_detect();
|
|
108160
108218
|
STORE_NAME = `${UIPATH_HOME_DIR}/.skills`;
|
|
108161
|
-
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._
|
|
108162
|
-
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._
|
|
108219
|
+
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._~-]+$/;
|
|
108220
|
+
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._~\- ]+$/;
|
|
108221
|
+
PM_PREFERENCE = ["npm", "pnpm", "bun", "yarn"];
|
|
108163
108222
|
});
|
|
108164
108223
|
|
|
108165
108224
|
// src/commands/skills/agents/claude.ts
|
|
@@ -108956,17 +109015,6 @@ async function resolveSkillsContext(options, operation) {
|
|
|
108956
109015
|
const isLocal = !!options.local;
|
|
108957
109016
|
const fs7 = getFileSystem();
|
|
108958
109017
|
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
109018
|
let agents;
|
|
108971
109019
|
if (options.agent) {
|
|
108972
109020
|
const agent = options.agent.trim().toLowerCase();
|
|
@@ -109001,6 +109049,17 @@ async function resolveSkillsContext(options, operation) {
|
|
|
109001
109049
|
agents = selected;
|
|
109002
109050
|
}
|
|
109003
109051
|
}
|
|
109052
|
+
const storePath = await getContentStore(rootDir);
|
|
109053
|
+
const availableSkills = await getAvailableSkills(storePath);
|
|
109054
|
+
const selectedSkills = availableSkills.filter((skill) => skill.name !== SKILL_CATALOG_SKILL_NAME);
|
|
109055
|
+
if (selectedSkills.length === 0) {
|
|
109056
|
+
OutputFormatter.error({
|
|
109057
|
+
Result: RESULTS.ConfigError,
|
|
109058
|
+
Message: "No skills found in content store.",
|
|
109059
|
+
Instructions: "Check that the @uipath/skills package contains skills in the skills/ directory."
|
|
109060
|
+
});
|
|
109061
|
+
return null;
|
|
109062
|
+
}
|
|
109004
109063
|
return { rootDir, storePath, selectedSkills, agents, isLocal };
|
|
109005
109064
|
}
|
|
109006
109065
|
async function detectInstalledAgents(isLocal) {
|
|
@@ -115086,16 +115145,16 @@ async function resolveToolsDirectories(context) {
|
|
|
115086
115145
|
return { toolsDirs, toolsDir };
|
|
115087
115146
|
}
|
|
115088
115147
|
logger.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
|
|
115089
|
-
const { dirname:
|
|
115148
|
+
const { dirname: dirname3, join: join2 } = fs7.path;
|
|
115090
115149
|
const isInstalledPackage = process.execPath.includes(join2("@uipath", "cli", "dist", "uip"));
|
|
115091
115150
|
if (isInstalledPackage) {
|
|
115092
|
-
const execDir =
|
|
115093
|
-
const packageDir =
|
|
115094
|
-
const fallbackDir2 =
|
|
115151
|
+
const execDir = dirname3(process.execPath);
|
|
115152
|
+
const packageDir = dirname3(execDir);
|
|
115153
|
+
const fallbackDir2 = dirname3(packageDir);
|
|
115095
115154
|
logger.debug(`Fallback (installed package): ${fallbackDir2}`);
|
|
115096
115155
|
return { toolsDirs: [fallbackDir2], toolsDir: fallbackDir2 };
|
|
115097
115156
|
}
|
|
115098
|
-
const fallbackDir = join2(
|
|
115157
|
+
const fallbackDir = join2(dirname3(currentFilePath), "..");
|
|
115099
115158
|
logger.debug(`Fallback (development mode): ${fallbackDir}`);
|
|
115100
115159
|
return { toolsDirs: [fallbackDir], toolsDir: fallbackDir };
|
|
115101
115160
|
}
|
|
@@ -115356,4 +115415,4 @@ export {
|
|
|
115356
115415
|
ready
|
|
115357
115416
|
};
|
|
115358
115417
|
|
|
115359
|
-
//# debugId=
|
|
115418
|
+
//# debugId=C75D6DF22C043EE264756E2164756E21
|
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.70",
|
|
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": "d681f04331bf787e58d1ed16c1ff0561283d7515"
|
|
38
38
|
}
|