@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
@@ -13,15 +13,16 @@ import { MARKDOWN_EXTENSIONS } from "../discovery/mod.js";
13
13
  import { ATTR_LINE_RE } from "../parser/attributes.js";
14
14
  import { extractFrontMatter } from "../parser/frontmatter.js";
15
15
  import { parseMarkdown } from "../parser/markdown.js";
16
- import { FENCE_RE, walkProseLines } from "../util/fence.js";
16
+ import { fencedCodeLines } from "../util/fence.js";
17
17
  import { applyLineEnding, detectLineEnding, normalizeLineEndings, } from "../util/line_endings.js";
18
- import { EARS_KEYWORD_RE, isSentenceInitial as _isSentenceInitial, RFC2119_MODAL_RE, } from "../util/modals.js";
18
+ import { isSentenceInitial as _isSentenceInitial, normalizeProseModals, } from "../util/modals.js";
19
19
  import { synthesizedUlid } from "./synth_ulid.js";
20
20
  import { buildBodyAst } from "../ast/build.js";
21
21
  import { render as renderBodyAst } from "../ast/render.js";
22
22
  import { normalizeBodyAst } from "../ast/normalize.js";
23
23
  import { astEquivalent } from "../ast/equivalence.js";
24
24
  import { formatProseSegments } from "./prose.js";
25
+ import { contentColumn } from "./entry_body.js";
25
26
  import { MARKSPEC_MARKDOWN_GLOBAL_CONFIG, } from "./dprint.js";
26
27
  import { markdownSemanticallyEquivalent } from "./md_equiv.js";
27
28
  /**
@@ -43,7 +44,7 @@ export function isSentenceInitial(line, offset) {
43
44
  *
44
45
  * The pass skips:
45
46
  *
46
- * - Fenced code blocks (between paired ``` or ~~~ markers) — code is
47
+ * - CommonMark fenced code blocks and inline-code spans — code is
47
48
  * verbatim per round-trip invariants (spec §5.1).
48
49
  * - Lines indented by four or more spaces (or a tab) — conservatively
49
50
  * captures indented code blocks and attribute trailers, both of which
@@ -52,21 +53,12 @@ export function isSentenceInitial(line, offset) {
52
53
  * @remarks Not called by `format()` as of SP3 Task 5 — body modal
53
54
  * normalization moved to `normalizeBodyAst` in the AST pass (spec-correct
54
55
  * verbatim-boundary handling). Retained as an exported symbol because
55
- * `mod_test.ts` tests it directly and `core/ast/normalize.ts` documents
56
- * the intentional duplication until a follow-up collapses the two. Do NOT
56
+ * `mod_test.ts` tests it directly. Both entry points delegate to the same
57
+ * AST-backed prose normalizer. Do NOT
57
58
  * delete — external callers may depend on this export.
58
59
  */
59
60
  export function normalizeModalKeywords(markdown) {
60
- const lines = markdown.split("\n");
61
- walkProseLines(markdown, (line, i) => {
62
- // Indented-code / attribute-trailer lines aren't prose either.
63
- if (/^( {4}|\t)/.test(line))
64
- return;
65
- let normalized = line.replace(RFC2119_MODAL_RE, (m) => m.toLowerCase());
66
- normalized = normalized.replace(EARS_KEYWORD_RE, (m, _g1, offset) => isSentenceInitial(normalized, offset) ? m : m.toLowerCase());
67
- lines[i] = normalized;
68
- });
69
- return lines.join("\n");
61
+ return normalizeProseModals(markdown);
70
62
  }
71
63
  /**
72
64
  * Canonical front-matter key order per ADR-007. Core keys first, then
@@ -219,16 +211,19 @@ function emitBodyViaAst(lines, file, diagnostics, cachedEntries, proseFormat) {
219
211
  for (const entry of sorted) {
220
212
  if (!entry.body.trim())
221
213
  continue; // empty or whitespace-only body
222
- const indent = (entry.location.column - 1) + 2; // marker column (0-based) + 2 spaces = list-item continuation indent
214
+ // List-item continuation indent: the item's content column, which
215
+ // follows every space after the marker (#865).
216
+ const indent = contentColumn(lines[entry.location.line - 1] ?? "", entry.location.column - 1);
223
217
  const indentStr = " ".repeat(indent);
224
218
  const titleLineIdx = entry.location.line - 1; // 0-based
225
219
  // Locate the body segment in `lines` — between the title line and
226
220
  // the attr block start (or item end when there is no attr block).
227
- const range = findAttributeBlockRange(lines, entry.location.line, indent);
221
+ const itemEndFloor = entry.endLine ?? 0;
222
+ const range = findAttributeBlockRange(lines, entry.location.line, indent, itemEndFloor);
228
223
  const bodyStart = titleLineIdx + 1;
229
224
  const bodyEnd = range
230
225
  ? range.start
231
- : findItemEnd(lines, titleLineIdx, indent);
226
+ : findItemEnd(lines, titleLineIdx, indent, itemEndFloor);
232
227
  if (bodyEnd <= bodyStart)
233
228
  continue; // no body lines to replace
234
229
  // Route the body through the canonical AST: build → normalize
@@ -386,13 +381,16 @@ export function format(markdown, options) {
386
381
  // `normalizeBodyAst` (more spec-correct: respects §2.5 verbatim
387
382
  // boundaries and per-node sentence-initial context). `normalizeModalKeywords`
388
383
  // stays exported/defined for other callers/tests but is not invoked here.
389
- const body = rawBody;
390
- const { entries } = parseMarkdown(body, { file });
391
384
  const diagnostics = [...fm.diagnostics];
385
+ // Drop empty-valued trailer lines (`Id:`, `Satisfies:`) before the main
386
+ // pass; left in place they demote the whole trailer block to body code.
387
+ const repaired = removeEmptyTrailerLines(rawBody, parseMarkdown(rawBody, { file }).entries, diagnostics);
388
+ const body = repaired ?? rawBody;
389
+ const { entries } = parseMarkdown(body, { file });
392
390
  // ADR-029: the whole-document Markdown pass is Markdown-only. Gate on the
393
391
  // file extension HERE so the invariant has one home — a caller that wires
394
- // formatMarkdownProse without its own guard (e.g. a future write tool, or
395
- // formatSource forwarding options with a source-file label) cannot silently
392
+ // formatMarkdownProse without its own guard (e.g. a future write tool
393
+ // forwarding options with a source-file label) cannot silently
396
394
  // reflow a source file's doc comment as Markdown. The CommonMark-semantic
397
395
  // gate cannot catch that class, so it must be prevented, not detected. The
398
396
  // CLI/LSP call-site guards remain as defense-in-depth.
@@ -405,12 +403,19 @@ export function format(markdown, options) {
405
403
  return { output: markdown, diagnostics, changed: false };
406
404
  }
407
405
  const lines = body.split("\n");
408
- let changed = false;
406
+ let changed = repaired !== undefined;
409
407
  // Process bottom-to-top so line splicing doesn't shift earlier entries.
410
408
  const sorted = [...entries].sort((a, b) => b.location.line - a.location.line);
411
409
  const genUlid = options?.generateUlid ?? defaultUlid;
412
410
  for (const entry of sorted) {
413
- const indent = (entry.location.column - 1) + 2;
411
+ const indent = contentColumn(lines[entry.location.line - 1] ?? "", entry.location.column - 1);
412
+ // `entry.endLine` comes from the parse of the unedited buffer. Entries
413
+ // are processed bottom to top, so only this entry's own edits move its
414
+ // end; the change in line count since here measures them.
415
+ const lengthAtStart = lines.length;
416
+ const itemEndFloor = () => entry.endLine === undefined
417
+ ? 0
418
+ : entry.endLine + (lines.length - lengthAtStart);
414
419
  let attrs = [...entry.rawAttributes];
415
420
  const titleLineIdx = entry.location.line - 1;
416
421
  // #686: a title that soft-wraps onto extra physical lines is a single
@@ -425,7 +430,7 @@ export function format(markdown, options) {
425
430
  // attribute block so a malformed entry with no blank line before its
426
431
  // trailer cannot swallow it.
427
432
  if (titleLineIdx >= 0 && titleLineIdx < lines.length) {
428
- const attrRange = findAttributeBlockRange(lines, entry.location.line, indent);
433
+ const attrRange = findAttributeBlockRange(lines, entry.location.line, indent, itemEndFloor());
429
434
  const limit = attrRange ? attrRange.start : lines.length;
430
435
  let titleEnd = titleLineIdx;
431
436
  while (titleEnd + 1 < limit && lines[titleEnd + 1].trim() !== "") {
@@ -507,7 +512,7 @@ export function format(markdown, options) {
507
512
  if (attrs.length === 0)
508
513
  continue;
509
514
  const normalized = sortAttributes(expandCsvValues(attrs));
510
- const range = findAttributeBlockRange(lines, entry.location.line, indent);
515
+ const range = findAttributeBlockRange(lines, entry.location.line, indent, itemEndFloor());
511
516
  if (range) {
512
517
  // Replace existing attribute block.
513
518
  const newBlock = renderAttributeBlock(normalized, indent);
@@ -519,7 +524,7 @@ export function format(markdown, options) {
519
524
  }
520
525
  else {
521
526
  // No attribute block — insert one after the entry body.
522
- const insertLine = findEntryBodyEnd(lines, entry, indent);
527
+ const insertLine = findEntryBodyEnd(lines, entry, indent, itemEndFloor());
523
528
  const newBlock = renderAttributeBlock(normalized, indent);
524
529
  lines.splice(insertLine, 0, "", ...newBlock.split("\n"));
525
530
  changed = true;
@@ -560,8 +565,11 @@ export function format(markdown, options) {
560
565
  : entries;
561
566
  const extents = proseEntries.map((e) => {
562
567
  const start = e.location.line - 1;
563
- const entryIndent = (e.location.column - 1) + 2;
564
- return { start, end: findItemEnd(collapsedLines, start, entryIndent) };
568
+ const entryIndent = contentColumn(collapsedLines[start] ?? "", e.location.column - 1);
569
+ return {
570
+ start,
571
+ end: findItemEnd(collapsedLines, start, entryIndent, e.endLine ?? 0),
572
+ };
565
573
  });
566
574
  const prose = formatProseSegments(collapsedLines, extents, proseFormat);
567
575
  if (prose.changed)
@@ -626,16 +634,10 @@ function renderFrontMatter(attrs) {
626
634
  */
627
635
  function collapseBlankLines(lines) {
628
636
  const out = [];
629
- let inFence = false;
637
+ const fencedLines = fencedCodeLines(lines.join("\n"));
630
638
  let prevBlank = false;
631
- for (const line of lines) {
632
- if (FENCE_RE.test(line)) {
633
- out.push(line);
634
- inFence = !inFence;
635
- prevBlank = false;
636
- continue;
637
- }
638
- if (inFence) {
639
+ for (const [i, line] of lines.entries()) {
640
+ if (fencedLines.has(i)) {
639
641
  out.push(line);
640
642
  prevBlank = false;
641
643
  continue;
@@ -732,8 +734,8 @@ export function sortAttributes(attributes) {
732
734
  * no trailing line-continuation characters.
733
735
  *
734
736
  * @param attributes - The attributes to render, in canonical order.
735
- * @param indent - Body indent for the entry (2 for list-wrapped entries,
736
- * 0 for entries inside source-file doc comments).
737
+ * @param indent - The 0-based list item content column, or 0 inside
738
+ * source-file doc comments.
737
739
  */
738
740
  export function renderAttributeBlock(attributes, indent) {
739
741
  const prefix = " ".repeat(indent + 4);
@@ -744,18 +746,26 @@ export function renderAttributeBlock(attributes, indent) {
744
746
  /**
745
747
  * Find the 0-based line index where a list item's content ends.
746
748
  * Exported for the ADR-029 prose pass (entry-extent computation).
747
- * Scans forward from the entry start, stopping at: a sibling list item
748
- * (`- ` at the entry's marker column), a line with less indent, or EOF.
749
+ * Scans forward from the later of the line after the entry start and
750
+ * `itemEndFloor` until a line has less indent than the content column, a
751
+ * conventional sibling marker is found, or EOF. Pass the parser's
752
+ * `Entry.endLine` as `itemEndFloor` so that a lazy continuation line
753
+ * inside the item does not end the scan early; the default `0` keeps
754
+ * the indentation-only scan.
749
755
  */
750
- export function findItemEnd(lines, startIdx, indent) {
756
+ export function findItemEnd(lines, startIdx, indent, itemEndFloor = 0) {
751
757
  const indentStr = " ".repeat(indent);
752
- // The marker column is indent - 2 (e.g., indent 2 → marker at column 0).
758
+ // Recognize sibling bullets with one space after the marker.
753
759
  const markerPrefix = " ".repeat(Math.max(0, indent - 2)) + "- ";
754
- for (let i = startIdx + 1; i < lines.length; i++) {
760
+ // `itemEndFloor` is the 0-based index just after the item's last content
761
+ // line, from the parser's `Entry.endLine`. The scan starts there, because
762
+ // an indentation scan ends the item early at a lazy continuation line
763
+ // (a paragraph line indented less than the item content).
764
+ for (let i = Math.max(startIdx + 1, itemEndFloor); i < lines.length; i++) {
755
765
  const line = lines[i];
756
766
  if (line.trim() === "")
757
767
  continue;
758
- // Sibling list item at same level
768
+ // Sibling with a one-space marker; wider markers use the indent check.
759
769
  if (line.startsWith(markerPrefix))
760
770
  return i;
761
771
  // Line with less indent than continuation
@@ -764,6 +774,72 @@ export function findItemEnd(lines, startIdx, indent) {
764
774
  }
765
775
  return lines.length;
766
776
  }
777
+ /** A trailer-shaped line whose value may be empty: `Key:` or `Key: value`. */
778
+ const TRAILER_SHAPED_RE = /^[A-Z][A-Za-z-]*:(?:\s.*)?$/;
779
+ /** A trailer-shaped line with no value: `Key:` (spec §2 makes it MSL-P021). */
780
+ const EMPTY_TRAILER_RE = /^([A-Z][A-Za-z-]*):\s*$/;
781
+ /**
782
+ * Remove empty-valued `Key:` lines from each entry's trailing trailer block.
783
+ *
784
+ * An empty-valued line is not a valid trailer (spec §2, MSL-P021), so the
785
+ * parser treats the whole trailing block as body code. Left alone, the
786
+ * main pass would fence that block and append a fresh `Id:`, silently
787
+ * turning real trace links into inert body text. An empty value carries no
788
+ * information, so dropping the line is lossless: an `Id:` placeholder then
789
+ * gets stamped in place and the remaining trailers stay trailers.
790
+ *
791
+ * Only touches a block of contiguous lines at the very end of an entry,
792
+ * indented at least four columns past the entry body, in which every line
793
+ * is trailer-shaped. Emits one MSL-F001 info diagnostic per removed line.
794
+ *
795
+ * @returns The repaired text, or `undefined` when nothing was removed.
796
+ */
797
+ function removeEmptyTrailerLines(body, entries, diagnostics) {
798
+ const lines = body.split("\n");
799
+ let removedAny = false;
800
+ const sorted = [...entries].sort((a, b) => b.location.line - a.location.line);
801
+ for (const entry of sorted) {
802
+ const indent = contentColumn(lines[entry.location.line - 1] ?? "", entry.location.column - 1);
803
+ const startIdx = entry.location.line - 1;
804
+ let end = findItemEnd(lines, startIdx, indent, entry.endLine ?? 0);
805
+ while (end > startIdx && lines[end - 1].trim() === "")
806
+ end--;
807
+ let start = end;
808
+ while (start - 1 > startIdx && lines[start - 1].trim() !== "")
809
+ start--;
810
+ if (start >= end || start - 1 <= startIdx)
811
+ continue;
812
+ const trailerIndent = " ".repeat(indent + 4);
813
+ const block = lines.slice(start, end);
814
+ const isTrailerBlock = block.every((l) => l.startsWith(trailerIndent) && TRAILER_SHAPED_RE.test(l.trim()));
815
+ if (!isTrailerBlock)
816
+ continue;
817
+ const kept = block.filter((l) => !EMPTY_TRAILER_RE.test(l.trim()));
818
+ if (kept.length === block.length)
819
+ continue;
820
+ for (const l of block) {
821
+ const key = EMPTY_TRAILER_RE.exec(l.trim())?.[1];
822
+ if (key === undefined)
823
+ continue;
824
+ diagnostics.push({
825
+ code: "MSL-F001",
826
+ severity: "info",
827
+ message: `removed empty '${key}:' trailer line from ${entry.displayId}`,
828
+ location: entry.location,
829
+ });
830
+ }
831
+ if (kept.length > 0) {
832
+ lines.splice(start, end - start, ...kept);
833
+ }
834
+ else {
835
+ // Whole block was placeholders: drop it and its leading blank line.
836
+ const from = lines[start - 1].trim() === "" ? start - 1 : start;
837
+ lines.splice(from, end - from);
838
+ }
839
+ removedAny = true;
840
+ }
841
+ return removedAny ? lines.join("\n") : undefined;
842
+ }
767
843
  /**
768
844
  * Find the 0-based line range [start, end) of the attribute block
769
845
  * for an entry starting at the given line.
@@ -771,9 +847,9 @@ export function findItemEnd(lines, startIdx, indent) {
771
847
  * Scans forward from the entry start to find the list item boundary,
772
848
  * then walks backwards to find the contiguous trailing attribute block.
773
849
  */
774
- export function findAttributeBlockRange(lines, entryStartLine, indent) {
850
+ export function findAttributeBlockRange(lines, entryStartLine, indent, itemEndFloor = 0) {
775
851
  const startIdx = entryStartLine - 1;
776
- const itemEnd = findItemEnd(lines, startIdx, indent);
852
+ const itemEnd = findItemEnd(lines, startIdx, indent, itemEndFloor);
777
853
  // Walk backwards from itemEnd, skip trailing blank lines.
778
854
  let scanEnd = itemEnd;
779
855
  while (scanEnd > startIdx && lines[scanEnd - 1].trim() === "") {
@@ -802,9 +878,9 @@ export function findAttributeBlockRange(lines, entryStartLine, indent) {
802
878
  * Find the 0-based line index where a new attribute block should be inserted
803
879
  * (after the last non-blank body line of the entry).
804
880
  */
805
- function findEntryBodyEnd(lines, entry, indent) {
881
+ function findEntryBodyEnd(lines, entry, indent, itemEndFloor = 0) {
806
882
  const startIdx = entry.location.line - 1;
807
- const itemEnd = findItemEnd(lines, startIdx, indent);
883
+ const itemEnd = findItemEnd(lines, startIdx, indent, itemEndFloor);
808
884
  let insertAt = itemEnd;
809
885
  while (insertAt > startIdx && lines[insertAt - 1].trim() === "") {
810
886
  insertAt--;
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
21
21
  import type { ProseFormatter } from "../formatter/dprint.js";
22
- import { type LockEdge, type ParseLockfileResult } from "../lock/mod.js";
22
+ import { type LockEdge, type ParseLockfileResult, type ReadFile as LockReadFile } from "../lock/mod.js";
23
23
  /**
24
24
  * Format-drift gate — the `MSL-F010` (formatter drift) and `MSL-F011`
25
25
  * (reference-canonicalization drift) findings.
@@ -57,12 +57,23 @@ export declare function fmtDriftGate(mdContents: ReadonlyMap<string, string>, en
57
57
  * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
58
58
  * mirroring `markspec lock`.
59
59
  *
60
+ * Also carries the MSL-L212 offline cache-drift case (Task 9): when `cache`
61
+ * is supplied and the lockfile parsed, every snapshot-carrying upstream row
62
+ * is verified against its on-disk cache under `cache.cacheRoot` and any
63
+ * cache-drift diagnostics are appended to the edge-drift result. Offline by
64
+ * design, like the edge-drift check — no network fetch.
65
+ *
60
66
  * @param lockParse The parsed `markspec.lock` (already read from disk).
61
67
  * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
62
68
  * location so JSON consumers that group by `location.file` keep the finding.
63
69
  * @param entries The full parsed entry set; corpus entries are filtered out.
70
+ * @param cache Optional upstream cache-verification inputs. Omitted →
71
+ * backward-compatible with callers that only want the edge-drift case.
64
72
  */
65
- export declare function lockfileDriftGate(lockParse: ParseLockfileResult, lockPath: string, entries: readonly Entry[]): Promise<Diagnostic[]>;
73
+ export declare function lockfileDriftGate(lockParse: ParseLockfileResult, lockPath: string, entries: readonly Entry[], cache?: {
74
+ readonly cacheRoot: string;
75
+ readonly readFile: LockReadFile;
76
+ }): Promise<Diagnostic[]>;
66
77
  /**
67
78
  * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
68
79
  * plain {@linkcode Diagnostic}s.
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/gates/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,mBAAmB,EAAE,cAAc,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAuCvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC,CAiBvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,EAAE,CAAC,CAQvB"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/gates/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,QAAQ,IAAI,YAAY,EAE9B,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,mBAAmB,EAAE,cAAc,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAwCvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACtE,OAAO,CAAC,UAAU,EAAE,CAAC,CAuCvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,EAAE,CAAC,CAQvB"}
package/esm/gates/mod.js CHANGED
@@ -17,10 +17,11 @@
17
17
  * `parser`, `refs`, `lock`, and `lint`, and nothing in those depends back on
18
18
  * it — no cycle.
19
19
  */
20
+ import { isCorpusEntry } from "../model/mod.js";
20
21
  import { format } from "../formatter/mod.js";
21
22
  import { parseFile } from "../parser/mod.js";
22
23
  import { buildRefIndex, canonicalizeRefs } from "../refs/mod.js";
23
- import { detectOfflineEdgeDrift, } from "../lock/mod.js";
24
+ import { detectOfflineEdgeDrift, formatEdgeDriftMessage, verifyUpstreamCache, } from "../lock/mod.js";
24
25
  import { runLint } from "../lint/mod.js";
25
26
  /**
26
27
  * Format-drift gate — the `MSL-F010` (formatter drift) and `MSL-F011`
@@ -50,8 +51,9 @@ export async function fmtDriftGate(mdContents, entries, ledger, formatMarkdownPr
50
51
  // Building the heal index over the full set (including corpus) would flag an
51
52
  // MSL-F011 drift that `fmt` can never fix — a permanently red gate for any
52
53
  // consumer using a delivered corpus. Filter to `!e.origin`, mirroring
53
- // lockfileDriftGate.
54
- const refIndex = buildRefIndex(entries.filter((e) => !e.origin));
54
+ // lockfileDriftGate — deliberately BROADER than the validators'
55
+ // `emittableEntries` (upstream-only, #771); do not "unify" it.
56
+ const refIndex = buildRefIndex(entries.filter((e) => !isCorpusEntry(e)));
55
57
  for (const [filePath, content] of mdContents) {
56
58
  const formatted = format(content, {
57
59
  file: filePath,
@@ -93,25 +95,51 @@ export async function fmtDriftGate(mdContents, entries, ledger, formatMarkdownPr
93
95
  * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
94
96
  * mirroring `markspec lock`.
95
97
  *
98
+ * Also carries the MSL-L212 offline cache-drift case (Task 9): when `cache`
99
+ * is supplied and the lockfile parsed, every snapshot-carrying upstream row
100
+ * is verified against its on-disk cache under `cache.cacheRoot` and any
101
+ * cache-drift diagnostics are appended to the edge-drift result. Offline by
102
+ * design, like the edge-drift check — no network fetch.
103
+ *
96
104
  * @param lockParse The parsed `markspec.lock` (already read from disk).
97
105
  * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
98
106
  * location so JSON consumers that group by `location.file` keep the finding.
99
107
  * @param entries The full parsed entry set; corpus entries are filtered out.
108
+ * @param cache Optional upstream cache-verification inputs. Omitted →
109
+ * backward-compatible with callers that only want the edge-drift case.
100
110
  */
101
- export async function lockfileDriftGate(lockParse, lockPath, entries) {
111
+ export async function lockfileDriftGate(lockParse, lockPath, entries, cache) {
102
112
  if (!lockParse.lockfile) {
103
113
  return [...lockParse.diagnostics];
104
114
  }
105
- const projectEntries = entries.filter((e) => !e.origin);
115
+ // `!e.origin` (project-owned only) — deliberately BROADER than the
116
+ // validators' `emittableEntries` partition (upstream-only, #771): the
117
+ // edge ledger records only edges the project authors.
118
+ const projectEntries = entries.filter((e) => !isCorpusEntry(e));
106
119
  const drift = await detectOfflineEdgeDrift(projectEntries, lockParse.lockfile.generatedCache);
107
- if (!drift.drifted)
108
- return [];
109
- return [{
110
- code: "MSL-L212",
111
- severity: "error",
112
- message: `traceability edges drifted from markspec.lock: locked ${drift.lockedCount} edge(s), current ${drift.currentCount} — run \`markspec lock\` to refresh. (After upgrading MarkSpec this can also fire once because traceability inputs now include source-file doc comments; re-running \`markspec lock\` clears it.)`,
113
- location: { file: lockPath, line: 1, column: 1 },
114
- }];
120
+ const diagnostics = drift.drifted
121
+ ? [{
122
+ code: "MSL-L212",
123
+ severity: "error",
124
+ message: formatEdgeDriftMessage(drift.lockedCount, drift.currentCount),
125
+ location: { file: lockPath, line: 1, column: 1 },
126
+ }]
127
+ : [];
128
+ if (cache !== undefined) {
129
+ const cacheDiags = await verifyUpstreamCache(lockParse.lockfile.upstreams, cache.cacheRoot, cache.readFile);
130
+ // verifyUpstreamCache is a reusable, lockfile-path-agnostic probe and
131
+ // emits `location: undefined` (see cache_check.ts). Stamp the same
132
+ // lockfile location the sibling edge-drift MSL-L212 above uses, so both
133
+ // findings from the same `markspec.lock` group under one file for a
134
+ // JSON consumer keyed on `location.file`.
135
+ for (const d of cacheDiags) {
136
+ diagnostics.push({
137
+ ...d,
138
+ location: { file: lockPath, line: 1, column: 1 },
139
+ });
140
+ }
141
+ }
142
+ return diagnostics;
115
143
  }
116
144
  /**
117
145
  * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAKT;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA0FvE"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAKT;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA+FvE"}
@@ -6,7 +6,7 @@
6
6
  * suppression hygiene on all Authored entries, applies suppression, and
7
7
  * returns the final diagnostics.
8
8
  */
9
- import { CORE_TYPE_HIERARCHY } from "../model/mod.js";
9
+ import { CORE_TYPE_HIERARCHY, isCorpusEntry } from "../model/mod.js";
10
10
  import { resolvedCoreType } from "../validator/type_resolution.js";
11
11
  import { runLexiconRules } from "./rules/lexicon.js";
12
12
  import { runStructRules } from "./rules/struct.js";
@@ -116,10 +116,12 @@ export async function runLint(options) {
116
116
  // Steps 1–9: collect diagnostics keyed by entry. Delivered-corpus entries
117
117
  // (`entry.origin`) are excluded from rule execution — a consumer cannot fix
118
118
  // upstream prose (ADR-030 §D4) — even though they contribute to the indexes
119
- // above.
119
+ // above. Deliberately BROADER than the validators' `emittableEntries`
120
+ // partition (upstream-only, #771): profile corpus stays structurally
121
+ // validated but is never prose-linted — do not "unify" this filter.
120
122
  const inScopeDiags = new Map();
121
123
  for (const entry of entries) {
122
- if (entry.origin)
124
+ if (isCorpusEntry(entry))
123
125
  continue;
124
126
  if (!isProseScope(entry, profile))
125
127
  continue;
@@ -147,7 +149,7 @@ export async function runLint(options) {
147
149
  for (const entry of entries) {
148
150
  if (entry.shape !== "Authored")
149
151
  continue;
150
- if (entry.origin)
152
+ if (isCorpusEntry(entry))
151
153
  continue;
152
154
  hygieneDiags.push(...runSuppressionRules(entry));
153
155
  }
@@ -182,6 +184,6 @@ export async function runLint(options) {
182
184
  // ones). Corpus entries are excluded — counting them would skew band-counts
183
185
  // and the mean on prose a consumer cannot act on (ADR-030 §D4). A no-op when
184
186
  // no corpus is present.
185
- const score = computeScoreRollup(out, entries.filter((e) => !e.origin));
187
+ const score = computeScoreRollup(out, entries.filter((e) => !isCorpusEntry(e)));
186
188
  return { diagnostics: out, score };
187
189
  }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module core/lock/acquire_compile
3
+ *
4
+ * Deterministic in-process compile of an acquired dependency tree
5
+ * (design §4.3). Produces the same `manifest.json` + `compiled.json` layout
6
+ * a published `references:` site serves, so `loadUpstreamCorpus` /
7
+ * `probeCacheSnapshot` read a dependency snapshot identically to a reference
8
+ * snapshot. The output is byte-reproducible from (tree, markspec version):
9
+ * files are compiled in sorted, tree-relative order with no stat/git IO, so
10
+ * `entry.location.file`, `properties.file.path`, and entry ordering are all
11
+ * stable. Pure — every file touch flows through {@linkcode AcquireCompileIO}.
12
+ */
13
+ import { type ManifestJson } from "../compiler/manifest.js";
14
+ import { type DiscoveryIO } from "../discovery/mod.js";
15
+ export interface AcquireCompileIO {
16
+ /** Config/profile reader — returns text or undefined (core `ReadFile`). */
17
+ readonly readFile: (path: string) => Promise<string | undefined>;
18
+ /** Throwing reader compile() consumes (`(path) => Promise<string>`). */
19
+ readonly readText: (path: string) => Promise<string>;
20
+ /** Discovery seam (`{ readDir, readFile }`) — same as `denoDiscoveryIO()`. */
21
+ readonly discovery: DiscoveryIO;
22
+ }
23
+ export interface CompiledSnapshot {
24
+ readonly manifestJson: ManifestJson;
25
+ readonly compiledBytes: Uint8Array;
26
+ readonly snapshot: string;
27
+ }
28
+ export declare function compileAcquiredTree(treeRoot: string, io: AcquireCompileIO, release: string): Promise<CompiledSnapshot | {
29
+ error: string;
30
+ }>;
31
+ //# sourceMappingURL=acquire_compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acquire_compile.d.ts","sourceRoot":"","sources":["../../src/lock/acquire_compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK3E,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtE,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjE,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,gBAAgB,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA0E/C"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @module core/lock/acquire_compile
3
+ *
4
+ * Deterministic in-process compile of an acquired dependency tree
5
+ * (design §4.3). Produces the same `manifest.json` + `compiled.json` layout
6
+ * a published `references:` site serves, so `loadUpstreamCorpus` /
7
+ * `probeCacheSnapshot` read a dependency snapshot identically to a reference
8
+ * snapshot. The output is byte-reproducible from (tree, markspec version):
9
+ * files are compiled in sorted, tree-relative order with no stat/git IO, so
10
+ * `entry.location.file`, `properties.file.path`, and entry ordering are all
11
+ * stable. Pure — every file touch flows through {@linkcode AcquireCompileIO}.
12
+ */
13
+ import { join, relative } from "@std/path";
14
+ import { compile } from "../compiler/mod.js";
15
+ import { buildManifest } from "../compiler/manifest.js";
16
+ import { serializeCompileResult } from "../compiler/schema.js";
17
+ import { loadConfig } from "../config/mod.js";
18
+ import { loadToolConfig } from "../config/markspec.js";
19
+ import { loadProfileForCommand } from "../profile/load.js";
20
+ import { discoverFiles } from "../discovery/mod.js";
21
+ import { sha256Bytes } from "./hash.js";
22
+ export async function compileAcquiredTree(treeRoot, io, release) {
23
+ // Memoize by path: loadConfig, loadProfileForCommand, and loadToolConfig
24
+ // each walk + read the same project.yaml/.markspec.yaml, so cache the
25
+ // in-flight promise per path to read each file exactly once per acquired
26
+ // tree. The tree is immutable (just fetched at a fixed sha), so a
27
+ // per-call cache is sound and deterministic.
28
+ const readCache = new Map();
29
+ const readFile = (path) => {
30
+ let pending = readCache.get(path);
31
+ if (pending === undefined) {
32
+ pending = io.readFile(path);
33
+ readCache.set(path, pending);
34
+ }
35
+ return pending;
36
+ };
37
+ const configResult = await loadConfig(treeRoot, readFile);
38
+ if (!configResult) {
39
+ return { error: "dependency tree has no discoverable project.yaml" };
40
+ }
41
+ const profileResult = await loadProfileForCommand(treeRoot, readFile);
42
+ const profile = profileResult.chain?.effective;
43
+ const toolConfig = await loadToolConfig(treeRoot, readFile);
44
+ // Discover → relativize → normalize to POSIX separators → sort. The
45
+ // `\\`→`/` normalization is load-bearing for cross-machine determinism:
46
+ // `relative()` yields OS-native separators, so a Windows host would emit
47
+ // `docs\reqs.md` while POSIX emits `docs/reqs.md`, giving two different
48
+ // `location.file`/`properties.file.path` values → two different snapshot
49
+ // hashes for the same source → spurious MSL-L212 drift between a Windows
50
+ // and a macOS/Linux developer sharing one lockfile. Normalizing before
51
+ // the sort also makes the entry order (hence JSON key order) identical
52
+ // on every platform.
53
+ const abs = [];
54
+ for await (const f of discoverFiles(treeRoot, io.discovery, {
55
+ exclude: toolConfig.config.exclude,
56
+ })) {
57
+ abs.push(f);
58
+ }
59
+ const rel = abs
60
+ .map((p) => relative(treeRoot, p).replaceAll("\\", "/"))
61
+ .sort();
62
+ // Compile with a root-resolving reader and NO stat/git callbacks →
63
+ // deterministic properties (no mtime, no contributors, relative path).
64
+ const result = await compile(rel, {
65
+ readFile: (r) => io.readText(join(treeRoot, r)),
66
+ profile,
67
+ });
68
+ // `root` is cosmetic here — manifest.json is not hashed (only compiled.json
69
+ // is) and lives in the gitignored cache; pass "." so no temp path leaks.
70
+ const manifestJson = buildManifest(result, configResult.config, ".", profile, release, false);
71
+ // Compact (no whitespace) rather than the CLI's pretty-printed form —
72
+ // this cache file is machine-read only (loadUpstreamCorpus /
73
+ // probeCacheSnapshot JSON.parse it), and compact output keeps
74
+ // `entry.location.file`'s tree-relative path adjacent to its `"file":`
75
+ // key with no formatting-introduced variance to reason about.
76
+ const compiled = serializeCompileResult(result);
77
+ const compiledBytes = new TextEncoder().encode(JSON.stringify(compiled));
78
+ return {
79
+ manifestJson,
80
+ compiledBytes,
81
+ snapshot: await sha256Bytes(compiledBytes),
82
+ };
83
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @module core/lock/cache_check
3
+ *
4
+ * Offline upstream cache-integrity check — the MSL-L212 cache-drift case
5
+ * (Task 9). For every locked upstream row that carries a `snapshot` hash
6
+ * (a federated registry or git-repository dependency), verify its cache
7
+ * under `<cacheRoot>/<id>/` is still present and hash-intact.
8
+ *
9
+ * Reuses {@linkcode probeCacheSnapshot} — the exact probe
10
+ * `resolveProjectReferences`'s keep/restore flow already uses
11
+ * (`upstream_refs.ts`, Task 5) — so `markspec check` and `markspec lock`
12
+ * never disagree on what "cache intact" means. Rows without a `snapshot`
13
+ * (legacy registry rows predating this field, or upstream kinds that never
14
+ * carry one — reference, profile) are skipped: there is nothing to verify
15
+ * offline.
16
+ *
17
+ * Pure module: file access only via the injected {@linkcode ReadFile}.
18
+ */
19
+ import type { Diagnostic } from "../model/mod.js";
20
+ import type { Upstream } from "./model.js";
21
+ import type { ReadFile } from "./resolve.js";
22
+ /**
23
+ * Verify every snapshot-carrying upstream row's cache under `cacheRoot`.
24
+ * One `MSL-L212` diagnostic per row whose cache is missing or whose
25
+ * entries-file hash no longer matches the locked `snapshot`.
26
+ */
27
+ export declare function verifyUpstreamCache(upstreams: readonly Upstream[], cacheRoot: string, readFile: ReadFile): Promise<Diagnostic[]>;
28
+ //# sourceMappingURL=cache_check.d.ts.map