paperlint 20.1.2 → 20.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 (56) 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 +345 -0
  4. package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
  5. package/dist/adapters/venue-corpus/index.js +205 -0
  6. package/dist/adapters/venue-corpus/index.js.map +1 -0
  7. package/dist/domain/licence.d.ts +51 -0
  8. package/dist/domain/licence.d.ts.map +1 -0
  9. package/dist/domain/licence.js +61 -0
  10. package/dist/domain/licence.js.map +1 -0
  11. package/dist/domain/venue-corpus.d.ts +120 -0
  12. package/dist/domain/venue-corpus.d.ts.map +1 -0
  13. package/dist/domain/venue-corpus.js +13 -0
  14. package/dist/domain/venue-corpus.js.map +1 -0
  15. package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
  16. package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
  17. package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
  18. package/dist/ports/venue-corpus-codec.d.ts +11 -0
  19. package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
  20. package/dist/ports/venue-corpus-codec.js +2 -0
  21. package/dist/ports/venue-corpus-codec.js.map +1 -0
  22. package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
  23. package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
  24. package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
  25. package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
  26. package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
  27. package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
  28. package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
  29. package/docs/design/venue-corpus.md +250 -0
  30. package/docs/venues.md +144 -21
  31. package/eslint-rules/CLAUDE.md +5 -1
  32. package/eslint-rules/CLAUDE.md.spec.ts +3 -0
  33. package/package.json +2 -1
  34. package/scripts/bundle-skills.ts +1 -0
  35. package/scripts/venue-corpus-schema.test.ts +39 -0
  36. package/scripts/venue-corpus-schema.ts +17 -0
  37. package/skills/argument-arc/scripts/headings.js +6 -4
  38. package/skills/cold-read-diff/scripts/cold-read.js +6 -4
  39. package/skills/paper-pipeline/scripts/extract-ref-facts.js +6 -5
  40. package/skills/pc-panel-review/scripts/prior-reviews.js +7 -5
  41. package/skills/study-accepted-papers/SKILL.md +28 -2
  42. package/skills/study-accepted-papers/SKILL.md.spec.ts +27 -1
  43. package/skills/study-accepted-papers/papers.schema.json +427 -0
  44. package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
  45. package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +302 -0
  46. package/skills/study-accepted-papers/scripts/corpus-licences.js +383 -0
  47. package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +485 -0
  48. package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
  49. package/skills/verify-citations/scripts/bib-authors.js +6 -5
  50. package/skills/verify-citations/scripts/verify-cites.js +6 -5
  51. package/src/adapters/venue-corpus/index.test.ts +279 -0
  52. package/src/adapters/venue-corpus/index.ts +286 -0
  53. package/src/domain/licence.test.ts +122 -0
  54. package/src/domain/licence.ts +95 -0
  55. package/src/domain/venue-corpus.ts +130 -0
  56. package/src/ports/venue-corpus-codec.ts +11 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "20.1.2",
3
+ "version": "20.2.0",
4
4
  "description": "Skills and hooks for writing a research paper with paperlint",
5
5
  "skills": "./skills/",
6
6
  "hooks": "./plugin/hooks/hooks.json"
package/CLAUDE.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- vigiles:sha256:6d6e96066c9c2e2b compiled from CLAUDE.md.spec.ts -->
1
+ <!-- vigiles:sha256:b9266075626f0285 compiled from CLAUDE.md.spec.ts -->
2
2
 
3
3
  # CLAUDE.md
4
4
 
@@ -121,6 +121,10 @@ Before writing machinery, **run the thing you are about to replace and paste its
121
121
 
122
122
  **Guidance only** — Every check — lint rule, script, hook, harness — fires on a planted defect AND stays quiet on a clean fixture, and the test goes red before the fix lands. A check only ever seen quiet is indistinguishable from a dead one. [Details](docs/testing.md)
123
123
 
124
+ ### Every Prescribed File Is Linted
125
+
126
+ **Guidance only** — Every file or folder paperlint prescribes to a project (a name a command or skill writes, or a doc tells the author to keep) has its names held by its family's `allowed-files-only` rule and its contents by a schema that a `record` rule reads, so a stray file or a misspelt key is a finding, not a silent pass. A file held only by prose or by a command at run time is a gap with an open issue. The audit of 2026-11-24 found most prescribed files only partly held; each gap's issue is linked from #516. The author asked for this on 2026-11-24.
127
+
124
128
  ### Never The Callers Cwd
125
129
 
126
130
  **Guidance only** — No program this package ships (`bin/`, `lib/`, hooks, skill scripts) depends on the directory it is started from: resolve from `git rev-parse --show-toplevel` or from the module's own location.
@@ -0,0 +1,345 @@
1
+ /**
2
+ * The schema of a venue corpus's `papers.json` — the one place its shape is checked
3
+ * (docs/design/venue-corpus.md, decision 1). The text is parsed once, here, into the domain's
4
+ * `VenueCorpus`; whatever reads a record after it never re-validates. The study registry's pattern
5
+ * (`src/adapters/study-registry/`).
6
+ *
7
+ * The top level, an edition, a copy, a licence and a paper's ids are strict, so a misspelt key is an
8
+ * error. A paper row is loose: a consumer's scripts read their own fields from it. A licence id is
9
+ * checked for its shape only: whether the id permits anything is `src/domain/licence.ts`'s table, so
10
+ * one unlisted id does not make the record unreadable.
11
+ */
12
+ import { z } from "zod";
13
+ import { NOASSERTION } from "../../domain/licence.ts";
14
+ import { type Copy, type Edition, type Licence, type ParsedCorpus, type Paper, type PaperIds, type VenueCorpus } from "../../domain/venue-corpus.ts";
15
+ import type { VenueCorpusCodec } from "../../ports/venue-corpus-codec.ts";
16
+ /** A licence: NOASSERTION alone, or any other id with where and when it was read. */
17
+ declare const licence: z.ZodPipe<z.ZodObject<{
18
+ id: z.ZodString;
19
+ read_from: z.ZodOptional<z.ZodURL>;
20
+ read_on: z.ZodOptional<z.ZodISODate>;
21
+ }, z.core.$strict>, z.ZodTransform<{
22
+ readonly id: typeof NOASSERTION;
23
+ } | {
24
+ readonly id: string;
25
+ readonly read_from: string;
26
+ readonly read_on: string;
27
+ }, {
28
+ id: string;
29
+ read_from?: string | undefined;
30
+ read_on?: string | undefined;
31
+ }>>;
32
+ declare const copy: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ stored: z.ZodArray<z.ZodEnum<{
34
+ text: "text";
35
+ pdf: "pdf";
36
+ }>>;
37
+ fetched_from: z.ZodOptional<z.ZodURL>;
38
+ version: z.ZodEnum<{
39
+ accepted: "accepted";
40
+ published: "published";
41
+ preprint: "preprint";
42
+ }>;
43
+ url: z.ZodURL;
44
+ licence: z.ZodPipe<z.ZodObject<{
45
+ id: z.ZodString;
46
+ read_from: z.ZodOptional<z.ZodURL>;
47
+ read_on: z.ZodOptional<z.ZodISODate>;
48
+ }, z.core.$strict>, z.ZodTransform<{
49
+ readonly id: typeof NOASSERTION;
50
+ } | {
51
+ readonly id: string;
52
+ readonly read_from: string;
53
+ readonly read_on: string;
54
+ }, {
55
+ id: string;
56
+ read_from?: string | undefined;
57
+ read_on?: string | undefined;
58
+ }>>;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ stored: z.ZodArray<z.ZodEnum<{
61
+ text: "text";
62
+ pdf: "pdf";
63
+ }>>;
64
+ fetched_from: z.ZodOptional<z.ZodURL>;
65
+ version: z.ZodLiteral<"unknown">;
66
+ licence: z.ZodObject<{
67
+ id: z.ZodLiteral<"NOASSERTION">;
68
+ }, z.core.$strict>;
69
+ }, z.core.$strict>], "version">;
70
+ declare const ids: z.ZodObject<{
71
+ doi: z.ZodOptional<z.ZodString>;
72
+ arxiv: z.ZodOptional<z.ZodString>;
73
+ dblp: z.ZodOptional<z.ZodString>;
74
+ s2: z.ZodOptional<z.ZodString>;
75
+ url: z.ZodOptional<z.ZodURL>;
76
+ }, z.core.$strict>;
77
+ declare const paper: z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ group: z.ZodEnum<{
79
+ accepted: "accepted";
80
+ award: "award";
81
+ }>;
82
+ edition: z.ZodNumber;
83
+ key: z.ZodString;
84
+ title: z.ZodString;
85
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ abstract: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ ids: z.ZodObject<{
88
+ doi: z.ZodOptional<z.ZodString>;
89
+ arxiv: z.ZodOptional<z.ZodString>;
90
+ dblp: z.ZodOptional<z.ZodString>;
91
+ s2: z.ZodOptional<z.ZodString>;
92
+ url: z.ZodOptional<z.ZodURL>;
93
+ }, z.core.$strict>;
94
+ copies: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
95
+ stored: z.ZodArray<z.ZodEnum<{
96
+ text: "text";
97
+ pdf: "pdf";
98
+ }>>;
99
+ fetched_from: z.ZodOptional<z.ZodURL>;
100
+ version: z.ZodEnum<{
101
+ accepted: "accepted";
102
+ published: "published";
103
+ preprint: "preprint";
104
+ }>;
105
+ url: z.ZodURL;
106
+ licence: z.ZodPipe<z.ZodObject<{
107
+ id: z.ZodString;
108
+ read_from: z.ZodOptional<z.ZodURL>;
109
+ read_on: z.ZodOptional<z.ZodISODate>;
110
+ }, z.core.$strict>, z.ZodTransform<{
111
+ readonly id: typeof NOASSERTION;
112
+ } | {
113
+ readonly id: string;
114
+ readonly read_from: string;
115
+ readonly read_on: string;
116
+ }, {
117
+ id: string;
118
+ read_from?: string | undefined;
119
+ read_on?: string | undefined;
120
+ }>>;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ stored: z.ZodArray<z.ZodEnum<{
123
+ text: "text";
124
+ pdf: "pdf";
125
+ }>>;
126
+ fetched_from: z.ZodOptional<z.ZodURL>;
127
+ version: z.ZodLiteral<"unknown">;
128
+ licence: z.ZodObject<{
129
+ id: z.ZodLiteral<"NOASSERTION">;
130
+ }, z.core.$strict>;
131
+ }, z.core.$strict>], "version">>;
132
+ }, z.core.$loose>, z.ZodObject<{
133
+ group: z.ZodLiteral<"sister">;
134
+ venue: z.ZodString;
135
+ year: z.ZodNumber;
136
+ listed_from: z.ZodURL;
137
+ key: z.ZodString;
138
+ title: z.ZodString;
139
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
140
+ abstract: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ ids: z.ZodObject<{
142
+ doi: z.ZodOptional<z.ZodString>;
143
+ arxiv: z.ZodOptional<z.ZodString>;
144
+ dblp: z.ZodOptional<z.ZodString>;
145
+ s2: z.ZodOptional<z.ZodString>;
146
+ url: z.ZodOptional<z.ZodURL>;
147
+ }, z.core.$strict>;
148
+ copies: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
149
+ stored: z.ZodArray<z.ZodEnum<{
150
+ text: "text";
151
+ pdf: "pdf";
152
+ }>>;
153
+ fetched_from: z.ZodOptional<z.ZodURL>;
154
+ version: z.ZodEnum<{
155
+ accepted: "accepted";
156
+ published: "published";
157
+ preprint: "preprint";
158
+ }>;
159
+ url: z.ZodURL;
160
+ licence: z.ZodPipe<z.ZodObject<{
161
+ id: z.ZodString;
162
+ read_from: z.ZodOptional<z.ZodURL>;
163
+ read_on: z.ZodOptional<z.ZodISODate>;
164
+ }, z.core.$strict>, z.ZodTransform<{
165
+ readonly id: typeof NOASSERTION;
166
+ } | {
167
+ readonly id: string;
168
+ readonly read_from: string;
169
+ readonly read_on: string;
170
+ }, {
171
+ id: string;
172
+ read_from?: string | undefined;
173
+ read_on?: string | undefined;
174
+ }>>;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ stored: z.ZodArray<z.ZodEnum<{
177
+ text: "text";
178
+ pdf: "pdf";
179
+ }>>;
180
+ fetched_from: z.ZodOptional<z.ZodURL>;
181
+ version: z.ZodLiteral<"unknown">;
182
+ licence: z.ZodObject<{
183
+ id: z.ZodLiteral<"NOASSERTION">;
184
+ }, z.core.$strict>;
185
+ }, z.core.$strict>], "version">>;
186
+ }, z.core.$loose>], "group">;
187
+ declare const edition: z.ZodObject<{
188
+ edition: z.ZodNumber;
189
+ listed_from: z.ZodURL;
190
+ read_on: z.ZodISODate;
191
+ accepted: z.ZodOptional<z.ZodNumber>;
192
+ }, z.core.$strict>;
193
+ declare const record: z.ZodObject<{
194
+ venue: z.ZodString;
195
+ editions: z.ZodArray<z.ZodObject<{
196
+ edition: z.ZodNumber;
197
+ listed_from: z.ZodURL;
198
+ read_on: z.ZodISODate;
199
+ accepted: z.ZodOptional<z.ZodNumber>;
200
+ }, z.core.$strict>>;
201
+ papers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
202
+ group: z.ZodEnum<{
203
+ accepted: "accepted";
204
+ award: "award";
205
+ }>;
206
+ edition: z.ZodNumber;
207
+ key: z.ZodString;
208
+ title: z.ZodString;
209
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
210
+ abstract: z.ZodOptional<z.ZodNullable<z.ZodString>>;
211
+ ids: z.ZodObject<{
212
+ doi: z.ZodOptional<z.ZodString>;
213
+ arxiv: z.ZodOptional<z.ZodString>;
214
+ dblp: z.ZodOptional<z.ZodString>;
215
+ s2: z.ZodOptional<z.ZodString>;
216
+ url: z.ZodOptional<z.ZodURL>;
217
+ }, z.core.$strict>;
218
+ copies: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
219
+ stored: z.ZodArray<z.ZodEnum<{
220
+ text: "text";
221
+ pdf: "pdf";
222
+ }>>;
223
+ fetched_from: z.ZodOptional<z.ZodURL>;
224
+ version: z.ZodEnum<{
225
+ accepted: "accepted";
226
+ published: "published";
227
+ preprint: "preprint";
228
+ }>;
229
+ url: z.ZodURL;
230
+ licence: z.ZodPipe<z.ZodObject<{
231
+ id: z.ZodString;
232
+ read_from: z.ZodOptional<z.ZodURL>;
233
+ read_on: z.ZodOptional<z.ZodISODate>;
234
+ }, z.core.$strict>, z.ZodTransform<{
235
+ readonly id: typeof NOASSERTION;
236
+ } | {
237
+ readonly id: string;
238
+ readonly read_from: string;
239
+ readonly read_on: string;
240
+ }, {
241
+ id: string;
242
+ read_from?: string | undefined;
243
+ read_on?: string | undefined;
244
+ }>>;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ stored: z.ZodArray<z.ZodEnum<{
247
+ text: "text";
248
+ pdf: "pdf";
249
+ }>>;
250
+ fetched_from: z.ZodOptional<z.ZodURL>;
251
+ version: z.ZodLiteral<"unknown">;
252
+ licence: z.ZodObject<{
253
+ id: z.ZodLiteral<"NOASSERTION">;
254
+ }, z.core.$strict>;
255
+ }, z.core.$strict>], "version">>;
256
+ }, z.core.$loose>, z.ZodObject<{
257
+ group: z.ZodLiteral<"sister">;
258
+ venue: z.ZodString;
259
+ year: z.ZodNumber;
260
+ listed_from: z.ZodURL;
261
+ key: z.ZodString;
262
+ title: z.ZodString;
263
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
264
+ abstract: z.ZodOptional<z.ZodNullable<z.ZodString>>;
265
+ ids: z.ZodObject<{
266
+ doi: z.ZodOptional<z.ZodString>;
267
+ arxiv: z.ZodOptional<z.ZodString>;
268
+ dblp: z.ZodOptional<z.ZodString>;
269
+ s2: z.ZodOptional<z.ZodString>;
270
+ url: z.ZodOptional<z.ZodURL>;
271
+ }, z.core.$strict>;
272
+ copies: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
273
+ stored: z.ZodArray<z.ZodEnum<{
274
+ text: "text";
275
+ pdf: "pdf";
276
+ }>>;
277
+ fetched_from: z.ZodOptional<z.ZodURL>;
278
+ version: z.ZodEnum<{
279
+ accepted: "accepted";
280
+ published: "published";
281
+ preprint: "preprint";
282
+ }>;
283
+ url: z.ZodURL;
284
+ licence: z.ZodPipe<z.ZodObject<{
285
+ id: z.ZodString;
286
+ read_from: z.ZodOptional<z.ZodURL>;
287
+ read_on: z.ZodOptional<z.ZodISODate>;
288
+ }, z.core.$strict>, z.ZodTransform<{
289
+ readonly id: typeof NOASSERTION;
290
+ } | {
291
+ readonly id: string;
292
+ readonly read_from: string;
293
+ readonly read_on: string;
294
+ }, {
295
+ id: string;
296
+ read_from?: string | undefined;
297
+ read_on?: string | undefined;
298
+ }>>;
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ stored: z.ZodArray<z.ZodEnum<{
301
+ text: "text";
302
+ pdf: "pdf";
303
+ }>>;
304
+ fetched_from: z.ZodOptional<z.ZodURL>;
305
+ version: z.ZodLiteral<"unknown">;
306
+ licence: z.ZodObject<{
307
+ id: z.ZodLiteral<"NOASSERTION">;
308
+ }, z.core.$strict>;
309
+ }, z.core.$strict>], "version">>;
310
+ }, z.core.$loose>], "group">>;
311
+ }, z.core.$strict>;
312
+ /** `T`, readonly all the way down: zod's outputs are mutable, the domain's are not. */
313
+ type Frozen<T> = T extends readonly (infer U)[] ? readonly Frozen<U>[] : T extends object ? {
314
+ readonly [K in keyof T]: Frozen<T[K]>;
315
+ } : T;
316
+ /** True when `A` and `B`, both made readonly all the way down, are one type. */
317
+ type Same<A, B> = (<T>() => T extends Frozen<A> ? readonly [T] : 2) extends <T>() => T extends Frozen<B> ? readonly [T] : 2 ? true : false;
318
+ /** Compiles only when every schema's output is its domain type. */
319
+ export type SchemasAreTheDomain = [
320
+ Same<z.output<typeof record>, VenueCorpus>,
321
+ Same<z.output<typeof edition>, Edition>,
322
+ Same<z.output<typeof paper>, Paper>,
323
+ Same<z.output<typeof copy>, Copy>,
324
+ Same<z.output<typeof licence>, Licence>,
325
+ Same<z.output<typeof ids>, PaperIds>
326
+ ] extends true[] ? true : never;
327
+ /** The proof is used, so the build checks it. */
328
+ export declare const SCHEMAS_ARE_THE_DOMAIN: SchemasAreTheDomain;
329
+ /** A `papers.json`'s text, parsed once at the boundary: the record, or every reason it is not one. */
330
+ export declare function parseVenueCorpus(text: string): ParsedCorpus;
331
+ export declare const venueCorpusCodec: VenueCorpusCodec;
332
+ /** Where the shipped JSON Schema of the record sits, below the package root: in the skill that writes it. */
333
+ export declare const SCHEMA_FILE = "skills/study-accepted-papers/papers.schema.json";
334
+ /**
335
+ * The JSON Schema of a `papers.json`, generated from the parser's own shape: the fields a skill (or
336
+ * an editor) reads instead of a hand-written table. Shipped as `SCHEMA_FILE`; a test holds the file
337
+ * to this. A schema cannot say that a key is unique, that a paper's edition is a listed one, or that
338
+ * a stored copy names where it was fetched from: `corpus-licences.js` checks those and names the
339
+ * field's path.
340
+ */
341
+ export declare const venueCorpusJsonSchema: () => unknown;
342
+ /** The shipped file's text: the schema, indented, with a closing newline. */
343
+ export declare const venueCorpusSchemaText: () => string;
344
+ export {};
345
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/venue-corpus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,WAAW,EAEZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAKL,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAyB1E,qFAAqF;AACrF,QAAA,MAAM,OAAO;;;;;;;;;;;;;;GAsBT,CAAC;AA2BL,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAgBR,CAAC;AAEH,QAAA,MAAM,GAAG;;;;;;kBAWN,CAAC;AAeJ,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,CAAC,EAAE,IAAI,CAAC;IACjC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,EAAE,OAAO,CAAC;IACvC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,QAAQ,CAAC;CACrC,SAAS,IAAI,EAAE,GACZ,IAAI,GACJ,KAAK,CAAC;AAEV,iDAAiD;AACjD,eAAO,MAAM,sBAAsB,EAAE,mBAA0B,CAAC;AAWhE,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAU3D;AAED,eAAO,MAAM,gBAAgB,EAAE,gBAA8C,CAAC;AAE9E,6GAA6G;AAC7G,eAAO,MAAM,WAAW,oDAAoD,CAAC;AAE7E;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAO,OAKvC,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,QAAO,MACgB,CAAC"}
@@ -0,0 +1,205 @@
1
+ /**
2
+ * The schema of a venue corpus's `papers.json` — the one place its shape is checked
3
+ * (docs/design/venue-corpus.md, decision 1). The text is parsed once, here, into the domain's
4
+ * `VenueCorpus`; whatever reads a record after it never re-validates. The study registry's pattern
5
+ * (`src/adapters/study-registry/`).
6
+ *
7
+ * The top level, an edition, a copy, a licence and a paper's ids are strict, so a misspelt key is an
8
+ * error. A paper row is loose: a consumer's scripts read their own fields from it. A licence id is
9
+ * checked for its shape only: whether the id permits anything is `src/domain/licence.ts`'s table, so
10
+ * one unlisted id does not make the record unreadable.
11
+ */
12
+ import { z } from "zod";
13
+ import { isLicenceId, NOASSERTION, STORED_KINDS, } from "../../domain/licence.js";
14
+ import { CORPUS_RECORD, KEY_PATTERN, KNOWN_VERSIONS, PAPER_ID_KINDS, } from "../../domain/venue-corpus.js";
15
+ const words = z.string().min(1);
16
+ const date = z.iso.date();
17
+ /** Where a page or a file was read: a web address, never a local path or another scheme. */
18
+ const webUrl = z.url({
19
+ protocol: /^https?$/u,
20
+ error: "an http or https address",
21
+ });
22
+ /** The index of each value that occurs earlier in `values`, with the index of its first. */
23
+ const repeats = (values) => values.flatMap((v, i) => {
24
+ const first = values.indexOf(v);
25
+ return first === i ? [] : [[i, first]];
26
+ });
27
+ const licenceId = z
28
+ .string()
29
+ .refine(isLicenceId, "an SPDX license id or a LicenseRef-");
30
+ const notRead = z.strictObject({ id: z.literal(NOASSERTION) });
31
+ /** A licence: NOASSERTION alone, or any other id with where and when it was read. */
32
+ const licence = z
33
+ .strictObject({
34
+ id: licenceId,
35
+ read_from: webUrl.optional(),
36
+ read_on: date.optional(),
37
+ })
38
+ .transform((l, ctx) => {
39
+ const fields = ["read_from", "read_on"];
40
+ const noneRead = l.id === NOASSERTION;
41
+ const wrong = fields.filter((f) => (l[f] === undefined) !== noneRead);
42
+ wrong.forEach((f) => {
43
+ ctx.addIssue({
44
+ code: "custom",
45
+ path: [f],
46
+ message: noneRead
47
+ ? "NOASSERTION means the licence was not read"
48
+ : `a licence other than NOASSERTION names ${f === "read_from" ? "where" : "when"} it was read`,
49
+ });
50
+ });
51
+ return l.read_from === undefined || l.read_on === undefined
52
+ ? { id: NOASSERTION }
53
+ : { id: l.id, read_from: l.read_from, read_on: l.read_on };
54
+ });
55
+ const storage = {
56
+ stored: z.array(z.enum(STORED_KINDS)),
57
+ fetched_from: webUrl.optional(),
58
+ };
59
+ /** Each kind at most once, and a stored copy names where its bytes came from. */
60
+ const stores = (c, ctx) => {
61
+ repeats(c.stored).forEach(([i]) => {
62
+ ctx.addIssue({
63
+ code: "custom",
64
+ path: ["stored"],
65
+ message: `"${String(c.stored[i])}" is listed twice`,
66
+ });
67
+ });
68
+ if (c.stored.length > 0 && c.fetched_from === undefined)
69
+ ctx.addIssue({
70
+ code: "custom",
71
+ path: ["fetched_from"],
72
+ message: "a copy that stores a file names where it was fetched from",
73
+ });
74
+ };
75
+ const copy = z.discriminatedUnion("version", [
76
+ z
77
+ .strictObject({
78
+ version: z.enum(KNOWN_VERSIONS),
79
+ url: webUrl,
80
+ licence,
81
+ ...storage,
82
+ })
83
+ .superRefine(stores),
84
+ z
85
+ .strictObject({
86
+ version: z.literal("unknown"),
87
+ licence: notRead,
88
+ ...storage,
89
+ })
90
+ .superRefine(stores),
91
+ ]);
92
+ const ids = z
93
+ .strictObject({
94
+ doi: words.optional(),
95
+ arxiv: words.optional(),
96
+ dblp: words.optional(),
97
+ s2: words.optional(),
98
+ url: webUrl.optional(),
99
+ })
100
+ .refine((i) => Object.values(i).some((v) => v !== undefined), `at least one of ${PAPER_ID_KINDS.join(", ")}`);
101
+ const paperFields = {
102
+ key: z
103
+ .string()
104
+ .regex(KEY_PATTERN, "a letter or digit, then letters, digits, '_' or '-'"),
105
+ title: words,
106
+ authors: z.array(words).optional(),
107
+ abstract: z.string().nullable().optional(),
108
+ ids,
109
+ copies: z.array(copy),
110
+ };
111
+ const year = z.number().int().positive();
112
+ const paper = z.discriminatedUnion("group", [
113
+ z.looseObject({
114
+ ...paperFields,
115
+ group: z.enum(["accepted", "award"]),
116
+ edition: year,
117
+ }),
118
+ z.looseObject({
119
+ ...paperFields,
120
+ group: z.literal("sister"),
121
+ venue: words,
122
+ year,
123
+ listed_from: webUrl,
124
+ }),
125
+ ]);
126
+ const edition = z.strictObject({
127
+ edition: year,
128
+ listed_from: webUrl,
129
+ read_on: date,
130
+ accepted: z.number().int().nonnegative().optional(),
131
+ });
132
+ /** Keys unique, editions unique, and every paper of this venue of a listed edition. */
133
+ const consistent = (r, ctx) => {
134
+ const years = r.editions.map((e) => e.edition);
135
+ repeats(years).forEach(([i]) => {
136
+ ctx.addIssue({
137
+ code: "custom",
138
+ path: ["editions", i, "edition"],
139
+ message: `${String(years[i])} is listed twice`,
140
+ });
141
+ });
142
+ const keys = r.papers.map((p) => p.key);
143
+ repeats(keys).forEach(([i, first]) => {
144
+ ctx.addIssue({
145
+ code: "custom",
146
+ path: ["papers", i, "key"],
147
+ message: `"${String(keys[i])}" is the key of papers.${String(first)} too`,
148
+ });
149
+ });
150
+ r.papers.forEach((p, i) => {
151
+ if (p.group !== "sister" && !years.includes(p.edition))
152
+ ctx.addIssue({
153
+ code: "custom",
154
+ path: ["papers", i, "edition"],
155
+ message: `${String(p.edition)} is not one of editions[].edition (${years.join(", ")})`,
156
+ });
157
+ });
158
+ };
159
+ const record = z
160
+ .strictObject({
161
+ venue: words,
162
+ editions: z.array(edition),
163
+ papers: z.array(paper),
164
+ })
165
+ .superRefine(consistent);
166
+ /** The proof is used, so the build checks it. */
167
+ export const SCHEMAS_ARE_THE_DOMAIN = true;
168
+ /** The JSON `text` holds, or undefined when it is not JSON. */
169
+ function jsonOf(text) {
170
+ try {
171
+ return JSON.parse(text);
172
+ }
173
+ catch {
174
+ return undefined;
175
+ }
176
+ }
177
+ /** A `papers.json`'s text, parsed once at the boundary: the record, or every reason it is not one. */
178
+ export function parseVenueCorpus(text) {
179
+ const json = jsonOf(text);
180
+ if (json === undefined)
181
+ return { ok: false, why: `${CORPUS_RECORD} is not JSON` };
182
+ const parsed = record.safeParse(json);
183
+ if (parsed.success)
184
+ return { ok: true, corpus: parsed.data };
185
+ const reasons = parsed.error.issues.map((i) => `${i.path.length === 0 ? "(top)" : i.path.join(".")}: ${i.message}`);
186
+ return { ok: false, why: `${CORPUS_RECORD}: ${reasons.join("; ")}` };
187
+ }
188
+ export const venueCorpusCodec = { parse: parseVenueCorpus };
189
+ /** Where the shipped JSON Schema of the record sits, below the package root: in the skill that writes it. */
190
+ export const SCHEMA_FILE = "skills/study-accepted-papers/papers.schema.json";
191
+ /**
192
+ * The JSON Schema of a `papers.json`, generated from the parser's own shape: the fields a skill (or
193
+ * an editor) reads instead of a hand-written table. Shipped as `SCHEMA_FILE`; a test holds the file
194
+ * to this. A schema cannot say that a key is unique, that a paper's edition is a listed one, or that
195
+ * a stored copy names where it was fetched from: `corpus-licences.js` checks those and names the
196
+ * field's path.
197
+ */
198
+ export const venueCorpusJsonSchema = () => ({
199
+ ...z.toJSONSchema(record, { io: "input", unrepresentable: "any" }),
200
+ title: "A venue corpus's papers.json",
201
+ description: "The record of a venue corpus, papers.json: one row per paper, every copy with its licence. This schema lists the fields; it cannot express that a key is unique, that a paper's edition is one of editions[].edition, or that a copy that stores a file names where it was fetched from. `node ${CLAUDE_SKILL_DIR}/scripts/corpus-licences.js <venue>` checks those and refuses a wrong record with the path of the field.",
202
+ });
203
+ /** The shipped file's text: the schema, indented, with a closing newline. */
204
+ export const venueCorpusSchemaText = () => `${JSON.stringify(venueCorpusJsonSchema(), null, 2)}\n`;
205
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/venue-corpus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,GAQf,MAAM,8BAA8B,CAAC;AAGtC,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AAC1B,4FAA4F;AAC5F,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC;IACnB,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE,0BAA0B;CAClC,CAAC,CAAC;AAEH,4FAA4F;AAC5F,MAAM,OAAO,GAAG,CACd,MAA0B,EACc,EAAE,CAC1C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IACtB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CA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,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,4ZAA4Z;CAC/Z,CAAC,CAAC;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAW,EAAE,CAChD,GAAG,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * THE LICENCE TABLE — what a copy's licence permits a venue corpus to store (docs/design/venue-corpus.md,
3
+ * decision 3). A corpus keeps third-party papers; each stored file is a copy of one version, judged by
4
+ * that copy's licence (`papers.json`, `src/domain/venue-corpus.ts`).
5
+ *
6
+ * Any SPDX id or `LicenseRef-…` is a licence id where the record is parsed; this table decides what
7
+ * one permits. An id it does not list permits nothing and is its own result, naming the id, so one
8
+ * `CC-BY-3.0` does not hide the rest of a record and a typo is still loud. `NOASSERTION` (the licence
9
+ * was not read) permits nothing, as its own result. A non-commercial licence permits storing only in a
10
+ * project that declares itself non-commercial: paperlint does not assume it.
11
+ *
12
+ * A version of a CC licence other than 4.0 gets its row when a corpus meets it.
13
+ */
14
+ /** What a corpus stores of a copy: its extracted text (every variant), or the PDF. */
15
+ export declare const STORED_KINDS: readonly ["text", "pdf"];
16
+ export type StoredKind = (typeof STORED_KINDS)[number];
17
+ /** SPDX's own id for "no licence information was given": here, the licence was not read. */
18
+ export declare const NOASSERTION = "NOASSERTION";
19
+ /** The project's one setting the table reads: it declares itself non-commercial. */
20
+ export interface LicenceSettings {
21
+ readonly nonCommercial: boolean;
22
+ }
23
+ /** What a licence permits for one kind: storing it, or the one reason it may not be stored. */
24
+ export type Permission = {
25
+ readonly kind: "permitted";
26
+ } | {
27
+ readonly kind: "forbidden";
28
+ readonly why: string;
29
+ }
30
+ /** A non-commercial licence, in a project that has not declared itself non-commercial. */
31
+ | {
32
+ readonly kind: "non-commercial-only";
33
+ }
34
+ /** `NOASSERTION`: no licence was read for the copy. */
35
+ | {
36
+ readonly kind: "not-read";
37
+ }
38
+ /** An id the table does not list. */
39
+ | {
40
+ readonly kind: "unlisted";
41
+ readonly id: string;
42
+ };
43
+ /**
44
+ * True for an SPDX license id's shape (letters, digits, `-` and `.`, and the deprecated `+` suffix)
45
+ * or a `LicenseRef-` of SPDX and REUSE; listed or not. An expression (`MIT OR Apache-2.0`), a phrase
46
+ * or a URL is not an id.
47
+ */
48
+ export declare const isLicenceId: (id: string) => boolean;
49
+ /** Whether a copy under licence `id` may be stored as `kind`, in a project of `settings`. */
50
+ export declare function permits(id: string, kind: StoredKind, settings: Readonly<LicenceSettings>): Permission;
51
+ //# sourceMappingURL=licence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"licence.d.ts","sourceRoot":"","sources":["../../src/domain/licence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,sFAAsF;AACtF,eAAO,MAAM,YAAY,0BAA2B,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,4FAA4F;AAC5F,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,oFAAoF;AACpF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,+FAA+F;AAC/F,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE;AACtD,0FAA0F;GACxF;IAAE,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE;AAC1C,uDAAuD;GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE;AAC/B,qCAAqC;GACnC;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAmCvD;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,KAAG,OACiC,CAAC;AAE3E,6FAA6F;AAC7F,wBAAgB,OAAO,CACrB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,GAClC,UAAU,CAWZ"}