@sjawhar/pi-envoy 15.0.1 → 15.0.2

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/dispatch.js CHANGED
@@ -15957,7 +15957,8 @@ function fieldKinds(spec) {
15957
15957
  nullable,
15958
15958
  required: required.has(field),
15959
15959
  ...description === undefined ? {} : { description },
15960
- ...values === undefined ? {} : { values }
15960
+ ...values === undefined ? {} : { values },
15961
+ shape: inner === undefined ? [] : shapeLines(inner, "")
15961
15962
  });
15962
15963
  }
15963
15964
  return fields;
@@ -15992,6 +15993,58 @@ function kindOf(field, node) {
15992
15993
  return "json";
15993
15994
  }
15994
15995
  }
15996
+ function withoutNull(node) {
15997
+ const members = (node.anyOf ?? [node]).filter((member) => member.type !== "null");
15998
+ return members.length === 1 ? members[0] : undefined;
15999
+ }
16000
+ function typeName(node) {
16001
+ if (node.anyOf !== undefined)
16002
+ return node.anyOf.map(typeName).join(" or ");
16003
+ if (node.enum !== undefined)
16004
+ return node.enum.map(String).join("|");
16005
+ switch (node.type) {
16006
+ case "string":
16007
+ return "text";
16008
+ case "integer":
16009
+ case "number":
16010
+ case "boolean":
16011
+ case "null":
16012
+ return node.type;
16013
+ case "object":
16014
+ return "object";
16015
+ case "array":
16016
+ return node.items === undefined ? "list" : `list of ${pluralTypeName(node.items)}`;
16017
+ default:
16018
+ return "any JSON";
16019
+ }
16020
+ }
16021
+ function pluralTypeName(node) {
16022
+ if (node.type === "object")
16023
+ return "objects";
16024
+ if (node.type === "integer")
16025
+ return "integers";
16026
+ if (node.type === "number")
16027
+ return "numbers";
16028
+ return typeName(node);
16029
+ }
16030
+ function shapeLines(node, indent) {
16031
+ const item = node.type === "array" ? node.items : undefined;
16032
+ const properties = (item ?? node).properties;
16033
+ if (properties === undefined)
16034
+ return [];
16035
+ const required = new Set((item ?? node).required ?? []);
16036
+ return [
16037
+ `${indent}${item === undefined ? "Its keys:" : "Each item's keys:"}`,
16038
+ ...Object.entries(properties).flatMap(([key, child]) => {
16039
+ const about = [required.has(key) ? "required" : undefined, typeName(child)].filter((part) => part !== undefined).join("; ");
16040
+ const inner = withoutNull(child);
16041
+ return [
16042
+ `${indent} ${key} (${about})${child.description === undefined ? "" : `: ${child.description}`}`,
16043
+ ...inner === undefined ? [] : shapeLines(inner, `${indent} `)
16044
+ ];
16045
+ })
16046
+ ];
16047
+ }
15995
16048
  function singular(field) {
15996
16049
  return field.endsWith("s") ? field.slice(0, -1) : field;
15997
16050
  }
@@ -16039,10 +16092,17 @@ function flagTable(tool, fields) {
16039
16092
  field,
16040
16093
  action: "json",
16041
16094
  value: "<json>",
16042
- text: `Every option as a JSON list of {label, description?}, in place of --${singular(name)}.`
16095
+ text: [`Every option as a JSON list, in place of --${singular(name)}.`, ...info.shape].join(`
16096
+ `)
16043
16097
  });
16044
16098
  } else if (kind === "json") {
16045
- add(`--${name}-json`, { field, action: "json", value: "<json>", text: about });
16099
+ add(`--${name}-json`, {
16100
+ field,
16101
+ action: "json",
16102
+ value: "<json>",
16103
+ text: [about, ...info.shape].filter((line) => line !== "").join(`
16104
+ `)
16105
+ });
16046
16106
  add(`--${name}-json-file`, {
16047
16107
  field,
16048
16108
  action: "json-file",
@@ -16320,7 +16380,8 @@ function commandHelp(tool) {
16320
16380
  surface.spec.description,
16321
16381
  "",
16322
16382
  "Flags:",
16323
- ...commandFlagTable(tool).flatMap((row) => row.text === "" ? [` ${row.flag}`] : [` ${row.flag}`, ` ${row.text}`]),
16383
+ ...commandFlagTable(tool).flatMap((row) => row.text === "" ? [` ${row.flag}`] : [` ${row.flag}`, ...row.text.split(`
16384
+ `).map((line) => ` ${line}`)]),
16324
16385
  "",
16325
16386
  `Example: ${commandLine(tool, surface.spec.example)}`,
16326
16387
  ""
package/dist/envoy.js CHANGED
@@ -31747,7 +31747,8 @@ function fieldKinds(spec) {
31747
31747
  nullable,
31748
31748
  required: required.has(field),
31749
31749
  ...description === undefined ? {} : { description },
31750
- ...values === undefined ? {} : { values }
31750
+ ...values === undefined ? {} : { values },
31751
+ shape: inner === undefined ? [] : shapeLines(inner, "")
31751
31752
  });
31752
31753
  }
31753
31754
  return fields;
@@ -31782,6 +31783,58 @@ function kindOf(field, node) {
31782
31783
  return "json";
31783
31784
  }
31784
31785
  }
31786
+ function withoutNull(node) {
31787
+ const members = (node.anyOf ?? [node]).filter((member) => member.type !== "null");
31788
+ return members.length === 1 ? members[0] : undefined;
31789
+ }
31790
+ function typeName(node) {
31791
+ if (node.anyOf !== undefined)
31792
+ return node.anyOf.map(typeName).join(" or ");
31793
+ if (node.enum !== undefined)
31794
+ return node.enum.map(String).join("|");
31795
+ switch (node.type) {
31796
+ case "string":
31797
+ return "text";
31798
+ case "integer":
31799
+ case "number":
31800
+ case "boolean":
31801
+ case "null":
31802
+ return node.type;
31803
+ case "object":
31804
+ return "object";
31805
+ case "array":
31806
+ return node.items === undefined ? "list" : `list of ${pluralTypeName(node.items)}`;
31807
+ default:
31808
+ return "any JSON";
31809
+ }
31810
+ }
31811
+ function pluralTypeName(node) {
31812
+ if (node.type === "object")
31813
+ return "objects";
31814
+ if (node.type === "integer")
31815
+ return "integers";
31816
+ if (node.type === "number")
31817
+ return "numbers";
31818
+ return typeName(node);
31819
+ }
31820
+ function shapeLines(node, indent) {
31821
+ const item = node.type === "array" ? node.items : undefined;
31822
+ const properties = (item ?? node).properties;
31823
+ if (properties === undefined)
31824
+ return [];
31825
+ const required = new Set((item ?? node).required ?? []);
31826
+ return [
31827
+ `${indent}${item === undefined ? "Its keys:" : "Each item's keys:"}`,
31828
+ ...Object.entries(properties).flatMap(([key, child]) => {
31829
+ const about = [required.has(key) ? "required" : undefined, typeName(child)].filter((part) => part !== undefined).join("; ");
31830
+ const inner = withoutNull(child);
31831
+ return [
31832
+ `${indent} ${key} (${about})${child.description === undefined ? "" : `: ${child.description}`}`,
31833
+ ...inner === undefined ? [] : shapeLines(inner, `${indent} `)
31834
+ ];
31835
+ })
31836
+ ];
31837
+ }
31785
31838
  function singular(field) {
31786
31839
  return field.endsWith("s") ? field.slice(0, -1) : field;
31787
31840
  }
@@ -31829,10 +31882,17 @@ function flagTable(tool, fields) {
31829
31882
  field,
31830
31883
  action: "json",
31831
31884
  value: "<json>",
31832
- text: `Every option as a JSON list of {label, description?}, in place of --${singular(name)}.`
31885
+ text: [`Every option as a JSON list, in place of --${singular(name)}.`, ...info.shape].join(`
31886
+ `)
31833
31887
  });
31834
31888
  } else if (kind === "json") {
31835
- add(`--${name}-json`, { field, action: "json", value: "<json>", text: about });
31889
+ add(`--${name}-json`, {
31890
+ field,
31891
+ action: "json",
31892
+ value: "<json>",
31893
+ text: [about, ...info.shape].filter((line) => line !== "").join(`
31894
+ `)
31895
+ });
31836
31896
  add(`--${name}-json-file`, {
31837
31897
  field,
31838
31898
  action: "json-file",
@@ -37993,7 +38053,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
37993
38053
 
37994
38054
  // package.json
37995
38055
  var name = "@sjawhar/pi-envoy";
37996
- var version2 = "15.0.1";
38056
+ var version2 = "15.0.2";
37997
38057
  var package_default = {
37998
38058
  name,
37999
38059
  version: version2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-envoy",
3
- "version": "15.0.1",
3
+ "version": "15.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {