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.
- 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 +46 -98
- 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/folder-layout-hook.js +1 -1
- package/dist/hooks-notice.d.ts +9 -1
- package/dist/hooks-notice.d.ts.map +1 -1
- package/dist/hooks-notice.js +16 -18
- 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 +12 -14
- package/docs/layout.md +2 -5
- 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 +4 -8
- package/lib/paper-config.ts +4 -9
- package/package.json +2 -3
- package/plugin/hooks/hooks.json +0 -22
- 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 +16 -80
- package/src/cli.test.ts +6 -36
- package/src/cli.ts +49 -145
- 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/folder-layout-hook.ts +1 -1
- package/src/hooks-notice.test.ts +21 -74
- package/src/hooks-notice.ts +37 -18
- package/src/hooks-settings.harness.ts +27 -29
- 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 -704
- 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 -199
- package/hooks/paper-skills-nudge.test.ts +0 -122
- package/hooks/paper-status-gates.hook.mjs +0 -158
- package/hooks/paper-status-gates.sh +0 -93
- package/hooks/paper-status-gates.test.ts +0 -101
|
@@ -1,199 +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
|
-
* ── SPLIT FROM `paper-status-gates`, DELIBERATELY ───────────────────────────
|
|
14
|
-
* This carries the STATIC checklist. The part that reads `<paper-dir>/PIPELINE-STATUS.md` and
|
|
15
|
-
* surfaces unrun gates lives in `paper-status-gates.hook.mjs`, because it needs a tool run and
|
|
16
|
-
* this one does not. Two hooks on one event is the honest line between a constant and an I/O,
|
|
17
|
-
* not an accident of porting.
|
|
18
|
-
*
|
|
19
|
-
* ── DELIVERY, MEASURED (2026-09-12, vigiles 27.1.4) ─────────────────────────
|
|
20
|
-
* `PostToolUse` is in the adapter's `injectableEvents`, so a `notice` on this event reaches the
|
|
21
|
-
* model as `hookSpecificOutput.additionalContext` on STDOUT — 1 346 bytes on a paper edit, 0 on
|
|
22
|
-
* anything else — with a copy on stderr for a human. That is NOT true of every event: `Stop` and
|
|
23
|
-
* `PreToolUse` are absent from that list, and a `notice` there reaches only the debug log. Do not
|
|
24
|
-
* move this hook to another event assuming its text still lands.
|
|
25
|
-
*
|
|
26
|
-
* ── WHY `.mjs` AND NOT A `.hook.ts` SPEC ────────────────────────────────────
|
|
27
|
-
* Measured in `paper-edit-guard.hook.mjs` — a `.ts` hook reached through `node_modules` does not
|
|
28
|
-
* load at all, and a consumer-side thin spec that imports this logic is refused by
|
|
29
|
-
* `vigiles compile` and can therefore never be re-stamped. The full reasoning, with both
|
|
30
|
-
* measurements, is in that file's header; the capability surface of this one is asserted by
|
|
31
|
-
* `hooks.harness.ts` running `checkHookImports` over the shipped artifact.
|
|
32
|
-
*/
|
|
33
|
-
import {
|
|
34
|
-
experimental_defineReact,
|
|
35
|
-
tools,
|
|
36
|
-
provide,
|
|
37
|
-
notice,
|
|
38
|
-
nothing,
|
|
39
|
-
record,
|
|
40
|
-
state,
|
|
41
|
-
} from "vigiles/hook";
|
|
42
|
-
|
|
43
|
-
/** The tool's name — the package this hook resolves its scripts through. */
|
|
44
|
-
export const CONFIG_KEY = "paperlint";
|
|
45
|
-
/** The settings file at the project root. Optional: absent means every default. */
|
|
46
|
-
export const CONFIG_FILE = "paperlint.json";
|
|
47
|
-
/** The default. A consumer that declares nothing is assumed to keep papers in `papers/`. */
|
|
48
|
-
export const DEFAULT_PAPERS_ROOT = "papers";
|
|
49
|
-
/**
|
|
50
|
-
* The field of the root `paperlint.json` that names the papers directory. These are copies of the
|
|
51
|
-
* constants in `lib/paper-config.mjs` (a hook may import nothing but `vigiles/hook`);
|
|
52
|
-
* `lib/paper-config.harness.mjs` checks that the copies match.
|
|
53
|
-
*/
|
|
54
|
-
export const PAPERS_DIR_FIELD = "papersDir";
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The provider: the root `paperlint.json`, or `{}` when the project has none — so an ABSENT file
|
|
58
|
-
* (every default) and an UNREADABLE one (the empty string the runtime gives a failed provider)
|
|
59
|
-
* stay two different inputs.
|
|
60
|
-
*
|
|
61
|
-
* 🔴 THE PATH IS ANCHORED TO THE PROJECT ROOT. vigiles runs a provider "via execSync in the hook's
|
|
62
|
-
* cwd", which is the consumer's wiring — a string this hook cannot see. A bare relative path reads
|
|
63
|
-
* from whatever directory the Bash tool last moved to.
|
|
64
|
-
*/
|
|
65
|
-
const READ_CONFIG = `f="\${CLAUDE_PROJECT_DIR:-.}/${CONFIG_FILE}"; if [ -e "$f" ]; then cat "$f"; else echo '{}'; fi`;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* The declared papers root, or `null` when it is unusable.
|
|
69
|
-
*
|
|
70
|
-
* ⚠️ NO TRAILING-SLASH NORMALISATION HERE, and that is measured rather than sloppy. The guard
|
|
71
|
-
* hand-writes its own prefix tests (`startsWith(p + "/")`), where a slash the consumer typed
|
|
72
|
-
* becomes `//` and matches nothing — a defect that shipped once. This hook instead uses
|
|
73
|
-
* `e.path.under()`, and vigiles normalises the prefix itself (`normalizePrefix` →
|
|
74
|
-
* `trimTrailingSeparators`), so `"docs/papers/"` and `"docs/papers"` are the same prefix to it.
|
|
75
|
-
* A normalise here would be a line no test could kill, which is a line that documents a
|
|
76
|
-
* defence that does not exist. Confirmed 2026-09-12: removing it left the harness green, which
|
|
77
|
-
* is the finding that produced this paragraph.
|
|
78
|
-
*
|
|
79
|
-
* ⚠️ A NUDGE FALLS SILENT WHERE THE GATE REFUSES, and the asymmetry is the decision, not an
|
|
80
|
-
* inconsistency. `paper-edit-guard` denies on an unreadable declaration because a gate that
|
|
81
|
-
* quietly reverts to the default would pass every write it exists to stop. This hook has no such
|
|
82
|
-
* failure mode: with no root it prints nothing, which is what it already does on every
|
|
83
|
-
* non-paper edit. Denying here would mean an advisory hook blocking work over a courtesy
|
|
84
|
-
* message — and a `react` cannot deny at all: its type has no `deny`, so it always exits 0.
|
|
85
|
-
*
|
|
86
|
-
* 🔴 `declared === undefined`, NOT `declared ?? DEFAULT` — `"papersDir": null` is a keystroke, not
|
|
87
|
-
* an absence. Same distinction as every other carrier in this package.
|
|
88
|
-
*/
|
|
89
|
-
const papersRoot = (rawConfig) => {
|
|
90
|
-
let declared;
|
|
91
|
-
try {
|
|
92
|
-
declared = JSON.parse(rawConfig)?.[PAPERS_DIR_FIELD];
|
|
93
|
-
} catch {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
const root = declared === undefined ? DEFAULT_PAPERS_ROOT : declared;
|
|
97
|
-
if (typeof root !== "string" || root.length === 0) return null;
|
|
98
|
-
return root;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The shipped skills, one per line as name, a tab, and the description, read from the package's own
|
|
103
|
-
* skills folder (the consumer's node_modules copy; in this repository, its own folder). The list used
|
|
104
|
-
* to be typed into this file and drifted: a skill added to the package never reached the nudge.
|
|
105
|
-
* An empty result (no folder, no skills) leaves the list out and keeps the rest of the message.
|
|
106
|
-
*/
|
|
107
|
-
const READ_SKILLS =
|
|
108
|
-
`d="\${CLAUDE_PROJECT_DIR:-.}/node_modules/paperlint/skills"; [ -d "$d" ] || d="\${CLAUDE_PROJECT_DIR:-.}/skills"; ` +
|
|
109
|
-
`for f in "$d"/*/SKILL.md; do [ -f "$f" ] || continue; ` +
|
|
110
|
-
`awk 'NR==1 && $0!="---" {exit} NR>1 && $0=="---" {exit} ` +
|
|
111
|
-
`/^name: / {n=substr($0, 7)} /^description: / {d=substr($0, 14)} END {if (n!="") print n "\t" d}' "$f"; done`;
|
|
112
|
-
|
|
113
|
-
/** One line per skill: its name and the description's first clause, at most 110 characters. */
|
|
114
|
-
export const skillLines = (raw) =>
|
|
115
|
-
String(raw ?? "")
|
|
116
|
-
.split("\n")
|
|
117
|
-
.map((l) => l.split("\t"))
|
|
118
|
-
.filter(([name]) => /^[a-z0-9-]+$/.test(name))
|
|
119
|
-
.map(([name, desc = ""]) => {
|
|
120
|
-
const clause = desc
|
|
121
|
-
.replace(/^["']|["']$/g, "")
|
|
122
|
-
.replace(/\\"/g, '"')
|
|
123
|
-
.split(/ — |\. /)[0];
|
|
124
|
-
return ` • ${name} — ${clause.length > 110 ? `${clause.slice(0, 107)}...` : clause}`;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
/** A path or root in one spelling: no leading "./", no doubled or trailing separators. */
|
|
128
|
-
const tidy = (p) =>
|
|
129
|
-
p
|
|
130
|
-
.replace(/^(\.\/+)+/, "")
|
|
131
|
-
.replace(/\/{2,}/g, "/")
|
|
132
|
-
.replace(/\/+$/, "");
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* The paper a path belongs to: the first folder under the papers root, when the file sits inside one.
|
|
136
|
-
* A file directly in the root (its README) belongs to no paper and stays silent. The path comes in
|
|
137
|
-
* every spelling the event has (repo-relative and as sent), and the root in any spelling the config
|
|
138
|
-
* allows (with a leading dot-slash, doubled slashes, absolute); the first spelling under the root wins.
|
|
139
|
-
*/
|
|
140
|
-
export const paperOf = (paths, root) => {
|
|
141
|
-
const prefix = `${tidy(root)}/`;
|
|
142
|
-
const names = paths
|
|
143
|
-
.filter((p) => typeof p === "string")
|
|
144
|
-
.map(tidy)
|
|
145
|
-
.filter((p) => p.startsWith(prefix))
|
|
146
|
-
.map((p) => p.slice(prefix.length).split("/"))
|
|
147
|
-
.map((parts) => (parts.length >= 2 ? parts[0] : null));
|
|
148
|
-
return names.length ? names[0] : null;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
/** How long one paper stays nudged. Touching a different paper speaks again at once. */
|
|
152
|
-
const QUIET_FOR = "3h";
|
|
153
|
-
|
|
154
|
-
export const message = (paper, lines) =>
|
|
155
|
-
`📄 Working on paper "${paper}". Before deciding a step yourself, check whether a skill owns it ` +
|
|
156
|
-
"(Skill tool) — a hand-written brief or a winged review is how pipeline stages get skipped.\n" +
|
|
157
|
-
" → Update <paper-dir>/PIPELINE-STATUS.md: mark the row for any stage you (re)ran, and read its\n" +
|
|
158
|
-
" verdict line to see what's still ☐/◐/⚠ before submit.\n" +
|
|
159
|
-
(lines.length
|
|
160
|
-
? `The paper skills shipped with this package:\n${lines.join("\n")}\n`
|
|
161
|
-
: "") +
|
|
162
|
-
"RULES earned the hard way:\n" +
|
|
163
|
-
" • After every aggressive rewrite/thinning pass → claim-preservation DIFF vs the pre-pass baseline\n" +
|
|
164
|
-
" • Numbers overwhelming the reader? secondary numbers live in the artifact, not the paper\n" +
|
|
165
|
-
" • bib inside \\begin{filecontents*}{refs.bib}? edit it THERE — refs.bib is overwritten on build\n" +
|
|
166
|
-
" • Done + claim-clean + page-legal ships. Further churn breaks about as much as it fixes.";
|
|
167
|
-
|
|
168
|
-
export default experimental_defineReact({
|
|
169
|
-
on: "PostToolUse",
|
|
170
|
-
// Read too: the moment a paper is opened is when its skills are worth knowing, before anything is
|
|
171
|
-
// decided — an edit-only trigger fires after the decision.
|
|
172
|
-
match: tools("Read", "Edit", "Write", "MultiEdit"),
|
|
173
|
-
// The provider is anchored to the project root (`READ_CONFIG`, above).
|
|
174
|
-
//
|
|
175
|
-
// ⚠️ THE FAILURE HERE IS SILENT, which makes it more dangerous than its neighbor's.
|
|
176
|
-
// `paper-edit-guard` on PreToolUse DENIES loudly and visibly when the declaration is
|
|
177
|
-
// unreadable. This hook on PostToolUse just returns `nothing()`, i.e. simply stops firing:
|
|
178
|
-
// the `cat` fails → empty string → `JSON.parse("")` throws → `papersRoot` returns null
|
|
179
|
-
// → silence. And silence is exactly what a nudge's success state looks like, so a dead hook
|
|
180
|
-
// is indistinguishable from a working one.
|
|
181
|
-
needs: [
|
|
182
|
-
provide("config", READ_CONFIG),
|
|
183
|
-
provide("skills", READ_SKILLS),
|
|
184
|
-
state("paper-skills.shown"),
|
|
185
|
-
],
|
|
186
|
-
react: (e) => {
|
|
187
|
-
const root = papersRoot(e.ctx.config);
|
|
188
|
-
if (root === null || !e.path.under([tidy(root)])) return nothing();
|
|
189
|
-
const paper = paperOf([e.path.rel, e.path.raw], root);
|
|
190
|
-
if (paper === null) return nothing();
|
|
191
|
-
const shown = e.ctx["paper-skills.shown"];
|
|
192
|
-
// Once per paper: the same paper again within QUIET_FOR stays silent; another paper speaks.
|
|
193
|
-
if (shown.value === paper && shown.fresherThan(QUIET_FOR)) return nothing();
|
|
194
|
-
return notice(
|
|
195
|
-
message(paper, skillLines(e.ctx.skills)),
|
|
196
|
-
record("paper-skills.shown", paper),
|
|
197
|
-
);
|
|
198
|
-
},
|
|
199
|
-
});
|
|
@@ -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
|
-
});
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* paper-status-gates — a PostToolUse react: editing a paper's source surfaces that paper's
|
|
3
|
-
* readiness verdict and its UNRUN GATES, unprompted.
|
|
4
|
-
*
|
|
5
|
-
* A ☐ against study-accepted / pc-panel / harden / verify-citations is a HOLE, not an
|
|
6
|
-
* "anti-churn" skip: a session that skipped three of them had the panel come back with real
|
|
7
|
-
* must-fixes. Advisory, never blocks, always exits 0 — a `react`'s type has no `deny`.
|
|
8
|
-
*
|
|
9
|
-
* ── WHY IT WAS WORTH SURFACING AT ALL ───────────────────────────────────────
|
|
10
|
-
* The checker PARSED the verdict line (to test it was not a bare percentage) and never PRINTED
|
|
11
|
-
* it, so the one fact its author kept asking for by hand was the one thing the tooling reliably
|
|
12
|
-
* withheld. A status file nobody is shown is a status file nobody reads.
|
|
13
|
-
*
|
|
14
|
-
* ── THE PURE / IMPURE LINE, AND WHERE IT REALLY FALLS ───────────────────────
|
|
15
|
-
* An earlier header claimed this half "READS A FILE and interpolates its contents, and a vigiles
|
|
16
|
-
* `react` is a pure function — it cannot", and called that the honest boundary of the closed
|
|
17
|
-
* vocabulary. That reading was one step too pessimistic. The boundary is real, but it falls
|
|
18
|
-
* between DECIDING and DOING, not between "hook" and "shell": deciding whether this edit
|
|
19
|
-
* concerns a paper, and WHICH one, is pure and belongs here; reading that paper's status file
|
|
20
|
-
* and running the checker is a tool, and `run()` is how a react invokes one.
|
|
21
|
-
*
|
|
22
|
-
* ── WHY THE DIRECTORY NAME IS VALIDATED BEFORE IT REACHES A COMMAND ─────────
|
|
23
|
-
* `run()` takes a string AND IT GOES THROUGH A SHELL — measured 2026-09-12: a `$(…)` inside a
|
|
24
|
-
* `run()` command substitutes. This one embeds a path taken from the event, so the name is
|
|
25
|
-
* extracted by an anchored pattern and accepted only if it is `[A-Za-z0-9._-]+` — no slash, no
|
|
26
|
-
* space, no shell metacharacter can survive. The shell predecessor got this incidentally, via a
|
|
27
|
-
* `grep -oE`; here it is explicit, because "incidentally safe" is how it stops being safe.
|
|
28
|
-
*
|
|
29
|
-
* 🔴 THE `(?:^|\/)` IS NOT DECORATION, AND LEAVING IT OUT KILLED THIS HOOK ONCE. The first
|
|
30
|
-
* version anchored the papers root at `^`, which passed every test in the harness — because the
|
|
31
|
-
* harness's own edit helper builds a RELATIVE path. The live harness sends an ABSOLUTE one.
|
|
32
|
-
* Measured against the real runtime:
|
|
33
|
-
*
|
|
34
|
-
* file_path "<root>/<paper>/paper.tex" → fires
|
|
35
|
-
* file_path "/abs/path/to/repo/<root>/<paper>/…" → SILENT
|
|
36
|
-
*
|
|
37
|
-
* So the hook would have been dead in production and green in the tests: precisely the
|
|
38
|
-
* false-confidence class this whole exercise is about, reintroduced while converting a hook away
|
|
39
|
-
* from it. The shell version was accidentally immune — it grepped the raw payload with no anchor
|
|
40
|
-
* at all. The harness now sends BOTH spellings for every case.
|
|
41
|
-
*
|
|
42
|
-
* The boundary is still required (`^` or `/`), so a directory merely ENDING in the root's last
|
|
43
|
-
* segment cannot smuggle a match.
|
|
44
|
-
*
|
|
45
|
-
* ── WHAT THIS HOOK'S OUTPUT DOES *NOT* DO, measured and named ───────────────
|
|
46
|
-
* ⚠️ A `run()` reaction's output is passed through RAW — 0 bytes of `hookSpecificOutput` on
|
|
47
|
-
* stdout, the tool's own text on stderr (measured 2026-09-12: 1 184 bytes of stderr, 0 of
|
|
48
|
-
* stdout). Only a `notice` on an injectable event becomes `additionalContext`. So this hook's
|
|
49
|
-
* findings reach a HUMAN reading the transcript's debug output, not the model's context. That is
|
|
50
|
-
* a property of the reaction KIND, not a bug here, and it is the reason the static half lives in
|
|
51
|
-
* `paper-skills-nudge` as a `notice` instead: that one does land.
|
|
52
|
-
*
|
|
53
|
-
* ── WHY `.mjs` AND NOT A `.hook.ts` SPEC ────────────────────────────────────
|
|
54
|
-
* See `paper-edit-guard.hook.mjs`: a `.ts` hook reached through `node_modules` does not load,
|
|
55
|
-
* and a consumer-side thin spec importing this logic is refused by `vigiles compile` and can
|
|
56
|
-
* never be re-stamped. Both halves measured there.
|
|
57
|
-
*/
|
|
58
|
-
import {
|
|
59
|
-
experimental_defineReact,
|
|
60
|
-
tools,
|
|
61
|
-
provide,
|
|
62
|
-
run,
|
|
63
|
-
nothing,
|
|
64
|
-
} from "vigiles/hook";
|
|
65
|
-
|
|
66
|
-
/** The tool's name — the package this hook resolves its scripts through. */
|
|
67
|
-
export const CONFIG_KEY = "paperlint";
|
|
68
|
-
/** The settings file at the project root. Optional: absent means every default. */
|
|
69
|
-
export const CONFIG_FILE = "paperlint.json";
|
|
70
|
-
/** The default. A consumer that declares nothing is assumed to keep papers in `papers/`. */
|
|
71
|
-
export const DEFAULT_PAPERS_ROOT = "papers";
|
|
72
|
-
/**
|
|
73
|
-
* The field of the root `paperlint.json` that names the papers directory. These are copies of the
|
|
74
|
-
* constants in `lib/paper-config.mjs` (a hook may import nothing but `vigiles/hook`);
|
|
75
|
-
* `lib/paper-config.harness.mjs` checks that the copies match.
|
|
76
|
-
*/
|
|
77
|
-
export const PAPERS_DIR_FIELD = "papersDir";
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* The provider: the root `paperlint.json`, or `{}` when the project has none — so an ABSENT file
|
|
81
|
-
* (every default) and an UNREADABLE one (the empty string the runtime gives a failed provider)
|
|
82
|
-
* stay two different inputs.
|
|
83
|
-
*
|
|
84
|
-
* 🔴 THE PATH IS ANCHORED TO THE PROJECT ROOT. vigiles runs a provider "via execSync in the hook's
|
|
85
|
-
* cwd", which is the consumer's wiring — a string this hook cannot see. A bare relative path reads
|
|
86
|
-
* from whatever directory the Bash tool last moved to.
|
|
87
|
-
*/
|
|
88
|
-
const READ_CONFIG = `f="\${CLAUDE_PROJECT_DIR:-.}/${CONFIG_FILE}"; if [ -e "$f" ]; then cat "$f"; else echo '{}'; fi`;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The declared papers root, or `null` when it is unusable.
|
|
92
|
-
*
|
|
93
|
-
* ⚠️ `null` means SILENCE, not refusal — same asymmetry as `paper-skills-nudge` and for the same
|
|
94
|
-
* reason: this is advisory, and a `react` cannot deny anyway. The gate (`paper-edit-guard`) is
|
|
95
|
-
* the one that must refuse on an unreadable declaration, because there a silent default would
|
|
96
|
-
* pass the very writes it exists to stop.
|
|
97
|
-
*
|
|
98
|
-
* 🔴 `declared === undefined`, NOT `declared ?? DEFAULT` — `"papersDir": null` is a keystroke, not
|
|
99
|
-
* an absence.
|
|
100
|
-
*/
|
|
101
|
-
const papersRoot = (rawConfig) => {
|
|
102
|
-
let declared;
|
|
103
|
-
try {
|
|
104
|
-
declared = JSON.parse(rawConfig)?.[PAPERS_DIR_FIELD];
|
|
105
|
-
} catch {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
const root = declared === undefined ? DEFAULT_PAPERS_ROOT : declared;
|
|
109
|
-
if (typeof root !== "string" || root.length === 0) return null;
|
|
110
|
-
return root.replace(/\/+$/, "");
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* A paper SOURCE under `<root>/<dir>/`, with `<dir>` captured.
|
|
115
|
-
*
|
|
116
|
-
* 🔴 THE ROOT IS REGEX-ESCAPED. It is a path from a config file, and `.` is both a legal
|
|
117
|
-
* directory character and a regex wildcard: an unescaped root like `docs.v2/papers` would match
|
|
118
|
-
* `docsXv2/papers` too. Cheap to get right, and the failure it prevents is a hook firing about
|
|
119
|
-
* the wrong tree.
|
|
120
|
-
*/
|
|
121
|
-
const paperSourceRe = (root) =>
|
|
122
|
-
new RegExp(
|
|
123
|
-
`(?:^|/)${root.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/([A-Za-z0-9._-]+)/[^/]*\\.tex$`,
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* The tool invocation, with the script located rather than assumed.
|
|
128
|
-
*
|
|
129
|
-
* 🔴 `require.resolve` INSTEAD OF A HARD-CODED `node_modules/<pkg>/…` PATH. This package must
|
|
130
|
-
* not spell its own install location: a consumer may install it under an alias, and a
|
|
131
|
-
* pnpm/yarn-berry layout is not `node_modules/<name>` at all. `require.resolve` asks the
|
|
132
|
-
* resolver the same question Node itself answers, and it works for a non-JS extension —
|
|
133
|
-
* measured 2026-09-12 against a `.md` and a `.sh` in an installed copy. It runs in a `$(…)`
|
|
134
|
-
* because `run()` goes through a shell (also measured).
|
|
135
|
-
*/
|
|
136
|
-
const surface = (dir) =>
|
|
137
|
-
`bash "$(node -p "require.resolve('${CONFIG_KEY}/hooks/paper-status-gates.sh')")" --surface ${dir}`;
|
|
138
|
-
|
|
139
|
-
export default experimental_defineReact({
|
|
140
|
-
on: "PostToolUse",
|
|
141
|
-
match: tools("Edit", "Write", "MultiEdit"),
|
|
142
|
-
// The provider is anchored to the project root (`READ_CONFIG`, above).
|
|
143
|
-
//
|
|
144
|
-
// ⚠️ THE FAILURE HERE IS SILENT, which makes it more dangerous than its neighbor's.
|
|
145
|
-
// `paper-edit-guard` on PreToolUse DENIES loudly and visibly when the declaration is
|
|
146
|
-
// unreadable. This hook on PostToolUse just returns `nothing()`, i.e. simply stops firing:
|
|
147
|
-
// the `cat` fails → empty string → `JSON.parse("")` throws → `papersRoot` returns null
|
|
148
|
-
// → silence. And silence is exactly what a nudge's success state looks like, so a dead hook
|
|
149
|
-
// is indistinguishable from a working one.
|
|
150
|
-
needs: [provide("config", READ_CONFIG)],
|
|
151
|
-
react: (e) => {
|
|
152
|
-
const root = papersRoot(e.ctx.config);
|
|
153
|
-
if (root === null) return nothing();
|
|
154
|
-
const m = paperSourceRe(root).exec(e.path.raw.replace(/^\.\//, ""));
|
|
155
|
-
if (m === null) return nothing();
|
|
156
|
-
return run(surface(m[1]));
|
|
157
|
-
},
|
|
158
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# paper-status-gates.sh — NOT A HOOK. This is a TOOL invoked by `paper-status-gates.hook.mjs`,
|
|
3
|
-
# which owns the event routing and decides WHICH paper (if any) an edit concerned.
|
|
4
|
-
#
|
|
5
|
-
# --surface <paper-dir> print the readiness verdict and the unrun gates
|
|
6
|
-
#
|
|
7
|
-
# 🔴 WHAT LEFT THIS FILE AND WHY IT MATTERS. It used to read its payload with
|
|
8
|
-
# `INPUT="${CLAUDE_TOOL_INPUT:-}"` plus a `timeout 1 cat` fallback and then grep that blob for a
|
|
9
|
-
# paper path. `$CLAUDE_TOOL_INPUT` is NOT set by the harness — the payload arrives on stdin — and
|
|
10
|
-
# that single idiom left THREE hooks silently dead for twelve days. None of it survives here:
|
|
11
|
-
# this file receives an already-validated directory NAME as an argument, and it is registered as
|
|
12
|
-
# a hook nowhere, so it cannot contract that disease again.
|
|
13
|
-
#
|
|
14
|
-
# Advisory (stderr), never blocks, always exits 0.
|
|
15
|
-
set -euo pipefail
|
|
16
|
-
|
|
17
|
-
[ "${1:-}" = "--surface" ] || {
|
|
18
|
-
echo "paper-status-gates.sh: a tool, not a hook. Use --surface <paper-dir>." >&2
|
|
19
|
-
exit 0
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
pdir_name="${2:-}"
|
|
23
|
-
[ -n "$pdir_name" ] || exit 0
|
|
24
|
-
# Defence in depth: the hook already anchored this to [A-Za-z0-9._-]+, and it is re-checked here
|
|
25
|
-
# so the file is safe to call directly too.
|
|
26
|
-
case "$pdir_name" in
|
|
27
|
-
*[!A-Za-z0-9._-]* | "" | . | ..) exit 0 ;;
|
|
28
|
-
esac
|
|
29
|
-
|
|
30
|
-
# ── WHERE THE CONSUMER'S THINGS ARE — READ, NOT ASSUMED ─────────────────────
|
|
31
|
-
# The papers path comes from the one declaration every other carrier of this package reads, the
|
|
32
|
-
# project's root paperlint.json (optional — absent means the default):
|
|
33
|
-
#
|
|
34
|
-
# { "papersDir": "docs/papers" }
|
|
35
|
-
#
|
|
36
|
-
# ⚠️ `node -p` RATHER THAN grep/sed ON THE FILE. A JSON value is not a line of text: it can
|
|
37
|
-
# be quoted, escaped, or spread across lines, and a pattern that gets it right today gets it
|
|
38
|
-
# wrong on the first reformat — silently, by producing a root that matches nothing. Node is
|
|
39
|
-
# already a hard dependency of the hook that runs this script, so there is no new requirement.
|
|
40
|
-
ROOT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
41
|
-
read_key() { # $1 = key, $2 = default
|
|
42
|
-
node -p "((c) => c['$1'] ?? '$2')((() => { try { return require('$ROOT_DIR/paperlint.json') } catch { return {} } })())" \
|
|
43
|
-
2>/dev/null || echo "$2"
|
|
44
|
-
}
|
|
45
|
-
papers_root="$(read_key papersDir papers)"
|
|
46
|
-
|
|
47
|
-
# 🔴 AN UNUSABLE ROOT EXITS, IT DOES NOT BUILD A PATH FROM IT. `node -p` prints `undefined` for a
|
|
48
|
-
# key whose value is literally `null` (`?? ` only catches null/undefined AFTER the object lookup,
|
|
49
|
-
# and a `null` value reaches the default — but a malformed paperlint.json reads as {} and
|
|
50
|
-
# hands back the default). Either way, an empty or nonsense value would
|
|
51
|
-
# produce `/<paper>/PIPELINE-STATUS.md` rooted at the filesystem, which does not exist, and this
|
|
52
|
-
# script would exit 0 looking like a paper with nothing to report. Named rather than risked.
|
|
53
|
-
case "$papers_root" in
|
|
54
|
-
"" | undefined | null) exit 0 ;;
|
|
55
|
-
esac
|
|
56
|
-
|
|
57
|
-
pdir="$papers_root/$pdir_name"
|
|
58
|
-
STATUS="$ROOT_DIR/$pdir/PIPELINE-STATUS.md"
|
|
59
|
-
[ -f "$STATUS" ] || exit 0
|
|
60
|
-
|
|
61
|
-
# 🔴 SURFACE THE VERDICT, UNPROMPTED — see the header: the checker parsed this line and never
|
|
62
|
-
# printed it, so the single fact anyone actually wanted was the one the tooling withheld.
|
|
63
|
-
VERDICT=$(grep -m1 -E '^\*\*Readiness verdict:\*\*' "$STATUS" 2>/dev/null || true)
|
|
64
|
-
if [ -n "$VERDICT" ]; then
|
|
65
|
-
echo "📊 $(echo "$VERDICT" | sed -E 's/\*\*//g' | cut -c1-200)" >&2
|
|
66
|
-
else
|
|
67
|
-
echo "📊 PIPELINE-STATUS.md has NO '**Readiness verdict:**' line — the scorecard cannot say" >&2
|
|
68
|
-
echo " whether this paper is submittable, which is the one question it exists to answer." >&2
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
# The gates a table row marks ☐ (not run), each with the skill that owns it. A report, not an order:
|
|
72
|
-
# the final review runs once, and a row it closed (☑ closed) is not unrun. Only table rows count, so
|
|
73
|
-
# the checklist line under the GATES table is not read as a gate.
|
|
74
|
-
owner_of() { # $1 = the row's id; empty for a row that is not one of these gates
|
|
75
|
-
case "$1" in
|
|
76
|
-
structure | coldread | panel) echo "the final review, once (paper-pipeline, \"The final review\")" ;;
|
|
77
|
-
harden) echo "the submit checklist (harden-paper)" ;;
|
|
78
|
-
cites) echo "verify-citations, on every \\cite added or moved" ;;
|
|
79
|
-
venuebar) echo "study-accepted-papers" ;;
|
|
80
|
-
esac
|
|
81
|
-
}
|
|
82
|
-
ids=$(grep -E '^\|' "$STATUS" 2>/dev/null | grep '☐' | grep -v 'closed' |
|
|
83
|
-
awk -F'|' '{ gsub(/ /, "", $2); print $2 }' || true)
|
|
84
|
-
report=""
|
|
85
|
-
for g in $ids; do
|
|
86
|
-
o=$(owner_of "$g")
|
|
87
|
-
[ -n "$o" ] && report="$report $g — $o"$'\n'
|
|
88
|
-
done
|
|
89
|
-
if [ -n "$report" ]; then
|
|
90
|
-
echo "📋 Not run yet in $pdir/PIPELINE-STATUS.md (☐):" >&2
|
|
91
|
-
printf '%s' "$report" >&2
|
|
92
|
-
fi
|
|
93
|
-
exit 0
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* paper-status-gates on the two declarations the hooks harness does not carry: none at all (the
|
|
3
|
-
* default `papers/` root applies) and one that does not parse (silence — this hook never blocks).
|
|
4
|
-
* Then the report of unrun gates: it fires on a planted ☐ and stays quiet on a clean or closed status.
|
|
5
|
-
*/
|
|
6
|
-
import assert from "node:assert/strict";
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import { test } from "vitest";
|
|
9
|
-
import { hookConsumer, onEdit, runShippedHook } from "../test/hook-consumer.ts";
|
|
10
|
-
import { useTempDir } from "../test/support.ts";
|
|
11
|
-
|
|
12
|
-
const root = useTempDir("paper-status-gates-");
|
|
13
|
-
const STATUS = "**Readiness verdict:** ✅ fixture verdict line\n";
|
|
14
|
-
|
|
15
|
-
test("no paperlint.json: an edit under papers/ runs the gates for that paper", () => {
|
|
16
|
-
const dir = hookConsumer(join(root, "default"), {
|
|
17
|
-
"papers/alpha/PIPELINE-STATUS.md": STATUS,
|
|
18
|
-
});
|
|
19
|
-
const r = runShippedHook(
|
|
20
|
-
"paper-status-gates",
|
|
21
|
-
onEdit("papers/alpha/paper.tex"),
|
|
22
|
-
dir,
|
|
23
|
-
);
|
|
24
|
-
assert.equal(r.exitCode, 0);
|
|
25
|
-
assert.match(r.stderr, /fixture verdict line/);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test("a paperlint.json that does not parse: silent, exit 0", () => {
|
|
29
|
-
const dir = hookConsumer(join(root, "broken"), {
|
|
30
|
-
"paperlint.json": "{ nope",
|
|
31
|
-
"papers/alpha/PIPELINE-STATUS.md": STATUS,
|
|
32
|
-
});
|
|
33
|
-
const r = runShippedHook(
|
|
34
|
-
"paper-status-gates",
|
|
35
|
-
onEdit("papers/alpha/paper.tex"),
|
|
36
|
-
dir,
|
|
37
|
-
);
|
|
38
|
-
assert.deepEqual([r.exitCode, r.stdout, r.stderr], [0, "", ""]);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test("an edit to a file of the paper other than its source: no gates run", () => {
|
|
42
|
-
const dir = hookConsumer(join(root, "not-a-source"), {
|
|
43
|
-
"papers/alpha/PIPELINE-STATUS.md": STATUS,
|
|
44
|
-
});
|
|
45
|
-
const r = runShippedHook(
|
|
46
|
-
"paper-status-gates",
|
|
47
|
-
onEdit("papers/alpha/notes.txt"),
|
|
48
|
-
dir,
|
|
49
|
-
);
|
|
50
|
-
assert.deepEqual([r.exitCode, r.stdout, r.stderr], [0, "", ""]);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
/** A status file with the verdict line and the given GATES rows. */
|
|
54
|
-
const statusWith = (...rows: readonly string[]): string =>
|
|
55
|
-
[
|
|
56
|
-
STATUS,
|
|
57
|
-
"| id | Gate | Skill | Requires | Status | Date | Result | Open |",
|
|
58
|
-
"| -- | ---- | ----- | -------- | ------ | ---- | ------ | ---- |",
|
|
59
|
-
...rows,
|
|
60
|
-
"",
|
|
61
|
-
].join("\n");
|
|
62
|
-
|
|
63
|
-
const gatesOf = (name: string, status: string) =>
|
|
64
|
-
runShippedHook(
|
|
65
|
-
"paper-status-gates",
|
|
66
|
-
onEdit("papers/alpha/paper.tex"),
|
|
67
|
-
hookConsumer(join(root, name), {
|
|
68
|
-
"papers/alpha/PIPELINE-STATUS.md": status,
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
test("unrun gates are reported with their owner, and nothing orders a rerun", () => {
|
|
73
|
-
const r = gatesOf(
|
|
74
|
-
"unrun",
|
|
75
|
-
statusWith(
|
|
76
|
-
"| panel | Review decision | pc-panel-review | structure, coldread | ☐ | — | — | — |",
|
|
77
|
-
"| harden | Submit checklist | harden-paper | panel, cites | ☐ | — | — | — |",
|
|
78
|
-
),
|
|
79
|
-
);
|
|
80
|
-
assert.equal(r.exitCode, 0);
|
|
81
|
-
assert.deepEqual(r.stderr.split("\n").slice(1), [
|
|
82
|
-
"📋 Not run yet in papers/alpha/PIPELINE-STATUS.md (☐):",
|
|
83
|
-
' panel — the final review, once (paper-pipeline, "The final review")',
|
|
84
|
-
" harden — the submit checklist (harden-paper)",
|
|
85
|
-
"",
|
|
86
|
-
]);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test("a clean status and a closed final review report no gate", () => {
|
|
90
|
-
const r = gatesOf(
|
|
91
|
-
"closed",
|
|
92
|
-
statusWith(
|
|
93
|
-
"| panel | Review decision | pc-panel-review | structure, coldread | ☑ closed 2026-11-19 | 2026-11-19 | weak accept | — |",
|
|
94
|
-
"| harden | Submit checklist | harden-paper | panel, cites | ☑ | 2026-11-19 | ready | — |",
|
|
95
|
-
),
|
|
96
|
-
);
|
|
97
|
-
assert.deepEqual(
|
|
98
|
-
[r.exitCode, r.stderr],
|
|
99
|
-
[0, "📊 Readiness verdict: ✅ fixture verdict line\n"],
|
|
100
|
-
);
|
|
101
|
-
});
|