@quantum-hub/qhubctl 2.2.5-next.1 → 3.0.0-next.1

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.
package/README.md CHANGED
@@ -6,7 +6,7 @@ Detailed information about the supported commands can be found in our [CLI refer
6
6
 
7
7
  ## Installation
8
8
 
9
- Node.js 20 or higher is required.
9
+ Node.js 22 or higher is required.
10
10
  Install it via a [Node version manager](https://github.com/nvm-sh/nvm) or a [Node installer](https://nodejs.org/en/download).
11
11
 
12
12
  ```bash
@@ -1,2 +1,9 @@
1
1
  import { Command } from "commander";
2
+ interface Context {
3
+ displayName: string;
4
+ id: string;
5
+ isOrganization: boolean;
6
+ }
7
+ export declare function renderContextsTable(contexts: Context[]): string;
2
8
  export declare const listContextsCommand: Command;
9
+ export {};
@@ -1,8 +1,14 @@
1
1
  import { Command } from "commander";
2
- import Table from "tty-table";
3
- import { spinner, stdout } from "../lib/output.js";
2
+ import { renderTable, spinner, stdout } from "../lib/output.js";
4
3
  import { requireAuth } from "../model/command.js";
5
4
  import QuantumHubService from "../service/quantum-hub-service.js";
5
+ export function renderContextsTable(contexts) {
6
+ return renderTable(["Name", "ID", "Account"], contexts.map((context) => [
7
+ context.displayName,
8
+ context.id,
9
+ context.isOrganization ? "Organization" : "Personal",
10
+ ]));
11
+ }
6
12
  const EXAMPLES = `
7
13
  Examples:
8
14
  $ qhubctl list-contexts`;
@@ -20,17 +26,6 @@ export const listContextsCommand = new Command("list-contexts")
20
26
  id: account.id ?? "",
21
27
  isOrganization: account.isOrganization ?? false,
22
28
  }));
23
- const header = [
24
- { value: "displayName", alias: "Name", align: "left" },
25
- { value: "id", alias: "ID", align: "left" },
26
- {
27
- value: "isOrganization",
28
- alias: "Account",
29
- width: 14,
30
- formatter: (value) => (value ? "Organization" : "Personal"),
31
- },
32
- ];
33
- const t = Table(header, tableData);
34
- stdout(t.render());
29
+ stdout(renderContextsTable(tableData));
35
30
  stdout();
36
31
  });
@@ -1,2 +1,8 @@
1
1
  import { Command } from "commander";
2
+ interface Service {
3
+ id?: string;
4
+ name?: string;
5
+ }
6
+ export declare function renderServicesTable(services: Service[]): string;
2
7
  export declare const servicesListCommand: Command;
8
+ export {};
@@ -1,8 +1,10 @@
1
1
  import { Command } from "commander";
2
- import Table from "tty-table";
3
- import { spinner, stdout, warn } from "../lib/output.js";
2
+ import { renderTable, spinner, stdout, warn } from "../lib/output.js";
4
3
  import { requireAuth } from "../model/command.js";
5
4
  import QuantumHubService from "../service/quantum-hub-service.js";
5
+ export function renderServicesTable(services) {
6
+ return renderTable(["ID", "Name"], services.map((service) => [service.id ?? "", service.name ?? ""]));
7
+ }
6
8
  const EXAMPLES = `
7
9
  Examples:
8
10
  $ qhubctl services list
@@ -38,14 +40,9 @@ export const servicesListCommand = new Command("list")
38
40
  stdout(JSON.stringify(opts.all ? services : tableData, null, 2));
39
41
  return;
40
42
  }
41
- const header = [
42
- { value: "id", alias: "ID", align: "left" },
43
- { value: "name", alias: "Name", align: "left" },
44
- ];
45
- const t = Table(header, tableData);
46
43
  const contextName = userConfig.context?.displayName;
47
44
  const filterInfo = opts.name ? ` (filtered by name: "${opts.name}")` : "";
48
45
  stdout(`Available services for ${contextName}${filterInfo}:`);
49
- stdout(t.render());
46
+ stdout(renderServicesTable(tableData));
50
47
  stdout();
51
48
  });
@@ -12,3 +12,5 @@ export declare function stdout(msg?: string): void;
12
12
  export declare function warn(msg: string): void;
13
13
  export declare function error(msg: string, exitCode?: number): never;
14
14
  export declare function spinner(msg: string): Ora;
15
+ /** Renders a bordered table without ANSI colors, so piped output stays plain. */
16
+ export declare function renderTable(head: string[], rows: string[][]): string;
@@ -1,3 +1,4 @@
1
+ import Table from "cli-table3";
1
2
  import ora from "ora";
2
3
  /**
3
4
  * Output helpers — replaces oclif's `ux.*` surface.
@@ -20,3 +21,9 @@ export function error(msg, exitCode = 1) {
20
21
  export function spinner(msg) {
21
22
  return ora(msg).start();
22
23
  }
24
+ /** Renders a bordered table without ANSI colors, so piped output stays plain. */
25
+ export function renderTable(head, rows) {
26
+ const table = new Table({ head, style: { head: [], border: [] } });
27
+ table.push(...rows);
28
+ return table.toString();
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantum-hub/qhubctl",
3
- "version": "2.2.5-next.1",
3
+ "version": "3.0.0-next.1",
4
4
  "description": "Kipu Quantum Hub CLI",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [
@@ -29,12 +29,12 @@
29
29
  "@quantum-hub/qhub-api": "^3.0.0",
30
30
  "adm-zip": "^0.6.0",
31
31
  "async-wait-until": "^2",
32
+ "cli-table3": "^0.6.5",
32
33
  "commander": "^14",
33
34
  "fs-extra": "^11",
34
35
  "ignore": "^7",
35
36
  "isomorphic-git": "^1",
36
37
  "ora": "^9",
37
- "tty-table": "^5",
38
38
  "update-notifier": "^7",
39
39
  "yaml": "^2"
40
40
  },
@@ -72,7 +72,7 @@
72
72
  "test:coverage": "nyc --reporter=lcov --reporter=text-lcov mocha --forbid-only \"test/**/*.test.ts\""
73
73
  },
74
74
  "engines": {
75
- "node": ">=20.0.0"
75
+ "node": ">=22.0.0"
76
76
  },
77
77
  "types": "dist/index.d.ts",
78
78
  "private": false,