@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
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ /**
3
+ * @module formatter/entry_body
4
+ *
5
+ * Read and replace the body of one entry in a Markdown file text.
6
+ *
7
+ * Splice-only contract: {@linkcode replaceEntryBody} changes only the
8
+ * lines of the target entry's body. Every other line of the file (other
9
+ * entries, prose, front matter, the title, the trailer block, and each
10
+ * line's own line ending) stays byte-for-byte unchanged. After the splice
11
+ * the text is parsed again; when the set of entries differs (a new entry,
12
+ * a lost entry, a changed title or trailer) or the target's body is not
13
+ * the proposal, the edit is refused.
14
+ *
15
+ * The body range starts after the title paragraph (up to the first blank
16
+ * line after the title line, so a soft-wrapped title is skipped) and the
17
+ * blank lines after it. It has as many lines as the parser's
18
+ * `entry.body`, so lazy continuation lines are included, and it must
19
+ * match that body line for line. The body indent is the content column of
20
+ * the list item: the marker column, plus the marker width, plus the spaces
21
+ * after the marker. Lines are split on `\r\n`, a
22
+ * lone `\r`, or `\n`, as in the parser.
23
+ *
24
+ * Pure: no I/O, Node-compatible.
25
+ */
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.contentColumn = contentColumn;
28
+ exports.readEntryBody = readEntryBody;
29
+ exports.replaceEntryBody = replaceEntryBody;
30
+ const mod_js_1 = require("../parser/mod.js");
31
+ /**
32
+ * Split `text` into lines on `\r\n`, a lone `\r`, or `\n`, the same rule
33
+ * the parser uses to normalize line endings, so line indexes agree with
34
+ * parser line numbers. Each line keeps its own ending.
35
+ */
36
+ function splitText(text) {
37
+ const lines = [];
38
+ const endings = [];
39
+ const re = /\r\n|\r|\n/g;
40
+ let from = 0;
41
+ for (let m = re.exec(text); m !== null; m = re.exec(text)) {
42
+ lines.push(text.slice(from, m.index));
43
+ endings.push(m[0]);
44
+ from = m.index + m[0].length;
45
+ }
46
+ lines.push(text.slice(from));
47
+ endings.push("");
48
+ return { lines, endings };
49
+ }
50
+ /** Lines of `text` with trailing whitespace removed, for comparisons. */
51
+ function trimmedLines(text) {
52
+ return text.split("\n").map((l) => l.trimEnd());
53
+ }
54
+ /**
55
+ * Locate the body of `entry` in `lines`. `start === end` when the entry
56
+ * has no body.
57
+ *
58
+ * The body starts after the title paragraph and the blank lines that
59
+ * follow it. Its length is the line count of the parser's `entry.body`,
60
+ * so a lazy continuation line (a body line indented less than the body
61
+ * indent) is part of the span. `exact` is false when the dedented span,
62
+ * trimmed as a whole like the parser's body, does not match `entry.body`
63
+ * line for line (trailing whitespace ignored); the span is then not
64
+ * reliable and must not be edited.
65
+ */
66
+ function bodySpan(lines, entry) {
67
+ const titleIdx = entry.location.line - 1;
68
+ const indent = contentColumn(lines[titleIdx] ?? "", entry.location.column - 1);
69
+ const isBlank = (i) => lines[i].trim() === "";
70
+ let start = titleIdx + 1;
71
+ // Skip the rest of the title paragraph (a soft-wrapped title).
72
+ while (start < lines.length && !isBlank(start))
73
+ start++;
74
+ while (start < lines.length && isBlank(start))
75
+ start++;
76
+ if (entry.body === "")
77
+ return { start, end: start, indent, exact: true };
78
+ const expected = trimmedLines(entry.body);
79
+ const end = Math.min(start + expected.length, lines.length);
80
+ const actual = spanText(lines, { start, end, indent, exact: true });
81
+ // The parser trims its body as a whole, which drops the leading
82
+ // whitespace of the first line (an indented code block); trim the span
83
+ // the same way before comparing.
84
+ const exact = actual.join("\n").trim() === expected.join("\n");
85
+ return { start, end, indent, exact };
86
+ }
87
+ /**
88
+ * 0-based content column of the list item whose marker starts at `marker`
89
+ * on `line`: the marker column, plus 1 for the bullet, plus the spaces
90
+ * after it. So `- [ID]` gives the marker column plus 2 and `- [ID]` gives
91
+ * the marker column plus 4. Only a bullet followed by one to four spaces
92
+ * can start an entry: ordered lists never hold entries, and five or more
93
+ * spaces make the title an indented code block. When the line does not
94
+ * start with a bullet and a space at `marker`, the marker column plus 2 is
95
+ * used as a fallback.
96
+ */
97
+ function contentColumn(line, marker) {
98
+ const m = /^[-*+]( +)/.exec(line.slice(marker));
99
+ return m ? marker + 1 + m[1].length : marker + 2;
100
+ }
101
+ /** Dedented span lines, trailing whitespace removed. */
102
+ function spanText(lines, span) {
103
+ return lines.slice(span.start, span.end)
104
+ .map((l) => l.trim() === "" ? "" : dedent(l, span.indent).trimEnd());
105
+ }
106
+ /** Parse `text` and find the entry named `displayId`. */
107
+ async function locate(text, file, displayId) {
108
+ const { entries, diagnostics } = await (0, mod_js_1.parseFile)(text, { file });
109
+ const entry = entries.find((e) => e.displayId === displayId);
110
+ const trailerInvalid = diagnostics.some((d) => TRAILER_PARSE_CODES.has(d.code) && d.message.startsWith(`${displayId}:`));
111
+ return {
112
+ entries,
113
+ entry,
114
+ diagnosticCodes: diagnostics.map((d) => d.code),
115
+ trailerInvalid,
116
+ };
117
+ }
118
+ /** Parse codes that mean an entry's trailer block did not parse. */
119
+ const TRAILER_PARSE_CODES = new Set([
120
+ "MSL-P020",
121
+ "MSL-P021",
122
+ "MSL-P022",
123
+ ]);
124
+ /**
125
+ * Body of the entry `displayId` as written in `text`: dedented, LF line
126
+ * endings, no surrounding blank lines. Returns `""` when the entry has no
127
+ * body and `undefined` when no entry has `displayId`. `file` names a
128
+ * `.md` file. When the body lines cannot be located exactly in `text`,
129
+ * the parser's body is returned (and {@linkcode replaceEntryBody}
130
+ * refuses to edit that entry).
131
+ */
132
+ async function readEntryBody(text, file, displayId) {
133
+ const { entry } = await locate(text, file, displayId);
134
+ if (!entry)
135
+ return undefined;
136
+ const { lines } = splitText(text);
137
+ const span = bodySpan(lines, entry);
138
+ if (!span.exact)
139
+ return entry.body;
140
+ return lines.slice(span.start, span.end)
141
+ .map((l) => l.trim() === "" ? "" : dedent(l, span.indent))
142
+ .join("\n");
143
+ }
144
+ /** Remove up to `indent` leading spaces. */
145
+ function dedent(line, indent) {
146
+ let i = 0;
147
+ while (i < indent && line[i] === " ")
148
+ i++;
149
+ return line.slice(i);
150
+ }
151
+ /**
152
+ * Return `text` with the body of entry `displayId` replaced by `body`,
153
+ * re-indented to the body indent. Every other line stays byte-for-byte
154
+ * unchanged. Inserted lines take the line ending of the title line. In
155
+ * `body`, `\r\n` and a lone `\r` count as line breaks.
156
+ *
157
+ * Refusals: `entry-not-found` (no such entry), `trailer-invalid` (the
158
+ * entry's trailer block did not parse, see below), `body-empty` (the entry
159
+ * has no body), `proposal-empty` (`body` is blank), `entries-changed`
160
+ * (two entries in `text` have `displayId`; or the body lines cannot be
161
+ * located exactly in `text`; or the edited
162
+ * text no longer parses to the same entries, with the same title and
163
+ * trailer for the target, and with the proposal as the target's body;
164
+ * or the parse raises more structural diagnostics of some code, such as
165
+ * MSL-P020, than the original text).
166
+ *
167
+ * `trailer-invalid`: when a trailer line is malformed (for example an
168
+ * empty `Labels:`, a key without a colon, or a lowercase key), the parser
169
+ * reads the whole trailer block, the `Id:` line included, as body. A
170
+ * splice would then delete the `Id:` and trailer lines, and the identity
171
+ * check cannot see it, because the entry has no `id` and no attributes
172
+ * before or after the edit. So the edit is refused when an `MSL-P020`,
173
+ * `MSL-P021` or `MSL-P022` names the entry (the message starts with
174
+ * `<displayId>:`). This is broader than that case: `MSL-P020` also fires
175
+ * when a body paragraph starts with a recognized trailer key, so such an
176
+ * entry is refused too. The file already fails `markspec check` there.
177
+ * An entry whose trailer-looking lines use only unrecognized keys, and
178
+ * that the parser reads as body without a diagnostic, is edited as the
179
+ * parser sees it: those lines are body.
180
+ */
181
+ async function replaceEntryBody(text, file, displayId, body) {
182
+ const before = await locate(text, file, displayId);
183
+ const entry = before.entry;
184
+ if (!entry)
185
+ return { ok: false, refusal: "entry-not-found" };
186
+ if (before.trailerInvalid)
187
+ return { ok: false, refusal: "trailer-invalid" };
188
+ // Two entries with the same display ID make the target ambiguous (and
189
+ // `markspec check` already rejects the file), so do not edit either.
190
+ if (before.entries.filter((e) => e.displayId === displayId).length > 1) {
191
+ return { ok: false, refusal: "entries-changed" };
192
+ }
193
+ const { lines, endings } = splitText(text);
194
+ const span = bodySpan(lines, entry);
195
+ if (span.start === span.end)
196
+ return { ok: false, refusal: "body-empty" };
197
+ if (!span.exact)
198
+ return { ok: false, refusal: "entries-changed" };
199
+ const proposal = body.replace(/\r\n?/g, "\n").split("\n");
200
+ while (proposal.length > 0 && proposal[0].trim() === "")
201
+ proposal.shift();
202
+ while (proposal.length > 0 && proposal[proposal.length - 1].trim() === "") {
203
+ proposal.pop();
204
+ }
205
+ if (proposal.length === 0)
206
+ return { ok: false, refusal: "proposal-empty" };
207
+ const titleIdx = entry.location.line - 1;
208
+ const eol = endings[titleIdx];
209
+ const indentStr = " ".repeat(span.indent);
210
+ const inserted = proposal.map((l) => (l.trim() === "" ? "" : indentStr + l) + eol);
211
+ // The final line of the file has no ending after it; keep the old
212
+ // ending of the last body line when the body reaches the file end.
213
+ if (span.end === lines.length) {
214
+ const last = inserted.length - 1;
215
+ inserted[last] = indentStr + proposal[last] + endings[span.end - 1];
216
+ }
217
+ const keep = (from, to) => {
218
+ let out = "";
219
+ for (let i = from; i < to; i++)
220
+ out += lines[i] + endings[i];
221
+ return out;
222
+ };
223
+ const edited = keep(0, span.start) + inserted.join("") +
224
+ keep(span.end, lines.length);
225
+ const after = await locate(edited, file, displayId);
226
+ if (!sameEntries(before.entries, after.entries, entry, after.entry) ||
227
+ addsParseDiagnostic(before.diagnosticCodes, after.diagnosticCodes) ||
228
+ trimmedLines(after.entry?.body ?? "").join("\n") !==
229
+ proposal.map((l) => l.trimEnd()).join("\n").trim()) {
230
+ return { ok: false, refusal: "entries-changed" };
231
+ }
232
+ return { ok: true, text: edited };
233
+ }
234
+ /**
235
+ * Identity check: same entry count; per index, same display ID and Id;
236
+ * for the target, also the same title and the same trailer attributes.
237
+ * An unclosed fence or HTML block in the proposal (for example a final
238
+ * line of three backticks) can swallow the target's trailer without any
239
+ * parse diagnostic; this comparison and the body-equality check in
240
+ * {@linkcode replaceEntryBody} are what refuse such an edit. No input is
241
+ * known that only one of the two refuses: the splice changes only body
242
+ * lines, so another entry, or the target's title or trailer, can change
243
+ * only through a block in the proposal that also changes the target body.
244
+ * (A link reference definition named like a later display ID does not
245
+ * remove that entry: the parser reads definitions only at the top level.)
246
+ * So the tests pin the pair, not either check by itself, and each check is
247
+ * a backstop for the other.
248
+ */
249
+ function sameEntries(before, after, target, targetAfter) {
250
+ if (before.length !== after.length || !targetAfter)
251
+ return false;
252
+ for (let i = 0; i < before.length; i++) {
253
+ if (before[i].displayId !== after[i].displayId)
254
+ return false;
255
+ if (before[i].id !== after[i].id)
256
+ return false;
257
+ }
258
+ if (target.title !== targetAfter.title)
259
+ return false;
260
+ const a = target.rawAttributes;
261
+ const b = targetAfter.rawAttributes;
262
+ if (a.length !== b.length)
263
+ return false;
264
+ return a.every((attr, i) => attr.key === b[i].key && attr.value === b[i].value);
265
+ }
266
+ /**
267
+ * True when `after` holds more diagnostics of some code than `before`.
268
+ * Counts per code, not messages, so diagnostics whose location moved with
269
+ * the splice do not count as new. This catches a body with a trailer-like
270
+ * line or an entry-shaped list item after a blank line (MSL-P020), which
271
+ * the parser keeps as body text and the entry comparison alone cannot
272
+ * see. An entry-shaped item directly after a paragraph line, with no
273
+ * blank line between them, raises no diagnostic; the parser keeps it as
274
+ * body text and adds no entry, so the edit is accepted.
275
+ *
276
+ * Known limit: the parser raises at most one MSL-P020 per entry, so when
277
+ * the target body already has a trailer-like line, a proposal that adds
278
+ * more such lines raises no new MSL-P020 and is accepted. The lines stay
279
+ * body text; no trailer or entry changes.
280
+ */
281
+ function addsParseDiagnostic(before, after) {
282
+ const counts = new Map();
283
+ for (const code of before)
284
+ counts.set(code, (counts.get(code) ?? 0) + 1);
285
+ for (const code of after) {
286
+ const left = (counts.get(code) ?? 0) - 1;
287
+ if (left < 0)
288
+ return true;
289
+ counts.set(code, left);
290
+ }
291
+ return false;
292
+ }
@@ -24,7 +24,7 @@ export declare function isSentenceInitial(line: string, offset: number): boolean
24
24
  *
25
25
  * The pass skips:
26
26
  *
27
- * - Fenced code blocks (between paired ``` or ~~~ markers) — code is
27
+ * - CommonMark fenced code blocks and inline-code spans — code is
28
28
  * verbatim per round-trip invariants (spec §5.1).
29
29
  * - Lines indented by four or more spaces (or a tab) — conservatively
30
30
  * captures indented code blocks and attribute trailers, both of which
@@ -33,8 +33,8 @@ export declare function isSentenceInitial(line: string, offset: number): boolean
33
33
  * @remarks Not called by `format()` as of SP3 Task 5 — body modal
34
34
  * normalization moved to `normalizeBodyAst` in the AST pass (spec-correct
35
35
  * verbatim-boundary handling). Retained as an exported symbol because
36
- * `mod_test.ts` tests it directly and `core/ast/normalize.ts` documents
37
- * the intentional duplication until a follow-up collapses the two. Do NOT
36
+ * `mod_test.ts` tests it directly. Both entry points delegate to the same
37
+ * AST-backed prose normalizer. Do NOT
38
38
  * delete — external callers may depend on this export.
39
39
  */
40
40
  export declare function normalizeModalKeywords(markdown: string): string;
@@ -121,17 +121,21 @@ export declare function sortAttributes(attributes: Attribute[]): Attribute[];
121
121
  * no trailing line-continuation characters.
122
122
  *
123
123
  * @param attributes - The attributes to render, in canonical order.
124
- * @param indent - Body indent for the entry (2 for list-wrapped entries,
125
- * 0 for entries inside source-file doc comments).
124
+ * @param indent - The 0-based list item content column, or 0 inside
125
+ * source-file doc comments.
126
126
  */
127
127
  export declare function renderAttributeBlock(attributes: Attribute[], indent: number): string;
128
128
  /**
129
129
  * Find the 0-based line index where a list item's content ends.
130
130
  * Exported for the ADR-029 prose pass (entry-extent computation).
131
- * Scans forward from the entry start, stopping at: a sibling list item
132
- * (`- ` at the entry's marker column), a line with less indent, or EOF.
131
+ * Scans forward from the later of the line after the entry start and
132
+ * `itemEndFloor` until a line has less indent than the content column, a
133
+ * conventional sibling marker is found, or EOF. Pass the parser's
134
+ * `Entry.endLine` as `itemEndFloor` so that a lazy continuation line
135
+ * inside the item does not end the scan early; the default `0` keeps
136
+ * the indentation-only scan.
133
137
  */
134
- export declare function findItemEnd(lines: readonly string[], startIdx: number, indent: number): number;
138
+ export declare function findItemEnd(lines: readonly string[], startIdx: number, indent: number, itemEndFloor?: number): number;
135
139
  /**
136
140
  * Find the 0-based line range [start, end) of the attribute block
137
141
  * for an entry starting at the given line.
@@ -139,7 +143,7 @@ export declare function findItemEnd(lines: readonly string[], startIdx: number,
139
143
  * Scans forward from the entry start to find the list item boundary,
140
144
  * then walks backwards to find the contiguous trailing attribute block.
141
145
  */
142
- export declare function findAttributeBlockRange(lines: readonly string[], entryStartLine: number, indent: number): {
146
+ export declare function findAttributeBlockRange(lines: readonly string[], entryStartLine: number, indent: number, itemEndFloor?: number): {
143
147
  start: number;
144
148
  end: number;
145
149
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/formatter/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAGX,MAAM,iBAAiB,CAAC;AA2BzB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAGrB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAc/D;AAmSD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;IAC9B;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC;CAC/C;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AA2BD;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CAgQd;AA4DD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAmB/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,EAAE,GACtB,SAAS,EAAE,CA2Bb;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,MAAM,CAcR;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B5C"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/formatter/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAGX,MAAM,iBAAiB,CAAC;AA2BzB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAGrB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/D;AA8SD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;IAC9B;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC;CAC/C;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AA2BD;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CAmSd;AAsDD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAmB/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,EAAE,GACtB,SAAS,EAAE,CA2Bb;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,SAAI,GACf,MAAM,CAkBR;AAyED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,YAAY,SAAI,GACf;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B5C"}
@@ -33,6 +33,7 @@ const render_js_1 = require("../ast/render.js");
33
33
  const normalize_js_1 = require("../ast/normalize.js");
34
34
  const equivalence_js_1 = require("../ast/equivalence.js");
35
35
  const prose_js_1 = require("./prose.js");
36
+ const entry_body_js_1 = require("./entry_body.js");
36
37
  const dprint_js_1 = require("./dprint.js");
37
38
  const md_equiv_js_1 = require("./md_equiv.js");
38
39
  /**
@@ -54,7 +55,7 @@ function isSentenceInitial(line, offset) {
54
55
  *
55
56
  * The pass skips:
56
57
  *
57
- * - Fenced code blocks (between paired ``` or ~~~ markers) — code is
58
+ * - CommonMark fenced code blocks and inline-code spans — code is
58
59
  * verbatim per round-trip invariants (spec §5.1).
59
60
  * - Lines indented by four or more spaces (or a tab) — conservatively
60
61
  * captures indented code blocks and attribute trailers, both of which
@@ -63,21 +64,12 @@ function isSentenceInitial(line, offset) {
63
64
  * @remarks Not called by `format()` as of SP3 Task 5 — body modal
64
65
  * normalization moved to `normalizeBodyAst` in the AST pass (spec-correct
65
66
  * verbatim-boundary handling). Retained as an exported symbol because
66
- * `mod_test.ts` tests it directly and `core/ast/normalize.ts` documents
67
- * the intentional duplication until a follow-up collapses the two. Do NOT
67
+ * `mod_test.ts` tests it directly. Both entry points delegate to the same
68
+ * AST-backed prose normalizer. Do NOT
68
69
  * delete — external callers may depend on this export.
69
70
  */
70
71
  function normalizeModalKeywords(markdown) {
71
- const lines = markdown.split("\n");
72
- (0, fence_js_1.walkProseLines)(markdown, (line, i) => {
73
- // Indented-code / attribute-trailer lines aren't prose either.
74
- if (/^( {4}|\t)/.test(line))
75
- return;
76
- let normalized = line.replace(modals_js_1.RFC2119_MODAL_RE, (m) => m.toLowerCase());
77
- normalized = normalized.replace(modals_js_1.EARS_KEYWORD_RE, (m, _g1, offset) => isSentenceInitial(normalized, offset) ? m : m.toLowerCase());
78
- lines[i] = normalized;
79
- });
80
- return lines.join("\n");
72
+ return (0, modals_js_1.normalizeProseModals)(markdown);
81
73
  }
82
74
  /**
83
75
  * Canonical front-matter key order per ADR-007. Core keys first, then
@@ -230,16 +222,19 @@ function emitBodyViaAst(lines, file, diagnostics, cachedEntries, proseFormat) {
230
222
  for (const entry of sorted) {
231
223
  if (!entry.body.trim())
232
224
  continue; // empty or whitespace-only body
233
- const indent = (entry.location.column - 1) + 2; // marker column (0-based) + 2 spaces = list-item continuation indent
225
+ // List-item continuation indent: the item's content column, which
226
+ // follows every space after the marker (#865).
227
+ const indent = (0, entry_body_js_1.contentColumn)(lines[entry.location.line - 1] ?? "", entry.location.column - 1);
234
228
  const indentStr = " ".repeat(indent);
235
229
  const titleLineIdx = entry.location.line - 1; // 0-based
236
230
  // Locate the body segment in `lines` — between the title line and
237
231
  // the attr block start (or item end when there is no attr block).
238
- const range = findAttributeBlockRange(lines, entry.location.line, indent);
232
+ const itemEndFloor = entry.endLine ?? 0;
233
+ const range = findAttributeBlockRange(lines, entry.location.line, indent, itemEndFloor);
239
234
  const bodyStart = titleLineIdx + 1;
240
235
  const bodyEnd = range
241
236
  ? range.start
242
- : findItemEnd(lines, titleLineIdx, indent);
237
+ : findItemEnd(lines, titleLineIdx, indent, itemEndFloor);
243
238
  if (bodyEnd <= bodyStart)
244
239
  continue; // no body lines to replace
245
240
  // Route the body through the canonical AST: build → normalize
@@ -397,13 +392,16 @@ function format(markdown, options) {
397
392
  // `normalizeBodyAst` (more spec-correct: respects §2.5 verbatim
398
393
  // boundaries and per-node sentence-initial context). `normalizeModalKeywords`
399
394
  // stays exported/defined for other callers/tests but is not invoked here.
400
- const body = rawBody;
401
- const { entries } = (0, markdown_js_1.parseMarkdown)(body, { file });
402
395
  const diagnostics = [...fm.diagnostics];
396
+ // Drop empty-valued trailer lines (`Id:`, `Satisfies:`) before the main
397
+ // pass; left in place they demote the whole trailer block to body code.
398
+ const repaired = removeEmptyTrailerLines(rawBody, (0, markdown_js_1.parseMarkdown)(rawBody, { file }).entries, diagnostics);
399
+ const body = repaired ?? rawBody;
400
+ const { entries } = (0, markdown_js_1.parseMarkdown)(body, { file });
403
401
  // ADR-029: the whole-document Markdown pass is Markdown-only. Gate on the
404
402
  // file extension HERE so the invariant has one home — a caller that wires
405
- // formatMarkdownProse without its own guard (e.g. a future write tool, or
406
- // formatSource forwarding options with a source-file label) cannot silently
403
+ // formatMarkdownProse without its own guard (e.g. a future write tool
404
+ // forwarding options with a source-file label) cannot silently
407
405
  // reflow a source file's doc comment as Markdown. The CommonMark-semantic
408
406
  // gate cannot catch that class, so it must be prevented, not detected. The
409
407
  // CLI/LSP call-site guards remain as defense-in-depth.
@@ -416,12 +414,19 @@ function format(markdown, options) {
416
414
  return { output: markdown, diagnostics, changed: false };
417
415
  }
418
416
  const lines = body.split("\n");
419
- let changed = false;
417
+ let changed = repaired !== undefined;
420
418
  // Process bottom-to-top so line splicing doesn't shift earlier entries.
421
419
  const sorted = [...entries].sort((a, b) => b.location.line - a.location.line);
422
420
  const genUlid = options?.generateUlid ?? ulid_1.ulid;
423
421
  for (const entry of sorted) {
424
- const indent = (entry.location.column - 1) + 2;
422
+ const indent = (0, entry_body_js_1.contentColumn)(lines[entry.location.line - 1] ?? "", entry.location.column - 1);
423
+ // `entry.endLine` comes from the parse of the unedited buffer. Entries
424
+ // are processed bottom to top, so only this entry's own edits move its
425
+ // end; the change in line count since here measures them.
426
+ const lengthAtStart = lines.length;
427
+ const itemEndFloor = () => entry.endLine === undefined
428
+ ? 0
429
+ : entry.endLine + (lines.length - lengthAtStart);
425
430
  let attrs = [...entry.rawAttributes];
426
431
  const titleLineIdx = entry.location.line - 1;
427
432
  // #686: a title that soft-wraps onto extra physical lines is a single
@@ -436,7 +441,7 @@ function format(markdown, options) {
436
441
  // attribute block so a malformed entry with no blank line before its
437
442
  // trailer cannot swallow it.
438
443
  if (titleLineIdx >= 0 && titleLineIdx < lines.length) {
439
- const attrRange = findAttributeBlockRange(lines, entry.location.line, indent);
444
+ const attrRange = findAttributeBlockRange(lines, entry.location.line, indent, itemEndFloor());
440
445
  const limit = attrRange ? attrRange.start : lines.length;
441
446
  let titleEnd = titleLineIdx;
442
447
  while (titleEnd + 1 < limit && lines[titleEnd + 1].trim() !== "") {
@@ -518,7 +523,7 @@ function format(markdown, options) {
518
523
  if (attrs.length === 0)
519
524
  continue;
520
525
  const normalized = sortAttributes(expandCsvValues(attrs));
521
- const range = findAttributeBlockRange(lines, entry.location.line, indent);
526
+ const range = findAttributeBlockRange(lines, entry.location.line, indent, itemEndFloor());
522
527
  if (range) {
523
528
  // Replace existing attribute block.
524
529
  const newBlock = renderAttributeBlock(normalized, indent);
@@ -530,7 +535,7 @@ function format(markdown, options) {
530
535
  }
531
536
  else {
532
537
  // No attribute block — insert one after the entry body.
533
- const insertLine = findEntryBodyEnd(lines, entry, indent);
538
+ const insertLine = findEntryBodyEnd(lines, entry, indent, itemEndFloor());
534
539
  const newBlock = renderAttributeBlock(normalized, indent);
535
540
  lines.splice(insertLine, 0, "", ...newBlock.split("\n"));
536
541
  changed = true;
@@ -571,8 +576,11 @@ function format(markdown, options) {
571
576
  : entries;
572
577
  const extents = proseEntries.map((e) => {
573
578
  const start = e.location.line - 1;
574
- const entryIndent = (e.location.column - 1) + 2;
575
- return { start, end: findItemEnd(collapsedLines, start, entryIndent) };
579
+ const entryIndent = (0, entry_body_js_1.contentColumn)(collapsedLines[start] ?? "", e.location.column - 1);
580
+ return {
581
+ start,
582
+ end: findItemEnd(collapsedLines, start, entryIndent, e.endLine ?? 0),
583
+ };
576
584
  });
577
585
  const prose = (0, prose_js_1.formatProseSegments)(collapsedLines, extents, proseFormat);
578
586
  if (prose.changed)
@@ -637,16 +645,10 @@ function renderFrontMatter(attrs) {
637
645
  */
638
646
  function collapseBlankLines(lines) {
639
647
  const out = [];
640
- let inFence = false;
648
+ const fencedLines = (0, fence_js_1.fencedCodeLines)(lines.join("\n"));
641
649
  let prevBlank = false;
642
- for (const line of lines) {
643
- if (fence_js_1.FENCE_RE.test(line)) {
644
- out.push(line);
645
- inFence = !inFence;
646
- prevBlank = false;
647
- continue;
648
- }
649
- if (inFence) {
650
+ for (const [i, line] of lines.entries()) {
651
+ if (fencedLines.has(i)) {
650
652
  out.push(line);
651
653
  prevBlank = false;
652
654
  continue;
@@ -743,8 +745,8 @@ function sortAttributes(attributes) {
743
745
  * no trailing line-continuation characters.
744
746
  *
745
747
  * @param attributes - The attributes to render, in canonical order.
746
- * @param indent - Body indent for the entry (2 for list-wrapped entries,
747
- * 0 for entries inside source-file doc comments).
748
+ * @param indent - The 0-based list item content column, or 0 inside
749
+ * source-file doc comments.
748
750
  */
749
751
  function renderAttributeBlock(attributes, indent) {
750
752
  const prefix = " ".repeat(indent + 4);
@@ -755,18 +757,26 @@ function renderAttributeBlock(attributes, indent) {
755
757
  /**
756
758
  * Find the 0-based line index where a list item's content ends.
757
759
  * Exported for the ADR-029 prose pass (entry-extent computation).
758
- * Scans forward from the entry start, stopping at: a sibling list item
759
- * (`- ` at the entry's marker column), a line with less indent, or EOF.
760
+ * Scans forward from the later of the line after the entry start and
761
+ * `itemEndFloor` until a line has less indent than the content column, a
762
+ * conventional sibling marker is found, or EOF. Pass the parser's
763
+ * `Entry.endLine` as `itemEndFloor` so that a lazy continuation line
764
+ * inside the item does not end the scan early; the default `0` keeps
765
+ * the indentation-only scan.
760
766
  */
761
- function findItemEnd(lines, startIdx, indent) {
767
+ function findItemEnd(lines, startIdx, indent, itemEndFloor = 0) {
762
768
  const indentStr = " ".repeat(indent);
763
- // The marker column is indent - 2 (e.g., indent 2 → marker at column 0).
769
+ // Recognize sibling bullets with one space after the marker.
764
770
  const markerPrefix = " ".repeat(Math.max(0, indent - 2)) + "- ";
765
- for (let i = startIdx + 1; i < lines.length; i++) {
771
+ // `itemEndFloor` is the 0-based index just after the item's last content
772
+ // line, from the parser's `Entry.endLine`. The scan starts there, because
773
+ // an indentation scan ends the item early at a lazy continuation line
774
+ // (a paragraph line indented less than the item content).
775
+ for (let i = Math.max(startIdx + 1, itemEndFloor); i < lines.length; i++) {
766
776
  const line = lines[i];
767
777
  if (line.trim() === "")
768
778
  continue;
769
- // Sibling list item at same level
779
+ // Sibling with a one-space marker; wider markers use the indent check.
770
780
  if (line.startsWith(markerPrefix))
771
781
  return i;
772
782
  // Line with less indent than continuation
@@ -775,6 +785,72 @@ function findItemEnd(lines, startIdx, indent) {
775
785
  }
776
786
  return lines.length;
777
787
  }
788
+ /** A trailer-shaped line whose value may be empty: `Key:` or `Key: value`. */
789
+ const TRAILER_SHAPED_RE = /^[A-Z][A-Za-z-]*:(?:\s.*)?$/;
790
+ /** A trailer-shaped line with no value: `Key:` (spec §2 makes it MSL-P021). */
791
+ const EMPTY_TRAILER_RE = /^([A-Z][A-Za-z-]*):\s*$/;
792
+ /**
793
+ * Remove empty-valued `Key:` lines from each entry's trailing trailer block.
794
+ *
795
+ * An empty-valued line is not a valid trailer (spec §2, MSL-P021), so the
796
+ * parser treats the whole trailing block as body code. Left alone, the
797
+ * main pass would fence that block and append a fresh `Id:`, silently
798
+ * turning real trace links into inert body text. An empty value carries no
799
+ * information, so dropping the line is lossless: an `Id:` placeholder then
800
+ * gets stamped in place and the remaining trailers stay trailers.
801
+ *
802
+ * Only touches a block of contiguous lines at the very end of an entry,
803
+ * indented at least four columns past the entry body, in which every line
804
+ * is trailer-shaped. Emits one MSL-F001 info diagnostic per removed line.
805
+ *
806
+ * @returns The repaired text, or `undefined` when nothing was removed.
807
+ */
808
+ function removeEmptyTrailerLines(body, entries, diagnostics) {
809
+ const lines = body.split("\n");
810
+ let removedAny = false;
811
+ const sorted = [...entries].sort((a, b) => b.location.line - a.location.line);
812
+ for (const entry of sorted) {
813
+ const indent = (0, entry_body_js_1.contentColumn)(lines[entry.location.line - 1] ?? "", entry.location.column - 1);
814
+ const startIdx = entry.location.line - 1;
815
+ let end = findItemEnd(lines, startIdx, indent, entry.endLine ?? 0);
816
+ while (end > startIdx && lines[end - 1].trim() === "")
817
+ end--;
818
+ let start = end;
819
+ while (start - 1 > startIdx && lines[start - 1].trim() !== "")
820
+ start--;
821
+ if (start >= end || start - 1 <= startIdx)
822
+ continue;
823
+ const trailerIndent = " ".repeat(indent + 4);
824
+ const block = lines.slice(start, end);
825
+ const isTrailerBlock = block.every((l) => l.startsWith(trailerIndent) && TRAILER_SHAPED_RE.test(l.trim()));
826
+ if (!isTrailerBlock)
827
+ continue;
828
+ const kept = block.filter((l) => !EMPTY_TRAILER_RE.test(l.trim()));
829
+ if (kept.length === block.length)
830
+ continue;
831
+ for (const l of block) {
832
+ const key = EMPTY_TRAILER_RE.exec(l.trim())?.[1];
833
+ if (key === undefined)
834
+ continue;
835
+ diagnostics.push({
836
+ code: "MSL-F001",
837
+ severity: "info",
838
+ message: `removed empty '${key}:' trailer line from ${entry.displayId}`,
839
+ location: entry.location,
840
+ });
841
+ }
842
+ if (kept.length > 0) {
843
+ lines.splice(start, end - start, ...kept);
844
+ }
845
+ else {
846
+ // Whole block was placeholders: drop it and its leading blank line.
847
+ const from = lines[start - 1].trim() === "" ? start - 1 : start;
848
+ lines.splice(from, end - from);
849
+ }
850
+ removedAny = true;
851
+ }
852
+ return removedAny ? lines.join("\n") : undefined;
853
+ }
778
854
  /**
779
855
  * Find the 0-based line range [start, end) of the attribute block
780
856
  * for an entry starting at the given line.
@@ -782,9 +858,9 @@ function findItemEnd(lines, startIdx, indent) {
782
858
  * Scans forward from the entry start to find the list item boundary,
783
859
  * then walks backwards to find the contiguous trailing attribute block.
784
860
  */
785
- function findAttributeBlockRange(lines, entryStartLine, indent) {
861
+ function findAttributeBlockRange(lines, entryStartLine, indent, itemEndFloor = 0) {
786
862
  const startIdx = entryStartLine - 1;
787
- const itemEnd = findItemEnd(lines, startIdx, indent);
863
+ const itemEnd = findItemEnd(lines, startIdx, indent, itemEndFloor);
788
864
  // Walk backwards from itemEnd, skip trailing blank lines.
789
865
  let scanEnd = itemEnd;
790
866
  while (scanEnd > startIdx && lines[scanEnd - 1].trim() === "") {
@@ -813,9 +889,9 @@ function findAttributeBlockRange(lines, entryStartLine, indent) {
813
889
  * Find the 0-based line index where a new attribute block should be inserted
814
890
  * (after the last non-blank body line of the entry).
815
891
  */
816
- function findEntryBodyEnd(lines, entry, indent) {
892
+ function findEntryBodyEnd(lines, entry, indent, itemEndFloor = 0) {
817
893
  const startIdx = entry.location.line - 1;
818
- const itemEnd = findItemEnd(lines, startIdx, indent);
894
+ const itemEnd = findItemEnd(lines, startIdx, indent, itemEndFloor);
819
895
  let insertAt = itemEnd;
820
896
  while (insertAt > startIdx && lines[insertAt - 1].trim() === "") {
821
897
  insertAt--;