@voxgig/sdkgen 3.5.1 → 3.6.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 (171) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ExternalTarget.js +1 -1
  3. package/dist/cmp/ExternalTarget.js.map +1 -1
  4. package/dist/helpers/naming.d.ts +4 -1
  5. package/dist/helpers/naming.js +119 -5
  6. package/dist/helpers/naming.js.map +1 -1
  7. package/dist/helpers/opShape.js +72 -0
  8. package/dist/helpers/opShape.js.map +1 -1
  9. package/dist/helpers/packageMeta.d.ts +2 -1
  10. package/dist/helpers/packageMeta.js +57 -20
  11. package/dist/helpers/packageMeta.js.map +1 -1
  12. package/dist/sdkgen.d.ts +3 -3
  13. package/dist/sdkgen.js +61 -18
  14. package/dist/sdkgen.js.map +1 -1
  15. package/dist/testkit.d.ts +39 -0
  16. package/dist/testkit.js +663 -0
  17. package/dist/testkit.js.map +1 -0
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +32 -8
  20. package/project/.sdk/src/cmp/c/Test_c.ts +5 -7
  21. package/project/.sdk/src/cmp/clojure/Test_clojure.ts +3 -7
  22. package/project/.sdk/src/cmp/cpp/Test_cpp.ts +4 -7
  23. package/project/.sdk/src/cmp/csharp/Package_csharp.ts +1 -1
  24. package/project/.sdk/src/cmp/csharp/Test_csharp.ts +5 -7
  25. package/project/.sdk/src/cmp/dart/Test_dart.ts +3 -4
  26. package/project/.sdk/src/cmp/elixir/Package_elixir.ts +1 -1
  27. package/project/.sdk/src/cmp/elixir/Test_elixir.ts +5 -6
  28. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +1 -1
  29. package/project/.sdk/src/cmp/go/Entity_go.ts +1 -1
  30. package/project/.sdk/src/cmp/go/Gitignore_go.ts +6 -0
  31. package/project/.sdk/src/cmp/go/Main_go.ts +2 -2
  32. package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
  33. package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +59 -6
  34. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
  35. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +1 -1
  36. package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +1 -1
  37. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +1 -1
  38. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
  39. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +1 -1
  40. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +1 -1
  41. package/project/.sdk/src/cmp/go/Test_go.ts +6 -8
  42. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +6 -2
  43. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +6 -2
  44. package/project/.sdk/src/cmp/java/Test_java.ts +4 -7
  45. package/project/.sdk/src/cmp/js/Package_js.ts +1 -1
  46. package/project/.sdk/src/cmp/js/Test_js.ts +4 -7
  47. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +4 -7
  48. package/project/.sdk/src/cmp/lean/Test_lean.ts +3 -3
  49. package/project/.sdk/src/cmp/lua/Package_lua.ts +2 -2
  50. package/project/.sdk/src/cmp/lua/Test_lua.ts +5 -7
  51. package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +3 -7
  52. package/project/.sdk/src/cmp/perl/Package_perl.ts +1 -1
  53. package/project/.sdk/src/cmp/perl/Test_perl.ts +5 -7
  54. package/project/.sdk/src/cmp/php/EntityTypes_php.ts +13 -2
  55. package/project/.sdk/src/cmp/php/Package_php.ts +2 -2
  56. package/project/.sdk/src/cmp/php/Test_php.ts +5 -7
  57. package/project/.sdk/src/cmp/py/Package_py.ts +2 -2
  58. package/project/.sdk/src/cmp/py/Test_py.ts +5 -7
  59. package/project/.sdk/src/cmp/py-data/Main_py-data.ts +14 -19
  60. package/project/.sdk/src/cmp/rb/Package_rb.ts +3 -3
  61. package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +1 -1
  62. package/project/.sdk/src/cmp/rb/Test_rb.ts +5 -7
  63. package/project/.sdk/src/cmp/rust/Test_rust.ts +5 -7
  64. package/project/.sdk/src/cmp/scala/Test_scala.ts +5 -2
  65. package/project/.sdk/src/cmp/seneca-provider/Gitignore_seneca-provider.ts +161 -0
  66. package/project/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +20 -11
  67. package/project/.sdk/src/cmp/swift/Test_swift.ts +5 -7
  68. package/project/.sdk/src/cmp/ts/Package_ts.ts +1 -1
  69. package/project/.sdk/src/cmp/ts/Test_ts.ts +8 -7
  70. package/project/.sdk/src/cmp/zig/Test_zig.ts +3 -7
  71. package/project/.sdk/tm/c/utility/make_point.c +64 -3
  72. package/project/.sdk/tm/clojure/src/sdk/core.clj +49 -14
  73. package/project/.sdk/tm/cpp/utility/pipeline.hpp +55 -3
  74. package/project/.sdk/tm/csharp/feature/TestFeature.cs +36 -2
  75. package/project/.sdk/tm/csharp/utility/MakePoint.cs +65 -2
  76. package/project/.sdk/tm/dart/lib/feature/test/TestFeature.dart +34 -4
  77. package/project/.sdk/tm/dart/lib/utility/MakePointUtility.dart +48 -2
  78. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +70 -10
  79. package/project/.sdk/tm/go/feature/test_feature.go +34 -2
  80. package/project/.sdk/tm/go/utility/make_point.go +66 -2
  81. package/project/.sdk/tm/java/feature/TestFeature.java +42 -2
  82. package/project/.sdk/tm/java/utility/MakePoint.java +61 -2
  83. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +22 -3
  84. package/project/.sdk/tm/js/src/utility/MakePointUtility.js +72 -2
  85. package/project/.sdk/tm/kotlin/feature/TestFeature.kt +31 -2
  86. package/project/.sdk/tm/kotlin/utility/MakePoint.kt +58 -2
  87. package/project/.sdk/tm/lean/src/SdkUtility.lean +28 -0
  88. package/project/.sdk/tm/lua/utility/make_point.lua +65 -2
  89. package/project/.sdk/tm/ocaml/sdk_runtime.ml +40 -2
  90. package/project/.sdk/tm/perl/utility/make_point.pm +55 -2
  91. package/project/.sdk/tm/php/feature/TestFeature.php +30 -1
  92. package/project/.sdk/tm/php/utility/MakePoint.php +49 -1
  93. package/project/.sdk/tm/py/pkg/utility/make_point.py +56 -2
  94. package/project/.sdk/tm/rb/utility/make_point.rb +42 -2
  95. package/project/.sdk/tm/rust/utility/make_point.rs +69 -2
  96. package/project/.sdk/tm/scala/feature/TestFeature.scala +36 -1
  97. package/project/.sdk/tm/scala/utility/Make.scala +57 -3
  98. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +29 -1
  99. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +51 -2
  100. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +22 -3
  101. package/project/.sdk/tm/ts/src/utility/MakePointUtility.ts +72 -2
  102. package/project/.sdk/tm/zig/core/utility.zig +66 -3
  103. package/project/sdkgen-package.json +1 -2
  104. package/src/cmp/ExternalTarget.ts +1 -1
  105. package/src/helpers/naming.ts +129 -5
  106. package/src/helpers/opShape.ts +85 -0
  107. package/src/helpers/packageMeta.ts +59 -20
  108. package/src/sdkgen.ts +68 -20
  109. package/src/testkit.ts +863 -0
  110. package/testkit.d.ts +3 -0
  111. package/testkit.js +12 -0
  112. package/project/.sdk/model/target/haskell.aontu +0 -72
  113. package/project/.sdk/src/cmp/haskell/Config_haskell.ts +0 -98
  114. package/project/.sdk/src/cmp/haskell/Entity_haskell.ts +0 -13
  115. package/project/.sdk/src/cmp/haskell/Gitignore_haskell.ts +0 -27
  116. package/project/.sdk/src/cmp/haskell/Main_haskell.ts +0 -123
  117. package/project/.sdk/src/cmp/haskell/Package_haskell.ts +0 -60
  118. package/project/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +0 -186
  119. package/project/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +0 -135
  120. package/project/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +0 -48
  121. package/project/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +0 -168
  122. package/project/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +0 -51
  123. package/project/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +0 -67
  124. package/project/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +0 -162
  125. package/project/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +0 -74
  126. package/project/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +0 -241
  127. package/project/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +0 -408
  128. package/project/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +0 -31
  129. package/project/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +0 -104
  130. package/project/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +0 -80
  131. package/project/.sdk/src/cmp/haskell/Test_haskell.ts +0 -300
  132. package/project/.sdk/src/cmp/haskell/tsconfig.json +0 -15
  133. package/project/.sdk/src/cmp/haskell/utility_haskell.ts +0 -166
  134. package/project/.sdk/tm/haskell/LICENSE +0 -21
  135. package/project/.sdk/tm/haskell/Makefile +0 -22
  136. package/project/.sdk/tm/haskell/VERSION +0 -1
  137. package/project/.sdk/tm/haskell/src/SdkFeatures.hs +0 -1440
  138. package/project/.sdk/tm/haskell/src/SdkHelpers.hs +0 -337
  139. package/project/.sdk/tm/haskell/src/SdkJson.hs +0 -111
  140. package/project/.sdk/tm/haskell/src/SdkRuntime.hs +0 -1219
  141. package/project/.sdk/tm/haskell/src/SdkTypes.hs +0 -195
  142. package/project/.sdk/tm/haskell/src/VoxgigStruct.hs +0 -2299
  143. package/project/.sdk/tm/haskell/src/Vregex.hs +0 -237
  144. package/project/.sdk/tm/haskell/src/feature/README.md +0 -5
  145. package/project/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
  146. package/project/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
  147. package/project/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
  148. package/project/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
  149. package/project/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
  150. package/project/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
  151. package/project/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
  152. package/project/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
  153. package/project/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
  154. package/project/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
  155. package/project/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
  156. package/project/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
  157. package/project/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
  158. package/project/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
  159. package/project/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
  160. package/project/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
  161. package/project/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
  162. package/project/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
  163. package/project/.sdk/tm/haskell/test/Harness.hs +0 -281
  164. package/project/.sdk/tm/haskell/test/Runner.hs +0 -47
  165. package/project/.sdk/tm/haskell/test/StructCorpus.hs +0 -449
  166. package/project/.sdk/tm/haskell/test/TCustomUtility.hs +0 -38
  167. package/project/.sdk/tm/haskell/test/TFeature.hs +0 -794
  168. package/project/.sdk/tm/haskell/test/TNetsim.hs +0 -50
  169. package/project/.sdk/tm/haskell/test/TPipeline.hs +0 -334
  170. package/project/.sdk/tm/haskell/test/TPrimaryUtility.hs +0 -386
  171. package/project/.sdk/tm/haskell/test/Testutil.hs +0 -59
package/package.json CHANGED
@@ -1,12 +1,33 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen",
3
- "version": "3.5.1",
3
+ "version": "3.6.0",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "engines": {
7
7
  "node": ">=24"
8
8
  },
9
9
  "types": "dist/sdkgen.d.ts",
10
+ "_no_exports_comment": [
11
+ "THERE IS DELIBERATELY NO `exports` MAP, and adding one is not a tidy-up.",
12
+ "",
13
+ "`@voxgig/sdkgen/testkit` is served by the stub `testkit.js` beside this",
14
+ "file, resolved by ordinary CommonJS probing — the way subpath entry",
15
+ "points worked before `exports` existed.",
16
+ "",
17
+ "The obvious alternative, an `exports` map naming './testkit', REPLACES",
18
+ "the deep-import freedom a package has without one. Consumers depend on",
19
+ "that freedom in places nothing here would notice: every generated model",
20
+ "file includes '@voxgig/sdkgen/model/sdkgen.aontu', and the scaffold is",
21
+ "reached as '@voxgig/sdkgen/project/<lang>'.",
22
+ "",
23
+ "A './*' catch-all looks like it restores that, and does not: exports",
24
+ "resolution never falls back to CommonJS extension probing, so",
25
+ "require('@voxgig/sdkgen/dist/helpers/manifest') maps to an",
26
+ "extensionless path that does not exist and fails with MODULE_NOT_FOUND.",
27
+ "An array of probes ('./*', './*.js', ...) does not fix it either —",
28
+ "measured, not assumed. test/packaging.test.ts resolves the real",
29
+ "subpaths through a real node_modules to keep this honest."
30
+ ],
10
31
  "description": "Voxgig SDK Generator.",
11
32
  "homepage": "https://github.com/voxgig/voxgig-sdkgen",
12
33
  "keywords": [
@@ -26,7 +47,7 @@
26
47
  "test-some": "node --enable-source-maps --test-name-pattern=\"$npm_config_pattern\" --test dist-test/**/*.test.js",
27
48
  "golden": "npm run build && SDKGEN_GOLDEN_UPDATE=1 node --test dist-test/characterize.test.js",
28
49
  "watch": "tsc --build src test -w",
29
- "build": "tsc --build src test && npm run check-scaffold && npm run stage-scaffold",
50
+ "build": "tsc --build src test && npm run check-scaffold && npm run check-fixture && npm run stage-scaffold",
30
51
  "clean": "rm -rf dist dist-test node_modules yarn.lock package-lock.json",
31
52
  "reset": "npm run clean && npm i && npm run build && npm test",
32
53
  "embed-version": "node build/version.js",
@@ -40,6 +61,7 @@
40
61
  "repo-release": "npm run repo-publish && npm run repo-tag",
41
62
  "repo-release-dry": "npm run repo-publish-quick-dry && npm run repo-tag-dry",
42
63
  "check-scaffold": "tsc -p tsconfig.scaffold.json",
64
+ "check-fixture": "tsc -p tsconfig.fixture.json",
43
65
  "stage-scaffold": "node build/scaffold-stage.js && tsc -p tsconfig.scaffold-emit.json"
44
66
  },
45
67
  "license": "MIT",
@@ -49,6 +71,8 @@
49
71
  "model",
50
72
  "src",
51
73
  "dist",
74
+ "testkit.js",
75
+ "testkit.d.ts",
52
76
  "LICENSE"
53
77
  ],
54
78
  "devDependencies": {
@@ -64,11 +88,11 @@
64
88
  "peerDependencies": {
65
89
  "@tabnas/jsonic": "0.6.0",
66
90
  "@tabnas/parser": "0.8.0",
67
- "@voxgig/apidef": ">=0",
68
- "@voxgig/struct": ">=0",
69
- "@voxgig/util": ">=0",
70
- "aontu": ">=0",
71
- "jostraca": ">=0",
72
- "shape": ">=0"
91
+ "@voxgig/apidef": ">=7.1",
92
+ "@voxgig/struct": ">=0.2",
93
+ "@voxgig/util": ">=0.5",
94
+ "aontu": ">=0.52",
95
+ "jostraca": "^0.33.1",
96
+ "shape": ">=10"
73
97
  }
74
98
  }
@@ -1,14 +1,9 @@
1
1
 
2
- import {
3
- KIT,
4
- getModelPath
5
- } from '@voxgig/apidef'
6
-
7
2
  import type {
8
3
  ModelEntity
9
4
  } from '@voxgig/apidef'
10
5
 
11
- import { cmp, each, Folder, File, Content } from '@voxgig/sdkgen'
6
+ import { cmp, each, Folder, File, Content, entityCollection } from '@voxgig/sdkgen'
12
7
 
13
8
 
14
9
  import { TestEntity } from './TestEntity_c'
@@ -39,7 +34,10 @@ int main(void) {
39
34
  `)
40
35
  })
41
36
 
42
- each(model.main[KIT].entity, (entity: ModelEntity) => {
37
+ const entity = each(entityCollection(model))
38
+ .filter((e: any) => false !== e.active)
39
+
40
+ each(entity, (entity: ModelEntity) => {
43
41
  TestEntity({ target, entity })
44
42
  TestDirect({ target, entity })
45
43
  })
@@ -1,14 +1,9 @@
1
1
 
2
- import {
3
- KIT,
4
- getModelPath
5
- } from '@voxgig/apidef'
6
-
7
2
  import type {
8
3
  ModelEntity
9
4
  } from '@voxgig/apidef'
10
5
 
11
- import { cmp, each, File, Content, Folder } from '@voxgig/sdkgen'
6
+ import { cmp, each, File, Content, Folder, entityCollection } from '@voxgig/sdkgen'
12
7
 
13
8
  import { TestEntity } from './TestEntity_clojure'
14
9
  import { TestDirect } from './TestDirect_clojure'
@@ -27,7 +22,8 @@ const Test = cmp(function Test(props: any) {
27
22
  const { model } = props.ctx$
28
23
  const { target } = props
29
24
 
30
- const entity: ModelEntity = getModelPath(model, `main.${KIT}.entity`)
25
+ const entity: ModelEntity[] = each(entityCollection(model))
26
+ .filter((e: any) => false !== e.active)
31
27
 
32
28
  Folder({ name: 'test' }, () => {
33
29
  Folder({ name: 'sdk' }, () => {
@@ -1,14 +1,9 @@
1
1
 
2
- import {
3
- KIT,
4
- getModelPath
5
- } from '@voxgig/apidef'
6
-
7
2
  import type {
8
3
  ModelEntity
9
4
  } from '@voxgig/apidef'
10
5
 
11
- import { cmp, each, Folder } from '@voxgig/sdkgen'
6
+ import { cmp, each, Folder, entityCollection } from '@voxgig/sdkgen'
12
7
 
13
8
 
14
9
  import { TestEntity } from './TestEntity_cpp'
@@ -24,7 +19,9 @@ const Test = cmp(function Test(props: any) {
24
19
  // netsim / struct corpus) ships as tm/cpp/test templates (copied verbatim).
25
20
  // Here we generate the per-entity model-driven tests into test/.
26
21
  Folder({ name: 'test' }, () => {
27
- each(model.main[KIT].entity, (entity: ModelEntity) => {
22
+ const entity = each(entityCollection(model))
23
+ .filter((e: any) => false !== e.active)
24
+ each(entity, (entity: ModelEntity) => {
28
25
  TestEntity({ target, entity })
29
26
  TestDirect({ target, entity })
30
27
  })
@@ -60,7 +60,7 @@ const Package = cmp(async function Package(props: any) {
60
60
  <Version>${packageVersion(model, target.name)}</Version>
61
61
  <PackageId>${Name}.Sdk</PackageId>
62
62
  <Authors>Voxgig</Authors>
63
- <Description>${pkgDescription(model, 'csharp')}</Description>
63
+ <Description>${pkgDescription(model, target.name)}</Description>
64
64
  <PackageLicenseExpression>MIT</PackageLicenseExpression>
65
65
  <RepositoryUrl>${repoUrl}</RepositoryUrl>
66
66
  </PropertyGroup>
@@ -1,14 +1,9 @@
1
1
 
2
- import {
3
- KIT,
4
- getModelPath
5
- } from '@voxgig/apidef'
6
-
7
2
  import type {
8
3
  ModelEntity
9
4
  } from '@voxgig/apidef'
10
5
 
11
- import { cmp, each, Folder } from '@voxgig/sdkgen'
6
+ import { cmp, each, Folder, entityCollection } from '@voxgig/sdkgen'
12
7
 
13
8
 
14
9
  import { TestEntity } from './TestEntity_csharp'
@@ -26,7 +21,10 @@ const Test = cmp(function Test(props: any) {
26
21
  // tests are generated here.
27
22
  Folder({ name: 'test' }, () => {
28
23
 
29
- each(model.main[KIT].entity, (entity: ModelEntity) => {
24
+ const entity = each(entityCollection(model))
25
+ .filter((e: any) => false !== e.active)
26
+
27
+ each(entity, (entity: ModelEntity) => {
30
28
  TestEntity({ target, entity })
31
29
  TestDirect({ target, entity })
32
30
  })
@@ -1,7 +1,5 @@
1
1
 
2
2
  import {
3
- KIT,
4
- getModelPath,
5
3
  nom,
6
4
  } from '@voxgig/apidef'
7
5
 
@@ -9,7 +7,7 @@ import type {
9
7
  ModelEntity
10
8
  } from '@voxgig/apidef'
11
9
 
12
- import { cmp, each, snakify, Folder, File, Content } from '@voxgig/sdkgen'
10
+ import { cmp, each, snakify, Folder, File, Content, entityCollection } from '@voxgig/sdkgen'
13
11
 
14
12
 
15
13
  import { TestDirect } from './TestDirect_dart'
@@ -21,7 +19,8 @@ const Test = cmp(function Test(props: any) {
21
19
  const { model } = props.ctx$
22
20
  const { target } = props
23
21
 
24
- const entity = getModelPath(model, `main.${KIT}.entity`)
22
+ const entity = each(entityCollection(model))
23
+ .filter((e: any) => false !== e.active)
25
24
 
26
25
  Folder({ name: 'test' }, () => {
27
26
 
@@ -36,7 +36,7 @@ const Package = cmp(async function Package(props: any) {
36
36
  app: :${app},
37
37
  version: "${packageVersion(model, target.name)}",
38
38
  elixir: "~> 1.14",
39
- description: ${JSON.stringify(pkgDescription(model, 'elixir'))},
39
+ description: ${JSON.stringify(pkgDescription(model, target.name))},
40
40
  elixirc_paths: elixirc_paths(Mix.env()),
41
41
  start_permanent: Mix.env() == :prod,
42
42
  deps: deps(),
@@ -1,13 +1,9 @@
1
1
 
2
- import {
3
- KIT,
4
- } from '@voxgig/apidef'
5
-
6
2
  import type {
7
3
  ModelEntity
8
4
  } from '@voxgig/apidef'
9
5
 
10
- import { cmp, each, Folder, File, Content } from '@voxgig/sdkgen'
6
+ import { cmp, each, Folder, File, Content, entityCollection } from '@voxgig/sdkgen'
11
7
 
12
8
 
13
9
  import { TestEntity } from './TestEntity_elixir'
@@ -35,7 +31,10 @@ end
35
31
  `)
36
32
  })
37
33
 
38
- each(model.main[KIT].entity, (entity: ModelEntity) => {
34
+ const entity = each(entityCollection(model))
35
+ .filter((e: any) => false !== e.active)
36
+
37
+ each(entity, (entity: ModelEntity) => {
39
38
  TestEntity({ target, entity })
40
39
  TestDirect({ target, entity })
41
40
  })
@@ -167,7 +167,7 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
167
167
 
168
168
  // This file is GENERATED, not templated, so the GOMODULE placeholder is
169
169
  // never substituted for it — the module path has to be interpolated.
170
- const gomodule = goModule(model, 'go')
170
+ const gomodule = goModule(model, target.name)
171
171
 
172
172
  // only_active:false — getModelPath DROPS active:false entries by default,
173
173
  // but the consumer scaffold (create-sdkgen Root.ts) iterates the RAW entity
@@ -21,7 +21,7 @@ const Entity = cmp(function Entity(props: any) {
21
21
 
22
22
  // Module name: concatenated lowercase
23
23
  // Go module path == repo path on GitHub (org from model.origin).
24
- const gomodule = goModule(model, 'go')
24
+ const gomodule = goModule(model, target.name)
25
25
 
26
26
  // Collision-free entity CLASS name (see entityClassName): normally
27
27
  // `<Name>Entity`, but disambiguated (e.g. `<Name>EntityClient`) when it would
@@ -21,6 +21,12 @@ const Gitignore = cmp(async function Gitignore(_props: any) {
21
21
  *.test
22
22
  *.out
23
23
 
24
+ # Readme-snippet check work dirs (TestReadmeGoSnippets). Normally removed on
25
+ # exit; a killed run leaves one behind, and committing it is how a 1132-file
26
+ # snippet package once shipped in a release.
27
+ _readmecheck-*/
28
+ readmecheck-*/
29
+
24
30
  # Coverage
25
31
  coverage.txt
26
32
  coverage.html
@@ -37,10 +37,10 @@ const Main = cmp(async function Main(props: any) {
37
37
 
38
38
  // Go module path == the repo path on GitHub (org from model.origin),
39
39
  // e.g. github.com/voxgig-sdk/<slug>-sdk. Used in go.mod and every import.
40
- const gomodule = goModule(model, 'go')
40
+ const gomodule = goModule(model, target.name)
41
41
  // The root package name must be a plain Go identifier (can't be a path),
42
42
  // so it stays a concatenated-lowercase form (e.g. voxgigdogsdk).
43
- const gopackage = goPackageIdent(model, 'go')
43
+ const gopackage = goPackageIdent(model, target.name)
44
44
 
45
45
  Package({ target })
46
46
 
@@ -23,7 +23,7 @@ const Package = cmp(async function Package(props: any) {
23
23
  // may not be named `<slug>-sdk`, and the hardcoded `go 1.20` this used to
24
24
  // emit could not compile sdkgen's own `log` feature (it imports log/slog,
25
25
  // which needs 1.21).
26
- const gomodule = goModule(model, 'go')
26
+ const gomodule = goModule(model, target.name)
27
27
 
28
28
  File({ name: 'go.mod' }, () => {
29
29
  Content(`module ${gomodule}
@@ -67,11 +67,26 @@ import (
67
67
  "testing"
68
68
  )
69
69
 
70
- // testSeed is a test-mode fixture seeded for every entity. It is spliced as
71
- // literal Go source into fragment wrappers and into the test-mode variant of
72
- // complete programs, so the offline mock transport has data to return.
70
+ // testSeed is a test-mode fixture seeded for every entity, as Go source, so
71
+ // the offline mock transport has data to return. It is NOT spliced into each
72
+ // snippet: it is written ONCE per generated package as seed.go, and snippets
73
+ // reference it by name (seedRef).
74
+ //
75
+ // Splicing it inline was O(snippets x entities). Every fragment lands in ONE
76
+ // package, so a large API multiplied one ~26 KB composite literal by every
77
+ // \`\`\`go block in the docs: gitlab reached 1132 fragments / ~625k literal
78
+ // entries in a single compilation unit, and \`compile\` grew ~15 MB per fragment
79
+ // to ~16 GB — the same superlinear-composite-literal blowup the L1 config data
80
+ // path fixed for core/config.go. One shared var is O(1) in the snippet count.
73
81
  const testSeed = \`${goSeed}\`
74
82
 
83
+ // seedRef is how a snippet names the shared fixture; seedFile declares it.
84
+ const seedRef = "readmeTestSeed"
85
+
86
+ func seedFile(pkg string) []byte {
87
+ return []byte("package " + pkg + "\\n\\nvar " + seedRef + " = " + testSeed + "\\n")
88
+ }
89
+
75
90
  // doc names one of the three docs that carry go examples, with its path
76
91
  // relative to this test file's directory (which is <repo>/go/test): the root
77
92
  // README is two levels up, the go docs are one.
@@ -109,7 +124,18 @@ func TestReadmeGoSnippets(t *testing.T) {
109
124
  {"go/REFERENCE", filepath.Join(testDir, "..", "REFERENCE.md")},
110
125
  }
111
126
 
112
- work, err := os.MkdirTemp(moduleRoot, "readmecheck-")
127
+ // The work dir has to live inside the module (the snippets import the SDK
128
+ // by module path), but it MUST stay invisible to \`go build ./...\`. The go
129
+ // tool skips directories whose name starts with "_" for wildcard matching
130
+ // while still building them by explicit path — exactly what is needed
131
+ // here, because \`defer os.RemoveAll\` does NOT run when the process is
132
+ // killed. A leftover frag package inside the module made the NEXT plain
133
+ // \`go build ./...\` compile every snippet and OOM, which is how a killed
134
+ // run poisoned later runs (and, once committed, every fresh clone).
135
+ // Sweeping first lets a repo that already carries one self-heal.
136
+ sweepStaleWorkDirs(moduleRoot)
137
+
138
+ work, err := os.MkdirTemp(moduleRoot, "_readmecheck-")
113
139
  if err != nil {
114
140
  t.Fatalf("mkdir temp: %v", err)
115
141
  }
@@ -179,6 +205,10 @@ func TestReadmeGoSnippets(t *testing.T) {
179
205
  if err := os.WriteFile(filepath.Join(runDir, "main.go"), []byte(variant), 0o644); err != nil {
180
206
  t.Fatal(err)
181
207
  }
208
+ // The rewritten ctors reference the shared fixture.
209
+ if err := os.WriteFile(filepath.Join(runDir, "seed.go"), seedFile("main"), 0o644); err != nil {
210
+ t.Fatal(err)
211
+ }
182
212
  runDirs = append(runDirs, "./"+rel+"/run"+strconv.Itoa(progCount))
183
213
  }
184
214
 
@@ -197,6 +227,10 @@ func TestReadmeGoSnippets(t *testing.T) {
197
227
  if err := os.MkdirAll(fragDir, 0o755); err != nil {
198
228
  t.Fatal(err)
199
229
  }
230
+ // One shared fixture for the whole fragment package (see testSeed).
231
+ if err := os.WriteFile(filepath.Join(fragDir, "seed.go"), seedFile("readmefrag"), 0o644); err != nil {
232
+ t.Fatal(err)
233
+ }
200
234
  fragPkg = "./" + rel + "/frag"
201
235
  }
202
236
 
@@ -305,7 +339,7 @@ func runProgs(moduleRoot string, dirs []string) string {
305
339
  // left-to-right pass with balanced-paren matching; returns the rewritten
306
340
  // source and whether any replacement was made.
307
341
  func rewriteCtorsToTest(src string) (string, bool) {
308
- repl := "sdk.TestSDK(" + testSeed + ", nil)"
342
+ repl := "sdk.TestSDK(" + seedRef + ", nil)"
309
343
  var b strings.Builder
310
344
  changed := false
311
345
  i := 0
@@ -555,7 +589,7 @@ func wrapFragment(name, block, modulePath string) string {
555
589
  b.WriteString("func " + name + "() {\\n")
556
590
  if injectClient {
557
591
  // Seeded test client so the fragment's documented calls have data.
558
- b.WriteString("\\tclient := sdk.TestSDK(" + testSeed + ", nil)\\n")
592
+ b.WriteString("\\tclient := sdk.TestSDK(" + seedRef + ", nil)\\n")
559
593
  }
560
594
  b.WriteString(block)
561
595
  b.WriteString("\\n}\\n")
@@ -664,6 +698,25 @@ func addBlankAssign(content, name string) string {
664
698
  return content[:last] + "\\t_ = " + name + "\\n" + content[last:]
665
699
  }
666
700
 
701
+ // sweepStaleWorkDirs removes work dirs abandoned by a killed run, under both
702
+ // the current "_readmecheck-" name and the legacy "readmecheck-" one that
703
+ // \`go build ./...\` still picks up.
704
+ func sweepStaleWorkDirs(moduleRoot string) {
705
+ entries, err := os.ReadDir(moduleRoot)
706
+ if err != nil {
707
+ return
708
+ }
709
+ for _, e := range entries {
710
+ if !e.IsDir() {
711
+ continue
712
+ }
713
+ if n := e.Name(); strings.HasPrefix(n, "readmecheck-") ||
714
+ strings.HasPrefix(n, "_readmecheck-") {
715
+ os.RemoveAll(filepath.Join(moduleRoot, n))
716
+ }
717
+ }
718
+ }
719
+
667
720
  func readModulePath(moduleRoot string) string {
668
721
  data, err := os.ReadFile(filepath.Join(moduleRoot, "go.mod"))
669
722
  if err != nil {
@@ -6,7 +6,7 @@ const ReadmeExplanation = cmp(function ReadmeExplanation(props: any) {
6
6
  const { target, ctx$: { model } } = props
7
7
 
8
8
  // Go module path == repo path on GitHub (org from model.origin).
9
- const gomodule = goModule(model, 'go')
9
+ const gomodule = goModule(model, target.name)
10
10
 
11
11
  Content(`### Data as maps
12
12
 
@@ -29,7 +29,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
29
29
  const { target, ctx$: { model } } = props
30
30
 
31
31
  // Go module path == repo path on GitHub (org from model.origin).
32
- const gomodule = goModule(model, 'go')
32
+ const gomodule = goModule(model, target.name)
33
33
 
34
34
  const entity = getModelPath(model, `main.${KIT}.entity`)
35
35
  // Pick an entity with a real op (prefer a read op) — never fabricate a
@@ -7,7 +7,7 @@ const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
7
7
  const { model } = ctx$
8
8
 
9
9
  // Go module path == repo path on GitHub (org from model.origin).
10
- const gomodule = packageName(model, 'go')
10
+ const gomodule = packageName(model, target.name)
11
11
  // `repo` is the directory a `git clone` of this project creates — not
12
12
  // `<slug>-sdk`, which is only the DEFAULT repo name.
13
13
  const { releasesUrl, repo } = repoInfo(model)
@@ -44,7 +44,7 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
44
44
  const resultShapeRows = resultRows.join('\n')
45
45
 
46
46
  // Go module path == repo path on GitHub (org from model.origin).
47
- const gomodule = goModule(model, 'go')
47
+ const gomodule = goModule(model, target.name)
48
48
 
49
49
  const apikeyOptionRow = isAuthActive(model)
50
50
  ? '| `"apikey"` | `string` | API key for authentication. |\n'
@@ -20,7 +20,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
20
20
 
21
21
  const entity = getModelPath(model, `main.${KIT}.entity`)
22
22
  // Go module path == repo path on GitHub (org from model.origin).
23
- const gomodule = goModule(model, 'go')
23
+ const gomodule = goModule(model, target.name)
24
24
 
25
25
  const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
26
26
 
@@ -15,7 +15,7 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
15
15
 
16
16
  const entity = getModelPath(model, `main.${KIT}.entity`)
17
17
  // Go module path == repo path on GitHub (org from model.origin).
18
- const gomodule = goModule(model, 'go')
18
+ const gomodule = goModule(model, target.name)
19
19
 
20
20
  const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
21
21
 
@@ -28,7 +28,7 @@ const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
28
28
 
29
29
  const entity = getModelPath(model, `main.${KIT}.entity`)
30
30
  // Go module path == repo path on GitHub (org from model.origin).
31
- const gomodule = goModule(model, 'go')
31
+ const gomodule = goModule(model, target.name)
32
32
 
33
33
  // Pick an entity with a real op (prefer a read op) — never fabricate a
34
34
  // `load` on an op-less entity like Cloudsmith's `Abort`.
@@ -1,14 +1,9 @@
1
1
 
2
- import {
3
- KIT,
4
- getModelPath
5
- } from '@voxgig/apidef'
6
-
7
2
  import type {
8
3
  ModelEntity
9
4
  } from '@voxgig/apidef'
10
5
 
11
- import { cmp, each, Folder, File, Content, goModule } from '@voxgig/sdkgen'
6
+ import { cmp, each, Folder, File, Content, goModule, entityCollection } from '@voxgig/sdkgen'
12
7
 
13
8
 
14
9
  import { TestEntity } from './TestEntity_go'
@@ -22,7 +17,7 @@ const Test = cmp(function Test(props: any) {
22
17
 
23
18
  // Module name: concatenated lowercase
24
19
  // Go module path == repo path on GitHub (org from model.origin).
25
- const gomodule = goModule(model, 'go')
20
+ const gomodule = goModule(model, target.name)
26
21
 
27
22
  Folder({ name: 'test' }, () => {
28
23
 
@@ -48,7 +43,10 @@ func TestExists(t *testing.T) {
48
43
  `)
49
44
  })
50
45
 
51
- each(model.main[KIT].entity, (entity: ModelEntity) => {
46
+ const entity = each(entityCollection(model))
47
+ .filter((e: any) => false !== e.active)
48
+
49
+ each(entity, (entity: ModelEntity) => {
52
50
  TestEntity({ target, entity, gomodule })
53
51
  TestDirect({ target, entity, gomodule })
54
52
  })
@@ -50,8 +50,12 @@ const Main = cmp(function Main(props: any) {
50
50
  const { model } = props.ctx$
51
51
 
52
52
  const org = model.origin || 'voxgig-sdk'
53
+ // The two names on the next lines are DIFFERENT KINDS of name, and the
54
+ // adjacency is the trap. `sdkModule` is the Go SDK this CLI imports — a
55
+ // different target, so it keeps its own name and must NOT follow this
56
+ // target's alias. `cliModule` is this target itself, so it must.
53
57
  const sdkModule = goModule(model, 'go')
54
- const cliModule = goModule(model, 'go-cli')
58
+ const cliModule = goModule(model, target.name)
55
59
 
56
60
  const entityMap: any = getModelPath(model, `main.${KIT}.entity`)
57
61
  // Derive each entity's PascalCase `Name` here rather than relying on another
@@ -369,7 +373,7 @@ this repo, or upstream at
369
373
  // (go 1.24.7) — keep in step with BORU_ENG_VERSION.
370
374
  File({ name: 'go.mod' }, () => Content(`module ${cliModule}
371
375
 
372
- go ${goVersion(model, 'go-cli', '1.24.7')}
376
+ go ${goVersion(model, target.name, '1.24.7')}
373
377
 
374
378
  require ${sdkModule} v0.0.0
375
379
  require github.com/boru-lang/boru/eng/go ${BORU_ENG_VERSION}
@@ -50,8 +50,12 @@ const Main = cmp(function Main(props: any) {
50
50
  const { model } = props.ctx$
51
51
 
52
52
  const org = model.origin || 'voxgig-sdk'
53
+ // The two names on the next lines are DIFFERENT KINDS of name, and the
54
+ // adjacency is the trap. `sdkModule` is the Go SDK this CLI imports — a
55
+ // different target, so it keeps its own name and must NOT follow this
56
+ // target's alias. `mcpModule` is this target itself, so it must.
53
57
  const sdkModule = goModule(model, 'go')
54
- const mcpModule = goModule(model, 'go-mcp')
58
+ const mcpModule = goModule(model, target.name)
55
59
 
56
60
  const entityMap: any = getModelPath(model, `main.${KIT}.entity`)
57
61
  // Derive each entity's PascalCase `Name` here rather than relying on another
@@ -319,7 +323,7 @@ this repo, or upstream at
319
323
  // the public proxy. The MCP Go SDK requires go >= 1.25.
320
324
  File({ name: 'go.mod' }, () => Content(`module ${mcpModule}
321
325
 
322
- go ${goVersion(model, 'go-mcp', '1.25.0')}
326
+ go ${goVersion(model, target.name, '1.25.0')}
323
327
 
324
328
  require ${sdkModule} v0.0.0
325
329
  require github.com/modelcontextprotocol/go-sdk ${MCP_GO_SDK_VERSION}
@@ -1,14 +1,9 @@
1
1
 
2
- import {
3
- KIT,
4
- getModelPath
5
- } from '@voxgig/apidef'
6
-
7
2
  import type {
8
3
  ModelEntity
9
4
  } from '@voxgig/apidef'
10
5
 
11
- import { cmp, each, Folder } from '@voxgig/sdkgen'
6
+ import { cmp, each, Folder, entityCollection } from '@voxgig/sdkgen'
12
7
 
13
8
 
14
9
  import { TestEntity } from './TestEntity_java'
@@ -30,7 +25,9 @@ const Test = cmp(function Test(props: any) {
30
25
  // CustomUtilityTest, StructRunner/StructCorpusTest, ExistsTest and
31
26
  // sdk-test-control.json) ships as templates in tm/java/test/ and is
32
27
  // copied by Main_java. Here we generate only the API-specific tests.
33
- each(model.main[KIT].entity, (entity: ModelEntity) => {
28
+ const entity = each(entityCollection(model))
29
+ .filter((e: any) => false !== e.active)
30
+ each(entity, (entity: ModelEntity) => {
34
31
  TestEntity({ target, entity, javapackage })
35
32
  TestDirect({ target, entity, javapackage })
36
33
  })
@@ -63,7 +63,7 @@ const Package = cmp(async function Package(props: any) {
63
63
  const pkg = {
64
64
  // The ts target publishes the canonical scoped npm name; the js target
65
65
  // appends `-js` so the two never collide on npm.
66
- name: packageName(model, 'js'),
66
+ name: packageName(model, target.name),
67
67
  version: packageVersion(model, target.name),
68
68
  description: pkgDescription(model, target.name),
69
69
  keywords: keywords(model),