@lambdacurry/arbor 0.12.5 → 0.12.6
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/arbor.js +15 -7
- package/package.json +1 -1
package/dist/arbor.js
CHANGED
|
@@ -17926,13 +17926,21 @@ function zodType(node) {
|
|
|
17926
17926
|
const ctor = node.constructor?.name ?? "";
|
|
17927
17927
|
return ctor.replace(/^Zod/, "").toLowerCase();
|
|
17928
17928
|
}
|
|
17929
|
-
function
|
|
17930
|
-
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
|
|
17929
|
+
function unwrapForCli(node) {
|
|
17930
|
+
let inner = node;
|
|
17931
|
+
let optional2 = false;
|
|
17932
|
+
for (;; ) {
|
|
17933
|
+
const type = zodType(inner);
|
|
17934
|
+
if (type !== "optional" && type !== "nullable")
|
|
17935
|
+
break;
|
|
17936
|
+
if (type === "optional")
|
|
17937
|
+
optional2 = true;
|
|
17938
|
+
const unwrapped = inner.unwrap?.();
|
|
17939
|
+
if (!unwrapped)
|
|
17940
|
+
break;
|
|
17941
|
+
inner = unwrapped;
|
|
17934
17942
|
}
|
|
17935
|
-
return { inner
|
|
17943
|
+
return { inner, optional: optional2 };
|
|
17936
17944
|
}
|
|
17937
17945
|
function description(node) {
|
|
17938
17946
|
return node.description;
|
|
@@ -17973,7 +17981,7 @@ function primaryPositionalField(inputSchema) {
|
|
|
17973
17981
|
}
|
|
17974
17982
|
function flagsForSchema(inputSchema) {
|
|
17975
17983
|
return Object.entries(inputSchema).map(([field, raw]) => {
|
|
17976
|
-
const { inner, optional: optional2 } =
|
|
17984
|
+
const { inner, optional: optional2 } = unwrapForCli(raw);
|
|
17977
17985
|
return {
|
|
17978
17986
|
field,
|
|
17979
17987
|
flag: kebab(field),
|
package/package.json
CHANGED