@robinmordasiewicz/f5xc-xcsh 2.0.21-2601090658 → 2.0.21-2601091525

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +26 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -46994,8 +46994,8 @@ function getLogoModeFromEnv(envPrefix) {
46994
46994
  var CLI_NAME = "xcsh";
46995
46995
  var CLI_FULL_NAME = "F5 Distributed Cloud Shell";
46996
46996
  function getVersion() {
46997
- if ("v2.0.21-2601090658") {
46998
- return "v2.0.21-2601090658";
46997
+ if ("v2.0.21-2601091525") {
46998
+ return "v2.0.21-2601091525";
46999
46999
  }
47000
47000
  if (process.env.XCSH_VERSION) {
47001
47001
  return process.env.XCSH_VERSION;
@@ -77199,6 +77199,7 @@ var CompletionRegistry = class {
77199
77199
  getDomainSuggestions(prefix = "") {
77200
77200
  const suggestions = [];
77201
77201
  const lowerPrefix = prefix.toLowerCase();
77202
+ const addedAliases = /* @__PURE__ */ new Set();
77202
77203
  for (const node of this.tree.values()) {
77203
77204
  if (node.hidden) continue;
77204
77205
  if (!prefix || node.name.toLowerCase().startsWith(lowerPrefix)) {
@@ -77216,10 +77217,21 @@ var CompletionRegistry = class {
77216
77217
  description: `Alias for ${node.name}`,
77217
77218
  category: "domain"
77218
77219
  });
77220
+ addedAliases.add(alias);
77219
77221
  }
77220
77222
  }
77221
77223
  }
77222
77224
  }
77225
+ for (const [alias, canonicalName] of this.aliases.entries()) {
77226
+ if (addedAliases.has(alias)) continue;
77227
+ if (!prefix || alias.toLowerCase().startsWith(lowerPrefix)) {
77228
+ suggestions.push({
77229
+ text: alias,
77230
+ description: `Alias for ${canonicalName}`,
77231
+ category: "domain"
77232
+ });
77233
+ }
77234
+ }
77223
77235
  return suggestions.sort((a, b) => a.text.localeCompare(b.text));
77224
77236
  }
77225
77237
  /**
@@ -77873,14 +77885,19 @@ function renderResponse(response) {
77873
77885
  }
77874
77886
  return lines;
77875
77887
  }
77888
+ function stripHtml(html) {
77889
+ return html.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ").replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n\n").replace(/<\/li>/gi, "\n").replace(/<\/h[1-6]>/gi, "\n\n").replace(/<hr\s*\/?>/gi, "\n---\n").replace(/<a[^>]*href="([^"]*)"[^>]*>([^<]*)<\/a>/gi, "$2 ($1)").replace(/<code>([^<]*)<\/code>/gi, "`$1`").replace(/<li[^>]*>/gi, " \u2022 ").replace(/<h3[^>]*>/gi, "\n### ").replace(/<h[1-6][^>]*>/gi, "\n").replace(/<ol[^>]*>/gi, "").replace(/<\/ol>/gi, "").replace(/<ul[^>]*>/gi, "").replace(/<\/ul>/gi, "").replace(/<strong>([^<]*)<\/strong>/gi, "**$1**").replace(/<b>([^<]*)<\/b>/gi, "**$1**").replace(/<em>([^<]*)<\/em>/gi, "*$1*").replace(/<i>([^<]*)<\/i>/gi, "*$1*").replace(/<[^>]+>/g, "").replace(/\n{3,}/g, "\n\n").trim();
77890
+ }
77876
77891
  function renderGenericResponse(response) {
77877
77892
  const lines = [];
77878
- if (response.error) {
77879
- lines.push(`Error: ${response.error}`);
77893
+ if (response.is_error || response.error && response.error !== null) {
77894
+ lines.push(`Error: ${response.error ?? "Unknown error"}`);
77880
77895
  return lines;
77881
77896
  }
77882
- if (response.text) {
77883
- lines.push(...response.text.split("\n"));
77897
+ const content = response.summary ?? response.text;
77898
+ if (content) {
77899
+ const plainText = stripHtml(content);
77900
+ lines.push(...plainText.split("\n"));
77884
77901
  }
77885
77902
  if (response.links && response.links.length > 0) {
77886
77903
  lines.push("");
@@ -81086,7 +81103,8 @@ var Completer = class {
81086
81103
  return this.getRootContextSuggestions();
81087
81104
  }
81088
81105
  const firstArg = parsed.args[0]?.toLowerCase() ?? "";
81089
- if (isCustomDomain(firstArg) && parsed.args.length >= 1) {
81106
+ const isStillTypingDomain = parsed.args.length === 1 && parsed.currentWord === firstArg;
81107
+ if (isCustomDomain(firstArg) && parsed.args.length >= 1 && !isStillTypingDomain) {
81090
81108
  return await this.getCustomDomainCompletions(
81091
81109
  firstArg,
81092
81110
  parsed.args.slice(1),
@@ -81143,7 +81161,7 @@ var Completer = class {
81143
81161
  let suggestions;
81144
81162
  if (parsed.isEscapedToRoot) {
81145
81163
  const firstArg2 = parsed.args[0];
81146
- if (parsed.args.length > 0 && firstArg2) {
81164
+ if (parsed.args.length > 0 && firstArg2 && !isStillTypingDomain) {
81147
81165
  const targetDomain = firstArg2.toLowerCase();
81148
81166
  if (completionRegistry.has(targetDomain)) {
81149
81167
  const domainNode = completionRegistry.get(targetDomain);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinmordasiewicz/f5xc-xcsh",
3
- "version": "2.0.21-2601090658",
3
+ "version": "2.0.21-2601091525",
4
4
  "description": "F5 Distributed Cloud Shell - Interactive CLI for F5 XC",
5
5
  "type": "module",
6
6
  "bin": {