@voxgig/sdkgen 4.32.1 → 4.34.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 (442) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/copies.d.ts +21 -0
  3. package/dist/action/copies.js +146 -0
  4. package/dist/action/copies.js.map +1 -0
  5. package/dist/action/doctor.d.ts +15 -2
  6. package/dist/action/doctor.js +169 -23
  7. package/dist/action/doctor.js.map +1 -1
  8. package/dist/action/edition.js +6 -2
  9. package/dist/action/edition.js.map +1 -1
  10. package/dist/action/feature.js +6 -2
  11. package/dist/action/feature.js.map +1 -1
  12. package/dist/action/package.js +28 -10
  13. package/dist/action/package.js.map +1 -1
  14. package/dist/action/remove.js +2 -0
  15. package/dist/action/remove.js.map +1 -1
  16. package/dist/action/resolve.d.ts +1 -0
  17. package/dist/action/resolve.js +10 -2
  18. package/dist/action/resolve.js.map +1 -1
  19. package/dist/action/target.js +6 -2
  20. package/dist/action/target.js.map +1 -1
  21. package/dist/helpers/naming.js +1 -1
  22. package/dist/helpers/naming.js.map +1 -1
  23. package/dist/sdkgen.d.ts +2 -1
  24. package/dist/sdkgen.js +36 -3
  25. package/dist/sdkgen.js.map +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/model/sdkgen.aontu +7 -1
  28. package/package.json +1 -1
  29. package/project/.sdk/model/feature/debug.aontu +3 -1
  30. package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +8 -28
  31. package/project/.sdk/src/cmp/c/TestClean_c.ts +774 -0
  32. package/project/.sdk/src/cmp/c/Test_c.ts +3 -0
  33. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +16 -5
  34. package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -1
  35. package/project/.sdk/src/cmp/clojure/PrepareAuth_clojure.ts +3 -0
  36. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +473 -0
  37. package/project/.sdk/src/cmp/clojure/Test_clojure.ts +6 -0
  38. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -8
  39. package/project/.sdk/src/cmp/cpp/PrepareAuth_cpp.ts +3 -0
  40. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +782 -0
  41. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +1 -1
  42. package/project/.sdk/src/cmp/cpp/Test_cpp.ts +2 -0
  43. package/project/.sdk/src/cmp/csharp/PrepareAuth_csharp.ts +3 -0
  44. package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +887 -0
  45. package/project/.sdk/src/cmp/csharp/Test_csharp.ts +2 -0
  46. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +68 -4
  47. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +8 -2
  48. package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +49 -0
  49. package/project/.sdk/src/cmp/elixir/PrepareAuth_elixir.ts +3 -0
  50. package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +20 -10
  51. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +666 -0
  52. package/project/.sdk/src/cmp/elixir/Test_elixir.ts +4 -0
  53. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +1 -1
  54. package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +14 -2
  55. package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +3 -0
  56. package/project/.sdk/src/cmp/go/TestClean_go.ts +804 -0
  57. package/project/.sdk/src/cmp/go/Test_go.ts +3 -0
  58. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +54 -4
  59. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +27 -2
  60. package/project/.sdk/src/cmp/java/PrepareAuth_java.ts +3 -0
  61. package/project/.sdk/src/cmp/java/TestClean_java.ts +884 -0
  62. package/project/.sdk/src/cmp/java/Test_java.ts +2 -0
  63. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +56 -11
  64. package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +36 -3
  65. package/project/.sdk/src/cmp/js/PrepareAuth_js.ts +3 -0
  66. package/project/.sdk/src/cmp/js/TestClean_js.ts +458 -0
  67. package/project/.sdk/src/cmp/js/Test_js.ts +2 -0
  68. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +5 -4
  69. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +7 -1
  70. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +7 -1
  71. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -1
  72. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -1
  73. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -1
  74. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +11 -2
  75. package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +17 -1
  76. package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +5 -0
  77. package/project/.sdk/src/cmp/kotlin/PrepareAuth_kotlin.ts +3 -0
  78. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +654 -0
  79. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +3 -0
  80. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +44 -11
  81. package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +31 -0
  82. package/project/.sdk/src/cmp/lua/PrepareAuth_lua.ts +3 -0
  83. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +769 -0
  84. package/project/.sdk/src/cmp/lua/Test_lua.ts +3 -0
  85. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +77 -1
  86. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +49 -2
  87. package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +3 -2
  88. package/project/.sdk/src/cmp/ocaml/PrepareAuth_ocaml.ts +4 -25
  89. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +538 -0
  90. package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +5 -0
  91. package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +16 -4
  92. package/project/.sdk/src/cmp/perl/PrepareAuth_perl.ts +3 -0
  93. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +619 -0
  94. package/project/.sdk/src/cmp/perl/Test_perl.ts +3 -0
  95. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +67 -5
  96. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +13 -1
  97. package/project/.sdk/src/cmp/php/PrepareAuth_php.ts +3 -0
  98. package/project/.sdk/src/cmp/php/TestClean_php.ts +809 -0
  99. package/project/.sdk/src/cmp/php/Test_php.ts +2 -0
  100. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +96 -55
  101. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +15 -2
  102. package/project/.sdk/src/cmp/py/PrepareAuth_py.ts +3 -0
  103. package/project/.sdk/src/cmp/py/TestClean_py.ts +549 -0
  104. package/project/.sdk/src/cmp/py/Test_py.ts +3 -0
  105. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +83 -55
  106. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +19 -3
  107. package/project/.sdk/src/cmp/rb/PrepareAuth_rb.ts +3 -0
  108. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +535 -0
  109. package/project/.sdk/src/cmp/rb/Test_rb.ts +3 -0
  110. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +108 -46
  111. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +12 -1
  112. package/project/.sdk/src/cmp/rust/PrepareAuth_rust.ts +9 -45
  113. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +881 -0
  114. package/project/.sdk/src/cmp/rust/Test_rust.ts +3 -0
  115. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +14 -6
  116. package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +17 -1
  117. package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -2
  118. package/project/.sdk/src/cmp/scala/PrepareAuth_scala.ts +3 -0
  119. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +608 -0
  120. package/project/.sdk/src/cmp/scala/Test_scala.ts +3 -0
  121. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +58 -6
  122. package/project/.sdk/src/cmp/swift/PrepareAuth_swift.ts +3 -0
  123. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +671 -0
  124. package/project/.sdk/src/cmp/swift/Test_swift.ts +3 -0
  125. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +10 -0
  126. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +16 -2
  127. package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +47 -3
  128. package/project/.sdk/src/cmp/ts/PrepareAuth_ts.ts +3 -0
  129. package/project/.sdk/src/cmp/ts/TestClean_ts.ts +465 -0
  130. package/project/.sdk/src/cmp/ts/Test_ts.ts +2 -0
  131. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +5 -4
  132. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +7 -1
  133. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +7 -1
  134. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +7 -1
  135. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +7 -1
  136. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +7 -1
  137. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +8 -2
  138. package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +20 -2
  139. package/project/.sdk/src/cmp/zig/PrepareAuth_zig.ts +3 -0
  140. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +791 -0
  141. package/project/.sdk/src/cmp/zig/Test_zig.ts +5 -0
  142. package/project/.sdk/src/cmp/zig/fragment/Build.fragment.zig +19 -0
  143. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +14 -5
  144. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +1 -1
  145. package/project/.sdk/tm/c/core/context.c +25 -0
  146. package/project/.sdk/tm/c/core/error.c +16 -0
  147. package/project/.sdk/tm/c/core/sdk.h +22 -0
  148. package/project/.sdk/tm/c/feature/audit.c +2 -0
  149. package/project/.sdk/tm/c/feature/cost.c +1 -0
  150. package/project/.sdk/tm/c/feature/debug.c +19 -29
  151. package/project/.sdk/tm/c/feature/log.c +21 -2
  152. package/project/.sdk/tm/c/feature/proxy.c +55 -3
  153. package/project/.sdk/tm/c/feature/secrets.c +7 -0
  154. package/project/.sdk/tm/c/feature/telemetry.c +2 -0
  155. package/project/.sdk/tm/c/tests/feature_test.c +2 -2
  156. package/project/.sdk/tm/c/utility/clean.c +530 -8
  157. package/project/.sdk/tm/c/utility/done.c +28 -12
  158. package/project/.sdk/tm/c/utility/make_error.c +4 -3
  159. package/project/.sdk/tm/c/utility/make_options.c +71 -45
  160. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +15 -0
  161. package/project/.sdk/tm/clojure/src/sdk/client.clj +20 -4
  162. package/project/.sdk/tm/clojure/src/sdk/core.clj +319 -35
  163. package/project/.sdk/tm/clojure/src/sdk/features.clj +68 -30
  164. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +4 -2
  165. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +47 -20
  166. package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +4 -0
  167. package/project/.sdk/tm/cpp/core/types.hpp +93 -3
  168. package/project/.sdk/tm/cpp/feature/audit.hpp +1 -0
  169. package/project/.sdk/tm/cpp/feature/cost.hpp +1 -0
  170. package/project/.sdk/tm/cpp/feature/debug.hpp +20 -12
  171. package/project/.sdk/tm/cpp/feature/log.hpp +31 -9
  172. package/project/.sdk/tm/cpp/feature/proxy.hpp +52 -6
  173. package/project/.sdk/tm/cpp/feature/secrets.hpp +13 -0
  174. package/project/.sdk/tm/cpp/feature/telemetry.hpp +4 -2
  175. package/project/.sdk/tm/cpp/test/feature_test.cpp +2 -2
  176. package/project/.sdk/tm/cpp/utility/pipeline.hpp +426 -51
  177. package/project/.sdk/tm/csharp/core/Context.cs +32 -0
  178. package/project/.sdk/tm/csharp/core/Utility.cs +2 -0
  179. package/project/.sdk/tm/csharp/feature/AuditFeature.cs +1 -0
  180. package/project/.sdk/tm/csharp/feature/CostFeature.cs +7 -5
  181. package/project/.sdk/tm/csharp/feature/DebugFeature.cs +19 -16
  182. package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +16 -0
  183. package/project/.sdk/tm/csharp/feature/LogFeature.cs +4 -1
  184. package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +26 -5
  185. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +16 -0
  186. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +4 -2
  187. package/project/.sdk/tm/csharp/test/FeatureTest.cs +2 -2
  188. package/project/.sdk/tm/csharp/utility/Clean.cs +440 -2
  189. package/project/.sdk/tm/csharp/utility/Done.cs +27 -11
  190. package/project/.sdk/tm/csharp/utility/MakeError.cs +19 -8
  191. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +119 -29
  192. package/project/.sdk/tm/csharp/utility/MakeResponse.cs +21 -11
  193. package/project/.sdk/tm/csharp/utility/Register.cs +1 -0
  194. package/project/.sdk/tm/elixir/lib/projectname/context.ex +19 -0
  195. package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +22 -1
  196. package/project/.sdk/tm/elixir/lib/projectname/error.ex +24 -0
  197. package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +2 -2
  198. package/project/.sdk/tm/elixir/lib/projectname/feature/cost.ex +2 -2
  199. package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +13 -13
  200. package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +18 -5
  201. package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +19 -1
  202. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +15 -0
  203. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +4 -2
  204. package/project/.sdk/tm/elixir/lib/projectname/feature.ex +22 -0
  205. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +464 -41
  206. package/project/.sdk/tm/elixir/test/feature_test.exs +3 -2
  207. package/project/.sdk/tm/go/core/context.go +42 -0
  208. package/project/.sdk/tm/go/core/error.go +30 -10
  209. package/project/.sdk/tm/go/core/utility_type.go +2 -0
  210. package/project/.sdk/tm/go/feature/audit_feature.go +1 -0
  211. package/project/.sdk/tm/go/feature/base_feature.go +12 -0
  212. package/project/.sdk/tm/go/feature/cost_feature.go +2 -2
  213. package/project/.sdk/tm/go/feature/debug_feature.go +14 -12
  214. package/project/.sdk/tm/go/feature/log_feature.go +13 -8
  215. package/project/.sdk/tm/go/feature/proxy_feature.go +26 -6
  216. package/project/.sdk/tm/go/feature/secrets_feature.go +19 -0
  217. package/project/.sdk/tm/go/feature/telemetry_feature.go +4 -2
  218. package/project/.sdk/tm/go/test/feature_test.go +2 -2
  219. package/project/.sdk/tm/go/utility/clean.go +585 -2
  220. package/project/.sdk/tm/go/utility/done.go +29 -9
  221. package/project/.sdk/tm/go/utility/make_error.go +51 -16
  222. package/project/.sdk/tm/go/utility/make_options.go +77 -36
  223. package/project/.sdk/tm/go/utility/register.go +12 -0
  224. package/project/.sdk/tm/java/core/Context.java +29 -0
  225. package/project/.sdk/tm/java/core/SdkClient.java +4 -2
  226. package/project/.sdk/tm/java/core/Utility.java +7 -0
  227. package/project/.sdk/tm/java/feature/AuditFeature.java +6 -0
  228. package/project/.sdk/tm/java/feature/CostFeature.java +5 -0
  229. package/project/.sdk/tm/java/feature/DebugFeature.java +25 -14
  230. package/project/.sdk/tm/java/feature/LogFeature.java +11 -4
  231. package/project/.sdk/tm/java/feature/ProxyFeature.java +41 -6
  232. package/project/.sdk/tm/java/feature/SecretsFeature.java +18 -0
  233. package/project/.sdk/tm/java/feature/TelemetryFeature.java +8 -2
  234. package/project/.sdk/tm/java/test/FeatureTest.java +2 -2
  235. package/project/.sdk/tm/java/utility/Clean.java +519 -1
  236. package/project/.sdk/tm/java/utility/Done.java +1 -1
  237. package/project/.sdk/tm/java/utility/MakeError.java +5 -1
  238. package/project/.sdk/tm/java/utility/MakeOptions.java +55 -31
  239. package/project/.sdk/tm/java/utility/Register.java +4 -0
  240. package/project/.sdk/tm/js/src/Context.js +5 -1
  241. package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +2 -2
  242. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +2 -2
  243. package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +13 -7
  244. package/project/.sdk/tm/js/src/feature/log/LogFeature.js +9 -5
  245. package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +19 -1
  246. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +14 -0
  247. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +4 -2
  248. package/project/.sdk/tm/js/src/utility/CleanUtility.js +294 -21
  249. package/project/.sdk/tm/js/src/utility/DoneUtility.js +17 -5
  250. package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +18 -2
  251. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -15
  252. package/project/.sdk/tm/js/src/utility/Utility.js +4 -2
  253. package/project/.sdk/tm/js/test/feature/harness.js +11 -1
  254. package/project/.sdk/tm/js/test/feature.test.js +9 -2
  255. package/project/.sdk/tm/kotlin/core/Context.kt +19 -0
  256. package/project/.sdk/tm/kotlin/core/SdkClient.kt +9 -2
  257. package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
  258. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +11 -9
  259. package/project/.sdk/tm/kotlin/feature/CostFeature.kt +8 -5
  260. package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +15 -22
  261. package/project/.sdk/tm/kotlin/feature/LogFeature.kt +8 -4
  262. package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +26 -2
  263. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +11 -0
  264. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +4 -2
  265. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +2 -2
  266. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +447 -11
  267. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +38 -31
  268. package/project/.sdk/tm/kotlin/utility/Register.kt +1 -0
  269. package/project/.sdk/tm/lua/core/context.lua +43 -0
  270. package/project/.sdk/tm/lua/core/error.lua +36 -1
  271. package/project/.sdk/tm/lua/core/utility_type.lua +4 -0
  272. package/project/.sdk/tm/lua/feature/audit_feature.lua +2 -2
  273. package/project/.sdk/tm/lua/feature/cost_feature.lua +2 -2
  274. package/project/.sdk/tm/lua/feature/debug_feature.lua +21 -17
  275. package/project/.sdk/tm/lua/feature/log_feature.lua +2 -1
  276. package/project/.sdk/tm/lua/feature/proxy_feature.lua +23 -1
  277. package/project/.sdk/tm/lua/feature/secrets_feature.lua +18 -0
  278. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +4 -2
  279. package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +3 -2
  280. package/project/.sdk/tm/lua/test/feature_test.lua +10 -3
  281. package/project/.sdk/tm/lua/utility/clean.lua +426 -2
  282. package/project/.sdk/tm/lua/utility/clean_explain.lua +34 -0
  283. package/project/.sdk/tm/lua/utility/done.lua +1 -7
  284. package/project/.sdk/tm/lua/utility/make_error.lua +3 -1
  285. package/project/.sdk/tm/lua/utility/make_options.lua +76 -30
  286. package/project/.sdk/tm/lua/utility/register.lua +4 -1
  287. package/project/.sdk/tm/ocaml/Makefile +5 -1
  288. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +12 -1
  289. package/project/.sdk/tm/ocaml/sdk_features.ml +78 -18
  290. package/project/.sdk/tm/ocaml/sdk_helpers.ml +27 -0
  291. package/project/.sdk/tm/ocaml/sdk_runtime.ml +304 -26
  292. package/project/.sdk/tm/ocaml/sdk_types.ml +1 -0
  293. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
  294. package/project/.sdk/tm/ocaml/test/t_feature.ml +2 -2
  295. package/project/.sdk/tm/perl/core/context.pm +27 -0
  296. package/project/.sdk/tm/perl/core/error.pm +52 -5
  297. package/project/.sdk/tm/perl/feature/audit_feature.pm +2 -2
  298. package/project/.sdk/tm/perl/feature/cost_feature.pm +2 -2
  299. package/project/.sdk/tm/perl/feature/debug_feature.pm +17 -13
  300. package/project/.sdk/tm/perl/feature/log_feature.pm +3 -1
  301. package/project/.sdk/tm/perl/feature/proxy_feature.pm +21 -1
  302. package/project/.sdk/tm/perl/feature/secrets_feature.pm +20 -1
  303. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +4 -2
  304. package/project/.sdk/tm/perl/t/feature.t +4 -2
  305. package/project/.sdk/tm/perl/utility/clean.pm +345 -1
  306. package/project/.sdk/tm/perl/utility/done.pm +24 -6
  307. package/project/.sdk/tm/perl/utility/make_error.pm +17 -4
  308. package/project/.sdk/tm/perl/utility/make_options.pm +33 -14
  309. package/project/.sdk/tm/php/core/Context.php +24 -1
  310. package/project/.sdk/tm/php/core/Error.php +34 -3
  311. package/project/.sdk/tm/php/core/UtilityType.php +4 -0
  312. package/project/.sdk/tm/php/feature/AuditFeature.php +2 -2
  313. package/project/.sdk/tm/php/feature/CostFeature.php +2 -2
  314. package/project/.sdk/tm/php/feature/DebugFeature.php +18 -9
  315. package/project/.sdk/tm/php/feature/LogFeature.php +5 -2
  316. package/project/.sdk/tm/php/feature/ProxyFeature.php +20 -1
  317. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -0
  318. package/project/.sdk/tm/php/feature/TelemetryFeature.php +4 -2
  319. package/project/.sdk/tm/php/test/FeatureTest.php +2 -2
  320. package/project/.sdk/tm/php/utility/Clean.php +438 -2
  321. package/project/.sdk/tm/php/utility/Done.php +14 -7
  322. package/project/.sdk/tm/php/utility/MakeError.php +9 -7
  323. package/project/.sdk/tm/php/utility/MakeOptions.php +62 -38
  324. package/project/.sdk/tm/php/utility/Register.php +2 -0
  325. package/project/.sdk/tm/py/pkg/core/context.py +17 -0
  326. package/project/.sdk/tm/py/pkg/core/error.py +42 -1
  327. package/project/.sdk/tm/py/pkg/core/utility_type.py +4 -0
  328. package/project/.sdk/tm/py/pkg/feature/audit_feature.py +2 -2
  329. package/project/.sdk/tm/py/pkg/feature/cost_feature.py +2 -2
  330. package/project/.sdk/tm/py/pkg/feature/debug_feature.py +17 -12
  331. package/project/.sdk/tm/py/pkg/feature/log_feature.py +2 -1
  332. package/project/.sdk/tm/py/pkg/feature/proxy_feature.py +18 -1
  333. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +12 -0
  334. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +4 -2
  335. package/project/.sdk/tm/py/pkg/utility/clean.py +311 -1
  336. package/project/.sdk/tm/py/pkg/utility/done.py +18 -5
  337. package/project/.sdk/tm/py/pkg/utility/make_error.py +9 -6
  338. package/project/.sdk/tm/py/pkg/utility/make_options.py +64 -25
  339. package/project/.sdk/tm/py/pkg/utility/make_response.py +19 -13
  340. package/project/.sdk/tm/py/pkg/utility/register.py +4 -2
  341. package/project/.sdk/tm/py/test/feature_harness.py +4 -0
  342. package/project/.sdk/tm/py/test/test_feature.py +2 -2
  343. package/project/.sdk/tm/py/test/test_primary_utility.py +1 -0
  344. package/project/.sdk/tm/rb/core/context.rb +28 -0
  345. package/project/.sdk/tm/rb/core/error.rb +30 -0
  346. package/project/.sdk/tm/rb/core/utility_type.rb +1 -1
  347. package/project/.sdk/tm/rb/feature/audit_feature.rb +2 -2
  348. package/project/.sdk/tm/rb/feature/cost_feature.rb +2 -2
  349. package/project/.sdk/tm/rb/feature/debug_feature.rb +15 -12
  350. package/project/.sdk/tm/rb/feature/log_feature.rb +3 -1
  351. package/project/.sdk/tm/rb/feature/proxy_feature.rb +25 -1
  352. package/project/.sdk/tm/rb/feature/secrets_feature.rb +17 -0
  353. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +4 -2
  354. package/project/.sdk/tm/rb/test/feature_test.rb +4 -2
  355. package/project/.sdk/tm/rb/utility/clean.rb +312 -1
  356. package/project/.sdk/tm/rb/utility/done.rb +15 -5
  357. package/project/.sdk/tm/rb/utility/make_error.rb +13 -4
  358. package/project/.sdk/tm/rb/utility/make_options.rb +31 -12
  359. package/project/.sdk/tm/rb/utility/register.rb +2 -0
  360. package/project/.sdk/tm/rust/core/context.rs +55 -0
  361. package/project/.sdk/tm/rust/core/utility_type.rs +17 -0
  362. package/project/.sdk/tm/rust/feature/audit.rs +2 -0
  363. package/project/.sdk/tm/rust/feature/cost.rs +3 -2
  364. package/project/.sdk/tm/rust/feature/debug.rs +16 -16
  365. package/project/.sdk/tm/rust/feature/log.rs +42 -7
  366. package/project/.sdk/tm/rust/feature/proxy.rs +48 -2
  367. package/project/.sdk/tm/rust/feature/secrets.rs +12 -0
  368. package/project/.sdk/tm/rust/feature/telemetry.rs +2 -0
  369. package/project/.sdk/tm/rust/tests/feature_test.rs +2 -2
  370. package/project/.sdk/tm/rust/utility/clean.rs +446 -5
  371. package/project/.sdk/tm/rust/utility/done.rs +22 -12
  372. package/project/.sdk/tm/rust/utility/make_error.rs +4 -1
  373. package/project/.sdk/tm/rust/utility/make_options.rs +73 -19
  374. package/project/.sdk/tm/scala/Makefile +3 -1
  375. package/project/.sdk/tm/scala/core/Context.scala +16 -0
  376. package/project/.sdk/tm/scala/core/SdkClient.scala +14 -4
  377. package/project/.sdk/tm/scala/core/SdkError.scala +28 -0
  378. package/project/.sdk/tm/scala/core/Types.scala +3 -0
  379. package/project/.sdk/tm/scala/core/Utility.scala +2 -0
  380. package/project/.sdk/tm/scala/feature/AuditFeature.scala +16 -10
  381. package/project/.sdk/tm/scala/feature/CostFeature.scala +10 -5
  382. package/project/.sdk/tm/scala/feature/DebugFeature.scala +24 -21
  383. package/project/.sdk/tm/scala/feature/LogFeature.scala +9 -4
  384. package/project/.sdk/tm/scala/feature/ProxyFeature.scala +23 -2
  385. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +14 -0
  386. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +9 -2
  387. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +2 -2
  388. package/project/.sdk/tm/scala/utility/Make.scala +63 -20
  389. package/project/.sdk/tm/scala/utility/Misc.scala +358 -5
  390. package/project/.sdk/tm/scala/utility/Register.scala +1 -0
  391. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +29 -0
  392. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +2 -0
  393. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +10 -9
  394. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +7 -5
  395. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +19 -15
  396. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +16 -0
  397. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +4 -1
  398. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +20 -5
  399. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +13 -0
  400. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +4 -2
  401. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +15 -5
  402. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +58 -19
  403. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +1 -0
  404. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +391 -4
  405. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +2 -2
  406. package/project/.sdk/tm/ts/src/Context.ts +5 -1
  407. package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +2 -2
  408. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +2 -2
  409. package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +13 -7
  410. package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +9 -5
  411. package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +19 -1
  412. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +12 -0
  413. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +4 -2
  414. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +287 -9
  415. package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +18 -5
  416. package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +18 -8
  417. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +38 -16
  418. package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -2
  419. package/project/.sdk/tm/ts/test/feature/harness.ts +11 -1
  420. package/project/.sdk/tm/ts/test/feature.test.ts +9 -2
  421. package/project/.sdk/tm/zig/core/context.zig +34 -0
  422. package/project/.sdk/tm/zig/core/error.zig +22 -1
  423. package/project/.sdk/tm/zig/core/utility.zig +403 -39
  424. package/project/.sdk/tm/zig/feature/audit.zig +4 -2
  425. package/project/.sdk/tm/zig/feature/cost.zig +3 -2
  426. package/project/.sdk/tm/zig/feature/debug.zig +20 -25
  427. package/project/.sdk/tm/zig/feature/log.zig +3 -1
  428. package/project/.sdk/tm/zig/feature/proxy.zig +47 -6
  429. package/project/.sdk/tm/zig/feature/secrets.zig +7 -0
  430. package/project/.sdk/tm/zig/feature/telemetry.zig +4 -2
  431. package/project/.sdk/tm/zig/test/feature_test.zig +2 -2
  432. package/project/sdkgen-package.json +1 -1
  433. package/src/action/copies.ts +219 -0
  434. package/src/action/doctor.ts +247 -21
  435. package/src/action/edition.ts +10 -2
  436. package/src/action/feature.ts +11 -2
  437. package/src/action/package.ts +31 -10
  438. package/src/action/remove.ts +4 -0
  439. package/src/action/resolve.ts +16 -3
  440. package/src/action/target.ts +10 -2
  441. package/src/helpers/naming.ts +1 -1
  442. package/src/sdkgen.ts +45 -5
@@ -37,6 +37,9 @@ import { findFeatureSources } from '../helpers/featureSource'
37
37
 
38
38
  import { isJunk } from '../helpers/junk'
39
39
 
40
+ import { readCopies, untouched, itemKey } from './copies'
41
+ import type { CopyRecord } from './copies'
42
+
40
43
 
41
44
  const IGNORED_RE = /(~|-jostraca-off)$/
42
45
 
@@ -97,10 +100,41 @@ type DoctorReport = {
97
100
  // it is what an alias is FOR.
98
101
  aliasedDiff: string[]
99
102
 
103
+ // Differs from its source, but the copy record shows it untouched since an
104
+ // add wrote it: the source moved on, so refreshing it discards nothing.
105
+ outdated: string[]
106
+
107
+ // The forked and edited findings the copy record has no entry for, so
108
+ // nothing shows whether the project changed them.
109
+ unrecorded: string[]
110
+
111
+ // Per item with findings, keyed `<kind>/<name>`.
112
+ byItem: Record<string, ItemDrift>
113
+
100
114
  ok: boolean
101
115
  }
102
116
 
103
117
 
118
+ type ItemDrift = {
119
+ // The package the item resolves to now, which is what refreshes it.
120
+ package?: string
121
+
122
+ // The version its copies came from, and the version installed now.
123
+ from?: string
124
+ to?: string
125
+
126
+ outdated: number
127
+
128
+ // Forked, edited, missing and stale files.
129
+ changed: number
130
+ }
131
+
132
+
133
+ type Category = 'forked' | 'edited' | 'missing' | 'stale'
134
+
135
+ type Found = (category: Category, label: string) => void
136
+
137
+
104
138
  const CMD_MAP: any = {
105
139
  check: cmd_doctor_check,
106
140
  prune: cmd_doctor_prune,
@@ -243,9 +277,12 @@ async function doctor(
243
277
  const report: DoctorReport = {
244
278
  forked: [], edited: [], stale: [], missing: [], additive: [],
245
279
  superseded: [], unwired: [], orphanModel: [],
246
- resyncPending: [], aliasedDiff: [], ok: true,
280
+ resyncPending: [], aliasedDiff: [],
281
+ outdated: [], unrecorded: [], byItem: {}, ok: true,
247
282
  }
248
283
 
284
+ const copies = readCopies(fs, root)
285
+
249
286
  report.superseded = supersededFiles(actx)
250
287
 
251
288
  report.orphanModel = orphanModelFiles(actx)
@@ -285,12 +322,14 @@ async function doctor(
285
322
  continue
286
323
  }
287
324
 
325
+ const found = noteDrift(actx, report, copies, kind, source)
326
+
288
327
  if ('target' === kind) {
289
- checkTarget(actx, source, report, selected)
328
+ checkTarget(actx, source, report, found, selected)
290
329
  }
291
330
 
292
331
  if ('edition' === kind) {
293
- checkEdition(actx, source, report)
332
+ checkEdition(actx, source, report, found)
294
333
  }
295
334
 
296
335
  // Only an ACTIVE feature has source copied out; an inactive one's
@@ -298,10 +337,10 @@ async function doctor(
298
337
  if ('feature' === kind &&
299
338
  (false !== (model as any)?.main?.[KIT]?.feature?.[name]?.active ||
300
339
  true === selected?.includes(name))) {
301
- checkFeatureSource(actx, source, targets, report)
340
+ checkFeatureSource(actx, source, targets, found)
302
341
  }
303
342
 
304
- checkItemModel(actx, kind, source, report)
343
+ checkItemModel(actx, kind, source, report, found)
305
344
  }
306
345
  }
307
346
 
@@ -316,7 +355,7 @@ async function doctor(
316
355
  // authoritative either way.
317
356
  report.ok = 0 === report.forked.length + report.edited.length +
318
357
  report.stale.length + report.missing.length + report.superseded.length +
319
- report.orphanModel.length
358
+ report.orphanModel.length + report.outdated.length
320
359
 
321
360
  for (const [kind, note] of [
322
361
  ['forked', 'FORKED (will be reverted by `target add`)'],
@@ -329,12 +368,24 @@ async function doctor(
329
368
  ['orphanModel', 'ORPHAN MODEL FILE (on disk, included by nothing, read by nobody)'],
330
369
  ['resyncPending', 'RESYNC PENDING (predates provenance; `target add` updates it)'],
331
370
  ['aliasedDiff', 'aliased model differs from its origin (project-owned, not drift)'],
371
+ ['outdated', 'OUTDATED (unchanged since it was copied, but its source has moved on)'],
332
372
  ] as [keyof DoctorReport, string][]) {
333
373
  for (const file of (report[kind] as string[])) {
334
374
  log.info({ point: 'doctor-finding', kind, file, note: note + ': ' + file })
335
375
  }
336
376
  }
337
377
 
378
+ for (const item of Object.keys(report.byItem).sort()) {
379
+ const drift = report.byItem[item]
380
+ if (0 < drift.outdated) {
381
+ log.info({
382
+ point: 'doctor-outdated', item, ...drift,
383
+ note: outdatedNote(item, drift) + ' - `voxgig-sdkgen ' +
384
+ refreshCommand(item, drift.package) + '` refreshes them'
385
+ })
386
+ }
387
+ }
388
+
338
389
  log.info({
339
390
  point: 'doctor-end',
340
391
  ok: report.ok,
@@ -348,11 +399,13 @@ async function doctor(
348
399
  orphanModel: report.orphanModel.length,
349
400
  resyncPending: report.resyncPending.length,
350
401
  aliasedDiff: report.aliasedDiff.length,
402
+ outdated: report.outdated.length,
351
403
  note: report.ok ?
352
404
  ('.sdk matches the scaffold (' + report.additive.length + ' additive)') :
353
405
  ('.sdk has drifted: ' + report.forked.length + ' forked, ' +
354
406
  report.edited.length + ' edited, ' + report.stale.length + ' stale, ' +
355
- report.missing.length + ' missing')
407
+ report.missing.length + ' missing, ' + report.outdated.length +
408
+ ' outdated')
356
409
  })
357
410
 
358
411
  return { report }
@@ -412,7 +465,7 @@ function resolveDeclared(
412
465
 
413
466
 
414
467
  function checkTarget(
415
- actx: ActionContext, resolved: Source, report: DoctorReport,
468
+ actx: ActionContext, resolved: Source, report: DoctorReport, found: Found,
416
469
  selected?: string[],
417
470
  ) {
418
471
  const tname = resolved.name
@@ -466,7 +519,7 @@ function checkTarget(
466
519
  { log: quietLog(actx.log), fs: () => fs, folder: root, model },
467
520
  tfolder, torigname, tname, features)
468
521
 
469
- compareTrees(actx, report, trees, {
522
+ compareTrees(actx, report, found, trees, {
470
523
  excludes,
471
524
  foreign: (kind: string) => 'edited' === kind ?
472
525
  foreignFeatureSource(actx, resolved) : [],
@@ -477,6 +530,7 @@ function checkTarget(
477
530
  function compareTrees(
478
531
  actx: ActionContext,
479
532
  report: DoctorReport,
533
+ found: Found,
480
534
  trees: TreeCompare[],
481
535
  opts?: {
482
536
  excludes?: RegExp[],
@@ -518,7 +572,7 @@ function compareTrees(
518
572
 
519
573
  for (const rel of expected) {
520
574
  if (!actualSet.has(rel)) {
521
- report.missing.push(label + rel)
575
+ found('missing', label + rel)
522
576
  continue
523
577
  }
524
578
 
@@ -535,7 +589,7 @@ function compareTrees(
535
589
 
536
590
  if (differs(fs, from, Path.join(tree.project, rel),
537
591
  model, tree.replace, undefined, tree.rewrite)) {
538
- report[tree.kind].push(label + rel)
592
+ found(tree.kind, label + rel)
539
593
  }
540
594
  }
541
595
 
@@ -553,7 +607,7 @@ function compareTrees(
553
607
  report.additive.push(label + rel)
554
608
  }
555
609
  else {
556
- report.stale.push(label + rel)
610
+ found('stale', label + rel)
557
611
  }
558
612
  }
559
613
  }
@@ -561,7 +615,7 @@ function compareTrees(
561
615
 
562
616
 
563
617
  function checkEdition(
564
- actx: ActionContext, resolved: Source, report: DoctorReport,
618
+ actx: ActionContext, resolved: Source, report: DoctorReport, found: Found,
565
619
  ) {
566
620
  const fs = actx.fs()
567
621
  const root = actx.folder
@@ -593,7 +647,7 @@ function checkEdition(
593
647
  } as TreeCompare]
594
648
  })
595
649
 
596
- compareTrees(actx, report, trees)
650
+ compareTrees(actx, report, found, trees)
597
651
  }
598
652
 
599
653
 
@@ -677,7 +731,7 @@ function checkFeatureSource(
677
731
  actx: ActionContext,
678
732
  feature: Source,
679
733
  targets: Map<string, Source>,
680
- report: DoctorReport,
734
+ found: Found,
681
735
  ) {
682
736
  const fs = actx.fs()
683
737
  const root = actx.folder
@@ -689,14 +743,14 @@ function checkFeatureSource(
689
743
  const label = 'tm/' + tname + '/' + rel
690
744
 
691
745
  if (!fs.existsSync(project)) {
692
- report.missing.push(label)
746
+ found('missing', label)
693
747
  continue
694
748
  }
695
749
 
696
750
  // The same map `feature add` copies with — see helpers/stdrep. A
697
751
  // different one here would report every substituted file as edited.
698
752
  if (differs(fs, from, project, model, templateReplacements(model, tname))) {
699
- report.edited.push(label)
753
+ found('edited', label)
700
754
  }
701
755
  }
702
756
  }
@@ -705,6 +759,7 @@ function checkFeatureSource(
705
759
 
706
760
  function checkItemModel(
707
761
  actx: ActionContext, kind: string, source: Source, report: DoctorReport,
762
+ found: Found,
708
763
  ) {
709
764
  const name = source.name
710
765
  const origname = source.origname
@@ -723,7 +778,7 @@ function checkItemModel(
723
778
  const label = 'model/' + kind + '/' + Path.basename(project)
724
779
 
725
780
  if (!fs.existsSync(project)) {
726
- report.missing.push(label)
781
+ found('missing', label)
727
782
  return
728
783
  }
729
784
 
@@ -746,7 +801,92 @@ function checkItemModel(
746
801
  return
747
802
  }
748
803
 
749
- report.forked.push(label)
804
+ found('forked', label)
805
+ }
806
+
807
+
808
+ // Files every finding through one place: a forked or edited copy the record
809
+ // shows untouched is outdated instead, and every item keeps a tally.
810
+ function noteDrift(
811
+ actx: ActionContext, report: DoctorReport, copies: CopyRecord,
812
+ kind: string, source: Source,
813
+ ): Found {
814
+ const fs = actx.fs()
815
+ const item = itemKey(kind, source.name)
816
+ const copied = copies.items[item]
817
+
818
+ return (category: Category, label: string) => {
819
+ let into: Category | 'outdated' = category
820
+
821
+ if ('forked' === category || 'edited' === category) {
822
+ const same = untouched(fs, actx.folder, copies, label)
823
+
824
+ if (true === same) {
825
+ into = 'outdated'
826
+ }
827
+ else if (undefined === same) {
828
+ report.unrecorded.push(label)
829
+ }
830
+ }
831
+
832
+ report[into].push(label)
833
+
834
+ const drift = report.byItem[item] = report.byItem[item] ?? {
835
+ ...pkgOf(source.package ?? copied?.package),
836
+ ...(null == copied?.version ? {} : { from: copied.version }),
837
+ ...(null == source.version ? {} : { to: source.version }),
838
+ outdated: 0,
839
+ changed: 0,
840
+ }
841
+
842
+ if ('outdated' === into) {
843
+ drift.outdated++
844
+ }
845
+ else {
846
+ drift.changed++
847
+ }
848
+ }
849
+ }
850
+
851
+
852
+ function pkgOf(name?: string): { package?: string } {
853
+ return null == name ? {} : { package: name }
854
+ }
855
+
856
+
857
+ // The command that brings an item's copies up to the installed source. The
858
+ // package form checks first and refuses to overwrite a local edit.
859
+ function refreshCommand(item: string, pkg?: string): string {
860
+ if (null != pkg) {
861
+ return 'package update ' + pkg + ' --no-fetch'
862
+ }
863
+
864
+ const [kind, ...name] = item.split('/')
865
+ return kind + ' add ' + name.join('/')
866
+ }
867
+
868
+
869
+ function outdatedNote(item: string, drift: ItemDrift): string {
870
+ return item.replace('/', ' ') + ': ' + drift.outdated +
871
+ ' file(s) are unchanged copies' + sinceCopied(drift.package, [drift])
872
+ }
873
+
874
+
875
+ // Names both versions only when they differ: a source that changed under the
876
+ // same version (a linked checkout, say) is still a source that moved on.
877
+ function sinceCopied(pkg: string | undefined, drift: ItemDrift[]): string {
878
+ const froms = Array.from(new Set(drift.map((d: ItemDrift) => d.from)))
879
+ const to = drift[0].to
880
+ const from = 1 === froms.length ? froms[0] : undefined
881
+ const name = pkg ?? 'their source'
882
+
883
+ if (null != from && null != to && from !== to) {
884
+ return ' from ' + name + ' ' + from + ', but ' + name + ' ' + to +
885
+ ' is installed'
886
+ }
887
+
888
+ return ', but ' + name + (null == to ? '' : ' ' + to) +
889
+ ' has changed since they were copied'
750
890
  }
751
891
 
752
892
 
@@ -868,13 +1008,19 @@ function renderPair(
868
1008
  const rawsrc = fs.readFileSync(scaffoldPath, 'utf8')
869
1009
  const src = null == rewrite ? rawsrc : rewrite(rawsrc)
870
1010
 
1011
+ // git may rewrite line endings on checkout (core.autocrlf).
871
1012
  return {
872
- expected: template(src, model, { replace }),
873
- actual: fs.readFileSync(projectPath, 'utf8'),
1013
+ expected: lfEndings(template(src, model, { replace })),
1014
+ actual: lfEndings(fs.readFileSync(projectPath, 'utf8')),
874
1015
  }
875
1016
  }
876
1017
 
877
1018
 
1019
+ function lfEndings(text: string): string {
1020
+ return text.replace(/\r\n/g, '\n')
1021
+ }
1022
+
1023
+
878
1024
  function quietLog(log: any): any {
879
1025
  const noop = () => { }
880
1026
  const quiet: any = { info: noop, debug: noop, warn: log.warn.bind(log), error: noop, trace: noop, fatal: noop }
@@ -883,12 +1029,92 @@ function quietLog(log: any): any {
883
1029
  }
884
1030
 
885
1031
 
1032
+ function silentLog(): any {
1033
+ const noop = () => { }
1034
+ const silent: any = { info: noop, debug: noop, warn: noop, error: noop, trace: noop, fatal: noop }
1035
+ silent.child = () => silent
1036
+ return silent
1037
+ }
1038
+
1039
+
1040
+ // What `generate` checks before it reads the copies: the active items only,
1041
+ // and a warning per refresh command rather than a failure, since a
1042
+ // difference may be a deliberate edit.
1043
+ async function copyCheck(actx: ActionContext): Promise<string[]> {
1044
+ const active = (kind: string, name: string) =>
1045
+ false !== kindCollection(actx.model, kind)?.[name]?.active
1046
+
1047
+ const res: any = await doctor({ ...actx, log: silentLog() }, active)
1048
+
1049
+ return copyWarnings(res.report)
1050
+ }
1051
+
1052
+
1053
+ function copyWarnings(report: DoctorReport): string[] {
1054
+ const groups = new Map<string, { items: string[], files: number, drift: ItemDrift[] }>()
1055
+
1056
+ const add = (key: string, item: string, files: number, drift: ItemDrift) => {
1057
+ const group = groups.get(key) ?? { items: [], files: 0, drift: [] }
1058
+ group.items.push(item.replace('/', ' '))
1059
+ group.files += files
1060
+ group.drift.push(drift)
1061
+ groups.set(key, group)
1062
+ }
1063
+
1064
+ for (const item of Object.keys(report.byItem).sort()) {
1065
+ const drift = report.byItem[item]
1066
+ const command = refreshCommand(item, drift.package)
1067
+
1068
+ if (0 < drift.outdated) {
1069
+ add('outdated\n' + command, item, drift.outdated, drift)
1070
+ }
1071
+
1072
+ if (0 < drift.changed) {
1073
+ add('changed\n' + command, item, drift.changed, drift)
1074
+ }
1075
+ }
1076
+
1077
+ const lines: string[] = []
1078
+
1079
+ for (const [key, group] of groups) {
1080
+ const [what, command] = key.split('\n')
1081
+ const pkg = group.drift[0].package
1082
+ const to = group.drift[0].to
1083
+ const installed = null == pkg ? 'their source' :
1084
+ (pkg + (null == to ? '' : ' ' + to))
1085
+ const refresh = '`npx voxgig-sdkgen ' + command + '`'
1086
+
1087
+ if ('outdated' === what) {
1088
+ lines.push(group.items.join(', ') + ': ' + group.files +
1089
+ ' file(s) in .sdk are unchanged copies' +
1090
+ sinceCopied(pkg, group.drift) + ', so this run generates from ' +
1091
+ 'older templates. Run ' + refresh + ' to refresh them.')
1092
+ }
1093
+ else {
1094
+ lines.push(group.items.join(', ') + ': ' + group.files +
1095
+ ' file(s) in .sdk differ from what ' + installed + ' installs: ' +
1096
+ 'changed in this project, or copied before sdkgen recorded its ' +
1097
+ 'copies. `npx voxgig-sdkgen doctor` lists them; ' + refresh +
1098
+ ' refreshes them' +
1099
+ (null == pkg ? ', discarding any local edit.' :
1100
+ ', and refuses before it overwrites a local edit.'))
1101
+ }
1102
+ }
1103
+
1104
+ return lines
1105
+ }
1106
+
1107
+
886
1108
  export type {
887
1109
  DoctorReport,
888
1110
  DoctorScope,
1111
+ ItemDrift,
889
1112
  }
890
1113
 
891
1114
  export {
892
1115
  action_doctor,
893
1116
  doctor,
1117
+ copyCheck,
1118
+ copyWarnings,
1119
+ refreshCommand,
894
1120
  }
@@ -17,6 +17,9 @@ import { resolveKind, kindModel, kindIndex, kindTrees } from './kind'
17
17
  import type { TreeDef } from './kind'
18
18
 
19
19
  import { registerInstalled } from './resolve'
20
+ import type { Source } from './resolve'
21
+
22
+ import { recordCopies } from './copies'
20
23
 
21
24
  import { aliasCmpTree, pruneStaleTemplates } from './target'
22
25
 
@@ -107,8 +110,12 @@ async function edition_add(
107
110
  // Later items in the command read this in-memory registration.
108
111
  registerInstalled('edition', edition, actx)
109
112
 
113
+ const installed: Source[] = []
114
+
110
115
  const jres = await jostraca.generate(opts, () =>
111
- EditionRoot({ edition, actx }))
116
+ EditionRoot({ edition, actx, installed }))
117
+
118
+ recordCopies(actx, jres, 'edition', installed)
112
119
 
113
120
  return { jres }
114
121
  }
@@ -139,7 +146,7 @@ function preflight(edition: string[], actx: ActionContext) {
139
146
 
140
147
 
141
148
  const EditionRoot = cmp(function EditionRoot(props: any) {
142
- const { ctx$, edition } = props
149
+ const { ctx$, edition, installed } = props
143
150
  const { log } = ctx$
144
151
 
145
152
  Project({}, () => {
@@ -153,6 +160,7 @@ const EditionRoot = cmp(function EditionRoot(props: any) {
153
160
  const source = resolveKind(dref, 'edition', ctx$)
154
161
 
155
162
  dnames.push(source.name)
163
+ installed?.push(source)
156
164
 
157
165
  log.info({
158
166
  point: 'edition-name', edition: source.name, folder: source.folder, ref: dref,
@@ -32,6 +32,9 @@ import { templateReplacements } from '../helpers/stdrep'
32
32
  import { copyOpts } from '../helpers/junk'
33
33
 
34
34
  import { resolveKind, kindModel, kindIndex } from './kind'
35
+ import type { Source } from './resolve'
36
+
37
+ import { recordCopies } from './copies'
35
38
 
36
39
 
37
40
  import {
@@ -111,10 +114,15 @@ async function feature_add(features: string[], actx: ActionContext): Promise<Act
111
114
  note: (actx.opts.dryrun ? '** DRY RUN **' : '')
112
115
  })
113
116
 
114
- const jres = await jostraca.generate(opts, () => FeatureRoot({ features }))
117
+ const installed: Source[] = []
118
+
119
+ const jres = await jostraca.generate(opts, () =>
120
+ FeatureRoot({ features, installed }))
115
121
 
116
122
  showChanges(opts.log, 'feature-result', jres)
117
123
 
124
+ recordCopies(actx, jres, 'feature', installed)
125
+
118
126
  if (actx.opts.dryrun) {
119
127
  showDryrun(opts.log, 'feature-result', jres, actx.folder)
120
128
  }
@@ -131,7 +139,7 @@ async function feature_add(features: string[], actx: ActionContext): Promise<Act
131
139
 
132
140
 
133
141
  const FeatureRoot = cmp(function FeatureRoot(props: any) {
134
- const { ctx$, features } = props
142
+ const { ctx$, features, installed } = props
135
143
  const { model, log } = ctx$
136
144
 
137
145
  const fs = ctx$.fs()
@@ -167,6 +175,7 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
167
175
 
168
176
  const fname = source.name
169
177
  fnames.push(fname)
178
+ installed?.push(source)
170
179
 
171
180
  log.info({
172
181
  point: 'feature-build',
@@ -29,6 +29,8 @@ import { cmd_package_check } from './check'
29
29
 
30
30
  import { doctor } from './doctor'
31
31
 
32
+ import { COPIES } from './copies'
33
+
32
34
  import { resolveSource, registerInstalled, nameConflict } from './resolve'
33
35
  import type { Source } from './resolve'
34
36
 
@@ -639,6 +641,16 @@ async function preCheck(
639
641
 
640
642
  const report = res.report
641
643
 
644
+ // Unchanged since an add wrote them, so refreshing them loses nothing.
645
+ if (0 < report.outdated.length) {
646
+ actx.log.info({
647
+ point: 'package-update-outdated', package: pkgname,
648
+ files: report.outdated.length,
649
+ note: pkgname + ': ' + report.outdated.length + ' outdated file(s) ' +
650
+ 'will be refreshed; ' + COPIES + ' shows nothing in them was changed'
651
+ })
652
+ }
653
+
642
654
  const changed = [...report.forked, ...report.edited]
643
655
 
644
656
  if (0 === changed.length) {
@@ -654,19 +666,28 @@ async function preCheck(
654
666
  return
655
667
  }
656
668
 
669
+ const unrecorded = new Set<string>(report.unrecorded)
670
+ const edited = changed.filter((file: string) => !unrecorded.has(file))
671
+ const unknown = changed.filter((file: string) => unrecorded.has(file))
672
+
657
673
  throw new SdkGenError(
658
674
  pkgname + ': ' + changed.length + ' file(s) differ from the installed ' +
659
675
  'source, so updating would overwrite them:\n ' + changed.join('\n ') +
660
- '\n\n This means one of two things, and nothing recorded in the project ' +
661
- 'tells them apart:' +
662
- '\n - they are LOCAL EDITS, and `--force` will discard them;' +
663
- '\n - or ' + pkgname + ' was already updated out of band (an ' +
664
- '`npm update` in another shell), in which case they are merely STALE ' +
665
- 'and nothing is at risk.' +
666
- '\n\n If you did not update it: copy anything you want to keep into ' +
667
- '.sdk/model/, then re-run with --force.' +
668
- '\n If you did: reinstall the version you had, re-run this command, ' +
669
- 'and it will check against the right source.')
676
+ (0 === edited.length ? '' :
677
+ '\n\n ' + edited.length + ' of them changed in this project after ' +
678
+ 'an add wrote them (' + COPIES + ' records what it wrote), so updating ' +
679
+ 'would discard those edits.') +
680
+ (0 === unknown.length ? '' :
681
+ '\n\n ' + unknown.length + ' of them predate ' + COPIES + ', so ' +
682
+ 'nothing tells these two apart:' +
683
+ '\n - they are LOCAL EDITS, and `--force` will discard them;' +
684
+ '\n - or ' + pkgname + ' was already updated out of band (an ' +
685
+ '`npm update` in another shell), in which case they are merely STALE ' +
686
+ 'and nothing is at risk.' +
687
+ '\n If you updated it and changed nothing, --force is safe. To check ' +
688
+ 'first, reinstall the version you had and re-run this command.') +
689
+ '\n\n Copy anything you want to keep into .sdk/model/, then re-run ' +
690
+ 'with --force.')
670
691
  }
671
692
 
672
693
 
@@ -29,6 +29,8 @@ import { removeIndexEntries } from './action'
29
29
 
30
30
  import { doctor } from './doctor'
31
31
 
32
+ import { forgetCopies } from './copies'
33
+
32
34
 
33
35
  // Everything one `remove` would touch, decided before anything is written.
34
36
  type RemovePlan = {
@@ -121,6 +123,8 @@ async function kind_remove(
121
123
  }
122
124
 
123
125
  removed.push(...applyRemove(plan, actx, dryrun))
126
+
127
+ forgetCopies(actx, kind, plan.name)
124
128
  }
125
129
 
126
130
  log.info({
@@ -30,6 +30,9 @@ type Source = {
30
30
  // The sdkgen package that provided it, when the source has a manifest.
31
31
  // Undefined for a bare `.sdk`-shaped folder, which stays legal.
32
32
  package?: string
33
+
34
+ // That package's version, read from the same manifest.
35
+ version?: string
33
36
  }
34
37
 
35
38
 
@@ -113,6 +116,8 @@ function resolveSource(ref: string, kind: string, ctx$: any): Source {
113
116
  const nroot = Path.normalize(root)
114
117
  const rootslash = nroot.endsWith(Path.sep) ? nroot : nroot + Path.sep
115
118
 
119
+ const owner = sourcePackage(fs, folder, kind, origname, ctx$)
120
+
116
121
  return {
117
122
  name,
118
123
  origname,
@@ -125,14 +130,17 @@ function resolveSource(ref: string, kind: string, ctx$: any): Source {
125
130
  // separator path that some readers handle and others do not.
126
131
  model: definitionPathAny(fs, folder, kind, origname),
127
132
 
128
- package: sourcePackage(fs, folder, kind, origname, ctx$),
133
+ ...(null == owner ? {} : {
134
+ package: owner.name,
135
+ ...(null == owner.version ? {} : { version: owner.version }),
136
+ }),
129
137
  }
130
138
  }
131
139
 
132
140
 
133
141
  function sourcePackage(
134
142
  fs: any, folder: string, kind: string, origname: string, ctx$: any,
135
- ): string | undefined {
143
+ ): { name: string, version?: string } | undefined {
136
144
  const read = readManifest(fs, folder)
137
145
 
138
146
  if (null != read.err) {
@@ -164,7 +172,12 @@ function sourcePackage(
164
172
  return undefined
165
173
  }
166
174
 
167
- return read.manifest.name
175
+ const version = read.manifest.version
176
+
177
+ return {
178
+ name: read.manifest.name,
179
+ ...('string' === typeof version && '' !== version ? { version } : {}),
180
+ }
168
181
  }
169
182
 
170
183