@driftsys/markspec 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/esm/ast/build.d.ts.map +1 -1
  2. package/esm/ast/build.js +19 -5
  3. package/esm/ast/equivalence.js +14 -2
  4. package/esm/ast/nodes.d.ts +15 -3
  5. package/esm/ast/nodes.d.ts.map +1 -1
  6. package/esm/compiler/inverses.d.ts.map +1 -1
  7. package/esm/compiler/inverses.js +18 -3
  8. package/esm/compiler/mod.d.ts +34 -1
  9. package/esm/compiler/mod.d.ts.map +1 -1
  10. package/esm/compiler/mod.js +112 -48
  11. package/esm/compiler/schema.d.ts +3 -2
  12. package/esm/compiler/schema.d.ts.map +1 -1
  13. package/esm/compiler/schema.js +6 -3
  14. package/esm/criteria/scenarios.d.ts +55 -0
  15. package/esm/criteria/scenarios.d.ts.map +1 -0
  16. package/esm/criteria/scenarios.js +133 -0
  17. package/esm/discovery/mod.d.ts +20 -1
  18. package/esm/discovery/mod.d.ts.map +1 -1
  19. package/esm/discovery/mod.js +105 -17
  20. package/esm/formatter/entry_body.d.ts +8 -5
  21. package/esm/formatter/entry_body.d.ts.map +1 -1
  22. package/esm/formatter/entry_body.js +12 -8
  23. package/esm/formatter/feature_file.d.ts +40 -0
  24. package/esm/formatter/feature_file.d.ts.map +1 -0
  25. package/esm/formatter/feature_file.js +88 -0
  26. package/esm/formatter/mod.d.ts +21 -2
  27. package/esm/formatter/mod.d.ts.map +1 -1
  28. package/esm/formatter/mod.js +64 -22
  29. package/esm/gates/mod.d.ts +2 -2
  30. package/esm/gates/mod.d.ts.map +1 -1
  31. package/esm/gates/mod.js +17 -2
  32. package/esm/gherkin/load.d.ts +35 -0
  33. package/esm/gherkin/load.d.ts.map +1 -0
  34. package/esm/gherkin/load.js +39 -0
  35. package/esm/gherkin/parse.d.ts +11 -0
  36. package/esm/gherkin/parse.d.ts.map +1 -0
  37. package/esm/gherkin/parse.js +311 -0
  38. package/esm/gherkin/position.d.ts +23 -0
  39. package/esm/gherkin/position.d.ts.map +1 -0
  40. package/esm/gherkin/position.js +21 -0
  41. package/esm/gherkin/procedure.d.ts +76 -0
  42. package/esm/gherkin/procedure.d.ts.map +1 -0
  43. package/esm/gherkin/procedure.js +164 -0
  44. package/esm/gherkin/project.d.ts +35 -0
  45. package/esm/gherkin/project.d.ts.map +1 -0
  46. package/esm/gherkin/project.js +64 -0
  47. package/esm/gherkin/role.d.ts +23 -0
  48. package/esm/gherkin/role.d.ts.map +1 -0
  49. package/esm/gherkin/role.js +28 -0
  50. package/esm/gherkin/types.d.ts +118 -0
  51. package/esm/gherkin/types.d.ts.map +1 -0
  52. package/esm/gherkin/types.js +12 -0
  53. package/esm/lock/acquire_compile.d.ts +12 -4
  54. package/esm/lock/acquire_compile.d.ts.map +1 -1
  55. package/esm/lock/acquire_compile.js +15 -5
  56. package/esm/lock/canonical_edges.d.ts +6 -2
  57. package/esm/lock/canonical_edges.d.ts.map +1 -1
  58. package/esm/lock/canonical_edges.js +10 -3
  59. package/esm/lock/model.d.ts +5 -0
  60. package/esm/lock/model.d.ts.map +1 -1
  61. package/esm/lock/parser.d.ts.map +1 -1
  62. package/esm/lock/parser.js +2 -0
  63. package/esm/lock/resolve.d.ts +6 -2
  64. package/esm/lock/resolve.d.ts.map +1 -1
  65. package/esm/lock/resolve.js +36 -4
  66. package/esm/lock/serializer.d.ts.map +1 -1
  67. package/esm/lock/serializer.js +7 -1
  68. package/esm/mod.d.ts +23 -6
  69. package/esm/mod.d.ts.map +1 -1
  70. package/esm/mod.js +18 -5
  71. package/esm/model/mod.d.ts +42 -1
  72. package/esm/model/mod.d.ts.map +1 -1
  73. package/esm/model/mod.js +1 -1
  74. package/esm/model/relations.d.ts +9 -0
  75. package/esm/model/relations.d.ts.map +1 -1
  76. package/esm/model/relations.js +16 -1
  77. package/esm/parser/attributes.d.ts +82 -3
  78. package/esm/parser/attributes.d.ts.map +1 -1
  79. package/esm/parser/attributes.js +199 -32
  80. package/esm/parser/body_tokens.d.ts +1 -1
  81. package/esm/parser/body_tokens.d.ts.map +1 -1
  82. package/esm/parser/body_tokens.js +49 -35
  83. package/esm/parser/feature_file.d.ts +116 -0
  84. package/esm/parser/feature_file.d.ts.map +1 -0
  85. package/esm/parser/feature_file.js +540 -0
  86. package/esm/parser/markdown.d.ts +7 -0
  87. package/esm/parser/markdown.d.ts.map +1 -1
  88. package/esm/parser/markdown.js +129 -40
  89. package/esm/parser/mod.d.ts +18 -0
  90. package/esm/parser/mod.d.ts.map +1 -1
  91. package/esm/parser/mod.js +51 -0
  92. package/esm/parser/translate.d.ts.map +1 -1
  93. package/esm/parser/translate.js +5 -0
  94. package/esm/refs/mod.d.ts +2 -1
  95. package/esm/refs/mod.d.ts.map +1 -1
  96. package/esm/refs/mod.js +12 -4
  97. package/esm/refs/split.d.ts +58 -0
  98. package/esm/refs/split.d.ts.map +1 -0
  99. package/esm/refs/split.js +137 -0
  100. package/esm/reporter/mod.d.ts +7 -0
  101. package/esm/reporter/mod.d.ts.map +1 -1
  102. package/esm/reporter/mod.js +113 -3
  103. package/esm/validator/attributes.d.ts.map +1 -1
  104. package/esm/validator/attributes.js +4 -1
  105. package/esm/validator/block_role.d.ts +40 -0
  106. package/esm/validator/block_role.d.ts.map +1 -0
  107. package/esm/validator/block_role.js +109 -0
  108. package/esm/validator/feature_ac.d.ts.map +1 -1
  109. package/esm/validator/feature_ac.js +6 -1
  110. package/esm/validator/feature_parse.d.ts +35 -0
  111. package/esm/validator/feature_parse.d.ts.map +1 -0
  112. package/esm/validator/feature_parse.js +69 -0
  113. package/esm/validator/locators.d.ts +36 -0
  114. package/esm/validator/locators.d.ts.map +1 -0
  115. package/esm/validator/locators.js +184 -0
  116. package/esm/validator/mod.d.ts +10 -1
  117. package/esm/validator/mod.d.ts.map +1 -1
  118. package/esm/validator/mod.js +38 -14
  119. package/esm/validator/normalize.d.ts.map +1 -1
  120. package/esm/validator/normalize.js +8 -3
  121. package/esm/validator/per_type_attrs.d.ts +3 -3
  122. package/esm/validator/per_type_attrs.js +3 -3
  123. package/esm/validator/pipeline.d.ts +4 -12
  124. package/esm/validator/pipeline.d.ts.map +1 -1
  125. package/esm/validator/pipeline.js +24 -5
  126. package/esm/validator/procedure.d.ts +22 -0
  127. package/esm/validator/procedure.d.ts.map +1 -0
  128. package/esm/validator/procedure.js +58 -0
  129. package/esm/validator/trace_types.d.ts.map +1 -1
  130. package/esm/validator/trace_types.js +4 -3
  131. package/esm/validator/traceability.d.ts.map +1 -1
  132. package/esm/validator/traceability.js +4 -1
  133. package/esm/validator/type_resolution.d.ts +5 -3
  134. package/esm/validator/type_resolution.d.ts.map +1 -1
  135. package/esm/validator/type_resolution.js +14 -2
  136. package/esm/validator/types.d.ts +11 -0
  137. package/esm/validator/types.d.ts.map +1 -1
  138. package/esm/validator/types.js +26 -4
  139. package/esm/validator/uxil_family.d.ts +1 -1
  140. package/package.json +3 -1
  141. package/script/ast/build.d.ts.map +1 -1
  142. package/script/ast/build.js +19 -5
  143. package/script/ast/equivalence.js +14 -2
  144. package/script/ast/nodes.d.ts +15 -3
  145. package/script/ast/nodes.d.ts.map +1 -1
  146. package/script/compiler/inverses.d.ts.map +1 -1
  147. package/script/compiler/inverses.js +18 -3
  148. package/script/compiler/mod.d.ts +34 -1
  149. package/script/compiler/mod.d.ts.map +1 -1
  150. package/script/compiler/mod.js +110 -46
  151. package/script/compiler/schema.d.ts +3 -2
  152. package/script/compiler/schema.d.ts.map +1 -1
  153. package/script/compiler/schema.js +6 -3
  154. package/script/criteria/scenarios.d.ts +55 -0
  155. package/script/criteria/scenarios.d.ts.map +1 -0
  156. package/script/criteria/scenarios.js +139 -0
  157. package/script/discovery/mod.d.ts +20 -1
  158. package/script/discovery/mod.d.ts.map +1 -1
  159. package/script/discovery/mod.js +106 -17
  160. package/script/formatter/entry_body.d.ts +8 -5
  161. package/script/formatter/entry_body.d.ts.map +1 -1
  162. package/script/formatter/entry_body.js +12 -8
  163. package/script/formatter/feature_file.d.ts +40 -0
  164. package/script/formatter/feature_file.d.ts.map +1 -0
  165. package/script/formatter/feature_file.js +92 -0
  166. package/script/formatter/mod.d.ts +21 -2
  167. package/script/formatter/mod.d.ts.map +1 -1
  168. package/script/formatter/mod.js +63 -21
  169. package/script/gates/mod.d.ts +2 -2
  170. package/script/gates/mod.d.ts.map +1 -1
  171. package/script/gates/mod.js +17 -2
  172. package/script/gherkin/load.d.ts +35 -0
  173. package/script/gherkin/load.d.ts.map +1 -0
  174. package/script/gherkin/load.js +76 -0
  175. package/script/gherkin/parse.d.ts +11 -0
  176. package/script/gherkin/parse.d.ts.map +1 -0
  177. package/script/gherkin/parse.js +314 -0
  178. package/script/gherkin/position.d.ts +23 -0
  179. package/script/gherkin/position.d.ts.map +1 -0
  180. package/script/gherkin/position.js +24 -0
  181. package/script/gherkin/procedure.d.ts +76 -0
  182. package/script/gherkin/procedure.d.ts.map +1 -0
  183. package/script/gherkin/procedure.js +169 -0
  184. package/script/gherkin/project.d.ts +35 -0
  185. package/script/gherkin/project.d.ts.map +1 -0
  186. package/script/gherkin/project.js +67 -0
  187. package/script/gherkin/role.d.ts +23 -0
  188. package/script/gherkin/role.d.ts.map +1 -0
  189. package/script/gherkin/role.js +31 -0
  190. package/script/gherkin/types.d.ts +118 -0
  191. package/script/gherkin/types.d.ts.map +1 -0
  192. package/script/gherkin/types.js +13 -0
  193. package/script/lock/acquire_compile.d.ts +12 -4
  194. package/script/lock/acquire_compile.d.ts.map +1 -1
  195. package/script/lock/acquire_compile.js +15 -5
  196. package/script/lock/canonical_edges.d.ts +6 -2
  197. package/script/lock/canonical_edges.d.ts.map +1 -1
  198. package/script/lock/canonical_edges.js +10 -3
  199. package/script/lock/model.d.ts +5 -0
  200. package/script/lock/model.d.ts.map +1 -1
  201. package/script/lock/parser.d.ts.map +1 -1
  202. package/script/lock/parser.js +2 -0
  203. package/script/lock/resolve.d.ts +6 -2
  204. package/script/lock/resolve.d.ts.map +1 -1
  205. package/script/lock/resolve.js +36 -4
  206. package/script/lock/serializer.d.ts.map +1 -1
  207. package/script/lock/serializer.js +7 -1
  208. package/script/mod.d.ts +23 -6
  209. package/script/mod.d.ts.map +1 -1
  210. package/script/mod.js +45 -6
  211. package/script/model/mod.d.ts +42 -1
  212. package/script/model/mod.d.ts.map +1 -1
  213. package/script/model/mod.js +2 -1
  214. package/script/model/relations.d.ts +9 -0
  215. package/script/model/relations.d.ts.map +1 -1
  216. package/script/model/relations.js +17 -1
  217. package/script/parser/attributes.d.ts +82 -3
  218. package/script/parser/attributes.d.ts.map +1 -1
  219. package/script/parser/attributes.js +205 -33
  220. package/script/parser/body_tokens.d.ts +1 -1
  221. package/script/parser/body_tokens.d.ts.map +1 -1
  222. package/script/parser/body_tokens.js +49 -35
  223. package/script/parser/feature_file.d.ts +116 -0
  224. package/script/parser/feature_file.d.ts.map +1 -0
  225. package/script/parser/feature_file.js +548 -0
  226. package/script/parser/markdown.d.ts +7 -0
  227. package/script/parser/markdown.d.ts.map +1 -1
  228. package/script/parser/markdown.js +128 -39
  229. package/script/parser/mod.d.ts +18 -0
  230. package/script/parser/mod.d.ts.map +1 -1
  231. package/script/parser/mod.js +52 -1
  232. package/script/parser/translate.d.ts.map +1 -1
  233. package/script/parser/translate.js +5 -0
  234. package/script/refs/mod.d.ts +2 -1
  235. package/script/refs/mod.d.ts.map +1 -1
  236. package/script/refs/mod.js +12 -4
  237. package/script/refs/split.d.ts +58 -0
  238. package/script/refs/split.d.ts.map +1 -0
  239. package/script/refs/split.js +145 -0
  240. package/script/reporter/mod.d.ts +7 -0
  241. package/script/reporter/mod.d.ts.map +1 -1
  242. package/script/reporter/mod.js +113 -3
  243. package/script/validator/attributes.d.ts.map +1 -1
  244. package/script/validator/attributes.js +4 -1
  245. package/script/validator/block_role.d.ts +40 -0
  246. package/script/validator/block_role.d.ts.map +1 -0
  247. package/script/validator/block_role.js +112 -0
  248. package/script/validator/feature_ac.d.ts.map +1 -1
  249. package/script/validator/feature_ac.js +6 -1
  250. package/script/validator/feature_parse.d.ts +35 -0
  251. package/script/validator/feature_parse.d.ts.map +1 -0
  252. package/script/validator/feature_parse.js +73 -0
  253. package/script/validator/locators.d.ts +36 -0
  254. package/script/validator/locators.d.ts.map +1 -0
  255. package/script/validator/locators.js +188 -0
  256. package/script/validator/mod.d.ts +10 -1
  257. package/script/validator/mod.d.ts.map +1 -1
  258. package/script/validator/mod.js +38 -14
  259. package/script/validator/normalize.d.ts.map +1 -1
  260. package/script/validator/normalize.js +8 -3
  261. package/script/validator/per_type_attrs.d.ts +3 -3
  262. package/script/validator/per_type_attrs.js +3 -3
  263. package/script/validator/pipeline.d.ts +4 -12
  264. package/script/validator/pipeline.d.ts.map +1 -1
  265. package/script/validator/pipeline.js +23 -5
  266. package/script/validator/procedure.d.ts +22 -0
  267. package/script/validator/procedure.d.ts.map +1 -0
  268. package/script/validator/procedure.js +61 -0
  269. package/script/validator/trace_types.d.ts.map +1 -1
  270. package/script/validator/trace_types.js +4 -3
  271. package/script/validator/traceability.d.ts.map +1 -1
  272. package/script/validator/traceability.js +4 -1
  273. package/script/validator/type_resolution.d.ts +5 -3
  274. package/script/validator/type_resolution.d.ts.map +1 -1
  275. package/script/validator/type_resolution.js +14 -2
  276. package/script/validator/types.d.ts +11 -0
  277. package/script/validator/types.d.ts.map +1 -1
  278. package/script/validator/types.js +27 -4
  279. package/script/validator/uxil_family.d.ts +1 -1
@@ -9,9 +9,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.generateInverses = exports.serializeCompileResult = void 0;
10
10
  exports.compile = compile;
11
11
  const mod_js_1 = require("../model/mod.js");
12
+ const scenarios_js_1 = require("../criteria/scenarios.js");
13
+ const split_js_1 = require("../refs/split.js");
12
14
  const mod_js_2 = require("../parser/mod.js");
13
15
  const mod_js_3 = require("../validator/mod.js");
14
- const uxil_family_js_1 = require("../validator/uxil_family.js");
15
16
  const mod_js_4 = require("../typl/mod.js");
16
17
  const discipline_registry_js_1 = require("../profile/discipline_registry.js");
17
18
  const constants_js_1 = require("./constants.js");
@@ -45,7 +46,9 @@ function resolveGit(raw, withContributors) {
45
46
  * Project `Entry.source` onto `EntryProperties.source`. Always returns a
46
47
  * non-empty object — every entry has a known source category. Markdown
47
48
  * entries get `{ type: "markdown" }`; doc-comment entries get the full
48
- * code-source fan-out (adapter, language, function, rule).
49
+ * code-source fan-out (adapter, language, function, rule); `.feature`
50
+ * header entries get `{ type: "feature-file", adapter: "gherkin", rule }`
51
+ * where `rule` is the Gherkin node kind.
49
52
  */
50
53
  function resolveSource(source) {
51
54
  if (source.kind === "markdown") {
@@ -60,7 +63,11 @@ function resolveSource(source) {
60
63
  rule: source.rule,
61
64
  };
62
65
  }
63
- // Exhaustiveness check — adding a third EntrySource variant becomes a
66
+ if (source.kind === "feature-file") {
67
+ // The Gherkin node the header stands above is the extractor rule.
68
+ return { type: "feature-file", adapter: "gherkin", rule: source.node };
69
+ }
70
+ // Exhaustiveness check — adding a fourth EntrySource variant becomes a
64
71
  // compile-time error here, forcing a deliberate decision about its
65
72
  // properties.source projection rather than silently inheriting the
66
73
  // tree-sitter branch's defaults.
@@ -109,6 +116,14 @@ class Semaphore {
109
116
  * Compile MarkSpec files from the given paths into a resolved
110
117
  * traceability graph.
111
118
  *
119
+ * The returned diagnostics combine parse diagnostics, the validator
120
+ * pipeline's diagnostics, inverse-generation diagnostics and MSL-T013. The
121
+ * pipeline call is the same `runPipeline` call that bare `markspec check`
122
+ * and the LSP make, with project-wide scope by default
123
+ * (`options.projectWide`), so MSL-L006 and the other traceability rules are
124
+ * included. The diagnostics do not include fmt drift, lockfile drift or prose
125
+ * lint.
126
+ *
112
127
  * @param paths - File paths to compile
113
128
  * @param options - Compile options
114
129
  * @returns Compiled entries, links, and diagnostics
@@ -181,26 +196,26 @@ async function compile(paths, options) {
181
196
  if (res.document)
182
197
  documents.set(res.filePath, res.document);
183
198
  }
184
- // Phase 2: Validate all entries. When a profile is loaded, suppress the
185
- // core-only MSL-R010 "unknown attribute" warnings for attributes the profile
186
- // declares — mirrors runPipeline's Stage 1 so LSP/MCP diagnostics match the
187
- // `validate` command instead of flooding the editor with false positives.
188
- const validationResult = (0, mod_js_3.validate)(allEntries);
189
- const validationDiagnostics = (0, mod_js_3.suppressDeclaredAttrR010)(validationResult.diagnostics, allEntries, options.profile ?? null);
190
- // Phase 2.5: Classify entries when a profile is loaded.
199
+ // Phase 2: Validate all entries with the same validator pipeline that
200
+ // bare `markspec check` and the LSP run (`runPipeline`): core hygiene,
201
+ // classification, typed attributes, traceability (MSL-L006, MSL-T014),
202
+ // Gherkin checks and the uxil family. By default the requested path set is
203
+ // the whole project, so project-wide scope applies (`options.projectWide`).
204
+ // Only the pipeline's diagnostics are used. The graph below is built from
205
+ // compile's own classification, so the compiled graph does not depend on
206
+ // the pipeline. CLI-only gates (fmt drift, lock drift, prose lint) are
207
+ // not part of compile.
208
+ const pipelineDiagnostics = (0, mod_js_3.runPipeline)(allEntries, options.profile ?? null, options.captionConventions ?? {}, {
209
+ projectWide: options.projectWide ?? true,
210
+ declaredUpstreamIds: options.declaredUpstreamIds ?? [],
211
+ }).diagnostics;
212
+ // Phase 2.5: Classify entries when a profile is loaded. The
213
+ // classification diagnostics are already part of the pipeline result.
191
214
  let classifiedEntries = allEntries;
192
215
  if (options.profile) {
193
- const stage2 = (0, mod_js_3.classifyEntriesStage)(allEntries, options.profile);
194
- classifiedEntries = stage2.entries;
195
- parseDiagnostics.push(...stage2.diagnostics);
216
+ classifiedEntries = (0, mod_js_3.classifyEntriesStage)(allEntries, options.profile)
217
+ .entries;
196
218
  }
197
- // Phase 2.6: uxil diagnostics family (S9 #727) — profile-gated (inert
198
- // without a `declares: ux-surface` designation), mirroring runPipeline's
199
- // Stage 5 so compile-backed surfaces (CLI compile/export/show, the MCP
200
- // server) agree with `check` and the LSP on designated corpora. No
201
- // file-local filter here: the requested path set IS the corpus being
202
- // compiled — the same full-set semantics MSL-L006 assumes in compile.
203
- const uxilDiagnostics = (0, uxil_family_js_1.validateUxilFamily)(classifiedEntries, options.profile ?? null);
204
219
  // Phase 3: Build traceability graph.
205
220
  // Keep first occurrence of each display ID (validator catches duplicates).
206
221
  const entries = new Map();
@@ -238,22 +253,25 @@ async function compile(paths, options) {
238
253
  entries.set(entry.displayId, entry);
239
254
  }
240
255
  }
256
+ // Phase 4.5: Attach criteria (scenario names of fenced feature blocks)
257
+ // to Requirement and Contract entries, then resolve link locators
258
+ // against them (epic #915).
259
+ attachCriteria(entries, options.profile);
241
260
  const authoredLinks = extractLinks([...entries.values()]);
242
- const links = [...authoredLinks, ...generatedLinks];
261
+ const links = resolveLocators([...authoredLinks, ...generatedLinks], entries, options.profile);
243
262
  // MSL-T013: check link targets for draft/retired state.
244
263
  const linkTargetDiags = (0, link_target_js_1.checkLinkTargets)(entries, links);
245
264
  const forward = buildAdjacency(links, (l) => l.from);
246
265
  const reverse = buildAdjacency(links, (l) => l.to);
247
- // Build the corpus typl registry directly — validate() (called above)
266
+ // Build the corpus typl registry directly — the pipeline (called above)
248
267
  // already ran the full validateTypl pass (citation resolution, TYPL-009,
249
- // etc.) for validationDiagnostics; re-running it here just to get
250
- // `.registry` would redo that work a second time per compile/show/
251
- // context/report/export/MCP call.
268
+ // etc.) for its diagnostics; re-running it here just to get `.registry`
269
+ // would redo that work a second time per compile/show/context/report/
270
+ // export/MCP call.
252
271
  const typeRegistry = (0, mod_js_4.buildTypeRegistry)([...entries.values()]);
253
272
  let diagnostics = [
254
273
  ...parseDiagnostics,
255
- ...validationDiagnostics,
256
- ...uxilDiagnostics,
274
+ ...pipelineDiagnostics,
257
275
  ...linkTargetDiags,
258
276
  ];
259
277
  // Phase 5: Corpus-aware diagnostic post-pass (ADR-030). A project entry
@@ -289,35 +307,81 @@ function extractLinks(entries) {
289
307
  }
290
308
  /**
291
309
  * Attributes whose value is `slug + optional free-text locator` per
292
- * ADR-002 §2.6 (citation type + legacy Derived-from tolerance). The link
293
- * target is the leading non-whitespace token only.
310
+ * ADR-002 §2.6 (citation type + legacy Derived-from tolerance). Without a
311
+ * bracket locator, the link target is the leading non-whitespace token.
294
312
  */
295
- const LOCATOR_BEARING_ATTRS = new Set([
313
+ const LEADING_TOKEN_ATTRS = new Set([
296
314
  "Derived-from",
297
315
  "References",
298
316
  ]);
299
- /** Map an attribute key+value to zero or more links. */
317
+ /** The link target of one comma-separated part without a locator, as
318
+ * before scenario locators: the leading token for
319
+ * {@linkcode LEADING_TOKEN_ATTRS}, else the whole trimmed part. */
320
+ function plainTarget(key, part) {
321
+ const trimmed = part.trim();
322
+ return LEADING_TOKEN_ATTRS.has(key) ? trimmed.split(/\s/)[0] : trimmed;
323
+ }
324
+ /** Map an attribute key+value to zero or more links. The value is split
325
+ * with {@linkcode splitTraceValues}. A part with a bracket locator
326
+ * (`A [x]`) yields a link to `A` that keeps the normalized locator. Any
327
+ * other part is read as before scenario locators existed
328
+ * ({@linkcode plainTarget}). */
300
329
  function extractLinksFromAttribute(from, key, value, location) {
301
330
  const kind = constants_js_1.ATTR_TO_LINK_KIND[key];
302
331
  if (!kind)
303
332
  return [];
304
- if (LOCATOR_BEARING_ATTRS.has(key)) {
305
- // Comma-separated targets, each "ID §section": split the list (these
306
- // attributes are 0..N), then take the leading ID token of each value,
307
- // dropping the optional free-text locator.
308
- return value
309
- .split(",")
310
- .map((s) => s.trim().split(/\s/)[0])
311
- .filter((s) => s.length > 0)
312
- .map((to) => ({ from, to: (0, mod_js_1.makeDisplayId)(to), kind, location }));
333
+ return (0, split_js_1.splitTraceValues)(value).map((part) => {
334
+ const { target, locator } = (0, split_js_1.parseTraceValue)(part);
335
+ if (locator !== undefined) {
336
+ return { from, to: (0, mod_js_1.makeDisplayId)(target), kind, location, locator };
337
+ }
338
+ return { from, to: (0, mod_js_1.makeDisplayId)(plainTarget(key, part)), kind, location };
339
+ });
340
+ }
341
+ /** Attach `criteria` to every criteria-bearing, non-upstream entry that
342
+ * has at least one scenario. Entries without scenarios are left unchanged, so compiled
343
+ * output for projects without feature blocks does not change. */
344
+ function attachCriteria(entries, profile) {
345
+ for (const [id, entry] of entries) {
346
+ // Upstream (federated) entries are read-only references: no criteria.
347
+ if ((0, mod_js_1.isUpstreamEntry)(entry))
348
+ continue;
349
+ if (!(0, scenarios_js_1.isCriteriaBearing)(entry, profile))
350
+ continue;
351
+ const criteria = (0, scenarios_js_1.buildCriteria)(entry);
352
+ if (criteria.length > 0)
353
+ entries.set(id, { ...entry, criteria });
313
354
  }
314
- // Comma-separated targets for id-list attributes.
315
- return value
316
- .split(",")
317
- .map((s) => s.trim())
318
- .filter((s) => s.length > 0)
319
- .map((to) => ({ from, to: (0, mod_js_1.makeDisplayId)(to), kind, location }));
320
355
  }
356
+ /**
357
+ * Set `locatorResolved` on every link whose locator is on a `"criterion"`
358
+ * relation and whose target resolves to a criteria-bearing entry. For a
359
+ * generated inverse the target of the authored relation is `link.from`.
360
+ */
361
+ function resolveLocators(links, entries, profile) {
362
+ // A target may be written as a display ID or as a ULID.
363
+ const byUlid = new Map();
364
+ for (const e of entries.values())
365
+ if (e.id)
366
+ byUlid.set(e.id, e);
367
+ return links.map((link) => {
368
+ if (link.locator === undefined)
369
+ return link;
370
+ if ((0, mod_js_1.relationLocatorMode)(LINK_KIND_TO_ATTR[link.kind]) !== "criterion") {
371
+ return link;
372
+ }
373
+ const targetId = link.origin === "generated" ? link.from : link.to;
374
+ const target = entries.get(targetId) ?? byUlid.get(targetId);
375
+ if (!target || !(0, scenarios_js_1.isCriteriaBearing)(target, profile))
376
+ return link;
377
+ const resolved = (target.criteria ?? []).some((c) => c.addressable && c.name === link.locator);
378
+ return { ...link, locatorResolved: resolved };
379
+ });
380
+ }
381
+ /** Reverse of {@linkcode ATTR_TO_LINK_KIND}: each link kind has one
382
+ * attribute. */
383
+ const LINK_KIND_TO_ATTR = Object
384
+ .fromEntries(Object.entries(constants_js_1.ATTR_TO_LINK_KIND).map(([attr, kind]) => [kind, attr]));
321
385
  /** Build an adjacency map from links using a key selector. */
322
386
  function buildAdjacency(links, keyFn) {
323
387
  const map = new Map();
@@ -70,8 +70,9 @@ export declare function serializeCompileResult(result: CompileResult): Serialize
70
70
  /**
71
71
  * Convert an {@linkcode Entry} to a JSON-safe {@linkcode SerializedEntry} by
72
72
  * replacing `typedAttributes` (a `ReadonlyMap`) with a plain
73
- * `Record<string, readonly string[]>`, and stripping `properties.sync`
74
- * (privacy rule — never publish connector state).
73
+ * `Record<string, readonly string[]>`, stripping `properties.sync`
74
+ * (privacy rule — never publish connector state), and dropping
75
+ * `attributeLines` (a parser aid for diagnostic locations).
75
76
  */
76
77
  export declare function serializeEntry(entry: Entry): SerializedEntry;
77
78
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/compiler/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,GAAG;IAC7D,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;IAC9D,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,eA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,CAAC;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;IAC9D,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;CAC/D;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClD,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAClD,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAClD,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,sCAAsC;IACtC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;CAC/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,GACpB,uBAAuB,CAazB;AAgBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,CA8B5D"}
@@ -46,8 +46,9 @@ function serializeTypeRegistry(registry) {
46
46
  /**
47
47
  * Convert an {@linkcode Entry} to a JSON-safe {@linkcode SerializedEntry} by
48
48
  * replacing `typedAttributes` (a `ReadonlyMap`) with a plain
49
- * `Record<string, readonly string[]>`, and stripping `properties.sync`
50
- * (privacy rule — never publish connector state).
49
+ * `Record<string, readonly string[]>`, stripping `properties.sync`
50
+ * (privacy rule — never publish connector state), and dropping
51
+ * `attributeLines` (a parser aid for diagnostic locations).
51
52
  */
52
53
  function serializeEntry(entry) {
53
54
  // Replace the ReadonlyMap with a plain Record when populated; omit when empty
@@ -66,7 +67,9 @@ function serializeEntry(entry) {
66
67
  // from a delivered corpus, matching the serialized-field-presence
67
68
  // contract. Object rest destructuring drops the named key regardless
68
69
  // of its value, unlike `...entry` alone.
69
- const { origin, ...rest } = entry;
70
+ // `attributeLines` is a parser aid for diagnostic locations, not part
71
+ // of the compiled schema.
72
+ const { origin, attributeLines: _attributeLines, ...rest } = entry;
70
73
  return {
71
74
  ...rest,
72
75
  typedAttributes,
@@ -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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