paperlint 18.6.0 → 18.8.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 (165) hide show
  1. package/.claude-plugin/marketplace.json +11 -0
  2. package/.claude-plugin/plugin.json +7 -0
  3. package/CLAUDE.md +3 -3
  4. package/CONTRIBUTING.md +5 -2
  5. package/README.md +6 -6
  6. package/dist/adapters/clack/index.d.ts +3 -0
  7. package/dist/adapters/clack/index.d.ts.map +1 -0
  8. package/dist/adapters/clack/index.js +3 -0
  9. package/dist/adapters/clack/index.js.map +1 -0
  10. package/dist/adapters/clack/prompts.io.d.ts +8 -0
  11. package/dist/adapters/clack/prompts.io.d.ts.map +1 -0
  12. package/dist/adapters/clack/prompts.io.js +20 -0
  13. package/dist/adapters/clack/prompts.io.js.map +1 -0
  14. package/dist/adapters/claude-code/claude.io.d.ts +13 -0
  15. package/dist/adapters/claude-code/claude.io.d.ts.map +1 -0
  16. package/dist/adapters/claude-code/claude.io.js +68 -0
  17. package/dist/adapters/claude-code/claude.io.js.map +1 -0
  18. package/dist/adapters/claude-code/index.d.ts +4 -0
  19. package/dist/adapters/claude-code/index.d.ts.map +1 -0
  20. package/dist/adapters/claude-code/index.js +4 -0
  21. package/dist/adapters/claude-code/index.js.map +1 -0
  22. package/dist/adapters/claude-code/plugin.d.ts +19 -0
  23. package/dist/adapters/claude-code/plugin.d.ts.map +1 -0
  24. package/dist/adapters/claude-code/plugin.js +66 -0
  25. package/dist/adapters/claude-code/plugin.js.map +1 -0
  26. package/dist/adapters/package-manager/index.d.ts +4 -0
  27. package/dist/adapters/package-manager/index.d.ts.map +1 -0
  28. package/dist/adapters/package-manager/index.js +4 -0
  29. package/dist/adapters/package-manager/index.js.map +1 -0
  30. package/dist/adapters/package-manager/install.io.d.ts +3 -0
  31. package/dist/adapters/package-manager/install.io.d.ts.map +1 -0
  32. package/dist/adapters/package-manager/install.io.js +23 -0
  33. package/dist/adapters/package-manager/install.io.js.map +1 -0
  34. package/dist/adapters/package-manager/manager.d.ts +13 -0
  35. package/dist/adapters/package-manager/manager.d.ts.map +1 -0
  36. package/dist/adapters/package-manager/manager.js +22 -0
  37. package/dist/adapters/package-manager/manager.js.map +1 -0
  38. package/dist/adapters/study-registry/index.d.ts +2 -2
  39. package/dist/cli.d.ts +9 -1
  40. package/dist/cli.d.ts.map +1 -1
  41. package/dist/cli.js +73 -13
  42. package/dist/cli.js.map +1 -1
  43. package/dist/doctor-plugin.d.ts +23 -0
  44. package/dist/doctor-plugin.d.ts.map +1 -0
  45. package/dist/doctor-plugin.js +56 -0
  46. package/dist/doctor-plugin.js.map +1 -0
  47. package/dist/doctor.d.ts +6 -1
  48. package/dist/doctor.d.ts.map +1 -1
  49. package/dist/doctor.js +69 -26
  50. package/dist/doctor.js.map +1 -1
  51. package/dist/hooks-settings.d.ts +18 -0
  52. package/dist/hooks-settings.d.ts.map +1 -1
  53. package/dist/hooks-settings.js +25 -0
  54. package/dist/hooks-settings.js.map +1 -1
  55. package/dist/init.d.ts +47 -16
  56. package/dist/init.d.ts.map +1 -1
  57. package/dist/init.js +231 -86
  58. package/dist/init.js.map +1 -1
  59. package/dist/link-skills.d.ts +15 -0
  60. package/dist/link-skills.d.ts.map +1 -1
  61. package/dist/link-skills.js +18 -1
  62. package/dist/link-skills.js.map +1 -1
  63. package/dist/plugin-offer.d.ts +73 -0
  64. package/dist/plugin-offer.d.ts.map +1 -0
  65. package/dist/plugin-offer.js +96 -0
  66. package/dist/plugin-offer.js.map +1 -0
  67. package/dist/ports/claude-code.d.ts +31 -0
  68. package/dist/ports/claude-code.d.ts.map +1 -0
  69. package/dist/ports/claude-code.js +2 -0
  70. package/dist/ports/claude-code.js.map +1 -0
  71. package/dist/ports/project-install.d.ts +19 -0
  72. package/dist/ports/project-install.d.ts.map +1 -0
  73. package/dist/ports/project-install.js +2 -0
  74. package/dist/ports/project-install.js.map +1 -0
  75. package/dist/ports/prompts.d.ts +31 -0
  76. package/dist/ports/prompts.d.ts.map +1 -0
  77. package/dist/ports/prompts.js +2 -0
  78. package/dist/ports/prompts.js.map +1 -0
  79. package/dist/self-install.d.ts +65 -0
  80. package/dist/self-install.d.ts.map +1 -0
  81. package/dist/self-install.js +145 -0
  82. package/dist/self-install.js.map +1 -0
  83. package/dist/skill-chunks/chunk-65X5HVIJ.js +26462 -0
  84. package/dist/skill-chunks/chunk-6NU6CXUS.js +258 -0
  85. package/dist/skill-chunks/chunk-GRSXIWYF.js +352 -0
  86. package/dist/skill-chunks/chunk-IREAROCV.js +84 -0
  87. package/dist/skill-chunks/chunk-KWK6RT4T.js +24267 -0
  88. package/dist/skill-chunks/chunk-NPQVDEE4.js +19681 -0
  89. package/dist/skill-chunks/chunk-PJ4KNV4J.js +45 -0
  90. package/dist/skill-chunks/dist-UPCJMLBM.js +385 -0
  91. package/dist/skill-chunks/pdfjs-LUMEFOH2.js +39518 -0
  92. package/dist/types.d.ts +4 -0
  93. package/dist/types.d.ts.map +1 -1
  94. package/docs/e2e.md +10 -0
  95. package/docs/install.md +88 -29
  96. package/docs/prior-art/README.md +2 -0
  97. package/docs/prior-art/one-command-install.md +33 -0
  98. package/docs/prior-art/prompt-libraries.md +32 -0
  99. package/eslint.config.mjs +1 -0
  100. package/hooks/CLAUDE.md +2 -2
  101. package/hooks/CLAUDE.md.spec.ts +1 -1
  102. package/lib/skill-checks.mjs +13 -6
  103. package/lib/skill-checks.test.mjs +28 -15
  104. package/lib/skill-corpus.mjs +5 -2
  105. package/package.json +8 -3
  106. package/plugin/CLAUDE.md +22 -14
  107. package/plugin/CLAUDE.md.spec.ts +20 -12
  108. package/scripts/bundle-skills.test.ts +226 -0
  109. package/scripts/bundle-skills.ts +304 -0
  110. package/scripts/plugin-version.test.ts +80 -0
  111. package/scripts/plugin-version.ts +58 -0
  112. package/skills/CLAUDE.md +2 -2
  113. package/skills/CLAUDE.md.spec.ts +1 -1
  114. package/skills/argument-arc/SKILL.md +2 -2
  115. package/skills/argument-arc/SKILL.md.spec.ts +1 -1
  116. package/skills/argument-arc/scripts/headings.js +57 -13
  117. package/skills/build-label-page/scripts/label-page.js +2005 -93
  118. package/skills/cold-read-diff/scripts/cold-read.js +221 -14
  119. package/skills/label-agent-runs/scripts/labels.js +272 -348
  120. package/skills/paper-pipeline/references/anonymization.md +4 -3
  121. package/skills/paper-pipeline/scripts/extract-ref-facts.js +304 -0
  122. package/skills/pc-panel-review/scripts/prior-reviews.js +7244 -12
  123. package/skills/run-agent-grid/scripts/grid-guard.js +562 -627
  124. package/skills/submit-paper/SKILL.md +5 -4
  125. package/skills/submit-paper/SKILL.md.spec.ts +4 -3
  126. package/skills/submit-paper/check-deanon.sh +17 -2
  127. package/skills/submit-paper/check-deanon.test.ts +141 -0
  128. package/skills/verify-citations/SKILL.md +9 -9
  129. package/skills/verify-citations/SKILL.md.spec.ts +8 -8
  130. package/skills/verify-citations/scripts/bib-authors.js +228 -0
  131. package/skills/verify-citations/scripts/verify-cites.js +816 -0
  132. package/src/adapters/clack/index.ts +2 -0
  133. package/src/adapters/clack/prompts.io.ts +35 -0
  134. package/src/adapters/clack/prompts.test.ts +58 -0
  135. package/src/adapters/claude-code/claude.io.ts +103 -0
  136. package/src/adapters/claude-code/index.test.ts +233 -0
  137. package/src/adapters/claude-code/index.ts +11 -0
  138. package/src/adapters/claude-code/plugin.ts +82 -0
  139. package/src/adapters/package-manager/index.test.ts +67 -0
  140. package/src/adapters/package-manager/index.ts +3 -0
  141. package/src/adapters/package-manager/install.io.ts +27 -0
  142. package/src/adapters/package-manager/manager.ts +33 -0
  143. package/src/cli.harness.mjs +47 -26
  144. package/src/cli.test.ts +179 -2
  145. package/src/cli.ts +130 -10
  146. package/src/doctor-plugin.test.ts +103 -0
  147. package/src/doctor-plugin.ts +83 -0
  148. package/src/doctor.test.ts +111 -2
  149. package/src/doctor.ts +83 -32
  150. package/src/hooks-notice.test.ts +82 -0
  151. package/src/hooks-settings.ts +49 -0
  152. package/src/init-plugin.test.ts +178 -0
  153. package/src/init.test.ts +138 -27
  154. package/src/init.ts +341 -124
  155. package/src/link-skills.test.ts +34 -1
  156. package/src/link-skills.ts +34 -0
  157. package/src/parse-args.test.ts +2 -0
  158. package/src/plugin-offer.test.ts +276 -0
  159. package/src/plugin-offer.ts +160 -0
  160. package/src/ports/claude-code.ts +30 -0
  161. package/src/ports/project-install.ts +18 -0
  162. package/src/ports/prompts.ts +27 -0
  163. package/src/self-install.test.ts +267 -0
  164. package/src/self-install.ts +224 -0
  165. package/src/types.ts +4 -0
@@ -12,9 +12,10 @@ Author/identity strings to find and remove from anything a reviewer sees:
12
12
  ```
13
13
  # Your OWN list of identifiers — names, surnames, handles, repo names, tool names, email.
14
14
  # It is CONSUMER DATA, so it lives in your repository, not in this package:
15
- # .claude/skills/submit-paper/deanon-denylist.txt (one extended regex per line)
16
- bash .claude/skills/submit-paper/check-deanon.sh <paper-dir> # PDF text + artifact/ + inside *.zip
17
- grep -rIiE "$(grep -vE '^\s*(#|$)' .claude/skills/submit-paper/deanon-denylist.txt | paste -sd'|')" <targets>
15
+ # .paperlint/deanon-denylist.txt (one extended regex per line)
16
+ # The gate that greps PDF text + artifact/ + inside *.zip is submit-paper's check-deanon.sh
17
+ # (its step 0 gives the command). By hand, over any other targets:
18
+ grep -rIiE "$(grep -vE '^\s*(#|$)' .paperlint/deanon-denylist.txt | paste -sd'|')" <targets>
18
19
  ```
19
20
 
20
21
  Plus a **non-English script** in the source (an author-language fingerprint — Cyrillic in the example
@@ -0,0 +1,304 @@
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/paper-pipeline/scripts/extract-ref-facts.mjs
28
+ import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
29
+ import { createHash } from "node:crypto";
30
+ import { join, resolve, dirname, basename } from "node:path";
31
+ var ROOT = process.env.CLAUDE_PROJECT_DIR || process.cwd();
32
+ var CROSSREF = "https://api.crossref.org/works/";
33
+ var ARXIV = "https://export.arxiv.org/api/query?id_list=";
34
+ var UA = "extract-ref-facts/1.0 (https://github.com/; paper-pipeline citation facts)";
35
+ var SCHEMA = 1;
36
+ var joinName = (a) => a.name ?? [a.firstName, a.prefix, a.lastName, a.suffix].filter(Boolean).join(" ").trim();
37
+ function factEntries(bib) {
38
+ const lineOf = (at) => bib.text.slice(0, at).split("\n").length;
39
+ return bib.entries.map((e, i) => {
40
+ const f = e.fields;
41
+ const names = e.names.author ?? [];
42
+ const isOthers = (a) => !a.firstName && /^others$/i.test(a.lastName ?? "");
43
+ const truncated = names.some(isOthers);
44
+ const authors = names.filter((a) => !isOthers(a)).map(joinName).filter(Boolean);
45
+ const str = (v) => v ?? "";
46
+ const venueText = [f.booktitle, f.journal, f.note, f.howpublished].map(str).filter(Boolean).join(" ");
47
+ return {
48
+ n: i + 1,
49
+ line: lineOf(e.span.start),
50
+ key: e.key,
51
+ // `raw` is where identifiers are looked for: they hide in `note`, in `journal`
52
+ // (`arXiv preprint arXiv:2107.03374`), and in a separate `doi` field.
53
+ raw: [
54
+ authors.join(" and "),
55
+ str(f.title),
56
+ venueText,
57
+ str(f.doi),
58
+ str(f.url),
59
+ str(f.year)
60
+ ].filter(Boolean).join(" "),
61
+ authors,
62
+ truncated,
63
+ title: str(f.title).trim() || null,
64
+ year: str(f.year).trim() || null,
65
+ venue_text: [venueText, str(f.doi)].filter(Boolean).join(" "),
66
+ // In BibTeX a DOI is declared as a field rather than hidden in prose — take it directly.
67
+ doi_field: str(f.doi).trim() || null
68
+ };
69
+ });
70
+ }
71
+ var ARXIV_RE = /arxiv[:\s]\s*(\d{4}\.\d{4,5})(v\d+)?/i;
72
+ var DOI_RE = /(?:doi[:\s]\s*|doi\.org\/)(10\.\d{4,9}\/[^\s,;)}]+)/i;
73
+ var ARXIV_RE_G = new RegExp(ARXIV_RE.source, "gi");
74
+ var DOI_RE_G = new RegExp(DOI_RE.source, "gi");
75
+ function extractIds(entry) {
76
+ const hay = `${entry.venue_text ?? ""} ${entry.raw ?? ""}`;
77
+ const uniq = (xs) => [...new Set(xs)];
78
+ const doi = uniq([
79
+ ...entry.doi_field ? [entry.doi_field] : [],
80
+ // A trailing period belongs to the sentence, not to the DOI. Suffixes legitimately contain
81
+ // periods (10.18653/v1/2020.acl-main.168), so only the LAST one is stripped.
82
+ ...[...hay.matchAll(DOI_RE_G)].map((m) => m[1].replace(/[.,]$/, ""))
83
+ ]);
84
+ return { arxiv: uniq([...hay.matchAll(ARXIV_RE_G)].map((m) => m[1])), doi };
85
+ }
86
+ var ARXIV_DOI = /^10\.48550\/arxiv\.(\d{4}\.\d{4,5})(v\d+)?$/i;
87
+ var primaryOf = (ids) => ids.doi.length ? `doi:${ids.doi[0]}` : ids.arxiv.length ? `arxiv:${ids.arxiv[0]}` : null;
88
+ var allKeys = (ids) => [
89
+ ...ids.doi.map((d) => `doi:${d}`),
90
+ ...ids.arxiv.map((a) => `arxiv:${a}`)
91
+ ];
92
+ function routeOf(key) {
93
+ const kind = key.slice(0, key.indexOf(":"));
94
+ const id = key.slice(key.indexOf(":") + 1);
95
+ if (kind === "arxiv")
96
+ return { registry: "arxiv", url: ARXIV + encodeURIComponent(id) };
97
+ const m = ARXIV_DOI.exec(id);
98
+ if (m) return { registry: "arxiv", url: ARXIV + encodeURIComponent(m[1]) };
99
+ return { registry: "crossref", url: CROSSREF + encodeURIComponent(id) };
100
+ }
101
+ function readCrossref(body) {
102
+ const j = JSON.parse(body);
103
+ const m = j.message;
104
+ if (!m) return null;
105
+ const dp = m.issued?.["date-parts"]?.[0]?.[0] ?? m["published-print"]?.["date-parts"]?.[0]?.[0] ?? m["published-online"]?.["date-parts"]?.[0]?.[0] ?? null;
106
+ const parts = [
107
+ ...Array.isArray(m.title) ? m.title : [m.title],
108
+ ...Array.isArray(m.subtitle) ? m.subtitle : m.subtitle ? [m.subtitle] : []
109
+ ];
110
+ return {
111
+ title: parts.filter(Boolean).join(": "),
112
+ authors: (m.author ?? []).map((a) => a.family ?? a.name ?? ""),
113
+ year: dp ? String(dp) : null,
114
+ venue: Array.isArray(m["container-title"]) ? m["container-title"][0] : m["container-title"],
115
+ journalRef: null,
116
+ doi: null,
117
+ error: false
118
+ };
119
+ }
120
+ function readArxiv(body) {
121
+ const entry = /<entry>([\s\S]*?)<\/entry>/.exec(body);
122
+ if (!entry) return null;
123
+ const e = entry[1];
124
+ const tag = (name) => {
125
+ const m = new RegExp(`<${name}[^>]*>([\\s\\S]*?)</${name}>`).exec(e);
126
+ return m ? unescapeXml(m[1]).replace(/\s+/g, " ").trim() : null;
127
+ };
128
+ const authors = [
129
+ ...e.matchAll(
130
+ /<author>[\s\S]*?<name>([\s\S]*?)<\/name>[\s\S]*?<\/author>/g
131
+ )
132
+ ].map((m) => unescapeXml(m[1]).replace(/\s+/g, " ").trim());
133
+ const published = tag("published");
134
+ return {
135
+ title: tag("title"),
136
+ authors,
137
+ year: published ? published.slice(0, 4) : null,
138
+ venue: null,
139
+ // arXiv's own "this came out somewhere" fields. Either of them means a published version
140
+ // exists.
141
+ journalRef: tag("arxiv:journal_ref"),
142
+ doi: tag("arxiv:doi"),
143
+ // A search for a withdrawn or invented id still returns an <entry> whose id echoes the query;
144
+ // a real entry's title is never "Error".
145
+ error: /^Error$/i.test(tag("title") ?? "")
146
+ };
147
+ }
148
+ var unescapeXml = (s) => s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
149
+ function loadCache(path) {
150
+ if (!path || !existsSync(path)) return {};
151
+ try {
152
+ return JSON.parse(readFileSync(path, "utf8"));
153
+ } catch {
154
+ return {};
155
+ }
156
+ }
157
+ function saveCache(path, cache) {
158
+ mkdirSync(dirname(path), { recursive: true });
159
+ writeFileSync(path, `${JSON.stringify(cache, null, 1)}
160
+ `);
161
+ }
162
+ async function fetchKey(key) {
163
+ const { url } = routeOf(key);
164
+ const r = await fetch(url, { headers: { "User-Agent": UA } });
165
+ return {
166
+ httpStatus: r.status,
167
+ body: await r.text(),
168
+ fetched: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
169
+ };
170
+ }
171
+ function recordFrom(key, cached) {
172
+ if (!cached) return { cached: false };
173
+ const { registry } = routeOf(key);
174
+ const base = {
175
+ cached: true,
176
+ registry,
177
+ httpStatus: cached.httpStatus ?? null,
178
+ fetched: cached.fetched ?? null
179
+ };
180
+ if (cached.httpStatus !== 200) return base;
181
+ let rec;
182
+ try {
183
+ rec = registry === "crossref" ? readCrossref(cached.body) : readArxiv(cached.body);
184
+ } catch (e) {
185
+ return {
186
+ ...base,
187
+ found: false,
188
+ parse_error: String(e.message).split("\n")[0]
189
+ };
190
+ }
191
+ if (!rec) return { ...base, found: false };
192
+ return { ...base, found: !rec.error, ...rec };
193
+ }
194
+ var DEPS = {
195
+ files: nodeFiles,
196
+ codec: sourcesCodec,
197
+ latex: latexReader,
198
+ bib: bibReader
199
+ };
200
+ function bibliographyFrom(target) {
201
+ const r = bibliographyAt(absolutePath(resolve(target)), DEPS);
202
+ if (!r.ok) return { ok: false, why: bibliographyUnreadWhy(r.error) };
203
+ const { paperDir, texts } = r.value;
204
+ return { ok: true, paperDir, texts };
205
+ }
206
+ function loadEntries(bib) {
207
+ const file = rel(bib.path);
208
+ return factEntries(bib).map((e) => ({ ...e, file }));
209
+ }
210
+ function keysFor(entries) {
211
+ const keys = /* @__PURE__ */ new Set();
212
+ for (const e of entries) for (const k of allKeys(extractIds(e))) keys.add(k);
213
+ return [...keys];
214
+ }
215
+ var rel = (p) => p.startsWith(ROOT) ? p.slice(ROOT.length + 1) : p;
216
+ function buildFacts({ texts, entries, cache, cachePath }) {
217
+ const withIds = entries.map((e) => {
218
+ const ids = extractIds(e);
219
+ return { ...e, ids, primary: primaryOf(ids), keys: allKeys(ids) };
220
+ });
221
+ const records = {};
222
+ for (const e of withIds)
223
+ for (const k of e.keys)
224
+ if (!(k in records)) records[k] = recordFrom(k, cache[k]);
225
+ return {
226
+ schema: SCHEMA,
227
+ source: rel(texts[0].path),
228
+ sources: [...new Set(texts.map((b) => rel(b.path)))],
229
+ source_kind: "bibtex",
230
+ source_sha256: [...new Set(texts.map((b) => b.text))].reduce((h, t) => h.update(t), createHash("sha256")).digest("hex"),
231
+ cache: cachePath ? rel(cachePath) : null,
232
+ generated: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
233
+ entries: withIds,
234
+ records
235
+ };
236
+ }
237
+ async function main(argv) {
238
+ const args = argv.slice(2);
239
+ const target = args.find((a) => !a.startsWith("--")) ?? ".";
240
+ const offline = args.includes("--offline");
241
+ const refresh = args.includes("--refresh");
242
+ const quiet = args.includes("--quiet");
243
+ const opt = (name) => (args.find((a) => a.startsWith(`--${name}=`)) ?? "").split("=").slice(1).join("=");
244
+ const found = bibliographyFrom(target);
245
+ if (!found.ok) {
246
+ console.error(`\u{1F6D1} ${found.why}.`);
247
+ return 1;
248
+ }
249
+ const { paperDir, texts } = found;
250
+ const cachePath = opt("cache") ? resolve(opt("cache")) : join(paperDir, "repro", "data", "refs-cache.json");
251
+ const out = opt("out") ? resolve(opt("out")) : join(paperDir, "_build", "refs.facts.json");
252
+ const entries = texts.flatMap(loadEntries);
253
+ const names = [...new Set(texts.map((b) => basename(b.path)))].join(", ");
254
+ if (!entries.length) {
255
+ console.error(
256
+ `\u{1F6D1} parsed 0 entries out of ${[...new Set(texts.map((b) => rel(b.path)))].join(", ")}. Silence here would look like a clean bibliography.`
257
+ );
258
+ return 1;
259
+ }
260
+ const cache = loadCache(cachePath);
261
+ let fetched = 0;
262
+ if (!offline) {
263
+ for (const k of keysFor(entries)) {
264
+ if (cache[k] && !refresh) continue;
265
+ try {
266
+ cache[k] = await fetchKey(k);
267
+ fetched++;
268
+ } catch (err) {
269
+ if (!quiet) console.error(` \u2026 ${k}: ${err.message}`);
270
+ }
271
+ await new Promise((r) => {
272
+ setTimeout(r, 250);
273
+ });
274
+ }
275
+ if (fetched) saveCache(cachePath, cache);
276
+ }
277
+ const facts = buildFacts({ texts, entries, cache, cachePath });
278
+ mkdirSync(dirname(out), { recursive: true });
279
+ writeFileSync(out, `${JSON.stringify(facts, null, 2)}
280
+ `);
281
+ const resolved = Object.values(facts.records).filter((r) => r.found).length;
282
+ console.log(
283
+ `\u{1F4DA} ${names} \u2192 ${rel(out)} (${entries.length} entries, ${Object.keys(facts.records).length} identifiers, ${resolved} resolved${offline ? ", offline" : fetched ? `, +${fetched} fetched` : ", all from cache"})`
284
+ );
285
+ return 0;
286
+ }
287
+ if (isMain(import.meta.url)) main(process.argv).then((c) => process.exit(c));
288
+ export {
289
+ ARXIV_DOI,
290
+ SCHEMA,
291
+ allKeys,
292
+ bibliographyFrom,
293
+ buildFacts,
294
+ extractIds,
295
+ factEntries,
296
+ keysFor,
297
+ loadCache,
298
+ loadEntries,
299
+ primaryOf,
300
+ readArxiv,
301
+ readCrossref,
302
+ recordFrom,
303
+ routeOf
304
+ };