@driftsys/markspec 0.12.1 → 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 (279) 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/criteria/scenarios.d.ts +55 -0
  15. package/esm/criteria/scenarios.d.ts.map +1 -0
  16. package/esm/criteria/scenarios.js +133 -0
  17. package/esm/discovery/mod.d.ts +20 -1
  18. package/esm/discovery/mod.d.ts.map +1 -1
  19. package/esm/discovery/mod.js +105 -17
  20. package/esm/formatter/entry_body.d.ts +8 -5
  21. package/esm/formatter/entry_body.d.ts.map +1 -1
  22. package/esm/formatter/entry_body.js +12 -8
  23. package/esm/formatter/feature_file.d.ts +40 -0
  24. package/esm/formatter/feature_file.d.ts.map +1 -0
  25. package/esm/formatter/feature_file.js +88 -0
  26. package/esm/formatter/mod.d.ts +21 -2
  27. package/esm/formatter/mod.d.ts.map +1 -1
  28. package/esm/formatter/mod.js +64 -22
  29. package/esm/gates/mod.d.ts +2 -2
  30. package/esm/gates/mod.d.ts.map +1 -1
  31. package/esm/gates/mod.js +17 -2
  32. package/esm/gherkin/load.d.ts +35 -0
  33. package/esm/gherkin/load.d.ts.map +1 -0
  34. package/esm/gherkin/load.js +39 -0
  35. package/esm/gherkin/parse.d.ts +11 -0
  36. package/esm/gherkin/parse.d.ts.map +1 -0
  37. package/esm/gherkin/parse.js +311 -0
  38. package/esm/gherkin/position.d.ts +23 -0
  39. package/esm/gherkin/position.d.ts.map +1 -0
  40. package/esm/gherkin/position.js +21 -0
  41. package/esm/gherkin/procedure.d.ts +76 -0
  42. package/esm/gherkin/procedure.d.ts.map +1 -0
  43. package/esm/gherkin/procedure.js +164 -0
  44. package/esm/gherkin/project.d.ts +35 -0
  45. package/esm/gherkin/project.d.ts.map +1 -0
  46. package/esm/gherkin/project.js +64 -0
  47. package/esm/gherkin/role.d.ts +23 -0
  48. package/esm/gherkin/role.d.ts.map +1 -0
  49. package/esm/gherkin/role.js +28 -0
  50. package/esm/gherkin/types.d.ts +118 -0
  51. package/esm/gherkin/types.d.ts.map +1 -0
  52. package/esm/gherkin/types.js +12 -0
  53. package/esm/lock/acquire_compile.d.ts +12 -4
  54. package/esm/lock/acquire_compile.d.ts.map +1 -1
  55. package/esm/lock/acquire_compile.js +15 -5
  56. package/esm/lock/canonical_edges.d.ts +6 -2
  57. package/esm/lock/canonical_edges.d.ts.map +1 -1
  58. package/esm/lock/canonical_edges.js +10 -3
  59. package/esm/lock/model.d.ts +5 -0
  60. package/esm/lock/model.d.ts.map +1 -1
  61. package/esm/lock/parser.d.ts.map +1 -1
  62. package/esm/lock/parser.js +2 -0
  63. package/esm/lock/resolve.d.ts +6 -2
  64. package/esm/lock/resolve.d.ts.map +1 -1
  65. package/esm/lock/resolve.js +36 -4
  66. package/esm/lock/serializer.d.ts.map +1 -1
  67. package/esm/lock/serializer.js +7 -1
  68. package/esm/mod.d.ts +23 -6
  69. package/esm/mod.d.ts.map +1 -1
  70. package/esm/mod.js +18 -5
  71. package/esm/model/mod.d.ts +42 -1
  72. package/esm/model/mod.d.ts.map +1 -1
  73. package/esm/model/mod.js +1 -1
  74. package/esm/model/relations.d.ts +9 -0
  75. package/esm/model/relations.d.ts.map +1 -1
  76. package/esm/model/relations.js +16 -1
  77. package/esm/parser/attributes.d.ts +82 -3
  78. package/esm/parser/attributes.d.ts.map +1 -1
  79. package/esm/parser/attributes.js +199 -32
  80. package/esm/parser/body_tokens.d.ts +1 -1
  81. package/esm/parser/body_tokens.d.ts.map +1 -1
  82. package/esm/parser/body_tokens.js +49 -35
  83. package/esm/parser/feature_file.d.ts +116 -0
  84. package/esm/parser/feature_file.d.ts.map +1 -0
  85. package/esm/parser/feature_file.js +540 -0
  86. package/esm/parser/markdown.d.ts +7 -0
  87. package/esm/parser/markdown.d.ts.map +1 -1
  88. package/esm/parser/markdown.js +129 -40
  89. package/esm/parser/mod.d.ts +18 -0
  90. package/esm/parser/mod.d.ts.map +1 -1
  91. package/esm/parser/mod.js +51 -0
  92. package/esm/parser/translate.d.ts.map +1 -1
  93. package/esm/parser/translate.js +5 -0
  94. package/esm/refs/mod.d.ts +2 -1
  95. package/esm/refs/mod.d.ts.map +1 -1
  96. package/esm/refs/mod.js +12 -4
  97. package/esm/refs/split.d.ts +58 -0
  98. package/esm/refs/split.d.ts.map +1 -0
  99. package/esm/refs/split.js +137 -0
  100. package/esm/reporter/mod.d.ts +7 -0
  101. package/esm/reporter/mod.d.ts.map +1 -1
  102. package/esm/reporter/mod.js +113 -3
  103. package/esm/validator/attributes.d.ts.map +1 -1
  104. package/esm/validator/attributes.js +4 -1
  105. package/esm/validator/block_role.d.ts +40 -0
  106. package/esm/validator/block_role.d.ts.map +1 -0
  107. package/esm/validator/block_role.js +109 -0
  108. package/esm/validator/feature_ac.d.ts.map +1 -1
  109. package/esm/validator/feature_ac.js +6 -1
  110. package/esm/validator/feature_parse.d.ts +35 -0
  111. package/esm/validator/feature_parse.d.ts.map +1 -0
  112. package/esm/validator/feature_parse.js +69 -0
  113. package/esm/validator/locators.d.ts +36 -0
  114. package/esm/validator/locators.d.ts.map +1 -0
  115. package/esm/validator/locators.js +184 -0
  116. package/esm/validator/mod.d.ts +10 -1
  117. package/esm/validator/mod.d.ts.map +1 -1
  118. package/esm/validator/mod.js +38 -14
  119. package/esm/validator/normalize.d.ts.map +1 -1
  120. package/esm/validator/normalize.js +8 -3
  121. package/esm/validator/per_type_attrs.d.ts +3 -3
  122. package/esm/validator/per_type_attrs.js +3 -3
  123. package/esm/validator/pipeline.d.ts +4 -12
  124. package/esm/validator/pipeline.d.ts.map +1 -1
  125. package/esm/validator/pipeline.js +24 -5
  126. package/esm/validator/procedure.d.ts +22 -0
  127. package/esm/validator/procedure.d.ts.map +1 -0
  128. package/esm/validator/procedure.js +58 -0
  129. package/esm/validator/trace_types.d.ts.map +1 -1
  130. package/esm/validator/trace_types.js +4 -3
  131. package/esm/validator/traceability.d.ts.map +1 -1
  132. package/esm/validator/traceability.js +4 -1
  133. package/esm/validator/type_resolution.d.ts +5 -3
  134. package/esm/validator/type_resolution.d.ts.map +1 -1
  135. package/esm/validator/type_resolution.js +14 -2
  136. package/esm/validator/types.d.ts +11 -0
  137. package/esm/validator/types.d.ts.map +1 -1
  138. package/esm/validator/types.js +26 -4
  139. package/esm/validator/uxil_family.d.ts +1 -1
  140. package/package.json +3 -1
  141. package/script/ast/build.d.ts.map +1 -1
  142. package/script/ast/build.js +19 -5
  143. package/script/ast/equivalence.js +14 -2
  144. package/script/ast/nodes.d.ts +15 -3
  145. package/script/ast/nodes.d.ts.map +1 -1
  146. package/script/compiler/inverses.d.ts.map +1 -1
  147. package/script/compiler/inverses.js +18 -3
  148. package/script/compiler/mod.d.ts +34 -1
  149. package/script/compiler/mod.d.ts.map +1 -1
  150. package/script/compiler/mod.js +110 -46
  151. package/script/compiler/schema.d.ts +3 -2
  152. package/script/compiler/schema.d.ts.map +1 -1
  153. package/script/compiler/schema.js +6 -3
  154. package/script/criteria/scenarios.d.ts +55 -0
  155. package/script/criteria/scenarios.d.ts.map +1 -0
  156. package/script/criteria/scenarios.js +139 -0
  157. package/script/discovery/mod.d.ts +20 -1
  158. package/script/discovery/mod.d.ts.map +1 -1
  159. package/script/discovery/mod.js +106 -17
  160. package/script/formatter/entry_body.d.ts +8 -5
  161. package/script/formatter/entry_body.d.ts.map +1 -1
  162. package/script/formatter/entry_body.js +12 -8
  163. package/script/formatter/feature_file.d.ts +40 -0
  164. package/script/formatter/feature_file.d.ts.map +1 -0
  165. package/script/formatter/feature_file.js +92 -0
  166. package/script/formatter/mod.d.ts +21 -2
  167. package/script/formatter/mod.d.ts.map +1 -1
  168. package/script/formatter/mod.js +63 -21
  169. package/script/gates/mod.d.ts +2 -2
  170. package/script/gates/mod.d.ts.map +1 -1
  171. package/script/gates/mod.js +17 -2
  172. package/script/gherkin/load.d.ts +35 -0
  173. package/script/gherkin/load.d.ts.map +1 -0
  174. package/script/gherkin/load.js +76 -0
  175. package/script/gherkin/parse.d.ts +11 -0
  176. package/script/gherkin/parse.d.ts.map +1 -0
  177. package/script/gherkin/parse.js +314 -0
  178. package/script/gherkin/position.d.ts +23 -0
  179. package/script/gherkin/position.d.ts.map +1 -0
  180. package/script/gherkin/position.js +24 -0
  181. package/script/gherkin/procedure.d.ts +76 -0
  182. package/script/gherkin/procedure.d.ts.map +1 -0
  183. package/script/gherkin/procedure.js +169 -0
  184. package/script/gherkin/project.d.ts +35 -0
  185. package/script/gherkin/project.d.ts.map +1 -0
  186. package/script/gherkin/project.js +67 -0
  187. package/script/gherkin/role.d.ts +23 -0
  188. package/script/gherkin/role.d.ts.map +1 -0
  189. package/script/gherkin/role.js +31 -0
  190. package/script/gherkin/types.d.ts +118 -0
  191. package/script/gherkin/types.d.ts.map +1 -0
  192. package/script/gherkin/types.js +13 -0
  193. package/script/lock/acquire_compile.d.ts +12 -4
  194. package/script/lock/acquire_compile.d.ts.map +1 -1
  195. package/script/lock/acquire_compile.js +15 -5
  196. package/script/lock/canonical_edges.d.ts +6 -2
  197. package/script/lock/canonical_edges.d.ts.map +1 -1
  198. package/script/lock/canonical_edges.js +10 -3
  199. package/script/lock/model.d.ts +5 -0
  200. package/script/lock/model.d.ts.map +1 -1
  201. package/script/lock/parser.d.ts.map +1 -1
  202. package/script/lock/parser.js +2 -0
  203. package/script/lock/resolve.d.ts +6 -2
  204. package/script/lock/resolve.d.ts.map +1 -1
  205. package/script/lock/resolve.js +36 -4
  206. package/script/lock/serializer.d.ts.map +1 -1
  207. package/script/lock/serializer.js +7 -1
  208. package/script/mod.d.ts +23 -6
  209. package/script/mod.d.ts.map +1 -1
  210. package/script/mod.js +45 -6
  211. package/script/model/mod.d.ts +42 -1
  212. package/script/model/mod.d.ts.map +1 -1
  213. package/script/model/mod.js +2 -1
  214. package/script/model/relations.d.ts +9 -0
  215. package/script/model/relations.d.ts.map +1 -1
  216. package/script/model/relations.js +17 -1
  217. package/script/parser/attributes.d.ts +82 -3
  218. package/script/parser/attributes.d.ts.map +1 -1
  219. package/script/parser/attributes.js +205 -33
  220. package/script/parser/body_tokens.d.ts +1 -1
  221. package/script/parser/body_tokens.d.ts.map +1 -1
  222. package/script/parser/body_tokens.js +49 -35
  223. package/script/parser/feature_file.d.ts +116 -0
  224. package/script/parser/feature_file.d.ts.map +1 -0
  225. package/script/parser/feature_file.js +548 -0
  226. package/script/parser/markdown.d.ts +7 -0
  227. package/script/parser/markdown.d.ts.map +1 -1
  228. package/script/parser/markdown.js +128 -39
  229. package/script/parser/mod.d.ts +18 -0
  230. package/script/parser/mod.d.ts.map +1 -1
  231. package/script/parser/mod.js +52 -1
  232. package/script/parser/translate.d.ts.map +1 -1
  233. package/script/parser/translate.js +5 -0
  234. package/script/refs/mod.d.ts +2 -1
  235. package/script/refs/mod.d.ts.map +1 -1
  236. package/script/refs/mod.js +12 -4
  237. package/script/refs/split.d.ts +58 -0
  238. package/script/refs/split.d.ts.map +1 -0
  239. package/script/refs/split.js +145 -0
  240. package/script/reporter/mod.d.ts +7 -0
  241. package/script/reporter/mod.d.ts.map +1 -1
  242. package/script/reporter/mod.js +113 -3
  243. package/script/validator/attributes.d.ts.map +1 -1
  244. package/script/validator/attributes.js +4 -1
  245. package/script/validator/block_role.d.ts +40 -0
  246. package/script/validator/block_role.d.ts.map +1 -0
  247. package/script/validator/block_role.js +112 -0
  248. package/script/validator/feature_ac.d.ts.map +1 -1
  249. package/script/validator/feature_ac.js +6 -1
  250. package/script/validator/feature_parse.d.ts +35 -0
  251. package/script/validator/feature_parse.d.ts.map +1 -0
  252. package/script/validator/feature_parse.js +73 -0
  253. package/script/validator/locators.d.ts +36 -0
  254. package/script/validator/locators.d.ts.map +1 -0
  255. package/script/validator/locators.js +188 -0
  256. package/script/validator/mod.d.ts +10 -1
  257. package/script/validator/mod.d.ts.map +1 -1
  258. package/script/validator/mod.js +38 -14
  259. package/script/validator/normalize.d.ts.map +1 -1
  260. package/script/validator/normalize.js +8 -3
  261. package/script/validator/per_type_attrs.d.ts +3 -3
  262. package/script/validator/per_type_attrs.js +3 -3
  263. package/script/validator/pipeline.d.ts +4 -12
  264. package/script/validator/pipeline.d.ts.map +1 -1
  265. package/script/validator/pipeline.js +23 -5
  266. package/script/validator/procedure.d.ts +22 -0
  267. package/script/validator/procedure.d.ts.map +1 -0
  268. package/script/validator/procedure.js +61 -0
  269. package/script/validator/trace_types.d.ts.map +1 -1
  270. package/script/validator/trace_types.js +4 -3
  271. package/script/validator/traceability.d.ts.map +1 -1
  272. package/script/validator/traceability.js +4 -1
  273. package/script/validator/type_resolution.d.ts +5 -3
  274. package/script/validator/type_resolution.d.ts.map +1 -1
  275. package/script/validator/type_resolution.js +14 -2
  276. package/script/validator/types.d.ts +11 -0
  277. package/script/validator/types.d.ts.map +1 -1
  278. package/script/validator/types.js +27 -4
  279. package/script/validator/uxil_family.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ast/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAKV,IAAI,EAKL,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAGV,SAAS,EAeV,MAAM,YAAY,CAAC;AAwCpB;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;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AE,MAAM,EAAE,SAAS,EAAE,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAkBrC"}
package/esm/ast/build.js CHANGED
@@ -9,6 +9,8 @@
9
9
  */
10
10
  import { processor } from "../parser/remark.js";
11
11
  import { normalizeLineEndings } from "../util/line_endings.js";
12
+ import { loadedGherkin } from "../gherkin/load.js";
13
+ import { parseFeature } from "../gherkin/parse.js";
12
14
  /**
13
15
  * Build an InlineContent from verbatim source prose.
14
16
  * `storedText` is the verbatim source prose that `render` emits (§5.1
@@ -386,11 +388,23 @@ function mapMdastNode(node, body) {
386
388
  case "code": {
387
389
  const lang = node.lang ?? undefined; // empty string → undefined
388
390
  if (lang === "gherkin" || lang === "feature") {
389
- return {
390
- kind: "feature",
391
- source: node.value ?? "",
392
- range,
393
- };
391
+ const source = node.value ?? "";
392
+ const api = loadedGherkin();
393
+ if (!api)
394
+ return { kind: "feature", source, range };
395
+ const parsed = parseFeature(api, source);
396
+ return parsed.ok
397
+ ? { kind: "feature", source, feature: parsed.feature, range }
398
+ : {
399
+ kind: "feature",
400
+ source,
401
+ parseError: {
402
+ line: parsed.line,
403
+ column: parsed.column,
404
+ message: parsed.message,
405
+ },
406
+ range,
407
+ };
394
408
  }
395
409
  return {
396
410
  kind: "code",
@@ -38,8 +38,8 @@ function deepEqualIgnoringRanges(a, b) {
38
38
  if (typeof a === "object" && typeof b === "object") {
39
39
  const ao = a;
40
40
  const bo = b;
41
- const ak = Object.keys(ao).filter((k) => k !== "range").sort();
42
- const bk = Object.keys(bo).filter((k) => k !== "range").sort();
41
+ const ak = comparedKeys(ao);
42
+ const bk = comparedKeys(bo);
43
43
  if (ak.length !== bk.length)
44
44
  return false;
45
45
  for (let i = 0; i < ak.length; i++) {
@@ -54,3 +54,15 @@ function deepEqualIgnoringRanges(a, b) {
54
54
  }
55
55
  return false;
56
56
  }
57
+ /**
58
+ * Keys compared for one object: every key except `range`. A `FeatureNode`
59
+ * also skips `feature` and `parseError`: both are pure functions of
60
+ * `source`, which is compared, and they exist only while the Gherkin parser
61
+ * is loaded. Comparing them would make equivalence depend on load timing.
62
+ */
63
+ function comparedKeys(node) {
64
+ const derived = node.kind === "feature";
65
+ return Object.keys(node)
66
+ .filter((k) => k !== "range" && !(derived && (k === "feature" || k === "parseError")))
67
+ .sort();
68
+ }
@@ -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,CA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MG;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"}
@@ -6,6 +6,7 @@
6
6
  * entries.
7
7
  */
8
8
  import { ATTR_TO_LINK_KIND } from "./constants.js";
9
+ import { parseTraceValue } from "../refs/split.js";
9
10
  /**
10
11
  * Generate inverse (back-link) attributes from forward link declarations.
11
12
  *
@@ -32,6 +33,8 @@ export function generateInverses(entries, profile) {
32
33
  // Step 3–5: Walk entries, accumulate back-links
33
34
  // Map: targetId → Map<inverseAttrName, Set<sourceId>>
34
35
  const generated = new Map();
36
+ /** Keys of the generated edges already emitted. */
37
+ const edgeKeys = new Set();
35
38
  // Parallel list of raw generated-edge data for Link emission.
36
39
  const generatedEdges = [];
37
40
  for (const source of entries) {
@@ -42,7 +45,13 @@ export function generateInverses(entries, profile) {
42
45
  const forwardValues = source.typedAttributes.get(spec.attrName);
43
46
  if (!forwardValues)
44
47
  continue;
45
- for (const targetId of forwardValues) {
48
+ for (const forwardValue of forwardValues) {
49
+ // A value may carry a locator (`<ULID> [Scenario name]`); the
50
+ // target is the part before it and the locator is copied to the
51
+ // generated link.
52
+ const parsed = parseTraceValue(forwardValue);
53
+ const locator = parsed.locator;
54
+ const targetId = parsed.target;
46
55
  const target = byId.get(targetId);
47
56
  if (!target || target.type !== spec.inverse.category)
48
57
  continue;
@@ -56,13 +65,18 @@ export function generateInverses(entries, profile) {
56
65
  idSet = new Set();
57
66
  targetMap.set(spec.inverse.name, idSet);
58
67
  }
59
- const wasNew = !idSet.has(source.id);
60
68
  idSet.add(source.id);
69
+ // One generated edge per (target, inverse, source, locator): two
70
+ // locators from one source keep two edges.
71
+ const edgeKey = `${targetId}\u0000${spec.inverse.name}\u0000${source.id}\u0000${locator === undefined ? "-" : `+${locator}`}`;
72
+ const wasNew = !edgeKeys.has(edgeKey);
73
+ edgeKeys.add(edgeKey);
61
74
  if (wasNew) {
62
75
  generatedEdges.push({
63
76
  targetUlid: targetId,
64
77
  sourceUlid: source.id,
65
78
  attrName: spec.attrName,
79
+ ...(locator !== undefined ? { locator } : {}),
66
80
  });
67
81
  }
68
82
  }
@@ -115,7 +129,7 @@ export function generateInverses(entries, profile) {
115
129
  }
116
130
  // Resolve generated edges to displayId-based Link objects.
117
131
  const links = [];
118
- for (const { targetUlid, sourceUlid, attrName } of generatedEdges) {
132
+ for (const { targetUlid, sourceUlid, attrName, locator } of generatedEdges) {
119
133
  const kind = ATTR_TO_LINK_KIND[attrName];
120
134
  if (!kind)
121
135
  continue;
@@ -129,6 +143,7 @@ export function generateInverses(entries, profile) {
129
143
  kind,
130
144
  location: source.location,
131
145
  origin: "generated",
146
+ ...(locator !== undefined ? { locator } : {}),
132
147
  });
133
148
  }
134
149
  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,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,IAAI,EAEL,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOtE,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,qGAAqG;IACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAClB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IACjD;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CACjB,IAAI,EAAE,MAAM,KACT,OAA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ths, parses all entries, validates them,
5
5
  * builds a bidirectional traceability graph, and returns the compiled model.
6
6
  */
7
- import { makeDisplayId } from "../model/mod.js";
7
+ import { isUpstreamEntry, makeDisplayId, relationLocatorMode, } from "../model/mod.js";
8
+ import { buildCriteria, isCriteriaBearing } from "../criteria/scenarios.js";
9
+ import { parseTraceValue, splitTraceValues } from "../refs/split.js";
8
10
  import { parseFile } from "../parser/mod.js";
9
- import { applyCorpusPostPass, classifyEntriesStage, suppressDeclaredAttrR010, validate, } from "../validator/mod.js";
10
- import { validateUxilFamily } from "../validator/uxil_family.js";
11
+ import { applyCorpusPostPass, classifyEntriesStage, runPipeline, } from "../validator/mod.js";
11
12
  import { buildTypeRegistry } from "../typl/mod.js";
12
13
  import { buildEffectiveDisciplineRegistry } from "../profile/discipline_registry.js";
13
14
  import { ATTR_TO_LINK_KIND } from "./constants.js";
@@ -41,7 +42,9 @@ function resolveGit(raw, withContributors) {
41
42
  * Project `Entry.source` onto `EntryProperties.source`. Always returns a
42
43
  * non-empty object — every entry has a known source category. Markdown
43
44
  * entries get `{ type: "markdown" }`; doc-comment entries get the full
44
- * code-source fan-out (adapter, language, function, rule).
45
+ * code-source fan-out (adapter, language, function, rule); `.feature`
46
+ * header entries get `{ type: "feature-file", adapter: "gherkin", rule }`
47
+ * where `rule` is the Gherkin node kind.
45
48
  */
46
49
  function resolveSource(source) {
47
50
  if (source.kind === "markdown") {
@@ -56,7 +59,11 @@ function resolveSource(source) {
56
59
  rule: source.rule,
57
60
  };
58
61
  }
59
- // Exhaustiveness check — adding a third EntrySource variant becomes a
62
+ if (source.kind === "feature-file") {
63
+ // The Gherkin node the header stands above is the extractor rule.
64
+ return { type: "feature-file", adapter: "gherkin", rule: source.node };
65
+ }
66
+ // Exhaustiveness check — adding a fourth EntrySource variant becomes a
60
67
  // compile-time error here, forcing a deliberate decision about its
61
68
  // properties.source projection rather than silently inheriting the
62
69
  // tree-sitter branch's defaults.
@@ -105,6 +112,14 @@ class Semaphore {
105
112
  * Compile MarkSpec files from the given paths into a resolved
106
113
  * traceability graph.
107
114
  *
115
+ * The returned diagnostics combine parse diagnostics, the validator
116
+ * pipeline's diagnostics, inverse-generation diagnostics and MSL-T013. The
117
+ * pipeline call is the same `runPipeline` call that bare `markspec check`
118
+ * and the LSP make, with project-wide scope by default
119
+ * (`options.projectWide`), so MSL-L006 and the other traceability rules are
120
+ * included. The diagnostics do not include fmt drift, lockfile drift or prose
121
+ * lint.
122
+ *
108
123
  * @param paths - File paths to compile
109
124
  * @param options - Compile options
110
125
  * @returns Compiled entries, links, and diagnostics
@@ -177,26 +192,26 @@ export async function compile(paths, options) {
177
192
  if (res.document)
178
193
  documents.set(res.filePath, res.document);
179
194
  }
180
- // Phase 2: Validate all entries. When a profile is loaded, suppress the
181
- // core-only MSL-R010 "unknown attribute" warnings for attributes the profile
182
- // declares — mirrors runPipeline's Stage 1 so LSP/MCP diagnostics match the
183
- // `validate` command instead of flooding the editor with false positives.
184
- const validationResult = validate(allEntries);
185
- const validationDiagnostics = suppressDeclaredAttrR010(validationResult.diagnostics, allEntries, options.profile ?? null);
186
- // Phase 2.5: Classify entries when a profile is loaded.
195
+ // Phase 2: Validate all entries with the same validator pipeline that
196
+ // bare `markspec check` and the LSP run (`runPipeline`): core hygiene,
197
+ // classification, typed attributes, traceability (MSL-L006, MSL-T014),
198
+ // Gherkin checks and the uxil family. By default the requested path set is
199
+ // the whole project, so project-wide scope applies (`options.projectWide`).
200
+ // Only the pipeline's diagnostics are used. The graph below is built from
201
+ // compile's own classification, so the compiled graph does not depend on
202
+ // the pipeline. CLI-only gates (fmt drift, lock drift, prose lint) are
203
+ // not part of compile.
204
+ const pipelineDiagnostics = runPipeline(allEntries, options.profile ?? null, options.captionConventions ?? {}, {
205
+ projectWide: options.projectWide ?? true,
206
+ declaredUpstreamIds: options.declaredUpstreamIds ?? [],
207
+ }).diagnostics;
208
+ // Phase 2.5: Classify entries when a profile is loaded. The
209
+ // classification diagnostics are already part of the pipeline result.
187
210
  let classifiedEntries = allEntries;
188
211
  if (options.profile) {
189
- const stage2 = classifyEntriesStage(allEntries, options.profile);
190
- classifiedEntries = stage2.entries;
191
- parseDiagnostics.push(...stage2.diagnostics);
212
+ classifiedEntries = classifyEntriesStage(allEntries, options.profile)
213
+ .entries;
192
214
  }
193
- // Phase 2.6: uxil diagnostics family (S9 #727) — profile-gated (inert
194
- // without a `declares: ux-surface` designation), mirroring runPipeline's
195
- // Stage 5 so compile-backed surfaces (CLI compile/export/show, the MCP
196
- // server) agree with `check` and the LSP on designated corpora. No
197
- // file-local filter here: the requested path set IS the corpus being
198
- // compiled — the same full-set semantics MSL-L006 assumes in compile.
199
- const uxilDiagnostics = validateUxilFamily(classifiedEntries, options.profile ?? null);
200
215
  // Phase 3: Build traceability graph.
201
216
  // Keep first occurrence of each display ID (validator catches duplicates).
202
217
  const entries = new Map();
@@ -234,22 +249,25 @@ export async function compile(paths, options) {
234
249
  entries.set(entry.displayId, entry);
235
250
  }
236
251
  }
252
+ // Phase 4.5: Attach criteria (scenario names of fenced feature blocks)
253
+ // to Requirement and Contract entries, then resolve link locators
254
+ // against them (epic #915).
255
+ attachCriteria(entries, options.profile);
237
256
  const authoredLinks = extractLinks([...entries.values()]);
238
- const links = [...authoredLinks, ...generatedLinks];
257
+ const links = resolveLocators([...authoredLinks, ...generatedLinks], entries, options.profile);
239
258
  // MSL-T013: check link targets for draft/retired state.
240
259
  const linkTargetDiags = checkLinkTargets(entries, links);
241
260
  const forward = buildAdjacency(links, (l) => l.from);
242
261
  const reverse = buildAdjacency(links, (l) => l.to);
243
- // Build the corpus typl registry directly — validate() (called above)
262
+ // Build the corpus typl registry directly — the pipeline (called above)
244
263
  // already ran the full validateTypl pass (citation resolution, TYPL-009,
245
- // etc.) for validationDiagnostics; re-running it here just to get
246
- // `.registry` would redo that work a second time per compile/show/
247
- // context/report/export/MCP call.
264
+ // etc.) for its diagnostics; re-running it here just to get `.registry`
265
+ // would redo that work a second time per compile/show/context/report/
266
+ // export/MCP call.
248
267
  const typeRegistry = buildTypeRegistry([...entries.values()]);
249
268
  let diagnostics = [
250
269
  ...parseDiagnostics,
251
- ...validationDiagnostics,
252
- ...uxilDiagnostics,
270
+ ...pipelineDiagnostics,
253
271
  ...linkTargetDiags,
254
272
  ];
255
273
  // Phase 5: Corpus-aware diagnostic post-pass (ADR-030). A project entry
@@ -285,35 +303,81 @@ function extractLinks(entries) {
285
303
  }
286
304
  /**
287
305
  * Attributes whose value is `slug + optional free-text locator` per
288
- * ADR-002 §2.6 (citation type + legacy Derived-from tolerance). The link
289
- * target is the leading non-whitespace token only.
306
+ * ADR-002 §2.6 (citation type + legacy Derived-from tolerance). Without a
307
+ * bracket locator, the link target is the leading non-whitespace token.
290
308
  */
291
- const LOCATOR_BEARING_ATTRS = new Set([
309
+ const LEADING_TOKEN_ATTRS = new Set([
292
310
  "Derived-from",
293
311
  "References",
294
312
  ]);
295
- /** Map an attribute key+value to zero or more links. */
313
+ /** The link target of one comma-separated part without a locator, as
314
+ * before scenario locators: the leading token for
315
+ * {@linkcode LEADING_TOKEN_ATTRS}, else the whole trimmed part. */
316
+ function plainTarget(key, part) {
317
+ const trimmed = part.trim();
318
+ return LEADING_TOKEN_ATTRS.has(key) ? trimmed.split(/\s/)[0] : trimmed;
319
+ }
320
+ /** Map an attribute key+value to zero or more links. The value is split
321
+ * with {@linkcode splitTraceValues}. A part with a bracket locator
322
+ * (`A [x]`) yields a link to `A` that keeps the normalized locator. Any
323
+ * other part is read as before scenario locators existed
324
+ * ({@linkcode plainTarget}). */
296
325
  function extractLinksFromAttribute(from, key, value, location) {
297
326
  const kind = ATTR_TO_LINK_KIND[key];
298
327
  if (!kind)
299
328
  return [];
300
- if (LOCATOR_BEARING_ATTRS.has(key)) {
301
- // Comma-separated targets, each "ID §section": split the list (these
302
- // attributes are 0..N), then take the leading ID token of each value,
303
- // dropping the optional free-text locator.
304
- return value
305
- .split(",")
306
- .map((s) => s.trim().split(/\s/)[0])
307
- .filter((s) => s.length > 0)
308
- .map((to) => ({ from, to: makeDisplayId(to), kind, location }));
329
+ return splitTraceValues(value).map((part) => {
330
+ const { target, locator } = parseTraceValue(part);
331
+ if (locator !== undefined) {
332
+ return { from, to: makeDisplayId(target), kind, location, locator };
333
+ }
334
+ return { from, to: makeDisplayId(plainTarget(key, part)), kind, location };
335
+ });
336
+ }
337
+ /** Attach `criteria` to every criteria-bearing, non-upstream entry that
338
+ * has at least one scenario. Entries without scenarios are left unchanged, so compiled
339
+ * output for projects without feature blocks does not change. */
340
+ function attachCriteria(entries, profile) {
341
+ for (const [id, entry] of entries) {
342
+ // Upstream (federated) entries are read-only references: no criteria.
343
+ if (isUpstreamEntry(entry))
344
+ continue;
345
+ if (!isCriteriaBearing(entry, profile))
346
+ continue;
347
+ const criteria = buildCriteria(entry);
348
+ if (criteria.length > 0)
349
+ entries.set(id, { ...entry, criteria });
309
350
  }
310
- // Comma-separated targets for id-list attributes.
311
- return value
312
- .split(",")
313
- .map((s) => s.trim())
314
- .filter((s) => s.length > 0)
315
- .map((to) => ({ from, to: makeDisplayId(to), kind, location }));
316
351
  }
352
+ /**
353
+ * Set `locatorResolved` on every link whose locator is on a `"criterion"`
354
+ * relation and whose target resolves to a criteria-bearing entry. For a
355
+ * generated inverse the target of the authored relation is `link.from`.
356
+ */
357
+ function resolveLocators(links, entries, profile) {
358
+ // A target may be written as a display ID or as a ULID.
359
+ const byUlid = new Map();
360
+ for (const e of entries.values())
361
+ if (e.id)
362
+ byUlid.set(e.id, e);
363
+ return links.map((link) => {
364
+ if (link.locator === undefined)
365
+ return link;
366
+ if (relationLocatorMode(LINK_KIND_TO_ATTR[link.kind]) !== "criterion") {
367
+ return link;
368
+ }
369
+ const targetId = link.origin === "generated" ? link.from : link.to;
370
+ const target = entries.get(targetId) ?? byUlid.get(targetId);
371
+ if (!target || !isCriteriaBearing(target, profile))
372
+ return link;
373
+ const resolved = (target.criteria ?? []).some((c) => c.addressable && c.name === link.locator);
374
+ return { ...link, locatorResolved: resolved };
375
+ });
376
+ }
377
+ /** Reverse of {@linkcode ATTR_TO_LINK_KIND}: each link kind has one
378
+ * attribute. */
379
+ const LINK_KIND_TO_ATTR = Object
380
+ .fromEntries(Object.entries(ATTR_TO_LINK_KIND).map(([attr, kind]) => [kind, attr]));
317
381
  /** Build an adjacency map from links using a key selector. */
318
382
  function buildAdjacency(links, keyFn) {
319
383
  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;;;;;GAK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e,CA8B5D"}
@@ -42,8 +42,9 @@ function serializeTypeRegistry(registry) {
42
42
  /**
43
43
  * Convert an {@linkcode Entry} to a JSON-safe {@linkcode SerializedEntry} by
44
44
  * replacing `typedAttributes` (a `ReadonlyMap`) with a plain
45
- * `Record<string, readonly string[]>`, and stripping `properties.sync`
46
- * (privacy rule — never publish connector state).
45
+ * `Record<string, readonly string[]>`, stripping `properties.sync`
46
+ * (privacy rule — never publish connector state), and dropping
47
+ * `attributeLines` (a parser aid for diagnostic locations).
47
48
  */
48
49
  export function serializeEntry(entry) {
49
50
  // Replace the ReadonlyMap with a plain Record when populated; omit when empty
@@ -62,7 +63,9 @@ export function serializeEntry(entry) {
62
63
  // from a delivered corpus, matching the serialized-field-presence
63
64
  // contract. Object rest destructuring drops the named key regardless
64
65
  // of its value, unlike `...entry` alone.
65
- const { origin, ...rest } = entry;
66
+ // `attributeLines` is a parser aid for diagnostic locations, not part
67
+ // of the compiled schema.
68
+ const { origin, attributeLines: _attributeLines, ...rest } = entry;
66
69
  return {
67
70
  ...rest,
68
71
  typedAttributes,
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module criteria/scenarios
3
+ *
4
+ * Scenario index. Builds the `Entry.criteria` subset
5
+ * `{ form: "scenario", name, addressable, location }` from the fenced
6
+ * `gherkin` / `feature` blocks of an entry body.
7
+ *
8
+ * Source of the scenario names, per block:
9
+ *
10
+ * - the Gherkin AST (`FeatureNode.feature`) when it is present, in any spoken
11
+ * language;
12
+ * - otherwise the line scanner ({@linkcode scanScenarioNames}, English
13
+ * keywords only), when the block did not parse (`parseError`) or when the
14
+ * parser was not loaded at parse time.
15
+ *
16
+ * `parseFile` loads the parser before it parses a text with a gherkin fence,
17
+ * so every entry that reaches the compiler, the validator and the reporter
18
+ * carries the AST or a `parseError`, unless the parser import failed. The
19
+ * scanner for the not-loaded case covers that failure and code that builds
20
+ * entries with the synchronous `parse()` before any load.
21
+ */
22
+ import type { Criterion, EffectiveProfile, Entry } from "../model/mod.js";
23
+ /**
24
+ * Collect the scenario names of one Gherkin source text, in order.
25
+ * `line` is the 0-based line of the keyword within `source`. Lines between
26
+ * doc-string delimiters (`"""` or three backticks) are skipped. `Background`
27
+ * and `Rule` are not scenarios. Names are trimmed but not otherwise
28
+ * normalized.
29
+ */
30
+ export declare function scanScenarioNames(source: string): {
31
+ name: string;
32
+ line: number;
33
+ }[];
34
+ /**
35
+ * Build the criteria of an entry from its feature blocks, in source order.
36
+ * Only top-level fenced blocks of the body are indexed: a fence nested in a
37
+ * list item or another container yields no criteria.
38
+ * A block with an AST contributes the AST's scenarios; see the module comment
39
+ * for the fallback. Names are normalized with {@linkcode normalizeLocator}. The blocks of one
40
+ * entry form one scope: a normalized name that occurs more than once, and an
41
+ * empty name, are not addressable. `location.line` is the file-relative line
42
+ * of the keyword; `location.column` is always 1.
43
+ */
44
+ export declare function buildCriteria(entry: Entry): readonly Criterion[];
45
+ /** `true` when `entry`'s type resolves to core Requirement or Contract —
46
+ * the entries that carry criteria (epic #915, decision 3). Uses the
47
+ * profile extends chain when a profile is loaded, else the core hierarchy.
48
+ * An entry without a resolved type carries no criteria. */
49
+ export declare function isCriteriaBearing(entry: Entry, profile: EffectiveProfile | null | undefined): boolean;
50
+ /** `true` when `entry`'s type is, or extends, the core `Test` type — the
51
+ * entries whose `Verifies` links count for criterion coverage (epic #915,
52
+ * decision 2). Uses the profile extends chain when a profile is loaded,
53
+ * else the core hierarchy. */
54
+ export declare function isTestEntry(entry: Entry, profile: EffectiveProfile | null | undefined): boolean;
55
+ //# sourceMappingURL=scenarios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../src/criteria/scenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAU1E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAsBlC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,SAAS,EAAE,CA8BhE;AAKD;;;2DAG2D;AAC3D,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC3C,OAAO,CAQT;AAMD;;;8BAG8B;AAC9B,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC3C,OAAO,CAMT"}