@uipath/cli 1.198.0-preview.87 → 1.198.0-preview.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -68838,7 +68838,7 @@ var init_package = __esm(() => {
68838
68838
  package_default = {
68839
68839
  name: "@uipath/cli",
68840
68840
  license: "MIT",
68841
- version: "1.198.0-preview.87",
68841
+ version: "1.198.0-preview.88",
68842
68842
  description: "Cross platform CLI for UiPath",
68843
68843
  repository: {
68844
68844
  type: "git",
@@ -125166,6 +125166,7 @@ var require_fast_uri = __commonJS((exports, module) => {
125166
125166
  return uriTokens.join("");
125167
125167
  }
125168
125168
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
125169
+ var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
125169
125170
  function getParseError(parsed, matches) {
125170
125171
  if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
125171
125172
  return 'URI path must start with "/" when authority is present.';
@@ -125195,6 +125196,11 @@ var require_fast_uri = __commonJS((exports, module) => {
125195
125196
  uri = "//" + uri;
125196
125197
  }
125197
125198
  }
125199
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
125200
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
125201
+ parsed.error = "URI authority must not contain a literal backslash.";
125202
+ malformedAuthorityOrPort = true;
125203
+ }
125198
125204
  const matches = uri.match(URI_PARSE);
125199
125205
  if (matches) {
125200
125206
  parsed.scheme = matches[1];
@@ -125238,7 +125244,7 @@ var require_fast_uri = __commonJS((exports, module) => {
125238
125244
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
125239
125245
  if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
125240
125246
  try {
125241
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
125247
+ parsed.host = new URL("http://" + parsed.host).hostname;
125242
125248
  } catch (e) {
125243
125249
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
125244
125250
  }
@@ -130541,6 +130547,7 @@ var init_autopilot = __esm(() => {
130541
130547
  init_detect();
130542
130548
  def2 = {
130543
130549
  localSubdir: [".autopilot", "skills"],
130550
+ extraFolders: ["agents", "hooks"],
130544
130551
  detect: () => homeAppDirInstalled(".autopilot")
130545
130552
  };
130546
130553
  });
@@ -131044,6 +131051,28 @@ async function removeFromManifest(storePath, skillNames, agents) {
131044
131051
  delete manifest.skills[name];
131045
131052
  }
131046
131053
  }
131054
+ if (manifest.extraFiles) {
131055
+ for (const agent of agents)
131056
+ delete manifest.extraFiles[agent];
131057
+ if (Object.keys(manifest.extraFiles).length === 0) {
131058
+ manifest.extraFiles = undefined;
131059
+ }
131060
+ }
131061
+ await writeManifest(storePath, manifest);
131062
+ }
131063
+ async function readExtraFiles(storePath, agent) {
131064
+ const manifest = await readManifest(storePath);
131065
+ return manifest.extraFiles?.[agent] ?? [];
131066
+ }
131067
+ async function recordExtraFiles(storePath, agent, files) {
131068
+ const manifest = await readManifest(storePath);
131069
+ const extraFiles = manifest.extraFiles ?? {};
131070
+ if (files.length > 0) {
131071
+ extraFiles[agent] = files;
131072
+ } else {
131073
+ delete extraFiles[agent];
131074
+ }
131075
+ manifest.extraFiles = Object.keys(extraFiles).length > 0 ? extraFiles : undefined;
131047
131076
  await writeManifest(storePath, manifest);
131048
131077
  }
131049
131078
  function asRecord(value) {
@@ -131952,6 +131981,92 @@ async function installSkill(agent, skill, skillsDir, owner) {
131952
131981
  logger.info(` ${agent}: installed ${skill.name}`);
131953
131982
  return { installed: true };
131954
131983
  }
131984
+ async function listFilesRelative(fs7, dir) {
131985
+ const out = [];
131986
+ const walk = async (rel) => {
131987
+ const abs = rel ? fs7.path.join(dir, ...rel.split("/")) : dir;
131988
+ const [, entries] = await catchError(fs7.readdir(abs));
131989
+ for (const name of entries ?? []) {
131990
+ const childRel = rel ? `${rel}/${name}` : name;
131991
+ const stats = await fs7.stat(fs7.path.join(dir, ...childRel.split("/")));
131992
+ if (stats?.isDirectory()) {
131993
+ await walk(childRel);
131994
+ } else if (stats?.isFile()) {
131995
+ out.push(childRel);
131996
+ }
131997
+ }
131998
+ };
131999
+ await walk("");
132000
+ return out;
132001
+ }
132002
+ async function removeEmptyDirs(fs7, dir) {
132003
+ const stats = await fs7.stat(dir);
132004
+ if (!stats?.isDirectory())
132005
+ return;
132006
+ for (const name of await fs7.readdir(dir)) {
132007
+ const child = fs7.path.join(dir, name);
132008
+ const childStats = await fs7.stat(child);
132009
+ if (childStats?.isDirectory())
132010
+ await removeEmptyDirs(fs7, child);
132011
+ }
132012
+ if ((await fs7.readdir(dir)).length === 0)
132013
+ await fs7.rm(dir);
132014
+ }
132015
+ async function installExtraFolders(agent, storePath, skillsDir, owned = []) {
132016
+ const extraFolders = AGENT_DEFS[agent].extraFolders ?? [];
132017
+ if (extraFolders.length === 0)
132018
+ return [];
132019
+ const fs7 = getFileSystem();
132020
+ const agentRoot = fs7.path.dirname(skillsDir);
132021
+ const ownedSet = new Set(owned);
132022
+ const copied = [];
132023
+ for (const folder of extraFolders) {
132024
+ const source = fs7.path.join(storePath, folder);
132025
+ if (!await fs7.exists(source))
132026
+ continue;
132027
+ for (const rel of await listFilesRelative(fs7, source)) {
132028
+ const relFromRoot = `${folder}/${rel}`;
132029
+ const target = fs7.path.join(agentRoot, folder, ...rel.split("/"));
132030
+ if (await fs7.exists(target) && !ownedSet.has(relFromRoot)) {
132031
+ logger.info(` ${agent}: kept existing ${relFromRoot} (not overwritten)`);
132032
+ continue;
132033
+ }
132034
+ const data = await fs7.readFile(fs7.path.join(source, ...rel.split("/")));
132035
+ if (data === null)
132036
+ continue;
132037
+ await fs7.writeFile(target, data);
132038
+ copied.push(relFromRoot);
132039
+ }
132040
+ logger.info(` ${agent}: installed ${folder}/`);
132041
+ }
132042
+ const copiedSet = new Set(copied);
132043
+ for (const stale of ownedSet) {
132044
+ if (copiedSet.has(stale))
132045
+ continue;
132046
+ const target = fs7.path.join(agentRoot, ...stale.split("/"));
132047
+ if (await fs7.exists(target))
132048
+ await fs7.rm(target);
132049
+ }
132050
+ for (const folder of extraFolders) {
132051
+ await removeEmptyDirs(fs7, fs7.path.join(agentRoot, folder));
132052
+ }
132053
+ return copied;
132054
+ }
132055
+ async function uninstallExtraFolders(skillsDir, owned) {
132056
+ if (owned.length === 0)
132057
+ return;
132058
+ const fs7 = getFileSystem();
132059
+ const agentRoot = fs7.path.dirname(skillsDir);
132060
+ for (const rel of owned) {
132061
+ const target = fs7.path.join(agentRoot, ...rel.split("/"));
132062
+ if (await fs7.exists(target))
132063
+ await fs7.rm(target);
132064
+ }
132065
+ const topFolders = new Set(owned.map((rel) => rel.split("/")[0]));
132066
+ for (const folder of topFolders) {
132067
+ await removeEmptyDirs(fs7, fs7.path.join(agentRoot, folder));
132068
+ }
132069
+ }
131955
132070
  async function uninstallSkill(skillName, skillsDir, owner) {
131956
132071
  const fs7 = getFileSystem();
131957
132072
  const target = fs7.path.join(skillsDir, skillName);
@@ -132653,7 +132768,8 @@ async function runOneAgent(agent, operation, resolved) {
132653
132768
  return {
132654
132769
  installedIds: selectedSkills.map((s) => `${agent}:${s.name}`),
132655
132770
  installedNames: selectedSkills.map((s) => s.name),
132656
- conflicts: []
132771
+ conflicts: [],
132772
+ extraFiles: []
132657
132773
  };
132658
132774
  }
132659
132775
  const owner = skillOwnerOf(source);
@@ -132677,6 +132793,11 @@ async function runOneAgent(agent, operation, resolved) {
132677
132793
  installedIds.push(`${agent}:${skill.name}`);
132678
132794
  installedNames.push(skill.name);
132679
132795
  }
132796
+ const [, priorOwned] = await catchError(readExtraFiles(storePath, agent));
132797
+ const [extraFoldersError, extraFiles] = await catchError(installExtraFolders(agent, storePath, skillsDir, priorOwned ?? []));
132798
+ if (extraFoldersError) {
132799
+ return new Error(`Failed to install extra folders for ${agent}: ${extraFoldersError.message}`);
132800
+ }
132680
132801
  if (isDefaultSource) {
132681
132802
  const installedSet = new Set(installedNames);
132682
132803
  const [catalogError] = await catchError(writeSkillCatalog(skillsDir, selectedSkills.filter((s) => installedSet.has(s.name)), {
@@ -132688,7 +132809,7 @@ async function runOneAgent(agent, operation, resolved) {
132688
132809
  return new Error(`Failed to write skill catalog for ${agent}: ${catalogError.message}`);
132689
132810
  }
132690
132811
  }
132691
- return { installedIds, installedNames, conflicts };
132812
+ return { installedIds, installedNames, conflicts, extraFiles };
132692
132813
  }
132693
132814
  async function runAgentInstalls(resolved, operation = "install") {
132694
132815
  const { rootDir, storePath, agents, isLocal } = resolved;
@@ -132696,6 +132817,7 @@ async function runAgentInstalls(resolved, operation = "install") {
132696
132817
  const conflicts = [];
132697
132818
  const succeededAgents = [];
132698
132819
  const installedByAgent = new Map;
132820
+ const extraFilesByAgent = new Map;
132699
132821
  const failures = [];
132700
132822
  for (const agent of agents) {
132701
132823
  const result = await runOneAgent(agent, operation, resolved);
@@ -132706,16 +132828,21 @@ async function runAgentInstalls(resolved, operation = "install") {
132706
132828
  installed.push(...result.installedIds);
132707
132829
  conflicts.push(...result.conflicts);
132708
132830
  installedByAgent.set(agent, result.installedNames);
132831
+ extraFilesByAgent.set(agent, result.extraFiles);
132709
132832
  succeededAgents.push(agent);
132710
132833
  }
132711
132834
  if (succeededAgents.length > 0) {
132712
132835
  for (const agent of succeededAgents) {
132713
132836
  const names = installedByAgent.get(agent) ?? [];
132714
- if (names.length === 0)
132715
- continue;
132716
- const [manifestError] = await catchError(updateManifestAfterInstall(storePath, names, [agent]));
132717
- if (manifestError) {
132718
- throw new SkillsError(`Failed to update manifest: ${manifestError.message}`, "Check that the content store is intact and you have write permissions.");
132837
+ if (names.length > 0) {
132838
+ const [manifestError] = await catchError(updateManifestAfterInstall(storePath, names, [agent]));
132839
+ if (manifestError) {
132840
+ throw new SkillsError(`Failed to update manifest: ${manifestError.message}`, "Check that the content store is intact and you have write permissions.");
132841
+ }
132842
+ }
132843
+ const [extraError] = await catchError(recordExtraFiles(storePath, agent, extraFilesByAgent.get(agent) ?? []));
132844
+ if (extraError) {
132845
+ throw new SkillsError(`Failed to record installed folders: ${extraError.message}`, "Check that the content store is intact and you have write permissions.");
132719
132846
  }
132720
132847
  }
132721
132848
  if (isLocal) {
@@ -133008,6 +133135,16 @@ async function uninstallForAgent(targetAgent, ctx, uninstalled) {
133008
133135
  }
133009
133136
  uninstalled.push(`${targetAgent}:${name}`);
133010
133137
  }
133138
+ const [, ownedExtra] = await catchError(readExtraFiles(storePath, targetAgent));
133139
+ const [extraError] = await catchError(uninstallExtraFolders(skillsDir, ownedExtra ?? []));
133140
+ if (extraError) {
133141
+ OutputFormatter.error({
133142
+ Result: RESULTS.Failure,
133143
+ Message: `Failed to remove installed folders for ${targetAgent}: ${extraError.message}`,
133144
+ Instructions: "Check that the destination is writable and try again."
133145
+ });
133146
+ return HANDLED;
133147
+ }
133011
133148
  if (isDefaultSource) {
133012
133149
  const [catalogError] = await catchError(removeSkillCatalog(skillsDir));
133013
133150
  if (catalogError) {
@@ -139285,4 +139422,4 @@ export {
139285
139422
  ready
139286
139423
  };
139287
139424
 
139288
- //# debugId=BB061C455091872164756E2164756E21
139425
+ //# debugId=3205D8D666BB8C3A64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/cli",
3
3
  "license": "MIT",
4
- "version": "1.198.0-preview.87",
4
+ "version": "1.198.0-preview.88",
5
5
  "description": "Cross platform CLI for UiPath",
6
6
  "repository": {
7
7
  "type": "git",
@@ -34,5 +34,5 @@
34
34
  "mihaigirleanu",
35
35
  "vlad-uipath"
36
36
  ],
37
- "gitHead": "b84a7a78e1a325c3dd3b39efd3018c49b38c789f"
37
+ "gitHead": "9be5d51c7d9ccd184c980771e7f06e240c75a9e2"
38
38
  }