paperlint 18.9.1 → 19.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 (34) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/lib/skill-corpus.mjs +2 -113
  3. package/lib/skill-corpus.test.mjs +10 -11
  4. package/package.json +1 -2
  5. package/scripts/harness-api.frozen.json +0 -18
  6. package/skills/build-label-page/build-label-page.test.ts +2 -7
  7. package/skills/harden-paper/check-numbers.test.ts +104 -0
  8. package/skills/harden-paper/check-release-claims.test.ts +126 -0
  9. package/skills/label-agent-runs/label-agent-runs.harness.ts +2 -6
  10. package/skills/render-paper/render-paper.harness.mjs +153 -0
  11. package/skills/rewrite-unclear/rewrite-unclear.harness.ts +0 -5
  12. package/skills/run-agent-grid/run-agent-grid.harness.ts +2 -6
  13. package/skills/submit-paper/check-deanon.test.ts +165 -0
  14. package/lib/skill-checks.d.mts +0 -10
  15. package/lib/skill-checks.mjs +0 -403
  16. package/lib/skill-checks.test.mjs +0 -288
  17. package/skills/analyze-sibling-paper/analyze-sibling-paper.harness.mjs +0 -23
  18. package/skills/argument-arc/argument-arc.harness.mjs +0 -23
  19. package/skills/build-benchmark/build-benchmark.harness.mjs +0 -23
  20. package/skills/camera-ready/camera-ready.harness.mjs +0 -23
  21. package/skills/cold-read-diff/cold-read-diff.harness.mjs +0 -21
  22. package/skills/draft-paper/draft-paper.harness.mjs +0 -23
  23. package/skills/extend-paper/extend-paper.harness.mjs +0 -23
  24. package/skills/find-venue/find-venue.harness.mjs +0 -23
  25. package/skills/harden-paper/harden-paper.harness.mjs +0 -23
  26. package/skills/map-prior-work/map-prior-work.harness.mjs +0 -23
  27. package/skills/paper-status/paper-status.harness.mjs +0 -25
  28. package/skills/pc-panel-review/pc-panel-review.harness.mjs +0 -24
  29. package/skills/plan-paper-timeline/plan-paper-timeline.harness.mjs +0 -23
  30. package/skills/research-ideate/research-ideate.harness.mjs +0 -23
  31. package/skills/study-accepted-papers/study-accepted-papers.harness.mjs +0 -23
  32. package/skills/submit-paper/submit-paper.harness.mjs +0 -23
  33. package/skills/tighten-paper/tighten-paper.harness.mjs +0 -23
  34. package/skills/verify-citations/verify-citations.harness.mjs +0 -23
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "18.9.1",
3
+ "version": "19.0.0",
4
4
  "description": "Skills and hooks for writing a research paper with paperlint",
5
5
  "skills": "./skills/",
6
6
  "hooks": "./plugin/hooks/hooks.json"
@@ -1,37 +1,8 @@
1
1
  /**
2
- * skill-corpus.mjs — what a skill IS, read from its directory: the frontmatter, the tool contract,
3
- * the commands its text instructs. Derivation and helpers, no assertions — `skill-checks.mjs`
4
- * asserts about one skill by calling these.
2
+ * skill-corpus.mjs — the strict reader of a SKILL.md frontmatter block. It reads nothing on import:
3
+ * the caller passes the text it already has.
5
4
  */
6
- import assert from "node:assert/strict";
7
- import { existsSync, readFileSync } from "node:fs";
8
- import { join, dirname } from "node:path";
9
- import { fileURLToPath } from "node:url";
10
5
  import * as yaml from "js-yaml";
11
- import { consumerRoot } from "../skills/paper-pipeline/scripts/consumer.mjs";
12
- import { requireMarkdown, frontmatterBlock } from "#lib/markdown";
13
-
14
- // Markup is parsed with a real parser. Here we THROW rather than degrade: with no parser every
15
- // frontmatter would read as absent, which is a finding about the corpus, not about the install.
16
- requireMarkdown();
17
-
18
- export const HERE = dirname(fileURLToPath(import.meta.url));
19
- // 🔴 THE CONSUMER'S ROOT, ASKED FOR — NOT WALKED TO. While this module lived in the consumer's
20
- // own `.claude/lib/`, `resolve(HERE, "..", "..")` WAS the repository root. From inside
21
- // `node_modules/<pkg>/lib/` the same walk lands on the consumer's `node_modules/`, and every path
22
- // below it — the skills directory above all — would be a directory that does not exist. That
23
- // failure is silent in the worst way: `readdirSync` throws while this module is still LOADING, and
24
- // a harness whose module fails to load is reported by `vigiles test` as SKIPPED with exit code 0.
25
- // `consumerRoot()` is the carrier the package already uses for the papers root.
26
- export const ROOT = consumerRoot();
27
- export const SKILLS_DIR = join(ROOT, ".claude", "skills");
28
-
29
- // ── parsing ────────────────────────────────────────────────────────────────────────────────────
30
-
31
- /** Raw text between the opening `---` and the next `---`. Null if there is no frontmatter at all. */
32
- export function frontmatter(src) {
33
- return frontmatterBlock(src);
34
- }
35
6
 
36
7
  /**
37
8
  * THE frontmatter reader. One parser, and it is a real one.
@@ -79,85 +50,3 @@ export function parseFm(fmText, where = "frontmatter") {
79
50
  );
80
51
  }
81
52
  }
82
-
83
- /**
84
- * `allowed-tools` as a list, accepting BOTH shapes the corpus now contains.
85
- *
86
- * Hand-written skills carry a comma scalar (`Bash, Read`); a skill compiled from a
87
- * `SKILL.md.spec.ts` carries a real YAML flow sequence (`[Bash, Read]`) — which is the
88
- * MORE correct form, because a scalar parses as one string and loses the contract on a
89
- * round trip (vigiles #107). This split understood only the scalar, so on 2026-08-17
90
- * adopting five pipeline skills turned four harnesses red: the checker read the whole
91
- * bracketed list as a single entry named `[Bash` and reported that the skill's own
92
- * narrowed `Bash(node …:*)` instruction was denied. The skills were fine; the reader
93
- * was not.
94
- *
95
- * Entries themselves carry no commas (`Bash(node …:*)` has none), so a plain split is
96
- * still exact once the flow brackets are off.
97
- */
98
- export const toolList = (v) =>
99
- // 2026-08-19: with a real YAML parser upstream, the flow form `[Bash, Read]` now arrives as an
100
- // ACTUAL array, not the string "[Bash, Read]". It survived the switch only because
101
- // `String(["Bash","Read"])` happens to produce "Bash,Read" and the split put it back — a correct
102
- // answer by coincidence, which stops being correct the day an entry contains a comma. Handle the
103
- // array as an array; the scalar branch stays for hand-written skills.
104
- Array.isArray(v)
105
- ? v.map((x) => String(x).trim()).filter(Boolean)
106
- : String(v ?? "")
107
- .trim()
108
- .replace(/^\[(.*)\]$/s, "$1")
109
- .split(",")
110
- .map((s) => s.trim())
111
- .filter(Boolean);
112
-
113
- /**
114
- * Does `entry` permit `cmd`? Mirrors Claude Code's rule: bare `Bash` permits everything;
115
- * `Bash(prefix:*)` permits any command starting with `prefix`; an inner `*` is a wildcard.
116
- */
117
- export function permits(entry, cmd) {
118
- if (entry === "Bash") return true;
119
- const m = entry.match(/^Bash\((.*)\)$/);
120
- if (!m) return false;
121
- const pat = m[1].replace(/:\*$/, "");
122
- const rx = new RegExp(
123
- "^" +
124
- pat
125
- .split("*")
126
- .map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
127
- .join(".*"),
128
- );
129
- return rx.test(cmd);
130
- }
131
-
132
- /**
133
- * Every `node|bash|python3 <script>` line the SKILL.md instructs, with its full command text. The
134
- * script may start with `${CLAUDE_SKILL_DIR}/`, the skill's own directory wherever it is installed.
135
- */
136
- export function commands(src) {
137
- return [
138
- ...src.matchAll(
139
- /^\s*(node|bash|python3?) +((?:\$\{CLAUDE_SKILL_DIR\}\/)?[A-Za-z0-9_./@-]+\.(?:mjs|js|sh|py))(.*)$/gm,
140
- ),
141
- ].map((m) => ({
142
- runner: m[1],
143
- script: m[2],
144
- cmd: `${m[1]} ${m[2]}${m[3]}`.trim(),
145
- args: m[3].trim().split(/\s+/).filter(Boolean),
146
- }));
147
- }
148
-
149
- export const load = (name) => {
150
- const path = join(SKILLS_DIR, name, "SKILL.md");
151
- assert.ok(
152
- existsSync(path),
153
- `${name}: no SKILL.md at ${path} — it is listed as a pipeline skill and does not exist`,
154
- );
155
- const src = readFileSync(path, "utf8");
156
- const fmText = frontmatter(src);
157
- assert.ok(
158
- fmText !== null,
159
- `${name}: SKILL.md has no --- frontmatter block; the skill cannot be loaded at all`,
160
- );
161
- const fm = parseFm(fmText, name);
162
- return { name, path, src, fmText, fm, tools: toolList(fm["allowed-tools"]) };
163
- };
@@ -1,10 +1,10 @@
1
1
  /**
2
- * skill-corpus.mjs's pure readers on the inputs the shipped corpus never contains: frontmatter
3
- * that is not a mapping or not YAML, and an `allowed-tools` that is absent.
2
+ * parseFm on the inputs the shipped corpus never contains: frontmatter that is not a mapping or
3
+ * not YAML.
4
4
  */
5
5
  import assert from "node:assert/strict";
6
6
  import { test } from "vitest";
7
- import { parseFm, toolList } from "./skill-corpus.mjs";
7
+ import { parseFm } from "./skill-corpus.mjs";
8
8
 
9
9
  const refusal = (fn) => {
10
10
  try {
@@ -30,14 +30,13 @@ test("parseFm refuses a list, a bare string and broken YAML, naming where", () =
30
30
  );
31
31
  });
32
32
 
33
- test("toolList of nothing is an empty contract, and a flow list or a comma scalar is split", () => {
33
+ test("parseFm returns the mapping of a valid frontmatter", () => {
34
34
  assert.deepEqual(
35
- [
36
- toolList(undefined),
37
- toolList("[Bash, Read]"),
38
- toolList(" Read , Write "),
39
- toolList(["Read ", ""]),
40
- ],
41
- [[], ["Bash", "Read"], ["Read", "Write"], ["Read"]],
35
+ parseFm('name: x\ndescription: "a: b"\nallowed-tools: [Read]'),
36
+ {
37
+ name: "x",
38
+ description: "a: b",
39
+ "allowed-tools": ["Read"],
40
+ },
42
41
  );
43
42
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "18.9.1",
3
+ "version": "19.0.0",
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",
@@ -102,7 +102,6 @@
102
102
  "types": "./dist/eslint-rules/*.d.ts",
103
103
  "default": "./dist/eslint-rules/*.js"
104
104
  },
105
- "./lib/skill-checks.mjs": "./lib/skill-checks.mjs",
106
105
  "./lib/skill-corpus.mjs": "./lib/skill-corpus.mjs",
107
106
  "./lib/skill-eval-kit.mjs": "./lib/skill-eval-kit.mjs",
108
107
  "./lib/skill-trigger-cases.mjs": "./lib/skill-trigger-cases.mjs",
@@ -15,30 +15,12 @@
15
15
  "lib/skill-trigger-cases.harness.mjs",
16
16
  "scripts/check.harness.ts",
17
17
  "scripts/rules-see-files.harness.mjs",
18
- "skills/analyze-sibling-paper/analyze-sibling-paper.harness.mjs",
19
- "skills/argument-arc/argument-arc.harness.mjs",
20
- "skills/build-benchmark/build-benchmark.harness.mjs",
21
- "skills/camera-ready/camera-ready.harness.mjs",
22
- "skills/cold-read-diff/cold-read-diff.harness.mjs",
23
- "skills/draft-paper/draft-paper.harness.mjs",
24
- "skills/extend-paper/extend-paper.harness.mjs",
25
- "skills/find-venue/find-venue.harness.mjs",
26
- "skills/harden-paper/harden-paper.harness.mjs",
27
- "skills/map-prior-work/map-prior-work.harness.mjs",
28
18
  "skills/paper-pipeline/paper-pipeline.harness.mjs",
29
19
  "skills/paper-pipeline/scripts/consumer.harness.mjs",
30
20
  "skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs",
31
21
  "skills/paper-pipeline/scripts/generated-code.harness.mjs",
32
- "skills/paper-status/paper-status.harness.mjs",
33
- "skills/pc-panel-review/pc-panel-review.harness.mjs",
34
- "skills/plan-paper-timeline/plan-paper-timeline.harness.mjs",
35
22
  "skills/render-paper/extract-pdf-facts.harness.ts",
36
23
  "skills/render-paper/render-paper.harness.mjs",
37
- "skills/research-ideate/research-ideate.harness.mjs",
38
- "skills/study-accepted-papers/study-accepted-papers.harness.mjs",
39
- "skills/submit-paper/submit-paper.harness.mjs",
40
- "skills/tighten-paper/tighten-paper.harness.mjs",
41
- "skills/verify-citations/verify-citations.harness.mjs",
42
24
  "src/build-engine.harness.mjs",
43
25
  "src/build.harness.mjs",
44
26
  "src/cli.harness.mjs",
@@ -1,20 +1,15 @@
1
1
  /**
2
- * build-label-page — the free tier of the SKILL itself: it passes the shared per-skill checks, and its
3
- * checklist has the eight rules the skill names. The generator is tested beside it, in scripts/.
2
+ * build-label-page — the free tier of the SKILL itself: its checklist has the eight rules the skill
3
+ * names. The generator is tested beside it, in scripts/.
4
4
  * No model, no network, no browser.
5
5
  */
6
6
  import assert from "node:assert/strict";
7
7
  import { readFileSync } from "node:fs";
8
8
  import { join } from "node:path";
9
9
  import { test } from "vitest";
10
- import { checkSkill } from "../../lib/skill-checks.mjs";
11
10
 
12
11
  const HERE = import.meta.dirname;
13
12
 
14
- test("the shared per-skill checks pass", async () => {
15
- await checkSkill("build-label-page");
16
- });
17
-
18
13
  test("the checklist has the eight rules, numbered, and the skill names eight", () => {
19
14
  const checklist = readFileSync(
20
15
  join(HERE, "references", "checklist.md"),
@@ -0,0 +1,104 @@
1
+ /**
2
+ * `check-numbers.sh`, the number enumerator: it lists every quantitative token in a paper's body
3
+ * so each can be traced to an artifact output or a citation. The gate is advisory (a real run
4
+ * always exits 0), so the verdict lives entirely in its output, and an empty list is its whole
5
+ * failure mode. Exit 2 on a bad path is the only signal that tells "nothing to trace" from "no
6
+ * file was read".
7
+ */
8
+ import { spawnSync } from "node:child_process";
9
+ import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
10
+ import { tmpdir } from "node:os";
11
+ import { dirname, join } from "node:path";
12
+ import { fileURLToPath } from "node:url";
13
+ import { afterEach, describe, expect, it } from "vitest";
14
+
15
+ const SCRIPT = join(
16
+ dirname(fileURLToPath(import.meta.url)),
17
+ "check-numbers.sh",
18
+ );
19
+ const made: string[] = [];
20
+ afterEach(() => {
21
+ made.splice(0).forEach((d) => {
22
+ rmSync(d, { recursive: true, force: true });
23
+ });
24
+ });
25
+
26
+ /** A paper directory holding `paper.tex` with the given lines. */
27
+ const paperDir = (lines: readonly string[]): string => {
28
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "numbers-")));
29
+ made.push(dir);
30
+ writeFileSync(join(dir, "paper.tex"), `${lines.join("\n")}\n`);
31
+ return dir;
32
+ };
33
+
34
+ const run = (args: readonly string[]) => {
35
+ const r = spawnSync("bash", [SCRIPT, ...args], {
36
+ encoding: "utf8",
37
+ cwd: tmpdir(),
38
+ });
39
+ return { status: r.status, stdout: r.stdout };
40
+ };
41
+
42
+ const header = (dir: string): string[] => [
43
+ `== number enumeration (body only): ${dir}/paper.tex ==`,
44
+ " Trace each to an artifact output or a \\cite. An untraceable number = treat as fabricated (source it or cut it).",
45
+ ];
46
+
47
+ const footer =
48
+ "-- review the list: every number above must appear in the artifact output or carry a citation --";
49
+
50
+ describe("check-numbers.sh", () => {
51
+ it("lists the body line whose numbers carry no citation, and nothing else", () => {
52
+ const dir = paperDir([
53
+ "\\documentclass{article}",
54
+ "\\begin{document}",
55
+ "% a stray 99\\% inside a comment, which is not body prose",
56
+ "The mean output change ranged from a 37\\% growth to an 18\\% cut across independent runs.",
57
+ "Prior work reports a 2.4x speedup \\cite{smith2020}.",
58
+ "\\begin{filecontents}{refs.bib}",
59
+ "@article{smith2020, year={2020}, pages={100--200}}",
60
+ "\\end{filecontents}",
61
+ "\\end{document}",
62
+ ]);
63
+ // Excluded: the comment (line 3), the cited line (5) and the embedded bibliography (6-8).
64
+ expect(run([dir])).toEqual({
65
+ status: 0,
66
+ stdout: [
67
+ ...header(dir),
68
+ " 4: The mean output change ranged from a 37\\% growth to an 18\\% cut across independent runs.",
69
+ footer,
70
+ "",
71
+ ].join("\n"),
72
+ });
73
+ });
74
+
75
+ it("lists nothing for prose with no quantitative token", () => {
76
+ const dir = paperDir([
77
+ "\\documentclass{article}",
78
+ "\\begin{document}",
79
+ "The gate reads the configuration and fails the build when they disagree.",
80
+ "\\end{document}",
81
+ ]);
82
+ expect(run([dir])).toEqual({
83
+ status: 0,
84
+ stdout: [...header(dir), footer, ""].join("\n"),
85
+ });
86
+ });
87
+
88
+ it("exits 2, naming the file, when the named tex basename does not exist", () => {
89
+ const dir = paperDir(["\\documentclass{article}"]);
90
+ expect(run([dir, "nosuchbase"])).toEqual({
91
+ status: 2,
92
+ stdout: "FAIL: no nosuchbase.tex\n",
93
+ });
94
+ });
95
+
96
+ it("exits 2 when the paper directory does not exist", () => {
97
+ const dir = paperDir([]);
98
+ const gone = join(dir, "missing");
99
+ expect(run([gone])).toEqual({
100
+ status: 2,
101
+ stdout: `FAIL: cannot cd ${gone}\n`,
102
+ });
103
+ });
104
+ });
@@ -0,0 +1,126 @@
1
+ /**
2
+ * `check-release-claims.sh`, the release-claim reconciler: it prints the paper's "we release X"
3
+ * sentences next to what the artifact directory actually holds, so an over-promise is visible.
4
+ * The gate is advisory (a real run always exits 0), so the verdict lives in its output; exit 2 on
5
+ * a bad path is the only way a wrong path differs from a paper that promises nothing.
6
+ */
7
+ import { spawnSync } from "node:child_process";
8
+ import {
9
+ mkdirSync,
10
+ mkdtempSync,
11
+ realpathSync,
12
+ rmSync,
13
+ writeFileSync,
14
+ } from "node:fs";
15
+ import { tmpdir } from "node:os";
16
+ import { dirname, join } from "node:path";
17
+ import { fileURLToPath } from "node:url";
18
+ import { afterEach, describe, expect, it } from "vitest";
19
+
20
+ const SCRIPT = join(
21
+ dirname(fileURLToPath(import.meta.url)),
22
+ "check-release-claims.sh",
23
+ );
24
+ const made: string[] = [];
25
+ afterEach(() => {
26
+ made.splice(0).forEach((d) => {
27
+ rmSync(d, { recursive: true, force: true });
28
+ });
29
+ });
30
+
31
+ /** A paper directory holding `paper.tex` with the given lines and the given artifact files. */
32
+ const paperDir = (
33
+ lines: readonly string[],
34
+ artifact: Readonly<Record<string, string>> = {},
35
+ ): string => {
36
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "release-")));
37
+ made.push(dir);
38
+ writeFileSync(join(dir, "paper.tex"), `${lines.join("\n")}\n`);
39
+ Object.entries(artifact).forEach(([name, body]) => {
40
+ mkdirSync(join(dir, "artifact"), { recursive: true });
41
+ writeFileSync(join(dir, "artifact", name), body);
42
+ });
43
+ return dir;
44
+ };
45
+
46
+ const run = (args: readonly string[]) => {
47
+ const r = spawnSync("bash", [SCRIPT, ...args], {
48
+ encoding: "utf8",
49
+ cwd: tmpdir(),
50
+ });
51
+ return { status: r.status, stdout: r.stdout };
52
+ };
53
+
54
+ const claimsHeader = (dir: string): string[] => [
55
+ `== release-claim reconciliation: ${dir} ==`,
56
+ "-- (1) PROSE claims (release verbs) — reconcile each against the artifact listing below --",
57
+ ];
58
+
59
+ const footer = [
60
+ "-- CHECK: every 'we release X' in (1) must be satisfied by a file in (2).",
61
+ " Promised-but-absent (e.g. 'raw runs' but only aggregates shipped) -> soften to '(at camera-ready)' or add the file.",
62
+ " Mirror the accurate Availability paragraph; do not let the abstract/conclusion over-promise the artifact.",
63
+ "",
64
+ ];
65
+
66
+ describe("check-release-claims.sh", () => {
67
+ it("prints the release sentence beside what the artifact holds, skipping a commented-out claim", () => {
68
+ const dir = paperDir(
69
+ [
70
+ "\\documentclass{article}",
71
+ "\\begin{document}",
72
+ "We release the harness and raw runs with the submission.",
73
+ "% we release nothing, and this line is a comment",
74
+ "The gate reads the configuration.",
75
+ "\\end{document}",
76
+ ],
77
+ { "aggregates.csv": "arm,mean\na,1\n" },
78
+ );
79
+ expect(run([dir])).toEqual({
80
+ status: 0,
81
+ stdout: [
82
+ ...claimsHeader(dir),
83
+ " 3:We release the harness and raw runs with the submission.",
84
+ `-- (2) what the artifact ACTUALLY contains (${dir}/artifact) --`,
85
+ " artifact/aggregates.csv",
86
+ ...footer,
87
+ ].join("\n"),
88
+ });
89
+ });
90
+
91
+ it("says no release-verb line matched, and that no local artifact exists, for a paper that promises nothing", () => {
92
+ const dir = paperDir([
93
+ "\\documentclass{article}",
94
+ "\\begin{document}",
95
+ "The gate reads the configuration.",
96
+ "\\end{document}",
97
+ ]);
98
+ expect(run([dir])).toEqual({
99
+ status: 0,
100
+ stdout: [
101
+ ...claimsHeader(dir),
102
+ " (no release-verb lines matched)",
103
+ `-- (2) what the artifact ACTUALLY contains (${dir}/artifact) --`,
104
+ " (no local artifact/ dir — hosted externally? then reconcile the claim against the HOSTED contents)",
105
+ ...footer,
106
+ ].join("\n"),
107
+ });
108
+ });
109
+
110
+ it("exits 2, naming the file, when the named tex basename does not exist", () => {
111
+ const dir = paperDir(["\\documentclass{article}"]);
112
+ expect(run([dir, "nosuchbase"])).toEqual({
113
+ status: 2,
114
+ stdout: "FAIL: no nosuchbase.tex\n",
115
+ });
116
+ });
117
+
118
+ it("exits 2 when the paper directory does not exist", () => {
119
+ const dir = paperDir([]);
120
+ const gone = join(dir, "missing");
121
+ expect(run([gone])).toEqual({
122
+ status: 2,
123
+ stdout: `FAIL: cannot cd ${gone}\n`,
124
+ });
125
+ });
126
+ });
@@ -8,9 +8,8 @@
8
8
  * pair that labels different runs refused. The commands call the COMPILED `labels.js` under the
9
9
  * skill's link, which is what runs from `node_modules` (`npm run build` makes it).
10
10
  *
11
- * Also, without the CLI: the shared per-skill checks (`checkSkill`). Whether the skill names only
12
- * subcommands the script has is not tested here: the spec interpolates them from
13
- * `scripts/labels-commands.ts`, so a wrong one fails `tsc`.
11
+ * Whether the skill names only subcommands the script has is not tested here: the spec interpolates
12
+ * them from `scripts/labels-commands.ts`, so a wrong one fails `tsc`.
14
13
  *
15
14
  * What it does NOT prove: that a real model reads the uncertain runs in full. That is for
16
15
  * `label-agent-runs.eval.ts` and a real labelling pass.
@@ -19,15 +18,12 @@ import { spawnSync } from "node:child_process";
19
18
  import { join } from "node:path";
20
19
  import { runHarnessTest, skip, type ToolCall } from "vigiles";
21
20
  import { createChecker } from "../../lib/check.ts";
22
- import { checkSkill } from "../../lib/skill-checks.mjs";
23
21
  import { observeAgentCli } from "#lib/agent-cli-version";
24
22
  import { claudeDir } from "#src/package-dirs";
25
23
  import { COMMANDS } from "./scripts/labels-commands.ts";
26
24
 
27
25
  const check = createChecker();
28
26
 
29
- await checkSkill("label-agent-runs");
30
-
31
27
  // ── Through the real CLI: agreement, as the skill tells an agent to compute it ───────────
32
28
  const LINK = join(claudeDir(), "skills", "label-agent-runs");
33
29
  const cli = observeAgentCli({ spawnSync });
@@ -381,3 +381,156 @@ import {
381
381
  withGap.stdout,
382
382
  );
383
383
  }
384
+
385
+ // ── THE LOG VERDICT: check-render.sh FAILS A PAPER WHOSE TEXT BLEEDS PAST THE COLUMN ─────────
386
+ // The script reads the LaTeX log and exits 1 on a visible defect (an overfull box wider than the
387
+ // threshold, an undefined citation or reference), 0 on a clean log, and 2 when there is no log to
388
+ // read. `NO_COMPILE=1` skips pdflatex, so the log parser runs anywhere; the last case compiles
389
+ // for real, and only where a TeX toolchain exists. Both halves, always: a gate that fails a clean
390
+ // log is bypassed on deadline day, and one that passes a defective log is decoration.
391
+ {
392
+ const CHECK = join(
393
+ dirname(fileURLToPath(import.meta.url)),
394
+ "check-render.sh",
395
+ );
396
+ const dirWith = (files) => {
397
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "render-log-")));
398
+ for (const [name, body] of Object.entries(files))
399
+ writeFileSync(join(dir, name), body);
400
+ return dir;
401
+ };
402
+ const verdict = (dir, { threshold = "5", compile = false } = {}) => {
403
+ const env = { ...process.env };
404
+ if (compile) delete env.NO_COMPILE;
405
+ else env.NO_COMPILE = "1";
406
+ const r = spawnSync("bash", [CHECK, dir, "paper", threshold], {
407
+ encoding: "utf8",
408
+ env,
409
+ });
410
+ return { status: r.status, stdout: r.stdout };
411
+ };
412
+ const overfull = (pt) =>
413
+ `Overfull \\hbox (${pt}pt too wide) in paragraph at lines 4--5\n`;
414
+
415
+ const wide = verdict(dirWith({ "paper.log": overfull("12.34") }));
416
+ assert.equal(
417
+ wide.status,
418
+ 1,
419
+ `a 12.34pt overfull hbox must fail:\n${wide.stdout}`,
420
+ );
421
+ assert.match(
422
+ wide.stdout,
423
+ /OVERFULL hbox\s+12\.34pt/,
424
+ `the overfull box was counted but not located:\n${wide.stdout}`,
425
+ );
426
+
427
+ const narrow = verdict(dirWith({ "paper.log": overfull("1.2") }));
428
+ assert.equal(
429
+ narrow.status,
430
+ 0,
431
+ `a 1.2pt overfull is invisible in print and must not fail:\n${narrow.stdout}`,
432
+ );
433
+ assert.match(
434
+ narrow.stdout,
435
+ /1 sub-threshold/,
436
+ `the sub-threshold box was not counted:\n${narrow.stdout}`,
437
+ );
438
+
439
+ // The threshold argument has to move the line, or it is decoration.
440
+ const twelve = dirWith({ "paper.log": overfull("12.0") });
441
+ assert.equal(
442
+ verdict(twelve, { threshold: "5" }).status,
443
+ 1,
444
+ "12pt is above a 5pt threshold",
445
+ );
446
+ assert.equal(
447
+ verdict(twelve, { threshold: "20" }).status,
448
+ 0,
449
+ "the same 12pt box must pass at a 20pt threshold",
450
+ );
451
+
452
+ const undefinedCite = verdict(
453
+ dirWith({
454
+ "paper.log":
455
+ "LaTeX Warning: Citation `smith2020' on page 1 undefined on input line 9.\n",
456
+ }),
457
+ );
458
+ assert.equal(
459
+ undefinedCite.status,
460
+ 1,
461
+ `an undefined citation prints a literal ? in the PDF and must fail:\n${undefinedCite.stdout}`,
462
+ );
463
+
464
+ const cleanLog = verdict(
465
+ dirWith({
466
+ "paper.log":
467
+ "This is pdfTeX\nOutput written on paper.pdf (8 pages, 100000 bytes).\n",
468
+ }),
469
+ );
470
+ assert.equal(
471
+ cleanLog.status,
472
+ 0,
473
+ `a clean log must pass:\n${cleanLog.stdout}`,
474
+ );
475
+ assert.match(
476
+ cleanLog.stdout,
477
+ /PASS: no visible layout defects/,
478
+ `a clean log did not print its PASS line:\n${cleanLog.stdout}`,
479
+ );
480
+
481
+ // No .log and no compile: exit 2 naming the log. Exit 0 would declare a render clean without a
482
+ // render having happened, and exit 1 would say "defects found", which is a different story.
483
+ const noLog = verdict(dirWith({}), { compile: true });
484
+ assert.equal(
485
+ noLog.status,
486
+ 2,
487
+ `no log to read must be exit 2:\n${noLog.stdout}`,
488
+ );
489
+ assert.match(
490
+ noLog.stdout,
491
+ /FAIL: no .*paper\.log/,
492
+ `the missing log was not named:\n${noLog.stdout}`,
493
+ );
494
+
495
+ const haveLatex =
496
+ spawnSync("bash", ["-c", "command -v pdflatex"], { encoding: "utf8" })
497
+ .status === 0;
498
+ if (haveLatex) {
499
+ const texPaper = (body, preamble = "") =>
500
+ dirWith({
501
+ "paper.tex": `\\documentclass[10pt]{article}\n${preamble}\\begin{document}\n${body}\n\\end{document}\n`,
502
+ });
503
+ const bad = verdict(
504
+ texPaper(
505
+ `\\noindent ${"A".repeat(72)}`,
506
+ "\\usepackage[paperwidth=6cm,paperheight=12cm,margin=1cm]{geometry}\n",
507
+ ),
508
+ { compile: true },
509
+ );
510
+ assert.equal(
511
+ bad.status,
512
+ 1,
513
+ `a word several times the column width must fail:\n${bad.stdout}`,
514
+ );
515
+ assert.match(
516
+ bad.stdout,
517
+ /OVERFULL hbox/,
518
+ `the real compile reported no overfull box:\n${bad.stdout}`,
519
+ );
520
+ const good = verdict(
521
+ texPaper(
522
+ "\\noindent The gate reads the configuration and fails the build when they disagree.",
523
+ ),
524
+ { compile: true },
525
+ );
526
+ assert.equal(
527
+ good.status,
528
+ 0,
529
+ `an ordinary paragraph must pass a real compile:\n${good.stdout}`,
530
+ );
531
+ } else {
532
+ console.log(
533
+ " real compile (overfull word, clean paragraph): NOT VERIFIED — pdflatex is not installed; only the log parser ran.",
534
+ );
535
+ }
536
+ }