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
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* paper-skills-nudge — a PostToolUse react: editing a paper SOURCE surfaces the static
|
|
3
|
-
* pre-submit checklist, so the pipeline is driven rather than winged.
|
|
4
|
-
*
|
|
5
|
-
* ── THE BUG THIS REMOVES ────────────────────────────────────────────────────
|
|
6
|
-
* Its shell predecessor was dead for twelve days: it read the payload from `$CLAUDE_TOOL_INPUT`
|
|
7
|
-
* while the harness delivers on stdin, so its path match never ran and it exited 0 in silence
|
|
8
|
-
* across dozens of paper edits. An advisory hook cannot be NOTICED failing — silence is also its
|
|
9
|
-
* success case, which is why it took a frozen throttle stamp to find it. A `react` never touches
|
|
10
|
-
* the payload: the runtime decodes the event and hands in `e.path`, so the whole family of "read
|
|
11
|
-
* the wrong input / wrote the wrong field / exited the wrong code" is unrepresentable here.
|
|
12
|
-
*
|
|
13
|
-
* ── DELIVERY, MEASURED (2026-09-12, vigiles 27.1.4) ─────────────────────────
|
|
14
|
-
* `PostToolUse` is in the adapter's `injectableEvents`, so a `notice` on this event reaches the
|
|
15
|
-
* model as `hookSpecificOutput.additionalContext` on STDOUT — 1 346 bytes on a paper edit, 0 on
|
|
16
|
-
* anything else — with a copy on stderr for a human. That is NOT true of every event: `Stop` and
|
|
17
|
-
* `PreToolUse` are absent from that list, and a `notice` there reaches only the debug log. Do not
|
|
18
|
-
* move this hook to another event assuming its text still lands.
|
|
19
|
-
*
|
|
20
|
-
* ── WHY `.mjs` AND NOT A `.hook.ts` SPEC ────────────────────────────────────
|
|
21
|
-
* Measured in `paper-edit-guard.hook.mjs` — a `.ts` hook reached through `node_modules` does not
|
|
22
|
-
* load at all, and a consumer-side thin spec that imports this logic is refused by
|
|
23
|
-
* `vigiles compile` and can therefore never be re-stamped. The full reasoning, with both
|
|
24
|
-
* measurements, is in that file's header; the capability surface of this one is asserted by
|
|
25
|
-
* `hooks.harness.ts` running `checkHookImports` over the shipped artifact.
|
|
26
|
-
*/
|
|
27
|
-
import {
|
|
28
|
-
experimental_defineReact,
|
|
29
|
-
tools,
|
|
30
|
-
provide,
|
|
31
|
-
notice,
|
|
32
|
-
nothing,
|
|
33
|
-
record,
|
|
34
|
-
state,
|
|
35
|
-
} from "vigiles/hook";
|
|
36
|
-
|
|
37
|
-
/** The tool's name — the package this hook resolves its scripts through. */
|
|
38
|
-
export const CONFIG_KEY = "paperlint";
|
|
39
|
-
/** The settings file at the project root. Optional: absent means every default. */
|
|
40
|
-
export const CONFIG_FILE = "paperlint.json";
|
|
41
|
-
/** The default. A consumer that declares nothing is assumed to keep papers in `papers/`. */
|
|
42
|
-
export const DEFAULT_PAPERS_ROOT = "papers";
|
|
43
|
-
/**
|
|
44
|
-
* The field of the root `paperlint.json` that names the papers directory. These are copies of the
|
|
45
|
-
* constants in `lib/paper-config.mjs` (a hook may import nothing but `vigiles/hook`);
|
|
46
|
-
* `lib/paper-config.harness.mjs` checks that the copies match.
|
|
47
|
-
*/
|
|
48
|
-
export const PAPERS_DIR_FIELD = "papersDir";
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The provider: the root `paperlint.json`, or `{}` when the project has none — so an ABSENT file
|
|
52
|
-
* (every default) and an UNREADABLE one (the empty string the runtime gives a failed provider)
|
|
53
|
-
* stay two different inputs.
|
|
54
|
-
*
|
|
55
|
-
* 🔴 THE PATH IS ANCHORED TO THE PROJECT ROOT. vigiles runs a provider "via execSync in the hook's
|
|
56
|
-
* cwd", which is the consumer's wiring — a string this hook cannot see. A bare relative path reads
|
|
57
|
-
* from whatever directory the Bash tool last moved to.
|
|
58
|
-
*/
|
|
59
|
-
const READ_CONFIG = `f="\${CLAUDE_PROJECT_DIR:-.}/${CONFIG_FILE}"; if [ -e "$f" ]; then cat "$f"; else echo '{}'; fi`;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The declared papers root, or `null` when it is unusable.
|
|
63
|
-
*
|
|
64
|
-
* ⚠️ NO TRAILING-SLASH NORMALISATION HERE, and that is measured rather than sloppy. The guard
|
|
65
|
-
* hand-writes its own prefix tests (`startsWith(p + "/")`), where a slash the consumer typed
|
|
66
|
-
* becomes `//` and matches nothing — a defect that shipped once. This hook instead uses
|
|
67
|
-
* `e.path.under()`, and vigiles normalises the prefix itself (`normalizePrefix` →
|
|
68
|
-
* `trimTrailingSeparators`), so `"docs/papers/"` and `"docs/papers"` are the same prefix to it.
|
|
69
|
-
* A normalise here would be a line no test could kill, which is a line that documents a
|
|
70
|
-
* defence that does not exist. Confirmed 2026-09-12: removing it left the harness green, which
|
|
71
|
-
* is the finding that produced this paragraph.
|
|
72
|
-
*
|
|
73
|
-
* ⚠️ A NUDGE FALLS SILENT WHERE THE GATE REFUSES, and the asymmetry is the decision, not an
|
|
74
|
-
* inconsistency. `paper-edit-guard` denies on an unreadable declaration because a gate that
|
|
75
|
-
* quietly reverts to the default would pass every write it exists to stop. This hook has no such
|
|
76
|
-
* failure mode: with no root it prints nothing, which is what it already does on every
|
|
77
|
-
* non-paper edit. Denying here would mean an advisory hook blocking work over a courtesy
|
|
78
|
-
* message — and a `react` cannot deny at all: its type has no `deny`, so it always exits 0.
|
|
79
|
-
*
|
|
80
|
-
* 🔴 `declared === undefined`, NOT `declared ?? DEFAULT` — `"papersDir": null` is a keystroke, not
|
|
81
|
-
* an absence. Same distinction as every other carrier in this package.
|
|
82
|
-
*/
|
|
83
|
-
const papersRoot = (rawConfig) => {
|
|
84
|
-
let declared;
|
|
85
|
-
try {
|
|
86
|
-
declared = JSON.parse(rawConfig)?.[PAPERS_DIR_FIELD];
|
|
87
|
-
} catch {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
const root = declared === undefined ? DEFAULT_PAPERS_ROOT : declared;
|
|
91
|
-
if (typeof root !== "string" || root.length === 0) return null;
|
|
92
|
-
return root;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The shipped skills, one per line as name, a tab, and the description, read from the package's own
|
|
97
|
-
* skills folder (the consumer's node_modules copy; in this repository, its own folder). The list used
|
|
98
|
-
* to be typed into this file and drifted: a skill added to the package never reached the nudge.
|
|
99
|
-
* An empty result (no folder, no skills) leaves the list out and keeps the rest of the message.
|
|
100
|
-
*/
|
|
101
|
-
const READ_SKILLS =
|
|
102
|
-
`d="\${CLAUDE_PROJECT_DIR:-.}/node_modules/paperlint/skills"; [ -d "$d" ] || d="\${CLAUDE_PROJECT_DIR:-.}/skills"; ` +
|
|
103
|
-
`for f in "$d"/*/SKILL.md; do [ -f "$f" ] || continue; ` +
|
|
104
|
-
`awk 'NR==1 && $0!="---" {exit} NR>1 && $0=="---" {exit} ` +
|
|
105
|
-
`/^name: / {n=substr($0, 7)} /^description: / {d=substr($0, 14)} END {if (n!="") print n "\t" d}' "$f"; done`;
|
|
106
|
-
|
|
107
|
-
/** One line per skill: its name and the description's first clause, at most 110 characters. */
|
|
108
|
-
export const skillLines = (raw) =>
|
|
109
|
-
String(raw ?? "")
|
|
110
|
-
.split("\n")
|
|
111
|
-
.map((l) => l.split("\t"))
|
|
112
|
-
.filter(([name]) => /^[a-z0-9-]+$/.test(name))
|
|
113
|
-
.map(([name, desc = ""]) => {
|
|
114
|
-
const clause = desc
|
|
115
|
-
.replace(/^["']|["']$/g, "")
|
|
116
|
-
.replace(/\\"/g, '"')
|
|
117
|
-
.split(/ — |\. /)[0];
|
|
118
|
-
return ` • ${name} — ${clause.length > 110 ? `${clause.slice(0, 107)}...` : clause}`;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
/** A path or root in one spelling: no leading "./", no doubled or trailing separators. */
|
|
122
|
-
const tidy = (p) =>
|
|
123
|
-
p
|
|
124
|
-
.replace(/^(\.\/+)+/, "")
|
|
125
|
-
.replace(/\/{2,}/g, "/")
|
|
126
|
-
.replace(/\/+$/, "");
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The paper a path belongs to: the first folder under the papers root, when the file sits inside one.
|
|
130
|
-
* A file directly in the root (its README) belongs to no paper and stays silent. The path comes in
|
|
131
|
-
* every spelling the event has (repo-relative and as sent), and the root in any spelling the config
|
|
132
|
-
* allows (with a leading dot-slash, doubled slashes, absolute); the first spelling under the root wins.
|
|
133
|
-
*/
|
|
134
|
-
export const paperOf = (paths, root) => {
|
|
135
|
-
const prefix = `${tidy(root)}/`;
|
|
136
|
-
const names = paths
|
|
137
|
-
.filter((p) => typeof p === "string")
|
|
138
|
-
.map(tidy)
|
|
139
|
-
.filter((p) => p.startsWith(prefix))
|
|
140
|
-
.map((p) => p.slice(prefix.length).split("/"))
|
|
141
|
-
.map((parts) => (parts.length >= 2 ? parts[0] : null));
|
|
142
|
-
return names.length ? names[0] : null;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/** How long one paper stays nudged. Touching a different paper speaks again at once. */
|
|
146
|
-
const QUIET_FOR = "3h";
|
|
147
|
-
|
|
148
|
-
export const message = (paper, lines) =>
|
|
149
|
-
`📄 Working on paper "${paper}". Before deciding a step yourself, check whether a skill owns it ` +
|
|
150
|
-
"(Skill tool) — a hand-written brief or a winged review is how pipeline stages get skipped.\n" +
|
|
151
|
-
" → Update <paper-dir>/PIPELINE-STATUS.md: mark the row for any stage you (re)ran, and read its\n" +
|
|
152
|
-
" verdict line to see what's still ☐/◐/⚠ before submit.\n" +
|
|
153
|
-
(lines.length
|
|
154
|
-
? `The paper skills shipped with this package:\n${lines.join("\n")}\n`
|
|
155
|
-
: "") +
|
|
156
|
-
"RULES earned the hard way:\n" +
|
|
157
|
-
" • After every aggressive rewrite/thinning pass → claim-preservation DIFF vs the pre-pass baseline\n" +
|
|
158
|
-
" • Numbers overwhelming the reader? secondary numbers live in the artifact, not the paper\n" +
|
|
159
|
-
" • bib inside \\begin{filecontents*}{refs.bib}? edit it THERE — refs.bib is overwritten on build\n" +
|
|
160
|
-
" • Done + claim-clean + page-legal ships. Further churn breaks about as much as it fixes.";
|
|
161
|
-
|
|
162
|
-
export default experimental_defineReact({
|
|
163
|
-
on: "PostToolUse",
|
|
164
|
-
// Read too: the moment a paper is opened is when its skills are worth knowing, before anything is
|
|
165
|
-
// decided — an edit-only trigger fires after the decision.
|
|
166
|
-
match: tools("Read", "Edit", "Write", "MultiEdit"),
|
|
167
|
-
// The provider is anchored to the project root (`READ_CONFIG`, above).
|
|
168
|
-
//
|
|
169
|
-
// ⚠️ THE FAILURE HERE IS SILENT, which makes it more dangerous than its neighbor's.
|
|
170
|
-
// `paper-edit-guard` on PreToolUse DENIES loudly and visibly when the declaration is
|
|
171
|
-
// unreadable. This hook on PostToolUse just returns `nothing()`, i.e. simply stops firing:
|
|
172
|
-
// the `cat` fails → empty string → `JSON.parse("")` throws → `papersRoot` returns null
|
|
173
|
-
// → silence. And silence is exactly what a nudge's success state looks like, so a dead hook
|
|
174
|
-
// is indistinguishable from a working one.
|
|
175
|
-
needs: [
|
|
176
|
-
provide("config", READ_CONFIG),
|
|
177
|
-
provide("skills", READ_SKILLS),
|
|
178
|
-
state("paper-skills.shown"),
|
|
179
|
-
],
|
|
180
|
-
react: (e) => {
|
|
181
|
-
const root = papersRoot(e.ctx.config);
|
|
182
|
-
if (root === null || !e.path.under([tidy(root)])) return nothing();
|
|
183
|
-
const paper = paperOf([e.path.rel, e.path.raw], root);
|
|
184
|
-
if (paper === null) return nothing();
|
|
185
|
-
const shown = e.ctx["paper-skills.shown"];
|
|
186
|
-
// Once per paper: the same paper again within QUIET_FOR stays silent; another paper speaks.
|
|
187
|
-
if (shown.value === paper && shown.fresherThan(QUIET_FOR)) return nothing();
|
|
188
|
-
return notice(
|
|
189
|
-
message(paper, skillLines(e.ctx.skills)),
|
|
190
|
-
record("paper-skills.shown", paper),
|
|
191
|
-
);
|
|
192
|
-
},
|
|
193
|
-
});
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* paper-skills-nudge on the declarations the hooks harness does not carry: none at all (the
|
|
3
|
-
* default `papers/` root applies) and one that does not parse (silence — a nudge never blocks).
|
|
4
|
-
*/
|
|
5
|
-
import assert from "node:assert/strict";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { test } from "vitest";
|
|
8
|
-
import { hookConsumer, onEdit, runShippedHook } from "../test/hook-consumer.ts";
|
|
9
|
-
import { useTempDir } from "../test/support.ts";
|
|
10
|
-
import { message, paperOf, skillLines } from "./paper-skills-nudge.hook.mjs";
|
|
11
|
-
|
|
12
|
-
const root = useTempDir("paper-skills-nudge-");
|
|
13
|
-
|
|
14
|
-
test("no paperlint.json: an edit to papers/<p>/paper.tex gets the checklist", () => {
|
|
15
|
-
const dir = hookConsumer(join(root, "default"));
|
|
16
|
-
const r = runShippedHook(
|
|
17
|
-
"paper-skills-nudge",
|
|
18
|
-
onEdit("papers/alpha/paper.tex"),
|
|
19
|
-
dir,
|
|
20
|
-
);
|
|
21
|
-
assert.equal(r.exitCode, 0);
|
|
22
|
-
assert.notEqual(r.stdout, "");
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test("a paperlint.json that does not parse: silent, exit 0", () => {
|
|
26
|
-
const dir = hookConsumer(join(root, "broken"), {
|
|
27
|
-
"paperlint.json": "{ nope",
|
|
28
|
-
});
|
|
29
|
-
const r = runShippedHook(
|
|
30
|
-
"paper-skills-nudge",
|
|
31
|
-
onEdit("papers/alpha/paper.tex"),
|
|
32
|
-
dir,
|
|
33
|
-
);
|
|
34
|
-
assert.deepEqual([r.exitCode, r.stdout, r.stderr], [0, "", ""]);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test("a file directly under the papers root belongs to no paper: silent", () => {
|
|
38
|
-
const dir = hookConsumer(join(root, "root-file"));
|
|
39
|
-
const r = runShippedHook(
|
|
40
|
-
"paper-skills-nudge",
|
|
41
|
-
onEdit("papers/README.md"),
|
|
42
|
-
dir,
|
|
43
|
-
);
|
|
44
|
-
assert.deepEqual([r.exitCode, r.stdout, r.stderr], [0, "", ""]);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("any file of a paper, not only its source: the checklist", () => {
|
|
48
|
-
const dir = hookConsumer(join(root, "any-file"));
|
|
49
|
-
const r = runShippedHook(
|
|
50
|
-
"paper-skills-nudge",
|
|
51
|
-
onEdit("papers/alpha/notes.txt"),
|
|
52
|
-
dir,
|
|
53
|
-
);
|
|
54
|
-
assert.equal(r.exitCode, 0);
|
|
55
|
-
assert.match(r.stdout, /Working on paper \\"alpha\\"/);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// ── the pure helpers, on the inputs the shipped run never sends ─────────────────────────────
|
|
59
|
-
|
|
60
|
-
test("skillLines: a missing provider result is no skills, not a crash", () => {
|
|
61
|
-
assert.deepEqual(skillLines(undefined), []);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test("skillLines: a line that is not a skill name is dropped; a name without a description stays", () => {
|
|
65
|
-
assert.deepEqual(skillLines("Not A Name\tx\nbare-name"), [
|
|
66
|
-
" • bare-name — ",
|
|
67
|
-
]);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test("skillLines: a quoted description is unquoted and cut at its first clause, at most 110 characters", () => {
|
|
71
|
-
const long = "a".repeat(200);
|
|
72
|
-
assert.deepEqual(
|
|
73
|
-
skillLines(`quoted\t"Say \\"hi\\" — then more"\nlong\t${long}`),
|
|
74
|
-
[' • quoted — Say "hi"', ` • long — ${"a".repeat(107)}...`],
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test("paperOf: only a file inside a paper folder belongs to a paper", () => {
|
|
79
|
-
assert.deepEqual(
|
|
80
|
-
[
|
|
81
|
-
paperOf([undefined], "papers"),
|
|
82
|
-
paperOf(["elsewhere/alpha/x.tex"], "papers"),
|
|
83
|
-
paperOf(["papers/README.md"], "papers"),
|
|
84
|
-
paperOf(["papers/alpha/x.tex"], "papers/"),
|
|
85
|
-
],
|
|
86
|
-
[null, null, null, "alpha"],
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("message: with no skills found, the list is left out and the rest stays", () => {
|
|
91
|
-
const m = message("alpha", []);
|
|
92
|
-
assert.equal(m.includes("shipped with this package"), false);
|
|
93
|
-
assert.match(m, /RULES earned the hard way/);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test("paperOf: the root in any spelling the path check accepts — ./, doubled slashes, absolute", () => {
|
|
97
|
-
assert.deepEqual(
|
|
98
|
-
[
|
|
99
|
-
paperOf(["papers/alpha/x.tex"], "./papers"),
|
|
100
|
-
paperOf(["papers/alpha/x.tex"], ".//papers//"),
|
|
101
|
-
paperOf(
|
|
102
|
-
["papers/alpha/x.tex", "/repo/papers/alpha/x.tex"],
|
|
103
|
-
"/repo/papers",
|
|
104
|
-
),
|
|
105
|
-
paperOf(["papers/README.md", "/repo/papers/README.md"], "/repo/papers"),
|
|
106
|
-
],
|
|
107
|
-
["alpha", "alpha", "alpha", null],
|
|
108
|
-
);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
test("a ./-spelled papersDir: the checklist still lands", () => {
|
|
112
|
-
const dir = hookConsumer(join(root, "dot-slash"), {
|
|
113
|
-
"paperlint.json": JSON.stringify({ papersDir: "./papers" }),
|
|
114
|
-
});
|
|
115
|
-
const r = runShippedHook(
|
|
116
|
-
"paper-skills-nudge",
|
|
117
|
-
onEdit("papers/alpha/paper.tex"),
|
|
118
|
-
dir,
|
|
119
|
-
);
|
|
120
|
-
assert.equal(r.exitCode, 0);
|
|
121
|
-
assert.match(r.stdout, /Working on paper/);
|
|
122
|
-
});
|