semantifold 0.3.0 → 0.4.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 (297) hide show
  1. package/README.md +58 -15
  2. package/build/index.d.ts +48 -2
  3. package/build/index.d.ts.map +1 -1
  4. package/build/index.js +57 -8
  5. package/build/src/artifact-path.d.ts +23 -1
  6. package/build/src/artifact-path.d.ts.map +1 -1
  7. package/build/src/artifact-path.js +45 -3
  8. package/build/src/artifacts.d.ts.map +1 -1
  9. package/build/src/artifacts.js +66 -1
  10. package/build/src/backends/c-validation.d.ts.map +1 -1
  11. package/build/src/backends/c-validation.js +7 -3
  12. package/build/src/backends/cpp-validation.d.ts.map +1 -1
  13. package/build/src/backends/cpp-validation.js +7 -3
  14. package/build/src/backends/csharp.js +7 -1
  15. package/build/src/backends/dart-runtime.d.ts +2 -0
  16. package/build/src/backends/dart-runtime.d.ts.map +1 -0
  17. package/build/src/backends/dart-runtime.js +41 -0
  18. package/build/src/backends/dart.d.ts +20 -0
  19. package/build/src/backends/dart.d.ts.map +1 -0
  20. package/build/src/backends/dart.js +321 -0
  21. package/build/src/backends/effects.d.ts +60 -0
  22. package/build/src/backends/effects.d.ts.map +1 -0
  23. package/build/src/backends/effects.js +746 -0
  24. package/build/src/backends/go.js +18 -4
  25. package/build/src/backends/identifiers.d.ts +36 -4
  26. package/build/src/backends/identifiers.d.ts.map +1 -1
  27. package/build/src/backends/identifiers.js +154 -10
  28. package/build/src/backends/index.d.ts.map +1 -1
  29. package/build/src/backends/index.js +27 -4
  30. package/build/src/backends/ios.d.ts +68 -0
  31. package/build/src/backends/ios.d.ts.map +1 -0
  32. package/build/src/backends/ios.js +1503 -0
  33. package/build/src/backends/java.d.ts.map +1 -1
  34. package/build/src/backends/java.js +429 -36
  35. package/build/src/backends/javascript.d.ts +6 -0
  36. package/build/src/backends/javascript.d.ts.map +1 -1
  37. package/build/src/backends/javascript.js +380 -24
  38. package/build/src/backends/kotlin-runtime.d.ts +3 -0
  39. package/build/src/backends/kotlin-runtime.d.ts.map +1 -0
  40. package/build/src/backends/kotlin-runtime.js +29 -0
  41. package/build/src/backends/kotlin.d.ts +23 -0
  42. package/build/src/backends/kotlin.d.ts.map +1 -0
  43. package/build/src/backends/kotlin.js +136 -0
  44. package/build/src/backends/native-validation.d.ts +2 -2
  45. package/build/src/backends/native-validation.d.ts.map +1 -1
  46. package/build/src/backends/native-validation.js +2 -2
  47. package/build/src/backends/ordered-expressions.d.ts.map +1 -1
  48. package/build/src/backends/ordered-expressions.js +39 -7
  49. package/build/src/backends/php-stdlib-support.d.ts +19 -0
  50. package/build/src/backends/php-stdlib-support.d.ts.map +1 -0
  51. package/build/src/backends/php-stdlib-support.js +227 -0
  52. package/build/src/backends/php.d.ts.map +1 -1
  53. package/build/src/backends/php.js +448 -33
  54. package/build/src/backends/program.d.ts +81 -0
  55. package/build/src/backends/program.d.ts.map +1 -0
  56. package/build/src/backends/program.js +1308 -0
  57. package/build/src/backends/python.js +7 -1
  58. package/build/src/backends/ruby.d.ts.map +1 -1
  59. package/build/src/backends/ruby.js +310 -24
  60. package/build/src/backends/rust-runtime.d.ts +7 -0
  61. package/build/src/backends/rust-runtime.d.ts.map +1 -0
  62. package/build/src/backends/rust-runtime.js +32 -0
  63. package/build/src/backends/rust-validation.d.ts +9 -0
  64. package/build/src/backends/rust-validation.d.ts.map +1 -0
  65. package/build/src/backends/rust-validation.js +78 -0
  66. package/build/src/backends/rust.d.ts +24 -0
  67. package/build/src/backends/rust.d.ts.map +1 -0
  68. package/build/src/backends/rust.js +344 -0
  69. package/build/src/backends/scalars.d.ts +14 -6
  70. package/build/src/backends/scalars.d.ts.map +1 -1
  71. package/build/src/backends/scalars.js +167 -17
  72. package/build/src/backends/shared.d.ts +23 -4
  73. package/build/src/backends/shared.d.ts.map +1 -1
  74. package/build/src/backends/shared.js +2158 -62
  75. package/build/src/backends/stdlib-support.d.ts +14 -0
  76. package/build/src/backends/stdlib-support.d.ts.map +1 -0
  77. package/build/src/backends/stdlib-support.js +237 -0
  78. package/build/src/backends/swift-runtime.d.ts +3 -0
  79. package/build/src/backends/swift-runtime.d.ts.map +1 -0
  80. package/build/src/backends/swift-runtime.js +14 -0
  81. package/build/src/backends/swift.d.ts +8 -0
  82. package/build/src/backends/swift.d.ts.map +1 -0
  83. package/build/src/backends/swift.js +127 -0
  84. package/build/src/backends/typescript.d.ts.map +1 -1
  85. package/build/src/backends/typescript.js +344 -24
  86. package/build/src/backends/wasm.d.ts +43 -0
  87. package/build/src/backends/wasm.d.ts.map +1 -0
  88. package/build/src/backends/wasm.js +2164 -0
  89. package/build/src/backends/writer.d.ts +235 -4
  90. package/build/src/backends/writer.d.ts.map +1 -1
  91. package/build/src/backends/writer.js +468 -3
  92. package/build/src/diagnostic.d.ts +4 -3
  93. package/build/src/diagnostic.d.ts.map +1 -1
  94. package/build/src/diagnostic.js +5 -3
  95. package/build/src/frontends/c.d.ts.map +1 -1
  96. package/build/src/frontends/c.js +5 -3
  97. package/build/src/frontends/cpp.d.ts.map +1 -1
  98. package/build/src/frontends/cpp.js +5 -3
  99. package/build/src/frontends/csharp.d.ts.map +1 -1
  100. package/build/src/frontends/csharp.js +7 -3
  101. package/build/src/frontends/dart.d.ts +10 -0
  102. package/build/src/frontends/dart.d.ts.map +1 -0
  103. package/build/src/frontends/dart.js +913 -0
  104. package/build/src/frontends/index.d.ts +3 -1
  105. package/build/src/frontends/index.d.ts.map +1 -1
  106. package/build/src/frontends/index.js +15 -5
  107. package/build/src/frontends/java.d.ts +110 -1
  108. package/build/src/frontends/java.d.ts.map +1 -1
  109. package/build/src/frontends/java.js +1725 -70
  110. package/build/src/frontends/javascript-typescript.d.ts +69 -1
  111. package/build/src/frontends/javascript-typescript.d.ts.map +1 -1
  112. package/build/src/frontends/javascript-typescript.js +1825 -93
  113. package/build/src/frontends/kotlin.d.ts +10 -0
  114. package/build/src/frontends/kotlin.d.ts.map +1 -0
  115. package/build/src/frontends/kotlin.js +685 -0
  116. package/build/src/frontends/php.d.ts +118 -1
  117. package/build/src/frontends/php.d.ts.map +1 -1
  118. package/build/src/frontends/php.js +1583 -76
  119. package/build/src/frontends/program.d.ts +74 -0
  120. package/build/src/frontends/program.d.ts.map +1 -0
  121. package/build/src/frontends/program.js +989 -0
  122. package/build/src/frontends/ruby.d.ts +68 -1
  123. package/build/src/frontends/ruby.d.ts.map +1 -1
  124. package/build/src/frontends/ruby.js +1446 -101
  125. package/build/src/frontends/rust-parser.d.ts +11 -0
  126. package/build/src/frontends/rust-parser.d.ts.map +1 -0
  127. package/build/src/frontends/rust-parser.js +15 -0
  128. package/build/src/frontends/rust.d.ts +14 -0
  129. package/build/src/frontends/rust.d.ts.map +1 -0
  130. package/build/src/frontends/rust.js +715 -0
  131. package/build/src/frontends/scalars.d.ts +10 -0
  132. package/build/src/frontends/scalars.d.ts.map +1 -1
  133. package/build/src/frontends/scalars.js +28 -2
  134. package/build/src/frontends/swift.d.ts +10 -0
  135. package/build/src/frontends/swift.d.ts.map +1 -0
  136. package/build/src/frontends/swift.js +860 -0
  137. package/build/src/frontends/types.d.ts +186 -0
  138. package/build/src/frontends/types.d.ts.map +1 -0
  139. package/build/src/frontends/types.js +634 -0
  140. package/build/src/language-registry.d.ts +46 -4
  141. package/build/src/language-registry.d.ts.map +1 -1
  142. package/build/src/language-registry.js +167 -13
  143. package/build/src/mapping.d.ts +2 -2
  144. package/build/src/mapping.d.ts.map +1 -1
  145. package/build/src/mapping.js +31 -10
  146. package/build/src/semantic/capabilities.d.ts +66 -0
  147. package/build/src/semantic/capabilities.d.ts.map +1 -0
  148. package/build/src/semantic/capabilities.js +649 -0
  149. package/build/src/semantic/effects.d.ts +26 -0
  150. package/build/src/semantic/effects.d.ts.map +1 -0
  151. package/build/src/semantic/effects.js +764 -0
  152. package/build/src/semantic/generics.d.ts +23 -0
  153. package/build/src/semantic/generics.d.ts.map +1 -0
  154. package/build/src/semantic/generics.js +61 -0
  155. package/build/src/semantic/lifetime.d.ts +37 -0
  156. package/build/src/semantic/lifetime.d.ts.map +1 -0
  157. package/build/src/semantic/lifetime.js +527 -0
  158. package/build/src/semantic/provenance.d.ts +9 -2
  159. package/build/src/semantic/provenance.d.ts.map +1 -1
  160. package/build/src/semantic/provenance.js +462 -20
  161. package/build/src/semantic/scalars.d.ts +11 -0
  162. package/build/src/semantic/scalars.d.ts.map +1 -1
  163. package/build/src/semantic/scalars.js +16 -1
  164. package/build/src/semantic/stdlib.d.ts +254 -0
  165. package/build/src/semantic/stdlib.d.ts.map +1 -0
  166. package/build/src/semantic/stdlib.js +880 -0
  167. package/build/src/semantic/types.d.ts +2952 -202
  168. package/build/src/semantic/types.d.ts.map +1 -1
  169. package/build/src/semantic/types.js +688 -15
  170. package/build/src/semantic/validate.d.ts +85 -5
  171. package/build/src/semantic/validate.d.ts.map +1 -1
  172. package/build/src/semantic/validate.js +2576 -98
  173. package/build/src/stdlib-facades.d.ts +304 -0
  174. package/build/src/stdlib-facades.d.ts.map +1 -0
  175. package/build/src/stdlib-facades.js +1167 -0
  176. package/build/src/stdlib-negotiation.d.ts +69 -0
  177. package/build/src/stdlib-negotiation.d.ts.map +1 -0
  178. package/build/src/stdlib-negotiation.js +403 -0
  179. package/build/src/stdlib-providers.d.ts +72 -0
  180. package/build/src/stdlib-providers.d.ts.map +1 -0
  181. package/build/src/stdlib-providers.js +339 -0
  182. package/build/src/toolchains.d.ts +55 -1
  183. package/build/src/toolchains.d.ts.map +1 -1
  184. package/build/src/toolchains.js +15 -4
  185. package/docs/architecture.md +45 -13
  186. package/docs/dart.md +60 -0
  187. package/docs/goals.md +3 -3
  188. package/docs/ios.md +121 -0
  189. package/docs/kotlin.md +42 -0
  190. package/docs/language-support.md +231 -26
  191. package/docs/multi-file-modules.md +52 -0
  192. package/docs/parser-qualification.md +121 -8
  193. package/docs/plans/2026-09-05-standard-library-portability.md +10 -10
  194. package/docs/rust.md +88 -0
  195. package/docs/source-maps.md +15 -7
  196. package/docs/standard-library-portability.md +39 -8
  197. package/docs/swift.md +44 -0
  198. package/docs/testing.md +366 -4
  199. package/docs/webassembly.md +52 -0
  200. package/index.js +63 -8
  201. package/node_modules/semantifold-tree-sitter-legacy-internal/README.md +2 -2
  202. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/LICENSE +21 -0
  203. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/README.md +45 -0
  204. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/binding.gyp +30 -0
  205. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/binding.cc +20 -0
  206. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/binding_test.js +9 -0
  207. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/index.d.ts +28 -0
  208. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/index.js +11 -0
  209. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/grammar.js +1630 -0
  210. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/package.json +64 -0
  211. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/darwin-arm64/tree-sitter-rust.node +0 -0
  212. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/darwin-x64/tree-sitter-rust.node +0 -0
  213. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/linux-arm64/tree-sitter-rust.node +0 -0
  214. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/linux-x64/tree-sitter-rust.node +0 -0
  215. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/win32-arm64/tree-sitter-rust.node +0 -0
  216. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/win32-x64/tree-sitter-rust.node +0 -0
  217. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/queries/highlights.scm +159 -0
  218. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/queries/injections.scm +9 -0
  219. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/queries/tags.scm +60 -0
  220. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/grammar.json +9405 -0
  221. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/node-types.json +5399 -0
  222. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/parser.c +192569 -0
  223. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/scanner.c +393 -0
  224. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/tree_sitter/alloc.h +54 -0
  225. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/tree_sitter/array.h +290 -0
  226. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/tree_sitter/parser.h +266 -0
  227. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/tree-sitter-rust.wasm +0 -0
  228. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/tree-sitter.json +53 -0
  229. package/node_modules/semantifold-tree-sitter-legacy-internal/package.json +3 -2
  230. package/node_modules/semantifold-tree-sitter-legacy-internal/src/c.js +5 -4
  231. package/package.json +5 -2
  232. package/src/artifact-path.js +47 -2
  233. package/src/artifacts.js +67 -0
  234. package/src/backends/c-validation.js +6 -1
  235. package/src/backends/cpp-validation.js +6 -1
  236. package/src/backends/csharp.js +3 -0
  237. package/src/backends/dart-runtime.js +41 -0
  238. package/src/backends/dart.js +326 -0
  239. package/src/backends/effects.js +705 -0
  240. package/src/backends/go.js +14 -2
  241. package/src/backends/identifiers.js +160 -9
  242. package/src/backends/index.js +27 -2
  243. package/src/backends/ios.js +1612 -0
  244. package/src/backends/java.js +454 -36
  245. package/src/backends/javascript.js +389 -23
  246. package/src/backends/kotlin-runtime.js +29 -0
  247. package/src/backends/kotlin.js +141 -0
  248. package/src/backends/native-validation.js +1 -1
  249. package/src/backends/ordered-expressions.js +40 -6
  250. package/src/backends/php-stdlib-support.js +239 -0
  251. package/src/backends/php.js +469 -32
  252. package/src/backends/program.js +1407 -0
  253. package/src/backends/python.js +3 -0
  254. package/src/backends/ruby.js +326 -23
  255. package/src/backends/rust-runtime.js +34 -0
  256. package/src/backends/rust-validation.js +75 -0
  257. package/src/backends/rust.js +335 -0
  258. package/src/backends/scalars.js +141 -16
  259. package/src/backends/shared.js +2304 -124
  260. package/src/backends/stdlib-support.js +234 -0
  261. package/src/backends/swift-runtime.js +14 -0
  262. package/src/backends/swift.js +132 -0
  263. package/src/backends/typescript.js +349 -23
  264. package/src/backends/wasm.js +2208 -0
  265. package/src/backends/writer.js +520 -2
  266. package/src/diagnostic.js +4 -2
  267. package/src/frontends/c.js +4 -2
  268. package/src/frontends/cpp.js +4 -2
  269. package/src/frontends/csharp.js +4 -2
  270. package/src/frontends/dart.js +963 -0
  271. package/src/frontends/index.js +14 -4
  272. package/src/frontends/java.js +1977 -69
  273. package/src/frontends/javascript-typescript.js +2046 -102
  274. package/src/frontends/kotlin.js +713 -0
  275. package/src/frontends/php.js +1725 -79
  276. package/src/frontends/program.js +1062 -0
  277. package/src/frontends/ruby.js +1624 -98
  278. package/src/frontends/rust-parser.js +18 -0
  279. package/src/frontends/rust.js +714 -0
  280. package/src/frontends/scalars.js +31 -1
  281. package/src/frontends/swift.js +893 -0
  282. package/src/frontends/types.js +750 -0
  283. package/src/language-registry.js +172 -12
  284. package/src/mapping.js +33 -9
  285. package/src/semantic/capabilities.js +671 -0
  286. package/src/semantic/effects.js +737 -0
  287. package/src/semantic/generics.js +58 -0
  288. package/src/semantic/lifetime.js +517 -0
  289. package/src/semantic/provenance.js +412 -19
  290. package/src/semantic/scalars.js +17 -0
  291. package/src/semantic/stdlib.js +921 -0
  292. package/src/semantic/types.js +765 -14
  293. package/src/semantic/validate.js +2934 -209
  294. package/src/stdlib-facades.js +1211 -0
  295. package/src/stdlib-negotiation.js +446 -0
  296. package/src/stdlib-providers.js +377 -0
  297. package/src/toolchains.js +16 -3
package/docs/ios.md ADDED
@@ -0,0 +1,121 @@
1
+ # iOS application target
2
+
3
+ Task 026 has an implemented Linux-qualified deterministic generation/provenance slice, with materialization and Apple-platform acceptance explicitly deferred. The registered `ios` identity is a target-only application backend: it has no frontend, text backend, binary-backend route, interoperability bridge, provider role, source-discovery behavior, filesystem writer, or entry in `supportedLanguages`. Real Xcode, Apple SDK, XCTest, XCUIAutomation, and iOS Simulator proof has not been run, so the task is not delivered and the generated Xcode model is not yet platform-qualified.
4
+
5
+ ## Public route
6
+
7
+ Callers parse source normally, build an explicit Task 010 program, and request the application role. Omitting `role` retains ordinary text generation. Generation is pure and performs no filesystem access.
8
+
9
+ ```js
10
+ import {generateProgramArtifactSet, parseProgram} from "semantifold"
11
+
12
+ const program = parseProgram({
13
+ entryModule: "main",
14
+ sources: [{
15
+ filename: "main.rb",
16
+ id: "main",
17
+ language: "ruby",
18
+ source: "module Main\n puts 7\nend\n"
19
+ }]
20
+ })
21
+
22
+ const artifactSet = generateProgramArtifactSet({
23
+ configuration: {
24
+ bundleIdentifier: "com.example.semantifold",
25
+ deploymentTarget: "18.0",
26
+ displayName: "Semantifold",
27
+ moduleName: "SemantifoldApp",
28
+ organizationPrefix: "com.example",
29
+ productName: "SemantifoldApp"
30
+ },
31
+ language: "ios",
32
+ program,
33
+ role: "application"
34
+ })
35
+ ```
36
+
37
+ `generateArtifactSet` accepts the same application fields for one semantic module and normalizes it to one project module. Both routes validate the entire semantic graph before rendering. The source registry accepts provenance from every registered frontend language, including compatible Dart modules, while the supported semantics remain exactly the Tasks 001–004 Swift subset from Task 022: typed scalar values, typed locals/assignment, the closed scalar operators, nested statement blocks/conditionals, exact two-argument scalar-return functions, resolved calls, and deterministic text output. Task 010 owns project modules, source ownership, imports, exports, and dependency order. iOS adds no parser rule or semantic node for SwiftUI, application lifecycle, capture, configuration, resources, signing, or Apple APIs.
38
+
39
+ Program-shaped application dispatch is limited to program-capable application targets, currently only `ios`. The separate Wasm application backend remains available through the single-module `generateArtifactSet` route and is rejected with `UNSUPPORTED_ROLE` when requested through `generateProgramArtifactSet`; a program object is never passed to that module backend.
40
+
41
+ Unsupported source or caller-supplied IR produces a located `SemantifoldDiagnostic` with `UNSUPPORTED_CAPABILITY` and target `ios`. The backend never embeds Ruby, invokes a Ruby runtime from the app, translates through JavaScript, emulates dynamic Ruby behavior, or discovers sources/packages.
42
+
43
+ ## Closed configuration and assets
44
+
45
+ The required configuration fields are `productName`, `moduleName`, `organizationPrefix`, `bundleIdentifier`, `deploymentTarget`, and `displayName`. They are caller-owned; no account, team, certificate, provisioning profile, installed SDK, or host path supplies a default. Product and module names are ASCII upper-camel identifiers. Organization and bundle identities are canonical lowercase reverse DNS, and the bundle must extend the organization prefix. Deployment is a canonical caller-supplied `major.minor` string.
46
+
47
+ The only defaults are:
48
+
49
+ | Field | Exact value |
50
+ | --- | --- |
51
+ | `sourceRoot` | `Sources` |
52
+ | `resourceRoot` | `Assets.xcassets` |
53
+ | `lifecycle` | `swiftui` |
54
+ | `infoPlist` | empty object |
55
+ | `permissions` | empty array |
56
+ | `entitlements` | empty array |
57
+ | `privacyDeclarations` | empty array |
58
+ | `capabilities` | empty array |
59
+
60
+ The schema is closed. Unknown fields, any nonempty plist extension/capability set, alternate lifecycle/root, or invalid identity fails before emission. The baseline creates no entitlements file and does not synthesize an icon.
61
+
62
+ Every asset is explicit `{path, content, mediaType, sha256}` input. Its path must use only ASCII letters, digits, `.`, `_`, and `-` in nonempty relative POSIX components below `Assets.xcassets`; this closed alphabet has complete ASCII case-fold comparison. Sharp-S, sigma, composed/decomposed non-ASCII names, traversal, duplicates, case-fold collisions, and file/directory-prefix collisions fail at input validation before an artifact set is returned. This path restriction does not alter Unicode semantic source filenames, source text, string values, or generated Swift content. Asset content is a nonempty exact string or `Uint8Array`, and its lowercase SHA-256 must match the exact UTF-8 text or bytes. Assets are defensively copied and sorted.
63
+
64
+ ## Deterministic artifact contract
65
+
66
+ Generation returns one ordered `GeneratedArtifactSet` with exactly one `entry`, `Sources/Application/App.swift`. The fixed categories are:
67
+
68
+ 1. `<Product>.xcodeproj/project.pbxproj` and its shared scheme;
69
+ 2. `Configuration/Base.xcconfig` and `Configuration/Info.plist`;
70
+ 3. the shared semantic runtime and one namespace-owned Swift file per project module;
71
+ 4. `App.swift`, `SemantifoldBridge.swift`, and `SemantifoldOutputView.swift`;
72
+ 5. base `Assets.xcassets/Contents.json` and exact caller assets;
73
+ 6. pure-logic XCTest and accessibility-route XCUI test sources;
74
+ 7. `semantifold-project.json`.
75
+
76
+ The semantic renderer uses one shared reference-type `SemantifoldOutputSink`. Nested calls receive that same sink, preserving exact evaluation/output order. The semantic entry returns `[String]`; the bridge invokes it; the SwiftUI view joins with one LF and assigns accessibility identifier `semantifold-output`. Per-module Swift lives in deterministic `SemantifoldModule…` namespaces.
77
+
78
+ Xcode object IDs are the uppercase first 24 hexadecimal digits of built-in SHA-256 over normalized, collision-checked full identities. Project sections, groups, build phases, build settings, paths, configuration JSON, and assets have canonical ordering; text uses LF and relative paths. Signing is disabled and no entitlement/team/account/certificate/provision data is emitted. Two generations from the same validated input return byte-identical artifacts. The generated Xcode source/project syntax is deterministic but remains platform-unqualified.
79
+
80
+ ## Manifest and provenance
81
+
82
+ `semantifold-project.json` is `SemantifoldIosProject` version 1. It records generator identity/version, target, the complete normalized configuration, caller source and asset hashes, exact ordered owned paths, explicit excluded path patterns, and Apple tool requirements whose status is `deferred`. Its `SemantifoldIosSemanticProgram` version 1 section preserves caller-order source IDs, filenames, hashes and ownership; dependency-order caller module IDs and import dependencies; source-to-module ownership links; generated namespaces/artifacts; and the selected entry module, generated function, bridge, and application artifact linkage.
83
+
84
+ Mapped semantic Swift retains rich UTF-16 range provenance and Source Map v3 projection through every originating module, including Ruby and Dart. Synthetic runtime, SwiftUI, project, configuration, asset-catalog base metadata, and test scaffolding carry explicit synthetic provenance. Each owning renderer records causal configuration spans while emitting a specific field-derived token; the manifest groups only those ranges with their JSON pointers and never reconstructs ownership through substring scans. Equal module/product values, an organization prefix embedded in a bundle ID, and synthetic text matching the display name therefore cannot create false citations. Exact assets record path, media type, representation, and SHA-256; binary artifact provenance spans every byte.
85
+
86
+ Build products, `DerivedData`, Xcode user data, code signatures, and caller files outside the owned path list are excluded. The manifest is an ownership description, not a filesystem mutation or permission to overwrite or adopt a project.
87
+
88
+ ## Deferred filesystem publication
89
+
90
+ Materialization is deferred and this release exposes no public project writer. Node's public filesystem API does not provide the combination required by the accepted contract: genuine atomic no-replace publication of a complete directory plus descriptor-relative no-follow anchoring for staging, publication, and cleanup. A path preflight followed by ordinary rename can replace a raced empty directory or follow an exchanged ancestor, so it is not retained as best effort.
91
+
92
+ A future materializer requires a separately authorized, reviewed, and platform-qualified native boundary. Until then, generation returns only an immutable in-memory artifact set; no transactional filesystem, regeneration, adoption, merge, or overwrite claim is made.
93
+
94
+ ## Acceptance status
95
+
96
+ | Criterion | Status | Evidence or remaining boundary |
97
+ | --- | --- | --- |
98
+ | AC01 | implemented | Complete Task 010 graph preflight and Tasks 001–004 lowering are focused-spec covered. |
99
+ | AC02 | partial | SwiftUI shell/bridge/view and capture are generated; real Apple compilation is deferred. |
100
+ | AC03 | implemented | Closed caller configuration and identity validation are covered. |
101
+ | AC04 | implemented | Empty capabilities, exact hashed assets, and the complete portable ASCII path boundary are covered. |
102
+ | AC05 | partial | Canonical project, IDs, paths, LF, and double generation are covered; `xcodebuild` validation is deferred. |
103
+ | AC06 | partial | Unit/UI sources and Linux semantic execution exist; real XCTest/XCUI execution is deferred. |
104
+ | AC07 | deferred | No public materializer ships; atomic no-replace plus descriptor-relative no-follow publication requires a separately authorized native boundary. |
105
+ | AC08 | implemented | Ruby/Dart/Swift mapping, renderer-owned configuration spans, stable semantic program identities/linkage, ownership, and asset provenance are covered. |
106
+ | AC09 | partial | Located capability and stable application diagnostics are covered; filesystem safety diagnostics remain deferred with materialization. |
107
+ | AC10 | implemented | Real Ruby output equals generated Swift output in debug and optimized Linux execution. |
108
+ | AC11 | implemented | No VM, runtime emulation, credentials, entitlements, dependencies, signing, or host leakage is emitted. |
109
+ | AC12 | deferred | No qualified macOS/Xcode/Apple SDK/Swift compiler lane has listed or built the project. |
110
+ | AC13 | deferred | No named iOS Simulator has been booted, installed to, or launched. |
111
+ | AC14 | deferred | No XCTest/XCUIAutomation run has observed exact `semantifold-output` text. |
112
+ | AC15 | implemented locally for generator scope | Focused generation and packed-generator proofs are required; materializer/Apple proof and coordinator CI remain deferred or external. |
113
+ | AC16 | implemented for this reduced scope | Public generator contract, provenance, path boundary, deferrals, testing, changelog, task, and roadmap are documented without claiming delivery. |
114
+
115
+ Linux acceptance runs real Ruby and exact Swift 6.3.3 on x86_64 Linux. Generated semantic Swift is typechecked, compiled, and run in debug and optimized modes with exact Unicode/output assertions. The packed proof uses a fresh cache, empty npm configurations, explicit public registry, default `install-links=false`, ordinary install and clean `npm ci`, full dependency listings, repeated deterministic generation/manifest checks, strict type consumption, and proof that no materializer implementation/declaration is shipped. Missing Ruby or Swift commands fail.
116
+
117
+ Kasper separately selected “Defer the materializer and ship the generator/provenance scope,” so AC07 remains deferred without weakening its transaction guarantee. Per Kasper's 2026-09-14 direction to skip OSX work for now, no `xcodebuild`, Apple SDK, signing, runtime download, simulator, XCTest, or XCUIAutomation command was run, and TensorBuzz configuration was not changed to manufacture a lane. AC12–AC14 also remain deferred. Task 026 and its roadmap row therefore remain in progress rather than delivered.
118
+
119
+ ## Non-goals
120
+
121
+ The profile does not support arbitrary Ruby or Swift, UIKit parity, storyboards, platform APIs, storage, networking, concurrency, background modes, package dependencies, CocoaPods/SwiftPM resolution, non-iOS Apple targets, Objective-C/Objective-C++/Metal bridges, signing, physical devices, archives/export, TestFlight, App Store submission, deployment, release, or publication.
package/docs/kotlin.md ADDED
@@ -0,0 +1,42 @@
1
+ # Kotlin/JVM source and target
2
+
3
+ Task023 adds `kotlin` as a frontend and deterministic single-file Kotlin/JVM text backend for exactly the Tasks001–004 semantic subset. It does not claim Android, Gradle, Kotlin/Native, Kotlin/JS, Wasm, multiplatform projects, compiler plugins, package resolution, or Java interoperability beyond executing the generated JVM bytecode. Android application packaging and lifecycle remain Task028.
4
+
5
+ ## Parser route
6
+
7
+ The frontend uses root `tree-sitter@0.25.1` with the MIT-licensed `tree-sitter-kotlin@0.4.0` grammar from the Semantifold packaging fork. The exact dependency is the full-SHA source archive `https://github.com/kaspernj/tree-sitter-kotlin/archive/57c35ad1a80ccd2a0ebd8fffe852f0d13a20acd0.tar.gz`, and the lock records that HTTPS URL with SHA-512 integrity. The commit is also tagged `v0.4.0-semantifold.1`. The fork keeps grammar ABI 14, declares optional peer `tree-sitter@^0.25.1`, ships typed `nodeTypeInfo`, generated parser/scanner sources and the `node-gyp-build` binding, and has no install-time downloader.
8
+
9
+ The root tarball does not bundle the grammar. A credential-free consumer resolves the immutable archive over HTTPS and verifies its lock integrity, while root `acceptDependencies` remains restricted to the exact private legacy-runtime payload. The packed-consumer proof uses empty user/global npm configuration, a fresh cache, the public registry, default `install-links=false`, full dependency listing, ordinary install, clean `npm ci`, strict public API typing, parser loading, and real Kotlin/JVM execution without SSH or credentials.
10
+
11
+ The adapter exhaustively visits every named, anonymous, extra, error, and missing child, verifies parser indexes through the shared UTF-8-byte-to-UTF-16 converter, rejects lone surrogates and recovery, and never scans source text to recover rejected syntax. The parser route, five fixture hashes, CST corpus, coordinates, lifecycle, package boundary, and exact `kotlinc` differential are recorded in [parser qualification](parser-qualification.md).
12
+
13
+ ## Source profile
14
+
15
+ Source consists of one or more top-level semantic `fun` declarations followed by exactly one `fun main()`. A semantic function has exactly two ordinary parameters and explicit `Long`, `Boolean`, or `String` parameter and return types. Calls are direct, positional, and have exactly two arguments. `main` has no parameters or return annotation and contains the sequenced entry statements; printing is direct one-argument `println(...)`.
16
+
17
+ Locals require `val|var name: Long|Boolean|String = expression`. `val` is immutable and `var` is mutable under the shared assignment rules; targets are plain local identifiers. Conditions require semantic `Boolean`. Braced nested and one-armed `if`, `else`, and fallthrough normalize to semantic blocks. Returns are explicit on every reachable function path.
18
+
19
+ The profile accepts safe canonical decimal integers with an optional uppercase `L`, ordinary noninterpolated strings, Boolean literals, identifiers, calls, integer add/subtract/multiply/negate and ordering, Boolean not/short-circuit and/or, same-type scalar equality/inequality, and string concatenation. Ordinary unescaped identifiers follow the qualified grammar's letters/decimal-digits/underscore profile and NFC requirement; unsupported Unicode identifier forms reject before emission rather than failing generated reparse. Types remain exact: there is no numeric widening, conversion, inference, nullable/platform type, unsigned/arbitrary-width number, boxing, or `null` mapping.
20
+
21
+ Packages, imports, annotations, classes/interfaces/data/value classes, objects/companions, extensions, overloads, generics, lambdas, local functions, delegation, casts, smart casts, referential equality, arrays/collections, indexing, ranges, loops, `when`, exceptions, reflection, coroutines/`suspend`, interpolation, raw strings, qualified calls, arbitrary APIs, and locale-dependent formatting are outside the profile. Parser recovery uses `PARSE_ERROR`; omitted required types use `MISSING_TYPE`; other parsed Kotlin outside the profile uses located `UNSUPPORTED_SYNTAX`.
22
+
23
+ ## Generated program
24
+
25
+ The backend emits exactly one LF-normalized `Program.kt`. It preserves explicit scalar types and `val`/`var`, emits uppercase-`L` integer literals, and uses ordinary Kotlin/JVM scalar equality. Native eager operands and call arguments retain left-to-right order, while `&&` and `||` retain native short-circuiting. Private target-only helpers wrap `Math.addExact`, `subtractExact`, `multiplyExact`, and `negateExact`, then check the result against `-9007199254740991L...9007199254740991L`; dynamic overflow therefore cannot silently wrap outside the semantic safe-integer range. Only the complete byte-for-byte helper CST prefix authorizes helper-call collapse during generated reparse. Caller identifiers cannot enter the helper namespace or capture Kotlin/JVM scaffolding.
26
+
27
+ Rich mappings and Source Map v3 cover semantic names, types, literals, callees, and operators. Runtime helpers, separators, braces, `main`, and `println` plumbing are synthetic and related to semantic origins. Generation validates malformed/cyclic/excessively expanded graphs, types, names, literals, known arithmetic bounds, mutability, and the fixed filename transactionally, then reparses the final source through the registered Kotlin frontend before returning it. Only omitted filenames or exact `Program.kt` are accepted; map directives and alternate map names reject with `UNSUPPORTED_CAPABILITY`.
28
+
29
+ `generateArtifactSet()` returns one `text/x-kotlin` entry plus detached immutable metadata. Its declared build and run recipe is:
30
+
31
+ ```sh
32
+ kotlinc -language-version 2.4 -api-version 2.4 -jvm-target 25 -Werror -include-runtime Program.kt -d Program.jar
33
+ java -jar Program.jar
34
+ ```
35
+
36
+ No Gradle files or downloaded project dependencies are generated.
37
+
38
+ ## Compiler contract
39
+
40
+ `kotlinc` discovery accepts only Kotlin/JVM 2.4.20 on the exact OpenJDK 25.0.4+7 Ubuntu builds: `info: kotlinc-jvm 2.4.20 (JRE 25.0.4+7-1-26.04-Ubuntu)` in the Ubuntu26.04 development image or the corresponding `...-1-24.04-Ubuntu` identity in Ubuntu24.04 TensorBuzz. The canonical command is `kotlinc`; `SEMANTIFOLD_KOTLINC` may provide an absolute executable override. Kotlin execution uses the separate `java25` contract, which invokes `java` through `SEMANTIFOLD_JAVA` and accepts only the complete matching OpenJDK25.0.4 runtime and 64-bit Server VM output for one of those two Ubuntu revisions; the broader Java-language `java` contract remains JRE17-29. Missing, ambiguous, non-executable, wrong-compiler, wrong-Kotlin, or wrong-JRE identities fail loudly.
41
+
42
+ The Dockerfile and TensorBuzz download only the official Kotlin `2.4.20` compiler ZIP from JetBrains and verify SHA-256 `59e9ca74c7904ef2c122b12114937673ccce68de820a663f0ed66ccf8799e0b7` before installation at `/opt/kotlinc`. The development image pins `openjdk-25-jdk-headless=25.0.4+7-1~26.04`; Noble TensorBuzz pins the repository-compatible `25.0.4+7-1~24.04` build. Their bootstrap probes require the complete Kotlin/JVM 2.4.20 and JRE 25.0.4+7 identity while admitting only the known Ubuntu 24.04 or 26.04 packaging suffix. They expose `/opt/kotlinc/bin/kotlinc` through `SEMANTIFOLD_KOTLINC` without shadowing `PATH`. Runtime tests materialize fresh directories, compile original and generated five-profile sources with the exact metadata arguments, execute runnable JARs through the discovered Java25 contract, assert status/stderr/exact UTF-8 stdout bytes, and remove all temporary artifacts.