paperlint 20.1.2 → 20.3.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 (96) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CLAUDE.md +5 -1
  3. package/dist/adapters/venue-corpus/index.d.ts +361 -0
  4. package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
  5. package/dist/adapters/venue-corpus/index.js +221 -0
  6. package/dist/adapters/venue-corpus/index.js.map +1 -0
  7. package/dist/cli.d.ts +4 -3
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +42 -13
  10. package/dist/cli.js.map +1 -1
  11. package/dist/corpus-record-rule.d.ts +65 -0
  12. package/dist/corpus-record-rule.d.ts.map +1 -0
  13. package/dist/corpus-record-rule.js +85 -0
  14. package/dist/corpus-record-rule.js.map +1 -0
  15. package/dist/domain/corpus-record.d.ts +51 -0
  16. package/dist/domain/corpus-record.d.ts.map +1 -0
  17. package/dist/domain/corpus-record.js +119 -0
  18. package/dist/domain/corpus-record.js.map +1 -0
  19. package/dist/domain/licence.d.ts +51 -0
  20. package/dist/domain/licence.d.ts.map +1 -0
  21. package/dist/domain/licence.js +61 -0
  22. package/dist/domain/licence.js.map +1 -0
  23. package/dist/domain/venue-corpus.d.ts +142 -0
  24. package/dist/domain/venue-corpus.d.ts.map +1 -0
  25. package/dist/domain/venue-corpus.js +17 -0
  26. package/dist/domain/venue-corpus.js.map +1 -0
  27. package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
  28. package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
  29. package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
  30. package/dist/paper-files.d.ts +10 -3
  31. package/dist/paper-files.d.ts.map +1 -1
  32. package/dist/paper-files.js +17 -2
  33. package/dist/paper-files.js.map +1 -1
  34. package/dist/papers-roots.d.ts +6 -0
  35. package/dist/papers-roots.d.ts.map +1 -1
  36. package/dist/papers-roots.js +14 -0
  37. package/dist/papers-roots.js.map +1 -1
  38. package/dist/ports/venue-corpus-codec.d.ts +11 -0
  39. package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
  40. package/dist/ports/venue-corpus-codec.js +2 -0
  41. package/dist/ports/venue-corpus-codec.js.map +1 -0
  42. package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
  43. package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
  44. package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
  45. package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
  46. package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
  47. package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
  48. package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
  49. package/docs/design/venue-corpus.md +271 -0
  50. package/docs/layout.md +2 -2
  51. package/docs/rules/corpus/record.md +119 -0
  52. package/docs/rules.md +1 -0
  53. package/docs/venues.md +158 -24
  54. package/eslint-rules/CLAUDE.md +5 -1
  55. package/eslint-rules/CLAUDE.md.spec.ts +3 -0
  56. package/eslint.config.mjs +1 -0
  57. package/package.json +3 -1
  58. package/scripts/bundle-skills.ts +1 -0
  59. package/scripts/eslint-file-length.mjs +3 -3
  60. package/scripts/venue-corpus-schema.test.ts +39 -0
  61. package/scripts/venue-corpus-schema.ts +17 -0
  62. package/skills/argument-arc/scripts/headings.js +6 -4
  63. package/skills/cold-read-diff/scripts/cold-read.js +6 -4
  64. package/skills/paper-pipeline/scripts/extract-ref-facts.js +6 -5
  65. package/skills/pc-panel-review/scripts/prior-reviews.js +7 -5
  66. package/skills/study-accepted-papers/SKILL.md +34 -2
  67. package/skills/study-accepted-papers/SKILL.md.spec.ts +33 -1
  68. package/skills/study-accepted-papers/papers.schema.json +474 -0
  69. package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
  70. package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +303 -0
  71. package/skills/study-accepted-papers/scripts/corpus-licences.js +393 -0
  72. package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +488 -0
  73. package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
  74. package/skills/verify-citations/scripts/bib-authors.js +6 -5
  75. package/skills/verify-citations/scripts/verify-cites.js +6 -5
  76. package/src/adapters/venue-corpus/index.test.ts +337 -0
  77. package/src/adapters/venue-corpus/index.ts +306 -0
  78. package/src/cli-e2e.test.mjs +2 -2
  79. package/src/cli.test.ts +1 -1
  80. package/src/cli.ts +57 -13
  81. package/src/corpus-record-rule.test.ts +228 -0
  82. package/src/corpus-record-rule.ts +175 -0
  83. package/src/domain/corpus-record.test.ts +163 -0
  84. package/src/domain/corpus-record.ts +210 -0
  85. package/src/domain/licence.test.ts +122 -0
  86. package/src/domain/licence.ts +95 -0
  87. package/src/domain/venue-corpus.ts +159 -0
  88. package/src/paper-files.test.ts +13 -4
  89. package/src/paper-files.ts +23 -2
  90. package/src/paper-settings-commands.test.ts +2 -2
  91. package/src/papers-roots.test.ts +34 -1
  92. package/src/papers-roots.ts +15 -0
  93. package/src/ports/venue-corpus-codec.ts +11 -0
  94. package/src/rule-cases.test.ts +15 -0
  95. package/src/settled-paper.test.ts +1 -1
  96. package/src/unowned-file.test.ts +1 -1
@@ -0,0 +1,488 @@
1
+ /**
2
+ * corpus-licences-core.ts: for each paper of a corpus's `papers.json` and each kind a corpus stores,
3
+ * the copy whose licence permits keeping it, or every copy's reason it may not be kept — and the
4
+ * command that prints it. No model, no network.
5
+ */
6
+ import { spawnSync } from "node:child_process";
7
+ import { dirname, join } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ import { describe, expect, it } from "vitest";
10
+ import { memoryFiles } from "#src/adapters/memory/index";
11
+ import { venueCorpusCodec } from "#src/adapters/venue-corpus/index";
12
+ import type { VenueCorpus } from "#src/domain/venue-corpus";
13
+ import { runNode, useTempDir, writeTree } from "../../../test/support.ts";
14
+ import type { Command, ProcessExit } from "#src/ports/process";
15
+ import {
16
+ gitTopLevel,
17
+ listing,
18
+ main,
19
+ verdicts,
20
+ } from "./corpus-licences-core.ts";
21
+
22
+ const SCRIPT = join(
23
+ dirname(fileURLToPath(import.meta.url)),
24
+ "corpus-licences.ts",
25
+ );
26
+ const CORPUS = "/work/papers/venues/agent";
27
+
28
+ const read = (id: string) => ({
29
+ id,
30
+ read_from: "https://api.crossref.org/works/10.1145/1",
31
+ read_on: "2026-11-03",
32
+ });
33
+ const published = (id: string) => ({
34
+ version: "published",
35
+ url: "https://doi.org/10.1145/1",
36
+ licence: read(id),
37
+ stored: [],
38
+ });
39
+ const preprint = (id: string) => ({
40
+ version: "preprint",
41
+ url: "https://arxiv.org/abs/2601.00001",
42
+ licence: read(id),
43
+ stored: [],
44
+ });
45
+ const notRead = {
46
+ version: "preprint",
47
+ url: "https://arxiv.org/abs/2601.00002",
48
+ licence: { id: "NOASSERTION" },
49
+ stored: [],
50
+ };
51
+ const unknownCopy = {
52
+ version: "unknown",
53
+ licence: { id: "NOASSERTION" },
54
+ stored: ["pdf"],
55
+ fetched_from: "https://example.org/a.pdf",
56
+ };
57
+
58
+ const row = (key: string, copies: readonly object[]) => ({
59
+ key,
60
+ edition: 2026,
61
+ group: "accepted",
62
+ title: `Paper ${key}`,
63
+ ids: { doi: `10.1145/${key}` },
64
+ copies,
65
+ });
66
+
67
+ const record = (papers: readonly object[]) => ({
68
+ venue: "agent",
69
+ editions: [
70
+ {
71
+ edition: 2026,
72
+ listed_from: "https://conf.researchr.org/home/icse-2026/agent-2026",
73
+ read_on: "2026-11-03",
74
+ capped: null,
75
+ proxy: null,
76
+ },
77
+ ],
78
+ papers,
79
+ rebuild: [],
80
+ });
81
+
82
+ /** The record parsed by the real codec, as the command reads it. */
83
+ const corpus = (papers: readonly object[]): VenueCorpus => {
84
+ const parsed = venueCorpusCodec.parse(JSON.stringify(record(papers)));
85
+ if (!parsed.ok) throw new Error(JSON.stringify(parsed.problems));
86
+ return parsed.corpus;
87
+ };
88
+
89
+ const COMMERCIAL = { nonCommercial: false };
90
+
91
+ const ARXIV_WHY =
92
+ 'it grants arXiv alone the right to distribute: "We are thus unable to grant others the right to distribute arXiv articles"';
93
+ const ND_WHY =
94
+ "ND permits reproduction in unmodified form; whether an extracted text is an adaptation is unsettled";
95
+
96
+ describe("verdicts — one per paper and kind, from the copies' licences", () => {
97
+ it("🔴 the first copy that permits a kind is the one to keep, per kind", () => {
98
+ // The preprint is arXiv's (permits nothing); the published copy is CC BY-ND: its PDF may be
99
+ // kept, its extracted text may not.
100
+ const c = corpus([
101
+ row("a1", [
102
+ preprint("LicenseRef-arxiv-nonexclusive-1.0"),
103
+ published("CC-BY-ND-4.0"),
104
+ ]),
105
+ ]);
106
+ expect(verdicts(c, COMMERCIAL)).toEqual([
107
+ {
108
+ key: "a1",
109
+ stored: "text",
110
+ outcome: "none",
111
+ refusals: [
112
+ {
113
+ version: "preprint",
114
+ licence: "LicenseRef-arxiv-nonexclusive-1.0",
115
+ permission: { kind: "forbidden", why: ARXIV_WHY },
116
+ },
117
+ {
118
+ version: "published",
119
+ licence: "CC-BY-ND-4.0",
120
+ permission: { kind: "forbidden", why: ND_WHY },
121
+ },
122
+ ],
123
+ },
124
+ {
125
+ key: "a1",
126
+ stored: "pdf",
127
+ outcome: "keep",
128
+ version: "published",
129
+ licence: "CC-BY-ND-4.0",
130
+ url: "https://doi.org/10.1145/1",
131
+ },
132
+ ]);
133
+ });
134
+ });
135
+
136
+ describe("verdicts — what keeps nothing", () => {
137
+ it("🔴 a licence not read, an unknown copy, an unlisted id and no copy at all keep nothing", () => {
138
+ const c = corpus([
139
+ row("b1", [notRead, unknownCopy, published("CC-BY-3.0")]),
140
+ row("b2", []),
141
+ ]);
142
+ const refusals = [
143
+ {
144
+ version: "preprint",
145
+ licence: "NOASSERTION",
146
+ permission: { kind: "not-read" },
147
+ },
148
+ {
149
+ version: "unknown",
150
+ licence: "NOASSERTION",
151
+ permission: { kind: "not-read" },
152
+ },
153
+ {
154
+ version: "published",
155
+ licence: "CC-BY-3.0",
156
+ permission: { kind: "unlisted", id: "CC-BY-3.0" },
157
+ },
158
+ ];
159
+ expect(verdicts(c, COMMERCIAL)).toEqual([
160
+ { key: "b1", stored: "text", outcome: "none", refusals },
161
+ { key: "b1", stored: "pdf", outcome: "none", refusals },
162
+ { key: "b2", stored: "text", outcome: "none", refusals: [] },
163
+ { key: "b2", stored: "pdf", outcome: "none", refusals: [] },
164
+ ]);
165
+ });
166
+ });
167
+
168
+ describe("verdicts — the non-commercial setting, and an empty record", () => {
169
+ it("🔴 a non-commercial copy is kept only in a project declared non-commercial", () => {
170
+ const c = corpus([row("c1", [published("CC-BY-NC-4.0")])]);
171
+ const refused = {
172
+ outcome: "none",
173
+ refusals: [
174
+ {
175
+ version: "published",
176
+ licence: "CC-BY-NC-4.0",
177
+ permission: { kind: "non-commercial-only" },
178
+ },
179
+ ],
180
+ };
181
+ const kept = {
182
+ outcome: "keep",
183
+ version: "published",
184
+ licence: "CC-BY-NC-4.0",
185
+ url: "https://doi.org/10.1145/1",
186
+ };
187
+ expect({
188
+ commercial: verdicts(c, COMMERCIAL),
189
+ nonCommercial: verdicts(c, { nonCommercial: true }),
190
+ }).toEqual({
191
+ commercial: [
192
+ { key: "c1", stored: "text", ...refused },
193
+ { key: "c1", stored: "pdf", ...refused },
194
+ ],
195
+ nonCommercial: [
196
+ { key: "c1", stored: "text", ...kept },
197
+ { key: "c1", stored: "pdf", ...kept },
198
+ ],
199
+ });
200
+ });
201
+
202
+ it("an empty record has no verdict", () => {
203
+ expect(verdicts(corpus([]), COMMERCIAL)).toEqual([]);
204
+ });
205
+ });
206
+
207
+ describe("listing — one line per paper and kind", () => {
208
+ it("🔴 names the copy to keep, or each copy's reason, or that no copy is recorded", () => {
209
+ const c = corpus([
210
+ row("a1", [
211
+ preprint("LicenseRef-arxiv-nonexclusive-1.0"),
212
+ published("CC-BY-ND-4.0"),
213
+ ]),
214
+ row("b1", [notRead, unknownCopy, published("CC-BY-3.0")]),
215
+ row("b2", []),
216
+ row("c1", [published("CC-BY-NC-4.0")]),
217
+ ]);
218
+ const b1 =
219
+ "none: preprint: its licence was not read (NOASSERTION); unknown: its licence was not read (NOASSERTION); published: CC-BY-3.0 is not in the licence table, so it permits nothing";
220
+ const c1 =
221
+ "none: published: CC-BY-NC-4.0 permits it only in a project declared non-commercial";
222
+ expect(listing(verdicts(c, COMMERCIAL)).split("\n")).toEqual([
223
+ `a1 text: none: preprint: LicenseRef-arxiv-nonexclusive-1.0: ${ARXIV_WHY}; published: CC-BY-ND-4.0: ${ND_WHY}`,
224
+ "a1 pdf: keep the published copy (CC-BY-ND-4.0), https://doi.org/10.1145/1",
225
+ `b1 text: ${b1}`,
226
+ `b1 pdf: ${b1}`,
227
+ "b2 text: none: no copy recorded",
228
+ "b2 pdf: none: no copy recorded",
229
+ `c1 text: ${c1}`,
230
+ `c1 pdf: ${c1}`,
231
+ "",
232
+ ]);
233
+ });
234
+
235
+ it("an empty record lists that it holds no paper", () => {
236
+ expect(listing([])).toBe("papers.json holds no paper\n");
237
+ });
238
+ });
239
+
240
+ const run = (
241
+ argv: readonly string[],
242
+ files: Record<string, string>,
243
+ root: string | null = "/work",
244
+ ) => {
245
+ const out: string[] = [];
246
+ const err: string[] = [];
247
+ const code = main(
248
+ argv,
249
+ {
250
+ files: memoryFiles(files),
251
+ codec: venueCorpusCodec,
252
+ projectRoot: () => root,
253
+ cwd: "/work/papers/some-paper",
254
+ },
255
+ { out: (s) => out.push(s), err: (s) => err.push(s) },
256
+ );
257
+ return { code, out: out.join(""), err: err.join("") };
258
+ };
259
+ const papers = [row("c1", [published("CC-BY-4.0")])];
260
+ const json = JSON.stringify(record(papers));
261
+ const KEEP =
262
+ "c1 text: keep the published copy (CC-BY-4.0), https://doi.org/10.1145/1\nc1 pdf: keep the published copy (CC-BY-4.0), https://doi.org/10.1145/1\n";
263
+
264
+ describe("main — finding the record", () => {
265
+ it("🔴 a venue in the default papers folder: its listing on stdout, exit 0", () => {
266
+ expect(run(["agent"], { [`${CORPUS}/papers.json`]: json })).toEqual({
267
+ code: 0,
268
+ out: KEEP,
269
+ err: "",
270
+ });
271
+ });
272
+
273
+ it("🔴 the papers folder is the project's papersDir, not a built path", () => {
274
+ expect(
275
+ run(["agent"], {
276
+ "/work/paperlint.json": JSON.stringify({ papersDir: "research" }),
277
+ "/work/research/venues/agent/papers.json": json,
278
+ }),
279
+ ).toEqual({ code: 0, out: KEEP, err: "" });
280
+ });
281
+
282
+ it("🔴 several papers folders: the one that holds the venue is read", () => {
283
+ expect(
284
+ run(["agent"], {
285
+ "/work/paperlint.json": JSON.stringify({ papersDir: ["a", "b"] }),
286
+ "/work/b/venues/agent/papers.json": json,
287
+ }),
288
+ ).toEqual({ code: 0, out: KEEP, err: "" });
289
+ });
290
+
291
+ it("🔴 no papers.json in any papers folder: the folders looked in, exit 1", () => {
292
+ expect(
293
+ run(["agent"], {
294
+ "/work/paperlint.json": JSON.stringify({ papersDir: ["a", "b"] }),
295
+ }),
296
+ ).toEqual({
297
+ code: 1,
298
+ out: "",
299
+ err: 'corpus-licences: no papers.json for venue "agent": looked in /work/a/venues/agent, /work/b/venues/agent; write the record first\n',
300
+ });
301
+ });
302
+
303
+ it("🔴 a paperlint.json that is not JSON: named, exit 1", () => {
304
+ expect(run(["agent"], { "/work/paperlint.json": "{" })).toEqual({
305
+ code: 1,
306
+ out: "",
307
+ err: "corpus-licences: /work/paperlint.json is not JSON\n",
308
+ });
309
+ });
310
+
311
+ it("a paperlint.json that is not an object: the default papers folder", () => {
312
+ expect(
313
+ run(["agent"], {
314
+ "/work/paperlint.json": "[]",
315
+ [`${CORPUS}/papers.json`]: json,
316
+ }).code,
317
+ ).toBe(0);
318
+ });
319
+ });
320
+
321
+ describe("main — what stops it", () => {
322
+ it("🔴 two papers folders hold the venue: both named, exit 1", () => {
323
+ expect(
324
+ run(["agent"], {
325
+ "/work/paperlint.json": JSON.stringify({ papersDir: ["a", "b"] }),
326
+ "/work/a/venues/agent/papers.json": json,
327
+ "/work/b/venues/agent/papers.json": json,
328
+ }),
329
+ ).toEqual({
330
+ code: 1,
331
+ out: "",
332
+ err: 'corpus-licences: venue "agent" is in more than one papers folder: /work/a/venues/agent, /work/b/venues/agent\n',
333
+ });
334
+ });
335
+
336
+ it("🔴 outside a git repository: said, exit 1", () => {
337
+ expect(run(["agent"], {}, null)).toEqual({
338
+ code: 1,
339
+ out: "",
340
+ err: "corpus-licences: /work/papers/some-paper is not inside a git repository: run it in the project\n",
341
+ });
342
+ });
343
+
344
+ it("🔴 a record that does not parse: the codec's reasons on stderr, exit 1", () => {
345
+ const bad = [{ ...row("bad.key", []), ids: {} }];
346
+ expect(
347
+ run(["agent"], {
348
+ [`${CORPUS}/papers.json`]: JSON.stringify(record(bad)),
349
+ }),
350
+ ).toEqual({
351
+ code: 1,
352
+ out: "",
353
+ err: "corpus-licences: papers.json: papers.0.key: a letter or digit, then letters, digits, '_' or '-'; papers.0.ids: at least one of doi, arxiv, dblp, s2, url\n",
354
+ });
355
+ });
356
+
357
+ it("🔴 no venue, a second argument, or something that is not a folder name: the usage, exit 2", () => {
358
+ const usage = {
359
+ code: 2,
360
+ out: "",
361
+ err: "usage: node corpus-licences.js <venue>\n",
362
+ };
363
+ expect(run([], {})).toEqual(usage);
364
+ expect(run(["agent", "x"], {})).toEqual(usage);
365
+ expect(run(["../agent"], {})).toEqual(usage);
366
+ expect(run(["/abs/agent"], {})).toEqual(usage);
367
+ });
368
+ });
369
+
370
+ /** A git that answers every command with `exit`, and keeps what it was asked. */
371
+ const fakeGit = (exit: ProcessExit) => {
372
+ const asked: Command[] = [];
373
+ return {
374
+ asked,
375
+ git: {
376
+ run: (c: Command) => {
377
+ asked.push(c);
378
+ return exit;
379
+ },
380
+ },
381
+ };
382
+ };
383
+ const exited = (status: number, stdout: string): ProcessExit => ({
384
+ kind: "exited",
385
+ status,
386
+ stdout,
387
+ stderr: "",
388
+ });
389
+
390
+ describe("gitTopLevel", () => {
391
+ it("🔴 inside a repository: the top level git prints, trimmed", () => {
392
+ const { git, asked } = fakeGit(exited(0, "/work\n"));
393
+ expect(gitTopLevel(git, "/usr/bin", "/work/papers")).toBe("/work");
394
+ // Guards: git is given only the caller's PATH and runs in the caller's folder.
395
+ expect(asked).toEqual([
396
+ {
397
+ file: "git",
398
+ args: ["rev-parse", "--show-toplevel"],
399
+ env: { PATH: "/usr/bin" },
400
+ timeoutMs: 10_000,
401
+ cwd: "/work/papers",
402
+ },
403
+ ]);
404
+ });
405
+
406
+ it("outside a repository (git exits non-zero): null", () => {
407
+ expect(gitTopLevel(fakeGit(exited(128, "")).git, "/usr/bin", "/tmp")).toBe(
408
+ null,
409
+ );
410
+ });
411
+
412
+ it("git exits 0 but prints nothing: null", () => {
413
+ expect(gitTopLevel(fakeGit(exited(0, "\n")).git, "/usr/bin", "/tmp")).toBe(
414
+ null,
415
+ );
416
+ });
417
+
418
+ it("git did not exit (killed by its timeout): null", () => {
419
+ const killed: ProcessExit = {
420
+ kind: "signalled",
421
+ signal: "SIGTERM",
422
+ stdout: "",
423
+ stderr: "",
424
+ };
425
+ expect(gitTopLevel(fakeGit(killed).git, "/usr/bin", "/tmp")).toBe(null);
426
+ });
427
+
428
+ it("no PATH in the caller's environment: git is given an empty one", () => {
429
+ const { git, asked } = fakeGit(exited(0, "/work\n"));
430
+ gitTopLevel(git, undefined, "/work");
431
+ expect(asked.map((c) => c.env)).toEqual([{ PATH: "" }]);
432
+ });
433
+ });
434
+
435
+ describe("main — a record that cannot be read", () => {
436
+ it("🔴 a file that is listed but unreadable: exit 1, the path on stderr", () => {
437
+ const files = memoryFiles({ [`${CORPUS}/papers.json`]: json });
438
+ const err: string[] = [];
439
+ const code = main(
440
+ ["agent"],
441
+ {
442
+ files: { ...files, readBytes: () => null },
443
+ codec: venueCorpusCodec,
444
+ projectRoot: () => "/work",
445
+ cwd: "/work",
446
+ },
447
+ { out: () => undefined, err: (s) => err.push(s) },
448
+ );
449
+ expect({ code, err: err.join("") }).toEqual({
450
+ code: 1,
451
+ err: `corpus-licences: ${CORPUS}/papers.json could not be read\n`,
452
+ });
453
+ });
454
+ });
455
+
456
+ describe("corpus-licences.ts — the runner in a real git repository", () => {
457
+ const dir = useTempDir();
458
+
459
+ const gitInit = () =>
460
+ spawnSync("git", ["init", "-q", dir], { encoding: "utf8" });
461
+
462
+ it("🔴 lists the venue's corpus from a subfolder of the project", () => {
463
+ gitInit();
464
+ writeTree(dir, {
465
+ "paperlint.json": JSON.stringify({ papersDir: "research" }),
466
+ "research/venues/agent/papers.json": JSON.stringify(
467
+ record([row("a1", [preprint("LicenseRef-arxiv-nonexclusive-1.0")])]),
468
+ ),
469
+ "research/some-paper/paper.tex": "",
470
+ });
471
+ const line = `none: preprint: LicenseRef-arxiv-nonexclusive-1.0: ${ARXIV_WHY}`;
472
+ expect(
473
+ runNode(SCRIPT, ["agent"], { cwd: join(dir, "research/some-paper") }),
474
+ ).toEqual({
475
+ status: 0,
476
+ stdout: `a1 text: ${line}\na1 pdf: ${line}\n`,
477
+ stderr: "",
478
+ });
479
+ });
480
+
481
+ it("no argument: the usage on stderr, exit 2", () => {
482
+ expect(runNode(SCRIPT, [], { cwd: dir })).toEqual({
483
+ status: 2,
484
+ stdout: "",
485
+ stderr: "usage: node corpus-licences.js <venue>\n",
486
+ });
487
+ });
488
+ });
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * corpus-licences — for each paper of a venue corpus and each kind (text, PDF), the copy whose
4
+ * licence permits keeping it, or why none does (`corpus-licences-core.ts`); this file only runs it.
5
+ * A consumer runs the compiled `corpus-licences.js` (Node strips no types under node_modules).
6
+ *
7
+ * Usage: node corpus-licences.js <venue>
8
+ */
9
+ import { nodeFiles, spawnProcess } from "#src/adapters/node/index";
10
+ import { venueCorpusCodec } from "#src/adapters/venue-corpus/index";
11
+ import { gitTopLevel, main } from "./corpus-licences-core.ts";
12
+
13
+ const git = spawnProcess();
14
+
15
+ process.exitCode = main(
16
+ process.argv.slice(2),
17
+ {
18
+ files: nodeFiles,
19
+ codec: venueCorpusCodec,
20
+ projectRoot: (cwd) => gitTopLevel(git, process.env["PATH"], cwd),
21
+ cwd: process.cwd(),
22
+ },
23
+ {
24
+ out: (s) => process.stdout.write(s),
25
+ err: (s) => process.stderr.write(s),
26
+ },
27
+ );
@@ -10,17 +10,18 @@ import {
10
10
  bibliographyAt,
11
11
  bibliographyUnreadWhy,
12
12
  isMain
13
- } from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
13
+ } from "../../../dist/skill-chunks/chunk-6YEM4VDI.js";
14
14
  import {
15
15
  latexReader,
16
16
  sourcesCodec
17
- } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
18
- import "../../../dist/skill-chunks/chunk-IREAROCV.js";
17
+ } from "../../../dist/skill-chunks/chunk-CXAGKT44.js";
18
+ import "../../../dist/skill-chunks/chunk-J5XYPERO.js";
19
+ import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
20
+ import "../../../dist/skill-chunks/chunk-Z5YMDZYW.js";
19
21
  import {
20
22
  absolutePath,
21
23
  nodeFiles
22
- } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
23
- import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
24
+ } from "../../../dist/skill-chunks/chunk-5KCU4WTN.js";
24
25
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
25
26
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
26
27
 
@@ -11,17 +11,18 @@ import {
11
11
  bibliographyUnreadWhy,
12
12
  consumerContactEmail,
13
13
  isMain
14
- } from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
14
+ } from "../../../dist/skill-chunks/chunk-6YEM4VDI.js";
15
15
  import {
16
16
  latexReader,
17
17
  sourcesCodec
18
- } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
19
- import "../../../dist/skill-chunks/chunk-IREAROCV.js";
18
+ } from "../../../dist/skill-chunks/chunk-CXAGKT44.js";
19
+ import "../../../dist/skill-chunks/chunk-J5XYPERO.js";
20
+ import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
21
+ import "../../../dist/skill-chunks/chunk-Z5YMDZYW.js";
20
22
  import {
21
23
  absolutePath,
22
24
  nodeFiles
23
- } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
24
- import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
25
+ } from "../../../dist/skill-chunks/chunk-5KCU4WTN.js";
25
26
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
26
27
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
27
28