@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
@@ -16,6 +16,7 @@
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.normalizeListValues = normalizeListValues;
18
18
  const attributes_js_1 = require("./attributes.js");
19
+ const split_js_1 = require("../refs/split.js");
19
20
  const LIST_TYPES = new Set(["id-list", "tag-list"]);
20
21
  /**
21
22
  * Return a new Entry with list-typed attribute values split on commas. If no
@@ -28,7 +29,7 @@ function normalizeListValues(entry, profile) {
28
29
  for (const [name, values] of entry.typedAttributes) {
29
30
  const decl = scope.attributes.get(name);
30
31
  if (decl !== undefined && LIST_TYPES.has(decl.type)) {
31
- const split = splitListValues(values);
32
+ const split = splitListValues(values, decl.type === "id-list");
32
33
  if (!arraysEqual(split, values)) {
33
34
  rewritten.set(name, split);
34
35
  anyChange = true;
@@ -41,10 +42,14 @@ function normalizeListValues(entry, profile) {
41
42
  return entry;
42
43
  return { ...entry, typedAttributes: rewritten };
43
44
  }
44
- function splitListValues(values) {
45
+ function splitListValues(values, isTraceList) {
45
46
  const out = [];
46
47
  for (const v of values) {
47
- const parts = v.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
48
+ // In a trace list, commas inside a bracket locator (`A [x, y]`) do not
49
+ // split. Other lists (tag-list) split on every comma.
50
+ const parts = isTraceList
51
+ ? (0, split_js_1.splitTraceValues)(v)
52
+ : v.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
48
53
  if (parts.length === 0)
49
54
  continue;
50
55
  out.push(...parts);
@@ -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
  /**
@@ -7,9 +7,9 @@
7
7
  * `Type:`, profile classification, or URI-scheme inference for
8
8
  * Reference-shape entries — any attribute that's known to the core
9
9
  * hierarchy but not allowed on that type fires MSL-T022 as a warning.
10
- * Unknown attributes (neither universal nor core-typed) fall through
11
- * to the existing MSL-R010 unknown-attribute warning in
12
- * `validator/mod.ts`.
10
+ * Unknown attributes (neither universal, core relation keys, nor
11
+ * core-typed) fall through to the existing MSL-R010 unknown-attribute
12
+ * warning in `validator/mod.ts`.
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.validatePerTypeAttributes = validatePerTypeAttributes;
@@ -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,OAAO,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;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,CA8JhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CASvB"}
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AA6CzB,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,OAAO,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;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"}
@@ -6,11 +6,13 @@
6
6
  * Stage 2 (type classification — {@linkcode classifyEntriesStage}),
7
7
  * Stage 2.5 (list-value normalization — {@linkcode normalizeListValues}),
8
8
  * Stage 3 (typed attribute validation — {@linkcode validateAttributesForEntry}),
9
- * and Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}).
9
+ * Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}),
10
+ * then the Gherkin checks: Stage 4.4 (MSL-B062), Stage 4.5 (scenario
11
+ * locators), Stage 4.6 (procedure steps, MSL-B063) and Stage 4.7 (block
12
+ * roles, MSL-B064 to MSL-B068).
10
13
  */
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.runPipeline = runPipeline;
13
- exports.suppressDeclaredAttrR010 = suppressDeclaredAttrR010;
14
16
  const mod_js_1 = require("../model/mod.js");
15
17
  const mod_js_2 = require("./mod.js");
16
18
  const types_js_1 = require("./types.js");
@@ -27,11 +29,19 @@ const caption_convention_js_1 = require("./caption_convention.js");
27
29
  const discipline_js_1 = require("./discipline.js");
28
30
  const discipline_registry_js_1 = require("../profile/discipline_registry.js");
29
31
  const uxil_family_js_1 = require("./uxil_family.js");
30
- /** Cross-entry uxil codes suppressed under file-local scope (#727): a
32
+ const locators_js_1 = require("./locators.js");
33
+ const block_role_js_1 = require("./block_role.js");
34
+ const procedure_js_1 = require("./procedure.js");
35
+ const feature_parse_js_1 = require("./feature_parse.js");
36
+ /** Cross-entry DSL codes suppressed under file-local scope: a
31
37
  * subset registry cannot distinguish a dangling reference from an
32
38
  * unchecked file — the same false-positive class the MSL-L006 filter
33
- * guards. Entry-local UXIL codes are unaffected. */
34
- const FILE_LOCAL_SUPPRESSED_UXIL = new Set([
39
+ * guards. Suppress these even when the cause is inside the subset,
40
+ * matching uxil's scope policy. Parser diagnostics are unaffected. */
41
+ const FILE_LOCAL_SUPPRESSED_DSL = new Set([
42
+ "TYPL-009",
43
+ "TYPL-010",
44
+ "TYPL-011",
35
45
  "UXIL-016",
36
46
  "UXIL-017",
37
47
  "UXIL-018",
@@ -52,7 +62,7 @@ const FILE_LOCAL_SUPPRESSED_UXIL = new Set([
52
62
  * and non-empty, MSL-C072 is checked for each entry. Defaults to no
53
63
  * conventions (rule inactive).
54
64
  * @param opts - Pipeline options. Pass `{ projectWide: false }` when
55
- * validating a file-local subset so MSL-L006 is suppressed.
65
+ * validating a file-local subset to suppress cross-entry diagnostics.
56
66
  */
57
67
  function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
58
68
  const diagnostics = [];
@@ -168,19 +178,31 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
168
178
  : stage4.filter((d) => d.code !== "MSL-L006" && d.code !== "MSL-T014"));
169
179
  }
170
180
  }
181
+ // Stage 4.4 — Gherkin blocks that do not parse (MSL-B062, epic #915).
182
+ diagnostics.push(...(0, feature_parse_js_1.checkFeatureParse)(entries));
183
+ // Stage 4.5 — scenario locators and scenario names (epic #915). Runs
184
+ // on the classified entries so criteria-bearing types resolve; targets
185
+ // resolve against the full list, diagnostics come from the emittable
186
+ // entries only. An unresolved target raises MSL-L006 (Stage 4), never
187
+ // MSL-L007, so no file-local filter is needed here.
188
+ diagnostics.push(...(0, locators_js_1.validateLocators)(finalEntries, profile));
189
+ // Stage 4.6 — Gherkin procedure steps with no expected result (MSL-B063).
190
+ // Only Test entries are checked; unclassified entries are classified first.
191
+ diagnostics.push(...(0, procedure_js_1.checkProcedureSteps)(finalEntries, profile));
192
+ // Stage 4.7 — Gherkin block roles (MSL-B064 warning, MSL-B065..B068 info).
193
+ // Unclassified entries are classified first, as in Stage 4.6.
194
+ diagnostics.push(...(0, block_role_js_1.checkBlockRoles)(finalEntries, profile));
171
195
  // Stage 5 — uxil diagnostics family (S9 #727). Inert unless some profile
172
196
  // tier designates a declaring type (`declares: ux-surface`). Receives the
173
197
  // FULL classified list on purpose: the family derives its own #771
174
198
  // partition and its own declaring/citing split — registry scope is the
175
199
  // module's contract, not this orchestrator's (mirrors validateTypl).
176
- // File-local scope (projectWide: false) suppresses the cross-entry codes
177
- // (UXIL-016/017/018) — a subset registry cannot distinguish a dangling
178
- // reference from an unchecked file, the same false-positive class the
179
- // MSL-L006 suppression guards (#727 review).
180
200
  const uxilDiagnostics = (0, uxil_family_js_1.validateUxilFamily)(finalEntries, profile);
181
- diagnostics.push(...(projectWide ? uxilDiagnostics : uxilDiagnostics.filter((d) => !FILE_LOCAL_SUPPRESSED_UXIL.has(d.code))));
182
- const valid = !diagnostics.some((d) => d.severity === "error");
183
- return { entries: finalEntries, diagnostics, valid };
201
+ diagnostics.push(...uxilDiagnostics);
202
+ // Apply the same scope policy to Stage 1's typl and Stage 5's uxil.
203
+ const scopedDiagnostics = projectWide ? diagnostics : diagnostics.filter((d) => !FILE_LOCAL_SUPPRESSED_DSL.has(d.code));
204
+ const valid = !scopedDiagnostics.some((d) => d.severity === "error");
205
+ return { entries: finalEntries, diagnostics: scopedDiagnostics, valid };
184
206
  }
185
207
  /**
186
208
  * Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes
@@ -188,9 +210,7 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
188
210
  * core-only check would be noise. Returns `diagnostics` unchanged when no
189
211
  * profile is loaded.
190
212
  *
191
- * Exported so callers that run only Stage 1 (e.g. the compiler's diagnostic
192
- * pass) suppress the same false positives the full {@linkcode runPipeline}
193
- * does, keeping LSP/MCP diagnostics consistent with the `validate` command.
213
+ * Used by {@linkcode runPipeline} Stage 1 only.
194
214
  */
195
215
  function suppressDeclaredAttrR010(diagnostics, entries, profile) {
196
216
  if (profile === null)
@@ -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,61 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/validator/procedure
4
+ *
5
+ * `MSL-B063` (warning): a step of a Gherkin procedure has actions and no
6
+ * expected result (epic #915). Only entries whose type is, or extends, core
7
+ * `Test` are checked, because the procedure view belongs to Test entries.
8
+ * In a Requirement the block is a criterion, which is another check.
9
+ *
10
+ * Each `feature` or `gherkin` block is checked in a top-level block or in a
11
+ * list item at any depth, as for `MSL-B062`. A block that has a
12
+ * `parseError` or no `feature` is skipped: `MSL-B062` reports the first, and
13
+ * the second means the Gherkin parser was not loaded. Upstream entries are
14
+ * not checked (`emittableEntries`).
15
+ *
16
+ * The warning is reported at the file line of the last action of the step,
17
+ * in column 1. An entry without `entry.type` is classified with the profile
18
+ * first, so callers may pass classified or unclassified entries.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.checkProcedureSteps = checkProcedureSteps;
22
+ const mod_js_1 = require("../model/mod.js");
23
+ const scenarios_js_1 = require("../criteria/scenarios.js");
24
+ const procedure_js_1 = require("../gherkin/procedure.js");
25
+ const position_js_1 = require("../gherkin/position.js");
26
+ const feature_parse_js_1 = require("./feature_parse.js");
27
+ const locators_js_1 = require("./locators.js");
28
+ /** Report one MSL-B063 warning per procedure step with no expected result. */
29
+ function checkProcedureSteps(entries, profile) {
30
+ const diagnostics = [];
31
+ for (const candidate of (0, mod_js_1.emittableEntries)(entries)) {
32
+ // Classify an unclassified entry, as `validateLocators` does.
33
+ const entry = (0, locators_js_1.withType)(candidate, profile);
34
+ if (!(0, scenarios_js_1.isTestEntry)(entry, profile))
35
+ continue;
36
+ for (const node of (0, feature_parse_js_1.featureNodes)(entry.bodyAst ?? [])) {
37
+ if (node.parseError !== undefined || node.feature === undefined)
38
+ continue;
39
+ for (const scenario of node.feature.scenarios) {
40
+ for (const step of (0, procedure_js_1.scenarioProcedure)(scenario).steps) {
41
+ const last = step.actions.at(-1);
42
+ if (last === undefined || step.expected.length > 0)
43
+ continue;
44
+ diagnostics.push({
45
+ code: "MSL-B063",
46
+ severity: "warning",
47
+ message: `${entry.displayId}: step ${step.n} of scenario ` +
48
+ `"${scenario.name}" has no expected result (no Then step); ` +
49
+ "add a Then step after the last action",
50
+ location: {
51
+ file: entry.location.file,
52
+ line: (0, position_js_1.featureFileLine)(entry, node, last.step.range.start.line),
53
+ column: 1,
54
+ },
55
+ });
56
+ }
57
+ }
58
+ }
59
+ }
60
+ return diagnostics;
61
+ }
@@ -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"}
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.validateTraceTargetTypes = validateTraceTargetTypes;
17
17
  const mod_js_1 = require("../model/mod.js");
18
18
  const type_resolution_js_1 = require("./type_resolution.js");
19
+ const split_js_1 = require("../refs/split.js");
19
20
  const TRACE_RULES = mod_js_1.CORE_RELATIONS
20
21
  .filter((r) => r.targetTypes)
21
22
  .map((r) => ({ attr: r.attr, allowedTargetTypes: r.targetTypes }));
@@ -110,7 +111,7 @@ function validateTraceTargetTypes(emittable, all) {
110
111
  for (const attr of entry.rawAttributes) {
111
112
  if (attr.key !== "Supersedes")
112
113
  continue;
113
- const target = attr.value.trim();
114
+ const target = (0, split_js_1.traceTarget)(attr.value);
114
115
  const resolved = byId.get(target) ?? byDisplayId.get(target);
115
116
  if (!resolved)
116
117
  continue;
@@ -129,7 +130,7 @@ function validateTraceTargetTypes(emittable, all) {
129
130
  for (const attr of entry.rawAttributes) {
130
131
  if (attr.key !== rule.attr)
131
132
  continue;
132
- const target = attr.value.trim();
133
+ const target = (0, split_js_1.traceTarget)(attr.value);
133
134
  const resolved = byId.get(target) ?? byDisplayId.get(target);
134
135
  if (!resolved)
135
136
  continue;
@@ -169,7 +170,7 @@ function validateTraceTargetTypes(emittable, all) {
169
170
  for (const attr of entry.rawAttributes) {
170
171
  if (attr.key !== "Caused-by")
171
172
  continue;
172
- const target = attr.value.trim();
173
+ const target = (0, split_js_1.traceTarget)(attr.value);
173
174
  const resolved = byId.get(target) ?? byDisplayId.get(target);
174
175
  if (!resolved)
175
176
  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"}
@@ -26,6 +26,7 @@ exports.effectiveTraceRules = effectiveTraceRules;
26
26
  exports.matchesAnyTarget = matchesAnyTarget;
27
27
  exports.validateTraceabilityForEntry = validateTraceabilityForEntry;
28
28
  const mod_js_1 = require("../model/mod.js");
29
+ const split_js_1 = require("../refs/split.js");
29
30
  /**
30
31
  * Effective trace rules for an entry: type-scope rules only.
31
32
  * Type-scope rules are applied only when the entry is classified.
@@ -132,7 +133,9 @@ function validateTraceabilityForEntry(entry, profile, graph, byDisplayId = new M
132
133
  // MSL-L004 target match + MSL-L006 existence, for each resolved value.
133
134
  // Resolve by ULID (graph) first, then by display ID (byDisplayId) — the
134
135
  // dual-resolution spine (issue #593).
135
- for (const v of values) {
136
+ // A bracket locator (`A [x]`) addresses part of the target; the
137
+ // existence check uses the target only (epic #915).
138
+ for (const v of values.map(split_js_1.traceTarget)) {
136
139
  const target = graph.get(v) ?? byDisplayId.get(v);
137
140
  if (!target) {
138
141
  // 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,GAAG,SAAS,CAWpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAO7D;AAYD;mEACmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,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,CA4CxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,GAAG,SAAS,CAEpB"}
1
+ {"version":3,"file":"type_resolution.d.ts","sourceRoot":"","sources":["../../src/validator/type_resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAuB/D;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAO7D;AAYD;mEACmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAE9D,0EAA0E;AAC1E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,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"}
@@ -15,6 +15,8 @@
15
15
  * 5. Reference-shape URI scheme inference (ADR-003 §Part 6).
16
16
  * 6. Discriminating-attribute presence (Verifies → Test,
17
17
  * Schema-language → Contract, …).
18
+ * 6a. `.feature` header entries only: Feature / Rule → Requirement,
19
+ * Scenario → Test.
18
20
  *
19
21
  * Step 7 (document directive) is not consulted here; step 8
20
22
  * (display-ID shape) has its own warning-emitting stage in
@@ -101,7 +103,7 @@ function profileTypeToCore(typeName, profile) {
101
103
  /**
102
104
  * Resolve an entry's effective core type and report which step of the
103
105
  * spec §1.3.1 chain matched. First match wins. Returns `undefined` when
104
- * no step in {1..6} resolves to a known core type — callers may then
106
+ * no step in {1..6a} resolves to a known core type — callers may then
105
107
  * consult late-stage step-8 inference (`inferTypeFromDisplayIdShape`)
106
108
  * or treat the entry as unclassified (fallback to `Item`).
107
109
  */
@@ -152,6 +154,16 @@ function resolvedCoreTypeWithProvenance(entry, profile) {
152
154
  if (fromDiscriminator && mod_js_1.CORE_TYPE_HIERARCHY[fromDiscriminator]) {
153
155
  return { type: fromDiscriminator, step: 6 };
154
156
  }
157
+ // Step 6a: node kind of a `.feature` header entry (epic #915 Case B) —
158
+ // Feature and Rule are Requirements, Scenario is a Test. Applies only to
159
+ // entries built from `.feature` files; Markdown and source-file entries
160
+ // never reach it.
161
+ if (entry.source.kind === "feature-file") {
162
+ return {
163
+ type: entry.source.node === "scenario" ? "Test" : "Requirement",
164
+ step: "6a",
165
+ };
166
+ }
155
167
  return undefined;
156
168
  }
157
169
  /**
@@ -159,7 +171,7 @@ function resolvedCoreTypeWithProvenance(entry, profile) {
159
171
  * wrapper around {@linkcode resolvedCoreTypeWithProvenance} for callers
160
172
  * that don't need to know which step matched.
161
173
  *
162
- * Returns `undefined` when no step in {1..6} resolves to a known core
174
+ * Returns `undefined` when no step in {1..6a} resolves to a known core
163
175
  * type. The caller decides whether to skip validation, fall back to a
164
176
  * less specific check, or report on the unclassified state.
165
177
  */
@@ -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;AAwBzB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,CAWvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,CAiBvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CAwBvB;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;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,cAAc,CAiEhB;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"}
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;AAwBzB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,CAWvB;AAED;;;;;;;;;;;;;;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"}
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.inferTypeFromDisplayIdShape = inferTypeFromDisplayIdShape;
13
13
  exports.inferTypeFromLateStageChain = inferTypeFromLateStageChain;
14
14
  exports.validateCoreTypeAttribute = validateCoreTypeAttribute;
15
+ exports.featureFileCoreType = featureFileCoreType;
15
16
  exports.classifyEntry = classifyEntry;
16
17
  exports.classifyEntriesStage = classifyEntriesStage;
17
18
  const mod_js_1 = require("../model/mod.js");
@@ -81,7 +82,8 @@ function inferTypeFromLateStageChain(entry) {
81
82
  const resolved = (0, type_resolution_js_1.resolvedCoreTypeWithProvenance)(entry);
82
83
  if (!resolved)
83
84
  return [];
84
- if (resolved.step < 5)
85
+ // Step 6a is the silent default for `.feature` header entries.
86
+ if (resolved.step === "6a" || resolved.step < 5)
85
87
  return [];
86
88
  const source = resolved.step === 5
87
89
  ? "URI scheme"
@@ -133,6 +135,19 @@ function validateCoreTypeAttribute(entry, profile) {
133
135
  location: entry.location,
134
136
  }];
135
137
  }
138
+ /**
139
+ * The core type of a `.feature` header entry that no profile pattern
140
+ * classifies (epic #915 Case B). It is resolved through the type resolution
141
+ * chain without the profile, so `Source:` (step 3), the display-ID prefix
142
+ * (step 4) and a discriminating attribute (step 6) win over the node kind
143
+ * (step 6a: `Test` for a Scenario, `Requirement` for a Feature or a Rule).
144
+ * `undefined` for every other entry.
145
+ */
146
+ function featureFileCoreType(entry) {
147
+ if (entry.source.kind !== "feature-file")
148
+ return undefined;
149
+ return (0, type_resolution_js_1.resolvedCoreTypeWithProvenance)(entry)?.type;
150
+ }
136
151
  /**
137
152
  * Classify one {@linkcode Entry} against the profile's type vocabulary.
138
153
  *
@@ -140,6 +155,8 @@ function validateCoreTypeAttribute(entry, profile) {
140
155
  * 1. Explicit `Type:` trailer attribute (if present).
141
156
  * 2. Display-ID pattern match across types whose `shape` matches
142
157
  * `entry.shape`.
158
+ * 3. For a `.feature` header entry that no pattern matched, the node
159
+ * kind (step 6a, {@linkcode featureFileCoreType}).
143
160
  *
144
161
  * Emits:
145
162
  * - `MSL-T001` when explicit `Type:` value is not in the profile's type
@@ -167,8 +184,9 @@ function classifyEntry(entry, profile) {
167
184
  // 2. Display-ID pattern match across same-shape types (Authored only).
168
185
  // Reference entries use URI scheme or explicit Type: for classification;
169
186
  // matching display-id-patterns against their slug-style IDs is incorrect.
170
- if (entry.shape !== "Authored")
171
- return { type: undefined, diagnostics };
187
+ if (entry.shape !== "Authored") {
188
+ return { type: featureFileCoreType(entry), diagnostics };
189
+ }
172
190
  const matches = [];
173
191
  for (const [typeName, typeEntry] of profile.types) {
174
192
  const pattern = typeEntry.value.displayIdPattern.value;
@@ -196,7 +214,12 @@ function classifyEntry(entry, profile) {
196
214
  });
197
215
  return { type: undefined, diagnostics };
198
216
  }
199
- // 0 matches. Strict mode → MSL-T003; permissive → OK.
217
+ // 0 matches. A `.feature` header entry falls back to step 6a (Feature and
218
+ // Rule are Requirements, Scenario is a Test) and is never un-classified.
219
+ const fromNode = featureFileCoreType(entry);
220
+ if (fromNode !== undefined)
221
+ return { type: fromNode, diagnostics };
222
+ // Strict mode → MSL-T003; permissive → OK.
200
223
  if (profile.types.size > 0) {
201
224
  diagnostics.push({
202
225
  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
  */