@uinaf/skillcheck 1.7.6 → 1.7.8
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/README.md +16 -27
- package/dist/cli.js +29 -31
- package/dist/grok-provider.js +20 -9
- package/dist/lint.js +5 -6
- package/dist/scenario.js +7 -8
- package/dist/skill-evidence.js +14 -9
- package/dist/transform.js +3 -4
- package/docs/adoption.md +19 -68
- package/docs/scenarios.md +70 -103
- package/docs/usage.md +90 -205
- package/package.json +7 -6
- package/docs/authoring.md +0 -70
- package/docs/releasing.md +0 -88
package/README.md
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# uinaf/skillcheck
|
|
4
4
|
|
|
5
|
-
Lint and eval harness for agent skills
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Built for [uinaf](https://uinaf.dev) skill repos. Nothing in it is
|
|
10
|
-
uinaf-specific. It ships no opinion about what a skill should say, only about
|
|
11
|
-
where skills sit and how a scenario is scored.
|
|
5
|
+
Lint and eval harness for agent skills: a keyless structural lint any repo can
|
|
6
|
+
run in CI, and a promptfoo-driven eval loop that grades what a skill makes an
|
|
7
|
+
agent do.
|
|
12
8
|
|
|
13
9
|
## Install
|
|
14
10
|
|
|
@@ -16,12 +12,8 @@ where skills sit and how a scenario is scored.
|
|
|
16
12
|
pnpm add -D @uinaf/skillcheck
|
|
17
13
|
```
|
|
18
14
|
|
|
19
|
-
Node 24 or newer. The
|
|
20
|
-
|
|
21
|
-
the lint-only install stays at a handful of packages. The promptfoo eval engine
|
|
22
|
-
and provider SDKs are optional peers, installed only on the operator machine
|
|
23
|
-
that runs evals ([adoption](docs/adoption.md)). Consumers still pinned to the
|
|
24
|
-
pre-npm git tags are covered there too.
|
|
15
|
+
Node 24 or newer. The lint-only install has no regular dependencies and runs
|
|
16
|
+
no install scripts. Evals need optional peers ([adoption](docs/adoption.md)).
|
|
25
17
|
|
|
26
18
|
## Use
|
|
27
19
|
|
|
@@ -32,14 +24,12 @@ skillcheck sweep --trials 3 # every scenario, three trials each
|
|
|
32
24
|
skillcheck summarize # per-scenario and per-skill scorecard
|
|
33
25
|
```
|
|
34
26
|
|
|
35
|
-
`
|
|
36
|
-
stay operator-run and consumer repos never hold credentials. Every command,
|
|
37
|
-
flag, and auth variable is in [usage](docs/usage.md).
|
|
27
|
+
`run` and `sweep` need model auth ([usage](docs/usage.md#auth)).
|
|
38
28
|
|
|
39
29
|
## Layout contract
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
current directory.
|
|
31
|
+
Fixed, with no config file. Every command reads one root: `--root <dir>`, or
|
|
32
|
+
the current directory.
|
|
43
33
|
|
|
44
34
|
```text
|
|
45
35
|
<root>/skills/<skill>/SKILL.md linted
|
|
@@ -53,15 +43,14 @@ CLI it documents.
|
|
|
53
43
|
|
|
54
44
|
## Docs
|
|
55
45
|
|
|
56
|
-
| Doc
|
|
57
|
-
|
|
|
58
|
-
| [Usage](docs/usage.md)
|
|
59
|
-
| [Scenarios](docs/scenarios.md)
|
|
60
|
-
| [
|
|
61
|
-
| [
|
|
62
|
-
| [
|
|
63
|
-
| [
|
|
64
|
-
| [Security](https://github.com/uinaf/skillcheck/security/policy) | Reporting a vulnerability |
|
|
46
|
+
| Doc | When |
|
|
47
|
+
| ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
48
|
+
| [Usage](docs/usage.md) | Every subcommand, flag, and auth path |
|
|
49
|
+
| [Scenarios](docs/scenarios.md) | Writing an eval scenario |
|
|
50
|
+
| [Adoption](docs/adoption.md) | Wiring the lint into another repo |
|
|
51
|
+
| [Contributing](CONTRIBUTING.md) | Local setup, the verify gate, and the npm pipeline |
|
|
52
|
+
| [Skill quality](https://github.com/uinaf/ffss/blob/main/skills/slopaudit/references/skills.md) | Writing and auditing the skill itself |
|
|
53
|
+
| [Security](https://github.com/uinaf/skillcheck/security/policy) | Reporting a vulnerability |
|
|
65
54
|
|
|
66
55
|
## License
|
|
67
56
|
|
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { encodeRunNamePart, generateRun, isIsolated, requiredEvalPackages, resolvePackageDir, runNameFor } from "./scenario.js";
|
|
3
2
|
import { lintSkills } from "./lint.js";
|
|
3
|
+
import { encodeRunNamePart, generateRun, isIsolated, requiredEvalPackages, resolvePackageDir, runNameFor } from "./scenario.js";
|
|
4
4
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
// src/cli.ts
|
|
10
|
+
const here = import.meta.dirname;
|
|
12
11
|
const packageDir = path.resolve(here, "..");
|
|
13
|
-
const selfExt = path.extname(
|
|
12
|
+
const selfExt = path.extname(import.meta.filename);
|
|
14
13
|
function toolVersion() {
|
|
15
14
|
return JSON.parse(fs.readFileSync(path.join(packageDir, "package.json"), "utf8")).version;
|
|
16
15
|
}
|
|
@@ -125,9 +124,9 @@ function configKey(c) {
|
|
|
125
124
|
c.isolated ?? false
|
|
126
125
|
]);
|
|
127
126
|
}
|
|
127
|
+
const effortSuffix = (e) => e ? `@${e}` : "";
|
|
128
128
|
function describeConfig(c) {
|
|
129
|
-
|
|
130
|
-
return `agent ${c.agent_model}${effort(c.agent_effort)}, judge ${c.judge_model}${effort(c.judge_effort)}, trials ${c.trials ?? 1}, ${c.agent_access ?? "offline"}, ${c.isolated ? "isolated" : "host"}`;
|
|
129
|
+
return `agent ${c.agent_model}${effortSuffix(c.agent_effort)}, judge ${c.judge_model}${effortSuffix(c.judge_effort)}, trials ${c.trials ?? 1}, ${c.agent_access ?? "offline"}, ${c.isolated ? "isolated" : "host"}`;
|
|
131
130
|
}
|
|
132
131
|
function assertUniformConfig(entries, allowMixed) {
|
|
133
132
|
if (allowMixed) return;
|
|
@@ -369,7 +368,7 @@ function readJson(file) {
|
|
|
369
368
|
}
|
|
370
369
|
function liveScenarios(root) {
|
|
371
370
|
const cli = path.join(root, "cli");
|
|
372
|
-
if (!(fs.existsSync(path.join(root, "skills")) || fs.existsSync(cli) && fs.readdirSync(cli).some((d) => fs.existsSync(path.join(cli, d, "skills"))))) return
|
|
371
|
+
if (!(fs.existsSync(path.join(root, "skills")) || fs.existsSync(cli) && fs.readdirSync(cli).some((d) => fs.existsSync(path.join(cli, d, "skills"))))) return;
|
|
373
372
|
return new Set(discoverScenarios(root).map((dir) => {
|
|
374
373
|
const parts = dir.split(path.sep);
|
|
375
374
|
return `${parts.at(-3)}\0${parts.at(-1)}`;
|
|
@@ -457,27 +456,27 @@ function cmdSweep(argv) {
|
|
|
457
456
|
console.log(`\nsweep: ${passed} passed, ${failed} failed, ${errored} errored, ${skipped} skipped`);
|
|
458
457
|
process.exit(errored > 0 ? 2 : failed > 0 ? 1 : 0);
|
|
459
458
|
}
|
|
459
|
+
const decodePart = (part) => {
|
|
460
|
+
if (!part.startsWith("~v2~")) return part;
|
|
461
|
+
try {
|
|
462
|
+
const decoded = decodeURIComponent(part.slice(4));
|
|
463
|
+
return encodeRunNamePart(decoded) === part ? decoded : part;
|
|
464
|
+
} catch {
|
|
465
|
+
return part;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
460
468
|
function resultIdentity(file, dir) {
|
|
461
469
|
const base = file.replace(/\.json$/, "");
|
|
462
|
-
for (const sidecar of [`${base}.meta.json`, `${file}.attempt`])
|
|
463
|
-
const identity =
|
|
470
|
+
for (const sidecar of [`${base}.meta.json`, `${file}.attempt`]) {
|
|
471
|
+
const identity = readJson(path.join(dir, sidecar));
|
|
464
472
|
if (identity !== null && typeof identity === "object" && "skill" in identity && typeof identity.skill === "string" && "scenario" in identity && typeof identity.scenario === "string" && "harness" in identity && (identity.harness === "claude" || identity.harness === "codex" || identity.harness === "grok")) return {
|
|
465
473
|
skill: identity.skill,
|
|
466
474
|
scenario: identity.scenario,
|
|
467
475
|
harness: identity.harness,
|
|
468
476
|
variant: "variant" in identity && identity.variant === "control" ? "control" : "skill"
|
|
469
477
|
};
|
|
470
|
-
}
|
|
478
|
+
}
|
|
471
479
|
if (/^~v3~[0-9a-f]{64}$/.test(base)) throw new Error(`missing identity metadata for ${file}`);
|
|
472
|
-
const decode = (part) => {
|
|
473
|
-
if (!part.startsWith("~v2~")) return part;
|
|
474
|
-
try {
|
|
475
|
-
const decoded = decodeURIComponent(part.slice(4));
|
|
476
|
-
return encodeRunNamePart(decoded) === part ? decoded : part;
|
|
477
|
-
} catch {
|
|
478
|
-
return part;
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
480
|
const unsuffixed = base.replace(/--control$/, "");
|
|
482
481
|
const variant = unsuffixed !== base && unsuffixed.includes("--") ? "control" : "skill";
|
|
483
482
|
const stem = variant === "control" ? unsuffixed : base;
|
|
@@ -485,8 +484,8 @@ function resultIdentity(file, dir) {
|
|
|
485
484
|
const harness = suffix === null ? "claude" : suffix[1];
|
|
486
485
|
const [skill, ...rest] = stem.replace(/--(codex|grok|cursor)$/, "").split("--");
|
|
487
486
|
return {
|
|
488
|
-
skill:
|
|
489
|
-
scenario:
|
|
487
|
+
skill: decodePart(skill),
|
|
488
|
+
scenario: decodePart(rest.join("--")),
|
|
490
489
|
harness,
|
|
491
490
|
variant
|
|
492
491
|
};
|
|
@@ -642,6 +641,7 @@ function cmdSummarize(argv) {
|
|
|
642
641
|
}
|
|
643
642
|
for (const s of summarizeSkills(merged.entries)) for (const scenario of s.no_lift) console.log(`NO LIFT ${s.skill}/${scenario} (${s.harness}): passes without the skill`);
|
|
644
643
|
}
|
|
644
|
+
const mean4 = (xs) => round4(xs.reduce((a, b) => a + b, 0) / xs.length);
|
|
645
645
|
function summarizeSkills(entries) {
|
|
646
646
|
const groups = /* @__PURE__ */ new Map();
|
|
647
647
|
const controls = /* @__PURE__ */ new Map();
|
|
@@ -650,7 +650,6 @@ function summarizeSkills(entries) {
|
|
|
650
650
|
if (e.variant === "control") controls.set(`${key}\0${e.scenario}`, e);
|
|
651
651
|
else groups.set(key, [...groups.get(key) ?? [], e]);
|
|
652
652
|
}
|
|
653
|
-
const mean = (xs) => round4(xs.reduce((a, b) => a + b, 0) / xs.length);
|
|
654
653
|
return [...groups.entries()].map(([key, rows]) => {
|
|
655
654
|
const paired = rows.flatMap((r) => {
|
|
656
655
|
const c = controls.get(`${key}\0${r.scenario}`);
|
|
@@ -659,17 +658,17 @@ function summarizeSkills(entries) {
|
|
|
659
658
|
control: c
|
|
660
659
|
}];
|
|
661
660
|
});
|
|
662
|
-
const controlScore = paired.length === 0 ? null :
|
|
661
|
+
const controlScore = paired.length === 0 ? null : mean4(paired.map((p) => p.control.score));
|
|
663
662
|
return {
|
|
664
663
|
skill: rows[0].skill,
|
|
665
664
|
harness: rows[0].harness,
|
|
666
665
|
scenarios: rows.length,
|
|
667
666
|
pass_all: rows.filter((r) => r.pass).length,
|
|
668
|
-
pass_rate:
|
|
669
|
-
score:
|
|
667
|
+
pass_rate: mean4(rows.map((r) => r.pass_rate ?? (r.pass ? 1 : 0))),
|
|
668
|
+
score: mean4(rows.map((r) => r.score)),
|
|
670
669
|
noisy: rows.filter((r) => r.noisy).map((r) => r.scenario),
|
|
671
670
|
control_score: controlScore,
|
|
672
|
-
lift: controlScore === null ? null : round4(
|
|
671
|
+
lift: controlScore === null ? null : round4(mean4(paired.map((p) => p.skill.score)) - controlScore),
|
|
673
672
|
no_lift: paired.filter((p) => p.control.pass).map((p) => p.skill.scenario)
|
|
674
673
|
};
|
|
675
674
|
});
|
|
@@ -715,7 +714,7 @@ function isMainModule() {
|
|
|
715
714
|
const entry = process.argv[1];
|
|
716
715
|
if (entry === void 0) return false;
|
|
717
716
|
try {
|
|
718
|
-
return fs.realpathSync(entry) === fs.realpathSync(
|
|
717
|
+
return fs.realpathSync(entry) === fs.realpathSync(import.meta.filename);
|
|
719
718
|
} catch {
|
|
720
719
|
return false;
|
|
721
720
|
}
|
|
@@ -728,9 +727,8 @@ if (isMainModule()) {
|
|
|
728
727
|
else if (cmd === "summarize") cmdSummarize(rest);
|
|
729
728
|
else if (cmd === "lint") cmdLint(rest);
|
|
730
729
|
else fail("usage: skillcheck <lint|run|sweep|summarize> ...");
|
|
731
|
-
} catch (
|
|
732
|
-
fail(
|
|
730
|
+
} catch (error) {
|
|
731
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
733
732
|
}
|
|
734
733
|
}
|
|
735
|
-
//#endregion
|
|
736
734
|
export { NOISY_SPREAD, aggregateTrials, assertUniformConfig, classifyResult, ensurePrivateDir, formatStats, liveScenarios, mergeScorecard, parseArgs, parsePositiveInt, reduceResults, resolveRoot, resultRunConfig, runConfigOf, runOptions, stateDirs, summarizeSkills, toolVersion, treeShaOf };
|
package/dist/grok-provider.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/grok-provider.ts
|
|
4
4
|
function record(value) {
|
|
5
5
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
6
|
}
|
|
@@ -35,6 +35,14 @@ function within(root, file) {
|
|
|
35
35
|
const rel = path.relative(root, file);
|
|
36
36
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel);
|
|
37
37
|
}
|
|
38
|
+
function attempt(action) {
|
|
39
|
+
try {
|
|
40
|
+
action();
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
38
46
|
var GrokProvider = class {
|
|
39
47
|
config;
|
|
40
48
|
constructor(options) {
|
|
@@ -82,10 +90,13 @@ var GrokProvider = class {
|
|
|
82
90
|
const skillCalls = [];
|
|
83
91
|
const stop = (reason) => {
|
|
84
92
|
error ??= reason;
|
|
85
|
-
if (child.pid !== void 0)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
if (child.pid !== void 0) {
|
|
94
|
+
const pid = child.pid;
|
|
95
|
+
attempt(() => {
|
|
96
|
+
if (process.platform === "win32") child.kill();
|
|
97
|
+
else process.kill(-pid, "SIGKILL");
|
|
98
|
+
});
|
|
99
|
+
}
|
|
89
100
|
};
|
|
90
101
|
const consume = (line) => {
|
|
91
102
|
if (!line.trim()) return;
|
|
@@ -148,9 +159,10 @@ var GrokProvider = class {
|
|
|
148
159
|
callOptions?.abortSignal?.addEventListener("abort", abort, { once: true });
|
|
149
160
|
if (callOptions?.abortSignal?.aborted) abort();
|
|
150
161
|
child.on("exit", () => {
|
|
151
|
-
if (process.platform !== "win32" && child.pid !== void 0)
|
|
152
|
-
|
|
153
|
-
|
|
162
|
+
if (process.platform !== "win32" && child.pid !== void 0) {
|
|
163
|
+
const pid = child.pid;
|
|
164
|
+
attempt(() => process.kill(-pid, "SIGKILL"));
|
|
165
|
+
}
|
|
154
166
|
});
|
|
155
167
|
child.on("close", (code, signal) => {
|
|
156
168
|
clearTimeout(timer);
|
|
@@ -174,5 +186,4 @@ var GrokProvider = class {
|
|
|
174
186
|
});
|
|
175
187
|
}
|
|
176
188
|
};
|
|
177
|
-
//#endregion
|
|
178
189
|
export { GrokProvider as default };
|
package/dist/lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FILE_BLOCK, isHiddenSkill, parseCriteria } from "./scenario.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
|
|
4
|
+
// src/lint.ts
|
|
5
5
|
const ALLOWED_KEYS = /* @__PURE__ */ new Set([
|
|
6
6
|
"name",
|
|
7
7
|
"description",
|
|
@@ -51,7 +51,7 @@ function lintSkill(dir, root, errors) {
|
|
|
51
51
|
if (!fields.get("description")?.value) errors.push(`${label}: description is required and must be non-empty`);
|
|
52
52
|
const dmi = fields.get("disable-model-invocation");
|
|
53
53
|
if (dmi !== void 0 && dmi.raw !== "true") errors.push(`${label}: disable-model-invocation must be the literal boolean true, got ${JSON.stringify(dmi.raw)}`);
|
|
54
|
-
const body = lines.slice(close + 1).join("\n").
|
|
54
|
+
const body = lines.slice(close + 1).join("\n").replaceAll(/^```[\s\S]*?^```/gm, "").replaceAll(/`[^`\n]*`/g, "");
|
|
55
55
|
for (const link of body.matchAll(/\]\(\s*(<[^>\n]*>|[^)\s]+)(?:\s+"[^"\n]*")?\s*\)/g)) {
|
|
56
56
|
const target = link[1].replace(/^<(.*)>$/, "$1");
|
|
57
57
|
if (/^[a-z][a-z+.-]*:/.test(target) || target.startsWith("#") || target === "") continue;
|
|
@@ -90,19 +90,18 @@ function lintEvals(skills, root, errors) {
|
|
|
90
90
|
const criteria = path.join(scenarioDir, "criteria.json");
|
|
91
91
|
if (fs.existsSync(criteria)) try {
|
|
92
92
|
parseCriteria(scenarioDir, hidden);
|
|
93
|
-
} catch (
|
|
94
|
-
const message =
|
|
93
|
+
} catch (error) {
|
|
94
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
95
95
|
errors.push(`${path.relative(root, criteria)}: ${message}`);
|
|
96
96
|
}
|
|
97
97
|
const file = path.join(scenarioDir, "task.md");
|
|
98
98
|
if (!fs.existsSync(file)) continue;
|
|
99
99
|
const text = fs.readFileSync(file, "utf8").replace(FILE_BLOCK, "");
|
|
100
100
|
for (const name of names) {
|
|
101
|
-
const escaped = name.
|
|
101
|
+
const escaped = name.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
102
102
|
if (new RegExp(`(?<![\\w-])${escaped}(?![\\w-])`, "i").test(text)) errors.push(`${path.relative(root, file)}: task names skill ${name}`);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
//#endregion
|
|
108
107
|
export { lintSkills };
|
package/dist/scenario.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createHash } from "node:crypto";
|
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
|
|
7
|
+
// src/scenario.ts
|
|
8
8
|
const FILE_BLOCK = /^=+ FILE: (.+?) =+\n([\s\S]*?)\n=+ END FILE =+$/gm;
|
|
9
9
|
const DEFAULT_CLAUDE_AGENT = "claude-opus-5";
|
|
10
10
|
function loadScenario(scenarioDir) {
|
|
@@ -17,13 +17,13 @@ function loadScenario(scenarioDir) {
|
|
|
17
17
|
let parsed;
|
|
18
18
|
try {
|
|
19
19
|
parsed = parseCriteria(scenarioDir, hidden);
|
|
20
|
-
} catch (
|
|
21
|
-
const message =
|
|
22
|
-
throw new Error(`${path.join(scenarioDir, "criteria.json")}: ${message}`, { cause:
|
|
20
|
+
} catch (error) {
|
|
21
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
22
|
+
throw new Error(`${path.join(scenarioDir, "criteria.json")}: ${message}`, { cause: error });
|
|
23
23
|
}
|
|
24
24
|
const { criteria, alternatives } = parsed;
|
|
25
25
|
const files = [];
|
|
26
|
-
const task = taskMd.
|
|
26
|
+
const task = taskMd.replaceAll(FILE_BLOCK, (_, name, content) => {
|
|
27
27
|
files.push({
|
|
28
28
|
name: name.trim(),
|
|
29
29
|
content: content + "\n"
|
|
@@ -48,8 +48,8 @@ function parseCriteria(scenarioDir, hidden) {
|
|
|
48
48
|
let criteria;
|
|
49
49
|
try {
|
|
50
50
|
criteria = JSON.parse(text);
|
|
51
|
-
} catch (
|
|
52
|
-
throw new Error(`not valid JSON: ${
|
|
51
|
+
} catch (error) {
|
|
52
|
+
throw new Error(`not valid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
53
53
|
}
|
|
54
54
|
if (typeof criteria !== "object" || criteria === null || Array.isArray(criteria)) throw new Error("must be a JSON object");
|
|
55
55
|
if (criteria.type !== "weighted_checklist") throw new Error(`type must be "weighted_checklist", got ${JSON.stringify(criteria.type)}`);
|
|
@@ -481,5 +481,4 @@ function generateRun(scenarioDir, opts, paths) {
|
|
|
481
481
|
scenario: s.scenario
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
|
-
//#endregion
|
|
485
484
|
export { DEFAULT_CLAUDE_AGENT, FILE_BLOCK, buildConfig, encodeRunNamePart, generateRun, handOverToAgent, isHiddenSkill, isIsolated, linkedSiblings, loadScenario, materialize, parseCriteria, privateCodexHome, privateHome, requiredEvalPackages, resolvePackageDir, runNameFor, sdkNodeModulesDir, stripHiddenFlag, trialLabel };
|
package/dist/skill-evidence.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/skill-evidence.ts
|
|
4
4
|
const SKILL_ROOTS = [
|
|
5
5
|
".claude",
|
|
6
6
|
".agents",
|
|
@@ -13,16 +13,19 @@ function real(file) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
const callList = (value) => Array.isArray(value) ? value.filter((c) => c !== null && typeof c === "object") : [];
|
|
16
17
|
function skillEvidence(context) {
|
|
17
18
|
const skill = context.config?.skill;
|
|
18
19
|
const workdir = context.vars.workdir;
|
|
19
|
-
if (typeof skill !== "string" || typeof workdir !== "string") return
|
|
20
|
-
const calls = (value) => Array.isArray(value) ? value.filter((c) => c !== null && typeof c === "object") : [];
|
|
20
|
+
if (typeof skill !== "string" || typeof workdir !== "string") return;
|
|
21
21
|
const metadata = context.metadata ?? context.providerResponse?.metadata;
|
|
22
|
-
if (
|
|
23
|
-
const installed = new Set(SKILL_ROOTS.
|
|
22
|
+
if (callList(metadata?.skillCalls).find((c) => c.name === skill && c.is_error !== true)) return `skill call ${skill}`;
|
|
23
|
+
const installed = new Set(SKILL_ROOTS.flatMap((root) => {
|
|
24
|
+
const p = real(path.join(workdir, root, "skills", skill, "SKILL.md"));
|
|
25
|
+
return p === void 0 ? [] : [p];
|
|
26
|
+
}));
|
|
24
27
|
const root = real(workdir) ?? workdir;
|
|
25
|
-
if (
|
|
28
|
+
if (callList(metadata?.toolCalls).find((c) => {
|
|
26
29
|
if (c.name !== "Read" || c.is_error !== false || typeof c.output !== "string") return false;
|
|
27
30
|
const file = c.input?.file_path;
|
|
28
31
|
if (typeof file !== "string") return false;
|
|
@@ -34,8 +37,11 @@ function skillEvidence(context) {
|
|
|
34
37
|
const target = real(named);
|
|
35
38
|
return inside && target !== void 0 && installed.has(target);
|
|
36
39
|
})) return `read of the installed ${skill}/SKILL.md`;
|
|
37
|
-
const opening = [...installed].
|
|
38
|
-
|
|
40
|
+
const opening = [...installed].flatMap((p) => {
|
|
41
|
+
const t = fs.readFileSync(p, "utf8").slice(0, 300).trim();
|
|
42
|
+
return t.length >= 40 ? [t] : [];
|
|
43
|
+
});
|
|
44
|
+
if (callList(metadata?.toolCalls).find((c) => c.name === "Bash" && c.is_error === false && typeof c.output === "string" && opening.some((t) => c.output.includes(t)))) return `shell read of the installed ${skill}/SKILL.md`;
|
|
39
45
|
if (codexCommandOutputs(context.providerResponse?.raw).some((out) => opening.some((t) => out.includes(t)))) return `shell read of the installed ${skill}/SKILL.md`;
|
|
40
46
|
}
|
|
41
47
|
function codexCommandOutputs(raw) {
|
|
@@ -61,5 +67,4 @@ function assertSkillUsed(_output, context) {
|
|
|
61
67
|
reason: used ? `skill used: ${evidence}${forbidden ? " (forbidden for this scenario)" : ""}` : `skill ${skill} not loaded${required || forbidden ? "" : " (optional for this scenario)"}`
|
|
62
68
|
};
|
|
63
69
|
}
|
|
64
|
-
//#endregion
|
|
65
70
|
export { assertSkillUsed as default, skillEvidence };
|
package/dist/transform.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
|
|
4
|
+
// src/transform.ts
|
|
5
5
|
const PER_FILE_CAP = 16e3;
|
|
6
6
|
const TOTAL_CAP = 64e3;
|
|
7
7
|
function safeSlice(text, end) {
|
|
@@ -38,8 +38,8 @@ function transform(output, context) {
|
|
|
38
38
|
let body;
|
|
39
39
|
try {
|
|
40
40
|
body = fs.readFileSync(p);
|
|
41
|
-
} catch (
|
|
42
|
-
const detail =
|
|
41
|
+
} catch (error) {
|
|
42
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
43
43
|
sections.push({
|
|
44
44
|
rel,
|
|
45
45
|
text: `=== UNREADABLE FILE: ${rel} === (${detail})`
|
|
@@ -71,5 +71,4 @@ function transform(output, context) {
|
|
|
71
71
|
if (appended.length > TOTAL_CAP) appended = `${safeSlice(appended, TOTAL_CAP)}\n\n=== TRUNCATED: output files exceeded ${TOTAL_CAP} chars total ===`;
|
|
72
72
|
return `${output}\n\n${appended}`;
|
|
73
73
|
}
|
|
74
|
-
//#endregion
|
|
75
74
|
export { SKIPPED_DIRS, transform as default };
|
package/docs/adoption.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Adopting it in a repo
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Run the lint in the consumer repo's CI. Run evals only on a machine with model
|
|
4
|
+
auth.
|
|
5
5
|
|
|
6
6
|
## Lint in CI
|
|
7
7
|
|
|
@@ -9,89 +9,40 @@ model auth. Only the first belongs in a consumer repo.
|
|
|
9
9
|
pnpm add -D @uinaf/skillcheck
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Runners that install with `--ignore-scripts` are fine: the package ships
|
|
13
|
-
compiled ESM and has no install or postinstall script. Its `prepare` script
|
|
14
|
-
only wires this repository's own commit hook; package managers do not run it
|
|
15
|
-
for a registry install.
|
|
16
|
-
|
|
17
12
|
```json
|
|
18
13
|
{ "scripts": { "skills:lint": "skillcheck lint" } }
|
|
19
14
|
```
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
28
|
-
with:
|
|
29
|
-
persist-credentials: false
|
|
30
|
-
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
31
|
-
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
|
|
32
|
-
with:
|
|
33
|
-
node-version: "24"
|
|
34
|
-
- run: pnpm install --frozen-lockfile
|
|
35
|
-
- run: pnpm run skills:lint
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
The job needs no secrets and no network beyond the install. Node 24 is the
|
|
39
|
-
floor. `pnpm/action-setup` installs the pnpm version pinned in the repo's
|
|
40
|
-
`packageManager` field; hosted runners do not ship pnpm.
|
|
41
|
-
|
|
42
|
-
Run it through the script rather than a bare `npx skillcheck`: the script
|
|
43
|
-
resolves the version the repo pinned, and `npx` would resolve the latest one on
|
|
44
|
-
the registry.
|
|
16
|
+
Add a CI job that checks out, sets up pnpm and the
|
|
17
|
+
[supported Node](../README.md#install), installs with `--frozen-lockfile`, and
|
|
18
|
+
runs `pnpm run skills:lint`. The job needs no secrets, and `--ignore-scripts` installs work. Run it through
|
|
19
|
+
the script: a bare `npx skillcheck` resolves the latest registry version, not
|
|
20
|
+
the pinned one.
|
|
45
21
|
|
|
46
22
|
## Evals
|
|
47
23
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
24
|
+
Keep sweeps off consumer CI. For pnpm 12, add this override to the operator
|
|
25
|
+
project's `pnpm-workspace.yaml` before installing; it drops promptfoo's unused
|
|
26
|
+
local-inference path and its unpatched `sprintf-js`
|
|
27
|
+
([GHSA-hp3w-g68c-fv3c](https://github.com/advisories/GHSA-hp3w-g68c-fv3c)):
|
|
52
28
|
|
|
53
|
-
```
|
|
54
|
-
|
|
29
|
+
```yaml
|
|
30
|
+
overrides:
|
|
31
|
+
"promptfoo>@huggingface/transformers": "-"
|
|
55
32
|
```
|
|
56
33
|
|
|
57
|
-
|
|
58
|
-
with that install command when they are missing, so a lint-only install never
|
|
59
|
-
crashes into a resolution error. Then:
|
|
34
|
+
Install the peers next to skillcheck, then sweep and summarize:
|
|
60
35
|
|
|
61
36
|
```sh
|
|
37
|
+
pnpm add -D promptfoo @anthropic-ai/claude-agent-sdk @openai/codex-sdk
|
|
62
38
|
skillcheck sweep # resumes: only scenarios without results
|
|
63
39
|
skillcheck summarize # writes .skillcheck/scorecards/<UTC-date>.json
|
|
64
40
|
```
|
|
65
41
|
|
|
66
|
-
Keep `.skillcheck/scorecards
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
Keep `.skillcheck/scorecards/`, committed here or in a separate evals
|
|
43
|
+
repository ([isolated runs](usage.md#isolated-runs)), and gitignore the
|
|
44
|
+
results:
|
|
69
45
|
|
|
70
46
|
```gitignore
|
|
71
47
|
.skillcheck/results/
|
|
72
48
|
```
|
|
73
|
-
|
|
74
|
-
A scorecard is only comparable against the tree it graded and the configuration
|
|
75
|
-
it ran with, which is why every result carries the root repo's HEAD, the agent
|
|
76
|
-
and judge models and efforts, and the trial count, and why `summarize` refuses
|
|
77
|
-
to mix them without `--allow-mixed`. Use `--trials 3` or more before calling a
|
|
78
|
-
skill change better or worse; one trial cannot tell a regression from noise.
|
|
79
|
-
|
|
80
|
-
## Upgrading
|
|
81
|
-
|
|
82
|
-
Bump the version in `package.json` and rerun the sweep. Results carry the
|
|
83
|
-
`tool_version` that produced them, so a scorecard says which harness build it
|
|
84
|
-
came from as well as which skills tree.
|
|
85
|
-
|
|
86
|
-
## The older install path
|
|
87
|
-
|
|
88
|
-
Before the package was published, consumers installed it from a git tag:
|
|
89
|
-
|
|
90
|
-
```sh
|
|
91
|
-
npm i -D github:uinaf/skillcheck#v0.1.3
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Those tags are frozen and still work: they carry a committed `dist/`, and npm
|
|
95
|
-
12 consumers needed `allow-git=root` in `.npmrc` to accept the spec at all. The
|
|
96
|
-
registry install needs none of that. Tags from `v0.1.4` on are npm releases and
|
|
97
|
-
carry no `dist/`, so a git spec pointing at one will not run.
|