viza 1.8.27 → 1.8.29

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,18 +105,27 @@ 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
- const positionalArgs = args.slice(0, -1);
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
120
129
  await node.run(...positionalArgs, opts);
121
130
  });
122
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viza",
3
- "version": "1.8.27",
3
+ "version": "1.8.29",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {