@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
package/esm/config/mod.js CHANGED
@@ -46,6 +46,42 @@ function findLineNumber(rawYaml, fieldName) {
46
46
  return undefined;
47
47
  return rawYaml.slice(0, match.index).split("\n").length;
48
48
  }
49
+ /** `name:` must be lowercase, start with a letter, and contain only
50
+ * letters, digits, `.`, and `-` (org project schema). */
51
+ const NAME_PATTERN = /^[a-z][a-z0-9.-]*$/;
52
+ /**
53
+ * Org keys `project.yaml` accepts but never parses or acts on — free-form
54
+ * classification/metadata fields owned by the org schema, not MarkSpec.
55
+ */
56
+ const ORG_INERT_KEYS = new Set([
57
+ "$schema",
58
+ "category",
59
+ "description",
60
+ "license",
61
+ "keywords",
62
+ "labels",
63
+ "authors",
64
+ "homepage",
65
+ "bugs",
66
+ "repository",
67
+ "upstream",
68
+ "process",
69
+ "classification",
70
+ "metadata",
71
+ ]);
72
+ /** Keys `parseProjectConfig` actually parses into `ProjectConfig`. */
73
+ const PARSED_KEYS = new Set(["name", "version", "dependencies", "references"]);
74
+ /**
75
+ * Keys retired or relocated by the Task 8 closed-schema flip. Present only
76
+ * to produce an actionable migration message; the key itself is never
77
+ * accepted.
78
+ */
79
+ const MIGRATED_KEY_HINTS = {
80
+ "exclude": "has moved to .markspec.yaml (markspec tool config)",
81
+ "caption-conventions": "has moved to .markspec.yaml (markspec tool config)",
82
+ "parents": "is retired — declare a 'references:' projectRef instead",
83
+ "parent-fallback": "is retired — declare a 'references:' projectRef instead",
84
+ };
49
85
  /**
50
86
  * Parse a YAML string and validate it as a MarkSpec project configuration.
51
87
  *
@@ -82,7 +118,7 @@ export function parseProjectConfig(yaml, filePath) {
82
118
  }
83
119
  const obj = raw;
84
120
  const errors = [];
85
- // name: required string
121
+ // name: required string, matching the org name pattern
86
122
  if (obj.name === undefined || obj.name === null || obj.name === "") {
87
123
  errors.push({
88
124
  field: "name",
@@ -97,10 +133,16 @@ export function parseProjectConfig(yaml, filePath) {
97
133
  line: findLineNumber(yaml, "name"),
98
134
  });
99
135
  }
100
- // version: optional string
101
- // version: optional string
136
+ else if (!NAME_PATTERN.test(obj.name)) {
137
+ errors.push({
138
+ field: "name",
139
+ message: "must match ^[a-z][a-z0-9.-]*$ (lowercase letters, digits, '.', '-'; starts with a letter)",
140
+ line: findLineNumber(yaml, "name"),
141
+ });
142
+ }
143
+ // version: required string (org project schema)
102
144
  let version = DEFAULT_PROJECT_CONFIG.version;
103
- if (obj.version !== undefined && obj.version !== null) {
145
+ if (obj.version !== undefined && obj.version !== null && obj.version !== "") {
104
146
  if (typeof obj.version === "number") {
105
147
  console.error(`warning: ${filePath}: version is a number (${obj.version}), ` +
106
148
  `coerced to "${String(obj.version)}". ` +
@@ -108,159 +150,125 @@ export function parseProjectConfig(yaml, filePath) {
108
150
  }
109
151
  version = String(obj.version);
110
152
  }
111
- // labels: optional string[]
112
- let labels = DEFAULT_PROJECT_CONFIG.labels;
113
- if (obj.labels !== undefined && obj.labels !== null) {
114
- if (!Array.isArray(obj.labels)) {
115
- errors.push({
116
- field: "labels",
117
- message: `expected array, got ${typeof obj.labels}`,
118
- line: findLineNumber(yaml, "labels"),
119
- });
120
- }
121
- else {
122
- const bad = obj.labels.findIndex((v) => typeof v !== "string" || v === "");
123
- if (bad !== -1) {
124
- errors.push({
125
- field: `labels[${bad}]`,
126
- message: "each label must be a non-empty string",
127
- line: findLineNumber(yaml, "labels"),
128
- });
129
- }
130
- else {
131
- labels = obj.labels;
132
- }
133
- }
153
+ else {
154
+ errors.push({
155
+ field: "version",
156
+ message: "version is required (org project schema)",
157
+ line: undefined,
158
+ });
134
159
  }
135
- // parents: optional string[] of URLs
136
- let parents = DEFAULT_PROJECT_CONFIG.parents;
137
- if (obj.parents !== undefined && obj.parents !== null) {
138
- if (!Array.isArray(obj.parents)) {
160
+ // dependencies / references: optional projectRef[] (org project-manifest)
161
+ const dependencies = parseProjectRefList(obj["dependencies"], "dependencies", yaml, errors);
162
+ const references = parseProjectRefList(obj["references"], "references", yaml, errors);
163
+ // Closed-schema key classifier: every key must be one this parser reads
164
+ // (PARSED_KEYS), an org-owned free-form field MarkSpec ignores
165
+ // (ORG_INERT_KEYS), or a migrated/retired key with an actionable hint
166
+ // (MIGRATED_KEY_HINTS). Anything else is unknown to the closed schema.
167
+ for (const key of Object.keys(obj)) {
168
+ if (PARSED_KEYS.has(key) || ORG_INERT_KEYS.has(key))
169
+ continue;
170
+ const hint = MIGRATED_KEY_HINTS[key];
171
+ errors.push({
172
+ field: key,
173
+ message: hint !== undefined
174
+ ? `'${key}' ${hint}`
175
+ : `unknown key '${key}' (project.yaml follows the closed org schema ` +
176
+ `https://driftsys.github.io/schemas/project/v1.json)`,
177
+ line: findLineNumber(yaml, key),
178
+ });
179
+ }
180
+ if (errors.length > 0) {
181
+ throw new ConfigError(filePath, errors);
182
+ }
183
+ return {
184
+ name: obj.name,
185
+ version,
186
+ dependencies,
187
+ references,
188
+ };
189
+ }
190
+ // ---------------------------------------------------------------------------
191
+ // projectRef parsing (org project-manifest contract: dependencies/references)
192
+ // ---------------------------------------------------------------------------
193
+ /** Safe upstream id: single path segment, no separators or traversal. */
194
+ const PROJECT_REF_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
195
+ const PROJECT_REF_KEYS = new Set(["url", "version", "name"]);
196
+ /**
197
+ * Parse a `dependencies:` or `references:` list of projectRef objects
198
+ * (`{ url (required), version?, name? }`). Pushes field errors onto
199
+ * `errors` and returns whatever refs parsed cleanly; the caller throws
200
+ * once all fields have been checked, so a single invalid entry doesn't
201
+ * mask other unrelated errors.
202
+ */
203
+ function parseProjectRefList(value, field, yaml, errors) {
204
+ if (value === undefined || value === null)
205
+ return [];
206
+ if (!Array.isArray(value)) {
207
+ errors.push({
208
+ field,
209
+ message: "must be a list of projectRef objects ({ url, version?, name? })",
210
+ line: findLineNumber(yaml, field),
211
+ });
212
+ return [];
213
+ }
214
+ const out = [];
215
+ value.forEach((item, i) => {
216
+ if (typeof item !== "object" || item === null || Array.isArray(item)) {
139
217
  errors.push({
140
- field: "parents",
141
- message: `expected array, got ${typeof obj.parents}`,
142
- line: findLineNumber(yaml, "parents"),
218
+ field: `${field}[${i}]`,
219
+ message: "must be a mapping with a required 'url' key",
220
+ line: findLineNumber(yaml, field),
143
221
  });
222
+ return;
144
223
  }
145
- else {
146
- const bad = obj.parents.findIndex((v) => typeof v !== "string" || !isValidUrl(v));
147
- if (bad !== -1) {
224
+ const record = item;
225
+ for (const key of Object.keys(record)) {
226
+ if (!PROJECT_REF_KEYS.has(key)) {
148
227
  errors.push({
149
- field: `parents[${bad}]`,
150
- message: "each parent must be a valid URL",
151
- line: findLineNumber(yaml, "parents"),
228
+ field: `${field}[${i}]`,
229
+ message: `unknown projectRef key '${key}' (allowed: url, version, name)`,
230
+ line: findLineNumber(yaml, key),
152
231
  });
153
232
  }
154
- else {
155
- parents = obj.parents;
156
- }
157
233
  }
158
- }
159
- // parent-fallback: optional URL string
160
- let parentFallback = DEFAULT_PROJECT_CONFIG.parentFallback;
161
- const fallbackKey = "parent-fallback";
162
- if (obj[fallbackKey] !== undefined && obj[fallbackKey] !== null) {
163
- const val = obj[fallbackKey];
164
- if (typeof val !== "string" || !isValidUrl(val)) {
234
+ const url = record.url;
235
+ if (typeof url !== "string" || url.length === 0) {
165
236
  errors.push({
166
- field: "parent-fallback",
167
- message: "must be a valid URL",
168
- line: findLineNumber(yaml, "parent-fallback"),
237
+ field: `${field}[${i}].url`,
238
+ message: "projectRef requires a non-empty 'url' string",
239
+ line: findLineNumber(yaml, field),
169
240
  });
241
+ return;
170
242
  }
171
- else {
172
- parentFallback = val;
173
- }
174
- }
175
- // caption-conventions: optional mapping of keyword → "above" | "below"
176
- let captionConventions = DEFAULT_PROJECT_CONFIG.captionConventions;
177
- const captionConventionsKey = "caption-conventions";
178
- if (obj[captionConventionsKey] !== undefined &&
179
- obj[captionConventionsKey] !== null) {
180
- const raw = obj[captionConventionsKey];
181
- if (typeof raw !== "object" || Array.isArray(raw)) {
182
- errors.push({
183
- field: captionConventionsKey,
184
- message: `expected a mapping of caption-keyword: above|below, got ${Array.isArray(raw) ? "array" : typeof raw}`,
185
- line: findLineNumber(yaml, captionConventionsKey),
186
- });
187
- }
188
- else {
189
- const rawMap = raw;
190
- const VALID_KEYWORDS = new Set([
191
- "Figure",
192
- "Table",
193
- "Listing",
194
- "Feature",
195
- "Equation",
196
- "List",
197
- ]);
198
- const parsed = {};
199
- let badKey;
200
- const captionErrsBefore = errors.length;
201
- for (const [kw, pos] of Object.entries(rawMap)) {
202
- if (!VALID_KEYWORDS.has(kw)) {
203
- badKey = kw;
204
- break;
205
- }
206
- if (pos !== "above" && pos !== "below") {
207
- errors.push({
208
- field: `${captionConventionsKey}.${kw}`,
209
- message: `expected "above" or "below", got ${JSON.stringify(pos)}`,
210
- line: findLineNumber(yaml, captionConventionsKey),
211
- });
212
- continue;
213
- }
214
- parsed[kw] = pos;
215
- }
216
- if (badKey !== undefined) {
243
+ const ref = { url };
244
+ if (record.version !== undefined) {
245
+ if (typeof record.version !== "string" || record.version.length === 0) {
217
246
  errors.push({
218
- field: `${captionConventionsKey}.${badKey}`,
219
- message: `unknown caption keyword '${badKey}'; valid keywords: ${[...VALID_KEYWORDS].join(", ")}`,
220
- line: findLineNumber(yaml, captionConventionsKey),
247
+ field: `${field}[${i}].version`,
248
+ message: "must be a non-empty string when present",
249
+ line: findLineNumber(yaml, field),
221
250
  });
222
251
  }
223
- if (errors.length === captionErrsBefore) {
224
- captionConventions = parsed;
252
+ else {
253
+ ref.version = record.version;
225
254
  }
226
255
  }
227
- }
228
- // exclude: optional string[] of gitignore-syntax patterns
229
- let exclude = DEFAULT_PROJECT_CONFIG.exclude;
230
- if (obj.exclude !== undefined && obj.exclude !== null) {
231
- if (!Array.isArray(obj.exclude)) {
232
- errors.push({
233
- field: "exclude",
234
- message: `expected array, got ${typeof obj.exclude}`,
235
- line: findLineNumber(yaml, "exclude"),
236
- });
237
- }
238
- else {
239
- const bad = obj.exclude.findIndex((v) => typeof v !== "string" || v === "");
240
- if (bad !== -1) {
256
+ if (record.name !== undefined) {
257
+ if (typeof record.name !== "string" ||
258
+ !PROJECT_REF_NAME_RE.test(record.name)) {
241
259
  errors.push({
242
- field: `exclude[${bad}]`,
243
- message: "each exclude pattern must be a non-empty string",
244
- line: findLineNumber(yaml, "exclude"),
260
+ field: `${field}[${i}].name`,
261
+ message: "must match [A-Za-z0-9][A-Za-z0-9._-]* (used as a cache directory name)",
262
+ line: findLineNumber(yaml, field),
245
263
  });
246
264
  }
247
265
  else {
248
- exclude = obj.exclude;
266
+ ref.name = record.name;
249
267
  }
250
268
  }
251
- }
252
- if (errors.length > 0) {
253
- throw new ConfigError(filePath, errors);
254
- }
255
- return {
256
- name: obj.name,
257
- version,
258
- labels,
259
- parents,
260
- parentFallback,
261
- captionConventions,
262
- exclude,
263
- };
269
+ out.push(ref);
270
+ });
271
+ return out;
264
272
  }
265
273
  // ---------------------------------------------------------------------------
266
274
  // Domain derivation
@@ -308,15 +316,3 @@ export async function loadConfig(startDir, readFile) {
308
316
  const config = parseProjectConfig(content, configPath);
309
317
  return { config, projectRoot: root, configPath };
310
318
  }
311
- // ---------------------------------------------------------------------------
312
- // Helpers
313
- // ---------------------------------------------------------------------------
314
- function isValidUrl(value) {
315
- try {
316
- new URL(value);
317
- return true;
318
- }
319
- catch {
320
- return false;
321
- }
322
- }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @module core/decl/duplicates
3
+ *
4
+ * DSL-agnostic "declared exactly once" scan over a corpus-wide registry
5
+ * (uxil epic #717 §A, #754). Both typl's dotted-name bindings (TYPL-009)
6
+ * and uxil's own registry (#726) need the identical shape: a
7
+ * `Map<name, T[]>` where any name with more than one declaration is a
8
+ * violation. The engine only counts and groups — the DSL host supplies
9
+ * the registry, narrows which names to check via `predicate`, and maps
10
+ * each {@linkcode DuplicateDeclaration} to its own diagnostic code.
11
+ */
12
+ /**
13
+ * One corpus-wide multiple-declaration violation: `name` was declared
14
+ * more than once. `first` is the earliest declaration (registry
15
+ * insertion order); `duplicates` are the rest, in the same order.
16
+ */
17
+ export interface DuplicateDeclaration<T> {
18
+ readonly name: string;
19
+ readonly first: T;
20
+ readonly duplicates: readonly T[];
21
+ }
22
+ /**
23
+ * Scan `registry` for names declared more than once. Returns one entry
24
+ * per offending name, in `registry`'s iteration order. `predicate`
25
+ * narrows which names are checked at all (e.g. typl's "only dotted,
26
+ * published names" rule); defaults to checking every name.
27
+ */
28
+ export declare function findDuplicateDeclarations<T>(registry: ReadonlyMap<string, readonly T[]>, predicate?: (name: string) => boolean): readonly DuplicateDeclaration<T>[];
29
+ //# sourceMappingURL=duplicates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicates.d.ts","sourceRoot":"","sources":["../../src/decl/duplicates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EACzC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,EAC3C,SAAS,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAoB,GAChD,SAAS,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAQpC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @module core/decl/duplicates
3
+ *
4
+ * DSL-agnostic "declared exactly once" scan over a corpus-wide registry
5
+ * (uxil epic #717 §A, #754). Both typl's dotted-name bindings (TYPL-009)
6
+ * and uxil's own registry (#726) need the identical shape: a
7
+ * `Map<name, T[]>` where any name with more than one declaration is a
8
+ * violation. The engine only counts and groups — the DSL host supplies
9
+ * the registry, narrows which names to check via `predicate`, and maps
10
+ * each {@linkcode DuplicateDeclaration} to its own diagnostic code.
11
+ */
12
+ /**
13
+ * Scan `registry` for names declared more than once. Returns one entry
14
+ * per offending name, in `registry`'s iteration order. `predicate`
15
+ * narrows which names are checked at all (e.g. typl's "only dotted,
16
+ * published names" rule); defaults to checking every name.
17
+ */
18
+ export function findDuplicateDeclarations(registry, predicate = () => true) {
19
+ const out = [];
20
+ for (const [name, decls] of registry) {
21
+ if (decls.length < 2)
22
+ continue;
23
+ if (!predicate(name))
24
+ continue;
25
+ out.push({ name, first: decls[0], duplicates: decls.slice(1) });
26
+ }
27
+ return out;
28
+ }
package/esm/decl/mod.d.ts CHANGED
@@ -9,10 +9,12 @@
9
9
  * against the base an enclosing declaration establishes. typl consumes
10
10
  * these today; uxil (§B) rides on the same substrate.
11
11
  */
12
- export type { BlockDeclaration, FenceRecognizer, InlineDeclaration, TextRecognizer, } from "./surfaces.js";
13
- export { extractBulletDeclarations, extractFenceDeclarations, extractInlineDeclarations, stripCodeSpanDelimiters, } from "./surfaces.js";
12
+ export type { BlockDeclaration, FenceRecognizer, InlineDeclaration, NestedBlockDeclaration, TextRecognizer, } from "./surfaces.js";
13
+ export { extractFenceDeclarations, extractInlineDeclarations, extractNestedBulletDeclarations, stripCodeSpanDelimiters, } from "./surfaces.js";
14
14
  export type { RowRecognizer, TableRowDeclaration } from "./table.js";
15
15
  export { extractTableDeclarations } from "./table.js";
16
16
  export type { BaseScope, RefOps, RefResolution, RootCheck } from "./resolve.js";
17
17
  export { checkSingleRoot, resolveRef } from "./resolve.js";
18
+ export type { DuplicateDeclaration } from "./duplicates.js";
19
+ export { findDuplicateDeclarations } from "./duplicates.js";
18
20
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/decl/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/decl/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC"}
package/esm/decl/mod.js CHANGED
@@ -9,6 +9,7 @@
9
9
  * against the base an enclosing declaration establishes. typl consumes
10
10
  * these today; uxil (§B) rides on the same substrate.
11
11
  */
12
- export { extractBulletDeclarations, extractFenceDeclarations, extractInlineDeclarations, stripCodeSpanDelimiters, } from "./surfaces.js";
12
+ export { extractFenceDeclarations, extractInlineDeclarations, extractNestedBulletDeclarations, stripCodeSpanDelimiters, } from "./surfaces.js";
13
13
  export { extractTableDeclarations } from "./table.js";
14
14
  export { checkSingleRoot, resolveRef } from "./resolve.js";
15
+ export { findDuplicateDeclarations } from "./duplicates.js";
@@ -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"}
@@ -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
  *
@@ -48,35 +48,43 @@ export function extractFenceDeclarations(blocks, matchLang) {
48
48
  }
49
49
  /**
50
50
  * Walk a body AST and return every bullet-list item whose first paragraph
51
- * satisfies `matchText`. Recurses through ListNode → ListItemNode.blocks
52
- * for nested lists. Mixed lists are supported: items whose first paragraph
53
- * matches are extracted; non-matching bullets are left alone.
54
- *
55
- * Returns declarations in source order (depth-first).
51
+ * satisfies `matchText`, in depth-first source order, each with a `parent`
52
+ * link to its nearest enclosing extracted declaration (or `undefined` at
53
+ * top level). Recurses through ListNode → ListItemNode.blocks for nested
54
+ * lists. Mixed lists are supported: items whose first paragraph matches
55
+ * are extracted; non-matching bullets are left alone. A DSL host walks
56
+ * the `parent` links to build the {@linkcode BaseScope} chain a nested
57
+ * declaration resolves against.
56
58
  */
57
- export function extractBulletDeclarations(blocks, matchText) {
59
+ export function extractNestedBulletDeclarations(blocks, matchText) {
58
60
  const results = [];
59
- for (const block of blocks) {
60
- if (block.kind === "list") {
61
+ const walk = (blocks, parent) => {
62
+ for (const block of blocks) {
63
+ if (block.kind !== "list")
64
+ continue;
61
65
  for (const item of block.items) {
62
66
  if (item.blocks.length === 0)
63
67
  continue;
64
68
  const first = item.blocks[0];
65
- if (first.kind === "paragraph") {
66
- if (matchText(first.content.text)) {
67
- results.push({ source: first.content.text, range: first.range });
68
- }
69
+ let itemParent = parent;
70
+ if (first.kind === "paragraph" && matchText(first.content.text)) {
71
+ results.push({
72
+ source: first.content.text,
73
+ range: first.range,
74
+ parent,
75
+ });
76
+ itemParent = results.length - 1;
69
77
  }
70
- // Recurse into nested blocks (the item may itself contain a list).
71
78
  if (item.blocks.length > 1) {
72
- results.push(...extractBulletDeclarations(item.blocks.slice(1), matchText));
79
+ walk(item.blocks.slice(1), itemParent);
73
80
  }
74
81
  else if (first.kind === "list") {
75
- results.push(...extractBulletDeclarations([first], matchText));
82
+ walk([first], itemParent);
76
83
  }
77
84
  }
78
85
  }
79
- }
86
+ };
87
+ walk(blocks, undefined);
80
88
  return results;
81
89
  }
82
90
  /**
@@ -116,7 +124,12 @@ export function extractInlineDeclarations(bodyTokens, matchText) {
116
124
  const inner = stripCodeSpanDelimiters(token.text);
117
125
  if (!matchText(inner))
118
126
  continue;
119
- results.push({ source: inner, location: token.location });
127
+ const delim = token.text.startsWith("``") ? 2 : 1;
128
+ results.push({
129
+ source: inner,
130
+ location: token.location,
131
+ innerColumn: token.location.column + delim,
132
+ });
120
133
  }
121
134
  return results;
122
135
  }
@@ -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"}