@voxgig/sdkgen 3.5.1 → 3.7.0

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 (255) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/AgentGuideTop.js +17 -0
  3. package/dist/cmp/AgentGuideTop.js.map +1 -1
  4. package/dist/cmp/ExternalTarget.js +1 -1
  5. package/dist/cmp/ExternalTarget.js.map +1 -1
  6. package/dist/cmp/Readme.js +2 -0
  7. package/dist/cmp/Readme.js.map +1 -1
  8. package/dist/cmp/ReadmeStation.d.ts +2 -0
  9. package/dist/cmp/ReadmeStation.js +57 -0
  10. package/dist/cmp/ReadmeStation.js.map +1 -0
  11. package/dist/helpers/naming.d.ts +6 -1
  12. package/dist/helpers/naming.js +156 -5
  13. package/dist/helpers/naming.js.map +1 -1
  14. package/dist/helpers/opShape.js +72 -0
  15. package/dist/helpers/opShape.js.map +1 -1
  16. package/dist/helpers/packageMeta.d.ts +2 -1
  17. package/dist/helpers/packageMeta.js +57 -20
  18. package/dist/helpers/packageMeta.js.map +1 -1
  19. package/dist/sdkgen.d.ts +3 -3
  20. package/dist/sdkgen.js +63 -18
  21. package/dist/sdkgen.js.map +1 -1
  22. package/dist/testkit.d.ts +39 -0
  23. package/dist/testkit.js +663 -0
  24. package/dist/testkit.js.map +1 -0
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/dist/utility.d.ts +1 -1
  27. package/dist/utility.js +16 -2
  28. package/dist/utility.js.map +1 -1
  29. package/package.json +32 -8
  30. package/project/.sdk/src/cmp/c/Config_c.ts +34 -13
  31. package/project/.sdk/src/cmp/c/Test_c.ts +5 -7
  32. package/project/.sdk/src/cmp/clojure/Test_clojure.ts +3 -7
  33. package/project/.sdk/src/cmp/cpp/Config_cpp.ts +9 -46
  34. package/project/.sdk/src/cmp/cpp/Test_cpp.ts +4 -7
  35. package/project/.sdk/src/cmp/csharp/Config_csharp.ts +7 -1
  36. package/project/.sdk/src/cmp/csharp/Package_csharp.ts +1 -1
  37. package/project/.sdk/src/cmp/csharp/Test_csharp.ts +5 -7
  38. package/project/.sdk/src/cmp/dart/Config_dart.ts +14 -2
  39. package/project/.sdk/src/cmp/dart/Test_dart.ts +3 -4
  40. package/project/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +5 -0
  41. package/project/.sdk/src/cmp/dart/fragment/Config.fragment.dart +6 -0
  42. package/project/.sdk/src/cmp/dart/fragment/Main.fragment.dart +13 -4
  43. package/project/.sdk/src/cmp/elixir/Config_elixir.ts +12 -2
  44. package/project/.sdk/src/cmp/elixir/Package_elixir.ts +42 -3
  45. package/project/.sdk/src/cmp/elixir/Test_elixir.ts +5 -6
  46. package/project/.sdk/src/cmp/go/Config_go.ts +8 -1
  47. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +1 -1
  48. package/project/.sdk/src/cmp/go/Entity_go.ts +1 -1
  49. package/project/.sdk/src/cmp/go/Gitignore_go.ts +6 -0
  50. package/project/.sdk/src/cmp/go/Main_go.ts +2 -2
  51. package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
  52. package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +59 -6
  53. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
  54. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +1 -1
  55. package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +1 -1
  56. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +1 -1
  57. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
  58. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +1 -1
  59. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +1 -1
  60. package/project/.sdk/src/cmp/go/Test_go.ts +6 -8
  61. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +6 -2
  62. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +6 -2
  63. package/project/.sdk/src/cmp/java/Config_java.ts +8 -1
  64. package/project/.sdk/src/cmp/java/Test_java.ts +4 -7
  65. package/project/.sdk/src/cmp/js/Config_js.ts +9 -1
  66. package/project/.sdk/src/cmp/js/Package_js.ts +1 -1
  67. package/project/.sdk/src/cmp/js/Test_js.ts +4 -7
  68. package/project/.sdk/src/cmp/js/fragment/Config.data.fragment.js +7 -0
  69. package/project/.sdk/src/cmp/js/fragment/Config.fragment.js +8 -0
  70. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +33 -5
  71. package/project/.sdk/src/cmp/kotlin/Config_kotlin.ts +8 -1
  72. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +4 -7
  73. package/project/.sdk/src/cmp/lean/Test_lean.ts +3 -3
  74. package/project/.sdk/src/cmp/lua/Config_lua.ts +11 -2
  75. package/project/.sdk/src/cmp/lua/Package_lua.ts +26 -3
  76. package/project/.sdk/src/cmp/lua/Test_lua.ts +5 -7
  77. package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +3 -7
  78. package/project/.sdk/src/cmp/perl/Config_perl.ts +8 -60
  79. package/project/.sdk/src/cmp/perl/Package_perl.ts +1 -1
  80. package/project/.sdk/src/cmp/perl/Test_perl.ts +5 -7
  81. package/project/.sdk/src/cmp/php/Config_php.ts +11 -2
  82. package/project/.sdk/src/cmp/php/EntityTypes_php.ts +13 -2
  83. package/project/.sdk/src/cmp/php/Main_php.ts +25 -0
  84. package/project/.sdk/src/cmp/php/Package_php.ts +2 -2
  85. package/project/.sdk/src/cmp/php/Test_php.ts +5 -7
  86. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +23 -6
  87. package/project/.sdk/src/cmp/py/Config_py.ts +11 -2
  88. package/project/.sdk/src/cmp/py/Main_py.ts +17 -7
  89. package/project/.sdk/src/cmp/py/Package_py.ts +2 -2
  90. package/project/.sdk/src/cmp/py/Test_py.ts +5 -7
  91. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +23 -6
  92. package/project/.sdk/src/cmp/py-data/Main_py-data.ts +14 -19
  93. package/project/.sdk/src/cmp/rb/Config_rb.ts +7 -1
  94. package/project/.sdk/src/cmp/rb/Package_rb.ts +3 -3
  95. package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +1 -1
  96. package/project/.sdk/src/cmp/rb/Test_rb.ts +5 -7
  97. package/project/.sdk/src/cmp/rust/Config_rust.ts +5 -2
  98. package/project/.sdk/src/cmp/rust/Test_rust.ts +5 -7
  99. package/project/.sdk/src/cmp/scala/Test_scala.ts +5 -2
  100. package/project/.sdk/src/cmp/seneca-provider/Gitignore_seneca-provider.ts +161 -0
  101. package/project/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +20 -11
  102. package/project/.sdk/src/cmp/swift/Config_swift.ts +8 -54
  103. package/project/.sdk/src/cmp/swift/Package_swift.ts +52 -10
  104. package/project/.sdk/src/cmp/swift/Test_swift.ts +5 -7
  105. package/project/.sdk/src/cmp/ts/Config_ts.ts +9 -1
  106. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +5 -2
  107. package/project/.sdk/src/cmp/ts/Entity_ts.ts +8 -2
  108. package/project/.sdk/src/cmp/ts/Package_ts.ts +1 -1
  109. package/project/.sdk/src/cmp/ts/Test_ts.ts +8 -7
  110. package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +7 -0
  111. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +8 -0
  112. package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +1 -1
  113. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -4
  114. package/project/.sdk/src/cmp/zig/Test_zig.ts +3 -7
  115. package/project/.sdk/tm/c/Makefile +6 -1
  116. package/project/.sdk/tm/c/utility/make_options.c +12 -1
  117. package/project/.sdk/tm/c/utility/make_point.c +64 -3
  118. package/project/.sdk/tm/clojure/src/sdk/core.clj +49 -14
  119. package/project/.sdk/tm/cpp/utility/pipeline.hpp +64 -4
  120. package/project/.sdk/tm/csharp/feature/TestFeature.cs +36 -2
  121. package/project/.sdk/tm/csharp/utility/Fetcher.cs +23 -5
  122. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +13 -0
  123. package/project/.sdk/tm/csharp/utility/MakePoint.cs +65 -2
  124. package/project/.sdk/tm/dart/lib/feature/test/TestFeature.dart +34 -4
  125. package/project/.sdk/tm/dart/lib/utility/FetcherUtility.dart +9 -0
  126. package/project/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +17 -0
  127. package/project/.sdk/tm/dart/lib/utility/MakePointUtility.dart +48 -2
  128. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +109 -13
  129. package/project/.sdk/tm/elixir/test/feature_test.exs +19 -0
  130. package/project/.sdk/tm/elixir/test/primary_utility_test.exs +72 -0
  131. package/project/.sdk/tm/go/feature/test_feature.go +34 -2
  132. package/project/.sdk/tm/go/test/primary_utility_test.go +42 -20
  133. package/project/.sdk/tm/go/test/runner_test.go +1 -1
  134. package/project/.sdk/tm/go/utility/fetcher.go +14 -0
  135. package/project/.sdk/tm/go/utility/make_options.go +31 -4
  136. package/project/.sdk/tm/go/utility/make_point.go +66 -2
  137. package/project/.sdk/tm/java/feature/TestFeature.java +42 -2
  138. package/project/.sdk/tm/java/utility/Fetcher.java +11 -1
  139. package/project/.sdk/tm/java/utility/MakeOptions.java +11 -0
  140. package/project/.sdk/tm/java/utility/MakePoint.java +61 -2
  141. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +22 -3
  142. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +20 -2
  143. package/project/.sdk/tm/js/src/utility/MakePointUtility.js +72 -2
  144. package/project/.sdk/tm/kotlin/feature/TestFeature.kt +31 -2
  145. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +10 -1
  146. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +11 -0
  147. package/project/.sdk/tm/kotlin/utility/MakePoint.kt +58 -2
  148. package/project/.sdk/tm/lean/src/SdkUtility.lean +28 -0
  149. package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +13 -2
  150. package/project/.sdk/tm/lua/utility/make_options.lua +44 -0
  151. package/project/.sdk/tm/lua/utility/make_point.lua +65 -2
  152. package/project/.sdk/tm/ocaml/sdk_runtime.ml +40 -2
  153. package/project/.sdk/tm/perl/utility/fetcher.pm +10 -1
  154. package/project/.sdk/tm/perl/utility/make_options.pm +36 -0
  155. package/project/.sdk/tm/perl/utility/make_point.pm +55 -2
  156. package/project/.sdk/tm/php/feature/TestFeature.php +30 -1
  157. package/project/.sdk/tm/php/test/PipelineTest.php +20 -0
  158. package/project/.sdk/tm/php/utility/Fetcher.php +12 -1
  159. package/project/.sdk/tm/php/utility/MakeOptions.php +58 -0
  160. package/project/.sdk/tm/php/utility/MakePoint.php +49 -1
  161. package/project/.sdk/tm/py/pkg/utility/fetcher.py +13 -1
  162. package/project/.sdk/tm/py/pkg/utility/make_options.py +23 -0
  163. package/project/.sdk/tm/py/pkg/utility/make_point.py +56 -2
  164. package/project/.sdk/tm/rb/utility/make_options.rb +18 -0
  165. package/project/.sdk/tm/rb/utility/make_point.rb +42 -2
  166. package/project/.sdk/tm/rust/tests/common/mod.rs +1 -1
  167. package/project/.sdk/tm/rust/tests/feature_test.rs +27 -0
  168. package/project/.sdk/tm/rust/utility/fetcher.rs +8 -0
  169. package/project/.sdk/tm/rust/utility/make_options.rs +15 -0
  170. package/project/.sdk/tm/rust/utility/make_point.rs +69 -2
  171. package/project/.sdk/tm/scala/feature/TestFeature.scala +36 -1
  172. package/project/.sdk/tm/scala/utility/Make.scala +57 -3
  173. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +29 -1
  174. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +24 -1
  175. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +51 -2
  176. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +12 -0
  177. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +22 -3
  178. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +20 -2
  179. package/project/.sdk/tm/ts/src/utility/MakePointUtility.ts +72 -2
  180. package/project/.sdk/tm/ts/test/utility/Corpus.test.ts +85 -0
  181. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +10 -17
  182. package/project/.sdk/tm/zig/core/utility.zig +66 -3
  183. package/project/sdkgen-package.json +1 -2
  184. package/src/cmp/AgentGuideTop.ts +18 -0
  185. package/src/cmp/ExternalTarget.ts +1 -1
  186. package/src/cmp/Readme.ts +2 -0
  187. package/src/cmp/ReadmeStation.ts +69 -0
  188. package/src/helpers/naming.ts +172 -5
  189. package/src/helpers/opShape.ts +85 -0
  190. package/src/helpers/packageMeta.ts +59 -20
  191. package/src/sdkgen.ts +70 -20
  192. package/src/testkit.ts +863 -0
  193. package/src/utility.ts +17 -2
  194. package/testkit.d.ts +3 -0
  195. package/testkit.js +12 -0
  196. package/project/.sdk/model/target/haskell.aontu +0 -72
  197. package/project/.sdk/src/cmp/haskell/Config_haskell.ts +0 -98
  198. package/project/.sdk/src/cmp/haskell/Entity_haskell.ts +0 -13
  199. package/project/.sdk/src/cmp/haskell/Gitignore_haskell.ts +0 -27
  200. package/project/.sdk/src/cmp/haskell/Main_haskell.ts +0 -123
  201. package/project/.sdk/src/cmp/haskell/Package_haskell.ts +0 -60
  202. package/project/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +0 -186
  203. package/project/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +0 -135
  204. package/project/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +0 -48
  205. package/project/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +0 -168
  206. package/project/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +0 -51
  207. package/project/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +0 -67
  208. package/project/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +0 -162
  209. package/project/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +0 -74
  210. package/project/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +0 -241
  211. package/project/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +0 -408
  212. package/project/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +0 -31
  213. package/project/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +0 -104
  214. package/project/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +0 -80
  215. package/project/.sdk/src/cmp/haskell/Test_haskell.ts +0 -300
  216. package/project/.sdk/src/cmp/haskell/tsconfig.json +0 -15
  217. package/project/.sdk/src/cmp/haskell/utility_haskell.ts +0 -166
  218. package/project/.sdk/tm/haskell/LICENSE +0 -21
  219. package/project/.sdk/tm/haskell/Makefile +0 -22
  220. package/project/.sdk/tm/haskell/VERSION +0 -1
  221. package/project/.sdk/tm/haskell/src/SdkFeatures.hs +0 -1440
  222. package/project/.sdk/tm/haskell/src/SdkHelpers.hs +0 -337
  223. package/project/.sdk/tm/haskell/src/SdkJson.hs +0 -111
  224. package/project/.sdk/tm/haskell/src/SdkRuntime.hs +0 -1219
  225. package/project/.sdk/tm/haskell/src/SdkTypes.hs +0 -195
  226. package/project/.sdk/tm/haskell/src/VoxgigStruct.hs +0 -2299
  227. package/project/.sdk/tm/haskell/src/Vregex.hs +0 -237
  228. package/project/.sdk/tm/haskell/src/feature/README.md +0 -5
  229. package/project/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
  230. package/project/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
  231. package/project/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
  232. package/project/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
  233. package/project/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
  234. package/project/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
  235. package/project/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
  236. package/project/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
  237. package/project/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
  238. package/project/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
  239. package/project/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
  240. package/project/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
  241. package/project/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
  242. package/project/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
  243. package/project/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
  244. package/project/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
  245. package/project/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
  246. package/project/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
  247. package/project/.sdk/tm/haskell/test/Harness.hs +0 -281
  248. package/project/.sdk/tm/haskell/test/Runner.hs +0 -47
  249. package/project/.sdk/tm/haskell/test/StructCorpus.hs +0 -449
  250. package/project/.sdk/tm/haskell/test/TCustomUtility.hs +0 -38
  251. package/project/.sdk/tm/haskell/test/TFeature.hs +0 -794
  252. package/project/.sdk/tm/haskell/test/TNetsim.hs +0 -50
  253. package/project/.sdk/tm/haskell/test/TPipeline.hs +0 -334
  254. package/project/.sdk/tm/haskell/test/TPrimaryUtility.hs +0 -386
  255. package/project/.sdk/tm/haskell/test/Testutil.hs +0 -59
@@ -40,6 +40,27 @@ function langLabel(target: string): string {
40
40
  return LANG_LABEL[target] || target
41
41
  }
42
42
 
43
+
44
+ // THE NAME WHOSE LANGUAGE RULES APPLY.
45
+ //
46
+ // A target name does two unrelated jobs in this file, and conflating them is
47
+ // the defect this exists to end. `go~go2` installs a SECOND Go SDK: its
48
+ // CONFIG lives under `main.kit.target.go2` (its own module path, its own
49
+ // registry state), but it is still Go — the same go.mod shape, the same
50
+ // `go get` install line, the same "Go" label.
51
+ //
52
+ // So: look config up by the target's OWN name, and select behaviour by this.
53
+ // `origname` is stamped at add time precisely for aliased installs and is
54
+ // empty when a target was installed under its own name, which makes the
55
+ // unaliased case identical to what it was.
56
+ //
57
+ // Ecosystem keys ('npm', 'gem', 'composer') pass through untouched: there is
58
+ // no target node under those names, so they answer for themselves.
59
+ function originName(model: any, target: string): string {
60
+ const orig = model?.main?.[KIT]?.target?.[target]?.origname
61
+ return (null != orig && '' !== orig) ? String(orig) : target
62
+ }
63
+
43
64
  // Git host, org/repo path, and the canonical repo URLs.
44
65
  //
45
66
  // `<origin>/<slug>-sdk` is a DERIVATION, not a law. A project whose repo is
@@ -185,7 +206,10 @@ function goPackageIdent(model: any, target: string): string {
185
206
  // The legacy boolean `registry.active: true` is honoured as a back-compat
186
207
  // alias for state === 'active'.
187
208
  function registryState(model: any, target: string): 'tag' | 'pending' | 'active' | 'inactive' {
188
- if ('go' === target || 'go-cli' === target || 'go-mcp' === target) return 'tag'
209
+ // Tag-only is a property of the Go toolchain, not of one target name, so
210
+ // an aliased `go~go2` must be tag-only too.
211
+ const eco = originName(model, target)
212
+ if ('go' === eco || 'go-cli' === eco || 'go-mcp' === eco) return 'tag'
189
213
  const reg = model?.main?.[KIT]?.target?.[target]?.publish?.registry
190
214
  if (null == reg || '' === (reg.name || '')) return 'tag'
191
215
  if (true === reg.active) return 'active' // legacy alias
@@ -215,13 +239,16 @@ function registryName(model: any, target: string): string {
215
239
  // pointer carrying the releases URL.
216
240
  function vendorCommand(model: any, target: string): string {
217
241
  const { releasesUrl } = repoInfo(model)
218
- switch (target) {
242
+ switch (originName(model, target)) {
243
+ // `target`, not the literal — the case says WHICH command, the argument
244
+ // says whose module. Writing the literal here reintroduces the same bug
245
+ // the switch above exists to fix, one level down, which is exactly what
246
+ // the first cut of this change did.
219
247
  case 'go':
220
- return `go get ${packageName(model, 'go')}@latest`
221
248
  case 'go-mcp':
222
- return `go get ${packageName(model, 'go-mcp')}@latest`
249
+ return `go get ${packageName(model, target)}@latest`
223
250
  case 'go-cli':
224
- return `go install ${packageName(model, 'go-cli')}/cmd/${model.name}@latest`
251
+ return `go install ${packageName(model, target)}/cmd/${model.name}@latest`
225
252
  default: {
226
253
  const reg = registryName(model, target)
227
254
  return `not yet on ${reg || 'the registry'} — install from the git tag: ${releasesUrl}`
@@ -266,7 +293,12 @@ function packageName(model: any, eco: string): string {
266
293
  return String(declared)
267
294
  }
268
295
 
269
- switch (eco) {
296
+ // The lookup above is keyed by the target's OWN name, so an alias reads its
297
+ // own declared package. The switch below is about FORM — npm scoping,
298
+ // slash-separated composer names — which belongs to the language, so it
299
+ // follows the origin. Passing `ts2` here without this would miss every case
300
+ // and fall to `default`, silently publishing under a non-npm name.
301
+ switch (originName(model, eco)) {
270
302
  case 'npm':
271
303
  case 'ts':
272
304
  return npmScoped
@@ -282,12 +314,13 @@ function packageName(model: any, eco: string): string {
282
314
  case 'composer':
283
315
  case 'php':
284
316
  return `${origin}/${base}`
317
+ // `eco`, not the literal: the case is chosen by the LANGUAGE but the
318
+ // module belongs to the target that asked. `packageName(model, 'go2')`
319
+ // returning go's module was the same conflation one level down.
285
320
  case 'go':
286
- return goModule(model, 'go')
287
321
  case 'go-cli':
288
- return goModule(model, 'go-cli')
289
322
  case 'go-mcp':
290
- return goModule(model, 'go-mcp')
323
+ return goModule(model, eco)
291
324
  // The notebook/analyst package layered on `py`. Distinct PyPI name so it
292
325
  // can version and publish independently of the SDK it wraps.
293
326
  case 'py-data':
@@ -306,25 +339,29 @@ function installCommand(model: any, target: string): string {
306
339
  if (!isPublished(model, target)) {
307
340
  return vendorCommand(model, target)
308
341
  }
309
- switch (target) {
342
+ // WHICH package manager is the language's business, so the switch follows
343
+ // the origin; WHICH package name is this target's own, so every arm passes
344
+ // `target` rather than a hardcoded ecosystem key. Before, an aliased
345
+ // `ts~ts2` matched no case and returned '' — a README with an empty install
346
+ // line — and even had it matched, `packageName(model, 'npm')` would have
347
+ // printed the ORIGIN's package.
348
+ switch (originName(model, target)) {
310
349
  case 'ts':
311
- return `npm install ${packageName(model, 'npm')}`
312
350
  case 'js':
313
- return `npm install ${packageName(model, 'js')}`
351
+ return `npm install ${packageName(model, target)}`
314
352
  case 'py':
315
- return `pip install ${packageName(model, 'pypi')}`
316
353
  case 'py-data':
317
- return `pip install ${packageName(model, 'py-data')}`
354
+ return `pip install ${packageName(model, target)}`
318
355
  case 'php':
319
- return `composer require ${packageName(model, 'composer')}`
356
+ return `composer require ${packageName(model, target)}`
320
357
  case 'rb':
321
- return `gem install ${packageName(model, 'gem')}`
358
+ return `gem install ${packageName(model, target)}`
322
359
  case 'lua':
323
- return `luarocks install ${packageName(model, 'luarocks')}`
360
+ return `luarocks install ${packageName(model, target)}`
324
361
  case 'go':
325
- return `go get ${packageName(model, 'go')}`
362
+ return `go get ${packageName(model, target)}`
326
363
  case 'go-cli':
327
- return `go install ${packageName(model, 'go-cli')}/cmd/${model.name}@latest`
364
+ return `go install ${packageName(model, target)}/cmd/${model.name}@latest`
328
365
  default:
329
366
  return ''
330
367
  }
@@ -333,7 +370,8 @@ function installCommand(model: any, target: string): string {
333
370
  // The standard one-line package description (with the generic non-affiliation
334
371
  // statement inline) used in every manifest.
335
372
  function pkgDescription(model: any, target: string): string {
336
- return `Unofficial generated ${langLabel(target)} SDK for the ${apiName(model)} public API.` +
373
+ return `Unofficial generated ${langLabel(originName(model, target))} SDK` +
374
+ ` for the ${apiName(model)} public API.` +
337
375
  ` Not affiliated with or endorsed by the upstream API provider.`
338
376
  }
339
377
 
@@ -437,6 +475,7 @@ export {
437
475
  GENERATOR_URL,
438
476
  LANG_LABEL,
439
477
  langLabel,
478
+ originName,
440
479
  repoInfo,
441
480
  apiName,
442
481
  packageName,
package/src/sdkgen.ts CHANGED
@@ -10,7 +10,6 @@ import { Aontu } from 'aontu'
10
10
 
11
11
  import {
12
12
  showChanges,
13
- getdlog,
14
13
  } from '@voxgig/util'
15
14
 
16
15
  import type {
@@ -60,7 +59,7 @@ import { collectDeps } from './helpers/collectDeps'
60
59
  import type { DepEntry } from './helpers/collectDeps'
61
60
  import { canonToType, canonToDtype, canonKey } from './helpers/canonType'
62
61
  import { OP_SUFFIX, opTypeName, opParams, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityOps, entityPrimaryOp, pickExampleEntity, entityClassName, entityTypeCollisions, warnEntityTypeCollisions, deriveEntityNames, entityCollection } from './helpers/opShape'
63
- import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, jsProp, jsOptProp, jsKey } from './helpers/naming'
62
+ import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, phpSafeTypeName, isTsReservedType, tsSafeTypeName, jsProp, jsOptProp, jsKey } from './helpers/naming'
64
63
  import { serverVariables, hasServerVariables } from './helpers/serverVars'
65
64
  import { primaryOpCall, idLiteral, matchArg, dataArg, litFor } from './helpers/opExample'
66
65
  import type { ExampleLang } from './helpers/opExample'
@@ -108,6 +107,7 @@ import {
108
107
  repoInfo,
109
108
  apiName,
110
109
  langLabel,
110
+ originName,
111
111
  PUBLISHER,
112
112
  PUBLISHER_URL,
113
113
  SECURITY_EMAIL,
@@ -176,7 +176,38 @@ type SdkGenOptions = {
176
176
  const { Jostraca } = JostracaModule
177
177
 
178
178
 
179
- const dlog = getdlog('sdkgen', __filename)
179
+ // A BROKEN PROJECT MODEL IS THE USER'S FILE, NOT A CRASH.
180
+ //
181
+ // One constructor for both routes out of `resolveModel` — the throw aontu
182
+ // actually takes, and the `errs` array it documents but never fills — because
183
+ // two spellings of the same error is how this repo keeps reintroducing the
184
+ // same defect.
185
+ //
186
+ // aontu's own diagnostic is the valuable part and is passed through
187
+ // UNTOUCHED: it carries the source excerpt, a caret under the offending
188
+ // token, and an explanation. What it lacks is any statement of WHOSE file
189
+ // this is, so the path leads. Wrapping it in an SdkGenError is what makes the
190
+ // CLI print it as a message instead of dumping the error object and a stack
191
+ // trace through sdkgen's internals — `handleError` reserves clean output for
192
+ // that name.
193
+ function modelError(path: string, cause: any, rooterrs: any[]): any {
194
+ const detail = String(cause?.msg ?? cause?.message ?? cause ?? '').trim()
195
+
196
+ const err: any = new SdkGenError(
197
+ 'Model Error: ' + path + '\n' + detail)
198
+
199
+ err.cause$ = [cause]
200
+ err.rooterrs$ = rooterrs
201
+
202
+ // A syntax error is the user's typo, and there is nothing for them to do
203
+ // with a stack. `why` lives on the structured entries rather than the
204
+ // thrown wrapper, so it is read from the first of them.
205
+ if ('syntax' === (cause?.why ?? rooterrs?.[0]?.why)) {
206
+ err.uxmsg$ = true
207
+ }
208
+
209
+ return err
210
+ }
180
211
 
181
212
 
182
213
  function SdkGen(opts: SdkGenOptions) {
@@ -393,13 +424,6 @@ function SdkGen(opts: SdkGenOptions) {
393
424
  showChanges(jopts.log, 'generate-result', eres, Path.dirname(process.cwd()))
394
425
  }
395
426
 
396
- const dlogs = dlog.log()
397
- if (0 < dlogs.length) {
398
- for (let dlogentry of dlogs) {
399
- log.debug({ point: 'generate-warning', dlogentry, note: String(dlogentry) })
400
- }
401
- }
402
-
403
427
  log.info({ point: 'generate-end' })
404
428
 
405
429
  return { ok: true, name: 'sdkgen' }
@@ -482,19 +506,39 @@ function SdkGen(opts: SdkGenOptions) {
482
506
  const aopts = { path, errs }
483
507
  const src = fs.readFileSync(path, 'utf8')
484
508
 
485
- const model = aontu.generate(src, aopts)
486
-
487
- if (0 < errs.length) {
488
- const serr = errs[0]
489
- const err: any = new SdkGenError('Model Error: ' + serr.msg)
490
- err.cause$ = [serr]
509
+ // AONTU THROWS; IT DOES NOT FILL `errs`.
510
+ //
511
+ // The `errs` array is handed to `generate` and stays empty on every
512
+ // failure syntax, unresolved path and unify conflict alike all raise an
513
+ // AontuError instead (verified against 0.52 by running each). So the
514
+ // `0 < errs.length` branch this used to have could never fire, and every
515
+ // broken project model reached the CLI as a bare AontuError: `handleError`
516
+ // prints the raw object for anything that is not an SdkGenError, so the
517
+ // user got aontu's diagnostic followed by a stack trace into sdkgen's
518
+ // `dist/` and a dump of the error's own fields. It read as an sdkgen
519
+ // crash rather than a problem in their own file.
520
+ //
521
+ // The array is still passed, and still checked below, because that is
522
+ // aontu's documented option and a later version may start using it. Both
523
+ // routes build the error the same way, so they cannot drift.
524
+ let model: any
491
525
 
492
- if ('syntax' === serr.why) {
493
- err.uxmsg$ = true
526
+ try {
527
+ model = aontu.generate(src, aopts)
528
+ }
529
+ catch (aerr: any) {
530
+ if (true !== aerr?.aontu) {
531
+ throw aerr
494
532
  }
495
533
 
496
- err.rooterrs$ = errs
497
- throw err
534
+ // The structured errors are reachable after all — the thrown error
535
+ // carries the accessor the empty array was standing in for.
536
+ throw modelError(path, aerr,
537
+ 'function' === typeof aerr.errs ? aerr.errs() : [])
538
+ }
539
+
540
+ if (0 < errs.length) {
541
+ throw modelError(path, errs[0], errs)
498
542
  }
499
543
 
500
544
  model.const = { name: model.name }
@@ -1039,9 +1083,14 @@ export {
1039
1083
  phpEntityAccessor,
1040
1084
  entityCacheField,
1041
1085
  isRbCoreConstant,
1086
+ isRbSdkConstant,
1042
1087
  rbSafeTypeName,
1043
1088
  isSwiftSdkType,
1044
1089
  swiftSafeTypeName,
1090
+ isPhpReservedType,
1091
+ phpSafeTypeName,
1092
+ isTsReservedType,
1093
+ tsSafeTypeName,
1045
1094
  serverVariables,
1046
1095
  hasServerVariables,
1047
1096
  liveStrict,
@@ -1090,6 +1139,7 @@ export {
1090
1139
  repoInfo,
1091
1140
  apiName,
1092
1141
  langLabel,
1142
+ originName,
1093
1143
  PUBLISHER,
1094
1144
  PUBLISHER_URL,
1095
1145
  SECURITY_EMAIL,