@robinmordasiewicz/f5xc-xcsh 2.0.21-2601130605 → 2.0.21-2601131436

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 +41 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49215,8 +49215,8 @@ function getLogoModeFromEnv(envPrefix) {
49215
49215
  var CLI_NAME = "xcsh";
49216
49216
  var CLI_FULL_NAME = "F5 Distributed Cloud Shell";
49217
49217
  function getVersion() {
49218
- if ("v2.0.21-2601130605") {
49219
- return "v2.0.21-2601130605";
49218
+ if ("v2.0.21-2601131436") {
49219
+ return "v2.0.21-2601131436";
49220
49220
  }
49221
49221
  if (process.env.XCSH_VERSION) {
49222
49222
  return process.env.XCSH_VERSION;
@@ -83975,7 +83975,7 @@ var Completer = class {
83975
83975
  resourceCtx.domain
83976
83976
  );
83977
83977
  if (resourceTypes.length > 0) {
83978
- if (parsed.currentWord && !parsed.currentWord.startsWith("-")) {
83978
+ if (parsed.currentWord && !parsed.currentWord.startsWith("-") && parsed.currentWord.toLowerCase() !== resourceCtx.action) {
83979
83979
  const filtered = this.filterSuggestions(
83980
83980
  resourceTypes,
83981
83981
  parsed.currentWord
@@ -83983,7 +83983,7 @@ var Completer = class {
83983
83983
  if (filtered.length > 0) {
83984
83984
  return filtered;
83985
83985
  }
83986
- } else if (!parsed.currentWord) {
83986
+ } else if (!parsed.currentWord || parsed.currentWord.toLowerCase() === resourceCtx.action) {
83987
83987
  return [
83988
83988
  ...resourceTypes,
83989
83989
  ...this.getActionFlagSuggestions(resourceCtx.action)
@@ -83996,10 +83996,21 @@ var Completer = class {
83996
83996
  const firstArg2 = parsed.args[0];
83997
83997
  if (parsed.args.length > 0 && firstArg2 && !isStillTypingDomain) {
83998
83998
  const targetDomain = firstArg2.toLowerCase();
83999
- if (completionRegistry.has(targetDomain)) {
84000
- const domainNode = completionRegistry.get(targetDomain);
84001
- if (domainNode?.source === "api") {
84002
- suggestions = this.getActionSuggestions();
83999
+ const domainNode = completionRegistry.get(targetDomain);
84000
+ const apiDomainInfo = getDomainInfo(targetDomain);
84001
+ if (domainNode || apiDomainInfo) {
84002
+ const isApiDomain = domainNode?.source === "api" || apiDomainInfo !== null;
84003
+ if (isApiDomain) {
84004
+ const hasAction = parsed.args.length > 1 && RESOURCE_ACTIONS.has(
84005
+ parsed.args[1]?.toLowerCase() ?? ""
84006
+ );
84007
+ if (!hasAction) {
84008
+ suggestions = this.getActionSuggestions();
84009
+ } else {
84010
+ suggestions = this.getActionFlagSuggestions(
84011
+ parsed.args[1]?.toLowerCase()
84012
+ );
84013
+ }
84003
84014
  } else {
84004
84015
  suggestions = completionRegistry.getChildSuggestions(
84005
84016
  targetDomain,
@@ -84325,11 +84336,22 @@ var Completer = class {
84325
84336
  return ctx;
84326
84337
  }
84327
84338
  const navCtx = this.session.getContextPath();
84328
- ctx.domain = navCtx.domain || null;
84329
- if (parsed.args.length > 0) {
84339
+ let argOffset = 0;
84340
+ if (navCtx.domain) {
84341
+ ctx.domain = navCtx.domain;
84342
+ argOffset = 0;
84343
+ } else if (parsed.args.length > 0) {
84330
84344
  const firstArg = parsed.args[0]?.toLowerCase() ?? "";
84331
- if (RESOURCE_ACTIONS.has(firstArg)) {
84332
- ctx.action = firstArg;
84345
+ const domainInfo = getDomainInfo(firstArg);
84346
+ if (domainInfo) {
84347
+ ctx.domain = firstArg;
84348
+ argOffset = 1;
84349
+ }
84350
+ }
84351
+ if (parsed.args.length > argOffset) {
84352
+ const actionArg = parsed.args[argOffset]?.toLowerCase() ?? "";
84353
+ if (RESOURCE_ACTIONS.has(actionArg)) {
84354
+ ctx.action = actionArg;
84333
84355
  }
84334
84356
  }
84335
84357
  if (ctx.domain && ctx.action && RESOURCE_ACTIONS.has(ctx.action)) {
@@ -84337,7 +84359,7 @@ var Completer = class {
84337
84359
  const resourceNames = new Set(
84338
84360
  domainInfo?.primaryResources?.map((r) => r.name) ?? []
84339
84361
  );
84340
- for (let i = 1; i < parsed.args.length; i++) {
84362
+ for (let i = argOffset + 1; i < parsed.args.length; i++) {
84341
84363
  const arg = parsed.args[i]?.toLowerCase() ?? "";
84342
84364
  if (resourceNames.has(arg)) {
84343
84365
  const isLastArg = i === parsed.args.length - 1;
@@ -84503,6 +84525,7 @@ var Completer = class {
84503
84525
  if (resourceType && namespace) {
84504
84526
  return this.completeResourceName(
84505
84527
  resourceType,
84528
+ // Will be pluralized for API path (e.g., 'http_loadbalancer' → 'http_loadbalancers')
84506
84529
  resourceType,
84507
84530
  valuePartial,
84508
84531
  namespace
@@ -84561,11 +84584,12 @@ var Completer = class {
84561
84584
  }));
84562
84585
  }
84563
84586
  /**
84564
- * Convert domain name to API resource path
84587
+ * Convert resource type to API resource path
84588
+ * F5 XC API paths keep underscores and use plural form
84589
+ * Example: http_loadbalancer → http_loadbalancers
84565
84590
  */
84566
- domainToResourcePath(domain) {
84567
- const resourceName = domain.replace(/_/g, "-");
84568
- return resourceName.endsWith("s") ? resourceName : `${resourceName}s`;
84591
+ domainToResourcePath(resourceType) {
84592
+ return resourceType.endsWith("s") ? resourceType : `${resourceType}s`;
84569
84593
  }
84570
84594
  /**
84571
84595
  * Complete resource names with caching
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinmordasiewicz/f5xc-xcsh",
3
- "version": "2.0.21-2601130605",
3
+ "version": "2.0.21-2601131436",
4
4
  "description": "F5 Distributed Cloud Shell - Interactive CLI for F5 XC",
5
5
  "type": "module",
6
6
  "bin": {