@driftsys/markspec 0.4.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 (632) hide show
  1. package/README.md +74 -20
  2. package/esm/ast/build.d.ts +60 -0
  3. package/esm/ast/build.d.ts.map +1 -0
  4. package/esm/ast/build.js +516 -0
  5. package/esm/ast/equivalence.d.ts +18 -0
  6. package/esm/ast/equivalence.d.ts.map +1 -0
  7. package/esm/ast/equivalence.js +56 -0
  8. package/esm/ast/nodes.d.ts +189 -0
  9. package/esm/ast/nodes.d.ts.map +1 -0
  10. package/esm/ast/nodes.js +17 -0
  11. package/esm/ast/normalize.d.ts +58 -0
  12. package/esm/ast/normalize.d.ts.map +1 -0
  13. package/esm/ast/normalize.js +197 -0
  14. package/esm/ast/render.d.ts +34 -0
  15. package/esm/ast/render.d.ts.map +1 -0
  16. package/esm/ast/render.js +215 -0
  17. package/esm/compiler/constants.d.ts +16 -0
  18. package/esm/compiler/constants.d.ts.map +1 -0
  19. package/esm/compiler/constants.js +26 -0
  20. package/esm/compiler/discipline_classifier.d.ts +55 -0
  21. package/esm/compiler/discipline_classifier.d.ts.map +1 -0
  22. package/esm/compiler/discipline_classifier.js +191 -0
  23. package/esm/compiler/inverses.d.ts +2 -1
  24. package/esm/compiler/inverses.d.ts.map +1 -1
  25. package/esm/compiler/inverses.js +33 -14
  26. package/esm/compiler/manifest.d.ts +59 -0
  27. package/esm/compiler/manifest.d.ts.map +1 -0
  28. package/esm/compiler/manifest.js +48 -0
  29. package/esm/compiler/mod.d.ts +38 -1
  30. package/esm/compiler/mod.d.ts.map +1 -1
  31. package/esm/compiler/mod.js +202 -50
  32. package/esm/compiler/ndjson_writer.d.ts +50 -0
  33. package/esm/compiler/ndjson_writer.d.ts.map +1 -0
  34. package/esm/compiler/ndjson_writer.js +73 -0
  35. package/esm/compiler/schema.d.ts +33 -1
  36. package/esm/compiler/schema.d.ts.map +1 -1
  37. package/esm/compiler/schema.js +30 -9
  38. package/esm/config/markspec.d.ts +5 -0
  39. package/esm/config/markspec.d.ts.map +1 -1
  40. package/esm/config/markspec.js +17 -2
  41. package/esm/config/mod.d.ts.map +1 -1
  42. package/esm/config/mod.js +54 -0
  43. package/esm/formatter/mod.d.ts +55 -4
  44. package/esm/formatter/mod.d.ts.map +1 -1
  45. package/esm/formatter/mod.js +423 -46
  46. package/esm/formatter/synth_ulid.d.ts +21 -0
  47. package/esm/formatter/synth_ulid.d.ts.map +1 -0
  48. package/esm/formatter/synth_ulid.js +64 -0
  49. package/esm/lexicons/loader.d.ts +35 -0
  50. package/esm/lexicons/loader.d.ts.map +1 -0
  51. package/esm/lexicons/loader.js +51 -0
  52. package/esm/lexicons/mod.d.ts +13 -0
  53. package/esm/lexicons/mod.d.ts.map +1 -0
  54. package/esm/lexicons/mod.js +12 -0
  55. package/esm/lint/glossary.d.ts +45 -0
  56. package/esm/lint/glossary.d.ts.map +1 -0
  57. package/esm/lint/glossary.js +85 -0
  58. package/esm/lint/mod.d.ts +14 -0
  59. package/esm/lint/mod.d.ts.map +1 -0
  60. package/esm/lint/mod.js +9 -0
  61. package/esm/lint/range_util.d.ts +25 -0
  62. package/esm/lint/range_util.d.ts.map +1 -0
  63. package/esm/lint/range_util.js +50 -0
  64. package/esm/lint/rules/ears.d.ts +39 -0
  65. package/esm/lint/rules/ears.d.ts.map +1 -0
  66. package/esm/lint/rules/ears.js +316 -0
  67. package/esm/lint/rules/incose_sentence.d.ts +46 -0
  68. package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
  69. package/esm/lint/rules/incose_sentence.js +417 -0
  70. package/esm/lint/rules/lexicon.d.ts +24 -0
  71. package/esm/lint/rules/lexicon.d.ts.map +1 -0
  72. package/esm/lint/rules/lexicon.js +236 -0
  73. package/esm/lint/rules/modal_sentence.d.ts +46 -0
  74. package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
  75. package/esm/lint/rules/modal_sentence.js +146 -0
  76. package/esm/lint/rules/passive.d.ts +64 -0
  77. package/esm/lint/rules/passive.d.ts.map +1 -0
  78. package/esm/lint/rules/passive.js +282 -0
  79. package/esm/lint/rules/struct.d.ts +17 -0
  80. package/esm/lint/rules/struct.d.ts.map +1 -0
  81. package/esm/lint/rules/struct.js +55 -0
  82. package/esm/lint/rules/suppression.d.ts +54 -0
  83. package/esm/lint/rules/suppression.d.ts.map +1 -0
  84. package/esm/lint/rules/suppression.js +129 -0
  85. package/esm/lint/rules/xref.d.ts +19 -0
  86. package/esm/lint/rules/xref.d.ts.map +1 -0
  87. package/esm/lint/rules/xref.js +248 -0
  88. package/esm/lint/runner.d.ts +59 -0
  89. package/esm/lint/runner.d.ts.map +1 -0
  90. package/esm/lint/runner.js +153 -0
  91. package/esm/lint/score.d.ts +64 -0
  92. package/esm/lint/score.d.ts.map +1 -0
  93. package/esm/lint/score.js +163 -0
  94. package/esm/lint/segmenter.d.ts +32 -0
  95. package/esm/lint/segmenter.d.ts.map +1 -0
  96. package/esm/lint/segmenter.js +79 -0
  97. package/esm/lint/types.d.ts +31 -0
  98. package/esm/lint/types.d.ts.map +1 -0
  99. package/esm/lint/types.js +9 -0
  100. package/esm/lock/canonical_edges.d.ts +31 -0
  101. package/esm/lock/canonical_edges.d.ts.map +1 -0
  102. package/esm/lock/canonical_edges.js +57 -0
  103. package/esm/lock/check.d.ts +24 -0
  104. package/esm/lock/check.d.ts.map +1 -0
  105. package/esm/lock/check.js +127 -0
  106. package/esm/lock/hash.d.ts +12 -0
  107. package/esm/lock/hash.d.ts.map +1 -0
  108. package/esm/lock/hash.js +32 -0
  109. package/esm/lock/mod.d.ts +19 -0
  110. package/esm/lock/mod.d.ts.map +1 -0
  111. package/esm/lock/mod.js +14 -0
  112. package/esm/lock/model.d.ts +81 -0
  113. package/esm/lock/model.d.ts.map +1 -0
  114. package/esm/lock/model.js +7 -0
  115. package/esm/lock/parser.d.ts +26 -0
  116. package/esm/lock/parser.d.ts.map +1 -0
  117. package/esm/lock/parser.js +195 -0
  118. package/esm/lock/resolve.d.ts +142 -0
  119. package/esm/lock/resolve.d.ts.map +1 -0
  120. package/esm/lock/resolve.js +389 -0
  121. package/esm/lock/serializer.d.ts +14 -0
  122. package/esm/lock/serializer.d.ts.map +1 -0
  123. package/esm/lock/serializer.js +104 -0
  124. package/esm/mod.d.ts +28 -8
  125. package/esm/mod.d.ts.map +1 -1
  126. package/esm/mod.js +23 -4
  127. package/esm/model/attributes.d.ts +6 -0
  128. package/esm/model/attributes.d.ts.map +1 -1
  129. package/esm/model/attributes.js +200 -2
  130. package/esm/model/discipline.d.ts +53 -0
  131. package/esm/model/discipline.d.ts.map +1 -0
  132. package/esm/model/discipline.js +50 -0
  133. package/esm/model/discriminating_attr.d.ts +33 -0
  134. package/esm/model/discriminating_attr.d.ts.map +1 -0
  135. package/esm/model/discriminating_attr.js +74 -0
  136. package/esm/model/mod.d.ts +267 -14
  137. package/esm/model/mod.d.ts.map +1 -1
  138. package/esm/model/mod.js +99 -3
  139. package/esm/model/profile.d.ts +102 -27
  140. package/esm/model/profile.d.ts.map +1 -1
  141. package/esm/model/source_introspection.d.ts +26 -0
  142. package/esm/model/source_introspection.d.ts.map +1 -0
  143. package/esm/model/source_introspection.js +77 -0
  144. package/esm/model/type_hierarchy.d.ts +51 -0
  145. package/esm/model/type_hierarchy.d.ts.map +1 -0
  146. package/esm/model/type_hierarchy.js +126 -0
  147. package/esm/model/uri_scheme_map.d.ts +21 -0
  148. package/esm/model/uri_scheme_map.d.ts.map +1 -0
  149. package/esm/model/uri_scheme_map.js +66 -0
  150. package/esm/parser/attributes.d.ts.map +1 -1
  151. package/esm/parser/attributes.js +10 -16
  152. package/esm/parser/body_tokens.d.ts +35 -0
  153. package/esm/parser/body_tokens.d.ts.map +1 -0
  154. package/esm/parser/body_tokens.js +232 -0
  155. package/esm/parser/glossary.d.ts +51 -0
  156. package/esm/parser/glossary.d.ts.map +1 -0
  157. package/esm/parser/glossary.js +219 -0
  158. package/esm/parser/grammars.d.ts +5 -3
  159. package/esm/parser/grammars.d.ts.map +1 -1
  160. package/esm/parser/grammars.js +12 -4
  161. package/esm/parser/language_spec.d.ts +55 -0
  162. package/esm/parser/language_spec.d.ts.map +1 -0
  163. package/esm/parser/language_spec.js +419 -0
  164. package/esm/parser/line_map.d.ts +60 -0
  165. package/esm/parser/line_map.d.ts.map +1 -0
  166. package/esm/parser/line_map.js +41 -0
  167. package/esm/parser/markdown.d.ts +9 -0
  168. package/esm/parser/markdown.d.ts.map +1 -1
  169. package/esm/parser/markdown.js +317 -25
  170. package/esm/parser/mod.d.ts +5 -0
  171. package/esm/parser/mod.d.ts.map +1 -1
  172. package/esm/parser/mod.js +31 -8
  173. package/esm/parser/source.d.ts +53 -2
  174. package/esm/parser/source.d.ts.map +1 -1
  175. package/esm/parser/source.js +158 -68
  176. package/esm/parser/translate.d.ts +24 -0
  177. package/esm/parser/translate.d.ts.map +1 -0
  178. package/esm/parser/translate.js +99 -0
  179. package/esm/profile/chain.d.ts +8 -0
  180. package/esm/profile/chain.d.ts.map +1 -1
  181. package/esm/profile/chain.js +32 -14
  182. package/esm/profile/colors.js +1 -1
  183. package/esm/profile/default_profile.d.ts +25 -0
  184. package/esm/profile/default_profile.d.ts.map +1 -0
  185. package/esm/profile/default_profile.js +43 -0
  186. package/esm/profile/discipline_mode.d.ts +64 -0
  187. package/esm/profile/discipline_mode.d.ts.map +1 -0
  188. package/esm/profile/discipline_mode.js +133 -0
  189. package/esm/profile/discipline_registry.d.ts +41 -0
  190. package/esm/profile/discipline_registry.d.ts.map +1 -0
  191. package/esm/profile/discipline_registry.js +67 -0
  192. package/esm/profile/introspect.d.ts +135 -0
  193. package/esm/profile/introspect.d.ts.map +1 -0
  194. package/esm/profile/introspect.js +378 -0
  195. package/esm/profile/load.d.ts +3 -1
  196. package/esm/profile/load.d.ts.map +1 -1
  197. package/esm/profile/load.js +91 -5
  198. package/esm/profile/manifest.d.ts.map +1 -1
  199. package/esm/profile/manifest.js +512 -90
  200. package/esm/profile/merge.d.ts.map +1 -1
  201. package/esm/profile/merge.js +251 -39
  202. package/esm/profile/mod.d.ts +4 -4
  203. package/esm/profile/mod.d.ts.map +1 -1
  204. package/esm/profile/mod.js +7 -2
  205. package/esm/reporter/mod.js +4 -4
  206. package/esm/sync/locked_attributes.d.ts +19 -0
  207. package/esm/sync/locked_attributes.d.ts.map +1 -0
  208. package/esm/sync/locked_attributes.js +27 -0
  209. package/esm/sync/log.d.ts +34 -0
  210. package/esm/sync/log.d.ts.map +1 -0
  211. package/esm/sync/log.js +48 -0
  212. package/esm/sync/mapping.d.ts +66 -0
  213. package/esm/sync/mapping.d.ts.map +1 -0
  214. package/esm/sync/mapping.js +165 -0
  215. package/esm/sync/mod.d.ts +16 -0
  216. package/esm/sync/mod.d.ts.map +1 -0
  217. package/esm/sync/mod.js +12 -0
  218. package/esm/sync/status.d.ts +23 -0
  219. package/esm/sync/status.d.ts.map +1 -0
  220. package/esm/sync/status.js +21 -0
  221. package/esm/typl/ast.d.ts +87 -0
  222. package/esm/typl/ast.d.ts.map +1 -0
  223. package/esm/typl/ast.js +21 -0
  224. package/esm/typl/bridge.d.ts +32 -0
  225. package/esm/typl/bridge.d.ts.map +1 -0
  226. package/esm/typl/bridge.js +27 -0
  227. package/esm/typl/bullet.d.ts +34 -0
  228. package/esm/typl/bullet.d.ts.map +1 -0
  229. package/esm/typl/bullet.js +44 -0
  230. package/esm/typl/diagnostics.d.ts +43 -0
  231. package/esm/typl/diagnostics.d.ts.map +1 -0
  232. package/esm/typl/diagnostics.js +61 -0
  233. package/esm/typl/fence.d.ts +31 -0
  234. package/esm/typl/fence.d.ts.map +1 -0
  235. package/esm/typl/fence.js +24 -0
  236. package/esm/typl/grammar.d.ts +20 -0
  237. package/esm/typl/grammar.d.ts.map +1 -0
  238. package/esm/typl/grammar.js +471 -0
  239. package/esm/typl/inline.d.ts +34 -0
  240. package/esm/typl/inline.d.ts.map +1 -0
  241. package/esm/typl/inline.js +48 -0
  242. package/esm/typl/lexer.d.ts +37 -0
  243. package/esm/typl/lexer.d.ts.map +1 -0
  244. package/esm/typl/lexer.js +234 -0
  245. package/esm/typl/mod.d.ts +23 -0
  246. package/esm/typl/mod.d.ts.map +1 -0
  247. package/esm/typl/mod.js +16 -0
  248. package/esm/typl/registry.d.ts +42 -0
  249. package/esm/typl/registry.d.ts.map +1 -0
  250. package/esm/typl/registry.js +26 -0
  251. package/esm/typl/validator.d.ts +29 -0
  252. package/esm/typl/validator.d.ts.map +1 -0
  253. package/esm/typl/validator.js +141 -0
  254. package/esm/util/fence.d.ts +30 -0
  255. package/esm/util/fence.d.ts.map +1 -0
  256. package/esm/util/fence.js +40 -0
  257. package/esm/util/line_endings.d.ts +33 -0
  258. package/esm/util/line_endings.d.ts.map +1 -0
  259. package/esm/util/line_endings.js +53 -0
  260. package/esm/util/modals.d.ts +29 -0
  261. package/esm/util/modals.d.ts.map +1 -0
  262. package/esm/util/modals.js +38 -0
  263. package/esm/validator/attributes.d.ts +3 -3
  264. package/esm/validator/attributes.d.ts.map +1 -1
  265. package/esm/validator/attributes.js +1 -18
  266. package/esm/validator/body_blocks.d.ts +38 -0
  267. package/esm/validator/body_blocks.d.ts.map +1 -0
  268. package/esm/validator/body_blocks.js +218 -0
  269. package/esm/validator/caption_convention.d.ts +29 -0
  270. package/esm/validator/caption_convention.d.ts.map +1 -0
  271. package/esm/validator/caption_convention.js +58 -0
  272. package/esm/validator/captions.d.ts +22 -0
  273. package/esm/validator/captions.d.ts.map +1 -0
  274. package/esm/validator/captions.js +137 -0
  275. package/esm/validator/component_schemes.d.ts +73 -0
  276. package/esm/validator/component_schemes.d.ts.map +1 -0
  277. package/esm/validator/component_schemes.js +375 -0
  278. package/esm/validator/discipline.d.ts +35 -0
  279. package/esm/validator/discipline.d.ts.map +1 -0
  280. package/esm/validator/discipline.js +204 -0
  281. package/esm/validator/feature_ac.d.ts +28 -0
  282. package/esm/validator/feature_ac.d.ts.map +1 -0
  283. package/esm/validator/feature_ac.js +102 -0
  284. package/esm/validator/listing.d.ts +42 -0
  285. package/esm/validator/listing.d.ts.map +1 -0
  286. package/esm/validator/listing.js +295 -0
  287. package/esm/validator/mod.d.ts +3 -1
  288. package/esm/validator/mod.d.ts.map +1 -1
  289. package/esm/validator/mod.js +275 -13
  290. package/esm/validator/modal_keywords.d.ts +25 -0
  291. package/esm/validator/modal_keywords.d.ts.map +1 -0
  292. package/esm/validator/modal_keywords.js +54 -0
  293. package/esm/validator/pattern.d.ts +15 -8
  294. package/esm/validator/pattern.d.ts.map +1 -1
  295. package/esm/validator/pattern.js +42 -19
  296. package/esm/validator/per_type_attrs.d.ts +29 -0
  297. package/esm/validator/per_type_attrs.d.ts.map +1 -0
  298. package/esm/validator/per_type_attrs.js +75 -0
  299. package/esm/validator/pipeline.d.ts +18 -2
  300. package/esm/validator/pipeline.d.ts.map +1 -1
  301. package/esm/validator/pipeline.js +76 -21
  302. package/esm/validator/trace_types.d.ts +26 -0
  303. package/esm/validator/trace_types.d.ts.map +1 -0
  304. package/esm/validator/trace_types.js +232 -0
  305. package/esm/validator/traceability.d.ts +3 -4
  306. package/esm/validator/traceability.d.ts.map +1 -1
  307. package/esm/validator/traceability.js +5 -10
  308. package/esm/validator/type_resolution.d.ts +67 -0
  309. package/esm/validator/type_resolution.d.ts.map +1 -0
  310. package/esm/validator/type_resolution.js +162 -0
  311. package/esm/validator/types.d.ts +45 -0
  312. package/esm/validator/types.d.ts.map +1 -1
  313. package/esm/validator/types.js +128 -16
  314. package/esm/validator/value_types.d.ts +8 -0
  315. package/esm/validator/value_types.d.ts.map +1 -1
  316. package/esm/validator/value_types.js +8 -1
  317. package/package.json +2 -2
  318. package/script/ast/build.d.ts +60 -0
  319. package/script/ast/build.d.ts.map +1 -0
  320. package/script/ast/build.js +521 -0
  321. package/script/ast/equivalence.d.ts +18 -0
  322. package/script/ast/equivalence.d.ts.map +1 -0
  323. package/script/ast/equivalence.js +59 -0
  324. package/script/ast/nodes.d.ts +189 -0
  325. package/script/ast/nodes.d.ts.map +1 -0
  326. package/script/ast/nodes.js +18 -0
  327. package/script/ast/normalize.d.ts +58 -0
  328. package/script/ast/normalize.d.ts.map +1 -0
  329. package/script/ast/normalize.js +200 -0
  330. package/script/ast/render.d.ts +34 -0
  331. package/script/ast/render.d.ts.map +1 -0
  332. package/script/ast/render.js +218 -0
  333. package/script/compiler/constants.d.ts +16 -0
  334. package/script/compiler/constants.d.ts.map +1 -0
  335. package/script/compiler/constants.js +29 -0
  336. package/script/compiler/discipline_classifier.d.ts +55 -0
  337. package/script/compiler/discipline_classifier.d.ts.map +1 -0
  338. package/script/compiler/discipline_classifier.js +196 -0
  339. package/script/compiler/inverses.d.ts +2 -1
  340. package/script/compiler/inverses.d.ts.map +1 -1
  341. package/script/compiler/inverses.js +33 -14
  342. package/script/compiler/manifest.d.ts +59 -0
  343. package/script/compiler/manifest.d.ts.map +1 -0
  344. package/script/compiler/manifest.js +51 -0
  345. package/script/compiler/mod.d.ts +38 -1
  346. package/script/compiler/mod.d.ts.map +1 -1
  347. package/script/compiler/mod.js +206 -54
  348. package/script/compiler/ndjson_writer.d.ts +50 -0
  349. package/script/compiler/ndjson_writer.d.ts.map +1 -0
  350. package/script/compiler/ndjson_writer.js +78 -0
  351. package/script/compiler/schema.d.ts +33 -1
  352. package/script/compiler/schema.d.ts.map +1 -1
  353. package/script/compiler/schema.js +30 -8
  354. package/script/config/markspec.d.ts +5 -0
  355. package/script/config/markspec.d.ts.map +1 -1
  356. package/script/config/markspec.js +17 -2
  357. package/script/config/mod.d.ts.map +1 -1
  358. package/script/config/mod.js +54 -0
  359. package/script/formatter/mod.d.ts +55 -4
  360. package/script/formatter/mod.d.ts.map +1 -1
  361. package/script/formatter/mod.js +426 -46
  362. package/script/formatter/synth_ulid.d.ts +21 -0
  363. package/script/formatter/synth_ulid.d.ts.map +1 -0
  364. package/script/formatter/synth_ulid.js +67 -0
  365. package/script/lexicons/loader.d.ts +35 -0
  366. package/script/lexicons/loader.d.ts.map +1 -0
  367. package/script/lexicons/loader.js +55 -0
  368. package/script/lexicons/mod.d.ts +13 -0
  369. package/script/lexicons/mod.d.ts.map +1 -0
  370. package/script/lexicons/mod.js +17 -0
  371. package/script/lint/glossary.d.ts +45 -0
  372. package/script/lint/glossary.d.ts.map +1 -0
  373. package/script/lint/glossary.js +88 -0
  374. package/script/lint/mod.d.ts +14 -0
  375. package/script/lint/mod.d.ts.map +1 -0
  376. package/script/lint/mod.js +17 -0
  377. package/script/lint/range_util.d.ts +25 -0
  378. package/script/lint/range_util.d.ts.map +1 -0
  379. package/script/lint/range_util.js +53 -0
  380. package/script/lint/rules/ears.d.ts +39 -0
  381. package/script/lint/rules/ears.d.ts.map +1 -0
  382. package/script/lint/rules/ears.js +320 -0
  383. package/script/lint/rules/incose_sentence.d.ts +46 -0
  384. package/script/lint/rules/incose_sentence.d.ts.map +1 -0
  385. package/script/lint/rules/incose_sentence.js +421 -0
  386. package/script/lint/rules/lexicon.d.ts +24 -0
  387. package/script/lint/rules/lexicon.d.ts.map +1 -0
  388. package/script/lint/rules/lexicon.js +240 -0
  389. package/script/lint/rules/modal_sentence.d.ts +46 -0
  390. package/script/lint/rules/modal_sentence.d.ts.map +1 -0
  391. package/script/lint/rules/modal_sentence.js +150 -0
  392. package/script/lint/rules/passive.d.ts +64 -0
  393. package/script/lint/rules/passive.d.ts.map +1 -0
  394. package/script/lint/rules/passive.js +286 -0
  395. package/script/lint/rules/struct.d.ts +17 -0
  396. package/script/lint/rules/struct.d.ts.map +1 -0
  397. package/script/lint/rules/struct.js +59 -0
  398. package/script/lint/rules/suppression.d.ts +54 -0
  399. package/script/lint/rules/suppression.d.ts.map +1 -0
  400. package/script/lint/rules/suppression.js +136 -0
  401. package/script/lint/rules/xref.d.ts +19 -0
  402. package/script/lint/rules/xref.d.ts.map +1 -0
  403. package/script/lint/rules/xref.js +251 -0
  404. package/script/lint/runner.d.ts +59 -0
  405. package/script/lint/runner.d.ts.map +1 -0
  406. package/script/lint/runner.js +157 -0
  407. package/script/lint/score.d.ts +64 -0
  408. package/script/lint/score.d.ts.map +1 -0
  409. package/script/lint/score.js +167 -0
  410. package/script/lint/segmenter.d.ts +32 -0
  411. package/script/lint/segmenter.d.ts.map +1 -0
  412. package/script/lint/segmenter.js +82 -0
  413. package/script/lint/types.d.ts +31 -0
  414. package/script/lint/types.d.ts.map +1 -0
  415. package/script/lint/types.js +10 -0
  416. package/script/lock/canonical_edges.d.ts +31 -0
  417. package/script/lock/canonical_edges.d.ts.map +1 -0
  418. package/script/lock/canonical_edges.js +61 -0
  419. package/script/lock/check.d.ts +24 -0
  420. package/script/lock/check.d.ts.map +1 -0
  421. package/script/lock/check.js +130 -0
  422. package/script/lock/hash.d.ts +12 -0
  423. package/script/lock/hash.d.ts.map +1 -0
  424. package/script/lock/hash.js +36 -0
  425. package/script/lock/mod.d.ts +19 -0
  426. package/script/lock/mod.d.ts.map +1 -0
  427. package/script/lock/mod.js +31 -0
  428. package/script/lock/model.d.ts +81 -0
  429. package/script/lock/model.d.ts.map +1 -0
  430. package/script/lock/model.js +10 -0
  431. package/script/lock/parser.d.ts +26 -0
  432. package/script/lock/parser.d.ts.map +1 -0
  433. package/script/lock/parser.js +198 -0
  434. package/script/lock/resolve.d.ts +142 -0
  435. package/script/lock/resolve.d.ts.map +1 -0
  436. package/script/lock/resolve.js +397 -0
  437. package/script/lock/serializer.d.ts +14 -0
  438. package/script/lock/serializer.d.ts.map +1 -0
  439. package/script/lock/serializer.js +107 -0
  440. package/script/mod.d.ts +28 -8
  441. package/script/mod.d.ts.map +1 -1
  442. package/script/mod.js +129 -32
  443. package/script/model/attributes.d.ts +6 -0
  444. package/script/model/attributes.d.ts.map +1 -1
  445. package/script/model/attributes.js +201 -3
  446. package/script/model/discipline.d.ts +53 -0
  447. package/script/model/discipline.d.ts.map +1 -0
  448. package/script/model/discipline.js +53 -0
  449. package/script/model/discriminating_attr.d.ts +33 -0
  450. package/script/model/discriminating_attr.d.ts.map +1 -0
  451. package/script/model/discriminating_attr.js +77 -0
  452. package/script/model/mod.d.ts +267 -14
  453. package/script/model/mod.d.ts.map +1 -1
  454. package/script/model/mod.js +111 -3
  455. package/script/model/profile.d.ts +102 -27
  456. package/script/model/profile.d.ts.map +1 -1
  457. package/script/model/source_introspection.d.ts +26 -0
  458. package/script/model/source_introspection.d.ts.map +1 -0
  459. package/script/model/source_introspection.js +80 -0
  460. package/script/model/type_hierarchy.d.ts +51 -0
  461. package/script/model/type_hierarchy.d.ts.map +1 -0
  462. package/script/model/type_hierarchy.js +130 -0
  463. package/script/model/uri_scheme_map.d.ts +21 -0
  464. package/script/model/uri_scheme_map.d.ts.map +1 -0
  465. package/script/model/uri_scheme_map.js +69 -0
  466. package/script/parser/attributes.d.ts.map +1 -1
  467. package/script/parser/attributes.js +10 -16
  468. package/script/parser/body_tokens.d.ts +35 -0
  469. package/script/parser/body_tokens.d.ts.map +1 -0
  470. package/script/parser/body_tokens.js +235 -0
  471. package/script/parser/glossary.d.ts +51 -0
  472. package/script/parser/glossary.d.ts.map +1 -0
  473. package/script/parser/glossary.js +224 -0
  474. package/script/parser/grammars.d.ts +5 -3
  475. package/script/parser/grammars.d.ts.map +1 -1
  476. package/script/parser/grammars.js +15 -8
  477. package/script/parser/language_spec.d.ts +55 -0
  478. package/script/parser/language_spec.d.ts.map +1 -0
  479. package/script/parser/language_spec.js +423 -0
  480. package/script/parser/line_map.d.ts +60 -0
  481. package/script/parser/line_map.d.ts.map +1 -0
  482. package/script/parser/line_map.js +44 -0
  483. package/script/parser/markdown.d.ts +9 -0
  484. package/script/parser/markdown.d.ts.map +1 -1
  485. package/script/parser/markdown.js +315 -23
  486. package/script/parser/mod.d.ts +5 -0
  487. package/script/parser/mod.d.ts.map +1 -1
  488. package/script/parser/mod.js +36 -7
  489. package/script/parser/source.d.ts +53 -2
  490. package/script/parser/source.d.ts.map +1 -1
  491. package/script/parser/source.js +159 -69
  492. package/script/parser/translate.d.ts +24 -0
  493. package/script/parser/translate.d.ts.map +1 -0
  494. package/script/parser/translate.js +102 -0
  495. package/script/profile/chain.d.ts +8 -0
  496. package/script/profile/chain.d.ts.map +1 -1
  497. package/script/profile/chain.js +32 -14
  498. package/script/profile/colors.js +1 -1
  499. package/script/profile/default_profile.d.ts +25 -0
  500. package/script/profile/default_profile.d.ts.map +1 -0
  501. package/script/profile/default_profile.js +46 -0
  502. package/script/profile/discipline_mode.d.ts +64 -0
  503. package/script/profile/discipline_mode.d.ts.map +1 -0
  504. package/script/profile/discipline_mode.js +138 -0
  505. package/script/profile/discipline_registry.d.ts +41 -0
  506. package/script/profile/discipline_registry.d.ts.map +1 -0
  507. package/script/profile/discipline_registry.js +70 -0
  508. package/script/profile/introspect.d.ts +135 -0
  509. package/script/profile/introspect.d.ts.map +1 -0
  510. package/script/profile/introspect.js +381 -0
  511. package/script/profile/load.d.ts +3 -1
  512. package/script/profile/load.d.ts.map +1 -1
  513. package/script/profile/load.js +91 -5
  514. package/script/profile/manifest.d.ts.map +1 -1
  515. package/script/profile/manifest.js +511 -89
  516. package/script/profile/merge.d.ts.map +1 -1
  517. package/script/profile/merge.js +251 -39
  518. package/script/profile/mod.d.ts +4 -4
  519. package/script/profile/mod.d.ts.map +1 -1
  520. package/script/profile/mod.js +12 -6
  521. package/script/reporter/mod.js +4 -4
  522. package/script/sync/locked_attributes.d.ts +19 -0
  523. package/script/sync/locked_attributes.d.ts.map +1 -0
  524. package/script/sync/locked_attributes.js +30 -0
  525. package/script/sync/log.d.ts +34 -0
  526. package/script/sync/log.d.ts.map +1 -0
  527. package/script/sync/log.js +52 -0
  528. package/script/sync/mapping.d.ts +66 -0
  529. package/script/sync/mapping.d.ts.map +1 -0
  530. package/script/sync/mapping.js +169 -0
  531. package/script/sync/mod.d.ts +16 -0
  532. package/script/sync/mod.d.ts.map +1 -0
  533. package/script/sync/mod.js +21 -0
  534. package/script/sync/status.d.ts +23 -0
  535. package/script/sync/status.d.ts.map +1 -0
  536. package/script/sync/status.js +24 -0
  537. package/script/typl/ast.d.ts +87 -0
  538. package/script/typl/ast.d.ts.map +1 -0
  539. package/script/typl/ast.js +24 -0
  540. package/script/typl/bridge.d.ts +32 -0
  541. package/script/typl/bridge.d.ts.map +1 -0
  542. package/script/typl/bridge.js +30 -0
  543. package/script/typl/bullet.d.ts +34 -0
  544. package/script/typl/bullet.d.ts.map +1 -0
  545. package/script/typl/bullet.js +47 -0
  546. package/script/typl/diagnostics.d.ts +43 -0
  547. package/script/typl/diagnostics.d.ts.map +1 -0
  548. package/script/typl/diagnostics.js +65 -0
  549. package/script/typl/fence.d.ts +31 -0
  550. package/script/typl/fence.d.ts.map +1 -0
  551. package/script/typl/fence.js +27 -0
  552. package/script/typl/grammar.d.ts +20 -0
  553. package/script/typl/grammar.d.ts.map +1 -0
  554. package/script/typl/grammar.js +474 -0
  555. package/script/typl/inline.d.ts +34 -0
  556. package/script/typl/inline.d.ts.map +1 -0
  557. package/script/typl/inline.js +51 -0
  558. package/script/typl/lexer.d.ts +37 -0
  559. package/script/typl/lexer.d.ts.map +1 -0
  560. package/script/typl/lexer.js +237 -0
  561. package/script/typl/mod.d.ts +23 -0
  562. package/script/typl/mod.d.ts.map +1 -0
  563. package/script/typl/mod.js +29 -0
  564. package/script/typl/registry.d.ts +42 -0
  565. package/script/typl/registry.d.ts.map +1 -0
  566. package/script/typl/registry.js +29 -0
  567. package/script/typl/validator.d.ts +29 -0
  568. package/script/typl/validator.d.ts.map +1 -0
  569. package/script/typl/validator.js +144 -0
  570. package/script/util/fence.d.ts +30 -0
  571. package/script/util/fence.d.ts.map +1 -0
  572. package/script/util/fence.js +44 -0
  573. package/script/util/line_endings.d.ts +33 -0
  574. package/script/util/line_endings.d.ts.map +1 -0
  575. package/script/util/line_endings.js +58 -0
  576. package/script/util/modals.d.ts +29 -0
  577. package/script/util/modals.d.ts.map +1 -0
  578. package/script/util/modals.js +42 -0
  579. package/script/validator/attributes.d.ts +3 -3
  580. package/script/validator/attributes.d.ts.map +1 -1
  581. package/script/validator/attributes.js +1 -18
  582. package/script/validator/body_blocks.d.ts +38 -0
  583. package/script/validator/body_blocks.d.ts.map +1 -0
  584. package/script/validator/body_blocks.js +221 -0
  585. package/script/validator/caption_convention.d.ts +29 -0
  586. package/script/validator/caption_convention.d.ts.map +1 -0
  587. package/script/validator/caption_convention.js +61 -0
  588. package/script/validator/captions.d.ts +22 -0
  589. package/script/validator/captions.d.ts.map +1 -0
  590. package/script/validator/captions.js +140 -0
  591. package/script/validator/component_schemes.d.ts +73 -0
  592. package/script/validator/component_schemes.d.ts.map +1 -0
  593. package/script/validator/component_schemes.js +384 -0
  594. package/script/validator/discipline.d.ts +35 -0
  595. package/script/validator/discipline.d.ts.map +1 -0
  596. package/script/validator/discipline.js +207 -0
  597. package/script/validator/feature_ac.d.ts +28 -0
  598. package/script/validator/feature_ac.d.ts.map +1 -0
  599. package/script/validator/feature_ac.js +105 -0
  600. package/script/validator/listing.d.ts +42 -0
  601. package/script/validator/listing.d.ts.map +1 -0
  602. package/script/validator/listing.js +298 -0
  603. package/script/validator/mod.d.ts +3 -1
  604. package/script/validator/mod.d.ts.map +1 -1
  605. package/script/validator/mod.js +278 -14
  606. package/script/validator/modal_keywords.d.ts +25 -0
  607. package/script/validator/modal_keywords.d.ts.map +1 -0
  608. package/script/validator/modal_keywords.js +57 -0
  609. package/script/validator/pattern.d.ts +15 -8
  610. package/script/validator/pattern.d.ts.map +1 -1
  611. package/script/validator/pattern.js +42 -19
  612. package/script/validator/per_type_attrs.d.ts +29 -0
  613. package/script/validator/per_type_attrs.d.ts.map +1 -0
  614. package/script/validator/per_type_attrs.js +78 -0
  615. package/script/validator/pipeline.d.ts +18 -2
  616. package/script/validator/pipeline.d.ts.map +1 -1
  617. package/script/validator/pipeline.js +78 -22
  618. package/script/validator/trace_types.d.ts +26 -0
  619. package/script/validator/trace_types.d.ts.map +1 -0
  620. package/script/validator/trace_types.js +235 -0
  621. package/script/validator/traceability.d.ts +3 -4
  622. package/script/validator/traceability.d.ts.map +1 -1
  623. package/script/validator/traceability.js +5 -10
  624. package/script/validator/type_resolution.d.ts +67 -0
  625. package/script/validator/type_resolution.d.ts.map +1 -0
  626. package/script/validator/type_resolution.js +168 -0
  627. package/script/validator/types.d.ts +45 -0
  628. package/script/validator/types.d.ts.map +1 -1
  629. package/script/validator/types.js +131 -16
  630. package/script/validator/value_types.d.ts +8 -0
  631. package/script/validator/value_types.d.ts.map +1 -1
  632. package/script/validator/value_types.js +10 -2
@@ -0,0 +1,142 @@
1
+ /**
2
+ * @module core/lock/resolve
3
+ *
4
+ * Shared upstream-resolution layer. Both `markspec lock` and
5
+ * `markspec compile` call {@linkcode resolveUpstreams}. All
6
+ * world-touching operations (HTTP fetch, clock) flow through
7
+ * callbacks so unit tests inject deterministic stubs.
8
+ *
9
+ * Implementation arrives in Tasks 15–18; this file ships the type
10
+ * surface and a stub.
11
+ */
12
+ import type { Diagnostic, Entry, ProfileChain, ProjectConfig } from "../model/mod.js";
13
+ import type { Mapping } from "../sync/mod.js";
14
+ import type { BoundEntry, UpstreamProfile, UpstreamReference, UpstreamRegistry } from "./model.js";
15
+ import { type EdgeQuad } from "./canonical_edges.js";
16
+ /**
17
+ * Callback to fetch a URL. Returns the bytes on success, or an
18
+ * `{ error }` object on failure. Never throws — every recoverable
19
+ * problem flows back as an error so the resolver can attach a
20
+ * diagnostic instead of bubbling an exception.
21
+ */
22
+ export type FetchUrl = (url: string) => Promise<Uint8Array | {
23
+ error: string;
24
+ }>;
25
+ /**
26
+ * Callback to read a local file by absolute path. Returns the bytes on
27
+ * success, or `{ error }` on failure. Used by `resolveProfileChain` to
28
+ * hash on-disk profile manifests; isolated to a callback so the resolver
29
+ * stays runtime-agnostic.
30
+ */
31
+ export type ReadFile = (path: string) => Promise<Uint8Array | {
32
+ error: string;
33
+ }>;
34
+ /** Inputs to {@linkcode resolveUpstreams}. */
35
+ export interface ResolveUpstreamsOptions {
36
+ readonly entries: readonly Entry[];
37
+ /**
38
+ * Profile chain to lock. Pass `[]` when no profile is active —
39
+ * tighter than making the chain optional, since downstream
40
+ * code can always iterate `profileChain` without a null check.
41
+ */
42
+ readonly profileChain: ProfileChain | readonly never[];
43
+ readonly config: ProjectConfig;
44
+ readonly mappings: readonly Mapping[];
45
+ readonly fetchUrl: FetchUrl;
46
+ readonly readFile: ReadFile;
47
+ /** Injectable clock for deterministic tests. Defaults to `() => new Date()`. */
48
+ readonly now?: () => Date;
49
+ }
50
+ /** A Reference citation that resolved to bytes or identity-only. */
51
+ export interface ResolvedReference {
52
+ readonly upstream: UpstreamReference;
53
+ readonly diagnostics: readonly Diagnostic[];
54
+ }
55
+ /** A profile chain tier that resolved. */
56
+ export interface ResolvedProfile {
57
+ readonly upstream: UpstreamProfile;
58
+ readonly diagnostics: readonly Diagnostic[];
59
+ }
60
+ /** A federated registry that resolved. */
61
+ export interface ResolvedRegistry {
62
+ readonly upstream: UpstreamRegistry;
63
+ readonly diagnostics: readonly Diagnostic[];
64
+ }
65
+ /** A bound entry's locked-attribute snapshot. */
66
+ export interface ResolvedBoundEntry {
67
+ readonly boundEntry: BoundEntry;
68
+ readonly diagnostics: readonly Diagnostic[];
69
+ }
70
+ /** Full resolved-upstreams payload — input to lockfile serialization. */
71
+ export interface ResolvedUpstreams {
72
+ readonly references: readonly ResolvedReference[];
73
+ readonly profiles: readonly ResolvedProfile[];
74
+ readonly registries: readonly ResolvedRegistry[];
75
+ readonly boundEntries: readonly ResolvedBoundEntry[];
76
+ /** sha256:* of the canonical edge serialization. */
77
+ readonly canonicalEdgeHash: string;
78
+ readonly canonicalEdgeCount: number;
79
+ /** Wall-clock timestamp the lockfile was resolved. */
80
+ readonly lockedAt: string;
81
+ /** Aggregate diagnostics — empty when every upstream resolved cleanly. */
82
+ readonly diagnostics: readonly Diagnostic[];
83
+ }
84
+ /**
85
+ * Resolve every Reference entry to an upstream record. Deduplicates by
86
+ * display ID (first occurrence wins). When `Reference-url:` is set, the
87
+ * bytes are fetched and `sha256:*`-hashed; otherwise an MSL-L010 info
88
+ * diagnostic is attached and the upstream is identity-only. Fetch
89
+ * failures attach MSL-L101 and degrade to identity-only.
90
+ */
91
+ export declare function resolveReferences(entries: readonly Entry[], fetchUrl: FetchUrl): Promise<ResolvedReference[]>;
92
+ /**
93
+ * Project an entry list to canonical edge quads. Walks the eleven core
94
+ * trace-link attributes (Satisfies, Derived-from, Verified-by, …) and
95
+ * emits one quad per resolved target ID, splitting CSV values on `,`
96
+ * or whitespace. Every quad is provenance `"local"` — externally
97
+ * sourced edges are folded in later (post-MVP).
98
+ */
99
+ export declare function extractEdgeQuads(entries: readonly Entry[]): EdgeQuad[];
100
+ /**
101
+ * Resolve every upstream the lockfile needs: References, profile chain
102
+ * tiers, federated registries, and bound entries. Computes the
103
+ * canonical edge hash from the same entry set. Returns the aggregate
104
+ * `ResolvedUpstreams` payload ready for {@link serializeLockfile}.
105
+ *
106
+ * The four sub-resolvers run sequentially (not concurrently) because
107
+ * (a) the callbacks they share — `fetchUrl`, `readFile` — may themselves
108
+ * serialize work, and (b) the diagnostics output is easier to reason
109
+ * about with a deterministic order. Wrap inside `Promise.all` only when
110
+ * profiling shows a clear win.
111
+ */
112
+ export declare function resolveUpstreams(opts: ResolveUpstreamsOptions): Promise<ResolvedUpstreams>;
113
+ /**
114
+ * Resolve every profile chain tier into an upstream record. Each tier's
115
+ * `markspec.yaml` is read from `tier.sourcePath` via `readFile` and
116
+ * `sha256:*`-hashed; a read failure attaches MSL-L102 and degrades the
117
+ * tier's hash to `sha256:0` (identity-only).
118
+ *
119
+ * The `extends` chain is reconstructed from list order: tiers are
120
+ * already root-parent → leaf-child, so each tier's `extends` points to
121
+ * the previous tier's id. The root tier has `extends: undefined`.
122
+ */
123
+ export declare function resolveProfileChain(chain: ProfileChain | readonly never[], readFile: ReadFile): Promise<ResolvedProfile[]>;
124
+ /**
125
+ * Resolve federated parent registries (and the fallback, when not already
126
+ * listed). Each URL's `<url>/manifest` is fetched; the body is parsed
127
+ * loosely for `markspec-schema` (defaults to 1 on parse failure).
128
+ */
129
+ export declare function resolveRegistries(config: ProjectConfig, fetchUrl: FetchUrl): Promise<ResolvedRegistry[]>;
130
+ /**
131
+ * Resolve every entry carrying `External-id:` attributes into a
132
+ * `ResolvedBoundEntry`. For each External-id, look up the mapping by
133
+ * scheme prefix, compute the locked-attribute set, and snapshot each
134
+ * local value as `sha256:*` of UTF-8 bytes.
135
+ *
136
+ * Unknown scheme → MSL-S021 error, that binding skipped. Entries with
137
+ * zero External-id attributes are silently dropped (no upstream lock
138
+ * needed). Multi-value attributes are joined with `\n` before hashing
139
+ * so a single locked-attribute hash captures the full attribute state.
140
+ */
141
+ export declare function resolveBoundEntries(entries: readonly Entry[], mappings: readonly Mapping[]): Promise<ResolvedBoundEntry[]>;
142
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/lock/resolve.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,397 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock/resolve
4
+ *
5
+ * Shared upstream-resolution layer. Both `markspec lock` and
6
+ * `markspec compile` call {@linkcode resolveUpstreams}. All
7
+ * world-touching operations (HTTP fetch, clock) flow through
8
+ * callbacks so unit tests inject deterministic stubs.
9
+ *
10
+ * Implementation arrives in Tasks 15–18; this file ships the type
11
+ * surface and a stub.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.resolveReferences = resolveReferences;
15
+ exports.extractEdgeQuads = extractEdgeQuads;
16
+ exports.resolveUpstreams = resolveUpstreams;
17
+ exports.resolveProfileChain = resolveProfileChain;
18
+ exports.resolveRegistries = resolveRegistries;
19
+ exports.resolveBoundEntries = resolveBoundEntries;
20
+ const locked_attributes_js_1 = require("../sync/locked_attributes.js");
21
+ const hash_js_1 = require("./hash.js");
22
+ const canonical_edges_js_1 = require("./canonical_edges.js");
23
+ // ---------------------------------------------------------------------------
24
+ // Reference resolution (Task 15)
25
+ // ---------------------------------------------------------------------------
26
+ /**
27
+ * Extract the "resolved version" segment from a Reference's URI.
28
+ *
29
+ * Heuristics covering the URI schemes the lock CLI is expected to see:
30
+ * - `urn:iso:std:iso:26262:-6:ed-2` → `ed-2` (last `:`-segment)
31
+ * - `pkg:cargo/serde@1.0.0` → `1.0.0` (everything after the last `@`)
32
+ * - `doi:…`, `isbn:…`, plain `https://…` → undefined
33
+ */
34
+ function extractResolvedVersion(uri) {
35
+ const urnMatch = uri.match(/^urn:[^:]+(?:::|:)([^:]+)$/);
36
+ if (urnMatch)
37
+ return urnMatch[1];
38
+ const pkgMatch = uri.match(/@([^?]+)$/);
39
+ if (pkgMatch)
40
+ return pkgMatch[1];
41
+ return undefined;
42
+ }
43
+ /** First raw-attribute value matching `key`, or undefined. */
44
+ function attrValue(entry, key) {
45
+ for (const a of entry.rawAttributes) {
46
+ if (a.key === key)
47
+ return a.value;
48
+ }
49
+ return undefined;
50
+ }
51
+ /**
52
+ * Resolve every Reference entry to an upstream record. Deduplicates by
53
+ * display ID (first occurrence wins). When `Reference-url:` is set, the
54
+ * bytes are fetched and `sha256:*`-hashed; otherwise an MSL-L010 info
55
+ * diagnostic is attached and the upstream is identity-only. Fetch
56
+ * failures attach MSL-L101 and degrade to identity-only.
57
+ */
58
+ async function resolveReferences(entries, fetchUrl) {
59
+ const out = [];
60
+ const seenSlugs = new Set();
61
+ for (const entry of entries) {
62
+ if (entry.shape !== "Reference")
63
+ continue;
64
+ if (seenSlugs.has(entry.displayId))
65
+ continue;
66
+ seenSlugs.add(entry.displayId);
67
+ const id = entry.id;
68
+ if (id === undefined)
69
+ continue;
70
+ const refUrl = attrValue(entry, "Reference-url");
71
+ const diagnostics = [];
72
+ let hash;
73
+ let source;
74
+ if (refUrl === undefined) {
75
+ diagnostics.push({
76
+ code: "MSL-L010",
77
+ severity: "info",
78
+ message: `Reference '${entry.displayId}' has no Reference-url:; identity-only lock (no hash, no drift detection).`,
79
+ location: entry.location,
80
+ });
81
+ }
82
+ else {
83
+ const fetched = await fetchUrl(refUrl);
84
+ if (fetched instanceof Uint8Array) {
85
+ hash = await (0, hash_js_1.sha256Bytes)(fetched);
86
+ source = refUrl;
87
+ }
88
+ else {
89
+ diagnostics.push({
90
+ code: "MSL-L101",
91
+ severity: "warning",
92
+ message: `Failed to fetch Reference-url for '${entry.displayId}' (${refUrl}): ${fetched.error}. Recording identity-only.`,
93
+ location: entry.location,
94
+ });
95
+ }
96
+ }
97
+ out.push({
98
+ upstream: {
99
+ kind: "reference",
100
+ slug: entry.displayId,
101
+ id,
102
+ resolved: extractResolvedVersion(id),
103
+ hash,
104
+ source,
105
+ },
106
+ diagnostics,
107
+ });
108
+ }
109
+ return out;
110
+ }
111
+ // ---------------------------------------------------------------------------
112
+ // Full upstream resolution (Tasks 16–18)
113
+ // ---------------------------------------------------------------------------
114
+ /**
115
+ * Project an entry list to canonical edge quads. Walks the eleven core
116
+ * trace-link attributes (Satisfies, Derived-from, Verified-by, …) and
117
+ * emits one quad per resolved target ID, splitting CSV values on `,`
118
+ * or whitespace. Every quad is provenance `"local"` — externally
119
+ * sourced edges are folded in later (post-MVP).
120
+ */
121
+ function extractEdgeQuads(entries) {
122
+ const TRACE_KEYS = [
123
+ "Satisfies",
124
+ "Derived-from",
125
+ "Verified-by",
126
+ "References",
127
+ "Tests",
128
+ "Depends-on",
129
+ "Part-of",
130
+ "Allocated-to",
131
+ "Realizes",
132
+ "Generated-from",
133
+ "Supersedes",
134
+ ];
135
+ const out = [];
136
+ for (const entry of entries) {
137
+ for (const a of entry.rawAttributes) {
138
+ if (!TRACE_KEYS.includes(a.key))
139
+ continue;
140
+ const targets = a.value.split(/[\s,]+/).filter((t) => t.length > 0);
141
+ for (const target of targets) {
142
+ out.push({
143
+ source: entry.displayId,
144
+ relation: a.key,
145
+ target,
146
+ provenance: "local",
147
+ });
148
+ }
149
+ }
150
+ }
151
+ return out;
152
+ }
153
+ /**
154
+ * Resolve every upstream the lockfile needs: References, profile chain
155
+ * tiers, federated registries, and bound entries. Computes the
156
+ * canonical edge hash from the same entry set. Returns the aggregate
157
+ * `ResolvedUpstreams` payload ready for {@link serializeLockfile}.
158
+ *
159
+ * The four sub-resolvers run sequentially (not concurrently) because
160
+ * (a) the callbacks they share — `fetchUrl`, `readFile` — may themselves
161
+ * serialize work, and (b) the diagnostics output is easier to reason
162
+ * about with a deterministic order. Wrap inside `Promise.all` only when
163
+ * profiling shows a clear win.
164
+ */
165
+ async function resolveUpstreams(opts) {
166
+ const now = (opts.now ?? (() => new Date()))();
167
+ const lockedAt = now.toISOString();
168
+ const refResults = await resolveReferences(opts.entries, opts.fetchUrl);
169
+ const profResults = await resolveProfileChain(opts.profileChain, opts.readFile);
170
+ const regResults = await resolveRegistries(opts.config, opts.fetchUrl);
171
+ const boundResults = await resolveBoundEntries(opts.entries, opts.mappings);
172
+ const edges = extractEdgeQuads(opts.entries);
173
+ const canonicalEdgeHash = await (0, canonical_edges_js_1.hashCanonicalEdges)(edges);
174
+ const diagnostics = [
175
+ ...refResults.flatMap((r) => r.diagnostics),
176
+ ...profResults.flatMap((r) => r.diagnostics),
177
+ ...regResults.flatMap((r) => r.diagnostics),
178
+ ...boundResults.flatMap((r) => r.diagnostics),
179
+ ];
180
+ return {
181
+ references: refResults,
182
+ profiles: profResults,
183
+ registries: regResults,
184
+ boundEntries: boundResults,
185
+ canonicalEdgeHash,
186
+ canonicalEdgeCount: edges.length,
187
+ lockedAt,
188
+ diagnostics,
189
+ };
190
+ }
191
+ // ---------------------------------------------------------------------------
192
+ // Profile chain resolution (Task 16)
193
+ // ---------------------------------------------------------------------------
194
+ /**
195
+ * Format a `ProfileSpecifier` into the lockfile-canonical specifier string.
196
+ *
197
+ * Strings are stable across runs so the lockfile diff captures only meaningful
198
+ * changes:
199
+ * - `builtin` — bundled default
200
+ * - `local:<path>` — on-disk profile
201
+ * - `git:<repo>#<tag>` or `git:<repo>//<subpath>#<tag>`
202
+ * - `npm:<scope?><name>@<range>`
203
+ */
204
+ function formatSpecifier(spec) {
205
+ switch (spec.kind) {
206
+ case "builtin":
207
+ return "builtin";
208
+ case "local":
209
+ return `local:${spec.path}`;
210
+ case "git":
211
+ return spec.subpath !== undefined
212
+ ? `git:${spec.repo}//${spec.subpath}#${spec.tag}`
213
+ : `git:${spec.repo}#${spec.tag}`;
214
+ case "npm": {
215
+ const name = spec.scope !== undefined
216
+ ? `${spec.scope}/${spec.name}`
217
+ : spec.name;
218
+ return `npm:${name}@${spec.range}`;
219
+ }
220
+ }
221
+ }
222
+ /**
223
+ * Resolve every profile chain tier into an upstream record. Each tier's
224
+ * `markspec.yaml` is read from `tier.sourcePath` via `readFile` and
225
+ * `sha256:*`-hashed; a read failure attaches MSL-L102 and degrades the
226
+ * tier's hash to `sha256:0` (identity-only).
227
+ *
228
+ * The `extends` chain is reconstructed from list order: tiers are
229
+ * already root-parent → leaf-child, so each tier's `extends` points to
230
+ * the previous tier's id. The root tier has `extends: undefined`.
231
+ */
232
+ async function resolveProfileChain(chain, readFile) {
233
+ if (Array.isArray(chain))
234
+ return [];
235
+ const realChain = chain;
236
+ const out = [];
237
+ let parentId = undefined;
238
+ for (const tier of realChain.tiers) {
239
+ const diagnostics = [];
240
+ let hash = "sha256:0";
241
+ const fetched = await readFile(tier.sourcePath);
242
+ if (fetched instanceof Uint8Array) {
243
+ hash = await (0, hash_js_1.sha256Bytes)(fetched);
244
+ }
245
+ else {
246
+ diagnostics.push({
247
+ code: "MSL-L102",
248
+ severity: "warning",
249
+ message: `Failed to read profile manifest at ${tier.sourcePath}: ${fetched.error}. Recording identity-only hash.`,
250
+ location: undefined,
251
+ });
252
+ }
253
+ out.push({
254
+ upstream: {
255
+ kind: "profile",
256
+ id: tier.id,
257
+ specifier: formatSpecifier(tier.specifier),
258
+ resolved: tier.version,
259
+ hash,
260
+ extends: parentId,
261
+ },
262
+ diagnostics,
263
+ });
264
+ parentId = tier.id;
265
+ }
266
+ return out;
267
+ }
268
+ // ---------------------------------------------------------------------------
269
+ // Registry resolution (Task 16)
270
+ // ---------------------------------------------------------------------------
271
+ /**
272
+ * Resolve federated parent registries (and the fallback, when not already
273
+ * listed). Each URL's `<url>/manifest` is fetched; the body is parsed
274
+ * loosely for `markspec-schema` (defaults to 1 on parse failure).
275
+ */
276
+ async function resolveRegistries(config, fetchUrl) {
277
+ const urls = [...config.parents];
278
+ if (config.parentFallback && !urls.includes(config.parentFallback)) {
279
+ urls.push(config.parentFallback);
280
+ }
281
+ const out = [];
282
+ for (const url of urls) {
283
+ const manifestUrl = url.endsWith("/")
284
+ ? `${url}manifest`
285
+ : `${url}/manifest`;
286
+ const fetched = await fetchUrl(manifestUrl);
287
+ if (fetched instanceof Uint8Array) {
288
+ const hash = await (0, hash_js_1.sha256Bytes)(fetched);
289
+ let markspecSchema = 1;
290
+ try {
291
+ const parsed = JSON.parse(new TextDecoder().decode(fetched));
292
+ if (typeof parsed["markspec-schema"] === "number") {
293
+ markspecSchema = parsed["markspec-schema"];
294
+ }
295
+ }
296
+ catch { /* leave default */ }
297
+ out.push({
298
+ upstream: {
299
+ kind: "registry",
300
+ id: `urn:markspec:registry:${url}`,
301
+ api: url,
302
+ resolvedManifestHash: hash,
303
+ markspecSchema,
304
+ },
305
+ diagnostics: [],
306
+ });
307
+ }
308
+ else {
309
+ out.push({
310
+ upstream: {
311
+ kind: "registry",
312
+ id: `urn:markspec:registry:${url}`,
313
+ api: url,
314
+ resolvedManifestHash: "sha256:0",
315
+ markspecSchema: 1,
316
+ },
317
+ diagnostics: [{
318
+ code: "MSL-L101",
319
+ severity: "warning",
320
+ message: `Failed to fetch registry manifest from ${manifestUrl}: ${fetched.error}`,
321
+ location: undefined,
322
+ }],
323
+ });
324
+ }
325
+ }
326
+ return out;
327
+ }
328
+ // ---------------------------------------------------------------------------
329
+ // Bound-entry resolution (Task 17)
330
+ // ---------------------------------------------------------------------------
331
+ /**
332
+ * Resolve every entry carrying `External-id:` attributes into a
333
+ * `ResolvedBoundEntry`. For each External-id, look up the mapping by
334
+ * scheme prefix, compute the locked-attribute set, and snapshot each
335
+ * local value as `sha256:*` of UTF-8 bytes.
336
+ *
337
+ * Unknown scheme → MSL-S021 error, that binding skipped. Entries with
338
+ * zero External-id attributes are silently dropped (no upstream lock
339
+ * needed). Multi-value attributes are joined with `\n` before hashing
340
+ * so a single locked-attribute hash captures the full attribute state.
341
+ */
342
+ async function resolveBoundEntries(entries, mappings) {
343
+ const mappingBySystem = new Map();
344
+ for (const m of mappings)
345
+ mappingBySystem.set(m.system, m);
346
+ const out = [];
347
+ for (const entry of entries) {
348
+ const externalIds = [];
349
+ for (const a of entry.rawAttributes) {
350
+ if (a.key === "External-id")
351
+ externalIds.push(a.value);
352
+ }
353
+ if (externalIds.length === 0)
354
+ continue;
355
+ const diagnostics = [];
356
+ const bindings = [];
357
+ for (const eid of externalIds) {
358
+ const colonIdx = eid.indexOf(":");
359
+ const scheme = colonIdx >= 0 ? eid.slice(0, colonIdx) : eid;
360
+ const mapping = mappingBySystem.get(scheme);
361
+ if (!mapping) {
362
+ diagnostics.push({
363
+ code: "MSL-S021",
364
+ severity: "error",
365
+ message: `External-id scheme '${scheme}' on entry '${entry.displayId}' has no matching mapping.yaml.`,
366
+ location: entry.location,
367
+ });
368
+ continue;
369
+ }
370
+ const lockedAttrNames = (0, locked_attributes_js_1.inferLockedAttributes)(mapping);
371
+ const lockedAttributes = new Map();
372
+ for (const attrName of lockedAttrNames) {
373
+ const value = entry.rawAttributes
374
+ .filter((a) => a.key === attrName)
375
+ .map((a) => a.value)
376
+ .join("\n");
377
+ const hash = await (0, hash_js_1.sha256Bytes)(new TextEncoder().encode(value));
378
+ lockedAttributes.set(attrName, hash);
379
+ }
380
+ bindings.push({
381
+ externalId: eid,
382
+ system: scheme,
383
+ direction: mapping.direction,
384
+ lockedAttributes,
385
+ });
386
+ }
387
+ out.push({
388
+ boundEntry: {
389
+ displayId: entry.displayId,
390
+ ulid: entry.id ?? "",
391
+ bindings,
392
+ },
393
+ diagnostics,
394
+ });
395
+ }
396
+ return out;
397
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @module core/lock/serializer
3
+ *
4
+ * Deterministic TOML emitter for the Lockfile model. Tables and keys in
5
+ * fixed order; arrays sorted by primary key; identical input → byte-
6
+ * identical output. We hand-roll the emitter rather than using
7
+ * @std/toml/stringify because we need (a) generated-file header
8
+ * comment, (b) precise control over nested array-of-tables emission
9
+ * order, (c) guaranteed key sort.
10
+ */
11
+ import type { Lockfile } from "./model.js";
12
+ /** Emit a deterministic TOML representation of a Lockfile. */
13
+ export declare function serializeLockfile(lf: Lockfile): string;
14
+ //# sourceMappingURL=serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/lock/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,QAAQ,EAIT,MAAM,YAAY,CAAC;AAMpB,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAwFtD"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock/serializer
4
+ *
5
+ * Deterministic TOML emitter for the Lockfile model. Tables and keys in
6
+ * fixed order; arrays sorted by primary key; identical input → byte-
7
+ * identical output. We hand-roll the emitter rather than using
8
+ * @std/toml/stringify because we need (a) generated-file header
9
+ * comment, (b) precise control over nested array-of-tables emission
10
+ * order, (c) guaranteed key sort.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.serializeLockfile = serializeLockfile;
14
+ const HEADER = "# @generated by `markspec lock` — do not hand-edit. Run `markspec lock`.\n" +
15
+ "# See https://markspec.dev/lock for the format.\n";
16
+ /** Emit a deterministic TOML representation of a Lockfile. */
17
+ function serializeLockfile(lf) {
18
+ const parts = [HEADER];
19
+ parts.push(`schema = ${lf.schema}\n\n`);
20
+ parts.push("[meta]\n");
21
+ parts.push(`markspec-schema = ${lf.meta.markspecSchema}\n`);
22
+ parts.push(`locked-at = ${tomlString(lf.meta.lockedAt)}\n`);
23
+ const refs = lf.upstreams
24
+ .filter((u) => u.kind === "reference")
25
+ .slice()
26
+ .sort((a, b) => a.slug.localeCompare(b.slug));
27
+ for (const r of refs) {
28
+ parts.push("\n[[upstream.reference]]\n");
29
+ parts.push(`slug = ${tomlString(r.slug)}\n`);
30
+ parts.push(`id = ${tomlString(r.id)}\n`);
31
+ if (r.resolved !== undefined) {
32
+ parts.push(`resolved = ${tomlString(r.resolved)}\n`);
33
+ }
34
+ if (r.hash !== undefined)
35
+ parts.push(`hash = ${tomlString(r.hash)}\n`);
36
+ if (r.source !== undefined) {
37
+ parts.push(`source = ${tomlString(r.source)}\n`);
38
+ }
39
+ if (r.componentScheme !== undefined) {
40
+ parts.push(`component-scheme = ${tomlString(r.componentScheme)}\n`);
41
+ }
42
+ }
43
+ const profs = lf.upstreams
44
+ .filter((u) => u.kind === "profile")
45
+ .slice()
46
+ .sort((a, b) => a.id.localeCompare(b.id));
47
+ for (const p of profs) {
48
+ parts.push("\n[[upstream.profile]]\n");
49
+ parts.push(`id = ${tomlString(p.id)}\n`);
50
+ parts.push(`specifier = ${tomlString(p.specifier)}\n`);
51
+ parts.push(`resolved = ${tomlString(p.resolved)}\n`);
52
+ parts.push(`hash = ${tomlString(p.hash)}\n`);
53
+ if (p.extends !== undefined) {
54
+ parts.push(`extends = ${tomlString(p.extends)}\n`);
55
+ }
56
+ }
57
+ const regs = lf.upstreams
58
+ .filter((u) => u.kind === "registry")
59
+ .slice()
60
+ .sort((a, b) => a.id.localeCompare(b.id));
61
+ for (const r of regs) {
62
+ parts.push("\n[[upstream.registry]]\n");
63
+ parts.push(`id = ${tomlString(r.id)}\n`);
64
+ parts.push(`api = ${tomlString(r.api)}\n`);
65
+ parts.push(`resolved-manifest-hash = ${tomlString(r.resolvedManifestHash)}\n`);
66
+ parts.push(`markspec-schema = ${r.markspecSchema}\n`);
67
+ }
68
+ const bounds = lf.boundEntries.slice().sort((a, b) => a.displayId.localeCompare(b.displayId));
69
+ for (const be of bounds) {
70
+ parts.push("\n[[bound-entry]]\n");
71
+ parts.push(`display-id = ${tomlString(be.displayId)}\n`);
72
+ parts.push(`ulid = ${tomlString(be.ulid)}\n`);
73
+ const bindings = be.bindings.slice().sort((a, b) => a.system.localeCompare(b.system));
74
+ for (const b of bindings) {
75
+ parts.push("\n[[bound-entry.binding]]\n");
76
+ parts.push(`external-id = ${tomlString(b.externalId)}\n`);
77
+ parts.push(`system = ${tomlString(b.system)}\n`);
78
+ parts.push(`direction = ${tomlString(b.direction)}\n`);
79
+ if (b.lockedAttributes.size > 0) {
80
+ parts.push("\n[bound-entry.binding.locked-attributes]\n");
81
+ const sortedAttrs = [...b.lockedAttributes.entries()]
82
+ .sort(([k1], [k2]) => k1.localeCompare(k2));
83
+ for (const [k, v] of sortedAttrs) {
84
+ parts.push(`${k} = ${tomlString(v)}\n`);
85
+ }
86
+ }
87
+ }
88
+ }
89
+ parts.push("\n[generated-cache]\n");
90
+ parts.push(`edges-hash = ${tomlString(lf.generatedCache.edgesHash)}\n`);
91
+ parts.push(`edges-count = ${lf.generatedCache.edgesCount}\n`);
92
+ return parts.join("");
93
+ }
94
+ /**
95
+ * Emit a TOML basic string. Backslash and double-quote escaped; the three
96
+ * common whitespace control characters (`\n`, `\r`, `\t`) are escaped so
97
+ * that opaque external-system inputs (e.g. an `externalId` containing a
98
+ * newline) cannot produce invalid TOML.
99
+ */
100
+ function tomlString(s) {
101
+ return `"${s
102
+ .replace(/\\/g, "\\\\")
103
+ .replace(/"/g, '\\"')
104
+ .replace(/\n/g, "\\n")
105
+ .replace(/\r/g, "\\r")
106
+ .replace(/\t/g, "\\t")}"`;
107
+ }