paperlint 10.2.0 → 10.4.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 (147) hide show
  1. package/.github/workflows/ci.yml +15 -4
  2. package/README.md +1 -0
  3. package/dist/adapters/git/index.d.ts +10 -0
  4. package/dist/adapters/git/index.d.ts.map +1 -0
  5. package/dist/adapters/git/index.js +151 -0
  6. package/dist/adapters/git/index.js.map +1 -0
  7. package/dist/adapters/memory/index.d.ts +6 -0
  8. package/dist/adapters/memory/index.d.ts.map +1 -1
  9. package/dist/adapters/memory/index.js +8 -0
  10. package/dist/adapters/memory/index.js.map +1 -1
  11. package/dist/adapters/node/index.d.ts +1 -0
  12. package/dist/adapters/node/index.d.ts.map +1 -1
  13. package/dist/adapters/node/index.js +1 -0
  14. package/dist/adapters/node/index.js.map +1 -1
  15. package/dist/adapters/node/list-entries.io.d.ts +3 -0
  16. package/dist/adapters/node/list-entries.io.d.ts.map +1 -0
  17. package/dist/adapters/node/list-entries.io.js +24 -0
  18. package/dist/adapters/node/list-entries.io.js.map +1 -0
  19. package/dist/adapters/study-registry/index.d.ts +412 -1
  20. package/dist/adapters/study-registry/index.d.ts.map +1 -1
  21. package/dist/adapters/study-registry/index.js +245 -8
  22. package/dist/adapters/study-registry/index.js.map +1 -1
  23. package/dist/cli.d.ts.map +1 -1
  24. package/dist/cli.js +38 -6
  25. package/dist/cli.js.map +1 -1
  26. package/dist/domain/decide-first.d.ts +100 -0
  27. package/dist/domain/decide-first.d.ts.map +1 -0
  28. package/dist/domain/decide-first.js +102 -0
  29. package/dist/domain/decide-first.js.map +1 -0
  30. package/dist/domain/index-columns.d.ts +45 -0
  31. package/dist/domain/index-columns.d.ts.map +1 -0
  32. package/dist/domain/index-columns.js +62 -0
  33. package/dist/domain/index-columns.js.map +1 -0
  34. package/dist/domain/study-mode.d.ts +37 -0
  35. package/dist/domain/study-mode.d.ts.map +1 -0
  36. package/dist/domain/study-mode.js +45 -0
  37. package/dist/domain/study-mode.js.map +1 -0
  38. package/dist/domain/study-registry.d.ts +253 -10
  39. package/dist/domain/study-registry.d.ts.map +1 -1
  40. package/dist/domain/study-registry.js +325 -27
  41. package/dist/domain/study-registry.js.map +1 -1
  42. package/dist/outputs-before-decision-rule.d.ts +17 -0
  43. package/dist/outputs-before-decision-rule.d.ts.map +1 -0
  44. package/dist/outputs-before-decision-rule.js +90 -0
  45. package/dist/outputs-before-decision-rule.js.map +1 -0
  46. package/dist/ports/git-history.d.ts +44 -0
  47. package/dist/ports/git-history.d.ts.map +1 -0
  48. package/dist/ports/git-history.js +2 -0
  49. package/dist/ports/git-history.js.map +1 -0
  50. package/dist/ports/list-entries.d.ts +17 -0
  51. package/dist/ports/list-entries.d.ts.map +1 -0
  52. package/dist/ports/list-entries.js +2 -0
  53. package/dist/ports/list-entries.js.map +1 -0
  54. package/dist/ports/study-registry-codec.d.ts +9 -2
  55. package/dist/ports/study-registry-codec.d.ts.map +1 -1
  56. package/dist/studies.d.ts +4 -0
  57. package/dist/studies.d.ts.map +1 -1
  58. package/dist/studies.js +55 -24
  59. package/dist/studies.js.map +1 -1
  60. package/dist/study-gate.d.ts +14 -0
  61. package/dist/study-gate.d.ts.map +1 -0
  62. package/dist/study-gate.js +95 -0
  63. package/dist/study-gate.js.map +1 -0
  64. package/dist/study-index-input.d.ts +5 -0
  65. package/dist/study-index-input.d.ts.map +1 -0
  66. package/dist/study-index-input.js +13 -0
  67. package/dist/study-index-input.js.map +1 -0
  68. package/dist/study-modes.d.ts +45 -0
  69. package/dist/study-modes.d.ts.map +1 -0
  70. package/dist/study-modes.js +70 -0
  71. package/dist/study-modes.js.map +1 -0
  72. package/dist/study-registry-rule.d.ts +29 -6
  73. package/dist/study-registry-rule.d.ts.map +1 -1
  74. package/dist/study-registry-rule.js +91 -40
  75. package/dist/study-registry-rule.js.map +1 -1
  76. package/dist/study-run.d.ts +19 -0
  77. package/dist/study-run.d.ts.map +1 -0
  78. package/dist/study-run.js +9 -0
  79. package/dist/study-run.js.map +1 -0
  80. package/docs/design/study-modes.md +247 -0
  81. package/docs/design/study-registry.md +137 -15
  82. package/docs/e2e.md +8 -4
  83. package/docs/layout.md +26 -21
  84. package/docs/rules/repro/outputs-before-decision.md +119 -0
  85. package/docs/rules/repro/study-plan-name.md +70 -0
  86. package/docs/rules/repro/study-registered.md +206 -15
  87. package/docs/rules.md +54 -52
  88. package/docs/testing.md +1 -0
  89. package/package.json +2 -1
  90. package/scripts/check.ts +6 -0
  91. package/skills/build-benchmark/SKILL.md +24 -12
  92. package/skills/build-benchmark/SKILL.md.spec.ts +23 -11
  93. package/skills/build-label-page/SKILL.md +9 -7
  94. package/skills/build-label-page/SKILL.md.spec.ts +8 -6
  95. package/skills/camera-ready/SKILL.md +6 -1
  96. package/skills/camera-ready/SKILL.md.spec.ts +5 -0
  97. package/skills/draft-paper/SKILL.md +11 -3
  98. package/skills/draft-paper/SKILL.md.spec.ts +10 -2
  99. package/skills/harden-paper/SKILL.md +12 -2
  100. package/skills/harden-paper/SKILL.md.spec.ts +11 -1
  101. package/skills/osf-artifact-upload/SKILL.md +7 -1
  102. package/skills/osf-artifact-upload/SKILL.md.spec.ts +6 -0
  103. package/skills/pc-panel-review/SKILL.md +10 -3
  104. package/skills/pc-panel-review/SKILL.md.spec.ts +9 -2
  105. package/skills/run-agent-grid/SKILL.md +10 -5
  106. package/skills/run-agent-grid/SKILL.md.spec.ts +9 -4
  107. package/skills/tighten-paper/SKILL.md +5 -1
  108. package/skills/tighten-paper/SKILL.md.spec.ts +4 -0
  109. package/src/adapters/git/history.test.ts +121 -0
  110. package/src/adapters/git/index.test.ts +268 -0
  111. package/src/adapters/git/index.ts +227 -0
  112. package/src/adapters/memory/index.test.ts +15 -1
  113. package/src/adapters/memory/index.ts +13 -0
  114. package/src/adapters/node/index.ts +1 -0
  115. package/src/adapters/node/list-entries.io.ts +26 -0
  116. package/src/adapters/node/list-entries.test.ts +43 -0
  117. package/src/adapters/study-registry/index.test.ts +343 -0
  118. package/src/adapters/study-registry/index.ts +374 -10
  119. package/src/adapters/study-registry/mode.test.ts +162 -0
  120. package/src/cli.ts +52 -6
  121. package/src/domain/decide-first.test.ts +258 -0
  122. package/src/domain/decide-first.ts +243 -0
  123. package/src/domain/index-columns.test.ts +216 -0
  124. package/src/domain/index-columns.ts +105 -0
  125. package/src/domain/study-measurements.test.ts +633 -0
  126. package/src/domain/study-mode.test.ts +55 -0
  127. package/src/domain/study-mode.ts +78 -0
  128. package/src/domain/study-registry.test.ts +48 -32
  129. package/src/domain/study-registry.ts +621 -36
  130. package/src/new-paper.test.ts +6 -1
  131. package/src/outputs-before-decision-rule.test.ts +206 -0
  132. package/src/outputs-before-decision-rule.ts +124 -0
  133. package/src/ports/git-history.ts +44 -0
  134. package/src/ports/list-entries.ts +18 -0
  135. package/src/ports/study-registry-codec.ts +13 -2
  136. package/src/rule-cases.test.ts +103 -1
  137. package/src/studies-cli.test.ts +2 -2
  138. package/src/studies-index-modes.test.ts +129 -0
  139. package/src/studies.test.ts +39 -9
  140. package/src/studies.ts +99 -29
  141. package/src/study-gate.test.ts +316 -0
  142. package/src/study-gate.ts +161 -0
  143. package/src/study-index-input.ts +23 -0
  144. package/src/study-modes.ts +120 -0
  145. package/src/study-registry-rule.test.ts +333 -7
  146. package/src/study-registry-rule.ts +145 -41
  147. package/src/study-run.ts +21 -0
@@ -1,6 +1,417 @@
1
- import { type ParsedRegistry } from "../../domain/study-registry.ts";
1
+ /**
2
+ * The schema of `repro/studies.json` — the one place its shape is checked (docs/design/study-registry.md).
3
+ * The text is parsed once, here, into the domain's `StudyRegistry`; whatever reads a registry after it
4
+ * never re-validates.
5
+ *
6
+ * A row is a loose object: a paper merges its own measurement metadata into its rows (`role`, `frame`,
7
+ * `rules_under_test`, `outcome` …), and those fields are kept as they are. The top level is strict, so
8
+ * a misspelt key is an error rather than a key nobody reads. A measurement keeps its extra fields as a
9
+ * row does; a requirement and an approval are exactly their fields.
10
+ *
11
+ * A study's plan (`plan.json`) is parsed here too, strictly: a key of the paper's own goes in `extra`.
12
+ * Its texts may be empty — the template's are — and the parser says which: a plan comes out ready or
13
+ * a draft naming its empty texts, so nothing downstream looks at a text again. A plan still named
14
+ * `prereg.json` has a loose schema of its own.
15
+ *
16
+ * A plan's `mode` (docs/design/study-modes.md) is parsed here too, strictly, a union on its `kind`:
17
+ * one mode at most, a glob that leaves the study's folder or a decision outside the paper refused,
18
+ * and a measurement's plan ready only with a mode.
19
+ */
20
+ import { z } from "zod";
21
+ import { type Approval, type AuthorCheck, type Measurement, type ParsedPlan, type ParsedRegistry, type Requirement, type Study, type PlanTextField, type StudyKind, type StudyPlan, type StudyRegistry } from "../../domain/study-registry.ts";
22
+ import { type Decision, type StudyMode } from "../../domain/study-mode.ts";
2
23
  import type { StudyRegistryCodec } from "../../ports/study-registry-codec.ts";
24
+ declare const study: z.ZodObject<{
25
+ id: z.ZodString;
26
+ folder: z.ZodString;
27
+ title: z.ZodString;
28
+ question: z.ZodString;
29
+ kind: z.ZodEnum<{
30
+ data: "data";
31
+ artifact: "artifact";
32
+ measurement: "measurement";
33
+ spike: "spike";
34
+ tooling: "tooling";
35
+ salvage: "salvage";
36
+ }>;
37
+ status: z.ZodEnum<{
38
+ done: "done";
39
+ designing: "designing";
40
+ running: "running";
41
+ stopped: "stopped";
42
+ superseded: "superseded";
43
+ dropped: "dropped";
44
+ }>;
45
+ date: z.ZodISODate;
46
+ result: z.ZodOptional<z.ZodString>;
47
+ result_file: z.ZodOptional<z.ZodString>;
48
+ superseded_by: z.ZodOptional<z.ZodString>;
49
+ in_paper: z.ZodEnum<{
50
+ yes: "yes";
51
+ no: "no";
52
+ registry: "registry";
53
+ }>;
54
+ measurement: z.ZodOptional<z.ZodString>;
55
+ plan: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$loose>;
57
+ declare const requirement: z.ZodObject<{
58
+ id: z.ZodString;
59
+ text: z.ZodString;
60
+ date: z.ZodISODate;
61
+ source: z.ZodString;
62
+ }, z.core.$strict>;
63
+ declare const approval: z.ZodObject<{
64
+ by: z.ZodString;
65
+ date: z.ZodISODate;
66
+ quote: z.ZodString;
67
+ source: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$strict>;
69
+ declare const measurement: z.ZodObject<{
70
+ id: z.ZodString;
71
+ title: z.ZodString;
72
+ rq: z.ZodOptional<z.ZodString>;
73
+ role: z.ZodEnum<{
74
+ baseline: "baseline";
75
+ headline: "headline";
76
+ }>;
77
+ approval: z.ZodOptional<z.ZodObject<{
78
+ by: z.ZodString;
79
+ date: z.ZodISODate;
80
+ quote: z.ZodString;
81
+ source: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strict>>;
83
+ requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
84
+ }, z.core.$loose>;
85
+ declare const registry: z.ZodObject<{
86
+ prefix: z.ZodString;
87
+ author: z.ZodOptional<z.ZodString>;
88
+ requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
89
+ id: z.ZodString;
90
+ text: z.ZodString;
91
+ date: z.ZodISODate;
92
+ source: z.ZodString;
93
+ }, z.core.$strict>>>;
94
+ measurements: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
+ id: z.ZodString;
96
+ title: z.ZodString;
97
+ rq: z.ZodOptional<z.ZodString>;
98
+ role: z.ZodEnum<{
99
+ baseline: "baseline";
100
+ headline: "headline";
101
+ }>;
102
+ approval: z.ZodOptional<z.ZodObject<{
103
+ by: z.ZodString;
104
+ date: z.ZodISODate;
105
+ quote: z.ZodString;
106
+ source: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strict>>;
108
+ requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ }, z.core.$loose>>>;
110
+ studies: z.ZodArray<z.ZodObject<{
111
+ id: z.ZodString;
112
+ folder: z.ZodString;
113
+ title: z.ZodString;
114
+ question: z.ZodString;
115
+ kind: z.ZodEnum<{
116
+ data: "data";
117
+ artifact: "artifact";
118
+ measurement: "measurement";
119
+ spike: "spike";
120
+ tooling: "tooling";
121
+ salvage: "salvage";
122
+ }>;
123
+ status: z.ZodEnum<{
124
+ done: "done";
125
+ designing: "designing";
126
+ running: "running";
127
+ stopped: "stopped";
128
+ superseded: "superseded";
129
+ dropped: "dropped";
130
+ }>;
131
+ date: z.ZodISODate;
132
+ result: z.ZodOptional<z.ZodString>;
133
+ result_file: z.ZodOptional<z.ZodString>;
134
+ superseded_by: z.ZodOptional<z.ZodString>;
135
+ in_paper: z.ZodEnum<{
136
+ yes: "yes";
137
+ no: "no";
138
+ registry: "registry";
139
+ }>;
140
+ measurement: z.ZodOptional<z.ZodString>;
141
+ plan: z.ZodOptional<z.ZodString>;
142
+ }, z.core.$loose>>;
143
+ }, z.core.$strict>;
144
+ declare const authorCheck: z.ZodObject<{
145
+ by: z.ZodString;
146
+ date: z.ZodISODate;
147
+ quote: z.ZodString;
148
+ }, z.core.$strict>;
149
+ declare const decisionShape: z.ZodObject<{
150
+ file: z.ZodString;
151
+ note: z.ZodString;
152
+ }, z.core.$strict>;
153
+ /** How the outcomes are kept from the decisions: exactly one mode, by its `kind`. */
154
+ declare const mode: z.ZodDiscriminatedUnion<[z.ZodObject<{
155
+ kind: z.ZodLiteral<"decide_before_run">;
156
+ outputs: z.ZodArray<z.ZodString>;
157
+ decision: z.ZodObject<{
158
+ file: z.ZodString;
159
+ note: z.ZodString;
160
+ }, z.core.$strict>;
161
+ }, z.core.$strict>, z.ZodObject<{
162
+ kind: z.ZodLiteral<"exploratory">;
163
+ reason: z.ZodString;
164
+ }, z.core.$strict>], "kind">;
165
+ /** A plan's shape: closed at every level; the paper's own keys go in `extra`. Null is the one "none". */
166
+ declare const planShape: z.ZodObject<{
167
+ question: z.ZodString;
168
+ population: z.ZodObject<{
169
+ source: z.ZodString;
170
+ draw: z.ZodDiscriminatedUnion<[z.ZodObject<{
171
+ kind: z.ZodLiteral<"seeded">;
172
+ method: z.ZodString;
173
+ seed: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
174
+ }, z.core.$strict>, z.ZodObject<{
175
+ kind: z.ZodLiteral<"all">;
176
+ method: z.ZodString;
177
+ }, z.core.$strict>], "kind">;
178
+ }, z.core.$strict>;
179
+ arms: z.ZodArray<z.ZodObject<{
180
+ name: z.ZodString;
181
+ }, z.core.$strict>>;
182
+ primary_outcome: z.ZodString;
183
+ author_check: z.ZodNullable<z.ZodObject<{
184
+ by: z.ZodString;
185
+ date: z.ZodISODate;
186
+ quote: z.ZodString;
187
+ }, z.core.$strict>>;
188
+ extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
189
+ mode: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
190
+ kind: z.ZodLiteral<"decide_before_run">;
191
+ outputs: z.ZodArray<z.ZodString>;
192
+ decision: z.ZodObject<{
193
+ file: z.ZodString;
194
+ note: z.ZodString;
195
+ }, z.core.$strict>;
196
+ }, z.core.$strict>, z.ZodObject<{
197
+ kind: z.ZodLiteral<"exploratory">;
198
+ reason: z.ZodString;
199
+ }, z.core.$strict>], "kind">>;
200
+ }, z.core.$strict>;
201
+ /**
202
+ * A plan under its old name, `prereg.json`, written by hand before the plan had a schema: open at
203
+ * every level, its own top-level keys kept in `extra`. A seed makes the draw seeded, none (or null) a
204
+ * draw of all; a size, and keys of its own deeper down, are not read; the file is never rewritten.
205
+ */
206
+ declare const legacyAsPlan: z.ZodPipe<z.ZodObject<{
207
+ question: z.ZodString;
208
+ population: z.ZodObject<{
209
+ source: z.ZodString;
210
+ draw: z.ZodObject<{
211
+ method: z.ZodString;
212
+ seed: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
213
+ }, z.core.$loose>;
214
+ }, z.core.$loose>;
215
+ arms: z.ZodArray<z.ZodObject<{
216
+ name: z.ZodString;
217
+ }, z.core.$loose>>;
218
+ primary_outcome: z.ZodString;
219
+ author_check: z.ZodOptional<z.ZodNullable<z.ZodObject<{
220
+ by: z.ZodString;
221
+ date: z.ZodISODate;
222
+ quote: z.ZodString;
223
+ }, z.core.$strict>>>;
224
+ }, z.core.$loose>, z.ZodTransform<StudyPlan, {
225
+ [x: string]: unknown;
226
+ question: string;
227
+ population: {
228
+ [x: string]: unknown;
229
+ source: string;
230
+ draw: {
231
+ [x: string]: unknown;
232
+ method: string;
233
+ seed?: string | number | null | undefined;
234
+ };
235
+ };
236
+ arms: {
237
+ [x: string]: unknown;
238
+ name: string;
239
+ }[];
240
+ primary_outcome: string;
241
+ author_check?: {
242
+ by: string;
243
+ date: string;
244
+ quote: string;
245
+ } | null | undefined;
246
+ }>>;
247
+ /** A plan that parsed: ready, or a draft. */
248
+ type ReadyOrDraft = Exclude<ParsedPlan, {
249
+ readonly kind: "unreadable";
250
+ }>;
251
+ /** A `plan.json` of a study of `kind`: strict, then ready or draft — a measurement's ready only with its mode. */
252
+ declare const planFor: (kind: StudyKind) => z.ZodPipe<z.ZodObject<{
253
+ question: z.ZodString;
254
+ population: z.ZodObject<{
255
+ source: z.ZodString;
256
+ draw: z.ZodDiscriminatedUnion<[z.ZodObject<{
257
+ kind: z.ZodLiteral<"seeded">;
258
+ method: z.ZodString;
259
+ seed: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
260
+ }, z.core.$strict>, z.ZodObject<{
261
+ kind: z.ZodLiteral<"all">;
262
+ method: z.ZodString;
263
+ }, z.core.$strict>], "kind">;
264
+ }, z.core.$strict>;
265
+ arms: z.ZodArray<z.ZodObject<{
266
+ name: z.ZodString;
267
+ }, z.core.$strict>>;
268
+ primary_outcome: z.ZodString;
269
+ author_check: z.ZodNullable<z.ZodObject<{
270
+ by: z.ZodString;
271
+ date: z.ZodISODate;
272
+ quote: z.ZodString;
273
+ }, z.core.$strict>>;
274
+ extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
275
+ mode: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
276
+ kind: z.ZodLiteral<"decide_before_run">;
277
+ outputs: z.ZodArray<z.ZodString>;
278
+ decision: z.ZodObject<{
279
+ file: z.ZodString;
280
+ note: z.ZodString;
281
+ }, z.core.$strict>;
282
+ }, z.core.$strict>, z.ZodObject<{
283
+ kind: z.ZodLiteral<"exploratory">;
284
+ reason: z.ZodString;
285
+ }, z.core.$strict>], "kind">>;
286
+ }, z.core.$strict>, z.ZodTransform<{
287
+ readonly kind: "ready";
288
+ readonly plan: StudyPlan;
289
+ } | {
290
+ readonly kind: "draft";
291
+ readonly plan: import("../../domain/study-registry.ts").DraftPlan;
292
+ readonly empty: readonly PlanTextField[];
293
+ }, {
294
+ question: string;
295
+ population: {
296
+ source: string;
297
+ draw: {
298
+ kind: "seeded";
299
+ method: string;
300
+ seed: string | number;
301
+ } | {
302
+ kind: "all";
303
+ method: string;
304
+ };
305
+ };
306
+ arms: {
307
+ name: string;
308
+ }[];
309
+ primary_outcome: string;
310
+ author_check: {
311
+ by: string;
312
+ date: string;
313
+ quote: string;
314
+ } | null;
315
+ extra?: Record<string, unknown> | undefined;
316
+ mode?: {
317
+ kind: "decide_before_run";
318
+ outputs: string[];
319
+ decision: {
320
+ file: string;
321
+ note: string;
322
+ };
323
+ } | {
324
+ kind: "exploratory";
325
+ reason: string;
326
+ } | undefined;
327
+ }>>;
328
+ /**
329
+ * A `prereg.json`: loose, mapped onto the plan, then ready or draft. Written before modes existed, it
330
+ * is never asked for one; `repro/study-plan-name` already asks to move it to `plan.json`, where the
331
+ * strict parser does.
332
+ */
333
+ declare const legacyPlan: z.ZodPipe<z.ZodPipe<z.ZodObject<{
334
+ question: z.ZodString;
335
+ population: z.ZodObject<{
336
+ source: z.ZodString;
337
+ draw: z.ZodObject<{
338
+ method: z.ZodString;
339
+ seed: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
340
+ }, z.core.$loose>;
341
+ }, z.core.$loose>;
342
+ arms: z.ZodArray<z.ZodObject<{
343
+ name: z.ZodString;
344
+ }, z.core.$loose>>;
345
+ primary_outcome: z.ZodString;
346
+ author_check: z.ZodOptional<z.ZodNullable<z.ZodObject<{
347
+ by: z.ZodString;
348
+ date: z.ZodISODate;
349
+ quote: z.ZodString;
350
+ }, z.core.$strict>>>;
351
+ }, z.core.$loose>, z.ZodTransform<StudyPlan, {
352
+ [x: string]: unknown;
353
+ question: string;
354
+ population: {
355
+ [x: string]: unknown;
356
+ source: string;
357
+ draw: {
358
+ [x: string]: unknown;
359
+ method: string;
360
+ seed?: string | number | null | undefined;
361
+ };
362
+ };
363
+ arms: {
364
+ [x: string]: unknown;
365
+ name: string;
366
+ }[];
367
+ primary_outcome: string;
368
+ author_check?: {
369
+ by: string;
370
+ date: string;
371
+ quote: string;
372
+ } | null | undefined;
373
+ }>>, z.ZodTransform<{
374
+ readonly kind: "ready";
375
+ readonly plan: StudyPlan;
376
+ } | {
377
+ readonly kind: "draft";
378
+ readonly plan: import("../../domain/study-registry.ts").DraftPlan;
379
+ readonly empty: readonly PlanTextField[];
380
+ }, StudyPlan>>;
381
+ /** `T`, readonly all the way down: zod's outputs are mutable, the domain's are not. */
382
+ type Frozen<T> = T extends readonly (infer U)[] ? readonly Frozen<U>[] : T extends object ? {
383
+ readonly [K in keyof T]: Frozen<T[K]>;
384
+ } : T;
385
+ /**
386
+ * True when `A` and `B`, both made readonly all the way down, are one type, optional modifiers
387
+ * included: two generic signatures whose returns are deferred conditionals are related only when
388
+ * the conditionals are identical. Written out, not through an alias: an alias is compared by the
389
+ * variance of its parameter, which misses a dropped optional field.
390
+ */
391
+ type Same<A, B> = (<T>() => T extends Frozen<A> ? readonly [T] : 2) extends <T>() => T extends Frozen<B> ? readonly [T] : 2 ? true : false;
392
+ /** Compiles only when every schema's output is its domain type. */
393
+ export type SchemasAreTheDomain = [
394
+ Same<z.output<typeof registry>, StudyRegistry>,
395
+ Same<z.output<typeof study>, Study>,
396
+ Same<z.output<typeof measurement>, Measurement>,
397
+ Same<z.output<typeof requirement>, Requirement>,
398
+ Same<z.output<typeof approval>, Approval>,
399
+ Same<z.output<typeof authorCheck>, AuthorCheck>,
400
+ Same<z.output<typeof planShape>, StudyPlan>,
401
+ Same<z.output<typeof legacyAsPlan>, StudyPlan>,
402
+ Same<z.output<ReturnType<typeof planFor>>, ReadyOrDraft>,
403
+ Same<z.output<typeof legacyPlan>, ReadyOrDraft>,
404
+ Same<z.output<typeof mode>, StudyMode>,
405
+ Same<z.output<typeof decisionShape>, Decision>
406
+ ] extends true[] ? true : never;
407
+ /** The proof is used, so the build checks it. */
408
+ export declare const SCHEMAS_ARE_THE_DOMAIN: SchemasAreTheDomain;
3
409
  /** A `studies.json`'s text, parsed once at the boundary: the registry, or every reason it is not one. */
4
410
  export declare function parseStudyRegistry(text: string): ParsedRegistry;
411
+ /** A `plan.json` of a study of `kind`: strict. */
412
+ export declare const parseStudyPlan: (text: string, kind: StudyKind) => ParsedPlan;
413
+ /** A plan still named `prereg.json`: loose, read only when a row names it. */
414
+ export declare const parseLegacyPlan: (text: string) => ParsedPlan;
5
415
  export declare const studyRegistryCodec: StudyRegistryCodec;
416
+ export {};
6
417
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/study-registry/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAgC9E,yGAAyG;AACzG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAe/D;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/study-registry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAQL,KAAK,QAAQ,EACb,KAAK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