skillfit 0.12.0 → 0.13.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.
Files changed (127) hide show
  1. package/README.md +60 -119
  2. package/README.zh-CN.md +60 -116
  3. package/dist/commands/bench-check-report.js +1 -34
  4. package/dist/commands/bench.js +6 -239
  5. package/dist/commands/eval-preflight-error.js +9 -0
  6. package/dist/commands/eval-preflight.js +4 -11
  7. package/dist/commands/eval-report.js +6 -459
  8. package/dist/commands/install.js +14 -98
  9. package/dist/harness/bench-check.js +277 -0
  10. package/dist/harness/bench-diagnostics.js +34 -0
  11. package/dist/harness/eval-acceptance.js +1 -1
  12. package/dist/harness/eval-audit.js +1 -1
  13. package/dist/harness/eval-manifest.js +456 -0
  14. package/dist/install/constants.js +1 -0
  15. package/dist/install/transaction.js +112 -0
  16. package/docs/README.md +65 -0
  17. package/docs/architecture.md +86 -0
  18. package/docs/archive-delivery.md +83 -0
  19. package/docs/archive-inventory.md +91 -0
  20. package/docs/evaluation-reports.md +1 -1
  21. package/docs/growth-roadmap-2026-10.md +14 -18
  22. package/docs/package-contents.md +73 -0
  23. package/docs/plans/2026-10-20-archive-replay-verification.json +125 -0
  24. package/docs/plans/2026-10-20-archive-source-verification.json +256 -0
  25. package/docs/plans/2026-10-20-delivery-verification.json +146 -0
  26. package/docs/plans/2026-10-20-docs-architecture-cleanup.md +233 -0
  27. package/docs/plans/2026-10-20-install-transactions-and-archive-delivery.md +233 -0
  28. package/docs/plans/2026-10-21-npm-0.13.0-release.md +41 -0
  29. package/docs/releases/0.12.0-attestation-check.json +22 -0
  30. package/docs/releases/0.12.0-attestations.json +155 -0
  31. package/docs/releases/0.12.0-ci-registry-install.json +90 -0
  32. package/docs/releases/0.12.0-feature-smoke.json +34 -0
  33. package/docs/releases/0.12.0-foundations-smoke.json +1576 -0
  34. package/docs/releases/0.12.0-local-registry-install.json +75 -0
  35. package/docs/releases/0.12.0-preparation-attempt-1.json +22 -0
  36. package/docs/releases/0.12.0-registry-metadata.json +96 -0
  37. package/docs/releases/0.12.0-signatures.txt +6 -0
  38. package/docs/releases/0.12.0-verification.json +99 -0
  39. package/docs/releases/0.12.0.md +14 -0
  40. package/docs/releases/0.13.0-feature-smoke.mjs +114 -0
  41. package/docs/releases/0.13.0-preparation.json +102 -0
  42. package/docs/releases/0.13.0.md +61 -0
  43. package/docs/releases/archive-delivery-smoke.mjs +37 -0
  44. package/docs/reproducible-offline-example.md +1 -1
  45. package/evidence/README.md +24 -1
  46. package/evidence/archive-catalog.v1.json +8044 -0
  47. package/evidence/fetch-archives.mjs +211 -0
  48. package/package.json +9 -2
  49. package/dist/cli.test.js +0 -193
  50. package/dist/commands/bench-calibration.test.js +0 -237
  51. package/dist/commands/bench-check-json.test.js +0 -242
  52. package/dist/commands/bench-manage.test.js +0 -87
  53. package/dist/commands/bench.test.js +0 -1166
  54. package/dist/commands/bundle.test.js +0 -142
  55. package/dist/commands/calibration-cli.test.js +0 -145
  56. package/dist/commands/doctor.test.js +0 -280
  57. package/dist/commands/eval-agent-preflight.test.js +0 -269
  58. package/dist/commands/eval-cli-usage.test.js +0 -75
  59. package/dist/commands/eval-export-modes.test.js +0 -350
  60. package/dist/commands/eval-export.test.js +0 -279
  61. package/dist/commands/eval-interruption.test.js +0 -263
  62. package/dist/commands/eval-preflight.test.js +0 -382
  63. package/dist/commands/eval-report.test.js +0 -367
  64. package/dist/commands/eval.test.js +0 -503
  65. package/dist/commands/evaluation-report.test.js +0 -243
  66. package/dist/commands/install.test.js +0 -555
  67. package/dist/commands/npm-first-run.test.js +0 -74
  68. package/dist/commands/replay-cancellation.test.js +0 -105
  69. package/dist/commands/report.test.js +0 -110
  70. package/dist/commands/setup.test.js +0 -150
  71. package/dist/commands/upstream.test.js +0 -139
  72. package/dist/commands/workflow-entrypoints.test.js +0 -137
  73. package/dist/docs.test.js +0 -154
  74. package/dist/frontmatter.test.js +0 -49
  75. package/dist/harness/bench.test.js +0 -109
  76. package/dist/harness/bundle.test.js +0 -71
  77. package/dist/harness/codex-usage.test.js +0 -87
  78. package/dist/harness/costs.test.js +0 -92
  79. package/dist/harness/eval-budget.test.js +0 -237
  80. package/dist/harness/eval-component.test.js +0 -770
  81. package/dist/harness/eval-efficiency.test.js +0 -56
  82. package/dist/harness/execution-timing.test.js +0 -61
  83. package/dist/harness/executors/api.test.js +0 -175
  84. package/dist/harness/executors/cli.test.js +0 -541
  85. package/dist/harness/executors/mock.test.js +0 -43
  86. package/dist/harness/experiment-session.test.js +0 -317
  87. package/dist/harness/installed-skill.test.js +0 -162
  88. package/dist/harness/interruption.test.js +0 -31
  89. package/dist/harness/judge-accounting.test.js +0 -216
  90. package/dist/harness/judge.test.js +0 -181
  91. package/dist/harness/kimi-usage.test.js +0 -62
  92. package/dist/harness/native-diff.test.js +0 -53
  93. package/dist/harness/oss-lru-cache.test.js +0 -79
  94. package/dist/harness/oss-normalize-url.test.js +0 -64
  95. package/dist/harness/oss-regression-witness.test.js +0 -89
  96. package/dist/harness/oss-skill-followup.test.js +0 -59
  97. package/dist/harness/prompt.test.js +0 -48
  98. package/dist/harness/receipts.test.js +0 -148
  99. package/dist/harness/report.test.js +0 -297
  100. package/dist/harness/runner.test.js +0 -635
  101. package/dist/harness/skill-revision.test.js +0 -148
  102. package/dist/harness/stats.test.js +0 -124
  103. package/dist/harness/target.test.js +0 -60
  104. package/dist/harness/trigger.test.js +0 -261
  105. package/dist/harness/verifier-summary.test.js +0 -99
  106. package/dist/harness/verifier.test.js +0 -128
  107. package/dist/harness/waza-behavior.test.js +0 -139
  108. package/dist/mcp/probe.test.js +0 -139
  109. package/evidence/artifacts/2026-10-12-diagnosing-revision/calibration-records.tar.gz +0 -0
  110. package/evidence/artifacts/2026-10-12-diagnosing-revision/interrupted-records.tar.gz +0 -0
  111. package/evidence/artifacts/2026-10-12-diagnosing-revision/validation-records.tar.gz +0 -0
  112. package/evidence/artifacts/2026-10-12-diagnosing-v2/regression-records.tar.gz +0 -0
  113. package/evidence/artifacts/2026-10-12-diagnosing-v2/transfer-records.tar.gz +0 -0
  114. package/evidence/artifacts/2026-10-12-normalize-url-v2-available/readiness-records.tar.gz +0 -0
  115. package/evidence/artifacts/2026-10-12-normalize-url-v2-comparison/records.tar.gz +0 -0
  116. package/evidence/artifacts/2026-10-12-normalize-url-v2-recovery/records.tar.gz +0 -0
  117. package/evidence/artifacts/2026-10-12-normalize-url-v2-validated/records.tar.gz +0 -0
  118. package/evidence/artifacts/2026-10-13-debugging-completed-development/package.tar.gz +0 -0
  119. package/evidence/artifacts/2026-10-13-debugging-controls-and-sleep-stop/package.tar.gz +0 -0
  120. package/evidence/artifacts/2026-10-13-debugging-development-stops/package.tar.gz +0 -0
  121. package/evidence/artifacts/2026-10-14-debugging-followup-routing-stop/package.tar.gz +0 -0
  122. package/evidence/artifacts/2026-10-14-debugging-independent-validation/package.tar.gz +0 -0
  123. package/evidence/artifacts/2026-10-14-debugging-reading-pilot-and-cost-review/package.tar.gz +0 -0
  124. package/evidence/artifacts/2026-10-14-debugging-spending-stop/package.tar.gz +0 -0
  125. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
  126. package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
  127. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
@@ -0,0 +1,277 @@
1
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { loadBench, selectBenchTasks } from './bench.js';
5
+ import { resolveBenchDir } from './bench-location.js';
6
+ import { listFilesRecursive } from './hash.js';
7
+ import { runVerifier, verifierFailure } from './runner.js';
8
+ import { MOCK_MARKER_FILE } from './constants.js';
9
+ import { verdictFromOutput } from './verifier-summary.js';
10
+ import { throwIfEvaluationInterrupted, withEvaluationInterrupts } from './interruption.js';
11
+ import { benchDiagnostic, benchCheckEvidence } from './bench-diagnostics.js';
12
+ const FIXTURE_SIZE_WARN_BYTES = 64 * 1024;
13
+ // benches/README.md: a verifier decomposes its acceptance criteria into 2–8 named checks.
14
+ const MIN_FACET_CHECKS = 2;
15
+ const MAX_FACET_CHECKS = 8;
16
+ // docs/metrics.md: >=30% of trigger-labelled tasks should be negative controls.
17
+ const NEGATIVE_CONTROL_TARGET = 0.3;
18
+ const NEGATIVE_CONTROL_PERCENT = 30;
19
+ async function probeVerifier(benchDir, verifier, output, timeoutSeconds) {
20
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-check-'));
21
+ try {
22
+ if (output !== null) {
23
+ writeFileSync(join(dir, '_output.md'), output, 'utf8');
24
+ }
25
+ const result = await runVerifier(benchDir, verifier, dir, timeoutSeconds);
26
+ return {
27
+ exitCode: result.exitCode,
28
+ error: result.error,
29
+ output: result.output,
30
+ checks: verdictFromOutput(result.output)?.checks ?? null,
31
+ };
32
+ }
33
+ finally {
34
+ rmSync(dir, { recursive: true, force: true });
35
+ }
36
+ }
37
+ function facetCountCheck(taskId, checks) {
38
+ // `checks` is optional in the verifier contract; with no checks there is no graded signal to gate.
39
+ if (checks === null)
40
+ return null;
41
+ if (checks.length >= MIN_FACET_CHECKS && checks.length <= MAX_FACET_CHECKS) {
42
+ return {
43
+ status: 'PASS',
44
+ message: `${taskId}: ${checks.length} facet check(s), within the ${MIN_FACET_CHECKS}–${MAX_FACET_CHECKS} contract`,
45
+ };
46
+ }
47
+ const why = checks.length < MIN_FACET_CHECKS
48
+ ? 'a single check is binary pass/fail in facet costume — it carries none of the graded signal facet scores exist to provide'
49
+ : 'the trial score is dominated by whatever these checks happen to measure, and the per-facet table stops being readable';
50
+ return {
51
+ status: 'WARN',
52
+ message: `${taskId}: ${checks.length} facet check(s) — outside the ${MIN_FACET_CHECKS}–${MAX_FACET_CHECKS} range in benches/README.md (${why})`,
53
+ };
54
+ }
55
+ export function copyFixture(fixtureDir, dest) {
56
+ for (const rel of listFilesRecursive(fixtureDir)) {
57
+ const target = join(dest, rel);
58
+ mkdirSync(dirname(target), { recursive: true });
59
+ writeFileSync(target, readFileSync(join(fixtureDir, rel)));
60
+ }
61
+ }
62
+ export async function runOracleGate(benchDir, fixtureDir, oracle, verifier, timeoutSeconds, record) {
63
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-check-'));
64
+ try {
65
+ copyFixture(fixtureDir, dir);
66
+ const oracleRun = await runVerifier(benchDir, oracle, dir, timeoutSeconds);
67
+ record?.('oracle', oracleRun);
68
+ if (oracleRun.error !== null || oracleRun.exitCode !== 0) {
69
+ return {
70
+ kind: 'oracle-failed',
71
+ result: oracleRun,
72
+ command: oracle,
73
+ exitCode: oracleRun.exitCode,
74
+ reason: oracleRun.error !== null || oracleRun.exitCode === null ? verifierFailure('oracle', oracle, oracleRun.error) : null,
75
+ };
76
+ }
77
+ const graded = await runVerifier(benchDir, verifier, dir, timeoutSeconds);
78
+ record?.('oracle-verifier', graded);
79
+ if (graded.error !== null || graded.exitCode !== 0) {
80
+ return {
81
+ kind: 'verifier-failed',
82
+ result: graded,
83
+ command: verifier,
84
+ reason: graded.error !== null || graded.exitCode === null ? verifierFailure('verifier', verifier, graded.error) : null,
85
+ };
86
+ }
87
+ const score = verdictFromOutput(graded.output)?.score ?? null;
88
+ if (score !== null && score < 1) {
89
+ return { kind: 'low-score', score, result: graded, command: verifier };
90
+ }
91
+ return { kind: 'pass', score, result: graded, command: verifier };
92
+ }
93
+ finally {
94
+ rmSync(dir, { recursive: true, force: true });
95
+ }
96
+ }
97
+ async function probeOracle(benchDir, fixture, oracle, verifier, timeoutSeconds) {
98
+ const gate = await runOracleGate(benchDir, join(benchDir, fixture), oracle, verifier, timeoutSeconds);
99
+ switch (gate.kind) {
100
+ case 'oracle-failed':
101
+ return {
102
+ status: 'FAIL',
103
+ evidence: benchCheckEvidence(gate.result, gate.command),
104
+ message: gate.reason ??
105
+ `oracle command itself failed (exit ${gate.exitCode}) — the reference solution cannot run`,
106
+ };
107
+ case 'verifier-failed':
108
+ return {
109
+ status: 'FAIL',
110
+ evidence: benchCheckEvidence(gate.result, gate.command),
111
+ message: gate.reason ?? 'oracle solution does not pass the verifier — the task is unwinnable or the oracle is stale',
112
+ };
113
+ case 'low-score':
114
+ return {
115
+ status: 'FAIL',
116
+ evidence: benchCheckEvidence(gate.result, gate.command),
117
+ message: `oracle passes the verifier but scores ${gate.score.toFixed(2)} on its checks — the checks are stricter than the exit code`,
118
+ };
119
+ case 'pass':
120
+ return {
121
+ status: 'PASS',
122
+ evidence: benchCheckEvidence(gate.result, gate.command),
123
+ message: `oracle solution passes the verifier${gate.score !== null ? ' with full checks' : ''}`,
124
+ };
125
+ }
126
+ }
127
+ /** Probe a loaded selection with disposable copies; no executor or calibration. */
128
+ export async function inspectBenchIntegrity(bench, push) {
129
+ let labeledTasks = 0;
130
+ let negativeTasks = 0;
131
+ for (const task of bench.tasks) {
132
+ const taskPush = (code, status, message, evidence) => push(code, status, message, task, evidence);
133
+ let facetChecks = null;
134
+ if ((task.verifierKind ?? 'output') === 'command') {
135
+ const fixtureCopy = mkdtempSync(join(tmpdir(), 'skillfit-check-'));
136
+ try {
137
+ copyFixture(join(bench.dir, task.fixture), fixtureCopy);
138
+ const pristine = await runVerifier(bench.dir, task.verifier, fixtureCopy, task.verifierTimeoutSeconds);
139
+ facetChecks = verdictFromOutput(pristine.output)?.checks ?? null;
140
+ if (pristine.error !== null || pristine.exitCode === null) {
141
+ // Without this branch a verifier that cannot even be spawned reads as a clean NOP gate:
142
+ // "fails on the untouched fixture" is exactly what `exitCode !== 0` looks like.
143
+ taskPush('UNTOUCHED_FIXTURE', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, pristine.error)}`, benchCheckEvidence(pristine, task.verifier));
144
+ }
145
+ else if (pristine.exitCode === 0) {
146
+ taskPush('UNTOUCHED_FIXTURE', 'FAIL', `${task.id}: command verifier already passes on the untouched fixture — the task is solved or the verifier is broken`, benchCheckEvidence(pristine, task.verifier));
147
+ }
148
+ else {
149
+ taskPush('UNTOUCHED_FIXTURE', 'PASS', `${task.id}: command verifier fails on the untouched fixture (the failure reproduces)`, benchCheckEvidence(pristine, task.verifier));
150
+ }
151
+ }
152
+ finally {
153
+ rmSync(fixtureCopy, { recursive: true, force: true });
154
+ }
155
+ }
156
+ else {
157
+ const missing = await probeVerifier(bench.dir, task.verifier, null, task.verifierTimeoutSeconds);
158
+ if (missing.error !== null || missing.exitCode === null) {
159
+ taskPush('MISSING_OUTPUT', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, missing.error)}`, benchCheckEvidence(missing, task.verifier));
160
+ }
161
+ else if (missing.exitCode === 0) {
162
+ taskPush('MISSING_OUTPUT', 'FAIL', `${task.id}: verifier does not reject a missing _output.md`, benchCheckEvidence(missing, task.verifier));
163
+ }
164
+ else {
165
+ taskPush('MISSING_OUTPUT', 'PASS', `${task.id}: verifier rejects missing output`, benchCheckEvidence(missing, task.verifier));
166
+ }
167
+ const empty = await probeVerifier(bench.dir, task.verifier, '', task.verifierTimeoutSeconds);
168
+ facetChecks = empty.checks;
169
+ if (empty.error !== null || empty.exitCode === null) {
170
+ taskPush('EMPTY_OUTPUT', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, empty.error)}`, benchCheckEvidence(empty, task.verifier));
171
+ }
172
+ else if (empty.exitCode === 0) {
173
+ taskPush('EMPTY_OUTPUT', 'FAIL', `${task.id}: verifier passes an empty output — it cannot tell success from silence`, benchCheckEvidence(empty, task.verifier));
174
+ }
175
+ else {
176
+ taskPush('EMPTY_OUTPUT', 'PASS', `${task.id}: verifier rejects empty output`, benchCheckEvidence(empty, task.verifier));
177
+ }
178
+ }
179
+ const facetGate = facetCountCheck(task.id, facetChecks);
180
+ if (facetGate)
181
+ taskPush('FACET_COUNT', facetGate.status, facetGate.message);
182
+ if (task.oracle) {
183
+ const oracleResult = await probeOracle(bench.dir, task.fixture, task.oracle, task.verifier, task.verifierTimeoutSeconds);
184
+ taskPush('ORACLE', oracleResult.status, `${task.id}: ${oracleResult.message}`, oracleResult.evidence);
185
+ }
186
+ else {
187
+ taskPush('ORACLE', 'WARN', `${task.id}: no oracle — task winnability is unverified (nothing proves a correct solution passes this verifier; register one with --oracle or write ground-truth/oracle-${task.id}.mjs)`);
188
+ }
189
+ const markerPath = join(bench.dir, task.fixture, MOCK_MARKER_FILE);
190
+ if ((task.verifierKind ?? 'output') === 'command') {
191
+ taskPush('MOCK_COVERAGE', 'INFO', `${task.id}: command verifier — mock-arm probes not applicable (a mock writes _output.md text, not file edits)${task.oracle
192
+ ? '; offline coverage comes from the oracle and NOP gates above'
193
+ : '; with no oracle registered, nothing offline shows this task is solvable'}`);
194
+ }
195
+ else if (existsSync(markerPath)) {
196
+ try {
197
+ const marker = JSON.parse(readFileSync(markerPath, 'utf8'));
198
+ for (const arm of ['baseline', 'treatment']) {
199
+ const behavior = marker[arm];
200
+ if (behavior?.output === undefined) {
201
+ taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', 'INFO', `${task.id}: no mock ${arm} output — this arm was not probed`);
202
+ continue;
203
+ }
204
+ const probe = await probeVerifier(bench.dir, task.verifier, behavior.output, task.verifierTimeoutSeconds);
205
+ taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', probe.error !== null || probe.exitCode === null ? 'FAIL' : 'INFO', `${task.id}: mock ${arm} output → ${probe.error !== null || probe.exitCode === null ? verifierFailure('verifier', task.verifier, probe.error) : `verifier ${probe.exitCode === 0 ? 'pass' : 'fail'}`}`, benchCheckEvidence(probe, task.verifier));
206
+ }
207
+ }
208
+ catch (error) {
209
+ throwIfEvaluationInterrupted();
210
+ taskPush('MOCK_MARKER', 'FAIL', `${task.id}: ${MOCK_MARKER_FILE} is unreadable (${error.message})`);
211
+ }
212
+ }
213
+ else {
214
+ taskPush('MOCK_COVERAGE', 'INFO', `${task.id}: no ${MOCK_MARKER_FILE} (offline mock runs will produce empty outputs)`);
215
+ }
216
+ const fixtureDir = join(bench.dir, task.fixture);
217
+ const fixtureBytes = listFilesRecursive(fixtureDir)
218
+ .map((rel) => statSync(join(fixtureDir, rel)).size)
219
+ .reduce((sum, size) => sum + size, 0);
220
+ if (fixtureBytes > FIXTURE_SIZE_WARN_BYTES) {
221
+ taskPush('FIXTURE_SIZE', 'WARN', `${task.id}: fixture is ${Math.round(fixtureBytes / 1024)} KB — inject mode inlines it into every prompt; keep it lean`);
222
+ }
223
+ else {
224
+ taskPush('FIXTURE_SIZE', 'PASS', `${task.id}: fixture size ${Math.round(fixtureBytes / 1024)} KB`);
225
+ }
226
+ if (task.shouldTrigger === undefined) {
227
+ taskPush('TRIGGER_LABEL', 'INFO', `${task.id}: no shouldTrigger label (trigger mode will skip this task)`);
228
+ }
229
+ else {
230
+ labeledTasks++;
231
+ if (task.shouldTrigger === false)
232
+ negativeTasks++;
233
+ }
234
+ }
235
+ if (labeledTasks > 0) {
236
+ const fraction = negativeTasks / labeledTasks;
237
+ const percent = Math.round(fraction * 100);
238
+ if (negativeTasks === 0) {
239
+ push('NEGATIVE_CONTROLS', 'WARN', 'no shouldTrigger:false (negative-control) tasks — trigger mode cannot measure false-trigger rate (see docs/metrics.md)');
240
+ }
241
+ else if (fraction < NEGATIVE_CONTROL_TARGET) {
242
+ push('NEGATIVE_CONTROLS', 'WARN', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — below the ${NEGATIVE_CONTROL_PERCENT}% target in docs/metrics.md, so false-trigger rate rests on a thin sample`);
243
+ }
244
+ else {
245
+ push('NEGATIVE_CONTROLS', 'PASS', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — at or above the ${NEGATIVE_CONTROL_PERCENT}% target`);
246
+ }
247
+ }
248
+ }
249
+ /** Shared offline entry for callers that need data rather than a CLI summary. */
250
+ export async function runOfflineBenchCheck(options) {
251
+ return withEvaluationInterrupts(async () => {
252
+ let dir = resolve(options.dir ?? '.');
253
+ const checks = [];
254
+ let identity = null;
255
+ const result = () => ({ dir, bench: identity, checks,
256
+ failures: checks.filter(check => check.status === 'FAIL').length,
257
+ warnings: checks.filter(check => check.status === 'WARN').length });
258
+ const push = (code, status, message, task, evidence) => {
259
+ throwIfEvaluationInterrupted();
260
+ checks.push(benchDiagnostic(code, status, message, task, evidence));
261
+ options.log?.(`[${status}] ${message}`);
262
+ };
263
+ let bench;
264
+ try {
265
+ dir = resolveBenchDir(options.dir ?? '.');
266
+ bench = selectBenchTasks(loadBench(dir), options.taskIds);
267
+ }
268
+ catch (error) {
269
+ push('BENCH_LOAD', 'FAIL', `bench does not load: ${error.message}`);
270
+ return result();
271
+ }
272
+ identity = { name: bench.name, sha256: bench.contentSha256, taskCount: bench.tasks.length };
273
+ push('BENCH_LOAD', 'PASS', `bench.json valid (${bench.tasks.length} task(s), content sha256 ${bench.contentSha256.slice(0, 12)}…)`);
274
+ await inspectBenchIntegrity(bench, push);
275
+ return result();
276
+ });
277
+ }
@@ -0,0 +1,34 @@
1
+ import { verdictFromOutput } from './verifier-summary.js';
2
+ import { MOCK_MARKER_FILE } from './constants.js';
3
+ const GATES = {
4
+ BENCH_LOAD: [null, 'Fix bench.json and its referenced files, then run bench check again.'],
5
+ UNTOUCHED_FIXTURE: ['verifier', 'Make the verifier executable and ensure the untouched fixture fails for the intended defect.'],
6
+ MISSING_OUTPUT: ['verifier', 'Make the verifier executable and reject a missing _output.md.'],
7
+ EMPTY_OUTPUT: ['verifier', 'Make the verifier executable and reject an empty _output.md.'],
8
+ FACET_COUNT: ['verifier', 'Decompose acceptance into 2–8 deterministic named checks.'],
9
+ ORACLE: ['oracle', 'Inspect the oracle and verifier output; register a reference repair that passes every check.'],
10
+ MOCK_COVERAGE: ['fixture', 'Add a valid .skillfit-mock.json marker for output tasks if mock coverage is needed.'],
11
+ MOCK_MARKER: ['fixture', 'Fix the .skillfit-mock.json file so it contains valid JSON.'],
12
+ MOCK_BASELINE: ['fixture', 'Inspect the baseline mock output and verifier.'],
13
+ MOCK_TREATMENT: ['fixture', 'Inspect the treatment mock output and verifier.'],
14
+ FIXTURE_SIZE: ['fixture', 'Shrink the fixture while preserving the real defect and acceptance checks.'],
15
+ TRIGGER_LABEL: ['shouldTrigger', 'Label trigger tasks and include appropriate negative controls.'],
16
+ NEGATIVE_CONTROLS: ['shouldTrigger', 'Add representative shouldTrigger:false tasks to reach the documented 30% target.'],
17
+ CALIBRATION: [null, 'Inspect the calibration records before considering a separately budgeted run.'],
18
+ };
19
+ export function benchDiagnostic(code, status, message, task, evidence = null) {
20
+ const [field, remediation] = GATES[code];
21
+ const marker = code.startsWith('MOCK_');
22
+ const path = task && field === 'fixture'
23
+ ? `${task.fixture}${marker ? `/${MOCK_MARKER_FILE}` : ''}` : 'bench.json';
24
+ return { code, status, message, taskId: task?.id ?? null,
25
+ location: { path, field: path === 'bench.json' && field ? `tasks[].${field}` : null },
26
+ remediation: status === 'FAIL' || status === 'WARN' ? remediation : null, evidence };
27
+ }
28
+ /** Bound process text without dropping exit status or individual verifier checks. */
29
+ export function benchCheckEvidence(result, command) {
30
+ // Verifier JSON is interpreted consistently with the existing runner.
31
+ return { command, exitCode: result.exitCode, error: result.error,
32
+ output: result.output.slice(-8192), outputTruncated: result.output.length > 8192,
33
+ checks: verdictFromOutput(result.output)?.checks ?? null };
34
+ }
@@ -1,4 +1,4 @@
1
- import { parseEvalReport } from '../commands/eval-report.js';
1
+ import { parseEvalReport } from './eval-manifest.js';
2
2
  import { completeCost, COST_METRICS } from './costs.js';
3
3
  import { parseAcceptancePolicy, policyHash, record } from './eval-contract.js';
4
4
  import { efficiencyEvidence } from './eval-efficiency.js';
@@ -10,7 +10,7 @@ import { sha256File, sha256Text } from './hash.js';
10
10
  import { collectInstalledSkillTarget } from './installed-skill.js';
11
11
  import { runVerifier, summarizeJudge } from './runner.js';
12
12
  import { verdictFromOutput } from './verifier-summary.js';
13
- import { parseEvalReport } from '../commands/eval-report.js';
13
+ import { parseEvalReport } from './eval-manifest.js';
14
14
  import { pairConditions } from './types.js';
15
15
  import { NATIVE_DIFF_PATH, NATIVE_DIFF_SNAPSHOT } from './native-diff.js';
16
16
  import { assertSpendingCanContinue, parseSpendingBudget, spendingBudgetState } from './eval-budget.js';