@uipath/cli 1.206.0-preview.303 → 1.207.0-preview.305
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/README.md +48 -0
- package/dist/{browser-strategy-p5fhwxqj.js → browser-strategy-5rfwnk5q.js} +1 -1
- package/dist/cli-10857d67.js +28 -0
- package/dist/cliInstaller-3dxg6fbd.js +23 -0
- package/dist/{contentStore-w35jnkxk.js → contentStore-z3t1yt3n.js} +7 -6
- package/dist/{environmentInfo-nz3126q4.js → environmentInfo-dyhpheza.js} +6 -6
- package/dist/{feedbackPrompts-bx209g5v.js → feedbackPrompts-fc66gq0p.js} +3 -3
- package/dist/forcedUpdate-5hd8cp9x.js +21 -0
- package/dist/{handlers-jjwt24f2.js → handlers-rg3d62gb.js} +13 -9
- package/dist/index-2f6vv7yr.js +81 -0
- package/dist/{index-v3vx48v0.js → index-2g332j2f.js} +8 -12
- package/dist/index-319vtrwd.js +264 -0
- package/dist/{index-jqt7p70w.js → index-3vkb4j13.js} +26 -17
- package/dist/index-5j78gm9c.js +41 -0
- package/dist/index-5ygg5mrs.js +1272 -0
- package/dist/{index-99emfvtm.js → index-65pyx6c9.js} +4 -2
- package/dist/{index-rr5hdtcy.js → index-81197qe5.js} +15 -17
- package/dist/{index-2mm750yx.js → index-8n0z4r6f.js} +69 -13
- package/dist/{index-8zhmg5tz.js → index-8pk6n4t9.js} +2 -2
- package/dist/{index-cef72dzy.js → index-9v7334md.js} +1 -1
- package/dist/{index-nsrrst23.js → index-ack311y7.js} +12 -2
- package/dist/{index-2n2vr5w5.js → index-dt6mjnkf.js} +39 -57
- package/dist/{index-y7d0cth0.js → index-e82sznr2.js} +7 -7
- package/dist/index-ej6eeger.js +23 -0
- package/dist/index-evcsjfyy.js +248 -0
- package/dist/{index-bxc30q35.js → index-gk5pc8xr.js} +2 -2
- package/dist/{index-7q9kcs3w.js → index-h2ctqv68.js} +14 -5
- package/dist/index-jk7em40j.js +37 -0
- package/dist/{index-vhn8f5d2.js → index-kdr4xvby.js} +5 -5
- package/dist/{index-y7j0ant5.js → index-kmacaa53.js} +2130 -834
- package/dist/{index-ckp8r4dh.js → index-mb62swmp.js} +2 -2
- package/dist/{index-dxfqvgqg.js → index-md27nny8.js} +7 -10
- package/dist/{index-85fa5z1t.js → index-nex3q8cg.js} +2 -2
- package/dist/index-nyx7fh45.js +331 -0
- package/dist/index-nzfpbep9.js +14 -0
- package/dist/{index-z070caqq.js → index-p64w2wrt.js} +30 -8
- package/dist/{index-0pan2k7w.js → index-t6hrzpm7.js} +30 -14
- package/dist/index-v7yphxb8.js +118 -0
- package/dist/index-vrfbee4d.js +340 -0
- package/dist/{index-69mcde3n.js → index-xw81b1gn.js} +196 -81
- package/dist/{index-wg3cne7n.js → index-xxms6rt8.js} +24 -5
- package/dist/{index-21kns9qg.js → index-y7v9rkq9.js} +1 -1
- package/dist/{index-6wzpac34.js → index-z3q16ts7.js} +81 -58
- package/dist/{index-fdztq951.js → index-zhp702kh.js} +393 -82
- package/dist/index.js +23 -18
- package/dist/{install-kgcwdbqs.js → install-h76qyy1e.js} +6 -7
- package/dist/{node-strategy-p1n8wr5s.js → node-strategy-9t0ttffv.js} +2 -2
- package/dist/{project-context-caht70an.js → project-context-rc4ghykm.js} +13 -5
- package/dist/{prompt-tvxwpvxh.js → prompt-66bnttv7.js} +5 -5
- package/dist/{server-pge2gheb.js → server-pxfn9w9m.js} +5 -5
- package/dist/{skillCatalog-b3z68z4n.js → skillCatalog-7gh14b4s.js} +8 -7
- package/dist/skillsService-wz3c21qb.js +35 -0
- package/dist/{telemetry-drain-rt346cfz.js → telemetry-drain-8qr5tzmf.js} +2 -2
- package/dist/tree-fk9gwh4v.js +16 -0
- package/dist/updateService-ybs9274t.js +377 -0
- package/dist/updateService.cli-xtqp78g7.js +15 -0
- package/dist/updateService.skills-pgst1fyj.js +27 -0
- package/dist/updateService.tools-m58m2fbt.js +19 -0
- package/package.json +2 -2
- package/dist/cli-0p8c9t5r.js +0 -23
- package/dist/index-1n5v3afn.js +0 -45
- package/dist/index-3qp7d08f.js +0 -240
- package/dist/index-3zf0ywpb.js +0 -95
- package/dist/index-753mncpq.js +0 -271
- package/dist/skillsService-qzzqacmg.js +0 -29
- package/dist/tree-4dhk82fh.js +0 -17
- package/dist/updateService-b579ys6m.js +0 -522
- package/dist/updateService.skills-teejc562.js +0 -22
- package/dist/updateService.tools-3zfct9yk.js +0 -16
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_AUTH_PROFILE2,
|
|
3
|
+
normalizeAuthProfileName2,
|
|
4
|
+
getActiveAuthProfile2,
|
|
5
|
+
listAuthProfileNamesAsync2,
|
|
6
|
+
authProfileExistsAsync2,
|
|
7
|
+
deleteAuthProfileAsync2,
|
|
8
|
+
parseJWT2,
|
|
9
|
+
DEFAULT_AUTH_FILENAME2,
|
|
10
|
+
getLoginStatusAsync2,
|
|
11
|
+
describeAuthProfilesAsync2,
|
|
12
|
+
logout2
|
|
13
|
+
} from "./index-8n0z4r6f.js";
|
|
1
14
|
import {
|
|
2
15
|
getFileSystem2,
|
|
3
16
|
getFileSystemAsync2
|
|
4
|
-
} from "./index-
|
|
17
|
+
} from "./index-p64w2wrt.js";
|
|
5
18
|
import {
|
|
6
19
|
CLI_APPLICATION_NAME,
|
|
7
20
|
BaseDimensions,
|
|
@@ -11,10 +24,12 @@ import {
|
|
|
11
24
|
assertNoCuratedDimensionTargets,
|
|
12
25
|
redactProperties,
|
|
13
26
|
catchError,
|
|
27
|
+
RESULTS,
|
|
14
28
|
carriedErrorCode,
|
|
15
29
|
carriedRetry,
|
|
16
30
|
carriedInstructions,
|
|
17
|
-
|
|
31
|
+
classifyThrownError,
|
|
32
|
+
classifiedFailure,
|
|
18
33
|
Command,
|
|
19
34
|
Option,
|
|
20
35
|
setPreviewBuild,
|
|
@@ -36,13 +51,12 @@ import {
|
|
|
36
51
|
getHelpRequested,
|
|
37
52
|
setOutputFilter,
|
|
38
53
|
OUTPUT_FORMATS,
|
|
39
|
-
isOutputFormat,
|
|
40
54
|
takeRecordedCommandFailureTelemetry,
|
|
41
55
|
buildCommandTerminalTelemetryProperties,
|
|
42
56
|
CommonTelemetryEvents,
|
|
57
|
+
setGlobalTelemetryProperties,
|
|
43
58
|
detectAgent,
|
|
44
59
|
detectAgentVersion,
|
|
45
|
-
setGlobalTelemetryProperties,
|
|
46
60
|
isTelemetryDisabled,
|
|
47
61
|
telemetry,
|
|
48
62
|
telemetryInit,
|
|
@@ -50,11 +64,13 @@ import {
|
|
|
50
64
|
telemetryShutdownWithoutFlush,
|
|
51
65
|
EXIT_CODES,
|
|
52
66
|
Pagination,
|
|
67
|
+
pascalCaseDataKeys,
|
|
53
68
|
validateOutputFilter,
|
|
54
69
|
OutputFormatter,
|
|
55
70
|
configureProjectContextTelemetry,
|
|
56
71
|
buildSkillEventTelemetryAttribution,
|
|
57
72
|
sanitizeTelemetryToken,
|
|
73
|
+
CLI_COMMAND_ROOT,
|
|
58
74
|
commandTelemetryName,
|
|
59
75
|
commandInvocationPath,
|
|
60
76
|
runWithInvocationRequest,
|
|
@@ -64,31 +80,74 @@ import {
|
|
|
64
80
|
extractCommandHelp,
|
|
65
81
|
requireConfirmation,
|
|
66
82
|
UIPATH_HOME_DIR,
|
|
67
|
-
CONFIG_FILENAME,
|
|
68
83
|
setInteractivityMode,
|
|
69
84
|
setInteractiveFlag,
|
|
70
85
|
canPrompt,
|
|
71
86
|
parseBoundedInt,
|
|
87
|
+
isOutputRelayed,
|
|
72
88
|
setSdkUserAgentHostToken,
|
|
89
|
+
quoteForShell,
|
|
73
90
|
readStdinWithTimeout,
|
|
74
91
|
setPackagerFactoryProvider
|
|
75
|
-
} from "./index-
|
|
92
|
+
} from "./index-zhp702kh.js";
|
|
76
93
|
import {
|
|
77
94
|
VALID_CHANNELS,
|
|
78
95
|
HIDDEN_CHANNELS,
|
|
79
96
|
PUBLIC_CHANNELS,
|
|
97
|
+
versionChannel
|
|
98
|
+
} from "./index-ej6eeger.js";
|
|
99
|
+
import {
|
|
100
|
+
VERSION_PIN_RE,
|
|
101
|
+
channelOffPinMessage,
|
|
102
|
+
parseVersionPin,
|
|
103
|
+
majorOf,
|
|
104
|
+
versionLinePrefix,
|
|
105
|
+
skillsPinFor,
|
|
106
|
+
formatVersionPin,
|
|
107
|
+
matchesPin,
|
|
108
|
+
sortedByName
|
|
109
|
+
} from "./index-v7yphxb8.js";
|
|
110
|
+
import {
|
|
80
111
|
withConfigLock,
|
|
112
|
+
parseConfigJson,
|
|
81
113
|
readConfigFileAt,
|
|
82
114
|
writeConfigFileAt,
|
|
115
|
+
writeFileAtomically,
|
|
116
|
+
configPathForMessage,
|
|
117
|
+
dropUnknownFrozenValues,
|
|
118
|
+
ignoredValuesWarning,
|
|
119
|
+
configLoadProblem,
|
|
120
|
+
removeCoreVersion,
|
|
121
|
+
deleteKeysRemovedOnLoad,
|
|
122
|
+
OLDER_CLIS_LOSE_PIN,
|
|
123
|
+
ignoreCachedVersions,
|
|
83
124
|
resolveConfigFilePathAsync,
|
|
125
|
+
resolveConfigWriteTargetAsync,
|
|
126
|
+
unwarnedIgnoredKeys,
|
|
127
|
+
misspelledVersionsKeysIn,
|
|
128
|
+
getConfigLoadError,
|
|
84
129
|
loadConfigAsync,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
130
|
+
reloadConfigAfterWriteAsync,
|
|
131
|
+
stripGlobalOptions,
|
|
132
|
+
isHelpOrVersionInvocation,
|
|
133
|
+
verbAndSubcommand,
|
|
134
|
+
DISABLE_VERSION_SYNC_ENV,
|
|
135
|
+
DISABLE_AUTOINSTALL_ENV,
|
|
136
|
+
DISABLE_TOOL_LINE_CHECK_ENV,
|
|
137
|
+
isTruthyEnv,
|
|
138
|
+
isAutoInstallDisabled,
|
|
139
|
+
isToolLineCheckDisabled,
|
|
140
|
+
backgroundUpdateSkipReason,
|
|
141
|
+
classifyError,
|
|
142
|
+
renderPinChange,
|
|
143
|
+
allFlag,
|
|
144
|
+
freezeFailure,
|
|
145
|
+
reportFreezeFailure,
|
|
146
|
+
FreezeFailureError,
|
|
147
|
+
freezeFailureError,
|
|
148
|
+
reportFreezeFailureError,
|
|
149
|
+
freezeRefusal
|
|
150
|
+
} from "./index-5ygg5mrs.js";
|
|
92
151
|
import {
|
|
93
152
|
storage,
|
|
94
153
|
isInsideNodeModules,
|
|
@@ -98,23 +157,58 @@ import {
|
|
|
98
157
|
importPackagerTool,
|
|
99
158
|
importToolLibraryModule,
|
|
100
159
|
resolveToolsDirs
|
|
101
|
-
} from "./index-
|
|
160
|
+
} from "./index-kdr4xvby.js";
|
|
102
161
|
import {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
162
|
+
TOOLS_DIRS_ENV_VAR,
|
|
163
|
+
getEnvToolsDirsDeclaration,
|
|
164
|
+
resolveNpmPrefixForToolsDir,
|
|
165
|
+
InstallRefusedError,
|
|
166
|
+
isBundledDistribution,
|
|
167
|
+
isRegistryTlsError,
|
|
168
|
+
TOOLS_WHITELIST,
|
|
169
|
+
COMMAND_ALIASES,
|
|
170
|
+
ALIASES_BY_COMMAND,
|
|
171
|
+
WHITELIST_BY_COMMAND,
|
|
172
|
+
isValidSemver,
|
|
173
|
+
compareSemver,
|
|
174
|
+
resolveToolPackageName,
|
|
175
|
+
toolPackageName,
|
|
176
|
+
toolShortName,
|
|
177
|
+
parsePackageSpec,
|
|
178
|
+
describeCandidateFailure,
|
|
179
|
+
classifyInstallError,
|
|
180
|
+
pickNpmFailureLine,
|
|
181
|
+
getEffectiveRegistry,
|
|
182
|
+
CLI_REPO_ROOT_PACKAGE_NAME,
|
|
183
|
+
isDevMode,
|
|
184
|
+
HostOwnedToolError,
|
|
185
|
+
truncateVersionsForDisplay,
|
|
186
|
+
toolService
|
|
187
|
+
} from "./index-xw81b1gn.js";
|
|
188
|
+
import {
|
|
189
|
+
isVersionPublished2
|
|
190
|
+
} from "./index-2f6vv7yr.js";
|
|
191
|
+
import {
|
|
192
|
+
isStudioBundle,
|
|
193
|
+
isFrozen,
|
|
194
|
+
governingPins,
|
|
195
|
+
freezeScopeOf,
|
|
196
|
+
reportUnloadedConfig,
|
|
197
|
+
refusesUnloadedConfig,
|
|
198
|
+
warnConfigNotLoaded,
|
|
199
|
+
enforceVersionsConfig,
|
|
200
|
+
PIN_INSTALL_FAILED_INSTRUCTIONS,
|
|
201
|
+
TOOL_PIN_INSTRUCTIONS,
|
|
202
|
+
nothingListed,
|
|
203
|
+
readUpdatePins,
|
|
204
|
+
readFrozenState
|
|
205
|
+
} from "./index-evcsjfyy.js";
|
|
206
|
+
import {
|
|
207
|
+
asRecord,
|
|
208
|
+
STORE_NAME,
|
|
209
|
+
readStoreSkillsVersion,
|
|
210
|
+
readInstalledSkillsVersion
|
|
211
|
+
} from "./index-jk7em40j.js";
|
|
118
212
|
import {
|
|
119
213
|
buildIssueUrl,
|
|
120
214
|
VALID_TYPES,
|
|
@@ -123,7 +217,7 @@ import {
|
|
|
123
217
|
createFeedbackIssue,
|
|
124
218
|
uploadAttachment,
|
|
125
219
|
validateAttachment
|
|
126
|
-
} from "./index-
|
|
220
|
+
} from "./index-8pk6n4t9.js";
|
|
127
221
|
import {
|
|
128
222
|
ALL_AGENTS,
|
|
129
223
|
AGENT_DISPLAY_NAMES,
|
|
@@ -135,61 +229,80 @@ import {
|
|
|
135
229
|
uninstallExtraFolders,
|
|
136
230
|
uninstallSkill,
|
|
137
231
|
rejectIfGlobalOnly
|
|
138
|
-
} from "./index-
|
|
232
|
+
} from "./index-2g332j2f.js";
|
|
139
233
|
import {
|
|
140
|
-
|
|
141
|
-
|
|
234
|
+
CONFIG_CODES,
|
|
235
|
+
homeConfigWarning,
|
|
236
|
+
configFileTelemetryProperties,
|
|
237
|
+
FileReadError,
|
|
238
|
+
readConfigFileOrReadError,
|
|
239
|
+
valueText,
|
|
240
|
+
setUpdateChannel,
|
|
241
|
+
readVersions,
|
|
242
|
+
reportConfigFileError,
|
|
243
|
+
configFileReadFailure,
|
|
244
|
+
configFilePathFailure,
|
|
245
|
+
writeBackVersions2
|
|
246
|
+
} from "./index-nyx7fh45.js";
|
|
142
247
|
import {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
ALIASES_BY_COMMAND,
|
|
152
|
-
WHITELIST_BY_COMMAND,
|
|
153
|
-
isValidSemver,
|
|
154
|
-
compareSemver,
|
|
155
|
-
resolveToolPackageName,
|
|
156
|
-
parsePackageSpec,
|
|
157
|
-
describeCandidateFailure,
|
|
158
|
-
getEffectiveRegistry,
|
|
159
|
-
isDevMode,
|
|
160
|
-
HostOwnedToolError,
|
|
161
|
-
truncateVersionsForDisplay,
|
|
162
|
-
toolService
|
|
163
|
-
} from "./index-69mcde3n.js";
|
|
248
|
+
resolveUpdateChannel,
|
|
249
|
+
resolveRuntimeChannel,
|
|
250
|
+
runtimeChannelFor,
|
|
251
|
+
isPreviewVersion
|
|
252
|
+
} from "./index-5j78gm9c.js";
|
|
253
|
+
import {
|
|
254
|
+
getSkillsSourceFailureDetails
|
|
255
|
+
} from "./index-xxms6rt8.js";
|
|
164
256
|
import {
|
|
165
257
|
getInstalledTools,
|
|
166
258
|
toolFailureRemediation,
|
|
167
|
-
|
|
259
|
+
globalInstallDirFor,
|
|
168
260
|
todayLocal,
|
|
169
261
|
readState,
|
|
170
262
|
recordToolUpdateDate,
|
|
171
|
-
mergeState
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
resolveUpdateChannel,
|
|
175
|
-
resolveRuntimeChannel,
|
|
176
|
-
isPreviewVersion
|
|
177
|
-
} from "./index-1n5v3afn.js";
|
|
263
|
+
mergeState,
|
|
264
|
+
claimFrozenEnvWarning
|
|
265
|
+
} from "./index-dt6mjnkf.js";
|
|
178
266
|
import {
|
|
179
|
-
|
|
180
|
-
} from "./index-
|
|
267
|
+
samePath
|
|
268
|
+
} from "./index-nzfpbep9.js";
|
|
181
269
|
import {
|
|
182
270
|
SkillSourceError,
|
|
183
271
|
SkillsRegistryAuthError
|
|
184
|
-
} from "./index-
|
|
272
|
+
} from "./index-ack311y7.js";
|
|
185
273
|
import {
|
|
186
274
|
package_default
|
|
187
|
-
} from "./index-
|
|
275
|
+
} from "./index-nex3q8cg.js";
|
|
188
276
|
import {
|
|
189
277
|
COPYRIGHT_NOTICE,
|
|
190
278
|
populateTelemetryAuthContext,
|
|
191
|
-
trackAuthLogout
|
|
192
|
-
|
|
279
|
+
trackAuthLogout,
|
|
280
|
+
warnIfEnvAuthOverrides
|
|
281
|
+
} from "./index-h2ctqv68.js";
|
|
282
|
+
|
|
283
|
+
// ../executor/jit-debug-contract/src/index.ts
|
|
284
|
+
var ORCHESTRATOR_PROJECT_TYPES = [
|
|
285
|
+
"Undefined",
|
|
286
|
+
"Process",
|
|
287
|
+
"ProcessLibrary",
|
|
288
|
+
"BusinessProcess",
|
|
289
|
+
"BusinessProcessLibrary",
|
|
290
|
+
"TestAutomationProcess",
|
|
291
|
+
"ProcessOrchestration",
|
|
292
|
+
"BusinessProcessOrchestration",
|
|
293
|
+
"WebApp",
|
|
294
|
+
"BusinessWebApp",
|
|
295
|
+
"Agent",
|
|
296
|
+
"BusinessAgent",
|
|
297
|
+
"Api",
|
|
298
|
+
"MCPServer",
|
|
299
|
+
"BusinessRules",
|
|
300
|
+
"CaseManagement",
|
|
301
|
+
"Flow",
|
|
302
|
+
"Function",
|
|
303
|
+
"FlowAutomate"
|
|
304
|
+
];
|
|
305
|
+
var READABLE_PROJECT_TYPES = new Set(ORCHESTRATOR_PROJECT_TYPES.map((type) => type.toLowerCase()));
|
|
193
306
|
// ../executor/project-executor/src/services/executor-tool-module.ts
|
|
194
307
|
var EXECUTOR_FACTORY_EXPORT = "createExecutorFactory";
|
|
195
308
|
function isExecutorFactoryModule(module) {
|
|
@@ -256,231 +369,14 @@ function registerExecutorFactoryFromModule(module, source) {
|
|
|
256
369
|
// src/services/project-context-telemetry.ts
|
|
257
370
|
function configureHostProjectContextTelemetry(program) {
|
|
258
371
|
configureProjectContextTelemetry(program, async (projectDirectory) => {
|
|
259
|
-
const { readProjectSolutionContext } = await import("./project-context-
|
|
372
|
+
const { readProjectSolutionContext } = await import("./project-context-rc4ghykm.js");
|
|
260
373
|
return readProjectSolutionContext(projectDirectory);
|
|
261
374
|
});
|
|
262
375
|
}
|
|
263
376
|
|
|
264
|
-
// src/utils/globalOptions.ts
|
|
265
|
-
var VALID_LOG_LEVELS = {
|
|
266
|
-
debug: 0,
|
|
267
|
-
info: 1,
|
|
268
|
-
warn: 2,
|
|
269
|
-
error: 3
|
|
270
|
-
};
|
|
271
|
-
var NOT_CONSUMED = { consumed: false, advance: 0 };
|
|
272
|
-
function tryParseOutputFilter(state, args, i) {
|
|
273
|
-
if (args[i] === "--output-filter" && i + 1 < args.length) {
|
|
274
|
-
state.filter = args[i + 1];
|
|
275
|
-
return { consumed: true, advance: 1 };
|
|
276
|
-
}
|
|
277
|
-
if (args[i]?.startsWith("--output-filter=")) {
|
|
278
|
-
state.filter = args[i].substring("--output-filter=".length);
|
|
279
|
-
return { consumed: true, advance: 0 };
|
|
280
|
-
}
|
|
281
|
-
return NOT_CONSUMED;
|
|
282
|
-
}
|
|
283
|
-
function tryParseJson(state, args, i) {
|
|
284
|
-
if (args[i] !== "--json") {
|
|
285
|
-
return NOT_CONSUMED;
|
|
286
|
-
}
|
|
287
|
-
state.sawJsonAlias = true;
|
|
288
|
-
state.format = "json";
|
|
289
|
-
state.formatWasExplicit = true;
|
|
290
|
-
if (state.sawOutputOption) {
|
|
291
|
-
state.outputConflict = true;
|
|
292
|
-
}
|
|
293
|
-
return { consumed: true, advance: 0 };
|
|
294
|
-
}
|
|
295
|
-
function applyOutputValue(state, value) {
|
|
296
|
-
if (!state.sawJsonAlias) {
|
|
297
|
-
state.format = value;
|
|
298
|
-
}
|
|
299
|
-
state.formatWasExplicit = true;
|
|
300
|
-
}
|
|
301
|
-
function tryParseOutputSpace(state, args, i) {
|
|
302
|
-
if (args[i] !== "--output") {
|
|
303
|
-
return NOT_CONSUMED;
|
|
304
|
-
}
|
|
305
|
-
const v = args[i + 1];
|
|
306
|
-
if (v === undefined || !isOutputFormat(v)) {
|
|
307
|
-
return NOT_CONSUMED;
|
|
308
|
-
}
|
|
309
|
-
noteOutputFormatOption(state);
|
|
310
|
-
applyOutputValue(state, v);
|
|
311
|
-
return { consumed: true, advance: 1 };
|
|
312
|
-
}
|
|
313
|
-
function tryParseOutputEquals(state, args, i) {
|
|
314
|
-
if (!args[i]?.startsWith("--output=")) {
|
|
315
|
-
return NOT_CONSUMED;
|
|
316
|
-
}
|
|
317
|
-
const v = args[i].substring("--output=".length);
|
|
318
|
-
if (!isOutputFormat(v)) {
|
|
319
|
-
return NOT_CONSUMED;
|
|
320
|
-
}
|
|
321
|
-
noteOutputFormatOption(state);
|
|
322
|
-
applyOutputValue(state, v);
|
|
323
|
-
return { consumed: true, advance: 0 };
|
|
324
|
-
}
|
|
325
|
-
function noteOutputFormatOption(state) {
|
|
326
|
-
state.sawOutputOption = true;
|
|
327
|
-
if (state.sawJsonAlias) {
|
|
328
|
-
state.outputConflict = true;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
function tryParseLogLevel(state, args, i) {
|
|
332
|
-
if (args[i] === "--log-level" && i + 1 < args.length) {
|
|
333
|
-
const parsed = VALID_LOG_LEVELS[args[i + 1].toLowerCase()];
|
|
334
|
-
if (parsed !== undefined) {
|
|
335
|
-
state.logLevel = parsed;
|
|
336
|
-
}
|
|
337
|
-
return { consumed: true, advance: 1 };
|
|
338
|
-
}
|
|
339
|
-
if (args[i]?.startsWith("--log-level=")) {
|
|
340
|
-
const parsed = VALID_LOG_LEVELS[args[i].substring("--log-level=".length).toLowerCase()];
|
|
341
|
-
if (parsed !== undefined) {
|
|
342
|
-
state.logLevel = parsed;
|
|
343
|
-
}
|
|
344
|
-
return { consumed: true, advance: 0 };
|
|
345
|
-
}
|
|
346
|
-
return NOT_CONSUMED;
|
|
347
|
-
}
|
|
348
|
-
function tryParseLogFile(state, args, i) {
|
|
349
|
-
if (args[i] === "--log-file" && i + 1 < args.length) {
|
|
350
|
-
state.logFile = args[i + 1];
|
|
351
|
-
return { consumed: true, advance: 1 };
|
|
352
|
-
}
|
|
353
|
-
if (args[i]?.startsWith("--log-file=")) {
|
|
354
|
-
state.logFile = args[i].substring("--log-file=".length);
|
|
355
|
-
return { consumed: true, advance: 0 };
|
|
356
|
-
}
|
|
357
|
-
return NOT_CONSUMED;
|
|
358
|
-
}
|
|
359
|
-
function applyProfileValue(state, value, source = 0 /* Flag */) {
|
|
360
|
-
let normalized;
|
|
361
|
-
try {
|
|
362
|
-
normalized = normalizeAuthProfileName2(value);
|
|
363
|
-
} catch (error) {
|
|
364
|
-
if (!(error instanceof AuthProfileValidationError2)) {
|
|
365
|
-
throw error;
|
|
366
|
-
}
|
|
367
|
-
state.profile = undefined;
|
|
368
|
-
state.profileError ??= source === 1 /* Env */ ? `${INHERITED_AUTH_PROFILE_ENV2}: ${error.message}` : error.message;
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
if (state.profileError !== undefined) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
state.profile = normalized;
|
|
375
|
-
}
|
|
376
|
-
function tryParseProfile(state, args, i) {
|
|
377
|
-
if (args[i] === "--profile") {
|
|
378
|
-
state.sawProfileOption = true;
|
|
379
|
-
if (i + 1 >= args.length) {
|
|
380
|
-
state.profile = undefined;
|
|
381
|
-
state.profileError ??= "error: option '--profile <name>' argument missing";
|
|
382
|
-
return { consumed: true, advance: 0 };
|
|
383
|
-
}
|
|
384
|
-
applyProfileValue(state, args[i + 1]);
|
|
385
|
-
return { consumed: true, advance: 1 };
|
|
386
|
-
}
|
|
387
|
-
if (args[i]?.startsWith("--profile=")) {
|
|
388
|
-
state.sawProfileOption = true;
|
|
389
|
-
applyProfileValue(state, args[i].substring("--profile=".length));
|
|
390
|
-
return { consumed: true, advance: 0 };
|
|
391
|
-
}
|
|
392
|
-
return NOT_CONSUMED;
|
|
393
|
-
}
|
|
394
|
-
function tryParseInteractive(state, args, i) {
|
|
395
|
-
if (args[i] === "--interactive") {
|
|
396
|
-
state.interactive = "always";
|
|
397
|
-
return { consumed: true, advance: 0 };
|
|
398
|
-
}
|
|
399
|
-
if (args[i] === "--no-interactive") {
|
|
400
|
-
state.interactive = "never";
|
|
401
|
-
return { consumed: true, advance: 0 };
|
|
402
|
-
}
|
|
403
|
-
return NOT_CONSUMED;
|
|
404
|
-
}
|
|
405
|
-
var MATCHERS = [
|
|
406
|
-
tryParseOutputFilter,
|
|
407
|
-
tryParseJson,
|
|
408
|
-
tryParseOutputSpace,
|
|
409
|
-
tryParseOutputEquals,
|
|
410
|
-
tryParseLogLevel,
|
|
411
|
-
tryParseLogFile,
|
|
412
|
-
tryParseProfile,
|
|
413
|
-
tryParseInteractive
|
|
414
|
-
];
|
|
415
|
-
function stripGlobalOptions(args) {
|
|
416
|
-
const state = {
|
|
417
|
-
cleaned: [],
|
|
418
|
-
format: undefined,
|
|
419
|
-
formatWasExplicit: false,
|
|
420
|
-
sawJsonAlias: false,
|
|
421
|
-
sawOutputOption: false,
|
|
422
|
-
outputConflict: false,
|
|
423
|
-
filter: undefined,
|
|
424
|
-
logLevel: undefined,
|
|
425
|
-
logFile: undefined,
|
|
426
|
-
sawProfileOption: false,
|
|
427
|
-
profile: undefined,
|
|
428
|
-
profileError: undefined,
|
|
429
|
-
interactive: undefined
|
|
430
|
-
};
|
|
431
|
-
for (let i = 0;i < args.length; i++) {
|
|
432
|
-
let matched = false;
|
|
433
|
-
for (const matcher of MATCHERS) {
|
|
434
|
-
const result = matcher(state, args, i);
|
|
435
|
-
if (result.consumed) {
|
|
436
|
-
i += result.advance;
|
|
437
|
-
matched = true;
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
if (!matched) {
|
|
442
|
-
state.cleaned.push(args[i]);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
const envProfile = process.env?.[INHERITED_AUTH_PROFILE_ENV2];
|
|
446
|
-
if (!state.sawProfileOption && envProfile) {
|
|
447
|
-
applyProfileValue(state, envProfile, 1 /* Env */);
|
|
448
|
-
}
|
|
449
|
-
const envDefault = process.env?.UIP_DEFAULT_OUTPUT;
|
|
450
|
-
const resolvedFormat = state.format ?? (envDefault && isOutputFormat(envDefault) ? envDefault : "json");
|
|
451
|
-
return {
|
|
452
|
-
args: state.cleaned,
|
|
453
|
-
format: resolvedFormat,
|
|
454
|
-
formatWasExplicit: state.formatWasExplicit,
|
|
455
|
-
outputConflict: state.outputConflict,
|
|
456
|
-
filter: state.filter,
|
|
457
|
-
logLevel: state.logLevel,
|
|
458
|
-
logFile: state.logFile,
|
|
459
|
-
profile: state.profile,
|
|
460
|
-
profileError: state.profileError,
|
|
461
|
-
interactive: state.interactive
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
var HELP_FLAGS = new Set(["-h", "--help"]);
|
|
465
|
-
var VERSION_FLAGS = new Set(["-v", "--version"]);
|
|
466
|
-
function isHelpOrVersionInvocation(args) {
|
|
467
|
-
let sawVerb = false;
|
|
468
|
-
for (const token of stripGlobalOptions(args.slice(2)).args) {
|
|
469
|
-
if (token === "--")
|
|
470
|
-
return false;
|
|
471
|
-
if (HELP_FLAGS.has(token))
|
|
472
|
-
return true;
|
|
473
|
-
if (!sawVerb && VERSION_FLAGS.has(token))
|
|
474
|
-
return true;
|
|
475
|
-
if (!token.startsWith("-"))
|
|
476
|
-
sawVerb = true;
|
|
477
|
-
}
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
377
|
// src/utils/helpFormatter.ts
|
|
482
378
|
var OUTPUT_FLAG = `--output <${OUTPUT_FORMATS.join("|")}>`;
|
|
483
|
-
var
|
|
379
|
+
var OUTPUT_OPTIONS = [
|
|
484
380
|
{
|
|
485
381
|
Flags: OUTPUT_FLAG,
|
|
486
382
|
Description: "Output format (default: json)"
|
|
@@ -488,7 +384,10 @@ var GLOBAL_OPTIONS = [
|
|
|
488
384
|
{
|
|
489
385
|
Flags: "--output-filter <expression>",
|
|
490
386
|
Description: "JMESPath expression applied to the Data field of the response envelope"
|
|
491
|
-
}
|
|
387
|
+
}
|
|
388
|
+
];
|
|
389
|
+
var GLOBAL_OPTIONS = [
|
|
390
|
+
...OUTPUT_OPTIONS,
|
|
492
391
|
{
|
|
493
392
|
Flags: "--log-level <debug|info|warn|error>",
|
|
494
393
|
Description: "Log level threshold (default: warn)"
|
|
@@ -502,6 +401,12 @@ var GLOBAL_OPTIONS = [
|
|
|
502
401
|
Description: "Use a named login profile"
|
|
503
402
|
}
|
|
504
403
|
];
|
|
404
|
+
function globalOptionsFor(cmd) {
|
|
405
|
+
if (!isOutputRelayed(cmd)) {
|
|
406
|
+
return GLOBAL_OPTIONS;
|
|
407
|
+
}
|
|
408
|
+
return GLOBAL_OPTIONS.filter((option) => !OUTPUT_OPTIONS.includes(option));
|
|
409
|
+
}
|
|
505
410
|
var BUILT_IN_ROOT_COMMANDS = [
|
|
506
411
|
"login",
|
|
507
412
|
"logout",
|
|
@@ -529,11 +434,11 @@ var GETTING_STARTED_ROWS = [
|
|
|
529
434
|
var ENVIRONMENT_ROWS = [
|
|
530
435
|
{
|
|
531
436
|
Label: "UIPATH_CLI_DISABLE_VERSION_SYNC=1",
|
|
532
|
-
Description: "Skip the daily CLI and tool update check"
|
|
437
|
+
Description: "Skip the daily CLI and tool update check (ignored when the config is frozen)"
|
|
533
438
|
},
|
|
534
439
|
{
|
|
535
440
|
Label: "UIPATH_CLI_DISABLE_AUTOINSTALL=1",
|
|
536
|
-
Description: "Do not install a missing tool on first use"
|
|
441
|
+
Description: "Do not install a missing tool on first use, even one the config pins"
|
|
537
442
|
},
|
|
538
443
|
{
|
|
539
444
|
Label: "HTTPS_PROXY, NO_PROXY",
|
|
@@ -861,7 +766,7 @@ function buildTableHelpSections(cmd, helper, isBrowser) {
|
|
|
861
766
|
Label: option.Flags,
|
|
862
767
|
Description: option.Description || "No description"
|
|
863
768
|
})),
|
|
864
|
-
...
|
|
769
|
+
...globalOptionsFor(cmd).map((option) => ({
|
|
865
770
|
Label: option.Flags,
|
|
866
771
|
Description: option.Description
|
|
867
772
|
}))
|
|
@@ -952,7 +857,7 @@ function createHelpConfiguration(isBrowser) {
|
|
|
952
857
|
const helpData = {
|
|
953
858
|
...baseHelp,
|
|
954
859
|
Subcommands: subcommands,
|
|
955
|
-
GlobalOptions:
|
|
860
|
+
GlobalOptions: globalOptionsFor(cmd)
|
|
956
861
|
};
|
|
957
862
|
if (isRootCommand(cmd)) {
|
|
958
863
|
helpData.GettingStarted = GETTING_STARTED_ROWS;
|
|
@@ -986,6 +891,14 @@ var FLAG_HINTS = {
|
|
|
986
891
|
version: "--version",
|
|
987
892
|
v: "--version"
|
|
988
893
|
};
|
|
894
|
+
var OPTION_HINTS = {
|
|
895
|
+
"--top": "--limit",
|
|
896
|
+
"--take": "--limit"
|
|
897
|
+
};
|
|
898
|
+
var UNKNOWN_OPTION_CODE = "commander.unknownOption";
|
|
899
|
+
var SUGGESTION_PATTERN = /\s*\(Did you mean [^)]*\)\??/;
|
|
900
|
+
var UNKNOWN_OPTION_PATTERN = /unknown option '(--[^\n]*)'/;
|
|
901
|
+
var JOINED_ARGUMENTS_PATTERN = /\s/;
|
|
989
902
|
function commandPartsFromArgs(cleanedArgs) {
|
|
990
903
|
const userArgs = cleanedArgs.slice(2);
|
|
991
904
|
for (let i = 0;i < userArgs.length; i++) {
|
|
@@ -1012,13 +925,53 @@ function commandInvocationPathFromArgs(cleanedArgs) {
|
|
|
1012
925
|
function helpInstructions(commandPath) {
|
|
1013
926
|
return `Run '${commandPath} --help' for usage information.`;
|
|
1014
927
|
}
|
|
1015
|
-
function instructionsForUnknownCommand(cleanedArgs) {
|
|
928
|
+
function instructionsForUnknownCommand(cleanedArgs, helpCommandPath) {
|
|
929
|
+
if (helpCommandPath !== CLI_COMMAND_ROOT) {
|
|
930
|
+
return `Run '${helpCommandPath} --help' for available subcommands.`;
|
|
931
|
+
}
|
|
1016
932
|
const firstUserToken = cleanedArgs.slice(2).find((a) => !a.startsWith("-"));
|
|
1017
933
|
const flagHint = firstUserToken && FLAG_HINTS[firstUserToken];
|
|
1018
934
|
if (flagHint) {
|
|
1019
935
|
return `Did you mean \`${flagHint}\`? Use --help for usage information.`;
|
|
1020
936
|
}
|
|
1021
|
-
return
|
|
937
|
+
return `Run '${CLI_COMMAND_ROOT} --help' to list available commands.`;
|
|
938
|
+
}
|
|
939
|
+
function pagingReplacement(flag, commandFlags) {
|
|
940
|
+
const replacement = flag && OPTION_HINTS[flag];
|
|
941
|
+
if (!replacement || !commandFlags.includes(replacement)) {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
return replacement;
|
|
945
|
+
}
|
|
946
|
+
function describeUnknownOption(message, argument, commandFlags, helpCommandPath) {
|
|
947
|
+
const bareMessage = message.replace(SUGGESTION_PATTERN, "");
|
|
948
|
+
if (argument !== undefined && JOINED_ARGUMENTS_PATTERN.test(argument)) {
|
|
949
|
+
return {
|
|
950
|
+
message: `${bareMessage}. Several options arrived as one argument.`,
|
|
951
|
+
instructions: "Pass each option and its value as a separate argument. " + "If they come from a shell variable, check its quoting: a " + "quoted variable, or any variable in zsh, is not split into " + `words. ${helpInstructions(helpCommandPath)}`
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
const flag = argument?.split("=", 1)[0];
|
|
955
|
+
const replacement = pagingReplacement(flag, commandFlags);
|
|
956
|
+
if (!replacement) {
|
|
957
|
+
return { message, instructions: helpInstructions(helpCommandPath) };
|
|
958
|
+
}
|
|
959
|
+
return {
|
|
960
|
+
message: bareMessage,
|
|
961
|
+
instructions: `Did you mean \`${replacement} <number>\`? ${flag} is not supported: ` + `${replacement} caps the rows the command returns. ` + `Run '${helpCommandPath} --help' for usage information.`
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
function describeParseError(code, message, cleanedArgs, helpCommandPath, commandFlags) {
|
|
965
|
+
if (code === UNKNOWN_OPTION_CODE) {
|
|
966
|
+
return describeUnknownOption(message, UNKNOWN_OPTION_PATTERN.exec(message)?.[1], commandFlags, helpCommandPath);
|
|
967
|
+
}
|
|
968
|
+
if (code === "commander.unknownCommand") {
|
|
969
|
+
return {
|
|
970
|
+
message,
|
|
971
|
+
instructions: instructionsForUnknownCommand(cleanedArgs, helpCommandPath)
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
return { message, instructions: helpInstructions(helpCommandPath) };
|
|
1022
975
|
}
|
|
1023
976
|
function isDisplayOnly(code, message) {
|
|
1024
977
|
return code === "commander.helpDisplayed" || code === "commander.version" || message === "(outputHelp)";
|
|
@@ -1039,7 +992,7 @@ function trackCommandFailure(error, eventName, commandPath, exitCode, context) {
|
|
|
1039
992
|
})
|
|
1040
993
|
});
|
|
1041
994
|
}
|
|
1042
|
-
async function handleParseError(error, cleanedArgs, context,
|
|
995
|
+
async function handleParseError(error, cleanedArgs, context, commandOptions) {
|
|
1043
996
|
const isObj = error !== null && typeof error === "object";
|
|
1044
997
|
const e = isObj ? error : {};
|
|
1045
998
|
const code = typeof e.code === "string" ? e.code : undefined;
|
|
@@ -1051,21 +1004,21 @@ async function handleParseError(error, cleanedArgs, context, telemetryOptions) {
|
|
|
1051
1004
|
context.exit(exitCode ?? 0);
|
|
1052
1005
|
return;
|
|
1053
1006
|
}
|
|
1054
|
-
const
|
|
1007
|
+
const described = describeParseError(code, message, cleanedArgs, commandOptions.helpCommandPath, commandOptions.commandFlags ?? []);
|
|
1055
1008
|
OutputFormatter.error({
|
|
1056
1009
|
Result: RESULTS.ValidationError,
|
|
1057
1010
|
ErrorCode: "invalid_argument",
|
|
1058
|
-
Message: message,
|
|
1059
|
-
Instructions: instructions,
|
|
1011
|
+
Message: described.message,
|
|
1012
|
+
Instructions: described.instructions,
|
|
1060
1013
|
Retry: "RetryWillNotFix"
|
|
1061
1014
|
});
|
|
1062
1015
|
const finalExitCode = currentExitCode();
|
|
1063
|
-
trackCommandFailure(error,
|
|
1016
|
+
trackCommandFailure(error, commandOptions.eventName, commandOptions.commandPath, finalExitCode, context);
|
|
1064
1017
|
await telemetryFlushAndShutdown();
|
|
1065
1018
|
context.exit(finalExitCode);
|
|
1066
1019
|
return;
|
|
1067
1020
|
}
|
|
1068
|
-
trackCommandFailure(error,
|
|
1021
|
+
trackCommandFailure(error, commandOptions.eventName, commandOptions.commandPath, currentExitCode(), context);
|
|
1069
1022
|
await telemetryFlushAndShutdown();
|
|
1070
1023
|
context.exit(currentExitCode());
|
|
1071
1024
|
}
|
|
@@ -1094,7 +1047,7 @@ function findUnknownHelpCommand(root, positionals, allArgs) {
|
|
|
1094
1047
|
}
|
|
1095
1048
|
|
|
1096
1049
|
// cli.core.ts
|
|
1097
|
-
var
|
|
1050
|
+
var HELP_FLAGS = new Set(["-h", "--help"]);
|
|
1098
1051
|
var HELP_COMMAND_TOKEN = "help";
|
|
1099
1052
|
var NO_APPLICATION_START = new Set([
|
|
1100
1053
|
"uip track",
|
|
@@ -1106,8 +1059,8 @@ function findSubcommand(command, token) {
|
|
|
1106
1059
|
function optionValueTokens(userArgs, index) {
|
|
1107
1060
|
return !userArgs[index].includes("=") && index + 1 < userArgs.length && !userArgs[index + 1].startsWith("-") ? 1 : 0;
|
|
1108
1061
|
}
|
|
1109
|
-
function
|
|
1110
|
-
const
|
|
1062
|
+
function resolveCommandPath(program, cleanedArgs) {
|
|
1063
|
+
const matched = [];
|
|
1111
1064
|
let current = program;
|
|
1112
1065
|
const userArgs = cleanedArgs.slice(2);
|
|
1113
1066
|
for (let i = 0;i < userArgs.length; i++) {
|
|
@@ -1121,19 +1074,25 @@ function commandPartsFromProgram(program, cleanedArgs) {
|
|
|
1121
1074
|
}
|
|
1122
1075
|
const subcommand = findSubcommand(current, token);
|
|
1123
1076
|
if (subcommand) {
|
|
1124
|
-
|
|
1077
|
+
matched.push(subcommand.name());
|
|
1125
1078
|
current = subcommand;
|
|
1126
1079
|
continue;
|
|
1127
1080
|
}
|
|
1128
1081
|
if (token === HELP_COMMAND_TOKEN) {
|
|
1129
1082
|
continue;
|
|
1130
1083
|
}
|
|
1131
|
-
|
|
1132
|
-
parts.push(token);
|
|
1133
|
-
}
|
|
1134
|
-
break;
|
|
1084
|
+
return { matched, unmatched: token, command: current };
|
|
1135
1085
|
}
|
|
1136
|
-
return
|
|
1086
|
+
return { matched, command: current };
|
|
1087
|
+
}
|
|
1088
|
+
function telemetryCommandParts({
|
|
1089
|
+
matched,
|
|
1090
|
+
unmatched
|
|
1091
|
+
}) {
|
|
1092
|
+
return matched.length === 0 && unmatched !== undefined ? [unmatched] : matched;
|
|
1093
|
+
}
|
|
1094
|
+
function commandPartsFromProgram(program, cleanedArgs) {
|
|
1095
|
+
return telemetryCommandParts(resolveCommandPath(program, cleanedArgs));
|
|
1137
1096
|
}
|
|
1138
1097
|
function trackRecordedCommandFailure(commandParts, exitCode, context, error) {
|
|
1139
1098
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
@@ -1181,6 +1140,7 @@ function getCliVersionPrefix() {
|
|
|
1181
1140
|
}
|
|
1182
1141
|
function validateAndSetOutputFilter(filter, context) {
|
|
1183
1142
|
if (filter === undefined) {
|
|
1143
|
+
setOutputFilter(undefined);
|
|
1184
1144
|
return true;
|
|
1185
1145
|
}
|
|
1186
1146
|
const filterError = validateOutputFilter(filter);
|
|
@@ -1211,6 +1171,7 @@ async function initProgram(context, hooks = {}) {
|
|
|
1211
1171
|
logLevel,
|
|
1212
1172
|
logFile,
|
|
1213
1173
|
profile,
|
|
1174
|
+
profileWasExplicit,
|
|
1214
1175
|
profileError,
|
|
1215
1176
|
interactive
|
|
1216
1177
|
} = globalOptions;
|
|
@@ -1235,13 +1196,33 @@ async function initProgram(context, hooks = {}) {
|
|
|
1235
1196
|
yaml: effectiveFormat === "yaml",
|
|
1236
1197
|
filter: filter !== undefined
|
|
1237
1198
|
});
|
|
1238
|
-
setHelpRequested(!formatWasExplicit && cleanedArgs.some((arg) =>
|
|
1199
|
+
setHelpRequested(!formatWasExplicit && cleanedArgs.some((arg) => HELP_FLAGS.has(arg)));
|
|
1239
1200
|
configureLogger({
|
|
1240
1201
|
...effectiveLogLevel !== undefined && { level: effectiveLogLevel }
|
|
1241
1202
|
});
|
|
1242
1203
|
if (overrides.onLoggerReady) {
|
|
1243
1204
|
overrides.onLoggerReady();
|
|
1244
1205
|
}
|
|
1206
|
+
const agent = detectAgent();
|
|
1207
|
+
const defaultTelemetryProperties = {
|
|
1208
|
+
[BaseDimensions.ApplicationName]: CLI_APPLICATION_NAME,
|
|
1209
|
+
[BaseDimensions.ProductVersion]: package_default.version
|
|
1210
|
+
};
|
|
1211
|
+
if (agent !== undefined) {
|
|
1212
|
+
defaultTelemetryProperties[BaseDimensions.Agent] = agent;
|
|
1213
|
+
const agentVersion = detectAgentVersion();
|
|
1214
|
+
if (agentVersion !== undefined) {
|
|
1215
|
+
defaultTelemetryProperties[BaseDimensions.AgentVersion] = agentVersion;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
if (context.capabilities.isBrowser) {
|
|
1219
|
+
await telemetryInit({
|
|
1220
|
+
version: package_default.version,
|
|
1221
|
+
defaultProperties: defaultTelemetryProperties,
|
|
1222
|
+
appInsights: false,
|
|
1223
|
+
browserAppInsights: context.sendTelemetry
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1245
1226
|
if (outputConflict) {
|
|
1246
1227
|
OutputFormatter.error({
|
|
1247
1228
|
Result: RESULTS.ValidationError,
|
|
@@ -1285,22 +1266,11 @@ async function initProgram(context, hooks = {}) {
|
|
|
1285
1266
|
logger.debug("Storage initialized");
|
|
1286
1267
|
}
|
|
1287
1268
|
})();
|
|
1288
|
-
const agent = detectAgent();
|
|
1289
|
-
const defaultTelemetryProperties = {
|
|
1290
|
-
[BaseDimensions.ApplicationName]: CLI_APPLICATION_NAME,
|
|
1291
|
-
[BaseDimensions.ProductVersion]: package_default.version
|
|
1292
|
-
};
|
|
1293
|
-
if (agent !== undefined) {
|
|
1294
|
-
defaultTelemetryProperties[BaseDimensions.Agent] = agent;
|
|
1295
|
-
const agentVersion = detectAgentVersion();
|
|
1296
|
-
if (agentVersion !== undefined) {
|
|
1297
|
-
defaultTelemetryProperties[BaseDimensions.AgentVersion] = agentVersion;
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
1269
|
const telemetryPromise = isHelpOrVersionInvocation(cleanedArgs) ? Promise.resolve() : telemetryInit({
|
|
1301
1270
|
version: package_default.version,
|
|
1302
1271
|
defaultProperties: defaultTelemetryProperties,
|
|
1303
|
-
appInsights: !context.capabilities.isBrowser
|
|
1272
|
+
appInsights: !context.capabilities.isBrowser,
|
|
1273
|
+
browserAppInsights: context.sendTelemetry
|
|
1304
1274
|
}).then(() => logger.debug("Telemetry initialized")).then(async () => {
|
|
1305
1275
|
if (hooks.afterTelemetryInit) {
|
|
1306
1276
|
await hooks.afterTelemetryInit();
|
|
@@ -1311,7 +1281,8 @@ async function initProgram(context, hooks = {}) {
|
|
|
1311
1281
|
program,
|
|
1312
1282
|
cleanedArgs,
|
|
1313
1283
|
formatWasExplicit,
|
|
1314
|
-
logLevelWasExplicit: logLevel !== undefined
|
|
1284
|
+
logLevelWasExplicit: logLevel !== undefined,
|
|
1285
|
+
profileWasExplicit
|
|
1315
1286
|
};
|
|
1316
1287
|
}
|
|
1317
1288
|
function finalizeProgram(args) {
|
|
@@ -1348,10 +1319,13 @@ async function parseAndExit(program, cleanedArgs, context) {
|
|
|
1348
1319
|
const [parseError] = await catchError(program.parseAsync(cleanedArgs));
|
|
1349
1320
|
nameTimingCommand();
|
|
1350
1321
|
if (parseError) {
|
|
1351
|
-
const
|
|
1322
|
+
const resolved = resolveCommandPath(program, cleanedArgs);
|
|
1323
|
+
const commandParts = telemetryCommandParts(resolved);
|
|
1352
1324
|
await handleParseError(parseError, cleanedArgs, context, {
|
|
1353
1325
|
eventName: commandTelemetryName(commandParts),
|
|
1354
|
-
commandPath: commandInvocationPath(commandParts)
|
|
1326
|
+
commandPath: commandInvocationPath(commandParts),
|
|
1327
|
+
helpCommandPath: [CLI_COMMAND_ROOT, ...resolved.matched].join(" "),
|
|
1328
|
+
commandFlags: resolved.command.options.map((o) => o.long ?? "")
|
|
1355
1329
|
});
|
|
1356
1330
|
} else {
|
|
1357
1331
|
const exitCode = getExitCode();
|
|
@@ -1368,7 +1342,7 @@ async function parseAndExit(program, cleanedArgs, context) {
|
|
|
1368
1342
|
|
|
1369
1343
|
// src/commands/completion.ts
|
|
1370
1344
|
async function handleUninstall(shell, program, context, fs) {
|
|
1371
|
-
const { doUninstall, resolveUninstallTarget } = await import("./install-
|
|
1345
|
+
const { doUninstall, resolveUninstallTarget } = await import("./install-h76qyy1e.js");
|
|
1372
1346
|
const target = resolveUninstallTarget(shell, program.name(), fs);
|
|
1373
1347
|
const [err, action] = await catchError(doUninstall(target, fs));
|
|
1374
1348
|
if (err) {
|
|
@@ -1409,7 +1383,7 @@ function handlePrint(target) {
|
|
|
1409
1383
|
}
|
|
1410
1384
|
async function handleInteractiveInstall(target, context, fs) {
|
|
1411
1385
|
const { confirm } = await import("./index-1vyte4ma.js");
|
|
1412
|
-
const { doInstall } = await import("./install-
|
|
1386
|
+
const { doInstall } = await import("./install-h76qyy1e.js");
|
|
1413
1387
|
const [promptErr, ok] = await catchError(confirm({
|
|
1414
1388
|
message: `Install ${target.shell} completion to ${target.rcPath}?`,
|
|
1415
1389
|
default: true
|
|
@@ -1454,58 +1428,850 @@ async function handleInteractiveInstall(target, context, fs) {
|
|
|
1454
1428
|
target.shell === "zsh" ? "Dynamic flag-value completion (e.g. --package-name <TAB>) requires `jq` on PATH; without it, those candidates are suppressed." : "Dynamic flag-value completion is currently zsh-only; static subcommand and option-name completion works on all four shells."
|
|
1455
1429
|
]
|
|
1456
1430
|
}
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
function registerCompletionCommand(program, discovered, context) {
|
|
1460
|
-
program.command("completion").description(`Install or output the shell completion script. Interactive in a TTY; with an explicit shell argument, dumps the script to stdout. Dynamic flag-value completion (e.g. --package-name <TAB>) is zsh-only and requires \`jq\` on PATH; static subcommand/option-name completion works on bash, zsh, fish, and pwsh.`).argument("[shell]", "Shell type: bash, zsh, fish, pwsh (alias: powershell). Auto-detected from $SHELL, $PSModulePath, and platform when omitted.").option("--print", "Print the target rc file path and the block that would be written, without touching the filesystem").option("--uninstall", "Remove the managed completion block (or fish completion file) instead of installing").trackedAction(context, async (shellArg, opts) => {
|
|
1461
|
-
const { normalizeShell, resolveTarget } = await import("./install-
|
|
1462
|
-
const { buildFullTree, detectShell } = await import("./tree-
|
|
1463
|
-
const rawShell = shellArg ?? detectShell();
|
|
1464
|
-
const shell = normalizeShell(rawShell);
|
|
1465
|
-
if (!shell) {
|
|
1466
|
-
OutputFormatter.error({
|
|
1467
|
-
Result: RESULTS.Failure,
|
|
1468
|
-
Message: `Unsupported shell: ${rawShell}`,
|
|
1469
|
-
Instructions: "Use bash, zsh, fish, or pwsh."
|
|
1470
|
-
});
|
|
1471
|
-
context.exit(1);
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
function registerCompletionCommand(program, discovered, context) {
|
|
1434
|
+
program.command("completion").description(`Install or output the shell completion script. Interactive in a TTY; with an explicit shell argument, dumps the script to stdout. Dynamic flag-value completion (e.g. --package-name <TAB>) is zsh-only and requires \`jq\` on PATH; static subcommand/option-name completion works on bash, zsh, fish, and pwsh.`).argument("[shell]", "Shell type: bash, zsh, fish, pwsh (alias: powershell). Auto-detected from $SHELL, $PSModulePath, and platform when omitted.").option("--print", "Print the target rc file path and the block that would be written, without touching the filesystem").option("--uninstall", "Remove the managed completion block (or fish completion file) instead of installing").trackedAction(context, async (shellArg, opts) => {
|
|
1435
|
+
const { normalizeShell, resolveTarget } = await import("./install-h76qyy1e.js");
|
|
1436
|
+
const { buildFullTree, detectShell } = await import("./tree-fk9gwh4v.js");
|
|
1437
|
+
const rawShell = shellArg ?? detectShell();
|
|
1438
|
+
const shell = normalizeShell(rawShell);
|
|
1439
|
+
if (!shell) {
|
|
1440
|
+
OutputFormatter.error({
|
|
1441
|
+
Result: RESULTS.Failure,
|
|
1442
|
+
Message: `Unsupported shell: ${rawShell}`,
|
|
1443
|
+
Instructions: "Use bash, zsh, fish, or pwsh."
|
|
1444
|
+
});
|
|
1445
|
+
context.exit(1);
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
const fs = await getFileSystemAsync2();
|
|
1449
|
+
if (opts.uninstall) {
|
|
1450
|
+
return handleUninstall(shell, program, context, fs);
|
|
1451
|
+
}
|
|
1452
|
+
const [buildError, root] = await catchError(buildFullTree(program, discovered));
|
|
1453
|
+
if (buildError || !root) {
|
|
1454
|
+
OutputFormatter.error({
|
|
1455
|
+
Result: RESULTS.Failure,
|
|
1456
|
+
Message: buildError?.message ?? "Failed to build command tree",
|
|
1457
|
+
Instructions: "Try re-running the command. If the problem persists, report it at https://github.com/UiPath/cli/issues"
|
|
1458
|
+
});
|
|
1459
|
+
context.exit(1);
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
const [renderErr, target] = await catchError(Promise.resolve().then(() => resolveTarget(shell, root, fs)));
|
|
1463
|
+
if (renderErr || !target) {
|
|
1464
|
+
OutputFormatter.error({
|
|
1465
|
+
Result: RESULTS.Failure,
|
|
1466
|
+
Message: renderErr?.message ?? "Failed to render completion script",
|
|
1467
|
+
Instructions: "If the error mentions a shell-special character in a command name, rename the offending command or open an issue at https://github.com/UiPath/cli/issues"
|
|
1468
|
+
});
|
|
1469
|
+
context.exit(1);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
if (opts.print) {
|
|
1473
|
+
handlePrint(target);
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
if (shellArg || !canPrompt()) {
|
|
1477
|
+
context.output.writeOut(target.scriptContent ?? target.content);
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
await handleInteractiveInstall(target, context, fs);
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
// src/commands/config/export.ts
|
|
1485
|
+
var CONFIG_EXPORT_EXAMPLES = [
|
|
1486
|
+
{
|
|
1487
|
+
Description: "Copy the config file to a path of your choice",
|
|
1488
|
+
Command: "uip config export --output-file ci/config.json",
|
|
1489
|
+
Output: {
|
|
1490
|
+
Code: CONFIG_CODES.ConfigExported,
|
|
1491
|
+
Data: {
|
|
1492
|
+
Path: "/repo/ci/config.json",
|
|
1493
|
+
From: "/repo/.uipath/config.json"
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
];
|
|
1498
|
+
function registerConfigExportCommand(configCommand, context) {
|
|
1499
|
+
configCommand.command("export").description("Copy the config file uip config reads to a path of your choice").requiredOption("--output-file <path>", "Path of the copy to write").option("--overwrite", "Replace --output-file when it already exists. Without it, writing over an existing file is refused").examples(CONFIG_EXPORT_EXAMPLES).trackedAction(context, exportConfigFile);
|
|
1500
|
+
}
|
|
1501
|
+
async function exportConfigFile(options) {
|
|
1502
|
+
const fs = getFileSystem2();
|
|
1503
|
+
const { outputFile } = options;
|
|
1504
|
+
const to = fs.path.resolve(fs.env.cwd(), outputFile);
|
|
1505
|
+
const problem = await outputFileProblem(fs, outputFile, to);
|
|
1506
|
+
if (problem !== undefined) {
|
|
1507
|
+
reportFreezeFailure("exportBadOutputFile", { outputFile, reason: problem }, { Code: CONFIG_CODES.ConfigExportBadOutputFile });
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
const [error, from] = await catchError(readSource(fs, to, outputFile).then(async ({ from, content }) => {
|
|
1511
|
+
await writeCopy(fs, to, content, options);
|
|
1512
|
+
return from;
|
|
1513
|
+
}));
|
|
1514
|
+
if (error instanceof FreezeFailureError) {
|
|
1515
|
+
reportFreezeFailureError(error);
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
if (error) {
|
|
1519
|
+
const cause = await classifyError(error);
|
|
1520
|
+
reportFreezeFailure("exportWrite", {
|
|
1521
|
+
path: to,
|
|
1522
|
+
cause,
|
|
1523
|
+
outputFile,
|
|
1524
|
+
overwrite: options.overwrite
|
|
1525
|
+
}, { Code: CONFIG_CODES.ConfigExportWrite });
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
OutputFormatter.success({
|
|
1529
|
+
Result: RESULTS.Success,
|
|
1530
|
+
Code: CONFIG_CODES.ConfigExported,
|
|
1531
|
+
Data: { Path: to, From: from }
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
async function readSource(fs, to, outputFile) {
|
|
1535
|
+
const source = await resolveConfigFilePathAsync();
|
|
1536
|
+
if (!source.absolutePath || !source.exists) {
|
|
1537
|
+
throw noConfig(source.absolutePath);
|
|
1538
|
+
}
|
|
1539
|
+
const from = source.absolutePath;
|
|
1540
|
+
if (await fs.exists(to) && await fs.realpath(to) === await fs.realpath(from)) {
|
|
1541
|
+
throw freezeFailureError("exportSameFile", { outputFile }, { Code: CONFIG_CODES.ConfigExportBadOutputFile });
|
|
1542
|
+
}
|
|
1543
|
+
const [readError, content] = await catchError(fs.readFile(from));
|
|
1544
|
+
if (readError) {
|
|
1545
|
+
throw await configFileReadFailure(readError, from);
|
|
1546
|
+
}
|
|
1547
|
+
if (content === null)
|
|
1548
|
+
throw noConfig(from);
|
|
1549
|
+
return { from, content };
|
|
1550
|
+
}
|
|
1551
|
+
function noConfig(path) {
|
|
1552
|
+
return freezeFailureError("exportNoConfig", { path }, { Code: CONFIG_CODES.ConfigExportNoConfig });
|
|
1553
|
+
}
|
|
1554
|
+
async function writeCopy(fs, to, content, { outputFile, overwrite }) {
|
|
1555
|
+
await withConfigLock(to, async () => {
|
|
1556
|
+
if (!overwrite && (await fs.exists(to) || await fs.isSymbolicLink?.(to))) {
|
|
1557
|
+
throw freezeFailureError("exportExists", { path: to, outputFile }, { Code: CONFIG_CODES.ConfigExportExists });
|
|
1558
|
+
}
|
|
1559
|
+
await writeFileAtomically(to, content);
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
async function outputFileProblem(fs, outputFile, to) {
|
|
1563
|
+
if (outputFile === "")
|
|
1564
|
+
return "the path is empty";
|
|
1565
|
+
if (/[\\/]$/.test(outputFile)) {
|
|
1566
|
+
return "the path ends with a separator, so it names a folder";
|
|
1567
|
+
}
|
|
1568
|
+
const [, target] = await catchError(fs.stat(to));
|
|
1569
|
+
if (target?.isDirectory())
|
|
1570
|
+
return "it is a folder";
|
|
1571
|
+
let dir = fs.path.dirname(to);
|
|
1572
|
+
for (;; ) {
|
|
1573
|
+
const [, stats] = await catchError(fs.stat(dir));
|
|
1574
|
+
if (stats) {
|
|
1575
|
+
return stats.isDirectory() ? undefined : `${configPathForMessage(dir)} is a file, not a folder`;
|
|
1576
|
+
}
|
|
1577
|
+
const parent = fs.path.dirname(dir);
|
|
1578
|
+
if (parent === dir)
|
|
1579
|
+
return;
|
|
1580
|
+
dir = parent;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
// src/commands/config/installedSkills.ts
|
|
1585
|
+
async function skillsToFreeze(cliLinePrefix, target, freezeAgain, pinnedSkills, isPublished) {
|
|
1586
|
+
const { version, updateCommand } = await readInstalledSkills(target);
|
|
1587
|
+
const decision = await skillsPinFor(version, pinnedSkills, cliLinePrefix, isPublished);
|
|
1588
|
+
switch (decision.reason) {
|
|
1589
|
+
case "installed":
|
|
1590
|
+
return { skills: decision.skills, skippedSkills: [] };
|
|
1591
|
+
case "installedOffLine":
|
|
1592
|
+
return {
|
|
1593
|
+
skippedSkills: ["@uipath/skills"],
|
|
1594
|
+
skillsWarning: `@uipath/skills ${decision.installed} is not on this CLI's ${cliLinePrefix}x line, so the config freeze leaves it out and the skills are not frozen. Run '${updateCommand}', then '${freezeAgain}' again.`
|
|
1595
|
+
};
|
|
1596
|
+
case "pinKept":
|
|
1597
|
+
return {
|
|
1598
|
+
skills: decision.skills,
|
|
1599
|
+
skippedSkills: [],
|
|
1600
|
+
skillsWarning: `No skills are installed, so the config freeze keeps the skills pin ${decision.skills}.`
|
|
1601
|
+
};
|
|
1602
|
+
case "pinUnchecked":
|
|
1603
|
+
return {
|
|
1604
|
+
skills: decision.skills,
|
|
1605
|
+
skippedSkills: [],
|
|
1606
|
+
skillsWarning: `No skills are installed, so the config freeze keeps the skills pin ${decision.skills}. The registry lookup failed, so the pin was not checked.`
|
|
1607
|
+
};
|
|
1608
|
+
case "pinUnpublished":
|
|
1609
|
+
return {
|
|
1610
|
+
skippedSkills: [],
|
|
1611
|
+
skillsWarning: `No skills are installed, and the registry does not publish @uipath/skills ${decision.pin}, so the config freeze drops the skills pin. The skills are not frozen: skills installed later follow the line of the CLI pin.`
|
|
1612
|
+
};
|
|
1613
|
+
default:
|
|
1614
|
+
return {
|
|
1615
|
+
skippedSkills: [],
|
|
1616
|
+
skillsWarning: "The config freeze pins no skills version, because no skills are installed. The skills are not frozen: skills installed later follow the line of the CLI pin."
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
async function readInstalledSkills(target) {
|
|
1621
|
+
const fs = getFileSystem2();
|
|
1622
|
+
const projectDir = projectDirOf(target);
|
|
1623
|
+
if (projectDir !== undefined) {
|
|
1624
|
+
const version = await readStoreSkillsVersion(fs.path.join(projectDir, STORE_NAME));
|
|
1625
|
+
if (version !== undefined) {
|
|
1626
|
+
const cwd = fs.env.cwd();
|
|
1627
|
+
const updateCommand = samePath(projectDir, cwd) ? "uip skills update --local" : `uip skills update --path ${quoteForShell(fs.path.relative(cwd, projectDir))}`;
|
|
1628
|
+
return { version, updateCommand };
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
return {
|
|
1632
|
+
version: await readStoreSkillsVersion(fs.path.join(fs.env.homedir(), STORE_NAME)),
|
|
1633
|
+
updateCommand: "uip skills update"
|
|
1634
|
+
};
|
|
1635
|
+
}
|
|
1636
|
+
function projectDirOf(target) {
|
|
1637
|
+
if (target.home)
|
|
1638
|
+
return;
|
|
1639
|
+
const fs = getFileSystem2();
|
|
1640
|
+
const configDir = fs.path.dirname(target.path);
|
|
1641
|
+
return fs.path.basename(configDir) === UIPATH_HOME_DIR ? fs.path.dirname(configDir) : fs.env.cwd();
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
// src/commands/config/freeze.ts
|
|
1645
|
+
var CONFIG_FREEZE_EXAMPLES = [
|
|
1646
|
+
{
|
|
1647
|
+
Description: "Snapshot and freeze the current config: pin the running CLI and the installed tools and skills",
|
|
1648
|
+
Command: "uip config freeze",
|
|
1649
|
+
Output: {
|
|
1650
|
+
Code: CONFIG_CODES.ConfigFrozen,
|
|
1651
|
+
Data: {
|
|
1652
|
+
Path: "/repo/.uipath/config.json",
|
|
1653
|
+
Versions: {
|
|
1654
|
+
cli: "1.206.1",
|
|
1655
|
+
skills: "1.206.0",
|
|
1656
|
+
tools: { "@uipath/orchestrator-tool": "1.206.2" }
|
|
1657
|
+
},
|
|
1658
|
+
Skipped: []
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
Description: "Also freeze every tool that is not installed",
|
|
1664
|
+
Command: "uip config freeze --all",
|
|
1665
|
+
Output: {
|
|
1666
|
+
Code: CONFIG_CODES.ConfigFrozen,
|
|
1667
|
+
Data: {
|
|
1668
|
+
Path: "/repo/.uipath/config.json",
|
|
1669
|
+
Versions: {
|
|
1670
|
+
cli: "1.206.1",
|
|
1671
|
+
tools: {
|
|
1672
|
+
"@uipath/orchestrator-tool": "1.206.2",
|
|
1673
|
+
"@uipath/solution-tool": "1.206.3"
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
Skipped: ["@uipath/rpa-tool"]
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
];
|
|
1681
|
+
function registerFreezeCommand(configCommand, context, state) {
|
|
1682
|
+
configCommand.command("freeze").description("Snapshot and freeze the current config: pin the installed CLI, tool and skills versions and the update channel.").option("--all", "Also freeze each tool that is not installed, at the newest version on this CLI's line and channel").option("--force", "Freeze the config even when the snapshot changes or drops versions it already pins, or pins no tool").examples(CONFIG_FREEZE_EXAMPLES).trackedAction(context, async (options) => {
|
|
1683
|
+
if (await isStudioBundle(state.resolveInstallPath)) {
|
|
1684
|
+
reportFreezeFailure("freezeOnStudio", {}, { Code: CONFIG_CODES.ConfigFreezeOnStudio });
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
const target = await resolveConfigWriteTargetAsync();
|
|
1688
|
+
const [error, frozen] = await catchError(freeze(state, options, target));
|
|
1689
|
+
if (error) {
|
|
1690
|
+
await reportConfigFileError(error, target.path);
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
printFreezeWarnings(frozen, target, options.all === true);
|
|
1694
|
+
await reloadConfigAfterWriteAsync(target.path);
|
|
1695
|
+
OutputFormatter.success({
|
|
1696
|
+
Result: RESULTS.Success,
|
|
1697
|
+
Code: CONFIG_CODES.ConfigFrozen,
|
|
1698
|
+
Data: {
|
|
1699
|
+
Path: target.path,
|
|
1700
|
+
Versions: frozen.versions,
|
|
1701
|
+
Skipped: frozen.skipped
|
|
1702
|
+
}
|
|
1703
|
+
}, { preserveDataKeys: ["Versions"] });
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
async function freeze(state, options, target) {
|
|
1707
|
+
const take = async (channel) => {
|
|
1708
|
+
const snapshot = await takeSnapshot(state, options, target, channel);
|
|
1709
|
+
refuseNoTool(snapshot, options);
|
|
1710
|
+
return snapshot;
|
|
1711
|
+
};
|
|
1712
|
+
return writeSnapshot(await take(), target.path, options.force, take, options.all ? (channel) => missingTools(state, channel) : undefined);
|
|
1713
|
+
}
|
|
1714
|
+
async function takeSnapshot(state, options, target, channel) {
|
|
1715
|
+
const cliLinePrefix = state.getCliVersionPrefix();
|
|
1716
|
+
const freezeAgain = `uip config freeze${allFlag(options.all === true)}`;
|
|
1717
|
+
const fileConfig = await readConfigFileOrReadError(target.path);
|
|
1718
|
+
const pinnedVersions = readVersions(fileConfig);
|
|
1719
|
+
const pinned = pinnedVersions.tools ?? {};
|
|
1720
|
+
const lookUpChannel = channel ?? fileChannel(fileConfig);
|
|
1721
|
+
const installed = installedTools(state, cliLinePrefix, pinned);
|
|
1722
|
+
const kept = await keepPinnedTools(state, pinned, installed.tools, lookUpChannel, options.all === true);
|
|
1723
|
+
const { skills, skippedSkills, skillsWarning } = await skillsToFreeze(cliLinePrefix, target, freezeAgain, pinnedVersions.skills, (version) => isVersionPublished2("@uipath/skills", version));
|
|
1724
|
+
const versions = {
|
|
1725
|
+
cli: package_default.version,
|
|
1726
|
+
...skills !== undefined && { skills },
|
|
1727
|
+
tools: sortedByName({ ...installed.tools, ...kept.tools })
|
|
1728
|
+
};
|
|
1729
|
+
return {
|
|
1730
|
+
versions,
|
|
1731
|
+
skipped: [...installed.skipped, ...kept.skipped, ...skippedSkills],
|
|
1732
|
+
warnings: [
|
|
1733
|
+
...installed.toolWarnings,
|
|
1734
|
+
...kept.toolWarnings,
|
|
1735
|
+
...skillsWarning === undefined ? [] : [skillsWarning]
|
|
1736
|
+
],
|
|
1737
|
+
noToolWarning: noToolWarning(options.all === true, installed.skipped.length > 0, (state.discoveredTools ?? []).length > 0),
|
|
1738
|
+
installedLeftOut: [
|
|
1739
|
+
...installed.skipped,
|
|
1740
|
+
...kept.skipped.filter((name) => (state.discoveredTools ?? []).some((tool) => tool.packageName === name))
|
|
1741
|
+
],
|
|
1742
|
+
channel: lookUpChannel
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
async function writeSnapshot(taken, path, force, retake, lookUpMissing) {
|
|
1746
|
+
const all = lookUpMissing !== undefined;
|
|
1747
|
+
refuseUnpinnable(taken, all);
|
|
1748
|
+
const lookedUpChannel = lookUpMissing ? taken.channel : undefined;
|
|
1749
|
+
const lookedUp = lookedUpChannel && await lookUpMissing?.(lookedUpChannel);
|
|
1750
|
+
return withConfigLock(path, async () => {
|
|
1751
|
+
const fileConfig = await readConfigFileOrReadError(path);
|
|
1752
|
+
const removedCoreVersion = removeCoreVersion(fileConfig);
|
|
1753
|
+
const channel = fileChannel(fileConfig);
|
|
1754
|
+
const snapshot = channel === taken.channel ? taken : await retake(channel);
|
|
1755
|
+
if (snapshot !== taken)
|
|
1756
|
+
refuseUnpinnable(snapshot, all);
|
|
1757
|
+
const missing = lookUpMissing && channel !== lookedUpChannel ? await lookUpMissing(channel) : lookedUp;
|
|
1758
|
+
const frozen = missing ? withMissingTools(snapshot, missing) : snapshot;
|
|
1759
|
+
const pinned = readVersions(fileConfig);
|
|
1760
|
+
const changes = pinChanges(pinned, frozen.versions);
|
|
1761
|
+
if (changes.length > 0 && !force) {
|
|
1762
|
+
throw pinChangesRefusal(path, changes, all);
|
|
1763
|
+
}
|
|
1764
|
+
fileConfig.versions = frozen.versions;
|
|
1765
|
+
const channelWarning = setUpdateChannel(fileConfig, channel, "the running CLI");
|
|
1766
|
+
refuseUnloadable(fileConfig, { path, all, force: force === true });
|
|
1767
|
+
await writeConfigFileAt(path, fileConfig);
|
|
1768
|
+
const ignored = unwarnedIgnoredKeys(dropUnknownFrozenValues(fileConfig).ignored);
|
|
1769
|
+
return {
|
|
1770
|
+
...frozen,
|
|
1771
|
+
changes,
|
|
1772
|
+
channelWarning,
|
|
1773
|
+
removedCoreVersion,
|
|
1774
|
+
ignored
|
|
1775
|
+
};
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
function refuseUnpinnable(snapshot, all) {
|
|
1779
|
+
const unpinnable = unpinnableVersions(snapshot.versions);
|
|
1780
|
+
if (unpinnable.length > 0) {
|
|
1781
|
+
throw invalidPinsRefusal(unpinnable, false, all);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
function refuseUnloadable(fileConfig, details) {
|
|
1785
|
+
const problem = configLoadProblem(fileConfig);
|
|
1786
|
+
if (!problem)
|
|
1787
|
+
return;
|
|
1788
|
+
const { problems, keys } = problem.kind === "config" ? problem : { problems: [problem.detail], keys: ["versions"] };
|
|
1789
|
+
throw freezeFailureError("freezeInvalidConfig", { ...details, problems, keys }, { Code: CONFIG_CODES.ConfigFreezeInvalidConfig });
|
|
1790
|
+
}
|
|
1791
|
+
function refuseNoTool(snapshot, options) {
|
|
1792
|
+
if (options.all || options.force || Object.keys(snapshot.versions.tools ?? {}).length > 0) {
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
throw freezeFailureError("freezeNoTool", { offLine: snapshot.installedLeftOut }, { Code: CONFIG_CODES.ConfigFreezeNoTool });
|
|
1796
|
+
}
|
|
1797
|
+
function fileChannel(fileConfig) {
|
|
1798
|
+
return runtimeChannelFor(asRecord(fileConfig.core)?.updateChannel);
|
|
1799
|
+
}
|
|
1800
|
+
function pinChangesRefusal(path, changes, all) {
|
|
1801
|
+
return freezeFailureError("freezeDrift", { path, changes, all }, {
|
|
1802
|
+
Code: CONFIG_CODES.ConfigFreezeDrift,
|
|
1803
|
+
Data: {
|
|
1804
|
+
Path: path,
|
|
1805
|
+
Changes: changes.map(({ name, from, to }) => ({
|
|
1806
|
+
Name: name,
|
|
1807
|
+
From: from,
|
|
1808
|
+
To: to ?? null
|
|
1809
|
+
}))
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
function invalidPinsRefusal(versions, onRegistry, all) {
|
|
1814
|
+
return freezeFailureError("freezeInvalidPins", { versions, onRegistry, all }, { Code: CONFIG_CODES.ConfigFreezeInvalidPins });
|
|
1815
|
+
}
|
|
1816
|
+
function withMissingTools(snapshot, missing) {
|
|
1817
|
+
const unpinnable = unpinnableVersions({
|
|
1818
|
+
...snapshot.versions,
|
|
1819
|
+
tools: missing.tools
|
|
1820
|
+
});
|
|
1821
|
+
if (unpinnable.length > 0) {
|
|
1822
|
+
throw invalidPinsRefusal(unpinnable, true, true);
|
|
1823
|
+
}
|
|
1824
|
+
return {
|
|
1825
|
+
...snapshot,
|
|
1826
|
+
versions: {
|
|
1827
|
+
...snapshot.versions,
|
|
1828
|
+
tools: sortedByName({
|
|
1829
|
+
...snapshot.versions.tools,
|
|
1830
|
+
...missing.tools
|
|
1831
|
+
})
|
|
1832
|
+
},
|
|
1833
|
+
skipped: [...snapshot.skipped, ...missing.skipped],
|
|
1834
|
+
warnings: [...snapshot.warnings, ...missing.toolWarnings]
|
|
1835
|
+
};
|
|
1836
|
+
}
|
|
1837
|
+
function printFreezeWarnings({
|
|
1838
|
+
versions,
|
|
1839
|
+
warnings,
|
|
1840
|
+
noToolWarning,
|
|
1841
|
+
channelWarning,
|
|
1842
|
+
removedCoreVersion,
|
|
1843
|
+
changes,
|
|
1844
|
+
ignored
|
|
1845
|
+
}, target, all) {
|
|
1846
|
+
for (const warning of warnings) {
|
|
1847
|
+
OutputFormatter.log({ Warning: warning });
|
|
1848
|
+
}
|
|
1849
|
+
if (ignored.length > 0) {
|
|
1850
|
+
OutputFormatter.log({
|
|
1851
|
+
Warning: ignoredValuesWarning(configPathForMessage(target.path), ignored)
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
if (channelWarning !== undefined) {
|
|
1855
|
+
OutputFormatter.log({ Warning: channelWarning });
|
|
1856
|
+
}
|
|
1857
|
+
if (removedCoreVersion !== undefined) {
|
|
1858
|
+
OutputFormatter.log({
|
|
1859
|
+
Warning: `The config freeze removes the old 'version' setting ${String(removedCoreVersion.version)}. ${OLDER_CLIS_LOSE_PIN}`
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
for (const change of changes) {
|
|
1863
|
+
OutputFormatter.log({
|
|
1864
|
+
Warning: `The config freeze changes ${renderPinChange(change)}.`
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
if (Object.keys(versions.tools ?? {}).length === 0) {
|
|
1868
|
+
OutputFormatter.log({ Warning: noToolWarning });
|
|
1869
|
+
}
|
|
1870
|
+
if (target.home) {
|
|
1871
|
+
OutputFormatter.log({
|
|
1872
|
+
Warning: homeConfigWarning(target.path, {
|
|
1873
|
+
doing: "freezing it",
|
|
1874
|
+
onlyThisRepo: "freeze only this repo",
|
|
1875
|
+
command: `uip config freeze${allFlag(all)}`
|
|
1876
|
+
})
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
function noToolWarning(all, installedOffLine, anyInstalled) {
|
|
1881
|
+
if (!all) {
|
|
1882
|
+
const why = anyInstalled ? "no installed tool is on this CLI's line" : "no tool is installed";
|
|
1883
|
+
return `The config freeze pins no tool: ${why}. No tool will run under this freeze until it is pinned. Run 'uip config freeze --all' to freeze every tool.`;
|
|
1884
|
+
}
|
|
1885
|
+
return installedOffLine ? "The config freeze pins no tool: no installed tool is on this CLI's line." : "The config freeze pins no tool: the registry has no tool build on this CLI's line.";
|
|
1886
|
+
}
|
|
1887
|
+
function unpinnableVersions(snapshot) {
|
|
1888
|
+
return Object.entries({
|
|
1889
|
+
CLI: snapshot.cli,
|
|
1890
|
+
"@uipath/skills": snapshot.skills,
|
|
1891
|
+
...snapshot.tools
|
|
1892
|
+
}).filter((entry) => entry[1] !== undefined).filter(([, version]) => !VERSION_PIN_RE.test(version)).map(([name, version]) => ({ name, version }));
|
|
1893
|
+
}
|
|
1894
|
+
function installedTools(state, cliLinePrefix, pinned) {
|
|
1895
|
+
const tools = {};
|
|
1896
|
+
const skipped = [];
|
|
1897
|
+
const toolWarnings = [];
|
|
1898
|
+
for (const tool of state.discoveredTools ?? []) {
|
|
1899
|
+
if (tool.version.startsWith(cliLinePrefix)) {
|
|
1900
|
+
tools[tool.packageName] = tool.version;
|
|
1901
|
+
continue;
|
|
1902
|
+
}
|
|
1903
|
+
if (Object.hasOwn(pinned, tool.packageName))
|
|
1904
|
+
continue;
|
|
1905
|
+
skipped.push(tool.packageName);
|
|
1906
|
+
toolWarnings.push(`${tool.packageName} ${tool.version} is not on this CLI's ${cliLinePrefix}x line, so the config freeze leaves it out. Run 'uip tools install ${tool.packageName} --force' to install a version on the line and add it to the freeze.`);
|
|
1907
|
+
}
|
|
1908
|
+
return { tools, skipped, toolWarnings };
|
|
1909
|
+
}
|
|
1910
|
+
async function keepPinnedTools(state, pinned, snapshotTools, channel, all) {
|
|
1911
|
+
const cliLinePrefix = state.getCliVersionPrefix();
|
|
1912
|
+
const selection = {
|
|
1913
|
+
tools: {},
|
|
1914
|
+
skipped: [],
|
|
1915
|
+
toolWarnings: []
|
|
1916
|
+
};
|
|
1917
|
+
const toLookUp = [];
|
|
1918
|
+
for (const [packageName, pin] of Object.entries(pinned)) {
|
|
1919
|
+
if (Object.hasOwn(snapshotTools, packageName))
|
|
1920
|
+
continue;
|
|
1921
|
+
if (!TOOLS_WHITELIST.has(packageName)) {
|
|
1922
|
+
selection.skipped.push(packageName);
|
|
1923
|
+
selection.toolWarnings.push(`The freeze lists ${packageName}, which is not a known tool, so the config freeze leaves it out.`);
|
|
1924
|
+
continue;
|
|
1925
|
+
}
|
|
1926
|
+
const installed = (state.discoveredTools ?? []).find((tool) => tool.packageName === packageName);
|
|
1927
|
+
if (!installed && all)
|
|
1928
|
+
continue;
|
|
1929
|
+
if (!installed && versionLinePrefix(pin) === cliLinePrefix) {
|
|
1930
|
+
selection.tools[packageName] = pin;
|
|
1931
|
+
continue;
|
|
1932
|
+
}
|
|
1933
|
+
toLookUp.push([packageName, installed?.version ?? pin]);
|
|
1934
|
+
}
|
|
1935
|
+
const lookups = await Promise.all(toLookUp.map(([packageName]) => lookUpTool(packageName, cliLinePrefix, channel)));
|
|
1936
|
+
for (const [index, lookup] of lookups.entries()) {
|
|
1937
|
+
const from = toLookUp[index]?.[1];
|
|
1938
|
+
await addLookedUpTool(selection, lookup, from, cliLinePrefix, channel);
|
|
1939
|
+
}
|
|
1940
|
+
return selection;
|
|
1941
|
+
}
|
|
1942
|
+
async function addLookedUpTool(selection, { packageName, version, failure }, from, cliLinePrefix, channel) {
|
|
1943
|
+
if (version !== undefined) {
|
|
1944
|
+
selection.tools[packageName] = version;
|
|
1945
|
+
selection.toolWarnings.push(`${packageName} ${from} is not on this CLI's ${cliLinePrefix}x line, so the config freeze pins ${version}, the newest version on the line. Run 'uip update' to install it.`);
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
if (failure !== undefined && failure.kind !== "not-found") {
|
|
1949
|
+
const lookup = describeCandidateFailure(packageName, cliLinePrefix, failure, await getEffectiveRegistry(packageName));
|
|
1950
|
+
throw freezeFailureError("freezeToolLookup", { lookup }, { Code: CONFIG_CODES.ConfigFreezeToolLookup });
|
|
1951
|
+
}
|
|
1952
|
+
selection.skipped.push(packageName);
|
|
1953
|
+
selection.toolWarnings.push(`${packageName} has no ${channel} build on this CLI's ${cliLinePrefix}x line, so the config freeze leaves it out.`);
|
|
1954
|
+
}
|
|
1955
|
+
async function missingTools(state, channel) {
|
|
1956
|
+
const cliLinePrefix = state.getCliVersionPrefix();
|
|
1957
|
+
const installed = new Set((state.discoveredTools ?? []).map((tool) => tool.packageName));
|
|
1958
|
+
const lookups = await Promise.all([...TOOLS_WHITELIST.keys()].filter((packageName) => !installed.has(packageName)).map((packageName) => lookUpTool(packageName, cliLinePrefix, channel)));
|
|
1959
|
+
const [first] = lookups;
|
|
1960
|
+
if (installed.size === 0 && first !== undefined && lookups.every(({ failure }) => failure?.kind === "not-found")) {
|
|
1961
|
+
throw freezeFailureError("freezeAllNothingFound", { registry: await getEffectiveRegistry(first.packageName) }, { Code: CONFIG_CODES.ConfigFreezeAllNothingFound });
|
|
1962
|
+
}
|
|
1963
|
+
const failed = lookups.find(({ failure }) => failure !== undefined && failure.kind !== "not-found");
|
|
1964
|
+
if (failed) {
|
|
1965
|
+
const lookup = describeCandidateFailure(failed.packageName, cliLinePrefix, failed.failure, await getEffectiveRegistry(failed.packageName));
|
|
1966
|
+
throw freezeFailureError("freezeToolLookup", { lookup }, { Code: CONFIG_CODES.ConfigFreezeToolLookup });
|
|
1967
|
+
}
|
|
1968
|
+
const selection = {
|
|
1969
|
+
tools: {},
|
|
1970
|
+
skipped: [],
|
|
1971
|
+
toolWarnings: []
|
|
1972
|
+
};
|
|
1973
|
+
for (const { packageName, version, failure } of lookups) {
|
|
1974
|
+
if (version !== undefined) {
|
|
1975
|
+
selection.tools[packageName] = version;
|
|
1976
|
+
continue;
|
|
1977
|
+
}
|
|
1978
|
+
selection.skipped.push(packageName);
|
|
1979
|
+
selection.toolWarnings.push(failure ? `The config freeze leaves ${packageName} out: ${failure.message}.` : `${packageName} has no ${channel} build on this CLI's ${cliLinePrefix}x line, so the config freeze leaves it out.`);
|
|
1980
|
+
}
|
|
1981
|
+
return selection;
|
|
1982
|
+
}
|
|
1983
|
+
async function lookUpTool(packageName, cliLinePrefix, channel) {
|
|
1984
|
+
let failure;
|
|
1985
|
+
const candidate = await toolService.resolveInstallCandidate(packageName, cliLinePrefix, channel, (lookupFailure) => {
|
|
1986
|
+
failure = lookupFailure;
|
|
1987
|
+
});
|
|
1988
|
+
return { packageName, version: candidate?.version, failure };
|
|
1989
|
+
}
|
|
1990
|
+
function pinChanges(current, snapshot) {
|
|
1991
|
+
const changes = [];
|
|
1992
|
+
const addIfChanged = (name, from, to) => {
|
|
1993
|
+
if (from === undefined || from === to)
|
|
1994
|
+
return;
|
|
1995
|
+
changes.push({ name, from, to });
|
|
1996
|
+
};
|
|
1997
|
+
addIfChanged("CLI", current.cli, snapshot.cli);
|
|
1998
|
+
addIfChanged("@uipath/skills", current.skills, snapshot.skills);
|
|
1999
|
+
for (const [name, pin] of Object.entries(current.tools ?? {})) {
|
|
2000
|
+
addIfChanged(name, pin, snapshot.tools?.[name]);
|
|
2001
|
+
}
|
|
2002
|
+
return changes;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
// src/commands/config/import.ts
|
|
2006
|
+
var CONFIG_IMPORT_EXAMPLES = [
|
|
2007
|
+
{
|
|
2008
|
+
Description: "Import a config file as the current config",
|
|
2009
|
+
Command: "uip config import --input ci/config.json",
|
|
2010
|
+
Output: {
|
|
2011
|
+
Code: CONFIG_CODES.ConfigImported,
|
|
2012
|
+
Data: {
|
|
2013
|
+
Path: "/repo/.uipath/config.json",
|
|
2014
|
+
From: "/repo/ci/config.json"
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
];
|
|
2019
|
+
function registerImportCommand(configCommand, context) {
|
|
2020
|
+
configCommand.command("import").description("Check a config file and put it in place of the current config").requiredOption("--input <path>", "Path of the config file to import").examples(CONFIG_IMPORT_EXAMPLES).trackedAction(context, importConfigFile);
|
|
2021
|
+
}
|
|
2022
|
+
async function importConfigFile(options) {
|
|
2023
|
+
if (options.input === "") {
|
|
2024
|
+
reportFreezeFailure("importEmptyFile", {}, { Code: CONFIG_CODES.ConfigImportBadInput });
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
const fs = getFileSystem2();
|
|
2028
|
+
const from = fs.path.resolve(fs.env.cwd(), options.input);
|
|
2029
|
+
const [readError, source] = await catchError(readSource2(from));
|
|
2030
|
+
if (readError) {
|
|
2031
|
+
await reportSourceError(readError, from);
|
|
2032
|
+
return;
|
|
2033
|
+
}
|
|
2034
|
+
const target = await resolveConfigWriteTargetAsync();
|
|
2035
|
+
const [writeError, warnings] = await catchError(writeTarget(target.path, source));
|
|
2036
|
+
if (writeError) {
|
|
2037
|
+
await reportConfigFileError(writeError, target.path);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
for (const warning of warnings) {
|
|
2041
|
+
OutputFormatter.log({ Warning: warning });
|
|
2042
|
+
}
|
|
2043
|
+
const ignored = unwarnedIgnoredKeys(dropUnknownFrozenValues(source).ignored);
|
|
2044
|
+
if (ignored.length > 0) {
|
|
2045
|
+
OutputFormatter.log({
|
|
2046
|
+
Warning: ignoredValuesWarning(configPathForMessage(target.path), ignored)
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2049
|
+
const [typo] = misspelledVersionsKeysIn(source);
|
|
2050
|
+
if (typo !== undefined) {
|
|
2051
|
+
OutputFormatter.log({
|
|
2052
|
+
Warning: `${configPathForMessage(from)} has the key '${typo}', not 'versions', so the imported config is not frozen.`
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
if (target.home && asRecord(source.versions) !== undefined) {
|
|
2056
|
+
OutputFormatter.log({
|
|
2057
|
+
Warning: homeConfigWarning(target.path, {
|
|
2058
|
+
doing: "importing a freeze into it",
|
|
2059
|
+
onlyThisRepo: "import only into this repo",
|
|
2060
|
+
command: `uip config import --input ${quoteForShell(from)}`
|
|
2061
|
+
})
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
await reloadConfigAfterWriteAsync(target.path);
|
|
2065
|
+
OutputFormatter.success({
|
|
2066
|
+
Result: RESULTS.Success,
|
|
2067
|
+
Code: CONFIG_CODES.ConfigImported,
|
|
2068
|
+
Data: { Path: target.path, From: from }
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2071
|
+
async function readSource2(from) {
|
|
2072
|
+
const fs = getFileSystem2();
|
|
2073
|
+
const notFound = () => freezeFailureError("importNotFound", { path: from }, { Code: CONFIG_CODES.ConfigImportNotFound });
|
|
2074
|
+
const [statError, stats] = await catchError(fs.stat(from));
|
|
2075
|
+
if (statError)
|
|
2076
|
+
throw await unreadable(from, statError);
|
|
2077
|
+
if (stats === null || stats.isDirectory())
|
|
2078
|
+
throw notFound();
|
|
2079
|
+
const [readError, bytes] = await catchError(fs.readFile(from));
|
|
2080
|
+
if (readError)
|
|
2081
|
+
throw await unreadable(from, readError);
|
|
2082
|
+
if (bytes === null)
|
|
2083
|
+
throw notFound();
|
|
2084
|
+
const [decodeError, content] = catchError(() => new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
2085
|
+
if (decodeError)
|
|
2086
|
+
throw invalidSource("importNotUtf8", { path: from });
|
|
2087
|
+
if (content.trim() === "") {
|
|
2088
|
+
throw invalidSource("importInvalidJson", { path: from });
|
|
2089
|
+
}
|
|
2090
|
+
const [parseError, parsed] = catchError(() => parseConfigJson(content, from));
|
|
2091
|
+
if (parseError?.cause instanceof SyntaxError) {
|
|
2092
|
+
throw invalidSource("importInvalidJson", { path: from });
|
|
2093
|
+
}
|
|
2094
|
+
if (parseError)
|
|
2095
|
+
throw parseError;
|
|
2096
|
+
const problem = configLoadProblem(parsed);
|
|
2097
|
+
if (problem?.kind === "pins") {
|
|
2098
|
+
throw invalidSource("importInvalidPins", {
|
|
2099
|
+
path: from,
|
|
2100
|
+
detail: problem.detail
|
|
2101
|
+
});
|
|
2102
|
+
}
|
|
2103
|
+
if (problem?.kind === "config") {
|
|
2104
|
+
throw invalidSource("importInvalidConfig", {
|
|
2105
|
+
path: from,
|
|
2106
|
+
problems: problem.problems
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
return parsed;
|
|
2110
|
+
}
|
|
2111
|
+
function invalidSource(kind, details) {
|
|
2112
|
+
return freezeFailureError(kind, details, {
|
|
2113
|
+
Code: CONFIG_CODES.ConfigImportInvalid
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
async function unreadable(path, error) {
|
|
2117
|
+
return freezeFailureError("importUnreadable", { path, cause: await classifyError(error) }, { Code: CONFIG_CODES.ConfigImportRead });
|
|
2118
|
+
}
|
|
2119
|
+
async function writeTarget(path, source) {
|
|
2120
|
+
const written = structuredClone(source);
|
|
2121
|
+
const notImported = deleteKeysRemovedOnLoad(written);
|
|
2122
|
+
const removedCoreVersion = removeCoreVersion(written);
|
|
2123
|
+
const shownTarget = configPathForMessage(path);
|
|
2124
|
+
return withConfigLock(path, async () => {
|
|
2125
|
+
const [currentError, current] = await catchError(readConfigFileAt(path));
|
|
2126
|
+
if (currentError && (await getFileSystem2().stat(path))?.isDirectory()) {
|
|
2127
|
+
throw new FileReadError(currentError);
|
|
2128
|
+
}
|
|
2129
|
+
await writeConfigFileAt(path, written);
|
|
2130
|
+
return [
|
|
2131
|
+
...notImported.map((key) => `${key} is not written to ${shownTarget}, because the CLI deletes it from any config file.`),
|
|
2132
|
+
...removedCoreVersion ? [coreVersionNotImported(removedCoreVersion, shownTarget)] : [],
|
|
2133
|
+
...droppedKeys(current ?? {}, source).map((key) => `${key} is removed from ${shownTarget}, because the imported file does not have it.`)
|
|
2134
|
+
];
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
function coreVersionNotImported({ version, outcome }, shownTarget) {
|
|
2138
|
+
const line = `The old 'version' setting ${String(version)} is not written to ${shownTarget}. ${OLDER_CLIS_LOSE_PIN}`;
|
|
2139
|
+
return outcome === "removed" ? `${line} 'uip config freeze' pins the versions installed now.` : line;
|
|
2140
|
+
}
|
|
2141
|
+
async function reportSourceError(error, path) {
|
|
2142
|
+
if (error instanceof FreezeFailureError) {
|
|
2143
|
+
reportFreezeFailureError(error);
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
const failure = await classifiedFailure(`Could not import ${configPathForMessage(path)}, so the config was not changed`, error);
|
|
2147
|
+
OutputFormatter.error({
|
|
2148
|
+
...failure,
|
|
2149
|
+
Code: CONFIG_CODES.ConfigImportFailed
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function droppedKeys(current, imported, parentPath = "") {
|
|
2153
|
+
return Object.entries(current).flatMap(([key, value]) => {
|
|
2154
|
+
const keyPath = `${parentPath}${key}`;
|
|
2155
|
+
if (!Object.hasOwn(imported, key))
|
|
2156
|
+
return [keyPath];
|
|
2157
|
+
const currentSection = asRecord(value);
|
|
2158
|
+
if (!currentSection)
|
|
2159
|
+
return [];
|
|
2160
|
+
const importedSection = asRecord(imported[key]) ?? {};
|
|
2161
|
+
return droppedKeys(currentSection, importedSection, `${keyPath}.`);
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
// src/commands/config/unfreeze.ts
|
|
2166
|
+
var CONFIG_UNFREEZE_EXAMPLES = [
|
|
2167
|
+
{
|
|
2168
|
+
Description: "Remove the config freeze",
|
|
2169
|
+
Command: "uip config unfreeze",
|
|
2170
|
+
Output: {
|
|
2171
|
+
Code: CONFIG_CODES.ConfigUnfrozen,
|
|
2172
|
+
Data: {
|
|
2173
|
+
Path: "/repo/.uipath/config.json",
|
|
2174
|
+
Status: "Unfrozen",
|
|
2175
|
+
Removed: {
|
|
2176
|
+
Versions: {
|
|
2177
|
+
cli: "1.206.1",
|
|
2178
|
+
skills: "1.206.0",
|
|
2179
|
+
tools: { "@uipath/orchestrator-tool": "1.206.2" }
|
|
2180
|
+
},
|
|
2181
|
+
UpdateChannel: "stable"
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
];
|
|
2187
|
+
function registerUnfreezeCommand(configCommand, context) {
|
|
2188
|
+
configCommand.command("unfreeze").description("Remove the freeze from the current config").examples(CONFIG_UNFREEZE_EXAMPLES).trackedAction(context, async () => {
|
|
2189
|
+
const target = await resolveConfigWriteTargetAsync();
|
|
2190
|
+
const [error, unfrozen] = await catchError(unfreeze(target.path));
|
|
2191
|
+
if (error) {
|
|
2192
|
+
await reportConfigFileError(error, target.path);
|
|
1472
2193
|
return;
|
|
1473
2194
|
}
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
|
|
2195
|
+
const removed = unfrozen?.removed;
|
|
2196
|
+
if (removed) {
|
|
2197
|
+
await reloadConfigAfterWriteAsync(target.path, unfrozen.unloadableKeys.length === 0);
|
|
1477
2198
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
Result: RESULTS.Failure,
|
|
1482
|
-
Message: buildError?.message ?? "Failed to build command tree",
|
|
1483
|
-
Instructions: "Try re-running the command. If the problem persists, report it at https://github.com/UiPath/cli/issues"
|
|
2199
|
+
if (removed?.Ignored !== undefined) {
|
|
2200
|
+
OutputFormatter.log({
|
|
2201
|
+
Warning: `The values that this CLI cannot use are removed too, because the file does not load with them once it is unfrozen: ${removed.Ignored.join(", ")}.`
|
|
1484
2202
|
});
|
|
1485
|
-
context.exit(1);
|
|
1486
|
-
return;
|
|
1487
2203
|
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
Result: RESULTS.Failure,
|
|
1492
|
-
Message: renderErr?.message ?? "Failed to render completion script",
|
|
1493
|
-
Instructions: "If the error mentions a shell-special character in a command name, rename the offending command or open an issue at https://github.com/UiPath/cli/issues"
|
|
2204
|
+
if (unfrozen?.unloadableKeys.length) {
|
|
2205
|
+
OutputFormatter.log({
|
|
2206
|
+
Warning: `${configPathForMessage(target.path)} has values that this CLI cannot use, so the config does not load until they are fixed: ${unfrozen.unloadableKeys.join(", ")}.`
|
|
1494
2207
|
});
|
|
1495
|
-
context.exit(1);
|
|
1496
|
-
return;
|
|
1497
2208
|
}
|
|
1498
|
-
if (
|
|
1499
|
-
|
|
1500
|
-
|
|
2209
|
+
if (removed?.UpdateChannel !== undefined) {
|
|
2210
|
+
OutputFormatter.log({
|
|
2211
|
+
Warning: channelRemovedWarning(removed.UpdateChannel)
|
|
2212
|
+
});
|
|
1501
2213
|
}
|
|
1502
|
-
if (
|
|
1503
|
-
|
|
1504
|
-
|
|
2214
|
+
if (removed && target.home) {
|
|
2215
|
+
OutputFormatter.log({
|
|
2216
|
+
Warning: `${configPathForMessage(target.path)} is the home config, so unfreezing it unfreezes every repo without a .uipath/config.json of its own.`
|
|
2217
|
+
});
|
|
1505
2218
|
}
|
|
1506
|
-
|
|
2219
|
+
OutputFormatter.success({
|
|
2220
|
+
Result: RESULTS.Success,
|
|
2221
|
+
Code: CONFIG_CODES.ConfigUnfrozen,
|
|
2222
|
+
Data: {
|
|
2223
|
+
Path: target.path,
|
|
2224
|
+
Status: removed ? "Unfrozen" : "NotFrozen",
|
|
2225
|
+
...removed && { Removed: removed }
|
|
2226
|
+
}
|
|
2227
|
+
}, { preserveDataKeys: ["Versions"] });
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2230
|
+
async function unfreeze(path) {
|
|
2231
|
+
if (!await getFileSystem2().exists(path))
|
|
2232
|
+
return;
|
|
2233
|
+
const unlocked = await readConfigFileOrReadError(path);
|
|
2234
|
+
if (unlocked.versions === undefined)
|
|
2235
|
+
return;
|
|
2236
|
+
return withConfigLock(path, async () => {
|
|
2237
|
+
const read = await readConfigFileOrReadError(path);
|
|
2238
|
+
if (read.versions === undefined)
|
|
2239
|
+
return;
|
|
2240
|
+
removeCoreVersion(read);
|
|
2241
|
+
const removed = {
|
|
2242
|
+
Versions: readVersions(read),
|
|
2243
|
+
...removeUpdateChannel(read)
|
|
2244
|
+
};
|
|
2245
|
+
const { kept: fileConfig, ignored } = dropUnknownFrozenValues(read);
|
|
2246
|
+
delete fileConfig.versions;
|
|
2247
|
+
const removedValues = ignored.filter((key) => !key.startsWith("versions."));
|
|
2248
|
+
const core = asRecord(fileConfig.core);
|
|
2249
|
+
if (removedValues.length > 0 && core && Object.keys(core).length === 0) {
|
|
2250
|
+
delete fileConfig.core;
|
|
2251
|
+
}
|
|
2252
|
+
await writeConfigFileAt(path, fileConfig);
|
|
2253
|
+
if (removedValues.length > 0)
|
|
2254
|
+
removed.Ignored = removedValues;
|
|
2255
|
+
const problem = configLoadProblem(fileConfig);
|
|
2256
|
+
const unloadableKeys = problem?.kind === "config" ? problem.keys : [];
|
|
2257
|
+
return { removed, unloadableKeys };
|
|
1507
2258
|
});
|
|
1508
2259
|
}
|
|
2260
|
+
function channelRemovedWarning(channel) {
|
|
2261
|
+
const removed = `The config's updateChannel ${channel} is removed.`;
|
|
2262
|
+
return VALID_CHANNELS.has(channel) ? `${removed} To keep it, run 'uip config set updateChannel ${channel}'.` : removed;
|
|
2263
|
+
}
|
|
2264
|
+
function removeUpdateChannel(fileConfig) {
|
|
2265
|
+
const core = asRecord(fileConfig.core);
|
|
2266
|
+
if (core?.updateChannel === undefined)
|
|
2267
|
+
return {};
|
|
2268
|
+
const { updateChannel, ...otherCoreKeys } = core;
|
|
2269
|
+
if (Object.keys(otherCoreKeys).length > 0)
|
|
2270
|
+
fileConfig.core = otherCoreKeys;
|
|
2271
|
+
else
|
|
2272
|
+
delete fileConfig.core;
|
|
2273
|
+
return { UpdateChannel: valueText(updateChannel) };
|
|
2274
|
+
}
|
|
1509
2275
|
|
|
1510
2276
|
// src/commands/config.ts
|
|
1511
2277
|
var CONFIG_KEYS = {
|
|
@@ -1529,16 +2295,10 @@ var CONFIG_KEYS = {
|
|
|
1529
2295
|
validValues: [...PUBLIC_CHANNELS],
|
|
1530
2296
|
hiddenValues: [...HIDDEN_CHANNELS],
|
|
1531
2297
|
description: "Release channel used to resolve tool updates"
|
|
1532
|
-
},
|
|
1533
|
-
version: {
|
|
1534
|
-
path: ["core", "version"],
|
|
1535
|
-
normalize: (v) => v.trim(),
|
|
1536
|
-
validate: (v) => isValidVersionPin(v),
|
|
1537
|
-
valueHint: "Use major.minor or major.minor.patch (e.g. 1.2 or 1.2.3).",
|
|
1538
|
-
description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows the latest release"
|
|
1539
2298
|
}
|
|
1540
2299
|
};
|
|
1541
2300
|
var VALID_KEY_NAMES = Object.keys(CONFIG_KEYS);
|
|
2301
|
+
var MOVED_KEYS = new Set(["version"]);
|
|
1542
2302
|
var CONFIG_GET_EXAMPLES = [
|
|
1543
2303
|
{
|
|
1544
2304
|
Description: "Get the default output format",
|
|
@@ -1595,40 +2355,16 @@ var CONFIG_SET_EXAMPLES = [
|
|
|
1595
2355
|
Status: "Updated"
|
|
1596
2356
|
}
|
|
1597
2357
|
}
|
|
1598
|
-
},
|
|
1599
|
-
{
|
|
1600
|
-
Description: "Pin the CLI and tools to the 1.196 version line",
|
|
1601
|
-
Command: "uip config set version 1.196",
|
|
1602
|
-
Output: {
|
|
1603
|
-
Code: "ConfigSet",
|
|
1604
|
-
Data: {
|
|
1605
|
-
Key: "version",
|
|
1606
|
-
Value: "1.196",
|
|
1607
|
-
Status: "Updated"
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
},
|
|
1611
|
-
{
|
|
1612
|
-
Description: "Freeze the CLI and tools by pinning an exact version",
|
|
1613
|
-
Command: "uip config set version 1.196.3",
|
|
1614
|
-
Output: {
|
|
1615
|
-
Code: "ConfigSet",
|
|
1616
|
-
Data: {
|
|
1617
|
-
Key: "version",
|
|
1618
|
-
Value: "1.196.3",
|
|
1619
|
-
Status: "Updated"
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
2358
|
}
|
|
1623
2359
|
];
|
|
1624
2360
|
var CONFIG_CLEAR_EXAMPLES = [
|
|
1625
2361
|
{
|
|
1626
|
-
Description: "Clear the
|
|
1627
|
-
Command: "uip config clear
|
|
2362
|
+
Description: "Clear the default output format",
|
|
2363
|
+
Command: "uip config clear output",
|
|
1628
2364
|
Output: {
|
|
1629
2365
|
Code: "ConfigClear",
|
|
1630
2366
|
Data: {
|
|
1631
|
-
Key: "
|
|
2367
|
+
Key: "output",
|
|
1632
2368
|
Status: "Cleared"
|
|
1633
2369
|
}
|
|
1634
2370
|
}
|
|
@@ -1650,21 +2386,11 @@ async function resolveForRead(explicit) {
|
|
|
1650
2386
|
if (r.absolutePath && r.exists) {
|
|
1651
2387
|
return { result: { path: r.absolutePath } };
|
|
1652
2388
|
}
|
|
1653
|
-
if (r.
|
|
1654
|
-
return { error: r.
|
|
2389
|
+
if (r.error) {
|
|
2390
|
+
return { error: r.error };
|
|
1655
2391
|
}
|
|
1656
2392
|
return {};
|
|
1657
2393
|
}
|
|
1658
|
-
async function resolveForWrite(explicit) {
|
|
1659
|
-
const r = await resolveConfigFilePathAsync(explicit);
|
|
1660
|
-
if (r.absolutePath) {
|
|
1661
|
-
return { path: r.absolutePath };
|
|
1662
|
-
}
|
|
1663
|
-
const fs = getFileSystem2();
|
|
1664
|
-
return {
|
|
1665
|
-
path: fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, CONFIG_FILENAME)
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
2394
|
function getNestedValue(obj, path) {
|
|
1669
2395
|
const section = obj[path[0]];
|
|
1670
2396
|
if (section === undefined || section === null || typeof section !== "object") {
|
|
@@ -1739,9 +2465,6 @@ function redactSecretsDeep(value, pathSegments = []) {
|
|
|
1739
2465
|
}
|
|
1740
2466
|
return value;
|
|
1741
2467
|
}
|
|
1742
|
-
function configFileTelemetryProperties(options) {
|
|
1743
|
-
return options.configFile !== undefined ? { configFile: TELEMETRY_ARG_VALUE_WITHHELD } : {};
|
|
1744
|
-
}
|
|
1745
2468
|
function keyTelemetryValue(key) {
|
|
1746
2469
|
if (key === undefined) {
|
|
1747
2470
|
return;
|
|
@@ -1772,102 +2495,123 @@ function clearTelemetryProperties(key, options) {
|
|
|
1772
2495
|
...configFileTelemetryProperties(options)
|
|
1773
2496
|
};
|
|
1774
2497
|
}
|
|
1775
|
-
function
|
|
2498
|
+
function reportInvalidKey(key, verb) {
|
|
2499
|
+
if (MOVED_KEYS.has(key)) {
|
|
2500
|
+
reportFreezeFailure("movedKey", { key, verb }, { Code: CONFIG_CODES.ConfigMovedKey });
|
|
2501
|
+
return;
|
|
2502
|
+
}
|
|
2503
|
+
OutputFormatter.error({
|
|
2504
|
+
Result: RESULTS.ValidationError,
|
|
2505
|
+
Code: CONFIG_CODES.ConfigUnknownKey,
|
|
2506
|
+
Message: `Unknown config key '${key}'`,
|
|
2507
|
+
Instructions: `Valid keys: ${VALID_KEY_NAMES.join(", ")}`
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
function assertEditable(fileConfig, path, key, { configFile, force }) {
|
|
2511
|
+
if (force || fileConfig.versions === undefined)
|
|
2512
|
+
return;
|
|
2513
|
+
throw freezeFailureError("frozenEdit", { path, key, configFile }, { Code: CONFIG_CODES.ConfigFrozenEdit });
|
|
2514
|
+
}
|
|
2515
|
+
function isValidValue(def, value) {
|
|
2516
|
+
return def.validValues === undefined || def.validValues.includes(value) || (def.hiddenValues ?? []).includes(value);
|
|
2517
|
+
}
|
|
2518
|
+
function reportInvalidValue(key, value, def) {
|
|
2519
|
+
OutputFormatter.error({
|
|
2520
|
+
Result: RESULTS.ValidationError,
|
|
2521
|
+
Code: CONFIG_CODES.ConfigInvalidValue,
|
|
2522
|
+
Message: `Invalid value '${value}' for '${key}'`,
|
|
2523
|
+
Instructions: `Valid values: ${def.validValues?.join(", ")}`
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2526
|
+
async function setValue(path, key, value, options) {
|
|
2527
|
+
const def = CONFIG_KEYS[key];
|
|
2528
|
+
await withConfigLock(path, async () => {
|
|
2529
|
+
const rawConfig = await readConfigFileOrReadError(path);
|
|
2530
|
+
const problem = key === "updateChannel" ? channelOffPinMessage(readVersions(rawConfig).cli, value) : undefined;
|
|
2531
|
+
if (problem !== undefined) {
|
|
2532
|
+
throw freezeFailureError("channelOffPin", { problem, configFile: options.configFile }, { Code: CONFIG_CODES.ConfigChannelOffPin });
|
|
2533
|
+
}
|
|
2534
|
+
assertEditable(rawConfig, path, key, options);
|
|
2535
|
+
setNestedValue(rawConfig, def.path, value);
|
|
2536
|
+
await writeConfigFileAt(path, rawConfig);
|
|
2537
|
+
});
|
|
2538
|
+
}
|
|
2539
|
+
async function clearValue(path, key, options) {
|
|
2540
|
+
return withConfigLock(path, async () => {
|
|
2541
|
+
const rawConfig = await readConfigFileOrReadError(path);
|
|
2542
|
+
const had = deleteNestedValue(rawConfig, CONFIG_KEYS[key].path);
|
|
2543
|
+
if (had) {
|
|
2544
|
+
assertEditable(rawConfig, path, key, options);
|
|
2545
|
+
await writeConfigFileAt(path, rawConfig);
|
|
2546
|
+
}
|
|
2547
|
+
return had;
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
function printConfig(key, rawConfig) {
|
|
2551
|
+
if (key !== undefined) {
|
|
2552
|
+
const def = CONFIG_KEYS[key];
|
|
2553
|
+
const value = getNestedValue(rawConfig, def.path);
|
|
2554
|
+
const display = value === undefined ? "-" : isSensitiveKey(def.path[1]) ? REDACTED_VALUE : String(value);
|
|
2555
|
+
OutputFormatter.success({
|
|
2556
|
+
Result: RESULTS.Success,
|
|
2557
|
+
Code: "ConfigGet",
|
|
2558
|
+
Data: { Key: key, Value: display }
|
|
2559
|
+
});
|
|
2560
|
+
return;
|
|
2561
|
+
}
|
|
2562
|
+
OutputFormatter.success({
|
|
2563
|
+
Result: RESULTS.Success,
|
|
2564
|
+
Code: "ConfigList",
|
|
2565
|
+
Data: {
|
|
2566
|
+
Config: redactSecretsDeep(rawConfig)
|
|
2567
|
+
}
|
|
2568
|
+
}, { preserveDataKeys: ["Versions"] });
|
|
2569
|
+
}
|
|
2570
|
+
function registerConfigCommand(program, context, state) {
|
|
1776
2571
|
const config = program.command("config").description("View or update CLI configuration preferences");
|
|
1777
2572
|
config.command("get").description("Get a configuration value (reads <workspace>/.uipath/config.json walking up to $HOME, then ~/.uipath/config.json)").argument("[key]", `Config key (${VALID_KEY_NAMES.join(", ")}). Omit to show all.`).option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_GET_EXAMPLES).trackedAction(context, async (key, options) => {
|
|
1778
2573
|
if (key !== undefined && !Object.hasOwn(CONFIG_KEYS, key)) {
|
|
1779
|
-
|
|
1780
|
-
Result: RESULTS.ValidationError,
|
|
1781
|
-
Message: `Unknown config key '${key}'`,
|
|
1782
|
-
Instructions: `Valid keys: ${VALID_KEY_NAMES.join(", ")}`
|
|
1783
|
-
});
|
|
1784
|
-
context.exit(1);
|
|
2574
|
+
reportInvalidKey(key, "get");
|
|
1785
2575
|
return;
|
|
1786
2576
|
}
|
|
1787
2577
|
const resolved = await resolveForRead(options.configFile);
|
|
1788
2578
|
if (resolved.error) {
|
|
1789
|
-
|
|
1790
|
-
Result: RESULTS.Failure,
|
|
1791
|
-
Message: resolved.error,
|
|
1792
|
-
Instructions: "Pass --config-file <path> with a valid path, or omit it to use discovery."
|
|
1793
|
-
});
|
|
2579
|
+
reportFreezeFailureError(configFilePathFailure(resolved.error));
|
|
1794
2580
|
context.exit(1);
|
|
1795
2581
|
return;
|
|
1796
2582
|
}
|
|
1797
2583
|
const path = resolved.result?.path;
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
OutputFormatter.error({
|
|
1801
|
-
Result: RESULTS.Failure,
|
|
1802
|
-
Message: "Failed to read configuration file",
|
|
1803
|
-
Instructions: readError.message
|
|
1804
|
-
});
|
|
1805
|
-
context.exit(1);
|
|
2584
|
+
if (path === undefined) {
|
|
2585
|
+
printConfig(key, {});
|
|
1806
2586
|
return;
|
|
1807
2587
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
const display = value === undefined ? "-" : isSensitiveKey(def.path[1]) ? REDACTED_VALUE : String(value);
|
|
1812
|
-
const data = { Key: key, Value: display };
|
|
1813
|
-
OutputFormatter.success({
|
|
1814
|
-
Result: RESULTS.Success,
|
|
1815
|
-
Code: "ConfigGet",
|
|
1816
|
-
Data: data
|
|
1817
|
-
});
|
|
2588
|
+
const [readError, rawConfig] = await catchError(readConfigFileOrReadError(path));
|
|
2589
|
+
if (readError) {
|
|
2590
|
+
await reportConfigFileError(readError, path, options.configFile);
|
|
1818
2591
|
return;
|
|
1819
2592
|
}
|
|
1820
|
-
|
|
1821
|
-
Result: RESULTS.Success,
|
|
1822
|
-
Code: "ConfigList",
|
|
1823
|
-
Data: {
|
|
1824
|
-
Config: redactSecretsDeep(rawConfig)
|
|
1825
|
-
}
|
|
1826
|
-
});
|
|
2593
|
+
printConfig(key, rawConfig);
|
|
1827
2594
|
}, getTelemetryProperties);
|
|
1828
|
-
config.command("set").description("Set a configuration value (writes to the discovered file, or to ~/.uipath/config.json by default)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).argument("<value>", "New value").option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_SET_EXAMPLES).trackedAction(context, async (key,
|
|
2595
|
+
config.command("set").description("Set a configuration value (writes to the discovered file, or to ~/.uipath/config.json by default)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).argument("<value>", "New value").option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").option("--force", "Change the value even when the config is frozen").examples(CONFIG_SET_EXAMPLES).trackedAction(context, async (key, value, options) => {
|
|
1829
2596
|
if (!Object.hasOwn(CONFIG_KEYS, key)) {
|
|
1830
|
-
|
|
1831
|
-
Result: RESULTS.ValidationError,
|
|
1832
|
-
Message: `Unknown config key '${key}'`,
|
|
1833
|
-
Instructions: `Valid keys: ${VALID_KEY_NAMES.join(", ")}`
|
|
1834
|
-
});
|
|
1835
|
-
context.exit(1);
|
|
2597
|
+
reportInvalidKey(key, "set");
|
|
1836
2598
|
return;
|
|
1837
2599
|
}
|
|
1838
2600
|
const def = CONFIG_KEYS[key];
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
OutputFormatter.error({
|
|
1842
|
-
Result: RESULTS.ValidationError,
|
|
1843
|
-
Message: `Invalid value '${value}' for '${key}'`,
|
|
1844
|
-
Instructions: `Valid values: ${def.validValues.join(", ")}`
|
|
1845
|
-
});
|
|
2601
|
+
if (!isValidValue(def, value)) {
|
|
2602
|
+
reportInvalidValue(key, value, def);
|
|
1846
2603
|
context.exit(1);
|
|
1847
2604
|
return;
|
|
1848
2605
|
}
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
Message: `Invalid value '${value}' for '${key}'`,
|
|
1853
|
-
Instructions: def.valueHint ?? "See documentation for valid values."
|
|
1854
|
-
});
|
|
2606
|
+
const target = await resolveConfigWriteTargetAsync(options.configFile);
|
|
2607
|
+
if (target.error) {
|
|
2608
|
+
reportFreezeFailureError(configFilePathFailure(target.error));
|
|
1855
2609
|
context.exit(1);
|
|
1856
2610
|
return;
|
|
1857
2611
|
}
|
|
1858
|
-
const
|
|
1859
|
-
const [opErr] = await catchError(withConfigLock(target.path, async () => {
|
|
1860
|
-
const rawConfig = await readConfigFileAt(target.path);
|
|
1861
|
-
setNestedValue(rawConfig, def.path, value);
|
|
1862
|
-
await writeConfigFileAt(target.path, rawConfig);
|
|
1863
|
-
}));
|
|
2612
|
+
const [opErr] = await catchError(setValue(target.path, key, value, options));
|
|
1864
2613
|
if (opErr) {
|
|
1865
|
-
|
|
1866
|
-
Result: RESULTS.Failure,
|
|
1867
|
-
Message: "Failed to update configuration file",
|
|
1868
|
-
Instructions: opErr.message
|
|
1869
|
-
});
|
|
1870
|
-
context.exit(1);
|
|
2614
|
+
await reportConfigFileError(opErr, target.path, options.configFile);
|
|
1871
2615
|
return;
|
|
1872
2616
|
}
|
|
1873
2617
|
OutputFormatter.success({
|
|
@@ -1880,28 +2624,19 @@ function registerConfigCommand(program, context) {
|
|
|
1880
2624
|
}
|
|
1881
2625
|
});
|
|
1882
2626
|
}, setTelemetryProperties);
|
|
1883
|
-
config.command("clear").description("Remove a configuration value (from the discovered file; no-op if it isn't set)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_CLEAR_EXAMPLES).trackedAction(context, async (key, options) => {
|
|
2627
|
+
config.command("clear").description("Remove a configuration value (from the discovered file; no-op if it isn't set)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").option("--force", "Remove the value even when the config is frozen").examples(CONFIG_CLEAR_EXAMPLES).trackedAction(context, async (key, options) => {
|
|
1884
2628
|
if (!Object.hasOwn(CONFIG_KEYS, key)) {
|
|
1885
|
-
|
|
1886
|
-
Result: RESULTS.ValidationError,
|
|
1887
|
-
Message: `Unknown config key '${key}'`,
|
|
1888
|
-
Instructions: `Valid keys: ${VALID_KEY_NAMES.join(", ")}`
|
|
1889
|
-
});
|
|
1890
|
-
context.exit(1);
|
|
2629
|
+
reportInvalidKey(key, "clear");
|
|
1891
2630
|
return;
|
|
1892
2631
|
}
|
|
1893
|
-
const def = CONFIG_KEYS[key];
|
|
1894
2632
|
const resolved = await resolveForRead(options.configFile);
|
|
1895
2633
|
if (resolved.error) {
|
|
1896
|
-
|
|
1897
|
-
Result: RESULTS.Failure,
|
|
1898
|
-
Message: resolved.error,
|
|
1899
|
-
Instructions: "Pass --config-file <path> with a valid path, or omit it to use discovery."
|
|
1900
|
-
});
|
|
2634
|
+
reportFreezeFailureError(configFilePathFailure(resolved.error));
|
|
1901
2635
|
context.exit(1);
|
|
1902
2636
|
return;
|
|
1903
2637
|
}
|
|
1904
|
-
|
|
2638
|
+
const path = resolved.result?.path;
|
|
2639
|
+
if (path === undefined) {
|
|
1905
2640
|
OutputFormatter.success({
|
|
1906
2641
|
Result: RESULTS.Success,
|
|
1907
2642
|
Code: "ConfigClear",
|
|
@@ -1909,22 +2644,9 @@ function registerConfigCommand(program, context) {
|
|
|
1909
2644
|
});
|
|
1910
2645
|
return;
|
|
1911
2646
|
}
|
|
1912
|
-
const
|
|
1913
|
-
const [opErr, existed] = await catchError(withConfigLock(targetPath, async () => {
|
|
1914
|
-
const rawConfig = await readConfigFileAt(targetPath);
|
|
1915
|
-
const had = deleteNestedValue(rawConfig, def.path);
|
|
1916
|
-
if (had) {
|
|
1917
|
-
await writeConfigFileAt(targetPath, rawConfig);
|
|
1918
|
-
}
|
|
1919
|
-
return had;
|
|
1920
|
-
}));
|
|
2647
|
+
const [opErr, existed] = await catchError(clearValue(path, key, options));
|
|
1921
2648
|
if (opErr) {
|
|
1922
|
-
|
|
1923
|
-
Result: RESULTS.Failure,
|
|
1924
|
-
Message: "Failed to update configuration file",
|
|
1925
|
-
Instructions: opErr.message
|
|
1926
|
-
});
|
|
1927
|
-
context.exit(1);
|
|
2649
|
+
await reportConfigFileError(opErr, path, options.configFile);
|
|
1928
2650
|
return;
|
|
1929
2651
|
}
|
|
1930
2652
|
OutputFormatter.success({
|
|
@@ -1933,6 +2655,10 @@ function registerConfigCommand(program, context) {
|
|
|
1933
2655
|
Data: { Key: key, Status: existed ? "Cleared" : "Not set" }
|
|
1934
2656
|
});
|
|
1935
2657
|
}, clearTelemetryProperties);
|
|
2658
|
+
registerFreezeCommand(config, context, state);
|
|
2659
|
+
registerUnfreezeCommand(config, context);
|
|
2660
|
+
registerConfigExportCommand(config, context);
|
|
2661
|
+
registerImportCommand(config, context);
|
|
1936
2662
|
}
|
|
1937
2663
|
|
|
1938
2664
|
// src/commands/profiles/delete.ts
|
|
@@ -2426,7 +3152,7 @@ var LOGIN_WHICH_EXAMPLES = [
|
|
|
2426
3152
|
];
|
|
2427
3153
|
function registerLoginCommand(program, context) {
|
|
2428
3154
|
const loginCommand = program.command("login").description("Login to UiPath Cloud").option("-f, --file <folder>", "Path to credentials folder").option("--authority <url>", "Custom authority URL, e.g. https://cloud.uipath.com (default), https://govcloud.uipath.us (Public Sector), or your Automation Suite host. https:// may be omitted (cloud.uipath.com works)").option("--client-id <id>", "External application ID. Requires --client-secret or --client-assertion. Use env.ENV_NAME to read from an environment variable").option("--client-secret <secret>", "External application secret. Requires --client-id. Use env.ENV_NAME to read from an environment variable").option("--client-assertion <jwt>", "OIDC token (JWT) for federated login (workload identity), used instead of a secret. Use env.ENV_NAME to read from an environment variable (recommended). Requires --client-id").option("-s, --scope <scopes>", "Custom scopes or Application scopes (External Apps). Comma- or space-separated values.").option("-t, --tenant <name>", "Tenant name (non-interactive mode)").option("--organization <name>", "Organization logical name to pre-select during browser login (bypasses the org picker for users in multiple organizations)").option("--no-browser", "Don't open a browser; print the authorize URL and wait for the callback (for headless/automation-driven login). Blocks until the sign-in completes — when a person will do the sign-in, they should run the command themselves in their own terminal, not through an agent's shell tool").examples(LOGIN_EXAMPLES).trackedAction(context, async (options) => {
|
|
2429
|
-
const { runLogin } = await import("./handlers-
|
|
3155
|
+
const { runLogin } = await import("./handlers-rg3d62gb.js");
|
|
2430
3156
|
await runLogin(context, options);
|
|
2431
3157
|
}, (options) => ({
|
|
2432
3158
|
HasClientCredentials: !!(options.clientId && options.clientSecret),
|
|
@@ -2435,14 +3161,14 @@ function registerLoginCommand(program, context) {
|
|
|
2435
3161
|
Interactive: canPrompt()
|
|
2436
3162
|
}));
|
|
2437
3163
|
loginCommand.command("status").description("Show current login status and session information").addOption(new Option("--detailed", "Also show the scopes the access token carries").hideHelp()).examples(LOGIN_STATUS_EXAMPLES).trackedAction(context, async (options) => {
|
|
2438
|
-
const { runLoginStatus } = await import("./handlers-
|
|
3164
|
+
const { runLoginStatus } = await import("./handlers-rg3d62gb.js");
|
|
2439
3165
|
await runLoginStatus(context, options);
|
|
2440
3166
|
});
|
|
2441
3167
|
loginCommand.command("refresh").description("Refresh the access token proactively and emit a machine-readable session payload " + "(access token, org/tenant identity, expiration). Programmatic consumers (e.g. the Flow " + "VSCode extension) call this to guarantee the returned token will still be valid " + "for the next N minutes. `login status`, by contrast, is a status report — it " + "only rotates tokens incidentally when the stored access token is already past " + "its expiry, and never performs proactive refresh.").option("--login-validity <minutes>", "Refresh only if the access token expires within this many minutes. " + "Default 5. Pass 0 to skip proactive refresh and only rotate if already expired.", (raw) => parseBoundedInt(raw, "--login-validity", {
|
|
2442
3168
|
min: 0,
|
|
2443
3169
|
max: 60 * 24 * 365
|
|
2444
3170
|
}), 5).examples(LOGIN_REFRESH_EXAMPLES).trackedAction(context, async (options) => {
|
|
2445
|
-
const { runLoginRefresh } = await import("./handlers-
|
|
3171
|
+
const { runLoginRefresh } = await import("./handlers-rg3d62gb.js");
|
|
2446
3172
|
await runLoginRefresh(context, options);
|
|
2447
3173
|
}, (options) => ({
|
|
2448
3174
|
LoginValidityMinutes: options.loginValidity
|
|
@@ -2450,15 +3176,15 @@ function registerLoginCommand(program, context) {
|
|
|
2450
3176
|
registerProfilesCommand(loginCommand, context);
|
|
2451
3177
|
const tenantCommand = loginCommand.command("tenant").description("Manage tenants");
|
|
2452
3178
|
tenantCommand.command("list").description("List all available tenants").option("-f, --file <folder>", "Path to credentials folder").examples(LOGIN_TENANT_LIST_EXAMPLES).trackedAction(context, async (options) => {
|
|
2453
|
-
const { runTenantList } = await import("./handlers-
|
|
3179
|
+
const { runTenantList } = await import("./handlers-rg3d62gb.js");
|
|
2454
3180
|
await runTenantList(context, options);
|
|
2455
3181
|
});
|
|
2456
3182
|
tenantCommand.command("set").description("Set the active tenant by name").argument("<name>", "Tenant name to set as active").option("-f, --file <folder>", "Path to credentials folder").examples(LOGIN_TENANT_SET_EXAMPLES).trackedAction(context, async (name, options) => {
|
|
2457
|
-
const { runTenantSet } = await import("./handlers-
|
|
3183
|
+
const { runTenantSet } = await import("./handlers-rg3d62gb.js");
|
|
2458
3184
|
await runTenantSet(context, name, options);
|
|
2459
3185
|
}, (name) => ({ TenantName: name }));
|
|
2460
3186
|
loginCommand.command("which").description("Print the auth source uip would use for the current cwd.").examples(LOGIN_WHICH_EXAMPLES).trackedAction(context, async () => {
|
|
2461
|
-
const { runLoginWhich } = await import("./handlers-
|
|
3187
|
+
const { runLoginWhich } = await import("./handlers-rg3d62gb.js");
|
|
2462
3188
|
await runLoginWhich(context);
|
|
2463
3189
|
});
|
|
2464
3190
|
}
|
|
@@ -2526,7 +3252,7 @@ function registerLogoutCommand(program, context) {
|
|
|
2526
3252
|
function registerMcpCommand(program) {
|
|
2527
3253
|
const mcpCommand = program.command("mcp").description("Model Context Protocol (MCP) server");
|
|
2528
3254
|
mcpCommand.command("serve").description("Start the MCP server (stdio transport)").trackedAction(processContext, async () => {
|
|
2529
|
-
const { startMcpServer } = await import("./server-
|
|
3255
|
+
const { startMcpServer } = await import("./server-pxfn9w9m.js");
|
|
2530
3256
|
await startMcpServer(program);
|
|
2531
3257
|
});
|
|
2532
3258
|
}
|
|
@@ -2599,7 +3325,7 @@ async function validateSendInputs(options, attachments) {
|
|
|
2599
3325
|
Instructions: `--priority must be one of: ${VALID_PRIORITIES.join(", ")}`
|
|
2600
3326
|
};
|
|
2601
3327
|
}
|
|
2602
|
-
const { validateUrl } = await import("./feedbackPrompts-
|
|
3328
|
+
const { validateUrl } = await import("./feedbackPrompts-fc66gq0p.js");
|
|
2603
3329
|
if (options.slackThread !== undefined && validateUrl(options.slackThread) !== true) {
|
|
2604
3330
|
return {
|
|
2605
3331
|
Result: RESULTS.ValidationError,
|
|
@@ -2647,7 +3373,7 @@ async function uploadAttachments(key, sig, deviceId, attachments) {
|
|
|
2647
3373
|
return uploaded;
|
|
2648
3374
|
}
|
|
2649
3375
|
async function reviewFeedback(draft, email, attachmentCount, context) {
|
|
2650
|
-
const { confirmFeedback, isExitPrompt, promptSlackThread } = await import("./feedbackPrompts-
|
|
3376
|
+
const { confirmFeedback, isExitPrompt, promptSlackThread } = await import("./feedbackPrompts-fc66gq0p.js");
|
|
2651
3377
|
const [promptError, slackThreadUrl] = await catchError(promptSlackThread(draft.slackThreadUrl));
|
|
2652
3378
|
if (promptError) {
|
|
2653
3379
|
if (isExitPrompt(promptError)) {
|
|
@@ -2729,7 +3455,7 @@ async function resolveDescription(options) {
|
|
|
2729
3455
|
function registerFeedbackCommand(program, context) {
|
|
2730
3456
|
const feedback = program.command("feedback").description("Send bug reports and improvement suggestions");
|
|
2731
3457
|
feedback.command("send").description("Send feedback (bug report or improvement suggestion) to the UiPath team. Provide the description body via exactly one of --description, --description-file, or stdin.").requiredOption("--type <type>", "Feedback type: bug or improvement").requiredOption("--title <title>", "Issue title / summary").option("--description <text>", "Detailed description or steps to reproduce (single-line safe; for large multi-line bodies use --description-file or stdin)").option("--description-file <path>", "Read the description body from a file. Shell-safe for large multi-line markdown — required on Windows PowerShell, where inlining --description mangles the value").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)").option("--slack-thread <url>", "Link to a related Slack discussion to include in the ticket").examples(FEEDBACK_SEND_EXAMPLES).trackedAction(context, async (options) => {
|
|
2732
|
-
const { buildEnvironmentString, getAuthContext } = await import("./environmentInfo-
|
|
3458
|
+
const { buildEnvironmentString, getAuthContext } = await import("./environmentInfo-dyhpheza.js");
|
|
2733
3459
|
const attachments = options.attachment ?? [];
|
|
2734
3460
|
const validationError = await validateSendInputs(options, attachments);
|
|
2735
3461
|
if (validationError) {
|
|
@@ -2898,12 +3624,14 @@ function getRootDir(options) {
|
|
|
2898
3624
|
const fs = getFileSystem2();
|
|
2899
3625
|
return options.local ? fs.env.cwd() : fs.env.homedir();
|
|
2900
3626
|
}
|
|
2901
|
-
async function resolveCatalog(options) {
|
|
2902
|
-
const { getAvailableSkills, getContentStoreForRead, resolveSkillSource } = await import("./contentStore-
|
|
2903
|
-
const { buildSkillCatalog } = await import("./skillCatalog-
|
|
3627
|
+
async function resolveCatalog(options, resolveInstallPath) {
|
|
3628
|
+
const { getAvailableSkills, getContentStoreForRead, resolveSkillSource } = await import("./contentStore-z3t1yt3n.js");
|
|
3629
|
+
const { buildSkillCatalog } = await import("./skillCatalog-7gh14b4s.js");
|
|
3630
|
+
const { resolveSkillsTarget } = await import("./skillsService-wz3c21qb.js");
|
|
2904
3631
|
const rootDir = getRootDir(options);
|
|
2905
3632
|
const source = resolveSkillSource(options.repo, options.branch);
|
|
2906
|
-
const
|
|
3633
|
+
const { targetVersion, exactVersion } = await resolveSkillsTarget(source, resolveInstallPath);
|
|
3634
|
+
const storePath = await getContentStoreForRead(rootDir, source, targetVersion, exactVersion);
|
|
2907
3635
|
const shadowed = [];
|
|
2908
3636
|
const skills = await getAvailableSkills(storePath, shadowed);
|
|
2909
3637
|
const catalog = await buildSkillCatalog(skills, {
|
|
@@ -2934,8 +3662,8 @@ function parseLimit(value) {
|
|
|
2934
3662
|
return null;
|
|
2935
3663
|
return Number.parseInt(raw, 10);
|
|
2936
3664
|
}
|
|
2937
|
-
async function loadCatalogOrReport(options) {
|
|
2938
|
-
const [error, resolved] = await catchError(resolveCatalog(options));
|
|
3665
|
+
async function loadCatalogOrReport(options, resolveInstallPath) {
|
|
3666
|
+
const [error, resolved] = await catchError(resolveCatalog(options, resolveInstallPath));
|
|
2939
3667
|
if (error) {
|
|
2940
3668
|
if (error instanceof SkillSourceError)
|
|
2941
3669
|
throw error;
|
|
@@ -2952,9 +3680,9 @@ async function loadCatalogOrReport(options) {
|
|
|
2952
3680
|
}
|
|
2953
3681
|
return resolved;
|
|
2954
3682
|
}
|
|
2955
|
-
function registerCatalogCommands(skillsCommand) {
|
|
3683
|
+
function registerCatalogCommands(skillsCommand, resolveInstallPath) {
|
|
2956
3684
|
skillsCommand.command("list").description("List available UiPath skills.").option("--local", "Read the current project's local skills store").option("--repo <url>", "List skills from another repo (GitHub owner/repo, https/git URL, or a local directory like ./skills). Defaults to the UiPath skills repository.").option("--branch <name>", "Branch to fetch from --repo").examples(SKILLS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
2957
|
-
const resolved = await loadCatalogOrReport(options);
|
|
3685
|
+
const resolved = await loadCatalogOrReport(options, resolveInstallPath);
|
|
2958
3686
|
if (!resolved)
|
|
2959
3687
|
return;
|
|
2960
3688
|
OutputFormatter.success({
|
|
@@ -2983,10 +3711,10 @@ function registerCatalogCommands(skillsCommand) {
|
|
|
2983
3711
|
processContext.exit(1);
|
|
2984
3712
|
return;
|
|
2985
3713
|
}
|
|
2986
|
-
const resolved = await loadCatalogOrReport(options);
|
|
3714
|
+
const resolved = await loadCatalogOrReport(options, resolveInstallPath);
|
|
2987
3715
|
if (!resolved)
|
|
2988
3716
|
return;
|
|
2989
|
-
const { searchSkillCatalog } = await import("./skillCatalog-
|
|
3717
|
+
const { searchSkillCatalog } = await import("./skillCatalog-7gh14b4s.js");
|
|
2990
3718
|
const skills = searchSkillCatalog(resolved.catalog, query).slice(0, limit);
|
|
2991
3719
|
OutputFormatter.success({
|
|
2992
3720
|
Result: RESULTS.Success,
|
|
@@ -3005,7 +3733,7 @@ function registerCatalogCommands(skillsCommand) {
|
|
|
3005
3733
|
});
|
|
3006
3734
|
});
|
|
3007
3735
|
skillsCommand.command("show").description("Show one available UiPath skill catalog entry.").argument("<name>", "Skill name").option("--local", "Read the current project's local skills store").option("--repo <url>", "Show a skill from another repo (GitHub owner/repo, https/git URL, or a local directory like ./skills). Defaults to the UiPath skills repository.").option("--branch <name>", "Branch to fetch from --repo").examples(SKILLS_SHOW_EXAMPLES).trackedAction(processContext, async (name, options) => {
|
|
3008
|
-
const resolved = await loadCatalogOrReport(options);
|
|
3736
|
+
const resolved = await loadCatalogOrReport(options, resolveInstallPath);
|
|
3009
3737
|
if (!resolved)
|
|
3010
3738
|
return;
|
|
3011
3739
|
const normalizedName = name.trim().toLowerCase();
|
|
@@ -3086,12 +3814,12 @@ var SKILLS_INSTALL_EXAMPLES = [
|
|
|
3086
3814
|
}
|
|
3087
3815
|
}
|
|
3088
3816
|
];
|
|
3089
|
-
function registerInstallCommand(skillsCommand) {
|
|
3817
|
+
function registerInstallCommand(skillsCommand, resolveInstallPath) {
|
|
3090
3818
|
skillsCommand.command("install").description(`Download UiPath skills from the configured npm registry and install
|
|
3091
3819
|
` + `them for your coding agents. Pass --repo to install from another
|
|
3092
3820
|
` + "GitHub/git repository or a local directory instead.").option("--agent <agent>", `Target agent: ${ALL_AGENTS.join(", ")}`).option("--skip-if-no-agent", "Exit successfully without installing when no supported agent is detected").option("--local", "Install to current project instead of globally").option("--path <dir>", "Install to a specific project directory (implies --local)").option("--repo <url>", "Install from another skills repo (GitHub owner/repo, https/git URL, or a local directory like ./skills). Defaults to the UiPath skills repository.").option("--branch <name>", "Branch to fetch from --repo (defaults to the repo's default branch)").option("--force", "Reinstall from a clean state (resets the Claude Code marketplace registration and plugin cache)").examples(SKILLS_INSTALL_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
3093
|
-
const { resolveSkillsContext, runAgentInstalls, SkillsError } = await import("./skillsService-
|
|
3094
|
-
const [contextError, resolved] = await catchError(resolveSkillsContext(options, "install"));
|
|
3821
|
+
const { resolveSkillsContext, runAgentInstalls, SkillsError } = await import("./skillsService-wz3c21qb.js");
|
|
3822
|
+
const [contextError, resolved] = await catchError(resolveSkillsContext(options, "install", resolveInstallPath));
|
|
3095
3823
|
if (contextError || !resolved) {
|
|
3096
3824
|
if (contextError) {
|
|
3097
3825
|
if (contextError.exitCode === 130) {
|
|
@@ -3207,7 +3935,7 @@ async function resolveAgents(options, isLocal, isDefaultSource) {
|
|
|
3207
3935
|
processContext.exit(1);
|
|
3208
3936
|
return HANDLED;
|
|
3209
3937
|
}
|
|
3210
|
-
const { promptAgentSelection } = await import("./prompt-
|
|
3938
|
+
const { promptAgentSelection } = await import("./prompt-66bnttv7.js");
|
|
3211
3939
|
const [agentErr, selected] = await catchError(promptAgentSelection("uninstall", isLocal));
|
|
3212
3940
|
if (agentErr) {
|
|
3213
3941
|
if (agentErr instanceof Error && agentErr.name === "ExitPromptError") {
|
|
@@ -3219,7 +3947,7 @@ async function resolveAgents(options, isLocal, isDefaultSource) {
|
|
|
3219
3947
|
return selected;
|
|
3220
3948
|
}
|
|
3221
3949
|
async function readSkillNames(storePath) {
|
|
3222
|
-
const { readManifest } = await import("./contentStore-
|
|
3950
|
+
const { readManifest } = await import("./contentStore-z3t1yt3n.js");
|
|
3223
3951
|
const [manifestErr, manifest] = await catchError(readManifest(storePath));
|
|
3224
3952
|
if (manifestErr || !manifest) {
|
|
3225
3953
|
OutputFormatter.error({
|
|
@@ -3273,7 +4001,7 @@ async function uninstallForAgent(targetAgent, ctx, uninstalled) {
|
|
|
3273
4001
|
}
|
|
3274
4002
|
uninstalled.push(`${targetAgent}:${name}`);
|
|
3275
4003
|
}
|
|
3276
|
-
const { readExtraFiles } = await import("./contentStore-
|
|
4004
|
+
const { readExtraFiles } = await import("./contentStore-z3t1yt3n.js");
|
|
3277
4005
|
const [, ownedExtra] = await catchError(readExtraFiles(storePath, targetAgent));
|
|
3278
4006
|
const [extraError] = await catchError(uninstallExtraFolders(skillsDir, ownedExtra ?? []));
|
|
3279
4007
|
if (extraError) {
|
|
@@ -3285,7 +4013,7 @@ async function uninstallForAgent(targetAgent, ctx, uninstalled) {
|
|
|
3285
4013
|
return HANDLED;
|
|
3286
4014
|
}
|
|
3287
4015
|
if (isDefaultSource) {
|
|
3288
|
-
const { removeSkillCatalog } = await import("./skillCatalog-
|
|
4016
|
+
const { removeSkillCatalog } = await import("./skillCatalog-7gh14b4s.js");
|
|
3289
4017
|
const [catalogError] = await catchError(removeSkillCatalog(skillsDir));
|
|
3290
4018
|
if (catalogError) {
|
|
3291
4019
|
OutputFormatter.error({
|
|
@@ -3301,8 +4029,8 @@ async function uninstallForAgent(targetAgent, ctx, uninstalled) {
|
|
|
3301
4029
|
}
|
|
3302
4030
|
function registerUninstallCommand(skillsCommand) {
|
|
3303
4031
|
skillsCommand.command("uninstall").description("Remove previously installed skills from agent configurations.").option("--agent <agent>", `Target agent: ${ALL_AGENTS.join(", ")}`).option("--local", "Uninstall from current project instead of globally").option("--path <dir>", "Uninstall from a specific project directory (implies --local)").option("--repo <url>", "Uninstall skills previously installed from another repo. Defaults to the UiPath skills repository.").option("--branch <name>", "Branch that was used with --repo").examples(SKILLS_UNINSTALL_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
3304
|
-
const { removeFromManifest, resolveSkillSource } = await import("./contentStore-
|
|
3305
|
-
const { resolveRootDir } = await import("./skillsService-
|
|
4032
|
+
const { removeFromManifest, resolveSkillSource } = await import("./contentStore-z3t1yt3n.js");
|
|
4033
|
+
const { resolveRootDir } = await import("./skillsService-wz3c21qb.js");
|
|
3306
4034
|
const root = await resolveRootDir(options);
|
|
3307
4035
|
if (!root)
|
|
3308
4036
|
return;
|
|
@@ -3383,15 +4111,15 @@ var SKILLS_UPDATE_EXAMPLES = [
|
|
|
3383
4111
|
}
|
|
3384
4112
|
}
|
|
3385
4113
|
];
|
|
3386
|
-
function registerUpdateCommand(skillsCommand) {
|
|
3387
|
-
skillsCommand.command("update").description("Re-fetch UiPath skills from the configured npm registry and reinstall the latest patch
|
|
3388
|
-
const { runSkillsUpdate } = await import("./updateService.skills-
|
|
3389
|
-
const { resolveSkillSource } = await import("./contentStore-
|
|
3390
|
-
const {
|
|
4114
|
+
function registerUpdateCommand(skillsCommand, resolveInstallPath) {
|
|
4115
|
+
skillsCommand.command("update").description("Re-fetch UiPath skills from the configured npm registry and reinstall the versions.skills version, else the latest patch on the line of the CLI pin, else on this CLI's line.").option("--agent <agent>", `Target agent: ${ALL_AGENTS.join(", ")}`).option("--local", "Update in current project instead of globally").option("--path <dir>", "Update skills in a specific project directory (implies --local)").option("--repo <url>", "Update skills previously installed from another repo. Defaults to the UiPath skills repository.").option("--branch <name>", "Branch to fetch from --repo").option("--force", "Reinstall from a clean state (resets the Claude Code marketplace registration and plugin cache)").examples(SKILLS_UPDATE_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
4116
|
+
const { runSkillsUpdate } = await import("./updateService.skills-pgst1fyj.js");
|
|
4117
|
+
const { resolveSkillSource } = await import("./contentStore-z3t1yt3n.js");
|
|
4118
|
+
const { resolveSkillsTarget } = await import("./skillsService-wz3c21qb.js");
|
|
3391
4119
|
const local = options.local === true;
|
|
3392
4120
|
const [err, report] = await catchError((async () => {
|
|
3393
4121
|
const source = resolveSkillSource(options.repo, options.branch);
|
|
3394
|
-
const targetVersion =
|
|
4122
|
+
const { targetVersion, exactVersion } = await resolveSkillsTarget(source, resolveInstallPath);
|
|
3395
4123
|
return runSkillsUpdate({
|
|
3396
4124
|
dryRun: false,
|
|
3397
4125
|
agent: options.agent,
|
|
@@ -3400,7 +4128,8 @@ function registerUpdateCommand(skillsCommand) {
|
|
|
3400
4128
|
repo: options.repo,
|
|
3401
4129
|
branch: options.branch,
|
|
3402
4130
|
force: options.force,
|
|
3403
|
-
targetVersion
|
|
4131
|
+
targetVersion,
|
|
4132
|
+
skillsVersion: exactVersion
|
|
3404
4133
|
});
|
|
3405
4134
|
})());
|
|
3406
4135
|
if (err) {
|
|
@@ -3431,7 +4160,9 @@ function registerUpdateCommand(skillsCommand) {
|
|
|
3431
4160
|
OutputFormatter.error({
|
|
3432
4161
|
Result: section.error.result,
|
|
3433
4162
|
Message: section.error.message,
|
|
3434
|
-
Instructions: section.error.instructions
|
|
4163
|
+
Instructions: section.error.instructions,
|
|
4164
|
+
ErrorCode: section.error.errorCode,
|
|
4165
|
+
Retry: section.error.retry
|
|
3435
4166
|
});
|
|
3436
4167
|
processContext.exit(EXIT_CODES[section.error.result] ?? EXIT_CODES.Failure);
|
|
3437
4168
|
return;
|
|
@@ -3471,7 +4202,7 @@ function getAgentsTable() {
|
|
|
3471
4202
|
].join(`
|
|
3472
4203
|
`);
|
|
3473
4204
|
}
|
|
3474
|
-
function registerSkillsCommand(program) {
|
|
4205
|
+
function registerSkillsCommand(program, resolveInstallPath) {
|
|
3475
4206
|
const skillsCommand = program.command("skills").description(`Install and manage UiPath skills for AI coding agents.
|
|
3476
4207
|
|
|
3477
4208
|
` + `Skills teach AI coding agents how to build UiPath automations, agents,
|
|
@@ -3482,9 +4213,9 @@ function registerSkillsCommand(program) {
|
|
|
3482
4213
|
` + `another GitHub/git repository instead of UiPath; they are file-copied into
|
|
3483
4214
|
` + `the chosen agent's skills directory.
|
|
3484
4215
|
` + getAgentsTable());
|
|
3485
|
-
registerCatalogCommands(skillsCommand);
|
|
3486
|
-
registerInstallCommand(skillsCommand);
|
|
3487
|
-
registerUpdateCommand(skillsCommand);
|
|
4216
|
+
registerCatalogCommands(skillsCommand, resolveInstallPath);
|
|
4217
|
+
registerInstallCommand(skillsCommand, resolveInstallPath);
|
|
4218
|
+
registerUpdateCommand(skillsCommand, resolveInstallPath);
|
|
3488
4219
|
registerUninstallCommand(skillsCommand);
|
|
3489
4220
|
}
|
|
3490
4221
|
|
|
@@ -3503,7 +4234,8 @@ var TOOLS_INSTALL_EXAMPLES = [
|
|
|
3503
4234
|
];
|
|
3504
4235
|
function registerInstallCommand2(toolsCommand, _context, state) {
|
|
3505
4236
|
const { resolveInstallPath, getCliVersionPrefix } = state;
|
|
3506
|
-
toolsCommand.command("install").description("Install a tool from registry").argument("<package-name>", "Name of the package to install (optionally with @version)").examples(TOOLS_INSTALL_EXAMPLES).trackedAction(processContext, async (packageArg) => {
|
|
4237
|
+
toolsCommand.command("install").description("Install a tool from registry").argument("<package-name>", "Name of the package to install (optionally with @version)").option("--force", "When this config is frozen, install a version the freeze does not have and write it into the freeze").examples(TOOLS_INSTALL_EXAMPLES).trackedAction(processContext, async (packageArg, options) => {
|
|
4238
|
+
const updatePins = await readUpdatePins(state);
|
|
3507
4239
|
const { name: rawName, version: explicitVersion } = parsePackageSpec(packageArg);
|
|
3508
4240
|
if (explicitVersion && !isValidSemver(explicitVersion)) {
|
|
3509
4241
|
OutputFormatter.error({
|
|
@@ -3522,13 +4254,16 @@ function registerInstallCommand2(toolsCommand, _context, state) {
|
|
|
3522
4254
|
});
|
|
3523
4255
|
return;
|
|
3524
4256
|
}
|
|
4257
|
+
const gate = await checkFreezeGate(state, { packageArg, packageName, requested: explicitVersion }, updatePins, options.force);
|
|
4258
|
+
if (gate === undefined)
|
|
4259
|
+
return;
|
|
3525
4260
|
let resolutionFailure;
|
|
3526
4261
|
const registryFailures = [];
|
|
3527
|
-
const [error] = await catchError((async () => {
|
|
4262
|
+
const [error, packageSpec] = await catchError((async () => {
|
|
3528
4263
|
const location = await resolveInstallPath(packageName);
|
|
3529
4264
|
let packageSpec;
|
|
3530
|
-
if (
|
|
3531
|
-
packageSpec = `${packageName}@${
|
|
4265
|
+
if (gate.version) {
|
|
4266
|
+
packageSpec = `${packageName}@${gate.version}`;
|
|
3532
4267
|
} else {
|
|
3533
4268
|
const cliPrefix = getCliVersionPrefix();
|
|
3534
4269
|
const channel = resolveRuntimeChannel();
|
|
@@ -3544,13 +4279,7 @@ function registerInstallCommand2(toolsCommand, _context, state) {
|
|
|
3544
4279
|
prefix: location.prefix
|
|
3545
4280
|
});
|
|
3546
4281
|
logger.info(`Installed to ${location.path}`);
|
|
3547
|
-
|
|
3548
|
-
Result: RESULTS.Success,
|
|
3549
|
-
Code: "Message",
|
|
3550
|
-
Data: {
|
|
3551
|
-
Message: `Successfully installed ${packageSpec}`
|
|
3552
|
-
}
|
|
3553
|
-
});
|
|
4282
|
+
return packageSpec;
|
|
3554
4283
|
})());
|
|
3555
4284
|
if (error) {
|
|
3556
4285
|
if (resolutionFailure) {
|
|
@@ -3566,21 +4295,95 @@ function registerInstallCommand2(toolsCommand, _context, state) {
|
|
|
3566
4295
|
OutputFormatter.error({
|
|
3567
4296
|
Result: RESULTS.Failure,
|
|
3568
4297
|
Message: `Failed to install '${packageName}': ${error.message}`,
|
|
3569
|
-
Instructions: error
|
|
4298
|
+
Instructions: carriedInstructions(error) ?? "Please check the package name and try again.",
|
|
4299
|
+
ErrorCode: carriedErrorCode(error),
|
|
4300
|
+
Retry: carriedRetry(error)
|
|
4301
|
+
});
|
|
4302
|
+
return;
|
|
4303
|
+
}
|
|
4304
|
+
await reportInstalled(packageName, packageSpec, gate);
|
|
4305
|
+
});
|
|
4306
|
+
}
|
|
4307
|
+
async function reportInstalled(packageName, packageSpec, { pastPin, listedPin }) {
|
|
4308
|
+
if (pastPin) {
|
|
4309
|
+
const { writeToolPin } = await import("./forcedUpdate-5hd8cp9x.js");
|
|
4310
|
+
const [pinError, written] = await catchError(writeToolPin(packageName, parsePackageSpec(packageSpec).version));
|
|
4311
|
+
if (pinError) {
|
|
4312
|
+
reportFreezeFailure("installPinNotWritten", {
|
|
4313
|
+
packageSpec,
|
|
4314
|
+
cause: await classifyError(pinError)
|
|
3570
4315
|
});
|
|
3571
4316
|
return;
|
|
3572
4317
|
}
|
|
4318
|
+
if (written.pin !== listedPin) {
|
|
4319
|
+
OutputFormatter.log({
|
|
4320
|
+
Warning: `The freeze in ${configPathForMessage(written.path)} now has ${packageName} at ${written.pin}.`
|
|
4321
|
+
});
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
OutputFormatter.success({
|
|
4325
|
+
Result: RESULTS.Success,
|
|
4326
|
+
Code: "Message",
|
|
4327
|
+
Data: {
|
|
4328
|
+
Message: `Successfully installed ${packageSpec}`
|
|
4329
|
+
}
|
|
3573
4330
|
});
|
|
3574
4331
|
}
|
|
4332
|
+
async function checkFreezeGate(state, {
|
|
4333
|
+
packageArg,
|
|
4334
|
+
packageName,
|
|
4335
|
+
requested
|
|
4336
|
+
}, { frozen, pins }, force) {
|
|
4337
|
+
const linePrefix = state.getCliVersionPrefix();
|
|
4338
|
+
const listedPin = pins.tools?.[packageName];
|
|
4339
|
+
const pastPin = frozen && (force === true || listedPin === undefined || requested !== undefined && !matchesPin(listedPin, requested));
|
|
4340
|
+
if (pastPin && requested !== undefined && !requested.startsWith(linePrefix)) {
|
|
4341
|
+
reportFreezeFailure("installOffLine", {
|
|
4342
|
+
packageName,
|
|
4343
|
+
requested,
|
|
4344
|
+
prefix: linePrefix
|
|
4345
|
+
});
|
|
4346
|
+
return;
|
|
4347
|
+
}
|
|
4348
|
+
if (pastPin && !force) {
|
|
4349
|
+
const { path } = await resolveConfigWriteTargetAsync();
|
|
4350
|
+
reportFreezeFailure("installRefused", {
|
|
4351
|
+
path,
|
|
4352
|
+
packageArg,
|
|
4353
|
+
packageName,
|
|
4354
|
+
listedPin,
|
|
4355
|
+
requested
|
|
4356
|
+
});
|
|
4357
|
+
return;
|
|
4358
|
+
}
|
|
4359
|
+
if (!pastPin && listedPin !== undefined) {
|
|
4360
|
+
return { pastPin, version: listedPin, listedPin };
|
|
4361
|
+
}
|
|
4362
|
+
return { pastPin, version: requested, listedPin };
|
|
4363
|
+
}
|
|
3575
4364
|
|
|
3576
4365
|
// src/commands/tools/list.ts
|
|
3577
4366
|
var TOOL_STATUS = {
|
|
3578
4367
|
Ok: "ok",
|
|
3579
|
-
NeedsUpdate: "needs update"
|
|
4368
|
+
NeedsUpdate: "needs update",
|
|
4369
|
+
Frozen: "frozen",
|
|
4370
|
+
OffFreeze: "off freeze"
|
|
3580
4371
|
};
|
|
4372
|
+
function freezeStatus(pin, installedVersion) {
|
|
4373
|
+
return pin !== undefined && matchesPin(pin, installedVersion) ? TOOL_STATUS.Frozen : TOOL_STATUS.OffFreeze;
|
|
4374
|
+
}
|
|
4375
|
+
async function freezePinByTool(state) {
|
|
4376
|
+
if (!await isFrozen(state.resolveInstallPath))
|
|
4377
|
+
return;
|
|
4378
|
+
const pins = (await governingPins(state.resolveInstallPath)).tools ?? {};
|
|
4379
|
+
return new Map((state.discoveredTools ?? []).map((tool) => [
|
|
4380
|
+
tool.toolName,
|
|
4381
|
+
pins[tool.packageName]
|
|
4382
|
+
]));
|
|
4383
|
+
}
|
|
3581
4384
|
var TOOLS_LIST_EXAMPLES = [
|
|
3582
4385
|
{
|
|
3583
|
-
Description: "List
|
|
4386
|
+
Description: "List installed tools and the file each one loads from",
|
|
3584
4387
|
Command: "uip tools list",
|
|
3585
4388
|
Output: {
|
|
3586
4389
|
Code: "ToolList",
|
|
@@ -3590,14 +4393,41 @@ var TOOLS_LIST_EXAMPLES = [
|
|
|
3590
4393
|
Version: "1.2.3",
|
|
3591
4394
|
Description: "UiPath Orchestrator Tool",
|
|
3592
4395
|
CommandPrefix: "or",
|
|
3593
|
-
Status: TOOL_STATUS.Ok
|
|
4396
|
+
Status: TOOL_STATUS.Ok,
|
|
4397
|
+
Path: "/usr/local/lib/node_modules/@uipath/orchestrator-tool/dist/tool.js"
|
|
3594
4398
|
},
|
|
3595
4399
|
{
|
|
3596
4400
|
Name: "agent-tool",
|
|
3597
4401
|
Version: "1.1.7",
|
|
3598
4402
|
Description: "UiPath Agent Tool",
|
|
3599
4403
|
CommandPrefix: "agent",
|
|
3600
|
-
Status: TOOL_STATUS.NeedsUpdate
|
|
4404
|
+
Status: TOOL_STATUS.NeedsUpdate,
|
|
4405
|
+
Path: "/usr/local/lib/node_modules/@uipath/agent-tool/dist/tool.js"
|
|
4406
|
+
}
|
|
4407
|
+
]
|
|
4408
|
+
}
|
|
4409
|
+
},
|
|
4410
|
+
{
|
|
4411
|
+
Description: "List installed tools when the config is frozen: a tool is frozen at its pin, else off freeze",
|
|
4412
|
+
Command: "uip tools list",
|
|
4413
|
+
Output: {
|
|
4414
|
+
Code: "ToolList",
|
|
4415
|
+
Data: [
|
|
4416
|
+
{
|
|
4417
|
+
Name: "orchestrator-tool",
|
|
4418
|
+
Version: "1.2.3",
|
|
4419
|
+
Description: "UiPath Orchestrator Tool",
|
|
4420
|
+
CommandPrefix: "or",
|
|
4421
|
+
Status: TOOL_STATUS.Frozen,
|
|
4422
|
+
Path: "/usr/local/lib/node_modules/@uipath/orchestrator-tool/dist/tool.js"
|
|
4423
|
+
},
|
|
4424
|
+
{
|
|
4425
|
+
Name: "agent-tool",
|
|
4426
|
+
Version: "1.2.1",
|
|
4427
|
+
Description: "UiPath Agent Tool",
|
|
4428
|
+
CommandPrefix: "agent",
|
|
4429
|
+
Status: TOOL_STATUS.OffFreeze,
|
|
4430
|
+
Path: "/usr/local/lib/node_modules/@uipath/agent-tool/dist/tool.js"
|
|
3601
4431
|
}
|
|
3602
4432
|
]
|
|
3603
4433
|
}
|
|
@@ -3606,16 +4436,29 @@ var TOOLS_LIST_EXAMPLES = [
|
|
|
3606
4436
|
function registerListCommand2(toolsCommand, state) {
|
|
3607
4437
|
toolsCommand.command("list").description("List installed tools").examples(TOOLS_LIST_EXAMPLES).trackedAction(processContext, async () => {
|
|
3608
4438
|
const cliVersionPrefix = state.getCliVersionPrefix();
|
|
3609
|
-
const
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
4439
|
+
const pinByTool = await freezePinByTool(state);
|
|
4440
|
+
const data = getInstalledTools(state).map(({ path, ...tool }) => {
|
|
4441
|
+
const installedVersion = tool.version ?? "";
|
|
4442
|
+
if (pinByTool) {
|
|
4443
|
+
const pin = pinByTool.get(tool.name);
|
|
4444
|
+
return {
|
|
4445
|
+
...tool,
|
|
4446
|
+
status: freezeStatus(pin, installedVersion),
|
|
4447
|
+
path
|
|
4448
|
+
};
|
|
4449
|
+
}
|
|
4450
|
+
return {
|
|
4451
|
+
...tool,
|
|
4452
|
+
status: installedVersion.startsWith(cliVersionPrefix) ? TOOL_STATUS.Ok : TOOL_STATUS.NeedsUpdate,
|
|
4453
|
+
path
|
|
4454
|
+
};
|
|
4455
|
+
});
|
|
3613
4456
|
OutputFormatter.success({
|
|
3614
4457
|
Result: RESULTS.Success,
|
|
3615
4458
|
Code: "ToolList",
|
|
3616
4459
|
Data: data
|
|
3617
4460
|
}, {
|
|
3618
|
-
tableRowStyle: (row) => row.Status === TOOL_STATUS.NeedsUpdate ? "red" : undefined
|
|
4461
|
+
tableRowStyle: (row) => row.Status === TOOL_STATUS.NeedsUpdate || row.Status === TOOL_STATUS.OffFreeze ? "red" : undefined
|
|
3619
4462
|
});
|
|
3620
4463
|
});
|
|
3621
4464
|
}
|
|
@@ -3703,7 +4546,7 @@ var TOOLS_UNINSTALL_EXAMPLES = [
|
|
|
3703
4546
|
}
|
|
3704
4547
|
];
|
|
3705
4548
|
function registerUninstallCommand2(toolsCommand, _context, state) {
|
|
3706
|
-
toolsCommand.command("uninstall").description("Uninstall an installed tool").argument("[package-name]", "Package name (e.g. @uipath/rpa-tool) or command alias (e.g. rpa)").option("--all", "Uninstall all installed tools").examples(TOOLS_UNINSTALL_EXAMPLES).trackedAction(processContext, async (packageArg, options) => {
|
|
4549
|
+
toolsCommand.command("uninstall").description("Uninstall an installed tool").argument("[package-name]", "Package name (e.g. @uipath/rpa-tool) or command alias (e.g. rpa)").option("--all", "Uninstall all installed tools").option("--force", "When this config is frozen, uninstall and remove the tool from the freeze").examples(TOOLS_UNINSTALL_EXAMPLES).trackedAction(processContext, async (packageArg, options) => {
|
|
3707
4550
|
if (options.all && packageArg) {
|
|
3708
4551
|
OutputFormatter.error({
|
|
3709
4552
|
Result: RESULTS.ValidationError,
|
|
@@ -3713,12 +4556,17 @@ function registerUninstallCommand2(toolsCommand, _context, state) {
|
|
|
3713
4556
|
processContext.exit(1);
|
|
3714
4557
|
return;
|
|
3715
4558
|
}
|
|
4559
|
+
const { frozen, pins } = await readUpdatePins(state);
|
|
4560
|
+
const freeze = {
|
|
4561
|
+
pins: frozen ? pins.tools : undefined,
|
|
4562
|
+
force: options.force === true
|
|
4563
|
+
};
|
|
3716
4564
|
if (options.all) {
|
|
3717
|
-
await uninstallAll(state);
|
|
4565
|
+
await uninstallAll(state, freeze);
|
|
3718
4566
|
return;
|
|
3719
4567
|
}
|
|
3720
4568
|
if (packageArg) {
|
|
3721
|
-
await uninstallSingle(packageArg, state);
|
|
4569
|
+
await uninstallSingle(packageArg, state, freeze);
|
|
3722
4570
|
return;
|
|
3723
4571
|
}
|
|
3724
4572
|
OutputFormatter.error({
|
|
@@ -3729,6 +4577,39 @@ function registerUninstallCommand2(toolsCommand, _context, state) {
|
|
|
3729
4577
|
processContext.exit(1);
|
|
3730
4578
|
});
|
|
3731
4579
|
}
|
|
4580
|
+
async function allowUninstall(packageNames, { pins, force }, command) {
|
|
4581
|
+
if (force || pins === undefined)
|
|
4582
|
+
return true;
|
|
4583
|
+
const listed = packageNames.some((name) => pins[name] !== undefined);
|
|
4584
|
+
const { path } = await resolveConfigWriteTargetAsync();
|
|
4585
|
+
reportFreezeFailure("uninstallRefused", {
|
|
4586
|
+
path,
|
|
4587
|
+
packageNames,
|
|
4588
|
+
command,
|
|
4589
|
+
listed
|
|
4590
|
+
});
|
|
4591
|
+
return false;
|
|
4592
|
+
}
|
|
4593
|
+
function pinsOnly(installed, { pins, force }) {
|
|
4594
|
+
if (!force || pins === undefined)
|
|
4595
|
+
return [];
|
|
4596
|
+
return Object.keys(pins).filter((name) => !installed.includes(name));
|
|
4597
|
+
}
|
|
4598
|
+
async function unpin(packageNames, { pins, force }) {
|
|
4599
|
+
const pinned = packageNames.filter((name) => pins?.[name] !== undefined);
|
|
4600
|
+
if (!force || pinned.length === 0)
|
|
4601
|
+
return;
|
|
4602
|
+
const { removeToolPins } = await import("./forcedUpdate-5hd8cp9x.js");
|
|
4603
|
+
const [error, path] = await catchError(removeToolPins(pinned));
|
|
4604
|
+
if (error)
|
|
4605
|
+
return { pinned, cause: await classifyError(error) };
|
|
4606
|
+
for (const name of pinned) {
|
|
4607
|
+
OutputFormatter.log({
|
|
4608
|
+
Warning: `The freeze in ${configPathForMessage(path)} no longer lists ${name}.`
|
|
4609
|
+
});
|
|
4610
|
+
}
|
|
4611
|
+
return;
|
|
4612
|
+
}
|
|
3732
4613
|
async function runUninstall(packageName, location) {
|
|
3733
4614
|
const [error] = await catchError(toolService.uninstall(packageName, location.path, {
|
|
3734
4615
|
global: location.global,
|
|
@@ -3742,14 +4623,16 @@ async function resolveLocation(state) {
|
|
|
3742
4623
|
OutputFormatter.error({
|
|
3743
4624
|
Result: RESULTS.ConfigError,
|
|
3744
4625
|
Message: error.message,
|
|
3745
|
-
Instructions: "Please ensure the CLI is installed correctly."
|
|
4626
|
+
Instructions: carriedInstructions(error) ?? "Please ensure the CLI is installed correctly.",
|
|
4627
|
+
ErrorCode: carriedErrorCode(error),
|
|
4628
|
+
Retry: carriedRetry(error)
|
|
3746
4629
|
});
|
|
3747
4630
|
processContext.exit(1);
|
|
3748
4631
|
return;
|
|
3749
4632
|
}
|
|
3750
4633
|
return location;
|
|
3751
4634
|
}
|
|
3752
|
-
async function uninstallSingle(packageArg, state) {
|
|
4635
|
+
async function uninstallSingle(packageArg, state, freeze) {
|
|
3753
4636
|
const packageName = resolveToolPackageName(packageArg);
|
|
3754
4637
|
if (!TOOLS_WHITELIST.has(packageName)) {
|
|
3755
4638
|
OutputFormatter.error({
|
|
@@ -3760,6 +4643,14 @@ async function uninstallSingle(packageArg, state) {
|
|
|
3760
4643
|
processContext.exit(1);
|
|
3761
4644
|
return;
|
|
3762
4645
|
}
|
|
4646
|
+
if (!await allowUninstall([packageName], freeze, `uip tools uninstall ${packageArg}`)) {
|
|
4647
|
+
return;
|
|
4648
|
+
}
|
|
4649
|
+
const installed = getInstalledTools(state).map((tool) => toolPackageName(tool.name));
|
|
4650
|
+
if (pinsOnly(installed, freeze).includes(packageName)) {
|
|
4651
|
+
await removePinOnly(packageName, freeze);
|
|
4652
|
+
return;
|
|
4653
|
+
}
|
|
3763
4654
|
const location = await resolveLocation(state);
|
|
3764
4655
|
if (!location)
|
|
3765
4656
|
return;
|
|
@@ -3768,20 +4659,49 @@ async function uninstallSingle(packageArg, state) {
|
|
|
3768
4659
|
OutputFormatter.error({
|
|
3769
4660
|
Result: RESULTS.Failure,
|
|
3770
4661
|
Message: `Failed to uninstall '${packageName}': ${error.message}`,
|
|
3771
|
-
Instructions: error
|
|
4662
|
+
Instructions: carriedInstructions(error) ?? "Use 'uip tools list' to see installed tools.",
|
|
4663
|
+
ErrorCode: carriedErrorCode(error),
|
|
4664
|
+
Retry: carriedRetry(error)
|
|
3772
4665
|
});
|
|
3773
4666
|
processContext.exit(1);
|
|
3774
4667
|
return;
|
|
3775
4668
|
}
|
|
4669
|
+
const unpinFailure = await unpin([packageName], freeze);
|
|
4670
|
+
if (unpinFailure) {
|
|
4671
|
+
reportFreezeFailure("uninstallPinNotRemoved", {
|
|
4672
|
+
uninstalled: [packageName],
|
|
4673
|
+
...unpinFailure
|
|
4674
|
+
});
|
|
4675
|
+
return;
|
|
4676
|
+
}
|
|
3776
4677
|
OutputFormatter.success({
|
|
3777
4678
|
Result: RESULTS.Success,
|
|
3778
4679
|
Code: "Message",
|
|
3779
4680
|
Data: { Message: `Successfully uninstalled ${packageName}` }
|
|
3780
4681
|
});
|
|
3781
4682
|
}
|
|
3782
|
-
async function
|
|
4683
|
+
async function removePinOnly(packageName, freeze) {
|
|
4684
|
+
const unpinFailure = await unpin([packageName], freeze);
|
|
4685
|
+
if (unpinFailure) {
|
|
4686
|
+
reportFreezeFailure("uninstallPinNotRemoved", {
|
|
4687
|
+
uninstalled: [],
|
|
4688
|
+
...unpinFailure
|
|
4689
|
+
});
|
|
4690
|
+
return;
|
|
4691
|
+
}
|
|
4692
|
+
OutputFormatter.success({
|
|
4693
|
+
Result: RESULTS.Success,
|
|
4694
|
+
Code: "Message",
|
|
4695
|
+
Data: {
|
|
4696
|
+
Message: `${packageName} was not installed, so only its pin was removed.`
|
|
4697
|
+
}
|
|
4698
|
+
});
|
|
4699
|
+
}
|
|
4700
|
+
async function uninstallAll(state, freeze) {
|
|
3783
4701
|
const installed = getInstalledTools(state);
|
|
3784
|
-
|
|
4702
|
+
const packageNames = installed.map((tool) => toolPackageName(tool.name));
|
|
4703
|
+
const notInstalled = pinsOnly(packageNames, freeze);
|
|
4704
|
+
if (installed.length === 0 && notInstalled.length === 0) {
|
|
3785
4705
|
OutputFormatter.error({
|
|
3786
4706
|
Result: RESULTS.ConfigError,
|
|
3787
4707
|
Message: "No tools installed.",
|
|
@@ -3790,19 +4710,44 @@ async function uninstallAll(state) {
|
|
|
3790
4710
|
processContext.exit(1);
|
|
3791
4711
|
return;
|
|
3792
4712
|
}
|
|
3793
|
-
|
|
3794
|
-
if (!location)
|
|
4713
|
+
if (!await allowUninstall(packageNames, freeze, "uip tools uninstall --all")) {
|
|
3795
4714
|
return;
|
|
4715
|
+
}
|
|
3796
4716
|
const results = [];
|
|
3797
|
-
|
|
3798
|
-
const
|
|
3799
|
-
|
|
4717
|
+
if (installed.length > 0) {
|
|
4718
|
+
const location = await resolveLocation(state);
|
|
4719
|
+
if (!location)
|
|
4720
|
+
return;
|
|
4721
|
+
for (const tool of installed) {
|
|
4722
|
+
const error = await runUninstall(`@uipath/${tool.name}`, location);
|
|
4723
|
+
results.push(!error ? { name: tool.name, status: "uninstalled" } : error instanceof HostOwnedToolError ? {
|
|
4724
|
+
name: tool.name,
|
|
4725
|
+
status: "skipped",
|
|
4726
|
+
error: error.message
|
|
4727
|
+
} : {
|
|
4728
|
+
name: tool.name,
|
|
4729
|
+
status: "failed",
|
|
4730
|
+
error: error.message
|
|
4731
|
+
});
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
const uninstalled = results.filter((row) => row.status === "uninstalled").map((row) => toolPackageName(row.name));
|
|
4735
|
+
const unpinFailure = await unpin([...uninstalled, ...notInstalled], freeze);
|
|
4736
|
+
for (const name of notInstalled) {
|
|
4737
|
+
results.push({
|
|
4738
|
+
name: toolShortName(name),
|
|
4739
|
+
status: unpinFailure ? "not installed" : "not installed, pin removed"
|
|
4740
|
+
});
|
|
4741
|
+
}
|
|
4742
|
+
if (unpinFailure) {
|
|
4743
|
+
reportFreezeFailure("uninstallPinNotRemoved", { uninstalled, ...unpinFailure }, { Code: "UninstallResult", Data: pascalCaseDataKeys(results) });
|
|
4744
|
+
} else {
|
|
4745
|
+
OutputFormatter.success({
|
|
4746
|
+
Result: RESULTS.Success,
|
|
4747
|
+
Code: "UninstallResult",
|
|
4748
|
+
Data: results
|
|
4749
|
+
});
|
|
3800
4750
|
}
|
|
3801
|
-
OutputFormatter.success({
|
|
3802
|
-
Result: RESULTS.Success,
|
|
3803
|
-
Code: "UninstallResult",
|
|
3804
|
-
Data: results
|
|
3805
|
-
});
|
|
3806
4751
|
const failed = results.filter((r) => r.status === "failed");
|
|
3807
4752
|
if (failed.length > 0) {
|
|
3808
4753
|
logger.error(`Failed to uninstall ${failed.length} tool(s): ${failed.map((f) => `${f.name}: ${f.error}`).join("; ")}`);
|
|
@@ -3821,11 +4766,13 @@ async function startSpinner(text) {
|
|
|
3821
4766
|
|
|
3822
4767
|
// src/services/versionTarget.ts
|
|
3823
4768
|
function resolveEffectiveTarget() {
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
4769
|
+
return { pin: null, origin: "latest" };
|
|
4770
|
+
}
|
|
4771
|
+
async function resolveUpdateTarget(resolveInstallPath) {
|
|
4772
|
+
const pin = parseVersionPin((await governingPins(resolveInstallPath)).cli);
|
|
4773
|
+
if (!pin)
|
|
4774
|
+
return resolveEffectiveTarget();
|
|
4775
|
+
return { pin, origin: "config" };
|
|
3829
4776
|
}
|
|
3830
4777
|
|
|
3831
4778
|
// src/commands/tools/update.ts
|
|
@@ -3852,22 +4799,37 @@ var TOOLS_UPDATE_EXAMPLES = [
|
|
|
3852
4799
|
}
|
|
3853
4800
|
}
|
|
3854
4801
|
];
|
|
4802
|
+
function reportNothingListed(pins, name, nameListed) {
|
|
4803
|
+
const nothing = pins && nothingListed(pins, name, nameListed);
|
|
4804
|
+
if (!nothing)
|
|
4805
|
+
return false;
|
|
4806
|
+
OutputFormatter.log({ Warning: nothing.warning });
|
|
4807
|
+
OutputFormatter.success({
|
|
4808
|
+
Result: RESULTS.Success,
|
|
4809
|
+
Code: "UpdateResult",
|
|
4810
|
+
Data: [],
|
|
4811
|
+
Instructions: nothing.instructions
|
|
4812
|
+
});
|
|
4813
|
+
return true;
|
|
4814
|
+
}
|
|
3855
4815
|
function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
3856
4816
|
toolsCommand.command("update").description("Update installed tools within the active version line").option("--name <scoped-tool-name>", "scoped package name").examples(TOOLS_UPDATE_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
3857
|
-
const
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
Data: [],
|
|
3866
|
-
Instructions: `core.version is pinned to the exact version ${exact}; nothing was updated.`
|
|
4817
|
+
const {
|
|
4818
|
+
pins: { tools: pins },
|
|
4819
|
+
unlisted
|
|
4820
|
+
} = await readUpdatePins(state);
|
|
4821
|
+
if (unlisted.length > 0) {
|
|
4822
|
+
reportFreezeFailure("unlistedTools", {
|
|
4823
|
+
tools: unlisted,
|
|
4824
|
+
linePrefix: state.getCliVersionPrefix()
|
|
3867
4825
|
});
|
|
3868
4826
|
return;
|
|
3869
4827
|
}
|
|
3870
|
-
const { runToolsUpdate, TOOLS_UPDATE_PHASES } = await import("./updateService.tools-
|
|
4828
|
+
const { isListedTool, runToolsUpdate, TOOLS_UPDATE_PHASES } = await import("./updateService.tools-m58m2fbt.js");
|
|
4829
|
+
const nameListed = options.name === undefined || isListedTool(pins, options.name);
|
|
4830
|
+
if (reportNothingListed(pins, options.name, nameListed))
|
|
4831
|
+
return;
|
|
4832
|
+
const target = await resolveUpdateTarget(state.resolveInstallPath);
|
|
3871
4833
|
const spinner = await startSpinner("Updating tools…");
|
|
3872
4834
|
let report;
|
|
3873
4835
|
try {
|
|
@@ -3875,8 +4837,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
|
3875
4837
|
dryRun: false,
|
|
3876
4838
|
channel: target.pin ? resolveUpdateChannel() : resolveRuntimeChannel(),
|
|
3877
4839
|
name: options.name,
|
|
3878
|
-
|
|
3879
|
-
pinOrigin: target.origin,
|
|
4840
|
+
toolPins: pins,
|
|
3880
4841
|
onProgress: spinner ? ({ current, total, tool, phase }) => {
|
|
3881
4842
|
const verb = phase === TOOLS_UPDATE_PHASES.Checking ? "Checking" : "Installing";
|
|
3882
4843
|
spinner.text = `[${current}/${total}] ${verb} ${tool}`;
|
|
@@ -3889,7 +4850,9 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
|
3889
4850
|
OutputFormatter.error({
|
|
3890
4851
|
Result: report.fatal.result,
|
|
3891
4852
|
Message: report.fatal.message,
|
|
3892
|
-
Instructions: report.fatal.instructions
|
|
4853
|
+
Instructions: report.fatal.instructions,
|
|
4854
|
+
ErrorCode: report.fatal.errorCode,
|
|
4855
|
+
Retry: report.fatal.retry
|
|
3893
4856
|
});
|
|
3894
4857
|
processContext.exit(EXIT_CODES[report.fatal.result] ?? EXIT_CODES.Failure);
|
|
3895
4858
|
return;
|
|
@@ -3900,7 +4863,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
|
3900
4863
|
OutputFormatter.error({
|
|
3901
4864
|
Result: RESULTS.Failure,
|
|
3902
4865
|
Message: `Failed to update ${failed.length} tool(s).`,
|
|
3903
|
-
Instructions: `${report.instructions ? `${report.instructions} ` : ""}${toolFailureRemediation(target.origin)}`
|
|
4866
|
+
Instructions: failed.some((e) => e.errorKind === "tool-pin") ? TOOL_PIN_INSTRUCTIONS : pins ? PIN_INSTALL_FAILED_INSTRUCTIONS : `${report.instructions ? `${report.instructions} ` : ""}${toolFailureRemediation(target.origin)}`
|
|
3904
4867
|
});
|
|
3905
4868
|
processContext.exit(EXIT_CODES.Failure);
|
|
3906
4869
|
return;
|
|
@@ -4368,133 +5331,339 @@ var UPDATE_EXAMPLES = [
|
|
|
4368
5331
|
}
|
|
4369
5332
|
}
|
|
4370
5333
|
];
|
|
4371
|
-
function
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
5334
|
+
function channelOffCli(channel) {
|
|
5335
|
+
const problem = channelOffPinMessage(package_default.version, channel);
|
|
5336
|
+
const pinChannel = versionChannel(package_default.version);
|
|
5337
|
+
if (problem === undefined || pinChannel === undefined)
|
|
5338
|
+
return;
|
|
5339
|
+
return { problem, pinChannel };
|
|
5340
|
+
}
|
|
5341
|
+
async function forcedRunMovesCli(cli) {
|
|
5342
|
+
return !!cli?.available && cli.action === "notice" && await forcedRunInstallsCli();
|
|
5343
|
+
}
|
|
5344
|
+
async function addChannelOffCliError(report) {
|
|
5345
|
+
const { Cli: cli } = report;
|
|
5346
|
+
const offCli = channelOffCli(report.Channel);
|
|
5347
|
+
if (offCli === undefined)
|
|
5348
|
+
return false;
|
|
5349
|
+
const installs = cli?.available && (cli.action === "updated" || report.DryRun && await forcedRunMovesCli(cli));
|
|
5350
|
+
if (installs)
|
|
5351
|
+
return false;
|
|
5352
|
+
report.Errors.push({
|
|
5353
|
+
Subsystem: "cli",
|
|
5354
|
+
...freezeFailure("updateChannelOffCli", {
|
|
5355
|
+
...offCli,
|
|
5356
|
+
cliVersion: package_default.version,
|
|
5357
|
+
channel: report.Channel,
|
|
5358
|
+
available: cli?.available ?? undefined,
|
|
5359
|
+
manualCommand: cli?.manualCommand,
|
|
5360
|
+
hostOwned: await isHostOwnedCli(),
|
|
5361
|
+
stage: report.DryRun ? "dryRun" : "after"
|
|
5362
|
+
})
|
|
5363
|
+
});
|
|
5364
|
+
report.HasFailures = true;
|
|
5365
|
+
return true;
|
|
5366
|
+
}
|
|
5367
|
+
async function refusedChannelOffCli(raw, forced, channel, target) {
|
|
5368
|
+
if (!forced || raw.dryRun)
|
|
5369
|
+
return false;
|
|
5370
|
+
const offCli = channelOffCli(channel);
|
|
5371
|
+
if (offCli === undefined)
|
|
5372
|
+
return false;
|
|
5373
|
+
const { checkCliVersion } = await import("./updateService.cli-xtqp78g7.js");
|
|
5374
|
+
const cli = await checkCliVersion({
|
|
5375
|
+
channel,
|
|
5376
|
+
cliPkgVersion: package_default.version,
|
|
5377
|
+
isDev: await isDevMode(CLI_REPO_ROOT_PACKAGE_NAME),
|
|
5378
|
+
pin: target.pin ?? null
|
|
5379
|
+
});
|
|
5380
|
+
if (await forcedRunMovesCli(cli))
|
|
5381
|
+
return false;
|
|
5382
|
+
const hostOwned = await isHostOwnedCli();
|
|
5383
|
+
reportFreezeFailure("updateChannelOffCli", {
|
|
5384
|
+
...offCli,
|
|
5385
|
+
cliVersion: package_default.version,
|
|
5386
|
+
channel,
|
|
5387
|
+
available: cli.available ?? undefined,
|
|
5388
|
+
manualCommand: hostOwned ? undefined : await noticeCommand(cli),
|
|
5389
|
+
hostOwned,
|
|
5390
|
+
stage: "before"
|
|
5391
|
+
});
|
|
5392
|
+
return true;
|
|
5393
|
+
}
|
|
5394
|
+
async function noticeCommand(cli) {
|
|
5395
|
+
if (cli.action !== "notice" || !cli.available)
|
|
5396
|
+
return;
|
|
5397
|
+
const { describeUpdateCommand, detectCliInstallContext } = await import("./cliInstaller-3dxg6fbd.js");
|
|
5398
|
+
return describeUpdateCommand(`@uipath/cli@${cli.available}`, detectCliInstallContext());
|
|
5399
|
+
}
|
|
5400
|
+
async function writeBack(report, state) {
|
|
5401
|
+
if (await addChannelOffCliError(report))
|
|
5402
|
+
return;
|
|
5403
|
+
const [error, written] = await catchError(writeBackVersions2(report, state.discoveredTools ?? []));
|
|
5404
|
+
if (error) {
|
|
5405
|
+
report.Errors.push({
|
|
5406
|
+
Subsystem: "cli",
|
|
5407
|
+
...freezeFailure("updateFreezeNotWritten", {
|
|
5408
|
+
cause: await classifyError(error)
|
|
5409
|
+
})
|
|
5410
|
+
});
|
|
5411
|
+
report.HasFailures = true;
|
|
5412
|
+
return;
|
|
5413
|
+
}
|
|
5414
|
+
if (!written.changed)
|
|
5415
|
+
return;
|
|
5416
|
+
OutputFormatter.log({
|
|
5417
|
+
Warning: `The freeze in ${configPathForMessage(written.path)} now has the versions this update installed.`
|
|
5418
|
+
});
|
|
5419
|
+
}
|
|
5420
|
+
function refuseForcedSectionOptions(options) {
|
|
5421
|
+
const sectionOptions = [
|
|
5422
|
+
options.name !== undefined && "--name",
|
|
5423
|
+
options.toolsOnly && "--tools-only",
|
|
5424
|
+
options.skillsOnly && "--skills-only",
|
|
5425
|
+
options.tools === false && "--no-tools",
|
|
5426
|
+
options.skills === false && "--no-skills",
|
|
5427
|
+
options.cliCheck === false && "--no-cli-check",
|
|
5428
|
+
options.self === false && "--no-self"
|
|
5429
|
+
].filter((option) => typeof option === "string");
|
|
5430
|
+
if (sectionOptions.length === 0)
|
|
5431
|
+
return false;
|
|
5432
|
+
reportFreezeFailure("updateForceWithSection", { options: sectionOptions });
|
|
5433
|
+
return true;
|
|
5434
|
+
}
|
|
5435
|
+
async function warnHeldSkills(target, pins, skillsSection) {
|
|
5436
|
+
if (!target.pin)
|
|
5437
|
+
return;
|
|
5438
|
+
if (!skillsSection || pins.skills !== undefined)
|
|
5439
|
+
return;
|
|
5440
|
+
if (await readInstalledSkillsVersion() === undefined)
|
|
5441
|
+
return;
|
|
5442
|
+
OutputFormatter.log({
|
|
5443
|
+
Warning: `The CLI pin is the exact version ${formatVersionPin(target.pin)}, so the skills without a pin stay as installed. Run 'uip config freeze' to freeze them too.`
|
|
5444
|
+
});
|
|
5445
|
+
}
|
|
5446
|
+
async function readForce(raw, state) {
|
|
5447
|
+
const updatePins = await readUpdatePins(state);
|
|
5448
|
+
const forced = raw.force === true && updatePins.frozen;
|
|
5449
|
+
if (forced && refuseForcedSectionOptions(raw))
|
|
5450
|
+
return;
|
|
5451
|
+
return { updatePins, forced, linePrefix: state.getCliVersionPrefix() };
|
|
5452
|
+
}
|
|
5453
|
+
function offPinTarget(target) {
|
|
5454
|
+
if (!target.pin)
|
|
5455
|
+
return;
|
|
5456
|
+
const pin = formatVersionPin(target.pin);
|
|
5457
|
+
if (matchesPin(pin, package_default.version))
|
|
5458
|
+
return;
|
|
5459
|
+
return pin;
|
|
5460
|
+
}
|
|
5461
|
+
async function readFreeze({ updatePins, forced, linePrefix }, raw, toolsSection, target) {
|
|
5462
|
+
const { unlisted } = updatePins;
|
|
5463
|
+
const pins = forced ? {} : updatePins.pins;
|
|
5464
|
+
const refuseUnlisted = !forced && toolsSection && unlisted.length > 0;
|
|
5465
|
+
const cliTarget = refuseUnlisted && !await isDevMode(CLI_REPO_ROOT_PACKAGE_NAME) ? offPinTarget(target) : undefined;
|
|
5466
|
+
if (refuseUnlisted && !raw.dryRun) {
|
|
5467
|
+
reportFreezeFailure("unlistedTools", {
|
|
5468
|
+
tools: unlisted,
|
|
5469
|
+
cliTarget,
|
|
5470
|
+
linePrefix
|
|
5471
|
+
});
|
|
5472
|
+
return;
|
|
5473
|
+
}
|
|
5474
|
+
if (toolsSection && pins.tools) {
|
|
5475
|
+
const nameListed = raw.name === undefined || (await import("./updateService.tools-m58m2fbt.js")).isListedTool(pins.tools, raw.name);
|
|
5476
|
+
const nothing = nothingListed(pins.tools, raw.name, nameListed);
|
|
5477
|
+
if (nothing) {
|
|
5478
|
+
OutputFormatter.log({
|
|
5479
|
+
Warning: nothing.warning,
|
|
5480
|
+
Instructions: nothing.instructions
|
|
4378
5481
|
});
|
|
4379
|
-
processContext.exit(EXIT_CODES.ValidationError);
|
|
4380
|
-
return;
|
|
4381
5482
|
}
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
5483
|
+
}
|
|
5484
|
+
const frozenState = raw.dryRun ? await readFrozenState(updatePins) : undefined;
|
|
5485
|
+
return {
|
|
5486
|
+
pins,
|
|
5487
|
+
unlisted,
|
|
5488
|
+
frozenState,
|
|
5489
|
+
refuseUnlisted,
|
|
5490
|
+
cliTarget,
|
|
5491
|
+
linePrefix
|
|
5492
|
+
};
|
|
5493
|
+
}
|
|
5494
|
+
function mergeFrozen(report, freeze) {
|
|
5495
|
+
if (freeze.frozenState === undefined)
|
|
5496
|
+
return;
|
|
5497
|
+
report.Frozen = freeze.frozenState;
|
|
5498
|
+
if (!freeze.refuseUnlisted)
|
|
5499
|
+
return;
|
|
5500
|
+
report.Errors.push({
|
|
5501
|
+
Subsystem: "tools",
|
|
5502
|
+
...freezeFailure("unlistedTools", {
|
|
5503
|
+
tools: freeze.unlisted,
|
|
5504
|
+
cliTarget: freeze.cliTarget,
|
|
5505
|
+
linePrefix: freeze.linePrefix
|
|
5506
|
+
})
|
|
5507
|
+
});
|
|
5508
|
+
report.HasFailures = true;
|
|
5509
|
+
}
|
|
5510
|
+
function registerUpdateCommand3(program, _context, state) {
|
|
5511
|
+
program.command("update").description("Update installed UiPath tools and skills, and check for newer CLI").option("--dry-run", "Preview changes without applying them", false).option("--tools-only", "Skip skills section", false).option("--skills-only", "Skip tools section", false).option("--no-tools", "Do not update tools").option("--no-skills", "Do not update skills").option("--no-cli-check", "Do not probe for newer CLI version").option("--no-self", "Do not auto-update the CLI itself; only print a notice").option("--channel <channel>", `Override channel: ${PUBLIC_CHANNELS.join(" | ")}`).option("--name <scoped-tool-name>", "Restrict tool update to one tool").option("--agent <agent>", "Restrict skill update to one agent").option("--local", "Restrict skills update to local scope only").option("--no-local", "Restrict skills update to global scope only").option("--force", "When this config is frozen, update past the freeze and write the new versions and core.updateChannel into it").examples(UPDATE_EXAMPLES).trackedAction(processContext, async (raw) => {
|
|
5512
|
+
const force = await readForce(raw, state);
|
|
5513
|
+
if (!force)
|
|
4389
5514
|
return;
|
|
4390
|
-
}
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
Result: RESULTS.ValidationError,
|
|
4394
|
-
Message: "Cannot use --skills-only with --no-skills.",
|
|
4395
|
-
Instructions: "Pick one: --skills-only updates only skills; --no-skills skips them."
|
|
4396
|
-
});
|
|
4397
|
-
processContext.exit(EXIT_CODES.ValidationError);
|
|
5515
|
+
const { forced } = force;
|
|
5516
|
+
const channel = checkedOptionsChannel(raw);
|
|
5517
|
+
if (channel === undefined)
|
|
4398
5518
|
return;
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
OutputFormatter.error({
|
|
4403
|
-
Result: RESULTS.ValidationError,
|
|
4404
|
-
Message: `Invalid --channel value: ${raw.channel}`,
|
|
4405
|
-
Instructions: `Valid values: ${PUBLIC_CHANNELS.join(", ")}.`
|
|
4406
|
-
});
|
|
4407
|
-
processContext.exit(EXIT_CODES.ValidationError);
|
|
5519
|
+
const loadError = getConfigLoadError();
|
|
5520
|
+
if (loadError) {
|
|
5521
|
+
await reportUnloadedConfig(loadError, "update");
|
|
4408
5522
|
return;
|
|
4409
5523
|
}
|
|
4410
|
-
const target = resolveEffectiveTarget();
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
});
|
|
4417
|
-
OutputFormatter.success({
|
|
4418
|
-
Result: RESULTS.Success,
|
|
4419
|
-
Code: "UpdateResult",
|
|
4420
|
-
Data: {
|
|
4421
|
-
DryRun: raw.dryRun ?? false,
|
|
4422
|
-
Channel: channel,
|
|
4423
|
-
Cli: {
|
|
4424
|
-
current: package_default.version,
|
|
4425
|
-
available: null,
|
|
4426
|
-
action: "skipped",
|
|
4427
|
-
reason: `core.version pinned to exact ${exact} (frozen)`
|
|
4428
|
-
},
|
|
4429
|
-
Tools: null,
|
|
4430
|
-
Skills: null,
|
|
4431
|
-
Errors: [],
|
|
4432
|
-
HasFailures: false
|
|
4433
|
-
}
|
|
4434
|
-
});
|
|
5524
|
+
const target = forced ? resolveEffectiveTarget() : await resolveUpdateTarget(state.resolveInstallPath);
|
|
5525
|
+
const sections = sectionsOf(raw);
|
|
5526
|
+
const freeze = await readFreeze(force, raw, sections.tools, target);
|
|
5527
|
+
if (!freeze)
|
|
5528
|
+
return;
|
|
5529
|
+
if (await refusedChannelOffCli(raw, forced, channel, target)) {
|
|
4435
5530
|
return;
|
|
4436
5531
|
}
|
|
4437
|
-
const
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
const [err, report] = await catchError((async () => {
|
|
4443
|
-
const { runUpdate } = await import("./updateService-b579ys6m.js");
|
|
4444
|
-
const isDev = await isDevMode();
|
|
4445
|
-
const [locationError, location] = await catchError(state.resolveInstallPath());
|
|
4446
|
-
if (locationError && !(locationError instanceof InstallRefusedError)) {
|
|
4447
|
-
throw locationError;
|
|
4448
|
-
}
|
|
4449
|
-
const hostOwnsCli = await getEnvToolsDirsDeclaration() !== null;
|
|
4450
|
-
return runUpdate({
|
|
4451
|
-
dryRun: raw.dryRun ?? false,
|
|
4452
|
-
channel,
|
|
4453
|
-
sections,
|
|
4454
|
-
tools: {
|
|
4455
|
-
name: raw.name,
|
|
4456
|
-
channel: resolveToolsChannel(raw.channel, channel, !!target.pin)
|
|
4457
|
-
},
|
|
4458
|
-
skills: {
|
|
4459
|
-
agent: raw.agent,
|
|
4460
|
-
local: raw.local
|
|
4461
|
-
},
|
|
4462
|
-
cli: { self: raw.self !== false && !hostOwnsCli },
|
|
4463
|
-
versionPin: target.pin,
|
|
4464
|
-
versionPinOrigin: target.origin
|
|
4465
|
-
}, state, {
|
|
4466
|
-
cliPkgVersion: package_default.version,
|
|
4467
|
-
isLocal: location ? !location.global : false,
|
|
4468
|
-
isDev,
|
|
4469
|
-
installPath: location?.path ?? ""
|
|
4470
|
-
});
|
|
4471
|
-
})());
|
|
5532
|
+
const { pins } = freeze;
|
|
5533
|
+
await warnHeldSkills(target, pins, sections.skills);
|
|
5534
|
+
const restoreVersions = forced ? ignoreCachedVersions() : undefined;
|
|
5535
|
+
const [err, report] = await catchError(runEngine(raw, state, { channel, sections, target, pins }));
|
|
5536
|
+
restoreVersions?.();
|
|
4472
5537
|
if (err) {
|
|
5538
|
+
const { errorCode, retry } = classifyThrownError(err);
|
|
4473
5539
|
OutputFormatter.error({
|
|
4474
5540
|
Result: RESULTS.Failure,
|
|
4475
5541
|
Message: `uip update failed: ${err.message}`,
|
|
4476
|
-
Instructions: "Check the log file for details and re-run."
|
|
5542
|
+
Instructions: carriedInstructions(err) ?? "Check the log file for details and re-run.",
|
|
5543
|
+
ErrorCode: errorCode === "unknown_error" ? "execution_failed" : errorCode,
|
|
5544
|
+
Retry: retry
|
|
4477
5545
|
});
|
|
4478
5546
|
processContext.exit(EXIT_CODES.Failure);
|
|
4479
5547
|
return;
|
|
4480
5548
|
}
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
5549
|
+
if (forced && report.DryRun)
|
|
5550
|
+
await finishForcedDryRun(report, raw, channel);
|
|
5551
|
+
else if (forced)
|
|
5552
|
+
await writeBack(report, state);
|
|
5553
|
+
mergeFrozen(report, freeze);
|
|
5554
|
+
printReport(report);
|
|
5555
|
+
});
|
|
5556
|
+
}
|
|
5557
|
+
async function finishForcedDryRun(report, raw, channel) {
|
|
5558
|
+
await addChannelOffCliError(report);
|
|
5559
|
+
if (report.Cli?.manualCommand && await forcedRunInstallsCli()) {
|
|
5560
|
+
report.Cli.manualCommand = raw.channel === undefined ? "uip update --force" : `uip update --force --channel ${channel}`;
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
async function isHostOwnedCli() {
|
|
5564
|
+
return await getEnvToolsDirsDeclaration() !== null;
|
|
5565
|
+
}
|
|
5566
|
+
async function forcedRunInstallsCli() {
|
|
5567
|
+
if (await isHostOwnedCli())
|
|
5568
|
+
return false;
|
|
5569
|
+
const { detectCliInstallContext } = await import("./cliInstaller-3dxg6fbd.js");
|
|
5570
|
+
return detectCliInstallContext().kind !== "unknown";
|
|
5571
|
+
}
|
|
5572
|
+
function checkedOptionsChannel(raw) {
|
|
5573
|
+
const conflicts = [
|
|
5574
|
+
[
|
|
5575
|
+
!!raw.toolsOnly && !!raw.skillsOnly,
|
|
5576
|
+
"Cannot use --tools-only and --skills-only together.",
|
|
5577
|
+
"Pick one, or omit both to update everything."
|
|
5578
|
+
],
|
|
5579
|
+
[
|
|
5580
|
+
!!raw.toolsOnly && raw.tools === false,
|
|
5581
|
+
"Cannot use --tools-only with --no-tools.",
|
|
5582
|
+
"Pick one: --tools-only updates only tools; --no-tools skips them."
|
|
5583
|
+
],
|
|
5584
|
+
[
|
|
5585
|
+
!!raw.skillsOnly && raw.skills === false,
|
|
5586
|
+
"Cannot use --skills-only with --no-skills.",
|
|
5587
|
+
"Pick one: --skills-only updates only skills; --no-skills skips them."
|
|
5588
|
+
]
|
|
5589
|
+
];
|
|
5590
|
+
const conflict = conflicts.find(([hit]) => hit);
|
|
5591
|
+
if (conflict) {
|
|
5592
|
+
OutputFormatter.error({
|
|
5593
|
+
Result: RESULTS.ValidationError,
|
|
5594
|
+
Message: conflict[1],
|
|
5595
|
+
Instructions: conflict[2]
|
|
4485
5596
|
});
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
}
|
|
5597
|
+
processContext.exit(EXIT_CODES.ValidationError);
|
|
5598
|
+
return;
|
|
5599
|
+
}
|
|
5600
|
+
const channel = resolveChannelFlag(raw.channel);
|
|
5601
|
+
if (channel === null) {
|
|
5602
|
+
OutputFormatter.error({
|
|
5603
|
+
Result: RESULTS.ValidationError,
|
|
5604
|
+
Message: `Invalid --channel value: ${raw.channel}`,
|
|
5605
|
+
Instructions: `Valid values: ${PUBLIC_CHANNELS.join(", ")}.`
|
|
5606
|
+
});
|
|
5607
|
+
processContext.exit(EXIT_CODES.ValidationError);
|
|
5608
|
+
return;
|
|
5609
|
+
}
|
|
5610
|
+
return channel;
|
|
5611
|
+
}
|
|
5612
|
+
function sectionsOf(raw) {
|
|
5613
|
+
return {
|
|
5614
|
+
tools: raw.tools !== false && !raw.skillsOnly,
|
|
5615
|
+
skills: raw.skills !== false && !raw.toolsOnly,
|
|
5616
|
+
cli: raw.cliCheck !== false
|
|
5617
|
+
};
|
|
5618
|
+
}
|
|
5619
|
+
async function runEngine(raw, state, { channel, sections, target, pins }) {
|
|
5620
|
+
const { runUpdate } = await import("./updateService-ybs9274t.js");
|
|
5621
|
+
const isDev = await isDevMode(CLI_REPO_ROOT_PACKAGE_NAME);
|
|
5622
|
+
const [locationError, location] = await catchError(state.resolveInstallPath());
|
|
5623
|
+
if (locationError && !(locationError instanceof InstallRefusedError)) {
|
|
5624
|
+
throw locationError;
|
|
5625
|
+
}
|
|
5626
|
+
const hostOwnsCli = await isHostOwnedCli();
|
|
5627
|
+
return runUpdate({
|
|
5628
|
+
dryRun: raw.dryRun ?? false,
|
|
5629
|
+
channel,
|
|
5630
|
+
sections,
|
|
5631
|
+
tools: {
|
|
5632
|
+
name: raw.name,
|
|
5633
|
+
channel: resolveToolsChannel(raw.channel, channel, !!target.pin)
|
|
5634
|
+
},
|
|
5635
|
+
skills: { agent: raw.agent, local: raw.local },
|
|
5636
|
+
cli: {
|
|
5637
|
+
self: raw.self !== false && !hostOwnsCli,
|
|
5638
|
+
hostOwned: hostOwnsCli
|
|
5639
|
+
},
|
|
5640
|
+
versionPins: pins,
|
|
5641
|
+
versionPin: target.pin,
|
|
5642
|
+
versionPinOrigin: target.origin
|
|
5643
|
+
}, state, {
|
|
5644
|
+
cliPkgVersion: package_default.version,
|
|
5645
|
+
isLocal: location ? !location.global : false,
|
|
5646
|
+
isDev,
|
|
5647
|
+
installPath: location?.path ?? ""
|
|
4496
5648
|
});
|
|
4497
5649
|
}
|
|
5650
|
+
function printReport(report) {
|
|
5651
|
+
OutputFormatter.success({
|
|
5652
|
+
Result: RESULTS.Success,
|
|
5653
|
+
Code: "UpdateResult",
|
|
5654
|
+
Data: report
|
|
5655
|
+
}, { preserveDataKeys: ["Versions"] });
|
|
5656
|
+
for (const line of formatFailureStderr(report)) {
|
|
5657
|
+
logger.warn(line);
|
|
5658
|
+
}
|
|
5659
|
+
if (report.Cli?.action === "notice" && report.Cli.available) {
|
|
5660
|
+
const manualCommand = report.Cli.manualCommand ?? `npm install -g @uipath/cli@${report.Cli.available}`;
|
|
5661
|
+
logger.info(`A newer @uipath/cli is available: ${report.Cli.current} → ${report.Cli.available}. Run: ${manualCommand}`);
|
|
5662
|
+
}
|
|
5663
|
+
if (report.HasFailures) {
|
|
5664
|
+
processContext.exit(EXIT_CODES.Failure);
|
|
5665
|
+
}
|
|
5666
|
+
}
|
|
4498
5667
|
function resolveChannelFlag(flag) {
|
|
4499
5668
|
if (!flag)
|
|
4500
5669
|
return resolveUpdateChannel();
|
|
@@ -4507,14 +5676,11 @@ function resolveToolsChannel(flag, runChannel, pinned) {
|
|
|
4507
5676
|
return runChannel;
|
|
4508
5677
|
return resolveRuntimeChannel();
|
|
4509
5678
|
}
|
|
4510
|
-
function formatFailureStderr(report
|
|
4511
|
-
|
|
4512
|
-
const lines = collapsed ? [collapsed] : [];
|
|
4513
|
-
for (const e of individual) {
|
|
5679
|
+
function formatFailureStderr(report) {
|
|
5680
|
+
return report.Errors.map((e) => {
|
|
4514
5681
|
const scope = e.Scope ? ` (${e.Scope})` : "";
|
|
4515
|
-
|
|
4516
|
-
}
|
|
4517
|
-
return lines;
|
|
5682
|
+
return `[${e.Subsystem}${scope}] ${e.Message} ${e.Instructions}`;
|
|
5683
|
+
});
|
|
4518
5684
|
}
|
|
4519
5685
|
|
|
4520
5686
|
// src/commands/user.ts
|
|
@@ -4589,13 +5755,21 @@ function registerUserCommand(program, context) {
|
|
|
4589
5755
|
}
|
|
4590
5756
|
|
|
4591
5757
|
// src/services/installPath.ts
|
|
5758
|
+
import { fileURLToPath } from "node:url";
|
|
4592
5759
|
function createInstallPathResolver(toolsDir, isBrowser) {
|
|
5760
|
+
const ownedProjects = new Set;
|
|
5761
|
+
const refuseUnlessOwned = async (fs, projectDir) => {
|
|
5762
|
+
if (ownedProjects.has(projectDir))
|
|
5763
|
+
return;
|
|
5764
|
+
await refuseProjectOfAnotherCli(fs, projectDir);
|
|
5765
|
+
ownedProjects.add(projectDir);
|
|
5766
|
+
};
|
|
4593
5767
|
return async (packageName) => {
|
|
4594
5768
|
if (isBrowser) {
|
|
4595
5769
|
const path = packageName ? `/tools/${packageName.replace(/[/@]/g, "_")}` : "/tools";
|
|
4596
5770
|
return { path, global: false };
|
|
4597
5771
|
}
|
|
4598
|
-
const { getFileSystem } = await import("./index-
|
|
5772
|
+
const { getFileSystem } = await import("./index-y7v9rkq9.js");
|
|
4599
5773
|
const fsLocal = getFileSystem();
|
|
4600
5774
|
const { dirname: dirnameFn, join: joinFn } = fsLocal.path;
|
|
4601
5775
|
const declaration = await getEnvToolsDirsDeclaration();
|
|
@@ -4621,6 +5795,9 @@ function createInstallPathResolver(toolsDir, isBrowser) {
|
|
|
4621
5795
|
path = parent;
|
|
4622
5796
|
}
|
|
4623
5797
|
const isGlobal = !await isLocalWorkspaceDir(path);
|
|
5798
|
+
if (!isGlobal) {
|
|
5799
|
+
await refuseUnlessOwned(fsLocal, path);
|
|
5800
|
+
}
|
|
4624
5801
|
logger.debug(`Install path resolved: ${path} (global: ${isGlobal})`);
|
|
4625
5802
|
return { path, global: isGlobal };
|
|
4626
5803
|
}
|
|
@@ -4629,6 +5806,9 @@ function createInstallPathResolver(toolsDir, isBrowser) {
|
|
|
4629
5806
|
const nodeModulesPath = joinFn(searchDir, "node_modules");
|
|
4630
5807
|
const [, exists] = await catchError(fsLocal.exists(nodeModulesPath));
|
|
4631
5808
|
if (exists) {
|
|
5809
|
+
if (await isLocalWorkspaceDir(searchDir)) {
|
|
5810
|
+
await refuseUnlessOwned(fsLocal, searchDir);
|
|
5811
|
+
}
|
|
4632
5812
|
logger.debug(`Install path resolved via fallback: ${searchDir}`);
|
|
4633
5813
|
return { path: searchDir, global: false };
|
|
4634
5814
|
}
|
|
@@ -4640,6 +5820,30 @@ function createInstallPathResolver(toolsDir, isBrowser) {
|
|
|
4640
5820
|
throw new Error("Unable to determine install location. No node_modules found in parent directories.");
|
|
4641
5821
|
};
|
|
4642
5822
|
}
|
|
5823
|
+
async function refuseProjectOfAnotherCli(fs, projectDir) {
|
|
5824
|
+
const projectCliDir = fs.path.join(projectDir, "node_modules", "@uipath", "cli");
|
|
5825
|
+
const ownInstall = await resolveExistingRealpath(fs, projectCliDir);
|
|
5826
|
+
const runningFile = await resolveExistingRealpath(fs, fileURLToPath(import.meta.url));
|
|
5827
|
+
if (ownInstall && runningFile) {
|
|
5828
|
+
const fromInstall = fs.path.relative(ownInstall, runningFile);
|
|
5829
|
+
if (!fromInstall.startsWith("..") && !fs.path.isAbsolute(fromInstall)) {
|
|
5830
|
+
return;
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5833
|
+
const [, raw] = await catchError(fs.readFile(fs.path.join(projectCliDir, "package.json"), "utf-8"));
|
|
5834
|
+
const [, projectCli] = catchError(() => raw ? JSON.parse(raw) : undefined);
|
|
5835
|
+
const version = typeof projectCli?.version === "string" ? ` ${projectCli.version}` : "";
|
|
5836
|
+
const ownership = ownInstall && runningFile ? `has its own @uipath/cli${version}, and this uip (${package_default.version}) is not it.` : ownInstall ? `has its own @uipath/cli${version}, but this uip's install could not be resolved, so ownership could not be verified.` : "declares its own @uipath/cli, but its installed CLI could not be resolved.";
|
|
5837
|
+
const instructions = ownInstall ? `Run the command with the project's CLI ('npx uip ...' from ${projectDir}), or run this uip outside the project.` : `Install the project's dependencies, then run the command with its CLI ('npx uip ...' from ${projectDir}), or run this uip outside the project.`;
|
|
5838
|
+
throw new InstallRefusedError(`The project at ${projectDir} ${ownership} Only the project's own CLI installs, updates or removes the project's tools, so nothing was changed.`, instructions, { errorCode: "configuration_error", retry: "RetryWillNotFix" });
|
|
5839
|
+
}
|
|
5840
|
+
async function resolveExistingRealpath(fs, path) {
|
|
5841
|
+
const [, exists] = await catchError(fs.exists(path));
|
|
5842
|
+
if (!exists)
|
|
5843
|
+
return;
|
|
5844
|
+
const [, realpath] = await catchError(fs.realpath(path));
|
|
5845
|
+
return realpath;
|
|
5846
|
+
}
|
|
4643
5847
|
|
|
4644
5848
|
// src/services/installTelemetry.ts
|
|
4645
5849
|
var INSTALL_ID_TELEMETRY_KEY = BaseDimensions.InstallationId;
|
|
@@ -4667,39 +5871,6 @@ var populateTelemetryInstallContext = async (deps = {}) => {
|
|
|
4667
5871
|
logger.debug("[Telemetry] install context populated at startup");
|
|
4668
5872
|
};
|
|
4669
5873
|
|
|
4670
|
-
// src/services/autoUpdatePolicy.ts
|
|
4671
|
-
var DISABLE_VERSION_SYNC_ENV = "UIPATH_CLI_DISABLE_VERSION_SYNC";
|
|
4672
|
-
var DISABLE_AUTOINSTALL_ENV = "UIPATH_CLI_DISABLE_AUTOINSTALL";
|
|
4673
|
-
var DISABLE_TOOL_LINE_CHECK_ENV = "UIPATH_CLI_DISABLE_TOOL_LINE_CHECK";
|
|
4674
|
-
function isTruthyEnv(name) {
|
|
4675
|
-
const value = getFileSystem2().env.getenv(name);
|
|
4676
|
-
if (!value)
|
|
4677
|
-
return false;
|
|
4678
|
-
const v = value.trim().toLowerCase();
|
|
4679
|
-
return v !== "" && v !== "0" && v !== "false" && v !== "no";
|
|
4680
|
-
}
|
|
4681
|
-
function isAutoInstallDisabled() {
|
|
4682
|
-
return isTruthyEnv(DISABLE_AUTOINSTALL_ENV);
|
|
4683
|
-
}
|
|
4684
|
-
function isToolLineCheckDisabled() {
|
|
4685
|
-
return isTruthyEnv(DISABLE_TOOL_LINE_CHECK_ENV);
|
|
4686
|
-
}
|
|
4687
|
-
function backgroundUpdateSkipReason(argv) {
|
|
4688
|
-
if (isTruthyEnv(DISABLE_VERSION_SYNC_ENV)) {
|
|
4689
|
-
return `${DISABLE_VERSION_SYNC_ENV} is set`;
|
|
4690
|
-
}
|
|
4691
|
-
if (isAutoInstallDisabled()) {
|
|
4692
|
-
return `${DISABLE_AUTOINSTALL_ENV} is set`;
|
|
4693
|
-
}
|
|
4694
|
-
if (isEnvAuthEnabled2()) {
|
|
4695
|
-
return "env-var auth (CI/headless)";
|
|
4696
|
-
}
|
|
4697
|
-
if (isHelpOrVersionInvocation(argv)) {
|
|
4698
|
-
return "--help or the CLI's own --version";
|
|
4699
|
-
}
|
|
4700
|
-
return null;
|
|
4701
|
-
}
|
|
4702
|
-
|
|
4703
5874
|
// src/services/toolFreshness.ts
|
|
4704
5875
|
class ToolUpdateCheckError extends InstallRefusedError {
|
|
4705
5876
|
constructor(message, cause) {
|
|
@@ -4707,7 +5878,7 @@ class ToolUpdateCheckError extends InstallRefusedError {
|
|
|
4707
5878
|
this.name = "ToolUpdateCheckError";
|
|
4708
5879
|
}
|
|
4709
5880
|
}
|
|
4710
|
-
var TOOL_CHECK_INSTRUCTIONS = "Check your connection and re-run the command — the check runs again on the next attempt. " + `To skip the daily tool check, set ${DISABLE_VERSION_SYNC_ENV}=1, ` + "or freeze versions with 'uip config
|
|
5881
|
+
var TOOL_CHECK_INSTRUCTIONS = "Check your connection and re-run the command — the check runs again on the next attempt. " + `To skip the daily tool check, set ${DISABLE_VERSION_SYNC_ENV}=1, ` + "or freeze versions with 'uip config freeze'.";
|
|
4711
5882
|
function toolLookupFailedError(toolName, cause) {
|
|
4712
5883
|
return new ToolUpdateCheckError(`The daily update check for '${toolName}' failed: ${cause.message}`, cause);
|
|
4713
5884
|
}
|
|
@@ -4719,10 +5890,6 @@ async function resolveFreshnessGate() {
|
|
|
4719
5890
|
logger.debug("Tool freshness check skipped: dev mode");
|
|
4720
5891
|
return null;
|
|
4721
5892
|
}
|
|
4722
|
-
if (resolveEffectiveTarget().frozen) {
|
|
4723
|
-
logger.debug("Tool freshness check skipped: exact pin (frozen)");
|
|
4724
|
-
return null;
|
|
4725
|
-
}
|
|
4726
5893
|
return { channel: resolveRuntimeChannel() };
|
|
4727
5894
|
}
|
|
4728
5895
|
async function isToolCheckedToday(toolName) {
|
|
@@ -4730,7 +5897,7 @@ async function isToolCheckedToday(toolName) {
|
|
|
4730
5897
|
return state.toolUpdateDates?.[toolName] === todayLocal();
|
|
4731
5898
|
}
|
|
4732
5899
|
async function acquireToolCheckLock(toolName) {
|
|
4733
|
-
const { getFileSystemAsync } = await import("./index-
|
|
5900
|
+
const { getFileSystemAsync } = await import("./index-y7v9rkq9.js");
|
|
4734
5901
|
const fs = await getFileSystemAsync();
|
|
4735
5902
|
if (typeof fs.acquireLock !== "function") {
|
|
4736
5903
|
return { kind: "unavailable" };
|
|
@@ -4750,6 +5917,14 @@ async function acquireToolCheckLock(toolName) {
|
|
|
4750
5917
|
}
|
|
4751
5918
|
|
|
4752
5919
|
// src/services/tool-manager.ts
|
|
5920
|
+
async function classifyInstallFailure(error) {
|
|
5921
|
+
const { message, errorCode, retry } = await classifyInstallError(error);
|
|
5922
|
+
return {
|
|
5923
|
+
message: error instanceof InstallRefusedError ? message : pickNpmFailureLine(message),
|
|
5924
|
+
errorCode,
|
|
5925
|
+
retry
|
|
5926
|
+
};
|
|
5927
|
+
}
|
|
4753
5928
|
var EXECUTOR_TOOL_MODULE = "executor-tool";
|
|
4754
5929
|
|
|
4755
5930
|
class ToolManager {
|
|
@@ -4762,6 +5937,7 @@ class ToolManager {
|
|
|
4762
5937
|
discoveredPrefixes;
|
|
4763
5938
|
checkedVerbs = new Set;
|
|
4764
5939
|
freshVerbs = new Set;
|
|
5940
|
+
listedPins = new Map;
|
|
4765
5941
|
freshnessGate;
|
|
4766
5942
|
constructor(tools, toolsDirs, resolveInstallPath, cliVersionPrefix, discoveredTools, argv = process.argv) {
|
|
4767
5943
|
this.toolsDirs = toolsDirs;
|
|
@@ -4776,14 +5952,82 @@ class ToolManager {
|
|
|
4776
5952
|
return this.discoveredPrefixes.has(verb) || this.tools.some((t) => t.metadata.commandPrefix === verb);
|
|
4777
5953
|
}
|
|
4778
5954
|
async ensureAvailable(verb) {
|
|
5955
|
+
if (freezeScopeOf(this.argv) !== "help") {
|
|
5956
|
+
await this.ensureListedVersion(verb);
|
|
5957
|
+
}
|
|
4779
5958
|
if (!this.isInstalled(verb)) {
|
|
4780
|
-
await this.installTool(verb);
|
|
5959
|
+
await this.installTool(verb, undefined, await this.listedPinOf(verb));
|
|
4781
5960
|
} else {
|
|
4782
5961
|
logger.debug(`Tool '${verb}' is already installed`);
|
|
4783
5962
|
await this.ensureOnTargetLine(verb);
|
|
4784
5963
|
}
|
|
4785
5964
|
await this.ensureUpdatedToday(verb);
|
|
4786
5965
|
}
|
|
5966
|
+
async ensureListedVersion(verb) {
|
|
5967
|
+
if (this.listedPins.has(verb))
|
|
5968
|
+
return;
|
|
5969
|
+
this.listedPins.set(verb, await this.checkListedVersion(verb));
|
|
5970
|
+
}
|
|
5971
|
+
async listedPinOf(verb) {
|
|
5972
|
+
const packageName = WHITELIST_BY_COMMAND.get(verb);
|
|
5973
|
+
if (!packageName)
|
|
5974
|
+
return;
|
|
5975
|
+
const { tools: pins } = await governingPins(this.resolveInstallPath);
|
|
5976
|
+
return pins?.[packageName];
|
|
5977
|
+
}
|
|
5978
|
+
async checkListedVersion(verb) {
|
|
5979
|
+
const packageName = WHITELIST_BY_COMMAND.get(verb);
|
|
5980
|
+
if (!packageName)
|
|
5981
|
+
return;
|
|
5982
|
+
const { tools: pins } = await governingPins(this.resolveInstallPath);
|
|
5983
|
+
const pin = pins?.[packageName];
|
|
5984
|
+
const onDisk = this.installedVersionOf(verb);
|
|
5985
|
+
if (pin === undefined) {
|
|
5986
|
+
if (onDisk && await isFrozen(this.resolveInstallPath)) {
|
|
5987
|
+
const replacing = this.offTargetLine(verb);
|
|
5988
|
+
throw replacing ? freezeRefusal("unlistedToolNotInstalled", {
|
|
5989
|
+
verb,
|
|
5990
|
+
packageName,
|
|
5991
|
+
replacing
|
|
5992
|
+
}) : freezeRefusal("unlistedToolRefused", {
|
|
5993
|
+
verb,
|
|
5994
|
+
packageName,
|
|
5995
|
+
installed: onDisk.version
|
|
5996
|
+
});
|
|
5997
|
+
}
|
|
5998
|
+
return;
|
|
5999
|
+
}
|
|
6000
|
+
if (onDisk && matchesPin(pin, onDisk.version))
|
|
6001
|
+
return pin;
|
|
6002
|
+
if (onDisk) {
|
|
6003
|
+
throw freezeRefusal("toolOffPin", {
|
|
6004
|
+
verb,
|
|
6005
|
+
packageName: onDisk.packageName,
|
|
6006
|
+
version: onDisk.version,
|
|
6007
|
+
pin
|
|
6008
|
+
});
|
|
6009
|
+
}
|
|
6010
|
+
await this.installTool(verb, undefined, pin);
|
|
6011
|
+
const installed = this.installedVersionOf(verb);
|
|
6012
|
+
if (!installed) {
|
|
6013
|
+
throw freezeRefusal("toolMissingAfterInstall", {
|
|
6014
|
+
verb,
|
|
6015
|
+
packageName,
|
|
6016
|
+
pin,
|
|
6017
|
+
dirs: this.toolsDirs
|
|
6018
|
+
});
|
|
6019
|
+
}
|
|
6020
|
+
if (!matchesPin(pin, installed.version)) {
|
|
6021
|
+
throw freezeRefusal("toolShadowed", {
|
|
6022
|
+
verb,
|
|
6023
|
+
packageName,
|
|
6024
|
+
pin,
|
|
6025
|
+
found: `${installed.packageName}@${installed.version}`,
|
|
6026
|
+
dirs: this.toolsDirs
|
|
6027
|
+
});
|
|
6028
|
+
}
|
|
6029
|
+
return pin;
|
|
6030
|
+
}
|
|
4787
6031
|
async ensureUpdatedToday(verb) {
|
|
4788
6032
|
if (this.freshVerbs.has(verb)) {
|
|
4789
6033
|
return;
|
|
@@ -4931,11 +6175,12 @@ class ToolManager {
|
|
|
4931
6175
|
}
|
|
4932
6176
|
return {
|
|
4933
6177
|
packageName: loaded.metadata.name,
|
|
4934
|
-
toolName: loaded.metadata.name
|
|
6178
|
+
toolName: toolShortName(loaded.metadata.name),
|
|
4935
6179
|
version: loaded.metadata.version
|
|
4936
6180
|
};
|
|
4937
6181
|
}
|
|
4938
6182
|
async resolveOrInstallEntry(verb) {
|
|
6183
|
+
await this.ensureListedVersion(verb);
|
|
4939
6184
|
let entry = this.discoveredTools.find((d) => d.commandPrefix === verb);
|
|
4940
6185
|
if (!entry) {
|
|
4941
6186
|
logger.info(`Tool '${verb}' not found on disk. Attempting install...`);
|
|
@@ -4968,7 +6213,7 @@ class ToolManager {
|
|
|
4968
6213
|
const entry = await this.resolveOrInstallEntry(verb);
|
|
4969
6214
|
const [error, module] = await catchError(importToolLibraryModule(entry, EXECUTOR_TOOL_MODULE));
|
|
4970
6215
|
if (error) {
|
|
4971
|
-
throw new Error(`Tool '${verb}' (${entry.packageName}@${entry.version || "unknown"}) cannot run projects. ` + `${error.message} ` + `Run 'uip tools update ${entry.
|
|
6216
|
+
throw new Error(`Tool '${verb}' (${entry.packageName}@${entry.version || "unknown"}) cannot run projects. ` + `${error.message} ` + `Run 'uip tools update --name ${entry.packageName}' to move it onto a version that can.`);
|
|
4972
6217
|
}
|
|
4973
6218
|
registerExecutorFactoryFromModule(module, `${entry.toolName}/${EXECUTOR_TOOL_MODULE}`);
|
|
4974
6219
|
}
|
|
@@ -4978,31 +6223,67 @@ class ToolManager {
|
|
|
4978
6223
|
getDiscoveredTools() {
|
|
4979
6224
|
return this.discoveredTools;
|
|
4980
6225
|
}
|
|
4981
|
-
async installTool(verb, replacing) {
|
|
6226
|
+
async installTool(verb, replacing, listedPin) {
|
|
4982
6227
|
const packageName = WHITELIST_BY_COMMAND.get(verb);
|
|
4983
6228
|
if (!packageName) {
|
|
4984
6229
|
throw new Error(`Unknown tool verb '${verb}'.`);
|
|
4985
6230
|
}
|
|
4986
6231
|
const prefix = this.cliVersionPrefix;
|
|
4987
|
-
const state = replacing ? `runs ${replacing.packageName}@${replacing.version}, which is off this CLI's ${prefix}x line
|
|
4988
|
-
|
|
4989
|
-
|
|
6232
|
+
const state = replacing ? `runs ${replacing.packageName}@${replacing.version}, which is off this CLI's ${prefix}x line` : "is not installed";
|
|
6233
|
+
const frozen = await isFrozen(this.resolveInstallPath);
|
|
6234
|
+
if (isAutoInstallDisabled() && listedPin !== undefined) {
|
|
6235
|
+
throw freezeRefusal("toolPinNotInstalled", {
|
|
6236
|
+
packageName,
|
|
6237
|
+
pin: listedPin
|
|
6238
|
+
});
|
|
6239
|
+
}
|
|
6240
|
+
if (isAutoInstallDisabled() && !frozen) {
|
|
6241
|
+
throw new InstallRefusedError(`Tool '${verb}' ${state}, and automatic tool installation is disabled (${DISABLE_AUTOINSTALL_ENV}).`, replacing ? `Run 'uip tools update --name ${replacing.packageName}' to move it onto the ${prefix}x line, or unset ${DISABLE_AUTOINSTALL_ENV} and re-run.` : `Run the command with a uip installation that includes '${verb}', or unset ${DISABLE_AUTOINSTALL_ENV} and re-run.`);
|
|
6242
|
+
}
|
|
6243
|
+
if (!listedPin && frozen) {
|
|
6244
|
+
throw await this.frozenRefusal(verb, packageName, replacing);
|
|
4990
6245
|
}
|
|
4991
6246
|
const location = await this.resolveInstallPath();
|
|
4992
6247
|
if (await isBundledDistribution(location.path)) {
|
|
4993
6248
|
throw new InstallRefusedError(replacing ? `The Studio-bundled CLI ships ${replacing.packageName}@${replacing.version} for '${verb}', ` + `which is off its own ${prefix}x line, and the bundle cannot install another version: ` + `it is a fixed set of tools managed by Studio setup.` : `The Studio-bundled CLI does not include the '${verb}' tool and cannot install it: ` + `the bundle is a fixed set of tools managed by Studio setup.`, `Use a globally installed CLI for '${verb}': 'npm install -g @uipath/cli', then re-run with that 'uip'.`);
|
|
4994
6249
|
}
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
const
|
|
4999
|
-
if (!
|
|
5000
|
-
|
|
5001
|
-
|
|
6250
|
+
const install = this.installResolved(verb, packageName, location, state, replacing, listedPin);
|
|
6251
|
+
if (listedPin === undefined)
|
|
6252
|
+
return install;
|
|
6253
|
+
const [error] = await catchError(install);
|
|
6254
|
+
if (!error)
|
|
6255
|
+
return;
|
|
6256
|
+
throw freezeRefusal("toolPinInstallFailed", {
|
|
6257
|
+
packageName,
|
|
6258
|
+
pin: listedPin,
|
|
6259
|
+
cause: await classifyInstallFailure(error)
|
|
6260
|
+
});
|
|
6261
|
+
}
|
|
6262
|
+
async frozenRefusal(verb, packageName, replacing) {
|
|
6263
|
+
const pin = replacing && await this.listedPinOf(verb);
|
|
6264
|
+
if (replacing && pin) {
|
|
6265
|
+
return freezeRefusal("toolOffPin", {
|
|
6266
|
+
verb,
|
|
6267
|
+
packageName: replacing.packageName,
|
|
6268
|
+
version: replacing.version,
|
|
6269
|
+
pin
|
|
6270
|
+
});
|
|
5002
6271
|
}
|
|
6272
|
+
return freezeRefusal("unlistedToolNotInstalled", {
|
|
6273
|
+
verb,
|
|
6274
|
+
packageName,
|
|
6275
|
+
replacing
|
|
6276
|
+
});
|
|
6277
|
+
}
|
|
6278
|
+
async installResolved(verb, packageName, location, state, replacing, listedPin) {
|
|
6279
|
+
const prefix = this.cliVersionPrefix;
|
|
6280
|
+
const candidate = listedPin ? { version: listedPin, registry: undefined } : await this.resolveLineCandidate(verb, packageName, state, replacing);
|
|
5003
6281
|
const packageSpec = `${packageName}@${candidate.version}`;
|
|
5004
6282
|
if (replacing) {
|
|
5005
6283
|
getOutputSink().writeErr(`'${verb}' runs ${replacing.packageName}@${replacing.version}, ` + `which is off this CLI's ${prefix}x line. ` + `Installing ${packageSpec} before running it.
|
|
6284
|
+
`);
|
|
6285
|
+
} else if (listedPin) {
|
|
6286
|
+
getOutputSink().writeErr(`'${verb}' is not installed. Installing ${packageSpec}, the frozen version.
|
|
5006
6287
|
`);
|
|
5007
6288
|
}
|
|
5008
6289
|
logger.debug(`Installing ${packageSpec} from ${candidate.registry ?? "the configured registry"} to ${location.path} (global: ${location.global})`);
|
|
@@ -5013,14 +6294,22 @@ class ToolManager {
|
|
|
5013
6294
|
logger.info(`Installed ${packageSpec} successfully.`);
|
|
5014
6295
|
await this.includeGlobalInstallDirectory(location);
|
|
5015
6296
|
await this.refreshDiscovery();
|
|
5016
|
-
await this.recordUpdateDate(packageName
|
|
6297
|
+
await this.recordUpdateDate(toolShortName(packageName));
|
|
6298
|
+
}
|
|
6299
|
+
async resolveLineCandidate(verb, packageName, state, replacing) {
|
|
6300
|
+
const prefix = this.cliVersionPrefix;
|
|
6301
|
+
logger.info(`Tool '${verb}' ${state}, searching for a compatible version...`);
|
|
6302
|
+
const channel = resolveRuntimeChannel();
|
|
6303
|
+
const registryFailures = [];
|
|
6304
|
+
const candidate = await toolService.resolveInstallCandidate(packageName, prefix, channel, (failure) => registryFailures.push(failure));
|
|
6305
|
+
if (!candidate) {
|
|
6306
|
+
const diagnosis = describeCandidateFailure(packageName, prefix, registryFailures[0], await getEffectiveRegistry(packageName));
|
|
6307
|
+
throw new InstallRefusedError(`Tool '${verb}' ${state}. ${diagnosis.message}`, diagnosis.instructions, { errorCode: diagnosis.errorCode, retry: diagnosis.retry });
|
|
6308
|
+
}
|
|
6309
|
+
return candidate;
|
|
5017
6310
|
}
|
|
5018
6311
|
async includeGlobalInstallDirectory(location) {
|
|
5019
|
-
|
|
5020
|
-
return;
|
|
5021
|
-
if (await getEnvToolsDirsDeclaration())
|
|
5022
|
-
return;
|
|
5023
|
-
const globalToolsDir = await refreshGlobalNpmUipathDir();
|
|
6312
|
+
const globalToolsDir = await globalInstallDirFor(location);
|
|
5024
6313
|
if (globalToolsDir && !this.toolsDirs.includes(globalToolsDir)) {
|
|
5025
6314
|
this.toolsDirs.push(globalToolsDir);
|
|
5026
6315
|
logger.debug(`Added global tool directory after install: ${globalToolsDir}`);
|
|
@@ -5074,9 +6363,10 @@ async function runStartupSync(context, state) {
|
|
|
5074
6363
|
const skip = backgroundUpdateSkipReason(args);
|
|
5075
6364
|
if (skip) {
|
|
5076
6365
|
logger.debug(`Version sync skipped: ${skip}`);
|
|
6366
|
+
await warnIgnoredSwitches(args, state);
|
|
5077
6367
|
return false;
|
|
5078
6368
|
}
|
|
5079
|
-
const verb =
|
|
6369
|
+
const { verb } = verbAndSubcommand(args);
|
|
5080
6370
|
if (!verb || SKIP_VERBS.has(verb)) {
|
|
5081
6371
|
logger.debug(`Version sync skipped: command '${verb}' is exempt`);
|
|
5082
6372
|
return false;
|
|
@@ -5090,12 +6380,30 @@ async function runStartupSync(context, state) {
|
|
|
5090
6380
|
return false;
|
|
5091
6381
|
}
|
|
5092
6382
|
const [locationError, location] = await catchError(state.resolveInstallPath());
|
|
6383
|
+
if (locationError instanceof InstallRefusedError) {
|
|
6384
|
+
logger.debug(`Version sync skipped: ${locationError.message}`);
|
|
6385
|
+
return false;
|
|
6386
|
+
}
|
|
5093
6387
|
if (!locationError && location && await isBundledDistribution(location.path)) {
|
|
5094
6388
|
logger.debug("Version sync skipped: Studio-bundled CLI distribution");
|
|
5095
6389
|
return false;
|
|
5096
6390
|
}
|
|
5097
6391
|
return runDailyAutoUpdate(state, context);
|
|
5098
6392
|
}
|
|
6393
|
+
async function warnIgnoredSwitches(args, state) {
|
|
6394
|
+
if (!isTruthyEnv(DISABLE_VERSION_SYNC_ENV))
|
|
6395
|
+
return;
|
|
6396
|
+
const { verb } = verbAndSubcommand(args);
|
|
6397
|
+
if (verb === undefined || verb === "help")
|
|
6398
|
+
return;
|
|
6399
|
+
if (isHelpOrVersionInvocation(args))
|
|
6400
|
+
return;
|
|
6401
|
+
if (!await isFrozen(state.resolveInstallPath))
|
|
6402
|
+
return;
|
|
6403
|
+
if (!await claimFrozenEnvWarning(todayLocal()))
|
|
6404
|
+
return;
|
|
6405
|
+
logger.warn(`${DISABLE_VERSION_SYNC_ENV} is ignored, because this config is frozen (versions block).`);
|
|
6406
|
+
}
|
|
5099
6407
|
async function runDailyAutoUpdate(state, context) {
|
|
5100
6408
|
const today = todayLocal();
|
|
5101
6409
|
const prev = await readState();
|
|
@@ -5104,11 +6412,6 @@ async function runDailyAutoUpdate(state, context) {
|
|
|
5104
6412
|
return false;
|
|
5105
6413
|
}
|
|
5106
6414
|
const target = resolveEffectiveTarget();
|
|
5107
|
-
if (target.frozen) {
|
|
5108
|
-
await mergeState({ lastUpdateDate: today });
|
|
5109
|
-
logger.debug("Daily auto-update skipped: exact pin (frozen)");
|
|
5110
|
-
return false;
|
|
5111
|
-
}
|
|
5112
6415
|
if (!await mergeState({ lastUpdateDate: today })) {
|
|
5113
6416
|
logger.debug("Daily auto-update skipped: could not persist the day claim (state dir unwritable)");
|
|
5114
6417
|
return false;
|
|
@@ -5117,9 +6420,8 @@ async function runDailyAutoUpdate(state, context) {
|
|
|
5117
6420
|
writeSyncStatus(context, "Checking for updates.");
|
|
5118
6421
|
}
|
|
5119
6422
|
return applyUpdate(state, context, {
|
|
5120
|
-
pin: target.pin,
|
|
5121
6423
|
origin: target.origin,
|
|
5122
|
-
...
|
|
6424
|
+
...runningMajorCeiling()
|
|
5123
6425
|
});
|
|
5124
6426
|
}
|
|
5125
6427
|
function runningMajorCeiling() {
|
|
@@ -5137,7 +6439,7 @@ async function applyUpdate(state, context, target) {
|
|
|
5137
6439
|
const report = await runUpdateEngine(state, location, context, target);
|
|
5138
6440
|
if (!report)
|
|
5139
6441
|
return false;
|
|
5140
|
-
return finishUpdate(report, context
|
|
6442
|
+
return finishUpdate(report, context);
|
|
5141
6443
|
}
|
|
5142
6444
|
async function resolveUpdateLocation(state, context) {
|
|
5143
6445
|
const [locErr, location] = await catchError(state.resolveInstallPath());
|
|
@@ -5149,7 +6451,7 @@ async function resolveUpdateLocation(state, context) {
|
|
|
5149
6451
|
return location;
|
|
5150
6452
|
}
|
|
5151
6453
|
async function runUpdateEngine(state, location, context, target) {
|
|
5152
|
-
const { runUpdate } = await import("./updateService-
|
|
6454
|
+
const { runUpdate } = await import("./updateService-ybs9274t.js");
|
|
5153
6455
|
const spinner = await startSpinner(formatUpdateStartMessage(target));
|
|
5154
6456
|
if (!spinner) {
|
|
5155
6457
|
writeSyncStatus(context, formatUpdateStartMessage(target));
|
|
@@ -5161,7 +6463,7 @@ async function runUpdateEngine(state, location, context, target) {
|
|
|
5161
6463
|
tools: { name: undefined },
|
|
5162
6464
|
skills: { agent: undefined, local: undefined },
|
|
5163
6465
|
cli: { self: true },
|
|
5164
|
-
versionPin:
|
|
6466
|
+
versionPin: null,
|
|
5165
6467
|
versionPinOrigin: target.origin,
|
|
5166
6468
|
maxMajor: target.maxMajor,
|
|
5167
6469
|
onProgress: spinner ? (message) => {
|
|
@@ -5180,10 +6482,10 @@ async function runUpdateEngine(state, location, context, target) {
|
|
|
5180
6482
|
}
|
|
5181
6483
|
return report;
|
|
5182
6484
|
}
|
|
5183
|
-
function finishUpdate(report, context
|
|
6485
|
+
function finishUpdate(report, context) {
|
|
5184
6486
|
if (report.HasFailures) {
|
|
5185
6487
|
writeSyncStatus(context, "Update completed with failures.");
|
|
5186
|
-
for (const message of formatUpdateFailureMessages(report
|
|
6488
|
+
for (const message of formatUpdateFailureMessages(report)) {
|
|
5187
6489
|
writeSyncStatus(context, message);
|
|
5188
6490
|
}
|
|
5189
6491
|
}
|
|
@@ -5192,7 +6494,7 @@ function finishUpdate(report, context, target) {
|
|
|
5192
6494
|
}
|
|
5193
6495
|
const heldBack = report.Cli?.heldBackVersion;
|
|
5194
6496
|
if (heldBack) {
|
|
5195
|
-
writeSyncStatus(context, `@uipath/cli ${heldBack} is available but was not installed: the daily update does not cross major versions. Run \`uip update\` to move to it, or \`uip config
|
|
6497
|
+
writeSyncStatus(context, `@uipath/cli ${heldBack} is available but was not installed: the daily update does not cross major versions. Run \`uip update\` to move to it, or \`uip config freeze\` to stay on this version.`);
|
|
5196
6498
|
}
|
|
5197
6499
|
const cliUpdated = report.Cli?.action === "updated";
|
|
5198
6500
|
const skillsUpdated = countRefreshedSkills(report) > 0;
|
|
@@ -5217,12 +6519,7 @@ function formatInstallLocationFailure(error) {
|
|
|
5217
6519
|
return `Update failed: could not resolve the CLI install location${suffix}`;
|
|
5218
6520
|
}
|
|
5219
6521
|
function formatUpdateStartMessage(target) {
|
|
5220
|
-
|
|
5221
|
-
if (!effectivePin) {
|
|
5222
|
-
return target.maxMajor === undefined ? "Updating UiPath CLI and skills." : `Updating UiPath CLI and skills within version ${target.maxMajor}.x.`;
|
|
5223
|
-
}
|
|
5224
|
-
const version = effectivePin.patch === undefined ? `${formatVersionPin(effectivePin)}.x` : formatVersionPin(effectivePin);
|
|
5225
|
-
return `Updating UiPath CLI and skills to version ${version}.`;
|
|
6522
|
+
return target.maxMajor === undefined ? "Updating UiPath CLI and skills." : `Updating UiPath CLI and skills within version ${target.maxMajor}.x.`;
|
|
5226
6523
|
}
|
|
5227
6524
|
async function reexecOriginalCommand(context) {
|
|
5228
6525
|
const { spawn } = await import("node:child_process");
|
|
@@ -5265,14 +6562,11 @@ function formatUpdateSuccessMessage(report) {
|
|
|
5265
6562
|
}
|
|
5266
6563
|
return parts.length > 0 ? `Update succeeded: ${parts.join("; ")}.` : "Update succeeded.";
|
|
5267
6564
|
}
|
|
5268
|
-
function formatUpdateFailureMessages(report
|
|
5269
|
-
const
|
|
5270
|
-
const messages = individual.map((error) => {
|
|
6565
|
+
function formatUpdateFailureMessages(report) {
|
|
6566
|
+
const messages = report.Errors.map((error) => {
|
|
5271
6567
|
const scope = error.Scope ? ` (${error.Scope})` : "";
|
|
5272
6568
|
return `Update failed: [${error.Subsystem}${scope}] ${error.Message}. Instructions: ${error.Instructions}`;
|
|
5273
6569
|
});
|
|
5274
|
-
if (collapsed)
|
|
5275
|
-
messages.unshift(`Update failed: ${collapsed}`);
|
|
5276
6570
|
if (messages.length > 0)
|
|
5277
6571
|
return messages;
|
|
5278
6572
|
if (report.Cli?.action === "failed" && report.Cli.reason) {
|
|
@@ -5290,13 +6584,6 @@ function runChild(spawnFn, command, args, env) {
|
|
|
5290
6584
|
child.on("close", (code) => resolve(code));
|
|
5291
6585
|
});
|
|
5292
6586
|
}
|
|
5293
|
-
function extractVerb(args) {
|
|
5294
|
-
for (const a of stripGlobalOptions(args.slice(2)).args) {
|
|
5295
|
-
if (!a.startsWith("-"))
|
|
5296
|
-
return a;
|
|
5297
|
-
}
|
|
5298
|
-
return;
|
|
5299
|
-
}
|
|
5300
6587
|
|
|
5301
6588
|
// src/utils/autoInstall.ts
|
|
5302
6589
|
async function autoInstallToolIfNeeded(args, program, toolManager, context) {
|
|
@@ -5418,13 +6705,13 @@ function registerToolCommands(program, discovered, context) {
|
|
|
5418
6705
|
}
|
|
5419
6706
|
|
|
5420
6707
|
// src/utils/resolveToolsDirectories.ts
|
|
5421
|
-
import { fileURLToPath } from "node:url";
|
|
6708
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
5422
6709
|
async function resolveToolsDirectories(context) {
|
|
5423
6710
|
if (context.capabilities.isBrowser) {
|
|
5424
6711
|
logger.debug("Browser mode — tools directory: /tools");
|
|
5425
6712
|
return { toolsDirs: ["/tools"], toolsDir: "/tools" };
|
|
5426
6713
|
}
|
|
5427
|
-
const currentFilePath =
|
|
6714
|
+
const currentFilePath = fileURLToPath2(import.meta.url);
|
|
5428
6715
|
const fs = getFileSystem2();
|
|
5429
6716
|
const toolsDirs = await resolveToolsDirs(currentFilePath, fs.env.cwd());
|
|
5430
6717
|
const toolsDir = toolsDirs[0];
|
|
@@ -5462,13 +6749,15 @@ async function buildNodeProgram(context) {
|
|
|
5462
6749
|
if (shouldPopulateTelemetryInstallContext(context.args)) {
|
|
5463
6750
|
await populateTelemetryInstallContext();
|
|
5464
6751
|
}
|
|
5465
|
-
const { setActiveAuthProfile, setAuthFileConfig } = await import("./index-
|
|
6752
|
+
const { setActiveAuthProfile, setAuthFileConfig } = await import("./index-e82sznr2.js");
|
|
5466
6753
|
setActiveAuthProfile(profile);
|
|
5467
6754
|
const [configErr, config] = await catchError(loadConfigAsync());
|
|
5468
6755
|
if (configErr) {
|
|
5469
6756
|
return {
|
|
5470
6757
|
onLoggerReady: () => {
|
|
5471
|
-
|
|
6758
|
+
if (refusesUnloadedConfig(context.args))
|
|
6759
|
+
return;
|
|
6760
|
+
warnConfigNotLoaded(configErr);
|
|
5472
6761
|
}
|
|
5473
6762
|
};
|
|
5474
6763
|
}
|
|
@@ -5491,22 +6780,28 @@ async function buildNodeProgram(context) {
|
|
|
5491
6780
|
await toolsDirsPromise.catch((err) => logger.debug(`Tool directory resolution failed during early exit: ${String(err)}`));
|
|
5492
6781
|
return null;
|
|
5493
6782
|
}
|
|
5494
|
-
const { program, cleanedArgs } = init;
|
|
6783
|
+
const { program, cleanedArgs, profileWasExplicit } = init;
|
|
6784
|
+
const explicitProfile = profileWasExplicit ? getActiveAuthProfile2() : undefined;
|
|
6785
|
+
if (explicitProfile !== undefined) {
|
|
6786
|
+
warnIfEnvAuthOverrides(`profile "${explicitProfile}"`);
|
|
6787
|
+
}
|
|
5495
6788
|
const { toolsDirs, toolsDir } = await toolsDirsPromise;
|
|
5496
|
-
|
|
6789
|
+
const resolveInstallPath = createInstallPathResolver(toolsDir, false);
|
|
5497
6790
|
registerLoginCommand(program, context);
|
|
5498
6791
|
registerLogoutCommand(program, context);
|
|
5499
6792
|
registerFeedbackCommand(program, context);
|
|
5500
|
-
registerSkillsCommand(program);
|
|
6793
|
+
registerSkillsCommand(program, resolveInstallPath);
|
|
5501
6794
|
registerMcpCommand(program);
|
|
5502
6795
|
registerUserCommand(program, context);
|
|
5503
6796
|
registerTrackCommand(program);
|
|
5504
6797
|
let discoveredTools = await discoverToolPaths(toolsDirs);
|
|
5505
|
-
const resolveInstallPath = createInstallPathResolver(toolsDir, false);
|
|
5506
6798
|
const toolManager = new ToolManager([], toolsDirs, resolveInstallPath, getCliVersionPrefix(), discoveredTools, context.args);
|
|
5507
6799
|
setPackagerFactoryProvider((verb) => toolManager.ensurePackagerFactory(verb));
|
|
5508
6800
|
setExecutorFactoryProvider((verb) => toolManager.ensureExecutorFactory(verb));
|
|
5509
|
-
|
|
6801
|
+
const verdict = await enforceVersionsConfig(context.args, resolveInstallPath);
|
|
6802
|
+
if (verdict === "refused")
|
|
6803
|
+
return null;
|
|
6804
|
+
if (toolsDir && verdict === "ok") {
|
|
5510
6805
|
const [autoInstallError] = await catchError(autoInstallToolIfNeeded(context.args, program, toolManager, context));
|
|
5511
6806
|
if (autoInstallError) {
|
|
5512
6807
|
OutputFormatter.error({
|
|
@@ -5530,6 +6825,7 @@ async function buildNodeProgram(context) {
|
|
|
5530
6825
|
resolveInstallPath,
|
|
5531
6826
|
getCliVersionPrefix
|
|
5532
6827
|
};
|
|
6828
|
+
registerConfigCommand(program, context, updateState);
|
|
5533
6829
|
registerToolsCommand(program, context, updateState);
|
|
5534
6830
|
registerUpdateCommand3(program, context, updateState);
|
|
5535
6831
|
finalizeProgram({
|
|
@@ -5567,4 +6863,4 @@ async function runNodeInvocation(context) {
|
|
|
5567
6863
|
|
|
5568
6864
|
export { runNode };
|
|
5569
6865
|
|
|
5570
|
-
//# debugId=
|
|
6866
|
+
//# debugId=0342E2B938D372B164756E2164756E21
|