@driftsys/markspec 0.9.0 → 0.10.2

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 (131) hide show
  1. package/esm/collect/mod.d.ts +34 -0
  2. package/esm/collect/mod.d.ts.map +1 -0
  3. package/esm/collect/mod.js +37 -0
  4. package/esm/compiler/mod.d.ts +7 -0
  5. package/esm/compiler/mod.d.ts.map +1 -1
  6. package/esm/compiler/mod.js +17 -3
  7. package/esm/compiler/schema.d.ts +8 -1
  8. package/esm/compiler/schema.d.ts.map +1 -1
  9. package/esm/compiler/schema.js +8 -1
  10. package/esm/formatter/dprint.d.ts +62 -0
  11. package/esm/formatter/dprint.d.ts.map +1 -0
  12. package/esm/formatter/dprint.js +83 -0
  13. package/esm/formatter/md_equiv.d.ts +24 -0
  14. package/esm/formatter/md_equiv.d.ts.map +1 -0
  15. package/esm/formatter/md_equiv.js +81 -0
  16. package/esm/formatter/mod.d.ts +25 -0
  17. package/esm/formatter/mod.d.ts.map +1 -1
  18. package/esm/formatter/mod.js +135 -7
  19. package/esm/formatter/prose.d.ts +48 -0
  20. package/esm/formatter/prose.d.ts.map +1 -0
  21. package/esm/formatter/prose.js +85 -0
  22. package/esm/gates/mod.d.ts +82 -0
  23. package/esm/gates/mod.d.ts.map +1 -0
  24. package/esm/gates/mod.js +139 -0
  25. package/esm/lint/runner.d.ts +26 -3
  26. package/esm/lint/runner.d.ts.map +1 -1
  27. package/esm/lint/runner.js +39 -9
  28. package/esm/lock/edge_drift.d.ts +31 -0
  29. package/esm/lock/edge_drift.d.ts.map +1 -0
  30. package/esm/lock/edge_drift.js +29 -0
  31. package/esm/lock/mod.d.ts +2 -0
  32. package/esm/lock/mod.d.ts.map +1 -1
  33. package/esm/lock/mod.js +1 -0
  34. package/esm/mod.d.ts +16 -7
  35. package/esm/mod.d.ts.map +1 -1
  36. package/esm/mod.js +13 -4
  37. package/esm/model/mod.d.ts +27 -1
  38. package/esm/model/mod.d.ts.map +1 -1
  39. package/esm/model/mod.js +10 -0
  40. package/esm/model/profile.d.ts +42 -0
  41. package/esm/model/profile.d.ts.map +1 -1
  42. package/esm/parser/markdown.d.ts.map +1 -1
  43. package/esm/parser/markdown.js +38 -11
  44. package/esm/profile/chain.js +1 -0
  45. package/esm/profile/delivered.d.ts +48 -0
  46. package/esm/profile/delivered.d.ts.map +1 -0
  47. package/esm/profile/delivered.js +103 -0
  48. package/esm/profile/manifest.d.ts +1 -0
  49. package/esm/profile/manifest.d.ts.map +1 -1
  50. package/esm/profile/manifest.js +107 -0
  51. package/esm/profile/merge.d.ts.map +1 -1
  52. package/esm/profile/merge.js +22 -0
  53. package/esm/refs/mod.d.ts.map +1 -1
  54. package/esm/refs/mod.js +22 -0
  55. package/esm/reporter/mod.d.ts.map +1 -1
  56. package/esm/reporter/mod.js +16 -4
  57. package/esm/util/fence.d.ts +8 -0
  58. package/esm/util/fence.d.ts.map +1 -1
  59. package/esm/util/fence.js +22 -0
  60. package/esm/validator/corpus.d.ts +25 -0
  61. package/esm/validator/corpus.d.ts.map +1 -0
  62. package/esm/validator/corpus.js +140 -0
  63. package/esm/validator/mod.d.ts +2 -0
  64. package/esm/validator/mod.d.ts.map +1 -1
  65. package/esm/validator/mod.js +1 -0
  66. package/package.json +3 -1
  67. package/script/collect/mod.d.ts +34 -0
  68. package/script/collect/mod.d.ts.map +1 -0
  69. package/script/collect/mod.js +40 -0
  70. package/script/compiler/mod.d.ts +7 -0
  71. package/script/compiler/mod.d.ts.map +1 -1
  72. package/script/compiler/mod.js +16 -2
  73. package/script/compiler/schema.d.ts +8 -1
  74. package/script/compiler/schema.d.ts.map +1 -1
  75. package/script/compiler/schema.js +8 -1
  76. package/script/formatter/dprint.d.ts +62 -0
  77. package/script/formatter/dprint.d.ts.map +1 -0
  78. package/script/formatter/dprint.js +120 -0
  79. package/script/formatter/md_equiv.d.ts +24 -0
  80. package/script/formatter/md_equiv.d.ts.map +1 -0
  81. package/script/formatter/md_equiv.js +87 -0
  82. package/script/formatter/mod.d.ts +25 -0
  83. package/script/formatter/mod.d.ts.map +1 -1
  84. package/script/formatter/mod.js +135 -6
  85. package/script/formatter/prose.d.ts +48 -0
  86. package/script/formatter/prose.d.ts.map +1 -0
  87. package/script/formatter/prose.js +88 -0
  88. package/script/gates/mod.d.ts +82 -0
  89. package/script/gates/mod.d.ts.map +1 -0
  90. package/script/gates/mod.js +144 -0
  91. package/script/lint/runner.d.ts +26 -3
  92. package/script/lint/runner.d.ts.map +1 -1
  93. package/script/lint/runner.js +39 -9
  94. package/script/lock/edge_drift.d.ts +31 -0
  95. package/script/lock/edge_drift.d.ts.map +1 -0
  96. package/script/lock/edge_drift.js +32 -0
  97. package/script/lock/mod.d.ts +2 -0
  98. package/script/lock/mod.d.ts.map +1 -1
  99. package/script/lock/mod.js +3 -1
  100. package/script/mod.d.ts +16 -7
  101. package/script/mod.d.ts.map +1 -1
  102. package/script/mod.js +56 -29
  103. package/script/model/mod.d.ts +27 -1
  104. package/script/model/mod.d.ts.map +1 -1
  105. package/script/model/mod.js +11 -0
  106. package/script/model/profile.d.ts +42 -0
  107. package/script/model/profile.d.ts.map +1 -1
  108. package/script/parser/markdown.d.ts.map +1 -1
  109. package/script/parser/markdown.js +38 -11
  110. package/script/profile/chain.js +1 -0
  111. package/script/profile/delivered.d.ts +48 -0
  112. package/script/profile/delivered.d.ts.map +1 -0
  113. package/script/profile/delivered.js +109 -0
  114. package/script/profile/manifest.d.ts +1 -0
  115. package/script/profile/manifest.d.ts.map +1 -1
  116. package/script/profile/manifest.js +108 -1
  117. package/script/profile/merge.d.ts.map +1 -1
  118. package/script/profile/merge.js +22 -0
  119. package/script/refs/mod.d.ts.map +1 -1
  120. package/script/refs/mod.js +22 -0
  121. package/script/reporter/mod.d.ts.map +1 -1
  122. package/script/reporter/mod.js +16 -4
  123. package/script/util/fence.d.ts +8 -0
  124. package/script/util/fence.d.ts.map +1 -1
  125. package/script/util/fence.js +23 -0
  126. package/script/validator/corpus.d.ts +25 -0
  127. package/script/validator/corpus.d.ts.map +1 -0
  128. package/script/validator/corpus.js +144 -0
  129. package/script/validator/mod.d.ts +2 -0
  130. package/script/validator/mod.d.ts.map +1 -1
  131. package/script/validator/mod.js +4 -1
@@ -5,9 +5,11 @@
5
5
  * ULID stamping, indentation normalization, trailing backslash enforcement,
6
6
  * and requirement block insertion.
7
7
  */
8
+ import { extname } from "@std/path";
8
9
  import { ulid as defaultUlid } from "@std/ulid";
9
10
  import { stringify as stringifyYaml } from "@std/yaml";
10
11
  import { attributeSpec, CSV_SPLITTABLE_TYPES, IDENTITY_KEY, } from "../model/mod.js";
12
+ import { MARKDOWN_EXTENSIONS } from "../discovery/mod.js";
11
13
  import { ATTR_LINE_RE } from "../parser/attributes.js";
12
14
  import { extractFrontMatter } from "../parser/frontmatter.js";
13
15
  import { parseMarkdown } from "../parser/markdown.js";
@@ -19,6 +21,9 @@ import { buildBodyAst } from "../ast/build.js";
19
21
  import { render as renderBodyAst } from "../ast/render.js";
20
22
  import { normalizeBodyAst } from "../ast/normalize.js";
21
23
  import { astEquivalent } from "../ast/equivalence.js";
24
+ import { formatProseSegments } from "./prose.js";
25
+ import { MARKSPEC_MARKDOWN_GLOBAL_CONFIG, } from "./dprint.js";
26
+ import { markdownSemanticallyEquivalent } from "./md_equiv.js";
22
27
  /**
23
28
  * Decide whether the EARS keyword at `offset` in `line` is at sentence
24
29
  * start (return value true). Delegates to the shared implementation in
@@ -175,6 +180,14 @@ const CANONICAL_ORDER = [
175
180
  * string, preserving the leading/trailing blank-line delimiters
176
181
  * that separate the body from the title and attr block.
177
182
  *
183
+ * When `proseFormat` (ADR-029) is supplied, the AST-canonical body is
184
+ * further polished by the whole-document Markdown formatter (dprint),
185
+ * gated by CommonMark-semantic equivalence — NOT the strict ADR-015
186
+ * relation above, which is byte-verbatim on inline markup and would
187
+ * reject every legitimate re-wrap. A rejected polish keeps the
188
+ * AST-canonical body and raises an info diagnostic (MSL-F012) naming
189
+ * the entry.
190
+ *
178
191
  * Returns `true` when any entry body was rewritten (so `format()` can
179
192
  * keep `changed` accurate for `--check` mode); `false` when every body
180
193
  * was already §5.2-canonical.
@@ -183,7 +196,7 @@ const CANONICAL_ORDER = [
183
196
  * `normalizeBodyAst` is FORMATTER-ONLY — the validate/parse path must
184
197
  * never call it.
185
198
  */
186
- function emitBodyViaAst(lines, file, diagnostics, cachedEntries) {
199
+ function emitBodyViaAst(lines, file, diagnostics, cachedEntries, proseFormat) {
187
200
  // When the caller supplies pre-parsed entries whose line numbers are still
188
201
  // valid in `lines` (i.e., no line-count-changing operations occurred before
189
202
  // this call), skip the re-parse entirely — the common hot path for files
@@ -246,6 +259,52 @@ function emitBodyViaAst(lines, file, diagnostics, cachedEntries) {
246
259
  });
247
260
  continue;
248
261
  }
262
+ // ADR-029: polish the canonical body with the whole-document
263
+ // Markdown formatter. Gated by CommonMark-semantic equivalence —
264
+ // NOT the strict ADR-015 relation, which is byte-verbatim on
265
+ // inline markup and would reject every legitimate re-wrap. On
266
+ // rejection keep the AST-canonical body and say so (info).
267
+ let finalBody = emittedBody;
268
+ if (proseFormat !== undefined) {
269
+ // The body is formatted DEDENTED and re-indented afterwards, so the
270
+ // width budget must shrink by the indent — otherwise a wrap point
271
+ // landing near 80 columns dedented exceeds 80 re-indented, and an
272
+ // external whole-file dprint view (which sees the indent) re-wraps
273
+ // it: a formatter ping-pong. Floor of 20 keeps a pathological indent
274
+ // from degenerating into one-word-per-line output.
275
+ let polished;
276
+ try {
277
+ polished = proseFormat(emittedBody, {
278
+ lineWidth: Math.max(20, MARKSPEC_MARKDOWN_GLOBAL_CONFIG.lineWidth - indent),
279
+ }).replace(/\n$/, "");
280
+ }
281
+ catch {
282
+ // The dprint WASM formatter can throw on a pathological body.
283
+ // Treat a throw exactly like a rejected rewrite: keep the
284
+ // canonical body and report the fallback (never crash the run).
285
+ diagnostics.push({
286
+ code: "MSL-F012",
287
+ severity: "info",
288
+ message: `${entry.displayId}: Markdown pass errored — kept ` +
289
+ `the canonical body`,
290
+ location: entry.location,
291
+ });
292
+ }
293
+ if (polished !== undefined && polished !== emittedBody) {
294
+ if (markdownSemanticallyEquivalent(emittedBody, polished)) {
295
+ finalBody = polished;
296
+ }
297
+ else {
298
+ diagnostics.push({
299
+ code: "MSL-F012",
300
+ severity: "info",
301
+ message: `${entry.displayId}: Markdown pass produced a ` +
302
+ `non-equivalent body — kept the canonical body`,
303
+ location: entry.location,
304
+ });
305
+ }
306
+ }
307
+ }
249
308
  // The emitted body is the §5.2-canonical body and re-builds
250
309
  // AST-equivalent to the canonical AST. Splice it back into the
251
310
  // document — the AST is the load-bearing emission path.
@@ -264,7 +323,7 @@ function emitBodyViaAst(lines, file, diagnostics, cachedEntries) {
264
323
  while (ei >= si && rawSegment[ei].trim() === "") {
265
324
  trailBlanks.unshift(rawSegment[ei--]);
266
325
  }
267
- const emittedLines = emittedBody.split("\n").map((l) => l ? `${indentStr}${l}` : l);
326
+ const emittedLines = finalBody.split("\n").map((l) => l ? `${indentStr}${l}` : l);
268
327
  const newSegment = [...leadBlanks, ...emittedLines, ...trailBlanks];
269
328
  // `changed` accuracy: only flag a body rewrite when the spliced
270
329
  // segment actually differs from the original lines (a §5.2-canonical
@@ -330,7 +389,16 @@ export function format(markdown, options) {
330
389
  const body = rawBody;
331
390
  const { entries } = parseMarkdown(body, { file });
332
391
  const diagnostics = [...fm.diagnostics];
333
- if (entries.length === 0 && !fm.hadFrontMatter) {
392
+ // ADR-029: the whole-document Markdown pass is Markdown-only. Gate on the
393
+ // file extension HERE so the invariant has one home — a caller that wires
394
+ // formatMarkdownProse without its own guard (e.g. a future write tool, or
395
+ // formatSource forwarding options with a source-file label) cannot silently
396
+ // reflow a source file's doc comment as Markdown. The CommonMark-semantic
397
+ // gate cannot catch that class, so it must be prevented, not detected. The
398
+ // CLI/LSP call-site guards remain as defense-in-depth.
399
+ const isMarkdownFile = MARKDOWN_EXTENSIONS.has(extname(file).toLowerCase());
400
+ const proseFormat = isMarkdownFile ? options?.formatMarkdownProse : undefined;
401
+ if (entries.length === 0 && !fm.hadFrontMatter && proseFormat === undefined) {
334
402
  // No entries and no front matter — nothing to format. Returning the
335
403
  // original `markdown` preserves the source's exact byte sequence,
336
404
  // including its line-ending convention.
@@ -344,11 +412,39 @@ export function format(markdown, options) {
344
412
  for (const entry of sorted) {
345
413
  const indent = (entry.location.column - 1) + 2;
346
414
  let attrs = [...entry.rawAttributes];
415
+ const titleLineIdx = entry.location.line - 1;
416
+ // #686: a title that soft-wraps onto extra physical lines is a single
417
+ // Markdown paragraph, but the line-based passes here and in
418
+ // `emitBodyViaAst` (which takes `titleLineIdx + 1` as the body start)
419
+ // assume the title occupies one physical line. Collapse the wrapped
420
+ // title onto a single line so Id stamping and body splicing land on the
421
+ // right lines and the continuation is not clobbered or dropped. The
422
+ // parser already folded the title text on the model side; this repairs
423
+ // the raw buffer to match. The scan runs from the title line to the
424
+ // first blank line (the title/body separator), bounded above by the
425
+ // attribute block so a malformed entry with no blank line before its
426
+ // trailer cannot swallow it.
427
+ if (titleLineIdx >= 0 && titleLineIdx < lines.length) {
428
+ const attrRange = findAttributeBlockRange(lines, entry.location.line, indent);
429
+ const limit = attrRange ? attrRange.start : lines.length;
430
+ let titleEnd = titleLineIdx;
431
+ while (titleEnd + 1 < limit && lines[titleEnd + 1].trim() !== "") {
432
+ titleEnd++;
433
+ }
434
+ if (titleEnd > titleLineIdx) {
435
+ const collapsed = lines[titleLineIdx].replace(/\s+$/, "") + " " +
436
+ lines
437
+ .slice(titleLineIdx + 1, titleEnd + 1)
438
+ .map((l) => l.trim())
439
+ .join(" ");
440
+ lines.splice(titleLineIdx, titleEnd - titleLineIdx + 1, collapsed);
441
+ changed = true;
442
+ }
443
+ }
347
444
  // Title-line bullet canonicalisation per spec §3.2: rewrite `*`
348
445
  // or `+` to `-`. The list-item position from the parser is the
349
446
  // line carrying the bullet marker; we only touch the marker
350
447
  // character itself, leaving the rest of the title alone.
351
- const titleLineIdx = entry.location.line - 1;
352
448
  if (titleLineIdx >= 0 && titleLineIdx < lines.length) {
353
449
  const titleLine = lines[titleLineIdx];
354
450
  const markerCol = entry.location.column - 1;
@@ -451,9 +547,40 @@ export function format(markdown, options) {
451
547
  // emitBodyViaAst skips its re-parse (the hot path for already-formatted
452
548
  // files). When `changed` is true, any splicing or collapse may have
453
549
  // shifted positions, so pass undefined to trigger the normal re-parse.
454
- if (emitBodyViaAst(collapsedLines, file, diagnostics, changed ? undefined : entries))
550
+ if (emitBodyViaAst(collapsedLines, file, diagnostics, changed ? undefined : entries, proseFormat))
455
551
  changed = true;
456
- const formattedBody = collapsedLines.join("\n");
552
+ // ADR-029 whole-document Markdown pass: prose segments outside entry
553
+ // blocks through dprint, gated per segment. Entry bodies were already
554
+ // polished inside emitBodyViaAst. Re-parse for fresh extents when any
555
+ // earlier pass changed line positions.
556
+ let proseLines = collapsedLines;
557
+ if (proseFormat !== undefined) {
558
+ const proseEntries = changed
559
+ ? parseMarkdown(collapsedLines.join("\n"), { file }).entries
560
+ : entries;
561
+ const extents = proseEntries.map((e) => {
562
+ const start = e.location.line - 1;
563
+ const entryIndent = (e.location.column - 1) + 2;
564
+ return { start, end: findItemEnd(collapsedLines, start, entryIndent) };
565
+ });
566
+ const prose = formatProseSegments(collapsedLines, extents, proseFormat);
567
+ if (prose.changed)
568
+ changed = true;
569
+ for (const fallback of prose.fallbacks) {
570
+ const cause = fallback.reason === "error"
571
+ ? "errored"
572
+ : "produced non-equivalent output";
573
+ diagnostics.push({
574
+ code: "MSL-F012",
575
+ severity: "info",
576
+ message: `Markdown pass ${cause} for this prose segment — kept ` +
577
+ `the original text`,
578
+ location: { file, line: fallback.line + 1, column: 1 },
579
+ });
580
+ }
581
+ proseLines = prose.lines;
582
+ }
583
+ const formattedBody = proseLines.join("\n");
457
584
  if (fm.hadFrontMatter) {
458
585
  const canonicalFm = renderFrontMatter(fm.attributes);
459
586
  const outputLf = canonicalFm + formattedBody;
@@ -616,10 +743,11 @@ export function renderAttributeBlock(attributes, indent) {
616
743
  }
617
744
  /**
618
745
  * Find the 0-based line index where a list item's content ends.
746
+ * Exported for the ADR-029 prose pass (entry-extent computation).
619
747
  * Scans forward from the entry start, stopping at: a sibling list item
620
748
  * (`- ` at the entry's marker column), a line with less indent, or EOF.
621
749
  */
622
- function findItemEnd(lines, startIdx, indent) {
750
+ export function findItemEnd(lines, startIdx, indent) {
623
751
  const indentStr = " ".repeat(indent);
624
752
  // The marker column is indent - 2 (e.g., indent 2 → marker at column 0).
625
753
  const markerPrefix = " ".repeat(Math.max(0, indent - 2)) + "- ";
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @module formatter/prose
3
+ *
4
+ * ADR-029 whole-document Markdown pass: splits a document's lines into
5
+ * prose / entry-block segments and routes each prose segment through
6
+ * the injected {@linkcode ProseFormatter} (dprint-markdown). Every
7
+ * rewritten segment must pass {@linkcode markdownSemanticallyEquivalent}
8
+ * against its original — a rejected segment is kept byte-identical and
9
+ * reported via `fallbacks` (with its reason) so `format()` can emit an
10
+ * advisory diagnostic ("never make a file worse").
11
+ *
12
+ * Entry blocks (title line → item end, trailers included) are never
13
+ * given to dprint here; entry BODIES are polished separately inside
14
+ * `emitBodyViaAst` (core/formatter/mod.ts) where the parser's
15
+ * dedent/re-indent machinery and the body-AST gate already live.
16
+ */
17
+ import type { ProseFormatter } from "./dprint.js";
18
+ /** 0-based `[start, end)` line span of one entry block. */
19
+ export interface EntryExtent {
20
+ readonly start: number;
21
+ readonly end: number;
22
+ }
23
+ /**
24
+ * Why a prose segment kept its original text instead of the formatted
25
+ * output: the dprint formatter threw (`"error"`), or its output failed the
26
+ * CommonMark-semantic gate (`"non-equivalent"`). Threaded so `format()`
27
+ * can emit an accurate MSL-F012 cause per segment rather than collapsing
28
+ * both into one message.
29
+ */
30
+ export interface ProseFallback {
31
+ readonly line: number;
32
+ readonly reason: "error" | "non-equivalent";
33
+ }
34
+ /** Result of {@linkcode formatProseSegments}. */
35
+ export interface ProsePassResult {
36
+ readonly lines: string[];
37
+ readonly changed: boolean;
38
+ /** One entry per prose segment that fell back to its original text,
39
+ * with the 0-based first line and the reason. */
40
+ readonly fallbacks: readonly ProseFallback[];
41
+ }
42
+ /**
43
+ * Format every prose gap between entry extents. Boundary blank lines
44
+ * stay outside the formatted chunk so entry-block separation is never
45
+ * disturbed.
46
+ */
47
+ export declare function formatProseSegments(lines: readonly string[], entryExtents: readonly EntryExtent[], proseFormat: ProseFormatter): ProsePassResult;
48
+ //# sourceMappingURL=prose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prose.d.ts","sourceRoot":"","sources":["../../src/formatter/prose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,CAAC;CAC7C;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;qDACiD;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,WAAW,EAAE,cAAc,GAC1B,eAAe,CA4DjB"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @module formatter/prose
3
+ *
4
+ * ADR-029 whole-document Markdown pass: splits a document's lines into
5
+ * prose / entry-block segments and routes each prose segment through
6
+ * the injected {@linkcode ProseFormatter} (dprint-markdown). Every
7
+ * rewritten segment must pass {@linkcode markdownSemanticallyEquivalent}
8
+ * against its original — a rejected segment is kept byte-identical and
9
+ * reported via `fallbacks` (with its reason) so `format()` can emit an
10
+ * advisory diagnostic ("never make a file worse").
11
+ *
12
+ * Entry blocks (title line → item end, trailers included) are never
13
+ * given to dprint here; entry BODIES are polished separately inside
14
+ * `emitBodyViaAst` (core/formatter/mod.ts) where the parser's
15
+ * dedent/re-indent machinery and the body-AST gate already live.
16
+ */
17
+ import { markdownSemanticallyEquivalent } from "./md_equiv.js";
18
+ /**
19
+ * Format every prose gap between entry extents. Boundary blank lines
20
+ * stay outside the formatted chunk so entry-block separation is never
21
+ * disturbed.
22
+ */
23
+ export function formatProseSegments(lines, entryExtents, proseFormat) {
24
+ const extents = [...entryExtents].sort((a, b) => a.start - b.start);
25
+ const out = [];
26
+ const fallbacks = [];
27
+ let changed = false;
28
+ let cursor = 0;
29
+ const flushProse = (gapStart, gapEnd) => {
30
+ const segment = lines.slice(gapStart, gapEnd);
31
+ // Keep boundary blank lines verbatim, format only the core.
32
+ let from = 0;
33
+ while (from < segment.length && segment[from].trim() === "")
34
+ from++;
35
+ let to = segment.length;
36
+ while (to > from && segment[to - 1].trim() === "")
37
+ to--;
38
+ if (from >= to) {
39
+ out.push(...segment);
40
+ return;
41
+ }
42
+ const chunk = segment.slice(from, to).join("\n");
43
+ let formatted;
44
+ try {
45
+ formatted = proseFormat(chunk).replace(/\n$/, "");
46
+ }
47
+ catch {
48
+ // The dprint WASM formatter can throw on a pathological fragment.
49
+ // Treat a throw exactly like a rejected rewrite: keep the original
50
+ // segment and report the fallback (never crash the whole run).
51
+ fallbacks.push({ line: gapStart + from, reason: "error" });
52
+ out.push(...segment);
53
+ return;
54
+ }
55
+ if (formatted === chunk) {
56
+ out.push(...segment);
57
+ return;
58
+ }
59
+ if (!markdownSemanticallyEquivalent(chunk, formatted)) {
60
+ fallbacks.push({ line: gapStart + from, reason: "non-equivalent" });
61
+ out.push(...segment);
62
+ return;
63
+ }
64
+ changed = true;
65
+ out.push(...segment.slice(0, from));
66
+ out.push(...formatted.split("\n"));
67
+ out.push(...segment.slice(to));
68
+ };
69
+ for (const extent of extents) {
70
+ // Defensive clamp: extents from a healthy parse are disjoint and
71
+ // well-formed, but this module is the last guard between entry
72
+ // blocks and the prose formatter — never re-emit lines already
73
+ // written (overlap/duplicate extents) and treat end < start as
74
+ // zero-width instead of walking the cursor backwards.
75
+ const start = Math.max(extent.start, cursor);
76
+ const end = Math.max(extent.end, start);
77
+ if (start > cursor)
78
+ flushProse(cursor, start);
79
+ out.push(...lines.slice(start, end));
80
+ cursor = end;
81
+ }
82
+ if (cursor < lines.length)
83
+ flushProse(cursor, lines.length);
84
+ return { lines: out, changed, fallbacks };
85
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @module core/gates
3
+ *
4
+ * Composite-`check` gate stages (ADR-027). Each function is a pure,
5
+ * independently-testable transformation from already-gathered inputs to a
6
+ * `Diagnostic[]`; the CLI `check` command orchestrates them (gather inputs →
7
+ * call stages → merge diagnostics → render) and owns the scope policy that
8
+ * decides whether they run at all (project-wide only).
9
+ *
10
+ * Extracted from `cli/commands/check.ts` (#659) so the diagnostic-producing
11
+ * logic lives in `core` — composable, unit-testable in isolation, and reusable
12
+ * by future surfaces — rather than inline in the command body. The command
13
+ * keeps the I/O it must do (loading the Markdown prose formatter, reading
14
+ * `markspec.lock`) and feeds the results in.
15
+ *
16
+ * `gates` is a top-level composition layer: it depends on `formatter`,
17
+ * `parser`, `refs`, `lock`, and `lint`, and nothing in those depends back on
18
+ * it — no cycle.
19
+ */
20
+ import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
21
+ import type { ProseFormatter } from "../formatter/dprint.js";
22
+ import { type LockEdge, type ParseLockfileResult } from "../lock/mod.js";
23
+ /**
24
+ * Format-drift gate — the `MSL-F010` (formatter drift) and `MSL-F011`
25
+ * (reference-canonicalization drift) findings.
26
+ *
27
+ * Runs the SAME `format() → parse → canonicalizeRefs` sequence `markspec fmt`
28
+ * performs, from the same exclude-aware corpus, so bare `check` and
29
+ * `fmt --check` never disagree on what "formatted" means. `MSL-F010` is pure
30
+ * formatter drift; `MSL-F011` is reference-canonicalization drift (a ULID or
31
+ * stale display ID `fmt` would rewrite) — kept distinct so the author knows
32
+ * which fmt concern fired. Markdown only — `markspec fmt` never rewrites source
33
+ * files, so the caller passes only Markdown file contents.
34
+ *
35
+ * @param mdContents Markdown file path → current on-disk content.
36
+ * @param entries The full parsed entry set (project + corpus). Only
37
+ * project-owned entries (`!e.origin`) build the reference index
38
+ * `canonicalizeRefs` heals against — `markspec fmt` is corpus-blind (ADR-030).
39
+ * @param ledger The lockfile's `[[edge]]` ULID ledger (`lockfile.edges`, or
40
+ * `[]` when there is no lockfile), threaded into `canonicalizeRefs`.
41
+ * @param formatMarkdownProse The loaded ADR-029 whole-document Markdown
42
+ * formatter, or `undefined` to degrade to entry-only formatting.
43
+ */
44
+ export declare function fmtDriftGate(mdContents: ReadonlyMap<string, string>, entries: readonly Entry[], ledger: readonly LockEdge[], formatMarkdownProse: ProseFormatter | undefined): Promise<Diagnostic[]>;
45
+ /**
46
+ * Lockfile-drift gate — the `MSL-L212` offline traceability-edge drift finding.
47
+ *
48
+ * A malformed lockfile surfaces the parser's own diagnostics unchanged. An
49
+ * intact lockfile is compared against the current graph's canonical edge hash.
50
+ * Offline by design — upstream resolution (network) stays in
51
+ * `markspec lock --check`.
52
+ *
53
+ * Corpus-blind by design: the lockfile is not corpus-aware yet (ADR-030 defers
54
+ * lockfile integration), so `markspec lock` never counts corpus edges. Counting
55
+ * them here would raise an `MSL-L212` drift error that `markspec lock` can never
56
+ * fix — a consumer gate must not fail on upstream content the consumer cannot
57
+ * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
58
+ * mirroring `markspec lock`.
59
+ *
60
+ * @param lockParse The parsed `markspec.lock` (already read from disk).
61
+ * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
62
+ * location so JSON consumers that group by `location.file` keep the finding.
63
+ * @param entries The full parsed entry set; corpus entries are filtered out.
64
+ */
65
+ export declare function lockfileDriftGate(lockParse: ParseLockfileResult, lockPath: string, entries: readonly Entry[]): Promise<Diagnostic[]>;
66
+ /**
67
+ * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
68
+ * plain {@linkcode Diagnostic}s.
69
+ *
70
+ * Pass the FULL entry set (project + corpus) and the active profile.
71
+ * {@linkcode runLint} excludes corpus entries from its output but keeps them in
72
+ * the glossary / `$Identifier` indexes, so a corpus-defined term still silences
73
+ * Q500 in project prose (ADR-030 §D4). The profile threads into `isProseScope`
74
+ * so profile-typed entries are scoped (#675).
75
+ *
76
+ * `runLint`'s {@linkcode LintDiagnostic} carries `slug`/`group`/`score` fields
77
+ * that must not leak into `check`'s stable JSON schema — the result is projected
78
+ * to plain {@linkcode Diagnostic}. `runLint`'s `readFile` option (for glossary
79
+ * file indexing) is not needed here: `check` passes no `glossaryFilePaths`.
80
+ */
81
+ export declare function proseLintGate(entries: readonly Entry[], profile: EffectiveProfile | undefined): Promise<Diagnostic[]>;
82
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/gates/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,mBAAmB,EAAE,cAAc,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAuCvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC,CAiBvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,EAAE,CAAC,CAQvB"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @module core/gates
3
+ *
4
+ * Composite-`check` gate stages (ADR-027). Each function is a pure,
5
+ * independently-testable transformation from already-gathered inputs to a
6
+ * `Diagnostic[]`; the CLI `check` command orchestrates them (gather inputs →
7
+ * call stages → merge diagnostics → render) and owns the scope policy that
8
+ * decides whether they run at all (project-wide only).
9
+ *
10
+ * Extracted from `cli/commands/check.ts` (#659) so the diagnostic-producing
11
+ * logic lives in `core` — composable, unit-testable in isolation, and reusable
12
+ * by future surfaces — rather than inline in the command body. The command
13
+ * keeps the I/O it must do (loading the Markdown prose formatter, reading
14
+ * `markspec.lock`) and feeds the results in.
15
+ *
16
+ * `gates` is a top-level composition layer: it depends on `formatter`,
17
+ * `parser`, `refs`, `lock`, and `lint`, and nothing in those depends back on
18
+ * it — no cycle.
19
+ */
20
+ import { format } from "../formatter/mod.js";
21
+ import { parseFile } from "../parser/mod.js";
22
+ import { buildRefIndex, canonicalizeRefs } from "../refs/mod.js";
23
+ import { detectOfflineEdgeDrift, } from "../lock/mod.js";
24
+ import { runLint } from "../lint/mod.js";
25
+ /**
26
+ * Format-drift gate — the `MSL-F010` (formatter drift) and `MSL-F011`
27
+ * (reference-canonicalization drift) findings.
28
+ *
29
+ * Runs the SAME `format() → parse → canonicalizeRefs` sequence `markspec fmt`
30
+ * performs, from the same exclude-aware corpus, so bare `check` and
31
+ * `fmt --check` never disagree on what "formatted" means. `MSL-F010` is pure
32
+ * formatter drift; `MSL-F011` is reference-canonicalization drift (a ULID or
33
+ * stale display ID `fmt` would rewrite) — kept distinct so the author knows
34
+ * which fmt concern fired. Markdown only — `markspec fmt` never rewrites source
35
+ * files, so the caller passes only Markdown file contents.
36
+ *
37
+ * @param mdContents Markdown file path → current on-disk content.
38
+ * @param entries The full parsed entry set (project + corpus). Only
39
+ * project-owned entries (`!e.origin`) build the reference index
40
+ * `canonicalizeRefs` heals against — `markspec fmt` is corpus-blind (ADR-030).
41
+ * @param ledger The lockfile's `[[edge]]` ULID ledger (`lockfile.edges`, or
42
+ * `[]` when there is no lockfile), threaded into `canonicalizeRefs`.
43
+ * @param formatMarkdownProse The loaded ADR-029 whole-document Markdown
44
+ * formatter, or `undefined` to degrade to entry-only formatting.
45
+ */
46
+ export async function fmtDriftGate(mdContents, entries, ledger, formatMarkdownProse) {
47
+ const diagnostics = [];
48
+ // Corpus-blind by design (ADR-030): `markspec fmt` never loads the delivered
49
+ // corpus, so it can only canonicalize references into project-owned entries.
50
+ // Building the heal index over the full set (including corpus) would flag an
51
+ // MSL-F011 drift that `fmt` can never fix — a permanently red gate for any
52
+ // consumer using a delivered corpus. Filter to `!e.origin`, mirroring
53
+ // lockfileDriftGate.
54
+ const refIndex = buildRefIndex(entries.filter((e) => !e.origin));
55
+ for (const [filePath, content] of mdContents) {
56
+ const formatted = format(content, {
57
+ file: filePath,
58
+ formatMarkdownProse,
59
+ });
60
+ if (formatted.changed) {
61
+ diagnostics.push({
62
+ code: "MSL-F010",
63
+ severity: "error",
64
+ message: "file is not formatted (run `markspec fmt`)",
65
+ location: { file: filePath, line: 1, column: 1 },
66
+ });
67
+ }
68
+ const parsed = await parseFile(formatted.output, { file: filePath });
69
+ const refResult = canonicalizeRefs(formatted.output, parsed.entries, refIndex, ledger);
70
+ if (refResult.changed) {
71
+ diagnostics.push({
72
+ code: "MSL-F011",
73
+ severity: "error",
74
+ message: "references are not canonical (run `markspec fmt`)",
75
+ location: { file: filePath, line: 1, column: 1 },
76
+ });
77
+ }
78
+ }
79
+ return diagnostics;
80
+ }
81
+ /**
82
+ * Lockfile-drift gate — the `MSL-L212` offline traceability-edge drift finding.
83
+ *
84
+ * A malformed lockfile surfaces the parser's own diagnostics unchanged. An
85
+ * intact lockfile is compared against the current graph's canonical edge hash.
86
+ * Offline by design — upstream resolution (network) stays in
87
+ * `markspec lock --check`.
88
+ *
89
+ * Corpus-blind by design: the lockfile is not corpus-aware yet (ADR-030 defers
90
+ * lockfile integration), so `markspec lock` never counts corpus edges. Counting
91
+ * them here would raise an `MSL-L212` drift error that `markspec lock` can never
92
+ * fix — a consumer gate must not fail on upstream content the consumer cannot
93
+ * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
94
+ * mirroring `markspec lock`.
95
+ *
96
+ * @param lockParse The parsed `markspec.lock` (already read from disk).
97
+ * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
98
+ * location so JSON consumers that group by `location.file` keep the finding.
99
+ * @param entries The full parsed entry set; corpus entries are filtered out.
100
+ */
101
+ export async function lockfileDriftGate(lockParse, lockPath, entries) {
102
+ if (!lockParse.lockfile) {
103
+ return [...lockParse.diagnostics];
104
+ }
105
+ const projectEntries = entries.filter((e) => !e.origin);
106
+ const drift = await detectOfflineEdgeDrift(projectEntries, lockParse.lockfile.generatedCache);
107
+ if (!drift.drifted)
108
+ return [];
109
+ return [{
110
+ code: "MSL-L212",
111
+ severity: "error",
112
+ message: `traceability edges drifted from markspec.lock: locked ${drift.lockedCount} edge(s), current ${drift.currentCount} — run \`markspec lock\` to refresh. (After upgrading MarkSpec this can also fire once because traceability inputs now include source-file doc comments; re-running \`markspec lock\` clears it.)`,
113
+ location: { file: lockPath, line: 1, column: 1 },
114
+ }];
115
+ }
116
+ /**
117
+ * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
118
+ * plain {@linkcode Diagnostic}s.
119
+ *
120
+ * Pass the FULL entry set (project + corpus) and the active profile.
121
+ * {@linkcode runLint} excludes corpus entries from its output but keeps them in
122
+ * the glossary / `$Identifier` indexes, so a corpus-defined term still silences
123
+ * Q500 in project prose (ADR-030 §D4). The profile threads into `isProseScope`
124
+ * so profile-typed entries are scoped (#675).
125
+ *
126
+ * `runLint`'s {@linkcode LintDiagnostic} carries `slug`/`group`/`score` fields
127
+ * that must not leak into `check`'s stable JSON schema — the result is projected
128
+ * to plain {@linkcode Diagnostic}. `runLint`'s `readFile` option (for glossary
129
+ * file indexing) is not needed here: `check` passes no `glossaryFilePaths`.
130
+ */
131
+ export async function proseLintGate(entries, profile) {
132
+ const lintResult = await runLint({ entries, profile });
133
+ return lintResult.diagnostics.map((d) => ({
134
+ code: d.code,
135
+ severity: d.severity,
136
+ message: d.message,
137
+ location: d.location,
138
+ }));
139
+ }
@@ -6,7 +6,7 @@
6
6
  * suppression hygiene on all Authored entries, applies suppression, and
7
7
  * returns the final diagnostics.
8
8
  */
9
- import type { Entry } from "../model/mod.js";
9
+ import type { EffectiveProfile, Entry } from "../model/mod.js";
10
10
  import type { LintDiagnostic } from "./types.js";
11
11
  import type { FileReader } from "./glossary.js";
12
12
  import type { ScoreRollup } from "./score.js";
@@ -16,10 +16,23 @@ import type { ScoreRollup } from "./score.js";
16
16
  * In-scope: Authored shape AND resolved core type is Specification or
17
17
  * a direct subtype (Requirement, Test, Contract, Record, Risk).
18
18
  * Reference-shape entries are always excluded.
19
+ *
20
+ * `profile` is threaded into {@linkcode resolvedCoreType} so an entry
21
+ * classified purely by a profile type (via `Type:` or a profile
22
+ * display-id pattern, e.g. `platform-component`) resolves to its core
23
+ * ancestor through the profile's `extends:` chain. Without it (#675),
24
+ * such entries never enter prose scope and are silently skipped.
19
25
  */
20
- export declare function isProseScope(entry: Entry): boolean;
26
+ export declare function isProseScope(entry: Entry, profile?: EffectiveProfile): boolean;
21
27
  export interface LintOptions {
22
28
  readonly entries: readonly Entry[];
29
+ /**
30
+ * Active profile, threaded into {@linkcode isProseScope} so entries
31
+ * classified purely by a profile type enter prose scope (#675). Optional:
32
+ * callers with no profile (e.g. file-local prose scoring) pass nothing and
33
+ * only core-resolvable types are scoped.
34
+ */
35
+ readonly profile?: EffectiveProfile;
23
36
  /** Profile-extended capitalized-allow lexicon. Defaults to core baseline. */
24
37
  readonly capitalizedAllow?: ReadonlySet<string>;
25
38
  /** Glossary file paths discovered by the listing-directive validator. */
@@ -34,8 +47,18 @@ export interface LintResult {
34
47
  /**
35
48
  * Run the lint pipeline on a set of entries.
36
49
  *
50
+ * Corpus handling (ADR-030 §D4): the glossary and `$Identifier` indexes are
51
+ * built from the FULL `entries` set — including delivered-corpus entries — so a
52
+ * term or `$Identifier` defined only in a corpus document still silences Q500
53
+ * in project prose (the additive-enrichment invariant). Prose *diagnostics*,
54
+ * suppression hygiene, and the score roll-up run only on project entries
55
+ * (`entry.origin === undefined`): a consumer cannot fix an upstream profile's
56
+ * prose, so corpus findings are never emitted and never skew the score. Callers
57
+ * therefore pass the merged project + corpus set, not a pre-filtered one.
58
+ *
37
59
  * Pipeline:
38
- * 1. Filter to in-scope entries (Specification subtypes, Authored shape).
60
+ * 1. Filter to in-scope entries (Specification subtypes, Authored shape,
61
+ * non-corpus).
39
62
  * 2. Build glossary index from DefinitionList nodes and glossary files.
40
63
  * 3. Run lexicon rules on each in-scope entry's prose blocks.
41
64
  * 4. Run structural rules on each in-scope entry.
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAKlD;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA8EvE"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAKT;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA0FvE"}