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
package/src/init.test.ts CHANGED
@@ -18,12 +18,14 @@ import {
18
18
  writeFileSync,
19
19
  } from "node:fs";
20
20
  import { tmpdir } from "node:os";
21
- import { join } from "node:path";
21
+ import { join, relative } from "node:path";
22
22
  import { afterEach, describe, expect, it } from "vitest";
23
23
  import { FRESH_CLONE_NOTE } from "./hooks-settings.ts";
24
24
  import { load as yamlLoad } from "js-yaml";
25
25
  import { z } from "zod";
26
26
  import {
27
+ CANCELLED_CODE,
28
+ CANCELLED_LINE,
27
29
  WORKFLOW_PATH,
28
30
  choosePapers,
29
31
  declarePapers,
@@ -36,7 +38,7 @@ import {
36
38
  reportWorkflow,
37
39
  workflowYaml,
38
40
  } from "./init.ts";
39
- import { runNode } from "../test/support.ts";
41
+ import { runNode, scriptedPrompts, type Reply } from "../test/support.ts";
40
42
  import { nodeFiles } from "./adapters/node/index.ts";
41
43
  import { presetsDir } from "./package-dirs.ts";
42
44
  import { shippedVenueNames } from "./presets.ts";
@@ -94,24 +96,29 @@ describe("paperlint init — a declared papers directory", () => {
94
96
 
95
97
  it("is not asked about, even with a human at the terminal", async () => {
96
98
  const root = project();
97
- const asked: string[] = [];
99
+ const prompts = scriptedPrompts(() => false);
98
100
  await init(root, {
99
101
  cwd: root,
100
102
  log: () => {},
101
103
  err: () => {},
102
104
  interactive: true,
103
- ask: (q) => Promise.resolve((asked.push(q), "n")),
105
+ prompts,
104
106
  hooks: false,
105
107
  run: () => ({ status: 0 }),
106
108
  link: () => ({ ok: false, error: "not linked in this test" }),
107
109
  });
108
- expect(asked.filter((q) => /papers roots/.test(q))).toEqual([]);
110
+ expect(prompts.asked).toEqual([
111
+ "add a GitHub Actions workflow that runs this in CI?",
112
+ ]);
109
113
  });
110
114
 
111
115
  it("without a declaration, the candidates are still measured and offered", async () => {
112
116
  const choice = await choosePapers(project(), { interactive: false });
113
- expect(choice.how).toBe("not-asked");
114
- expect(choice.candidates.length).toBeGreaterThan(1);
117
+ expect(choice).toEqual({
118
+ papers: "drafts",
119
+ how: "not-asked",
120
+ candidates: ["drafts", "eslint-rules/fixtures", "papers"],
121
+ });
115
122
  });
116
123
  });
117
124
 
@@ -161,25 +168,26 @@ describe("paperlint init — writes paperlint.json only when something differs f
161
168
  /** Runs init in a fresh directory with the given TeX Live port; what it printed and asked. */
162
169
  const texRun = async (
163
170
  tex: { installed: () => boolean; install?: () => number },
164
- { interactive, answer = "" }: { interactive: boolean; answer?: string },
171
+ { interactive, answer }: { interactive: boolean; answer?: Reply },
165
172
  ) => {
166
173
  const root = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-tex-")));
167
174
  dirs.push(root);
168
175
  const out: string[] = [];
169
- const asked: string[] = [];
170
- await init(root, {
176
+ const prompts = scriptedPrompts((q) =>
177
+ /TeX Live/.test(q) ? answer : undefined,
178
+ );
179
+ const code = await init(root, {
171
180
  cwd: root,
172
181
  log: (s: string) => out.push(s),
173
182
  err: () => {},
174
183
  interactive,
175
- ask: (q) =>
176
- Promise.resolve((asked.push(q), /TeX Live/.test(q) ? answer : "")),
184
+ prompts,
177
185
  hooks: false,
178
186
  run: () => ({ status: 0 }),
179
187
  link: () => ({ ok: false as const, error: "not linked in this test" }),
180
188
  tex,
181
189
  });
182
- return { text: out.join("\n"), asked };
190
+ return { text: out.join("\n"), asked: prompts.asked, code };
183
191
  };
184
192
 
185
193
  describe("paperlint init — TeX Live is offered with its cost, never installed unasked", () => {
@@ -201,10 +209,10 @@ describe("paperlint init — TeX Live is offered with its cost, never installed
201
209
  let installs = 0;
202
210
  const r = await texRun(
203
211
  { installed: () => false, install: () => (installs++, 0) },
204
- { interactive: true, answer: "y" },
212
+ { interactive: true, answer: true },
205
213
  );
206
- expect(r.asked.find((q) => /TeX Live/.test(q))).toMatch(
207
- /~270 MB, ~3 min, once\) \[y\/N\]/,
214
+ expect(r.asked.find((q) => /TeX Live/.test(q))).toBe(
215
+ "install TeX Live now, for `paperlint build`? (~270 MB, ~3 min, once)",
208
216
  );
209
217
  expect(installs).toBe(1);
210
218
  expect(r.text).not.toMatch(/next: .*\n.*npx paperlint toolchain/);
@@ -220,10 +228,24 @@ describe("paperlint init — TeX Live is offered with its cost, never installed
220
228
  expect(r.text).toMatch(/declined — nothing installed/);
221
229
  });
222
230
 
231
+ it("🔴 Ctrl+C at the question installs nothing, stops init and exits 130", async () => {
232
+ let installs = 0;
233
+ const r = await texRun(
234
+ { installed: () => false, install: () => (installs++, 0) },
235
+ { interactive: true, answer: "cancel" },
236
+ );
237
+ expect([installs, r.code, r.text.split("\n").at(-1)]).toEqual([
238
+ 0,
239
+ CANCELLED_CODE,
240
+ CANCELLED_LINE,
241
+ ]);
242
+ expect(r.text).not.toMatch(/paperlint doctor/);
243
+ });
244
+
223
245
  it("already installed: not asked about", async () => {
224
246
  const r = await texRun(
225
247
  { installed: () => true, install: () => 0 },
226
- { interactive: true, answer: "y" },
248
+ { interactive: true, answer: true },
227
249
  );
228
250
  expect(r.asked.filter((q) => /TeX Live/.test(q))).toEqual([]);
229
251
  expect(r.text).toMatch(/✓ paperlint's TeX Live is installed/);
@@ -327,13 +349,29 @@ describe("paperlint init — how several candidate directories were decided, sai
327
349
  out.slice(out.indexOf("papers directory") + 1, out.indexOf("settings") - 1);
328
350
 
329
351
  it("picked by a human", async () => {
330
- const r = await initRun(several(), {
331
- interactive: true,
332
- ask: () => Promise.resolve("2"),
333
- });
352
+ const prompts = scriptedPrompts((q) =>
353
+ /papers roots/.test(q) ? "writing" : false,
354
+ );
355
+ const r = await initRun(several(), { interactive: true, prompts });
334
356
  expect(section(r.out)).toEqual([
335
357
  " ✓ writing — you picked it out of 2 candidates",
336
358
  ]);
359
+ expect(prompts.asked[0]).toBe(
360
+ "several directories look like papers roots — which one?",
361
+ );
362
+ });
363
+
364
+ it("🔴 Ctrl+C at the choice writes no paperlint.json and exits 130", async () => {
365
+ const root = several();
366
+ const r = await initRun(root, {
367
+ interactive: true,
368
+ prompts: scriptedPrompts(() => "cancel"),
369
+ });
370
+ expect([r.code, r.out.slice(2)]).toEqual([
371
+ CANCELLED_CODE,
372
+ [CANCELLED_LINE],
373
+ ]);
374
+ expect(existsSync(join(root, "paperlint.json"))).toBe(false);
337
375
  });
338
376
 
339
377
  it("no terminal: the first, and the others named", async () => {
@@ -344,10 +382,12 @@ describe("paperlint init — how several candidate directories were decided, sai
344
382
  ]);
345
383
  });
346
384
 
347
- it("an answer that picks nothing: the first, and said so", async () => {
385
+ it("a question that failed (the stream ended): the first, and said so", async () => {
348
386
  const r = await initRun(several(), {
349
387
  interactive: true,
350
- ask: () => Promise.resolve("nine"),
388
+ prompts: scriptedPrompts((q) =>
389
+ /papers roots/.test(q) ? new Error("stream ended") : false,
390
+ ),
351
391
  });
352
392
  expect(section(r.out)[0]).toBe(
353
393
  " ✓ drafts — 2 candidates, no answer was given, so the first one was taken",
@@ -479,7 +519,7 @@ describe("paperlint init — TeX Live and hooks failures, whole", () => {
479
519
  it("TeX Live: a failed install says to run it again", async () => {
480
520
  const t = await offerTexLive(
481
521
  { installed: () => false, install: () => 1 },
482
- { interactive: true, ask: () => Promise.resolve("yes") },
522
+ { interactive: true, prompts: scriptedPrompts(() => true) },
483
523
  );
484
524
  expect([t, reportTexLive(t, "")]).toEqual([
485
525
  "failed",
@@ -501,6 +541,26 @@ describe("paperlint init — TeX Live and hooks failures, whole", () => {
501
541
  });
502
542
  expect(outcome).toEqual({ status: "failed", reason: "merge exploded" });
503
543
  });
544
+
545
+ it("hooks: a question that failed (the stream ended) takes the stated default, YES; a No declines", async () => {
546
+ const ask = async (reply: boolean | Error) => {
547
+ const root = tree({});
548
+ const outcome = await offerHooks(root, {
549
+ hooks: true,
550
+ interactive: true,
551
+ prompts: scriptedPrompts(() => reply),
552
+ });
553
+ // Each run has its own temp root: compare where it wrote, relative to that root.
554
+ return "path" in outcome
555
+ ? { ...outcome, path: relative(root, outcome.path) }
556
+ : outcome;
557
+ };
558
+ // Guards: the failed question wires exactly what an explicit yes wires, not a decline.
559
+ expect([await ask(new Error("stream ended")), await ask(false)]).toEqual([
560
+ await ask(true),
561
+ { status: "declined" },
562
+ ]);
563
+ });
504
564
  });
505
565
 
506
566
  describe("paperlint init — a first paper", () => {
@@ -508,7 +568,7 @@ describe("paperlint init — a first paper", () => {
508
568
  const made: string[] = [];
509
569
  const r = await initRun(tree({}), {
510
570
  interactive: true,
511
- ask: () => Promise.resolve(""),
571
+ prompts: scriptedPrompts((q) => (/first paper/.test(q) ? "" : false)),
512
572
  createPaper: (_root, name) => Promise.resolve((made.push(name), 0)),
513
573
  });
514
574
  expect(made).toEqual([]);
@@ -516,17 +576,68 @@ describe("paperlint init — a first paper", () => {
516
576
  " · none yet. `npx paperlint new <name>` or `--paper <name>` creates one",
517
577
  );
518
578
  });
579
+
580
+ it("a name typed at the prompt creates that paper", async () => {
581
+ const made: string[] = [];
582
+ await initRun(tree({}), {
583
+ interactive: true,
584
+ prompts: scriptedPrompts((q) =>
585
+ /first paper/.test(q) ? " draft-one " : false,
586
+ ),
587
+ createPaper: (_root, name) => Promise.resolve((made.push(name), 0)),
588
+ });
589
+ expect(made).toEqual(["draft-one"]);
590
+ });
591
+
592
+ it("🔴 Ctrl+C at the name creates nothing and exits 130", async () => {
593
+ const made: string[] = [];
594
+ const r = await initRun(tree({}), {
595
+ interactive: true,
596
+ prompts: scriptedPrompts((q) =>
597
+ /first paper/.test(q) ? "cancel" : false,
598
+ ),
599
+ createPaper: (_root, name) => Promise.resolve((made.push(name), 0)),
600
+ });
601
+ expect([made, r.code, r.out.at(-1)]).toEqual([
602
+ [],
603
+ CANCELLED_CODE,
604
+ CANCELLED_LINE,
605
+ ]);
606
+ });
607
+ });
608
+
609
+ describe("paperlint init — Ctrl+C at the hooks or the workflow question", () => {
610
+ it("🔴 at the hooks: nothing is wired, and nothing after it is asked", async () => {
611
+ const root = tree({});
612
+ const prompts = scriptedPrompts(() => "cancel");
613
+ const r = await initRun(root, { interactive: true, hooks: true, prompts });
614
+ expect([r.code, r.out.at(-1), prompts.asked.length]).toEqual([
615
+ CANCELLED_CODE,
616
+ CANCELLED_LINE,
617
+ 1,
618
+ ]);
619
+ expect(existsSync(join(root, ".claude", "settings.json"))).toBe(false);
620
+ });
621
+
622
+ it("🔴 at the workflow: no file, exit 130", async () => {
623
+ const root = tree({});
624
+ const r = await initRun(root, {
625
+ interactive: true,
626
+ prompts: scriptedPrompts(() => "cancel"),
627
+ });
628
+ expect([r.code, r.out.at(-1)]).toEqual([CANCELLED_CODE, CANCELLED_LINE]);
629
+ expect(existsSync(join(root, WORKFLOW_PATH))).toBe(false);
630
+ });
519
631
  });
520
632
 
521
633
  describe("paperlint init — a first paper named after a venue", () => {
522
634
  it("--paper aisec-2026 is refused before anything is asked, and createPaper is not called", async () => {
523
635
  const made: string[] = [];
524
- const asked: string[] = [];
525
636
  const r = await initRun(tree({}), {
526
637
  interactive: true,
527
638
  paper: "aisec-2026",
528
639
  venues: shippedVenueNames({ files: nodeFiles, venuesDir: presetsDir() }),
529
- ask: (q) => Promise.resolve((asked.push(q), "")),
640
+ prompts: scriptedPrompts(() => false),
530
641
  createPaper: (_root, name) => Promise.resolve((made.push(name), 0)),
531
642
  });
532
643
  expect(made).toEqual([]);