@uipath/cli 0.1.16 → 0.1.19

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 +631 -305
  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.19",
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
  }
@@ -179,7 +179,11 @@ var init_auth = __esm(() => {
179
179
 
180
180
  // src/commands/login.ts
181
181
  import { DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME } from "@uipath/auth";
182
- import { catchError, OutputFormatter } from "@uipath/common";
182
+ import {
183
+ catchError,
184
+ OutputFormatter,
185
+ resolveEnvReference
186
+ } from "@uipath/common";
183
187
  import { getFileSystem } from "@uipath/filesystem";
184
188
  function resolveAuthFilePath(folder) {
185
189
  if (folder) {
@@ -188,13 +192,28 @@ function resolveAuthFilePath(folder) {
188
192
  return DEFAULT_ENV_FILENAME;
189
193
  }
190
194
  function registerLoginCommand(program, context) {
191
- const loginCommand = program.command("login").description("Login to UiPath Cloud").option("-f, --file <folder>", "Path to credentials folder").option("--authority <url>", "Custom authority URL").option("--client-id <id>", "Client Id or Application Id (default: uses built-in client for interactive login)").option("--client-secret <secret>", "Client Secret or Application Secret (External Apps)").option("-s, --scope <scopes>", "Custom scopes or Application scopes (External Apps). Space separated values.").option("-t, --tenant <name>", "Tenant name (non-interactive mode)").option("--it, --interactive", "Interactively select tenant from list").trackedAction(context, async (options) => {
195
+ const loginCommand = program.command("login").description("Login to UiPath Cloud").option("-f, --file <folder>", "Path to credentials folder").option("--authority <url>", "Custom authority URL").option("--client-id <id>", "Client Id or Application Id. Use env.ENV_NAME to read from an environment variable").option("--client-secret <secret>", "Client Secret or Application Secret. Use env.ENV_NAME to read from an environment variable").option("-s, --scope <scopes>", "Custom scopes or Application scopes (External Apps). Space separated values.").option("-t, --tenant <name>", "Tenant name (non-interactive mode)").option("--it, --interactive", "Interactively select tenant from list").trackedAction(context, async (options) => {
192
196
  const envFilePath = resolveAuthFilePath(options.file);
197
+ let clientId;
198
+ let clientSecret;
199
+ try {
200
+ clientId = resolveEnvReference(options.clientId);
201
+ clientSecret = resolveEnvReference(options.clientSecret);
202
+ } catch (e) {
203
+ const message = e instanceof Error ? e.message : String(e);
204
+ OutputFormatter.error({
205
+ Result: "Failure",
206
+ Message: message,
207
+ Instructions: "Inspect command arguments and try again."
208
+ });
209
+ context.exit(1);
210
+ return;
211
+ }
193
212
  const [error, authResult] = await catchError(auth.interactiveLogin({
194
213
  envFilePath,
195
214
  authority: options.authority,
196
- clientId: options.clientId,
197
- clientSecret: options.clientSecret,
215
+ clientId,
216
+ clientSecret,
198
217
  scope: options.scope ? options.scope.split(" ") : undefined,
199
218
  tenant: options.tenant,
200
219
  interactive: options.interactive
@@ -29739,23 +29758,323 @@ function registerMcpCommand(program) {
29739
29758
  }
29740
29759
  var init_mcp2 = () => {};
29741
29760
 
29761
+ // src/services/deviceId.ts
29762
+ import { randomUUID } from "node:crypto";
29763
+ import { catchError as catchError4, logger, UIPATH_HOME_DIR } from "@uipath/common";
29764
+ import { getFileSystem as getFileSystem3 } from "@uipath/filesystem";
29765
+ async function getOrCreateDeviceId() {
29766
+ const fs = getFileSystem3();
29767
+ const homeDir = fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR);
29768
+ const filePath = fs.path.join(homeDir, DEVICE_ID_FILENAME);
29769
+ const existing = await fs.readFile(filePath, "utf-8");
29770
+ if (existing?.trim()) {
29771
+ return existing.trim();
29772
+ }
29773
+ const newId = randomUUID();
29774
+ const [writeError] = await catchError4((async () => {
29775
+ if (!await fs.exists(homeDir)) {
29776
+ await fs.mkdir(homeDir);
29777
+ }
29778
+ await fs.writeFile(filePath, newId);
29779
+ })());
29780
+ if (writeError) {
29781
+ logger.warn(`Failed to persist device ID: ${writeError.message}`);
29782
+ }
29783
+ return newId;
29784
+ }
29785
+ var DEVICE_ID_FILENAME = "cli-device-id";
29786
+ var init_deviceId = () => {};
29787
+
29788
+ // src/services/environmentInfo.ts
29789
+ import { arch as osArch, release as osRelease, type as osType } from "node:os";
29790
+ import { catchError as catchError5 } from "@uipath/common";
29791
+ function decodeJwtPayload(token) {
29792
+ const parts = token.split(".");
29793
+ if (parts.length !== 3)
29794
+ return;
29795
+ const base643 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
29796
+ const padded = base643 + "=".repeat((4 - base643.length % 4) % 4);
29797
+ const [, parsed] = catchError5(() => JSON.parse(atob(padded)));
29798
+ return parsed;
29799
+ }
29800
+ async function getAuthContext() {
29801
+ const [statusError, status] = await catchError5(auth.getLoginStatus());
29802
+ if (statusError || status.loginStatus !== "Logged in" || !status.accessToken) {
29803
+ return {};
29804
+ }
29805
+ const claims = decodeJwtPayload(status.accessToken);
29806
+ return {
29807
+ email: claims?.email ?? claims?.preferred_username,
29808
+ userId: claims?.sub,
29809
+ organizationId: status.organizationId,
29810
+ organizationName: status.organizationName,
29811
+ tenantId: status.tenantId,
29812
+ tenantName: status.tenantName
29813
+ };
29814
+ }
29815
+ function buildEnvironmentString(authCtx) {
29816
+ const lines = [
29817
+ `CLI Version: ${package_default.version}`,
29818
+ `Node Version: ${process.version}`,
29819
+ `OS: ${osType()} ${osRelease()} (${osArch()})`,
29820
+ `Platform: ${process.platform}`
29821
+ ];
29822
+ if (authCtx.userId)
29823
+ lines.push(`Cloud User ID: ${authCtx.userId}`);
29824
+ if (authCtx.organizationName)
29825
+ lines.push(`Cloud Organization: ${authCtx.organizationName}`);
29826
+ if (authCtx.organizationId)
29827
+ lines.push(`Cloud Organization ID: ${authCtx.organizationId}`);
29828
+ if (authCtx.tenantName)
29829
+ lines.push(`Tenant: ${authCtx.tenantName}`);
29830
+ if (authCtx.tenantId)
29831
+ lines.push(`Tenant ID: ${authCtx.tenantId}`);
29832
+ return lines.join(`
29833
+ `);
29834
+ }
29835
+ var init_environmentInfo = __esm(() => {
29836
+ init_package();
29837
+ init_auth();
29838
+ });
29839
+
29840
+ // src/services/feedbackService.ts
29841
+ import { catchError as catchError6, DEFAULT_FETCH_TIMEOUT_MS } from "@uipath/common";
29842
+ import { getFileSystem as getFileSystem4 } from "@uipath/filesystem";
29843
+ async function createFeedbackIssue(options) {
29844
+ const feedbackType = FEEDBACK_TYPE_MAP[options.type];
29845
+ const priorityId = PRIORITY_MAP[options.priority];
29846
+ const descriptionParts = [options.description];
29847
+ if (options.email) {
29848
+ descriptionParts.push(`User Email: ${options.email}`);
29849
+ }
29850
+ const body = {
29851
+ fields: {
29852
+ project: { id: PROJECT_ID },
29853
+ components: [{ id: CLI_COMPONENT_ID }],
29854
+ versions: [],
29855
+ summary: options.title,
29856
+ description: descriptionParts.join(`
29857
+ `),
29858
+ issuetype: { id: feedbackType.id, name: feedbackType.name },
29859
+ [FIELD_ENVIRONMENT]: options.environment,
29860
+ [FIELD_STEPS_TO_REPRODUCE]: "",
29861
+ labels: [],
29862
+ priority: { id: priorityId }
29863
+ }
29864
+ };
29865
+ const response = await fetch(`${FEEDBACK_ENDPOINT}/issue/`, {
29866
+ method: "POST",
29867
+ headers: {
29868
+ "Content-Type": "application/json",
29869
+ "Accept-Encoding": "gzip, deflate",
29870
+ deviceId: options.deviceId
29871
+ },
29872
+ body: JSON.stringify(body),
29873
+ signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS)
29874
+ });
29875
+ const text = await response.text();
29876
+ if (!response.ok) {
29877
+ if (response.status === 429) {
29878
+ throw new Error("Too many feedback submissions. Please wait and try again later.");
29879
+ }
29880
+ throw new Error(`Failed to create feedback issue: ${text}`);
29881
+ }
29882
+ const [parseError, result] = catchError6(() => JSON.parse(text));
29883
+ if (parseError || !result?.key) {
29884
+ throw new Error(`Unexpected response from feedback service: ${text}`);
29885
+ }
29886
+ return { key: result.key, sig: result.sig ?? "" };
29887
+ }
29888
+ async function uploadAttachment(issueId, signature, deviceId, filePath) {
29889
+ const fs = getFileSystem4();
29890
+ const fileBuffer = await fs.readFile(filePath);
29891
+ if (!fileBuffer) {
29892
+ throw new Error(`Could not read attachment: "${fs.path.basename(filePath)}"`);
29893
+ }
29894
+ const fileName = fs.path.basename(filePath);
29895
+ const formData = new FormData;
29896
+ formData.append("file", new Blob([fileBuffer]), fileName);
29897
+ const response = await fetch(`${FEEDBACK_ENDPOINT}/issue/${issueId}/attachments`, {
29898
+ method: "POST",
29899
+ headers: {
29900
+ "X-SIG": signature,
29901
+ deviceId,
29902
+ "Accept-Encoding": "gzip, deflate"
29903
+ },
29904
+ body: formData,
29905
+ signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS)
29906
+ });
29907
+ const text = await response.text();
29908
+ if (!response.ok) {
29909
+ throw new Error(`Failed to upload attachment "${fileName}": ${text}`);
29910
+ }
29911
+ }
29912
+ async function validateAttachment(filePath) {
29913
+ const MAX_FILE_SIZE = 10 * 1024 * 1024;
29914
+ const fs = getFileSystem4();
29915
+ const stat = await fs.stat(filePath);
29916
+ if (!stat) {
29917
+ throw new Error(`Attachment not found: "${fs.path.basename(filePath)}"`);
29918
+ }
29919
+ if (stat.size > MAX_FILE_SIZE) {
29920
+ throw new Error(`Attachment "${fs.path.basename(filePath)}" exceeds 10 MB limit (${Math.round(stat.size / 1024 / 1024)} MB).`);
29921
+ }
29922
+ }
29923
+ 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;
29924
+ var init_feedbackService = __esm(() => {
29925
+ FEEDBACK_ENDPOINT = atob("aHR0cHM6Ly9zdHVkaW8tZmVlZGJhY2suYXp1cmUtYXBpLm5ldC9jb2RpbmctYWdlbnRz");
29926
+ FEEDBACK_TYPE_MAP = {
29927
+ bug: { id: "1", name: "Bug" },
29928
+ improvement: { id: "4", name: "Improvement" }
29929
+ };
29930
+ PRIORITY_MAP = {
29931
+ critical: "3",
29932
+ normal: "5",
29933
+ minor: "4"
29934
+ };
29935
+ });
29936
+
29937
+ // src/commands/send-feedback.ts
29938
+ import { catchError as catchError7, logger as logger2, OutputFormatter as OutputFormatter3 } from "@uipath/common";
29939
+ import { getFileSystem as getFileSystem5 } from "@uipath/filesystem";
29940
+ function registerFeedbackCommand(program, context) {
29941
+ const feedback = program.command("feedback").description("Send bug reports and improvement suggestions");
29942
+ 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) => {
29943
+ if (!VALID_TYPES.includes(options.type)) {
29944
+ OutputFormatter3.error({
29945
+ Result: "Failure",
29946
+ Message: `Invalid feedback type: "${options.type}"`,
29947
+ Instructions: `--type must be one of: ${VALID_TYPES.join(", ")}`
29948
+ });
29949
+ context.exit(1);
29950
+ return;
29951
+ }
29952
+ if (!VALID_PRIORITIES.includes(options.priority)) {
29953
+ OutputFormatter3.error({
29954
+ Result: "Failure",
29955
+ Message: `Invalid priority: "${options.priority}"`,
29956
+ Instructions: `--priority must be one of: ${VALID_PRIORITIES.join(", ")}`
29957
+ });
29958
+ context.exit(1);
29959
+ return;
29960
+ }
29961
+ const attachments = options.attachment ?? [];
29962
+ if (attachments.length > MAX_ATTACHMENTS) {
29963
+ OutputFormatter3.error({
29964
+ Result: "Failure",
29965
+ Message: `Too many attachments: ${attachments.length}`,
29966
+ Instructions: `Maximum ${MAX_ATTACHMENTS} attachments allowed.`
29967
+ });
29968
+ context.exit(1);
29969
+ return;
29970
+ }
29971
+ const fs = getFileSystem5();
29972
+ for (const filePath of attachments) {
29973
+ if (!await fs.exists(filePath)) {
29974
+ OutputFormatter3.error({
29975
+ Result: "Failure",
29976
+ Message: `Attachment not found: "${filePath}"`,
29977
+ Instructions: "Check the file path and try again."
29978
+ });
29979
+ context.exit(1);
29980
+ return;
29981
+ }
29982
+ const [validateError] = await catchError7(validateAttachment(filePath));
29983
+ if (validateError) {
29984
+ OutputFormatter3.error({
29985
+ Result: "Failure",
29986
+ Message: validateError.message,
29987
+ Instructions: "Reduce the file size or choose a different file."
29988
+ });
29989
+ context.exit(1);
29990
+ return;
29991
+ }
29992
+ }
29993
+ const [deviceIdError, deviceId] = await catchError7(getOrCreateDeviceId());
29994
+ if (deviceIdError) {
29995
+ OutputFormatter3.error({
29996
+ Result: "Failure",
29997
+ Message: deviceIdError.message,
29998
+ Instructions: "Failed to generate device ID."
29999
+ });
30000
+ context.exit(1);
30001
+ return;
30002
+ }
30003
+ const authCtx = await getAuthContext();
30004
+ const email3 = options.email ?? authCtx.email;
30005
+ const feedbackOptions = {
30006
+ type: options.type,
30007
+ priority: options.priority,
30008
+ title: options.title,
30009
+ description: options.description,
30010
+ email: email3,
30011
+ environment: buildEnvironmentString(authCtx),
30012
+ deviceId
30013
+ };
30014
+ const [createError, result] = await catchError7(createFeedbackIssue(feedbackOptions));
30015
+ if (createError) {
30016
+ OutputFormatter3.error({
30017
+ Result: "Failure",
30018
+ Message: createError.message,
30019
+ Instructions: "Failed to submit feedback. Check your network connection and try again."
30020
+ });
30021
+ context.exit(1);
30022
+ return;
30023
+ }
30024
+ let attachmentsUploaded = 0;
30025
+ for (const filePath of attachments) {
30026
+ const [attachError] = await catchError7(uploadAttachment(result.key, result.sig, deviceId, filePath));
30027
+ if (attachError) {
30028
+ logger2.warn(`Failed to upload attachment "${filePath}": ${attachError.message}`);
30029
+ } else {
30030
+ attachmentsUploaded++;
30031
+ }
30032
+ }
30033
+ OutputFormatter3.success({
30034
+ Result: "Success",
30035
+ Code: "FeedbackSent",
30036
+ Data: {
30037
+ IssueKey: result.key,
30038
+ Type: options.type,
30039
+ Title: options.title,
30040
+ ...attachments.length > 0 && {
30041
+ AttachmentsUploaded: `${attachmentsUploaded}/${attachments.length}`
30042
+ }
30043
+ }
30044
+ });
30045
+ }, (options) => ({
30046
+ feedbackType: options.type,
30047
+ priority: options.priority,
30048
+ hasEmail: !!options.email,
30049
+ attachmentCount: options.attachment?.length ?? 0
30050
+ }));
30051
+ }
30052
+ var VALID_TYPES, VALID_PRIORITIES, MAX_ATTACHMENTS = 10;
30053
+ var init_send_feedback = __esm(() => {
30054
+ init_deviceId();
30055
+ init_environmentInfo();
30056
+ init_feedbackService();
30057
+ VALID_TYPES = ["bug", "improvement"];
30058
+ VALID_PRIORITIES = ["critical", "normal", "minor"];
30059
+ });
30060
+
29742
30061
  // src/commands/skills/agents/claude.ts
29743
30062
  var exports_claude = {};
29744
30063
  __export(exports_claude, {
29745
30064
  uninstall: () => uninstall,
29746
30065
  install: () => install
29747
30066
  });
29748
- import { logger } from "@uipath/common";
29749
- import { getFileSystem as getFileSystem3 } from "@uipath/filesystem";
30067
+ import { logger as logger3 } from "@uipath/common";
30068
+ import { getFileSystem as getFileSystem6 } from "@uipath/filesystem";
29750
30069
  async function install(skill, rootDir) {
29751
- const fs = getFileSystem3();
30070
+ const fs = getFileSystem6();
29752
30071
  const target = fs.path.join(rootDir, ".claude", "skills", skill.name);
29753
30072
  await fs.mkdir(target);
29754
30073
  await fs.copyDirectory(skill.skillDir, target);
29755
- logger.info(` claude: installed ${skill.name}`);
30074
+ logger3.info(` claude: installed ${skill.name}`);
29756
30075
  }
29757
30076
  async function uninstall(skillName, rootDir) {
29758
- const fs = getFileSystem3();
30077
+ const fs = getFileSystem6();
29759
30078
  const target = fs.path.join(rootDir, ".claude", "skills", skillName);
29760
30079
  if (await fs.exists(target)) {
29761
30080
  await fs.rm(target);
@@ -32412,23 +32731,23 @@ var init_js_yaml = __esm(() => {
32412
32731
 
32413
32732
  // src/commands/skills/contentStore.ts
32414
32733
  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";
32734
+ import { catchError as catchError8, logger as logger4, UIPATH_HOME_DIR as UIPATH_HOME_DIR2 } from "@uipath/common";
32735
+ import { getFileSystem as getFileSystem7 } from "@uipath/filesystem";
32417
32736
  async function getContentStore(rootDir) {
32418
- const fs = getFileSystem4();
32737
+ const fs = getFileSystem7();
32419
32738
  const storePath = fs.path.join(rootDir, STORE_NAME);
32420
32739
  let needsClone = true;
32421
32740
  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));
32741
+ logger4.info("Updating content store...");
32742
+ const [pullError] = await catchError8(runGit(["pull", "--ff-only"], storePath));
32424
32743
  if (pullError) {
32425
- logger2.warn("git pull failed, re-cloning...");
32744
+ logger4.warn("git pull failed, re-cloning...");
32426
32745
  } else {
32427
32746
  needsClone = false;
32428
32747
  }
32429
32748
  }
32430
32749
  if (needsClone) {
32431
- logger2.info("Downloading content store...");
32750
+ logger4.info("Downloading content store...");
32432
32751
  let savedManifest = null;
32433
32752
  const manifestPath = fs.path.join(storePath, MANIFEST_NAME);
32434
32753
  if (await fs.exists(storePath)) {
@@ -32438,9 +32757,9 @@ async function getContentStore(rootDir) {
32438
32757
  await fs.rm(storePath);
32439
32758
  }
32440
32759
  await fs.mkdir(storePath);
32441
- const [cloneError] = await catchError4(runGit(["clone", "--depth", "1", REPO_URL, storePath], rootDir));
32760
+ const [cloneError] = await catchError8(runGit(["clone", "--depth", "1", REPO_URL, storePath], rootDir));
32442
32761
  if (cloneError) {
32443
- logger2.info("git clone failed, falling back to zip download...");
32762
+ logger4.info("git clone failed, falling back to zip download...");
32444
32763
  await downloadAndExtractZip(storePath);
32445
32764
  }
32446
32765
  if (savedManifest !== null) {
@@ -32450,7 +32769,7 @@ async function getContentStore(rootDir) {
32450
32769
  return storePath;
32451
32770
  }
32452
32771
  async function readSkillDescription(fs, skillMdPath) {
32453
- const [err, content] = await catchError4(fs.readFile(skillMdPath, { encoding: "utf-8" }));
32772
+ const [err, content] = await catchError8(fs.readFile(skillMdPath, { encoding: "utf-8" }));
32454
32773
  if (err || !content)
32455
32774
  return;
32456
32775
  const head = content.length > 2048 ? content.slice(0, 2048) : content;
@@ -32458,7 +32777,7 @@ async function readSkillDescription(fs, skillMdPath) {
32458
32777
  return meta3.description;
32459
32778
  }
32460
32779
  async function getAvailableSkills(storePath) {
32461
- const fs = getFileSystem4();
32780
+ const fs = getFileSystem7();
32462
32781
  const skills = [];
32463
32782
  const rootSkillsDir = fs.path.join(storePath, "skills");
32464
32783
  if (await fs.exists(rootSkillsDir)) {
@@ -32504,7 +32823,7 @@ function parseSkillMd(content) {
32504
32823
  return { meta: meta3, body: fmMatch[2] };
32505
32824
  }
32506
32825
  async function getSkillMetadata(skillMdPath) {
32507
- const fs = getFileSystem4();
32826
+ const fs = getFileSystem7();
32508
32827
  const content = await fs.readFile(skillMdPath, { encoding: "utf-8" });
32509
32828
  if (content === null) {
32510
32829
  throw new Error(`Skill metadata not found: ${skillMdPath}`);
@@ -32512,7 +32831,7 @@ async function getSkillMetadata(skillMdPath) {
32512
32831
  return parseSkillMd(content);
32513
32832
  }
32514
32833
  function rewriteBody(body, skillDir, targetDir) {
32515
- const fs = getFileSystem4();
32834
+ const fs = getFileSystem7();
32516
32835
  const relFromTarget = fs.path.relative(targetDir, skillDir).split("\\").join("/");
32517
32836
  return body.replace(/(\[.*?\]\()(?!https?:\/\/|\/)([^)]+?)(\))/g, (_match, prefix, relPath, suffix) => {
32518
32837
  const rewritten = [relFromTarget, relPath].join("/").replace(/\/+/g, "/");
@@ -32522,7 +32841,7 @@ function rewriteBody(body, skillDir, targetDir) {
32522
32841
  async function setMarkedBlock(filePath, marker, content, commentStyle = "hash") {
32523
32842
  const startTag = commentStyle === "html" ? `<!-- ${marker} START -->` : `# ${marker} START`;
32524
32843
  const endTag = commentStyle === "html" ? `<!-- ${marker} END -->` : `# ${marker} END`;
32525
- const fs = getFileSystem4();
32844
+ const fs = getFileSystem7();
32526
32845
  const block = `${startTag}
32527
32846
  ${content}
32528
32847
  ${endTag}`;
@@ -32541,7 +32860,7 @@ ${endTag}`;
32541
32860
  }
32542
32861
  }
32543
32862
  async function removeMarkedBlock(filePath, marker, commentStyle = "hash") {
32544
- const fs = getFileSystem4();
32863
+ const fs = getFileSystem7();
32545
32864
  const startTag = commentStyle === "html" ? `<!-- ${marker} START -->` : `# ${marker} START`;
32546
32865
  const endTag = commentStyle === "html" ? `<!-- ${marker} END -->` : `# ${marker} END`;
32547
32866
  const existing = await fs.readFile(filePath, { encoding: "utf-8" });
@@ -32558,7 +32877,7 @@ async function removeMarkedBlock(filePath, marker, commentStyle = "hash") {
32558
32877
  await fs.writeFile(filePath, updated);
32559
32878
  }
32560
32879
  async function addToGitignore(rootDir, entry) {
32561
- const fs = getFileSystem4();
32880
+ const fs = getFileSystem7();
32562
32881
  const gitignorePath = fs.path.join(rootDir, ".gitignore");
32563
32882
  const content = await fs.readFile(gitignorePath, { encoding: "utf-8" }) ?? "";
32564
32883
  const lines = content.split(`
@@ -32572,19 +32891,19 @@ async function addToGitignore(rootDir, entry) {
32572
32891
  }
32573
32892
  }
32574
32893
  async function readManifest(storePath) {
32575
- const fs = getFileSystem4();
32894
+ const fs = getFileSystem7();
32576
32895
  const manifestPath = fs.path.join(storePath, MANIFEST_NAME);
32577
32896
  const content = await fs.readFile(manifestPath, { encoding: "utf-8" });
32578
32897
  if (content === null) {
32579
32898
  return { skills: {} };
32580
32899
  }
32581
- const [parseError, parsed] = catchError4(() => JSON.parse(content));
32900
+ const [parseError, parsed] = catchError8(() => JSON.parse(content));
32582
32901
  if (parseError)
32583
32902
  return { skills: {} };
32584
32903
  return parsed;
32585
32904
  }
32586
32905
  async function writeManifest(storePath, manifest) {
32587
- const fs = getFileSystem4();
32906
+ const fs = getFileSystem7();
32588
32907
  const manifestPath = fs.path.join(storePath, MANIFEST_NAME);
32589
32908
  await fs.writeFile(manifestPath, `${JSON.stringify(manifest, null, 4)}
32590
32909
  `);
@@ -32650,7 +32969,7 @@ function runGit(args, cwd) {
32650
32969
  });
32651
32970
  }
32652
32971
  async function downloadAndExtractZip(storePath) {
32653
- const fs = getFileSystem4();
32972
+ const fs = getFileSystem7();
32654
32973
  const response = await fetch(ZIP_URL, {
32655
32974
  signal: AbortSignal.timeout(60000)
32656
32975
  });
@@ -32692,7 +33011,7 @@ async function downloadAndExtractZip(storePath) {
32692
33011
  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
33012
  var init_contentStore = __esm(() => {
32694
33013
  init_js_yaml();
32695
- STORE_NAME = `${UIPATH_HOME_DIR}/.skills`;
33014
+ STORE_NAME = `${UIPATH_HOME_DIR2}/.skills`;
32696
33015
  });
32697
33016
 
32698
33017
  // src/commands/skills/agents/codex.ts
@@ -32701,10 +33020,10 @@ __export(exports_codex, {
32701
33020
  uninstall: () => uninstall2,
32702
33021
  install: () => install2
32703
33022
  });
32704
- import { logger as logger3 } from "@uipath/common";
32705
- import { getFileSystem as getFileSystem5 } from "@uipath/filesystem";
33023
+ import { logger as logger5 } from "@uipath/common";
33024
+ import { getFileSystem as getFileSystem8 } from "@uipath/filesystem";
32706
33025
  async function install2(skill, rootDir) {
32707
- const fs = getFileSystem5();
33026
+ const fs = getFileSystem8();
32708
33027
  const isGlobal = fs.path.resolve(rootDir) === fs.path.resolve(fs.env.homedir());
32709
33028
  const targetFile = isGlobal ? fs.path.join(rootDir, ".codex", "instructions.md") : fs.path.join(rootDir, "codex.md");
32710
33029
  await fs.mkdir(fs.path.dirname(targetFile));
@@ -32713,10 +33032,10 @@ async function install2(skill, rootDir) {
32713
33032
  const marker = `uipath-skill:${skill.name}`;
32714
33033
  const content = `See ${relPath} for ${skill.name} instructions.`;
32715
33034
  await setMarkedBlock(targetFile, marker, content, "html");
32716
- logger3.info(` codex: installed ${skill.name}`);
33035
+ logger5.info(` codex: installed ${skill.name}`);
32717
33036
  }
32718
33037
  async function uninstall2(skillName, rootDir) {
32719
- const fs = getFileSystem5();
33038
+ const fs = getFileSystem8();
32720
33039
  const isGlobal = fs.path.resolve(rootDir) === fs.path.resolve(fs.env.homedir());
32721
33040
  const targetFile = isGlobal ? fs.path.join(rootDir, ".codex", "instructions.md") : fs.path.join(rootDir, "codex.md");
32722
33041
  const marker = `uipath-skill:${skillName}`;
@@ -32732,10 +33051,10 @@ __export(exports_copilot, {
32732
33051
  uninstall: () => uninstall3,
32733
33052
  install: () => install3
32734
33053
  });
32735
- import { logger as logger4 } from "@uipath/common";
32736
- import { getFileSystem as getFileSystem6 } from "@uipath/filesystem";
33054
+ import { logger as logger6 } from "@uipath/common";
33055
+ import { getFileSystem as getFileSystem9 } from "@uipath/filesystem";
32737
33056
  async function install3(skill, rootDir) {
32738
- const fs = getFileSystem6();
33057
+ const fs = getFileSystem9();
32739
33058
  const skillMdPath = fs.path.join(skill.skillDir, "SKILL.md");
32740
33059
  const { meta: meta3, body } = await getSkillMetadata(skillMdPath);
32741
33060
  const targetDir = fs.path.join(rootDir, ".github", "instructions");
@@ -32746,10 +33065,10 @@ applyTo: "${Array.isArray(meta3.globs) ? meta3.globs.join(", ") : meta3.globs}"
32746
33065
  ---
32747
33066
  ` : "";
32748
33067
  await fs.writeFile(fs.path.join(targetDir, `${skill.name}.instructions.md`), header + rewritten);
32749
- logger4.info(` copilot: installed ${skill.name}`);
33068
+ logger6.info(` copilot: installed ${skill.name}`);
32750
33069
  }
32751
33070
  async function uninstall3(skillName, rootDir) {
32752
- const fs = getFileSystem6();
33071
+ const fs = getFileSystem9();
32753
33072
  const target = fs.path.join(rootDir, ".github", "instructions", `${skillName}.instructions.md`);
32754
33073
  if (await fs.exists(target)) {
32755
33074
  await fs.rm(target);
@@ -32765,10 +33084,10 @@ __export(exports_cursor, {
32765
33084
  uninstall: () => uninstall4,
32766
33085
  install: () => install4
32767
33086
  });
32768
- import { logger as logger5 } from "@uipath/common";
32769
- import { getFileSystem as getFileSystem7 } from "@uipath/filesystem";
33087
+ import { logger as logger7 } from "@uipath/common";
33088
+ import { getFileSystem as getFileSystem10 } from "@uipath/filesystem";
32770
33089
  async function install4(skill, rootDir) {
32771
- const fs = getFileSystem7();
33090
+ const fs = getFileSystem10();
32772
33091
  const skillMdPath = fs.path.join(skill.skillDir, "SKILL.md");
32773
33092
  const { meta: meta3, body } = await getSkillMetadata(skillMdPath);
32774
33093
  const targetDir = fs.path.join(rootDir, ".cursor", "rules");
@@ -32776,10 +33095,10 @@ async function install4(skill, rootDir) {
32776
33095
  const rewritten = rewriteBody(body, skill.skillDir, targetDir);
32777
33096
  const mdc = buildMdc(skill.name, meta3, rewritten);
32778
33097
  await fs.writeFile(fs.path.join(targetDir, `${skill.name}.mdc`), mdc);
32779
- logger5.info(` cursor: installed ${skill.name}`);
33098
+ logger7.info(` cursor: installed ${skill.name}`);
32780
33099
  }
32781
33100
  async function uninstall4(skillName, rootDir) {
32782
- const fs = getFileSystem7();
33101
+ const fs = getFileSystem10();
32783
33102
  const target = fs.path.join(rootDir, ".cursor", "rules", `${skillName}.mdc`);
32784
33103
  if (await fs.exists(target)) {
32785
33104
  await fs.rm(target);
@@ -32810,10 +33129,10 @@ __export(exports_gemini, {
32810
33129
  uninstall: () => uninstall5,
32811
33130
  install: () => install5
32812
33131
  });
32813
- import { logger as logger6 } from "@uipath/common";
32814
- import { getFileSystem as getFileSystem8 } from "@uipath/filesystem";
33132
+ import { logger as logger8 } from "@uipath/common";
33133
+ import { getFileSystem as getFileSystem11 } from "@uipath/filesystem";
32815
33134
  async function install5(skill, rootDir) {
32816
- const fs = getFileSystem8();
33135
+ const fs = getFileSystem11();
32817
33136
  const geminiDir = fs.path.join(rootDir, ".gemini");
32818
33137
  const geminiMd = fs.path.join(geminiDir, "GEMINI.md");
32819
33138
  await fs.mkdir(geminiDir);
@@ -32822,10 +33141,10 @@ async function install5(skill, rootDir) {
32822
33141
  const marker = `uipath-skill:${skill.name}`;
32823
33142
  const content = `@import ${relPath}`;
32824
33143
  await setMarkedBlock(geminiMd, marker, content, "html");
32825
- logger6.info(` gemini: installed ${skill.name}`);
33144
+ logger8.info(` gemini: installed ${skill.name}`);
32826
33145
  }
32827
33146
  async function uninstall5(skillName, rootDir) {
32828
- const fs = getFileSystem8();
33147
+ const fs = getFileSystem11();
32829
33148
  const geminiMd = fs.path.join(rootDir, ".gemini", "GEMINI.md");
32830
33149
  const marker = `uipath-skill:${skillName}`;
32831
33150
  await removeMarkedBlock(geminiMd, marker, "html");
@@ -34756,23 +35075,23 @@ var init_prompt = __esm(() => {
34756
35075
  });
34757
35076
 
34758
35077
  // 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";
35078
+ import { catchError as catchError9, logger as logger9, OutputFormatter as OutputFormatter4 } from "@uipath/common";
35079
+ import { getFileSystem as getFileSystem12 } from "@uipath/filesystem";
34761
35080
  function handlePromptCancellation(err, operation) {
34762
35081
  if (err instanceof Error && err.name === "ExitPromptError") {
34763
- logger7.warn(`${operation.charAt(0).toUpperCase() + operation.slice(1)} cancelled.`);
35082
+ logger9.warn(`${operation.charAt(0).toUpperCase() + operation.slice(1)} cancelled.`);
34764
35083
  throw Object.assign(new Error("cancelled"), { exitCode: 130 });
34765
35084
  }
34766
35085
  throw err;
34767
35086
  }
34768
35087
  async function resolveSkillsContext(options, operation) {
34769
35088
  const isLocal = !!options.local;
34770
- const fs = getFileSystem9();
35089
+ const fs = getFileSystem12();
34771
35090
  const rootDir = isLocal ? fs.env.cwd() : fs.env.homedir();
34772
35091
  const storePath = await getContentStore(rootDir);
34773
35092
  const availableSkills = await getAvailableSkills(storePath);
34774
35093
  if (availableSkills.length === 0) {
34775
- OutputFormatter3.error({
35094
+ OutputFormatter4.error({
34776
35095
  Result: "Failure",
34777
35096
  Message: "No skills found in content store.",
34778
35097
  Instructions: "Check that the skills repository contains skills in the skills/ directory."
@@ -34782,7 +35101,7 @@ async function resolveSkillsContext(options, operation) {
34782
35101
  }
34783
35102
  let selectedSkills = availableSkills;
34784
35103
  if (!options.skills && !options.agents) {
34785
- const [skillErr, chosen] = await catchError5(promptSkillSelection(availableSkills, operation));
35104
+ const [skillErr, chosen] = await catchError9(promptSkillSelection(availableSkills, operation));
34786
35105
  if (skillErr)
34787
35106
  handlePromptCancellation(skillErr, operation);
34788
35107
  selectedSkills = availableSkills.filter((s) => chosen.includes(s.name));
@@ -34801,7 +35120,7 @@ async function resolveSkillsContext(options, operation) {
34801
35120
  if (neverSeen.length > 0) {
34802
35121
  parts.push(`Unknown skills: ${neverSeen.join(", ")}`);
34803
35122
  }
34804
- OutputFormatter3.error({
35123
+ OutputFormatter4.error({
34805
35124
  Result: "Failure",
34806
35125
  Message: parts.join(" "),
34807
35126
  Instructions: `Available skills: ${availableNames.join(", ")}`
@@ -34816,7 +35135,7 @@ async function resolveSkillsContext(options, operation) {
34816
35135
  agents = options.agents.split(",").map((s) => s.trim().toLowerCase());
34817
35136
  const unknown3 = agents.filter((a) => !ALL_AGENTS.includes(a));
34818
35137
  if (unknown3.length > 0) {
34819
- OutputFormatter3.error({
35138
+ OutputFormatter4.error({
34820
35139
  Result: "Failure",
34821
35140
  Message: `Unknown agents: ${unknown3.join(", ")}`,
34822
35141
  Instructions: `Available agents: ${ALL_AGENTS.join(", ")}`
@@ -34825,7 +35144,7 @@ async function resolveSkillsContext(options, operation) {
34825
35144
  return null;
34826
35145
  }
34827
35146
  } else {
34828
- const [agentErr, selected] = await catchError5(promptAgentSelection(operation));
35147
+ const [agentErr, selected] = await catchError9(promptAgentSelection(operation));
34829
35148
  if (agentErr)
34830
35149
  handlePromptCancellation(agentErr, operation);
34831
35150
  agents = selected;
@@ -34838,9 +35157,9 @@ async function runAgentInstalls(resolved) {
34838
35157
  for (const agent of agents) {
34839
35158
  const handler = getAgentHandler(agent);
34840
35159
  for (const skill of selectedSkills) {
34841
- const [installError] = await catchError5(handler.install(skill, rootDir));
35160
+ const [installError] = await catchError9(handler.install(skill, rootDir));
34842
35161
  if (installError) {
34843
- OutputFormatter3.error({
35162
+ OutputFormatter4.error({
34844
35163
  Result: "Failure",
34845
35164
  Message: `Failed to install ${skill.name} for ${agent}: ${installError.message}`,
34846
35165
  Instructions: "Check that the content store is intact and you have write permissions."
@@ -34851,9 +35170,9 @@ async function runAgentInstalls(resolved) {
34851
35170
  installed.push(`${agent}:${skill.name}`);
34852
35171
  }
34853
35172
  }
34854
- const [manifestError] = await catchError5(updateManifestAfterInstall(storePath, selectedSkills.map((s) => s.name), agents));
35173
+ const [manifestError] = await catchError9(updateManifestAfterInstall(storePath, selectedSkills.map((s) => s.name), agents));
34855
35174
  if (manifestError) {
34856
- OutputFormatter3.error({
35175
+ OutputFormatter4.error({
34857
35176
  Result: "Failure",
34858
35177
  Message: `Failed to update manifest: ${manifestError.message}`,
34859
35178
  Instructions: "Check that the content store is intact and you have write permissions."
@@ -34862,9 +35181,9 @@ async function runAgentInstalls(resolved) {
34862
35181
  return null;
34863
35182
  }
34864
35183
  if (isLocal) {
34865
- const [gitignoreError] = await catchError5(addToGitignore(rootDir, `${STORE_NAME}/`));
35184
+ const [gitignoreError] = await catchError9(addToGitignore(rootDir, `${STORE_NAME}/`));
34866
35185
  if (gitignoreError) {
34867
- OutputFormatter3.error({
35186
+ OutputFormatter4.error({
34868
35187
  Result: "Failure",
34869
35188
  Message: `Failed to update .gitignore: ${gitignoreError.message}`,
34870
35189
  Instructions: "Check that you have write permissions to the project directory."
@@ -34882,17 +35201,17 @@ var init_skillsService = __esm(() => {
34882
35201
  });
34883
35202
 
34884
35203
  // src/commands/skills/install.ts
34885
- import { catchError as catchError6, OutputFormatter as OutputFormatter4, processContext as processContext2 } from "@uipath/common";
35204
+ import { catchError as catchError10, OutputFormatter as OutputFormatter5, processContext as processContext2 } from "@uipath/common";
34886
35205
  function registerInstallCommand(skillsCommand) {
34887
35206
  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"));
35207
+ const [contextError, resolved] = await catchError10(resolveSkillsContext(options, "install"));
34889
35208
  if (contextError || !resolved) {
34890
35209
  if (contextError) {
34891
35210
  if (contextError.exitCode === 130) {
34892
35211
  processContext2.exit(130);
34893
35212
  return;
34894
35213
  }
34895
- OutputFormatter4.error({
35214
+ OutputFormatter5.error({
34896
35215
  Result: "Failure",
34897
35216
  Message: `Failed to install skills: ${contextError.message}`,
34898
35217
  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 +35223,7 @@ function registerInstallCommand(skillsCommand) {
34904
35223
  const installed = await runAgentInstalls(resolved);
34905
35224
  if (!installed)
34906
35225
  return;
34907
- OutputFormatter4.success({
35226
+ OutputFormatter5.success({
34908
35227
  Result: "Success",
34909
35228
  Code: "SkillsInstall",
34910
35229
  Data: {
@@ -34922,15 +35241,15 @@ var init_install = __esm(() => {
34922
35241
 
34923
35242
  // src/commands/skills/uninstall.ts
34924
35243
  import {
34925
- catchError as catchError7,
34926
- logger as logger8,
34927
- OutputFormatter as OutputFormatter5,
35244
+ catchError as catchError11,
35245
+ logger as logger10,
35246
+ OutputFormatter as OutputFormatter6,
34928
35247
  processContext as processContext3
34929
35248
  } from "@uipath/common";
34930
- import { getFileSystem as getFileSystem10 } from "@uipath/filesystem";
35249
+ import { getFileSystem as getFileSystem13 } from "@uipath/filesystem";
34931
35250
  function registerUninstallCommand(skillsCommand) {
34932
35251
  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"));
35252
+ const [contextError, resolved] = await catchError11(resolveSkillsContext(options, "uninstall"));
34934
35253
  const isLocal = !!options.local;
34935
35254
  let rootDir;
34936
35255
  let storePath;
@@ -34941,7 +35260,7 @@ function registerUninstallCommand(skillsCommand) {
34941
35260
  processContext3.exit(130);
34942
35261
  return;
34943
35262
  }
34944
- OutputFormatter5.error({
35263
+ OutputFormatter6.error({
34945
35264
  Result: "Failure",
34946
35265
  Message: `Failed to uninstall skills: ${contextError.message}`,
34947
35266
  Instructions: "Check network connectivity and try again. Ensure git is installed."
@@ -34958,14 +35277,14 @@ function registerUninstallCommand(skillsCommand) {
34958
35277
  if (!options.skills || !options.agents) {
34959
35278
  return;
34960
35279
  }
34961
- const fs = getFileSystem10();
35280
+ const fs = getFileSystem13();
34962
35281
  rootDir = isLocal ? fs.env.cwd() : fs.env.homedir();
34963
35282
  storePath = fs.path.join(rootDir, STORE_NAME);
34964
35283
  const manifest = await readManifest(storePath);
34965
35284
  const requested = options.skills.split(",").map((s) => s.trim());
34966
35285
  const inManifest = requested.filter((s) => manifest.skills[s]);
34967
35286
  if (inManifest.length === 0) {
34968
- OutputFormatter5.error({
35287
+ OutputFormatter6.error({
34969
35288
  Result: "Failure",
34970
35289
  Message: `Skills not found in manifest: ${requested.join(", ")}`,
34971
35290
  Instructions: "These skills are not currently installed. Use 'uipath skills install' to install them first."
@@ -34977,7 +35296,7 @@ function registerUninstallCommand(skillsCommand) {
34977
35296
  agents = options.agents.split(",").map((s) => s.trim().toLowerCase());
34978
35297
  const unknownAgents = agents.filter((a) => !ALL_AGENTS.includes(a));
34979
35298
  if (unknownAgents.length > 0) {
34980
- OutputFormatter5.error({
35299
+ OutputFormatter6.error({
34981
35300
  Result: "Failure",
34982
35301
  Message: `Unknown agents: ${unknownAgents.join(", ")}`,
34983
35302
  Instructions: `Available agents: ${ALL_AGENTS.join(", ")}`
@@ -34985,15 +35304,15 @@ function registerUninstallCommand(skillsCommand) {
34985
35304
  processContext3.exit(1);
34986
35305
  return;
34987
35306
  }
34988
- logger8.info(`Uninstalling skills from manifest: ${inManifest.join(", ")}`);
35307
+ logger10.info(`Uninstalling skills from manifest: ${inManifest.join(", ")}`);
34989
35308
  }
34990
35309
  const uninstalled = [];
34991
35310
  for (const agent of agents) {
34992
35311
  const handler = getAgentHandler(agent);
34993
35312
  for (const name of skillNames) {
34994
- const [uninstallError] = await catchError7(handler.uninstall(name, rootDir));
35313
+ const [uninstallError] = await catchError11(handler.uninstall(name, rootDir));
34995
35314
  if (uninstallError) {
34996
- OutputFormatter5.error({
35315
+ OutputFormatter6.error({
34997
35316
  Result: "Failure",
34998
35317
  Message: `Failed to uninstall ${name} for ${agent}: ${uninstallError.message}`,
34999
35318
  Instructions: "Check that the skill files exist and you have write permissions."
@@ -35005,7 +35324,7 @@ function registerUninstallCommand(skillsCommand) {
35005
35324
  }
35006
35325
  }
35007
35326
  await removeFromManifest(storePath, skillNames, agents);
35008
- OutputFormatter5.success({
35327
+ OutputFormatter6.success({
35009
35328
  Result: "Success",
35010
35329
  Code: "SkillsUninstall",
35011
35330
  Data: {
@@ -35026,21 +35345,21 @@ var init_uninstall = __esm(() => {
35026
35345
 
35027
35346
  // src/commands/skills/update.ts
35028
35347
  import {
35029
- catchError as catchError8,
35030
- logger as logger9,
35031
- OutputFormatter as OutputFormatter6,
35348
+ catchError as catchError12,
35349
+ logger as logger11,
35350
+ OutputFormatter as OutputFormatter7,
35032
35351
  processContext as processContext4
35033
35352
  } from "@uipath/common";
35034
35353
  function registerUpdateCommand(skillsCommand) {
35035
35354
  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"));
35355
+ const [contextError, resolved] = await catchError12(resolveSkillsContext(options, "update"));
35037
35356
  if (contextError || !resolved) {
35038
35357
  if (contextError) {
35039
35358
  if (contextError.exitCode === 130) {
35040
35359
  processContext4.exit(130);
35041
35360
  return;
35042
35361
  }
35043
- OutputFormatter6.error({
35362
+ OutputFormatter7.error({
35044
35363
  Result: "Failure",
35045
35364
  Message: `Failed to update skills: ${contextError.message}`,
35046
35365
  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 +35369,20 @@ function registerUpdateCommand(skillsCommand) {
35050
35369
  return;
35051
35370
  }
35052
35371
  if (!options.skills) {
35053
- const [manifestErr, manifest] = await catchError8(readManifest(resolved.storePath));
35054
- const [skillsErr, availableSkills] = await catchError8(getAvailableSkills(resolved.storePath));
35372
+ const [manifestErr, manifest] = await catchError12(readManifest(resolved.storePath));
35373
+ const [skillsErr, availableSkills] = await catchError12(getAvailableSkills(resolved.storePath));
35055
35374
  if (!manifestErr && !skillsErr && availableSkills) {
35056
35375
  const availableNames = availableSkills.map((s) => s.name);
35057
35376
  const removed = Object.keys(manifest.skills).filter((s) => !availableNames.includes(s));
35058
35377
  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.`);
35378
+ 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
35379
  }
35061
35380
  }
35062
35381
  }
35063
35382
  const updated = await runAgentInstalls(resolved);
35064
35383
  if (!updated)
35065
35384
  return;
35066
- OutputFormatter6.success({
35385
+ OutputFormatter7.success({
35067
35386
  Result: "Success",
35068
35387
  Code: "SkillsUpdate",
35069
35388
  Data: {
@@ -35113,15 +35432,15 @@ var exports_npmrc = {};
35113
35432
  __export(exports_npmrc, {
35114
35433
  findNpmrcConfig: () => findNpmrcConfig
35115
35434
  });
35116
- import { catchError as catchError9, logger as logger10 } from "@uipath/common";
35117
- import { getFileSystem as getFileSystem11 } from "@uipath/filesystem";
35435
+ import { catchError as catchError13, logger as logger12 } from "@uipath/common";
35436
+ import { getFileSystem as getFileSystem14 } from "@uipath/filesystem";
35118
35437
  function expandEnvVars(raw) {
35119
35438
  let hasMissing = false;
35120
35439
  const expanded = raw.replace(/\$\{([^}]+)\}/g, (_, v) => {
35121
35440
  const val = process.env[v];
35122
35441
  if (val === undefined) {
35123
35442
  hasMissing = true;
35124
- logger10.warn(`Warning: .npmrc references \${${v}} but it is not set.`);
35443
+ logger12.warn(`Warning: .npmrc references \${${v}} but it is not set.`);
35125
35444
  return "";
35126
35445
  }
35127
35446
  return val;
@@ -35154,13 +35473,13 @@ function parseNpmrc(content) {
35154
35473
  return result;
35155
35474
  }
35156
35475
  function registryHost(url2) {
35157
- const [error48, parsed] = catchError9(() => new URL(url2));
35476
+ const [error48, parsed] = catchError13(() => new URL(url2));
35158
35477
  if (error48)
35159
35478
  return;
35160
35479
  return parsed.host;
35161
35480
  }
35162
35481
  async function findNpmrcConfig() {
35163
- const fs = getFileSystem11();
35482
+ const fs = getFileSystem14();
35164
35483
  const paths = [];
35165
35484
  let dir = fs.env.cwd();
35166
35485
  for (let i2 = 0;i2 < 20; i2++) {
@@ -35171,29 +35490,29 @@ async function findNpmrcConfig() {
35171
35490
  dir = parent;
35172
35491
  }
35173
35492
  paths.push(fs.path.join(fs.env.homedir(), ".npmrc"));
35174
- logger10.debug(`Searching for .npmrc in ${paths.length} locations`);
35493
+ logger12.debug(`Searching for .npmrc in ${paths.length} locations`);
35175
35494
  let scopedRegistry;
35176
35495
  let prefix;
35177
35496
  const allTokensByHost = new Map;
35178
35497
  for (const p of paths) {
35179
- const [readError, content] = await catchError9(fs.readFile(p, "utf-8"));
35498
+ const [readError, content] = await catchError13(fs.readFile(p, "utf-8"));
35180
35499
  if (readError) {
35181
35500
  continue;
35182
35501
  }
35183
- logger10.debug(`Found .npmrc at ${p}`);
35502
+ logger12.debug(`Found .npmrc at ${p}`);
35184
35503
  if (!content)
35185
35504
  continue;
35186
35505
  const parsed = parseNpmrc(content);
35187
35506
  if (parsed.scopedRegistry && !scopedRegistry) {
35188
35507
  scopedRegistry = parsed.scopedRegistry;
35189
- logger10.debug(`@uipath:registry = ${scopedRegistry} (from ${p})`);
35508
+ logger12.debug(`@uipath:registry = ${scopedRegistry} (from ${p})`);
35190
35509
  }
35191
35510
  if (parsed.prefix && !prefix)
35192
35511
  prefix = parsed.prefix;
35193
35512
  for (const [host, token] of parsed.tokensByHost) {
35194
35513
  if (!allTokensByHost.has(host)) {
35195
35514
  allTokensByHost.set(host, token);
35196
- logger10.debug(`Auth token found for host '${host}' (from ${p})`);
35515
+ logger12.debug(`Auth token found for host '${host}' (from ${p})`);
35197
35516
  }
35198
35517
  }
35199
35518
  }
@@ -35210,12 +35529,12 @@ var init_npmrc = () => {};
35210
35529
 
35211
35530
  // src/services/toolService.ts
35212
35531
  import {
35213
- catchError as catchError10,
35214
- DEFAULT_FETCH_TIMEOUT_MS,
35532
+ catchError as catchError14,
35533
+ DEFAULT_FETCH_TIMEOUT_MS as DEFAULT_FETCH_TIMEOUT_MS2,
35215
35534
  extractErrorMessageSync,
35216
- logger as logger11
35535
+ logger as logger13
35217
35536
  } from "@uipath/common";
35218
- import { getFileSystem as getFileSystem12 } from "@uipath/filesystem";
35537
+ import { getFileSystem as getFileSystem15 } from "@uipath/filesystem";
35219
35538
  function isValidSemver(v) {
35220
35539
  return SEMVER_RE.test(v);
35221
35540
  }
@@ -35291,8 +35610,8 @@ function parsePackageSpec(spec) {
35291
35610
  };
35292
35611
  }
35293
35612
  async function isDevMode() {
35294
- const [error48, result] = await catchError10((async () => {
35295
- const fs = getFileSystem12();
35613
+ const [error48, result] = await catchError14((async () => {
35614
+ const fs = getFileSystem15();
35296
35615
  let dir = fs.env.cwd();
35297
35616
  for (let i2 = 0;i2 < 10; i2++) {
35298
35617
  const pkgPath = fs.path.join(dir, "package.json");
@@ -35303,7 +35622,7 @@ async function isDevMode() {
35303
35622
  if (pkg.workspaces && pkg.private) {
35304
35623
  const bunLockPath = fs.path.join(dir, "bun.lock");
35305
35624
  if (await fs.exists(bunLockPath)) {
35306
- logger11.debug(`Dev mode detected — found monorepo root at ${dir}`);
35625
+ logger13.debug(`Dev mode detected — found monorepo root at ${dir}`);
35307
35626
  return true;
35308
35627
  }
35309
35628
  }
@@ -35317,12 +35636,12 @@ async function isDevMode() {
35317
35636
  return false;
35318
35637
  })());
35319
35638
  if (error48) {
35320
- logger11.debug("Dev mode not detected — using npm");
35639
+ logger13.debug("Dev mode not detected — using npm");
35321
35640
  return false;
35322
35641
  }
35323
35642
  if (result)
35324
35643
  return true;
35325
- logger11.debug("Dev mode not detected — using npm");
35644
+ logger13.debug("Dev mode not detected — using npm");
35326
35645
  return false;
35327
35646
  }
35328
35647
  async function runPackageManager(args, cwd) {
@@ -35335,7 +35654,7 @@ async function runPackageManager(args, cwd) {
35335
35654
  const isWindows = process.platform === "win32";
35336
35655
  const useBun = await isDevMode();
35337
35656
  const pm = useBun ? "bun" : "npm";
35338
- logger11.debug(`Running package manager: ${pm} ${args.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
35657
+ logger13.debug(`Running package manager: ${pm} ${args.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
35339
35658
  const pmArgs = useBun ? args.filter((a) => a !== "-g").map((a) => a === "uninstall" ? "remove" : a) : args;
35340
35659
  return new Promise((resolve, reject) => {
35341
35660
  const proc = isWindows ? spawn2([pm, ...pmArgs].map((a) => a.includes(" ") ? `"${a}"` : a).join(" "), [], {
@@ -35349,7 +35668,7 @@ async function runPackageManager(args, cwd) {
35349
35668
  let stderr = "";
35350
35669
  const MAX_STDERR = 65536;
35351
35670
  proc.stdout?.on("data", (d) => {
35352
- logger11.info(d.toString().trimEnd());
35671
+ logger13.info(d.toString().trimEnd());
35353
35672
  });
35354
35673
  proc.stderr?.on("data", (d) => {
35355
35674
  if (stderr.length < MAX_STDERR) {
@@ -35371,20 +35690,20 @@ async function runPackageManager(args, cwd) {
35371
35690
  });
35372
35691
  }
35373
35692
  async function resolveRegistry() {
35374
- logger11.debug("Resolving npm registry for @uipath packages...");
35693
+ logger13.debug("Resolving npm registry for @uipath packages...");
35375
35694
  const { findNpmrcConfig: findNpmrcConfig2 } = await Promise.resolve().then(() => (init_npmrc(), exports_npmrc));
35376
35695
  const config2 = await findNpmrcConfig2();
35377
35696
  const registryUrl = config2.scopedRegistry || DEFAULT_REGISTRY;
35378
- logger11.debug(`Registry URL: ${registryUrl}${config2.scopedRegistry ? " (from .npmrc)" : " (default)"}`);
35379
- const [urlError] = catchError10(() => new URL(registryUrl));
35697
+ logger13.debug(`Registry URL: ${registryUrl}${config2.scopedRegistry ? " (from .npmrc)" : " (default)"}`);
35698
+ const [urlError] = catchError14(() => new URL(registryUrl));
35380
35699
  if (urlError) {
35381
35700
  throw new Error(`Invalid @uipath:registry URL in .npmrc: "${registryUrl}"`);
35382
35701
  }
35383
35702
  const envToken = globalThis.process?.env?.GH_NPM_REGISTRY_TOKEN;
35384
35703
  const authToken = envToken || config2.authToken || undefined;
35385
- logger11.debug(`Auth token: ${authToken ? `found (source: ${envToken ? "GH_NPM_REGISTRY_TOKEN env" : ".npmrc"})` : "not found"}`);
35704
+ logger13.debug(`Auth token: ${authToken ? `found (source: ${envToken ? "GH_NPM_REGISTRY_TOKEN env" : ".npmrc"})` : "not found"}`);
35386
35705
  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)");
35706
+ logger13.warn("Auth token found but no @uipath:registry configured in .npmrc — " + "token will be sent to the default registry (npmjs.org)");
35388
35707
  }
35389
35708
  return { registryUrl, authToken };
35390
35709
  }
@@ -35393,14 +35712,14 @@ class NodeToolService {
35393
35712
  async fetchPackageInfo(registryUrl, packageName, headers) {
35394
35713
  const encodedName = packageName.replaceAll("/", "%2f");
35395
35714
  const url2 = `${registryUrl.replace(/\/+$/, "")}/${encodedName}`;
35396
- logger11.debug(`Fetching package info: ${url2}`);
35715
+ logger13.debug(`Fetching package info: ${url2}`);
35397
35716
  const fetchHeaders = {
35398
35717
  Accept: "application/json",
35399
35718
  ...headers
35400
35719
  };
35401
35720
  const response = await fetch(url2, {
35402
35721
  headers: fetchHeaders,
35403
- signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS)
35722
+ signal: AbortSignal.timeout(DEFAULT_FETCH_TIMEOUT_MS2)
35404
35723
  });
35405
35724
  if (response.status === 401 || response.status === 403) {
35406
35725
  throw new Error(`Registry ${registryUrl} returned ${response.status} for ${packageName} (authentication required)`);
@@ -35410,10 +35729,10 @@ class NodeToolService {
35410
35729
  }
35411
35730
  const data = await response.json();
35412
35731
  const latestVersion = data["dist-tags"]?.latest;
35413
- const [labelError, parsedUrl] = catchError10(() => new URL(registryUrl));
35732
+ const [labelError, parsedUrl] = catchError14(() => new URL(registryUrl));
35414
35733
  const registryLabel = labelError ? registryUrl : parsedUrl.host;
35415
35734
  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`);
35735
+ logger13.debug(`Package '${packageName}': latest=${latestVersion ?? "unknown"}, ${availableVersions.length} versions available`);
35417
35736
  return {
35418
35737
  name: data.name,
35419
35738
  version: latestVersion || "latest",
@@ -35450,7 +35769,7 @@ ${errors5.map((e) => ` - ${e}`).join(`
35450
35769
  return results;
35451
35770
  }
35452
35771
  async searchLatestVersion(packageName, versionPrefix) {
35453
- logger11.debug(`Searching latest version of '${packageName}'${versionPrefix ? ` with prefix '${versionPrefix}'` : ""}`);
35772
+ logger13.debug(`Searching latest version of '${packageName}'${versionPrefix ? ` with prefix '${versionPrefix}'` : ""}`);
35454
35773
  const { registryUrl, authToken } = await resolveRegistry();
35455
35774
  const headers = {};
35456
35775
  if (authToken)
@@ -35460,24 +35779,24 @@ ${errors5.map((e) => ` - ${e}`).join(`
35460
35779
  const matching = info.availableVersions.filter((v) => v.startsWith(versionPrefix));
35461
35780
  const stable = matching.find((v) => !v.includes("-"));
35462
35781
  if (stable) {
35463
- logger11.debug(`Resolved version: ${stable} (stable, prefix match)`);
35782
+ logger13.debug(`Resolved version: ${stable} (stable, prefix match)`);
35464
35783
  return stable;
35465
35784
  }
35466
35785
  if (matching.length > 0) {
35467
- logger11.debug(`Resolved version: ${matching[0]} (prerelease, prefix match)`);
35786
+ logger13.debug(`Resolved version: ${matching[0]} (prerelease, prefix match)`);
35468
35787
  return matching[0];
35469
35788
  }
35470
- logger11.debug(`No version found matching prefix '${versionPrefix}'`);
35789
+ logger13.debug(`No version found matching prefix '${versionPrefix}'`);
35471
35790
  return null;
35472
35791
  }
35473
- logger11.debug(`Resolved version: ${info.version ?? "null"} (latest)`);
35792
+ logger13.debug(`Resolved version: ${info.version ?? "null"} (latest)`);
35474
35793
  return info.version ?? null;
35475
35794
  }
35476
35795
  async install(packageName, destination, options) {
35477
35796
  validatePackageSpec(packageName);
35478
35797
  const baseArgs = options?.global ? ["install", "-g", packageName] : ["install", packageName];
35479
35798
  for (let attempt = 0;attempt <= NPM_MAX_RETRIES; attempt++) {
35480
- const [err] = await catchError10(runPackageManager(baseArgs, destination));
35799
+ const [err] = await catchError14(runPackageManager(baseArgs, destination));
35481
35800
  if (!err) {
35482
35801
  return;
35483
35802
  }
@@ -35487,12 +35806,12 @@ ${errors5.map((e) => ` - ${e}`).join(`
35487
35806
  throw err;
35488
35807
  }
35489
35808
  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}`);
35809
+ logger13.warn(`npm install failed with transient error (attempt ${attempt + 1}/${NPM_MAX_RETRIES + 1}), retrying in ${delayMs}ms: ${msg}`);
35491
35810
  await new Promise((r) => setTimeout(r, delayMs));
35492
35811
  }
35493
35812
  }
35494
35813
  async uninstall(packageName, destination, options) {
35495
- const fs = getFileSystem12();
35814
+ const fs = getFileSystem15();
35496
35815
  const nodeModulesDir = fs.path.resolve(destination, "node_modules");
35497
35816
  const packageDir = fs.path.resolve(fs.path.join(destination, "node_modules", packageName));
35498
35817
  if (!packageDir.startsWith(`${nodeModulesDir}/`) && !packageDir.startsWith(`${nodeModulesDir}\\`)) {
@@ -35501,10 +35820,10 @@ ${errors5.map((e) => ` - ${e}`).join(`
35501
35820
  if (!await fs.exists(packageDir)) {
35502
35821
  throw new Error(`Package '${packageName}' is not installed at ${destination}`);
35503
35822
  }
35504
- const [statError, stat] = await catchError10(fs.stat(packageDir));
35823
+ const [statError, stat] = await catchError14(fs.stat(packageDir));
35505
35824
  if (!statError && !stat) {
35506
35825
  await fs.rm(packageDir);
35507
- logger11.info(`Removed workspace-linked package '${packageName}'`);
35826
+ logger13.info(`Removed workspace-linked package '${packageName}'`);
35508
35827
  return;
35509
35828
  }
35510
35829
  if (options?.global) {
@@ -35514,7 +35833,7 @@ ${errors5.map((e) => ` - ${e}`).join(`
35514
35833
  }
35515
35834
  if (await fs.exists(packageDir)) {
35516
35835
  await fs.rm(packageDir);
35517
- logger11.info(`Package directory for '${packageName}' still existed after uninstall — removed manually`);
35836
+ logger13.info(`Package directory for '${packageName}' still existed after uninstall — removed manually`);
35518
35837
  }
35519
35838
  }
35520
35839
  }
@@ -35550,7 +35869,7 @@ var init_toolService = __esm(() => {
35550
35869
  TOOLS_WHITELIST = new Map([
35551
35870
  ["@uipath/solution-tool", "solution"],
35552
35871
  ["@uipath/agent-tool", "agent"],
35553
- ["@uipath/codedagents-tool", "codedagents"],
35872
+ ["@uipath/codedagents-tool", "codedagent"],
35554
35873
  ["@uipath/codedapp-tool", "codedapp"],
35555
35874
  ["@uipath/integrationservice-tool", "is"],
35556
35875
  ["@uipath/orchestrator-tool", "or"],
@@ -35558,7 +35877,7 @@ var init_toolService = __esm(() => {
35558
35877
  ["@uipath/flow-tool", "flow"],
35559
35878
  ["@uipath/case-tool", "case"],
35560
35879
  ["@uipath/test-manager-tool", "tm"],
35561
- ["@uipath/resources-tool", "resources"],
35880
+ ["@uipath/resources-tool", "resource"],
35562
35881
  ["@uipath/api-workflow-tool", "api-workflow"],
35563
35882
  ["@uipath/maestro-tool", "maestro"],
35564
35883
  ["@uipath/docsai-tool", "docsai"],
@@ -35574,9 +35893,9 @@ var init_toolService = __esm(() => {
35574
35893
 
35575
35894
  // src/commands/tools/install.ts
35576
35895
  import {
35577
- catchError as catchError11,
35578
- logger as logger12,
35579
- OutputFormatter as OutputFormatter7,
35896
+ catchError as catchError15,
35897
+ logger as logger14,
35898
+ OutputFormatter as OutputFormatter8,
35580
35899
  processContext as processContext5
35581
35900
  } from "@uipath/common";
35582
35901
  function registerInstallCommand2(toolsCommand, _context, state) {
@@ -35584,7 +35903,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35584
35903
  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
35904
  const { name: rawName, version: explicitVersion } = parsePackageSpec(packageArg);
35586
35905
  if (explicitVersion && !isValidSemver(explicitVersion)) {
35587
- OutputFormatter7.error({
35906
+ OutputFormatter8.error({
35588
35907
  Result: "Failure",
35589
35908
  Message: `Invalid version '${explicitVersion}'.`,
35590
35909
  Instructions: "Version must be a valid semver string (e.g. 1.0.0 or 1.0.0-beta.1)."
@@ -35594,7 +35913,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35594
35913
  }
35595
35914
  const packageName = resolveToolPackageName(rawName);
35596
35915
  if (!TOOLS_WHITELIST.has(packageName)) {
35597
- OutputFormatter7.error({
35916
+ OutputFormatter8.error({
35598
35917
  Result: "Failure",
35599
35918
  Message: `Unknown tool '${packageArg}'.`,
35600
35919
  Instructions: "Run 'uip tools search' to see available tools."
@@ -35602,7 +35921,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35602
35921
  processContext5.exit(1);
35603
35922
  return;
35604
35923
  }
35605
- const [error48] = await catchError11((async () => {
35924
+ const [error48] = await catchError15((async () => {
35606
35925
  const location = await resolveInstallPath(packageName);
35607
35926
  let packageSpec;
35608
35927
  if (explicitVersion) {
@@ -35618,8 +35937,8 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35618
35937
  await toolService.install(packageSpec, location.path, {
35619
35938
  global: location.global
35620
35939
  });
35621
- logger12.info(`Installed to ${location.path}`);
35622
- OutputFormatter7.success({
35940
+ logger14.info(`Installed to ${location.path}`);
35941
+ OutputFormatter8.success({
35623
35942
  Result: "Success",
35624
35943
  Code: "Message",
35625
35944
  Data: {
@@ -35628,7 +35947,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
35628
35947
  });
35629
35948
  })());
35630
35949
  if (error48) {
35631
- OutputFormatter7.error({
35950
+ OutputFormatter8.error({
35632
35951
  Result: "Failure",
35633
35952
  Message: `Failed to install '${packageName}': ${error48.message}`,
35634
35953
  Instructions: "Please check the package name and try again."
@@ -35641,17 +35960,22 @@ var init_install2 = __esm(() => {
35641
35960
  init_toolService();
35642
35961
  });
35643
35962
 
35963
+ // src/commands/tools/tool-helpers.ts
35964
+ function getInstalledTools(state) {
35965
+ return (state.discoveredTools ?? []).map((d) => ({
35966
+ name: d.toolName,
35967
+ version: d.version,
35968
+ description: d.description,
35969
+ commandPrefix: d.commandPrefix
35970
+ }));
35971
+ }
35972
+
35644
35973
  // src/commands/tools/list.ts
35645
- import { OutputFormatter as OutputFormatter8, processContext as processContext6 } from "@uipath/common";
35974
+ import { OutputFormatter as OutputFormatter9, processContext as processContext6 } from "@uipath/common";
35646
35975
  function registerListCommand(toolsCommand, state) {
35647
35976
  toolsCommand.command("list").description("List installed tools").trackedAction(processContext6, async () => {
35648
- const data = state.tools.length > 0 ? state.tools.map((tool) => tool.metadata) : (state.discoveredTools ?? []).map((d) => ({
35649
- name: d.toolName,
35650
- version: d.version,
35651
- description: d.description,
35652
- commandPrefix: d.commandPrefix
35653
- }));
35654
- OutputFormatter8.success({
35977
+ const data = getInstalledTools(state);
35978
+ OutputFormatter9.success({
35655
35979
  Result: "Success",
35656
35980
  Code: "ToolList",
35657
35981
  Data: data
@@ -35661,12 +35985,12 @@ function registerListCommand(toolsCommand, state) {
35661
35985
  var init_list = () => {};
35662
35986
 
35663
35987
  // src/commands/tools/search.ts
35664
- import { catchError as catchError12, OutputFormatter as OutputFormatter9, processContext as processContext7 } from "@uipath/common";
35988
+ import { catchError as catchError16, OutputFormatter as OutputFormatter10, processContext as processContext7 } from "@uipath/common";
35665
35989
  function registerSearchCommand(toolsCommand, _context) {
35666
35990
  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));
35991
+ const [error48, results] = await catchError16(toolService.search(query));
35668
35992
  if (error48) {
35669
- OutputFormatter9.error({
35993
+ OutputFormatter10.error({
35670
35994
  Result: "Failure",
35671
35995
  Message: "No matching tools found.",
35672
35996
  Instructions: error48.message
@@ -35678,7 +36002,7 @@ function registerSearchCommand(toolsCommand, _context) {
35678
36002
  ...r,
35679
36003
  availableVersions: r.availableVersions ? truncateVersionsForDisplay(r.availableVersions) : undefined
35680
36004
  }));
35681
- OutputFormatter9.success({
36005
+ OutputFormatter10.success({
35682
36006
  Result: "Success",
35683
36007
  Code: "SearchResult",
35684
36008
  Data: displayResults
@@ -35690,13 +36014,13 @@ var init_search = __esm(() => {
35690
36014
  });
35691
36015
 
35692
36016
  // src/commands/tools/uninstall.ts
35693
- import { catchError as catchError13, OutputFormatter as OutputFormatter10, processContext as processContext8 } from "@uipath/common";
36017
+ import { catchError as catchError17, OutputFormatter as OutputFormatter11, processContext as processContext8 } from "@uipath/common";
35694
36018
  function registerUninstallCommand2(toolsCommand, _context, state) {
35695
36019
  const { resolveInstallPath } = state;
35696
36020
  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
36021
  const packageName = resolveToolPackageName(packageArg);
35698
36022
  if (!TOOLS_WHITELIST.has(packageName)) {
35699
- OutputFormatter10.error({
36023
+ OutputFormatter11.error({
35700
36024
  Result: "Failure",
35701
36025
  Message: `Unknown tool '${packageArg}'.`,
35702
36026
  Instructions: `Use 'uip tools list' to see installed tools.`
@@ -35704,12 +36028,12 @@ function registerUninstallCommand2(toolsCommand, _context, state) {
35704
36028
  processContext8.exit(1);
35705
36029
  return;
35706
36030
  }
35707
- const [error48] = await catchError13((async () => {
36031
+ const [error48] = await catchError17((async () => {
35708
36032
  const location = await resolveInstallPath();
35709
36033
  await toolService.uninstall(packageName, location.path, {
35710
36034
  global: location.global
35711
36035
  });
35712
- OutputFormatter10.success({
36036
+ OutputFormatter11.success({
35713
36037
  Result: "Success",
35714
36038
  Code: "Message",
35715
36039
  Data: {
@@ -35718,7 +36042,7 @@ function registerUninstallCommand2(toolsCommand, _context, state) {
35718
36042
  });
35719
36043
  })());
35720
36044
  if (error48) {
35721
- OutputFormatter10.error({
36045
+ OutputFormatter11.error({
35722
36046
  Result: "Failure",
35723
36047
  Message: `Failed to uninstall '${packageName}': ${error48.message}`,
35724
36048
  Instructions: "Use 'uip tools list' to see installed tools."
@@ -35733,17 +36057,18 @@ var init_uninstall2 = __esm(() => {
35733
36057
 
35734
36058
  // src/commands/tools/update.ts
35735
36059
  import {
35736
- catchError as catchError14,
35737
- logger as logger13,
35738
- OutputFormatter as OutputFormatter11,
36060
+ catchError as catchError18,
36061
+ logger as logger15,
36062
+ OutputFormatter as OutputFormatter12,
35739
36063
  processContext as processContext9
35740
36064
  } from "@uipath/common";
35741
- import { getFileSystem as getFileSystem13 } from "@uipath/filesystem";
36065
+ import { getFileSystem as getFileSystem16 } from "@uipath/filesystem";
35742
36066
  function registerUpdateCommand2(toolsCommand, _context, state) {
35743
- const { tools, toolsDirs, resolveInstallPath, getCliVersionPrefix } = state;
36067
+ const { toolsDirs, resolveInstallPath, getCliVersionPrefix } = state;
35744
36068
  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
- if (tools.length === 0) {
35746
- OutputFormatter11.error({
36069
+ const installed = getInstalledTools(state);
36070
+ if (installed.length === 0) {
36071
+ OutputFormatter12.error({
35747
36072
  Result: "Failure",
35748
36073
  Message: "No tools installed.",
35749
36074
  Instructions: "Use 'uip tools install <package>' to install a tool."
@@ -35751,9 +36076,9 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35751
36076
  processContext9.exit(1);
35752
36077
  return;
35753
36078
  }
35754
- const [locationError, location] = await catchError14(resolveInstallPath());
36079
+ const [locationError, location] = await catchError18(resolveInstallPath());
35755
36080
  if (locationError) {
35756
- OutputFormatter11.error({
36081
+ OutputFormatter12.error({
35757
36082
  Result: "Failure",
35758
36083
  Message: locationError.message,
35759
36084
  Instructions: "Please ensure the CLI is installed correctly."
@@ -35762,9 +36087,9 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35762
36087
  return;
35763
36088
  }
35764
36089
  const resolvedName = options.name ? resolveToolPackageName(options.name) : undefined;
35765
- const toUpdate = resolvedName ? tools.filter((t) => t.metadata.name === resolvedName || `@uipath/${t.metadata.name}` === resolvedName) : tools;
36090
+ const toUpdate = resolvedName ? installed.filter((t) => t.name === resolvedName || `@uipath/${t.name}` === resolvedName) : installed;
35766
36091
  if (resolvedName && toUpdate.length === 0) {
35767
- OutputFormatter11.error({
36092
+ OutputFormatter12.error({
35768
36093
  Result: "Failure",
35769
36094
  Message: `Tool '${options.name}' is not installed.`,
35770
36095
  Instructions: "Use 'uip tools list' to see installed tools."
@@ -35773,9 +36098,9 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35773
36098
  return;
35774
36099
  }
35775
36100
  if (options.version !== "latest") {
35776
- const [validateError] = catchError14(() => validateVersionString(options.version));
36101
+ const [validateError] = catchError18(() => validateVersionString(options.version));
35777
36102
  if (validateError) {
35778
- OutputFormatter11.error({
36103
+ OutputFormatter12.error({
35779
36104
  Result: "Failure",
35780
36105
  Message: validateError.message,
35781
36106
  Instructions: "Use a valid semver version (e.g. 1.2.3) or 'latest'."
@@ -35785,10 +36110,10 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35785
36110
  }
35786
36111
  }
35787
36112
  const results = [];
35788
- const previousVersions = new Map(toUpdate.map((t) => [t.metadata.name, t.metadata.version]));
36113
+ const previousVersions = new Map(toUpdate.map((t) => [t.name, t.version]));
35789
36114
  for (const tool of toUpdate) {
35790
- const fullName = `@uipath/${tool.metadata.name}`;
35791
- const [updateError] = await catchError14((async () => {
36115
+ const fullName = `@uipath/${tool.name}`;
36116
+ const [updateError] = await catchError18((async () => {
35792
36117
  let targetVersion = options.version;
35793
36118
  if (targetVersion === "latest") {
35794
36119
  const cliPrefix = getCliVersionPrefix();
@@ -35797,18 +36122,18 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35797
36122
  targetVersion = latest;
35798
36123
  } else {
35799
36124
  results.push({
35800
- name: tool.metadata.name,
36125
+ name: tool.name,
35801
36126
  status: "failed",
35802
- from: tool.metadata.version,
36127
+ from: tool.version,
35803
36128
  error: `No compatible version found for CLI v${cliPrefix}x`
35804
36129
  });
35805
36130
  return;
35806
36131
  }
35807
36132
  }
35808
- const currentVersion = tool.metadata.version;
36133
+ const currentVersion = tool.version;
35809
36134
  if (currentVersion === targetVersion) {
35810
36135
  results.push({
35811
- name: tool.metadata.name,
36136
+ name: tool.name,
35812
36137
  status: "up-to-date",
35813
36138
  from: currentVersion,
35814
36139
  to: currentVersion
@@ -35820,26 +36145,26 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35820
36145
  })());
35821
36146
  if (updateError) {
35822
36147
  results.push({
35823
- name: tool.metadata.name,
36148
+ name: tool.name,
35824
36149
  status: "failed",
35825
36150
  error: updateError.message
35826
36151
  });
35827
36152
  }
35828
36153
  }
35829
- const fs = getFileSystem13();
36154
+ const fs = getFileSystem16();
35830
36155
  const updatedVersions = new Map;
35831
36156
  for (const dir of toolsDirs) {
35832
36157
  for (const tool of toUpdate) {
35833
- const name = tool.metadata.name;
36158
+ const name = tool.name;
35834
36159
  if (updatedVersions.has(name))
35835
36160
  continue;
35836
36161
  const pkgPath = fs.path.join(dir, name, "package.json");
35837
36162
  if (!await fs.exists(pkgPath))
35838
36163
  continue;
35839
- const [readError, raw] = await catchError14(fs.readFile(pkgPath, "utf-8"));
36164
+ const [readError, raw] = await catchError18(fs.readFile(pkgPath, "utf-8"));
35840
36165
  if (readError || !raw)
35841
36166
  continue;
35842
- const [parseError, pkg] = catchError14(() => JSON.parse(raw));
36167
+ const [parseError, pkg] = catchError18(() => JSON.parse(raw));
35843
36168
  if (parseError || !pkg.version)
35844
36169
  continue;
35845
36170
  updatedVersions.set(name, pkg.version);
@@ -35847,7 +36172,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35847
36172
  }
35848
36173
  const recordedNames = new Set(results.map((r) => r.name));
35849
36174
  for (const tool of toUpdate) {
35850
- const name = tool.metadata.name;
36175
+ const name = tool.name;
35851
36176
  if (recordedNames.has(name))
35852
36177
  continue;
35853
36178
  const from = previousVersions.get(name) ?? "unknown";
@@ -35865,13 +36190,13 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
35865
36190
  }
35866
36191
  }
35867
36192
  const failed = results.filter((r) => r.status === "failed");
35868
- OutputFormatter11.success({
36193
+ OutputFormatter12.success({
35869
36194
  Result: "Success",
35870
36195
  Code: "UpdateResult",
35871
36196
  Data: results
35872
36197
  });
35873
36198
  if (failed.length > 0) {
35874
- logger13.error(`Failed to update ${failed.length} tool(s): ${failed.map((f) => `${f.name}: ${f.error}`).join("; ")}`);
36199
+ logger15.error(`Failed to update ${failed.length} tool(s): ${failed.map((f) => `${f.name}: ${f.error}`).join("; ")}`);
35875
36200
  processContext9.exit(1);
35876
36201
  }
35877
36202
  });
@@ -35898,15 +36223,15 @@ var init_tools = __esm(() => {
35898
36223
  });
35899
36224
 
35900
36225
  // src/services/installPath.ts
35901
- import { catchError as catchError15, logger as logger14 } from "@uipath/common";
36226
+ import { catchError as catchError19, logger as logger16 } from "@uipath/common";
35902
36227
  function createInstallPathResolver(toolsDir, isBrowser2) {
35903
36228
  return async (packageName) => {
35904
36229
  if (isBrowser2) {
35905
36230
  const path = packageName ? `/tools/${packageName.replace(/[/@]/g, "_")}` : "/tools";
35906
36231
  return { path, global: false };
35907
36232
  }
35908
- const { getFileSystem: getFileSystem14 } = await import("@uipath/filesystem");
35909
- const fsLocal = getFileSystem14();
36233
+ const { getFileSystem: getFileSystem17 } = await import("@uipath/filesystem");
36234
+ const fsLocal = getFileSystem17();
35910
36235
  const { dirname: dirnameFn, join: joinFn } = fsLocal.path;
35911
36236
  if (toolsDir) {
35912
36237
  let path = dirnameFn(dirnameFn(toolsDir));
@@ -35919,9 +36244,9 @@ function createInstallPathResolver(toolsDir, isBrowser2) {
35919
36244
  let isGlobal = true;
35920
36245
  const pkgJsonPath = joinFn(path, "package.json");
35921
36246
  if (await fsLocal.exists(pkgJsonPath)) {
35922
- const [, raw] = await catchError15(fsLocal.readFile(pkgJsonPath, "utf-8"));
36247
+ const [, raw] = await catchError19(fsLocal.readFile(pkgJsonPath, "utf-8"));
35923
36248
  if (raw) {
35924
- const [, pkgJson] = catchError15(() => JSON.parse(raw));
36249
+ const [, pkgJson] = catchError19(() => JSON.parse(raw));
35925
36250
  if (pkgJson) {
35926
36251
  const deps = {
35927
36252
  ...pkgJson.dependencies,
@@ -35936,15 +36261,15 @@ function createInstallPathResolver(toolsDir, isBrowser2) {
35936
36261
  }
35937
36262
  }
35938
36263
  }
35939
- logger14.debug(`Install path resolved: ${path} (global: ${isGlobal})`);
36264
+ logger16.debug(`Install path resolved: ${path} (global: ${isGlobal})`);
35940
36265
  return { path, global: isGlobal };
35941
36266
  }
35942
36267
  let searchDir = fsLocal.env.cwd();
35943
36268
  for (let i2 = 0;i2 < 10; i2++) {
35944
36269
  const nodeModulesPath = joinFn(searchDir, "node_modules");
35945
- const [, exists] = await catchError15(fsLocal.exists(nodeModulesPath));
36270
+ const [, exists] = await catchError19(fsLocal.exists(nodeModulesPath));
35946
36271
  if (exists) {
35947
- logger14.debug(`Install path resolved via fallback: ${searchDir}`);
36272
+ logger16.debug(`Install path resolved via fallback: ${searchDir}`);
35948
36273
  return { path: searchDir, global: false };
35949
36274
  }
35950
36275
  const parentDir = dirnameFn(searchDir);
@@ -35959,17 +36284,24 @@ var insideNodeModules = (dir) => /[\\/]node_modules([\\/]|$)/.test(dir);
35959
36284
  var init_installPath = () => {};
35960
36285
 
35961
36286
  // src/services/storage.ts
35962
- import { logger as logger15 } from "@uipath/common";
35963
- import { getFileSystem as getFileSystem14, getFileSystemAsync } from "@uipath/filesystem";
36287
+ import { getFileSystem as getFileSystem17, getFileSystemAsync } from "@uipath/filesystem";
35964
36288
 
35965
36289
  class GeneralizedStorage {
36290
+ _initPromise;
35966
36291
  async init() {
35967
- logger15.debug("Initializing filesystem...");
35968
- await getFileSystemAsync();
35969
- logger15.debug("Filesystem initialized");
36292
+ if (this._initPromise)
36293
+ return this._initPromise;
36294
+ const promise3 = getFileSystemAsync().then(() => {
36295
+ return;
36296
+ });
36297
+ this._initPromise = promise3;
36298
+ promise3.catch(() => {
36299
+ this._initPromise = undefined;
36300
+ });
36301
+ return promise3;
35970
36302
  }
35971
36303
  get fs() {
35972
- return getFileSystem14();
36304
+ return getFileSystem17();
35973
36305
  }
35974
36306
  async read(path) {
35975
36307
  const res = await this.fs.readFile(path);
@@ -36007,11 +36339,11 @@ var init_storage = __esm(() => {
36007
36339
  });
36008
36340
 
36009
36341
  // src/utils/toolLoader.ts
36010
- import { catchError as catchError16, logger as logger16 } from "@uipath/common";
36011
- import { getFileSystem as getFileSystem15 } from "@uipath/filesystem";
36342
+ import { catchError as catchError20, logger as logger17 } from "@uipath/common";
36343
+ import { getFileSystem as getFileSystem18 } from "@uipath/filesystem";
36012
36344
  import { Command } from "commander";
36013
36345
  function isRunningFromSource() {
36014
- const [error48, mainUrl] = catchError16(() => import.meta.url);
36346
+ const [error48, mainUrl] = catchError20(() => import.meta.url);
36015
36347
  if (error48) {
36016
36348
  return false;
36017
36349
  }
@@ -36021,9 +36353,9 @@ function joinPath(...parts) {
36021
36353
  return parts.filter((p) => p).join("/").replace(/\/+/g, "/");
36022
36354
  }
36023
36355
  async function discoverToolPaths(toolsDirs) {
36024
- const [initError] = await catchError16(storage.init());
36356
+ const [initError] = await catchError20(storage.init());
36025
36357
  if (initError) {
36026
- logger16.error("Storage initialization failed:", initError);
36358
+ logger17.error("Storage initialization failed:", initError);
36027
36359
  return [];
36028
36360
  }
36029
36361
  const dirs = Array.isArray(toolsDirs) ? toolsDirs : [toolsDirs];
@@ -36031,10 +36363,9 @@ async function discoverToolPaths(toolsDirs) {
36031
36363
  const seenPrefixes = new Set;
36032
36364
  for (const toolsDir of dirs) {
36033
36365
  if (!await storage.exists(toolsDir)) {
36034
- logger16.debug(`Tools directory does not exist, skipping: ${toolsDir}`);
36366
+ logger17.debug(`Tools directory does not exist, skipping: ${toolsDir}`);
36035
36367
  continue;
36036
36368
  }
36037
- logger16.debug(`Scanning tools directory: ${toolsDir}`);
36038
36369
  const toolNames = [...WHITELIST_BY_SHORT_NAME.keys()];
36039
36370
  const resolvedPaths = await Promise.all(toolNames.map(async (toolName) => {
36040
36371
  const toolDir = joinPath(toolsDir, toolName);
@@ -36064,7 +36395,7 @@ async function discoverToolPaths(toolsDirs) {
36064
36395
  let description = "";
36065
36396
  let version2 = "";
36066
36397
  if (pkgJson) {
36067
- const [parseErr, pkg] = catchError16(() => JSON.parse(pkgJson));
36398
+ const [parseErr, pkg] = catchError20(() => JSON.parse(pkgJson));
36068
36399
  if (!parseErr) {
36069
36400
  description = pkg.description ?? "";
36070
36401
  version2 = pkg.version ?? "";
@@ -36086,20 +36417,20 @@ async function discoverToolPaths(toolsDirs) {
36086
36417
  version: version2
36087
36418
  } of resolvedPaths) {
36088
36419
  if (!toolPath) {
36089
- logger16.debug(`Tool '${toolName}' not found in ${joinPath(toolsDir, toolName)}`);
36090
36420
  continue;
36091
36421
  }
36092
36422
  const packageName = WHITELIST_BY_SHORT_NAME.get(toolName);
36093
36423
  const commandPrefix = packageName ? TOOLS_WHITELIST.get(packageName) : undefined;
36094
36424
  if (!commandPrefix || !packageName) {
36095
- logger16.warn(`Tool '${toolName}' found at ${toolPath} but not in whitelist, skipping`);
36425
+ logger17.warn(`Tool '${toolName}' found at ${toolPath} but not in whitelist, skipping`);
36096
36426
  continue;
36097
36427
  }
36098
36428
  if (seenPrefixes.has(commandPrefix)) {
36099
- logger16.info(`Tool ${toolName} (command '${commandPrefix}') already found from a higher-priority path, skipping`);
36429
+ logger17.info(`Tool ${toolName} (command '${commandPrefix}') already found from a higher-priority path, skipping`);
36100
36430
  continue;
36101
36431
  }
36102
36432
  seenPrefixes.add(commandPrefix);
36433
+ logger17.debug(`Discovered tool '${toolName}' v${version2 || "unknown"} at ${toolPath}`);
36103
36434
  discovered.push({
36104
36435
  toolName,
36105
36436
  toolPath,
@@ -36109,21 +36440,20 @@ async function discoverToolPaths(toolsDirs) {
36109
36440
  version: version2,
36110
36441
  packagerToolPath
36111
36442
  });
36112
- logger16.debug(`Discovered tool '${toolName}' at ${toolPath} (prefix: ${commandPrefix})`);
36113
36443
  }
36114
36444
  }
36115
36445
  return discovered;
36116
36446
  }
36117
36447
  async function importModuleByPath(modulePath) {
36118
36448
  const savedTrackedAction = Command.prototype.trackedAction;
36119
- const [error48, mod] = await catchError16((async () => {
36449
+ const [error48, mod] = await catchError20((async () => {
36120
36450
  if (_isBrowser) {
36121
36451
  const content = await storage.readText(modulePath);
36122
36452
  if (!content)
36123
36453
  return;
36124
36454
  const blob = new Blob([content], { type: "text/javascript" });
36125
36455
  const blobUrl = URL.createObjectURL(blob);
36126
- const [importError, imported] = await catchError16(import(blobUrl));
36456
+ const [importError, imported] = await catchError20(import(blobUrl));
36127
36457
  URL.revokeObjectURL(blobUrl);
36128
36458
  if (importError)
36129
36459
  throw importError;
@@ -36136,7 +36466,7 @@ async function importModuleByPath(modulePath) {
36136
36466
  })());
36137
36467
  if (savedTrackedAction && Command.prototype.trackedAction !== savedTrackedAction) {
36138
36468
  Command.prototype.trackedAction = savedTrackedAction;
36139
- logger16.warn(`Import of ${modulePath} overwrote Command.prototype.trackedAction — restored CLI version.`);
36469
+ logger17.warn(`Import of ${modulePath} overwrote Command.prototype.trackedAction — restored CLI version.`);
36140
36470
  }
36141
36471
  if (error48)
36142
36472
  throw error48;
@@ -36144,26 +36474,26 @@ async function importModuleByPath(modulePath) {
36144
36474
  }
36145
36475
  async function importTool(discovered) {
36146
36476
  const { toolName, toolPath } = discovered;
36147
- logger16.debug(`Loading tool '${toolName}' from ${toolPath}`);
36148
- const [error48, toolModule] = await catchError16(importModuleByPath(toolPath));
36477
+ logger17.debug(`Loading tool '${toolName}' from ${toolPath}`);
36478
+ const [error48, toolModule] = await catchError20(importModuleByPath(toolPath));
36149
36479
  if (error48) {
36150
- logger16.error(`Failed to load tool ${toolName}:`, error48);
36480
+ logger17.error(`Failed to load tool ${toolName} (version: ${discovered.version || "unknown"}, path: ${toolPath}):`, error48);
36151
36481
  return;
36152
36482
  }
36153
36483
  const { metadata, registerCommands } = toolModule ?? {};
36154
36484
  if (!metadata || !registerCommands) {
36155
- logger16.warn(`Tool ${toolName} missing required exports (metadata or registerCommands), skipping`);
36485
+ logger17.warn(`Tool ${toolName} missing required exports (metadata or registerCommands), skipping`);
36156
36486
  return;
36157
36487
  }
36158
- logger16.debug(`Tool '${toolName}' loaded successfully (prefix: ${metadata.commandPrefix}, version: ${metadata.version ?? "unknown"})`);
36488
+ logger17.debug(`Tool '${toolName}' loaded successfully (prefix: ${metadata.commandPrefix}, version: ${metadata.version ?? "unknown"})`);
36159
36489
  return { metadata, registerCommands };
36160
36490
  }
36161
36491
  async function importPackagerTool(discovered) {
36162
36492
  const { toolName, packagerToolPath } = discovered;
36163
36493
  if (!packagerToolPath)
36164
36494
  return;
36165
- logger16.debug(`Loading packager factory for '${toolName}' from ${packagerToolPath}`);
36166
- const [error48] = await catchError16(importModuleByPath(packagerToolPath));
36495
+ logger17.debug(`Loading packager factory for '${toolName}' from ${packagerToolPath}`);
36496
+ const [error48] = await catchError20(importModuleByPath(packagerToolPath));
36167
36497
  if (error48) {
36168
36498
  throw new Error(`Failed to load packager factory for '${toolName}' from ${packagerToolPath}: ${error48 instanceof Error ? error48.message : error48}`);
36169
36499
  }
@@ -36184,25 +36514,23 @@ function isInsideNodeModules(dir) {
36184
36514
  return segments.includes("node_modules");
36185
36515
  }
36186
36516
  async function findNearestToolsDir(startDir, seen) {
36187
- const fs = getFileSystem15();
36517
+ const fs = getFileSystem18();
36188
36518
  const { dirname, join } = fs.path;
36189
36519
  const results = [];
36190
36520
  let searchPath = startDir;
36191
36521
  for (let i2 = 0;i2 < MAX_WALK_DEPTH; i2++) {
36192
36522
  const candidate = join(searchPath, "node_modules", "@uipath");
36193
- const [, exists] = await catchError16(fs.exists(candidate));
36523
+ const [, exists] = await catchError20(fs.exists(candidate));
36194
36524
  if (exists) {
36195
36525
  if (seen.has(candidate)) {
36196
- logger16.debug(`Tools directory already seen, stopping walk: ${candidate}`);
36197
36526
  break;
36198
36527
  }
36199
36528
  seen.add(candidate);
36200
36529
  results.push(candidate);
36201
- logger16.debug(`Found tools directory: ${candidate}`);
36202
36530
  if (!isInsideNodeModules(searchPath)) {
36203
36531
  break;
36204
36532
  }
36205
- logger16.debug("Search path is inside node_modules, continuing walk for hoisted packages");
36533
+ logger17.debug("Search path is inside node_modules, continuing walk for hoisted packages");
36206
36534
  }
36207
36535
  const parentPath = dirname(searchPath);
36208
36536
  if (parentPath === searchPath) {
@@ -36210,19 +36538,15 @@ async function findNearestToolsDir(startDir, seen) {
36210
36538
  }
36211
36539
  searchPath = parentPath;
36212
36540
  }
36213
- if (results.length === 0) {
36214
- logger16.debug(`No tools directory found walking up from ${startDir}`);
36215
- }
36216
36541
  return results;
36217
36542
  }
36218
36543
  async function resolveToolsDirs(cliFilePath, cwd) {
36219
- const fs = getFileSystem15();
36544
+ const fs = getFileSystem18();
36220
36545
  const { dirname } = fs.path;
36221
36546
  const seen = new Set;
36222
36547
  const dirs = [];
36223
36548
  dirs.push(...await findNearestToolsDir(dirname(cliFilePath), seen));
36224
36549
  dirs.push(...await findNearestToolsDir(cwd, seen));
36225
- logger16.debug(`Resolved ${dirs.length} tool directories: ${dirs.join(", ") || "(none)"}`);
36226
36550
  return dirs;
36227
36551
  }
36228
36552
  var _isRunningFromSource, _isBrowser, MAX_WALK_DEPTH = 10;
@@ -36234,7 +36558,7 @@ var init_toolLoader = __esm(() => {
36234
36558
  });
36235
36559
 
36236
36560
  // src/services/tool-manager.ts
36237
- import { logger as logger17 } from "@uipath/common";
36561
+ import { logger as logger18 } from "@uipath/common";
36238
36562
 
36239
36563
  class ToolManager {
36240
36564
  toolsDirs;
@@ -36256,33 +36580,33 @@ class ToolManager {
36256
36580
  }
36257
36581
  async ensureAvailable(verb) {
36258
36582
  if (this.isInstalled(verb)) {
36259
- logger17.debug(`Tool '${verb}' is already installed`);
36583
+ logger18.debug(`Tool '${verb}' is already installed`);
36260
36584
  return;
36261
36585
  }
36262
36586
  const packageName = WHITELIST_BY_COMMAND.get(verb);
36263
36587
  if (!packageName) {
36264
36588
  throw new Error(`Unknown tool verb '${verb}'.`);
36265
36589
  }
36266
- logger17.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36267
- logger17.debug(`Searching latest version of '${packageName}' with prefix '${this.cliVersionPrefix}'`);
36590
+ logger18.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36591
+ logger18.debug(`Searching latest version of '${packageName}' with prefix '${this.cliVersionPrefix}'`);
36268
36592
  const version2 = await toolService.searchLatestVersion(packageName, this.cliVersionPrefix);
36269
36593
  if (!version2) {
36270
36594
  throw new Error(`No compatible version of '${packageName}' found for CLI (needs ${this.cliVersionPrefix}x).`);
36271
36595
  }
36272
36596
  const packageSpec = `${packageName}@${version2}`;
36273
36597
  const location = await this.resolveInstallPath();
36274
- logger17.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36598
+ logger18.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36275
36599
  await toolService.install(packageSpec, location.path, {
36276
36600
  global: location.global
36277
36601
  });
36278
- logger17.info(`Installed ${packageSpec} successfully.`);
36279
- logger17.debug("Re-discovering tools after install...");
36602
+ logger18.info(`Installed ${packageSpec} successfully.`);
36603
+ logger18.debug("Re-discovering tools after install...");
36280
36604
  this.tools = await discoverTools(this.toolsDirs);
36281
36605
  }
36282
36606
  async ensurePackagerFactory(verb) {
36283
36607
  let entry = this.discoveredTools.find((d) => d.commandPrefix === verb);
36284
36608
  if (!entry) {
36285
- logger17.info(`Tool '${verb}' not found on disk. Attempting install...`);
36609
+ logger18.info(`Tool '${verb}' not found on disk. Attempting install...`);
36286
36610
  await this.installTool(verb);
36287
36611
  entry = this.discoveredTools.find((d) => d.commandPrefix === verb);
36288
36612
  if (!entry) {
@@ -36291,14 +36615,14 @@ class ToolManager {
36291
36615
  }
36292
36616
  }
36293
36617
  if (entry.packagerToolPath) {
36294
- logger17.debug(`Loading packager factory for '${verb}' from ${entry.packagerToolPath}`);
36618
+ logger18.debug(`Loading packager factory for '${verb}' from ${entry.packagerToolPath}`);
36295
36619
  await importPackagerTool(entry);
36296
36620
  return;
36297
36621
  }
36298
- logger17.debug(`Tool '${verb}' has no packager-tool entry point, falling back to full tool import`);
36622
+ logger18.debug(`Tool '${verb}' has no packager-tool entry point, falling back to full tool import`);
36299
36623
  const tool = await importTool(entry);
36300
36624
  if (!tool) {
36301
- throw new Error(`Tool '${verb}' was discovered on disk but failed to load. ` + `Entry point: ${entry.toolPath}`);
36625
+ 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
36626
  }
36303
36627
  }
36304
36628
  getTools() {
@@ -36309,22 +36633,22 @@ class ToolManager {
36309
36633
  if (!packageName) {
36310
36634
  throw new Error(`Unknown tool verb '${verb}'.`);
36311
36635
  }
36312
- logger17.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36636
+ logger18.info(`Tool '${verb}' is not installed. Searching for compatible version...`);
36313
36637
  const version2 = await toolService.searchLatestVersion(packageName, this.cliVersionPrefix);
36314
36638
  if (!version2) {
36315
36639
  throw new Error(`No compatible version of '${packageName}' found for CLI (needs ${this.cliVersionPrefix}x).`);
36316
36640
  }
36317
36641
  const packageSpec = `${packageName}@${version2}`;
36318
36642
  const location = await this.resolveInstallPath();
36319
- logger17.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36643
+ logger18.debug(`Installing ${packageSpec} to ${location.path} (global: ${location.global})`);
36320
36644
  await toolService.install(packageSpec, location.path, {
36321
36645
  global: location.global
36322
36646
  });
36323
- logger17.info(`Installed ${packageSpec} successfully.`);
36324
- logger17.debug(`Re-discovering tools in [${this.toolsDirs.join(", ")}]...`);
36647
+ logger18.info(`Installed ${packageSpec} successfully.`);
36648
+ logger18.debug(`Re-discovering tools in [${this.toolsDirs.join(", ")}]...`);
36325
36649
  this.discoveredTools = await discoverToolPaths(this.toolsDirs);
36326
36650
  this.discoveredPrefixes = new Set(this.discoveredTools.map((d) => d.commandPrefix));
36327
- logger17.debug(`After install, discovered: [${this.discoveredTools.map((d) => d.commandPrefix).join(", ") || "none"}]`);
36651
+ logger18.debug(`After install, discovered: [${this.discoveredTools.map((d) => d.commandPrefix).join(", ") || "none"}]`);
36328
36652
  }
36329
36653
  }
36330
36654
  var init_tool_manager = __esm(() => {
@@ -36333,7 +36657,7 @@ var init_tool_manager = __esm(() => {
36333
36657
  });
36334
36658
 
36335
36659
  // src/utils/autoInstall.ts
36336
- import { catchError as catchError17, logger as logger18, OutputFormatter as OutputFormatter12 } from "@uipath/common";
36660
+ import { catchError as catchError21, logger as logger19, OutputFormatter as OutputFormatter13 } from "@uipath/common";
36337
36661
  async function autoInstallToolIfNeeded(args, program, toolManager, context) {
36338
36662
  if (context.capabilities.isBrowser)
36339
36663
  return false;
@@ -36353,10 +36677,10 @@ async function autoInstallToolIfNeeded(args, program, toolManager, context) {
36353
36677
  break;
36354
36678
  }
36355
36679
  if (requestedVerb && !toolManager.isInstalled(requestedVerb)) {
36356
- logger18.debug(`Tool '${requestedVerb}' not installed — attempting auto-install`);
36357
- const [error48] = await catchError17(toolManager.ensureAvailable(requestedVerb));
36680
+ logger19.debug(`Tool '${requestedVerb}' not installed — attempting auto-install`);
36681
+ const [error48] = await catchError21(toolManager.ensureAvailable(requestedVerb));
36358
36682
  if (error48) {
36359
- OutputFormatter12.error({
36683
+ OutputFormatter13.error({
36360
36684
  Result: "Failure",
36361
36685
  Message: `Failed to auto-install '${requestedVerb}': ${error48.message}`,
36362
36686
  Instructions: `Run 'uip tools install ${requestedVerb}' to install manually.`
@@ -36434,7 +36758,13 @@ function stripGlobalOptions(args) {
36434
36758
  cleaned.push(args[i2]);
36435
36759
  }
36436
36760
  const resolvedFormat = format ?? (getOutputSink2().capabilities.isInteractive ? "table" : "json");
36437
- return { args: cleaned, format: resolvedFormat, filter, logLevel, logFile };
36761
+ return {
36762
+ args: cleaned,
36763
+ format: resolvedFormat,
36764
+ filter,
36765
+ logLevel,
36766
+ logFile
36767
+ };
36438
36768
  }
36439
36769
  var VALID_FORMATS, VALID_LOG_LEVELS;
36440
36770
  var init_globalOptions = __esm(() => {
@@ -36452,7 +36782,7 @@ import {
36452
36782
  extractCommandHelp,
36453
36783
  getOutputFormat,
36454
36784
  getOutputSink as getOutputSink3,
36455
- OutputFormatter as OutputFormatter13
36785
+ OutputFormatter as OutputFormatter14
36456
36786
  } from "@uipath/common";
36457
36787
  function getCommandPath(cmd) {
36458
36788
  const names = [];
@@ -36708,7 +37038,7 @@ function createHelpConfiguration(isBrowser2) {
36708
37038
  Code: "Help",
36709
37039
  Data: helpData
36710
37040
  };
36711
- return OutputFormatter13.formatToString(output);
37041
+ return OutputFormatter14.formatToString(output);
36712
37042
  }
36713
37043
  };
36714
37044
  if (isBrowser2) {
@@ -36765,7 +37095,7 @@ var init_telemetry_events = __esm(() => {
36765
37095
 
36766
37096
  // src/utils/parseError.ts
36767
37097
  import {
36768
- OutputFormatter as OutputFormatter14,
37098
+ OutputFormatter as OutputFormatter15,
36769
37099
  telemetry,
36770
37100
  telemetryFlushAndShutdown
36771
37101
  } from "@uipath/common";
@@ -36784,7 +37114,7 @@ async function handleParseError(error48, cleanedArgs, context) {
36784
37114
  context.exit(exitCode ?? 0);
36785
37115
  return;
36786
37116
  }
36787
- OutputFormatter14.error({
37117
+ OutputFormatter15.error({
36788
37118
  Result: "ValidationError",
36789
37119
  Message: message,
36790
37120
  Instructions: "Check command arguments and options. Use --help for usage information."
@@ -36801,19 +37131,17 @@ var init_parseError = __esm(() => {
36801
37131
  });
36802
37132
 
36803
37133
  // 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...");
37134
+ import { catchError as catchError22, logger as logger20, OutputFormatter as OutputFormatter16 } from "@uipath/common";
37135
+ function registerToolCommands(program, discovered, context) {
36807
37136
  for (const entry of discovered) {
36808
- logger19.debug(`Registering lazy command for tool '${entry.toolName}' (prefix: ${entry.commandPrefix})`);
36809
37137
  const toolCommand = program.command(entry.commandPrefix).description(entry.description).allowUnknownOption().allowExcessArguments(true).helpOption(false);
36810
37138
  toolCommand.action(async () => {
36811
- logger19.debug(`Lazy-loading tool '${entry.toolName}' on first use...`);
37139
+ logger20.debug(`Loading tool '${entry.toolName}'...`);
36812
37140
  const tool = await importTool(entry);
36813
37141
  if (!tool) {
36814
- OutputFormatter15.error({
37142
+ OutputFormatter16.error({
36815
37143
  Result: "Failure",
36816
- Message: `Failed to load tool '${entry.toolName}'.`,
37144
+ Message: `Failed to load tool '${entry.toolName}' (version: ${entry.version || "unknown"}, path: ${entry.toolPath}).`,
36817
37145
  Instructions: `Try reinstalling with 'uip tools install ${entry.commandPrefix}'.`
36818
37146
  });
36819
37147
  context.exit(1);
@@ -36824,9 +37152,9 @@ function registerLazyToolCommands(program, discovered, context) {
36824
37152
  program.commands.splice(idx, 1);
36825
37153
  }
36826
37154
  const realCommand = program.command(tool.metadata.commandPrefix).description(tool.metadata.description);
36827
- const [regError] = await catchError18(tool.registerCommands(realCommand));
37155
+ const [regError] = await catchError22(tool.registerCommands(realCommand));
36828
37156
  if (regError) {
36829
- OutputFormatter15.error({
37157
+ OutputFormatter16.error({
36830
37158
  Result: "Failure",
36831
37159
  Message: `Failed to register commands from tool '${tool.metadata.name}': ${regError.message}`,
36832
37160
  Instructions: "This might be due to a command name conflict with existing commands."
@@ -36844,32 +37172,32 @@ var init_registerToolCommands = __esm(() => {
36844
37172
 
36845
37173
  // src/utils/resolveToolsDirectories.ts
36846
37174
  import { fileURLToPath } from "node:url";
36847
- import { logger as logger20 } from "@uipath/common";
36848
- import { getFileSystem as getFileSystem16 } from "@uipath/filesystem";
37175
+ import { logger as logger21 } from "@uipath/common";
37176
+ import { getFileSystem as getFileSystem19 } from "@uipath/filesystem";
36849
37177
  async function resolveToolsDirectories(context) {
36850
37178
  if (context.capabilities.isBrowser) {
36851
- logger20.debug("Browser mode — tools directory: /tools");
37179
+ logger21.debug("Browser mode — tools directory: /tools");
36852
37180
  return { toolsDirs: ["/tools"], toolsDir: "/tools" };
36853
37181
  }
36854
37182
  const currentFilePath = fileURLToPath(import.meta.url);
36855
- const fs = getFileSystem16();
37183
+ const fs = getFileSystem19();
36856
37184
  const toolsDirs = await resolveToolsDirs(currentFilePath, fs.env.cwd());
36857
37185
  const toolsDir = toolsDirs[0];
36858
37186
  if (toolsDirs.length > 0) {
36859
37187
  return { toolsDirs, toolsDir };
36860
37188
  }
36861
- logger20.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
37189
+ logger21.warn("Unable to determine tools directory. Please ensure the CLI is installed correctly.");
36862
37190
  const { dirname, join } = fs.path;
36863
37191
  const isInstalledPackage = process.execPath.includes(join("@uipath", "cli", "dist", "uip"));
36864
37192
  if (isInstalledPackage) {
36865
37193
  const execDir = dirname(process.execPath);
36866
37194
  const packageDir = dirname(execDir);
36867
37195
  const fallbackDir2 = dirname(packageDir);
36868
- logger20.debug(`Fallback (installed package): ${fallbackDir2}`);
37196
+ logger21.debug(`Fallback (installed package): ${fallbackDir2}`);
36869
37197
  return { toolsDirs: [fallbackDir2], toolsDir: fallbackDir2 };
36870
37198
  }
36871
37199
  const fallbackDir = join(dirname(currentFilePath), "..");
36872
- logger20.debug(`Fallback (development mode): ${fallbackDir}`);
37200
+ logger21.debug(`Fallback (development mode): ${fallbackDir}`);
36873
37201
  return { toolsDirs: [fallbackDir], toolsDir: fallbackDir };
36874
37202
  }
36875
37203
  var init_resolveToolsDirectories = __esm(() => {
@@ -36882,10 +37210,10 @@ __export(exports_cli, {
36882
37210
  run: () => run
36883
37211
  });
36884
37212
  import {
36885
- catchError as catchError19,
37213
+ catchError as catchError23,
36886
37214
  configureLogger,
36887
37215
  LogLevel,
36888
- logger as logger21,
37216
+ logger as logger22,
36889
37217
  registerHelpAll,
36890
37218
  setOutputFilter,
36891
37219
  setOutputFormat,
@@ -36904,13 +37232,14 @@ function getCliVersionPrefix() {
36904
37232
  async function buildProgram(context) {
36905
37233
  const program = new Command2;
36906
37234
  program.name("uip").description(`UiPath CLI ${package_default.version}`).version(package_default.version, "-v, --version").enablePositionalOptions();
37235
+ const globalOptions = stripGlobalOptions(context.args);
36907
37236
  const {
36908
37237
  args: cleanedArgs,
36909
37238
  format: helpFormat,
36910
37239
  filter,
36911
37240
  logLevel,
36912
37241
  logFile
36913
- } = stripGlobalOptions(context.args);
37242
+ } = globalOptions;
36914
37243
  context.args = cleanedArgs;
36915
37244
  setOutputFormat(helpFormat);
36916
37245
  setOutputFilter(filter);
@@ -36918,7 +37247,7 @@ async function buildProgram(context) {
36918
37247
  ...logLevel !== undefined && { level: logLevel },
36919
37248
  ...logFile !== undefined && { logFile }
36920
37249
  });
36921
- logger21.debug(`CLI v${package_default.version} starting — output=${helpFormat}, logLevel=${logLevel !== undefined ? LogLevel[logLevel].toLowerCase() : "default"}, logFile=${logFile ?? "none"}`);
37250
+ logger22.debug(`CLI v${package_default.version} starting — output=${helpFormat}, logLevel=${logLevel !== undefined ? LogLevel[logLevel].toLowerCase() : "default"}, logFile=${logFile ?? "none"}`);
36922
37251
  program.exitOverride();
36923
37252
  program.configureOutput({
36924
37253
  writeOut: context.output.writeOut,
@@ -36929,8 +37258,7 @@ async function buildProgram(context) {
36929
37258
  });
36930
37259
  program.configureHelp(createHelpConfiguration(context.capabilities.isBrowser));
36931
37260
  const storageAndToolsDirsPromise = (async () => {
36932
- logger21.debug("Initializing storage...");
36933
- const [storageError] = await catchError19(storage.init());
37261
+ const [storageError] = await catchError23(storage.init());
36934
37262
  if (storageError) {
36935
37263
  if (context.capabilities.isBrowser) {
36936
37264
  context.output.writeErr(`Storage initialization failed: ${errorMessage(storageError)}`);
@@ -36938,24 +37266,25 @@ async function buildProgram(context) {
36938
37266
  throw storageError;
36939
37267
  }
36940
37268
  } else {
36941
- logger21.debug("Storage initialized");
37269
+ logger22.debug("Storage initialized");
36942
37270
  }
36943
- logger21.debug("Resolving tool directories...");
36944
37271
  const result = await resolveToolsDirectories(context);
36945
- logger21.debug(`Resolved ${result.toolsDirs.length} tool directories: ${result.toolsDirs.join(", ") || "(none)"}`);
37272
+ logger22.debug(`Resolved ${result.toolsDirs.length} tool directories: ${result.toolsDirs.join(", ") || "(none)"}`);
36946
37273
  return result;
36947
37274
  })();
36948
37275
  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)}`)),
37276
+ telemetryInit({ uip_version: package_default.version }).then(() => logger22.debug("Telemetry initialized")).catch((err) => logger22.warn(`Telemetry init failed (non-fatal): ${errorMessage(err)}`)),
36950
37277
  storageAndToolsDirsPromise
36951
37278
  ]);
36952
- logger21.debug("Registering login/logout commands");
36953
37279
  registerLoginCommand(program, context);
36954
37280
  registerLogoutCommand(program, context);
37281
+ if (!context.capabilities.isBrowser) {
37282
+ registerFeedbackCommand(program, context);
37283
+ registerSkillsCommand(program);
37284
+ }
37285
+ registerMcpCommand(program);
36955
37286
  const resolveInstallPath = createInstallPathResolver(toolsDir, context.capabilities.isBrowser);
36956
- logger21.debug("Discovering tool paths...");
36957
37287
  let discoveredTools = await discoverToolPaths(toolsDirs);
36958
- logger21.debug(`Discovered ${discoveredTools.length} tools: ${discoveredTools.map((t) => t.commandPrefix).join(", ") || "(none)"}`);
36959
37288
  const toolManager = new ToolManager([], toolsDirs, resolveInstallPath, getCliVersionPrefix(), discoveredTools);
36960
37289
  setPackagerFactoryProvider((verb) => toolManager.ensurePackagerFactory(verb));
36961
37290
  if (toolsDir) {
@@ -36964,7 +37293,7 @@ async function buildProgram(context) {
36964
37293
  discoveredTools = await discoverToolPaths(toolsDirs);
36965
37294
  }
36966
37295
  }
36967
- registerLazyToolCommands(program, discoveredTools, context);
37296
+ registerToolCommands(program, discoveredTools, context);
36968
37297
  registerToolsCommand(program, context, {
36969
37298
  tools: toolManager.getTools(),
36970
37299
  discoveredTools,
@@ -36972,36 +37301,33 @@ async function buildProgram(context) {
36972
37301
  resolveInstallPath,
36973
37302
  getCliVersionPrefix
36974
37303
  });
36975
- if (!context.capabilities.isBrowser) {
36976
- logger21.debug("Registering skills command");
36977
- registerSkillsCommand(program);
36978
- }
36979
- logger21.debug("Registering MCP command");
36980
- registerMcpCommand(program);
37304
+ logger22.debug(`Discovered ${discoveredTools.length} tools: ${discoveredTools.map((t) => t.commandPrefix).join(", ") || "(none)"}`);
36981
37305
  registerHelpAll(program);
36982
37306
  for (const cmd of program.commands) {
36983
37307
  registerHelpAll(cmd);
36984
37308
  }
36985
- logger21.debug("Program built successfully — ready to parse args");
36986
- return { program, cleanedArgs };
37309
+ logger22.debug("Program built successfully — ready to parse args");
37310
+ return { program, cleanedArgs, globalOptions };
36987
37311
  }
36988
37312
  async function run(context) {
36989
37313
  const { program, cleanedArgs } = await buildProgram(context);
36990
- logger21.debug(`Parsing args: ${cleanedArgs.slice(2).join(" ")}`);
36991
- const [parseError] = await catchError19(program.parseAsync(cleanedArgs));
37314
+ logger22.debug(`Parsing args: ${cleanedArgs.slice(2).join(" ")}`);
37315
+ const [parseError] = await catchError23(program.parseAsync(cleanedArgs));
36992
37316
  if (parseError) {
36993
37317
  await handleParseError(parseError, cleanedArgs, context);
36994
- return;
36995
37318
  }
36996
- logger21.debug("Command completed flushing telemetry");
37319
+ if (!process.exitCode || process.exitCode === 0) {
37320
+ logger22.debug("Command completed — flushing telemetry");
37321
+ context.exit(0);
37322
+ }
36997
37323
  await telemetryFlushAndShutdown2();
36998
- context.exit(0);
36999
37324
  }
37000
37325
  var init_cli = __esm(() => {
37001
37326
  init_package();
37002
37327
  init_login();
37003
37328
  init_logout();
37004
37329
  init_mcp2();
37330
+ init_send_feedback();
37005
37331
  init_skills();
37006
37332
  init_tools();
37007
37333
  init_installPath();