@voxgig/sdkgen 1.3.14 → 1.3.17

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.
Files changed (398) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/action.js.map +1 -1
  3. package/dist/action/feature.js.map +1 -1
  4. package/dist/action/target.js.map +1 -1
  5. package/dist/cmp/AgentGuide.js.map +1 -1
  6. package/dist/cmp/AgentGuideContent.js.map +1 -1
  7. package/dist/cmp/AgentGuideFeature.js.map +1 -1
  8. package/dist/cmp/AgentGuideTop.js.map +1 -1
  9. package/dist/cmp/Changelog.js.map +1 -1
  10. package/dist/cmp/Deploy.js.map +1 -1
  11. package/dist/cmp/Entity.js.map +1 -1
  12. package/dist/cmp/Feature.js.map +1 -1
  13. package/dist/cmp/FeatureHook.js.map +1 -1
  14. package/dist/cmp/License.js.map +1 -1
  15. package/dist/cmp/Main.js.map +1 -1
  16. package/dist/cmp/Readme.js.map +1 -1
  17. package/dist/cmp/ReadmeEntity.js.map +1 -1
  18. package/dist/cmp/ReadmeErrors.js +1 -1
  19. package/dist/cmp/ReadmeErrors.js.map +1 -1
  20. package/dist/cmp/ReadmeExplanation.js +2 -2
  21. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  22. package/dist/cmp/ReadmeHowto.js.map +1 -1
  23. package/dist/cmp/ReadmeInstall.js.map +1 -1
  24. package/dist/cmp/ReadmeIntro.js.map +1 -1
  25. package/dist/cmp/ReadmeModel.js.map +1 -1
  26. package/dist/cmp/ReadmeOptions.js.map +1 -1
  27. package/dist/cmp/ReadmeQuick.js.map +1 -1
  28. package/dist/cmp/ReadmeRef.js.map +1 -1
  29. package/dist/cmp/ReadmeTop.js +1 -1
  30. package/dist/cmp/ReadmeTop.js.map +1 -1
  31. package/dist/cmp/Security.js.map +1 -1
  32. package/dist/cmp/Test.js.map +1 -1
  33. package/dist/helpers/buildIdNames.js.map +1 -1
  34. package/dist/helpers/canonType.d.ts +3 -2
  35. package/dist/helpers/canonType.js +107 -24
  36. package/dist/helpers/canonType.js.map +1 -1
  37. package/dist/helpers/collectDeps.js.map +1 -1
  38. package/dist/helpers/getMatchEntries.js.map +1 -1
  39. package/dist/helpers/naming.d.ts +5 -1
  40. package/dist/helpers/naming.js +37 -0
  41. package/dist/helpers/naming.js.map +1 -1
  42. package/dist/helpers/opExample.d.ts +1 -1
  43. package/dist/helpers/opExample.js +37 -20
  44. package/dist/helpers/opExample.js.map +1 -1
  45. package/dist/helpers/opShape.d.ts +3 -1
  46. package/dist/helpers/opShape.js +91 -3
  47. package/dist/helpers/opShape.js.map +1 -1
  48. package/dist/helpers/packageMeta.js.map +1 -1
  49. package/dist/sdkgen.d.ts +3 -3
  50. package/dist/sdkgen.js +7 -1
  51. package/dist/sdkgen.js.map +1 -1
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/dist/types.js.map +1 -1
  54. package/dist/utility.js.map +1 -1
  55. package/package.json +7 -6
  56. package/project/.sdk/model/target/haskell.aontu +6 -3
  57. package/project/.sdk/model/target/zig.aontu +12 -2
  58. package/project/.sdk/src/cmp/c/Config_c.ts +16 -4
  59. package/project/.sdk/src/cmp/c/EntityTypes_c.ts +168 -0
  60. package/project/.sdk/src/cmp/c/Main_c.ts +4 -0
  61. package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +192 -0
  62. package/project/.sdk/src/cmp/c/ReadmeExamplesTest_c.ts +152 -0
  63. package/project/.sdk/src/cmp/c/ReadmeExplanation_c.ts +55 -0
  64. package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +168 -0
  65. package/project/.sdk/src/cmp/c/ReadmeInstall_c.ts +52 -0
  66. package/project/.sdk/src/cmp/c/ReadmeIntro_c.ts +67 -0
  67. package/project/.sdk/src/cmp/c/ReadmeModel_c.ts +151 -0
  68. package/project/.sdk/src/cmp/c/ReadmeOptions_c.ts +65 -0
  69. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +225 -0
  70. package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +398 -0
  71. package/project/.sdk/src/cmp/c/ReadmeTopHowto_c.ts +24 -0
  72. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +104 -0
  73. package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +86 -0
  74. package/project/.sdk/src/cmp/c/TestEntity_c.ts +10 -0
  75. package/project/.sdk/src/cmp/c/Test_c.ts +4 -0
  76. package/project/.sdk/src/cmp/c/utility_c.ts +8 -2
  77. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +182 -0
  78. package/project/.sdk/src/cmp/clojure/ReadmeExamplesTest_clojure.ts +54 -0
  79. package/project/.sdk/src/cmp/clojure/ReadmeExplanation_clojure.ts +44 -0
  80. package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +144 -0
  81. package/project/.sdk/src/cmp/clojure/ReadmeInstall_clojure.ts +51 -0
  82. package/project/.sdk/src/cmp/clojure/ReadmeIntro_clojure.ts +66 -0
  83. package/project/.sdk/src/cmp/clojure/ReadmeModel_clojure.ts +156 -0
  84. package/project/.sdk/src/cmp/clojure/ReadmeOptions_clojure.ts +61 -0
  85. package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +210 -0
  86. package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +409 -0
  87. package/project/.sdk/src/cmp/clojure/ReadmeTopHowto_clojure.ts +24 -0
  88. package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +98 -0
  89. package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +78 -0
  90. package/project/.sdk/src/cmp/clojure/TestDirect_clojure.ts +58 -0
  91. package/project/.sdk/src/cmp/clojure/TestEntity_clojure.ts +79 -0
  92. package/project/.sdk/src/cmp/clojure/Test_clojure.ts +21 -65
  93. package/project/.sdk/src/cmp/cpp/EntityTypes_cpp.ts +174 -0
  94. package/project/.sdk/src/cmp/cpp/Main_cpp.ts +5 -0
  95. package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +170 -0
  96. package/project/.sdk/src/cmp/cpp/ReadmeExplanation_cpp.ts +45 -0
  97. package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +139 -0
  98. package/project/.sdk/src/cmp/cpp/ReadmeInstall_cpp.ts +42 -0
  99. package/project/.sdk/src/cmp/cpp/ReadmeIntro_cpp.ts +69 -0
  100. package/project/.sdk/src/cmp/cpp/ReadmeModel_cpp.ts +155 -0
  101. package/project/.sdk/src/cmp/cpp/ReadmeOptions_cpp.ts +62 -0
  102. package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +234 -0
  103. package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +387 -0
  104. package/project/.sdk/src/cmp/cpp/ReadmeTopHowto_cpp.ts +24 -0
  105. package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +95 -0
  106. package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +70 -0
  107. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +5 -1
  108. package/project/.sdk/src/cmp/csharp/EntityTypes_csharp.ts +196 -0
  109. package/project/.sdk/src/cmp/csharp/Main_csharp.ts +6 -0
  110. package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +174 -0
  111. package/project/.sdk/src/cmp/csharp/ReadmeExamplesTest_csharp.ts +198 -0
  112. package/project/.sdk/src/cmp/csharp/ReadmeExplanation_csharp.ts +42 -0
  113. package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +168 -0
  114. package/project/.sdk/src/cmp/csharp/ReadmeInstall_csharp.ts +41 -0
  115. package/project/.sdk/src/cmp/csharp/ReadmeIntro_csharp.ts +65 -0
  116. package/project/.sdk/src/cmp/csharp/ReadmeModel_csharp.ts +148 -0
  117. package/project/.sdk/src/cmp/csharp/ReadmeOptions_csharp.ts +60 -0
  118. package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +219 -0
  119. package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +390 -0
  120. package/project/.sdk/src/cmp/csharp/ReadmeTopHowto_csharp.ts +25 -0
  121. package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +92 -0
  122. package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +77 -0
  123. package/project/.sdk/src/cmp/csharp/Test_csharp.ts +4 -0
  124. package/project/.sdk/src/cmp/dart/EntityTypes_dart.ts +43 -29
  125. package/project/.sdk/src/cmp/dart/Entity_dart.ts +8 -0
  126. package/project/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +166 -0
  127. package/project/.sdk/src/cmp/dart/ReadmeExamplesTest_dart.ts +238 -0
  128. package/project/.sdk/src/cmp/dart/ReadmeExplanation_dart.ts +53 -0
  129. package/project/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +151 -0
  130. package/project/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +59 -0
  131. package/project/.sdk/src/cmp/dart/ReadmeIntro_dart.ts +65 -0
  132. package/project/.sdk/src/cmp/dart/ReadmeModel_dart.ts +151 -0
  133. package/project/.sdk/src/cmp/dart/ReadmeOptions_dart.ts +63 -0
  134. package/project/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +214 -0
  135. package/project/.sdk/src/cmp/dart/ReadmeRef_dart.ts +381 -0
  136. package/project/.sdk/src/cmp/dart/ReadmeTopHowto_dart.ts +24 -0
  137. package/project/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +95 -0
  138. package/project/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +78 -0
  139. package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +52 -0
  140. package/project/.sdk/src/cmp/dart/Test_dart.ts +6 -0
  141. package/project/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +1 -3
  142. package/project/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +1 -40
  143. package/project/.sdk/src/cmp/dart/fragment/Main.fragment.dart +3 -3
  144. package/project/.sdk/src/cmp/elixir/EntityTypes_elixir.ts +165 -0
  145. package/project/.sdk/src/cmp/elixir/Main_elixir.ts +4 -0
  146. package/project/.sdk/src/cmp/elixir/Package_elixir.ts +3 -1
  147. package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +163 -0
  148. package/project/.sdk/src/cmp/elixir/ReadmeExamplesTest_elixir.ts +126 -0
  149. package/project/.sdk/src/cmp/elixir/ReadmeExplanation_elixir.ts +55 -0
  150. package/project/.sdk/src/cmp/elixir/ReadmeHowto_elixir.ts +149 -0
  151. package/project/.sdk/src/cmp/elixir/ReadmeInstall_elixir.ts +67 -0
  152. package/project/.sdk/src/cmp/elixir/ReadmeIntro_elixir.ts +66 -0
  153. package/project/.sdk/src/cmp/elixir/ReadmeModel_elixir.ts +150 -0
  154. package/project/.sdk/src/cmp/elixir/ReadmeOptions_elixir.ts +62 -0
  155. package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +198 -0
  156. package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +333 -0
  157. package/project/.sdk/src/cmp/elixir/ReadmeTopHowto_elixir.ts +26 -0
  158. package/project/.sdk/src/cmp/elixir/ReadmeTopQuick_elixir.ts +79 -0
  159. package/project/.sdk/src/cmp/elixir/ReadmeTopTest_elixir.ts +68 -0
  160. package/project/.sdk/src/cmp/elixir/Test_elixir.ts +4 -0
  161. package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +4 -0
  162. package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +4 -0
  163. package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +4 -0
  164. package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +4 -0
  165. package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +4 -0
  166. package/project/.sdk/src/cmp/elixir/utility_elixir.ts +32 -0
  167. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +12 -3
  168. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +6 -1
  169. package/project/.sdk/src/cmp/go/TestEntity_go.ts +10 -3
  170. package/project/.sdk/src/cmp/go/utility_go.ts +3 -2
  171. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +240 -43
  172. package/project/.sdk/src/cmp/go-cli/fragment/main.fragment.go +27 -5
  173. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +191 -30
  174. package/project/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +181 -0
  175. package/project/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +125 -0
  176. package/project/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +48 -0
  177. package/project/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +168 -0
  178. package/project/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +51 -0
  179. package/project/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +67 -0
  180. package/project/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +160 -0
  181. package/project/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +74 -0
  182. package/project/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +237 -0
  183. package/project/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +405 -0
  184. package/project/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +31 -0
  185. package/project/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +104 -0
  186. package/project/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +80 -0
  187. package/project/.sdk/src/cmp/haskell/Test_haskell.ts +27 -2
  188. package/project/.sdk/src/cmp/java/EntityTypes_java.ts +207 -0
  189. package/project/.sdk/src/cmp/java/Main_java.ts +6 -0
  190. package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +175 -0
  191. package/project/.sdk/src/cmp/java/ReadmeExamplesTest_java.ts +186 -0
  192. package/project/.sdk/src/cmp/java/ReadmeExplanation_java.ts +46 -0
  193. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +156 -0
  194. package/project/.sdk/src/cmp/java/ReadmeInstall_java.ts +52 -0
  195. package/project/.sdk/src/cmp/java/ReadmeIntro_java.ts +66 -0
  196. package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +150 -0
  197. package/project/.sdk/src/cmp/java/ReadmeOptions_java.ts +61 -0
  198. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +230 -0
  199. package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +388 -0
  200. package/project/.sdk/src/cmp/java/ReadmeTopHowto_java.ts +23 -0
  201. package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +103 -0
  202. package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +77 -0
  203. package/project/.sdk/src/cmp/java/Test_java.ts +4 -0
  204. package/project/.sdk/src/cmp/js/EntityTypes_js.ts +25 -8
  205. package/project/.sdk/src/cmp/js/MainEntity_js.ts +4 -2
  206. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +4 -4
  207. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -4
  208. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +4 -4
  209. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +5 -5
  210. package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +4 -4
  211. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +4 -4
  212. package/project/.sdk/src/cmp/js/TestDirect_js.ts +6 -5
  213. package/project/.sdk/src/cmp/js/TestEntity_js.ts +7 -2
  214. package/project/.sdk/src/cmp/js/fragment/Entity.test.fragment.js +0 -31
  215. package/project/.sdk/src/cmp/kotlin/EntityTypes_kotlin.ts +201 -0
  216. package/project/.sdk/src/cmp/kotlin/Main_kotlin.ts +6 -0
  217. package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +175 -0
  218. package/project/.sdk/src/cmp/kotlin/ReadmeExamplesTest_kotlin.ts +173 -0
  219. package/project/.sdk/src/cmp/kotlin/ReadmeExplanation_kotlin.ts +47 -0
  220. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +154 -0
  221. package/project/.sdk/src/cmp/kotlin/ReadmeInstall_kotlin.ts +50 -0
  222. package/project/.sdk/src/cmp/kotlin/ReadmeIntro_kotlin.ts +66 -0
  223. package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +150 -0
  224. package/project/.sdk/src/cmp/kotlin/ReadmeOptions_kotlin.ts +61 -0
  225. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +230 -0
  226. package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +387 -0
  227. package/project/.sdk/src/cmp/kotlin/ReadmeTopHowto_kotlin.ts +23 -0
  228. package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +104 -0
  229. package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +77 -0
  230. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +4 -0
  231. package/project/.sdk/src/cmp/lua/Config_lua.ts +1 -1
  232. package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +19 -5
  233. package/project/.sdk/src/cmp/lua/Main_lua.ts +14 -2
  234. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
  235. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +6 -1
  236. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +3 -3
  237. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +2 -2
  238. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +2 -2
  239. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +7 -2
  240. package/project/.sdk/src/cmp/lua/Test_lua.ts +1 -1
  241. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +2 -0
  242. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +180 -0
  243. package/project/.sdk/src/cmp/ocaml/ReadmeExamplesTest_ocaml.ts +111 -0
  244. package/project/.sdk/src/cmp/ocaml/ReadmeExplanation_ocaml.ts +46 -0
  245. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +147 -0
  246. package/project/.sdk/src/cmp/ocaml/ReadmeInstall_ocaml.ts +44 -0
  247. package/project/.sdk/src/cmp/ocaml/ReadmeIntro_ocaml.ts +68 -0
  248. package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +155 -0
  249. package/project/.sdk/src/cmp/ocaml/ReadmeOptions_ocaml.ts +59 -0
  250. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +205 -0
  251. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +402 -0
  252. package/project/.sdk/src/cmp/ocaml/ReadmeTopHowto_ocaml.ts +25 -0
  253. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +86 -0
  254. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +79 -0
  255. package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +4 -0
  256. package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +181 -0
  257. package/project/.sdk/src/cmp/perl/ReadmeExamplesTest_perl.ts +354 -0
  258. package/project/.sdk/src/cmp/perl/ReadmeExplanation_perl.ts +43 -0
  259. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +149 -0
  260. package/project/.sdk/src/cmp/perl/ReadmeInstall_perl.ts +47 -0
  261. package/project/.sdk/src/cmp/perl/ReadmeIntro_perl.ts +66 -0
  262. package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +150 -0
  263. package/project/.sdk/src/cmp/perl/ReadmeOptions_perl.ts +59 -0
  264. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +216 -0
  265. package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +399 -0
  266. package/project/.sdk/src/cmp/perl/ReadmeTopHowto_perl.ts +24 -0
  267. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +91 -0
  268. package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +83 -0
  269. package/project/.sdk/src/cmp/perl/Test_perl.ts +4 -0
  270. package/project/.sdk/src/cmp/php/EntityTypes_php.ts +23 -6
  271. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +6 -1
  272. package/project/.sdk/src/cmp/php/TestEntity_php.ts +7 -2
  273. package/project/.sdk/src/cmp/py/EntityTypes_py.ts +32 -7
  274. package/project/.sdk/src/cmp/py/Entity_py.ts +2 -10
  275. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
  276. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +8 -3
  277. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +3 -3
  278. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +2 -2
  279. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
  280. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
  281. package/project/.sdk/src/cmp/py/TestEntity_py.ts +7 -2
  282. package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +19 -5
  283. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
  284. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +8 -3
  285. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +3 -3
  286. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +2 -2
  287. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
  288. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
  289. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +7 -2
  290. package/project/.sdk/src/cmp/rust/EntityBase_rust.ts +4 -0
  291. package/project/.sdk/src/cmp/rust/EntityTypes_rust.ts +152 -0
  292. package/project/.sdk/src/cmp/rust/Entity_rust.ts +1 -1
  293. package/project/.sdk/src/cmp/rust/Main_rust.ts +5 -0
  294. package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +163 -0
  295. package/project/.sdk/src/cmp/rust/ReadmeExamplesTest_rust.ts +132 -0
  296. package/project/.sdk/src/cmp/rust/ReadmeExplanation_rust.ts +44 -0
  297. package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +142 -0
  298. package/project/.sdk/src/cmp/rust/ReadmeInstall_rust.ts +49 -0
  299. package/project/.sdk/src/cmp/rust/ReadmeIntro_rust.ts +66 -0
  300. package/project/.sdk/src/cmp/rust/ReadmeModel_rust.ts +153 -0
  301. package/project/.sdk/src/cmp/rust/ReadmeOptions_rust.ts +60 -0
  302. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +212 -0
  303. package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +384 -0
  304. package/project/.sdk/src/cmp/rust/ReadmeTopHowto_rust.ts +24 -0
  305. package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +95 -0
  306. package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +81 -0
  307. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +10 -0
  308. package/project/.sdk/src/cmp/rust/Test_rust.ts +4 -0
  309. package/project/.sdk/src/cmp/scala/EntityTypes_scala.ts +202 -0
  310. package/project/.sdk/src/cmp/scala/Main_scala.ts +6 -0
  311. package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +175 -0
  312. package/project/.sdk/src/cmp/scala/ReadmeExamplesTest_scala.ts +163 -0
  313. package/project/.sdk/src/cmp/scala/ReadmeExplanation_scala.ts +49 -0
  314. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +155 -0
  315. package/project/.sdk/src/cmp/scala/ReadmeInstall_scala.ts +58 -0
  316. package/project/.sdk/src/cmp/scala/ReadmeIntro_scala.ts +66 -0
  317. package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +150 -0
  318. package/project/.sdk/src/cmp/scala/ReadmeOptions_scala.ts +61 -0
  319. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +230 -0
  320. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +388 -0
  321. package/project/.sdk/src/cmp/scala/ReadmeTopHowto_scala.ts +23 -0
  322. package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +104 -0
  323. package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +77 -0
  324. package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +38 -10
  325. package/project/.sdk/src/cmp/scala/Test_scala.ts +8 -0
  326. package/project/.sdk/src/cmp/swift/EntityTypes_swift.ts +152 -0
  327. package/project/.sdk/src/cmp/swift/Main_swift.ts +5 -0
  328. package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +176 -0
  329. package/project/.sdk/src/cmp/swift/ReadmeExamplesTest_swift.ts +170 -0
  330. package/project/.sdk/src/cmp/swift/ReadmeExplanation_swift.ts +49 -0
  331. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +159 -0
  332. package/project/.sdk/src/cmp/swift/ReadmeInstall_swift.ts +58 -0
  333. package/project/.sdk/src/cmp/swift/ReadmeIntro_swift.ts +64 -0
  334. package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +149 -0
  335. package/project/.sdk/src/cmp/swift/ReadmeOptions_swift.ts +62 -0
  336. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +232 -0
  337. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +387 -0
  338. package/project/.sdk/src/cmp/swift/ReadmeTopHowto_swift.ts +24 -0
  339. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +105 -0
  340. package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +77 -0
  341. package/project/.sdk/src/cmp/swift/Test_swift.ts +4 -0
  342. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +19 -5
  343. package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +4 -2
  344. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +4 -4
  345. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +14 -4
  346. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +29 -11
  347. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +5 -5
  348. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +4 -4
  349. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +4 -4
  350. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +13 -11
  351. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +18 -2
  352. package/project/.sdk/src/cmp/zig/Config_zig.ts +22 -4
  353. package/project/.sdk/src/cmp/zig/Entity_zig.ts +1 -1
  354. package/project/.sdk/src/cmp/zig/Main_zig.ts +10 -4
  355. package/project/.sdk/src/cmp/zig/Package_zig.ts +53 -0
  356. package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +188 -0
  357. package/project/.sdk/src/cmp/zig/ReadmeExamplesTest_zig.ts +58 -0
  358. package/project/.sdk/src/cmp/zig/ReadmeExplanation_zig.ts +45 -0
  359. package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +143 -0
  360. package/project/.sdk/src/cmp/zig/ReadmeInstall_zig.ts +54 -0
  361. package/project/.sdk/src/cmp/zig/ReadmeIntro_zig.ts +66 -0
  362. package/project/.sdk/src/cmp/zig/ReadmeModel_zig.ts +152 -0
  363. package/project/.sdk/src/cmp/zig/ReadmeOptions_zig.ts +60 -0
  364. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +211 -0
  365. package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +400 -0
  366. package/project/.sdk/src/cmp/zig/ReadmeTopHowto_zig.ts +24 -0
  367. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +96 -0
  368. package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +82 -0
  369. package/project/.sdk/src/cmp/zig/TestDirect_zig.ts +66 -0
  370. package/project/.sdk/src/cmp/zig/TestEntity_zig.ts +79 -0
  371. package/project/.sdk/src/cmp/zig/Test_zig.ts +17 -61
  372. package/project/.sdk/tm/clojure/src/voxgig/struct.clj +1 -1
  373. package/project/.sdk/tm/cpp/test/feature_test.cpp +19 -0
  374. package/project/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +4 -1
  375. package/project/.sdk/tm/dart/lib/utility/voxgig_struct.dart +7 -1
  376. package/project/.sdk/tm/elixir/lib/utility/struct/voxgig_struct.ex +1 -1
  377. package/project/.sdk/tm/elixir/test/primary_utility_test.exs +7 -1
  378. package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +3 -1
  379. package/project/.sdk/tm/haskell/test/Harness.hs +8 -3
  380. package/project/.sdk/tm/js/Makefile +1 -1
  381. package/project/.sdk/tm/js/jsconfig.json +12 -0
  382. package/project/.sdk/tm/ocaml/Makefile +5 -1
  383. package/project/.sdk/tm/php/utility/struct/Struct.php +1 -1
  384. package/project/.sdk/tm/py/utility/voxgig_struct/voxgig_struct.py +1 -1
  385. package/project/.sdk/tm/rb/utility/struct/voxgig_struct.rb +1 -1
  386. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +8 -59
  387. package/project/.sdk/tm/ts/Makefile +1 -1
  388. package/project/.sdk/tm/zig/utility/voxgigstruct/struct.zig +1 -1
  389. package/src/cmp/ReadmeErrors.ts +2 -2
  390. package/src/cmp/ReadmeExplanation.ts +3 -3
  391. package/src/cmp/ReadmeTop.ts +2 -2
  392. package/src/helpers/canonType.ts +116 -25
  393. package/src/helpers/naming.ts +47 -0
  394. package/src/helpers/opExample.ts +43 -20
  395. package/src/helpers/opShape.ts +102 -3
  396. package/src/sdkgen.ts +8 -2
  397. package/src/tsconfig.json +2 -0
  398. package/project/.sdk/tm/zig/build.zig.zon +0 -11
@@ -70,58 +70,198 @@ const Main = cmp(function Main(props: any) {
70
70
  /go-mcp
71
71
  `))
72
72
 
73
- // README.md — usage guide for the MCP server.
73
+ // ==========================================================================
74
+ // README.md — Diátaxis-structured, examples-first usage guide.
75
+ //
76
+ // The server ALWAYS registers exactly two tools (<slug>_list / <slug>_load;
77
+ // see tools.fragment.go), so tools are not gated. Concrete tool-call and
78
+ // entity examples are MODEL-DRIVEN off the real slug + entity names.
79
+ // ==========================================================================
80
+ const bin = `${model.name}-mcp`
81
+ const toolList = `${slugLower}_list`
82
+ const toolLoad = `${slugLower}_load`
83
+ const entityCount = entityNames.length
84
+ const entityNoun = entityCount === 1 ? 'entity' : 'entities'
74
85
  const firstEntity = entityNames[0] || 'entity'
86
+
87
+ // Example entities chosen per-op so a doc example never shows an entity that
88
+ // doesn't support the op being demonstrated (both tools are always
89
+ // registered, but a given entity only responds to the ops it exposes).
90
+ const activeEntityObjs: any[] =
91
+ Object.values(entityMap).filter((e: any) => e && e.active !== false)
92
+ const entWithOp = (op: string) => {
93
+ const e = activeEntityObjs.find(
94
+ (x: any) => x.op && x.op[op] && x.op[op].active !== false)
95
+ return e ? String(e.name).toLowerCase() : firstEntity
96
+ }
97
+ const listEntity = entWithOp('list')
98
+ const loadEntity = entWithOp('load')
99
+
100
+ const projUpper = String(model.name).toUpperCase().replace(/[^A-Z0-9]/g, '_')
101
+ const apiKeyEnv = projUpper + '_APIKEY'
102
+ const baseEnv = projUpper + '_BASE'
103
+
75
104
  File({ name: 'README.md' }, () => Content(`# ${model.name}-mcp
76
105
 
77
- MCP server exposing the ${model.Name} SDK as tools, built on the
78
- [official Go MCP SDK](https://github.com/modelcontextprotocol/go-sdk)
79
- and the sibling Go SDK at \`../go\`.
106
+ [MCP](https://modelcontextprotocol.io) server exposing the ${model.Name} SDK as
107
+ two agent tools — \`${toolList}\` and \`${toolLoad}\` — built on the
108
+ [official Go MCP SDK](https://github.com/modelcontextprotocol/go-sdk) and the
109
+ sibling Go SDK at \`../go\`. Runs over **stdio** (default, for spawnable installs)
110
+ or **streamable HTTP** (one shared server for several agents).
80
111
 
81
- ## Tools
112
+ ## Examples
82
113
 
83
- | Tool | Args | Returns |
84
- |------|------|---------|
85
- | \`${slugLower}_list\` | \`entity\`, optional \`query\` map | First page of records as JSON |
86
- | \`${slugLower}_load\` | \`entity\`, \`query\` (e.g. \`{id:N}\`) | Single record as JSON |
114
+ \`\`\`sh
115
+ # 1. Build a native binary (-> dist/<os>-<arch>/${bin})
116
+ make build
87
117
 
88
- JSON schemas for both tools are emitted by the SDK from the \`Args\`
89
- struct's \`json\` / \`jsonschema\` tags — no schema is hand-written.
118
+ # 2. Provide credentials via the environment
119
+ export ${apiKeyEnv}=sk_live_xxx
90
120
 
91
- ## Entities
121
+ # 3a. Install into Claude Code over stdio (most common)
122
+ claude mcp add --scope user ${slugLower} \\
123
+ -- /absolute/path/to/${bin} -transport stdio
92
124
 
93
- ${entityHelp}
125
+ # 3b. …or run a shared HTTP server instead
126
+ ./${bin} -transport http -addr :8080
127
+ \`\`\`
128
+
129
+ Tool-call arguments (what an agent sends):
130
+
131
+ \`\`\`jsonc
132
+ // ${toolList}: first page of records
133
+ { "entity": "${listEntity}" }
134
+ { "entity": "${listEntity}", "query": { } }
135
+
136
+ // ${toolLoad}: one record by id
137
+ { "entity": "${loadEntity}", "query": { "id": 1 } }
138
+ \`\`\`
139
+
140
+ > The rest of this guide follows the [Diátaxis](https://diataxis.fr) framework:
141
+ > a hands-on **Tutorial**, task-focused **How-to guides**, a factual
142
+ > **Reference**, and background **Explanation**.
143
+
144
+ ## Tutorial: install and call a tool
145
+
146
+ 1. **Build** the server from this \`go-mcp/\` directory:
94
147
 
95
- ## Build
148
+ \`\`\`sh
149
+ make build # -> dist/<os>-<arch>/${bin}
150
+ \`\`\`
151
+
152
+ 2. **Set your API key:**
153
+
154
+ \`\`\`sh
155
+ export ${apiKeyEnv}=sk_live_xxx
156
+ \`\`\`
157
+
158
+ 3. **Install it into Claude Code** (stdio transport):
159
+
160
+ \`\`\`sh
161
+ claude mcp add --scope user ${slugLower} \\
162
+ -- "$PWD"/dist/*/${bin} -transport stdio
163
+ \`\`\`
164
+
165
+ 4. **Restart Claude Code.** The \`${toolList}\` and \`${toolLoad}\` tools now appear
166
+ in new sessions. Ask the agent to *"list ${listEntity} using ${slugLower}"*
167
+ and it calls \`${toolList}\` with \`{"entity":"${listEntity}"}\`.
168
+
169
+ ## How-to guides
170
+
171
+ ### Authenticate and choose an environment
172
+
173
+ Configuration is read from the environment — nothing is written to disk:
96
174
 
97
175
  \`\`\`sh
98
- go build -o ${model.name}-mcp ./...
176
+ export ${apiKeyEnv}=sk_live_xxx # API key
177
+ export ${baseEnv}=https://api.example.com # optional: override the API base URL
99
178
  \`\`\`
100
179
 
101
- ## Run
180
+ Set these in the shell that launches the server (or in the \`claude mcp add\`
181
+ environment) so every tool call is authenticated.
182
+
183
+ ### Run as a shared HTTP server
102
184
 
103
185
  \`\`\`sh
104
- # stdio transport for spawnable agent installs (default).
105
- ./${model.name}-mcp
186
+ ./${bin} -transport http -addr :8080
187
+ \`\`\`
188
+
189
+ Streamable HTTP lets several agents share one running process; stdio (the
190
+ default) spawns a fresh process per client.
106
191
 
107
- # streamable HTTP transport — share one running server between agents.
108
- ./${model.name}-mcp -transport http -addr :8080
192
+ ### Call the \`${toolList}\` tool
193
+
194
+ Args: \`entity\` (required), \`query\` (optional filter map). Returns the first
195
+ page of records as JSON:
196
+
197
+ \`\`\`jsonc
198
+ { "entity": "${listEntity}" }
109
199
  \`\`\`
110
200
 
111
- ## Install for Claude Code
201
+ ### Call the \`${toolLoad}\` tool
202
+
203
+ Args: \`entity\` (required), \`query\` = \`{"id":N}\` (required). Returns the single
204
+ record as JSON:
205
+
206
+ \`\`\`jsonc
207
+ { "entity": "${loadEntity}", "query": { "id": 1 } }
208
+ \`\`\`
209
+
210
+ ### Cross-compile release binaries
112
211
 
113
212
  \`\`\`sh
114
- claude mcp add --scope user ${slugLower} \\
115
- -- /absolute/path/to/${model.name}-mcp -transport stdio
213
+ make build # native binary for this machine
214
+ make build-all # linux/darwin/windows x amd64/arm64, under dist/<os>-<arch>/
116
215
  \`\`\`
117
216
 
118
- After install, restart Claude Code; the \`${slugLower}_list\` and
119
- \`${slugLower}_load\` tools become available in new sessions.
217
+ ## Reference
218
+
219
+ ### Tools
220
+
221
+ | Tool | Args | Returns |
222
+ |------|------|---------|
223
+ | \`${toolList}\` | \`entity\` (required), \`query\` (optional map) | First page of records as JSON |
224
+ | \`${toolLoad}\` | \`entity\` (required), \`query\` = \`{id:N}\` | Single record as JSON |
225
+
226
+ On error, a tool returns an MCP error result (\`isError: true\`) whose text is the
227
+ failure message (e.g. unknown entity, or an API error).
228
+
229
+ ### \`Args\` schema
230
+
231
+ Both tools take the same argument object:
232
+
233
+ | Field | Type | Notes |
234
+ |-------|------|-------|
235
+ | \`entity\` | string | One of the ${entityCount} supported entities (see below). |
236
+ | \`query\` | object | Optional match map. \`{"id":N}\` for load; omit or \`{}\` for list. |
237
+
238
+ JSON schemas are emitted by the SDK from the \`Args\` struct's \`json\` /
239
+ \`jsonschema\` tags — no schema is hand-written.
240
+
241
+ ### Transports & flags
120
242
 
121
- ## Smoke test via HTTP
243
+ | Flag | Default | Purpose |
244
+ |------|---------|---------|
245
+ | \`-transport\` | \`stdio\` | \`stdio\` (spawnable) or \`http\` (streamable HTTP). |
246
+ | \`-addr\` | \`:8080\` | Listen address for the \`http\` transport. |
247
+
248
+ ### Environment variables
249
+
250
+ | Variable | Purpose |
251
+ |----------|---------|
252
+ | \`${apiKeyEnv}\` | API key sent with every request. |
253
+ | \`${baseEnv}\` | Optional override of the API base URL. |
254
+
255
+ ### Entities
256
+
257
+ The ${entityCount} ${entityNoun} valid as the \`entity\` argument:
258
+
259
+ ${entityHelp}
260
+
261
+ ### Smoke test via HTTP (raw JSON-RPC)
122
262
 
123
263
  \`\`\`sh
124
- ./${model.name}-mcp -transport http -addr :18080 &
264
+ ./${bin} -transport http -addr :18080 &
125
265
 
126
266
  # initialize, grab the session id
127
267
  curl -sN -X POST http://localhost:18080 \\
@@ -136,13 +276,34 @@ curl -sN -X POST http://localhost:18080 \\
136
276
  -H 'Content-Type: application/json' \\
137
277
  -H 'Accept: application/json, text/event-stream' \\
138
278
  -H "Mcp-Session-Id: $SESSION" \\
139
- -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"${slugLower}_load","arguments":{"entity":"${firstEntity}","query":{"id":1}}}}'
279
+ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"${toolLoad}","arguments":{"entity":"${loadEntity}","query":{"id":1}}}}'
140
280
  \`\`\`
141
281
 
282
+ ## Explanation
283
+
284
+ ### How tools map to the SDK
285
+
286
+ \`main.go\` builds the SDK client (configured from the environment) and registers
287
+ two tools. Each dispatches on the \`entity\` argument to the matching entity in
288
+ the sibling Go SDK at \`../go\`, calls \`List\` or \`Load\`, unwraps the \`Entity\`
289
+ wrappers to plain data, and returns it as pretty-printed JSON.
290
+
291
+ ### Why two transports
292
+
293
+ **stdio** is the standard for agent hosts that spawn a server per client
294
+ (Claude Code's \`claude mcp add\`). **streamable HTTP** keeps one process running
295
+ that many agents can share — handy for a long-lived deployment.
296
+
297
+ ### Schema generation
298
+
299
+ The input schema is derived from the \`Args\` Go struct's \`json\` / \`jsonschema\`
300
+ tags at registration time, so the advertised tool schema can never drift from
301
+ the code that consumes it.
302
+
142
303
  ## Generated by
143
304
 
144
- sdkgen \`go-mcp\` target. See the target source under
145
- \`.sdk/src/cmp/go-mcp/\` in this repo, or upstream at
305
+ sdkgen \`go-mcp\` target. See the target source under \`.sdk/src/cmp/go-mcp/\` in
306
+ this repo, or upstream at
146
307
  \`github.com/voxgig/sdkgen/project/.sdk/src/cmp/go-mcp/\`.
147
308
  `))
148
309
 
@@ -0,0 +1,181 @@
1
+
2
+ import { cmp, each, Content, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
+
4
+ import {
5
+ KIT,
6
+ getModelPath,
7
+ } from '@voxgig/apidef'
8
+
9
+ import { hsVarName } from './utility_haskell'
10
+
11
+
12
+ // A type-correct Haskell `Value` literal for a field's canonical type.
13
+ function hsLit(type: any, placeholder: string = 'example'): string {
14
+ const k = canonKey(type)
15
+ if ('INTEGER' === k || 'NUMBER' === k) return 'VNum 1'
16
+ if ('BOOLEAN' === k) return 'VBool True'
17
+ if ('ARRAY' === k || 'OBJECT' === k) return 'VNoval'
18
+ return `VStr "${placeholder}"`
19
+ }
20
+
21
+
22
+ // A readable Haskell type name for a field's canonical type. The runtime
23
+ // carries every field as a dynamic `Value`; this documents the logical type.
24
+ function hsType(type: any): string {
25
+ const k = canonKey(type)
26
+ if ('STRING' === k) return 'String'
27
+ if ('INTEGER' === k) return 'Int'
28
+ if ('NUMBER' === k) return 'Double'
29
+ if ('BOOLEAN' === k) return 'Bool'
30
+ if ('ARRAY' === k) return '[Value]'
31
+ return 'Value'
32
+ }
33
+
34
+
35
+ const OP_DESC: Record<string, { method: string, desc: string }> = {
36
+ load: { method: 'eLoad ent match ctrl', desc: 'Load a single entity by match criteria.' },
37
+ list: { method: 'eList ent match ctrl', desc: 'List entities, optionally matching the given criteria.' },
38
+ create: { method: 'eCreate ent data ctrl', desc: 'Create a new entity with the given data.' },
39
+ update: { method: 'eUpdate ent data ctrl', desc: 'Update an existing entity.' },
40
+ remove: { method: 'eRemove ent match ctrl', desc: 'Remove the matching entity.' },
41
+ }
42
+
43
+
44
+ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
45
+ const { target } = props
46
+ const { model } = props.ctx$
47
+
48
+ const entity = getModelPath(model, `main.${KIT}.entity`)
49
+
50
+ const publishedEntities = each(entity)
51
+ .filter((entity: any) => entity.active !== false)
52
+
53
+ if (0 === publishedEntities.length) {
54
+ return
55
+ }
56
+
57
+ Content(`
58
+
59
+ ## Entities
60
+
61
+ `)
62
+
63
+ publishedEntities.map((entity: any) => {
64
+ const opnames = Object.keys(entity.op || {})
65
+ const fields = entity.fields || []
66
+ const idF = entityIdField(entity)
67
+ const eFn = hsVarName(entity.name)
68
+
69
+ Content(`
70
+ ### ${entity.Name}
71
+
72
+ `)
73
+
74
+ if (entity.short) {
75
+ Content(`${entity.short}
76
+
77
+ `)
78
+ }
79
+
80
+ Content(`Create an instance: \`${eFn} <- Sdk.${eFn} sdk VNoval\`
81
+
82
+ `)
83
+
84
+ if (opnames.length > 0) {
85
+ Content(`#### Operations
86
+
87
+ | Method | Description |
88
+ | --- | --- |
89
+ `)
90
+ opnames.map((opname: string) => {
91
+ const info = OP_DESC[opname]
92
+ if (info) {
93
+ Content(`| \`${info.method}\` | ${info.desc} |
94
+ `)
95
+ }
96
+ })
97
+
98
+ Content(`
99
+ `)
100
+ }
101
+
102
+ if (fields.length > 0) {
103
+ Content(`#### Fields
104
+
105
+ | Field | Type | Description |
106
+ | --- | --- | --- |
107
+ `)
108
+
109
+ each(fields, (field: any) => {
110
+ const desc = field.short || ''
111
+ Content(`| \`${field.name}\` | \`${hsType(field.type)}\` | ${desc} |
112
+ `)
113
+ })
114
+
115
+ Content(`
116
+ `)
117
+ }
118
+
119
+ if (opnames.includes('load')) {
120
+ const loadItems = opRequestShape(entity, 'load').items
121
+ .filter((it: any) => !it.optional || it.name === idF)
122
+ .sort((a: any, b: any) =>
123
+ (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
124
+ const loadArg = 0 < loadItems.length
125
+ ? `[${loadItems.map((it: any) =>
126
+ `("${it.name}", ${hsLit(it.type,
127
+ it.name === idF ? entity.name + '_id' : it.name)})`).join(', ')}]`
128
+ : '[]'
129
+ Content(`#### Example: Load
130
+
131
+ \`\`\`haskell
132
+ ent <- Sdk.${eFn} sdk VNoval
133
+ match <- jo ${loadArg}
134
+ ctrl <- emptyMap
135
+ ${eFn} <- Sdk.eLoad ent match ctrl
136
+ \`\`\`
137
+
138
+ `)
139
+ }
140
+
141
+ if (opnames.includes('list')) {
142
+ Content(`#### Example: List
143
+
144
+ \`\`\`haskell
145
+ ent <- Sdk.${eFn} sdk VNoval
146
+ match <- emptyMap
147
+ ctrl <- emptyMap
148
+ ${eFn}s <- Sdk.eList ent match ctrl
149
+ \`\`\`
150
+
151
+ `)
152
+ }
153
+
154
+ if (opnames.includes('create')) {
155
+ const createItems = opRequestShape(entity, 'create').items
156
+ .filter((it: any) => !it.optional)
157
+ Content(`#### Example: Create
158
+
159
+ \`\`\`haskell
160
+ ent <- Sdk.${eFn} sdk VNoval
161
+ d <- jo
162
+ [`)
163
+ createItems.map((it: any, i: number) => {
164
+ const bracket = 0 === i ? ' ' : ', '
165
+ Content(`${bracket}("${it.name}", ${hsLit(it.type, 'example_' + it.name)}) -- ${hsType(it.type)}
166
+ `)
167
+ })
168
+ Content(`]
169
+ ctrl <- emptyMap
170
+ ${eFn} <- Sdk.eCreate ent d ctrl
171
+ \`\`\`
172
+
173
+ `)
174
+ }
175
+ })
176
+ })
177
+
178
+
179
+ export {
180
+ ReadmeEntity
181
+ }
@@ -0,0 +1,125 @@
1
+
2
+ import { cmp, File, Content } from '@voxgig/sdkgen'
3
+
4
+
5
+ // Emits test/TReadmeExamples.hs — a STRUCTURAL gate over every fenced
6
+ // Haskell code block in the three docs that ship Haskell examples:
7
+ // - the root README.md (top-level, multi-language quick start)
8
+ // - the per-language haskell/README.md
9
+ // - the per-language haskell/REFERENCE.md
10
+ //
11
+ // DESIGN NOTE vs the Python gate (ReadmeExamplesTest_py.ts): the Python
12
+ // version parses AND executes every block in a seeded test-mode subprocess.
13
+ // A faithful Haskell port would compile every snippet against the generated
14
+ // SDK — a throwaway module per block plus a GHC invocation — a large,
15
+ // environment-sensitive harness that cannot be authored safely without a build
16
+ // to validate it. This gate instead validates that every documented Haskell
17
+ // block is PRESENT, non-empty, and STRUCTURALLY well-formed (balanced
18
+ // delimiters). Missing docs are tolerated (a run may generate a subset of
19
+ // phases), and no blocks found records no failures — so this never breaks the
20
+ // shared runner. Upgrading it to a true compile gate is left as a follow-up.
21
+ //
22
+ // The emitted module exposes `tests :: Counters -> IO ()`; the generated
23
+ // SdkGenTests calls it, so it runs inside the standard Runner. The triple
24
+ // backtick fence marker is built from its char code (toEnum 96) so this
25
+ // component's Haskell source needs no backtick/backslash gymnastics.
26
+ const ReadmeExamplesTest = cmp(function ReadmeExamplesTest(props: any) {
27
+ const { target, ctx$: { model } } = props
28
+
29
+ const Name = model.const.Name
30
+
31
+ File({ name: 'TReadmeExamples.' + target.ext }, () => {
32
+ Content(`-- ${Name} SDK — documentation Haskell-examples structural gate.
33
+ --
34
+ -- Validates that every fenced Haskell code block in the SDK docs (the root
35
+ -- README.md, the per-language README.md, and REFERENCE.md) is present,
36
+ -- non-empty, and has balanced delimiters. Missing docs are tolerated (a run
37
+ -- may generate a subset of phases), so this gate never breaks the shared
38
+ -- runner. See ReadmeExamplesTest_haskell for why this is a structural gate
39
+ -- rather than a full compile harness. Generated by @voxgig/sdkgen.
40
+
41
+ {-# LANGUAGE ScopedTypeVariables #-}
42
+
43
+ module TReadmeExamples (tests) where
44
+
45
+ import Control.Exception (SomeException, evaluate, try)
46
+ import Control.Monad (forM_)
47
+
48
+ import Testutil (Counters, runTest)
49
+
50
+
51
+ -- True for the whitespace characters we trim: space, tab, carriage return.
52
+ isWs :: Char -> Bool
53
+ isWs ch = let n = fromEnum ch in n == 32 || n == 9 || n == 13
54
+
55
+
56
+ -- Trim leading/trailing whitespace from a line.
57
+ trimWs :: String -> String
58
+ trimWs = f . f
59
+ where f = reverse . dropWhile isWs
60
+
61
+
62
+ -- Read a doc file, tolerating absence (returns "" when missing/unreadable).
63
+ readDoc :: FilePath -> IO String
64
+ readDoc path = do
65
+ r <- try (do s <- readFile path; _ <- evaluate (length s); pure s)
66
+ :: IO (Either SomeException String)
67
+ pure (either (const "") id r)
68
+
69
+
70
+ -- Extract the body of every fenced Haskell block from markdown. The fence
71
+ -- marker (three backticks) is built from its char code so this source stays
72
+ -- backtick-free.
73
+ haskellBlocks :: String -> [String]
74
+ haskellBlocks src = go (lines src)
75
+ where
76
+ fence3 = replicate 3 (toEnum 96 :: Char)
77
+ fenceHs = fence3 ++ "haskell"
78
+ go [] = []
79
+ go (l : ls)
80
+ | trimWs l == fenceHs =
81
+ let (blk, rest) = break (\\x -> trimWs x == fence3) ls
82
+ in unlines blk : go (drop 1 rest)
83
+ | otherwise = go ls
84
+
85
+
86
+ -- Balanced (), [], {} ignoring the contents of double-quoted string literals.
87
+ -- The generated snippets never embed an escaped quote inside a string.
88
+ balanced :: String -> Bool
89
+ balanced = go False (0 :: Int)
90
+ where
91
+ go inStr d [] = not inStr && d == 0
92
+ go inStr d (c : cs)
93
+ | c == '"' = go (not inStr) d cs
94
+ | inStr = go inStr d cs
95
+ | c == '(' || c == '[' || c == '{' = go inStr (d + 1) cs
96
+ | c == ')' || c == ']' || c == '}' =
97
+ if d <= 0 then False else go inStr (d - 1) cs
98
+ | otherwise = go inStr d cs
99
+
100
+
101
+ -- The three documents held to the gate, tagged by human label.
102
+ docs :: [(String, FilePath)]
103
+ docs =
104
+ [ ("root README", "../README.md")
105
+ , ("${target.name} README", "README.md")
106
+ , ("${target.name} REFERENCE", "REFERENCE.md")
107
+ ]
108
+
109
+
110
+ tests :: Counters -> IO ()
111
+ tests c =
112
+ forM_ docs (\\(label, path) -> do
113
+ src <- readDoc path
114
+ let blocks = haskellBlocks src
115
+ forM_ (zip [1 :: Int ..] blocks) (\\(i, blk) ->
116
+ runTest c (label ++ " haskell block " ++ show i ++ " well-formed")
117
+ (pure (not (null (trimWs blk)) && balanced blk))))
118
+ `)
119
+ })
120
+ })
121
+
122
+
123
+ export {
124
+ ReadmeExamplesTest
125
+ }
@@ -0,0 +1,48 @@
1
+
2
+ import { cmp, Content } from '@voxgig/sdkgen'
3
+
4
+
5
+ const ReadmeExplanation = cmp(function ReadmeExplanation(props: any) {
6
+ const { target, ctx$: { model } } = props
7
+
8
+ Content(`### Data as struct Values
9
+
10
+ The Haskell SDK models every API record as the dynamic \`Value\` type (from
11
+ the vendored \`VoxgigStruct\` module) rather than bespoke Haskell records.
12
+ This mirrors the dynamic nature of the API and keeps the SDK flexible — no
13
+ new datatypes or code generation are needed when the API schema changes.
14
+
15
+ Build request maps with \`jo [(key, value)]\` and read fields back with
16
+ \`getp value "field"\`; scalars are the \`VStr\` / \`VNum\` / \`VBool\`
17
+ constructors, and \`VNoval\` stands for an absent property.
18
+
19
+ ### Module structure
20
+
21
+ \`\`\`
22
+ ${target.name}/
23
+ ├── src/
24
+ │ ├── VoxgigStruct.hs -- vendored dependency-free struct library (Value)
25
+ │ ├── Vregex.hs -- vendored regex support
26
+ │ ├── SdkTypes.hs -- core types (Client, Entity, Feature)
27
+ │ ├── SdkHelpers.hs -- helper functions (jo, getp, ...)
28
+ │ ├── SdkRuntime.hs -- the generic operation pipeline
29
+ │ ├── SdkFeatures.hs -- built-in features + makeEntity
30
+ │ ├── SdkConfig.hs -- generated API configuration + feature factory
31
+ │ └── SdkClient.hs -- generated public client (newSdk, entity accessors)
32
+ ├── test/ -- test suites
33
+ ├── Makefile -- stock-GHC build/test (no third-party deps)
34
+ └── ${model.const.Name.toLowerCase()}-sdk.cabal -- package manifest (for Hackage)
35
+ \`\`\`
36
+
37
+ The public module (\`SdkClient\`) exports the SDK constructors (\`newSdk\`,
38
+ \`testSdk\`) and one accessor per entity. Import \`VoxgigStruct\` for the
39
+ \`Value\` constructors and \`SdkHelpers\` for \`jo\` / \`getp\`.
40
+
41
+ `)
42
+
43
+ })
44
+
45
+
46
+ export {
47
+ ReadmeExplanation
48
+ }