@uipath/cli 1.197.0 → 1.197.1-preview.76
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 +318 -318
- package/dist/index.js +248 -164
- 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.
|
|
45869
|
+
version: "1.197.1-preview.76",
|
|
45870
45870
|
description: "Cross platform CLI for UiPath",
|
|
45871
45871
|
repository: {
|
|
45872
45872
|
type: "git",
|
|
@@ -82430,11 +82430,26 @@ function renderTableHelp(cmd, helper) {
|
|
|
82430
82430
|
`)}
|
|
82431
82431
|
`;
|
|
82432
82432
|
}
|
|
82433
|
+
function rendersTableHelp() {
|
|
82434
|
+
return getOutputFormat() === "table" || !getOutputFormatExplicit() && getOutputSink().capabilities.isInteractive;
|
|
82435
|
+
}
|
|
82436
|
+
function stripHelpTextEventsForStructuredHelp(root) {
|
|
82437
|
+
if (rendersTableHelp()) {
|
|
82438
|
+
return;
|
|
82439
|
+
}
|
|
82440
|
+
const stack = [root];
|
|
82441
|
+
while (stack.length > 0) {
|
|
82442
|
+
const cmd = stack.pop();
|
|
82443
|
+
for (const event of HELP_TEXT_EVENTS) {
|
|
82444
|
+
cmd.removeAllListeners(event);
|
|
82445
|
+
}
|
|
82446
|
+
stack.push(...cmd.commands);
|
|
82447
|
+
}
|
|
82448
|
+
}
|
|
82433
82449
|
function createHelpConfiguration(isBrowser3) {
|
|
82434
82450
|
const config2 = {
|
|
82435
82451
|
formatHelp(cmd, helper) {
|
|
82436
|
-
|
|
82437
|
-
if (format2 === "table" || !getOutputFormatExplicit() && getOutputSink().capabilities.isInteractive) {
|
|
82452
|
+
if (rendersTableHelp()) {
|
|
82438
82453
|
return renderTableHelp(cmd, helper);
|
|
82439
82454
|
}
|
|
82440
82455
|
const baseHelp = extractCommandHelp(cmd, helper);
|
|
@@ -82478,7 +82493,7 @@ function createHelpConfiguration(isBrowser3) {
|
|
|
82478
82493
|
}
|
|
82479
82494
|
return config2;
|
|
82480
82495
|
}
|
|
82481
|
-
var GLOBAL_OPTIONS, BUILT_IN_ROOT_COMMANDS, GETTING_STARTED_ROWS;
|
|
82496
|
+
var GLOBAL_OPTIONS, BUILT_IN_ROOT_COMMANDS, GETTING_STARTED_ROWS, HELP_TEXT_EVENTS;
|
|
82482
82497
|
var init_helpFormatter = __esm(() => {
|
|
82483
82498
|
init_src2();
|
|
82484
82499
|
GLOBAL_OPTIONS = [
|
|
@@ -82527,6 +82542,12 @@ var init_helpFormatter = __esm(() => {
|
|
|
82527
82542
|
Description: "Install AI-agent skills for this CLI"
|
|
82528
82543
|
}
|
|
82529
82544
|
];
|
|
82545
|
+
HELP_TEXT_EVENTS = [
|
|
82546
|
+
"beforeAllHelp",
|
|
82547
|
+
"beforeHelp",
|
|
82548
|
+
"afterHelp",
|
|
82549
|
+
"afterAllHelp"
|
|
82550
|
+
];
|
|
82530
82551
|
});
|
|
82531
82552
|
|
|
82532
82553
|
// src/utils/parseError.ts
|
|
@@ -107468,42 +107489,72 @@ var init_autopilot = __esm(() => {
|
|
|
107468
107489
|
|
|
107469
107490
|
// src/commands/skills/contentStore.ts
|
|
107470
107491
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
107492
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
107493
|
+
import { dirname as dirname2 } from "node:path";
|
|
107471
107494
|
import { gunzipSync } from "node:zlib";
|
|
107472
107495
|
function loadChildProcess2() {
|
|
107473
107496
|
childProcessModulePromise2 ??= import("node:child_process");
|
|
107474
107497
|
return childProcessModulePromise2;
|
|
107475
107498
|
}
|
|
107476
|
-
async function
|
|
107477
|
-
const
|
|
107478
|
-
const
|
|
107479
|
-
|
|
107480
|
-
|
|
107499
|
+
async function resolveLocalSkillsStore(fs7) {
|
|
107500
|
+
const hasSkillsDir = async (d) => !!d && await fs7.exists(fs7.path.join(d, "skills"));
|
|
107501
|
+
const envDir = process.env.UIPATH_SKILLS_LOCAL_DIR?.trim();
|
|
107502
|
+
if (envDir && await hasSkillsDir(envDir))
|
|
107503
|
+
return envDir;
|
|
107504
|
+
const [reqErr, require2] = catchError(() => createRequire2(import.meta.url));
|
|
107505
|
+
if (reqErr || !require2)
|
|
107506
|
+
return;
|
|
107507
|
+
const [resErr, pkgJsonPath] = catchError(() => require2.resolve(`${SKILLS_PACKAGE_NAME}/package.json`));
|
|
107508
|
+
if (resErr || !pkgJsonPath)
|
|
107509
|
+
return;
|
|
107510
|
+
const dir = dirname2(pkgJsonPath);
|
|
107511
|
+
return await hasSkillsDir(dir) ? dir : undefined;
|
|
107512
|
+
}
|
|
107513
|
+
async function copySkillsStore(fs7, sourceDir, targetPath) {
|
|
107481
107514
|
const manifestPath = fs7.path.join(targetPath, MANIFEST_NAME);
|
|
107482
107515
|
let savedManifest = null;
|
|
107483
107516
|
if (await fs7.exists(targetPath)) {
|
|
107484
|
-
savedManifest = await fs7.readFile(manifestPath, {
|
|
107485
|
-
|
|
107486
|
-
|
|
107517
|
+
savedManifest = await fs7.readFile(manifestPath, { encoding: "utf-8" });
|
|
107518
|
+
await fs7.rm(targetPath);
|
|
107519
|
+
}
|
|
107520
|
+
await fs7.mkdir(targetPath);
|
|
107521
|
+
await fs7.copyDirectory(sourceDir, targetPath);
|
|
107522
|
+
if (savedManifest !== null) {
|
|
107523
|
+
await fs7.writeFile(manifestPath, savedManifest);
|
|
107524
|
+
}
|
|
107525
|
+
}
|
|
107526
|
+
async function fetchSkillsTo(targetPath, _rootDir) {
|
|
107527
|
+
const fs7 = getFileSystem();
|
|
107528
|
+
const [infoErr, resolved] = await catchError(resolveSkillsDownload());
|
|
107529
|
+
if (infoErr || !resolved) {
|
|
107530
|
+
const localStore = await resolveLocalSkillsStore(fs7);
|
|
107531
|
+
if (localStore) {
|
|
107532
|
+
logger.info(`Could not resolve ${SKILLS_PACKAGE_NAME} from a registry (${infoErr?.message ?? "unknown error"}); using the locally-installed package at ${localStore}.`);
|
|
107533
|
+
await copySkillsStore(fs7, localStore, targetPath);
|
|
107534
|
+
return;
|
|
107535
|
+
}
|
|
107536
|
+
throw infoErr ?? new Error(`Could not resolve ${SKILLS_PACKAGE_NAME}.`);
|
|
107487
107537
|
}
|
|
107538
|
+
const { pm, packageInfo } = resolved;
|
|
107539
|
+
logger.info(`Downloading ${SKILLS_PACKAGE_NAME}@${packageInfo.version} content store with ${pm}...`);
|
|
107540
|
+
const tmpPath = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-store-${randomUUID5()}`);
|
|
107488
107541
|
try {
|
|
107489
107542
|
await fs7.mkdir(tmpPath);
|
|
107490
|
-
await
|
|
107543
|
+
await materializePackage(pm, packageInfo, tmpPath);
|
|
107491
107544
|
if (!await fs7.exists(fs7.path.join(tmpPath, "skills"))) {
|
|
107492
107545
|
throw new Error(`${SKILLS_PACKAGE_NAME}@${packageInfo.version} does not contain a skills/ directory`);
|
|
107493
107546
|
}
|
|
107494
107547
|
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
|
-
}
|
|
107548
|
+
await copySkillsStore(fs7, tmpPath, targetPath);
|
|
107503
107549
|
} finally {
|
|
107504
107550
|
await catchError(fs7.rm(tmpPath));
|
|
107505
107551
|
}
|
|
107506
107552
|
}
|
|
107553
|
+
async function resolveSkillsDownload() {
|
|
107554
|
+
const pm = await resolvePackageManager();
|
|
107555
|
+
const packageInfo = await fetchMatchingSkillsPackageInfo(pm);
|
|
107556
|
+
return { pm, packageInfo };
|
|
107557
|
+
}
|
|
107507
107558
|
async function getContentStore(rootDir) {
|
|
107508
107559
|
const fs7 = getFileSystem();
|
|
107509
107560
|
const storePath = fs7.path.join(rootDir, STORE_NAME);
|
|
@@ -107623,16 +107674,6 @@ async function removeFromManifest(storePath, skillNames, agents) {
|
|
|
107623
107674
|
}
|
|
107624
107675
|
await writeManifest(storePath, manifest);
|
|
107625
107676
|
}
|
|
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
107677
|
function asRecord(value) {
|
|
107637
107678
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
107638
107679
|
return;
|
|
@@ -107757,45 +107798,57 @@ function matchesCliVersionLine(version2, cliVersion) {
|
|
|
107757
107798
|
function isStableVersion(version2) {
|
|
107758
107799
|
return parseSemver(version2)?.prerelease === undefined;
|
|
107759
107800
|
}
|
|
107760
|
-
function
|
|
107761
|
-
|
|
107762
|
-
|
|
107801
|
+
function isPackageManager(value) {
|
|
107802
|
+
return PM_PREFERENCE.includes(value);
|
|
107803
|
+
}
|
|
107804
|
+
async function resolvePackageManager() {
|
|
107805
|
+
const override = getFileSystem().env.getenv(PM_OVERRIDE_ENV)?.toLowerCase();
|
|
107806
|
+
if (override) {
|
|
107807
|
+
if (!isPackageManager(override)) {
|
|
107808
|
+
throw new Error(`${PM_OVERRIDE_ENV}="${override}" is not supported. Use one of: ${PM_PREFERENCE.join(", ")}.`);
|
|
107809
|
+
}
|
|
107810
|
+
return override;
|
|
107811
|
+
}
|
|
107812
|
+
if (!cachedPackageManager) {
|
|
107813
|
+
cachedPackageManager = detectPackageManager();
|
|
107814
|
+
}
|
|
107815
|
+
return cachedPackageManager;
|
|
107763
107816
|
}
|
|
107764
|
-
function
|
|
107817
|
+
async function detectPackageManager() {
|
|
107818
|
+
for (const pm of PM_PREFERENCE) {
|
|
107819
|
+
if (await commandOnPath(pm)) {
|
|
107820
|
+
logger.debug(`Using ${pm} to download ${SKILLS_PACKAGE_NAME}`);
|
|
107821
|
+
return pm;
|
|
107822
|
+
}
|
|
107823
|
+
}
|
|
107824
|
+
throw new Error(`No supported package manager found on PATH to download ${SKILLS_PACKAGE_NAME}. Install one of: ${PM_PREFERENCE.join(", ")}.`);
|
|
107825
|
+
}
|
|
107826
|
+
function validatePmArgument(arg) {
|
|
107765
107827
|
if (!SHELL_SAFE_ARG2.test(arg)) {
|
|
107766
|
-
throw new Error(`Unsafe
|
|
107828
|
+
throw new Error(`Unsafe package-manager argument: '${arg}'`);
|
|
107767
107829
|
}
|
|
107768
107830
|
}
|
|
107769
|
-
function
|
|
107831
|
+
function validatePmArguments(args) {
|
|
107770
107832
|
for (const arg of args) {
|
|
107771
|
-
|
|
107833
|
+
validatePmArgument(arg);
|
|
107772
107834
|
}
|
|
107773
107835
|
}
|
|
107774
|
-
function
|
|
107775
|
-
|
|
107776
|
-
Accept: accept,
|
|
107777
|
-
...authToken ? { Authorization: `Bearer ${authToken}` } : {}
|
|
107778
|
-
};
|
|
107779
|
-
}
|
|
107780
|
-
async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
107781
|
-
validateNpmArguments(args);
|
|
107836
|
+
async function runPmCommand(pm, args, label, timeoutMs, cwd, extraEnv) {
|
|
107837
|
+
validatePmArguments(args);
|
|
107782
107838
|
const { spawn: spawn2 } = await loadChildProcess2();
|
|
107783
107839
|
const isWindows = process.platform === "win32";
|
|
107840
|
+
const env = extraEnv ? { ...process.env, ...extraEnv } : undefined;
|
|
107784
107841
|
return await new Promise((resolve2, reject) => {
|
|
107785
107842
|
let proc;
|
|
107786
107843
|
if (isWindows) {
|
|
107787
|
-
|
|
107788
|
-
reject(new Error("Unsafe executable: 'npm'"));
|
|
107789
|
-
return;
|
|
107790
|
-
}
|
|
107791
|
-
const commandLine = ["npm", ...args].join(" ");
|
|
107844
|
+
const commandLine = [pm, ...args].join(" ");
|
|
107792
107845
|
if (!SHELL_SAFE_COMMAND_LINE2.test(commandLine)) {
|
|
107793
107846
|
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
107794
107847
|
return;
|
|
107795
107848
|
}
|
|
107796
|
-
proc = spawn2(commandLine, [], { cwd, shell: true });
|
|
107849
|
+
proc = spawn2(commandLine, [], { cwd, shell: true, env });
|
|
107797
107850
|
} else {
|
|
107798
|
-
proc = spawn2(
|
|
107851
|
+
proc = spawn2(pm, args, { cwd, env });
|
|
107799
107852
|
}
|
|
107800
107853
|
let stdout = "";
|
|
107801
107854
|
let stderr = "";
|
|
@@ -107810,11 +107863,11 @@ async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
|
107810
107863
|
});
|
|
107811
107864
|
const timer = setTimeout(() => {
|
|
107812
107865
|
proc.kill("SIGTERM");
|
|
107813
|
-
reject(new Error(
|
|
107866
|
+
reject(new Error(`${pm} ${label} timed out after ${timeoutMs / 1000}s`));
|
|
107814
107867
|
}, timeoutMs);
|
|
107815
107868
|
proc.on("error", (error51) => {
|
|
107816
107869
|
clearTimeout(timer);
|
|
107817
|
-
reject(
|
|
107870
|
+
reject(mapPmError(pm, label, stderr, error51));
|
|
107818
107871
|
});
|
|
107819
107872
|
proc.on("close", (code) => {
|
|
107820
107873
|
clearTimeout(timer);
|
|
@@ -107822,41 +107875,95 @@ async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
|
107822
107875
|
resolve2(stdout);
|
|
107823
107876
|
return;
|
|
107824
107877
|
}
|
|
107825
|
-
reject(
|
|
107878
|
+
reject(mapPmError(pm, label, stderr, code));
|
|
107826
107879
|
});
|
|
107827
107880
|
});
|
|
107828
107881
|
}
|
|
107829
|
-
function
|
|
107830
|
-
if (/E404
|
|
107882
|
+
function mapPmError(pm, label, stderr, codeOrError) {
|
|
107883
|
+
if (/E404|\b404\b|not found|Couldn't find|no matching version/i.test(stderr)) {
|
|
107831
107884
|
return new Error(`${SKILLS_PACKAGE_NAME} not found in the registry`);
|
|
107832
107885
|
}
|
|
107833
|
-
if (/E401|E403|ENEEDAUTH|need(s)? auth|authentication/i.test(stderr)) {
|
|
107834
|
-
return new Error(`Authentication required for ${SKILLS_PACKAGE_NAME}
|
|
107886
|
+
if (/E401|E403|\b401\b|\b403\b|ENEEDAUTH|unauthor|forbidden|need(s)? auth|authentication/i.test(stderr)) {
|
|
107887
|
+
return new Error(`Authentication required for ${SKILLS_PACKAGE_NAME}. ${REGISTRY_AUTH_HINT}`);
|
|
107835
107888
|
}
|
|
107836
107889
|
const detail = stderr.trim() || (codeOrError instanceof Error ? codeOrError.message : `exit ${codeOrError}`);
|
|
107837
|
-
return new Error(
|
|
107890
|
+
return new Error(`${pm} ${label} failed: ${detail}`);
|
|
107838
107891
|
}
|
|
107839
|
-
function
|
|
107892
|
+
function parsePmJson(pm, stdout, label) {
|
|
107840
107893
|
const [parseError, parsed] = catchError(() => JSON.parse(stdout));
|
|
107841
107894
|
if (parseError) {
|
|
107842
|
-
throw new Error(`Unexpected
|
|
107895
|
+
throw new Error(`Unexpected ${pm} ${label} output`);
|
|
107843
107896
|
}
|
|
107844
107897
|
return parsed;
|
|
107845
107898
|
}
|
|
107846
|
-
async function
|
|
107847
|
-
const
|
|
107848
|
-
|
|
107899
|
+
async function pmViewJson(pm, args) {
|
|
107900
|
+
const label = `view ${args.join(" ")}`;
|
|
107901
|
+
const pmArgs = pm === "bun" ? ["info", ...args, "--json"] : ["view", ...args, "--json"];
|
|
107902
|
+
return await withTempProject(async (dir) => {
|
|
107903
|
+
const stdout = await runPmCommand(pm, pmArgs, label, NPM_VIEW_TIMEOUT_MS2, dir);
|
|
107904
|
+
return parseViewOutput(pm, stdout);
|
|
107905
|
+
});
|
|
107849
107906
|
}
|
|
107850
|
-
function
|
|
107851
|
-
if (
|
|
107852
|
-
return
|
|
107853
|
-
|
|
107854
|
-
|
|
107907
|
+
function parseViewOutput(pm, stdout) {
|
|
107908
|
+
if (!stdout.trim())
|
|
107909
|
+
return;
|
|
107910
|
+
return parsePmJson(pm, stdout, "view");
|
|
107911
|
+
}
|
|
107912
|
+
async function yarnInfo(args) {
|
|
107913
|
+
const label = `info ${args.join(" ")}`;
|
|
107914
|
+
const stdout = await withTempProject((dir) => runPmCommand("yarn", ["info", ...args, "--json"], label, NPM_VIEW_TIMEOUT_MS2, dir));
|
|
107915
|
+
if (!stdout.trim())
|
|
107916
|
+
return;
|
|
107917
|
+
for (const line of stdout.split(`
|
|
107918
|
+
`)) {
|
|
107919
|
+
const trimmed = line.trim();
|
|
107920
|
+
if (!trimmed)
|
|
107921
|
+
continue;
|
|
107922
|
+
const [, parsed] = catchError(() => JSON.parse(trimmed));
|
|
107923
|
+
const record3 = asRecord(parsed);
|
|
107924
|
+
if (record3 && "data" in record3) {
|
|
107925
|
+
return record3.data;
|
|
107926
|
+
}
|
|
107855
107927
|
}
|
|
107856
|
-
|
|
107857
|
-
|
|
107928
|
+
throw new Error(`Unexpected yarn ${label} output`);
|
|
107929
|
+
}
|
|
107930
|
+
async function queryVersions(pm, spec) {
|
|
107931
|
+
const raw = pm === "yarn" ? await yarnInfo([spec, "versions"]) : await pmViewJson(pm, [spec, "versions"]);
|
|
107932
|
+
return normalizeVersionList(raw);
|
|
107933
|
+
}
|
|
107934
|
+
async function pmListVersions(pm, cliVersion) {
|
|
107935
|
+
const primary = await queryVersions(pm, SKILLS_PACKAGE_NAME);
|
|
107936
|
+
if (primary.length > 0)
|
|
107937
|
+
return primary;
|
|
107938
|
+
const lineSpec = `${SKILLS_PACKAGE_NAME}@~${cliVersion.major}.${cliVersion.minor}.0-0`;
|
|
107939
|
+
const [err, versions2] = await catchError(queryVersions(pm, lineSpec));
|
|
107940
|
+
if (err) {
|
|
107941
|
+
logger.debug(`Line-scoped version lookup for ${lineSpec} failed: ${err.message}`);
|
|
107942
|
+
return [];
|
|
107858
107943
|
}
|
|
107859
|
-
return
|
|
107944
|
+
return versions2;
|
|
107945
|
+
}
|
|
107946
|
+
async function pmResolveTarball(pm, version2) {
|
|
107947
|
+
const spec = `${SKILLS_PACKAGE_NAME}@${version2}`;
|
|
107948
|
+
const [error51, value] = await catchError(pm === "yarn" ? yarnInfo([spec, "dist.tarball"]) : pmViewJson(pm, [spec, "dist.tarball"]));
|
|
107949
|
+
if (error51) {
|
|
107950
|
+
logger.debug(`Could not resolve dist.tarball for ${spec}: ${error51}`);
|
|
107951
|
+
return;
|
|
107952
|
+
}
|
|
107953
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
107954
|
+
}
|
|
107955
|
+
function normalizeVersionList(value) {
|
|
107956
|
+
const collected = new Set;
|
|
107957
|
+
const walk = (node2) => {
|
|
107958
|
+
if (typeof node2 === "string") {
|
|
107959
|
+
collected.add(node2);
|
|
107960
|
+
} else if (Array.isArray(node2)) {
|
|
107961
|
+
for (const child of node2)
|
|
107962
|
+
walk(child);
|
|
107963
|
+
}
|
|
107964
|
+
};
|
|
107965
|
+
walk(value);
|
|
107966
|
+
return [...collected];
|
|
107860
107967
|
}
|
|
107861
107968
|
function requireString(value, message) {
|
|
107862
107969
|
if (typeof value !== "string" || value.length === 0) {
|
|
@@ -107868,31 +107975,22 @@ function registryFromTarball(tarballUrl) {
|
|
|
107868
107975
|
const [urlError, parsedUrl] = catchError(() => new URL(tarballUrl));
|
|
107869
107976
|
return urlError ? SKILLS_REGISTRY_URL : parsedUrl.origin;
|
|
107870
107977
|
}
|
|
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() {
|
|
107978
|
+
async function fetchMatchingSkillsPackageInfo(pm) {
|
|
107886
107979
|
const cliVersion = parseSemver(package_default.version);
|
|
107887
107980
|
if (!cliVersion) {
|
|
107888
107981
|
throw new Error(`Invalid CLI version ${package_default.version}; expected semantic version major.minor.patch`);
|
|
107889
107982
|
}
|
|
107890
|
-
const
|
|
107891
|
-
|
|
107892
|
-
|
|
107893
|
-
|
|
107894
|
-
|
|
107895
|
-
|
|
107983
|
+
const versions2 = await pmListVersions(pm, cliVersion);
|
|
107984
|
+
const selectedVersion = pickMatchingSkillsVersion(versions2, cliVersion);
|
|
107985
|
+
const tarballUrl = pm === "npm" || pm === "pnpm" ? requireString(await pmViewJson(pm, [
|
|
107986
|
+
`${SKILLS_PACKAGE_NAME}@${selectedVersion}`,
|
|
107987
|
+
"dist.tarball"
|
|
107988
|
+
]), `${SKILLS_PACKAGE_NAME}@${selectedVersion} does not declare dist.tarball`) : await pmResolveTarball(pm, selectedVersion);
|
|
107989
|
+
return {
|
|
107990
|
+
version: selectedVersion,
|
|
107991
|
+
tarballUrl: tarballUrl ?? "",
|
|
107992
|
+
registryUrl: tarballUrl ? registryFromTarball(tarballUrl) : SKILLS_REGISTRY_URL
|
|
107993
|
+
};
|
|
107896
107994
|
}
|
|
107897
107995
|
function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
107898
107996
|
const matchingVersions = versions2.filter((version2) => matchesCliVersionLine(version2, cliVersion));
|
|
@@ -107903,64 +108001,32 @@ function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
|
107903
108001
|
}
|
|
107904
108002
|
return selectedVersion;
|
|
107905
108003
|
}
|
|
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`);
|
|
108004
|
+
async function withTempProject(fn) {
|
|
108005
|
+
const fs7 = getFileSystem();
|
|
108006
|
+
const projectDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pm-${randomUUID5()}`);
|
|
108007
|
+
try {
|
|
108008
|
+
await fs7.mkdir(projectDir);
|
|
108009
|
+
await fs7.writeFile(fs7.path.join(projectDir, "package.json"), `${JSON.stringify({ name: "uipath-skills-fetch", version: "0.0.0", private: true }, null, 2)}
|
|
108010
|
+
`);
|
|
108011
|
+
return await fn(projectDir);
|
|
108012
|
+
} finally {
|
|
108013
|
+
await catchError(fs7.rm(projectDir));
|
|
107933
108014
|
}
|
|
107934
|
-
return {
|
|
107935
|
-
version: selectedVersion,
|
|
107936
|
-
tarballUrl,
|
|
107937
|
-
registryUrl,
|
|
107938
|
-
authToken
|
|
107939
|
-
};
|
|
107940
108015
|
}
|
|
107941
|
-
async function
|
|
107942
|
-
if (
|
|
107943
|
-
await
|
|
108016
|
+
async function materializePackage(pm, packageInfo, destinationPath) {
|
|
108017
|
+
if (pm === "npm") {
|
|
108018
|
+
await packAndExtractWithNpm(packageInfo, destinationPath);
|
|
107944
108019
|
return;
|
|
107945
108020
|
}
|
|
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);
|
|
108021
|
+
await addAndCopyPackage(pm, packageInfo, destinationPath);
|
|
107956
108022
|
}
|
|
107957
|
-
async function
|
|
108023
|
+
async function packAndExtractWithNpm(packageInfo, destinationPath) {
|
|
107958
108024
|
const fs7 = getFileSystem();
|
|
107959
108025
|
const packDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pack-${randomUUID5()}`);
|
|
107960
108026
|
try {
|
|
107961
108027
|
await fs7.mkdir(packDir);
|
|
107962
|
-
const stdout = await
|
|
107963
|
-
const packOutput =
|
|
108028
|
+
const stdout = await runPmCommand("npm", ["pack", `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, "--json"], `pack ${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, NPM_PACK_TIMEOUT_MS, packDir);
|
|
108029
|
+
const packOutput = parsePmJson("npm", stdout, "pack");
|
|
107964
108030
|
const packedFile = readPackedFileName(packOutput);
|
|
107965
108031
|
const packedPath = fs7.path.join(packDir, packedFile);
|
|
107966
108032
|
const packedContent = await fs7.readFile(packedPath);
|
|
@@ -107973,6 +108039,20 @@ async function packAndExtractPackage(packageInfo, destinationPath) {
|
|
|
107973
108039
|
await catchError(fs7.rm(packDir));
|
|
107974
108040
|
}
|
|
107975
108041
|
}
|
|
108042
|
+
async function addAndCopyPackage(pm, packageInfo, destinationPath) {
|
|
108043
|
+
const fs7 = getFileSystem();
|
|
108044
|
+
const spec = `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`;
|
|
108045
|
+
const extraEnv = pm === "yarn" ? { YARN_NODE_LINKER: "node-modules" } : undefined;
|
|
108046
|
+
await withTempProject(async (projectDir) => {
|
|
108047
|
+
await runPmCommand(pm, ["add", spec, "--ignore-scripts"], `add ${spec}`, NPM_PACK_TIMEOUT_MS, projectDir, extraEnv);
|
|
108048
|
+
const installed = fs7.path.join(projectDir, "node_modules", SKILLS_PACKAGE_NAME);
|
|
108049
|
+
if (!await fs7.exists(installed)) {
|
|
108050
|
+
throw new Error(`${pm} add did not install ${SKILLS_PACKAGE_NAME}`);
|
|
108051
|
+
}
|
|
108052
|
+
const realInstalled = await fs7.realpath(installed);
|
|
108053
|
+
await fs7.copyDirectory(realInstalled, destinationPath);
|
|
108054
|
+
});
|
|
108055
|
+
}
|
|
107976
108056
|
function readPackedFileName(packOutput) {
|
|
107977
108057
|
if (!Array.isArray(packOutput)) {
|
|
107978
108058
|
throw new TypeError(`Unexpected npm pack output for ${SKILLS_PACKAGE_NAME}`);
|
|
@@ -108151,15 +108231,17 @@ async function extractNpmTarballToDir(tarData, destinationDir) {
|
|
|
108151
108231
|
await extractTarEntry2(fs7, destinationDir, entryName, entry);
|
|
108152
108232
|
}
|
|
108153
108233
|
}
|
|
108154
|
-
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org",
|
|
108234
|
+
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
108235
|
var init_contentStore = __esm(() => {
|
|
108156
108236
|
init_src2();
|
|
108157
108237
|
init_src();
|
|
108158
108238
|
init_js_yaml();
|
|
108159
108239
|
init_package();
|
|
108240
|
+
init_detect();
|
|
108160
108241
|
STORE_NAME = `${UIPATH_HOME_DIR}/.skills`;
|
|
108161
|
-
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._
|
|
108162
|
-
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._
|
|
108242
|
+
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._~-]+$/;
|
|
108243
|
+
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._~\- ]+$/;
|
|
108244
|
+
PM_PREFERENCE = ["npm", "pnpm", "bun", "yarn"];
|
|
108163
108245
|
});
|
|
108164
108246
|
|
|
108165
108247
|
// src/commands/skills/agents/claude.ts
|
|
@@ -108956,17 +109038,6 @@ async function resolveSkillsContext(options, operation) {
|
|
|
108956
109038
|
const isLocal = !!options.local;
|
|
108957
109039
|
const fs7 = getFileSystem();
|
|
108958
109040
|
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
109041
|
let agents;
|
|
108971
109042
|
if (options.agent) {
|
|
108972
109043
|
const agent = options.agent.trim().toLowerCase();
|
|
@@ -109001,6 +109072,17 @@ async function resolveSkillsContext(options, operation) {
|
|
|
109001
109072
|
agents = selected;
|
|
109002
109073
|
}
|
|
109003
109074
|
}
|
|
109075
|
+
const storePath = await getContentStore(rootDir);
|
|
109076
|
+
const availableSkills = await getAvailableSkills(storePath);
|
|
109077
|
+
const selectedSkills = availableSkills.filter((skill) => skill.name !== SKILL_CATALOG_SKILL_NAME);
|
|
109078
|
+
if (selectedSkills.length === 0) {
|
|
109079
|
+
OutputFormatter.error({
|
|
109080
|
+
Result: RESULTS.ConfigError,
|
|
109081
|
+
Message: "No skills found in content store.",
|
|
109082
|
+
Instructions: "Check that the @uipath/skills package contains skills in the skills/ directory."
|
|
109083
|
+
});
|
|
109084
|
+
return null;
|
|
109085
|
+
}
|
|
109004
109086
|
return { rootDir, storePath, selectedSkills, agents, isLocal };
|
|
109005
109087
|
}
|
|
109006
109088
|
async function detectInstalledAgents(isLocal) {
|
|
@@ -115045,6 +115127,7 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
115045
115127
|
});
|
|
115046
115128
|
return;
|
|
115047
115129
|
}
|
|
115130
|
+
stripHelpTextEventsForStructuredHelp(realCommand);
|
|
115048
115131
|
const toolArgs = context.args.slice(2);
|
|
115049
115132
|
const candidates = [entry.commandPrefix, ...aliases];
|
|
115050
115133
|
const prefixIdx = toolArgs.findIndex((a) => candidates.includes(a));
|
|
@@ -115068,6 +115151,7 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
115068
115151
|
var init_registerToolCommands = __esm(() => {
|
|
115069
115152
|
init_src2();
|
|
115070
115153
|
init_tools_whitelist();
|
|
115154
|
+
init_helpFormatter();
|
|
115071
115155
|
init_toolLoader();
|
|
115072
115156
|
});
|
|
115073
115157
|
|
|
@@ -115086,16 +115170,16 @@ async function resolveToolsDirectories(context) {
|
|
|
115086
115170
|
return { toolsDirs, toolsDir };
|
|
115087
115171
|
}
|
|
115088
115172
|
logger.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
|
|
115089
|
-
const { dirname:
|
|
115173
|
+
const { dirname: dirname3, join: join2 } = fs7.path;
|
|
115090
115174
|
const isInstalledPackage = process.execPath.includes(join2("@uipath", "cli", "dist", "uip"));
|
|
115091
115175
|
if (isInstalledPackage) {
|
|
115092
|
-
const execDir =
|
|
115093
|
-
const packageDir =
|
|
115094
|
-
const fallbackDir2 =
|
|
115176
|
+
const execDir = dirname3(process.execPath);
|
|
115177
|
+
const packageDir = dirname3(execDir);
|
|
115178
|
+
const fallbackDir2 = dirname3(packageDir);
|
|
115095
115179
|
logger.debug(`Fallback (installed package): ${fallbackDir2}`);
|
|
115096
115180
|
return { toolsDirs: [fallbackDir2], toolsDir: fallbackDir2 };
|
|
115097
115181
|
}
|
|
115098
|
-
const fallbackDir = join2(
|
|
115182
|
+
const fallbackDir = join2(dirname3(currentFilePath), "..");
|
|
115099
115183
|
logger.debug(`Fallback (development mode): ${fallbackDir}`);
|
|
115100
115184
|
return { toolsDirs: [fallbackDir], toolsDir: fallbackDir };
|
|
115101
115185
|
}
|
|
@@ -115356,4 +115440,4 @@ export {
|
|
|
115356
115440
|
ready
|
|
115357
115441
|
};
|
|
115358
115442
|
|
|
115359
|
-
//# debugId=
|
|
115443
|
+
//# debugId=23FF6BC7E4F26FA564756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/cli",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.197.
|
|
4
|
+
"version": "1.197.1-preview.76",
|
|
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": "e66bcea788dcf20d4032933a353a64baab9b22a9"
|
|
38
38
|
}
|