@uipath/cli 1.197.0-preview.67 → 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 +232 -214
- 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);
|
|
107487
107498
|
}
|
|
107499
|
+
await fs7.mkdir(targetPath);
|
|
107500
|
+
await fs7.copyDirectory(sourceDir, targetPath);
|
|
107501
|
+
if (savedManifest !== null) {
|
|
107502
|
+
await fs7.writeFile(manifestPath, savedManifest);
|
|
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;
|
|
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(", ")}.`);
|
|
107763
107804
|
}
|
|
107764
|
-
function
|
|
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,44 +108208,43 @@ 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
|
|
108166
108225
|
import { spawn as spawn2 } from "node:child_process";
|
|
108226
|
+
function samePath(a, b) {
|
|
108227
|
+
const norm = (p) => {
|
|
108228
|
+
const forward = p.replaceAll("\\", "/").replace(/\/+$/, "");
|
|
108229
|
+
return process.platform === "win32" ? forward.toLowerCase() : forward;
|
|
108230
|
+
};
|
|
108231
|
+
return norm(a) === norm(b);
|
|
108232
|
+
}
|
|
108167
108233
|
function claudeConfigDir() {
|
|
108168
108234
|
const fs7 = getFileSystem();
|
|
108169
108235
|
const override = fs7.env.getenv("CLAUDE_CONFIG_DIR");
|
|
108170
108236
|
return override?.trim() ? override : fs7.path.join(fs7.env.homedir(), ".claude");
|
|
108171
108237
|
}
|
|
108172
|
-
function
|
|
108173
|
-
|
|
108174
|
-
const count = Number.isInteger(existing) && existing >= 0 ? existing : 0;
|
|
108175
|
-
return {
|
|
108176
|
-
...env,
|
|
108177
|
-
GIT_CONFIG_COUNT: String(count + 1),
|
|
108178
|
-
[`GIT_CONFIG_KEY_${count}`]: "core.longpaths",
|
|
108179
|
-
[`GIT_CONFIG_VALUE_${count}`]: "true"
|
|
108180
|
-
};
|
|
108238
|
+
function quoteForWinShell(arg) {
|
|
108239
|
+
return /\s/.test(arg) ? `"${arg}"` : arg;
|
|
108181
108240
|
}
|
|
108182
108241
|
function runClaude(args) {
|
|
108183
108242
|
return new Promise((resolve2, reject) => {
|
|
108184
|
-
const
|
|
108185
|
-
const proc = process.platform === "win32" ? spawn2(["claude", ...args].join(" "), [], {
|
|
108243
|
+
const proc = process.platform === "win32" ? spawn2(["claude", ...args.map(quoteForWinShell)].join(" "), [], {
|
|
108186
108244
|
stdio: ["inherit", "pipe", "pipe"],
|
|
108187
|
-
shell: true
|
|
108188
|
-
env
|
|
108245
|
+
shell: true
|
|
108189
108246
|
}) : spawn2("claude", [...args], {
|
|
108190
|
-
stdio: ["inherit", "pipe", "pipe"]
|
|
108191
|
-
env
|
|
108247
|
+
stdio: ["inherit", "pipe", "pipe"]
|
|
108192
108248
|
});
|
|
108193
108249
|
let stderr = "";
|
|
108194
108250
|
proc.stdout?.on("data", (d) => {
|
|
@@ -108236,42 +108292,7 @@ async function removeLegacySkillCopies(storePath, rootDir) {
|
|
|
108236
108292
|
}
|
|
108237
108293
|
}
|
|
108238
108294
|
}
|
|
108239
|
-
async function
|
|
108240
|
-
const fs7 = getFileSystem();
|
|
108241
|
-
const settingsPath = fs7.path.join(claudeConfigDir(), "settings.json");
|
|
108242
|
-
let raw = "{}";
|
|
108243
|
-
if (await fs7.exists(settingsPath)) {
|
|
108244
|
-
const [readErr, value] = await catchError(fs7.readFile(settingsPath, { encoding: "utf-8" }));
|
|
108245
|
-
if (readErr) {
|
|
108246
|
-
logger.warn(` claude: could not read ${settingsPath} — skipping autoUpdate flag: ${readErr.message}`);
|
|
108247
|
-
return;
|
|
108248
|
-
}
|
|
108249
|
-
raw = value;
|
|
108250
|
-
}
|
|
108251
|
-
const [parseErr, parsed] = catchError(() => JSON.parse(raw || "{}"));
|
|
108252
|
-
if (parseErr || !parsed) {
|
|
108253
|
-
logger.warn(` claude: could not parse ${settingsPath} — skipping autoUpdate flag`);
|
|
108254
|
-
return;
|
|
108255
|
-
}
|
|
108256
|
-
parsed.extraKnownMarketplaces ??= {};
|
|
108257
|
-
const mks = parsed.extraKnownMarketplaces;
|
|
108258
|
-
mks[MARKETPLACE_NAME] ??= {};
|
|
108259
|
-
const entry = mks[MARKETPLACE_NAME];
|
|
108260
|
-
const desiredSource = { source: "git", url: MARKETPLACE_URL };
|
|
108261
|
-
const sourceMatches = JSON.stringify(entry.source) === JSON.stringify(desiredSource);
|
|
108262
|
-
if (entry.autoUpdate === true && sourceMatches)
|
|
108263
|
-
return;
|
|
108264
|
-
entry.autoUpdate = true;
|
|
108265
|
-
entry.source = desiredSource;
|
|
108266
|
-
const [writeErr] = await catchError(fs7.writeFile(settingsPath, `${JSON.stringify(parsed, null, 2)}
|
|
108267
|
-
`));
|
|
108268
|
-
if (writeErr) {
|
|
108269
|
-
logger.warn(` claude: could not write ${settingsPath} — autoUpdate flag not set: ${writeErr.message}`);
|
|
108270
|
-
return;
|
|
108271
|
-
}
|
|
108272
|
-
logger.info(` claude: enabled auto-update for marketplace ${MARKETPLACE_NAME}`);
|
|
108273
|
-
}
|
|
108274
|
-
async function isHttpsMarketplaceRegistered() {
|
|
108295
|
+
async function isDirectoryMarketplaceRegistered(storePath) {
|
|
108275
108296
|
const fs7 = getFileSystem();
|
|
108276
108297
|
const registryPath = fs7.path.join(claudeConfigDir(), "plugins", "known_marketplaces.json");
|
|
108277
108298
|
if (!await fs7.exists(registryPath))
|
|
@@ -108283,7 +108304,7 @@ async function isHttpsMarketplaceRegistered() {
|
|
|
108283
108304
|
if (parseErr || !parsed)
|
|
108284
108305
|
return false;
|
|
108285
108306
|
const source = parsed[MARKETPLACE_NAME]?.source;
|
|
108286
|
-
return source?.source === "
|
|
108307
|
+
return source?.source === "directory" && !!source.path && samePath(source.path, storePath);
|
|
108287
108308
|
}
|
|
108288
108309
|
function marketplacesCacheDir() {
|
|
108289
108310
|
const fs7 = getFileSystem();
|
|
@@ -108304,10 +108325,10 @@ async function removeStaleMarketplaceCache() {
|
|
|
108304
108325
|
}
|
|
108305
108326
|
}
|
|
108306
108327
|
}
|
|
108307
|
-
async function
|
|
108308
|
-
if (await
|
|
108328
|
+
async function ensureDirectoryMarketplace(storePath) {
|
|
108329
|
+
if (await isDirectoryMarketplaceRegistered(storePath))
|
|
108309
108330
|
return;
|
|
108310
|
-
const addArgs = ["plugin", "marketplace", "add",
|
|
108331
|
+
const addArgs = ["plugin", "marketplace", "add", storePath];
|
|
108311
108332
|
const [addErr] = await catchError(runClaude(addArgs));
|
|
108312
108333
|
if (!addErr)
|
|
108313
108334
|
return;
|
|
@@ -108322,13 +108343,12 @@ async function ensureHttpsMarketplace() {
|
|
|
108322
108343
|
instructions: `Close all running Claude Code sessions, delete ${getFileSystem().path.join(marketplacesCacheDir(), MARKETPLACE_NAME)} if it still exists, then re-run this command. ` + "If it keeps failing, an antivirus or another process is locking the directory."
|
|
108323
108344
|
});
|
|
108324
108345
|
}
|
|
108325
|
-
var
|
|
108346
|
+
var MARKETPLACE_NAME = "uipath-marketplace", PLUGIN_NAME = "uipath", PLUGIN_REF, FINALIZE_CACHE_ERROR, def2;
|
|
108326
108347
|
var init_claude = __esm(() => {
|
|
108327
108348
|
init_src2();
|
|
108328
108349
|
init_src();
|
|
108329
108350
|
init_contentStore();
|
|
108330
108351
|
init_detect();
|
|
108331
|
-
MARKETPLACE_URL = `https://github.com/${MARKETPLACE_REPO}.git`;
|
|
108332
108352
|
PLUGIN_REF = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
|
|
108333
108353
|
FINALIZE_CACHE_ERROR = /Failed to finalize marketplace cache/i;
|
|
108334
108354
|
def2 = {
|
|
@@ -108338,17 +108358,15 @@ var init_claude = __esm(() => {
|
|
|
108338
108358
|
detect: () => verifiedCommandOnPath(["claude"], /Claude Code/i),
|
|
108339
108359
|
install: async ({ storePath, rootDir }) => {
|
|
108340
108360
|
await removeLegacySkillCopies(storePath, rootDir);
|
|
108341
|
-
await
|
|
108361
|
+
await ensureDirectoryMarketplace(storePath);
|
|
108342
108362
|
await runClaude(["plugin", "install", PLUGIN_REF]);
|
|
108343
|
-
await enableMarketplaceAutoUpdate();
|
|
108344
108363
|
logger.info(` claude: installed plugin ${PLUGIN_REF}`);
|
|
108345
108364
|
},
|
|
108346
108365
|
update: async ({ storePath, rootDir }) => {
|
|
108347
108366
|
await removeLegacySkillCopies(storePath, rootDir);
|
|
108348
|
-
await
|
|
108367
|
+
await ensureDirectoryMarketplace(storePath);
|
|
108349
108368
|
await runClaude(["plugin", "marketplace", "update", MARKETPLACE_NAME]);
|
|
108350
108369
|
await runClaude(["plugin", "update", PLUGIN_REF]);
|
|
108351
|
-
await enableMarketplaceAutoUpdate();
|
|
108352
108370
|
logger.info(` claude: updated plugin ${PLUGIN_REF}`);
|
|
108353
108371
|
},
|
|
108354
108372
|
uninstall: async ({ storePath, rootDir }) => {
|
|
@@ -108997,17 +109015,6 @@ async function resolveSkillsContext(options, operation) {
|
|
|
108997
109015
|
const isLocal = !!options.local;
|
|
108998
109016
|
const fs7 = getFileSystem();
|
|
108999
109017
|
const rootDir = isLocal ? fs7.env.cwd() : fs7.env.homedir();
|
|
109000
|
-
const storePath = await getContentStore(rootDir);
|
|
109001
|
-
const availableSkills = await getAvailableSkills(storePath);
|
|
109002
|
-
const selectedSkills = availableSkills.filter((skill) => skill.name !== SKILL_CATALOG_SKILL_NAME);
|
|
109003
|
-
if (selectedSkills.length === 0) {
|
|
109004
|
-
OutputFormatter.error({
|
|
109005
|
-
Result: RESULTS.ConfigError,
|
|
109006
|
-
Message: "No skills found in content store.",
|
|
109007
|
-
Instructions: "Check that the @uipath/skills package contains skills in the skills/ directory."
|
|
109008
|
-
});
|
|
109009
|
-
return null;
|
|
109010
|
-
}
|
|
109011
109018
|
let agents;
|
|
109012
109019
|
if (options.agent) {
|
|
109013
109020
|
const agent = options.agent.trim().toLowerCase();
|
|
@@ -109042,6 +109049,17 @@ async function resolveSkillsContext(options, operation) {
|
|
|
109042
109049
|
agents = selected;
|
|
109043
109050
|
}
|
|
109044
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
|
+
}
|
|
109045
109063
|
return { rootDir, storePath, selectedSkills, agents, isLocal };
|
|
109046
109064
|
}
|
|
109047
109065
|
async function detectInstalledAgents(isLocal) {
|
|
@@ -115127,16 +115145,16 @@ async function resolveToolsDirectories(context) {
|
|
|
115127
115145
|
return { toolsDirs, toolsDir };
|
|
115128
115146
|
}
|
|
115129
115147
|
logger.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
|
|
115130
|
-
const { dirname:
|
|
115148
|
+
const { dirname: dirname3, join: join2 } = fs7.path;
|
|
115131
115149
|
const isInstalledPackage = process.execPath.includes(join2("@uipath", "cli", "dist", "uip"));
|
|
115132
115150
|
if (isInstalledPackage) {
|
|
115133
|
-
const execDir =
|
|
115134
|
-
const packageDir =
|
|
115135
|
-
const fallbackDir2 =
|
|
115151
|
+
const execDir = dirname3(process.execPath);
|
|
115152
|
+
const packageDir = dirname3(execDir);
|
|
115153
|
+
const fallbackDir2 = dirname3(packageDir);
|
|
115136
115154
|
logger.debug(`Fallback (installed package): ${fallbackDir2}`);
|
|
115137
115155
|
return { toolsDirs: [fallbackDir2], toolsDir: fallbackDir2 };
|
|
115138
115156
|
}
|
|
115139
|
-
const fallbackDir = join2(
|
|
115157
|
+
const fallbackDir = join2(dirname3(currentFilePath), "..");
|
|
115140
115158
|
logger.debug(`Fallback (development mode): ${fallbackDir}`);
|
|
115141
115159
|
return { toolsDirs: [fallbackDir], toolsDir: fallbackDir };
|
|
115142
115160
|
}
|
|
@@ -115397,4 +115415,4 @@ export {
|
|
|
115397
115415
|
ready
|
|
115398
115416
|
};
|
|
115399
115417
|
|
|
115400
|
-
//# debugId=
|
|
115418
|
+
//# debugId=C75D6DF22C043EE264756E2164756E21
|