paperlint 7.2.0 → 9.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 (474) hide show
  1. package/CLAUDE.md +9 -25
  2. package/CONTRIBUTING.md +5 -4
  3. package/README.md +4 -3
  4. package/dist/adapters/bibtex/index.d.ts +3 -0
  5. package/dist/adapters/bibtex/index.d.ts.map +1 -0
  6. package/dist/adapters/bibtex/index.js +103 -0
  7. package/dist/adapters/bibtex/index.js.map +1 -0
  8. package/dist/adapters/latex/filecontents.d.ts +33 -0
  9. package/dist/adapters/latex/filecontents.d.ts.map +1 -0
  10. package/dist/adapters/latex/filecontents.js +65 -0
  11. package/dist/adapters/latex/filecontents.js.map +1 -0
  12. package/dist/adapters/latex/includes.d.ts +3 -3
  13. package/dist/adapters/latex/includes.d.ts.map +1 -1
  14. package/dist/adapters/latex/includes.js +18 -10
  15. package/dist/adapters/latex/includes.js.map +1 -1
  16. package/dist/adapters/latex/index.d.ts.map +1 -1
  17. package/dist/adapters/latex/index.js +2 -0
  18. package/dist/adapters/latex/index.js.map +1 -1
  19. package/dist/adapters/latex/nodes.d.ts +12 -0
  20. package/dist/adapters/latex/nodes.d.ts.map +1 -1
  21. package/dist/adapters/latex/nodes.js +39 -0
  22. package/dist/adapters/latex/nodes.js.map +1 -1
  23. package/dist/adapters/latex/parse.d.ts +7 -1
  24. package/dist/adapters/latex/parse.d.ts.map +1 -1
  25. package/dist/adapters/latex/parse.js +55 -6
  26. package/dist/adapters/latex/parse.js.map +1 -1
  27. package/dist/adapters/memory/index.d.ts +3 -0
  28. package/dist/adapters/memory/index.d.ts.map +1 -1
  29. package/dist/adapters/memory/index.js +9 -0
  30. package/dist/adapters/memory/index.js.map +1 -1
  31. package/dist/adapters/references/index.d.ts.map +1 -1
  32. package/dist/adapters/references/index.js +27 -24
  33. package/dist/adapters/references/index.js.map +1 -1
  34. package/dist/adapters/sources-record/index.d.ts +9 -0
  35. package/dist/adapters/sources-record/index.d.ts.map +1 -0
  36. package/dist/adapters/sources-record/index.js +68 -0
  37. package/dist/adapters/sources-record/index.js.map +1 -0
  38. package/dist/adapters/tex-output/blg.d.ts +9 -0
  39. package/dist/adapters/tex-output/blg.d.ts.map +1 -0
  40. package/dist/adapters/tex-output/blg.js +20 -0
  41. package/dist/adapters/tex-output/blg.js.map +1 -0
  42. package/dist/adapters/tex-output/fls.d.ts +8 -0
  43. package/dist/adapters/tex-output/fls.d.ts.map +1 -0
  44. package/dist/adapters/tex-output/fls.js +16 -0
  45. package/dist/adapters/tex-output/fls.js.map +1 -0
  46. package/dist/adapters/tex-output/index.d.ts +7 -0
  47. package/dist/adapters/tex-output/index.d.ts.map +1 -0
  48. package/dist/adapters/tex-output/index.js +7 -0
  49. package/dist/adapters/tex-output/index.js.map +1 -0
  50. package/dist/bib-rules.d.ts +47 -0
  51. package/dist/bib-rules.d.ts.map +1 -0
  52. package/dist/bib-rules.js +127 -0
  53. package/dist/bib-rules.js.map +1 -0
  54. package/dist/build.d.ts +29 -1
  55. package/dist/build.d.ts.map +1 -1
  56. package/dist/build.js +41 -30
  57. package/dist/build.js.map +1 -1
  58. package/dist/claim-provenance.d.ts +2 -2
  59. package/dist/cli.d.ts +9 -5
  60. package/dist/cli.d.ts.map +1 -1
  61. package/dist/cli.js +43 -68
  62. package/dist/cli.js.map +1 -1
  63. package/dist/domain/paper-source.d.ts +1 -10
  64. package/dist/domain/paper-source.d.ts.map +1 -1
  65. package/dist/domain/paper-source.js +34 -24
  66. package/dist/domain/paper-source.js.map +1 -1
  67. package/dist/domain/paper-sources.d.ts +72 -0
  68. package/dist/domain/paper-sources.d.ts.map +1 -0
  69. package/dist/domain/paper-sources.js +18 -0
  70. package/dist/domain/paper-sources.js.map +1 -0
  71. package/dist/domain/sources-record.d.ts +102 -0
  72. package/dist/domain/sources-record.d.ts.map +1 -0
  73. package/dist/domain/sources-record.js +38 -0
  74. package/dist/domain/sources-record.js.map +1 -0
  75. package/dist/domain/tex-run.d.ts +25 -0
  76. package/dist/domain/tex-run.d.ts.map +1 -0
  77. package/dist/domain/tex-run.js +79 -0
  78. package/dist/domain/tex-run.js.map +1 -0
  79. package/dist/eslint-rules/latex-language.d.ts.map +1 -1
  80. package/dist/eslint-rules/latex-language.js +10 -13
  81. package/dist/eslint-rules/latex-language.js.map +1 -1
  82. package/dist/eslint-rules/paper-context.d.ts.map +1 -1
  83. package/dist/eslint-rules/paper-context.js +6 -5
  84. package/dist/eslint-rules/paper-context.js.map +1 -1
  85. package/dist/eslint-rules/paper-typography.d.ts +0 -9
  86. package/dist/eslint-rules/paper-typography.d.ts.map +1 -1
  87. package/dist/eslint-rules/paper-typography.js +34 -96
  88. package/dist/eslint-rules/paper-typography.js.map +1 -1
  89. package/dist/eslint-rules/papers.d.ts +1 -3
  90. package/dist/eslint-rules/papers.d.ts.map +1 -1
  91. package/dist/eslint-rules/papers.js +2 -4
  92. package/dist/eslint-rules/papers.js.map +1 -1
  93. package/dist/eslint-rules/tex-build.d.ts.map +1 -1
  94. package/dist/eslint-rules/tex-build.js +8 -25
  95. package/dist/eslint-rules/tex-build.js.map +1 -1
  96. package/dist/init.d.ts +1 -4
  97. package/dist/init.d.ts.map +1 -1
  98. package/dist/init.js +3 -9
  99. package/dist/init.js.map +1 -1
  100. package/dist/latex-log.d.ts +10 -0
  101. package/dist/latex-log.d.ts.map +1 -1
  102. package/dist/latex-log.js +10 -0
  103. package/dist/latex-log.js.map +1 -1
  104. package/dist/latex-loop.d.ts +2 -0
  105. package/dist/latex-loop.d.ts.map +1 -1
  106. package/dist/latex-loop.js.map +1 -1
  107. package/dist/lib/markdown.d.ts +5 -81
  108. package/dist/lib/markdown.d.ts.map +1 -1
  109. package/dist/lib/markdown.js +5 -116
  110. package/dist/lib/markdown.js.map +1 -1
  111. package/dist/lib/paper-config.d.ts.map +1 -1
  112. package/dist/lib/paper-config.js +0 -2
  113. package/dist/lib/paper-config.js.map +1 -1
  114. package/dist/lib/skill-eval-fixture.d.ts +6 -4
  115. package/dist/lib/skill-eval-fixture.d.ts.map +1 -1
  116. package/dist/lib/skill-eval-fixture.js +25 -18
  117. package/dist/lib/skill-eval-fixture.js.map +1 -1
  118. package/dist/new-paper.d.ts +5 -11
  119. package/dist/new-paper.d.ts.map +1 -1
  120. package/dist/new-paper.js +12 -23
  121. package/dist/new-paper.js.map +1 -1
  122. package/dist/package-dirs.d.ts.map +1 -1
  123. package/dist/package-dirs.js +3 -2
  124. package/dist/package-dirs.js.map +1 -1
  125. package/dist/paper-files.d.ts +4 -4
  126. package/dist/paper-includes.d.ts +4 -7
  127. package/dist/paper-includes.d.ts.map +1 -1
  128. package/dist/paper-includes.js +29 -21
  129. package/dist/paper-includes.js.map +1 -1
  130. package/dist/paper-prose.d.ts +17 -0
  131. package/dist/paper-prose.d.ts.map +1 -0
  132. package/dist/paper-prose.js +46 -0
  133. package/dist/paper-prose.js.map +1 -0
  134. package/dist/paper-record.d.ts +25 -0
  135. package/dist/paper-record.d.ts.map +1 -0
  136. package/dist/paper-record.js +39 -0
  137. package/dist/paper-record.js.map +1 -0
  138. package/dist/paper-sources.d.ts +66 -0
  139. package/dist/paper-sources.d.ts.map +1 -0
  140. package/dist/paper-sources.js +92 -0
  141. package/dist/paper-sources.js.map +1 -0
  142. package/dist/ports/bib-reader.d.ts +18 -0
  143. package/dist/ports/bib-reader.d.ts.map +1 -0
  144. package/dist/ports/bib-reader.js +2 -0
  145. package/dist/ports/bib-reader.js.map +1 -0
  146. package/dist/ports/check-references.d.ts +9 -4
  147. package/dist/ports/check-references.d.ts.map +1 -1
  148. package/dist/ports/latex.d.ts +15 -0
  149. package/dist/ports/latex.d.ts.map +1 -1
  150. package/dist/ports/sources-codec.d.ts +11 -0
  151. package/dist/ports/sources-codec.d.ts.map +1 -0
  152. package/dist/ports/sources-codec.js +2 -0
  153. package/dist/ports/sources-codec.js.map +1 -0
  154. package/dist/ports/tex-output.d.ts +17 -0
  155. package/dist/ports/tex-output.d.ts.map +1 -0
  156. package/dist/ports/tex-output.js +2 -0
  157. package/dist/ports/tex-output.js.map +1 -0
  158. package/dist/recorded-bibliography.d.ts +89 -0
  159. package/dist/recorded-bibliography.d.ts.map +1 -0
  160. package/dist/recorded-bibliography.js +136 -0
  161. package/dist/recorded-bibliography.js.map +1 -0
  162. package/dist/reference-rules.d.ts +5 -5
  163. package/dist/reference-rules.d.ts.map +1 -1
  164. package/dist/reference-rules.js +150 -77
  165. package/dist/reference-rules.js.map +1 -1
  166. package/dist/references.d.ts +71 -16
  167. package/dist/references.d.ts.map +1 -1
  168. package/dist/references.js +110 -26
  169. package/dist/references.js.map +1 -1
  170. package/dist/register-bands.d.ts +3 -3
  171. package/dist/register-bands.d.ts.map +1 -1
  172. package/dist/register-bands.js.map +1 -1
  173. package/dist/register.d.ts +2 -2
  174. package/dist/sources-record.d.ts +38 -0
  175. package/dist/sources-record.d.ts.map +1 -0
  176. package/dist/sources-record.js +123 -0
  177. package/dist/sources-record.js.map +1 -0
  178. package/dist/sources-rules.d.ts +44 -0
  179. package/dist/sources-rules.d.ts.map +1 -0
  180. package/dist/sources-rules.js +76 -0
  181. package/dist/sources-rules.js.map +1 -0
  182. package/dist/structure.d.ts.map +1 -1
  183. package/dist/structure.js +4 -3
  184. package/dist/structure.js.map +1 -1
  185. package/dist/tex-paper.d.ts +10 -15
  186. package/dist/tex-paper.d.ts.map +1 -1
  187. package/dist/tex-paper.js +24 -40
  188. package/dist/tex-paper.js.map +1 -1
  189. package/dist/tex-venue-rules.d.ts +3 -3
  190. package/dist/tex-venue-rules.d.ts.map +1 -1
  191. package/dist/tex-venue-rules.js.map +1 -1
  192. package/dist/types.d.ts +0 -2
  193. package/dist/types.d.ts.map +1 -1
  194. package/docs/configuration.md +18 -12
  195. package/docs/design/paper-sources.md +197 -0
  196. package/docs/e2e.md +4 -6
  197. package/docs/package-shape-options.md +1 -1
  198. package/docs/prior-art/paper-folder-scaffolding.md +24 -29
  199. package/docs/references.md +34 -8
  200. package/docs/rules/bib/reachable-entry.md +64 -0
  201. package/docs/rules/paper/sources-fresh.md +81 -0
  202. package/docs/rules/tex/claim-provenance.md +0 -1
  203. package/docs/rules.md +62 -61
  204. package/eslint-rules/latex-language.harness.mjs +3 -3
  205. package/eslint-rules/latex-language.ts +10 -13
  206. package/eslint-rules/paper-context.ts +6 -5
  207. package/eslint-rules/paper-typography.test.mjs +29 -157
  208. package/eslint-rules/paper-typography.ts +35 -104
  209. package/eslint-rules/papers.harness.mjs +1 -1
  210. package/eslint-rules/papers.ts +2 -4
  211. package/eslint-rules/tex-build.harness.mjs +2 -2
  212. package/eslint-rules/tex-build.ts +8 -25
  213. package/eslint.config.mjs +22 -1
  214. package/fixtures/build-e2e/aidc/paper.tex +1 -1
  215. package/fixtures/build-e2e/anon-ack/paper.tex +1 -1
  216. package/fixtures/build-e2e/anon-author/paper.tex +1 -1
  217. package/fixtures/build-e2e/anon-bib/paper.tex +1 -1
  218. package/fixtures/build-e2e/anon-href/paper.tex +1 -1
  219. package/fixtures/build-e2e/anon-macro/paper.tex +1 -1
  220. package/fixtures/build-e2e/anon-pdfauthor/paper.tex +1 -1
  221. package/fixtures/paper-sources/p1/paper.tex +30 -0
  222. package/fixtures/paper-sources/p1/refs.bib +6 -0
  223. package/fixtures/paper-sources/p1/sections/dead.tex +6 -0
  224. package/fixtures/paper-sources/p1/sections/intro.tex +7 -0
  225. package/fixtures/paper-sources/p1/sections/parked.tex +6 -0
  226. package/fixtures/paper-sources/p1/tex-truth.json +37 -0
  227. package/fixtures/paper-sources/p1/versions/2026-01-01-review.tex +4 -0
  228. package/fixtures/paper-sources/v1-stale/paper.tex +14 -0
  229. package/fixtures/paper-sources/v1-stale/refs.bib +6 -0
  230. package/fixtures/paper-sources/v1-stale/tex-truth.json +32 -0
  231. package/fixtures/paper-sources/v10-ifthenelse/anon.bib +1 -0
  232. package/fixtures/paper-sources/v10-ifthenelse/paper.tex +9 -0
  233. package/fixtures/paper-sources/v10-ifthenelse/real.bib +1 -0
  234. package/fixtures/paper-sources/v10-ifthenelse/tex-truth.json +28 -0
  235. package/fixtures/paper-sources/v11-two-blocks/paper.tex +12 -0
  236. package/fixtures/paper-sources/v11-two-blocks/tex-truth.json +30 -0
  237. package/fixtures/paper-sources/v13-percent-text/paper.tex +6 -0
  238. package/fixtures/paper-sources/v13-percent-text/refs.bib +3 -0
  239. package/fixtures/paper-sources/v13-percent-text/tex-truth.json +30 -0
  240. package/fixtures/paper-sources/v15-after-end/paper.tex +6 -0
  241. package/fixtures/paper-sources/v15-after-end/refs.bib +1 -0
  242. package/fixtures/paper-sources/v15-after-end/tex-truth.json +17 -0
  243. package/fixtures/paper-sources/v16-included-block/bibblock.tex +3 -0
  244. package/fixtures/paper-sources/v16-included-block/paper.tex +7 -0
  245. package/fixtures/paper-sources/v16-included-block/refs.bib +1 -0
  246. package/fixtures/paper-sources/v16-included-block/tex-truth.json +35 -0
  247. package/fixtures/paper-sources/v17-include-order/bibsetup.tex +1 -0
  248. package/fixtures/paper-sources/v17-include-order/first.bib +1 -0
  249. package/fixtures/paper-sources/v17-include-order/later.bib +1 -0
  250. package/fixtures/paper-sources/v17-include-order/paper.tex +7 -0
  251. package/fixtures/paper-sources/v17-include-order/tex-truth.json +40 -0
  252. package/fixtures/paper-sources/v2-overwrite/paper.tex +14 -0
  253. package/fixtures/paper-sources/v2-overwrite/refs.bib +6 -0
  254. package/fixtures/paper-sources/v2-overwrite/tex-truth.json +30 -0
  255. package/fixtures/paper-sources/v22-parked-thebibliography/paper.tex +7 -0
  256. package/fixtures/paper-sources/v22-parked-thebibliography/tex-truth.json +17 -0
  257. package/fixtures/paper-sources/v23-parked-include/old.bib +1 -0
  258. package/fixtures/paper-sources/v23-parked-include/paper.tex +7 -0
  259. package/fixtures/paper-sources/v23-parked-include/parked.tex +1 -0
  260. package/fixtures/paper-sources/v23-parked-include/refs.bib +1 -0
  261. package/fixtures/paper-sources/v23-parked-include/tex-truth.json +28 -0
  262. package/fixtures/paper-sources/v24-quoted-fields/paper.tex +6 -0
  263. package/fixtures/paper-sources/v24-quoted-fields/refs.bib +5 -0
  264. package/fixtures/paper-sources/v24-quoted-fields/tex-truth.json +32 -0
  265. package/fixtures/paper-sources/v25-string-differs/paper.tex +10 -0
  266. package/fixtures/paper-sources/v25-string-differs/refs.bib +2 -0
  267. package/fixtures/paper-sources/v25-string-differs/tex-truth.json +32 -0
  268. package/fixtures/paper-sources/v26-comment-in-names/one.bib +1 -0
  269. package/fixtures/paper-sources/v26-comment-in-names/paper.tex +7 -0
  270. package/fixtures/paper-sources/v26-comment-in-names/tex-truth.json +32 -0
  271. package/fixtures/paper-sources/v26-comment-in-names/two.bib +1 -0
  272. package/fixtures/paper-sources/v27-shared-string/abbreviations.bib +2 -0
  273. package/fixtures/paper-sources/v27-shared-string/paper.tex +6 -0
  274. package/fixtures/paper-sources/v27-shared-string/references.bib +6 -0
  275. package/fixtures/paper-sources/v27-shared-string/tex-truth.json +31 -0
  276. package/fixtures/paper-sources/v28-shared-string-block/abbreviations.bib +2 -0
  277. package/fixtures/paper-sources/v28-shared-string-block/paper.tex +14 -0
  278. package/fixtures/paper-sources/v28-shared-string-block/tex-truth.json +33 -0
  279. package/fixtures/paper-sources/v29-generated-input/paper.tex +9 -0
  280. package/fixtures/paper-sources/v29-generated-input/tex-truth.json +24 -0
  281. package/fixtures/paper-sources/v3-declared/paper.bib +6 -0
  282. package/fixtures/paper-sources/v3-declared/paper.tex +6 -0
  283. package/fixtures/paper-sources/v3-declared/tex-truth.json +28 -0
  284. package/fixtures/paper-sources/v30-name-next-line/paper.tex +14 -0
  285. package/fixtures/paper-sources/v30-name-next-line/tex-truth.json +30 -0
  286. package/fixtures/paper-sources/v4-commented/paper.tex +14 -0
  287. package/fixtures/paper-sources/v4-commented/refs.bib +6 -0
  288. package/fixtures/paper-sources/v4-commented/tex-truth.json +28 -0
  289. package/fixtures/paper-sources/v5-percent-entry/paper.tex +20 -0
  290. package/fixtures/paper-sources/v5-percent-entry/tex-truth.json +37 -0
  291. package/fixtures/paper-sources/v6-unclosed/paper.tex +6 -0
  292. package/fixtures/paper-sources/v6-unclosed/refs.bib +5 -0
  293. package/fixtures/paper-sources/v6-unclosed/tex-truth.json +37 -0
  294. package/fixtures/paper-sources/v8-jobname/paper.tex +9 -0
  295. package/fixtures/paper-sources/v8-jobname/tex-truth.json +30 -0
  296. package/fixtures/paper-sources/v9-two-bibliographies/one.bib +1 -0
  297. package/fixtures/paper-sources/v9-two-bibliographies/paper.tex +7 -0
  298. package/fixtures/paper-sources/v9-two-bibliographies/tex-truth.json +35 -0
  299. package/fixtures/paper-sources/v9-two-bibliographies/two.bib +1 -0
  300. package/fixtures/paper-typography/clean-paper/paper.tex +1 -1
  301. package/fixtures/paper-typography/messy-paper/paper.tex +1 -1
  302. package/hooks/hooks.harness.ts +15 -15
  303. package/hooks/paper-edit-guard.hook.mjs +5 -8
  304. package/hooks/paper-edit-guard.test.ts +12 -3
  305. package/hooks/paper-skills-nudge.hook.mjs +2 -3
  306. package/hooks/paper-skills-nudge.test.ts +13 -3
  307. package/hooks/paper-status-gates.hook.mjs +2 -2
  308. package/hooks/paper-status-gates.test.ts +14 -2
  309. package/lib/markdown.test.mjs +5 -60
  310. package/lib/markdown.ts +9 -136
  311. package/lib/paper-config.ts +0 -2
  312. package/lib/skill-checks.test.mjs +4 -1
  313. package/lib/skill-eval-fixture.ts +25 -18
  314. package/package.json +2 -12
  315. package/presets/realm.jsonc +1 -1
  316. package/scripts/check.test.ts +23 -1
  317. package/scripts/check.ts +7 -3
  318. package/scripts/coverage-config.test.ts +19 -10
  319. package/scripts/harness-api.frozen.json +0 -5
  320. package/scripts/layer-legacy-frozen.test.ts +41 -2
  321. package/scripts/layer-legacy-frozen.ts +31 -2
  322. package/skills/cold-read-diff/SKILL.md +3 -3
  323. package/skills/cold-read-diff/SKILL.md.spec.ts +2 -2
  324. package/skills/grade-paper-writing/SKILL.md +15 -22
  325. package/skills/grade-paper-writing/SKILL.md.spec.ts +14 -21
  326. package/skills/grade-paper-writing/__snapshots__/prose-lint.test.ts.snap +40 -26
  327. package/skills/grade-paper-writing/prose-lint.mjs +117 -278
  328. package/skills/grade-paper-writing/prose-lint.test.ts +230 -79
  329. package/skills/paper-adversarial-review/SKILL.md +2 -2
  330. package/skills/paper-adversarial-review/SKILL.md.spec.ts +1 -1
  331. package/skills/paper-pipeline/SKILL.md +9 -12
  332. package/skills/paper-pipeline/SKILL.md.spec.ts +8 -11
  333. package/skills/paper-pipeline/description-language.eval.mjs +25 -15
  334. package/skills/paper-pipeline/framing-vs-vocabulary.eval.mjs +25 -15
  335. package/skills/paper-pipeline/grade-paper-writing-ablation.eval.mjs +25 -15
  336. package/skills/paper-pipeline/pipeline-firing.eval.mjs +27 -16
  337. package/skills/paper-pipeline/pipeline-language.eval.mjs +25 -15
  338. package/skills/paper-pipeline/references/acceptance-gate.md +16 -20
  339. package/skills/paper-pipeline/references/artifact-checklist.md +4 -5
  340. package/skills/paper-pipeline/references/pipeline-status-template.md +1 -1
  341. package/skills/paper-pipeline/scripts/README.md +0 -4
  342. package/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs +91 -105
  343. package/skills/paper-pipeline/scripts/extract-ref-facts.mjs +85 -241
  344. package/skills/paper-pipeline/scripts/extract-ref-facts.test.mjs +166 -153
  345. package/skills/paper-pipeline/scripts/generated-code.harness.mjs +3 -3
  346. package/skills/paper-status/SKILL.md +2 -2
  347. package/skills/paper-status/SKILL.md.spec.ts +1 -1
  348. package/skills/render-paper/SKILL.md +2 -2
  349. package/skills/render-paper/SKILL.md.spec.ts +1 -1
  350. package/skills/render-paper/extract-pdf-facts.mjs +2 -2
  351. package/skills/tighten-paper/SKILL.md +29 -42
  352. package/skills/tighten-paper/SKILL.md.spec.ts +28 -41
  353. package/skills/verify-citations/SKILL.md +7 -4
  354. package/skills/verify-citations/SKILL.md.spec.ts +6 -3
  355. package/skills/verify-citations/scripts/bib-authors.check.test.mjs +17 -32
  356. package/skills/verify-citations/scripts/bib-authors.cli.test.ts +138 -43
  357. package/skills/verify-citations/scripts/bib-authors.d.mts +22 -2
  358. package/skills/verify-citations/scripts/bib-authors.mjs +54 -193
  359. package/skills/verify-citations/scripts/bib-authors.test.mjs +1 -44
  360. package/skills/verify-citations/scripts/verify-cites.cli.test.ts +16 -0
  361. package/skills/verify-citations/scripts/verify-cites.d.mts +19 -3
  362. package/skills/verify-citations/scripts/verify-cites.mjs +42 -108
  363. package/skills/verify-citations/scripts/verify-cites.test.mjs +23 -36
  364. package/src/adapters/bibtex/index.test.ts +163 -0
  365. package/src/adapters/bibtex/index.ts +155 -0
  366. package/src/adapters/latex/filecontents.ts +114 -0
  367. package/src/adapters/latex/includes.ts +18 -10
  368. package/src/adapters/latex/index.test.ts +73 -0
  369. package/src/adapters/latex/index.ts +2 -0
  370. package/src/adapters/latex/nodes.ts +64 -0
  371. package/src/adapters/latex/parse.test.ts +38 -0
  372. package/src/adapters/latex/parse.ts +67 -6
  373. package/src/adapters/memory/index.ts +17 -0
  374. package/src/adapters/references/index.test.ts +75 -21
  375. package/src/adapters/references/index.ts +37 -32
  376. package/src/adapters/sources-record/index.test.ts +87 -0
  377. package/src/adapters/sources-record/index.ts +82 -0
  378. package/src/adapters/tex-output/blg.ts +27 -0
  379. package/src/adapters/tex-output/fls.ts +24 -0
  380. package/src/adapters/tex-output/index.test.ts +171 -0
  381. package/src/adapters/tex-output/index.ts +12 -0
  382. package/src/bib-rules.test.ts +356 -0
  383. package/src/bib-rules.ts +228 -0
  384. package/src/bibliography-at.test.ts +286 -0
  385. package/src/build.harness.mjs +2 -2
  386. package/src/build.test.ts +211 -1
  387. package/src/build.ts +101 -41
  388. package/src/claim-provenance.test.ts +33 -7
  389. package/src/claim-provenance.ts +2 -2
  390. package/src/cli.harness.mjs +46 -56
  391. package/src/cli.test.ts +44 -48
  392. package/src/cli.ts +51 -82
  393. package/src/domain/paper-source.test.ts +58 -20
  394. package/src/domain/paper-source.ts +38 -42
  395. package/src/domain/paper-sources.ts +94 -0
  396. package/src/domain/sources-record.test.ts +71 -0
  397. package/src/domain/sources-record.ts +136 -0
  398. package/src/domain/tex-run.test.ts +228 -0
  399. package/src/domain/tex-run.ts +139 -0
  400. package/src/folder-venue-rule.test.ts +1 -1
  401. package/src/heading-case.test.ts +24 -10
  402. package/src/init.test.ts +6 -7
  403. package/src/init.ts +3 -22
  404. package/src/latex-log.ts +20 -0
  405. package/src/latex-loop.harness.ts +1 -0
  406. package/src/latex-loop.ts +2 -0
  407. package/src/lint-fix.test.ts +10 -4
  408. package/src/linted-set.test.ts +9 -1
  409. package/src/new-paper.harness.mjs +12 -30
  410. package/src/new-paper.test.ts +15 -11
  411. package/src/new-paper.ts +11 -30
  412. package/src/package-dirs.ts +3 -2
  413. package/src/paper-files.test.ts +5 -4
  414. package/src/paper-files.ts +4 -4
  415. package/src/paper-includes.test.ts +157 -38
  416. package/src/paper-includes.ts +39 -35
  417. package/src/paper-prose.test.ts +78 -0
  418. package/src/paper-prose.ts +67 -0
  419. package/src/paper-record.test.ts +173 -0
  420. package/src/paper-record.ts +66 -0
  421. package/src/paper-settings-commands.test.ts +5 -2
  422. package/src/paper-sources.ts +151 -0
  423. package/src/parse-args.test.ts +0 -1
  424. package/src/ports/bib-reader.ts +27 -0
  425. package/src/ports/check-references.ts +7 -3
  426. package/src/ports/latex.ts +19 -0
  427. package/src/ports/sources-codec.ts +11 -0
  428. package/src/ports/tex-output.ts +17 -0
  429. package/src/recorded-bibliography.ts +297 -0
  430. package/src/reference-rules.ts +217 -104
  431. package/src/references.test.ts +520 -177
  432. package/src/references.ts +185 -37
  433. package/src/register-bands.test.ts +5 -1
  434. package/src/register-bands.ts +3 -5
  435. package/src/register.test.ts +6 -1
  436. package/src/register.ts +2 -2
  437. package/src/rule-cases.test.ts +68 -12
  438. package/src/rule-docs.test.ts +0 -1
  439. package/src/sources-record.test.ts +308 -0
  440. package/src/sources-record.ts +231 -0
  441. package/src/sources-rules.test.ts +152 -0
  442. package/src/sources-rules.ts +117 -0
  443. package/src/structure.harness.ts +5 -11
  444. package/src/structure.ts +4 -3
  445. package/src/tex-paper.test.ts +148 -78
  446. package/src/tex-paper.ts +31 -61
  447. package/src/tex-venue-rules.test.ts +36 -8
  448. package/src/tex-venue-rules.ts +3 -5
  449. package/src/types.ts +0 -2
  450. package/dist/eslint-rules/bib-reachable-entry.d.ts +0 -22
  451. package/dist/eslint-rules/bib-reachable-entry.d.ts.map +0 -1
  452. package/dist/eslint-rules/bib-reachable-entry.js +0 -75
  453. package/dist/eslint-rules/bib-reachable-entry.js.map +0 -1
  454. package/eslint-rules/bib-reachable-entry.ts +0 -76
  455. package/fixtures/real-markdown-paper/baseline.json +0 -22
  456. package/fixtures/real-markdown-paper/baseline.ts +0 -70
  457. package/skills/paper-pipeline/PIPELINE-MAP.md +0 -381
  458. package/skills/paper-pipeline/pipeline-firing.baseline.json +0 -270
  459. package/skills/paper-pipeline/references/sweep-2026-08-09-ideal-pipeline.md +0 -585
  460. package/skills/paper-pipeline/scripts/artifact-coverage.harness.mjs +0 -492
  461. package/skills/paper-pipeline/scripts/artifact-coverage.mjs +0 -397
  462. package/skills/paper-pipeline/scripts/artifact-coverage.test.ts +0 -86
  463. package/skills/paper-pipeline/scripts/check-provenance.mjs +0 -184
  464. package/skills/paper-pipeline/scripts/population-map.harness.mjs +0 -135
  465. package/skills/paper-pipeline/scripts/population-map.mjs +0 -188
  466. package/skills/paper-pipeline/scripts/population-map.test.mjs +0 -154
  467. package/skills/paper-pipeline/scripts/provenance.harness.mjs +0 -266
  468. package/skills/paper-pipeline/scripts/round-diff.harness.ts +0 -907
  469. package/skills/paper-pipeline/scripts/round-diff.mjs +0 -583
  470. package/skills/paper-pipeline/scripts/round-diff.test.mjs +0 -159
  471. package/skills/tighten-paper/__snapshots__/structure.test.ts.snap +0 -133
  472. package/skills/tighten-paper/structure.mjs +0 -364
  473. package/skills/tighten-paper/structure.test.ts +0 -117
  474. package/templates/paper/paper.md +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recorded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AQ,CAAC;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SACxD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAU,CAAC,CAC1D,CAAC;IACF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAW,EACX,QAAsE,EACtE,IAAkB;IAElB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,OAAO,QAAQ,CAAC,SAAS,CAAC,GAAG,CAC3B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAC5E,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Files } from "./ports/files.ts";
1
+ import { type RecordedDeps } from "./recorded-bibliography.ts";
2
2
  interface Loc {
3
3
  readonly line: number;
4
4
  readonly column: number;
@@ -7,6 +7,8 @@ interface RuleContext {
7
7
  readonly filename: string;
8
8
  readonly cwd: string;
9
9
  readonly sourceCode: {
10
+ /** The file as written (the `tex/latex` language's source code). */
11
+ readonly raw: string;
10
12
  getLocFromIndex(i: number): Loc;
11
13
  };
12
14
  report(d: {
@@ -32,10 +34,8 @@ export interface ReferenceRuleModule {
32
34
  };
33
35
  }
34
36
  type Name = "author-list" | "cite-exists" | "refs-checked" | "refs-fresh";
35
- /** The four rules, reading through `files`. They act on `paper.tex` only. */
36
- export declare function referenceRules({ files, }: {
37
- files: Files;
38
- }): Record<Name, ReferenceRuleModule>;
37
+ /** The four rules, reading the paper through `deps`. They act on `paper.tex` only. */
38
+ export declare function referenceRules(deps: RecordedDeps): Record<Name, ReferenceRuleModule>;
39
39
  /** The level each is on at for every `paper.tex` in paperlint's own config. */
40
40
  export declare const REFERENCE_RULE_LEVELS: {
41
41
  readonly "paper/author-list": "error";
@@ -1 +1 @@
1
- {"version":3,"file":"reference-rules.d.ts","sourceRoot":"","sources":["../src/reference-rules.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAS9C,UAAU,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AACD,UAAU,WAAW;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE;QACnB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KACjC,CAAC;IACF,MAAM,CAAC,CAAC,EAAE;QACR,GAAG,EAAE;YAAE,KAAK,EAAE,GAAG,CAAC;YAAC,GAAG,EAAE,GAAG,CAAA;SAAE,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,GAAG,IAAI,CAAC;CACV;AACD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;QAC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,GAAG,CAAA;SAAE,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,GAAG,IAAI,CAAC;CACV;AACD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;QACxC,QAAQ,CAAC,IAAI,EAAE;YAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;QAChD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;QACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACrD,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG;QAAE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CAC5D;AAED,KAAK,IAAI,GAAG,aAAa,GAAG,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;AA+N1E,sFAAsF;AACtF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,GACjB,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC,CA6BnC;AAED,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC"}
@@ -5,47 +5,76 @@
5
5
  *
6
6
  * entry whose authors are the preprint's paper/author-list (error), on the entry
7
7
  * entry whose identifier provably fails paper/cite-exists (error), on the entry
8
- * no record, or recorded "not checked" paper/refs-checked (warn) — like pdf/measured
9
- * bibliography edited after the build paper/refs-fresh (error) — like pdf/fresh
8
+ * no verdicts, or recorded "not checked" paper/refs-checked (warn) — like pdf/measured
9
+ * a key bibtex typeset that no entry the paper/refs-checked (warn): that reference was not
10
+ * reader read has (`unseenKeys`) checked
11
+ * a database bibtex found outside the paper/refs-checked (warn): its references were not checked
12
+ * paper directory (BIBINPUTS)
13
+ * databases edited after the build paper/refs-fresh (error) — like pdf/fresh
10
14
  *
11
- * While the record is stale, the per-entry rules are silent: they would judge a bibliography
12
- * that no longer exists, and refs-fresh already says so once. A paper with no bibliography gets
13
- * nothing.
15
+ * The databases are the ones the last build's bibtex opened (`_build/sources.json`,
16
+ * docs/design/paper-sources.md §1) — `readBibliography` answers only from a record the paper has not
17
+ * changed since. With no record, or a stale one, every rule here is silent: `paper/sources-fresh`
18
+ * speaks once. While the verdicts are stale, the per-entry rules are silent too: they would judge
19
+ * databases that no longer exist, and refs-fresh already says so once. A paper whose build ran no
20
+ * bibtex gets nothing.
21
+ *
22
+ * `paper/author-list` and `paper/cite-exists` lay the verdicts on the entries of those databases. ESLint
23
+ * does not lint a `.bib`, so a finding is a place in `paper.tex`: an entry of a `.bib` TeX wrote from a
24
+ * block of `paper.tex` is reported on its line there (`entryReports`); any other entry at the top of
25
+ * `paper.tex`, with the entry's file, line and column at the front of the message (`refs.bib:12:1:`).
14
26
  *
15
27
  * `paper/author-list` used to live on PIPELINE-STATUS.md and ask whether the scorecard mentioned
16
28
  * a run. It lives here now because its subject is the bibliography, and the record of the run is
17
29
  * the run's own output.
18
30
  */
19
31
  import { basename, dirname } from "node:path";
20
- import { bibHash, bibliographyOf, readReferences, REFERENCES_FILE, } from "./references.js";
21
- function assess(files, paperDir) {
22
- const bib = bibliographyOf(files, paperDir);
23
- if (bib === null)
24
- return { kind: "no-bibliography" };
25
- const doc = readReferences(files, paperDir);
32
+ import { callerPath } from "./caller-path.js";
33
+ import { MAIN_FILE } from "./domain/paper-sources.js";
34
+ import { entryReports, } from "./recorded-bibliography.js";
35
+ import { bibHash, readBibliography, readReferences, REFERENCES_FILE, unseenKeys, } from "./references.js";
36
+ /**
37
+ * Each entry checked with its verdict — when the record holds one verdict per entry, in its order, as
38
+ * the build writes it. One that does not (written by hand) is not about these databases: null.
39
+ */
40
+ function laid(verdicts, entries) {
41
+ const pairs = entries.flatMap((f, i) => {
42
+ const v = verdicts[i];
43
+ return v?.key === f.entry.key ? [[f, v]] : [];
44
+ });
45
+ return pairs.length === entries.length && verdicts.length === entries.length
46
+ ? pairs
47
+ : null;
48
+ }
49
+ /** What the verdicts on disk say about the databases of `bib`. */
50
+ function judgedVerdicts(bib, doc) {
26
51
  if (doc === null)
27
52
  return { kind: "unrecorded" };
28
53
  if (doc.bib.sha256 !== bibHash(bib))
29
54
  return { kind: "stale" };
30
55
  if (doc.status === "not-checked")
31
56
  return { kind: "not-checked", why: doc.why ?? "no reason recorded" };
32
- const failing = doc.entries.flatMap((e) => [
33
- ...(e.authors === "mismatch"
34
- ? [{ key: e.key, rule: "author-list", why: e.why ?? "" }]
35
- : []),
36
- ...(e.exists === "false"
37
- ? [{ key: e.key, rule: "cite-exists", why: e.why ?? "" }]
38
- : []),
39
- ]);
40
- return { kind: "ready", bib, failing };
57
+ const verdicts = laid(doc.entries, bib.entries);
58
+ return verdicts === null
59
+ ? { kind: "stale" }
60
+ : { kind: "ready", judged: { bib, verdicts } };
41
61
  }
42
- /** Where entry `key` starts in the source file: its `@type{key,` line, or the file's start. */
43
- function entryOffset(bib, key) {
44
- const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
45
- const m = new RegExp(`^@\\w+\\s*\\{\\s*${escaped}\\s*,`, "m").exec(bib.text);
46
- return m ? bib.offset + m.index : 0;
62
+ function assess(deps, paperDir) {
63
+ const read = readBibliography(paperDir, deps);
64
+ switch (read.kind) {
65
+ case "no-record":
66
+ case "nothing":
67
+ case "not-wired":
68
+ return { kind: "silent" };
69
+ case "unread":
70
+ return { kind: "unread", databases: read.databases };
71
+ case "read":
72
+ return judgedVerdicts(read.bibliography, readReferences(deps.files, paperDir));
73
+ }
47
74
  }
48
75
  const BUILD = "`npx paperlint build`";
76
+ const MISMATCH = "`{{key}}`: the authors are not those of the version cited — {{why}}. The citation resolves and the id resolves, and the list is the PREPRINT's under a published venue";
77
+ const MISSING = "`{{key}}` does not resolve to the work cited — {{why}}";
49
78
  const META = {
50
79
  "author-list": {
51
80
  type: "problem",
@@ -53,9 +82,7 @@ const META = {
53
82
  description: "each entry's authors are those of the version it cites, not the preprint's (recorded by paperlint build)",
54
83
  },
55
84
  schema: [],
56
- messages: {
57
- mismatch: "`{{key}}`: the authors are not those of the version cited — {{why}}. The citation resolves and the id resolves, and the list is the PREPRINT's under a published venue",
58
- },
85
+ messages: { mismatch: MISMATCH, mismatchIn: `{{where}}: ${MISMATCH}` },
59
86
  },
60
87
  "cite-exists": {
61
88
  type: "problem",
@@ -63,9 +90,7 @@ const META = {
63
90
  description: "each entry's identifier resolves to the work cited (recorded by paperlint build)",
64
91
  },
65
92
  schema: [],
66
- messages: {
67
- missing: "`{{key}}` does not resolve to the work cited — {{why}}",
68
- },
93
+ messages: { missing: MISSING, missingIn: `{{where}}: ${MISSING}` },
69
94
  },
70
95
  "refs-checked": {
71
96
  type: "suggestion",
@@ -76,12 +101,14 @@ const META = {
76
101
  messages: {
77
102
  unrecorded: `the references have not been checked — ${BUILD} checks them online and records the result in _build/${REFERENCES_FILE}`,
78
103
  notChecked: `the last build could not check the references ({{why}}) — run ${BUILD} with network`,
104
+ unseen: "the last build's bibtex typeset {{what}}, which paperlint's reader did not read from the databases bibtex opened, so those references were not checked: an entry behind `%` or inside `@comment{…}` — bibtex has no comment syntax and reads it, the reader skips it. Delete the entry, or remove its `@`",
105
+ unread: `{{what}}, which the last build's bibtex opened, is not in the paper directory (bibtex found it on its search path, BIBINPUTS), so its references were not checked — move it beside paper.tex`,
79
106
  },
80
107
  },
81
108
  "refs-fresh": {
82
109
  type: "problem",
83
110
  docs: {
84
- description: "the recorded reference verdicts are about the bibliography on disk, not an earlier one",
111
+ description: "the recorded reference verdicts are about the databases on disk, not an earlier set",
85
112
  },
86
113
  schema: [],
87
114
  messages: {
@@ -89,61 +116,107 @@ const META = {
89
116
  },
90
117
  },
91
118
  };
119
+ const AT_START = { kind: "here", span: { start: 0, end: 0 } };
92
120
  const JUDGES = {
93
- "author-list": (a) => a.kind === "ready"
94
- ? a.failing
95
- .filter((f) => f.rule === "author-list")
96
- .map((f) => ({
97
- at: entryOffset(a.bib, f.key),
98
- messageId: "mismatch",
99
- data: { key: f.key, why: f.why },
100
- }))
101
- : [],
102
- "cite-exists": (a) => a.kind === "ready"
103
- ? a.failing
104
- .filter((f) => f.rule === "cite-exists")
105
- .map((f) => ({
106
- at: entryOffset(a.bib, f.key),
107
- messageId: "missing",
108
- data: { key: f.key, why: f.why },
109
- }))
110
- : [],
111
- "refs-checked": (a) => a.kind === "unrecorded"
112
- ? [{ at: 0, messageId: "unrecorded" }]
113
- : a.kind === "not-checked"
114
- ? [{ at: 0, messageId: "notChecked", data: { why: a.why } }]
115
- : [],
116
- "refs-fresh": (a) => a.kind === "stale" ? [{ at: 0, messageId: "stale" }] : [],
121
+ "refs-checked": (a) => {
122
+ switch (a.kind) {
123
+ case "unrecorded":
124
+ return [{ messageId: "unrecorded" }];
125
+ case "not-checked":
126
+ return [{ messageId: "notChecked", data: { why: a.why } }];
127
+ case "unread":
128
+ return [
129
+ { messageId: "unread", data: { what: a.databases.join(", ") } },
130
+ ];
131
+ case "ready": {
132
+ const unseen = unseenKeys(a.judged.bib);
133
+ return unseen.length === 0
134
+ ? []
135
+ : [
136
+ {
137
+ messageId: "unseen",
138
+ data: { what: unseen.map((k) => `\`${k}\``).join(", ") },
139
+ },
140
+ ];
141
+ }
142
+ case "silent":
143
+ case "stale":
144
+ return [];
145
+ }
146
+ },
147
+ "refs-fresh": (a) => (a.kind === "stale" ? [{ messageId: "stale" }] : []),
117
148
  };
118
- /** The four rules, reading through `files`. They act on `paper.tex` only. */
119
- export function referenceRules({ files, }) {
120
- const make = (name) => ({
149
+ /**
150
+ * One finding, at its entry in paper.tex — or, for an entry in a `.bib`, at the top, with the `…In`
151
+ * message that names the entry's file, line and column first.
152
+ */
153
+ function report(context, r) {
154
+ const loc = (i) => context.sourceCode.getLocFromIndex(i);
155
+ const at = r.at ?? AT_START;
156
+ context.report({
157
+ loc: { start: loc(at.span.start), end: loc(at.span.end) },
158
+ ...(at.kind === "here"
159
+ ? { messageId: r.messageId, ...(r.data ? { data: r.data } : {}) }
160
+ : {
161
+ messageId: `${r.messageId}In`,
162
+ data: { ...r.data, where: at.where },
163
+ }),
164
+ });
165
+ }
166
+ /** The verdicts a rule reports, and the message each makes. */
167
+ const VERDICT_RULES = {
168
+ "author-list": {
169
+ failed: (v) => v.authors === "mismatch",
170
+ messageId: "mismatch",
171
+ },
172
+ "cite-exists": {
173
+ failed: (v) => v.exists === "false",
174
+ messageId: "missing",
175
+ },
176
+ };
177
+ /**
178
+ * The entries the verdicts judged failing for `rule`, each where it is reported (`entryReports`): the
179
+ * line of its `filecontents` block in the paper's text when TeX wrote its `.bib` from one, else the
180
+ * top of `paper.tex`.
181
+ */
182
+ function verdictReports(rule, context, deps) {
183
+ const main = callerPath(context.filename);
184
+ const dir = dirname(main);
185
+ const a = assess(deps, dir);
186
+ if (a.kind !== "ready")
187
+ return [];
188
+ const { failed, messageId } = VERDICT_RULES[rule];
189
+ const flagged = a.judged.verdicts.filter(([, v]) => failed(v));
190
+ const at = entryReports({
191
+ dir,
192
+ record: a.judged.bib.record,
193
+ main: { path: main, text: context.sourceCode.raw },
194
+ }, flagged.map(([f]) => f), deps);
195
+ return flagged.map(([, v], i) => ({
196
+ at: at[i],
197
+ messageId,
198
+ data: { key: v.key, why: v.why ?? "" },
199
+ }));
200
+ }
201
+ /** The four rules, reading the paper through `deps`. They act on `paper.tex` only. */
202
+ export function referenceRules(deps) {
203
+ const make = (name, judge) => ({
121
204
  meta: META[name],
122
- create: (context) => basename(context.filename) !== "paper.tex"
205
+ create: (context) => basename(context.filename) !== MAIN_FILE
123
206
  ? {}
124
207
  : {
125
208
  "root:exit": () => {
126
- const paperDir = dirname(context.filename);
127
- const a = assess(files, paperDir);
128
- // An external refs.bib: the entry is not in this file, so the finding sits at its
129
- // start and names the key.
130
- const external = a.kind === "ready" && a.bib.source !== "paper.tex";
131
- for (const r of JUDGES[name](a)) {
132
- const loc = context.sourceCode.getLocFromIndex(external ? 0 : r.at);
133
- context.report({
134
- loc: { start: loc, end: loc },
135
- messageId: r.messageId,
136
- ...(r.data ? { data: r.data } : {}),
137
- });
138
- }
209
+ for (const r of judge(context))
210
+ report(context, r);
139
211
  },
140
212
  },
141
213
  });
214
+ const assessed = (name) => (context) => JUDGES[name](assess(deps, dirname(callerPath(context.filename))));
142
215
  return {
143
- "author-list": make("author-list"),
144
- "cite-exists": make("cite-exists"),
145
- "refs-checked": make("refs-checked"),
146
- "refs-fresh": make("refs-fresh"),
216
+ "author-list": make("author-list", (c) => verdictReports("author-list", c, deps)),
217
+ "cite-exists": make("cite-exists", (c) => verdictReports("cite-exists", c, deps)),
218
+ "refs-checked": make("refs-checked", assessed("refs-checked")),
219
+ "refs-fresh": make("refs-fresh", assessed("refs-fresh")),
147
220
  };
148
221
  }
149
222
  /** The level each is on at for every `paper.tex` in paperlint's own config. */
@@ -1 +1 @@
1
- {"version":3,"file":"reference-rules.js","sourceRoot":"","sources":["../src/reference-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,GAEhB,MAAM,iBAAiB,CAAC;AA8CzB,SAAS,MAAM,CAAC,KAAY,EAAE,QAAgB;IAC5C,MAAM,GAAG,GAAG,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5C,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IACrD,MAAM,GAAG,GAAG,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5C,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAChD,IAAI,GAAG,CAAC,GAA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QAAQ,CAAC,KAAK,SAAS;YACtC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,WAAW,EAAE,GAAG,EAAE;oBAChB,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC;wBAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBACrD,CAAC;aACF;KACR,CAAC,CAAC;IACH,MAAM,QAAQ,GACZ,CAAC,IAAmC,EAAE,EAAE,CACxC,CAAC,OAAoB,EAAqB,EAAE,CAC1C,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CACvC,cAAc,CAAC,aAAa,EAAE,CAAC,EAAE,IAAI,CAAC,CACvC;QACD,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CACvC,cAAc,CAAC,aAAa,EAAE,CAAC,EAAE,IAAI,CAAC,CACvC;QACD,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;QAC9D,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;KACzD,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,mBAAmB,EAAE,OAAO;IAC5B,mBAAmB,EAAE,OAAO;IAC5B,oBAAoB,EAAE,MAAM;IAC5B,kBAAkB,EAAE,OAAO;CACnB,CAAC"}
@@ -2,43 +2,98 @@ import type { Files } from "./ports/files.ts";
2
2
  import { type LookupCache } from "./domain/lookup-cache.ts";
3
3
  import { type Result } from "./domain/result.ts";
4
4
  import type { CheckReferences, EntryVerdict, ReferencesCheck } from "./ports/check-references.ts";
5
- export declare const REFERENCES_SCHEMA = 1;
5
+ import { type SourcesRecord } from "./domain/sources-record.ts";
6
+ import type { PaperRecord } from "./paper-record.ts";
7
+ import { type ReadDatabase, type RecordedEntry, type RecordedReadDeps } from "./recorded-bibliography.ts";
8
+ /** 3: the record of what bibtex read lives in `_build/sources.json`; an older one reads as none. */
9
+ export declare const REFERENCES_SCHEMA = 3;
6
10
  export declare const REFERENCES_FILE = "references.json";
7
11
  /** The lookup cache's place in a paper: committed, beside the paper's other reproduction files. */
8
12
  export declare const LOOKUP_CACHE_FILE = "repro/references-cache.json";
9
13
  export declare const lookupCachePath: (paperDir: string) => string;
10
14
  /** Where a paper's reference verdicts live — beside `paper.facts.json`. */
11
15
  export declare const referencesPath: (paperDir: string) => string;
12
- /** The bibliography a paper carries: inside `paper.tex` (`filecontents`), else `refs.bib`. */
13
- export interface Bibliography {
14
- readonly source: "paper.tex" | "refs.bib";
15
- readonly text: string;
16
- /** Where `text` starts in the source file — so a finding can point at an entry. */
17
- readonly offset: number;
16
+ /**
17
+ * The bibliography the build checks: the databases bibtex opened, in the order it opened them, and
18
+ * their entries as the bibtex reader read them. The verdicts are recorded one per entry, in this
19
+ * order: a verdict is about an entry, not about its key.
20
+ */
21
+ export interface CheckedBibliography {
22
+ /** The build's record these databases were read from. */
23
+ readonly record: SourcesRecord;
24
+ readonly databases: readonly [ReadDatabase, ...ReadDatabase[]];
25
+ readonly entries: readonly RecordedEntry[];
26
+ /** The keys bibtex typeset, in the order it did: the `.bbl`'s `\bibitem`s. */
27
+ readonly typeset: readonly string[];
28
+ }
29
+ /** What reading the bibliography takes: the record's readers, and the bibtex reader. */
30
+ export type BibliographyDeps = RecordedReadDeps;
31
+ /** What a paper's record comes to for the references. */
32
+ export type BibliographyRead = {
33
+ readonly kind: "read";
34
+ readonly bibliography: CheckedBibliography;
35
+ }
36
+ /** No record of the build, an unreadable one, or one the paper has changed since. */
37
+ | {
38
+ readonly kind: "no-record";
39
+ readonly record: Exclude<PaperRecord, {
40
+ readonly kind: "fresh";
41
+ }>;
42
+ }
43
+ /** bibtex opened no database: the build ran none, or the paper names none. */
44
+ | {
45
+ readonly kind: "nothing";
18
46
  }
19
- export declare function bibliographyOf(files: Files, paperDir: string): Bibliography | null;
20
- export declare const bibHash: (b: Bibliography) => string;
47
+ /** Databases bibtex opened that are not in the paper directory: it found them on its search path. */
48
+ | {
49
+ readonly kind: "unread";
50
+ readonly databases: readonly string[];
51
+ }
52
+ /** The build was not given a reader. */
53
+ | {
54
+ readonly kind: "not-wired";
55
+ };
56
+ /**
57
+ * The bibliography the build recorded for the paper in `dir`: the databases bibtex opened, read by
58
+ * the bibtex reader. Only a fresh record answers (`paperRecord`).
59
+ */
60
+ export declare function readBibliography(dir: string, deps: BibliographyDeps): BibliographyRead;
61
+ /** A paper's bibliography by its directory — what the build's steps are handed by the composition root. */
62
+ export type ReadBibliography = (dir: string) => BibliographyRead;
63
+ /** `readBibliography` over `deps`, as a `ReadBibliography`. */
64
+ export declare const bibliographyReader: (deps: BibliographyDeps) => ReadBibliography;
65
+ /** No reader: the build was not given one. Never "no bibliography" — it says so. */
66
+ export declare const notWiredBibliography: ReadBibliography;
67
+ /**
68
+ * The keys bibtex typeset that no entry the reader read has — an entry behind `%` or inside
69
+ * `@comment{…}`, which bibtex reads and the reader does not. In the order bibtex typeset them, each
70
+ * once. bibtex's keys are case-insensitive (`\cite{SMITH}` typesets `\bibitem{SMITH}` from an entry
71
+ * `smith`, measured), so they are compared so.
72
+ */
73
+ export declare function unseenKeys(b: CheckedBibliography): readonly string[];
74
+ /** The bytes of the databases checked, in order: what a later lint compares to see the verdicts are current. */
75
+ export declare const bibHash: (b: CheckedBibliography) => string;
21
76
  /** What `_build/references.json` holds. */
22
77
  export interface ReferencesDocument {
23
78
  readonly schema: number;
24
79
  readonly bib: {
25
- readonly source: string;
80
+ readonly sources: readonly string[];
26
81
  readonly sha256: string;
27
82
  };
28
83
  readonly status: "checked" | "not-checked";
29
84
  readonly why?: string;
30
85
  readonly entries: readonly EntryVerdict[];
31
86
  }
32
- export declare const documentOf: (bib: Bibliography, check: ReferencesCheck) => ReferencesDocument;
87
+ export declare const documentOf: (bib: CheckedBibliography, check: ReferencesCheck) => ReferencesDocument;
33
88
  /** The recorded verdicts, or null when there are none or they do not parse. */
34
89
  export declare function readReferences(files: Files, paperDir: string): ReferencesDocument | null;
35
90
  /** The paper's lookup cache: empty when there is none, or why the file on disk cannot be read. */
36
91
  export declare function readLookupCache(files: Files, paperDir: string): Result<LookupCache, string>;
37
92
  /**
38
- * The build step's work: check the bibliography, serving what it can from the paper's lookup
39
- * cache, and record the verdicts. Returns the one-line note the build prints. A checker that
40
- * throws, or a cache that does not parse, is recorded as `not-checked` — the step reports, it
41
- * never refuses. A cache that does not parse is left as it is, and named.
93
+ * The build step's work: check the bibliography the build recorded, serving what it can from the
94
+ * paper's lookup cache, and record the verdicts. Returns the one-line note the build prints. A
95
+ * checker that throws, or a cache that does not parse, is recorded as `not-checked` — the step
96
+ * reports, it never refuses. A cache that does not parse is left as it is, and named.
42
97
  */
43
- export declare function recordReferences(files: Files, paperDir: string, check: CheckReferences): Promise<string>;
98
+ export declare function recordReferences(files: Files, paperDir: string, read: BibliographyRead, check: CheckReferences): Promise<string>;
44
99
  //# sourceMappingURL=references.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAM,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EAEhB,MAAM,6BAA6B,CAAC;AAIrC,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,mGAAmG;AACnG,eAAO,M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