@driftsys/markspec 0.6.0 → 0.6.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 (109) hide show
  1. package/esm/lint/mod.d.ts +2 -0
  2. package/esm/lint/mod.d.ts.map +1 -1
  3. package/esm/lint/mod.js +1 -0
  4. package/esm/lint/rules/xref.d.ts +32 -5
  5. package/esm/lint/rules/xref.d.ts.map +1 -1
  6. package/esm/lint/rules/xref.js +40 -0
  7. package/esm/lint/runner.d.ts.map +1 -1
  8. package/esm/lint/runner.js +6 -2
  9. package/esm/lint/score_text.d.ts +67 -0
  10. package/esm/lint/score_text.d.ts.map +1 -0
  11. package/esm/lint/score_text.js +74 -0
  12. package/esm/lock/compare.d.ts +34 -0
  13. package/esm/lock/compare.d.ts.map +1 -0
  14. package/esm/lock/compare.js +64 -0
  15. package/esm/lock/mod.d.ts +2 -1
  16. package/esm/lock/mod.d.ts.map +1 -1
  17. package/esm/lock/mod.js +1 -0
  18. package/esm/lock/model.d.ts +13 -0
  19. package/esm/lock/model.d.ts.map +1 -1
  20. package/esm/lock/parser.d.ts +3 -0
  21. package/esm/lock/parser.d.ts.map +1 -1
  22. package/esm/lock/parser.js +37 -1
  23. package/esm/lock/serializer.d.ts.map +1 -1
  24. package/esm/lock/serializer.js +4 -0
  25. package/esm/mod.d.ts +7 -3
  26. package/esm/mod.d.ts.map +1 -1
  27. package/esm/mod.js +6 -2
  28. package/esm/parser/grammars.d.ts.map +1 -1
  29. package/esm/parser/grammars.js +8 -2
  30. package/esm/parser/markdown.js +11 -21
  31. package/esm/profile/display_id.d.ts +60 -0
  32. package/esm/profile/display_id.d.ts.map +1 -0
  33. package/esm/profile/display_id.js +80 -0
  34. package/esm/profile/mod.d.ts +3 -0
  35. package/esm/profile/mod.d.ts.map +1 -1
  36. package/esm/profile/mod.js +2 -0
  37. package/esm/profile/trace_targets.d.ts +43 -0
  38. package/esm/profile/trace_targets.d.ts.map +1 -0
  39. package/esm/profile/trace_targets.js +74 -0
  40. package/esm/self_upgrade/compare.d.ts +19 -0
  41. package/esm/self_upgrade/compare.d.ts.map +1 -0
  42. package/esm/self_upgrade/compare.js +35 -0
  43. package/esm/self_upgrade/manifest.d.ts +21 -0
  44. package/esm/self_upgrade/manifest.d.ts.map +1 -0
  45. package/esm/self_upgrade/manifest.js +27 -0
  46. package/esm/self_upgrade/mod.d.ts +12 -0
  47. package/esm/self_upgrade/mod.d.ts.map +1 -0
  48. package/esm/self_upgrade/mod.js +11 -0
  49. package/esm/self_upgrade/pm_detect.d.ts +27 -0
  50. package/esm/self_upgrade/pm_detect.d.ts.map +1 -0
  51. package/esm/self_upgrade/pm_detect.js +55 -0
  52. package/esm/self_upgrade/target.d.ts +25 -0
  53. package/esm/self_upgrade/target.d.ts.map +1 -0
  54. package/esm/self_upgrade/target.js +34 -0
  55. package/package.json +1 -1
  56. package/script/lint/mod.d.ts +2 -0
  57. package/script/lint/mod.d.ts.map +1 -1
  58. package/script/lint/mod.js +3 -1
  59. package/script/lint/rules/xref.d.ts +32 -5
  60. package/script/lint/rules/xref.d.ts.map +1 -1
  61. package/script/lint/rules/xref.js +42 -0
  62. package/script/lint/runner.d.ts.map +1 -1
  63. package/script/lint/runner.js +5 -1
  64. package/script/lint/score_text.d.ts +67 -0
  65. package/script/lint/score_text.d.ts.map +1 -0
  66. package/script/lint/score_text.js +77 -0
  67. package/script/lock/compare.d.ts +34 -0
  68. package/script/lock/compare.d.ts.map +1 -0
  69. package/script/lock/compare.js +67 -0
  70. package/script/lock/mod.d.ts +2 -1
  71. package/script/lock/mod.d.ts.map +1 -1
  72. package/script/lock/mod.js +3 -1
  73. package/script/lock/model.d.ts +13 -0
  74. package/script/lock/model.d.ts.map +1 -1
  75. package/script/lock/parser.d.ts +3 -0
  76. package/script/lock/parser.d.ts.map +1 -1
  77. package/script/lock/parser.js +37 -1
  78. package/script/lock/serializer.d.ts.map +1 -1
  79. package/script/lock/serializer.js +4 -0
  80. package/script/mod.d.ts +7 -3
  81. package/script/mod.d.ts.map +1 -1
  82. package/script/mod.js +82 -63
  83. package/script/parser/grammars.d.ts.map +1 -1
  84. package/script/parser/grammars.js +8 -2
  85. package/script/parser/markdown.js +11 -21
  86. package/script/profile/display_id.d.ts +60 -0
  87. package/script/profile/display_id.d.ts.map +1 -0
  88. package/script/profile/display_id.js +86 -0
  89. package/script/profile/mod.d.ts +3 -0
  90. package/script/profile/mod.d.ts.map +1 -1
  91. package/script/profile/mod.js +10 -1
  92. package/script/profile/trace_targets.d.ts +43 -0
  93. package/script/profile/trace_targets.d.ts.map +1 -0
  94. package/script/profile/trace_targets.js +79 -0
  95. package/script/self_upgrade/compare.d.ts +19 -0
  96. package/script/self_upgrade/compare.d.ts.map +1 -0
  97. package/script/self_upgrade/compare.js +38 -0
  98. package/script/self_upgrade/manifest.d.ts +21 -0
  99. package/script/self_upgrade/manifest.d.ts.map +1 -0
  100. package/script/self_upgrade/manifest.js +31 -0
  101. package/script/self_upgrade/mod.d.ts +12 -0
  102. package/script/self_upgrade/mod.d.ts.map +1 -0
  103. package/script/self_upgrade/mod.js +20 -0
  104. package/script/self_upgrade/pm_detect.d.ts +27 -0
  105. package/script/self_upgrade/pm_detect.d.ts.map +1 -0
  106. package/script/self_upgrade/pm_detect.js +58 -0
  107. package/script/self_upgrade/target.d.ts +25 -0
  108. package/script/self_upgrade/target.d.ts.map +1 -0
  109. package/script/self_upgrade/target.js +38 -0
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @module core/self_upgrade/target
3
+ *
4
+ * Map (os, arch) → the GitHub release target string used in tarball
5
+ * names. Targets match those produced by the Release workflow:
6
+ * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
7
+ * aarch64-apple-darwin, x86_64-pc-windows-msvc.
8
+ *
9
+ * Pure functions — no I/O, no Deno.* APIs. The CLI passes
10
+ * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
11
+ * this module never reads them itself so tests don't need any
12
+ * environment setup.
13
+ */
14
+ export type Os = "linux" | "darwin" | "windows";
15
+ export type Arch = "x86_64" | "aarch64";
16
+ export interface Platform {
17
+ readonly os: Os;
18
+ readonly arch: Arch;
19
+ }
20
+ export type Target = "x86_64-unknown-linux-gnu" | "x86_64-apple-darwin" | "aarch64-apple-darwin" | "x86_64-pc-windows-msvc";
21
+ /** Return the release target for a platform, or undefined if not shipped. */
22
+ export declare function detectTarget(platform: Platform): Target | undefined;
23
+ /** Parse Deno.build.{os,arch} strings into a typed Platform, or undefined. */
24
+ export declare function platformFromBuild(os: string, arch: string): Platform | undefined;
25
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,EAAE,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,MAAM,GACd,0BAA0B,GAC1B,qBAAqB,GACrB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAOnE;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GACX,QAAQ,GAAG,SAAS,CAKtB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @module core/self_upgrade/target
3
+ *
4
+ * Map (os, arch) → the GitHub release target string used in tarball
5
+ * names. Targets match those produced by the Release workflow:
6
+ * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
7
+ * aarch64-apple-darwin, x86_64-pc-windows-msvc.
8
+ *
9
+ * Pure functions — no I/O, no Deno.* APIs. The CLI passes
10
+ * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
11
+ * this module never reads them itself so tests don't need any
12
+ * environment setup.
13
+ */
14
+ /** Return the release target for a platform, or undefined if not shipped. */
15
+ export function detectTarget(platform) {
16
+ const { os, arch } = platform;
17
+ if (os === "linux" && arch === "x86_64")
18
+ return "x86_64-unknown-linux-gnu";
19
+ if (os === "darwin" && arch === "x86_64")
20
+ return "x86_64-apple-darwin";
21
+ if (os === "darwin" && arch === "aarch64")
22
+ return "aarch64-apple-darwin";
23
+ if (os === "windows" && arch === "x86_64")
24
+ return "x86_64-pc-windows-msvc";
25
+ return undefined;
26
+ }
27
+ /** Parse Deno.build.{os,arch} strings into a typed Platform, or undefined. */
28
+ export function platformFromBuild(os, arch) {
29
+ const okOs = os === "linux" || os === "darwin" || os === "windows";
30
+ const okArch = arch === "x86_64" || arch === "aarch64";
31
+ if (!okOs || !okArch)
32
+ return undefined;
33
+ return { os, arch };
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftsys/markspec",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Markdown flavor and toolchain for traceable industrial documentation",
5
5
  "keywords": [
6
6
  "markdown",
@@ -9,6 +9,8 @@ export { isProseScope, runLint } from "./runner.js";
9
9
  export type { LintOptions, LintResult } from "./runner.js";
10
10
  export { ANTI_PATTERN_NOTE, computeScoreRollup } from "./score.js";
11
11
  export type { EntryScore, RuleContribution, ScoreRollup } from "./score.js";
12
+ export { scoreText } from "./score_text.js";
13
+ export type { ScoreTextOptions, ScoreTextResult } from "./score_text.js";
12
14
  export { segmentSentences } from "./segmenter.js";
13
15
  export type { Sentence } from "./segmenter.js";
14
16
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/lint/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/lint/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
@@ -6,12 +6,14 @@
6
6
  * markspec lint subcommand and LSP integration.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.segmentSentences = exports.computeScoreRollup = exports.ANTI_PATTERN_NOTE = exports.runLint = exports.isProseScope = void 0;
9
+ exports.segmentSentences = exports.scoreText = exports.computeScoreRollup = exports.ANTI_PATTERN_NOTE = exports.runLint = exports.isProseScope = void 0;
10
10
  var runner_js_1 = require("./runner.js");
11
11
  Object.defineProperty(exports, "isProseScope", { enumerable: true, get: function () { return runner_js_1.isProseScope; } });
12
12
  Object.defineProperty(exports, "runLint", { enumerable: true, get: function () { return runner_js_1.runLint; } });
13
13
  var score_js_1 = require("./score.js");
14
14
  Object.defineProperty(exports, "ANTI_PATTERN_NOTE", { enumerable: true, get: function () { return score_js_1.ANTI_PATTERN_NOTE; } });
15
15
  Object.defineProperty(exports, "computeScoreRollup", { enumerable: true, get: function () { return score_js_1.computeScoreRollup; } });
16
+ var score_text_js_1 = require("./score_text.js");
17
+ Object.defineProperty(exports, "scoreText", { enumerable: true, get: function () { return score_text_js_1.scoreText; } });
16
18
  var segmenter_js_1 = require("./segmenter.js");
17
19
  Object.defineProperty(exports, "segmentSentences", { enumerable: true, get: function () { return segmenter_js_1.segmentSentences; } });
@@ -8,12 +8,39 @@
8
8
  import type { Entry } from "../../model/mod.js";
9
9
  import type { LintDiagnostic } from "../types.js";
10
10
  import type { GlossaryIndex } from "../glossary.js";
11
- /** Hook signature for the deferred $Identifier registry leg. Returns
12
- * true when the token is a resolvable $Identifier (i.e. should be
13
- * skipped by Q500). Today, always returns false; ADR-016's marker
14
- * pass replaces this with a real registry lookup. See ADR-021
15
- * Decision 1. */
11
+ /** Hook signature for the $Identifier registry leg. Returns true when
12
+ * the token is a resolvable $Identifier (i.e. should be skipped by
13
+ * Q500). See ADR-021 Decision 1 for the integration seam, and
14
+ * {@linkcode buildIdentifierIndex} + {@linkcode buildIsIdentifierHook}
15
+ * for the corpus-scan implementation that backs it today. */
16
16
  export type IsIdentifierHook = (token: string) => boolean;
17
+ /**
18
+ * Build a corpus-wide `$Identifier` index from every entry's `bodyTokens`.
19
+ *
20
+ * Aggregates the bare name (text with leading `$` stripped) of every
21
+ * `entity-ref` token across `entries` into a `Set<string>`. The set is
22
+ * the data backing the {@linkcode IsIdentifierHook} closure produced by
23
+ * {@linkcode buildIsIdentifierHook}.
24
+ *
25
+ * Behavioural contract (ADR-021 Decision 1, additive-enrichment invariant):
26
+ * - Every name in the index is observed in the corpus as `$Name`.
27
+ * - The index is purely additive: more entries → more silenced phrases,
28
+ * never more diagnostics.
29
+ *
30
+ * Scope note: this is the pragmatic minimal resolver leg per issue #502.
31
+ * The formal `MSL-M050`/`MSL-M051` entity-resolution model (definition
32
+ * vs. use, typed identifiers, profile Aliases) is deferred to a
33
+ * follow-up story — the closure body changes but the hook signature
34
+ * stays the same.
35
+ */
36
+ export declare function buildIdentifierIndex(entries: readonly Entry[]): ReadonlySet<string>;
37
+ /**
38
+ * Build the {@linkcode IsIdentifierHook} closure from a precomputed
39
+ * index. Separated from {@linkcode buildIdentifierIndex} so the index
40
+ * can be computed once per `runLint` invocation and reused across
41
+ * every in-scope entry.
42
+ */
43
+ export declare function buildIsIdentifierHook(index: ReadonlySet<string>): IsIdentifierHook;
17
44
  /** Public entry point: run Q500 against an entry's paragraph bodies. */
18
45
  export declare function runXrefRules(entry: Entry, glossary: GlossaryIndex, capitalizedAllow: ReadonlySet<string>, isIdentifier: IsIdentifierHook): LintDiagnostic[];
19
46
  //# sourceMappingURL=xref.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xref.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/xref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD;;;;iBAIiB;AACjB,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAmN1D,wEAAwE;AACxE,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,EACrC,YAAY,EAAE,gBAAgB,GAC7B,cAAc,EAAE,CAsElB"}
1
+ {"version":3,"file":"xref.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/xref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD;;;;6DAI6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,CAAC,CAUrB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GACzB,gBAAgB,CAElB;AAmND,wEAAwE;AACxE,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,EACrC,YAAY,EAAE,gBAAgB,GAC7B,cAAc,EAAE,CAsElB"}
@@ -7,9 +7,51 @@
7
7
  * markspec-prose-analysis §2.8 and ADR-021.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.buildIdentifierIndex = buildIdentifierIndex;
11
+ exports.buildIsIdentifierHook = buildIsIdentifierHook;
10
12
  exports.runXrefRules = runXrefRules;
11
13
  const glossary_js_1 = require("../../parser/glossary.js");
12
14
  const range_util_js_1 = require("../range_util.js");
15
+ /**
16
+ * Build a corpus-wide `$Identifier` index from every entry's `bodyTokens`.
17
+ *
18
+ * Aggregates the bare name (text with leading `$` stripped) of every
19
+ * `entity-ref` token across `entries` into a `Set<string>`. The set is
20
+ * the data backing the {@linkcode IsIdentifierHook} closure produced by
21
+ * {@linkcode buildIsIdentifierHook}.
22
+ *
23
+ * Behavioural contract (ADR-021 Decision 1, additive-enrichment invariant):
24
+ * - Every name in the index is observed in the corpus as `$Name`.
25
+ * - The index is purely additive: more entries → more silenced phrases,
26
+ * never more diagnostics.
27
+ *
28
+ * Scope note: this is the pragmatic minimal resolver leg per issue #502.
29
+ * The formal `MSL-M050`/`MSL-M051` entity-resolution model (definition
30
+ * vs. use, typed identifiers, profile Aliases) is deferred to a
31
+ * follow-up story — the closure body changes but the hook signature
32
+ * stays the same.
33
+ */
34
+ function buildIdentifierIndex(entries) {
35
+ const out = new Set();
36
+ for (const entry of entries) {
37
+ for (const token of entry.bodyTokens) {
38
+ if (token.kind !== "entity-ref")
39
+ continue;
40
+ // `token.text` is the full `$Identifier` form; strip the leading `$`.
41
+ out.add(token.text.slice(1));
42
+ }
43
+ }
44
+ return out;
45
+ }
46
+ /**
47
+ * Build the {@linkcode IsIdentifierHook} closure from a precomputed
48
+ * index. Separated from {@linkcode buildIdentifierIndex} so the index
49
+ * can be computed once per `runLint` invocation and reused across
50
+ * every in-scope entry.
51
+ */
52
+ function buildIsIdentifierHook(index) {
53
+ return (phrase) => index.has(phrase);
54
+ }
13
55
  /** RFC 2119 modal verbs + EARS leading-clause keywords that must never
14
56
  * trigger Q500 mid-sentence. Sentence-initial exclusion is handled
15
57
  * separately by position; this set catches keyword uses elsewhere. */
@@ -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;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AAC,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"}
@@ -94,7 +94,11 @@ async function runLint(options) {
94
94
  const { entries } = options;
95
95
  const allow = options.capitalizedAllow ?? (0, mod_js_2.loadLexicon)("capitalized-allow");
96
96
  const glossary = await (0, glossary_js_1.buildGlossaryIndex)(entries, options.readFile ?? (() => Promise.resolve(undefined)), options.glossaryFilePaths ?? []);
97
- const isIdHook = () => false;
97
+ // Corpus-scan resolver leg (issue #502, ADR-021 Decision 1). Built once
98
+ // per invocation; reused across every in-scope entry. Honors the
99
+ // additive-enrichment invariant — Q500 fires *less* as the resolver
100
+ // grows, never *more*.
101
+ const isIdHook = (0, xref_js_1.buildIsIdentifierHook)((0, xref_js_1.buildIdentifierIndex)(entries));
98
102
  // Steps 1–9: collect diagnostics keyed by entry
99
103
  const inScopeDiags = new Map();
100
104
  for (const entry of entries) {
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @module core/lint/score_text
3
+ *
4
+ * Score a single piece of requirement prose using the PA-3 lint
5
+ * pipeline. Wraps the input text in a synthetic `Entry` (type
6
+ * `Requirement`, body = text, bodyAst = parsed) and runs `runLint`
7
+ * against a one-entry corpus.
8
+ *
9
+ * Two non-obvious wrapping choices:
10
+ * - `bodyAst` is populated via `buildBodyAst(text)`. Most PA-3
11
+ * rules (modal, EARS, INCOSE, passive, lexicon) walk `bodyAst`,
12
+ * not the raw `body` string — without the AST, ~95% of the
13
+ * rule catalog silently no-ops.
14
+ * - `title` is set to the resolved id. Q400 (`struct-title-length`)
15
+ * fires when title length is outside [3, 120]; reusing the id
16
+ * (always ≥ 3 chars) keeps Q400 silent so the score reflects
17
+ * prose quality, not the absence of an authored title.
18
+ *
19
+ * Corpus-dependent rules (Q500 xref-glossary, xref-undefined,
20
+ * suppression hygiene) self-skip because there is nothing for them
21
+ * to cross-reference on a one-entry corpus. Note specifically:
22
+ * `bodyTokens` is left empty here, which means any `$Identifier`
23
+ * style entity references inside `text` are NOT extracted and so
24
+ * Q500 cannot fire on them in either direction. External requirement
25
+ * prose (DOORS / Word / PDF) does not use MarkSpec's `$Identifier`
26
+ * syntax, so this is the right trade for v1; a caller that does want
27
+ * `$Identifier` resolution should run the prose through `parseFile`
28
+ * to get a real entry and use the normal `runLint` path instead.
29
+ */
30
+ import type { LintDiagnostic } from "./types.js";
31
+ import type { RuleContribution } from "./score.js";
32
+ /** Options for {@linkcode scoreText}. */
33
+ export interface ScoreTextOptions {
34
+ /**
35
+ * Caller-supplied identifier carried through to the result so a
36
+ * batch caller can correlate inputs and outputs. Defaults to
37
+ * `"EXT_0001"` when absent or empty.
38
+ */
39
+ readonly id?: string;
40
+ }
41
+ /**
42
+ * Result returned by {@linkcode scoreText}.
43
+ *
44
+ * `warningCount + infoCount === diagnostics.length` by convention:
45
+ * every PA-3 rule emits `warning` or `info` only. The `Severity` type
46
+ * permits `error`, but no current rule produces one; if that ever
47
+ * changes the partition will need a third counter.
48
+ */
49
+ export interface ScoreTextResult {
50
+ readonly id: string;
51
+ /** Sum of `weight × occurrences` across all firings. */
52
+ readonly score: number;
53
+ /** Number of diagnostics with severity `"warning"`. */
54
+ readonly warningCount: number;
55
+ /** Number of diagnostics with severity `"info"`. */
56
+ readonly infoCount: number;
57
+ /** Sorted by weight DESC, code ASC. */
58
+ readonly contributions: readonly RuleContribution[];
59
+ /** Full lint diagnostics, in pipeline order. */
60
+ readonly diagnostics: readonly LintDiagnostic[];
61
+ }
62
+ /**
63
+ * Score a single piece of requirement prose against the PA-3 rule
64
+ * catalog. See module doc for the wrapping strategy.
65
+ */
66
+ export declare function scoreText(text: string, opts?: ScoreTextOptions): Promise<ScoreTextResult>;
67
+ //# sourceMappingURL=score_text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"score_text.d.ts","sourceRoot":"","sources":["../../src/lint/score_text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKnD,yCAAyC;AACzC,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACpD,gDAAgD;IAChD,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,gBAAgB,GACtB,OAAO,CAAC,eAAe,CAAC,CAqC1B"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lint/score_text
4
+ *
5
+ * Score a single piece of requirement prose using the PA-3 lint
6
+ * pipeline. Wraps the input text in a synthetic `Entry` (type
7
+ * `Requirement`, body = text, bodyAst = parsed) and runs `runLint`
8
+ * against a one-entry corpus.
9
+ *
10
+ * Two non-obvious wrapping choices:
11
+ * - `bodyAst` is populated via `buildBodyAst(text)`. Most PA-3
12
+ * rules (modal, EARS, INCOSE, passive, lexicon) walk `bodyAst`,
13
+ * not the raw `body` string — without the AST, ~95% of the
14
+ * rule catalog silently no-ops.
15
+ * - `title` is set to the resolved id. Q400 (`struct-title-length`)
16
+ * fires when title length is outside [3, 120]; reusing the id
17
+ * (always ≥ 3 chars) keeps Q400 silent so the score reflects
18
+ * prose quality, not the absence of an authored title.
19
+ *
20
+ * Corpus-dependent rules (Q500 xref-glossary, xref-undefined,
21
+ * suppression hygiene) self-skip because there is nothing for them
22
+ * to cross-reference on a one-entry corpus. Note specifically:
23
+ * `bodyTokens` is left empty here, which means any `$Identifier`
24
+ * style entity references inside `text` are NOT extracted and so
25
+ * Q500 cannot fire on them in either direction. External requirement
26
+ * prose (DOORS / Word / PDF) does not use MarkSpec's `$Identifier`
27
+ * syntax, so this is the right trade for v1; a caller that does want
28
+ * `$Identifier` resolution should run the prose through `parseFile`
29
+ * to get a real entry and use the normal `runLint` path instead.
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.scoreText = scoreText;
33
+ const mod_js_1 = require("../model/mod.js");
34
+ const build_js_1 = require("../ast/build.js");
35
+ const runner_js_1 = require("./runner.js");
36
+ const SYNTHETIC_FILE = "<scoreText>";
37
+ const DEFAULT_ID = "EXT_0001";
38
+ /**
39
+ * Score a single piece of requirement prose against the PA-3 rule
40
+ * catalog. See module doc for the wrapping strategy.
41
+ */
42
+ async function scoreText(text, opts) {
43
+ const id = typeof opts?.id === "string" && opts.id.length > 0
44
+ ? opts.id
45
+ : DEFAULT_ID;
46
+ const entry = {
47
+ displayId: (0, mod_js_1.makeDisplayId)(id),
48
+ title: id,
49
+ body: text,
50
+ bodyAst: (0, build_js_1.buildBodyAst)(text),
51
+ rawAttributes: [],
52
+ typedAttributes: new Map(),
53
+ type: "Requirement",
54
+ shape: "Authored",
55
+ location: { file: SYNTHETIC_FILE, line: 1, column: 1 },
56
+ source: { kind: "markdown" },
57
+ bodyTokens: [],
58
+ };
59
+ const lintResult = await (0, runner_js_1.runLint)({ entries: [entry] });
60
+ let warningCount = 0;
61
+ let infoCount = 0;
62
+ for (const d of lintResult.diagnostics) {
63
+ if (d.severity === "warning")
64
+ warningCount++;
65
+ else if (d.severity === "info")
66
+ infoCount++;
67
+ }
68
+ const entryScore = lintResult.score.perEntry[0];
69
+ return {
70
+ id,
71
+ score: entryScore?.score ?? 0,
72
+ warningCount,
73
+ infoCount,
74
+ contributions: entryScore?.contributions ?? [],
75
+ diagnostics: lintResult.diagnostics,
76
+ };
77
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @module core/lock/compare
3
+ *
4
+ * Pure comparison utilities for lockfile-related version data.
5
+ * Consumed by the LSP extension (slice C) and `markspec doctor`
6
+ * (slice F) to surface skew between the project's declared
7
+ * `[meta.toolchain].min-version` floor and the running CLI's release
8
+ * version.
9
+ *
10
+ * Keeping this in the lock module makes the comparison the SSOT —
11
+ * downstream consumers import one function rather than reinventing
12
+ * parsing + comparison logic each time.
13
+ */
14
+ /**
15
+ * Returns `true` when `actualVersion` is strictly below `floor`,
16
+ * compared as `(major, minor)` tuples. The patch component of
17
+ * `actualVersion` is ignored.
18
+ *
19
+ * Returns `false` when `floor` is `undefined` (project declares no
20
+ * floor) or when `actualVersion >= floor`.
21
+ *
22
+ * Throws `Error` if either argument is not in the expected grammar.
23
+ * Callers should pass values that originated from the parsed lockfile
24
+ * model (`LockfileToolchain.minVersion`, already validated at parse
25
+ * time) and from `VERSION` (a known-good semver constant).
26
+ *
27
+ * @example
28
+ * isBelowFloor("0.6.1", "0.6") // false
29
+ * isBelowFloor("0.5.99", "0.6") // true
30
+ * isBelowFloor("0.7.0", "0.6") // false
31
+ * isBelowFloor("0.6.1", undefined) // false (no floor)
32
+ */
33
+ export declare function isBelowFloor(actualVersion: string, floor: string | undefined): boolean;
34
+ //# sourceMappingURL=compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/lock/compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAeH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAmBT"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock/compare
4
+ *
5
+ * Pure comparison utilities for lockfile-related version data.
6
+ * Consumed by the LSP extension (slice C) and `markspec doctor`
7
+ * (slice F) to surface skew between the project's declared
8
+ * `[meta.toolchain].min-version` floor and the running CLI's release
9
+ * version.
10
+ *
11
+ * Keeping this in the lock module makes the comparison the SSOT —
12
+ * downstream consumers import one function rather than reinventing
13
+ * parsing + comparison logic each time.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.isBelowFloor = isBelowFloor;
17
+ /**
18
+ * Strict MAJOR.MINOR grammar — must match the parser's MIN_VERSION_RE.
19
+ * Used to validate the `floor` argument.
20
+ */
21
+ const FLOOR_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
22
+ /**
23
+ * Prefix-match grammar for the running binary's VERSION string. Accepts
24
+ * standard semver (MAJOR.MINOR.PATCH and optional pre-release/build),
25
+ * extracting only the major + minor pair.
26
+ */
27
+ const ACTUAL_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.|[-+]|$)/;
28
+ /**
29
+ * Returns `true` when `actualVersion` is strictly below `floor`,
30
+ * compared as `(major, minor)` tuples. The patch component of
31
+ * `actualVersion` is ignored.
32
+ *
33
+ * Returns `false` when `floor` is `undefined` (project declares no
34
+ * floor) or when `actualVersion >= floor`.
35
+ *
36
+ * Throws `Error` if either argument is not in the expected grammar.
37
+ * Callers should pass values that originated from the parsed lockfile
38
+ * model (`LockfileToolchain.minVersion`, already validated at parse
39
+ * time) and from `VERSION` (a known-good semver constant).
40
+ *
41
+ * @example
42
+ * isBelowFloor("0.6.1", "0.6") // false
43
+ * isBelowFloor("0.5.99", "0.6") // true
44
+ * isBelowFloor("0.7.0", "0.6") // false
45
+ * isBelowFloor("0.6.1", undefined) // false (no floor)
46
+ */
47
+ function isBelowFloor(actualVersion, floor) {
48
+ if (floor === undefined)
49
+ return false;
50
+ const f = FLOOR_RE.exec(floor);
51
+ if (!f) {
52
+ throw new Error(`isBelowFloor: invalid floor ${JSON.stringify(floor)}`);
53
+ }
54
+ const a = ACTUAL_RE.exec(actualVersion);
55
+ if (!a) {
56
+ throw new Error(`isBelowFloor: invalid actualVersion ${JSON.stringify(actualVersion)}`);
57
+ }
58
+ const fMajor = parseInt(f[1], 10);
59
+ const fMinor = parseInt(f[2], 10);
60
+ const aMajor = parseInt(a[1], 10);
61
+ const aMinor = parseInt(a[2], 10);
62
+ if (aMajor < fMajor)
63
+ return true;
64
+ if (aMajor > fMajor)
65
+ return false;
66
+ return aMinor < fMinor;
67
+ }
@@ -5,11 +5,12 @@
5
5
  * model, upstream resolution, drift detection. The public boundary
6
6
  * for both `markspec lock` and `markspec compile --frozen`.
7
7
  */
8
- export type { BoundEntry, BoundEntryBinding, GeneratedCache, LockedAttributes, Lockfile, LockfileMeta, Upstream, UpstreamProfile, UpstreamReference, UpstreamRegistry, } from "./model.js";
8
+ export type { BoundEntry, BoundEntryBinding, GeneratedCache, LockedAttributes, Lockfile, LockfileMeta, LockfileToolchain, Upstream, UpstreamProfile, UpstreamReference, UpstreamRegistry, } from "./model.js";
9
9
  export { LOCKFILE_SCHEMA_VERSION } from "./model.js";
10
10
  export { serializeLockfile } from "./serializer.js";
11
11
  export { parseLockfile } from "./parser.js";
12
12
  export type { ParseLockfileResult } from "./parser.js";
13
+ export { isBelowFloor } from "./compare.js";
13
14
  export { checkDrift } from "./check.js";
14
15
  export { sha256Bytes, sha256String } from "./hash.js";
15
16
  export { canonicalEdgeJson, hashCanonicalEdges } from "./canonical_edges.js";
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/lock/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/lock/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,cAAc,CAAC"}
@@ -7,13 +7,15 @@
7
7
  * for both `markspec lock` and `markspec compile --frozen`.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.resolveUpstreams = exports.resolveRegistries = exports.resolveReferences = exports.resolveProfileChain = exports.resolveBoundEntries = exports.extractEdgeQuads = exports.hashCanonicalEdges = exports.canonicalEdgeJson = exports.sha256String = exports.sha256Bytes = exports.checkDrift = exports.parseLockfile = exports.serializeLockfile = exports.LOCKFILE_SCHEMA_VERSION = void 0;
10
+ exports.resolveUpstreams = exports.resolveRegistries = exports.resolveReferences = exports.resolveProfileChain = exports.resolveBoundEntries = exports.extractEdgeQuads = exports.hashCanonicalEdges = exports.canonicalEdgeJson = exports.sha256String = exports.sha256Bytes = exports.checkDrift = exports.isBelowFloor = exports.parseLockfile = exports.serializeLockfile = exports.LOCKFILE_SCHEMA_VERSION = void 0;
11
11
  var model_js_1 = require("./model.js");
12
12
  Object.defineProperty(exports, "LOCKFILE_SCHEMA_VERSION", { enumerable: true, get: function () { return model_js_1.LOCKFILE_SCHEMA_VERSION; } });
13
13
  var serializer_js_1 = require("./serializer.js");
14
14
  Object.defineProperty(exports, "serializeLockfile", { enumerable: true, get: function () { return serializer_js_1.serializeLockfile; } });
15
15
  var parser_js_1 = require("./parser.js");
16
16
  Object.defineProperty(exports, "parseLockfile", { enumerable: true, get: function () { return parser_js_1.parseLockfile; } });
17
+ var compare_js_1 = require("./compare.js");
18
+ Object.defineProperty(exports, "isBelowFloor", { enumerable: true, get: function () { return compare_js_1.isBelowFloor; } });
17
19
  var check_js_1 = require("./check.js");
18
20
  Object.defineProperty(exports, "checkDrift", { enumerable: true, get: function () { return check_js_1.checkDrift; } });
19
21
  var hash_js_1 = require("./hash.js");
@@ -62,11 +62,24 @@ export interface GeneratedCache {
62
62
  readonly edgesHash: string;
63
63
  readonly edgesCount: number;
64
64
  }
65
+ /** Toolchain requirements declared by the project. */
66
+ export interface LockfileToolchain {
67
+ /**
68
+ * Minimum required markspec release version at minor granularity
69
+ * (e.g. "0.6" means "any 0.6.x or later"). Compared as a
70
+ * (major, minor) tuple against the running binary's VERSION.
71
+ * Format: /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/ — exactly two components,
72
+ * no leading zeros, no prefix, no operator.
73
+ */
74
+ readonly minVersion: string;
75
+ }
65
76
  /** Lockfile metadata. */
66
77
  export interface LockfileMeta {
67
78
  readonly markspecSchema: number;
68
79
  /** Timestamp the lockfile was written, RFC 3339 UTC (e.g. "2026-05-25T12:00:00Z"). */
69
80
  readonly lockedAt: string;
81
+ /** Toolchain requirements; omitted when no floor is declared. */
82
+ readonly toolchain?: LockfileToolchain;
70
83
  }
71
84
  /** Top-level lockfile model. */
72
85
  export interface Lockfile {
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lock/model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAA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,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;CACzC;AAED,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
@@ -8,6 +8,9 @@
8
8
  * - MSL-L001 — malformed TOML or missing required field
9
9
  * - MSL-L002 — lockfile schema is newer than this binary supports
10
10
  * - MSL-L003 — lockfile schema is unrecognised (< 1)
11
+ * - MSL-L030 — `[meta.toolchain].min-version` is malformed
12
+ * - MSL-L031 — `[meta.toolchain].min-version` is not a string
13
+ * - MSL-L032 — `meta.toolchain` is a scalar instead of a table
11
14
  */
12
15
  import type { Diagnostic } from "../model/mod.js";
13
16
  import { type Lockfile } from "./model.js";
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/lock/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAGL,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AAEpB,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CA+L/D"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/lock/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAGL,KAAK,QAAQ,EAId,MAAM,YAAY,CAAC;AAUpB,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAkO/D"}