@uipath/cli 1.206.0-preview.303 → 1.207.0-preview.305
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/README.md +48 -0
- package/dist/{browser-strategy-p5fhwxqj.js → browser-strategy-5rfwnk5q.js} +1 -1
- package/dist/cli-10857d67.js +28 -0
- package/dist/cliInstaller-3dxg6fbd.js +23 -0
- package/dist/{contentStore-w35jnkxk.js → contentStore-z3t1yt3n.js} +7 -6
- package/dist/{environmentInfo-nz3126q4.js → environmentInfo-dyhpheza.js} +6 -6
- package/dist/{feedbackPrompts-bx209g5v.js → feedbackPrompts-fc66gq0p.js} +3 -3
- package/dist/forcedUpdate-5hd8cp9x.js +21 -0
- package/dist/{handlers-jjwt24f2.js → handlers-rg3d62gb.js} +13 -9
- package/dist/index-2f6vv7yr.js +81 -0
- package/dist/{index-v3vx48v0.js → index-2g332j2f.js} +8 -12
- package/dist/index-319vtrwd.js +264 -0
- package/dist/{index-jqt7p70w.js → index-3vkb4j13.js} +26 -17
- package/dist/index-5j78gm9c.js +41 -0
- package/dist/index-5ygg5mrs.js +1272 -0
- package/dist/{index-99emfvtm.js → index-65pyx6c9.js} +4 -2
- package/dist/{index-rr5hdtcy.js → index-81197qe5.js} +15 -17
- package/dist/{index-2mm750yx.js → index-8n0z4r6f.js} +69 -13
- package/dist/{index-8zhmg5tz.js → index-8pk6n4t9.js} +2 -2
- package/dist/{index-cef72dzy.js → index-9v7334md.js} +1 -1
- package/dist/{index-nsrrst23.js → index-ack311y7.js} +12 -2
- package/dist/{index-2n2vr5w5.js → index-dt6mjnkf.js} +39 -57
- package/dist/{index-y7d0cth0.js → index-e82sznr2.js} +7 -7
- package/dist/index-ej6eeger.js +23 -0
- package/dist/index-evcsjfyy.js +248 -0
- package/dist/{index-bxc30q35.js → index-gk5pc8xr.js} +2 -2
- package/dist/{index-7q9kcs3w.js → index-h2ctqv68.js} +14 -5
- package/dist/index-jk7em40j.js +37 -0
- package/dist/{index-vhn8f5d2.js → index-kdr4xvby.js} +5 -5
- package/dist/{index-y7j0ant5.js → index-kmacaa53.js} +2130 -834
- package/dist/{index-ckp8r4dh.js → index-mb62swmp.js} +2 -2
- package/dist/{index-dxfqvgqg.js → index-md27nny8.js} +7 -10
- package/dist/{index-85fa5z1t.js → index-nex3q8cg.js} +2 -2
- package/dist/index-nyx7fh45.js +331 -0
- package/dist/index-nzfpbep9.js +14 -0
- package/dist/{index-z070caqq.js → index-p64w2wrt.js} +30 -8
- package/dist/{index-0pan2k7w.js → index-t6hrzpm7.js} +30 -14
- package/dist/index-v7yphxb8.js +118 -0
- package/dist/index-vrfbee4d.js +340 -0
- package/dist/{index-69mcde3n.js → index-xw81b1gn.js} +196 -81
- package/dist/{index-wg3cne7n.js → index-xxms6rt8.js} +24 -5
- package/dist/{index-21kns9qg.js → index-y7v9rkq9.js} +1 -1
- package/dist/{index-6wzpac34.js → index-z3q16ts7.js} +81 -58
- package/dist/{index-fdztq951.js → index-zhp702kh.js} +393 -82
- package/dist/index.js +23 -18
- package/dist/{install-kgcwdbqs.js → install-h76qyy1e.js} +6 -7
- package/dist/{node-strategy-p1n8wr5s.js → node-strategy-9t0ttffv.js} +2 -2
- package/dist/{project-context-caht70an.js → project-context-rc4ghykm.js} +13 -5
- package/dist/{prompt-tvxwpvxh.js → prompt-66bnttv7.js} +5 -5
- package/dist/{server-pge2gheb.js → server-pxfn9w9m.js} +5 -5
- package/dist/{skillCatalog-b3z68z4n.js → skillCatalog-7gh14b4s.js} +8 -7
- package/dist/skillsService-wz3c21qb.js +35 -0
- package/dist/{telemetry-drain-rt346cfz.js → telemetry-drain-8qr5tzmf.js} +2 -2
- package/dist/tree-fk9gwh4v.js +16 -0
- package/dist/updateService-ybs9274t.js +377 -0
- package/dist/updateService.cli-xtqp78g7.js +15 -0
- package/dist/updateService.skills-pgst1fyj.js +27 -0
- package/dist/updateService.tools-m58m2fbt.js +19 -0
- package/package.json +2 -2
- package/dist/cli-0p8c9t5r.js +0 -23
- package/dist/index-1n5v3afn.js +0 -45
- package/dist/index-3qp7d08f.js +0 -240
- package/dist/index-3zf0ywpb.js +0 -95
- package/dist/index-753mncpq.js +0 -271
- package/dist/skillsService-qzzqacmg.js +0 -29
- package/dist/tree-4dhk82fh.js +0 -17
- package/dist/updateService-b579ys6m.js +0 -522
- package/dist/updateService.skills-teejc562.js +0 -22
- package/dist/updateService.tools-3zfct9yk.js +0 -16
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getFileSystem2
|
|
3
|
-
} from "./index-z070caqq.js";
|
|
4
|
-
import {
|
|
5
|
-
catchError,
|
|
6
|
-
logger
|
|
7
|
-
} from "./index-fdztq951.js";
|
|
8
|
-
import {
|
|
9
|
-
majorOf,
|
|
10
|
-
pinnedPrefix,
|
|
11
|
-
versionLinePrefix,
|
|
12
|
-
formatVersionPin
|
|
13
|
-
} from "./index-753mncpq.js";
|
|
14
|
-
import {
|
|
15
|
-
getGlobalNpmUipathDir,
|
|
16
|
-
compareSemver,
|
|
17
|
-
validatePackageSpec,
|
|
18
|
-
isNpmViewMetadataError,
|
|
19
|
-
getEffectiveRegistry,
|
|
20
|
-
isPermissionError,
|
|
21
|
-
toolService
|
|
22
|
-
} from "./index-69mcde3n.js";
|
|
23
|
-
import {
|
|
24
|
-
withSystemCaEnv
|
|
25
|
-
} from "./index-3zf0ywpb.js";
|
|
26
|
-
import {
|
|
27
|
-
pinnedLineRemediation,
|
|
28
|
-
toolFailureRemediation,
|
|
29
|
-
describeMissingLine,
|
|
30
|
-
describeDowngradeReason
|
|
31
|
-
} from "./index-2n2vr5w5.js";
|
|
32
|
-
import"./index-5gce5wfd.js";
|
|
33
|
-
import"./index-6wzpac34.js";
|
|
34
|
-
import"./index-v3vx48v0.js";
|
|
35
|
-
import"./index-5j0bfd3e.js";
|
|
36
|
-
import"./index-cef72dzy.js";
|
|
37
|
-
import"./index-dxfqvgqg.js";
|
|
38
|
-
import"./index-jqt7p70w.js";
|
|
39
|
-
import {
|
|
40
|
-
runSkillsUpdate2
|
|
41
|
-
} from "./index-0pan2k7w.js";
|
|
42
|
-
import {
|
|
43
|
-
TOOLS_UPDATE_PHASES2,
|
|
44
|
-
runToolsUpdate2
|
|
45
|
-
} from "./index-3qp7d08f.js";
|
|
46
|
-
import {
|
|
47
|
-
channelForVersion
|
|
48
|
-
} from "./index-1n5v3afn.js";
|
|
49
|
-
import"./index-wg3cne7n.js";
|
|
50
|
-
import"./index-ckp8r4dh.js";
|
|
51
|
-
|
|
52
|
-
// src/services/cliInstaller.ts
|
|
53
|
-
import { fileURLToPath } from "node:url";
|
|
54
|
-
function detectCliInstallContext(execPath) {
|
|
55
|
-
const exe = (execPath ?? fileURLToPath(import.meta.url)).replace(/\\/g, "/");
|
|
56
|
-
const brew = /\/Cellar\/([^/]+)\/[^/]+\//.exec(exe);
|
|
57
|
-
if (brew)
|
|
58
|
-
return { kind: "brew", formula: brew[1] };
|
|
59
|
-
if (exe.includes("/install/global/node_modules/@uipath/cli/")) {
|
|
60
|
-
return { kind: "bun", global: true };
|
|
61
|
-
}
|
|
62
|
-
if (exe.includes("/node_modules/@uipath/cli/") && (exe.includes("/pnpm/global/") || exe.includes("/pnpm-global/"))) {
|
|
63
|
-
return { kind: "pnpm", global: true };
|
|
64
|
-
}
|
|
65
|
-
if (exe.includes("/node_modules/@uipath/cli/") && exe.includes("/.pnpm/")) {
|
|
66
|
-
return { kind: "pnpm", global: false };
|
|
67
|
-
}
|
|
68
|
-
if (exe.includes("/node_modules/@uipath/cli/"))
|
|
69
|
-
return { kind: "npm" };
|
|
70
|
-
return { kind: "unknown" };
|
|
71
|
-
}
|
|
72
|
-
function describeUpdateCommand(target, ctx, global) {
|
|
73
|
-
switch (ctx.kind) {
|
|
74
|
-
case "brew":
|
|
75
|
-
return `brew upgrade ${ctx.formula}`;
|
|
76
|
-
case "bun":
|
|
77
|
-
return isGlobalPackageManagerInstall(ctx, global) ? `bun add -g ${target}` : `bun add ${target}`;
|
|
78
|
-
case "pnpm":
|
|
79
|
-
return isGlobalPackageManagerInstall(ctx, global) ? `pnpm add -g ${target}` : `pnpm add ${target}`;
|
|
80
|
-
case "npm":
|
|
81
|
-
return global !== false ? `npm install -g ${target}` : `npm install ${target}`;
|
|
82
|
-
case "unknown":
|
|
83
|
-
return `npm install -g ${target}`;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async function resolveUpdateCommand(target, ctx, installPath, global) {
|
|
87
|
-
if (ctx.kind === "npm" && global === false && await isBunProject(installPath)) {
|
|
88
|
-
return describeUpdateCommand(target, { kind: "bun", global: false });
|
|
89
|
-
}
|
|
90
|
-
return describeUpdateCommand(target, ctx, global);
|
|
91
|
-
}
|
|
92
|
-
async function detectShadowedCliInstall(global, installPath, runningVersion, installCtx, execPath) {
|
|
93
|
-
const fs = getFileSystem2();
|
|
94
|
-
const normalize = (p) => {
|
|
95
|
-
let forward = p.replace(/\\/g, "/");
|
|
96
|
-
let end = forward.length;
|
|
97
|
-
while (end > 0 && forward[end - 1] === "/")
|
|
98
|
-
end--;
|
|
99
|
-
forward = forward.slice(0, end);
|
|
100
|
-
return process.platform === "win32" ? forward.toLowerCase() : forward;
|
|
101
|
-
};
|
|
102
|
-
let packageDir;
|
|
103
|
-
if (global) {
|
|
104
|
-
if (installCtx.kind !== "npm" && installCtx.kind !== "unknown") {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
const uipathDir = await getGlobalNpmUipathDir();
|
|
108
|
-
if (!uipathDir)
|
|
109
|
-
return null;
|
|
110
|
-
packageDir = fs.path.join(uipathDir, "cli");
|
|
111
|
-
} else {
|
|
112
|
-
packageDir = fs.path.join(installPath, "node_modules", "@uipath", "cli");
|
|
113
|
-
}
|
|
114
|
-
const [readErr, raw] = await catchError(fs.readFile(fs.path.join(packageDir, "package.json"), {
|
|
115
|
-
encoding: "utf-8"
|
|
116
|
-
}));
|
|
117
|
-
if (readErr || !raw)
|
|
118
|
-
return null;
|
|
119
|
-
const [parseErr, parsed] = catchError(() => JSON.parse(raw));
|
|
120
|
-
if (parseErr || typeof parsed?.version !== "string" || !parsed.version) {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
if (parsed.version === runningVersion)
|
|
124
|
-
return null;
|
|
125
|
-
const exe = normalize(execPath ?? fileURLToPath(import.meta.url));
|
|
126
|
-
const normalizedPackageDir = normalize(packageDir);
|
|
127
|
-
if (exe.startsWith(`${normalizedPackageDir}/`))
|
|
128
|
-
return null;
|
|
129
|
-
if (!global && installCtx.kind === "pnpm" && exe.startsWith(`${normalize(installPath)}/node_modules/.pnpm/`) && exe.includes("/node_modules/@uipath/cli/")) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
return { installedVersion: parsed.version, packageDir };
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
class CliSelfUpdateError extends Error {
|
|
136
|
-
originalError;
|
|
137
|
-
manualCommand;
|
|
138
|
-
constructor(originalError, manualCommand) {
|
|
139
|
-
super(originalError instanceof Error ? originalError.message : String(originalError));
|
|
140
|
-
this.name = "CliSelfUpdateError";
|
|
141
|
-
this.originalError = originalError;
|
|
142
|
-
this.manualCommand = manualCommand;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async function runCliSelfUpdate(target, ctx, installPath, global) {
|
|
146
|
-
switch (ctx.kind) {
|
|
147
|
-
case "brew":
|
|
148
|
-
await spawnBrewUpgrade(ctx.formula);
|
|
149
|
-
return;
|
|
150
|
-
case "bun":
|
|
151
|
-
await spawnPackageManagerAdd("bun", target, installPath, ctx.global || global);
|
|
152
|
-
return;
|
|
153
|
-
case "pnpm":
|
|
154
|
-
await spawnPackageManagerAdd("pnpm", target, installPath, ctx.global || global);
|
|
155
|
-
return;
|
|
156
|
-
case "npm":
|
|
157
|
-
if (!global && await isBunProject(installPath)) {
|
|
158
|
-
await runWithManualCommand(spawnPackageManagerAdd("bun", target, installPath, false), describeUpdateCommand(target, {
|
|
159
|
-
kind: "bun",
|
|
160
|
-
global: false
|
|
161
|
-
}));
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
await toolService.install(target, installPath, { global });
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async function runWithManualCommand(operation, manualCommand) {
|
|
169
|
-
const [error] = await catchError(operation);
|
|
170
|
-
if (error)
|
|
171
|
-
throw new CliSelfUpdateError(error, manualCommand);
|
|
172
|
-
}
|
|
173
|
-
function isGlobalPackageManagerInstall(ctx, global) {
|
|
174
|
-
return ctx.global || global === true;
|
|
175
|
-
}
|
|
176
|
-
var SAFE_BREW_ARG = /^[a-z0-9_@.-]+(\/[a-z0-9_@.-]+){0,2}$/;
|
|
177
|
-
var SAFE_PACKAGE_MANAGER = /^(bun|pnpm)$/;
|
|
178
|
-
var SHELL_SAFE_ARG = /^[a-zA-Z0-9@/._-]+$/;
|
|
179
|
-
var SHELL_SAFE_COMMAND_LINE = /^[a-zA-Z0-9@/._\- ]+$/;
|
|
180
|
-
var BREW_TIMEOUT_MS = 5 * 60 * 1000;
|
|
181
|
-
var PACKAGE_MANAGER_TIMEOUT_MS = 5 * 60 * 1000;
|
|
182
|
-
async function spawnBrewUpgrade(formula) {
|
|
183
|
-
if (!SAFE_BREW_ARG.test(formula)) {
|
|
184
|
-
throw new Error(`Invalid brew formula name: '${formula}'`);
|
|
185
|
-
}
|
|
186
|
-
await spawnSelfUpdateCommand({
|
|
187
|
-
executable: "brew",
|
|
188
|
-
args: ["upgrade", formula],
|
|
189
|
-
label: "brew upgrade",
|
|
190
|
-
timeoutMs: BREW_TIMEOUT_MS
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
async function spawnPackageManagerAdd(packageManager, target, installPath, global) {
|
|
194
|
-
if (!SAFE_PACKAGE_MANAGER.test(packageManager)) {
|
|
195
|
-
throw new Error(`Invalid package manager: '${packageManager}'`);
|
|
196
|
-
}
|
|
197
|
-
validatePackageSpec(target);
|
|
198
|
-
const args = global ? ["add", "-g", target] : ["add", target];
|
|
199
|
-
for (const arg of [packageManager, ...args]) {
|
|
200
|
-
if (!SHELL_SAFE_ARG.test(arg)) {
|
|
201
|
-
throw new Error(`Unsafe package manager argument: '${arg}'`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
await spawnSelfUpdateCommand({
|
|
205
|
-
executable: packageManager,
|
|
206
|
-
args,
|
|
207
|
-
cwd: installPath,
|
|
208
|
-
label: `${packageManager} add`,
|
|
209
|
-
shellOnWindows: true,
|
|
210
|
-
timeoutMs: PACKAGE_MANAGER_TIMEOUT_MS
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
async function isBunProject(installPath) {
|
|
214
|
-
const { getFileSystem } = await import("./index-21kns9qg.js");
|
|
215
|
-
const fs = getFileSystem();
|
|
216
|
-
const bunLock = fs.path.join(installPath, "bun.lock");
|
|
217
|
-
const bunLockb = fs.path.join(installPath, "bun.lockb");
|
|
218
|
-
return await fs.exists(bunLock) || await fs.exists(bunLockb);
|
|
219
|
-
}
|
|
220
|
-
async function spawnSelfUpdateCommand({
|
|
221
|
-
executable,
|
|
222
|
-
args,
|
|
223
|
-
label,
|
|
224
|
-
timeoutMs,
|
|
225
|
-
cwd,
|
|
226
|
-
shellOnWindows = false
|
|
227
|
-
}) {
|
|
228
|
-
const { spawn } = await import("node:child_process");
|
|
229
|
-
logger.debug(`Running: ${executable} ${args.join(" ")}`);
|
|
230
|
-
return new Promise((resolve, reject) => {
|
|
231
|
-
let proc;
|
|
232
|
-
if (shellOnWindows && process.platform === "win32") {
|
|
233
|
-
const commandLine = [executable, ...args].join(" ");
|
|
234
|
-
if (!SHELL_SAFE_COMMAND_LINE.test(commandLine)) {
|
|
235
|
-
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
proc = spawn(commandLine, [], {
|
|
239
|
-
cwd,
|
|
240
|
-
env: withSystemCaEnv(),
|
|
241
|
-
shell: true,
|
|
242
|
-
stdio: ["inherit", "pipe", "pipe"]
|
|
243
|
-
});
|
|
244
|
-
} else {
|
|
245
|
-
proc = spawn(executable, args, {
|
|
246
|
-
cwd,
|
|
247
|
-
env: withSystemCaEnv(),
|
|
248
|
-
stdio: ["inherit", "pipe", "pipe"]
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
let stderr = "";
|
|
252
|
-
const MAX_STDERR = 65536;
|
|
253
|
-
proc.stdout?.on("data", (d) => {
|
|
254
|
-
logger.info(d.toString().trimEnd());
|
|
255
|
-
});
|
|
256
|
-
proc.stderr?.on("data", (d) => {
|
|
257
|
-
if (stderr.length < MAX_STDERR)
|
|
258
|
-
stderr += d.toString();
|
|
259
|
-
});
|
|
260
|
-
const timer = setTimeout(() => {
|
|
261
|
-
proc.kill("SIGTERM");
|
|
262
|
-
reject(new Error(`${label} timed out after ${timeoutMs / 1000}s`));
|
|
263
|
-
}, timeoutMs);
|
|
264
|
-
proc.on("error", (err) => {
|
|
265
|
-
clearTimeout(timer);
|
|
266
|
-
reject(err);
|
|
267
|
-
});
|
|
268
|
-
proc.on("close", (code) => {
|
|
269
|
-
clearTimeout(timer);
|
|
270
|
-
code === 0 ? resolve() : reject(new Error(stderr.trim() || `${label} failed with code ${code}`));
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// src/services/updateService.cli.ts
|
|
276
|
-
var CLI_VERSION_PROBE_TIMEOUT_MS = 20000;
|
|
277
|
-
async function checkCliVersion(opts) {
|
|
278
|
-
if (opts.isDev) {
|
|
279
|
-
return skipped(opts.cliPkgVersion, "dev mode");
|
|
280
|
-
}
|
|
281
|
-
const pin = opts.pin ?? null;
|
|
282
|
-
const [err, latest] = await catchError(toolService.searchLatestVersion("@uipath/cli", pin ? pinnedPrefix(pin) : undefined, {
|
|
283
|
-
channel: opts.channel,
|
|
284
|
-
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
285
|
-
}));
|
|
286
|
-
if (err) {
|
|
287
|
-
logger.debug(`CLI version probe failed: ${err.message}`);
|
|
288
|
-
return skipped(opts.cliPkgVersion, isNpmViewMetadataError(err) ? err.message : "network error");
|
|
289
|
-
}
|
|
290
|
-
if (!latest) {
|
|
291
|
-
if (pin) {
|
|
292
|
-
const searched = await getEffectiveRegistry("@uipath/cli");
|
|
293
|
-
return {
|
|
294
|
-
current: opts.cliPkgVersion,
|
|
295
|
-
available: null,
|
|
296
|
-
action: "failed",
|
|
297
|
-
reason: describeMissingLine({
|
|
298
|
-
pin,
|
|
299
|
-
origin: opts.pinOrigin,
|
|
300
|
-
targetLine: `${pinnedPrefix(pin)}x`,
|
|
301
|
-
searched
|
|
302
|
-
}),
|
|
303
|
-
...searched ? { searchedRegistry: searched } : {}
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
return skipped(opts.cliPkgVersion, `no ${opts.channel} version found`);
|
|
307
|
-
}
|
|
308
|
-
if (!pin && exceedsMajorCeiling(latest, opts.maxMajor)) {
|
|
309
|
-
return {
|
|
310
|
-
current: opts.cliPkgVersion,
|
|
311
|
-
available: latest,
|
|
312
|
-
action: "none",
|
|
313
|
-
reason: null,
|
|
314
|
-
heldBackVersion: latest
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
const differs = pin ? compareSemver(latest, opts.cliPkgVersion) !== 0 : compareSemver(latest, opts.cliPkgVersion) > 0;
|
|
318
|
-
if (differs) {
|
|
319
|
-
return {
|
|
320
|
-
current: opts.cliPkgVersion,
|
|
321
|
-
available: latest,
|
|
322
|
-
action: "notice",
|
|
323
|
-
reason: null
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
return {
|
|
327
|
-
current: opts.cliPkgVersion,
|
|
328
|
-
available: latest,
|
|
329
|
-
action: "none",
|
|
330
|
-
reason: null
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
function exceedsMajorCeiling(version, maxMajor) {
|
|
334
|
-
if (maxMajor === undefined)
|
|
335
|
-
return false;
|
|
336
|
-
const major = majorOf(version);
|
|
337
|
-
return major !== null && major > maxMajor;
|
|
338
|
-
}
|
|
339
|
-
function skipped(current, reason) {
|
|
340
|
-
return { current, available: null, action: "skipped", reason };
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// src/services/updateService.ts
|
|
344
|
-
async function runUpdate(options, state, cliEnv) {
|
|
345
|
-
const { sections, channel, dryRun } = options;
|
|
346
|
-
const errors = [];
|
|
347
|
-
const onProgress = options.onProgress;
|
|
348
|
-
const selfUpdate = options.cli?.self !== false;
|
|
349
|
-
let detectedInstallCtx = null;
|
|
350
|
-
const getDetectedInstallCtx = () => {
|
|
351
|
-
detectedInstallCtx ??= detectCliInstallContext();
|
|
352
|
-
return detectedInstallCtx;
|
|
353
|
-
};
|
|
354
|
-
if (sections.cli)
|
|
355
|
-
onProgress?.("Checking the CLI version…");
|
|
356
|
-
let cliReport = sections.cli ? await checkCliVersion({
|
|
357
|
-
channel,
|
|
358
|
-
cliPkgVersion: cliEnv.cliPkgVersion,
|
|
359
|
-
isDev: cliEnv.isDev,
|
|
360
|
-
pin: options.versionPin ?? null,
|
|
361
|
-
pinOrigin: options.versionPinOrigin,
|
|
362
|
-
maxMajor: options.maxMajor
|
|
363
|
-
}) : null;
|
|
364
|
-
if (cliReport?.action === "notice" && cliReport.available) {
|
|
365
|
-
const installCtx = getDetectedInstallCtx();
|
|
366
|
-
const target = `@uipath/cli@${cliReport.available}`;
|
|
367
|
-
const global = !cliEnv.isLocal;
|
|
368
|
-
const manualCommand = await resolveUpdateCommand(target, installCtx, cliEnv.installPath, global);
|
|
369
|
-
if (dryRun || !selfUpdate || installCtx.kind === "unknown") {
|
|
370
|
-
cliReport = { ...cliReport, manualCommand };
|
|
371
|
-
}
|
|
372
|
-
if (installCtx.kind !== "unknown") {
|
|
373
|
-
const noticeReport = cliReport;
|
|
374
|
-
const available = noticeReport.available;
|
|
375
|
-
if (!dryRun && selfUpdate) {
|
|
376
|
-
const pin = options.versionPin ?? null;
|
|
377
|
-
if (pin && compareSemver(available, noticeReport.current) < 0) {
|
|
378
|
-
logger.info(`Downgrading @uipath/cli ${noticeReport.current} → ${available} to match ${describeDowngradeReason(options.versionPinOrigin)}.`);
|
|
379
|
-
}
|
|
380
|
-
onProgress?.(`Updating @uipath/cli to ${available}…`);
|
|
381
|
-
const [installErr] = await catchError(runCliSelfUpdate(target, installCtx, cliEnv.installPath, global));
|
|
382
|
-
if (installErr) {
|
|
383
|
-
const isWindows = process.platform === "win32";
|
|
384
|
-
const instructions = isPermissionError(installErr) ? isWindows ? "Re-run from an elevated terminal (right-click → Run as administrator): uip update" : "Re-run with elevated permissions, e.g. sudo uip update" : `Run manually: ${getManualCommandForInstallError(installErr, manualCommand)}`;
|
|
385
|
-
errors.push({
|
|
386
|
-
Subsystem: "cli",
|
|
387
|
-
Result: "Failure",
|
|
388
|
-
Message: `Failed to self-update @uipath/cli to ${available}: ${installErr.message}`,
|
|
389
|
-
Instructions: instructions
|
|
390
|
-
});
|
|
391
|
-
cliReport = { ...noticeReport, action: "failed" };
|
|
392
|
-
} else {
|
|
393
|
-
cliReport = { ...noticeReport, action: "updated" };
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
if (cliReport?.action === "failed" && cliReport.available === null) {
|
|
399
|
-
errors.push({
|
|
400
|
-
Subsystem: "cli",
|
|
401
|
-
Result: "Failure",
|
|
402
|
-
Message: cliReport.reason ?? "Failed to resolve the pinned @uipath/cli version.",
|
|
403
|
-
Instructions: pinnedLineRemediation(options.versionPinOrigin),
|
|
404
|
-
Kind: "pinned-line-missing",
|
|
405
|
-
Registry: cliReport.searchedRegistry
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
if (sections.cli && !cliEnv.isDev) {
|
|
409
|
-
const installCtx = getDetectedInstallCtx();
|
|
410
|
-
const shadow = await detectShadowedCliInstall(!cliEnv.isLocal, cliEnv.installPath, cliEnv.cliPkgVersion, installCtx);
|
|
411
|
-
if (shadow) {
|
|
412
|
-
logger.warn(`@uipath/cli ${shadow.installedVersion} is installed at ${shadow.packageDir}, ` + `but this process is running ${cliEnv.cliPkgVersion} from a different install. ` + "Your PATH may resolve an outdated copy — check `which uip` (Windows: `where uip`) " + "and update or remove the copy it points to.");
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
const settledCliVersion = resolveSettledCliVersion(cliReport, dryRun, selfUpdate, getDetectedInstallCtx);
|
|
416
|
-
const toolsChannel = (settledCliVersion ? channelForVersion(settledCliVersion) : undefined) ?? options.tools.channel ?? channel;
|
|
417
|
-
const toolsLinePrefix = settledCliVersion ? versionLinePrefix(settledCliVersion) : undefined;
|
|
418
|
-
let toolsReport = sections.tools ? await runToolsUpdate2({
|
|
419
|
-
dryRun,
|
|
420
|
-
channel: toolsChannel,
|
|
421
|
-
cliVersionPrefix: toolsLinePrefix,
|
|
422
|
-
name: options.tools.name,
|
|
423
|
-
pin: options.versionPin ?? null,
|
|
424
|
-
pinOrigin: options.versionPinOrigin,
|
|
425
|
-
onProgress: onProgress ? ({ current, total, tool, phase }) => {
|
|
426
|
-
const verb = phase === TOOLS_UPDATE_PHASES2.Checking ? "Checking" : "Installing";
|
|
427
|
-
onProgress(`[${current}/${total}] ${verb} ${tool}`);
|
|
428
|
-
} : undefined
|
|
429
|
-
}, state) : null;
|
|
430
|
-
if (toolsReport?.fatal?.code === "NO_TOOLS_INSTALLED") {
|
|
431
|
-
toolsReport = { entries: [] };
|
|
432
|
-
}
|
|
433
|
-
if (toolsReport?.fatal) {
|
|
434
|
-
errors.push({
|
|
435
|
-
Subsystem: "tools",
|
|
436
|
-
Result: toolsReport.fatal.result,
|
|
437
|
-
Message: toolsReport.fatal.message,
|
|
438
|
-
Instructions: toolsReport.fatal.instructions
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
if (toolsReport) {
|
|
442
|
-
for (const entry of toolsReport.entries) {
|
|
443
|
-
if (entry.status === "failed") {
|
|
444
|
-
errors.push({
|
|
445
|
-
Subsystem: "tools",
|
|
446
|
-
Result: "Failure",
|
|
447
|
-
Message: `Failed to update ${entry.name}: ${entry.error ?? "unknown error"}`,
|
|
448
|
-
Instructions: entry.errorKind === "pinned-line-missing" ? pinnedLineRemediation(options.versionPinOrigin) : toolFailureRemediation(options.versionPinOrigin),
|
|
449
|
-
Kind: entry.errorKind,
|
|
450
|
-
Registry: entry.searchedRegistry
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
const targetVersion = resolveSkillsCliTarget(cliReport, dryRun, selfUpdate, cliEnv.cliPkgVersion, options.versionPin ?? null, getDetectedInstallCtx);
|
|
456
|
-
if (sections.skills)
|
|
457
|
-
onProgress?.("Refreshing skills…");
|
|
458
|
-
const skillsReport = sections.skills ? await runSkillsUpdate2({
|
|
459
|
-
dryRun,
|
|
460
|
-
agent: options.skills.agent,
|
|
461
|
-
local: options.skills.local,
|
|
462
|
-
targetVersion
|
|
463
|
-
}) : null;
|
|
464
|
-
if (skillsReport) {
|
|
465
|
-
for (const s of skillsReport.sections) {
|
|
466
|
-
if (s.error) {
|
|
467
|
-
errors.push({
|
|
468
|
-
Subsystem: "skills",
|
|
469
|
-
Scope: s.scope,
|
|
470
|
-
Result: s.error.result,
|
|
471
|
-
Message: s.error.message,
|
|
472
|
-
Instructions: s.error.instructions
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
const toolsFailed = !!toolsReport && (!!toolsReport.fatal || toolsReport.entries.some((e) => e.status === "failed"));
|
|
478
|
-
const skillsFailed = !!skillsReport && skillsReport.sections.some((s) => !!s.error);
|
|
479
|
-
const cliFailed = cliReport?.action === "failed";
|
|
480
|
-
const toolsPayload = toolsReport && !toolsReport.fatal ? toolsReport.entries : null;
|
|
481
|
-
return {
|
|
482
|
-
DryRun: dryRun,
|
|
483
|
-
Channel: channel,
|
|
484
|
-
Cli: cliReport,
|
|
485
|
-
Tools: toolsPayload,
|
|
486
|
-
Skills: skillsReport ? { Sections: skillsReport.sections } : null,
|
|
487
|
-
Errors: errors,
|
|
488
|
-
HasFailures: toolsFailed || skillsFailed || cliFailed
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
function resolveSkillsCliTarget(cliReport, dryRun, selfUpdate, fallbackVersion, pin, getInstallCtx) {
|
|
492
|
-
if (cliReport?.action === "failed") {
|
|
493
|
-
return cliReport.current ?? fallbackVersion;
|
|
494
|
-
}
|
|
495
|
-
if (cliReport?.action === "updated") {
|
|
496
|
-
return cliReport.available ?? fallbackVersion;
|
|
497
|
-
}
|
|
498
|
-
if (dryRun && selfUpdate && cliReport?.action === "notice" && getInstallCtx().kind !== "unknown") {
|
|
499
|
-
return cliReport.available ?? fallbackVersion;
|
|
500
|
-
}
|
|
501
|
-
if (pin) {
|
|
502
|
-
return cliReport?.available ?? formatVersionPin(pin);
|
|
503
|
-
}
|
|
504
|
-
return cliReport?.current ?? fallbackVersion;
|
|
505
|
-
}
|
|
506
|
-
function resolveSettledCliVersion(cliReport, dryRun, selfUpdate, getInstallCtx) {
|
|
507
|
-
if (cliReport?.action === "updated") {
|
|
508
|
-
return cliReport.available ?? null;
|
|
509
|
-
}
|
|
510
|
-
if (dryRun && selfUpdate && cliReport?.action === "notice" && getInstallCtx().kind !== "unknown") {
|
|
511
|
-
return cliReport.available ?? null;
|
|
512
|
-
}
|
|
513
|
-
return null;
|
|
514
|
-
}
|
|
515
|
-
function getManualCommandForInstallError(error, fallback) {
|
|
516
|
-
return error instanceof CliSelfUpdateError ? error.manualCommand : fallback;
|
|
517
|
-
}
|
|
518
|
-
export {
|
|
519
|
-
runUpdate
|
|
520
|
-
};
|
|
521
|
-
|
|
522
|
-
//# debugId=781B7BE67C9B2C3364756E2164756E21
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runSkillsUpdate2
|
|
3
|
-
} from "./index-0pan2k7w.js";
|
|
4
|
-
import"./index-jqt7p70w.js";
|
|
5
|
-
import"./index-cef72dzy.js";
|
|
6
|
-
import"./index-dxfqvgqg.js";
|
|
7
|
-
import"./index-6wzpac34.js";
|
|
8
|
-
import"./index-5j0bfd3e.js";
|
|
9
|
-
import"./index-wg3cne7n.js";
|
|
10
|
-
import"./index-v3vx48v0.js";
|
|
11
|
-
import"./index-753mncpq.js";
|
|
12
|
-
import"./index-ckp8r4dh.js";
|
|
13
|
-
import"./index-69mcde3n.js";
|
|
14
|
-
import"./index-3zf0ywpb.js";
|
|
15
|
-
import"./index-fdztq951.js";
|
|
16
|
-
import"./index-5gce5wfd.js";
|
|
17
|
-
import"./index-z070caqq.js";
|
|
18
|
-
export {
|
|
19
|
-
runSkillsUpdate2 as runSkillsUpdate
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
//# debugId=BDA76D69421D256364756E2164756E21
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TOOLS_UPDATE_PHASES2,
|
|
3
|
-
runToolsUpdate2
|
|
4
|
-
} from "./index-3qp7d08f.js";
|
|
5
|
-
import"./index-2n2vr5w5.js";
|
|
6
|
-
import"./index-753mncpq.js";
|
|
7
|
-
import"./index-69mcde3n.js";
|
|
8
|
-
import"./index-3zf0ywpb.js";
|
|
9
|
-
import"./index-fdztq951.js";
|
|
10
|
-
import"./index-z070caqq.js";
|
|
11
|
-
export {
|
|
12
|
-
TOOLS_UPDATE_PHASES2 as TOOLS_UPDATE_PHASES,
|
|
13
|
-
runToolsUpdate2 as runToolsUpdate
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
//# debugId=CC2B285A25A29F1464756E2164756E21
|