paperlint 18.3.0 → 18.3.1

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.
@@ -0,0 +1,19 @@
1
+ import type { Files } from "#src/ports/files";
2
+ /** What the command prints, and its exit code. */
3
+ export interface SeatVerdict {
4
+ readonly code: number;
5
+ readonly line: string;
6
+ }
7
+ /** The seat's verdict for the paper in `dir`. */
8
+ export declare function seatVerdict(dir: string, deps: {
9
+ readonly files: Files;
10
+ }): SeatVerdict;
11
+ /** Where the command writes. */
12
+ export interface Output {
13
+ readonly out: (s: string) => void;
14
+ readonly err: (s: string) => void;
15
+ }
16
+ /** Run the command on `argv`; the exit code. */
17
+ export declare function main(argv: readonly string[], deps: {
18
+ readonly files: Files;
19
+ }, { out, err }: Output): number;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "18.3.0",
3
+ "version": "18.3.1",
4
4
  "description": "A linter for scientific papers written in LaTeX: catches mistakes before you submit to a conference or journal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  name: pc-panel-review
3
- description: Use when asking "what would the program committee decide?" / "simulate the reviewers" / "what's this paper's accept probability?" / "red-team this paper" / "what would Reviewer 2 attack?" on a drafted paper + artifact. Spawns N independent reviewers with DISTINCT lenses (one actually RUNS the artifact, one is a skimming genre/register reviewer, one is the hostile Reviewer 2), then synthesizes a PC-chair meta-review into an accept/reject prediction reported as min/median/max, a calibrated probability, and consensus must-fixes (or none). Takes tighten-paper's structural verdict and cold-read-diff's whole-paper report as inputs — the panel cannot feel reader fatigue on its own. The third and last step of the final review. Before the final review, a red-team request runs the hostile seat (Reviewer 2) alone, without the readability inputs. Also runs the VENUE-FIT seat alone for a CFP-fit spot-check. NOT the submit checklist (harden-paper).
3
+ description: Use when asking "what would the program committee decide?" / "simulate the reviewers" / "what's this paper's accept probability?" / "red-team this paper" / "what would Reviewer 2 attack?" on a drafted paper + artifact. Spawns N independent reviewers with DISTINCT lenses (one actually RUNS the artifact, one is a skimming genre/register reviewer, one is the hostile Reviewer 2), then synthesizes a PC-chair meta-review into an accept/reject prediction reported as min/median/max, a calibrated probability, and consensus must-fixes (or none). Takes tighten-paper's structural verdict and cold-read-diff's whole-paper report as inputs — the panel cannot feel reader fatigue on its own. The third and last step of the final review. Before the final review, a red-team request runs the hostile seat (Reviewer 2) alone, without the readability inputs. Also runs the VENUE-FIT seat alone for a CFP-fit spot-check, and the PRIOR-REVIEWS seat alone while drafting ("did we really answer the last reviewers?"). NOT the submit checklist (harden-paper).
4
4
  allowed-tools: [Read, Write, Grep, Glob, Bash, WebSearch, WebFetch, Agent, Skill]
5
5
  ---
6
6
 
7
- <!-- vigiles:sha256:c0b27cf6767dde05 compiled from skills/pc-panel-review/SKILL.md.spec.ts -->
7
+ <!-- vigiles:sha256:0f74ef7b0488f6e2 compiled from skills/pc-panel-review/SKILL.md.spec.ts -->
8
8
 
9
9
  # pc-panel-review — model the whole PC, not one reviewer
10
10
 
11
11
  > The whole PC (N independent lenses incl. an artifact-runner) + a chair meta-review, run once as the
12
- > last step of the final review (`paper-pipeline`, "The final review"). Two seats also run alone:
13
- > the hostile seat, before the final review only (**Hostile-seat mode**, below), and **Venue-fit mode**
14
- > (below), a spot-check against a named venue's CFP rubric, recorded as `venue-fit`. Neither is
15
- > recorded as the panel.
12
+ > last step of the final review (`paper-pipeline`, "The final review"). Three seats also run alone:
13
+ > the hostile seat, before the final review only (**Hostile-seat mode**, below), the prior-reviews seat
14
+ > while drafting (**Prior-reviews mode**, below), and **Venue-fit mode** (below), a spot-check against a
15
+ > named venue's CFP rubric, recorded as `venue-fit`. None is recorded as the panel.
16
16
 
17
17
  A real decision is made by **2–4 reviewers with different priorities + a meta-review** that weighs
18
18
  consensus over any single voice. This skill runs that. The payoff over a single review: a **must-fix
@@ -77,11 +77,12 @@ prose-only read can.
77
77
  code for
78
78
  circularity (echoing stored fields vs recomputing); grep all files (incl. data + compiled
79
79
  caches) for anonymization leaks; scope the badge (Available / Functional / Reproduced).
80
- - **Prior-reviews reviewer (MANDATORY when the attempt before this one was rejected with
81
- reviews)** — the rejection's `"desk": false` outcome in `paperlint.json` names the points file
82
- (`outcome.points`). `cycle/prior-reviews-answered` already decides that every point has an
83
- answer and that each `where` is a `\section` of the paper; do not re-count that. Give this
84
- reviewer the points file beside the paper, and it judges what no rule can: whether the section an
80
+ - **Prior-reviews reviewer (MANDATORY when
81
+ `node ${CLAUDE_SKILL_DIR}/scripts/prior-reviews.js <paper-dir>` prints `required`)** — the
82
+ script reads the same function as `cycle/prior-reviews-answered`, so the seat sits exactly when
83
+ that rule fires, and it prints the points file. Do not decide from `paperlint.json` by eye. The rule
84
+ already decides that every point has an answer and that each `where` is a `\section` of the
85
+ paper; do not re-count that. Give this reviewer the points file beside the paper, and it judges what no rule can: whether the section an
85
86
  answer names really answers the quoted point, and whether a `declined` reason would satisfy the
86
87
  reviewer who raised it. Each answer that does not is a must-fix, named by its point id.
87
88
  - **Security/ethics reviewer** (security venues) — threat model soundness, responsible disclosure,
@@ -183,6 +184,12 @@ consensus must-fixes. Its report goes under `reviews/`, and the author decides e
183
184
  (`fixed`, or `wontfix` with a `note` giving his reason; `review/frontmatter`). Once the final review
184
185
  starts, the hostile seat runs only inside the panel.
185
186
 
187
+ ## Prior-reviews mode (one seat, while drafting)
188
+ While the paper is being revised for the next attempt, the prior-reviews seat of step 3 runs alone, on
189
+ the current text and the points file `scripts/prior-reviews.js` prints; it runs only when that script
190
+ says `required`. It gets no readability inputs and predicts no decision. Its report goes under
191
+ `reviews/`, decided per finding like Hostile-seat mode. In the final review it sits inside the panel.
192
+
186
193
  ## Venue-fit mode (single-lens spot-check — the merged `venue-review-sim`)
187
194
  When a full panel is overkill and you just want to predict **"given THIS venue's criteria, bar, and
188
195
  culture, would a real reviewer accept it, and what scores?"**, run **one** venue-fit reviewer scoring
@@ -12,7 +12,7 @@ import tightenPaper from "../tighten-paper/SKILL.md.spec.ts";
12
12
  export default experimental_skill({
13
13
  name: "pc-panel-review",
14
14
  description:
15
- 'Use when asking "what would the program committee decide?" / "simulate the reviewers" / "what\'s this paper\'s accept probability?" / "red-team this paper" / "what would Reviewer 2 attack?" on a drafted paper + artifact. Spawns N independent reviewers with DISTINCT lenses (one actually RUNS the artifact, one is a skimming genre/register reviewer, one is the hostile Reviewer 2), then synthesizes a PC-chair meta-review into an accept/reject prediction reported as min/median/max, a calibrated probability, and consensus must-fixes (or none). Takes tighten-paper\'s structural verdict and cold-read-diff\'s whole-paper report as inputs — the panel cannot feel reader fatigue on its own. The third and last step of the final review. Before the final review, a red-team request runs the hostile seat (Reviewer 2) alone, without the readability inputs. Also runs the VENUE-FIT seat alone for a CFP-fit spot-check. NOT the submit checklist (harden-paper).',
15
+ 'Use when asking "what would the program committee decide?" / "simulate the reviewers" / "what\'s this paper\'s accept probability?" / "red-team this paper" / "what would Reviewer 2 attack?" on a drafted paper + artifact. Spawns N independent reviewers with DISTINCT lenses (one actually RUNS the artifact, one is a skimming genre/register reviewer, one is the hostile Reviewer 2), then synthesizes a PC-chair meta-review into an accept/reject prediction reported as min/median/max, a calibrated probability, and consensus must-fixes (or none). Takes tighten-paper\'s structural verdict and cold-read-diff\'s whole-paper report as inputs — the panel cannot feel reader fatigue on its own. The third and last step of the final review. Before the final review, a red-team request runs the hostile seat (Reviewer 2) alone, without the readability inputs. Also runs the VENUE-FIT seat alone for a CFP-fit spot-check, and the PRIOR-REVIEWS seat alone while drafting ("did we really answer the last reviewers?"). NOT the submit checklist (harden-paper).',
16
16
  tools: [
17
17
  "Read",
18
18
  "Write",
@@ -28,10 +28,10 @@ export default experimental_skill({
28
28
  # pc-panel-review — model the whole PC, not one reviewer
29
29
 
30
30
  > The whole PC (N independent lenses incl. an artifact-runner) + a chair meta-review, run once as the
31
- > last step of the final review (\`paper-pipeline\`, "The final review"). Two seats also run alone:
32
- > the hostile seat, before the final review only (**Hostile-seat mode**, below), and **Venue-fit mode**
33
- > (below), a spot-check against a named venue's CFP rubric, recorded as \`venue-fit\`. Neither is
34
- > recorded as the panel.
31
+ > last step of the final review (\`paper-pipeline\`, "The final review"). Three seats also run alone:
32
+ > the hostile seat, before the final review only (**Hostile-seat mode**, below), the prior-reviews seat
33
+ > while drafting (**Prior-reviews mode**, below), and **Venue-fit mode** (below), a spot-check against a
34
+ > named venue's CFP rubric, recorded as \`venue-fit\`. None is recorded as the panel.
35
35
 
36
36
  A real decision is made by **2–4 reviewers with different priorities + a meta-review** that weighs
37
37
  consensus over any single voice. This skill runs that. The payoff over a single review: a **must-fix
@@ -96,11 +96,12 @@ prose-only read can.
96
96
  code for
97
97
  circularity (echoing stored fields vs recomputing); grep all files (incl. data + compiled
98
98
  caches) for anonymization leaks; scope the badge (Available / Functional / Reproduced).
99
- - **Prior-reviews reviewer (MANDATORY when the attempt before this one was rejected with
100
- reviews)** — the rejection's \`"desk": false\` outcome in \`paperlint.json\` names the points file
101
- (\`outcome.points\`). \`cycle/prior-reviews-answered\` already decides that every point has an
102
- answer and that each \`where\` is a \`\\section\` of the paper; do not re-count that. Give this
103
- reviewer the points file beside the paper, and it judges what no rule can: whether the section an
99
+ - **Prior-reviews reviewer (MANDATORY when
100
+ \`node \${CLAUDE_SKILL_DIR}/scripts/prior-reviews.js <paper-dir>\` prints \`required\`)** — the
101
+ script reads the same function as \`cycle/prior-reviews-answered\`, so the seat sits exactly when
102
+ that rule fires, and it prints the points file. Do not decide from \`paperlint.json\` by eye. The rule
103
+ already decides that every point has an answer and that each \`where\` is a \`\\section\` of the
104
+ paper; do not re-count that. Give this reviewer the points file beside the paper, and it judges what no rule can: whether the section an
104
105
  answer names really answers the quoted point, and whether a \`declined\` reason would satisfy the
105
106
  reviewer who raised it. Each answer that does not is a must-fix, named by its point id.
106
107
  - **Security/ethics reviewer** (security venues) — threat model soundness, responsible disclosure,
@@ -202,6 +203,12 @@ consensus must-fixes. Its report goes under \`reviews/\`, and the author decides
202
203
  (\`fixed\`, or \`wontfix\` with a \`note\` giving his reason; \`review/frontmatter\`). Once the final review
203
204
  starts, the hostile seat runs only inside the panel.
204
205
 
206
+ ## Prior-reviews mode (one seat, while drafting)
207
+ While the paper is being revised for the next attempt, the prior-reviews seat of step 3 runs alone, on
208
+ the current text and the points file \`scripts/prior-reviews.js\` prints; it runs only when that script
209
+ says \`required\`. It gets no readability inputs and predicts no decision. Its report goes under
210
+ \`reviews/\`, decided per finding like Hostile-seat mode. In the final review it sits inside the panel.
211
+
205
212
  ## Venue-fit mode (single-lens spot-check — the merged \`venue-review-sim\`)
206
213
  When a full panel is overkill and you just want to predict **"given THIS venue's criteria, bar, and
207
214
  culture, would a real reviewer accept it, and what scores?"**, run **one** venue-fit reviewer scoring
@@ -0,0 +1,44 @@
1
+ /**
2
+ * prior-reviews-core — whether the panel's prior-reviews seat must sit, and which points file it
3
+ * reads. The answer comes from `priorReviewsOf`, the function `cycle/prior-reviews-answered` uses,
4
+ * so the seat and the rule fire on the same papers: the last rejection with reviews before the open
5
+ * attempt, walking back over attempts that brought no reviews (a withdrawal, a desk rejection).
6
+ * No model, no network.
7
+ */
8
+ import { join } from "node:path";
9
+ import { callerPath } from "#src/caller-path";
10
+ import { readPaperSettings } from "#src/paper-settings";
11
+ import { priorReviewsOf } from "#src/prior-reviews-rule";
12
+ /** The seat's verdict for the paper in `dir`. */
13
+ export function seatVerdict(dir, deps) {
14
+ // readPaperSettings, as the lint run reads the file: a file that does not parse, or cycles it cannot
15
+ // hold, is an error here, never a "not required" (readCycles alone reads broken JSON as no cycles).
16
+ const settings = readPaperSettings(deps.files, dir);
17
+ if (!settings.ok)
18
+ return { code: 2, line: `prior-reviews: ${settings.error.why}` };
19
+ const cycles = settings.value?.cycles ?? null;
20
+ const prior = cycles === null ? null : priorReviewsOf(cycles);
21
+ if (prior === null)
22
+ return {
23
+ code: 0,
24
+ line: "not required: no rejection with reviews before the open attempt",
25
+ };
26
+ const from = `reviews from ${prior.rejected.id}, answered by ${prior.open.id}`;
27
+ return deps.files.isFile(callerPath(join(dir, prior.file)))
28
+ ? { code: 0, line: `required: ${prior.file} (${from})` }
29
+ : {
30
+ code: 1,
31
+ line: `required, and ${prior.file} is missing (${from}): write it first; cycle/prior-reviews-answered fails until it exists`,
32
+ };
33
+ }
34
+ /** Run the command on `argv`; the exit code. */
35
+ export function main(argv, deps, { out, err }) {
36
+ const [arg] = argv;
37
+ if (arg === undefined) {
38
+ err("usage: node prior-reviews.js <paper-dir>\n");
39
+ return 2;
40
+ }
41
+ const verdict = seatVerdict(callerPath(arg), deps);
42
+ (verdict.code === 0 ? out : err)(`${verdict.line}\n`);
43
+ return verdict.code;
44
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * prior-reviews-core — whether the panel's prior-reviews seat must sit, and which points file it
3
+ * reads. The answer comes from `priorReviewsOf`, the function `cycle/prior-reviews-answered` uses,
4
+ * so the seat and the rule fire on the same papers: the last rejection with reviews before the open
5
+ * attempt, walking back over attempts that brought no reviews (a withdrawal, a desk rejection).
6
+ * No model, no network.
7
+ */
8
+ import { join } from "node:path";
9
+ import { callerPath } from "#src/caller-path";
10
+ import type { Files } from "#src/ports/files";
11
+ import { readPaperSettings } from "#src/paper-settings";
12
+ import { priorReviewsOf } from "#src/prior-reviews-rule";
13
+
14
+ /** What the command prints, and its exit code. */
15
+ export interface SeatVerdict {
16
+ readonly code: number;
17
+ readonly line: string;
18
+ }
19
+
20
+ /** The seat's verdict for the paper in `dir`. */
21
+ export function seatVerdict(
22
+ dir: string,
23
+ deps: { readonly files: Files },
24
+ ): SeatVerdict {
25
+ // readPaperSettings, as the lint run reads the file: a file that does not parse, or cycles it cannot
26
+ // hold, is an error here, never a "not required" (readCycles alone reads broken JSON as no cycles).
27
+ const settings = readPaperSettings(deps.files, dir);
28
+ if (!settings.ok)
29
+ return { code: 2, line: `prior-reviews: ${settings.error.why}` };
30
+ const cycles = settings.value?.cycles ?? null;
31
+ const prior = cycles === null ? null : priorReviewsOf(cycles);
32
+ if (prior === null)
33
+ return {
34
+ code: 0,
35
+ line: "not required: no rejection with reviews before the open attempt",
36
+ };
37
+ const from = `reviews from ${prior.rejected.id}, answered by ${prior.open.id}`;
38
+ return deps.files.isFile(callerPath(join(dir, prior.file)))
39
+ ? { code: 0, line: `required: ${prior.file} (${from})` }
40
+ : {
41
+ code: 1,
42
+ line: `required, and ${prior.file} is missing (${from}): write it first; cycle/prior-reviews-answered fails until it exists`,
43
+ };
44
+ }
45
+
46
+ /** Where the command writes. */
47
+ export interface Output {
48
+ readonly out: (s: string) => void;
49
+ readonly err: (s: string) => void;
50
+ }
51
+
52
+ /** Run the command on `argv`; the exit code. */
53
+ export function main(
54
+ argv: readonly string[],
55
+ deps: { readonly files: Files },
56
+ { out, err }: Output,
57
+ ): number {
58
+ const [arg] = argv;
59
+ if (arg === undefined) {
60
+ err("usage: node prior-reviews.js <paper-dir>\n");
61
+ return 2;
62
+ }
63
+ const verdict = seatVerdict(callerPath(arg), deps);
64
+ (verdict.code === 0 ? out : err)(`${verdict.line}\n`);
65
+ return verdict.code;
66
+ }
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * prior-reviews — whether the panel's prior-reviews seat must sit, and its points file
4
+ * (`prior-reviews-core.ts`); this file only runs it. A consumer runs the compiled `prior-reviews.js`
5
+ * (Node strips no types under node_modules).
6
+ *
7
+ * Usage: node prior-reviews.js <paper-dir>
8
+ */
9
+ import { nodeFiles } from "#src/adapters/node/index";
10
+ import { main } from "./prior-reviews-core.js";
11
+ process.exitCode = main(process.argv.slice(2), { files: nodeFiles }, {
12
+ out: (s) => process.stdout.write(s),
13
+ err: (s) => process.stderr.write(s),
14
+ });
@@ -0,0 +1,206 @@
1
+ /**
2
+ * prior-reviews-core.ts: the prior-reviews seat sits exactly when `cycle/prior-reviews-answered`
3
+ * fires, past attempts that brought no reviews, and names the points file it reads.
4
+ */
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { describe, expect, it } from "vitest";
8
+ import { memoryFiles } from "#src/adapters/memory/index";
9
+ import { runNode, useTempDir, writeTree } from "../../../test/support.ts";
10
+ import { readPaperSettings } from "#src/paper-settings";
11
+ import { main, seatVerdict } from "./prior-reviews-core.ts";
12
+
13
+ const SCRIPT = join(
14
+ dirname(fileURLToPath(import.meta.url)),
15
+ "prior-reviews.ts",
16
+ );
17
+ const PAPER = "/work/papers/p";
18
+ const POINTS = "reviews/alpha-response.yaml";
19
+
20
+ const venue = (name: string) => ({
21
+ kind: "named",
22
+ name,
23
+ url: `https://${name.toLowerCase()}.example`,
24
+ });
25
+ const REVIEWED = {
26
+ id: "alpha-2026",
27
+ venue: venue("Alpha"),
28
+ opened: "2026-06-01",
29
+ deadlines: [],
30
+ outcome: {
31
+ kind: "rejected",
32
+ date: "2026-09-08",
33
+ evidence: "reviews/alpha.eml",
34
+ desk: false,
35
+ points: POINTS,
36
+ },
37
+ };
38
+ const between = (outcome: object) => ({
39
+ id: "gamma-2026",
40
+ venue: venue("Gamma"),
41
+ opened: "2026-09-09",
42
+ deadlines: [],
43
+ outcome: { date: "2026-10-01", evidence: "reviews/gamma.eml", ...outcome },
44
+ });
45
+ const OPEN = {
46
+ id: "beta-2027",
47
+ venue: venue("Beta"),
48
+ opened: "2026-10-02",
49
+ deadlines: [],
50
+ };
51
+
52
+ /** The paper folder with `cycles` as its record, and the points file when `points` is true. */
53
+ const paper = (cycles: readonly object[] | undefined, points = true) =>
54
+ memoryFiles({
55
+ [`${PAPER}/paperlint.json`]: JSON.stringify(
56
+ cycles === undefined ? {} : { cycles },
57
+ ),
58
+ ...(points ? { [`${PAPER}/${POINTS}`]: "points: []\n" } : {}),
59
+ });
60
+
61
+ const verdict = (cycles: readonly object[] | undefined, points = true) =>
62
+ seatVerdict(PAPER, { files: paper(cycles, points) });
63
+
64
+ /** A record whose one cycle has no id, venue or dates: the settings reader refuses it. */
65
+ const BROKEN = JSON.stringify({ cycles: [{}] });
66
+
67
+ const REQUIRED = {
68
+ code: 0,
69
+ line: `required: ${POINTS} (reviews from alpha-2026, answered by beta-2027)`,
70
+ };
71
+ const NOT_REQUIRED = {
72
+ code: 0,
73
+ line: "not required: no rejection with reviews before the open attempt",
74
+ };
75
+
76
+ describe("seatVerdict — the seat sits when the rule fires", () => {
77
+ it("🔴 rejected with reviews → withdrawn → open: required, with the rejection's points file", () => {
78
+ expect(verdict([REVIEWED, between({ kind: "withdrawn" }), OPEN])).toEqual(
79
+ REQUIRED,
80
+ );
81
+ });
82
+
83
+ it("🔴 rejected with reviews → desk-rejected → open: required", () => {
84
+ expect(
85
+ verdict([REVIEWED, between({ kind: "rejected", desk: true }), OPEN]),
86
+ ).toEqual(REQUIRED);
87
+ });
88
+
89
+ it("🔴 rejected with reviews, then open directly: required", () => {
90
+ expect(verdict([REVIEWED, { ...OPEN, opened: "2026-09-09" }])).toEqual(
91
+ REQUIRED,
92
+ );
93
+ });
94
+
95
+ it("🔴 required, and the points file is missing: exit 1, says to write it", () => {
96
+ expect(verdict([REVIEWED, OPEN], false)).toEqual({
97
+ code: 1,
98
+ line: `required, and ${POINTS} is missing (reviews from alpha-2026, answered by beta-2027): write it first; cycle/prior-reviews-answered fails until it exists`,
99
+ });
100
+ });
101
+
102
+ it("no cycles recorded: not required", () => {
103
+ expect(verdict(undefined)).toEqual(NOT_REQUIRED);
104
+ });
105
+
106
+ it("only a desk rejection before the open attempt: not required", () => {
107
+ expect(verdict([between({ kind: "rejected", desk: true }), OPEN])).toEqual(
108
+ NOT_REQUIRED,
109
+ );
110
+ });
111
+
112
+ it("the reviewed rejection is the last attempt, nothing open: not required", () => {
113
+ expect(verdict([REVIEWED])).toEqual(NOT_REQUIRED);
114
+ });
115
+
116
+ it('🔴 a paperlint.json that does not parse: exit 2 with readPaperSettings\' reason, never "not required"', () => {
117
+ const files = memoryFiles({
118
+ [`${PAPER}/paperlint.json`]: '{ "cycles": [], }',
119
+ });
120
+ const read = readPaperSettings(files, PAPER);
121
+ expect({ read: read.ok, verdict: seatVerdict(PAPER, { files }) }).toEqual({
122
+ read: false,
123
+ verdict: {
124
+ code: 2,
125
+ line: `prior-reviews: ${read.ok ? "" : read.error.why}`,
126
+ },
127
+ });
128
+ });
129
+
130
+ it("🔴 cycles the record cannot hold: exit 2 with the settings' reason", () => {
131
+ const files = memoryFiles({ [`${PAPER}/paperlint.json`]: BROKEN });
132
+ const read = readPaperSettings(files, PAPER);
133
+ expect({ read: read.ok, verdict: seatVerdict(PAPER, { files }) }).toEqual({
134
+ read: false,
135
+ verdict: {
136
+ code: 2,
137
+ line: `prior-reviews: ${read.ok ? "" : read.error.why}`,
138
+ },
139
+ });
140
+ });
141
+ });
142
+
143
+ describe("main — the command", () => {
144
+ const run = (argv: readonly string[], cycles?: readonly object[]) => {
145
+ const out: string[] = [];
146
+ const err: string[] = [];
147
+ const code = main(
148
+ argv,
149
+ { files: paper(cycles) },
150
+ {
151
+ out: (s) => out.push(s),
152
+ err: (s) => err.push(s),
153
+ },
154
+ );
155
+ return { code, out: out.join(""), err: err.join("") };
156
+ };
157
+
158
+ it("🔴 prints the verdict on stdout", () => {
159
+ expect(run([PAPER], [REVIEWED, OPEN])).toEqual({
160
+ code: 0,
161
+ out: `${REQUIRED.line}\n`,
162
+ err: "",
163
+ });
164
+ });
165
+
166
+ it("no argument: the usage on stderr, exit 2", () => {
167
+ expect(run([])).toEqual({
168
+ code: 2,
169
+ out: "",
170
+ err: "usage: node prior-reviews.js <paper-dir>\n",
171
+ });
172
+ });
173
+
174
+ it("an unreadable record goes to stderr", () => {
175
+ const err: string[] = [];
176
+ const files = memoryFiles({ [`${PAPER}/paperlint.json`]: BROKEN });
177
+ const code = main(
178
+ [PAPER],
179
+ { files },
180
+ { out: () => {}, err: (s) => err.push(s) },
181
+ );
182
+ expect({ code, toStderr: err.length }).toEqual({ code: 2, toStderr: 1 });
183
+ });
184
+ });
185
+
186
+ describe("prior-reviews.ts — the runner on a real folder", () => {
187
+ const dir = useTempDir();
188
+
189
+ it("🔴 required for a reviewed rejection behind a withdrawal, from any cwd", () => {
190
+ writeTree(dir, {
191
+ "paperlint.json": JSON.stringify({
192
+ cycles: [REVIEWED, between({ kind: "withdrawn" }), OPEN],
193
+ }),
194
+ [POINTS]: "points: []\n",
195
+ });
196
+ const r = runNode(SCRIPT, [dir], { cwd: "/" });
197
+ expect(r).toEqual({ status: 0, stdout: `${REQUIRED.line}\n`, stderr: "" });
198
+ });
199
+ it("no argument: the usage on stderr, exit 2", () => {
200
+ expect(runNode(SCRIPT, [], { cwd: "/" })).toEqual({
201
+ status: 2,
202
+ stdout: "",
203
+ stderr: "usage: node prior-reviews.js <paper-dir>\n",
204
+ });
205
+ });
206
+ });
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * prior-reviews — whether the panel's prior-reviews seat must sit, and its points file
4
+ * (`prior-reviews-core.ts`); this file only runs it. A consumer runs the compiled `prior-reviews.js`
5
+ * (Node strips no types under node_modules).
6
+ *
7
+ * Usage: node prior-reviews.js <paper-dir>
8
+ */
9
+ import { nodeFiles } from "#src/adapters/node/index";
10
+ import { main } from "./prior-reviews-core.ts";
11
+
12
+ process.exitCode = main(
13
+ process.argv.slice(2),
14
+ { files: nodeFiles },
15
+ {
16
+ out: (s) => process.stdout.write(s),
17
+ err: (s) => process.stderr.write(s),
18
+ },
19
+ );