viza 1.9.22 → 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
|
|
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);
|
|
@@ -10,34 +10,78 @@ export async function showRuntimeUsage(result) {
|
|
|
10
10
|
}
|
|
11
11
|
const { log, result: data } = env.data;
|
|
12
12
|
// ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
13
|
-
// 1. Render usage by month
|
|
13
|
+
// 1. Render usage by month (horizontal)
|
|
14
14
|
// ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
15
15
|
if (data?.usage) {
|
|
16
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");
|
|
17
39
|
console.log("─".repeat(60));
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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);
|
|
23
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}`);
|
|
24
58
|
}
|
|
59
|
+
console.log();
|
|
25
60
|
}
|
|
26
61
|
console.log("─".repeat(60));
|
|
27
62
|
}
|
|
28
63
|
// ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
29
|
-
// 2. Render usage by org + month
|
|
64
|
+
// 2. Render usage by org + month (horizontal)
|
|
30
65
|
// ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
31
66
|
if (data?.byOrg) {
|
|
32
67
|
console.log("\n🏢 Usage by Organization");
|
|
33
|
-
console.log("─".repeat(
|
|
68
|
+
console.log("─".repeat(120));
|
|
34
69
|
for (const org of data.byOrg) {
|
|
35
70
|
console.log(`\n${chalk.bold(org.org)}`);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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);
|
|
39
83
|
}
|
|
40
|
-
console.log("─".repeat(
|
|
84
|
+
console.log("─".repeat(120));
|
|
41
85
|
}
|
|
42
86
|
// ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
43
87
|
// 4. Raw hint (optional)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { normalizeBinName } from "./normalizeBin.js";
|
|
2
3
|
export function resolveBinaryContext() {
|
|
3
|
-
const
|
|
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.
|
|
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"
|