@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
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module criteria/scenarios
3
+ *
4
+ * Scenario index. Builds the `Entry.criteria` subset
5
+ * `{ form: "scenario", name, addressable, location }` from the fenced
6
+ * `gherkin` / `feature` blocks of an entry body.
7
+ *
8
+ * Source of the scenario names, per block:
9
+ *
10
+ * - the Gherkin AST (`FeatureNode.feature`) when it is present, in any spoken
11
+ * language;
12
+ * - otherwise the line scanner ({@linkcode scanScenarioNames}, English
13
+ * keywords only), when the block did not parse (`parseError`) or when the
14
+ * parser was not loaded at parse time.
15
+ *
16
+ * `parseFile` loads the parser before it parses a text with a gherkin fence,
17
+ * so every entry that reaches the compiler, the validator and the reporter
18
+ * carries the AST or a `parseError`, unless the parser import failed. The
19
+ * scanner for the not-loaded case covers that failure and code that builds
20
+ * entries with the synchronous `parse()` before any load.
21
+ */
22
+ import type { Criterion, EffectiveProfile, Entry } from "../model/mod.js";
23
+ /**
24
+ * Collect the scenario names of one Gherkin source text, in order.
25
+ * `line` is the 0-based line of the keyword within `source`. Lines between
26
+ * doc-string delimiters (`"""` or three backticks) are skipped. `Background`
27
+ * and `Rule` are not scenarios. Names are trimmed but not otherwise
28
+ * normalized.
29
+ */
30
+ export declare function scanScenarioNames(source: string): {
31
+ name: string;
32
+ line: number;
33
+ }[];
34
+ /**
35
+ * Build the criteria of an entry from its feature blocks, in source order.
36
+ * Only top-level fenced blocks of the body are indexed: a fence nested in a
37
+ * list item or another container yields no criteria.
38
+ * A block with an AST contributes the AST's scenarios; see the module comment
39
+ * for the fallback. Names are normalized with {@linkcode normalizeLocator}. The blocks of one
40
+ * entry form one scope: a normalized name that occurs more than once, and an
41
+ * empty name, are not addressable. `location.line` is the file-relative line
42
+ * of the keyword; `location.column` is always 1.
43
+ */
44
+ export declare function buildCriteria(entry: Entry): readonly Criterion[];
45
+ /** `true` when `entry`'s type resolves to core Requirement or Contract —
46
+ * the entries that carry criteria (epic #915, decision 3). Uses the
47
+ * profile extends chain when a profile is loaded, else the core hierarchy.
48
+ * An entry without a resolved type carries no criteria. */
49
+ export declare function isCriteriaBearing(entry: Entry, profile: EffectiveProfile | null | undefined): boolean;
50
+ /** `true` when `entry`'s type is, or extends, the core `Test` type — the
51
+ * entries whose `Verifies` links count for criterion coverage (epic #915,
52
+ * decision 2). Uses the profile extends chain when a profile is loaded,
53
+ * else the core hierarchy. */
54
+ export declare function isTestEntry(entry: Entry, profile: EffectiveProfile | null | undefined): boolean;
55
+ //# sourceMappingURL=scenarios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../src/criteria/scenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAU1E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAsBlC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,SAAS,EAAE,CA8BhE;AAKD;;;2DAG2D;AAC3D,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC3C,OAAO,CAQT;AAMD;;;8BAG8B;AAC9B,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC3C,OAAO,CAMT"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ /**
3
+ * @module criteria/scenarios
4
+ *
5
+ * Scenario index. Builds the `Entry.criteria` subset
6
+ * `{ form: "scenario", name, addressable, location }` from the fenced
7
+ * `gherkin` / `feature` blocks of an entry body.
8
+ *
9
+ * Source of the scenario names, per block:
10
+ *
11
+ * - the Gherkin AST (`FeatureNode.feature`) when it is present, in any spoken
12
+ * language;
13
+ * - otherwise the line scanner ({@linkcode scanScenarioNames}, English
14
+ * keywords only), when the block did not parse (`parseError`) or when the
15
+ * parser was not loaded at parse time.
16
+ *
17
+ * `parseFile` loads the parser before it parses a text with a gherkin fence,
18
+ * so every entry that reaches the compiler, the validator and the reporter
19
+ * carries the AST or a `parseError`, unless the parser import failed. The
20
+ * scanner for the not-loaded case covers that failure and code that builds
21
+ * entries with the synchronous `parse()` before any load.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.scanScenarioNames = scanScenarioNames;
25
+ exports.buildCriteria = buildCriteria;
26
+ exports.isCriteriaBearing = isCriteriaBearing;
27
+ exports.isTestEntry = isTestEntry;
28
+ const mod_js_1 = require("../model/mod.js");
29
+ const discipline_mode_js_1 = require("../profile/discipline_mode.js");
30
+ const split_js_1 = require("../refs/split.js");
31
+ const position_js_1 = require("../gherkin/position.js");
32
+ /** Matches a scenario-like keyword line. Group 2 is the raw name. */
33
+ const SCENARIO_RE = /^\s*(Scenario Outline|Scenario Template|Scenario|Example):\s*(.*)$/;
34
+ /**
35
+ * Collect the scenario names of one Gherkin source text, in order.
36
+ * `line` is the 0-based line of the keyword within `source`. Lines between
37
+ * doc-string delimiters (`"""` or three backticks) are skipped. `Background`
38
+ * and `Rule` are not scenarios. Names are trimmed but not otherwise
39
+ * normalized.
40
+ */
41
+ function scanScenarioNames(source) {
42
+ const found = [];
43
+ // The delimiter that opened the current doc string, if any. Only the same
44
+ // delimiter closes it.
45
+ let openDelimiter;
46
+ source.split(/\r?\n/).forEach((text, line) => {
47
+ const trimmed = text.trim();
48
+ const delimiter = trimmed.startsWith('"""')
49
+ ? '"""'
50
+ : trimmed.startsWith("```")
51
+ ? "```"
52
+ : undefined;
53
+ if (delimiter !== undefined) {
54
+ if (openDelimiter === undefined)
55
+ openDelimiter = delimiter;
56
+ else if (openDelimiter === delimiter)
57
+ openDelimiter = undefined;
58
+ return;
59
+ }
60
+ if (openDelimiter !== undefined)
61
+ return;
62
+ const match = SCENARIO_RE.exec(text);
63
+ if (match)
64
+ found.push({ name: match[2].trim(), line });
65
+ });
66
+ return found;
67
+ }
68
+ /**
69
+ * Build the criteria of an entry from its feature blocks, in source order.
70
+ * Only top-level fenced blocks of the body are indexed: a fence nested in a
71
+ * list item or another container yields no criteria.
72
+ * A block with an AST contributes the AST's scenarios; see the module comment
73
+ * for the fallback. Names are normalized with {@linkcode normalizeLocator}. The blocks of one
74
+ * entry form one scope: a normalized name that occurs more than once, and an
75
+ * empty name, are not addressable. `location.line` is the file-relative line
76
+ * of the keyword; `location.column` is always 1.
77
+ */
78
+ function buildCriteria(entry) {
79
+ const bodyStart = entry.bodyStartLine ?? (entry.location.line + 1);
80
+ const raw = [];
81
+ for (const block of entry.bodyAst ?? []) {
82
+ if (!isFeature(block))
83
+ continue;
84
+ if (block.feature !== undefined) {
85
+ for (const scenario of block.feature.scenarios) {
86
+ raw.push({
87
+ name: (0, split_js_1.normalizeLocator)(scenario.name),
88
+ line: (0, position_js_1.featureFileLine)(entry, block, scenario.range.start.line),
89
+ });
90
+ }
91
+ continue;
92
+ }
93
+ // Block did not parse, or the parser was not loaded: scan it. Body-
94
+ // relative range line 1 is `bodyStart`; the block's first source line
95
+ // follows the opening fence line.
96
+ const firstSourceLine = bodyStart + block.range.start.line;
97
+ for (const { name, line } of scanScenarioNames(block.source)) {
98
+ raw.push({ name: (0, split_js_1.normalizeLocator)(name), line: firstSourceLine + line });
99
+ }
100
+ }
101
+ const counts = new Map();
102
+ for (const { name } of raw)
103
+ counts.set(name, (counts.get(name) ?? 0) + 1);
104
+ return raw.map(({ name, line }) => ({
105
+ form: "scenario",
106
+ name,
107
+ addressable: name !== "" && counts.get(name) === 1,
108
+ location: { file: entry.location.file, line, column: 1 },
109
+ }));
110
+ }
111
+ /** Core types whose descendants carry criteria. */
112
+ const CRITERIA_BEARING_TYPES = ["Requirement", "Contract"];
113
+ /** `true` when `entry`'s type resolves to core Requirement or Contract —
114
+ * the entries that carry criteria (epic #915, decision 3). Uses the
115
+ * profile extends chain when a profile is loaded, else the core hierarchy.
116
+ * An entry without a resolved type carries no criteria. */
117
+ function isCriteriaBearing(entry, profile) {
118
+ const type = entry.type;
119
+ if (type === undefined)
120
+ return false;
121
+ return CRITERIA_BEARING_TYPES.some((core) => profile
122
+ ? (0, discipline_mode_js_1.extendsTransitively)(type, core, profile)
123
+ : (0, mod_js_1.descendantsOf)(core).has(type));
124
+ }
125
+ function isFeature(block) {
126
+ return block.kind === "feature";
127
+ }
128
+ /** `true` when `entry`'s type is, or extends, the core `Test` type — the
129
+ * entries whose `Verifies` links count for criterion coverage (epic #915,
130
+ * decision 2). Uses the profile extends chain when a profile is loaded,
131
+ * else the core hierarchy. */
132
+ function isTestEntry(entry, profile) {
133
+ const type = entry.type;
134
+ if (type === undefined)
135
+ return false;
136
+ return profile
137
+ ? (0, discipline_mode_js_1.extendsTransitively)(type, "Test", profile)
138
+ : (0, mod_js_1.descendantsOf)("Test").has(type);
139
+ }
@@ -26,7 +26,13 @@ export { type GitignoreRule, isIgnored, parseGitignore } from "./gitignore.js";
26
26
  export declare const SOURCE_EXTENSIONS: ReadonlySet<string>;
27
27
  /** Markdown only — the `fmt` scope (the formatter never rewrites source). */
28
28
  export declare const MARKDOWN_EXTENSIONS: ReadonlySet<string>;
29
- /** Everything MarkSpec-relevant: markdown + source families. */
29
+ /**
30
+ * Gherkin `.feature` files, whose `# [ID]` header comments define entries
31
+ * (ADR-038). Not part of {@linkcode SOURCE_EXTENSIONS}: that set drives the
32
+ * tree-sitter grammars and the LSP, and `.feature` files use neither.
33
+ */
34
+ export declare const FEATURE_EXTENSIONS: ReadonlySet<string>;
35
+ /** Everything MarkSpec-relevant: markdown, source and `.feature` files. */
30
36
  export declare const RELEVANT_EXTENSIONS: ReadonlySet<string>;
31
37
  /** One directory entry from {@linkcode DiscoveryIO.readDir}.
32
38
  * Structurally compatible with `Deno.DirEntry`. */
@@ -67,4 +73,17 @@ export interface DiscoverOptions {
67
73
  * output across filesystems. Unreadable directories are skipped.
68
74
  */
69
75
  export declare function discoverFiles(root: string, io: DiscoveryIO, options?: DiscoverOptions): AsyncGenerator<string>;
76
+ /**
77
+ * Report whether {@linkcode discoverFiles} with the same `root`, `io` and
78
+ * `options` would yield `path`. It applies the same rules as the walk: the
79
+ * extension filter, hidden directories, the built-in build-output skips, the
80
+ * `.gitignore` chain and `exclude`. It checks the directories from `root`
81
+ * down to the file, so a file under an ignored directory is not included.
82
+ * The file must exist as a regular file: a path that does not exist, a
83
+ * symbolic link, and a path outside `root` are not included. It lists every
84
+ * ancestor directory of the file, so it is meant for per-file checks, not
85
+ * bulk use. It compares paths as given: case and symbolic links in the
86
+ * directories above the file are not resolved.
87
+ */
88
+ export declare function isDiscoverable(path: string, root: string, io: DiscoveryIO, options?: DiscoverOptions): Promise<boolean>;
70
89
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discovery/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAmBhD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAoB,CAAC;AAEzE,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH;mDACmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACxD,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACrD;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C;;;6EAGyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;;;;OAQG;IACH,QAAQ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;;6EAGyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AA8BD;;;;GAIG;AACH,wBAAuB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAAC,MAAM,CAAC,CAaxB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAgClB"}
@@ -19,8 +19,9 @@
19
19
  * Node-compatible; entry points supply the Deno implementation.
20
20
  */
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.RELEVANT_EXTENSIONS = exports.MARKDOWN_EXTENSIONS = exports.SOURCE_EXTENSIONS = exports.parseGitignore = exports.isIgnored = void 0;
22
+ exports.RELEVANT_EXTENSIONS = exports.FEATURE_EXTENSIONS = exports.MARKDOWN_EXTENSIONS = exports.SOURCE_EXTENSIONS = exports.parseGitignore = exports.isIgnored = void 0;
23
23
  exports.discoverFiles = discoverFiles;
24
+ exports.isDiscoverable = isDiscoverable;
24
25
  const path_1 = require("@std/path");
25
26
  const gitignore_js_1 = require("./gitignore.js");
26
27
  var gitignore_js_2 = require("./gitignore.js");
@@ -53,10 +54,17 @@ exports.SOURCE_EXTENSIONS = new Set([
53
54
  ]);
54
55
  /** Markdown only — the `fmt` scope (the formatter never rewrites source). */
55
56
  exports.MARKDOWN_EXTENSIONS = new Set([".md"]);
56
- /** Everything MarkSpec-relevant: markdown + source families. */
57
+ /**
58
+ * Gherkin `.feature` files, whose `# [ID]` header comments define entries
59
+ * (ADR-038). Not part of {@linkcode SOURCE_EXTENSIONS}: that set drives the
60
+ * tree-sitter grammars and the LSP, and `.feature` files use neither.
61
+ */
62
+ exports.FEATURE_EXTENSIONS = new Set([".feature"]);
63
+ /** Everything MarkSpec-relevant: markdown, source and `.feature` files. */
57
64
  exports.RELEVANT_EXTENSIONS = new Set([
58
65
  ...exports.MARKDOWN_EXTENSIONS,
59
66
  ...exports.SOURCE_EXTENSIONS,
67
+ ...exports.FEATURE_EXTENSIONS,
60
68
  ]);
61
69
  /**
62
70
  * Directory names pruned by default, in addition to the hidden-dir skip.
@@ -88,16 +96,104 @@ const BUILTIN_SKIP_RULES = (0, gitignore_js_1.parseGitignore)(BUILTIN_SKIP_DIRS.
88
96
  */
89
97
  async function* discoverFiles(root, io, options = {}) {
90
98
  const extensions = options.extensions ?? exports.RELEVANT_EXTENSIONS;
99
+ const start = await walkStart(root, io, options);
100
+ // Carry excludes separately: they must stay after every `.gitignore`,
101
+ // including ones loaded deeper in the walk.
102
+ yield* walk(root, start.prefix, start.rules, start.excludeRules, io, extensions);
103
+ }
104
+ /**
105
+ * Report whether {@linkcode discoverFiles} with the same `root`, `io` and
106
+ * `options` would yield `path`. It applies the same rules as the walk: the
107
+ * extension filter, hidden directories, the built-in build-output skips, the
108
+ * `.gitignore` chain and `exclude`. It checks the directories from `root`
109
+ * down to the file, so a file under an ignored directory is not included.
110
+ * The file must exist as a regular file: a path that does not exist, a
111
+ * symbolic link, and a path outside `root` are not included. It lists every
112
+ * ancestor directory of the file, so it is meant for per-file checks, not
113
+ * bulk use. It compares paths as given: case and symbolic links in the
114
+ * directories above the file are not resolved.
115
+ */
116
+ async function isDiscoverable(path, root, io, options = {}) {
117
+ const extensions = options.extensions ?? exports.RELEVANT_EXTENSIONS;
118
+ if (!isRelevantFile(path, extensions))
119
+ return false;
120
+ const rel = (0, path_1.relative)((0, path_1.resolve)(root), (0, path_1.resolve)(path));
121
+ if (rel === "" || rel === ".." || rel.startsWith(`..${path_1.SEPARATOR}`) ||
122
+ (0, path_1.isAbsolute)(rel)) {
123
+ return false;
124
+ }
125
+ const segments = rel.split(path_1.SEPARATOR);
126
+ const start = await walkStart(root, io, options);
127
+ let rules = start.rules;
128
+ let absDir = root;
129
+ let relDir = start.prefix;
130
+ for (let i = 0; i < segments.length; i++) {
131
+ const gitignoreRules = await rulesForDirectory(absDir, relDir, rules, io);
132
+ const active = [...gitignoreRules, ...start.excludeRules];
133
+ const name = segments[i];
134
+ const entryRel = relDir === "" ? name : `${relDir}/${name}`;
135
+ const isLast = i === segments.length - 1;
136
+ // The walk yields only entries that report isFile or isDirectory, so a
137
+ // symbolic link, or a path that does not exist, is not discoverable.
138
+ const kind = await entryKind(absDir, name, io);
139
+ if (isLast ? kind !== "file" : kind !== "directory")
140
+ return false;
141
+ if (isLast)
142
+ return !(0, gitignore_js_1.isIgnored)(entryRel, false, active);
143
+ if (isPrunedDirectory(name, entryRel, active))
144
+ return false;
145
+ rules = gitignoreRules;
146
+ absDir = (0, path_1.join)(absDir, name);
147
+ relDir = entryRel;
148
+ }
149
+ return false;
150
+ }
151
+ /** The kind of the entry `name` in `absDir`, as the walk sees it. */
152
+ async function entryKind(absDir, name, io) {
153
+ try {
154
+ for await (const e of io.readDir(absDir)) {
155
+ if (e.name !== name)
156
+ continue;
157
+ return e.isDirectory ? "directory" : e.isFile ? "file" : undefined;
158
+ }
159
+ }
160
+ catch {
161
+ // An unreadable directory is skipped by the walk.
162
+ }
163
+ return undefined;
164
+ }
165
+ /** The starting rule state of a walk of `root`, shared by the walk and
166
+ * {@linkcode isDiscoverable}. `prefix` is the path of `root` below the
167
+ * folder the rules are anchored at. */
168
+ async function walkStart(root, io, options) {
91
169
  const inherited = options.inheritGitignoreFrom === undefined
92
170
  ? { rules: [], prefix: "" }
93
171
  : await inheritedGitignoreRules(options.inheritGitignoreFrom, root, io);
94
172
  // With inherited rules, every rule is matched against paths relative to
95
173
  // the enclosing folder, so `prefix` is the path from it down to `root`.
96
- const prefix = inherited.prefix;
97
- const excludeRules = (0, gitignore_js_1.parseGitignore)((options.exclude ?? []).join("\n"), prefix);
98
- // Carry excludes separately: they must stay after every `.gitignore`,
99
- // including ones loaded deeper in the walk.
100
- yield* walk(root, prefix, [...BUILTIN_SKIP_RULES, ...inherited.rules], excludeRules, io, extensions);
174
+ return {
175
+ prefix: inherited.prefix,
176
+ rules: [...BUILTIN_SKIP_RULES, ...inherited.rules],
177
+ excludeRules: (0, gitignore_js_1.parseGitignore)((options.exclude ?? []).join("\n"), inherited.prefix),
178
+ };
179
+ }
180
+ /** `true` when a file has one of the `extensions`. */
181
+ function isRelevantFile(path, extensions) {
182
+ return extensions.has((0, path_1.extname)(path).toLowerCase());
183
+ }
184
+ /** `true` when the walk does not enter a directory: hidden, or ignored.
185
+ * Git semantics: paths under an ignored directory cannot be re-included, so
186
+ * pruning is correct. */
187
+ function isPrunedDirectory(name, rel, active) {
188
+ return name.startsWith(".") || (0, gitignore_js_1.isIgnored)(rel, true, active);
189
+ }
190
+ /** The `.gitignore` rules in force inside `absDir`: the inherited `rules`
191
+ * followed by the directory's own `.gitignore`, so deeper rules win. */
192
+ async function rulesForDirectory(absDir, relDir, rules, io) {
193
+ const raw = await io.readFile((0, path_1.join)(absDir, ".gitignore"));
194
+ return raw !== undefined && raw.length > 0
195
+ ? [...rules, ...(0, gitignore_js_1.parseGitignore)(raw, relDir)]
196
+ : rules;
101
197
  }
102
198
  /**
103
199
  * Collect the `.gitignore` rules of the folders from `from` down to the
@@ -128,10 +224,7 @@ async function inheritedGitignoreRules(from, root, io) {
128
224
  async function* walk(absDir, relDir, rules, excludeRules, io, extensions) {
129
225
  // Deeper `.gitignore` rules win over inherited ones. Excludes stay last
130
226
  // for this directory's decisions, but are not inherited as gitignore rules.
131
- const raw = await io.readFile((0, path_1.join)(absDir, ".gitignore"));
132
- const gitignoreRules = raw !== undefined && raw.length > 0
133
- ? [...rules, ...(0, gitignore_js_1.parseGitignore)(raw, relDir)]
134
- : rules;
227
+ const gitignoreRules = await rulesForDirectory(absDir, relDir, rules, io);
135
228
  const active = [...gitignoreRules, ...excludeRules];
136
229
  const entries = [];
137
230
  try {
@@ -145,16 +238,12 @@ async function* walk(absDir, relDir, rules, excludeRules, io, extensions) {
145
238
  for (const entry of entries) {
146
239
  const rel = relDir === "" ? entry.name : `${relDir}/${entry.name}`;
147
240
  if (entry.isDirectory) {
148
- if (entry.name.startsWith("."))
149
- continue; // built-in: hidden dirs
150
- // Git semantics: paths under an ignored directory cannot be
151
- // re-included, so pruning here is correct (and fast).
152
- if ((0, gitignore_js_1.isIgnored)(rel, true, active))
241
+ if (isPrunedDirectory(entry.name, rel, active))
153
242
  continue;
154
243
  yield* walk((0, path_1.join)(absDir, entry.name), rel, gitignoreRules, excludeRules, io, extensions);
155
244
  }
156
245
  else if (entry.isFile) {
157
- if (!extensions.has((0, path_1.extname)(entry.name).toLowerCase()))
246
+ if (!isRelevantFile(entry.name, extensions))
158
247
  continue;
159
248
  if ((0, gitignore_js_1.isIgnored)(rel, false, active))
160
249
  continue;
@@ -32,10 +32,12 @@ export declare function resolveConfigRoot(startDir: string, readFile: (path: str
32
32
  * `exclude`). Each discovered `project.yaml` or `.markspec.yaml` is
33
33
  * resolved with {@linkcode resolveConfigRoot} from its own directory, so a
34
34
  * `.markspec.yaml` below a `project.yaml` is not a root of its own — the
35
- * same answer the CLI gives for a file there. A found root is dropped when
36
- * the `.markspec.yaml` `exclude:` list of another found root above it
37
- * covers it: each project's exclude list applies to its own subtree, with
38
- * patterns relative to that project. The result is sorted.
35
+ * same answer the CLI gives for a file there. Each found root is scanned
36
+ * again with its own exclude list, so its negations can re-include non-hidden
37
+ * folders that the enclosing project's walk skipped. A found root is dropped
38
+ * when the start root's exclude list or the `.markspec.yaml` `exclude:` list
39
+ * of another found root above it covers it: each project's exclude list applies
40
+ * to its own subtree, with patterns relative to that project. The result is sorted.
39
41
  */
40
42
  export declare function findNestedProjectRoots(root: string, io: DiscoveryIO, exclude?: readonly string[]): Promise<string[]>;
41
43
  /** Options for {@linkcode discoverProjectRoots}. */
@@ -1 +1 @@
1
- {"version":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cG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoBnD;AAED;4CAC4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClD;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C;;;;;;OAMG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,uBAA4B,GACpC,mBAAmB,CAqErB"}
@@ -67,33 +67,43 @@ async function resolveConfigRoot(startDir, readFile) {
67
67
  * `exclude`). Each discovered `project.yaml` or `.markspec.yaml` is
68
68
  * resolved with {@linkcode resolveConfigRoot} from its own directory, so a
69
69
  * `.markspec.yaml` below a `project.yaml` is not a root of its own — the
70
- * same answer the CLI gives for a file there. A found root is dropped when
71
- * the `.markspec.yaml` `exclude:` list of another found root above it
72
- * covers it: each project's exclude list applies to its own subtree, with
73
- * patterns relative to that project. The result is sorted.
70
+ * same answer the CLI gives for a file there. Each found root is scanned
71
+ * again with its own exclude list, so its negations can re-include non-hidden
72
+ * folders that the enclosing project's walk skipped. A found root is dropped
73
+ * when the start root's exclude list or the `.markspec.yaml` `exclude:` list
74
+ * of another found root above it covers it: each project's exclude list applies
75
+ * to its own subtree, with patterns relative to that project. The result is sorted.
74
76
  */
75
77
  async function findNestedProjectRoots(root, io, exclude) {
76
78
  const out = new Set();
77
- for await (const path of (0, mod_js_2.discoverFiles)(root, io, {
78
- extensions: new Set([".yaml"]),
79
- exclude,
80
- })) {
81
- if (!CONFIG_BASENAMES.has((0, path_1.basename)(path)))
82
- continue;
83
- const dir = (0, path_1.dirname)(path);
84
- if (dir === root)
85
- continue;
86
- const found = await resolveConfigRoot(dir, io.readFile);
87
- if (found !== undefined && found !== root && isWithin(root, found)) {
88
- out.add(found);
79
+ const scans = [{ root, exclude }];
80
+ for (const scan of scans) {
81
+ for await (const path of (0, mod_js_2.discoverFiles)(scan.root, io, {
82
+ extensions: new Set([".yaml"]),
83
+ exclude: scan.exclude,
84
+ inheritGitignoreFrom: root,
85
+ })) {
86
+ if (!CONFIG_BASENAMES.has((0, path_1.basename)(path)))
87
+ continue;
88
+ const dir = (0, path_1.dirname)(path);
89
+ if (dir === scan.root)
90
+ continue;
91
+ const found = await resolveConfigRoot(dir, io.readFile);
92
+ if (found !== undefined && found !== root && isWithin(root, found) &&
93
+ !out.has(found)) {
94
+ out.add(found);
95
+ const { config } = await (0, markspec_js_1.loadToolConfig)(found, io.readFile);
96
+ scans.push({ root: found, exclude: config.exclude });
97
+ }
89
98
  }
90
99
  }
91
100
  const nested = [...out];
92
101
  const excludeRules = new Map();
102
+ excludeRules.set(root, (0, gitignore_js_1.parseGitignore)((exclude ?? []).join("\n"), ""));
93
103
  const kept = [];
94
104
  for (const candidate of nested) {
95
105
  let covered = false;
96
- for (const ancestor of nested) {
106
+ for (const ancestor of [root, ...nested]) {
97
107
  if (ancestor === candidate || !isWithin(ancestor, candidate))
98
108
  continue;
99
109
  let rules = excludeRules.get(ancestor);
@@ -34,13 +34,11 @@ export type EntryBodyEdit = {
34
34
  };
35
35
  /**
36
36
  * 0-based content column of the list item whose marker starts at `marker`
37
- * on `line`: the marker column, plus 1 for the bullet, plus the spaces
38
- * after it. So `- [ID]` gives the marker column plus 2 and `- [ID]` gives
39
- * the marker column plus 4. Only a bullet followed by one to four spaces
40
- * can start an entry: ordered lists never hold entries, and five or more
41
- * spaces make the title an indented code block. When the line does not
42
- * start with a bullet and a space at `marker`, the marker column plus 2 is
43
- * used as a fallback.
37
+ * on `line`: the marker column, plus 1 for the bullet, plus the whitespace
38
+ * after it. Tabs advance to the next four-column CommonMark tab stop.
39
+ * So `- [ID]` gives 2, `- [ID]` gives 4, and `-\t[ID]` gives 4 at
40
+ * column zero. Ordered lists never hold entries. When there is no bullet
41
+ * followed by whitespace at `marker`, use the marker column plus 2.
44
42
  */
45
43
  export declare function contentColumn(line: string, marker: number): number;
46
44
  /**
@@ -76,11 +74,14 @@ export declare function readEntryBody(text: string, file: string, displayId: str
76
74
  * before or after the edit. So the edit is refused when an `MSL-P020`,
77
75
  * `MSL-P021` or `MSL-P022` names the entry (the message starts with
78
76
  * `<displayId>:`). This is broader than that case: `MSL-P020` also fires
79
- * when a body paragraph starts with a recognized trailer key, so such an
80
- * entry is refused too. The file already fails `markspec check` there.
81
- * An entry whose trailer-looking lines use only unrecognized keys, and
82
- * that the parser reads as body without a diagnostic, is edited as the
83
- * parser sees it: those lines are body.
77
+ * when a body `Id:` or trace-relation line has other content after it,
78
+ * when an `Id:` run sits directly under prose (warning), and when a
79
+ * trailing trace-relation line is body prose (warning), so such an entry
80
+ * is refused too. An entry whose trailer-looking lines the parser reads as
81
+ * body without a diagnostic (for example `Note:` lines, or `Status:`
82
+ * directly under prose) is edited as the parser sees it: those lines are
83
+ * body. A final paragraph of only core keys after a blank line, such as a
84
+ * lone `Rationale:` line, is the trailer, not body.
84
85
  */
85
86
  export declare function replaceEntryBody(text: string, file: string, displayId: string, body: string): Promise<EntryBodyEdit>;
86
87
  //# sourceMappingURL=entry_body.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry_body.d.ts","sourceRoot":"","sources":["../../src/formatter/entry_body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,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,gBAAgB,CAAA;CAAE,CAAC;AA8E/D;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQlE;AAyCD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS7B;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,CAoDxB"}
@@ -86,17 +86,21 @@ function bodySpan(lines, entry) {
86
86
  }
87
87
  /**
88
88
  * 0-based content column of the list item whose marker starts at `marker`
89
- * on `line`: the marker column, plus 1 for the bullet, plus the spaces
90
- * after it. So `- [ID]` gives the marker column plus 2 and `- [ID]` gives
91
- * the marker column plus 4. Only a bullet followed by one to four spaces
92
- * can start an entry: ordered lists never hold entries, and five or more
93
- * spaces make the title an indented code block. When the line does not
94
- * start with a bullet and a space at `marker`, the marker column plus 2 is
95
- * used as a fallback.
89
+ * on `line`: the marker column, plus 1 for the bullet, plus the whitespace
90
+ * after it. Tabs advance to the next four-column CommonMark tab stop.
91
+ * So `- [ID]` gives 2, `- [ID]` gives 4, and `-\t[ID]` gives 4 at
92
+ * column zero. Ordered lists never hold entries. When there is no bullet
93
+ * followed by whitespace at `marker`, use the marker column plus 2.
96
94
  */
97
95
  function contentColumn(line, marker) {
98
- const m = /^[-*+]( +)/.exec(line.slice(marker));
99
- return m ? marker + 1 + m[1].length : marker + 2;
96
+ const m = /^[-*+]([ \t]+)/.exec(line.slice(marker));
97
+ if (!m)
98
+ return marker + 2;
99
+ let column = marker + 1;
100
+ for (const character of m[1]) {
101
+ column += character === "\t" ? 4 - column % 4 : 1;
102
+ }
103
+ return column;
100
104
  }
101
105
  /** Dedented span lines, trailing whitespace removed. */
102
106
  function spanText(lines, span) {
@@ -172,11 +176,14 @@ function dedent(line, indent) {
172
176
  * before or after the edit. So the edit is refused when an `MSL-P020`,
173
177
  * `MSL-P021` or `MSL-P022` names the entry (the message starts with
174
178
  * `<displayId>:`). This is broader than that case: `MSL-P020` also fires
175
- * when a body paragraph starts with a recognized trailer key, so such an
176
- * entry is refused too. The file already fails `markspec check` there.
177
- * An entry whose trailer-looking lines use only unrecognized keys, and
178
- * that the parser reads as body without a diagnostic, is edited as the
179
- * parser sees it: those lines are body.
179
+ * when a body `Id:` or trace-relation line has other content after it,
180
+ * when an `Id:` run sits directly under prose (warning), and when a
181
+ * trailing trace-relation line is body prose (warning), so such an entry
182
+ * is refused too. An entry whose trailer-looking lines the parser reads as
183
+ * body without a diagnostic (for example `Note:` lines, or `Status:`
184
+ * directly under prose) is edited as the parser sees it: those lines are
185
+ * body. A final paragraph of only core keys after a blank line, such as a
186
+ * lone `Rationale:` line, is the trailer, not body.
180
187
  */
181
188
  async function replaceEntryBody(text, file, displayId, body) {
182
189
  const before = await locate(text, file, displayId);
@@ -273,9 +280,10 @@ function sameEntries(before, after, target, targetAfter) {
273
280
  * blank line between them, raises no diagnostic; the parser keeps it as
274
281
  * body text and adds no entry, so the edit is accepted.
275
282
  *
276
- * Known limit: the parser raises at most one MSL-P020 per entry, so when
277
- * the target body already has a trailer-like line, a proposal that adds
278
- * more such lines raises no new MSL-P020 and is accepted. The lines stay
283
+ * Known limit: the body scan raises at most one MSL-P020 per entry (the
284
+ * under-prose warning can add a second one), so when the target body
285
+ * already has a trailer-like line, a proposal that adds more such lines
286
+ * raises no new MSL-P020 and is accepted. The lines stay
279
287
  * body text; no trailer or entry changes.
280
288
  */
281
289
  function addsParseDiagnostic(before, after) {