@driftsys/markspec 0.5.0 → 0.6.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 (484) hide show
  1. package/README.md +74 -20
  2. package/esm/ast/build.d.ts +11 -21
  3. package/esm/ast/build.d.ts.map +1 -1
  4. package/esm/ast/build.js +50 -139
  5. package/esm/ast/nodes.d.ts +11 -43
  6. package/esm/ast/nodes.d.ts.map +1 -1
  7. package/esm/ast/nodes.js +6 -1
  8. package/esm/ast/normalize.d.ts +8 -17
  9. package/esm/ast/normalize.d.ts.map +1 -1
  10. package/esm/ast/normalize.js +14 -72
  11. package/esm/compiler/constants.d.ts +16 -0
  12. package/esm/compiler/constants.d.ts.map +1 -0
  13. package/esm/compiler/constants.js +26 -0
  14. package/esm/compiler/discipline_classifier.d.ts +55 -0
  15. package/esm/compiler/discipline_classifier.d.ts.map +1 -0
  16. package/esm/compiler/discipline_classifier.js +191 -0
  17. package/esm/compiler/inverses.d.ts +7 -0
  18. package/esm/compiler/inverses.d.ts.map +1 -1
  19. package/esm/compiler/inverses.js +1 -18
  20. package/esm/compiler/mod.d.ts +30 -1
  21. package/esm/compiler/mod.d.ts.map +1 -1
  22. package/esm/compiler/mod.js +198 -65
  23. package/esm/compiler/schema.d.ts +15 -0
  24. package/esm/compiler/schema.d.ts.map +1 -1
  25. package/esm/compiler/schema.js +12 -0
  26. package/esm/config/markspec.d.ts +5 -0
  27. package/esm/config/markspec.d.ts.map +1 -1
  28. package/esm/config/markspec.js +17 -2
  29. package/esm/formatter/mod.d.ts +9 -3
  30. package/esm/formatter/mod.d.ts.map +1 -1
  31. package/esm/formatter/mod.js +97 -49
  32. package/esm/lexicons/loader.d.ts +35 -0
  33. package/esm/lexicons/loader.d.ts.map +1 -0
  34. package/esm/lexicons/loader.js +51 -0
  35. package/esm/lexicons/mod.d.ts +13 -0
  36. package/esm/lexicons/mod.d.ts.map +1 -0
  37. package/esm/lexicons/mod.js +12 -0
  38. package/esm/lint/glossary.d.ts +45 -0
  39. package/esm/lint/glossary.d.ts.map +1 -0
  40. package/esm/lint/glossary.js +85 -0
  41. package/esm/lint/mod.d.ts +4 -0
  42. package/esm/lint/mod.d.ts.map +1 -1
  43. package/esm/lint/mod.js +2 -0
  44. package/esm/lint/range_util.d.ts +25 -0
  45. package/esm/lint/range_util.d.ts.map +1 -0
  46. package/esm/lint/range_util.js +50 -0
  47. package/esm/lint/rules/ears.d.ts +39 -0
  48. package/esm/lint/rules/ears.d.ts.map +1 -0
  49. package/esm/lint/rules/ears.js +316 -0
  50. package/esm/lint/rules/incose_sentence.d.ts +46 -0
  51. package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
  52. package/esm/lint/rules/incose_sentence.js +417 -0
  53. package/esm/lint/rules/modal_sentence.d.ts +46 -0
  54. package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
  55. package/esm/lint/rules/modal_sentence.js +146 -0
  56. package/esm/lint/rules/passive.d.ts +64 -0
  57. package/esm/lint/rules/passive.d.ts.map +1 -0
  58. package/esm/lint/rules/passive.js +282 -0
  59. package/esm/lint/rules/suppression.d.ts +38 -3
  60. package/esm/lint/rules/suppression.d.ts.map +1 -1
  61. package/esm/lint/rules/suppression.js +58 -4
  62. package/esm/lint/rules/xref.d.ts +19 -0
  63. package/esm/lint/rules/xref.d.ts.map +1 -0
  64. package/esm/lint/rules/xref.js +248 -0
  65. package/esm/lint/runner.d.ts +31 -11
  66. package/esm/lint/runner.d.ts.map +1 -1
  67. package/esm/lint/runner.js +67 -26
  68. package/esm/lint/score.d.ts +64 -0
  69. package/esm/lint/score.d.ts.map +1 -0
  70. package/esm/lint/score.js +163 -0
  71. package/esm/lint/segmenter.d.ts +32 -0
  72. package/esm/lint/segmenter.d.ts.map +1 -0
  73. package/esm/lint/segmenter.js +79 -0
  74. package/esm/lint/types.d.ts +12 -0
  75. package/esm/lint/types.d.ts.map +1 -1
  76. package/esm/lock/canonical_edges.d.ts +31 -0
  77. package/esm/lock/canonical_edges.d.ts.map +1 -0
  78. package/esm/lock/canonical_edges.js +57 -0
  79. package/esm/lock/check.d.ts +24 -0
  80. package/esm/lock/check.d.ts.map +1 -0
  81. package/esm/lock/check.js +127 -0
  82. package/esm/lock/hash.d.ts +12 -0
  83. package/esm/lock/hash.d.ts.map +1 -0
  84. package/esm/lock/hash.js +32 -0
  85. package/esm/lock/mod.d.ts +19 -0
  86. package/esm/lock/mod.d.ts.map +1 -0
  87. package/esm/lock/mod.js +14 -0
  88. package/esm/lock/model.d.ts +81 -0
  89. package/esm/lock/model.d.ts.map +1 -0
  90. package/esm/lock/model.js +7 -0
  91. package/esm/lock/parser.d.ts +26 -0
  92. package/esm/lock/parser.d.ts.map +1 -0
  93. package/esm/lock/parser.js +195 -0
  94. package/esm/lock/resolve.d.ts +142 -0
  95. package/esm/lock/resolve.d.ts.map +1 -0
  96. package/esm/lock/resolve.js +389 -0
  97. package/esm/lock/serializer.d.ts +14 -0
  98. package/esm/lock/serializer.d.ts.map +1 -0
  99. package/esm/lock/serializer.js +104 -0
  100. package/esm/mod.d.ts +16 -9
  101. package/esm/mod.d.ts.map +1 -1
  102. package/esm/mod.js +12 -4
  103. package/esm/model/attributes.d.ts +6 -0
  104. package/esm/model/attributes.d.ts.map +1 -1
  105. package/esm/model/attributes.js +37 -0
  106. package/esm/model/discipline.d.ts +53 -0
  107. package/esm/model/discipline.d.ts.map +1 -0
  108. package/esm/model/discipline.js +50 -0
  109. package/esm/model/mod.d.ts +188 -30
  110. package/esm/model/mod.d.ts.map +1 -1
  111. package/esm/model/mod.js +42 -1
  112. package/esm/model/profile.d.ts +69 -0
  113. package/esm/model/profile.d.ts.map +1 -1
  114. package/esm/parser/attributes.d.ts.map +1 -1
  115. package/esm/parser/attributes.js +1 -10
  116. package/esm/parser/body_tokens.d.ts +35 -0
  117. package/esm/parser/body_tokens.d.ts.map +1 -0
  118. package/esm/parser/body_tokens.js +232 -0
  119. package/esm/parser/glossary.d.ts +8 -0
  120. package/esm/parser/glossary.d.ts.map +1 -1
  121. package/esm/parser/glossary.js +6 -4
  122. package/esm/parser/grammars.d.ts +5 -3
  123. package/esm/parser/grammars.d.ts.map +1 -1
  124. package/esm/parser/grammars.js +12 -4
  125. package/esm/parser/language_spec.d.ts +55 -0
  126. package/esm/parser/language_spec.d.ts.map +1 -0
  127. package/esm/parser/language_spec.js +419 -0
  128. package/esm/parser/line_map.d.ts +60 -0
  129. package/esm/parser/line_map.d.ts.map +1 -0
  130. package/esm/parser/line_map.js +41 -0
  131. package/esm/parser/markdown.d.ts +9 -0
  132. package/esm/parser/markdown.d.ts.map +1 -1
  133. package/esm/parser/markdown.js +107 -31
  134. package/esm/parser/mod.d.ts +4 -0
  135. package/esm/parser/mod.d.ts.map +1 -1
  136. package/esm/parser/mod.js +30 -8
  137. package/esm/parser/source.d.ts +39 -8
  138. package/esm/parser/source.d.ts.map +1 -1
  139. package/esm/parser/source.js +155 -65
  140. package/esm/parser/translate.d.ts +24 -0
  141. package/esm/parser/translate.d.ts.map +1 -0
  142. package/esm/parser/translate.js +99 -0
  143. package/esm/profile/chain.d.ts +8 -0
  144. package/esm/profile/chain.d.ts.map +1 -1
  145. package/esm/profile/chain.js +29 -1
  146. package/esm/profile/default_profile.d.ts +25 -0
  147. package/esm/profile/default_profile.d.ts.map +1 -0
  148. package/esm/profile/default_profile.js +43 -0
  149. package/esm/profile/discipline_mode.d.ts +64 -0
  150. package/esm/profile/discipline_mode.d.ts.map +1 -0
  151. package/esm/profile/discipline_mode.js +133 -0
  152. package/esm/profile/discipline_registry.d.ts +41 -0
  153. package/esm/profile/discipline_registry.d.ts.map +1 -0
  154. package/esm/profile/discipline_registry.js +67 -0
  155. package/esm/profile/load.d.ts +3 -1
  156. package/esm/profile/load.d.ts.map +1 -1
  157. package/esm/profile/load.js +24 -5
  158. package/esm/profile/manifest.d.ts.map +1 -1
  159. package/esm/profile/manifest.js +253 -20
  160. package/esm/profile/merge.d.ts.map +1 -1
  161. package/esm/profile/merge.js +112 -0
  162. package/esm/profile/mod.d.ts +2 -0
  163. package/esm/profile/mod.d.ts.map +1 -1
  164. package/esm/profile/mod.js +2 -0
  165. package/esm/sync/locked_attributes.d.ts +19 -0
  166. package/esm/sync/locked_attributes.d.ts.map +1 -0
  167. package/esm/sync/locked_attributes.js +27 -0
  168. package/esm/sync/log.d.ts +34 -0
  169. package/esm/sync/log.d.ts.map +1 -0
  170. package/esm/sync/log.js +48 -0
  171. package/esm/sync/mapping.d.ts +66 -0
  172. package/esm/sync/mapping.d.ts.map +1 -0
  173. package/esm/sync/mapping.js +165 -0
  174. package/esm/sync/mod.d.ts +16 -0
  175. package/esm/sync/mod.d.ts.map +1 -0
  176. package/esm/sync/mod.js +12 -0
  177. package/esm/sync/status.d.ts +23 -0
  178. package/esm/sync/status.d.ts.map +1 -0
  179. package/esm/sync/status.js +21 -0
  180. package/esm/typl/ast.d.ts +87 -0
  181. package/esm/typl/ast.d.ts.map +1 -0
  182. package/esm/typl/ast.js +21 -0
  183. package/esm/typl/bridge.d.ts +32 -0
  184. package/esm/typl/bridge.d.ts.map +1 -0
  185. package/esm/typl/bridge.js +27 -0
  186. package/esm/typl/bullet.d.ts +34 -0
  187. package/esm/typl/bullet.d.ts.map +1 -0
  188. package/esm/typl/bullet.js +44 -0
  189. package/esm/typl/diagnostics.d.ts +43 -0
  190. package/esm/typl/diagnostics.d.ts.map +1 -0
  191. package/esm/typl/diagnostics.js +61 -0
  192. package/esm/typl/fence.d.ts +31 -0
  193. package/esm/typl/fence.d.ts.map +1 -0
  194. package/esm/typl/fence.js +24 -0
  195. package/esm/typl/grammar.d.ts +20 -0
  196. package/esm/typl/grammar.d.ts.map +1 -0
  197. package/esm/typl/grammar.js +471 -0
  198. package/esm/typl/inline.d.ts +34 -0
  199. package/esm/typl/inline.d.ts.map +1 -0
  200. package/esm/typl/inline.js +48 -0
  201. package/esm/typl/lexer.d.ts +37 -0
  202. package/esm/typl/lexer.d.ts.map +1 -0
  203. package/esm/typl/lexer.js +234 -0
  204. package/esm/typl/mod.d.ts +23 -0
  205. package/esm/typl/mod.d.ts.map +1 -0
  206. package/esm/typl/mod.js +16 -0
  207. package/esm/typl/registry.d.ts +42 -0
  208. package/esm/typl/registry.d.ts.map +1 -0
  209. package/esm/typl/registry.js +26 -0
  210. package/esm/typl/validator.d.ts +29 -0
  211. package/esm/typl/validator.d.ts.map +1 -0
  212. package/esm/typl/validator.js +141 -0
  213. package/esm/util/line_endings.d.ts +33 -0
  214. package/esm/util/line_endings.d.ts.map +1 -0
  215. package/esm/util/line_endings.js +53 -0
  216. package/esm/util/modals.d.ts +29 -0
  217. package/esm/util/modals.d.ts.map +1 -0
  218. package/esm/util/modals.js +38 -0
  219. package/esm/validator/discipline.d.ts +35 -0
  220. package/esm/validator/discipline.d.ts.map +1 -0
  221. package/esm/validator/discipline.js +204 -0
  222. package/esm/validator/mod.d.ts +1 -1
  223. package/esm/validator/mod.d.ts.map +1 -1
  224. package/esm/validator/mod.js +23 -2
  225. package/esm/validator/modal_keywords.d.ts +15 -13
  226. package/esm/validator/modal_keywords.d.ts.map +1 -1
  227. package/esm/validator/modal_keywords.js +26 -109
  228. package/esm/validator/pattern.d.ts +15 -8
  229. package/esm/validator/pattern.d.ts.map +1 -1
  230. package/esm/validator/pattern.js +42 -19
  231. package/esm/validator/per_type_attrs.d.ts +2 -2
  232. package/esm/validator/per_type_attrs.d.ts.map +1 -1
  233. package/esm/validator/per_type_attrs.js +2 -2
  234. package/esm/validator/pipeline.d.ts +11 -0
  235. package/esm/validator/pipeline.d.ts.map +1 -1
  236. package/esm/validator/pipeline.js +37 -15
  237. package/esm/validator/type_resolution.d.ts +3 -3
  238. package/esm/validator/type_resolution.d.ts.map +1 -1
  239. package/esm/validator/type_resolution.js +31 -9
  240. package/package.json +2 -2
  241. package/script/ast/build.d.ts +11 -21
  242. package/script/ast/build.d.ts.map +1 -1
  243. package/script/ast/build.js +51 -140
  244. package/script/ast/nodes.d.ts +11 -43
  245. package/script/ast/nodes.d.ts.map +1 -1
  246. package/script/ast/nodes.js +6 -1
  247. package/script/ast/normalize.d.ts +8 -17
  248. package/script/ast/normalize.d.ts.map +1 -1
  249. package/script/ast/normalize.js +16 -74
  250. package/script/compiler/constants.d.ts +16 -0
  251. package/script/compiler/constants.d.ts.map +1 -0
  252. package/script/compiler/constants.js +29 -0
  253. package/script/compiler/discipline_classifier.d.ts +55 -0
  254. package/script/compiler/discipline_classifier.d.ts.map +1 -0
  255. package/script/compiler/discipline_classifier.js +196 -0
  256. package/script/compiler/inverses.d.ts +7 -0
  257. package/script/compiler/inverses.d.ts.map +1 -1
  258. package/script/compiler/inverses.js +2 -19
  259. package/script/compiler/mod.d.ts +30 -1
  260. package/script/compiler/mod.d.ts.map +1 -1
  261. package/script/compiler/mod.js +202 -69
  262. package/script/compiler/schema.d.ts +15 -0
  263. package/script/compiler/schema.d.ts.map +1 -1
  264. package/script/compiler/schema.js +12 -0
  265. package/script/config/markspec.d.ts +5 -0
  266. package/script/config/markspec.d.ts.map +1 -1
  267. package/script/config/markspec.js +17 -2
  268. package/script/formatter/mod.d.ts +9 -3
  269. package/script/formatter/mod.d.ts.map +1 -1
  270. package/script/formatter/mod.js +99 -51
  271. package/script/lexicons/loader.d.ts +35 -0
  272. package/script/lexicons/loader.d.ts.map +1 -0
  273. package/script/lexicons/loader.js +55 -0
  274. package/script/lexicons/mod.d.ts +13 -0
  275. package/script/lexicons/mod.d.ts.map +1 -0
  276. package/script/lexicons/mod.js +17 -0
  277. package/script/lint/glossary.d.ts +45 -0
  278. package/script/lint/glossary.d.ts.map +1 -0
  279. package/script/lint/glossary.js +88 -0
  280. package/script/lint/mod.d.ts +4 -0
  281. package/script/lint/mod.d.ts.map +1 -1
  282. package/script/lint/mod.js +6 -1
  283. package/script/lint/range_util.d.ts +25 -0
  284. package/script/lint/range_util.d.ts.map +1 -0
  285. package/script/lint/range_util.js +53 -0
  286. package/script/lint/rules/ears.d.ts +39 -0
  287. package/script/lint/rules/ears.d.ts.map +1 -0
  288. package/script/lint/rules/ears.js +320 -0
  289. package/script/lint/rules/incose_sentence.d.ts +46 -0
  290. package/script/lint/rules/incose_sentence.d.ts.map +1 -0
  291. package/script/lint/rules/incose_sentence.js +421 -0
  292. package/script/lint/rules/modal_sentence.d.ts +46 -0
  293. package/script/lint/rules/modal_sentence.d.ts.map +1 -0
  294. package/script/lint/rules/modal_sentence.js +150 -0
  295. package/script/lint/rules/passive.d.ts +64 -0
  296. package/script/lint/rules/passive.d.ts.map +1 -0
  297. package/script/lint/rules/passive.js +286 -0
  298. package/script/lint/rules/suppression.d.ts +38 -3
  299. package/script/lint/rules/suppression.d.ts.map +1 -1
  300. package/script/lint/rules/suppression.js +59 -3
  301. package/script/lint/rules/xref.d.ts +19 -0
  302. package/script/lint/rules/xref.d.ts.map +1 -0
  303. package/script/lint/rules/xref.js +251 -0
  304. package/script/lint/runner.d.ts +31 -11
  305. package/script/lint/runner.d.ts.map +1 -1
  306. package/script/lint/runner.js +67 -26
  307. package/script/lint/score.d.ts +64 -0
  308. package/script/lint/score.d.ts.map +1 -0
  309. package/script/lint/score.js +167 -0
  310. package/script/lint/segmenter.d.ts +32 -0
  311. package/script/lint/segmenter.d.ts.map +1 -0
  312. package/script/lint/segmenter.js +82 -0
  313. package/script/lint/types.d.ts +12 -0
  314. package/script/lint/types.d.ts.map +1 -1
  315. package/script/lock/canonical_edges.d.ts +31 -0
  316. package/script/lock/canonical_edges.d.ts.map +1 -0
  317. package/script/lock/canonical_edges.js +61 -0
  318. package/script/lock/check.d.ts +24 -0
  319. package/script/lock/check.d.ts.map +1 -0
  320. package/script/lock/check.js +130 -0
  321. package/script/lock/hash.d.ts +12 -0
  322. package/script/lock/hash.d.ts.map +1 -0
  323. package/script/lock/hash.js +36 -0
  324. package/script/lock/mod.d.ts +19 -0
  325. package/script/lock/mod.d.ts.map +1 -0
  326. package/script/lock/mod.js +31 -0
  327. package/script/lock/model.d.ts +81 -0
  328. package/script/lock/model.d.ts.map +1 -0
  329. package/script/lock/model.js +10 -0
  330. package/script/lock/parser.d.ts +26 -0
  331. package/script/lock/parser.d.ts.map +1 -0
  332. package/script/lock/parser.js +198 -0
  333. package/script/lock/resolve.d.ts +142 -0
  334. package/script/lock/resolve.d.ts.map +1 -0
  335. package/script/lock/resolve.js +397 -0
  336. package/script/lock/serializer.d.ts +14 -0
  337. package/script/lock/serializer.d.ts.map +1 -0
  338. package/script/lock/serializer.js +107 -0
  339. package/script/mod.d.ts +16 -9
  340. package/script/mod.d.ts.map +1 -1
  341. package/script/mod.js +111 -38
  342. package/script/model/attributes.d.ts +6 -0
  343. package/script/model/attributes.d.ts.map +1 -1
  344. package/script/model/attributes.js +38 -1
  345. package/script/model/discipline.d.ts +53 -0
  346. package/script/model/discipline.d.ts.map +1 -0
  347. package/script/model/discipline.js +53 -0
  348. package/script/model/mod.d.ts +188 -30
  349. package/script/model/mod.d.ts.map +1 -1
  350. package/script/model/mod.js +48 -1
  351. package/script/model/profile.d.ts +69 -0
  352. package/script/model/profile.d.ts.map +1 -1
  353. package/script/parser/attributes.d.ts.map +1 -1
  354. package/script/parser/attributes.js +1 -10
  355. package/script/parser/body_tokens.d.ts +35 -0
  356. package/script/parser/body_tokens.d.ts.map +1 -0
  357. package/script/parser/body_tokens.js +235 -0
  358. package/script/parser/glossary.d.ts +8 -0
  359. package/script/parser/glossary.d.ts.map +1 -1
  360. package/script/parser/glossary.js +7 -4
  361. package/script/parser/grammars.d.ts +5 -3
  362. package/script/parser/grammars.d.ts.map +1 -1
  363. package/script/parser/grammars.js +15 -8
  364. package/script/parser/language_spec.d.ts +55 -0
  365. package/script/parser/language_spec.d.ts.map +1 -0
  366. package/script/parser/language_spec.js +423 -0
  367. package/script/parser/line_map.d.ts +60 -0
  368. package/script/parser/line_map.d.ts.map +1 -0
  369. package/script/parser/line_map.js +44 -0
  370. package/script/parser/markdown.d.ts +9 -0
  371. package/script/parser/markdown.d.ts.map +1 -1
  372. package/script/parser/markdown.js +105 -29
  373. package/script/parser/mod.d.ts +4 -0
  374. package/script/parser/mod.d.ts.map +1 -1
  375. package/script/parser/mod.js +32 -7
  376. package/script/parser/source.d.ts +39 -8
  377. package/script/parser/source.d.ts.map +1 -1
  378. package/script/parser/source.js +156 -69
  379. package/script/parser/translate.d.ts +24 -0
  380. package/script/parser/translate.d.ts.map +1 -0
  381. package/script/parser/translate.js +102 -0
  382. package/script/profile/chain.d.ts +8 -0
  383. package/script/profile/chain.d.ts.map +1 -1
  384. package/script/profile/chain.js +29 -1
  385. package/script/profile/default_profile.d.ts +25 -0
  386. package/script/profile/default_profile.d.ts.map +1 -0
  387. package/script/profile/default_profile.js +46 -0
  388. package/script/profile/discipline_mode.d.ts +64 -0
  389. package/script/profile/discipline_mode.d.ts.map +1 -0
  390. package/script/profile/discipline_mode.js +138 -0
  391. package/script/profile/discipline_registry.d.ts +41 -0
  392. package/script/profile/discipline_registry.d.ts.map +1 -0
  393. package/script/profile/discipline_registry.js +70 -0
  394. package/script/profile/load.d.ts +3 -1
  395. package/script/profile/load.d.ts.map +1 -1
  396. package/script/profile/load.js +24 -5
  397. package/script/profile/manifest.d.ts.map +1 -1
  398. package/script/profile/manifest.js +252 -19
  399. package/script/profile/merge.d.ts.map +1 -1
  400. package/script/profile/merge.js +112 -0
  401. package/script/profile/mod.d.ts +2 -0
  402. package/script/profile/mod.d.ts.map +1 -1
  403. package/script/profile/mod.js +6 -1
  404. package/script/sync/locked_attributes.d.ts +19 -0
  405. package/script/sync/locked_attributes.d.ts.map +1 -0
  406. package/script/sync/locked_attributes.js +30 -0
  407. package/script/sync/log.d.ts +34 -0
  408. package/script/sync/log.d.ts.map +1 -0
  409. package/script/sync/log.js +52 -0
  410. package/script/sync/mapping.d.ts +66 -0
  411. package/script/sync/mapping.d.ts.map +1 -0
  412. package/script/sync/mapping.js +169 -0
  413. package/script/sync/mod.d.ts +16 -0
  414. package/script/sync/mod.d.ts.map +1 -0
  415. package/script/sync/mod.js +21 -0
  416. package/script/sync/status.d.ts +23 -0
  417. package/script/sync/status.d.ts.map +1 -0
  418. package/script/sync/status.js +24 -0
  419. package/script/typl/ast.d.ts +87 -0
  420. package/script/typl/ast.d.ts.map +1 -0
  421. package/script/typl/ast.js +24 -0
  422. package/script/typl/bridge.d.ts +32 -0
  423. package/script/typl/bridge.d.ts.map +1 -0
  424. package/script/typl/bridge.js +30 -0
  425. package/script/typl/bullet.d.ts +34 -0
  426. package/script/typl/bullet.d.ts.map +1 -0
  427. package/script/typl/bullet.js +47 -0
  428. package/script/typl/diagnostics.d.ts +43 -0
  429. package/script/typl/diagnostics.d.ts.map +1 -0
  430. package/script/typl/diagnostics.js +65 -0
  431. package/script/typl/fence.d.ts +31 -0
  432. package/script/typl/fence.d.ts.map +1 -0
  433. package/script/typl/fence.js +27 -0
  434. package/script/typl/grammar.d.ts +20 -0
  435. package/script/typl/grammar.d.ts.map +1 -0
  436. package/script/typl/grammar.js +474 -0
  437. package/script/typl/inline.d.ts +34 -0
  438. package/script/typl/inline.d.ts.map +1 -0
  439. package/script/typl/inline.js +51 -0
  440. package/script/typl/lexer.d.ts +37 -0
  441. package/script/typl/lexer.d.ts.map +1 -0
  442. package/script/typl/lexer.js +237 -0
  443. package/script/typl/mod.d.ts +23 -0
  444. package/script/typl/mod.d.ts.map +1 -0
  445. package/script/typl/mod.js +29 -0
  446. package/script/typl/registry.d.ts +42 -0
  447. package/script/typl/registry.d.ts.map +1 -0
  448. package/script/typl/registry.js +29 -0
  449. package/script/typl/validator.d.ts +29 -0
  450. package/script/typl/validator.d.ts.map +1 -0
  451. package/script/typl/validator.js +144 -0
  452. package/script/util/line_endings.d.ts +33 -0
  453. package/script/util/line_endings.d.ts.map +1 -0
  454. package/script/util/line_endings.js +58 -0
  455. package/script/util/modals.d.ts +29 -0
  456. package/script/util/modals.d.ts.map +1 -0
  457. package/script/util/modals.js +42 -0
  458. package/script/validator/discipline.d.ts +35 -0
  459. package/script/validator/discipline.d.ts.map +1 -0
  460. package/script/validator/discipline.js +207 -0
  461. package/script/validator/mod.d.ts +1 -1
  462. package/script/validator/mod.d.ts.map +1 -1
  463. package/script/validator/mod.js +23 -1
  464. package/script/validator/modal_keywords.d.ts +15 -13
  465. package/script/validator/modal_keywords.d.ts.map +1 -1
  466. package/script/validator/modal_keywords.js +26 -109
  467. package/script/validator/pattern.d.ts +15 -8
  468. package/script/validator/pattern.d.ts.map +1 -1
  469. package/script/validator/pattern.js +42 -19
  470. package/script/validator/per_type_attrs.d.ts +2 -2
  471. package/script/validator/per_type_attrs.d.ts.map +1 -1
  472. package/script/validator/per_type_attrs.js +2 -2
  473. package/script/validator/pipeline.d.ts +11 -0
  474. package/script/validator/pipeline.d.ts.map +1 -1
  475. package/script/validator/pipeline.js +40 -17
  476. package/script/validator/type_resolution.d.ts +3 -3
  477. package/script/validator/type_resolution.d.ts.map +1 -1
  478. package/script/validator/type_resolution.js +31 -9
  479. package/esm/parser/entity_refs.d.ts +0 -53
  480. package/esm/parser/entity_refs.d.ts.map +0 -1
  481. package/esm/parser/entity_refs.js +0 -151
  482. package/script/parser/entity_refs.d.ts +0 -53
  483. package/script/parser/entity_refs.d.ts.map +0 -1
  484. package/script/parser/entity_refs.js +0 -155
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @module core/util/modals
3
+ *
4
+ * RFC 2119 and EARS modal-keyword helpers shared by `formatter/mod.ts`
5
+ * and `ast/normalize.ts`. Extracted to `core/util/` to avoid a dep cycle:
6
+ * `ast/` is a dependency of `formatter/`, so `formatter → ast` is OK but
7
+ * `ast → formatter` is not.
8
+ */
9
+ /**
10
+ * RFC 2119 modal keywords in uppercase form, with optional ` NOT` suffix.
11
+ * Captured for canonical-form normalisation per spec §3.4.1: uppercase
12
+ * input is accepted but emitted lowercase, unconditionally.
13
+ */
14
+ export const RFC2119_MODAL_RE = /\b(SHALL|SHOULD|MAY|MUST)(\s+NOT)?\b/g;
15
+ /**
16
+ * EARS keywords subject to the sentence-initial rule of spec §3.4.1:
17
+ * lowercased when mid-sentence, preserved when starting a sentence.
18
+ * `If…then` is deferred to a later slice because its multi-token form
19
+ * needs separate handling.
20
+ */
21
+ export const EARS_KEYWORD_RE = /\b(When|While|Where|Unless)\b/g;
22
+ /**
23
+ * Decide whether the EARS keyword at `offset` in `line` is at sentence
24
+ * start (return value true). Walks left over whitespace and reports true
25
+ * when it hits the beginning of the line or a sentence-terminating
26
+ * punctuation character (`.`, `!`, `?`).
27
+ */
28
+ export function isSentenceInitial(line, offset) {
29
+ if (offset === 0)
30
+ return true;
31
+ let i = offset - 1;
32
+ while (i >= 0 && (line[i] === " " || line[i] === "\t"))
33
+ i--;
34
+ if (i < 0)
35
+ return true;
36
+ const prev = line[i];
37
+ return prev === "." || prev === "!" || prev === "?";
38
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @module core/validator/discipline
3
+ *
4
+ * Discipline-attribute validator per ADR-017 Slice 3. Emits seven codes:
5
+ *
6
+ * - MSL-T025 — `Discipline:` value not in the effective kind set (error)
7
+ * - MSL-T026 — `Discipline-frozen:` value malformed (error)
8
+ * - MSL-T027 — `Discipline-frozen:` kind not in the effective set (error)
9
+ * - MSL-T028 — `Discipline:` conflicts with channel-3 derivation (warning)
10
+ * - MSL-T029 — `Discipline:` conflicts with channel-4 derivation (warning)
11
+ * - MSL-T030 — `Discipline-frozen:` differs from current derivation (warning)
12
+ * - MSL-T031 — `Discipline:` and `Discipline-frozen:` disagree (warning)
13
+ *
14
+ * The effective kind set used by T025/T027 is `CORE_KINDS` plus any kinds
15
+ * the active profile chain declared via `profile.kinds:` (Slice 2's
16
+ * effective registry).
17
+ *
18
+ * Tasks 5–8 of the plan add T026–T031 incrementally on top of this skeleton.
19
+ */
20
+ import type { Diagnostic, DisciplineRegistry, DisplayId, Entry } from "../model/mod.js";
21
+ /**
22
+ * Validate the `Discipline:` and `Discipline-frozen:` attributes across
23
+ * every entry. Pure function: takes the entries, a lookup map (used by
24
+ * later tasks for channel-4 derivation), and the effective registry.
25
+ *
26
+ * @param entries Entries to walk.
27
+ * @param entriesByDisplayId Lookup map for channel-4 derivation. Tasks 5–8
28
+ * will use this; Task 4 ignores it but keeps the parameter to fix the
29
+ * signature now.
30
+ * @param registry Effective discipline registry from Slice 2's
31
+ * `buildEffectiveDisciplineRegistry()`, or `CORE_DISCIPLINE_REGISTRY` in
32
+ * core-only mode.
33
+ */
34
+ export declare function validateDiscipline(entries: readonly Entry[], entriesByDisplayId: ReadonlyMap<DisplayId, Entry>, registry: DisciplineRegistry): Diagnostic[];
35
+ //# sourceMappingURL=discipline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discipline.d.ts","sourceRoot":"","sources":["../../src/validator/discipline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,KAAK,EACN,MAAM,iBAAiB,CAAC;AAmFzB;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,kBAAkB,EAAE,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,EACjD,QAAQ,EAAE,kBAAkB,GAC3B,UAAU,EAAE,CAuHd"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * @module core/validator/discipline
3
+ *
4
+ * Discipline-attribute validator per ADR-017 Slice 3. Emits seven codes:
5
+ *
6
+ * - MSL-T025 — `Discipline:` value not in the effective kind set (error)
7
+ * - MSL-T026 — `Discipline-frozen:` value malformed (error)
8
+ * - MSL-T027 — `Discipline-frozen:` kind not in the effective set (error)
9
+ * - MSL-T028 — `Discipline:` conflicts with channel-3 derivation (warning)
10
+ * - MSL-T029 — `Discipline:` conflicts with channel-4 derivation (warning)
11
+ * - MSL-T030 — `Discipline-frozen:` differs from current derivation (warning)
12
+ * - MSL-T031 — `Discipline:` and `Discipline-frozen:` disagree (warning)
13
+ *
14
+ * The effective kind set used by T025/T027 is `CORE_KINDS` plus any kinds
15
+ * the active profile chain declared via `profile.kinds:` (Slice 2's
16
+ * effective registry).
17
+ *
18
+ * Tasks 5–8 of the plan add T026–T031 incrementally on top of this skeleton.
19
+ */
20
+ import { CORE_KINDS, makeDisplayId, MIXED_DISCIPLINE } from "../model/mod.js";
21
+ import { classifyDerivationOnly, parseFrozenValue, } from "../compiler/discipline_classifier.js";
22
+ /**
23
+ * Read the first non-empty value of a single-cardinality attribute. Mirrors
24
+ * the helper in the classifier so the validator doesn't need to import it.
25
+ */
26
+ function singleAttrValue(entry, key) {
27
+ for (const attr of entry.rawAttributes) {
28
+ if (attr.key === key) {
29
+ const trimmed = attr.value.trim();
30
+ if (trimmed.length > 0)
31
+ return trimmed;
32
+ }
33
+ }
34
+ return undefined;
35
+ }
36
+ /**
37
+ * Build the effective kind set from `CORE_KINDS` plus every type → kind
38
+ * value the registry contains.
39
+ */
40
+ function effectiveKindSet(registry) {
41
+ const set = new Set(CORE_KINDS);
42
+ for (const kind of registry.values())
43
+ set.add(kind);
44
+ return set;
45
+ }
46
+ /**
47
+ * Compute channel-3 alone for an entry — what the type-based registry
48
+ * lookup would yield. Returns `undefined` when no type or unknown type.
49
+ */
50
+ function channel3Kind(entry, registry) {
51
+ if (entry.type === undefined) {
52
+ // Fallback: look at the raw Type: attribute (mirrors resolvedType()
53
+ // in the classifier so the validator works in core-only mode).
54
+ for (const attr of entry.rawAttributes) {
55
+ if (attr.key === "Type") {
56
+ const trimmed = attr.value.trim();
57
+ if (trimmed.length > 0)
58
+ return registry.get(trimmed);
59
+ }
60
+ }
61
+ return undefined;
62
+ }
63
+ return registry.get(entry.type);
64
+ }
65
+ /**
66
+ * Compute channel-4 alone for an entry — walk Allocated-to targets,
67
+ * return the unique discipline if one, MIXED_DISCIPLINE if many,
68
+ * `undefined` if none.
69
+ */
70
+ function channel4Kind(entry, entriesByDisplayId, registry) {
71
+ const seen = new Set();
72
+ for (const attr of entry.rawAttributes) {
73
+ if (attr.key !== "Allocated-to")
74
+ continue;
75
+ for (const raw of attr.value.split(",")) {
76
+ const token = raw.trim();
77
+ if (token.length === 0)
78
+ continue;
79
+ const target = entriesByDisplayId.get(makeDisplayId(token));
80
+ if (!target)
81
+ continue;
82
+ const targetType = target.type ??
83
+ target.rawAttributes.find((a) => a.key === "Type")?.value.trim();
84
+ if (!targetType)
85
+ continue;
86
+ const kind = registry.get(targetType);
87
+ if (kind !== undefined)
88
+ seen.add(kind);
89
+ }
90
+ }
91
+ if (seen.size === 0)
92
+ return undefined;
93
+ if (seen.size === 1)
94
+ return [...seen][0];
95
+ return MIXED_DISCIPLINE;
96
+ }
97
+ /**
98
+ * Validate the `Discipline:` and `Discipline-frozen:` attributes across
99
+ * every entry. Pure function: takes the entries, a lookup map (used by
100
+ * later tasks for channel-4 derivation), and the effective registry.
101
+ *
102
+ * @param entries Entries to walk.
103
+ * @param entriesByDisplayId Lookup map for channel-4 derivation. Tasks 5–8
104
+ * will use this; Task 4 ignores it but keeps the parameter to fix the
105
+ * signature now.
106
+ * @param registry Effective discipline registry from Slice 2's
107
+ * `buildEffectiveDisciplineRegistry()`, or `CORE_DISCIPLINE_REGISTRY` in
108
+ * core-only mode.
109
+ */
110
+ export function validateDiscipline(entries, entriesByDisplayId, registry) {
111
+ const out = [];
112
+ const knownKinds = effectiveKindSet(registry);
113
+ for (const entry of entries) {
114
+ const override = singleAttrValue(entry, "Discipline");
115
+ if (override !== undefined && !knownKinds.has(override)) {
116
+ out.push({
117
+ code: "MSL-T025",
118
+ severity: "error",
119
+ message: `${entry.displayId}: Discipline: '${override}' is not a known kind (declare it under profile.kinds: or use a core kind: ${[...CORE_KINDS].join(" / ")})`,
120
+ location: entry.location,
121
+ });
122
+ }
123
+ const frozen = singleAttrValue(entry, "Discipline-frozen");
124
+ if (frozen !== undefined) {
125
+ const parsed = parseFrozenValue(frozen);
126
+ if (parsed === undefined) {
127
+ out.push({
128
+ code: "MSL-T026",
129
+ severity: "error",
130
+ message: `${entry.displayId}: Discipline-frozen: '${frozen}' is malformed (expected '<kind>' or '<kind> @ YYYY-MM-DD'; kind must match /^[a-z][a-z0-9-]*$/; date must be calendar-valid)`,
131
+ location: entry.location,
132
+ });
133
+ }
134
+ else if (!knownKinds.has(parsed.kind)) {
135
+ out.push({
136
+ code: "MSL-T027",
137
+ severity: "error",
138
+ message: `${entry.displayId}: Discipline-frozen: kind '${parsed.kind}' is not a known kind (declare it under profile.kinds: or use a core kind: ${[...CORE_KINDS].join(" / ")})`,
139
+ location: entry.location,
140
+ });
141
+ }
142
+ }
143
+ // T028 / T029: override vs channel-3 / channel-4 conflicts. Only run
144
+ // when the override is well-formed (suppressed by T025) and a channel
145
+ // actually produced a kind (default-system suppression).
146
+ if (override !== undefined && knownKinds.has(override)) {
147
+ const c3 = channel3Kind(entry, registry);
148
+ if (c3 !== undefined && c3 !== override) {
149
+ out.push({
150
+ code: "MSL-T028",
151
+ severity: "warning",
152
+ message: `${entry.displayId}: Discipline: '${override}' conflicts with type-based derivation '${c3}' (from Type: ${entry.type ?? "(raw)"})`,
153
+ location: entry.location,
154
+ });
155
+ }
156
+ const c4 = channel4Kind(entry, entriesByDisplayId, registry);
157
+ if (c4 !== undefined && c4 !== override) {
158
+ out.push({
159
+ code: "MSL-T029",
160
+ severity: "warning",
161
+ message: `${entry.displayId}: Discipline: '${override}' conflicts with allocation-based derivation '${c4}' (via Allocated-to)`,
162
+ location: entry.location,
163
+ });
164
+ }
165
+ }
166
+ // T030: freeze divergence. Runs whenever the freeze is well-formed
167
+ // and references a known kind — NOT suppressed by default-system
168
+ // derivation (drift from a known kind to default-system is exactly
169
+ // what freeze is designed to surface).
170
+ if (frozen !== undefined) {
171
+ const parsedF = parseFrozenValue(frozen);
172
+ if (parsedF !== undefined && knownKinds.has(parsedF.kind)) {
173
+ const current = classifyDerivationOnly(entry, entriesByDisplayId, registry);
174
+ if (current !== parsedF.kind) {
175
+ out.push({
176
+ code: "MSL-T030",
177
+ severity: "warning",
178
+ message: `${entry.displayId}: Discipline-frozen: '${parsedF.kind}' differs from current derivation '${current}' (something changed since the freeze on ${parsedF.date ?? "(no date)"})`,
179
+ location: entry.location,
180
+ });
181
+ }
182
+ }
183
+ }
184
+ // T031: override vs freeze disagreement. Both must be well-formed
185
+ // and reference known kinds — otherwise upstream errors (T025/T026/T027)
186
+ // handle the case.
187
+ if (override !== undefined &&
188
+ knownKinds.has(override) &&
189
+ frozen !== undefined) {
190
+ const parsedF = parseFrozenValue(frozen);
191
+ if (parsedF !== undefined && knownKinds.has(parsedF.kind)) {
192
+ if (override !== parsedF.kind) {
193
+ out.push({
194
+ code: "MSL-T031",
195
+ severity: "warning",
196
+ message: `${entry.displayId}: Discipline: '${override}' disagrees with Discipline-frozen: '${parsedF.kind}' (the override wins for derivedDiscipline; remove or update the freeze if the override is intentional)`,
197
+ location: entry.location,
198
+ });
199
+ }
200
+ }
201
+ }
202
+ }
203
+ return out;
204
+ }
@@ -30,7 +30,7 @@ export interface ValidateResult {
30
30
  export declare function validate(entries: readonly Entry[]): ValidateResult;
31
31
  export declare function indexByDisplayId(entries: readonly Entry[]): ReadonlyMap<string, Entry>;
32
32
  export declare function findAttr(attrs: readonly Attribute[], key: string): Attribute | undefined;
33
- export { runPipeline } from "./pipeline.js";
33
+ export { runPipeline, suppressDeclaredAttrR010 } from "./pipeline.js";
34
34
  export type { PipelineResult } from "./pipeline.js";
35
35
  export { validateListingDocuments } from "./listing.js";
36
36
  export type { ListingFileContext, ListingKind } from "./listing.js";
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAmCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAQlE;AAwZD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAqCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAclE;AA2aD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC"}
@@ -13,8 +13,9 @@
13
13
  * constraints, enum vocabularies) are profile-declared and evaluated by
14
14
  * a profile-aware validator layer (not in the core).
15
15
  */
16
- import { attributeSpec, CORE_TYPE_SCOPED_ATTRS, IDENTITY_KEY, ULID_RE, UNIVERSAL_ATTRIBUTE_KEYS, URI_SCHEME_RE, } from "../model/mod.js";
16
+ import { attributeSpec, CORE_TYPE_SCOPED_ATTRS, CSV_SPLITTABLE_TYPES, IDENTITY_KEY, ULID_RE, UNIVERSAL_ATTRIBUTE_KEYS, URI_SCHEME_RE, } from "../model/mod.js";
17
17
  import { HTTP_URL_RE } from "./value_types.js";
18
+ import { validateTypl } from "../typl/mod.js";
18
19
  /** Universal attribute keys the core recognizes. */
19
20
  const UNIVERSAL_KEYS = new Set(UNIVERSAL_ATTRIBUTE_KEYS);
20
21
  /**
@@ -46,6 +47,11 @@ export function validate(entries) {
46
47
  const diagnostics = [];
47
48
  checkStructural(entries, diagnostics);
48
49
  checkReferences(entries, diagnostics);
50
+ // Typl cross-entry collisions (TYPL-002/003) and undefined-typedef-refs
51
+ // (TYPL-005). Per-block diagnostics (TYPL-001/004/006/007/008) already
52
+ // fired during parse via the bridge.
53
+ const typlResult = validateTypl(entries);
54
+ diagnostics.push(...typlResult.diagnostics);
49
55
  const valid = !diagnostics.some((d) => d.severity === "error");
50
56
  return { diagnostics, valid };
51
57
  }
@@ -362,6 +368,21 @@ function checkStructural(entries, diagnostics) {
362
368
  location: entry.location,
363
369
  });
364
370
  }
371
+ // MSL-A006: empty element in CSV attribute value (e.g. "A,,B").
372
+ const csvSpec = attributeSpec(attr.key);
373
+ if (csvSpec && CSV_SPLITTABLE_TYPES.has(csvSpec.type) &&
374
+ attr.value.includes(",")) {
375
+ const parts = attr.value.split(",").map((s) => s.trim());
376
+ const emptyCount = parts.filter((s) => s.length === 0).length;
377
+ if (emptyCount > 0) {
378
+ diagnostics.push({
379
+ code: "MSL-A006",
380
+ severity: "warning",
381
+ message: `${entry.displayId}: attribute '${attr.key}' contains ${emptyCount} empty element(s) in CSV value "${attr.value}"`,
382
+ location: entry.location,
383
+ });
384
+ }
385
+ }
365
386
  }
366
387
  }
367
388
  }
@@ -445,7 +466,7 @@ export function indexByDisplayId(entries) {
445
466
  export function findAttr(attrs, key) {
446
467
  return attrs.find((a) => a.key === key);
447
468
  }
448
- export { runPipeline } from "./pipeline.js";
469
+ export { runPipeline, suppressDeclaredAttrR010 } from "./pipeline.js";
449
470
  export { validateListingDocuments } from "./listing.js";
450
471
  export { classifyEntriesStage, classifyEntry } from "./types.js";
451
472
  export { compileDisplayIdPattern } from "./pattern.js";
@@ -2,22 +2,24 @@
2
2
  * @module core/validator/modal_keywords
3
3
  *
4
4
  * MSL-M060 validator — uppercase RFC 2119 modal keyword (`SHALL`,
5
- * `SHOULD`, `MAY`, `MUST`, optionally `… NOT`) in entry-body prose.
6
- * The formatter normalises these to lowercase per spec §3.4.1; this
7
- * validator surfaces the deviation in a lint-only flow. Profiles may
8
- * promote the severity. Each prose-bearing node's `InlineContent.markers`
9
- * carries pre-extracted `ModalMarker` objects from the builder; an
10
- * uppercase match is detected where `marker.raw` differs from
11
- * `marker.canonical`. EARS markers are not flagged — MSL-M060 targets
12
- * RFC 2119 only. Code, Feature, and Math blocks are automatically
13
- * excluded because the builder does not extract markers from verbatim
14
- * content.
5
+ * `SHOULD`, `MAY`, `MUST`, `WILL`) in entry-body prose. The formatter
6
+ * normalises these to lowercase per spec §3.4.1; this validator
7
+ * surfaces the deviation in a lint-only flow. Profiles may promote the
8
+ * severity.
9
+ *
10
+ * Reads `Entry.bodyTokens` (ADR-016) and filters for `kind === "modal"`
11
+ * AND `case === "upper"`. Code, feature, and math blocks are
12
+ * automatically excluded because the parser's `extractBodyTokens` does
13
+ * not emit tokens inside verbatim regions.
15
14
  */
16
15
  import type { Diagnostic, Entry } from "../model/mod.js";
17
16
  /**
18
- * Scan an entry's body for uppercase modal keywords and emit MSL-M060
19
- * for each occurrence. Severity is `warning`; the formatter rewrites
20
- * them on the next run.
17
+ * MSL-M060: report every uppercase RFC 2119 modal keyword in entry-body
18
+ * prose. Emits one diagnostic per uppercase occurrence with the exact
19
+ * source text in the message.
20
+ *
21
+ * MSL-M061: report when a Requirement-type entry contains no modal
22
+ * keyword at all (info severity; style hint to add an obligation verb).
21
23
  */
22
24
  export declare function validateModalKeywords(entry: Entry): readonly Diagnostic[];
23
25
  //# sourceMappingURL=modal_keywords.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal_keywords.d.ts","sourceRoot":"","sources":["../../src/validator/modal_keywords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAiFzD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAkDzE"}
1
+ {"version":3,"file":"modal_keywords.d.ts","sourceRoot":"","sources":["../../src/validator/modal_keywords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAa,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKpE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAoCzE"}
@@ -2,121 +2,38 @@
2
2
  * @module core/validator/modal_keywords
3
3
  *
4
4
  * MSL-M060 validator — uppercase RFC 2119 modal keyword (`SHALL`,
5
- * `SHOULD`, `MAY`, `MUST`, optionally `… NOT`) in entry-body prose.
6
- * The formatter normalises these to lowercase per spec §3.4.1; this
7
- * validator surfaces the deviation in a lint-only flow. Profiles may
8
- * promote the severity. Each prose-bearing node's `InlineContent.markers`
9
- * carries pre-extracted `ModalMarker` objects from the builder; an
10
- * uppercase match is detected where `marker.raw` differs from
11
- * `marker.canonical`. EARS markers are not flagged — MSL-M060 targets
12
- * RFC 2119 only. Code, Feature, and Math blocks are automatically
13
- * excluded because the builder does not extract markers from verbatim
14
- * content.
5
+ * `SHOULD`, `MAY`, `MUST`, `WILL`) in entry-body prose. The formatter
6
+ * normalises these to lowercase per spec §3.4.1; this validator
7
+ * surfaces the deviation in a lint-only flow. Profiles may promote the
8
+ * severity.
9
+ *
10
+ * Reads `Entry.bodyTokens` (ADR-016) and filters for `kind === "modal"`
11
+ * AND `case === "upper"`. Code, feature, and math blocks are
12
+ * automatically excluded because the parser's `extractBodyTokens` does
13
+ * not emit tokens inside verbatim regions.
15
14
  */
16
15
  import { resolvedCoreType } from "./type_resolution.js";
17
- // ---------------------------------------------------------------------------
18
- // Marker collection from bodyAst
19
- // ---------------------------------------------------------------------------
20
- /** Collect all modal markers from an InlineContent object. */
21
- function modalsFromInline(content) {
22
- return content.markers.filter((m) => m.kind === "modal");
23
- }
24
- /** Recursively collect modal markers from a list item's blocks. */
25
- function modalsFromListItem(item) {
26
- const out = [];
27
- for (const block of item.blocks) {
28
- out.push(...modalsFromBlock(block));
29
- }
30
- return out;
31
- }
32
- /** Collect all modal markers from a single BodyBlock (recursively). */
33
- function modalsFromBlock(block) {
34
- const out = [];
35
- switch (block.kind) {
36
- case "paragraph":
37
- out.push(...modalsFromInline(block.content));
38
- break;
39
- case "list":
40
- for (const item of block.items) {
41
- out.push(...modalsFromListItem(item));
42
- }
43
- break;
44
- case "table":
45
- for (const cell of block.header) {
46
- out.push(...modalsFromInline(cell));
47
- }
48
- for (const row of block.rows) {
49
- for (const cell of row) {
50
- out.push(...modalsFromInline(cell));
51
- }
52
- }
53
- break;
54
- case "note":
55
- out.push(...modalsFromInline(block.content));
56
- break;
57
- case "blockquote":
58
- out.push(...modalsFromInline(block.content));
59
- break;
60
- case "definition-list":
61
- for (const item of block.items) {
62
- out.push(...modalsFromInline(item.term));
63
- out.push(...modalsFromInline(item.definition));
64
- }
65
- break;
66
- case "code":
67
- case "feature":
68
- case "math":
69
- case "figure":
70
- case "caption":
71
- case "unknown":
72
- // Verbatim / structural nodes: no modal markers.
73
- break;
74
- default:
75
- break;
76
- }
77
- return out;
78
- }
79
- // ---------------------------------------------------------------------------
80
- // Public API
81
- // ---------------------------------------------------------------------------
82
16
  /**
83
- * Scan an entry's body for uppercase modal keywords and emit MSL-M060
84
- * for each occurrence. Severity is `warning`; the formatter rewrites
85
- * them on the next run.
17
+ * MSL-M060: report every uppercase RFC 2119 modal keyword in entry-body
18
+ * prose. Emits one diagnostic per uppercase occurrence with the exact
19
+ * source text in the message.
20
+ *
21
+ * MSL-M061: report when a Requirement-type entry contains no modal
22
+ * keyword at all (info severity; style hint to add an obligation verb).
86
23
  */
87
24
  export function validateModalKeywords(entry) {
88
25
  const diagnostics = [];
89
- let anyModalSeen = false;
90
- const blocks = entry.bodyAst ?? [];
91
- for (const block of blocks) {
92
- for (const marker of modalsFromBlock(block)) {
93
- anyModalSeen = true;
94
- // MSL-M060: RFC 2119 keywords in non-canonical (uppercase) form.
95
- // `marker.raw` is the original source text; `marker.canonical` is
96
- // always lowercase. When they differ, the keyword is uppercase.
97
- // EARS markers (cls = "ears") are always case-preserved and
98
- // are not subject to MSL-M060.
99
- if (marker.cls !== "rfc2119")
100
- continue;
101
- const raw = marker.raw ?? marker.canonical;
102
- if (raw === marker.canonical)
103
- continue; // already lowercase — OK
104
- diagnostics.push({
105
- code: "MSL-M060",
106
- severity: "warning",
107
- message: `${entry.displayId}: modal keyword '${raw}' in body ` +
108
- `prose is uppercase (spec §3.4.1 canonical form is lowercase; ` +
109
- `'markspec format' will rewrite it)`,
110
- location: {
111
- file: entry.location.file,
112
- // marker.range.start.line is body-relative 1-based.
113
- // entry.location.line is the title line (0-based offset 0).
114
- // Body line 1 → file line entry.location.line + 0, etc.
115
- line: entry.location.line + (marker.range.start.line - 1),
116
- column: marker.range.start.column,
117
- },
118
- });
119
- }
26
+ const modalTokens = entry.bodyTokens.filter((t) => t.kind === "modal");
27
+ const anyModalSeen = modalTokens.length > 0;
28
+ for (const t of modalTokens) {
29
+ if (t.case !== "upper")
30
+ continue;
31
+ diagnostics.push({
32
+ code: "MSL-M060",
33
+ severity: "warning",
34
+ message: `modal keyword '${t.text}' should be lowercase`,
35
+ location: t.location,
36
+ });
120
37
  }
121
38
  // MSL-M061 — Requirement-type entry contains no modal keyword
122
39
  // (info; style hint). Gated on the resolved core type being
@@ -4,20 +4,27 @@
4
4
  * Display-ID pattern template → anchored RegExp.
5
5
  *
6
6
  * Grammar (per ADR-009 §5):
7
- * pattern := literal-prefix placeholder (literal-suffix)?
8
- * placeholder := "{n}" | "{n:" PADDING "d}"
9
- * PADDING := "0" digits
7
+ * pattern := segment+ (exactly one counter)
8
+ * segment := literal | counter | named
9
+ * counter := "{n}" | "{n:" PADDING "d}"
10
+ * named := "{" identifier "}" (e.g. {scope}, {feature})
11
+ * PADDING := "0" digits
12
+ *
13
+ * The counter `{n}` is the numeric running index (exactly one required). A
14
+ * named placeholder such as `{scope}` matches a free alphanumeric segment —
15
+ * it validates the *shape* `PREFIX_<scope>_<NNNN>` without pinning the scope
16
+ * to a fixed value, so one profile pattern serves every feature scope.
10
17
  *
11
18
  * Examples:
12
- * REQ-{n} → ^REQ-(\d+)$
13
- * REQ-{n:04d} → ^REQ-(\d{4})$
14
- * STAKE-REQ-{n:06d} → ^STAKE-REQ-(\d{6})$
19
+ * REQ-{n} → ^REQ-(\d+)$
20
+ * REQ-{n:04d} → ^REQ-(\d{4})$
21
+ * XREQ_{scope}_{n:04d} → ^XREQ_(?<scope>[A-Za-z0-9]+)_(\d{4})$
15
22
  */
16
23
  /**
17
24
  * Compile a display-ID pattern template into an anchored RegExp.
18
25
  *
19
- * Throws if the template is missing the `{n}` placeholder or has an invalid
20
- * padding specifier.
26
+ * Throws if the template is missing the `{n}` counter, has more than one, or
27
+ * has an invalid padding specifier.
21
28
  */
22
29
  export declare function compileDisplayIdPattern(template: string): RegExp;
23
30
  //# sourceMappingURL=pattern.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/validator/pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA0BhE"}
1
+ {"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/validator/pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuChE"}