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.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/skill-chunks/{chunk-J5XYPERO.js → chunk-FOYA3JCS.js} +0 -6
- package/dist/skill-chunks/chunk-KCX34KV4.js +7610 -0
- package/dist/skill-chunks/{chunk-WYQTXKNM.js → chunk-KIKDPXE4.js} +2 -2
- package/dist/skill-chunks/{chunk-EDHTB7KT.js → chunk-MX3LJNFG.js} +4 -2
- package/dist/skill-chunks/chunk-UE2CAVD6.js +34 -0
- package/dist/skill-chunks/{chunk-QPWFSYJG.js → chunk-ZWJMR4TF.js} +5 -7
- package/dist/skills/paper-pipeline/scripts/revision-plan-core.d.ts +79 -0
- package/dist/skills/paper-pipeline/scripts/revision-plan.d.ts +2 -0
- package/package.json +1 -1
- package/scripts/bundle-skills.ts +1 -0
- package/scripts/test.test.ts +1 -0
- package/scripts/test.ts +4 -0
- package/skills/argument-arc/scripts/headings.js +3 -2
- package/skills/cold-read-diff/scripts/cold-read.js +3 -2
- package/skills/find-venue/SKILL.md +3 -2
- package/skills/find-venue/SKILL.md.spec.ts +2 -1
- package/skills/harden-paper/SKILL.md +5 -1
- package/skills/harden-paper/SKILL.md.spec.ts +4 -0
- package/skills/paper-pipeline/SKILL.md +29 -4
- package/skills/paper-pipeline/SKILL.md.spec.ts +28 -3
- package/skills/paper-pipeline/scripts/README.md +6 -5
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +4 -3
- package/skills/paper-pipeline/scripts/revision-plan-core.js +194 -0
- package/skills/paper-pipeline/scripts/revision-plan-core.ts +286 -0
- package/skills/paper-pipeline/scripts/revision-plan.js +462 -0
- package/skills/paper-pipeline/scripts/revision-plan.test.ts +386 -0
- package/skills/paper-pipeline/scripts/revision-plan.ts +21 -0
- package/skills/paper-status/SKILL.md +2 -1
- package/skills/paper-status/SKILL.md.spec.ts +1 -0
- package/skills/pc-panel-review/SKILL.md +5 -2
- package/skills/pc-panel-review/SKILL.md.spec.ts +4 -1
- package/skills/pc-panel-review/pc-panel-review.harness.ts +122 -0
- package/skills/pc-panel-review/scripts/prior-reviews.js +11 -7031
- package/skills/study-accepted-papers/SKILL.md +5 -2
- package/skills/study-accepted-papers/SKILL.md.spec.ts +4 -1
- package/skills/study-accepted-papers/scripts/corpus-licences.js +1 -1
- package/skills/tighten-paper/SKILL.md +3 -2
- package/skills/tighten-paper/SKILL.md.spec.ts +2 -1
- package/skills/verify-citations/scripts/bib-authors.js +4 -3
- package/skills/verify-citations/scripts/verify-cites.js +4 -3
|
@@ -0,0 +1,286 @@
|
|
|
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 type { Current } from "#src/domain/cycle";
|
|
19
|
+
import type { VenueScope } from "#src/domain/venue-scope";
|
|
20
|
+
import {
|
|
21
|
+
REVISION_PLAN,
|
|
22
|
+
type Bar,
|
|
23
|
+
type Measurement,
|
|
24
|
+
type PlanProblem,
|
|
25
|
+
type RevisionPlan,
|
|
26
|
+
type Row,
|
|
27
|
+
} from "#src/domain/revision-plan";
|
|
28
|
+
import type { Files } from "#src/ports/files";
|
|
29
|
+
import type { RevisionPlanCodec } from "#src/ports/revision-plan-codec";
|
|
30
|
+
import {
|
|
31
|
+
paperPreset,
|
|
32
|
+
unusablePresetLine,
|
|
33
|
+
type PaperPreset,
|
|
34
|
+
} from "#src/presets";
|
|
35
|
+
|
|
36
|
+
/** What the script reads through. */
|
|
37
|
+
export interface Deps {
|
|
38
|
+
readonly files: Files;
|
|
39
|
+
readonly codec: RevisionPlanCodec;
|
|
40
|
+
/** The package's presets directory (`presetsDir()`). */
|
|
41
|
+
readonly venuesDir: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The plan file, as far as the script can read it. */
|
|
45
|
+
export type PlanRead =
|
|
46
|
+
| { readonly kind: "none" }
|
|
47
|
+
| { readonly kind: "unreadable"; readonly problems: readonly PlanProblem[] }
|
|
48
|
+
| { readonly kind: "read"; readonly plan: RevisionPlan };
|
|
49
|
+
|
|
50
|
+
/** Where the plan stands against the paper's cycles. */
|
|
51
|
+
export type CycleFit =
|
|
52
|
+
/** `paperlint.json` keeps no `cycles`: nothing to hold the plan's cycle against. */
|
|
53
|
+
| { readonly kind: "no-cycles" }
|
|
54
|
+
| { readonly kind: "current" }
|
|
55
|
+
| { readonly kind: "stale"; readonly current: string }
|
|
56
|
+
/** No open attempt: the paper is accepted, between venues, or has no cycle yet. */
|
|
57
|
+
| { readonly kind: "no-open-cycle" };
|
|
58
|
+
|
|
59
|
+
/** The plan's cycle held against the paper's current attempt. Pure. */
|
|
60
|
+
export const cycleFit = (
|
|
61
|
+
plan: RevisionPlan,
|
|
62
|
+
current: Current | null,
|
|
63
|
+
): CycleFit => {
|
|
64
|
+
if (current === null) return { kind: "no-cycles" };
|
|
65
|
+
if (current.kind !== "cycle") return { kind: "no-open-cycle" };
|
|
66
|
+
return current.cycle.id === plan.cycle
|
|
67
|
+
? { kind: "current" }
|
|
68
|
+
: { kind: "stale", current: current.cycle.id };
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** The plan file of the paper in `dir`, read and parsed. */
|
|
72
|
+
export const readPlan = (dir: string, deps: Deps): PlanRead => {
|
|
73
|
+
const bytes = deps.files.readBytes(callerPath(join(dir, REVISION_PLAN)));
|
|
74
|
+
if (bytes === null) return { kind: "none" };
|
|
75
|
+
const parsed = deps.codec.parse(new TextDecoder().decode(bytes));
|
|
76
|
+
return parsed.ok
|
|
77
|
+
? { kind: "read", plan: parsed.plan }
|
|
78
|
+
: { kind: "unreadable", problems: parsed.problems };
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const barLine = (b: Bar): string => {
|
|
82
|
+
switch (b.kind) {
|
|
83
|
+
case "corpus":
|
|
84
|
+
return `bar: the accepted papers of ${b.series}, ${b.editions.join(", ")}`;
|
|
85
|
+
case "proxy":
|
|
86
|
+
return `bar: the accepted papers of ${b.series}, standing in for ${b.stands_in_for}`;
|
|
87
|
+
case "none":
|
|
88
|
+
return `bar: none — ${b.why}`;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const measurementLine = (m: Measurement): string =>
|
|
93
|
+
m.kind === "open"
|
|
94
|
+
? "measurement: open — new evidence may still be added"
|
|
95
|
+
: `measurement: enough since ${m.since} (${m.evidence}) — no new study, only the text`;
|
|
96
|
+
|
|
97
|
+
const fitLine = (plan: RevisionPlan, fit: CycleFit): string => {
|
|
98
|
+
const head = `plan: ${plan.cycle}, written ${plan.written}`;
|
|
99
|
+
switch (fit.kind) {
|
|
100
|
+
case "current":
|
|
101
|
+
return `${head} · the current cycle`;
|
|
102
|
+
case "stale":
|
|
103
|
+
return `${head} · the current cycle is ${fit.current} — rewrite the plan for it`;
|
|
104
|
+
case "no-open-cycle":
|
|
105
|
+
return `${head} · the paper has no open cycle`;
|
|
106
|
+
case "no-cycles":
|
|
107
|
+
return `${head} · paperlint.json keeps no cycles to hold it against`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The scope lines: the call's sentences verbatim, from the paper's venue preset. A `paperlint.json`
|
|
113
|
+
* that does not parse never gets here: `report` stops on it first, and the type says so.
|
|
114
|
+
*/
|
|
115
|
+
export const scopeLines = (
|
|
116
|
+
p: Exclude<PaperPreset, { kind: "settings-problem" }>,
|
|
117
|
+
): readonly string[] => {
|
|
118
|
+
switch (p.kind) {
|
|
119
|
+
case "none":
|
|
120
|
+
return ["scope: no venue — paperlint.json names no preset"];
|
|
121
|
+
case "resolved":
|
|
122
|
+
return p.preset.scope === null
|
|
123
|
+
? [
|
|
124
|
+
`scope: none recorded — ${p.preset.id} has no \`scope\` in its preset (add-venue)`,
|
|
125
|
+
]
|
|
126
|
+
: scopeText(p.preset.scope);
|
|
127
|
+
case "preset-problem":
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/** One venue scope as lines: its address and reading date, each sentence quoted, then its topics. */
|
|
133
|
+
export const scopeText = (s: VenueScope): readonly string[] => [
|
|
134
|
+
`scope: ${s.url} (read ${s.read})`,
|
|
135
|
+
...s.sentences.map((t) => ` > ${t}`),
|
|
136
|
+
...(s.topics.length === 0
|
|
137
|
+
? []
|
|
138
|
+
: [" topics:", ...s.topics.map((t) => ` - ${t}`)]),
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
const STATE_WIDTH = 8;
|
|
142
|
+
|
|
143
|
+
/** One row: its id, state, what it asks, and what closes it. */
|
|
144
|
+
export const rowLine = (r: Row): string => {
|
|
145
|
+
const head = `${r.id} ${r.state.padEnd(STATE_WIDTH)} ${r.what}`;
|
|
146
|
+
switch (r.state) {
|
|
147
|
+
case "todo":
|
|
148
|
+
case "doing":
|
|
149
|
+
return head;
|
|
150
|
+
case "done":
|
|
151
|
+
return `${head} — evidence: ${r.evidence}`;
|
|
152
|
+
case "dropped":
|
|
153
|
+
return `${head} — ${r.kind}: ${r.reason}`;
|
|
154
|
+
case "by-rule":
|
|
155
|
+
return `${head} — closed when paperlint lint reports nothing for ${r.rule}`;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/** Whether the list is closed, as far as the plan alone can say. */
|
|
160
|
+
export type Stop =
|
|
161
|
+
| { readonly kind: "met" }
|
|
162
|
+
| {
|
|
163
|
+
readonly kind: "not-met";
|
|
164
|
+
readonly open: readonly string[];
|
|
165
|
+
readonly byRule: readonly string[];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/** The stop verdict over the rows: met when nothing is open; `by-rule` rows are lint's to decide. Pure. */
|
|
169
|
+
export const stopOf = (rows: readonly Row[]): Stop => {
|
|
170
|
+
const open = rows
|
|
171
|
+
.filter((r) => r.state === "todo" || r.state === "doing")
|
|
172
|
+
.map((r) => r.id);
|
|
173
|
+
const byRule = rows.filter((r) => r.state === "by-rule").map((r) => r.id);
|
|
174
|
+
return open.length === 0 && byRule.length === 0
|
|
175
|
+
? { kind: "met" }
|
|
176
|
+
: { kind: "not-met", open, byRule };
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const stopLine = (s: Stop): string => {
|
|
180
|
+
if (s.kind === "met") return "stop: met — every row is done or dropped";
|
|
181
|
+
const parts = [
|
|
182
|
+
...(s.open.length === 0 ? [] : [`open ${s.open.join(" ")}`]),
|
|
183
|
+
...(s.byRule.length === 0
|
|
184
|
+
? []
|
|
185
|
+
: [`paperlint lint decides ${s.byRule.join(" ")}`]),
|
|
186
|
+
];
|
|
187
|
+
return `stop: not met — ${parts.join(" · ")}`;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/** The rows added after the plan was written: growth of the list, which its reader sees. Pure. */
|
|
191
|
+
export const addedAfter = (plan: RevisionPlan): readonly string[] =>
|
|
192
|
+
plan.remaining.filter((r) => r.added > plan.written).map((r) => r.id);
|
|
193
|
+
|
|
194
|
+
/** What the command prints, and its exit code. */
|
|
195
|
+
export interface Report {
|
|
196
|
+
readonly code: number;
|
|
197
|
+
readonly lines: readonly string[];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** The report when the paper has no plan. */
|
|
201
|
+
const noPlan = (dir: string, scope: readonly string[]): Report => ({
|
|
202
|
+
code: 0,
|
|
203
|
+
lines: [
|
|
204
|
+
`plan: none written — ${join(dir, REVISION_PLAN)} does not exist`,
|
|
205
|
+
...scope,
|
|
206
|
+
"stop: no plan — nothing says what is left",
|
|
207
|
+
],
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
/** The report when the plan does not parse: each problem at its field. */
|
|
211
|
+
const unreadable = (dir: string, problems: readonly PlanProblem[]): Report => ({
|
|
212
|
+
code: 1,
|
|
213
|
+
lines: [
|
|
214
|
+
`plan: unreadable — ${join(dir, REVISION_PLAN)}`,
|
|
215
|
+
...problems.map(
|
|
216
|
+
(p) =>
|
|
217
|
+
` ${p.path.length === 0 ? "(the file)" : p.path.join(".")}: ${p.message}`,
|
|
218
|
+
),
|
|
219
|
+
"stop: unreadable — fix the plan first",
|
|
220
|
+
],
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
/** The report for the paper in `dir`. */
|
|
224
|
+
export const report = (dir: string, deps: Deps): Report => {
|
|
225
|
+
const preset = paperPreset(callerPath(dir), deps);
|
|
226
|
+
if (preset.kind === "settings-problem")
|
|
227
|
+
return { code: 1, lines: [unusablePresetLine(dir, preset)] };
|
|
228
|
+
const read = readPlan(dir, deps);
|
|
229
|
+
const scope = scopeLines(preset);
|
|
230
|
+
switch (read.kind) {
|
|
231
|
+
case "none":
|
|
232
|
+
return noPlan(dir, scope);
|
|
233
|
+
case "unreadable":
|
|
234
|
+
return unreadable(dir, read.problems);
|
|
235
|
+
case "read":
|
|
236
|
+
return { code: 0, lines: planLines(read.plan, preset, scope) };
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const growthLine = (grown: readonly string[]): string =>
|
|
241
|
+
grown.length === 0
|
|
242
|
+
? "rows added after the plan was written: 0"
|
|
243
|
+
: `rows added after the plan was written: ${String(grown.length)} (${grown.join(" ")})`;
|
|
244
|
+
|
|
245
|
+
const planLines = (
|
|
246
|
+
plan: RevisionPlan,
|
|
247
|
+
preset: Exclude<PaperPreset, { readonly kind: "settings-problem" }>,
|
|
248
|
+
scope: readonly string[],
|
|
249
|
+
): readonly string[] => {
|
|
250
|
+
const fit = cycleFit(plan, preset.settings?.cycles?.current ?? null);
|
|
251
|
+
return [
|
|
252
|
+
fitLine(plan, fit),
|
|
253
|
+
barLine(plan.bar),
|
|
254
|
+
measurementLine(plan.measurement),
|
|
255
|
+
growthLine(addedAfter(plan)),
|
|
256
|
+
...(preset.kind === "preset-problem"
|
|
257
|
+
? [`scope: unknown — ${unusablePresetLine("", preset)}`]
|
|
258
|
+
: scope),
|
|
259
|
+
...plan.remaining.map(rowLine),
|
|
260
|
+
fit.kind === "stale"
|
|
261
|
+
? `stop: unknown — the plan is for ${plan.cycle}, not ${fit.current}`
|
|
262
|
+
: stopLine(stopOf(plan.remaining)),
|
|
263
|
+
];
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/** Where the command writes. */
|
|
267
|
+
export interface Output {
|
|
268
|
+
readonly out: (s: string) => void;
|
|
269
|
+
readonly err: (s: string) => void;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** Run the command on `argv`; the exit code. */
|
|
273
|
+
export function main(
|
|
274
|
+
argv: readonly string[],
|
|
275
|
+
deps: Deps,
|
|
276
|
+
{ out, err }: Output,
|
|
277
|
+
): number {
|
|
278
|
+
const [arg] = argv;
|
|
279
|
+
if (arg === undefined) {
|
|
280
|
+
err("usage: node revision-plan.js <paper-dir>\n");
|
|
281
|
+
return 2;
|
|
282
|
+
}
|
|
283
|
+
const r = report(arg, deps);
|
|
284
|
+
(r.code === 0 ? out : err)(`${r.lines.join("\n")}\n`);
|
|
285
|
+
return r.code;
|
|
286
|
+
}
|