@robinmordasiewicz/f5xc-xcsh 2.0.41-2601192002 → 2.0.41-2601192054

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 +50 -104
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -41229,8 +41229,8 @@ var init_logo_renderer = __esm({
41229
41229
 
41230
41230
  // src/branding/index.ts
41231
41231
  function getVersion() {
41232
- if ("v2.0.41-2601192002") {
41233
- return "v2.0.41-2601192002";
41232
+ if ("v2.0.41-2601192054") {
41233
+ return "v2.0.41-2601192054";
41234
41234
  }
41235
41235
  if (process.env.XCSH_VERSION) {
41236
41236
  return process.env.XCSH_VERSION;
@@ -150546,91 +150546,6 @@ var init_service = __esm({
150546
150546
  });
150547
150547
 
150548
150548
  // src/domains/login/whoami/formatter.ts
150549
- function formatWhoami(info, options = {}) {
150550
- if (!info.isAuthenticated) {
150551
- return ["Enter '/login' to authenticate"];
150552
- }
150553
- if (options.json) {
150554
- return formatWhoamiJson(info);
150555
- }
150556
- return formatWhoamiBox(info);
150557
- }
150558
- function formatWhoamiJson(info) {
150559
- const output = {};
150560
- if (info.tenant) output.tenant = info.tenant;
150561
- if (info.username) output.username = info.username;
150562
- if (info.email) output.email = info.email;
150563
- output.namespace = info.namespace;
150564
- output.serverUrl = info.serverUrl;
150565
- output.isAuthenticated = info.isAuthenticated;
150566
- return [JSON.stringify(output, null, 2)];
150567
- }
150568
- function getAuthStatusDisplay(info) {
150569
- if (!info.isAuthenticated) {
150570
- return "Not authenticated";
150571
- }
150572
- if (info.isValidated) {
150573
- return "\u2713 Authenticated";
150574
- }
150575
- if (info.validationError) {
150576
- return `\u2717 ${info.validationError}`;
150577
- }
150578
- return "\u26A0 Token not verified";
150579
- }
150580
- function formatWhoamiBox(info) {
150581
- const lines = [];
150582
- const red = colors.red;
150583
- const reset = colors.reset;
150584
- const BOX = {
150585
- topLeft: "\u256D",
150586
- topRight: "\u256E",
150587
- bottomLeft: "\u2570",
150588
- bottomRight: "\u256F",
150589
- horizontal: "\u2500",
150590
- vertical: "\u2502"
150591
- };
150592
- const contentLines = [];
150593
- if (info.tenant) {
150594
- contentLines.push({ label: "Tenant", value: info.tenant });
150595
- }
150596
- if (info.email) {
150597
- contentLines.push({ label: "User", value: info.email });
150598
- } else if (info.username) {
150599
- contentLines.push({ label: "User", value: info.username });
150600
- }
150601
- contentLines.push({ label: "Namespace", value: info.namespace });
150602
- contentLines.push({ label: "Server", value: info.serverUrl });
150603
- contentLines.push({
150604
- label: "Auth",
150605
- value: getAuthStatusDisplay(info)
150606
- });
150607
- const maxLabelWidth = Math.max(...contentLines.map((c) => c.label.length));
150608
- const formattedContent = contentLines.map((c) => {
150609
- const paddedLabel = c.label.padEnd(maxLabelWidth);
150610
- return `${paddedLabel}: ${c.value}`;
150611
- });
150612
- const headerTitle = "Connection Info";
150613
- const allTextLines = [...formattedContent, headerTitle];
150614
- const maxContentWidth = Math.max(...allTextLines.map((l) => l.length));
150615
- const innerWidth = maxContentWidth + 2;
150616
- const title = " Connection Info ";
150617
- const remainingWidth = innerWidth - title.length;
150618
- const leftDashes = 1;
150619
- const rightDashes = Math.max(0, remainingWidth - leftDashes);
150620
- lines.push(
150621
- `${red}${BOX.topLeft}${BOX.horizontal.repeat(leftDashes)}${reset}${title}${red}${BOX.horizontal.repeat(rightDashes)}${BOX.topRight}${reset}`
150622
- );
150623
- for (const text of formattedContent) {
150624
- const padding = innerWidth - text.length;
150625
- lines.push(
150626
- `${red}${BOX.vertical}${reset} ${text}${" ".repeat(Math.max(0, padding - 1))}${red}${BOX.vertical}${reset}`
150627
- );
150628
- }
150629
- lines.push(
150630
- `${red}${BOX.bottomLeft}${BOX.horizontal.repeat(innerWidth)}${BOX.bottomRight}${reset}`
150631
- );
150632
- return lines;
150633
- }
150634
150549
  var init_formatter2 = __esm({
150635
150550
  "src/domains/login/whoami/formatter.ts"() {
150636
150551
  "use strict";
@@ -150658,7 +150573,7 @@ var init_whoami = __esm({
150658
150573
  "use strict";
150659
150574
  init_registry();
150660
150575
  init_service();
150661
- init_formatter2();
150576
+ init_connection_table();
150662
150577
  init_domain_formatter();
150663
150578
  init_service();
150664
150579
  init_formatter2();
@@ -150682,11 +150597,22 @@ var init_whoami = __esm({
150682
150597
  return successResult(
150683
150598
  formatKeyValueOutput(keyValueData, {
150684
150599
  ...options,
150685
- title: "Connection Info"
150600
+ title: "Connection Summary"
150686
150601
  })
150687
150602
  );
150688
150603
  }
150689
- const output = formatWhoami(info);
150604
+ const connectionInfo = buildConnectionInfo(
150605
+ session.getActiveProfileName() || "(environment)",
150606
+ session.getServerUrl(),
150607
+ session.isAuthenticated(),
150608
+ session.getNamespace(),
150609
+ !session.isOfflineMode(),
150610
+ session.isTokenValidated(),
150611
+ session.getValidationError() || void 0,
150612
+ session.getAuthSource() || void 0,
150613
+ session.getEnvVarsPresent()
150614
+ );
150615
+ const output = formatConnectionTable(connectionInfo);
150690
150616
  return successResult(output);
150691
150617
  } catch (error) {
150692
150618
  return errorResult(
@@ -174386,7 +174312,7 @@ function useGitStatus(options = {}) {
174386
174312
  init_domains();
174387
174313
  init_domains2();
174388
174314
  init_extensions();
174389
- init_whoami();
174315
+ init_connection_table();
174390
174316
  init_output();
174391
174317
 
174392
174318
  // src/dependencies/relationships.ts
@@ -176249,9 +176175,8 @@ function executeBuiltin(cmd, session, ctx) {
176249
176175
  };
176250
176176
  }
176251
176177
  if (command === "whoami" || command.startsWith("whoami ")) {
176252
- const parts = parseInputArgs(command).slice(1);
176253
176178
  const options = {};
176254
- for (const arg of parts) {
176179
+ for (const arg of cmd.args) {
176255
176180
  const lowerArg = arg.toLowerCase();
176256
176181
  switch (lowerArg) {
176257
176182
  case "--quota":
@@ -176274,20 +176199,41 @@ function executeBuiltin(cmd, session, ctx) {
176274
176199
  break;
176275
176200
  }
176276
176201
  }
176277
- return getWhoamiInfo(session, options).then((info) => ({
176278
- output: formatWhoami(info, options),
176202
+ const connectionInfo = buildConnectionInfo(
176203
+ session.getActiveProfileName() || "(environment)",
176204
+ session.getServerUrl(),
176205
+ session.isAuthenticated(),
176206
+ session.getNamespace(),
176207
+ !session.isOfflineMode(),
176208
+ session.isTokenValidated(),
176209
+ session.getValidationError() || void 0,
176210
+ session.getAuthSource() || void 0,
176211
+ session.getEnvVarsPresent()
176212
+ );
176213
+ if (options.json) {
176214
+ const jsonOutput = {
176215
+ profileName: connectionInfo.profileName,
176216
+ tenant: connectionInfo.tenant,
176217
+ apiUrl: connectionInfo.apiUrl,
176218
+ namespace: connectionInfo.namespace,
176219
+ isAuthenticated: connectionInfo.hasToken,
176220
+ isConnected: connectionInfo.isConnected,
176221
+ isValidated: connectionInfo.isValidated,
176222
+ authSource: connectionInfo.authSource
176223
+ };
176224
+ return {
176225
+ output: [JSON.stringify(jsonOutput, null, 2)],
176226
+ shouldExit: false,
176227
+ shouldClear: false,
176228
+ contextChanged: false
176229
+ };
176230
+ }
176231
+ return {
176232
+ output: formatConnectionTable(connectionInfo),
176279
176233
  shouldExit: false,
176280
176234
  shouldClear: false,
176281
176235
  contextChanged: false
176282
- })).catch((error) => ({
176283
- output: [
176284
- `Failed to get whoami info: ${error instanceof Error ? error.message : "Unknown error"}`
176285
- ],
176286
- shouldExit: false,
176287
- shouldClear: false,
176288
- contextChanged: false,
176289
- error: "whoami failed"
176290
- }));
176236
+ };
176291
176237
  }
176292
176238
  if (command === "debug-completion" || command.startsWith("debug-completion ")) {
176293
176239
  const parts = parseInputArgs(command).slice(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinmordasiewicz/f5xc-xcsh",
3
- "version": "2.0.41-2601192002",
3
+ "version": "2.0.41-2601192054",
4
4
  "description": "F5 Distributed Cloud Shell - Interactive CLI for F5 XC",
5
5
  "type": "module",
6
6
  "bin": {