@uipath/cli 1.205.0-preview.281 → 1.206.0-preview.282

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/{applicationinsights-s28k1t0d.js → applicationinsights-pwe8sf3y.js} +1269 -1269
  2. package/dist/{browser-strategy-6atc7v8s.js → browser-strategy-p5fhwxqj.js} +6 -7
  3. package/dist/cli-s27j1n5p.js +23 -0
  4. package/dist/contentStore-m1z06vbp.js +41 -0
  5. package/dist/environmentInfo-687282b3.js +71 -0
  6. package/dist/feedbackPrompts-t1enxv1x.js +144 -0
  7. package/dist/handlers-93z27zrr.js +805 -0
  8. package/dist/index-090cbg51.js +72 -0
  9. package/dist/index-16d4evd1.js +1051 -0
  10. package/dist/index-1vyte4ma.js +14 -0
  11. package/dist/index-1z45q8dr.js +365 -0
  12. package/dist/index-21kns9qg.js +10 -0
  13. package/dist/{index-30618bjs.js → index-2mm750yx.js} +174 -234
  14. package/dist/{index-622x1qb5.js → index-3fvbddpw.js} +7092 -7092
  15. package/dist/{index-d3w0wn6k.js → index-5gce5wfd.js} +16 -16
  16. package/dist/index-5j0bfd3e.js +4744 -0
  17. package/dist/index-5r4q8h0q.js +30 -0
  18. package/dist/index-68xmrb9x.js +237 -0
  19. package/dist/index-6wj58qka.js +59 -0
  20. package/dist/index-99emfvtm.js +13 -0
  21. package/dist/{index-pj3g8ftz.js → index-9db5vwx9.js} +2429 -1693
  22. package/dist/index-ayg25v46.js +151 -0
  23. package/dist/index-bf0e4evz.js +6180 -0
  24. package/dist/index-bpqx6f8h.js +92 -0
  25. package/dist/index-bpxh3fqv.js +392 -0
  26. package/dist/index-c6fsnn8s.js +200 -0
  27. package/dist/{index-m5nwse9v.js → index-cj4v0jct.js} +21 -69
  28. package/dist/index-ckafghar.js +274 -0
  29. package/dist/{index-469jgr1w.js → index-dsj3jrm0.js} +105 -106
  30. package/dist/{index-1yh8g550.js → index-epsr41wx.js} +8 -12
  31. package/dist/index-gbdz3pb5.js +668 -0
  32. package/dist/{index-yb4er9vd.js → index-jjejkkg4.js} +474 -528
  33. package/dist/index-jmz7bmca.js +1327 -0
  34. package/dist/{index-wwyf05nx.js → index-k9t8g78x.js} +331 -2595
  35. package/dist/index-kg1xrq51.js +171 -0
  36. package/dist/index-m8vqyv3g.js +72 -0
  37. package/dist/index-nht90rae.js +45 -0
  38. package/dist/index-nsrrst23.js +44 -0
  39. package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
  40. package/dist/index-qadhm1gn.js +271 -0
  41. package/dist/index-qwbyt2q5.js +95 -0
  42. package/dist/index-rr5hdtcy.js +95 -0
  43. package/dist/{index-qa9gftnj.js → index-xd2w5pct.js} +3 -3
  44. package/dist/{index-925304r7.js → index-y085rpen.js} +29 -25
  45. package/dist/index-y5ncb93a.js +240 -0
  46. package/dist/index-y7d0cth0.js +93 -0
  47. package/dist/{index-hdxtgckw.js → index-z070caqq.js} +56 -12
  48. package/dist/index-zdqbp34f.js +14 -0
  49. package/dist/index.js +38 -36
  50. package/dist/install-3gw33jcf.js +558 -0
  51. package/dist/{jmespath-e4a59c8w.js → jmespath-ab6tdc42.js} +1 -1
  52. package/dist/js-yaml-0c4svjwq.js +36 -0
  53. package/dist/{mcp-jssaz3wr.js → mcp-s50h6d56.js} +236 -472
  54. package/dist/{node-strategy-ggx3nmyj.js → node-strategy-p1n8wr5s.js} +16 -19
  55. package/dist/project-context-285hydnd.js +94 -0
  56. package/dist/prompt-yxpm7mfr.js +13 -0
  57. package/dist/{server-7jza1fyx.js → server-900wc6vc.js} +28 -43
  58. package/dist/skillCatalog-d1t2qec8.js +22 -0
  59. package/dist/skillsService-tpvbx5g8.js +29 -0
  60. package/dist/{stdio-tmngemcz.js → stdio-kpsab5bz.js} +2 -4
  61. package/dist/{telemetry-drain-r92f0e4r.js → telemetry-drain-bw59e8f5.js} +8 -9
  62. package/dist/tree-j4w7p0pg.js +17 -0
  63. package/dist/updateService-mt6d51p1.js +522 -0
  64. package/dist/updateService.skills-491vfgt8.js +22 -0
  65. package/dist/updateService.tools-f7tr6kc6.js +16 -0
  66. package/package.json +2 -2
  67. package/dist/cli-kyp49kdm.js +0 -19
  68. package/dist/index-0gctz400.js +0 -17
  69. package/dist/index-4cq44eth.js +0 -19427
  70. package/dist/index-7tshyfxx.js +0 -157
  71. package/dist/index-g8ck9tv6.js +0 -2
  72. package/dist/index-ngs0a2he.js +0 -15
  73. package/dist/index-pr8kzdte.js +0 -9867
  74. package/dist/index-yc4kw997.js +0 -13
  75. package/dist/js-yaml-69tsdrrf.js +0 -37
  76. package/dist/updateService-t3yq8936.js +0 -14
@@ -0,0 +1,558 @@
1
+ import"./index-z070caqq.js";
2
+ import {
3
+ catchError
4
+ } from "./index-9db5vwx9.js";
5
+ import"./index-bpxh3fqv.js";
6
+ import"./index-16d4evd1.js";
7
+ import"./index-qwbyt2q5.js";
8
+ import {
9
+ posixSq2
10
+ } from "./index-m8vqyv3g.js";
11
+
12
+ // src/commands/completion/bash.ts
13
+ function generateBash(root) {
14
+ const bin = root.name;
15
+ const fnName = `_${bin.replace(/-/g, "_")}`;
16
+ const lines = [];
17
+ lines.push(`# Generated by: ${bin} completion bash`);
18
+ lines.push(`# Install: ${bin} completion (writes a managed block in ~/.bashrc that sources this file)`);
19
+ lines.push("");
20
+ const lookup = {};
21
+ const optLookup = {};
22
+ function collect(node, path) {
23
+ if (node.subcommands.length > 0) {
24
+ lookup[path] = node.subcommands.map((s) => s.name).join(" ");
25
+ }
26
+ if (node.options.length > 0) {
27
+ optLookup[path] = node.options.map((o) => o.long ? `--${o.long}` : `-${o.short}`).join(" ");
28
+ }
29
+ for (const sub of node.subcommands) {
30
+ collect(sub, `${path} ${sub.name}`);
31
+ }
32
+ }
33
+ collect(root, bin);
34
+ lines.push(`${fnName}_subs() {`);
35
+ lines.push(' case "$1" in');
36
+ for (const [p, subs] of Object.entries(lookup)) {
37
+ lines.push(` '${posixSq2(p)}') echo '${posixSq2(subs)}' ;;`);
38
+ }
39
+ lines.push(" esac");
40
+ lines.push("}");
41
+ lines.push("");
42
+ lines.push(`${fnName}_opts() {`);
43
+ lines.push(' case "$1" in');
44
+ for (const [p, opts] of Object.entries(optLookup)) {
45
+ lines.push(` '${posixSq2(p)}') echo '${posixSq2(opts)}' ;;`);
46
+ }
47
+ lines.push(" esac");
48
+ lines.push("}");
49
+ lines.push("");
50
+ lines.push(`${fnName}() {`);
51
+ lines.push(" local cur path i w children");
52
+ lines.push(' cur="${COMP_WORDS[COMP_CWORD]}"');
53
+ lines.push("");
54
+ lines.push(` path="${bin}"`);
55
+ lines.push(" for ((i=1; i<COMP_CWORD; i++)); do");
56
+ lines.push(' w="${COMP_WORDS[i]}"');
57
+ lines.push(' [[ "$w" == -* ]] && continue');
58
+ lines.push(` children=" $(${fnName}_subs "$path") "`);
59
+ lines.push(' case "$children" in *" $w "*) path="$path $w" ;; esac');
60
+ lines.push(" done");
61
+ lines.push("");
62
+ lines.push(' if [[ "$cur" == -* ]]; then');
63
+ lines.push(` COMPREPLY=($(compgen -W "$(${fnName}_opts "$path")" -- "$cur"))`);
64
+ lines.push(" else");
65
+ lines.push(` COMPREPLY=($(compgen -W "$(${fnName}_subs "$path")" -- "$cur"))`);
66
+ lines.push(" fi");
67
+ lines.push("}");
68
+ lines.push("");
69
+ lines.push(`complete -F ${fnName} ${bin}`);
70
+ lines.push("");
71
+ return lines.join(`
72
+ `);
73
+ }
74
+
75
+ // src/commands/completion/fish.ts
76
+ function generateFish(root) {
77
+ const bin = root.name;
78
+ const helperFn = `__${bin.replace(/-/g, "_")}_path_matches`;
79
+ const lines = [];
80
+ lines.push(`# Generated by: ${bin} completion fish`);
81
+ lines.push(`# Add to config: ${bin} completion fish | source`);
82
+ lines.push("# Use --opt=value (not --opt value) after subcommands — static completion can't know flag arity.");
83
+ lines.push("");
84
+ lines.push(`function ${helperFn}`);
85
+ lines.push(" set -l tokens (commandline -opc)");
86
+ lines.push(" set -l subs");
87
+ lines.push(" for i in (seq 2 (count $tokens))");
88
+ lines.push(" set -l tok $tokens[$i]");
89
+ lines.push(" string match -q -- '-*' $tok; and continue");
90
+ lines.push(" set -a subs $tok");
91
+ lines.push(" end");
92
+ lines.push(" test (count $subs) -eq (count $argv)");
93
+ lines.push(" or return 1");
94
+ lines.push(" for i in (seq (count $argv))");
95
+ lines.push(' test "$argv[$i]" = "$subs[$i]"');
96
+ lines.push(" or return 1");
97
+ lines.push(" end");
98
+ lines.push(" return 0");
99
+ lines.push("end");
100
+ lines.push("");
101
+ function emit(node, path) {
102
+ for (const segment of path) {
103
+ if (/[|()[\]{}"'$`\\]/.test(segment)) {
104
+ throw new Error(`Fish generator: command path segment "${segment}" contains shell-special characters; rename the command or extend the fish emitter to escape it.`);
105
+ }
106
+ }
107
+ const condition = path.length === 0 ? helperFn : `${helperFn} ${path.join(" ")}`;
108
+ for (const sub of node.subcommands) {
109
+ let line = `complete -c ${bin} -n "${condition}" -a '${posixSq2(sub.name)}'`;
110
+ if (sub.description) {
111
+ line += ` -d '${posixSq2(sub.description)}'`;
112
+ }
113
+ lines.push(line);
114
+ }
115
+ for (const opt of node.options) {
116
+ let line = `complete -c ${bin} -n "${condition}"`;
117
+ if (opt.long)
118
+ line += ` -l '${posixSq2(opt.long)}'`;
119
+ if (opt.short)
120
+ line += ` -s '${posixSq2(opt.short)}'`;
121
+ if (opt.flags.includes("<") || opt.flags.includes("[")) {
122
+ line += " -r";
123
+ }
124
+ if (opt.description) {
125
+ line += ` -d '${posixSq2(opt.description)}'`;
126
+ }
127
+ lines.push(line);
128
+ }
129
+ for (const sub of node.subcommands) {
130
+ emit(sub, [...path, sub.name]);
131
+ }
132
+ }
133
+ emit(root, []);
134
+ lines.push("");
135
+ return lines.join(`
136
+ `);
137
+ }
138
+
139
+ // src/commands/completion/pwsh.ts
140
+ function generatePwsh(root) {
141
+ const bin = root.name;
142
+ const subs = {};
143
+ const opts = {};
144
+ function collect(node, path) {
145
+ if (node.subcommands.length > 0) {
146
+ subs[path] = node.subcommands.map((s) => s.name);
147
+ }
148
+ if (node.options.length > 0) {
149
+ opts[path] = node.options.map((o) => o.long ? `--${o.long}` : `-${o.short}`);
150
+ }
151
+ for (const sub of node.subcommands) {
152
+ collect(sub, `${path} ${sub.name}`);
153
+ }
154
+ }
155
+ collect(root, bin);
156
+ const q = (s) => `'${s.replace(/'/g, "''")}'`;
157
+ const lines = [];
158
+ lines.push(`# Generated by: ${bin} completion pwsh`);
159
+ lines.push(`# Install: ${bin} completion (writes a managed block in $PROFILE that dot-sources this file)`);
160
+ lines.push("");
161
+ lines.push(`Register-ArgumentCompleter -Native -CommandName ${bin} -ScriptBlock {`);
162
+ lines.push(" param($wordToComplete, $commandAst, $cursorPosition)");
163
+ lines.push("");
164
+ lines.push(" $subcommands = @{");
165
+ for (const [p, children] of Object.entries(subs)) {
166
+ lines.push(` ${q(p)} = @(${children.map(q).join(", ")})`);
167
+ }
168
+ lines.push(" }");
169
+ lines.push(" $options = @{");
170
+ for (const [p, flags] of Object.entries(opts)) {
171
+ lines.push(` ${q(p)} = @(${flags.map(q).join(", ")})`);
172
+ }
173
+ lines.push(" }");
174
+ lines.push("");
175
+ lines.push(" $elements = $commandAst.CommandElements");
176
+ lines.push(` $path = ${q(bin)}`);
177
+ lines.push(" for ($i = 1; $i -lt $elements.Count; $i++) {");
178
+ lines.push(" $tok = $elements[$i].Extent.Text");
179
+ lines.push(" if ($tok -eq $wordToComplete) { break }");
180
+ lines.push(" if ($tok -like '-*') { continue }");
181
+ lines.push(" $children = $subcommands[$path]");
182
+ lines.push(' if ($children -and ($children -contains $tok)) { $path = "$path $tok" }');
183
+ lines.push(" }");
184
+ lines.push("");
185
+ lines.push(" if ($wordToComplete -like '-*') {");
186
+ lines.push(" $candidates = $options[$path]");
187
+ lines.push(" } else {");
188
+ lines.push(" $candidates = $subcommands[$path]");
189
+ lines.push(" }");
190
+ lines.push(" if ($null -eq $candidates) { return }");
191
+ lines.push(' $candidates | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {');
192
+ lines.push(" [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)");
193
+ lines.push(" }");
194
+ lines.push("}");
195
+ lines.push("");
196
+ return lines.join(`
197
+ `);
198
+ }
199
+
200
+ // src/commands/completion/zsh.ts
201
+ var longOptionForKey = (key) => `--${key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`;
202
+ function renderArgWithPlaceholders(template) {
203
+ const parts = template.split(/\{([a-zA-Z][a-zA-Z0-9]*)\}/);
204
+ const out = [];
205
+ for (let i = 0;i < parts.length; i++) {
206
+ if (i % 2 === 0) {
207
+ if (parts[i] !== "")
208
+ out.push(`'${posixSq2(parts[i])}'`);
209
+ } else {
210
+ out.push(`"$_req_${parts[i]}"`);
211
+ }
212
+ }
213
+ return out.length > 0 ? out.join("") : "''";
214
+ }
215
+ function renderJqSelector(template) {
216
+ const requiredArgs = [];
217
+ const selector = template.replace(/\{([a-zA-Z][a-zA-Z0-9]*)\}/g, (_, name) => {
218
+ if (!requiredArgs.includes(name))
219
+ requiredArgs.push(name);
220
+ return `$${name}`;
221
+ });
222
+ return { selector, requiredArgs };
223
+ }
224
+ function generateZsh(root) {
225
+ const bin = root.name;
226
+ const fnPrefix = `_${bin.replace(/-/g, "_")}`;
227
+ const lines = [];
228
+ lines.push(`#compdef ${bin}`);
229
+ lines.push("");
230
+ lines.push(`# Generated by: ${bin} completion zsh`);
231
+ lines.push(`# Install: ${bin} completion (writes a managed block in ~/.zshrc that sources this file)`);
232
+ lines.push("");
233
+ lines.push(`${fnPrefix}_run_completer() {`);
234
+ lines.push(" local selector=$1; shift");
235
+ lines.push(" local -a jq_args");
236
+ lines.push(" while [[ ${1:-} == --arg ]]; do");
237
+ lines.push(' jq_args+=(--arg "$2" "$3")');
238
+ lines.push(" shift 3");
239
+ lines.push(" done");
240
+ lines.push(" (( ${+commands[jq]} )) || return 0");
241
+ lines.push(" local -a out");
242
+ lines.push(` out=(\${(f)"$("$@" 2>/dev/null | jq -r "\${jq_args[@]}" "$selector" 2>/dev/null)"})`);
243
+ lines.push(' (( ${#out} )) && compadd -- "${out[@]}"');
244
+ lines.push("}");
245
+ lines.push("");
246
+ function emitFunction(node, path) {
247
+ for (const segment of [...path, node.name]) {
248
+ if (/[|()[\]{}"'$`\\]/.test(segment)) {
249
+ throw new Error(`Zsh generator: command path segment "${segment}" contains shell-special characters; rename the command or extend the zsh emitter to escape it.`);
250
+ }
251
+ }
252
+ const fnName = path.length === 0 ? fnPrefix : `${fnPrefix}__${path.join("__").replace(/-/g, "_")}`;
253
+ lines.push(`${fnName}() {`);
254
+ if (path.length === 0) {
255
+ lines.push(` typeset -g ${fnPrefix}_bin=\${words[1]}`);
256
+ }
257
+ emitDynamicDispatch(node, lines, fnPrefix, bin);
258
+ emitSubcommandHandling(node, lines, fnPrefix, path);
259
+ emitOptionHandling(node, lines);
260
+ lines.push("}");
261
+ lines.push("");
262
+ for (const sub of node.subcommands) {
263
+ emitFunction(sub, [...path, sub.name]);
264
+ }
265
+ }
266
+ emitFunction(root, []);
267
+ lines.push(`compdef ${fnPrefix} ${bin}`);
268
+ lines.push("");
269
+ return lines.join(`
270
+ `);
271
+ }
272
+ function emitDynamicDispatch(node, lines, fnPrefix, bin) {
273
+ const completables = node.options.filter((o) => o.completer && o.long);
274
+ if (completables.length === 0)
275
+ return;
276
+ lines.push(" if (( CURRENT > 2 )); then");
277
+ lines.push(" local _prev=${words[CURRENT-1]}");
278
+ lines.push(" case $_prev in");
279
+ for (const opt of completables) {
280
+ const spec = opt.completer;
281
+ lines.push(` '--${posixSq2(opt.long)}')`);
282
+ const { selector, requiredArgs } = renderJqSelector(spec.valueSelector);
283
+ const required = spec.requiresOptions ?? [];
284
+ const unguarded = requiredArgs.filter((n) => !required.includes(n));
285
+ if (unguarded.length > 0) {
286
+ throw new Error(`Zsh generator: valueSelector placeholder(s) {${unguarded.join("}, {")}} are not listed in requiresOptions — add them or the generated --arg will expand to an empty string.`);
287
+ }
288
+ for (const k of required) {
289
+ if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(k)) {
290
+ throw new Error(`Zsh generator: requiresOptions key "${k}" is not a valid camelCase identifier (used as a zsh variable name suffix).`);
291
+ }
292
+ lines.push(` local _req_${k}=""`);
293
+ lines.push(" local _i");
294
+ lines.push(" for ((_i=2; _i<CURRENT; _i++)); do");
295
+ lines.push(` [[ \${words[_i]} == ${longOptionForKey(k)} ]] && _req_${k}=\${words[_i+1]}`);
296
+ lines.push(" done");
297
+ lines.push(` [[ -z $_req_${k} ]] && return`);
298
+ }
299
+ const [cmdBin, ...cmdArgs] = spec.command;
300
+ const binToken = cmdBin === bin ? `"$${fnPrefix}_bin"` : `'${posixSq2(cmdBin ?? bin)}'`;
301
+ const argsStr = cmdArgs.map(renderArgWithPlaceholders).join(" ");
302
+ const jqArgPairs = requiredArgs.map((name) => `--arg ${name} "$_req_${name}"`).join(" ");
303
+ const jqArgsPrefix = jqArgPairs ? `${jqArgPairs} ` : "";
304
+ lines.push(` ${fnPrefix}_run_completer '${posixSq2(selector)}' ${jqArgsPrefix}${binToken} ${argsStr}`);
305
+ lines.push(" return");
306
+ lines.push(" ;;");
307
+ }
308
+ lines.push(" esac");
309
+ lines.push(" fi");
310
+ }
311
+ function emitSubcommandHandling(node, lines, fnPrefix, path) {
312
+ if (node.subcommands.length === 0)
313
+ return;
314
+ lines.push(" local i");
315
+ lines.push(" for ((i=2; i<CURRENT; i++)); do");
316
+ lines.push(" case $words[i] in");
317
+ for (const sub of node.subcommands) {
318
+ const subFn = `${fnPrefix}__${[...path, sub.name].join("__").replace(/-/g, "_")}`;
319
+ lines.push(` '${posixSq2(sub.name)}') shift $((i-1)) words; ((CURRENT-=i-1)); ${subFn}; return ;;`);
320
+ }
321
+ lines.push(" esac");
322
+ lines.push(" done");
323
+ lines.push("");
324
+ lines.push(" local -a commands");
325
+ lines.push(" commands=(");
326
+ for (const sub of node.subcommands) {
327
+ lines.push(` '${posixSq2(sub.name)}:${posixSq2(sub.description)}'`);
328
+ }
329
+ lines.push(" )");
330
+ lines.push(" _describe -t commands 'command' commands");
331
+ }
332
+ function emitOptionHandling(node, lines) {
333
+ if (node.options.length === 0)
334
+ return;
335
+ lines.push(" local -a options");
336
+ lines.push(" options=(");
337
+ for (const opt of node.options) {
338
+ const desc = posixSq2(opt.description);
339
+ if (opt.long)
340
+ lines.push(` '--${posixSq2(opt.long)}:${desc}'`);
341
+ if (opt.short)
342
+ lines.push(` '-${posixSq2(opt.short)}:${desc}'`);
343
+ }
344
+ lines.push(" )");
345
+ lines.push(" _describe -t options 'option' options");
346
+ }
347
+
348
+ // src/commands/completion/install.ts
349
+ var blockStart = (bin) => `# >>> ${bin} completion >>>`;
350
+ var blockEnd = (bin) => `# <<< ${bin} completion <<<`;
351
+ var blockRe = (bin) => {
352
+ const escaped = bin.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
353
+ return new RegExp(`(?:\\r?\\n)*# >>> ${escaped} completion >>>[\\s\\S]*?# <<< ${escaped} completion <<<(?:\\r?\\n)*`, "g");
354
+ };
355
+ function normalizeShell(shell) {
356
+ switch (shell) {
357
+ case "bash":
358
+ case "zsh":
359
+ case "fish":
360
+ case "pwsh":
361
+ return shell;
362
+ case "powershell":
363
+ return "pwsh";
364
+ default:
365
+ return null;
366
+ }
367
+ }
368
+ function resolveUninstallTarget(shell, bin, fs) {
369
+ const home = fs.env.homedir();
370
+ const scriptDir = shell === "pwsh" && process.platform === "win32" ? fs.path.join(home, "Documents", "PowerShell", bin) : fs.path.join(home, ".config", bin);
371
+ switch (shell) {
372
+ case "zsh":
373
+ return {
374
+ bin,
375
+ shell,
376
+ rcPath: fs.path.join(home, ".zshrc"),
377
+ mode: "block",
378
+ scriptPath: fs.path.join(scriptDir, "completion.zsh")
379
+ };
380
+ case "bash": {
381
+ const bashRc = fs.path.join(home, process.platform === "darwin" ? ".bash_profile" : ".bashrc");
382
+ return {
383
+ bin,
384
+ shell,
385
+ rcPath: bashRc,
386
+ mode: "block",
387
+ scriptPath: fs.path.join(scriptDir, "completion.bash")
388
+ };
389
+ }
390
+ case "fish":
391
+ return {
392
+ bin,
393
+ shell,
394
+ rcPath: fs.path.join(home, ".config", "fish", "completions", `${bin}.fish`),
395
+ mode: "file"
396
+ };
397
+ case "pwsh": {
398
+ const pwshRc = process.platform === "win32" ? fs.path.join(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1") : fs.path.join(home, ".config", "powershell", "Microsoft.PowerShell_profile.ps1");
399
+ return {
400
+ bin,
401
+ shell,
402
+ rcPath: pwshRc,
403
+ mode: "block",
404
+ scriptPath: fs.path.join(scriptDir, "completion.ps1")
405
+ };
406
+ }
407
+ }
408
+ }
409
+ function resolveTarget(shell, root, fs) {
410
+ const bin = root.name;
411
+ const paths = resolveUninstallTarget(shell, bin, fs);
412
+ const managedBlock = (line) => `${blockStart(bin)}
413
+ ${line}
414
+ ${blockEnd(bin)}`;
415
+ const requireScriptPath = () => {
416
+ if (!paths.scriptPath) {
417
+ throw new Error(`resolveUninstallTarget(${shell}) returned no scriptPath for block-mode install`);
418
+ }
419
+ return paths.scriptPath;
420
+ };
421
+ switch (shell) {
422
+ case "zsh": {
423
+ const scriptPath = requireScriptPath();
424
+ return {
425
+ ...paths,
426
+ content: managedBlock(`source '${posixSq2(scriptPath)}'`),
427
+ scriptContent: generateZsh(root)
428
+ };
429
+ }
430
+ case "bash": {
431
+ const scriptPath = requireScriptPath();
432
+ return {
433
+ ...paths,
434
+ content: managedBlock(`source '${posixSq2(scriptPath)}'`),
435
+ scriptContent: generateBash(root)
436
+ };
437
+ }
438
+ case "fish":
439
+ return {
440
+ ...paths,
441
+ content: generateFish(root)
442
+ };
443
+ case "pwsh": {
444
+ const scriptPath = requireScriptPath();
445
+ return {
446
+ ...paths,
447
+ content: managedBlock(`. '${scriptPath.replace(/'/g, "''")}'`),
448
+ scriptContent: generatePwsh(root)
449
+ };
450
+ }
451
+ }
452
+ }
453
+ function stripManagedBlock(content, bin) {
454
+ return content.replace(blockRe(bin), `
455
+ `);
456
+ }
457
+ async function writeScriptFile(target, fs) {
458
+ if (!target.scriptPath || target.scriptContent === undefined) {
459
+ return "skipped";
460
+ }
461
+ await fs.mkdir(fs.path.dirname(target.scriptPath));
462
+ const [existsErr, existsValue] = await catchError(fs.exists(target.scriptPath));
463
+ if (existsErr)
464
+ throw existsErr;
465
+ if (existsValue === true) {
466
+ const [readErr, prev] = await catchError(fs.readFile(target.scriptPath, "utf-8"));
467
+ if (readErr)
468
+ throw readErr;
469
+ if (prev === target.scriptContent)
470
+ return "skipped";
471
+ }
472
+ await fs.writeFile(target.scriptPath, target.scriptContent);
473
+ return "written";
474
+ }
475
+ async function doInstall(target, fs) {
476
+ const [existsErr, existsValue] = await catchError(fs.exists(target.rcPath));
477
+ if (existsErr)
478
+ throw existsErr;
479
+ const exists = existsValue === true;
480
+ await fs.mkdir(fs.path.dirname(target.rcPath));
481
+ if (target.mode === "file") {
482
+ let prev = null;
483
+ if (exists) {
484
+ const [readErr, contents] = await catchError(fs.readFile(target.rcPath, "utf-8"));
485
+ if (readErr)
486
+ throw readErr;
487
+ prev = contents;
488
+ }
489
+ if (prev === target.content)
490
+ return "skipped";
491
+ await fs.writeFile(target.rcPath, target.content);
492
+ return exists ? "updated" : "installed";
493
+ }
494
+ const scriptWrite = await writeScriptFile(target, fs);
495
+ if (!exists) {
496
+ await fs.writeFile(target.rcPath, `${target.content}
497
+ `);
498
+ return "installed";
499
+ }
500
+ const [readErr, existing] = await catchError(fs.readFile(target.rcPath, "utf-8"));
501
+ if (readErr)
502
+ throw readErr;
503
+ const prev = existing ?? "";
504
+ const stripped = stripManagedBlock(prev, target.bin).replace(/\n+$/, "");
505
+ const sep = stripped ? `
506
+ ` : "";
507
+ const next = `${stripped}${sep}${target.content}
508
+ `;
509
+ const rcWritten = next !== prev;
510
+ if (rcWritten)
511
+ await fs.writeFile(target.rcPath, next);
512
+ if (!rcWritten && scriptWrite === "skipped")
513
+ return "skipped";
514
+ return prev.includes(blockStart(target.bin)) ? "updated" : "installed";
515
+ }
516
+ async function doUninstall(target, fs) {
517
+ const [existsErr, existsValue] = await catchError(fs.exists(target.rcPath));
518
+ if (existsErr)
519
+ throw existsErr;
520
+ if (target.mode === "file") {
521
+ if (!existsValue)
522
+ return "nothing";
523
+ await fs.rm(target.rcPath);
524
+ return "removed";
525
+ }
526
+ let removed = false;
527
+ if (existsValue) {
528
+ const [readErr, existing] = await catchError(fs.readFile(target.rcPath, "utf-8"));
529
+ if (readErr)
530
+ throw readErr;
531
+ const prev = existing ?? "";
532
+ if (prev.includes(blockStart(target.bin))) {
533
+ const next = stripManagedBlock(prev, target.bin).replace(/\n+$/, `
534
+ `);
535
+ await fs.writeFile(target.rcPath, next);
536
+ removed = true;
537
+ }
538
+ }
539
+ if (target.scriptPath) {
540
+ const [scriptExistsErr, scriptExists] = await catchError(fs.exists(target.scriptPath));
541
+ if (scriptExistsErr)
542
+ throw scriptExistsErr;
543
+ if (scriptExists) {
544
+ await fs.rm(target.scriptPath);
545
+ removed = true;
546
+ }
547
+ }
548
+ return removed ? "removed" : "nothing";
549
+ }
550
+ export {
551
+ doInstall,
552
+ doUninstall,
553
+ normalizeShell,
554
+ resolveTarget,
555
+ resolveUninstallTarget
556
+ };
557
+
558
+ //# debugId=F5BF273A118025BB64756E2164756E21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __commonJS
3
- } from "./index-1yh8g550.js";
3
+ } from "./index-epsr41wx.js";
4
4
 
5
5
  // ../../node_modules/jmespath/jmespath.js
6
6
  var require_jmespath = __commonJS(function(exports) {
@@ -0,0 +1,36 @@
1
+ import {
2
+ yaml,
3
+ Type2,
4
+ Schema2,
5
+ FAILSAFE_SCHEMA2,
6
+ JSON_SCHEMA2,
7
+ CORE_SCHEMA2,
8
+ DEFAULT_SCHEMA2,
9
+ load2,
10
+ loadAll2,
11
+ dump2,
12
+ YAMLException2,
13
+ types2,
14
+ safeLoad2,
15
+ safeLoadAll2,
16
+ safeDump2
17
+ } from "./index-5gce5wfd.js";
18
+ export {
19
+ CORE_SCHEMA2 as CORE_SCHEMA,
20
+ DEFAULT_SCHEMA2 as DEFAULT_SCHEMA,
21
+ FAILSAFE_SCHEMA2 as FAILSAFE_SCHEMA,
22
+ JSON_SCHEMA2 as JSON_SCHEMA,
23
+ Schema2 as Schema,
24
+ Type2 as Type,
25
+ YAMLException2 as YAMLException,
26
+ yaml as default,
27
+ dump2 as dump,
28
+ load2 as load,
29
+ loadAll2 as loadAll,
30
+ safeDump2 as safeDump,
31
+ safeLoad2 as safeLoad,
32
+ safeLoadAll2 as safeLoadAll,
33
+ types2 as types
34
+ };
35
+
36
+ //# debugId=63F44311F167DCFE64756E2164756E21