@driftsys/markspec 0.12.0 → 0.13.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 (317) hide show
  1. package/esm/ast/build.d.ts.map +1 -1
  2. package/esm/ast/build.js +19 -5
  3. package/esm/ast/equivalence.js +14 -2
  4. package/esm/ast/nodes.d.ts +15 -3
  5. package/esm/ast/nodes.d.ts.map +1 -1
  6. package/esm/compiler/inverses.d.ts.map +1 -1
  7. package/esm/compiler/inverses.js +18 -3
  8. package/esm/compiler/mod.d.ts +34 -1
  9. package/esm/compiler/mod.d.ts.map +1 -1
  10. package/esm/compiler/mod.js +112 -48
  11. package/esm/compiler/schema.d.ts +3 -2
  12. package/esm/compiler/schema.d.ts.map +1 -1
  13. package/esm/compiler/schema.js +6 -3
  14. package/esm/config/markspec.d.ts +2 -2
  15. package/esm/config/mod.d.ts.map +1 -1
  16. package/esm/config/mod.js +47 -5
  17. package/esm/criteria/scenarios.d.ts +55 -0
  18. package/esm/criteria/scenarios.d.ts.map +1 -0
  19. package/esm/criteria/scenarios.js +133 -0
  20. package/esm/discovery/mod.d.ts +20 -1
  21. package/esm/discovery/mod.d.ts.map +1 -1
  22. package/esm/discovery/mod.js +105 -17
  23. package/esm/discovery/projects.d.ts +6 -4
  24. package/esm/discovery/projects.d.ts.map +1 -1
  25. package/esm/discovery/projects.js +27 -17
  26. package/esm/formatter/entry_body.d.ts +13 -12
  27. package/esm/formatter/entry_body.d.ts.map +1 -1
  28. package/esm/formatter/entry_body.js +25 -17
  29. package/esm/formatter/feature_file.d.ts +40 -0
  30. package/esm/formatter/feature_file.d.ts.map +1 -0
  31. package/esm/formatter/feature_file.js +88 -0
  32. package/esm/formatter/md_equiv.d.ts +6 -5
  33. package/esm/formatter/md_equiv.d.ts.map +1 -1
  34. package/esm/formatter/md_equiv.js +6 -5
  35. package/esm/formatter/mod.d.ts +25 -3
  36. package/esm/formatter/mod.d.ts.map +1 -1
  37. package/esm/formatter/mod.js +267 -27
  38. package/esm/formatter/tab_markers.d.ts +15 -0
  39. package/esm/formatter/tab_markers.d.ts.map +1 -0
  40. package/esm/formatter/tab_markers.js +133 -0
  41. package/esm/gates/mod.d.ts +2 -2
  42. package/esm/gates/mod.d.ts.map +1 -1
  43. package/esm/gates/mod.js +18 -3
  44. package/esm/gherkin/load.d.ts +35 -0
  45. package/esm/gherkin/load.d.ts.map +1 -0
  46. package/esm/gherkin/load.js +39 -0
  47. package/esm/gherkin/parse.d.ts +11 -0
  48. package/esm/gherkin/parse.d.ts.map +1 -0
  49. package/esm/gherkin/parse.js +311 -0
  50. package/esm/gherkin/position.d.ts +23 -0
  51. package/esm/gherkin/position.d.ts.map +1 -0
  52. package/esm/gherkin/position.js +21 -0
  53. package/esm/gherkin/procedure.d.ts +76 -0
  54. package/esm/gherkin/procedure.d.ts.map +1 -0
  55. package/esm/gherkin/procedure.js +164 -0
  56. package/esm/gherkin/project.d.ts +35 -0
  57. package/esm/gherkin/project.d.ts.map +1 -0
  58. package/esm/gherkin/project.js +64 -0
  59. package/esm/gherkin/role.d.ts +23 -0
  60. package/esm/gherkin/role.d.ts.map +1 -0
  61. package/esm/gherkin/role.js +28 -0
  62. package/esm/gherkin/types.d.ts +118 -0
  63. package/esm/gherkin/types.d.ts.map +1 -0
  64. package/esm/gherkin/types.js +12 -0
  65. package/esm/lock/acquire_compile.d.ts +12 -4
  66. package/esm/lock/acquire_compile.d.ts.map +1 -1
  67. package/esm/lock/acquire_compile.js +15 -5
  68. package/esm/lock/canonical_edges.d.ts +6 -2
  69. package/esm/lock/canonical_edges.d.ts.map +1 -1
  70. package/esm/lock/canonical_edges.js +10 -3
  71. package/esm/lock/model.d.ts +5 -0
  72. package/esm/lock/model.d.ts.map +1 -1
  73. package/esm/lock/parser.d.ts.map +1 -1
  74. package/esm/lock/parser.js +2 -0
  75. package/esm/lock/resolve.d.ts +6 -2
  76. package/esm/lock/resolve.d.ts.map +1 -1
  77. package/esm/lock/resolve.js +36 -4
  78. package/esm/lock/serializer.d.ts.map +1 -1
  79. package/esm/lock/serializer.js +7 -1
  80. package/esm/lock/upstream_deps.js +1 -1
  81. package/esm/mod.d.ts +24 -6
  82. package/esm/mod.d.ts.map +1 -1
  83. package/esm/mod.js +19 -5
  84. package/esm/model/mod.d.ts +43 -2
  85. package/esm/model/mod.d.ts.map +1 -1
  86. package/esm/model/mod.js +1 -1
  87. package/esm/model/relations.d.ts +9 -0
  88. package/esm/model/relations.d.ts.map +1 -1
  89. package/esm/model/relations.js +16 -1
  90. package/esm/parser/attributes.d.ts +82 -3
  91. package/esm/parser/attributes.d.ts.map +1 -1
  92. package/esm/parser/attributes.js +199 -32
  93. package/esm/parser/body_tokens.d.ts +1 -1
  94. package/esm/parser/body_tokens.d.ts.map +1 -1
  95. package/esm/parser/body_tokens.js +49 -35
  96. package/esm/parser/feature_file.d.ts +116 -0
  97. package/esm/parser/feature_file.d.ts.map +1 -0
  98. package/esm/parser/feature_file.js +540 -0
  99. package/esm/parser/markdown.d.ts +7 -0
  100. package/esm/parser/markdown.d.ts.map +1 -1
  101. package/esm/parser/markdown.js +129 -40
  102. package/esm/parser/mod.d.ts +18 -0
  103. package/esm/parser/mod.d.ts.map +1 -1
  104. package/esm/parser/mod.js +51 -0
  105. package/esm/parser/translate.d.ts.map +1 -1
  106. package/esm/parser/translate.js +5 -0
  107. package/esm/refs/mod.d.ts +8 -3
  108. package/esm/refs/mod.d.ts.map +1 -1
  109. package/esm/refs/mod.js +20 -7
  110. package/esm/refs/split.d.ts +58 -0
  111. package/esm/refs/split.d.ts.map +1 -0
  112. package/esm/refs/split.js +137 -0
  113. package/esm/reporter/mod.d.ts +7 -0
  114. package/esm/reporter/mod.d.ts.map +1 -1
  115. package/esm/reporter/mod.js +113 -3
  116. package/esm/sync/mapping.d.ts +4 -3
  117. package/esm/sync/mapping.d.ts.map +1 -1
  118. package/esm/sync/mapping.js +52 -9
  119. package/esm/util/display_id.d.ts +20 -0
  120. package/esm/util/display_id.d.ts.map +1 -0
  121. package/esm/util/display_id.js +19 -0
  122. package/esm/validator/attributes.d.ts.map +1 -1
  123. package/esm/validator/attributes.js +4 -1
  124. package/esm/validator/block_role.d.ts +40 -0
  125. package/esm/validator/block_role.d.ts.map +1 -0
  126. package/esm/validator/block_role.js +109 -0
  127. package/esm/validator/feature_ac.d.ts.map +1 -1
  128. package/esm/validator/feature_ac.js +6 -1
  129. package/esm/validator/feature_parse.d.ts +35 -0
  130. package/esm/validator/feature_parse.d.ts.map +1 -0
  131. package/esm/validator/feature_parse.js +69 -0
  132. package/esm/validator/locators.d.ts +36 -0
  133. package/esm/validator/locators.d.ts.map +1 -0
  134. package/esm/validator/locators.js +184 -0
  135. package/esm/validator/mod.d.ts +10 -1
  136. package/esm/validator/mod.d.ts.map +1 -1
  137. package/esm/validator/mod.js +38 -14
  138. package/esm/validator/normalize.d.ts.map +1 -1
  139. package/esm/validator/normalize.js +8 -3
  140. package/esm/validator/per_type_attrs.d.ts +3 -3
  141. package/esm/validator/per_type_attrs.js +3 -3
  142. package/esm/validator/pipeline.d.ts +10 -16
  143. package/esm/validator/pipeline.d.ts.map +1 -1
  144. package/esm/validator/pipeline.js +37 -16
  145. package/esm/validator/procedure.d.ts +22 -0
  146. package/esm/validator/procedure.d.ts.map +1 -0
  147. package/esm/validator/procedure.js +58 -0
  148. package/esm/validator/trace_types.d.ts.map +1 -1
  149. package/esm/validator/trace_types.js +4 -3
  150. package/esm/validator/traceability.d.ts.map +1 -1
  151. package/esm/validator/traceability.js +4 -1
  152. package/esm/validator/type_resolution.d.ts +5 -3
  153. package/esm/validator/type_resolution.d.ts.map +1 -1
  154. package/esm/validator/type_resolution.js +14 -2
  155. package/esm/validator/types.d.ts +11 -0
  156. package/esm/validator/types.d.ts.map +1 -1
  157. package/esm/validator/types.js +26 -4
  158. package/esm/validator/uxil_family.d.ts +1 -1
  159. package/package.json +3 -1
  160. package/script/ast/build.d.ts.map +1 -1
  161. package/script/ast/build.js +19 -5
  162. package/script/ast/equivalence.js +14 -2
  163. package/script/ast/nodes.d.ts +15 -3
  164. package/script/ast/nodes.d.ts.map +1 -1
  165. package/script/compiler/inverses.d.ts.map +1 -1
  166. package/script/compiler/inverses.js +18 -3
  167. package/script/compiler/mod.d.ts +34 -1
  168. package/script/compiler/mod.d.ts.map +1 -1
  169. package/script/compiler/mod.js +110 -46
  170. package/script/compiler/schema.d.ts +3 -2
  171. package/script/compiler/schema.d.ts.map +1 -1
  172. package/script/compiler/schema.js +6 -3
  173. package/script/config/markspec.d.ts +2 -2
  174. package/script/config/mod.d.ts.map +1 -1
  175. package/script/config/mod.js +47 -5
  176. package/script/criteria/scenarios.d.ts +55 -0
  177. package/script/criteria/scenarios.d.ts.map +1 -0
  178. package/script/criteria/scenarios.js +139 -0
  179. package/script/discovery/mod.d.ts +20 -1
  180. package/script/discovery/mod.d.ts.map +1 -1
  181. package/script/discovery/mod.js +106 -17
  182. package/script/discovery/projects.d.ts +6 -4
  183. package/script/discovery/projects.d.ts.map +1 -1
  184. package/script/discovery/projects.js +27 -17
  185. package/script/formatter/entry_body.d.ts +13 -12
  186. package/script/formatter/entry_body.d.ts.map +1 -1
  187. package/script/formatter/entry_body.js +25 -17
  188. package/script/formatter/feature_file.d.ts +40 -0
  189. package/script/formatter/feature_file.d.ts.map +1 -0
  190. package/script/formatter/feature_file.js +92 -0
  191. package/script/formatter/md_equiv.d.ts +6 -5
  192. package/script/formatter/md_equiv.d.ts.map +1 -1
  193. package/script/formatter/md_equiv.js +6 -5
  194. package/script/formatter/mod.d.ts +25 -3
  195. package/script/formatter/mod.d.ts.map +1 -1
  196. package/script/formatter/mod.js +266 -26
  197. package/script/formatter/tab_markers.d.ts +15 -0
  198. package/script/formatter/tab_markers.d.ts.map +1 -0
  199. package/script/formatter/tab_markers.js +141 -0
  200. package/script/gates/mod.d.ts +2 -2
  201. package/script/gates/mod.d.ts.map +1 -1
  202. package/script/gates/mod.js +18 -3
  203. package/script/gherkin/load.d.ts +35 -0
  204. package/script/gherkin/load.d.ts.map +1 -0
  205. package/script/gherkin/load.js +76 -0
  206. package/script/gherkin/parse.d.ts +11 -0
  207. package/script/gherkin/parse.d.ts.map +1 -0
  208. package/script/gherkin/parse.js +314 -0
  209. package/script/gherkin/position.d.ts +23 -0
  210. package/script/gherkin/position.d.ts.map +1 -0
  211. package/script/gherkin/position.js +24 -0
  212. package/script/gherkin/procedure.d.ts +76 -0
  213. package/script/gherkin/procedure.d.ts.map +1 -0
  214. package/script/gherkin/procedure.js +169 -0
  215. package/script/gherkin/project.d.ts +35 -0
  216. package/script/gherkin/project.d.ts.map +1 -0
  217. package/script/gherkin/project.js +67 -0
  218. package/script/gherkin/role.d.ts +23 -0
  219. package/script/gherkin/role.d.ts.map +1 -0
  220. package/script/gherkin/role.js +31 -0
  221. package/script/gherkin/types.d.ts +118 -0
  222. package/script/gherkin/types.d.ts.map +1 -0
  223. package/script/gherkin/types.js +13 -0
  224. package/script/lock/acquire_compile.d.ts +12 -4
  225. package/script/lock/acquire_compile.d.ts.map +1 -1
  226. package/script/lock/acquire_compile.js +15 -5
  227. package/script/lock/canonical_edges.d.ts +6 -2
  228. package/script/lock/canonical_edges.d.ts.map +1 -1
  229. package/script/lock/canonical_edges.js +10 -3
  230. package/script/lock/model.d.ts +5 -0
  231. package/script/lock/model.d.ts.map +1 -1
  232. package/script/lock/parser.d.ts.map +1 -1
  233. package/script/lock/parser.js +2 -0
  234. package/script/lock/resolve.d.ts +6 -2
  235. package/script/lock/resolve.d.ts.map +1 -1
  236. package/script/lock/resolve.js +36 -4
  237. package/script/lock/serializer.d.ts.map +1 -1
  238. package/script/lock/serializer.js +7 -1
  239. package/script/lock/upstream_deps.js +1 -1
  240. package/script/mod.d.ts +24 -6
  241. package/script/mod.d.ts.map +1 -1
  242. package/script/mod.js +48 -6
  243. package/script/model/mod.d.ts +43 -2
  244. package/script/model/mod.d.ts.map +1 -1
  245. package/script/model/mod.js +2 -1
  246. package/script/model/relations.d.ts +9 -0
  247. package/script/model/relations.d.ts.map +1 -1
  248. package/script/model/relations.js +17 -1
  249. package/script/parser/attributes.d.ts +82 -3
  250. package/script/parser/attributes.d.ts.map +1 -1
  251. package/script/parser/attributes.js +205 -33
  252. package/script/parser/body_tokens.d.ts +1 -1
  253. package/script/parser/body_tokens.d.ts.map +1 -1
  254. package/script/parser/body_tokens.js +49 -35
  255. package/script/parser/feature_file.d.ts +116 -0
  256. package/script/parser/feature_file.d.ts.map +1 -0
  257. package/script/parser/feature_file.js +548 -0
  258. package/script/parser/markdown.d.ts +7 -0
  259. package/script/parser/markdown.d.ts.map +1 -1
  260. package/script/parser/markdown.js +128 -39
  261. package/script/parser/mod.d.ts +18 -0
  262. package/script/parser/mod.d.ts.map +1 -1
  263. package/script/parser/mod.js +52 -1
  264. package/script/parser/translate.d.ts.map +1 -1
  265. package/script/parser/translate.js +5 -0
  266. package/script/refs/mod.d.ts +8 -3
  267. package/script/refs/mod.d.ts.map +1 -1
  268. package/script/refs/mod.js +20 -7
  269. package/script/refs/split.d.ts +58 -0
  270. package/script/refs/split.d.ts.map +1 -0
  271. package/script/refs/split.js +145 -0
  272. package/script/reporter/mod.d.ts +7 -0
  273. package/script/reporter/mod.d.ts.map +1 -1
  274. package/script/reporter/mod.js +113 -3
  275. package/script/sync/mapping.d.ts +4 -3
  276. package/script/sync/mapping.d.ts.map +1 -1
  277. package/script/sync/mapping.js +52 -9
  278. package/script/util/display_id.d.ts +20 -0
  279. package/script/util/display_id.d.ts.map +1 -0
  280. package/script/util/display_id.js +22 -0
  281. package/script/validator/attributes.d.ts.map +1 -1
  282. package/script/validator/attributes.js +4 -1
  283. package/script/validator/block_role.d.ts +40 -0
  284. package/script/validator/block_role.d.ts.map +1 -0
  285. package/script/validator/block_role.js +112 -0
  286. package/script/validator/feature_ac.d.ts.map +1 -1
  287. package/script/validator/feature_ac.js +6 -1
  288. package/script/validator/feature_parse.d.ts +35 -0
  289. package/script/validator/feature_parse.d.ts.map +1 -0
  290. package/script/validator/feature_parse.js +73 -0
  291. package/script/validator/locators.d.ts +36 -0
  292. package/script/validator/locators.d.ts.map +1 -0
  293. package/script/validator/locators.js +188 -0
  294. package/script/validator/mod.d.ts +10 -1
  295. package/script/validator/mod.d.ts.map +1 -1
  296. package/script/validator/mod.js +38 -14
  297. package/script/validator/normalize.d.ts.map +1 -1
  298. package/script/validator/normalize.js +8 -3
  299. package/script/validator/per_type_attrs.d.ts +3 -3
  300. package/script/validator/per_type_attrs.js +3 -3
  301. package/script/validator/pipeline.d.ts +10 -16
  302. package/script/validator/pipeline.d.ts.map +1 -1
  303. package/script/validator/pipeline.js +36 -16
  304. package/script/validator/procedure.d.ts +22 -0
  305. package/script/validator/procedure.d.ts.map +1 -0
  306. package/script/validator/procedure.js +61 -0
  307. package/script/validator/trace_types.d.ts.map +1 -1
  308. package/script/validator/trace_types.js +4 -3
  309. package/script/validator/traceability.d.ts.map +1 -1
  310. package/script/validator/traceability.js +4 -1
  311. package/script/validator/type_resolution.d.ts +5 -3
  312. package/script/validator/type_resolution.d.ts.map +1 -1
  313. package/script/validator/type_resolution.js +14 -2
  314. package/script/validator/types.d.ts +11 -0
  315. package/script/validator/types.d.ts.map +1 -1
  316. package/script/validator/types.js +27 -4
  317. package/script/validator/uxil_family.d.ts +1 -1
@@ -14,6 +14,7 @@
14
14
  * see `core/parser/body_tokens.ts`. `InlineContent` now carries only
15
15
  * verbatim source text.
16
16
  */
17
+ import type { FeatureAst } from "../gherkin/types.js";
17
18
  /** Body-relative source span. 1-based line/column, matching the
18
19
  * codebase's {@link SourceLocation} convention. No `file`: that
19
20
  * lives on the owning {@link Entry}. */
@@ -113,12 +114,23 @@ export interface CodeNode {
113
114
  readonly text: string;
114
115
  readonly range: SourceRange;
115
116
  }
116
- /** Fenced code with info-string `gherkin` or `feature`. Content is kept verbatim
117
- * for now; structured scenario parsing is deferred to a later PR
118
- * (see the canonical-body-AST plan). */
117
+ /**
118
+ * Fenced code with info-string `gherkin` or `feature`. `source` is the
119
+ * authored text, kept verbatim. When the Gherkin parser is loaded, exactly
120
+ * one of `feature` (the normalized AST) and `parseError` is set; when it is
121
+ * not loaded, neither is set. Both are pure functions of `source`.
122
+ */
119
123
  export interface FeatureNode {
120
124
  readonly kind: "feature";
121
125
  readonly source: string;
126
+ /** Normalized AST of the block; ranges are relative to `source`. */
127
+ readonly feature?: FeatureAst;
128
+ /** First parser error; line 1 is the first line of `source`. */
129
+ readonly parseError?: {
130
+ readonly line: number;
131
+ readonly column: number;
132
+ readonly message: string;
133
+ };
122
134
  readonly range: SourceRange;
123
135
  }
124
136
  /** `$$ … $$` math block (spec §2.4). */
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/ast/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;wCAEwC;AACxC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAA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AC7B;AAED;qEACqE;AACrE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,gBAAgB,GAAG,MAAM,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED,uEAAuE;AACvE,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,QAAQ,GACR,SAAS,GACT,UAAU,GACV,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,kBAAkB,GAClB,QAAQ,GACR,cAAc,GACd,WAAW,GACX,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"inverses.d.ts","sourceRoot":"","sources":["../../src/compiler/inverses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,EAEL,IAAI,EACL,MAAM,iBAAiB,CAAC;AAGzB,oCAAoC;AACpC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GACxB,sBAAsB,CA4IxB"}
1
+ {"version":3,"file":"inverses.d.ts","sourceRoot":"","sources":["../../src/compiler/inverses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,EAEL,IAAI,EACL,MAAM,iBAAiB,CAAC;AAIzB,oCAAoC;AACpC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GACxB,sBAAsB,CAgKxB"}
@@ -9,6 +9,7 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.generateInverses = generateInverses;
11
11
  const constants_js_1 = require("./constants.js");
12
+ const split_js_1 = require("../refs/split.js");
12
13
  /**
13
14
  * Generate inverse (back-link) attributes from forward link declarations.
14
15
  *
@@ -35,6 +36,8 @@ function generateInverses(entries, profile) {
35
36
  // Step 3–5: Walk entries, accumulate back-links
36
37
  // Map: targetId → Map<inverseAttrName, Set<sourceId>>
37
38
  const generated = new Map();
39
+ /** Keys of the generated edges already emitted. */
40
+ const edgeKeys = new Set();
38
41
  // Parallel list of raw generated-edge data for Link emission.
39
42
  const generatedEdges = [];
40
43
  for (const source of entries) {
@@ -45,7 +48,13 @@ function generateInverses(entries, profile) {
45
48
  const forwardValues = source.typedAttributes.get(spec.attrName);
46
49
  if (!forwardValues)
47
50
  continue;
48
- for (const targetId of forwardValues) {
51
+ for (const forwardValue of forwardValues) {
52
+ // A value may carry a locator (`<ULID> [Scenario name]`); the
53
+ // target is the part before it and the locator is copied to the
54
+ // generated link.
55
+ const parsed = (0, split_js_1.parseTraceValue)(forwardValue);
56
+ const locator = parsed.locator;
57
+ const targetId = parsed.target;
49
58
  const target = byId.get(targetId);
50
59
  if (!target || target.type !== spec.inverse.category)
51
60
  continue;
@@ -59,13 +68,18 @@ function generateInverses(entries, profile) {
59
68
  idSet = new Set();
60
69
  targetMap.set(spec.inverse.name, idSet);
61
70
  }
62
- const wasNew = !idSet.has(source.id);
63
71
  idSet.add(source.id);
72
+ // One generated edge per (target, inverse, source, locator): two
73
+ // locators from one source keep two edges.
74
+ const edgeKey = `${targetId}\u0000${spec.inverse.name}\u0000${source.id}\u0000${locator === undefined ? "-" : `+${locator}`}`;
75
+ const wasNew = !edgeKeys.has(edgeKey);
76
+ edgeKeys.add(edgeKey);
64
77
  if (wasNew) {
65
78
  generatedEdges.push({
66
79
  targetUlid: targetId,
67
80
  sourceUlid: source.id,
68
81
  attrName: spec.attrName,
82
+ ...(locator !== undefined ? { locator } : {}),
69
83
  });
70
84
  }
71
85
  }
@@ -118,7 +132,7 @@ function generateInverses(entries, profile) {
118
132
  }
119
133
  // Resolve generated edges to displayId-based Link objects.
120
134
  const links = [];
121
- for (const { targetUlid, sourceUlid, attrName } of generatedEdges) {
135
+ for (const { targetUlid, sourceUlid, attrName, locator } of generatedEdges) {
122
136
  const kind = constants_js_1.ATTR_TO_LINK_KIND[attrName];
123
137
  if (!kind)
124
138
  continue;
@@ -132,6 +146,7 @@ function generateInverses(entries, profile) {
132
146
  kind,
133
147
  location: source.location,
134
148
  origin: "generated",
149
+ ...(locator !== undefined ? { locator } : {}),
135
150
  });
136
151
  }
137
152
  return { entries: result, links, diagnostics };
@@ -4,7 +4,7 @@
4
4
  * Compiler pipeline. Takes file paths, parses all entries, validates them,
5
5
  * builds a bidirectional traceability graph, and returns the compiled model.
6
6
  */
7
- import type { Diagnostic, DisplayId, Document, EffectiveProfile, Entry, Link } from "../model/mod.js";
7
+ import type { CaptionConventions, Diagnostic, DisplayId, Document, EffectiveProfile, Entry, Link } from "../model/mod.js";
8
8
  import { type TypeRegistry } from "../typl/mod.js";
9
9
  /** Options for {@linkcode compile}. */
10
10
  export interface CompileOptions {
@@ -50,6 +50,31 @@ export interface CompileOptions {
50
50
  * deterministically. Optional — absent means no corpus.
51
51
  */
52
52
  readonly corpusEntries?: readonly Entry[];
53
+ /**
54
+ * Caption-position conventions from `.markspec.yaml`
55
+ * (`ToolConfig.captionConventions`), passed to the validator pipeline
56
+ * for MSL-C072. Optional — absent means the rule is inactive.
57
+ */
58
+ readonly captionConventions?: CaptionConventions;
59
+ /**
60
+ * Upstream ids declared in `project.yaml` `dependencies:` and
61
+ * `references:` (derived with `deriveUpstreamId`). Passed to the
62
+ * validator pipeline so a trace target that stays unresolved is
63
+ * reported as MSL-T014 instead of MSL-L006. Optional — absent means
64
+ * MSL-L006 is unchanged.
65
+ */
66
+ readonly declaredUpstreamIds?: readonly string[];
67
+ /**
68
+ * Scope of the validator pipeline. Defaults to `true`: the compiled path
69
+ * set is the whole project, so MSL-L006 and MSL-T014 are reported. Pass
70
+ * `false` when the paths are one file or a subset (`insert <file>`,
71
+ * `doc build <file>`, `lint <file>`): a target in a file outside the set
72
+ * cannot be told from a typo, so the project-wide trace and DSL codes are
73
+ * suppressed, as in `check <file>` (ADR-027). `false` also suppresses the
74
+ * cross-entry DSL codes TYPL-009, TYPL-010, TYPL-011, UXIL-016, UXIL-017
75
+ * and UXIL-018 for the same reason.
76
+ */
77
+ readonly projectWide?: boolean;
53
78
  }
54
79
  /** Compiled project output with resolved traceability graph. */
55
80
  export interface CompileResult {
@@ -75,6 +100,14 @@ export interface CompileResult {
75
100
  * Compile MarkSpec files from the given paths into a resolved
76
101
  * traceability graph.
77
102
  *
103
+ * The returned diagnostics combine parse diagnostics, the validator
104
+ * pipeline's diagnostics, inverse-generation diagnostics and MSL-T013. The
105
+ * pipeline call is the same `runPipeline` call that bare `markspec check`
106
+ * and the LSP make, with project-wide scope by default
107
+ * (`options.projectWide`), so MSL-L006 and the other traceability rules are
108
+ * included. The diagnostics do not include fmt drift, lockfile drift or prose
109
+ * lint.
110
+ *
78
111
  * @param paths - File paths to compile
79
112
  * @param options - Compile options
80
113
  * @returns Compiled entries, links, and diagnostics
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/compiler/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAC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AAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClD,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AA4BD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,OAAO,CAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAyMxB;AAmID,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
@@ -9,9 +9,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.generateInverses = exports.serializeCompileResult = void 0;
10
10
  exports.compile = compile;
11
11
  const mod_js_1 = require("../model/mod.js");
12
+ const scenarios_js_1 = require("../criteria/scenarios.js");
13
+ const split_js_1 = require("../refs/split.js");
12
14
  const mod_js_2 = require("../parser/mod.js");
13
15
  const mod_js_3 = require("../validator/mod.js");
14
- const uxil_family_js_1 = require("../validator/uxil_family.js");
15
16
  const mod_js_4 = require("../typl/mod.js");
16
17
  const discipline_registry_js_1 = require("../profile/discipline_registry.js");
17
18
  const constants_js_1 = require("./constants.js");
@@ -45,7 +46,9 @@ function resolveGit(raw, withContributors) {
45
46
  * Project `Entry.source` onto `EntryProperties.source`. Always returns a
46
47
  * non-empty object — every entry has a known source category. Markdown
47
48
  * entries get `{ type: "markdown" }`; doc-comment entries get the full
48
- * code-source fan-out (adapter, language, function, rule).
49
+ * code-source fan-out (adapter, language, function, rule); `.feature`
50
+ * header entries get `{ type: "feature-file", adapter: "gherkin", rule }`
51
+ * where `rule` is the Gherkin node kind.
49
52
  */
50
53
  function resolveSource(source) {
51
54
  if (source.kind === "markdown") {
@@ -60,7 +63,11 @@ function resolveSource(source) {
60
63
  rule: source.rule,
61
64
  };
62
65
  }
63
- // Exhaustiveness check — adding a third EntrySource variant becomes a
66
+ if (source.kind === "feature-file") {
67
+ // The Gherkin node the header stands above is the extractor rule.
68
+ return { type: "feature-file", adapter: "gherkin", rule: source.node };
69
+ }
70
+ // Exhaustiveness check — adding a fourth EntrySource variant becomes a
64
71
  // compile-time error here, forcing a deliberate decision about its
65
72
  // properties.source projection rather than silently inheriting the
66
73
  // tree-sitter branch's defaults.
@@ -109,6 +116,14 @@ class Semaphore {
109
116
  * Compile MarkSpec files from the given paths into a resolved
110
117
  * traceability graph.
111
118
  *
119
+ * The returned diagnostics combine parse diagnostics, the validator
120
+ * pipeline's diagnostics, inverse-generation diagnostics and MSL-T013. The
121
+ * pipeline call is the same `runPipeline` call that bare `markspec check`
122
+ * and the LSP make, with project-wide scope by default
123
+ * (`options.projectWide`), so MSL-L006 and the other traceability rules are
124
+ * included. The diagnostics do not include fmt drift, lockfile drift or prose
125
+ * lint.
126
+ *
112
127
  * @param paths - File paths to compile
113
128
  * @param options - Compile options
114
129
  * @returns Compiled entries, links, and diagnostics
@@ -181,26 +196,26 @@ async function compile(paths, options) {
181
196
  if (res.document)
182
197
  documents.set(res.filePath, res.document);
183
198
  }
184
- // Phase 2: Validate all entries. When a profile is loaded, suppress the
185
- // core-only MSL-R010 "unknown attribute" warnings for attributes the profile
186
- // declares — mirrors runPipeline's Stage 1 so LSP/MCP diagnostics match the
187
- // `validate` command instead of flooding the editor with false positives.
188
- const validationResult = (0, mod_js_3.validate)(allEntries);
189
- const validationDiagnostics = (0, mod_js_3.suppressDeclaredAttrR010)(validationResult.diagnostics, allEntries, options.profile ?? null);
190
- // Phase 2.5: Classify entries when a profile is loaded.
199
+ // Phase 2: Validate all entries with the same validator pipeline that
200
+ // bare `markspec check` and the LSP run (`runPipeline`): core hygiene,
201
+ // classification, typed attributes, traceability (MSL-L006, MSL-T014),
202
+ // Gherkin checks and the uxil family. By default the requested path set is
203
+ // the whole project, so project-wide scope applies (`options.projectWide`).
204
+ // Only the pipeline's diagnostics are used. The graph below is built from
205
+ // compile's own classification, so the compiled graph does not depend on
206
+ // the pipeline. CLI-only gates (fmt drift, lock drift, prose lint) are
207
+ // not part of compile.
208
+ const pipelineDiagnostics = (0, mod_js_3.runPipeline)(allEntries, options.profile ?? null, options.captionConventions ?? {}, {
209
+ projectWide: options.projectWide ?? true,
210
+ declaredUpstreamIds: options.declaredUpstreamIds ?? [],
211
+ }).diagnostics;
212
+ // Phase 2.5: Classify entries when a profile is loaded. The
213
+ // classification diagnostics are already part of the pipeline result.
191
214
  let classifiedEntries = allEntries;
192
215
  if (options.profile) {
193
- const stage2 = (0, mod_js_3.classifyEntriesStage)(allEntries, options.profile);
194
- classifiedEntries = stage2.entries;
195
- parseDiagnostics.push(...stage2.diagnostics);
216
+ classifiedEntries = (0, mod_js_3.classifyEntriesStage)(allEntries, options.profile)
217
+ .entries;
196
218
  }
197
- // Phase 2.6: uxil diagnostics family (S9 #727) — profile-gated (inert
198
- // without a `declares: ux-surface` designation), mirroring runPipeline's
199
- // Stage 5 so compile-backed surfaces (CLI compile/export/show, the MCP
200
- // server) agree with `check` and the LSP on designated corpora. No
201
- // file-local filter here: the requested path set IS the corpus being
202
- // compiled — the same full-set semantics MSL-L006 assumes in compile.
203
- const uxilDiagnostics = (0, uxil_family_js_1.validateUxilFamily)(classifiedEntries, options.profile ?? null);
204
219
  // Phase 3: Build traceability graph.
205
220
  // Keep first occurrence of each display ID (validator catches duplicates).
206
221
  const entries = new Map();
@@ -238,22 +253,25 @@ async function compile(paths, options) {
238
253
  entries.set(entry.displayId, entry);
239
254
  }
240
255
  }
256
+ // Phase 4.5: Attach criteria (scenario names of fenced feature blocks)
257
+ // to Requirement and Contract entries, then resolve link locators
258
+ // against them (epic #915).
259
+ attachCriteria(entries, options.profile);
241
260
  const authoredLinks = extractLinks([...entries.values()]);
242
- const links = [...authoredLinks, ...generatedLinks];
261
+ const links = resolveLocators([...authoredLinks, ...generatedLinks], entries, options.profile);
243
262
  // MSL-T013: check link targets for draft/retired state.
244
263
  const linkTargetDiags = (0, link_target_js_1.checkLinkTargets)(entries, links);
245
264
  const forward = buildAdjacency(links, (l) => l.from);
246
265
  const reverse = buildAdjacency(links, (l) => l.to);
247
- // Build the corpus typl registry directly — validate() (called above)
266
+ // Build the corpus typl registry directly — the pipeline (called above)
248
267
  // already ran the full validateTypl pass (citation resolution, TYPL-009,
249
- // etc.) for validationDiagnostics; re-running it here just to get
250
- // `.registry` would redo that work a second time per compile/show/
251
- // context/report/export/MCP call.
268
+ // etc.) for its diagnostics; re-running it here just to get `.registry`
269
+ // would redo that work a second time per compile/show/context/report/
270
+ // export/MCP call.
252
271
  const typeRegistry = (0, mod_js_4.buildTypeRegistry)([...entries.values()]);
253
272
  let diagnostics = [
254
273
  ...parseDiagnostics,
255
- ...validationDiagnostics,
256
- ...uxilDiagnostics,
274
+ ...pipelineDiagnostics,
257
275
  ...linkTargetDiags,
258
276
  ];
259
277
  // Phase 5: Corpus-aware diagnostic post-pass (ADR-030). A project entry
@@ -289,35 +307,81 @@ function extractLinks(entries) {
289
307
  }
290
308
  /**
291
309
  * Attributes whose value is `slug + optional free-text locator` per
292
- * ADR-002 §2.6 (citation type + legacy Derived-from tolerance). The link
293
- * target is the leading non-whitespace token only.
310
+ * ADR-002 §2.6 (citation type + legacy Derived-from tolerance). Without a
311
+ * bracket locator, the link target is the leading non-whitespace token.
294
312
  */
295
- const LOCATOR_BEARING_ATTRS = new Set([
313
+ const LEADING_TOKEN_ATTRS = new Set([
296
314
  "Derived-from",
297
315
  "References",
298
316
  ]);
299
- /** Map an attribute key+value to zero or more links. */
317
+ /** The link target of one comma-separated part without a locator, as
318
+ * before scenario locators: the leading token for
319
+ * {@linkcode LEADING_TOKEN_ATTRS}, else the whole trimmed part. */
320
+ function plainTarget(key, part) {
321
+ const trimmed = part.trim();
322
+ return LEADING_TOKEN_ATTRS.has(key) ? trimmed.split(/\s/)[0] : trimmed;
323
+ }
324
+ /** Map an attribute key+value to zero or more links. The value is split
325
+ * with {@linkcode splitTraceValues}. A part with a bracket locator
326
+ * (`A [x]`) yields a link to `A` that keeps the normalized locator. Any
327
+ * other part is read as before scenario locators existed
328
+ * ({@linkcode plainTarget}). */
300
329
  function extractLinksFromAttribute(from, key, value, location) {
301
330
  const kind = constants_js_1.ATTR_TO_LINK_KIND[key];
302
331
  if (!kind)
303
332
  return [];
304
- if (LOCATOR_BEARING_ATTRS.has(key)) {
305
- // Comma-separated targets, each "ID §section": split the list (these
306
- // attributes are 0..N), then take the leading ID token of each value,
307
- // dropping the optional free-text locator.
308
- return value
309
- .split(",")
310
- .map((s) => s.trim().split(/\s/)[0])
311
- .filter((s) => s.length > 0)
312
- .map((to) => ({ from, to: (0, mod_js_1.makeDisplayId)(to), kind, location }));
333
+ return (0, split_js_1.splitTraceValues)(value).map((part) => {
334
+ const { target, locator } = (0, split_js_1.parseTraceValue)(part);
335
+ if (locator !== undefined) {
336
+ return { from, to: (0, mod_js_1.makeDisplayId)(target), kind, location, locator };
337
+ }
338
+ return { from, to: (0, mod_js_1.makeDisplayId)(plainTarget(key, part)), kind, location };
339
+ });
340
+ }
341
+ /** Attach `criteria` to every criteria-bearing, non-upstream entry that
342
+ * has at least one scenario. Entries without scenarios are left unchanged, so compiled
343
+ * output for projects without feature blocks does not change. */
344
+ function attachCriteria(entries, profile) {
345
+ for (const [id, entry] of entries) {
346
+ // Upstream (federated) entries are read-only references: no criteria.
347
+ if ((0, mod_js_1.isUpstreamEntry)(entry))
348
+ continue;
349
+ if (!(0, scenarios_js_1.isCriteriaBearing)(entry, profile))
350
+ continue;
351
+ const criteria = (0, scenarios_js_1.buildCriteria)(entry);
352
+ if (criteria.length > 0)
353
+ entries.set(id, { ...entry, criteria });
313
354
  }
314
- // Comma-separated targets for id-list attributes.
315
- return value
316
- .split(",")
317
- .map((s) => s.trim())
318
- .filter((s) => s.length > 0)
319
- .map((to) => ({ from, to: (0, mod_js_1.makeDisplayId)(to), kind, location }));
320
355
  }
356
+ /**
357
+ * Set `locatorResolved` on every link whose locator is on a `"criterion"`
358
+ * relation and whose target resolves to a criteria-bearing entry. For a
359
+ * generated inverse the target of the authored relation is `link.from`.
360
+ */
361
+ function resolveLocators(links, entries, profile) {
362
+ // A target may be written as a display ID or as a ULID.
363
+ const byUlid = new Map();
364
+ for (const e of entries.values())
365
+ if (e.id)
366
+ byUlid.set(e.id, e);
367
+ return links.map((link) => {
368
+ if (link.locator === undefined)
369
+ return link;
370
+ if ((0, mod_js_1.relationLocatorMode)(LINK_KIND_TO_ATTR[link.kind]) !== "criterion") {
371
+ return link;
372
+ }
373
+ const targetId = link.origin === "generated" ? link.from : link.to;
374
+ const target = entries.get(targetId) ?? byUlid.get(targetId);
375
+ if (!target || !(0, scenarios_js_1.isCriteriaBearing)(target, profile))
376
+ return link;
377
+ const resolved = (target.criteria ?? []).some((c) => c.addressable && c.name === link.locator);
378
+ return { ...link, locatorResolved: resolved };
379
+ });
380
+ }
381
+ /** Reverse of {@linkcode ATTR_TO_LINK_KIND}: each link kind has one
382
+ * attribute. */
383
+ const LINK_KIND_TO_ATTR = Object
384
+ .fromEntries(Object.entries(constants_js_1.ATTR_TO_LINK_KIND).map(([attr, kind]) => [kind, attr]));
321
385
  /** Build an adjacency map from links using a key selector. */
322
386
  function buildAdjacency(links, keyFn) {
323
387
  const map = new Map();
@@ -70,8 +70,9 @@ export declare function serializeCompileResult(result: CompileResult): Serialize
70
70
  /**
71
71
  * Convert an {@linkcode Entry} to a JSON-safe {@linkcode SerializedEntry} by
72
72
  * replacing `typedAttributes` (a `ReadonlyMap`) with a plain
73
- * `Record<string, readonly string[]>`, and stripping `properties.sync`
74
- * (privacy rule — never publish connector state).
73
+ * `Record<string, readonly string[]>`, stripping `properties.sync`
74
+ * (privacy rule — never publish connector state), and dropping
75
+ * `attributeLines` (a parser aid for diagnostic locations).
75
76
  */
76
77
  export declare function serializeEntry(entry: Entry): SerializedEntry;
77
78
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/compiler/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,GAAG;IAC7D,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;IAC9D,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;CAC/D;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClD,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,I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CAAC,CAAC;CAC/D;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClD,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAClD,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAClD,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,sCAAsC;IACtC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;CAC/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,GACpB,uBAAuB,CAazB;AAgBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,CA8B5D"}
@@ -46,8 +46,9 @@ function serializeTypeRegistry(registry) {
46
46
  /**
47
47
  * Convert an {@linkcode Entry} to a JSON-safe {@linkcode SerializedEntry} by
48
48
  * replacing `typedAttributes` (a `ReadonlyMap`) with a plain
49
- * `Record<string, readonly string[]>`, and stripping `properties.sync`
50
- * (privacy rule — never publish connector state).
49
+ * `Record<string, readonly string[]>`, stripping `properties.sync`
50
+ * (privacy rule — never publish connector state), and dropping
51
+ * `attributeLines` (a parser aid for diagnostic locations).
51
52
  */
52
53
  function serializeEntry(entry) {
53
54
  // Replace the ReadonlyMap with a plain Record when populated; omit when empty
@@ -66,7 +67,9 @@ function serializeEntry(entry) {
66
67
  // from a delivered corpus, matching the serialized-field-presence
67
68
  // contract. Object rest destructuring drops the named key regardless
68
69
  // of its value, unlike `...entry` alone.
69
- const { origin, ...rest } = entry;
70
+ // `attributeLines` is a parser aid for diagnostic locations, not part
71
+ // of the compiled schema.
72
+ const { origin, attributeLines: _attributeLines, ...rest } = entry;
70
73
  return {
71
74
  ...rest,
72
75
  typedAttributes,
@@ -50,12 +50,12 @@ export interface MarkspecYaml {
50
50
  * Applied after built-in build-output skips and all `.gitignore` rules at
51
51
  * every directory level by `core/discovery`. Negations can re-include
52
52
  * non-hidden directories, provided their parents are not ignored. Hidden
53
- * directories are always skipped. Defaults to `[]` when the key is absent.
53
+ * directories are always skipped. Defaults to `[]` when the key is absent or null.
54
54
  */
55
55
  readonly exclude: readonly string[];
56
56
  /**
57
57
  * Per-keyword caption-position conventions (spec §4.7 MSL-C072).
58
- * Defaults to `{}` when the key is absent.
58
+ * Defaults to `{}` when the key is absent or null.
59
59
  */
60
60
  readonly captionConventions: CaptionConventions;
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/config/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAIL,KAAK,aAAa,EAEnB,MAAM,iBAAiB,CAAC;AAEzB,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,yFAAyF;AACzF,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAMrE;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,GAAG,SAAS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GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAUvC"}
@@ -13,6 +13,7 @@ exports.deriveDomain = deriveDomain;
13
13
  exports.loadConfig = loadConfig;
14
14
  const yaml_1 = require("@std/yaml");
15
15
  const path_1 = require("@std/path");
16
+ const formats_js_1 = require("ajv-formats/dist/formats.js");
16
17
  const mod_js_1 = require("../model/mod.js");
17
18
  /** The config file name used as the project root marker. */
18
19
  exports.CONFIG_FILE_NAME = "project.yaml";
@@ -150,12 +151,24 @@ function parseProjectConfig(yaml, filePath) {
150
151
  // version: required string (org project schema)
151
152
  let version = mod_js_1.DEFAULT_PROJECT_CONFIG.version;
152
153
  if (obj.version !== undefined && obj.version !== null && obj.version !== "") {
153
- if (typeof obj.version === "number") {
154
+ if (typeof obj.version === "string") {
155
+ version = obj.version;
156
+ }
157
+ else if (typeof obj.version === "number") {
158
+ // Existing tests and the guide require numeric-version coercion.
159
+ // This remains an exception to the org schema's string-only rule.
154
160
  console.error(`warning: ${filePath}: version is a number (${obj.version}), ` +
155
161
  `coerced to "${String(obj.version)}". ` +
156
162
  `Quote it in YAML: version: "${obj.version}"`);
163
+ version = String(obj.version);
164
+ }
165
+ else {
166
+ errors.push({
167
+ field: "version",
168
+ message: `expected string, got ${typeof obj.version}`,
169
+ line: findLineNumber(yaml, "version"),
170
+ });
157
171
  }
158
- version = String(obj.version);
159
172
  }
160
173
  else {
161
174
  errors.push({
@@ -200,6 +213,8 @@ function parseProjectConfig(yaml, filePath) {
200
213
  /** Safe upstream id: single path segment, no separators or traversal. */
201
214
  const PROJECT_REF_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
202
215
  const PROJECT_REF_KEYS = new Set(["url", "version", "name"]);
216
+ // ajv-formats provides the RFC 3986 URI validator used by schema validation.
217
+ const isUri = formats_js_1.fullFormats.uri;
203
218
  /**
204
219
  * Parse a `dependencies:` or `references:` list of projectRef objects
205
220
  * (`{ url (required), version?, name? }`). Pushes field errors onto
@@ -208,7 +223,7 @@ const PROJECT_REF_KEYS = new Set(["url", "version", "name"]);
208
223
  * mask other unrelated errors.
209
224
  */
210
225
  function parseProjectRefList(value, field, yaml, errors) {
211
- if (value === undefined || value === null)
226
+ if (value === undefined)
212
227
  return [];
213
228
  if (!Array.isArray(value)) {
214
229
  errors.push({
@@ -218,6 +233,13 @@ function parseProjectRefList(value, field, yaml, errors) {
218
233
  });
219
234
  return [];
220
235
  }
236
+ if (value.length === 0) {
237
+ errors.push({
238
+ field,
239
+ message: "must contain at least one projectRef when present",
240
+ line: findLineNumber(yaml, field),
241
+ });
242
+ }
221
243
  const out = [];
222
244
  value.forEach((item, i) => {
223
245
  if (typeof item !== "object" || item === null || Array.isArray(item)) {
@@ -247,12 +269,24 @@ function parseProjectRefList(value, field, yaml, errors) {
247
269
  });
248
270
  return;
249
271
  }
272
+ // Local paths and scp-style Git URLs are required by existing tests and
273
+ // documentation, although the org schema's URI format rejects them.
274
+ const isGitLocation = field === "dependencies" && (url.startsWith("./") || url.startsWith("../") || url.startsWith("/") ||
275
+ /^[A-Za-z]:\\/.test(url) ||
276
+ /^[^@/:\s]+@[^/:\s]+:[^\s]+$/.test(url));
277
+ if (!isUri(url) && !isGitLocation) {
278
+ errors.push({
279
+ field: `${field}[${i}].url`,
280
+ message: "must be a URI",
281
+ line: findLineNumber(yaml, field),
282
+ });
283
+ }
250
284
  const ref = { url };
251
285
  if (record.version !== undefined) {
252
- if (typeof record.version !== "string" || record.version.length === 0) {
286
+ if (typeof record.version !== "string") {
253
287
  errors.push({
254
288
  field: `${field}[${i}].version`,
255
- message: "must be a non-empty string when present",
289
+ message: "must be a string when present",
256
290
  line: findLineNumber(yaml, field),
257
291
  });
258
292
  }
@@ -273,6 +307,14 @@ function parseProjectRefList(value, field, yaml, errors) {
273
307
  ref.name = record.name;
274
308
  }
275
309
  }
310
+ if (out.some((previous) => previous.url === ref.url && previous.version === ref.version &&
311
+ previous.name === ref.name)) {
312
+ errors.push({
313
+ field: `${field}[${i}]`,
314
+ message: "duplicate projectRef; list items must be unique",
315
+ line: findLineNumber(yaml, field),
316
+ });
317
+ }
276
318
  out.push(ref);
277
319
  });
278
320
  return out;