@uipath/cli 1.201.0-preview.127 → 1.201.0-preview.128

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.js CHANGED
@@ -68718,7 +68718,7 @@ var init_package = __esm(() => {
68718
68718
  package_default = {
68719
68719
  name: "@uipath/cli",
68720
68720
  license: "MIT",
68721
- version: "1.201.0-preview.127",
68721
+ version: "1.201.0-preview.128",
68722
68722
  description: "Cross platform CLI for UiPath",
68723
68723
  repository: {
68724
68724
  type: "git",
@@ -90057,27 +90057,6 @@ var init_tools_whitelist = __esm(() => {
90057
90057
  });
90058
90058
 
90059
90059
  // src/services/toolService.ts
90060
- var exports_toolService = {};
90061
- __export(exports_toolService, {
90062
- validateVersionString: () => validateVersionString,
90063
- validatePackageSpec: () => validatePackageSpec,
90064
- truncateVersionsForDisplay: () => truncateVersionsForDisplay,
90065
- toolService: () => toolService,
90066
- resolveToolPackageName: () => resolveToolPackageName,
90067
- resetBunOnPathCacheForTests: () => resetBunOnPathCacheForTests,
90068
- parsePackageSpec: () => parsePackageSpec,
90069
- isValidSemver: () => isValidSemver,
90070
- isPermissionError: () => isPermissionError,
90071
- isNpmViewMetadataError: () => isNpmViewMetadataError,
90072
- isDevMode: () => isDevMode,
90073
- isBunOnPath: () => isBunOnPath,
90074
- getEffectiveRegistry: () => getEffectiveRegistry,
90075
- compareSemver: () => compareSemver,
90076
- WHITELIST_BY_SHORT_NAME: () => WHITELIST_BY_SHORT_NAME,
90077
- WHITELIST_BY_COMMAND: () => WHITELIST_BY_COMMAND,
90078
- TOOLS_WHITELIST: () => TOOLS_WHITELIST,
90079
- NpmViewMetadataError: () => NpmViewMetadataError
90080
- });
90081
90060
  function isValidSemver(v) {
90082
90061
  return SEMVER_RE.test(v);
90083
90062
  }
@@ -90149,19 +90128,11 @@ async function isBunOnPath() {
90149
90128
  cachedBunOnPath = !error51 && result === true;
90150
90129
  return cachedBunOnPath;
90151
90130
  }
90152
- function resetBunOnPathCacheForTests() {
90153
- cachedBunOnPath = undefined;
90154
- }
90155
90131
  function validatePackageSpec(spec) {
90156
90132
  if (!SAFE_PACKAGE_SPEC.test(spec)) {
90157
90133
  throw new Error(`Invalid package specifier: '${spec}'. Only alphanumeric characters, dots, hyphens, underscores, slashes, and @ are allowed.`);
90158
90134
  }
90159
90135
  }
90160
- function validateVersionString(version2) {
90161
- if (!SAFE_VERSION.test(version2)) {
90162
- throw new Error(`Invalid version string: '${version2}'. Only alphanumeric characters, dots, hyphens, underscores, and semver operators are allowed.`);
90163
- }
90164
- }
90165
90136
  function isNpmViewMetadataError(error51) {
90166
90137
  return error51 instanceof NpmViewMetadataError || error51.name === "NpmViewMetadataError";
90167
90138
  }
@@ -90427,27 +90398,6 @@ async function runPackageManagerWithBun(args, cwd, extraEnv) {
90427
90398
  logger.debug(`Running package manager: bun ${pmArgs.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
90428
90399
  await spawnPackageManager("bun", pmArgs, cwd, `bun ${pmArgs[0]}`, extraEnv);
90429
90400
  }
90430
- function extractTarEntry(tar, entryName) {
90431
- const decoder3 = new TextDecoder;
90432
- let offset = 0;
90433
- while (offset + 512 <= tar.length) {
90434
- const header = tar.subarray(offset, offset + 512);
90435
- if (header.every((b) => b === 0))
90436
- break;
90437
- const name = decoder3.decode(header.subarray(0, 100)).split("\x00", 1)[0];
90438
- const sizeField = decoder3.decode(header.subarray(124, 136)).split("\x00", 1)[0].trim();
90439
- const size = Number.parseInt(sizeField, 8);
90440
- if (Number.isNaN(size) || size < 0) {
90441
- throw new Error(`Corrupt tar header at offset ${offset}`);
90442
- }
90443
- const typeflag = header[156];
90444
- if ((typeflag === 0 || typeflag === 48) && name === entryName) {
90445
- return decoder3.decode(tar.subarray(offset + 512, offset + 512 + size));
90446
- }
90447
- offset += 512 + Math.ceil(size / 512) * 512;
90448
- }
90449
- return null;
90450
- }
90451
90401
 
90452
90402
  class NodeToolService {
90453
90403
  async npmView(packageName, timeoutMs = NPM_VIEW_TIMEOUT_MS, registry3) {
@@ -90612,88 +90562,6 @@ ${errors7.map((e) => ` - ${e}`).join(`
90612
90562
  }
90613
90563
  return null;
90614
90564
  }
90615
- async npmPack(packageName, destination, timeoutMs) {
90616
- const args = ["pack", packageName];
90617
- const { spawn: spawn2 } = await loadChildProcess();
90618
- const isWindows = process.platform === "win32";
90619
- const env = {
90620
- ...process.env,
90621
- npm_config_pack_destination: destination
90622
- };
90623
- await new Promise((resolve2, reject) => {
90624
- let proc;
90625
- if (isWindows) {
90626
- for (const token of ["npm", ...args]) {
90627
- if (!SHELL_SAFE_ARG.test(token)) {
90628
- reject(new Error(`Unsafe argument: '${token}'`));
90629
- return;
90630
- }
90631
- }
90632
- const commandLine = ["npm", ...args].join(" ");
90633
- if (!SHELL_SAFE_COMMAND_LINE.test(commandLine)) {
90634
- reject(new Error(`Unsafe command line: '${commandLine}'`));
90635
- return;
90636
- }
90637
- proc = spawn2(commandLine, [], { shell: true, env });
90638
- } else {
90639
- proc = spawn2("npm", args, { env });
90640
- }
90641
- let stderr = "";
90642
- const MAX_STDERR = 65536;
90643
- proc.stderr?.on("data", (d) => {
90644
- if (stderr.length < MAX_STDERR)
90645
- stderr += d.toString();
90646
- });
90647
- const timer = setTimeout(() => {
90648
- proc.kill("SIGTERM");
90649
- reject(new Error(`npm pack ${packageName} timed out after ${timeoutMs / 1000}s`));
90650
- }, timeoutMs);
90651
- proc.on("error", (err) => {
90652
- clearTimeout(timer);
90653
- reject(err);
90654
- });
90655
- proc.on("close", (code) => {
90656
- clearTimeout(timer);
90657
- if (code === 0) {
90658
- resolve2();
90659
- return;
90660
- }
90661
- reject(new Error(`npm pack ${packageName} failed with code ${code}${stderr.trim() ? `: ${stderr.trim()}` : ""}`));
90662
- });
90663
- });
90664
- }
90665
- async downloadPackageFile(packageName, fileName, options) {
90666
- validatePackageSpec(packageName);
90667
- if (!SHELL_SAFE_ARG.test(packageName)) {
90668
- throw new Error(`Unsafe package name: '${packageName}'`);
90669
- }
90670
- const timeoutMs = options?.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
90671
- const fs7 = getFileSystem();
90672
- const dir = await fs7.getTempDir();
90673
- try {
90674
- await this.npmPack(packageName, dir, timeoutMs);
90675
- const entries = await fs7.readdir(dir);
90676
- const tarballName = entries.find((entry) => entry.endsWith(".tgz"));
90677
- if (!tarballName) {
90678
- throw new Error(`npm pack produced no tarball for ${packageName}`);
90679
- }
90680
- const bytes = await fs7.readFile(fs7.path.join(dir, tarballName));
90681
- if (!bytes) {
90682
- throw new Error(`Could not read the packed tarball for ${packageName}`);
90683
- }
90684
- const { gunzipSync } = await import("node:zlib");
90685
- const content = extractTarEntry(gunzipSync(bytes), `package/${fileName}`);
90686
- if (content === null) {
90687
- throw new Error(`File '${fileName}' not found in the ${packageName} tarball`);
90688
- }
90689
- return content;
90690
- } finally {
90691
- const [rmErr] = await catchError(fs7.rm(dir));
90692
- if (rmErr) {
90693
- logger.debug(`Could not remove the temp dir for ${packageName}: ${rmErr.message}`);
90694
- }
90695
- }
90696
- }
90697
90565
  async install(packageName, destination, options) {
90698
90566
  validatePackageSpec(packageName);
90699
90567
  await refuseIfBundledDistribution(destination, "install", packageName);
@@ -90797,7 +90665,7 @@ function truncateVersionsForDisplay(versions2) {
90797
90665
  }
90798
90666
  return result;
90799
90667
  }
90800
- var SEMVER_RE, SAFE_PACKAGE_SPEC, SAFE_VERSION, SHELL_SAFE_ARG, SHELL_SAFE_COMMAND_LINE, NPM_TIMEOUT_MS = 180000, NPM_VIEW_TIMEOUT_MS = 30000, NPM_MAX_RETRIES = 2, TRANSIENT_NPM_ERRORS, UNSUPPORTED_PROTOCOL_MARKER = "EUNSUPPORTEDPROTOCOL", cachedBunOnPath, childProcessModulePromise, NpmViewMetadataError, NPMJS_REGISTRY = "https://registry.npmjs.org", GITHUB_REGISTRY = "https://npm.pkg.github.com", REGISTRY_PREFERENCE, effectiveNpmConfigPromise = null, PERMISSION_ERROR_MARKERS, toolService;
90668
+ var SEMVER_RE, SAFE_PACKAGE_SPEC, SHELL_SAFE_ARG, SHELL_SAFE_COMMAND_LINE, NPM_TIMEOUT_MS = 180000, NPM_VIEW_TIMEOUT_MS = 30000, NPM_MAX_RETRIES = 2, TRANSIENT_NPM_ERRORS, UNSUPPORTED_PROTOCOL_MARKER = "EUNSUPPORTEDPROTOCOL", cachedBunOnPath, childProcessModulePromise, NpmViewMetadataError, NPMJS_REGISTRY = "https://registry.npmjs.org", GITHUB_REGISTRY = "https://npm.pkg.github.com", REGISTRY_PREFERENCE, effectiveNpmConfigPromise = null, PERMISSION_ERROR_MARKERS, toolService;
90801
90669
  var init_toolService = __esm(() => {
90802
90670
  init_src2();
90803
90671
  init_src();
@@ -90808,7 +90676,6 @@ var init_toolService = __esm(() => {
90808
90676
  init_tools_whitelist();
90809
90677
  SEMVER_RE = /^\d+\.\d+\.\d+(-[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?(\+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?$/;
90810
90678
  SAFE_PACKAGE_SPEC = /^@?[a-zA-Z0-9._/-]+(@[a-zA-Z0-9._+:~^<>=| -]+)?$/;
90811
- SAFE_VERSION = /^[a-zA-Z0-9._+:~^<>=| -]+$/;
90812
90679
  SHELL_SAFE_ARG = /^[a-zA-Z0-9@/._-]+$/;
90813
90680
  SHELL_SAFE_COMMAND_LINE = /^[a-zA-Z0-9@/._\- ]+$/;
90814
90681
  TRANSIENT_NPM_ERRORS = ["ENOTEMPTY", "EBUSY"];
@@ -91938,12 +91805,11 @@ function parseVersionPin(raw) {
91938
91805
  pin.patch = Number(match[3]);
91939
91806
  return pin;
91940
91807
  }
91941
- function majorMinorPinOf(version2) {
91942
- const [rawMajor, rawMinor] = version2.trim().split(/[.\-+]/);
91943
- if (rawMajor === undefined || rawMinor === undefined || !/^\d+$/.test(rawMajor) || !/^\d+$/.test(rawMinor)) {
91808
+ function majorOf(version2) {
91809
+ const [rawMajor] = version2.trim().split(/[.\-+]/);
91810
+ if (rawMajor === undefined || !/^\d+$/.test(rawMajor))
91944
91811
  return null;
91945
- }
91946
- return { major: Number(rawMajor), minor: Number(rawMinor) };
91812
+ return Number(rawMajor);
91947
91813
  }
91948
91814
  function resolvePinnedVersion() {
91949
91815
  return parseVersionPin(getCachedConfig().core?.version);
@@ -92301,7 +92167,7 @@ var init_config2 = __esm(() => {
92301
92167
  normalize: (v) => v.trim(),
92302
92168
  validate: (v) => isValidVersionPin(v),
92303
92169
  valueHint: "Use major.minor or major.minor.patch (e.g. 1.2 or 1.2.3).",
92304
- description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows your environment or the latest"
92170
+ description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows the latest release"
92305
92171
  },
92306
92172
  clientSecret: {
92307
92173
  path: ["auth", "clientSecret"],
@@ -92313,7 +92179,7 @@ var init_config2 = __esm(() => {
92313
92179
  WRITABLE_KEY_NAMES = VALID_KEY_NAMES.filter((key) => CONFIG_KEYS[key].writable !== false);
92314
92180
  REMOVED_KEYS = {
92315
92181
  autoVersionSync: "`autoVersionSync` was removed. To stop auto-updates, freeze on an " + "exact version: `uip config set version <major.minor.patch>` " + "(undo with `uip config clear version`).",
92316
- versionSource: "`versionSource` was removed. Version policy now lives entirely in " + "`version`: set a pin with `uip config set version <major.minor[.patch]>`, " + "or clear it with `uip config clear version` to follow your " + "environment or the latest release."
92182
+ versionSource: "`versionSource` was removed. Version policy now lives entirely in " + "`version`: set a pin with `uip config set version <major.minor[.patch]>`, " + "or clear it with `uip config clear version` to follow the latest " + "release."
92317
92183
  };
92318
92184
  CONFIG_GET_EXAMPLES = [
92319
92185
  {
@@ -92400,7 +92266,7 @@ var init_config2 = __esm(() => {
92400
92266
  ];
92401
92267
  CONFIG_CLEAR_EXAMPLES = [
92402
92268
  {
92403
- Description: "Clear the version pin so the CLI follows the environment / latest again",
92269
+ Description: "Clear the version pin so the CLI follows the latest release again",
92404
92270
  Command: "uip config clear version",
92405
92271
  Output: {
92406
92272
  Code: "ConfigClear",
@@ -92467,11 +92333,6 @@ var init_promptSelect = __esm(() => {
92467
92333
  });
92468
92334
 
92469
92335
  // src/services/auth.ts
92470
- var exports_auth = {};
92471
- __export(exports_auth, {
92472
- auth: () => auth
92473
- });
92474
-
92475
92336
  class NodeAuth {
92476
92337
  async interactiveLogin(options) {
92477
92338
  const { interactiveLogin: interactiveLogin2 } = await Promise.resolve().then(() => (init_src3(), exports_src2));
@@ -111224,7 +111085,7 @@ function isTarDirectoryEntry(typeFlag, entryName) {
111224
111085
  function isTarRegularFileEntry(typeFlag) {
111225
111086
  return typeFlag === "0" || typeFlag === "\x00";
111226
111087
  }
111227
- async function extractTarEntry2(fs7, destinationDir, entryName, entry) {
111088
+ async function extractTarEntry(fs7, destinationDir, entryName, entry) {
111228
111089
  if (isTarDirectoryEntry(entry.typeFlag, entryName)) {
111229
111090
  await fs7.mkdir(resolveTarEntryPath(fs7, destinationDir, entryName));
111230
111091
  return;
@@ -111258,7 +111119,7 @@ async function extractNpmTarballToDir(tarData, destinationDir) {
111258
111119
  const entryName = stripNpmPackageRoot(rawPath);
111259
111120
  if (!entryName)
111260
111121
  continue;
111261
- await extractTarEntry2(fs7, destinationDir, entryName, entry);
111122
+ await extractTarEntry(fs7, destinationDir, entryName, entry);
111262
111123
  }
111263
111124
  }
111264
111125
  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, SkillSourceError, SkillsRegistryAuthError, SkillsPackageMetadataError, SkillsPackOutputError, DEFAULT_SOURCE, MAX_SKILL_SCAN_DEPTH = 16, 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.";
@@ -117108,14 +116969,12 @@ var init_ora = __esm(() => {
117108
116969
 
117109
116970
  // src/services/updateFailureFormat.ts
117110
116971
  function pinnedLineRemediation(origin) {
117111
- if (origin === "environment")
117112
- return ENVIRONMENT_LINE_REMEDIATION;
117113
116972
  if (origin === "latest")
117114
116973
  return LATEST_LINE_REMEDIATION;
117115
116974
  return PINNED_LINE_REMEDIATION;
117116
116975
  }
117117
116976
  function toolFailureRemediation(origin) {
117118
- const changeTarget = origin === "environment" ? "pin a version line with `uip config set version <major.minor>` to override your environment" : origin === "latest" ? "pin a version line with `uip config set version <major.minor>`" : "adjust the pinned `core.version`";
116977
+ const changeTarget = origin === "latest" ? "pin a version line with `uip config set version <major.minor>`" : "adjust the pinned `core.version`";
117119
116978
  return `Check tool compatibility with the current CLI version, ${changeTarget}, ` + `or run \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\` to switch release channels.`;
117120
116979
  }
117121
116980
  function isPinnedLineMissing(error52) {
@@ -117127,17 +116986,12 @@ function describeSearchedRegistry(registry3) {
117127
116986
  function describeMissingLine(opts) {
117128
116987
  const { pin, origin, targetLine, searched } = opts;
117129
116988
  const suffix = describeSearchedRegistry(searched);
117130
- if (origin === "environment") {
117131
- return `No version found matching your environment's version line ${formatVersionPin(pin)} in the ${targetLine} line${suffix}`;
117132
- }
117133
116989
  if (origin === "latest") {
117134
116990
  return `No version found in the latest ${targetLine} line${suffix}`;
117135
116991
  }
117136
116992
  return `No version found matching pinned ${formatVersionPin(pin)} in the ${targetLine} line${suffix}`;
117137
116993
  }
117138
116994
  function describeDowngradeReason(origin) {
117139
- if (origin === "environment")
117140
- return "your environment's version line";
117141
116995
  if (origin === "latest")
117142
116996
  return "the latest version line";
117143
116997
  return "the pinned version";
@@ -117156,9 +117010,6 @@ function describePinnedLine(target) {
117156
117010
  if (!target?.pin)
117157
117011
  return "the pinned version line";
117158
117012
  const line = `${target.pin.major}.${target.pin.minor}`;
117159
- if (target.origin === "environment") {
117160
- return `your environment's version line ${line}`;
117161
- }
117162
117013
  if (target.origin === "latest") {
117163
117014
  return `the latest version line ${line}`;
117164
117015
  }
@@ -117175,12 +117026,11 @@ function collapsePinnedLineErrors(report, target) {
117175
117026
  individual: report.Errors.filter((e) => !isPinnedLineMissing(e))
117176
117027
  };
117177
117028
  }
117178
- var PINNED_LINE_REMEDIATION, ENVIRONMENT_LINE_REMEDIATION, LATEST_LINE_REMEDIATION;
117029
+ var PINNED_LINE_REMEDIATION, LATEST_LINE_REMEDIATION;
117179
117030
  var init_updateFailureFormat = __esm(() => {
117180
117031
  init_channels();
117181
117032
  init_versionPin();
117182
- PINNED_LINE_REMEDIATION = "Pin a published version line with `uip config set version <major.minor>`, " + `switch channels with \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, ` + "or clear the pin with `uip config clear version` to track your " + "environment or the latest release, then re-run `uip update`.";
117183
- ENVIRONMENT_LINE_REMEDIATION = "This line comes from your environment, not a config pin — " + "`uip config clear version` will not change it. Pin a published version " + "line with `uip config set version <major.minor>` to override the " + "environment, or switch channels with " + `\`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, then re-run \`uip update\`.`;
117033
+ PINNED_LINE_REMEDIATION = "Pin a published version line with `uip config set version <major.minor>`, " + `switch channels with \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, ` + "or clear the pin with `uip config clear version` to track the latest " + "release, then re-run `uip update`.";
117184
117034
  LATEST_LINE_REMEDIATION = "Pin a published version line with `uip config set version <major.minor>`, " + `or switch channels with \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, ` + "then re-run `uip update`.";
117185
117035
  });
117186
117036
 
@@ -117194,13 +117044,6 @@ function buildToolUpdatePolicy(opts, cliVersionPrefix) {
117194
117044
  if (pin) {
117195
117045
  const targetLine2 = formatTargetLine(pinnedPrefix(pin));
117196
117046
  const renderedPin = formatVersionPin(pin);
117197
- if (opts.pinOrigin === "environment") {
117198
- return {
117199
- resolvedBy: "environment",
117200
- targetLine: targetLine2,
117201
- reason: `Using your environment's version line ${renderedPin}; tools resolve within ${targetLine2}.`
117202
- };
117203
- }
117204
117047
  return {
117205
117048
  resolvedBy: "core.version",
117206
117049
  targetLine: targetLine2,
@@ -117439,230 +117282,22 @@ var init_updateService_tools = __esm(() => {
117439
117282
  };
117440
117283
  });
117441
117284
 
117442
- // src/services/versionSyncState.ts
117443
- import { randomUUID as randomUUID7 } from "node:crypto";
117444
- function todayLocal() {
117445
- const d = new Date;
117446
- const month = String(d.getMonth() + 1).padStart(2, "0");
117447
- const day = String(d.getDate()).padStart(2, "0");
117448
- return `${d.getFullYear()}-${month}-${day}`;
117449
- }
117450
- function stateFilePath(fs7) {
117451
- return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
117452
- }
117453
- async function readState(fs7 = getFileSystem()) {
117454
- const [readErr, raw] = await catchError(fs7.readFile(stateFilePath(fs7), "utf-8"));
117455
- if (readErr || !raw)
117456
- return {};
117457
- const [parseErr, parsed] = catchError(() => JSON.parse(raw));
117458
- if (parseErr || parsed === null || typeof parsed !== "object") {
117459
- return {};
117460
- }
117461
- const state = {};
117462
- if (typeof parsed.lastUpdateDate === "string") {
117463
- state.lastUpdateDate = parsed.lastUpdateDate;
117464
- }
117465
- if (typeof parsed.envLine === "string")
117466
- state.envLine = parsed.envLine;
117467
- if (typeof parsed.envLineDate === "string") {
117468
- state.envLineDate = parsed.envLineDate;
117469
- }
117470
- if (typeof parsed.envLineAttemptDate === "string") {
117471
- state.envLineAttemptDate = parsed.envLineAttemptDate;
117472
- }
117473
- if (typeof parsed.envKey === "string")
117474
- state.envKey = parsed.envKey;
117475
- return state;
117476
- }
117477
- async function mergeState(patch, fs7 = getFileSystem()) {
117478
- const current = await readState(fs7);
117479
- const next = { ...current, ...patch };
117480
- const target = stateFilePath(fs7);
117481
- await catchError(fs7.mkdir(fs7.path.dirname(target)));
117482
- const tempPath = `${target}.${randomUUID7()}.tmp`;
117483
- const [err] = await catchError((async () => {
117484
- await fs7.writeFile(tempPath, JSON.stringify(next, null, 2));
117485
- await fs7.rename(tempPath, target);
117486
- })());
117487
- if (err) {
117488
- await catchError(fs7.rm(tempPath));
117489
- return false;
117490
- }
117491
- return true;
117492
- }
117493
- async function invalidateSyncState(fs7 = getFileSystem()) {
117494
- await catchError(fs7.rm(stateFilePath(fs7)));
117495
- }
117496
- var STATE_FILENAME = "version-sync.json";
117497
- var init_versionSyncState = __esm(() => {
117498
- init_src2();
117499
- init_src();
117500
- });
117501
-
117502
117285
  // src/services/versionTarget.ts
117503
- function mapAuthorityToEnvironment(baseUrl) {
117504
- const [err, host] = catchError(() => new URL(baseUrl).hostname.toLowerCase());
117505
- if (err || !host)
117506
- return "unknown";
117507
- if (host === "alpha.uipath.com")
117508
- return "alpha";
117509
- if (host === "staging.uipath.com")
117510
- return "staging";
117511
- if (host === "cloud.uipath.com")
117512
- return "cloud";
117513
- return "unknown";
117514
- }
117515
- async function currentKnownEnvironment() {
117516
- const { auth: auth2 } = await Promise.resolve().then(() => (init_auth(), exports_auth));
117517
- const [statusErr, status] = await catchError(auth2.getLoginStatus());
117518
- if (statusErr || status.loginStatus !== "Logged in" || !status.baseUrl) {
117519
- return null;
117520
- }
117521
- const env2 = mapAuthorityToEnvironment(status.baseUrl);
117522
- return env2 === "unknown" ? null : env2;
117523
- }
117524
- async function downloadVersions() {
117525
- const { toolService: toolService2 } = await Promise.resolve().then(() => (init_toolService(), exports_toolService));
117526
- const [dlErr, raw] = await catchError(toolService2.downloadPackageFile(VERSIONS_PACKAGE, VERSIONS_FILENAME, {
117527
- timeoutMs: DOWNLOAD_TIMEOUT_MS
117528
- }));
117529
- if (dlErr) {
117530
- logger.debug(`Failed to download ${VERSIONS_FILENAME} from ${VERSIONS_PACKAGE}: ${dlErr.message}`);
117531
- return null;
117532
- }
117533
- const [jsonErr, json3] = catchError(() => JSON.parse(raw));
117534
- if (jsonErr) {
117535
- logger.debug(`Failed to parse ${VERSIONS_FILENAME}: ${jsonErr.message}`);
117536
- return null;
117537
- }
117538
- return json3;
117539
- }
117540
- async function fetchEnvLine(env2) {
117541
- const versions2 = await downloadVersions();
117542
- if (!versions2)
117543
- return null;
117544
- const parsed = VersionsSchema.safeParse(versions2);
117545
- if (!parsed.success) {
117546
- logger.debug("cli-versions.json failed schema validation; skipping");
117547
- return null;
117548
- }
117549
- if (parsed.data.schemaVersion !== undefined && parsed.data.schemaVersion > SUPPORTED_SCHEMA_VERSION) {
117550
- logger.debug(`cli-versions.json schemaVersion ${parsed.data.schemaVersion} is newer than supported ${SUPPORTED_SCHEMA_VERSION}; skipping`);
117551
- return null;
117552
- }
117553
- const line = parsed.data.environments[env2]?.cliVersion;
117554
- if (!line || !majorMinorPinOf(line)) {
117555
- logger.debug(`No usable cliVersion for '${env2}'; skipping`);
117556
- return null;
117557
- }
117558
- return line;
117559
- }
117560
- function cacheFresh(state, env2) {
117561
- return state.envKey === env2 && state.envLineDate === todayLocal();
117562
- }
117563
- async function refreshEnvCacheIfStale() {
117564
- const state = await readState();
117565
- const today = todayLocal();
117566
- if (state.envLineAttemptDate === today) {
117567
- logger.debug("Env refresh skipped: already attempted today (backoff after a failed fetch)");
117568
- return state.envLine ?? null;
117569
- }
117570
- const env2 = await currentKnownEnvironment();
117571
- if (!env2) {
117572
- logger.debug("Env refresh skipped: not logged into a known environment");
117573
- return null;
117574
- }
117575
- if (cacheFresh(state, env2) && state.envLine) {
117576
- logger.debug(`Env line cache fresh (${env2}=${state.envLine}); skipping`);
117577
- return state.envLine;
117578
- }
117579
- if (!await mergeState({ envLineAttemptDate: today })) {
117580
- logger.debug("Env refresh skipped: could not persist the attempt claim (state dir unwritable)");
117581
- return state.envLine ?? null;
117582
- }
117583
- const line = await fetchEnvLine(env2);
117584
- if (!line)
117585
- return null;
117586
- await mergeState({ envLine: line, envLineDate: today, envKey: env2 });
117587
- logger.debug(`Env line cached: ${env2}=${line}`);
117588
- return line;
117589
- }
117590
- async function getEnvLine(env2, allowFetch) {
117591
- const state = await readState();
117592
- if (cacheFresh(state, env2) && state.envLine)
117593
- return state.envLine;
117594
- if (state.envKey === env2 && state.envLine && !allowFetch) {
117595
- return state.envLine;
117596
- }
117597
- if (!allowFetch)
117598
- return null;
117599
- const line = await fetchEnvLine(env2);
117600
- if (!line)
117601
- return state.envKey === env2 ? state.envLine ?? null : null;
117602
- await mergeState({ envLine: line, envLineDate: todayLocal(), envKey: env2 });
117603
- return line;
117604
- }
117605
- async function resolveEffectiveTarget(allowFetch = true) {
117286
+ function resolveEffectiveTarget() {
117606
117287
  const pin = resolvePinnedVersion();
117607
117288
  if (pin) {
117608
117289
  return { pin, frozen: isExactPin(pin), origin: "config" };
117609
117290
  }
117610
- const env2 = await currentKnownEnvironment();
117611
- if (env2) {
117612
- const line = await getEnvLine(env2, allowFetch);
117613
- const envPin = line ? majorMinorPinOf(line) : null;
117614
- if (envPin) {
117615
- return {
117616
- pin: envPin,
117617
- frozen: false,
117618
- origin: "environment",
117619
- envKey: env2
117620
- };
117621
- }
117622
- return {
117623
- pin: null,
117624
- frozen: false,
117625
- origin: "environment",
117626
- envKey: env2,
117627
- envUnresolved: true
117628
- };
117629
- }
117630
117291
  return { pin: null, frozen: false, origin: "latest" };
117631
117292
  }
117632
- var VERSIONS_PACKAGE = "@uipath/cli-meta", VERSIONS_FILENAME = "cli-versions.json", SUPPORTED_SCHEMA_VERSION = 1, DOWNLOAD_TIMEOUT_MS = 8000, VersionsSchema;
117633
117293
  var init_versionTarget = __esm(() => {
117634
- init_src2();
117635
- init_zod();
117636
117294
  init_versionPin();
117637
- init_versionSyncState();
117638
- VersionsSchema = exports_external.object({
117639
- schemaVersion: exports_external.number().optional(),
117640
- environments: exports_external.record(exports_external.string(), exports_external.object({ cliVersion: exports_external.string().min(1) }).passthrough())
117641
- }).passthrough();
117642
117295
  });
117643
117296
 
117644
117297
  // src/commands/tools/update.ts
117645
117298
  function registerUpdateCommand2(toolsCommand, _context, state) {
117646
117299
  toolsCommand.command("update").description("Update installed tools within the active version line").option("--name <scoped-tool-name>", "scoped package name").examples(TOOLS_UPDATE_EXAMPLES).trackedAction(processContext, async (options) => {
117647
- const [targetErr, target] = await catchError(resolveEffectiveTarget(true));
117648
- if (targetErr) {
117649
- OutputFormatter.error({
117650
- Result: RESULTS.Failure,
117651
- Message: `Could not determine the update target: ${targetErr.message}`,
117652
- Instructions: "Re-run `uip tools update`; if it persists, check the log file, or pin a line with `uip config set version <major.minor>` to bypass environment resolution."
117653
- });
117654
- processContext.exit(EXIT_CODES.Failure);
117655
- return;
117656
- }
117657
- if (target.envUnresolved) {
117658
- OutputFormatter.error({
117659
- Result: RESULTS.Failure,
117660
- Message: "Could not resolve your environment's version line.",
117661
- Instructions: "Check your connection and re-run `uip tools update`, or pin a line with `uip config set version <major.minor>` to override the environment."
117662
- });
117663
- processContext.exit(EXIT_CODES.Failure);
117664
- return;
117665
- }
117300
+ const target = resolveEffectiveTarget();
117666
117301
  if (target.frozen && target.pin) {
117667
117302
  const exact = formatVersionPin(target.pin);
117668
117303
  const line = `${target.pin.major}.${target.pin.minor}`;
@@ -118118,10 +117753,7 @@ async function checkCliVersion(opts) {
118118
117753
  return skipped(opts.cliPkgVersion, "dev mode");
118119
117754
  }
118120
117755
  const pin = opts.pin ?? null;
118121
- const [err, latest] = await catchError(pin ? toolService.searchLatestVersion("@uipath/cli", pinnedPrefix(pin), {
118122
- channel: opts.channel,
118123
- timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
118124
- }) : toolService.searchLatestVersion("@uipath/cli", undefined, {
117756
+ const [err, latest] = await catchError(toolService.searchLatestVersion("@uipath/cli", pin ? pinnedPrefix(pin) : undefined, {
118125
117757
  channel: opts.channel,
118126
117758
  timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
118127
117759
  }));
@@ -118147,6 +117779,15 @@ async function checkCliVersion(opts) {
118147
117779
  }
118148
117780
  return skipped(opts.cliPkgVersion, `no ${opts.channel} version found`);
118149
117781
  }
117782
+ if (!pin && exceedsMajorCeiling(latest, opts.maxMajor)) {
117783
+ return {
117784
+ current: opts.cliPkgVersion,
117785
+ available: latest,
117786
+ action: "none",
117787
+ reason: null,
117788
+ heldBackVersion: latest
117789
+ };
117790
+ }
118150
117791
  const differs = pin ? compareSemver(latest, opts.cliPkgVersion) !== 0 : compareSemver(latest, opts.cliPkgVersion) > 0;
118151
117792
  if (differs) {
118152
117793
  return {
@@ -118163,6 +117804,12 @@ async function checkCliVersion(opts) {
118163
117804
  reason: null
118164
117805
  };
118165
117806
  }
117807
+ function exceedsMajorCeiling(version2, maxMajor) {
117808
+ if (maxMajor === undefined)
117809
+ return false;
117810
+ const major = majorOf(version2);
117811
+ return major !== null && major > maxMajor;
117812
+ }
118166
117813
  function skipped(current, reason) {
118167
117814
  return { current, available: null, action: "skipped", reason };
118168
117815
  }
@@ -118219,7 +117866,8 @@ async function runUpdate(options, state, cliEnv) {
118219
117866
  cliPkgVersion: cliEnv.cliPkgVersion,
118220
117867
  isDev: cliEnv.isDev,
118221
117868
  pin: options.versionPin ?? null,
118222
- pinOrigin: options.versionPinOrigin
117869
+ pinOrigin: options.versionPinOrigin,
117870
+ maxMajor: options.maxMajor
118223
117871
  }) : null;
118224
117872
  let detectedInstallCtx = null;
118225
117873
  const getDetectedInstallCtx = () => {
@@ -118391,25 +118039,7 @@ function registerUpdateCommand3(program2, _context, state) {
118391
118039
  processContext.exit(EXIT_CODES.ValidationError);
118392
118040
  return;
118393
118041
  }
118394
- const [targetErr, target] = await catchError(resolveEffectiveTarget(true));
118395
- if (targetErr) {
118396
- OutputFormatter.error({
118397
- Result: RESULTS.Failure,
118398
- Message: `Could not determine the update target: ${targetErr.message}`,
118399
- Instructions: "Re-run `uip update`; if it persists, check the log file, or pin a line with `uip config set version <major.minor>` to bypass environment resolution."
118400
- });
118401
- processContext.exit(EXIT_CODES.Failure);
118402
- return;
118403
- }
118404
- if (target.envUnresolved) {
118405
- OutputFormatter.error({
118406
- Result: RESULTS.Failure,
118407
- Message: "Could not resolve your environment's version line.",
118408
- Instructions: "Check your connection and re-run `uip update`, or pin a line with `uip config set version <major.minor>` to override the environment."
118409
- });
118410
- processContext.exit(EXIT_CODES.Failure);
118411
- return;
118412
- }
118042
+ const target = resolveEffectiveTarget();
118413
118043
  if (target.frozen && target.pin) {
118414
118044
  const exact = formatVersionPin(target.pin);
118415
118045
  const line = `${target.pin.major}.${target.pin.minor}`;
@@ -118945,6 +118575,53 @@ var init_tool_manager = __esm(() => {
118945
118575
  init_toolService();
118946
118576
  });
118947
118577
 
118578
+ // src/services/versionSyncState.ts
118579
+ import { randomUUID as randomUUID7 } from "node:crypto";
118580
+ function todayLocal() {
118581
+ const d = new Date;
118582
+ const month = String(d.getMonth() + 1).padStart(2, "0");
118583
+ const day = String(d.getDate()).padStart(2, "0");
118584
+ return `${d.getFullYear()}-${month}-${day}`;
118585
+ }
118586
+ function stateFilePath(fs7) {
118587
+ return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
118588
+ }
118589
+ async function readState(fs7 = getFileSystem()) {
118590
+ const [readErr, raw] = await catchError(fs7.readFile(stateFilePath(fs7), "utf-8"));
118591
+ if (readErr || !raw)
118592
+ return {};
118593
+ const [parseErr, parsed] = catchError(() => JSON.parse(raw));
118594
+ if (parseErr || parsed === null || typeof parsed !== "object") {
118595
+ return {};
118596
+ }
118597
+ const state = {};
118598
+ if (typeof parsed.lastUpdateDate === "string") {
118599
+ state.lastUpdateDate = parsed.lastUpdateDate;
118600
+ }
118601
+ return state;
118602
+ }
118603
+ async function mergeState(patch, fs7 = getFileSystem()) {
118604
+ const current = await readState(fs7);
118605
+ const next = { ...current, ...patch };
118606
+ const target = stateFilePath(fs7);
118607
+ await catchError(fs7.mkdir(fs7.path.dirname(target)));
118608
+ const tempPath = `${target}.${randomUUID7()}.tmp`;
118609
+ const [err] = await catchError((async () => {
118610
+ await fs7.writeFile(tempPath, JSON.stringify(next, null, 2));
118611
+ await fs7.rename(tempPath, target);
118612
+ })());
118613
+ if (err) {
118614
+ await catchError(fs7.rm(tempPath));
118615
+ return false;
118616
+ }
118617
+ return true;
118618
+ }
118619
+ var STATE_FILENAME = "version-sync.json";
118620
+ var init_versionSyncState = __esm(() => {
118621
+ init_src2();
118622
+ init_src();
118623
+ });
118624
+
118948
118625
  // src/services/versionSync.ts
118949
118626
  async function maybeRunDailyVersionSync(context, state) {
118950
118627
  const [err, reexeced] = await catchError(runStartupSync(context, state));
@@ -118954,33 +118631,6 @@ async function maybeRunDailyVersionSync(context, state) {
118954
118631
  }
118955
118632
  return reexeced;
118956
118633
  }
118957
- async function runPostLoginVersionSync(context) {
118958
- if (context.capabilities.isBrowser) {
118959
- logger.debug("Post-login sync skipped: browser environment");
118960
- return;
118961
- }
118962
- if (isTruthyEnv(process.env[DISABLE_ENV])) {
118963
- logger.debug(`Post-login sync skipped: ${DISABLE_ENV} is set`);
118964
- return;
118965
- }
118966
- const verb = extractVerb(context.args);
118967
- if (verb !== "login") {
118968
- logger.debug(`Post-login sync: not a login command (verb=${verb})`);
118969
- return;
118970
- }
118971
- if (extractVerb(context.args, 1) === "status") {
118972
- logger.debug("Post-login sync: read-only `login status`; skipping");
118973
- return;
118974
- }
118975
- if (process.exitCode) {
118976
- logger.debug(`Post-login sync: login failed (exitCode=${String(process.exitCode)}); skipping`);
118977
- return;
118978
- }
118979
- logger.debug("Post-login sync: invalidating sync state for re-check");
118980
- const [err] = await catchError(invalidateSyncState());
118981
- if (err)
118982
- logger.debug(`Post-login state invalidation failed: ${err.message}`);
118983
- }
118984
118634
  async function runStartupSync(context, state) {
118985
118635
  logger.debug("Version sync evaluating (trigger=startup)");
118986
118636
  if (context.capabilities.isBrowser) {
@@ -119018,16 +118668,8 @@ async function runStartupSync(context, state) {
119018
118668
  logger.debug("Version sync skipped: Studio-bundled CLI distribution");
119019
118669
  return false;
119020
118670
  }
119021
- await maybeRefreshEnvCache();
119022
118671
  return runDailyAutoUpdate(state, context);
119023
118672
  }
119024
- async function maybeRefreshEnvCache() {
119025
- if (resolvePinnedVersion()) {
119026
- logger.debug("Env refresh skipped: core.version is pinned");
119027
- return;
119028
- }
119029
- await catchError(refreshEnvCacheIfStale());
119030
- }
119031
118673
  async function runDailyAutoUpdate(state, context) {
119032
118674
  const today = todayLocal();
119033
118675
  const prev = await readState();
@@ -119035,17 +118677,12 @@ async function runDailyAutoUpdate(state, context) {
119035
118677
  logger.debug("Daily auto-update already ran today; skipping");
119036
118678
  return false;
119037
118679
  }
119038
- const target = await resolveEffectiveTarget(false);
118680
+ const target = resolveEffectiveTarget();
119039
118681
  if (target.frozen) {
119040
118682
  await mergeState({ lastUpdateDate: today });
119041
118683
  logger.debug("Daily auto-update skipped: exact pin (frozen)");
119042
118684
  return false;
119043
118685
  }
119044
- if (target.envUnresolved) {
119045
- await mergeState({ lastUpdateDate: today });
119046
- logger.debug("Daily auto-update skipped: environment line unresolved today");
119047
- return false;
119048
- }
119049
118686
  if (!await mergeState({ lastUpdateDate: today })) {
119050
118687
  logger.debug("Daily auto-update skipped: could not persist the day claim (state dir unwritable)");
119051
118688
  return false;
@@ -119053,9 +118690,18 @@ async function runDailyAutoUpdate(state, context) {
119053
118690
  writeSyncStatus(context, "Checking for updates.");
119054
118691
  return applyUpdate(state, context, {
119055
118692
  pin: target.pin,
119056
- origin: target.origin
118693
+ origin: target.origin,
118694
+ ...target.pin ? {} : runningMajorCeiling()
119057
118695
  });
119058
118696
  }
118697
+ function runningMajorCeiling() {
118698
+ const major = majorOf(package_default.version);
118699
+ if (major === null) {
118700
+ logger.debug(`Daily auto-update: no major ceiling (unparseable CLI version '${package_default.version}')`);
118701
+ return {};
118702
+ }
118703
+ return { maxMajor: major };
118704
+ }
119059
118705
  async function applyUpdate(state, context, target) {
119060
118706
  const location = await resolveUpdateLocation(state, context);
119061
118707
  if (!location)
@@ -119076,7 +118722,7 @@ async function resolveUpdateLocation(state, context) {
119076
118722
  }
119077
118723
  async function runUpdateEngine(state, location, context, target) {
119078
118724
  const { runUpdate: runUpdate2 } = await Promise.resolve().then(() => (init_updateService(), exports_updateService));
119079
- writeSyncStatus(context, formatUpdateStartMessage(target.pin));
118725
+ writeSyncStatus(context, formatUpdateStartMessage(target));
119080
118726
  const [updErr, report] = await catchError(runUpdate2({
119081
118727
  dryRun: false,
119082
118728
  channel: resolveChannel(),
@@ -119085,7 +118731,8 @@ async function runUpdateEngine(state, location, context, target) {
119085
118731
  skills: { agent: undefined, local: undefined },
119086
118732
  cli: { self: true },
119087
118733
  versionPin: target.pin,
119088
- versionPinOrigin: target.origin
118734
+ versionPinOrigin: target.origin,
118735
+ maxMajor: target.maxMajor
119089
118736
  }, state, {
119090
118737
  cliPkgVersion: package_default.version,
119091
118738
  isLocal: !location.global,
@@ -119109,6 +118756,10 @@ function finishUpdate(report, context, target) {
119109
118756
  for (const e of report.Errors) {
119110
118757
  logger.debug(`[${e.Subsystem}] ${e.Message} ${e.Instructions}`);
119111
118758
  }
118759
+ const heldBack = report.Cli?.heldBackVersion;
118760
+ if (heldBack) {
118761
+ writeSyncStatus(context, `@uipath/cli ${heldBack} is available but was not installed: the daily update does not cross major versions. Run \`uip update\` to move to it, or \`uip config set version <major.minor>\` to hold a line.`);
118762
+ }
119112
118763
  const cliUpdated = report.Cli?.action === "updated";
119113
118764
  const toolsUpdated = !!report.Tools?.some((t) => t.status === "updated");
119114
118765
  const skillsUpdated = countRefreshedSkills(report) > 0;
@@ -119132,9 +118783,10 @@ function formatInstallLocationFailure(error52) {
119132
118783
  const suffix = error52 ? `: ${error52.message}` : ".";
119133
118784
  return `Update failed: could not resolve the CLI install location${suffix}`;
119134
118785
  }
119135
- function formatUpdateStartMessage(effectivePin) {
118786
+ function formatUpdateStartMessage(target) {
118787
+ const effectivePin = target.pin;
119136
118788
  if (!effectivePin) {
119137
- return "Updating UiPath CLI, tools, and skills.";
118789
+ return target.maxMajor === undefined ? "Updating UiPath CLI, tools, and skills." : `Updating UiPath CLI, tools, and skills within version ${target.maxMajor}.x.`;
119138
118790
  }
119139
118791
  const version2 = effectivePin.patch === undefined ? `${formatVersionPin(effectivePin)}.x` : formatVersionPin(effectivePin);
119140
118792
  return `Updating UiPath CLI, tools, and skills to version ${version2}.`;
@@ -119209,14 +118861,10 @@ function runChild(spawnFn, command, args, env2) {
119209
118861
  child.on("close", (code) => resolve2(code));
119210
118862
  });
119211
118863
  }
119212
- function extractVerb(args, index = 0) {
119213
- let bare = 0;
118864
+ function extractVerb(args) {
119214
118865
  for (const a of stripGlobalOptions(args.slice(2)).args) {
119215
- if (a.startsWith("-"))
119216
- continue;
119217
- if (bare === index)
118866
+ if (!a.startsWith("-"))
119218
118867
  return a;
119219
- bare += 1;
119220
118868
  }
119221
118869
  return;
119222
118870
  }
@@ -119489,7 +119137,6 @@ async function runNode(context) {
119489
119137
  return;
119490
119138
  }
119491
119139
  await parseAndExit(built.program, built.cleanedArgs, context);
119492
- await runPostLoginVersionSync(context);
119493
119140
  }
119494
119141
  var init_cli_node = __esm(() => {
119495
119142
  init_src2();
@@ -146550,4 +146197,4 @@ export {
146550
146197
  ready
146551
146198
  };
146552
146199
 
146553
- //# debugId=29C27359FF3F342564756E2164756E21
146200
+ //# debugId=89C06392F1E4D6D164756E2164756E21