@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
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/validator/corpus
4
+ *
5
+ * Corpus-aware diagnostic post-pass (ADR-030). Two responsibilities:
6
+ *
7
+ * 1. {@linkcode detectCorpusCollisions} — a project entry re-declaring a
8
+ * display ID (or Id) owned by a delivered corpus entry is MSL-R014, a
9
+ * distinct code from MSL-R006 because the fix is different: rename the
10
+ * project entry; the corpus entry is not yours to change.
11
+ * 2. {@linkcode attributeCorpusDiagnostics} — consumer builds must not go
12
+ * red from upstream bugs they cannot fix: findings located inside a
13
+ * corpus file are downgraded to warnings and attributed to the
14
+ * delivering profile; generic duplicate codes are suppressed for
15
+ * collided tokens (MSL-R014 replaces them).
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.detectCorpusCollisions = detectCorpusCollisions;
19
+ exports.attributeCorpusDiagnostics = attributeCorpusDiagnostics;
20
+ const mod_js_1 = require("../model/mod.js");
21
+ /** Generic duplicate detectors superseded by MSL-R014 for corpus collisions. */
22
+ const GENERIC_DUP_CODES = new Set([
23
+ "MSL-R005",
24
+ "MSL-R006",
25
+ "MSL-I007",
26
+ "MSL-I008",
27
+ ]);
28
+ function detectCorpusCollisions(allEntries) {
29
+ const corpusByDisplayId = new Map();
30
+ const corpusById = new Map();
31
+ for (const e of allEntries) {
32
+ if (!e.origin)
33
+ continue;
34
+ if (!corpusByDisplayId.has(e.displayId)) {
35
+ corpusByDisplayId.set(e.displayId, e);
36
+ }
37
+ if (e.id && !corpusById.has(e.id))
38
+ corpusById.set(e.id, e);
39
+ }
40
+ if (corpusByDisplayId.size === 0 && corpusById.size === 0) {
41
+ return { diagnostics: [], collidedTokens: new Set() };
42
+ }
43
+ const diagnostics = [];
44
+ const collided = new Set();
45
+ for (const e of allEntries) {
46
+ if (!e.origin) {
47
+ const displayOwner = corpusByDisplayId.get(e.displayId);
48
+ if (displayOwner) {
49
+ collided.add(e.displayId);
50
+ diagnostics.push({
51
+ code: "MSL-R014",
52
+ severity: "error",
53
+ message: `display ID '${e.displayId}' is already delivered by ` +
54
+ `${(0, mod_js_1.formatEntryOrigin)(displayOwner.origin)}; rename this entry — ` +
55
+ `delivered corpus entries are read-only`,
56
+ location: e.location,
57
+ });
58
+ }
59
+ if (e.id) {
60
+ const idOwner = corpusById.get(e.id);
61
+ if (idOwner) {
62
+ collided.add(e.id);
63
+ diagnostics.push({
64
+ code: "MSL-R014",
65
+ severity: "error",
66
+ message: `Id '${e.id}' is already delivered by ` +
67
+ `${(0, mod_js_1.formatEntryOrigin)(idOwner.origin)}; rename this entry — ` +
68
+ `delivered corpus entries are read-only`,
69
+ location: e.location,
70
+ });
71
+ }
72
+ }
73
+ continue;
74
+ }
75
+ // Corpus↔corpus inter-tier collision: a later delivered entry from a
76
+ // DIFFERENT profile claims a display ID (or Id) the first-registered
77
+ // profile already owns. Same-profile duplicates are excluded — that's
78
+ // the delivering profile's own authoring bug, not a read-only-boundary
79
+ // violation, and stays on the generic duplicate codes.
80
+ const displayOwner = corpusByDisplayId.get(e.displayId);
81
+ if (displayOwner !== e && displayOwner &&
82
+ displayOwner.origin.profileId !== e.origin.profileId) {
83
+ collided.add(e.displayId);
84
+ diagnostics.push({
85
+ code: "MSL-R014",
86
+ severity: "error",
87
+ message: `display ID '${e.displayId}' is already delivered by ` +
88
+ `${(0, mod_js_1.formatEntryOrigin)(displayOwner.origin)}; delivered corpus ` +
89
+ `entries are read-only`,
90
+ location: e.location,
91
+ });
92
+ }
93
+ if (e.id) {
94
+ const idOwner = corpusById.get(e.id);
95
+ if (idOwner !== e && idOwner &&
96
+ idOwner.origin.profileId !== e.origin.profileId) {
97
+ collided.add(e.id);
98
+ diagnostics.push({
99
+ code: "MSL-R014",
100
+ severity: "error",
101
+ message: `Id '${e.id}' is already delivered by ` +
102
+ `${(0, mod_js_1.formatEntryOrigin)(idOwner.origin)}; delivered corpus entries ` +
103
+ `are read-only`,
104
+ location: e.location,
105
+ });
106
+ }
107
+ }
108
+ }
109
+ return { diagnostics, collidedTokens: collided };
110
+ }
111
+ function attributeCorpusDiagnostics(diagnostics, allEntries, collidedTokens) {
112
+ const corpusFiles = new Map();
113
+ for (const e of allEntries) {
114
+ if (e.origin) {
115
+ corpusFiles.set(e.location.file, (0, mod_js_1.formatEntryOrigin)(e.origin));
116
+ }
117
+ }
118
+ const out = [];
119
+ for (const d of diagnostics) {
120
+ // Suppress the generic duplicate codes for a corpus collision (MSL-R014
121
+ // has already replaced them). This is a load-bearing coupling with the
122
+ // duplicate validators' message format: MSL-R005/R006/I007/I008 all embed
123
+ // the offending token wrapped in single quotes (`'<token>'`), and the
124
+ // containment check below keys on that exact `'${t}'` shape. If any of
125
+ // those producers stops single-quoting the token, the generic duplicate
126
+ // would leak through alongside the MSL-R014 — `corpus_test.ts` pins all
127
+ // four codes to this contract.
128
+ if (GENERIC_DUP_CODES.has(d.code) &&
129
+ [...collidedTokens].some((t) => d.message.includes(`'${t}'`))) {
130
+ continue;
131
+ }
132
+ const label = d.location ? corpusFiles.get(d.location.file) : undefined;
133
+ if (label !== undefined) {
134
+ out.push({
135
+ ...d,
136
+ severity: d.severity === "error" ? "warning" : d.severity,
137
+ message: `delivered by ${label}: ${d.message}`,
138
+ });
139
+ continue;
140
+ }
141
+ out.push(d);
142
+ }
143
+ return out;
144
+ }
@@ -43,4 +43,6 @@ export { validateValue } from "./value_types.js";
43
43
  export type { ValueValidator } from "./value_types.js";
44
44
  export { normalizeListValues } from "./normalize.js";
45
45
  export { effectiveTraceRules, matchesAnyTarget, validateTraceabilityForEntry, } from "./traceability.js";
46
+ export { attributeCorpusDiagnostics, detectCorpusCollisions, } from "./corpus.js";
47
+ export type { CorpusCollisionResult } from "./corpus.js";
46
48
  //# sourceMappingURL=mod.d.ts.map
@@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,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
@@ -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.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.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;
@@ -493,3 +493,6 @@ var traceability_js_1 = require("./traceability.js");
493
493
  Object.defineProperty(exports, "effectiveTraceRules", { enumerable: true, get: function () { return traceability_js_1.effectiveTraceRules; } });
494
494
  Object.defineProperty(exports, "matchesAnyTarget", { enumerable: true, get: function () { return traceability_js_1.matchesAnyTarget; } });
495
495
  Object.defineProperty(exports, "validateTraceabilityForEntry", { enumerable: true, get: function () { return traceability_js_1.validateTraceabilityForEntry; } });
496
+ var corpus_js_1 = require("./corpus.js");
497
+ Object.defineProperty(exports, "attributeCorpusDiagnostics", { enumerable: true, get: function () { return corpus_js_1.attributeCorpusDiagnostics; } });
498
+ Object.defineProperty(exports, "detectCorpusCollisions", { enumerable: true, get: function () { return corpus_js_1.detectCorpusCollisions; } });