paperlint 20.1.1 → 20.2.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 (126) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/ci.yml +7 -0
  3. package/CLAUDE.md +6 -2
  4. package/CONTRIBUTING.md +2 -2
  5. package/{action.harness.mjs → action.test.mjs} +147 -138
  6. package/dist/adapters/venue-corpus/index.d.ts +345 -0
  7. package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
  8. package/dist/adapters/venue-corpus/index.js +205 -0
  9. package/dist/adapters/venue-corpus/index.js.map +1 -0
  10. package/dist/domain/licence.d.ts +51 -0
  11. package/dist/domain/licence.d.ts.map +1 -0
  12. package/dist/domain/licence.js +61 -0
  13. package/dist/domain/licence.js.map +1 -0
  14. package/dist/domain/venue-corpus.d.ts +120 -0
  15. package/dist/domain/venue-corpus.d.ts.map +1 -0
  16. package/dist/domain/venue-corpus.js +13 -0
  17. package/dist/domain/venue-corpus.js.map +1 -0
  18. package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
  19. package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
  20. package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
  21. package/dist/eslint-rules/papers.js +1 -1
  22. package/dist/latex-log.d.ts +1 -1
  23. package/dist/latex-log.js +1 -1
  24. package/dist/latex-loop.d.ts +1 -1
  25. package/dist/latex-loop.js +1 -1
  26. package/dist/lib/paper-config.d.ts +3 -3
  27. package/dist/lib/paper-config.js +3 -3
  28. package/dist/ports/venue-corpus-codec.d.ts +11 -0
  29. package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
  30. package/dist/ports/venue-corpus-codec.js +2 -0
  31. package/dist/ports/venue-corpus-codec.js.map +1 -0
  32. package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
  33. package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
  34. package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
  35. package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
  36. package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
  37. package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
  38. package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
  39. package/docs/design/venue-corpus.md +250 -0
  40. package/docs/e2e.md +9 -9
  41. package/docs/testing.md +3 -4
  42. package/docs/venues.md +144 -21
  43. package/eslint-rules/CLAUDE.md +5 -1
  44. package/eslint-rules/CLAUDE.md.spec.ts +3 -0
  45. package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
  46. package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
  47. package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
  48. package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
  49. package/eslint-rules/papers.ts +1 -1
  50. package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
  51. package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
  52. package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
  53. package/eslint.config.mjs +15 -2
  54. package/fixtures/pdf-facts/README.md +1 -1
  55. package/fixtures/render-paper/build-clean.sh +1 -1
  56. package/fixtures/toolchain-mirror/install-tl +1 -1
  57. package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
  58. package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
  59. package/lib/paper-config.ts +3 -3
  60. package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
  61. package/package.json +4 -3
  62. package/presets/acm-acmsmall.jsonc +1 -1
  63. package/scripts/bundle-skills.ts +1 -0
  64. package/scripts/check-workflow.test.ts +368 -0
  65. package/scripts/check.ts +2 -2
  66. package/scripts/eslint-file-length.mjs +9 -9
  67. package/scripts/eslint-report-guard.mjs +1 -1
  68. package/scripts/eslint-report-guard.test.mjs +1 -1
  69. package/scripts/harness-api.test.ts +7 -46
  70. package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
  71. package/scripts/rules-see-files.mjs +1 -1
  72. package/scripts/venue-corpus-schema.test.ts +39 -0
  73. package/scripts/venue-corpus-schema.ts +17 -0
  74. package/skills/argument-arc/scripts/headings.js +6 -4
  75. package/skills/cold-read-diff/scripts/cold-read.js +6 -4
  76. package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
  77. package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
  78. package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
  79. package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
  80. package/skills/paper-pipeline/scripts/extract-ref-facts.js +6 -5
  81. package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
  82. package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
  83. package/skills/pc-panel-review/scripts/prior-reviews.js +7 -5
  84. package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
  85. package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
  86. package/skills/study-accepted-papers/SKILL.md +28 -2
  87. package/skills/study-accepted-papers/SKILL.md.spec.ts +27 -1
  88. package/skills/study-accepted-papers/papers.schema.json +427 -0
  89. package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
  90. package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +302 -0
  91. package/skills/study-accepted-papers/scripts/corpus-licences.js +383 -0
  92. package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +485 -0
  93. package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
  94. package/skills/verify-citations/scripts/bib-authors.js +6 -5
  95. package/skills/verify-citations/scripts/verify-cites.js +6 -5
  96. package/src/adapters/pdfjs/fill.test.ts +1 -1
  97. package/src/adapters/venue-corpus/index.test.ts +279 -0
  98. package/src/adapters/venue-corpus/index.ts +286 -0
  99. package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
  100. package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
  101. package/src/{cli.harness.mjs → cli-e2e.test.mjs} +108 -102
  102. package/src/cli.test.ts +1 -1
  103. package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
  104. package/src/domain/licence.test.ts +122 -0
  105. package/src/domain/licence.ts +95 -0
  106. package/src/domain/venue-corpus.ts +130 -0
  107. package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
  108. package/src/facts-file.test.ts +1 -1
  109. package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
  110. package/src/latex-log.test.ts +395 -0
  111. package/src/latex-log.ts +1 -1
  112. package/src/latex-loop.test.ts +553 -0
  113. package/src/latex-loop.ts +1 -1
  114. package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
  115. package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
  116. package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
  117. package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
  118. package/src/ports/venue-corpus-codec.ts +11 -0
  119. package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
  120. package/src/{structure.harness.ts → structure.test.ts} +12 -10
  121. package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
  122. package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
  123. package/scripts/check.harness.ts +0 -343
  124. package/scripts/harness-api.frozen.json +0 -41
  125. package/src/latex-log.harness.ts +0 -382
  126. package/src/latex-loop.harness.ts +0 -515
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Regenerates the JSON Schema of a venue corpus's papers.json from the record's parser
4
+ * (`src/adapters/venue-corpus`) into the file it is given. `npm run schema:venue-corpus` writes the
5
+ * shipped one (`SCHEMA_FILE`); a test fails until the committed file is the one this writes.
6
+ *
7
+ * Usage: node venue-corpus-schema.ts <output-file>
8
+ */
9
+ import { writeFileSync } from "node:fs";
10
+ import { resolve } from "node:path";
11
+ import { venueCorpusSchemaText } from "#src/adapters/venue-corpus/index";
12
+
13
+ const [out, ...rest] = process.argv.slice(2);
14
+ if (out === undefined || rest.length > 0) {
15
+ process.stderr.write("usage: node venue-corpus-schema.ts <output-file>\n");
16
+ process.exitCode = 2;
17
+ } else writeFileSync(resolve(out), venueCorpusSchemaText());
@@ -8,15 +8,17 @@ const __dirname = __plDirname(__filename);
8
8
  import {
9
9
  latexReader,
10
10
  sourcesCodec
11
- } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
11
+ } from "../../../dist/skill-chunks/chunk-CXAGKT44.js";
12
12
  import {
13
- callerPath,
14
13
  decoded,
15
- nodeFiles,
16
14
  readPaper,
17
15
  runText
18
- } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
16
+ } from "../../../dist/skill-chunks/chunk-J5XYPERO.js";
19
17
  import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
18
+ import {
19
+ callerPath,
20
+ nodeFiles
21
+ } from "../../../dist/skill-chunks/chunk-5KCU4WTN.js";
20
22
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
21
23
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
22
24
 
@@ -10,17 +10,19 @@ import {
10
10
  parseLatex,
11
11
  sourcesCodec,
12
12
  visit
13
- } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
13
+ } from "../../../dist/skill-chunks/chunk-CXAGKT44.js";
14
14
  import {
15
- messageOf,
16
- nodeFiles,
17
15
  paperRecord,
18
16
  readPaper
19
- } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
17
+ } from "../../../dist/skill-chunks/chunk-J5XYPERO.js";
20
18
  import {
21
19
  chunk,
22
20
  last
23
21
  } from "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
22
+ import {
23
+ messageOf,
24
+ nodeFiles
25
+ } from "../../../dist/skill-chunks/chunk-5KCU4WTN.js";
24
26
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
25
27
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
26
28
 
@@ -28,7 +28,7 @@ import assert from "node:assert/strict";
28
28
  import { readFileSync } from "node:fs";
29
29
  import { join, dirname } from "node:path";
30
30
  import { fileURLToPath } from "node:url";
31
- import { recordCheck } from "vigiles";
31
+ import { it } from "vitest";
32
32
  import { installedSkills } from "./scripts/consumer.mjs";
33
33
 
34
34
  const HERE = dirname(fileURLToPath(import.meta.url));
@@ -57,25 +57,6 @@ const routed = new Set(
57
57
  .filter((n) => dirs.includes(n)),
58
58
  );
59
59
 
60
- // ── forward: a bolded backticked token in a routing table must be a real skill ──
61
- // `**`name`**` is the map's own emphasis for "go run this one", so it is a claim
62
- // about a skill and not about `pdflatex` or `jinja2` (plain backticks, correctly
63
- // out of scope).
64
- const asserted = [...src.matchAll(/\*\*`([a-z0-9-]+)`\*\*/g)].map((m) => m[1]);
65
- assert.ok(
66
- asserted.length > 0,
67
- "found no routed skills at all — the extraction broke, not the map",
68
- );
69
- for (const name of new Set(asserted)) {
70
- assert.ok(
71
- dirs.includes(name),
72
- `paper-pipeline routes to \`${name}\`, and no .claude/skills/${name}/SKILL.md exists. ` +
73
- `The conductor points at nothing; a run following the map stalls there.`,
74
- );
75
- recordCheck();
76
- }
77
-
78
- // ── backward: every shipped skill is named somewhere in the map ──
79
60
  /** Shipped skills the conductor does NOT name, each with why. */
80
61
  const NOT_IN_MAP = new Map([
81
62
  [
@@ -84,33 +65,51 @@ const NOT_IN_MAP = new Map([
84
65
  ],
85
66
  ]);
86
67
 
87
- for (const name of dirs) {
88
- if (name === SELF) continue;
89
- if (NOT_IN_MAP.has(name)) continue;
90
- assert.ok(
91
- routed.has(name),
92
- `${name} ships with this package and paper-pipeline never names it. A reader of the map ` +
93
- `does not learn the stage exists; name it in the map, or add it to NOT_IN_MAP with a reason.`,
94
- );
95
- recordCheck();
96
- }
97
-
98
- // ── the exception list must not rot, in BOTH directions ──
99
- for (const [name, reason] of NOT_IN_MAP) {
100
- assert.ok(
101
- dirs.includes(name),
102
- `NOT_IN_MAP names "${name}" and no such skill ships — delete the entry. Recorded reason: "${reason}"`,
68
+ // ── forward: a bolded backticked token in a routing table must be a real skill ──
69
+ it("forward: a bolded backticked token in a routing table must be a real skill", () => {
70
+ // `**`name`**` is the map's own emphasis for "go run this one", so it is a claim
71
+ // about a skill and not about `pdflatex` or `jinja2` (plain backticks, correctly
72
+ // out of scope).
73
+ const asserted = [...src.matchAll(/\*\*`([a-z0-9-]+)`\*\*/g)].map(
74
+ (m) => m[1],
103
75
  );
104
76
  assert.ok(
105
- !routed.has(name),
106
- `NOT_IN_MAP still names "${name}", but paper-pipeline DOES name it now — delete the entry, ` +
107
- `so the assertion above starts protecting this skill.`,
77
+ asserted.length > 0,
78
+ "found no routed skills at all — the extraction broke, not the map",
108
79
  );
109
- recordCheck();
110
- }
80
+ for (const name of new Set(asserted)) {
81
+ assert.ok(
82
+ dirs.includes(name),
83
+ `paper-pipeline routes to \`${name}\`, and no .claude/skills/${name}/SKILL.md exists. ` +
84
+ `The conductor points at nothing; a run following the map stalls there.`,
85
+ );
86
+ }
87
+ });
111
88
 
112
- console.log(
113
- `✓ paper-pipeline routing: ${String(new Set(asserted).size)} routes resolve · ` +
114
- `${String(dirs.length - NOT_IN_MAP.size - 1)} skills named · ` +
115
- `${String(NOT_IN_MAP.size)} not in the map (${[...NOT_IN_MAP.keys()].join(", ")})`,
116
- );
89
+ // ── backward: every shipped skill is named somewhere in the map ──
90
+ it("backward: every shipped skill is named somewhere in the map", () => {
91
+ for (const name of dirs) {
92
+ if (name === SELF) continue;
93
+ if (NOT_IN_MAP.has(name)) continue;
94
+ assert.ok(
95
+ routed.has(name),
96
+ `${name} ships with this package and paper-pipeline never names it. A reader of the map ` +
97
+ `does not learn the stage exists; name it in the map, or add it to NOT_IN_MAP with a reason.`,
98
+ );
99
+ }
100
+ });
101
+
102
+ // ── the exception list must not rot, in BOTH directions ──
103
+ it("the exception list must not rot, in BOTH directions", () => {
104
+ for (const [name, reason] of NOT_IN_MAP) {
105
+ assert.ok(
106
+ dirs.includes(name),
107
+ `NOT_IN_MAP names "${name}" and no such skill ships — delete the entry. Recorded reason: "${reason}"`,
108
+ );
109
+ assert.ok(
110
+ !routed.has(name),
111
+ `NOT_IN_MAP still names "${name}", but paper-pipeline DOES name it now — delete the entry, ` +
112
+ `so the assertion above starts protecting this skill.`,
113
+ );
114
+ }
115
+ });
@@ -1,7 +1,5 @@
1
1
  /**
2
- * consumer.harness.mjs — the path facts the move into a package depends on, both directions.
3
- *
4
- * `npx vigiles test skills/paper-pipeline/scripts/consumer.harness.mjs`
2
+ * consumer-paths.test.mjs — the path facts the move into a package depends on, both directions.
5
3
  *
6
4
  * 🔴 WHY THIS FILE IS NOT OPTIONAL. The resolutions in `consumer.mjs` all fail in the SILENT
7
5
  * direction when they are wrong: a bad main guard still exits 0, a bad root still hashes a missing directory to a stable value. None of them produce an
@@ -9,13 +7,14 @@
9
7
  * BOTH directions — fires when it should, silent when it should — because an assertion that only
10
8
  * ever sees the good case cannot tell a working resolver from a constant.
11
9
  *
12
- * Assertions run at module top level: `vigiles test` treats "did not throw" as a pass.
10
+ * Each part is one vitest `it`; an assertion that throws fails it.
13
11
  *
14
12
  * Parts VIII-X cover the fourth carrier, `scriptsRoot()`. It fails in the same silent direction
15
13
  * as the rest and worse: its value is a PREFIX a caller filters prose with, so a wrong one
16
14
  * matches nothing and every check built on it reports zero findings.
17
15
  */
18
16
  import assert from "node:assert/strict";
17
+ import { afterAll, it, vi } from "vitest";
19
18
  import {
20
19
  mkdirSync,
21
20
  mkdtempSync,
@@ -42,12 +41,15 @@ import {
42
41
  BIN_FILE,
43
42
  } from "./consumer.mjs";
44
43
 
44
+ // Several tests here run real ESLint, spawn processes or walk the repository.
45
+ vi.setConfig({ testTimeout: 120_000 });
46
+
45
47
  const HERE = dirname(fileURLToPath(import.meta.url));
46
48
 
47
49
  // ── THE PACKAGE NAME HAS ONE SOURCE, AND IT MATCHES THE MANIFEST ─────────────────────────────
48
50
  // Every path into the installed package is built from PACKAGE_NAME. Two files cannot import it
49
51
  // and spell it themselves: the manifest, and the hook wiring (JSON). Both are checked here.
50
- {
52
+ it("THE PACKAGE NAME HAS ONE SOURCE, AND IT MATCHES THE MANIFEST", () => {
51
53
  const root = resolve(HERE, "..", "..", "..");
52
54
  const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
53
55
  assert.equal(
@@ -79,9 +81,9 @@ const HERE = dirname(fileURLToPath(import.meta.url));
79
81
  ),
80
82
  `every command in plugin/hooks/hooks.json runs node_modules/${PACKAGE_NAME}/${BIN_FILE}`,
81
83
  );
82
- }
84
+ });
83
85
  const TMP = realpathSync(mkdtempSync(join(tmpdir(), "consumer-harness-")));
84
- process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
86
+ afterAll(() => rmSync(TMP, { recursive: true, force: true }));
85
87
 
86
88
  /** A throwaway consumer repository with the given root `paperlint.json` settings (or none). */
87
89
  function fakeConsumer(block) {
@@ -99,47 +101,54 @@ function installedDir(root) {
99
101
  }
100
102
 
101
103
  // ── IV. `insideNodeModules` is SEGMENT-WISE, not a substring ──────────────────────────────────
102
- assert.equal(
103
- insideNodeModules(join("a", "node_modules", "b")),
104
- true,
105
- "a real install went undetected",
106
- );
107
- assert.equal(
108
- insideNodeModules(join("a", "my-node_modules-inspector", "b")),
109
- false,
110
- "a directory whose NAME merely contains `node_modules` was treated as an install — that " +
111
- "consumer would be refused for a naming coincidence",
112
- );
113
- assert.equal(
114
- insideNodeModules(join("a", "b")),
115
- false,
116
- "a plain path was reported as installed",
117
- );
104
+ it("IV. `insideNodeModules` is SEGMENT-WISE, not a substring", () => {
105
+ assert.equal(
106
+ insideNodeModules(join("a", "node_modules", "b")),
107
+ true,
108
+ "a real install went undetected",
109
+ );
110
+ assert.equal(
111
+ insideNodeModules(join("a", "my-node_modules-inspector", "b")),
112
+ false,
113
+ "a directory whose NAME merely contains `node_modules` was treated as an install — that " +
114
+ "consumer would be refused for a naming coincidence",
115
+ );
116
+ assert.equal(
117
+ insideNodeModules(join("a", "b")),
118
+ false,
119
+ "a plain path was reported as installed",
120
+ );
121
+ });
118
122
 
119
123
  // ── V. `consumerRoot` prefers the harness-provided root over the cwd ──────────────────────────
120
- assert.equal(
121
- consumerRoot({ env: { CLAUDE_PROJECT_DIR: "/x/y" }, cwd: "/somewhere/else" }),
122
- "/x/y",
123
- "CLAUDE_PROJECT_DIR must win: a hook or an editor can start the process anywhere, and the cwd " +
124
- "then names the wrong repository",
125
- );
126
- assert.equal(
127
- consumerRoot({ env: {}, cwd: "/somewhere/else" }),
128
- "/somewhere/else",
129
- "without the variable the cwd is the answer — every documented invocation is typed from the root",
130
- );
131
- assert.equal(
132
- consumerSkillsDir({ env: {}, cwd: "/r" }),
133
- join("/r", ".claude", "skills"),
134
- "the skills directory must hang off the consumer root",
135
- );
124
+ it("V. `consumerRoot` prefers the harness-provided root over the cwd", () => {
125
+ assert.equal(
126
+ consumerRoot({
127
+ env: { CLAUDE_PROJECT_DIR: "/x/y" },
128
+ cwd: "/somewhere/else",
129
+ }),
130
+ "/x/y",
131
+ "CLAUDE_PROJECT_DIR must win: a hook or an editor can start the process anywhere, and the cwd " +
132
+ "then names the wrong repository",
133
+ );
134
+ assert.equal(
135
+ consumerRoot({ env: {}, cwd: "/somewhere/else" }),
136
+ "/somewhere/else",
137
+ "without the variable the cwd is the answer — every documented invocation is typed from the root",
138
+ );
139
+ assert.equal(
140
+ consumerSkillsDir({ env: {}, cwd: "/r" }),
141
+ join("/r", ".claude", "skills"),
142
+ "the skills directory must hang off the consumer root",
143
+ );
144
+ });
136
145
 
137
146
  // ── VI. 🔴 `isMain` THROUGH A SYMLINK — the measurement the whole move rests on ────────────────
138
147
  // Node resolves the entry point to its REALPATH but leaves `process.argv[1]` as typed. The idiom
139
148
  // `import.meta.url === `file://${process.argv[1]}`` is therefore FALSE when a script is reached
140
149
  // through a symlink — and false silently: the process exits 0 having run no CLI at all. Nine
141
150
  // scripts in this directory are reached exactly that way by a consumer.
142
- {
151
+ it("VI. `isMain` THROUGH A SYMLINK — the measurement the whole move rests on", () => {
143
152
  const root = mkdtempSync(join(TMP, "symlink-"));
144
153
  const real = join(root, "node_modules", "pkg", "scripts");
145
154
  mkdirSync(real, { recursive: true });
@@ -188,20 +197,23 @@ assert.equal(
188
197
  true,
189
198
  "the legacy guard failed even directly — the probe is wrong",
190
199
  );
191
- }
200
+ });
192
201
 
193
202
  // ── VII. imported, not executed ───────────────────────────────────────────────────────────────
194
- assert.equal(
195
- isMain(import.meta.url) && !process.argv[1].endsWith("consumer.harness.mjs"),
196
- false,
197
- "isMain claimed a module was the entry point while something else was",
198
- );
203
+ it("VII. imported, not executed", () => {
204
+ assert.equal(
205
+ isMain(import.meta.url) &&
206
+ !process.argv[1].endsWith("consumer-paths.test.mjs"),
207
+ false,
208
+ "isMain claimed a module was the entry point while something else was",
209
+ );
210
+ });
199
211
 
200
212
  // ── VIII. THE FOURTH CARRIER — declared wins, absent falls back to the default ────────────────
201
213
  // Both directions in one block on purpose: a resolver that returned the declaration for every
202
214
  // input and a resolver that returned the default for every input each pass HALF of this pair,
203
215
  // and half of a pair is a constant wearing a function's name.
204
- {
216
+ it("VIII. THE FOURTH CARRIER — declared wins, absent falls back to the default", () => {
205
217
  const declaredRoot = fakeConsumer({ scripts: "tools/pipeline" });
206
218
  mkdirSync(join(declaredRoot, "tools", "pipeline"), { recursive: true });
207
219
 
@@ -244,10 +256,10 @@ assert.equal(
244
256
  "tools/pipeline",
245
257
  "the declaration must be read from CLAUDE_PROJECT_DIR when it is set, not from the cwd",
246
258
  );
247
- }
259
+ });
248
260
 
249
261
  // ── IX. THE FOURTH CARRIER — the two refusals, each checked for its CURE ──────────────────────
250
- {
262
+ it("IX. THE FOURTH CARRIER — the two refusals, each checked for its CURE", () => {
251
263
  // 1. A value that resolves inside node_modules. This is the tempting wrong fix after the move,
252
264
  // and it is how the DEFAULT fails as well: with the process started inside the installed
253
265
  // package and CLAUDE_PROJECT_DIR unset, the consumer root is itself under node_modules.
@@ -340,13 +352,13 @@ assert.equal(
340
352
  "an empty scripts path was accepted; it resolves to the consumer root itself, so the prefix " +
341
353
  "would match every command in every skill",
342
354
  );
343
- }
355
+ });
344
356
 
345
357
  // ── X. THE PREFIX IS DERIVED, NOT RESTATED ─────────────────────────────────────────────
346
358
  // The names belong to this package; a consumer that spelled them out would keep its copy in step
347
359
  // by hand. The trailing slash on `prefix` is load-bearing: without it the prefix also matches a
348
360
  // SIBLING directory whose name merely starts with the root's.
349
- {
361
+ it("X. THE PREFIX IS DERIVED, NOT RESTATED", () => {
350
362
  const s = pipelineScripts("a/b");
351
363
  // The boundary is asserted BEFORE the literal equality for the same reason part VIII reorders:
352
364
  // `assert` aborts at the first failure, and a prefix that lost its slash died on "must end in a
@@ -374,7 +386,7 @@ assert.equal(
374
386
  'a declared trailing slash doubled the separator. `"scripts": "tools/pipeline/"` is a normal ' +
375
387
  "thing to write, and the doubled prefix matches no instruction at all.",
376
388
  );
377
- }
389
+ });
378
390
 
379
391
  // ── XI. WHICH SKILLS ARE INSTALLED — a link counts, a dangling link is REFUSED (paperlint#62) ────────
380
392
  // `paperlint init` installs every skill as a SYMLINK `.claude/skills/<name> -> …/skills/<name>`. A
@@ -383,7 +395,7 @@ assert.equal(
383
395
  // asked this question that way saw ZERO installed skills in every consumer and refused to start.
384
396
  // The tree below is built on disk, not faked — the property under test is how the filesystem
385
397
  // answers, and a stub would test the stub.
386
- {
398
+ it("XI. WHICH SKILLS ARE INSTALLED — a link counts, a dangling link is REFUSED (paperlint#62)", () => {
387
399
  const home = join(TMP, "skills-home");
388
400
  const store = join(TMP, "skills-store");
389
401
  const skill = (dir, name) => {
@@ -458,9 +470,4 @@ assert.equal(
458
470
  "a link that cannot be resolved (ELOOP) was not refused",
459
471
  );
460
472
  rmSync(join(home, "loop"));
461
- }
462
-
463
- console.log(
464
- "✓ consumer: three rungs each proved in both directions, node_modules refused, symlinked main guard held, " +
465
- "scripts root declared/default/refused, installed skills follow links and refuse dangling ones",
466
- );
473
+ });
@@ -46,7 +46,7 @@
46
46
  * is `node .claude/skills/…` typed from the repository root. `consumerRoot()`.
47
47
  *
48
48
  * ⚠️ THE EXAMPLES HERE ARE DELIBERATELY GENERIC. The first consumer's own directory names are
49
- * absent by the same rule `papers.harness.mjs` part IV enforces for `papers.mjs`: a package that
49
+ * absent by the same rule `papers.test.mjs` part IV enforces for `papers.mjs`: a package that
50
50
  * spells out one user's private tree has one user.
51
51
  */
52
52
  import {
@@ -101,13 +101,13 @@ export function consumerRoot({ env = process.env, cwd = process.cwd() } = {}) {
101
101
  /**
102
102
  * The package's npm name — the directory it lands in under `node_modules`, and the name Node
103
103
  * resolves it by. Every path into the installed package is built from this, never re-spelled;
104
- * `consumer.harness.mjs` checks it against `package.json`.
104
+ * `consumer-paths.test.mjs` checks it against `package.json`.
105
105
  */
106
106
  export const PACKAGE_NAME = "paperlint";
107
107
 
108
108
  /**
109
109
  * The package's one executable, relative to the package root — what `bin` in package.json names
110
- * and what every hook command runs. Named like the package; `consumer.harness.mjs` checks it
110
+ * and what every hook command runs. Named like the package; `consumer-paths.test.mjs` checks it
111
111
  * against the manifest, so the file and the hook commands cannot drift apart.
112
112
  */
113
113
  export const BIN_FILE = `bin/${PACKAGE_NAME}.mjs`;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Colocated test of the `extract-ref-facts.mjs` extractor.
3
- * Run: `npx vigiles test .claude/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs`
3
+ * Each numbered part is one vitest `it`; an assertion that throws fails it.
4
4
  *
5
5
  * ORDER IS LOAD-BEARING: first we prove that on CORRECT input the extractor returns the facts it
6
6
  * promises, and only then — that on broken input it refuses to write. An extractor that silently
@@ -17,10 +17,10 @@
17
17
  * a real request. A test that needs the internet is skipped in CI, and a skipped check
18
18
  * is indistinguishable from one that passed.
19
19
  *
20
- * 🔴 Assertions — AT MODULE TOP LEVEL: `vigiles test` imports the file and counts "did not throw"
21
- * as success, so an exported test object would report ✓ without running anything.
20
+ * 🔴 Assertions are plain `assert` calls inside each `it`: a throw fails that test.
22
21
  */
23
22
  import assert from "node:assert/strict";
23
+ import { afterAll, it, vi } from "vitest";
24
24
  import {
25
25
  DEFAULT_PAPERS_ROOT,
26
26
  PAPERS_DIR_FIELD,
@@ -45,6 +45,9 @@ import { sha256Hex } from "#src/domain/sha256";
45
45
  import { serializeSourcesRecord } from "#src/domain/sources-record";
46
46
  import { consumerRoot } from "./consumer.mjs";
47
47
 
48
+ // Several tests here run real ESLint, spawn processes or walk the repository.
49
+ vi.setConfig({ testTimeout: 120_000 });
50
+
48
51
  const HERE = dirname(fileURLToPath(import.meta.url));
49
52
  const ROOT = consumerRoot();
50
53
  const X = await import(join(HERE, "extract-ref-facts.mjs"));
@@ -111,13 +114,13 @@ function built(dir) {
111
114
  }
112
115
  // Cleanup is attached IMMEDIATELY: assertions throw, and "rmSync at end of file" does not execute precisely in those
113
116
  // runs that are red.
114
- process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
117
+ afterAll(() => rmSync(TMP, { recursive: true, force: true }));
115
118
 
116
119
  // ── 1. DEFECT #1: the `.bib` a paper declares is opened ──────────────────────
117
120
  //
118
121
  // The build recorded that bibtex opened `refs.bib`, and `bibliographyAt` opens it. A fixture paper
119
122
  // holds the frozen real `.bib`, so the leg is proven on a real file in every checkout.
120
- {
123
+ it("1. DEFECT #1: the `.bib` a paper declares is opened", () => {
121
124
  const dir = join(TMP, "declares-real-bib");
122
125
  mkdirSync(dir, { recursive: true });
123
126
  writeFileSync(
@@ -144,7 +147,7 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
144
147
  `${paper}: neither a bibliography nor a reason`,
145
148
  );
146
149
  }
147
- }
150
+ });
148
151
 
149
152
  // ── 2. DEFECT #2: real .bib parses, and entry count matches ───────
150
153
  //
@@ -152,7 +155,7 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
152
155
  // field, and a hand-written fixture almost certainly would close the entry on its own line — that is,
153
156
  // the test would pass but the corpus would not. The expected count comes from the file itself (`^@`), not
154
157
  // hardcoded: a constant grows stale on the first added entry.
155
- {
158
+ it("2. DEFECT #2: real .bib parses, and entry count matches", () => {
156
159
  // Counter of parsed sources, checked after the loop: a check that prints "passed"
157
160
  // but says nothing about HOW MANY files it opened — this is a counter that counts what it ignores.
158
161
  let parsed = 0;
@@ -194,7 +197,7 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
194
197
  "parsed ZERO .bib files. This is not 'nothing to check', but 'check did not find its subject': " +
195
198
  "the frozen fixture fixtures/real-bib/refs.bib must always lie in the repository.",
196
199
  );
197
- }
200
+ });
198
201
 
199
202
  // ── 3b. INSTITUTION DOES NOT DISAPPEAR ──────────────────────────────────────────────
200
203
  //
@@ -203,7 +206,7 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
203
206
  // Measurement 17.09 on real aisec-2026: eleven entries out of fifty-one came back
204
207
  // with `authors = []`, because joinName didn't know this form. Failure toward SILENCE — checking against
205
208
  // such entries found nothing and looked like passing.
206
- {
209
+ it("3b. INSTITUTION DOES NOT DISAPPEAR", () => {
207
210
  const bib = `@misc{inst,
208
211
  author={{Adversa AI}},
209
212
  title={A Report}, year={2026}}
@@ -217,13 +220,13 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
217
220
  `institution lost or torn apart: ${JSON.stringify(es.map((e) => e.authors))}`,
218
221
  );
219
222
  assert.equal(es[0].truncated, false, "institution is not `and others`");
220
- }
223
+ });
221
224
 
222
225
  // ── 3c. …AND SINGLE BRACE STILL PARSES AS PERSON ─────────────
223
226
  //
224
227
  // Second half. Without it the fix above is indistinguishable from "stopped parsing names at all":
225
228
  // single brace — ordinary author, and order "LastName, FirstName" must be unwound.
226
- {
229
+ it("3c. …AND SINGLE BRACE STILL PARSES AS PERSON", () => {
227
230
  const bib = `@misc{human, author={Adversa, Alice}, title={T}, year={2026}}`;
228
231
  const [e] = factsOf(bib);
229
232
  assert.deepEqual(
@@ -231,13 +234,13 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
231
234
  ["Alice Adversa"],
232
235
  `single brace must parse as person: ${JSON.stringify(e.authors)}`,
233
236
  );
234
- }
237
+ });
235
238
 
236
239
  // ── 3. DEFECT #3: name from .bib is converted to order "FirstName LastName" ─────────────
237
240
  //
238
241
  // In BibTeX they write `Jimenez, Carlos E.`, and the "last alphabetic token" of such a string is `e`.
239
242
  // The rule compares exactly the last token, so order must be unwound HERE.
240
- {
243
+ it('3. DEFECT #3: name from .bib is converted to order "FirstName LastName"', () => {
241
244
  const bib = `@inproceedings{k1,
242
245
  author={Jimenez, Carlos E. and Di Penta, Massimiliano and others},
243
246
  title={A Title}, booktitle={ICLR}, year={2024}, note={arXiv:2310.06770}}`;
@@ -253,28 +256,28 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
253
256
  "`and others` is et al. in BibTeX format, and it must be marked as truncation",
254
257
  );
255
258
  assert.deepEqual(X.extractIds(e), { arxiv: ["2310.06770"], doi: [] });
256
- }
259
+ });
257
260
 
258
261
  // ── 4. arXiv-DOI goes to arXiv, NOT to CrossRef ───────────────────────────────
259
262
  //
260
263
  // Measurement 26.08: `api.crossref.org/works/10.48550%2FarXiv.2107.03374` → HTTP 404 "Resource not
261
264
  // found" on a completely real DOI in <paper-b>/refs.bib. Asking CrossRef,
262
265
  // gate `id-resolves` would declare the correct entry broken.
263
- {
266
+ it("4. arXiv-DOI goes to arXiv, NOT to CrossRef", () => {
264
267
  assert.equal(X.routeOf("doi:10.48550/arXiv.2107.03374").registry, "arxiv");
265
268
  assert.ok(
266
269
  X.routeOf("doi:10.48550/arXiv.2107.03374").url.includes("2107.03374"),
267
270
  );
268
271
  assert.equal(X.routeOf("doi:10.1145/3597503.3623333").registry, "crossref");
269
272
  assert.equal(X.routeOf("arxiv:2310.06770").registry, "arxiv");
270
- }
273
+ });
271
274
 
272
275
  // ── 5. registry readers work on RAW bodies ─────────────────────────────
273
276
  //
274
277
  // Cache stores raw responses precisely for this: every fabricated title this base
275
278
  // shipped was found by reading the registry's response. A cache of parsed entries would leave readers
276
279
  // uncovered, appearing covered.
277
- {
280
+ it("5. registry readers work on RAW bodies", () => {
278
281
  const atom = `<?xml version='1.0' encoding='UTF-8'?>
279
282
  <feed xmlns:arxiv="http://arxiv.org/schemas/atom" xmlns="http://www.w3.org/2005/Atom">
280
283
  <entry>
@@ -316,10 +319,10 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
316
319
  );
317
320
  assert.equal(c.year, "2018");
318
321
  assert.deepEqual(c.authors, ["Liebig", "von Rhein"]);
319
- }
322
+ });
320
323
 
321
324
  // ── 6. recording facts: registry response → record, and UNparsed response is also a fact ─
322
- {
325
+ it("6. recording facts: registry response → record, and UNparsed response is also a fact", () => {
323
326
  const key = "arxiv:2310.06770";
324
327
  const ok = X.recordFrom(key, {
325
328
  httpStatus: 200,
@@ -346,10 +349,10 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
346
349
  broken.parse_error,
347
350
  "unreadable response must leave reason, not silently disappear",
348
351
  );
349
- }
352
+ });
350
353
 
351
354
  // ── 7. CLI: ZERO ENTRIES — REFUSAL, not empty facts ─────────────────────────
352
- {
355
+ it("7. CLI: ZERO ENTRIES — REFUSAL, not empty facts", async () => {
353
356
  const { spawnSync } = await import("node:child_process");
354
357
  const dir = join(TMP, "empty");
355
358
  mkdirSync(dir, { recursive: true });
@@ -377,10 +380,10 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
377
380
  !existsSync(join(dir, "_build", "refs.facts.json")),
378
381
  "facts with empty list written to disk — would be read as clean bibliography",
379
382
  );
380
- }
383
+ });
381
384
 
382
385
  // ── 8. CLI: no source — also refusal, not silence ─────────────────────────
383
- {
386
+ it("8. CLI: no source — also refusal, not silence", async () => {
384
387
  const { spawnSync } = await import("node:child_process");
385
388
  const dir = join(TMP, "nosrc");
386
389
  mkdirSync(dir, { recursive: true });
@@ -394,10 +397,10 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
394
397
  /no paper\.tex/u.test(r.stderr),
395
398
  `message must say what is missing: ${r.stderr}`,
396
399
  );
397
- }
400
+ });
398
401
 
399
402
  // ── 9. end-to-end: real paper → facts, freshness is computed ───────────────
400
- {
403
+ it("9. end-to-end: real paper → facts, freshness is computed", async () => {
401
404
  const { spawnSync } = await import("node:child_process");
402
405
  const dir = join(TMP, "e2e");
403
406
  mkdirSync(join(dir, "repro", "data"), { recursive: true });
@@ -437,9 +440,4 @@ process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
437
440
  createHash("sha256").update(paper).digest("hex"),
438
441
  "source sha256 does not match — rule `fresh` could not catch stale facts",
439
442
  );
440
- }
441
-
442
- console.log(
443
- "✓ extract-ref-facts: the declared refs.bib is opened, both real .bib parse completely, name order unwound, " +
444
- "arXiv-DOI does not go to CrossRef, registry readers run on raw bodies, zero entries = refusal",
445
- );
443
+ });