paperlint 19.0.1 → 19.0.3

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 (93) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CLAUDE.md +2 -2
  3. package/dist/CLAUDE.md.spec.d.ts.map +1 -1
  4. package/dist/CLAUDE.md.spec.js +7 -1
  5. package/dist/CLAUDE.md.spec.js.map +1 -1
  6. package/dist/cli.d.ts +2 -21
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +46 -98
  9. package/dist/cli.js.map +1 -1
  10. package/dist/doctor.d.ts +8 -10
  11. package/dist/doctor.d.ts.map +1 -1
  12. package/dist/doctor.js +27 -37
  13. package/dist/doctor.js.map +1 -1
  14. package/dist/folder-layout-hook.js +1 -1
  15. package/dist/hooks-notice.d.ts +9 -1
  16. package/dist/hooks-notice.d.ts.map +1 -1
  17. package/dist/hooks-notice.js +16 -18
  18. package/dist/hooks-notice.js.map +1 -1
  19. package/dist/hooks-settings.d.ts +1 -1
  20. package/dist/hooks-settings.js +1 -1
  21. package/dist/init.d.ts +1 -1
  22. package/dist/init.js +5 -5
  23. package/dist/lib/paper-config.d.ts +4 -9
  24. package/dist/lib/paper-config.d.ts.map +1 -1
  25. package/dist/lib/paper-config.js +4 -9
  26. package/dist/lib/paper-config.js.map +1 -1
  27. package/dist/papers-roots.d.ts +19 -0
  28. package/dist/papers-roots.d.ts.map +1 -0
  29. package/dist/papers-roots.js +42 -0
  30. package/dist/papers-roots.js.map +1 -0
  31. package/dist/retired-hooks.d.ts +6 -0
  32. package/dist/retired-hooks.d.ts.map +1 -0
  33. package/dist/retired-hooks.js +34 -0
  34. package/dist/retired-hooks.js.map +1 -0
  35. package/dist/skill-chunks/chunk-C2G5EK7S.js +579 -0
  36. package/dist/skill-chunks/{chunk-UL4INX2P.js → chunk-L3NJUJUP.js} +446 -446
  37. package/dist/skill-chunks/{chunk-EOVEVX67.js → chunk-X4VKG4KT.js} +1 -1
  38. package/dist/types.d.ts +1 -1
  39. package/docs/install.md +12 -14
  40. package/docs/layout.md +2 -5
  41. package/docs/rules/paper/allowed-files-only.md +1 -2
  42. package/docs/testing.md +1 -1
  43. package/eslint.config.mjs +1 -1
  44. package/lib/paper-config.harness.mjs +4 -8
  45. package/lib/paper-config.ts +4 -9
  46. package/package.json +2 -3
  47. package/plugin/hooks/hooks.json +0 -22
  48. package/scripts/coverage-config.test.ts +0 -1
  49. package/scripts/eslint-file-length.mjs +0 -1
  50. package/skills/argument-arc/scripts/headings.js +2 -2
  51. package/skills/build-label-page/scripts/label-page.js +125 -125
  52. package/skills/cold-read-diff/scripts/cold-read.js +11 -11
  53. package/skills/paper-pipeline/scripts/extract-ref-facts.js +3 -3
  54. package/skills/paper-status/SKILL.md +1 -2
  55. package/skills/paper-status/SKILL.md.spec.ts +0 -1
  56. package/skills/pc-panel-review/scripts/prior-reviews.js +1 -1
  57. package/skills/verify-citations/scripts/bib-authors.js +3 -3
  58. package/skills/verify-citations/scripts/verify-cites.js +3 -3
  59. package/src/CLAUDE.md +16 -1
  60. package/src/CLAUDE.md.spec.ts +12 -1
  61. package/src/cli.harness.mjs +16 -80
  62. package/src/cli.test.ts +6 -36
  63. package/src/cli.ts +49 -145
  64. package/src/doctor.harness.mjs +17 -59
  65. package/src/doctor.test.ts +1 -1
  66. package/src/doctor.ts +26 -41
  67. package/src/domain/paper-folder.test.ts +1 -1
  68. package/src/folder-layout-hook.ts +1 -1
  69. package/src/hooks-notice.test.ts +21 -74
  70. package/src/hooks-notice.ts +37 -18
  71. package/src/hooks-settings.harness.ts +27 -29
  72. package/src/hooks-settings.ts +1 -1
  73. package/src/in-process-hooks.test.ts +18 -0
  74. package/src/init.ts +5 -5
  75. package/src/lint-edited-site-example.test.ts +0 -3
  76. package/src/papers-roots.test.ts +56 -0
  77. package/src/papers-roots.ts +56 -0
  78. package/src/retired-hooks.test.ts +155 -0
  79. package/src/retired-hooks.ts +41 -0
  80. package/src/types.ts +1 -1
  81. package/dist/skill-chunks/chunk-GRSXIWYF.js +0 -352
  82. package/hooks/CLAUDE.md +0 -34
  83. package/hooks/CLAUDE.md.spec.ts +0 -30
  84. package/hooks/hooks.harness.ts +0 -704
  85. package/hooks/paper-edit-guard.hook.d.mts +0 -12
  86. package/hooks/paper-edit-guard.hook.mjs +0 -443
  87. package/hooks/paper-edit-guard.test.ts +0 -66
  88. package/hooks/paper-skills-nudge.hook.d.mts +0 -22
  89. package/hooks/paper-skills-nudge.hook.mjs +0 -199
  90. package/hooks/paper-skills-nudge.test.ts +0 -122
  91. package/hooks/paper-status-gates.hook.mjs +0 -158
  92. package/hooks/paper-status-gates.sh +0 -93
  93. package/hooks/paper-status-gates.test.ts +0 -101
@@ -10,7 +10,7 @@ import {
10
10
  parseLatex,
11
11
  sourcesCodec,
12
12
  visit
13
- } from "../../../dist/skill-chunks/chunk-UL4INX2P.js";
13
+ } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
14
14
  import {
15
15
  messageOf,
16
16
  nodeFiles,
@@ -18,9 +18,9 @@ import {
18
18
  readPaper
19
19
  } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
20
20
  import {
21
- t,
22
- t10 as t2
23
- } from "../../../dist/skill-chunks/chunk-GRSXIWYF.js";
21
+ chunk,
22
+ last
23
+ } from "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
24
24
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
25
25
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
26
26
 
@@ -58,8 +58,8 @@ var spanOf = (p) => {
58
58
  };
59
59
  };
60
60
  var lineAt = (src, offset) => src.slice(0, offset).split("\n").length;
61
- var sourceOf = (src, first, last) => {
62
- const lines = src.split("\n").slice(first - 1, last).join("\n");
61
+ var sourceOf = (src, first, last2) => {
62
+ const lines = src.split("\n").slice(first - 1, last2).join("\n");
63
63
  const notes = [];
64
64
  visit(parseLatex(lines).root, (node) => {
65
65
  const at = node.position;
@@ -74,16 +74,16 @@ ${text.slice(n.end)}`,
74
74
  };
75
75
  var isNote = (line) => line.trimStart().startsWith("%");
76
76
  var merged = (ranges) => [...ranges].sort((a, b) => a.start - b.start).reduce((out, r) => {
77
- const last = out.at(-1);
78
- return last !== void 0 && r.start <= last.end ? [
77
+ const last2 = out.at(-1);
78
+ return last2 !== void 0 && r.start <= last2.end ? [
79
79
  ...out.slice(0, -1),
80
- { start: last.start, end: Math.max(last.end, r.end) }
80
+ { start: last2.start, end: Math.max(last2.end, r.end) }
81
81
  ] : [...out, { start: r.start, end: r.end }];
82
82
  }, []);
83
83
  var touched = (b, lines, deletions) => lines.some((n) => n >= b.start && n <= b.end) || deletions.some((d) => d >= b.start && d + 1 <= b.end);
84
84
  var headingRanges = (src) => latexReader.headings(src).filter((h) => h.command.kind === "heading" && h.argument === "title").map((h) => ({
85
85
  start: lineAt(src, h.title.segments[0].at),
86
- end: lineAt(src, t2(h.title.segments).at)
86
+ end: lineAt(src, last(h.title.segments).at)
87
87
  }));
88
88
  var extract = (src, lines, deletions = []) => {
89
89
  const notes = new Set(
@@ -186,7 +186,7 @@ ${promptFor(ENGINEER, text)}
186
186
  === reviewer ===
187
187
  ${promptFor(reviewer(venue), text)}`;
188
188
  var chunked = (found, max, venue) => {
189
- const parts = t(found, max);
189
+ const parts = chunk(found, max);
190
190
  return parts.map((part, i) => {
191
191
  const label = `chunk ${String(i + 1)} of ${String(parts.length)}`;
192
192
  const text = numbered(part);
@@ -10,17 +10,17 @@ import {
10
10
  bibliographyAt,
11
11
  bibliographyUnreadWhy,
12
12
  isMain
13
- } from "../../../dist/skill-chunks/chunk-EOVEVX67.js";
13
+ } from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
14
14
  import {
15
15
  latexReader,
16
16
  sourcesCodec
17
- } from "../../../dist/skill-chunks/chunk-UL4INX2P.js";
17
+ } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
18
18
  import "../../../dist/skill-chunks/chunk-IREAROCV.js";
19
19
  import {
20
20
  absolutePath,
21
21
  nodeFiles
22
22
  } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
23
- import "../../../dist/skill-chunks/chunk-GRSXIWYF.js";
23
+ import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
24
24
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
25
25
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
26
26
 
@@ -4,7 +4,7 @@ description: Answer "what's the status of the paper?" in one pass — MEASURE wh
4
4
  allowed-tools: [Bash, Read, Grep, Glob]
5
5
  ---
6
6
 
7
- <!-- vigiles:sha256:0c5d170b48f86a8e compiled from skills/paper-status/SKILL.md.spec.ts -->
7
+ <!-- vigiles:sha256:5ecfb3138808a249 compiled from skills/paper-status/SKILL.md.spec.ts -->
8
8
 
9
9
  # paper-status — state, measured before it is narrated
10
10
 
@@ -89,7 +89,6 @@ and do not report from one of them alone:
89
89
  |---|---|---|
90
90
  | **`<paper-dir>/PIPELINE-STATUS.md`** | were the QUALITY stages run, and what did they conclude | per-stage `☑`/`◐`/`☐`/`⚠`, dates, the one-line submit-ready verdict |
91
91
  | **`<paper-dir>/SUBMIT-CHECKLIST.md`** | does it comply with the VENUE's format, and is the submission mechanics understood | page limit, template, blind model, mandatory sections, portal URL, whether a supplementary-upload field exists, the deadline converted to the author's own zone |
92
- | **`.claude/hooks/paper-skills-nudge.hook.ts`** | which gates EXIST at all | the canonical pre-submit gate list — use it to spot a gate nobody has ever run, which no scorecard row will show because the row was never added |
93
92
  | `<paper-dir>/CLAIMS.md` | what may still be claimed | 🔴 retired claims — flag if the current text asserts one |
94
93
  | `<paper-dir>/CLAUDE.md` | what this venue rewards | only when it changes what to do next |
95
94
 
@@ -96,7 +96,6 @@ and do not report from one of them alone:
96
96
  |---|---|---|
97
97
  | **\`<paper-dir>/PIPELINE-STATUS.md\`** | were the QUALITY stages run, and what did they conclude | per-stage \`☑\`/\`◐\`/\`☐\`/\`⚠\`, dates, the one-line submit-ready verdict |
98
98
  | **\`<paper-dir>/SUBMIT-CHECKLIST.md\`** | does it comply with the VENUE's format, and is the submission mechanics understood | page limit, template, blind model, mandatory sections, portal URL, whether a supplementary-upload field exists, the deadline converted to the author's own zone |
99
- | **\`.claude/hooks/paper-skills-nudge.hook.ts\`** | which gates EXIST at all | the canonical pre-submit gate list — use it to spot a gate nobody has ever run, which no scorecard row will show because the row was never added |
100
99
  | \`<paper-dir>/CLAIMS.md\` | what may still be claimed | 🔴 retired claims — flag if the current text asserts one |
101
100
  | \`<paper-dir>/CLAUDE.md\` | what this venue rewards | only when it changes what to do next |
102
101
 
@@ -20,7 +20,7 @@ import {
20
20
  nodeFiles,
21
21
  ok
22
22
  } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
23
- import "../../../dist/skill-chunks/chunk-GRSXIWYF.js";
23
+ import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
24
24
  import {
25
25
  external_exports
26
26
  } from "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
@@ -10,17 +10,17 @@ import {
10
10
  bibliographyAt,
11
11
  bibliographyUnreadWhy,
12
12
  isMain
13
- } from "../../../dist/skill-chunks/chunk-EOVEVX67.js";
13
+ } from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
14
14
  import {
15
15
  latexReader,
16
16
  sourcesCodec
17
- } from "../../../dist/skill-chunks/chunk-UL4INX2P.js";
17
+ } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
18
18
  import "../../../dist/skill-chunks/chunk-IREAROCV.js";
19
19
  import {
20
20
  absolutePath,
21
21
  nodeFiles
22
22
  } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
23
- import "../../../dist/skill-chunks/chunk-GRSXIWYF.js";
23
+ import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
24
24
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
25
25
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
26
26
 
@@ -11,17 +11,17 @@ import {
11
11
  bibliographyUnreadWhy,
12
12
  consumerContactEmail,
13
13
  isMain
14
- } from "../../../dist/skill-chunks/chunk-EOVEVX67.js";
14
+ } from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
15
15
  import {
16
16
  latexReader,
17
17
  sourcesCodec
18
- } from "../../../dist/skill-chunks/chunk-UL4INX2P.js";
18
+ } from "../../../dist/skill-chunks/chunk-L3NJUJUP.js";
19
19
  import "../../../dist/skill-chunks/chunk-IREAROCV.js";
20
20
  import {
21
21
  absolutePath,
22
22
  nodeFiles
23
23
  } from "../../../dist/skill-chunks/chunk-6NU6CXUS.js";
24
- import "../../../dist/skill-chunks/chunk-GRSXIWYF.js";
24
+ import "../../../dist/skill-chunks/chunk-C2G5EK7S.js";
25
25
  import "../../../dist/skill-chunks/chunk-4MHEJ6FR.js";
26
26
  import "../../../dist/skill-chunks/chunk-PJ4KNV4J.js";
27
27
 
package/src/CLAUDE.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- vigiles:sha256:599c83e36edde981 compiled from src/CLAUDE.md.spec.ts -->
1
+ <!-- vigiles:sha256:f188d1286e5637ac compiled from src/CLAUDE.md.spec.ts -->
2
2
 
3
3
  # CLAUDE.md
4
4
 
@@ -65,8 +65,23 @@ report nothing — dropping it turns the fixtures `src/domain/reads-disk.ts` and
65
65
  Rejected on 2026-09-27, so not proposed again: a separate `paperlint refs` command; the slowness it
66
66
  would have moved was a cache thrown away after every build (`docs/references.md`).
67
67
 
68
+ ## Hooks
69
+
70
+ The Claude Code hooks paperlint ships (`submission-confirm`, `paper-folder-layout`,
71
+ `lint-edited`) are app functions in `src/*-hook.ts`, run in-process by `paperlint hook <name>` from the
72
+ `IN_PROCESS_HOOKS` table in `src/cli.ts`. A bug in one does not break this repository; it breaks
73
+ somebody else's session.
74
+
68
75
  ## Rules
69
76
 
77
+ ### One Wiring File
78
+
79
+ **Guidance only** — The wiring is `plugin/hooks/hooks.json`. The Claude Code plugin ships it as its hooks, and `paperlint init` without the plugin merges it into the consumer's `.claude/settings.json`; there is no second copy.
80
+
81
+ ### In Process Hooks Frozen
82
+
83
+ **Guidance only** — `IN_PROCESS_HOOKS` is a workaround: a vigiles hook program may import only `vigiles/hook`, so a hook that needs this package's code was routed around the runtime. Do not add or grow an entry; the way out is zernie/vigiles#472, then #650, which moves the hooks to `hooks/<name>.hook.mjs`. `src/in-process-hooks.test.ts` fails when a name is added. Rejected for that move, so not proposed again: a `.hook.ts` hook (it does not load from `node_modules`), and a thin consumer-side `.hook.ts` importing the logic (`vigiles compile` refuses the import).
84
+
70
85
  ### Layers
71
86
 
72
87
  **Enforced by:** `eslint/boundaries/dependencies`
@@ -1,5 +1,5 @@
1
1
  // Compiled to src/CLAUDE.md by `npx vigiles compile`. Edit THIS file, never the markdown.
2
- import { enforce, file, instructionFile, prose } from "vigiles/spec";
2
+ import { enforce, file, guidance, instructionFile, prose } from "vigiles/spec";
3
3
 
4
4
  export default instructionFile({
5
5
  sections: {
@@ -59,8 +59,19 @@ report nothing — dropping it turns the fixtures \`src/domain/reads-disk.ts\` a
59
59
  "Readers and commands": prose`\`@retorquere/bibtex-parser\` is the one \`.bib\` reader, behind ${file("src/ports/bib-reader.ts")}.
60
60
  Rejected on 2026-09-27, so not proposed again: a separate \`paperlint refs\` command; the slowness it
61
61
  would have moved was a cache thrown away after every build (${file("docs/references.md")}).`,
62
+
63
+ Hooks: prose`The Claude Code hooks paperlint ships (\`submission-confirm\`, \`paper-folder-layout\`,
64
+ \`lint-edited\`) are app functions in \`src/*-hook.ts\`, run in-process by \`paperlint hook <name>\` from the
65
+ \`IN_PROCESS_HOOKS\` table in ${file("src/cli.ts")}. A bug in one does not break this repository; it breaks
66
+ somebody else's session.`,
62
67
  },
63
68
  rules: {
69
+ "one-wiring-file": guidance(
70
+ "The wiring is `plugin/hooks/hooks.json`. The Claude Code plugin ships it as its hooks, and `paperlint init` without the plugin merges it into the consumer's `.claude/settings.json`; there is no second copy.",
71
+ ),
72
+ "in-process-hooks-frozen": guidance(
73
+ "`IN_PROCESS_HOOKS` is a workaround: a vigiles hook program may import only `vigiles/hook`, so a hook that needs this package's code was routed around the runtime. Do not add or grow an entry; the way out is zernie/vigiles#472, then #650, which moves the hooks to `hooks/<name>.hook.mjs`. `src/in-process-hooks.test.ts` fails when a name is added. Rejected for that move, so not proposed again: a `.hook.ts` hook (it does not load from `node_modules`), and a thin consumer-side `.hook.ts` importing the logic (`vigiles compile` refuses the import).",
74
+ ),
64
75
  layers: enforce(
65
76
  "eslint/boundaries/dependencies",
66
77
  "Both axes: what a layer may import, and where an effect may be written.",
@@ -32,8 +32,9 @@ import { PAPERS_DIR_FIELD, findProjectRoot } from "../lib/paper-config.ts";
32
32
  import { createChecker } from "../lib/check.ts";
33
33
 
34
34
  const HERE = dirname(fileURLToPath(import.meta.url));
35
- const { run, parseArgs, buildConfig, nextSteps, toPaths, runHook } =
36
- await import(join(HERE, "cli.ts"));
35
+ const { run, parseArgs, buildConfig, nextSteps, runHook } = await import(
36
+ join(HERE, "cli.ts")
37
+ );
37
38
  const { init, choosePapers, offerWorkflow, missingPrograms, WORKFLOW_PATH } =
38
39
  await import(join(HERE, "init.ts"));
39
40
  const { PROGRAMS } = await import(join(HERE, "doctor.ts"));
@@ -156,13 +157,6 @@ check(
156
157
  "the old `--options` spelling keeps working — a flag in someone else's CI is not ours to break",
157
158
  parseArgs(["lint", "--options", "o.json"]).config === "o.json",
158
159
  );
159
- check(
160
- "the papers directory as a string and as a list normalize the same way",
161
- toPaths("papers")[0] === "papers" &&
162
- toPaths(["a", "b"]).length === 2 &&
163
- toPaths(undefined).length === 0 &&
164
- toPaths(" ").length === 0,
165
- );
166
160
 
167
161
  // ── config is assembled, and consumer data gets through ────────────────────────────────────
168
162
  {
@@ -293,8 +287,8 @@ check(
293
287
  // 🔴 THE DEFECT THIS COMMAND WAS REWRITTEN FOR (issue #33, measured 09-18): init wrote
294
288
  // a separate config file with a GUESSED `"papers": "papers"` and never touched `package.json` — while the
295
289
  // three hooks read the papers directory from exactly there. A consumer who did everything by
296
- // the book got a `paper-edit-guard` guarding a directory that did not exist; from outside that
297
- // is indistinguishable from a working guard, because silence is its success state.
290
+ // the book got hooks watching a directory that did not exist; from outside that is
291
+ // indistinguishable from working hooks, because silence is their success state.
298
292
  //
299
293
  // ⚠️ Questions here are NOT ASKED blind: `interactive` is passed explicitly, never read from
300
294
  // stdin. A harness stuck at an input prompt is not a red test, it is the absence of any answer
@@ -381,7 +375,7 @@ check(
381
375
  );
382
376
  check(
383
377
  "and exits zero on a consistent install",
384
- code === 0 && /the same directory/.test(out.text()),
378
+ code === 0 && /linted\s+writing\/drafts/.test(out.text()),
385
379
  );
386
380
  }
387
381
 
@@ -1164,82 +1158,24 @@ check(
1164
1158
  }
1165
1159
  }
1166
1160
 
1167
- // ── `paperlint hook` — THE RUNTIME RESOLVES FROM THE PACKAGE, NOT FROM THE PROJECT ROOT ────────
1168
- //
1169
- // 🔴 The measurement that gave rise to this command: one tarball, two package managers.
1170
- // npm: node_modules/vigiles/dist/cli.js EXISTS
1171
- // pnpm: node_modules/vigiles/dist/cli.js DOES NOT
1172
- // The old wiring addressed the runtime from the project root and did not resolve under pnpm,
1173
- // and `|| exit 2` on PreToolUse(Bash) turned that into a block on ANY command. The end-to-end
1174
- // half (both installs, real processes) lives in `test/e2e/install/install.e2e.ts`; here — the verdicts.
1161
+ // ── `paperlint hook` with no name or an unknown one — said, and never a denial (#324) ─────────
1175
1162
  {
1176
- const calls = [];
1177
- const fake = (code) => (bin, args, opts) => {
1178
- calls.push({ bin, args, opts });
1179
- return { status: code };
1180
- };
1181
1163
  let said = "";
1182
1164
  const err = (...a) => {
1183
1165
  said += a.join(" ") + "\n";
1184
1166
  };
1185
-
1186
- said = "";
1187
1167
  check(
1188
- "no name — a failure, and the right invocation is suggested",
1189
- runHook(undefined, { err }) === 2 &&
1190
- /paperlint hook paper-edit-guard/.test(said),
1168
+ "no name — the right invocation is suggested, and it does not deny",
1169
+ runHook(undefined, { err }) === 1 &&
1170
+ /paperlint hook lint-edited/.test(said),
1191
1171
  );
1192
-
1193
1172
  said = "";
1194
1173
  check(
1195
- "an unknown hook is NAMED together with the path it was looked for at",
1196
- runHook("no-such-hook", { err }) === 2 &&
1197
- /unknown hook `no-such-hook`/.test(said) &&
1198
- /no-such-hook\.hook\.mjs/.test(said),
1199
- );
1200
-
1201
- // 🔴 THE MAIN ASSERTION. A runtime that cannot be found HAS NO RIGHT to return 2: on
1202
- // PreToolUse that blocks any Bash command, including the one that would fix it. It must say
1203
- // so LOUDLY and let it through. Silent degradation is worse than an explicit one, but blocking
1204
- // everything is worse than both.
1205
- said = "";
1206
- calls.length = 0;
1207
- const brokenResolve = () => {
1208
- throw new Error("Cannot find module 'vigiles/dist/cli.js'");
1209
- };
1210
- const code = runHook("paper-edit-guard", {
1211
- err,
1212
- run: fake(0),
1213
- resolve: brokenResolve,
1214
- });
1215
- check(
1216
- "the runtime does not resolve — work is NOT blocked (code 0, not 2)",
1217
- code === 0,
1218
- );
1219
- check(
1220
- "and the complaint is LOUD: the hook is named, the effect is named, the remedy is named",
1221
- /paper-edit-guard/.test(said) &&
1222
- /is NOT running/.test(said) &&
1223
- /Reinstall this package/.test(said),
1224
- );
1225
- check("and the runtime was NOT started in the process", calls.length === 0);
1226
-
1227
- // The hook's real verdict passes through — otherwise the guard stops being a guard.
1228
- calls.length = 0;
1229
- check(
1230
- "the hook's verdict passes STRAIGHT THROUGH: 2 stays 2",
1231
- runHook("paper-edit-guard", { err, run: fake(2) }) === 2,
1232
- );
1233
- check(
1234
- "and EXACTLY the runtime with this hook's program is run",
1235
- calls.length === 1 &&
1236
- calls[0].args[1] === "hook-runtime" &&
1237
- calls[0].args[2] === "run-program" &&
1238
- /paper-edit-guard\.hook\.mjs$/.test(calls[0].args[3]),
1239
- );
1240
- check(
1241
- "zero stays zero",
1242
- runHook("paper-skills-nudge", { err, run: fake(0) }) === 0,
1174
+ "an unknown hook is NAMED with the installed version and the remedy, and does not deny",
1175
+ runHook("no-such-hook", { err }) === 1 &&
1176
+ /unknown hook `no-such-hook`.*no such hook.*paperlint \d+\.\d+\.\d+.*npm install/s.test(
1177
+ said,
1178
+ ),
1243
1179
  );
1244
1180
  }
1245
1181
 
@@ -1502,7 +1438,7 @@ console.log(
1502
1438
  check(
1503
1439
  "🔴 without a human the hooks default to YES — settings.json is written",
1504
1440
  existsSync(settings(dir)) &&
1505
- /hook paper-edit-guard/.test(readFileSync(settings(dir), "utf8")),
1441
+ /hook submission-confirm/.test(readFileSync(settings(dir), "utf8")),
1506
1442
  );
1507
1443
  check(
1508
1444
  "and the default names the flag that changes it",
package/src/cli.test.ts CHANGED
@@ -211,26 +211,6 @@ test("new with several papers directories says which one it used", async () => {
211
211
  );
212
212
  });
213
213
 
214
- test("runHook: a runtime with no cli.js beside it, and a hook killed by a signal, both let the tool call through", () => {
215
- const messages: string[] = [];
216
- const noCli = runHook("paper-edit-guard", {
217
- err: (m: string) => messages.push(m.split("\n")[0] ?? ""),
218
- resolve: () => join(root, "nowhere", "index.js"),
219
- });
220
- const killed = runHook("paper-edit-guard", {
221
- err: (m: string) => messages.push(m),
222
- run: () => ({ status: null, signal: "SIGKILL" }),
223
- });
224
- assert.deepEqual(
225
- { noCli, killed, messages: messages.map((m) => m.split(" from ")[0]) },
226
- {
227
- noCli: 0,
228
- killed: 0,
229
- messages: ["paperlint: the hook runtime (vigiles) is not resolvable"],
230
- },
231
- );
232
- });
233
-
234
214
  test("runHook paper-folder-layout: in-process, on the real disk — a refusal on stdout for a new stray file, nothing for an allowed one, a complaint and exit 0 on a broken payload", () => {
235
215
  const dir = join(root, "layout-hook");
236
216
  writeTree(dir, {
@@ -245,9 +225,6 @@ test("runHook paper-folder-layout: in-process, on the real disk — a refusal on
245
225
  stdin: () => payload,
246
226
  out: (t) => out.push(t),
247
227
  err: (m: string) => err.push(m),
248
- run: () => {
249
- throw new Error("an in-process hook spawns nothing");
250
- },
251
228
  });
252
229
  return { code, out, err };
253
230
  };
@@ -308,9 +285,6 @@ async function lintEditedOn(file: string, newString: string) {
308
285
  err: (m: string) => {
309
286
  err.push(m);
310
287
  },
311
- run: () => {
312
- throw new Error("an in-process hook spawns nothing");
313
- },
314
288
  });
315
289
  return { code, out: out.join(""), err };
316
290
  }
@@ -411,9 +385,6 @@ test("runHook submission-confirm: in-process — a refusal on stdout for a send
411
385
  const code = runHook("submission-confirm", {
412
386
  stdin,
413
387
  out: (t) => out.push(t),
414
- run: () => {
415
- throw new Error("an in-process hook spawns nothing");
416
- },
417
388
  });
418
389
  return { code, out };
419
390
  };
@@ -530,13 +501,12 @@ test("doctor reads a broken config as 'the CLI would lint nothing' instead of st
530
501
  const lines = r.out.split("\n");
531
502
  const at = lines.indexOf("papers directory");
532
503
  assert.deepEqual(
533
- { code: r.code, papers: lines.slice(at, at + 3) },
504
+ { code: r.code, papers: lines.slice(at, at + 2) },
534
505
  {
535
506
  code: 2,
536
507
  papers: [
537
508
  "papers directory",
538
- " the CLI will lint (nothing — no declaration found)",
539
- " the hooks will guard (nothing — the guard refuses and says why on first use)",
509
+ " linted (nothing — the settings do not read or name no directory)",
540
510
  ],
541
511
  },
542
512
  );
@@ -924,7 +894,7 @@ test("init and doctor with a declaration that names no directory: nothing to com
924
894
  const d = await cli(["doctor"], dir);
925
895
  assert.match(
926
896
  d.out,
927
- / {2}the CLI will lint {4}\(nothing — no declaration found\)/,
897
+ / {2}linted {15}\(nothing — the settings do not read or name no directory/,
928
898
  );
929
899
  });
930
900
 
@@ -1219,11 +1189,11 @@ test("lint with its LaTeX language missing from the install still lints the scor
1219
1189
  assert.match(whole.out, /missing all of `paper\.tex`/);
1220
1190
  });
1221
1191
 
1222
- test("`paperlint hook` with no name: exit 2, and the usage names an example", async () => {
1192
+ test("`paperlint hook` with no name: exit 1, so it cannot deny and is shown, and the usage names an example", async () => {
1223
1193
  assert.deepEqual(await cli(["hook"], root), {
1224
- code: 2,
1194
+ code: 1,
1225
1195
  out: "",
1226
- err: "`hook` needs a name, e.g. `paperlint hook paper-edit-guard`",
1196
+ err: "paperlint: `hook` needs a name, e.g. `paperlint hook lint-edited`; no hook is running.",
1227
1197
  });
1228
1198
  });
1229
1199