semantifold 0.2.0 → 0.3.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 (356) hide show
  1. package/README.md +37 -12
  2. package/build/index.js +2 -2
  3. package/build/src/acceptance.d.ts +10 -0
  4. package/build/src/acceptance.d.ts.map +1 -1
  5. package/build/src/acceptance.js +24 -5
  6. package/build/src/backends/c-runtime.d.ts +3 -0
  7. package/build/src/backends/c-runtime.d.ts.map +1 -0
  8. package/build/src/backends/c-runtime.js +151 -0
  9. package/build/src/backends/c-validation.d.ts +12 -0
  10. package/build/src/backends/c-validation.d.ts.map +1 -0
  11. package/build/src/backends/c-validation.js +85 -0
  12. package/build/src/backends/c.d.ts +31 -0
  13. package/build/src/backends/c.d.ts.map +1 -0
  14. package/build/src/backends/c.js +308 -0
  15. package/build/src/backends/cpp-runtime.d.ts +3 -0
  16. package/build/src/backends/cpp-runtime.d.ts.map +1 -0
  17. package/build/src/backends/cpp-runtime.js +99 -0
  18. package/build/src/backends/cpp-validation.d.ts +9 -0
  19. package/build/src/backends/cpp-validation.d.ts.map +1 -0
  20. package/build/src/backends/cpp-validation.js +74 -0
  21. package/build/src/backends/cpp.d.ts +16 -0
  22. package/build/src/backends/cpp.d.ts.map +1 -0
  23. package/build/src/backends/cpp.js +285 -0
  24. package/build/src/backends/csharp.d.ts +20 -0
  25. package/build/src/backends/csharp.d.ts.map +1 -0
  26. package/build/src/backends/csharp.js +259 -0
  27. package/build/src/backends/go.d.ts +20 -0
  28. package/build/src/backends/go.d.ts.map +1 -0
  29. package/build/src/backends/go.js +374 -0
  30. package/build/src/backends/identifiers.d.ts +12 -0
  31. package/build/src/backends/identifiers.d.ts.map +1 -1
  32. package/build/src/backends/identifiers.js +71 -2
  33. package/build/src/backends/index.d.ts.map +1 -1
  34. package/build/src/backends/index.js +9 -1
  35. package/build/src/backends/native-validation.d.ts +9 -0
  36. package/build/src/backends/native-validation.d.ts.map +1 -0
  37. package/build/src/backends/native-validation.js +59 -0
  38. package/build/src/backends/ordered-expressions.d.ts +74 -0
  39. package/build/src/backends/ordered-expressions.d.ts.map +1 -0
  40. package/build/src/backends/ordered-expressions.js +159 -0
  41. package/build/src/backends/scalars.d.ts.map +1 -1
  42. package/build/src/backends/scalars.js +7 -2
  43. package/build/src/backends/shared.d.ts.map +1 -1
  44. package/build/src/backends/shared.js +59 -14
  45. package/build/src/frontends/c-parser.d.ts +20 -0
  46. package/build/src/frontends/c-parser.d.ts.map +1 -0
  47. package/build/src/frontends/c-parser.js +14 -0
  48. package/build/src/frontends/c.d.ts +220 -0
  49. package/build/src/frontends/c.d.ts.map +1 -0
  50. package/build/src/frontends/c.js +750 -0
  51. package/build/src/frontends/cpp-parser.d.ts +11 -0
  52. package/build/src/frontends/cpp-parser.d.ts.map +1 -0
  53. package/build/src/frontends/cpp-parser.js +15 -0
  54. package/build/src/frontends/cpp.d.ts +227 -0
  55. package/build/src/frontends/cpp.d.ts.map +1 -0
  56. package/build/src/frontends/cpp.js +784 -0
  57. package/build/src/frontends/csharp.d.ts +14 -0
  58. package/build/src/frontends/csharp.d.ts.map +1 -0
  59. package/build/src/frontends/csharp.js +708 -0
  60. package/build/src/frontends/go.d.ts +15 -0
  61. package/build/src/frontends/go.d.ts.map +1 -0
  62. package/build/src/frontends/go.js +712 -0
  63. package/build/src/frontends/scalars.d.ts.map +1 -1
  64. package/build/src/frontends/scalars.js +16 -1
  65. package/build/src/language-registry.d.ts.map +1 -1
  66. package/build/src/language-registry.js +51 -2
  67. package/build/src/mapping.js +2 -2
  68. package/build/src/semantic/provenance.js +3 -3
  69. package/build/src/semantic/types.d.ts +4 -4
  70. package/build/src/semantic/types.d.ts.map +1 -1
  71. package/build/src/semantic/types.js +3 -3
  72. package/build/src/subprocess.d.ts +10 -1
  73. package/build/src/subprocess.d.ts.map +1 -1
  74. package/build/src/subprocess.js +29 -3
  75. package/build/src/toolchains.d.ts +24 -0
  76. package/build/src/toolchains.d.ts.map +1 -1
  77. package/build/src/toolchains.js +6 -2
  78. package/docs/architecture.md +20 -6
  79. package/docs/c.md +60 -0
  80. package/docs/cpp.md +61 -0
  81. package/docs/goals.md +4 -2
  82. package/docs/language-support.md +27 -8
  83. package/docs/parser-qualification.md +153 -4
  84. package/docs/plans/2026-09-05-standard-library-portability.md +46 -0
  85. package/docs/source-maps.md +11 -5
  86. package/docs/standard-library-portability.md +190 -0
  87. package/docs/testing.md +113 -4
  88. package/index.js +1 -1
  89. package/node_modules/node-addon-api/LICENSE.md +9 -0
  90. package/node_modules/node-addon-api/README.md +95 -0
  91. package/node_modules/node-addon-api/common.gypi +21 -0
  92. package/node_modules/node-addon-api/except.gypi +25 -0
  93. package/node_modules/node-addon-api/index.js +14 -0
  94. package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
  95. package/node_modules/node-addon-api/napi-inl.h +7250 -0
  96. package/node_modules/node-addon-api/napi.h +3463 -0
  97. package/node_modules/node-addon-api/node_addon_api.gyp +42 -0
  98. package/node_modules/node-addon-api/node_api.gyp +9 -0
  99. package/node_modules/node-addon-api/noexcept.gypi +26 -0
  100. package/node_modules/node-addon-api/nothing.c +0 -0
  101. package/node_modules/node-addon-api/package-support.json +21 -0
  102. package/node_modules/node-addon-api/package.json +481 -0
  103. package/node_modules/node-addon-api/tools/README.md +73 -0
  104. package/node_modules/node-addon-api/tools/check-napi.js +99 -0
  105. package/node_modules/node-addon-api/tools/clang-format.js +71 -0
  106. package/node_modules/node-addon-api/tools/conversion.js +301 -0
  107. package/node_modules/node-gyp-build/LICENSE +21 -0
  108. package/node_modules/node-gyp-build/README.md +58 -0
  109. package/node_modules/node-gyp-build/SECURITY.md +5 -0
  110. package/node_modules/node-gyp-build/bin.js +84 -0
  111. package/node_modules/node-gyp-build/build-test.js +19 -0
  112. package/node_modules/node-gyp-build/index.js +6 -0
  113. package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
  114. package/node_modules/node-gyp-build/optional.js +7 -0
  115. package/node_modules/node-gyp-build/package.json +43 -0
  116. package/node_modules/semantifold-tree-sitter-legacy-internal/LICENSE +15 -0
  117. package/node_modules/semantifold-tree-sitter-legacy-internal/README.md +7 -0
  118. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/LICENSE +21 -0
  119. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/README.md +90 -0
  120. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/binding.gyp +79 -0
  121. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/index.js +895 -0
  122. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/package.json +62 -0
  123. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
  124. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
  125. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
  126. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
  127. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/addon_data.h +47 -0
  128. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/binding.cc +35 -0
  129. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/conversions.cc +140 -0
  130. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/conversions.h +22 -0
  131. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/language.cc +106 -0
  132. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/language.h +17 -0
  133. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/logger.cc +70 -0
  134. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/logger.h +19 -0
  135. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  136. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  137. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/node.cc +1056 -0
  138. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/node.h +30 -0
  139. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/parser.cc +298 -0
  140. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/parser.h +35 -0
  141. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/query.cc +383 -0
  142. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/query.h +39 -0
  143. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree.cc +307 -0
  144. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree.h +45 -0
  145. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  146. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  147. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/tree-sitter.d.ts +211 -0
  148. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1266 -0
  149. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  150. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  151. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +290 -0
  152. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  153. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  154. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
  155. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +501 -0
  156. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
  157. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  158. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +221 -0
  159. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +299 -0
  160. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  161. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +419 -0
  162. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
  163. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +14 -0
  164. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +774 -0
  165. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2151 -0
  166. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +230 -0
  167. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
  168. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4134 -0
  169. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
  170. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
  171. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
  172. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
  173. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1060 -0
  174. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +382 -0
  175. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +165 -0
  176. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  177. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +714 -0
  178. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
  179. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
  180. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  181. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
  182. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
  183. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
  184. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
  185. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
  186. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
  187. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
  188. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +50 -0
  189. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +23 -0
  190. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +109 -0
  191. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1294 -0
  192. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1823 -0
  193. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
  194. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/LICENSE +21 -0
  195. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/README.md +18 -0
  196. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/binding.gyp +29 -0
  197. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/binding.cc +20 -0
  198. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/binding_test.js +9 -0
  199. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/index.d.ts +28 -0
  200. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/index.js +11 -0
  201. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/grammar.js +1470 -0
  202. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/package.json +60 -0
  203. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/darwin-arm64/tree-sitter-c.node +0 -0
  204. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/darwin-x64/tree-sitter-c.node +0 -0
  205. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/linux-arm64/tree-sitter-c.node +0 -0
  206. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/linux-x64/tree-sitter-c.node +0 -0
  207. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/win32-arm64/tree-sitter-c.node +0 -0
  208. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/win32-x64/tree-sitter-c.node +0 -0
  209. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/queries/highlights.scm +81 -0
  210. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/queries/tags.scm +9 -0
  211. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/grammar.json +9735 -0
  212. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/node-types.json +4614 -0
  213. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/parser.c +119615 -0
  214. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/alloc.h +54 -0
  215. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/array.h +290 -0
  216. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/parser.h +266 -0
  217. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/tree-sitter-c.wasm +0 -0
  218. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/tree-sitter.json +43 -0
  219. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/LICENSE +21 -0
  220. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/README.md +22 -0
  221. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/binding.gyp +30 -0
  222. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/binding.cc +20 -0
  223. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/binding_test.js +9 -0
  224. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/index.d.ts +28 -0
  225. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/index.js +11 -0
  226. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/grammar.js +1436 -0
  227. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/package.json +61 -0
  228. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/darwin-arm64/tree-sitter-cpp.node +0 -0
  229. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/darwin-x64/tree-sitter-cpp.node +0 -0
  230. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/linux-arm64/tree-sitter-cpp.node +0 -0
  231. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/linux-x64/tree-sitter-cpp.node +0 -0
  232. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/win32-arm64/tree-sitter-cpp.node +0 -0
  233. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/win32-x64/tree-sitter-cpp.node +0 -0
  234. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/highlights.scm +70 -0
  235. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/injections.scm +3 -0
  236. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/tags.scm +15 -0
  237. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/grammar.json +17084 -0
  238. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/node-types.json +7997 -0
  239. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/parser.c +530368 -0
  240. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/scanner.c +148 -0
  241. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/alloc.h +54 -0
  242. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/array.h +290 -0
  243. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/parser.h +266 -0
  244. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/tree-sitter-cpp.wasm +0 -0
  245. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/tree-sitter.json +55 -0
  246. package/node_modules/semantifold-tree-sitter-legacy-internal/package.json +22 -0
  247. package/node_modules/semantifold-tree-sitter-legacy-internal/src/c.js +152 -0
  248. package/node_modules/tree-sitter/LICENSE +21 -0
  249. package/node_modules/tree-sitter/README.md +128 -0
  250. package/node_modules/tree-sitter/binding.gyp +88 -0
  251. package/node_modules/tree-sitter/index.js +950 -0
  252. package/node_modules/tree-sitter/package.json +76 -0
  253. package/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
  254. package/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
  255. package/node_modules/tree-sitter/prebuilds/linux-arm64/tree-sitter.node +0 -0
  256. package/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
  257. package/node_modules/tree-sitter/prebuilds/win32-arm64/tree-sitter.node +0 -0
  258. package/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
  259. package/node_modules/tree-sitter/src/addon_data.h +47 -0
  260. package/node_modules/tree-sitter/src/binding.cc +35 -0
  261. package/node_modules/tree-sitter/src/conversions.cc +140 -0
  262. package/node_modules/tree-sitter/src/conversions.h +22 -0
  263. package/node_modules/tree-sitter/src/language.cc +105 -0
  264. package/node_modules/tree-sitter/src/language.h +17 -0
  265. package/node_modules/tree-sitter/src/logger.cc +70 -0
  266. package/node_modules/tree-sitter/src/logger.h +19 -0
  267. package/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  268. package/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  269. package/node_modules/tree-sitter/src/node.cc +1088 -0
  270. package/node_modules/tree-sitter/src/node.h +30 -0
  271. package/node_modules/tree-sitter/src/parser.cc +332 -0
  272. package/node_modules/tree-sitter/src/parser.h +35 -0
  273. package/node_modules/tree-sitter/src/query.cc +425 -0
  274. package/node_modules/tree-sitter/src/query.h +40 -0
  275. package/node_modules/tree-sitter/src/tree.cc +316 -0
  276. package/node_modules/tree-sitter/src/tree.h +45 -0
  277. package/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  278. package/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  279. package/node_modules/tree-sitter/tree-sitter.d.ts +1083 -0
  280. package/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1478 -0
  281. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  282. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  283. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +291 -0
  284. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  285. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  286. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
  287. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +523 -0
  288. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
  289. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  290. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +293 -0
  291. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +293 -0
  292. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  293. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +483 -0
  294. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +54 -0
  295. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +12 -0
  296. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +875 -0
  297. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2297 -0
  298. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +286 -0
  299. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +48 -0
  300. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/portable/endian.h +241 -0
  301. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4347 -0
  302. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
  303. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
  304. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +912 -0
  305. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
  306. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1034 -0
  307. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +399 -0
  308. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +170 -0
  309. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  310. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +716 -0
  311. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
  312. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/ts_assert.h +11 -0
  313. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
  314. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  315. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
  316. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
  317. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
  318. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
  319. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
  320. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
  321. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
  322. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +75 -0
  323. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +24 -0
  324. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +137 -0
  325. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1314 -0
  326. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1937 -0
  327. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
  328. package/package.json +21 -5
  329. package/src/acceptance.js +25 -4
  330. package/src/backends/c-runtime.js +151 -0
  331. package/src/backends/c-validation.js +83 -0
  332. package/src/backends/c.js +308 -0
  333. package/src/backends/cpp-runtime.js +99 -0
  334. package/src/backends/cpp-validation.js +70 -0
  335. package/src/backends/cpp.js +285 -0
  336. package/src/backends/csharp.js +270 -0
  337. package/src/backends/go.js +383 -0
  338. package/src/backends/identifiers.js +72 -1
  339. package/src/backends/index.js +7 -0
  340. package/src/backends/native-validation.js +64 -0
  341. package/src/backends/ordered-expressions.js +161 -0
  342. package/src/backends/scalars.js +7 -1
  343. package/src/backends/shared.js +56 -12
  344. package/src/frontends/c-parser.js +17 -0
  345. package/src/frontends/c.js +780 -0
  346. package/src/frontends/cpp-parser.js +18 -0
  347. package/src/frontends/cpp.js +816 -0
  348. package/src/frontends/csharp.js +759 -0
  349. package/src/frontends/go.js +770 -0
  350. package/src/frontends/scalars.js +15 -0
  351. package/src/language-registry.js +52 -1
  352. package/src/mapping.js +1 -1
  353. package/src/semantic/provenance.js +2 -2
  354. package/src/semantic/types.js +2 -2
  355. package/src/subprocess.js +31 -2
  356. package/src/toolchains.js +5 -1
@@ -0,0 +1,190 @@
1
+ # Standard-library portability
2
+
3
+ Status: planned architecture; not implemented in `semantifold@0.2.0`.
4
+
5
+ ## Purpose and boundary
6
+
7
+ Semantifold will make a deliberately bounded set of familiar source-language standard-library APIs portable without building a library translator for every source/target pair. The architecture is hub-and-spoke: source-language API shape is normalized into versioned canonical capabilities, and target-language native behavior is reached only through providers for those capabilities.
8
+
9
+ This is an incremental compatibility profile, not a promise to translate arbitrary applications or complete standard libraries. The current release cannot parse imports, classes or methods, loops, optional values, typed errors, resources, host APIs, or any standard-library use. The dependency plan must deliver those semantic prerequisites before the first portability slice.
10
+
11
+ ## Terminology
12
+
13
+ These three names are normative:
14
+
15
+ - A **language compatibility stdlib/facade** is a source-facing, portable implementation of a proved native-library API shape. It is authored in a Semantifold-supported subset and may use only canonical Semantifold capabilities. It contains executable behavior plus public declarations/contracts; it is not a name-only rewrite table.
16
+ - A **canonical Semantifold stdlib contract/capability** is a versioned, language-neutral operation and behavior contract. It precisely specifies types, evaluation order, effects, typed failures, EOF and presence, encoding, newline retention, blocking and timeout behavior, resource ownership/lifetime, close behavior, and target dependencies.
17
+ - A **target host provider/native binding** implements one or more canonical capabilities using the target language's genuine native standard library. Its protected host-native binding is unavailable to ordinary portable application and facade code.
18
+
19
+ An integration for a language therefore has two independent sides: its compatibility facade lets that language be a source, and its target host provider lets that language be a target. Both meet only at canonical contracts. There are no Ruby-on-PHP, PHP-on-Ruby, or other pair-specific adapters.
20
+
21
+ ## Compile and link flow
22
+
23
+ ```text
24
+ source application ─┐
25
+ ├─ frontend → semantic IR → target backend ─┐
26
+ source compatibility│ ├─ linked artifact set
27
+ stdlib/facade ───────┘ canonical capability calls ─────────┘
28
+ │
29
+ target host provider/native binding ─────┤
30
+ ▼
31
+ target native stdlib
32
+ ```
33
+
34
+ The compiler resolves a proved source stdlib reference, selects the corresponding language compatibility stdlib/facade, and compiles both application and used facade modules through ordinary frontend-to-semantic-to-backend processing. Canonical calls remain explicit link requirements. Artifact assembly selects a compatible target host provider/native binding, validates the complete capability set, and returns the application, facade, provider, and support artifacts transactionally.
35
+
36
+ Generated target code uses target syntax. It may retain the source API's class or function names in a collision-safe compatibility namespace or behind an import alias, so source-shaped calls remain readable without claiming those names belong to the target's native stdlib. Namespace allocation and provider symbols must not collide with application names, other facades, or target scaffolding.
37
+
38
+ Only transitively used compatibility and provider modules enter the artifact set. Tree-shaking happens at declared module/capability boundaries after resolution; it must not remove observable initialization, effects, failure paths, or close behavior.
39
+
40
+ ## Ruby-to-PHP example
41
+
42
+ Consider supported Ruby source that requires `socket`, creates `TCPSocket.new(host, port)`, reads lines with `gets`, calls `puts line`, and closes the socket. Once the necessary semantic tasks exist, Ruby stdlib resolution can prove that `TCPSocket` and the unqualified `puts(string)` or equivalent `Kernel.puts(string)` call refer to the supported native symbols and substitute their Ruby language compatibility stdlib/facades.
43
+
44
+ The portable facades can be expressed schematically as:
45
+
46
+ ```ruby
47
+ # Public compatibility declaration: Ruby-compatible supported profile.
48
+ class TCPSocket
49
+ def initialize(host, port)
50
+ @client = Semantifold::SocketClient.v1_connect(host, port)
51
+ end
52
+
53
+ def gets
54
+ Semantifold::TextStream.v1_read_line(@client)
55
+ end
56
+
57
+ def close
58
+ Semantifold::Resource.v1_close(@client)
59
+ end
60
+ end
61
+
62
+ module Kernel
63
+ def self.puts(value)
64
+ Semantifold::Output.v1_write_line(value)
65
+ end
66
+ end
67
+ ```
68
+
69
+ This is illustrative pseudocode, not syntax accepted by `0.2.0`. The real facades must use explicit types, optional/presence results, typed failures, and ownership rules from the selected contract versions. `TCPSocket#gets` preserves the supported Ruby behavior, including newline retention and an absent value at EOF, by composing canonical capabilities rather than by recognizing a source read loop. The bounded `puts` facade accepts exactly one string and calls `Output.v1_write_line(text)`, which outputs the string once and appends LF only when the string does not already end in LF. Multiple arguments, arrays or recursive output, implicit string conversion, custom output separators, and every other Ruby `puts` behavior are outside this profile.
70
+
71
+ The PHP target host provider/native binding can be expressed schematically as:
72
+
73
+ ```php
74
+ // Protected provider code; not callable as a portable application API.
75
+ function socket_client_v1_connect(string $host, int $port): SocketResource {
76
+ $handle = fsockopen($host, $port, $errorCode, $errorMessage);
77
+ return checked_socket_resource($handle, $errorCode, $errorMessage);
78
+ }
79
+
80
+ function text_stream_v1_read_line(SocketResource $socket): ?string {
81
+ return checked_fgets($socket->nativeHandle);
82
+ }
83
+
84
+ function resource_v1_close(SocketResource $socket): void {
85
+ checked_fclose_once($socket->nativeHandle);
86
+ }
87
+
88
+ function output_v1_write_line(string $text): void {
89
+ $output = str_ends_with($text, "\n") ? $text : $text . "\n";
90
+ checked_fwrite_all(STDOUT, $output);
91
+ }
92
+ ```
93
+
94
+ The application and Ruby facades compile to PHP. Generated PHP may define a source-compatible `TCPSocket` class and `puts` compatibility function in a generated compatibility namespace and alias them at their call sites. The class methods call the linked canonical `SocketClient`, text-stream, and resource provider operations; the `puts` facade calls the canonical output operation. The PHP target host provider/native binding writes the canonical line output to native `STDOUT` without duplicating an existing LF, while `fsockopen`, `fgets`, and `fclose` remain the genuine native socket operations.
95
+
96
+ The path is therefore:
97
+
98
+ ```text
99
+ Ruby application + Ruby TCPSocket/puts facades
100
+ → semantic IR
101
+ → generated PHP compatibility class/function
102
+ → canonical SocketClient/TextStream/Output/Resource calls
103
+ → PHP provider
104
+ → native stdout + fsockopen/fgets/fclose
105
+ ```
106
+
107
+ There is no handwritten Ruby-on-PHP library, pair-specific bridge, embedded Ruby runtime, or whole-program intelligent refactor. Syntax becomes PHP syntax while the supported Ruby library shape and behavior remain in the compiled facade.
108
+
109
+ ## Resolution and symbol identity
110
+
111
+ Compatibility substitution is permitted only when the frontend and semantic module resolver can prove both the referenced native library and symbol identity from parser-backed constructs and the configured supported profile. A recognized `require`, `import`, package path, qualified name, or declaration binding must resolve to the exact catalogued stdlib symbol and version range.
112
+
113
+ The following never qualify by spelling alone:
114
+
115
+ - a user-defined class, function, constant, module, or package with the same name;
116
+ - a monkey-patched or reopened native type;
117
+ - reflective or dynamic lookup, computed imports/requires, `eval`, dynamic dispatch, or unresolved aliases;
118
+ - behavior supplied by a native extension, package-manager dependency, preload hook, or runtime mutation; or
119
+ - a parser-rejected or ambiguous construct.
120
+
121
+ Such programs are rejected with a located diagnostic or remain explicitly outside the supported profile. A frontend must never scan source text as a fallback after its parser adapter or resolver rejects a construct.
122
+
123
+ Facade selection records the proved source symbol identity, facade module/version, and canonical capability requirements in semantic project metadata. That evidence, not a raw source name, authorizes linking.
124
+
125
+ ## Protected native boundary and recursion isolation
126
+
127
+ Ordinary portable application and facade code can call canonical capabilities but cannot access raw target-native bindings. Provider modules are compiler-owned artifacts with a protected role and symbols that the normal source resolver will not expose. Backend/provider validation is the only route from a canonical call to a native API.
128
+
129
+ This separation is essential for same-language generation. When Ruby source using the portable `TCPSocket` facade targets Ruby, the Ruby provider's native binding must reach the genuine host `TCPSocket`, not resolve the compatibility name and enter the facade again. Providers use reserved internal symbols or an equivalent compiler-controlled binding captured outside the compatibility namespace. Facade names, native provider names, and application aliases remain distinct even if their user-visible spellings coincide.
130
+
131
+ ## Canonical contract semantics
132
+
133
+ Every canonical capability version is a closed public contract. At minimum it declares:
134
+
135
+ - exact input, output, reference/resource, optional/presence, and typed-failure types;
136
+ - left-to-right evaluation order and which operations are effectful;
137
+ - whether an operation blocks, its timeout units and defaults, and the behavior of unsupported timeout modes;
138
+ - text encoding and decoding, invalid-sequence policy, newline recognition and retention, and whether EOF is an absent value or a failure;
139
+ - ownership transfer or borrowing, allowed aliases, resource lifetime, deterministic explicit close, repeated-close behavior, and use-after-close rejection;
140
+ - failure categories and the point at which native errors are normalized, without depending on target-specific messages or codes; and
141
+ - provider dependencies, supported target/runtime versions, and any capability dependencies.
142
+
143
+ Contracts do not inherit accidental behavior from the first facade or provider. A provider advertises exact versions and constraints. Capability negotiation succeeds only when one provider set satisfies every used canonical requirement without incompatible versions or semantics.
144
+
145
+ Capabilities evolve incrementally. A new operation or incompatible semantic rule receives an explicit version boundary; availability of `SocketClient` v1, for example, does not imply TCP server, TLS, UDP, async I/O, or arbitrary socket options.
146
+
147
+ ## Facades, providers, and artifacts
148
+
149
+ Language compatibility stdlib/facades are normal executable portable definitions under stricter authority rules. Their public declarations define the source-visible supported signatures, and their bodies may use semantic language features and canonical calls only. They cannot invoke target syntax, a protected native binding, reflection, or unversioned host behavior.
150
+
151
+ Target host providers/native bindings are target-owned modules selected from a validated registry. They may use genuine target stdlib APIs and the minimum generated support needed to implement the canonical contract. They cannot weaken types, EOF distinctions, failure categories, ownership, or blocking behavior merely because the host API differs.
152
+
153
+ Resolution produces a dependency graph from application symbols through facade modules and canonical capabilities to provider modules. Before returning anything, the linker validates graph closure, versions, target availability, namespaces, artifact paths, and every backend capability. It then returns one deterministic artifact set containing only reachable modules, declarations, mappings, and required support. Every generated range retains source/semantic provenance or an explicit synthetic/provider reason.
154
+
155
+ ## Failure and diagnostic policy
156
+
157
+ Portability is transactional and fail-loud. No source or artifact subset is exposed when validation fails. Diagnostics distinguish at least:
158
+
159
+ - unresolved or unproved stdlib module/symbol identity;
160
+ - a recognized stdlib symbol outside the facade's supported API profile;
161
+ - dynamic, monkey-patched, reflective, native-extension, or otherwise non-portable source behavior;
162
+ - a missing or version-incompatible canonical capability;
163
+ - a target provider that cannot meet required encoding, EOF, timeout, failure, ownership, or close semantics;
164
+ - same-language native-binding isolation or generated-name collisions; and
165
+ - invalid provider dependency, linking, or artifact graphs.
166
+
167
+ Source/resolution failures point to the import/require, symbol, call, or unsupported construct. Contract failures identify the capability and required version; target failures identify the target/provider constraint. A semantic mismatch is never hidden with a best-effort rewrite, partial artifact set, runtime warning, or source-text fallback.
168
+
169
+ ## Optimization boundary
170
+
171
+ The executable facade plus canonical capability plus provider path is the correctness baseline. A backend may later lower a known facade operation directly to idiomatic target code only when the optimizer proves the replacement preserves the selected contract version, evaluation order, effects, failures, EOF/presence, encoding, blocking/timeouts, and resource lifetime. The unoptimized path must remain valid and covered. Direct lowering cannot authorize a pair-specific behavior change or broaden accepted source identity.
172
+
173
+ ## Supported-subset promise
174
+
175
+ Each facade publishes the exact source APIs and forms it supports. Each canonical module publishes exact capability versions. Each provider publishes its target/runtime constraints. Unsupported operations remain unsupported even when a target happens to expose a similarly named native function.
176
+
177
+ The first planned proof is intentionally narrow: a blocking TCP client, Ruby `TCPSocket` and bounded one-string `puts` compatibility facades, and a PHP native provider. It does not imply coverage for every language, every networking API, or general Ruby output behavior. The dependency sequence is maintained in the [implementation plan](plans/2026-09-05-standard-library-portability.md) and [roadmap](../todo/README.md).
178
+
179
+ ## Acceptance strategy
180
+
181
+ Every implementation slice requires deterministic parser, semantic, link, generation, and real-toolchain acceptance. The first vertical slice will:
182
+
183
+ 1. start a real local ephemeral TCP server under test control, with no external network dependency;
184
+ 2. parse supported Ruby source and prove its `socket`/`TCPSocket` and `puts`/`Kernel.puts` identities;
185
+ 3. compile the application and used Ruby compatibility facades to PHP;
186
+ 4. link only the required PHP provider/native-binding modules;
187
+ 5. run the generated artifacts with real `php` and assert exact output, retained input newlines, exactly one appended LF for a final unterminated string, no duplicate LF, distinct EOF absence, normalized connection failure, deterministic close, repeated-close policy, and use-after-close rejection; and
188
+ 6. cover unresolved, shadowed, monkey-patched, unsupported, provider-missing, collision, and transactional-failure cases.
189
+
190
+ Same-language acceptance must additionally prove that the protected native binding bypasses the compatibility facade. Generated artifacts are reparsed where the target frontend supports their profile, generated twice for byte-for-byte determinism, inspected for unused module exclusion, and checked for complete provenance. Snapshots or source-only assertions cannot replace actual execution.
package/docs/testing.md CHANGED
@@ -1,11 +1,93 @@
1
1
  # Testing
2
2
 
3
- Specs use the released `@velocious/testing@0.0.0` framework and standalone `velocious-test` runner with one top-level `describe` per file. Direct value checks use the framework's `expect` API where it improves clarity; predicate-rich diagnostic assertions retain `node:assert/strict`. Frontend tests load real fixtures through Babel, php-parser, Prism, Lezer, and the qualified official Tree-sitter Python route and compare modeled meaning after removing source locations and the separately tested provenance index. They separately assert normalized annotations, complete named/anonymous child traversal, parser recovery rejection, and exact UTF-16 locations.
3
+ ## Task 018 C operational qualification
4
4
 
5
- Task 015 has separate focused specs for immutable registry-derived discovery, role-specific diagnostics, safe transactional artifact sets, byte-coordinate provenance, exact tool discovery, and staged acceptance. Every caller-supplied ordered array in these contracts must be dense before element validation or iteration; each field independently retains its documented empty/non-empty rule. Error-path discovery uses controlled local fake executables. Positive runner coverage discovers and invokes real `php`, `ruby`, `node`, the lockfile-installed `tsc`, `javac`, and `java`; a missing or unsupported tool is a failure, never a skip. Runner assertions cover isolated directory cleanup, fixed `C.UTF-8` locale and UTC timezone, absence of undeclared ambient variables, exact argument arrays, and distinct invalid-input, missing, ambiguous, version, setup/materialization, launch, output-limit, nonzero-stage, signal, and timeout diagnostics. `ACCEPTANCE_LAUNCH_FAILURE` is restricted to explicit operating-system spawn errors. `ACCEPTANCE_OUTPUT_LIMIT` identifies a child that launched but exceeded the fixed 16 MiB capture limit; its diagnostic retains stage/tool/version and the deterministic limit evidence while omitting the oversized streams and child error object.
5
+ The canonical Ubuntu 26.04 development image installs `clang=1:21.1.6-71`, `clang-21=1:21.1.8-6ubuntu1`, and `libclang-rt-21-dev=1:21.1.8-6ubuntu1`. These exact installed versions were read with `dpkg-query -W clang clang-21 libclang-rt-21-dev`. The `clang` metapackage version differs from the compiler version; the discovered executable is Ubuntu Clang 21.1.8 at `/usr/lib/llvm-21/bin/clang`, target `x86_64-pc-linux-gnu`. Compiler-rt is required for ASan/UBSan and leak detection. Missing tools or runtime libraries fail the C lane; sanitizer coverage is mandatory on this qualified Linux platform.
6
+
7
+ The source-independent root `Dockerfile` remains the canonical image definition and `compose.yml` service `dev` remains the canonical lane. An operator can reproduce the package prerequisite on Ubuntu 26.04 with:
8
+
9
+ ```sh
10
+ sudo apt-get update
11
+ sudo apt-get install --yes --no-install-recommends clang=1:21.1.6-71 clang-21=1:21.1.8-6ubuntu1 libclang-rt-21-dev=1:21.1.8-6ubuntu1
12
+ dpkg-query -W clang clang-21 libclang-rt-21-dev
13
+ clang --version
14
+ clang -dumpmachine
15
+ clang -print-resource-dir
16
+ test "$(clang -dumpversion)" = "21.1.8"
17
+ test "$(clang -dumpmachine)" = "x86_64-pc-linux-gnu"
18
+ test -r "$(clang -print-resource-dir)/lib/linux/libclang_rt.asan-x86_64.a"
19
+ test -r "$(clang -print-resource-dir)/lib/linux/libclang_rt.ubsan_standalone-x86_64.a"
20
+ ```
21
+
22
+ TensorBuzz uses the standard Peakflow Ubuntu 24.04 (`noble`) base, not the development image. Its package repositories cannot resolve the Ubuntu 26.04 pins above. CI instead installs the exact Clang 21.1.8 and compiler-rt builds from the official signed LLVM Noble repository and selects `/usr/bin/clang-21` through `SEMANTIFOLD_CLANG`. The signing key is checksum-pinned before APT receives it, and the repository is restricted to that key through `signed-by`; there is no unsigned package or unpinned compiler fallback. The checked-in `tensorbuzz.yml` owns the executable CI setup:
23
+
24
+ ```sh
25
+ sudo apt-get install --yes --no-install-recommends php-cli python3 ruby default-jdk-headless dotnet-sdk-10.0 ca-certificates curl gnupg
26
+ curl --fail --silent --show-error --location https://apt.llvm.org/llvm-snapshot.gpg.key --output /tmp/semantifold-llvm.asc
27
+ printf '%s %s\n' '8b2a587ffd672c4687e7581dad4b2f6c1bb2ad6b480cd9771ba2ff48e0b8c75d' '/tmp/semantifold-llvm.asc' | sha256sum --check -
28
+ sudo install -D -m 0644 /tmp/semantifold-llvm.asc /etc/apt/keyrings/llvm.asc
29
+ printf '%s\n' 'deb [arch=amd64 signed-by=/etc/apt/keyrings/llvm.asc] https://apt.llvm.org/noble/ llvm-toolchain-noble-21 main' | sudo tee /etc/apt/sources.list.d/semantifold-llvm21.list
30
+ sudo apt-get update
31
+ sudo apt-get install --yes --no-install-recommends clang-21=1:21.1.8~++20251221032922+2078da43e25a-1~exp1~20251221153059.70 libclang-rt-21-dev=1:21.1.8~++20251221032922+2078da43e25a-1~exp1~20251221153059.70
32
+ clang-21 --version
33
+ clang-21 -dumpmachine
34
+ clang-21 -print-resource-dir
35
+ test "$(clang-21 -dumpversion)" = "21.1.8"
36
+ test "$(clang-21 -dumpmachine)" = "x86_64-pc-linux-gnu"
37
+ test -r "$(clang-21 -print-resource-dir)/lib/linux/libclang_rt.asan-x86_64.a"
38
+ test -r "$(clang-21 -print-resource-dir)/lib/linux/libclang_rt.ubsan_standalone-x86_64.a"
39
+ ```
40
+
41
+ The standard CI base was qualified at `peakflow/base-ubuntu-24-04@sha256:9b23d3d5f82a8babb312b7ce549e02d60a6f32344b0088b90d3f486a9d8207a5`: signed APT installation plus UID1000 compile/link/run passed at O0/O2, ordinary and ASan/UBSan/leak profiles. The development image retains its working Ubuntu 26.04 package pins and prints the same compiler probes. Provider versions/authentication, container replacement and host preparation remain external. Package pins can become unavailable if Ubuntu repositories retire them; that is an operational failure requiring deliberate requalification, never a skip or unpinned fallback.
42
+
43
+ For an already materialized generated `program.c` and `semantifold_runtime.h`, use separate compile, link and native execution commands in a fresh directory:
44
+
45
+ ```sh
46
+ export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC
47
+ clang --no-default-config -std=c17 -Wall -Wextra -Werror -pedantic-errors -Wconversion -Wsign-conversion -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wformat=2 -ftrapv -finput-charset=UTF-8 -fexec-charset=UTF-8 -fno-color-diagnostics -O0 -c program.c -o program.o
48
+ clang --no-default-config -O0 program.o -o program
49
+ ./program
50
+ ```
51
+
52
+ Repeat with `-O2`. For both optimizations, repeat compilation and linking with `-g -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer`, then execute with `ASAN_OPTIONS=detect_leaks=1:halt_on_error=1:allocator_may_return_null=1` and `UBSAN_OPTIONS=halt_on_error=1`. The initial UID1000 image qualification passed all four profiles with exact `OK\n`, status zero and empty stderr. Repository C specs independently compile/link/run generated artifacts under all four profiles and compare raw stdout bytes, decoded stdout, stderr and status. Their native byte capture is private test infrastructure; the public acceptance API/lifecycle is unchanged.
53
+
54
+ The C focused files are `c-registry-toolchain.spec.js`, `c-frontend-validation.spec.js`, `c-backend-validation.spec.js`, `c-ordered-expressions.spec.js`, `c-provenance.spec.js`, `c-native-execution.spec.js`, `c-runtime-ownership.spec.js`, and `c-cross-language-acceptance.spec.js`, all under `spec/`. Run explicit files sequentially, for example:
55
+
56
+ ```sh
57
+ npm run verify:legacy-runtime
58
+ npx velocious-test spec/c-frontend-validation.spec.js
59
+ npx velocious-test spec/c-ordered-expressions.spec.js
60
+ npx velocious-test spec/c-native-execution.spec.js
61
+ npx velocious-test spec/c-runtime-ownership.spec.js
62
+ npx velocious-test spec/c-cross-language-acceptance.spec.js
63
+ ```
64
+
65
+ The ownership spec separately compiles native linker instrumentation for `--wrap=malloc` and `--wrap=free`: exact allocation/free counts are checked at normal/fatal exit, the second allocation can fail deterministically, and duplicate/foreign frees are fatal. It never patches a dependency or adds a runtime test hook. Direct native header probes cover invalid lengths, metadata overflow and cumulative arena limits before any borrowed memory access. Signed-64-bit minimum/maximum output and all four arithmetic failures execute at O0/O2 with and without sanitizers. Compile, link and native status failures are tested independently, including removal of their temporary directories. Unicode/NUL copies, returned slices, every operator/consumer, eager ordering, both short-circuit paths, branch fallthrough, forward calls, recursion and unused bindings execute through real Clang.
66
+
67
+ The unchanged legacy parser has a measured 32,767-UTF-16-code-unit source limit (including comments and whitespace). Direct parsing succeeds at that boundary, including astral comment text, and fails at 32,768. Both C source validation and exact generated-size preflight enforce it with located diagnostics before artifacts; no parser payload or consumer setting changes. Clang itself accepts larger generated programs, so native compilation alone cannot establish round-trip support. Strict C17 additionally rejects decoded literals above 4095 bytes; runtime concatenations can exceed that literal limit. The focused C specs execute the accepted literal boundary and nested-region round trips, and reject larger unrepresentable input/output before artifacts.
68
+
69
+ The five C Tasks 001–004 fixtures generate/reparse/execute all original-five targets using real PHP, Ruby, Node, TypeScript/Node and Java compiler/runtime commands. One original-five source rotates through each C profile. Rich/v3 tests verify token origins, synthetic context, shared occurrences, stale metadata and UTF-16 coordinates. Negative corpora cover parser recovery, preprocessing/declarators, ownership/pointers, collisions, malformed IR and every ordered-region boundary. [The C profile](c.md) specifies the exact source, memory and overflow contracts.
70
+
71
+ For this delivery, local testing is restricted to explicitly named changed/affected files. Aggregate `npm test`, directories and shards run only in TensorBuzz, whose end-to-end label includes ten languages and mandatory C/CPP O0/O2 sanitizers. Existing generic aggregate examples below describe that CI gate. Coordinator-owned independent review, exact-head CI and merge remain separate from local implementation delivery; publication/version/tag/release is not part of Tasks 018–019.
72
+
73
+ Specs use the released `@velocious/testing@0.0.0` framework and standalone `velocious-test` runner with one top-level `describe` per file. Direct value checks use the framework's `expect` API where it improves clarity; predicate-rich diagnostic assertions retain `node:assert/strict`. Frontend tests load real fixtures through Babel, php-parser, Prism, Lezer, and the qualified official Tree-sitter Python/C#/Go routes and compare modeled meaning after removing source locations and the separately tested provenance index. They separately assert normalized annotations, complete named/anonymous/comment/directive traversal, parser recovery rejection, and exact UTF-16 locations.
74
+
75
+ The private `packages/tree-sitter-legacy` workspace owns source checking and parser-neutral declaration generation for the internal legacy runtime; neither package is independently publishable. Its direct spec asserts the versioned frozen plain-data C CST, ordered field-bearing children, error/missing/extra state, UTF-16 indices and positions, and a declaration surface without native types. Its distribution spec runs the root package's real `prepack`, checks that the root tarball physically contains root `tree-sitter@0.25.1` and the internal package's isolated `tree-sitter@0.21.1` plus `tree-sitter-c@0.23.2` subtree, including licenses, platform prebuilds, and source fallbacks. It installs only that root tarball into a credential-free consumer with a fresh npm cache, verifies the installed lock and full npm tree, compiles a root API type consumer, and runs modern Go beside legacy C in one Node 24 process. The temporary tarball, cache, lockfile, dependencies, and consumer are always removed; no packed archive or dependency build is committed.
76
+
77
+ `tree-sitter-legacy-install-consistency.spec.js` reproduces source edits after `npm ci` in unique isolated npm fixtures, using the real pretest/prepack hooks and a semantic change to the serializer. Each shipped file must cause a stale-payload rejection until ordinary `npm ci` refreshes the installed copy; real tar extraction proves that subsequent packs contain the edited bytes. The shared gate uses npm's source pack inventory, checks the complete installed payload except its dependency subtree, and compares bytes before runtime specs, lint, and packing. The consumer spec independently compares every bundled internal file with source. Its configuration regression uses only synthetic registry and credential settings, removes all inherited `npm_config_*` inputs and token/module-path variables case-insensitively, isolates both user and global configuration files, and checks npm's effective public registry/config/cache settings before the real fresh-cache installation.
78
+
79
+ The consumer environment must assert npm's ordinary `install-links=false` default without setting it. Root `acceptDependencies` accepts the exact private package already supplied by the bundle while retaining the local `file:` installation source. The spec runs ordinary `npm install`, full `npm ls --all`, and then clean `npm ci` from the generated consumer lock, repeating dependency, simultaneous Go/C runtime, frozen-data, and TypeScript consumer checks. Bundled lock entries have neither links nor external resolutions; real paths must remain inside the consumer. The fresh cache must contain public dependency requests but no internal or retired adapter lookup. No consumer flags, project configuration, workspace fallback, or registry release of the private name are required.
80
+
81
+ Task 015 has separate focused specs for immutable registry-derived discovery, role-specific diagnostics, safe transactional artifact sets, byte-coordinate provenance, exact tool discovery, and staged acceptance. Every caller-supplied ordered array in these contracts must be dense before element validation or iteration; each field independently retains its documented empty/non-empty rule. Error-path discovery uses controlled local fake executables. Positive runner coverage discovers and invokes real `php`, `ruby`, `node`, the lockfile-installed `tsc`, `javac`, `java`, and `go`; a missing or unsupported tool is a failure, never a skip. Runner assertions cover isolated directory cleanup, fixed `C.UTF-8` locale and UTC timezone, absence of undeclared ambient variables, exact argument arrays, and distinct invalid-input, missing, ambiguous, version, setup/materialization, launch, output-limit, nonzero-stage, signal, and timeout diagnostics. `ACCEPTANCE_LAUNCH_FAILURE` is restricted to explicit operating-system spawn errors. `ACCEPTANCE_OUTPUT_LIMIT` identifies a child that launched but exceeded the fixed 16 MiB capture limit; its diagnostic retains stage/tool/version and the deterministic limit evidence while omitting the oversized streams and child error object.
82
+
83
+ `runAcceptanceStages` sets `LANG=C.UTF-8`, `LC_ALL=C.UTF-8`, and `TZ=UTC` for every child it owns, independently of the ambient locale. The aggregate repository suite also includes older direct native execution specs that invoke real tools with `execFile` and inherit the outer test process locale. Their Unicode round trips require a UTF-8 locale, so run the aggregate suite as `LANG=C.UTF-8 LC_ALL=C.UTF-8 npm test`.
6
84
 
7
85
  Task 016 extends the same fail-loud discovery and staged runner to configured Python 3. Native Python acceptance first invokes `python3 -m py_compile program.py`, then executes `python3 program.py` with deterministic `C.UTF-8`, `PYTHONUTF8=1`, and `PYTHONIOENCODING=utf-8`. Cross-language coverage generates and reparses Python from every original-five Tasks 001–004 fixture, then generates every original target from Python-derived IR, compiling where applicable and comparing exact runtime output. Missing Python is a test failure.
8
86
 
87
+ Task 017 adds the distinct ordered `restore` stage and configured .NET SDK 10 discovery. C# acceptance generates exactly `Program.cs` and `Semantifold.csproj`, then invokes `dotnet restore Semantifold.csproj --source . --no-cache --force --disable-parallel --nologo`, `dotnet build Semantifold.csproj --configuration Release --no-restore --nologo --warnaserror`, and `dotnet exec bin/Release/net10.0/Semantifold.dll` as separate stages. Tests set the .NET telemetry/first-run/no-logo/invariant variables and an isolated absolute `NUGET_PACKAGES` path. They require exact exit/stdout and no warning output. Two fresh directories must produce identical ordered artifact text/mappings/provenance and identical `Semantifold.dll`, `.deps.json`, and `.runtimeconfig.json`; path-bearing restore bookkeeping under `obj/` is intentionally not compared. Missing .NET, restore dependency/network demand, warnings, SDK major mismatch, or nondeterministic compiler output fails without a skip.
88
+
89
+ Task 024 adds configured Go 1.26.x discovery restricted to Linux/amd64; the patch release is read from the discovered toolchain rather than fixed by runtime tests. Acceptance obtains `GOROOT` from that exact `go`, requires the companion `gofmt` beside the configured or discovered executable to resolve to the same `GOROOT/bin/gofmt`, and checks `gofmt -d` before native execution. Each dependency-free generated module is run with `GOTOOLCHAIN=local`, `GOPROXY=off`, `GOSUMDB=off`, `GOVCS=off`, `CGO_ENABLED=0`, `GOENV=off`, `GOWORK=off`, `GOOS=linux`, `GOARCH=amd64`, and isolated HOME/GOPATH/build/module caches. The short-lived discovery fixture also writes exact `off` mode into its isolated Go telemetry directory before invoking the tool, then asserts that the mode file is the only telemetry state: Go 1.26 otherwise starts an unawaited uploader sidecar even in default `local` mode, which can recreate `upload/` while the fixture root is being removed. Cleanup errors remain fatal. Stages run offline `go build`, mandatory `go vet`, and `go run`, while compiler-only differential cases use the matching `go tool compile`. Tests require exact status/stdout, unchanged `go.mod`/`main.go`, no `go.sum`/`go.work`/vendor tree, and byte-identical binaries and output in two fresh directories. Missing, wrong-minor, wrong-architecture, mismatched-gofmt, download, cgo, workspace, vet, formatting, nondeterminism, telemetry leakage, or cleanup evidence fails without a skip.
90
+
9
91
  | Tool ID | Canonical command | Absolute-path override | Accepted canonical version |
10
92
  | --- | --- | --- | --- |
11
93
  | `php` | `php` | `SEMANTIFOLD_PHP` | PHP 8.x |
@@ -15,9 +97,15 @@ Task 016 extends the same fail-loud discovery and staged runner to configured Py
15
97
  | `javac` | `javac` | `SEMANTIFOLD_JAVAC` | JDK 17–29 |
16
98
  | `java` | `java` | `SEMANTIFOLD_JAVA` | JRE 17–29 |
17
99
  | `python` | `python3` | `SEMANTIFOLD_PYTHON` | Python 3.x |
100
+ | `dotnet` | `dotnet` | `SEMANTIFOLD_DOTNET` | .NET SDK 10.x |
101
+ | `go` | `go` | `SEMANTIFOLD_GO` | Go 1.26.x, Linux/amd64 |
102
+ | `clangpp` | `clang++` | `SEMANTIFOLD_CLANGPP` | Ubuntu Clang 21.1.8, x86_64-pc-linux-gnu, C++20/libstdc++ ABI1 |
103
+ | `clang` | `clang` | `SEMANTIFOLD_CLANG` | Ubuntu Clang 21.1.8, x86_64-pc-linux-gnu |
18
104
 
19
105
  Canonical toolchain IDs must be non-empty primitive strings and are validated before property lookup or diagnostic formatting; malformed values normalize to `INVALID_TOOLCHAIN`, while an unknown valid string retains that string as its diagnostic identity. Discovery records the complete version output and first version line. Optional discovery and runner configuration defaults only when a field is `undefined`; explicit `null`, including in an environment entry, is invalid before lookup, setup, or launch. Explicit timeouts must be positive integers no greater than Node's exact timer ceiling of 2,147,483,647 milliseconds; larger values are rejected before lookup, setup, or launch rather than being clamped to one millisecond. Explicit environments must be ordinary or null-prototype records containing only enumerable own data properties with string or `undefined` values; inherited fields, accessors, symbol keys, collection/class instances, and other object shapes are rejected. Accepted environment values are synchronously detached before override lookup, setup, or launch. An override must be an executable absolute path resolving to a regular file; directories and other invalid file types report `TOOL_NOT_FOUND`. Canonical lookup examines the explicit PATH, accepts only executable regular files, resolves symlinks to exact paths, deduplicates aliases of the same executable, and rejects zero or multiple distinct matches. Version arguments and the accepted non-global/non-sticky version-policy expression are validated and detached before asynchronous executable lookup; the immutable discovery result retains the exact argument array that was executed, and caller mutation cannot change the pending version decision. TensorBuzz installs its pinned Node archive at `/usr/local/bin/node` and binds that exact executable through `SEMANTIFOLD_NODE`; a distinct host `/usr/bin/node` therefore cannot make the real-runtime lane ambiguous. This does not weaken canonical ambiguity detection when no override is configured. The runner inherits no ambient variables other than PATH unless the caller explicitly supplies them; locale and timezone are always normalized. Stage executable and version fields are copied and frozen before setup yields, embedded NUL is rejected before temporary-directory setup, and each completed stage returns a frozen copy of its executed argument array, so caller mutation cannot change execution or its audit record. On POSIX, version probes and acceptance stages spawn into one distinct owned process group: the configured deadline signals that exact group with `SIGTERM`, a fixed 250ms grace escalates the still-open group to `SIGKILL`, and a second fixed 250ms grace closes only the owned capture-pipe readers if an escaped descendant still retains their writers. The API then settles on the direct child's `close` event without claiming that an escaped process was terminated; captured output and timer-owned timeout classification remain unchanged. Platforms without this process-group contract fail with normalized unsupported launch/version diagnostics before spawning rather than claiming descendant cleanup. Timeout diagnostics derive from timer ownership rather than a subprocess signal, so spontaneous signals remain `TOOL_VERSION_FAILURE` or `ACCEPTANCE_SIGNAL` with their exact evidence. If a stage and isolated-directory cleanup both fail, the stage diagnostic remains primary with its exact stage, exit, signal, and bounded output fields; a bounded `ACCEPTANCE_CLEANUP_FAILURE` diagnostic is retained in its cause chain. Cleanup failure after successful stages remains `ACCEPTANCE_CLEANUP_FAILURE`.
20
106
 
107
+ TERM-to-KILL escalation coverage does not assume a spawned fixture has already executed its first instruction. A focused spec at the internal subprocess owner creates an executor with instance-owned spawn observation that begins its test deadline only after the fixture emits process-boundary readiness; the production executor continues to register directly on the child's `spawn` event. The internal factory is absent from the package export map, and no Node builtin binding or shared test dependency is replaced. The fixture records readiness only after installing its TERM handler and capturing its Linux PID/start-time/process-group/session identity. Assertions retain the exact `SIGKILL` result and `SIGTERM` evidence and require both that identity and its complete owned group to disappear, while high-level discovery and acceptance coverage retains timeout-diagnostic translation without timing delays, retries, or relaxed signal expectations.
108
+
21
109
  Backend tests start from one parsed semantic module, generate every target, parse each generated program back to equivalent modeled meaning, and work in isolated `mkdtemp` directories. They invoke real commands and assert exact `5\n` output:
22
110
 
23
111
  - `php program.php`
@@ -26,12 +114,14 @@ Backend tests start from one parsed semantic module, generate every target, pars
26
114
  - local lockfile-installed `tsc program.ts`, then `node program.js`
27
115
  - `javac Main.java`, then `java -cp … Main`
28
116
  - `python3 -m py_compile program.py`, then `python3 program.py` with `PYTHONUTF8=1` and `PYTHONIOENCODING=utf-8`
117
+ - C#'s separate local-only `dotnet restore`, `dotnet build --no-restore`, and `dotnet exec` commands above
118
+ - matching-GOROOT `gofmt -d`, then isolated offline `go build`, `go vet`, and `go run`
29
119
 
30
120
  Cleanup runs in `finally`. A missing tool raises the process error and fails the spec; there are no skip branches or mocked compilers. Diagnostic specs cover unsupported syntax, missing JSDoc types, and backend capability rejection.
31
121
 
32
122
  Mapping specs assert all 36 frontend/backend combinations, exact/anchor/synthetic coverage without gaps, semantic-token roles, deterministic source/node/symbol IDs, exact `sourcesContent`, independently decoded v3 maps, rich/v3 composition, malformed caller metadata repair, legacy modules, caller-assembled multi-source IR, and deterministic JSON round trips. Transformation regressions cover same-kind function reorder, insertion, deletion, cloning, ID regeneration, source ownership, shared parameter, expression, and statement occurrences, and their distinct JSON-pointer node identities. UTF-16 cases cover BMP/astral text plus LF, canonical CRLF, and lone CR; escaped Babel identifiers cover declarations, references, and calls. Imported maps are checked against TraceMap on unmapped prefixes and lines; content-backed EOF anchors, including empty sources, round-trip as exact points, while mapped imports without source content are rejected before offset construction. Composition coverage includes derived intermediate provenance that resolves only to unmapped synthetic content, untraced intermediate EOF points whose registry source must remain available, and ordering where a later range remains traceable. Identity-index coverage checks direct, derived, and synthetic-related node/symbol associations for ordered deduplication. External directive coverage includes mixed parent-relative depths and resolution to the advertised map path. A bounded 50-to-200-function scaling test guards linear validation and indexed lookups; deterministic operation-count coverage guards Babel token indexing without wall-clock thresholds. A real `tsc` map is composed through generated TypeScript to original Ruby source. Mapped-artifact acceptance executes PHP, Ruby, Node, TypeScript through real `tsc`/Node, Java through real `javac`/`java`, and Python through its configured interpreter after `py_compile`; unavailable commands fail. SHA-256 characterization checks preserve every existing base/local generated byte across all original source languages and targets.
33
123
 
34
- Task 016 adds mapped Python execution through the configured interpreter after `py_compile`; the original-five SHA-256 characterizations remain unchanged.
124
+ Task 016 adds mapped Python execution through the configured interpreter after `py_compile`; Task 017 adds the five C# profiles, C# generation into every original-five target, a rotated original-five source into C# per profile, and real deterministic .NET project execution. Task 024 adds five Go profiles into every original-five target/runtime, rotates one original-five source per profile into Go, and verifies native evaluation order, signed-64-bit boundaries, reparsing, and deterministic binary/output behavior. The original-six SHA-256 characterizations remain unchanged.
35
125
 
36
126
  Local-binding fixtures cover initialized mutable and immutable declarations, plain assignment, function/branch/entry sequencing, exact Ruby/PHP profile metadata, and source locations in all five frontends. Focused negatives cover every declaration/assignment exclusion, declaration-before-use, unresolved and duplicate bindings, callable-name and lexical no-shadowing, immutable parameters/locals, exact type preservation, and RHS-before-target validation. Ruby coverage rejects profile-like tag misspellings, places multibyte text before later function and local carrier comments, asserts their UTF-16 locations, and reparses generated Ruby with the same offset shift. Backend shape coverage applies missing, null, primitive, array, sparse, and unsupported-object values to recursive blocks, statement elements, declaration/assignment fields, and recursively nested call expressions, proving caller-supplied malformed IR receives the nearest located capability diagnostic before emitter dispatch. Backend runtime coverage regenerates and reparses the same binding/mutability semantics, then executes the result through all five real toolchains with exact `yes\n` output. Target-focused coverage rejects JavaScript/TypeScript `console` and Java `args`/`System` entry captures, JavaScript/TypeScript `console` and Java `System` function parameter/local print-receiver captures, and JavaScript/TypeScript `console` and Ruby `puts` function captures before emission. Real `tsc`, PHP, and Ruby coverage demonstrates their strict or reserved binding failures and requires located target-backend rejection for each proven declaration/assignment role. The PHP probe matrix separately covers automatic-global parameters, the narrower `GLOBALS`/`this` assignment restriction, legal function names, assignable non-`GLOBALS` superglobals, ordinary predefined variables, and exact-case near-collisions; other runtime coverage executes safe JavaScript behavior, Ruby `_10`, and TypeScript near-collisions.
37
127
 
@@ -41,4 +131,23 @@ Typed-operation fixtures cover all 18 closed unary/binary operations and explici
41
131
 
42
132
  Focused correction specs prove that unsafe numeric literals never enter the semantic tree; async/generator flags are rejected; Java receivers, unsupported arguments, and extra entry statements cannot disappear; Ruby annotations and parameter forms stay function-local; and PHP accepts only its precise strict-types declaration. Backend specs cover target reserved identifiers, Java's signed 32-bit range, and exact one-return branch cardinality. Repository-contract specs parse package metadata, Compose/TensorBuzz YAML, and the Dockerfile AST; they prove the custom ESLint plugin uses an immutable commit and TensorBuzz is the sole CI topology.
43
133
 
44
- Run `npx velocious-test spec/repository-contract.spec.js` for the focused repository contract and `npm test` for framework-native discovery of `.spec.js` files under `spec`. An empty selection is a framework failure and exits nonzero. Run `npm run lint`, `npm run typecheck`, and `npm run build` for source quality and declaration generation. Packaging validation is documented in the root README and `AGENTS.md`.
134
+ Run `npx velocious-test spec/repository-contract.spec.js` for the focused repository contract and `npm test` for framework-native discovery of `.spec.js` files under `spec`. An empty selection is a framework failure and exits nonzero. Run `npm run lint`, `npm run typecheck`, and `npm run build` for source quality and declaration generation. Inspect `npm pack --dry-run --json`; the focused packed-consumer spec performs the stronger real root-tarball installation proof. Packaging validation is also documented in the root README and `AGENTS.md`.
135
+
136
+ ## Task019 CPP acceptance
137
+
138
+ The CPP lane selects `/usr/bin/clang++-21` through `SEMANTIFOLD_CLANGPP`; C retains `SEMANTIFOLD_CLANG`. The development image pins libstdc++-15-dev 15.2.0-16ubuntu1 and already obtains clang++ from the exact clang-21 package. Noble TensorBuzz reuses the signed LLVM21 setup above, explicitly installs g++-13/libstdc++ headers, probes clang++ and libstdc++, and runs framework-native discovery of all ten languages. [The CPP profile](cpp.md) lists every compile/link, encoding, warning, exception/RTTI and sanitizer flag. Local validation uses explicit named spec files only; full-suite discovery belongs to TensorBuzz.
139
+
140
+ ```sh
141
+ export SEMANTIFOLD_CLANG=/usr/bin/clang-21
142
+ export SEMANTIFOLD_CLANGPP=/usr/bin/clang++-21
143
+ npx velocious-test spec/cpp-native-execution.spec.js
144
+ npx velocious-test spec/cpp-runtime-values.spec.js
145
+ npx velocious-test spec/cpp-cross-language-acceptance.spec.js
146
+ npx velocious-test spec/tree-sitter-legacy-packed-consumer.spec.js
147
+ ```
148
+
149
+ Each native spec executes O0/O2, ordinary and ASan/UBSan/leak profiles, with byte/stdout/stderr/status assertions and fresh-directory cleanup. The original-five crossing spec invokes real PHP, Ruby, Node, tsc, javac and java; none may silently skip. The packed consumer proves ordinary install and clean npm ci with fresh cache, empty configs, default install-links=false, both bundled runtime paths, CPP and C frozen data, modern Go loading, and public CPP parse/generate/reparse/types.
150
+
151
+ ## Release-version package verification
152
+
153
+ Repository delivery checks validate a stable SemVer root version and require both lockfile version entries to match it. Packed-consumer checks compare the packed and installed package versions with the source manifest, rather than pinning a historical release. When validating a release candidate, run `npx velocious-test spec/repository-contract.spec.js spec/tree-sitter-legacy-packed-consumer.spec.js` on the actual candidate version; all existing runtime isolation, ordinary install/ci, and strict TypeScript checks remain mandatory.
package/index.js CHANGED
@@ -112,7 +112,7 @@ export function generateArtifactSet(input) {
112
112
  if (record.artifactMultiplicity == "multiple") {
113
113
  const backend = languageRegistry.resolve(language, "textBackend", module?.location)
114
114
 
115
- return constructArtifactSet(backend({filename, language, module, sources}))
115
+ return constructArtifactSet(backend({filename, language, mapDirective, module, sourceMapFilename, sources}))
116
116
  }
117
117
  const artifact = generateArtifactSource({
118
118
  filename,
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 [Node.js API collaborators](https://github.com/nodejs/node-addon-api#collaborators)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,95 @@
1
+ # **node-addon-api module**
2
+
3
+ [![codecov](https://codecov.io/gh/nodejs/node-addon-api/branch/main/graph/badge.svg)](https://app.codecov.io/gh/nodejs/node-addon-api/tree/main)
4
+
5
+ [![NPM](https://nodei.co/npm/node-addon-api.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-addon-api/) [![NPM](https://nodei.co/npm-dl/node-addon-api.png?months=6&height=1)](https://nodei.co/npm/node-addon-api/)
6
+
7
+ This module contains **header-only C++ wrapper classes** which simplify
8
+ the use of the C based [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)
9
+ provided by Node.js when using C++. It provides a C++ object model
10
+ and exception handling semantics with low overhead.
11
+
12
+ - [API References](doc/README.md)
13
+ - [Badges](#badges)
14
+ - [Contributing](#contributing)
15
+ - [License](#license)
16
+
17
+ ## API References
18
+
19
+ API references are available in the [doc](doc/README.md) directory.
20
+
21
+ <!-- x-release-please-start-version -->
22
+ ## Current version: 8.9.2
23
+ <!-- x-release-please-end -->
24
+
25
+ (See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
26
+
27
+ node-addon-api is based on [Node-API](https://nodejs.org/api/n-api.html) and supports using different Node-API versions.
28
+ This allows addons built with it to run with Node.js versions which support the targeted Node-API version.
29
+ **However** the node-addon-api support model is to support only the active LTS Node.js versions. This means that
30
+ every year there will be a new major which drops support for the Node.js LTS version which has gone out of service.
31
+
32
+ The oldest Node.js version supported by the current version of node-addon-api is Node.js 18.x.
33
+
34
+ ## Badges
35
+
36
+ The use of badges is recommended to indicate the minimum version of Node-API
37
+ required for the module. This helps to determine which Node.js major versions are
38
+ supported. Addon maintainers can consult the [Node-API support matrix][] to determine
39
+ which Node.js versions provide a given Node-API version. The following badges are
40
+ available:
41
+
42
+ ![Node-API v1 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v1%20Badge.svg)
43
+ ![Node-API v2 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v2%20Badge.svg)
44
+ ![Node-API v3 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v3%20Badge.svg)
45
+ ![Node-API v4 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v4%20Badge.svg)
46
+ ![Node-API v5 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v5%20Badge.svg)
47
+ ![Node-API v6 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v6%20Badge.svg)
48
+ ![Node-API v7 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v7%20Badge.svg)
49
+ ![Node-API v8 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v8%20Badge.svg)
50
+ ![Node-API v9 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v9%20Badge.svg)
51
+ ![Node-API Experimental Version Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20Experimental%20Version%20Badge.svg)
52
+
53
+ ## Contributing
54
+
55
+ We love contributions from the community to **node-addon-api**!
56
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on our philosophy around extending this module.
57
+
58
+ ## Team members
59
+
60
+ ### Active
61
+
62
+ | Name | GitHub Link |
63
+ | ------------------- | ----------------------------------------------------- |
64
+ | Anna Henningsen | [addaleax](https://github.com/addaleax) |
65
+ | Chengzhong Wu | [legendecas](https://github.com/legendecas) |
66
+ | Jack Xia | [JckXia](https://github.com/JckXia) |
67
+ | Kevin Eady | [KevinEady](https://github.com/KevinEady) |
68
+ | Michael Dawson | [mhdawson](https://github.com/mhdawson) |
69
+ | Nicola Del Gobbo | [NickNaso](https://github.com/NickNaso) |
70
+ | Vladimir Morozov | [vmoroz](https://github.com/vmoroz) |
71
+
72
+ <details>
73
+
74
+ <summary>Emeritus</summary>
75
+
76
+ ### Emeritus
77
+
78
+ | Name | GitHub Link |
79
+ | ------------------- | ----------------------------------------------------- |
80
+ | Arunesh Chandra | [aruneshchandra](https://github.com/aruneshchandra) |
81
+ | Benjamin Byholm | [kkoopa](https://github.com/kkoopa) |
82
+ | Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) |
83
+ | Hitesh Kanwathirtha | [digitalinfinity](https://github.com/digitalinfinity) |
84
+ | Jason Ginchereau | [jasongin](https://github.com/jasongin) |
85
+ | Jim Schlight | [jschlight](https://github.com/jschlight) |
86
+ | Sampson Gao | [sampsongao](https://github.com/sampsongao) |
87
+ | Taylor Woll | [boingoing](https://github.com/boingoing) |
88
+
89
+ </details>
90
+
91
+ ## License
92
+
93
+ Licensed under [MIT](./LICENSE.md)
94
+
95
+ [Node-API support matrix]: https://nodejs.org/dist/latest/docs/api/n-api.html#node-api-version-matrix
@@ -0,0 +1,21 @@
1
+ {
2
+ 'variables': {
3
+ 'NAPI_VERSION%': "<!(node -p \"process.env.NAPI_VERSION || process.versions.napi\")",
4
+ 'disable_deprecated': "<!(node -p \"process.env['npm_config_disable_deprecated']\")"
5
+ },
6
+ 'conditions': [
7
+ ['NAPI_VERSION!=""', { 'defines': ['NAPI_VERSION=<@(NAPI_VERSION)'] } ],
8
+ ['NAPI_VERSION==2147483647', { 'defines': ['NAPI_EXPERIMENTAL', 'NODE_API_EXPERIMENTAL_NO_WARNING'] } ],
9
+ ['disable_deprecated=="true"', {
10
+ 'defines': ['NODE_ADDON_API_DISABLE_DEPRECATED']
11
+ }],
12
+ ['OS=="mac"', {
13
+ 'cflags+': ['-fvisibility=hidden'],
14
+ 'xcode_settings': {
15
+ 'OTHER_CFLAGS': ['-fvisibility=hidden']
16
+ }
17
+ }]
18
+ ],
19
+ 'cflags': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ],
20
+ 'cflags_cc': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ]
21
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ 'defines': [ 'NAPI_CPP_EXCEPTIONS' ],
3
+ 'cflags!': [ '-fno-exceptions' ],
4
+ 'cflags_cc!': [ '-fno-exceptions' ],
5
+ 'conditions': [
6
+ ["OS=='win'", {
7
+ "defines": [
8
+ "_HAS_EXCEPTIONS=1"
9
+ ],
10
+ "msvs_settings": {
11
+ "VCCLCompilerTool": {
12
+ "ExceptionHandling": 1,
13
+ 'EnablePREfast': 'true',
14
+ },
15
+ },
16
+ }],
17
+ ["OS=='mac'", {
18
+ 'xcode_settings': {
19
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
20
+ 'CLANG_CXX_LIBRARY': 'libc++',
21
+ 'MACOSX_DEPLOYMENT_TARGET': '10.7',
22
+ },
23
+ }],
24
+ ],
25
+ }
@@ -0,0 +1,14 @@
1
+ const path = require('path');
2
+ const { version } = require('./package.json');
3
+
4
+ const includeDir = path.relative('.', __dirname);
5
+
6
+ module.exports = {
7
+ include: `"${__dirname}"`, // deprecated, can be removed as part of 4.0.0
8
+ include_dir: includeDir,
9
+ gyp: path.join(includeDir, 'node_api.gyp:nothing'), // deprecated.
10
+ targets: path.join(includeDir, 'node_addon_api.gyp'),
11
+ version,
12
+ isNodeApiBuiltin: true,
13
+ needsFlag: false
14
+ };