@sublang/spex 5.0.0 → 7.0.0-beta.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 (114) hide show
  1. package/README.md +453 -41
  2. package/dist/cli.js +12 -1
  3. package/dist/commands/add.d.ts +1 -1
  4. package/dist/commands/add.js +3 -3
  5. package/dist/commands/auth-target.d.ts +1 -0
  6. package/dist/commands/auth-target.js +4 -2
  7. package/dist/commands/environment.d.ts +15 -21
  8. package/dist/commands/environment.js +43 -57
  9. package/dist/commands/export.js +2 -2
  10. package/dist/commands/home.d.ts +2 -2
  11. package/dist/commands/home.js +3 -3
  12. package/dist/commands/list.js +1 -1
  13. package/dist/commands/login.js +12 -7
  14. package/dist/commands/logout.js +2 -3
  15. package/dist/commands/publish.js +16 -16
  16. package/dist/commands/remove.js +1 -1
  17. package/dist/commands/run.d.ts +1 -1
  18. package/dist/commands/run.js +22 -3
  19. package/dist/commands/search.js +1 -1
  20. package/dist/commands/settle.d.ts +1 -1
  21. package/dist/commands/settle.js +3 -3
  22. package/dist/commands/whoami.js +2 -6
  23. package/dist/guards/approval.d.ts +56 -0
  24. package/dist/guards/approval.js +158 -0
  25. package/dist/guards/checks.d.ts +207 -0
  26. package/dist/guards/checks.js +681 -0
  27. package/dist/guards/commands.d.ts +15 -0
  28. package/dist/guards/commands.js +313 -0
  29. package/dist/guards/copy.d.ts +67 -0
  30. package/dist/guards/copy.js +306 -0
  31. package/dist/guards/declaration.d.ts +45 -0
  32. package/dist/guards/declaration.js +224 -0
  33. package/dist/guards/files.d.ts +137 -0
  34. package/dist/guards/files.js +544 -0
  35. package/dist/guards/harness.d.ts +58 -0
  36. package/dist/guards/harness.js +420 -0
  37. package/dist/guards/items.d.ts +61 -0
  38. package/dist/guards/items.js +161 -0
  39. package/dist/guards/patch.d.ts +55 -0
  40. package/dist/guards/patch.js +258 -0
  41. package/dist/guards/processes.d.ts +49 -0
  42. package/dist/guards/processes.js +233 -0
  43. package/dist/guards/proofs.d.ts +88 -0
  44. package/dist/guards/proofs.js +503 -0
  45. package/dist/guards/records.d.ts +176 -0
  46. package/dist/guards/records.js +513 -0
  47. package/dist/guards/report.d.ts +26 -0
  48. package/dist/guards/report.js +492 -0
  49. package/dist/guards/runner.d.ts +42 -0
  50. package/dist/guards/runner.js +167 -0
  51. package/dist/guards/tla.d.ts +51 -0
  52. package/dist/guards/tla.js +352 -0
  53. package/dist/guards/tlapm.d.ts +81 -0
  54. package/dist/guards/tlapm.js +172 -0
  55. package/dist/guards/tlc.d.ts +191 -0
  56. package/dist/guards/tlc.js +457 -0
  57. package/dist/guards/translation.d.ts +66 -0
  58. package/dist/guards/translation.js +202 -0
  59. package/dist/guards/types.d.ts +185 -0
  60. package/dist/guards/types.js +437 -0
  61. package/dist/guards/verify.d.ts +290 -0
  62. package/dist/guards/verify.js +1191 -0
  63. package/dist/guards/xml.d.ts +18 -0
  64. package/dist/guards/xml.js +105 -0
  65. package/dist/lib/environment/archive.d.ts +16 -3
  66. package/dist/lib/environment/archive.js +39 -8
  67. package/dist/lib/environment/builtins.d.ts +10 -12
  68. package/dist/lib/environment/builtins.js +18 -20
  69. package/dist/lib/environment/exports.d.ts +14 -13
  70. package/dist/lib/environment/exports.js +31 -16
  71. package/dist/lib/environment/format.d.ts +2 -2
  72. package/dist/lib/environment/format.js +3 -3
  73. package/dist/lib/environment/git-source.js +6 -3
  74. package/dist/lib/environment/install.d.ts +14 -16
  75. package/dist/lib/environment/install.js +66 -61
  76. package/dist/lib/environment/lock.d.ts +4 -3
  77. package/dist/lib/environment/lock.js +6 -5
  78. package/dist/lib/environment/marker.js +1 -2
  79. package/dist/lib/environment/own-paths.d.ts +7 -10
  80. package/dist/lib/environment/own-paths.js +10 -13
  81. package/dist/lib/environment/placed-record.d.ts +3 -2
  82. package/dist/lib/environment/placed-record.js +5 -4
  83. package/dist/lib/environment/registries.d.ts +7 -9
  84. package/dist/lib/environment/registries.js +9 -36
  85. package/dist/lib/environment/registry.d.ts +6 -7
  86. package/dist/lib/environment/registry.js +12 -12
  87. package/dist/lib/environment/requests.d.ts +6 -5
  88. package/dist/lib/environment/requests.js +6 -8
  89. package/dist/lib/environment/resolve.d.ts +4 -4
  90. package/dist/lib/environment/resolve.js +3 -4
  91. package/dist/lib/environment/store.d.ts +34 -8
  92. package/dist/lib/environment/store.js +138 -43
  93. package/dist/lib/files.d.ts +72 -12
  94. package/dist/lib/files.js +200 -65
  95. package/dist/lib/git-host.d.ts +52 -258
  96. package/dist/lib/git-host.js +52 -265
  97. package/dist/lib/home-file.d.ts +13 -10
  98. package/dist/lib/home-file.js +28 -18
  99. package/dist/lib/instance.d.ts +1 -1
  100. package/dist/lib/instance.js +1 -1
  101. package/dist/lint.d.ts +22 -0
  102. package/dist/lint.js +36 -0
  103. package/dist/testing/standin-registry.js +1 -1
  104. package/package.json +7 -3
  105. package/scaffold/.file-history.json +14 -7
  106. package/scaffold/i18n/zh/source-pins.json +41 -0
  107. package/scaffold/i18n/zh/specs/decisions/000-spec-structure-format.md +0 -1
  108. package/scaffold/i18n/zh/specs/intents/000-spdx-headers.md +0 -1
  109. package/scaffold/i18n/zh/specs/map.md +0 -1
  110. package/scaffold/i18n/zh/specs/meta.md +18 -35
  111. package/scaffold/i18n/zh/specs/packages/git.md +0 -1
  112. package/scaffold/i18n/zh/specs/packages/licensing.md +0 -1
  113. package/scaffold/specs/meta.md +18 -3
  114. package/scripts/test-exit-guard.mjs +28 -0
@@ -0,0 +1,202 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
3
+ /*
4
+ * Guards package (guards-6), DR-244 and DR-252: a translation, the
5
+ * guard's items written in TLA+ in one file `guards/<guard>/translations/<name>.tla`.
6
+ * Spex reads its text only to check its form: its one opening line,
7
+ * the words a translation may not hold and the seven operators with
8
+ * their parameters. What the translation means is TLC's to say.
9
+ */
10
+ import { DECLARATION_MODULE, OPERATORS } from "./declaration.js";
11
+ /** What a translation's name is made of. */
12
+ export const TRANSLATION_NAME_RE = /^[a-z][a-z0-9_]*$/;
13
+ /** The TLA+ modules a translation may load: the declaration in TLA+
14
+ * and four standard modules. */
15
+ export const MAY_LOAD = [DECLARATION_MODULE, "Naturals", "Integers", "FiniteSets", "Sequences"];
16
+ /** Names no translation may take: a file of that name would stand in
17
+ * for a file TLC or the proof system loads, on a file system that
18
+ * ignores case. */
19
+ const TAKEN_MODULES = new Set([
20
+ "declaration", "naturals", "integers", "reals", "finitesets", "sequences", "bags", "tlc", "tlcext",
21
+ "randomization", "realtime", "toolbox",
22
+ // The proof system's standard modules.
23
+ "tlaps", "naturalsinduction", "wellfoundedinduction", "finitesettheorems", "sequencetheorems", "functiontheorems",
24
+ "functions", "folds", "bagstheorems",
25
+ ]);
26
+ /** Why `name` cannot name a translation, or null when it can. */
27
+ export function translationNameFault(name) {
28
+ if (!TRANSLATION_NAME_RE.test(name)) {
29
+ return "a translation's name is a lowercase letter, then lowercase letters, digits and _";
30
+ }
31
+ if (TAKEN_MODULES.has(name) || name.startsWith("spex")) {
32
+ return `'${name}' is the name of a file TLC or Spex loads; pick another`;
33
+ }
34
+ // `<name>_proofs` names the proofs of the translation `<name>`.
35
+ if (name.endsWith("_proofs"))
36
+ return `'${name}' is the name of a proof file; pick another`;
37
+ return null;
38
+ }
39
+ /** Why a translation holds no prime, `ENABLED` or `UNCHANGED`: each
40
+ * of its operators is given its state. */
41
+ const NEXT_STATE = "a translation speaks of the state it is given, never of the next";
42
+ /** The words a translation may not hold, each with why. The prime is
43
+ * one of them: outside a comment and a string it is TLA+'s mark of
44
+ * the next state and nothing else. */
45
+ const REFUSED = [
46
+ ["INSTANCE", "a translation loads only what it extends"],
47
+ ["CONSTANT", "a translation declares no constant"],
48
+ ["CONSTANTS", "a translation declares no constant"],
49
+ ["VARIABLE", "a translation declares no variable"],
50
+ ["VARIABLES", "a translation declares no variable"],
51
+ ["ASSUME", "a translation assumes nothing"],
52
+ ["ASSUMPTION", "a translation assumes nothing"],
53
+ ["AXIOM", "a translation assumes nothing"],
54
+ ["THEOREM", "a translation states no theorem"],
55
+ ["LEMMA", "a translation states no theorem"],
56
+ ["PROPOSITION", "a translation states no theorem"],
57
+ ["COROLLARY", "a translation states no theorem"],
58
+ ["CHOOSE", "choose among values with <Values>First, by the order the binding declares, so no answer rests on TLC's own order"],
59
+ ["'", NEXT_STATE],
60
+ ["ENABLED", NEXT_STATE],
61
+ ["UNCHANGED", NEXT_STATE],
62
+ ];
63
+ /**
64
+ * TLA+ text with each comment and each string's content blanked out,
65
+ * every other character at its own place, so a word found is a word
66
+ * of the translation and its line and column are the file's.
67
+ */
68
+ export function bare(text) {
69
+ let out = "";
70
+ let depth = 0;
71
+ const blank = (c) => (c === "\n" ? "\n" : " ");
72
+ for (let at = 0; at < text.length; at += 1) {
73
+ if (text.startsWith("(*", at)) {
74
+ depth += 1;
75
+ out += " ";
76
+ at += 1;
77
+ }
78
+ else if (depth > 0 && text.startsWith("*)", at)) {
79
+ depth -= 1;
80
+ out += " ";
81
+ at += 1;
82
+ }
83
+ else if (depth > 0) {
84
+ out += blank(text[at]);
85
+ }
86
+ else if (text.startsWith("\\*", at)) {
87
+ while (at < text.length && text[at] !== "\n") {
88
+ out += " ";
89
+ at += 1;
90
+ }
91
+ if (at < text.length)
92
+ out += "\n";
93
+ }
94
+ else if (text[at] === '"') {
95
+ out += '"';
96
+ at += 1;
97
+ while (at < text.length && text[at] !== '"' && text[at] !== "\n") {
98
+ if (text[at] === "\\" && at + 1 < text.length && text[at + 1] !== "\n") {
99
+ out += " ";
100
+ at += 2;
101
+ }
102
+ else {
103
+ out += " ";
104
+ at += 1;
105
+ }
106
+ }
107
+ if (at < text.length)
108
+ out += text[at] === "\n" ? "\n" : '"';
109
+ }
110
+ else {
111
+ out += text[at];
112
+ }
113
+ }
114
+ return out;
115
+ }
116
+ /** The line and column, from 1, of an offset in a text. */
117
+ export function placeOf(text, offset) {
118
+ const before = text.slice(0, offset);
119
+ const line = before.split("\n").length;
120
+ return { line, col: offset - (before.lastIndexOf("\n") + 1) + 1 };
121
+ }
122
+ /** What a file both TLC and the proof system read holds only:
123
+ * TLC's parser counts a column for each character and the proof
124
+ * system's for each byte, so a character of more than one byte moves
125
+ * what follows it on its line for one of them alone, and a list of
126
+ * `/\` or `\/` set under one another is read two ways. */
127
+ export const ASCII_ONLY = "only printable ASCII characters and line ends, which TLC and the proof system read alike";
128
+ /** Where a text first holds a character that is no printable ASCII
129
+ * character and no line end, with the character as `U+<hex>`, or null.
130
+ * `text` has its line ends as LF. */
131
+ export function otherCharacter(text) {
132
+ const found = /[^\x20-\x7e\n]/u.exec(text);
133
+ if (found === null)
134
+ return null;
135
+ const code = found[0].codePointAt(0) ?? 0;
136
+ return { ...placeOf(text, found.index), shown: `U+${code.toString(16).toUpperCase().padStart(4, "0")}` };
137
+ }
138
+ /** What a file of one module is refused for where it is not one. */
139
+ export function oneModuleRule(name) {
140
+ return `the word MODULE stands once in the file, in its line ---- MODULE ${name} ----, after blank lines and \\* comment lines alone`;
141
+ }
142
+ /**
143
+ * Whether a text is one module of this name and holds no other. The
144
+ * tools find a module by the word, wherever it stands: before a module
145
+ * begins they read no comment, so a commented line can open one, and a
146
+ * module's name may stand on the line after the word. The text is
147
+ * therefore read as it is, comments and strings included: one MODULE
148
+ * leaves no place for a second module, and nothing before its line
149
+ * that could open a comment for Spex alone. `text` has its line ends
150
+ * as LF.
151
+ */
152
+ export function oneModule(text, name) {
153
+ const words = [...text.matchAll(/\bMODULE\b/g)];
154
+ if (words.length !== 1)
155
+ return false;
156
+ const lines = text.split("\n");
157
+ const at = placeOf(text, words[0].index).line - 1;
158
+ if (!new RegExp(`^ *-{4,} *MODULE +${name} *-{4,} *$`).test(lines[at]))
159
+ return false;
160
+ return lines.slice(0, at).every((line) => /^ *(?:\\\*.*)?$/.test(line));
161
+ }
162
+ /**
163
+ * The errors of form in a translation's text, in the file's order;
164
+ * none where its form holds. A check of the text only: whether the
165
+ * file parses, and what it loads, TLC says.
166
+ */
167
+ export function formFaults(translation) {
168
+ const { name } = translation;
169
+ // A line ends at LF, CRLF or a lone CR, as TLC reads it: a comment
170
+ // ends where TLC ends it, and a place is the one TLC names.
171
+ const text = translation.text.replace(/\r\n?/g, "\n");
172
+ const code = bare(text);
173
+ const faults = [];
174
+ const other = otherCharacter(text);
175
+ if (other !== null) {
176
+ faults.push({ line: other.line, col: other.col, message: `it holds the character ${other.shown}: a translation holds ${ASCII_ONLY}` });
177
+ }
178
+ if (!oneModule(text, name))
179
+ faults.push({ line: null, col: null, message: oneModuleRule(name) });
180
+ for (const [word, why] of REFUSED) {
181
+ const found = (word === "'" ? /'/ : new RegExp(`\\b${word}\\b`)).exec(code);
182
+ if (found !== null)
183
+ faults.push({ ...placeOf(code, found.index), message: `${word} is not for a translation: ${why}` });
184
+ }
185
+ for (const [operator, params] of OPERATORS) {
186
+ const found = new RegExp(`^${operator}[ \\t]*(?:\\(([^)]*)\\))?\\s*==`, "m").exec(code);
187
+ const shown = params.length === 0 ? operator : `${operator}(${params.join(", ")})`;
188
+ if (found === null) {
189
+ faults.push({ line: null, col: null, message: `it does not define ${shown}` });
190
+ continue;
191
+ }
192
+ const given = found[1] === undefined ? 0 : found[1].split(",").length;
193
+ if (given !== params.length) {
194
+ faults.push({
195
+ ...placeOf(code, found.index),
196
+ message: `it defines ${operator} with ${given} ${given === 1 ? "parameter" : "parameters"}, not as ${shown}`,
197
+ });
198
+ }
199
+ }
200
+ return faults.sort((a, b) => (a.line ?? 0) - (b.line ?? 0) || (a.col ?? 0) - (b.col ?? 0));
201
+ }
202
+ //# sourceMappingURL=translation.js.map
@@ -0,0 +1,185 @@
1
+ /** The one error the guards library throws on purpose. Its message is
2
+ * plain words, ready to print; nothing else of it is for a person. */
3
+ export declare class GuardError extends Error {
4
+ constructor(message: string);
5
+ }
6
+ /** Run `work`, and put `where` before the message of a GuardError it
7
+ * throws: `<where>: <cause>`. */
8
+ export declare function within<T>(where: string, work: () => T): T;
9
+ /** Order two texts by their code units, the same on every machine. */
10
+ export declare function byText(a: string, b: string): number;
11
+ /** Why `name` cannot name a values set, a param or an effect field,
12
+ * or null when it can. */
13
+ export declare function fieldFault(name: string): string | null;
14
+ /** Why `name` cannot name an event, or null when it can. */
15
+ export declare function eventFault(name: string): string | null;
16
+ /** A declared type. A set holds whole numbers or named values;
17
+ * `optional` adds the missing value and is never nested. */
18
+ export type Type = {
19
+ kind: "bool";
20
+ } | {
21
+ kind: "int";
22
+ min: number;
23
+ max: number;
24
+ } | {
25
+ kind: "value";
26
+ set: string;
27
+ } | {
28
+ kind: "set";
29
+ of: Type;
30
+ } | {
31
+ kind: "optional";
32
+ of: Type;
33
+ };
34
+ /** A value of a declared type, in its one fixed form. */
35
+ export type Value = boolean | number | string | null | Value[];
36
+ /** Named values: an event's params or its effect. */
37
+ export type Fields = Record<string, Value>;
38
+ /**
39
+ * How a values set is ordered, for any of its values (DR-244): as
40
+ * text, code unit by code unit with a prefix first; or split at every
41
+ * `separator` and compared part by part as text, a value with fewer
42
+ * parts first where all its parts are equal.
43
+ */
44
+ export type Order = {
45
+ rule: "text";
46
+ } | {
47
+ rule: "parts";
48
+ separator: string;
49
+ };
50
+ /**
51
+ * The binding's values sets. Each set is any values; `sets` holds the
52
+ * ones it declares, which TLC searches with and a case's step may
53
+ * name. `orders` holds the order of each set that has one; a set
54
+ * without an entry has none. `home` finds a declared value's set and
55
+ * its place in the list; a value belongs to exactly one set.
56
+ */
57
+ export type Vocabulary = {
58
+ sets: Record<string, readonly string[]>;
59
+ orders: Record<string, Order>;
60
+ home: ReadonlyMap<string, {
61
+ set: string;
62
+ rank: number;
63
+ }>;
64
+ };
65
+ /** One event as a binding declares it. */
66
+ export type EventDeclaration = {
67
+ params: Record<string, Type>;
68
+ effect: Record<string, Type>;
69
+ };
70
+ /** What a case's steps are checked against: the binding's values and
71
+ * events. `events` keeps the declared order. */
72
+ export type Declaration = {
73
+ vocabulary: Vocabulary;
74
+ events: Record<string, EventDeclaration>;
75
+ };
76
+ /** One event with its params: what a sequence is made of. */
77
+ export type Call = {
78
+ event: string;
79
+ params: Fields;
80
+ };
81
+ /** One step of a case: a call and the effect fields the case states
82
+ * (fields left out are not compared). */
83
+ export type Step = Call & {
84
+ effect: Fields;
85
+ };
86
+ /** A case of the guard item (guards-37) with its steps from the guard
87
+ * file (guards-10). */
88
+ export type Case = {
89
+ /** Its label, as the item writes it. */
90
+ label: string;
91
+ kind: "permitted" | "forbidden";
92
+ /** Its plain words, from the item. */
93
+ words: string;
94
+ steps: Step[];
95
+ };
96
+ /**
97
+ * Compare two values of a set by its order: negative where `a` comes
98
+ * first, positive where `b` does, zero where they are the same. It
99
+ * reads the values alone, so it orders values a binding never
100
+ * declared as well as those it did.
101
+ */
102
+ export declare function compareInOrder(order: Order, a: string, b: string): number;
103
+ /** An order as binding.yaml writes it. */
104
+ export declare function showOrder(order: Order): string;
105
+ /** Why a string cannot be a value of a values set, or null where it
106
+ * can: it is printable ASCII, not empty, with no space at either end,
107
+ * and not `none`, `true` or `false`. */
108
+ export declare function valueFault(value: string): string | null;
109
+ /**
110
+ * Build a vocabulary from the declared values of each set and the
111
+ * orders of those that have one. Where a set has an order its
112
+ * declared values must be listed in it, so the list is that order
113
+ * for TLC as well.
114
+ */
115
+ export declare function vocabulary(values: Record<string, readonly string[]>, orders?: Record<string, Order>): Vocabulary;
116
+ /** Whether `name` is one of the vocabulary's sets. */
117
+ export declare function isValuesSet(vocab: Vocabulary, name: string): boolean;
118
+ /**
119
+ * Read a type as binding.yaml writes it: `bool`, `<a>..<b>`, a values
120
+ * name, `set of <values name>`, `set of <a>..<b>`, and `<type>?`.
121
+ * After `set of …` the `?` makes the set optional.
122
+ */
123
+ export declare function parseType(text: unknown, vocab: Vocabulary): Type;
124
+ /** A type as it is written. */
125
+ export declare function showType(type: Type): string;
126
+ /** Data that is not yet a value, printed for a message. */
127
+ export declare function showData(data: unknown): string;
128
+ /** Put a set's members in declared order: whole numbers rising, named
129
+ * values as their set lists them. */
130
+ export declare function inOrder(members: readonly Value[], vocab: Vocabulary): Value[];
131
+ /**
132
+ * Read data written as YAML or JSON as a value of `type`: a step's
133
+ * params and effects, what a binding returns. Throws a GuardError
134
+ * saying what was expected and what was found.
135
+ */
136
+ export declare function decodeValue(type: Type, data: unknown, vocab: Vocabulary): Value;
137
+ /**
138
+ * Read a record of named values against its declared fields. Every
139
+ * declared field must be there unless `partial`; no other field may
140
+ * be. The result keeps the declared order.
141
+ */
142
+ export declare function decodeFields(declared: Record<string, Type>, data: unknown, vocab: Vocabulary, options?: {
143
+ partial?: boolean;
144
+ }): Fields;
145
+ /** Whether two values are the same. */
146
+ export declare function sameValue(a: Value, b: Value): boolean;
147
+ /** Whether two records of named values are the same, field by field. */
148
+ export declare function sameFields(a: Fields, b: Fields): boolean;
149
+ /** The stated fields whose observed value is another: what a step
150
+ * states of an effect against what the code produced. Fields the step
151
+ * leaves out are not compared. In the stated order. */
152
+ export declare function differences(stated: Fields, observed: Fields): {
153
+ field: string;
154
+ stated: Value;
155
+ observed: Value;
156
+ }[];
157
+ /**
158
+ * Order two values of one declared type: the missing value first,
159
+ * false before true, whole numbers rising, a values set in its
160
+ * declared order, sets by size and then by their members in order.
161
+ */
162
+ export declare function compareValues(type: Type, a: Value, b: Value, vocab: Vocabulary): number;
163
+ /** Order two records of the same declared fields: by the first
164
+ * field's value, then the second's, and so on. */
165
+ export declare function compareFields(declared: Record<string, Type>, a: Fields, b: Fields, vocab: Vocabulary): number;
166
+ /** A value as output prints it: `none`, `{a, b}` for a set. */
167
+ export declare function showValue(value: Value): string;
168
+ /**
169
+ * A string as a report prints it: itself where it can be read as
170
+ * nothing else, and as JSON writes it where it is empty, holds white
171
+ * space or a mark the printed forms are built of, or reads as another
172
+ * value, so that a string never prints as another value does: the set
173
+ * of `"ann, zed"` is `{"ann, zed"}`, and the string `true` is `"true"`.
174
+ */
175
+ export declare function showText(text: string): string;
176
+ /** Named values on one line: `selected={zeta/kit} providing={}`. */
177
+ export declare function showFields(fields: Fields): string;
178
+ /** Parse one YAML file's text. A syntax error or a repeated key is a
179
+ * GuardError. */
180
+ export declare function parseYaml(text: string): unknown;
181
+ /** `data` as a mapping, with only the `allowed` keys when they are
182
+ * given; else a GuardError naming the unknown key. */
183
+ export declare function mapping(data: unknown, allowed?: readonly string[]): Record<string, unknown>;
184
+ /** `data` as a mapping, or an empty one where the key was left out. */
185
+ export declare function mappingOrNone(data: unknown, allowed?: readonly string[]): Record<string, unknown>;