@uipath/cli 1.200.0-preview.126 → 1.200.1-preview.129

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
@@ -92769,7 +92769,7 @@ var init_package = __esm(() => {
92769
92769
  package_default = {
92770
92770
  name: "@uipath/cli",
92771
92771
  license: "MIT",
92772
- version: "1.200.0-preview.126",
92772
+ version: "1.200.1-preview.129",
92773
92773
  description: "Cross platform CLI for UiPath",
92774
92774
  repository: {
92775
92775
  type: "git",
@@ -114049,27 +114049,6 @@ var init_tools_whitelist = __esm(() => {
114049
114049
  });
114050
114050
 
114051
114051
  // src/services/toolService.ts
114052
- var exports_toolService = {};
114053
- __export(exports_toolService, {
114054
- validateVersionString: () => validateVersionString,
114055
- validatePackageSpec: () => validatePackageSpec,
114056
- truncateVersionsForDisplay: () => truncateVersionsForDisplay,
114057
- toolService: () => toolService,
114058
- resolveToolPackageName: () => resolveToolPackageName,
114059
- resetBunOnPathCacheForTests: () => resetBunOnPathCacheForTests,
114060
- parsePackageSpec: () => parsePackageSpec,
114061
- isValidSemver: () => isValidSemver,
114062
- isPermissionError: () => isPermissionError,
114063
- isNpmViewMetadataError: () => isNpmViewMetadataError,
114064
- isDevMode: () => isDevMode,
114065
- isBunOnPath: () => isBunOnPath,
114066
- getEffectiveRegistry: () => getEffectiveRegistry,
114067
- compareSemver: () => compareSemver,
114068
- WHITELIST_BY_SHORT_NAME: () => WHITELIST_BY_SHORT_NAME,
114069
- WHITELIST_BY_COMMAND: () => WHITELIST_BY_COMMAND,
114070
- TOOLS_WHITELIST: () => TOOLS_WHITELIST,
114071
- NpmViewMetadataError: () => NpmViewMetadataError
114072
- });
114073
114052
  function isValidSemver(v) {
114074
114053
  return SEMVER_RE.test(v);
114075
114054
  }
@@ -114141,19 +114120,11 @@ async function isBunOnPath() {
114141
114120
  cachedBunOnPath = !error51 && result === true;
114142
114121
  return cachedBunOnPath;
114143
114122
  }
114144
- function resetBunOnPathCacheForTests() {
114145
- cachedBunOnPath = undefined;
114146
- }
114147
114123
  function validatePackageSpec(spec) {
114148
114124
  if (!SAFE_PACKAGE_SPEC.test(spec)) {
114149
114125
  throw new Error(`Invalid package specifier: '${spec}'. Only alphanumeric characters, dots, hyphens, underscores, slashes, and @ are allowed.`);
114150
114126
  }
114151
114127
  }
114152
- function validateVersionString(version2) {
114153
- if (!SAFE_VERSION.test(version2)) {
114154
- throw new Error(`Invalid version string: '${version2}'. Only alphanumeric characters, dots, hyphens, underscores, and semver operators are allowed.`);
114155
- }
114156
- }
114157
114128
  function isNpmViewMetadataError(error51) {
114158
114129
  return error51 instanceof NpmViewMetadataError || error51.name === "NpmViewMetadataError";
114159
114130
  }
@@ -114419,41 +114390,6 @@ async function runPackageManagerWithBun(args, cwd, extraEnv) {
114419
114390
  logger.debug(`Running package manager: bun ${pmArgs.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
114420
114391
  await spawnPackageManager("bun", pmArgs, cwd, `bun ${pmArgs[0]}`, extraEnv);
114421
114392
  }
114422
- function validateTarballUrl(tarballUrl, registryUrl) {
114423
- const [err, parsed] = catchError(() => {
114424
- const url2 = new URL(tarballUrl);
114425
- const registry3 = new URL(registryUrl);
114426
- if (url2.hostname !== registry3.hostname || url2.protocol !== registry3.protocol) {
114427
- throw new Error(`refusing tarball from '${url2.protocol}//${url2.hostname}'; expected '${registry3.protocol}//${registry3.hostname}'`);
114428
- }
114429
- return url2;
114430
- });
114431
- if (err || !parsed) {
114432
- throw new Error(`Invalid tarball URL '${tarballUrl}': ${err ? err.message : "unparseable"}`);
114433
- }
114434
- return parsed;
114435
- }
114436
- function extractTarEntry(tar, entryName) {
114437
- const decoder3 = new TextDecoder;
114438
- let offset = 0;
114439
- while (offset + 512 <= tar.length) {
114440
- const header = tar.subarray(offset, offset + 512);
114441
- if (header.every((b) => b === 0))
114442
- break;
114443
- const name = decoder3.decode(header.subarray(0, 100)).split("\x00", 1)[0];
114444
- const sizeField = decoder3.decode(header.subarray(124, 136)).split("\x00", 1)[0].trim();
114445
- const size = Number.parseInt(sizeField, 8);
114446
- if (Number.isNaN(size) || size < 0) {
114447
- throw new Error(`Corrupt tar header at offset ${offset}`);
114448
- }
114449
- const typeflag = header[156];
114450
- if ((typeflag === 0 || typeflag === 48) && name === entryName) {
114451
- return decoder3.decode(tar.subarray(offset + 512, offset + 512 + size));
114452
- }
114453
- offset += 512 + Math.ceil(size / 512) * 512;
114454
- }
114455
- return null;
114456
- }
114457
114393
 
114458
114394
  class NodeToolService {
114459
114395
  async npmView(packageName, timeoutMs = NPM_VIEW_TIMEOUT_MS, registry3) {
@@ -114553,20 +114489,6 @@ class NodeToolService {
114553
114489
  const detail = stderr.trim() || (codeOrError instanceof Error ? codeOrError.message : `exit ${codeOrError}`);
114554
114490
  return new Error(`npm view ${packageName} failed: ${detail}`);
114555
114491
  }
114556
- async fetchPublicPackument(packageName, timeoutMs = DEFAULT_FETCH_TIMEOUT_MS) {
114557
- validatePackageSpec(packageName);
114558
- const encodedName = packageName.replaceAll("/", "%2f");
114559
- const url2 = `${NPMJS_REGISTRY}/${encodedName}`;
114560
- logger.debug(`Fetching package info: ${url2}`);
114561
- const response = await fetch(url2, {
114562
- headers: { Accept: "application/json" },
114563
- signal: AbortSignal.timeout(timeoutMs)
114564
- });
114565
- if (!response.ok) {
114566
- throw new Error(`Registry ${NPMJS_REGISTRY} returned ${response.status} ${response.statusText} for ${packageName}`);
114567
- }
114568
- return await response.json();
114569
- }
114570
114492
  async search(query) {
114571
114493
  const packages = [...TOOLS_WHITELIST.keys()];
114572
114494
  const settled = await Promise.allSettled(packages.map((name) => this.npmView(name)));
@@ -114632,31 +114554,6 @@ ${errors7.map((e) => ` - ${e}`).join(`
114632
114554
  }
114633
114555
  return null;
114634
114556
  }
114635
- async downloadPackageFile(packageName, fileName, options) {
114636
- validatePackageSpec(packageName);
114637
- const timeoutMs = options?.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
114638
- const packument = await this.fetchPublicPackument(packageName, timeoutMs);
114639
- const latest = packument["dist-tags"]?.latest;
114640
- const tarballUrl = latest ? packument.versions?.[latest]?.dist?.tarball : undefined;
114641
- if (!tarballUrl) {
114642
- throw new Error(`No tarball URL for ${packageName}@${latest ?? "latest"} on ${NPMJS_REGISTRY}`);
114643
- }
114644
- const tarball = validateTarballUrl(tarballUrl, NPMJS_REGISTRY);
114645
- logger.debug(`Downloading tarball: ${tarball.href}`);
114646
- const response = await fetch(tarball, {
114647
- signal: AbortSignal.timeout(timeoutMs)
114648
- });
114649
- if (!response.ok) {
114650
- throw new Error(`Tarball download for ${packageName} returned ${response.status} ${response.statusText}`);
114651
- }
114652
- const { gunzipSync } = await import("node:zlib");
114653
- const tar = gunzipSync(new Uint8Array(await response.arrayBuffer()));
114654
- const content = extractTarEntry(tar, `package/${fileName}`);
114655
- if (content === null) {
114656
- throw new Error(`File '${fileName}' not found in ${packageName}@${latest} tarball`);
114657
- }
114658
- return content;
114659
- }
114660
114557
  async install(packageName, destination, options) {
114661
114558
  validatePackageSpec(packageName);
114662
114559
  await refuseIfBundledDistribution(destination, "install", packageName);
@@ -114756,7 +114653,7 @@ function truncateVersionsForDisplay(versions2) {
114756
114653
  }
114757
114654
  return result;
114758
114655
  }
114759
- 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;
114656
+ 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;
114760
114657
  var init_toolService = __esm(() => {
114761
114658
  init_src2();
114762
114659
  init_src();
@@ -114766,7 +114663,6 @@ var init_toolService = __esm(() => {
114766
114663
  init_tools_whitelist();
114767
114664
  SEMVER_RE = /^\d+\.\d+\.\d+(-[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?(\+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?$/;
114768
114665
  SAFE_PACKAGE_SPEC = /^@?[a-zA-Z0-9._/-]+(@[a-zA-Z0-9._+:~^<>=| -]+)?$/;
114769
- SAFE_VERSION = /^[a-zA-Z0-9._+:~^<>=| -]+$/;
114770
114666
  SHELL_SAFE_ARG = /^[a-zA-Z0-9@/._-]+$/;
114771
114667
  SHELL_SAFE_COMMAND_LINE = /^[a-zA-Z0-9@/._\- ]+$/;
114772
114668
  TRANSIENT_NPM_ERRORS = ["ENOTEMPTY", "EBUSY"];
@@ -115896,12 +115792,11 @@ function parseVersionPin(raw) {
115896
115792
  pin.patch = Number(match[3]);
115897
115793
  return pin;
115898
115794
  }
115899
- function majorMinorPinOf(version2) {
115900
- const [rawMajor, rawMinor] = version2.trim().split(/[.\-+]/);
115901
- if (rawMajor === undefined || rawMinor === undefined || !/^\d+$/.test(rawMajor) || !/^\d+$/.test(rawMinor)) {
115795
+ function majorOf(version2) {
115796
+ const [rawMajor] = version2.trim().split(/[.\-+]/);
115797
+ if (rawMajor === undefined || !/^\d+$/.test(rawMajor))
115902
115798
  return null;
115903
- }
115904
- return { major: Number(rawMajor), minor: Number(rawMinor) };
115799
+ return Number(rawMajor);
115905
115800
  }
115906
115801
  function resolvePinnedVersion() {
115907
115802
  return parseVersionPin(getCachedConfig().core?.version);
@@ -116259,7 +116154,7 @@ var init_config2 = __esm(() => {
116259
116154
  normalize: (v) => v.trim(),
116260
116155
  validate: (v) => isValidVersionPin(v),
116261
116156
  valueHint: "Use major.minor or major.minor.patch (e.g. 1.2 or 1.2.3).",
116262
- description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows your environment or the latest"
116157
+ description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows the latest release"
116263
116158
  },
116264
116159
  clientSecret: {
116265
116160
  path: ["auth", "clientSecret"],
@@ -116271,7 +116166,7 @@ var init_config2 = __esm(() => {
116271
116166
  WRITABLE_KEY_NAMES = VALID_KEY_NAMES.filter((key) => CONFIG_KEYS[key].writable !== false);
116272
116167
  REMOVED_KEYS = {
116273
116168
  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`).",
116274
- 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."
116169
+ 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."
116275
116170
  };
116276
116171
  CONFIG_GET_EXAMPLES = [
116277
116172
  {
@@ -116358,7 +116253,7 @@ var init_config2 = __esm(() => {
116358
116253
  ];
116359
116254
  CONFIG_CLEAR_EXAMPLES = [
116360
116255
  {
116361
- Description: "Clear the version pin so the CLI follows the environment / latest again",
116256
+ Description: "Clear the version pin so the CLI follows the latest release again",
116362
116257
  Command: "uip config clear version",
116363
116258
  Output: {
116364
116259
  Code: "ConfigClear",
@@ -116425,11 +116320,6 @@ var init_promptSelect = __esm(() => {
116425
116320
  });
116426
116321
 
116427
116322
  // src/services/auth.ts
116428
- var exports_auth = {};
116429
- __export(exports_auth, {
116430
- auth: () => auth
116431
- });
116432
-
116433
116323
  class NodeAuth {
116434
116324
  async interactiveLogin(options) {
116435
116325
  const { interactiveLogin: interactiveLogin2 } = await Promise.resolve().then(() => (init_src3(), exports_src2));
@@ -135121,7 +135011,7 @@ function isTarDirectoryEntry(typeFlag, entryName) {
135121
135011
  function isTarRegularFileEntry(typeFlag) {
135122
135012
  return typeFlag === "0" || typeFlag === "\x00";
135123
135013
  }
135124
- async function extractTarEntry2(fs7, destinationDir, entryName, entry) {
135014
+ async function extractTarEntry(fs7, destinationDir, entryName, entry) {
135125
135015
  if (isTarDirectoryEntry(entry.typeFlag, entryName)) {
135126
135016
  await fs7.mkdir(resolveTarEntryPath(fs7, destinationDir, entryName));
135127
135017
  return;
@@ -135155,7 +135045,7 @@ async function extractNpmTarballToDir(tarData, destinationDir) {
135155
135045
  const entryName = stripNpmPackageRoot(rawPath);
135156
135046
  if (!entryName)
135157
135047
  continue;
135158
- await extractTarEntry2(fs7, destinationDir, entryName, entry);
135048
+ await extractTarEntry(fs7, destinationDir, entryName, entry);
135159
135049
  }
135160
135050
  }
135161
135051
  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.";
@@ -141005,14 +140895,12 @@ var init_ora = __esm(() => {
141005
140895
 
141006
140896
  // src/services/updateFailureFormat.ts
141007
140897
  function pinnedLineRemediation(origin) {
141008
- if (origin === "environment")
141009
- return ENVIRONMENT_LINE_REMEDIATION;
141010
140898
  if (origin === "latest")
141011
140899
  return LATEST_LINE_REMEDIATION;
141012
140900
  return PINNED_LINE_REMEDIATION;
141013
140901
  }
141014
140902
  function toolFailureRemediation(origin) {
141015
- 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`";
140903
+ const changeTarget = origin === "latest" ? "pin a version line with `uip config set version <major.minor>`" : "adjust the pinned `core.version`";
141016
140904
  return `Check tool compatibility with the current CLI version, ${changeTarget}, ` + `or run \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\` to switch release channels.`;
141017
140905
  }
141018
140906
  function isPinnedLineMissing(error52) {
@@ -141024,17 +140912,12 @@ function describeSearchedRegistry(registry3) {
141024
140912
  function describeMissingLine(opts) {
141025
140913
  const { pin, origin, targetLine, searched } = opts;
141026
140914
  const suffix = describeSearchedRegistry(searched);
141027
- if (origin === "environment") {
141028
- return `No version found matching your environment's version line ${formatVersionPin(pin)} in the ${targetLine} line${suffix}`;
141029
- }
141030
140915
  if (origin === "latest") {
141031
140916
  return `No version found in the latest ${targetLine} line${suffix}`;
141032
140917
  }
141033
140918
  return `No version found matching pinned ${formatVersionPin(pin)} in the ${targetLine} line${suffix}`;
141034
140919
  }
141035
140920
  function describeDowngradeReason(origin) {
141036
- if (origin === "environment")
141037
- return "your environment's version line";
141038
140921
  if (origin === "latest")
141039
140922
  return "the latest version line";
141040
140923
  return "the pinned version";
@@ -141053,9 +140936,6 @@ function describePinnedLine(target) {
141053
140936
  if (!target?.pin)
141054
140937
  return "the pinned version line";
141055
140938
  const line = `${target.pin.major}.${target.pin.minor}`;
141056
- if (target.origin === "environment") {
141057
- return `your environment's version line ${line}`;
141058
- }
141059
140939
  if (target.origin === "latest") {
141060
140940
  return `the latest version line ${line}`;
141061
140941
  }
@@ -141072,12 +140952,11 @@ function collapsePinnedLineErrors(report, target) {
141072
140952
  individual: report.Errors.filter((e) => !isPinnedLineMissing(e))
141073
140953
  };
141074
140954
  }
141075
- var PINNED_LINE_REMEDIATION, ENVIRONMENT_LINE_REMEDIATION, LATEST_LINE_REMEDIATION;
140955
+ var PINNED_LINE_REMEDIATION, LATEST_LINE_REMEDIATION;
141076
140956
  var init_updateFailureFormat = __esm(() => {
141077
140957
  init_channels();
141078
140958
  init_versionPin();
141079
- 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`.";
141080
- 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\`.`;
140959
+ 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`.";
141081
140960
  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`.";
141082
140961
  });
141083
140962
 
@@ -141091,13 +140970,6 @@ function buildToolUpdatePolicy(opts, cliVersionPrefix) {
141091
140970
  if (pin) {
141092
140971
  const targetLine2 = formatTargetLine(pinnedPrefix(pin));
141093
140972
  const renderedPin = formatVersionPin(pin);
141094
- if (opts.pinOrigin === "environment") {
141095
- return {
141096
- resolvedBy: "environment",
141097
- targetLine: targetLine2,
141098
- reason: `Using your environment's version line ${renderedPin}; tools resolve within ${targetLine2}.`
141099
- };
141100
- }
141101
140973
  return {
141102
140974
  resolvedBy: "core.version",
141103
140975
  targetLine: targetLine2,
@@ -141336,230 +141208,22 @@ var init_updateService_tools = __esm(() => {
141336
141208
  };
141337
141209
  });
141338
141210
 
141339
- // src/services/versionSyncState.ts
141340
- import { randomUUID as randomUUID7 } from "node:crypto";
141341
- function todayLocal() {
141342
- const d = new Date;
141343
- const month = String(d.getMonth() + 1).padStart(2, "0");
141344
- const day = String(d.getDate()).padStart(2, "0");
141345
- return `${d.getFullYear()}-${month}-${day}`;
141346
- }
141347
- function stateFilePath(fs7) {
141348
- return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
141349
- }
141350
- async function readState(fs7 = getFileSystem()) {
141351
- const [readErr, raw] = await catchError(fs7.readFile(stateFilePath(fs7), "utf-8"));
141352
- if (readErr || !raw)
141353
- return {};
141354
- const [parseErr, parsed] = catchError(() => JSON.parse(raw));
141355
- if (parseErr || parsed === null || typeof parsed !== "object") {
141356
- return {};
141357
- }
141358
- const state = {};
141359
- if (typeof parsed.lastUpdateDate === "string") {
141360
- state.lastUpdateDate = parsed.lastUpdateDate;
141361
- }
141362
- if (typeof parsed.envLine === "string")
141363
- state.envLine = parsed.envLine;
141364
- if (typeof parsed.envLineDate === "string") {
141365
- state.envLineDate = parsed.envLineDate;
141366
- }
141367
- if (typeof parsed.envLineAttemptDate === "string") {
141368
- state.envLineAttemptDate = parsed.envLineAttemptDate;
141369
- }
141370
- if (typeof parsed.envKey === "string")
141371
- state.envKey = parsed.envKey;
141372
- return state;
141373
- }
141374
- async function mergeState(patch, fs7 = getFileSystem()) {
141375
- const current = await readState(fs7);
141376
- const next = { ...current, ...patch };
141377
- const target = stateFilePath(fs7);
141378
- await catchError(fs7.mkdir(fs7.path.dirname(target)));
141379
- const tempPath = `${target}.${randomUUID7()}.tmp`;
141380
- const [err] = await catchError((async () => {
141381
- await fs7.writeFile(tempPath, JSON.stringify(next, null, 2));
141382
- await fs7.rename(tempPath, target);
141383
- })());
141384
- if (err) {
141385
- await catchError(fs7.rm(tempPath));
141386
- return false;
141387
- }
141388
- return true;
141389
- }
141390
- async function invalidateSyncState(fs7 = getFileSystem()) {
141391
- await catchError(fs7.rm(stateFilePath(fs7)));
141392
- }
141393
- var STATE_FILENAME = "version-sync.json";
141394
- var init_versionSyncState = __esm(() => {
141395
- init_src2();
141396
- init_src();
141397
- });
141398
-
141399
141211
  // src/services/versionTarget.ts
141400
- function mapAuthorityToEnvironment(baseUrl) {
141401
- const [err, host] = catchError(() => new URL(baseUrl).hostname.toLowerCase());
141402
- if (err || !host)
141403
- return "unknown";
141404
- if (host === "alpha.uipath.com")
141405
- return "alpha";
141406
- if (host === "staging.uipath.com")
141407
- return "staging";
141408
- if (host === "cloud.uipath.com")
141409
- return "cloud";
141410
- return "unknown";
141411
- }
141412
- async function currentKnownEnvironment() {
141413
- const { auth: auth2 } = await Promise.resolve().then(() => (init_auth(), exports_auth));
141414
- const [statusErr, status] = await catchError(auth2.getLoginStatus());
141415
- if (statusErr || status.loginStatus !== "Logged in" || !status.baseUrl) {
141416
- return null;
141417
- }
141418
- const env2 = mapAuthorityToEnvironment(status.baseUrl);
141419
- return env2 === "unknown" ? null : env2;
141420
- }
141421
- async function downloadVersions() {
141422
- const { toolService: toolService2 } = await Promise.resolve().then(() => (init_toolService(), exports_toolService));
141423
- const [dlErr, raw] = await catchError(toolService2.downloadPackageFile(VERSIONS_PACKAGE, VERSIONS_FILENAME, {
141424
- timeoutMs: DOWNLOAD_TIMEOUT_MS
141425
- }));
141426
- if (dlErr) {
141427
- logger.debug(`Failed to download ${VERSIONS_FILENAME} from ${VERSIONS_PACKAGE}: ${dlErr.message}`);
141428
- return null;
141429
- }
141430
- const [jsonErr, json3] = catchError(() => JSON.parse(raw));
141431
- if (jsonErr) {
141432
- logger.debug(`Failed to parse ${VERSIONS_FILENAME}: ${jsonErr.message}`);
141433
- return null;
141434
- }
141435
- return json3;
141436
- }
141437
- async function fetchEnvLine(env2) {
141438
- const versions2 = await downloadVersions();
141439
- if (!versions2)
141440
- return null;
141441
- const parsed = VersionsSchema.safeParse(versions2);
141442
- if (!parsed.success) {
141443
- logger.debug("cli-versions.json failed schema validation; skipping");
141444
- return null;
141445
- }
141446
- if (parsed.data.schemaVersion !== undefined && parsed.data.schemaVersion > SUPPORTED_SCHEMA_VERSION) {
141447
- logger.debug(`cli-versions.json schemaVersion ${parsed.data.schemaVersion} is newer than supported ${SUPPORTED_SCHEMA_VERSION}; skipping`);
141448
- return null;
141449
- }
141450
- const line = parsed.data.environments[env2]?.cliVersion;
141451
- if (!line || !majorMinorPinOf(line)) {
141452
- logger.debug(`No usable cliVersion for '${env2}'; skipping`);
141453
- return null;
141454
- }
141455
- return line;
141456
- }
141457
- function cacheFresh(state, env2) {
141458
- return state.envKey === env2 && state.envLineDate === todayLocal();
141459
- }
141460
- async function refreshEnvCacheIfStale() {
141461
- const state = await readState();
141462
- const today = todayLocal();
141463
- if (state.envLineAttemptDate === today) {
141464
- logger.debug("Env refresh skipped: already attempted today (backoff after a failed fetch)");
141465
- return state.envLine ?? null;
141466
- }
141467
- const env2 = await currentKnownEnvironment();
141468
- if (!env2) {
141469
- logger.debug("Env refresh skipped: not logged into a known environment");
141470
- return null;
141471
- }
141472
- if (cacheFresh(state, env2) && state.envLine) {
141473
- logger.debug(`Env line cache fresh (${env2}=${state.envLine}); skipping`);
141474
- return state.envLine;
141475
- }
141476
- if (!await mergeState({ envLineAttemptDate: today })) {
141477
- logger.debug("Env refresh skipped: could not persist the attempt claim (state dir unwritable)");
141478
- return state.envLine ?? null;
141479
- }
141480
- const line = await fetchEnvLine(env2);
141481
- if (!line)
141482
- return null;
141483
- await mergeState({ envLine: line, envLineDate: today, envKey: env2 });
141484
- logger.debug(`Env line cached: ${env2}=${line}`);
141485
- return line;
141486
- }
141487
- async function getEnvLine(env2, allowFetch) {
141488
- const state = await readState();
141489
- if (cacheFresh(state, env2) && state.envLine)
141490
- return state.envLine;
141491
- if (state.envKey === env2 && state.envLine && !allowFetch) {
141492
- return state.envLine;
141493
- }
141494
- if (!allowFetch)
141495
- return null;
141496
- const line = await fetchEnvLine(env2);
141497
- if (!line)
141498
- return state.envKey === env2 ? state.envLine ?? null : null;
141499
- await mergeState({ envLine: line, envLineDate: todayLocal(), envKey: env2 });
141500
- return line;
141501
- }
141502
- async function resolveEffectiveTarget(allowFetch = true) {
141212
+ function resolveEffectiveTarget() {
141503
141213
  const pin = resolvePinnedVersion();
141504
141214
  if (pin) {
141505
141215
  return { pin, frozen: isExactPin(pin), origin: "config" };
141506
141216
  }
141507
- const env2 = await currentKnownEnvironment();
141508
- if (env2) {
141509
- const line = await getEnvLine(env2, allowFetch);
141510
- const envPin = line ? majorMinorPinOf(line) : null;
141511
- if (envPin) {
141512
- return {
141513
- pin: envPin,
141514
- frozen: false,
141515
- origin: "environment",
141516
- envKey: env2
141517
- };
141518
- }
141519
- return {
141520
- pin: null,
141521
- frozen: false,
141522
- origin: "environment",
141523
- envKey: env2,
141524
- envUnresolved: true
141525
- };
141526
- }
141527
141217
  return { pin: null, frozen: false, origin: "latest" };
141528
141218
  }
141529
- var VERSIONS_PACKAGE = "@uipath/cli-meta", VERSIONS_FILENAME = "cli-versions.json", SUPPORTED_SCHEMA_VERSION = 1, DOWNLOAD_TIMEOUT_MS = 8000, VersionsSchema;
141530
141219
  var init_versionTarget = __esm(() => {
141531
- init_src2();
141532
- init_zod();
141533
141220
  init_versionPin();
141534
- init_versionSyncState();
141535
- VersionsSchema = exports_external.object({
141536
- schemaVersion: exports_external.number().optional(),
141537
- environments: exports_external.record(exports_external.string(), exports_external.object({ cliVersion: exports_external.string().min(1) }).passthrough())
141538
- }).passthrough();
141539
141221
  });
141540
141222
 
141541
141223
  // src/commands/tools/update.ts
141542
141224
  function registerUpdateCommand2(toolsCommand, _context, state) {
141543
141225
  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) => {
141544
- const [targetErr, target] = await catchError(resolveEffectiveTarget(true));
141545
- if (targetErr) {
141546
- OutputFormatter.error({
141547
- Result: RESULTS.Failure,
141548
- Message: `Could not determine the update target: ${targetErr.message}`,
141549
- 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."
141550
- });
141551
- processContext.exit(EXIT_CODES.Failure);
141552
- return;
141553
- }
141554
- if (target.envUnresolved) {
141555
- OutputFormatter.error({
141556
- Result: RESULTS.Failure,
141557
- Message: "Could not resolve your environment's version line.",
141558
- 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."
141559
- });
141560
- processContext.exit(EXIT_CODES.Failure);
141561
- return;
141562
- }
141226
+ const target = resolveEffectiveTarget();
141563
141227
  if (target.frozen && target.pin) {
141564
141228
  const exact = formatVersionPin(target.pin);
141565
141229
  const line = `${target.pin.major}.${target.pin.minor}`;
@@ -142015,10 +141679,7 @@ async function checkCliVersion(opts) {
142015
141679
  return skipped(opts.cliPkgVersion, "dev mode");
142016
141680
  }
142017
141681
  const pin = opts.pin ?? null;
142018
- const [err, latest] = await catchError(pin ? toolService.searchLatestVersion("@uipath/cli", pinnedPrefix(pin), {
142019
- channel: opts.channel,
142020
- timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
142021
- }) : toolService.searchLatestVersion("@uipath/cli", undefined, {
141682
+ const [err, latest] = await catchError(toolService.searchLatestVersion("@uipath/cli", pin ? pinnedPrefix(pin) : undefined, {
142022
141683
  channel: opts.channel,
142023
141684
  timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
142024
141685
  }));
@@ -142044,6 +141705,15 @@ async function checkCliVersion(opts) {
142044
141705
  }
142045
141706
  return skipped(opts.cliPkgVersion, `no ${opts.channel} version found`);
142046
141707
  }
141708
+ if (!pin && exceedsMajorCeiling(latest, opts.maxMajor)) {
141709
+ return {
141710
+ current: opts.cliPkgVersion,
141711
+ available: latest,
141712
+ action: "none",
141713
+ reason: null,
141714
+ heldBackVersion: latest
141715
+ };
141716
+ }
142047
141717
  const differs = pin ? compareSemver(latest, opts.cliPkgVersion) !== 0 : compareSemver(latest, opts.cliPkgVersion) > 0;
142048
141718
  if (differs) {
142049
141719
  return {
@@ -142060,6 +141730,12 @@ async function checkCliVersion(opts) {
142060
141730
  reason: null
142061
141731
  };
142062
141732
  }
141733
+ function exceedsMajorCeiling(version2, maxMajor) {
141734
+ if (maxMajor === undefined)
141735
+ return false;
141736
+ const major = majorOf(version2);
141737
+ return major !== null && major > maxMajor;
141738
+ }
142063
141739
  function skipped(current, reason) {
142064
141740
  return { current, available: null, action: "skipped", reason };
142065
141741
  }
@@ -142116,7 +141792,8 @@ async function runUpdate(options, state, cliEnv) {
142116
141792
  cliPkgVersion: cliEnv.cliPkgVersion,
142117
141793
  isDev: cliEnv.isDev,
142118
141794
  pin: options.versionPin ?? null,
142119
- pinOrigin: options.versionPinOrigin
141795
+ pinOrigin: options.versionPinOrigin,
141796
+ maxMajor: options.maxMajor
142120
141797
  }) : null;
142121
141798
  let detectedInstallCtx = null;
142122
141799
  const getDetectedInstallCtx = () => {
@@ -142288,25 +141965,7 @@ function registerUpdateCommand3(program2, _context, state) {
142288
141965
  processContext.exit(EXIT_CODES.ValidationError);
142289
141966
  return;
142290
141967
  }
142291
- const [targetErr, target] = await catchError(resolveEffectiveTarget(true));
142292
- if (targetErr) {
142293
- OutputFormatter.error({
142294
- Result: RESULTS.Failure,
142295
- Message: `Could not determine the update target: ${targetErr.message}`,
142296
- 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."
142297
- });
142298
- processContext.exit(EXIT_CODES.Failure);
142299
- return;
142300
- }
142301
- if (target.envUnresolved) {
142302
- OutputFormatter.error({
142303
- Result: RESULTS.Failure,
142304
- Message: "Could not resolve your environment's version line.",
142305
- Instructions: "Check your connection and re-run `uip update`, or pin a line with `uip config set version <major.minor>` to override the environment."
142306
- });
142307
- processContext.exit(EXIT_CODES.Failure);
142308
- return;
142309
- }
141968
+ const target = resolveEffectiveTarget();
142310
141969
  if (target.frozen && target.pin) {
142311
141970
  const exact = formatVersionPin(target.pin);
142312
141971
  const line = `${target.pin.major}.${target.pin.minor}`;
@@ -142815,6 +142474,53 @@ var init_tool_manager = __esm(() => {
142815
142474
  init_versionPin();
142816
142475
  });
142817
142476
 
142477
+ // src/services/versionSyncState.ts
142478
+ import { randomUUID as randomUUID7 } from "node:crypto";
142479
+ function todayLocal() {
142480
+ const d = new Date;
142481
+ const month = String(d.getMonth() + 1).padStart(2, "0");
142482
+ const day = String(d.getDate()).padStart(2, "0");
142483
+ return `${d.getFullYear()}-${month}-${day}`;
142484
+ }
142485
+ function stateFilePath(fs7) {
142486
+ return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
142487
+ }
142488
+ async function readState(fs7 = getFileSystem()) {
142489
+ const [readErr, raw] = await catchError(fs7.readFile(stateFilePath(fs7), "utf-8"));
142490
+ if (readErr || !raw)
142491
+ return {};
142492
+ const [parseErr, parsed] = catchError(() => JSON.parse(raw));
142493
+ if (parseErr || parsed === null || typeof parsed !== "object") {
142494
+ return {};
142495
+ }
142496
+ const state = {};
142497
+ if (typeof parsed.lastUpdateDate === "string") {
142498
+ state.lastUpdateDate = parsed.lastUpdateDate;
142499
+ }
142500
+ return state;
142501
+ }
142502
+ async function mergeState(patch, fs7 = getFileSystem()) {
142503
+ const current = await readState(fs7);
142504
+ const next = { ...current, ...patch };
142505
+ const target = stateFilePath(fs7);
142506
+ await catchError(fs7.mkdir(fs7.path.dirname(target)));
142507
+ const tempPath = `${target}.${randomUUID7()}.tmp`;
142508
+ const [err] = await catchError((async () => {
142509
+ await fs7.writeFile(tempPath, JSON.stringify(next, null, 2));
142510
+ await fs7.rename(tempPath, target);
142511
+ })());
142512
+ if (err) {
142513
+ await catchError(fs7.rm(tempPath));
142514
+ return false;
142515
+ }
142516
+ return true;
142517
+ }
142518
+ var STATE_FILENAME = "version-sync.json";
142519
+ var init_versionSyncState = __esm(() => {
142520
+ init_src2();
142521
+ init_src();
142522
+ });
142523
+
142818
142524
  // src/services/versionSync.ts
142819
142525
  async function maybeRunDailyVersionSync(context, state) {
142820
142526
  const [err, reexeced] = await catchError(runStartupSync(context, state));
@@ -142824,33 +142530,6 @@ async function maybeRunDailyVersionSync(context, state) {
142824
142530
  }
142825
142531
  return reexeced;
142826
142532
  }
142827
- async function runPostLoginVersionSync(context) {
142828
- if (context.capabilities.isBrowser) {
142829
- logger.debug("Post-login sync skipped: browser environment");
142830
- return;
142831
- }
142832
- if (isTruthyEnv(process.env[DISABLE_ENV])) {
142833
- logger.debug(`Post-login sync skipped: ${DISABLE_ENV} is set`);
142834
- return;
142835
- }
142836
- const verb = extractVerb(context.args);
142837
- if (verb !== "login") {
142838
- logger.debug(`Post-login sync: not a login command (verb=${verb})`);
142839
- return;
142840
- }
142841
- if (extractVerb(context.args, 1) === "status") {
142842
- logger.debug("Post-login sync: read-only `login status`; skipping");
142843
- return;
142844
- }
142845
- if (process.exitCode) {
142846
- logger.debug(`Post-login sync: login failed (exitCode=${String(process.exitCode)}); skipping`);
142847
- return;
142848
- }
142849
- logger.debug("Post-login sync: invalidating sync state for re-check");
142850
- const [err] = await catchError(invalidateSyncState());
142851
- if (err)
142852
- logger.debug(`Post-login state invalidation failed: ${err.message}`);
142853
- }
142854
142533
  async function runStartupSync(context, state) {
142855
142534
  logger.debug("Version sync evaluating (trigger=startup)");
142856
142535
  if (context.capabilities.isBrowser) {
@@ -142888,16 +142567,8 @@ async function runStartupSync(context, state) {
142888
142567
  logger.debug("Version sync skipped: Studio-bundled CLI distribution");
142889
142568
  return false;
142890
142569
  }
142891
- await maybeRefreshEnvCache();
142892
142570
  return runDailyAutoUpdate(state, context);
142893
142571
  }
142894
- async function maybeRefreshEnvCache() {
142895
- if (resolvePinnedVersion()) {
142896
- logger.debug("Env refresh skipped: core.version is pinned");
142897
- return;
142898
- }
142899
- await catchError(refreshEnvCacheIfStale());
142900
- }
142901
142572
  async function runDailyAutoUpdate(state, context) {
142902
142573
  const today = todayLocal();
142903
142574
  const prev = await readState();
@@ -142905,17 +142576,12 @@ async function runDailyAutoUpdate(state, context) {
142905
142576
  logger.debug("Daily auto-update already ran today; skipping");
142906
142577
  return false;
142907
142578
  }
142908
- const target = await resolveEffectiveTarget(false);
142579
+ const target = resolveEffectiveTarget();
142909
142580
  if (target.frozen) {
142910
142581
  await mergeState({ lastUpdateDate: today });
142911
142582
  logger.debug("Daily auto-update skipped: exact pin (frozen)");
142912
142583
  return false;
142913
142584
  }
142914
- if (target.envUnresolved) {
142915
- await mergeState({ lastUpdateDate: today });
142916
- logger.debug("Daily auto-update skipped: environment line unresolved today");
142917
- return false;
142918
- }
142919
142585
  if (!await mergeState({ lastUpdateDate: today })) {
142920
142586
  logger.debug("Daily auto-update skipped: could not persist the day claim (state dir unwritable)");
142921
142587
  return false;
@@ -142923,9 +142589,18 @@ async function runDailyAutoUpdate(state, context) {
142923
142589
  writeSyncStatus(context, "Checking for updates.");
142924
142590
  return applyUpdate(state, context, {
142925
142591
  pin: target.pin,
142926
- origin: target.origin
142592
+ origin: target.origin,
142593
+ ...target.pin ? {} : runningMajorCeiling()
142927
142594
  });
142928
142595
  }
142596
+ function runningMajorCeiling() {
142597
+ const major = majorOf(package_default.version);
142598
+ if (major === null) {
142599
+ logger.debug(`Daily auto-update: no major ceiling (unparseable CLI version '${package_default.version}')`);
142600
+ return {};
142601
+ }
142602
+ return { maxMajor: major };
142603
+ }
142929
142604
  async function applyUpdate(state, context, target) {
142930
142605
  const location = await resolveUpdateLocation(state, context);
142931
142606
  if (!location)
@@ -142946,7 +142621,7 @@ async function resolveUpdateLocation(state, context) {
142946
142621
  }
142947
142622
  async function runUpdateEngine(state, location, context, target) {
142948
142623
  const { runUpdate: runUpdate2 } = await Promise.resolve().then(() => (init_updateService(), exports_updateService));
142949
- writeSyncStatus(context, formatUpdateStartMessage(target.pin));
142624
+ writeSyncStatus(context, formatUpdateStartMessage(target));
142950
142625
  const [updErr, report] = await catchError(runUpdate2({
142951
142626
  dryRun: false,
142952
142627
  channel: resolveChannel(),
@@ -142955,7 +142630,8 @@ async function runUpdateEngine(state, location, context, target) {
142955
142630
  skills: { agent: undefined, local: undefined },
142956
142631
  cli: { self: true },
142957
142632
  versionPin: target.pin,
142958
- versionPinOrigin: target.origin
142633
+ versionPinOrigin: target.origin,
142634
+ maxMajor: target.maxMajor
142959
142635
  }, state, {
142960
142636
  cliPkgVersion: package_default.version,
142961
142637
  isLocal: !location.global,
@@ -142979,6 +142655,10 @@ function finishUpdate(report, context, target) {
142979
142655
  for (const e of report.Errors) {
142980
142656
  logger.debug(`[${e.Subsystem}] ${e.Message} ${e.Instructions}`);
142981
142657
  }
142658
+ const heldBack = report.Cli?.heldBackVersion;
142659
+ if (heldBack) {
142660
+ 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.`);
142661
+ }
142982
142662
  const cliUpdated = report.Cli?.action === "updated";
142983
142663
  const toolsUpdated = !!report.Tools?.some((t) => t.status === "updated");
142984
142664
  const skillsUpdated = countRefreshedSkills(report) > 0;
@@ -143002,9 +142682,10 @@ function formatInstallLocationFailure(error52) {
143002
142682
  const suffix = error52 ? `: ${error52.message}` : ".";
143003
142683
  return `Update failed: could not resolve the CLI install location${suffix}`;
143004
142684
  }
143005
- function formatUpdateStartMessage(effectivePin) {
142685
+ function formatUpdateStartMessage(target) {
142686
+ const effectivePin = target.pin;
143006
142687
  if (!effectivePin) {
143007
- return "Updating UiPath CLI, tools, and skills.";
142688
+ return target.maxMajor === undefined ? "Updating UiPath CLI, tools, and skills." : `Updating UiPath CLI, tools, and skills within version ${target.maxMajor}.x.`;
143008
142689
  }
143009
142690
  const version2 = effectivePin.patch === undefined ? `${formatVersionPin(effectivePin)}.x` : formatVersionPin(effectivePin);
143010
142691
  return `Updating UiPath CLI, tools, and skills to version ${version2}.`;
@@ -143079,14 +142760,10 @@ function runChild(spawnFn, command, args, env2) {
143079
142760
  child.on("close", (code) => resolve2(code));
143080
142761
  });
143081
142762
  }
143082
- function extractVerb(args, index = 0) {
143083
- let bare = 0;
142763
+ function extractVerb(args) {
143084
142764
  for (const a of stripGlobalOptions(args.slice(2)).args) {
143085
- if (a.startsWith("-"))
143086
- continue;
143087
- if (bare === index)
142765
+ if (!a.startsWith("-"))
143088
142766
  return a;
143089
- bare += 1;
143090
142767
  }
143091
142768
  return;
143092
142769
  }
@@ -143361,7 +143038,6 @@ async function runNode(context) {
143361
143038
  return;
143362
143039
  }
143363
143040
  await parseAndExit(built.program, built.cleanedArgs, context);
143364
- await runPostLoginVersionSync(context);
143365
143041
  }
143366
143042
  var init_cli_node = __esm(() => {
143367
143043
  init_src2();
@@ -143608,4 +143284,4 @@ export {
143608
143284
  ready
143609
143285
  };
143610
143286
 
143611
- //# debugId=A10E069468DA983464756E2164756E21
143287
+ //# debugId=7DB21EA3DF7C515464756E2164756E21