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,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `corpus/record` — every copy a venue corpus stores in `pdf/` and `text/` is accounted for by its
|
|
3
|
+
* `papers.json` (docs/design/venue-corpus.md, decision 4; docs/rules/corpus/record.md). What is
|
|
4
|
+
* judged is `src/domain/corpus-record.ts`; this file reads the record through the codec, lists the
|
|
5
|
+
* corpus, and reports.
|
|
6
|
+
*
|
|
7
|
+
* ── WHERE IT REPORTS ─────────────────────────────────────────────────────────────
|
|
8
|
+
* On `<papers-root>/venues/<venue>/papers.json`, which `buildConfig` lints with ESLint's JSON
|
|
9
|
+
* language (`@eslint/json`): each finding at the field its path names, walked down the file's JSON
|
|
10
|
+
* tree; where the path stops being in the file (a required field left out), at the deepest part
|
|
11
|
+
* that is. A file that is not JSON never reaches the rule: ESLint reports its parse error. A corpus
|
|
12
|
+
* folder without `papers.json` has no file to report on, and this rule says nothing about it.
|
|
13
|
+
*/
|
|
14
|
+
import { dirname, join } from "node:path";
|
|
15
|
+
import { callerPath } from "./caller-path.js";
|
|
16
|
+
import { corpusMessage, judgeCorpus, } from "./domain/corpus-record.js";
|
|
17
|
+
import { rulePageUrl } from "./venue-rules.js";
|
|
18
|
+
/**
|
|
19
|
+
* One step of a path: a key to the member of that name (the last of them, as `JSON.parse` keeps it),
|
|
20
|
+
* whose whole `"key": value` is reported; an index to that element.
|
|
21
|
+
*/
|
|
22
|
+
const step = (at, segment) => {
|
|
23
|
+
const next = typeof segment === "number"
|
|
24
|
+
? at.node?.elements?.[segment]
|
|
25
|
+
: at.node?.members?.findLast((m) => m.name.value === segment);
|
|
26
|
+
return next === undefined
|
|
27
|
+
? { node: null, loc: at.loc }
|
|
28
|
+
: { node: next.value, loc: next.loc };
|
|
29
|
+
};
|
|
30
|
+
/** The span of the field `path` names; the whole file for an empty path. */
|
|
31
|
+
export const spanAt = (doc, path) => path.reduce(step, { node: doc.body, loc: doc.loc }).loc;
|
|
32
|
+
/** The entries of `dir` a person put there: hidden ones (`.DS_Store`, `.gitkeep`) are not copies. */
|
|
33
|
+
const visible = (dir, deps) => deps
|
|
34
|
+
.entries(callerPath(dir))
|
|
35
|
+
.filter((e) => !e.name.startsWith("."))
|
|
36
|
+
.map((e) => e.name)
|
|
37
|
+
.toSorted((a, b) => a.localeCompare(b));
|
|
38
|
+
/** The findings about the corpus whose `papers.json` is `file`, holding `text`. */
|
|
39
|
+
const findingsFor = (file, text, deps) => judgeCorpus({
|
|
40
|
+
record: deps.codec.parse(text),
|
|
41
|
+
stored: {
|
|
42
|
+
pdf: visible(join(dirname(file), "pdf"), deps),
|
|
43
|
+
text: visible(join(dirname(file), "text"), deps),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const META = {
|
|
47
|
+
type: "suggestion",
|
|
48
|
+
docs: {
|
|
49
|
+
description: "a venue corpus's papers.json is a record, every copy stored in pdf/ and text/ is claimed by one copy in it, and every claimed file is there",
|
|
50
|
+
url: rulePageUrl("corpus/record"),
|
|
51
|
+
},
|
|
52
|
+
schema: [],
|
|
53
|
+
// One id per finding, each with the whole text of `corpusMessage`.
|
|
54
|
+
messages: Object.fromEntries([
|
|
55
|
+
"unparsed",
|
|
56
|
+
"unclaimed",
|
|
57
|
+
"missing",
|
|
58
|
+
"twice",
|
|
59
|
+
].map((id) => [id, "{{text}}"])),
|
|
60
|
+
};
|
|
61
|
+
/** The rule, reading the corpus through `deps`. */
|
|
62
|
+
export function corpusRecordRules(deps) {
|
|
63
|
+
return {
|
|
64
|
+
record: {
|
|
65
|
+
meta: META,
|
|
66
|
+
create(context) {
|
|
67
|
+
return {
|
|
68
|
+
Document() {
|
|
69
|
+
const { text, ast } = context.sourceCode;
|
|
70
|
+
findingsFor(context.filename, text, deps).forEach((f) => {
|
|
71
|
+
context.report({
|
|
72
|
+
loc: spanAt(ast, f.at),
|
|
73
|
+
messageId: f.kind,
|
|
74
|
+
data: { text: corpusMessage(f) },
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** On by default, on every corpus's `papers.json`. */
|
|
84
|
+
export const CORPUS_RECORD_RULE_LEVELS = { "corpus/record": "error" };
|
|
85
|
+
//# sourceMappingURL=corpus-record-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-record-rule.js","sourceRoot":"","sources":["../src/corpus-record-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,WAAW,GAEZ,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA6D/C;;;GAGG;AACH,MAAM,IAAI,GAAG,CAAC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AAC,IAAI;gCACjB,IAAI,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE;6BACjC,CAAC,CAAC;wBACL,CAAC,CAAC,CAAC;oBACL,CAAC;iBACF,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAElC,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `corpus/record`'s judgement of one venue corpus (docs/design/venue-corpus.md, decisions 4–6;
|
|
3
|
+
* docs/rules/corpus/record.md): whether every copy stored in `pdf/` and `text/` is accounted for by
|
|
4
|
+
* `papers.json`. Pure: the folder's listing and the record, already parsed by the codec, in; the
|
|
5
|
+
* findings out. What the record's fields mean is `venue-corpus.ts`; this file never re-checks them.
|
|
6
|
+
*
|
|
7
|
+
* A stored file's path follows from its paper's `key` (decision 5): `pdf/<key>.pdf`,
|
|
8
|
+
* `text/<key>.txt` and `text/<key>.<variant>.txt`. The folder is named after the kind it holds.
|
|
9
|
+
*/
|
|
10
|
+
import { type StoredKind } from "./licence.ts";
|
|
11
|
+
import { type ParsedCorpus, type RecordPath } from "./venue-corpus.ts";
|
|
12
|
+
/** The folder in a papers root that holds one corpus per venue. */
|
|
13
|
+
export declare const CORPORA_DIR = "venues";
|
|
14
|
+
/** What the rule reads of one corpus folder. */
|
|
15
|
+
export interface CorpusFolder {
|
|
16
|
+
/** `papers.json`, as the codec parsed it. */
|
|
17
|
+
readonly record: ParsedCorpus;
|
|
18
|
+
/** The names in `pdf/` and in `text/`, hidden ones left out; none when the folder is absent. */
|
|
19
|
+
readonly stored: Readonly<Record<StoredKind, readonly string[]>>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One finding, with `at`, the path in `papers.json` it is reported at (empty: the whole file);
|
|
23
|
+
* `file` is relative to the corpus folder.
|
|
24
|
+
*/
|
|
25
|
+
export type CorpusFinding = {
|
|
26
|
+
readonly at: RecordPath;
|
|
27
|
+
} & ({
|
|
28
|
+
readonly kind: "unparsed";
|
|
29
|
+
readonly message: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: "unclaimed";
|
|
32
|
+
readonly file: string;
|
|
33
|
+
readonly key: string | null;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: "missing";
|
|
36
|
+
readonly key: string;
|
|
37
|
+
readonly stored: StoredKind;
|
|
38
|
+
readonly file: string;
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: "twice";
|
|
41
|
+
readonly key: string;
|
|
42
|
+
readonly stored: StoredKind;
|
|
43
|
+
readonly copies: readonly number[];
|
|
44
|
+
});
|
|
45
|
+
/** The key a stored file's name belongs to, or null when the name is not one a copy can store. */
|
|
46
|
+
export declare function storedKey(kind: StoredKind, name: string): string | null;
|
|
47
|
+
/** Every finding about one corpus folder; none for a corpus whose record accounts for each copy. */
|
|
48
|
+
export declare const judgeCorpus: (folder: CorpusFolder) => readonly CorpusFinding[];
|
|
49
|
+
/** The text of a finding: what is wrong, then what to do. */
|
|
50
|
+
export declare function corpusMessage(f: CorpusFinding): string;
|
|
51
|
+
//# sourceMappingURL=corpus-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-record.d.ts","sourceRoot":"","sources":["../../src/domain/corpus-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,mBAAmB,CAAC;AAE3B,mEAAmE;AACnE,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,gGAAgG;IAChG,QAAQ,CAAC,MAAM,E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
* docs/rules/corpus/record.md): whether every copy stored in `pdf/` and `text/` is accounted for by
|
|
4
|
+
* `papers.json`. Pure: the folder's listing and the record, already parsed by the codec, in; the
|
|
5
|
+
* findings out. What the record's fields mean is `venue-corpus.ts`; this file never re-checks them.
|
|
6
|
+
*
|
|
7
|
+
* A stored file's path follows from its paper's `key` (decision 5): `pdf/<key>.pdf`,
|
|
8
|
+
* `text/<key>.txt` and `text/<key>.<variant>.txt`. The folder is named after the kind it holds.
|
|
9
|
+
*/
|
|
10
|
+
import { STORED_KINDS } from "./licence.js";
|
|
11
|
+
import { CORPUS_RECORD, KEY_PATTERN, pathText, } from "./venue-corpus.js";
|
|
12
|
+
/** The folder in a papers root that holds one corpus per venue. */
|
|
13
|
+
export const CORPORA_DIR = "venues";
|
|
14
|
+
const keyOrNull = (key) => KEY_PATTERN.test(key) ? key : null;
|
|
15
|
+
/** The key a stored file's name belongs to, or null when the name is not one a copy can store. */
|
|
16
|
+
export function storedKey(kind, name) {
|
|
17
|
+
switch (kind) {
|
|
18
|
+
case "pdf":
|
|
19
|
+
return name.endsWith(".pdf") ? keyOrNull(name.slice(0, -4)) : null;
|
|
20
|
+
case "text": {
|
|
21
|
+
if (!name.endsWith(".txt"))
|
|
22
|
+
return null;
|
|
23
|
+
const [key = "", ...variant] = name.slice(0, -4).split(".");
|
|
24
|
+
return variant.length > 0 && variant.join(".") === ""
|
|
25
|
+
? null
|
|
26
|
+
: keyOrNull(key);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** The extension of a stored kind's file. */
|
|
31
|
+
const EXTENSION = {
|
|
32
|
+
pdf: "pdf",
|
|
33
|
+
text: "txt",
|
|
34
|
+
};
|
|
35
|
+
/** The name the record expects a paper's stored kind under, for a message. */
|
|
36
|
+
const expectedFile = (kind, key) => `${kind}/${key}.${EXTENSION[kind]}`;
|
|
37
|
+
/** The indexes of `p`'s copies that store `kind`. */
|
|
38
|
+
const storing = (p, kind) => p.copies.flatMap((c, i) => (c.stored.includes(kind) ? [i] : []));
|
|
39
|
+
/** The `stored` of a paper's copy (`copy` holds its index), as a path. */
|
|
40
|
+
const storedAt = (paper, copy) => [
|
|
41
|
+
"papers",
|
|
42
|
+
paper,
|
|
43
|
+
"copies",
|
|
44
|
+
...copy,
|
|
45
|
+
"stored",
|
|
46
|
+
];
|
|
47
|
+
/** A paper's kind stored by more than one of its copies, reported at the second one. */
|
|
48
|
+
const twice = (claims) => claims
|
|
49
|
+
.filter((c) => c.copies.length > 1)
|
|
50
|
+
.map((c) => ({
|
|
51
|
+
kind: "twice",
|
|
52
|
+
at: storedAt(c.paper, c.copies.slice(1, 2)),
|
|
53
|
+
key: c.key,
|
|
54
|
+
stored: c.kind,
|
|
55
|
+
copies: c.copies,
|
|
56
|
+
}));
|
|
57
|
+
/** A stored file no copy claims: at its paper's copies when the record lists the paper, else on the file. */
|
|
58
|
+
const unclaimed = (claims, stored) => STORED_KINDS.flatMap((kind) => stored[kind]
|
|
59
|
+
.map((name) => ({ name, key: storedKey(kind, name) }))
|
|
60
|
+
.filter((f) => !claims.some((c) => c.kind === kind && c.key === f.key && c.copies.length > 0))
|
|
61
|
+
.map((f) => ({
|
|
62
|
+
kind: "unclaimed",
|
|
63
|
+
at: atPaper(claims, f.key),
|
|
64
|
+
file: `${kind}/${f.name}`,
|
|
65
|
+
key: f.key,
|
|
66
|
+
})));
|
|
67
|
+
/** The copies of the paper `key` names, as a path; the whole file when no paper has that key. */
|
|
68
|
+
const atPaper = (claims, key) => {
|
|
69
|
+
const claim = claims.find((c) => c.key === key);
|
|
70
|
+
return claim === undefined ? [] : ["papers", claim.paper, "copies"];
|
|
71
|
+
};
|
|
72
|
+
/** A claimed kind with no file of its paper's key. */
|
|
73
|
+
const missing = (claims, stored) => claims
|
|
74
|
+
.filter((c) => c.copies.length > 0 &&
|
|
75
|
+
!stored[c.kind].some((name) => storedKey(c.kind, name) === c.key))
|
|
76
|
+
.map((c) => ({
|
|
77
|
+
kind: "missing",
|
|
78
|
+
at: storedAt(c.paper, c.copies.slice(0, 1)),
|
|
79
|
+
key: c.key,
|
|
80
|
+
stored: c.kind,
|
|
81
|
+
file: expectedFile(c.kind, c.key),
|
|
82
|
+
}));
|
|
83
|
+
/** What a read record says about the folder. */
|
|
84
|
+
function judgeRecord(corpus, stored) {
|
|
85
|
+
const claims = STORED_KINDS.flatMap((kind) => corpus.papers.map((p, paper) => ({
|
|
86
|
+
kind,
|
|
87
|
+
key: p.key,
|
|
88
|
+
paper,
|
|
89
|
+
copies: storing(p, kind),
|
|
90
|
+
})));
|
|
91
|
+
return [
|
|
92
|
+
...twice(claims),
|
|
93
|
+
...unclaimed(claims, stored),
|
|
94
|
+
...missing(claims, stored),
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
/** Every finding about one corpus folder; none for a corpus whose record accounts for each copy. */
|
|
98
|
+
export const judgeCorpus = (folder) => folder.record.ok
|
|
99
|
+
? judgeRecord(folder.record.corpus, folder.stored)
|
|
100
|
+
: folder.record.problems.map((p) => ({
|
|
101
|
+
kind: "unparsed",
|
|
102
|
+
at: p.path,
|
|
103
|
+
message: p.message,
|
|
104
|
+
}));
|
|
105
|
+
const KEEP_IDS = "or remove the file and keep the paper's ids in `papers.json`, which is all a corpus needs to measure against it";
|
|
106
|
+
/** The text of a finding: what is wrong, then what to do. */
|
|
107
|
+
export function corpusMessage(f) {
|
|
108
|
+
switch (f.kind) {
|
|
109
|
+
case "unparsed":
|
|
110
|
+
return `\`${pathText(f.at)}\`: ${f.message}. What to do: correct the field; the fields are in the JSON Schema \`papers.schema.json\` that \`study-accepted-papers\` ships`;
|
|
111
|
+
case "unclaimed":
|
|
112
|
+
return `\`${f.file}\` is stored, and no copy in \`${CORPUS_RECORD}\` claims it${f.key === null ? `: its name is not \`pdf/<key>.pdf\`, \`text/<key>.txt\` or \`text/<key>.<variant>.txt\`` : ` (no copy of the paper \`${f.key}\` lists it in \`stored\`)`}. What to do: record it under the copy it was fetched from, with \`fetched_from\`, its licence and where the licence was read; ${KEEP_IDS}`;
|
|
113
|
+
case "missing":
|
|
114
|
+
return `a copy of \`${f.key}\` stores \`${f.stored}\` in \`${CORPUS_RECORD}\`, and \`${f.file}\` is not there. What to do: put the file back, or remove \`"${f.stored}"\` from that copy's \`stored\``;
|
|
115
|
+
case "twice":
|
|
116
|
+
return `copies ${f.copies.join(" and ")} of \`${f.key}\` both store \`${f.stored}\`, and one stored file is a copy of one version. What to do: keep \`"${f.stored}"\` in the \`stored\` of the copy the file was fetched from, and remove it from the other`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=corpus-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-record.js","sourceRoot":"","sources":["../../src/domain/corpus-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAmB,MAAM,cAAc,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,WAAW,EACX,QAAQ,GAKT,MAAM,mBAAmB,CAAC;AAE3B,mEAAmE;AACnE,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAmCpC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAiB,EAAE,CAC/C,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAErC,kGAAkG;AAClG,MAAM,UAAU,SAAS,CAAC,IAAgB,EAAE,IAAY;IACtD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrE,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CA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Z,OAAO,eAAe,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,MAAM,WAAW,aAAa,aAAa,CAAC,CAAC,IAAI,gEAAgE,CAAC,CAAC,MAAM,iCAAiC,CAAC;QACzM,KAAK,OAAO;YACV,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,MAAM,yEAAyE,CAAC,CAAC,MAAM,2FAA2F,CAAC;IACjQ,CAAC;AACH,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"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 const STORED_KINDS = ["text", "pdf"];
|
|
16
|
+
/** SPDX's own id for "no licence information was given": here, the licence was not read. */
|
|
17
|
+
export const NOASSERTION = "NOASSERTION";
|
|
18
|
+
const ND = {
|
|
19
|
+
no: "ND permits reproduction in unmodified form; whether an extracted text is an adaptation is unsettled",
|
|
20
|
+
};
|
|
21
|
+
const ARXIV = {
|
|
22
|
+
no: 'it grants arXiv alone the right to distribute: "We are thus unable to grant others the right to distribute arXiv articles"',
|
|
23
|
+
};
|
|
24
|
+
const PUBLISHER = {
|
|
25
|
+
no: "the publisher grants no right to third parties",
|
|
26
|
+
};
|
|
27
|
+
/** The table: an id → what it grants for text and for the PDF. */
|
|
28
|
+
const TABLE = new Map([
|
|
29
|
+
["CC0-1.0", { text: "yes", pdf: "yes" }],
|
|
30
|
+
["CC-BY-4.0", { text: "yes", pdf: "yes" }],
|
|
31
|
+
["CC-BY-SA-4.0", { text: "yes", pdf: "yes" }],
|
|
32
|
+
["CC-BY-NC-4.0", { text: "non-commercial", pdf: "non-commercial" }],
|
|
33
|
+
["CC-BY-NC-SA-4.0", { text: "non-commercial", pdf: "non-commercial" }],
|
|
34
|
+
["CC-BY-ND-4.0", { text: ND, pdf: "yes" }],
|
|
35
|
+
["CC-BY-NC-ND-4.0", { text: ND, pdf: "non-commercial" }],
|
|
36
|
+
["LicenseRef-arxiv-nonexclusive-1.0", { text: ARXIV, pdf: ARXIV }],
|
|
37
|
+
["LicenseRef-publisher", { text: PUBLISHER, pdf: PUBLISHER }],
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* True for an SPDX license id's shape (letters, digits, `-` and `.`, and the deprecated `+` suffix)
|
|
41
|
+
* or a `LicenseRef-` of SPDX and REUSE; listed or not. An expression (`MIT OR Apache-2.0`), a phrase
|
|
42
|
+
* or a URL is not an id.
|
|
43
|
+
*/
|
|
44
|
+
export const isLicenceId = (id) => /^(?:LicenseRef-[A-Za-z0-9.-]+|[A-Za-z0-9][A-Za-z0-9.-]*\+?)$/u.test(id);
|
|
45
|
+
/** Whether a copy under licence `id` may be stored as `kind`, in a project of `settings`. */
|
|
46
|
+
export function permits(id, kind, settings) {
|
|
47
|
+
if (id === NOASSERTION)
|
|
48
|
+
return { kind: "not-read" };
|
|
49
|
+
const row = TABLE.get(id);
|
|
50
|
+
if (row === undefined)
|
|
51
|
+
return { kind: "unlisted", id };
|
|
52
|
+
const grant = row[kind];
|
|
53
|
+
if (grant === "yes")
|
|
54
|
+
return { kind: "permitted" };
|
|
55
|
+
if (grant === "non-commercial")
|
|
56
|
+
return settings.nonCommercial
|
|
57
|
+
? { kind: "permitted" }
|
|
58
|
+
: { kind: "non-commercial-only" };
|
|
59
|
+
return { kind: "forbidden", why: grant.no };
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=licence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"licence.js","sourceRoot":"","sources":["../../src/domain/licence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,CAAU,CAAC;AAGrD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AA0BzC,MAAM,EAAE,GAAG;IACT,EAAE,EAAE,qGAAqG;CACjG,CAAC;AAEX,MAAM,KAAK,GAAG;IACZ,EAAE,EAAE,4HAA4H;CACxH,CAAC;AAEX,MAAM,SAAS,GAAG;IAChB,EAAE,EAAE,gDAAgD;CAC5C,CAAC;AAEX,kEAAkE;AAClE,MAAM,KAAK,GAA6B,IAAI,GAAG,CAAc;IAC3D,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAA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,CAAC;IACxB,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAClD,IAAI,KAAK,KAAK,gBAAgB;QAC5B,OAAO,QAAQ,CAAC,aAAa;YAC3B,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE;YACvB,CAAC,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;IACtC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A VENUE CORPUS'S RECORD — `<papers-root>/venues/<venue>/papers.json` (docs/design/venue-corpus.md,
|
|
3
|
+
* decision 1; docs/venues.md): the papers a venue accepted and, for each, every copy we know of with
|
|
4
|
+
* its licence, and the facts of how the corpus was collected. Codes and measurements stay in
|
|
5
|
+
* `measurements.json`, keyed by a paper's `key`; only caveats stay prose, in an optional `MANIFEST.md`.
|
|
6
|
+
*
|
|
7
|
+
* The text of the file is checked once, where it enters: `VenueCorpusCodec`
|
|
8
|
+
* (`src/ports/venue-corpus-codec.ts`), whose adapter holds the zod schema of this shape. The domain
|
|
9
|
+
* holds the value: only the codec mints one, so a value built by hand can hold what the schema
|
|
10
|
+
* refuses (a stored copy without `fetched_from`, a key with a slash). The top level, an edition, a copy, its licence and a paper's ids are strict; a paper
|
|
11
|
+
* row keeps any further field as it is, because a consumer's own scripts read them.
|
|
12
|
+
*
|
|
13
|
+
* 🔴 A licence belongs to a copy, not to a paper (decision 2): the same paper is often CC BY in the
|
|
14
|
+
* proceedings and under arXiv's licence as a preprint, and a stored file is a copy of one version. What
|
|
15
|
+
* a licence permits is `src/domain/licence.ts`'s table.
|
|
16
|
+
*/
|
|
17
|
+
import type { NOASSERTION, StoredKind } from "./licence.ts";
|
|
18
|
+
export declare const CORPUS_RECORD = "papers.json";
|
|
19
|
+
/** `accepted` and `award` are this venue's; `sister`, a paper of another venue (corpus 2). */
|
|
20
|
+
export declare const PAPER_GROUPS: readonly ["accepted", "award", "sister"];
|
|
21
|
+
export type PaperGroup = (typeof PAPER_GROUPS)[number];
|
|
22
|
+
/** OpenAlex's `publishedVersion` / `acceptedVersion` / `submittedVersion`. */
|
|
23
|
+
export declare const KNOWN_VERSIONS: readonly ["published", "accepted", "preprint"];
|
|
24
|
+
export type KnownVersion = (typeof KNOWN_VERSIONS)[number];
|
|
25
|
+
/** The ids a paper may carry; `url` is its page on the listing, when nothing else identifies it. */
|
|
26
|
+
export declare const PAPER_ID_KINDS: readonly ["doi", "arxiv", "dblp", "s2", "url"];
|
|
27
|
+
/**
|
|
28
|
+
* A key names the stored files (`pdf/<key>.pdf`) and the measurement rows: one path segment, with
|
|
29
|
+
* no dot, because `text/<key>.<variant>.txt` is read up to the first dot. An arXiv id goes in `ids`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const KEY_PATTERN: RegExp;
|
|
32
|
+
/** One edition of this venue the corpus covers. */
|
|
33
|
+
export interface Edition {
|
|
34
|
+
readonly edition: number;
|
|
35
|
+
/** The page that lists what the edition accepted. */
|
|
36
|
+
readonly listed_from: string;
|
|
37
|
+
readonly read_on: string;
|
|
38
|
+
/** How many it accepted, when the page says. */
|
|
39
|
+
readonly accepted?: number | undefined;
|
|
40
|
+
/** What was left out of the edition and why; null when nothing was (never left out). */
|
|
41
|
+
readonly capped: string | null;
|
|
42
|
+
/** The stand-in for "strong accept" in this edition; null when it has none. */
|
|
43
|
+
readonly proxy: StrongAcceptProxy | null;
|
|
44
|
+
}
|
|
45
|
+
/** What stands in for "strong accept" (an award, an oral slot), and how many papers it marks. */
|
|
46
|
+
export interface StrongAcceptProxy {
|
|
47
|
+
readonly what: string;
|
|
48
|
+
readonly papers: number;
|
|
49
|
+
}
|
|
50
|
+
/** A licence read from a source, or `NOASSERTION`: none was read. */
|
|
51
|
+
export type Licence = {
|
|
52
|
+
readonly id: typeof NOASSERTION;
|
|
53
|
+
} | {
|
|
54
|
+
/** An SPDX id or a `LicenseRef-`. */
|
|
55
|
+
readonly id: string;
|
|
56
|
+
/** The page or API response it was read from, never inferred. */
|
|
57
|
+
readonly read_from: string;
|
|
58
|
+
readonly read_on: string;
|
|
59
|
+
};
|
|
60
|
+
/** What of a copy is in the corpus, and where its bytes came from. */
|
|
61
|
+
interface Storage {
|
|
62
|
+
/**
|
|
63
|
+
* Each kind at most once per copy (two copies of one paper storing one kind is `corpus/record`'s
|
|
64
|
+
* finding); `text` covers every text variant of the paper.
|
|
65
|
+
*/
|
|
66
|
+
readonly stored: readonly StoredKind[];
|
|
67
|
+
/** Present whenever `stored` is not empty. */
|
|
68
|
+
readonly fetched_from?: string | undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* One copy of a paper. A copy whose origin nobody recorded is `unknown`, and its licence is
|
|
72
|
+
* `NOASSERTION`, so it permits nothing.
|
|
73
|
+
*/
|
|
74
|
+
export type Copy = (Storage & {
|
|
75
|
+
readonly version: KnownVersion;
|
|
76
|
+
readonly url: string;
|
|
77
|
+
readonly licence: Licence;
|
|
78
|
+
}) | (Storage & {
|
|
79
|
+
readonly version: "unknown";
|
|
80
|
+
readonly licence: {
|
|
81
|
+
readonly id: typeof NOASSERTION;
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
export interface PaperIds {
|
|
85
|
+
readonly doi?: string | undefined;
|
|
86
|
+
readonly arxiv?: string | undefined;
|
|
87
|
+
readonly dblp?: string | undefined;
|
|
88
|
+
readonly s2?: string | undefined;
|
|
89
|
+
readonly url?: string | undefined;
|
|
90
|
+
}
|
|
91
|
+
interface PaperFields {
|
|
92
|
+
/** Unique in the file. */
|
|
93
|
+
readonly key: string;
|
|
94
|
+
readonly title: string;
|
|
95
|
+
readonly authors?: readonly string[] | undefined;
|
|
96
|
+
/** Kept as metadata whatever the copies' licences. */
|
|
97
|
+
/** `null` where the listing gave none. */
|
|
98
|
+
readonly abstract?: string | null | undefined;
|
|
99
|
+
/** At least one. */
|
|
100
|
+
readonly ids: PaperIds;
|
|
101
|
+
readonly copies: readonly Copy[];
|
|
102
|
+
readonly [extra: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
export type Paper = (PaperFields & {
|
|
105
|
+
readonly group: "accepted" | "award";
|
|
106
|
+
/** One of the record's `editions[].edition`. */
|
|
107
|
+
readonly edition: number;
|
|
108
|
+
}) | (PaperFields & {
|
|
109
|
+
readonly group: "sister";
|
|
110
|
+
readonly venue: string;
|
|
111
|
+
readonly year: number;
|
|
112
|
+
readonly listed_from: string;
|
|
113
|
+
});
|
|
114
|
+
export interface VenueCorpus {
|
|
115
|
+
/** The corpus folder's name: the venue preset's series. */
|
|
116
|
+
readonly venue: string;
|
|
117
|
+
readonly editions: readonly Edition[];
|
|
118
|
+
readonly papers: readonly Paper[];
|
|
119
|
+
/** The commands that regenerate the corpus, in order; empty when none was kept. */
|
|
120
|
+
readonly rebuild: readonly string[];
|
|
121
|
+
}
|
|
122
|
+
/** Where in a `papers.json` a problem is: keys and indexes from the top; empty for the whole file. */
|
|
123
|
+
export type RecordPath = readonly (string | number)[];
|
|
124
|
+
/** One reason a `papers.json` is not a record. */
|
|
125
|
+
export interface CorpusProblem {
|
|
126
|
+
readonly path: RecordPath;
|
|
127
|
+
readonly message: string;
|
|
128
|
+
}
|
|
129
|
+
/** A `papers.json`'s text, parsed: the record, or every reason it is not one. */
|
|
130
|
+
export type ParsedCorpus = {
|
|
131
|
+
readonly ok: true;
|
|
132
|
+
readonly corpus: VenueCorpus;
|
|
133
|
+
} | {
|
|
134
|
+
readonly ok: false;
|
|
135
|
+
readonly problems: readonly CorpusProblem[];
|
|
136
|
+
};
|
|
137
|
+
/** A path as a message names it: `papers.0.copies`, or `(top)` for the whole file. */
|
|
138
|
+
export declare const pathText: (path: RecordPath) => string;
|
|
139
|
+
/** Every problem on one line, each with its path. */
|
|
140
|
+
export declare const problemsText: (problems: readonly CorpusProblem[]) => string;
|
|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UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,iFAAiF;AACjF,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC;AAExE,sFAAsF;AACtF,eAAO,MAAM,QAAQ,GAAI,MAAM,UAAU,KAAG,MACE,CAAC;AAE/C,qDAAqD;AACrD,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,aAAa,EAAE,KAAG,MAC0B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const CORPUS_RECORD = "papers.json";
|
|
2
|
+
/** `accepted` and `award` are this venue's; `sister`, a paper of another venue (corpus 2). */
|
|
3
|
+
export const PAPER_GROUPS = ["accepted", "award", "sister"];
|
|
4
|
+
/** OpenAlex's `publishedVersion` / `acceptedVersion` / `submittedVersion`. */
|
|
5
|
+
export const KNOWN_VERSIONS = ["published", "accepted", "preprint"];
|
|
6
|
+
/** The ids a paper may carry; `url` is its page on the listing, when nothing else identifies it. */
|
|
7
|
+
export const PAPER_ID_KINDS = ["doi", "arxiv", "dblp", "s2", "url"];
|
|
8
|
+
/**
|
|
9
|
+
* A key names the stored files (`pdf/<key>.pdf`) and the measurement rows: one path segment, with
|
|
10
|
+
* no dot, because `text/<key>.<variant>.txt` is read up to the first dot. An arXiv id goes in `ids`.
|
|
11
|
+
*/
|
|
12
|
+
export const KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u;
|
|
13
|
+
/** A path as a message names it: `papers.0.copies`, or `(top)` for the whole file. */
|
|
14
|
+
export const pathText = (path) => path.length === 0 ? "(top)" : path.join(".");
|
|
15
|
+
/** Every problem on one line, each with its path. */
|
|
16
|
+
export const problemsText = (problems) => `${CORPUS_RECORD}: ${problems.map((p) => `${pathText(p.path)}: ${p.message}`).join("; ")}`;
|
|
17
|
+
//# sourceMappingURL=venue-corpus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"venue-corpus.js","sourceRoot":"","sources":["../../src/domain/venue-corpus.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC;AAE3C,8FAA8F;AAC9F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAGrE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAG7E,oGAAoG;AACpG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAE7E;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAqH1D,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAgB,EAAU,EAAE,CACnD,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAkC,EAAU,EAAE,CACzE,GAAG,aAAa,KAAK,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CLAUDE.md.spec.d.ts","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":";AAMA,
|
|
1
|
+
{"version":3,"file":"CLAUDE.md.spec.d.ts","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":";AAMA,wBA8CG"}
|
|
@@ -34,6 +34,7 @@ the checks push every paper toward a blog post.
|
|
|
34
34
|
tic, plus a check that no claim was softened or strengthened.`,
|
|
35
35
|
},
|
|
36
36
|
rules: {
|
|
37
|
+
"a-rule-id-names-its-subject": guidance("A rule id is `<family>/<rule>`: one slash, kebab-case, as ESLint's `plugin/rule`. The family is the folder or record the rule judges (`paper/`, `repro/`, `cycle/`, `corpus/`), never the kind of check and never a venue; a new family only when no existing one judges that subject. The same check keeps the same name in every family: `allowed-files-only` for a folder's whitelist of names, `record` for a record file read against its schema, `layout` for a folder's shape. So related rules sort together and a reader who knows one family can guess another's rule. The rule's page is `docs/rules/<family>/<rule>.md`, held by `src/rule-docs.test.ts`. The author asked for this on 2026-11-24."),
|
|
37
38
|
"lint-rule-over-script": guidance("A check over a syntax tree is a lint rule, not a script. It fires in the editor on save, gets the AST for free, and has a suppression syntax people already know. A script is for corpus-wide questions — index connectivity, ratios across many files. When the work has to run a program, a script may do the work and write facts to a JSON file, and a rule judges that file: the verdict still lands in the engine."),
|
|
38
39
|
"the-config-decides-where-a-rule-runs": guidance("A NEW decision about which files a rule runs on goes into the config, not into the rule. A rule judges its own subject wherever it is turned on; whether it applies to a paper at a given stage is a rule block the lint config builds (`paperRuleBlocks` in `src/cli.ts`): `files`, `ignores`, or a rule set to `off`, where a later block wins, as in ESLint. Example: a finished paper (accepted, camera-ready frozen) has its text and build rules turned off by `src/settled-paper.ts`, and no rule reads its cycles for that (#583, #553). Two older decisions still live inside rules and are not a precedent: `phase` set to `porting` silences the venue rules from inside them (`src/venue-rules.ts`), and the anonymity rules go quiet on an accepted cycle (`effectiveBlind`, `src/domain/cycle.ts`); #599 decides whether they move. The author decided this on 2026-11-23."),
|
|
39
40
|
"a-rule-is-configured-the-eslint-way": guidance('Provisional, pending #599 (the author is not sure it is right). A rule\'s own switches (what to require, a threshold, a file to compare) come from its options where it is turned on: `["warn", { … }]`. A new rule is not on by default and silent until some key of `paperlint.json` is declared: that hides a check behind a setting nobody sees in the rule list. A fact several rules share about a paper (its venue, cycles, artifact, talk) reaches them through ESLint\'s `settings`, filled once by `buildConfig` from `paperlint.json`; a rule does not open `paperlint.json` itself. A rule whose subject IS `paperlint.json` (it validates the config) is exempt. Where an outside service varies (an artifact host, a portal), the rule reads a file of facts a command wrote and never the service; the services are adapters behind a port, as `src/ports/submission-portal.ts` and `src/adapters/hotcrp/` are, and eslint-plugin-import\'s `settings["import/resolver"]` is the ESLint precedent. About 25 existing rules predate this; #599 decides whether to move them, narrow this rule, or drop it and allow a rule to read `paperlint.json`. The author proposed this on 2026-11-21.'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CLAUDE.md.spec.js","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,EAAE;AACF,gGAAgG;AAChG,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtE,eAAe,eAAe,CAAC;IAC7B,QAAQ,EAAE;QACR,iBAAiB,EAAE,KAAK,CAAA;;oBAER;QAEhB,+CAA+C,EAAE,KAAK,CAAA;;sEAEY,IAAI,CAAC,wBAAwB,CAAC;;0KAEsE,IAAI,CAAC,yCAAyC,CAAC;gHACzG,IAAI,CAAC,0CAA0C,CAAC,6NAA6N,IAAI,CAAC,8BAA8B,CAAC;2FACtU,IAAI,CAAC,uBAAuB,CAAC;wGAChB,IAAI,CAAC,6BAA6B,CAAC;;;kDAGzF,IAAI,CAAC,eAAe,CAAC,6BAA6B;QAEhG,0BAA0B,EAAE,KAAK,CAAA;;;;;;;;;;;;iEAY4B;KAC9D;IACD,KAAK,EAAE;QACL,uBAAuB,EAAE,QAAQ,CAC/B,0ZAA0Z,CAC3Z;QACD,sCAAsC,EAAE,QAAQ,CAC9C,01BAA01B,CAC31B;QACD,qCAAqC,EAAE,QAAQ,CAC7C,4oCAA4oC,CAC7oC;KACF;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"CLAUDE.md.spec.js","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,EAAE;AACF,gGAAgG;AAChG,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtE,eAAe,eAAe,CAAC;IAC7B,QAAQ,EAAE;QACR,iBAAiB,EAAE,KAAK,CAAA;;oBAER;QAEhB,+CAA+C,EAAE,KAAK,CAAA;;sEAEY,IAAI,CAAC,wBAAwB,CAAC;;0KAEsE,IAAI,CAAC,yCAAyC,CAAC;gHACzG,IAAI,CAAC,0CAA0C,CAAC,6NAA6N,IAAI,CAAC,8BAA8B,CAAC;2FACtU,IAAI,CAAC,uBAAuB,CAAC;wGAChB,IAAI,CAAC,6BAA6B,CAAC;;;kDAGzF,IAAI,CAAC,eAAe,CAAC,6BAA6B;QAEhG,0BAA0B,EAAE,KAAK,CAAA;;;;;;;;;;;;iEAY4B;KAC9D;IACD,KAAK,EAAE;QACL,6BAA6B,EAAE,QAAQ,CACrC,grBAAgrB,CACjrB;QACD,uBAAuB,EAAE,QAAQ,CAC/B,0ZAA0Z,CAC3Z;QACD,sCAAsC,EAAE,QAAQ,CAC9C,01BAA01B,CAC31B;QACD,qCAAqC,EAAE,QAAQ,CAC7C,4oCAA4oC,CAC7oC;KACF;CACF,CAAC,CAAC"}
|
package/dist/paper-files.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { ConfigBlock, RuleBlock, RuleEntry, StageLinterOptions } from "./ru
|
|
|
3
3
|
* Which papers' own files paperlint's blocks claim. `any` is the config's SHAPE, for the rule list and
|
|
4
4
|
* the docs: a file in any folder. `papers` is what `paperlint lint` runs on: the real papers, as glob
|
|
5
5
|
* prefixes relative to ESLint's `cwd` ("" for `cwd` itself), so a copy of a paper kept inside one (a
|
|
6
|
-
* review snapshot, a build copy) is claimed by no block (#582)
|
|
6
|
+
* review snapshot, a build copy) is claimed by no block (#582); and the papers roots (absolute),
|
|
7
|
+
* whose `venues/` hold the venue corpora.
|
|
7
8
|
*/
|
|
8
9
|
export type PaperScope = {
|
|
9
10
|
readonly kind: "any";
|
|
@@ -11,12 +12,18 @@ export type PaperScope = {
|
|
|
11
12
|
readonly kind: "papers";
|
|
12
13
|
readonly cwd: string;
|
|
13
14
|
readonly prefixes: readonly string[];
|
|
15
|
+
readonly roots: readonly string[];
|
|
14
16
|
};
|
|
15
17
|
export declare const ANY_PAPER: PaperScope;
|
|
16
|
-
/** The papers `dirs` under ESLint's `cwd`: the scope `paperlint lint` lints. Pure. */
|
|
17
|
-
export declare const papersScope: (dirs: readonly string[], cwd: string) => PaperScope;
|
|
18
|
+
/** The papers `dirs` and the papers `roots` under ESLint's `cwd`: the scope `paperlint lint` lints. Pure. */
|
|
19
|
+
export declare const papersScope: (dirs: readonly string[], cwd: string, roots: readonly string[]) => PaperScope;
|
|
18
20
|
/** A glob of a paper's own file (`paper.tex`, `reviews/*.md`) in each paper of `scope`. Pure. */
|
|
19
21
|
export declare const paperFiles: (scope: PaperScope, glob: string) => readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* A glob of a file in each venue corpus, `<papers-root>/venues/<venue>/<glob>`; none for a root
|
|
24
|
+
* outside ESLint's `cwd`, whose files ESLint never lints. Pure.
|
|
25
|
+
*/
|
|
26
|
+
export declare const corpusFiles: (scope: PaperScope, glob: string) => readonly string[];
|
|
20
27
|
/**
|
|
21
28
|
* A glob relative to `cwd`, as the block whose `basePath` is `base` must write it — ESLint reads a
|
|
22
29
|
* block's patterns from its `basePath`, and a paper's own settings carry the paper's folder. None
|