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
|
|
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
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
//
|
|
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(
|
|
68
|
+
console.log("ā".repeat(120));
|
|
50
69
|
for (const org of data.byOrg) {
|
|
51
70
|
console.log(`\n${chalk.bold(org.org)}`);
|
|
52
|
-
|
|
53
|
-
|
|
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(
|
|
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)"));
|
|
@@ -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"
|