@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
@@ -27,6 +27,9 @@ const ALLOWED_PROFILE_KEYS = new Set([
27
27
  "conventions",
28
28
  "types",
29
29
  "documents",
30
+ "kinds",
31
+ "prose",
32
+ "discipline-mode",
30
33
  ]);
31
34
  const ALLOWED_TYPE_KEYS = new Set([
32
35
  "extends",
@@ -37,6 +40,7 @@ const ALLOWED_TYPE_KEYS = new Set([
37
40
  "attributes",
38
41
  "traceability",
39
42
  "color",
43
+ "discipline",
40
44
  ]);
41
45
  const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
42
46
  const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
@@ -174,6 +178,42 @@ function parseCardinality(raw, fallback, context, sourcePath, diagnostics) {
174
178
  }
175
179
  return { lower, upper };
176
180
  }
181
+ /**
182
+ * Flatten a (possibly grouped) value list to its leaf value names. Accepts
183
+ * items that are bare strings, `{name, description?}` objects, or
184
+ * `{group, description?, values: [...]}` group objects (recursed). Group
185
+ * labels and descriptions are documentation-only and dropped — markspec
186
+ * validates against the value names. Returns `null` when any item matches
187
+ * none of these shapes.
188
+ */
189
+ function flattenGroupedNames(raw) {
190
+ if (!Array.isArray(raw))
191
+ return null;
192
+ const out = [];
193
+ for (const item of raw) {
194
+ if (typeof item === "string") {
195
+ out.push(item);
196
+ continue;
197
+ }
198
+ if (item == null || typeof item !== "object" || Array.isArray(item)) {
199
+ return null;
200
+ }
201
+ const o = item;
202
+ if (typeof o.name === "string") {
203
+ out.push(o.name);
204
+ }
205
+ else if (Array.isArray(o.values)) {
206
+ const nested = flattenGroupedNames(o.values);
207
+ if (nested === null)
208
+ return null;
209
+ out.push(...nested);
210
+ }
211
+ else {
212
+ return null;
213
+ }
214
+ }
215
+ return out;
216
+ }
177
217
  function parseAttrDecl(raw, context, sourcePath, diagnostics) {
178
218
  if (raw == null || typeof raw !== "object" || Array.isArray(raw)) {
179
219
  diagnostics.push({
@@ -221,19 +261,18 @@ function parseAttrDecl(raw, context, sourcePath, diagnostics) {
221
261
  const cardinality = parseCardinality(r.cardinality, defaultCardinality(vtype), `${context}/${name}`, sourcePath, diagnostics);
222
262
  let values;
223
263
  if (vtype === "enum") {
224
- const rawValues = r.values;
225
- if (!Array.isArray(rawValues) ||
226
- rawValues.some((v) => typeof v !== "string") ||
227
- rawValues.length === 0) {
264
+ const flat = flattenGroupedNames(r.values);
265
+ if (flat === null || flat.length === 0) {
228
266
  diagnostics.push({
229
267
  code: "PROFILE-LOAD-003",
230
268
  severity: "error",
231
- message: `${context}: enum attribute '${name}' requires a non-empty 'values' list of strings`,
269
+ message: `${context}: enum attribute '${name}' requires a non-empty 'values' list ` +
270
+ `(strings, {name, description?}, or {group, values: [...]})`,
232
271
  location: { file: sourcePath, line: 1, column: 1 },
233
272
  });
234
273
  return undefined;
235
274
  }
236
- values = rawValues;
275
+ values = flat;
237
276
  }
238
277
  let inverse;
239
278
  if (r.inverse !== undefined) {
@@ -462,27 +501,157 @@ function parseColorsMap(raw, sourcePath, diagnostics) {
462
501
  }
463
502
  return out;
464
503
  }
465
- const KNOWN_CONVENTIONS = new Set(["modal-keywords"]);
466
- const MODAL_KEYWORDS_CASING_VALUES = new Set(["rfc2119", "iso", "preserve"]);
467
- function parseLabelConcerns(raw, sourcePath, diagnostics) {
504
+ /**
505
+ * Parse the `profile.kinds:` block. Each key must match COLOR_NAME_RE
506
+ * (the same lexical rule used for color names — lowercase letters,
507
+ * digits, hyphens, starting with a letter). Values may be:
508
+ * - `null` / `undefined` — declare the kind with no description.
509
+ * - a bare string — treated as the description shorthand.
510
+ * - a mapping with optional `description:`.
511
+ *
512
+ * Validation:
513
+ * - PROFILE-DISCIPLINE-001 (error): name fails the regex.
514
+ * - PROFILE-DISCIPLINE-002 (error): name is the reserved sentinel
515
+ * `MIXED_DISCIPLINE` ("mixed").
516
+ * - PROFILE-DISCIPLINE-003 (warning): name shadows a core kind
517
+ * (`system`/`software`/`hardware`).
518
+ */
519
+ function parseKindsMap(raw, sourcePath, diagnostics) {
520
+ const out = new Map();
468
521
  if (raw === undefined)
469
- return [];
470
- // Form A: flat sequence of strings → each becomes a flag concern.
471
- if (Array.isArray(raw)) {
472
- const concerns = [];
473
- for (const item of raw) {
474
- if (typeof item !== "string") {
522
+ return out;
523
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
524
+ diagnostics.push({
525
+ code: "PROFILE-LOAD-003",
526
+ severity: "error",
527
+ message: "profile.kinds: must be a mapping",
528
+ location: { file: sourcePath, line: 1, column: 1 },
529
+ });
530
+ return out;
531
+ }
532
+ for (const [name, value] of Object.entries(raw)) {
533
+ if (name === mod_js_1.MIXED_DISCIPLINE) {
534
+ diagnostics.push({
535
+ code: "PROFILE-DISCIPLINE-002",
536
+ severity: "error",
537
+ message: `profile.kinds: '${name}' is a reserved sentinel name; choose a different kind name`,
538
+ location: { file: sourcePath, line: 1, column: 1 },
539
+ });
540
+ continue;
541
+ }
542
+ if (!mod_js_1.COLOR_NAME_RE.test(name)) {
543
+ diagnostics.push({
544
+ code: "PROFILE-DISCIPLINE-001",
545
+ severity: "error",
546
+ message: `profile.kinds: '${name}' is not a valid kind name (lowercase letters, digits, hyphens; must start with a letter)`,
547
+ location: { file: sourcePath, line: 1, column: 1 },
548
+ });
549
+ continue;
550
+ }
551
+ if (mod_js_1.CORE_KINDS.has(name)) {
552
+ diagnostics.push({
553
+ code: "PROFILE-DISCIPLINE-003",
554
+ severity: "warning",
555
+ message: `profile.kinds: '${name}' redeclares a core kind (already shipped by markspec core); the declaration is idempotent and will be ignored`,
556
+ location: { file: sourcePath, line: 1, column: 1 },
557
+ });
558
+ continue;
559
+ }
560
+ let description;
561
+ if (value === null || value === undefined) {
562
+ // declaration only
563
+ }
564
+ else if (typeof value === "string") {
565
+ description = value;
566
+ }
567
+ else if (typeof value === "object" && !Array.isArray(value)) {
568
+ const r = value;
569
+ if (r.description !== undefined && typeof r.description !== "string") {
475
570
  diagnostics.push({
476
571
  code: "PROFILE-LOAD-003",
477
572
  severity: "error",
478
- message: "profile.labels: list form requires all-string entries",
573
+ message: `profile.kinds.${name}: 'description' must be a string`,
479
574
  location: { file: sourcePath, line: 1, column: 1 },
480
575
  });
481
- return [];
576
+ continue;
482
577
  }
483
- concerns.push({ name: item, kind: "flag", values: [] });
578
+ description = typeof r.description === "string"
579
+ ? r.description
580
+ : undefined;
581
+ }
582
+ else {
583
+ diagnostics.push({
584
+ code: "PROFILE-LOAD-003",
585
+ severity: "error",
586
+ message: `profile.kinds.${name}: value must be null, a string, or a mapping with 'description'`,
587
+ location: { file: sourcePath, line: 1, column: 1 },
588
+ });
589
+ continue;
484
590
  }
485
- return concerns;
591
+ out.set(name, description !== undefined ? { description } : {});
592
+ }
593
+ return out;
594
+ }
595
+ /** Closed enum of valid discipline-mode values (ADR-017 Slice 5). */
596
+ const DISCIPLINE_MODE_VALUES = new Set([
597
+ "flat",
598
+ "tiered",
599
+ "none",
600
+ ]);
601
+ /**
602
+ * Parse the `profile.discipline-mode:` field. Must be a scalar string in
603
+ * {flat, tiered, none}. Returns `undefined` when the field is absent.
604
+ *
605
+ * Validation:
606
+ * - PROFILE-DISCIPLINE-006 (error): value is a scalar string but not
607
+ * in the allowed enum.
608
+ * - PROFILE-DISCIPLINE-007 (error): value is not a scalar string
609
+ * (mapping, list, etc.).
610
+ */
611
+ function parseDisciplineMode(raw, sourcePath, diagnostics) {
612
+ if (raw === undefined || raw === null)
613
+ return undefined;
614
+ if (typeof raw !== "string") {
615
+ diagnostics.push({
616
+ code: "PROFILE-DISCIPLINE-007",
617
+ severity: "error",
618
+ message: `profile.discipline-mode: must be a scalar string (one of flat / tiered / none)`,
619
+ location: { file: sourcePath, line: 1, column: 1 },
620
+ });
621
+ return undefined;
622
+ }
623
+ if (!DISCIPLINE_MODE_VALUES.has(raw)) {
624
+ diagnostics.push({
625
+ code: "PROFILE-DISCIPLINE-006",
626
+ severity: "error",
627
+ message: `profile.discipline-mode: '${raw}' is not a valid mode (must be one of: flat, tiered, none)`,
628
+ location: { file: sourcePath, line: 1, column: 1 },
629
+ });
630
+ return undefined;
631
+ }
632
+ return raw;
633
+ }
634
+ const KNOWN_CONVENTIONS = new Set(["modal-keywords"]);
635
+ const MODAL_KEYWORDS_CASING_VALUES = new Set(["rfc2119", "iso", "preserve"]);
636
+ function parseLabelConcerns(raw, sourcePath, diagnostics) {
637
+ if (raw === undefined)
638
+ return [];
639
+ // Form A: sequence of label names → each becomes a flag concern. Entries
640
+ // may be bare strings or grouped objects ({group, values: [{name}, ...]});
641
+ // groups and descriptions are documentation-only and flattened away.
642
+ if (Array.isArray(raw)) {
643
+ const names = flattenGroupedNames(raw);
644
+ if (names === null) {
645
+ diagnostics.push({
646
+ code: "PROFILE-LOAD-003",
647
+ severity: "error",
648
+ message: "profile.labels: list entries must be strings, {name, description?}, " +
649
+ "or {group, values: [...]}",
650
+ location: { file: sourcePath, line: 1, column: 1 },
651
+ });
652
+ return [];
653
+ }
654
+ return names.map((name) => ({ name, kind: "flag", values: [] }));
486
655
  }
487
656
  // Form B: mapping — each key is a concern name.
488
657
  if (raw === null || typeof raw !== "object") {
@@ -653,6 +822,46 @@ function parseConventions(raw, sourcePath, diagnostics) {
653
822
  }
654
823
  return out;
655
824
  }
825
+ /**
826
+ * Parse the `profile.prose:` section. Returns a normalized object with
827
+ * the two lexicon lists; absent lists default to `[]`.
828
+ */
829
+ function parseProse(raw, sourcePath, diagnostics) {
830
+ const empty = {
831
+ lexicons: { "capitalized-allow": [], "sentence-abbrev": [] },
832
+ };
833
+ if (raw === undefined || raw === null)
834
+ return empty;
835
+ if (typeof raw !== "object" || Array.isArray(raw)) {
836
+ diagnostics.push({
837
+ code: "PROFILE-LOAD-003",
838
+ severity: "error",
839
+ message: "'profile.prose' must be a mapping",
840
+ location: { file: sourcePath, line: 1, column: 1 },
841
+ });
842
+ return empty;
843
+ }
844
+ const r = raw;
845
+ const lexRaw = r.lexicons;
846
+ if (lexRaw === undefined || lexRaw === null) {
847
+ return empty;
848
+ }
849
+ if (typeof lexRaw !== "object" || Array.isArray(lexRaw)) {
850
+ diagnostics.push({
851
+ code: "PROFILE-LOAD-003",
852
+ severity: "error",
853
+ message: "'profile.prose.lexicons' must be a mapping",
854
+ location: { file: sourcePath, line: 1, column: 1 },
855
+ });
856
+ return empty;
857
+ }
858
+ const lex = lexRaw;
859
+ const capAllow = parseStringList(lex["capitalized-allow"], "profile.prose.lexicons.capitalized-allow", sourcePath, diagnostics);
860
+ const sentAbbrev = parseStringList(lex["sentence-abbrev"], "profile.prose.lexicons.sentence-abbrev", sourcePath, diagnostics);
861
+ return {
862
+ lexicons: { "capitalized-allow": capAllow, "sentence-abbrev": sentAbbrev },
863
+ };
864
+ }
656
865
  function parseTypeDef(name, raw, sourcePath, diagnostics) {
657
866
  const ctx = `profile.types.${name}`;
658
867
  if (raw == null || typeof raw !== "object" || Array.isArray(raw)) {
@@ -735,6 +944,20 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
735
944
  }
736
945
  color = r.color;
737
946
  }
947
+ // PROFILE-DISCIPLINE-005 (error): value is not a non-empty string.
948
+ let discipline;
949
+ if (r.discipline !== undefined) {
950
+ if (typeof r.discipline !== "string" || r.discipline.length === 0) {
951
+ diagnostics.push({
952
+ code: "PROFILE-DISCIPLINE-005",
953
+ severity: "error",
954
+ message: `${ctx}: 'discipline' must be a non-empty string`,
955
+ location: { file: sourcePath, line: 1, column: 1 },
956
+ });
957
+ return undefined;
958
+ }
959
+ discipline = r.discipline;
960
+ }
738
961
  const description = typeof r.description === "string"
739
962
  ? r.description
740
963
  : undefined;
@@ -751,6 +974,7 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
751
974
  traceability,
752
975
  color,
753
976
  description,
977
+ discipline,
754
978
  };
755
979
  }
756
980
  function parseTypesMap(raw, sourcePath, diagnostics) {
@@ -952,6 +1176,8 @@ function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
952
1176
  const universalAttributes = parseAttrList(profileSection.attributes, "profile.attributes", sourcePath, diagnostics);
953
1177
  const labels = parseLabelConcerns(profileSection.labels, sourcePath, diagnostics);
954
1178
  const colors = parseColorsMap(profileSection.colors, sourcePath, diagnostics);
1179
+ const kinds = parseKindsMap(profileSection.kinds, sourcePath, diagnostics);
1180
+ const disciplineMode = parseDisciplineMode(profileSection["discipline-mode"], sourcePath, diagnostics);
955
1181
  const conventions = parseConventions(profileSection.conventions, sourcePath, diagnostics);
956
1182
  if (diagnostics.some((d) => d.severity === "error")) {
957
1183
  return { manifest: null, diagnostics };
@@ -964,6 +1190,10 @@ function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
964
1190
  if (diagnostics.some((d) => d.severity === "error")) {
965
1191
  return { manifest: null, diagnostics };
966
1192
  }
1193
+ const prose = parseProse(profileSection.prose, sourcePath, diagnostics);
1194
+ if (diagnostics.some((d) => d.severity === "error")) {
1195
+ return { manifest: null, diagnostics };
1196
+ }
967
1197
  // PROFILE-SCHEMA-002: emitted on the otherwise-complete manifest so it
968
1198
  // doesn't add noise to error-case output.
969
1199
  if (rawSchema === undefined) {
@@ -989,6 +1219,9 @@ function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
989
1219
  colors,
990
1220
  types: types,
991
1221
  documents: documents,
1222
+ kinds,
1223
+ prose,
1224
+ disciplineMode,
992
1225
  };
993
1226
  return { manifest, diagnostics };
994
1227
  }
@@ -1 +1 @@
1
- {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/profile/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAEV,UAAU,EAEV,gBAAgB,EAIhB,YAAY,EASb,MAAM,iBAAiB,CAAC;AAEzB,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CA8C3D"}
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/profile/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAEV,UAAU,EAGV,gBAAgB,EAKhB,YAAY,EASb,MAAM,iBAAiB,CAAC;AAGzB,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAiF3D"}
@@ -10,6 +10,8 @@
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.mergeChain = mergeChain;
13
+ const mod_js_1 = require("../model/mod.js");
14
+ const discipline_mode_js_1 = require("./discipline_mode.js");
13
15
  /**
14
16
  * Merge all tiers of a chain into one EffectiveProfile. Tiers are processed
15
17
  * in root → leaf order; later tiers can add to or tighten earlier tiers'
@@ -44,13 +46,39 @@ function mergeChain(chain) {
44
46
  // required is narrower than its shape-scope required, for example.
45
47
  // Start from root, fold each subsequent tier.
46
48
  let effective = seedFromTier(tiers[0]);
49
+ // ADR-017 Slice 5: LWW accumulator for declared discipline-mode across
50
+ // tiers. Initialized from the seed tier; updated on each subsequent tier
51
+ // that supplies a value. Resolved post-fold via resolveDisciplineMode().
52
+ let declaredMode;
53
+ const seedMode = tiers[0].manifest.disciplineMode;
54
+ if (seedMode !== undefined) {
55
+ declaredMode = {
56
+ value: seedMode,
57
+ origin: tiers[0].manifest.id,
58
+ };
59
+ }
47
60
  for (let i = 1; i < tiers.length; i++) {
48
61
  effective = foldTier(effective, tiers[i], diagnostics);
62
+ const tierMode = tiers[i].manifest.disciplineMode;
63
+ if (tierMode !== undefined) {
64
+ declaredMode = {
65
+ value: tierMode,
66
+ origin: tiers[i].manifest.id,
67
+ };
68
+ }
49
69
  }
50
70
  // Validate per-type color references against the FINAL merged colors map.
51
71
  // Running this only after all tiers fold avoids false positives when a parent
52
72
  // tier references a color that a child tier supplies in its colors: block.
53
73
  validateTypeColors(effective, diagnostics, tiers[tiers.length - 1].sourcePath);
74
+ validateTypeDisciplines(effective, diagnostics, tiers[tiers.length - 1].sourcePath);
75
+ // ADR-017 Slice 5: resolve disciplineMode AFTER the full chain has folded
76
+ // so inference sees the final type graph. The accumulator `declaredMode`
77
+ // (set above) carries the LWW-declared value across tiers.
78
+ effective = {
79
+ ...effective,
80
+ disciplineMode: (0, discipline_mode_js_1.resolveDisciplineMode)(effective, declaredMode),
81
+ };
54
82
  // If any merge error was recorded, drop the effective profile.
55
83
  const hasError = diagnostics.some((d) => d.severity === "error");
56
84
  return hasError
@@ -71,6 +99,8 @@ function foldTier(base, tier, diagnostics) {
71
99
  const attributes = unionAttrMap(base.attributes, m.universalAttributes, origin, diagnostics);
72
100
  // Colors map: last-write-wins per key, additive across tiers.
73
101
  const colors = unionColorsMap(base.colors, m.colors, origin);
102
+ // Kinds map: additive across tiers, child wins on description.
103
+ const kinds = unionKindsMap(base.kinds, m.kinds, origin);
74
104
  // Types — add new types, fold existing ones.
75
105
  const types = new Map(base.types);
76
106
  for (const [name, td] of m.types) {
@@ -92,6 +122,7 @@ function foldTier(base, tier, diagnostics) {
92
122
  description: { value: td.description, origin },
93
123
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
94
124
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
125
+ discipline: { value: td.discipline, origin },
95
126
  };
96
127
  types.set(name, { value: eff, origin });
97
128
  }
@@ -112,6 +143,9 @@ function foldTier(base, tier, diagnostics) {
112
143
  // Overlap handling deferred.
113
144
  }
114
145
  const frontMatter = unionAttrMap(base.documents.frontMatter, m.documents.frontMatter, origin, diagnostics);
146
+ // Prose lexicons: list-additive across tiers (profile-schema §5.1).
147
+ const capAllow = unionList(base.prose.lexicons["capitalized-allow"], m.prose.lexicons["capitalized-allow"], origin);
148
+ const sentAbbrev = unionList(base.prose.lexicons["sentence-abbrev"], m.prose.lexicons["sentence-abbrev"], origin);
115
149
  const result = {
116
150
  attributes,
117
151
  labels,
@@ -122,6 +156,14 @@ function foldTier(base, tier, diagnostics) {
122
156
  types: docTypes,
123
157
  frontMatter,
124
158
  },
159
+ kinds,
160
+ prose: {
161
+ lexicons: {
162
+ "capitalized-allow": capAllow,
163
+ "sentence-abbrev": sentAbbrev,
164
+ },
165
+ },
166
+ disciplineMode: { value: "none", origin: "inferred" },
125
167
  };
126
168
  return result;
127
169
  }
@@ -169,6 +211,30 @@ function validateTypeColors(effective, diagnostics, fallbackFile) {
169
211
  }
170
212
  }
171
213
  }
214
+ /**
215
+ * After the full chain folds, verify each type's `discipline.value` (when
216
+ * set) names a kind that is in the merged `effective.kinds` map ∪
217
+ * CORE_KINDS. Emits PROFILE-DISCIPLINE-004 for each violation. Runs after
218
+ * the merge because a parent tier's kind must be visible to a child
219
+ * tier's type.
220
+ */
221
+ function validateTypeDisciplines(effective, diagnostics, fallbackFile) {
222
+ for (const [typeName, entry] of effective.types) {
223
+ const value = entry.value.discipline.value;
224
+ if (value === undefined)
225
+ continue;
226
+ if (mod_js_1.CORE_KINDS.has(value))
227
+ continue;
228
+ if (effective.kinds.has(value))
229
+ continue;
230
+ diagnostics.push({
231
+ code: "PROFILE-DISCIPLINE-004",
232
+ severity: "error",
233
+ message: `type '${typeName}' references unknown discipline kind '${value}' (declare it under profile.kinds: in this profile or a parent)`,
234
+ location: { file: fallbackFile, line: 1, column: 1 },
235
+ });
236
+ }
237
+ }
172
238
  /**
173
239
  * Union of two string lists; parent entries first, child entries appended,
174
240
  * duplicates dropped. Origin = child tier if anything was added, else parent.
@@ -323,6 +389,10 @@ function tightenType(existing, child, childOrigin, diagnostics) {
323
389
  const description = child.description !== undefined
324
390
  ? { value: child.description, origin: childOrigin }
325
391
  : effExisting.description;
392
+ // Discipline: child wins when set; otherwise parent stays.
393
+ const discipline = child.discipline !== undefined
394
+ ? { value: child.discipline, origin: childOrigin }
395
+ : effExisting.discipline;
326
396
  const attrDescriptions = mergeDescriptionMap(effExisting.attrDescriptions, child.attributes.map((a) => ({ name: a.name, desc: a.description })), childOrigin);
327
397
  const relationDescriptions = mergeDescriptionMap(effExisting.relationDescriptions, [...child.traceability.entries()].map(([name, r]) => ({
328
398
  name,
@@ -340,6 +410,7 @@ function tightenType(existing, child, childOrigin, diagnostics) {
340
410
  description,
341
411
  attrDescriptions,
342
412
  relationDescriptions,
413
+ discipline,
343
414
  };
344
415
  const overrides = [
345
416
  ...(existing.overrides ?? []),
@@ -461,6 +532,20 @@ function seedFromTier(tier) {
461
532
  types: mapFromDocTypes(m.documents.types, origin),
462
533
  frontMatter: mapFromAttrList(m.documents.frontMatter, origin),
463
534
  },
535
+ kinds: mapFromKinds(m.kinds, origin),
536
+ prose: {
537
+ lexicons: {
538
+ "capitalized-allow": {
539
+ value: m.prose.lexicons["capitalized-allow"],
540
+ origin,
541
+ },
542
+ "sentence-abbrev": {
543
+ value: m.prose.lexicons["sentence-abbrev"],
544
+ origin,
545
+ },
546
+ },
547
+ },
548
+ disciplineMode: { value: "none", origin: "inferred" },
464
549
  };
465
550
  }
466
551
  function mapFromColors(colors, origin) {
@@ -470,6 +555,32 @@ function mapFromColors(colors, origin) {
470
555
  }
471
556
  return out;
472
557
  }
558
+ /**
559
+ * Union of `kinds:` maps across tiers. Additive: every tier's kinds are
560
+ * carried. When two tiers declare the same kind, the child wins on
561
+ * description and `overrides` records the displaced parent.
562
+ */
563
+ function unionKindsMap(parent, childKinds, childOrigin) {
564
+ if (childKinds.size === 0)
565
+ return parent;
566
+ const out = new Map(parent);
567
+ for (const [name, kd] of childKinds) {
568
+ const prior = out.get(name);
569
+ out.set(name, {
570
+ value: kd,
571
+ origin: childOrigin,
572
+ overrides: prior ? [...(prior.overrides ?? []), prior.origin] : undefined,
573
+ });
574
+ }
575
+ return out;
576
+ }
577
+ function mapFromKinds(kinds, origin) {
578
+ const out = new Map();
579
+ for (const [name, kd] of kinds) {
580
+ out.set(name, { value: kd, origin });
581
+ }
582
+ return out;
583
+ }
473
584
  function mapFromLabelConcerns(concerns, origin) {
474
585
  const out = new Map();
475
586
  for (const c of concerns) {
@@ -607,6 +718,7 @@ function mapFromTypes(types, origin) {
607
718
  description: { value: td.description, origin },
608
719
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
609
720
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
721
+ discipline: { value: td.discipline, origin },
610
722
  };
611
723
  out.set(name, { value: eff, origin });
612
724
  }
@@ -17,6 +17,8 @@ export type { LoadProfileForCommandResult } from "./load.js";
17
17
  export { mergeChain } from "./merge.js";
18
18
  export type { MergeResult } from "./merge.js";
19
19
  export { resolveEntryColor } from "./colors.js";
20
+ export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
21
+ export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
20
22
  export { buildProfileIntrospection } from "./introspect.js";
21
23
  export type { AttributeDetail, ConventionDetail, LabelConcernDetail, ProfileElementDetail, ProfileElementKind, ProfileElementRef, ProfileIntrospection, ProfileOverview, ProvenancedDescription, RelationDetail, TypeDetail, } from "./introspect.js";
22
24
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * resolution, and merging. Consumed by the validator pipeline and the CLI.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.buildProfileIntrospection = exports.resolveEntryColor = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = void 0;
9
+ exports.buildProfileIntrospection = exports.resolveDisciplineMode = exports.inferDisciplineMode = exports.buildEffectiveDisciplineRegistry = exports.resolveEntryColor = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = void 0;
10
10
  var manifest_js_1 = require("./manifest.js");
11
11
  Object.defineProperty(exports, "parseManifest", { enumerable: true, get: function () { return manifest_js_1.parseManifest; } });
12
12
  var resolver_js_1 = require("./resolver.js");
@@ -30,5 +30,10 @@ Object.defineProperty(exports, "mergeChain", { enumerable: true, get: function (
30
30
  // core/mod.ts. Consumers use loadChain / loadProfileForCommand instead.
31
31
  var colors_js_1 = require("./colors.js");
32
32
  Object.defineProperty(exports, "resolveEntryColor", { enumerable: true, get: function () { return colors_js_1.resolveEntryColor; } });
33
+ var discipline_registry_js_1 = require("./discipline_registry.js");
34
+ Object.defineProperty(exports, "buildEffectiveDisciplineRegistry", { enumerable: true, get: function () { return discipline_registry_js_1.buildEffectiveDisciplineRegistry; } });
35
+ var discipline_mode_js_1 = require("./discipline_mode.js");
36
+ Object.defineProperty(exports, "inferDisciplineMode", { enumerable: true, get: function () { return discipline_mode_js_1.inferDisciplineMode; } });
37
+ Object.defineProperty(exports, "resolveDisciplineMode", { enumerable: true, get: function () { return discipline_mode_js_1.resolveDisciplineMode; } });
33
38
  var introspect_js_1 = require("./introspect.js");
34
39
  Object.defineProperty(exports, "buildProfileIntrospection", { enumerable: true, get: function () { return introspect_js_1.buildProfileIntrospection; } });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module core/sync/locked_attributes
3
+ *
4
+ * Infers which MarkSpec attributes are upstream-owned (locally read-only)
5
+ * for a single mapping. Reads only per-attribute direction + locked
6
+ * fields — the top-level system direction has already been baked into
7
+ * every per-attribute direction at parse time (see `parseMapping`), so
8
+ * this function does not need to consult it.
9
+ *
10
+ * Locking rule:
11
+ * - Per-attribute direction `outbound` → never locked
12
+ * - Per-attribute `locked: true` → locked
13
+ * - Per-attribute direction `inbound` → locked
14
+ * - Per-attribute direction `bidirectional` without `locked: true` → not locked
15
+ */
16
+ import type { Mapping } from "./mapping.js";
17
+ /** The set of MarkSpec attribute names locked for this mapping. */
18
+ export declare function inferLockedAttributes(mapping: Mapping): Set<string>;
19
+ //# sourceMappingURL=locked_attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locked_attributes.d.ts","sourceRoot":"","sources":["../../src/sync/locked_attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CASnE"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/sync/locked_attributes
4
+ *
5
+ * Infers which MarkSpec attributes are upstream-owned (locally read-only)
6
+ * for a single mapping. Reads only per-attribute direction + locked
7
+ * fields — the top-level system direction has already been baked into
8
+ * every per-attribute direction at parse time (see `parseMapping`), so
9
+ * this function does not need to consult it.
10
+ *
11
+ * Locking rule:
12
+ * - Per-attribute direction `outbound` → never locked
13
+ * - Per-attribute `locked: true` → locked
14
+ * - Per-attribute direction `inbound` → locked
15
+ * - Per-attribute direction `bidirectional` without `locked: true` → not locked
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.inferLockedAttributes = inferLockedAttributes;
19
+ /** The set of MarkSpec attribute names locked for this mapping. */
20
+ function inferLockedAttributes(mapping) {
21
+ const locked = new Set();
22
+ for (const a of mapping.attributes) {
23
+ if (a.direction === "outbound")
24
+ continue;
25
+ if (a.locked || a.direction === "inbound") {
26
+ locked.add(a.markspec);
27
+ }
28
+ }
29
+ return locked;
30
+ }