paperlint 3.1.3 → 3.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 (371) hide show
  1. package/.github/workflows/ci.yml +12 -7
  2. package/CLAUDE.md +3 -3
  3. package/CONTRIBUTING.md +34 -5
  4. package/dist/adapters/banal/index.d.ts.map +1 -1
  5. package/dist/adapters/banal/index.js +9 -5
  6. package/dist/adapters/banal/index.js.map +1 -1
  7. package/dist/adapters/banal/invocation.d.ts +1 -1
  8. package/dist/adapters/node/files.io.d.ts.map +1 -1
  9. package/dist/adapters/node/files.io.js +2 -1
  10. package/dist/adapters/node/files.io.js.map +1 -1
  11. package/dist/adapters/node/process.io.d.ts +0 -5
  12. package/dist/adapters/node/process.io.d.ts.map +1 -1
  13. package/dist/adapters/node/process.io.js +4 -3
  14. package/dist/adapters/node/process.io.js.map +1 -1
  15. package/dist/adapters/pdfjs/fill.d.ts.map +1 -1
  16. package/dist/adapters/pdfjs/fill.js +13 -7
  17. package/dist/adapters/pdfjs/fill.js.map +1 -1
  18. package/dist/adapters/references/index.d.ts.map +1 -1
  19. package/dist/adapters/references/index.js +4 -5
  20. package/dist/adapters/references/index.js.map +1 -1
  21. package/dist/adapters/references/pool.d.ts.map +1 -1
  22. package/dist/adapters/references/pool.js +4 -5
  23. package/dist/adapters/references/pool.js.map +1 -1
  24. package/dist/adapters/references/reach.io.d.ts.map +1 -1
  25. package/dist/adapters/references/reach.io.js +2 -1
  26. package/dist/adapters/references/reach.io.js.map +1 -1
  27. package/dist/build-engine.js +2 -2
  28. package/dist/build-engine.js.map +1 -1
  29. package/dist/build.d.ts.map +1 -1
  30. package/dist/build.js +14 -11
  31. package/dist/build.js.map +1 -1
  32. package/dist/cli.d.ts.map +1 -1
  33. package/dist/cli.js +31 -34
  34. package/dist/cli.js.map +1 -1
  35. package/dist/doctor.d.ts.map +1 -1
  36. package/dist/doctor.js +3 -2
  37. package/dist/doctor.js.map +1 -1
  38. package/dist/domain/lookup-cache.d.ts.map +1 -1
  39. package/dist/domain/lookup-cache.js +10 -8
  40. package/dist/domain/lookup-cache.js.map +1 -1
  41. package/dist/domain/text.d.ts +12 -0
  42. package/dist/domain/text.d.ts.map +1 -1
  43. package/dist/domain/text.js +17 -0
  44. package/dist/domain/text.js.map +1 -1
  45. package/dist/engine.d.ts.map +1 -1
  46. package/dist/engine.js +4 -3
  47. package/dist/engine.js.map +1 -1
  48. package/dist/eslint-rules/bib-reachable-entry.d.ts +22 -0
  49. package/dist/eslint-rules/bib-reachable-entry.d.ts.map +1 -0
  50. package/dist/eslint-rules/bib-reachable-entry.js +75 -0
  51. package/dist/eslint-rules/bib-reachable-entry.js.map +1 -0
  52. package/dist/eslint-rules/install-path-literals.d.ts +80 -0
  53. package/dist/eslint-rules/install-path-literals.d.ts.map +1 -0
  54. package/dist/eslint-rules/install-path-literals.js +105 -0
  55. package/dist/eslint-rules/install-path-literals.js.map +1 -0
  56. package/dist/eslint-rules/latex-language.d.ts +136 -0
  57. package/dist/eslint-rules/latex-language.d.ts.map +1 -0
  58. package/dist/eslint-rules/latex-language.js +639 -0
  59. package/dist/eslint-rules/latex-language.js.map +1 -0
  60. package/dist/eslint-rules/paper-research-question.d.ts +31 -0
  61. package/dist/eslint-rules/paper-research-question.d.ts.map +1 -0
  62. package/dist/eslint-rules/paper-research-question.js +188 -0
  63. package/dist/eslint-rules/paper-research-question.js.map +1 -0
  64. package/dist/eslint-rules/paper-stages.d.ts +83 -0
  65. package/dist/eslint-rules/paper-stages.d.ts.map +1 -0
  66. package/dist/eslint-rules/paper-stages.js +358 -0
  67. package/dist/eslint-rules/paper-stages.js.map +1 -0
  68. package/dist/eslint-rules/paper-typography.d.ts +74 -0
  69. package/dist/eslint-rules/paper-typography.d.ts.map +1 -0
  70. package/dist/eslint-rules/paper-typography.js +404 -0
  71. package/dist/eslint-rules/paper-typography.js.map +1 -0
  72. package/dist/eslint-rules/papers.d.ts +42 -0
  73. package/dist/eslint-rules/papers.d.ts.map +1 -0
  74. package/dist/eslint-rules/papers.js +145 -0
  75. package/dist/eslint-rules/papers.js.map +1 -0
  76. package/dist/eslint-rules/pdf-last-page-balance.d.ts +72 -0
  77. package/dist/eslint-rules/pdf-last-page-balance.d.ts.map +1 -0
  78. package/dist/eslint-rules/pdf-last-page-balance.js +237 -0
  79. package/dist/eslint-rules/pdf-last-page-balance.js.map +1 -0
  80. package/dist/eslint-rules/review-frontmatter.d.ts +57 -0
  81. package/dist/eslint-rules/review-frontmatter.d.ts.map +1 -0
  82. package/dist/eslint-rules/review-frontmatter.js +126 -0
  83. package/dist/eslint-rules/review-frontmatter.js.map +1 -0
  84. package/dist/eslint-rules/review-frontmatter.schema.json +36 -0
  85. package/dist/eslint-rules/rule-context.d.ts +55 -0
  86. package/dist/eslint-rules/rule-context.d.ts.map +1 -0
  87. package/dist/eslint-rules/rule-context.js +9 -0
  88. package/dist/eslint-rules/rule-context.js.map +1 -0
  89. package/dist/eslint-rules/sibling-frontmatter.d.ts +25 -0
  90. package/dist/eslint-rules/sibling-frontmatter.d.ts.map +1 -0
  91. package/dist/eslint-rules/sibling-frontmatter.js +16 -0
  92. package/dist/eslint-rules/sibling-frontmatter.js.map +1 -0
  93. package/dist/eslint-rules/sibling-frontmatter.schema.json +14 -0
  94. package/dist/eslint-rules/temp-root-realpath.d.ts +71 -0
  95. package/dist/eslint-rules/temp-root-realpath.d.ts.map +1 -0
  96. package/dist/eslint-rules/temp-root-realpath.js +139 -0
  97. package/dist/eslint-rules/temp-root-realpath.js.map +1 -0
  98. package/dist/eslint-rules/tex-build.d.ts +35 -0
  99. package/dist/eslint-rules/tex-build.d.ts.map +1 -0
  100. package/dist/eslint-rules/tex-build.js +313 -0
  101. package/dist/eslint-rules/tex-build.js.map +1 -0
  102. package/dist/facts-file.d.ts.map +1 -1
  103. package/dist/facts-file.js +2 -1
  104. package/dist/facts-file.js.map +1 -1
  105. package/dist/hooks-settings.d.ts +1 -1
  106. package/dist/hooks-settings.d.ts.map +1 -1
  107. package/dist/hooks-settings.js +14 -9
  108. package/dist/hooks-settings.js.map +1 -1
  109. package/dist/init.d.ts +5 -5
  110. package/dist/init.d.ts.map +1 -1
  111. package/dist/init.js +15 -7
  112. package/dist/init.js.map +1 -1
  113. package/dist/latex-loop.d.ts +2 -2
  114. package/dist/latex-loop.d.ts.map +1 -1
  115. package/dist/latex-loop.js +2 -2
  116. package/dist/latex-loop.js.map +1 -1
  117. package/dist/lib/agent-cli-version.d.ts +65 -0
  118. package/dist/lib/agent-cli-version.d.ts.map +1 -0
  119. package/dist/lib/agent-cli-version.js +77 -0
  120. package/dist/lib/agent-cli-version.js.map +1 -0
  121. package/dist/lib/check.d.ts +19 -0
  122. package/dist/lib/check.d.ts.map +1 -0
  123. package/dist/lib/check.js +52 -0
  124. package/dist/lib/check.js.map +1 -0
  125. package/dist/lib/markdown.d.ts +180 -0
  126. package/dist/lib/markdown.d.ts.map +1 -0
  127. package/dist/lib/markdown.js +302 -0
  128. package/dist/lib/markdown.js.map +1 -0
  129. package/dist/lib/paper-config.d.ts +84 -0
  130. package/dist/lib/paper-config.d.ts.map +1 -0
  131. package/dist/lib/paper-config.js +142 -0
  132. package/dist/lib/paper-config.js.map +1 -0
  133. package/dist/lib/skill-eval-fixture.d.ts +29 -0
  134. package/dist/lib/skill-eval-fixture.d.ts.map +1 -0
  135. package/dist/lib/skill-eval-fixture.js +62 -0
  136. package/dist/lib/skill-eval-fixture.js.map +1 -0
  137. package/dist/link-skills.d.ts.map +1 -1
  138. package/dist/link-skills.js +5 -4
  139. package/dist/link-skills.js.map +1 -1
  140. package/dist/new-paper.d.ts.map +1 -1
  141. package/dist/new-paper.js +2 -2
  142. package/dist/new-paper.js.map +1 -1
  143. package/dist/paper-settings.d.ts.map +1 -1
  144. package/dist/paper-settings.js +5 -4
  145. package/dist/paper-settings.js.map +1 -1
  146. package/dist/pdf-facts.d.ts.map +1 -1
  147. package/dist/pdf-facts.js +2 -1
  148. package/dist/pdf-facts.js.map +1 -1
  149. package/dist/pdf-geometry.d.ts.map +1 -1
  150. package/dist/pdf-geometry.js +1 -1
  151. package/dist/pdf-geometry.js.map +1 -1
  152. package/dist/presets.d.ts.map +1 -1
  153. package/dist/presets.js +3 -2
  154. package/dist/presets.js.map +1 -1
  155. package/dist/references.d.ts.map +1 -1
  156. package/dist/references.js +11 -6
  157. package/dist/references.js.map +1 -1
  158. package/dist/rules-config.d.ts.map +1 -1
  159. package/dist/rules-config.js +6 -3
  160. package/dist/rules-config.js.map +1 -1
  161. package/dist/structure.js +1 -1
  162. package/dist/structure.js.map +1 -1
  163. package/dist/tex-requirements.d.ts.map +1 -1
  164. package/dist/tex-requirements.js +8 -3
  165. package/dist/tex-requirements.js.map +1 -1
  166. package/dist/toolchain.d.ts.map +1 -1
  167. package/dist/toolchain.js +21 -16
  168. package/dist/toolchain.js.map +1 -1
  169. package/dist/venue-rules.js +1 -1
  170. package/dist/venue-rules.js.map +1 -1
  171. package/docs/e2e.md +7 -7
  172. package/docs/install.md +1 -1
  173. package/docs/prior-art/README.md +1 -1
  174. package/docs/prior-art/package-location.md +5 -5
  175. package/docs/prior-art/repro/README.md +1 -1
  176. package/docs/prior-art/test-tooling.md +2 -2
  177. package/docs/testing.md +11 -8
  178. package/docs/toolchain.md +1 -1
  179. package/eslint-rules/{bib-reachable-entry.mjs → bib-reachable-entry.ts} +4 -3
  180. package/eslint-rules/install-path-literals.harness.mjs +1 -1
  181. package/eslint-rules/{install-path-literals.mjs → install-path-literals.ts} +16 -8
  182. package/eslint-rules/latex-language.harness.mjs +2 -2
  183. package/eslint-rules/latex-language.test.mjs +7 -1
  184. package/eslint-rules/{latex-language.mjs → latex-language.ts} +297 -109
  185. package/eslint-rules/paper-research-question.harness.mjs +3 -3
  186. package/eslint-rules/{paper-research-question.mjs → paper-research-question.ts} +34 -15
  187. package/eslint-rules/paper-stages.harness.mjs +2 -2
  188. package/eslint-rules/paper-stages.test.mjs +8 -2
  189. package/eslint-rules/{paper-stages.mjs → paper-stages.ts} +74 -29
  190. package/eslint-rules/paper-typography.test.mjs +3 -3
  191. package/eslint-rules/{paper-typography.mjs → paper-typography.ts} +132 -54
  192. package/eslint-rules/papers.harness.mjs +2 -2
  193. package/eslint-rules/{papers.mjs → papers.ts} +7 -4
  194. package/eslint-rules/pdf-last-page-balance.harness.mjs +3 -3
  195. package/eslint-rules/{pdf-last-page-balance.mjs → pdf-last-page-balance.ts} +88 -31
  196. package/eslint-rules/review-frontmatter.test.mjs +2 -2
  197. package/eslint-rules/{review-frontmatter.mjs → review-frontmatter.ts} +37 -15
  198. package/eslint-rules/rule-context.ts +62 -0
  199. package/eslint-rules/{sibling-frontmatter.mjs → sibling-frontmatter.ts} +1 -1
  200. package/eslint-rules/temp-root-realpath.harness.mjs +1 -1
  201. package/eslint-rules/{temp-root-realpath.mjs → temp-root-realpath.ts} +19 -6
  202. package/eslint-rules/tex-build.harness.mjs +2 -2
  203. package/eslint-rules/{tex-build.mjs → tex-build.ts} +4 -3
  204. package/eslint.config.mjs +139 -30
  205. package/fixtures/pdf-facts/README.md +2 -2
  206. package/fixtures/real-markdown-paper/{baseline.mjs → baseline.ts} +31 -10
  207. package/hooks/{hooks.harness.mjs → hooks.harness.ts} +51 -34
  208. package/hooks/paper-edit-guard.hook.mjs +1 -1
  209. package/hooks/{paper-edit-guard.test.mjs → paper-edit-guard.test.ts} +3 -7
  210. package/hooks/paper-skills-nudge.hook.mjs +1 -1
  211. package/hooks/{paper-skills-nudge.test.mjs → paper-skills-nudge.test.ts} +2 -6
  212. package/hooks/{paper-status-gates.test.mjs → paper-status-gates.test.ts} +2 -6
  213. package/lib/agent-cli-version.harness.mjs +1 -1
  214. package/lib/{agent-cli-version.mjs → agent-cli-version.ts} +32 -18
  215. package/lib/check.test.ts +14 -9
  216. package/lib/{check.mjs → check.ts} +22 -9
  217. package/lib/markdown.test.mjs +7 -7
  218. package/lib/{markdown.mjs → markdown.ts} +68 -29
  219. package/lib/paper-config.harness.mjs +8 -8
  220. package/lib/{paper-config.mjs → paper-config.ts} +19 -14
  221. package/lib/skill-checks.mjs +1 -1
  222. package/lib/skill-checks.test.mjs +1 -1
  223. package/lib/skill-corpus.mjs +1 -1
  224. package/lib/skill-eval-kit.mjs +1 -1
  225. package/package.json +42 -10
  226. package/scripts/{check.harness.mjs → check.harness.ts} +111 -10
  227. package/scripts/{check.test.mjs → check.test.ts} +13 -10
  228. package/scripts/{check.mjs → check.ts} +116 -42
  229. package/scripts/coverage-config.test.ts +80 -37
  230. package/scripts/eslint-report-guard.test.mjs +1 -1
  231. package/scripts/harness-api.frozen.json +14 -15
  232. package/scripts/harness-api.test.ts +8 -5
  233. package/scripts/layer-legacy-frozen.test.ts +17 -13
  234. package/scripts/{layer-legacy-frozen.mjs → layer-legacy-frozen.ts} +128 -39
  235. package/scripts/release-config.test.ts +12 -4
  236. package/scripts/rules-see-files.test.mjs +1 -1
  237. package/scripts/test.test.ts +78 -0
  238. package/scripts/test.ts +87 -0
  239. package/skills/grade-paper-writing/prose-lint.mjs +1 -1
  240. package/skills/grade-paper-writing/{prose-lint.test.mjs → prose-lint.test.ts} +2 -2
  241. package/skills/paper-pipeline/description-language.eval.mjs +1 -1
  242. package/skills/paper-pipeline/framing-vs-vocabulary.eval.mjs +1 -1
  243. package/skills/paper-pipeline/grade-paper-writing-ablation.eval.mjs +1 -1
  244. package/skills/paper-pipeline/pipeline-firing.eval.mjs +1 -1
  245. package/skills/paper-pipeline/pipeline-language.eval.mjs +1 -1
  246. package/skills/paper-pipeline/scripts/README.md +1 -1
  247. package/skills/paper-pipeline/scripts/announce.test.mjs +1 -1
  248. package/skills/paper-pipeline/scripts/artifact-coverage.mjs +1 -1
  249. package/skills/paper-pipeline/scripts/{artifact-coverage.test.mjs → artifact-coverage.test.ts} +2 -2
  250. package/skills/paper-pipeline/scripts/consumer.mjs +1 -5
  251. package/skills/paper-pipeline/scripts/consumer.test.mjs +1 -1
  252. package/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs +1 -1
  253. package/skills/paper-pipeline/scripts/extract-ref-facts.mjs +1 -4
  254. package/skills/paper-pipeline/scripts/extract-ref-facts.test.mjs +1 -1
  255. package/skills/paper-pipeline/scripts/fixtures/{scorecard.mjs → scorecard.ts} +36 -7
  256. package/skills/paper-pipeline/scripts/{generated-code.test.mjs → generated-code.test.ts} +3 -3
  257. package/skills/paper-pipeline/scripts/ledger.cli.test.mjs +1 -1
  258. package/skills/paper-pipeline/scripts/pipeline-check.cli.test.mjs +2 -2
  259. package/skills/paper-pipeline/scripts/pipeline-check.harness.mjs +2 -2
  260. package/skills/paper-pipeline/scripts/pipeline-check.mjs +1 -4
  261. package/skills/paper-pipeline/scripts/population-map.mjs +1 -4
  262. package/skills/paper-pipeline/scripts/population-map.test.mjs +1 -1
  263. package/skills/paper-pipeline/scripts/{round-diff.harness.mjs → round-diff.harness.ts} +45 -18
  264. package/skills/paper-pipeline/scripts/round-diff.mjs +1 -1
  265. package/skills/paper-pipeline/scripts/round-diff.test.mjs +1 -1
  266. package/skills/paper-pipeline/scripts/run-mechanical.test.mjs +1 -1
  267. package/skills/paper-pipeline/scripts/status.test.mjs +1 -1
  268. package/skills/plan-paper-timeline/fixtures/{fake-google-calendar.mjs → fake-google-calendar.ts} +101 -70
  269. package/skills/plan-paper-timeline/plan-paper-timeline.effects.harness.mjs +3 -3
  270. package/skills/render-paper/{extract-pdf-facts.harness.mjs → extract-pdf-facts.harness.ts} +34 -9
  271. package/skills/render-paper/render-paper.harness.mjs +2 -2
  272. package/skills/tighten-paper/structure.mjs +1 -1
  273. package/skills/tighten-paper/{structure.test.mjs → structure.test.ts} +4 -3
  274. package/skills/verify-citations/scripts/{bib-authors.cli.test.mjs → bib-authors.cli.test.ts} +14 -4
  275. package/skills/verify-citations/scripts/bib-authors.d.mts +63 -0
  276. package/skills/verify-citations/scripts/bib-authors.mjs +1 -4
  277. package/skills/verify-citations/scripts/{verify-cites.cli.test.mjs → verify-cites.cli.test.ts} +32 -9
  278. package/skills/verify-citations/scripts/verify-cites.d.mts +58 -0
  279. package/src/CLAUDE.md +1 -1
  280. package/src/adapters/banal/index.test.ts +3 -6
  281. package/src/adapters/banal/index.ts +7 -4
  282. package/src/adapters/banal/invocation.test.ts +3 -1
  283. package/src/adapters/banal/invocation.ts +1 -1
  284. package/src/adapters/banal/output.test.ts +1 -1
  285. package/src/adapters/banal/run.test.ts +3 -3
  286. package/src/adapters/banal/xml.test.ts +1 -1
  287. package/src/adapters/curl/download.test.ts +4 -2
  288. package/src/adapters/node/files.io.ts +2 -2
  289. package/src/adapters/node/files.test.ts +3 -1
  290. package/src/adapters/node/process.io.ts +4 -3
  291. package/src/adapters/node/process.test.ts +1 -1
  292. package/src/adapters/node/workspace.test.ts +3 -1
  293. package/src/adapters/pdfjs/fill.test.ts +2 -2
  294. package/src/adapters/pdfjs/fill.ts +14 -7
  295. package/src/adapters/references/index.test.ts +31 -38
  296. package/src/adapters/references/index.ts +26 -58
  297. package/src/adapters/references/pool.ts +3 -5
  298. package/src/adapters/references/reach.io.ts +2 -1
  299. package/src/build-engine.harness.mjs +1 -1
  300. package/src/build-engine.test.ts +2 -2
  301. package/src/build-engine.ts +2 -2
  302. package/src/build.harness.mjs +2 -2
  303. package/src/build.test.ts +15 -14
  304. package/src/build.ts +28 -19
  305. package/src/cli.harness.mjs +6 -6
  306. package/src/cli.test.ts +13 -6
  307. package/src/cli.ts +39 -37
  308. package/src/doctor.harness.mjs +3 -3
  309. package/src/doctor.ts +3 -2
  310. package/src/domain/lookup-cache.ts +21 -11
  311. package/src/domain/result.test.ts +2 -2
  312. package/src/domain/text.test.ts +32 -0
  313. package/src/domain/text.ts +23 -0
  314. package/src/engine.harness.mjs +2 -2
  315. package/src/engine.ts +4 -3
  316. package/src/facts-file.test.ts +9 -7
  317. package/src/facts-file.ts +2 -1
  318. package/src/{hooks-settings.harness.mjs → hooks-settings.harness.ts} +39 -20
  319. package/src/hooks-settings.ts +20 -9
  320. package/src/init.test.ts +12 -9
  321. package/src/init.ts +22 -12
  322. package/src/{latex-log.harness.mjs → latex-log.harness.ts} +14 -14
  323. package/src/{latex-loop.harness.mjs → latex-loop.harness.ts} +64 -36
  324. package/src/latex-loop.ts +3 -3
  325. package/src/{link-skills.harness.mjs → link-skills.harness.ts} +19 -19
  326. package/src/link-skills.test.ts +3 -3
  327. package/src/link-skills.ts +5 -4
  328. package/src/lint-fix.test.ts +4 -6
  329. package/src/linted-set.test.ts +2 -2
  330. package/src/new-paper.harness.mjs +2 -2
  331. package/src/new-paper.test.ts +8 -10
  332. package/src/new-paper.ts +2 -2
  333. package/src/paper-files.test.ts +3 -5
  334. package/src/paper-settings-commands.test.ts +5 -4
  335. package/src/paper-settings.test.ts +5 -5
  336. package/src/paper-settings.ts +8 -9
  337. package/src/{pdf-facts.harness.mjs → pdf-facts.harness.ts} +9 -8
  338. package/src/pdf-facts.test.ts +10 -11
  339. package/src/pdf-facts.ts +2 -1
  340. package/src/{pdf-geometry.harness.mjs → pdf-geometry.harness.ts} +19 -12
  341. package/src/pdf-geometry.ts +3 -1
  342. package/src/presets.ts +3 -2
  343. package/src/references.test.ts +51 -43
  344. package/src/references.ts +14 -7
  345. package/src/{rules-config.harness.mjs → rules-config.harness.ts} +7 -13
  346. package/src/rules-config.ts +7 -4
  347. package/src/rules-off.test.ts +6 -4
  348. package/src/{structure.harness.mjs → structure.harness.ts} +26 -15
  349. package/src/structure.ts +1 -1
  350. package/src/{tex-requirements.harness.mjs → tex-requirements.harness.ts} +50 -22
  351. package/src/tex-requirements.ts +8 -5
  352. package/src/toolchain.harness.mjs +2 -2
  353. package/src/toolchain.test.ts +1 -1
  354. package/src/toolchain.ts +31 -17
  355. package/src/venue-rules.test.ts +62 -64
  356. package/src/venue-rules.ts +1 -1
  357. package/tsconfig.json +6 -3
  358. package/tsconfig.pkg.json +10 -0
  359. package/lib/check.d.mts +0 -17
  360. package/lib/paper-config.d.mts +0 -31
  361. package/scripts/layer-legacy-frozen.d.mts +0 -36
  362. package/scripts/rules-are-content-only.harness.mjs +0 -105
  363. package/scripts/rules-are-content-only.mjs +0 -148
  364. package/scripts/rules-are-content-only.test.mjs +0 -61
  365. package/scripts/test.mjs +0 -44
  366. package/scripts/test.test.mjs +0 -52
  367. /package/bin/{paperlint.test.mjs → paperlint.test.ts} +0 -0
  368. /package/lib/{skill-eval-fixture.mjs → skill-eval-fixture.ts} +0 -0
  369. /package/skills/grade-paper-writing/__snapshots__/{prose-lint.test.mjs.snap → prose-lint.test.ts.snap} +0 -0
  370. /package/skills/osf-artifact-upload/{osf-artifact-upload.harness.mjs → osf-artifact-upload.harness.ts} +0 -0
  371. /package/skills/tighten-paper/__snapshots__/{structure.test.mjs.snap → structure.test.ts.snap} +0 -0
@@ -0,0 +1,404 @@
1
+ /**
2
+ * Three mechanical conventions a reviewer already raised, ONE RULE EACH, reported where each
3
+ * occurrence is and fixed by `paperlint lint --fix`:
4
+ *
5
+ * paper/section-word `§5`, `\S\ref{…}` → `Section 5`, `Section~\ref{…}`
6
+ * paper/leading-zero `.05` → `0.05`
7
+ * paper/figure-ref-style `Fig.~\ref` beside `Figure~\ref` in one document → the majority form
8
+ *
9
+ * The fourth check of the old `paper/typography`, an unreachable bibliography entry, is
10
+ * `bib/reachable-entry` (bib-reachable-entry.mjs): it is about the bibliography, not the prose,
11
+ * and it has no fix.
12
+ *
13
+ * ── PROVENANCE: every one is a real review finding, not an invented style ───────────────
14
+ * From HotCRP #20 (2026-08-23). Reviewer B listed two as literal to-dos:
15
+ * B#11 "§ -> Section" one paper in the source corpus carried 246
16
+ * B#12 ".05 -> 0.05" four in the submitted text, fixed by hand
17
+ * (own) `Fig.` and `Figure` side by side
18
+ *
19
+ * ── WHY THERE IS NO DEBT OPTION ANY MORE (3.0.0) ──────────────────────────────────────────
20
+ * Until 3.0.0 this was ONE rule, `paper/typography`, that counted all four per paper against a
21
+ * declared `debt` and spoke only when a count grew. A ratchet was needed because the rule could
22
+ * only COUNT: 246 section signs meant 246 edits by hand, so the only way to turn it on was to
23
+ * freeze the backlog. Every check here now has a FIX, so the backlog costs one command
24
+ * (`paperlint lint --fix`), and the ratchet — per-paper numbers in the project config, keyed by
25
+ * a path — has nothing left to protect. A deliberate exception is an ESLint disable directive on
26
+ * the line (`% eslint-disable-next-line paper/section-word -- reason`), the standard escape
27
+ * hatch every ESLint user already knows, not a counter.
28
+ *
29
+ * ── WHY section-word AND figure-ref-style READ `sourceCode.raw` ───────────────────────────
30
+ * They are about MARKUP. The prose projection of the LaTeX language blanks macros — that is its
31
+ * purpose — so `\S\ref{}` and `Fig.~\ref{}` reach a normal rule as spaces. Offsets coincide
32
+ * between the two (blanking preserves length), so scanning `raw` and reporting the offset found
33
+ * there points at the right byte. Comments and the inline bibliography are skipped.
34
+ *
35
+ * 🔴 BOTH forms of the section sign, and the second one is why this check was ever wrong. The
36
+ * first version counted only the literal `§` and returned ZERO on the very paper whose reviewer
37
+ * raised it: the source writes `\S\ref{sec:threats}`, which RENDERS as `§5`.
38
+ *
39
+ * ── WHY leading-zero READS THE PARSED TREE (paperlint#44) ──────────────────────────────────
40
+ * ISO 80000-1 ("the decimal sign shall be preceded by a zero" for magnitudes below 1) and the
41
+ * IEEE Editorial Style Manual ("0.25, not .25") require the zero. A regex over the raw source
42
+ * found 22 decimals on a real corpus and none was a defect: every one sat in markup (an option,
43
+ * a column spec, a comment, a listing, a tikz coordinate). So this walks the TREE and keeps only
44
+ * what the reader sees as a number:
45
+ * LaTeX prose, inline and display math, table cells, and the text arguments of a known
46
+ * set of text macros. Not: any other macro's arguments, environment arguments,
47
+ * comments, verbatim/listings/`\lstinline`, tikz, the preamble, the bibliography.
48
+ * Markdown text nodes, table cells included. Not: code, inline code, html, front matter.
49
+ * Each character of a run keeps its source offset, so the finding points at the dot and the fix
50
+ * inserts the zero there. The arXiv lookbehind stays: in `2310.05736` the dot follows a digit.
51
+ * A text macro outside the known set (`\hl{.05}`) is read as a parameter and NOT reported — a
52
+ * miss costs less than a finding on markup.
53
+ *
54
+ * 🔴 A NUMBER AFTER `¶` OR `§` IS A DESIGNATOR, NOT A DECIMAL (#102). An auditing standard is cited
55
+ * by paragraph as `¶¶.42`, and `--fix` rewrote it to `¶¶0.42` — a fix that changed a reference.
56
+ * So a lexeme right after the sign (`¶`, `§`, `\P`, `\S`, spaces or `~` between) is silent. The
57
+ * same sentence then goes on `and .44`: a paragraph number continuing the list, or a decimal —
58
+ * the text does not say which. In a paragraph that already cites `¶.nn` this way, a bare decimal
59
+ * is REPORTED WITHOUT A FIX and the zero is offered as a suggestion: an autofix must never be the
60
+ * one to decide what a number means. A real `.05` in any other paragraph is fixed as before.
61
+ */
62
+ import assert from "node:assert/strict";
63
+ import { getParser } from "@unified-latex/unified-latex-util-parse";
64
+ /** The inline bibliography — a `filecontents` block writing a `.bib` — with its offsets. */
65
+ export function bibRange(text) {
66
+ const m = /\\begin\{filecontents\*?\}(?:\[[^\]]*\])?\{[^}]*\.bib\}\r?\n([\s\S]*?)\\end\{filecontents\*?\}/d.exec(text);
67
+ if (!m)
68
+ return null;
69
+ const [whole, body] = m;
70
+ const bodyStart = m.indices?.[1]?.[0];
71
+ // The `d` flag records every group's indices, and group 1 is not optional.
72
+ assert.ok(body !== undefined && bodyStart !== undefined, "no .bib body");
73
+ return { start: m.index, end: m.index + whole.length, bodyStart, body };
74
+ }
75
+ /**
76
+ * The ranges a markup rule must not read: LaTeX comments (the language gives them as `html`
77
+ * nodes, with positions) and the inline bibliography.
78
+ */
79
+ function skippedRanges(sourceCode, raw) {
80
+ const out = [];
81
+ for (const n of sourceCode.ast?.children ?? [])
82
+ if (n.type === "html" && n.position) {
83
+ // An offset-less point compares as NaN: inside no range, as `undefined` always did.
84
+ const { start: { offset: s = Number.NaN }, end: { offset: e = Number.NaN }, } = n.position;
85
+ out.push([s, e]);
86
+ }
87
+ const bib = bibRange(raw);
88
+ if (bib)
89
+ out.push([bib.start, bib.end]);
90
+ return out;
91
+ }
92
+ const inside = (ranges, i) => ranges.some(([s, e]) => i >= s && i < e);
93
+ /** Every match of `re` in `raw` outside the skipped ranges. */
94
+ function markupMatches(sourceCode, re) {
95
+ const raw = sourceCode.raw;
96
+ const skip = skippedRanges(sourceCode, raw);
97
+ return [...raw.matchAll(re)].filter((m) => !inside(skip, m.index));
98
+ }
99
+ const isTex = (sourceCode) => typeof sourceCode.raw === "string";
100
+ // ── the text a READER sees, with the source offset of every character ─────────────────────
101
+ /** A run of visible text; `offs[i]` is the source offset of `text[i]`, or null when unknown. */
102
+ const run = () => ({ text: "", offs: [] });
103
+ // Environments whose body is not typeset as text: code, drawings, the inline bibliography.
104
+ const TEX_HIDDEN_ENV = /^(verbatim|Verbatim|lstlisting|minted|tikzpicture|filecontents\*?|comment)$/;
105
+ // Text macros whose mandatory argument IS prose. Every other macro's arguments are parameters.
106
+ const TEX_PROSE_ARG = /^(emph|textbf|textit|textsl|textsc|textup|textmd|textrm|textsf|textnormal|underline|text|mbox|caption|footnote|footnotetext|thanks|title|textsuperscript|textsubscript|part|chapter|section|subsection|subsubsection|paragraph|subparagraph)$/;
107
+ // Macros whose LAST mandatory argument is what the reader sees.
108
+ const TEX_LAST_ARG = /^(multicolumn|multirow|textcolor|href)$/;
109
+ // In math every macro argument is typeset except these.
110
+ const TEX_MATH_HIDDEN = /^(label|ref|eqref|autoref|cite|hspace|vspace|hskip|vskip|kern|mkern|mskip|rule|phantom|hphantom|vphantom|color|raisebox|includegraphics)$/;
111
+ const mandatory = (macro) => (macro.args || []).filter((a) => a.openMark === "{");
112
+ /**
113
+ * unified-latex attaches arguments only to what it has a signature for. For the rest the
114
+ * arguments come back as the NEXT SIBLINGS: an optional `[…]` as bare strings, then groups.
115
+ * They are parameters, not prose. Returns the index of the last sibling to skip after `i`.
116
+ */
117
+ /** Whether `n` is a string node whose text passes `test`. */
118
+ const isString = (n, test) => n?.type === "string" && test(n.content);
119
+ function unparsedArgsEnd(nodes, i) {
120
+ let j = i + 1;
121
+ if (isString(nodes[j], (c) => c.startsWith("["))) {
122
+ let k = j;
123
+ while (k < nodes.length && !isString(nodes[k], (c) => c.endsWith("]")))
124
+ k++;
125
+ if (k < nodes.length)
126
+ j = k + 1;
127
+ }
128
+ while (nodes[j]?.type === "group")
129
+ j++;
130
+ return j - 1;
131
+ }
132
+ /** Append a string node to the current run, keeping each character's offset. */
133
+ function appendString(cur, n, src) {
134
+ const start = n.position?.start?.offset;
135
+ const exact = typeof start === "number" &&
136
+ src.slice(start, start + n.content.length) === n.content
137
+ ? start
138
+ : null;
139
+ for (let i = 0; i < n.content.length; i++)
140
+ cur.offs.push(exact === null ? null : exact + i);
141
+ cur.text += n.content;
142
+ }
143
+ /**
144
+ * Collect runs of visible text from a unified-latex node list. A run is a stretch of sibling
145
+ * `string` nodes with nothing between them: math splits `.05` into `.`, `0`, `5`, and prose
146
+ * keeps `2310.05736` whole — both come back as one word. Anything else ends the run.
147
+ */
148
+ /** What stands in for an index past the end: a node every branch below passes over. */
149
+ const NOTHING = { type: "whitespace" };
150
+ function texRuns(nodes, math, src, out) {
151
+ let cur = run();
152
+ const flush = () => {
153
+ if (cur.text)
154
+ out.push(cur);
155
+ cur = run();
156
+ };
157
+ const list = nodes || [];
158
+ for (let i = 0; i < list.length; i++) {
159
+ const { [i]: n = NOTHING } = list;
160
+ if (n.type === "string") {
161
+ appendString(cur, n, src);
162
+ continue;
163
+ }
164
+ flush();
165
+ if (n.type === "inlinemath" ||
166
+ n.type === "displaymath" ||
167
+ n.type === "mathenv")
168
+ texRuns(n.content, true, src, out);
169
+ else if (n.type === "environment") {
170
+ const env = typeof n.env === "string" ? n.env : "";
171
+ if (!TEX_HIDDEN_ENV.test(env)) {
172
+ const body = n.content || [];
173
+ const from = (n.args || []).length ? 0 : unparsedArgsEnd(body, -1) + 1;
174
+ texRuns(body.slice(from), math, src, out);
175
+ }
176
+ }
177
+ else if (n.type === "group") {
178
+ texRuns(n.content, math, src, out);
179
+ }
180
+ else if (n.type === "macro") {
181
+ const args = mandatory(n);
182
+ if (math) {
183
+ if (!TEX_MATH_HIDDEN.test(n.content))
184
+ for (const a of args)
185
+ texRuns(a.content, true, src, out);
186
+ }
187
+ else if (TEX_PROSE_ARG.test(n.content)) {
188
+ for (const a of args)
189
+ texRuns(a.content, false, src, out);
190
+ }
191
+ else if (TEX_LAST_ARG.test(n.content) && args.length) {
192
+ texRuns(args.at(-1)?.content, false, src, out);
193
+ }
194
+ if (!math && !(n.args || []).length)
195
+ i = unparsedArgsEnd(list, i);
196
+ }
197
+ }
198
+ flush();
199
+ return out;
200
+ }
201
+ /**
202
+ * The visible runs of a LaTeX source. `parse` is unified-latex's parser; a test hands in a tree
203
+ * with the fields the walk tolerates being absent.
204
+ */
205
+ export function texVisibleRuns(raw, { parse = (s) => getParser().parse(s), } = {}) {
206
+ const root = parse(raw).content;
207
+ // Only the document body is typeset. A fragment with no `document` environment is all body.
208
+ const document = root.find((n) => n.type === "environment" && n.env === "document");
209
+ return texRuns(document ? document.content : root, false, raw, []);
210
+ }
211
+ // Markdown node types that are not prose.
212
+ const MD_HIDDEN = new Set([
213
+ "code",
214
+ "inlineCode",
215
+ "html",
216
+ "yaml",
217
+ "toml",
218
+ "math",
219
+ "inlineMath",
220
+ ]);
221
+ /**
222
+ * The source offset of each character of a text node's value. The value is the source with
223
+ * markdown's escapes (`\*`) and character references (`&lt;`) resolved, so the two are walked
224
+ * side by side; a character whose source cannot be followed gets null (reported, not fixed).
225
+ */
226
+ function mdOffsets(value, src, start) {
227
+ const offs = [];
228
+ let j = start;
229
+ for (const ch of value) {
230
+ if (src[j] === ch)
231
+ offs.push(j++);
232
+ else if (src[j] === "\\" && src[j + 1] === ch) {
233
+ offs.push(j + 1);
234
+ j += 2;
235
+ }
236
+ else if (src[j] === "&" && /^&#?\w{1,8};/.test(src.slice(j, j + 10))) {
237
+ offs.push(null);
238
+ j = src.indexOf(";", j) + 1;
239
+ }
240
+ else {
241
+ offs.push(null);
242
+ j++;
243
+ }
244
+ }
245
+ return offs;
246
+ }
247
+ function mdVisibleRuns(node, src, out = []) {
248
+ if (!node || MD_HIDDEN.has(node.type))
249
+ return out;
250
+ if (node.type === "text") {
251
+ const start = node.position?.start.offset;
252
+ out.push({
253
+ text: node.value,
254
+ offs: typeof start === "number"
255
+ ? mdOffsets(node.value, src, start)
256
+ : Array.from(node.value, () => null),
257
+ });
258
+ }
259
+ for (const c of "children" in node ? node.children : [])
260
+ mdVisibleRuns(c, src, out);
261
+ return out;
262
+ }
263
+ const visibleRuns = (sourceCode) => isTex(sourceCode)
264
+ ? texVisibleRuns(sourceCode.raw)
265
+ : mdVisibleRuns(sourceCode.ast, sourceCode.text);
266
+ /** A report at `[from, to)` of the file. */
267
+ const at = (context, from, to, rest) => {
268
+ const sc = context.sourceCode;
269
+ context.report({
270
+ loc: { start: sc.getLocFromIndex(from), end: sc.getLocFromIndex(to) },
271
+ ...rest,
272
+ });
273
+ };
274
+ // ── paper/section-word ─────────────────────────────────────────────────────────────────
275
+ // The sign (the glyph, or the `\S` macro not followed by a letter), the separator after it, and
276
+ // what follows: a reference (group 3) or a number (group 4).
277
+ const SECTION_TEX = /(§|\\S(?![A-Za-z]))(~|[ \t]*)(?=(\\(?:auto)?ref\b)|(\d))/g;
278
+ const SECTION_GLYPH = /§/g;
279
+ function sectionWord(context) {
280
+ const sc = context.sourceCode;
281
+ if (isTex(sc)) {
282
+ const seen = new Set();
283
+ for (const m of markupMatches(sc, SECTION_TEX)) {
284
+ seen.add(m.index);
285
+ const word = m[3] ? "Section~" : "Section ";
286
+ const range = [m.index, m.index + m[0].length];
287
+ at(context, range[0], range[1], {
288
+ messageId: "sign",
289
+ fix: (f) => f.replaceTextRange(range, word),
290
+ });
291
+ }
292
+ // A glyph before neither a reference nor a number: reported, not rewritten — there is no
293
+ // single right word for a doubled sign or a sign before prose.
294
+ for (const m of markupMatches(sc, SECTION_GLYPH))
295
+ if (!seen.has(m.index))
296
+ at(context, m.index, m.index + 1, { messageId: "sign" });
297
+ return;
298
+ }
299
+ for (const r of visibleRuns(sc))
300
+ for (const m of r.text.matchAll(/§([ \t]*)(\d)?/g)) {
301
+ const from = r.offs[m.index];
302
+ if (from === null || from === undefined)
303
+ continue;
304
+ // The sign and the space after it; the number stays.
305
+ const [, gap = ""] = m;
306
+ const range = [from, from + 1 + gap.length];
307
+ at(context, range[0], range[1], {
308
+ messageId: "sign",
309
+ ...(m[2] ? { fix: (f) => f.replaceTextRange(range, "Section ") } : {}),
310
+ });
311
+ }
312
+ }
313
+ // ── paper/leading-zero ─────────────────────────────────────────────────────────────────
314
+ // The lexeme, matched inside ONE run of visible text. The lookbehind keeps arXiv ids
315
+ // (2310.05736) out: there the dot follows a digit.
316
+ const BARE_DECIMAL = /(?<![\d.\w])\.\d{2,}\b/g;
317
+ // A paragraph or section sign — the glyph, or `\P`/`\S` not followed by a letter — and what may
318
+ // sit between it and the number. Both read the SOURCE, because in LaTeX `\P\P.42` reaches the
319
+ // visible runs as `.42` alone: the macros end the run.
320
+ const DESIGNATOR_BEFORE = /(?:[¶§]|\\[PS](?![A-Za-z]))[ \t~]*$/;
321
+ const DESIGNATED = /(?:[¶§]|\\[PS](?![A-Za-z]))[ \t~]*\.\d/;
322
+ /** The source of the paragraph holding `i`, up to `i`: from the last blank line before it. */
323
+ const paragraphBefore = (src, i) => {
324
+ const head = src.slice(0, i);
325
+ const blank = [...head.matchAll(/\n[ \t]*\n/g)].at(-1);
326
+ return head.slice(blank ? blank.index + blank[0].length : 0);
327
+ };
328
+ function leadingZero(context) {
329
+ const sc = context.sourceCode;
330
+ const src = isTex(sc) ? sc.raw : sc.text;
331
+ for (const r of visibleRuns(sc))
332
+ for (const m of r.text.matchAll(BARE_DECIMAL)) {
333
+ const dot = r.offs[m.index];
334
+ if (dot === null || dot === undefined)
335
+ continue;
336
+ const before = paragraphBefore(src, dot);
337
+ if (DESIGNATOR_BEFORE.test(before))
338
+ continue;
339
+ const zero = (f) => f.insertTextBeforeRange([dot, dot], "0");
340
+ at(context, dot, dot + 1, DESIGNATED.test(before)
341
+ ? {
342
+ messageId: "ambiguous",
343
+ data: { n: m[0] },
344
+ suggest: [
345
+ { messageId: "insertZero", data: { n: m[0] }, fix: zero },
346
+ ],
347
+ }
348
+ : { messageId: "bare", data: { n: m[0] }, fix: zero });
349
+ }
350
+ }
351
+ // ── paper/figure-ref-style ─────────────────────────────────────────────────────────────
352
+ const FIG_REF = /\b(Fig\.|Figure)(?=~?\\(?:ref|autoref)\b)/g;
353
+ function figureRefStyle(context) {
354
+ const sc = context.sourceCode;
355
+ if (!isTex(sc))
356
+ return;
357
+ const all = markupMatches(sc, FIG_REF);
358
+ const short = all.filter((m) => m[1] === "Fig.");
359
+ const long = all.filter((m) => m[1] === "Figure");
360
+ if (!short.length || !long.length)
361
+ return;
362
+ // The minority form is rewritten to the majority one; on a tie, to the full word.
363
+ const [minority, word] = short.length > long.length ? [long, "Fig."] : [short, "Figure"];
364
+ for (const m of minority) {
365
+ const [, form = ""] = m;
366
+ const range = [m.index, m.index + form.length];
367
+ at(context, range[0], range[1], {
368
+ messageId: "mixed",
369
+ data: { form, word, n: String(all.length - minority.length) },
370
+ fix: (f) => f.replaceTextRange(range, word),
371
+ });
372
+ }
373
+ }
374
+ const rule = (description, messages, check, meta = {}) => ({
375
+ meta: {
376
+ type: "suggestion",
377
+ fixable: "code",
378
+ docs: { description },
379
+ schema: [],
380
+ messages,
381
+ ...meta,
382
+ },
383
+ create: (context) => ({
384
+ "root:exit": () => {
385
+ check(context);
386
+ },
387
+ }),
388
+ });
389
+ export default {
390
+ rules: {
391
+ "section-word": rule("`§` / `\\S` instead of the word Section (a reviewer's to-do); fixable", {
392
+ sign: "`§` instead of the word «Section» — `paperlint lint --fix` writes it",
393
+ }, sectionWord),
394
+ "leading-zero": rule("a decimal below 1 written without its leading zero (IEEE / ISO 80000-1); fixable", {
395
+ bare: "`{{n}}` has no leading zero — write `0{{n}}` (IEEE / ISO 80000-1); `paperlint lint --fix` inserts it",
396
+ ambiguous: "`{{n}}` in a paragraph that cites `¶`/`§` numbers: a decimal without its leading zero, or another paragraph number? Not fixed automatically — write `0{{n}}` for a decimal, or put the sign before a paragraph number",
397
+ insertZero: "It is a decimal: write `0{{n}}`",
398
+ }, leadingZero, { hasSuggestions: true }),
399
+ "figure-ref-style": rule("`Fig.~\\ref` and `Figure~\\ref` mixed in one document; fixable to the majority form", {
400
+ mixed: "`{{form}}` beside {{n}} × `{{word}}` in one document — use one form; `paperlint lint --fix` writes `{{word}}`",
401
+ }, figureRefStyle),
402
+ },
403
+ };
404
+ //# sourceMappingURL=paper-typography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paper-typography.js","sourceRoot":"","sources":["../../eslint-rules/paper-typography.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2BpE,4FAA4F;AAC5F,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,CAAC,GACL,iGAAiG,CAAC,IAAI,CACpG,IAAI,CACL,CAAC;IACJ,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,SAAS,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACtC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE,cAAc,CAAC,CAAC;IACzE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CACpB,UAA0B,EAC1B,GAAW;IAEX,M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;QAClB,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,EAAE,WAAW,EAAE;QACrB,MAAM,EAAE,EAAE;QACV,QAAQ;QACR,GAAG,IAAI;KACR;IACD,MAAM,EAAE,CAAC,OAAoB,EAAE,EAAE,CAAC,CAAC;QACjC,WAAW,EAAE,GAAG,EAAE;YAChB,KAAK,CAAC,OAAO,CAAC,CAAC;QACjB,CAAC;KACF,CAAC;CACH,CAAC,CAAC;AAEH,eAAe;IACb,KAAK,EAAE;QACL,cAAc,EAAE,IAAI,CAClB,uEAAuE,EACvE;YACE,IAAI,EAAE,sEAAsE;SAC7E,EACD,WAAW,CACZ;QACD,cAAc,EAAE,IAAI,CAClB,kFAAkF,EAClF;YACE,IAAI,EAAE,sGAAsG;YAC5G,SAAS,EACP,uNAAuN;YACzN,UAAU,EAAE,iCAAiC;SAC9C,EACD,WAAW,EACX,EAAE,cAAc,EAAE,IAAI,EAAE,CACzB;QACD,kBAAkB,EAAE,IAAI,CACtB,qFAAqF,EACrF;YACE,KAAK,EACH,+GAA+G;SAClH,EACD,cAAc,CACf;KACF;CACF,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { DEFAULT_PAPERS_ROOT } from "../lib/paper-config.ts";
2
+ export { DEFAULT_PAPERS_ROOT };
3
+ /**
4
+ * The declared papers root, verified to be on disk.
5
+ *
6
+ * @param settings the project's root `paperlint.json`, parsed (`settingsOf(root)`), or undefined
7
+ * @param baseDir the directory the root is relative to. PASS `import.meta.dirname` FROM THE
8
+ * CONFIG rather than relying on the default: `process.cwd()` is wherever the
9
+ * editor, the hook runtime or the CI step happened to start, and in a git
10
+ * worktree it can be a different checkout entirely. The config file sits at
11
+ * the repository root, so its own directory is the stable answer.
12
+ * @returns the root as DECLARED (relative), not resolved — it goes straight into `files:`
13
+ * globs, which ESLint interprets relative to the config, and an absolute path there
14
+ * would change their meaning.
15
+ */
16
+ export declare function papersRoot(settings: Readonly<Record<string, unknown>> | null | undefined, baseDir?: string): string;
17
+ /**
18
+ * The glob sets a consumer declares its blocks on, derived from one root.
19
+ *
20
+ * 🔴 THE SHAPES LIVE HERE, NOT IN THE CONSUMER, and that is the half that keeps a rule from
21
+ * going blind later. `paper.md` + `draft.md`, `_build/*.facts.json`, `PIPELINE-STATUS.md` are
22
+ * this pipeline's CONVENTION; if a rule starts reading a new file, the glob for it must arrive
23
+ * with the rule, in the same package, rather than as a line every consumer has to add by hand
24
+ * to keep up. A hand-maintained list of paths is the thing that rots, and rots silently.
25
+ */
26
+ export declare function paperFiles(root: string): {
27
+ /** Markdown drafts — the two names a paper's prose is allowed to have. */
28
+ md: string[];
29
+ /** The LaTeX source of a paper (not its figures, not its vendored drafts). */
30
+ tex: string[];
31
+ /** The per-paper stage ledger. */
32
+ status: string[];
33
+ /** The per-paper settings file, `paperlint.json`. */
34
+ venue: string[];
35
+ /** Facts extracted from the built PDF. */
36
+ pdfFacts: string[];
37
+ /** Facts extracted from the bibliography. */
38
+ refFacts: string[];
39
+ /** Everything under the root — for blocks that turn other tooling OFF rather than on. */
40
+ all: string[];
41
+ };
42
+ //# sourceMappingURL=papers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"papers.d.ts","sourceRoot":"","sources":["../../eslint-rules/papers.ts"],"names":[],"mappings":"AA+EA,OAAO,EAEL,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAC9D,OAAO,GAAE,MAAsB,GAC9B,MAAM,CA2BR;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;IAEnC,0EAA0E;;IAE1E,8EAA8E;;IAE9E,kCAAkC;;IAElC,qDAAqD;;IAErD,0CAA0C;;IAE1C,6CAA6C;;IAE7C,yFAAyF;;EAG5F"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * papers.mjs — WHERE THE CONSUMER'S PAPERS LIVE. One declaration, three readers.
3
+ *
4
+ * ── THE PROBLEM THIS SOLVES ─────────────────────────────────────────────────
5
+ * This package lints papers. It must not know where any particular consumer keeps them: the
6
+ * first consumer keeps them two levels deep under a directory named in its own language, and
7
+ * a package that hard-codes that word is a package with exactly one possible user. But the
8
+ * path cannot simply be "passed in" either, because it is needed by FOUR carriers with four
9
+ * different mechanics — an ESLint config (JavaScript), a compiled hook (a closed vocabulary
10
+ * that forbids imports), the PROSE of a skill (read by a model, not resolved by code), and
11
+ * LaTeX (`TEXINPUTS`, kpathsea).
12
+ *
13
+ * ── THE DECISION ────────────────────────────────────────────────────────────
14
+ * ONE declaration, in the project's root `paperlint.json`, with a default:
15
+ *
16
+ * { "papersDir": "docs/papers" }
17
+ *
18
+ * No file, or no key → `papers`. Every carrier then reads that one value with its OWN standard
19
+ * mechanism:
20
+ *
21
+ * ESLint → `settingsOf(root)` (lib/paper-config.mjs) + this module
22
+ * hook → `needs: [provide("config", …)]` cats the file, JSON.parse inside `decide`
23
+ * prose → the skill names a COMMAND, not a path:
24
+ * `node -p "(() => { try { return require('./paperlint.json').papersDir } catch {} })() ?? 'papers'"`
25
+ * LaTeX → `TEXINPUTS` built FROM THE SCRIPT (`$(dirname "$0")/../tex//:`), so the
26
+ * consumer declares nothing at all for this carrier
27
+ *
28
+ * ── WHAT WAS MEASURED AND KILLED, so it is not proposed again ───────────────
29
+ * (full measurements: consumer repo, `idei/paper-pipeline-extraction/`, 2026-09-11)
30
+ *
31
+ * A SYMLINK (`papers -> <the real directory>`) plus a hard-coded default, no config at all.
32
+ * ESLint does NOT descend into a symlinked directory when walking `.`: the run reported
33
+ * ZERO files and exit 0 — the green zero this package has a dedicated guard against.
34
+ *
35
+ * AN ENVIRONMENT VARIABLE (`$PAPER_ROOT`).
36
+ * A compiled hook cannot read `process.env` — the vocabulary check rejects every import
37
+ * except `vigiles/hook`. The only way in is `provide("root", "echo $PAPER_ROOT")`, and
38
+ * then THREE different places must set the same value (the agent harness that spawns the
39
+ * hook, CI, the editor running ESLint). Unset, it expands to the empty string and every
40
+ * prefix test silently passes.
41
+ *
42
+ * A FILENAME MARKER, no root at all (`**\/paper.tex`).
43
+ * Measured on the first consumer: `paper.tex` ×4 with one outside the corpus,
44
+ * `PIPELINE-STATUS.md` ×6 with two of them test fixtures, `paper.md` ×3 with two outside.
45
+ * The guard that would consume this is a `deny` at `error` severity; a denial on writing
46
+ * a fixture gets the hook switched off the same day.
47
+ *
48
+ * `context.settings`.
49
+ * It delivers data INTO a rule; it does not choose which files a rule sees. `files:` is
50
+ * the only mechanism that does. Useful for a plugin's `structureRoot`, useless here.
51
+ *
52
+ * ── WHY THIS THROWS INSTEAD OF FALLING BACK ─────────────────────────────────
53
+ * 🔴 A wrong root does not produce wrong findings — it produces NO findings, and a run with no
54
+ * findings is byte-identical to a run that examined everything and passed. That is the one
55
+ * failure mode of this whole design, and it belongs to the ESLint carrier alone: the other
56
+ * three fail loudly on their own (a hook throws on `join(undefined)`, `ls` exits non-zero,
57
+ * LaTeX stops with `! Emergency stop.`). So this module refuses to return a root it cannot
58
+ * see on disk, and the refusal happens while the CONFIG is loading — before any rule runs,
59
+ * where it cannot be mistaken for a clean lint.
60
+ *
61
+ * ⚠️ THAT IS NOT ENOUGH ON ITS OWN, and saying so is the point. `existsSync` proves the
62
+ * directory exists, not that any rule was handed a file from it: a root that exists but holds
63
+ * no papers, or a glob shape that stopped matching, still yields the green zero. The second
64
+ * net is `scripts/rules-see-files.mjs`, which asks ESLint what the effective config of every
65
+ * linted file is and names any rule that saw none. A consumer using this module without
66
+ * running that script has one net, not two.
67
+ *
68
+ * ⚠️ THE EXAMPLES IN THIS FILE ARE DELIBERATELY GENERIC (`docs/papers`), and that is ENFORCED
69
+ * rather than a style preference: `papers.harness.mjs` part IV fails if the first consumer's own
70
+ * directory name appears anywhere in this package outside the test itself. It caught this very
71
+ * docblock on 2026-09-11, where the example used the real value. An exemption list is what turns
72
+ * such a check into decoration, so there is exactly one exemption: the file asserting it.
73
+ */
74
+ import { existsSync } from "node:fs";
75
+ import { resolve } from "node:path";
76
+ // Re-exported, not re-declared. This file is not a hook, so nothing stops it importing the one
77
+ // source; it had its own copy for no reason, and that copy was outside the agreement check that
78
+ // compares the three hooks — it could have drifted in silence.
79
+ import { CONFIG_KEY, DEFAULT_PAPERS_ROOT, PAPERS_DIR_FIELD, CONFIG_FILE, } from "../lib/paper-config.js";
80
+ export { DEFAULT_PAPERS_ROOT };
81
+ /**
82
+ * The declared papers root, verified to be on disk.
83
+ *
84
+ * @param settings the project's root `paperlint.json`, parsed (`settingsOf(root)`), or undefined
85
+ * @param baseDir the directory the root is relative to. PASS `import.meta.dirname` FROM THE
86
+ * CONFIG rather than relying on the default: `process.cwd()` is wherever the
87
+ * editor, the hook runtime or the CI step happened to start, and in a git
88
+ * worktree it can be a different checkout entirely. The config file sits at
89
+ * the repository root, so its own directory is the stable answer.
90
+ * @returns the root as DECLARED (relative), not resolved — it goes straight into `files:`
91
+ * globs, which ESLint interprets relative to the config, and an absolute path there
92
+ * would change their meaning.
93
+ */
94
+ export function papersRoot(settings, baseDir = process.cwd()) {
95
+ const declared = settings?.[PAPERS_DIR_FIELD];
96
+ // 🔴 `declared === undefined`, NOT `declared ?? DEFAULT`. The two differ on exactly one
97
+ // input — `"papersDir": null` — and the difference is the whole point: `??` reads an explicit
98
+ // `null` as "nothing was declared" and silently uses the default, which is a typed keystroke
99
+ // being treated as an absence. Caught by the harness on 2026-09-11, where the first draft of
100
+ // this line used `??` and let `null` through. Absence means default; anything written down
101
+ // means it must be usable.
102
+ const root = declared === undefined ? DEFAULT_PAPERS_ROOT : declared;
103
+ if (typeof root !== "string" || root.length === 0)
104
+ throw new TypeError(`${CONFIG_KEY}: "${PAPERS_DIR_FIELD}" must be a non-empty string, got ${JSON.stringify(root)}`);
105
+ if (!existsSync(resolve(baseDir, root)))
106
+ throw new Error(`${CONFIG_KEY}: the papers root "${root}" does not exist under ${baseDir}.\n` +
107
+ (declared === undefined
108
+ ? `Nothing was declared, so the default "${DEFAULT_PAPERS_ROOT}" was used. Declare the ` +
109
+ `real location in ${CONFIG_FILE}:\n` +
110
+ ` { "${PAPERS_DIR_FIELD}": "path/to/papers" }`
111
+ : `It is declared in ${CONFIG_FILE} as "${root}". Fix it there, or create the ` +
112
+ `directory.`) +
113
+ `\nThis is thrown rather than ignored on purpose: a papers root that matches nothing ` +
114
+ `makes every rule lint zero files, and a run with zero findings is indistinguishable ` +
115
+ `from a run that checked everything and passed.`);
116
+ return root;
117
+ }
118
+ /**
119
+ * The glob sets a consumer declares its blocks on, derived from one root.
120
+ *
121
+ * 🔴 THE SHAPES LIVE HERE, NOT IN THE CONSUMER, and that is the half that keeps a rule from
122
+ * going blind later. `paper.md` + `draft.md`, `_build/*.facts.json`, `PIPELINE-STATUS.md` are
123
+ * this pipeline's CONVENTION; if a rule starts reading a new file, the glob for it must arrive
124
+ * with the rule, in the same package, rather than as a line every consumer has to add by hand
125
+ * to keep up. A hand-maintained list of paths is the thing that rots, and rots silently.
126
+ */
127
+ export function paperFiles(root) {
128
+ return {
129
+ /** Markdown drafts — the two names a paper's prose is allowed to have. */
130
+ md: [`${root}/*/paper.md`, `${root}/*/draft.md`],
131
+ /** The LaTeX source of a paper (not its figures, not its vendored drafts). */
132
+ tex: [`${root}/*/paper.tex`],
133
+ /** The per-paper stage ledger. */
134
+ status: [`${root}/*/PIPELINE-STATUS.md`],
135
+ /** The per-paper settings file, `paperlint.json`. */
136
+ venue: [`${root}/*/${CONFIG_FILE}`],
137
+ /** Facts extracted from the built PDF. */
138
+ pdfFacts: [`${root}/*/_build/paper.facts.json`],
139
+ /** Facts extracted from the bibliography. */
140
+ refFacts: [`${root}/*/_build/refs.facts.json`],
141
+ /** Everything under the root — for blocks that turn other tooling OFF rather than on. */
142
+ all: [`${root}/**/*.*`],
143
+ };
144
+ }
145
+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