@uipath/cli 1.205.0-preview.281 → 1.206.0-preview.282

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.
Files changed (76) hide show
  1. package/dist/{applicationinsights-s28k1t0d.js → applicationinsights-pwe8sf3y.js} +1269 -1269
  2. package/dist/{browser-strategy-6atc7v8s.js → browser-strategy-p5fhwxqj.js} +6 -7
  3. package/dist/cli-s27j1n5p.js +23 -0
  4. package/dist/contentStore-m1z06vbp.js +41 -0
  5. package/dist/environmentInfo-687282b3.js +71 -0
  6. package/dist/feedbackPrompts-t1enxv1x.js +144 -0
  7. package/dist/handlers-93z27zrr.js +805 -0
  8. package/dist/index-090cbg51.js +72 -0
  9. package/dist/index-16d4evd1.js +1051 -0
  10. package/dist/index-1vyte4ma.js +14 -0
  11. package/dist/index-1z45q8dr.js +365 -0
  12. package/dist/index-21kns9qg.js +10 -0
  13. package/dist/{index-30618bjs.js → index-2mm750yx.js} +174 -234
  14. package/dist/{index-622x1qb5.js → index-3fvbddpw.js} +7092 -7092
  15. package/dist/{index-d3w0wn6k.js → index-5gce5wfd.js} +16 -16
  16. package/dist/index-5j0bfd3e.js +4744 -0
  17. package/dist/index-5r4q8h0q.js +30 -0
  18. package/dist/index-68xmrb9x.js +237 -0
  19. package/dist/index-6wj58qka.js +59 -0
  20. package/dist/index-99emfvtm.js +13 -0
  21. package/dist/{index-pj3g8ftz.js → index-9db5vwx9.js} +2429 -1693
  22. package/dist/index-ayg25v46.js +151 -0
  23. package/dist/index-bf0e4evz.js +6180 -0
  24. package/dist/index-bpqx6f8h.js +92 -0
  25. package/dist/index-bpxh3fqv.js +392 -0
  26. package/dist/index-c6fsnn8s.js +200 -0
  27. package/dist/{index-m5nwse9v.js → index-cj4v0jct.js} +21 -69
  28. package/dist/index-ckafghar.js +274 -0
  29. package/dist/{index-469jgr1w.js → index-dsj3jrm0.js} +105 -106
  30. package/dist/{index-1yh8g550.js → index-epsr41wx.js} +8 -12
  31. package/dist/index-gbdz3pb5.js +668 -0
  32. package/dist/{index-yb4er9vd.js → index-jjejkkg4.js} +474 -528
  33. package/dist/index-jmz7bmca.js +1327 -0
  34. package/dist/{index-wwyf05nx.js → index-k9t8g78x.js} +331 -2595
  35. package/dist/index-kg1xrq51.js +171 -0
  36. package/dist/index-m8vqyv3g.js +72 -0
  37. package/dist/index-nht90rae.js +45 -0
  38. package/dist/index-nsrrst23.js +44 -0
  39. package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
  40. package/dist/index-qadhm1gn.js +271 -0
  41. package/dist/index-qwbyt2q5.js +95 -0
  42. package/dist/index-rr5hdtcy.js +95 -0
  43. package/dist/{index-qa9gftnj.js → index-xd2w5pct.js} +3 -3
  44. package/dist/{index-925304r7.js → index-y085rpen.js} +29 -25
  45. package/dist/index-y5ncb93a.js +240 -0
  46. package/dist/index-y7d0cth0.js +93 -0
  47. package/dist/{index-hdxtgckw.js → index-z070caqq.js} +56 -12
  48. package/dist/index-zdqbp34f.js +14 -0
  49. package/dist/index.js +38 -36
  50. package/dist/install-3gw33jcf.js +558 -0
  51. package/dist/{jmespath-e4a59c8w.js → jmespath-ab6tdc42.js} +1 -1
  52. package/dist/js-yaml-0c4svjwq.js +36 -0
  53. package/dist/{mcp-jssaz3wr.js → mcp-s50h6d56.js} +236 -472
  54. package/dist/{node-strategy-ggx3nmyj.js → node-strategy-p1n8wr5s.js} +16 -19
  55. package/dist/project-context-285hydnd.js +94 -0
  56. package/dist/prompt-yxpm7mfr.js +13 -0
  57. package/dist/{server-7jza1fyx.js → server-900wc6vc.js} +28 -43
  58. package/dist/skillCatalog-d1t2qec8.js +22 -0
  59. package/dist/skillsService-tpvbx5g8.js +29 -0
  60. package/dist/{stdio-tmngemcz.js → stdio-kpsab5bz.js} +2 -4
  61. package/dist/{telemetry-drain-r92f0e4r.js → telemetry-drain-bw59e8f5.js} +8 -9
  62. package/dist/tree-j4w7p0pg.js +17 -0
  63. package/dist/updateService-mt6d51p1.js +522 -0
  64. package/dist/updateService.skills-491vfgt8.js +22 -0
  65. package/dist/updateService.tools-f7tr6kc6.js +16 -0
  66. package/package.json +2 -2
  67. package/dist/cli-kyp49kdm.js +0 -19
  68. package/dist/index-0gctz400.js +0 -17
  69. package/dist/index-4cq44eth.js +0 -19427
  70. package/dist/index-7tshyfxx.js +0 -157
  71. package/dist/index-g8ck9tv6.js +0 -2
  72. package/dist/index-ngs0a2he.js +0 -15
  73. package/dist/index-pr8kzdte.js +0 -9867
  74. package/dist/index-yc4kw997.js +0 -13
  75. package/dist/js-yaml-69tsdrrf.js +0 -37
  76. package/dist/updateService-t3yq8936.js +0 -14
@@ -0,0 +1,171 @@
1
+ import {
2
+ CHANNEL_PLACEHOLDER,
3
+ formatVersionPin
4
+ } from "./index-qadhm1gn.js";
5
+ import {
6
+ getFileSystem2
7
+ } from "./index-z070caqq.js";
8
+ import {
9
+ catchError,
10
+ logger,
11
+ UIPATH_HOME_DIR
12
+ } from "./index-9db5vwx9.js";
13
+
14
+ // src/commands/tools/tool-helpers.ts
15
+ function getInstalledTools(state) {
16
+ return (state.discoveredTools ?? []).map((d) => ({
17
+ name: d.toolName,
18
+ version: d.version,
19
+ description: d.description,
20
+ commandPrefix: d.commandPrefix
21
+ }));
22
+ }
23
+
24
+ // src/services/updateFailureFormat.ts
25
+ var 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`.";
26
+ var 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`.";
27
+ function pinnedLineRemediation(origin) {
28
+ if (origin === "latest")
29
+ return LATEST_LINE_REMEDIATION;
30
+ return PINNED_LINE_REMEDIATION;
31
+ }
32
+ function toolFailureRemediation(origin) {
33
+ const changeTarget = origin === "latest" ? "pin a version line with `uip config set version <major.minor>`" : "adjust the pinned `core.version`";
34
+ return `Check tool compatibility with the current CLI version, ${changeTarget}, ` + `or run \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\` to switch release channels.`;
35
+ }
36
+ function isPinnedLineMissing(error) {
37
+ return error.Kind === "pinned-line-missing";
38
+ }
39
+ function describeSearchedRegistry(registry) {
40
+ return registry ? ` (searched ${registry})` : "";
41
+ }
42
+ function describeMissingLine(opts) {
43
+ const { pin, origin, targetLine, searched } = opts;
44
+ const suffix = describeSearchedRegistry(searched);
45
+ if (origin === "latest") {
46
+ return `No version found in the latest ${targetLine} line${suffix}`;
47
+ }
48
+ return `No version found matching pinned ${formatVersionPin(pin)} in the ${targetLine} line${suffix}`;
49
+ }
50
+ function describeDowngradeReason(origin) {
51
+ if (origin === "latest")
52
+ return "the latest version line";
53
+ return "the pinned version";
54
+ }
55
+ function describeMissing(missing) {
56
+ const parts = [];
57
+ if (missing.some((e) => e.Subsystem === "cli"))
58
+ parts.push("the CLI");
59
+ const toolCount = missing.filter((e) => e.Subsystem === "tools").length;
60
+ if (toolCount > 0) {
61
+ parts.push(`${toolCount} tool${toolCount === 1 ? "" : "s"}`);
62
+ }
63
+ return parts.length > 0 ? parts.join(" and ") : "the pinned line";
64
+ }
65
+ function describePinnedLine(target) {
66
+ if (!target?.pin)
67
+ return "the pinned version line";
68
+ const line = `${target.pin.major}.${target.pin.minor}`;
69
+ if (target.origin === "latest") {
70
+ return `the latest version line ${line}`;
71
+ }
72
+ return `the pinned version line ${line}`;
73
+ }
74
+ function collapsePinnedLineErrors(report, target) {
75
+ const missing = report.Errors.filter(isPinnedLineMissing);
76
+ if (missing.length <= 1) {
77
+ return { collapsed: null, individual: report.Errors };
78
+ }
79
+ const searched = missing.find((e) => e.Registry)?.Registry;
80
+ return {
81
+ collapsed: `No published release found for ${describeMissing(missing)} on ` + `${describePinnedLine(target)} (channel: ${report.Channel}${searched ? `; searched ${searched}` : ""}). ` + pinnedLineRemediation(target?.origin),
82
+ individual: report.Errors.filter((e) => !isPinnedLineMissing(e))
83
+ };
84
+ }
85
+
86
+ // src/services/versionSyncState.ts
87
+ import { randomUUID } from "node:crypto";
88
+ var STATE_FILENAME = "version-sync.json";
89
+ function todayLocal() {
90
+ const d = new Date;
91
+ const month = String(d.getMonth() + 1).padStart(2, "0");
92
+ const day = String(d.getDate()).padStart(2, "0");
93
+ return `${d.getFullYear()}-${month}-${day}`;
94
+ }
95
+ function stateFilePath(fs) {
96
+ return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
97
+ }
98
+ async function readState(fs = getFileSystem2()) {
99
+ const [readErr, raw] = await catchError(fs.readFile(stateFilePath(fs), "utf-8"));
100
+ if (readErr || !raw)
101
+ return {};
102
+ const [parseErr, parsed] = catchError(() => JSON.parse(raw));
103
+ if (parseErr || parsed === null || typeof parsed !== "object") {
104
+ return {};
105
+ }
106
+ const state = {};
107
+ if (typeof parsed.lastUpdateDate === "string") {
108
+ state.lastUpdateDate = parsed.lastUpdateDate;
109
+ }
110
+ if (isPlainRecord(parsed.toolUpdateDates)) {
111
+ const dates = {};
112
+ for (const [name, date] of Object.entries(parsed.toolUpdateDates)) {
113
+ if (typeof date === "string")
114
+ dates[name] = date;
115
+ }
116
+ if (Object.keys(dates).length > 0)
117
+ state.toolUpdateDates = dates;
118
+ }
119
+ return state;
120
+ }
121
+ function isPlainRecord(value) {
122
+ return typeof value === "object" && value !== null && !Array.isArray(value);
123
+ }
124
+ async function recordToolUpdateDate(toolName, fs = getFileSystem2()) {
125
+ return mergeState({ toolUpdateDates: { [toolName]: todayLocal() } }, fs);
126
+ }
127
+ async function mergeState(patch, fs = getFileSystem2()) {
128
+ return updateState((current) => {
129
+ const next = { ...current, ...patch };
130
+ if (patch.toolUpdateDates && current.toolUpdateDates) {
131
+ next.toolUpdateDates = {
132
+ ...current.toolUpdateDates,
133
+ ...patch.toolUpdateDates
134
+ };
135
+ }
136
+ return next;
137
+ }, fs);
138
+ }
139
+ async function updateState(mutate, fs) {
140
+ const target = stateFilePath(fs);
141
+ await catchError(fs.mkdir(fs.path.dirname(target)));
142
+ let release;
143
+ if (typeof fs.acquireLock === "function") {
144
+ const [lockErr, acquired] = await catchError(fs.acquireLock(target));
145
+ if (lockErr) {
146
+ logger.debug(`Writing the version-sync state without its lock: ${lockErr.message}`);
147
+ } else {
148
+ release = acquired;
149
+ }
150
+ }
151
+ try {
152
+ const next = mutate(await readState(fs));
153
+ const tempPath = `${target}.${randomUUID()}.tmp`;
154
+ const [err] = await catchError((async () => {
155
+ await fs.writeFile(tempPath, JSON.stringify(next, null, 2));
156
+ await fs.rename(tempPath, target);
157
+ })());
158
+ if (err) {
159
+ await catchError(fs.rm(tempPath));
160
+ return false;
161
+ }
162
+ return true;
163
+ } finally {
164
+ if (release)
165
+ await catchError(release());
166
+ }
167
+ }
168
+
169
+ export { getInstalledTools, pinnedLineRemediation, toolFailureRemediation, describeSearchedRegistry, describeMissingLine, describeDowngradeReason, collapsePinnedLineErrors, todayLocal, readState, recordToolUpdateDate, mergeState };
170
+
171
+ //# debugId=F8E8AEC37A3D02A864756E2164756E21
@@ -0,0 +1,72 @@
1
+ import {
2
+ catchError,
3
+ Command,
4
+ logger,
5
+ getCompleter
6
+ } from "./index-9db5vwx9.js";
7
+ import {
8
+ importTool
9
+ } from "./index-bpxh3fqv.js";
10
+
11
+ // src/commands/completion/tree.ts
12
+ var isHiddenCommand = (cmd) => cmd._hidden === true;
13
+ function walkCommand(cmd) {
14
+ const options = cmd.options.map((o) => ({
15
+ flags: o.flags,
16
+ long: o.long?.replace(/^--/, "") ?? "",
17
+ short: o.short?.replace(/^-/, "") ?? "",
18
+ description: o.description,
19
+ completer: getCompleter(o)
20
+ }));
21
+ return {
22
+ name: cmd.name(),
23
+ description: cmd.description().split(`
24
+ `)[0],
25
+ subcommands: cmd.commands.filter((c) => !isHiddenCommand(c)).map(walkCommand),
26
+ options
27
+ };
28
+ }
29
+ async function buildFullTree2(program, discovered) {
30
+ const root = walkCommand(program);
31
+ for (const entry of discovered) {
32
+ const tool = await importTool(entry, { throwOnLoadError: true });
33
+ if (!tool) {
34
+ logger.debug(`Skipping tool ${entry.toolName}: import returned null`);
35
+ continue;
36
+ }
37
+ const shadow = new Command(tool.metadata.commandPrefix).description(tool.metadata.description);
38
+ const [regErr] = await catchError(tool.registerCommands(shadow));
39
+ if (regErr) {
40
+ logger.debug(`Skipping tool ${entry.toolName}: ${regErr.message}`);
41
+ continue;
42
+ }
43
+ const toolNode = walkCommand(shadow);
44
+ const idx = root.subcommands.findIndex((n) => n.name === entry.commandPrefix);
45
+ if (idx >= 0) {
46
+ root.subcommands[idx] = toolNode;
47
+ } else {
48
+ root.subcommands.push(toolNode);
49
+ }
50
+ }
51
+ return root;
52
+ }
53
+ function detectShell2() {
54
+ const raw = process.env.SHELL ?? "";
55
+ const shell = raw.includes("/") ? raw.slice(raw.lastIndexOf("/") + 1) : raw;
56
+ if (shell === "zsh")
57
+ return "zsh";
58
+ if (shell === "fish")
59
+ return "fish";
60
+ if (shell === "pwsh")
61
+ return "pwsh";
62
+ if (shell === "bash")
63
+ return "bash";
64
+ if (process.platform === "win32" || process.env.PSModulePath)
65
+ return "pwsh";
66
+ return "bash";
67
+ }
68
+ var posixSq2 = (s) => s.replace(/'/g, "'\\''");
69
+
70
+ export { buildFullTree2, detectShell2, posixSq2 };
71
+
72
+ //# debugId=67BE2E238A37909A64756E2164756E21
@@ -0,0 +1,45 @@
1
+ import {
2
+ VALID_CHANNELS,
3
+ getCachedConfig
4
+ } from "./index-qadhm1gn.js";
5
+ import {
6
+ package_default
7
+ } from "./index-090cbg51.js";
8
+
9
+ // src/services/channel.ts
10
+ function resolveUpdateChannel(cliVersion = package_default.version) {
11
+ return configChannel() ?? versionChannel(cliVersion) ?? "stable";
12
+ }
13
+ function resolveRuntimeChannel(cliVersion = package_default.version) {
14
+ return versionChannel(cliVersion) ?? configChannel() ?? "stable";
15
+ }
16
+ function isPreviewVersion(cliVersion = package_default.version) {
17
+ return parsePrereleaseTag(cliVersion) !== undefined;
18
+ }
19
+ function channelForVersion(version) {
20
+ return parsePrereleaseTag(version) === undefined ? "stable" : versionChannel(version);
21
+ }
22
+ function configChannel() {
23
+ const fileChannel = getCachedConfig().core?.updateChannel;
24
+ if (fileChannel && VALID_CHANNELS.has(fileChannel)) {
25
+ return fileChannel;
26
+ }
27
+ return;
28
+ }
29
+ function versionChannel(cliVersion) {
30
+ const prerelease = parsePrereleaseTag(cliVersion);
31
+ if (prerelease && VALID_CHANNELS.has(prerelease)) {
32
+ return prerelease;
33
+ }
34
+ return;
35
+ }
36
+ function parsePrereleaseTag(version) {
37
+ const dashIdx = version.indexOf("-");
38
+ if (dashIdx === -1)
39
+ return;
40
+ return version.slice(dashIdx + 1).split(".")[0];
41
+ }
42
+
43
+ export { resolveUpdateChannel, resolveRuntimeChannel, isPreviewVersion, channelForVersion };
44
+
45
+ //# debugId=FCA91512C4C316F964756E2164756E21
@@ -0,0 +1,44 @@
1
+ // src/commands/skills/errors.ts
2
+ class SkillSourceError extends Error {
3
+ result = "ValidationError";
4
+ instructions;
5
+ constructor(message, instructions) {
6
+ super(message);
7
+ this.name = "SkillSourceError";
8
+ this.instructions = instructions;
9
+ }
10
+ }
11
+
12
+ class SkillsRegistryAuthError extends Error {
13
+ constructor(message) {
14
+ super(message);
15
+ this.name = "SkillsRegistryAuthError";
16
+ }
17
+ }
18
+ function isSkillsRegistryAuthError(error) {
19
+ return error instanceof SkillsRegistryAuthError || error.name === "SkillsRegistryAuthError";
20
+ }
21
+
22
+ class SkillsPackageMetadataError extends Error {
23
+ constructor(message) {
24
+ super(message);
25
+ this.name = "SkillsPackageMetadataError";
26
+ }
27
+ }
28
+ function isSkillsPackageMetadataError(error) {
29
+ return error instanceof SkillsPackageMetadataError || error.name === "SkillsPackageMetadataError";
30
+ }
31
+
32
+ class SkillsPackOutputError extends Error {
33
+ constructor(message) {
34
+ super(message);
35
+ this.name = "SkillsPackOutputError";
36
+ }
37
+ }
38
+ function isSkillsPackOutputError(error) {
39
+ return error instanceof SkillsPackOutputError || error.name === "SkillsPackOutputError";
40
+ }
41
+
42
+ export { SkillSourceError, SkillsRegistryAuthError, isSkillsRegistryAuthError, SkillsPackageMetadataError, isSkillsPackageMetadataError, SkillsPackOutputError, isSkillsPackOutputError };
43
+
44
+ //# debugId=0C596E198F8E6D8964756E2164756E21
@@ -1,5 +1,3 @@
1
- import"./index-1yh8g550.js";
2
-
3
1
  // ../../node_modules/open/index.js
4
2
  import process7 from "node:process";
5
3
  import path from "node:path";
@@ -548,22 +546,6 @@ var open = (target, options) => {
548
546
  target
549
547
  });
550
548
  };
551
- var openApp = (name, options) => {
552
- if (typeof name !== "string" && !Array.isArray(name)) {
553
- throw new TypeError("Expected a valid `name`");
554
- }
555
- const { arguments: appArguments = [] } = options ?? {};
556
- if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
557
- throw new TypeError("Expected `appArguments` as Array type");
558
- }
559
- return baseOpen({
560
- ...options,
561
- app: {
562
- name,
563
- arguments: appArguments
564
- }
565
- });
566
- };
567
549
  function detectArchBinary(binary) {
568
550
  if (typeof binary === "string" || Array.isArray(binary)) {
569
551
  return binary;
@@ -626,9 +608,7 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
626
608
  }));
627
609
  var open_default = open;
628
610
  export {
629
- apps,
630
- open_default as default,
631
- openApp
611
+ open_default as default
632
612
  };
633
613
 
634
- //# debugId=42C9AEC59ECC644E64756E2164756E21
614
+ //# debugId=6F288C058A3A412164756E2164756E21
@@ -0,0 +1,271 @@
1
+ import {
2
+ catchError,
3
+ logger,
4
+ OUTPUT_FORMATS,
5
+ UIPATH_HOME_DIR,
6
+ CONFIG_FILENAME
7
+ } from "./index-9db5vwx9.js";
8
+ import {
9
+ string,
10
+ array,
11
+ object,
12
+ _enum
13
+ } from "./index-bf0e4evz.js";
14
+
15
+ // src/services/channels.ts
16
+ var CHANNELS = ["stable", "preview", "dev"];
17
+ var VALID_CHANNELS = new Set(CHANNELS);
18
+ var HIDDEN_CHANNELS = ["dev"];
19
+ var PUBLIC_CHANNELS = CHANNELS.filter((channel) => !HIDDEN_CHANNELS.includes(channel));
20
+ var CHANNEL_PLACEHOLDER = `<${PUBLIC_CHANNELS.join("|")}>`;
21
+
22
+ // src/config/configLock.ts
23
+ import { randomUUID } from "node:crypto";
24
+ async function withConfigLock(targetPath, fn) {
25
+ const { getFileSystemAsync } = await import("./index-21kns9qg.js");
26
+ const fs = await getFileSystemAsync();
27
+ const dir = fs.path.dirname(targetPath);
28
+ const [mkdirErr] = await catchError(fs.mkdir(dir));
29
+ if (mkdirErr) {
30
+ throw new Error(`Could not create config directory ${dir}: ${mkdirErr.message}`);
31
+ }
32
+ const release = await fs.acquireLock(targetPath);
33
+ try {
34
+ return await fn();
35
+ } finally {
36
+ await catchError(release());
37
+ }
38
+ }
39
+ async function readConfigFileAt(path) {
40
+ const { getFileSystem } = await import("./index-21kns9qg.js");
41
+ const fs = getFileSystem();
42
+ if (!await fs.exists(path)) {
43
+ return {};
44
+ }
45
+ const content = await fs.readFile(path, "utf-8");
46
+ if (content === null) {
47
+ return {};
48
+ }
49
+ const parsed = JSON.parse(content);
50
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
51
+ return {};
52
+ }
53
+ return parsed;
54
+ }
55
+ async function writeConfigFileAt(path, config) {
56
+ const { getFileSystem } = await import("./index-21kns9qg.js");
57
+ const fs = getFileSystem();
58
+ const dir = fs.path.dirname(path);
59
+ await fs.mkdir(dir);
60
+ const tempPath = `${path}.${randomUUID()}.tmp`;
61
+ await fs.writeFile(tempPath, JSON.stringify(config, null, 4));
62
+ const [renameErr] = await catchError(fs.rename(tempPath, path));
63
+ if (renameErr) {
64
+ await catchError(fs.rm(tempPath));
65
+ throw renameErr;
66
+ }
67
+ }
68
+
69
+ // src/config/loadConfig.ts
70
+ var VERSION_PIN_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
71
+ var ConfigSchema = object({
72
+ core: object({
73
+ output: _enum(OUTPUT_FORMATS).optional(),
74
+ logLevel: _enum(["error", "warn", "info", "debug"]).optional(),
75
+ interactive: _enum(["never", "auto", "always"]).optional(),
76
+ updateChannel: _enum(CHANNELS).optional(),
77
+ version: string().regex(VERSION_PIN_RE, "must be major.minor or major.minor.patch (e.g. 1.2 or 1.2.3)").optional()
78
+ }).optional(),
79
+ auth: object({
80
+ scopes: array(string().min(1)).optional(),
81
+ authority: string().url().optional()
82
+ }).optional()
83
+ });
84
+ var formatZodError = (error) => {
85
+ const issues = error.issues.map((issue) => {
86
+ const path = issue.path.join(".") || "config";
87
+ let message = issue.message;
88
+ if (message.includes("Required")) {
89
+ message = "is required";
90
+ } else if (message.includes("Expected string")) {
91
+ message = "must be a string";
92
+ } else if (message.includes("Invalid url")) {
93
+ message = "must be a valid URL";
94
+ } else if (message.includes("String must contain at least 1 character")) {
95
+ message = "cannot be empty";
96
+ }
97
+ return ` • ${path}: ${message}`;
98
+ });
99
+ return `Configuration validation failed:
100
+ ` + issues.join(`
101
+ `) + `
102
+
103
+ Please check your config file and fix the errors above.`;
104
+ };
105
+
106
+ class ConfigValidationError extends Error {
107
+ constructor(message) {
108
+ super(message);
109
+ this.name = "ConfigValidationError";
110
+ }
111
+ }
112
+ var validateConfig = (parsed) => {
113
+ const result = ConfigSchema.safeParse(parsed);
114
+ if (!result.success) {
115
+ throw new ConfigValidationError(formatZodError(result.error));
116
+ }
117
+ return result.data;
118
+ };
119
+ var CREDENTIAL_AUTH_KEYS = ["clientId", "clientSecret"];
120
+ var LEGACY_TOOLS_KEYS = ["registryUrl", "localToolPaths"];
121
+ var CLEANUP_BLOCKS = [
122
+ ["auth", CREDENTIAL_AUTH_KEYS],
123
+ ["tools", LEGACY_TOOLS_KEYS]
124
+ ];
125
+ var hasKeysIn = (parsed, block, keys) => {
126
+ const blockConfig = parsed?.[block];
127
+ return typeof blockConfig === "object" && blockConfig !== null && keys.some((key) => (key in blockConfig));
128
+ };
129
+ var cachedConfig = null;
130
+ var deleteKeysFrom = async (absolutePath, blocks) => {
131
+ await withConfigLock(absolutePath, async () => {
132
+ const fileConfig = await readConfigFileAt(absolutePath);
133
+ const blocksWithKeys = blocks.filter(([block, keys]) => hasKeysIn(fileConfig, block, keys));
134
+ if (blocksWithKeys.length === 0)
135
+ return;
136
+ for (const [block, keys] of blocksWithKeys) {
137
+ const blockConfig = fileConfig[block];
138
+ for (const key of keys)
139
+ delete blockConfig[key];
140
+ if (Object.keys(blockConfig).length === 0)
141
+ delete fileConfig[block];
142
+ }
143
+ await writeConfigFileAt(absolutePath, fileConfig);
144
+ });
145
+ };
146
+ var cleanUpConfigKeys = async (parsed, absolutePath) => {
147
+ const blocksWithKeys = CLEANUP_BLOCKS.filter(([block, keys]) => hasKeysIn(parsed, block, keys));
148
+ if (blocksWithKeys.length === 0)
149
+ return;
150
+ const [removeErr] = await catchError(deleteKeysFrom(absolutePath, blocksWithKeys));
151
+ if (removeErr) {
152
+ const paths = blocksWithKeys.flatMap(([block, keys]) => keys.map((key) => `${block}.${key}`));
153
+ logger.debug(`Could not remove ${paths.join(" / ")}: ${removeErr.message}`);
154
+ }
155
+ };
156
+ var getCachedConfig = () => cachedConfig ?? {};
157
+ var getFs = async () => {
158
+ const { getFileSystemAsync } = await import("./index-21kns9qg.js");
159
+ return getFileSystemAsync();
160
+ };
161
+ var LOCAL_CONFIG_REL = `${UIPATH_HOME_DIR}/${CONFIG_FILENAME}`;
162
+ var resolveConfigFilePathAsync = async (explicitPath) => {
163
+ const fs = await getFs();
164
+ if (explicitPath !== undefined) {
165
+ const absolutePath = fs.path.resolve(fs.env.cwd(), explicitPath);
166
+ const fileExists = await fs.exists(absolutePath);
167
+ return {
168
+ absolutePath,
169
+ exists: fileExists,
170
+ source: "explicit",
171
+ errorMessage: fileExists ? undefined : `Config file not found: ${absolutePath}`
172
+ };
173
+ }
174
+ const homeDir = fs.env.homedir();
175
+ let searchDir = fs.env.cwd();
176
+ while (searchDir !== homeDir) {
177
+ const candidate = fs.path.join(searchDir, LOCAL_CONFIG_REL);
178
+ if (await fs.exists(candidate)) {
179
+ return { absolutePath: candidate, exists: true, source: "local" };
180
+ }
181
+ const parent = fs.path.dirname(searchDir);
182
+ if (parent === searchDir) {
183
+ break;
184
+ }
185
+ searchDir = parent;
186
+ }
187
+ const globalPath = fs.path.join(homeDir, UIPATH_HOME_DIR, CONFIG_FILENAME);
188
+ if (await fs.exists(globalPath)) {
189
+ return { absolutePath: globalPath, exists: true, source: "global" };
190
+ }
191
+ return { absolutePath: undefined, exists: false, source: "none" };
192
+ };
193
+ var loadConfigAsync = async () => {
194
+ if (cachedConfig) {
195
+ return cachedConfig;
196
+ }
197
+ const fs = await getFs();
198
+ const { absolutePath, exists: fileExists } = await resolveConfigFilePathAsync();
199
+ if (!absolutePath || !fileExists) {
200
+ cachedConfig = {};
201
+ return cachedConfig;
202
+ }
203
+ const [readErr, content] = await catchError(fs.readFile(absolutePath, "utf-8"));
204
+ if (readErr) {
205
+ logger.warn(`Failed to load config from ${absolutePath}:`, readErr.message);
206
+ cachedConfig = {};
207
+ return cachedConfig;
208
+ }
209
+ if (content === null) {
210
+ cachedConfig = {};
211
+ return cachedConfig;
212
+ }
213
+ const [parseErr, parsed] = await catchError(Promise.resolve().then(() => JSON.parse(content)));
214
+ if (parseErr) {
215
+ if (parseErr instanceof SyntaxError) {
216
+ throw new Error(`Invalid JSON in config file: ${absolutePath}
217
+ Error: ${parseErr.message}
218
+
219
+ Please ensure your config file contains valid JSON.`);
220
+ }
221
+ throw parseErr;
222
+ }
223
+ await cleanUpConfigKeys(parsed, absolutePath);
224
+ cachedConfig = validateConfig(parsed);
225
+ return cachedConfig;
226
+ };
227
+
228
+ // src/services/versionPin.ts
229
+ function isValidVersionPin(raw) {
230
+ return VERSION_PIN_RE.test(raw.trim());
231
+ }
232
+ function parseVersionPin(raw) {
233
+ if (raw === undefined)
234
+ return null;
235
+ const match = VERSION_PIN_RE.exec(raw.trim());
236
+ if (!match)
237
+ return null;
238
+ const pin = {
239
+ major: Number(match[1]),
240
+ minor: Number(match[2])
241
+ };
242
+ if (match[3] !== undefined)
243
+ pin.patch = Number(match[3]);
244
+ return pin;
245
+ }
246
+ function majorOf(version) {
247
+ const [rawMajor] = version.trim().split(/[.\-+]/);
248
+ if (rawMajor === undefined || !/^\d+$/.test(rawMajor))
249
+ return null;
250
+ return Number(rawMajor);
251
+ }
252
+ function resolvePinnedVersion() {
253
+ return parseVersionPin(getCachedConfig().core?.version);
254
+ }
255
+ function isExactPin(pin) {
256
+ return pin.patch !== undefined;
257
+ }
258
+ function pinnedPrefix(pin) {
259
+ return `${pin.major}.${pin.minor}.`;
260
+ }
261
+ function versionLinePrefix(version) {
262
+ const [major, minor] = version.split(".");
263
+ return `${major}.${minor}.`;
264
+ }
265
+ function formatVersionPin(pin) {
266
+ return isExactPin(pin) ? `${pin.major}.${pin.minor}.${pin.patch}` : `${pin.major}.${pin.minor}`;
267
+ }
268
+
269
+ export { VALID_CHANNELS, HIDDEN_CHANNELS, PUBLIC_CHANNELS, CHANNEL_PLACEHOLDER, withConfigLock, readConfigFileAt, writeConfigFileAt, getCachedConfig, resolveConfigFilePathAsync, loadConfigAsync, isValidVersionPin, majorOf, resolvePinnedVersion, isExactPin, pinnedPrefix, versionLinePrefix, formatVersionPin };
270
+
271
+ //# debugId=80E9FBD5B9D5F2D564756E2164756E21