@robinmordasiewicz/f5xc-xcsh 2.0.46-2601220614 → 2.0.46-2601220805

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 +82 -65
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -41209,8 +41209,8 @@ var init_logo_renderer = __esm({
41209
41209
 
41210
41210
  // src/branding/index.ts
41211
41211
  function getVersion() {
41212
- if ("v2.0.46-2601220614") {
41213
- return "v2.0.46-2601220614";
41212
+ if ("v2.0.46-2601220805") {
41213
+ return "v2.0.46-2601220805";
41214
41214
  }
41215
41215
  if (process.env.XCSH_VERSION) {
41216
41216
  return process.env.XCSH_VERSION;
@@ -49209,7 +49209,7 @@ function calculateColumnWidths(columns, rows, maxTableWidth) {
49209
49209
  if (totalWidth > maxTableWidth) {
49210
49210
  const ratio = (maxTableWidth - columns.length * 3 - 1) / totalWidth;
49211
49211
  for (let i = 0; i < widths.length; i++) {
49212
- widths[i] = Math.max(5, Math.floor(widths[i] * ratio));
49212
+ widths[i] = Math.max(5, Math.floor((widths[i] ?? 0) * ratio));
49213
49213
  }
49214
49214
  }
49215
49215
  }
@@ -49255,7 +49255,7 @@ function formatBeautifulTable(data, config, noColor = false) {
49255
49255
  );
49256
49256
  }
49257
49257
  const headerCells = config.columns.map((col, i) => {
49258
- const padding = widths[i] - col.header.length;
49258
+ const padding = (widths[i] ?? 0) - col.header.length;
49259
49259
  const leftPad = Math.floor(padding / 2);
49260
49260
  const rightPad = padding - leftPad;
49261
49261
  const content = " ".repeat(leftPad) + col.header + " ".repeat(rightPad);
@@ -49268,16 +49268,16 @@ function formatBeautifulTable(data, config, noColor = false) {
49268
49268
  buildHorizontalLine(box.leftT, box.cross, box.rightT, box.horizontal)
49269
49269
  );
49270
49270
  for (let rowIndex = 0; rowIndex < data.length; rowIndex++) {
49271
- const row = data[rowIndex];
49271
+ const row = data[rowIndex] ?? {};
49272
49272
  const cellValues = config.columns.map((col, i) => {
49273
49273
  const value = getValue(row, col.accessor) || "<None>";
49274
- return config.wrapText !== false ? wrapText2(value, widths[i]) : [value.slice(0, widths[i])];
49274
+ return config.wrapText !== false ? wrapText2(value, widths[i] ?? 0) : [value.slice(0, widths[i] ?? 0)];
49275
49275
  });
49276
49276
  const maxLines = Math.max(...cellValues.map((c) => c.length));
49277
49277
  for (let lineIndex = 0; lineIndex < maxLines; lineIndex++) {
49278
49278
  const cells = cellValues.map((cellLines, i) => {
49279
49279
  const text = cellLines[lineIndex] ?? "";
49280
- const padding = widths[i] - text.length;
49280
+ const padding = (widths[i] ?? 0) - text.length;
49281
49281
  const align = config.columns[i]?.align ?? "left";
49282
49282
  let content;
49283
49283
  if (align === "center") {
@@ -1138755,7 +1138755,9 @@ function extractFieldSpecs(schemaName, openApiSpec) {
1138755
1138755
  return [];
1138756
1138756
  }
1138757
1138757
  const fields = [];
1138758
- const required = new Set(schema.required || []);
1138758
+ const required = new Set(
1138759
+ Array.isArray(schema.required) ? schema.required : []
1138760
+ );
1138759
1138761
  for (const [fieldName, property] of Object.entries(
1138760
1138762
  schema.properties
1138761
1138763
  )) {
@@ -1138789,7 +1138791,7 @@ function extractOneOfGroups(schemaName, openApiSpec) {
1138789
1138791
  groups.push({
1138790
1138792
  groupName,
1138791
1138793
  variants,
1138792
- recommendedVariant,
1138794
+ ...recommendedVariant && { recommendedVariant },
1138793
1138795
  description: `Choose exactly one of: ${variants.join(", ")}`
1138794
1138796
  });
1138795
1138797
  }
@@ -1138800,19 +1138802,24 @@ function extractConstraints(property) {
1138800
1138802
  const constraints = {
1138801
1138803
  type: property.type || "unknown"
1138802
1138804
  };
1138803
- if (property.minLength !== void 0)
1138805
+ if (property.minLength !== void 0 && property.minLength !== null)
1138804
1138806
  constraints.minLength = property.minLength;
1138805
- if (property.maxLength !== void 0)
1138807
+ if (property.maxLength !== void 0 && property.maxLength !== null)
1138806
1138808
  constraints.maxLength = property.maxLength;
1138807
- if (property.pattern !== void 0) constraints.pattern = property.pattern;
1138808
- if (property.format !== void 0) constraints.format = property.format;
1138809
- if (property.minimum !== void 0) constraints.minimum = property.minimum;
1138810
- if (property.maximum !== void 0) constraints.maximum = property.maximum;
1138811
- if (property.maxItems !== void 0)
1138809
+ if (property.pattern !== void 0 && property.pattern !== null)
1138810
+ constraints.pattern = property.pattern;
1138811
+ if (property.format !== void 0 && property.format !== null)
1138812
+ constraints.format = property.format;
1138813
+ if (property.minimum !== void 0 && property.minimum !== null)
1138814
+ constraints.minimum = property.minimum;
1138815
+ if (property.maximum !== void 0 && property.maximum !== null)
1138816
+ constraints.maximum = property.maximum;
1138817
+ if (property.maxItems !== void 0 && property.maxItems !== null)
1138812
1138818
  constraints.maxItems = property.maxItems;
1138813
- if (property.uniqueItems !== void 0)
1138819
+ if (property.uniqueItems !== void 0 && property.uniqueItems !== null)
1138814
1138820
  constraints.uniqueItems = property.uniqueItems;
1138815
- if (property.enum !== void 0) constraints.enum = property.enum;
1138821
+ if (property.enum !== void 0 && property.enum !== null)
1138822
+ constraints.enum = property.enum;
1138816
1138823
  return constraints;
1138817
1138824
  }
1138818
1138825
  function extractF5XCExtensions(property) {
@@ -1138833,7 +1138840,10 @@ function extractF5XCExtensions(property) {
1138833
1138840
  extensions.descriptionMedium = property["x-f5xc-description-medium"];
1138834
1138841
  }
1138835
1138842
  if (property["x-f5xc-required-for"] !== void 0) {
1138836
- extensions.requiredFor = property["x-f5xc-required-for"];
1138843
+ const requiredFor = property["x-f5xc-required-for"];
1138844
+ if (requiredFor) {
1138845
+ extensions.requiredFor = requiredFor;
1138846
+ }
1138837
1138847
  }
1138838
1138848
  if (property["x-f5xc-example"] !== void 0 || property["x-ves-example"] !== void 0) {
1138839
1138849
  extensions.example = property["x-f5xc-example"] || property["x-ves-example"];
@@ -1139329,7 +1139339,7 @@ var init_ai_guide_builder = __esm({
1139329
1139339
  // src/output/resource-spec-builder.ts
1139330
1139340
  function buildResourceSpec(resourceType) {
1139331
1139341
  if (specCache.has(resourceType)) {
1139332
- return specCache.get(resourceType);
1139342
+ return specCache.get(resourceType) ?? null;
1139333
1139343
  }
1139334
1139344
  if (!cachedOpenApiSpec) {
1139335
1139345
  cachedOpenApiSpec = loadOpenApiSpec();
@@ -1142871,24 +1142881,28 @@ function renderResponse(response) {
1142871
1142881
  const responseType = getResponseType(response);
1142872
1142882
  switch (responseType) {
1142873
1142883
  case "generic_response":
1142874
- lines.push(...renderGenericResponse(response.generic_response));
1142884
+ lines.push(
1142885
+ ...renderGenericResponse(response.generic_response ?? {})
1142886
+ );
1142875
1142887
  break;
1142876
1142888
  case "explain_log":
1142877
- lines.push(...renderExplainLog(response.explain_log));
1142889
+ lines.push(...renderExplainLog(response.explain_log ?? {}));
1142878
1142890
  break;
1142879
1142891
  case "gen_dashboard_filter":
1142880
1142892
  lines.push(
1142881
- ...renderDashboardFilter(response.gen_dashboard_filter)
1142893
+ ...renderDashboardFilter(response.gen_dashboard_filter ?? {})
1142882
1142894
  );
1142883
1142895
  break;
1142884
1142896
  case "list_response":
1142885
- lines.push(...renderListResponse(response.list_response));
1142897
+ lines.push(...renderListResponse(response.list_response ?? {}));
1142886
1142898
  break;
1142887
1142899
  case "site_analysis_response":
1142888
- lines.push(...renderSiteAnalysis(response.site_analysis_response));
1142900
+ lines.push(
1142901
+ ...renderSiteAnalysis(response.site_analysis_response ?? {})
1142902
+ );
1142889
1142903
  break;
1142890
1142904
  case "widget_response":
1142891
- lines.push(...renderWidgetResponse(response.widget_response));
1142905
+ lines.push(...renderWidgetResponse(response.widget_response ?? {}));
1142892
1142906
  break;
1142893
1142907
  default:
1142894
1142908
  lines.push("No response content.");
@@ -1144253,8 +1144267,7 @@ var init_create = __esm({
1144253
1144267
  generateUsageError(
1144254
1144268
  "login create profile",
1144255
1144269
  // FIXED: Correct registry path (verb-first)
1144256
- createCommand2.usage,
1144257
- // Single source of truth
1144270
+ createCommand2.usage ?? "",
1144258
1144271
  {
1144259
1144272
  options: [
1144260
1144273
  {
@@ -1146634,7 +1146647,9 @@ function generateZshCompletion() {
1146634
1146647
  const escaped = escapeForZsh(d.description);
1146635
1146648
  return `'${d.name}:${escaped}'`;
1146636
1146649
  }).join("\n ");
1146637
- const aliasDescriptions = domains.filter((d) => d.aliases && d.aliases.length > 0).flatMap((d) => d.aliases.map((a) => `'${a}:Alias for ${d.name}'`)).join("\n ");
1146650
+ const aliasDescriptions = domains.filter((d) => d.aliases && d.aliases.length > 0).flatMap(
1146651
+ (d) => d.aliases?.map((a) => `'${a}:Alias for ${d.name}'`) ?? []
1146652
+ ).join("\n ");
1146638
1146653
  const actionDescriptions2 = getActionDescriptions();
1146639
1146654
  const actionDescArray = Object.entries(actionDescriptions2).map(([action, desc]) => {
1146640
1146655
  const escaped = escapeForZsh(desc);
@@ -1146747,9 +1146762,9 @@ function generateFishCompletion() {
1146747
1146762
  return `complete -c xcsh -n "__fish_use_subcommand" -a "${d.name}" -d '${escaped}'`;
1146748
1146763
  }).join("\n");
1146749
1146764
  const aliasCompletions = domains.filter((d) => d.aliases && d.aliases.length > 0).flatMap(
1146750
- (d) => d.aliases.map(
1146765
+ (d) => d.aliases?.map(
1146751
1146766
  (a) => `complete -c xcsh -n "__fish_use_subcommand" -a "${a}" -d 'Alias for ${d.name}'`
1146752
- )
1146767
+ ) ?? []
1146753
1146768
  ).join("\n");
1146754
1146769
  const customDomainCompletions = [];
1146755
1146770
  for (const domain of domains) {
@@ -1152755,7 +1152770,7 @@ function groupFlagsForHelp(resourceType, typeFilter) {
1152755
1152770
  flags: []
1152756
1152771
  });
1152757
1152772
  }
1152758
- groups.get(groupId).flags.push(flag);
1152773
+ groups.get(groupId)?.flags.push(flag);
1152759
1152774
  }
1152760
1152775
  return Array.from(groups.values()).sort((a, b) => a.priority - b.priority).map((group) => ({
1152761
1152776
  ...group,
@@ -1163015,7 +1163030,7 @@ async function detectDependencies(resourceType, resourceName, namespace, client)
1163015
1163030
  searchTimeMs
1163016
1163031
  };
1163017
1163032
  } catch (error) {
1163018
- console.debug(`Dependency detection error: ${error}`);
1163033
+ console.warn(`Dependency detection error: ${error}`);
1163019
1163034
  const searchTimeMs = Date.now() - startTime;
1163020
1163035
  return {
1163021
1163036
  found: false,
@@ -1166074,6 +1166089,7 @@ function App2({ initialSession } = {}) {
1166074
1166089
  setInput(newValue);
1166075
1166090
  setInputKey((k) => k + 1);
1166076
1166091
  },
1166092
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1166077
1166093
  []
1166078
1166094
  // No dependencies needed since we use inputRef
1166079
1166095
  );
@@ -1166158,7 +1166174,8 @@ function App2({ initialSession } = {}) {
1166158
1166174
  exit,
1166159
1166175
  refreshHistory,
1166160
1166176
  gitStatus,
1166161
- healthCheck
1166177
+ healthCheck,
1166178
+ outputItems
1166162
1166179
  ]
1166163
1166180
  );
1166164
1166181
  const handleInputChange = (0, import_react35.useCallback)(
@@ -1166187,7 +1166204,7 @@ function App2({ initialSession } = {}) {
1166187
1166204
  }
1166188
1166205
  }
1166189
1166206
  },
1166190
- [input, completion]
1166207
+ [input, completion, setInput]
1166191
1166208
  );
1166192
1166209
  const handleSubmit = (0, import_react35.useCallback)(
1166193
1166210
  async (value) => {
@@ -1166198,7 +1166215,7 @@ function App2({ initialSession } = {}) {
1166198
1166215
  history.reset();
1166199
1166216
  await runCommand(value);
1166200
1166217
  },
1166201
- [completion, applyCompletion, runCommand, history]
1166218
+ [completion, runCommand, history, setInput]
1166202
1166219
  );
1166203
1166220
  use_input_default((char, key) => {
1166204
1166221
  if (key.ctrl && char === "c") {
@@ -1166570,7 +1166587,7 @@ var HeadlessController = class {
1166570
1166587
  * Write output to stdout
1166571
1166588
  */
1166572
1166589
  write(output) {
1166573
- console.log(formatOutput2(output));
1166590
+ console.warn(formatOutput2(output));
1166574
1166591
  }
1166575
1166592
  /**
1166576
1166593
  * Emit an event
@@ -1166759,11 +1166776,11 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
1166759
1166776
  ).option("-o, --output <format>", `Output format (${OUTPUT_FORMAT_HELP})`).option("--spec", "Output command specification as JSON (for AI)").option("--headless", "Run in headless JSON protocol mode (for AI agents)").option("-h, --help", "Show help").argument("[command...]", "Command to execute non-interactively").allowUnknownOption(true).helpOption(false).action(
1166760
1166777
  async (commandArgs, options) => {
1166761
1166778
  if (options.help && commandArgs.length === 0) {
1166762
- formatRootHelp().forEach((line) => console.log(line));
1166779
+ formatRootHelp().forEach((line) => console.warn(line));
1166763
1166780
  process.exit(0);
1166764
1166781
  }
1166765
1166782
  if (options.spec && commandArgs.length === 0) {
1166766
- console.log(formatFullCLISpec());
1166783
+ console.warn(formatFullCLISpec());
1166767
1166784
  process.exit(0);
1166768
1166785
  }
1166769
1166786
  if (options.help && commandArgs.length > 0) {
@@ -1166817,7 +1166834,7 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
1166817
1166834
  const activeProfile = session.getActiveProfile();
1166818
1166835
  const envConfigured = process.env[`${ENV_PREFIX}_API_URL`] && process.env[`${ENV_PREFIX}_API_TOKEN`];
1166819
1166836
  if (activeProfile) {
1166820
- console.log("");
1166837
+ console.warn("");
1166821
1166838
  const connectionInfo = buildConnectionInfo(
1166822
1166839
  session.getActiveProfileName() || activeProfile.name || "default",
1166823
1166840
  activeProfile.apiUrl || session.getServerUrl() || "",
@@ -1166830,24 +1166847,24 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
1166830
1166847
  session.getEnvVarsPresent()
1166831
1166848
  );
1166832
1166849
  const tableLines = formatConnectionTable(connectionInfo);
1166833
- tableLines.forEach((line) => console.log(line));
1166850
+ tableLines.forEach((line) => console.warn(line));
1166834
1166851
  if (session.isOfflineMode()) {
1166835
- console.log("");
1166836
- console.log(
1166852
+ console.warn("");
1166853
+ console.warn(
1166837
1166854
  `${colors.yellow}\u26A0\uFE0F Offline Mode: API endpoint unreachable${colors.reset}`
1166838
1166855
  );
1166839
- console.log(
1166856
+ console.warn(
1166840
1166857
  `${colors.dim} Commands requiring API access will fail.${colors.reset}`
1166841
1166858
  );
1166842
1166859
  }
1166843
1166860
  if (session.getAuthSource() === "profile-fallback") {
1166844
- console.log("");
1166845
- console.log(
1166861
+ console.warn("");
1166862
+ console.warn(
1166846
1166863
  `${colors.blue}Info: Using credentials from profile '${session.getActiveProfileName()}' (environment variables were invalid)${colors.reset}`
1166847
1166864
  );
1166848
1166865
  }
1166849
1166866
  } else if (envConfigured) {
1166850
- console.log("");
1166867
+ console.warn("");
1166851
1166868
  const connectionInfo = buildConnectionInfo(
1166852
1166869
  "(environment)",
1166853
1166870
  process.env[`${ENV_PREFIX}_API_URL`] || "",
@@ -1166862,42 +1166879,42 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
1166862
1166879
  // envVarsPresent - by definition, this flow means env vars exist
1166863
1166880
  );
1166864
1166881
  const tableLines = formatConnectionTable(connectionInfo);
1166865
- tableLines.forEach((line) => console.log(line));
1166882
+ tableLines.forEach((line) => console.warn(line));
1166866
1166883
  if (session.isOfflineMode()) {
1166867
- console.log("");
1166868
- console.log(
1166884
+ console.warn("");
1166885
+ console.warn(
1166869
1166886
  `${colors.yellow}\u26A0\uFE0F Offline Mode: API endpoint unreachable${colors.reset}`
1166870
1166887
  );
1166871
1166888
  }
1166872
1166889
  if (!session.isTokenValidated() && session.getValidationError()) {
1166873
- console.log("");
1166874
- console.log(
1166890
+ console.warn("");
1166891
+ console.warn(
1166875
1166892
  `${colors.yellow}Warning: ${session.getValidationError()}${colors.reset}`
1166876
1166893
  );
1166877
1166894
  }
1166878
1166895
  } else {
1166879
- console.log("");
1166880
- console.log(
1166896
+ console.warn("");
1166897
+ console.warn(
1166881
1166898
  `${colors.yellow}No connection profiles found.${colors.reset}`
1166882
1166899
  );
1166883
- console.log("");
1166884
- console.log(
1166900
+ console.warn("");
1166901
+ console.warn(
1166885
1166902
  "Create a profile to connect to F5 Distributed Cloud:"
1166886
1166903
  );
1166887
- console.log("");
1166888
- console.log(
1166904
+ console.warn("");
1166905
+ console.warn(
1166889
1166906
  ` ${colors.blue}login profile create${colors.reset} <name> --url <api-url> --token <api-token>`
1166890
1166907
  );
1166891
- console.log("");
1166892
- console.log("Or set environment variables:");
1166893
- console.log("");
1166894
- console.log(
1166908
+ console.warn("");
1166909
+ console.warn("Or set environment variables:");
1166910
+ console.warn("");
1166911
+ console.warn(
1166895
1166912
  ` ${colors.blue}export ${ENV_PREFIX}_API_URL${colors.reset}=https://tenant.console.ves.volterra.io`
1166896
1166913
  );
1166897
- console.log(
1166914
+ console.warn(
1166898
1166915
  ` ${colors.blue}export ${ENV_PREFIX}_API_TOKEN${colors.reset}=<your-api-token>`
1166899
1166916
  );
1166900
- console.log("");
1166917
+ console.warn("");
1166901
1166918
  }
1166902
1166919
  process.stdin.resume();
1166903
1166920
  const appProps = { initialSession: session };
@@ -1166959,7 +1166976,7 @@ async function executeNonInteractive(args) {
1166959
1166976
  const command = args.join(" ");
1166960
1166977
  const result = await executeCommand(command, session);
1166961
1166978
  result.output.forEach((line) => {
1166962
- console.log(line);
1166979
+ console.warn(line);
1166963
1166980
  });
1166964
1166981
  if (result.error) {
1166965
1166982
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinmordasiewicz/f5xc-xcsh",
3
- "version": "2.0.46-2601220614",
3
+ "version": "2.0.46-2601220805",
4
4
  "description": "F5 Distributed Cloud Shell - Interactive CLI for F5 XC",
5
5
  "type": "module",
6
6
  "bin": {