paperlint 18.9.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CLAUDE.md +7 -1
- package/dist/skill-chunks/{chunk-NPQVDEE4.js → chunk-4MHEJ6FR.js} +50 -1
- package/dist/skill-chunks/{chunk-KWK6RT4T.js → chunk-EOVEVX67.js} +1 -1
- package/dist/skill-chunks/{chunk-65X5HVIJ.js → chunk-UL4INX2P.js} +1 -1
- package/lib/skill-corpus.mjs +2 -113
- package/lib/skill-corpus.test.mjs +10 -11
- package/package.json +4 -3
- package/presets/agentverify-2027.jsonc +12 -6
- package/presets/agentverify-2027.md +11 -7
- package/presets/aidc-2026.jsonc +4 -4
- package/presets/aidc-2026.md +4 -0
- package/presets/nlbse-2027.jsonc +11 -6
- package/presets/nlbse-2027.md +7 -7
- package/scripts/harness-api.frozen.json +0 -18
- package/scripts/sync-skills.test.ts +69 -0
- package/scripts/sync-skills.ts +57 -0
- package/skills/argument-arc/scripts/headings.js +2 -2
- package/skills/build-label-page/build-label-page.test.ts +2 -7
- package/skills/build-label-page/scripts/label-page.js +1 -1
- package/skills/cold-read-diff/scripts/cold-read.js +2 -2
- package/skills/harden-paper/check-numbers.test.ts +104 -0
- package/skills/harden-paper/check-release-claims.test.ts +126 -0
- package/skills/label-agent-runs/label-agent-runs.harness.ts +2 -6
- package/skills/label-agent-runs/scripts/labels.js +1 -1
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +3 -3
- package/skills/pc-panel-review/scripts/prior-reviews.js +1 -1
- package/skills/render-paper/render-paper.harness.mjs +153 -0
- package/skills/rewrite-unclear/rewrite-unclear.harness.ts +0 -5
- package/skills/run-agent-grid/run-agent-grid.harness.ts +2 -6
- package/skills/run-agent-grid/scripts/grid-guard.js +1 -1
- package/skills/submit-paper/check-deanon.test.ts +165 -0
- package/skills/verify-citations/scripts/bib-authors.js +3 -3
- package/skills/verify-citations/scripts/verify-cites.js +3 -3
- package/src/edition-rule.test.ts +16 -12
- package/lib/skill-checks.d.mts +0 -10
- package/lib/skill-checks.mjs +0 -403
- package/lib/skill-checks.test.mjs +0 -288
- package/skills/analyze-sibling-paper/analyze-sibling-paper.harness.mjs +0 -23
- package/skills/argument-arc/argument-arc.harness.mjs +0 -23
- package/skills/build-benchmark/build-benchmark.harness.mjs +0 -23
- package/skills/camera-ready/camera-ready.harness.mjs +0 -23
- package/skills/cold-read-diff/cold-read-diff.harness.mjs +0 -21
- package/skills/draft-paper/draft-paper.harness.mjs +0 -23
- package/skills/extend-paper/extend-paper.harness.mjs +0 -23
- package/skills/find-venue/find-venue.harness.mjs +0 -23
- package/skills/harden-paper/harden-paper.harness.mjs +0 -23
- package/skills/map-prior-work/map-prior-work.harness.mjs +0 -23
- package/skills/paper-status/paper-status.harness.mjs +0 -25
- package/skills/pc-panel-review/pc-panel-review.harness.mjs +0 -24
- package/skills/plan-paper-timeline/plan-paper-timeline.harness.mjs +0 -23
- package/skills/research-ideate/research-ideate.harness.mjs +0 -23
- package/skills/study-accepted-papers/study-accepted-papers.harness.mjs +0 -23
- package/skills/submit-paper/submit-paper.harness.mjs +0 -23
- package/skills/tighten-paper/tighten-paper.harness.mjs +0 -23
- package/skills/verify-citations/verify-citations.harness.mjs +0 -23
package/lib/skill-checks.mjs
DELETED
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* skill-checks.mjs — everything asserted about ONE skill, as a function you call with its name.
|
|
3
|
-
* `checkSkill("verify-citations")`.
|
|
4
|
-
*
|
|
5
|
-
* WHY A FUNCTION AND NOT A HARNESS. Until 2026-08-11 these assertions lived in
|
|
6
|
-
* `skills.harness.mjs`, a 614-line file named after no surface, and the 21 colocated per-skill
|
|
7
|
-
* harnesses reached it by setting `PIPELINE_SKILL_ONLY` and importing it for its side effects.
|
|
8
|
-
* That is a script pretending to be an API: the caller could not pass an argument, could not get
|
|
9
|
-
* a result, and the coupling was an environment variable. The owner asked three times why the
|
|
10
|
-
* file survived; the answer was that I had wrapped it instead of splitting it.
|
|
11
|
-
*
|
|
12
|
-
* WHAT IS CHECKED HERE. Anything decidable from one SKILL.md: strict-YAML frontmatter, the
|
|
13
|
-
* declared tool contract, every script path it instructs, and whether it is PERMITTED to run what
|
|
14
|
-
* it instructs.
|
|
15
|
-
*
|
|
16
|
-
* 🔴 KNOWN-RED ASSERTIONS ARE DEFERRED, NOT WEAKENED, and the deferral list is now PER CALL.
|
|
17
|
-
* A throw would abort the rest, making one open finding silently skip every check after it —
|
|
18
|
-
* the failure this whole directory exists to end. Per call matters too: with one shared list,
|
|
19
|
-
* a full sweep could attribute one skill's failures to another's line in the report.
|
|
20
|
-
*/
|
|
21
|
-
import assert from "node:assert/strict";
|
|
22
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
23
|
-
import { join } from "node:path";
|
|
24
|
-
import { recordCheck } from "vigiles";
|
|
25
|
-
import { presetsDir } from "#src/package-dirs";
|
|
26
|
-
|
|
27
|
-
import { SKILLS_DIR, ROOT, load, commands, permits } from "./skill-corpus.mjs";
|
|
28
|
-
|
|
29
|
-
// Where the pipeline's own scripts live is asked of the package, not spelled here. The resolver
|
|
30
|
-
// refuses a root that is not on disk, because every use below is a FILTER: a wrong prefix would
|
|
31
|
-
// match nothing and report a clean skill that was never examined.
|
|
32
|
-
import {
|
|
33
|
-
pipelineScripts,
|
|
34
|
-
scriptsRoot,
|
|
35
|
-
} from "../skills/paper-pipeline/scripts/consumer.mjs";
|
|
36
|
-
|
|
37
|
-
const PIPELINE = pipelineScripts(scriptsRoot({ env: {}, cwd: ROOT }));
|
|
38
|
-
/** How a SKILL.md names its own directory in a command: Claude Code substitutes it wherever the skill is. */
|
|
39
|
-
const SKILL_DIR_VAR = "${CLAUDE_SKILL_DIR}/";
|
|
40
|
-
|
|
41
|
-
/** How a skill names a file of the package's presets directory. */
|
|
42
|
-
const PRESETS_PREFIX = "presets/";
|
|
43
|
-
|
|
44
|
-
/** The preset files a skill's text names in code spans (`presets/agenticdev-2026.md`), placeholders left out. */
|
|
45
|
-
export const presetRefs = (src) => [
|
|
46
|
-
...new Set(
|
|
47
|
-
[...src.matchAll(/`(presets\/[A-Za-z0-9._-]+)`/g)].map((m) => m[1]),
|
|
48
|
-
),
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Assert everything single-skill about `name`. Throws with EVERY finding, not the first.
|
|
53
|
-
* Returns the number of skills checked (1) so a caller can report what it actually did.
|
|
54
|
-
*/
|
|
55
|
-
export async function checkSkill(name) {
|
|
56
|
-
if (!existsSync(join(SKILLS_DIR, name, "SKILL.md")))
|
|
57
|
-
throw new Error(`"${name}" has no SKILL.md under ${SKILLS_DIR}`);
|
|
58
|
-
const deferred = [];
|
|
59
|
-
const soft = (fn) => {
|
|
60
|
-
try {
|
|
61
|
-
fn();
|
|
62
|
-
} catch (e) {
|
|
63
|
-
deferred.push(e);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const skills = [load(name)];
|
|
67
|
-
|
|
68
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
69
|
-
// 1. GONE, AND THAT IS THE RESULT (2026-08-19). This slot held a strict-YAML assertion whose whole
|
|
70
|
-
// job was to police the gap between how the corpus was READ here (a hand-rolled lenient reader)
|
|
71
|
-
// and how every other consumer reads it (a real YAML parser). The corpus owner, on being shown the gap:
|
|
72
|
-
// "sounds like a hack… let's think about how to do it properly". The right fix was not a better
|
|
73
|
-
// check — it was to stop being lenient: the two remaining unparseable descriptions were quoted and
|
|
74
|
-
// `parseFm` in skill-corpus.mjs now throws on anything a real parser rejects.
|
|
75
|
-
//
|
|
76
|
-
// So the defect class is not detected here any more; it is UNREACHABLE. A skill whose frontmatter
|
|
77
|
-
// is not valid YAML does not reach these assertions with a plausible-looking object and a missing
|
|
78
|
-
// `allowed-tools` — it does not load at all, and says why. What the corpus does about the root
|
|
79
|
-
// cause (`vigiles compile` interpolating the description into YAML raw) is written where the
|
|
80
|
-
// parser lives.
|
|
81
|
-
|
|
82
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
83
|
-
// 2-4. Identity and contract fields, read from the strict parse — there is no other kind now, and
|
|
84
|
-
// nothing above can fail while leaving these reachable. `name` is what Claude Code lists and
|
|
85
|
-
// matches the skill by, so a name that disagrees with its directory is two identities for one skill.
|
|
86
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
87
|
-
for (const s of skills) {
|
|
88
|
-
soft(() =>
|
|
89
|
-
assert.equal(
|
|
90
|
-
s.fm.name,
|
|
91
|
-
s.name,
|
|
92
|
-
`${s.name}: frontmatter name is ${JSON.stringify(s.fm.name)} but the directory is "${s.name}".`,
|
|
93
|
-
),
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
soft(() =>
|
|
97
|
-
assert.ok(
|
|
98
|
-
(s.fm.description || "").length > 40,
|
|
99
|
-
`${s.name}: description is missing or trivially short (${(s.fm.description || "").length} chars). ` +
|
|
100
|
-
`The description is the ONLY thing the model matches on when choosing a skill — an empty one is ` +
|
|
101
|
-
`a skill that never fires, and a skill that never fires is indistinguishable from one that works.`,
|
|
102
|
-
),
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
soft(() =>
|
|
106
|
-
assert.ok(
|
|
107
|
-
s.tools.length > 0,
|
|
108
|
-
`${s.name}: no allowed-tools. A skill declaring nothing INHERITS EVERYTHING — Bash, WebFetch and ` +
|
|
109
|
-
`every MCP server (Calendar, GitHub-write, Vercel) — over a repo holding health data, DNA and ` +
|
|
110
|
-
`bank balances. This is the finding the 2026-08-03 audit closed for all 35 skills.`,
|
|
111
|
-
),
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
116
|
-
// 7. EVERY script path the skill instructs resolves.
|
|
117
|
-
//
|
|
118
|
-
// Scoped to paths that are unambiguously resolvable: `${CLAUDE_SKILL_DIR}/…` and `scripts/…`, both
|
|
119
|
-
// skill-relative. A `.claude/skills/…` path is not resolved here: under the plugin no such folder
|
|
120
|
-
// exists, and `port/md-install-path` flags it in the skill's text. A `.js` a skill runs is a build output
|
|
121
|
-
// (`npm run build`), so this checks the checkout as built. Paths
|
|
122
|
-
// like `repro/build-submission.sh` are relative to a PAPER directory that does not exist at test
|
|
123
|
-
// time, so they are excluded BY NAME rather than by a guess that would fire on correct text.
|
|
124
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
125
|
-
for (const s of skills) {
|
|
126
|
-
for (const c of commands(s.src)) {
|
|
127
|
-
const abs = c.script.startsWith(SKILL_DIR_VAR)
|
|
128
|
-
? join(SKILLS_DIR, s.name, c.script.slice(SKILL_DIR_VAR.length))
|
|
129
|
-
: c.script.startsWith("scripts/")
|
|
130
|
-
? join(SKILLS_DIR, s.name, c.script)
|
|
131
|
-
: null;
|
|
132
|
-
if (!abs) continue;
|
|
133
|
-
soft(() =>
|
|
134
|
-
assert.ok(
|
|
135
|
-
existsSync(abs),
|
|
136
|
-
`${s.name}: instructs \`${c.cmd}\` but ${c.script} does not exist (looked at ${abs}). Dead ` +
|
|
137
|
-
`instruction — the model will improvise something adjacent and report it as done.`,
|
|
138
|
-
),
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
144
|
-
// 8. A skill is PERMITTED TO RUN what it instructs. The inverse-direction risk of narrowing: over-
|
|
145
|
-
// narrow an allowed-tools entry and the skill's own instruction is denied at runtime, which looks
|
|
146
|
-
// like the skill silently declining a step — the same invisible failure as a dead hook, arrived at
|
|
147
|
-
// from the opposite direction. Nothing else checks the two halves against each other.
|
|
148
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
149
|
-
for (const s of skills) {
|
|
150
|
-
for (const c of commands(s.src)) {
|
|
151
|
-
// The pipeline's own scripts, by either spelling; any other command is the consumer's business.
|
|
152
|
-
const own =
|
|
153
|
-
c.script.startsWith(PIPELINE.prefix) ||
|
|
154
|
-
c.script.startsWith(SKILL_DIR_VAR);
|
|
155
|
-
if (!own) continue;
|
|
156
|
-
soft(() =>
|
|
157
|
-
assert.ok(
|
|
158
|
-
s.tools.some((t) => permits(t, c.cmd)),
|
|
159
|
-
`${s.name}: instructs \`${c.cmd}\` but its allowed-tools [${s.tools.join(", ")}] permit no such ` +
|
|
160
|
-
`Bash command. The instruction is denied at runtime and the step silently does not happen.`,
|
|
161
|
-
),
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
167
|
-
// 9. EVERY PRESET FILE the skill names exists in the package. Skills name a venue's card and preset
|
|
168
|
-
// as `presets/<name>.md` / `presets/<name>.jsonc` "in the package" — a path inside the package, the
|
|
169
|
-
// same in every install channel — and the cards once lived under a skill's `references/`, so a
|
|
170
|
-
// name that outlived a move would send the model to a file that is not there. Resolved against
|
|
171
|
-
// the package's presets directory (`#src/package-dirs`, the one module that knows where it is).
|
|
172
|
-
// Placeholders (`presets/<venue>.md`) are not names of a file and are left out.
|
|
173
|
-
// ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
174
|
-
for (const s of skills) {
|
|
175
|
-
for (const ref of presetRefs(s.src)) {
|
|
176
|
-
const abs = join(presetsDir(), ref.slice(PRESETS_PREFIX.length));
|
|
177
|
-
soft(() =>
|
|
178
|
-
assert.ok(
|
|
179
|
-
existsSync(abs),
|
|
180
|
-
`${s.name}: names \`${ref}\` in the package, and there is no such file (looked at ${abs}).`,
|
|
181
|
-
),
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (deferred.length) {
|
|
187
|
-
const e = new Error(
|
|
188
|
-
`${deferred.length} assertion(s) failed for skill "${name}":\n\n` +
|
|
189
|
-
deferred.map((d, i) => ` [${i + 1}] ${d.message}`).join("\n\n"),
|
|
190
|
-
);
|
|
191
|
-
e.stack = e.message;
|
|
192
|
-
throw e;
|
|
193
|
-
}
|
|
194
|
-
// Reported so `vigiles test` can tell a run that verified this skill from a file that merely
|
|
195
|
-
// sits beside it — the distinction colocation cannot make (see vigiles check-count.ts).
|
|
196
|
-
recordCheck();
|
|
197
|
-
console.log(`✓ ${name}: frontmatter, script paths, tool contract`);
|
|
198
|
-
return 1;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/** The shared reference every skill that scores soundness or novelty points to, and its fallback line. */
|
|
202
|
-
const VENUE_BAR_REF = "paper-pipeline/references/venue-bar.md";
|
|
203
|
-
const VENUE_BAR_FALLBACK = "main-conference bar assumed";
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Assert that the skill `name`, which scores soundness or novelty, takes the venue's measured bar:
|
|
207
|
-
* it names the one shared reference and carries the no-summary fallback line. Both halves are
|
|
208
|
-
* needed: a skill that reads the summary but never says what a missing one means scores against an
|
|
209
|
-
* unnamed main-conference bar in silence, and a skill that only says the fallback never reads it.
|
|
210
|
-
* The wording itself lives in the reference, so the reference must hold both as well.
|
|
211
|
-
*/
|
|
212
|
-
export function checkVenueBar(name) {
|
|
213
|
-
const skill = load(name);
|
|
214
|
-
const ref = join(SKILLS_DIR, VENUE_BAR_REF);
|
|
215
|
-
assert.ok(
|
|
216
|
-
existsSync(ref),
|
|
217
|
-
`${name}: ${VENUE_BAR_REF} does not exist (looked at ${ref}).`,
|
|
218
|
-
);
|
|
219
|
-
const shared = readFileSync(ref, "utf8");
|
|
220
|
-
const findings = [
|
|
221
|
-
[
|
|
222
|
-
skill.src.includes(VENUE_BAR_REF),
|
|
223
|
-
`does not point to \`${VENUE_BAR_REF}\``,
|
|
224
|
-
],
|
|
225
|
-
[
|
|
226
|
-
skill.src.includes("venues/<venue>/summary.md"),
|
|
227
|
-
"does not name `<papers-root>/venues/<venue>/summary.md`",
|
|
228
|
-
],
|
|
229
|
-
[
|
|
230
|
-
skill.src.includes(VENUE_BAR_FALLBACK),
|
|
231
|
-
`does not carry the fallback "${VENUE_BAR_FALLBACK}"`,
|
|
232
|
-
],
|
|
233
|
-
[
|
|
234
|
-
shared.includes(VENUE_BAR_FALLBACK),
|
|
235
|
-
`the shared reference lacks the fallback "${VENUE_BAR_FALLBACK}"`,
|
|
236
|
-
],
|
|
237
|
-
]
|
|
238
|
-
.filter(([ok]) => !ok)
|
|
239
|
-
.map(([, why]) => `${name}: ${why}`);
|
|
240
|
-
assert.deepEqual(
|
|
241
|
-
findings,
|
|
242
|
-
[],
|
|
243
|
-
`${name}: venue bar not wired:\n${findings.join("\n")}`,
|
|
244
|
-
);
|
|
245
|
-
recordCheck();
|
|
246
|
-
console.log(`✓ ${name}: venue bar input and fallback`);
|
|
247
|
-
return 1;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// ═════════════════════════════════════════════════════════════════════════════════════════════════
|
|
251
|
-
// checkProseSkill — for skills WITHOUT the pipeline (2026-08-27)
|
|
252
|
-
//
|
|
253
|
-
// WHY A SEPARATE FUNCTION. A prose skill only writes text, so Bash, Agent and Task are banned
|
|
254
|
-
// unless an exemption names a reason; a pipeline skill runs its scripts through narrowed Bash
|
|
255
|
-
// entries and is checked instead for whether those scripts exist and are permitted.
|
|
256
|
-
//
|
|
257
|
-
// 🔴 BOTH HALVES ARE BUILT IN, NOT WRITTEN BY HAND. The `CLAUDE.md` rule requires two halves of
|
|
258
|
-
// every check: it fires on a planted defect AND it stays silent on clean input. The "fires" half is
|
|
259
|
-
// written less often — it is not needed to make a run go green. So here it is not entrusted to the
|
|
260
|
-
// author: EVERY predicate below is run twice — over the real text and over the mutated one, and the
|
|
261
|
-
// disagreement of the verdicts IS the assertion. The mutation cannot be forgotten, there is nowhere
|
|
262
|
-
// to forget it.
|
|
263
|
-
//
|
|
264
|
-
// WHAT THIS DOES NOT PROVE: that the skill fires on the right request and that its advice gives a
|
|
265
|
-
// good result. The first is the trigger eval, the second is the model. Only what is decidable from
|
|
266
|
-
// the text is here.
|
|
267
|
-
// ═════════════════════════════════════════════════════════════════════════════════════════════════
|
|
268
|
-
|
|
269
|
-
/** Relative markdown links that do not resolve from the skill's directory. */
|
|
270
|
-
function danglingLinks(src, dir) {
|
|
271
|
-
const out = [];
|
|
272
|
-
for (const m of src.matchAll(/\[[^\]]*\]\(([^)\s]+)\)/g)) {
|
|
273
|
-
const t = m[1].split("#")[0];
|
|
274
|
-
if (!t || /^(https?:|mailto:)/.test(t)) continue;
|
|
275
|
-
if (!existsSync(join(dir, t))) out.push(t);
|
|
276
|
-
}
|
|
277
|
-
return out;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Check the prose skill `name`.
|
|
282
|
-
*
|
|
283
|
-
* @param {string} name — the directory name in `.claude/skills/`
|
|
284
|
-
* @param {{toolsNeeded?: Record<string,string>}} opts
|
|
285
|
-
* `toolsNeeded` — {tool: REASON}. Lifts the ban on Bash/Agent/Task for a skill that
|
|
286
|
-
* needs the tool IN SUBSTANCE. The reason is mandatory and non-empty.
|
|
287
|
-
*
|
|
288
|
-
* 🔴 Why `toolsNeeded` appeared (2026-09-01) and why it carries a REASON rather than a flag.
|
|
289
|
-
* The ban on Bash/Agent/Task was written for two text-only skills and was hard-wired as
|
|
290
|
-
* universal: "a skill that only writes text". For `session-retro` that is a lie — its own
|
|
291
|
-
* instruction prescribes SPAWNING auditors ("Spawn parallel audit subagents") and running
|
|
292
|
-
* measurements, that is, without Agent and Bash it does not do what it is.
|
|
293
|
-
*
|
|
294
|
-
* The temptation was to switch the check off for it entirely. That is wrong: the ban protects
|
|
295
|
-
* a repository with health data and balances from the third leg of the lethal trifecta, and it
|
|
296
|
-
* is still right for the rest. So it is not a flag but a NAMED exemption with a reason — the
|
|
297
|
-
* same form as `vigiles:local-by-design` in this same knowledge base: switching off is
|
|
298
|
-
* possible, but it stays written down, and the next reader sees WHAT exactly was decided.
|
|
299
|
-
*/
|
|
300
|
-
export async function checkProseSkill(name, opts = {}) {
|
|
301
|
-
const { skillContract } = await import("vigiles");
|
|
302
|
-
const dir = join(SKILLS_DIR, name);
|
|
303
|
-
const md = join(dir, "SKILL.md");
|
|
304
|
-
const deferred = [];
|
|
305
|
-
const soft = (fn) => {
|
|
306
|
-
try {
|
|
307
|
-
fn();
|
|
308
|
-
} catch (e) {
|
|
309
|
-
deferred.push(e);
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
// Any other option is refused by name: an option this function no longer reads would be a
|
|
314
|
-
// check the caller believes runs and that does nothing.
|
|
315
|
-
const unknown = Object.keys(opts).filter((k) => k !== "toolsNeeded");
|
|
316
|
-
assert.deepEqual(
|
|
317
|
-
unknown,
|
|
318
|
-
[],
|
|
319
|
-
`${name}: unknown option(s) ${unknown.join(", ")} — checkProseSkill takes only toolsNeeded`,
|
|
320
|
-
);
|
|
321
|
-
assert.ok(existsSync(md), `${name}: no ${md} — nothing to check`);
|
|
322
|
-
const src = readFileSync(md, "utf8");
|
|
323
|
-
|
|
324
|
-
// 1. The tool contract. Both skills deliberately DROPPED Bash — it was the third leg of the
|
|
325
|
-
// lethal trifecta over a repo with health data and balances. A regression here is silent: a
|
|
326
|
-
// skill with no parseable `allowed-tools` INHERITS EVERYTHING, and that looks exactly like a
|
|
327
|
-
// declared contract.
|
|
328
|
-
const c = await skillContract(dir);
|
|
329
|
-
soft(() =>
|
|
330
|
-
assert.equal(
|
|
331
|
-
c.malformed,
|
|
332
|
-
false,
|
|
333
|
-
`${name}: allowed-tools does not parse. The file LOOKS like it declares a contract, while a ` +
|
|
334
|
-
`strict parser sees nothing — the skill silently inherits every tool. Known cause: ` +
|
|
335
|
-
`\`vigiles compile\` strips the quotes off a scalar containing ": " and breaks the YAML ` +
|
|
336
|
-
`(see CLAUDE.md, measured 2026-08-19).`,
|
|
337
|
-
),
|
|
338
|
-
);
|
|
339
|
-
soft(() =>
|
|
340
|
-
assert.ok(
|
|
341
|
-
c.declared.length > 0,
|
|
342
|
-
`${name}: empty allowed-tools — inherits everything`,
|
|
343
|
-
),
|
|
344
|
-
);
|
|
345
|
-
const needed = opts.toolsNeeded ?? {};
|
|
346
|
-
// An exemption without a reason is not an exemption: an empty string would pass as "decided"
|
|
347
|
-
// while saying nothing. The same miss as "a counter that counts what it ignores".
|
|
348
|
-
for (const [tool, why] of Object.entries(needed))
|
|
349
|
-
assert.ok(
|
|
350
|
-
typeof why === "string" && why.trim().length >= 10,
|
|
351
|
-
`${name}: toolsNeeded.${tool} is declared without an intelligible reason. An exemption must ` +
|
|
352
|
-
`say WHY the tool is needed in substance — otherwise it is a silent disabling of the check.`,
|
|
353
|
-
);
|
|
354
|
-
for (const banned of ["Bash", "Agent", "Task"]) {
|
|
355
|
-
if (banned in needed) continue;
|
|
356
|
-
soft(() =>
|
|
357
|
-
assert.ok(
|
|
358
|
-
!c.declared.includes(banned),
|
|
359
|
-
`${name}: ${banned} appeared in the contract. It was dropped deliberately; bringing it back ` +
|
|
360
|
-
`restores a leg of the lethal trifecta (data + network + execution) on a skill that only ` +
|
|
361
|
-
`writes text. If the tool IS needed IN SUBSTANCE — declare it in toolsNeeded WITH A REASON, ` +
|
|
362
|
-
`not silently.`,
|
|
363
|
-
),
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
// The other side: an exemption that exempts nothing is garbage, and garbage accumulates.
|
|
367
|
-
// A year later such lines read as "there was a risk here", though there is no risk.
|
|
368
|
-
for (const tool of Object.keys(needed))
|
|
369
|
-
soft(() =>
|
|
370
|
-
assert.ok(
|
|
371
|
-
c.declared.includes(tool),
|
|
372
|
-
`${name}: toolsNeeded.${tool} is declared, but ${tool} itself is NOT in the contract. ` +
|
|
373
|
-
`The exemption is stale — remove it, otherwise it describes a different skill.`,
|
|
374
|
-
),
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
// 2. Links. The class we got burned on 2026-08-27: a file moves one level deeper, the link
|
|
378
|
-
// stays as it was and silently stops resolving. A grep by name does not see that.
|
|
379
|
-
const dangling = danglingLinks(src, dir);
|
|
380
|
-
soft(() =>
|
|
381
|
-
assert.deepEqual(
|
|
382
|
-
dangling,
|
|
383
|
-
[],
|
|
384
|
-
`${name}: dangling links → ${dangling.join(", ")}. A skill naming a path that does not exist ` +
|
|
385
|
-
`is a dead instruction: the model reads it, does something adjacent and reports success.`,
|
|
386
|
-
),
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
// 3. Whether it is compiled. Editing the markdown by hand desynchronises the sha and gets
|
|
390
|
-
// quietly rolled back by the next `vigiles compile`.
|
|
391
|
-
soft(() =>
|
|
392
|
-
assert.ok(
|
|
393
|
-
/vigiles:sha256:/.test(src),
|
|
394
|
-
`${name}: no compilation mark. That means SKILL.md was edited by hand rather than through ` +
|
|
395
|
-
`.spec.ts — the next \`vigiles compile\` will overwrite the edit without warning.`,
|
|
396
|
-
),
|
|
397
|
-
);
|
|
398
|
-
|
|
399
|
-
if (deferred.length)
|
|
400
|
-
throw new AggregateError(deferred, `${name}: ${deferred.length} findings`);
|
|
401
|
-
recordCheck();
|
|
402
|
-
return 1;
|
|
403
|
-
}
|