@uipath/cli 1.197.0-preview.72 → 1.197.0
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 +164 -248
- 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
|
|
45869
|
+
version: "1.197.0",
|
|
45870
45870
|
description: "Cross platform CLI for UiPath",
|
|
45871
45871
|
repository: {
|
|
45872
45872
|
type: "git",
|
|
@@ -82430,26 +82430,11 @@ 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
|
-
}
|
|
82449
82433
|
function createHelpConfiguration(isBrowser3) {
|
|
82450
82434
|
const config2 = {
|
|
82451
82435
|
formatHelp(cmd, helper) {
|
|
82452
|
-
|
|
82436
|
+
const format2 = getOutputFormat();
|
|
82437
|
+
if (format2 === "table" || !getOutputFormatExplicit() && getOutputSink().capabilities.isInteractive) {
|
|
82453
82438
|
return renderTableHelp(cmd, helper);
|
|
82454
82439
|
}
|
|
82455
82440
|
const baseHelp = extractCommandHelp(cmd, helper);
|
|
@@ -82493,7 +82478,7 @@ function createHelpConfiguration(isBrowser3) {
|
|
|
82493
82478
|
}
|
|
82494
82479
|
return config2;
|
|
82495
82480
|
}
|
|
82496
|
-
var GLOBAL_OPTIONS, BUILT_IN_ROOT_COMMANDS, GETTING_STARTED_ROWS
|
|
82481
|
+
var GLOBAL_OPTIONS, BUILT_IN_ROOT_COMMANDS, GETTING_STARTED_ROWS;
|
|
82497
82482
|
var init_helpFormatter = __esm(() => {
|
|
82498
82483
|
init_src2();
|
|
82499
82484
|
GLOBAL_OPTIONS = [
|
|
@@ -82542,12 +82527,6 @@ var init_helpFormatter = __esm(() => {
|
|
|
82542
82527
|
Description: "Install AI-agent skills for this CLI"
|
|
82543
82528
|
}
|
|
82544
82529
|
];
|
|
82545
|
-
HELP_TEXT_EVENTS = [
|
|
82546
|
-
"beforeAllHelp",
|
|
82547
|
-
"beforeHelp",
|
|
82548
|
-
"afterHelp",
|
|
82549
|
-
"afterAllHelp"
|
|
82550
|
-
];
|
|
82551
82530
|
});
|
|
82552
82531
|
|
|
82553
82532
|
// src/utils/parseError.ts
|
|
@@ -107489,72 +107468,42 @@ var init_autopilot = __esm(() => {
|
|
|
107489
107468
|
|
|
107490
107469
|
// src/commands/skills/contentStore.ts
|
|
107491
107470
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
107492
|
-
import { createRequire as createRequire2 } from "node:module";
|
|
107493
|
-
import { dirname as dirname2 } from "node:path";
|
|
107494
107471
|
import { gunzipSync } from "node:zlib";
|
|
107495
107472
|
function loadChildProcess2() {
|
|
107496
107473
|
childProcessModulePromise2 ??= import("node:child_process");
|
|
107497
107474
|
return childProcessModulePromise2;
|
|
107498
107475
|
}
|
|
107499
|
-
async function
|
|
107500
|
-
const
|
|
107501
|
-
const
|
|
107502
|
-
|
|
107503
|
-
|
|
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) {
|
|
107476
|
+
async function fetchSkillsTo(targetPath, _rootDir) {
|
|
107477
|
+
const fs7 = getFileSystem();
|
|
107478
|
+
const packageInfo = await fetchMatchingSkillsPackageInfo();
|
|
107479
|
+
logger.info(`Downloading ${SKILLS_PACKAGE_NAME}@${packageInfo.version} content store...`);
|
|
107480
|
+
const tmpPath = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-store-${randomUUID5()}`);
|
|
107514
107481
|
const manifestPath = fs7.path.join(targetPath, MANIFEST_NAME);
|
|
107515
107482
|
let savedManifest = null;
|
|
107516
107483
|
if (await fs7.exists(targetPath)) {
|
|
107517
|
-
savedManifest = await fs7.readFile(manifestPath, {
|
|
107518
|
-
|
|
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}.`);
|
|
107484
|
+
savedManifest = await fs7.readFile(manifestPath, {
|
|
107485
|
+
encoding: "utf-8"
|
|
107486
|
+
});
|
|
107537
107487
|
}
|
|
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()}`);
|
|
107541
107488
|
try {
|
|
107542
107489
|
await fs7.mkdir(tmpPath);
|
|
107543
|
-
await
|
|
107490
|
+
await downloadAndExtractPackage(packageInfo, tmpPath);
|
|
107544
107491
|
if (!await fs7.exists(fs7.path.join(tmpPath, "skills"))) {
|
|
107545
107492
|
throw new Error(`${SKILLS_PACKAGE_NAME}@${packageInfo.version} does not contain a skills/ directory`);
|
|
107546
107493
|
}
|
|
107547
107494
|
await writeSourceMarker(tmpPath, packageInfo);
|
|
107548
|
-
await
|
|
107495
|
+
if (await fs7.exists(targetPath)) {
|
|
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
|
+
}
|
|
107549
107503
|
} finally {
|
|
107550
107504
|
await catchError(fs7.rm(tmpPath));
|
|
107551
107505
|
}
|
|
107552
107506
|
}
|
|
107553
|
-
async function resolveSkillsDownload() {
|
|
107554
|
-
const pm = await resolvePackageManager();
|
|
107555
|
-
const packageInfo = await fetchMatchingSkillsPackageInfo(pm);
|
|
107556
|
-
return { pm, packageInfo };
|
|
107557
|
-
}
|
|
107558
107507
|
async function getContentStore(rootDir) {
|
|
107559
107508
|
const fs7 = getFileSystem();
|
|
107560
107509
|
const storePath = fs7.path.join(rootDir, STORE_NAME);
|
|
@@ -107674,6 +107623,16 @@ async function removeFromManifest(storePath, skillNames, agents) {
|
|
|
107674
107623
|
}
|
|
107675
107624
|
await writeManifest(storePath, manifest);
|
|
107676
107625
|
}
|
|
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
|
+
}
|
|
107677
107636
|
function asRecord(value) {
|
|
107678
107637
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
107679
107638
|
return;
|
|
@@ -107798,57 +107757,45 @@ function matchesCliVersionLine(version2, cliVersion) {
|
|
|
107798
107757
|
function isStableVersion(version2) {
|
|
107799
107758
|
return parseSemver(version2)?.prerelease === undefined;
|
|
107800
107759
|
}
|
|
107801
|
-
function
|
|
107802
|
-
|
|
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;
|
|
107760
|
+
function getGhNpmRegistryToken() {
|
|
107761
|
+
const envToken = globalThis.process?.env?.GH_NPM_REGISTRY_TOKEN;
|
|
107762
|
+
return envToken || undefined;
|
|
107816
107763
|
}
|
|
107817
|
-
|
|
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) {
|
|
107764
|
+
function validateNpmArgument(arg) {
|
|
107827
107765
|
if (!SHELL_SAFE_ARG2.test(arg)) {
|
|
107828
|
-
throw new Error(`Unsafe
|
|
107766
|
+
throw new Error(`Unsafe npm argument: '${arg}'`);
|
|
107829
107767
|
}
|
|
107830
107768
|
}
|
|
107831
|
-
function
|
|
107769
|
+
function validateNpmArguments(args) {
|
|
107832
107770
|
for (const arg of args) {
|
|
107833
|
-
|
|
107771
|
+
validateNpmArgument(arg);
|
|
107834
107772
|
}
|
|
107835
107773
|
}
|
|
107836
|
-
|
|
107837
|
-
|
|
107774
|
+
function packageFetchHeaders(accept, authToken) {
|
|
107775
|
+
return {
|
|
107776
|
+
Accept: accept,
|
|
107777
|
+
...authToken ? { Authorization: `Bearer ${authToken}` } : {}
|
|
107778
|
+
};
|
|
107779
|
+
}
|
|
107780
|
+
async function runNpmCommand(args, label, timeoutMs, cwd) {
|
|
107781
|
+
validateNpmArguments(args);
|
|
107838
107782
|
const { spawn: spawn2 } = await loadChildProcess2();
|
|
107839
107783
|
const isWindows = process.platform === "win32";
|
|
107840
|
-
const env = extraEnv ? { ...process.env, ...extraEnv } : undefined;
|
|
107841
107784
|
return await new Promise((resolve2, reject) => {
|
|
107842
107785
|
let proc;
|
|
107843
107786
|
if (isWindows) {
|
|
107844
|
-
|
|
107787
|
+
if (!SHELL_SAFE_ARG2.test("npm")) {
|
|
107788
|
+
reject(new Error("Unsafe executable: 'npm'"));
|
|
107789
|
+
return;
|
|
107790
|
+
}
|
|
107791
|
+
const commandLine = ["npm", ...args].join(" ");
|
|
107845
107792
|
if (!SHELL_SAFE_COMMAND_LINE2.test(commandLine)) {
|
|
107846
107793
|
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
107847
107794
|
return;
|
|
107848
107795
|
}
|
|
107849
|
-
proc = spawn2(commandLine, [], { cwd, shell: true
|
|
107796
|
+
proc = spawn2(commandLine, [], { cwd, shell: true });
|
|
107850
107797
|
} else {
|
|
107851
|
-
proc = spawn2(
|
|
107798
|
+
proc = spawn2("npm", args, { cwd });
|
|
107852
107799
|
}
|
|
107853
107800
|
let stdout = "";
|
|
107854
107801
|
let stderr = "";
|
|
@@ -107863,11 +107810,11 @@ async function runPmCommand(pm, args, label, timeoutMs, cwd, extraEnv) {
|
|
|
107863
107810
|
});
|
|
107864
107811
|
const timer = setTimeout(() => {
|
|
107865
107812
|
proc.kill("SIGTERM");
|
|
107866
|
-
reject(new Error(
|
|
107813
|
+
reject(new Error(`npm ${label} timed out after ${timeoutMs / 1000}s`));
|
|
107867
107814
|
}, timeoutMs);
|
|
107868
107815
|
proc.on("error", (error51) => {
|
|
107869
107816
|
clearTimeout(timer);
|
|
107870
|
-
reject(
|
|
107817
|
+
reject(mapNpmError(label, stderr, error51));
|
|
107871
107818
|
});
|
|
107872
107819
|
proc.on("close", (code) => {
|
|
107873
107820
|
clearTimeout(timer);
|
|
@@ -107875,95 +107822,41 @@ async function runPmCommand(pm, args, label, timeoutMs, cwd, extraEnv) {
|
|
|
107875
107822
|
resolve2(stdout);
|
|
107876
107823
|
return;
|
|
107877
107824
|
}
|
|
107878
|
-
reject(
|
|
107825
|
+
reject(mapNpmError(label, stderr, code));
|
|
107879
107826
|
});
|
|
107880
107827
|
});
|
|
107881
107828
|
}
|
|
107882
|
-
function
|
|
107883
|
-
if (/E404
|
|
107829
|
+
function mapNpmError(label, stderr, codeOrError) {
|
|
107830
|
+
if (/E404/.test(stderr) || /404/.test(stderr)) {
|
|
107884
107831
|
return new Error(`${SKILLS_PACKAGE_NAME} not found in the registry`);
|
|
107885
107832
|
}
|
|
107886
|
-
if (/E401|E403
|
|
107887
|
-
return new Error(`Authentication required for ${SKILLS_PACKAGE_NAME}.
|
|
107833
|
+
if (/E401|E403|ENEEDAUTH|need(s)? auth|authentication/i.test(stderr)) {
|
|
107834
|
+
return new Error(`Authentication required for ${SKILLS_PACKAGE_NAME} (configure @uipath:registry and an auth token in .npmrc, or set GH_NPM_REGISTRY_TOKEN)`);
|
|
107888
107835
|
}
|
|
107889
107836
|
const detail = stderr.trim() || (codeOrError instanceof Error ? codeOrError.message : `exit ${codeOrError}`);
|
|
107890
|
-
return new Error(
|
|
107837
|
+
return new Error(`npm ${label} failed: ${detail}`);
|
|
107891
107838
|
}
|
|
107892
|
-
function
|
|
107839
|
+
function parseNpmJson(stdout, label) {
|
|
107893
107840
|
const [parseError, parsed] = catchError(() => JSON.parse(stdout));
|
|
107894
107841
|
if (parseError) {
|
|
107895
|
-
throw new Error(`Unexpected
|
|
107842
|
+
throw new Error(`Unexpected npm ${label} output`);
|
|
107896
107843
|
}
|
|
107897
107844
|
return parsed;
|
|
107898
107845
|
}
|
|
107899
|
-
async function
|
|
107900
|
-
const
|
|
107901
|
-
|
|
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
|
-
});
|
|
107906
|
-
}
|
|
107907
|
-
function parseViewOutput(pm, stdout) {
|
|
107908
|
-
if (!stdout.trim())
|
|
107909
|
-
return;
|
|
107910
|
-
return parsePmJson(pm, stdout, "view");
|
|
107846
|
+
async function npmViewJson(args) {
|
|
107847
|
+
const stdout = await runNpmCommand(["view", ...args, "--json"], `view ${args.join(" ")}`, NPM_VIEW_TIMEOUT_MS2);
|
|
107848
|
+
return parseNpmJson(stdout, "view");
|
|
107911
107849
|
}
|
|
107912
|
-
|
|
107913
|
-
|
|
107914
|
-
|
|
107915
|
-
|
|
107916
|
-
|
|
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
|
-
}
|
|
107927
|
-
}
|
|
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 [];
|
|
107850
|
+
function normalizeVersionList(value) {
|
|
107851
|
+
if (Array.isArray(value)) {
|
|
107852
|
+
return value.filter((version2) => {
|
|
107853
|
+
return typeof version2 === "string";
|
|
107854
|
+
});
|
|
107943
107855
|
}
|
|
107944
|
-
|
|
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;
|
|
107856
|
+
if (typeof value === "string") {
|
|
107857
|
+
return [value];
|
|
107952
107858
|
}
|
|
107953
|
-
return
|
|
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];
|
|
107859
|
+
return [];
|
|
107967
107860
|
}
|
|
107968
107861
|
function requireString(value, message) {
|
|
107969
107862
|
if (typeof value !== "string" || value.length === 0) {
|
|
@@ -107975,22 +107868,31 @@ function registryFromTarball(tarballUrl) {
|
|
|
107975
107868
|
const [urlError, parsedUrl] = catchError(() => new URL(tarballUrl));
|
|
107976
107869
|
return urlError ? SKILLS_REGISTRY_URL : parsedUrl.origin;
|
|
107977
107870
|
}
|
|
107978
|
-
async function
|
|
107871
|
+
async function fetchJson(url2, authToken) {
|
|
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() {
|
|
107979
107886
|
const cliVersion = parseSemver(package_default.version);
|
|
107980
107887
|
if (!cliVersion) {
|
|
107981
107888
|
throw new Error(`Invalid CLI version ${package_default.version}; expected semantic version major.minor.patch`);
|
|
107982
107889
|
}
|
|
107983
|
-
const
|
|
107984
|
-
|
|
107985
|
-
|
|
107986
|
-
|
|
107987
|
-
|
|
107988
|
-
|
|
107989
|
-
return {
|
|
107990
|
-
version: selectedVersion,
|
|
107991
|
-
tarballUrl: tarballUrl ?? "",
|
|
107992
|
-
registryUrl: tarballUrl ? registryFromTarball(tarballUrl) : SKILLS_REGISTRY_URL
|
|
107993
|
-
};
|
|
107890
|
+
const ghToken = getGhNpmRegistryToken();
|
|
107891
|
+
if (ghToken) {
|
|
107892
|
+
logger.debug(`GH_NPM_REGISTRY_TOKEN found; using ${SKILLS_GITHUB_REGISTRY_URL}`);
|
|
107893
|
+
return await fetchMatchingSkillsPackageInfoFromRegistry(cliVersion, SKILLS_GITHUB_REGISTRY_URL, ghToken);
|
|
107894
|
+
}
|
|
107895
|
+
return await fetchMatchingSkillsPackageInfoWithNpm(cliVersion);
|
|
107994
107896
|
}
|
|
107995
107897
|
function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
107996
107898
|
const matchingVersions = versions2.filter((version2) => matchesCliVersionLine(version2, cliVersion));
|
|
@@ -108001,32 +107903,64 @@ function pickMatchingSkillsVersion(versions2, cliVersion) {
|
|
|
108001
107903
|
}
|
|
108002
107904
|
return selectedVersion;
|
|
108003
107905
|
}
|
|
108004
|
-
async function
|
|
108005
|
-
const
|
|
108006
|
-
const
|
|
108007
|
-
|
|
108008
|
-
|
|
108009
|
-
|
|
108010
|
-
`);
|
|
108011
|
-
|
|
108012
|
-
|
|
108013
|
-
|
|
107906
|
+
async function fetchMatchingSkillsPackageInfoWithNpm(cliVersion) {
|
|
107907
|
+
const versions2 = normalizeVersionList(await npmViewJson([SKILLS_PACKAGE_NAME, "versions"]));
|
|
107908
|
+
const selectedVersion = pickMatchingSkillsVersion(versions2, cliVersion);
|
|
107909
|
+
const tarballUrl = requireString(await npmViewJson([
|
|
107910
|
+
`${SKILLS_PACKAGE_NAME}@${selectedVersion}`,
|
|
107911
|
+
"dist.tarball"
|
|
107912
|
+
]), `${SKILLS_PACKAGE_NAME}@${selectedVersion} does not declare dist.tarball`);
|
|
107913
|
+
return {
|
|
107914
|
+
version: selectedVersion,
|
|
107915
|
+
tarballUrl,
|
|
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`);
|
|
108014
107933
|
}
|
|
107934
|
+
return {
|
|
107935
|
+
version: selectedVersion,
|
|
107936
|
+
tarballUrl,
|
|
107937
|
+
registryUrl,
|
|
107938
|
+
authToken
|
|
107939
|
+
};
|
|
108015
107940
|
}
|
|
108016
|
-
async function
|
|
108017
|
-
if (
|
|
108018
|
-
await
|
|
107941
|
+
async function downloadAndExtractPackage(packageInfo, destinationPath) {
|
|
107942
|
+
if (!packageInfo.authToken) {
|
|
107943
|
+
await packAndExtractPackage(packageInfo, destinationPath);
|
|
108019
107944
|
return;
|
|
108020
107945
|
}
|
|
108021
|
-
await
|
|
107946
|
+
const response = await fetch(packageInfo.tarballUrl, {
|
|
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);
|
|
108022
107956
|
}
|
|
108023
|
-
async function
|
|
107957
|
+
async function packAndExtractPackage(packageInfo, destinationPath) {
|
|
108024
107958
|
const fs7 = getFileSystem();
|
|
108025
107959
|
const packDir = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-pack-${randomUUID5()}`);
|
|
108026
107960
|
try {
|
|
108027
107961
|
await fs7.mkdir(packDir);
|
|
108028
|
-
const stdout = await
|
|
108029
|
-
const packOutput =
|
|
107962
|
+
const stdout = await runNpmCommand(["pack", `${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, "--json"], `pack ${SKILLS_PACKAGE_NAME}@${packageInfo.version}`, NPM_PACK_TIMEOUT_MS, packDir);
|
|
107963
|
+
const packOutput = parseNpmJson(stdout, "pack");
|
|
108030
107964
|
const packedFile = readPackedFileName(packOutput);
|
|
108031
107965
|
const packedPath = fs7.path.join(packDir, packedFile);
|
|
108032
107966
|
const packedContent = await fs7.readFile(packedPath);
|
|
@@ -108039,20 +107973,6 @@ async function packAndExtractWithNpm(packageInfo, destinationPath) {
|
|
|
108039
107973
|
await catchError(fs7.rm(packDir));
|
|
108040
107974
|
}
|
|
108041
107975
|
}
|
|
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
|
-
}
|
|
108056
107976
|
function readPackedFileName(packOutput) {
|
|
108057
107977
|
if (!Array.isArray(packOutput)) {
|
|
108058
107978
|
throw new TypeError(`Unexpected npm pack output for ${SKILLS_PACKAGE_NAME}`);
|
|
@@ -108231,17 +108151,15 @@ async function extractNpmTarballToDir(tarData, destinationDir) {
|
|
|
108231
108151
|
await extractTarEntry2(fs7, destinationDir, entryName, entry);
|
|
108232
108152
|
}
|
|
108233
108153
|
}
|
|
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,
|
|
108154
|
+
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org", SKILLS_GITHUB_REGISTRY_URL = "https://npm.pkg.github.com/", 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, childProcessModulePromise2, MANIFEST_NAME = "manifest.json";
|
|
108235
108155
|
var init_contentStore = __esm(() => {
|
|
108236
108156
|
init_src2();
|
|
108237
108157
|
init_src();
|
|
108238
108158
|
init_js_yaml();
|
|
108239
108159
|
init_package();
|
|
108240
|
-
init_detect();
|
|
108241
108160
|
STORE_NAME = `${UIPATH_HOME_DIR}/.skills`;
|
|
108242
|
-
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._
|
|
108243
|
-
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._
|
|
108244
|
-
PM_PREFERENCE = ["npm", "pnpm", "bun", "yarn"];
|
|
108161
|
+
SHELL_SAFE_ARG2 = /^[a-zA-Z0-9@/._-]+$/;
|
|
108162
|
+
SHELL_SAFE_COMMAND_LINE2 = /^[a-zA-Z0-9@/._\- ]+$/;
|
|
108245
108163
|
});
|
|
108246
108164
|
|
|
108247
108165
|
// src/commands/skills/agents/claude.ts
|
|
@@ -109038,6 +108956,17 @@ async function resolveSkillsContext(options, operation) {
|
|
|
109038
108956
|
const isLocal = !!options.local;
|
|
109039
108957
|
const fs7 = getFileSystem();
|
|
109040
108958
|
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
|
+
}
|
|
109041
108970
|
let agents;
|
|
109042
108971
|
if (options.agent) {
|
|
109043
108972
|
const agent = options.agent.trim().toLowerCase();
|
|
@@ -109072,17 +109001,6 @@ async function resolveSkillsContext(options, operation) {
|
|
|
109072
109001
|
agents = selected;
|
|
109073
109002
|
}
|
|
109074
109003
|
}
|
|
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
|
-
}
|
|
109086
109004
|
return { rootDir, storePath, selectedSkills, agents, isLocal };
|
|
109087
109005
|
}
|
|
109088
109006
|
async function detectInstalledAgents(isLocal) {
|
|
@@ -115127,7 +115045,6 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
115127
115045
|
});
|
|
115128
115046
|
return;
|
|
115129
115047
|
}
|
|
115130
|
-
stripHelpTextEventsForStructuredHelp(realCommand);
|
|
115131
115048
|
const toolArgs = context.args.slice(2);
|
|
115132
115049
|
const candidates = [entry.commandPrefix, ...aliases];
|
|
115133
115050
|
const prefixIdx = toolArgs.findIndex((a) => candidates.includes(a));
|
|
@@ -115151,7 +115068,6 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
115151
115068
|
var init_registerToolCommands = __esm(() => {
|
|
115152
115069
|
init_src2();
|
|
115153
115070
|
init_tools_whitelist();
|
|
115154
|
-
init_helpFormatter();
|
|
115155
115071
|
init_toolLoader();
|
|
115156
115072
|
});
|
|
115157
115073
|
|
|
@@ -115170,16 +115086,16 @@ async function resolveToolsDirectories(context) {
|
|
|
115170
115086
|
return { toolsDirs, toolsDir };
|
|
115171
115087
|
}
|
|
115172
115088
|
logger.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
|
|
115173
|
-
const { dirname:
|
|
115089
|
+
const { dirname: dirname2, join: join2 } = fs7.path;
|
|
115174
115090
|
const isInstalledPackage = process.execPath.includes(join2("@uipath", "cli", "dist", "uip"));
|
|
115175
115091
|
if (isInstalledPackage) {
|
|
115176
|
-
const execDir =
|
|
115177
|
-
const packageDir =
|
|
115178
|
-
const fallbackDir2 =
|
|
115092
|
+
const execDir = dirname2(process.execPath);
|
|
115093
|
+
const packageDir = dirname2(execDir);
|
|
115094
|
+
const fallbackDir2 = dirname2(packageDir);
|
|
115179
115095
|
logger.debug(`Fallback (installed package): ${fallbackDir2}`);
|
|
115180
115096
|
return { toolsDirs: [fallbackDir2], toolsDir: fallbackDir2 };
|
|
115181
115097
|
}
|
|
115182
|
-
const fallbackDir = join2(
|
|
115098
|
+
const fallbackDir = join2(dirname2(currentFilePath), "..");
|
|
115183
115099
|
logger.debug(`Fallback (development mode): ${fallbackDir}`);
|
|
115184
115100
|
return { toolsDirs: [fallbackDir], toolsDir: fallbackDir };
|
|
115185
115101
|
}
|
|
@@ -115440,4 +115356,4 @@ export {
|
|
|
115440
115356
|
ready
|
|
115441
115357
|
};
|
|
115442
115358
|
|
|
115443
|
-
//# debugId=
|
|
115359
|
+
//# debugId=F57483DDAE741E3264756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/cli",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.197.0
|
|
4
|
+
"version": "1.197.0",
|
|
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": "56f68b263cec4ea1f2a39d738bd99ecf52f88fea"
|
|
38
38
|
}
|