@uipath/cli 0.1.17 → 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 +50 -25
  2. package/package.json +1 -1
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.17",
55
+ version: "0.1.19",
56
56
  description: "Cross platform CLI for UiPath",
57
57
  repository: {
58
58
  type: "git",
@@ -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
@@ -35850,7 +35869,7 @@ var init_toolService = __esm(() => {
35850
35869
  TOOLS_WHITELIST = new Map([
35851
35870
  ["@uipath/solution-tool", "solution"],
35852
35871
  ["@uipath/agent-tool", "agent"],
35853
- ["@uipath/codedagents-tool", "codedagents"],
35872
+ ["@uipath/codedagents-tool", "codedagent"],
35854
35873
  ["@uipath/codedapp-tool", "codedapp"],
35855
35874
  ["@uipath/integrationservice-tool", "is"],
35856
35875
  ["@uipath/orchestrator-tool", "or"],
@@ -35858,7 +35877,7 @@ var init_toolService = __esm(() => {
35858
35877
  ["@uipath/flow-tool", "flow"],
35859
35878
  ["@uipath/case-tool", "case"],
35860
35879
  ["@uipath/test-manager-tool", "tm"],
35861
- ["@uipath/resources-tool", "resources"],
35880
+ ["@uipath/resources-tool", "resource"],
35862
35881
  ["@uipath/api-workflow-tool", "api-workflow"],
35863
35882
  ["@uipath/maestro-tool", "maestro"],
35864
35883
  ["@uipath/docsai-tool", "docsai"],
@@ -35941,16 +35960,21 @@ var init_install2 = __esm(() => {
35941
35960
  init_toolService();
35942
35961
  });
35943
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
+
35944
35973
  // src/commands/tools/list.ts
35945
35974
  import { OutputFormatter as OutputFormatter9, processContext as processContext6 } from "@uipath/common";
35946
35975
  function registerListCommand(toolsCommand, state) {
35947
35976
  toolsCommand.command("list").description("List installed tools").trackedAction(processContext6, async () => {
35948
- const data = state.tools.length > 0 ? state.tools.map((tool) => tool.metadata) : (state.discoveredTools ?? []).map((d) => ({
35949
- name: d.toolName,
35950
- version: d.version,
35951
- description: d.description,
35952
- commandPrefix: d.commandPrefix
35953
- }));
35977
+ const data = getInstalledTools(state);
35954
35978
  OutputFormatter9.success({
35955
35979
  Result: "Success",
35956
35980
  Code: "ToolList",
@@ -36040,9 +36064,10 @@ import {
36040
36064
  } from "@uipath/common";
36041
36065
  import { getFileSystem as getFileSystem16 } from "@uipath/filesystem";
36042
36066
  function registerUpdateCommand2(toolsCommand, _context, state) {
36043
- const { tools, toolsDirs, resolveInstallPath, getCliVersionPrefix } = state;
36067
+ const { toolsDirs, resolveInstallPath, getCliVersionPrefix } = state;
36044
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) => {
36045
- if (tools.length === 0) {
36069
+ const installed = getInstalledTools(state);
36070
+ if (installed.length === 0) {
36046
36071
  OutputFormatter12.error({
36047
36072
  Result: "Failure",
36048
36073
  Message: "No tools installed.",
@@ -36062,7 +36087,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
36062
36087
  return;
36063
36088
  }
36064
36089
  const resolvedName = options.name ? resolveToolPackageName(options.name) : undefined;
36065
- 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;
36066
36091
  if (resolvedName && toUpdate.length === 0) {
36067
36092
  OutputFormatter12.error({
36068
36093
  Result: "Failure",
@@ -36085,9 +36110,9 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
36085
36110
  }
36086
36111
  }
36087
36112
  const results = [];
36088
- 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]));
36089
36114
  for (const tool of toUpdate) {
36090
- const fullName = `@uipath/${tool.metadata.name}`;
36115
+ const fullName = `@uipath/${tool.name}`;
36091
36116
  const [updateError] = await catchError18((async () => {
36092
36117
  let targetVersion = options.version;
36093
36118
  if (targetVersion === "latest") {
@@ -36097,18 +36122,18 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
36097
36122
  targetVersion = latest;
36098
36123
  } else {
36099
36124
  results.push({
36100
- name: tool.metadata.name,
36125
+ name: tool.name,
36101
36126
  status: "failed",
36102
- from: tool.metadata.version,
36127
+ from: tool.version,
36103
36128
  error: `No compatible version found for CLI v${cliPrefix}x`
36104
36129
  });
36105
36130
  return;
36106
36131
  }
36107
36132
  }
36108
- const currentVersion = tool.metadata.version;
36133
+ const currentVersion = tool.version;
36109
36134
  if (currentVersion === targetVersion) {
36110
36135
  results.push({
36111
- name: tool.metadata.name,
36136
+ name: tool.name,
36112
36137
  status: "up-to-date",
36113
36138
  from: currentVersion,
36114
36139
  to: currentVersion
@@ -36120,7 +36145,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
36120
36145
  })());
36121
36146
  if (updateError) {
36122
36147
  results.push({
36123
- name: tool.metadata.name,
36148
+ name: tool.name,
36124
36149
  status: "failed",
36125
36150
  error: updateError.message
36126
36151
  });
@@ -36130,7 +36155,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
36130
36155
  const updatedVersions = new Map;
36131
36156
  for (const dir of toolsDirs) {
36132
36157
  for (const tool of toUpdate) {
36133
- const name = tool.metadata.name;
36158
+ const name = tool.name;
36134
36159
  if (updatedVersions.has(name))
36135
36160
  continue;
36136
36161
  const pkgPath = fs.path.join(dir, name, "package.json");
@@ -36147,7 +36172,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
36147
36172
  }
36148
36173
  const recordedNames = new Set(results.map((r) => r.name));
36149
36174
  for (const tool of toUpdate) {
36150
- const name = tool.metadata.name;
36175
+ const name = tool.name;
36151
36176
  if (recordedNames.has(name))
36152
36177
  continue;
36153
36178
  const from = previousVersions.get(name) ?? "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/cli",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Cross platform CLI for UiPath",
5
5
  "repository": {
6
6
  "type": "git",