@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
@@ -6,7 +6,7 @@
6
6
  * schema violations.
7
7
  */
8
8
  import { parse as parseYaml } from "@std/yaml";
9
- import { COLOR_NAME_RE, CORE_TYPES, LIST_VALUE_TYPES, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
9
+ import { COLOR_NAME_RE, CORE_KINDS, CORE_TYPES, LIST_VALUE_TYPES, MIXED_DISCIPLINE, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
10
10
  const VALUE_TYPE_SET = new Set(VALUE_TYPES);
11
11
  const ALLOWED_ROOT_KEYS = new Set([
12
12
  "id",
@@ -24,6 +24,9 @@ const ALLOWED_PROFILE_KEYS = new Set([
24
24
  "conventions",
25
25
  "types",
26
26
  "documents",
27
+ "kinds",
28
+ "prose",
29
+ "discipline-mode",
27
30
  ]);
28
31
  const ALLOWED_TYPE_KEYS = new Set([
29
32
  "extends",
@@ -34,6 +37,7 @@ const ALLOWED_TYPE_KEYS = new Set([
34
37
  "attributes",
35
38
  "traceability",
36
39
  "color",
40
+ "discipline",
37
41
  ]);
38
42
  const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
39
43
  const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
@@ -171,6 +175,42 @@ function parseCardinality(raw, fallback, context, sourcePath, diagnostics) {
171
175
  }
172
176
  return { lower, upper };
173
177
  }
178
+ /**
179
+ * Flatten a (possibly grouped) value list to its leaf value names. Accepts
180
+ * items that are bare strings, `{name, description?}` objects, or
181
+ * `{group, description?, values: [...]}` group objects (recursed). Group
182
+ * labels and descriptions are documentation-only and dropped — markspec
183
+ * validates against the value names. Returns `null` when any item matches
184
+ * none of these shapes.
185
+ */
186
+ function flattenGroupedNames(raw) {
187
+ if (!Array.isArray(raw))
188
+ return null;
189
+ const out = [];
190
+ for (const item of raw) {
191
+ if (typeof item === "string") {
192
+ out.push(item);
193
+ continue;
194
+ }
195
+ if (item == null || typeof item !== "object" || Array.isArray(item)) {
196
+ return null;
197
+ }
198
+ const o = item;
199
+ if (typeof o.name === "string") {
200
+ out.push(o.name);
201
+ }
202
+ else if (Array.isArray(o.values)) {
203
+ const nested = flattenGroupedNames(o.values);
204
+ if (nested === null)
205
+ return null;
206
+ out.push(...nested);
207
+ }
208
+ else {
209
+ return null;
210
+ }
211
+ }
212
+ return out;
213
+ }
174
214
  function parseAttrDecl(raw, context, sourcePath, diagnostics) {
175
215
  if (raw == null || typeof raw !== "object" || Array.isArray(raw)) {
176
216
  diagnostics.push({
@@ -218,19 +258,18 @@ function parseAttrDecl(raw, context, sourcePath, diagnostics) {
218
258
  const cardinality = parseCardinality(r.cardinality, defaultCardinality(vtype), `${context}/${name}`, sourcePath, diagnostics);
219
259
  let values;
220
260
  if (vtype === "enum") {
221
- const rawValues = r.values;
222
- if (!Array.isArray(rawValues) ||
223
- rawValues.some((v) => typeof v !== "string") ||
224
- rawValues.length === 0) {
261
+ const flat = flattenGroupedNames(r.values);
262
+ if (flat === null || flat.length === 0) {
225
263
  diagnostics.push({
226
264
  code: "PROFILE-LOAD-003",
227
265
  severity: "error",
228
- message: `${context}: enum attribute '${name}' requires a non-empty 'values' list of strings`,
266
+ message: `${context}: enum attribute '${name}' requires a non-empty 'values' list ` +
267
+ `(strings, {name, description?}, or {group, values: [...]})`,
229
268
  location: { file: sourcePath, line: 1, column: 1 },
230
269
  });
231
270
  return undefined;
232
271
  }
233
- values = rawValues;
272
+ values = flat;
234
273
  }
235
274
  let inverse;
236
275
  if (r.inverse !== undefined) {
@@ -459,27 +498,157 @@ function parseColorsMap(raw, sourcePath, diagnostics) {
459
498
  }
460
499
  return out;
461
500
  }
462
- const KNOWN_CONVENTIONS = new Set(["modal-keywords"]);
463
- const MODAL_KEYWORDS_CASING_VALUES = new Set(["rfc2119", "iso", "preserve"]);
464
- function parseLabelConcerns(raw, sourcePath, diagnostics) {
501
+ /**
502
+ * Parse the `profile.kinds:` block. Each key must match COLOR_NAME_RE
503
+ * (the same lexical rule used for color names — lowercase letters,
504
+ * digits, hyphens, starting with a letter). Values may be:
505
+ * - `null` / `undefined` — declare the kind with no description.
506
+ * - a bare string — treated as the description shorthand.
507
+ * - a mapping with optional `description:`.
508
+ *
509
+ * Validation:
510
+ * - PROFILE-DISCIPLINE-001 (error): name fails the regex.
511
+ * - PROFILE-DISCIPLINE-002 (error): name is the reserved sentinel
512
+ * `MIXED_DISCIPLINE` ("mixed").
513
+ * - PROFILE-DISCIPLINE-003 (warning): name shadows a core kind
514
+ * (`system`/`software`/`hardware`).
515
+ */
516
+ function parseKindsMap(raw, sourcePath, diagnostics) {
517
+ const out = new Map();
465
518
  if (raw === undefined)
466
- return [];
467
- // Form A: flat sequence of strings → each becomes a flag concern.
468
- if (Array.isArray(raw)) {
469
- const concerns = [];
470
- for (const item of raw) {
471
- if (typeof item !== "string") {
519
+ return out;
520
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
521
+ diagnostics.push({
522
+ code: "PROFILE-LOAD-003",
523
+ severity: "error",
524
+ message: "profile.kinds: must be a mapping",
525
+ location: { file: sourcePath, line: 1, column: 1 },
526
+ });
527
+ return out;
528
+ }
529
+ for (const [name, value] of Object.entries(raw)) {
530
+ if (name === MIXED_DISCIPLINE) {
531
+ diagnostics.push({
532
+ code: "PROFILE-DISCIPLINE-002",
533
+ severity: "error",
534
+ message: `profile.kinds: '${name}' is a reserved sentinel name; choose a different kind name`,
535
+ location: { file: sourcePath, line: 1, column: 1 },
536
+ });
537
+ continue;
538
+ }
539
+ if (!COLOR_NAME_RE.test(name)) {
540
+ diagnostics.push({
541
+ code: "PROFILE-DISCIPLINE-001",
542
+ severity: "error",
543
+ message: `profile.kinds: '${name}' is not a valid kind name (lowercase letters, digits, hyphens; must start with a letter)`,
544
+ location: { file: sourcePath, line: 1, column: 1 },
545
+ });
546
+ continue;
547
+ }
548
+ if (CORE_KINDS.has(name)) {
549
+ diagnostics.push({
550
+ code: "PROFILE-DISCIPLINE-003",
551
+ severity: "warning",
552
+ message: `profile.kinds: '${name}' redeclares a core kind (already shipped by markspec core); the declaration is idempotent and will be ignored`,
553
+ location: { file: sourcePath, line: 1, column: 1 },
554
+ });
555
+ continue;
556
+ }
557
+ let description;
558
+ if (value === null || value === undefined) {
559
+ // declaration only
560
+ }
561
+ else if (typeof value === "string") {
562
+ description = value;
563
+ }
564
+ else if (typeof value === "object" && !Array.isArray(value)) {
565
+ const r = value;
566
+ if (r.description !== undefined && typeof r.description !== "string") {
472
567
  diagnostics.push({
473
568
  code: "PROFILE-LOAD-003",
474
569
  severity: "error",
475
- message: "profile.labels: list form requires all-string entries",
570
+ message: `profile.kinds.${name}: 'description' must be a string`,
476
571
  location: { file: sourcePath, line: 1, column: 1 },
477
572
  });
478
- return [];
573
+ continue;
479
574
  }
480
- concerns.push({ name: item, kind: "flag", values: [] });
575
+ description = typeof r.description === "string"
576
+ ? r.description
577
+ : undefined;
578
+ }
579
+ else {
580
+ diagnostics.push({
581
+ code: "PROFILE-LOAD-003",
582
+ severity: "error",
583
+ message: `profile.kinds.${name}: value must be null, a string, or a mapping with 'description'`,
584
+ location: { file: sourcePath, line: 1, column: 1 },
585
+ });
586
+ continue;
481
587
  }
482
- return concerns;
588
+ out.set(name, description !== undefined ? { description } : {});
589
+ }
590
+ return out;
591
+ }
592
+ /** Closed enum of valid discipline-mode values (ADR-017 Slice 5). */
593
+ const DISCIPLINE_MODE_VALUES = new Set([
594
+ "flat",
595
+ "tiered",
596
+ "none",
597
+ ]);
598
+ /**
599
+ * Parse the `profile.discipline-mode:` field. Must be a scalar string in
600
+ * {flat, tiered, none}. Returns `undefined` when the field is absent.
601
+ *
602
+ * Validation:
603
+ * - PROFILE-DISCIPLINE-006 (error): value is a scalar string but not
604
+ * in the allowed enum.
605
+ * - PROFILE-DISCIPLINE-007 (error): value is not a scalar string
606
+ * (mapping, list, etc.).
607
+ */
608
+ function parseDisciplineMode(raw, sourcePath, diagnostics) {
609
+ if (raw === undefined || raw === null)
610
+ return undefined;
611
+ if (typeof raw !== "string") {
612
+ diagnostics.push({
613
+ code: "PROFILE-DISCIPLINE-007",
614
+ severity: "error",
615
+ message: `profile.discipline-mode: must be a scalar string (one of flat / tiered / none)`,
616
+ location: { file: sourcePath, line: 1, column: 1 },
617
+ });
618
+ return undefined;
619
+ }
620
+ if (!DISCIPLINE_MODE_VALUES.has(raw)) {
621
+ diagnostics.push({
622
+ code: "PROFILE-DISCIPLINE-006",
623
+ severity: "error",
624
+ message: `profile.discipline-mode: '${raw}' is not a valid mode (must be one of: flat, tiered, none)`,
625
+ location: { file: sourcePath, line: 1, column: 1 },
626
+ });
627
+ return undefined;
628
+ }
629
+ return raw;
630
+ }
631
+ const KNOWN_CONVENTIONS = new Set(["modal-keywords"]);
632
+ const MODAL_KEYWORDS_CASING_VALUES = new Set(["rfc2119", "iso", "preserve"]);
633
+ function parseLabelConcerns(raw, sourcePath, diagnostics) {
634
+ if (raw === undefined)
635
+ return [];
636
+ // Form A: sequence of label names → each becomes a flag concern. Entries
637
+ // may be bare strings or grouped objects ({group, values: [{name}, ...]});
638
+ // groups and descriptions are documentation-only and flattened away.
639
+ if (Array.isArray(raw)) {
640
+ const names = flattenGroupedNames(raw);
641
+ if (names === null) {
642
+ diagnostics.push({
643
+ code: "PROFILE-LOAD-003",
644
+ severity: "error",
645
+ message: "profile.labels: list entries must be strings, {name, description?}, " +
646
+ "or {group, values: [...]}",
647
+ location: { file: sourcePath, line: 1, column: 1 },
648
+ });
649
+ return [];
650
+ }
651
+ return names.map((name) => ({ name, kind: "flag", values: [] }));
483
652
  }
484
653
  // Form B: mapping — each key is a concern name.
485
654
  if (raw === null || typeof raw !== "object") {
@@ -650,6 +819,46 @@ function parseConventions(raw, sourcePath, diagnostics) {
650
819
  }
651
820
  return out;
652
821
  }
822
+ /**
823
+ * Parse the `profile.prose:` section. Returns a normalized object with
824
+ * the two lexicon lists; absent lists default to `[]`.
825
+ */
826
+ function parseProse(raw, sourcePath, diagnostics) {
827
+ const empty = {
828
+ lexicons: { "capitalized-allow": [], "sentence-abbrev": [] },
829
+ };
830
+ if (raw === undefined || raw === null)
831
+ return empty;
832
+ if (typeof raw !== "object" || Array.isArray(raw)) {
833
+ diagnostics.push({
834
+ code: "PROFILE-LOAD-003",
835
+ severity: "error",
836
+ message: "'profile.prose' must be a mapping",
837
+ location: { file: sourcePath, line: 1, column: 1 },
838
+ });
839
+ return empty;
840
+ }
841
+ const r = raw;
842
+ const lexRaw = r.lexicons;
843
+ if (lexRaw === undefined || lexRaw === null) {
844
+ return empty;
845
+ }
846
+ if (typeof lexRaw !== "object" || Array.isArray(lexRaw)) {
847
+ diagnostics.push({
848
+ code: "PROFILE-LOAD-003",
849
+ severity: "error",
850
+ message: "'profile.prose.lexicons' must be a mapping",
851
+ location: { file: sourcePath, line: 1, column: 1 },
852
+ });
853
+ return empty;
854
+ }
855
+ const lex = lexRaw;
856
+ const capAllow = parseStringList(lex["capitalized-allow"], "profile.prose.lexicons.capitalized-allow", sourcePath, diagnostics);
857
+ const sentAbbrev = parseStringList(lex["sentence-abbrev"], "profile.prose.lexicons.sentence-abbrev", sourcePath, diagnostics);
858
+ return {
859
+ lexicons: { "capitalized-allow": capAllow, "sentence-abbrev": sentAbbrev },
860
+ };
861
+ }
653
862
  function parseTypeDef(name, raw, sourcePath, diagnostics) {
654
863
  const ctx = `profile.types.${name}`;
655
864
  if (raw == null || typeof raw !== "object" || Array.isArray(raw)) {
@@ -732,6 +941,20 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
732
941
  }
733
942
  color = r.color;
734
943
  }
944
+ // PROFILE-DISCIPLINE-005 (error): value is not a non-empty string.
945
+ let discipline;
946
+ if (r.discipline !== undefined) {
947
+ if (typeof r.discipline !== "string" || r.discipline.length === 0) {
948
+ diagnostics.push({
949
+ code: "PROFILE-DISCIPLINE-005",
950
+ severity: "error",
951
+ message: `${ctx}: 'discipline' must be a non-empty string`,
952
+ location: { file: sourcePath, line: 1, column: 1 },
953
+ });
954
+ return undefined;
955
+ }
956
+ discipline = r.discipline;
957
+ }
735
958
  const description = typeof r.description === "string"
736
959
  ? r.description
737
960
  : undefined;
@@ -748,6 +971,7 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
748
971
  traceability,
749
972
  color,
750
973
  description,
974
+ discipline,
751
975
  };
752
976
  }
753
977
  function parseTypesMap(raw, sourcePath, diagnostics) {
@@ -949,6 +1173,8 @@ export function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
949
1173
  const universalAttributes = parseAttrList(profileSection.attributes, "profile.attributes", sourcePath, diagnostics);
950
1174
  const labels = parseLabelConcerns(profileSection.labels, sourcePath, diagnostics);
951
1175
  const colors = parseColorsMap(profileSection.colors, sourcePath, diagnostics);
1176
+ const kinds = parseKindsMap(profileSection.kinds, sourcePath, diagnostics);
1177
+ const disciplineMode = parseDisciplineMode(profileSection["discipline-mode"], sourcePath, diagnostics);
952
1178
  const conventions = parseConventions(profileSection.conventions, sourcePath, diagnostics);
953
1179
  if (diagnostics.some((d) => d.severity === "error")) {
954
1180
  return { manifest: null, diagnostics };
@@ -961,6 +1187,10 @@ export function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
961
1187
  if (diagnostics.some((d) => d.severity === "error")) {
962
1188
  return { manifest: null, diagnostics };
963
1189
  }
1190
+ const prose = parseProse(profileSection.prose, sourcePath, diagnostics);
1191
+ if (diagnostics.some((d) => d.severity === "error")) {
1192
+ return { manifest: null, diagnostics };
1193
+ }
964
1194
  // PROFILE-SCHEMA-002: emitted on the otherwise-complete manifest so it
965
1195
  // doesn't add noise to error-case output.
966
1196
  if (rawSchema === undefined) {
@@ -986,6 +1216,9 @@ export function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
986
1216
  colors,
987
1217
  types: types,
988
1218
  documents: documents,
1219
+ kinds,
1220
+ prose,
1221
+ disciplineMode,
989
1222
  };
990
1223
  return { manifest, diagnostics };
991
1224
  }
@@ -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"}
@@ -7,6 +7,8 @@
7
7
  *
8
8
  * Merge happens once at load. Callers should not call `mergeChain` lazily.
9
9
  */
10
+ import { CORE_KINDS } from "../model/mod.js";
11
+ import { resolveDisciplineMode } from "./discipline_mode.js";
10
12
  /**
11
13
  * Merge all tiers of a chain into one EffectiveProfile. Tiers are processed
12
14
  * in root → leaf order; later tiers can add to or tighten earlier tiers'
@@ -41,13 +43,39 @@ export function mergeChain(chain) {
41
43
  // required is narrower than its shape-scope required, for example.
42
44
  // Start from root, fold each subsequent tier.
43
45
  let effective = seedFromTier(tiers[0]);
46
+ // ADR-017 Slice 5: LWW accumulator for declared discipline-mode across
47
+ // tiers. Initialized from the seed tier; updated on each subsequent tier
48
+ // that supplies a value. Resolved post-fold via resolveDisciplineMode().
49
+ let declaredMode;
50
+ const seedMode = tiers[0].manifest.disciplineMode;
51
+ if (seedMode !== undefined) {
52
+ declaredMode = {
53
+ value: seedMode,
54
+ origin: tiers[0].manifest.id,
55
+ };
56
+ }
44
57
  for (let i = 1; i < tiers.length; i++) {
45
58
  effective = foldTier(effective, tiers[i], diagnostics);
59
+ const tierMode = tiers[i].manifest.disciplineMode;
60
+ if (tierMode !== undefined) {
61
+ declaredMode = {
62
+ value: tierMode,
63
+ origin: tiers[i].manifest.id,
64
+ };
65
+ }
46
66
  }
47
67
  // Validate per-type color references against the FINAL merged colors map.
48
68
  // Running this only after all tiers fold avoids false positives when a parent
49
69
  // tier references a color that a child tier supplies in its colors: block.
50
70
  validateTypeColors(effective, diagnostics, tiers[tiers.length - 1].sourcePath);
71
+ validateTypeDisciplines(effective, diagnostics, tiers[tiers.length - 1].sourcePath);
72
+ // ADR-017 Slice 5: resolve disciplineMode AFTER the full chain has folded
73
+ // so inference sees the final type graph. The accumulator `declaredMode`
74
+ // (set above) carries the LWW-declared value across tiers.
75
+ effective = {
76
+ ...effective,
77
+ disciplineMode: resolveDisciplineMode(effective, declaredMode),
78
+ };
51
79
  // If any merge error was recorded, drop the effective profile.
52
80
  const hasError = diagnostics.some((d) => d.severity === "error");
53
81
  return hasError
@@ -68,6 +96,8 @@ function foldTier(base, tier, diagnostics) {
68
96
  const attributes = unionAttrMap(base.attributes, m.universalAttributes, origin, diagnostics);
69
97
  // Colors map: last-write-wins per key, additive across tiers.
70
98
  const colors = unionColorsMap(base.colors, m.colors, origin);
99
+ // Kinds map: additive across tiers, child wins on description.
100
+ const kinds = unionKindsMap(base.kinds, m.kinds, origin);
71
101
  // Types — add new types, fold existing ones.
72
102
  const types = new Map(base.types);
73
103
  for (const [name, td] of m.types) {
@@ -89,6 +119,7 @@ function foldTier(base, tier, diagnostics) {
89
119
  description: { value: td.description, origin },
90
120
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
91
121
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
122
+ discipline: { value: td.discipline, origin },
92
123
  };
93
124
  types.set(name, { value: eff, origin });
94
125
  }
@@ -109,6 +140,9 @@ function foldTier(base, tier, diagnostics) {
109
140
  // Overlap handling deferred.
110
141
  }
111
142
  const frontMatter = unionAttrMap(base.documents.frontMatter, m.documents.frontMatter, origin, diagnostics);
143
+ // Prose lexicons: list-additive across tiers (profile-schema §5.1).
144
+ const capAllow = unionList(base.prose.lexicons["capitalized-allow"], m.prose.lexicons["capitalized-allow"], origin);
145
+ const sentAbbrev = unionList(base.prose.lexicons["sentence-abbrev"], m.prose.lexicons["sentence-abbrev"], origin);
112
146
  const result = {
113
147
  attributes,
114
148
  labels,
@@ -119,6 +153,14 @@ function foldTier(base, tier, diagnostics) {
119
153
  types: docTypes,
120
154
  frontMatter,
121
155
  },
156
+ kinds,
157
+ prose: {
158
+ lexicons: {
159
+ "capitalized-allow": capAllow,
160
+ "sentence-abbrev": sentAbbrev,
161
+ },
162
+ },
163
+ disciplineMode: { value: "none", origin: "inferred" },
122
164
  };
123
165
  return result;
124
166
  }
@@ -166,6 +208,30 @@ function validateTypeColors(effective, diagnostics, fallbackFile) {
166
208
  }
167
209
  }
168
210
  }
211
+ /**
212
+ * After the full chain folds, verify each type's `discipline.value` (when
213
+ * set) names a kind that is in the merged `effective.kinds` map ∪
214
+ * CORE_KINDS. Emits PROFILE-DISCIPLINE-004 for each violation. Runs after
215
+ * the merge because a parent tier's kind must be visible to a child
216
+ * tier's type.
217
+ */
218
+ function validateTypeDisciplines(effective, diagnostics, fallbackFile) {
219
+ for (const [typeName, entry] of effective.types) {
220
+ const value = entry.value.discipline.value;
221
+ if (value === undefined)
222
+ continue;
223
+ if (CORE_KINDS.has(value))
224
+ continue;
225
+ if (effective.kinds.has(value))
226
+ continue;
227
+ diagnostics.push({
228
+ code: "PROFILE-DISCIPLINE-004",
229
+ severity: "error",
230
+ message: `type '${typeName}' references unknown discipline kind '${value}' (declare it under profile.kinds: in this profile or a parent)`,
231
+ location: { file: fallbackFile, line: 1, column: 1 },
232
+ });
233
+ }
234
+ }
169
235
  /**
170
236
  * Union of two string lists; parent entries first, child entries appended,
171
237
  * duplicates dropped. Origin = child tier if anything was added, else parent.
@@ -320,6 +386,10 @@ function tightenType(existing, child, childOrigin, diagnostics) {
320
386
  const description = child.description !== undefined
321
387
  ? { value: child.description, origin: childOrigin }
322
388
  : effExisting.description;
389
+ // Discipline: child wins when set; otherwise parent stays.
390
+ const discipline = child.discipline !== undefined
391
+ ? { value: child.discipline, origin: childOrigin }
392
+ : effExisting.discipline;
323
393
  const attrDescriptions = mergeDescriptionMap(effExisting.attrDescriptions, child.attributes.map((a) => ({ name: a.name, desc: a.description })), childOrigin);
324
394
  const relationDescriptions = mergeDescriptionMap(effExisting.relationDescriptions, [...child.traceability.entries()].map(([name, r]) => ({
325
395
  name,
@@ -337,6 +407,7 @@ function tightenType(existing, child, childOrigin, diagnostics) {
337
407
  description,
338
408
  attrDescriptions,
339
409
  relationDescriptions,
410
+ discipline,
340
411
  };
341
412
  const overrides = [
342
413
  ...(existing.overrides ?? []),
@@ -458,6 +529,20 @@ function seedFromTier(tier) {
458
529
  types: mapFromDocTypes(m.documents.types, origin),
459
530
  frontMatter: mapFromAttrList(m.documents.frontMatter, origin),
460
531
  },
532
+ kinds: mapFromKinds(m.kinds, origin),
533
+ prose: {
534
+ lexicons: {
535
+ "capitalized-allow": {
536
+ value: m.prose.lexicons["capitalized-allow"],
537
+ origin,
538
+ },
539
+ "sentence-abbrev": {
540
+ value: m.prose.lexicons["sentence-abbrev"],
541
+ origin,
542
+ },
543
+ },
544
+ },
545
+ disciplineMode: { value: "none", origin: "inferred" },
461
546
  };
462
547
  }
463
548
  function mapFromColors(colors, origin) {
@@ -467,6 +552,32 @@ function mapFromColors(colors, origin) {
467
552
  }
468
553
  return out;
469
554
  }
555
+ /**
556
+ * Union of `kinds:` maps across tiers. Additive: every tier's kinds are
557
+ * carried. When two tiers declare the same kind, the child wins on
558
+ * description and `overrides` records the displaced parent.
559
+ */
560
+ function unionKindsMap(parent, childKinds, childOrigin) {
561
+ if (childKinds.size === 0)
562
+ return parent;
563
+ const out = new Map(parent);
564
+ for (const [name, kd] of childKinds) {
565
+ const prior = out.get(name);
566
+ out.set(name, {
567
+ value: kd,
568
+ origin: childOrigin,
569
+ overrides: prior ? [...(prior.overrides ?? []), prior.origin] : undefined,
570
+ });
571
+ }
572
+ return out;
573
+ }
574
+ function mapFromKinds(kinds, origin) {
575
+ const out = new Map();
576
+ for (const [name, kd] of kinds) {
577
+ out.set(name, { value: kd, origin });
578
+ }
579
+ return out;
580
+ }
470
581
  function mapFromLabelConcerns(concerns, origin) {
471
582
  const out = new Map();
472
583
  for (const c of concerns) {
@@ -604,6 +715,7 @@ function mapFromTypes(types, origin) {
604
715
  description: { value: td.description, origin },
605
716
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
606
717
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
718
+ discipline: { value: td.discipline, origin },
607
719
  };
608
720
  out.set(name, { value: eff, origin });
609
721
  }
@@ -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"}
@@ -15,4 +15,6 @@ export { mergeChain } from "./merge.js";
15
15
  // are not part of the public profile API and are not re-exported from
16
16
  // core/mod.ts. Consumers use loadChain / loadProfileForCommand instead.
17
17
  export { resolveEntryColor } from "./colors.js";
18
+ export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
19
+ export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
18
20
  export { buildProfileIntrospection } from "./introspect.js";
@@ -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,27 @@
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
+ /** The set of MarkSpec attribute names locked for this mapping. */
17
+ export function inferLockedAttributes(mapping) {
18
+ const locked = new Set();
19
+ for (const a of mapping.attributes) {
20
+ if (a.direction === "outbound")
21
+ continue;
22
+ if (a.locked || a.direction === "inbound") {
23
+ locked.add(a.markspec);
24
+ }
25
+ }
26
+ return locked;
27
+ }