viza 1.8.28 → 1.8.30

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.
@@ -105,19 +105,28 @@ export async function createProgram() {
105
105
  sub.action(async (...args) => {
106
106
  const cmd = args[args.length - 1];
107
107
  function collectOptions(c) {
108
- const merged = {};
108
+ const chain = [];
109
109
  let cur = c;
110
+ // collect from leaf → root
110
111
  while (cur) {
111
112
  if (typeof cur.opts === "function") {
112
- Object.assign(merged, cur.opts());
113
+ const o = cur.opts();
114
+ chain.push(o);
113
115
  }
114
116
  cur = cur.parent;
115
117
  }
118
+ // merge from root → leaf (leaf overrides parent)
119
+ const merged = {};
120
+ for (let i = chain.length - 1; i >= 0; i--) {
121
+ Object.assign(merged, chain[i]);
122
+ }
116
123
  return merged;
117
124
  }
118
125
  const opts = collectOptions(cmd);
119
- // NOTE: Use stable options-only execution (KISS)
120
- await node.run(opts);
126
+ // Extract positional args reliably from Commander (avoid stray objects)
127
+ const positionalArgs = Array.isArray(cmd.args) ? cmd.args : [];
128
+ // Pass args + options in correct order
129
+ await node.run(...positionalArgs, opts);
121
130
  });
122
131
  }
123
132
  if (node.children?.length) {
@@ -52,13 +52,14 @@ export function renderLog(zipBuffer, options) {
52
52
  // ignore parsing errors
53
53
  }
54
54
  // Print final status banner
55
- const status = options.status ?? "unknown";
55
+ // Chuyển về lowercase ngay từ đầu, mặc định là "unknown" nếu undefined
56
+ const status = (options.status?.toString() || "unknown").toLowerCase();
56
57
  let color = chalk.gray;
57
58
  if (status === "success")
58
59
  color = chalk.greenBright;
59
- else if (status === "failure")
60
+ else if (status === "failure" || status === "failed")
60
61
  color = chalk.redBright;
61
- else if (status === "cancelled")
62
+ else if (status === "cancelled" || status === "unknown")
62
63
  color = chalk.yellowBright;
63
64
  console.log(color(`\n────── DEPLOY STATUS: ${String(status).toUpperCase()} ─────────────────────────────────────────────────────────────────────────────────────────────\n`));
64
65
  // Warn if the run was dispatched by someone else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viza",
3
- "version": "1.8.28",
3
+ "version": "1.8.30",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {