@driftsys/markspec 0.12.0 → 0.12.1

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 (75) hide show
  1. package/esm/config/markspec.d.ts +2 -2
  2. package/esm/config/mod.d.ts.map +1 -1
  3. package/esm/config/mod.js +47 -5
  4. package/esm/discovery/projects.d.ts +6 -4
  5. package/esm/discovery/projects.d.ts.map +1 -1
  6. package/esm/discovery/projects.js +27 -17
  7. package/esm/formatter/entry_body.d.ts +5 -7
  8. package/esm/formatter/entry_body.d.ts.map +1 -1
  9. package/esm/formatter/entry_body.js +13 -9
  10. package/esm/formatter/md_equiv.d.ts +6 -5
  11. package/esm/formatter/md_equiv.d.ts.map +1 -1
  12. package/esm/formatter/md_equiv.js +6 -5
  13. package/esm/formatter/mod.d.ts +4 -1
  14. package/esm/formatter/mod.d.ts.map +1 -1
  15. package/esm/formatter/mod.js +206 -8
  16. package/esm/formatter/tab_markers.d.ts +15 -0
  17. package/esm/formatter/tab_markers.d.ts.map +1 -0
  18. package/esm/formatter/tab_markers.js +133 -0
  19. package/esm/gates/mod.d.ts.map +1 -1
  20. package/esm/gates/mod.js +1 -1
  21. package/esm/lock/upstream_deps.js +1 -1
  22. package/esm/mod.d.ts +2 -1
  23. package/esm/mod.d.ts.map +1 -1
  24. package/esm/mod.js +2 -1
  25. package/esm/model/mod.d.ts +1 -1
  26. package/esm/refs/mod.d.ts +6 -2
  27. package/esm/refs/mod.d.ts.map +1 -1
  28. package/esm/refs/mod.js +8 -3
  29. package/esm/sync/mapping.d.ts +4 -3
  30. package/esm/sync/mapping.d.ts.map +1 -1
  31. package/esm/sync/mapping.js +52 -9
  32. package/esm/util/display_id.d.ts +20 -0
  33. package/esm/util/display_id.d.ts.map +1 -0
  34. package/esm/util/display_id.js +19 -0
  35. package/esm/validator/pipeline.d.ts +6 -4
  36. package/esm/validator/pipeline.d.ts.map +1 -1
  37. package/esm/validator/pipeline.js +13 -11
  38. package/package.json +1 -1
  39. package/script/config/markspec.d.ts +2 -2
  40. package/script/config/mod.d.ts.map +1 -1
  41. package/script/config/mod.js +47 -5
  42. package/script/discovery/projects.d.ts +6 -4
  43. package/script/discovery/projects.d.ts.map +1 -1
  44. package/script/discovery/projects.js +27 -17
  45. package/script/formatter/entry_body.d.ts +5 -7
  46. package/script/formatter/entry_body.d.ts.map +1 -1
  47. package/script/formatter/entry_body.js +13 -9
  48. package/script/formatter/md_equiv.d.ts +6 -5
  49. package/script/formatter/md_equiv.d.ts.map +1 -1
  50. package/script/formatter/md_equiv.js +6 -5
  51. package/script/formatter/mod.d.ts +4 -1
  52. package/script/formatter/mod.d.ts.map +1 -1
  53. package/script/formatter/mod.js +205 -7
  54. package/script/formatter/tab_markers.d.ts +15 -0
  55. package/script/formatter/tab_markers.d.ts.map +1 -0
  56. package/script/formatter/tab_markers.js +141 -0
  57. package/script/gates/mod.d.ts.map +1 -1
  58. package/script/gates/mod.js +1 -1
  59. package/script/lock/upstream_deps.js +1 -1
  60. package/script/mod.d.ts +2 -1
  61. package/script/mod.d.ts.map +1 -1
  62. package/script/mod.js +8 -5
  63. package/script/model/mod.d.ts +1 -1
  64. package/script/refs/mod.d.ts +6 -2
  65. package/script/refs/mod.d.ts.map +1 -1
  66. package/script/refs/mod.js +8 -3
  67. package/script/sync/mapping.d.ts +4 -3
  68. package/script/sync/mapping.d.ts.map +1 -1
  69. package/script/sync/mapping.js +52 -9
  70. package/script/util/display_id.d.ts +20 -0
  71. package/script/util/display_id.d.ts.map +1 -0
  72. package/script/util/display_id.js +22 -0
  73. package/script/validator/pipeline.d.ts +6 -4
  74. package/script/validator/pipeline.d.ts.map +1 -1
  75. package/script/validator/pipeline.js +13 -11
@@ -34,9 +34,13 @@ export declare function buildRefIndex(entries: readonly Entry[]): RefIndex;
34
34
  * Rewrite trace-attribute values in `content` per the canonicalise/heal rules.
35
35
  * `entries` MUST be the parse of `content` (used to map each trailer line to its
36
36
  * source entry's stable ULID). Returns the rewritten text and whether anything
37
- * changed. Lossless: only resolvable value tokens are replaced.
37
+ * changed. Lossless: only resolvable value tokens are replaced. Optional
38
+ * `preservedRanges` exclude 0-based, end-exclusive line spans from rewriting.
38
39
  */
39
- export declare function canonicalizeRefs(content: string, entries: readonly Entry[], index: RefIndex, ledger: readonly LockEdge[]): {
40
+ export declare function canonicalizeRefs(content: string, entries: readonly Entry[], index: RefIndex, ledger: readonly LockEdge[], preservedRanges?: readonly {
41
+ readonly start: number;
42
+ readonly end: number;
43
+ }[]): {
40
44
  output: string;
41
45
  changed: boolean;
42
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/refs/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAGnD,CAAC;AAEH,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,QAAQ,CAajE;AAcD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,QAAQ,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAqGtC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/refs/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAGnD,CAAC;AAEH,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,QAAQ,CAajE;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,eAAe,GAAE,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACtE,GACH;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAwGtC"}
@@ -60,9 +60,10 @@ const VALUE_TOKEN_RE = /[^\s,]+/g;
60
60
  * Rewrite trace-attribute values in `content` per the canonicalise/heal rules.
61
61
  * `entries` MUST be the parse of `content` (used to map each trailer line to its
62
62
  * source entry's stable ULID). Returns the rewritten text and whether anything
63
- * changed. Lossless: only resolvable value tokens are replaced.
63
+ * changed. Lossless: only resolvable value tokens are replaced. Optional
64
+ * `preservedRanges` exclude 0-based, end-exclusive line spans from rewriting.
64
65
  */
65
- function canonicalizeRefs(content, entries, index, ledger) {
66
+ function canonicalizeRefs(content, entries, index, ledger, preservedRanges = []) {
66
67
  const ledgerByKey = new Map();
67
68
  for (const e of ledger) {
68
69
  if (e.targetUlid === undefined)
@@ -92,7 +93,11 @@ function canonicalizeRefs(content, entries, index, ledger) {
92
93
  let changed = false;
93
94
  // Share CommonMark fence boundaries with other prose passes. Compute them
94
95
  // once so both the main loop and continuation loop remain linear (#705).
95
- const fencedLines = (0, fence_js_1.fencedCodeLines)(content);
96
+ const fencedLines = new Set((0, fence_js_1.fencedCodeLines)(content));
97
+ for (const range of preservedRanges) {
98
+ for (let i = range.start; i < range.end; i++)
99
+ fencedLines.add(i);
100
+ }
96
101
  for (let i = 0; i < lines.length; i++) {
97
102
  if (fencedLines.has(i))
98
103
  continue;
@@ -7,7 +7,7 @@
7
7
  * cache TTL.
8
8
  *
9
9
  * Diagnostic family is `MSL-S###`:
10
- * - MSL-S001 — malformed YAML / unsupported schema
10
+ * - MSL-S001 — malformed YAML / invalid structure / unsupported schema
11
11
  * - MSL-S002 — locked + outbound contradiction
12
12
  * - MSL-S003 — unknown conflict policy (newest-wins removed pre-1.0)
13
13
  * - MSL-S004 — system ≠ identity.external-id-scheme
@@ -52,8 +52,9 @@ export interface ParseMappingResult {
52
52
  }
53
53
  /**
54
54
  * Parse and validate one mapping.yaml. Returns the model when valid, or
55
- * an MSL-S### diagnostic when not. Single-shot — stops at the first
56
- * integrity failure to keep the repair signal clear.
55
+ * an MSL-S### diagnostic when not. Never throws on invalid YAML or invalid
56
+ * field shapes. Single-shot — stops at the first integrity failure to keep
57
+ * the repair signal clear.
57
58
  */
58
59
  export declare function parseMapping(yaml: string, sourcePath: string): ParseMappingResult;
59
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../src/sync/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,2BAA2B;AAC3B,MA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W,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AASD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,kBAAkB,CAoLpB;AASD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,UAAU,EAAE,CA2B3E"}
@@ -8,7 +8,7 @@
8
8
  * cache TTL.
9
9
  *
10
10
  * Diagnostic family is `MSL-S###`:
11
- * - MSL-S001 — malformed YAML / unsupported schema
11
+ * - MSL-S001 — malformed YAML / invalid structure / unsupported schema
12
12
  * - MSL-S002 — locked + outbound contradiction
13
13
  * - MSL-S003 — unknown conflict policy (newest-wins removed pre-1.0)
14
14
  * - MSL-S004 — system ≠ identity.external-id-scheme
@@ -27,8 +27,9 @@ const ALLOWED_POLICIES = new Set([
27
27
  ]);
28
28
  /**
29
29
  * Parse and validate one mapping.yaml. Returns the model when valid, or
30
- * an MSL-S### diagnostic when not. Single-shot — stops at the first
31
- * integrity failure to keep the repair signal clear.
30
+ * an MSL-S### diagnostic when not. Never throws on invalid YAML or invalid
31
+ * field shapes. Single-shot — stops at the first integrity failure to keep
32
+ * the repair signal clear.
32
33
  */
33
34
  function parseMapping(yaml, sourcePath) {
34
35
  let raw;
@@ -38,7 +39,16 @@ function parseMapping(yaml, sourcePath) {
38
39
  catch (e) {
39
40
  return fail("MSL-S001", `Malformed mapping.yaml: ${e.message}`, sourcePath);
40
41
  }
42
+ if (raw === null || raw === undefined) {
43
+ return fail("MSL-S001", "Mapping YAML is empty or null", sourcePath);
44
+ }
45
+ if (!isRecord(raw)) {
46
+ return fail("MSL-S001", "Mapping YAML must be an object", sourcePath);
47
+ }
41
48
  const schema = raw.schema;
49
+ if (typeof schema !== "number") {
50
+ return fail("MSL-S001", "Missing or non-number `schema` field", sourcePath);
51
+ }
42
52
  if (schema !== SUPPORTED_SCHEMA) {
43
53
  return fail("MSL-S001", `Unsupported mapping schema: ${schema} (expected ${SUPPORTED_SCHEMA})`, sourcePath);
44
54
  }
@@ -47,12 +57,18 @@ function parseMapping(yaml, sourcePath) {
47
57
  return fail("MSL-S001", "Missing or non-string `system` field", sourcePath);
48
58
  }
49
59
  const direction = raw.direction;
60
+ if (typeof direction !== "string") {
61
+ return fail("MSL-S001", "Missing or non-string `direction` field", sourcePath);
62
+ }
50
63
  if (direction !== "outbound" && direction !== "inbound" &&
51
64
  direction !== "bidirectional") {
52
65
  return fail("MSL-S001", `Invalid top-level direction '${direction}' (expected outbound/inbound/bidirectional)`, sourcePath);
53
66
  }
54
67
  const identity = raw.identity;
55
- const scheme = identity?.["external-id-scheme"];
68
+ if (!isRecord(identity)) {
69
+ return fail("MSL-S001", "Missing or non-object `identity` field", sourcePath);
70
+ }
71
+ const scheme = identity["external-id-scheme"];
56
72
  if (typeof scheme !== "string") {
57
73
  return fail("MSL-S001", "Missing identity.external-id-scheme", sourcePath);
58
74
  }
@@ -60,19 +76,42 @@ function parseMapping(yaml, sourcePath) {
60
76
  return fail("MSL-S004", `system '${system}' does not match identity.external-id-scheme '${scheme}'`, sourcePath);
61
77
  }
62
78
  const conflict = raw.conflict;
79
+ if (conflict !== undefined && !isRecord(conflict)) {
80
+ return fail("MSL-S001", "Non-object `conflict` field", sourcePath);
81
+ }
63
82
  const policy = conflict?.default;
83
+ if (policy !== undefined && typeof policy !== "string") {
84
+ return fail("MSL-S001", "Non-string conflict.default", sourcePath);
85
+ }
64
86
  if (policy !== undefined && !ALLOWED_POLICIES.has(policy)) {
65
87
  return fail("MSL-S003", `Unknown conflict policy '${policy}' (allowed: manual, local-wins, remote-wins; newest-wins removed pre-1.0)`, sourcePath);
66
88
  }
67
89
  const cacheRaw = raw.cache;
68
- const ttlStr = cacheRaw?.ttl ?? "15m";
90
+ if (cacheRaw !== undefined && !isRecord(cacheRaw)) {
91
+ return fail("MSL-S001", "Non-object `cache` field", sourcePath);
92
+ }
93
+ const ttlStr = cacheRaw?.ttl === undefined ? "15m" : cacheRaw.ttl;
94
+ if (typeof ttlStr !== "string") {
95
+ return fail("MSL-S001", "Non-string cache.ttl", sourcePath);
96
+ }
69
97
  const ttlMs = parseDurationMs(ttlStr);
70
98
  if (ttlMs === null) {
71
99
  return fail("MSL-S005", `Unparseable cache.ttl '${ttlStr}' (expected: 15m, 1h, 7d etc.)`, sourcePath);
72
100
  }
73
- const attrsRaw = raw.attributes ?? [];
101
+ const attrsRaw = raw.attributes === undefined ? [] : raw.attributes;
102
+ if (!Array.isArray(attrsRaw)) {
103
+ return fail("MSL-S001", "Non-array `attributes` field", sourcePath);
104
+ }
74
105
  const attributes = [];
75
106
  for (const a of attrsRaw) {
107
+ if (!isRecord(a) || typeof a.markspec !== "string" ||
108
+ typeof a.external !== "string") {
109
+ return fail("MSL-S001", "Each attribute mapping requires an object with string 'markspec' and 'external' fields", sourcePath);
110
+ }
111
+ if ((a.direction !== undefined && typeof a.direction !== "string") ||
112
+ (a.locked !== undefined && typeof a.locked !== "boolean")) {
113
+ return fail("MSL-S001", "Attribute mapping requires a string 'direction' and boolean 'locked' when present", sourcePath);
114
+ }
76
115
  const attrDir = (a.direction === "outbound" || a.direction === "inbound" ||
77
116
  a.direction === "bidirectional")
78
117
  ? a.direction
@@ -81,9 +120,6 @@ function parseMapping(yaml, sourcePath) {
81
120
  if (locked && attrDir === "outbound") {
82
121
  return fail("MSL-S002", `Attribute '${a.markspec}': locked: true contradicts direction: outbound`, sourcePath);
83
122
  }
84
- if (typeof a.markspec !== "string" || typeof a.external !== "string") {
85
- return fail("MSL-S001", "Each attribute mapping requires string 'markspec' and 'external' fields", sourcePath);
86
- }
87
123
  attributes.push({
88
124
  markspec: a.markspec,
89
125
  external: a.external,
@@ -103,6 +139,13 @@ function parseMapping(yaml, sourcePath) {
103
139
  };
104
140
  return { mapping, diagnostics: [] };
105
141
  }
142
+ /** Whether a YAML value is a plain mapping rather than a scalar or sequence. */
143
+ function isRecord(value) {
144
+ if (typeof value !== "object" || value === null)
145
+ return false;
146
+ const prototype = Object.getPrototypeOf(value);
147
+ return prototype === Object.prototype || prototype === null;
148
+ }
106
149
  /**
107
150
  * Cross-system validation: at most one system writes locally per attribute.
108
151
  * "Writes locally" = direction is `inbound` or `bidirectional`. Multiple
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Display-ID token characters are ASCII letters, digits, dots, slashes,
3
+ * underscores and hyphens. The LSP reads the whole token under the cursor,
4
+ * including trailing characters in this set, then applies DISPLAY_ID_TOKEN_RE.
5
+ * The renderer scans whole runs of the same characters and resolves each
6
+ * against the known IDs: exact match first, then split on slashes only if
7
+ * every segment is nonempty and a known ID. If neither resolves, remove one
8
+ * trailing period and repeat, leaving the removed period outside the link.
9
+ * A token with a trailing hyphen, such as SYS_A-, does not link SYS_A.
10
+ * With only A/B and C known, A/B/C links nothing: slash segments are not
11
+ * recursively grouped. A known short ID links wherever it stands alone.
12
+ * These recognition rules do not constrain the parser's entry IDs.
13
+ */
14
+ export declare const DISPLAY_ID_CHAR_RE: RegExp;
15
+ /**
16
+ * An LSP display-ID token starts with an ASCII letter or digit and contains
17
+ * at least three characters. Any display-ID character may end the token.
18
+ */
19
+ export declare const DISPLAY_ID_TOKEN_RE: RegExp;
20
+ //# sourceMappingURL=display_id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display_id.d.ts","sourceRoot":"","sources":["../../src/util/display_id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,QAAoB,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAEjC,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DISPLAY_ID_TOKEN_RE = exports.DISPLAY_ID_CHAR_RE = void 0;
4
+ /**
5
+ * Display-ID token characters are ASCII letters, digits, dots, slashes,
6
+ * underscores and hyphens. The LSP reads the whole token under the cursor,
7
+ * including trailing characters in this set, then applies DISPLAY_ID_TOKEN_RE.
8
+ * The renderer scans whole runs of the same characters and resolves each
9
+ * against the known IDs: exact match first, then split on slashes only if
10
+ * every segment is nonempty and a known ID. If neither resolves, remove one
11
+ * trailing period and repeat, leaving the removed period outside the link.
12
+ * A token with a trailing hyphen, such as SYS_A-, does not link SYS_A.
13
+ * With only A/B and C known, A/B/C links nothing: slash segments are not
14
+ * recursively grouped. A known short ID links wherever it stands alone.
15
+ * These recognition rules do not constrain the parser's entry IDs.
16
+ */
17
+ exports.DISPLAY_ID_CHAR_RE = /[A-Za-z0-9._/-]/;
18
+ /**
19
+ * An LSP display-ID token starts with an ASCII letter or digit and contains
20
+ * at least three characters. Any display-ID character may end the token.
21
+ */
22
+ exports.DISPLAY_ID_TOKEN_RE = new RegExp(`^[A-Za-z0-9]${exports.DISPLAY_ID_CHAR_RE.source}{2,}$`);
@@ -19,12 +19,14 @@ export interface PipelineResult {
19
19
  /** Options for {@linkcode runPipeline}. */
20
20
  export interface PipelineOptions {
21
21
  /**
22
- * When `false`, suppress MSL-L006 ("link target does not resolve") from
23
- * Stage 4 output. Use this when the validator is running against a subset
22
+ * When `false`, suppress cross-entry TYPL-009/010/011 from Stage 1,
23
+ * UXIL-016/017/018 from Stage 5, and MSL-L006 ("link target does not
24
+ * resolve") from Stage 4.
25
+ * Use this when the validator is running against a subset
24
26
  * of the project's files (e.g. `markspec check <file>`): file-local scope
25
27
  * cannot distinguish a typo from a valid cross-file target. MSL-L006 is
26
28
  * only meaningful when the full entry set is available (LSP, `compile`).
27
- * Defaults to `true` (full-project scope — emit MSL-L006 normally).
29
+ * Defaults to `true` (full-project scope — emit these codes normally).
28
30
  */
29
31
  readonly projectWide?: boolean;
30
32
  /**
@@ -53,7 +55,7 @@ export interface PipelineOptions {
53
55
  * and non-empty, MSL-C072 is checked for each entry. Defaults to no
54
56
  * conventions (rule inactive).
55
57
  * @param opts - Pipeline options. Pass `{ projectWide: false }` when
56
- * validating a file-local subset so MSL-L006 is suppressed.
58
+ * validating a file-local subset to suppress cross-entry diagnostics.
57
59
  */
58
60
  export declare function runPipeline(entries: readonly Entry[], profile: EffectiveProfile | null, captionConventions?: CaptionConventions, opts?: PipelineOptions): PipelineResult;
59
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAqCzB,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,EAChC,kBAAkB,GAAE,kBAAuB,EAC3C,IAAI,GAAE,eAAoB,GACzB,cAAc,CA8JhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CASvB"}
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAyCzB,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,EAChC,kBAAkB,GAAE,kBAAuB,EAC3C,IAAI,GAAE,eAAoB,GACzB,cAAc,CA0JhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CASvB"}
@@ -27,11 +27,15 @@ const caption_convention_js_1 = require("./caption_convention.js");
27
27
  const discipline_js_1 = require("./discipline.js");
28
28
  const discipline_registry_js_1 = require("../profile/discipline_registry.js");
29
29
  const uxil_family_js_1 = require("./uxil_family.js");
30
- /** Cross-entry uxil codes suppressed under file-local scope (#727): a
30
+ /** Cross-entry DSL codes suppressed under file-local scope: a
31
31
  * subset registry cannot distinguish a dangling reference from an
32
32
  * unchecked file — the same false-positive class the MSL-L006 filter
33
- * guards. Entry-local UXIL codes are unaffected. */
34
- const FILE_LOCAL_SUPPRESSED_UXIL = new Set([
33
+ * guards. Suppress these even when the cause is inside the subset,
34
+ * matching uxil's scope policy. Parser diagnostics are unaffected. */
35
+ const FILE_LOCAL_SUPPRESSED_DSL = new Set([
36
+ "TYPL-009",
37
+ "TYPL-010",
38
+ "TYPL-011",
35
39
  "UXIL-016",
36
40
  "UXIL-017",
37
41
  "UXIL-018",
@@ -52,7 +56,7 @@ const FILE_LOCAL_SUPPRESSED_UXIL = new Set([
52
56
  * and non-empty, MSL-C072 is checked for each entry. Defaults to no
53
57
  * conventions (rule inactive).
54
58
  * @param opts - Pipeline options. Pass `{ projectWide: false }` when
55
- * validating a file-local subset so MSL-L006 is suppressed.
59
+ * validating a file-local subset to suppress cross-entry diagnostics.
56
60
  */
57
61
  function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
58
62
  const diagnostics = [];
@@ -173,14 +177,12 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
173
177
  // FULL classified list on purpose: the family derives its own #771
174
178
  // partition and its own declaring/citing split — registry scope is the
175
179
  // module's contract, not this orchestrator's (mirrors validateTypl).
176
- // File-local scope (projectWide: false) suppresses the cross-entry codes
177
- // (UXIL-016/017/018) — a subset registry cannot distinguish a dangling
178
- // reference from an unchecked file, the same false-positive class the
179
- // MSL-L006 suppression guards (#727 review).
180
180
  const uxilDiagnostics = (0, uxil_family_js_1.validateUxilFamily)(finalEntries, profile);
181
- diagnostics.push(...(projectWide ? uxilDiagnostics : uxilDiagnostics.filter((d) => !FILE_LOCAL_SUPPRESSED_UXIL.has(d.code))));
182
- const valid = !diagnostics.some((d) => d.severity === "error");
183
- return { entries: finalEntries, diagnostics, valid };
181
+ diagnostics.push(...uxilDiagnostics);
182
+ // Apply the same scope policy to Stage 1's typl and Stage 5's uxil.
183
+ const scopedDiagnostics = projectWide ? diagnostics : diagnostics.filter((d) => !FILE_LOCAL_SUPPRESSED_DSL.has(d.code));
184
+ const valid = !scopedDiagnostics.some((d) => d.severity === "error");
185
+ return { entries: finalEntries, diagnostics: scopedDiagnostics, valid };
184
186
  }
185
187
  /**
186
188
  * Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes