viza 1.9.21 → 1.9.23

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/dist/bin/viza.js CHANGED
@@ -6,9 +6,11 @@ import { setEnv } from "../src/context/env.js";
6
6
  import { setHubIntent } from "../src/context/hubIntent.js";
7
7
  import { setCommand } from "../src/context/command.js";
8
8
  import path from "path";
9
+ import { normalizeBinName } from "../src/context/normalizeBin.js";
9
10
  (async () => {
10
11
  const { env, runner } = resolveBinaryContext();
11
- const binName = path.basename(process.argv[1] || "viza");
12
+ const rawBin = path.basename(process.argv[1] || "viza");
13
+ const binName = normalizeBinName(rawBin);
12
14
  const args = process.argv.slice(2).join(" ");
13
15
  const fullCommand = args ? `${binName} ${args}` : binName;
14
16
  setCommand(fullCommand);
@@ -9,55 +9,83 @@ export async function showRuntimeUsage(result) {
9
9
  return;
10
10
  }
11
11
  const { log, result: data } = env.data;
12
- // -------------------------------
13
- // 1. Render execution log
14
- // -------------------------------
15
- if (Array.isArray(log) && log.length > 0) {
16
- console.log("\n🧩 Execution Steps");
17
- console.log("─".repeat(80));
18
- for (const step of log) {
19
- const statusIcon = step.status === "ok" ? "āœ…" : "āŒ";
20
- const duration = step.durationMs ? `${step.durationMs}ms` : "-";
21
- console.log(`${statusIcon} [${step.step}] ${step.title} ${chalk.gray(`(${duration})`)}`);
22
- if (step.message) {
23
- console.log(chalk.gray(` ↳ ${step.message}`));
24
- }
25
- }
26
- console.log("─".repeat(80));
27
- }
28
- // -------------------------------
29
- // 2. Render usage by month
30
- // -------------------------------
12
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
13
+ // 1. Render usage by month (horizontal)
14
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
31
15
  if (data?.usage) {
32
16
  console.log("\nšŸ“Š Usage by Month");
17
+ console.log("─".repeat(120));
18
+ const usage = [...data.usage].sort((a, b) => a.month.localeCompare(b.month));
19
+ const latest = usage[usage.length - 1];
20
+ // Header row (months)
21
+ const header = usage.map((m) => pad(m.month, 24)).join("");
22
+ console.log(chalk.gray(header));
23
+ // Values row
24
+ const values = usage.map((m) => {
25
+ const val = `${m.totalMinutes} min`;
26
+ if (m.month === latest?.month) {
27
+ return chalk.bold.green(pad(val, 24));
28
+ }
29
+ return pad(val, 24);
30
+ }).join("");
31
+ console.log(values);
32
+ console.log("─".repeat(120));
33
+ }
34
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
35
+ // 1.1 Usage by OS (separate view)
36
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
37
+ if (data?.usage && data.usage.some((m) => Array.isArray(m.byOS))) {
38
+ console.log("\nšŸ–„ļø Usage by OS");
33
39
  console.log("─".repeat(60));
34
- for (const m of data.usage) {
35
- console.log(`${pad(m.month, 10)} ${pad(String(m.totalMinutes) + " min", 15)}`);
36
- if (Array.isArray(m.byOS)) {
37
- for (const os of m.byOS) {
38
- console.log(chalk.gray(` ↳ ${os.os}: ${os.minutes} min`));
40
+ const usage = [...data.usage].sort((a, b) => a.month.localeCompare(b.month));
41
+ const latest = usage[usage.length - 1];
42
+ for (const osName of ["linux", "windows", "macos"]) {
43
+ const months = usage.map((m) => {
44
+ const os = m.byOS?.find((o) => o.os === osName);
45
+ if (!os)
46
+ return null;
47
+ const text = `${m.month}: ${os.minutes} min`;
48
+ if (m.month === latest?.month) {
49
+ return chalk.bold.green(text);
39
50
  }
51
+ return chalk.gray(text);
52
+ }).filter(Boolean);
53
+ if (months.length === 0)
54
+ continue;
55
+ console.log(`${chalk.bold(osName)}`);
56
+ for (const m of months) {
57
+ console.log(` ↳ ${m}`);
40
58
  }
59
+ console.log();
41
60
  }
42
61
  console.log("─".repeat(60));
43
62
  }
44
- // -------------------------------
45
- // 3. Render usage by org + month
46
- // -------------------------------
63
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
64
+ // 2. Render usage by org + month (horizontal)
65
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
47
66
  if (data?.byOrg) {
48
67
  console.log("\nšŸ¢ Usage by Organization");
49
- console.log("─".repeat(60));
68
+ console.log("─".repeat(120));
50
69
  for (const org of data.byOrg) {
51
70
  console.log(`\n${chalk.bold(org.org)}`);
52
- for (const m of org.months || []) {
53
- console.log(` ${pad(m.month, 10)} ${pad(String(m.totalMinutes) + " min", 15)}`);
54
- }
71
+ const months = [...(org.months || [])].sort((a, b) => a.month.localeCompare(b.month));
72
+ const latest = months[months.length - 1];
73
+ const header = months.map((m) => pad(m.month, 24)).join("");
74
+ console.log(chalk.gray(header));
75
+ const values = months.map((m) => {
76
+ const val = `${m.totalMinutes} min`;
77
+ if (m.month === latest?.month) {
78
+ return chalk.bold.green(pad(val, 24));
79
+ }
80
+ return pad(val, 24);
81
+ }).join("");
82
+ console.log(values);
55
83
  }
56
- console.log("─".repeat(60));
84
+ console.log("─".repeat(120));
57
85
  }
58
- // -------------------------------
86
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
59
87
  // 4. Raw hint (optional)
60
- // -------------------------------
88
+ // ────────────────────────────────────────────────────────────────────────────────────────────────
61
89
  if (data?.raw?.usageItems) {
62
90
  console.log();
63
91
  console.log(chalk.gray("šŸ’” Raw usage items available (use debug mode if needed)"));
@@ -0,0 +1,9 @@
1
+ export function normalizeBinName(raw) {
2
+ const aliasMap = {
3
+ v2: "v-builder",
4
+ v3: "v-deployer",
5
+ x2: "x-builder",
6
+ x3: "x-deployer",
7
+ };
8
+ return aliasMap[raw] ?? raw;
9
+ }
@@ -1,6 +1,8 @@
1
1
  import path from "node:path";
2
+ import { normalizeBinName } from "./normalizeBin.js";
2
3
  export function resolveBinaryContext() {
3
- const bin = path.basename(process.argv[1] ?? "");
4
+ const rawBin = path.basename(process.argv[1] ?? "");
5
+ const bin = normalizeBinName(rawBin);
4
6
  const env = bin.startsWith("x") ? "prod" : "dev";
5
7
  let runner = "hub";
6
8
  if (bin.includes("builder"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viza",
3
- "version": "1.9.21",
3
+ "version": "1.9.23",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {
@@ -15,7 +15,11 @@
15
15
  "v-deployer": "dist/bin/viza.js",
16
16
  "x": "dist/bin/viza.js",
17
17
  "x-builder": "dist/bin/viza.js",
18
- "x-deployer": "dist/bin/viza.js"
18
+ "x-deployer": "dist/bin/viza.js",
19
+ "v2": "dist/bin/viza.js",
20
+ "v3": "dist/bin/viza.js",
21
+ "x2": "dist/bin/viza.js",
22
+ "x3": "dist/bin/viza.js"
19
23
  },
20
24
  "files": [
21
25
  "dist"