@driftsys/markspec 0.10.3 → 0.11.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 (376) hide show
  1. package/README.md +2 -2
  2. package/esm/compiler/deserialize.d.ts +49 -0
  3. package/esm/compiler/deserialize.d.ts.map +1 -0
  4. package/esm/compiler/deserialize.js +139 -0
  5. package/esm/compiler/manifest.d.ts +3 -0
  6. package/esm/compiler/manifest.d.ts.map +1 -1
  7. package/esm/compiler/manifest.js +9 -3
  8. package/esm/compiler/mod.d.ts.map +1 -1
  9. package/esm/compiler/mod.js +16 -7
  10. package/esm/config/markspec.d.ts +38 -1
  11. package/esm/config/markspec.d.ts.map +1 -1
  12. package/esm/config/markspec.js +127 -2
  13. package/esm/config/mod.d.ts.map +1 -1
  14. package/esm/config/mod.js +143 -147
  15. package/esm/decl/duplicates.d.ts +29 -0
  16. package/esm/decl/duplicates.d.ts.map +1 -0
  17. package/esm/decl/duplicates.js +28 -0
  18. package/esm/decl/mod.d.ts +4 -2
  19. package/esm/decl/mod.d.ts.map +1 -1
  20. package/esm/decl/mod.js +2 -1
  21. package/esm/decl/surfaces.d.ts +29 -7
  22. package/esm/decl/surfaces.d.ts.map +1 -1
  23. package/esm/decl/surfaces.js +31 -18
  24. package/esm/gates/mod.d.ts +13 -2
  25. package/esm/gates/mod.d.ts.map +1 -1
  26. package/esm/gates/mod.js +38 -11
  27. package/esm/lint/runner.d.ts.map +1 -1
  28. package/esm/lint/runner.js +3 -1
  29. package/esm/lock/acquire_compile.d.ts +31 -0
  30. package/esm/lock/acquire_compile.d.ts.map +1 -0
  31. package/esm/lock/acquire_compile.js +83 -0
  32. package/esm/lock/cache_check.d.ts +28 -0
  33. package/esm/lock/cache_check.d.ts.map +1 -0
  34. package/esm/lock/cache_check.js +51 -0
  35. package/esm/lock/check.d.ts +14 -3
  36. package/esm/lock/check.d.ts.map +1 -1
  37. package/esm/lock/check.js +41 -3
  38. package/esm/lock/git_intent.d.ts +46 -0
  39. package/esm/lock/git_intent.d.ts.map +1 -0
  40. package/esm/lock/git_intent.js +111 -0
  41. package/esm/lock/mod.d.ts +10 -3
  42. package/esm/lock/mod.d.ts.map +1 -1
  43. package/esm/lock/mod.js +7 -1
  44. package/esm/lock/model.d.ts +24 -1
  45. package/esm/lock/model.d.ts.map +1 -1
  46. package/esm/lock/parser.d.ts.map +1 -1
  47. package/esm/lock/parser.js +32 -0
  48. package/esm/lock/pin_assurance.d.ts +20 -0
  49. package/esm/lock/pin_assurance.d.ts.map +1 -0
  50. package/esm/lock/pin_assurance.js +34 -0
  51. package/esm/lock/resolve.d.ts +8 -17
  52. package/esm/lock/resolve.d.ts.map +1 -1
  53. package/esm/lock/resolve.js +7 -67
  54. package/esm/lock/serializer.d.ts.map +1 -1
  55. package/esm/lock/serializer.js +23 -0
  56. package/esm/lock/upstream_common.d.ts +29 -0
  57. package/esm/lock/upstream_common.d.ts.map +1 -0
  58. package/esm/lock/upstream_common.js +38 -0
  59. package/esm/lock/upstream_deps.d.ts +63 -0
  60. package/esm/lock/upstream_deps.d.ts.map +1 -0
  61. package/esm/lock/upstream_deps.js +172 -0
  62. package/esm/lock/upstream_refs.d.ts +69 -0
  63. package/esm/lock/upstream_refs.d.ts.map +1 -0
  64. package/esm/lock/upstream_refs.js +238 -0
  65. package/esm/mod.d.ts +16 -8
  66. package/esm/mod.d.ts.map +1 -1
  67. package/esm/mod.js +15 -5
  68. package/esm/model/mod.d.ts +93 -28
  69. package/esm/model/mod.d.ts.map +1 -1
  70. package/esm/model/mod.js +66 -13
  71. package/esm/model/profile.d.ts +13 -0
  72. package/esm/model/profile.d.ts.map +1 -1
  73. package/esm/parser/markdown.d.ts.map +1 -1
  74. package/esm/parser/markdown.js +7 -51
  75. package/esm/profile/manifest.d.ts.map +1 -1
  76. package/esm/profile/manifest.js +20 -3
  77. package/esm/profile/merge.js +7 -0
  78. package/esm/reporter/mod.d.ts +11 -0
  79. package/esm/reporter/mod.d.ts.map +1 -1
  80. package/esm/reporter/mod.js +19 -8
  81. package/esm/typl/assemble.d.ts +53 -0
  82. package/esm/typl/assemble.d.ts.map +1 -0
  83. package/esm/typl/assemble.js +238 -0
  84. package/esm/typl/ast.d.ts +7 -1
  85. package/esm/typl/ast.d.ts.map +1 -1
  86. package/esm/typl/ast.js +3 -0
  87. package/esm/typl/bullet.d.ts +9 -7
  88. package/esm/typl/bullet.d.ts.map +1 -1
  89. package/esm/typl/bullet.js +6 -4
  90. package/esm/typl/citations.d.ts +27 -0
  91. package/esm/typl/citations.d.ts.map +1 -0
  92. package/esm/typl/citations.js +16 -0
  93. package/esm/typl/diagnostics.d.ts +2 -2
  94. package/esm/typl/diagnostics.d.ts.map +1 -1
  95. package/esm/typl/diagnostics.js +18 -0
  96. package/esm/typl/grammar.d.ts.map +1 -1
  97. package/esm/typl/grammar.js +6 -0
  98. package/esm/typl/lexer.d.ts.map +1 -1
  99. package/esm/typl/lexer.js +25 -4
  100. package/esm/typl/mod.d.ts +8 -2
  101. package/esm/typl/mod.d.ts.map +1 -1
  102. package/esm/typl/mod.js +5 -1
  103. package/esm/typl/recognize.js +2 -2
  104. package/esm/typl/registry.d.ts +1 -1
  105. package/esm/typl/resolve.d.ts +31 -0
  106. package/esm/typl/resolve.d.ts.map +1 -0
  107. package/esm/typl/resolve.js +27 -0
  108. package/esm/typl/table.d.ts +52 -0
  109. package/esm/typl/table.d.ts.map +1 -0
  110. package/esm/typl/table.js +69 -0
  111. package/esm/typl/validator.d.ts +24 -5
  112. package/esm/typl/validator.d.ts.map +1 -1
  113. package/esm/typl/validator.js +55 -75
  114. package/esm/upstream/mod.d.ts +45 -0
  115. package/esm/upstream/mod.d.ts.map +1 -0
  116. package/esm/upstream/mod.js +98 -0
  117. package/esm/upstream/project.d.ts +33 -0
  118. package/esm/upstream/project.d.ts.map +1 -0
  119. package/esm/upstream/project.js +38 -0
  120. package/esm/upstream/refs.d.ts +23 -0
  121. package/esm/upstream/refs.d.ts.map +1 -0
  122. package/esm/upstream/refs.js +71 -0
  123. package/esm/util/paths.d.ts +14 -0
  124. package/esm/util/paths.d.ts.map +1 -0
  125. package/esm/util/paths.js +22 -0
  126. package/esm/uxil/assemble.d.ts +38 -0
  127. package/esm/uxil/assemble.d.ts.map +1 -0
  128. package/esm/uxil/assemble.js +268 -0
  129. package/esm/uxil/ast.d.ts +63 -0
  130. package/esm/uxil/ast.d.ts.map +1 -0
  131. package/esm/uxil/ast.js +9 -0
  132. package/esm/uxil/citations.d.ts +27 -0
  133. package/esm/uxil/citations.d.ts.map +1 -0
  134. package/esm/uxil/citations.js +25 -0
  135. package/esm/uxil/diagnostics.d.ts +39 -0
  136. package/esm/uxil/diagnostics.d.ts.map +1 -0
  137. package/esm/uxil/diagnostics.js +135 -0
  138. package/esm/uxil/grammar.d.ts +72 -0
  139. package/esm/uxil/grammar.d.ts.map +1 -0
  140. package/esm/uxil/grammar.js +505 -0
  141. package/esm/uxil/lexer.d.ts +23 -0
  142. package/esm/uxil/lexer.d.ts.map +1 -0
  143. package/esm/uxil/lexer.js +58 -0
  144. package/esm/uxil/mod.d.ts +32 -0
  145. package/esm/uxil/mod.d.ts.map +1 -0
  146. package/esm/uxil/mod.js +11 -0
  147. package/esm/uxil/projection.d.ts +40 -0
  148. package/esm/uxil/projection.d.ts.map +1 -0
  149. package/esm/uxil/projection.js +41 -0
  150. package/esm/uxil/recognize.d.ts +16 -0
  151. package/esm/uxil/recognize.d.ts.map +1 -0
  152. package/esm/uxil/recognize.js +28 -0
  153. package/esm/uxil/registry.d.ts +37 -0
  154. package/esm/uxil/registry.d.ts.map +1 -0
  155. package/esm/uxil/registry.js +29 -0
  156. package/esm/uxil/surfaces.d.ts +36 -0
  157. package/esm/uxil/surfaces.d.ts.map +1 -0
  158. package/esm/uxil/surfaces.js +34 -0
  159. package/esm/uxil/validator.d.ts +36 -0
  160. package/esm/uxil/validator.d.ts.map +1 -0
  161. package/esm/uxil/validator.js +139 -0
  162. package/esm/uxil/vocab.d.ts +33 -0
  163. package/esm/uxil/vocab.d.ts.map +1 -0
  164. package/esm/uxil/vocab.js +36 -0
  165. package/esm/validator/caption_convention.d.ts +2 -1
  166. package/esm/validator/caption_convention.d.ts.map +1 -1
  167. package/esm/validator/caption_convention.js +2 -1
  168. package/esm/validator/corpus.d.ts.map +1 -1
  169. package/esm/validator/corpus.js +40 -17
  170. package/esm/validator/discipline.d.ts +6 -4
  171. package/esm/validator/discipline.d.ts.map +1 -1
  172. package/esm/validator/discipline.js +6 -4
  173. package/esm/validator/mod.d.ts.map +1 -1
  174. package/esm/validator/mod.js +28 -15
  175. package/esm/validator/pipeline.d.ts +11 -1
  176. package/esm/validator/pipeline.d.ts.map +1 -1
  177. package/esm/validator/pipeline.js +68 -18
  178. package/esm/validator/trace_types.d.ts +9 -2
  179. package/esm/validator/trace_types.d.ts.map +1 -1
  180. package/esm/validator/trace_types.js +21 -5
  181. package/esm/validator/traceability.d.ts +15 -3
  182. package/esm/validator/traceability.d.ts.map +1 -1
  183. package/esm/validator/traceability.js +39 -4
  184. package/esm/validator/types.d.ts.map +1 -1
  185. package/esm/validator/types.js +11 -1
  186. package/esm/validator/uxil_family.d.ts +43 -0
  187. package/esm/validator/uxil_family.d.ts.map +1 -0
  188. package/esm/validator/uxil_family.js +52 -0
  189. package/package.json +1 -1
  190. package/script/compiler/deserialize.d.ts +49 -0
  191. package/script/compiler/deserialize.d.ts.map +1 -0
  192. package/script/compiler/deserialize.js +144 -0
  193. package/script/compiler/manifest.d.ts +3 -0
  194. package/script/compiler/manifest.d.ts.map +1 -1
  195. package/script/compiler/manifest.js +10 -3
  196. package/script/compiler/mod.d.ts.map +1 -1
  197. package/script/compiler/mod.js +15 -6
  198. package/script/config/markspec.d.ts +38 -1
  199. package/script/config/markspec.d.ts.map +1 -1
  200. package/script/config/markspec.js +129 -3
  201. package/script/config/mod.d.ts.map +1 -1
  202. package/script/config/mod.js +143 -147
  203. package/script/decl/duplicates.d.ts +29 -0
  204. package/script/decl/duplicates.d.ts.map +1 -0
  205. package/script/decl/duplicates.js +31 -0
  206. package/script/decl/mod.d.ts +4 -2
  207. package/script/decl/mod.d.ts.map +1 -1
  208. package/script/decl/mod.js +4 -2
  209. package/script/decl/surfaces.d.ts +29 -7
  210. package/script/decl/surfaces.d.ts.map +1 -1
  211. package/script/decl/surfaces.js +32 -19
  212. package/script/gates/mod.d.ts +13 -2
  213. package/script/gates/mod.d.ts.map +1 -1
  214. package/script/gates/mod.js +37 -10
  215. package/script/lint/runner.d.ts.map +1 -1
  216. package/script/lint/runner.js +3 -1
  217. package/script/lock/acquire_compile.d.ts +31 -0
  218. package/script/lock/acquire_compile.d.ts.map +1 -0
  219. package/script/lock/acquire_compile.js +86 -0
  220. package/script/lock/cache_check.d.ts +28 -0
  221. package/script/lock/cache_check.d.ts.map +1 -0
  222. package/script/lock/cache_check.js +54 -0
  223. package/script/lock/check.d.ts +14 -3
  224. package/script/lock/check.d.ts.map +1 -1
  225. package/script/lock/check.js +41 -3
  226. package/script/lock/git_intent.d.ts +46 -0
  227. package/script/lock/git_intent.d.ts.map +1 -0
  228. package/script/lock/git_intent.js +115 -0
  229. package/script/lock/mod.d.ts +10 -3
  230. package/script/lock/mod.d.ts.map +1 -1
  231. package/script/lock/mod.js +16 -2
  232. package/script/lock/model.d.ts +24 -1
  233. package/script/lock/model.d.ts.map +1 -1
  234. package/script/lock/parser.d.ts.map +1 -1
  235. package/script/lock/parser.js +32 -0
  236. package/script/lock/pin_assurance.d.ts +20 -0
  237. package/script/lock/pin_assurance.d.ts.map +1 -0
  238. package/script/lock/pin_assurance.js +37 -0
  239. package/script/lock/resolve.d.ts +8 -17
  240. package/script/lock/resolve.d.ts.map +1 -1
  241. package/script/lock/resolve.js +7 -68
  242. package/script/lock/serializer.d.ts.map +1 -1
  243. package/script/lock/serializer.js +23 -0
  244. package/script/lock/upstream_common.d.ts +29 -0
  245. package/script/lock/upstream_common.d.ts.map +1 -0
  246. package/script/lock/upstream_common.js +42 -0
  247. package/script/lock/upstream_deps.d.ts +63 -0
  248. package/script/lock/upstream_deps.d.ts.map +1 -0
  249. package/script/lock/upstream_deps.js +175 -0
  250. package/script/lock/upstream_refs.d.ts +69 -0
  251. package/script/lock/upstream_refs.d.ts.map +1 -0
  252. package/script/lock/upstream_refs.js +244 -0
  253. package/script/mod.d.ts +16 -8
  254. package/script/mod.d.ts.map +1 -1
  255. package/script/mod.js +40 -7
  256. package/script/model/mod.d.ts +93 -28
  257. package/script/model/mod.d.ts.map +1 -1
  258. package/script/model/mod.js +70 -14
  259. package/script/model/profile.d.ts +13 -0
  260. package/script/model/profile.d.ts.map +1 -1
  261. package/script/parser/markdown.d.ts.map +1 -1
  262. package/script/parser/markdown.js +6 -50
  263. package/script/profile/manifest.d.ts.map +1 -1
  264. package/script/profile/manifest.js +20 -3
  265. package/script/profile/merge.js +7 -0
  266. package/script/reporter/mod.d.ts +11 -0
  267. package/script/reporter/mod.d.ts.map +1 -1
  268. package/script/reporter/mod.js +18 -7
  269. package/script/typl/assemble.d.ts +53 -0
  270. package/script/typl/assemble.d.ts.map +1 -0
  271. package/script/typl/assemble.js +241 -0
  272. package/script/typl/ast.d.ts +7 -1
  273. package/script/typl/ast.d.ts.map +1 -1
  274. package/script/typl/ast.js +3 -0
  275. package/script/typl/bullet.d.ts +9 -7
  276. package/script/typl/bullet.d.ts.map +1 -1
  277. package/script/typl/bullet.js +6 -4
  278. package/script/typl/citations.d.ts +27 -0
  279. package/script/typl/citations.d.ts.map +1 -0
  280. package/script/typl/citations.js +20 -0
  281. package/script/typl/diagnostics.d.ts +2 -2
  282. package/script/typl/diagnostics.d.ts.map +1 -1
  283. package/script/typl/diagnostics.js +18 -0
  284. package/script/typl/grammar.d.ts.map +1 -1
  285. package/script/typl/grammar.js +6 -0
  286. package/script/typl/lexer.d.ts.map +1 -1
  287. package/script/typl/lexer.js +25 -4
  288. package/script/typl/mod.d.ts +8 -2
  289. package/script/typl/mod.d.ts.map +1 -1
  290. package/script/typl/mod.js +14 -2
  291. package/script/typl/recognize.js +2 -2
  292. package/script/typl/registry.d.ts +1 -1
  293. package/script/typl/resolve.d.ts +31 -0
  294. package/script/typl/resolve.d.ts.map +1 -0
  295. package/script/typl/resolve.js +33 -0
  296. package/script/typl/table.d.ts +52 -0
  297. package/script/typl/table.d.ts.map +1 -0
  298. package/script/typl/table.js +75 -0
  299. package/script/typl/validator.d.ts +24 -5
  300. package/script/typl/validator.d.ts.map +1 -1
  301. package/script/typl/validator.js +55 -75
  302. package/script/upstream/mod.d.ts +45 -0
  303. package/script/upstream/mod.d.ts.map +1 -0
  304. package/script/upstream/mod.js +101 -0
  305. package/script/upstream/project.d.ts +33 -0
  306. package/script/upstream/project.d.ts.map +1 -0
  307. package/script/upstream/project.js +41 -0
  308. package/script/upstream/refs.d.ts +23 -0
  309. package/script/upstream/refs.d.ts.map +1 -0
  310. package/script/upstream/refs.js +74 -0
  311. package/script/util/paths.d.ts +14 -0
  312. package/script/util/paths.d.ts.map +1 -0
  313. package/script/util/paths.js +25 -0
  314. package/script/uxil/assemble.d.ts +38 -0
  315. package/script/uxil/assemble.d.ts.map +1 -0
  316. package/script/uxil/assemble.js +272 -0
  317. package/script/uxil/ast.d.ts +63 -0
  318. package/script/uxil/ast.d.ts.map +1 -0
  319. package/script/uxil/ast.js +10 -0
  320. package/script/uxil/citations.d.ts +27 -0
  321. package/script/uxil/citations.d.ts.map +1 -0
  322. package/script/uxil/citations.js +29 -0
  323. package/script/uxil/diagnostics.d.ts +39 -0
  324. package/script/uxil/diagnostics.d.ts.map +1 -0
  325. package/script/uxil/diagnostics.js +140 -0
  326. package/script/uxil/grammar.d.ts +72 -0
  327. package/script/uxil/grammar.d.ts.map +1 -0
  328. package/script/uxil/grammar.js +511 -0
  329. package/script/uxil/lexer.d.ts +23 -0
  330. package/script/uxil/lexer.d.ts.map +1 -0
  331. package/script/uxil/lexer.js +61 -0
  332. package/script/uxil/mod.d.ts +32 -0
  333. package/script/uxil/mod.d.ts.map +1 -0
  334. package/script/uxil/mod.js +37 -0
  335. package/script/uxil/projection.d.ts +40 -0
  336. package/script/uxil/projection.d.ts.map +1 -0
  337. package/script/uxil/projection.js +44 -0
  338. package/script/uxil/recognize.d.ts +16 -0
  339. package/script/uxil/recognize.d.ts.map +1 -0
  340. package/script/uxil/recognize.js +31 -0
  341. package/script/uxil/registry.d.ts +37 -0
  342. package/script/uxil/registry.d.ts.map +1 -0
  343. package/script/uxil/registry.js +32 -0
  344. package/script/uxil/surfaces.d.ts +36 -0
  345. package/script/uxil/surfaces.d.ts.map +1 -0
  346. package/script/uxil/surfaces.js +39 -0
  347. package/script/uxil/validator.d.ts +36 -0
  348. package/script/uxil/validator.d.ts.map +1 -0
  349. package/script/uxil/validator.js +142 -0
  350. package/script/uxil/vocab.d.ts +33 -0
  351. package/script/uxil/vocab.d.ts.map +1 -0
  352. package/script/uxil/vocab.js +41 -0
  353. package/script/validator/caption_convention.d.ts +2 -1
  354. package/script/validator/caption_convention.d.ts.map +1 -1
  355. package/script/validator/caption_convention.js +2 -1
  356. package/script/validator/corpus.d.ts.map +1 -1
  357. package/script/validator/corpus.js +39 -16
  358. package/script/validator/discipline.d.ts +6 -4
  359. package/script/validator/discipline.d.ts.map +1 -1
  360. package/script/validator/discipline.js +6 -4
  361. package/script/validator/mod.d.ts.map +1 -1
  362. package/script/validator/mod.js +27 -14
  363. package/script/validator/pipeline.d.ts +11 -1
  364. package/script/validator/pipeline.d.ts.map +1 -1
  365. package/script/validator/pipeline.js +67 -17
  366. package/script/validator/trace_types.d.ts +9 -2
  367. package/script/validator/trace_types.d.ts.map +1 -1
  368. package/script/validator/trace_types.js +20 -4
  369. package/script/validator/traceability.d.ts +15 -3
  370. package/script/validator/traceability.d.ts.map +1 -1
  371. package/script/validator/traceability.js +38 -3
  372. package/script/validator/types.d.ts.map +1 -1
  373. package/script/validator/types.js +10 -0
  374. package/script/validator/uxil_family.d.ts +43 -0
  375. package/script/validator/uxil_family.d.ts.map +1 -0
  376. package/script/validator/uxil_family.js +56 -0
@@ -8,7 +8,7 @@
8
8
  * - **fence** — a fenced code block whose info-string a DSL claims
9
9
  * (e.g. ```typl). {@linkcode extractFenceDeclarations}
10
10
  * - **bullet** — a list item whose first paragraph is a declaration.
11
- * {@linkcode extractBulletDeclarations}
11
+ * {@linkcode extractNestedBulletDeclarations}
12
12
  * - **inline** — a CommonMark code span whose text is a declaration.
13
13
  * {@linkcode extractInlineDeclarations}
14
14
  *
@@ -47,6 +47,15 @@ export interface InlineDeclaration {
47
47
  readonly source: string;
48
48
  /** File-relative location of the code span. */
49
49
  readonly location: SourceLocation;
50
+ /**
51
+ * Column of the span's inner text: `location.column` plus the opening
52
+ * delimiter width. A DSL host composes span-relative parse-diagnostic
53
+ * columns against this, not `location.column` (#727). Note the token
54
+ * model canonicalises `text` to single-backtick delimiters, so the
55
+ * width is 1 in practice — a double-backtick original anchors one
56
+ * column left (accepted wart, same class as the typl indent wart).
57
+ */
58
+ readonly innerColumn: number;
50
59
  }
51
60
  /** Recognizer for the fence surface: does this info-string host the DSL? */
52
61
  export type FenceRecognizer = (lang: string | undefined) => boolean;
@@ -62,15 +71,28 @@ export type TextRecognizer = (text: string) => boolean;
62
71
  * source order (depth-first traversal).
63
72
  */
64
73
  export declare function extractFenceDeclarations(blocks: readonly BodyBlock[], matchLang: FenceRecognizer): readonly BlockDeclaration[];
74
+ /**
75
+ * A bullet declaration with its structural parent: the index (into the
76
+ * returned array) of the nearest enclosing extracted declaration, or
77
+ * `undefined` at top level. Parents always precede children in the
78
+ * depth-first output order, so `parent < index` holds for every link.
79
+ * The base-resolution engine (resolve.ts) consumes these links to build
80
+ * its innermost-wins scope chains (#723).
81
+ */
82
+ export interface NestedBlockDeclaration extends BlockDeclaration {
83
+ readonly parent?: number;
84
+ }
65
85
  /**
66
86
  * Walk a body AST and return every bullet-list item whose first paragraph
67
- * satisfies `matchText`. Recurses through ListNode → ListItemNode.blocks
68
- * for nested lists. Mixed lists are supported: items whose first paragraph
69
- * matches are extracted; non-matching bullets are left alone.
70
- *
71
- * Returns declarations in source order (depth-first).
87
+ * satisfies `matchText`, in depth-first source order, each with a `parent`
88
+ * link to its nearest enclosing extracted declaration (or `undefined` at
89
+ * top level). Recurses through ListNode → ListItemNode.blocks for nested
90
+ * lists. Mixed lists are supported: items whose first paragraph matches
91
+ * are extracted; non-matching bullets are left alone. A DSL host walks
92
+ * the `parent` links to build the {@linkcode BaseScope} chain a nested
93
+ * declaration resolves against.
72
94
  */
73
- export declare function extractBulletDeclarations(blocks: readonly BodyBlock[], matchText: TextRecognizer): readonly BlockDeclaration[];
95
+ export declare function extractNestedBulletDeclarations(blocks: readonly BodyBlock[], matchText: TextRecognizer): readonly NestedBlockDeclaration[];
74
96
  /**
75
97
  * Strip the surrounding backtick delimiter(s) from an inline-code token's
76
98
  * `text` field. `body_tokens.ts` stores inline-code text as `` `value` ``
@@ -1 +1 @@
1
- {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../src/decl/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC;AAEpE,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,eAAe,GACzB,SAAS,gBAAgB,EAAE,CAY7B;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,SAAS,gBAAgB,EAAE,CAwB7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,SAAS,EAAE,cAAc,GACxB,SAAS,iBAAiB,EAAE,CAS9B"}
1
+ {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../src/decl/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC;AAEpE,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,eAAe,GACzB,SAAS,gBAAgB,EAAE,CAY7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,SAAS,sBAAsB,EAAE,CA8BnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,SAAS,EAAE,cAAc,GACxB,SAAS,iBAAiB,EAAE,CAc9B"}
@@ -9,7 +9,7 @@
9
9
  * - **fence** — a fenced code block whose info-string a DSL claims
10
10
  * (e.g. ```typl). {@linkcode extractFenceDeclarations}
11
11
  * - **bullet** — a list item whose first paragraph is a declaration.
12
- * {@linkcode extractBulletDeclarations}
12
+ * {@linkcode extractNestedBulletDeclarations}
13
13
  * - **inline** — a CommonMark code span whose text is a declaration.
14
14
  * {@linkcode extractInlineDeclarations}
15
15
  *
@@ -26,7 +26,7 @@
26
26
  */
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.extractFenceDeclarations = extractFenceDeclarations;
29
- exports.extractBulletDeclarations = extractBulletDeclarations;
29
+ exports.extractNestedBulletDeclarations = extractNestedBulletDeclarations;
30
30
  exports.stripCodeSpanDelimiters = stripCodeSpanDelimiters;
31
31
  exports.extractInlineDeclarations = extractInlineDeclarations;
32
32
  /**
@@ -54,35 +54,43 @@ function extractFenceDeclarations(blocks, matchLang) {
54
54
  }
55
55
  /**
56
56
  * Walk a body AST and return every bullet-list item whose first paragraph
57
- * satisfies `matchText`. Recurses through ListNode → ListItemNode.blocks
58
- * for nested lists. Mixed lists are supported: items whose first paragraph
59
- * matches are extracted; non-matching bullets are left alone.
60
- *
61
- * Returns declarations in source order (depth-first).
57
+ * satisfies `matchText`, in depth-first source order, each with a `parent`
58
+ * link to its nearest enclosing extracted declaration (or `undefined` at
59
+ * top level). Recurses through ListNode → ListItemNode.blocks for nested
60
+ * lists. Mixed lists are supported: items whose first paragraph matches
61
+ * are extracted; non-matching bullets are left alone. A DSL host walks
62
+ * the `parent` links to build the {@linkcode BaseScope} chain a nested
63
+ * declaration resolves against.
62
64
  */
63
- function extractBulletDeclarations(blocks, matchText) {
65
+ function extractNestedBulletDeclarations(blocks, matchText) {
64
66
  const results = [];
65
- for (const block of blocks) {
66
- if (block.kind === "list") {
67
+ const walk = (blocks, parent) => {
68
+ for (const block of blocks) {
69
+ if (block.kind !== "list")
70
+ continue;
67
71
  for (const item of block.items) {
68
72
  if (item.blocks.length === 0)
69
73
  continue;
70
74
  const first = item.blocks[0];
71
- if (first.kind === "paragraph") {
72
- if (matchText(first.content.text)) {
73
- results.push({ source: first.content.text, range: first.range });
74
- }
75
+ let itemParent = parent;
76
+ if (first.kind === "paragraph" && matchText(first.content.text)) {
77
+ results.push({
78
+ source: first.content.text,
79
+ range: first.range,
80
+ parent,
81
+ });
82
+ itemParent = results.length - 1;
75
83
  }
76
- // Recurse into nested blocks (the item may itself contain a list).
77
84
  if (item.blocks.length > 1) {
78
- results.push(...extractBulletDeclarations(item.blocks.slice(1), matchText));
85
+ walk(item.blocks.slice(1), itemParent);
79
86
  }
80
87
  else if (first.kind === "list") {
81
- results.push(...extractBulletDeclarations([first], matchText));
88
+ walk([first], itemParent);
82
89
  }
83
90
  }
84
91
  }
85
- }
92
+ };
93
+ walk(blocks, undefined);
86
94
  return results;
87
95
  }
88
96
  /**
@@ -122,7 +130,12 @@ function extractInlineDeclarations(bodyTokens, matchText) {
122
130
  const inner = stripCodeSpanDelimiters(token.text);
123
131
  if (!matchText(inner))
124
132
  continue;
125
- results.push({ source: inner, location: token.location });
133
+ const delim = token.text.startsWith("``") ? 2 : 1;
134
+ results.push({
135
+ source: inner,
136
+ location: token.location,
137
+ innerColumn: token.location.column + delim,
138
+ });
126
139
  }
127
140
  return results;
128
141
  }
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
21
21
  import type { ProseFormatter } from "../formatter/dprint.js";
22
- import { type LockEdge, type ParseLockfileResult } from "../lock/mod.js";
22
+ import { type LockEdge, type ParseLockfileResult, type ReadFile as LockReadFile } from "../lock/mod.js";
23
23
  /**
24
24
  * Format-drift gate — the `MSL-F010` (formatter drift) and `MSL-F011`
25
25
  * (reference-canonicalization drift) findings.
@@ -57,12 +57,23 @@ export declare function fmtDriftGate(mdContents: ReadonlyMap<string, string>, en
57
57
  * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
58
58
  * mirroring `markspec lock`.
59
59
  *
60
+ * Also carries the MSL-L212 offline cache-drift case (Task 9): when `cache`
61
+ * is supplied and the lockfile parsed, every snapshot-carrying upstream row
62
+ * is verified against its on-disk cache under `cache.cacheRoot` and any
63
+ * cache-drift diagnostics are appended to the edge-drift result. Offline by
64
+ * design, like the edge-drift check — no network fetch.
65
+ *
60
66
  * @param lockParse The parsed `markspec.lock` (already read from disk).
61
67
  * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
62
68
  * location so JSON consumers that group by `location.file` keep the finding.
63
69
  * @param entries The full parsed entry set; corpus entries are filtered out.
70
+ * @param cache Optional upstream cache-verification inputs. Omitted →
71
+ * backward-compatible with callers that only want the edge-drift case.
64
72
  */
65
- export declare function lockfileDriftGate(lockParse: ParseLockfileResult, lockPath: string, entries: readonly Entry[]): Promise<Diagnostic[]>;
73
+ export declare function lockfileDriftGate(lockParse: ParseLockfileResult, lockPath: string, entries: readonly Entry[], cache?: {
74
+ readonly cacheRoot: string;
75
+ readonly readFile: LockReadFile;
76
+ }): Promise<Diagnostic[]>;
66
77
  /**
67
78
  * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
68
79
  * plain {@linkcode Diagnostic}s.
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/gates/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,mBAAmB,EAAE,cAAc,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAuCvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC,CAiBvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,EAAE,CAAC,CAQvB"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/gates/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,QAAQ,IAAI,YAAY,EAE9B,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,mBAAmB,EAAE,cAAc,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAwCvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACtE,OAAO,CAAC,UAAU,EAAE,CAAC,CAwCvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,EAAE,CAAC,CAQvB"}
@@ -55,7 +55,8 @@ async function fmtDriftGate(mdContents, entries, ledger, formatMarkdownProse) {
55
55
  // Building the heal index over the full set (including corpus) would flag an
56
56
  // MSL-F011 drift that `fmt` can never fix — a permanently red gate for any
57
57
  // consumer using a delivered corpus. Filter to `!e.origin`, mirroring
58
- // lockfileDriftGate.
58
+ // lockfileDriftGate — deliberately BROADER than the validators'
59
+ // `emittableEntries` (upstream-only, #771); do not "unify" it.
59
60
  const refIndex = (0, mod_js_3.buildRefIndex)(entries.filter((e) => !e.origin));
60
61
  for (const [filePath, content] of mdContents) {
61
62
  const formatted = (0, mod_js_1.format)(content, {
@@ -98,25 +99,51 @@ async function fmtDriftGate(mdContents, entries, ledger, formatMarkdownProse) {
98
99
  * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
99
100
  * mirroring `markspec lock`.
100
101
  *
102
+ * Also carries the MSL-L212 offline cache-drift case (Task 9): when `cache`
103
+ * is supplied and the lockfile parsed, every snapshot-carrying upstream row
104
+ * is verified against its on-disk cache under `cache.cacheRoot` and any
105
+ * cache-drift diagnostics are appended to the edge-drift result. Offline by
106
+ * design, like the edge-drift check — no network fetch.
107
+ *
101
108
  * @param lockParse The parsed `markspec.lock` (already read from disk).
102
109
  * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
103
110
  * location so JSON consumers that group by `location.file` keep the finding.
104
111
  * @param entries The full parsed entry set; corpus entries are filtered out.
112
+ * @param cache Optional upstream cache-verification inputs. Omitted →
113
+ * backward-compatible with callers that only want the edge-drift case.
105
114
  */
106
- async function lockfileDriftGate(lockParse, lockPath, entries) {
115
+ async function lockfileDriftGate(lockParse, lockPath, entries, cache) {
107
116
  if (!lockParse.lockfile) {
108
117
  return [...lockParse.diagnostics];
109
118
  }
119
+ // `!e.origin` (project-owned only) — deliberately BROADER than the
120
+ // validators' `emittableEntries` partition (upstream-only, #771): the
121
+ // edge ledger records only edges the project authors.
110
122
  const projectEntries = entries.filter((e) => !e.origin);
111
123
  const drift = await (0, mod_js_4.detectOfflineEdgeDrift)(projectEntries, lockParse.lockfile.generatedCache);
112
- if (!drift.drifted)
113
- return [];
114
- return [{
115
- code: "MSL-L212",
116
- severity: "error",
117
- message: `traceability edges drifted from markspec.lock: locked ${drift.lockedCount} edge(s), current ${drift.currentCount} — run \`markspec lock\` to refresh. (After upgrading MarkSpec this can also fire once because traceability inputs now include source-file doc comments; re-running \`markspec lock\` clears it.)`,
118
- location: { file: lockPath, line: 1, column: 1 },
119
- }];
124
+ const diagnostics = drift.drifted
125
+ ? [{
126
+ code: "MSL-L212",
127
+ severity: "error",
128
+ message: `traceability edges drifted from markspec.lock: locked ${drift.lockedCount} edge(s), current ${drift.currentCount} — run \`markspec lock\` to refresh. (After upgrading MarkSpec this can also fire once because traceability inputs now include source-file doc comments; re-running \`markspec lock\` clears it.)`,
129
+ location: { file: lockPath, line: 1, column: 1 },
130
+ }]
131
+ : [];
132
+ if (cache !== undefined) {
133
+ const cacheDiags = await (0, mod_js_4.verifyUpstreamCache)(lockParse.lockfile.upstreams, cache.cacheRoot, cache.readFile);
134
+ // verifyUpstreamCache is a reusable, lockfile-path-agnostic probe and
135
+ // emits `location: undefined` (see cache_check.ts). Stamp the same
136
+ // lockfile location the sibling edge-drift MSL-L212 above uses, so both
137
+ // findings from the same `markspec.lock` group under one file for a
138
+ // JSON consumer keyed on `location.file`.
139
+ for (const d of cacheDiags) {
140
+ diagnostics.push({
141
+ ...d,
142
+ location: { file: lockPath, line: 1, column: 1 },
143
+ });
144
+ }
145
+ }
146
+ return diagnostics;
120
147
  }
121
148
  /**
122
149
  * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAKT;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA0FvE"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAKT;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA4FvE"}
@@ -120,7 +120,9 @@ async function runLint(options) {
120
120
  // Steps 1–9: collect diagnostics keyed by entry. Delivered-corpus entries
121
121
  // (`entry.origin`) are excluded from rule execution — a consumer cannot fix
122
122
  // upstream prose (ADR-030 §D4) — even though they contribute to the indexes
123
- // above.
123
+ // above. Deliberately BROADER than the validators' `emittableEntries`
124
+ // partition (upstream-only, #771): profile corpus stays structurally
125
+ // validated but is never prose-linted — do not "unify" this filter.
124
126
  const inScopeDiags = new Map();
125
127
  for (const entry of entries) {
126
128
  if (entry.origin)
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module core/lock/acquire_compile
3
+ *
4
+ * Deterministic in-process compile of an acquired dependency tree
5
+ * (design §4.3). Produces the same `manifest.json` + `compiled.json` layout
6
+ * a published `references:` site serves, so `loadUpstreamCorpus` /
7
+ * `probeCacheSnapshot` read a dependency snapshot identically to a reference
8
+ * snapshot. The output is byte-reproducible from (tree, markspec version):
9
+ * files are compiled in sorted, tree-relative order with no stat/git IO, so
10
+ * `entry.location.file`, `properties.file.path`, and entry ordering are all
11
+ * stable. Pure — every file touch flows through {@linkcode AcquireCompileIO}.
12
+ */
13
+ import { type ManifestJson } from "../compiler/manifest.js";
14
+ import { type DiscoveryIO } from "../discovery/mod.js";
15
+ export interface AcquireCompileIO {
16
+ /** Config/profile reader — returns text or undefined (core `ReadFile`). */
17
+ readonly readFile: (path: string) => Promise<string | undefined>;
18
+ /** Throwing reader compile() consumes (`(path) => Promise<string>`). */
19
+ readonly readText: (path: string) => Promise<string>;
20
+ /** Discovery seam (`{ readDir, readFile }`) — same as `denoDiscoveryIO()`. */
21
+ readonly discovery: DiscoveryIO;
22
+ }
23
+ export interface CompiledSnapshot {
24
+ readonly manifestJson: ManifestJson;
25
+ readonly compiledBytes: Uint8Array;
26
+ readonly snapshot: string;
27
+ }
28
+ export declare function compileAcquiredTree(treeRoot: string, io: AcquireCompileIO, release: string): Promise<CompiledSnapshot | {
29
+ error: string;
30
+ }>;
31
+ //# sourceMappingURL=acquire_compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acquire_compile.d.ts","sourceRoot":"","sources":["../../src/lock/acquire_compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK3E,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtE,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjE,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,gBAAgB,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA0E/C"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock/acquire_compile
4
+ *
5
+ * Deterministic in-process compile of an acquired dependency tree
6
+ * (design §4.3). Produces the same `manifest.json` + `compiled.json` layout
7
+ * a published `references:` site serves, so `loadUpstreamCorpus` /
8
+ * `probeCacheSnapshot` read a dependency snapshot identically to a reference
9
+ * snapshot. The output is byte-reproducible from (tree, markspec version):
10
+ * files are compiled in sorted, tree-relative order with no stat/git IO, so
11
+ * `entry.location.file`, `properties.file.path`, and entry ordering are all
12
+ * stable. Pure — every file touch flows through {@linkcode AcquireCompileIO}.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.compileAcquiredTree = compileAcquiredTree;
16
+ const path_1 = require("@std/path");
17
+ const mod_js_1 = require("../compiler/mod.js");
18
+ const manifest_js_1 = require("../compiler/manifest.js");
19
+ const schema_js_1 = require("../compiler/schema.js");
20
+ const mod_js_2 = require("../config/mod.js");
21
+ const markspec_js_1 = require("../config/markspec.js");
22
+ const load_js_1 = require("../profile/load.js");
23
+ const mod_js_3 = require("../discovery/mod.js");
24
+ const hash_js_1 = require("./hash.js");
25
+ async function compileAcquiredTree(treeRoot, io, release) {
26
+ // Memoize by path: loadConfig, loadProfileForCommand, and loadToolConfig
27
+ // each walk + read the same project.yaml/.markspec.yaml, so cache the
28
+ // in-flight promise per path to read each file exactly once per acquired
29
+ // tree. The tree is immutable (just fetched at a fixed sha), so a
30
+ // per-call cache is sound and deterministic.
31
+ const readCache = new Map();
32
+ const readFile = (path) => {
33
+ let pending = readCache.get(path);
34
+ if (pending === undefined) {
35
+ pending = io.readFile(path);
36
+ readCache.set(path, pending);
37
+ }
38
+ return pending;
39
+ };
40
+ const configResult = await (0, mod_js_2.loadConfig)(treeRoot, readFile);
41
+ if (!configResult) {
42
+ return { error: "dependency tree has no discoverable project.yaml" };
43
+ }
44
+ const profileResult = await (0, load_js_1.loadProfileForCommand)(treeRoot, readFile);
45
+ const profile = profileResult.chain?.effective;
46
+ const toolConfig = await (0, markspec_js_1.loadToolConfig)(treeRoot, readFile);
47
+ // Discover → relativize → normalize to POSIX separators → sort. The
48
+ // `\\`→`/` normalization is load-bearing for cross-machine determinism:
49
+ // `relative()` yields OS-native separators, so a Windows host would emit
50
+ // `docs\reqs.md` while POSIX emits `docs/reqs.md`, giving two different
51
+ // `location.file`/`properties.file.path` values → two different snapshot
52
+ // hashes for the same source → spurious MSL-L212 drift between a Windows
53
+ // and a macOS/Linux developer sharing one lockfile. Normalizing before
54
+ // the sort also makes the entry order (hence JSON key order) identical
55
+ // on every platform.
56
+ const abs = [];
57
+ for await (const f of (0, mod_js_3.discoverFiles)(treeRoot, io.discovery, {
58
+ exclude: toolConfig.config.exclude,
59
+ })) {
60
+ abs.push(f);
61
+ }
62
+ const rel = abs
63
+ .map((p) => (0, path_1.relative)(treeRoot, p).replaceAll("\\", "/"))
64
+ .sort();
65
+ // Compile with a root-resolving reader and NO stat/git callbacks →
66
+ // deterministic properties (no mtime, no contributors, relative path).
67
+ const result = await (0, mod_js_1.compile)(rel, {
68
+ readFile: (r) => io.readText((0, path_1.join)(treeRoot, r)),
69
+ profile,
70
+ });
71
+ // `root` is cosmetic here — manifest.json is not hashed (only compiled.json
72
+ // is) and lives in the gitignored cache; pass "." so no temp path leaks.
73
+ const manifestJson = (0, manifest_js_1.buildManifest)(result, configResult.config, ".", profile, release, false);
74
+ // Compact (no whitespace) rather than the CLI's pretty-printed form —
75
+ // this cache file is machine-read only (loadUpstreamCorpus /
76
+ // probeCacheSnapshot JSON.parse it), and compact output keeps
77
+ // `entry.location.file`'s tree-relative path adjacent to its `"file":`
78
+ // key with no formatting-introduced variance to reason about.
79
+ const compiled = (0, schema_js_1.serializeCompileResult)(result);
80
+ const compiledBytes = new TextEncoder().encode(JSON.stringify(compiled));
81
+ return {
82
+ manifestJson,
83
+ compiledBytes,
84
+ snapshot: await (0, hash_js_1.sha256Bytes)(compiledBytes),
85
+ };
86
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @module core/lock/cache_check
3
+ *
4
+ * Offline upstream cache-integrity check — the MSL-L212 cache-drift case
5
+ * (Task 9). For every locked upstream row that carries a `snapshot` hash
6
+ * (a federated registry or git-repository dependency), verify its cache
7
+ * under `<cacheRoot>/<id>/` is still present and hash-intact.
8
+ *
9
+ * Reuses {@linkcode probeCacheSnapshot} — the exact probe
10
+ * `resolveProjectReferences`'s keep/restore flow already uses
11
+ * (`upstream_refs.ts`, Task 5) — so `markspec check` and `markspec lock`
12
+ * never disagree on what "cache intact" means. Rows without a `snapshot`
13
+ * (legacy registry rows predating this field, or upstream kinds that never
14
+ * carry one — reference, profile) are skipped: there is nothing to verify
15
+ * offline.
16
+ *
17
+ * Pure module: file access only via the injected {@linkcode ReadFile}.
18
+ */
19
+ import type { Diagnostic } from "../model/mod.js";
20
+ import type { Upstream } from "./model.js";
21
+ import type { ReadFile } from "./resolve.js";
22
+ /**
23
+ * Verify every snapshot-carrying upstream row's cache under `cacheRoot`.
24
+ * One `MSL-L212` diagnostic per row whose cache is missing or whose
25
+ * entries-file hash no longer matches the locked `snapshot`.
26
+ */
27
+ export declare function verifyUpstreamCache(upstreams: readonly Upstream[], cacheRoot: string, readFile: ReadFile): Promise<Diagnostic[]>;
28
+ //# sourceMappingURL=cache_check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache_check.d.ts","sourceRoot":"","sources":["../../src/lock/cache_check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAa7C;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,SAAS,QAAQ,EAAE,EAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,UAAU,EAAE,CAAC,CAevB"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock/cache_check
4
+ *
5
+ * Offline upstream cache-integrity check — the MSL-L212 cache-drift case
6
+ * (Task 9). For every locked upstream row that carries a `snapshot` hash
7
+ * (a federated registry or git-repository dependency), verify its cache
8
+ * under `<cacheRoot>/<id>/` is still present and hash-intact.
9
+ *
10
+ * Reuses {@linkcode probeCacheSnapshot} — the exact probe
11
+ * `resolveProjectReferences`'s keep/restore flow already uses
12
+ * (`upstream_refs.ts`, Task 5) — so `markspec check` and `markspec lock`
13
+ * never disagree on what "cache intact" means. Rows without a `snapshot`
14
+ * (legacy registry rows predating this field, or upstream kinds that never
15
+ * carry one — reference, profile) are skipped: there is nothing to verify
16
+ * offline.
17
+ *
18
+ * Pure module: file access only via the injected {@linkcode ReadFile}.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.verifyUpstreamCache = verifyUpstreamCache;
22
+ const path_1 = require("@std/path");
23
+ const upstream_refs_js_1 = require("./upstream_refs.js");
24
+ function cacheDriftDiagnostic(id) {
25
+ return {
26
+ code: "MSL-L212",
27
+ severity: "error",
28
+ message: `upstream '${id}' cache snapshot is missing or does not match markspec.lock — run 'markspec lock'`,
29
+ location: undefined,
30
+ };
31
+ }
32
+ /**
33
+ * Verify every snapshot-carrying upstream row's cache under `cacheRoot`.
34
+ * One `MSL-L212` diagnostic per row whose cache is missing or whose
35
+ * entries-file hash no longer matches the locked `snapshot`.
36
+ */
37
+ async function verifyUpstreamCache(upstreams, cacheRoot, readFile) {
38
+ const diagnostics = [];
39
+ for (const upstream of upstreams) {
40
+ if (upstream.kind !== "registry" && upstream.kind !== "dependency") {
41
+ continue; // references/profiles never carry a cache snapshot
42
+ }
43
+ if (upstream.snapshot === undefined)
44
+ continue; // legacy row — skip
45
+ // join() at construction (#771): a template concat would mix the
46
+ // platform separator with a literal `/` — the Windows drift class
47
+ // that bit slices 2 and 4. Writer and reader must agree byte-for-byte.
48
+ const dir = (0, path_1.join)(cacheRoot, upstream.id);
49
+ const intact = await (0, upstream_refs_js_1.probeCacheSnapshot)(dir, upstream.snapshot, readFile);
50
+ if (!intact)
51
+ diagnostics.push(cacheDriftDiagnostic(upstream.id));
52
+ }
53
+ return diagnostics;
54
+ }
@@ -6,11 +6,18 @@
6
6
  * category. Pure function — no I/O.
7
7
  *
8
8
  * Drift categories:
9
- * - MSL-L202 — upstream in resolved but missing from lockfile
10
- * - MSL-L203 — upstream in lockfile but missing from resolved
9
+ * - MSL-L202 — upstream in resolved but missing from lockfile (also:
10
+ * a declared reference with no lockfile registry row)
11
+ * - MSL-L203 — upstream in lockfile but missing from resolved (also:
12
+ * a locked registry row no longer declared in project.yaml)
11
13
  * - MSL-L210 — hash mismatch (same identity, different bytes)
12
14
  * - MSL-L211 — profile resolved-version drift (npm range now resolves a different exact version)
13
15
  * - MSL-L212 — canonical edge hash drift (traceability graph changed)
16
+ *
17
+ * Federated registry rows (org `references:`) are checked by pure
18
+ * id-presence against `declaredReferenceIds` — no hash comparison.
19
+ * Content integrity for those rows is the offline cache gate (a later
20
+ * task), not this online-vs-lockfile comparison.
14
21
  */
15
22
  import type { Diagnostic } from "../model/mod.js";
16
23
  import type { Lockfile } from "./model.js";
@@ -19,6 +26,10 @@ import type { ResolvedUpstreams } from "./resolve.js";
19
26
  * Compare locked vs resolved upstreams; return one diagnostic per drift
20
27
  * case. An empty result means the lockfile is in sync with the current
21
28
  * project state.
29
+ *
30
+ * @param declaredReferenceIds - Upstream ids derived from
31
+ * `config.references` (via `deriveUpstreamId`) — the id-presence
32
+ * comparison set for federated registry rows.
22
33
  */
23
- export declare function checkDrift(locked: Lockfile, resolved: ResolvedUpstreams): Diagnostic[];
34
+ export declare function checkDrift(locked: Lockfile, resolved: ResolvedUpstreams, declaredReferenceIds: readonly string[]): Diagnostic[];
24
35
  //# sourceMappingURL=check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/lock/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAsC,MAAM,YAAY,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,QAAQ,EAChB,QAAQ,EAAE,iBAAiB,GAC1B,UAAU,EAAE,CAyHd"}
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/lock/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,QAAQ,EAIT,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,QAAQ,EAChB,QAAQ,EAAE,iBAAiB,EAC3B,oBAAoB,EAAE,SAAS,MAAM,EAAE,GACtC,UAAU,EAAE,CA0Jd"}
@@ -7,11 +7,18 @@
7
7
  * category. Pure function — no I/O.
8
8
  *
9
9
  * Drift categories:
10
- * - MSL-L202 — upstream in resolved but missing from lockfile
11
- * - MSL-L203 — upstream in lockfile but missing from resolved
10
+ * - MSL-L202 — upstream in resolved but missing from lockfile (also:
11
+ * a declared reference with no lockfile registry row)
12
+ * - MSL-L203 — upstream in lockfile but missing from resolved (also:
13
+ * a locked registry row no longer declared in project.yaml)
12
14
  * - MSL-L210 — hash mismatch (same identity, different bytes)
13
15
  * - MSL-L211 — profile resolved-version drift (npm range now resolves a different exact version)
14
16
  * - MSL-L212 — canonical edge hash drift (traceability graph changed)
17
+ *
18
+ * Federated registry rows (org `references:`) are checked by pure
19
+ * id-presence against `declaredReferenceIds` — no hash comparison.
20
+ * Content integrity for those rows is the offline cache gate (a later
21
+ * task), not this online-vs-lockfile comparison.
15
22
  */
16
23
  Object.defineProperty(exports, "__esModule", { value: true });
17
24
  exports.checkDrift = checkDrift;
@@ -19,8 +26,12 @@ exports.checkDrift = checkDrift;
19
26
  * Compare locked vs resolved upstreams; return one diagnostic per drift
20
27
  * case. An empty result means the lockfile is in sync with the current
21
28
  * project state.
29
+ *
30
+ * @param declaredReferenceIds - Upstream ids derived from
31
+ * `config.references` (via `deriveUpstreamId`) — the id-presence
32
+ * comparison set for federated registry rows.
22
33
  */
23
- function checkDrift(locked, resolved) {
34
+ function checkDrift(locked, resolved, declaredReferenceIds) {
24
35
  const diags = [];
25
36
  // -------------------------------------------------------------------------
26
37
  // References — match by slug.
@@ -116,6 +127,33 @@ function checkDrift(locked, resolved) {
116
127
  }
117
128
  }
118
129
  // -------------------------------------------------------------------------
130
+ // Federated registries — pure id-presence against declared references.
131
+ // No hash comparison: content integrity is the offline cache gate.
132
+ // -------------------------------------------------------------------------
133
+ const lockedRegistries = locked.upstreams.filter((u) => u.kind === "registry");
134
+ const lockedRegistryIds = new Set(lockedRegistries.map((r) => r.id));
135
+ for (const id of declaredReferenceIds) {
136
+ if (!lockedRegistryIds.has(id)) {
137
+ diags.push({
138
+ code: "MSL-L202",
139
+ severity: "error",
140
+ message: `declared reference '${id}' has no lockfile row — run 'markspec lock'`,
141
+ location: undefined,
142
+ });
143
+ }
144
+ }
145
+ const declaredRegistryIds = new Set(declaredReferenceIds);
146
+ for (const row of lockedRegistries) {
147
+ if (!declaredRegistryIds.has(row.id)) {
148
+ diags.push({
149
+ code: "MSL-L203",
150
+ severity: "error",
151
+ message: `locked reference '${row.id}' is no longer declared in project.yaml — run 'markspec lock'`,
152
+ location: undefined,
153
+ });
154
+ }
155
+ }
156
+ // -------------------------------------------------------------------------
119
157
  // Canonical edge hash — single comparison, MSL-L212 on mismatch.
120
158
  // -------------------------------------------------------------------------
121
159
  if (locked.generatedCache.edgesHash !== resolved.canonicalEdgeHash) {