paperlint 18.6.0 → 18.7.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 (94) hide show
  1. package/CLAUDE.md +2 -2
  2. package/CONTRIBUTING.md +5 -2
  3. package/README.md +6 -6
  4. package/dist/adapters/clack/index.d.ts +3 -0
  5. package/dist/adapters/clack/index.d.ts.map +1 -0
  6. package/dist/adapters/clack/index.js +3 -0
  7. package/dist/adapters/clack/index.js.map +1 -0
  8. package/dist/adapters/clack/prompts.io.d.ts +8 -0
  9. package/dist/adapters/clack/prompts.io.d.ts.map +1 -0
  10. package/dist/adapters/clack/prompts.io.js +20 -0
  11. package/dist/adapters/clack/prompts.io.js.map +1 -0
  12. package/dist/adapters/package-manager/index.d.ts +4 -0
  13. package/dist/adapters/package-manager/index.d.ts.map +1 -0
  14. package/dist/adapters/package-manager/index.js +4 -0
  15. package/dist/adapters/package-manager/index.js.map +1 -0
  16. package/dist/adapters/package-manager/install.io.d.ts +3 -0
  17. package/dist/adapters/package-manager/install.io.d.ts.map +1 -0
  18. package/dist/adapters/package-manager/install.io.js +23 -0
  19. package/dist/adapters/package-manager/install.io.js.map +1 -0
  20. package/dist/adapters/package-manager/manager.d.ts +13 -0
  21. package/dist/adapters/package-manager/manager.d.ts.map +1 -0
  22. package/dist/adapters/package-manager/manager.js +22 -0
  23. package/dist/adapters/package-manager/manager.js.map +1 -0
  24. package/dist/adapters/study-registry/index.d.ts +2 -2
  25. package/dist/cli.d.ts +4 -1
  26. package/dist/cli.d.ts.map +1 -1
  27. package/dist/cli.js +42 -6
  28. package/dist/cli.js.map +1 -1
  29. package/dist/init.d.ts +38 -15
  30. package/dist/init.d.ts.map +1 -1
  31. package/dist/init.js +99 -39
  32. package/dist/init.js.map +1 -1
  33. package/dist/ports/project-install.d.ts +19 -0
  34. package/dist/ports/project-install.d.ts.map +1 -0
  35. package/dist/ports/project-install.js +2 -0
  36. package/dist/ports/project-install.js.map +1 -0
  37. package/dist/ports/prompts.d.ts +31 -0
  38. package/dist/ports/prompts.d.ts.map +1 -0
  39. package/dist/ports/prompts.js +2 -0
  40. package/dist/ports/prompts.js.map +1 -0
  41. package/dist/self-install.d.ts +65 -0
  42. package/dist/self-install.d.ts.map +1 -0
  43. package/dist/self-install.js +145 -0
  44. package/dist/self-install.js.map +1 -0
  45. package/dist/skill-chunks/chunk-65X5HVIJ.js +26462 -0
  46. package/dist/skill-chunks/chunk-6NU6CXUS.js +258 -0
  47. package/dist/skill-chunks/chunk-GRSXIWYF.js +352 -0
  48. package/dist/skill-chunks/chunk-IREAROCV.js +84 -0
  49. package/dist/skill-chunks/chunk-KWK6RT4T.js +24267 -0
  50. package/dist/skill-chunks/chunk-NPQVDEE4.js +19681 -0
  51. package/dist/skill-chunks/chunk-PJ4KNV4J.js +45 -0
  52. package/dist/skill-chunks/dist-UPCJMLBM.js +385 -0
  53. package/dist/skill-chunks/pdfjs-LUMEFOH2.js +39518 -0
  54. package/docs/e2e.md +10 -0
  55. package/docs/install.md +27 -16
  56. package/docs/prior-art/README.md +2 -0
  57. package/docs/prior-art/one-command-install.md +33 -0
  58. package/docs/prior-art/prompt-libraries.md +32 -0
  59. package/eslint.config.mjs +1 -0
  60. package/lib/skill-checks.mjs +17 -9
  61. package/lib/skill-checks.test.mjs +28 -15
  62. package/lib/skill-corpus.mjs +5 -2
  63. package/package.json +5 -3
  64. package/scripts/bundle-skills.test.ts +226 -0
  65. package/scripts/bundle-skills.ts +304 -0
  66. package/skills/argument-arc/SKILL.md +2 -2
  67. package/skills/argument-arc/SKILL.md.spec.ts +1 -1
  68. package/skills/argument-arc/scripts/headings.js +57 -13
  69. package/skills/build-label-page/scripts/label-page.js +2005 -93
  70. package/skills/cold-read-diff/scripts/cold-read.js +221 -14
  71. package/skills/label-agent-runs/scripts/labels.js +272 -348
  72. package/skills/paper-pipeline/scripts/extract-ref-facts.js +304 -0
  73. package/skills/pc-panel-review/scripts/prior-reviews.js +7244 -12
  74. package/skills/run-agent-grid/scripts/grid-guard.js +562 -627
  75. package/skills/verify-citations/SKILL.md +9 -9
  76. package/skills/verify-citations/SKILL.md.spec.ts +8 -8
  77. package/skills/verify-citations/scripts/bib-authors.js +228 -0
  78. package/skills/verify-citations/scripts/verify-cites.js +816 -0
  79. package/src/adapters/clack/index.ts +2 -0
  80. package/src/adapters/clack/prompts.io.ts +35 -0
  81. package/src/adapters/clack/prompts.test.ts +58 -0
  82. package/src/adapters/package-manager/index.test.ts +67 -0
  83. package/src/adapters/package-manager/index.ts +3 -0
  84. package/src/adapters/package-manager/install.io.ts +27 -0
  85. package/src/adapters/package-manager/manager.ts +33 -0
  86. package/src/cli.harness.mjs +41 -26
  87. package/src/cli.test.ts +93 -2
  88. package/src/cli.ts +75 -4
  89. package/src/init.test.ts +138 -27
  90. package/src/init.ts +128 -72
  91. package/src/ports/project-install.ts +18 -0
  92. package/src/ports/prompts.ts +27 -0
  93. package/src/self-install.test.ts +267 -0
  94. package/src/self-install.ts +224 -0
@@ -4,7 +4,7 @@ description: Verify every citation is a real work with correct metadata, and tha
4
4
  allowed-tools: [Read, Write, Edit, Grep, Glob, Bash, WebSearch, WebFetch, Agent]
5
5
  ---
6
6
 
7
- <!-- vigiles:sha256:25a05cd3468a3a26 compiled from skills/verify-citations/SKILL.md.spec.ts -->
7
+ <!-- vigiles:sha256:660c7457aab73a4e compiled from skills/verify-citations/SKILL.md.spec.ts -->
8
8
 
9
9
  # verify-citations — every cite real, the delta explicit
10
10
 
@@ -109,10 +109,10 @@ paper.
109
109
 
110
110
  **How to run.**
111
111
  ```
112
- node scripts/verify-cites.mjs cites.json # JSON array of {id,doi?,arxiv?,title?,year?,cve?,commit?}
113
- node scripts/verify-cites.mjs refs.bib # best-effort .bib extraction
114
- cat cites.json | node scripts/verify-cites.mjs -
115
- node scripts/verify-cites.mjs cites.json --offline # no network (everything degrades to unresolvable)
112
+ node ${CLAUDE_SKILL_DIR}/scripts/verify-cites.js cites.json # JSON array of {id,doi?,arxiv?,title?,year?,cve?,commit?}
113
+ node ${CLAUDE_SKILL_DIR}/scripts/verify-cites.js refs.bib # best-effort .bib extraction
114
+ cat cites.json | node ${CLAUDE_SKILL_DIR}/scripts/verify-cites.js -
115
+ node ${CLAUDE_SKILL_DIR}/scripts/verify-cites.js cites.json --offline # no network (everything degrades to unresolvable)
116
116
  ```
117
117
  It prints per-cite `{id, verdict, reason, matched_db, matched_title?, flags?}` + a summary, and **exits 1 iff
118
118
  any `false` (fabrication)** — `unresolvable` alone is advisory and does NOT fail the gate, matching the
@@ -146,8 +146,8 @@ The three defects that found it: `docs/design/verify-citations-history.md` in th
146
146
 
147
147
  **How to run.**
148
148
  ```
149
- node scripts/bib-authors.mjs <paper-dir> # the databases bibtex opened in the last build; or a .bib, or a .tex
150
- node scripts/bib-authors.mjs <paper-dir> --json
149
+ node ${CLAUDE_SKILL_DIR}/scripts/bib-authors.js <paper-dir> # the databases bibtex opened in the last build; or a .bib, or a .tex
150
+ node ${CLAUDE_SKILL_DIR}/scripts/bib-authors.js <paper-dir> --json
151
151
  ```
152
152
  Exits **1** on any author-set or author-order disagreement, **0** when clean, **2** on usage/IO error. A paper
153
153
  directory or a `.tex` is read through the build's record (`_build/sources.json`): a paper that was never built,
@@ -200,8 +200,8 @@ Run both; neither replaces the other.
200
200
 
201
201
  ```
202
202
  # 1. measure: parse the bibliography bibtex opened (build the paper first), ask CrossRef/arXiv, write _build/refs.facts.json
203
- node .claude/skills/paper-pipeline/scripts/extract-ref-facts.mjs <paper-dir>
204
- node .claude/skills/paper-pipeline/scripts/extract-ref-facts.mjs <paper-dir> --offline # cached responses only
203
+ node ${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/extract-ref-facts.js <paper-dir>
204
+ node ${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/extract-ref-facts.js <paper-dir> --offline # cached responses only
205
205
 
206
206
  # 2. judge: rules over those facts — severity from the config, positions, disable-with-reason
207
207
  npx eslint --no-config-lookup --config eslint.config.mjs "<paper-dir>/_build/refs.facts.json"
@@ -124,10 +124,10 @@ paper.
124
124
 
125
125
  **How to run.**
126
126
  \`\`\`
127
- node scripts/verify-cites.mjs cites.json # JSON array of {id,doi?,arxiv?,title?,year?,cve?,commit?}
128
- node scripts/verify-cites.mjs refs.bib # best-effort .bib extraction
129
- cat cites.json | node scripts/verify-cites.mjs -
130
- node scripts/verify-cites.mjs cites.json --offline # no network (everything degrades to unresolvable)
127
+ node \${CLAUDE_SKILL_DIR}/scripts/verify-cites.js cites.json # JSON array of {id,doi?,arxiv?,title?,year?,cve?,commit?}
128
+ node \${CLAUDE_SKILL_DIR}/scripts/verify-cites.js refs.bib # best-effort .bib extraction
129
+ cat cites.json | node \${CLAUDE_SKILL_DIR}/scripts/verify-cites.js -
130
+ node \${CLAUDE_SKILL_DIR}/scripts/verify-cites.js cites.json --offline # no network (everything degrades to unresolvable)
131
131
  \`\`\`
132
132
  It prints per-cite \`{id, verdict, reason, matched_db, matched_title?, flags?}\` + a summary, and **exits 1 iff
133
133
  any \`false\` (fabrication)** — \`unresolvable\` alone is advisory and does NOT fail the gate, matching the
@@ -161,8 +161,8 @@ The three defects that found it: \`docs/design/verify-citations-history.md\` in
161
161
 
162
162
  **How to run.**
163
163
  \`\`\`
164
- node scripts/bib-authors.mjs <paper-dir> # the databases bibtex opened in the last build; or a .bib, or a .tex
165
- node scripts/bib-authors.mjs <paper-dir> --json
164
+ node \${CLAUDE_SKILL_DIR}/scripts/bib-authors.js <paper-dir> # the databases bibtex opened in the last build; or a .bib, or a .tex
165
+ node \${CLAUDE_SKILL_DIR}/scripts/bib-authors.js <paper-dir> --json
166
166
  \`\`\`
167
167
  Exits **1** on any author-set or author-order disagreement, **0** when clean, **2** on usage/IO error. A paper
168
168
  directory or a \`.tex\` is read through the build's record (\`_build/sources.json\`): a paper that was never built,
@@ -215,8 +215,8 @@ Run both; neither replaces the other.
215
215
 
216
216
  \`\`\`
217
217
  # 1. measure: parse the bibliography bibtex opened (build the paper first), ask CrossRef/arXiv, write _build/refs.facts.json
218
- node .claude/skills/paper-pipeline/scripts/extract-ref-facts.mjs <paper-dir>
219
- node .claude/skills/paper-pipeline/scripts/extract-ref-facts.mjs <paper-dir> --offline # cached responses only
218
+ node \${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/extract-ref-facts.js <paper-dir>
219
+ node \${CLAUDE_SKILL_DIR}/../paper-pipeline/scripts/extract-ref-facts.js <paper-dir> --offline # cached responses only
220
220
 
221
221
  # 2. judge: rules over those facts — severity from the config, positions, disable-with-reason
222
222
  npx eslint --no-config-lookup --config eslint.config.mjs "<paper-dir>/_build/refs.facts.json"
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __plCreateRequire } from "node:module";
3
+ import { fileURLToPath as __plFileURLToPath } from "node:url";
4
+ import { dirname as __plDirname } from "node:path";
5
+ const require = __plCreateRequire(import.meta.url);
6
+ const __filename = __plFileURLToPath(import.meta.url);
7
+ const __dirname = __plDirname(__filename);
8
+ import {
9
+ bibReader,
10
+ bibliographyAt,
11
+ bibliographyUnreadWhy,
12
+ isMain
13
+ } from "../../../dist/skill-chunks/chunk-KWK6RT4T.js";
14
+ import {
15
+ latexReader,
16
+ sourcesCodec
17
+ } from "../../../dist/skill-chunks/chunk-65X5HVIJ.js";
18
+ import "../../../dist/skill-chunks/chunk-IREAROCV.js";
19
+ import {
20
+ absolutePath,
21
+ nodeFiles
22
+ } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
23
+ import "../../../dist/skill-chunks/chunk-GRSXIWYF.js";
24
+ import "../../../dist/skill-chunks/chunk-NPQVDEE4.js";
25
+ import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
26
+
27
+ // skills/verify-citations/scripts/bib-authors.mjs
28
+ import { resolve } from "node:path";
29
+ var DBLP = "https://dblp.org/search/publ/api";
30
+ var DEPS = {
31
+ files: nodeFiles,
32
+ codec: sourcesCodec,
33
+ latex: latexReader,
34
+ bib: bibReader
35
+ };
36
+ function bibliographyFrom(target) {
37
+ const r = bibliographyAt(absolutePath(resolve(target)), DEPS);
38
+ if (!r.ok) die(bibliographyUnreadWhy(r.error));
39
+ const { texts } = r.value;
40
+ return { files: [...new Set(texts.map((x) => x.path))], texts };
41
+ }
42
+ var writtenName = (n) => n.name ?? [[n.prefix, n.lastName].filter(Boolean).join(" "), n.firstName].filter(Boolean).join(", ");
43
+ function authorEntries(entries) {
44
+ return entries.map((e) => ({
45
+ type: e.type,
46
+ key: e.key,
47
+ author: (e.names.author ?? []).map(writtenName).join(" and "),
48
+ title: e.fields.title ?? "",
49
+ booktitle: e.fields.booktitle ?? "",
50
+ journal: e.fields.journal ?? ""
51
+ }));
52
+ }
53
+ var DEACCENT = (s) => s.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[{}\\'`"^~]/g, "");
54
+ function surnames(authorField) {
55
+ if (!authorField) return [];
56
+ return DEACCENT(authorField).split(/\s+and\s+/i).map((p) => p.trim()).filter(Boolean).map((p) => {
57
+ const familyPart = p.includes(",") ? p.split(",")[0] : p;
58
+ const last = familyPart.trim().split(/\s+/).slice(-1)[0] || "";
59
+ return last.trim().toLowerCase().replace(/[.\s-]+$/, "");
60
+ }).filter((s) => s && s !== "others");
61
+ }
62
+ var truncated = (authorField) => /\band\s+others\b/i.test(authorField);
63
+ function claimsPublished(e) {
64
+ const venue = `${e.booktitle} ${e.journal}`.trim();
65
+ if (!venue) return false;
66
+ return !/^\s*arxiv\b|arxiv preprint|\bcorr\b/i.test(venue);
67
+ }
68
+ async function dblpHits(title) {
69
+ const url = `${DBLP}/?q=${encodeURIComponent(title)}&format=json&h=6`;
70
+ const res = await fetch(url, {
71
+ headers: { "User-Agent": "bib-authors/1.0 (paper QA)" },
72
+ signal: AbortSignal.timeout(15e3)
73
+ });
74
+ if (res.status === 429)
75
+ throw Object.assign(new Error("DBLP 429"), { retryable: true });
76
+ if (!res.ok) throw new Error(`DBLP ${res.status}`);
77
+ const hits = (await res.json())?.result?.hits?.hit ?? [];
78
+ return hits.map((h) => {
79
+ const a = h.info?.authors?.author;
80
+ const list = a ? Array.isArray(a) ? a : [a] : [];
81
+ return {
82
+ venue: h.info?.venue ?? "",
83
+ year: h.info?.year ?? "",
84
+ type: h.info?.type ?? "",
85
+ title: h.info?.title ?? "",
86
+ // DBLP disambiguates people as "Mostafa Dehghani 0001" — the digits are not a name.
87
+ authors: list.map((p) => String(p.text).replace(/\s+\d{4}$/, ""))
88
+ };
89
+ });
90
+ }
91
+ var isPreprintRecord = (h) => /^corr$/i.test(h.venue) || /informal/i.test(h.type);
92
+ var looseTitle = (s) => DEACCENT(s).toLowerCase().replace(/[^a-z0-9]+/g, "");
93
+ function compare(ourSurnames, theirSurnames) {
94
+ const missing = theirSurnames.filter((x) => !ourSurnames.includes(x));
95
+ const extra = ourSurnames.filter((x) => !theirSurnames.includes(x));
96
+ const orderDiffers = missing.length === 0 && extra.length === 0 && ourSurnames.join("|") !== theirSurnames.join("|");
97
+ return { missing, extra, orderDiffers };
98
+ }
99
+ async function checkAuthors(parsed, {
100
+ lookup = dblpHits,
101
+ pause = (ms) => new Promise((r) => {
102
+ setTimeout(r, ms);
103
+ })
104
+ } = {}) {
105
+ const findings = [];
106
+ const skipped = [];
107
+ const unchecked = [];
108
+ const matched = [];
109
+ const entries = parsed.filter((e) => e.title && e.author);
110
+ for (const e of entries) {
111
+ if (!claimsPublished(e)) continue;
112
+ if (truncated(e.author)) {
113
+ skipped.push({
114
+ key: e.key,
115
+ why: "author list ends in `and others` \u2014 completeness not checkable"
116
+ });
117
+ continue;
118
+ }
119
+ let hits = null;
120
+ for (let attempt = 0; attempt < 3 && hits === null; attempt++) {
121
+ try {
122
+ hits = await lookup(e.title.replace(/[{}]/g, ""));
123
+ } catch (err) {
124
+ const last = attempt === 2;
125
+ if (last)
126
+ unchecked.push({
127
+ key: e.key,
128
+ why: `DBLP lookup failed: ${err.message}`
129
+ });
130
+ else await pause(1500 * (attempt + 1));
131
+ }
132
+ }
133
+ if (hits === null) continue;
134
+ const want = looseTitle(e.title);
135
+ const same = hits.filter((h) => looseTitle(h.title) === want);
136
+ const rec = same.find((h) => !isPreprintRecord(h));
137
+ if (!rec) {
138
+ skipped.push({
139
+ key: e.key,
140
+ why: same.length ? "only a preprint record on DBLP" : "no DBLP title match"
141
+ });
142
+ continue;
143
+ }
144
+ const ours = surnames(e.author);
145
+ const theirs = surnames(rec.authors.join(" and "));
146
+ const d = compare(ours, theirs);
147
+ if (!(d.missing.length || d.extra.length || d.orderDiffers))
148
+ matched.push(e.key);
149
+ else {
150
+ findings.push({
151
+ key: e.key,
152
+ venue: `${rec.venue} ${rec.year}`.trim(),
153
+ ours,
154
+ theirs,
155
+ ...d
156
+ });
157
+ }
158
+ await pause(900);
159
+ }
160
+ return { findings, skipped, unchecked, matched };
161
+ }
162
+ function die(msg) {
163
+ console.error(`bib-authors: ${msg}`);
164
+ process.exit(2);
165
+ }
166
+ async function main() {
167
+ const args = process.argv.slice(2).filter((a) => a !== "--json");
168
+ const asJson = process.argv.includes("--json");
169
+ if (!args[0])
170
+ die("usage: bib-authors.mjs <paper-dir|file.bib|file.tex> [--json]");
171
+ const { files, texts } = bibliographyFrom(args[0]);
172
+ const file = files.join(", ");
173
+ const parsed = texts.flatMap((t) => authorEntries(t.entries));
174
+ const entries = parsed.filter((e) => e.title && e.author);
175
+ const { findings, skipped, unchecked } = await checkAuthors(parsed);
176
+ if (asJson) {
177
+ console.log(
178
+ JSON.stringify(
179
+ {
180
+ file: files[0],
181
+ files,
182
+ entries: entries.length,
183
+ findings,
184
+ skipped,
185
+ unchecked
186
+ },
187
+ null,
188
+ 2
189
+ )
190
+ );
191
+ } else {
192
+ console.log(`== bib-authors: ${file} ==`);
193
+ for (const f of findings) {
194
+ console.log(`
195
+ \u{1F534} ${f.key} (DBLP: ${f.venue})`);
196
+ if (f.missing.length)
197
+ console.log(` MISSING from ours : ${f.missing.join(", ")}`);
198
+ if (f.extra.length)
199
+ console.log(` EXTRA in ours : ${f.extra.join(", ")}`);
200
+ if (f.orderDiffers) {
201
+ console.log(` ORDER differs`);
202
+ console.log(` ours : ${f.ours.join(" > ")}`);
203
+ console.log(` DBLP : ${f.theirs.join(" > ")}`);
204
+ }
205
+ }
206
+ for (const s of skipped) console.log(` \xB7 n/a ${s.key} \u2014 ${s.why}`);
207
+ for (const u of unchecked)
208
+ console.log(` \u26A0\uFE0F NOT CHECKED ${u.key} \u2014 ${u.why}`);
209
+ console.log(
210
+ `
211
+ -- ${entries.length} entries \xB7 ${findings.length} difference(s) \xB7 ${skipped.length} not applicable \xB7 ${unchecked.length} NOT CHECKED`
212
+ );
213
+ console.log(
214
+ findings.length ? "FAIL: our author list disagrees with the version we claim to cite." : unchecked.length ? `PARTIAL: no disagreement among the entries reached, but ${unchecked.length} could not be checked \u2014 this is NOT a pass.` : "PASS: no author-list disagreement."
215
+ );
216
+ }
217
+ process.exit(findings.length ? 1 : unchecked.length ? 2 : 0);
218
+ }
219
+ if (isMain(import.meta.url)) await main();
220
+ export {
221
+ authorEntries,
222
+ checkAuthors,
223
+ claimsPublished,
224
+ compare,
225
+ dblpHits,
226
+ surnames,
227
+ truncated
228
+ };