@driftsys/markspec 0.11.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 (176) hide show
  1. package/README.md +9 -0
  2. package/esm/ast/normalize.d.ts +4 -5
  3. package/esm/ast/normalize.d.ts.map +1 -1
  4. package/esm/ast/normalize.js +6 -37
  5. package/esm/collect/mod.d.ts +29 -9
  6. package/esm/collect/mod.d.ts.map +1 -1
  7. package/esm/collect/mod.js +36 -10
  8. package/esm/compiler/mod.d.ts.map +1 -1
  9. package/esm/compiler/mod.js +2 -6
  10. package/esm/config/markspec.d.ts +5 -3
  11. package/esm/config/markspec.d.ts.map +1 -1
  12. package/esm/config/mod.d.ts.map +1 -1
  13. package/esm/config/mod.js +47 -5
  14. package/esm/discovery/mod.d.ts +24 -8
  15. package/esm/discovery/mod.d.ts.map +1 -1
  16. package/esm/discovery/mod.js +57 -21
  17. package/esm/discovery/projects.d.ts +111 -0
  18. package/esm/discovery/projects.d.ts.map +1 -0
  19. package/esm/discovery/projects.js +242 -0
  20. package/esm/formatter/entry_body.d.ts +84 -0
  21. package/esm/formatter/entry_body.d.ts.map +1 -0
  22. package/esm/formatter/entry_body.js +291 -0
  23. package/esm/formatter/md_equiv.d.ts +6 -5
  24. package/esm/formatter/md_equiv.d.ts.map +1 -1
  25. package/esm/formatter/md_equiv.js +6 -5
  26. package/esm/formatter/mod.d.ts +16 -9
  27. package/esm/formatter/mod.d.ts.map +1 -1
  28. package/esm/formatter/mod.js +327 -53
  29. package/esm/formatter/tab_markers.d.ts +15 -0
  30. package/esm/formatter/tab_markers.d.ts.map +1 -0
  31. package/esm/formatter/tab_markers.js +133 -0
  32. package/esm/gates/mod.d.ts.map +1 -1
  33. package/esm/gates/mod.js +6 -5
  34. package/esm/lint/runner.d.ts.map +1 -1
  35. package/esm/lint/runner.js +4 -4
  36. package/esm/lock/check.d.ts.map +1 -1
  37. package/esm/lock/check.js +2 -1
  38. package/esm/lock/edge_drift.d.ts +2 -0
  39. package/esm/lock/edge_drift.d.ts.map +1 -1
  40. package/esm/lock/edge_drift.js +4 -0
  41. package/esm/lock/mod.d.ts +1 -1
  42. package/esm/lock/mod.d.ts.map +1 -1
  43. package/esm/lock/mod.js +1 -1
  44. package/esm/lock/upstream_deps.js +1 -1
  45. package/esm/mod.d.ts +11 -6
  46. package/esm/mod.d.ts.map +1 -1
  47. package/esm/mod.js +9 -6
  48. package/esm/model/mod.d.ts +22 -1
  49. package/esm/model/mod.d.ts.map +1 -1
  50. package/esm/model/mod.js +10 -0
  51. package/esm/parser/code_regions.d.ts +29 -0
  52. package/esm/parser/code_regions.d.ts.map +1 -0
  53. package/esm/parser/code_regions.js +38 -0
  54. package/esm/parser/markdown.d.ts.map +1 -1
  55. package/esm/parser/markdown.js +103 -40
  56. package/esm/parser/mod.d.ts.map +1 -1
  57. package/esm/parser/mod.js +7 -1
  58. package/esm/parser/translate.d.ts.map +1 -1
  59. package/esm/parser/translate.js +5 -0
  60. package/esm/refs/mod.d.ts +6 -2
  61. package/esm/refs/mod.d.ts.map +1 -1
  62. package/esm/refs/mod.js +15 -21
  63. package/esm/reporter/mod.d.ts.map +1 -1
  64. package/esm/reporter/mod.js +2 -2
  65. package/esm/sync/mapping.d.ts +4 -3
  66. package/esm/sync/mapping.d.ts.map +1 -1
  67. package/esm/sync/mapping.js +52 -9
  68. package/esm/util/display_id.d.ts +20 -0
  69. package/esm/util/display_id.d.ts.map +1 -0
  70. package/esm/util/display_id.js +19 -0
  71. package/esm/util/fence.d.ts +20 -29
  72. package/esm/util/fence.d.ts.map +1 -1
  73. package/esm/util/fence.js +42 -50
  74. package/esm/util/modals.d.ts +6 -0
  75. package/esm/util/modals.d.ts.map +1 -1
  76. package/esm/util/modals.js +37 -0
  77. package/esm/validator/body_blocks.d.ts +2 -1
  78. package/esm/validator/body_blocks.d.ts.map +1 -1
  79. package/esm/validator/body_blocks.js +80 -2
  80. package/esm/validator/corpus.d.ts +6 -0
  81. package/esm/validator/corpus.d.ts.map +1 -1
  82. package/esm/validator/corpus.js +16 -4
  83. package/esm/validator/mod.d.ts +1 -1
  84. package/esm/validator/mod.d.ts.map +1 -1
  85. package/esm/validator/mod.js +1 -1
  86. package/esm/validator/pipeline.d.ts +6 -4
  87. package/esm/validator/pipeline.d.ts.map +1 -1
  88. package/esm/validator/pipeline.js +24 -19
  89. package/package.json +1 -1
  90. package/script/ast/normalize.d.ts +4 -5
  91. package/script/ast/normalize.d.ts.map +1 -1
  92. package/script/ast/normalize.js +5 -36
  93. package/script/collect/mod.d.ts +29 -9
  94. package/script/collect/mod.d.ts.map +1 -1
  95. package/script/collect/mod.js +38 -10
  96. package/script/compiler/mod.d.ts.map +1 -1
  97. package/script/compiler/mod.js +1 -5
  98. package/script/config/markspec.d.ts +5 -3
  99. package/script/config/markspec.d.ts.map +1 -1
  100. package/script/config/mod.d.ts.map +1 -1
  101. package/script/config/mod.js +47 -5
  102. package/script/discovery/mod.d.ts +24 -8
  103. package/script/discovery/mod.d.ts.map +1 -1
  104. package/script/discovery/mod.js +56 -20
  105. package/script/discovery/projects.d.ts +111 -0
  106. package/script/discovery/projects.d.ts.map +1 -0
  107. package/script/discovery/projects.js +250 -0
  108. package/script/formatter/entry_body.d.ts +84 -0
  109. package/script/formatter/entry_body.d.ts.map +1 -0
  110. package/script/formatter/entry_body.js +296 -0
  111. package/script/formatter/md_equiv.d.ts +6 -5
  112. package/script/formatter/md_equiv.d.ts.map +1 -1
  113. package/script/formatter/md_equiv.js +6 -5
  114. package/script/formatter/mod.d.ts +16 -9
  115. package/script/formatter/mod.d.ts.map +1 -1
  116. package/script/formatter/mod.js +324 -50
  117. package/script/formatter/tab_markers.d.ts +15 -0
  118. package/script/formatter/tab_markers.d.ts.map +1 -0
  119. package/script/formatter/tab_markers.js +141 -0
  120. package/script/gates/mod.d.ts.map +1 -1
  121. package/script/gates/mod.js +15 -14
  122. package/script/lint/runner.d.ts.map +1 -1
  123. package/script/lint/runner.js +3 -3
  124. package/script/lock/check.d.ts.map +1 -1
  125. package/script/lock/check.js +2 -1
  126. package/script/lock/edge_drift.d.ts +2 -0
  127. package/script/lock/edge_drift.d.ts.map +1 -1
  128. package/script/lock/edge_drift.js +5 -0
  129. package/script/lock/mod.d.ts +1 -1
  130. package/script/lock/mod.d.ts.map +1 -1
  131. package/script/lock/mod.js +2 -1
  132. package/script/lock/upstream_deps.js +1 -1
  133. package/script/mod.d.ts +11 -6
  134. package/script/mod.d.ts.map +1 -1
  135. package/script/mod.js +23 -5
  136. package/script/model/mod.d.ts +22 -1
  137. package/script/model/mod.d.ts.map +1 -1
  138. package/script/model/mod.js +11 -0
  139. package/script/parser/code_regions.d.ts +29 -0
  140. package/script/parser/code_regions.d.ts.map +1 -0
  141. package/script/parser/code_regions.js +41 -0
  142. package/script/parser/markdown.d.ts.map +1 -1
  143. package/script/parser/markdown.js +102 -39
  144. package/script/parser/mod.d.ts.map +1 -1
  145. package/script/parser/mod.js +7 -1
  146. package/script/parser/translate.d.ts.map +1 -1
  147. package/script/parser/translate.js +5 -0
  148. package/script/refs/mod.d.ts +6 -2
  149. package/script/refs/mod.d.ts.map +1 -1
  150. package/script/refs/mod.js +14 -20
  151. package/script/reporter/mod.d.ts.map +1 -1
  152. package/script/reporter/mod.js +1 -1
  153. package/script/sync/mapping.d.ts +4 -3
  154. package/script/sync/mapping.d.ts.map +1 -1
  155. package/script/sync/mapping.js +52 -9
  156. package/script/util/display_id.d.ts +20 -0
  157. package/script/util/display_id.d.ts.map +1 -0
  158. package/script/util/display_id.js +22 -0
  159. package/script/util/fence.d.ts +20 -29
  160. package/script/util/fence.d.ts.map +1 -1
  161. package/script/util/fence.js +47 -54
  162. package/script/util/modals.d.ts +6 -0
  163. package/script/util/modals.d.ts.map +1 -1
  164. package/script/util/modals.js +38 -0
  165. package/script/validator/body_blocks.d.ts +2 -1
  166. package/script/validator/body_blocks.d.ts.map +1 -1
  167. package/script/validator/body_blocks.js +80 -2
  168. package/script/validator/corpus.d.ts +6 -0
  169. package/script/validator/corpus.d.ts.map +1 -1
  170. package/script/validator/corpus.js +16 -3
  171. package/script/validator/mod.d.ts +1 -1
  172. package/script/validator/mod.d.ts.map +1 -1
  173. package/script/validator/mod.js +2 -1
  174. package/script/validator/pipeline.d.ts +6 -4
  175. package/script/validator/pipeline.d.ts.map +1 -1
  176. package/script/validator/pipeline.js +24 -19
@@ -15,7 +15,7 @@
15
15
  * a profile-aware validator layer (not in the core).
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.detectCorpusCollisions = exports.attributeCorpusDiagnostics = exports.validateTraceabilityForEntry = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.normalizeListValues = exports.validateValue = exports.validateAttributesForEntry = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.validateListingDocuments = exports.suppressDeclaredAttrR010 = exports.runPipeline = void 0;
18
+ exports.detectCorpusCollisions = exports.attributeCorpusDiagnostics = exports.applyCorpusPostPass = exports.validateTraceabilityForEntry = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.normalizeListValues = exports.validateValue = exports.validateAttributesForEntry = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.validateListingDocuments = exports.suppressDeclaredAttrR010 = exports.runPipeline = void 0;
19
19
  exports.validate = validate;
20
20
  exports.indexByDisplayId = indexByDisplayId;
21
21
  exports.findAttr = findAttr;
@@ -507,5 +507,6 @@ Object.defineProperty(exports, "effectiveTraceRules", { enumerable: true, get: f
507
507
  Object.defineProperty(exports, "matchesAnyTarget", { enumerable: true, get: function () { return traceability_js_1.matchesAnyTarget; } });
508
508
  Object.defineProperty(exports, "validateTraceabilityForEntry", { enumerable: true, get: function () { return traceability_js_1.validateTraceabilityForEntry; } });
509
509
  var corpus_js_1 = require("./corpus.js");
510
+ Object.defineProperty(exports, "applyCorpusPostPass", { enumerable: true, get: function () { return corpus_js_1.applyCorpusPostPass; } });
510
511
  Object.defineProperty(exports, "attributeCorpusDiagnostics", { enumerable: true, get: function () { return corpus_js_1.attributeCorpusDiagnostics; } });
511
512
  Object.defineProperty(exports, "detectCorpusCollisions", { enumerable: true, get: function () { return corpus_js_1.detectCorpusCollisions; } });
@@ -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,MAA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C3C,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 = [];
@@ -80,7 +84,6 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
80
84
  diagnostics.push(...(0, caption_convention_js_1.validateCaptionConvention)(entry, captionConventions));
81
85
  diagnostics.push(...(0, body_blocks_js_1.validateBodyBlocks)(entry));
82
86
  diagnostics.push(...(0, feature_ac_js_1.validateFeatureAc)(entry));
83
- diagnostics.push(...(0, per_type_attrs_js_1.validatePerTypeAttributes)(entry, profile ?? undefined));
84
87
  diagnostics.push(...(0, modal_keywords_js_1.validateModalKeywords)(entry));
85
88
  }
86
89
  // Stage 1.6 — cross-file trace target-type compatibility (MSL-R083).
@@ -106,15 +109,19 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
106
109
  finalEntries = stage2.entries;
107
110
  diagnostics.push(...stage2.diagnostics);
108
111
  }
109
- // Stage 2.4 — late-stage inference warnings (MSL-T021 for steps 5/6).
110
- // Runs after Stage 2 so that profile-classified `entry.type` suppresses
111
- // the warning correctly. In core-only mode `finalEntries === entries`
112
- // and `entry.type` is always undefined, so this stage produces the same
113
- // diagnostics regardless of mode. Partitions inline: `finalEmittable`
114
- // below is derived from the post-normalization generation, which does
115
- // not exist yet at this point.
112
+ // Stage 2.4 — late-stage inference warnings (MSL-T021 for steps 5/6)
113
+ // and per-type attribute compatibility (MSL-T022 / MSL-T024). Both run
114
+ // after Stage 2 so that a profile-classified `entry.type` (display-ID
115
+ // pattern match, no explicit `Type:`) resolves to its `extends:` core
116
+ // type — run before classification, MSL-T024 fired on every
117
+ // pattern-classified entry carrying `Satisfies:`/`Derived-from:`. In
118
+ // core-only mode `finalEntries === entries` and `entry.type` is always
119
+ // undefined, so this stage produces the same diagnostics regardless of
120
+ // mode. Partitions inline: `finalEmittable` below is derived from the
121
+ // post-normalization generation, which does not exist yet at this point.
116
122
  for (const entry of (0, mod_js_1.emittableEntries)(finalEntries)) {
117
123
  diagnostics.push(...(0, types_js_1.inferTypeFromLateStageChain)(entry));
124
+ diagnostics.push(...(0, per_type_attrs_js_1.validatePerTypeAttributes)(entry, profile ?? undefined));
118
125
  }
119
126
  // Stage 2.5 — normalize profile-declared list-value attributes. Splits
120
127
  // comma-separated values for `id-list`/`tag-list` attributes the core parser
@@ -170,14 +177,12 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
170
177
  // FULL classified list on purpose: the family derives its own #771
171
178
  // partition and its own declaring/citing split — registry scope is the
172
179
  // module's contract, not this orchestrator's (mirrors validateTypl).
173
- // File-local scope (projectWide: false) suppresses the cross-entry codes
174
- // (UXIL-016/017/018) — a subset registry cannot distinguish a dangling
175
- // reference from an unchecked file, the same false-positive class the
176
- // MSL-L006 suppression guards (#727 review).
177
180
  const uxilDiagnostics = (0, uxil_family_js_1.validateUxilFamily)(finalEntries, profile);
178
- diagnostics.push(...(projectWide ? uxilDiagnostics : uxilDiagnostics.filter((d) => !FILE_LOCAL_SUPPRESSED_UXIL.has(d.code))));
179
- const valid = !diagnostics.some((d) => d.severity === "error");
180
- 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 };
181
186
  }
182
187
  /**
183
188
  * Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes