@driftsys/markspec 0.10.3 → 0.12.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 (458) hide show
  1. package/README.md +11 -2
  2. package/esm/ast/normalize.d.ts +4 -5
  3. package/esm/ast/normalize.d.ts.map +1 -1
  4. package/esm/ast/normalize.js +6 -37
  5. package/esm/collect/mod.d.ts +29 -9
  6. package/esm/collect/mod.d.ts.map +1 -1
  7. package/esm/collect/mod.js +36 -10
  8. package/esm/compiler/deserialize.d.ts +49 -0
  9. package/esm/compiler/deserialize.d.ts.map +1 -0
  10. package/esm/compiler/deserialize.js +139 -0
  11. package/esm/compiler/manifest.d.ts +3 -0
  12. package/esm/compiler/manifest.d.ts.map +1 -1
  13. package/esm/compiler/manifest.js +9 -3
  14. package/esm/compiler/mod.d.ts.map +1 -1
  15. package/esm/compiler/mod.js +18 -13
  16. package/esm/config/markspec.d.ts +40 -1
  17. package/esm/config/markspec.d.ts.map +1 -1
  18. package/esm/config/markspec.js +127 -2
  19. package/esm/config/mod.d.ts.map +1 -1
  20. package/esm/config/mod.js +143 -147
  21. package/esm/decl/duplicates.d.ts +29 -0
  22. package/esm/decl/duplicates.d.ts.map +1 -0
  23. package/esm/decl/duplicates.js +28 -0
  24. package/esm/decl/mod.d.ts +4 -2
  25. package/esm/decl/mod.d.ts.map +1 -1
  26. package/esm/decl/mod.js +2 -1
  27. package/esm/decl/surfaces.d.ts +29 -7
  28. package/esm/decl/surfaces.d.ts.map +1 -1
  29. package/esm/decl/surfaces.js +31 -18
  30. package/esm/discovery/mod.d.ts +24 -8
  31. package/esm/discovery/mod.d.ts.map +1 -1
  32. package/esm/discovery/mod.js +57 -21
  33. package/esm/discovery/projects.d.ts +109 -0
  34. package/esm/discovery/projects.d.ts.map +1 -0
  35. package/esm/discovery/projects.js +232 -0
  36. package/esm/formatter/entry_body.d.ts +86 -0
  37. package/esm/formatter/entry_body.d.ts.map +1 -0
  38. package/esm/formatter/entry_body.js +287 -0
  39. package/esm/formatter/mod.d.ts +13 -9
  40. package/esm/formatter/mod.d.ts.map +1 -1
  41. package/esm/formatter/mod.js +126 -50
  42. package/esm/gates/mod.d.ts +13 -2
  43. package/esm/gates/mod.d.ts.map +1 -1
  44. package/esm/gates/mod.js +41 -13
  45. package/esm/lint/runner.d.ts.map +1 -1
  46. package/esm/lint/runner.js +7 -5
  47. package/esm/lock/acquire_compile.d.ts +31 -0
  48. package/esm/lock/acquire_compile.d.ts.map +1 -0
  49. package/esm/lock/acquire_compile.js +83 -0
  50. package/esm/lock/cache_check.d.ts +28 -0
  51. package/esm/lock/cache_check.d.ts.map +1 -0
  52. package/esm/lock/cache_check.js +51 -0
  53. package/esm/lock/check.d.ts +14 -3
  54. package/esm/lock/check.d.ts.map +1 -1
  55. package/esm/lock/check.js +43 -4
  56. package/esm/lock/edge_drift.d.ts +2 -0
  57. package/esm/lock/edge_drift.d.ts.map +1 -1
  58. package/esm/lock/edge_drift.js +4 -0
  59. package/esm/lock/git_intent.d.ts +46 -0
  60. package/esm/lock/git_intent.d.ts.map +1 -0
  61. package/esm/lock/git_intent.js +111 -0
  62. package/esm/lock/mod.d.ts +11 -4
  63. package/esm/lock/mod.d.ts.map +1 -1
  64. package/esm/lock/mod.js +8 -2
  65. package/esm/lock/model.d.ts +24 -1
  66. package/esm/lock/model.d.ts.map +1 -1
  67. package/esm/lock/parser.d.ts.map +1 -1
  68. package/esm/lock/parser.js +32 -0
  69. package/esm/lock/pin_assurance.d.ts +20 -0
  70. package/esm/lock/pin_assurance.d.ts.map +1 -0
  71. package/esm/lock/pin_assurance.js +34 -0
  72. package/esm/lock/resolve.d.ts +8 -17
  73. package/esm/lock/resolve.d.ts.map +1 -1
  74. package/esm/lock/resolve.js +7 -67
  75. package/esm/lock/serializer.d.ts.map +1 -1
  76. package/esm/lock/serializer.js +23 -0
  77. package/esm/lock/upstream_common.d.ts +29 -0
  78. package/esm/lock/upstream_common.d.ts.map +1 -0
  79. package/esm/lock/upstream_common.js +38 -0
  80. package/esm/lock/upstream_deps.d.ts +63 -0
  81. package/esm/lock/upstream_deps.d.ts.map +1 -0
  82. package/esm/lock/upstream_deps.js +172 -0
  83. package/esm/lock/upstream_refs.d.ts +69 -0
  84. package/esm/lock/upstream_refs.d.ts.map +1 -0
  85. package/esm/lock/upstream_refs.js +238 -0
  86. package/esm/mod.d.ts +23 -11
  87. package/esm/mod.d.ts.map +1 -1
  88. package/esm/mod.js +20 -8
  89. package/esm/model/mod.d.ts +114 -28
  90. package/esm/model/mod.d.ts.map +1 -1
  91. package/esm/model/mod.js +76 -13
  92. package/esm/model/profile.d.ts +13 -0
  93. package/esm/model/profile.d.ts.map +1 -1
  94. package/esm/parser/code_regions.d.ts +29 -0
  95. package/esm/parser/code_regions.d.ts.map +1 -0
  96. package/esm/parser/code_regions.js +38 -0
  97. package/esm/parser/markdown.d.ts.map +1 -1
  98. package/esm/parser/markdown.js +110 -91
  99. package/esm/parser/mod.d.ts.map +1 -1
  100. package/esm/parser/mod.js +7 -1
  101. package/esm/parser/translate.d.ts.map +1 -1
  102. package/esm/parser/translate.js +5 -0
  103. package/esm/profile/manifest.d.ts.map +1 -1
  104. package/esm/profile/manifest.js +20 -3
  105. package/esm/profile/merge.js +7 -0
  106. package/esm/refs/mod.d.ts.map +1 -1
  107. package/esm/refs/mod.js +8 -19
  108. package/esm/reporter/mod.d.ts +11 -0
  109. package/esm/reporter/mod.d.ts.map +1 -1
  110. package/esm/reporter/mod.js +20 -9
  111. package/esm/typl/assemble.d.ts +53 -0
  112. package/esm/typl/assemble.d.ts.map +1 -0
  113. package/esm/typl/assemble.js +238 -0
  114. package/esm/typl/ast.d.ts +7 -1
  115. package/esm/typl/ast.d.ts.map +1 -1
  116. package/esm/typl/ast.js +3 -0
  117. package/esm/typl/bullet.d.ts +9 -7
  118. package/esm/typl/bullet.d.ts.map +1 -1
  119. package/esm/typl/bullet.js +6 -4
  120. package/esm/typl/citations.d.ts +27 -0
  121. package/esm/typl/citations.d.ts.map +1 -0
  122. package/esm/typl/citations.js +16 -0
  123. package/esm/typl/diagnostics.d.ts +2 -2
  124. package/esm/typl/diagnostics.d.ts.map +1 -1
  125. package/esm/typl/diagnostics.js +18 -0
  126. package/esm/typl/grammar.d.ts.map +1 -1
  127. package/esm/typl/grammar.js +6 -0
  128. package/esm/typl/lexer.d.ts.map +1 -1
  129. package/esm/typl/lexer.js +25 -4
  130. package/esm/typl/mod.d.ts +8 -2
  131. package/esm/typl/mod.d.ts.map +1 -1
  132. package/esm/typl/mod.js +5 -1
  133. package/esm/typl/recognize.js +2 -2
  134. package/esm/typl/registry.d.ts +1 -1
  135. package/esm/typl/resolve.d.ts +31 -0
  136. package/esm/typl/resolve.d.ts.map +1 -0
  137. package/esm/typl/resolve.js +27 -0
  138. package/esm/typl/table.d.ts +52 -0
  139. package/esm/typl/table.d.ts.map +1 -0
  140. package/esm/typl/table.js +69 -0
  141. package/esm/typl/validator.d.ts +24 -5
  142. package/esm/typl/validator.d.ts.map +1 -1
  143. package/esm/typl/validator.js +55 -75
  144. package/esm/upstream/mod.d.ts +45 -0
  145. package/esm/upstream/mod.d.ts.map +1 -0
  146. package/esm/upstream/mod.js +98 -0
  147. package/esm/upstream/project.d.ts +33 -0
  148. package/esm/upstream/project.d.ts.map +1 -0
  149. package/esm/upstream/project.js +38 -0
  150. package/esm/upstream/refs.d.ts +23 -0
  151. package/esm/upstream/refs.d.ts.map +1 -0
  152. package/esm/upstream/refs.js +71 -0
  153. package/esm/util/fence.d.ts +20 -29
  154. package/esm/util/fence.d.ts.map +1 -1
  155. package/esm/util/fence.js +42 -50
  156. package/esm/util/modals.d.ts +6 -0
  157. package/esm/util/modals.d.ts.map +1 -1
  158. package/esm/util/modals.js +37 -0
  159. package/esm/util/paths.d.ts +14 -0
  160. package/esm/util/paths.d.ts.map +1 -0
  161. package/esm/util/paths.js +22 -0
  162. package/esm/uxil/assemble.d.ts +38 -0
  163. package/esm/uxil/assemble.d.ts.map +1 -0
  164. package/esm/uxil/assemble.js +268 -0
  165. package/esm/uxil/ast.d.ts +63 -0
  166. package/esm/uxil/ast.d.ts.map +1 -0
  167. package/esm/uxil/ast.js +9 -0
  168. package/esm/uxil/citations.d.ts +27 -0
  169. package/esm/uxil/citations.d.ts.map +1 -0
  170. package/esm/uxil/citations.js +25 -0
  171. package/esm/uxil/diagnostics.d.ts +39 -0
  172. package/esm/uxil/diagnostics.d.ts.map +1 -0
  173. package/esm/uxil/diagnostics.js +135 -0
  174. package/esm/uxil/grammar.d.ts +72 -0
  175. package/esm/uxil/grammar.d.ts.map +1 -0
  176. package/esm/uxil/grammar.js +505 -0
  177. package/esm/uxil/lexer.d.ts +23 -0
  178. package/esm/uxil/lexer.d.ts.map +1 -0
  179. package/esm/uxil/lexer.js +58 -0
  180. package/esm/uxil/mod.d.ts +32 -0
  181. package/esm/uxil/mod.d.ts.map +1 -0
  182. package/esm/uxil/mod.js +11 -0
  183. package/esm/uxil/projection.d.ts +40 -0
  184. package/esm/uxil/projection.d.ts.map +1 -0
  185. package/esm/uxil/projection.js +41 -0
  186. package/esm/uxil/recognize.d.ts +16 -0
  187. package/esm/uxil/recognize.d.ts.map +1 -0
  188. package/esm/uxil/recognize.js +28 -0
  189. package/esm/uxil/registry.d.ts +37 -0
  190. package/esm/uxil/registry.d.ts.map +1 -0
  191. package/esm/uxil/registry.js +29 -0
  192. package/esm/uxil/surfaces.d.ts +36 -0
  193. package/esm/uxil/surfaces.d.ts.map +1 -0
  194. package/esm/uxil/surfaces.js +34 -0
  195. package/esm/uxil/validator.d.ts +36 -0
  196. package/esm/uxil/validator.d.ts.map +1 -0
  197. package/esm/uxil/validator.js +139 -0
  198. package/esm/uxil/vocab.d.ts +33 -0
  199. package/esm/uxil/vocab.d.ts.map +1 -0
  200. package/esm/uxil/vocab.js +36 -0
  201. package/esm/validator/body_blocks.d.ts +2 -1
  202. package/esm/validator/body_blocks.d.ts.map +1 -1
  203. package/esm/validator/body_blocks.js +80 -2
  204. package/esm/validator/caption_convention.d.ts +2 -1
  205. package/esm/validator/caption_convention.d.ts.map +1 -1
  206. package/esm/validator/caption_convention.js +2 -1
  207. package/esm/validator/corpus.d.ts +6 -0
  208. package/esm/validator/corpus.d.ts.map +1 -1
  209. package/esm/validator/corpus.js +55 -20
  210. package/esm/validator/discipline.d.ts +6 -4
  211. package/esm/validator/discipline.d.ts.map +1 -1
  212. package/esm/validator/discipline.js +6 -4
  213. package/esm/validator/mod.d.ts +1 -1
  214. package/esm/validator/mod.d.ts.map +1 -1
  215. package/esm/validator/mod.js +29 -16
  216. package/esm/validator/pipeline.d.ts +11 -1
  217. package/esm/validator/pipeline.d.ts.map +1 -1
  218. package/esm/validator/pipeline.js +76 -23
  219. package/esm/validator/trace_types.d.ts +9 -2
  220. package/esm/validator/trace_types.d.ts.map +1 -1
  221. package/esm/validator/trace_types.js +21 -5
  222. package/esm/validator/traceability.d.ts +15 -3
  223. package/esm/validator/traceability.d.ts.map +1 -1
  224. package/esm/validator/traceability.js +39 -4
  225. package/esm/validator/types.d.ts.map +1 -1
  226. package/esm/validator/types.js +11 -1
  227. package/esm/validator/uxil_family.d.ts +43 -0
  228. package/esm/validator/uxil_family.d.ts.map +1 -0
  229. package/esm/validator/uxil_family.js +52 -0
  230. package/package.json +1 -1
  231. package/script/ast/normalize.d.ts +4 -5
  232. package/script/ast/normalize.d.ts.map +1 -1
  233. package/script/ast/normalize.js +5 -36
  234. package/script/collect/mod.d.ts +29 -9
  235. package/script/collect/mod.d.ts.map +1 -1
  236. package/script/collect/mod.js +38 -10
  237. package/script/compiler/deserialize.d.ts +49 -0
  238. package/script/compiler/deserialize.d.ts.map +1 -0
  239. package/script/compiler/deserialize.js +144 -0
  240. package/script/compiler/manifest.d.ts +3 -0
  241. package/script/compiler/manifest.d.ts.map +1 -1
  242. package/script/compiler/manifest.js +10 -3
  243. package/script/compiler/mod.d.ts.map +1 -1
  244. package/script/compiler/mod.js +16 -11
  245. package/script/config/markspec.d.ts +40 -1
  246. package/script/config/markspec.d.ts.map +1 -1
  247. package/script/config/markspec.js +129 -3
  248. package/script/config/mod.d.ts.map +1 -1
  249. package/script/config/mod.js +143 -147
  250. package/script/decl/duplicates.d.ts +29 -0
  251. package/script/decl/duplicates.d.ts.map +1 -0
  252. package/script/decl/duplicates.js +31 -0
  253. package/script/decl/mod.d.ts +4 -2
  254. package/script/decl/mod.d.ts.map +1 -1
  255. package/script/decl/mod.js +4 -2
  256. package/script/decl/surfaces.d.ts +29 -7
  257. package/script/decl/surfaces.d.ts.map +1 -1
  258. package/script/decl/surfaces.js +32 -19
  259. package/script/discovery/mod.d.ts +24 -8
  260. package/script/discovery/mod.d.ts.map +1 -1
  261. package/script/discovery/mod.js +56 -20
  262. package/script/discovery/projects.d.ts +109 -0
  263. package/script/discovery/projects.d.ts.map +1 -0
  264. package/script/discovery/projects.js +240 -0
  265. package/script/formatter/entry_body.d.ts +86 -0
  266. package/script/formatter/entry_body.d.ts.map +1 -0
  267. package/script/formatter/entry_body.js +292 -0
  268. package/script/formatter/mod.d.ts +13 -9
  269. package/script/formatter/mod.d.ts.map +1 -1
  270. package/script/formatter/mod.js +124 -48
  271. package/script/gates/mod.d.ts +13 -2
  272. package/script/gates/mod.d.ts.map +1 -1
  273. package/script/gates/mod.js +50 -22
  274. package/script/lint/runner.d.ts.map +1 -1
  275. package/script/lint/runner.js +6 -4
  276. package/script/lock/acquire_compile.d.ts +31 -0
  277. package/script/lock/acquire_compile.d.ts.map +1 -0
  278. package/script/lock/acquire_compile.js +86 -0
  279. package/script/lock/cache_check.d.ts +28 -0
  280. package/script/lock/cache_check.d.ts.map +1 -0
  281. package/script/lock/cache_check.js +54 -0
  282. package/script/lock/check.d.ts +14 -3
  283. package/script/lock/check.d.ts.map +1 -1
  284. package/script/lock/check.js +43 -4
  285. package/script/lock/edge_drift.d.ts +2 -0
  286. package/script/lock/edge_drift.d.ts.map +1 -1
  287. package/script/lock/edge_drift.js +5 -0
  288. package/script/lock/git_intent.d.ts +46 -0
  289. package/script/lock/git_intent.d.ts.map +1 -0
  290. package/script/lock/git_intent.js +115 -0
  291. package/script/lock/mod.d.ts +11 -4
  292. package/script/lock/mod.d.ts.map +1 -1
  293. package/script/lock/mod.js +17 -2
  294. package/script/lock/model.d.ts +24 -1
  295. package/script/lock/model.d.ts.map +1 -1
  296. package/script/lock/parser.d.ts.map +1 -1
  297. package/script/lock/parser.js +32 -0
  298. package/script/lock/pin_assurance.d.ts +20 -0
  299. package/script/lock/pin_assurance.d.ts.map +1 -0
  300. package/script/lock/pin_assurance.js +37 -0
  301. package/script/lock/resolve.d.ts +8 -17
  302. package/script/lock/resolve.d.ts.map +1 -1
  303. package/script/lock/resolve.js +7 -68
  304. package/script/lock/serializer.d.ts.map +1 -1
  305. package/script/lock/serializer.js +23 -0
  306. package/script/lock/upstream_common.d.ts +29 -0
  307. package/script/lock/upstream_common.d.ts.map +1 -0
  308. package/script/lock/upstream_common.js +42 -0
  309. package/script/lock/upstream_deps.d.ts +63 -0
  310. package/script/lock/upstream_deps.d.ts.map +1 -0
  311. package/script/lock/upstream_deps.js +175 -0
  312. package/script/lock/upstream_refs.d.ts +69 -0
  313. package/script/lock/upstream_refs.d.ts.map +1 -0
  314. package/script/lock/upstream_refs.js +244 -0
  315. package/script/mod.d.ts +23 -11
  316. package/script/mod.d.ts.map +1 -1
  317. package/script/mod.js +55 -7
  318. package/script/model/mod.d.ts +114 -28
  319. package/script/model/mod.d.ts.map +1 -1
  320. package/script/model/mod.js +81 -14
  321. package/script/model/profile.d.ts +13 -0
  322. package/script/model/profile.d.ts.map +1 -1
  323. package/script/parser/code_regions.d.ts +29 -0
  324. package/script/parser/code_regions.d.ts.map +1 -0
  325. package/script/parser/code_regions.js +41 -0
  326. package/script/parser/markdown.d.ts.map +1 -1
  327. package/script/parser/markdown.js +108 -89
  328. package/script/parser/mod.d.ts.map +1 -1
  329. package/script/parser/mod.js +7 -1
  330. package/script/parser/translate.d.ts.map +1 -1
  331. package/script/parser/translate.js +5 -0
  332. package/script/profile/manifest.d.ts.map +1 -1
  333. package/script/profile/manifest.js +20 -3
  334. package/script/profile/merge.js +7 -0
  335. package/script/refs/mod.d.ts.map +1 -1
  336. package/script/refs/mod.js +7 -18
  337. package/script/reporter/mod.d.ts +11 -0
  338. package/script/reporter/mod.d.ts.map +1 -1
  339. package/script/reporter/mod.js +19 -8
  340. package/script/typl/assemble.d.ts +53 -0
  341. package/script/typl/assemble.d.ts.map +1 -0
  342. package/script/typl/assemble.js +241 -0
  343. package/script/typl/ast.d.ts +7 -1
  344. package/script/typl/ast.d.ts.map +1 -1
  345. package/script/typl/ast.js +3 -0
  346. package/script/typl/bullet.d.ts +9 -7
  347. package/script/typl/bullet.d.ts.map +1 -1
  348. package/script/typl/bullet.js +6 -4
  349. package/script/typl/citations.d.ts +27 -0
  350. package/script/typl/citations.d.ts.map +1 -0
  351. package/script/typl/citations.js +20 -0
  352. package/script/typl/diagnostics.d.ts +2 -2
  353. package/script/typl/diagnostics.d.ts.map +1 -1
  354. package/script/typl/diagnostics.js +18 -0
  355. package/script/typl/grammar.d.ts.map +1 -1
  356. package/script/typl/grammar.js +6 -0
  357. package/script/typl/lexer.d.ts.map +1 -1
  358. package/script/typl/lexer.js +25 -4
  359. package/script/typl/mod.d.ts +8 -2
  360. package/script/typl/mod.d.ts.map +1 -1
  361. package/script/typl/mod.js +14 -2
  362. package/script/typl/recognize.js +2 -2
  363. package/script/typl/registry.d.ts +1 -1
  364. package/script/typl/resolve.d.ts +31 -0
  365. package/script/typl/resolve.d.ts.map +1 -0
  366. package/script/typl/resolve.js +33 -0
  367. package/script/typl/table.d.ts +52 -0
  368. package/script/typl/table.d.ts.map +1 -0
  369. package/script/typl/table.js +75 -0
  370. package/script/typl/validator.d.ts +24 -5
  371. package/script/typl/validator.d.ts.map +1 -1
  372. package/script/typl/validator.js +55 -75
  373. package/script/upstream/mod.d.ts +45 -0
  374. package/script/upstream/mod.d.ts.map +1 -0
  375. package/script/upstream/mod.js +101 -0
  376. package/script/upstream/project.d.ts +33 -0
  377. package/script/upstream/project.d.ts.map +1 -0
  378. package/script/upstream/project.js +41 -0
  379. package/script/upstream/refs.d.ts +23 -0
  380. package/script/upstream/refs.d.ts.map +1 -0
  381. package/script/upstream/refs.js +74 -0
  382. package/script/util/fence.d.ts +20 -29
  383. package/script/util/fence.d.ts.map +1 -1
  384. package/script/util/fence.js +47 -54
  385. package/script/util/modals.d.ts +6 -0
  386. package/script/util/modals.d.ts.map +1 -1
  387. package/script/util/modals.js +38 -0
  388. package/script/util/paths.d.ts +14 -0
  389. package/script/util/paths.d.ts.map +1 -0
  390. package/script/util/paths.js +25 -0
  391. package/script/uxil/assemble.d.ts +38 -0
  392. package/script/uxil/assemble.d.ts.map +1 -0
  393. package/script/uxil/assemble.js +272 -0
  394. package/script/uxil/ast.d.ts +63 -0
  395. package/script/uxil/ast.d.ts.map +1 -0
  396. package/script/uxil/ast.js +10 -0
  397. package/script/uxil/citations.d.ts +27 -0
  398. package/script/uxil/citations.d.ts.map +1 -0
  399. package/script/uxil/citations.js +29 -0
  400. package/script/uxil/diagnostics.d.ts +39 -0
  401. package/script/uxil/diagnostics.d.ts.map +1 -0
  402. package/script/uxil/diagnostics.js +140 -0
  403. package/script/uxil/grammar.d.ts +72 -0
  404. package/script/uxil/grammar.d.ts.map +1 -0
  405. package/script/uxil/grammar.js +511 -0
  406. package/script/uxil/lexer.d.ts +23 -0
  407. package/script/uxil/lexer.d.ts.map +1 -0
  408. package/script/uxil/lexer.js +61 -0
  409. package/script/uxil/mod.d.ts +32 -0
  410. package/script/uxil/mod.d.ts.map +1 -0
  411. package/script/uxil/mod.js +37 -0
  412. package/script/uxil/projection.d.ts +40 -0
  413. package/script/uxil/projection.d.ts.map +1 -0
  414. package/script/uxil/projection.js +44 -0
  415. package/script/uxil/recognize.d.ts +16 -0
  416. package/script/uxil/recognize.d.ts.map +1 -0
  417. package/script/uxil/recognize.js +31 -0
  418. package/script/uxil/registry.d.ts +37 -0
  419. package/script/uxil/registry.d.ts.map +1 -0
  420. package/script/uxil/registry.js +32 -0
  421. package/script/uxil/surfaces.d.ts +36 -0
  422. package/script/uxil/surfaces.d.ts.map +1 -0
  423. package/script/uxil/surfaces.js +39 -0
  424. package/script/uxil/validator.d.ts +36 -0
  425. package/script/uxil/validator.d.ts.map +1 -0
  426. package/script/uxil/validator.js +142 -0
  427. package/script/uxil/vocab.d.ts +33 -0
  428. package/script/uxil/vocab.d.ts.map +1 -0
  429. package/script/uxil/vocab.js +41 -0
  430. package/script/validator/body_blocks.d.ts +2 -1
  431. package/script/validator/body_blocks.d.ts.map +1 -1
  432. package/script/validator/body_blocks.js +80 -2
  433. package/script/validator/caption_convention.d.ts +2 -1
  434. package/script/validator/caption_convention.d.ts.map +1 -1
  435. package/script/validator/caption_convention.js +2 -1
  436. package/script/validator/corpus.d.ts +6 -0
  437. package/script/validator/corpus.d.ts.map +1 -1
  438. package/script/validator/corpus.js +55 -19
  439. package/script/validator/discipline.d.ts +6 -4
  440. package/script/validator/discipline.d.ts.map +1 -1
  441. package/script/validator/discipline.js +6 -4
  442. package/script/validator/mod.d.ts +1 -1
  443. package/script/validator/mod.d.ts.map +1 -1
  444. package/script/validator/mod.js +29 -15
  445. package/script/validator/pipeline.d.ts +11 -1
  446. package/script/validator/pipeline.d.ts.map +1 -1
  447. package/script/validator/pipeline.js +75 -22
  448. package/script/validator/trace_types.d.ts +9 -2
  449. package/script/validator/trace_types.d.ts.map +1 -1
  450. package/script/validator/trace_types.js +20 -4
  451. package/script/validator/traceability.d.ts +15 -3
  452. package/script/validator/traceability.d.ts.map +1 -1
  453. package/script/validator/traceability.js +38 -3
  454. package/script/validator/types.d.ts.map +1 -1
  455. package/script/validator/types.js +10 -0
  456. package/script/validator/uxil_family.d.ts +43 -0
  457. package/script/validator/uxil_family.d.ts.map +1 -0
  458. package/script/validator/uxil_family.js +56 -0
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/parser/mod.ts"],"names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EAAE,qBAAqB,GAC9B,OAAO,EAAE,CAEX"}
package/esm/parser/mod.js CHANGED
@@ -81,7 +81,13 @@ export async function parseFile(content, options) {
81
81
  return { entries: result.entries, diagnostics: [] };
82
82
  }
83
83
  const fm = extractFrontMatter(normalised, { file: options.file });
84
- const body = fm.hadFrontMatter ? fm.markdown : normalised;
84
+ // Replace the stripped front matter with blank lines so every location
85
+ // the Markdown parser reports stays file-relative (CommonMark ignores
86
+ // leading blank lines).
87
+ const body = fm.hadFrontMatter
88
+ ? "\n".repeat(normalised.slice(0, normalised.length - fm.markdown.length)
89
+ .split("\n").length - 1) + fm.markdown
90
+ : normalised;
85
91
  const isReferencesDoc = isReferencesDocument(options.file);
86
92
  const { entries, diagnostics: parseDiagnostics } = parseMarkdown(body, {
87
93
  file: options.file,
@@ -1 +1 @@
1
- {"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/parser/translate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,OAAO,GACf,KAAK,EAAE,CAoDT"}
1
+ {"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/parser/translate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,OAAO,GACf,KAAK,EAAE,CAyDT"}
@@ -37,6 +37,11 @@ export function translateEntryLocations(entries, lineMap) {
37
37
  return {
38
38
  ...entry,
39
39
  location: translatedEntryLoc,
40
+ ...(entry.endLine !== undefined
41
+ ? {
42
+ endLine: lineMap.translate(entry.endLine, 1)?.line ?? entry.endLine,
43
+ }
44
+ : {}),
40
45
  bodyAst: entry.bodyAst
41
46
  ? entry.bodyAst.map((block) => translateBlock(block, lineMap, fallbackPoint, warn))
42
47
  : entry.bodyAst,
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA8BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAW/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAU5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAEhF,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAq0CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CAyMrB"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA+BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAW/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAW5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAEhF,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAo1CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CAyMrB"}
@@ -8,6 +8,7 @@
8
8
  import { parse as parseYaml } from "@std/yaml";
9
9
  import { COLOR_NAME_RE, CORE_KINDS, CORE_TYPES, LIST_VALUE_TYPES, MIXED_DISCIPLINE, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
10
10
  import { validateDisplayIdPattern } from "./display_id.js";
11
+ import { isUnsafeRelPath } from "../util/paths.js";
11
12
  const VALUE_TYPE_SET = new Set(VALUE_TYPES);
12
13
  export const ALLOWED_ROOT_KEYS = new Set([
13
14
  "$schema",
@@ -41,6 +42,7 @@ export const ALLOWED_TYPE_KEYS = new Set([
41
42
  "traceability",
42
43
  "color",
43
44
  "discipline",
45
+ "declares",
44
46
  ]);
45
47
  export const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
46
48
  export const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
@@ -977,6 +979,21 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
977
979
  }
978
980
  discipline = r.discipline;
979
981
  }
982
+ // uxil S9 (#727): `declares: ux-surface` designates a uxil declaring
983
+ // entry type. Closed vocabulary — reject anything else at load time.
984
+ let declares;
985
+ if (r.declares !== undefined) {
986
+ if (r.declares !== "ux-surface") {
987
+ diagnostics.push({
988
+ code: "PROFILE-TYPE-009",
989
+ severity: "error",
990
+ message: `${ctx}: 'declares' value '${r.declares}' is not recognised (expected 'ux-surface')`,
991
+ location: { file: sourcePath, line: 1, column: 1 },
992
+ });
993
+ return undefined;
994
+ }
995
+ declares = r.declares;
996
+ }
980
997
  const description = typeof r.description === "string"
981
998
  ? r.description
982
999
  : undefined;
@@ -994,6 +1011,7 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
994
1011
  color,
995
1012
  description,
996
1013
  discipline,
1014
+ declares,
997
1015
  };
998
1016
  }
999
1017
  function parseTypesMap(raw, sourcePath, diagnostics) {
@@ -1142,11 +1160,10 @@ function parseDeliversSection(raw, sourcePath, diagnostics) {
1142
1160
  });
1143
1161
  continue;
1144
1162
  }
1163
+ const normalized = path.replaceAll("\\", "/");
1145
1164
  // PROFILE-DELIVERS-003 — the path must stay inside the profile
1146
1165
  // directory: no absolute paths (POSIX or drive-letter), no `..`.
1147
- const normalized = path.replaceAll("\\", "/");
1148
- if (normalized.startsWith("/") || /^[A-Za-z]:/.test(normalized) ||
1149
- normalized.split("/").includes("..")) {
1166
+ if (isUnsafeRelPath(path)) {
1150
1167
  diagnostics.push({
1151
1168
  code: "PROFILE-DELIVERS-003",
1152
1169
  severity: "error",
@@ -121,6 +121,7 @@ function foldTier(base, tier, diagnostics) {
121
121
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
122
122
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
123
123
  discipline: { value: td.discipline, origin },
124
+ declares: { value: td.declares, origin },
124
125
  };
125
126
  types.set(name, { value: eff, origin });
126
127
  }
@@ -399,6 +400,10 @@ function tightenType(existing, child, childOrigin, diagnostics) {
399
400
  const discipline = child.discipline !== undefined
400
401
  ? { value: child.discipline, origin: childOrigin }
401
402
  : effExisting.discipline;
403
+ // Declares (uxil S9 #727): child wins when set; otherwise parent stays.
404
+ const declares = child.declares !== undefined
405
+ ? { value: child.declares, origin: childOrigin }
406
+ : effExisting.declares ?? { value: undefined, origin: existing.origin };
402
407
  const attrDescriptions = mergeDescriptionMap(effExisting.attrDescriptions, child.attributes.map((a) => ({ name: a.name, desc: a.description })), childOrigin);
403
408
  const relationDescriptions = mergeDescriptionMap(effExisting.relationDescriptions, [...child.traceability.entries()].map(([name, r]) => ({
404
409
  name,
@@ -417,6 +422,7 @@ function tightenType(existing, child, childOrigin, diagnostics) {
417
422
  attrDescriptions,
418
423
  relationDescriptions,
419
424
  discipline,
425
+ declares,
420
426
  };
421
427
  const overrides = [
422
428
  ...(existing.overrides ?? []),
@@ -738,6 +744,7 @@ function mapFromTypes(types, origin) {
738
744
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
739
745
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
740
746
  discipline: { value: td.discipline, origin },
747
+ declares: { value: td.declares, origin },
741
748
  };
742
749
  out.set(name, { value: eff, origin });
743
750
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/refs/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAGnD,CAAC;AAEH,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,QAAQ,CAajE;AAcD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,QAAQ,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAgHtC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/refs/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAGnD,CAAC;AAEH,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,QAAQ,CAajE;AAcD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,QAAQ,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAqGtC"}
package/esm/refs/mod.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * it (WASM-migration purity guard, AGENTS.md).
13
13
  */
14
14
  import { CORE_RELATIONS, DISPLAY_ID_RE, LOCK_EXTRA_INVERSE_KEYS, ULID_RE, } from "../model/mod.js";
15
- import { FENCE_RE } from "../util/fence.js";
15
+ import { fencedCodeLines } from "../util/fence.js";
16
16
  /**
17
17
  * Trace-attribute keys whose values are canonicalised/healed: the core
18
18
  * relations plus `Verified-by`. Derived from {@linkcode CORE_RELATIONS} so new
@@ -85,25 +85,17 @@ export function canonicalizeRefs(content, entries, index, ledger) {
85
85
  };
86
86
  const lines = content.split("\n");
87
87
  let changed = false;
88
- // Track fenced-code regions so illustrative trailers inside ``` / ~~~
89
- // blocks (e.g. `Realizes: 01HGW...` in a ```markdown example) are never
90
- // "healed" against the real ref index — the same verbatim-region rule
91
- // every other fmt pass honors (§5.1; cf. `collapseBlankLines`). Without
92
- // this, `markspec fmt` rewrites example IDs in spec/ADR docs on every run
93
- // (#668). The parser/validator already treat fenced content as inert.
94
- let inFence = false;
88
+ // Share CommonMark fence boundaries with other prose passes. Compute them
89
+ // once so both the main loop and continuation loop remain linear (#705).
90
+ const fencedLines = fencedCodeLines(content);
95
91
  for (let i = 0; i < lines.length; i++) {
92
+ if (fencedLines.has(i))
93
+ continue;
96
94
  // Strip a trailing CR before matching so CRLF files are handled (the
97
95
  // trailer regex ends in `$`, which `\r` would block) and re-append it on
98
96
  // rewrite so line endings stay byte-for-byte lossless.
99
97
  const cr = lines[i].endsWith("\r");
100
98
  const bare = cr ? lines[i].slice(0, -1) : lines[i];
101
- if (FENCE_RE.test(bare)) {
102
- inFence = !inFence;
103
- continue;
104
- }
105
- if (inFence)
106
- continue;
107
99
  const m = TRACE_TRAILER_RE.exec(bare);
108
100
  if (!m)
109
101
  continue;
@@ -130,11 +122,8 @@ export function canonicalizeRefs(content, entries, index, ledger) {
130
122
  j++;
131
123
  const crj = lines[j].endsWith("\r");
132
124
  const barej = crj ? lines[j].slice(0, -1) : lines[j];
133
- // A fence marker is never continuation text. An indented one (e.g.
134
- // ` ```md`) would otherwise match CONTINUATION_LINE_RE and be
135
- // swallowed here without toggling `inFence`, desyncing fence tracking
136
- // for the rest of the file. Back out and let the outer loop toggle it.
137
- if (FENCE_RE.test(barej)) {
125
+ // Fence delimiters and fenced content cannot continue a trace value.
126
+ if (fencedLines.has(j)) {
138
127
  j--;
139
128
  break;
140
129
  }
@@ -19,6 +19,17 @@ export interface ReportOptions {
19
19
  readonly scope?: string;
20
20
  /** Filter entries by label value. */
21
21
  readonly label?: string;
22
+ /**
23
+ * Declared upstream ids from `project.yaml`'s `dependencies:` (federated
24
+ * upstream, slice 4), derived via `deriveUpstreamId`. Used by the
25
+ * `coverage` report to classify an upstream-origin entry: an id in this
26
+ * set participates in coverage like a project entry (a `dependencies:`
27
+ * upstream); an upstream-origin entry whose id is NOT in this set is a
28
+ * `references:` leaf, excluded from the orphan/unsatisfied gap lists.
29
+ * Defaults to empty — every upstream-origin entry is treated as a
30
+ * reference leaf.
31
+ */
32
+ readonly dependencyUpstreamIds?: ReadonlySet<string>;
22
33
  }
23
34
  /**
24
35
  * Generate a report from compiled traceability graph.
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAErD,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAO5E"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQxD,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAErD,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAY5E"}
@@ -4,7 +4,7 @@
4
4
  * Output reporters. Transforms compiled traceability graph into
5
5
  * traceability matrices and coverage reports in md, json, or csv format.
6
6
  */
7
- import { formatEntryOrigin } from "../model/mod.js";
7
+ import { formatEntryOrigin, isCorpusEntry, isUpstreamEntry, } from "../model/mod.js";
8
8
  /**
9
9
  * Generate a report from compiled traceability graph.
10
10
  *
@@ -17,7 +17,7 @@ export function report(result, options) {
17
17
  if (options.kind === "traceability") {
18
18
  return formatTraceability(result, entries, options.format);
19
19
  }
20
- return formatCoverage(result, entries, options.format);
20
+ return formatCoverage(result, entries, options.format, options.dependencyUpstreamIds);
21
21
  }
22
22
  // ---------------------------------------------------------------------------
23
23
  // Filtering
@@ -50,7 +50,7 @@ function filterEntries(result, scope, label) {
50
50
  * Markdown, and JSON rows all agree on the same value.
51
51
  */
52
52
  function originCell(entry) {
53
- return entry.origin ? formatEntryOrigin(entry.origin) : "project";
53
+ return isCorpusEntry(entry) ? formatEntryOrigin(entry.origin) : "project";
54
54
  }
55
55
  function buildTraceRows(result, entries) {
56
56
  return entries.map((entry) => {
@@ -95,7 +95,8 @@ function formatTraceability(result, entries, format) {
95
95
  const lines = rows.map((r) => `| ${r.id} | ${r.title} | ${r.entryType} | ${r.origin} | ${r.satisfies || "\u2014"} | ${r.satisfiedBy || "\u2014"} |`);
96
96
  return [header, sep, ...lines].join("\n");
97
97
  }
98
- function computeCoverage(result, entries) {
98
+ function computeCoverage(result, entries, opts = {}) {
99
+ const { dependencyUpstreamIds } = opts;
99
100
  const byType = {};
100
101
  const orphans = [];
101
102
  const unsatisfied = [];
@@ -105,13 +106,22 @@ function computeCoverage(result, entries) {
105
106
  // Bucket by profile-declared type when available, fall back to shape.
106
107
  const t = entry.type ?? (entry.shape === "Reference" ? "ref" : "untyped");
107
108
  byType[t] = (byType[t] ?? 0) + 1;
109
+ // Federated upstream (slice 4): a `references:` upstream entry is a
110
+ // traceability leaf — no coverage expectation points at or from it, so
111
+ // it is excluded from both gap lists below. A `dependencies:` upstream
112
+ // entry (its upstreamId present in `dependencyUpstreamIds`) participates
113
+ // like a project entry — this branch is inert until slice 3 loads
114
+ // dependency entries, but the classification is exercised here so it's
115
+ // ready when they do.
116
+ const isReferenceLeaf = isUpstreamEntry(entry) &&
117
+ !(dependencyUpstreamIds?.has(entry.origin.upstreamId) ?? false);
108
118
  const fwd = result.forward.get(entry.displayId) ?? [];
109
119
  const rev = result.reverse.get(entry.displayId) ?? [];
110
120
  const hasSatisfies = fwd.some((l) => l.kind === "satisfies");
111
- if (hasSatisfies) {
121
+ if (hasSatisfies && !isReferenceLeaf) {
112
122
  withSatisfies++;
113
123
  }
114
- else if (entry.shape === "Authored") {
124
+ else if (entry.shape === "Authored" && !isReferenceLeaf) {
115
125
  withoutSatisfies++;
116
126
  orphans.push(entry.displayId);
117
127
  }
@@ -120,7 +130,8 @@ function computeCoverage(result, entries) {
120
130
  // profile-specific; a profile-aware reporter layer refines this.
121
131
  const hasSatisfiedBy = rev.some((l) => l.kind === "satisfies");
122
132
  if (entry.type &&
123
- !hasSatisfiedBy) {
133
+ !hasSatisfiedBy &&
134
+ !isReferenceLeaf) {
124
135
  unsatisfied.push(entry.displayId);
125
136
  }
126
137
  }
@@ -132,8 +143,8 @@ function computeCoverage(result, entries) {
132
143
  gaps: { orphans, unsatisfied },
133
144
  };
134
145
  }
135
- function formatCoverage(result, entries, format) {
136
- const stats = computeCoverage(result, entries);
146
+ function formatCoverage(result, entries, format, dependencyUpstreamIds) {
147
+ const stats = computeCoverage(result, entries, { dependencyUpstreamIds });
137
148
  if (format === "json") {
138
149
  return JSON.stringify(stats, null, 2);
139
150
  }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @module typl/assemble
3
+ *
4
+ * Entry-level typl assembly (#723, #724): extracts declarations from the four
5
+ * surfaces (fence / bullet / inline / table), resolves published names through
6
+ * the base-resolution engine (core/decl/resolve), and aggregates the
7
+ * result into the `Entry.types` TyplBlock. Moved out of parser/markdown.ts
8
+ * so the parser calls one function.
9
+ *
10
+ * Resolution rules (design spec D5):
11
+ * - a `: namespace` binding establishes a base; nested-bullet namespaces
12
+ * scope their subtree (innermost wins); the root namespace (no
13
+ * namespace ancestor) scopes the whole entry body, order-independent;
14
+ * - a table's `Table:` caption may carry a base (#724); a table row
15
+ * resolves against that caption base first (innermost, #722 rule 3),
16
+ * then the root — the caption base is not itself a root and never sets
17
+ * `rootNamespace`;
18
+ * - relative names (`$.x`) resolve to absolute dotted names before
19
+ * aggregation — Entry.types carries absolute names only;
20
+ * - namespace bindings are scaffolding: excluded from bindings;
21
+ * - a relative name with no base is TYPL-010 (binding dropped);
22
+ * - a second root is TYPL-012 (first root wins);
23
+ * - inline/fence relative refs resolve against the root base only.
24
+ */
25
+ import type { BodyBlock } from "../ast/nodes.js";
26
+ import type { BodyToken, Diagnostic } from "../model/mod.js";
27
+ import type { TyplBlock } from "./ast.js";
28
+ /**
29
+ * Assemble one entry's typl declarations into its `Entry.types` block.
30
+ *
31
+ * Extracts declarations from the four embedding surfaces (fenced code,
32
+ * bullet glossary, inline code spans, table rows), resolves every relative
33
+ * `$.x` name against the caption/root/nested-namespace bases in scope (see
34
+ * the module doc's resolution rules), and aggregates the result.
35
+ *
36
+ * @param bodyAst - The entry body's parsed block AST (fence + bullet + table
37
+ * surfaces walk this).
38
+ * @param bodyTokens - The entry body's flat token stream (the inline
39
+ * surface walks this).
40
+ * @param file - Source file path, for bridging diagnostics back to
41
+ * file-relative positions.
42
+ * @param bodyStartLine - 1-based line the entry body starts on, added to
43
+ * each surface's body-relative range to get a file-relative line.
44
+ * @returns `types` — the assembled `TyplBlock`, omitted when the entry
45
+ * declares nothing (no bindings, no typedefs, no root namespace) — plus
46
+ * any diagnostics raised during extraction or resolution (TYPL-010,
47
+ * TYPL-012, and bridged parse diagnostics).
48
+ */
49
+ export declare function assembleTyplTypes(bodyAst: readonly BodyBlock[], bodyTokens: readonly BodyToken[], file: string, bodyStartLine: number): {
50
+ types?: TyplBlock;
51
+ diagnostics: Diagnostic[];
52
+ };
53
+ //# sourceMappingURL=assemble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../src/typl/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,UAAU,CAAC;AAkC5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GACpB;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,CAqOlD"}
@@ -0,0 +1,238 @@
1
+ import { checkSingleRoot, resolveRef } from "../decl/mod.js";
2
+ import { bridgeTyplDiagnostic } from "./bridge.js";
3
+ import { typlDiagnostic } from "./diagnostics.js";
4
+ import { extractTyplFences } from "./fence.js";
5
+ import { extractTyplBulletsNested } from "./bullet.js";
6
+ import { extractTyplInlines } from "./inline.js";
7
+ import { extractTyplTable, typlTableCaptionBase } from "./table.js";
8
+ import { parseTyplBlock } from "./grammar.js";
9
+ import { TYPL_REF_OPS, typlPathOf } from "./resolve.js";
10
+ /**
11
+ * Assemble one entry's typl declarations into its `Entry.types` block.
12
+ *
13
+ * Extracts declarations from the four embedding surfaces (fenced code,
14
+ * bullet glossary, inline code spans, table rows), resolves every relative
15
+ * `$.x` name against the caption/root/nested-namespace bases in scope (see
16
+ * the module doc's resolution rules), and aggregates the result.
17
+ *
18
+ * @param bodyAst - The entry body's parsed block AST (fence + bullet + table
19
+ * surfaces walk this).
20
+ * @param bodyTokens - The entry body's flat token stream (the inline
21
+ * surface walks this).
22
+ * @param file - Source file path, for bridging diagnostics back to
23
+ * file-relative positions.
24
+ * @param bodyStartLine - 1-based line the entry body starts on, added to
25
+ * each surface's body-relative range to get a file-relative line.
26
+ * @returns `types` — the assembled `TyplBlock`, omitted when the entry
27
+ * declares nothing (no bindings, no typedefs, no root namespace) — plus
28
+ * any diagnostics raised during extraction or resolution (TYPL-010,
29
+ * TYPL-012, and bridged parse diagnostics).
30
+ */
31
+ export function assembleTyplTypes(bodyAst, bodyTokens, file, bodyStartLine) {
32
+ const diagnostics = [];
33
+ const blocks = [];
34
+ // Map bullet-extraction index → blocks[] index, for parent lookups.
35
+ const bulletBlockIndex = [];
36
+ for (const fence of extractTyplFences(bodyAst)) {
37
+ const result = parseTyplBlock(fence.source);
38
+ const lineOffset = bodyStartLine + fence.range.start.line - 1;
39
+ for (const td of result.diagnostics) {
40
+ diagnostics.push(bridgeTyplDiagnostic(td, file, lineOffset));
41
+ }
42
+ blocks.push({ ...result.ast, file, lineOffset });
43
+ }
44
+ const bullets = extractTyplBulletsNested(bodyAst);
45
+ for (const bullet of bullets) {
46
+ const result = parseTyplBlock(bullet.source);
47
+ const lineOffset = bodyStartLine + bullet.range.start.line - 2;
48
+ for (const td of result.diagnostics) {
49
+ diagnostics.push(bridgeTyplDiagnostic(td, file, lineOffset));
50
+ }
51
+ bulletBlockIndex.push(blocks.length);
52
+ blocks.push({
53
+ ...result.ast,
54
+ file,
55
+ lineOffset,
56
+ bulletParent: bullet.parent,
57
+ });
58
+ }
59
+ for (const inline of extractTyplInlines(bodyTokens)) {
60
+ const result = parseTyplBlock(inline.source);
61
+ const lineOffset = inline.location.line - 1;
62
+ for (const td of result.diagnostics) {
63
+ diagnostics.push(bridgeTyplDiagnostic(td, inline.location.file, lineOffset));
64
+ }
65
+ blocks.push({ ...result.ast, file: inline.location.file, lineOffset });
66
+ }
67
+ // Table rows (#724): each recognized data row is one binding. Its range
68
+ // points AT the row's own line (like the bullet surface, not the fence
69
+ // whose range points at the opening ``` a line above its content), so the
70
+ // diagnostic offset subtracts 2, matching the bullet path. The `Table:`
71
+ // caption base — when the caption text is an absolute typl name — scopes
72
+ // the row's relative refs (see `scopeFor`); the caption base is not a
73
+ // namespace binding, so it takes no part in Pass A root detection or Pass B.
74
+ for (const row of extractTyplTable(bodyAst)) {
75
+ const result = parseTyplBlock(row.source);
76
+ const lineOffset = bodyStartLine + row.range.start.line - 2;
77
+ for (const td of result.diagnostics) {
78
+ diagnostics.push(bridgeTyplDiagnostic(td, file, lineOffset));
79
+ }
80
+ const captionBase = row.captionText !== undefined
81
+ ? typlTableCaptionBase(row.captionText)
82
+ : undefined;
83
+ blocks.push({
84
+ ...result.ast,
85
+ file,
86
+ lineOffset,
87
+ ...(captionBase !== undefined ? { captionBase } : {}),
88
+ });
89
+ }
90
+ // Emit a bridged typl diagnostic for a binding in blocks[i].
91
+ const emit = (code, params, i, position) => {
92
+ const td = typlDiagnostic(code, params, position);
93
+ diagnostics.push(bridgeTyplDiagnostic(td, blocks[i].file, blocks[i].lineOffset));
94
+ };
95
+ // blockHasNamespace / hasNamespaceAncestor are static structure checks
96
+ // (independent of resolution), so Pass A is order-independent.
97
+ const blockHasNamespace = blocks.map((b) => b.bindings.some((x) => x.kind === "namespace"));
98
+ const hasNamespaceAncestor = (i) => {
99
+ let p = blocks[i].bulletParent;
100
+ while (p !== undefined) {
101
+ const idx = bulletBlockIndex[p];
102
+ if (blockHasNamespace[idx])
103
+ return true;
104
+ p = blocks[idx].bulletParent;
105
+ }
106
+ return false;
107
+ };
108
+ // ── Pass A: find the root ────────────────────────────────────────────
109
+ // Root candidate = an ABSOLUTE namespace binding with no namespace
110
+ // ancestor in its bullet chain (a relative namespace can never be a
111
+ // root — it needs a base itself). checkSingleRoot (core/decl) enforces
112
+ // the one-root invariant; its bare contract also flags zero candidates
113
+ // as a failure ("no-root"), but an entry with no namespace binding at
114
+ // all is a normal, error-free shape here — only "multiple-roots"
115
+ // produces diagnostics, first candidate in source order wins (order-
116
+ // independent for authors: the root scopes the whole body).
117
+ const rootCandidates = [];
118
+ for (let i = 0; i < blocks.length; i++) {
119
+ for (const binding of blocks[i].bindings) {
120
+ if (binding.kind !== "namespace")
121
+ continue;
122
+ if (!TYPL_REF_OPS.isAbsolute(binding.name))
123
+ continue;
124
+ if (hasNamespaceAncestor(i))
125
+ continue;
126
+ rootCandidates.push({
127
+ path: typlPathOf(binding.name),
128
+ blockIndex: i,
129
+ position: binding.position,
130
+ });
131
+ }
132
+ }
133
+ const rootCheck = checkSingleRoot(rootCandidates);
134
+ let rootPath;
135
+ if (rootCheck.ok) {
136
+ rootPath = rootCheck.root.path;
137
+ }
138
+ else if (rootCheck.reason === "multiple-roots") {
139
+ rootPath = rootCheck.roots[0].path;
140
+ for (let k = 1; k < rootCheck.roots.length; k++) {
141
+ const extra = rootCheck.roots[k];
142
+ emit("TYPL-012", { first: `$${rootPath}` }, extra.blockIndex, extra.position);
143
+ }
144
+ }
145
+ // "no-root" → rootPath stays undefined; not an error.
146
+ // basePathOfBlock[i] = the base path blocks[i] provides to its bullet
147
+ // subtree, or undefined. One base slot per block: a block with several
148
+ // namespace bindings keeps the last (bullet blocks hold a single
149
+ // declaration in practice).
150
+ const basePathOfBlock = blocks.map(() => undefined);
151
+ /**
152
+ * Scope chain for blocks[i], innermost-first, terminated by the root base.
153
+ * Which frames a block sees depends on its surface: a bullet block walks
154
+ * its bullet-ancestor bases; a table-row block contributes its `Table:`
155
+ * caption base (#724); fence/inline blocks have neither and see the root
156
+ * only. The frame kinds don't combine in practice — a table row carries no
157
+ * `bulletParent`, so a table nested inside a bullet-namespace subtree sees
158
+ * only its caption base + the root, not the enclosing bullet base (known
159
+ * limitation, #724). Built immutably per call.
160
+ */
161
+ const scopeFor = (i) => {
162
+ const chain = []; // innermost first
163
+ let p = blocks[i].bulletParent;
164
+ while (p !== undefined) {
165
+ const idx = bulletBlockIndex[p];
166
+ const base = basePathOfBlock[idx];
167
+ if (base !== undefined)
168
+ chain.push(base);
169
+ p = blocks[idx].bulletParent;
170
+ }
171
+ let scope = rootPath !== undefined
172
+ ? { base: rootPath }
173
+ : undefined;
174
+ for (let k = chain.length - 1; k >= 0; k--) {
175
+ scope = { base: chain[k], parent: scope };
176
+ }
177
+ // A table row resolves against its caption base first (#722 rule 3):
178
+ // innermost, above the bullet chain and the root.
179
+ const captionBase = blocks[i].captionBase;
180
+ if (captionBase !== undefined)
181
+ scope = { base: captionBase, parent: scope };
182
+ return scope;
183
+ };
184
+ // ── Pass B: establish bases ──────────────────────────────────────────
185
+ // Source order is parents-before-children (bullet extraction is
186
+ // depth-first), so an ancestor's base is always resolved before its
187
+ // descendants need it. A relative namespace resolves against its own
188
+ // chain (TYPL-010 when there is none). Extra roots (TYPL-012 in Pass A)
189
+ // establish no base.
190
+ for (let i = 0; i < blocks.length; i++) {
191
+ for (const binding of blocks[i].bindings) {
192
+ if (binding.kind !== "namespace")
193
+ continue;
194
+ if (TYPL_REF_OPS.isAbsolute(binding.name)) {
195
+ const path = typlPathOf(binding.name);
196
+ const isExtraRoot = !hasNamespaceAncestor(i) && path !== rootPath;
197
+ if (!isExtraRoot)
198
+ basePathOfBlock[i] = path;
199
+ continue;
200
+ }
201
+ const res = resolveRef(binding.name, scopeFor(i), TYPL_REF_OPS);
202
+ if (!res.ok) {
203
+ emit("TYPL-010", { name: binding.name }, i, binding.position);
204
+ continue;
205
+ }
206
+ basePathOfBlock[i] = typlPathOf(res.ref);
207
+ }
208
+ }
209
+ // ── Pass C: resolve every non-namespace binding to an absolute name ──
210
+ const allBindings = [];
211
+ const allTypedefs = [];
212
+ for (let i = 0; i < blocks.length; i++) {
213
+ const block = blocks[i];
214
+ for (const binding of block.bindings) {
215
+ if (binding.kind === "namespace")
216
+ continue; // scaffolding (D8)
217
+ const res = resolveRef(binding.name, scopeFor(i), TYPL_REF_OPS);
218
+ if (!res.ok) {
219
+ emit("TYPL-010", { name: binding.name }, i, binding.position);
220
+ continue;
221
+ }
222
+ allBindings.push(res.ref === binding.name ? binding : { ...binding, name: res.ref });
223
+ }
224
+ allTypedefs.push(...block.typedefs);
225
+ }
226
+ if (allBindings.length === 0 && allTypedefs.length === 0 &&
227
+ rootPath === undefined) {
228
+ return { diagnostics };
229
+ }
230
+ return {
231
+ types: {
232
+ bindings: allBindings,
233
+ typedefs: allTypedefs,
234
+ ...(rootPath !== undefined ? { rootNamespace: rootPath } : {}),
235
+ },
236
+ diagnostics,
237
+ };
238
+ }
package/esm/typl/ast.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * Closed kind vocabulary. `value` is the default kind when an author omits
9
9
  * it from a binding.
10
10
  */
11
- export declare const KINDS: readonly ["value", "event", "signal", "command", "state", "const", "config", "document", "stream"];
11
+ export declare const KINDS: readonly ["value", "event", "signal", "command", "state", "const", "config", "document", "stream", "namespace"];
12
12
  export type Kind = typeof KINDS[number];
13
13
  /** Schema AST — one discriminated union covering all shape variants. */
14
14
  export type Shape = {
@@ -83,5 +83,11 @@ export type Statement = Binding | Typedef;
83
83
  export interface TyplBlock {
84
84
  readonly bindings: readonly Binding[];
85
85
  readonly typedefs: readonly Typedef[];
86
+ /**
87
+ * The entry's root namespace path (no `$`, e.g. `"powertrain.brake"`),
88
+ * when the entry declares one (#723). The validator resolves relative
89
+ * citations against it.
90
+ */
91
+ readonly rootNamespace?: string;
86
92
  }
87
93
  //# sourceMappingURL=ast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/typl/ast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,KAAK,oGAUR,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AAExC,wEAAwE;AACxE,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;CAAE,GAC1E;IACA,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,GAAG,CAAC,EAAE,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