@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
package/README.md CHANGED
@@ -68,8 +68,8 @@ markspec book build # multi-chapter → static HTML site
68
68
  markspec lsp # LSP server (stdio JSON-RPC)
69
69
  markspec lsp install # print LSP config for vscode, neovim, zed
70
70
  markspec mcp # MCP server (stdio JSON-RPC)
71
- markspec mcp install # print MCP config for claude-desktop,
72
- # cursor, vscode
71
+ markspec mcp install # write/print MCP config for claude,
72
+ # copilot, cursor, opencode, vscode
73
73
  ```
74
74
 
75
75
  **Not yet implemented** (registered but exit with an error):
@@ -165,6 +165,15 @@ fn swt_brk_0001_debounce_filters_noise() {
165
165
  **Mustache variables** — `{{project.name}}` substitution from `project.yaml`,
166
166
  resolved at build time.
167
167
 
168
+ ## MarkDesk
169
+
170
+ MarkDesk is a desktop authoring app for MarkSpec products. It lives in
171
+ [`apps/markdesk`](apps/markdesk/README.md): a React and Vite UI in a Tauri v2
172
+ shell. The app starts `markspec desk --serve` as a sidecar and reads the product
173
+ through that local API. It writes an entry body only after the author accepts an
174
+ assistant's proposal. MarkDesk is in development and is not yet released. The
175
+ design is recorded in [ADR-035](docs/architecture/adr-035-markdesk.md).
176
+
168
177
  ## Install
169
178
 
170
179
  See [`docs/guide/installation.md`](docs/guide/installation.md) for the VS Code
@@ -14,11 +14,10 @@
14
14
  * - EARS (`When`, `While`, `Where`, `Unless`) — lowercased
15
15
  * mid-sentence, capitalisation preserved when sentence-initial.
16
16
  *
17
- * The shared `RFC2119_MODAL_RE`, `EARS_KEYWORD_RE`, and `isSentenceInitial`
18
- * helpers are imported from `core/util/modals.ts` (D11 consolidation).
19
- * They cannot be imported from `formatter/mod.ts` because `formatter/`
20
- * depends on `ast/`, making an `ast → formatter` import a dependency cycle.
21
- * `core/util/` is the base level that both modules can import from.
17
+ * The shared `normalizeProseModals` helper is imported from
18
+ * `core/util/modals.ts`. Importing it from `formatter/mod.ts` would create
19
+ * a cycle because `formatter/` already depends on `ast/`.
20
+ * The helper uses only the standalone remark code-region parser.
22
21
  *
23
22
  * Invariants (HARD — never weaken):
24
23
  * - Pure: no `Deno.*`, no I/O.
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/ast/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAQH,OAAO,KAAK,EAEV,SAAS,EASV,MAAM,YAAY,CAAC;AAiJpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,SAAS,EAAE,GAC3B,SAAS,EAAE,CAEb"}
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/ast/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EAEV,SAAS,EASV,MAAM,YAAY,CAAC;AA+GpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,SAAS,EAAE,GAC3B,SAAS,EAAE,CAEb"}
@@ -14,11 +14,10 @@
14
14
  * - EARS (`When`, `While`, `Where`, `Unless`) — lowercased
15
15
  * mid-sentence, capitalisation preserved when sentence-initial.
16
16
  *
17
- * The shared `RFC2119_MODAL_RE`, `EARS_KEYWORD_RE`, and `isSentenceInitial`
18
- * helpers are imported from `core/util/modals.ts` (D11 consolidation).
19
- * They cannot be imported from `formatter/mod.ts` because `formatter/`
20
- * depends on `ast/`, making an `ast → formatter` import a dependency cycle.
21
- * `core/util/` is the base level that both modules can import from.
17
+ * The shared `normalizeProseModals` helper is imported from
18
+ * `core/util/modals.ts`. Importing it from `formatter/mod.ts` would create
19
+ * a cycle because `formatter/` already depends on `ast/`.
20
+ * The helper uses only the standalone remark code-region parser.
22
21
  *
23
22
  * Invariants (HARD — never weaken):
24
23
  * - Pure: no `Deno.*`, no I/O.
@@ -33,37 +32,7 @@
33
32
  *
34
33
  * This module is pure library code: no `Deno.*` APIs.
35
34
  */
36
- import { walkProseLines } from "../util/fence.js";
37
- import { EARS_KEYWORD_RE, isSentenceInitial, RFC2119_MODAL_RE, } from "../util/modals.js";
38
- // ---------------------------------------------------------------------------
39
- // §3.4.1 string helper — uses shared RFC2119_MODAL_RE, EARS_KEYWORD_RE,
40
- // and isSentenceInitial from core/util/modals.ts (D11 consolidation).
41
- // ---------------------------------------------------------------------------
42
- /**
43
- * Apply the §3.4.1 modal-keyword case rule to a prose string.
44
- *
45
- * Faithful port of `normalizeModalKeywords` (`core/formatter/mod.ts`):
46
- * fenced-code lines are skipped (verbatim, §5.1), and lines indented by
47
- * four or more spaces (or a tab) are skipped (conservatively captures
48
- * indented code blocks / attribute trailers — not prose). On every other
49
- * line, RFC 2119 keywords are lowercased unconditionally and EARS
50
- * keywords are lowercased unless sentence-initial.
51
- *
52
- * Pure and total: never throws; a string with no modal keyword is
53
- * returned unchanged.
54
- */
55
- function normalizeModalsInText(text) {
56
- const lines = text.split("\n");
57
- walkProseLines(text, (line, i) => {
58
- // Indented-code / attribute-trailer lines aren't prose either.
59
- if (/^( {4}|\t)/.test(line))
60
- return;
61
- let normalized = line.replace(RFC2119_MODAL_RE, (m) => m.toLowerCase());
62
- normalized = normalized.replace(EARS_KEYWORD_RE, (m, _g1, offset) => isSentenceInitial(normalized, offset) ? m : m.toLowerCase());
63
- lines[i] = normalized;
64
- });
65
- return lines.join("\n");
66
- }
35
+ import { normalizeProseModals } from "../util/modals.js";
67
36
  // ---------------------------------------------------------------------------
68
37
  // InlineContent normalisation
69
38
  // ---------------------------------------------------------------------------
@@ -75,7 +44,7 @@ function normalizeModalsInText(text) {
75
44
  * returned UNCHANGED (makes the no-op case allocation-free).
76
45
  */
77
46
  function normalizeInline(content) {
78
- const normalizedText = normalizeModalsInText(content.text);
47
+ const normalizedText = normalizeProseModals(content.text);
79
48
  if (normalizedText === content.text)
80
49
  return content;
81
50
  return { text: normalizedText };
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @module core/collect
3
3
  *
4
- * Project-entry collection: discover every MarkSpec-relevant file under a
5
- * root and parse it into a flat `Entry[]`. The single source of truth for
4
+ * Project-entry collection: discover the MarkSpec-relevant files of one
5
+ * project (a root, minus the projects nested below it) and parse them into
6
+ * a flat `Entry[]`. The single source of truth for
6
7
  * "the set of entries whose trace edges the lockfile pins" — shared by
7
8
  * `markspec lock` (the pinner) and its checkers (`compile`, `fmt`, `doctor`)
8
9
  * so they cannot disagree on which files count. Previously each of those
@@ -12,23 +13,42 @@
12
13
  */
13
14
  import type { Entry } from "../model/mod.js";
14
15
  import { type DiscoveryIO } from "../discovery/mod.js";
16
+ /** A discovered project file could not be read. */
17
+ export declare class UnreadableProjectFileError extends Error {
18
+ readonly file: string;
19
+ constructor(file: string);
20
+ }
15
21
  /** Options for {@linkcode collectProjectEntries}. */
16
22
  export interface CollectOptions {
17
- /** Gitignore-syntax patterns (e.g. `project.yaml` `exclude:`), anchored at
18
- * `root`. Applied after `.gitignore` rules. Defaults to none. */
23
+ /** Gitignore-syntax patterns (e.g. `.markspec.yaml` `exclude:`), anchored at
24
+ * `root`. Applied after built-in build-output skips and all `.gitignore`
25
+ * rules at every directory level. Hidden directories are always skipped.
26
+ * Defaults to none. */
19
27
  readonly exclude?: readonly string[];
28
+ /** An enclosing project root whose `.gitignore` files, from it down to
29
+ * `root`, also apply (`discoverFiles` option of the same name). Pass the
30
+ * outermost project root above a nested project, so the nested project
31
+ * pins the files a bare `check` from any folder walks. */
32
+ readonly inheritGitignoreFrom?: string;
33
+ /** Roots of the projects nested below `root`. Their files belong to those
34
+ * projects and are skipped: each `markspec.lock` pins only the entries
35
+ * of its own project. Defaults to none. */
36
+ readonly nestedRoots?: readonly string[];
20
37
  }
21
38
  /**
22
39
  * Walk `root` via {@linkcode discoverFiles} — relying on its default
23
40
  * extension set (`RELEVANT_EXTENSIONS`), the parity point every caller
24
- * depends on — and parse each discovered file, returning the flattened
25
- * entry list. Unreadable files are skipped. Parse diagnostics are not
26
- * surfaced here: this collector exists to give the lockfile pinner and its
27
- * checkers one definition of the file set; callers that need diagnostics
28
- * re-parse.
41
+ * depends on — and parse each discovered file of the project at `root`,
42
+ * returning the flattened entry list. Files below `opts.nestedRoots` are
43
+ * skipped, and `opts.inheritGitignoreFrom` adds the `.gitignore` files of
44
+ * an enclosing project. An unreadable discovered file aborts collection.
45
+ * Parse diagnostics are not surfaced here: this collector exists to give
46
+ * the lockfile pinner and its checkers one definition of the file set;
47
+ * callers that need diagnostics re-parse.
29
48
  *
30
49
  * @param io Injected filesystem surface (keeps `core/` Node-compatible; CLI
31
50
  * entry points pass a Deno-backed implementation).
51
+ * @throws {UnreadableProjectFileError} If a discovered project file cannot be read.
32
52
  */
33
53
  export declare function collectProjectEntries(root: string, io: DiscoveryIO, opts?: CollectOptions): Promise<Entry[]>;
34
54
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/collect/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtE,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B;qEACiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,KAAK,EAAE,CAAC,CASlB"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/collect/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAItE,mDAAmD;AACnD,qBAAa,0BAA2B,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAIlC;AAED,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B;;;2BAGuB;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;8DAG0D;IAC1D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;+CAE2C;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,KAAK,EAAE,CAAC,CAkBlB"}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @module core/collect
3
3
  *
4
- * Project-entry collection: discover every MarkSpec-relevant file under a
5
- * root and parse it into a flat `Entry[]`. The single source of truth for
4
+ * Project-entry collection: discover the MarkSpec-relevant files of one
5
+ * project (a root, minus the projects nested below it) and parse them into
6
+ * a flat `Entry[]`. The single source of truth for
6
7
  * "the set of entries whose trace edges the lockfile pins" — shared by
7
8
  * `markspec lock` (the pinner) and its checkers (`compile`, `fmt`, `doctor`)
8
9
  * so they cannot disagree on which files count. Previously each of those
@@ -10,26 +11,51 @@
10
11
  * private helper the others reached into), which had to stay byte-identical
11
12
  * by hand or the lockfile edge-hash comparison would drift spuriously.
12
13
  */
14
+ import { dirname } from "@std/path";
13
15
  import { discoverFiles } from "../discovery/mod.js";
16
+ import { nearestRoot } from "../discovery/projects.js";
14
17
  import { parseFile } from "../parser/mod.js";
18
+ /** A discovered project file could not be read. */
19
+ export class UnreadableProjectFileError extends Error {
20
+ constructor(file) {
21
+ super(`Cannot read discovered project file: ${file}`);
22
+ Object.defineProperty(this, "file", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: file
27
+ });
28
+ this.name = "UnreadableProjectFileError";
29
+ }
30
+ }
15
31
  /**
16
32
  * Walk `root` via {@linkcode discoverFiles} — relying on its default
17
33
  * extension set (`RELEVANT_EXTENSIONS`), the parity point every caller
18
- * depends on — and parse each discovered file, returning the flattened
19
- * entry list. Unreadable files are skipped. Parse diagnostics are not
20
- * surfaced here: this collector exists to give the lockfile pinner and its
21
- * checkers one definition of the file set; callers that need diagnostics
22
- * re-parse.
34
+ * depends on — and parse each discovered file of the project at `root`,
35
+ * returning the flattened entry list. Files below `opts.nestedRoots` are
36
+ * skipped, and `opts.inheritGitignoreFrom` adds the `.gitignore` files of
37
+ * an enclosing project. An unreadable discovered file aborts collection.
38
+ * Parse diagnostics are not surfaced here: this collector exists to give
39
+ * the lockfile pinner and its checkers one definition of the file set;
40
+ * callers that need diagnostics re-parse.
23
41
  *
24
42
  * @param io Injected filesystem surface (keeps `core/` Node-compatible; CLI
25
43
  * entry points pass a Deno-backed implementation).
44
+ * @throws {UnreadableProjectFileError} If a discovered project file cannot be read.
26
45
  */
27
46
  export async function collectProjectEntries(root, io, opts = {}) {
28
47
  const out = [];
29
- for await (const file of discoverFiles(root, io, { exclude: opts.exclude })) {
30
- const content = await io.readFile(file);
31
- if (content === undefined)
48
+ const roots = [root, ...opts.nestedRoots ?? []];
49
+ for await (const file of discoverFiles(root, io, {
50
+ exclude: opts.exclude,
51
+ inheritGitignoreFrom: opts.inheritGitignoreFrom,
52
+ })) {
53
+ if (nearestRoot(dirname(file), roots) !== root)
32
54
  continue;
55
+ const content = await io.readFile(file);
56
+ if (content === undefined) {
57
+ throw new UnreadableProjectFileError(file);
58
+ }
33
59
  const result = await parseFile(content, { file });
34
60
  out.push(...result.entries);
35
61
  }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @module compiler/deserialize
3
+ *
4
+ * Hydration of compiled-JSON snapshots back into core {@linkcode Entry}
5
+ * values — the inverse of `./schema.ts`. Consumed by the upstream corpus
6
+ * loader (`core/upstream/`): a dependency's or reference's published
7
+ * compile output is deserialized here before joining the consumer's graph.
8
+ *
9
+ * Pure module: no I/O, no Deno APIs.
10
+ */
11
+ import type { Diagnostic, Entry } from "../model/mod.js";
12
+ import type { SerializedEntry } from "./schema.js";
13
+ /**
14
+ * Rebuild an {@linkcode Entry} from its serialized wire form. Inverse of
15
+ * `serializeEntry`: restores `typedAttributes` from a plain record to a
16
+ * `Map` (absent → empty). All other fields — including `origin` — pass
17
+ * through verbatim.
18
+ *
19
+ * `type` and `id` are re-keyed explicitly (rather than left to the
20
+ * `...rest` spread) to restore field-presence parity with a freshly
21
+ * parsed {@linkcode Entry}: the parser always includes both as own
22
+ * properties (`type` is `undefined` when no profile classified the
23
+ * entry; `id` is `undefined` on Reference-shaped entries with no `Id:`
24
+ * trailer), but `JSON.stringify` drops `undefined`-valued keys
25
+ * entirely, so the wire form loses the keys when it round-trips
26
+ * through `JSON.parse`. Without this, `deserializeEntry(wire)` would
27
+ * be missing those keys while the original entry still carries them
28
+ * (with value `undefined`), breaking the deep-equality round-trip
29
+ * contract.
30
+ */
31
+ export declare function deserializeEntry(s: SerializedEntry): Entry;
32
+ /** Result of {@linkcode extractSerializedEntries}. */
33
+ export interface ExtractedEntries {
34
+ readonly entries: SerializedEntry[];
35
+ readonly diagnostics: Diagnostic[];
36
+ }
37
+ /**
38
+ * Reject a snapshot whose schema versions don't match this build — a
39
+ * skewed snapshot must never silently misparse. Returns the diagnostic to
40
+ * publish, or `undefined` when the snapshot is compatible.
41
+ */
42
+ export declare function checkSnapshotSchema(manifest: unknown, manifestPath: string): Diagnostic | undefined;
43
+ /**
44
+ * Follow the manifest's `entries` block and return the raw serialized
45
+ * entries. `readSnapshotFile` resolves a path relative to the snapshot
46
+ * directory (injected — this module does no I/O).
47
+ */
48
+ export declare function extractSerializedEntries(manifest: unknown, readSnapshotFile: (relPath: string) => string | undefined, manifestPath: string): ExtractedEntries;
49
+ //# sourceMappingURL=deserialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deserialize.d.ts","sourceRoot":"","sources":["../../src/compiler/deserialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,GAAG,KAAK,CAQ1D;AAED,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,MAAM,GACnB,UAAU,GAAG,SAAS,CAwBxB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,OAAO,EACjB,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EACzD,YAAY,EAAE,MAAM,GACnB,gBAAgB,CAsDlB"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @module compiler/deserialize
3
+ *
4
+ * Hydration of compiled-JSON snapshots back into core {@linkcode Entry}
5
+ * values — the inverse of `./schema.ts`. Consumed by the upstream corpus
6
+ * loader (`core/upstream/`): a dependency's or reference's published
7
+ * compile output is deserialized here before joining the consumer's graph.
8
+ *
9
+ * Pure module: no I/O, no Deno APIs.
10
+ */
11
+ import { CORE_SCHEMA_VERSION } from "../model/mod.js";
12
+ import { MANIFEST_SCHEMA_VERSION } from "./manifest.js";
13
+ /**
14
+ * Rebuild an {@linkcode Entry} from its serialized wire form. Inverse of
15
+ * `serializeEntry`: restores `typedAttributes` from a plain record to a
16
+ * `Map` (absent → empty). All other fields — including `origin` — pass
17
+ * through verbatim.
18
+ *
19
+ * `type` and `id` are re-keyed explicitly (rather than left to the
20
+ * `...rest` spread) to restore field-presence parity with a freshly
21
+ * parsed {@linkcode Entry}: the parser always includes both as own
22
+ * properties (`type` is `undefined` when no profile classified the
23
+ * entry; `id` is `undefined` on Reference-shaped entries with no `Id:`
24
+ * trailer), but `JSON.stringify` drops `undefined`-valued keys
25
+ * entirely, so the wire form loses the keys when it round-trips
26
+ * through `JSON.parse`. Without this, `deserializeEntry(wire)` would
27
+ * be missing those keys while the original entry still carries them
28
+ * (with value `undefined`), breaking the deep-equality round-trip
29
+ * contract.
30
+ */
31
+ export function deserializeEntry(s) {
32
+ const { typedAttributes, type, id, ...rest } = s;
33
+ return {
34
+ ...rest,
35
+ type,
36
+ id,
37
+ typedAttributes: new Map(Object.entries(typedAttributes ?? {})),
38
+ };
39
+ }
40
+ /**
41
+ * Reject a snapshot whose schema versions don't match this build — a
42
+ * skewed snapshot must never silently misparse. Returns the diagnostic to
43
+ * publish, or `undefined` when the snapshot is compatible.
44
+ */
45
+ export function checkSnapshotSchema(manifest, manifestPath) {
46
+ const m = manifest;
47
+ if (m?.markspecSchemaVersion === MANIFEST_SCHEMA_VERSION &&
48
+ m?.generator?.coreSchema === CORE_SCHEMA_VERSION) {
49
+ return undefined;
50
+ }
51
+ return {
52
+ code: "UPSTREAM-SNAPSHOT-001",
53
+ severity: "error",
54
+ message: `upstream snapshot schema mismatch (manifest v${String(m?.markspecSchemaVersion)}, ` +
55
+ `core-schema ${String(m?.generator?.coreSchema)} vs expected ${MANIFEST_SCHEMA_VERSION}/${CORE_SCHEMA_VERSION}); ` +
56
+ `re-run 'markspec lock' with a compatible markspec version`,
57
+ location: { file: manifestPath, line: 1, column: 1 },
58
+ };
59
+ }
60
+ /**
61
+ * Follow the manifest's `entries` block and return the raw serialized
62
+ * entries. `readSnapshotFile` resolves a path relative to the snapshot
63
+ * directory (injected — this module does no I/O).
64
+ */
65
+ export function extractSerializedEntries(manifest, readSnapshotFile, manifestPath) {
66
+ const diagnostics = [];
67
+ const block = manifest
68
+ ?.entries;
69
+ const file = block?.file;
70
+ if (!file || (block?.format !== "inline" && block?.format !== "ndjson")) {
71
+ diagnostics.push(malformed(manifestPath, "manifest entries block missing or unknown format"));
72
+ return { entries: [], diagnostics };
73
+ }
74
+ const raw = readSnapshotFile(file);
75
+ if (raw === undefined) {
76
+ diagnostics.push({
77
+ code: "UPSTREAM-SNAPSHOT-002",
78
+ severity: "error",
79
+ message: `upstream snapshot file '${file}' is missing or unreadable; ` +
80
+ `run 'markspec lock' to restore the cache`,
81
+ location: { file: manifestPath, line: 1, column: 1 },
82
+ });
83
+ return { entries: [], diagnostics };
84
+ }
85
+ try {
86
+ let candidates;
87
+ if (block.format === "inline") {
88
+ const json = JSON.parse(raw);
89
+ candidates = Object.values(json.entries ?? {});
90
+ }
91
+ else {
92
+ candidates = raw
93
+ .split("\n")
94
+ .filter((line) => line.trim().length > 0)
95
+ .map((line) => JSON.parse(line));
96
+ }
97
+ const { valid, rejectedCount } = partitionEntryCandidates(candidates);
98
+ if (rejectedCount > 0) {
99
+ diagnostics.push(malformed(manifestPath, `snapshot file '${file}' contains ${rejectedCount} non-object ` +
100
+ `entry value(s)`));
101
+ }
102
+ return { entries: valid, diagnostics };
103
+ }
104
+ catch (err) {
105
+ diagnostics.push(malformed(manifestPath, `snapshot file '${file}' is not valid JSON: ${err instanceof Error ? err.message : String(err)}`));
106
+ return { entries: [], diagnostics };
107
+ }
108
+ }
109
+ /**
110
+ * Keep only candidates that are non-null, non-array plain objects — the
111
+ * shape a serialized entry must have. A snapshot line/value that parses
112
+ * as valid JSON but isn't an object (`null`, a bare string, a number, an
113
+ * array) would otherwise crash downstream (`deserializeEntry` destructures
114
+ * fields off it) or produce a garbage entry with an `undefined` displayId.
115
+ * Rejected candidates are dropped silently here; the caller emits a single
116
+ * summary diagnostic when `rejectedCount > 0`.
117
+ */
118
+ function partitionEntryCandidates(candidates) {
119
+ const valid = [];
120
+ let rejectedCount = 0;
121
+ for (const candidate of candidates) {
122
+ if (typeof candidate === "object" && candidate !== null &&
123
+ !Array.isArray(candidate)) {
124
+ valid.push(candidate);
125
+ }
126
+ else {
127
+ rejectedCount++;
128
+ }
129
+ }
130
+ return { valid, rejectedCount };
131
+ }
132
+ function malformed(file, detail) {
133
+ return {
134
+ code: "UPSTREAM-SNAPSHOT-003",
135
+ severity: "error",
136
+ message: `malformed upstream snapshot: ${detail}`,
137
+ location: { file, line: 1, column: 1 },
138
+ };
139
+ }
@@ -25,6 +25,8 @@ export type ManifestEdgesBlock = {
25
25
  readonly format: "ndjson";
26
26
  readonly file: string;
27
27
  };
28
+ /** Version of the compile-output wire schema (`manifest.json` et al.). */
29
+ export declare const MANIFEST_SCHEMA_VERSION = 1;
28
30
  /** `manifest.json` schema (spec §4.2). */
29
31
  export interface ManifestJson {
30
32
  readonly markspecSchemaVersion: 1;
@@ -35,6 +37,7 @@ export interface ManifestJson {
35
37
  readonly project: {
36
38
  readonly name: string;
37
39
  readonly root: string;
40
+ readonly version?: string;
38
41
  };
39
42
  readonly counts: {
40
43
  readonly entries: number;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/compiler/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACpD;IACA,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEJ,2EAA2E;AAC3E,MAAM,MAAM,kBAAkB,G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AE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACnD,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;CACpD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,gBAAgB,GAAG,SAAS,EACtC,OAAO,EAAE,MAAM,EACf,SAAS,UAAQ,GAChB,YAAY,CAmCd"}
@@ -6,6 +6,9 @@
6
6
  * `compiled.json` file pointed to by the manifest's `entries` and `edges`
7
7
  * indirection blocks.
8
8
  */
9
+ import { CORE_SCHEMA_VERSION } from "../model/mod.js";
10
+ /** Version of the compile-output wire schema (`manifest.json` et al.). */
11
+ export const MANIFEST_SCHEMA_VERSION = 1;
9
12
  /**
10
13
  * Build the `manifest.json` object for a compiled project.
11
14
  *
@@ -21,14 +24,17 @@ export function buildManifest(result, config, projectRoot, _profile, version, st
21
24
  byType[typeName] = (byType[typeName] ?? 0) + 1;
22
25
  }
23
26
  return {
24
- markspecSchemaVersion: 1,
27
+ markspecSchemaVersion: MANIFEST_SCHEMA_VERSION,
25
28
  generator: {
26
29
  release: version,
27
- coreSchema: 1,
30
+ coreSchema: CORE_SCHEMA_VERSION,
28
31
  },
29
32
  project: {
30
33
  name: config.name ?? "",
31
34
  root: projectRoot,
35
+ ...(config.version && config.version !== "0.0.0"
36
+ ? { version: config.version }
37
+ : {}),
32
38
  },
33
39
  counts: {
34
40
  entries: result.entries.size,
@@ -42,7 +48,7 @@ export function buildManifest(result, config, projectRoot, _profile, version, st
42
48
  ? { format: "ndjson", file: "edges.ndjson" }
43
49
  : { format: "inline", file: "compiled.json" },
44
50
  sqliteMirror: null,
45
- federation: config.parents ?? [],
51
+ federation: (config.references ?? []).map((r) => r.url),
46
52
  reserved: {},
47
53
  };
48
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/compiler/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,IAAI,EAEL,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAOjE,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,qGAAqG;IACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAClB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IACjD;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CACjB,IAAI,EAAE,MAAM,KACT,OAAO,CACV;QACE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,SAA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Q,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAC1D,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAC1D,4GAA4G;IAC5G,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClD,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AA4BD;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAoMxB;AA+ED,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
@@ -6,8 +6,9 @@
6
6
  */
7
7
  import { makeDisplayId } from "../model/mod.js";
8
8
  import { parseFile } from "../parser/mod.js";
9
- import { attributeCorpusDiagnostics, classifyEntriesStage, detectCorpusCollisions, suppressDeclaredAttrR010, validate, } from "../validator/mod.js";
10
- import { validateTypl } from "../typl/mod.js";
9
+ import { applyCorpusPostPass, classifyEntriesStage, suppressDeclaredAttrR010, validate, } from "../validator/mod.js";
10
+ import { validateUxilFamily } from "../validator/uxil_family.js";
11
+ import { buildTypeRegistry } from "../typl/mod.js";
11
12
  import { buildEffectiveDisciplineRegistry } from "../profile/discipline_registry.js";
12
13
  import { ATTR_TO_LINK_KIND } from "./constants.js";
13
14
  import { classifyDiscipline } from "./discipline_classifier.js";
@@ -189,6 +190,13 @@ export async function compile(paths, options) {
189
190
  classifiedEntries = stage2.entries;
190
191
  parseDiagnostics.push(...stage2.diagnostics);
191
192
  }
193
+ // Phase 2.6: uxil diagnostics family (S9 #727) — profile-gated (inert
194
+ // without a `declares: ux-surface` designation), mirroring runPipeline's
195
+ // Stage 5 so compile-backed surfaces (CLI compile/export/show, the MCP
196
+ // server) agree with `check` and the LSP on designated corpora. No
197
+ // file-local filter here: the requested path set IS the corpus being
198
+ // compiled — the same full-set semantics MSL-L006 assumes in compile.
199
+ const uxilDiagnostics = validateUxilFamily(classifiedEntries, options.profile ?? null);
192
200
  // Phase 3: Build traceability graph.
193
201
  // Keep first occurrence of each display ID (validator catches duplicates).
194
202
  const entries = new Map();
@@ -232,15 +240,16 @@ export async function compile(paths, options) {
232
240
  const linkTargetDiags = checkLinkTargets(entries, links);
233
241
  const forward = buildAdjacency(links, (l) => l.from);
234
242
  const reverse = buildAdjacency(links, (l) => l.to);
235
- // Build the corpus typl registry. validateTypl is also called inside
236
- // validate() (via validationDiagnostics) for the cross-entry TYPL
237
- // diagnostics. Here we call it again only to capture the registry — the
238
- // diagnostics are already included in validationDiagnostics, so we discard
239
- // them to avoid duplicates in the output.
240
- const { registry: typeRegistry } = validateTypl([...entries.values()]);
243
+ // Build the corpus typl registry directly — validate() (called above)
244
+ // already ran the full validateTypl pass (citation resolution, TYPL-009,
245
+ // etc.) for validationDiagnostics; re-running it here just to get
246
+ // `.registry` would redo that work a second time per compile/show/
247
+ // context/report/export/MCP call.
248
+ const typeRegistry = buildTypeRegistry([...entries.values()]);
241
249
  let diagnostics = [
242
250
  ...parseDiagnostics,
243
251
  ...validationDiagnostics,
252
+ ...uxilDiagnostics,
244
253
  ...linkTargetDiags,
245
254
  ];
246
255
  // Phase 5: Corpus-aware diagnostic post-pass (ADR-030). A project entry
@@ -251,11 +260,7 @@ export async function compile(paths, options) {
251
260
  // bugs they cannot fix. No-op (and zero allocation beyond the spread
252
261
  // above) when no corpus was injected.
253
262
  if (options.corpusEntries && options.corpusEntries.length > 0) {
254
- const collisions = detectCorpusCollisions(allEntries);
255
- diagnostics = [
256
- ...attributeCorpusDiagnostics(diagnostics, allEntries, collisions.collidedTokens),
257
- ...collisions.diagnostics,
258
- ];
263
+ diagnostics = applyCorpusPostPass(diagnostics, allEntries);
259
264
  }
260
265
  return {
261
266
  entries,