@robinmordasiewicz/f5xc-xcsh 2.0.11-2601051653 → 2.0.13-2601051943

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 +49 -17
  2. package/package.json +4 -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.11-2601051653") {
46998
- return "v2.0.11-2601051653";
46997
+ if ("v2.0.13-2601051943") {
46998
+ return "v2.0.13-2601051943";
46999
46999
  }
47000
47000
  if (process.env.XCSH_VERSION) {
47001
47001
  return process.env.XCSH_VERSION;
@@ -151712,7 +151712,8 @@ var Completer = class {
151712
151712
  if (parsed.isCompletingFlagValue && parsed.currentFlag) {
151713
151713
  return await this.getFlagValueCompletions(
151714
151714
  parsed.currentFlag,
151715
- parsed.currentWord
151715
+ parsed.currentWord,
151716
+ parsed
151716
151717
  );
151717
151718
  }
151718
151719
  if (parsed.isCompletingFlag) {
@@ -152211,10 +152212,24 @@ var Completer = class {
152211
152212
  const allFlags = this.getActionFlagSuggestions(action);
152212
152213
  return this.filterSuggestions(allFlags, prefix);
152213
152214
  }
152215
+ /**
152216
+ * Extract a flag value from args array
152217
+ * @param args - Array of command arguments
152218
+ * @param flagNames - Flag names to look for (e.g., ["--namespace", "-ns"])
152219
+ * @returns The flag value or undefined if not found
152220
+ */
152221
+ extractFlagValue(args, flagNames) {
152222
+ for (let i = 0; i < args.length - 1; i++) {
152223
+ if (flagNames.includes(args[i] ?? "")) {
152224
+ return args[i + 1];
152225
+ }
152226
+ }
152227
+ return void 0;
152228
+ }
152214
152229
  /**
152215
152230
  * Get flag value completions based on the flag being completed
152216
152231
  */
152217
- async getFlagValueCompletions(flag, partial) {
152232
+ async getFlagValueCompletions(flag, partial, parsed) {
152218
152233
  let valuePartial = partial;
152219
152234
  if (partial.includes("=")) {
152220
152235
  valuePartial = partial.slice(partial.indexOf("=") + 1);
@@ -152234,18 +152249,28 @@ var Completer = class {
152234
152249
  case "-ns":
152235
152250
  return this.completeNamespace(valuePartial);
152236
152251
  case "--name":
152237
- case "-n":
152238
- if (this.session) {
152239
- const ctx = this.session.getContextPath();
152240
- if (ctx.domain) {
152241
- return this.completeResourceName(
152242
- ctx.domain,
152243
- ctx.domain,
152244
- valuePartial
152245
- );
152246
- }
152252
+ case "-n": {
152253
+ if (!this.session) {
152254
+ return [];
152255
+ }
152256
+ const resourceCtx = this.parseResourceContext(parsed);
152257
+ const navCtx = this.session.getContextPath();
152258
+ const resourceType = resourceCtx.resourceType || navCtx.domain || null;
152259
+ const nsFromFlag = this.extractFlagValue(parsed.args, [
152260
+ "--namespace",
152261
+ "-ns"
152262
+ ]);
152263
+ const namespace = nsFromFlag || this.session.getNamespace();
152264
+ if (resourceType && namespace) {
152265
+ return this.completeResourceName(
152266
+ resourceType,
152267
+ resourceType,
152268
+ valuePartial,
152269
+ namespace
152270
+ );
152247
152271
  }
152248
152272
  return [];
152273
+ }
152249
152274
  case "--limit":
152250
152275
  return [
152251
152276
  {
@@ -152306,8 +152331,8 @@ var Completer = class {
152306
152331
  /**
152307
152332
  * Complete resource names with caching
152308
152333
  */
152309
- async completeResourceName(domain, _resourceType, partial) {
152310
- const namespace = this.session?.getNamespace() ?? "default";
152334
+ async completeResourceName(domain, _resourceType, partial, namespaceOverride) {
152335
+ const namespace = namespaceOverride || this.session?.getNamespace() || "default";
152311
152336
  const cacheKey = `${domain}:${namespace}`;
152312
152337
  const names = await this.cache.getResourceNames(cacheKey, async () => {
152313
152338
  const client = this.session?.getAPIClient();
@@ -152503,6 +152528,8 @@ var BUILTIN_COMMANDS = /* @__PURE__ */ new Set([
152503
152528
  "ctx",
152504
152529
  "history",
152505
152530
  "version",
152531
+ "--version",
152532
+ "-v",
152506
152533
  "domains",
152507
152534
  "whoami",
152508
152535
  "refresh"
@@ -152543,7 +152570,12 @@ function parseCommand(input) {
152543
152570
  const firstWord = trimmed.split(/\s+/)[0]?.toLowerCase() ?? "";
152544
152571
  const normalizedFirst = firstWord.startsWith("/") ? firstWord.slice(1) : firstWord;
152545
152572
  if (BUILTIN_COMMANDS.has(firstWord) || BUILTIN_COMMANDS.has(normalizedFirst)) {
152546
- const effectiveCommand = normalizedFirst === "--help" || normalizedFirst === "-h" ? "help" : normalizedFirst;
152573
+ let effectiveCommand = normalizedFirst;
152574
+ if (normalizedFirst === "--help" || normalizedFirst === "-h") {
152575
+ effectiveCommand = "help";
152576
+ } else if (normalizedFirst === "--version" || normalizedFirst === "-v") {
152577
+ effectiveCommand = "version";
152578
+ }
152547
152579
  return {
152548
152580
  raw: effectiveCommand,
152549
152581
  isDirectNavigation: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinmordasiewicz/f5xc-xcsh",
3
- "version": "2.0.11-2601051653",
3
+ "version": "2.0.13-2601051943",
4
4
  "description": "F5 Distributed Cloud Shell - Interactive CLI for F5 XC",
5
5
  "type": "module",
6
6
  "bin": {
@@ -91,5 +91,8 @@
91
91
  },
92
92
  "engines": {
93
93
  "node": ">=18.0.0"
94
+ },
95
+ "overrides": {
96
+ "esbuild": ">=0.25.0"
94
97
  }
95
98
  }