paperlint 20.8.0 → 20.9.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.
Files changed (41) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/skill-chunks/{chunk-J5XYPERO.js → chunk-FOYA3JCS.js} +0 -6
  3. package/dist/skill-chunks/chunk-KCX34KV4.js +7610 -0
  4. package/dist/skill-chunks/{chunk-WYQTXKNM.js → chunk-KIKDPXE4.js} +2 -2
  5. package/dist/skill-chunks/{chunk-EDHTB7KT.js → chunk-MX3LJNFG.js} +4 -2
  6. package/dist/skill-chunks/chunk-UE2CAVD6.js +34 -0
  7. package/dist/skill-chunks/{chunk-QPWFSYJG.js → chunk-ZWJMR4TF.js} +5 -7
  8. package/dist/skills/paper-pipeline/scripts/revision-plan-core.d.ts +79 -0
  9. package/dist/skills/paper-pipeline/scripts/revision-plan.d.ts +2 -0
  10. package/package.json +1 -1
  11. package/scripts/bundle-skills.ts +1 -0
  12. package/scripts/test.test.ts +1 -0
  13. package/scripts/test.ts +4 -0
  14. package/skills/argument-arc/scripts/headings.js +3 -2
  15. package/skills/cold-read-diff/scripts/cold-read.js +3 -2
  16. package/skills/find-venue/SKILL.md +3 -2
  17. package/skills/find-venue/SKILL.md.spec.ts +2 -1
  18. package/skills/harden-paper/SKILL.md +5 -1
  19. package/skills/harden-paper/SKILL.md.spec.ts +4 -0
  20. package/skills/paper-pipeline/SKILL.md +29 -4
  21. package/skills/paper-pipeline/SKILL.md.spec.ts +28 -3
  22. package/skills/paper-pipeline/scripts/README.md +6 -5
  23. package/skills/paper-pipeline/scripts/extract-ref-facts.js +4 -3
  24. package/skills/paper-pipeline/scripts/revision-plan-core.js +194 -0
  25. package/skills/paper-pipeline/scripts/revision-plan-core.ts +286 -0
  26. package/skills/paper-pipeline/scripts/revision-plan.js +462 -0
  27. package/skills/paper-pipeline/scripts/revision-plan.test.ts +386 -0
  28. package/skills/paper-pipeline/scripts/revision-plan.ts +21 -0
  29. package/skills/paper-status/SKILL.md +2 -1
  30. package/skills/paper-status/SKILL.md.spec.ts +1 -0
  31. package/skills/pc-panel-review/SKILL.md +5 -2
  32. package/skills/pc-panel-review/SKILL.md.spec.ts +4 -1
  33. package/skills/pc-panel-review/pc-panel-review.harness.ts +122 -0
  34. package/skills/pc-panel-review/scripts/prior-reviews.js +11 -7031
  35. package/skills/study-accepted-papers/SKILL.md +5 -2
  36. package/skills/study-accepted-papers/SKILL.md.spec.ts +4 -1
  37. package/skills/study-accepted-papers/scripts/corpus-licences.js +1 -1
  38. package/skills/tighten-paper/SKILL.md +3 -2
  39. package/skills/tighten-paper/SKILL.md.spec.ts +2 -1
  40. package/skills/verify-citations/scripts/bib-authors.js +4 -3
  41. package/skills/verify-citations/scripts/verify-cites.js +4 -3
@@ -9,14 +9,14 @@ import {
9
9
  printRaw,
10
10
  replaceNode,
11
11
  visit
12
- } from "./chunk-EDHTB7KT.js";
12
+ } from "./chunk-MX3LJNFG.js";
13
13
  import {
14
14
  JOBNAME,
15
15
  decoded,
16
16
  describeChanges,
17
17
  paperRecord,
18
18
  spelledIn
19
- } from "./chunk-J5XYPERO.js";
19
+ } from "./chunk-FOYA3JCS.js";
20
20
  import {
21
21
  CONFIG_KEY,
22
22
  settingsOf
@@ -11,11 +11,13 @@ import {
11
11
  SOURCES_SCHEMA,
12
12
  collapse,
13
13
  documentClassLine,
14
- fieldOf,
15
14
  optionsInEffect,
16
15
  readWhole,
17
16
  venueClass
18
- } from "./chunk-J5XYPERO.js";
17
+ } from "./chunk-FOYA3JCS.js";
18
+ import {
19
+ fieldOf
20
+ } from "./chunk-ZWJMR4TF.js";
19
21
  import {
20
22
  err,
21
23
  ok
@@ -0,0 +1,34 @@
1
+ import { createRequire as __plCreateRequire } from "node:module";
2
+ import { fileURLToPath as __plFileURLToPath } from "node:url";
3
+ import { dirname as __plDirname } from "node:path";
4
+ const require = __plCreateRequire(import.meta.url);
5
+ const __filename = __plFileURLToPath(import.meta.url);
6
+ const __dirname = __plDirname(__filename);
7
+ import {
8
+ sortBy
9
+ } from "./chunk-C2G5EK7S.js";
10
+
11
+ // src/domain/edition.ts
12
+ var SERIES = "[a-z0-9]+(?:-[a-z0-9]+)*";
13
+ var EDITION_ID = new RegExp(`^(${SERIES})-(\\d{4})$`, "u");
14
+ var SERIES_ID = new RegExp(`^${SERIES}$`, "u");
15
+ function editionOf(id) {
16
+ const m = EDITION_ID.exec(id);
17
+ return m === null ? null : { series: String(m[1]), year: Number.parseInt(String(m[2]), 10) };
18
+ }
19
+ var endsInYear = (id) => /\d{4}$/u.test(id);
20
+ var editionsOf = (series, shipped) => editionsWithIds(series, shipped).map((e) => e.id);
21
+ var editionsWithIds = (series, shipped) => sortBy(
22
+ shipped.flatMap((id) => {
23
+ const e = editionOf(id);
24
+ return e !== null && e.series === series ? [{ ...e, id }] : [];
25
+ }),
26
+ (e) => e.year
27
+ );
28
+
29
+ export {
30
+ SERIES_ID,
31
+ editionOf,
32
+ endsInYear,
33
+ editionsOf
34
+ };
@@ -5,13 +5,11 @@ const require = __plCreateRequire(import.meta.url);
5
5
  const __filename = __plFileURLToPath(import.meta.url);
6
6
  const __dirname = __plDirname(__filename);
7
7
 
8
- // src/domain/edition.ts
9
- var SERIES = "[a-z0-9]+(?:-[a-z0-9]+)*";
10
- var EDITION_ID = new RegExp(`^(${SERIES})-(\\d{4})$`, "u");
11
- var SERIES_ID = new RegExp(`^${SERIES}$`, "u");
12
- var endsInYear = (id) => /\d{4}$/u.test(id);
8
+ // src/domain/record.ts
9
+ var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
10
+ var fieldOf = (v, key) => isRecord(v) ? v[key] : void 0;
13
11
 
14
12
  export {
15
- SERIES_ID,
16
- endsInYear
13
+ isRecord,
14
+ fieldOf
17
15
  };
@@ -0,0 +1,79 @@
1
+ import type { Current } from "#src/domain/cycle";
2
+ import type { VenueScope } from "#src/domain/venue-scope";
3
+ import { type PlanProblem, type RevisionPlan, type Row } from "#src/domain/revision-plan";
4
+ import type { Files } from "#src/ports/files";
5
+ import type { RevisionPlanCodec } from "#src/ports/revision-plan-codec";
6
+ import { type PaperPreset } from "#src/presets";
7
+ /** What the script reads through. */
8
+ export interface Deps {
9
+ readonly files: Files;
10
+ readonly codec: RevisionPlanCodec;
11
+ /** The package's presets directory (`presetsDir()`). */
12
+ readonly venuesDir: string;
13
+ }
14
+ /** The plan file, as far as the script can read it. */
15
+ export type PlanRead = {
16
+ readonly kind: "none";
17
+ } | {
18
+ readonly kind: "unreadable";
19
+ readonly problems: readonly PlanProblem[];
20
+ } | {
21
+ readonly kind: "read";
22
+ readonly plan: RevisionPlan;
23
+ };
24
+ /** Where the plan stands against the paper's cycles. */
25
+ export type CycleFit =
26
+ /** `paperlint.json` keeps no `cycles`: nothing to hold the plan's cycle against. */
27
+ {
28
+ readonly kind: "no-cycles";
29
+ } | {
30
+ readonly kind: "current";
31
+ } | {
32
+ readonly kind: "stale";
33
+ readonly current: string;
34
+ }
35
+ /** No open attempt: the paper is accepted, between venues, or has no cycle yet. */
36
+ | {
37
+ readonly kind: "no-open-cycle";
38
+ };
39
+ /** The plan's cycle held against the paper's current attempt. Pure. */
40
+ export declare const cycleFit: (plan: RevisionPlan, current: Current | null) => CycleFit;
41
+ /** The plan file of the paper in `dir`, read and parsed. */
42
+ export declare const readPlan: (dir: string, deps: Deps) => PlanRead;
43
+ /**
44
+ * The scope lines: the call's sentences verbatim, from the paper's venue preset. A `paperlint.json`
45
+ * that does not parse never gets here: `report` stops on it first, and the type says so.
46
+ */
47
+ export declare const scopeLines: (p: Exclude<PaperPreset, {
48
+ kind: "settings-problem";
49
+ }>) => readonly string[];
50
+ /** One venue scope as lines: its address and reading date, each sentence quoted, then its topics. */
51
+ export declare const scopeText: (s: VenueScope) => readonly string[];
52
+ /** One row: its id, state, what it asks, and what closes it. */
53
+ export declare const rowLine: (r: Row) => string;
54
+ /** Whether the list is closed, as far as the plan alone can say. */
55
+ export type Stop = {
56
+ readonly kind: "met";
57
+ } | {
58
+ readonly kind: "not-met";
59
+ readonly open: readonly string[];
60
+ readonly byRule: readonly string[];
61
+ };
62
+ /** The stop verdict over the rows: met when nothing is open; `by-rule` rows are lint's to decide. Pure. */
63
+ export declare const stopOf: (rows: readonly Row[]) => Stop;
64
+ /** The rows added after the plan was written: growth of the list, which its reader sees. Pure. */
65
+ export declare const addedAfter: (plan: RevisionPlan) => readonly string[];
66
+ /** What the command prints, and its exit code. */
67
+ export interface Report {
68
+ readonly code: number;
69
+ readonly lines: readonly string[];
70
+ }
71
+ /** The report for the paper in `dir`. */
72
+ export declare const report: (dir: string, deps: Deps) => Report;
73
+ /** Where the command writes. */
74
+ export interface Output {
75
+ readonly out: (s: string) => void;
76
+ readonly err: (s: string) => void;
77
+ }
78
+ /** Run the command on `argv`; the exit code. */
79
+ export declare function main(argv: readonly string[], deps: Deps, { 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": "20.8.0",
3
+ "version": "20.9.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",
@@ -47,6 +47,7 @@ export const SKILL_ENTRIES: readonly string[] = [
47
47
  "skills/cold-read-diff/scripts/cold-read.ts",
48
48
  "skills/label-agent-runs/scripts/labels.ts",
49
49
  "skills/paper-pipeline/scripts/extract-ref-facts.mjs",
50
+ "skills/paper-pipeline/scripts/revision-plan.ts",
50
51
  "skills/pc-panel-review/scripts/prior-reviews.ts",
51
52
  "skills/run-agent-grid/scripts/grid-guard.ts",
52
53
  "skills/study-accepted-papers/scripts/corpus-licences.ts",
@@ -171,6 +171,7 @@ test("--changed: vitest runs only the unit tests the branch affects, on the SOUR
171
171
  "--coverage.provider=v8",
172
172
  "--coverage.reporter=text",
173
173
  "--coverage.skipFull",
174
+ "--coverage.reportOnFailure",
174
175
  ],
175
176
  nodeOptions: "--conditions=paperlint-source",
176
177
  },
package/scripts/test.ts CHANGED
@@ -84,6 +84,9 @@ function shardOf(arg: string): Shard | null {
84
84
  * a threshold would turn a sound branch red. The gate stays CI's `coverage` job. It costs ~30 s
85
85
  * (166 s against 135 s on 207 test files, measured 2026-11-09), and it shows a missed branch before
86
86
  * CI does: twice on 2026-11-08 a full run failed on a branch this report names in seconds.
87
+ * `reportOnFailure`: vitest prints no coverage at all when any test fails, so one test that fails
88
+ * for the container alone (2026-11-25: `crop_quote` without PyMuPDF) hid the whole report, and the
89
+ * gaps it would have named reached CI (#690).
87
90
  */
88
91
  const CHANGED = "--changed";
89
92
  const CHANGED_VITEST = [
@@ -93,6 +96,7 @@ const CHANGED_VITEST = [
93
96
  "--coverage.provider=v8",
94
97
  "--coverage.reporter=text",
95
98
  "--coverage.skipFull",
99
+ "--coverage.reportOnFailure",
96
100
  ] as const;
97
101
 
98
102
  /** What the arguments say: the shard, `--changed` and the harness runner's own, or the argument that is no shard. */
@@ -8,12 +8,13 @@ const __dirname = __plDirname(__filename);
8
8
  import {
9
9
  latexReader,
10
10
  sourcesCodec
11
- } from "../../../dist/skill-chunks/chunk-EDHTB7KT.js";
11
+ } from "../../../dist/skill-chunks/chunk-MX3LJNFG.js";
12
12
  import {
13
13
  decoded,
14
14
  readPaper,
15
15
  runText
16
- } from "../../../dist/skill-chunks/chunk-J5XYPERO.js";
16
+ } from "../../../dist/skill-chunks/chunk-FOYA3JCS.js";
17
+ import "../../../dist/skill-chunks/chunk-ZWJMR4TF.js";
17
18
  import {
18
19
  callerPath,
19
20
  nodeFiles
@@ -10,11 +10,12 @@ import {
10
10
  parseLatex,
11
11
  sourcesCodec,
12
12
  visit
13
- } from "../../../dist/skill-chunks/chunk-EDHTB7KT.js";
13
+ } from "../../../dist/skill-chunks/chunk-MX3LJNFG.js";
14
14
  import {
15
15
  paperRecord,
16
16
  readPaper
17
- } from "../../../dist/skill-chunks/chunk-J5XYPERO.js";
17
+ } from "../../../dist/skill-chunks/chunk-FOYA3JCS.js";
18
+ import "../../../dist/skill-chunks/chunk-ZWJMR4TF.js";
18
19
  import {
19
20
  messageOf,
20
21
  nodeFiles
@@ -4,7 +4,7 @@ description: "Discover and rank real venues for a given paper, scored by whether
4
4
  allowed-tools: [Read, Write, Grep, Glob, WebSearch, WebFetch, Agent]
5
5
  ---
6
6
 
7
- <!-- vigiles:sha256:784a0e1bfaa6e736 compiled from skills/find-venue/SKILL.md.spec.ts -->
7
+ <!-- vigiles:sha256:3a2832a42e4f4dbb compiled from skills/find-venue/SKILL.md.spec.ts -->
8
8
 
9
9
  # find-venue — rank real venues by what makes a publication, then keep or switch
10
10
 
@@ -61,7 +61,8 @@ rank = archival-weight × topic-fit × accept-probability × deadline-feasibilit
61
61
  type fit, **indexed? (Y/N + where)**, double-blind, remote, selectivity, computed rank.
62
62
  2. **Keep/switch recommendation** — the top-ranked venue with the one-line reason, and (if the paper
63
63
  already has a target) an explicit **keep** or **switch** verdict against it. Note the intended
64
- `extend-paper` upgrade target for later.
64
+ `extend-paper` upgrade target for later. After a **switch**, the paper's revision plan is for the
65
+ old cycle: say that it must be rewritten for the new one (`paper-pipeline`, "The revision plan").
65
66
 
66
67
  ## Rules
67
68
  - Fetch every CFP fact from the real page; never invent a deadline, page limit, or indexing status.
@@ -70,7 +70,8 @@ rank = archival-weight × topic-fit × accept-probability × deadline-feasibilit
70
70
  type fit, **indexed? (Y/N + where)**, double-blind, remote, selectivity, computed rank.
71
71
  2. **Keep/switch recommendation** — the top-ranked venue with the one-line reason, and (if the paper
72
72
  already has a target) an explicit **keep** or **switch** verdict against it. Note the intended
73
- \`extend-paper\` upgrade target for later.
73
+ \`extend-paper\` upgrade target for later. After a **switch**, the paper's revision plan is for the
74
+ old cycle: say that it must be rewritten for the new one (\`paper-pipeline\`, "The revision plan").
74
75
 
75
76
  ## Rules
76
77
  - Fetch every CFP fact from the real page; never invent a deadline, page limit, or indexing status.
@@ -4,7 +4,7 @@ description: "Use when asking \"is this paper actually ready to submit?\" / \"wh
4
4
  allowed-tools: [Read, Write, Grep, Glob, Bash, Skill]
5
5
  ---
6
6
 
7
- <!-- vigiles:sha256:45642cfc040166a9 compiled from skills/harden-paper/SKILL.md.spec.ts -->
7
+ <!-- vigiles:sha256:7fd6cca5d1633e4b compiled from skills/harden-paper/SKILL.md.spec.ts -->
8
8
 
9
9
  # harden-paper — the submit checklist
10
10
 
@@ -27,6 +27,10 @@ the author decides what to apply. "Nothing fails" is a valid result.
27
27
  again, and fix nothing. No closed review fails this item. Count its blockers (the panel's consensus
28
28
  must-fixes and the cold read's `CANNOT PARSE` rows) by `status` in the reports' frontmatter:
29
29
  `fixed`, waived (`wontfix` with a `waived by the author` note), `open`. Any `open` one fails.
30
+ With a revision plan, the blockers are its rows instead: `node ${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/revision-plan.js <paper-dir>`, read as
31
+ `paper-pipeline` says ("The revision plan"). A row its `stop:` line names `open` fails this item; a row it
32
+ leaves to lint passes when item 1's run reports nothing for the rule on the row; `stop: unknown` or
33
+ `stop: unreadable` fails.
30
34
  3. **Citations and the nearest neighbour.** `verify-citations` ran on the current bibliography
31
35
  (`paper/refs-checked` warns when it did not). `map-prior-work`'s record exists
32
36
  (`siblings/README.md` and its sweep file) and names the closest match with a disposition:
@@ -38,6 +38,10 @@ the author decides what to apply. "Nothing fails" is a valid result.
38
38
  again, and fix nothing. No closed review fails this item. Count its blockers (the panel's consensus
39
39
  must-fixes and the cold read's \`CANNOT PARSE\` rows) by \`status\` in the reports' frontmatter:
40
40
  \`fixed\`, waived (\`wontfix\` with a \`waived by the author\` note), \`open\`. Any \`open\` one fails.
41
+ With a revision plan, the blockers are its rows instead: \`node \${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/revision-plan.js <paper-dir>\`, read as
42
+ \`paper-pipeline\` says ("The revision plan"). A row its \`stop:\` line names \`open\` fails this item; a row it
43
+ leaves to lint passes when item 1's run reports nothing for the rule on the row; \`stop: unknown\` or
44
+ \`stop: unreadable\` fails.
41
45
  3. **Citations and the nearest neighbour.** \`verify-citations\` ran on the current bibliography
42
46
  (\`paper/refs-checked\` warns when it did not). \`map-prior-work\`'s record exists
43
47
  (\`siblings/README.md\` and its sweep file) and names the closest match with a disposition:
@@ -4,7 +4,7 @@ description: The orchestrator for writing a research paper end-to-end, from idea
4
4
  allowed-tools: [Read, Write, Edit, Grep, Glob, Bash, WebSearch, WebFetch, Agent, Skill]
5
5
  ---
6
6
 
7
- <!-- vigiles:sha256:66354b5d44875bdc compiled from skills/paper-pipeline/SKILL.md.spec.ts -->
7
+ <!-- vigiles:sha256:56f4a23d0d4d612d compiled from skills/paper-pipeline/SKILL.md.spec.ts -->
8
8
 
9
9
  # paper-pipeline — the conductor for the whole organism
10
10
 
@@ -154,6 +154,30 @@ how a day disappears and the same paper ships.
154
154
  decides. Order is
155
155
  **final review → harden → submit**.
156
156
 
157
+ ## The revision plan — what is left, read before any review
158
+
159
+ `<paper-dir>/revision-plan.json` is the author's closed list of what is left this cycle (its format:
160
+ `docs/configuration.md` in the package). Every skill that reviews, cuts or judges readiness runs, first:
161
+
162
+ ```bash
163
+ node ${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/revision-plan.js <paper-dir>
164
+ ```
165
+
166
+ The one place its lines are read; every other skill points here.
167
+
168
+ - `plan: none written` — work as the rest of this skill says. At the start of a cycle, offer to write
169
+ one; it is the author's list, written on his yes.
170
+ - `… rewrite the plan for it` or `stop: unknown` — the plan is for an earlier cycle: say so, and judge
171
+ nothing against it until the author rewrites it. `plan: unreadable` — show its lines; he fixes the file.
172
+ - `scope:` — the venue's call, verbatim, from its preset: what every reviewer seat is given as the
173
+ venue's statement of what it is for.
174
+ - `measurement: enough` — no new study, experiment or data: only the text changes.
175
+ - `rows added after the plan was written: N` — say N to the author when it is above 0.
176
+ - The rows and `stop:` — what is left. `stop: met` closes the list; `paperlint lint decides R…` rows
177
+ close when `npx paperlint lint` reports nothing for the rule named on the row.
178
+ - **A finding that no row covers is a proposal:** record it `open` in its review's frontmatter, and it
179
+ stops nothing until the author adds a row. Whether a finding is about a row is a reader's judgement.
180
+
157
181
  ## The final review — once, in this order, then closed
158
182
 
159
183
  The one place this order is written; every other skill points here.
@@ -170,9 +194,10 @@ The one place this order is written; every other skill points here.
170
194
  receives only those still open; he decides the panel's after step 3. The write happens once, after
171
195
  step 3: every accepted fix in one pass, a sentence through `rewrite-unclear`, a cut on his yes. A
172
196
  decided finding is not raised again in this review.
173
- - **Blockers** are a closed list, frozen when the review closes: the panel's consensus must-fixes and
174
- the cold read's `CANNOT PARSE` rows. Each stops submission until `fixed` or `wontfix` with
175
- `note: "waived by the author: <reason>"`.
197
+ - **Blockers** are a closed list, frozen when the review closes. With a revision plan, they are its
198
+ rows: a must-fix or a `CANNOT PARSE` row no row covers is a proposal ("The revision plan"). Without
199
+ one, they are the panel's consensus must-fixes and the cold read's `CANNOT PARSE` rows. Each stops
200
+ submission until `fixed` or `wontfix` with `note: "waived by the author: <reason>"`.
176
201
  - **At most one confirmation, and only when the author asks for it:** he names the pass, and it runs once
177
202
  on what changed. No pass schedules another, and none reruns because a score is low.
178
203
  - **Then the review is closed,** whatever the scores; a blocker still `open` stays open into the checklist.
@@ -193,6 +193,30 @@ how a day disappears and the same paper ships.
193
193
  decides. Order is
194
194
  **final review → harden → submit**.
195
195
 
196
+ ## The revision plan — what is left, read before any review
197
+
198
+ \`<paper-dir>/revision-plan.json\` is the author's closed list of what is left this cycle (its format:
199
+ \`docs/configuration.md\` in the package). Every skill that reviews, cuts or judges readiness runs, first:
200
+
201
+ \`\`\`bash
202
+ node \${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/revision-plan.js <paper-dir>
203
+ \`\`\`
204
+
205
+ The one place its lines are read; every other skill points here.
206
+
207
+ - \`plan: none written\` — work as the rest of this skill says. At the start of a cycle, offer to write
208
+ one; it is the author's list, written on his yes.
209
+ - \`… rewrite the plan for it\` or \`stop: unknown\` — the plan is for an earlier cycle: say so, and judge
210
+ nothing against it until the author rewrites it. \`plan: unreadable\` — show its lines; he fixes the file.
211
+ - \`scope:\` — the venue's call, verbatim, from its preset: what every reviewer seat is given as the
212
+ venue's statement of what it is for.
213
+ - \`measurement: enough\` — no new study, experiment or data: only the text changes.
214
+ - \`rows added after the plan was written: N\` — say N to the author when it is above 0.
215
+ - The rows and \`stop:\` — what is left. \`stop: met\` closes the list; \`paperlint lint decides R…\` rows
216
+ close when \`npx paperlint lint\` reports nothing for the rule named on the row.
217
+ - **A finding that no row covers is a proposal:** record it \`open\` in its review's frontmatter, and it
218
+ stops nothing until the author adds a row. Whether a finding is about a row is a reader's judgement.
219
+
196
220
  ## The final review — once, in this order, then closed
197
221
 
198
222
  The one place this order is written; every other skill points here.
@@ -209,9 +233,10 @@ The one place this order is written; every other skill points here.
209
233
  receives only those still open; he decides the panel's after step 3. The write happens once, after
210
234
  step 3: every accepted fix in one pass, a sentence through \`rewrite-unclear\`, a cut on his yes. A
211
235
  decided finding is not raised again in this review.
212
- - **Blockers** are a closed list, frozen when the review closes: the panel's consensus must-fixes and
213
- the cold read's \`CANNOT PARSE\` rows. Each stops submission until \`fixed\` or \`wontfix\` with
214
- \`note: "waived by the author: <reason>"\`.
236
+ - **Blockers** are a closed list, frozen when the review closes. With a revision plan, they are its
237
+ rows: a must-fix or a \`CANNOT PARSE\` row no row covers is a proposal ("The revision plan"). Without
238
+ one, they are the panel's consensus must-fixes and the cold read's \`CANNOT PARSE\` rows. Each stops
239
+ submission until \`fixed\` or \`wontfix\` with \`note: "waived by the author: <reason>"\`.
215
240
  - **At most one confirmation, and only when the author asks for it:** he names the pass, and it runs once
216
241
  on what changed. No pass schedules another, and none reruns because a score is low.
217
242
  - **Then the review is closed,** whatever the scores; a blocker still \`open\` stays open into the checklist.
@@ -5,11 +5,12 @@ in their instructions; a consumer reaches them through the path in `paperlint.js
5
5
  (default `.claude/skills/paper-pipeline/scripts`, a symlink `paperlint init` makes into the
6
6
  installed package — see `consumer.mjs`).
7
7
 
8
- | file | what it answers |
9
- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
10
- | `extract-ref-facts.mjs` | parse the bibliography, ask the registries, write facts to JSON for the `refs/*` ESLint rules |
11
- | `generated-code.mjs` | lint the analysis scripts before they produce a number (unseeded randomness, absolute paths, …) |
12
- | `consumer.mjs` | where the consumer's repository is, and whether a script was executed or imported through the symlink |
8
+ | file | what it answers |
9
+ | ----------------------- | -------------------------------------------------------------------------------------------------------------- |
10
+ | `extract-ref-facts.mjs` | parse the bibliography, ask the registries, write facts to JSON for the `refs/*` ESLint rules |
11
+ | `generated-code.mjs` | lint the analysis scripts before they produce a number (unseeded randomness, absolute paths, …) |
12
+ | `revision-plan.ts` | what the paper's `revision-plan.json` says is left: its cycle, bar, the venue's scope, each row, one stop line |
13
+ | `consumer.mjs` | where the consumer's repository is, and whether a script was executed or imported through the symlink |
13
14
 
14
15
  The checkers with a `--flags-only` mode print nothing on a clean paper and exit 0 — that mode is
15
16
  for hooks and pre-commit, where any output means a finding.
@@ -10,13 +10,14 @@ import {
10
10
  bibliographyAt,
11
11
  bibliographyUnreadWhy,
12
12
  isMain
13
- } from "../../../dist/skill-chunks/chunk-WYQTXKNM.js";
13
+ } from "../../../dist/skill-chunks/chunk-KIKDPXE4.js";
14
14
  import {
15
15
  latexReader,
16
16
  sourcesCodec
17
- } from "../../../dist/skill-chunks/chunk-EDHTB7KT.js";
18
- import "../../../dist/skill-chunks/chunk-J5XYPERO.js";
17
+ } from "../../../dist/skill-chunks/chunk-MX3LJNFG.js";
18
+ import "../../../dist/skill-chunks/chunk-FOYA3JCS.js";
19
19
  import "../../../dist/skill-chunks/chunk-Z5YMDZYW.js";
20
+ import "../../../dist/skill-chunks/chunk-ZWJMR4TF.js";
20
21
  import {
21
22
  absolutePath,
22
23
  nodeFiles
@@ -0,0 +1,194 @@
1
+ /**
2
+ * revision-plan-core — what a paper's `revision-plan.json` says is left before it is submitted, read
3
+ * the same way by every skill that reviews, tightens or judges the paper (#502): the plan's cycle
4
+ * against the paper's current one, the bar, whether evidence is still being gathered, the venue's
5
+ * scope from its preset, every row with its state, and one stop line.
6
+ *
7
+ * The plan is parsed by `RevisionPlanCodec` (src/ports/revision-plan-codec.ts), the paper's cycles by
8
+ * `readPaperSettings`, its venue by `paperPreset`: nothing here re-parses what an owner parses. A row
9
+ * closed by a rule (`by-rule`) is not judged here: this script runs no lint, so it names the rule and
10
+ * `paperlint lint` decides it. No model, no network.
11
+ *
12
+ * Usage: node revision-plan.js <paper-dir>
13
+ * Exit: 0 — the report (with or without a plan) · 1 — the plan or paperlint.json cannot be read ·
14
+ * 2 — no paper folder named.
15
+ */
16
+ import { join } from "node:path";
17
+ import { callerPath } from "#src/caller-path";
18
+ import { REVISION_PLAN, } from "#src/domain/revision-plan";
19
+ import { paperPreset, unusablePresetLine, } from "#src/presets";
20
+ /** The plan's cycle held against the paper's current attempt. Pure. */
21
+ export const cycleFit = (plan, current) => {
22
+ if (current === null)
23
+ return { kind: "no-cycles" };
24
+ if (current.kind !== "cycle")
25
+ return { kind: "no-open-cycle" };
26
+ return current.cycle.id === plan.cycle
27
+ ? { kind: "current" }
28
+ : { kind: "stale", current: current.cycle.id };
29
+ };
30
+ /** The plan file of the paper in `dir`, read and parsed. */
31
+ export const readPlan = (dir, deps) => {
32
+ const bytes = deps.files.readBytes(callerPath(join(dir, REVISION_PLAN)));
33
+ if (bytes === null)
34
+ return { kind: "none" };
35
+ const parsed = deps.codec.parse(new TextDecoder().decode(bytes));
36
+ return parsed.ok
37
+ ? { kind: "read", plan: parsed.plan }
38
+ : { kind: "unreadable", problems: parsed.problems };
39
+ };
40
+ const barLine = (b) => {
41
+ switch (b.kind) {
42
+ case "corpus":
43
+ return `bar: the accepted papers of ${b.series}, ${b.editions.join(", ")}`;
44
+ case "proxy":
45
+ return `bar: the accepted papers of ${b.series}, standing in for ${b.stands_in_for}`;
46
+ case "none":
47
+ return `bar: none — ${b.why}`;
48
+ }
49
+ };
50
+ const measurementLine = (m) => m.kind === "open"
51
+ ? "measurement: open — new evidence may still be added"
52
+ : `measurement: enough since ${m.since} (${m.evidence}) — no new study, only the text`;
53
+ const fitLine = (plan, fit) => {
54
+ const head = `plan: ${plan.cycle}, written ${plan.written}`;
55
+ switch (fit.kind) {
56
+ case "current":
57
+ return `${head} · the current cycle`;
58
+ case "stale":
59
+ return `${head} · the current cycle is ${fit.current} — rewrite the plan for it`;
60
+ case "no-open-cycle":
61
+ return `${head} · the paper has no open cycle`;
62
+ case "no-cycles":
63
+ return `${head} · paperlint.json keeps no cycles to hold it against`;
64
+ }
65
+ };
66
+ /**
67
+ * The scope lines: the call's sentences verbatim, from the paper's venue preset. A `paperlint.json`
68
+ * that does not parse never gets here: `report` stops on it first, and the type says so.
69
+ */
70
+ export const scopeLines = (p) => {
71
+ switch (p.kind) {
72
+ case "none":
73
+ return ["scope: no venue — paperlint.json names no preset"];
74
+ case "resolved":
75
+ return p.preset.scope === null
76
+ ? [
77
+ `scope: none recorded — ${p.preset.id} has no \`scope\` in its preset (add-venue)`,
78
+ ]
79
+ : scopeText(p.preset.scope);
80
+ case "preset-problem":
81
+ return [];
82
+ }
83
+ };
84
+ /** One venue scope as lines: its address and reading date, each sentence quoted, then its topics. */
85
+ export const scopeText = (s) => [
86
+ `scope: ${s.url} (read ${s.read})`,
87
+ ...s.sentences.map((t) => ` > ${t}`),
88
+ ...(s.topics.length === 0
89
+ ? []
90
+ : [" topics:", ...s.topics.map((t) => ` - ${t}`)]),
91
+ ];
92
+ const STATE_WIDTH = 8;
93
+ /** One row: its id, state, what it asks, and what closes it. */
94
+ export const rowLine = (r) => {
95
+ const head = `${r.id} ${r.state.padEnd(STATE_WIDTH)} ${r.what}`;
96
+ switch (r.state) {
97
+ case "todo":
98
+ case "doing":
99
+ return head;
100
+ case "done":
101
+ return `${head} — evidence: ${r.evidence}`;
102
+ case "dropped":
103
+ return `${head} — ${r.kind}: ${r.reason}`;
104
+ case "by-rule":
105
+ return `${head} — closed when paperlint lint reports nothing for ${r.rule}`;
106
+ }
107
+ };
108
+ /** The stop verdict over the rows: met when nothing is open; `by-rule` rows are lint's to decide. Pure. */
109
+ export const stopOf = (rows) => {
110
+ const open = rows
111
+ .filter((r) => r.state === "todo" || r.state === "doing")
112
+ .map((r) => r.id);
113
+ const byRule = rows.filter((r) => r.state === "by-rule").map((r) => r.id);
114
+ return open.length === 0 && byRule.length === 0
115
+ ? { kind: "met" }
116
+ : { kind: "not-met", open, byRule };
117
+ };
118
+ const stopLine = (s) => {
119
+ if (s.kind === "met")
120
+ return "stop: met — every row is done or dropped";
121
+ const parts = [
122
+ ...(s.open.length === 0 ? [] : [`open ${s.open.join(" ")}`]),
123
+ ...(s.byRule.length === 0
124
+ ? []
125
+ : [`paperlint lint decides ${s.byRule.join(" ")}`]),
126
+ ];
127
+ return `stop: not met — ${parts.join(" · ")}`;
128
+ };
129
+ /** The rows added after the plan was written: growth of the list, which its reader sees. Pure. */
130
+ export const addedAfter = (plan) => plan.remaining.filter((r) => r.added > plan.written).map((r) => r.id);
131
+ /** The report when the paper has no plan. */
132
+ const noPlan = (dir, scope) => ({
133
+ code: 0,
134
+ lines: [
135
+ `plan: none written — ${join(dir, REVISION_PLAN)} does not exist`,
136
+ ...scope,
137
+ "stop: no plan — nothing says what is left",
138
+ ],
139
+ });
140
+ /** The report when the plan does not parse: each problem at its field. */
141
+ const unreadable = (dir, problems) => ({
142
+ code: 1,
143
+ lines: [
144
+ `plan: unreadable — ${join(dir, REVISION_PLAN)}`,
145
+ ...problems.map((p) => ` ${p.path.length === 0 ? "(the file)" : p.path.join(".")}: ${p.message}`),
146
+ "stop: unreadable — fix the plan first",
147
+ ],
148
+ });
149
+ /** The report for the paper in `dir`. */
150
+ export const report = (dir, deps) => {
151
+ const preset = paperPreset(callerPath(dir), deps);
152
+ if (preset.kind === "settings-problem")
153
+ return { code: 1, lines: [unusablePresetLine(dir, preset)] };
154
+ const read = readPlan(dir, deps);
155
+ const scope = scopeLines(preset);
156
+ switch (read.kind) {
157
+ case "none":
158
+ return noPlan(dir, scope);
159
+ case "unreadable":
160
+ return unreadable(dir, read.problems);
161
+ case "read":
162
+ return { code: 0, lines: planLines(read.plan, preset, scope) };
163
+ }
164
+ };
165
+ const growthLine = (grown) => grown.length === 0
166
+ ? "rows added after the plan was written: 0"
167
+ : `rows added after the plan was written: ${String(grown.length)} (${grown.join(" ")})`;
168
+ const planLines = (plan, preset, scope) => {
169
+ const fit = cycleFit(plan, preset.settings?.cycles?.current ?? null);
170
+ return [
171
+ fitLine(plan, fit),
172
+ barLine(plan.bar),
173
+ measurementLine(plan.measurement),
174
+ growthLine(addedAfter(plan)),
175
+ ...(preset.kind === "preset-problem"
176
+ ? [`scope: unknown — ${unusablePresetLine("", preset)}`]
177
+ : scope),
178
+ ...plan.remaining.map(rowLine),
179
+ fit.kind === "stale"
180
+ ? `stop: unknown — the plan is for ${plan.cycle}, not ${fit.current}`
181
+ : stopLine(stopOf(plan.remaining)),
182
+ ];
183
+ };
184
+ /** Run the command on `argv`; the exit code. */
185
+ export function main(argv, deps, { out, err }) {
186
+ const [arg] = argv;
187
+ if (arg === undefined) {
188
+ err("usage: node revision-plan.js <paper-dir>\n");
189
+ return 2;
190
+ }
191
+ const r = report(arg, deps);
192
+ (r.code === 0 ? out : err)(`${r.lines.join("\n")}\n`);
193
+ return r.code;
194
+ }