paperlint 12.0.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CONTRIBUTING.md +2 -1
  2. package/dist/adapters/memory/index.d.ts +5 -0
  3. package/dist/adapters/memory/index.d.ts.map +1 -1
  4. package/dist/adapters/memory/index.js +16 -0
  5. package/dist/adapters/memory/index.js.map +1 -1
  6. package/dist/adapters/node/index.d.ts +1 -0
  7. package/dist/adapters/node/index.d.ts.map +1 -1
  8. package/dist/adapters/node/index.js +1 -0
  9. package/dist/adapters/node/index.js.map +1 -1
  10. package/dist/adapters/node/move-file.io.d.ts +4 -0
  11. package/dist/adapters/node/move-file.io.d.ts.map +1 -0
  12. package/dist/adapters/node/move-file.io.js +12 -0
  13. package/dist/adapters/node/move-file.io.js.map +1 -0
  14. package/dist/adapters/yaml/index.d.ts +3 -0
  15. package/dist/adapters/yaml/index.d.ts.map +1 -0
  16. package/dist/adapters/yaml/index.js +17 -0
  17. package/dist/adapters/yaml/index.js.map +1 -0
  18. package/dist/cli.d.ts.map +1 -1
  19. package/dist/cli.js +48 -7
  20. package/dist/cli.js.map +1 -1
  21. package/dist/cycle-rules.d.ts +3 -3
  22. package/dist/cycle-rules.d.ts.map +1 -1
  23. package/dist/cycle-rules.js +1 -2
  24. package/dist/cycle-rules.js.map +1 -1
  25. package/dist/domain/cycle.d.ts +16 -2
  26. package/dist/domain/cycle.d.ts.map +1 -1
  27. package/dist/domain/cycle.js +21 -42
  28. package/dist/domain/cycle.js.map +1 -1
  29. package/dist/domain/paper-layout.d.ts.map +1 -1
  30. package/dist/domain/paper-layout.js +5 -2
  31. package/dist/domain/paper-layout.js.map +1 -1
  32. package/dist/domain/paths.d.ts +12 -0
  33. package/dist/domain/paths.d.ts.map +1 -1
  34. package/dist/domain/paths.js +22 -1
  35. package/dist/domain/paths.js.map +1 -1
  36. package/dist/domain/scaffold-layout.js +1 -1
  37. package/dist/domain/versions-migration.d.ts +51 -0
  38. package/dist/domain/versions-migration.d.ts.map +1 -0
  39. package/dist/domain/versions-migration.js +252 -0
  40. package/dist/domain/versions-migration.js.map +1 -0
  41. package/dist/domain/versions.d.ts +167 -0
  42. package/dist/domain/versions.d.ts.map +1 -0
  43. package/dist/domain/versions.js +457 -0
  44. package/dist/domain/versions.js.map +1 -0
  45. package/dist/eslint-rules/paper-stages.d.ts +7 -0
  46. package/dist/eslint-rules/paper-stages.d.ts.map +1 -1
  47. package/dist/eslint-rules/paper-stages.js +62 -7
  48. package/dist/eslint-rules/paper-stages.js.map +1 -1
  49. package/dist/eslint-rules/rule-context.d.ts +2 -0
  50. package/dist/eslint-rules/rule-context.d.ts.map +1 -1
  51. package/dist/ports/move-file.d.ts +7 -0
  52. package/dist/ports/move-file.d.ts.map +1 -0
  53. package/dist/ports/move-file.js +2 -0
  54. package/dist/ports/move-file.js.map +1 -0
  55. package/dist/ports/yaml.d.ts +5 -0
  56. package/dist/ports/yaml.d.ts.map +1 -0
  57. package/dist/ports/yaml.js +2 -0
  58. package/dist/ports/yaml.js.map +1 -0
  59. package/dist/submission.d.ts +2 -0
  60. package/dist/submission.d.ts.map +1 -1
  61. package/dist/submission.js +49 -9
  62. package/dist/submission.js.map +1 -1
  63. package/dist/version-rules.d.ts +16 -0
  64. package/dist/version-rules.d.ts.map +1 -0
  65. package/dist/version-rules.js +201 -0
  66. package/dist/version-rules.js.map +1 -0
  67. package/dist/versions-command.d.ts +37 -0
  68. package/dist/versions-command.d.ts.map +1 -0
  69. package/dist/versions-command.js +209 -0
  70. package/dist/versions-command.js.map +1 -0
  71. package/dist/versions.d.ts +76 -0
  72. package/dist/versions.d.ts.map +1 -0
  73. package/dist/versions.js +164 -0
  74. package/dist/versions.js.map +1 -0
  75. package/docs/configuration.md +76 -2
  76. package/docs/layout.md +5 -5
  77. package/docs/rules/cycle/camera-ready-source.md +62 -0
  78. package/docs/rules/cycle/draft-drift.md +47 -0
  79. package/docs/rules/cycle/port-done.md +2 -2
  80. package/docs/rules/cycle/record.md +2 -1
  81. package/docs/rules/cycle/submitted-frozen.md +65 -0
  82. package/docs/rules/paper/allowed-files-only.md +1 -1
  83. package/docs/rules/versions/layout.md +88 -0
  84. package/docs/rules.md +25 -11
  85. package/docs/submission.md +21 -3
  86. package/eslint-rules/paper-stages.test.mjs +62 -0
  87. package/eslint-rules/paper-stages.ts +67 -8
  88. package/eslint-rules/prereg-coverage.test.ts +1 -0
  89. package/eslint-rules/rule-context.ts +2 -0
  90. package/package.json +2 -1
  91. package/presets/agent.jsonc +75 -0
  92. package/presets/agent.md +70 -0
  93. package/presets/agentverify.jsonc +72 -0
  94. package/presets/agentverify.md +85 -0
  95. package/presets/ieee-conference.md +1 -1
  96. package/presets/nlbse.jsonc +76 -0
  97. package/presets/nlbse.md +85 -0
  98. package/scripts/coverage-config.test.ts +3 -0
  99. package/skills/CLAUDE.md +2 -2
  100. package/skills/CLAUDE.md.spec.ts +1 -1
  101. package/skills/paper-pipeline/references/pipeline-status-template.md +4 -1
  102. package/skills/submit-paper/SKILL.md +18 -10
  103. package/skills/submit-paper/SKILL.md.spec.ts +17 -9
  104. package/skills/submit-paper/references/publishers/acm.md +5 -3
  105. package/src/adapters/memory/index.test.ts +22 -0
  106. package/src/adapters/memory/index.ts +21 -0
  107. package/src/adapters/node/index.ts +1 -0
  108. package/src/adapters/node/move-file.io.ts +21 -0
  109. package/src/adapters/node/move-file.test.ts +51 -0
  110. package/src/adapters/yaml/index.test.ts +16 -0
  111. package/src/adapters/yaml/index.ts +17 -0
  112. package/src/cli.test.ts +43 -0
  113. package/src/cli.ts +58 -6
  114. package/src/cycle-rules.ts +4 -5
  115. package/src/domain/cycle.test.ts +27 -0
  116. package/src/domain/cycle.ts +38 -6
  117. package/src/domain/paper-layout.ts +5 -2
  118. package/src/domain/paths.test.ts +28 -1
  119. package/src/domain/paths.ts +34 -1
  120. package/src/domain/scaffold-layout.ts +1 -1
  121. package/src/domain/versions-migration.test.ts +410 -0
  122. package/src/domain/versions-migration.ts +429 -0
  123. package/src/domain/versions.test.ts +564 -0
  124. package/src/domain/versions.ts +706 -0
  125. package/src/paper-settings-commands.test.ts +1 -1
  126. package/src/ports/move-file.ts +8 -0
  127. package/src/ports/yaml.ts +5 -0
  128. package/src/preset-card-rule.test.ts +3 -0
  129. package/src/presets.test.ts +55 -31
  130. package/src/rule-cases.test.ts +157 -8
  131. package/src/submission-freeze.test.ts +320 -0
  132. package/src/submission-new.test.ts +11 -1
  133. package/src/submission.ts +82 -11
  134. package/src/tex-venue-rules.test.ts +3 -0
  135. package/src/venue-rules.test.ts +2 -2
  136. package/src/version-rules.test.ts +222 -0
  137. package/src/version-rules.ts +282 -0
  138. package/src/versions-command.test.ts +594 -0
  139. package/src/versions-command.ts +360 -0
  140. package/src/versions.ts +286 -0
  141. package/dist/eslint-rules/cycle-stage.d.ts +0 -39
  142. package/dist/eslint-rules/cycle-stage.d.ts.map +0 -1
  143. package/dist/eslint-rules/cycle-stage.js +0 -119
  144. package/dist/eslint-rules/cycle-stage.js.map +0 -1
  145. package/docs/rules/cycle/stage.md +0 -85
  146. package/eslint-rules/cycle-stage.test.mjs +0 -131
  147. package/eslint-rules/cycle-stage.ts +0 -141
@@ -0,0 +1,252 @@
1
+ /**
2
+ * FROM `stages:` TO FOLDERS PER ATTEMPT — what `paperlint versions migrate` decides before it touches
3
+ * anything: each entry of the scorecard's `stages:` list becomes a move of its PDF and source into
4
+ * `versions/<cycle>/<stage>.{pdf,tex}` and an entry of `versions/lock.json`, and the list is dropped.
5
+ *
6
+ * The entry's `cycle:` names the folder, its `date:` becomes the day the lock says it was frozen, and
7
+ * its `bytes:` / `sourceBytes:` are checked against the files once more: a file that is no longer the
8
+ * one declared is not moved under a lock that would vouch for it. `sourceLost: true` becomes a lock
9
+ * entry that records the loss. A frozen file of the old layout that no entry names, and an entry that
10
+ * names no cycle, stop the whole migration with what to do — nothing is half-moved.
11
+ *
12
+ * Pure: the caller reads the disk and hands in what it found.
13
+ */
14
+ import * as R from "remeda";
15
+ import { asPaperPath, paperPath } from "./paths.js";
16
+ import { isRecord } from "./record.js";
17
+ import { err, ok } from "./result.js";
18
+ import { DATED_NAME, frozenKey, LOCK_FILE, VERSION_STAGES, VERSIONS_DIR, } from "./versions.js";
19
+ const NONE = { moves: [], lock: {}, problems: [] };
20
+ const problem = (why) => ({ ...NONE, problems: [why] });
21
+ const isStage = (s) => VERSION_STAGES.some((v) => v === s);
22
+ const text = (v) => typeof v === "string" ? v : v === undefined ? "" : JSON.stringify(v);
23
+ /** A YAML date without quotes is a `Date`; either way, the day it names, or "" when it names none. */
24
+ function isoDate(v) {
25
+ if (v instanceof Date)
26
+ return v.toISOString().slice(0, 10);
27
+ return typeof v === "string"
28
+ ? (/^\d{4}-\d{2}-\d{2}$/.exec(v)?.[0] ?? "")
29
+ : "";
30
+ }
31
+ const declaredPath = (v) => typeof v === "string" ? paperPath(v) : null;
32
+ const declaration = (e) => {
33
+ const rec = isRecord(e) ? e : {};
34
+ return {
35
+ rec,
36
+ pdf: declaredPath(rec["pdf"]),
37
+ source: declaredPath(rec["source"]),
38
+ };
39
+ };
40
+ /** A declared path that names no file of the paper: what stops the entry. */
41
+ const outside = (t, error) => problem(`${t.at}: ${error} — a stage names a file of this paper, relative to it`);
42
+ /** One declared file → its move and lock entry, or why it cannot move. */
43
+ function filePart(t, f, factsOf) {
44
+ const { path, declared, ext } = f;
45
+ const facts = factsOf(path);
46
+ if (facts === null)
47
+ return problem(`${t.at}: \`${path}\` is not on disk`);
48
+ if (typeof declared === "number" && declared !== facts.bytes)
49
+ return problem(`${t.at}: \`${path}\` has ${String(facts.bytes)} bytes, the stage declares ${String(declared)} — it is not the file that was frozen: restore it from git first`);
50
+ const key = frozenKey(t.cycle, t.stage, ext);
51
+ const entry = { kind: "file", ...facts, frozen: t.date };
52
+ return {
53
+ moves: [{ from: path, to: asPaperPath(`${VERSIONS_DIR}/${key}`) }],
54
+ lock: { [key]: entry },
55
+ problems: [],
56
+ };
57
+ }
58
+ const merge = (parts) => ({
59
+ moves: parts.flatMap((p) => p.moves),
60
+ lock: parts.reduce((acc, p) => ({ ...acc, ...p.lock }), {}),
61
+ problems: parts.flatMap((p) => p.problems),
62
+ });
63
+ /** The source of an entry: lost, a file, or none (versions/layout then says the PDF has none). */
64
+ function sourcePart(t, d, factsOf) {
65
+ if (d.rec["sourceLost"] === true)
66
+ return {
67
+ ...NONE,
68
+ lock: {
69
+ [frozenKey(t.cycle, t.stage, "tex")]: { kind: "lost", frozen: t.date },
70
+ },
71
+ };
72
+ if (d.source === null)
73
+ return NONE;
74
+ return d.source.ok
75
+ ? filePart(t, { path: d.source.value, declared: d.rec["sourceBytes"], ext: "tex" }, factsOf)
76
+ : outside(t, d.source.error);
77
+ }
78
+ /** Where one `stages:` entry goes, or why it has no place. */
79
+ function targetOf(rec, i, ids) {
80
+ const at = `stages[${String(i)}]`;
81
+ const stage = rec["stage"];
82
+ if (!isStage(stage))
83
+ return err(`${at}: the stage «${text(stage)}» has no place in versions/<cycle>/ — the stages are ${VERSION_STAGES.join(", ")}`);
84
+ const cycle = ids.find((id) => id === rec["cycle"]);
85
+ if (cycle === undefined)
86
+ return err(`${at} («${stage}»): names no cycle of paperlint.json — add \`cycle: <id>\` (${ids.join(" · ") || "none declared"}), the attempt the PDF was sent in, then migrate`);
87
+ const date = isoDate(rec["date"]);
88
+ return date === ""
89
+ ? err(`${at} («${stage}»): "date" is not YYYY-MM-DD`)
90
+ : ok({ at, cycle, stage, date });
91
+ }
92
+ /** One `stages:` entry → its moves and lock entries. */
93
+ function entryPart(d, i, input) {
94
+ const t = targetOf(d.rec, i, input.cycleIds);
95
+ if (!t.ok)
96
+ return problem(t.error);
97
+ return merge([
98
+ pdfPart(t.value, d, input.factsOf),
99
+ sourcePart(t.value, d, input.factsOf),
100
+ ]);
101
+ }
102
+ /** The PDF of an entry: a move, or why there is none. */
103
+ function pdfPart(t, d, factsOf) {
104
+ if (d.pdf === null)
105
+ return problem(`${t.at} («${t.stage}»): no "pdf"`);
106
+ return d.pdf.ok
107
+ ? filePart(t, { path: d.pdf.value, declared: d.rec["bytes"], ext: "pdf" }, factsOf)
108
+ : outside(t, d.pdf.error);
109
+ }
110
+ /** Every file the entries name, moved or not, in its one spelling. */
111
+ const named = (decls) => decls
112
+ .flatMap((d) => [d.pdf, d.source])
113
+ .flatMap((p) => (p?.ok === true ? [p.value] : []));
114
+ /**
115
+ * Files no entry names, at the top of versions/: a dated one of the old layout stops it — it may be a
116
+ * stage nobody declared — and any other (a withdrawn `STALE` copy, a note on the old convention) goes to
117
+ * extra/versions/, since versions/layout allows nothing loose beside lock.json.
118
+ */
119
+ function leftovers(input, moved) {
120
+ const left = input.root.filter((e) => e.kind === "file" && !e.name.startsWith(".") && e.name !== LOCK_FILE);
121
+ return merge(left.map((e) => {
122
+ const from = paperPath(`${VERSIONS_DIR}/${e.name}`);
123
+ if (!from.ok)
124
+ return problem(`versions/${e.name}: not a file name migrate can move — rename it, then migrate`);
125
+ if (moved.includes(from.value))
126
+ return NONE;
127
+ return DATED_NAME.test(e.name)
128
+ ? problem(`versions/${e.name}: no stage in \`stages:\` names it — declare it with its cycle, or move it to extra/, then migrate`)
129
+ : {
130
+ ...NONE,
131
+ moves: [
132
+ { from: from.value, to: asPaperPath(`extra/versions/${e.name}`) },
133
+ ],
134
+ };
135
+ }));
136
+ }
137
+ /** Two entries frozen into one place: an attempt keeps one upload per stage. */
138
+ const collisions = (moves) => Object.entries(R.groupBy(moves, (m) => m.to))
139
+ .filter(([, ms]) => ms.length > 1)
140
+ .map(([to, ms]) => `${to}: ${ms.map((m) => `\`${m.from}\``).join(" and ")} would both go there — an attempt keeps its last upload per stage: move the older to extra/, drop its entry from \`stages:\`, then migrate`);
141
+ /**
142
+ * One source named by several stages (the old layout let a `submitted` and an `arxiv` share the
143
+ * source they were built from): copied to each destination but the last, and moved to that one.
144
+ * Renaming it twice would fail on the second rename, after the first files had moved.
145
+ */
146
+ function shared(moves) {
147
+ const last = (m, i) => !moves.slice(i + 1).some((n) => n.from === m.from);
148
+ return {
149
+ copies: moves.filter((m, i) => !last(m, i)),
150
+ moves: moves.filter(last),
151
+ };
152
+ }
153
+ /** Destinations a file is already at — a version frozen on send since, or an earlier copy in extra/. */
154
+ const taken = (moves, exists) => moves
155
+ .filter((m) => exists(m.to))
156
+ .map((m) => `${m.to} is already there, and \`${m.from}\` would replace it — compare the two, keep one, move the other out of versions/, then migrate`);
157
+ /** The whole migration, or every reason it cannot run: nothing is planned that could stop half-way. Pure. */
158
+ export function planMigration(input) {
159
+ // Every declared path parsed once, here: everything below compares one spelling per file.
160
+ const decls = input.stages.map(declaration);
161
+ const entries = merge(decls.map((d, i) => entryPart(d, i, input)));
162
+ const rest = leftovers(input, named(decls));
163
+ const all = [...entries.moves, ...rest.moves].filter((m) => m.from !== m.to);
164
+ const problems = [
165
+ ...entries.problems,
166
+ ...rest.problems,
167
+ ...collisions(all),
168
+ ...taken(all, input.exists),
169
+ ];
170
+ return problems.length > 0
171
+ ? err(problems)
172
+ : ok({ ...shared(all), lock: { ...input.lock, ...entries.lock } });
173
+ }
174
+ /** One step on the files there: it needs its source and a free destination. */
175
+ function replay(state, s) {
176
+ const at = `${s.verb} ${s.from} → ${s.to}`;
177
+ if (!state.there.includes(s.from))
178
+ return {
179
+ ...state,
180
+ problems: [
181
+ ...state.problems,
182
+ `${at}: ${s.from} is not there at that step`,
183
+ ],
184
+ };
185
+ if (state.there.includes(s.to))
186
+ return {
187
+ ...state,
188
+ problems: [
189
+ ...state.problems,
190
+ `${at}: ${s.to} is already there at that step`,
191
+ ],
192
+ };
193
+ const kept = s.verb === "move" ? state.there.filter((p) => p !== s.from) : state.there;
194
+ return { ...state, there: [...kept, s.to] };
195
+ }
196
+ /**
197
+ * The plan replayed on the paths it touches, before the disk is: each copy and each move needs its
198
+ * source and a free destination at its step, and every file the new lock vouches for is there at the
199
+ * end. The planner's own checks give the reasons a person can act on; this is the backstop that turns
200
+ * any plan they let through by mistake into a refusal, never a paper moved half-way. Pure.
201
+ */
202
+ export function rehearse(plan, exists) {
203
+ const steps = [
204
+ ...plan.copies.map((m) => ({ verb: "copy", ...m })),
205
+ ...plan.moves.map((m) => ({ verb: "move", ...m })),
206
+ ];
207
+ const vouched = Object.entries(plan.lock)
208
+ .filter(([, e]) => e.kind === "file")
209
+ .map(([key]) => asPaperPath(`${VERSIONS_DIR}/${key}`));
210
+ const touched = R.unique([
211
+ ...steps.flatMap((s) => [s.from, s.to]),
212
+ ...vouched,
213
+ ]);
214
+ const end = steps.reduce(replay, {
215
+ there: touched.filter(exists),
216
+ problems: [],
217
+ });
218
+ const missing = vouched
219
+ .filter((p) => !end.there.includes(p))
220
+ .map((p) => `versions/lock.json would vouch for ${p}, which would not be there after the migration`);
221
+ const problems = [...end.problems, ...missing];
222
+ return problems.length > 0 ? err(problems) : ok(null);
223
+ }
224
+ // ── the scorecard's frontmatter ──────────────────────────────────────────────────────────
225
+ const FRONTMATTER = /^---\n([\s\S]*?\n)?---(?:\n|$)/;
226
+ /** The YAML between the scorecard's `---` lines; null when it has none. Pure. */
227
+ export function frontmatterOf(markdown) {
228
+ const m = FRONTMATTER.exec(markdown);
229
+ return m === null ? null : (m[1] ?? "");
230
+ }
231
+ /**
232
+ * The scorecard with its `stages:` key — the line and every indented or list line under it — taken
233
+ * out of the frontmatter; the frontmatter itself dropped when nothing is left in it. Null when there
234
+ * is no `stages:` key at the top of a frontmatter. Pure: the caller checks the result with a YAML
235
+ * parser, so a layout this misreads is refused, not written.
236
+ */
237
+ export function withoutStages(markdown) {
238
+ const m = FRONTMATTER.exec(markdown);
239
+ const lines = (m?.[1] ?? "").split("\n");
240
+ const start = lines.findIndex((l) => /^stages\s*:/.test(l));
241
+ if (m === null || start < 0)
242
+ return null;
243
+ const after = lines.slice(start + 1);
244
+ const length = after.findIndex((l) => /^[^\s#-]/.test(l));
245
+ const kept = [
246
+ ...lines.slice(0, start),
247
+ ...(length < 0 ? [] : after.slice(length)),
248
+ ].join("\n");
249
+ const body = markdown.slice(m[0].length);
250
+ return kept.trim() === "" ? body : `---\n${kept.trimEnd()}\n---\n${body}`;
251
+ }
252
+ //# sourceMappingURL=versions-migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions-migration.js","sourceRoot":"","sources":["../../src/domain/versions-migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,UAAU,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,YAAY,GAOb,MAAM,eAAe,CAAC;AAwCvB,MAAM,IAAI,GAAS,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AACzD,MAAM,OAAO,GAAG,CAAC,GAAW,EAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAEtE,MAAM,OAAO,GAAG,CAAC,CAAU,EAAqB,EAAE,CAChD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAEtC,MAAM,IAAI,GAAG,CAAC,CAAU,EAAU,EAAE,CAClC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAEvE,sGAAsG;AACtG,SAAS,OAAO,CAAC,CAAU;IACzB,IAAI,CAAC,YAAY,IAAI;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C,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC3C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,UAAU,IAAI,EAAE,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,167 @@
1
+ import { type Current, type Cycle, type CycleId } from "./cycle.ts";
2
+ import { type Result } from "./result.ts";
3
+ export declare const VERSIONS_DIR = "versions";
4
+ export declare const LOCK_FILE = "lock.json";
5
+ /** The stages a version is frozen at, in the order an attempt reaches them. */
6
+ export declare const VERSION_STAGES: readonly ["submitted", "camera-ready", "arxiv"];
7
+ export type VersionStage = (typeof VERSION_STAGES)[number];
8
+ export type VersionExt = "pdf" | "tex";
9
+ /** A frozen file in a cycle's folder: its stage and extension. */
10
+ export interface FrozenName {
11
+ readonly stage: VersionStage;
12
+ readonly ext: VersionExt;
13
+ }
14
+ /** `submitted.pdf` → its stage and extension; null for a name outside the convention. Pure. */
15
+ export declare function frozenName(name: string): FrozenName | null;
16
+ /** `<cycle>/<stage>.<ext>`: a frozen file's path under `versions/`, and its key in the lock. */
17
+ export declare const frozenKey: (cycle: CycleId, stage: VersionStage, ext: VersionExt) => string;
18
+ /**
19
+ * A frozen file in the layout before folders per attempt, `versions/<date>-<stage>.<ext>`: what
20
+ * `paperlint versions migrate` moves into its attempt's folder.
21
+ */
22
+ export declare const DATED_NAME: RegExp;
23
+ /**
24
+ * One frozen file in the lock: its bytes and digest as frozen, and when (an instant for a file
25
+ * paperlint froze on send or recorded; the day of the stage for one migrated from `stages:`) — or a
26
+ * source recorded as LOST, which a frozen PDF of an earlier layout may have.
27
+ */
28
+ export type LockEntry = {
29
+ readonly kind: "file";
30
+ readonly bytes: number;
31
+ readonly sha256: string;
32
+ readonly frozen: string;
33
+ } | {
34
+ readonly kind: "lost";
35
+ readonly frozen: string | null;
36
+ };
37
+ /** The lock: an entry per frozen file, by `<cycle>/<stage>.<ext>`. */
38
+ export type Lock = Readonly<Record<string, LockEntry>>;
39
+ export declare const LOCK_VERSION = 1;
40
+ /** What the lock says about itself, so nobody takes it for a file to edit. */
41
+ export declare const LOCK_NOTE = "generated by paperlint \u2014 do not edit: `paperlint submission update --save` and `paperlint versions lock` write it";
42
+ /** The cycle and the file name of a lock key; null for a key that is not `<cycle>/<stage>.<ext>`. */
43
+ export declare function keyParts(key: string): {
44
+ readonly cycle: string;
45
+ readonly name: FrozenName;
46
+ } | null;
47
+ /** `lock.json`, parsed → the lock, or one line naming what is wrong. Pure. */
48
+ export declare function parseLock(json: unknown): Result<Lock, string>;
49
+ /** The lock as paperlint writes it: keys sorted, two spaces, a newline at the end. Pure. */
50
+ export declare const lockText: (lock: Lock) => string;
51
+ /** What the disk says about a file: its size and digest. */
52
+ export interface FileFacts {
53
+ readonly bytes: number;
54
+ readonly sha256: string;
55
+ }
56
+ /** One entry of a folder: a file or a folder. */
57
+ export interface Entry {
58
+ readonly name: string;
59
+ readonly kind: "file" | "dir";
60
+ }
61
+ /** A finding, as the rule reports it: a message id and the data its template names. */
62
+ export interface VersionFinding {
63
+ readonly messageId: string;
64
+ readonly data: Readonly<Record<string, string>>;
65
+ }
66
+ /** What `versions/layout` judges: the paper's cycles, the folder's entries, and the lock. */
67
+ export interface LayoutInput {
68
+ readonly cycles: readonly Cycle[];
69
+ /** The entries directly in `versions/`. */
70
+ readonly root: readonly Entry[];
71
+ /** The entries of the folder `name` in `versions/`. */
72
+ readonly inFolder: (name: string) => readonly Entry[];
73
+ /** `lock.json`: null when there is none; else parsed, or why it does not parse. */
74
+ readonly lock: Result<Lock, string> | null;
75
+ /** The size and digest of a frozen file on disk, by its key. */
76
+ readonly factsOf: (key: string) => FileFacts;
77
+ }
78
+ /**
79
+ * `versions/layout`: every entry of `versions/` against the convention — a folder per cycle, a file
80
+ * per stage — the porting declaration, and every frozen file against the lock. Pure.
81
+ */
82
+ export declare function judgeVersions(input: LayoutInput): readonly VersionFinding[];
83
+ /**
84
+ * `cycle/submitted-frozen`: each cycle that has a submission on the portal and no
85
+ * `versions/<id>/submitted.pdf`. Pure over whether a file exists, by its key.
86
+ */
87
+ export declare const unfrozenSubmissions: (cycles: readonly Cycle[], has: (key: string) => boolean) => readonly VersionFinding[];
88
+ /** How far one text has moved from another, in lines: added and removed. */
89
+ export interface Drift {
90
+ readonly added: number;
91
+ readonly removed: number;
92
+ }
93
+ /** The lines `draft` adds to `frozen` and removes from it (a line diff, as `git diff --numstat`). Pure. */
94
+ export declare function lineDrift(frozen: string, draft: string): Drift;
95
+ /** How much of an accepted source a later version keeps: its lines left unchanged, of all it had. */
96
+ export interface Lineage {
97
+ readonly kept: number;
98
+ readonly total: number;
99
+ }
100
+ /** The lines of `accepted` that `later` keeps unchanged, counted with the same line diff as the drift. Pure. */
101
+ export declare function lineage(accepted: string, later: string): Lineage;
102
+ /**
103
+ * Whether a camera-ready started from the accepted source: it keeps at least half of its lines. A
104
+ * camera-ready is what was accepted plus the changes the reviewers asked for, so it differs — any
105
+ * difference cannot be the test. One that keeps less than half was built from something else.
106
+ */
107
+ export declare const derivesFrom: (l: Lineage) => boolean;
108
+ export declare const driftText: (d: Drift) => string;
109
+ /** The venue of a cycle, as a person names it: the preset's spec, or the named venue. */
110
+ /** A cycle's venue as a person names it: a named venue's name, a preset's name without its package or path. */
111
+ export declare const venueName: (c: Cycle) => string;
112
+ /**
113
+ * The frozen source the draft is measured against: the open cycle's `submitted.tex`, or — once the
114
+ * last cycle is accepted — its newest (`camera-ready.tex`, else `submitted.tex`); null between venues
115
+ * and before the first attempt. Pure over whether a file exists.
116
+ */
117
+ export declare function driftBase(current: Current, has: (key: string) => boolean): {
118
+ readonly cycle: Cycle;
119
+ readonly key: string;
120
+ } | null;
121
+ /** One row of the version → state table. */
122
+ export interface VersionRow {
123
+ readonly version: string;
124
+ readonly stage: string;
125
+ readonly state: string;
126
+ readonly detail: string;
127
+ }
128
+ /** What a frozen stage of a cycle IS, from the cycle's outcome. Pure. */
129
+ export declare function stateOf(c: Cycle, stage: VersionStage): string;
130
+ /** What the draft row says about its drift from the base. */
131
+ export type DraftDrift = {
132
+ readonly kind: "none";
133
+ } | {
134
+ readonly kind: "no-base";
135
+ readonly key: string;
136
+ } | {
137
+ readonly kind: "same";
138
+ readonly key: string;
139
+ } | {
140
+ readonly kind: "drift";
141
+ readonly key: string;
142
+ readonly drift: Drift;
143
+ };
144
+ /** The table: each cycle, newest first, then the draft. Pure. */
145
+ export declare function versionRows(input: {
146
+ readonly cycles: readonly Cycle[];
147
+ readonly has: (key: string) => boolean;
148
+ readonly lock: Lock;
149
+ readonly draft: DraftDrift;
150
+ }): readonly VersionRow[];
151
+ /** The rows as aligned columns, two spaces in front. Pure. */
152
+ export declare function versionTable(rows: readonly VersionRow[]): readonly string[];
153
+ /** A frozen file found on disk: its key and what it holds. */
154
+ export interface OnDisk {
155
+ readonly key: string;
156
+ readonly facts: FileFacts;
157
+ }
158
+ /**
159
+ * `paperlint versions lock`: the lock for the files on disk — each kept as recorded, recorded when it
160
+ * is new or changed, an entry whose file is gone dropped, a lost source kept while no file replaces
161
+ * it — and a line per change. Pure.
162
+ */
163
+ export declare function relock(found: readonly OnDisk[], old: Lock, now: string): {
164
+ readonly lock: Lock;
165
+ readonly lines: readonly string[];
166
+ };
167
+ //# sourceMappingURL=versions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/domain/versions.ts"],"names":[],"mappings":"AAkCA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,aAAa,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