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.
- package/.claude-plugin/plugin.json +1 -1
- package/CLAUDE.md +5 -1
- package/dist/adapters/venue-corpus/index.d.ts +361 -0
- package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
- package/dist/adapters/venue-corpus/index.js +221 -0
- package/dist/adapters/venue-corpus/index.js.map +1 -0
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +42 -13
- package/dist/cli.js.map +1 -1
- package/dist/corpus-record-rule.d.ts +65 -0
- package/dist/corpus-record-rule.d.ts.map +1 -0
- package/dist/corpus-record-rule.js +85 -0
- package/dist/corpus-record-rule.js.map +1 -0
- package/dist/domain/corpus-record.d.ts +51 -0
- package/dist/domain/corpus-record.d.ts.map +1 -0
- package/dist/domain/corpus-record.js +119 -0
- package/dist/domain/corpus-record.js.map +1 -0
- package/dist/domain/licence.d.ts +51 -0
- package/dist/domain/licence.d.ts.map +1 -0
- package/dist/domain/licence.js +61 -0
- package/dist/domain/licence.js.map +1 -0
- package/dist/domain/venue-corpus.d.ts +142 -0
- package/dist/domain/venue-corpus.d.ts.map +1 -0
- package/dist/domain/venue-corpus.js +17 -0
- package/dist/domain/venue-corpus.js.map +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
- package/dist/paper-files.d.ts +10 -3
- package/dist/paper-files.d.ts.map +1 -1
- package/dist/paper-files.js +17 -2
- package/dist/paper-files.js.map +1 -1
- package/dist/papers-roots.d.ts +6 -0
- package/dist/papers-roots.d.ts.map +1 -1
- package/dist/papers-roots.js +14 -0
- package/dist/papers-roots.js.map +1 -1
- package/dist/ports/venue-corpus-codec.d.ts +11 -0
- package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
- package/dist/ports/venue-corpus-codec.js +2 -0
- package/dist/ports/venue-corpus-codec.js.map +1 -0
- package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
- package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
- package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
- package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
- package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
- package/docs/design/venue-corpus.md +271 -0
- package/docs/layout.md +2 -2
- package/docs/rules/corpus/record.md +119 -0
- package/docs/rules.md +1 -0
- package/docs/venues.md +158 -24
- package/eslint-rules/CLAUDE.md +5 -1
- package/eslint-rules/CLAUDE.md.spec.ts +3 -0
- package/eslint.config.mjs +1 -0
- package/package.json +3 -1
- package/scripts/bundle-skills.ts +1 -0
- package/scripts/eslint-file-length.mjs +3 -3
- package/scripts/venue-corpus-schema.test.ts +39 -0
- package/scripts/venue-corpus-schema.ts +17 -0
- package/skills/argument-arc/scripts/headings.js +6 -4
- package/skills/cold-read-diff/scripts/cold-read.js +6 -4
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +6 -5
- package/skills/pc-panel-review/scripts/prior-reviews.js +7 -5
- package/skills/study-accepted-papers/SKILL.md +34 -2
- package/skills/study-accepted-papers/SKILL.md.spec.ts +33 -1
- package/skills/study-accepted-papers/papers.schema.json +474 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +303 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.js +393 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +488 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
- package/skills/verify-citations/scripts/bib-authors.js +6 -5
- package/skills/verify-citations/scripts/verify-cites.js +6 -5
- package/src/adapters/venue-corpus/index.test.ts +337 -0
- package/src/adapters/venue-corpus/index.ts +306 -0
- package/src/cli-e2e.test.mjs +2 -2
- package/src/cli.test.ts +1 -1
- package/src/cli.ts +57 -13
- package/src/corpus-record-rule.test.ts +228 -0
- package/src/corpus-record-rule.ts +175 -0
- package/src/domain/corpus-record.test.ts +163 -0
- package/src/domain/corpus-record.ts +210 -0
- package/src/domain/licence.test.ts +122 -0
- package/src/domain/licence.ts +95 -0
- package/src/domain/venue-corpus.ts +159 -0
- package/src/paper-files.test.ts +13 -4
- package/src/paper-files.ts +23 -2
- package/src/paper-settings-commands.test.ts +2 -2
- package/src/papers-roots.test.ts +34 -1
- package/src/papers-roots.ts +15 -0
- package/src/ports/venue-corpus-codec.ts +11 -0
- package/src/rule-cases.test.ts +15 -0
- package/src/settled-paper.test.ts +1 -1
- package/src/unowned-file.test.ts +1 -1
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"venue": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"minLength": 1
|
|
8
|
+
},
|
|
9
|
+
"editions": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"edition": {
|
|
15
|
+
"type": "integer",
|
|
16
|
+
"exclusiveMinimum": 0,
|
|
17
|
+
"maximum": 9007199254740991
|
|
18
|
+
},
|
|
19
|
+
"listed_from": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "uri"
|
|
22
|
+
},
|
|
23
|
+
"read_on": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "date",
|
|
26
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
|
|
27
|
+
},
|
|
28
|
+
"accepted": {
|
|
29
|
+
"type": "integer",
|
|
30
|
+
"minimum": 0,
|
|
31
|
+
"maximum": 9007199254740991
|
|
32
|
+
},
|
|
33
|
+
"capped": {
|
|
34
|
+
"anyOf": [
|
|
35
|
+
{
|
|
36
|
+
"type": "string",
|
|
37
|
+
"minLength": 1
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "null"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"proxy": {
|
|
45
|
+
"anyOf": [
|
|
46
|
+
{
|
|
47
|
+
"type": "object",
|
|
48
|
+
"properties": {
|
|
49
|
+
"what": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"minLength": 1
|
|
52
|
+
},
|
|
53
|
+
"papers": {
|
|
54
|
+
"type": "integer",
|
|
55
|
+
"minimum": 0,
|
|
56
|
+
"maximum": 9007199254740991
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": [
|
|
60
|
+
"what",
|
|
61
|
+
"papers"
|
|
62
|
+
],
|
|
63
|
+
"additionalProperties": false
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "null"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": [
|
|
72
|
+
"edition",
|
|
73
|
+
"listed_from",
|
|
74
|
+
"read_on",
|
|
75
|
+
"capped",
|
|
76
|
+
"proxy"
|
|
77
|
+
],
|
|
78
|
+
"additionalProperties": false
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"papers": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"items": {
|
|
84
|
+
"oneOf": [
|
|
85
|
+
{
|
|
86
|
+
"type": "object",
|
|
87
|
+
"properties": {
|
|
88
|
+
"key": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
|
|
91
|
+
},
|
|
92
|
+
"title": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"minLength": 1
|
|
95
|
+
},
|
|
96
|
+
"authors": {
|
|
97
|
+
"type": "array",
|
|
98
|
+
"items": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"minLength": 1
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"abstract": {
|
|
104
|
+
"type": [
|
|
105
|
+
"string",
|
|
106
|
+
"null"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"ids": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"doi": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"minLength": 1
|
|
115
|
+
},
|
|
116
|
+
"arxiv": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"minLength": 1
|
|
119
|
+
},
|
|
120
|
+
"dblp": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"minLength": 1
|
|
123
|
+
},
|
|
124
|
+
"s2": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"minLength": 1
|
|
127
|
+
},
|
|
128
|
+
"url": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"format": "uri"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"additionalProperties": false
|
|
134
|
+
},
|
|
135
|
+
"copies": {
|
|
136
|
+
"type": "array",
|
|
137
|
+
"items": {
|
|
138
|
+
"oneOf": [
|
|
139
|
+
{
|
|
140
|
+
"type": "object",
|
|
141
|
+
"properties": {
|
|
142
|
+
"version": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"enum": [
|
|
145
|
+
"published",
|
|
146
|
+
"accepted",
|
|
147
|
+
"preprint"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"url": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"format": "uri"
|
|
153
|
+
},
|
|
154
|
+
"licence": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"properties": {
|
|
157
|
+
"id": {
|
|
158
|
+
"type": "string"
|
|
159
|
+
},
|
|
160
|
+
"read_from": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"format": "uri"
|
|
163
|
+
},
|
|
164
|
+
"read_on": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"format": "date",
|
|
167
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"required": [
|
|
171
|
+
"id"
|
|
172
|
+
],
|
|
173
|
+
"additionalProperties": false
|
|
174
|
+
},
|
|
175
|
+
"stored": {
|
|
176
|
+
"type": "array",
|
|
177
|
+
"items": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"enum": [
|
|
180
|
+
"text",
|
|
181
|
+
"pdf"
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"fetched_from": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"format": "uri"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"required": [
|
|
191
|
+
"version",
|
|
192
|
+
"url",
|
|
193
|
+
"licence",
|
|
194
|
+
"stored"
|
|
195
|
+
],
|
|
196
|
+
"additionalProperties": false
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"type": "object",
|
|
200
|
+
"properties": {
|
|
201
|
+
"version": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"const": "unknown"
|
|
204
|
+
},
|
|
205
|
+
"licence": {
|
|
206
|
+
"type": "object",
|
|
207
|
+
"properties": {
|
|
208
|
+
"id": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"const": "NOASSERTION"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"required": [
|
|
214
|
+
"id"
|
|
215
|
+
],
|
|
216
|
+
"additionalProperties": false
|
|
217
|
+
},
|
|
218
|
+
"stored": {
|
|
219
|
+
"type": "array",
|
|
220
|
+
"items": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"enum": [
|
|
223
|
+
"text",
|
|
224
|
+
"pdf"
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"fetched_from": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"format": "uri"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"required": [
|
|
234
|
+
"version",
|
|
235
|
+
"licence",
|
|
236
|
+
"stored"
|
|
237
|
+
],
|
|
238
|
+
"additionalProperties": false
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"group": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"enum": [
|
|
246
|
+
"accepted",
|
|
247
|
+
"award"
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
"edition": {
|
|
251
|
+
"type": "integer",
|
|
252
|
+
"exclusiveMinimum": 0,
|
|
253
|
+
"maximum": 9007199254740991
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"required": [
|
|
257
|
+
"key",
|
|
258
|
+
"title",
|
|
259
|
+
"ids",
|
|
260
|
+
"copies",
|
|
261
|
+
"group",
|
|
262
|
+
"edition"
|
|
263
|
+
],
|
|
264
|
+
"additionalProperties": {}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"type": "object",
|
|
268
|
+
"properties": {
|
|
269
|
+
"key": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
|
|
272
|
+
},
|
|
273
|
+
"title": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"minLength": 1
|
|
276
|
+
},
|
|
277
|
+
"authors": {
|
|
278
|
+
"type": "array",
|
|
279
|
+
"items": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"minLength": 1
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"abstract": {
|
|
285
|
+
"type": [
|
|
286
|
+
"string",
|
|
287
|
+
"null"
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
"ids": {
|
|
291
|
+
"type": "object",
|
|
292
|
+
"properties": {
|
|
293
|
+
"doi": {
|
|
294
|
+
"type": "string",
|
|
295
|
+
"minLength": 1
|
|
296
|
+
},
|
|
297
|
+
"arxiv": {
|
|
298
|
+
"type": "string",
|
|
299
|
+
"minLength": 1
|
|
300
|
+
},
|
|
301
|
+
"dblp": {
|
|
302
|
+
"type": "string",
|
|
303
|
+
"minLength": 1
|
|
304
|
+
},
|
|
305
|
+
"s2": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"minLength": 1
|
|
308
|
+
},
|
|
309
|
+
"url": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"format": "uri"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"additionalProperties": false
|
|
315
|
+
},
|
|
316
|
+
"copies": {
|
|
317
|
+
"type": "array",
|
|
318
|
+
"items": {
|
|
319
|
+
"oneOf": [
|
|
320
|
+
{
|
|
321
|
+
"type": "object",
|
|
322
|
+
"properties": {
|
|
323
|
+
"version": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"enum": [
|
|
326
|
+
"published",
|
|
327
|
+
"accepted",
|
|
328
|
+
"preprint"
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
"url": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"format": "uri"
|
|
334
|
+
},
|
|
335
|
+
"licence": {
|
|
336
|
+
"type": "object",
|
|
337
|
+
"properties": {
|
|
338
|
+
"id": {
|
|
339
|
+
"type": "string"
|
|
340
|
+
},
|
|
341
|
+
"read_from": {
|
|
342
|
+
"type": "string",
|
|
343
|
+
"format": "uri"
|
|
344
|
+
},
|
|
345
|
+
"read_on": {
|
|
346
|
+
"type": "string",
|
|
347
|
+
"format": "date",
|
|
348
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"required": [
|
|
352
|
+
"id"
|
|
353
|
+
],
|
|
354
|
+
"additionalProperties": false
|
|
355
|
+
},
|
|
356
|
+
"stored": {
|
|
357
|
+
"type": "array",
|
|
358
|
+
"items": {
|
|
359
|
+
"type": "string",
|
|
360
|
+
"enum": [
|
|
361
|
+
"text",
|
|
362
|
+
"pdf"
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"fetched_from": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"format": "uri"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"required": [
|
|
372
|
+
"version",
|
|
373
|
+
"url",
|
|
374
|
+
"licence",
|
|
375
|
+
"stored"
|
|
376
|
+
],
|
|
377
|
+
"additionalProperties": false
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"type": "object",
|
|
381
|
+
"properties": {
|
|
382
|
+
"version": {
|
|
383
|
+
"type": "string",
|
|
384
|
+
"const": "unknown"
|
|
385
|
+
},
|
|
386
|
+
"licence": {
|
|
387
|
+
"type": "object",
|
|
388
|
+
"properties": {
|
|
389
|
+
"id": {
|
|
390
|
+
"type": "string",
|
|
391
|
+
"const": "NOASSERTION"
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"required": [
|
|
395
|
+
"id"
|
|
396
|
+
],
|
|
397
|
+
"additionalProperties": false
|
|
398
|
+
},
|
|
399
|
+
"stored": {
|
|
400
|
+
"type": "array",
|
|
401
|
+
"items": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"enum": [
|
|
404
|
+
"text",
|
|
405
|
+
"pdf"
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"fetched_from": {
|
|
410
|
+
"type": "string",
|
|
411
|
+
"format": "uri"
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
"required": [
|
|
415
|
+
"version",
|
|
416
|
+
"licence",
|
|
417
|
+
"stored"
|
|
418
|
+
],
|
|
419
|
+
"additionalProperties": false
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"group": {
|
|
425
|
+
"type": "string",
|
|
426
|
+
"const": "sister"
|
|
427
|
+
},
|
|
428
|
+
"venue": {
|
|
429
|
+
"type": "string",
|
|
430
|
+
"minLength": 1
|
|
431
|
+
},
|
|
432
|
+
"year": {
|
|
433
|
+
"type": "integer",
|
|
434
|
+
"exclusiveMinimum": 0,
|
|
435
|
+
"maximum": 9007199254740991
|
|
436
|
+
},
|
|
437
|
+
"listed_from": {
|
|
438
|
+
"type": "string",
|
|
439
|
+
"format": "uri"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"required": [
|
|
443
|
+
"key",
|
|
444
|
+
"title",
|
|
445
|
+
"ids",
|
|
446
|
+
"copies",
|
|
447
|
+
"group",
|
|
448
|
+
"venue",
|
|
449
|
+
"year",
|
|
450
|
+
"listed_from"
|
|
451
|
+
],
|
|
452
|
+
"additionalProperties": {}
|
|
453
|
+
}
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
"rebuild": {
|
|
458
|
+
"type": "array",
|
|
459
|
+
"items": {
|
|
460
|
+
"type": "string",
|
|
461
|
+
"minLength": 1
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"required": [
|
|
466
|
+
"venue",
|
|
467
|
+
"editions",
|
|
468
|
+
"papers",
|
|
469
|
+
"rebuild"
|
|
470
|
+
],
|
|
471
|
+
"additionalProperties": false,
|
|
472
|
+
"title": "A venue corpus's papers.json",
|
|
473
|
+
"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."
|
|
474
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* corpus-licences-core — for each paper of a venue corpus's `papers.json` and each kind a corpus
|
|
3
|
+
* stores (its extracted text, its PDF), the copy whose licence permits keeping it, or each copy's
|
|
4
|
+
* reason it may not be kept. study-accepted-papers reads it before it downloads a PDF or extracts a
|
|
5
|
+
* text (docs/venues.md, "Licences"; docs/design/venue-corpus.md, decisions 2 and 3).
|
|
6
|
+
*
|
|
7
|
+
* The record is parsed by `VenueCorpusCodec`; what a licence permits is `src/domain/licence.ts`'s
|
|
8
|
+
* table, never restated here. The project's non-commercial setting arrives with `corpus/licence`;
|
|
9
|
+
* until then the runner judges as for a project that has not declared itself non-commercial.
|
|
10
|
+
* No model, no network.
|
|
11
|
+
*
|
|
12
|
+
* Usage: node corpus-licences.js <venue>
|
|
13
|
+
* The record is `<papers-root>/venues/<venue>/papers.json`: the project root is the git top level of
|
|
14
|
+
* the folder the command runs in, the papers roots are the project's `papersDir` (src/papers-roots.ts).
|
|
15
|
+
* Exit: 0 — one line per paper and kind · 1 — not in a git repository, no papers.json in any papers
|
|
16
|
+
* root or one in several, or it does not parse · 2 — no venue named, or not a folder name.
|
|
17
|
+
*/
|
|
18
|
+
import { dirname, join } from "node:path";
|
|
19
|
+
import { CONFIG_FILE, PAPERS_DIR_FIELD } from "#lib/paper-config";
|
|
20
|
+
import { callerPath } from "#src/caller-path";
|
|
21
|
+
import { permits, STORED_KINDS, } from "#src/domain/licence";
|
|
22
|
+
import { CORPUS_RECORD, problemsText, } from "#src/domain/venue-corpus";
|
|
23
|
+
import { papersRoots } from "#src/papers-roots";
|
|
24
|
+
const isRefused = (j) => j.permission.kind !== "permitted";
|
|
25
|
+
/** The first copy, in the record's order, whose licence permits the kind. */
|
|
26
|
+
const keptOf = (judged) => judged
|
|
27
|
+
.map((j) => j.copy)
|
|
28
|
+
.find((c, i) => judged[i]?.permission.kind === "permitted" && c.version !== "unknown");
|
|
29
|
+
/** Every copy that may not be kept as the kind, with why. */
|
|
30
|
+
const refusalsOf = (judged) => judged.filter(isRefused).map((j) => ({
|
|
31
|
+
version: j.copy.version,
|
|
32
|
+
licence: j.copy.licence.id,
|
|
33
|
+
permission: j.permission,
|
|
34
|
+
}));
|
|
35
|
+
/** The verdict for one paper and one kind: the copy to keep, or every copy's refusal. */
|
|
36
|
+
function verdictOf(paper, stored, settings) {
|
|
37
|
+
const judged = paper.copies.map((copy) => ({
|
|
38
|
+
copy,
|
|
39
|
+
permission: permits(copy.licence.id, stored, settings),
|
|
40
|
+
}));
|
|
41
|
+
const kept = keptOf(judged);
|
|
42
|
+
const { key } = paper;
|
|
43
|
+
return kept === undefined
|
|
44
|
+
? {
|
|
45
|
+
key,
|
|
46
|
+
stored,
|
|
47
|
+
outcome: "none",
|
|
48
|
+
refusals: refusalsOf(judged),
|
|
49
|
+
}
|
|
50
|
+
: {
|
|
51
|
+
key,
|
|
52
|
+
stored,
|
|
53
|
+
outcome: "keep",
|
|
54
|
+
version: kept.version,
|
|
55
|
+
licence: kept.licence.id,
|
|
56
|
+
url: kept.url,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Every paper's verdict for each kind, in the record's order. */
|
|
60
|
+
export const verdicts = (corpus, settings) => corpus.papers.flatMap((p) => STORED_KINDS.map((kind) => verdictOf(p, kind, settings)));
|
|
61
|
+
/** Why a copy may not be kept, in words. */
|
|
62
|
+
function reason(r) {
|
|
63
|
+
switch (r.permission.kind) {
|
|
64
|
+
case "forbidden":
|
|
65
|
+
return `${r.licence}: ${r.permission.why}`;
|
|
66
|
+
case "non-commercial-only":
|
|
67
|
+
return `${r.licence} permits it only in a project declared non-commercial`;
|
|
68
|
+
case "not-read":
|
|
69
|
+
return "its licence was not read (NOASSERTION)";
|
|
70
|
+
case "unlisted":
|
|
71
|
+
return `${r.permission.id} is not in the licence table, so it permits nothing`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** One verdict as the line the command prints. */
|
|
75
|
+
function line(v) {
|
|
76
|
+
const what = v.outcome === "keep"
|
|
77
|
+
? `keep the ${v.version} copy (${v.licence}), ${v.url}`
|
|
78
|
+
: v.refusals.length === 0
|
|
79
|
+
? "none: no copy recorded"
|
|
80
|
+
: `none: ${v.refusals.map((r) => `${r.version}: ${reason(r)}`).join("; ")}`;
|
|
81
|
+
return `${v.key} ${v.stored}: ${what}`;
|
|
82
|
+
}
|
|
83
|
+
/** What the command prints for `all`. */
|
|
84
|
+
export const listing = (all) => all.length === 0
|
|
85
|
+
? `${CORPUS_RECORD} holds no paper\n`
|
|
86
|
+
: `${all.map(line).join("\n")}\n`;
|
|
87
|
+
/**
|
|
88
|
+
* `git rev-parse --show-toplevel` in `cwd`: the project's root, or null outside a repository (or
|
|
89
|
+
* when git did not run). `path` is the caller's PATH, the only variable git is given.
|
|
90
|
+
*/
|
|
91
|
+
export function gitTopLevel(git, path, cwd) {
|
|
92
|
+
const r = git.run({
|
|
93
|
+
file: "git",
|
|
94
|
+
args: ["rev-parse", "--show-toplevel"],
|
|
95
|
+
env: { PATH: path ?? "" },
|
|
96
|
+
timeoutMs: 10_000,
|
|
97
|
+
cwd: callerPath(cwd),
|
|
98
|
+
});
|
|
99
|
+
const top = r.kind === "exited" && r.status === 0 ? r.stdout.trim() : "";
|
|
100
|
+
return top === "" ? null : top;
|
|
101
|
+
}
|
|
102
|
+
/** The project's setting the table reads, until `corpus/licence` ships it: not declared. */
|
|
103
|
+
const UNDECLARED = { nonCommercial: false };
|
|
104
|
+
/** A venue is one folder name: no separator, and not a way up. */
|
|
105
|
+
const VENUE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/u;
|
|
106
|
+
const USAGE = "usage: node corpus-licences.js <venue>\n";
|
|
107
|
+
/** The project's `papersDir` setting, read through the disk port; absent file, default setting. */
|
|
108
|
+
function settingsOf(files, root) {
|
|
109
|
+
const file = join(root, CONFIG_FILE);
|
|
110
|
+
const bytes = files.readBytes(callerPath(file));
|
|
111
|
+
if (bytes === null)
|
|
112
|
+
return { ok: true, opts: {} };
|
|
113
|
+
const parsed = jsonOf(new TextDecoder().decode(bytes));
|
|
114
|
+
if (parsed === undefined)
|
|
115
|
+
return { ok: false, why: `${file} is not JSON` };
|
|
116
|
+
return {
|
|
117
|
+
ok: true,
|
|
118
|
+
opts: isObject(parsed)
|
|
119
|
+
? { [PAPERS_DIR_FIELD]: parsed[PAPERS_DIR_FIELD] }
|
|
120
|
+
: {},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
124
|
+
/** The JSON `text` holds, or undefined when it is not JSON. */
|
|
125
|
+
function jsonOf(text) {
|
|
126
|
+
try {
|
|
127
|
+
return JSON.parse(text);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** The one `papers.json` of `venue` among the project's papers roots, or why there is not exactly one. */
|
|
134
|
+
function recordOf(deps, venue) {
|
|
135
|
+
const root = deps.projectRoot(deps.cwd);
|
|
136
|
+
if (root === null)
|
|
137
|
+
return {
|
|
138
|
+
ok: false,
|
|
139
|
+
why: `${deps.cwd} is not inside a git repository: run it in the project`,
|
|
140
|
+
};
|
|
141
|
+
const settings = settingsOf(deps.files, root);
|
|
142
|
+
if (!settings.ok)
|
|
143
|
+
return settings;
|
|
144
|
+
const looked = papersRoots({ opts: settings.opts, root }).map((papers) => join(papers, "venues", venue, CORPUS_RECORD));
|
|
145
|
+
const found = looked.filter((f) => deps.files.isFile(callerPath(f)));
|
|
146
|
+
const [only] = found;
|
|
147
|
+
if (only !== undefined && found.length === 1)
|
|
148
|
+
return { ok: true, file: only };
|
|
149
|
+
return {
|
|
150
|
+
ok: false,
|
|
151
|
+
why: found.length === 0
|
|
152
|
+
? `no ${CORPUS_RECORD} for venue "${venue}": looked in ${looked.map((f) => dirname(f)).join(", ")}; write the record first`
|
|
153
|
+
: `venue "${venue}" is in more than one papers folder: ${found.map((f) => dirname(f)).join(", ")}`,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/** Run the command on `argv`; the exit code. */
|
|
157
|
+
export function main(argv, deps, { out, err }) {
|
|
158
|
+
const [venue, ...rest] = argv;
|
|
159
|
+
if (venue === undefined || rest.length > 0 || !VENUE.test(venue)) {
|
|
160
|
+
err(USAGE);
|
|
161
|
+
return 2;
|
|
162
|
+
}
|
|
163
|
+
const at = recordOf(deps, venue);
|
|
164
|
+
if (!at.ok) {
|
|
165
|
+
err(`corpus-licences: ${at.why}\n`);
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
const bytes = deps.files.readBytes(callerPath(at.file));
|
|
169
|
+
if (bytes === null) {
|
|
170
|
+
err(`corpus-licences: ${at.file} could not be read\n`);
|
|
171
|
+
return 1;
|
|
172
|
+
}
|
|
173
|
+
const parsed = deps.codec.parse(new TextDecoder().decode(bytes));
|
|
174
|
+
if (!parsed.ok) {
|
|
175
|
+
err(`corpus-licences: ${problemsText(parsed.problems)}\n`);
|
|
176
|
+
return 1;
|
|
177
|
+
}
|
|
178
|
+
out(listing(verdicts(parsed.corpus, UNDECLARED)));
|
|
179
|
+
return 0;
|
|
180
|
+
}
|