@uipath/rpa-tool 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tool.js CHANGED
@@ -61025,7 +61025,7 @@ var {
61025
61025
  // package.json
61026
61026
  var package_default = {
61027
61027
  name: "@uipath/rpa-tool",
61028
- version: "0.9.2",
61028
+ version: "0.9.4",
61029
61029
  description: "Tool for creating and managing UiPath RPA projects",
61030
61030
  keywords: [
61031
61031
  "uipcli-tool",
@@ -61058,7 +61058,7 @@ var package_default = {
61058
61058
  registry: "https://npm.pkg.github.com"
61059
61059
  },
61060
61060
  scripts: {
61061
- build: "bunx tsc --noEmit && bun build ./src/packager-tool.ts --outdir dist --format esm --target node --external @uipath/solutionpackager-tool-core && bun build ./src/tool.ts --outdir dist --format esm --target node --external '*/packager-tool.js' --external applicationinsights && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external applicationinsights",
61061
+ build: "bunx tsc --noEmit && bun build ./src/packager-tool.ts --outdir dist --format esm --target node && bun build ./src/tool.ts --outdir dist --format esm --target node --external '*/packager-tool.js' --external applicationinsights && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external applicationinsights",
61062
61062
  package: "bun run build && bun pm pack",
61063
61063
  "generate-docs": "bun run scripts/generate-docs.ts",
61064
61064
  "bump-uipath-alpha": "bun run scripts/bump-uipath-alpha.ts",
@@ -61238,7 +61238,7 @@ init_dist();
61238
61238
  // src/commands/packager/packager-shared.ts
61239
61239
  init_dist();
61240
61240
  import { existsSync as existsSync5 } from "node:fs";
61241
- import { join as join6 } from "node:path";
61241
+ import { join as join7 } from "node:path";
61242
61242
 
61243
61243
  // node_modules/@uipath/tool-workflowcompiler/dist/index.js
61244
61244
  init_dist2();
@@ -61894,7 +61894,7 @@ class WorkflowCompilerToolFactory {
61894
61894
  toolsFactoryRepository.registerProjectToolFactory(new WorkflowCompilerToolFactory);
61895
61895
 
61896
61896
  // src/resolution/helm-config.ts
61897
- var DEFAULT_HELM_VERSION = "0.9.2";
61897
+ var DEFAULT_HELM_VERSION = "0.9.4";
61898
61898
  var helmConfig = {
61899
61899
  helmVersion: DEFAULT_HELM_VERSION
61900
61900
  };
@@ -61903,7 +61903,7 @@ var helmConfig = {
61903
61903
  import { spawn as spawn3 } from "node:child_process";
61904
61904
  import { existsSync as existsSync3, mkdtempSync, rmSync, writeFileSync } from "node:fs";
61905
61905
  import { homedir as homedir3, tmpdir as tmpdir3 } from "node:os";
61906
- import { join as join4 } from "node:path";
61906
+ import { join as join5 } from "node:path";
61907
61907
 
61908
61908
  // src/resolution/resolver-deps.ts
61909
61909
  import { execFileSync as execFileSync5, spawn as spawn2 } from "node:child_process";
@@ -62690,6 +62690,72 @@ var STUDIO_EXE = "UiPath.Studio.exe";
62690
62690
  var HELM_EXE = process.platform === "win32" ? "UiPath.Studio.Helm.exe" : "UiPath.Studio.Helm";
62691
62691
  var HELM_INTEROP_MANIFEST = "helm-interop-manifest.json";
62692
62692
 
62693
+ // src/resolution/robot-bin-resolver.ts
62694
+ import { join as join4 } from "node:path";
62695
+ var ROBOT_SERVICE_DLL = "UiPath.Service.NetCoreHost.dll";
62696
+ var MACOS_ASSISTANT_ROBOT_PATH = "/Applications/UiPath Assistant.app/Contents/Robot";
62697
+ var REGISTRY_HIVES = [
62698
+ "HKCU\\Software\\UiPath\\UiPath Studio",
62699
+ "HKLM\\Software\\UiPath\\UiPath Studio"
62700
+ ];
62701
+ function queryRegistryRobotDir(deps) {
62702
+ for (const hive of REGISTRY_HIVES) {
62703
+ try {
62704
+ const output = deps.executeCommand("reg", [
62705
+ "query",
62706
+ hive,
62707
+ "/v",
62708
+ "InstallDir"
62709
+ ]);
62710
+ const match = output.match(/InstallDir\s+REG_SZ\s+(.+)/);
62711
+ if (match)
62712
+ return match[1].trim();
62713
+ } catch {}
62714
+ }
62715
+ return;
62716
+ }
62717
+ function resolveRobotDir(cliPath, deps) {
62718
+ if (cliPath) {
62719
+ deps.log(`Using --robot-dir: ${cliPath}`);
62720
+ return cliPath;
62721
+ }
62722
+ const envPath = process.env.UIPATH_ROBOT_DIR;
62723
+ if (envPath) {
62724
+ deps.log(`Using UIPATH_ROBOT_DIR: ${envPath}`);
62725
+ return envPath;
62726
+ }
62727
+ if (process.platform === "win32") {
62728
+ const dir = queryRegistryRobotDir(deps);
62729
+ if (dir) {
62730
+ deps.log(`Resolved robot dir from registry: ${dir}`);
62731
+ return dir;
62732
+ }
62733
+ }
62734
+ if (process.platform === "darwin") {
62735
+ if (deps.fileExists(join4(MACOS_ASSISTANT_ROBOT_PATH, ROBOT_SERVICE_DLL))) {
62736
+ deps.log(`Found robot at well-known path: ${MACOS_ASSISTANT_ROBOT_PATH}`);
62737
+ return MACOS_ASSISTANT_ROBOT_PATH;
62738
+ }
62739
+ }
62740
+ deps.log("Robot dir not resolved — Robot must already be running");
62741
+ return null;
62742
+ }
62743
+ function resolveBundledDotnet(robotDir, deps) {
62744
+ if (!robotDir)
62745
+ return;
62746
+ const exePath = process.platform === "win32" ? join4(robotDir, "dotnet.exe") : join4(robotDir, "dotnet", "dotnet");
62747
+ if (!deps.fileExists(exePath))
62748
+ return;
62749
+ const dotnetRoot = process.platform === "win32" ? robotDir : join4(robotDir, "dotnet");
62750
+ return {
62751
+ exePath,
62752
+ env: {
62753
+ DOTNET_ROOT: dotnetRoot,
62754
+ DOTNET_MULTILEVEL_LOOKUP: "0"
62755
+ }
62756
+ };
62757
+ }
62758
+
62693
62759
  // src/resolution/helm-nuget-resolver.ts
62694
62760
  var RESTORE_HEARTBEAT_INTERVAL_MS = 15000;
62695
62761
  var HELM_PACKAGE_PREFIX = "UiPath.Studio.Helm";
@@ -62751,20 +62817,22 @@ function getNuGetGlobalPackagesDir() {
62751
62817
  const envPath = process.env.NUGET_PACKAGES;
62752
62818
  if (envPath && existsSync3(envPath))
62753
62819
  return envPath;
62754
- return join4(homedir3(), ".nuget", "packages");
62820
+ return join5(homedir3(), ".nuget", "packages");
62755
62821
  }
62756
62822
  function findCachedHelmPackage(packageId, version) {
62757
62823
  const packagesDir = getNuGetGlobalPackagesDir();
62758
- const packageDir = join4(packagesDir, packageId.toLowerCase(), version, "tools");
62759
- if (existsSync3(join4(packageDir, HELM_INTEROP_MANIFEST))) {
62824
+ const packageDir = join5(packagesDir, packageId.toLowerCase(), version, "tools");
62825
+ if (existsSync3(join5(packageDir, HELM_INTEROP_MANIFEST))) {
62760
62826
  return packageDir;
62761
62827
  }
62762
62828
  return null;
62763
62829
  }
62764
- function spawnWithHeartbeat(command, args, heartbeatMessage) {
62830
+ function spawnWithHeartbeat(command, args, heartbeatMessage, env) {
62765
62831
  return new Promise((resolve2, reject) => {
62832
+ const spawnEnv = env ? { ...process.env, ...env } : undefined;
62766
62833
  const child = spawn3(command, args, {
62767
- stdio: ["ignore", "pipe", "pipe"]
62834
+ stdio: ["ignore", "pipe", "pipe"],
62835
+ env: spawnEnv
62768
62836
  });
62769
62837
  const stdoutChunks = [];
62770
62838
  const stderrChunks = [];
@@ -62800,8 +62868,17 @@ function spawnWithHeartbeat(command, args, heartbeatMessage) {
62800
62868
  });
62801
62869
  });
62802
62870
  }
62871
+ function isDotnetOnSystemPath(deps) {
62872
+ const probeCmd = process.platform === "win32" ? "where" : "which";
62873
+ try {
62874
+ const result = deps.executeCommand(probeCmd, ["dotnet"]);
62875
+ return result.trim().length > 0;
62876
+ } catch {
62877
+ return false;
62878
+ }
62879
+ }
62803
62880
  async function restoreHelmPackage(packageId, version, deps, nugetSource) {
62804
- const tempDir = mkdtempSync(join4(tmpdir3(), "helm-nuget-"));
62881
+ const tempDir = mkdtempSync(join5(tmpdir3(), "helm-nuget-"));
62805
62882
  try {
62806
62883
  const projectContent = `<Project Sdk="Microsoft.NET.Sdk">
62807
62884
  <PropertyGroup>
@@ -62811,21 +62888,39 @@ async function restoreHelmPackage(packageId, version, deps, nugetSource) {
62811
62888
  <PackageReference Include="${packageId}" Version="${version}" />
62812
62889
  </ItemGroup>
62813
62890
  </Project>`;
62814
- const projectPath = join4(tempDir, "HelmRestore.csproj");
62891
+ const projectPath = join5(tempDir, "HelmRestore.csproj");
62815
62892
  writeFileSync(projectPath, projectContent, "utf-8");
62816
- const nugetConfigPath = join4(tempDir, "nuget.config");
62893
+ const nugetConfigPath = join5(tempDir, "nuget.config");
62817
62894
  writeFileSync(nugetConfigPath, buildHelmNuGetConfigXml(version), "utf-8");
62818
62895
  const args = ["restore", projectPath, "--verbosity", "quiet"];
62819
62896
  if (nugetSource) {
62820
62897
  args.push("--source", nugetSource);
62821
62898
  }
62899
+ let dotnetCmd;
62900
+ let dotnetEnv;
62901
+ if (isDotnetOnSystemPath(deps)) {
62902
+ dotnetCmd = "dotnet";
62903
+ dotnetEnv = undefined;
62904
+ deps.log("Using system dotnet on PATH for restore");
62905
+ } else {
62906
+ const bundled = resolveBundledDotnet(resolveRobotDir(undefined, deps), deps);
62907
+ if (bundled) {
62908
+ dotnetCmd = bundled.exePath;
62909
+ dotnetEnv = bundled.env;
62910
+ deps.log(`System dotnet not on PATH; using bundled dotnet: ${bundled.exePath}`);
62911
+ } else {
62912
+ dotnetCmd = "dotnet";
62913
+ dotnetEnv = undefined;
62914
+ deps.log("No dotnet found on PATH and no bundled dotnet detected — restore will likely fail");
62915
+ }
62916
+ }
62822
62917
  const feedSummary = describeRestoreFeeds(version, nugetSource);
62823
- deps.log(`Restoring Helm NuGet package: dotnet ${args.join(" ")}`);
62918
+ deps.log(`Restoring Helm NuGet package: ${dotnetCmd} ${args.join(" ")}`);
62824
62919
  for (const line of feedSummary) {
62825
62920
  deps.log(` feed: ${line}`);
62826
62921
  }
62827
62922
  try {
62828
- await spawnWithHeartbeat("dotnet", args, `still restoring ${packageId}@${version}…`);
62923
+ await spawnWithHeartbeat(dotnetCmd, args, `still restoring ${packageId}@${version}…`, dotnetEnv);
62829
62924
  } catch (err2) {
62830
62925
  const baseMessage = err2 instanceof Error ? err2.message : String(err2);
62831
62926
  const feedsBlock = feedSummary.map((l) => ` - ${l}`).join(`
@@ -62847,7 +62942,7 @@ ${hint}`);
62847
62942
  async function resolveHelmFromNuGet(version, deps, nugetSource) {
62848
62943
  const localDir = process.env.HELM_LOCAL_DIR;
62849
62944
  if (localDir) {
62850
- const helmExePath2 = join4(localDir, HELM_EXE);
62945
+ const helmExePath2 = join5(localDir, HELM_EXE);
62851
62946
  if (existsSync3(helmExePath2)) {
62852
62947
  deps.log(`Using local Helm from HELM_LOCAL_DIR: ${localDir}`);
62853
62948
  return { toolsDir: localDir, helmExePath: helmExePath2 };
@@ -62872,7 +62967,7 @@ async function resolveHelmFromNuGet(version, deps, nugetSource) {
62872
62967
  `);
62873
62968
  deps.log(`Helm package restored to: ${toolsDir}`);
62874
62969
  }
62875
- const helmExePath = join4(toolsDir, HELM_EXE);
62970
+ const helmExePath = join5(toolsDir, HELM_EXE);
62876
62971
  if (!existsSync3(helmExePath)) {
62877
62972
  throw new Error(`Helm binary not found at ${helmExePath} after NuGet restore. ` + "The package may be corrupt or incomplete.");
62878
62973
  }
@@ -62894,7 +62989,7 @@ async function resolveWorkflowCompiler() {
62894
62989
  log: (msg) => logger.debug(msg)
62895
62990
  };
62896
62991
  const { toolsDir } = await resolveHelmFromNuGet(helmVersion, deps);
62897
- const compilerPath = join6(toolsDir, WORKFLOW_COMPILER_EXE);
62992
+ const compilerPath = join7(toolsDir, WORKFLOW_COMPILER_EXE);
62898
62993
  if (existsSync5(compilerPath)) {
62899
62994
  logger.debug(`Using WorkflowCompiler from Helm NuGet package: ${compilerPath}`);
62900
62995
  return compilerPath;
@@ -63089,7 +63184,7 @@ function registerPackCommand(program3) {
63089
63184
  init_dist();
63090
63185
  import { mkdtempSync as mkdtempSync2 } from "node:fs";
63091
63186
  import { tmpdir as tmpdir5 } from "node:os";
63092
- import { isAbsolute as isAbsolute3, join as join7, relative as relative3, resolve as resolve3 } from "node:path";
63187
+ import { isAbsolute as isAbsolute3, join as join8, relative as relative3, resolve as resolve3 } from "node:path";
63093
63188
  function isWithinOrEqual(parent, candidate) {
63094
63189
  const norm = process.platform === "win32" ? (p) => p.toLowerCase() : (p) => p;
63095
63190
  const rel = relative3(norm(resolve3(parent)), norm(resolve3(candidate)));
@@ -63111,7 +63206,7 @@ function registerRestoreCommand(program3) {
63111
63206
  label: "Restore",
63112
63207
  hint: "Check project path and NuGet configuration.",
63113
63208
  execute: async (packager, options) => {
63114
- options.outputPath = outputPath ?? mkdtempSync2(join7(tmpdir5(), "rpa-tool-restore-"));
63209
+ options.outputPath = outputPath ?? mkdtempSync2(join8(tmpdir5(), "rpa-tool-restore-"));
63115
63210
  return packager.restoreProjectAsync(options);
63116
63211
  }
63117
63212
  });
@@ -63435,7 +63530,7 @@ function filterByBackend(instances, preference) {
63435
63530
  }
63436
63531
  }
63437
63532
  // src/resolution/studio-bin-resolver.ts
63438
- import { dirname as dirname3, join as join8 } from "node:path";
63533
+ import { dirname as dirname3, join as join9 } from "node:path";
63439
63534
  function getProcessExecutablePath(pid, deps) {
63440
63535
  const exePath = deps.executeCommand("powershell", [
63441
63536
  "-NoProfile",
@@ -63444,7 +63539,7 @@ function getProcessExecutablePath(pid, deps) {
63444
63539
  ]);
63445
63540
  return dirname3(exePath);
63446
63541
  }
63447
- var REGISTRY_HIVES = [
63542
+ var REGISTRY_HIVES2 = [
63448
63543
  "HKCU\\Software\\UiPath\\UiPath Studio",
63449
63544
  "HKLM\\Software\\UiPath\\UiPath Studio"
63450
63545
  ];
@@ -63463,7 +63558,7 @@ function queryRegistryHive(hive, deps) {
63463
63558
  }
63464
63559
  }
63465
63560
  function queryRegistryInstallDir(deps) {
63466
- for (const hive of REGISTRY_HIVES) {
63561
+ for (const hive of REGISTRY_HIVES2) {
63467
63562
  const dir = queryRegistryHive(hive, deps);
63468
63563
  if (dir)
63469
63564
  return dir;
@@ -63506,7 +63601,7 @@ function getStudioFileVersion(binDir, deps) {
63506
63601
  return "unknown";
63507
63602
  }
63508
63603
  try {
63509
- const exePath = join8(binDir, STUDIO_EXE);
63604
+ const exePath = join9(binDir, STUDIO_EXE);
63510
63605
  const raw = deps.executeCommand("powershell", [
63511
63606
  "-NoProfile",
63512
63607
  "-Command",
@@ -63519,7 +63614,7 @@ function getStudioFileVersion(binDir, deps) {
63519
63614
  }
63520
63615
  }
63521
63616
  function readManifest(binDir, filename, deps) {
63522
- const manifestPath = join8(binDir, filename);
63617
+ const manifestPath = join9(binDir, filename);
63523
63618
  try {
63524
63619
  const content = deps.readFile(manifestPath);
63525
63620
  return JSON.parse(content);
@@ -63532,7 +63627,7 @@ function readInteropManifest(binDir, deps) {
63532
63627
  return readManifest(binDir, INTEROP_MANIFEST, deps);
63533
63628
  }
63534
63629
  function validateInteropSupport(binDir, deps) {
63535
- const manifestPath = join8(binDir, INTEROP_MANIFEST);
63630
+ const manifestPath = join9(binDir, INTEROP_MANIFEST);
63536
63631
  if (!deps.fileExists(manifestPath)) {
63537
63632
  const version = getStudioFileVersion(binDir, deps);
63538
63633
  throw new Error(`Studio ${version} does not support rpa-tool. Please upgrade to the latest version of UiPath Studio.`);
@@ -63541,59 +63636,6 @@ function validateInteropSupport(binDir, deps) {
63541
63636
 
63542
63637
  // src/resolution/studio-startup.ts
63543
63638
  import { join as join10 } from "node:path";
63544
-
63545
- // src/resolution/robot-bin-resolver.ts
63546
- import { join as join9 } from "node:path";
63547
- var ROBOT_SERVICE_DLL = "UiPath.Service.NetCoreHost.dll";
63548
- var MACOS_ASSISTANT_ROBOT_PATH = "/Applications/UiPath Assistant.app/Contents/Robot";
63549
- var REGISTRY_HIVES2 = [
63550
- "HKCU\\Software\\UiPath\\UiPath Studio",
63551
- "HKLM\\Software\\UiPath\\UiPath Studio"
63552
- ];
63553
- function queryRegistryRobotDir(deps) {
63554
- for (const hive of REGISTRY_HIVES2) {
63555
- try {
63556
- const output = deps.executeCommand("reg", [
63557
- "query",
63558
- hive,
63559
- "/v",
63560
- "InstallDir"
63561
- ]);
63562
- const match = output.match(/InstallDir\s+REG_SZ\s+(.+)/);
63563
- if (match)
63564
- return match[1].trim();
63565
- } catch {}
63566
- }
63567
- return;
63568
- }
63569
- function resolveRobotDir(cliPath, deps) {
63570
- if (cliPath) {
63571
- deps.log(`Using --robot-dir: ${cliPath}`);
63572
- return cliPath;
63573
- }
63574
- const envPath = process.env.UIPATH_ROBOT_DIR;
63575
- if (envPath) {
63576
- deps.log(`Using UIPATH_ROBOT_DIR: ${envPath}`);
63577
- return envPath;
63578
- }
63579
- if (process.platform === "win32") {
63580
- const dir = queryRegistryRobotDir(deps);
63581
- if (dir) {
63582
- deps.log(`Resolved robot dir from registry: ${dir}`);
63583
- return dir;
63584
- }
63585
- }
63586
- if (process.platform === "darwin") {
63587
- if (deps.fileExists(join9(MACOS_ASSISTANT_ROBOT_PATH, ROBOT_SERVICE_DLL))) {
63588
- deps.log(`Found robot at well-known path: ${MACOS_ASSISTANT_ROBOT_PATH}`);
63589
- return MACOS_ASSISTANT_ROBOT_PATH;
63590
- }
63591
- }
63592
- deps.log("Robot dir not resolved — Robot must already be running");
63593
- return null;
63594
- }
63595
-
63596
- // src/resolution/studio-startup.ts
63597
63639
  async function waitForInstanceAvailability(processId, deps, timeoutMs = DEFAULT_TIMEOUT_MS) {
63598
63640
  const deadline = Date.now() + timeoutMs;
63599
63641
  let pollCount = 0;
@@ -63653,19 +63695,6 @@ async function startStudioAndWait(binDir, deps, timeoutMs = DEFAULT_TIMEOUT_MS)
63653
63695
  }
63654
63696
  throw new Error(`Studio did not become ready within ${timeoutMs / 1000}s after ${pollCount} polls. ` + "Check that UiPath.Studio.exe can start successfully.");
63655
63697
  }
63656
- function resolveBundledDotnetEnv(robotDir, deps) {
63657
- if (!robotDir)
63658
- return;
63659
- const dotnetExePath = process.platform === "win32" ? join10(robotDir, "dotnet.exe") : join10(robotDir, "dotnet", "dotnet");
63660
- if (!deps.fileExists(dotnetExePath))
63661
- return;
63662
- const dotnetRoot = process.platform === "win32" ? robotDir : join10(robotDir, "dotnet");
63663
- deps.log(`Bundled dotnet found in Robot dir, setting DOTNET_ROOT=${dotnetRoot}`);
63664
- return {
63665
- DOTNET_ROOT: dotnetRoot,
63666
- DOTNET_MULTILEVEL_LOOKUP: "0"
63667
- };
63668
- }
63669
63698
  async function startHelmAndWait(deps, timeoutMs = DEFAULT_TIMEOUT_MS, options) {
63670
63699
  let extraArgs = [...options.extraArgs ?? []];
63671
63700
  const existingPids = new Set(deps.discoverInstances().instances.map((i3) => i3.processId));
@@ -63675,7 +63704,11 @@ async function startHelmAndWait(deps, timeoutMs = DEFAULT_TIMEOUT_MS, options) {
63675
63704
  extraArgs = ["--robot-dir", robotDir, ...extraArgs];
63676
63705
  deps.log(`Robot dir resolved: ${robotDir}`);
63677
63706
  }
63678
- const helmEnv = resolveBundledDotnetEnv(robotDir, deps);
63707
+ const bundledDotnet = resolveBundledDotnet(robotDir, deps);
63708
+ const helmEnv = bundledDotnet?.env;
63709
+ if (bundledDotnet) {
63710
+ deps.log(`Bundled dotnet found in Robot dir, setting DOTNET_ROOT=${bundledDotnet.env.DOTNET_ROOT}`);
63711
+ }
63679
63712
  const exePath = options.helmExePath;
63680
63713
  deps.log(`Using NuGet-resolved Helm: ${exePath}`);
63681
63714
  deps.log(`Starting Helm: ${exePath}${extraArgs.length ? ` ${extraArgs.join(" ")}` : ""}`);
@@ -64333,9 +64366,17 @@ function writeCache(path4, entry, deps) {
64333
64366
 
64334
64367
  // src/external-cli/forward.ts
64335
64368
  import { spawn as spawn5 } from "node:child_process";
64336
- function spawnForward(exePath, args) {
64369
+ function mergeEnv(extra) {
64370
+ if (!extra)
64371
+ return;
64372
+ return { ...process.env, ...extra };
64373
+ }
64374
+ function spawnForward(exePath, args, env) {
64337
64375
  return new Promise((resolve5, reject) => {
64338
- const child = spawn5(exePath, args, { stdio: "inherit" });
64376
+ const child = spawn5(exePath, args, {
64377
+ stdio: "inherit",
64378
+ env: mergeEnv(env)
64379
+ });
64339
64380
  child.on("error", (err2) => {
64340
64381
  reject(new Error(`Failed to spawn '${exePath}': ${err2.message}`));
64341
64382
  });
@@ -64344,10 +64385,11 @@ function spawnForward(exePath, args) {
64344
64385
  });
64345
64386
  });
64346
64387
  }
64347
- function spawnCapture(exePath, args) {
64388
+ function spawnCapture(exePath, args, env) {
64348
64389
  return new Promise((resolve5, reject) => {
64349
64390
  const child = spawn5(exePath, args, {
64350
- stdio: ["inherit", "pipe", "pipe"]
64391
+ stdio: ["inherit", "pipe", "pipe"],
64392
+ env: mergeEnv(env)
64351
64393
  });
64352
64394
  const stdoutChunks = [];
64353
64395
  const stderrChunks = [];
@@ -64377,6 +64419,37 @@ var defaultDeps3 = {
64377
64419
  fileExists: existsSync9,
64378
64420
  readFile: (path4) => readFileSync4(path4, "utf-8")
64379
64421
  };
64422
+ function getCurrentPlatformKey() {
64423
+ let osSegment;
64424
+ switch (process.platform) {
64425
+ case "win32":
64426
+ osSegment = "win";
64427
+ break;
64428
+ case "darwin":
64429
+ osSegment = "osx";
64430
+ break;
64431
+ case "linux":
64432
+ osSegment = "linux";
64433
+ break;
64434
+ default:
64435
+ osSegment = process.platform;
64436
+ }
64437
+ return `${osSegment}-${process.arch}`;
64438
+ }
64439
+ function resolveExecutableRelativePath(manifest, manifestPath, platformKey) {
64440
+ const { executable, executables } = manifest.tool;
64441
+ if (executables) {
64442
+ const match = executables[platformKey];
64443
+ if (!match) {
64444
+ const supported = Object.keys(executables).sort().join(", ");
64445
+ throw new Error(`No executable declared for platform '${platformKey}' in ${manifestPath}. ` + `Supported platforms: ${supported || "(none)"}.`);
64446
+ }
64447
+ return match;
64448
+ }
64449
+ if (executable)
64450
+ return executable;
64451
+ throw new Error(`Manifest ${manifestPath} declares neither 'tool.executable' nor 'tool.executables'.`);
64452
+ }
64380
64453
  function readCliManifest(packageRoot, deps = defaultDeps3) {
64381
64454
  const manifestPath = join14(packageRoot, MANIFEST_FILENAME);
64382
64455
  if (!deps.fileExists(manifestPath)) {
@@ -64391,7 +64464,9 @@ function readCliManifest(packageRoot, deps = defaultDeps3) {
64391
64464
  if (manifest.manifestVersion !== 1) {
64392
64465
  throw new Error(`Unsupported manifest version ${manifest.manifestVersion} in ${manifestPath}. Expected 1.`);
64393
64466
  }
64394
- const exePath = join14(packageRoot, manifest.tool.executable);
64467
+ const platformKey = (deps.getPlatformKey ?? getCurrentPlatformKey)();
64468
+ const relExe = resolveExecutableRelativePath(manifest, manifestPath, platformKey);
64469
+ const exePath = join14(packageRoot, relExe);
64395
64470
  if (!deps.fileExists(exePath)) {
64396
64471
  throw new Error(`Executable not found at ${exePath} as declared in ${manifestPath}.`);
64397
64472
  }
@@ -64399,8 +64474,8 @@ function readCliManifest(packageRoot, deps = defaultDeps3) {
64399
64474
  }
64400
64475
 
64401
64476
  // src/external-cli/register-cli-commands.ts
64402
- function registerExternalCliCommands(program3, projectDir, config2, deps, session, defaultFormat) {
64403
- const resolvedDeps = resolveDeps(projectDir, config2, deps, session);
64477
+ function registerExternalCliCommands(program3, projectDir, config2, deps, session, defaultFormat, runtime) {
64478
+ const resolvedDeps = resolveDeps(projectDir, config2, deps, session, runtime);
64404
64479
  const group = program3.command(config2.commandName).description(config2.description);
64405
64480
  let exePath;
64406
64481
  let manifest;
@@ -64473,17 +64548,18 @@ function registerCommand(parent, exePath, projectDir, cmd, config2, deps, comman
64473
64548
  throw new Error(`Command '${currentPath.join(" ")}' does not support --format.`);
64474
64549
  }
64475
64550
  const run = async () => {
64551
+ const env = deps.resolveEnv?.();
64476
64552
  if (supportsFormat) {
64477
64553
  const { format: _stripped, ...forwardOpts } = opts;
64478
64554
  const args = buildArgs(currentPath, positionalValues, forwardOpts, cmd, config2, effectiveProjectDir, "json");
64479
- const result = await deps.spawnCapture(exePath, args);
64555
+ const result = await deps.spawnCapture(exePath, args, env);
64480
64556
  renderCapturedOutput(result);
64481
64557
  if (result.exitCode !== 0) {
64482
64558
  processContext.exit(result.exitCode);
64483
64559
  }
64484
64560
  } else {
64485
64561
  const args = buildArgs(currentPath, positionalValues, opts, cmd, config2, effectiveProjectDir);
64486
- const exitCode = await deps.spawnForward(exePath, args);
64562
+ const exitCode = await deps.spawnForward(exePath, args, env);
64487
64563
  if (exitCode !== 0) {
64488
64564
  processContext.exit(exitCode);
64489
64565
  }
@@ -64611,7 +64687,7 @@ function renderCapturedOutput(captured) {
64611
64687
  OutputFormatter.error(new FailureOutput(envelope.Result || "Failure", envelope.Message ?? "Unknown error from external CLI", envelope.Instructions ?? "Check external CLI logs for details."));
64612
64688
  }
64613
64689
  }
64614
- function resolveDeps(_projectDir, config2, partial2, session) {
64690
+ function resolveDeps(_projectDir, config2, partial2, session, runtime) {
64615
64691
  return {
64616
64692
  discover: partial2?.discover ?? ((dir) => {
64617
64693
  const packageRoot = discoverPackageRootCached({
@@ -64625,7 +64701,23 @@ function resolveDeps(_projectDir, config2, partial2, session) {
64625
64701
  spawnCapture: partial2?.spawnCapture ?? spawnCapture,
64626
64702
  openProject: partial2?.openProject ?? (session ? (dir, operation) => session.execute(async () => {
64627
64703
  await operation();
64628
- }, { projectDir: dir, backend: "helm" /* Helm */ }) : undefined)
64704
+ }, { projectDir: dir, backend: "helm" /* Helm */ }) : undefined),
64705
+ resolveEnv: partial2?.resolveEnv ?? buildBundledDotnetEnvResolver(runtime)
64706
+ };
64707
+ }
64708
+ function buildBundledDotnetEnvResolver(runtime) {
64709
+ const resolverDeps = runtime?.resolverDeps;
64710
+ if (!resolverDeps)
64711
+ return;
64712
+ let cached3;
64713
+ let resolved = false;
64714
+ return () => {
64715
+ if (!resolved) {
64716
+ const robotDir = resolveRobotDir(runtime?.robotDir, resolverDeps);
64717
+ cached3 = resolveBundledDotnet(robotDir, resolverDeps)?.env;
64718
+ resolved = true;
64719
+ }
64720
+ return cached3;
64629
64721
  };
64630
64722
  }
64631
64723
 
@@ -67054,7 +67146,8 @@ var registerCommands = async (program3, options) => {
67054
67146
  registerAnalyzeCommand(program3);
67055
67147
  registerBuildCommand(program3);
67056
67148
  registerPackCommand(program3);
67057
- const session = createSession(resolved);
67149
+ const resolverDeps = buildResolverDeps(resolved);
67150
+ const session = createSession(resolved, resolverDeps);
67058
67151
  const format = extractArg(process.argv, "format");
67059
67152
  registerExternalCliCommands(program3, resolved.projectDir, {
67060
67153
  commandName: "uia",
@@ -67063,7 +67156,7 @@ var registerCommands = async (program3, options) => {
67063
67156
  minVersion: "26.4.1-preview",
67064
67157
  injectProjectDir: "project-dir",
67065
67158
  injectFormat: "format"
67066
- }, undefined, session, format);
67159
+ }, undefined, session, format, { resolverDeps, robotDir: resolved.robotDir });
67067
67160
  const toolProvider = resolveToolProvider(resolved, session);
67068
67161
  await registerMcpCommands(program3, toolProvider);
67069
67162
  const parentOptionDefs = [
@@ -67092,13 +67185,16 @@ Run 'start-studio' to start a Studio instance — ` + "additional commands may b
67092
67185
  process.exit(1);
67093
67186
  });
67094
67187
  };
67095
- function createSession(options) {
67096
- if (!options)
67097
- return;
67098
- const deps = options.verbose ? {
67188
+ function buildResolverDeps(options) {
67189
+ return options.verbose ? {
67099
67190
  ...defaultResolverDeps,
67100
67191
  log: (msg) => console.debug(`[rpa-tool] ${msg}`)
67101
67192
  } : defaultResolverDeps;
67193
+ }
67194
+ function createSession(options, deps) {
67195
+ if (!options)
67196
+ return;
67197
+ const resolverDeps = deps ?? buildResolverDeps(options);
67102
67198
  const timeoutMs = options.timeoutSeconds != null ? options.timeoutSeconds * 1000 : undefined;
67103
67199
  return new StudioSession({
67104
67200
  projectDir: options.projectDir,
@@ -67107,7 +67203,7 @@ function createSession(options) {
67107
67203
  useStudio: options.useStudio,
67108
67204
  hostStudioPid: options.hostStudioPid,
67109
67205
  timeoutMs
67110
- }, deps);
67206
+ }, resolverDeps);
67111
67207
  }
67112
67208
  function resolveToolProvider(options, session) {
67113
67209
  const localTools = new LocalToolProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/rpa-tool",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "Tool for creating and managing UiPath RPA projects",
5
5
  "keywords": [
6
6
  "uipcli-tool",
@@ -33,7 +33,7 @@
33
33
  "registry": "https://npm.pkg.github.com"
34
34
  },
35
35
  "scripts": {
36
- "build": "bunx tsc --noEmit && bun build ./src/packager-tool.ts --outdir dist --format esm --target node --external @uipath/solutionpackager-tool-core && bun build ./src/tool.ts --outdir dist --format esm --target node --external '*/packager-tool.js' --external applicationinsights && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external applicationinsights",
36
+ "build": "bunx tsc --noEmit && bun build ./src/packager-tool.ts --outdir dist --format esm --target node && bun build ./src/tool.ts --outdir dist --format esm --target node --external '*/packager-tool.js' --external applicationinsights && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external applicationinsights",
37
37
  "package": "bun run build && bun pm pack",
38
38
  "generate-docs": "bun run scripts/generate-docs.ts",
39
39
  "bump-uipath-alpha": "bun run scripts/bump-uipath-alpha.ts",