aontu 0.62.0 → 0.63.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 +1 -1
  2. package/dist/agentsmd.js +0 -27
  3. package/dist/agentsmd.js.map +1 -1
  4. package/dist/alias.js.map +1 -1
  5. package/dist/allow.js +0 -92
  6. package/dist/allow.js.map +1 -1
  7. package/dist/aontu.d.ts +1 -1
  8. package/dist/aontu.js +1 -79
  9. package/dist/aontu.js.map +1 -1
  10. package/dist/aontumodel.d.ts +4 -0
  11. package/dist/aontumodel.js +33 -0
  12. package/dist/aontumodel.js.map +1 -0
  13. package/dist/cli.js +101 -620
  14. package/dist/cli.js.map +1 -1
  15. package/dist/ctx.js +0 -48
  16. package/dist/ctx.js.map +1 -1
  17. package/dist/diff.js +0 -32
  18. package/dist/diff.js.map +1 -1
  19. package/dist/err.js +0 -40
  20. package/dist/err.js.map +1 -1
  21. package/dist/escape.js +0 -45
  22. package/dist/escape.js.map +1 -1
  23. package/dist/exactjson.d.ts +0 -35
  24. package/dist/exactjson.js +0 -131
  25. package/dist/exactjson.js.map +1 -1
  26. package/dist/format.js +13 -203
  27. package/dist/format.js.map +1 -1
  28. package/dist/grammar.d.ts +9 -0
  29. package/dist/grammar.js +54 -0
  30. package/dist/grammar.js.map +1 -0
  31. package/dist/graph.js +0 -26
  32. package/dist/graph.js.map +1 -1
  33. package/dist/hcanon.js +0 -82
  34. package/dist/hcanon.js.map +1 -1
  35. package/dist/helpdoc.js +1 -1
  36. package/dist/helpdoc.js.map +1 -1
  37. package/dist/hints.d.ts +0 -6
  38. package/dist/hints.js +54 -55
  39. package/dist/hints.js.map +1 -1
  40. package/dist/jsonschema.js +0 -114
  41. package/dist/jsonschema.js.map +1 -1
  42. package/dist/keyorder.d.ts +0 -7
  43. package/dist/keyorder.js +0 -41
  44. package/dist/keyorder.js.map +1 -1
  45. package/dist/lang.js +17 -915
  46. package/dist/lang.js.map +1 -1
  47. package/dist/lower.js +11 -61
  48. package/dist/lower.js.map +1 -1
  49. package/dist/lsp-server.js +0 -16
  50. package/dist/lsp-server.js.map +1 -1
  51. package/dist/lsp.d.ts +1 -1
  52. package/dist/lsp.js +12 -159
  53. package/dist/lsp.js.map +1 -1
  54. package/dist/mcp-server.js +0 -26
  55. package/dist/mcp-server.js.map +1 -1
  56. package/dist/mcp.js +0 -113
  57. package/dist/mcp.js.map +1 -1
  58. package/dist/mod-tool.js +0 -130
  59. package/dist/mod-tool.js.map +1 -1
  60. package/dist/mod.js +0 -162
  61. package/dist/mod.js.map +1 -1
  62. package/dist/patch.js +0 -217
  63. package/dist/patch.js.map +1 -1
  64. package/dist/provenance.js +0 -140
  65. package/dist/provenance.js.map +1 -1
  66. package/dist/query.js +0 -75
  67. package/dist/query.js.map +1 -1
  68. package/dist/reach.js +0 -43
  69. package/dist/reach.js.map +1 -1
  70. package/dist/relation.js +0 -61
  71. package/dist/relation.js.map +1 -1
  72. package/dist/render.js +20 -135
  73. package/dist/render.js.map +1 -1
  74. package/dist/report-sarif.d.ts +0 -11
  75. package/dist/report-sarif.js +0 -28
  76. package/dist/report-sarif.js.map +1 -1
  77. package/dist/sig.js +0 -35
  78. package/dist/sig.js.map +1 -1
  79. package/dist/sigdecl.js +1 -1
  80. package/dist/sigdecl.js.map +1 -1
  81. package/dist/siggate.js +0 -4
  82. package/dist/siggate.js.map +1 -1
  83. package/dist/site.js +3 -29
  84. package/dist/site.js.map +1 -1
  85. package/dist/subsume.d.ts +0 -10
  86. package/dist/subsume.js +0 -137
  87. package/dist/subsume.js.map +1 -1
  88. package/dist/template.d.ts +2 -1
  89. package/dist/template.js +58 -138
  90. package/dist/template.js.map +1 -1
  91. package/dist/trim.js +0 -41
  92. package/dist/trim.js.map +1 -1
  93. package/dist/tsconfig.tsbuildinfo +1 -1
  94. package/dist/type.js.map +1 -1
  95. package/dist/unify.js +12 -242
  96. package/dist/unify.js.map +1 -1
  97. package/dist/utility.js +0 -22
  98. package/dist/utility.js.map +1 -1
  99. package/dist/val/AbnfFuncVal.d.ts +18 -0
  100. package/dist/val/AbnfFuncVal.js +132 -0
  101. package/dist/val/AbnfFuncVal.js.map +1 -0
  102. package/dist/val/AbsentVal.d.ts +11 -0
  103. package/dist/val/AbsentVal.js +30 -0
  104. package/dist/val/AbsentVal.js.map +1 -0
  105. package/dist/val/AggFuncVal.d.ts +10 -1
  106. package/dist/val/AggFuncVal.js +104 -116
  107. package/dist/val/AggFuncVal.js.map +1 -1
  108. package/dist/val/ArithFuncVal.js +0 -12
  109. package/dist/val/ArithFuncVal.js.map +1 -1
  110. package/dist/val/BagVal.js +1 -78
  111. package/dist/val/BagVal.js.map +1 -1
  112. package/dist/val/BigDecimalVal.js +0 -16
  113. package/dist/val/BigDecimalVal.js.map +1 -1
  114. package/dist/val/BigIntegerVal.js +0 -16
  115. package/dist/val/BigIntegerVal.js.map +1 -1
  116. package/dist/val/CloseFuncVal.js +0 -9
  117. package/dist/val/CloseFuncVal.js.map +1 -1
  118. package/dist/val/CmpFuncVal.js +2 -59
  119. package/dist/val/CmpFuncVal.js.map +1 -1
  120. package/dist/val/ConjunctVal.js +0 -29
  121. package/dist/val/ConjunctVal.js.map +1 -1
  122. package/dist/val/ConstraintVal.js +0 -500
  123. package/dist/val/ConstraintVal.js.map +1 -1
  124. package/dist/val/ContainerKindVal.js +0 -2
  125. package/dist/val/ContainerKindVal.js.map +1 -1
  126. package/dist/val/CopyFuncVal.js +0 -3
  127. package/dist/val/CopyFuncVal.js.map +1 -1
  128. package/dist/val/Decimal.js +0 -179
  129. package/dist/val/Decimal.js.map +1 -1
  130. package/dist/val/DeprecateFuncVal.js.map +1 -1
  131. package/dist/val/DisjunctVal.js +0 -152
  132. package/dist/val/DisjunctVal.js.map +1 -1
  133. package/dist/val/EachFuncVal.js +0 -3
  134. package/dist/val/EachFuncVal.js.map +1 -1
  135. package/dist/val/EmitFuncVal.d.ts +1 -1
  136. package/dist/val/EmitFuncVal.js +6 -119
  137. package/dist/val/EmitFuncVal.js.map +1 -1
  138. package/dist/val/ExpectVal.js +0 -62
  139. package/dist/val/ExpectVal.js.map +1 -1
  140. package/dist/val/FilterFuncVal.js +0 -25
  141. package/dist/val/FilterFuncVal.js.map +1 -1
  142. package/dist/val/FuncBaseVal.d.ts +1 -0
  143. package/dist/val/FuncBaseVal.js +7 -127
  144. package/dist/val/FuncBaseVal.js.map +1 -1
  145. package/dist/val/GraphAtomVal.js +0 -15
  146. package/dist/val/GraphAtomVal.js.map +1 -1
  147. package/dist/val/HideFuncVal.js +0 -13
  148. package/dist/val/HideFuncVal.js.map +1 -1
  149. package/dist/val/IntegerVal.js +0 -61
  150. package/dist/val/IntegerVal.js.map +1 -1
  151. package/dist/val/JunctionVal.js +0 -20
  152. package/dist/val/JunctionVal.js.map +1 -1
  153. package/dist/val/KeyFuncVal.js +0 -46
  154. package/dist/val/KeyFuncVal.js.map +1 -1
  155. package/dist/val/ListVal.js +0 -57
  156. package/dist/val/ListVal.js.map +1 -1
  157. package/dist/val/LowerFuncVal.js +0 -11
  158. package/dist/val/LowerFuncVal.js.map +1 -1
  159. package/dist/val/MapVal.js +0 -151
  160. package/dist/val/MapVal.js.map +1 -1
  161. package/dist/val/MatchFuncVal.js +0 -27
  162. package/dist/val/MatchFuncVal.js.map +1 -1
  163. package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
  164. package/dist/val/MaybeFuncVal.js +50 -0
  165. package/dist/val/MaybeFuncVal.js.map +1 -0
  166. package/dist/val/MoveFuncVal.js +0 -18
  167. package/dist/val/MoveFuncVal.js.map +1 -1
  168. package/dist/val/NilVal.js +0 -60
  169. package/dist/val/NilVal.js.map +1 -1
  170. package/dist/val/NomFuncVal.js +8 -42
  171. package/dist/val/NomFuncVal.js.map +1 -1
  172. package/dist/val/NumberVal.js +0 -15
  173. package/dist/val/NumberVal.js.map +1 -1
  174. package/dist/val/OpBaseVal.d.ts +1 -0
  175. package/dist/val/OpBaseVal.js +3 -15
  176. package/dist/val/OpBaseVal.js.map +1 -1
  177. package/dist/val/PackFuncVal.js +0 -34
  178. package/dist/val/PackFuncVal.js.map +1 -1
  179. package/dist/val/PathFuncVal.js +0 -6
  180. package/dist/val/PathFuncVal.js.map +1 -1
  181. package/dist/val/PathVal.js +0 -41
  182. package/dist/val/PathVal.js.map +1 -1
  183. package/dist/val/PlaceVal.js +0 -25
  184. package/dist/val/PlaceVal.js.map +1 -1
  185. package/dist/val/PlusOpVal.d.ts +1 -7
  186. package/dist/val/PlusOpVal.js +13 -74
  187. package/dist/val/PlusOpVal.js.map +1 -1
  188. package/dist/val/PrefFuncVal.js +0 -1
  189. package/dist/val/PrefFuncVal.js.map +1 -1
  190. package/dist/val/PrefVal.js +0 -167
  191. package/dist/val/PrefVal.js.map +1 -1
  192. package/dist/val/RecurseVal.js +0 -55
  193. package/dist/val/RecurseVal.js.map +1 -1
  194. package/dist/val/RefVal.js +0 -282
  195. package/dist/val/RefVal.js.map +1 -1
  196. package/dist/val/ReferFuncVal.js +0 -232
  197. package/dist/val/ReferFuncVal.js.map +1 -1
  198. package/dist/val/ScalarKindVal.js +0 -49
  199. package/dist/val/ScalarKindVal.js.map +1 -1
  200. package/dist/val/ScalarVal.js +0 -11
  201. package/dist/val/ScalarVal.js.map +1 -1
  202. package/dist/val/StrFuncVal.js +0 -18
  203. package/dist/val/StrFuncVal.js.map +1 -1
  204. package/dist/val/SuperFuncVal.js +0 -32
  205. package/dist/val/SuperFuncVal.js.map +1 -1
  206. package/dist/val/TopVal.js +0 -1
  207. package/dist/val/TopVal.js.map +1 -1
  208. package/dist/val/TranslateFuncVal.js +1 -3
  209. package/dist/val/TranslateFuncVal.js.map +1 -1
  210. package/dist/val/UpperFuncVal.js +0 -11
  211. package/dist/val/UpperFuncVal.js.map +1 -1
  212. package/dist/val/Val.d.ts +1 -0
  213. package/dist/val/Val.js +2 -133
  214. package/dist/val/Val.js.map +1 -1
  215. package/dist/val/VarVal.js +0 -12
  216. package/dist/val/VarVal.js.map +1 -1
  217. package/dist/val/arith.js +0 -37
  218. package/dist/val/arith.js.map +1 -1
  219. package/dist/val/caserange.js +0 -61
  220. package/dist/val/caserange.js.map +1 -1
  221. package/dist/val/members.js +0 -6
  222. package/dist/val/members.js.map +1 -1
  223. package/dist/val/numcmp.js +0 -11
  224. package/dist/val/numcmp.js.map +1 -1
  225. package/dist/val/numkind.js +0 -145
  226. package/dist/val/numkind.js.map +1 -1
  227. package/dist/val/valutil.js +0 -16
  228. package/dist/val/valutil.js.map +1 -1
  229. package/dist/vet.js +0 -461
  230. package/dist/vet.js.map +1 -1
  231. package/dist/view.js +0 -414
  232. package/dist/view.js.map +1 -1
  233. package/dist/walk.js +0 -41
  234. package/dist/walk.js.map +1 -1
  235. package/grammar/aontu.abnf +8 -6
  236. package/grammar/aontu.gbnf +4 -4
  237. package/grammar/aontu.lark +4 -4
  238. package/grammar/aontu.tmLanguage.json +1 -1
  239. package/package.json +4 -2
  240. package/src/agentsmd.ts +0 -35
  241. package/src/alias.ts +0 -39
  242. package/src/allow.ts +1 -96
  243. package/src/aontu.ts +3 -110
  244. package/src/aontumodel.ts +32 -0
  245. package/src/cli.ts +113 -682
  246. package/src/ctx.ts +0 -103
  247. package/src/diff.ts +0 -40
  248. package/src/err.ts +0 -40
  249. package/src/escape.ts +0 -46
  250. package/src/exactjson.ts +0 -131
  251. package/src/format.ts +14 -257
  252. package/src/grammar.ts +72 -0
  253. package/src/graph.ts +0 -61
  254. package/src/hcanon.ts +0 -82
  255. package/src/helpdoc.ts +1 -1
  256. package/src/hints.ts +66 -57
  257. package/src/jsonschema.ts +0 -123
  258. package/src/keyorder.ts +0 -42
  259. package/src/lang.ts +19 -931
  260. package/src/lower.ts +12 -62
  261. package/src/lsp-server.ts +0 -16
  262. package/src/lsp.ts +12 -180
  263. package/src/mcp-server.ts +0 -31
  264. package/src/mcp.ts +0 -130
  265. package/src/mod-tool.ts +0 -158
  266. package/src/mod.ts +0 -178
  267. package/src/patch.ts +0 -232
  268. package/src/provenance.ts +0 -183
  269. package/src/query.ts +0 -84
  270. package/src/reach.ts +0 -53
  271. package/src/relation.ts +0 -84
  272. package/src/render.ts +20 -172
  273. package/src/report-sarif.ts +0 -48
  274. package/src/sig.ts +0 -35
  275. package/src/sigdecl.ts +1 -1
  276. package/src/siggate.ts +0 -30
  277. package/src/site.ts +3 -29
  278. package/src/subsume.ts +1 -161
  279. package/src/template.ts +69 -140
  280. package/src/trim.ts +0 -53
  281. package/src/type.ts +2 -45
  282. package/src/unify.ts +13 -251
  283. package/src/utility.ts +0 -31
  284. package/src/val/AbnfFuncVal.ts +181 -0
  285. package/src/val/AbsentVal.ts +54 -0
  286. package/src/val/AggFuncVal.ts +152 -188
  287. package/src/val/ArithFuncVal.ts +0 -20
  288. package/src/val/BagVal.ts +1 -78
  289. package/src/val/BigDecimalVal.ts +0 -16
  290. package/src/val/BigIntegerVal.ts +0 -16
  291. package/src/val/CloseFuncVal.ts +0 -9
  292. package/src/val/CmpFuncVal.ts +4 -166
  293. package/src/val/ConjunctVal.ts +0 -33
  294. package/src/val/ConstraintVal.ts +2 -537
  295. package/src/val/ContainerKindVal.ts +0 -18
  296. package/src/val/CopyFuncVal.ts +0 -5
  297. package/src/val/Decimal.ts +1 -185
  298. package/src/val/DeprecateFuncVal.ts +0 -10
  299. package/src/val/DisjunctVal.ts +0 -157
  300. package/src/val/EachFuncVal.ts +0 -40
  301. package/src/val/EmitFuncVal.ts +8 -208
  302. package/src/val/ExpectVal.ts +0 -62
  303. package/src/val/FilterFuncVal.ts +0 -55
  304. package/src/val/FuncBaseVal.ts +9 -130
  305. package/src/val/GraphAtomVal.ts +0 -42
  306. package/src/val/HideFuncVal.ts +0 -15
  307. package/src/val/IntegerVal.ts +0 -61
  308. package/src/val/JunctionVal.ts +0 -20
  309. package/src/val/KeyFuncVal.ts +0 -48
  310. package/src/val/ListVal.ts +0 -59
  311. package/src/val/LowerFuncVal.ts +0 -12
  312. package/src/val/MapVal.ts +0 -151
  313. package/src/val/MatchFuncVal.ts +0 -59
  314. package/src/val/MaybeFuncVal.ts +86 -0
  315. package/src/val/MoveFuncVal.ts +0 -20
  316. package/src/val/NilVal.ts +0 -60
  317. package/src/val/NomFuncVal.ts +8 -95
  318. package/src/val/NumberVal.ts +0 -16
  319. package/src/val/OpBaseVal.ts +4 -17
  320. package/src/val/PackFuncVal.ts +0 -63
  321. package/src/val/PathFuncVal.ts +0 -32
  322. package/src/val/PathVal.ts +0 -66
  323. package/src/val/PlaceVal.ts +0 -45
  324. package/src/val/PlusOpVal.ts +18 -75
  325. package/src/val/PrefFuncVal.ts +0 -1
  326. package/src/val/PrefVal.ts +0 -179
  327. package/src/val/RecurseVal.ts +0 -81
  328. package/src/val/RefVal.ts +1 -285
  329. package/src/val/ReferFuncVal.ts +0 -255
  330. package/src/val/ScalarKindVal.ts +0 -50
  331. package/src/val/ScalarVal.ts +0 -12
  332. package/src/val/StrFuncVal.ts +0 -44
  333. package/src/val/SuperFuncVal.ts +0 -42
  334. package/src/val/TopVal.ts +0 -1
  335. package/src/val/TranslateFuncVal.ts +1 -51
  336. package/src/val/UpperFuncVal.ts +0 -12
  337. package/src/val/Val.ts +3 -192
  338. package/src/val/VarVal.ts +0 -15
  339. package/src/val/arith.ts +0 -92
  340. package/src/val/caserange.ts +0 -62
  341. package/src/val/members.ts +0 -23
  342. package/src/val/numcmp.ts +1 -27
  343. package/src/val/numkind.ts +0 -149
  344. package/src/val/valutil.ts +0 -16
  345. package/src/vet.ts +1 -582
  346. package/src/view.ts +0 -507
  347. package/src/walk.ts +0 -41
  348. package/dist/std.d.ts +0 -3
  349. package/dist/std.js +0 -672
  350. package/dist/std.js.map +0 -1
  351. package/dist/val/FormFuncVal.js +0 -55
  352. package/dist/val/FormFuncVal.js.map +0 -1
  353. package/dist/val/NamerFuncVal.d.ts +0 -12
  354. package/dist/val/NamerFuncVal.js +0 -176
  355. package/dist/val/NamerFuncVal.js.map +0 -1
  356. package/src/std.ts +0 -683
@@ -18,12 +18,10 @@ import {
18
18
  } from '../utility'
19
19
 
20
20
 
21
-
22
21
  import { FuncBaseVal } from './FuncBaseVal'
23
22
  import { PrefFuncVal } from './PrefFuncVal'
24
23
 
25
24
 
26
-
27
25
  class MoveFuncVal extends FuncBaseVal {
28
26
  isMoveFunc = true
29
27
 
@@ -55,23 +53,6 @@ class MoveFuncVal extends FuncBaseVal {
55
53
  if (!orig.isNil) {
56
54
  const src = orig.clone(ctx)
57
55
 
58
- // THE HIDE-WALK ONLY RUNS WHEN THE CLONE IS A SEPARATE OBJECT.
59
- //
60
- // move() is the only function that marks the ORIGINAL rather than
61
- // the clone -- that is how the value disappears from its old home
62
- // and reappears at the destination. It relies on clone() returning
63
- // something distinct to carry to the destination.
64
- //
65
- // TopVal.clone is the IDENTITY function, so for `move(top)` the
66
- // clone and the original are the same object and the walk hid the
67
- // very value being returned: the key vanished from generated output
68
- // with no error, while canon still showed `x:top` -- the port
69
- // disagreeing with itself.
70
- //
71
- // With the walk skipped, `move(top)` keeps `top` at the destination
72
- // and then errors there because top is not generable, which is
73
- // already what `x:top`, `x:copy(top)` and `x:pref(top)` do in both
74
- // ports, and what `move(number)` does for the same reason.
75
56
  if (src !== orig) {
76
57
  if (src.isRef) {
77
58
  src.mark._hide_found = true
@@ -86,7 +67,6 @@ class MoveFuncVal extends FuncBaseVal {
86
67
  out = new PrefFuncVal({ peg: [src] }, ctx)
87
68
  }
88
69
 
89
- // console.log('MOVE-resolve', orig, out)
90
70
 
91
71
  return out
92
72
  }
package/src/val/NilVal.ts CHANGED
@@ -33,7 +33,6 @@ class NilVal extends Val {
33
33
  attempt?: string
34
34
  details?: Record<string, any>
35
35
 
36
- // TODO: include Val generating nil, thus capture type
37
36
 
38
37
  // A Nil is an error - should not happen - unify failed
39
38
  // refactor ,make(spec,ctx)
@@ -79,52 +78,6 @@ class NilVal extends Val {
79
78
  }
80
79
  }
81
80
 
82
- // THE PATH IS WHERE THE MEET IS, NOT WHERE THE OPERAND WAS WRITTEN
83
- // (use-cases/BUGS.md §41). The operand path above decides the SITE
84
- // correctly and the path only by accident: a value that arrives by
85
- // REFERENCE is re-pathed to the referring field, and its children
86
- // are re-pathed to that same field rather than rebased under it, so
87
- // every conflict inside `q: $.M` reported `$.q` — the enclosing
88
- // record, not the key to edit, and the SAME path for every one of
89
- // its fields. The context has descended to the child by the time
90
- // the meet fails, and Go reads the path off the tree position for
91
- // exactly this reason.
92
- //
93
- // Only EXTENDS, never redirects: the context path is taken when the
94
- // operand's path is a PREFIX of it, so a nil minted away from the
95
- // descent (a func resolving an argument, a generator's own probe,
96
- // an anchored `--at` run whose operand is already correctly placed)
97
- // keeps the path its operand carries. Taking the context path
98
- // unconditionally was tried and reverted -- it moved the closed-key,
99
- // spread-template and every `--at` finding to the driving location,
100
- // which is not where those belong.
101
- // A MEET OF TWO OPERANDS HAPPENS AT THE SLOT, always. A value that
102
- // arrives by REFERENCE carries a path re-based onto the referring
103
- // field -- `$.p.Port.direction` for a `p: $.lib.Port` whose
104
- // `direction` conflicts -- and the two ports corrupt it DIFFERENTLY
105
- // (Go's fallback is the slot plus the schema's own tail), so neither
106
- // operand path is trustworthy once a reference is in play. The
107
- // prefix test below cannot tell the corrupt case from a legitimately
108
- // deeper one, because Go's corrupt path EXTENDS the right answer.
109
- // The slot is the one thing both ports know exactly, so a real meet
110
- // takes it.
111
- //
112
- // A SINGLE-OPERAND nil is left alone: a residue, a closed key, a
113
- // generation failure and an `--at` finding are not meets, they are
114
- // facts about one value, and taking the driving location for those
115
- // is what the unconditional version got wrong. The ONE exception is
116
- // an operand that was MINTED -- a preference's yardstick, an
117
- // arithmetic or concat result -- which carries no path at all, so a
118
- // conflict at `$.a` reported `$`, the whole document rather than the
119
- // key to edit.
120
- //
121
- // This used to ask whether the operand's path was a PREFIX of the
122
- // slot, and extend it when so. Once a meet takes the slot outright
123
- // the question is vacuous: every nil still reaching here carries
124
- // either no path or one at least as long as the slot, so the prefix
125
- // walk never ran a single comparison across the whole suite. ADR-002
126
- // closes unreachable code by deleting it rather than by covering it,
127
- // and the emptiness test below is what the walk actually decided.
128
81
  if (null != ctx?.path && 0 < ctx.path.length &&
129
82
  (null != bv || null == nil.path || 0 === nil.path.length)) {
130
83
  nil.path = [...ctx.path]
@@ -171,9 +124,6 @@ class NilVal extends Val {
171
124
  let out = (super.clone(ctx, spec) as NilVal)
172
125
  out.why = this.why
173
126
 
174
- // Should these clone?
175
- // out.primary = this.primary?.clone()
176
- // out.secondary = this.secondary?.clone()
177
127
  out.primary = this.primary
178
128
  out.secondary = this.secondary
179
129
 
@@ -182,7 +132,6 @@ class NilVal extends Val {
182
132
  }
183
133
 
184
134
 
185
- // TODO: custom canon? useful for unknown function errors
186
135
  get canon() {
187
136
  return 'nil'
188
137
  }
@@ -226,15 +175,6 @@ class NilVal extends Val {
226
175
  }
227
176
 
228
177
 
229
- // Shared sentinel for transient "this unification branch failed"
230
- // markers. Used by DisjunctVal.unify to flag failed member trials
231
- // (and to dedup results) without allocating a fresh NilVal per
232
- // failure. The sentinel is filtered out before the disjunct result
233
- // is constructed, so its .why / .site / .primary fields are never
234
- // inspected by user-visible code.
235
- //
236
- // Do NOT use this sentinel for errors that may surface: those need
237
- // real NilVals with proper site/path info for descErr formatting.
238
178
  const TRIAL_NIL = new NilVal({ why: '|:trial-nil' }) /* node:coverage ignore next 7 */
239
179
 
240
180
 
@@ -1,57 +1,5 @@
1
1
  /* Copyright (c) 2026 Richard Rodger, MIT License */
2
2
 
3
- // `nom` -- NAME TRANSFORMATION, THE GENERAL CASE (SPIKE,
4
- // docs/design/JOSTRACA.0.md).
5
- //
6
- // Generated code is mostly names, and no two targets spell them the
7
- // same way: one model field is `user_id` in SQL, `userId` in
8
- // TypeScript, `UserID` in Go, `USER_ID` in an environment variable and
9
- // `user-id` in a URL. Before this, aontu had whole-string `upper` and
10
- // `lower` and nothing else, so the spike's own worked example wrote
11
- // `Planet` out by hand rather than deriving it -- `upper("planet")` is
12
- // `PLANET`.
13
- //
14
- // nom(s) every spelling, as a map
15
- // nom(s, style) one spelling
16
- // nom(s, acronyms) every spelling, with an acronym set
17
- // nom(s, style, acronyms) one spelling, with an acronym set
18
- //
19
- // THE SOURCE FORMAT IS NOT DECLARED, and that is what makes this the
20
- // general case rather than a family of pairwise converters. A name is
21
- // SPLIT INTO WORDS first -- `user_id`, `userId`, `UserID`, `USER_ID`,
22
- // `user-id`, `user.id` and `user/id` all split to `[user, id]` -- and
23
- // then rendered in the target style. N formats in and M out is one
24
- // splitter and M renderers, not N*M.
25
- //
26
- // THE SPLITTER IS THE RENDERER'S OWN (`splitWords`, ts/src/lower.ts):
27
- // the same one `aontu:profile`'s `%case` uses to lower a declaration,
28
- // so a name derived here and a name the renderer derives cannot
29
- // disagree. It breaks at `_`, `-` and space, at a lower-to-upper
30
- // boundary, at a letter-to-digit boundary either way, and before the
31
- // last capital of a capital run a lower case letter follows
32
- // (`HTTPServer` is HTTP, Server).
33
- //
34
- // `.` AND `/` ARE NORMALISED HERE, not in the splitter. A dotted path
35
- // and a slash path are name formats an author converts FROM, but the
36
- // splitter's behaviour is pinned in cross-port parity by the
37
- // renderer's rows, so the extra separators are this function's
38
- // vocabulary and are folded to `_` before it is asked. The same
39
- // boundary applies to the four styles below that `caseName` does not
40
- // serve: `title`, `text`, `dot` and `path` are nom's, and
41
- // `aontu:profile`'s `%case` set is unchanged.
42
- //
43
- // THE ACRONYM SET is the reason a style alone is not enough. `ledgerId`
44
- // is `LedgerID` in Go and `ledgerId` in TypeScript, which is a fact
45
- // about the TARGET and not about the name -- so it is an argument, and
46
- // a document generating for two targets passes a different one to each.
47
- //
48
- // SPIKE SCOPE. TypeScript only, so -- as with the component primitives
49
- // -- deliberately absent from test/spec/signature.tsv, BUILTIN_FUNCS
50
- // and grammar/, all pinned in cross-port parity. Arity and argument
51
- // shape are refused here rather than by the parse-time table or the
52
- // signature gate, and every refusal is `invalid-arg`, because a new
53
- // code needs a row in test/spec/errcodes.tsv and an entry in BOTH
54
- // ports' tables.
55
3
 
56
4
  import type {
57
5
  Val,
@@ -76,25 +24,20 @@ import { StringVal } from './StringVal'
76
24
  import { FuncBaseVal } from './FuncBaseVal'
77
25
 
78
26
 
79
- // The styles, and the map's keys. The first five are `caseName`'s --
80
- // `aontu:profile`'s `%case` vocabulary, shared with the renderer --
81
- // and the last four are nom's own (see the note above). `as-is` is
82
- // not among them: it is the profile's way of saying "do nothing",
83
- // which is not a spelling anyone asks a namer for.
84
27
  const NOM_STYLES = [
85
28
  'camel', // userId
86
- 'dot', // user.id
87
- 'kebab', // user-id
29
+ 'dot',
30
+ 'kebab',
88
31
  'pascal', // UserId
89
- 'path', // user/id
90
- 'snake', // user_id
91
- 'text', // User id
92
- 'title', // User Id
32
+ 'path',
33
+ 'snake',
34
+ 'text',
35
+ 'title',
93
36
  'upper', // USER_ID
94
37
  ]
95
38
 
96
39
  // nom's style name -> the `%case` style `caseName` serves. `upper` and
97
- // `text` are nom's spellings: `screaming` is what `aontu:profile` calls
40
+ // `text` are nom's spellings: `screaming` is what `aontu:render` calls
98
41
  // SCREAMING_SNAKE and that name is pinned cross-port, so the mapping
99
42
  // lives here rather than in the shared vocabulary.
100
43
  const CASENAME_STYLES: Record<string, string> = {
@@ -110,19 +53,8 @@ const CASENAME_STYLES: Record<string, string> = {
110
53
  // when the name holds no words at all.
111
54
  function styleName(name: string, style: string, acronyms: string[]):
112
55
  string | undefined {
113
- // `.` and `/` are nom's separators, folded before the shared
114
- // splitter is asked (see the note above). Everything else that is
115
- // not a separator is word content: a `$` or a `@` rides into the
116
- // word it sits in, which is why `nom` renames a spelled path's
117
- // text and does not tidy it.
118
56
  const src = name.replace(/[./]/g, '_')
119
57
 
120
- // A NAME WITH NO WORDS IS NOT A NAME, and it is refused in every
121
- // style. `caseName` answers its INPUT for one (it is lowering a
122
- // declaration, where the name has already been vetted), so
123
- // `nom("_", pascal)` came back as `"_"` while `nom("_")`
124
- // refused -- the same argument, accepted by one spelling of the
125
- // call and refused by the other.
126
58
  const words = splitWords(src)
127
59
  if (0 === words.length) {
128
60
  return undefined
@@ -143,14 +75,6 @@ function styleName(name: string, style: string, acronyms: string[]):
143
75
  return words.map((w) => capitalise(w, acronyms)).join(' ')
144
76
  }
145
77
  if ('text' === style) {
146
- // Sentence case: the first word capitalised, the rest lower --
147
- // EXCEPT an acronym, which stays one, because `ledger id` loses
148
- // what `ID` was. Membership in the set decides that, not how the
149
- // input happened to spell the word: asking whether `capitalise`
150
- // changed it made `nom("ledgerId", text, [ID])` answer
151
- // `Ledger id` while `nom("ledgerID", text, [ID])` answered
152
- // `Ledger ID` -- the same name, two answers, decided by its
153
- // source spelling, which is the one thing a namer must not do.
154
78
  const isAcronym = (w: string) =>
155
79
  acronyms.some((a) => lowerASCII(a) === lowerASCII(w))
156
80
  return [capitalise(words[0], acronyms)]
@@ -208,20 +132,12 @@ class NomFuncVal extends FuncBaseVal {
208
132
 
209
133
 
210
134
  resolve(ctx: AontuContext, args: Val[]): Val {
211
- if (args.length < 1 || 3 < args.length) {
212
- return makeNilErr(ctx, 'invalid-arg', this, undefined, 'arity')
213
- }
214
-
135
+ // Arity is checked at parse (funcArity); see the translate twin.
215
136
  const name = textOf(args[0])
216
137
  if (undefined === name || '' === name) {
217
138
  return makeNilErr(ctx, 'invalid-arg', this, args[0], 'name')
218
139
  }
219
140
 
220
- // THE SECOND ARGUMENT SAYS WHICH OF THE FOUR CALLS THIS IS, by
221
- // its shape rather than by its position: a STRING is the style, a
222
- // LIST is the acronym set. The same rule the component primitives
223
- // read their spec by, and it is what keeps the acronym set
224
- // reachable from the map form without a placeholder argument.
225
141
  let style: string | undefined
226
142
  let acronyms: string[] = []
227
143
 
@@ -261,9 +177,6 @@ class NomFuncVal extends FuncBaseVal {
261
177
  return this.place(new StringVal({ peg: out }, ctx))
262
178
  }
263
179
 
264
- // Every style: the map. Closed, because the nine keys ARE the
265
- // vocabulary and a tenth is a typo -- `nom($.n).pascel` is
266
- // refused where every other mistake in an aontu document is.
267
180
  const peg: Record<string, Val> = {}
268
181
  for (const s of NOM_STYLES) {
269
182
  const out = styleName(name, s, acronyms)
@@ -20,11 +20,6 @@ import {
20
20
  } from '../utility'
21
21
 
22
22
 
23
-
24
- // The IEEE-754 binary64 leaf of the number tower. Its KIND is Float (the
25
- // keyword `float`), not the `number` supertype: `number` names the family
26
- // of numeric leaves and never tags a concrete value. The class name is
27
- // historical -- `number` used to name this leaf.
28
23
  class NumberVal extends ScalarVal {
29
24
  isNumber = true
30
25
 
@@ -35,7 +30,6 @@ class NumberVal extends ScalarVal {
35
30
  // Number.isFinite (not the coercing global isNaN, which lets null/''
36
31
  // through as "numbers") — only an actual finite number is valid.
37
32
  if (!Number.isFinite(spec.peg)) {
38
- // TODO: use Nil?
39
33
  throw new AontuError('not-number: ' + spec.peg)
40
34
  }
41
35
 
@@ -57,8 +51,6 @@ class NumberVal extends ScalarVal {
57
51
  peer.kind === this.kind &&
58
52
  peer.peg === this.peg
59
53
  ) {
60
- // Same kind (both Float) and equal value: integer/float no
61
- // longer cross-unify, so peer is necessarily a NumberVal here.
62
54
  out = this
63
55
  }
64
56
  else if (peer.isTop) {
@@ -79,14 +71,6 @@ class NumberVal extends ScalarVal {
79
71
  }
80
72
 
81
73
 
82
- // Canon must round-trip kind: reparsing the canon of a float-kind
83
- // value has to yield a float-kind value again. A rendering with no
84
- // '.' and no exponent (1 -> "1") would reparse as an integer, so it
85
- // gains a ".0" suffix. Renderings that already carry a fraction, an
86
- // exponent, or are NaN/Infinity are left alone.
87
- //
88
- // This is the CANON path only. String coercion inside `+` keeps plain
89
- // JS parity ("a"+1.0 is "a1"), so it must not pick up the suffix.
90
74
  get canon() {
91
75
  const s = super.canon
92
76
  return (s.includes('.') ||
@@ -34,9 +34,11 @@ import { FeatureVal } from './FeatureVal'
34
34
  import { hasPlace, fillPlace } from './PlaceVal'
35
35
 
36
36
 
37
-
38
-
39
37
  class OpBaseVal extends FeatureVal {
38
+ // An op sorts BEFORE the kinds in a conjunct: only it knows to wait
39
+ // for a staged operand, and a kind met first refuses it outright.
40
+ cjo = 48000
41
+
40
42
  isOp = true
41
43
 
42
44
  constructor(
@@ -79,10 +81,6 @@ class OpBaseVal extends FeatureVal {
79
81
  return fillPlace(this, peer, ctx).unify(top(), ctx)
80
82
  }
81
83
  const te = ctx.explain && explainOpen(ctx, ctx.explain, 'Op:' + this.opname(), this, peer)
82
- // Declared without an initial value: every arm below assigns it, and
83
- // seeding it with `this` made the two arms that stand the op read as
84
- // redundant self-assignments. The arms themselves stay as they are —
85
- // they mirror the dispatch switch in go/op.go arm for arm (ADR-001).
86
84
  let out: Val
87
85
 
88
86
  if (this.id == peer.id) {
@@ -95,9 +93,6 @@ class OpBaseVal extends FeatureVal {
95
93
 
96
94
  for (let arg of this.peg) {
97
95
  if (!arg.done) {
98
- // Charged to the depth budget: this recurses without going
99
- // through `unite`, so the counter would otherwise stay flat
100
- // while the stack grows (see withDepth in unify.ts).
101
96
  const a = arg
102
97
  arg = withDepth(ctx, a, top(), () => a.unify(top(), ctx, ec(te, 'ARG')))
103
98
  }
@@ -112,12 +107,10 @@ class OpBaseVal extends FeatureVal {
112
107
  // takes the OpBaseVal arm below rather than a separate null arm.
113
108
  let result: Val = this.operate(ctx, newpeg) || this
114
109
 
115
- // TODO: should be result.isOp
116
110
  if (result instanceof OpBaseVal) {
117
111
  if (peer.isTop) {
118
112
  out = this
119
113
  }
120
- // TODO: should peer.isNil
121
114
  else if (peer.isNil) {
122
115
  out = makeNilErr(ctx, 'op[' + this.peg + ']', this, peer)
123
116
  }
@@ -142,24 +135,20 @@ class OpBaseVal extends FeatureVal {
142
135
  this.notdone()
143
136
  out = this.make(ctx, { peg: newpeg })
144
137
 
145
- // TODO: make should handle this using ctx?
146
138
  out.site.row = this.site.row
147
139
  out.site.col = this.site.col
148
140
  out.site.url = this.site.url
149
141
  out.path = this.path
150
142
 
151
- // why += 'top'
152
143
  }
153
144
  else if (peer.isNil) {
154
145
  this.notdone()
155
146
  out = peer
156
- //why += 'nil'
157
147
  }
158
148
  else {
159
149
  this.notdone()
160
150
  out = new ConjunctVal({ peg: [this, peer] }, ctx)
161
151
 
162
- // TODO: make should handle this using ctx?
163
152
  out.site.row = this.site.row
164
153
  out.site.col = this.site.col
165
154
  out.site.url = this.site.url
@@ -228,7 +217,6 @@ class OpBaseVal extends FeatureVal {
228
217
  undefined
229
218
  )
230
219
 
231
- // TODO: refactor to use Site
232
220
  nil.path = this.path
233
221
  nil.site.url = this.site.url
234
222
  nil.site.row = this.site.row
@@ -237,7 +225,6 @@ class OpBaseVal extends FeatureVal {
237
225
  descErr(nil, ctx)
238
226
 
239
227
  if (ctx) {
240
- // ctx.err.push(nil)
241
228
  ctx.adderr(nil)
242
229
  }
243
230
  else {
@@ -1,33 +1,5 @@
1
1
  /* Copyright (c) 2025 Richard Rodger, MIT License */
2
2
 
3
- // GENERATION: `pack(data, tmpl)` (G8 phase 1,
4
- // docs/capability-review/g8-generation.md). One child of the result map
5
- // per child of `data`, each of them `tmpl` cloned at the destination.
6
- //
7
- // names: [web, auth, billing]
8
- // deploy: pack($.names, {
9
- // image: "acme/" + key() + ":1.4.2"
10
- // replicas: *2 | integer
11
- // })
12
- //
13
- // WHY A FUNCTION AND NOT SYNTAX. A comprehension would need keywords,
14
- // a scoping rule, and string interpolation for the computed name; the
15
- // language already has functions, spread templates, and `key()`, and
16
- // `pack` is those three composed. A call is also DATA -- a named node
17
- // in the tree -- so a document that generates stays as analysable as
18
- // one that does not.
19
- //
20
- // KEYS ARE DATA, NOT POSITION. For a list, the strings themselves are
21
- // the keys (a non-string element is refused: `pack_key`); for a map,
22
- // its keys. Terraform's `count` keyed by index is the counter-example
23
- // the review names: reordering the data churns every downstream child.
24
- // Duplicate keys are not an error -- the colliding children unify,
25
- // exactly as duplicate source keys already merge.
26
- //
27
- // TOTALITY. `pack` iterates a finite, settled bag and cannot call
28
- // itself: the number of children it can produce is fixed by data that
29
- // already exists. Nothing here can recurse, which is the guarantee the
30
- // combinators exist to keep.
31
3
 
32
4
  import type {
33
5
  Val,
@@ -47,14 +19,7 @@ import { fillPlace } from './PlaceVal'
47
19
  import { bagMembers } from './members'
48
20
 
49
21
 
50
- // The keys a data bag names, in the order the result must carry them,
51
- // or a code naming what is wrong with it. `each` asks the same
52
- // question of the same argument and answers it with the values rather
53
- // than the keys (members.ts).
54
22
  function dataKeys(data: Val | undefined, ctx: AontuContext): string[] | string {
55
- // The candidates are the bag's MEMBERS -- what generation would
56
- // emit (./members.ts, BUGS.md §79) -- so a hidden key, or a hidden
57
- // name in a list of names, packs nothing.
58
23
  const members = bagMembers(data, ctx)
59
24
 
60
25
  if (undefined === members) {
@@ -83,11 +48,6 @@ function dataKeys(data: Val | undefined, ctx: AontuContext): string[] | string {
83
48
  class PackFuncVal extends FuncBaseVal {
84
49
  isPackFunc = true
85
50
 
86
- // THE STAGING RULE (G8 phase 0, see AontuContext.settle). A
87
- // generator's data argument is not settled merely by being `done`
88
- // once: a sibling conjunct, an include or a spread can still merge
89
- // keys into it, and children generated from the half-merged bag
90
- // would be missing. It fires on the settle pass and only then.
91
51
  staged = true
92
52
 
93
53
  constructor(
@@ -98,17 +58,11 @@ class PackFuncVal extends FuncBaseVal {
98
58
  }
99
59
 
100
60
 
101
-
102
61
  funcname() {
103
62
  return 'pack'
104
63
  }
105
64
 
106
65
 
107
- // The TEMPLATE IS NOT AN ARGUMENT TO DRIVE. Driving it would resolve
108
- // its `key()` at the CALL SITE -- the one position the template is
109
- // never used at -- and freeze whatever else in it is path-dependent
110
- // there too. The data argument is driven by `unify` below instead,
111
- // one argument by hand rather than all of them by the base.
112
66
  prepare(_ctx: AontuContext, _args: Val[]) {
113
67
  return null
114
68
  }
@@ -140,24 +94,7 @@ class PackFuncVal extends FuncBaseVal {
140
94
 
141
95
  for (const key of keys) {
142
96
  const keyctx = ctx.descend(key)
143
- // THE PLACEHOLDER BINDS THE SOURCE CHILD (G8 phase 3): inside a
144
- // generator's template `_` is the datum this child is being made
145
- // FROM. For a map that is the child's value; for a list of names
146
- // it is the name, which is also the key -- so `_` and `key()`
147
- // agree there, and differ the moment the data is a map.
148
97
  const source: Val = true === src?.isMap ? src.peg[key] : src.peg[keys.indexOf(key)]
149
- // CLONED, never shared. A spread may share a template that holds
150
- // nothing path-dependent (MapVal.spreadClone), because a spread
151
- // CONSTRAINS a child that exists; a generator's template IS the
152
- // child, and a child is a position. Sharing left every generated
153
- // child pointing at the template's own parse-time location, which
154
- // is the position the template is never used at -- visible as the
155
- // site an error inside a generated child reports.
156
- //
157
- // A FULL INSTANCE, to the leaves (`dup`, ADR-005): a bare clone
158
- // shares the inner structure of any call, preference or
159
- // operation in the template, so the first child's resolution of
160
- // a shared key()/ref answered for every child (BUGS.md §8, §9).
161
98
  const inst = tmpl.clone(keyctx, { dup: true })
162
99
  repathInstance(inst, inst.path)
163
100
  const child = fillPlace(inst, source, keyctx)
@@ -1,31 +1,5 @@
1
1
  /* Copyright (c) 2021-2025 Richard Rodger, MIT License */
2
2
 
3
- // THE PATH CONSTRUCTOR (docs/design/PATHS.0.md). `path(p)` CAPTURES
4
- // `p` -- the one non-strict argument position in the language: every
5
- // other call reads its argument's value, this one reads its spelling.
6
- // `path($.a.b)` is the address `$.a.b` as a first-class value, not
7
- // the value found there; a plain reference (`$.a.b` alone) stays the
8
- // embedding it has always been.
9
- //
10
- // The capture happens in prepare(), which receives the argument
11
- // BEFORE the driving loop resolves it -- the same interception this
12
- // function always used, now kept instead of released: the RefVal's
13
- // spelling is read off its segments and the RefVal itself is never
14
- // driven, so no pass ever holds a resolvable reference here.
15
- //
16
- // `path()` with no argument is the path KIND (PathKindVal): the
17
- // vacuous constructor call is the kind, as `{}`-the-unit is to maps
18
- // -- see ContainerKindVal for the other half of that convention.
19
- //
20
- // A string argument is read by the ADDRESS grammar, not resolved as a
21
- // segment: `path("$.a")` is the same capture `path($.a)` is, and text
22
- // with no anchor is RELATIVE (`path("a.b")` is `path(.a.b)`, the
23
- // address the raw spelling captures). A COMPUTED argument -- an
24
- // expression, a reference to a string -- is the one shape that does
25
- // evaluate: the driven result converts by the same grammar at
26
- // resolve, which is what makes an address buildable (`refer() &
27
- // path("$.customers." + key())`) while a bare string still never IS
28
- // one (ADR-016): the conversion happens only inside this call.
29
3
 
30
4
  import type {
31
5
  Val,
@@ -110,12 +84,6 @@ class PathFuncVal extends FuncBaseVal {
110
84
  return []
111
85
  }
112
86
 
113
- // The captured spelling, from a reference's segments or from a
114
- // string literal read as address text. Both go through
115
- // parseAddress, so what capture admits and what refer reads
116
- // cannot drift. Anything else -- an expression, a reference to
117
- // a string -- is left for the driving loop, and resolve
118
- // converts the driven result below.
119
87
  let spelling: string | undefined
120
88
  if (true === arg.isRef) {
121
89
  spelling = captureSpelling(arg)