@driftsys/markspec 0.10.3 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. package/README.md +11 -2
  2. package/esm/ast/normalize.d.ts +4 -5
  3. package/esm/ast/normalize.d.ts.map +1 -1
  4. package/esm/ast/normalize.js +6 -37
  5. package/esm/collect/mod.d.ts +29 -9
  6. package/esm/collect/mod.d.ts.map +1 -1
  7. package/esm/collect/mod.js +36 -10
  8. package/esm/compiler/deserialize.d.ts +49 -0
  9. package/esm/compiler/deserialize.d.ts.map +1 -0
  10. package/esm/compiler/deserialize.js +139 -0
  11. package/esm/compiler/manifest.d.ts +3 -0
  12. package/esm/compiler/manifest.d.ts.map +1 -1
  13. package/esm/compiler/manifest.js +9 -3
  14. package/esm/compiler/mod.d.ts.map +1 -1
  15. package/esm/compiler/mod.js +18 -13
  16. package/esm/config/markspec.d.ts +40 -1
  17. package/esm/config/markspec.d.ts.map +1 -1
  18. package/esm/config/markspec.js +127 -2
  19. package/esm/config/mod.d.ts.map +1 -1
  20. package/esm/config/mod.js +143 -147
  21. package/esm/decl/duplicates.d.ts +29 -0
  22. package/esm/decl/duplicates.d.ts.map +1 -0
  23. package/esm/decl/duplicates.js +28 -0
  24. package/esm/decl/mod.d.ts +4 -2
  25. package/esm/decl/mod.d.ts.map +1 -1
  26. package/esm/decl/mod.js +2 -1
  27. package/esm/decl/surfaces.d.ts +29 -7
  28. package/esm/decl/surfaces.d.ts.map +1 -1
  29. package/esm/decl/surfaces.js +31 -18
  30. package/esm/discovery/mod.d.ts +24 -8
  31. package/esm/discovery/mod.d.ts.map +1 -1
  32. package/esm/discovery/mod.js +57 -21
  33. package/esm/discovery/projects.d.ts +109 -0
  34. package/esm/discovery/projects.d.ts.map +1 -0
  35. package/esm/discovery/projects.js +232 -0
  36. package/esm/formatter/entry_body.d.ts +86 -0
  37. package/esm/formatter/entry_body.d.ts.map +1 -0
  38. package/esm/formatter/entry_body.js +287 -0
  39. package/esm/formatter/mod.d.ts +13 -9
  40. package/esm/formatter/mod.d.ts.map +1 -1
  41. package/esm/formatter/mod.js +126 -50
  42. package/esm/gates/mod.d.ts +13 -2
  43. package/esm/gates/mod.d.ts.map +1 -1
  44. package/esm/gates/mod.js +41 -13
  45. package/esm/lint/runner.d.ts.map +1 -1
  46. package/esm/lint/runner.js +7 -5
  47. package/esm/lock/acquire_compile.d.ts +31 -0
  48. package/esm/lock/acquire_compile.d.ts.map +1 -0
  49. package/esm/lock/acquire_compile.js +83 -0
  50. package/esm/lock/cache_check.d.ts +28 -0
  51. package/esm/lock/cache_check.d.ts.map +1 -0
  52. package/esm/lock/cache_check.js +51 -0
  53. package/esm/lock/check.d.ts +14 -3
  54. package/esm/lock/check.d.ts.map +1 -1
  55. package/esm/lock/check.js +43 -4
  56. package/esm/lock/edge_drift.d.ts +2 -0
  57. package/esm/lock/edge_drift.d.ts.map +1 -1
  58. package/esm/lock/edge_drift.js +4 -0
  59. package/esm/lock/git_intent.d.ts +46 -0
  60. package/esm/lock/git_intent.d.ts.map +1 -0
  61. package/esm/lock/git_intent.js +111 -0
  62. package/esm/lock/mod.d.ts +11 -4
  63. package/esm/lock/mod.d.ts.map +1 -1
  64. package/esm/lock/mod.js +8 -2
  65. package/esm/lock/model.d.ts +24 -1
  66. package/esm/lock/model.d.ts.map +1 -1
  67. package/esm/lock/parser.d.ts.map +1 -1
  68. package/esm/lock/parser.js +32 -0
  69. package/esm/lock/pin_assurance.d.ts +20 -0
  70. package/esm/lock/pin_assurance.d.ts.map +1 -0
  71. package/esm/lock/pin_assurance.js +34 -0
  72. package/esm/lock/resolve.d.ts +8 -17
  73. package/esm/lock/resolve.d.ts.map +1 -1
  74. package/esm/lock/resolve.js +7 -67
  75. package/esm/lock/serializer.d.ts.map +1 -1
  76. package/esm/lock/serializer.js +23 -0
  77. package/esm/lock/upstream_common.d.ts +29 -0
  78. package/esm/lock/upstream_common.d.ts.map +1 -0
  79. package/esm/lock/upstream_common.js +38 -0
  80. package/esm/lock/upstream_deps.d.ts +63 -0
  81. package/esm/lock/upstream_deps.d.ts.map +1 -0
  82. package/esm/lock/upstream_deps.js +172 -0
  83. package/esm/lock/upstream_refs.d.ts +69 -0
  84. package/esm/lock/upstream_refs.d.ts.map +1 -0
  85. package/esm/lock/upstream_refs.js +238 -0
  86. package/esm/mod.d.ts +23 -11
  87. package/esm/mod.d.ts.map +1 -1
  88. package/esm/mod.js +20 -8
  89. package/esm/model/mod.d.ts +114 -28
  90. package/esm/model/mod.d.ts.map +1 -1
  91. package/esm/model/mod.js +76 -13
  92. package/esm/model/profile.d.ts +13 -0
  93. package/esm/model/profile.d.ts.map +1 -1
  94. package/esm/parser/code_regions.d.ts +29 -0
  95. package/esm/parser/code_regions.d.ts.map +1 -0
  96. package/esm/parser/code_regions.js +38 -0
  97. package/esm/parser/markdown.d.ts.map +1 -1
  98. package/esm/parser/markdown.js +110 -91
  99. package/esm/parser/mod.d.ts.map +1 -1
  100. package/esm/parser/mod.js +7 -1
  101. package/esm/parser/translate.d.ts.map +1 -1
  102. package/esm/parser/translate.js +5 -0
  103. package/esm/profile/manifest.d.ts.map +1 -1
  104. package/esm/profile/manifest.js +20 -3
  105. package/esm/profile/merge.js +7 -0
  106. package/esm/refs/mod.d.ts.map +1 -1
  107. package/esm/refs/mod.js +8 -19
  108. package/esm/reporter/mod.d.ts +11 -0
  109. package/esm/reporter/mod.d.ts.map +1 -1
  110. package/esm/reporter/mod.js +20 -9
  111. package/esm/typl/assemble.d.ts +53 -0
  112. package/esm/typl/assemble.d.ts.map +1 -0
  113. package/esm/typl/assemble.js +238 -0
  114. package/esm/typl/ast.d.ts +7 -1
  115. package/esm/typl/ast.d.ts.map +1 -1
  116. package/esm/typl/ast.js +3 -0
  117. package/esm/typl/bullet.d.ts +9 -7
  118. package/esm/typl/bullet.d.ts.map +1 -1
  119. package/esm/typl/bullet.js +6 -4
  120. package/esm/typl/citations.d.ts +27 -0
  121. package/esm/typl/citations.d.ts.map +1 -0
  122. package/esm/typl/citations.js +16 -0
  123. package/esm/typl/diagnostics.d.ts +2 -2
  124. package/esm/typl/diagnostics.d.ts.map +1 -1
  125. package/esm/typl/diagnostics.js +18 -0
  126. package/esm/typl/grammar.d.ts.map +1 -1
  127. package/esm/typl/grammar.js +6 -0
  128. package/esm/typl/lexer.d.ts.map +1 -1
  129. package/esm/typl/lexer.js +25 -4
  130. package/esm/typl/mod.d.ts +8 -2
  131. package/esm/typl/mod.d.ts.map +1 -1
  132. package/esm/typl/mod.js +5 -1
  133. package/esm/typl/recognize.js +2 -2
  134. package/esm/typl/registry.d.ts +1 -1
  135. package/esm/typl/resolve.d.ts +31 -0
  136. package/esm/typl/resolve.d.ts.map +1 -0
  137. package/esm/typl/resolve.js +27 -0
  138. package/esm/typl/table.d.ts +52 -0
  139. package/esm/typl/table.d.ts.map +1 -0
  140. package/esm/typl/table.js +69 -0
  141. package/esm/typl/validator.d.ts +24 -5
  142. package/esm/typl/validator.d.ts.map +1 -1
  143. package/esm/typl/validator.js +55 -75
  144. package/esm/upstream/mod.d.ts +45 -0
  145. package/esm/upstream/mod.d.ts.map +1 -0
  146. package/esm/upstream/mod.js +98 -0
  147. package/esm/upstream/project.d.ts +33 -0
  148. package/esm/upstream/project.d.ts.map +1 -0
  149. package/esm/upstream/project.js +38 -0
  150. package/esm/upstream/refs.d.ts +23 -0
  151. package/esm/upstream/refs.d.ts.map +1 -0
  152. package/esm/upstream/refs.js +71 -0
  153. package/esm/util/fence.d.ts +20 -29
  154. package/esm/util/fence.d.ts.map +1 -1
  155. package/esm/util/fence.js +42 -50
  156. package/esm/util/modals.d.ts +6 -0
  157. package/esm/util/modals.d.ts.map +1 -1
  158. package/esm/util/modals.js +37 -0
  159. package/esm/util/paths.d.ts +14 -0
  160. package/esm/util/paths.d.ts.map +1 -0
  161. package/esm/util/paths.js +22 -0
  162. package/esm/uxil/assemble.d.ts +38 -0
  163. package/esm/uxil/assemble.d.ts.map +1 -0
  164. package/esm/uxil/assemble.js +268 -0
  165. package/esm/uxil/ast.d.ts +63 -0
  166. package/esm/uxil/ast.d.ts.map +1 -0
  167. package/esm/uxil/ast.js +9 -0
  168. package/esm/uxil/citations.d.ts +27 -0
  169. package/esm/uxil/citations.d.ts.map +1 -0
  170. package/esm/uxil/citations.js +25 -0
  171. package/esm/uxil/diagnostics.d.ts +39 -0
  172. package/esm/uxil/diagnostics.d.ts.map +1 -0
  173. package/esm/uxil/diagnostics.js +135 -0
  174. package/esm/uxil/grammar.d.ts +72 -0
  175. package/esm/uxil/grammar.d.ts.map +1 -0
  176. package/esm/uxil/grammar.js +505 -0
  177. package/esm/uxil/lexer.d.ts +23 -0
  178. package/esm/uxil/lexer.d.ts.map +1 -0
  179. package/esm/uxil/lexer.js +58 -0
  180. package/esm/uxil/mod.d.ts +32 -0
  181. package/esm/uxil/mod.d.ts.map +1 -0
  182. package/esm/uxil/mod.js +11 -0
  183. package/esm/uxil/projection.d.ts +40 -0
  184. package/esm/uxil/projection.d.ts.map +1 -0
  185. package/esm/uxil/projection.js +41 -0
  186. package/esm/uxil/recognize.d.ts +16 -0
  187. package/esm/uxil/recognize.d.ts.map +1 -0
  188. package/esm/uxil/recognize.js +28 -0
  189. package/esm/uxil/registry.d.ts +37 -0
  190. package/esm/uxil/registry.d.ts.map +1 -0
  191. package/esm/uxil/registry.js +29 -0
  192. package/esm/uxil/surfaces.d.ts +36 -0
  193. package/esm/uxil/surfaces.d.ts.map +1 -0
  194. package/esm/uxil/surfaces.js +34 -0
  195. package/esm/uxil/validator.d.ts +36 -0
  196. package/esm/uxil/validator.d.ts.map +1 -0
  197. package/esm/uxil/validator.js +139 -0
  198. package/esm/uxil/vocab.d.ts +33 -0
  199. package/esm/uxil/vocab.d.ts.map +1 -0
  200. package/esm/uxil/vocab.js +36 -0
  201. package/esm/validator/body_blocks.d.ts +2 -1
  202. package/esm/validator/body_blocks.d.ts.map +1 -1
  203. package/esm/validator/body_blocks.js +80 -2
  204. package/esm/validator/caption_convention.d.ts +2 -1
  205. package/esm/validator/caption_convention.d.ts.map +1 -1
  206. package/esm/validator/caption_convention.js +2 -1
  207. package/esm/validator/corpus.d.ts +6 -0
  208. package/esm/validator/corpus.d.ts.map +1 -1
  209. package/esm/validator/corpus.js +55 -20
  210. package/esm/validator/discipline.d.ts +6 -4
  211. package/esm/validator/discipline.d.ts.map +1 -1
  212. package/esm/validator/discipline.js +6 -4
  213. package/esm/validator/mod.d.ts +1 -1
  214. package/esm/validator/mod.d.ts.map +1 -1
  215. package/esm/validator/mod.js +29 -16
  216. package/esm/validator/pipeline.d.ts +11 -1
  217. package/esm/validator/pipeline.d.ts.map +1 -1
  218. package/esm/validator/pipeline.js +76 -23
  219. package/esm/validator/trace_types.d.ts +9 -2
  220. package/esm/validator/trace_types.d.ts.map +1 -1
  221. package/esm/validator/trace_types.js +21 -5
  222. package/esm/validator/traceability.d.ts +15 -3
  223. package/esm/validator/traceability.d.ts.map +1 -1
  224. package/esm/validator/traceability.js +39 -4
  225. package/esm/validator/types.d.ts.map +1 -1
  226. package/esm/validator/types.js +11 -1
  227. package/esm/validator/uxil_family.d.ts +43 -0
  228. package/esm/validator/uxil_family.d.ts.map +1 -0
  229. package/esm/validator/uxil_family.js +52 -0
  230. package/package.json +1 -1
  231. package/script/ast/normalize.d.ts +4 -5
  232. package/script/ast/normalize.d.ts.map +1 -1
  233. package/script/ast/normalize.js +5 -36
  234. package/script/collect/mod.d.ts +29 -9
  235. package/script/collect/mod.d.ts.map +1 -1
  236. package/script/collect/mod.js +38 -10
  237. package/script/compiler/deserialize.d.ts +49 -0
  238. package/script/compiler/deserialize.d.ts.map +1 -0
  239. package/script/compiler/deserialize.js +144 -0
  240. package/script/compiler/manifest.d.ts +3 -0
  241. package/script/compiler/manifest.d.ts.map +1 -1
  242. package/script/compiler/manifest.js +10 -3
  243. package/script/compiler/mod.d.ts.map +1 -1
  244. package/script/compiler/mod.js +16 -11
  245. package/script/config/markspec.d.ts +40 -1
  246. package/script/config/markspec.d.ts.map +1 -1
  247. package/script/config/markspec.js +129 -3
  248. package/script/config/mod.d.ts.map +1 -1
  249. package/script/config/mod.js +143 -147
  250. package/script/decl/duplicates.d.ts +29 -0
  251. package/script/decl/duplicates.d.ts.map +1 -0
  252. package/script/decl/duplicates.js +31 -0
  253. package/script/decl/mod.d.ts +4 -2
  254. package/script/decl/mod.d.ts.map +1 -1
  255. package/script/decl/mod.js +4 -2
  256. package/script/decl/surfaces.d.ts +29 -7
  257. package/script/decl/surfaces.d.ts.map +1 -1
  258. package/script/decl/surfaces.js +32 -19
  259. package/script/discovery/mod.d.ts +24 -8
  260. package/script/discovery/mod.d.ts.map +1 -1
  261. package/script/discovery/mod.js +56 -20
  262. package/script/discovery/projects.d.ts +109 -0
  263. package/script/discovery/projects.d.ts.map +1 -0
  264. package/script/discovery/projects.js +240 -0
  265. package/script/formatter/entry_body.d.ts +86 -0
  266. package/script/formatter/entry_body.d.ts.map +1 -0
  267. package/script/formatter/entry_body.js +292 -0
  268. package/script/formatter/mod.d.ts +13 -9
  269. package/script/formatter/mod.d.ts.map +1 -1
  270. package/script/formatter/mod.js +124 -48
  271. package/script/gates/mod.d.ts +13 -2
  272. package/script/gates/mod.d.ts.map +1 -1
  273. package/script/gates/mod.js +50 -22
  274. package/script/lint/runner.d.ts.map +1 -1
  275. package/script/lint/runner.js +6 -4
  276. package/script/lock/acquire_compile.d.ts +31 -0
  277. package/script/lock/acquire_compile.d.ts.map +1 -0
  278. package/script/lock/acquire_compile.js +86 -0
  279. package/script/lock/cache_check.d.ts +28 -0
  280. package/script/lock/cache_check.d.ts.map +1 -0
  281. package/script/lock/cache_check.js +54 -0
  282. package/script/lock/check.d.ts +14 -3
  283. package/script/lock/check.d.ts.map +1 -1
  284. package/script/lock/check.js +43 -4
  285. package/script/lock/edge_drift.d.ts +2 -0
  286. package/script/lock/edge_drift.d.ts.map +1 -1
  287. package/script/lock/edge_drift.js +5 -0
  288. package/script/lock/git_intent.d.ts +46 -0
  289. package/script/lock/git_intent.d.ts.map +1 -0
  290. package/script/lock/git_intent.js +115 -0
  291. package/script/lock/mod.d.ts +11 -4
  292. package/script/lock/mod.d.ts.map +1 -1
  293. package/script/lock/mod.js +17 -2
  294. package/script/lock/model.d.ts +24 -1
  295. package/script/lock/model.d.ts.map +1 -1
  296. package/script/lock/parser.d.ts.map +1 -1
  297. package/script/lock/parser.js +32 -0
  298. package/script/lock/pin_assurance.d.ts +20 -0
  299. package/script/lock/pin_assurance.d.ts.map +1 -0
  300. package/script/lock/pin_assurance.js +37 -0
  301. package/script/lock/resolve.d.ts +8 -17
  302. package/script/lock/resolve.d.ts.map +1 -1
  303. package/script/lock/resolve.js +7 -68
  304. package/script/lock/serializer.d.ts.map +1 -1
  305. package/script/lock/serializer.js +23 -0
  306. package/script/lock/upstream_common.d.ts +29 -0
  307. package/script/lock/upstream_common.d.ts.map +1 -0
  308. package/script/lock/upstream_common.js +42 -0
  309. package/script/lock/upstream_deps.d.ts +63 -0
  310. package/script/lock/upstream_deps.d.ts.map +1 -0
  311. package/script/lock/upstream_deps.js +175 -0
  312. package/script/lock/upstream_refs.d.ts +69 -0
  313. package/script/lock/upstream_refs.d.ts.map +1 -0
  314. package/script/lock/upstream_refs.js +244 -0
  315. package/script/mod.d.ts +23 -11
  316. package/script/mod.d.ts.map +1 -1
  317. package/script/mod.js +55 -7
  318. package/script/model/mod.d.ts +114 -28
  319. package/script/model/mod.d.ts.map +1 -1
  320. package/script/model/mod.js +81 -14
  321. package/script/model/profile.d.ts +13 -0
  322. package/script/model/profile.d.ts.map +1 -1
  323. package/script/parser/code_regions.d.ts +29 -0
  324. package/script/parser/code_regions.d.ts.map +1 -0
  325. package/script/parser/code_regions.js +41 -0
  326. package/script/parser/markdown.d.ts.map +1 -1
  327. package/script/parser/markdown.js +108 -89
  328. package/script/parser/mod.d.ts.map +1 -1
  329. package/script/parser/mod.js +7 -1
  330. package/script/parser/translate.d.ts.map +1 -1
  331. package/script/parser/translate.js +5 -0
  332. package/script/profile/manifest.d.ts.map +1 -1
  333. package/script/profile/manifest.js +20 -3
  334. package/script/profile/merge.js +7 -0
  335. package/script/refs/mod.d.ts.map +1 -1
  336. package/script/refs/mod.js +7 -18
  337. package/script/reporter/mod.d.ts +11 -0
  338. package/script/reporter/mod.d.ts.map +1 -1
  339. package/script/reporter/mod.js +19 -8
  340. package/script/typl/assemble.d.ts +53 -0
  341. package/script/typl/assemble.d.ts.map +1 -0
  342. package/script/typl/assemble.js +241 -0
  343. package/script/typl/ast.d.ts +7 -1
  344. package/script/typl/ast.d.ts.map +1 -1
  345. package/script/typl/ast.js +3 -0
  346. package/script/typl/bullet.d.ts +9 -7
  347. package/script/typl/bullet.d.ts.map +1 -1
  348. package/script/typl/bullet.js +6 -4
  349. package/script/typl/citations.d.ts +27 -0
  350. package/script/typl/citations.d.ts.map +1 -0
  351. package/script/typl/citations.js +20 -0
  352. package/script/typl/diagnostics.d.ts +2 -2
  353. package/script/typl/diagnostics.d.ts.map +1 -1
  354. package/script/typl/diagnostics.js +18 -0
  355. package/script/typl/grammar.d.ts.map +1 -1
  356. package/script/typl/grammar.js +6 -0
  357. package/script/typl/lexer.d.ts.map +1 -1
  358. package/script/typl/lexer.js +25 -4
  359. package/script/typl/mod.d.ts +8 -2
  360. package/script/typl/mod.d.ts.map +1 -1
  361. package/script/typl/mod.js +14 -2
  362. package/script/typl/recognize.js +2 -2
  363. package/script/typl/registry.d.ts +1 -1
  364. package/script/typl/resolve.d.ts +31 -0
  365. package/script/typl/resolve.d.ts.map +1 -0
  366. package/script/typl/resolve.js +33 -0
  367. package/script/typl/table.d.ts +52 -0
  368. package/script/typl/table.d.ts.map +1 -0
  369. package/script/typl/table.js +75 -0
  370. package/script/typl/validator.d.ts +24 -5
  371. package/script/typl/validator.d.ts.map +1 -1
  372. package/script/typl/validator.js +55 -75
  373. package/script/upstream/mod.d.ts +45 -0
  374. package/script/upstream/mod.d.ts.map +1 -0
  375. package/script/upstream/mod.js +101 -0
  376. package/script/upstream/project.d.ts +33 -0
  377. package/script/upstream/project.d.ts.map +1 -0
  378. package/script/upstream/project.js +41 -0
  379. package/script/upstream/refs.d.ts +23 -0
  380. package/script/upstream/refs.d.ts.map +1 -0
  381. package/script/upstream/refs.js +74 -0
  382. package/script/util/fence.d.ts +20 -29
  383. package/script/util/fence.d.ts.map +1 -1
  384. package/script/util/fence.js +47 -54
  385. package/script/util/modals.d.ts +6 -0
  386. package/script/util/modals.d.ts.map +1 -1
  387. package/script/util/modals.js +38 -0
  388. package/script/util/paths.d.ts +14 -0
  389. package/script/util/paths.d.ts.map +1 -0
  390. package/script/util/paths.js +25 -0
  391. package/script/uxil/assemble.d.ts +38 -0
  392. package/script/uxil/assemble.d.ts.map +1 -0
  393. package/script/uxil/assemble.js +272 -0
  394. package/script/uxil/ast.d.ts +63 -0
  395. package/script/uxil/ast.d.ts.map +1 -0
  396. package/script/uxil/ast.js +10 -0
  397. package/script/uxil/citations.d.ts +27 -0
  398. package/script/uxil/citations.d.ts.map +1 -0
  399. package/script/uxil/citations.js +29 -0
  400. package/script/uxil/diagnostics.d.ts +39 -0
  401. package/script/uxil/diagnostics.d.ts.map +1 -0
  402. package/script/uxil/diagnostics.js +140 -0
  403. package/script/uxil/grammar.d.ts +72 -0
  404. package/script/uxil/grammar.d.ts.map +1 -0
  405. package/script/uxil/grammar.js +511 -0
  406. package/script/uxil/lexer.d.ts +23 -0
  407. package/script/uxil/lexer.d.ts.map +1 -0
  408. package/script/uxil/lexer.js +61 -0
  409. package/script/uxil/mod.d.ts +32 -0
  410. package/script/uxil/mod.d.ts.map +1 -0
  411. package/script/uxil/mod.js +37 -0
  412. package/script/uxil/projection.d.ts +40 -0
  413. package/script/uxil/projection.d.ts.map +1 -0
  414. package/script/uxil/projection.js +44 -0
  415. package/script/uxil/recognize.d.ts +16 -0
  416. package/script/uxil/recognize.d.ts.map +1 -0
  417. package/script/uxil/recognize.js +31 -0
  418. package/script/uxil/registry.d.ts +37 -0
  419. package/script/uxil/registry.d.ts.map +1 -0
  420. package/script/uxil/registry.js +32 -0
  421. package/script/uxil/surfaces.d.ts +36 -0
  422. package/script/uxil/surfaces.d.ts.map +1 -0
  423. package/script/uxil/surfaces.js +39 -0
  424. package/script/uxil/validator.d.ts +36 -0
  425. package/script/uxil/validator.d.ts.map +1 -0
  426. package/script/uxil/validator.js +142 -0
  427. package/script/uxil/vocab.d.ts +33 -0
  428. package/script/uxil/vocab.d.ts.map +1 -0
  429. package/script/uxil/vocab.js +41 -0
  430. package/script/validator/body_blocks.d.ts +2 -1
  431. package/script/validator/body_blocks.d.ts.map +1 -1
  432. package/script/validator/body_blocks.js +80 -2
  433. package/script/validator/caption_convention.d.ts +2 -1
  434. package/script/validator/caption_convention.d.ts.map +1 -1
  435. package/script/validator/caption_convention.js +2 -1
  436. package/script/validator/corpus.d.ts +6 -0
  437. package/script/validator/corpus.d.ts.map +1 -1
  438. package/script/validator/corpus.js +55 -19
  439. package/script/validator/discipline.d.ts +6 -4
  440. package/script/validator/discipline.d.ts.map +1 -1
  441. package/script/validator/discipline.js +6 -4
  442. package/script/validator/mod.d.ts +1 -1
  443. package/script/validator/mod.d.ts.map +1 -1
  444. package/script/validator/mod.js +29 -15
  445. package/script/validator/pipeline.d.ts +11 -1
  446. package/script/validator/pipeline.d.ts.map +1 -1
  447. package/script/validator/pipeline.js +75 -22
  448. package/script/validator/trace_types.d.ts +9 -2
  449. package/script/validator/trace_types.d.ts.map +1 -1
  450. package/script/validator/trace_types.js +20 -4
  451. package/script/validator/traceability.d.ts +15 -3
  452. package/script/validator/traceability.d.ts.map +1 -1
  453. package/script/validator/traceability.js +38 -3
  454. package/script/validator/types.d.ts.map +1 -1
  455. package/script/validator/types.js +10 -0
  456. package/script/validator/uxil_family.d.ts +43 -0
  457. package/script/validator/uxil_family.d.ts.map +1 -0
  458. package/script/validator/uxil_family.js +56 -0
@@ -1,14 +1,18 @@
1
1
  /**
2
2
  * @module core/discovery
3
3
  *
4
- * Gitignore-aware project file discovery — the single walker every
5
- * MarkSpec surface uses (CLI verbs, LSP indexing, lockfile entry
6
- * collection). Yields absolute paths of MarkSpec-relevant files under a
7
- * root, honoring (in precedence order):
4
+ * Gitignore-aware project file discovery shared by CLI scope resolution,
5
+ * LSP indexing, lockfile entry collection and nested-project discovery.
6
+ * Yields absolute paths of MarkSpec-relevant files under a
7
+ * root, unconditionally skipping hidden directories and honoring (in
8
+ * precedence order):
8
9
  *
9
- * 1. built-in skips — hidden directories (name starts with `.`)
10
- * 2. `.gitignore` files (root + nested, standard semantics)
11
- * 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored)
10
+ * 1. built-in skips — common build-output directories
11
+ * 2. `.gitignore` files (root + nested, standard semantics), plus, when
12
+ * the caller names an enclosing folder, the `.gitignore` files of the
13
+ * folders from that folder down to the root's parent
14
+ * 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored),
15
+ * applied last at every directory level, including for negations
12
16
  *
13
17
  * I/O is injected via {@linkcode DiscoveryIO} so the module stays
14
18
  * Node-compatible; entry points supply the Deno implementation.
@@ -42,8 +46,20 @@ export interface DiscoverOptions {
42
46
  /** Extension filter; defaults to {@linkcode RELEVANT_EXTENSIONS}. */
43
47
  readonly extensions?: ReadonlySet<string>;
44
48
  /** Extra gitignore-syntax patterns, anchored at `root` (e.g. from
45
- * project.yaml `exclude:`). Applied after `.gitignore` rules. */
49
+ * `.markspec.yaml` `exclude:`). Applied after built-in build-output skips and
50
+ * `.gitignore` rules at every directory level. Negations can re-include
51
+ * non-hidden directories; an ignored parent must also be re-included. */
46
52
  readonly exclude?: readonly string[];
53
+ /**
54
+ * An enclosing folder of `root`, such as the root of the project that a
55
+ * nested project lies in. The `.gitignore` files of the folders from it
56
+ * down to the parent of `root` also apply, each anchored to its own
57
+ * folder, so the walk of a nested project skips the files that those
58
+ * `.gitignore` files ignore. Only `.gitignore` files are inherited, not
59
+ * the enclosing folder's `exclude` patterns. No `.gitignore` above this
60
+ * folder is read. Ignored when it is not a strict ancestor of `root`.
61
+ */
62
+ readonly inheritGitignoreFrom?: string;
47
63
  }
48
64
  /**
49
65
  * Walk `root` recursively, yielding absolute paths of relevant files.
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discovery/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAmBhD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAoB,CAAC;AAEzE,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH;mDACmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACxD,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACrD;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C;qEACiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AA8BD;;;;GAIG;AACH,wBAAuB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAAC,MAAM,CAAC,CAgBxB"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discovery/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAmBhD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAoB,CAAC;AAEzE,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH;mDACmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACxD,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACrD;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C;;;6EAGyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AA8BD;;;;GAIG;AACH,wBAAuB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAAC,MAAM,CAAC,CAsBxB"}
@@ -2,14 +2,18 @@
2
2
  /**
3
3
  * @module core/discovery
4
4
  *
5
- * Gitignore-aware project file discovery — the single walker every
6
- * MarkSpec surface uses (CLI verbs, LSP indexing, lockfile entry
7
- * collection). Yields absolute paths of MarkSpec-relevant files under a
8
- * root, honoring (in precedence order):
5
+ * Gitignore-aware project file discovery shared by CLI scope resolution,
6
+ * LSP indexing, lockfile entry collection and nested-project discovery.
7
+ * Yields absolute paths of MarkSpec-relevant files under a
8
+ * root, unconditionally skipping hidden directories and honoring (in
9
+ * precedence order):
9
10
  *
10
- * 1. built-in skips — hidden directories (name starts with `.`)
11
- * 2. `.gitignore` files (root + nested, standard semantics)
12
- * 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored)
11
+ * 1. built-in skips — common build-output directories
12
+ * 2. `.gitignore` files (root + nested, standard semantics), plus, when
13
+ * the caller names an enclosing folder, the `.gitignore` files of the
14
+ * folders from that folder down to the root's parent
15
+ * 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored),
16
+ * applied last at every directory level, including for negations
13
17
  *
14
18
  * I/O is injected via {@linkcode DiscoveryIO} so the module stays
15
19
  * Node-compatible; entry points supply the Deno implementation.
@@ -64,9 +68,9 @@ exports.RELEVANT_EXTENSIONS = new Set([
64
68
  * indexing, spurious `MSL-L212` edge-hash entries).
65
69
  *
66
70
  * Unlike the hidden-dir skip these are overridable: they are applied as the
67
- * LOWEST-precedence rule layer (before `.gitignore` and `exclude:`), so a
68
- * negated `!target/` entry in either re-includes them under gitignore
69
- * last-match-wins.
71
+ * lowest-precedence rule layer (before `.gitignore` and `exclude:`), so a
72
+ * negated `!target/` entry in either re-includes that directory under
73
+ * gitignore last-match-wins.
70
74
  */
71
75
  const BUILTIN_SKIP_DIRS = [
72
76
  "node_modules",
@@ -84,19 +88,51 @@ const BUILTIN_SKIP_RULES = (0, gitignore_js_1.parseGitignore)(BUILTIN_SKIP_DIRS.
84
88
  */
85
89
  async function* discoverFiles(root, io, options = {}) {
86
90
  const extensions = options.extensions ?? exports.RELEVANT_EXTENSIONS;
87
- const excludeRules = (0, gitignore_js_1.parseGitignore)((options.exclude ?? []).join("\n"), "");
88
- // Built-in build-output skips are the lowest-precedence layer: `.gitignore`
89
- // (appended per-directory in `walk`) and `exclude:` both come after, so a
90
- // `!target/` negation in either overrides them.
91
- yield* walk(root, "", [...BUILTIN_SKIP_RULES, ...excludeRules], io, extensions);
91
+ const inherited = options.inheritGitignoreFrom === undefined
92
+ ? { rules: [], prefix: "" }
93
+ : await inheritedGitignoreRules(options.inheritGitignoreFrom, root, io);
94
+ // With inherited rules, every rule is matched against paths relative to
95
+ // the enclosing folder, so `prefix` is the path from it down to `root`.
96
+ const prefix = inherited.prefix;
97
+ const excludeRules = (0, gitignore_js_1.parseGitignore)((options.exclude ?? []).join("\n"), prefix);
98
+ // Carry excludes separately: they must stay after every `.gitignore`,
99
+ // including ones loaded deeper in the walk.
100
+ yield* walk(root, prefix, [...BUILTIN_SKIP_RULES, ...inherited.rules], excludeRules, io, extensions);
92
101
  }
93
- async function* walk(absDir, relDir, rules, io, extensions) {
94
- // Nested .gitignore rules append after inherited ones — deeper rules
95
- // win under last-match-wins.
102
+ /**
103
+ * Collect the `.gitignore` rules of the folders from `from` down to the
104
+ * parent of `root`, outermost first, each anchored to its own folder.
105
+ * Returns them with the POSIX path from `from` down to `root`. Returns no
106
+ * rules and an empty path when `from` is not a strict ancestor of `root`.
107
+ */
108
+ async function inheritedGitignoreRules(from, root, io) {
109
+ const rel = (0, path_1.relative)((0, path_1.resolve)(from), (0, path_1.resolve)(root));
110
+ if (rel === "" || rel === ".." || rel.startsWith(`..${path_1.SEPARATOR}`)) {
111
+ return { rules: [], prefix: "" };
112
+ }
113
+ const segments = rel.split(path_1.SEPARATOR);
114
+ const rules = [];
115
+ for (let i = 0; i < segments.length; i++) {
116
+ const raw = await io.readFile((0, path_1.join)(from, ...segments.slice(0, i), ".gitignore"));
117
+ if (raw === undefined || raw.length === 0)
118
+ continue;
119
+ rules.push(...(0, gitignore_js_1.parseGitignore)(raw, segments.slice(0, i).join("/")));
120
+ }
121
+ return { rules, prefix: segments.join("/") };
122
+ }
123
+ /**
124
+ * Walk `absDir`. `relDir` is the POSIX path of `absDir` relative to the
125
+ * folder the rules are anchored at (the enclosing folder when rules are
126
+ * inherited, else the walk root); `""` for that folder itself.
127
+ */
128
+ async function* walk(absDir, relDir, rules, excludeRules, io, extensions) {
129
+ // Deeper `.gitignore` rules win over inherited ones. Excludes stay last
130
+ // for this directory's decisions, but are not inherited as gitignore rules.
96
131
  const raw = await io.readFile((0, path_1.join)(absDir, ".gitignore"));
97
- const active = raw !== undefined && raw.length > 0
132
+ const gitignoreRules = raw !== undefined && raw.length > 0
98
133
  ? [...rules, ...(0, gitignore_js_1.parseGitignore)(raw, relDir)]
99
134
  : rules;
135
+ const active = [...gitignoreRules, ...excludeRules];
100
136
  const entries = [];
101
137
  try {
102
138
  for await (const e of io.readDir(absDir))
@@ -115,7 +151,7 @@ async function* walk(absDir, relDir, rules, io, extensions) {
115
151
  // re-included, so pruning here is correct (and fast).
116
152
  if ((0, gitignore_js_1.isIgnored)(rel, true, active))
117
153
  continue;
118
- yield* walk((0, path_1.join)(absDir, entry.name), rel, active, io, extensions);
154
+ yield* walk((0, path_1.join)(absDir, entry.name), rel, gitignoreRules, excludeRules, io, extensions);
119
155
  }
120
156
  else if (entry.isFile) {
121
157
  if (!extensions.has((0, path_1.extname)(entry.name).toLowerCase()))
@@ -0,0 +1,109 @@
1
+ /**
2
+ * @module core/discovery/projects
3
+ *
4
+ * Project-root discovery shared by the CLI, the LSP and the MCP server.
5
+ *
6
+ * A "project root" is a directory that holds a `project.yaml` or a
7
+ * `.markspec.yaml`. {@linkcode discoverProjectRoots} finds the primary
8
+ * root by walking up from a start folder, then every nested root below
9
+ * it with the gitignore-aware file walk.
10
+ */
11
+ import { type DiscoveryIO } from "./mod.js";
12
+ /** `true` when `path` is `root` itself or lies below it. */
13
+ export declare function isWithin(root: string, path: string): boolean;
14
+ /**
15
+ * Return the deepest root in `roots` that is `dir` itself or an ancestor
16
+ * of `dir`, or `undefined` when none is.
17
+ */
18
+ export declare function nearestRoot(dir: string, roots: Iterable<string>): string | undefined;
19
+ /**
20
+ * Walk up from `startDir` to the nearest `project.yaml`, else the nearest
21
+ * `.markspec.yaml`. Returns `undefined` when neither exists.
22
+ *
23
+ * The LSP server and the MCP server use this order to find the root
24
+ * above their workspace. The CLI (`check`, `fmt`, `lint`) uses
25
+ * {@linkcode createProjectRootResolver}, which starts from this nearest
26
+ * config root but skips a config that an enclosing project hides (#845).
27
+ */
28
+ export declare function resolveConfigRoot(startDir: string, readFile: (path: string) => Promise<string | undefined>): Promise<string | undefined>;
29
+ /**
30
+ * Directories strictly below `root` that a document walk-up would
31
+ * resolve to, found with the gitignore-aware project walk (honouring
32
+ * `exclude`). Each discovered `project.yaml` or `.markspec.yaml` is
33
+ * resolved with {@linkcode resolveConfigRoot} from its own directory, so a
34
+ * `.markspec.yaml` below a `project.yaml` is not a root of its own — the
35
+ * same answer the CLI gives for a file there. A found root is dropped when
36
+ * the `.markspec.yaml` `exclude:` list of another found root above it
37
+ * covers it: each project's exclude list applies to its own subtree, with
38
+ * patterns relative to that project. The result is sorted.
39
+ */
40
+ export declare function findNestedProjectRoots(root: string, io: DiscoveryIO, exclude?: readonly string[]): Promise<string[]>;
41
+ /** Options for {@linkcode discoverProjectRoots}. */
42
+ export interface ProjectDiscoveryOptions {
43
+ /** The user's home folder. When the primary root equals this folder, no
44
+ * downward scan runs from it. */
45
+ readonly homeDir?: string;
46
+ }
47
+ /**
48
+ * Find every MarkSpec project reachable from `startDir`.
49
+ *
50
+ * `primaryRoot` is the nearest config root found by walking up from
51
+ * `startDir` (see {@linkcode resolveConfigRoot}), or `startDir` itself
52
+ * when there is none. `roots` holds the primary root (only when it has a
53
+ * config) plus every nested root below it, sorted. The nested scan honours
54
+ * the primary project's `.markspec.yaml` `exclude:` list, and each nested
55
+ * project's own list for the folders below it.
56
+ *
57
+ * When the primary root is a filesystem root or `options.homeDir`, no
58
+ * downward scan runs, even when that folder holds a config: `roots` then
59
+ * holds only the primary root when it has a config, and is empty
60
+ * otherwise.
61
+ */
62
+ export declare function discoverProjectRoots(startDir: string, io: DiscoveryIO, options?: ProjectDiscoveryOptions): Promise<{
63
+ primaryRoot: string;
64
+ roots: string[];
65
+ }>;
66
+ /** Answers which project root owns a folder; see
67
+ * {@linkcode createProjectRootResolver}. */
68
+ export interface ProjectRootResolver {
69
+ /**
70
+ * The project root that owns files in `dir`, or `undefined` when no
71
+ * `project.yaml` or `.markspec.yaml` is at or above `dir`.
72
+ */
73
+ ownerOf(dir: string): Promise<string | undefined>;
74
+ /**
75
+ * The nested project roots below `root`
76
+ * ({@linkcode findNestedProjectRoots} with the `.markspec.yaml`
77
+ * `exclude:` list of `root`). Cached per root.
78
+ */
79
+ nestedRoots(root: string): Promise<string[]>;
80
+ /**
81
+ * The outermost project root at or above `dir`: the root from which the
82
+ * LSP would index `dir` when its workspace is the outermost project. A
83
+ * nested project's walk inherits the `.gitignore` files from this root
84
+ * down (`discoverFiles` option `inheritGitignoreFrom`). `undefined` when
85
+ * no `project.yaml` or `.markspec.yaml` is at or above `dir`.
86
+ */
87
+ outermostOf(dir: string): Promise<string | undefined>;
88
+ }
89
+ /**
90
+ * Create a resolver that gives, for any folder, the project root the LSP
91
+ * would give a document in that folder when the editor workspace is the
92
+ * outermost project root above it (#845).
93
+ *
94
+ * The nearest config root {@linkcode resolveConfigRoot} finds is not
95
+ * always the owner: when an enclosing project hides that config (an
96
+ * `exclude:` entry, a `.gitignore` entry, a hidden folder), the LSP and
97
+ * the MCP server never treat it as a root, and its files belong to the
98
+ * enclosing project. So the resolver walks up from the nearest config
99
+ * root to the outermost enclosing one, finds the nested roots below that
100
+ * outermost root the way the LSP does, and returns the deepest of them
101
+ * that contains `dir`.
102
+ *
103
+ * The walk up stops before a filesystem root and before
104
+ * `options.homeDir`: {@linkcode discoverProjectRoots} never scans down
105
+ * from those folders, so a stray config there must not claim every
106
+ * project below it. Results are cached per folder.
107
+ */
108
+ export declare function createProjectRootResolver(io: DiscoveryIO, options?: ProjectDiscoveryOptions): ProjectRootResolver;
109
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/discovery/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAS3D,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GACtB,MAAM,GAAG,SAAS,CAOpB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GACtD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG7B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,CAqCnB;AAgBD,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC;qCACiC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoBnD;AAED;4CAC4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClD;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C;;;;;;OAMG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,uBAA4B,GACpC,mBAAmB,CAqErB"}
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/discovery/projects
4
+ *
5
+ * Project-root discovery shared by the CLI, the LSP and the MCP server.
6
+ *
7
+ * A "project root" is a directory that holds a `project.yaml` or a
8
+ * `.markspec.yaml`. {@linkcode discoverProjectRoots} finds the primary
9
+ * root by walking up from a start folder, then every nested root below
10
+ * it with the gitignore-aware file walk.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.isWithin = isWithin;
14
+ exports.nearestRoot = nearestRoot;
15
+ exports.resolveConfigRoot = resolveConfigRoot;
16
+ exports.findNestedProjectRoots = findNestedProjectRoots;
17
+ exports.discoverProjectRoots = discoverProjectRoots;
18
+ exports.createProjectRootResolver = createProjectRootResolver;
19
+ const path_1 = require("@std/path");
20
+ const mod_js_1 = require("../config/mod.js");
21
+ const markspec_js_1 = require("../config/markspec.js");
22
+ const mod_js_2 = require("./mod.js");
23
+ const gitignore_js_1 = require("./gitignore.js");
24
+ /** The file names whose directory can be a project root. */
25
+ const CONFIG_BASENAMES = new Set([
26
+ "project.yaml",
27
+ ".markspec.yaml",
28
+ ]);
29
+ /** `true` when `path` is `root` itself or lies below it. */
30
+ function isWithin(root, path) {
31
+ const rel = (0, path_1.relative)(root, path);
32
+ // A child directory may itself start with `..` (e.g. `..cache`), so
33
+ // compare whole path segments, not a string prefix.
34
+ return rel === "" ||
35
+ (rel !== ".." && !rel.startsWith(`..${path_1.SEPARATOR}`) && !(0, path_1.isAbsolute)(rel));
36
+ }
37
+ /**
38
+ * Return the deepest root in `roots` that is `dir` itself or an ancestor
39
+ * of `dir`, or `undefined` when none is.
40
+ */
41
+ function nearestRoot(dir, roots) {
42
+ let best;
43
+ for (const root of roots) {
44
+ if (!isWithin(root, dir))
45
+ continue;
46
+ if (best === undefined || root.length > best.length)
47
+ best = root;
48
+ }
49
+ return best;
50
+ }
51
+ /**
52
+ * Walk up from `startDir` to the nearest `project.yaml`, else the nearest
53
+ * `.markspec.yaml`. Returns `undefined` when neither exists.
54
+ *
55
+ * The LSP server and the MCP server use this order to find the root
56
+ * above their workspace. The CLI (`check`, `fmt`, `lint`) uses
57
+ * {@linkcode createProjectRootResolver}, which starts from this nearest
58
+ * config root but skips a config that an enclosing project hides (#845).
59
+ */
60
+ async function resolveConfigRoot(startDir, readFile) {
61
+ return await (0, mod_js_1.discoverProjectRoot)(startDir, readFile) ??
62
+ await (0, markspec_js_1.discoverMarkspecRoot)(startDir, readFile);
63
+ }
64
+ /**
65
+ * Directories strictly below `root` that a document walk-up would
66
+ * resolve to, found with the gitignore-aware project walk (honouring
67
+ * `exclude`). Each discovered `project.yaml` or `.markspec.yaml` is
68
+ * resolved with {@linkcode resolveConfigRoot} from its own directory, so a
69
+ * `.markspec.yaml` below a `project.yaml` is not a root of its own — the
70
+ * same answer the CLI gives for a file there. A found root is dropped when
71
+ * the `.markspec.yaml` `exclude:` list of another found root above it
72
+ * covers it: each project's exclude list applies to its own subtree, with
73
+ * patterns relative to that project. The result is sorted.
74
+ */
75
+ async function findNestedProjectRoots(root, io, exclude) {
76
+ const out = new Set();
77
+ for await (const path of (0, mod_js_2.discoverFiles)(root, io, {
78
+ extensions: new Set([".yaml"]),
79
+ exclude,
80
+ })) {
81
+ if (!CONFIG_BASENAMES.has((0, path_1.basename)(path)))
82
+ continue;
83
+ const dir = (0, path_1.dirname)(path);
84
+ if (dir === root)
85
+ continue;
86
+ const found = await resolveConfigRoot(dir, io.readFile);
87
+ if (found !== undefined && found !== root && isWithin(root, found)) {
88
+ out.add(found);
89
+ }
90
+ }
91
+ const nested = [...out];
92
+ const excludeRules = new Map();
93
+ const kept = [];
94
+ for (const candidate of nested) {
95
+ let covered = false;
96
+ for (const ancestor of nested) {
97
+ if (ancestor === candidate || !isWithin(ancestor, candidate))
98
+ continue;
99
+ let rules = excludeRules.get(ancestor);
100
+ if (rules === undefined) {
101
+ const { config } = await (0, markspec_js_1.loadToolConfig)(ancestor, io.readFile);
102
+ rules = (0, gitignore_js_1.parseGitignore)(config.exclude.join("\n"), "");
103
+ excludeRules.set(ancestor, rules);
104
+ }
105
+ if (isExcludedDir((0, path_1.relative)(ancestor, candidate), rules)) {
106
+ covered = true;
107
+ break;
108
+ }
109
+ }
110
+ if (!covered)
111
+ kept.push(candidate);
112
+ }
113
+ return kept.sort();
114
+ }
115
+ /** `true` when the directory at `rel` (relative, host separators), or any
116
+ * directory above it, matches `rules` — the same pruning the walk does. */
117
+ function isExcludedDir(rel, rules) {
118
+ if (rules.length === 0)
119
+ return false;
120
+ const segments = rel.split(path_1.SEPARATOR);
121
+ for (let i = 1; i <= segments.length; i++) {
122
+ if ((0, gitignore_js_1.isIgnored)(segments.slice(0, i).join("/"), true, rules))
123
+ return true;
124
+ }
125
+ return false;
126
+ }
127
+ /**
128
+ * Find every MarkSpec project reachable from `startDir`.
129
+ *
130
+ * `primaryRoot` is the nearest config root found by walking up from
131
+ * `startDir` (see {@linkcode resolveConfigRoot}), or `startDir` itself
132
+ * when there is none. `roots` holds the primary root (only when it has a
133
+ * config) plus every nested root below it, sorted. The nested scan honours
134
+ * the primary project's `.markspec.yaml` `exclude:` list, and each nested
135
+ * project's own list for the folders below it.
136
+ *
137
+ * When the primary root is a filesystem root or `options.homeDir`, no
138
+ * downward scan runs, even when that folder holds a config: `roots` then
139
+ * holds only the primary root when it has a config, and is empty
140
+ * otherwise.
141
+ */
142
+ async function discoverProjectRoots(startDir, io, options = {}) {
143
+ const configRoot = await resolveConfigRoot(startDir, io.readFile);
144
+ const primaryRoot = configRoot ?? startDir;
145
+ const isFilesystemRoot = (0, path_1.dirname)(primaryRoot) === primaryRoot;
146
+ if (isFilesystemRoot || primaryRoot === options.homeDir) {
147
+ return {
148
+ primaryRoot,
149
+ roots: configRoot !== undefined ? [primaryRoot] : [],
150
+ };
151
+ }
152
+ const { config } = configRoot !== undefined
153
+ ? await (0, markspec_js_1.loadToolConfig)(primaryRoot, io.readFile)
154
+ : { config: undefined };
155
+ const nested = await findNestedProjectRoots(primaryRoot, io, config?.exclude);
156
+ const roots = configRoot !== undefined ? [primaryRoot, ...nested] : nested;
157
+ return { primaryRoot, roots: roots.sort() };
158
+ }
159
+ /**
160
+ * Create a resolver that gives, for any folder, the project root the LSP
161
+ * would give a document in that folder when the editor workspace is the
162
+ * outermost project root above it (#845).
163
+ *
164
+ * The nearest config root {@linkcode resolveConfigRoot} finds is not
165
+ * always the owner: when an enclosing project hides that config (an
166
+ * `exclude:` entry, a `.gitignore` entry, a hidden folder), the LSP and
167
+ * the MCP server never treat it as a root, and its files belong to the
168
+ * enclosing project. So the resolver walks up from the nearest config
169
+ * root to the outermost enclosing one, finds the nested roots below that
170
+ * outermost root the way the LSP does, and returns the deepest of them
171
+ * that contains `dir`.
172
+ *
173
+ * The walk up stops before a filesystem root and before
174
+ * `options.homeDir`: {@linkcode discoverProjectRoots} never scans down
175
+ * from those folders, so a stray config there must not claim every
176
+ * project below it. Results are cached per folder.
177
+ */
178
+ function createProjectRootResolver(io, options = {}) {
179
+ const owners = new Map();
180
+ const outermosts = new Map();
181
+ const nested = new Map();
182
+ function nestedRoots(root) {
183
+ let found = nested.get(root);
184
+ if (found === undefined) {
185
+ found = (0, markspec_js_1.loadToolConfig)(root, io.readFile).then(({ config }) => findNestedProjectRoots(root, io, config.exclude));
186
+ nested.set(root, found);
187
+ }
188
+ return found;
189
+ }
190
+ function outermostOf(dir) {
191
+ let found = outermosts.get(dir);
192
+ if (found === undefined) {
193
+ found = resolveOutermost(dir);
194
+ outermosts.set(dir, found);
195
+ }
196
+ return found;
197
+ }
198
+ async function resolveOutermost(dir) {
199
+ const nearest = await resolveConfigRoot(dir, io.readFile);
200
+ return nearest === undefined ? undefined : await outermostFrom(nearest);
201
+ }
202
+ /** Walk up from the config root `nearest` to the outermost one. */
203
+ async function outermostFrom(nearest) {
204
+ let outermost = nearest;
205
+ while (true) {
206
+ const parent = (0, path_1.dirname)(outermost);
207
+ if (parent === outermost)
208
+ break;
209
+ const above = await resolveConfigRoot(parent, io.readFile);
210
+ if (above === undefined || (0, path_1.dirname)(above) === above ||
211
+ above === options.homeDir) {
212
+ break;
213
+ }
214
+ outermost = above;
215
+ }
216
+ return outermost;
217
+ }
218
+ async function resolveOwner(dir) {
219
+ const nearest = await resolveConfigRoot(dir, io.readFile);
220
+ if (nearest === undefined)
221
+ return undefined;
222
+ const outermost = await outermostFrom(nearest);
223
+ if (outermost === nearest)
224
+ return nearest;
225
+ const roots = [outermost, ...await nestedRoots(outermost)];
226
+ return nearestRoot(dir, roots) ?? outermost;
227
+ }
228
+ return {
229
+ ownerOf(dir) {
230
+ let owner = owners.get(dir);
231
+ if (owner === undefined) {
232
+ owner = resolveOwner(dir);
233
+ owners.set(dir, owner);
234
+ }
235
+ return owner;
236
+ },
237
+ nestedRoots,
238
+ outermostOf,
239
+ };
240
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @module formatter/entry_body
3
+ *
4
+ * Read and replace the body of one entry in a Markdown file text.
5
+ *
6
+ * Splice-only contract: {@linkcode replaceEntryBody} changes only the
7
+ * lines of the target entry's body. Every other line of the file (other
8
+ * entries, prose, front matter, the title, the trailer block, and each
9
+ * line's own line ending) stays byte-for-byte unchanged. After the splice
10
+ * the text is parsed again; when the set of entries differs (a new entry,
11
+ * a lost entry, a changed title or trailer) or the target's body is not
12
+ * the proposal, the edit is refused.
13
+ *
14
+ * The body range starts after the title paragraph (up to the first blank
15
+ * line after the title line, so a soft-wrapped title is skipped) and the
16
+ * blank lines after it. It has as many lines as the parser's
17
+ * `entry.body`, so lazy continuation lines are included, and it must
18
+ * match that body line for line. The body indent is the content column of
19
+ * the list item: the marker column, plus the marker width, plus the spaces
20
+ * after the marker. Lines are split on `\r\n`, a
21
+ * lone `\r`, or `\n`, as in the parser.
22
+ *
23
+ * Pure: no I/O, Node-compatible.
24
+ */
25
+ /** Why {@linkcode replaceEntryBody} refused an edit. */
26
+ export type EntryBodyRefusal = "entry-not-found" | "body-empty" | "proposal-empty" | "trailer-invalid" | "entries-changed";
27
+ /** Result of {@linkcode replaceEntryBody}. */
28
+ export type EntryBodyEdit = {
29
+ readonly ok: true;
30
+ readonly text: string;
31
+ } | {
32
+ readonly ok: false;
33
+ readonly refusal: EntryBodyRefusal;
34
+ };
35
+ /**
36
+ * 0-based content column of the list item whose marker starts at `marker`
37
+ * on `line`: the marker column, plus 1 for the bullet, plus the spaces
38
+ * after it. So `- [ID]` gives the marker column plus 2 and `- [ID]` gives
39
+ * the marker column plus 4. Only a bullet followed by one to four spaces
40
+ * can start an entry: ordered lists never hold entries, and five or more
41
+ * spaces make the title an indented code block. When the line does not
42
+ * start with a bullet and a space at `marker`, the marker column plus 2 is
43
+ * used as a fallback.
44
+ */
45
+ export declare function contentColumn(line: string, marker: number): number;
46
+ /**
47
+ * Body of the entry `displayId` as written in `text`: dedented, LF line
48
+ * endings, no surrounding blank lines. Returns `""` when the entry has no
49
+ * body and `undefined` when no entry has `displayId`. `file` names a
50
+ * `.md` file. When the body lines cannot be located exactly in `text`,
51
+ * the parser's body is returned (and {@linkcode replaceEntryBody}
52
+ * refuses to edit that entry).
53
+ */
54
+ export declare function readEntryBody(text: string, file: string, displayId: string): Promise<string | undefined>;
55
+ /**
56
+ * Return `text` with the body of entry `displayId` replaced by `body`,
57
+ * re-indented to the body indent. Every other line stays byte-for-byte
58
+ * unchanged. Inserted lines take the line ending of the title line. In
59
+ * `body`, `\r\n` and a lone `\r` count as line breaks.
60
+ *
61
+ * Refusals: `entry-not-found` (no such entry), `trailer-invalid` (the
62
+ * entry's trailer block did not parse, see below), `body-empty` (the entry
63
+ * has no body), `proposal-empty` (`body` is blank), `entries-changed`
64
+ * (two entries in `text` have `displayId`; or the body lines cannot be
65
+ * located exactly in `text`; or the edited
66
+ * text no longer parses to the same entries, with the same title and
67
+ * trailer for the target, and with the proposal as the target's body;
68
+ * or the parse raises more structural diagnostics of some code, such as
69
+ * MSL-P020, than the original text).
70
+ *
71
+ * `trailer-invalid`: when a trailer line is malformed (for example an
72
+ * empty `Labels:`, a key without a colon, or a lowercase key), the parser
73
+ * reads the whole trailer block, the `Id:` line included, as body. A
74
+ * splice would then delete the `Id:` and trailer lines, and the identity
75
+ * check cannot see it, because the entry has no `id` and no attributes
76
+ * before or after the edit. So the edit is refused when an `MSL-P020`,
77
+ * `MSL-P021` or `MSL-P022` names the entry (the message starts with
78
+ * `<displayId>:`). This is broader than that case: `MSL-P020` also fires
79
+ * when a body paragraph starts with a recognized trailer key, so such an
80
+ * entry is refused too. The file already fails `markspec check` there.
81
+ * An entry whose trailer-looking lines use only unrecognized keys, and
82
+ * that the parser reads as body without a diagnostic, is edited as the
83
+ * parser sees it: those lines are body.
84
+ */
85
+ export declare function replaceEntryBody(text: string, file: string, displayId: string, body: string): Promise<EntryBodyEdit>;
86
+ //# sourceMappingURL=entry_body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry_body.d.ts","sourceRoot":"","sources":["../../src/formatter/entry_body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,YAAY,GACZ,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC;AA8E/D;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAGlE;AAyCD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS7B;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,CAoDxB"}