@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,92 @@
1
+ import {
2
+ getFileSystem2
3
+ } from "./index-z070caqq.js";
4
+ import {
5
+ catchError
6
+ } from "./index-9db5vwx9.js";
7
+
8
+ // src/commands/skills/agents/detect.ts
9
+ import { spawn } from "node:child_process";
10
+ var VERSION_TIMEOUT_MS = 5000;
11
+ function windowsExts() {
12
+ const fs = getFileSystem2();
13
+ const raw = fs.env.getenv("PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
14
+ return raw.split(";").map((e) => e.trim().toLowerCase()).filter(Boolean);
15
+ }
16
+ async function commandOnPath(...names) {
17
+ const isWin = process.platform === "win32";
18
+ const fs = getFileSystem2();
19
+ const pathVar = fs.env.getenv("PATH") ?? "";
20
+ if (!pathVar)
21
+ return false;
22
+ const dirs = pathVar.split(isWin ? ";" : ":").filter(Boolean);
23
+ const exts = isWin ? ["", ...windowsExts()] : [""];
24
+ for (const dir of dirs) {
25
+ for (const name of names) {
26
+ for (const ext of exts) {
27
+ const candidate = fs.path.join(dir, `${name}${ext}`);
28
+ const [, exists] = await catchError(fs.exists(candidate));
29
+ if (exists)
30
+ return true;
31
+ }
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+ function runVersion(command, args, timeoutMs = VERSION_TIMEOUT_MS) {
37
+ return new Promise((resolve) => {
38
+ const proc = process.platform === "win32" ? spawn([command, ...args].join(" "), [], {
39
+ stdio: ["ignore", "pipe", "pipe"],
40
+ shell: true
41
+ }) : spawn(command, [...args], {
42
+ stdio: ["ignore", "pipe", "pipe"]
43
+ });
44
+ let out = "";
45
+ let settled = false;
46
+ const finish = (value) => {
47
+ if (settled)
48
+ return;
49
+ settled = true;
50
+ clearTimeout(timer);
51
+ resolve(value);
52
+ };
53
+ const timer = setTimeout(() => {
54
+ proc.kill();
55
+ finish(null);
56
+ }, timeoutMs);
57
+ proc.stdout?.on("data", (d) => {
58
+ out += d.toString();
59
+ });
60
+ proc.stderr?.on("data", (d) => {
61
+ out += d.toString();
62
+ });
63
+ proc.on("error", () => finish(null));
64
+ proc.on("close", () => finish(out || null));
65
+ });
66
+ }
67
+ async function verifiedCommandOnPath(names, signature, versionArgs = ["--version"]) {
68
+ for (const name of names) {
69
+ if (!await commandOnPath(name))
70
+ continue;
71
+ const out = await runVersion(name, versionArgs);
72
+ if (out && signature.test(out))
73
+ return true;
74
+ }
75
+ return false;
76
+ }
77
+ async function homePathExists(...segments) {
78
+ const fs = getFileSystem2();
79
+ const [, exists] = await catchError(fs.exists(fs.path.join(fs.env.homedir(), ...segments)));
80
+ return exists ?? false;
81
+ }
82
+ async function homeAppDirInstalled(dir) {
83
+ if (!await homePathExists(dir))
84
+ return false;
85
+ const fs = getFileSystem2();
86
+ const [, entries] = await catchError(fs.readdir(fs.path.join(fs.env.homedir(), dir)));
87
+ return (entries ?? []).some((entry) => entry !== "skills" && entry !== ".DS_Store");
88
+ }
89
+
90
+ export { commandOnPath, verifiedCommandOnPath, homePathExists, homeAppDirInstalled };
91
+
92
+ //# debugId=CC702EE4D941A58F64756E2164756E21
@@ -0,0 +1,392 @@
1
+ import {
2
+ getFileSystem2,
3
+ getFileSystemAsync2
4
+ } from "./index-z070caqq.js";
5
+ import {
6
+ catchError,
7
+ Command,
8
+ logger,
9
+ REGISTER_EXPORT
10
+ } from "./index-9db5vwx9.js";
11
+ import {
12
+ getGlobalNpmUipathDir,
13
+ getEnvToolsDirsDeclaration,
14
+ TOOLS_WHITELIST,
15
+ WHITELIST_BY_SHORT_NAME
16
+ } from "./index-16d4evd1.js";
17
+
18
+ // src/services/storage.ts
19
+ class GeneralizedStorage {
20
+ _initPromise;
21
+ async init() {
22
+ if (this._initPromise)
23
+ return this._initPromise;
24
+ const promise = getFileSystemAsync2().then(() => {
25
+ return;
26
+ });
27
+ this._initPromise = promise;
28
+ promise.catch(() => {
29
+ this._initPromise = undefined;
30
+ });
31
+ return promise;
32
+ }
33
+ get fs() {
34
+ return getFileSystem2();
35
+ }
36
+ async read(path) {
37
+ const res = await this.fs.readFile(path);
38
+ if (res === null)
39
+ return null;
40
+ if (typeof res === "string") {
41
+ return new TextEncoder().encode(res);
42
+ }
43
+ return res;
44
+ }
45
+ async readText(path) {
46
+ return this.fs.readFile(path, "utf-8");
47
+ }
48
+ async write(path, content) {
49
+ await this.fs.writeFile(path, content);
50
+ }
51
+ async exists(path) {
52
+ return this.fs.exists(path);
53
+ }
54
+ async readdir(path) {
55
+ return this.fs.readdir(path);
56
+ }
57
+ async remove(path) {
58
+ if (!await this.fs.exists(path))
59
+ return;
60
+ await this.fs.rm(path);
61
+ }
62
+ async mkdir(path) {
63
+ await this.fs.mkdir(path);
64
+ }
65
+ }
66
+ var storage = new GeneralizedStorage;
67
+
68
+ // src/utils/localWorkspace.ts
69
+ var MAX_WALK_DEPTH = 10;
70
+ var CLI_PACKAGE_NAME = "@uipath/cli";
71
+ function isInsideNodeModules(dir) {
72
+ const segments = dir.replace(/\\/g, "/").split("/").filter(Boolean);
73
+ return segments.includes("node_modules");
74
+ }
75
+ async function isLocalWorkspaceDir(dir) {
76
+ const fs = getFileSystem2();
77
+ const pkgJsonPath = fs.path.join(dir, "package.json");
78
+ const [, exists] = await catchError(fs.exists(pkgJsonPath));
79
+ if (!exists)
80
+ return false;
81
+ const [, raw] = await catchError(fs.readFile(pkgJsonPath, "utf-8"));
82
+ if (!raw)
83
+ return false;
84
+ const [, pkg] = catchError(() => JSON.parse(raw));
85
+ if (!pkg)
86
+ return false;
87
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
88
+ return CLI_PACKAGE_NAME in deps || !!pkg.workspaces;
89
+ }
90
+ async function hasGoverningLocalProject(startDir) {
91
+ const fs = getFileSystem2();
92
+ const { dirname } = fs.path;
93
+ let path = startDir;
94
+ for (let i = 0;i < MAX_WALK_DEPTH; i++) {
95
+ if (!isInsideNodeModules(path) && await isLocalWorkspaceDir(path)) {
96
+ return true;
97
+ }
98
+ const parent = dirname(path);
99
+ if (parent === path)
100
+ break;
101
+ path = parent;
102
+ }
103
+ return false;
104
+ }
105
+
106
+ // src/utils/toolLoader.ts
107
+ function isRunningFromSource() {
108
+ const [error, mainUrl] = catchError(() => import.meta.url);
109
+ if (error) {
110
+ return false;
111
+ }
112
+ return mainUrl.endsWith(".ts");
113
+ }
114
+ var _isRunningFromSource = isRunningFromSource();
115
+ var _isBrowser = !(typeof process !== "undefined" && process.versions && process.versions.node);
116
+ function joinPath(...parts) {
117
+ return parts.filter((p) => p).join("/").replace(/\/+/g, "/");
118
+ }
119
+ async function discoverToolPaths(toolsDirs) {
120
+ const [initError] = await catchError(storage.init());
121
+ if (initError) {
122
+ logger.error("Storage initialization failed:", initError);
123
+ return [];
124
+ }
125
+ const dirs = Array.isArray(toolsDirs) ? toolsDirs : [toolsDirs];
126
+ const discovered = [];
127
+ const seenPrefixes = new Set;
128
+ for (const toolsDir of dirs) {
129
+ if (!await storage.exists(toolsDir)) {
130
+ logger.debug(`Tools directory does not exist, skipping: ${toolsDir}`);
131
+ continue;
132
+ }
133
+ const toolNames = [...WHITELIST_BY_SHORT_NAME.keys()];
134
+ const resolvedPaths = await Promise.all(toolNames.map(async (toolName) => {
135
+ const toolDir = joinPath(toolsDir, toolName);
136
+ const possiblePaths = _isRunningFromSource ? [
137
+ joinPath(toolDir, "src", "tool.ts"),
138
+ joinPath(toolDir, "dist", "tool.js"),
139
+ joinPath(toolDir, "tool.js")
140
+ ] : [
141
+ joinPath(toolDir, "dist", "tool.js"),
142
+ joinPath(toolDir, "tool.js"),
143
+ joinPath(toolDir, "src", "tool.ts")
144
+ ];
145
+ const factoryPaths = _isRunningFromSource ? [
146
+ joinPath(toolDir, "src", "packager-tool.ts"),
147
+ joinPath(toolDir, "dist", "packager-tool.js")
148
+ ] : [
149
+ joinPath(toolDir, "dist", "packager-tool.js"),
150
+ joinPath(toolDir, "src", "packager-tool.ts")
151
+ ];
152
+ const [existResults, factoryExistResults, pkgJson] = await Promise.all([
153
+ Promise.all(possiblePaths.map((p) => storage.exists(p))),
154
+ Promise.all(factoryPaths.map((p) => storage.exists(p))),
155
+ storage.readText(joinPath(toolDir, "package.json")).catch(() => null)
156
+ ]);
157
+ const foundIndex = existResults.indexOf(true);
158
+ const factoryIndex = factoryExistResults.indexOf(true);
159
+ let description = "";
160
+ let version = "";
161
+ if (pkgJson) {
162
+ const [parseErr, pkg] = catchError(() => JSON.parse(pkgJson));
163
+ if (!parseErr) {
164
+ description = pkg.description ?? "";
165
+ version = pkg.version ?? "";
166
+ }
167
+ }
168
+ return {
169
+ toolName,
170
+ toolPath: foundIndex >= 0 ? possiblePaths[foundIndex] : null,
171
+ packagerToolPath: factoryIndex >= 0 ? factoryPaths[factoryIndex] : undefined,
172
+ description,
173
+ version
174
+ };
175
+ }));
176
+ for (const {
177
+ toolName,
178
+ toolPath,
179
+ packagerToolPath,
180
+ description,
181
+ version
182
+ } of resolvedPaths) {
183
+ if (!toolPath) {
184
+ continue;
185
+ }
186
+ const packageName = WHITELIST_BY_SHORT_NAME.get(toolName);
187
+ const commandPrefix = packageName ? TOOLS_WHITELIST.get(packageName) : undefined;
188
+ if (!commandPrefix || !packageName) {
189
+ logger.warn(`Tool '${toolName}' found at ${toolPath} but not in whitelist, skipping`);
190
+ continue;
191
+ }
192
+ if (seenPrefixes.has(commandPrefix)) {
193
+ logger.info(`Tool ${toolName} (command '${commandPrefix}') already found from a higher-priority path, skipping`);
194
+ continue;
195
+ }
196
+ seenPrefixes.add(commandPrefix);
197
+ logger.debug(`Discovered tool '${toolName}' v${version || "unknown"} at ${toolPath}`);
198
+ discovered.push({
199
+ toolName,
200
+ toolPath,
201
+ commandPrefix,
202
+ packageName,
203
+ description,
204
+ version,
205
+ packagerToolPath
206
+ });
207
+ }
208
+ }
209
+ return discovered;
210
+ }
211
+ async function importModuleByPath(modulePath) {
212
+ const savedTrackedAction = Command.prototype.trackedAction;
213
+ const [error, mod] = await catchError((async () => {
214
+ if (_isBrowser) {
215
+ const content = await storage.readText(modulePath);
216
+ if (!content)
217
+ return;
218
+ const blob = new Blob([content], { type: "text/javascript" });
219
+ const blobUrl = URL.createObjectURL(blob);
220
+ const [importError, imported] = await catchError(import(blobUrl));
221
+ URL.revokeObjectURL(blobUrl);
222
+ if (importError)
223
+ throw importError;
224
+ return imported;
225
+ } else {
226
+ const { pathToFileURL } = await import("node:url");
227
+ const fileUrl = pathToFileURL(modulePath).href;
228
+ return await import(fileUrl);
229
+ }
230
+ })());
231
+ if (savedTrackedAction && Command.prototype.trackedAction !== savedTrackedAction) {
232
+ Command.prototype.trackedAction = savedTrackedAction;
233
+ logger.warn(`Import of ${modulePath} overwrote Command.prototype.trackedAction — restored CLI version.`);
234
+ }
235
+ if (error)
236
+ throw error;
237
+ return mod;
238
+ }
239
+ async function importTool(discovered, options = {}) {
240
+ const { toolName, toolPath } = discovered;
241
+ logger.debug(`Loading tool '${toolName}' from ${toolPath}`);
242
+ const [error, toolModule] = await catchError(importModuleByPath(toolPath));
243
+ if (error) {
244
+ logger.error(`Failed to load tool ${toolName} (version: ${discovered.version || "unknown"}, path: ${toolPath}):`, error);
245
+ if (options.throwOnLoadError) {
246
+ throw error;
247
+ }
248
+ return;
249
+ }
250
+ const { metadata, registerCommands } = toolModule ?? {};
251
+ if (!metadata || !registerCommands) {
252
+ logger.warn(`Tool ${toolName} missing required exports (metadata or registerCommands), skipping`);
253
+ return;
254
+ }
255
+ logger.debug(`Tool '${toolName}' loaded successfully (prefix: ${metadata.commandPrefix}, version: ${metadata.version ?? "unknown"})`);
256
+ return { metadata, registerCommands };
257
+ }
258
+ async function importPackagerTool(discovered) {
259
+ const { toolName, packagerToolPath } = discovered;
260
+ if (!packagerToolPath)
261
+ return;
262
+ logger.debug(`Loading packager factory for '${toolName}' from ${packagerToolPath}`);
263
+ const [error, mod] = await catchError(importModuleByPath(packagerToolPath));
264
+ if (error) {
265
+ throw new Error(`Failed to load packager factory for '${toolName}' from ${packagerToolPath}: ${error instanceof Error ? error.message : error}`);
266
+ }
267
+ const register = mod?.[REGISTER_EXPORT];
268
+ if (typeof register !== "function") {
269
+ logger.debug(`Packager factory entry point for '${toolName}' (${packagerToolPath}) has no ` + `'${REGISTER_EXPORT}' export — treating it as a legacy entry point that ` + "registered its factories at import.");
270
+ return;
271
+ }
272
+ const [registerError] = catchError(() => {
273
+ register();
274
+ });
275
+ if (registerError) {
276
+ throw new Error(`Failed to register packager factories for '${toolName}' from ${packagerToolPath}: ${registerError.message}`);
277
+ }
278
+ }
279
+ async function importToolLibraryModule(discovered, moduleName) {
280
+ const { toolName, toolPath } = discovered;
281
+ if (!/^[a-z0-9-]+$/.test(moduleName)) {
282
+ throw new Error(`Invalid tool module name '${moduleName}'.`);
283
+ }
284
+ const modulePath = toolPath.replace(/tool\.(ts|js)$/, `${moduleName}.$1`);
285
+ if (modulePath === toolPath || !await storage.exists(modulePath)) {
286
+ throw new Error(`Tool '${toolName}' has no '${moduleName}' entry point next to ${toolPath}.`);
287
+ }
288
+ logger.debug(`Loading '${moduleName}' for '${toolName}' from ${modulePath}`);
289
+ const [error, mod] = await catchError(importModuleByPath(modulePath));
290
+ if (error) {
291
+ throw new Error(`Failed to load '${moduleName}' for '${toolName}' from ${modulePath}: ${error instanceof Error ? error.message : error}`);
292
+ }
293
+ return mod;
294
+ }
295
+ async function findNearestToolsDir(startDir, seen) {
296
+ const fs = getFileSystem2();
297
+ const { dirname, join } = fs.path;
298
+ const results = [];
299
+ let searchPath = startDir;
300
+ for (let i = 0;i < MAX_WALK_DEPTH; i++) {
301
+ const candidate = join(searchPath, "node_modules", "@uipath");
302
+ const [, exists] = await catchError(fs.exists(candidate));
303
+ if (exists) {
304
+ if (seen.has(candidate)) {
305
+ break;
306
+ }
307
+ seen.add(candidate);
308
+ results.push(candidate);
309
+ if (!isInsideNodeModules(searchPath)) {
310
+ break;
311
+ }
312
+ logger.debug("Search path is inside node_modules, continuing walk for hoisted packages");
313
+ }
314
+ const parentPath = dirname(searchPath);
315
+ if (parentPath === searchPath) {
316
+ break;
317
+ }
318
+ searchPath = parentPath;
319
+ }
320
+ return results;
321
+ }
322
+ async function findNearestLocalCliToolsDir(startDir) {
323
+ const fs = getFileSystem2();
324
+ const { dirname, join } = fs.path;
325
+ let searchPath = startDir;
326
+ for (let i = 0;i < MAX_WALK_DEPTH; i++) {
327
+ const candidate = join(searchPath, "node_modules", "@uipath");
328
+ const cliPackageJson = join(candidate, "cli", "package.json");
329
+ const [error, exists] = await catchError(fs.exists(cliPackageJson));
330
+ if (error) {
331
+ logger.debug(`fs.exists check failed for ${cliPackageJson}: ${String(error)}`);
332
+ } else if (exists) {
333
+ return candidate;
334
+ }
335
+ const parentPath = dirname(searchPath);
336
+ if (parentPath === searchPath) {
337
+ break;
338
+ }
339
+ searchPath = parentPath;
340
+ }
341
+ return null;
342
+ }
343
+ async function resolveToolsDirs(cliFilePath, cwd) {
344
+ const fs = getFileSystem2();
345
+ const { dirname } = fs.path;
346
+ const seen = new Set;
347
+ const dirs = [];
348
+ const cliDir = dirname(cliFilePath);
349
+ const declaration = await getEnvToolsDirsDeclaration();
350
+ if (declaration) {
351
+ logger.debug(`Using only the host-declared tool directories: [${declaration.dirs.join(", ")}]`);
352
+ return [...declaration.dirs];
353
+ }
354
+ const localCliToolsDir = await findNearestLocalCliToolsDir(cwd);
355
+ if (localCliToolsDir) {
356
+ seen.add(localCliToolsDir);
357
+ dirs.push(localCliToolsDir);
358
+ logger.debug("CWD has a local @uipath/cli install; skipping CLI-path and global tool discovery");
359
+ return dirs;
360
+ }
361
+ dirs.push(...await findNearestToolsDir(cliDir, seen));
362
+ dirs.push(...await findNearestToolsDir(cwd, seen));
363
+ if (!await hasGoverningLocalProject(cliDir) && !await dirsContainAnyPlugin(dirs)) {
364
+ const globalUipath = await getGlobalNpmUipathDir();
365
+ if (globalUipath && !seen.has(globalUipath)) {
366
+ seen.add(globalUipath);
367
+ dirs.push(globalUipath);
368
+ }
369
+ }
370
+ return dirs;
371
+ }
372
+ async function dirsContainAnyPlugin(dirs) {
373
+ if (dirs.length === 0)
374
+ return false;
375
+ const fs = getFileSystem2();
376
+ for (const dir of dirs) {
377
+ const [error, entries] = await catchError(fs.readdir(dir));
378
+ if (error) {
379
+ logger.debug(`fs.readdir failed for ${dir}: ${String(error)}`);
380
+ continue;
381
+ }
382
+ for (const entry of entries) {
383
+ if (WHITELIST_BY_SHORT_NAME.has(entry))
384
+ return true;
385
+ }
386
+ }
387
+ return false;
388
+ }
389
+
390
+ export { storage, isInsideNodeModules, isLocalWorkspaceDir, discoverToolPaths, importTool, importPackagerTool, importToolLibraryModule, resolveToolsDirs };
391
+
392
+ //# debugId=0DD9EAC63C4A8F6364756E2164756E21
@@ -0,0 +1,200 @@
1
+ import {
2
+ getFileSystem2
3
+ } from "./index-z070caqq.js";
4
+ import {
5
+ catchError
6
+ } from "./index-9db5vwx9.js";
7
+ import {
8
+ resolveSkillSource2,
9
+ fetchSkillsTo2,
10
+ getContentStore2,
11
+ getAvailableSkills2,
12
+ MANIFEST_NAME2,
13
+ readManifest2
14
+ } from "./index-jmz7bmca.js";
15
+ import {
16
+ ALL_AGENTS
17
+ } from "./index-gbdz3pb5.js";
18
+ import {
19
+ SkillsError2,
20
+ runAgentInstalls2,
21
+ cleanupStaleSkills2
22
+ } from "./index-1z45q8dr.js";
23
+ import {
24
+ getSkillsSourceFailureDetails
25
+ } from "./index-6wj58qka.js";
26
+
27
+ // src/services/updateService.skills.ts
28
+ import { randomUUID } from "node:crypto";
29
+ async function runSkillsUpdate2(opts) {
30
+ const fs = getFileSystem2();
31
+ const source = resolveSkillSource2(opts.repo, opts.branch);
32
+ const explicitPath = opts.path?.trim();
33
+ const resolvedPath = explicitPath ? fs.path.resolve(explicitPath) : undefined;
34
+ if (opts.agent !== undefined) {
35
+ const a = opts.agent.trim().toLowerCase();
36
+ if (!ALL_AGENTS.includes(a)) {
37
+ const scope = resolvedPath || opts.local === true ? "local" : "global";
38
+ const rootDir = resolvedPath ?? (scope === "local" ? fs.env.cwd() : fs.env.homedir());
39
+ return {
40
+ sections: [
41
+ {
42
+ rootDir,
43
+ scope,
44
+ agents: [],
45
+ skills: [],
46
+ added: [],
47
+ removed: [],
48
+ refreshed: 0,
49
+ error: {
50
+ result: "ValidationError",
51
+ message: `Unknown agent: ${a}`,
52
+ instructions: `Available agents: ${ALL_AGENTS.join(", ")}`
53
+ }
54
+ }
55
+ ]
56
+ };
57
+ }
58
+ }
59
+ if (resolvedPath) {
60
+ const stat = await fs.stat(resolvedPath);
61
+ if (!stat?.isDirectory()) {
62
+ return {
63
+ sections: [
64
+ {
65
+ rootDir: resolvedPath,
66
+ scope: "local",
67
+ agents: [],
68
+ skills: [],
69
+ added: [],
70
+ removed: [],
71
+ refreshed: 0,
72
+ error: {
73
+ result: "ValidationError",
74
+ message: `Path does not exist or is not a directory: ${resolvedPath}`,
75
+ instructions: "Pass --path pointing to an existing project directory."
76
+ }
77
+ }
78
+ ]
79
+ };
80
+ }
81
+ }
82
+ const candidates = [];
83
+ if (resolvedPath) {
84
+ candidates.push({ rootDir: resolvedPath, scope: "local" });
85
+ } else {
86
+ if (opts.local !== true) {
87
+ candidates.push({ rootDir: fs.env.homedir(), scope: "global" });
88
+ }
89
+ if (opts.local !== false) {
90
+ candidates.push({ rootDir: fs.env.cwd(), scope: "local" });
91
+ }
92
+ }
93
+ const sections = [];
94
+ for (const candidate of candidates) {
95
+ const manifestPath = fs.path.join(candidate.rootDir, source.storeName, MANIFEST_NAME2);
96
+ const hasManifest = await fs.exists(manifestPath);
97
+ if (!resolvedPath && opts.local === undefined && !hasManifest)
98
+ continue;
99
+ const [sectionErr, section] = await catchError(updateOneSection(opts, candidate, source));
100
+ if (sectionErr) {
101
+ const skillsErr = sectionErr instanceof SkillsError2 ? sectionErr : null;
102
+ const instructions = skillsErr?.instructions ?? getSkillsSourceFailureDetails(sectionErr).instructions;
103
+ sections.push({
104
+ rootDir: candidate.rootDir,
105
+ scope: candidate.scope,
106
+ agents: [],
107
+ skills: [],
108
+ added: [],
109
+ removed: [],
110
+ refreshed: 0,
111
+ error: {
112
+ result: skillsErr?.result ?? "Failure",
113
+ message: sectionErr.message,
114
+ instructions
115
+ }
116
+ });
117
+ continue;
118
+ }
119
+ if (section)
120
+ sections.push(section);
121
+ }
122
+ return { sections };
123
+ }
124
+ async function updateOneSection(opts, candidate, source) {
125
+ const fs = getFileSystem2();
126
+ const isLocal = candidate.scope === "local";
127
+ const previousManifest = await readManifest2(fs.path.join(candidate.rootDir, source.storeName));
128
+ const previousSkills = Object.keys(previousManifest.skills);
129
+ let agents;
130
+ if (opts.agent) {
131
+ const a = opts.agent.trim().toLowerCase();
132
+ if (!ALL_AGENTS.includes(a)) {
133
+ throw new SkillsError2(`Unknown agent: ${a}`, `Available agents: ${ALL_AGENTS.join(", ")}`, "ValidationError");
134
+ }
135
+ agents = [a];
136
+ } else {
137
+ const fromManifest = new Set;
138
+ for (const entry of Object.values(previousManifest.skills)) {
139
+ for (const a of entry.agents) {
140
+ if (ALL_AGENTS.includes(a)) {
141
+ fromManifest.add(a);
142
+ }
143
+ }
144
+ }
145
+ agents = [...fromManifest];
146
+ if (agents.length === 0) {
147
+ throw new SkillsError2(`No agents recorded in manifest at ${candidate.rootDir}; pass --agent explicitly.`, `Run 'uip skills install --agent <agent>' first, or pass --agent. Available agents: ${ALL_AGENTS.join(", ")}.`, "ConfigError");
148
+ }
149
+ }
150
+ if (opts.dryRun) {
151
+ const tmpRoot = fs.path.join(fs.env.tmpdir(), `uipath-skills-dryrun-${randomUUID()}`);
152
+ try {
153
+ await fs.mkdir(tmpRoot);
154
+ const tmpStore = fs.path.join(tmpRoot, "store");
155
+ await fetchSkillsTo2(tmpStore, tmpRoot, source, opts.targetVersion);
156
+ const remoteSkills = await getAvailableSkills2(tmpStore);
157
+ const remoteNames = remoteSkills.map((s) => s.name);
158
+ return {
159
+ rootDir: candidate.rootDir,
160
+ scope: candidate.scope,
161
+ agents,
162
+ skills: remoteNames,
163
+ added: remoteNames.filter((n) => !previousSkills.includes(n)),
164
+ removed: previousSkills.filter((n) => !remoteNames.includes(n)),
165
+ refreshed: 0
166
+ };
167
+ } finally {
168
+ await catchError(fs.rm(tmpRoot));
169
+ }
170
+ }
171
+ const storePath = await getContentStore2(candidate.rootDir, source, opts.targetVersion);
172
+ const availableSkills = await getAvailableSkills2(storePath);
173
+ const availableNames = availableSkills.map((s) => s.name);
174
+ const added = availableNames.filter((n) => !previousSkills.includes(n));
175
+ const removed = previousSkills.filter((n) => !availableNames.includes(n));
176
+ const resolved = {
177
+ rootDir: candidate.rootDir,
178
+ storePath,
179
+ selectedSkills: availableSkills,
180
+ agents,
181
+ isLocal,
182
+ source,
183
+ force: opts.force
184
+ };
185
+ const { installed } = await runAgentInstalls2(resolved, "update");
186
+ await cleanupStaleSkills2(resolved);
187
+ return {
188
+ rootDir: candidate.rootDir,
189
+ scope: candidate.scope,
190
+ agents,
191
+ skills: availableNames,
192
+ added,
193
+ removed,
194
+ refreshed: installed.length
195
+ };
196
+ }
197
+
198
+ export { runSkillsUpdate2 };
199
+
200
+ //# debugId=88AF4A5DB1FF04D064756E2164756E21