@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
@@ -1,7 +1,3 @@
1
- import {
2
- __export
3
- } from "./index-1yh8g550.js";
4
-
5
1
  // ../../node_modules/ora/index.js
6
2
  import process8 from "node:process";
7
3
  import { stripVTControlCharacters } from "node:util";
@@ -556,8 +552,8 @@ var onetime = (function_, options = {}) => {
556
552
  let returnValue;
557
553
  let callCount = 0;
558
554
  const functionName = function_.displayName || function_.name || "<anonymous>";
559
- const onetime2 = function(...arguments_) {
560
- calledFunctions.set(onetime2, ++callCount);
555
+ const onetime = function(...arguments_) {
556
+ calledFunctions.set(onetime, ++callCount);
561
557
  if (callCount === 1) {
562
558
  returnValue = function_.apply(this, arguments_);
563
559
  function_ = undefined;
@@ -566,9 +562,9 @@ var onetime = (function_, options = {}) => {
566
562
  }
567
563
  return returnValue;
568
564
  };
569
- mimicFunction(onetime2, function_);
570
- calledFunctions.set(onetime2, callCount);
571
- return onetime2;
565
+ mimicFunction(onetime, function_);
566
+ calledFunctions.set(onetime, callCount);
567
+ return onetime;
572
568
  };
573
569
  onetime.callCount = (function_) => {
574
570
  if (!calledFunctions.has(function_)) {
@@ -589,7 +585,7 @@ if (process.platform === "linux") {
589
585
  }
590
586
 
591
587
  // ../../node_modules/ora/node_modules/cli-cursor/node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/index.js
592
- var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
588
+ var processOk = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
593
589
  var kExitEmitter = Symbol.for("signal-exit emitter");
594
590
  var global = globalThis;
595
591
  var ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -679,15 +675,15 @@ class SignalExit extends SignalExitBase {
679
675
  #originalProcessReallyExit;
680
676
  #sigListeners = {};
681
677
  #loaded = false;
682
- constructor(process3) {
678
+ constructor(process2) {
683
679
  super();
684
- this.#process = process3;
680
+ this.#process = process2;
685
681
  this.#sigListeners = {};
686
682
  for (const sig of signals) {
687
683
  this.#sigListeners[sig] = () => {
688
684
  const listeners = this.#process.listeners(sig);
689
685
  let { count } = this.#emitter;
690
- const p = process3;
686
+ const p = process2;
691
687
  if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
692
688
  count += p.__signal_exit_emitter__.count;
693
689
  }
@@ -696,12 +692,12 @@ class SignalExit extends SignalExitBase {
696
692
  const ret = this.#emitter.emit("exit", null, sig);
697
693
  const s = sig === "SIGHUP" ? this.#hupSig : sig;
698
694
  if (!ret)
699
- process3.kill(process3.pid, s);
695
+ process2.kill(process2.pid, s);
700
696
  }
701
697
  };
702
698
  }
703
- this.#originalProcessReallyExit = process3.reallyExit;
704
- this.#originalProcessEmit = process3.emit;
699
+ this.#originalProcessReallyExit = process2.reallyExit;
700
+ this.#originalProcessEmit = process2.emit;
705
701
  }
706
702
  onExit(cb, opts) {
707
703
  if (!processOk(this.#process)) {
@@ -2527,15 +2523,6 @@ var spinners_default = {
2527
2523
  var cli_spinners_default = spinners_default;
2528
2524
  var spinnersList = Object.keys(spinners_default);
2529
2525
 
2530
- // ../../node_modules/ora/node_modules/log-symbols/symbols.js
2531
- var exports_symbols = {};
2532
- __export(exports_symbols, {
2533
- error: () => error,
2534
- info: () => info,
2535
- success: () => success,
2536
- warning: () => warning
2537
- });
2538
-
2539
2526
  // ../../node_modules/yoctocolors/base.js
2540
2527
  import tty2 from "node:tty";
2541
2528
  var hasColors = tty2?.WriteStream?.prototype?.hasColors?.() ?? false;
@@ -2609,12 +2596,12 @@ var bgWhiteBright = format(107, 49);
2609
2596
  // ../../node_modules/ora/node_modules/is-unicode-supported/index.js
2610
2597
  import process6 from "node:process";
2611
2598
  function isUnicodeSupported() {
2612
- const { env: env2 } = process6;
2613
- const { TERM, TERM_PROGRAM } = env2;
2599
+ const { env } = process6;
2600
+ const { TERM, TERM_PROGRAM } = env;
2614
2601
  if (process6.platform !== "win32") {
2615
2602
  return TERM !== "linux";
2616
2603
  }
2617
- return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
2604
+ return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
2618
2605
  }
2619
2606
 
2620
2607
  // ../../node_modules/ora/node_modules/log-symbols/symbols.js
@@ -3355,16 +3342,16 @@ class Ora {
3355
3342
  return this;
3356
3343
  }
3357
3344
  succeed(text) {
3358
- return this.stopAndPersist({ symbol: exports_symbols.success, text });
3345
+ return this.stopAndPersist({ symbol: success, text });
3359
3346
  }
3360
3347
  fail(text) {
3361
- return this.stopAndPersist({ symbol: exports_symbols.error, text });
3348
+ return this.stopAndPersist({ symbol: error, text });
3362
3349
  }
3363
3350
  warn(text) {
3364
- return this.stopAndPersist({ symbol: exports_symbols.warning, text });
3351
+ return this.stopAndPersist({ symbol: warning, text });
3365
3352
  }
3366
3353
  info(text) {
3367
- return this.stopAndPersist({ symbol: exports_symbols.info, text });
3354
+ return this.stopAndPersist({ symbol: info, text });
3368
3355
  }
3369
3356
  stopAndPersist(options = {}) {
3370
3357
  if (this.isSilent) {
@@ -3384,43 +3371,8 @@ class Ora {
3384
3371
  function ora(options) {
3385
3372
  return new Ora(options);
3386
3373
  }
3387
- async function oraPromise(action, options) {
3388
- const actionIsFunction = typeof action === "function";
3389
- const actionIsPromise = typeof action?.then === "function";
3390
- if (!actionIsFunction && !actionIsPromise) {
3391
- throw new TypeError("Parameter `action` must be a Function or a Promise");
3392
- }
3393
- const {
3394
- successText,
3395
- failText,
3396
- successSymbol,
3397
- failSymbol
3398
- } = typeof options === "object" && options !== null ? options : {};
3399
- const spinner = ora(options).start();
3400
- try {
3401
- const promise = actionIsFunction ? action(spinner) : action;
3402
- const result = await promise;
3403
- const text = successText === undefined ? undefined : typeof successText === "string" ? successText : successText(result);
3404
- if (successSymbol === undefined) {
3405
- spinner.succeed(text);
3406
- } else {
3407
- spinner.stopAndPersist({ symbol: successSymbol, text });
3408
- }
3409
- return result;
3410
- } catch (error2) {
3411
- const text = failText === undefined ? undefined : typeof failText === "string" ? failText : failText(error2);
3412
- if (failSymbol === undefined) {
3413
- spinner.fail(text);
3414
- } else {
3415
- spinner.stopAndPersist({ symbol: failSymbol, text });
3416
- }
3417
- throw error2;
3418
- }
3419
- }
3420
3374
  export {
3421
- ora as default,
3422
- oraPromise,
3423
- cli_spinners_default as spinners
3375
+ ora as default
3424
3376
  };
3425
3377
 
3426
- //# debugId=4F0ECF4A73C485D264756E2164756E21
3378
+ //# debugId=0ED51A39122E7F1264756E2164756E21
@@ -0,0 +1,274 @@
1
+ import {
2
+ getFileSystem2
3
+ } from "./index-z070caqq.js";
4
+ import {
5
+ catchError
6
+ } from "./index-9db5vwx9.js";
7
+ import {
8
+ REPO_URL2,
9
+ parseSkillMd2
10
+ } from "./index-jmz7bmca.js";
11
+
12
+ // src/commands/skills/skillCatalog.ts
13
+ var SKILL_CATALOG_SCHEMA_VERSION = 1;
14
+ var SKILL_CATALOG_GENERATED_BY = "uipath-cli.skills.catalog";
15
+ var SKILL_CATALOG_MARKER = "<!-- Generated by uip skills catalog. Safe to overwrite. -->";
16
+ var SKILL_CATALOG_SKILL_NAME2 = "uipath-skill-catalog";
17
+ var SKILL_CATALOG_JSON = "skills.catalog.json";
18
+ var SKILL_CATALOG_README = "README.md";
19
+ var SKILL_CATALOG_INDEX = "INDEX.md";
20
+ var SEARCH_STOPWORDS = new Set([
21
+ "a",
22
+ "an",
23
+ "and",
24
+ "for",
25
+ "in",
26
+ "of",
27
+ "on",
28
+ "or",
29
+ "the",
30
+ "to",
31
+ "with"
32
+ ]);
33
+ function asRecord(value) {
34
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
35
+ return;
36
+ }
37
+ return value;
38
+ }
39
+ function markdownEscape(value) {
40
+ return value.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
41
+ }
42
+ function renderSkillsSearchCommand(catalog) {
43
+ return catalog.scope === "local" ? 'uip skills search --local "<goal>" --output json' : 'uip skills search "<goal>" --output json';
44
+ }
45
+ function normalizeSearchText(value) {
46
+ return value.toLowerCase().replace(/[^a-z0-9.-]+/g, " ").trim();
47
+ }
48
+ function searchTokens(query) {
49
+ return Array.from(new Set(normalizeSearchText(query).split(/\s+/).filter((token) => token.length > 1 && !SEARCH_STOPWORDS.has(token))));
50
+ }
51
+ function hasToken(text, token) {
52
+ return text.split(/\s+/).some((word) => {
53
+ if (word === token)
54
+ return true;
55
+ if (word.split(/[.-]/).includes(token))
56
+ return true;
57
+ return token.length >= 4 && word.startsWith(token);
58
+ });
59
+ }
60
+ async function readSkillMetadata(skill) {
61
+ const fs = getFileSystem2();
62
+ const skillMdPath = fs.path.join(skill.skillDir, "SKILL.md");
63
+ const [err, content] = await catchError(fs.readFile(skillMdPath, { encoding: "utf-8" }));
64
+ const parsed = err || !content ? {
65
+ meta: {
66
+ name: skill.name,
67
+ description: skill.description
68
+ },
69
+ body: ""
70
+ } : parseSkillMd2(content);
71
+ const name = typeof parsed.meta.name === "string" && parsed.meta.name.trim() ? parsed.meta.name.trim() : skill.name;
72
+ const description = typeof parsed.meta.description === "string" ? parsed.meta.description.trim() : skill.description ?? "";
73
+ const metadata = asRecord(parsed.meta.metadata);
74
+ return {
75
+ name,
76
+ description,
77
+ skillPath: `${skill.name}/SKILL.md`,
78
+ ...metadata ? { metadata } : {}
79
+ };
80
+ }
81
+ async function buildSkillCatalog2(skills, options = {}) {
82
+ const entries = await Promise.all(skills.filter((skill) => skill.name !== SKILL_CATALOG_SKILL_NAME2).map(readSkillMetadata));
83
+ entries.sort((a, b) => a.name.localeCompare(b.name));
84
+ return {
85
+ schemaVersion: SKILL_CATALOG_SCHEMA_VERSION,
86
+ generatedBy: SKILL_CATALOG_GENERATED_BY,
87
+ source: options.source ?? { repository: REPO_URL2 },
88
+ ...options.agent ? { agent: options.agent } : {},
89
+ ...options.scope ? { scope: options.scope } : {},
90
+ ...options.generatedAt ? { generatedAt: options.generatedAt } : {},
91
+ skills: entries
92
+ };
93
+ }
94
+ function renderSkillCatalogReadme(catalog, { skillPathPrefix = "" } = {}) {
95
+ const searchCommand = renderSkillsSearchCommand(catalog);
96
+ const lines = [
97
+ SKILL_CATALOG_MARKER,
98
+ "",
99
+ "# UiPath Skill Catalog",
100
+ "",
101
+ "Generated overview for the installed UiPath skills. Read this file first when a user asks for UiPath help and no single skill is already obvious.",
102
+ "",
103
+ "## How to Use",
104
+ "",
105
+ `1. Search the catalog with \`${searchCommand}\`, or inspect \`skills.catalog.json\` directly.`,
106
+ "2. Pick the skill whose description best matches the user's goal and boundaries.",
107
+ "3. Open only that skill's `SKILL.md`, then follow its links into `references/` only as needed.",
108
+ "4. If several skills match, prefer the most specific skill first and add platform/deploy skills only when the task needs them.",
109
+ "",
110
+ "## Installed Skills",
111
+ "",
112
+ "| Skill | When to use | Entry point |",
113
+ "|---|---|---|"
114
+ ];
115
+ for (const skill of catalog.skills) {
116
+ lines.push(`| \`${markdownEscape(skill.name)}\` | ${markdownEscape(skill.description || "(no description)")} | [SKILL.md](${markdownEscape(`${skillPathPrefix}${skill.skillPath}`)}) |`);
117
+ }
118
+ lines.push("", "For the complete machine-readable catalog, read `skills.catalog.json`.", "");
119
+ return lines.join(`
120
+ `);
121
+ }
122
+ function renderSkillCatalogIndex(catalog, { skillPathPrefix = "" } = {}) {
123
+ const lines = [
124
+ SKILL_CATALOG_MARKER,
125
+ "",
126
+ "# UiPath Skills Index",
127
+ "",
128
+ `Schema version: ${catalog.schemaVersion}`,
129
+ `Source: ${catalog.source.repository}${catalog.source.ref ? ` @ ${catalog.source.ref}` : ""}`,
130
+ ...catalog.agent ? [`Agent: ${catalog.agent}`] : [],
131
+ ...catalog.scope ? [`Scope: ${catalog.scope}`] : [],
132
+ ""
133
+ ];
134
+ for (const skill of catalog.skills) {
135
+ lines.push(`## ${skill.name}`, "", skill.description || "(no description)", "", `Entry point: [${skill.skillPath}](${skillPathPrefix}${skill.skillPath})`, "");
136
+ }
137
+ return lines.join(`
138
+ `);
139
+ }
140
+ function renderSkillCatalogSkillMd(catalog) {
141
+ const searchCommand = renderSkillsSearchCommand(catalog);
142
+ const lines = [
143
+ "---",
144
+ `name: ${SKILL_CATALOG_SKILL_NAME2}`,
145
+ 'description: "Use first for UiPath requests when selecting among installed UiPath skills. Provides progressive discovery via a compact catalog so agents can pick one skill before opening full SKILL.md bodies."',
146
+ "---",
147
+ "",
148
+ SKILL_CATALOG_MARKER,
149
+ "",
150
+ "# UiPath Skill Catalog",
151
+ "",
152
+ "Use this skill first when the user asks for UiPath help and no single specialist skill is already obvious.",
153
+ "",
154
+ "## Routing Workflow",
155
+ "",
156
+ `1. Read \`references/skills.catalog.json\` or run \`${searchCommand}\`.`,
157
+ "2. Pick the skill whose description best matches the user's goal and boundaries.",
158
+ "3. Open only that skill's `SKILL.md`, then follow that skill's references only as needed.",
159
+ "4. If several skills match, prefer the most specific skill first and add platform/deploy skills only when the task needs them.",
160
+ "",
161
+ "## Installed Skills",
162
+ "",
163
+ "| Skill | When to use | Entry point |",
164
+ "|---|---|---|"
165
+ ];
166
+ for (const skill of catalog.skills) {
167
+ lines.push(`| \`${markdownEscape(skill.name)}\` | ${markdownEscape(skill.description || "(no description)")} | [SKILL.md](../${markdownEscape(skill.skillPath)}) |`);
168
+ }
169
+ lines.push("", "The complete machine-readable catalog is `references/skills.catalog.json`.", "");
170
+ return lines.join(`
171
+ `);
172
+ }
173
+ function ownsGeneratedText(content) {
174
+ return content?.startsWith(SKILL_CATALOG_MARKER) ?? false;
175
+ }
176
+ function ownsGeneratedSkill(content) {
177
+ return content?.includes(SKILL_CATALOG_MARKER) ?? false;
178
+ }
179
+ function ownsGeneratedJson(content) {
180
+ if (!content)
181
+ return false;
182
+ const [parseError, parsed] = catchError(() => JSON.parse(content));
183
+ return !parseError && parsed?.generatedBy === SKILL_CATALOG_GENERATED_BY;
184
+ }
185
+ async function writeGeneratedText(filePath, content) {
186
+ const fs = getFileSystem2();
187
+ const existing = await fs.readFile(filePath, { encoding: "utf-8" });
188
+ if (existing !== null && !ownsGeneratedText(existing))
189
+ return;
190
+ await fs.writeFile(filePath, content);
191
+ }
192
+ async function writeGeneratedJson(filePath, catalog) {
193
+ const fs = getFileSystem2();
194
+ const existing = await fs.readFile(filePath, { encoding: "utf-8" });
195
+ if (existing !== null && !ownsGeneratedJson(existing))
196
+ return;
197
+ await fs.writeFile(filePath, `${JSON.stringify(catalog, null, 2)}
198
+ `);
199
+ }
200
+ async function removeGeneratedText(filePath) {
201
+ const fs = getFileSystem2();
202
+ const existing = await fs.readFile(filePath, { encoding: "utf-8" });
203
+ if (existing === null || ownsGeneratedText(existing))
204
+ await fs.rm(filePath);
205
+ }
206
+ async function removeGeneratedJson(filePath) {
207
+ const fs = getFileSystem2();
208
+ const existing = await fs.readFile(filePath, { encoding: "utf-8" });
209
+ if (existing === null || ownsGeneratedJson(existing))
210
+ await fs.rm(filePath);
211
+ }
212
+ function getSkillCatalogSkillDir(skillsRoot) {
213
+ const fs = getFileSystem2();
214
+ return fs.path.join(skillsRoot, SKILL_CATALOG_SKILL_NAME2);
215
+ }
216
+ async function writeSkillCatalog2(skillsRoot, skills, options = {}) {
217
+ const fs = getFileSystem2();
218
+ const catalog = await buildSkillCatalog2(skills, options);
219
+ await writeGeneratedJson(fs.path.join(skillsRoot, SKILL_CATALOG_JSON), catalog);
220
+ await writeGeneratedText(fs.path.join(skillsRoot, SKILL_CATALOG_README), renderSkillCatalogReadme(catalog));
221
+ await writeGeneratedText(fs.path.join(skillsRoot, SKILL_CATALOG_INDEX), renderSkillCatalogIndex(catalog));
222
+ const catalogSkillDir = getSkillCatalogSkillDir(skillsRoot);
223
+ const existingCatalogSkillMd = await fs.readFile(fs.path.join(catalogSkillDir, "SKILL.md"), { encoding: "utf-8" });
224
+ if (existingCatalogSkillMd !== null && !ownsGeneratedSkill(existingCatalogSkillMd)) {
225
+ throw new Error(`${SKILL_CATALOG_SKILL_NAME2}/SKILL.md already exists and was not generated by uip skills`);
226
+ }
227
+ await fs.rm(catalogSkillDir);
228
+ await fs.writeFile(fs.path.join(catalogSkillDir, "SKILL.md"), renderSkillCatalogSkillMd(catalog));
229
+ await fs.writeFile(fs.path.join(catalogSkillDir, "references", SKILL_CATALOG_JSON), `${JSON.stringify(catalog, null, 2)}
230
+ `);
231
+ await fs.writeFile(fs.path.join(catalogSkillDir, "references", SKILL_CATALOG_README), renderSkillCatalogReadme(catalog, { skillPathPrefix: "../../" }));
232
+ await fs.writeFile(fs.path.join(catalogSkillDir, "references", SKILL_CATALOG_INDEX), renderSkillCatalogIndex(catalog, { skillPathPrefix: "../../" }));
233
+ return catalog;
234
+ }
235
+ async function removeSkillCatalog2(skillsRoot) {
236
+ const fs = getFileSystem2();
237
+ await removeGeneratedText(fs.path.join(skillsRoot, SKILL_CATALOG_README));
238
+ await removeGeneratedText(fs.path.join(skillsRoot, SKILL_CATALOG_INDEX));
239
+ await removeGeneratedJson(fs.path.join(skillsRoot, SKILL_CATALOG_JSON));
240
+ const catalogSkillDir = getSkillCatalogSkillDir(skillsRoot);
241
+ const skillMd = await fs.readFile(fs.path.join(catalogSkillDir, "SKILL.md"), { encoding: "utf-8" });
242
+ if (skillMd === null || ownsGeneratedSkill(skillMd)) {
243
+ await fs.rm(catalogSkillDir);
244
+ }
245
+ }
246
+ function searchSkillCatalog2(catalog, query) {
247
+ const tokens = searchTokens(query);
248
+ if (tokens.length === 0)
249
+ return catalog.skills;
250
+ const ranked = [];
251
+ for (const skill of catalog.skills) {
252
+ const name = normalizeSearchText(skill.name);
253
+ const description = normalizeSearchText(skill.description);
254
+ let score = 0;
255
+ if (name.includes(normalizeSearchText(query)))
256
+ score += 20;
257
+ if (description.includes(normalizeSearchText(query)))
258
+ score += 10;
259
+ for (const token of tokens) {
260
+ if (hasToken(name, token))
261
+ score += 6;
262
+ if (hasToken(description, token))
263
+ score += 3;
264
+ }
265
+ if (score > 0)
266
+ ranked.push({ skill, score });
267
+ }
268
+ ranked.sort((a, b) => b.score - a.score || a.skill.name.localeCompare(b.skill.name));
269
+ return ranked.map((entry) => entry.skill);
270
+ }
271
+
272
+ export { SKILL_CATALOG_SKILL_NAME2, buildSkillCatalog2, writeSkillCatalog2, removeSkillCatalog2, searchSkillCatalog2 };
273
+
274
+ //# debugId=B9335E32C99170BD64756E2164756E21