paperlint 19.0.2 → 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.
- package/.claude-plugin/plugin.json +1 -1
- package/CLAUDE.md +2 -2
- package/dist/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/CLAUDE.md.spec.js +7 -1
- package/dist/CLAUDE.md.spec.js.map +1 -1
- package/dist/cli.d.ts +2 -21
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +45 -93
- package/dist/cli.js.map +1 -1
- package/dist/doctor.d.ts +8 -10
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +27 -37
- package/dist/doctor.js.map +1 -1
- package/dist/hooks-notice.d.ts +8 -2
- package/dist/hooks-notice.d.ts.map +1 -1
- package/dist/hooks-notice.js +15 -20
- package/dist/hooks-notice.js.map +1 -1
- package/dist/hooks-settings.d.ts +1 -1
- package/dist/hooks-settings.js +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +5 -5
- package/dist/lib/paper-config.d.ts +4 -9
- package/dist/lib/paper-config.d.ts.map +1 -1
- package/dist/lib/paper-config.js +4 -9
- package/dist/lib/paper-config.js.map +1 -1
- package/dist/papers-roots.d.ts +19 -0
- package/dist/papers-roots.d.ts.map +1 -0
- package/dist/papers-roots.js +42 -0
- package/dist/papers-roots.js.map +1 -0
- package/dist/retired-hooks.d.ts +6 -0
- package/dist/retired-hooks.d.ts.map +1 -0
- package/dist/retired-hooks.js +34 -0
- package/dist/retired-hooks.js.map +1 -0
- package/dist/skill-chunks/chunk-C2G5EK7S.js +579 -0
- package/dist/skill-chunks/{chunk-UL4INX2P.js → chunk-L3NJUJUP.js} +446 -446
- package/dist/skill-chunks/{chunk-EOVEVX67.js → chunk-X4VKG4KT.js} +1 -1
- package/dist/types.d.ts +1 -1
- package/docs/install.md +9 -11
- package/docs/layout.md +2 -4
- package/docs/rules/paper/allowed-files-only.md +1 -2
- package/docs/testing.md +1 -1
- package/eslint.config.mjs +1 -1
- package/lib/paper-config.harness.mjs +3 -6
- package/lib/paper-config.ts +4 -9
- package/package.json +2 -3
- package/plugin/hooks/hooks.json +0 -13
- package/scripts/coverage-config.test.ts +0 -1
- package/scripts/eslint-file-length.mjs +0 -1
- package/skills/argument-arc/scripts/headings.js +2 -2
- package/skills/build-label-page/scripts/label-page.js +125 -125
- package/skills/cold-read-diff/scripts/cold-read.js +11 -11
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +3 -3
- package/skills/paper-status/SKILL.md +1 -2
- package/skills/paper-status/SKILL.md.spec.ts +0 -1
- package/skills/pc-panel-review/scripts/prior-reviews.js +1 -1
- package/skills/verify-citations/scripts/bib-authors.js +3 -3
- package/skills/verify-citations/scripts/verify-cites.js +3 -3
- package/src/CLAUDE.md +16 -1
- package/src/CLAUDE.md.spec.ts +12 -1
- package/src/cli.harness.mjs +14 -79
- package/src/cli.test.ts +4 -34
- package/src/cli.ts +47 -140
- package/src/doctor.harness.mjs +17 -59
- package/src/doctor.test.ts +1 -1
- package/src/doctor.ts +26 -41
- package/src/domain/paper-folder.test.ts +1 -1
- package/src/hooks-notice.test.ts +21 -74
- package/src/hooks-notice.ts +30 -20
- package/src/hooks-settings.harness.ts +25 -27
- package/src/hooks-settings.ts +1 -1
- package/src/in-process-hooks.test.ts +18 -0
- package/src/init.ts +5 -5
- package/src/lint-edited-site-example.test.ts +0 -3
- package/src/papers-roots.test.ts +56 -0
- package/src/papers-roots.ts +56 -0
- package/src/retired-hooks.test.ts +155 -0
- package/src/retired-hooks.ts +41 -0
- package/src/types.ts +1 -1
- package/dist/skill-chunks/chunk-GRSXIWYF.js +0 -352
- package/hooks/CLAUDE.md +0 -34
- package/hooks/CLAUDE.md.spec.ts +0 -30
- package/hooks/hooks.harness.ts +0 -566
- package/hooks/paper-edit-guard.hook.d.mts +0 -12
- package/hooks/paper-edit-guard.hook.mjs +0 -443
- package/hooks/paper-edit-guard.test.ts +0 -66
- package/hooks/paper-skills-nudge.hook.d.mts +0 -22
- package/hooks/paper-skills-nudge.hook.mjs +0 -193
- package/hooks/paper-skills-nudge.test.ts +0 -122
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
parseLatex,
|
|
11
11
|
sourcesCodec,
|
|
12
12
|
visit
|
|
13
|
-
} from "../../../dist/skill-chunks/chunk-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
} from "../../../dist/skill-chunks/chunk-
|
|
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,
|
|
62
|
-
const lines = src.split("\n").slice(first - 1,
|
|
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
|
|
78
|
-
return
|
|
77
|
+
const last2 = out.at(-1);
|
|
78
|
+
return last2 !== void 0 && r.start <= last2.end ? [
|
|
79
79
|
...out.slice(0, -1),
|
|
80
|
-
{ start:
|
|
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,
|
|
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 =
|
|
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-
|
|
13
|
+
} from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
|
|
14
14
|
import {
|
|
15
15
|
latexReader,
|
|
16
16
|
sourcesCodec
|
|
17
|
-
} from "../../../dist/skill-chunks/chunk-
|
|
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-
|
|
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:
|
|
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-
|
|
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-
|
|
13
|
+
} from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
|
|
14
14
|
import {
|
|
15
15
|
latexReader,
|
|
16
16
|
sourcesCodec
|
|
17
|
-
} from "../../../dist/skill-chunks/chunk-
|
|
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-
|
|
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-
|
|
14
|
+
} from "../../../dist/skill-chunks/chunk-X4VKG4KT.js";
|
|
15
15
|
import {
|
|
16
16
|
latexReader,
|
|
17
17
|
sourcesCodec
|
|
18
|
-
} from "../../../dist/skill-chunks/chunk-
|
|
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-
|
|
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:
|
|
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`
|
package/src/CLAUDE.md.spec.ts
CHANGED
|
@@ -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.",
|
package/src/cli.harness.mjs
CHANGED
|
@@ -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,
|
|
36
|
-
|
|
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
|
|
297
|
-
//
|
|
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 && /
|
|
378
|
+
code === 0 && /linted\s+writing\/drafts/.test(out.text()),
|
|
385
379
|
);
|
|
386
380
|
}
|
|
387
381
|
|
|
@@ -1164,83 +1158,24 @@ check(
|
|
|
1164
1158
|
}
|
|
1165
1159
|
}
|
|
1166
1160
|
|
|
1167
|
-
// ── `paperlint hook`
|
|
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
1168
|
"no name — the right invocation is suggested, and it does not deny",
|
|
1189
1169
|
runHook(undefined, { err }) === 1 &&
|
|
1190
|
-
/paperlint hook
|
|
1170
|
+
/paperlint hook lint-edited/.test(said),
|
|
1191
1171
|
);
|
|
1192
|
-
|
|
1193
|
-
// An unknown name cannot run, the same failure as a missing runtime below, so it must not deny (#324).
|
|
1194
1172
|
said = "";
|
|
1195
|
-
const named =
|
|
1196
|
-
/unknown hook `no-such-hook`.*no-such-hook\.hook\.mjs.*paperlint \d+\.\d+\.\d+.*npm install/s;
|
|
1197
1173
|
check(
|
|
1198
|
-
"an unknown hook is NAMED with
|
|
1199
|
-
runHook("no-such-hook", { err }) === 1 &&
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
// PreToolUse that blocks any Bash command, including the one that would fix it. It must say
|
|
1204
|
-
// so LOUDLY and let it through. Silent degradation is worse than an explicit one, but blocking
|
|
1205
|
-
// everything is worse than both.
|
|
1206
|
-
said = "";
|
|
1207
|
-
calls.length = 0;
|
|
1208
|
-
const brokenResolve = () => {
|
|
1209
|
-
throw new Error("Cannot find module 'vigiles/dist/cli.js'");
|
|
1210
|
-
};
|
|
1211
|
-
const code = runHook("paper-edit-guard", {
|
|
1212
|
-
err,
|
|
1213
|
-
run: fake(0),
|
|
1214
|
-
resolve: brokenResolve,
|
|
1215
|
-
});
|
|
1216
|
-
check(
|
|
1217
|
-
"the runtime does not resolve — work is NOT blocked (code 1: shown to the person, not 2)",
|
|
1218
|
-
code === 1,
|
|
1219
|
-
);
|
|
1220
|
-
check(
|
|
1221
|
-
"and the complaint is LOUD: the hook is named, the effect is named, the remedy is named",
|
|
1222
|
-
/paper-edit-guard/.test(said) &&
|
|
1223
|
-
/is NOT running/.test(said) &&
|
|
1224
|
-
/Reinstall this package/.test(said),
|
|
1225
|
-
);
|
|
1226
|
-
check("and the runtime was NOT started in the process", calls.length === 0);
|
|
1227
|
-
|
|
1228
|
-
// The hook's real verdict passes through — otherwise the guard stops being a guard.
|
|
1229
|
-
calls.length = 0;
|
|
1230
|
-
check(
|
|
1231
|
-
"the hook's verdict passes STRAIGHT THROUGH: 2 stays 2",
|
|
1232
|
-
runHook("paper-edit-guard", { err, run: fake(2) }) === 2,
|
|
1233
|
-
);
|
|
1234
|
-
check(
|
|
1235
|
-
"and EXACTLY the runtime with this hook's program is run",
|
|
1236
|
-
calls.length === 1 &&
|
|
1237
|
-
calls[0].args[1] === "hook-runtime" &&
|
|
1238
|
-
calls[0].args[2] === "run-program" &&
|
|
1239
|
-
/paper-edit-guard\.hook\.mjs$/.test(calls[0].args[3]),
|
|
1240
|
-
);
|
|
1241
|
-
check(
|
|
1242
|
-
"zero stays zero",
|
|
1243
|
-
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
|
+
),
|
|
1244
1179
|
);
|
|
1245
1180
|
}
|
|
1246
1181
|
|
|
@@ -1503,7 +1438,7 @@ console.log(
|
|
|
1503
1438
|
check(
|
|
1504
1439
|
"🔴 without a human the hooks default to YES — settings.json is written",
|
|
1505
1440
|
existsSync(settings(dir)) &&
|
|
1506
|
-
/hook
|
|
1441
|
+
/hook submission-confirm/.test(readFileSync(settings(dir), "utf8")),
|
|
1507
1442
|
);
|
|
1508
1443
|
check(
|
|
1509
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: 1,
|
|
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 +
|
|
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
|
|
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}
|
|
897
|
+
/ {2}linted {15}\(nothing — the settings do not read or name no directory/,
|
|
928
898
|
);
|
|
929
899
|
});
|
|
930
900
|
|
|
@@ -1223,7 +1193,7 @@ test("`paperlint hook` with no name: exit 1, so it cannot deny and is shown, and
|
|
|
1223
1193
|
assert.deepEqual(await cli(["hook"], root), {
|
|
1224
1194
|
code: 1,
|
|
1225
1195
|
out: "",
|
|
1226
|
-
err: "paperlint: `hook` needs a name, e.g. `paperlint hook
|
|
1196
|
+
err: "paperlint: `hook` needs a name, e.g. `paperlint hook lint-edited`; no hook is running.",
|
|
1227
1197
|
});
|
|
1228
1198
|
});
|
|
1229
1199
|
|