@uipath/cli 1.204.0 → 1.205.0-preview.258

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.
@@ -24,20 +24,17 @@ import {
24
24
  readAuthFromEnv,
25
25
  resolveEnvFileLocationAsync,
26
26
  resolveEnvFilePathAsync
27
- } from "./index-zwnedwxc.js";
27
+ } from "./index-30618bjs.js";
28
28
  import {
29
29
  AGENT_DEFS,
30
30
  AGENT_DISPLAY_NAMES,
31
31
  ALIASES_BY_COMMAND,
32
32
  ALL_AGENTS,
33
33
  COMMAND_ALIASES,
34
- DISABLE_AUTOINSTALL_ENV,
35
- DISABLE_TOOL_LINE_CHECK_ENV,
36
34
  HIDDEN_CHANNELS,
37
35
  HostOwnedToolError,
38
36
  InstallRefusedError,
39
37
  PUBLIC_CHANNELS,
40
- SECRET_FIELD_PATHS,
41
38
  SkillSourceError,
42
39
  SkillsError,
43
40
  SkillsRegistryAuthError,
@@ -65,21 +62,19 @@ import {
65
62
  getSkillsDir,
66
63
  getSkillsSourceFailureDetails,
67
64
  hasDistinctGlobalPath,
68
- isAutoInstallDisabled,
69
65
  isBundledDistribution,
70
66
  isDevMode,
71
67
  isExactPin,
72
68
  isPreviewVersion,
73
- isToolLineCheckDisabled,
74
69
  isValidSemver,
75
70
  isValidVersionPin,
76
71
  loadConfigAsync,
77
72
  majorOf,
78
73
  mergeState,
79
- migrateVersionConfig,
80
74
  package_default,
81
75
  parsePackageSpec,
82
76
  promptAgentSelection,
77
+ readConfigFileAt,
83
78
  readExtraFiles,
84
79
  readManifest,
85
80
  readState,
@@ -111,9 +106,9 @@ import {
111
106
  uninstallExtraFolders,
112
107
  uninstallSkill,
113
108
  versionLinePrefix,
114
- versionMigrationNotice,
115
- withConfigLock
116
- } from "./index-1xqtdfjh.js";
109
+ withConfigLock,
110
+ writeConfigFileAt
111
+ } from "./index-etwj8w7c.js";
117
112
  import {
118
113
  AuthDimensions,
119
114
  BaseDimensions,
@@ -193,14 +188,14 @@ import {
193
188
  telemetryInit,
194
189
  telemetryShutdownWithoutFlush,
195
190
  validateOutputFilter
196
- } from "./index-trd07rnv.js";
191
+ } from "./index-pj3g8ftz.js";
197
192
  import {
198
193
  isBrowser
199
194
  } from "./index-0gctz400.js";
200
195
  import {
201
196
  getFileSystem,
202
197
  getFileSystemAsync
203
- } from "./index-xdxr3ync.js";
198
+ } from "./index-hdxtgckw.js";
204
199
  import {
205
200
  AUTH_CANCELLED_ERROR_CODE,
206
201
  AUTH_RECLAIMED_ERROR_CODE,
@@ -549,7 +544,7 @@ var GLOBAL_OPTIONS = [
549
544
  },
550
545
  {
551
546
  Flags: "--log-level <debug|info|warn|error>",
552
- Description: "Log level threshold (default: info)"
547
+ Description: "Log level threshold (default: warn)"
553
548
  },
554
549
  {
555
550
  Flags: "--log-file <path>",
@@ -584,6 +579,24 @@ var GETTING_STARTED_ROWS = [
584
579
  Description: "Install AI-agent skills for this CLI"
585
580
  }
586
581
  ];
582
+ var ENVIRONMENT_ROWS = [
583
+ {
584
+ Label: "UIPATH_CLI_DISABLE_VERSION_SYNC=1",
585
+ Description: "Skip the daily CLI and tool update check"
586
+ },
587
+ {
588
+ Label: "UIPATH_CLI_DISABLE_AUTOINSTALL=1",
589
+ Description: "Do not install a missing tool on first use"
590
+ },
591
+ {
592
+ Label: "HTTPS_PROXY, NO_PROXY",
593
+ Description: "Send HTTPS through a proxy, and the hosts that skip it"
594
+ },
595
+ {
596
+ Label: "NODE_EXTRA_CA_CERTS=<file>",
597
+ Description: "Trust an extra root CA (PEM file), e.g. a TLS-inspecting proxy's CA"
598
+ }
599
+ ];
587
600
  function getCommandPath(cmd) {
588
601
  const names = [];
589
602
  let current = cmd;
@@ -685,6 +698,13 @@ function renderRows(rows, contentWidth) {
685
698
  }
686
699
  return lines;
687
700
  }
701
+ function renderStackedRows(rows, contentWidth) {
702
+ const indent = " ";
703
+ return rows.flatMap((row) => [
704
+ row.Label,
705
+ ...wrapText(row.Description, Math.max(contentWidth - indent.length, 1)).map((line) => `${indent}${line}`)
706
+ ]);
707
+ }
688
708
  function renderSection(section, width) {
689
709
  const contentWidth = Math.max(width - 4, 16);
690
710
  const title = ` ${section.Title} `;
@@ -831,7 +851,7 @@ function buildExampleLines(examples, contentWidth) {
831
851
  }
832
852
  return lines;
833
853
  }
834
- function buildTableHelpSections(cmd, helper) {
854
+ function buildTableHelpSections(cmd, helper, isBrowser2) {
835
855
  const contentWidth = Math.max(getHelpWidth() - 4, 16);
836
856
  const baseHelp = extractCommandHelp(cmd, helper);
837
857
  const sections = [];
@@ -908,6 +928,12 @@ function buildTableHelpSections(cmd, helper) {
908
928
  Lines: buildExampleLines(baseHelp.Examples, contentWidth)
909
929
  });
910
930
  }
931
+ if (isRootCommand(cmd) && !isBrowser2) {
932
+ sections.push({
933
+ Title: "Environment",
934
+ Lines: renderStackedRows(ENVIRONMENT_ROWS, contentWidth)
935
+ });
936
+ }
911
937
  if (isRootCommand(cmd)) {
912
938
  sections.push({
913
939
  Title: "Getting started",
@@ -916,7 +942,7 @@ function buildTableHelpSections(cmd, helper) {
916
942
  }
917
943
  return sections;
918
944
  }
919
- function renderTableHelp(cmd, helper) {
945
+ function renderTableHelp(cmd, helper, isBrowser2) {
920
946
  const width = getHelpWidth();
921
947
  const description = helper.commandDescription(cmd);
922
948
  const parts = [];
@@ -925,7 +951,7 @@ function renderTableHelp(cmd, helper) {
925
951
  } else {
926
952
  parts.push(renderCommandHeader(getCommandPath(cmd), description, width));
927
953
  }
928
- for (const section of buildTableHelpSections(cmd, helper)) {
954
+ for (const section of buildTableHelpSections(cmd, helper, isBrowser2)) {
929
955
  parts.push(renderSection(section, width));
930
956
  }
931
957
  return `${parts.join(`
@@ -959,7 +985,7 @@ function createHelpConfiguration(isBrowser2) {
959
985
  const config = {
960
986
  formatHelp(cmd, helper) {
961
987
  if (rendersTableHelp()) {
962
- return renderTableHelp(cmd, helper);
988
+ return renderTableHelp(cmd, helper, isBrowser2);
963
989
  }
964
990
  const baseHelp = extractCommandHelp(cmd, helper);
965
991
  const subcommands = helper.visibleCommands(cmd).map((sub) => {
@@ -980,6 +1006,8 @@ function createHelpConfiguration(isBrowser2) {
980
1006
  };
981
1007
  if (isRootCommand(cmd)) {
982
1008
  helpData.GettingStarted = GETTING_STARTED_ROWS;
1009
+ if (!isBrowser2)
1010
+ helpData.Environment = ENVIRONMENT_ROWS;
983
1011
  }
984
1012
  const output = {
985
1013
  Result: RESULTS.Success,
@@ -1242,6 +1270,10 @@ async function initProgram(context, hooks = {}) {
1242
1270
  interactive
1243
1271
  } = globalOptions;
1244
1272
  context.args = cleanedArgs;
1273
+ configureLogger({
1274
+ ...logLevel !== undefined && { level: logLevel },
1275
+ ...logFile !== undefined && { logFile }
1276
+ });
1245
1277
  const overrides = hooks.beforeLoggerConfigure ? await hooks.beforeLoggerConfigure({
1246
1278
  formatWasExplicit,
1247
1279
  logLevelWasExplicit: logLevel !== undefined,
@@ -1260,8 +1292,7 @@ async function initProgram(context, hooks = {}) {
1260
1292
  });
1261
1293
  setHelpRequested(!formatWasExplicit && cleanedArgs.some((arg) => HELP_FLAGS2.has(arg)));
1262
1294
  configureLogger({
1263
- ...effectiveLogLevel !== undefined && { level: effectiveLogLevel },
1264
- ...logFile !== undefined && { logFile }
1295
+ ...effectiveLogLevel !== undefined && { level: effectiveLogLevel }
1265
1296
  });
1266
1297
  if (overrides.onLoggerReady) {
1267
1298
  overrides.onLoggerReady();
@@ -2446,7 +2477,6 @@ function registerCompletionCommand(program, discovered, context) {
2446
2477
  }
2447
2478
 
2448
2479
  // src/commands/config.ts
2449
- import { randomUUID } from "node:crypto";
2450
2480
  var CONFIG_KEYS = {
2451
2481
  output: {
2452
2482
  path: ["core", "output"],
@@ -2475,20 +2505,9 @@ var CONFIG_KEYS = {
2475
2505
  validate: (v) => isValidVersionPin(v),
2476
2506
  valueHint: "Use major.minor or major.minor.patch (e.g. 1.2 or 1.2.3).",
2477
2507
  description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows the latest release"
2478
- },
2479
- clientSecret: {
2480
- path: ["auth", "clientSecret"],
2481
- writable: false,
2482
- description: "External app client secret used by login"
2483
2508
  }
2484
2509
  };
2485
2510
  var VALID_KEY_NAMES = Object.keys(CONFIG_KEYS);
2486
- var WRITABLE_KEY_NAMES = VALID_KEY_NAMES.filter((key) => CONFIG_KEYS[key].writable !== false);
2487
- var REMOVED_KEYS = {
2488
- 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`).",
2489
- 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."
2490
- };
2491
- var unknownKeyInstructions = (key, validNames) => Object.hasOwn(REMOVED_KEYS, key) ? REMOVED_KEYS[key] : `Valid keys: ${validNames.join(", ")}`;
2492
2511
  var CONFIG_GET_EXAMPLES = [
2493
2512
  {
2494
2513
  Description: "Get the default output format",
@@ -2514,8 +2533,7 @@ var CONFIG_GET_EXAMPLES = [
2514
2533
  updateChannel: "stable"
2515
2534
  },
2516
2535
  auth: {
2517
- clientId: "client-abc",
2518
- clientSecret: "<redacted>"
2536
+ authority: "https://cloud.uipath.com"
2519
2537
  }
2520
2538
  }
2521
2539
  }
@@ -2616,33 +2634,6 @@ async function resolveForWrite(explicit) {
2616
2634
  path: fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, CONFIG_FILENAME)
2617
2635
  };
2618
2636
  }
2619
- async function readConfigFileAt(path) {
2620
- const fs = getFileSystem();
2621
- if (!await fs.exists(path)) {
2622
- return {};
2623
- }
2624
- const content = await fs.readFile(path, "utf-8");
2625
- if (content === null) {
2626
- return {};
2627
- }
2628
- const parsed = JSON.parse(content);
2629
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
2630
- return {};
2631
- }
2632
- return parsed;
2633
- }
2634
- async function writeConfigFileAt(path, config) {
2635
- const fs = getFileSystem();
2636
- const dir = fs.path.dirname(path);
2637
- await fs.mkdir(dir);
2638
- const tempPath = `${path}.${randomUUID()}.tmp`;
2639
- await fs.writeFile(tempPath, JSON.stringify(config, null, 4));
2640
- const [renameErr] = await catchError(fs.rename(tempPath, path));
2641
- if (renameErr) {
2642
- await catchError(fs.rm(tempPath));
2643
- throw renameErr;
2644
- }
2645
- }
2646
2637
  function getNestedValue(obj, path) {
2647
2638
  const section = obj[path[0]];
2648
2639
  if (section === undefined || section === null || typeof section !== "object") {
@@ -2703,14 +2694,6 @@ function isSensitiveKey(key) {
2703
2694
  }
2704
2695
  return false;
2705
2696
  }
2706
- var SECRET_PATH_SET = new Set(SECRET_FIELD_PATHS.map((p) => p.join(".")));
2707
- function isSecretPath(pathSegments) {
2708
- if (pathSegments.length === 0)
2709
- return false;
2710
- if (SECRET_PATH_SET.has(pathSegments.join(".")))
2711
- return true;
2712
- return isSensitiveKey(pathSegments[pathSegments.length - 1]);
2713
- }
2714
2697
  function redactSecretsDeep(value, pathSegments = []) {
2715
2698
  if (Array.isArray(value)) {
2716
2699
  return value.map((v, i) => redactSecretsDeep(v, [...pathSegments, String(i)]));
@@ -2719,7 +2702,7 @@ function redactSecretsDeep(value, pathSegments = []) {
2719
2702
  const out = {};
2720
2703
  for (const [k, v] of Object.entries(value)) {
2721
2704
  const childPath = [...pathSegments, k];
2722
- out[k] = isSecretPath(childPath) ? REDACTED_VALUE : redactSecretsDeep(v, childPath);
2705
+ out[k] = isSensitiveKey(k) ? REDACTED_VALUE : redactSecretsDeep(v, childPath);
2723
2706
  }
2724
2707
  return out;
2725
2708
  }
@@ -2765,7 +2748,7 @@ function registerConfigCommand(program, context) {
2765
2748
  OutputFormatter.error({
2766
2749
  Result: RESULTS.ValidationError,
2767
2750
  Message: `Unknown config key '${key}'`,
2768
- Instructions: unknownKeyInstructions(key, VALID_KEY_NAMES)
2751
+ Instructions: `Valid keys: ${VALID_KEY_NAMES.join(", ")}`
2769
2752
  });
2770
2753
  context.exit(1);
2771
2754
  return;
@@ -2794,7 +2777,7 @@ function registerConfigCommand(program, context) {
2794
2777
  if (key !== undefined) {
2795
2778
  const def = CONFIG_KEYS[key];
2796
2779
  const value = getNestedValue(rawConfig, def.path);
2797
- const display = value === undefined ? "-" : isSecretPath(def.path) ? REDACTED_VALUE : String(value);
2780
+ const display = value === undefined ? "-" : isSensitiveKey(def.path[1]) ? REDACTED_VALUE : String(value);
2798
2781
  const data = { Key: key, Value: display };
2799
2782
  OutputFormatter.success({
2800
2783
  Result: RESULTS.Success,
@@ -2811,26 +2794,17 @@ function registerConfigCommand(program, context) {
2811
2794
  }
2812
2795
  });
2813
2796
  }, getTelemetryProperties);
2814
- config.command("set").description("Set a configuration value (writes to the discovered file, or to ~/.uipath/config.json by default)").argument("<key>", `Config key (${WRITABLE_KEY_NAMES.join(", ")})`).argument("<value>", "New value").option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_SET_EXAMPLES).trackedAction(context, async (key, rawValue, options) => {
2797
+ config.command("set").description("Set a configuration value (writes to the discovered file, or to ~/.uipath/config.json by default)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).argument("<value>", "New value").option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_SET_EXAMPLES).trackedAction(context, async (key, rawValue, options) => {
2815
2798
  if (!Object.hasOwn(CONFIG_KEYS, key)) {
2816
2799
  OutputFormatter.error({
2817
2800
  Result: RESULTS.ValidationError,
2818
2801
  Message: `Unknown config key '${key}'`,
2819
- Instructions: unknownKeyInstructions(key, WRITABLE_KEY_NAMES)
2802
+ Instructions: `Valid keys: ${VALID_KEY_NAMES.join(", ")}`
2820
2803
  });
2821
2804
  context.exit(1);
2822
2805
  return;
2823
2806
  }
2824
2807
  const def = CONFIG_KEYS[key];
2825
- if (def.writable === false) {
2826
- OutputFormatter.error({
2827
- Result: RESULTS.ValidationError,
2828
- Message: `Config key '${key}' cannot be set with 'uip config set'`,
2829
- Instructions: "Use 'uip login --client-secret env.NAME' so secrets stay in environment variables and the auth file, not config.json."
2830
- });
2831
- context.exit(1);
2832
- return;
2833
- }
2834
2808
  const value = def.normalize ? def.normalize(rawValue) : rawValue;
2835
2809
  if (def.validValues !== undefined && !def.validValues.includes(value) && !(def.hiddenValues ?? []).includes(value)) {
2836
2810
  OutputFormatter.error({
@@ -2870,31 +2844,22 @@ function registerConfigCommand(program, context) {
2870
2844
  Code: "ConfigSet",
2871
2845
  Data: {
2872
2846
  Key: key,
2873
- Value: isSecretPath(def.path) ? REDACTED_VALUE : value,
2847
+ Value: isSensitiveKey(def.path[1]) ? REDACTED_VALUE : value,
2874
2848
  Status: "Updated"
2875
2849
  }
2876
2850
  });
2877
2851
  }, setTelemetryProperties);
2878
- config.command("clear").description("Remove a configuration value (from the discovered file; no-op if it isn't set)").argument("<key>", `Config key (${WRITABLE_KEY_NAMES.join(", ")})`).option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_CLEAR_EXAMPLES).trackedAction(context, async (key, options) => {
2852
+ config.command("clear").description("Remove a configuration value (from the discovered file; no-op if it isn't set)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_CLEAR_EXAMPLES).trackedAction(context, async (key, options) => {
2879
2853
  if (!Object.hasOwn(CONFIG_KEYS, key)) {
2880
2854
  OutputFormatter.error({
2881
2855
  Result: RESULTS.ValidationError,
2882
2856
  Message: `Unknown config key '${key}'`,
2883
- Instructions: unknownKeyInstructions(key, WRITABLE_KEY_NAMES)
2857
+ Instructions: `Valid keys: ${VALID_KEY_NAMES.join(", ")}`
2884
2858
  });
2885
2859
  context.exit(1);
2886
2860
  return;
2887
2861
  }
2888
2862
  const def = CONFIG_KEYS[key];
2889
- if (def.writable === false) {
2890
- OutputFormatter.error({
2891
- Result: RESULTS.ValidationError,
2892
- Message: `Config key '${key}' cannot be cleared with 'uip config clear'`,
2893
- Instructions: "Manage this value through 'uip login' / 'uip logout', not config.json."
2894
- });
2895
- context.exit(1);
2896
- return;
2897
- }
2898
2863
  const resolved = await resolveForRead(options.configFile);
2899
2864
  if (resolved.error) {
2900
2865
  OutputFormatter.error({
@@ -2962,26 +2927,26 @@ var promptSelect = async (options, message) => {
2962
2927
  // src/services/auth.ts
2963
2928
  class NodeAuth {
2964
2929
  async interactiveLogin(options) {
2965
- const { interactiveLogin } = await import("./index-mttdq2yn.js");
2930
+ const { interactiveLogin } = await import("./index-7tshyfxx.js");
2966
2931
  return await interactiveLogin({
2967
2932
  ...options,
2968
2933
  selectFromList: promptSelect
2969
2934
  });
2970
2935
  }
2971
2936
  async clientCredentialsLogin(options) {
2972
- const { clientCredentialsLogin } = await import("./index-mttdq2yn.js");
2937
+ const { clientCredentialsLogin } = await import("./index-7tshyfxx.js");
2973
2938
  return await clientCredentialsLogin(options);
2974
2939
  }
2975
2940
  async getLoginStatus(options) {
2976
- const { getLoginStatusAsync: getLoginStatusAsync2 } = await import("./index-mttdq2yn.js");
2941
+ const { getLoginStatusAsync: getLoginStatusAsync2 } = await import("./index-7tshyfxx.js");
2977
2942
  return getLoginStatusAsync2(options);
2978
2943
  }
2979
2944
  async fetchTenants(baseUrl, accessToken, organizationId) {
2980
- const { fetchTenantsAndOrganizations } = await import("./index-mttdq2yn.js");
2945
+ const { fetchTenantsAndOrganizations } = await import("./index-7tshyfxx.js");
2981
2946
  return fetchTenantsAndOrganizations(baseUrl, accessToken, organizationId);
2982
2947
  }
2983
2948
  async saveTenantSelection(envFilePath, tenantName, tenantId) {
2984
- const { saveEnvFileAsync } = await import("./index-mttdq2yn.js");
2949
+ const { saveEnvFileAsync } = await import("./index-7tshyfxx.js");
2985
2950
  await saveEnvFileAsync({
2986
2951
  envPath: envFilePath,
2987
2952
  data: {
@@ -2995,23 +2960,23 @@ class NodeAuth {
2995
2960
 
2996
2961
  class BrowserAuth {
2997
2962
  async interactiveLogin(options) {
2998
- const { interactiveLogin } = await import("./index-mttdq2yn.js");
2963
+ const { interactiveLogin } = await import("./index-7tshyfxx.js");
2999
2964
  return await interactiveLogin(options);
3000
2965
  }
3001
2966
  async clientCredentialsLogin(options) {
3002
- const { clientCredentialsLogin } = await import("./index-mttdq2yn.js");
2967
+ const { clientCredentialsLogin } = await import("./index-7tshyfxx.js");
3003
2968
  return await clientCredentialsLogin(options);
3004
2969
  }
3005
2970
  async getLoginStatus(options) {
3006
- const { getLoginStatusAsync: getLoginStatusAsync2 } = await import("./index-mttdq2yn.js");
2971
+ const { getLoginStatusAsync: getLoginStatusAsync2 } = await import("./index-7tshyfxx.js");
3007
2972
  return getLoginStatusAsync2(options);
3008
2973
  }
3009
2974
  async fetchTenants(baseUrl, accessToken, organizationId) {
3010
- const { fetchTenantsAndOrganizations } = await import("./index-mttdq2yn.js");
2975
+ const { fetchTenantsAndOrganizations } = await import("./index-7tshyfxx.js");
3011
2976
  return fetchTenantsAndOrganizations(baseUrl, accessToken, organizationId);
3012
2977
  }
3013
2978
  async saveTenantSelection(envFilePath, tenantName, tenantId) {
3014
- const { saveEnvFileAsync } = await import("./index-mttdq2yn.js");
2979
+ const { saveEnvFileAsync } = await import("./index-7tshyfxx.js");
3015
2980
  await saveEnvFileAsync({
3016
2981
  envPath: envFilePath,
3017
2982
  data: {
@@ -3882,7 +3847,7 @@ var LOGIN_WHICH_EXAMPLES = [
3882
3847
  }
3883
3848
  ];
3884
3849
  function registerLoginCommand(program, context) {
3885
- const loginCommand = program.command("login").description("Login to UiPath Cloud").option("-f, --file <folder>", "Path to credentials folder").option("--authority <url>", "Custom authority URL, e.g. https://cloud.uipath.com (default), https://govcloud.uipath.us (Public Sector), or your Automation Suite host. https:// may be omitted (cloud.uipath.com works)").option("--client-id <id>", "Client Id or Application Id. Use env.ENV_NAME to read from an environment variable").option("--client-secret <secret>", "Client Secret or Application Secret. Use env.ENV_NAME to read from an environment variable").option("--client-assertion <jwt>", "OIDC token (JWT) for federated login (workload identity), used instead of a secret. Use env.ENV_NAME to read from an environment variable (recommended). Requires --client-id").option("-s, --scope <scopes>", "Custom scopes or Application scopes (External Apps). Comma- or space-separated values.").option("-t, --tenant <name>", "Tenant name (non-interactive mode)").option("--organization <name>", "Organization logical name to pre-select during browser login (bypasses the org picker for users in multiple organizations)").option("--no-browser", "Don't open a browser; print the authorize URL and wait for the callback (for headless/automation-driven login). Blocks until the sign-in completes — when a person will do the sign-in, they should run the command themselves in their own terminal, not through an agent's shell tool").examples(LOGIN_EXAMPLES).trackedAction(context, async (options) => {
3850
+ const loginCommand = program.command("login").description("Login to UiPath Cloud").option("-f, --file <folder>", "Path to credentials folder").option("--authority <url>", "Custom authority URL, e.g. https://cloud.uipath.com (default), https://govcloud.uipath.us (Public Sector), or your Automation Suite host. https:// may be omitted (cloud.uipath.com works)").option("--client-id <id>", "External application ID. Requires --client-secret or --client-assertion. Use env.ENV_NAME to read from an environment variable").option("--client-secret <secret>", "External application secret. Requires --client-id. Use env.ENV_NAME to read from an environment variable").option("--client-assertion <jwt>", "OIDC token (JWT) for federated login (workload identity), used instead of a secret. Use env.ENV_NAME to read from an environment variable (recommended). Requires --client-id").option("-s, --scope <scopes>", "Custom scopes or Application scopes (External Apps). Comma- or space-separated values.").option("-t, --tenant <name>", "Tenant name (non-interactive mode)").option("--organization <name>", "Organization logical name to pre-select during browser login (bypasses the org picker for users in multiple organizations)").option("--no-browser", "Don't open a browser; print the authorize URL and wait for the callback (for headless/automation-driven login). Blocks until the sign-in completes — when a person will do the sign-in, they should run the command themselves in their own terminal, not through an agent's shell tool").examples(LOGIN_EXAMPLES).trackedAction(context, async (options) => {
3886
3851
  if (rejectProfileFileConflict(context, options.file)) {
3887
3852
  return;
3888
3853
  }
@@ -3927,6 +3892,24 @@ function registerLoginCommand(program, context) {
3927
3892
  context.exit(1);
3928
3893
  return;
3929
3894
  }
3895
+ if (clientSecret && !clientId) {
3896
+ OutputFormatter.error({
3897
+ Result: RESULTS.ConfigError,
3898
+ Message: "Client credentials login requires --client-id (the external application ID).",
3899
+ Instructions: "Pass --client-id <app-id> along with --client-secret."
3900
+ });
3901
+ context.exit(1);
3902
+ return;
3903
+ }
3904
+ if (clientId && !clientSecret && !clientAssertion) {
3905
+ OutputFormatter.error({
3906
+ Result: RESULTS.ConfigError,
3907
+ Message: "--client-id requires --client-secret or --client-assertion.",
3908
+ Instructions: "For an external application, pass --client-secret (client credentials) or --client-assertion (federated login) with --client-id. For browser login, drop --client-id."
3909
+ });
3910
+ context.exit(1);
3911
+ return;
3912
+ }
3930
3913
  const authFlow = clientAssertion ? "federated_credentials" : clientSecret ? "client_credentials" : "authorization_code";
3931
3914
  if (authFlow === "authorization_code" && canPrompt()) {
3932
3915
  getOutputSink().writeErr(`${COPYRIGHT_NOTICE}
@@ -4437,7 +4420,7 @@ function registerLogoutCommand(program, context) {
4437
4420
  function registerMcpCommand(program) {
4438
4421
  const mcpCommand = program.command("mcp").description("Model Context Protocol (MCP) server");
4439
4422
  mcpCommand.command("serve").description("Start the MCP server (stdio transport)").trackedAction(processContext, async () => {
4440
- const { startMcpServer } = await import("./server-fjpf556z.js");
4423
+ const { startMcpServer } = await import("./server-60aw12sq.js");
4441
4424
  await startMcpServer(program);
4442
4425
  });
4443
4426
  }
@@ -6876,7 +6859,7 @@ function createInstallPathResolver(toolsDir, isBrowser2) {
6876
6859
  const path = packageName ? `/tools/${packageName.replace(/[/@]/g, "_")}` : "/tools";
6877
6860
  return { path, global: false };
6878
6861
  }
6879
- const { getFileSystem: getFileSystem2 } = await import("./index-hhsf00x8.js");
6862
+ const { getFileSystem: getFileSystem2 } = await import("./index-ngs0a2he.js");
6880
6863
  const fsLocal = getFileSystem2();
6881
6864
  const { dirname: dirnameFn, join: joinFn } = fsLocal.path;
6882
6865
  const declaration = await getEnvToolsDirsDeclaration();
@@ -6948,341 +6931,86 @@ var populateTelemetryInstallContext = async (deps = {}) => {
6948
6931
  logger.debug("[Telemetry] install context populated at startup");
6949
6932
  };
6950
6933
 
6951
- // src/services/versionSync.ts
6952
- var REEXEC_GUARD_ENV = "UIPATH_CLI_VERSION_SYNC_REEXEC";
6934
+ // src/services/autoUpdatePolicy.ts
6953
6935
  var DISABLE_VERSION_SYNC_ENV = "UIPATH_CLI_DISABLE_VERSION_SYNC";
6954
- var DISABLE_ENV = DISABLE_VERSION_SYNC_ENV;
6955
- var SKIP_VERBS = new Set([
6956
- "update",
6957
- "login",
6958
- "logout",
6959
- "mcp",
6960
- "completion",
6961
- "config",
6962
- "skills",
6963
- "help"
6964
- ]);
6965
- async function maybeRunDailyVersionSync(context, state) {
6966
- const [err, reexeced] = await catchError(runStartupSync(context, state));
6967
- if (err) {
6968
- logger.debug(`Version sync skipped due to error: ${err.message}`);
6936
+ var DISABLE_AUTOINSTALL_ENV = "UIPATH_CLI_DISABLE_AUTOINSTALL";
6937
+ var DISABLE_TOOL_LINE_CHECK_ENV = "UIPATH_CLI_DISABLE_TOOL_LINE_CHECK";
6938
+ function isTruthyEnv(name) {
6939
+ const value = getFileSystem().env.getenv(name);
6940
+ if (!value)
6969
6941
  return false;
6970
- }
6971
- return reexeced;
6942
+ const v = value.trim().toLowerCase();
6943
+ return v !== "" && v !== "0" && v !== "false" && v !== "no";
6972
6944
  }
6973
- async function runStartupSync(context, state) {
6974
- logger.debug("Version sync evaluating (trigger=startup)");
6975
- if (context.capabilities.isBrowser) {
6976
- logger.debug("Version sync skipped: browser environment");
6977
- return false;
6978
- }
6979
- if (process.env[REEXEC_GUARD_ENV]) {
6980
- logger.debug("Version sync skipped: re-exec child");
6981
- return false;
6982
- }
6983
- if (isTruthyEnv(process.env[DISABLE_ENV])) {
6984
- logger.debug(`Version sync skipped: ${DISABLE_ENV} is set`);
6985
- return false;
6986
- }
6987
- const args = context.args;
6988
- if (isHelpOrVersionInvocation(args)) {
6989
- logger.debug("Version sync skipped: --help or the CLI's own --version");
6990
- return false;
6945
+ function isAutoInstallDisabled() {
6946
+ return isTruthyEnv(DISABLE_AUTOINSTALL_ENV);
6947
+ }
6948
+ function isToolLineCheckDisabled() {
6949
+ return isTruthyEnv(DISABLE_TOOL_LINE_CHECK_ENV);
6950
+ }
6951
+ function backgroundUpdateSkipReason(argv) {
6952
+ if (isTruthyEnv(DISABLE_VERSION_SYNC_ENV)) {
6953
+ return `${DISABLE_VERSION_SYNC_ENV} is set`;
6991
6954
  }
6992
- const verb = extractVerb(args);
6993
- if (!verb || SKIP_VERBS.has(verb)) {
6994
- logger.debug(`Version sync skipped: command '${verb}' is exempt`);
6995
- return false;
6955
+ if (isAutoInstallDisabled()) {
6956
+ return `${DISABLE_AUTOINSTALL_ENV} is set`;
6996
6957
  }
6997
6958
  if (isEnvAuthEnabled()) {
6998
- logger.debug("Version sync skipped: env-var auth (CI/headless)");
6999
- return false;
7000
- }
7001
- if (await isDevMode()) {
7002
- logger.debug("Version sync skipped: dev mode (monorepo checkout)");
7003
- return false;
7004
- }
7005
- if (await getEnvToolsDirsDeclaration()) {
7006
- logger.debug("Version sync skipped: the host declared its tool directories and owns the CLI version");
7007
- return false;
6959
+ return "env-var auth (CI/headless)";
7008
6960
  }
7009
- const [locationError, location] = await catchError(state.resolveInstallPath());
7010
- if (!locationError && location && await isBundledDistribution(location.path)) {
7011
- logger.debug("Version sync skipped: Studio-bundled CLI distribution");
7012
- return false;
6961
+ if (isHelpOrVersionInvocation(argv)) {
6962
+ return "--help or the CLI's own --version";
7013
6963
  }
7014
- return runDailyAutoUpdate(state, context);
6964
+ return null;
7015
6965
  }
7016
- async function runDailyAutoUpdate(state, context) {
7017
- const today = todayLocal();
7018
- const prev = await readState();
7019
- if (prev.lastUpdateDate === today) {
7020
- logger.debug("Daily auto-update already ran today; skipping");
7021
- return false;
7022
- }
7023
- const target = resolveEffectiveTarget();
7024
- if (target.frozen) {
7025
- await mergeState({ lastUpdateDate: today });
7026
- logger.debug("Daily auto-update skipped: exact pin (frozen)");
7027
- return false;
7028
- }
7029
- if (!await mergeState({ lastUpdateDate: today })) {
7030
- logger.debug("Daily auto-update skipped: could not persist the day claim (state dir unwritable)");
7031
- return false;
7032
- }
7033
- if (!getOutputSink().capabilities.isInteractive) {
7034
- writeSyncStatus(context, "Checking for updates.");
6966
+
6967
+ // src/services/toolFreshness.ts
6968
+ class ToolUpdateCheckError extends InstallRefusedError {
6969
+ constructor(message) {
6970
+ super(message, TOOL_CHECK_INSTRUCTIONS);
6971
+ this.name = "ToolUpdateCheckError";
7035
6972
  }
7036
- return applyUpdate(state, context, {
7037
- pin: target.pin,
7038
- origin: target.origin,
7039
- ...target.pin ? {} : runningMajorCeiling()
7040
- });
7041
6973
  }
7042
- function runningMajorCeiling() {
7043
- const major = majorOf(package_default.version);
7044
- if (major === null) {
7045
- logger.debug(`Daily auto-update: no major ceiling (unparseable CLI version '${package_default.version}')`);
7046
- return {};
7047
- }
7048
- return { maxMajor: major };
6974
+ var TOOL_CHECK_INSTRUCTIONS = "Check your connection and re-run the command — the check runs again on the next attempt. " + `To skip the daily tool check, set ${DISABLE_VERSION_SYNC_ENV}=1, ` + "or freeze versions with 'uip config set version <major.minor.patch>'.";
6975
+ function toolLookupFailedError(toolName, cause) {
6976
+ return new ToolUpdateCheckError(`The daily update check for '${toolName}' failed: ${cause.message}`);
7049
6977
  }
7050
- async function applyUpdate(state, context, target) {
7051
- const location = await resolveUpdateLocation(state, context);
7052
- if (!location)
7053
- return false;
7054
- const report = await runUpdateEngine(state, location, context, target);
7055
- if (!report)
7056
- return false;
7057
- return finishUpdate(report, context, target);
6978
+ function toolInstallFailedError(toolName, packageSpec, cause) {
6979
+ return new ToolUpdateCheckError(`The daily update check for '${toolName}' could not install ${packageSpec}: ${cause.message}`);
7058
6980
  }
7059
- async function resolveUpdateLocation(state, context) {
7060
- const [locErr, location] = await catchError(state.resolveInstallPath());
7061
- if (locErr || !location) {
7062
- writeSyncStatus(context, formatInstallLocationFailure(locErr));
7063
- logger.debug(`Cannot resolve install location: ${String(locErr)}`);
6981
+ async function resolveFreshnessGate() {
6982
+ if (await isDevMode()) {
6983
+ logger.debug("Tool freshness check skipped: dev mode");
7064
6984
  return null;
7065
6985
  }
7066
- return location;
7067
- }
7068
- async function runUpdateEngine(state, location, context, target) {
7069
- const { runUpdate: runUpdate2 } = await import("./updateService-2gjddhc9.js");
7070
- const spinner = await startSpinner(formatUpdateStartMessage(target));
7071
- if (!spinner) {
7072
- writeSyncStatus(context, formatUpdateStartMessage(target));
7073
- }
7074
- const [updErr, report] = await catchError(runUpdate2({
7075
- dryRun: false,
7076
- channel: resolveUpdateChannel(),
7077
- sections: { tools: false, skills: true, cli: true },
7078
- tools: { name: undefined },
7079
- skills: { agent: undefined, local: undefined },
7080
- cli: { self: true },
7081
- versionPin: target.pin,
7082
- versionPinOrigin: target.origin,
7083
- maxMajor: target.maxMajor,
7084
- onProgress: spinner ? (message) => {
7085
- spinner.text = message;
7086
- } : undefined
7087
- }, state, {
7088
- cliPkgVersion: package_default.version,
7089
- isLocal: !location.global,
7090
- isDev: false,
7091
- installPath: location.path
7092
- })).finally(() => spinner?.stop());
7093
- if (updErr || !report) {
7094
- writeSyncStatus(context, `Update failed: ${updErr ? updErr.message : "no report returned"}.`);
7095
- logger.debug(`Version sync update failed: ${updErr ? updErr.message : "no report"}`);
6986
+ if (resolveEffectiveTarget().frozen) {
6987
+ logger.debug("Tool freshness check skipped: exact pin (frozen)");
7096
6988
  return null;
7097
6989
  }
7098
- return report;
6990
+ return { channel: resolveRuntimeChannel() };
7099
6991
  }
7100
- function finishUpdate(report, context, target) {
7101
- if (report.HasFailures) {
7102
- writeSyncStatus(context, "Update completed with failures.");
7103
- for (const message of formatUpdateFailureMessages(report, target)) {
7104
- writeSyncStatus(context, message);
7105
- }
7106
- }
7107
- for (const e of report.Errors) {
7108
- logger.debug(`[${e.Subsystem}] ${e.Message} ${e.Instructions}`);
7109
- }
7110
- const heldBack = report.Cli?.heldBackVersion;
7111
- if (heldBack) {
7112
- 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.`);
7113
- }
7114
- const cliUpdated = report.Cli?.action === "updated";
7115
- const skillsUpdated = countRefreshedSkills(report) > 0;
7116
- if (!cliUpdated && !skillsUpdated) {
7117
- if (!report.HasFailures) {
7118
- writeSyncStatus(context, "No updates found.");
7119
- }
7120
- logger.debug("Version sync: nothing changed; continuing in-process");
7121
- return false;
6992
+ async function isToolCheckedToday(toolName) {
6993
+ const state = await readState();
6994
+ return state.toolUpdateDates?.[toolName] === todayLocal();
6995
+ }
6996
+ async function acquireToolCheckLock(toolName) {
6997
+ const { getFileSystemAsync: getFileSystemAsync2 } = await import("./index-ngs0a2he.js");
6998
+ const fs = await getFileSystemAsync2();
6999
+ if (typeof fs.acquireLock !== "function") {
7000
+ return { kind: "unavailable" };
7122
7001
  }
7123
- if (!report.HasFailures) {
7124
- writeSyncStatus(context, formatUpdateSuccessMessage(report));
7002
+ const dir = fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR);
7003
+ await catchError(fs.mkdir(dir));
7004
+ const target = fs.path.join(dir, `tool-update-${toolName}`);
7005
+ const [err, release] = await catchError(fs.acquireLock(target));
7006
+ if (!err) {
7007
+ return { kind: "held", release };
7125
7008
  }
7126
- if (!cliUpdated) {
7127
- logger.debug("Version sync: skills refreshed; continuing in-process");
7128
- return false;
7009
+ if (err.message.includes("ELOCKED")) {
7010
+ return { kind: "contended" };
7129
7011
  }
7130
- return reexecOriginalCommand(context);
7131
- }
7132
- function formatInstallLocationFailure(error) {
7133
- const suffix = error ? `: ${error.message}` : ".";
7134
- return `Update failed: could not resolve the CLI install location${suffix}`;
7135
- }
7136
- function formatUpdateStartMessage(target) {
7137
- const effectivePin = target.pin;
7138
- if (!effectivePin) {
7139
- return target.maxMajor === undefined ? "Updating UiPath CLI and skills." : `Updating UiPath CLI and skills within version ${target.maxMajor}.x.`;
7140
- }
7141
- const version = effectivePin.patch === undefined ? `${formatVersionPin(effectivePin)}.x` : formatVersionPin(effectivePin);
7142
- return `Updating UiPath CLI and skills to version ${version}.`;
7143
- }
7144
- async function reexecOriginalCommand(context) {
7145
- const { spawn } = await import("node:child_process");
7146
- const userArgs = process.argv.slice(2);
7147
- const env = { ...process.env, [REEXEC_GUARD_ENV]: "1" };
7148
- const entry = process.argv[1];
7149
- if (!entry) {
7150
- logger.debug("Re-exec skipped: process.argv[1] is undefined");
7151
- writeSyncStatus(context, "Could not re-run on the updated CLI; continuing on the current version.");
7152
- return false;
7153
- }
7154
- writeSyncStatus(context, "Re-running the requested command on the updated CLI.");
7155
- const [primErr, primCode] = await catchError(runChild(spawn, entry, userArgs, env));
7156
- if (!primErr) {
7157
- setExitCode(primCode ?? 1);
7158
- return true;
7159
- }
7160
- logger.debug(`Re-exec of '${entry}' failed: ${primErr.message}; trying node fallback`);
7161
- const [fbErr, fbCode] = await catchError(runChild(spawn, process.execPath, [entry, ...userArgs], env));
7162
- if (fbErr) {
7163
- logger.debug(`Re-exec fallback failed: ${fbErr.message}`);
7164
- writeSyncStatus(context, "Could not re-run on the updated CLI; continuing on the current version.");
7165
- return false;
7166
- }
7167
- setExitCode(fbCode ?? 1);
7168
- return true;
7169
- }
7170
- function writeSyncStatus(context, message) {
7171
- context.output.writeErr(`${message}
7172
- `);
7173
- }
7174
- function formatUpdateSuccessMessage(report) {
7175
- const parts = [];
7176
- if (report.Cli?.action === "updated" && report.Cli.available) {
7177
- parts.push(`@uipath/cli ${report.Cli.current} -> ${report.Cli.available}`);
7178
- }
7179
- const refreshedSkills = countRefreshedSkills(report);
7180
- if (refreshedSkills > 0) {
7181
- parts.push(`${refreshedSkills} skill(s) refreshed`);
7182
- }
7183
- return parts.length > 0 ? `Update succeeded: ${parts.join("; ")}.` : "Update succeeded.";
7184
- }
7185
- function formatUpdateFailureMessages(report, target) {
7186
- const { collapsed, individual } = collapsePinnedLineErrors(report, target);
7187
- const messages = individual.map((error) => {
7188
- const scope = error.Scope ? ` (${error.Scope})` : "";
7189
- return `Update failed: [${error.Subsystem}${scope}] ${error.Message}. Instructions: ${error.Instructions}`;
7190
- });
7191
- if (collapsed)
7192
- messages.unshift(`Update failed: ${collapsed}`);
7193
- if (messages.length > 0)
7194
- return messages;
7195
- if (report.Cli?.action === "failed" && report.Cli.reason) {
7196
- return [`Update failed: ${report.Cli.reason}`];
7197
- }
7198
- return ["Update failed: one or more update steps failed."];
7199
- }
7200
- function countRefreshedSkills(report) {
7201
- return report.Skills?.Sections.reduce((total, section) => total + section.refreshed, 0) ?? 0;
7202
- }
7203
- function runChild(spawnFn, command, args, env) {
7204
- return new Promise((resolve, reject) => {
7205
- const child = spawnFn(command, args, { stdio: "inherit", env });
7206
- child.on("error", reject);
7207
- child.on("close", (code) => resolve(code));
7208
- });
7209
- }
7210
- function extractVerb(args) {
7211
- for (const a of stripGlobalOptions(args.slice(2)).args) {
7212
- if (!a.startsWith("-"))
7213
- return a;
7214
- }
7215
- return;
7216
- }
7217
- function isTruthyEnv(value) {
7218
- if (!value)
7219
- return false;
7220
- const v = value.trim().toLowerCase();
7221
- return v !== "" && v !== "0" && v !== "false" && v !== "no";
7222
- }
7223
-
7224
- // src/services/toolFreshness.ts
7225
- class ToolUpdateCheckError extends InstallRefusedError {
7226
- constructor(message) {
7227
- super(message, TOOL_CHECK_INSTRUCTIONS);
7228
- this.name = "ToolUpdateCheckError";
7229
- }
7230
- }
7231
- var TOOL_CHECK_INSTRUCTIONS = "Check your connection and re-run the command — the check runs again on the next attempt. " + `To skip the daily tool check, set ${DISABLE_VERSION_SYNC_ENV}=1, ` + "or freeze versions with 'uip config set version <major.minor.patch>'.";
7232
- function toolLookupFailedError(toolName, cause) {
7233
- return new ToolUpdateCheckError(`The daily update check for '${toolName}' failed: ${cause.message}`);
7234
- }
7235
- function toolInstallFailedError(toolName, packageSpec, cause) {
7236
- return new ToolUpdateCheckError(`The daily update check for '${toolName}' could not install ${packageSpec}: ${cause.message}`);
7237
- }
7238
- function freshnessSkipReason(argv = process.argv) {
7239
- if (isTruthyEnv(process.env[DISABLE_VERSION_SYNC_ENV])) {
7240
- return `${DISABLE_VERSION_SYNC_ENV} is set`;
7241
- }
7242
- if (isAutoInstallDisabled()) {
7243
- return "auto-install is disabled";
7244
- }
7245
- if (isEnvAuthEnabled()) {
7246
- return "env-var auth (CI/headless)";
7247
- }
7248
- if (isHelpOrVersionInvocation(argv)) {
7249
- return "--help or the CLI's own --version";
7250
- }
7251
- return null;
7252
- }
7253
- async function resolveFreshnessGate() {
7254
- if (await isDevMode()) {
7255
- logger.debug("Tool freshness check skipped: dev mode");
7256
- return null;
7257
- }
7258
- if (resolveEffectiveTarget().frozen) {
7259
- logger.debug("Tool freshness check skipped: exact pin (frozen)");
7260
- return null;
7261
- }
7262
- return { channel: resolveRuntimeChannel() };
7263
- }
7264
- async function isToolCheckedToday(toolName) {
7265
- const state = await readState();
7266
- return state.toolUpdateDates?.[toolName] === todayLocal();
7267
- }
7268
- async function acquireToolCheckLock(toolName) {
7269
- const { getFileSystemAsync: getFileSystemAsync2 } = await import("./index-hhsf00x8.js");
7270
- const fs = await getFileSystemAsync2();
7271
- if (typeof fs.acquireLock !== "function") {
7272
- return { kind: "unavailable" };
7273
- }
7274
- const dir = fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR);
7275
- await catchError(fs.mkdir(dir));
7276
- const target = fs.path.join(dir, `tool-update-${toolName}`);
7277
- const [err, release] = await catchError(fs.acquireLock(target));
7278
- if (!err) {
7279
- return { kind: "held", release };
7280
- }
7281
- if (err.message.includes("ELOCKED")) {
7282
- return { kind: "contended" };
7283
- }
7284
- logger.debug(`Could not lock the daily check for '${toolName}': ${err.message}; continuing unlocked`);
7285
- return { kind: "unavailable" };
7012
+ logger.debug(`Could not lock the daily check for '${toolName}': ${err.message}; continuing unlocked`);
7013
+ return { kind: "unavailable" };
7286
7014
  }
7287
7015
 
7288
7016
  // src/services/tool-manager.ts
@@ -7324,7 +7052,7 @@ class ToolManager {
7324
7052
  if (this.freshVerbs.has(verb)) {
7325
7053
  return;
7326
7054
  }
7327
- const skip = freshnessSkipReason(this.argv);
7055
+ const skip = backgroundUpdateSkipReason(this.argv);
7328
7056
  if (skip) {
7329
7057
  logger.debug(`Tool freshness check skipped: ${skip}`);
7330
7058
  this.freshVerbs.add(verb);
@@ -7576,6 +7304,264 @@ class ToolManager {
7576
7304
  }
7577
7305
  }
7578
7306
 
7307
+ // src/services/versionSync.ts
7308
+ var REEXEC_GUARD_ENV = "UIPATH_CLI_VERSION_SYNC_REEXEC";
7309
+ var SKIP_VERBS = new Set([
7310
+ "update",
7311
+ "login",
7312
+ "logout",
7313
+ "mcp",
7314
+ "completion",
7315
+ "config",
7316
+ "skills",
7317
+ "help"
7318
+ ]);
7319
+ async function maybeRunDailyVersionSync(context, state) {
7320
+ const [err, reexeced] = await catchError(runStartupSync(context, state));
7321
+ if (err) {
7322
+ logger.debug(`Version sync skipped due to error: ${err.message}`);
7323
+ return false;
7324
+ }
7325
+ return reexeced;
7326
+ }
7327
+ async function runStartupSync(context, state) {
7328
+ logger.debug("Version sync evaluating (trigger=startup)");
7329
+ if (context.capabilities.isBrowser) {
7330
+ logger.debug("Version sync skipped: browser environment");
7331
+ return false;
7332
+ }
7333
+ if (process.env[REEXEC_GUARD_ENV]) {
7334
+ logger.debug("Version sync skipped: re-exec child");
7335
+ return false;
7336
+ }
7337
+ const args = context.args;
7338
+ const skip = backgroundUpdateSkipReason(args);
7339
+ if (skip) {
7340
+ logger.debug(`Version sync skipped: ${skip}`);
7341
+ return false;
7342
+ }
7343
+ const verb = extractVerb(args);
7344
+ if (!verb || SKIP_VERBS.has(verb)) {
7345
+ logger.debug(`Version sync skipped: command '${verb}' is exempt`);
7346
+ return false;
7347
+ }
7348
+ if (await isDevMode()) {
7349
+ logger.debug("Version sync skipped: dev mode (monorepo checkout)");
7350
+ return false;
7351
+ }
7352
+ if (await getEnvToolsDirsDeclaration()) {
7353
+ logger.debug("Version sync skipped: the host declared its tool directories and owns the CLI version");
7354
+ return false;
7355
+ }
7356
+ const [locationError, location] = await catchError(state.resolveInstallPath());
7357
+ if (!locationError && location && await isBundledDistribution(location.path)) {
7358
+ logger.debug("Version sync skipped: Studio-bundled CLI distribution");
7359
+ return false;
7360
+ }
7361
+ return runDailyAutoUpdate(state, context);
7362
+ }
7363
+ async function runDailyAutoUpdate(state, context) {
7364
+ const today = todayLocal();
7365
+ const prev = await readState();
7366
+ if (prev.lastUpdateDate === today) {
7367
+ logger.debug("Daily auto-update already ran today; skipping");
7368
+ return false;
7369
+ }
7370
+ const target = resolveEffectiveTarget();
7371
+ if (target.frozen) {
7372
+ await mergeState({ lastUpdateDate: today });
7373
+ logger.debug("Daily auto-update skipped: exact pin (frozen)");
7374
+ return false;
7375
+ }
7376
+ if (!await mergeState({ lastUpdateDate: today })) {
7377
+ logger.debug("Daily auto-update skipped: could not persist the day claim (state dir unwritable)");
7378
+ return false;
7379
+ }
7380
+ if (!getOutputSink().capabilities.isInteractive) {
7381
+ writeSyncStatus(context, "Checking for updates.");
7382
+ }
7383
+ return applyUpdate(state, context, {
7384
+ pin: target.pin,
7385
+ origin: target.origin,
7386
+ ...target.pin ? {} : runningMajorCeiling()
7387
+ });
7388
+ }
7389
+ function runningMajorCeiling() {
7390
+ const major = majorOf(package_default.version);
7391
+ if (major === null) {
7392
+ logger.debug(`Daily auto-update: no major ceiling (unparseable CLI version '${package_default.version}')`);
7393
+ return {};
7394
+ }
7395
+ return { maxMajor: major };
7396
+ }
7397
+ async function applyUpdate(state, context, target) {
7398
+ const location = await resolveUpdateLocation(state, context);
7399
+ if (!location)
7400
+ return false;
7401
+ const report = await runUpdateEngine(state, location, context, target);
7402
+ if (!report)
7403
+ return false;
7404
+ return finishUpdate(report, context, target);
7405
+ }
7406
+ async function resolveUpdateLocation(state, context) {
7407
+ const [locErr, location] = await catchError(state.resolveInstallPath());
7408
+ if (locErr || !location) {
7409
+ writeSyncStatus(context, formatInstallLocationFailure(locErr));
7410
+ logger.debug(`Cannot resolve install location: ${String(locErr)}`);
7411
+ return null;
7412
+ }
7413
+ return location;
7414
+ }
7415
+ async function runUpdateEngine(state, location, context, target) {
7416
+ const { runUpdate: runUpdate2 } = await import("./updateService-6n4316n9.js");
7417
+ const spinner = await startSpinner(formatUpdateStartMessage(target));
7418
+ if (!spinner) {
7419
+ writeSyncStatus(context, formatUpdateStartMessage(target));
7420
+ }
7421
+ const [updErr, report] = await catchError(runUpdate2({
7422
+ dryRun: false,
7423
+ channel: resolveUpdateChannel(),
7424
+ sections: { tools: false, skills: true, cli: true },
7425
+ tools: { name: undefined },
7426
+ skills: { agent: undefined, local: undefined },
7427
+ cli: { self: true },
7428
+ versionPin: target.pin,
7429
+ versionPinOrigin: target.origin,
7430
+ maxMajor: target.maxMajor,
7431
+ onProgress: spinner ? (message) => {
7432
+ spinner.text = message;
7433
+ } : undefined
7434
+ }, state, {
7435
+ cliPkgVersion: package_default.version,
7436
+ isLocal: !location.global,
7437
+ isDev: false,
7438
+ installPath: location.path
7439
+ })).finally(() => spinner?.stop());
7440
+ if (updErr || !report) {
7441
+ writeSyncStatus(context, `Update failed: ${updErr ? updErr.message : "no report returned"}.`);
7442
+ logger.debug(`Version sync update failed: ${updErr ? updErr.message : "no report"}`);
7443
+ return null;
7444
+ }
7445
+ return report;
7446
+ }
7447
+ function finishUpdate(report, context, target) {
7448
+ if (report.HasFailures) {
7449
+ writeSyncStatus(context, "Update completed with failures.");
7450
+ for (const message of formatUpdateFailureMessages(report, target)) {
7451
+ writeSyncStatus(context, message);
7452
+ }
7453
+ }
7454
+ for (const e of report.Errors) {
7455
+ logger.debug(`[${e.Subsystem}] ${e.Message} ${e.Instructions}`);
7456
+ }
7457
+ const heldBack = report.Cli?.heldBackVersion;
7458
+ if (heldBack) {
7459
+ 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.`);
7460
+ }
7461
+ const cliUpdated = report.Cli?.action === "updated";
7462
+ const skillsUpdated = countRefreshedSkills(report) > 0;
7463
+ if (!cliUpdated && !skillsUpdated) {
7464
+ if (!report.HasFailures) {
7465
+ writeSyncStatus(context, "No updates found.");
7466
+ }
7467
+ logger.debug("Version sync: nothing changed; continuing in-process");
7468
+ return false;
7469
+ }
7470
+ if (!report.HasFailures) {
7471
+ writeSyncStatus(context, formatUpdateSuccessMessage(report));
7472
+ }
7473
+ if (!cliUpdated) {
7474
+ logger.debug("Version sync: skills refreshed; continuing in-process");
7475
+ return false;
7476
+ }
7477
+ return reexecOriginalCommand(context);
7478
+ }
7479
+ function formatInstallLocationFailure(error) {
7480
+ const suffix = error ? `: ${error.message}` : ".";
7481
+ return `Update failed: could not resolve the CLI install location${suffix}`;
7482
+ }
7483
+ function formatUpdateStartMessage(target) {
7484
+ const effectivePin = target.pin;
7485
+ if (!effectivePin) {
7486
+ return target.maxMajor === undefined ? "Updating UiPath CLI and skills." : `Updating UiPath CLI and skills within version ${target.maxMajor}.x.`;
7487
+ }
7488
+ const version = effectivePin.patch === undefined ? `${formatVersionPin(effectivePin)}.x` : formatVersionPin(effectivePin);
7489
+ return `Updating UiPath CLI and skills to version ${version}.`;
7490
+ }
7491
+ async function reexecOriginalCommand(context) {
7492
+ const { spawn } = await import("node:child_process");
7493
+ const userArgs = process.argv.slice(2);
7494
+ const env = { ...process.env, [REEXEC_GUARD_ENV]: "1" };
7495
+ const entry = process.argv[1];
7496
+ if (!entry) {
7497
+ logger.debug("Re-exec skipped: process.argv[1] is undefined");
7498
+ writeSyncStatus(context, "Could not re-run on the updated CLI; continuing on the current version.");
7499
+ return false;
7500
+ }
7501
+ writeSyncStatus(context, "Re-running the requested command on the updated CLI.");
7502
+ const [primErr, primCode] = await catchError(runChild(spawn, entry, userArgs, env));
7503
+ if (!primErr) {
7504
+ setExitCode(primCode ?? 1);
7505
+ return true;
7506
+ }
7507
+ logger.debug(`Re-exec of '${entry}' failed: ${primErr.message}; trying node fallback`);
7508
+ const [fbErr, fbCode] = await catchError(runChild(spawn, process.execPath, [entry, ...userArgs], env));
7509
+ if (fbErr) {
7510
+ logger.debug(`Re-exec fallback failed: ${fbErr.message}`);
7511
+ writeSyncStatus(context, "Could not re-run on the updated CLI; continuing on the current version.");
7512
+ return false;
7513
+ }
7514
+ setExitCode(fbCode ?? 1);
7515
+ return true;
7516
+ }
7517
+ function writeSyncStatus(context, message) {
7518
+ context.output.writeErr(`${message}
7519
+ `);
7520
+ }
7521
+ function formatUpdateSuccessMessage(report) {
7522
+ const parts = [];
7523
+ if (report.Cli?.action === "updated" && report.Cli.available) {
7524
+ parts.push(`@uipath/cli ${report.Cli.current} -> ${report.Cli.available}`);
7525
+ }
7526
+ const refreshedSkills = countRefreshedSkills(report);
7527
+ if (refreshedSkills > 0) {
7528
+ parts.push(`${refreshedSkills} skill(s) refreshed`);
7529
+ }
7530
+ return parts.length > 0 ? `Update succeeded: ${parts.join("; ")}.` : "Update succeeded.";
7531
+ }
7532
+ function formatUpdateFailureMessages(report, target) {
7533
+ const { collapsed, individual } = collapsePinnedLineErrors(report, target);
7534
+ const messages = individual.map((error) => {
7535
+ const scope = error.Scope ? ` (${error.Scope})` : "";
7536
+ return `Update failed: [${error.Subsystem}${scope}] ${error.Message}. Instructions: ${error.Instructions}`;
7537
+ });
7538
+ if (collapsed)
7539
+ messages.unshift(`Update failed: ${collapsed}`);
7540
+ if (messages.length > 0)
7541
+ return messages;
7542
+ if (report.Cli?.action === "failed" && report.Cli.reason) {
7543
+ return [`Update failed: ${report.Cli.reason}`];
7544
+ }
7545
+ return ["Update failed: one or more update steps failed."];
7546
+ }
7547
+ function countRefreshedSkills(report) {
7548
+ return report.Skills?.Sections.reduce((total, section) => total + section.refreshed, 0) ?? 0;
7549
+ }
7550
+ function runChild(spawnFn, command, args, env) {
7551
+ return new Promise((resolve, reject) => {
7552
+ const child = spawnFn(command, args, { stdio: "inherit", env });
7553
+ child.on("error", reject);
7554
+ child.on("close", (code) => resolve(code));
7555
+ });
7556
+ }
7557
+ function extractVerb(args) {
7558
+ for (const a of stripGlobalOptions(args.slice(2)).args) {
7559
+ if (!a.startsWith("-"))
7560
+ return a;
7561
+ }
7562
+ return;
7563
+ }
7564
+
7579
7565
  // src/utils/autoInstall.ts
7580
7566
  async function autoInstallToolIfNeeded(args, program, toolManager, context) {
7581
7567
  if (context.capabilities.isBrowser)
@@ -7740,7 +7726,7 @@ async function buildNodeProgram(context) {
7740
7726
  if (shouldPopulateTelemetryInstallContext(context.args)) {
7741
7727
  await populateTelemetryInstallContext();
7742
7728
  }
7743
- const { setActiveAuthProfile, setAuthFileConfig } = await import("./index-mttdq2yn.js");
7729
+ const { setActiveAuthProfile, setAuthFileConfig } = await import("./index-7tshyfxx.js");
7744
7730
  setActiveAuthProfile(profile);
7745
7731
  const [configErr, config] = await catchError(loadConfigAsync());
7746
7732
  if (configErr) {
@@ -7827,10 +7813,6 @@ async function runNodeInvocation(context) {
7827
7813
  await telemetryFlushAndShutdown();
7828
7814
  return;
7829
7815
  }
7830
- const [, migration] = await catchError(migrateVersionConfig(package_default.version));
7831
- if (migration?.removedAutoVersionSync) {
7832
- context.output.writeErr(versionMigrationNotice(migration));
7833
- }
7834
7816
  const reexeced = await maybeRunDailyVersionSync(context, built.updateState);
7835
7817
  if (reexeced) {
7836
7818
  suppressTimingReport();
@@ -7849,4 +7831,4 @@ async function runNodeInvocation(context) {
7849
7831
 
7850
7832
  export { runNode };
7851
7833
 
7852
- //# debugId=B8DF27E2432CE19B64756E2164756E21
7834
+ //# debugId=5D6737228DB9A33E64756E2164756E21