@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
@@ -6,9 +6,9 @@
6
6
  * `Type:`, profile classification, or URI-scheme inference for
7
7
  * Reference-shape entries — any attribute that's known to the core
8
8
  * hierarchy but not allowed on that type fires MSL-T022 as a warning.
9
- * Unknown attributes (neither universal nor core-typed) fall through
10
- * to the existing MSL-R010 unknown-attribute warning in
11
- * `validator/mod.ts`.
9
+ * Unknown attributes (neither universal, core relation keys, nor
10
+ * core-typed) fall through to the existing MSL-R010 unknown-attribute
11
+ * warning in `validator/mod.ts`.
12
12
  */
13
13
  import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
14
14
  /**
@@ -6,9 +6,9 @@
6
6
  * `Type:`, profile classification, or URI-scheme inference for
7
7
  * Reference-shape entries — any attribute that's known to the core
8
8
  * hierarchy but not allowed on that type fires MSL-T022 as a warning.
9
- * Unknown attributes (neither universal nor core-typed) fall through
10
- * to the existing MSL-R010 unknown-attribute warning in
11
- * `validator/mod.ts`.
9
+ * Unknown attributes (neither universal, core relation keys, nor
10
+ * core-typed) fall through to the existing MSL-R010 unknown-attribute
11
+ * warning in `validator/mod.ts`.
12
12
  */
13
13
  import { attributesForType, CORE_TYPE_SCOPED_ATTRS, UNIVERSAL_ATTRIBUTE_KEYS, } from "../model/mod.js";
14
14
  import { resolvedCoreType } from "./type_resolution.js";
@@ -5,7 +5,10 @@
5
5
  * Stage 2 (type classification — {@linkcode classifyEntriesStage}),
6
6
  * Stage 2.5 (list-value normalization — {@linkcode normalizeListValues}),
7
7
  * Stage 3 (typed attribute validation — {@linkcode validateAttributesForEntry}),
8
- * and Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}).
8
+ * Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}),
9
+ * then the Gherkin checks: Stage 4.4 (MSL-B062), Stage 4.5 (scenario
10
+ * locators), Stage 4.6 (procedure steps, MSL-B063) and Stage 4.7 (block
11
+ * roles, MSL-B064 to MSL-B068).
9
12
  */
10
13
  import type { CaptionConventions, Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
11
14
  /** Result of running the full validator pipeline. */
@@ -19,12 +22,14 @@ export interface PipelineResult {
19
22
  /** Options for {@linkcode runPipeline}. */
20
23
  export interface PipelineOptions {
21
24
  /**
22
- * When `false`, suppress MSL-L006 ("link target does not resolve") from
23
- * Stage 4 output. Use this when the validator is running against a subset
25
+ * When `false`, suppress cross-entry TYPL-009/010/011 from Stage 1,
26
+ * UXIL-016/017/018 from Stage 5, and MSL-L006 ("link target does not
27
+ * resolve") from Stage 4.
28
+ * Use this when the validator is running against a subset
24
29
  * of the project's files (e.g. `markspec check <file>`): file-local scope
25
30
  * cannot distinguish a typo from a valid cross-file target. MSL-L006 is
26
31
  * only meaningful when the full entry set is available (LSP, `compile`).
27
- * Defaults to `true` (full-project scope — emit MSL-L006 normally).
32
+ * Defaults to `true` (full-project scope — emit these codes normally).
28
33
  */
29
34
  readonly projectWide?: boolean;
30
35
  /**
@@ -53,18 +58,7 @@ export interface PipelineOptions {
53
58
  * and non-empty, MSL-C072 is checked for each entry. Defaults to no
54
59
  * conventions (rule inactive).
55
60
  * @param opts - Pipeline options. Pass `{ projectWide: false }` when
56
- * validating a file-local subset so MSL-L006 is suppressed.
61
+ * validating a file-local subset to suppress cross-entry diagnostics.
57
62
  */
58
63
  export declare function runPipeline(entries: readonly Entry[], profile: EffectiveProfile | null, captionConventions?: CaptionConventions, opts?: PipelineOptions): PipelineResult;
59
- /**
60
- * Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes
61
- * the loaded profile declares — Stage 3 validates those directly, so the
62
- * core-only check would be noise. Returns `diagnostics` unchanged when no
63
- * profile is loaded.
64
- *
65
- * Exported so callers that run only Stage 1 (e.g. the compiler's diagnostic
66
- * pass) suppress the same false positives the full {@linkcode runPipeline}
67
- * does, keeping LSP/MCP diagnostics consistent with the `validate` command.
68
- */
69
- export declare function suppressDeclaredAttrR010(diagnostics: readonly Diagnostic[], entries: readonly Entry[], profile: EffectiveProfile | null): readonly Diagnostic[];
70
64
  //# sourceMappingURL=pipeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAqCzB,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,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;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,EAChC,kBAAkB,GAAE,kBAAuB,EAC3C,IAAI,GAAE,eAAoB,GACzB,cAAc,CA4KhB"}
@@ -5,7 +5,10 @@
5
5
  * Stage 2 (type classification — {@linkcode classifyEntriesStage}),
6
6
  * Stage 2.5 (list-value normalization — {@linkcode normalizeListValues}),
7
7
  * Stage 3 (typed attribute validation — {@linkcode validateAttributesForEntry}),
8
- * and Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}).
8
+ * Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}),
9
+ * then the Gherkin checks: Stage 4.4 (MSL-B062), Stage 4.5 (scenario
10
+ * locators), Stage 4.6 (procedure steps, MSL-B063) and Stage 4.7 (block
11
+ * roles, MSL-B064 to MSL-B068).
9
12
  */
10
13
  import { CORE_DISCIPLINE_REGISTRY, emittableEntries, makeDisplayId, } from "../model/mod.js";
11
14
  import { validate } from "./mod.js";
@@ -23,11 +26,19 @@ import { validateCaptionConvention } from "./caption_convention.js";
23
26
  import { validateDiscipline } from "./discipline.js";
24
27
  import { buildEffectiveDisciplineRegistry } from "../profile/discipline_registry.js";
25
28
  import { validateUxilFamily } from "./uxil_family.js";
26
- /** Cross-entry uxil codes suppressed under file-local scope (#727): a
29
+ import { validateLocators } from "./locators.js";
30
+ import { checkBlockRoles } from "./block_role.js";
31
+ import { checkProcedureSteps } from "./procedure.js";
32
+ import { checkFeatureParse } from "./feature_parse.js";
33
+ /** Cross-entry DSL codes suppressed under file-local scope: a
27
34
  * subset registry cannot distinguish a dangling reference from an
28
35
  * unchecked file — the same false-positive class the MSL-L006 filter
29
- * guards. Entry-local UXIL codes are unaffected. */
30
- const FILE_LOCAL_SUPPRESSED_UXIL = new Set([
36
+ * guards. Suppress these even when the cause is inside the subset,
37
+ * matching uxil's scope policy. Parser diagnostics are unaffected. */
38
+ const FILE_LOCAL_SUPPRESSED_DSL = new Set([
39
+ "TYPL-009",
40
+ "TYPL-010",
41
+ "TYPL-011",
31
42
  "UXIL-016",
32
43
  "UXIL-017",
33
44
  "UXIL-018",
@@ -48,7 +59,7 @@ const FILE_LOCAL_SUPPRESSED_UXIL = new Set([
48
59
  * and non-empty, MSL-C072 is checked for each entry. Defaults to no
49
60
  * conventions (rule inactive).
50
61
  * @param opts - Pipeline options. Pass `{ projectWide: false }` when
51
- * validating a file-local subset so MSL-L006 is suppressed.
62
+ * validating a file-local subset to suppress cross-entry diagnostics.
52
63
  */
53
64
  export function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
54
65
  const diagnostics = [];
@@ -164,19 +175,31 @@ export function runPipeline(entries, profile, captionConventions = {}, opts = {}
164
175
  : stage4.filter((d) => d.code !== "MSL-L006" && d.code !== "MSL-T014"));
165
176
  }
166
177
  }
178
+ // Stage 4.4 — Gherkin blocks that do not parse (MSL-B062, epic #915).
179
+ diagnostics.push(...checkFeatureParse(entries));
180
+ // Stage 4.5 — scenario locators and scenario names (epic #915). Runs
181
+ // on the classified entries so criteria-bearing types resolve; targets
182
+ // resolve against the full list, diagnostics come from the emittable
183
+ // entries only. An unresolved target raises MSL-L006 (Stage 4), never
184
+ // MSL-L007, so no file-local filter is needed here.
185
+ diagnostics.push(...validateLocators(finalEntries, profile));
186
+ // Stage 4.6 — Gherkin procedure steps with no expected result (MSL-B063).
187
+ // Only Test entries are checked; unclassified entries are classified first.
188
+ diagnostics.push(...checkProcedureSteps(finalEntries, profile));
189
+ // Stage 4.7 — Gherkin block roles (MSL-B064 warning, MSL-B065..B068 info).
190
+ // Unclassified entries are classified first, as in Stage 4.6.
191
+ diagnostics.push(...checkBlockRoles(finalEntries, profile));
167
192
  // Stage 5 — uxil diagnostics family (S9 #727). Inert unless some profile
168
193
  // tier designates a declaring type (`declares: ux-surface`). Receives the
169
194
  // FULL classified list on purpose: the family derives its own #771
170
195
  // partition and its own declaring/citing split — registry scope is the
171
196
  // module's contract, not this orchestrator's (mirrors validateTypl).
172
- // File-local scope (projectWide: false) suppresses the cross-entry codes
173
- // (UXIL-016/017/018) — a subset registry cannot distinguish a dangling
174
- // reference from an unchecked file, the same false-positive class the
175
- // MSL-L006 suppression guards (#727 review).
176
197
  const uxilDiagnostics = validateUxilFamily(finalEntries, profile);
177
- diagnostics.push(...(projectWide ? uxilDiagnostics : uxilDiagnostics.filter((d) => !FILE_LOCAL_SUPPRESSED_UXIL.has(d.code))));
178
- const valid = !diagnostics.some((d) => d.severity === "error");
179
- return { entries: finalEntries, diagnostics, valid };
198
+ diagnostics.push(...uxilDiagnostics);
199
+ // Apply the same scope policy to Stage 1's typl and Stage 5's uxil.
200
+ const scopedDiagnostics = projectWide ? diagnostics : diagnostics.filter((d) => !FILE_LOCAL_SUPPRESSED_DSL.has(d.code));
201
+ const valid = !scopedDiagnostics.some((d) => d.severity === "error");
202
+ return { entries: finalEntries, diagnostics: scopedDiagnostics, valid };
180
203
  }
181
204
  /**
182
205
  * Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes
@@ -184,11 +207,9 @@ export function runPipeline(entries, profile, captionConventions = {}, opts = {}
184
207
  * core-only check would be noise. Returns `diagnostics` unchanged when no
185
208
  * profile is loaded.
186
209
  *
187
- * Exported so callers that run only Stage 1 (e.g. the compiler's diagnostic
188
- * pass) suppress the same false positives the full {@linkcode runPipeline}
189
- * does, keeping LSP/MCP diagnostics consistent with the `validate` command.
210
+ * Used by {@linkcode runPipeline} Stage 1 only.
190
211
  */
191
- export function suppressDeclaredAttrR010(diagnostics, entries, profile) {
212
+ function suppressDeclaredAttrR010(diagnostics, entries, profile) {
192
213
  if (profile === null)
193
214
  return diagnostics;
194
215
  const declared = collectAllProfileAttributes(entries, profile);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module core/validator/procedure
3
+ *
4
+ * `MSL-B063` (warning): a step of a Gherkin procedure has actions and no
5
+ * expected result (epic #915). Only entries whose type is, or extends, core
6
+ * `Test` are checked, because the procedure view belongs to Test entries.
7
+ * In a Requirement the block is a criterion, which is another check.
8
+ *
9
+ * Each `feature` or `gherkin` block is checked in a top-level block or in a
10
+ * list item at any depth, as for `MSL-B062`. A block that has a
11
+ * `parseError` or no `feature` is skipped: `MSL-B062` reports the first, and
12
+ * the second means the Gherkin parser was not loaded. Upstream entries are
13
+ * not checked (`emittableEntries`).
14
+ *
15
+ * The warning is reported at the file line of the last action of the step,
16
+ * in column 1. An entry without `entry.type` is classified with the profile
17
+ * first, so callers may pass classified or unclassified entries.
18
+ */
19
+ import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
20
+ /** Report one MSL-B063 warning per procedure step with no expected result. */
21
+ export declare function checkProcedureSteps(entries: readonly Entry[], profile: EffectiveProfile | null): Diagnostic[];
22
+ //# sourceMappingURL=procedure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"procedure.d.ts","sourceRoot":"","sources":["../../src/validator/procedure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAQ3E,8EAA8E;AAC9E,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,UAAU,EAAE,CA6Bd"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @module core/validator/procedure
3
+ *
4
+ * `MSL-B063` (warning): a step of a Gherkin procedure has actions and no
5
+ * expected result (epic #915). Only entries whose type is, or extends, core
6
+ * `Test` are checked, because the procedure view belongs to Test entries.
7
+ * In a Requirement the block is a criterion, which is another check.
8
+ *
9
+ * Each `feature` or `gherkin` block is checked in a top-level block or in a
10
+ * list item at any depth, as for `MSL-B062`. A block that has a
11
+ * `parseError` or no `feature` is skipped: `MSL-B062` reports the first, and
12
+ * the second means the Gherkin parser was not loaded. Upstream entries are
13
+ * not checked (`emittableEntries`).
14
+ *
15
+ * The warning is reported at the file line of the last action of the step,
16
+ * in column 1. An entry without `entry.type` is classified with the profile
17
+ * first, so callers may pass classified or unclassified entries.
18
+ */
19
+ import { emittableEntries } from "../model/mod.js";
20
+ import { isTestEntry } from "../criteria/scenarios.js";
21
+ import { scenarioProcedure } from "../gherkin/procedure.js";
22
+ import { featureFileLine } from "../gherkin/position.js";
23
+ import { featureNodes } from "./feature_parse.js";
24
+ import { withType } from "./locators.js";
25
+ /** Report one MSL-B063 warning per procedure step with no expected result. */
26
+ export function checkProcedureSteps(entries, profile) {
27
+ const diagnostics = [];
28
+ for (const candidate of emittableEntries(entries)) {
29
+ // Classify an unclassified entry, as `validateLocators` does.
30
+ const entry = withType(candidate, profile);
31
+ if (!isTestEntry(entry, profile))
32
+ continue;
33
+ for (const node of featureNodes(entry.bodyAst ?? [])) {
34
+ if (node.parseError !== undefined || node.feature === undefined)
35
+ continue;
36
+ for (const scenario of node.feature.scenarios) {
37
+ for (const step of scenarioProcedure(scenario).steps) {
38
+ const last = step.actions.at(-1);
39
+ if (last === undefined || step.expected.length > 0)
40
+ continue;
41
+ diagnostics.push({
42
+ code: "MSL-B063",
43
+ severity: "warning",
44
+ message: `${entry.displayId}: step ${step.n} of scenario ` +
45
+ `"${scenario.name}" has no expected result (no Then step); ` +
46
+ "add a Then step after the last action",
47
+ location: {
48
+ file: entry.location.file,
49
+ line: featureFileLine(entry, node, last.step.range.start.line),
50
+ column: 1,
51
+ },
52
+ });
53
+ }
54
+ }
55
+ }
56
+ }
57
+ return diagnostics;
58
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAwFzD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,KAAK,EAAE,EAC3B,GAAG,EAAE,SAAS,KAAK,EAAE,GACpB,SAAS,UAAU,EAAE,CA8HvB"}
1
+ {"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAyFzD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,KAAK,EAAE,EAC3B,GAAG,EAAE,SAAS,KAAK,EAAE,GACpB,SAAS,UAAU,EAAE,CA8HvB"}
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import { CORE_RELATIONS, CORE_TYPE_HIERARCHY, isUpstreamEntry, } from "../model/mod.js";
15
15
  import { resolvedCoreType } from "./type_resolution.js";
16
+ import { traceTarget } from "../refs/split.js";
16
17
  const TRACE_RULES = CORE_RELATIONS
17
18
  .filter((r) => r.targetTypes)
18
19
  .map((r) => ({ attr: r.attr, allowedTargetTypes: r.targetTypes }));
@@ -107,7 +108,7 @@ export function validateTraceTargetTypes(emittable, all) {
107
108
  for (const attr of entry.rawAttributes) {
108
109
  if (attr.key !== "Supersedes")
109
110
  continue;
110
- const target = attr.value.trim();
111
+ const target = traceTarget(attr.value);
111
112
  const resolved = byId.get(target) ?? byDisplayId.get(target);
112
113
  if (!resolved)
113
114
  continue;
@@ -126,7 +127,7 @@ export function validateTraceTargetTypes(emittable, all) {
126
127
  for (const attr of entry.rawAttributes) {
127
128
  if (attr.key !== rule.attr)
128
129
  continue;
129
- const target = attr.value.trim();
130
+ const target = traceTarget(attr.value);
130
131
  const resolved = byId.get(target) ?? byDisplayId.get(target);
131
132
  if (!resolved)
132
133
  continue;
@@ -166,7 +167,7 @@ export function validateTraceTargetTypes(emittable, all) {
166
167
  for (const attr of entry.rawAttributes) {
167
168
  if (attr.key !== "Caused-by")
168
169
  continue;
169
- const target = attr.value.trim();
170
+ const target = traceTarget(attr.value);
170
171
  const resolved = byId.get(target) ?? byDisplayId.get(target);
171
172
  if (!resolved)
172
173
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"traceability.d.ts","sourceRoot":"","sources":["../../src/validator/traceability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,KAAK,EAEV,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAehC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,KAAK,EACb,QAAQ,EAAE,SAAS,aAAa,EAAE,GACjC,OAAO,CAST;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EACjC,WAAW,GAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAa,EACnD,mBAAmB,GAAE,SAAS,MAAM,EAAO,GAC1C,UAAU,EAAE,CA+Gd"}
1
+ {"version":3,"file":"traceability.d.ts","sourceRoot":"","sources":["../../src/validator/traceability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,KAAK,EAEV,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAGzB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAehC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,KAAK,EACb,QAAQ,EAAE,SAAS,aAAa,EAAE,GACjC,OAAO,CAST;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EACjC,WAAW,GAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAa,EACnD,mBAAmB,GAAE,SAAS,MAAM,EAAO,GAC1C,UAAU,EAAE,CAiHd"}
@@ -21,6 +21,7 @@
21
21
  * never have declared outgoing links.
22
22
  */
23
23
  import { isUpstreamEntry, URI_SCHEME_RE, } from "../model/mod.js";
24
+ import { traceTarget } from "../refs/split.js";
24
25
  /**
25
26
  * Effective trace rules for an entry: type-scope rules only.
26
27
  * Type-scope rules are applied only when the entry is classified.
@@ -127,7 +128,9 @@ export function validateTraceabilityForEntry(entry, profile, graph, byDisplayId
127
128
  // MSL-L004 target match + MSL-L006 existence, for each resolved value.
128
129
  // Resolve by ULID (graph) first, then by display ID (byDisplayId) — the
129
130
  // dual-resolution spine (issue #593).
130
- for (const v of values) {
131
+ // A bracket locator (`A [x]`) addresses part of the target; the
132
+ // existence check uses the target only (epic #915).
133
+ for (const v of values.map(traceTarget)) {
131
134
  const target = graph.get(v) ?? byDisplayId.get(v);
132
135
  if (!target) {
133
136
  // Scheme-qualified URIs are intentionally external — never local
@@ -14,6 +14,8 @@
14
14
  * 5. Reference-shape URI scheme inference (ADR-003 §Part 6).
15
15
  * 6. Discriminating-attribute presence (Verifies → Test,
16
16
  * Schema-language → Contract, …).
17
+ * 6a. `.feature` header entries only: Feature / Rule → Requirement,
18
+ * Scenario → Test.
17
19
  *
18
20
  * Step 7 (document directive) is not consulted here; step 8
19
21
  * (display-ID shape) has its own warning-emitting stage in
@@ -40,7 +42,7 @@ export declare function inferTypeFromDisplayIdPrefix(displayId: string): string
40
42
  export declare function explicitType(entry: Entry): string | undefined;
41
43
  /** Which step of the §1.3.1 chain resolved a type. Steps 7 and 8 are
42
44
  * not reported here; step 8 has its own warning-emitting stage. */
43
- export type TypeResolutionStep = 1 | 2 | 3 | 4 | 5 | 6;
45
+ export type TypeResolutionStep = 1 | 2 | 3 | 4 | 5 | 6 | "6a";
44
46
  /** A type together with the step of the §1.3.1 chain that resolved it. */
45
47
  export interface ResolvedTypeWithProvenance {
46
48
  readonly type: string;
@@ -49,7 +51,7 @@ export interface ResolvedTypeWithProvenance {
49
51
  /**
50
52
  * Resolve an entry's effective core type and report which step of the
51
53
  * spec §1.3.1 chain matched. First match wins. Returns `undefined` when
52
- * no step in {1..6} resolves to a known core type — callers may then
54
+ * no step in {1..6a} resolves to a known core type — callers may then
53
55
  * consult late-stage step-8 inference (`inferTypeFromDisplayIdShape`)
54
56
  * or treat the entry as unclassified (fallback to `Item`).
55
57
  */
@@ -59,7 +61,7 @@ export declare function resolvedCoreTypeWithProvenance(entry: Entry, profile?: E
59
61
  * wrapper around {@linkcode resolvedCoreTypeWithProvenance} for callers
60
62
  * that don't need to know which step matched.
61
63
  *
62
- * Returns `undefined` when no step in {1..6} resolves to a known core
64
+ * Returns `undefined` when no step in {1..6a} resolves to a known core
63
65
  * type. The caller decides whether to skip validation, fall back to a
64
66
  * less specific check, or report on the unclassified state.
65
67
  */
@@ -1 +1 @@
1
- {"version":3,"file":"type_resolution.d.ts","sourceRoot":"","sources":["../../src/validator/type_resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAuB/D;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAChB,MAAM,GA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QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAkBD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,0BAA0B,GAAG,SAAS,CAsDxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,GAAG,SAAS,CAEpB"}
@@ -14,6 +14,8 @@
14
14
  * 5. Reference-shape URI scheme inference (ADR-003 §Part 6).
15
15
  * 6. Discriminating-attribute presence (Verifies → Test,
16
16
  * Schema-language → Contract, …).
17
+ * 6a. `.feature` header entries only: Feature / Rule → Requirement,
18
+ * Scenario → Test.
17
19
  *
18
20
  * Step 7 (document directive) is not consulted here; step 8
19
21
  * (display-ID shape) has its own warning-emitting stage in
@@ -95,7 +97,7 @@ function profileTypeToCore(typeName, profile) {
95
97
  /**
96
98
  * Resolve an entry's effective core type and report which step of the
97
99
  * spec §1.3.1 chain matched. First match wins. Returns `undefined` when
98
- * no step in {1..6} resolves to a known core type — callers may then
100
+ * no step in {1..6a} resolves to a known core type — callers may then
99
101
  * consult late-stage step-8 inference (`inferTypeFromDisplayIdShape`)
100
102
  * or treat the entry as unclassified (fallback to `Item`).
101
103
  */
@@ -146,6 +148,16 @@ export function resolvedCoreTypeWithProvenance(entry, profile) {
146
148
  if (fromDiscriminator && CORE_TYPE_HIERARCHY[fromDiscriminator]) {
147
149
  return { type: fromDiscriminator, step: 6 };
148
150
  }
151
+ // Step 6a: node kind of a `.feature` header entry (epic #915 Case B) —
152
+ // Feature and Rule are Requirements, Scenario is a Test. Applies only to
153
+ // entries built from `.feature` files; Markdown and source-file entries
154
+ // never reach it.
155
+ if (entry.source.kind === "feature-file") {
156
+ return {
157
+ type: entry.source.node === "scenario" ? "Test" : "Requirement",
158
+ step: "6a",
159
+ };
160
+ }
149
161
  return undefined;
150
162
  }
151
163
  /**
@@ -153,7 +165,7 @@ export function resolvedCoreTypeWithProvenance(entry, profile) {
153
165
  * wrapper around {@linkcode resolvedCoreTypeWithProvenance} for callers
154
166
  * that don't need to know which step matched.
155
167
  *
156
- * Returns `undefined` when no step in {1..6} resolves to a known core
168
+ * Returns `undefined` when no step in {1..6a} resolves to a known core
157
169
  * type. The caller decides whether to skip validation, fall back to a
158
170
  * less specific check, or report on the unclassified state.
159
171
  */
@@ -53,6 +53,15 @@ export declare function inferTypeFromLateStageChain(entry: Entry): readonly Diag
53
53
  * is plausibly a profile type, just unreachable in core-only mode.
54
54
  */
55
55
  export declare function validateCoreTypeAttribute(entry: Entry, profile: EffectiveProfile | null): readonly Diagnostic[];
56
+ /**
57
+ * The core type of a `.feature` header entry that no profile pattern
58
+ * classifies (epic #915 Case B). It is resolved through the type resolution
59
+ * chain without the profile, so `Source:` (step 3), the display-ID prefix
60
+ * (step 4) and a discriminating attribute (step 6) win over the node kind
61
+ * (step 6a: `Test` for a Scenario, `Requirement` for a Feature or a Rule).
62
+ * `undefined` for every other entry.
63
+ */
64
+ export declare function featureFileCoreType(entry: Entry): string | undefined;
56
65
  /** Result of classifying a single entry. */
57
66
  export interface ClassifyResult {
58
67
  /** The assigned type name, or `undefined` if un-classified. */
@@ -66,6 +75,8 @@ export interface ClassifyResult {
66
75
  * 1. Explicit `Type:` trailer attribute (if present).
67
76
  * 2. Display-ID pattern match across types whose `shape` matches
68
77
  * `entry.shape`.
78
+ * 3. For a `.feature` header entry that no pattern matched, the node
79
+ * kind (step 6a, {@linkcode featureFileCoreType}).
69
80
  *
70
81
  * Emits:
71
82
  * - `MSL-T001` when explicit `Type:` value is not in the profile's type
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validator/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAEhB,KAAK,EAEN,MAAM,iBAAiB,CAAC;A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;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,CAkBvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CAwBvB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAGpE;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,cAAc,CAwEhB;AAED,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GACxB,mBAAmB,CAkCrB"}
@@ -74,7 +74,8 @@ export function inferTypeFromLateStageChain(entry) {
74
74
  const resolved = resolvedCoreTypeWithProvenance(entry);
75
75
  if (!resolved)
76
76
  return [];
77
- if (resolved.step < 5)
77
+ // Step 6a is the silent default for `.feature` header entries.
78
+ if (resolved.step === "6a" || resolved.step < 5)
78
79
  return [];
79
80
  const source = resolved.step === 5
80
81
  ? "URI scheme"
@@ -126,6 +127,19 @@ export function validateCoreTypeAttribute(entry, profile) {
126
127
  location: entry.location,
127
128
  }];
128
129
  }
130
+ /**
131
+ * The core type of a `.feature` header entry that no profile pattern
132
+ * classifies (epic #915 Case B). It is resolved through the type resolution
133
+ * chain without the profile, so `Source:` (step 3), the display-ID prefix
134
+ * (step 4) and a discriminating attribute (step 6) win over the node kind
135
+ * (step 6a: `Test` for a Scenario, `Requirement` for a Feature or a Rule).
136
+ * `undefined` for every other entry.
137
+ */
138
+ export function featureFileCoreType(entry) {
139
+ if (entry.source.kind !== "feature-file")
140
+ return undefined;
141
+ return resolvedCoreTypeWithProvenance(entry)?.type;
142
+ }
129
143
  /**
130
144
  * Classify one {@linkcode Entry} against the profile's type vocabulary.
131
145
  *
@@ -133,6 +147,8 @@ export function validateCoreTypeAttribute(entry, profile) {
133
147
  * 1. Explicit `Type:` trailer attribute (if present).
134
148
  * 2. Display-ID pattern match across types whose `shape` matches
135
149
  * `entry.shape`.
150
+ * 3. For a `.feature` header entry that no pattern matched, the node
151
+ * kind (step 6a, {@linkcode featureFileCoreType}).
136
152
  *
137
153
  * Emits:
138
154
  * - `MSL-T001` when explicit `Type:` value is not in the profile's type
@@ -160,8 +176,9 @@ export function classifyEntry(entry, profile) {
160
176
  // 2. Display-ID pattern match across same-shape types (Authored only).
161
177
  // Reference entries use URI scheme or explicit Type: for classification;
162
178
  // matching display-id-patterns against their slug-style IDs is incorrect.
163
- if (entry.shape !== "Authored")
164
- return { type: undefined, diagnostics };
179
+ if (entry.shape !== "Authored") {
180
+ return { type: featureFileCoreType(entry), diagnostics };
181
+ }
165
182
  const matches = [];
166
183
  for (const [typeName, typeEntry] of profile.types) {
167
184
  const pattern = typeEntry.value.displayIdPattern.value;
@@ -189,7 +206,12 @@ export function classifyEntry(entry, profile) {
189
206
  });
190
207
  return { type: undefined, diagnostics };
191
208
  }
192
- // 0 matches. Strict mode → MSL-T003; permissive → OK.
209
+ // 0 matches. A `.feature` header entry falls back to step 6a (Feature and
210
+ // Rule are Requirements, Scenario is a Test) and is never un-classified.
211
+ const fromNode = featureFileCoreType(entry);
212
+ if (fromNode !== undefined)
213
+ return { type: fromNode, diagnostics };
214
+ // Strict mode → MSL-T003; permissive → OK.
193
215
  if (profile.types.size > 0) {
194
216
  diagnostics.push({
195
217
  code: "MSL-T003",
@@ -24,7 +24,7 @@
24
24
  * Upstream entries are uxil-inert (the #771 `emittableEntries` partition,
25
25
  * mirroring validateTypl). Entries are gated by `entry.type` when the
26
26
  * pipeline's Stage 2 already classified them, else by `classifyEntry` —
27
- * so the LSP path (which never runs Stage 2) gates identically; the
27
+ * so a caller that passes unclassified entries gates identically; the
28
28
  * classification diagnostics are deliberately dropped here (the pipeline
29
29
  * owns emitting those).
30
30
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftsys/markspec",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Markdown flavor and toolchain for traceable industrial documentation",
5
5
  "keywords": [
6
6
  "markdown",
@@ -29,6 +29,8 @@
29
29
  },
30
30
  "scripts": {},
31
31
  "dependencies": {
32
+ "@cucumber/gherkin": "42.0.1",
33
+ "@cucumber/messages": "34.2.1",
32
34
  "@dprint/formatter": "0.5.1",
33
35
  "@dprint/markdown": "0.20.0",
34
36
  "@types/mdast": "^4",
@@ -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;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC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
14
  exports.buildBodyAstWithTree = buildBodyAstWithTree;
15
15
  const remark_js_1 = require("../parser/remark.js");
16
16
  const line_endings_js_1 = require("../util/line_endings.js");
17
+ const load_js_1 = require("../gherkin/load.js");
18
+ const parse_js_1 = require("../gherkin/parse.js");
17
19
  /**
18
20
  * Build an InlineContent from verbatim source prose.
19
21
  * `storedText` is the verbatim source prose that `render` emits (§5.1
@@ -391,11 +393,23 @@ function mapMdastNode(node, body) {
391
393
  case "code": {
392
394
  const lang = node.lang ?? undefined; // empty string → undefined
393
395
  if (lang === "gherkin" || lang === "feature") {
394
- return {
395
- kind: "feature",
396
- source: node.value ?? "",
397
- range,
398
- };
396
+ const source = node.value ?? "";
397
+ const api = (0, load_js_1.loadedGherkin)();
398
+ if (!api)
399
+ return { kind: "feature", source, range };
400
+ const parsed = (0, parse_js_1.parseFeature)(api, source);
401
+ return parsed.ok
402
+ ? { kind: "feature", source, feature: parsed.feature, range }
403
+ : {
404
+ kind: "feature",
405
+ source,
406
+ parseError: {
407
+ line: parsed.line,
408
+ column: parsed.column,
409
+ message: parsed.message,
410
+ },
411
+ range,
412
+ };
399
413
  }
400
414
  return {
401
415
  kind: "code",
@@ -41,8 +41,8 @@ function deepEqualIgnoringRanges(a, b) {
41
41
  if (typeof a === "object" && typeof b === "object") {
42
42
  const ao = a;
43
43
  const bo = b;
44
- const ak = Object.keys(ao).filter((k) => k !== "range").sort();
45
- const bk = Object.keys(bo).filter((k) => k !== "range").sort();
44
+ const ak = comparedKeys(ao);
45
+ const bk = comparedKeys(bo);
46
46
  if (ak.length !== bk.length)
47
47
  return false;
48
48
  for (let i = 0; i < ak.length; i++) {
@@ -57,3 +57,15 @@ function deepEqualIgnoringRanges(a, b) {
57
57
  }
58
58
  return false;
59
59
  }
60
+ /**
61
+ * Keys compared for one object: every key except `range`. A `FeatureNode`
62
+ * also skips `feature` and `parseError`: both are pure functions of
63
+ * `source`, which is compared, and they exist only while the Gherkin parser
64
+ * is loaded. Comparing them would make equivalence depend on load timing.
65
+ */
66
+ function comparedKeys(node) {
67
+ const derived = node.kind === "feature";
68
+ return Object.keys(node)
69
+ .filter((k) => k !== "range" && !(derived && (k === "feature" || k === "parseError")))
70
+ .sort();
71
+ }