@uipath/cli 0.1.16 → 0.1.17

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 (2) hide show
  1. package/dist/index.js +582 -281
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -52,7 +52,7 @@ var package_default;
52
52
  var init_package = __esm(() => {
53
53
  package_default = {
54
54
  name: "@uipath/cli",
55
- version: "0.1.16",
55
+ version: "0.1.17",
56
56
  description: "Cross platform CLI for UiPath",
57
57
  repository: {
58
58
  type: "git",
@@ -60,7 +60,7 @@ var init_package = __esm(() => {
60
60
  directory: "packages/cli"
61
61
  },
62
62
  publishConfig: {
63
- registry: "https://registry.npmjs.org/"
63
+ registry: "https://npm.pkg.github.com/@uipath"
64
64
  },
65
65
  type: "module",
66
66
  main: "./dist/index.js",
@@ -103,7 +103,7 @@ var init_package = __esm(() => {
103
103
  },
104
104
  peerDependencies: {
105
105
  commander: "^14.0.3",
106
- "@uipath/common": "^0.1.12",
106
+ "@uipath/common": "^0.1.13",
107
107
  "@uipath/auth": "^0.1.9",
108
108
  "@uipath/filesystem": "^0.1.6"
109
109
  }
@@ -29739,23 +29739,323 @@ function registerMcpCommand(program) {
29739
29739
  }
29740
29740
  var init_mcp2 = () => {};
29741
29741
 
29742
+ // src/services/deviceId.ts
29743
+ import { randomUUID } from "node:crypto";
29744
+ import { catchError as catchError4, logger, UIPATH_HOME_DIR } from "@uipath/common";
29745
+ import { getFileSystem as getFileSystem3 } from "@uipath/filesystem";
29746
+ async function getOrCreateDeviceId() {
29747
+ const fs = getFileSystem3();
29748
+ const homeDir = fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR);
29749
+ const filePath = fs.path.join(homeDir, DEVICE_ID_FILENAME);
29750
+ const existing = await fs.readFile(filePath, "utf-8");
29751
+ if (existing?.trim()) {
29752
+ return existing.trim();
29753
+ }
29754
+ const newId = randomUUID();
29755
+ const [writeError] = await catchError4((async () => {
29756
+ if (!await fs.exists(homeDir)) {
29757
+ await fs.mkdir(homeDir);
29758
+ }
29759
+ await fs.writeFile(filePath, newId);
29760
+ })());
29761
+ if (writeError) {
29762
+ logger.warn(`Failed to persist device ID: ${writeError.message}`);
29763
+ }
29764
+ return newId;
29765
+ }
29766
+ var DEVICE_ID_FILENAME = "cli-device-id";
29767
+ var init_deviceId = () => {};
29768
+
29769
+ // src/services/environmentInfo.ts
29770
+ import { arch as osArch, release as osRelease, type as osType } from "node:os";
29771
+ import { catchError as catchError5 } from "@uipath/common";
29772
+ function decodeJwtPayload(token) {
29773
+ const parts = token.split(".");
29774
+ if (parts.length !== 3)
29775
+ return;
29776
+ const base643 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
29777
+ const padded = base643 + "=".repeat((4 - base643.length % 4) % 4);
29778
+ const [, parsed] = catchError5(() => JSON.parse(atob(padded)));
29779
+ return parsed;
29780
+ }
29781
+ async function getAuthContext() {
29782
+ const [statusError, status] = await catchError5(auth.getLoginStatus());
29783
+ if (statusError || status.loginStatus !== "Logged in" || !status.accessToken) {
29784
+ return {};
29785
+ }
29786
+ const claims = decodeJwtPayload(status.accessToken);
29787
+ return {
29788
+ email: claims?.email ?? claims?.preferred_username,
29789
+ userId: claims?.sub,
29790
+ organizationId: status.organizationId,
29791
+ organizationName: status.organizationName,
29792
+ tenantId: status.tenantId,
29793
+ tenantName: status.tenantName
29794
+ };
29795
+ }
29796
+ function buildEnvironmentString(authCtx) {
29797
+ const lines = [
29798
+ `CLI Version: ${package_default.version}`,
29799
+ `Node Version: ${process.version}`,
29800
+ `OS: ${osType()} ${osRelease()} (${osArch()})`,
29801
+ `Platform: ${process.platform}`
29802
+ ];
29803
+ if (authCtx.userId)
29804
+ lines.push(`Cloud User ID: ${authCtx.userId}`);
29805
+ if (authCtx.organizationName)
29806
+ lines.push(`Cloud Organization: ${authCtx.organizationName}`);
29807
+ if (authCtx.organizationId)
29808
+ lines.push(`Cloud Organization ID: ${authCtx.organizationId}`);
29809
+ if (authCtx.tenantName)
29810
+ lines.push(`Tenant: ${authCtx.tenantName}`);
29811
+ if (authCtx.tenantId)
29812
+ lines.push(`Tenant ID: ${authCtx.tenantId}`);
29813
+ return lines.join(`
29814
+ `);
29815
+ }
29816
+ var init_environmentInfo = __esm(() => {
29817
+ init_package();
29818
+ init_auth();
29819
+ });
29820
+
29821
+ // src/services/feedbackService.ts
29822
+ import { catchError as catchError6, DEFAULT_FETCH_TIMEOUT_MS } from "@uipath/common";
29823
+ import { getFileSystem as getFileSystem4 } from "@uipath/filesystem";
29824
+ async function createFeedbackIssue(options) {
29825
+ const feedbackType = FEEDBACK_TYPE_MAP[options.type];
29826
+ const priorityId = PRIORITY_MAP[options.priority];
29827
+ const descriptionParts = [options.description];
29828
+ if (options.email) {
29829
+ descriptionParts.push(`User Email: ${options.email}`);
29830
+ }
29831
+ const body = {
29832
+ fields: {
29833
+ project: { id: PROJECT_ID },
29834
+ components: [{ id: CLI_COMPONENT_ID }],
29835
+ versions: [],
29836
+ summary: options.title,
29837
+ description: descriptionParts.join(`
29838
+ `),
29839
+ issuetype: { id: feedbackType.id, name: feedbackType.name },
29840
+ [FIELD_ENVIRONMENT]: options.environment,
29841
+ [FIELD_STEPS_TO_REPRODUCE]: "",
29842
+ labels: [],
29843
+ priority: { id: priorityId }
29844
+ }
29845
+ };
29846
+ const response = await fetch(`${FEEDBACK_ENDPOINT}/issue/`, {
29847
+ method: "POST",
29848
+ headers: {
29849
+ "Content-Type": "application/json",
29850
+ "Accept-Encoding": "gzip, deflate",
29851
+ deviceId: options.deviceId
29852
+ },
29853
+ body: JSON.stringify(body),
29854
+ signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS)
29855
+ });
29856
+ const text = await response.text();
29857
+ if (!response.ok) {
29858
+ if (response.status === 429) {
29859
+ throw new Error("Too many feedback submissions. Please wait and try again later.");
29860
+ }
29861
+ throw new Error(`Failed to create feedback issue: ${text}`);
29862
+ }
29863
+ const [parseError, result] = catchError6(() => JSON.parse(text));
29864
+ if (parseError || !result?.key) {
29865
+ throw new Error(`Unexpected response from feedback service: ${text}`);
29866
+ }
29867
+ return { key: result.key, sig: result.sig ?? "" };
29868
+ }
29869
+ async function uploadAttachment(issueId, signature, deviceId, filePath) {
29870
+ const fs = getFileSystem4();
29871
+ const fileBuffer = await fs.readFile(filePath);
29872
+ if (!fileBuffer) {
29873
+ throw new Error(`Could not read attachment: "${fs.path.basename(filePath)}"`);
29874
+ }
29875
+ const fileName = fs.path.basename(filePath);
29876
+ const formData = new FormData;
29877
+ formData.append("file", new Blob([fileBuffer]), fileName);
29878
+ const response = await fetch(`${FEEDBACK_ENDPOINT}/issue/${issueId}/attachments`, {
29879
+ method: "POST",
29880
+ headers: {
29881
+ "X-SIG": signature,
29882
+ deviceId,
29883
+ "Accept-Encoding": "gzip, deflate"
29884
+ },
29885
+ body: formData,
29886
+ signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS)
29887
+ });
29888
+ const text = await response.text();
29889
+ if (!response.ok) {
29890
+ throw new Error(`Failed to upload attachment "${fileName}": ${text}`);
29891
+ }
29892
+ }
29893
+ async function validateAttachment(filePath) {
29894
+ const MAX_FILE_SIZE = 10 * 1024 * 1024;
29895
+ const fs = getFileSystem4();
29896
+ const stat = await fs.stat(filePath);
29897
+ if (!stat) {
29898
+ throw new Error(`Attachment not found: "${fs.path.basename(filePath)}"`);
29899
+ }
29900
+ if (stat.size > MAX_FILE_SIZE) {
29901
+ throw new Error(`Attachment "${fs.path.basename(filePath)}" exceeds 10 MB limit (${Math.round(stat.size / 1024 / 1024)} MB).`);
29902
+ }
29903
+ }
29904
+ var FEEDBACK_ENDPOINT, PROJECT_ID = "10677", CLI_COMPONENT_ID = "29590", FIELD_ENVIRONMENT = "customfield_11434", FIELD_STEPS_TO_REPRODUCE = "customfield_11433", FEEDBACK_TYPE_MAP, PRIORITY_MAP;
29905
+ var init_feedbackService = __esm(() => {
29906
+ FEEDBACK_ENDPOINT = atob("aHR0cHM6Ly9zdHVkaW8tZmVlZGJhY2suYXp1cmUtYXBpLm5ldC9jb2RpbmctYWdlbnRz");
29907
+ FEEDBACK_TYPE_MAP = {
29908
+ bug: { id: "1", name: "Bug" },
29909
+ improvement: { id: "4", name: "Improvement" }
29910
+ };
29911
+ PRIORITY_MAP = {
29912
+ critical: "3",
29913
+ normal: "5",
29914
+ minor: "4"
29915
+ };
29916
+ });
29917
+
29918
+ // src/commands/send-feedback.ts
29919
+ import { catchError as catchError7, logger as logger2, OutputFormatter as OutputFormatter3 } from "@uipath/common";
29920
+ import { getFileSystem as getFileSystem5 } from "@uipath/filesystem";
29921
+ function registerFeedbackCommand(program, context) {
29922
+ const feedback = program.command("feedback").description("Send bug reports and improvement suggestions");
29923
+ feedback.command("send").description("Send feedback (bug report or improvement suggestion) to the UiPath team").requiredOption("--type <type>", "Feedback type: bug or improvement").requiredOption("--title <title>", "Issue title / summary").requiredOption("--description <text>", "Detailed description or steps to reproduce").option("--priority <priority>", "Priority: critical, normal, or minor (default: normal)", "normal").option("--email <email>", "Contact email address").option("--attachment <paths...>", "File(s) to attach (max 10, max 10MB each)").trackedAction(context, async (options) => {
29924
+ if (!VALID_TYPES.includes(options.type)) {
29925
+ OutputFormatter3.error({
29926
+ Result: "Failure",
29927
+ Message: `Invalid feedback type: "${options.type}"`,
29928
+ Instructions: `--type must be one of: ${VALID_TYPES.join(", ")}`
29929
+ });
29930
+ context.exit(1);
29931
+ return;
29932
+ }
29933
+ if (!VALID_PRIORITIES.includes(options.priority)) {
29934
+ OutputFormatter3.error({
29935
+ Result: "Failure",
29936
+ Message: `Invalid priority: "${options.priority}"`,
29937
+ Instructions: `--priority must be one of: ${VALID_PRIORITIES.join(", ")}`
29938
+ });
29939
+ context.exit(1);
29940
+ return;
29941
+ }
29942
+ const attachments = options.attachment ?? [];
29943
+ if (attachments.length > MAX_ATTACHMENTS) {
29944
+ OutputFormatter3.error({
29945
+ Result: "Failure",
29946
+ Message: `Too many attachments: ${attachments.length}`,
29947
+ Instructions: `Maximum ${MAX_ATTACHMENTS} attachments allowed.`
29948
+ });
29949
+ context.exit(1);
29950
+ return;
29951
+ }
29952
+ const fs = getFileSystem5();
29953
+ for (const filePath of attachments) {
29954
+ if (!await fs.exists(filePath)) {
29955
+ OutputFormatter3.error({
29956
+ Result: "Failure",
29957
+ Message: `Attachment not found: "${filePath}"`,
29958
+ Instructions: "Check the file path and try again."
29959
+ });
29960
+ context.exit(1);
29961
+ return;
29962
+ }
29963
+ const [validateError] = await catchError7(validateAttachment(filePath));
29964
+ if (validateError) {
29965
+ OutputFormatter3.error({
29966
+ Result: "Failure",
29967
+ Message: validateError.message,
29968
+ Instructions: "Reduce the file size or choose a different file."
29969
+ });
29970
+ context.exit(1);
29971
+ return;
29972
+ }
29973
+ }
29974
+ const [deviceIdError, deviceId] = await catchError7(getOrCreateDeviceId());
29975
+ if (deviceIdError) {
29976
+ OutputFormatter3.error({
29977
+ Result: "Failure",
29978
+ Message: deviceIdError.message,
29979
+ Instructions: "Failed to generate device ID."
29980
+ });
29981
+ context.exit(1);
29982
+ return;
29983
+ }
29984
+ const authCtx = await getAuthContext();
29985
+ const email3 = options.email ?? authCtx.email;
29986
+ const feedbackOptions = {
29987
+ type: options.type,
29988
+ priority: options.priority,
29989
+ title: options.title,
29990
+ description: options.description,
29991
+ email: email3,
29992
+ environment: buildEnvironmentString(authCtx),
29993
+ deviceId
29994
+ };
29995
+ const [createError, result] = await catchError7(createFeedbackIssue(feedbackOptions));
29996
+ if (createError) {
29997
+ OutputFormatter3.error({
29998
+ Result: "Failure",
29999
+ Message: createError.message,
30000
+ Instructions: "Failed to submit feedback. Check your network connection and try again."
30001
+ });
30002
+ context.exit(1);
30003
+ return;
30004
+ }
30005
+ let attachmentsUploaded = 0;
30006
+ for (const filePath of attachments) {
30007
+ const [attachError] = await catchError7(uploadAttachment(result.key, result.sig, deviceId, filePath));
30008
+ if (attachError) {
30009
+ logger2.warn(`Failed to upload attachment "${filePath}": ${attachError.message}`);
30010
+ } else {
30011
+ attachmentsUploaded++;
30012
+ }
30013
+ }
30014
+ OutputFormatter3.success({
30015
+ Result: "Success",
30016
+ Code: "FeedbackSent",
30017
+ Data: {
30018
+ IssueKey: result.key,
30019
+ Type: options.type,
30020
+ Title: options.title,
30021
+ ...attachments.length > 0 && {
30022
+ AttachmentsUploaded: `${attachmentsUploaded}/${attachments.length}`
30023
+ }
30024
+ }
30025
+ });
30026
+ }, (options) => ({
30027
+ feedbackType: options.type,
30028
+ priority: options.priority,
30029
+ hasEmail: !!options.email,
30030
+ attachmentCount: options.attachment?.length ?? 0
30031
+ }));
30032
+ }
30033
+ var VALID_TYPES, VALID_PRIORITIES, MAX_ATTACHMENTS = 10;
30034
+ var init_send_feedback = __esm(() => {
30035
+ init_deviceId();
30036
+ init_environmentInfo();
30037
+ init_feedbackService();
30038
+ VALID_TYPES = ["bug", "improvement"];
30039
+ VALID_PRIORITIES = ["critical", "normal", "minor"];
30040
+ });
30041
+
29742
30042
  // src/commands/skills/agents/claude.ts
29743
30043
  var exports_claude = {};
29744
30044
  __export(exports_claude, {
29745
30045
  uninstall: () => uninstall,
29746
30046
  install: () => install
29747
30047
  });
29748
- import { logger } from "@uipath/common";
29749
- import { getFileSystem as getFileSystem3 } from "@uipath/filesystem";
30048
+ import { logger as logger3 } from "@uipath/common";
30049
+ import { getFileSystem as getFileSystem6 } from "@uipath/filesystem";
29750
30050
  async function install(skill, rootDir) {
29751
- const fs = getFileSystem3();
30051
+ const fs = getFileSystem6();
29752
30052
  const target = fs.path.join(rootDir, ".claude", "skills", skill.name);
29753
30053
  await fs.mkdir(target);
29754
30054
  await fs.copyDirectory(skill.skillDir, target);
29755
- logger.info(` claude: installed ${skill.name}`);
30055
+ logger3.info(` claude: installed ${skill.name}`);
29756
30056
  }
29757
30057
  async function uninstall(skillName, rootDir) {
29758
- const fs = getFileSystem3();
30058
+ const fs = getFileSystem6();
29759
30059
  const target = fs.path.join(rootDir, ".claude", "skills", skillName);
29760
30060
  if (await fs.exists(target)) {
29761
30061
  await fs.rm(target);
@@ -32412,23 +32712,23 @@ var init_js_yaml = __esm(() => {
32412
32712
 
32413
32713
  // src/commands/skills/contentStore.ts
32414
32714
  import { spawn } from "node:child_process";
32415
- import { catchError as catchError4, logger as logger2, UIPATH_HOME_DIR } from "@uipath/common";
32416
- import { getFileSystem as getFileSystem4 } from "@uipath/filesystem";
32715
+ import { catchError as catchError8, logger as logger4, UIPATH_HOME_DIR as UIPATH_HOME_DIR2 } from "@uipath/common";
32716
+ import { getFileSystem as getFileSystem7 } from "@uipath/filesystem";
32417
32717
  async function getContentStore(rootDir) {
32418
- const fs = getFileSystem4();
32718
+ const fs = getFileSystem7();
32419
32719
  const storePath = fs.path.join(rootDir, STORE_NAME);
32420
32720
  let needsClone = true;
32421
32721
  if (await fs.exists(fs.path.join(storePath, ".git"))) {
32422
- logger2.info("Updating content store...");
32423
- const [pullError] = await catchError4(runGit(["pull", "--ff-only"], storePath));
32722
+ logger4.info("Updating content store...");
32723
+ const [pullError] = await catchError8(runGit(["pull", "--ff-only"], storePath));
32424
32724
  if (pullError) {
32425
- logger2.warn("git pull failed, re-cloning...");
32725
+ logger4.warn("git pull failed, re-cloning...");
32426
32726
  } else {
32427
32727
  needsClone = false;
32428
32728
  }
32429
32729
  }
32430
32730
  if (needsClone) {
32431
- logger2.info("Downloading content store...");
32731
+ logger4.info("Downloading content store...");
32432
32732
  let savedManifest = null;
32433
32733
  const manifestPath = fs.path.join(storePath, MANIFEST_NAME);
32434
32734
  if (await fs.exists(storePath)) {
@@ -32438,9 +32738,9 @@ async function getContentStore(rootDir) {
32438
32738
  await fs.rm(storePath);
32439
32739
  }
32440
32740
  await fs.mkdir(storePath);
32441
- const [cloneError] = await catchError4(runGit(["clone", "--depth", "1", REPO_URL, storePath], rootDir));
32741
+ const [cloneError] = await catchError8(runGit(["clone", "--depth", "1", REPO_URL, storePath], rootDir));
32442
32742
  if (cloneError) {
32443
- logger2.info("git clone failed, falling back to zip download...");
32743
+ logger4.info("git clone failed, falling back to zip download...");
32444
32744
  await downloadAndExtractZip(storePath);
32445
32745
  }
32446
32746
  if (savedManifest !== null) {
@@ -32450,7 +32750,7 @@ async function getContentStore(rootDir) {
32450
32750
  return storePath;
32451
32751
  }
32452
32752
  async function readSkillDescription(fs, skillMdPath) {
32453
- const [err, content] = await catchError4(fs.readFile(skillMdPath, { encoding: "utf-8" }));
32753
+ const [err, content] = await catchError8(fs.readFile(skillMdPath, { encoding: "utf-8" }));
32454
32754
  if (err || !content)
32455
32755
  return;
32456
32756
  const head = content.length > 2048 ? content.slice(0, 2048) : content;
@@ -32458,7 +32758,7 @@ async function readSkillDescription(fs, skillMdPath) {
32458
32758
  return meta3.description;
32459
32759
  }
32460
32760
  async function getAvailableSkills(storePath) {
32461
- const fs = getFileSystem4();
32761
+ const fs = getFileSystem7();
32462
32762
  const skills = [];
32463
32763
  const rootSkillsDir = fs.path.join(storePath, "skills");
32464
32764
  if (await fs.exists(rootSkillsDir)) {
@@ -32504,7 +32804,7 @@ function parseSkillMd(content) {
32504
32804
  return { meta: meta3, body: fmMatch[2] };
32505
32805
  }
32506
32806
  async function getSkillMetadata(skillMdPath) {
32507
- const fs = getFileSystem4();
32807
+ const fs = getFileSystem7();
32508
32808
  const content = await fs.readFile(skillMdPath, { encoding: "utf-8" });
32509
32809
  if (content === null) {
32510
32810
  throw new Error(`Skill metadata not found: ${skillMdPath}`);
@@ -32512,7 +32812,7 @@ async function getSkillMetadata(skillMdPath) {
32512
32812
  return parseSkillMd(content);
32513
32813
  }
32514
32814
  function rewriteBody(body, skillDir, targetDir) {
32515
- const fs = getFileSystem4();
32815
+ const fs = getFileSystem7();
32516
32816
  const relFromTarget = fs.path.relative(targetDir, skillDir).split("\\").join("/");
32517
32817
  return body.replace(/(\[.*?\]\()(?!https?:\/\/|\/)([^)]+?)(\))/g, (_match, prefix, relPath, suffix) => {
32518
32818
  const rewritten = [relFromTarget, relPath].join("/").replace(/\/+/g, "/");
@@ -32522,7 +32822,7 @@ function rewriteBody(body, skillDir, targetDir) {
32522
32822
  async function setMarkedBlock(filePath, marker, content, commentStyle = "hash") {
32523
32823
  const startTag = commentStyle === "html" ? `<!-- ${marker} START -->` : `# ${marker} START`;
32524
32824
  const endTag = commentStyle === "html" ? `<!-- ${marker} END -->` : `# ${marker} END`;
32525
- const fs = getFileSystem4();
32825
+ const fs = getFileSystem7();
32526
32826
  const block = `${startTag}
32527
32827
  ${content}
32528
32828
  ${endTag}`;
@@ -32541,7 +32841,7 @@ ${endTag}`;
32541
32841
  }
32542
32842
  }
32543
32843
  async function removeMarkedBlock(filePath, marker, commentStyle = "hash") {
32544
- const fs = getFileSystem4();
32844
+ const fs = getFileSystem7();
32545
32845
  const startTag = commentStyle === "html" ? `<!-- ${marker} START -->` : `# ${marker} START`;
32546
32846
  const endTag = commentStyle === "html" ? `<!-- ${marker} END -->` : `# ${marker} END`;
32547
32847
  const existing = await fs.readFile(filePath, { encoding: "utf-8" });
@@ -32558,7 +32858,7 @@ async function removeMarkedBlock(filePath, marker, commentStyle = "hash") {
32558
32858
  await fs.writeFile(filePath, updated);
32559
32859
  }
32560
32860
  async function addToGitignore(rootDir, entry) {
32561
- const fs = getFileSystem4();
32861
+ const fs = getFileSystem7();
32562
32862
  const gitignorePath = fs.path.join(rootDir, ".gitignore");
32563
32863
  const content = await fs.readFile(gitignorePath, { encoding: "utf-8" }) ?? "";
32564
32864
  const lines = content.split(`
@@ -32572,19 +32872,19 @@ async function addToGitignore(rootDir, entry) {
32572
32872
  }
32573
32873
  }
32574
32874
  async function readManifest(storePath) {
32575
- const fs = getFileSystem4();
32875
+ const fs = getFileSystem7();
32576
32876
  const manifestPath = fs.path.join(storePath, MANIFEST_NAME);
32577
32877
  const content = await fs.readFile(manifestPath, { encoding: "utf-8" });
32578
32878
  if (content === null) {
32579
32879
  return { skills: {} };
32580
32880
  }
32581
- const [parseError, parsed] = catchError4(() => JSON.parse(content));
32881
+ const [parseError, parsed] = catchError8(() => JSON.parse(content));
32582
32882
  if (parseError)
32583
32883
  return { skills: {} };
32584
32884
  return parsed;
32585
32885
  }
32586
32886
  async function writeManifest(storePath, manifest) {
32587
- const fs = getFileSystem4();
32887
+ const fs = getFileSystem7();
32588
32888
  const manifestPath = fs.path.join(storePath, MANIFEST_NAME);
32589
32889
  await fs.writeFile(manifestPath, `${JSON.stringify(manifest, null, 4)}
32590
32890
  `);
@@ -32650,7 +32950,7 @@ function runGit(args, cwd) {
32650
32950
  });
32651
32951
  }
32652
32952
  async function downloadAndExtractZip(storePath) {
32653
- const fs = getFileSystem4();
32953
+ const fs = getFileSystem7();
32654
32954
  const response = await fetch(ZIP_URL, {
32655
32955
  signal: AbortSignal.timeout(60000)
32656
32956
  });
@@ -32692,7 +32992,7 @@ async function downloadAndExtractZip(storePath) {
32692
32992
  var REPO_URL = "https://github.com/UiPath/skills.git", ZIP_URL = "https://github.com/UiPath/skills/archive/refs/heads/main.zip", STORE_NAME, MANIFEST_NAME = "manifest.json";
32693
32993
  var init_contentStore = __esm(() => {
32694
32994
  init_js_yaml();
32695
- STORE_NAME = `${UIPATH_HOME_DIR}/.skills`;
32995
+ STORE_NAME = `${UIPATH_HOME_DIR2}/.skills`;
32696
32996
  });
32697
32997
 
32698
32998
  // src/commands/skills/agents/codex.ts
@@ -32701,10 +33001,10 @@ __export(exports_codex, {
32701
33001
  uninstall: () => uninstall2,
32702
33002
  install: () => install2
32703
33003
  });
32704
- import { logger as logger3 } from "@uipath/common";
32705
- import { getFileSystem as getFileSystem5 } from "@uipath/filesystem";
33004
+ import { logger as logger5 } from "@uipath/common";
33005
+ import { getFileSystem as getFileSystem8 } from "@uipath/filesystem";
32706
33006
  async function install2(skill, rootDir) {
32707
- const fs = getFileSystem5();
33007
+ const fs = getFileSystem8();
32708
33008
  const isGlobal = fs.path.resolve(rootDir) === fs.path.resolve(fs.env.homedir());
32709
33009
  const targetFile = isGlobal ? fs.path.join(rootDir, ".codex", "instructions.md") : fs.path.join(rootDir, "codex.md");
32710
33010
  await fs.mkdir(fs.path.dirname(targetFile));
@@ -32713,10 +33013,10 @@ async function install2(skill, rootDir) {
32713
33013
  const marker = `uipath-skill:${skill.name}`;
32714
33014
  const content = `See ${relPath} for ${skill.name} instructions.`;
32715
33015
  await setMarkedBlock(targetFile, marker, content, "html");
32716
- logger3.info(` codex: installed ${skill.name}`);
33016
+ logger5.info(` codex: installed ${skill.name}`);
32717
33017
  }
32718
33018
  async function uninstall2(skillName, rootDir) {
32719
- const fs = getFileSystem5();
33019
+ const fs = getFileSystem8();
32720
33020
  const isGlobal = fs.path.resolve(rootDir) === fs.path.resolve(fs.env.homedir());
32721
33021
  const targetFile = isGlobal ? fs.path.join(rootDir, ".codex", "instructions.md") : fs.path.join(rootDir, "codex.md");
32722
33022
  const marker = `uipath-skill:${skillName}`;
@@ -32732,10 +33032,10 @@ __export(exports_copilot, {
32732
33032
  uninstall: () => uninstall3,
32733
33033
  install: () => install3
32734
33034
  });
32735
- import { logger as logger4 } from "@uipath/common";
32736
- import { getFileSystem as getFileSystem6 } from "@uipath/filesystem";
33035
+ import { logger as logger6 } from "@uipath/common";
33036
+ import { getFileSystem as getFileSystem9 } from "@uipath/filesystem";
32737
33037
  async function install3(skill, rootDir) {
32738
- const fs = getFileSystem6();
33038
+ const fs = getFileSystem9();
32739
33039
  const skillMdPath = fs.path.join(skill.skillDir, "SKILL.md");
32740
33040
  const { meta: meta3, body } = await getSkillMetadata(skillMdPath);
32741
33041
  const targetDir = fs.path.join(rootDir, ".github", "instructions");
@@ -32746,10 +33046,10 @@ applyTo: "${Array.isArray(meta3.globs) ? meta3.globs.join(", ") : meta3.globs}"
32746
33046
  ---
32747
33047
  ` : "";
32748
33048
  await fs.writeFile(fs.path.join(targetDir, `${skill.name}.instructions.md`), header + rewritten);
32749
- logger4.info(` copilot: installed ${skill.name}`);
33049
+ logger6.info(` copilot: installed ${skill.name}`);
32750
33050
  }
32751
33051
  async function uninstall3(skillName, rootDir) {
32752
- const fs = getFileSystem6();
33052
+ const fs = getFileSystem9();
32753
33053
  const target = fs.path.join(rootDir, ".github", "instructions", `${skillName}.instructions.md`);
32754
33054
  if (await fs.exists(target)) {
32755
33055
  await fs.rm(target);
@@ -32765,10 +33065,10 @@ __export(exports_cursor, {
32765
33065
  uninstall: () => uninstall4,
32766
33066
  install: () => install4
32767
33067
  });
32768
- import { logger as logger5 } from "@uipath/common";
32769
- import { getFileSystem as getFileSystem7 } from "@uipath/filesystem";
33068
+ import { logger as logger7 } from "@uipath/common";
33069
+ import { getFileSystem as getFileSystem10 } from "@uipath/filesystem";
32770
33070
  async function install4(skill, rootDir) {
32771
- const fs = getFileSystem7();
33071
+ const fs = getFileSystem10();
32772
33072
  const skillMdPath = fs.path.join(skill.skillDir, "SKILL.md");
32773
33073
  const { meta: meta3, body } = await getSkillMetadata(skillMdPath);
32774
33074
  const targetDir = fs.path.join(rootDir, ".cursor", "rules");
@@ -32776,10 +33076,10 @@ async function install4(skill, rootDir) {
32776
33076
  const rewritten = rewriteBody(body, skill.skillDir, targetDir);
32777
33077
  const mdc = buildMdc(skill.name, meta3, rewritten);
32778
33078
  await fs.writeFile(fs.path.join(targetDir, `${skill.name}.mdc`), mdc);
32779
- logger5.info(` cursor: installed ${skill.name}`);
33079
+ logger7.info(` cursor: installed ${skill.name}`);
32780
33080
  }
32781
33081
  async function uninstall4(skillName, rootDir) {
32782
- const fs = getFileSystem7();
33082
+ const fs = getFileSystem10();
32783
33083
  const target = fs.path.join(rootDir, ".cursor", "rules", `${skillName}.mdc`);
32784
33084
  if (await fs.exists(target)) {
32785
33085
  await fs.rm(target);
@@ -32810,10 +33110,10 @@ __export(exports_gemini, {
32810
33110
  uninstall: () => uninstall5,
32811
33111
  install: () => install5
32812
33112
  });
32813
- import { logger as logger6 } from "@uipath/common";
32814
- import { getFileSystem as getFileSystem8 } from "@uipath/filesystem";
33113
+ import { logger as logger8 } from "@uipath/common";
33114
+ import { getFileSystem as getFileSystem11 } from "@uipath/filesystem";
32815
33115
  async function install5(skill, rootDir) {
32816
- const fs = getFileSystem8();
33116
+ const fs = getFileSystem11();
32817
33117
  const geminiDir = fs.path.join(rootDir, ".gemini");
32818
33118
  const geminiMd = fs.path.join(geminiDir, "GEMINI.md");
32819
33119
  await fs.mkdir(geminiDir);
@@ -32822,10 +33122,10 @@ async function install5(skill, rootDir) {
32822
33122
  const marker = `uipath-skill:${skill.name}`;
32823
33123
  const content = `@import ${relPath}`;
32824
33124
  await setMarkedBlock(geminiMd, marker, content, "html");
32825
- logger6.info(` gemini: installed ${skill.name}`);
33125
+ logger8.info(` gemini: installed ${skill.name}`);
32826
33126
  }
32827
33127
  async function uninstall5(skillName, rootDir) {
32828
- const fs = getFileSystem8();
33128
+ const fs = getFileSystem11();
32829
33129
  const geminiMd = fs.path.join(rootDir, ".gemini", "GEMINI.md");
32830
33130
  const marker = `uipath-skill:${skillName}`;
32831
33131
  await removeMarkedBlock(geminiMd, marker, "html");
@@ -34756,23 +35056,23 @@ var init_prompt = __esm(() => {
34756
35056
  });
34757
35057
 
34758
35058
  // src/commands/skills/skillsService.ts
34759
- import { catchError as catchError5, logger as logger7, OutputFormatter as OutputFormatter3 } from "@uipath/common";
34760
- import { getFileSystem as getFileSystem9 } from "@uipath/filesystem";
35059
+ import { catchError as catchError9, logger as logger9, OutputFormatter as OutputFormatter4 } from "@uipath/common";
35060
+ import { getFileSystem as getFileSystem12 } from "@uipath/filesystem";
34761
35061
  function handlePromptCancellation(err, operation) {
34762
35062
  if (err instanceof Error && err.name === "ExitPromptError") {
34763
- logger7.warn(`${operation.charAt(0).toUpperCase() + operation.slice(1)} cancelled.`);
35063
+ logger9.warn(`${operation.charAt(0).toUpperCase() + operation.slice(1)} cancelled.`);
34764
35064
  throw Object.assign(new Error("cancelled"), { exitCode: 130 });
34765
35065
  }
34766
35066
  throw err;
34767
35067
  }
34768
35068
  async function resolveSkillsContext(options, operation) {
34769
35069
  const isLocal = !!options.local;
34770
- const fs = getFileSystem9();
35070
+ const fs = getFileSystem12();
34771
35071
  const rootDir = isLocal ? fs.env.cwd() : fs.env.homedir();
34772
35072
  const storePath = await getContentStore(rootDir);
34773
35073
  const availableSkills = await getAvailableSkills(storePath);
34774
35074
  if (availableSkills.length === 0) {
34775
- OutputFormatter3.error({
35075
+ OutputFormatter4.error({
34776
35076
  Result: "Failure",
34777
35077
  Message: "No skills found in content store.",
34778
35078
  Instructions: "Check that the skills repository contains skills in the skills/ directory."
@@ -34782,7 +35082,7 @@ async function resolveSkillsContext(options, operation) {
34782
35082
  }
34783
35083
  let selectedSkills = availableSkills;
34784
35084
  if (!options.skills && !options.agents) {
34785
- const [skillErr, chosen] = await catchError5(promptSkillSelection(availableSkills, operation));
35085
+ const [skillErr, chosen] = await catchError9(promptSkillSelection(availableSkills, operation));
34786
35086
  if (skillErr)
34787
35087
  handlePromptCancellation(skillErr, operation);
34788
35088
  selectedSkills = availableSkills.filter((s) => chosen.includes(s.name));
@@ -34801,7 +35101,7 @@ async function resolveSkillsContext(options, operation) {
34801
35101
  if (neverSeen.length > 0) {
34802
35102
  parts.push(`Unknown skills: ${neverSeen.join(", ")}`);
34803
35103
  }
34804
- OutputFormatter3.error({
35104
+ OutputFormatter4.error({
34805
35105
  Result: "Failure",
34806
35106
  Message: parts.join(" "),
34807
35107
  Instructions: `Available skills: ${availableNames.join(", ")}`
@@ -34816,7 +35116,7 @@ async function resolveSkillsContext(options, operation) {
34816
35116
  agents = options.agents.split(",").map((s) => s.trim().toLowerCase());
34817
35117
  const unknown3 = agents.filter((a) => !ALL_AGENTS.includes(a));
34818
35118
  if (unknown3.length > 0) {
34819
- OutputFormatter3.error({
35119
+ OutputFormatter4.error({
34820
35120
  Result: "Failure",
34821
35121
  Message: `Unknown agents: ${unknown3.join(", ")}`,
34822
35122
  Instructions: `Available agents: ${ALL_AGENTS.join(", ")}`
@@ -34825,7 +35125,7 @@ async function resolveSkillsContext(options, operation) {
34825
35125
  return null;
34826
35126
  }
34827
35127
  } else {
34828
- const [agentErr, selected] = await catchError5(promptAgentSelection(operation));
35128
+ const [agentErr, selected] = await catchError9(promptAgentSelection(operation));
34829
35129
  if (agentErr)
34830
35130
  handlePromptCancellation(agentErr, operation);
34831
35131
  agents = selected;
@@ -34838,9 +35138,9 @@ async function runAgentInstalls(resolved) {
34838
35138
  for (const agent of agents) {
34839
35139
  const handler = getAgentHandler(agent);
34840
35140
  for (const skill of selectedSkills) {
34841
- const [installError] = await catchError5(handler.install(skill, rootDir));
35141
+ const [installError] = await catchError9(handler.install(skill, rootDir));
34842
35142
  if (installError) {
34843
- OutputFormatter3.error({
35143
+ OutputFormatter4.error({
34844
35144
  Result: "Failure",
34845
35145
  Message: `Failed to install ${skill.name} for ${agent}: ${installError.message}`,
34846
35146
  Instructions: "Check that the content store is intact and you have write permissions."
@@ -34851,9 +35151,9 @@ async function runAgentInstalls(resolved) {
34851
35151
  installed.push(`${agent}:${skill.name}`);
34852
35152
  }
34853
35153
  }
34854
- const [manifestError] = await catchError5(updateManifestAfterInstall(storePath, selectedSkills.map((s) => s.name), agents));
35154
+ const [manifestError] = await catchError9(updateManifestAfterInstall(storePath, selectedSkills.map((s) => s.name), agents));
34855
35155
  if (manifestError) {
34856
- OutputFormatter3.error({
35156
+ OutputFormatter4.error({
34857
35157
  Result: "Failure",
34858
35158
  Message: `Failed to update manifest: ${manifestError.message}`,
34859
35159
  Instructions: "Check that the content store is intact and you have write permissions."
@@ -34862,9 +35162,9 @@ async function runAgentInstalls(resolved) {
34862
35162
  return null;
34863
35163
  }
34864
35164
  if (isLocal) {
34865
- const [gitignoreError] = await catchError5(addToGitignore(rootDir, `${STORE_NAME}/`));
35165
+ const [gitignoreError] = await catchError9(addToGitignore(rootDir, `${STORE_NAME}/`));
34866
35166
  if (gitignoreError) {
34867
- OutputFormatter3.error({
35167
+ OutputFormatter4.error({
34868
35168
  Result: "Failure",
34869
35169
  Message: `Failed to update .gitignore: ${gitignoreError.message}`,
34870
35170
  Instructions: "Check that you have write permissions to the project directory."
@@ -34882,17 +35182,17 @@ var init_skillsService = __esm(() => {
34882
35182
  });
34883
35183
 
34884
35184
  // src/commands/skills/install.ts
34885
- import { catchError as catchError6, OutputFormatter as OutputFormatter4, processContext as processContext2 } from "@uipath/common";
35185
+ import { catchError as catchError10, OutputFormatter as OutputFormatter5, processContext as processContext2 } from "@uipath/common";
34886
35186
  function registerInstallCommand(skillsCommand) {
34887
35187
  skillsCommand.command("install").description("Download skills from UiPath and install them for your coding agents.").option("--agents <agents>", "Target agents: claude, cursor, copilot, gemini, codex (comma-separated)").option("--skills <skills>", "Specific skills to install (comma-separated)").option("--local", "Install to current project instead of globally").trackedAction(processContext2, async (options) => {
34888
- const [contextError, resolved] = await catchError6(resolveSkillsContext(options, "install"));
35188
+ const [contextError, resolved] = await catchError10(resolveSkillsContext(options, "install"));
34889
35189
  if (contextError || !resolved) {
34890
35190
  if (contextError) {
34891
35191
  if (contextError.exitCode === 130) {
34892
35192
  processContext2.exit(130);
34893
35193
  return;
34894
35194
  }
34895
- OutputFormatter4.error({
35195
+ OutputFormatter5.error({
34896
35196
  Result: "Failure",
34897
35197
  Message: `Failed to install skills: ${contextError.message}`,
34898
35198
  Instructions: "Check network connectivity and try again. Ensure git is installed. For zip-based installs, make sure PowerShell (on Windows) or the 'unzip' command (on macOS/Linux) is available."
@@ -34904,7 +35204,7 @@ function registerInstallCommand(skillsCommand) {
34904
35204
  const installed = await runAgentInstalls(resolved);
34905
35205
  if (!installed)
34906
35206
  return;
34907
- OutputFormatter4.success({
35207
+ OutputFormatter5.success({
34908
35208
  Result: "Success",
34909
35209
  Code: "SkillsInstall",
34910
35210
  Data: {
@@ -34922,15 +35222,15 @@ var init_install = __esm(() => {
34922
35222
 
34923
35223
  // src/commands/skills/uninstall.ts
34924
35224
  import {
34925
- catchError as catchError7,
34926
- logger as logger8,
34927
- OutputFormatter as OutputFormatter5,
35225
+ catchError as catchError11,
35226
+ logger as logger10,
35227
+ OutputFormatter as OutputFormatter6,
34928
35228
  processContext as processContext3
34929
35229
  } from "@uipath/common";
34930
- import { getFileSystem as getFileSystem10 } from "@uipath/filesystem";
35230
+ import { getFileSystem as getFileSystem13 } from "@uipath/filesystem";
34931
35231
  function registerUninstallCommand(skillsCommand) {
34932
35232
  skillsCommand.command("uninstall").description("Remove previously installed skills from agent configurations.").option("--agents <agents>", "Target agents: claude, cursor, copilot, gemini, codex (comma-separated)").option("--skills <skills>", "Specific skills to uninstall (comma-separated)").option("--local", "Uninstall from current project instead of globally").trackedAction(processContext3, async (options) => {
34933
- const [contextError, resolved] = await catchError7(resolveSkillsContext(options, "uninstall"));
35233
+ const [contextError, resolved] = await catchError11(resolveSkillsContext(options, "uninstall"));
34934
35234
  const isLocal = !!options.local;
34935
35235
  let rootDir;
34936
35236
  let storePath;
@@ -34941,7 +35241,7 @@ function registerUninstallCommand(skillsCommand) {
34941
35241
  processContext3.exit(130);
34942
35242
  return;
34943
35243
  }
34944
- OutputFormatter5.error({
35244
+ OutputFormatter6.error({
34945
35245
  Result: "Failure",
34946
35246
  Message: `Failed to uninstall skills: ${contextError.message}`,
34947
35247
  Instructions: "Check network connectivity and try again. Ensure git is installed."
@@ -34958,14 +35258,14 @@ function registerUninstallCommand(skillsCommand) {
34958
35258
  if (!options.skills || !options.agents) {
34959
35259
  return;
34960
35260
  }
34961
- const fs = getFileSystem10();
35261
+ const fs = getFileSystem13();
34962
35262
  rootDir = isLocal ? fs.env.cwd() : fs.env.homedir();
34963
35263
  storePath = fs.path.join(rootDir, STORE_NAME);
34964
35264
  const manifest = await readManifest(storePath);
34965
35265
  const requested = options.skills.split(",").map((s) => s.trim());
34966
35266
  const inManifest = requested.filter((s) => manifest.skills[s]);
34967
35267
  if (inManifest.length === 0) {
34968
- OutputFormatter5.error({
35268
+ OutputFormatter6.error({
34969
35269
  Result: "Failure",
34970
35270
  Message: `Skills not found in manifest: ${requested.join(", ")}`,
34971
35271
  Instructions: "These skills are not currently installed. Use 'uipath skills install' to install them first."
@@ -34977,7 +35277,7 @@ function registerUninstallCommand(skillsCommand) {
34977
35277
  agents = options.agents.split(",").map((s) => s.trim().toLowerCase());
34978
35278
  const unknownAgents = agents.filter((a) => !ALL_AGENTS.includes(a));
34979
35279
  if (unknownAgents.length > 0) {
34980
- OutputFormatter5.error({
35280
+ OutputFormatter6.error({
34981
35281
  Result: "Failure",
34982
35282
  Message: `Unknown agents: ${unknownAgents.join(", ")}`,
34983
35283
  Instructions: `Available agents: ${ALL_AGENTS.join(", ")}`
@@ -34985,15 +35285,15 @@ function registerUninstallCommand(skillsCommand) {
34985
35285
  processContext3.exit(1);
34986
35286
  return;
34987
35287
  }
34988
- logger8.info(`Uninstalling skills from manifest: ${inManifest.join(", ")}`);
35288
+ logger10.info(`Uninstalling skills from manifest: ${inManifest.join(", ")}`);
34989
35289
  }
34990
35290
  const uninstalled = [];
34991
35291
  for (const agent of agents) {
34992
35292
  const handler = getAgentHandler(agent);
34993
35293
  for (const name of skillNames) {
34994
- const [uninstallError] = await catchError7(handler.uninstall(name, rootDir));
35294
+ const [uninstallError] = await catchError11(handler.uninstall(name, rootDir));
34995
35295
  if (uninstallError) {
34996
- OutputFormatter5.error({
35296
+ OutputFormatter6.error({
34997
35297
  Result: "Failure",
34998
35298
  Message: `Failed to uninstall ${name} for ${agent}: ${uninstallError.message}`,
34999
35299
  Instructions: "Check that the skill files exist and you have write permissions."
@@ -35005,7 +35305,7 @@ function registerUninstallCommand(skillsCommand) {
35005
35305
  }
35006
35306
  }
35007
35307
  await removeFromManifest(storePath, skillNames, agents);
35008
- OutputFormatter5.success({
35308
+ OutputFormatter6.success({
35009
35309
  Result: "Success",
35010
35310
  Code: "SkillsUninstall",
35011
35311
  Data: {
@@ -35026,21 +35326,21 @@ var init_uninstall = __esm(() => {
35026
35326
 
35027
35327
  // src/commands/skills/update.ts
35028
35328
  import {
35029
- catchError as catchError8,
35030
- logger as logger9,
35031
- OutputFormatter as OutputFormatter6,
35329
+ catchError as catchError12,
35330
+ logger as logger11,
35331
+ OutputFormatter as OutputFormatter7,
35032
35332
  processContext as processContext4
35033
35333
  } from "@uipath/common";
35034
35334
  function registerUpdateCommand(skillsCommand) {
35035
35335
  skillsCommand.command("update").description("Re-fetch skills from UiPath and reinstall to get the latest versions.").option("--agents <agents>", "Target agents: claude, cursor, copilot, gemini, codex (comma-separated)").option("--skills <skills>", "Specific skills to update (comma-separated)").option("--local", "Update in current project instead of globally").trackedAction(processContext4, async (options) => {
35036
- const [contextError, resolved] = await catchError8(resolveSkillsContext(options, "update"));
35336
+ const [contextError, resolved] = await catchError12(resolveSkillsContext(options, "update"));
35037
35337
  if (contextError || !resolved) {
35038
35338
  if (contextError) {
35039
35339
  if (contextError.exitCode === 130) {
35040
35340
  processContext4.exit(130);
35041
35341
  return;
35042
35342
  }
35043
- OutputFormatter6.error({
35343
+ OutputFormatter7.error({
35044
35344
  Result: "Failure",
35045
35345
  Message: `Failed to update skills: ${contextError.message}`,
35046
35346
  Instructions: "Check network connectivity and try again. Ensure git is installed. On Windows, ensure PowerShell is available. On macOS/Linux, ensure the 'unzip' utility is installed."
@@ -35050,20 +35350,20 @@ function registerUpdateCommand(skillsCommand) {
35050
35350
  return;
35051
35351
  }
35052
35352
  if (!options.skills) {
35053
- const [manifestErr, manifest] = await catchError8(readManifest(resolved.storePath));
35054
- const [skillsErr, availableSkills] = await catchError8(getAvailableSkills(resolved.storePath));
35353
+ const [manifestErr, manifest] = await catchError12(readManifest(resolved.storePath));
35354
+ const [skillsErr, availableSkills] = await catchError12(getAvailableSkills(resolved.storePath));
35055
35355
  if (!manifestErr && !skillsErr && availableSkills) {
35056
35356
  const availableNames = availableSkills.map((s) => s.name);
35057
35357
  const removed = Object.keys(manifest.skills).filter((s) => !availableNames.includes(s));
35058
35358
  if (removed.length > 0) {
35059
- logger9.warn(`Previously installed skills no longer available: ${removed.join(", ")}. They may have been removed or renamed. Use 'uipath skills uninstall --skills ${removed.join(",")}' to clean up.`);
35359
+ logger11.warn(`Previously installed skills no longer available: ${removed.join(", ")}. They may have been removed or renamed. Use 'uipath skills uninstall --skills ${removed.join(",")}' to clean up.`);
35060
35360
  }
35061
35361
  }
35062
35362
  }
35063
35363
  const updated = await runAgentInstalls(resolved);
35064
35364
  if (!updated)
35065
35365
  return;
35066
- OutputFormatter6.success({
35366
+ OutputFormatter7.success({
35067
35367
  Result: "Success",
35068
35368
  Code: "SkillsUpdate",
35069
35369
  Data: {
@@ -35113,15 +35413,15 @@ var exports_npmrc = {};
35113
35413
  __export(exports_npmrc, {
35114
35414
  findNpmrcConfig: () => findNpmrcConfig
35115
35415
  });
35116
- import { catchError as catchError9, logger as logger10 } from "@uipath/common";
35117
- import { getFileSystem as getFileSystem11 } from "@uipath/filesystem";
35416
+ import { catchError as catchError13, logger as logger12 } from "@uipath/common";
35417
+ import { getFileSystem as getFileSystem14 } from "@uipath/filesystem";
35118
35418
  function expandEnvVars(raw) {
35119
35419
  let hasMissing = false;
35120
35420
  const expanded = raw.replace(/\$\{([^}]+)\}/g, (_, v) => {
35121
35421
  const val = process.env[v];
35122
35422
  if (val === undefined) {
35123
35423
  hasMissing = true;
35124
- logger10.warn(`Warning: .npmrc references \${${v}} but it is not set.`);
35424
+ logger12.warn(`Warning: .npmrc references \${${v}} but it is not set.`);
35125
35425
  return "";
35126
35426
  }
35127
35427
  return val;
@@ -35154,13 +35454,13 @@ function parseNpmrc(content) {
35154
35454
  return result;
35155
35455
  }
35156
35456
  function registryHost(url2) {
35157
- const [error48, parsed] = catchError9(() => new URL(url2));
35457
+ const [error48, parsed] = catchError13(() => new URL(url2));
35158
35458
  if (error48)
35159
35459
  return;
35160
35460
  return parsed.host;
35161
35461
  }
35162
35462
  async function findNpmrcConfig() {
35163
- const fs = getFileSystem11();
35463
+ const fs = getFileSystem14();
35164
35464
  const paths = [];
35165
35465
  let dir = fs.env.cwd();
35166
35466
  for (let i2 = 0;i2 < 20; i2++) {
@@ -35171,29 +35471,29 @@ async function findNpmrcConfig() {
35171
35471
  dir = parent;
35172
35472
  }
35173
35473
  paths.push(fs.path.join(fs.env.homedir(), ".npmrc"));
35174
- logger10.debug(`Searching for .npmrc in ${paths.length} locations`);
35474
+ logger12.debug(`Searching for .npmrc in ${paths.length} locations`);
35175
35475
  let scopedRegistry;
35176
35476
  let prefix;
35177
35477
  const allTokensByHost = new Map;
35178
35478
  for (const p of paths) {
35179
- const [readError, content] = await catchError9(fs.readFile(p, "utf-8"));
35479
+ const [readError, content] = await catchError13(fs.readFile(p, "utf-8"));
35180
35480
  if (readError) {
35181
35481
  continue;
35182
35482
  }
35183
- logger10.debug(`Found .npmrc at ${p}`);
35483
+ logger12.debug(`Found .npmrc at ${p}`);
35184
35484
  if (!content)
35185
35485
  continue;
35186
35486
  const parsed = parseNpmrc(content);
35187
35487
  if (parsed.scopedRegistry && !scopedRegistry) {
35188
35488
  scopedRegistry = parsed.scopedRegistry;
35189
- logger10.debug(`@uipath:registry = ${scopedRegistry} (from ${p})`);
35489
+ logger12.debug(`@uipath:registry = ${scopedRegistry} (from ${p})`);
35190
35490
  }
35191
35491
  if (parsed.prefix && !prefix)
35192
35492
  prefix = parsed.prefix;
35193
35493
  for (const [host, token] of parsed.tokensByHost) {
35194
35494
  if (!allTokensByHost.has(host)) {
35195
35495
  allTokensByHost.set(host, token);
35196
- logger10.debug(`Auth token found for host '${host}' (from ${p})`);
35496
+ logger12.debug(`Auth token found for host '${host}' (from ${p})`);
35197
35497
  }
35198
35498
  }
35199
35499
  }
@@ -35210,12 +35510,12 @@ var init_npmrc = () => {};
35210
35510
 
35211
35511
  // src/services/toolService.ts
35212
35512
  import {
35213
- catchError as catchError10,
35214
- DEFAULT_FETCH_TIMEOUT_MS,
35513
+ catchError as catchError14,
35514
+ DEFAULT_FETCH_TIMEOUT_MS as DEFAULT_FETCH_TIMEOUT_MS2,
35215
35515
  extractErrorMessageSync,
35216
- logger as logger11
35516
+ logger as logger13
35217
35517
  } from "@uipath/common";
35218
- import { getFileSystem as getFileSystem12 } from "@uipath/filesystem";
35518
+ import { getFileSystem as getFileSystem15 } from "@uipath/filesystem";
35219
35519
  function isValidSemver(v) {
35220
35520
  return SEMVER_RE.test(v);
35221
35521
  }
@@ -35291,8 +35591,8 @@ function parsePackageSpec(spec) {
35291
35591
  };
35292
35592
  }
35293
35593
  async function isDevMode() {
35294
- const [error48, result] = await catchError10((async () => {
35295
- const fs = getFileSystem12();
35594
+ const [error48, result] = await catchError14((async () => {
35595
+ const fs = getFileSystem15();
35296
35596
  let dir = fs.env.cwd();
35297
35597
  for (let i2 = 0;i2 < 10; i2++) {
35298
35598
  const pkgPath = fs.path.join(dir, "package.json");
@@ -35303,7 +35603,7 @@ async function isDevMode() {
35303
35603
  if (pkg.workspaces && pkg.private) {
35304
35604
  const bunLockPath = fs.path.join(dir, "bun.lock");
35305
35605
  if (await fs.exists(bunLockPath)) {
35306
- logger11.debug(`Dev mode detected — found monorepo root at ${dir}`);
35606
+ logger13.debug(`Dev mode detected — found monorepo root at ${dir}`);
35307
35607
  return true;
35308
35608
  }
35309
35609
  }
@@ -35317,12 +35617,12 @@ async function isDevMode() {
35317
35617
  return false;
35318
35618
  })());
35319
35619
  if (error48) {
35320
- logger11.debug("Dev mode not detected — using npm");
35620
+ logger13.debug("Dev mode not detected — using npm");
35321
35621
  return false;
35322
35622
  }
35323
35623
  if (result)
35324
35624
  return true;
35325
- logger11.debug("Dev mode not detected — using npm");
35625
+ logger13.debug("Dev mode not detected — using npm");
35326
35626
  return false;
35327
35627
  }
35328
35628
  async function runPackageManager(args, cwd) {
@@ -35335,7 +35635,7 @@ async function runPackageManager(args, cwd) {
35335
35635
  const isWindows = process.platform === "win32";
35336
35636
  const useBun = await isDevMode();
35337
35637
  const pm = useBun ? "bun" : "npm";
35338
- logger11.debug(`Running package manager: ${pm} ${args.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
35638
+ logger13.debug(`Running package manager: ${pm} ${args.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
35339
35639
  const pmArgs = useBun ? args.filter((a) => a !== "-g").map((a) => a === "uninstall" ? "remove" : a) : args;
35340
35640
  return new Promise((resolve, reject) => {
35341
35641
  const proc = isWindows ? spawn2([pm, ...pmArgs].map((a) => a.includes(" ") ? `"${a}"` : a).join(" "), [], {
@@ -35349,7 +35649,7 @@ async function runPackageManager(args, cwd) {
35349
35649
  let stderr = "";
35350
35650
  const MAX_STDERR = 65536;
35351
35651
  proc.stdout?.on("data", (d) => {
35352
- logger11.info(d.toString().trimEnd());
35652
+ logger13.info(d.toString().trimEnd());
35353
35653
  });
35354
35654
  proc.stderr?.on("data", (d) => {
35355
35655
  if (stderr.length < MAX_STDERR) {
@@ -35371,20 +35671,20 @@ async function runPackageManager(args, cwd) {
35371
35671
  });
35372
35672
  }
35373
35673
  async function resolveRegistry() {
35374
- logger11.debug("Resolving npm registry for @uipath packages...");
35674
+ logger13.debug("Resolving npm registry for @uipath packages...");
35375
35675
  const { findNpmrcConfig: findNpmrcConfig2 } = await Promise.resolve().then(() => (init_npmrc(), exports_npmrc));
35376
35676
  const config2 = await findNpmrcConfig2();
35377
35677
  const registryUrl = config2.scopedRegistry || DEFAULT_REGISTRY;
35378
- logger11.debug(`Registry URL: ${registryUrl}${config2.scopedRegistry ? " (from .npmrc)" : " (default)"}`);
35379
- const [urlError] = catchError10(() => new URL(registryUrl));
35678
+ logger13.debug(`Registry URL: ${registryUrl}${config2.scopedRegistry ? " (from .npmrc)" : " (default)"}`);
35679
+ const [urlError] = catchError14(() => new URL(registryUrl));
35380
35680
  if (urlError) {
35381
35681
  throw new Error(`Invalid @uipath:registry URL in .npmrc: "${registryUrl}"`);
35382
35682
  }
35383
35683
  const envToken = globalThis.process?.env?.GH_NPM_REGISTRY_TOKEN;
35384
35684
  const authToken = envToken || config2.authToken || undefined;
35385
- logger11.debug(`Auth token: ${authToken ? `found (source: ${envToken ? "GH_NPM_REGISTRY_TOKEN env" : ".npmrc"})` : "not found"}`);
35685
+ logger13.debug(`Auth token: ${authToken ? `found (source: ${envToken ? "GH_NPM_REGISTRY_TOKEN env" : ".npmrc"})` : "not found"}`);
35386
35686
  if (authToken && !config2.scopedRegistry) {
35387
- logger11.warn("Auth token found but no @uipath:registry configured in .npmrc — " + "token will be sent to the default registry (npmjs.org)");
35687
+ logger13.warn("Auth token found but no @uipath:registry configured in .npmrc — " + "token will be sent to the default registry (npmjs.org)");
35388
35688
  }
35389
35689
  return { registryUrl, authToken };
35390
35690
  }
@@ -35393,14 +35693,14 @@ class NodeToolService {
35393
35693
  async fetchPackageInfo(registryUrl, packageName, headers) {
35394
35694
  const encodedName = packageName.replaceAll("/", "%2f");
35395
35695
  const url2 = `${registryUrl.replace(/\/+$/, "")}/${encodedName}`;
35396
- logger11.debug(`Fetching package info: ${url2}`);
35696
+ logger13.debug(`Fetching package info: ${url2}`);
35397
35697
  const fetchHeaders = {
35398
35698
  Accept: "application/json",
35399
35699
  ...headers
35400
35700
  };
35401
35701
  const response = await fetch(url2, {
35402
35702
  headers: fetchHeaders,
35403
- signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS)
35703
+ signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS2)
35404
35704
  });
35405
35705
  if (response.status === 401 || response.status === 403) {
35406
35706
  throw new Error(`Registry ${registryUrl} returned ${response.status} for ${packageName} (authentication required)`);
@@ -35410,10 +35710,10 @@ class NodeToolService {
35410
35710
  }
35411
35711
  const data = await response.json();
35412
35712
  const latestVersion = data["dist-tags"]?.latest;
35413
- const [labelError, parsedUrl] = catchError10(() => new URL(registryUrl));
35713
+ const [labelError, parsedUrl] = catchError14(() => new URL(registryUrl));
35414
35714
  const registryLabel = labelError ? registryUrl : parsedUrl.host;
35415
35715
  const availableVersions = Object.keys(data.versions || {}).filter(isValidSemver).sort((a, b) => compareSemver(b, a));
35416
- logger11.debug(`Package '${packageName}': latest=${latestVersion ?? "unknown"}, ${availableVersions.length} versions available`);
35716
+ logger13.debug(`Package '${packageName}': latest=${latestVersion ?? "unknown"}, ${availableVersions.length} versions available`);
35417
35717
  return {
35418
35718
  name: data.name,
35419
35719
  version: latestVersion || "latest",
@@ -35450,7 +35750,7 @@ ${errors5.map((e) => ` - ${e}`).join(`
35450
35750
  return results;
35451
35751
  }
35452
35752
  async searchLatestVersion(packageName, versionPrefix) {
35453
- logger11.debug(`Searching latest version of '${packageName}'${versionPrefix ? ` with prefix '${versionPrefix}'` : ""}`);
35753
+ logger13.debug(`Searching latest version of '${packageName}'${versionPrefix ? ` with prefix '${versionPrefix}'` : ""}`);
35454
35754
  const { registryUrl, authToken } = await resolveRegistry();
35455
35755
  const headers = {};
35456
35756
  if (authToken)
@@ -35460,24 +35760,24 @@ ${errors5.map((e) => ` - ${e}`).join(`
35460
35760
  const matching = info.availableVersions.filter((v) => v.startsWith(versionPrefix));
35461
35761
  const stable = matching.find((v) => !v.includes("-"));
35462
35762
  if (stable) {
35463
- logger11.debug(`Resolved version: ${stable} (stable, prefix match)`);
35763
+ logger13.debug(`Resolved version: ${stable} (stable, prefix match)`);
35464
35764
  return stable;
35465
35765
  }
35466
35766
  if (matching.length > 0) {
35467
- logger11.debug(`Resolved version: ${matching[0]} (prerelease, prefix match)`);
35767
+ logger13.debug(`Resolved version: ${matching[0]} (prerelease, prefix match)`);
35468
35768
  return matching[0];
35469
35769
  }
35470
- logger11.debug(`No version found matching prefix '${versionPrefix}'`);
35770
+ logger13.debug(`No version found matching prefix '${versionPrefix}'`);
35471
35771
  return null;
35472
35772
  }
35473
- logger11.debug(`Resolved version: ${info.version ?? "null"} (latest)`);
35773
+ logger13.debug(`Resolved version: ${info.version ?? "null"} (latest)`);
35474
35774
  return info.version ?? null;
35475
35775
  }
35476
35776
  async install(packageName, destination, options) {
35477
35777
  validatePackageSpec(packageName);
35478
35778
  const baseArgs = options?.global ? ["install", "-g", packageName] : ["install", packageName];
35479
35779
  for (let attempt = 0;attempt <= NPM_MAX_RETRIES; attempt++) {
35480
- const [err] = await catchError10(runPackageManager(baseArgs, destination));
35780
+ const [err] = await catchError14(runPackageManager(baseArgs, destination));
35481
35781
  if (!err) {
35482
35782
  return;
35483
35783
  }
@@ -35487,12 +35787,12 @@ ${errors5.map((e) => ` - ${e}`).join(`
35487
35787
  throw err;
35488
35788
  }
35489
35789
  const delayMs = 1000 * (attempt + 1);
35490
- logger11.warn(`npm install failed with transient error (attempt ${attempt + 1}/${NPM_MAX_RETRIES + 1}), retrying in ${delayMs}ms: ${msg}`);
35790
+ logger13.warn(`npm install failed with transient error (attempt ${attempt + 1}/${NPM_MAX_RETRIES + 1}), retrying in ${delayMs}ms: ${msg}`);
35491
35791
  await new Promise((r) => setTimeout(r, delayMs));
35492
35792
  }
35493
35793
  }
35494
35794
  async uninstall(packageName, destination, options) {
35495
- const fs = getFileSystem12();
35795
+ const fs = getFileSystem15();
35496
35796
  const nodeModulesDir = fs.path.resolve(destination, "node_modules");
35497
35797
  const packageDir = fs.path.resolve(fs.path.join(destination, "node_modules", packageName));
35498
35798
  if (!packageDir.startsWith(`${nodeModulesDir}/`) && !packageDir.startsWith(`${nodeModulesDir}\\`)) {
@@ -35501,10 +35801,10 @@ ${errors5.map((e) => ` - ${e}`).join(`
35501
35801
  if (!await fs.exists(packageDir)) {
35502
35802
  throw new Error(`Package '${packageName}' is not installed at ${destination}`);
35503
35803
  }
35504
- const [statError, stat] = await catchError10(fs.stat(packageDir));
35804
+ const [statError, stat] = await catchError14(fs.stat(packageDir));
35505
35805
  if (!statError && !stat) {
35506
35806
  await fs.rm(packageDir);
35507
- logger11.info(`Removed workspace-linked package '${packageName}'`);
35807
+ logger13.info(`Removed workspace-linked package '${packageName}'`);
35508
35808
  return;
35509
35809
  }
35510
35810
  if (options?.global) {
@@ -35514,7 +35814,7 @@ ${errors5.map((e) => ` - ${e}`).join(`
35514
35814
  }
35515
35815
  if (await fs.exists(packageDir)) {
35516
35816
  await fs.rm(packageDir);
35517
- logger11.info(`Package directory for '${packageName}' still existed after uninstall — removed manually`);
35817
+ logger13.info(`Package directory for '${packageName}' still existed after uninstall — removed manually`);
35518
35818
  }
35519
35819
  }
35520
35820
  }
@@ -35574,9 +35874,9 @@ var init_toolService = __esm(() => {
35574
35874
 
35575
35875
  // src/commands/tools/install.ts
35576
35876
  import {
35577
- catchError as catchError11,
35578
- logger as logger12,
35579
- OutputFormatter as OutputFormatter7,
35877
+ catchError as catchError15,
35878
+ logger as logger14,
35879
+ OutputFormatter as OutputFormatter8,
35580
35880
  processContext as processContext5
35581
35881
  } from "@uipath/common";
35582
35882
  function registerInstallCommand2(toolsCommand, _context, state) {
@@ -35584,7 +35884,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35584
35884
  toolsCommand.command("install").description("Install a tool from registry").argument("<package-name>", "Name of the package to install (optionally with @version)").trackedAction(processContext5, async (packageArg) => {
35585
35885
  const { name: rawName, version: explicitVersion } = parsePackageSpec(packageArg);
35586
35886
  if (explicitVersion && !isValidSemver(explicitVersion)) {
35587
- OutputFormatter7.error({
35887
+ OutputFormatter8.error({
35588
35888
  Result: "Failure",
35589
35889
  Message: `Invalid version '${explicitVersion}'.`,
35590
35890
  Instructions: "Version must be a valid semver string (e.g. 1.0.0 or 1.0.0-beta.1)."
@@ -35594,7 +35894,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35594
35894
  }
35595
35895
  const packageName = resolveToolPackageName(rawName);
35596
35896
  if (!TOOLS_WHITELIST.has(packageName)) {
35597
- OutputFormatter7.error({
35897
+ OutputFormatter8.error({
35598
35898
  Result: "Failure",
35599
35899
  Message: `Unknown tool '${packageArg}'.`,
35600
35900
  Instructions: "Run 'uip tools search' to see available tools."
@@ -35602,7 +35902,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35602
35902
  processContext5.exit(1);
35603
35903
  return;
35604
35904
  }
35605
- const [error48] = await catchError11((async () => {
35905
+ const [error48] = await catchError15((async () => {
35606
35906
  const location = await resolveInstallPath(packageName);
35607
35907
  let packageSpec;
35608
35908
  if (explicitVersion) {
@@ -35618,8 +35918,8 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35618
35918
  await toolService.install(packageSpec, location.path, {
35619
35919
  global: location.global
35620
35920
  });
35621
- logger12.info(`Installed to ${location.path}`);
35622
- OutputFormatter7.success({
35921
+ logger14.info(`Installed to ${location.path}`);
35922
+ OutputFormatter8.success({
35623
35923
  Result: "Success",
35624
35924
  Code: "Message",
35625
35925
  Data: {
@@ -35628,7 +35928,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35628
35928
  });
35629
35929
  })());
35630
35930
  if (error48) {
35631
- OutputFormatter7.error({
35931
+ OutputFormatter8.error({
35632
35932
  Result: "Failure",
35633
35933
  Message: `Failed to install '${packageName}': ${error48.message}`,
35634
35934
  Instructions: "Please check the package name and try again."
@@ -35642,7 +35942,7 @@ var init_install2 = __esm(() => {
35642
35942
  });
35643
35943
 
35644
35944
  // src/commands/tools/list.ts
35645
- import { OutputFormatter as OutputFormatter8, processContext as processContext6 } from "@uipath/common";
35945
+ import { OutputFormatter as OutputFormatter9, processContext as processContext6 } from "@uipath/common";
35646
35946
  function registerListCommand(toolsCommand, state) {
35647
35947
  toolsCommand.command("list").description("List installed tools").trackedAction(processContext6, async () => {
35648
35948
  const data = state.tools.length > 0 ? state.tools.map((tool) => tool.metadata) : (state.discoveredTools ?? []).map((d) => ({
@@ -35651,7 +35951,7 @@ function registerListCommand(toolsCommand, state) {
35651
35951
  description: d.description,
35652
35952
  commandPrefix: d.commandPrefix
35653
35953
  }));
35654
- OutputFormatter8.success({
35954
+ OutputFormatter9.success({
35655
35955
  Result: "Success",
35656
35956
  Code: "ToolList",
35657
35957
  Data: data
@@ -35661,12 +35961,12 @@ function registerListCommand(toolsCommand, state) {
35661
35961
  var init_list = () => {};
35662
35962
 
35663
35963
  // src/commands/tools/search.ts
35664
- import { catchError as catchError12, OutputFormatter as OutputFormatter9, processContext as processContext7 } from "@uipath/common";
35964
+ import { catchError as catchError16, OutputFormatter as OutputFormatter10, processContext as processContext7 } from "@uipath/common";
35665
35965
  function registerSearchCommand(toolsCommand, _context) {
35666
35966
  toolsCommand.command("search").description("Search for tools in the configured registry").argument("[query]", "Search query (name or keyword)").trackedAction(processContext7, async (query) => {
35667
- const [error48, results] = await catchError12(toolService.search(query));
35967
+ const [error48, results] = await catchError16(toolService.search(query));
35668
35968
  if (error48) {
35669
- OutputFormatter9.error({
35969
+ OutputFormatter10.error({
35670
35970
  Result: "Failure",
35671
35971
  Message: "No matching tools found.",
35672
35972
  Instructions: error48.message
@@ -35678,7 +35978,7 @@ function registerSearchCommand(toolsCommand, _context) {
35678
35978
  ...r,
35679
35979
  availableVersions: r.availableVersions ? truncateVersionsForDisplay(r.availableVersions) : undefined
35680
35980
  }));
35681
- OutputFormatter9.success({
35981
+ OutputFormatter10.success({
35682
35982
  Result: "Success",
35683
35983
  Code: "SearchResult",
35684
35984
  Data: displayResults
@@ -35690,13 +35990,13 @@ var init_search = __esm(() => {
35690
35990
  });
35691
35991
 
35692
35992
  // src/commands/tools/uninstall.ts
35693
- import { catchError as catchError13, OutputFormatter as OutputFormatter10, processContext as processContext8 } from "@uipath/common";
35993
+ import { catchError as catchError17, OutputFormatter as OutputFormatter11, processContext as processContext8 } from "@uipath/common";
35694
35994
  function registerUninstallCommand2(toolsCommand, _context, state) {
35695
35995
  const { resolveInstallPath } = state;
35696
35996
  toolsCommand.command("uninstall").description("Uninstall an installed tool").argument("<package-name>", "Package name (e.g. @uipath/rpa-tool) or command alias (e.g. rpa)").trackedAction(processContext8, async (packageArg) => {
35697
35997
  const packageName = resolveToolPackageName(packageArg);
35698
35998
  if (!TOOLS_WHITELIST.has(packageName)) {
35699
- OutputFormatter10.error({
35999
+ OutputFormatter11.error({
35700
36000
  Result: "Failure",
35701
36001
  Message: `Unknown tool '${packageArg}'.`,
35702
36002
  Instructions: `Use 'uip tools list' to see installed tools.`
@@ -35704,12 +36004,12 @@ function registerUninstallCommand2(toolsCommand, _context, state) {
35704
36004
  processContext8.exit(1);
35705
36005
  return;
35706
36006
  }
35707
- const [error48] = await catchError13((async () => {
36007
+ const [error48] = await catchError17((async () => {
35708
36008
  const location = await resolveInstallPath();
35709
36009
  await toolService.uninstall(packageName, location.path, {
35710
36010
  global: location.global
35711
36011
  });
35712
- OutputFormatter10.success({
36012
+ OutputFormatter11.success({
35713
36013
  Result: "Success",
35714
36014
  Code: "Message",
35715
36015
  Data: {
@@ -35718,7 +36018,7 @@ function registerUninstallCommand2(toolsCommand, _context, state) {
35718
36018
  });
35719
36019
  })());
35720
36020
  if (error48) {
35721
- OutputFormatter10.error({
36021
+ OutputFormatter11.error({
35722
36022
  Result: "Failure",
35723
36023
  Message: `Failed to uninstall '${packageName}': ${error48.message}`,
35724
36024
  Instructions: "Use 'uip tools list' to see installed tools."
@@ -35733,17 +36033,17 @@ var init_uninstall2 = __esm(() => {
35733
36033
 
35734
36034
  // src/commands/tools/update.ts
35735
36035
  import {
35736
- catchError as catchError14,
35737
- logger as logger13,
35738
- OutputFormatter as OutputFormatter11,
36036
+ catchError as catchError18,
36037
+ logger as logger15,
36038
+ OutputFormatter as OutputFormatter12,
35739
36039
  processContext as processContext9
35740
36040
  } from "@uipath/common";
35741
- import { getFileSystem as getFileSystem13 } from "@uipath/filesystem";
36041
+ import { getFileSystem as getFileSystem16 } from "@uipath/filesystem";
35742
36042
  function registerUpdateCommand2(toolsCommand, _context, state) {
35743
36043
  const { tools, toolsDirs, resolveInstallPath, getCliVersionPrefix } = state;
35744
36044
  toolsCommand.command("update").description("Update installed tools").option("--name <scoped-tool-name>", "scoped package name").option("--version <version>", "package version to install", "latest").trackedAction(processContext9, async (options) => {
35745
36045
  if (tools.length === 0) {
35746
- OutputFormatter11.error({
36046
+ OutputFormatter12.error({
35747
36047
  Result: "Failure",
35748
36048
  Message: "No tools installed.",
35749
36049
  Instructions: "Use 'uip tools install <package>' to install a tool."
@@ -35751,9 +36051,9 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35751
36051
  processContext9.exit(1);
35752
36052
  return;
35753
36053
  }
35754
- const [locationError, location] = await catchError14(resolveInstallPath());
36054
+ const [locationError, location] = await catchError18(resolveInstallPath());
35755
36055
  if (locationError) {
35756
- OutputFormatter11.error({
36056
+ OutputFormatter12.error({
35757
36057
  Result: "Failure",
35758
36058
  Message: locationError.message,
35759
36059
  Instructions: "Please ensure the CLI is installed correctly."
@@ -35764,7 +36064,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35764
36064
  const resolvedName = options.name ? resolveToolPackageName(options.name) : undefined;
35765
36065
  const toUpdate = resolvedName ? tools.filter((t) => t.metadata.name === resolvedName || `@uipath/${t.metadata.name}` === resolvedName) : tools;
35766
36066
  if (resolvedName && toUpdate.length === 0) {
35767
- OutputFormatter11.error({
36067
+ OutputFormatter12.error({
35768
36068
  Result: "Failure",
35769
36069
  Message: `Tool '${options.name}' is not installed.`,
35770
36070
  Instructions: "Use 'uip tools list' to see installed tools."
@@ -35773,9 +36073,9 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35773
36073
  return;
35774
36074
  }
35775
36075
  if (options.version !== "latest") {
35776
- const [validateError] = catchError14(() => validateVersionString(options.version));
36076
+ const [validateError] = catchError18(() => validateVersionString(options.version));
35777
36077
  if (validateError) {
35778
- OutputFormatter11.error({
36078
+ OutputFormatter12.error({
35779
36079
  Result: "Failure",
35780
36080
  Message: validateError.message,
35781
36081
  Instructions: "Use a valid semver version (e.g. 1.2.3) or 'latest'."
@@ -35788,7 +36088,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35788
36088
  const previousVersions = new Map(toUpdate.map((t) => [t.metadata.name, t.metadata.version]));
35789
36089
  for (const tool of toUpdate) {
35790
36090
  const fullName = `@uipath/${tool.metadata.name}`;
35791
- const [updateError] = await catchError14((async () => {
36091
+ const [updateError] = await catchError18((async () => {
35792
36092
  let targetVersion = options.version;
35793
36093
  if (targetVersion === "latest") {
35794
36094
  const cliPrefix = getCliVersionPrefix();
@@ -35826,7 +36126,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35826
36126
  });
35827
36127
  }
35828
36128
  }
35829
- const fs = getFileSystem13();
36129
+ const fs = getFileSystem16();
35830
36130
  const updatedVersions = new Map;
35831
36131
  for (const dir of toolsDirs) {
35832
36132
  for (const tool of toUpdate) {
@@ -35836,10 +36136,10 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35836
36136
  const pkgPath = fs.path.join(dir, name, "package.json");
35837
36137
  if (!await fs.exists(pkgPath))
35838
36138
  continue;
35839
- const [readError, raw] = await catchError14(fs.readFile(pkgPath, "utf-8"));
36139
+ const [readError, raw] = await catchError18(fs.readFile(pkgPath, "utf-8"));
35840
36140
  if (readError || !raw)
35841
36141
  continue;
35842
- const [parseError, pkg] = catchError14(() => JSON.parse(raw));
36142
+ const [parseError, pkg] = catchError18(() => JSON.parse(raw));
35843
36143
  if (parseError || !pkg.version)
35844
36144
  continue;
35845
36145
  updatedVersions.set(name, pkg.version);
@@ -35865,13 +36165,13 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35865
36165
  }
35866
36166
  }
35867
36167
  const failed = results.filter((r) => r.status === "failed");
35868
- OutputFormatter11.success({
36168
+ OutputFormatter12.success({
35869
36169
  Result: "Success",
35870
36170
  Code: "UpdateResult",
35871
36171
  Data: results
35872
36172
  });
35873
36173
  if (failed.length > 0) {
35874
- logger13.error(`Failed to update ${failed.length} tool(s): ${failed.map((f) => `${f.name}: ${f.error}`).join("; ")}`);
36174
+ logger15.error(`Failed to update ${failed.length} tool(s): ${failed.map((f) => `${f.name}: ${f.error}`).join("; ")}`);
35875
36175
  processContext9.exit(1);
35876
36176
  }
35877
36177
  });
@@ -35898,15 +36198,15 @@ var init_tools = __esm(() => {
35898
36198
  });
35899
36199
 
35900
36200
  // src/services/installPath.ts
35901
- import { catchError as catchError15, logger as logger14 } from "@uipath/common";
36201
+ import { catchError as catchError19, logger as logger16 } from "@uipath/common";
35902
36202
  function createInstallPathResolver(toolsDir, isBrowser2) {
35903
36203
  return async (packageName) => {
35904
36204
  if (isBrowser2) {
35905
36205
  const path = packageName ? `/tools/${packageName.replace(/[/@]/g, "_")}` : "/tools";
35906
36206
  return { path, global: false };
35907
36207
  }
35908
- const { getFileSystem: getFileSystem14 } = await import("@uipath/filesystem");
35909
- const fsLocal = getFileSystem14();
36208
+ const { getFileSystem: getFileSystem17 } = await import("@uipath/filesystem");
36209
+ const fsLocal = getFileSystem17();
35910
36210
  const { dirname: dirnameFn, join: joinFn } = fsLocal.path;
35911
36211
  if (toolsDir) {
35912
36212
  let path = dirnameFn(dirnameFn(toolsDir));
@@ -35919,9 +36219,9 @@ function createInstallPathResolver(toolsDir, isBrowser2) {
35919
36219
  let isGlobal = true;
35920
36220
  const pkgJsonPath = joinFn(path, "package.json");
35921
36221
  if (await fsLocal.exists(pkgJsonPath)) {
35922
- const [, raw] = await catchError15(fsLocal.readFile(pkgJsonPath, "utf-8"));
36222
+ const [, raw] = await catchError19(fsLocal.readFile(pkgJsonPath, "utf-8"));
35923
36223
  if (raw) {
35924
- const [, pkgJson] = catchError15(() => JSON.parse(raw));
36224
+ const [, pkgJson] = catchError19(() => JSON.parse(raw));
35925
36225
  if (pkgJson) {
35926
36226
  const deps = {
35927
36227
  ...pkgJson.dependencies,
@@ -35936,15 +36236,15 @@ function createInstallPathResolver(toolsDir, isBrowser2) {
35936
36236
  }
35937
36237
  }
35938
36238
  }
35939
- logger14.debug(`Install path resolved: ${path} (global: ${isGlobal})`);
36239
+ logger16.debug(`Install path resolved: ${path} (global: ${isGlobal})`);
35940
36240
  return { path, global: isGlobal };
35941
36241
  }
35942
36242
  let searchDir = fsLocal.env.cwd();
35943
36243
  for (let i2 = 0;i2 < 10; i2++) {
35944
36244
  const nodeModulesPath = joinFn(searchDir, "node_modules");
35945
- const [, exists] = await catchError15(fsLocal.exists(nodeModulesPath));
36245
+ const [, exists] = await catchError19(fsLocal.exists(nodeModulesPath));
35946
36246
  if (exists) {
35947
- logger14.debug(`Install path resolved via fallback: ${searchDir}`);
36247
+ logger16.debug(`Install path resolved via fallback: ${searchDir}`);
35948
36248
  return { path: searchDir, global: false };
35949
36249
  }
35950
36250
  const parentDir = dirnameFn(searchDir);
@@ -35959,17 +36259,24 @@ var insideNodeModules = (dir) => /[\\/]node_modules([\\/]|$)/.test(dir);
35959
36259
  var init_installPath = () => {};
35960
36260
 
35961
36261
  // src/services/storage.ts
35962
- import { logger as logger15 } from "@uipath/common";
35963
- import { getFileSystem as getFileSystem14, getFileSystemAsync } from "@uipath/filesystem";
36262
+ import { getFileSystem as getFileSystem17, getFileSystemAsync } from "@uipath/filesystem";
35964
36263
 
35965
36264
  class GeneralizedStorage {
36265
+ _initPromise;
35966
36266
  async init() {
35967
- logger15.debug("Initializing filesystem...");
35968
- await getFileSystemAsync();
35969
- logger15.debug("Filesystem initialized");
36267
+ if (this._initPromise)
36268
+ return this._initPromise;
36269
+ const promise3 = getFileSystemAsync().then(() => {
36270
+ return;
36271
+ });
36272
+ this._initPromise = promise3;
36273
+ promise3.catch(() => {
36274
+ this._initPromise = undefined;
36275
+ });
36276
+ return promise3;
35970
36277
  }
35971
36278
  get fs() {
35972
- return getFileSystem14();
36279
+ return getFileSystem17();
35973
36280
  }
35974
36281
  async read(path) {
35975
36282
  const res = await this.fs.readFile(path);
@@ -36007,11 +36314,11 @@ var init_storage = __esm(() => {
36007
36314
  });
36008
36315
 
36009
36316
  // src/utils/toolLoader.ts
36010
- import { catchError as catchError16, logger as logger16 } from "@uipath/common";
36011
- import { getFileSystem as getFileSystem15 } from "@uipath/filesystem";
36317
+ import { catchError as catchError20, logger as logger17 } from "@uipath/common";
36318
+ import { getFileSystem as getFileSystem18 } from "@uipath/filesystem";
36012
36319
  import { Command } from "commander";
36013
36320
  function isRunningFromSource() {
36014
- const [error48, mainUrl] = catchError16(() => import.meta.url);
36321
+ const [error48, mainUrl] = catchError20(() => import.meta.url);
36015
36322
  if (error48) {
36016
36323
  return false;
36017
36324
  }
@@ -36021,9 +36328,9 @@ function joinPath(...parts) {
36021
36328
  return parts.filter((p) => p).join("/").replace(/\/+/g, "/");
36022
36329
  }
36023
36330
  async function discoverToolPaths(toolsDirs) {
36024
- const [initError] = await catchError16(storage.init());
36331
+ const [initError] = await catchError20(storage.init());
36025
36332
  if (initError) {
36026
- logger16.error("Storage initialization failed:", initError);
36333
+ logger17.error("Storage initialization failed:", initError);
36027
36334
  return [];
36028
36335
  }
36029
36336
  const dirs = Array.isArray(toolsDirs) ? toolsDirs : [toolsDirs];
@@ -36031,10 +36338,9 @@ async function discoverToolPaths(toolsDirs) {
36031
36338
  const seenPrefixes = new Set;
36032
36339
  for (const toolsDir of dirs) {
36033
36340
  if (!await storage.exists(toolsDir)) {
36034
- logger16.debug(`Tools directory does not exist, skipping: ${toolsDir}`);
36341
+ logger17.debug(`Tools directory does not exist, skipping: ${toolsDir}`);
36035
36342
  continue;
36036
36343
  }
36037
- logger16.debug(`Scanning tools directory: ${toolsDir}`);
36038
36344
  const toolNames = [...WHITELIST_BY_SHORT_NAME.keys()];
36039
36345
  const resolvedPaths = await Promise.all(toolNames.map(async (toolName) => {
36040
36346
  const toolDir = joinPath(toolsDir, toolName);
@@ -36064,7 +36370,7 @@ async function discoverToolPaths(toolsDirs) {
36064
36370
  let description = "";
36065
36371
  let version2 = "";
36066
36372
  if (pkgJson) {
36067
- const [parseErr, pkg] = catchError16(() => JSON.parse(pkgJson));
36373
+ const [parseErr, pkg] = catchError20(() => JSON.parse(pkgJson));
36068
36374
  if (!parseErr) {
36069
36375
  description = pkg.description ?? "";
36070
36376
  version2 = pkg.version ?? "";
@@ -36086,20 +36392,20 @@ async function discoverToolPaths(toolsDirs) {
36086
36392
  version: version2
36087
36393
  } of resolvedPaths) {
36088
36394
  if (!toolPath) {
36089
- logger16.debug(`Tool '${toolName}' not found in ${joinPath(toolsDir, toolName)}`);
36090
36395
  continue;
36091
36396
  }
36092
36397
  const packageName = WHITELIST_BY_SHORT_NAME.get(toolName);
36093
36398
  const commandPrefix = packageName ? TOOLS_WHITELIST.get(packageName) : undefined;
36094
36399
  if (!commandPrefix || !packageName) {
36095
- logger16.warn(`Tool '${toolName}' found at ${toolPath} but not in whitelist, skipping`);
36400
+ logger17.warn(`Tool '${toolName}' found at ${toolPath} but not in whitelist, skipping`);
36096
36401
  continue;
36097
36402
  }
36098
36403
  if (seenPrefixes.has(commandPrefix)) {
36099
- logger16.info(`Tool ${toolName} (command '${commandPrefix}') already found from a higher-priority path, skipping`);
36404
+ logger17.info(`Tool ${toolName} (command '${commandPrefix}') already found from a higher-priority path, skipping`);
36100
36405
  continue;
36101
36406
  }
36102
36407
  seenPrefixes.add(commandPrefix);
36408
+ logger17.debug(`Discovered tool '${toolName}' v${version2 || "unknown"} at ${toolPath}`);
36103
36409
  discovered.push({
36104
36410
  toolName,
36105
36411
  toolPath,
@@ -36109,21 +36415,20 @@ async function discoverToolPaths(toolsDirs) {
36109
36415
  version: version2,
36110
36416
  packagerToolPath
36111
36417
  });
36112
- logger16.debug(`Discovered tool '${toolName}' at ${toolPath} (prefix: ${commandPrefix})`);
36113
36418
  }
36114
36419
  }
36115
36420
  return discovered;
36116
36421
  }
36117
36422
  async function importModuleByPath(modulePath) {
36118
36423
  const savedTrackedAction = Command.prototype.trackedAction;
36119
- const [error48, mod] = await catchError16((async () => {
36424
+ const [error48, mod] = await catchError20((async () => {
36120
36425
  if (_isBrowser) {
36121
36426
  const content = await storage.readText(modulePath);
36122
36427
  if (!content)
36123
36428
  return;
36124
36429
  const blob = new Blob([content], { type: "text/javascript" });
36125
36430
  const blobUrl = URL.createObjectURL(blob);
36126
- const [importError, imported] = await catchError16(import(blobUrl));
36431
+ const [importError, imported] = await catchError20(import(blobUrl));
36127
36432
  URL.revokeObjectURL(blobUrl);
36128
36433
  if (importError)
36129
36434
  throw importError;
@@ -36136,7 +36441,7 @@ async function importModuleByPath(modulePath) {
36136
36441
  })());
36137
36442
  if (savedTrackedAction && Command.prototype.trackedAction !== savedTrackedAction) {
36138
36443
  Command.prototype.trackedAction = savedTrackedAction;
36139
- logger16.warn(`Import of ${modulePath} overwrote Command.prototype.trackedAction — restored CLI version.`);
36444
+ logger17.warn(`Import of ${modulePath} overwrote Command.prototype.trackedAction — restored CLI version.`);
36140
36445
  }
36141
36446
  if (error48)
36142
36447
  throw error48;
@@ -36144,26 +36449,26 @@ async function importModuleByPath(modulePath) {
36144
36449
  }
36145
36450
  async function importTool(discovered) {
36146
36451
  const { toolName, toolPath } = discovered;
36147
- logger16.debug(`Loading tool '${toolName}' from ${toolPath}`);
36148
- const [error48, toolModule] = await catchError16(importModuleByPath(toolPath));
36452
+ logger17.debug(`Loading tool '${toolName}' from ${toolPath}`);
36453
+ const [error48, toolModule] = await catchError20(importModuleByPath(toolPath));
36149
36454
  if (error48) {
36150
- logger16.error(`Failed to load tool ${toolName}:`, error48);
36455
+ logger17.error(`Failed to load tool ${toolName} (version: ${discovered.version || "unknown"}, path: ${toolPath}):`, error48);
36151
36456
  return;
36152
36457
  }
36153
36458
  const { metadata, registerCommands } = toolModule ?? {};
36154
36459
  if (!metadata || !registerCommands) {
36155
- logger16.warn(`Tool ${toolName} missing required exports (metadata or registerCommands), skipping`);
36460
+ logger17.warn(`Tool ${toolName} missing required exports (metadata or registerCommands), skipping`);
36156
36461
  return;
36157
36462
  }
36158
- logger16.debug(`Tool '${toolName}' loaded successfully (prefix: ${metadata.commandPrefix}, version: ${metadata.version ?? "unknown"})`);
36463
+ logger17.debug(`Tool '${toolName}' loaded successfully (prefix: ${metadata.commandPrefix}, version: ${metadata.version ?? "unknown"})`);
36159
36464
  return { metadata, registerCommands };
36160
36465
  }
36161
36466
  async function importPackagerTool(discovered) {
36162
36467
  const { toolName, packagerToolPath } = discovered;
36163
36468
  if (!packagerToolPath)
36164
36469
  return;
36165
- logger16.debug(`Loading packager factory for '${toolName}' from ${packagerToolPath}`);
36166
- const [error48] = await catchError16(importModuleByPath(packagerToolPath));
36470
+ logger17.debug(`Loading packager factory for '${toolName}' from ${packagerToolPath}`);
36471
+ const [error48] = await catchError20(importModuleByPath(packagerToolPath));
36167
36472
  if (error48) {
36168
36473
  throw new Error(`Failed to load packager factory for '${toolName}' from ${packagerToolPath}: ${error48 instanceof Error ? error48.message : error48}`);
36169
36474
  }
@@ -36184,25 +36489,23 @@ function isInsideNodeModules(dir) {
36184
36489
  return segments.includes("node_modules");
36185
36490
  }
36186
36491
  async function findNearestToolsDir(startDir, seen) {
36187
- const fs = getFileSystem15();
36492
+ const fs = getFileSystem18();
36188
36493
  const { dirname, join } = fs.path;
36189
36494
  const results = [];
36190
36495
  let searchPath = startDir;
36191
36496
  for (let i2 = 0;i2 < MAX_WALK_DEPTH; i2++) {
36192
36497
  const candidate = join(searchPath, "node_modules", "@uipath");
36193
- const [, exists] = await catchError16(fs.exists(candidate));
36498
+ const [, exists] = await catchError20(fs.exists(candidate));
36194
36499
  if (exists) {
36195
36500
  if (seen.has(candidate)) {
36196
- logger16.debug(`Tools directory already seen, stopping walk: ${candidate}`);
36197
36501
  break;
36198
36502
  }
36199
36503
  seen.add(candidate);
36200
36504
  results.push(candidate);
36201
- logger16.debug(`Found tools directory: ${candidate}`);
36202
36505
  if (!isInsideNodeModules(searchPath)) {
36203
36506
  break;
36204
36507
  }
36205
- logger16.debug("Search path is inside node_modules, continuing walk for hoisted packages");
36508
+ logger17.debug("Search path is inside node_modules, continuing walk for hoisted packages");
36206
36509
  }
36207
36510
  const parentPath = dirname(searchPath);
36208
36511
  if (parentPath === searchPath) {
@@ -36210,19 +36513,15 @@ async function findNearestToolsDir(startDir, seen) {
36210
36513
  }
36211
36514
  searchPath = parentPath;
36212
36515
  }
36213
- if (results.length === 0) {
36214
- logger16.debug(`No tools directory found walking up from ${startDir}`);
36215
- }
36216
36516
  return results;
36217
36517
  }
36218
36518
  async function resolveToolsDirs(cliFilePath, cwd) {
36219
- const fs = getFileSystem15();
36519
+ const fs = getFileSystem18();
36220
36520
  const { dirname } = fs.path;
36221
36521
  const seen = new Set;
36222
36522
  const dirs = [];
36223
36523
  dirs.push(...await findNearestToolsDir(dirname(cliFilePath), seen));
36224
36524
  dirs.push(...await findNearestToolsDir(cwd, seen));
36225
- logger16.debug(`Resolved ${dirs.length} tool directories: ${dirs.join(", ") || "(none)"}`);
36226
36525
  return dirs;
36227
36526
  }
36228
36527
  var _isRunningFromSource, _isBrowser, MAX_WALK_DEPTH = 10;
@@ -36234,7 +36533,7 @@ var init_toolLoader = __esm(() => {
36234
36533
  });
36235
36534
 
36236
36535
  // src/services/tool-manager.ts
36237
- import { logger as logger17 } from "@uipath/common";
36536
+ import { logger as logger18 } from "@uipath/common";
36238
36537
 
36239
36538
  class ToolManager {
36240
36539
  toolsDirs;
@@ -36256,33 +36555,33 @@ class ToolManager {
36256
36555
  }
36257
36556
  async ensureAvailable(verb) {
36258
36557
  if (this.isInstalled(verb)) {
36259
- logger17.debug(`Tool '${verb}' is already installed`);
36558
+ logger18.debug(`Tool '${verb}' is already installed`);
36260
36559
  return;
36261
36560
  }
36262
36561
  const packageName = WHITELIST_BY_COMMAND.get(verb);
36263
36562
  if (!packageName) {
36264
36563
  throw new Error(`Unknown tool verb '${verb}'.`);
36265
36564
  }
36266
- logger17.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36267
- logger17.debug(`Searching latest version of '${packageName}' with prefix '${this.cliVersionPrefix}'`);
36565
+ logger18.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36566
+ logger18.debug(`Searching latest version of '${packageName}' with prefix '${this.cliVersionPrefix}'`);
36268
36567
  const version2 = await toolService.searchLatestVersion(packageName, this.cliVersionPrefix);
36269
36568
  if (!version2) {
36270
36569
  throw new Error(`No compatible version of '${packageName}' found for CLI (needs ${this.cliVersionPrefix}x).`);
36271
36570
  }
36272
36571
  const packageSpec = `${packageName}@${version2}`;
36273
36572
  const location = await this.resolveInstallPath();
36274
- logger17.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36573
+ logger18.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36275
36574
  await toolService.install(packageSpec, location.path, {
36276
36575
  global: location.global
36277
36576
  });
36278
- logger17.info(`Installed ${packageSpec} successfully.`);
36279
- logger17.debug("Re-discovering tools after install...");
36577
+ logger18.info(`Installed ${packageSpec} successfully.`);
36578
+ logger18.debug("Re-discovering tools after install...");
36280
36579
  this.tools = await discoverTools(this.toolsDirs);
36281
36580
  }
36282
36581
  async ensurePackagerFactory(verb) {
36283
36582
  let entry = this.discoveredTools.find((d) => d.commandPrefix === verb);
36284
36583
  if (!entry) {
36285
- logger17.info(`Tool '${verb}' not found on disk. Attempting install...`);
36584
+ logger18.info(`Tool '${verb}' not found on disk. Attempting install...`);
36286
36585
  await this.installTool(verb);
36287
36586
  entry = this.discoveredTools.find((d) => d.commandPrefix === verb);
36288
36587
  if (!entry) {
@@ -36291,14 +36590,14 @@ class ToolManager {
36291
36590
  }
36292
36591
  }
36293
36592
  if (entry.packagerToolPath) {
36294
- logger17.debug(`Loading packager factory for '${verb}' from ${entry.packagerToolPath}`);
36593
+ logger18.debug(`Loading packager factory for '${verb}' from ${entry.packagerToolPath}`);
36295
36594
  await importPackagerTool(entry);
36296
36595
  return;
36297
36596
  }
36298
- logger17.debug(`Tool '${verb}' has no packager-tool entry point, falling back to full tool import`);
36597
+ logger18.debug(`Tool '${verb}' has no packager-tool entry point, falling back to full tool import`);
36299
36598
  const tool = await importTool(entry);
36300
36599
  if (!tool) {
36301
- throw new Error(`Tool '${verb}' was discovered on disk but failed to load. ` + `Entry point: ${entry.toolPath}`);
36600
+ throw new Error(`Tool '${verb}' was discovered on disk but failed to load. ` + `Entry point: ${entry.toolPath}, ` + `Version: ${entry.version || "unknown"}, ` + `Package: ${entry.packageName}`);
36302
36601
  }
36303
36602
  }
36304
36603
  getTools() {
@@ -36309,22 +36608,22 @@ class ToolManager {
36309
36608
  if (!packageName) {
36310
36609
  throw new Error(`Unknown tool verb '${verb}'.`);
36311
36610
  }
36312
- logger17.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36611
+ logger18.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36313
36612
  const version2 = await toolService.searchLatestVersion(packageName, this.cliVersionPrefix);
36314
36613
  if (!version2) {
36315
36614
  throw new Error(`No compatible version of '${packageName}' found for CLI (needs ${this.cliVersionPrefix}x).`);
36316
36615
  }
36317
36616
  const packageSpec = `${packageName}@${version2}`;
36318
36617
  const location = await this.resolveInstallPath();
36319
- logger17.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36618
+ logger18.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36320
36619
  await toolService.install(packageSpec, location.path, {
36321
36620
  global: location.global
36322
36621
  });
36323
- logger17.info(`Installed ${packageSpec} successfully.`);
36324
- logger17.debug(`Re-discovering tools in [${this.toolsDirs.join(", ")}]...`);
36622
+ logger18.info(`Installed ${packageSpec} successfully.`);
36623
+ logger18.debug(`Re-discovering tools in [${this.toolsDirs.join(", ")}]...`);
36325
36624
  this.discoveredTools = await discoverToolPaths(this.toolsDirs);
36326
36625
  this.discoveredPrefixes = new Set(this.discoveredTools.map((d) => d.commandPrefix));
36327
- logger17.debug(`After install, discovered: [${this.discoveredTools.map((d) => d.commandPrefix).join(", ") || "none"}]`);
36626
+ logger18.debug(`After install, discovered: [${this.discoveredTools.map((d) => d.commandPrefix).join(", ") || "none"}]`);
36328
36627
  }
36329
36628
  }
36330
36629
  var init_tool_manager = __esm(() => {
@@ -36333,7 +36632,7 @@ var init_tool_manager = __esm(() => {
36333
36632
  });
36334
36633
 
36335
36634
  // src/utils/autoInstall.ts
36336
- import { catchError as catchError17, logger as logger18, OutputFormatter as OutputFormatter12 } from "@uipath/common";
36635
+ import { catchError as catchError21, logger as logger19, OutputFormatter as OutputFormatter13 } from "@uipath/common";
36337
36636
  async function autoInstallToolIfNeeded(args, program, toolManager, context) {
36338
36637
  if (context.capabilities.isBrowser)
36339
36638
  return false;
@@ -36353,10 +36652,10 @@ async function autoInstallToolIfNeeded(args, program, toolManager, context) {
36353
36652
  break;
36354
36653
  }
36355
36654
  if (requestedVerb && !toolManager.isInstalled(requestedVerb)) {
36356
- logger18.debug(`Tool '${requestedVerb}' not installed — attempting auto-install`);
36357
- const [error48] = await catchError17(toolManager.ensureAvailable(requestedVerb));
36655
+ logger19.debug(`Tool '${requestedVerb}' not installed — attempting auto-install`);
36656
+ const [error48] = await catchError21(toolManager.ensureAvailable(requestedVerb));
36358
36657
  if (error48) {
36359
- OutputFormatter12.error({
36658
+ OutputFormatter13.error({
36360
36659
  Result: "Failure",
36361
36660
  Message: `Failed to auto-install '${requestedVerb}': ${error48.message}`,
36362
36661
  Instructions: `Run 'uip tools install ${requestedVerb}' to install manually.`
@@ -36434,7 +36733,13 @@ function stripGlobalOptions(args) {
36434
36733
  cleaned.push(args[i2]);
36435
36734
  }
36436
36735
  const resolvedFormat = format ?? (getOutputSink2().capabilities.isInteractive ? "table" : "json");
36437
- return { args: cleaned, format: resolvedFormat, filter, logLevel, logFile };
36736
+ return {
36737
+ args: cleaned,
36738
+ format: resolvedFormat,
36739
+ filter,
36740
+ logLevel,
36741
+ logFile
36742
+ };
36438
36743
  }
36439
36744
  var VALID_FORMATS, VALID_LOG_LEVELS;
36440
36745
  var init_globalOptions = __esm(() => {
@@ -36452,7 +36757,7 @@ import {
36452
36757
  extractCommandHelp,
36453
36758
  getOutputFormat,
36454
36759
  getOutputSink as getOutputSink3,
36455
- OutputFormatter as OutputFormatter13
36760
+ OutputFormatter as OutputFormatter14
36456
36761
  } from "@uipath/common";
36457
36762
  function getCommandPath(cmd) {
36458
36763
  const names = [];
@@ -36708,7 +37013,7 @@ function createHelpConfiguration(isBrowser2) {
36708
37013
  Code: "Help",
36709
37014
  Data: helpData
36710
37015
  };
36711
- return OutputFormatter13.formatToString(output);
37016
+ return OutputFormatter14.formatToString(output);
36712
37017
  }
36713
37018
  };
36714
37019
  if (isBrowser2) {
@@ -36765,7 +37070,7 @@ var init_telemetry_events = __esm(() => {
36765
37070
 
36766
37071
  // src/utils/parseError.ts
36767
37072
  import {
36768
- OutputFormatter as OutputFormatter14,
37073
+ OutputFormatter as OutputFormatter15,
36769
37074
  telemetry,
36770
37075
  telemetryFlushAndShutdown
36771
37076
  } from "@uipath/common";
@@ -36784,7 +37089,7 @@ async function handleParseError(error48, cleanedArgs, context) {
36784
37089
  context.exit(exitCode ?? 0);
36785
37090
  return;
36786
37091
  }
36787
- OutputFormatter14.error({
37092
+ OutputFormatter15.error({
36788
37093
  Result: "ValidationError",
36789
37094
  Message: message,
36790
37095
  Instructions: "Check command arguments and options. Use --help for usage information."
@@ -36801,19 +37106,17 @@ var init_parseError = __esm(() => {
36801
37106
  });
36802
37107
 
36803
37108
  // src/utils/registerToolCommands.ts
36804
- import { catchError as catchError18, logger as logger19, OutputFormatter as OutputFormatter15 } from "@uipath/common";
36805
- function registerLazyToolCommands(program, discovered, context) {
36806
- logger19.debug("Registering lazy tool commands...");
37109
+ import { catchError as catchError22, logger as logger20, OutputFormatter as OutputFormatter16 } from "@uipath/common";
37110
+ function registerToolCommands(program, discovered, context) {
36807
37111
  for (const entry of discovered) {
36808
- logger19.debug(`Registering lazy command for tool '${entry.toolName}' (prefix: ${entry.commandPrefix})`);
36809
37112
  const toolCommand = program.command(entry.commandPrefix).description(entry.description).allowUnknownOption().allowExcessArguments(true).helpOption(false);
36810
37113
  toolCommand.action(async () => {
36811
- logger19.debug(`Lazy-loading tool '${entry.toolName}' on first use...`);
37114
+ logger20.debug(`Loading tool '${entry.toolName}'...`);
36812
37115
  const tool = await importTool(entry);
36813
37116
  if (!tool) {
36814
- OutputFormatter15.error({
37117
+ OutputFormatter16.error({
36815
37118
  Result: "Failure",
36816
- Message: `Failed to load tool '${entry.toolName}'.`,
37119
+ Message: `Failed to load tool '${entry.toolName}' (version: ${entry.version || "unknown"}, path: ${entry.toolPath}).`,
36817
37120
  Instructions: `Try reinstalling with 'uip tools install ${entry.commandPrefix}'.`
36818
37121
  });
36819
37122
  context.exit(1);
@@ -36824,9 +37127,9 @@ function registerLazyToolCommands(program, discovered, context) {
36824
37127
  program.commands.splice(idx, 1);
36825
37128
  }
36826
37129
  const realCommand = program.command(tool.metadata.commandPrefix).description(tool.metadata.description);
36827
- const [regError] = await catchError18(tool.registerCommands(realCommand));
37130
+ const [regError] = await catchError22(tool.registerCommands(realCommand));
36828
37131
  if (regError) {
36829
- OutputFormatter15.error({
37132
+ OutputFormatter16.error({
36830
37133
  Result: "Failure",
36831
37134
  Message: `Failed to register commands from tool '${tool.metadata.name}': ${regError.message}`,
36832
37135
  Instructions: "This might be due to a command name conflict with existing commands."
@@ -36844,32 +37147,32 @@ var init_registerToolCommands = __esm(() => {
36844
37147
 
36845
37148
  // src/utils/resolveToolsDirectories.ts
36846
37149
  import { fileURLToPath } from "node:url";
36847
- import { logger as logger20 } from "@uipath/common";
36848
- import { getFileSystem as getFileSystem16 } from "@uipath/filesystem";
37150
+ import { logger as logger21 } from "@uipath/common";
37151
+ import { getFileSystem as getFileSystem19 } from "@uipath/filesystem";
36849
37152
  async function resolveToolsDirectories(context) {
36850
37153
  if (context.capabilities.isBrowser) {
36851
- logger20.debug("Browser mode — tools directory: /tools");
37154
+ logger21.debug("Browser mode — tools directory: /tools");
36852
37155
  return { toolsDirs: ["/tools"], toolsDir: "/tools" };
36853
37156
  }
36854
37157
  const currentFilePath = fileURLToPath(import.meta.url);
36855
- const fs = getFileSystem16();
37158
+ const fs = getFileSystem19();
36856
37159
  const toolsDirs = await resolveToolsDirs(currentFilePath, fs.env.cwd());
36857
37160
  const toolsDir = toolsDirs[0];
36858
37161
  if (toolsDirs.length > 0) {
36859
37162
  return { toolsDirs, toolsDir };
36860
37163
  }
36861
- logger20.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
37164
+ logger21.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
36862
37165
  const { dirname, join } = fs.path;
36863
37166
  const isInstalledPackage = process.execPath.includes(join("@uipath", "cli", "dist", "uip"));
36864
37167
  if (isInstalledPackage) {
36865
37168
  const execDir = dirname(process.execPath);
36866
37169
  const packageDir = dirname(execDir);
36867
37170
  const fallbackDir2 = dirname(packageDir);
36868
- logger20.debug(`Fallback (installed package): ${fallbackDir2}`);
37171
+ logger21.debug(`Fallback (installed package): ${fallbackDir2}`);
36869
37172
  return { toolsDirs: [fallbackDir2], toolsDir: fallbackDir2 };
36870
37173
  }
36871
37174
  const fallbackDir = join(dirname(currentFilePath), "..");
36872
- logger20.debug(`Fallback (development mode): ${fallbackDir}`);
37175
+ logger21.debug(`Fallback (development mode): ${fallbackDir}`);
36873
37176
  return { toolsDirs: [fallbackDir], toolsDir: fallbackDir };
36874
37177
  }
36875
37178
  var init_resolveToolsDirectories = __esm(() => {
@@ -36882,10 +37185,10 @@ __export(exports_cli, {
36882
37185
  run: () => run
36883
37186
  });
36884
37187
  import {
36885
- catchError as catchError19,
37188
+ catchError as catchError23,
36886
37189
  configureLogger,
36887
37190
  LogLevel,
36888
- logger as logger21,
37191
+ logger as logger22,
36889
37192
  registerHelpAll,
36890
37193
  setOutputFilter,
36891
37194
  setOutputFormat,
@@ -36904,13 +37207,14 @@ function getCliVersionPrefix() {
36904
37207
  async function buildProgram(context) {
36905
37208
  const program = new Command2;
36906
37209
  program.name("uip").description(`UiPath CLI ${package_default.version}`).version(package_default.version, "-v, --version").enablePositionalOptions();
37210
+ const globalOptions = stripGlobalOptions(context.args);
36907
37211
  const {
36908
37212
  args: cleanedArgs,
36909
37213
  format: helpFormat,
36910
37214
  filter,
36911
37215
  logLevel,
36912
37216
  logFile
36913
- } = stripGlobalOptions(context.args);
37217
+ } = globalOptions;
36914
37218
  context.args = cleanedArgs;
36915
37219
  setOutputFormat(helpFormat);
36916
37220
  setOutputFilter(filter);
@@ -36918,7 +37222,7 @@ async function buildProgram(context) {
36918
37222
  ...logLevel !== undefined && { level: logLevel },
36919
37223
  ...logFile !== undefined && { logFile }
36920
37224
  });
36921
- logger21.debug(`CLI v${package_default.version} starting — output=${helpFormat}, logLevel=${logLevel !== undefined ? LogLevel[logLevel].toLowerCase() : "default"}, logFile=${logFile ?? "none"}`);
37225
+ logger22.debug(`CLI v${package_default.version} starting — output=${helpFormat}, logLevel=${logLevel !== undefined ? LogLevel[logLevel].toLowerCase() : "default"}, logFile=${logFile ?? "none"}`);
36922
37226
  program.exitOverride();
36923
37227
  program.configureOutput({
36924
37228
  writeOut: context.output.writeOut,
@@ -36929,8 +37233,7 @@ async function buildProgram(context) {
36929
37233
  });
36930
37234
  program.configureHelp(createHelpConfiguration(context.capabilities.isBrowser));
36931
37235
  const storageAndToolsDirsPromise = (async () => {
36932
- logger21.debug("Initializing storage...");
36933
- const [storageError] = await catchError19(storage.init());
37236
+ const [storageError] = await catchError23(storage.init());
36934
37237
  if (storageError) {
36935
37238
  if (context.capabilities.isBrowser) {
36936
37239
  context.output.writeErr(`Storage initialization failed: ${errorMessage(storageError)}`);
@@ -36938,24 +37241,25 @@ async function buildProgram(context) {
36938
37241
  throw storageError;
36939
37242
  }
36940
37243
  } else {
36941
- logger21.debug("Storage initialized");
37244
+ logger22.debug("Storage initialized");
36942
37245
  }
36943
- logger21.debug("Resolving tool directories...");
36944
37246
  const result = await resolveToolsDirectories(context);
36945
- logger21.debug(`Resolved ${result.toolsDirs.length} tool directories: ${result.toolsDirs.join(", ") || "(none)"}`);
37247
+ logger22.debug(`Resolved ${result.toolsDirs.length} tool directories: ${result.toolsDirs.join(", ") || "(none)"}`);
36946
37248
  return result;
36947
37249
  })();
36948
37250
  const [, { toolsDirs, toolsDir }] = await Promise.all([
36949
- telemetryInit({ uip_version: package_default.version }).then(() => logger21.debug("Telemetry initialized")).catch((err) => logger21.warn(`Telemetry init failed (non-fatal): ${errorMessage(err)}`)),
37251
+ telemetryInit({ uip_version: package_default.version }).then(() => logger22.debug("Telemetry initialized")).catch((err) => logger22.warn(`Telemetry init failed (non-fatal): ${errorMessage(err)}`)),
36950
37252
  storageAndToolsDirsPromise
36951
37253
  ]);
36952
- logger21.debug("Registering login/logout commands");
36953
37254
  registerLoginCommand(program, context);
36954
37255
  registerLogoutCommand(program, context);
37256
+ if (!context.capabilities.isBrowser) {
37257
+ registerFeedbackCommand(program, context);
37258
+ registerSkillsCommand(program);
37259
+ }
37260
+ registerMcpCommand(program);
36955
37261
  const resolveInstallPath = createInstallPathResolver(toolsDir, context.capabilities.isBrowser);
36956
- logger21.debug("Discovering tool paths...");
36957
37262
  let discoveredTools = await discoverToolPaths(toolsDirs);
36958
- logger21.debug(`Discovered ${discoveredTools.length} tools: ${discoveredTools.map((t) => t.commandPrefix).join(", ") || "(none)"}`);
36959
37263
  const toolManager = new ToolManager([], toolsDirs, resolveInstallPath, getCliVersionPrefix(), discoveredTools);
36960
37264
  setPackagerFactoryProvider((verb) => toolManager.ensurePackagerFactory(verb));
36961
37265
  if (toolsDir) {
@@ -36964,7 +37268,7 @@ async function buildProgram(context) {
36964
37268
  discoveredTools = await discoverToolPaths(toolsDirs);
36965
37269
  }
36966
37270
  }
36967
- registerLazyToolCommands(program, discoveredTools, context);
37271
+ registerToolCommands(program, discoveredTools, context);
36968
37272
  registerToolsCommand(program, context, {
36969
37273
  tools: toolManager.getTools(),
36970
37274
  discoveredTools,
@@ -36972,36 +37276,33 @@ async function buildProgram(context) {
36972
37276
  resolveInstallPath,
36973
37277
  getCliVersionPrefix
36974
37278
  });
36975
- if (!context.capabilities.isBrowser) {
36976
- logger21.debug("Registering skills command");
36977
- registerSkillsCommand(program);
36978
- }
36979
- logger21.debug("Registering MCP command");
36980
- registerMcpCommand(program);
37279
+ logger22.debug(`Discovered ${discoveredTools.length} tools: ${discoveredTools.map((t) => t.commandPrefix).join(", ") || "(none)"}`);
36981
37280
  registerHelpAll(program);
36982
37281
  for (const cmd of program.commands) {
36983
37282
  registerHelpAll(cmd);
36984
37283
  }
36985
- logger21.debug("Program built successfully — ready to parse args");
36986
- return { program, cleanedArgs };
37284
+ logger22.debug("Program built successfully — ready to parse args");
37285
+ return { program, cleanedArgs, globalOptions };
36987
37286
  }
36988
37287
  async function run(context) {
36989
37288
  const { program, cleanedArgs } = await buildProgram(context);
36990
- logger21.debug(`Parsing args: ${cleanedArgs.slice(2).join(" ")}`);
36991
- const [parseError] = await catchError19(program.parseAsync(cleanedArgs));
37289
+ logger22.debug(`Parsing args: ${cleanedArgs.slice(2).join(" ")}`);
37290
+ const [parseError] = await catchError23(program.parseAsync(cleanedArgs));
36992
37291
  if (parseError) {
36993
37292
  await handleParseError(parseError, cleanedArgs, context);
36994
- return;
36995
37293
  }
36996
- logger21.debug("Command completed flushing telemetry");
37294
+ if (!process.exitCode || process.exitCode === 0) {
37295
+ logger22.debug("Command completed — flushing telemetry");
37296
+ context.exit(0);
37297
+ }
36997
37298
  await telemetryFlushAndShutdown2();
36998
- context.exit(0);
36999
37299
  }
37000
37300
  var init_cli = __esm(() => {
37001
37301
  init_package();
37002
37302
  init_login();
37003
37303
  init_logout();
37004
37304
  init_mcp2();
37305
+ init_send_feedback();
37005
37306
  init_skills();
37006
37307
  init_tools();
37007
37308
  init_installPath();