@tiphys/kernel 0.0.0 → 0.2.0

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 (207) hide show
  1. package/AGENTS.md +663 -0
  2. package/LICENSE +202 -0
  3. package/assurance-modes.yaml +299 -0
  4. package/checklists/clean-room.yaml +325 -0
  5. package/checklists/env-failure-diagnosis.yaml +68 -0
  6. package/checklists/flake-playbook.yaml +68 -0
  7. package/checklists/hazard-review.yaml +144 -0
  8. package/checklists/plan-review.yaml +103 -0
  9. package/dist/bin/tiphys.d.ts +2 -0
  10. package/dist/bin/tiphys.js +92 -0
  11. package/dist/src/adapters/load.d.ts +202 -0
  12. package/dist/src/adapters/load.js +440 -0
  13. package/dist/src/brief.d.ts +32 -0
  14. package/dist/src/brief.js +66 -0
  15. package/dist/src/checklists.d.ts +169 -0
  16. package/dist/src/checklists.js +310 -0
  17. package/dist/src/checks.d.ts +1539 -0
  18. package/dist/src/checks.js +5025 -0
  19. package/dist/src/cli.d.ts +9 -0
  20. package/dist/src/cli.js +68 -0
  21. package/dist/src/commands/brief.d.ts +92 -0
  22. package/dist/src/commands/brief.js +343 -0
  23. package/dist/src/commands/checklist.d.ts +42 -0
  24. package/dist/src/commands/checklist.js +168 -0
  25. package/dist/src/commands/cutover.d.ts +35 -0
  26. package/dist/src/commands/cutover.js +448 -0
  27. package/dist/src/commands/doctor.d.ts +264 -0
  28. package/dist/src/commands/doctor.js +1546 -0
  29. package/dist/src/commands/gates.d.ts +9 -0
  30. package/dist/src/commands/gates.js +360 -0
  31. package/dist/src/commands/init.d.ts +30 -0
  32. package/dist/src/commands/init.js +177 -0
  33. package/dist/src/commands/lock.d.ts +34 -0
  34. package/dist/src/commands/lock.js +340 -0
  35. package/dist/src/commands/mode.d.ts +40 -0
  36. package/dist/src/commands/mode.js +134 -0
  37. package/dist/src/commands/next.d.ts +130 -0
  38. package/dist/src/commands/next.js +597 -0
  39. package/dist/src/commands/plan.d.ts +20 -0
  40. package/dist/src/commands/plan.js +105 -0
  41. package/dist/src/commands/pool.d.ts +1 -0
  42. package/dist/src/commands/pool.js +139 -0
  43. package/dist/src/commands/resume.d.ts +1 -0
  44. package/dist/src/commands/resume.js +88 -0
  45. package/dist/src/commands/spawn.d.ts +1 -0
  46. package/dist/src/commands/spawn.js +195 -0
  47. package/dist/src/commands/status.d.ts +21 -0
  48. package/dist/src/commands/status.js +122 -0
  49. package/dist/src/commands/sync.d.ts +47 -0
  50. package/dist/src/commands/sync.js +341 -0
  51. package/dist/src/commands/teardown.d.ts +1 -0
  52. package/dist/src/commands/teardown.js +87 -0
  53. package/dist/src/commands/tuition.d.ts +21 -0
  54. package/dist/src/commands/tuition.js +218 -0
  55. package/dist/src/commands/validate.d.ts +78 -0
  56. package/dist/src/commands/validate.js +430 -0
  57. package/dist/src/commands/watch.d.ts +1 -0
  58. package/dist/src/commands/watch.js +172 -0
  59. package/dist/src/cutover.d.ts +584 -0
  60. package/dist/src/cutover.js +1444 -0
  61. package/dist/src/exclusion.d.ts +389 -0
  62. package/dist/src/exclusion.js +843 -0
  63. package/dist/src/exec/env.d.ts +278 -0
  64. package/dist/src/exec/env.js +334 -0
  65. package/dist/src/fleet.d.ts +223 -0
  66. package/dist/src/fleet.js +298 -0
  67. package/dist/src/gates/adapters/http-json.d.ts +5 -0
  68. package/dist/src/gates/adapters/http-json.js +283 -0
  69. package/dist/src/gates/adapters/migrations-command.d.ts +1 -0
  70. package/dist/src/gates/adapters/migrations-command.js +373 -0
  71. package/dist/src/gates/citations.d.ts +408 -0
  72. package/dist/src/gates/citations.js +1169 -0
  73. package/dist/src/gates/coverage.d.ts +375 -0
  74. package/dist/src/gates/coverage.js +836 -0
  75. package/dist/src/gates/credentials.d.ts +233 -0
  76. package/dist/src/gates/credentials.js +752 -0
  77. package/dist/src/gates/deploy.d.ts +1 -0
  78. package/dist/src/gates/deploy.js +33 -0
  79. package/dist/src/gates/gate-classes.d.ts +56 -0
  80. package/dist/src/gates/gate-classes.js +633 -0
  81. package/dist/src/gates/manifest.d.ts +99 -0
  82. package/dist/src/gates/manifest.js +208 -0
  83. package/dist/src/gates/merge-preconditions.d.ts +319 -0
  84. package/dist/src/gates/merge-preconditions.js +932 -0
  85. package/dist/src/gates/migrations.d.ts +1 -0
  86. package/dist/src/gates/migrations.js +36 -0
  87. package/dist/src/gates/pin.d.ts +114 -0
  88. package/dist/src/gates/pin.js +154 -0
  89. package/dist/src/gates/red-witness.d.ts +22 -0
  90. package/dist/src/gates/red-witness.js +482 -0
  91. package/dist/src/gates/release.d.ts +283 -0
  92. package/dist/src/gates/release.js +820 -0
  93. package/dist/src/gates/result.d.ts +116 -0
  94. package/dist/src/gates/result.js +91 -0
  95. package/dist/src/gates/run.d.ts +614 -0
  96. package/dist/src/gates/run.js +1614 -0
  97. package/dist/src/gates/schemas/citation-config.schema.json +59 -0
  98. package/dist/src/gates/schemas/coverage-config.schema.json +77 -0
  99. package/dist/src/gates/schemas/gate-manifest.schema.json +125 -0
  100. package/dist/src/gates/schemas/gate-result.schema.json +160 -0
  101. package/dist/src/gates/schemas/phase-declaration.schema.json +87 -0
  102. package/dist/src/gates/schemas/release-record.schema.json +119 -0
  103. package/dist/src/gates/schemas/verifier-config.schema.json +101 -0
  104. package/dist/src/gates/schemas/witness-spec.schema.json +110 -0
  105. package/dist/src/gates/scope.d.ts +131 -0
  106. package/dist/src/gates/scope.js +1018 -0
  107. package/dist/src/gates/suite.d.ts +217 -0
  108. package/dist/src/gates/suite.js +968 -0
  109. package/dist/src/gates/validate.d.ts +121 -0
  110. package/dist/src/gates/validate.js +414 -0
  111. package/dist/src/hooks.d.ts +84 -0
  112. package/dist/src/hooks.js +125 -0
  113. package/dist/src/index.d.ts +31 -0
  114. package/dist/src/index.js +30 -0
  115. package/dist/src/liveness.d.ts +321 -0
  116. package/dist/src/liveness.js +396 -0
  117. package/dist/src/lock.d.ts +256 -0
  118. package/dist/src/lock.js +792 -0
  119. package/dist/src/model-resolution.d.ts +159 -0
  120. package/dist/src/model-resolution.js +307 -0
  121. package/dist/src/modes.d.ts +149 -0
  122. package/dist/src/modes.js +258 -0
  123. package/dist/src/path-identity.d.ts +34 -0
  124. package/dist/src/path-identity.js +48 -0
  125. package/dist/src/plan.d.ts +73 -0
  126. package/dist/src/plan.js +153 -0
  127. package/dist/src/pool.d.ts +326 -0
  128. package/dist/src/pool.js +988 -0
  129. package/dist/src/roles.d.ts +461 -0
  130. package/dist/src/roles.js +776 -0
  131. package/dist/src/spawn.d.ts +482 -0
  132. package/dist/src/spawn.js +1003 -0
  133. package/dist/src/status.d.ts +116 -0
  134. package/dist/src/status.js +148 -0
  135. package/dist/src/task.d.ts +504 -0
  136. package/dist/src/task.js +307 -0
  137. package/dist/src/teardown.d.ts +39 -0
  138. package/dist/src/teardown.js +422 -0
  139. package/dist/src/tuition.d.ts +159 -0
  140. package/dist/src/tuition.js +311 -0
  141. package/dist/src/validate.d.ts +263 -0
  142. package/dist/src/validate.js +742 -0
  143. package/dist/src/version.d.ts +3 -0
  144. package/dist/src/version.js +38 -0
  145. package/dist/src/watcher.d.ts +275 -0
  146. package/dist/src/watcher.js +849 -0
  147. package/dist/src/witness/run.d.ts +299 -0
  148. package/dist/src/witness/run.js +1373 -0
  149. package/dist/src/witness/spec.d.ts +270 -0
  150. package/dist/src/witness/spec.js +475 -0
  151. package/dist/tsconfig.src.tsbuildinfo +1 -0
  152. package/gate-registry.yaml +526 -0
  153. package/gates.manifest.json +257 -0
  154. package/package.json +72 -3
  155. package/role-model-config.yaml +88 -0
  156. package/roles/README.md +128 -0
  157. package/roles/_shared-dispatch-contract.md +87 -0
  158. package/roles/adversarial-plan-reviewer.md +80 -0
  159. package/roles/clean-room-reviewer.md +140 -0
  160. package/roles/implementer.md +463 -0
  161. package/roles/investigator.md +138 -0
  162. package/roles/plan-writer.md +95 -0
  163. package/schemas/README.md +82 -0
  164. package/schemas/assurance-modes.schema.json +264 -0
  165. package/schemas/charter.schema.json +185 -0
  166. package/schemas/checklist.schema.json +114 -0
  167. package/schemas/cutover-state.schema.json +64 -0
  168. package/schemas/decision-record.schema.json +88 -0
  169. package/schemas/executor-record.schema.json +36 -0
  170. package/schemas/final-report.schema.json +90 -0
  171. package/schemas/finding.schema.json +106 -0
  172. package/schemas/gate-registry.schema.json +260 -0
  173. package/schemas/mechanism-index.schema.json +94 -0
  174. package/schemas/model-resolution.schema.json +362 -0
  175. package/schemas/plan.schema.json +300 -0
  176. package/schemas/report.schema.json +579 -0
  177. package/schemas/role-brief.schema.json +105 -0
  178. package/schemas/role-model-config.schema.json +90 -0
  179. package/schemas/status-line.schema.json +40 -0
  180. package/schemas/tuition.schema.json +191 -0
  181. package/schemas/verdict.schema.json +295 -0
  182. package/schemas/work-history.schema.json +183 -0
  183. package/schemas/write-bypass.schema.json +69 -0
  184. package/templates/charter.example.yaml +54 -0
  185. package/templates/decision-record.example.yaml +27 -0
  186. package/templates/final-report.example.yaml +80 -0
  187. package/templates/plan.example.yaml +87 -0
  188. package/templates/report.example.yaml +236 -0
  189. package/templates/warnings.md +74 -0
  190. package/templates/work-history.example.yaml +185 -0
  191. package/tuition/README.md +76 -0
  192. package/tuition/T-001.yaml +48 -0
  193. package/tuition/T-002.yaml +51 -0
  194. package/tuition/T-003.yaml +100 -0
  195. package/tuition/T-004.yaml +52 -0
  196. package/tuition/T-005.yaml +72 -0
  197. package/tuition/T-006.yaml +81 -0
  198. package/tuition/T-007.yaml +56 -0
  199. package/tuition/T-008.yaml +111 -0
  200. package/tuition/T-009.yaml +50 -0
  201. package/tuition/T-015.yaml +36 -0
  202. package/tuition/T-016.yaml +36 -0
  203. package/tuition/T-017.yaml +46 -0
  204. package/tuition/T-018.yaml +84 -0
  205. package/tuition/T-021.yaml +40 -0
  206. package/tuition/T-022.yaml +36 -0
  207. package/tuition/mechanism-index.yaml +256 -0
@@ -0,0 +1,218 @@
1
+ /**
2
+ * `tiphys tuition add|list|index` (kernel plan M3, M3-P8 steps 2 and 6;
3
+ * R-091).
4
+ *
5
+ * add --file <entry> [--into <dir>] validate an entry and file it
6
+ * list [--kernel-relevant] [--dir <d>] one line per entry
7
+ * index [--out <f>] [--check] [--dir <d>] project the mechanism index
8
+ *
9
+ * PROMOTION IS NOT A SUBCOMMAND, and that is a decision rather than an
10
+ * omission. R-091 says kernel-relevant tuition ships upstream as a kernel pull
11
+ * request; the kernel never opens pull requests, so promotion is a documented
12
+ * orchestrator procedure (M3-P9's `AGENTS.md`) and building a promoter that M3
13
+ * would use once is the M1-P3 mistake.
14
+ *
15
+ * `add` WRITES WITH AN EXCLUSIVE CREATE, so a second entry claiming an id that
16
+ * already exists fails loudly and names the file rather than overwriting a
17
+ * record. A `T-nnn` id is never renumbered and never reused after retirement,
18
+ * which makes an overwrite a silent loss of exactly the artifact this feed
19
+ * exists to keep.
20
+ */
21
+ import { mkdirSync, writeFileSync } from "node:fs";
22
+ import { basename, join } from "node:path";
23
+ import { EX_USAGE } from "../cli.js";
24
+ import { refuseOpenForWrite } from "../task.js";
25
+ import { decodeDocument, readOperatorPath } from "../validate.js";
26
+ import { MECHANISM_INDEX_FILE, driftLines, listEntryFiles, loadEntry, projectIndex, renderIndex, } from "../tuition.js";
27
+ const USAGE = "usage: tiphys tuition add --file <entry> [--into <dir>] | " +
28
+ "tiphys tuition list [--kernel-relevant] [--dir <dir>] | " +
29
+ "tiphys tuition index [--out <file>] [--check] [--dir <dir>]";
30
+ function parseArgs(argv) {
31
+ const options = { check: false, kernelRelevant: false };
32
+ const valued = new Map([
33
+ ["--file", "file"],
34
+ ["--into", "into"],
35
+ ["--dir", "dir"],
36
+ ["--out", "out"],
37
+ ]);
38
+ for (let index = 0; index < argv.length; index += 1) {
39
+ const argument = argv[index];
40
+ if (argument === "--check") {
41
+ options.check = true;
42
+ continue;
43
+ }
44
+ if (argument === "--kernel-relevant") {
45
+ options.kernelRelevant = true;
46
+ continue;
47
+ }
48
+ const field = valued.get(argument);
49
+ if (field === undefined) {
50
+ return { usageError: `unknown option ${argument}` };
51
+ }
52
+ const value = argv[index + 1];
53
+ if (value === undefined || value.startsWith("--")) {
54
+ return { usageError: `${argument} requires a value` };
55
+ }
56
+ options[field] = value;
57
+ index += 1;
58
+ }
59
+ return { options };
60
+ }
61
+ /** The feed directory a subcommand works in: `--dir`, else `<cwd>/tuition`. */
62
+ function feedDirectory(options) {
63
+ return options.dir ?? join(process.cwd(), "tuition");
64
+ }
65
+ /** Load every entry in the feed, reporting the first that does not validate. */
66
+ function loadFeed(directory) {
67
+ const listing = listEntryFiles(directory);
68
+ if (!listing.ok) {
69
+ process.stderr.write(`tiphys tuition: ${listing.reason}\n`);
70
+ return { ok: false };
71
+ }
72
+ const entries = [];
73
+ let failed = false;
74
+ for (const path of listing.paths) {
75
+ const loaded = loadEntry(path);
76
+ if (!loaded.ok) {
77
+ process.stderr.write(`tiphys tuition: ${loaded.reason}\n`);
78
+ for (const line of loaded.diagnostics) {
79
+ process.stdout.write(`${line}\n`);
80
+ }
81
+ failed = true;
82
+ continue;
83
+ }
84
+ entries.push(loaded.entry);
85
+ }
86
+ return failed ? { ok: false } : { ok: true, entries };
87
+ }
88
+ function cmdAdd(options) {
89
+ if (options.file === undefined) {
90
+ process.stderr.write(`tiphys tuition: --file is required\n${USAGE}\n`);
91
+ return EX_USAGE;
92
+ }
93
+ /* VALIDATE FIRST, WRITE SECOND. An invalid entry must leave the feed
94
+ directory byte-identical, which is criterion 7's own test. */
95
+ const loaded = loadEntry(options.file);
96
+ if (!loaded.ok) {
97
+ process.stderr.write(`tiphys tuition: ${loaded.reason}\n`);
98
+ for (const line of loaded.diagnostics) {
99
+ process.stdout.write(`${line}\n`);
100
+ }
101
+ return 1;
102
+ }
103
+ const directory = options.into ?? join(process.cwd(), "tuition");
104
+ const target = join(directory, `${loaded.entry.id}.yaml`);
105
+ const refusal = refuseOpenForWrite(target);
106
+ if (refusal !== undefined) {
107
+ process.stderr.write(`tiphys tuition: ${refusal}\n`);
108
+ return 1;
109
+ }
110
+ try {
111
+ mkdirSync(directory, { recursive: true });
112
+ /* EXCLUSIVE CREATE: an id already in the feed is a loud refusal, never an
113
+ overwrite. Ids are never reused, so the collision is the fault. */
114
+ writeFileSync(target, loaded.body, { flag: "wx" });
115
+ }
116
+ catch (error) {
117
+ const code = error.code;
118
+ process.stderr.write(code === "EEXIST"
119
+ ? `tiphys tuition: ${target} already exists, and a tuition id is never reused\n`
120
+ : `tiphys tuition: ${target} could not be written: ${String(error)}\n`);
121
+ return 1;
122
+ }
123
+ process.stdout.write(`added ${loaded.entry.id} to ${target}\n`);
124
+ return 0;
125
+ }
126
+ function cmdList(options) {
127
+ const feed = loadFeed(feedDirectory(options));
128
+ if (!feed.ok) {
129
+ return 1;
130
+ }
131
+ for (const entry of feed.entries) {
132
+ if (options.kernelRelevant && !entry["kernel-relevant"]) {
133
+ continue;
134
+ }
135
+ const targets = entry["structural-consequence"]?.length ?? 0;
136
+ process.stdout.write(`${entry.id} ${entry.date} targets=${String(targets)}\n`);
137
+ }
138
+ return 0;
139
+ }
140
+ function cmdIndex(options) {
141
+ const directory = feedDirectory(options);
142
+ const feed = loadFeed(directory);
143
+ if (!feed.ok) {
144
+ return 1;
145
+ }
146
+ const projection = projectIndex(feed.entries);
147
+ if (!projection.ok) {
148
+ process.stderr.write(`tiphys tuition: ${projection.reason}\n`);
149
+ return 1;
150
+ }
151
+ const rendered = renderIndex(projection.rows);
152
+ const out = options.out ?? join(directory, MECHANISM_INDEX_FILE);
153
+ if (options.check) {
154
+ const read = readOperatorPath(out);
155
+ if (!read.ok) {
156
+ process.stderr.write(`tiphys tuition: ${read.reason}\n`);
157
+ return 1;
158
+ }
159
+ const decoded = decodeDocument(read.body, out);
160
+ if (!decoded.ok) {
161
+ process.stderr.write(`tiphys tuition: ${decoded.reason}\n`);
162
+ return 1;
163
+ }
164
+ const problems = driftLines(decoded.value, projection.rows);
165
+ for (const problem of problems) {
166
+ process.stdout.write(`DRIFT ${problem}\n`);
167
+ }
168
+ if (problems.length > 0) {
169
+ process.stderr.write(`tiphys tuition: ${basename(out)} is not the projection of the feed in ${directory}\n`);
170
+ return 1;
171
+ }
172
+ /* THE BYTE COMPARISON IS SEPARATE AND SECOND. The structural diff above
173
+ names WHICH mechanism drifted, which a byte comparison cannot; this
174
+ catches a hand edit that changed nothing a reader of the decoded
175
+ document would see (a reordering, a rewrap, an added comment) and says
176
+ so in those words rather than claiming a rule changed. */
177
+ if (read.body !== rendered) {
178
+ process.stdout.write(`DRIFT ${out} decodes to the projection and its bytes differ from it, so it has been hand-edited\n`);
179
+ process.stderr.write(`tiphys tuition: ${basename(out)} is generated; regenerate it with tiphys tuition index\n`);
180
+ return 1;
181
+ }
182
+ process.stdout.write(`${String(projection.rows.length)} mechanism(s) projected from ${String(feed.entries.length)} entr(ies); the committed index matches\n`);
183
+ return 0;
184
+ }
185
+ const refusal = refuseOpenForWrite(out);
186
+ if (refusal !== undefined) {
187
+ process.stderr.write(`tiphys tuition: ${refusal}\n`);
188
+ return 1;
189
+ }
190
+ try {
191
+ writeFileSync(out, rendered);
192
+ }
193
+ catch (error) {
194
+ process.stderr.write(`tiphys tuition: ${out} could not be written: ${String(error)}\n`);
195
+ return 1;
196
+ }
197
+ process.stdout.write(`wrote ${String(projection.rows.length)} mechanism(s) from ${String(feed.entries.length)} entr(ies) to ${out}\n`);
198
+ return 0;
199
+ }
200
+ export function cmdTuition(argv) {
201
+ const [subcommand, ...rest] = argv;
202
+ const parsed = parseArgs(rest);
203
+ if (parsed.options === undefined) {
204
+ process.stderr.write(`tiphys tuition: ${parsed.usageError ?? "usage error"}\n${USAGE}\n`);
205
+ return EX_USAGE;
206
+ }
207
+ if (subcommand === "add") {
208
+ return cmdAdd(parsed.options);
209
+ }
210
+ if (subcommand === "list") {
211
+ return cmdList(parsed.options);
212
+ }
213
+ if (subcommand === "index") {
214
+ return cmdIndex(parsed.options);
215
+ }
216
+ process.stderr.write(`tiphys tuition: ${subcommand === undefined ? "a subcommand is required" : `unknown subcommand ${subcommand}`}\n${USAGE}\n`);
217
+ return EX_USAGE;
218
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * `tiphys validate --type <t> [--context <dir>] <file>` (kernel plan M3,
3
+ * M3-P1 step 8).
4
+ *
5
+ * Exit codes:
6
+ * 0 the instance passed schema validation and every derived check
7
+ * 1 at least one violation, or a derived check that could not run
8
+ * 64 usage error (BSD sysexits EX_USAGE), including `--type auto` on an
9
+ * instance with no `kind` field
10
+ *
11
+ * TWO STAGES, NEVER CONFLATED (DR-0013 YAML clause 3). The file is DECODED
12
+ * first and the decoded value is VALIDATED second. A decode failure names the
13
+ * decode; a validation failure names the pointer. Neither produces a stack
14
+ * trace on any stream, which is step 8b's policy applied at the site that
15
+ * needs it most: this command's ordinary input is a hand-authored file that
16
+ * will routinely be malformed, and a validator that answers malformed YAML
17
+ * with a stack trace is a validator nobody trusts.
18
+ *
19
+ * THE PATH IS OPERATOR-SUPPLIED (D-M3-27). It is classified before it is
20
+ * opened, so a named pipe is refused with the observed entry type instead of
21
+ * blocking this command forever. Same for the `--context` directory. This is
22
+ * the M1-P5 class (CR-520, twelve paths, four fix rounds) applied to the
23
+ * first kernel command whose ordinary input is a path an operator wrote.
24
+ */
25
+ import type { SchemaDocument } from "../validate.ts";
26
+ /** Exit code for usage errors, per BSD sysexits EX_USAGE. */
27
+ export declare const EX_USAGE = 64;
28
+ /**
29
+ * The artifact types this milestone's validator knows, and the schema
30
+ * document each resolves to.
31
+ *
32
+ * REGISTERED HERE, EXTENDED BY EVERY LATER PHASE (M3R-001). A phase that
33
+ * introduces an artifact type adds its row here and to the `auto` resolver in
34
+ * the same step, so a type whose schema ships but which `--type` cannot name
35
+ * is not a state this command can be in.
36
+ */
37
+ export declare const TYPE_TABLE: ReadonlyMap<string, string>;
38
+ /**
39
+ * COMPANION SCHEMAS, declared beside the type table (M3-P4 step 3).
40
+ *
41
+ * A type listed here is compiled with the named sibling documents registered
42
+ * alongside it, so a `$ref` that leaves the document resolves. THE SET IS
43
+ * DECLARED, NOT DISCOVERED: `src/validate.ts` never reads a reference and
44
+ * fetches what it names, so a `$ref` to a document absent from this table
45
+ * still fails compilation with `unresolvedRef`. That is the property DR-0013
46
+ * clause 4 protects, kept while letting two artifact types share ONE
47
+ * definition of the honesty contract instead of two that can drift.
48
+ *
49
+ * The reference in `work-history.schema.json` is RELATIVE
50
+ * (`report.schema.json#/$defs/claim`), so it resolves against that document's
51
+ * `$id` to `https://tiphys.dev/schemas/report.schema.json`, which is exactly
52
+ * the companion's own `$id`.
53
+ */
54
+ export declare const COMPANION_TABLE: ReadonlyMap<string, readonly string[]>;
55
+ /** The companion schema documents a type is compiled with, in declared order. */
56
+ export declare function companionsFor(type: string): SchemaDocument[];
57
+ /**
58
+ * Locate the shipped `schemas/` directory by walking UP from this module.
59
+ *
60
+ * The depth differs between the two layouts this code runs in: from source it
61
+ * is `src/commands/` and the directory is two levels up, and from the built
62
+ * entry it is `dist/src/commands/` and the directory is three levels up
63
+ * beside the package root. Counting `..` would therefore be right in exactly
64
+ * one of them, which is the kind of silent, layout-dependent break M2's own
65
+ * schema resolution comment warns about. Walking up and TESTING for the
66
+ * directory is right in both, and in a relocated copy as well.
67
+ */
68
+ export declare function schemasDirectory(): string;
69
+ /** Read and decode a shipped schema document. */
70
+ export declare function loadTypeSchema(type: string): SchemaDocument;
71
+ /**
72
+ * Resolve `--type auto` from the instance's `kind` field. An instance with no
73
+ * `kind`, or with a `kind` no schema is registered for, is a USAGE error: the
74
+ * caller asked the command to work out which contract applies and it cannot,
75
+ * which is not the same as the document failing that contract.
76
+ */
77
+ export declare function resolveAutoType(instance: unknown): string | undefined;
78
+ export declare function cmdValidate(argv: string[]): number;