paperlint 10.1.1 → 10.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.
- package/README.md +2 -0
- package/dist/adapters/study-registry/index.d.ts +6 -0
- package/dist/adapters/study-registry/index.d.ts.map +1 -0
- package/dist/adapters/study-registry/index.js +58 -0
- package/dist/adapters/study-registry/index.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +40 -2
- package/dist/cli.js.map +1 -1
- package/dist/domain/repro-layout.d.ts +12 -4
- package/dist/domain/repro-layout.d.ts.map +1 -1
- package/dist/domain/repro-layout.js +49 -18
- package/dist/domain/repro-layout.js.map +1 -1
- package/dist/domain/scaffold-layout.d.ts +4 -3
- package/dist/domain/scaffold-layout.d.ts.map +1 -1
- package/dist/domain/scaffold-layout.js +7 -4
- package/dist/domain/scaffold-layout.js.map +1 -1
- package/dist/domain/study-registry.d.ts +176 -0
- package/dist/domain/study-registry.d.ts.map +1 -0
- package/dist/domain/study-registry.js +371 -0
- package/dist/domain/study-registry.js.map +1 -0
- package/dist/ports/study-registry-codec.d.ts +11 -0
- package/dist/ports/study-registry-codec.d.ts.map +1 -0
- package/dist/ports/study-registry-codec.js +2 -0
- package/dist/ports/study-registry-codec.js.map +1 -0
- package/dist/repro-layout-rule.d.ts.map +1 -1
- package/dist/repro-layout-rule.js +4 -3
- package/dist/repro-layout-rule.js.map +1 -1
- package/dist/studies.d.ts +27 -0
- package/dist/studies.d.ts.map +1 -0
- package/dist/studies.js +160 -0
- package/dist/studies.js.map +1 -0
- package/dist/study-registry-rule.d.ts +17 -0
- package/dist/study-registry-rule.d.ts.map +1 -0
- package/dist/study-registry-rule.js +115 -0
- package/dist/study-registry-rule.js.map +1 -0
- package/docs/design/study-registry.md +130 -0
- package/docs/layout.md +47 -44
- package/docs/rules/paper/allowed-files-only.md +3 -2
- package/docs/rules/repro/allowed-files-only.md +40 -30
- package/docs/rules/repro/study-registered.md +162 -0
- package/docs/rules/study/declare-sample.md +1 -1
- package/docs/rules.md +2 -1
- package/package.json +1 -1
- package/skills/build-benchmark/SKILL.md +20 -1
- package/skills/build-benchmark/SKILL.md.spec.ts +19 -0
- package/skills/build-label-page/SKILL.md +7 -4
- package/skills/build-label-page/SKILL.md.spec.ts +6 -3
- package/skills/paper-pipeline/references/artifact-checklist.md +2 -1
- package/skills/paper-pipeline/references/pipeline-status-template.md +5 -3
- package/skills/run-agent-grid/SKILL.md +8 -1
- package/skills/run-agent-grid/SKILL.md.spec.ts +7 -0
- package/src/adapters/study-registry/index.test.ts +144 -0
- package/src/adapters/study-registry/index.ts +70 -0
- package/src/cli.ts +51 -2
- package/src/domain/paper-layout.test.ts +1 -1
- package/src/domain/repro-layout.test.ts +18 -9
- package/src/domain/repro-layout.ts +58 -18
- package/src/domain/scaffold-layout.ts +7 -4
- package/src/domain/study-registry.test.ts +657 -0
- package/src/domain/study-registry.ts +598 -0
- package/src/folder-layout-hook.test.ts +10 -0
- package/src/new-paper.test.ts +28 -2
- package/src/ports/study-registry-codec.ts +11 -0
- package/src/repro-layout-rule.ts +4 -3
- package/src/rule-cases.test.ts +41 -0
- package/src/studies-cli.test.ts +113 -0
- package/src/studies.test.ts +353 -0
- package/src/studies.ts +259 -0
- package/src/study-registry-rule.test.ts +317 -0
- package/src/study-registry-rule.ts +172 -0
|
@@ -7,15 +7,21 @@
|
|
|
7
7
|
* where a new run goes. The layout gives each kind of material one place:
|
|
8
8
|
*
|
|
9
9
|
* repro/
|
|
10
|
-
* ├── README.md the index: one line per study
|
|
11
|
-
* ├──
|
|
10
|
+
* ├── README.md the index: one line per study, generated from studies.json
|
|
11
|
+
* ├── studies.json the study registry: one row per study (src/domain/study-registry.ts)
|
|
12
|
+
* ├── <id>-<slug>/ one folder per study or spike, named by its row, with a README.md inside
|
|
12
13
|
* ├── tools/ scripts used across the paper (numbers, figures, anonymity check, harnesses)
|
|
13
14
|
* └── data/ shared data (tables, caches)
|
|
14
15
|
*
|
|
15
16
|
* plus `.gitignore`. A loose note belongs in its study's folder or in the paper's `research/`.
|
|
16
17
|
*
|
|
17
|
-
* ──
|
|
18
|
-
* `<slug
|
|
18
|
+
* ── A STUDY'S NAME ───────────────────────────────────────────────────────────────
|
|
19
|
+
* `<id>-<slug>` (`P1-S03-baseline`): the id of the study's row in `repro/studies.json` — the paper's
|
|
20
|
+
* prefix, `-S`, two or more digits — then the slug. Whether the id has a row, and the row this folder,
|
|
21
|
+
* is `repro/study-registered`'s question; this layout only accepts the shape.
|
|
22
|
+
*
|
|
23
|
+
* The older form, `<slug>-YYYY-MM-DD`, stays accepted, so a paper that turned the registry off is not
|
|
24
|
+
* broken: the date is the day the study began. `<slug>-YYYY-MM` is accepted too: a study that ran
|
|
19
25
|
* over weeks (labelling, a reading of a corpus) has a month as its honest date, and both forms sort
|
|
20
26
|
* by time. The date must be a real one (no month 13, no 30 February). The slug is lowercase letters
|
|
21
27
|
* and digits in words joined by single hyphens.
|
|
@@ -30,11 +36,20 @@ import { extname } from "node:path";
|
|
|
30
36
|
import { leaf, renderTree } from "./layout-tree.js";
|
|
31
37
|
/** The folder this layout governs, at the paper folder's root. */
|
|
32
38
|
export const REPRO_DIR = "repro";
|
|
39
|
+
/** The study registry, at the top of `repro/` (src/domain/study-registry.ts). */
|
|
40
|
+
export const STUDIES_FILE = "studies.json";
|
|
33
41
|
/** The index at the top of `repro/`, and the file every study folder holds. */
|
|
34
42
|
export const README = "README.md";
|
|
35
43
|
/** The files `repro/` may hold at its top, by exact name. */
|
|
36
44
|
export const REPRO_FILE_NOTES = [
|
|
37
|
-
{
|
|
45
|
+
{
|
|
46
|
+
name: README,
|
|
47
|
+
note: "the index: one line per study, generated from studies.json",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: STUDIES_FILE,
|
|
51
|
+
note: "the study registry: id, title, status and result of each study",
|
|
52
|
+
},
|
|
38
53
|
{ name: ".gitignore", note: "keeps the scripts' byproducts out of git" },
|
|
39
54
|
];
|
|
40
55
|
export const REPRO_FILES = REPRO_FILE_NOTES.map((f) => f.name);
|
|
@@ -51,8 +66,8 @@ export const REPRO_DIR_NOTES = [
|
|
|
51
66
|
export const REPRO_DIRS = REPRO_DIR_NOTES.map((d) => d.name);
|
|
52
67
|
/** The study folder as the layout draws it: the name pattern, and the README.md it must hold. */
|
|
53
68
|
const STUDY_NODE = {
|
|
54
|
-
name: "<slug
|
|
55
|
-
note: "one folder per study or spike
|
|
69
|
+
name: "<id>-<slug>/",
|
|
70
|
+
note: "one folder per study or spike, named by its row in studies.json (P1-S03-baseline)",
|
|
56
71
|
children: [
|
|
57
72
|
leaf(README, "required: what it asks, how to run it, what it found"),
|
|
58
73
|
],
|
|
@@ -80,13 +95,19 @@ export const REPRO_BYPRODUCTS = [
|
|
|
80
95
|
".DS_Store",
|
|
81
96
|
"Thumbs.db",
|
|
82
97
|
];
|
|
83
|
-
/** A
|
|
98
|
+
/** A slug: lowercase letters and digits, in words joined by single hyphens. */
|
|
99
|
+
export const STUDY_SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
100
|
+
/** A dated study's name: a slug, then the year, the month, and optionally the day it began. */
|
|
84
101
|
const STUDY_NAME = /^([a-z0-9]+(?:-[a-z0-9]+)*)-(\d{4})-(\d{2})(?:-(\d{2}))?$/u;
|
|
102
|
+
/** A registered study's name: the id (a prefix, `-S`, two or more digits), then the slug. */
|
|
103
|
+
const REGISTERED_STUDY_NAME = /^[A-Z][A-Z0-9]*-S\d{2,}-[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
104
|
+
/** Whether `name` is a registered study folder's: `<id>-<slug>`, as `P1-S03-baseline`. */
|
|
105
|
+
export const isRegisteredStudyName = (name) => REGISTERED_STUDY_NAME.test(name);
|
|
85
106
|
const isLeapYear = (y) => (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0;
|
|
86
107
|
/** The days in month `m` (1–12) of year `y`. */
|
|
87
108
|
const daysIn = (y, m) => m === 2 ? (isLeapYear(y) ? 29 : 28) : [4, 6, 9, 11].includes(m) ? 30 : 31;
|
|
88
|
-
/** Whether `name` is a study folder's: `<slug>-YYYY-MM-DD` or `<slug>-YYYY-MM`, a real date. */
|
|
89
|
-
|
|
109
|
+
/** Whether `name` is a dated study folder's: `<slug>-YYYY-MM-DD` or `<slug>-YYYY-MM`, a real date. */
|
|
110
|
+
function isDatedStudyName(name) {
|
|
90
111
|
const m = STUDY_NAME.exec(name);
|
|
91
112
|
if (m === null)
|
|
92
113
|
return false;
|
|
@@ -95,6 +116,8 @@ export function isStudyName(name) {
|
|
|
95
116
|
const day = m[4] === undefined ? 1 : Number(m[4]);
|
|
96
117
|
return month >= 1 && month <= 12 && day >= 1 && day <= daysIn(year, month);
|
|
97
118
|
}
|
|
119
|
+
/** Whether `name` is a study folder's: `<id>-<slug>`, or the dated `<slug>-YYYY-MM-DD` / `<slug>-YYYY-MM`. */
|
|
120
|
+
export const isStudyName = (name) => isRegisteredStudyName(name) || isDatedStudyName(name);
|
|
98
121
|
/**
|
|
99
122
|
* The study name to suggest for a folder named `name`: its name as a slug, with the date to fill in.
|
|
100
123
|
* A name that becomes a study name once lowercased and hyphenated is suggested as it is.
|
|
@@ -104,10 +127,18 @@ export function suggestedStudyName(name) {
|
|
|
104
127
|
.toLowerCase()
|
|
105
128
|
.replace(/[^a-z0-9]+/gu, "-")
|
|
106
129
|
.replace(/^-+|-+$/gu, "");
|
|
107
|
-
if (
|
|
130
|
+
if (isDatedStudyName(slug))
|
|
108
131
|
return slug;
|
|
109
|
-
|
|
110
|
-
|
|
132
|
+
return `${suggestedSlug(name)}-YYYY-MM-DD`;
|
|
133
|
+
}
|
|
134
|
+
/** The slug to suggest for a folder named `name`: its name as a slug, any trailing date dropped. */
|
|
135
|
+
export function suggestedSlug(name) {
|
|
136
|
+
const base = name
|
|
137
|
+
.toLowerCase()
|
|
138
|
+
.replace(/[^a-z0-9]+/gu, "-")
|
|
139
|
+
.replace(/^-+|-+$/gu, "")
|
|
140
|
+
.replace(/(?:^|-)\d{4}(?:-\d{1,2}){0,2}$/u, "");
|
|
141
|
+
return base === "" ? "<slug>" : base;
|
|
111
142
|
}
|
|
112
143
|
/** The extensions of a script: what a study or the paper's build runs. */
|
|
113
144
|
export const SCRIPT_EXTENSIONS = [
|
|
@@ -169,9 +200,9 @@ export const SCRIPT_CURE = "repro/tools/ — the scripts used across the paper (
|
|
|
169
200
|
/** Where data goes. */
|
|
170
201
|
export const DATA_CURE = "repro/data/ — the data shared across the paper (tables, caches); what one study's run produced goes in that study's folder instead";
|
|
171
202
|
/** Where a note goes. */
|
|
172
|
-
export const NOTE_CURE = "the
|
|
203
|
+
export const NOTE_CURE = "the folder of the study it is about (repro/<id>-<slug>/), or the paper's research/ when it is research or a decision rather than the record of a run";
|
|
173
204
|
/** Where a file of any other kind goes. */
|
|
174
|
-
export const FILE_CURE_BY_KIND = "decide by what it is — a script → repro/tools/; data → repro/data/; a note → the
|
|
205
|
+
export const FILE_CURE_BY_KIND = "decide by what it is — a script → repro/tools/; data → repro/data/; a note → the folder of its study, or the paper's research/; what one study produced → that study's folder";
|
|
175
206
|
/** The files paperlint itself once kept at the top of `repro/`, each with where it is read now. */
|
|
176
207
|
export const MOVED_FILES = [
|
|
177
208
|
{
|
|
@@ -202,7 +233,7 @@ function fileCure(name) {
|
|
|
202
233
|
return FILE_CURE_BY_KIND;
|
|
203
234
|
}
|
|
204
235
|
/** Where a folder with no study name goes: renamed as a study, or emptied into the shared folders. */
|
|
205
|
-
const folderCure = (name) => `rename it to
|
|
236
|
+
const folderCure = (name) => `rename it to \`<id>-${suggestedSlug(name)}\` — the next free id in repro/${STUDIES_FILE}, then what it is — give it its row there and a README.md (\`npx paperlint studies new\` makes all three for a new study); in a paper with repro/study-registered off, \`${suggestedStudyName(name)}\` is accepted instead, dated by the day it began — its first commit is a fine default (\`git log --reverse --format=%as -- repro/${name} | head -1\`, run in the paper folder); if it holds scripts or data shared across the paper instead, move them into repro/tools/ or repro/data/`;
|
|
206
237
|
const isAllowed = (e) => REPRO_BYPRODUCTS.includes(e.name) ||
|
|
207
238
|
(e.kind === "file"
|
|
208
239
|
? REPRO_FILES.includes(e.name)
|
|
@@ -220,7 +251,7 @@ function judgeEntry(e) {
|
|
|
220
251
|
return {
|
|
221
252
|
path,
|
|
222
253
|
problem: "no-readme",
|
|
223
|
-
cure: `add ${path}${README} — what the study asks, how to run it, what it found — and
|
|
254
|
+
cure: `add ${path}${README} — what the study asks, how to run it, what it found — and give the study its row in repro/${STUDIES_FILE}`,
|
|
224
255
|
};
|
|
225
256
|
return null;
|
|
226
257
|
}
|
|
@@ -235,7 +266,7 @@ export function judgeRepro(entries) {
|
|
|
235
266
|
*/
|
|
236
267
|
export function reproMessage(f) {
|
|
237
268
|
const head = f.problem === "stray"
|
|
238
|
-
? `\`${f.path}\` is loose at the top of the paper's repro/ folder, which holds only an index, the shared tools and data, and one
|
|
269
|
+
? `\`${f.path}\` is loose at the top of the paper's repro/ folder, which holds only an index, the study registry, the shared tools and data, and one folder per study. Where it goes: ${f.cure}.`
|
|
239
270
|
: `\`${f.path}\` is a study folder without a ${README}, and every study in repro/ has one. What to do: ${f.cure}.`;
|
|
240
271
|
return [
|
|
241
272
|
head,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repro-layout.js","sourceRoot":"","sources":["../../src/domain/repro-layout.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"repro-layout.js","sourceRoot":"","sources":["../../src/domain/repro-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAEnE,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AAEjC,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,C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AAC,KAAK,CAAC,CAAC,IAAI,2KAA2K,CAAC,CAAC,IAAI,GAAG;QACjM,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,kCAAkC,MAAM,oDAAoD,CAAC,CAAC,IAAI,GAAG,CAAC;IACvH,OAAO;QACL,IAAI;QACJ,iIAAiI;QACjI,iBAAiB;QACjB,qHAAqH;KACtH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -11,10 +11,11 @@ export declare const NOT_SCAFFOLDED: readonly {
|
|
|
11
11
|
/** The folders at the paper's root that a new paper holds from the first commit, in layout order. */
|
|
12
12
|
export declare const SCAFFOLD_DIRS: readonly string[];
|
|
13
13
|
/**
|
|
14
|
-
* The stub index of `repro/`: it makes the folder non-empty (no `.gitkeep`) and says what the
|
|
15
|
-
*
|
|
14
|
+
* The stub index of `repro/`: it makes the folder non-empty (no `.gitkeep`) and says what the rules
|
|
15
|
+
* ask of it. The table of studies is generated into it by `paperlint studies new` and
|
|
16
|
+
* `paperlint studies index`, from `repro/studies.json`.
|
|
16
17
|
*/
|
|
17
|
-
export declare const REPRO_INDEX_STUB = "# Reproduction index\n\nOne line per study
|
|
18
|
+
export declare const REPRO_INDEX_STUB = "# Reproduction index\n\nOne line per study, generated from `studies.json` \u2014 create a study with\n`npx paperlint studies new <paper-dir> \"<title>\"`, and after editing its row run\n`npx paperlint studies index <paper-dir>`. Scripts used across the paper go in `tools/`,\nshared data in `data/`.\n";
|
|
18
19
|
/** A file `paperlint new` writes into a new paper folder, with its path from that folder. */
|
|
19
20
|
export interface ScaffoldFile {
|
|
20
21
|
readonly path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold-layout.d.ts","sourceRoot":"","sources":["../../src/domain/scaffold-layout.ts"],"names":[],"mappings":"AAiCA,mEAAmE;AACnE,eAAO,MAAM,OAAO,aAAa,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,EAqBA,CAAC;AAEF,qGAAqG;AACrG,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAEqB,CAAC;AAEjE
|
|
1
|
+
{"version":3,"file":"scaffold-layout.d.ts","sourceRoot":"","sources":["../../src/domain/scaffold-layout.ts"],"names":[],"mappings":"AAiCA,mEAAmE;AACnE,eAAO,MAAM,OAAO,aAAa,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,EAqBA,CAAC;AAEF,qGAAqG;AACrG,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAEqB,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,kTAM5B,CAAC;AAEF,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAYjD,CAAC"}
|
|
@@ -55,13 +55,16 @@ export const NOT_SCAFFOLDED = [
|
|
|
55
55
|
/** The folders at the paper's root that a new paper holds from the first commit, in layout order. */
|
|
56
56
|
export const SCAFFOLD_DIRS = ROOT_DIR_NOTES.map((d) => d.name).filter((name) => !NOT_SCAFFOLDED.some((n) => n.name === name));
|
|
57
57
|
/**
|
|
58
|
-
* The stub index of `repro/`: it makes the folder non-empty (no `.gitkeep`) and says what the
|
|
59
|
-
*
|
|
58
|
+
* The stub index of `repro/`: it makes the folder non-empty (no `.gitkeep`) and says what the rules
|
|
59
|
+
* ask of it. The table of studies is generated into it by `paperlint studies new` and
|
|
60
|
+
* `paperlint studies index`, from `repro/studies.json`.
|
|
60
61
|
*/
|
|
61
62
|
export const REPRO_INDEX_STUB = `# Reproduction index
|
|
62
63
|
|
|
63
|
-
One line per study
|
|
64
|
-
paper
|
|
64
|
+
One line per study, generated from \`studies.json\` — create a study with
|
|
65
|
+
\`npx paperlint studies new <paper-dir> "<title>"\`, and after editing its row run
|
|
66
|
+
\`npx paperlint studies index <paper-dir>\`. Scripts used across the paper go in \`${TOOLS_DIR}/\`,
|
|
67
|
+
shared data in \`${DATA_DIR}/\`.
|
|
65
68
|
`;
|
|
66
69
|
/**
|
|
67
70
|
* Every file of the layout scaffold, relative to the paper folder, in a fixed order: a `.gitkeep` in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold-layout.js","sourceRoot":"","sources":["../../src/domain/scaffold-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,eAAe,EACf,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,mEAAmE;AACnE,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAGrB;IACJ;QACE,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,kFAAkF;KACxF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,8MAA8M;KACpN;IACD;QACE,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,oIAAoI;KAC1I;IACD;QACE,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,4IAA4I;KAClJ;IACD;QACE,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,iIAAiI;KACvI;CACF,CAAC;AAEF,qGAAqG;AACrG,MAAM,CAAC,MAAM,aAAa,GAAsB,cAAc,CAAC,GAAG,CAChE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,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AC3E,QAAQ;CAC1B,CAAC;AAQF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,EAA2B,EAAE,CACxD,GAAG,KAAK,SAAS;QACf,CAAC,CAAC;YACE,EAAE,IAAI,EAAE,GAAG,SAAS,IAAI,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;YAC1D,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC7B,IAAI,EAAE,GAAG,SAAS,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,EAAE;gBACzC,IAAI,EAAE,EAAE;aACT,CAAC,CAAC;SACJ;QACH,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAC9C;CACF,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { STUDIES_FILE } from "./repro-layout.ts";
|
|
2
|
+
/** The registry, at the top of the paper's `repro/`; the layout allows it there. */
|
|
3
|
+
export { STUDIES_FILE };
|
|
4
|
+
export declare const STUDY_KINDS: readonly ["measurement", "spike", "tooling", "data", "artifact", "salvage"];
|
|
5
|
+
export type StudyKind = (typeof STUDY_KINDS)[number];
|
|
6
|
+
export declare const STUDY_STATUSES: readonly ["designing", "running", "done", "stopped", "superseded", "dropped"];
|
|
7
|
+
export type StudyStatus = (typeof STUDY_STATUSES)[number];
|
|
8
|
+
/** `registry`: listed in the registry only, not in the paper's text. */
|
|
9
|
+
export declare const IN_PAPER: readonly ["yes", "no", "registry"];
|
|
10
|
+
export type InPaper = (typeof IN_PAPER)[number];
|
|
11
|
+
/** A title is a plain name, not a sentence. */
|
|
12
|
+
export declare const MAX_TITLE_WORDS = 8;
|
|
13
|
+
/** A paper's prefix: a capital letter, then capitals or digits (`P1`). */
|
|
14
|
+
export declare const PREFIX_PATTERN: RegExp;
|
|
15
|
+
/** The kind `paperlint studies new` gives a study when none is named. */
|
|
16
|
+
export declare const DEFAULT_KIND: StudyKind;
|
|
17
|
+
/** The markers around the generated index in `repro/README.md`. Fixed: the rule finds the block by them. */
|
|
18
|
+
export declare const INDEX_BEGIN = "<!-- studies:begin \u2014 generated from studies.json by `paperlint studies index`; do not edit -->";
|
|
19
|
+
export declare const INDEX_END = "<!-- studies:end -->";
|
|
20
|
+
/**
|
|
21
|
+
* One study. The named fields are the registry's; a row may carry more (a paper merges its own
|
|
22
|
+
* measurement metadata into it), and they are kept as they are.
|
|
23
|
+
*/
|
|
24
|
+
export interface Study {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly folder: string;
|
|
27
|
+
readonly title: string;
|
|
28
|
+
readonly question: string;
|
|
29
|
+
readonly kind: StudyKind;
|
|
30
|
+
readonly status: StudyStatus;
|
|
31
|
+
readonly date: string;
|
|
32
|
+
readonly result?: string | undefined;
|
|
33
|
+
readonly result_file?: string | undefined;
|
|
34
|
+
readonly superseded_by?: string | undefined;
|
|
35
|
+
readonly in_paper: InPaper;
|
|
36
|
+
readonly [extra: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface StudyRegistry {
|
|
39
|
+
readonly prefix: string;
|
|
40
|
+
readonly studies: readonly Study[];
|
|
41
|
+
}
|
|
42
|
+
/** A registry's text, parsed: the registry, or the one reason it is not one. */
|
|
43
|
+
export type ParsedRegistry = {
|
|
44
|
+
readonly ok: true;
|
|
45
|
+
readonly registry: StudyRegistry;
|
|
46
|
+
} | {
|
|
47
|
+
readonly ok: false;
|
|
48
|
+
readonly why: string;
|
|
49
|
+
};
|
|
50
|
+
/** What the paper's `repro/` holds of a registry. */
|
|
51
|
+
export type RegistryState = {
|
|
52
|
+
readonly kind: "absent";
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: "unreadable";
|
|
55
|
+
readonly why: string;
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: "read";
|
|
58
|
+
readonly registry: StudyRegistry;
|
|
59
|
+
};
|
|
60
|
+
/** What the judge reads. */
|
|
61
|
+
export interface StudyInput {
|
|
62
|
+
/** The study folders at the top of `repro/`: every folder but the shared ones and the byproducts. */
|
|
63
|
+
readonly folders: readonly string[];
|
|
64
|
+
readonly registry: RegistryState;
|
|
65
|
+
/** `repro/README.md`'s text; null when there is none. */
|
|
66
|
+
readonly readme: string | null;
|
|
67
|
+
/** Each `<folder>/<result_file>` of the registry that is a file. */
|
|
68
|
+
readonly existingResults: ReadonlySet<string>;
|
|
69
|
+
}
|
|
70
|
+
/** One defect of the registry, of a row, or of the index. */
|
|
71
|
+
export type StudyFinding = {
|
|
72
|
+
readonly problem: "no-registry";
|
|
73
|
+
readonly folders: readonly string[];
|
|
74
|
+
} | {
|
|
75
|
+
readonly problem: "unreadable";
|
|
76
|
+
readonly why: string;
|
|
77
|
+
} | {
|
|
78
|
+
readonly problem: "unregistered";
|
|
79
|
+
readonly folder: string;
|
|
80
|
+
readonly next: string;
|
|
81
|
+
} | {
|
|
82
|
+
readonly problem: "no-folder";
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly folder: string;
|
|
85
|
+
} | {
|
|
86
|
+
readonly problem: "two-rows";
|
|
87
|
+
readonly folder: string;
|
|
88
|
+
readonly ids: readonly string[];
|
|
89
|
+
} | {
|
|
90
|
+
readonly problem: "bad-id";
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly prefix: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly problem: "duplicate-id";
|
|
95
|
+
readonly id: string;
|
|
96
|
+
} | {
|
|
97
|
+
readonly problem: "folder-name";
|
|
98
|
+
readonly id: string;
|
|
99
|
+
readonly folder: string;
|
|
100
|
+
} | {
|
|
101
|
+
readonly problem: "long-title";
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly words: number;
|
|
104
|
+
} | {
|
|
105
|
+
readonly problem: "no-result";
|
|
106
|
+
readonly id: string;
|
|
107
|
+
readonly missing: readonly ("result" | "result_file")[];
|
|
108
|
+
} | {
|
|
109
|
+
readonly problem: "result-file";
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly path: string;
|
|
112
|
+
readonly why: "missing" | "outside";
|
|
113
|
+
} | {
|
|
114
|
+
readonly problem: "no-successor";
|
|
115
|
+
readonly id: string;
|
|
116
|
+
readonly superseded_by: string | null;
|
|
117
|
+
} | {
|
|
118
|
+
readonly problem: "stale-index";
|
|
119
|
+
readonly why: "no-readme" | "no-markers" | "differs";
|
|
120
|
+
};
|
|
121
|
+
/** The id after the highest one in `r`, at least two digits: `P1-S01` in an empty registry. */
|
|
122
|
+
export declare function nextStudyId(r: StudyRegistry): string;
|
|
123
|
+
/** The slug of a title: lowercase Latin letters and digits, words joined by single hyphens; "" when none. */
|
|
124
|
+
export declare const studySlug: (title: string) => string;
|
|
125
|
+
/** The number of words in a title. */
|
|
126
|
+
export declare const titleWords: (title: string) => number;
|
|
127
|
+
/**
|
|
128
|
+
* Every defect of a paper's study registry, in a fixed order: the registry itself; the unregistered
|
|
129
|
+
* folders; each row's; the index. Pure.
|
|
130
|
+
*/
|
|
131
|
+
export declare function judgeStudies(input: StudyInput): readonly StudyFinding[];
|
|
132
|
+
/**
|
|
133
|
+
* The index of `r`: a markdown table, a row per study in registry order, each column padded to its
|
|
134
|
+
* widest cell (at least 3), the way prettier writes a table — so formatting the README leaves it as
|
|
135
|
+
* it is.
|
|
136
|
+
*/
|
|
137
|
+
export declare function studyIndex(r: StudyRegistry): string;
|
|
138
|
+
/** Whether `readme` holds the index of `r`, whatever padding a formatter gave its table. */
|
|
139
|
+
export declare function indexInSync(readme: string | null, r: StudyRegistry): boolean;
|
|
140
|
+
/** The index between its markers, a blank line on each side. */
|
|
141
|
+
export declare const indexBlock: (r: StudyRegistry) => string;
|
|
142
|
+
/** The text between the markers of `readme`; null when it has no begin marker followed by an end one. */
|
|
143
|
+
export declare function embeddedIndex(readme: string): string | null;
|
|
144
|
+
/**
|
|
145
|
+
* `readme` with its index regenerated from `r`: the block replaced in place, appended when the README
|
|
146
|
+
* has none, a README of its own when there is none.
|
|
147
|
+
*/
|
|
148
|
+
export declare function withIndex(readme: string | null, r: StudyRegistry): string;
|
|
149
|
+
/** The registry's text as `paperlint studies new` writes it: JSON, two-space indented, a final newline. */
|
|
150
|
+
export declare const registryText: (r: StudyRegistry) => string;
|
|
151
|
+
/** The one text a finding is reported with: what is wrong, what to do, and the rule's page. */
|
|
152
|
+
export declare const studyMessage: (f: StudyFinding) => string;
|
|
153
|
+
/** Whether `s` names a kind of study. */
|
|
154
|
+
export declare const isStudyKind: (s: string) => s is StudyKind;
|
|
155
|
+
/** What a new study is made from. */
|
|
156
|
+
export interface NewStudy {
|
|
157
|
+
readonly title: string;
|
|
158
|
+
readonly kind: StudyKind;
|
|
159
|
+
/** The day it is registered, `YYYY-MM-DD`. */
|
|
160
|
+
readonly date: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* `r` with a new study appended: the next id, the folder `<id>-<slug>`, `status: designing`,
|
|
164
|
+
* `in_paper: no` and an empty question; or why the title cannot make one.
|
|
165
|
+
*/
|
|
166
|
+
export declare function addStudy(r: StudyRegistry, n: NewStudy): {
|
|
167
|
+
readonly ok: true;
|
|
168
|
+
readonly registry: StudyRegistry;
|
|
169
|
+
readonly study: Study;
|
|
170
|
+
} | {
|
|
171
|
+
readonly ok: false;
|
|
172
|
+
readonly why: string;
|
|
173
|
+
};
|
|
174
|
+
/** The `README.md` a new study's folder starts with: its id and title in frontmatter, then the sections. */
|
|
175
|
+
export declare const studyReadme: (s: Study) => string;
|
|
176
|
+
//# sourceMappingURL=study-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"study-registry.d.ts","sourceRoot":"","sources":["../../src/domain/study-registry.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAc,MAAM,mBAAmB,CAAC;AAE7D,oFAAoF;AACpF,OAAO,EAAE,YAAY,EAAE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