paperlint 18.3.2 → 18.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 (56) hide show
  1. package/dist/adapters/memory/index.d.ts +6 -0
  2. package/dist/adapters/memory/index.d.ts.map +1 -1
  3. package/dist/adapters/memory/index.js +11 -0
  4. package/dist/adapters/memory/index.js.map +1 -1
  5. package/dist/adapters/node/index.d.ts +1 -0
  6. package/dist/adapters/node/index.d.ts.map +1 -1
  7. package/dist/adapters/node/index.js +1 -0
  8. package/dist/adapters/node/index.js.map +1 -1
  9. package/dist/adapters/node/list-tree.io.d.ts +3 -0
  10. package/dist/adapters/node/list-tree.io.d.ts.map +1 -0
  11. package/dist/adapters/node/list-tree.io.js +23 -0
  12. package/dist/adapters/node/list-tree.io.js.map +1 -0
  13. package/dist/adapters/study-registry/index.d.ts +2 -2
  14. package/dist/artifact-rules.d.ts +26 -0
  15. package/dist/artifact-rules.d.ts.map +1 -0
  16. package/dist/artifact-rules.js +117 -0
  17. package/dist/artifact-rules.js.map +1 -0
  18. package/dist/cli.d.ts.map +1 -1
  19. package/dist/cli.js +7 -1
  20. package/dist/cli.js.map +1 -1
  21. package/dist/domain/artifact.d.ts +36 -0
  22. package/dist/domain/artifact.d.ts.map +1 -0
  23. package/dist/domain/artifact.js +116 -0
  24. package/dist/domain/artifact.js.map +1 -0
  25. package/dist/lib/paper-config.d.ts.map +1 -1
  26. package/dist/lib/paper-config.js +2 -0
  27. package/dist/lib/paper-config.js.map +1 -1
  28. package/dist/paper-settings.d.ts +3 -0
  29. package/dist/paper-settings.d.ts.map +1 -1
  30. package/dist/paper-settings.js +19 -16
  31. package/dist/paper-settings.js.map +1 -1
  32. package/dist/ports/list-tree.d.ts +11 -0
  33. package/dist/ports/list-tree.d.ts.map +1 -0
  34. package/dist/ports/list-tree.js +2 -0
  35. package/dist/ports/list-tree.js.map +1 -0
  36. package/docs/configuration.md +2 -1
  37. package/docs/rules/artifact/promised.md +64 -0
  38. package/docs/rules/artifact/required-files.md +65 -0
  39. package/docs/rules.md +2 -0
  40. package/lib/paper-config.ts +3 -0
  41. package/package.json +1 -1
  42. package/src/adapters/memory/index.test.ts +9 -0
  43. package/src/adapters/memory/index.ts +15 -0
  44. package/src/adapters/node/index.ts +1 -0
  45. package/src/adapters/node/list-tree.io.ts +27 -0
  46. package/src/adapters/node/list-tree.test.ts +38 -0
  47. package/src/artifact-rules.test.ts +50 -0
  48. package/src/artifact-rules.ts +188 -0
  49. package/src/cli.ts +7 -0
  50. package/src/domain/artifact.test.ts +154 -0
  51. package/src/domain/artifact.ts +171 -0
  52. package/src/new-paper.test.ts +1 -1
  53. package/src/paper-settings.test.ts +19 -0
  54. package/src/paper-settings.ts +21 -16
  55. package/src/ports/list-tree.ts +11 -0
  56. package/src/rule-cases.test.ts +134 -1
package/src/cli.ts CHANGED
@@ -63,6 +63,7 @@ import {
63
63
  nodeAdapters,
64
64
  nodeFiles,
65
65
  nodeListDir,
66
+ nodeListTree,
66
67
  nodeCopyFile,
67
68
  nodeMoveFile,
68
69
  } from "./adapters/node/index.ts";
@@ -187,6 +188,7 @@ import paperStages from "#eslint-rules/paper-stages";
187
188
  import preregCoverage from "#eslint-rules/prereg-coverage";
188
189
  import { CYCLE_RULE_LEVELS, cycleRules } from "./cycle-rules.ts";
189
190
  import { EDITION_RULE_LEVELS, editionRules } from "./edition-rule.ts";
191
+ import { ARTIFACT_RULE_LEVELS, artifactRules } from "./artifact-rules.ts";
190
192
  import { changesRules } from "./changes-rule.ts";
191
193
  import { latexDiff, withTexBin } from "./adapters/latexdiff/index.ts";
192
194
  import { runVersions } from "./versions-command.ts";
@@ -630,6 +632,10 @@ export function buildConfig(
630
632
  },
631
633
  },
632
634
  repro: { rules: REPRO_RULES },
635
+ // On for every paper, silent for one whose paperlint.json declares no `artifact`.
636
+ artifact: {
637
+ rules: artifactRules({ files: nodeFiles, listTree: nodeListTree }),
638
+ },
633
639
  // Registered, on for no paper: `"study/declare-sample": "error"` in paperlint.json turns it on.
634
640
  study: { rules: preregCoverage.rules },
635
641
  cycle: { rules: CYCLE_STATUS_RULES },
@@ -641,6 +647,7 @@ export function buildConfig(
641
647
  "paper/source": "error",
642
648
  ...FOLDER_VENUE_RULE_LEVELS,
643
649
  ...EDITION_RULE_LEVELS,
650
+ ...ARTIFACT_RULE_LEVELS,
644
651
  ...FOLDER_LAYOUT_RULE_LEVELS,
645
652
  ...REPRO_RULE_LEVELS,
646
653
  ...STATUS_CYCLE_RULE_LEVELS,
@@ -0,0 +1,154 @@
1
+ /** A paper's `artifact` key, parsed, and the two judgements over the artifact's paths. */
2
+ import { describe, expect, it } from "vitest";
3
+ import {
4
+ answers,
5
+ brokenPromises,
6
+ listedPaths,
7
+ missingRequired,
8
+ parsePaperArtifact,
9
+ } from "./artifact.ts";
10
+
11
+ /** A bad shape, and the one line that refuses it. */
12
+ const REFUSED: readonly (readonly [string, unknown, string])[] = [
13
+ [
14
+ "not an object",
15
+ "artifact",
16
+ `"artifact" must be an object with a "dir" or a "files"`,
17
+ ],
18
+ [
19
+ "an unknown key",
20
+ { dir: "a", include: ["x"] },
21
+ `"artifact" has an unknown key "include" — known: dir, files, required, promises`,
22
+ ],
23
+ [
24
+ "neither dir nor files",
25
+ { promises: {} },
26
+ `"artifact" needs exactly one of "dir" (the artifact's folder) or "files" (a committed list of its paths), got neither`,
27
+ ],
28
+ [
29
+ "both dir and files",
30
+ { dir: "a", files: "a.txt" },
31
+ `"artifact" needs exactly one of "dir" (the artifact's folder) or "files" (a committed list of its paths), got both`,
32
+ ],
33
+ [
34
+ "an absolute dir",
35
+ { dir: "/srv/artifact" },
36
+ `"artifact.dir" must be a path relative to the paper, got "/srv/artifact"`,
37
+ ],
38
+ [
39
+ "a required name with a folder",
40
+ { dir: "a", required: ["docs/README"] },
41
+ `"artifact.required" must be a list of top-level names without an extension ("README", "LICENSE"), got ["docs/README"]`,
42
+ ],
43
+ [
44
+ "promises as a list",
45
+ { dir: "a", promises: ["**/*.md"] },
46
+ `"artifact.promises" must be an object of label → glob`,
47
+ ],
48
+ [
49
+ "an empty glob",
50
+ { dir: "a", promises: { prompts: "" } },
51
+ `"artifact.promises" entry "prompts" must be a non-empty glob relative to the artifact's root, got ""`,
52
+ ],
53
+ ];
54
+
55
+ describe("parsePaperArtifact", () => {
56
+ it("is null when the paper declares no artifact", () => {
57
+ expect(parsePaperArtifact(undefined)).toEqual({ ok: true, value: null });
58
+ });
59
+
60
+ it("takes a folder, the required names and the promises", () => {
61
+ expect(
62
+ parsePaperArtifact({
63
+ dir: "../artifact",
64
+ required: ["README", "LICENSE"],
65
+ promises: { prompts: "**/prompts/*.md" },
66
+ }),
67
+ ).toEqual({
68
+ ok: true,
69
+ value: {
70
+ source: { kind: "dir", path: "../artifact" },
71
+ required: ["README", "LICENSE"],
72
+ promises: { prompts: "**/prompts/*.md" },
73
+ },
74
+ });
75
+ });
76
+
77
+ it("takes a committed list instead of a folder; required and promises are optional", () => {
78
+ expect(parsePaperArtifact({ files: "artifact-files.txt" })).toEqual({
79
+ ok: true,
80
+ value: {
81
+ source: { kind: "files", path: "artifact-files.txt" },
82
+ required: [],
83
+ promises: {},
84
+ },
85
+ });
86
+ });
87
+
88
+ it.each(REFUSED)("refuses %s", (_, v, why) => {
89
+ // Guards: each bad shape is refused with the one line naming the key and what it must be.
90
+ expect(parsePaperArtifact(v)).toEqual({ ok: false, error: why });
91
+ });
92
+ });
93
+
94
+ describe("answers — a top-level name answers a required name by its name before any extension, case ignored", () => {
95
+ it.each<[string, boolean]>([
96
+ ["README.md", true],
97
+ ["readme.txt", true],
98
+ ["README", true],
99
+ ["READMEFIRST.md", false],
100
+ ])("%s → %s", (name, yes) => {
101
+ expect(answers(name, "README")).toBe(yes);
102
+ });
103
+ });
104
+
105
+ describe("brokenPromises — a promise matching no path", () => {
106
+ it("names the label and the glob of each promise that matches nothing", () => {
107
+ expect(
108
+ brokenPromises({ prompts: "**/prompts/*.md", runs: "runs/*.jsonl" }, [
109
+ "prompts/a.md",
110
+ "README.md",
111
+ ]),
112
+ ).toEqual([["runs", "runs/*.jsonl"]]);
113
+ });
114
+ });
115
+
116
+ describe("one wrapper folder around every path (GitHub's Download ZIP, Zenodo, OSF) is looked through", () => {
117
+ const REQ = ["README", "LICENSE"];
118
+
119
+ it("🔴 a wrapped artifact holding README and LICENSE: nothing missing", () => {
120
+ expect(
121
+ missingRequired(REQ, ["repo-main/README.md", "repo-main/LICENSE"]),
122
+ ).toEqual([]);
123
+ });
124
+
125
+ it("a wrapped artifact without a README: README missing", () => {
126
+ expect(
127
+ missingRequired(REQ, ["repo-main/LICENSE", "repo-main/docs/README.md"]),
128
+ ).toEqual(["README"]);
129
+ });
130
+
131
+ it("two top folders are not unwrapped", () => {
132
+ expect(missingRequired(REQ, ["a/README.md", "b/LICENSE"])).toEqual(REQ);
133
+ });
134
+
135
+ it("a top-level file beside one folder is not unwrapped", () => {
136
+ expect(
137
+ missingRequired(REQ, ["notes.txt", "a/README.md", "a/LICENSE"]),
138
+ ).toEqual(REQ);
139
+ });
140
+
141
+ it("🔴 a promise's glob matches inside the wrapper", () => {
142
+ expect(
143
+ brokenPromises({ data: "data/*.csv" }, ["artifact/data/x.csv"]),
144
+ ).toEqual([]);
145
+ });
146
+ });
147
+
148
+ describe("listedPaths — a committed list as zipinfo -1 or find writes it", () => {
149
+ it("drops blank lines, folder entries and a leading ./", () => {
150
+ expect(
151
+ listedPaths(".\n./README.md\nprompts/\nprompts/a.md\r\n\n LICENSE \n"),
152
+ ).toEqual(["README.md", "prompts/a.md", "LICENSE"]);
153
+ });
154
+ });
@@ -0,0 +1,171 @@
1
+ /**
2
+ * A paper's reproduction artifact, as the paper declares it in its `paperlint.json`:
3
+ *
4
+ * "artifact": {
5
+ * "dir": "<folder, relative to the paper>" ┐ exactly one: where the artifact is, or
6
+ * "files": "<text file, relative to the paper>", ┘ a committed list of its paths, one per line
7
+ * "required": ["README", "LICENSE"], names its top level must hold
8
+ * "promises": { "<label>": "<glob>" } what the paper says it holds
9
+ * }
10
+ *
11
+ * `files` is for a bundle that is not committed (a gitignored zip): its paths as `zipinfo -1` or
12
+ * `find` writes them, relative to the artifact's root. A required name is matched without its
13
+ * extension and case (`README` is answered by README.md, readme.txt, README), and a promise's glob
14
+ * by `path.matchesGlob`, the same way whichever form lists the paths; one folder wrapped around
15
+ * every path is looked through (`unwrapSingleRoot`). `artifact/required-files` and
16
+ * `artifact/promised` judge them. The keys #205 plans for assembling a bundle (`include`, `exclude`,
17
+ * `scrub`) are left free.
18
+ */
19
+ import { isAbsolute, matchesGlob } from "node:path";
20
+ import { err, ok, type Result } from "./result.ts";
21
+ import { isRecord } from "./record.ts";
22
+
23
+ /** Where the artifact's paths come from: its folder, or a committed list of them. */
24
+ export interface ArtifactSource {
25
+ readonly kind: "dir" | "files";
26
+ readonly path: string;
27
+ }
28
+
29
+ /** What a paper says its artifact is. */
30
+ export interface PaperArtifact {
31
+ /** The folder or the list, its path relative to the paper folder. */
32
+ readonly source: ArtifactSource;
33
+ /** Names the artifact's top level must hold, each matched without its extension; empty when none. */
34
+ readonly required: readonly string[];
35
+ /** A label the author chose → a glob, relative to the artifact's root, that must match a path. */
36
+ readonly promises: Readonly<Record<string, string>>;
37
+ }
38
+
39
+ const KEYS = ["dir", "files", "required", "promises"];
40
+
41
+ /** The text of a name before its first dot, case folded: what a required name is matched by. Pure. */
42
+ const stemOf = (name: string): string =>
43
+ name.split(".", 1).join("").toLowerCase();
44
+
45
+ /** Whether a top-level name answers the required name `want` (any extension, any case). Pure. */
46
+ export const answers = (name: string, want: string): boolean =>
47
+ stemOf(name) === want.toLowerCase();
48
+
49
+ /**
50
+ * `paths` without the one folder every one of them sits in, when they all do and no file stands
51
+ * beside it (`repo-main/…` of GitHub's Download ZIP, Zenodo's and OSF's archives); else as they are.
52
+ * Pure.
53
+ */
54
+ export const unwrapSingleRoot = (
55
+ paths: readonly string[],
56
+ ): readonly string[] => {
57
+ const firsts = [...new Set(paths.map((p) => p.split("/", 1).join("")))];
58
+ // With exactly one first segment, joining the list gives it.
59
+ const root = firsts.join("");
60
+ const wrapped =
61
+ firsts.length === 1 && paths.every((p) => p.startsWith(`${root}/`));
62
+ return wrapped ? paths.map((p) => p.slice(root.length + 1)) : paths;
63
+ };
64
+
65
+ /** The required names `paths` (relative to the artifact's root) do not hold at its top level. Pure. */
66
+ export const missingRequired = (
67
+ required: readonly string[],
68
+ paths: readonly string[],
69
+ ): readonly string[] => {
70
+ const top = unwrapSingleRoot(paths).filter((p) => !p.includes("/"));
71
+ return required.filter((want) => !top.some((name) => answers(name, want)));
72
+ };
73
+
74
+ /** The promises whose glob matches none of `paths`, as [label, glob]. Pure. */
75
+ export const brokenPromises = (
76
+ promises: Readonly<Record<string, string>>,
77
+ paths: readonly string[],
78
+ ): readonly (readonly [string, string])[] => {
79
+ const under = unwrapSingleRoot(paths);
80
+ return Object.entries(promises).filter(
81
+ ([, glob]) => !under.some((p) => matchesGlob(p, glob)),
82
+ );
83
+ };
84
+
85
+ /**
86
+ * A committed list of paths → the files it names, relative to the artifact's root: one per line,
87
+ * blank lines and folder entries (`dir/`, as `zipinfo -1` writes them) dropped, a leading `./` (as
88
+ * `find .` writes it) removed. Pure.
89
+ */
90
+ export const listedPaths = (text: string): readonly string[] =>
91
+ text
92
+ .split(/\r?\n/u)
93
+ .map((l) => l.trim().replace(/^(?:\.\/)+/u, ""))
94
+ .filter((l) => l !== "" && l !== "." && !l.endsWith("/"));
95
+
96
+ /** A path relative to the paper: a non-empty string, not absolute. */
97
+ const relativePath = (v: unknown): v is string =>
98
+ typeof v === "string" && v !== "" && !isAbsolute(v);
99
+
100
+ /** `dir` or `files`, exactly one, each relative to the paper. Pure. */
101
+ function sourceOf(
102
+ v: Readonly<Record<string, unknown>>,
103
+ ): Result<ArtifactSource, string> {
104
+ const given = (["dir", "files"] as const).filter((k) => k in v);
105
+ const [kind] = given;
106
+ if (given.length !== 1 || kind === undefined)
107
+ return err(
108
+ `"artifact" needs exactly one of "dir" (the artifact's folder) or "files" (a committed list of its paths), got ${given.length === 0 ? "neither" : "both"}`,
109
+ );
110
+ const path = v[kind];
111
+ return relativePath(path)
112
+ ? ok({ kind, path })
113
+ : err(
114
+ `"artifact.${kind}" must be a path relative to the paper, got ${JSON.stringify(path)}`,
115
+ );
116
+ }
117
+
118
+ /** `required`: absent is none; otherwise names without a folder in them. Pure. */
119
+ function requiredOf(v: unknown): Result<readonly string[], string> {
120
+ if (v === undefined) return ok([]);
121
+ return Array.isArray(v) &&
122
+ v.every((x) => typeof x === "string" && /^[^/\\.\s]+$/u.test(x))
123
+ ? ok(v.filter((x): x is string => typeof x === "string"))
124
+ : err(
125
+ `"artifact.required" must be a list of top-level names without an extension ("README", "LICENSE"), got ${JSON.stringify(v)}`,
126
+ );
127
+ }
128
+
129
+ /** `promises`: absent is none; otherwise each label and glob a non-empty string. Pure. */
130
+ function promisesOf(
131
+ v: unknown,
132
+ ): Result<Readonly<Record<string, string>>, string> {
133
+ if (v === undefined) return ok({});
134
+ if (!isRecord(v))
135
+ return err(`"artifact.promises" must be an object of label → glob`);
136
+ const entries = Object.entries(v);
137
+ const bad = entries.find(
138
+ ([label, glob]) => label === "" || typeof glob !== "string" || glob === "",
139
+ );
140
+ return bad === undefined
141
+ ? ok(Object.fromEntries(entries.map(([l, g]) => [l, String(g)])))
142
+ : err(
143
+ `"artifact.promises" entry ${JSON.stringify(bad[0])} must be a non-empty glob relative to the artifact's root, got ${JSON.stringify(bad[1])}`,
144
+ );
145
+ }
146
+
147
+ /** A paper's `artifact` → the value, null when absent, or one line saying what is wrong. Pure. */
148
+ export function parsePaperArtifact(
149
+ v: unknown,
150
+ ): Result<PaperArtifact | null, string> {
151
+ if (v === undefined) return ok(null);
152
+ if (!isRecord(v))
153
+ return err(`"artifact" must be an object with a "dir" or a "files"`);
154
+ const unknown = Object.keys(v).find((k) => !KEYS.includes(k));
155
+ if (unknown !== undefined)
156
+ return err(
157
+ `"artifact" has an unknown key "${unknown}" — known: ${KEYS.join(", ")}`,
158
+ );
159
+ const source = sourceOf(v);
160
+ if (!source.ok) return source;
161
+ const required = requiredOf(v["required"]);
162
+ if (!required.ok) return required;
163
+ const promises = promisesOf(v["promises"]);
164
+ return promises.ok
165
+ ? ok({
166
+ source: source.value,
167
+ required: required.value,
168
+ promises: promises.value,
169
+ })
170
+ : promises;
171
+ }
@@ -73,7 +73,6 @@ describe("paperlint new — paperlint.json", () => {
73
73
  from: "package",
74
74
  });
75
75
  const s = settingsOf(join(papers, "demo"));
76
- expect(s["extends"]).toBeNull();
77
76
  expect(String(s["$comment"])).toMatch(/paperlint:agenticdev-2026/);
78
77
  expect(parsePaperSettings(s)).toEqual({
79
78
  ok: true,
@@ -88,6 +87,7 @@ describe("paperlint new — paperlint.json", () => {
88
87
  authors: null,
89
88
  fields: null,
90
89
  cycles: null,
90
+ artifact: null,
91
91
  },
92
92
  });
93
93
  });
@@ -36,6 +36,7 @@ describe("parsePaperSettings", () => {
36
36
  authors: null,
37
37
  fields: null,
38
38
  cycles: null,
39
+ artifact: null,
39
40
  },
40
41
  });
41
42
  expect(parsePaperSettings({})).toEqual({
@@ -51,6 +52,7 @@ describe("parsePaperSettings", () => {
51
52
  authors: null,
52
53
  fields: null,
53
54
  cycles: null,
55
+ artifact: null,
54
56
  },
55
57
  });
56
58
  });
@@ -69,6 +71,7 @@ describe("parsePaperSettings", () => {
69
71
  authors: null,
70
72
  fields: null,
71
73
  cycles: null,
74
+ artifact: null,
72
75
  },
73
76
  });
74
77
  });
@@ -191,6 +194,7 @@ const UNSET = {
191
194
  authors: null,
192
195
  fields: null,
193
196
  cycles: null,
197
+ artifact: null,
194
198
  };
195
199
 
196
200
  describe("readPaperSettings — the root paperlint.json's defaults, the paper's file over them", () => {
@@ -252,6 +256,7 @@ describe("readPaperSettings — the root paperlint.json's defaults, the paper's
252
256
  authors: null,
253
257
  fields: null,
254
258
  cycles: null,
259
+ artifact: null,
255
260
  });
256
261
  });
257
262
  });
@@ -304,6 +309,7 @@ describe("paperRules — `rules` in paperlint.json", () => {
304
309
  authors: null,
305
310
  fields: null,
306
311
  cycles: null,
312
+ artifact: null,
307
313
  });
308
314
 
309
315
  it("no rules: none", () => {
@@ -393,6 +399,19 @@ describe("talk in a paper's paperlint.json", () => {
393
399
  });
394
400
  });
395
401
 
402
+ it("🔴 artifact: parsed into the paper's settings, or refused naming the key", () => {
403
+ const r = parsePaperSettings({ artifact: { files: "a.txt" } });
404
+ expect(r.ok && r.value.artifact).toEqual({
405
+ source: { kind: "files", path: "a.txt" },
406
+ required: [],
407
+ promises: {},
408
+ });
409
+ expect(parsePaperSettings({ artifact: { dir: "/abs" } })).toEqual({
410
+ ok: false,
411
+ error: `"artifact.dir" must be a path relative to the paper, got "/abs"`,
412
+ });
413
+ });
414
+
396
415
  describe("parsePaperSettings — `cycles`: the current attempt supplies extends, kind and submission", () => {
397
416
  const closed = {
398
417
  id: "alpha-2026",
@@ -4,7 +4,7 @@
4
4
  * One file name at two levels, one schema (lib/paper-config.mjs → SETTINGS_KEYS):
5
5
  *
6
6
  * paperlint.json the project (optional): papersDir, rules, defaults
7
- * <paper>/paperlint.json this paper: { extends, kind, pdf, rules, identity, talk, submission, authors, fields } —
7
+ * <paper>/paperlint.json this paper: { extends, kind, pdf, rules, identity, talk, submission, authors, fields, artifact } —
8
8
  * or `cycles`, from whose current attempt extends, kind and submission
9
9
  * are DERIVED (src/domain/cycle.ts); the two forms do not mix
10
10
  * a venue preset `paperlint:<name>` (shipped) or `./x.jsonc` (src/presets.ts)
@@ -47,6 +47,7 @@ import {
47
47
  venueCycleOf,
48
48
  type Cycles,
49
49
  } from "./domain/cycle.ts";
50
+ import { parsePaperArtifact, type PaperArtifact } from "./domain/artifact.ts";
50
51
 
51
52
  /** What one paper declares. Every absent field is null. */
52
53
  export interface PaperSettings {
@@ -84,6 +85,8 @@ export interface PaperSettings {
84
85
  * attempt's — derived, never written beside it. Never the root's.
85
86
  */
86
87
  readonly cycles: Cycles | null;
88
+ /** Where the paper's reproduction artifact is and what the paper promises it holds (`artifact/contents`); null when absent. Never the root's. */
89
+ readonly artifact: PaperArtifact | null;
87
90
  }
88
91
 
89
92
  /** Why a paper's settings cannot be read. */
@@ -240,11 +243,14 @@ export function parsePaperSettings(
240
243
  if (!rest.ok) return rest;
241
244
  const cycles = cyclesField(json);
242
245
  if (!cycles.ok) return cycles;
246
+ const artifact = parsePaperArtifact(json["artifact"]);
247
+ if (!artifact.ok) return artifact;
243
248
  const flat = {
244
249
  ...fields.value,
245
250
  ...rest.value,
246
251
  identity: identity.value,
247
252
  cycles: cycles.value,
253
+ artifact: artifact.value,
248
254
  };
249
255
  return ok(
250
256
  cycles.value === null ? flat : { ...flat, ...derived(cycles.value) },
@@ -321,6 +327,18 @@ const NO_DEFAULTS: Defaults = {
321
327
  identity: null,
322
328
  };
323
329
 
330
+ /** A paper that declares nothing. */
331
+ const NO_SETTINGS: PaperSettings = {
332
+ ...NO_DEFAULTS,
333
+ rules: null,
334
+ talk: null,
335
+ submission: null,
336
+ authors: null,
337
+ fields: null,
338
+ cycles: null,
339
+ artifact: null,
340
+ };
341
+
324
342
  /** Both lists, joined without repeats; null when neither side has one. */
325
343
  const joined = (
326
344
  a: readonly string[] | null,
@@ -334,26 +352,13 @@ function merge(
334
352
  paper: PaperSettings | null,
335
353
  ): PaperSettings | null {
336
354
  const r = root ?? NO_DEFAULTS;
337
- const p = paper ?? {
338
- ...NO_DEFAULTS,
339
- rules: null,
340
- talk: null,
341
- submission: null,
342
- authors: null,
343
- fields: null,
344
- cycles: null,
345
- };
355
+ const p = paper ?? NO_SETTINGS;
346
356
  const merged: PaperSettings = {
357
+ ...p,
347
358
  extends: p.extends ?? r.extends,
348
359
  kind: p.kind ?? r.kind,
349
360
  pdf: p.pdf ?? r.pdf,
350
- rules: p.rules,
351
361
  identity: joined(r.identity, p.identity),
352
- talk: p.talk,
353
- submission: p.submission,
354
- authors: p.authors,
355
- fields: p.fields,
356
- cycles: p.cycles,
357
362
  };
358
363
  return paper === null && Object.values(merged).every((v) => v === null)
359
364
  ? null
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Every file under a folder — what the artifact rules ask of a paper's artifact folder, to judge its
3
+ * top level and its promises' globs over the same list a committed `files` list gives.
4
+ */
5
+ import type { AbsolutePath } from "../domain/paths.ts";
6
+
7
+ /**
8
+ * The regular files under `dir`, at any depth, as paths relative to it (`/`-separated), sorted;
9
+ * null when `dir` is not a directory.
10
+ */
11
+ export type ListTree = (dir: AbsolutePath) => readonly string[] | null;