aontu 0.61.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 (371) hide show
  1. package/README.md +4 -4
  2. package/dist/agentsmd.d.ts +1 -0
  3. package/dist/agentsmd.js +7 -28
  4. package/dist/agentsmd.js.map +1 -1
  5. package/dist/alias.js.map +1 -1
  6. package/dist/allow.d.ts +23 -0
  7. package/dist/allow.js +138 -0
  8. package/dist/allow.js.map +1 -0
  9. package/dist/aontu.d.ts +4 -2
  10. package/dist/aontu.js +4 -80
  11. package/dist/aontu.js.map +1 -1
  12. package/dist/aontumodel.d.ts +4 -0
  13. package/dist/aontumodel.js +33 -0
  14. package/dist/aontumodel.js.map +1 -0
  15. package/dist/cli.d.ts +10 -1
  16. package/dist/cli.js +877 -479
  17. package/dist/cli.js.map +1 -1
  18. package/dist/ctx.js +0 -48
  19. package/dist/ctx.js.map +1 -1
  20. package/dist/diff.js +0 -32
  21. package/dist/diff.js.map +1 -1
  22. package/dist/err.js +0 -40
  23. package/dist/err.js.map +1 -1
  24. package/dist/escape.js +0 -45
  25. package/dist/escape.js.map +1 -1
  26. package/dist/exactjson.d.ts +0 -35
  27. package/dist/exactjson.js +0 -131
  28. package/dist/exactjson.js.map +1 -1
  29. package/dist/format.js +55 -189
  30. package/dist/format.js.map +1 -1
  31. package/dist/grammar.d.ts +9 -0
  32. package/dist/grammar.js +54 -0
  33. package/dist/grammar.js.map +1 -0
  34. package/dist/graph.js +0 -26
  35. package/dist/graph.js.map +1 -1
  36. package/dist/hcanon.js +0 -82
  37. package/dist/hcanon.js.map +1 -1
  38. package/dist/helpdoc.d.ts +16 -0
  39. package/dist/helpdoc.js +59 -0
  40. package/dist/helpdoc.js.map +1 -0
  41. package/dist/hints.d.ts +0 -6
  42. package/dist/hints.js +59 -47
  43. package/dist/hints.js.map +1 -1
  44. package/dist/jsonschema.js +0 -114
  45. package/dist/jsonschema.js.map +1 -1
  46. package/dist/keyorder.d.ts +0 -7
  47. package/dist/keyorder.js +0 -41
  48. package/dist/keyorder.js.map +1 -1
  49. package/dist/lang.js +32 -877
  50. package/dist/lang.js.map +1 -1
  51. package/dist/lower.d.ts +3 -0
  52. package/dist/lower.js +14 -61
  53. package/dist/lower.js.map +1 -1
  54. package/dist/lsp-server.js +0 -16
  55. package/dist/lsp-server.js.map +1 -1
  56. package/dist/lsp.d.ts +1 -1
  57. package/dist/lsp.js +12 -159
  58. package/dist/lsp.js.map +1 -1
  59. package/dist/mcp-server.js +0 -26
  60. package/dist/mcp-server.js.map +1 -1
  61. package/dist/mcp.js +0 -113
  62. package/dist/mcp.js.map +1 -1
  63. package/dist/mod-tool.js +0 -130
  64. package/dist/mod-tool.js.map +1 -1
  65. package/dist/mod.js +0 -162
  66. package/dist/mod.js.map +1 -1
  67. package/dist/patch.js +0 -217
  68. package/dist/patch.js.map +1 -1
  69. package/dist/provenance.js +0 -140
  70. package/dist/provenance.js.map +1 -1
  71. package/dist/query.js +0 -75
  72. package/dist/query.js.map +1 -1
  73. package/dist/reach.js +0 -43
  74. package/dist/reach.js.map +1 -1
  75. package/dist/relation.d.ts +2 -0
  76. package/dist/relation.js +3 -58
  77. package/dist/relation.js.map +1 -1
  78. package/dist/render.js +33 -143
  79. package/dist/render.js.map +1 -1
  80. package/dist/report-sarif.d.ts +0 -11
  81. package/dist/report-sarif.js +0 -28
  82. package/dist/report-sarif.js.map +1 -1
  83. package/dist/sig.js +0 -35
  84. package/dist/sig.js.map +1 -1
  85. package/dist/sigdecl.js +1 -1
  86. package/dist/sigdecl.js.map +1 -1
  87. package/dist/siggate.js +0 -4
  88. package/dist/siggate.js.map +1 -1
  89. package/dist/site.js +3 -29
  90. package/dist/site.js.map +1 -1
  91. package/dist/subsume.d.ts +0 -10
  92. package/dist/subsume.js +0 -137
  93. package/dist/subsume.js.map +1 -1
  94. package/dist/template.d.ts +2 -1
  95. package/dist/template.js +58 -138
  96. package/dist/template.js.map +1 -1
  97. package/dist/trim.js +0 -41
  98. package/dist/trim.js.map +1 -1
  99. package/dist/tsconfig.tsbuildinfo +1 -1
  100. package/dist/type.js.map +1 -1
  101. package/dist/unify.js +12 -242
  102. package/dist/unify.js.map +1 -1
  103. package/dist/utility.js +0 -22
  104. package/dist/utility.js.map +1 -1
  105. package/dist/val/AbnfFuncVal.d.ts +18 -0
  106. package/dist/val/AbnfFuncVal.js +132 -0
  107. package/dist/val/AbnfFuncVal.js.map +1 -0
  108. package/dist/val/AbsentVal.d.ts +11 -0
  109. package/dist/val/AbsentVal.js +30 -0
  110. package/dist/val/AbsentVal.js.map +1 -0
  111. package/dist/val/AggFuncVal.d.ts +10 -1
  112. package/dist/val/AggFuncVal.js +104 -116
  113. package/dist/val/AggFuncVal.js.map +1 -1
  114. package/dist/val/ArithFuncVal.js +0 -12
  115. package/dist/val/ArithFuncVal.js.map +1 -1
  116. package/dist/val/BagVal.js +1 -78
  117. package/dist/val/BagVal.js.map +1 -1
  118. package/dist/val/BigDecimalVal.js +0 -16
  119. package/dist/val/BigDecimalVal.js.map +1 -1
  120. package/dist/val/BigIntegerVal.js +0 -16
  121. package/dist/val/BigIntegerVal.js.map +1 -1
  122. package/dist/val/CloseFuncVal.js +0 -9
  123. package/dist/val/CloseFuncVal.js.map +1 -1
  124. package/dist/val/CmpFuncVal.d.ts +20 -0
  125. package/dist/val/CmpFuncVal.js +188 -0
  126. package/dist/val/CmpFuncVal.js.map +1 -0
  127. package/dist/val/ConjunctVal.js +0 -29
  128. package/dist/val/ConjunctVal.js.map +1 -1
  129. package/dist/val/ConstraintVal.js +0 -500
  130. package/dist/val/ConstraintVal.js.map +1 -1
  131. package/dist/val/ContainerKindVal.js +0 -2
  132. package/dist/val/ContainerKindVal.js.map +1 -1
  133. package/dist/val/CopyFuncVal.js +0 -3
  134. package/dist/val/CopyFuncVal.js.map +1 -1
  135. package/dist/val/Decimal.js +0 -179
  136. package/dist/val/Decimal.js.map +1 -1
  137. package/dist/val/DeprecateFuncVal.js.map +1 -1
  138. package/dist/val/DisjunctVal.js +0 -152
  139. package/dist/val/DisjunctVal.js.map +1 -1
  140. package/dist/val/EachFuncVal.d.ts +1 -2
  141. package/dist/val/EachFuncVal.js +12 -29
  142. package/dist/val/EachFuncVal.js.map +1 -1
  143. package/dist/val/EmitFuncVal.d.ts +1 -1
  144. package/dist/val/EmitFuncVal.js +6 -119
  145. package/dist/val/EmitFuncVal.js.map +1 -1
  146. package/dist/val/ExpectVal.js +0 -62
  147. package/dist/val/ExpectVal.js.map +1 -1
  148. package/dist/val/FilterFuncVal.js +0 -25
  149. package/dist/val/FilterFuncVal.js.map +1 -1
  150. package/dist/val/FuncBaseVal.d.ts +1 -0
  151. package/dist/val/FuncBaseVal.js +7 -127
  152. package/dist/val/FuncBaseVal.js.map +1 -1
  153. package/dist/val/GraphAtomVal.js +0 -15
  154. package/dist/val/GraphAtomVal.js.map +1 -1
  155. package/dist/val/HideFuncVal.js +0 -13
  156. package/dist/val/HideFuncVal.js.map +1 -1
  157. package/dist/val/IntegerVal.js +0 -61
  158. package/dist/val/IntegerVal.js.map +1 -1
  159. package/dist/val/JunctionVal.js +0 -20
  160. package/dist/val/JunctionVal.js.map +1 -1
  161. package/dist/val/KeyFuncVal.js +0 -46
  162. package/dist/val/KeyFuncVal.js.map +1 -1
  163. package/dist/val/ListVal.js +0 -57
  164. package/dist/val/ListVal.js.map +1 -1
  165. package/dist/val/LowerFuncVal.js +11 -6
  166. package/dist/val/LowerFuncVal.js.map +1 -1
  167. package/dist/val/MapVal.js +0 -151
  168. package/dist/val/MapVal.js.map +1 -1
  169. package/dist/val/MatchFuncVal.js +0 -27
  170. package/dist/val/MatchFuncVal.js.map +1 -1
  171. package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
  172. package/dist/val/MaybeFuncVal.js +50 -0
  173. package/dist/val/MaybeFuncVal.js.map +1 -0
  174. package/dist/val/MoveFuncVal.js +0 -18
  175. package/dist/val/MoveFuncVal.js.map +1 -1
  176. package/dist/val/NilVal.js +2 -36
  177. package/dist/val/NilVal.js.map +1 -1
  178. package/dist/val/NomFuncVal.d.ts +12 -0
  179. package/dist/val/NomFuncVal.js +153 -0
  180. package/dist/val/NomFuncVal.js.map +1 -0
  181. package/dist/val/NumberVal.js +0 -15
  182. package/dist/val/NumberVal.js.map +1 -1
  183. package/dist/val/OpBaseVal.d.ts +1 -0
  184. package/dist/val/OpBaseVal.js +3 -15
  185. package/dist/val/OpBaseVal.js.map +1 -1
  186. package/dist/val/PackFuncVal.js +0 -34
  187. package/dist/val/PackFuncVal.js.map +1 -1
  188. package/dist/val/PathFuncVal.js +0 -6
  189. package/dist/val/PathFuncVal.js.map +1 -1
  190. package/dist/val/PathVal.js +0 -41
  191. package/dist/val/PathVal.js.map +1 -1
  192. package/dist/val/PlaceVal.js +0 -25
  193. package/dist/val/PlaceVal.js.map +1 -1
  194. package/dist/val/PlusOpVal.d.ts +1 -7
  195. package/dist/val/PlusOpVal.js +13 -74
  196. package/dist/val/PlusOpVal.js.map +1 -1
  197. package/dist/val/PrefFuncVal.js +0 -1
  198. package/dist/val/PrefFuncVal.js.map +1 -1
  199. package/dist/val/PrefVal.js +0 -167
  200. package/dist/val/PrefVal.js.map +1 -1
  201. package/dist/val/RecurseVal.js +0 -55
  202. package/dist/val/RecurseVal.js.map +1 -1
  203. package/dist/val/RefVal.js +0 -282
  204. package/dist/val/RefVal.js.map +1 -1
  205. package/dist/val/ReferFuncVal.js +0 -232
  206. package/dist/val/ReferFuncVal.js.map +1 -1
  207. package/dist/val/ScalarKindVal.js +0 -49
  208. package/dist/val/ScalarKindVal.js.map +1 -1
  209. package/dist/val/ScalarVal.js +0 -11
  210. package/dist/val/ScalarVal.js.map +1 -1
  211. package/dist/val/StrFuncVal.js +0 -18
  212. package/dist/val/StrFuncVal.js.map +1 -1
  213. package/dist/val/SuperFuncVal.js +0 -32
  214. package/dist/val/SuperFuncVal.js.map +1 -1
  215. package/dist/val/TopVal.js +0 -1
  216. package/dist/val/TopVal.js.map +1 -1
  217. package/dist/val/TranslateFuncVal.d.ts +12 -0
  218. package/dist/val/TranslateFuncVal.js +99 -0
  219. package/dist/val/TranslateFuncVal.js.map +1 -0
  220. package/dist/val/UpperFuncVal.js +11 -6
  221. package/dist/val/UpperFuncVal.js.map +1 -1
  222. package/dist/val/Val.d.ts +1 -0
  223. package/dist/val/Val.js +2 -133
  224. package/dist/val/Val.js.map +1 -1
  225. package/dist/val/VarVal.js +0 -12
  226. package/dist/val/VarVal.js.map +1 -1
  227. package/dist/val/arith.js +0 -37
  228. package/dist/val/arith.js.map +1 -1
  229. package/dist/val/caserange.d.ts +3 -0
  230. package/dist/val/caserange.js +49 -0
  231. package/dist/val/caserange.js.map +1 -0
  232. package/dist/val/members.js +0 -6
  233. package/dist/val/members.js.map +1 -1
  234. package/dist/val/numcmp.js +0 -11
  235. package/dist/val/numcmp.js.map +1 -1
  236. package/dist/val/numkind.js +0 -145
  237. package/dist/val/numkind.js.map +1 -1
  238. package/dist/val/valutil.js +0 -16
  239. package/dist/val/valutil.js.map +1 -1
  240. package/dist/vet.d.ts +12 -0
  241. package/dist/vet.js +159 -412
  242. package/dist/vet.js.map +1 -1
  243. package/dist/view.js +0 -414
  244. package/dist/view.js.map +1 -1
  245. package/dist/walk.js +0 -41
  246. package/dist/walk.js.map +1 -1
  247. package/grammar/aontu.abnf +9 -7
  248. package/grammar/aontu.gbnf +5 -5
  249. package/grammar/aontu.lark +5 -5
  250. package/grammar/aontu.tmLanguage.json +1 -1
  251. package/package.json +4 -2
  252. package/skill/SKILL.md +8 -0
  253. package/skill/init/check.sh +28 -0
  254. package/skill/init/data.aon +12 -0
  255. package/skill/init/model.aon +19 -0
  256. package/skill/tasks.md +151 -0
  257. package/src/agentsmd.ts +8 -32
  258. package/src/alias.ts +0 -39
  259. package/src/allow.ts +221 -0
  260. package/src/aontu.ts +10 -108
  261. package/src/aontumodel.ts +32 -0
  262. package/src/cli.ts +1009 -540
  263. package/src/ctx.ts +0 -103
  264. package/src/diff.ts +0 -40
  265. package/src/err.ts +0 -40
  266. package/src/escape.ts +0 -46
  267. package/src/exactjson.ts +0 -131
  268. package/src/format.ts +63 -234
  269. package/src/grammar.ts +72 -0
  270. package/src/graph.ts +0 -61
  271. package/src/hcanon.ts +0 -82
  272. package/src/helpdoc.ts +77 -0
  273. package/src/hints.ts +72 -49
  274. package/src/jsonschema.ts +0 -123
  275. package/src/keyorder.ts +0 -42
  276. package/src/lang.ts +39 -895
  277. package/src/lower.ts +15 -65
  278. package/src/lsp-server.ts +0 -16
  279. package/src/lsp.ts +12 -180
  280. package/src/mcp-server.ts +0 -31
  281. package/src/mcp.ts +0 -130
  282. package/src/mod-tool.ts +0 -158
  283. package/src/mod.ts +0 -178
  284. package/src/patch.ts +0 -232
  285. package/src/provenance.ts +0 -183
  286. package/src/query.ts +0 -84
  287. package/src/reach.ts +0 -53
  288. package/src/relation.ts +7 -71
  289. package/src/render.ts +33 -180
  290. package/src/report-sarif.ts +0 -48
  291. package/src/sig.ts +0 -35
  292. package/src/sigdecl.ts +1 -1
  293. package/src/siggate.ts +0 -30
  294. package/src/site.ts +3 -29
  295. package/src/subsume.ts +1 -161
  296. package/src/template.ts +69 -140
  297. package/src/trim.ts +0 -53
  298. package/src/type.ts +2 -45
  299. package/src/unify.ts +13 -251
  300. package/src/utility.ts +0 -31
  301. package/src/val/AbnfFuncVal.ts +181 -0
  302. package/src/val/AbsentVal.ts +54 -0
  303. package/src/val/AggFuncVal.ts +152 -188
  304. package/src/val/ArithFuncVal.ts +0 -20
  305. package/src/val/BagVal.ts +1 -78
  306. package/src/val/BigDecimalVal.ts +0 -16
  307. package/src/val/BigIntegerVal.ts +0 -16
  308. package/src/val/CloseFuncVal.ts +0 -9
  309. package/src/val/CmpFuncVal.ts +249 -0
  310. package/src/val/ConjunctVal.ts +0 -33
  311. package/src/val/ConstraintVal.ts +2 -537
  312. package/src/val/ContainerKindVal.ts +0 -18
  313. package/src/val/CopyFuncVal.ts +0 -5
  314. package/src/val/Decimal.ts +1 -185
  315. package/src/val/DeprecateFuncVal.ts +0 -10
  316. package/src/val/DisjunctVal.ts +0 -157
  317. package/src/val/EachFuncVal.ts +12 -53
  318. package/src/val/EmitFuncVal.ts +8 -208
  319. package/src/val/ExpectVal.ts +0 -62
  320. package/src/val/FilterFuncVal.ts +0 -55
  321. package/src/val/FuncBaseVal.ts +9 -130
  322. package/src/val/GraphAtomVal.ts +0 -42
  323. package/src/val/HideFuncVal.ts +0 -15
  324. package/src/val/IntegerVal.ts +0 -61
  325. package/src/val/JunctionVal.ts +0 -20
  326. package/src/val/KeyFuncVal.ts +0 -48
  327. package/src/val/ListVal.ts +0 -59
  328. package/src/val/LowerFuncVal.ts +12 -7
  329. package/src/val/MapVal.ts +0 -151
  330. package/src/val/MatchFuncVal.ts +0 -59
  331. package/src/val/MaybeFuncVal.ts +86 -0
  332. package/src/val/MoveFuncVal.ts +0 -20
  333. package/src/val/NilVal.ts +2 -36
  334. package/src/val/NomFuncVal.ts +200 -0
  335. package/src/val/NumberVal.ts +0 -16
  336. package/src/val/OpBaseVal.ts +4 -17
  337. package/src/val/PackFuncVal.ts +0 -63
  338. package/src/val/PathFuncVal.ts +0 -32
  339. package/src/val/PathVal.ts +0 -66
  340. package/src/val/PlaceVal.ts +0 -45
  341. package/src/val/PlusOpVal.ts +18 -75
  342. package/src/val/PrefFuncVal.ts +0 -1
  343. package/src/val/PrefVal.ts +0 -179
  344. package/src/val/RecurseVal.ts +0 -81
  345. package/src/val/RefVal.ts +1 -285
  346. package/src/val/ReferFuncVal.ts +0 -255
  347. package/src/val/ScalarKindVal.ts +0 -50
  348. package/src/val/ScalarVal.ts +0 -12
  349. package/src/val/StrFuncVal.ts +0 -44
  350. package/src/val/SuperFuncVal.ts +0 -42
  351. package/src/val/TopVal.ts +0 -1
  352. package/src/val/TranslateFuncVal.ts +132 -0
  353. package/src/val/UpperFuncVal.ts +12 -7
  354. package/src/val/Val.ts +3 -192
  355. package/src/val/VarVal.ts +0 -15
  356. package/src/val/arith.ts +0 -92
  357. package/src/val/caserange.ts +53 -0
  358. package/src/val/members.ts +0 -23
  359. package/src/val/numcmp.ts +1 -27
  360. package/src/val/numkind.ts +0 -149
  361. package/src/val/valutil.ts +0 -16
  362. package/src/vet.ts +209 -504
  363. package/src/view.ts +0 -507
  364. package/src/walk.ts +0 -41
  365. package/dist/std.d.ts +0 -3
  366. package/dist/std.js +0 -637
  367. package/dist/std.js.map +0 -1
  368. package/dist/val/FormFuncVal.js +0 -55
  369. package/dist/val/FormFuncVal.js.map +0 -1
  370. package/src/std.ts +0 -648
  371. package/src/val/FormFuncVal.ts +0 -119
@@ -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,28 +78,8 @@ 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
- if (null != ctx?.path && null != nil.path &&
102
- nil.path.length < ctx.path.length &&
103
- nil.path.every((p, i) => p === ctx.path[i])) {
81
+ if (null != ctx?.path && 0 < ctx.path.length &&
82
+ (null != bv || null == nil.path || 0 === nil.path.length)) {
104
83
  nil.path = [...ctx.path]
105
84
  }
106
85
 
@@ -145,9 +124,6 @@ class NilVal extends Val {
145
124
  let out = (super.clone(ctx, spec) as NilVal)
146
125
  out.why = this.why
147
126
 
148
- // Should these clone?
149
- // out.primary = this.primary?.clone()
150
- // out.secondary = this.secondary?.clone()
151
127
  out.primary = this.primary
152
128
  out.secondary = this.secondary
153
129
 
@@ -156,7 +132,6 @@ class NilVal extends Val {
156
132
  }
157
133
 
158
134
 
159
- // TODO: custom canon? useful for unknown function errors
160
135
  get canon() {
161
136
  return 'nil'
162
137
  }
@@ -200,15 +175,6 @@ class NilVal extends Val {
200
175
  }
201
176
 
202
177
 
203
- // Shared sentinel for transient "this unification branch failed"
204
- // markers. Used by DisjunctVal.unify to flag failed member trials
205
- // (and to dedup results) without allocating a fresh NilVal per
206
- // failure. The sentinel is filtered out before the disjunct result
207
- // is constructed, so its .why / .site / .primary fields are never
208
- // inspected by user-visible code.
209
- //
210
- // Do NOT use this sentinel for errors that may surface: those need
211
- // real NilVals with proper site/path info for descErr formatting.
212
178
  const TRIAL_NIL = new NilVal({ why: '|:trial-nil' }) /* node:coverage ignore next 7 */
213
179
 
214
180
 
@@ -0,0 +1,200 @@
1
+ /* Copyright (c) 2026 Richard Rodger, MIT License */
2
+
3
+
4
+ import type {
5
+ Val,
6
+ ValSpec,
7
+ } from '../type'
8
+
9
+ import {
10
+ AontuContext,
11
+ } from '../ctx'
12
+
13
+ import { makeNilErr } from '../err'
14
+
15
+ import {
16
+ splitWords,
17
+ caseName,
18
+ lowerASCII,
19
+ capitalise,
20
+ } from '../lower'
21
+
22
+ import { MapVal } from './MapVal'
23
+ import { StringVal } from './StringVal'
24
+ import { FuncBaseVal } from './FuncBaseVal'
25
+
26
+
27
+ const NOM_STYLES = [
28
+ 'camel', // userId
29
+ 'dot',
30
+ 'kebab',
31
+ 'pascal', // UserId
32
+ 'path',
33
+ 'snake',
34
+ 'text',
35
+ 'title',
36
+ 'upper', // USER_ID
37
+ ]
38
+
39
+ // nom's style name -> the `%case` style `caseName` serves. `upper` and
40
+ // `text` are nom's spellings: `screaming` is what `aontu:render` calls
41
+ // SCREAMING_SNAKE and that name is pinned cross-port, so the mapping
42
+ // lives here rather than in the shared vocabulary.
43
+ const CASENAME_STYLES: Record<string, string> = {
44
+ camel: 'camel',
45
+ kebab: 'kebab',
46
+ pascal: 'pascal',
47
+ snake: 'snake',
48
+ upper: 'screaming',
49
+ }
50
+
51
+
52
+ // One name in one style, or undefined when the style is not one, or
53
+ // when the name holds no words at all.
54
+ function styleName(name: string, style: string, acronyms: string[]):
55
+ string | undefined {
56
+ const src = name.replace(/[./]/g, '_')
57
+
58
+ const words = splitWords(src)
59
+ if (0 === words.length) {
60
+ return undefined
61
+ }
62
+
63
+ const cased = CASENAME_STYLES[style]
64
+ if (undefined !== cased) {
65
+ return caseName(src, cased, acronyms)
66
+ }
67
+
68
+ if ('dot' === style) {
69
+ return words.map(lowerASCII).join('.')
70
+ }
71
+ if ('path' === style) {
72
+ return words.map(lowerASCII).join('/')
73
+ }
74
+ if ('title' === style) {
75
+ return words.map((w) => capitalise(w, acronyms)).join(' ')
76
+ }
77
+ if ('text' === style) {
78
+ const isAcronym = (w: string) =>
79
+ acronyms.some((a) => lowerASCII(a) === lowerASCII(w))
80
+ return [capitalise(words[0], acronyms)]
81
+ .concat(words.slice(1).map((w) =>
82
+ isAcronym(w) ? capitalise(w, acronyms) : lowerASCII(w)))
83
+ .join(' ')
84
+ }
85
+
86
+ return undefined
87
+ }
88
+
89
+
90
+ // The text a value carries, when it is a concrete string. A path is a
91
+ // string too (ScalarKindVal's Path sits under String), so a spelled
92
+ // address may be renamed like any other text.
93
+ function textOf(v: Val | undefined): string | undefined {
94
+ const s: any = v
95
+ return (true === s?.isScalar && 'string' === typeof s.peg) ? s.peg : undefined
96
+ }
97
+
98
+
99
+ // An acronym set: a list of concrete strings, or undefined when the
100
+ // value is not one.
101
+ function acronymsOf(v: Val | undefined): string[] | undefined {
102
+ const l: any = v
103
+ if (true !== l?.isList) {
104
+ return undefined
105
+ }
106
+ const out: string[] = []
107
+ for (const el of l.peg as Val[]) {
108
+ const t = textOf(el)
109
+ if (undefined === t || '' === t) {
110
+ return undefined
111
+ }
112
+ out.push(t)
113
+ }
114
+ return out
115
+ }
116
+
117
+
118
+ class NomFuncVal extends FuncBaseVal {
119
+ isNamerFunc = true
120
+
121
+ constructor(spec: ValSpec, ctx?: AontuContext) {
122
+ super(spec, ctx)
123
+ }
124
+
125
+ make(_ctx: AontuContext, spec: ValSpec): Val {
126
+ return new NomFuncVal(spec)
127
+ }
128
+
129
+ funcname() {
130
+ return 'nom'
131
+ }
132
+
133
+
134
+ resolve(ctx: AontuContext, args: Val[]): Val {
135
+ // Arity is checked at parse (funcArity); see the translate twin.
136
+ const name = textOf(args[0])
137
+ if (undefined === name || '' === name) {
138
+ return makeNilErr(ctx, 'invalid-arg', this, args[0], 'name')
139
+ }
140
+
141
+ let style: string | undefined
142
+ let acronyms: string[] = []
143
+
144
+ if (2 <= args.length) {
145
+ const second: any = args[1]
146
+ if (true === second?.isList) {
147
+ if (3 === args.length) {
148
+ return makeNilErr(ctx, 'invalid-arg', this, args[2], 'arity')
149
+ }
150
+ const acr = acronymsOf(second)
151
+ if (undefined === acr) {
152
+ return makeNilErr(ctx, 'invalid-arg', this, second, 'acronyms')
153
+ }
154
+ acronyms = acr
155
+ }
156
+ else {
157
+ style = textOf(second)
158
+ if (undefined === style) {
159
+ return makeNilErr(ctx, 'invalid-arg', this, second, 'style')
160
+ }
161
+ if (3 === args.length) {
162
+ const acr = acronymsOf(args[2])
163
+ if (undefined === acr) {
164
+ return makeNilErr(ctx, 'invalid-arg', this, args[2], 'acronyms')
165
+ }
166
+ acronyms = acr
167
+ }
168
+ }
169
+ }
170
+
171
+ // One style: the string.
172
+ if (undefined !== style) {
173
+ const out = styleName(name, style, acronyms)
174
+ if (undefined === out) {
175
+ return makeNilErr(ctx, 'invalid-arg', this, args[1], 'style')
176
+ }
177
+ return this.place(new StringVal({ peg: out }, ctx))
178
+ }
179
+
180
+ const peg: Record<string, Val> = {}
181
+ for (const s of NOM_STYLES) {
182
+ const out = styleName(name, s, acronyms)
183
+ if (undefined === out) {
184
+ return makeNilErr(ctx, 'invalid-arg', this, args[0], 'name')
185
+ }
186
+ peg[s] = new StringVal({ peg: out }, ctx)
187
+ }
188
+ const map = new MapVal({ peg }, ctx)
189
+ map.closed = true
190
+
191
+ return this.place(map)
192
+ }
193
+
194
+ } /* node:coverage ignore next 6 */
195
+
196
+
197
+ export {
198
+ NOM_STYLES,
199
+ NomFuncVal,
200
+ }
@@ -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. Shared with `each`, which
52
- // asks the same question of the same argument and answers it with the
53
- // values rather than the keys.
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)