@voxgig/sdkgen 2.0.2 → 3.1.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 (403) hide show
  1. package/bin/voxgig-sdkgen +22 -2
  2. package/dist/action/doctor.d.ts +14 -0
  3. package/dist/action/doctor.js +351 -0
  4. package/dist/action/doctor.js.map +1 -0
  5. package/dist/action/feature.js +48 -9
  6. package/dist/action/feature.js.map +1 -1
  7. package/dist/action/target.d.ts +6 -1
  8. package/dist/action/target.js +134 -22
  9. package/dist/action/target.js.map +1 -1
  10. package/dist/cmp/Entity.js +5 -0
  11. package/dist/cmp/Entity.js.map +1 -1
  12. package/dist/cmp/ExternalTarget.d.ts +2 -0
  13. package/dist/cmp/ExternalTarget.js +104 -0
  14. package/dist/cmp/ExternalTarget.js.map +1 -0
  15. package/dist/cmp/Feature.js +2 -1
  16. package/dist/cmp/Feature.js.map +1 -1
  17. package/dist/cmp/Main.js +5 -1
  18. package/dist/cmp/Main.js.map +1 -1
  19. package/dist/cmp/ReadmeExplanation.js +1 -1
  20. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  21. package/dist/cmp/ReadmeTop.js +16 -6
  22. package/dist/cmp/ReadmeTop.js.map +1 -1
  23. package/dist/cmp/Registered.d.ts +7 -0
  24. package/dist/cmp/Registered.js +70 -0
  25. package/dist/cmp/Registered.js.map +1 -0
  26. package/dist/cmp/Test.js +3 -1
  27. package/dist/cmp/Test.js.map +1 -1
  28. package/dist/helpers/dryrun.d.ts +10 -0
  29. package/dist/helpers/dryrun.js +35 -0
  30. package/dist/helpers/dryrun.js.map +1 -0
  31. package/dist/helpers/featureSource.d.ts +13 -0
  32. package/dist/helpers/featureSource.js +156 -0
  33. package/dist/helpers/featureSource.js.map +1 -0
  34. package/dist/helpers/naming.d.ts +9 -1
  35. package/dist/helpers/naming.js +66 -2
  36. package/dist/helpers/naming.js.map +1 -1
  37. package/dist/helpers/opExample.js +23 -3
  38. package/dist/helpers/opExample.js.map +1 -1
  39. package/dist/helpers/opShape.d.ts +11 -1
  40. package/dist/helpers/opShape.js +51 -0
  41. package/dist/helpers/opShape.js.map +1 -1
  42. package/dist/helpers/packageMeta.d.ts +16 -1
  43. package/dist/helpers/packageMeta.js +181 -10
  44. package/dist/helpers/packageMeta.js.map +1 -1
  45. package/dist/helpers/stdrep.d.ts +3 -0
  46. package/dist/helpers/stdrep.js +47 -0
  47. package/dist/helpers/stdrep.js.map +1 -0
  48. package/dist/helpers/testPolicy.d.ts +2 -0
  49. package/dist/helpers/testPolicy.js +46 -0
  50. package/dist/helpers/testPolicy.js.map +1 -0
  51. package/dist/sdkgen.d.ts +15 -6
  52. package/dist/sdkgen.js +273 -5
  53. package/dist/sdkgen.js.map +1 -1
  54. package/dist/tsconfig.tsbuildinfo +1 -1
  55. package/dist/types.d.ts +12 -0
  56. package/dist/utility.js +10 -1
  57. package/dist/utility.js.map +1 -1
  58. package/model/sdkgen.aontu +245 -0
  59. package/package.json +5 -3
  60. package/project/.sdk/model/target/c.aontu +28 -3
  61. package/project/.sdk/model/target/clojure.aontu +24 -3
  62. package/project/.sdk/model/target/cpp.aontu +25 -3
  63. package/project/.sdk/model/target/csharp.aontu +25 -3
  64. package/project/.sdk/model/target/dart.aontu +15 -3
  65. package/project/.sdk/model/target/elixir.aontu +15 -3
  66. package/project/.sdk/model/target/go-cli.aontu +16 -1
  67. package/project/.sdk/model/target/go-mcp.aontu +16 -1
  68. package/project/.sdk/model/target/go.aontu +14 -4
  69. package/project/.sdk/model/target/haskell.aontu +24 -3
  70. package/project/.sdk/model/target/java.aontu +25 -3
  71. package/project/.sdk/model/target/js.aontu +15 -3
  72. package/project/.sdk/model/target/kotlin.aontu +25 -3
  73. package/project/.sdk/model/target/lean.aontu +24 -3
  74. package/project/.sdk/model/target/lua.aontu +15 -3
  75. package/project/.sdk/model/target/ocaml.aontu +24 -3
  76. package/project/.sdk/model/target/perl.aontu +15 -3
  77. package/project/.sdk/model/target/php.aontu +15 -3
  78. package/project/.sdk/model/target/py-data.aontu +15 -3
  79. package/project/.sdk/model/target/py.aontu +15 -3
  80. package/project/.sdk/model/target/rb.aontu +15 -3
  81. package/project/.sdk/model/target/rust.aontu +25 -3
  82. package/project/.sdk/model/target/scala.aontu +24 -3
  83. package/project/.sdk/model/target/seneca-provider.aontu +118 -0
  84. package/project/.sdk/model/target/swift.aontu +25 -3
  85. package/project/.sdk/model/target/ts.aontu +15 -3
  86. package/project/.sdk/model/target/zig.aontu +25 -3
  87. package/project/.sdk/src/cmp/c/Config_c.ts +10 -11
  88. package/project/.sdk/src/cmp/c/Entity_c.ts +5 -1
  89. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +23 -5
  90. package/project/.sdk/src/cmp/c/fragment/EntityCreateOp.fragment.c +9 -2
  91. package/project/.sdk/src/cmp/c/fragment/EntityListOp.fragment.c +19 -2
  92. package/project/.sdk/src/cmp/c/fragment/EntityLoadOp.fragment.c +9 -2
  93. package/project/.sdk/src/cmp/c/fragment/EntityRemoveOp.fragment.c +12 -2
  94. package/project/.sdk/src/cmp/c/fragment/EntityUpdateOp.fragment.c +9 -2
  95. package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -0
  96. package/project/.sdk/src/cmp/clojure/TestEntity_clojure.ts +6 -3
  97. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
  98. package/project/.sdk/src/cmp/clojure/fragment/EntityCreateOp.fragment.clj +2 -2
  99. package/project/.sdk/src/cmp/clojure/fragment/EntityLoadOp.fragment.clj +2 -2
  100. package/project/.sdk/src/cmp/clojure/fragment/EntityRemoveOp.fragment.clj +12 -8
  101. package/project/.sdk/src/cmp/clojure/fragment/EntityUpdateOp.fragment.clj +2 -2
  102. package/project/.sdk/src/cmp/cpp/Entity_cpp.ts +5 -1
  103. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +12 -9
  104. package/project/.sdk/src/cmp/cpp/fragment/EntityCreateOp.fragment.cpp +8 -2
  105. package/project/.sdk/src/cmp/cpp/fragment/EntityListOp.fragment.cpp +18 -2
  106. package/project/.sdk/src/cmp/cpp/fragment/EntityLoadOp.fragment.cpp +8 -2
  107. package/project/.sdk/src/cmp/cpp/fragment/EntityRemoveOp.fragment.cpp +11 -2
  108. package/project/.sdk/src/cmp/cpp/fragment/EntityUpdateOp.fragment.cpp +8 -2
  109. package/project/.sdk/src/cmp/csharp/Package_csharp.ts +2 -1
  110. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +3 -3
  111. package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +6 -6
  112. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +38 -1
  113. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +42 -33
  114. package/project/.sdk/src/cmp/dart/Package_dart.ts +2 -1
  115. package/project/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +13 -2
  116. package/project/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +2 -1
  117. package/project/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +3 -3
  118. package/project/.sdk/src/cmp/dart/ReadmeModel_dart.ts +1 -1
  119. package/project/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +17 -6
  120. package/project/.sdk/src/cmp/dart/ReadmeRef_dart.ts +13 -2
  121. package/project/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +13 -2
  122. package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +3 -3
  123. package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +8 -8
  124. package/project/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +18 -1
  125. package/project/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +9 -1
  126. package/project/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +9 -1
  127. package/project/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +15 -1
  128. package/project/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +9 -1
  129. package/project/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +8 -0
  130. package/project/.sdk/src/cmp/elixir/Package_elixir.ts +3 -1
  131. package/project/.sdk/src/cmp/elixir/ReadmeInstall_elixir.ts +2 -2
  132. package/project/.sdk/src/cmp/elixir/TestEntity_elixir.ts +11 -2
  133. package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +2 -1
  134. package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +1 -0
  135. package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +2 -1
  136. package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +4 -1
  137. package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +2 -1
  138. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +38 -8
  139. package/project/.sdk/src/cmp/go/Entity_go.ts +2 -2
  140. package/project/.sdk/src/cmp/go/Main_go.ts +4 -5
  141. package/project/.sdk/src/cmp/go/Package_go.ts +8 -5
  142. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +2 -2
  143. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
  144. package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +4 -2
  145. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +2 -2
  146. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +2 -2
  147. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +2 -2
  148. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
  149. package/project/.sdk/src/cmp/go/TestDirect_go.ts +21 -15
  150. package/project/.sdk/src/cmp/go/TestEntity_go.ts +9 -9
  151. package/project/.sdk/src/cmp/go/Test_go.ts +2 -2
  152. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -1
  153. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +4 -4
  154. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +4 -4
  155. package/project/.sdk/src/cmp/haskell/Package_haskell.ts +2 -1
  156. package/project/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +10 -5
  157. package/project/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +10 -8
  158. package/project/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +14 -10
  159. package/project/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +21 -18
  160. package/project/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +4 -4
  161. package/project/.sdk/src/cmp/haskell/Test_haskell.ts +23 -11
  162. package/project/.sdk/src/cmp/java/Package_java.ts +2 -1
  163. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -1
  164. package/project/.sdk/src/cmp/java/ReadmeInstall_java.ts +2 -2
  165. package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +1 -1
  166. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +3 -3
  167. package/project/.sdk/src/cmp/java/TestDirect_java.ts +3 -3
  168. package/project/.sdk/src/cmp/java/TestEntity_java.ts +6 -6
  169. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +34 -1
  170. package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +12 -0
  171. package/project/.sdk/src/cmp/js/Main_js.ts +4 -1
  172. package/project/.sdk/src/cmp/js/Package_js.ts +7 -1
  173. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +13 -2
  174. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +2 -1
  175. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +13 -2
  176. package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +13 -2
  177. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +2 -1
  178. package/project/.sdk/src/cmp/js/TestDirect_js.ts +3 -3
  179. package/project/.sdk/src/cmp/js/TestEntity_js.ts +8 -8
  180. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +22 -1
  181. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +9 -1
  182. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +9 -1
  183. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +15 -1
  184. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +9 -1
  185. package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +13 -0
  186. package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +2 -1
  187. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -1
  188. package/project/.sdk/src/cmp/kotlin/ReadmeInstall_kotlin.ts +2 -2
  189. package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +1 -1
  190. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +3 -3
  191. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +3 -3
  192. package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +6 -6
  193. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +32 -1
  194. package/project/.sdk/src/cmp/lean/Package_lean.ts +3 -1
  195. package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +9 -4
  196. package/project/.sdk/src/cmp/lua/Package_lua.ts +4 -3
  197. package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +11 -3
  198. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
  199. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +3 -3
  200. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +9 -9
  201. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +37 -1
  202. package/project/.sdk/src/cmp/lua/fragment/SdkError.fragment.lua +12 -0
  203. package/project/.sdk/src/cmp/ocaml/EntityOperation_ocaml.ts +30 -3
  204. package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +11 -5
  205. package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +3 -1
  206. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +10 -5
  207. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +6 -2
  208. package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +10 -8
  209. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +14 -13
  210. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +20 -18
  211. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +4 -4
  212. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +8 -2
  213. package/project/.sdk/src/cmp/ocaml/TestEntity_ocaml.ts +8 -5
  214. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -1
  215. package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +1 -1
  216. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +3 -3
  217. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +1 -1
  218. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +3 -3
  219. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +6 -6
  220. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +36 -1
  221. package/project/.sdk/src/cmp/php/MainEntity_php.ts +21 -16
  222. package/project/.sdk/src/cmp/php/Package_php.ts +2 -2
  223. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +6 -6
  224. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +4 -3
  225. package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +2 -2
  226. package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +1 -1
  227. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +12 -12
  228. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +6 -6
  229. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +4 -4
  230. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
  231. package/project/.sdk/src/cmp/php/TestDirect_php.ts +3 -3
  232. package/project/.sdk/src/cmp/php/TestEntity_php.ts +17 -15
  233. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +20 -1
  234. package/project/.sdk/src/cmp/php/fragment/SdkError.fragment.php +11 -0
  235. package/project/.sdk/src/cmp/py/Package_py.ts +4 -3
  236. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +13 -2
  237. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -1
  238. package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +1 -1
  239. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +17 -6
  240. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +14 -3
  241. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +13 -2
  242. package/project/.sdk/src/cmp/py/TestDirect_py.ts +3 -3
  243. package/project/.sdk/src/cmp/py/TestEntity_py.ts +9 -9
  244. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +29 -1
  245. package/project/.sdk/src/cmp/py/fragment/SdkError.fragment.py +11 -0
  246. package/project/.sdk/src/cmp/py-data/Main_py-data.ts +2 -1
  247. package/project/.sdk/src/cmp/rb/Package_rb.ts +4 -3
  248. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +1 -1
  249. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -1
  250. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +5 -5
  251. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +1 -1
  252. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +3 -3
  253. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +9 -9
  254. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +31 -1
  255. package/project/.sdk/src/cmp/rb/fragment/SdkError.fragment.rb +10 -1
  256. package/project/.sdk/src/cmp/rust/Entity_rust.ts +5 -1
  257. package/project/.sdk/src/cmp/rust/Main_rust.ts +21 -0
  258. package/project/.sdk/src/cmp/rust/Package_rust.ts +2 -1
  259. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +3 -3
  260. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +12 -12
  261. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +18 -0
  262. package/project/.sdk/src/cmp/rust/fragment/EntityCreateOp.fragment.rs +8 -2
  263. package/project/.sdk/src/cmp/rust/fragment/EntityListOp.fragment.rs +20 -3
  264. package/project/.sdk/src/cmp/rust/fragment/EntityLoadOp.fragment.rs +8 -2
  265. package/project/.sdk/src/cmp/rust/fragment/EntityRemoveOp.fragment.rs +10 -2
  266. package/project/.sdk/src/cmp/rust/fragment/EntityUpdateOp.fragment.rs +8 -2
  267. package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +10 -0
  268. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -1
  269. package/project/.sdk/src/cmp/scala/ReadmeInstall_scala.ts +3 -3
  270. package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +1 -1
  271. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +3 -3
  272. package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +3 -3
  273. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +27 -1
  274. package/project/.sdk/src/cmp/seneca-provider/Extras_seneca-provider.ts +3915 -0
  275. package/project/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +960 -0
  276. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -1
  277. package/project/.sdk/src/cmp/swift/ReadmeInstall_swift.ts +3 -3
  278. package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +1 -1
  279. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +3 -3
  280. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +34 -1
  281. package/project/.sdk/src/cmp/ts/EntityOperation_ts.ts +9 -1
  282. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +18 -1
  283. package/project/.sdk/src/cmp/ts/Gitignore_ts.ts +5 -2
  284. package/project/.sdk/src/cmp/ts/Main_ts.ts +4 -1
  285. package/project/.sdk/src/cmp/ts/Package_ts.ts +10 -1
  286. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +13 -2
  287. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +2 -1
  288. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +21 -6
  289. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +52 -2
  290. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +14 -3
  291. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +34 -2
  292. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +64 -43
  293. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +8 -8
  294. package/project/.sdk/src/cmp/ts/fragment/Direct.test.fragment.ts +2 -2
  295. package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +2 -2
  296. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +25 -1
  297. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +10 -2
  298. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +1 -1
  299. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +10 -2
  300. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +27 -3
  301. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +10 -2
  302. package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +15 -0
  303. package/project/.sdk/src/cmp/zig/Entity_zig.ts +5 -1
  304. package/project/.sdk/src/cmp/zig/Package_zig.ts +3 -1
  305. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +39 -0
  306. package/project/.sdk/src/cmp/zig/fragment/EntityCreateOp.fragment.zig +2 -2
  307. package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +21 -2
  308. package/project/.sdk/src/cmp/zig/fragment/EntityLoadOp.fragment.zig +2 -2
  309. package/project/.sdk/src/cmp/zig/fragment/EntityRemoveOp.fragment.zig +5 -2
  310. package/project/.sdk/src/cmp/zig/fragment/EntityUpdateOp.fragment.zig +2 -2
  311. package/project/.sdk/tm/c/VERSION +1 -1
  312. package/project/.sdk/tm/c/core/helpers.c +1 -0
  313. package/project/.sdk/tm/c/core/sdk.h +22 -6
  314. package/project/.sdk/tm/c/tests/feature_harness.h +1 -0
  315. package/project/.sdk/tm/c/tests/primary_utility_test.c +4 -1
  316. package/project/.sdk/tm/c/utility/make_url.c +1 -0
  317. package/project/.sdk/tm/c/utility/param.c +1 -0
  318. package/project/.sdk/tm/clojure/VERSION +1 -1
  319. package/project/.sdk/tm/cpp/VERSION +1 -1
  320. package/project/.sdk/tm/cpp/core/types.hpp +33 -8
  321. package/project/.sdk/tm/cpp/test/pipeline_test.cpp +5 -0
  322. package/project/.sdk/tm/cpp/test/runner_support.hpp +4 -4
  323. package/project/.sdk/tm/csharp/VERSION +1 -1
  324. package/project/.sdk/tm/csharp/core/Types.cs +6 -0
  325. package/project/.sdk/tm/csharp/test/FeatureHarness.cs +396 -0
  326. package/project/.sdk/tm/csharp/test/FeatureTest.cs +7 -385
  327. package/project/.sdk/tm/csharp/test/Runner.cs +4 -4
  328. package/project/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +4 -0
  329. package/project/.sdk/tm/dart/test/utility.dart +4 -4
  330. package/project/.sdk/tm/elixir/VERSION +1 -1
  331. package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +26 -0
  332. package/project/.sdk/tm/go/VERSION +1 -1
  333. package/project/.sdk/tm/go/core/types.go +6 -0
  334. package/project/.sdk/tm/go/test/feature_harness_test.go +361 -0
  335. package/project/.sdk/tm/go/test/feature_test.go +7 -350
  336. package/project/.sdk/tm/go/test/pipeline_test.go +6 -0
  337. package/project/.sdk/tm/go/test/runner_test.go +16 -4
  338. package/project/.sdk/tm/haskell/VERSION +1 -1
  339. package/project/.sdk/tm/haskell/src/SdkFeatures.hs +28 -5
  340. package/project/.sdk/tm/haskell/src/SdkTypes.hs +14 -5
  341. package/project/.sdk/tm/java/VERSION +1 -1
  342. package/project/.sdk/tm/java/test/RunnerSupport.java +4 -4
  343. package/project/.sdk/tm/java/utility/MakeError.java +4 -0
  344. package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +4 -0
  345. package/project/.sdk/tm/js/test/utility.js +3 -3
  346. package/project/.sdk/tm/kotlin/VERSION +1 -1
  347. package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +3 -3
  348. package/project/.sdk/tm/lean/VERSION +1 -1
  349. package/project/.sdk/tm/lean/test/TFeature.lean +27 -14
  350. package/project/.sdk/tm/lua/test/runner.lua +4 -4
  351. package/project/.sdk/tm/lua/utility/make_error.lua +4 -0
  352. package/project/.sdk/tm/ocaml/VERSION +1 -1
  353. package/project/.sdk/tm/ocaml/sdk_types.ml +14 -5
  354. package/project/.sdk/tm/ocaml/test/t_pipeline.ml +5 -2
  355. package/project/.sdk/tm/perl/t/runner.pm +4 -4
  356. package/project/.sdk/tm/php/VERSION +1 -1
  357. package/project/.sdk/tm/php/test/Runner.php +4 -4
  358. package/project/.sdk/tm/php/utility/MakeError.php +5 -0
  359. package/project/.sdk/tm/py/pkg/utility/make_error.py +4 -0
  360. package/project/.sdk/tm/py/test/runner.py +19 -4
  361. package/project/.sdk/tm/rb/test/runner.rb +4 -4
  362. package/project/.sdk/tm/rb/utility/make_error.rb +4 -0
  363. package/project/.sdk/tm/rust/VERSION +1 -1
  364. package/project/.sdk/tm/rust/core/types.rs +22 -6
  365. package/project/.sdk/tm/rust/tests/common/mod.rs +6 -6
  366. package/project/.sdk/tm/rust/tests/pipeline_test.rs +6 -0
  367. package/project/.sdk/tm/rust/utility/make_error.rs +4 -0
  368. package/project/.sdk/tm/scala/VERSION +1 -1
  369. package/project/.sdk/tm/seneca-provider/CODE_OF_CONDUCT.md +132 -0
  370. package/project/.sdk/tm/seneca-provider/LICENSE +21 -0
  371. package/project/.sdk/tm/seneca-provider/Makefile +15 -0
  372. package/project/.sdk/tm/seneca-provider/src/tsconfig.json +18 -0
  373. package/project/.sdk/tm/seneca-provider/test/tsconfig.json +16 -0
  374. package/project/.sdk/tm/seneca-provider/tsfmt.json +3 -0
  375. package/project/.sdk/tm/swift/VERSION +1 -1
  376. package/project/.sdk/tm/ts/src/tsconfig.json +1 -0
  377. package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +4 -0
  378. package/project/.sdk/tm/ts/test/tsconfig.json +1 -0
  379. package/project/.sdk/tm/ts/test/utility.ts +3 -3
  380. package/project/.sdk/tm/zig/VERSION +1 -1
  381. package/src/action/doctor.ts +475 -0
  382. package/src/action/feature.ts +54 -16
  383. package/src/action/target.ts +174 -25
  384. package/src/cmp/Entity.ts +7 -0
  385. package/src/cmp/ExternalTarget.ts +125 -0
  386. package/src/cmp/Feature.ts +3 -1
  387. package/src/cmp/Main.ts +7 -1
  388. package/src/cmp/ReadmeExplanation.ts +2 -2
  389. package/src/cmp/ReadmeTop.ts +22 -9
  390. package/src/cmp/Registered.ts +100 -0
  391. package/src/cmp/Test.ts +4 -1
  392. package/src/helpers/dryrun.ts +57 -0
  393. package/src/helpers/featureSource.ts +208 -0
  394. package/src/helpers/naming.ts +73 -2
  395. package/src/helpers/opExample.ts +19 -2
  396. package/src/helpers/opShape.ts +65 -0
  397. package/src/helpers/packageMeta.ts +211 -10
  398. package/src/helpers/stdrep.ts +56 -0
  399. package/src/helpers/testPolicy.ts +52 -0
  400. package/src/sdkgen.ts +350 -5
  401. package/src/types.ts +24 -1
  402. package/src/utility.ts +10 -1
  403. package/project/.sdk/tm/rust/feature/mod.rs +0 -24
@@ -46,6 +46,10 @@ function makeError(ctx: Context, err?: any) {
46
46
  err.result = clean(ctx, result)
47
47
  err.spec = clean(ctx, spec)
48
48
 
49
+ // Promote the HTTP status to the top level, so a consumer can branch on
50
+ // `err.status` / `err.notFound` instead of reaching into `err.result`.
51
+ err.status = null == result.status ? -1 : result.status
52
+
49
53
  ctx.ctrl.err = err
50
54
 
51
55
  // Fire PreUnexpected so observability features (metrics, telemetry, audit,
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "skipLibCheck": true,
3
4
  "esModuleInterop": true,
4
5
  "module": "nodenext",
5
6
  "noEmitOnError": true,
@@ -62,8 +62,8 @@ function makeCtrl(explain: boolean) {
62
62
  // Overrides configuration values with environment variables if available
63
63
  function envOverride(m: Record<string, any>) {
64
64
  if (
65
- 'TRUE' === process.env.PROJECTNAME_TEST_LIVE ||
66
- 'TRUE' === process.env.PROJECTNAME_TEST_OVERRIDE
65
+ 'TRUE' === process.env.PROJECTENV_TEST_LIVE ||
66
+ 'TRUE' === process.env.PROJECTENV_TEST_OVERRIDE
67
67
  ) {
68
68
  Object.entries(m).map(n => {
69
69
  let envval = process.env[n[0]]
@@ -74,7 +74,7 @@ function envOverride(m: Record<string, any>) {
74
74
  })
75
75
  }
76
76
 
77
- m.PROJECTNAME_TEST_EXPLAIN = process.env.PROJECTNAME_TEST_EXPLAIN || m.PROJECTNAME_TEST_EXPLAIN
77
+ m.PROJECTENV_TEST_EXPLAIN = process.env.PROJECTENV_TEST_EXPLAIN || m.PROJECTENV_TEST_EXPLAIN
78
78
 
79
79
  return m
80
80
  }
@@ -1 +1 @@
1
- 0.0.1
1
+ PROJECTVERSION
@@ -0,0 +1,475 @@
1
+ // `voxgig-sdkgen doctor` — does this project's `.sdk/` still match the
2
+ // scaffold?
3
+ //
4
+ // WHY THIS EXISTS
5
+ //
6
+ // Nothing told a project that its `.sdk/` had drifted. `target add`
7
+ // OVERWRITES the vendored components, the template masters AND the per-target
8
+ // model file, so any hand-edit there is silently reverted on the next run —
9
+ // and any file the scaffold has since stopped shipping just stays, compiling
10
+ // into the output forever. In voxgig-solardemo-sdk two such orphans broke the
11
+ // Go build in a single session: `utility/make_target.go` (replaced upstream by
12
+ // `make_point.go`, leaving a duplicate symbol) and `utility/struct/go.mod` (a
13
+ // nested module that made `utility/struct` unimportable).
14
+ //
15
+ // Every divergence in that repo was found by hand-diffing. Without a check,
16
+ // fixing it once guarantees nothing about next month.
17
+ //
18
+ // WHY A NAIVE `diff -r` DOES NOT WORK
19
+ //
20
+ // `target add` writes template masters with substitution PARTLY applied, and
21
+ // inconsistently: `tm/go/core/error.go` arrives substituted (`SolardemoError`
22
+ // where the scaffold says `ProjectNameError`), `tm/ts/test/utility.ts` arrives
23
+ // raw (its placeholders are substituted later, at generate time), and
24
+ // `tm/go/LICENSE` has the year filled in. A plain `diff -r` against the
25
+ // scaffold reported 20 edited files in that repo; 19 were substitution
26
+ // artefacts and exactly ONE was a real hand-edit.
27
+ //
28
+ // Only sdkgen knows which replacements it applied to which files, which is
29
+ // why this check belongs here and cannot be scripted downstream. It re-runs
30
+ // the same substitution before comparing, so what it reports is real.
31
+
32
+ import Path from 'node:path'
33
+
34
+ import { template } from 'jostraca'
35
+
36
+ import {
37
+ KIT
38
+ } from '../types'
39
+
40
+ import type {
41
+ ActionContext,
42
+ ActionResult,
43
+ } from '../types'
44
+
45
+ import { SdkGenError } from '../utility'
46
+
47
+ import { templateReplacements } from '../helpers/stdrep'
48
+
49
+ import {
50
+ resolveTarget,
51
+ trimFeatures,
52
+ } from './target'
53
+
54
+
55
+ // jostraca's Copy walk skips these (IGNORED_RE in CopyOp) — editor backups and
56
+ // deliberately-disabled templates never reach a project, so they are not drift.
57
+ const IGNORED_RE = /(~|-jostraca-off)$/
58
+
59
+ // Extensions jostraca copies byte-for-byte. Comparing them as text would
60
+ // report spurious differences, so they are compared by raw bytes.
61
+ const BINARY_RE = /\.(png|jpg|jpeg|gif|ico|pdf|zip|gz|woff2?|ttf|eot|wasm)$/i
62
+
63
+
64
+ // Root-level components sdkgen provides, and what a project loses by not
65
+ // wiring one in. A project's `Root.ts` / `Top.ts` come from create-sdkgen at
66
+ // init and are then FROZEN — `target add` never touches them — so a
67
+ // capability added to sdkgen afterwards is invisible to every existing
68
+ // project. solardemo's `Top.ts`, written before `ReadmeTop` existed, kept
69
+ // hand-rolling a 9-line stub root README with an empty mermaid diagram for
70
+ // months, and no number of `target add` runs would ever have said so.
71
+ //
72
+ // Not wiring one in is a legitimate choice, so this is REPORTED, never a
73
+ // failure.
74
+ const ROOT_COMPONENTS: [string, string][] = [
75
+ ['ReadmeTop', 'the assembled root README (quickstart, howto, test, package table)'],
76
+ ['AgentGuideTop', 'the root AGENTS.md / CLAUDE.md agent guides'],
77
+ ['License', 'the root LICENSE'],
78
+ ['Security', 'the root SECURITY.md'],
79
+ ['Changelog', 'the root CHANGELOG.md'],
80
+ ['Deploy', 'the release/publish recipes'],
81
+ ]
82
+
83
+
84
+ // What the check found, by category. Categories 1-3 are drift; `additive` is
85
+ // the project's own work and is reported separately, never as a problem.
86
+ type DoctorReport = {
87
+ // `.sdk/src/cmp/**`, or a target's own `.sdk/model/target/<t>.aontu`, that
88
+ // differs from the scaffold. `target add` will silently revert every one of
89
+ // these.
90
+ forked: string[]
91
+
92
+ // `.sdk/tm/**` that differs from the scaffold AFTER the same substitution
93
+ // `target add` applies.
94
+ edited: string[]
95
+
96
+ // Present in the project, but `target add` would no longer write it. Stale
97
+ // output — the category that broke the Go build twice.
98
+ stale: string[]
99
+
100
+ // `target add` would write it and the project does not have it.
101
+ missing: string[]
102
+
103
+ // Project-owned components the scaffold never shipped. NOT drift.
104
+ additive: string[]
105
+
106
+ // Root-level components this sdkgen provides that the project's root
107
+ // wiring never calls. Informational: opting out is legitimate.
108
+ unwired: string[]
109
+
110
+ // True when nothing in the first four categories was found.
111
+ ok: boolean
112
+ }
113
+
114
+
115
+ const CMD_MAP: any = {
116
+ check: cmd_doctor_check,
117
+ }
118
+
119
+
120
+ async function action_doctor(args: string[], actx: ActionContext): Promise<ActionResult> {
121
+ // `doctor` with no subcommand is the check — the command exists to be run
122
+ // in CI without anyone remembering a verb.
123
+ const cmdname = args[1]
124
+ const cmd = null == cmdname ? cmd_doctor_check : CMD_MAP[cmdname]
125
+
126
+ if (null == cmd) {
127
+ throw new SdkGenError('Unknown doctor cmd: ' + cmdname)
128
+ }
129
+
130
+ return await cmd(args, actx)
131
+ }
132
+
133
+
134
+ async function cmd_doctor_check(_args: string[], actx: ActionContext): Promise<ActionResult> {
135
+ return doctor(actx)
136
+ }
137
+
138
+
139
+ // Code API. Returns the report; the CLI turns a non-ok report into a
140
+ // non-zero exit so this can gate CI.
141
+ async function doctor(actx: ActionContext): Promise<ActionResult> {
142
+ const log = actx.log
143
+ const fs = actx.fs()
144
+ const model = actx.model
145
+ const root = actx.folder
146
+
147
+ const report: DoctorReport = {
148
+ forked: [], edited: [], stale: [], missing: [], additive: [],
149
+ unwired: [], ok: true,
150
+ }
151
+
152
+ const targets = Object.keys(model?.main?.[KIT]?.target ?? {})
153
+
154
+ log.info({ point: 'doctor-start', targets: targets.length })
155
+
156
+ for (const tname of targets) {
157
+ const declared = (model as any)?.main?.[KIT]?.target?.[tname]
158
+
159
+ // The target model records where it came from (`base`, written by
160
+ // `target add`). Fall back to the bundled scaffold.
161
+ const tref = (declared && declared.base) ?
162
+ Path.join(declared.base, '..', tname) : tname
163
+
164
+ let resolved: any
165
+ try {
166
+ resolved = resolveTarget(tref, { folder: root, fs: () => fs })
167
+ }
168
+ catch (err: any) {
169
+ log.warn({
170
+ point: 'doctor-target-unresolved', target: tname, err: err.message,
171
+ note: tname + ': cannot find its scaffold (' + err.message + ')'
172
+ })
173
+ continue
174
+ }
175
+
176
+ if (null != resolved) {
177
+ checkTarget(actx, resolved, report)
178
+ }
179
+ }
180
+
181
+ checkWiring(actx, report)
182
+
183
+ report.ok = 0 === report.forked.length + report.edited.length +
184
+ report.stale.length + report.missing.length
185
+
186
+ for (const [kind, note] of [
187
+ ['forked', 'FORKED (will be reverted by `target add`)'],
188
+ ['edited', 'EDITED template master'],
189
+ ['stale', 'STALE (no longer written by `target add`)'],
190
+ ['missing', 'MISSING (would be written by `target add`)'],
191
+ ['additive', 'additive (project-owned, not drift)'],
192
+ ['unwired', 'NOT WIRED IN (root capability this project is missing)'],
193
+ ] as [keyof DoctorReport, string][]) {
194
+ for (const file of (report[kind] as string[])) {
195
+ log.info({ point: 'doctor-finding', kind, file, note: note + ': ' + file })
196
+ }
197
+ }
198
+
199
+ log.info({
200
+ point: 'doctor-end',
201
+ ok: report.ok,
202
+ forked: report.forked.length,
203
+ edited: report.edited.length,
204
+ stale: report.stale.length,
205
+ missing: report.missing.length,
206
+ additive: report.additive.length,
207
+ unwired: report.unwired.length,
208
+ note: report.ok ?
209
+ ('.sdk matches the scaffold (' + report.additive.length + ' additive)') :
210
+ ('.sdk has drifted: ' + report.forked.length + ' forked, ' +
211
+ report.edited.length + ' edited, ' + report.stale.length + ' stale, ' +
212
+ report.missing.length + ' missing')
213
+ })
214
+
215
+ return { report } as any
216
+ }
217
+
218
+
219
+ // Which root-level components the project's own wiring calls. The wiring is
220
+ // hand-written TypeScript (Root.ts / Top.ts / BuildSDK.ts), so this is a
221
+ // reference check, not a diff: sdkgen has no reference copy of a file it does
222
+ // not ship.
223
+ function checkWiring(actx: ActionContext, report: DoctorReport) {
224
+ const fs = actx.fs()
225
+ const src = Path.join(actx.folder, 'src')
226
+
227
+ if (!fs.existsSync(src)) {
228
+ return
229
+ }
230
+
231
+ // Everything except cmp/, which is the per-target layer target add owns.
232
+ const wiring = walk(fs, src)
233
+ .filter((rel) => !rel.startsWith('cmp/') && rel.endsWith('.ts'))
234
+ .map((rel) => fs.readFileSync(Path.join(src, rel), 'utf8'))
235
+ .join('\n')
236
+
237
+ if ('' === wiring) {
238
+ return
239
+ }
240
+
241
+ for (const [name, what] of ROOT_COMPONENTS) {
242
+ // A bare identifier reference: imported and called, or at least named.
243
+ if (!new RegExp('\\b' + name + '\\b').test(wiring)) {
244
+ report.unwired.push(name + ' — ' + what)
245
+ }
246
+ }
247
+ }
248
+
249
+
250
+ function checkTarget(actx: ActionContext, resolved: any, report: DoctorReport) {
251
+ const { tname, tfolder, torigname } = resolved
252
+ const fs = actx.fs()
253
+ const model = actx.model
254
+ const root = actx.folder
255
+
256
+ // The two TREES `target add` owns, and the substitution it applies to each.
257
+ // (It owns one FILE as well — see checkTargetModel, below.)
258
+ //
259
+ // src/cmp — copied verbatim, so a byte compare is the truth.
260
+ // tm — copied through jostraca's template(), with ProjectName.
261
+ const trees: {
262
+ project: string, scaffold: string, replace: any, kind: 'forked' | 'edited',
263
+ }[] = [
264
+ {
265
+ project: Path.join(root, 'src', 'cmp', tname),
266
+ scaffold: Path.join(tfolder, 'src', 'cmp', torigname),
267
+ replace: {},
268
+ kind: 'forked',
269
+ },
270
+ {
271
+ project: Path.join(root, 'tm', tname),
272
+ scaffold: Path.join(tfolder, 'tm', torigname),
273
+ replace: templateReplacements(model, tname),
274
+ kind: 'edited',
275
+ },
276
+ ]
277
+
278
+ // The feature set `target add` would select right now. A project that
279
+ // added its targets before feature trimming existed carries source for
280
+ // features its model never declared — expected here as STALE, which is
281
+ // exactly what it is.
282
+ const featuremodel: any = model?.main?.[KIT]?.feature ?? {}
283
+ const features = Array.from(new Set([
284
+ 'test',
285
+ ...Object.keys(featuremodel).filter((n: string) => false !== featuremodel[n]?.active),
286
+ ]))
287
+
288
+ const excludes: RegExp[] = trimFeatures(
289
+ { log: quietLog(actx.log), fs: () => fs }, tfolder, torigname, tname, features)
290
+
291
+ for (const tree of trees) {
292
+ // Findings are reported at project-relative paths, the way a maintainer
293
+ // would type them.
294
+ const label = Path.relative(root, tree.project).split(Path.sep).join('/') + '/'
295
+
296
+ const expected = 'edited' === tree.kind ?
297
+ walk(fs, tree.scaffold).filter((rel) => !excluded(rel, excludes)) :
298
+ walk(fs, tree.scaffold)
299
+
300
+ const actual = walk(fs, tree.project)
301
+
302
+ const expectedSet = new Set(expected)
303
+ const actualSet = new Set(actual)
304
+
305
+ for (const rel of expected) {
306
+ if (!actualSet.has(rel)) {
307
+ report.missing.push(label + rel)
308
+ continue
309
+ }
310
+
311
+ if (differs(fs, Path.join(tree.scaffold, rel), Path.join(tree.project, rel),
312
+ model, tree.replace)) {
313
+ report[tree.kind].push(label + rel)
314
+ }
315
+ }
316
+
317
+ for (const rel of actual) {
318
+ if (expectedSet.has(rel)) {
319
+ continue
320
+ }
321
+
322
+ // A component the scaffold has NEVER shipped is the project's own —
323
+ // the supported way to add a per-target component. Anything else under
324
+ // a tree `target add` owns is stale output.
325
+ const known = fs.existsSync(Path.join(tree.scaffold, rel))
326
+ if ('forked' === tree.kind && !known) {
327
+ report.additive.push(label + rel)
328
+ }
329
+ else {
330
+ report.stale.push(label + rel)
331
+ }
332
+ }
333
+ }
334
+
335
+ checkTargetModel(actx, resolved, report)
336
+ }
337
+
338
+
339
+ // The THIRD thing `target add` writes for a target, and the one nothing
340
+ // compared: `model/target/<t>.aontu` (src/action/target.ts, the Copy with the
341
+ // `'BASE'` replacement).
342
+ //
343
+ // It is not scaffolding trivia. That file carries the target's dependency
344
+ // set, its `phase` gates, `srcfeature`, `feature.trim` / `feature.fullset`
345
+ // and its publish-registry identity — and `target add` OVERWRITES it exactly
346
+ // as it overwrites src/cmp and tm. So a maintainer who fixes a dep version
347
+ // there loses the fix on the next resync with nothing said (the SDK regresses
348
+ // with nobody touching it, which is the failure the "a project decision
349
+ // belongs in the MODEL" rule exists to prevent), and a project whose copy
350
+ // predates a scaffold change carries the old declaration forever while doctor
351
+ // reported the target in sync. Both are the drift this command exists to
352
+ // name; the file was simply in neither tree it walked.
353
+ function checkTargetModel(actx: ActionContext, resolved: any, report: DoctorReport) {
354
+ const { tname, tfolder, torigname, base } = resolved
355
+ const fs = actx.fs()
356
+
357
+ const scaffold = Path.join(tfolder, 'model', 'target', torigname + '.aontu')
358
+
359
+ // No scaffold file means nothing to compare against, which is the ALIASED
360
+ // target: `target add go~go2` copies go.aontu to model/target/go2.aontu and
361
+ // docs/how-to/add-a-target.md then tells the project to EDIT it (a second Go
362
+ // module needs its own module name and deps). doctor resolves a target by
363
+ // its INSTALLED name — the model records `base`, not the ref it came from —
364
+ // so the origin is not recoverable here, and reporting that documented edit
365
+ // as drift on every run is worse than saying nothing.
366
+ if (!fs.existsSync(scaffold)) {
367
+ return
368
+ }
369
+
370
+ const project = Path.join(actx.folder, 'model', 'target', tname + '.aontu')
371
+ const label = 'model/target/' + tname + '.aontu'
372
+
373
+ if (!fs.existsSync(project)) {
374
+ report.missing.push(label)
375
+ return
376
+ }
377
+
378
+ // The substitution `target add` applied on the way in: jostraca's template()
379
+ // against the model (so `module: name: '$$name$$'` arrives as the project
380
+ // slug) plus the `'BASE'` replacement recording where the scaffold was.
381
+ //
382
+ // NOT templateReplacements() — that is the tm/ tree's map. The two writers
383
+ // pass different maps, so doctor has to as well, or every csharp/swift/ts
384
+ // project reads as forked on the `base:` line alone.
385
+ if (differs(fs, scaffold, project, actx.model, { "'BASE'": "'" + base + "'" })) {
386
+ report.forked.push(label)
387
+ }
388
+ }
389
+
390
+
391
+ // Every file under `dir`, as forward-slash paths relative to it, sorted.
392
+ // Missing directory -> no files (a target that was never added).
393
+ function walk(fs: any, dir: string): string[] {
394
+ const out: string[] = []
395
+
396
+ if (!fs.existsSync(dir)) {
397
+ return out
398
+ }
399
+
400
+ const descend = (rel: string) => {
401
+ const abs = '' === rel ? dir : Path.join(dir, rel)
402
+ for (const entry of fs.readdirSync(abs).sort()) {
403
+ if (IGNORED_RE.test(entry)) {
404
+ continue
405
+ }
406
+ const entryrel = '' === rel ? entry : rel + '/' + entry
407
+ if (fs.statSync(Path.join(dir, entryrel)).isDirectory()) {
408
+ descend(entryrel)
409
+ }
410
+ else {
411
+ out.push(entryrel)
412
+ }
413
+ }
414
+ }
415
+
416
+ descend('')
417
+
418
+ return out.sort()
419
+ }
420
+
421
+
422
+ function excluded(rel: string, excludes: RegExp[]): boolean {
423
+ for (const re of excludes) {
424
+ if (re.test(rel)) {
425
+ return true
426
+ }
427
+ }
428
+ return false
429
+ }
430
+
431
+
432
+ // Compare a scaffold file with a project file, applying the SAME substitution
433
+ // `target add` applied on the way in. Without this the comparison reports
434
+ // every substituted placeholder as an edit.
435
+ function differs(
436
+ fs: any, scaffoldPath: string, projectPath: string, model: any, replace: any,
437
+ ): boolean {
438
+ if (BINARY_RE.test(scaffoldPath)) {
439
+ return !fs.readFileSync(scaffoldPath).equals(fs.readFileSync(projectPath))
440
+ }
441
+
442
+ const src = fs.readFileSync(scaffoldPath, 'utf8')
443
+
444
+ // template() runs even when there is nothing to REPLACE, because jostraca's
445
+ // Copy always interpolates `$$ref$$` against the model as well — the replace
446
+ // map is an extra, not the whole substitution. Skipping it for the src/cmp
447
+ // tree (whose Copy passes no replace map) meant the three Config fragments
448
+ // that carry `$$const.Name$$` / `$$main.kit.info.servers.0.url$$` arrived
449
+ // substituted and compared as bytes: every project with ts, js or dart
450
+ // reported `src/cmp/<t>/fragment/Config.fragment.<ext>` as FORKED straight
451
+ // out of `target add`, which is precisely the noise this function exists to
452
+ // remove. With no `$$` refs and no replace keys, template() is the identity.
453
+ const expected = template(src, model, { replace })
454
+
455
+ return expected !== fs.readFileSync(projectPath, 'utf8')
456
+ }
457
+
458
+
459
+ // trimFeatures logs its decisions; doctor is a report, not a run.
460
+ function quietLog(log: any): any {
461
+ const noop = () => { }
462
+ const quiet: any = { info: noop, debug: noop, warn: log.warn.bind(log), error: noop, trace: noop, fatal: noop }
463
+ quiet.child = () => quiet
464
+ return quiet
465
+ }
466
+
467
+
468
+ export type {
469
+ DoctorReport,
470
+ }
471
+
472
+ export {
473
+ action_doctor,
474
+ doctor,
475
+ }
@@ -12,6 +12,8 @@ import {
12
12
 
13
13
  import { showChanges } from '@voxgig/util'
14
14
 
15
+ import { showDryrun } from '../helpers/dryrun'
16
+
15
17
  import {
16
18
  KIT
17
19
  } from '../types'
@@ -23,6 +25,8 @@ import type {
23
25
 
24
26
  import { SdkGenError } from '../utility'
25
27
 
28
+ import { findFeatureSources } from '../helpers/featureSource'
29
+
26
30
 
27
31
  import {
28
32
  UpdateIndex,
@@ -74,7 +78,17 @@ async function feature_add(features: string[], actx: ActionContext): Promise<Act
74
78
  url: actx.url,
75
79
  content: loadContent(actx, 'feature')
76
80
  },
77
- model: actx.model
81
+ model: actx.model,
82
+ // Dry run must be passed per-call, not left to the Jostraca instance.
83
+ // jostraca's `generate` runs its own options through OptionsShape FIRST,
84
+ // which fills in `control.dryrun: false`, and only then merges
85
+ // `deep({}, gOpts.control, opts.control)` — so the shape default silently
86
+ // OVERRIDES the instance-level flag. `-y target add ts` printed
87
+ // ** DRY RUN ** and wrote every file. (Same trap as the `existing` FIX
88
+ // note in jostraca.js.)
89
+ control: {
90
+ dryrun: !!actx.opts.dryrun
91
+ },
78
92
  }
79
93
 
80
94
  opts.log.info({
@@ -86,6 +100,10 @@ async function feature_add(features: string[], actx: ActionContext): Promise<Act
86
100
 
87
101
  showChanges(opts.log, 'feature-result', jres)
88
102
 
103
+ if (actx.opts.dryrun) {
104
+ showDryrun(opts.log, 'feature-result', jres, actx.folder)
105
+ }
106
+
89
107
  opts.log.info({
90
108
  point: 'feature-end',
91
109
  note: (actx.opts.dryrun ? '** DRY RUN **' : '')
@@ -101,6 +119,7 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
101
119
  const { ctx$, features } = props
102
120
  const { model, log } = ctx$
103
121
 
122
+ const fs = ctx$.fs()
104
123
  const target = model.main[KIT].target
105
124
 
106
125
  Project({}, () => {
@@ -127,22 +146,41 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
127
146
  }))
128
147
  })
129
148
 
130
- each(target, (t) =>
131
- Folder({ name: 'tm/' + t.name + '/src/feature/' + fname }, () => {
132
- const from = Path.join(
133
- (t.base || Path.join(BASE, '/project/.sdk')),
134
- 'tm',
135
- t.name,
136
- '/src/feature/',
137
- fname
138
- )
139
-
140
- Copy({
141
- // from: BASE + '/project/.sdk/tm/' + target.name + '/src/feature/' + name,
142
- from,
143
- exclude: true
149
+ // Bring in the feature's source for every target already in the model.
150
+ // Where that source lives is language-specific — `src/feature/<name>/`
151
+ // for ts and js, `feature/<name>_feature.go` for go,
152
+ // `lib/feature/<name>/` for dart, and so on — so discover it in the
153
+ // target's template tree instead of assuming one layout. Assuming
154
+ // `src/feature/<name>` meant `feature add` silently added nothing for
155
+ // every target that keeps feature source elsewhere.
156
+ each(target, (t) => {
157
+ const sdkfolder = t.base || Path.join(BASE, 'project/.sdk')
158
+ const tmfolder = Path.join(sdkfolder, 'tm', t.name)
159
+
160
+ const sources = findFeatureSources(fs, tmfolder, [fname])
161
+
162
+ if (0 === sources.length) {
163
+ log.warn({
164
+ point: 'feature-source-missing', feature: fname, target: t.name,
165
+ folder: tmfolder,
166
+ note: 'no ' + fname + ' source found for target ' + t.name
144
167
  })
145
- }))
168
+ return
169
+ }
170
+
171
+ for (const source of sources) {
172
+ // A folder source IS the destination folder; a file source goes
173
+ // into the folder that holds it.
174
+ const dest = source.folder ? source.path : Path.dirname(source.path)
175
+
176
+ Folder({ name: 'tm/' + t.name + '/' + dest }, () => {
177
+ Copy({
178
+ from: Path.join(tmfolder, source.path),
179
+ exclude: true
180
+ })
181
+ })
182
+ }
183
+ })
146
184
 
147
185
  log.info({
148
186
  point: 'feature-done', feature: fname,