skillfit 0.12.0 → 0.13.1
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 +60 -119
- package/README.zh-CN.md +60 -116
- package/dist/commands/bench-check-report.js +1 -34
- package/dist/commands/bench.js +6 -239
- package/dist/commands/eval-preflight-error.js +9 -0
- package/dist/commands/eval-preflight.js +4 -11
- package/dist/commands/eval-report.js +6 -459
- package/dist/commands/install.js +14 -98
- package/dist/harness/bench-check.js +277 -0
- package/dist/harness/bench-diagnostics.js +34 -0
- package/dist/harness/eval-acceptance.js +1 -1
- package/dist/harness/eval-audit.js +1 -1
- package/dist/harness/eval-manifest.js +456 -0
- package/dist/install/constants.js +1 -0
- package/dist/install/transaction.js +112 -0
- package/docs/README.md +65 -0
- package/docs/architecture.md +86 -0
- package/docs/archive-delivery.md +83 -0
- package/docs/archive-inventory.md +91 -0
- package/docs/evaluation-reports.md +1 -1
- package/docs/first-real-eval.md +12 -10
- package/docs/growth-roadmap-2026-10.md +17 -18
- package/docs/package-contents.md +80 -0
- package/docs/plans/2026-10-20-archive-replay-verification.json +125 -0
- package/docs/plans/2026-10-20-archive-source-verification.json +256 -0
- package/docs/plans/2026-10-20-delivery-verification.json +146 -0
- package/docs/plans/2026-10-20-docs-architecture-cleanup.md +233 -0
- package/docs/plans/2026-10-20-install-transactions-and-archive-delivery.md +233 -0
- package/docs/plans/2026-10-21-npm-0.13.0-release.md +74 -0
- package/docs/plans/2026-10-21-npm-0.13.1-release.md +38 -0
- package/docs/releases/0.12.0-attestation-check.json +22 -0
- package/docs/releases/0.12.0-attestations.json +155 -0
- package/docs/releases/0.12.0-ci-registry-install.json +90 -0
- package/docs/releases/0.12.0-feature-smoke.json +34 -0
- package/docs/releases/0.12.0-foundations-smoke.json +1576 -0
- package/docs/releases/0.12.0-local-registry-install.json +75 -0
- package/docs/releases/0.12.0-preparation-attempt-1.json +22 -0
- package/docs/releases/0.12.0-registry-metadata.json +96 -0
- package/docs/releases/0.12.0-signatures.txt +6 -0
- package/docs/releases/0.12.0-verification.json +99 -0
- package/docs/releases/0.12.0.md +14 -0
- package/docs/releases/0.13.0-archive-replays.json +266 -0
- package/docs/releases/0.13.0-archive-restoration.json +168 -0
- package/docs/releases/0.13.0-attestation-check.json +22 -0
- package/docs/releases/0.13.0-attestations.json +147 -0
- package/docs/releases/0.13.0-ci-registry-install.json +60 -0
- package/docs/releases/0.13.0-feature-smoke.json +41 -0
- package/docs/releases/0.13.0-feature-smoke.mjs +114 -0
- package/docs/releases/0.13.0-foundations-smoke.json +1576 -0
- package/docs/releases/0.13.0-local-registry-install.json +40 -0
- package/docs/releases/0.13.0-preparation.json +102 -0
- package/docs/releases/0.13.0-preview-review.json +16 -0
- package/docs/releases/0.13.0-registry-metadata.json +92 -0
- package/docs/releases/0.13.0-signatures.txt +12 -0
- package/docs/releases/0.13.0-verification.json +136 -0
- package/docs/releases/0.13.0.md +112 -0
- package/docs/releases/0.13.1-feature-smoke.mjs +116 -0
- package/docs/releases/0.13.1-preparation-failure-1.json +25 -0
- package/docs/releases/0.13.1-preparation.json +149 -0
- package/docs/releases/0.13.1.md +62 -0
- package/docs/releases/archive-delivery-smoke.mjs +37 -0
- package/docs/releases/release-docs-smoke.mjs +37 -0
- package/docs/reproducible-offline-example.md +1 -1
- package/evidence/README.md +24 -1
- package/evidence/archive-catalog.v1.json +8044 -0
- package/evidence/fetch-archives.mjs +211 -0
- package/package.json +9 -2
- package/skills/skillfit/SKILL.md +20 -6
- package/dist/cli.test.js +0 -193
- package/dist/commands/bench-calibration.test.js +0 -237
- package/dist/commands/bench-check-json.test.js +0 -242
- package/dist/commands/bench-manage.test.js +0 -87
- package/dist/commands/bench.test.js +0 -1166
- package/dist/commands/bundle.test.js +0 -142
- package/dist/commands/calibration-cli.test.js +0 -145
- package/dist/commands/doctor.test.js +0 -280
- package/dist/commands/eval-agent-preflight.test.js +0 -269
- package/dist/commands/eval-cli-usage.test.js +0 -75
- package/dist/commands/eval-export-modes.test.js +0 -350
- package/dist/commands/eval-export.test.js +0 -279
- package/dist/commands/eval-interruption.test.js +0 -263
- package/dist/commands/eval-preflight.test.js +0 -382
- package/dist/commands/eval-report.test.js +0 -367
- package/dist/commands/eval.test.js +0 -503
- package/dist/commands/evaluation-report.test.js +0 -243
- package/dist/commands/install.test.js +0 -555
- package/dist/commands/npm-first-run.test.js +0 -74
- package/dist/commands/replay-cancellation.test.js +0 -105
- package/dist/commands/report.test.js +0 -110
- package/dist/commands/setup.test.js +0 -150
- package/dist/commands/upstream.test.js +0 -139
- package/dist/commands/workflow-entrypoints.test.js +0 -137
- package/dist/docs.test.js +0 -154
- package/dist/frontmatter.test.js +0 -49
- package/dist/harness/bench.test.js +0 -109
- package/dist/harness/bundle.test.js +0 -71
- package/dist/harness/codex-usage.test.js +0 -87
- package/dist/harness/costs.test.js +0 -92
- package/dist/harness/eval-budget.test.js +0 -237
- package/dist/harness/eval-component.test.js +0 -770
- package/dist/harness/eval-efficiency.test.js +0 -56
- package/dist/harness/execution-timing.test.js +0 -61
- package/dist/harness/executors/api.test.js +0 -175
- package/dist/harness/executors/cli.test.js +0 -541
- package/dist/harness/executors/mock.test.js +0 -43
- package/dist/harness/experiment-session.test.js +0 -317
- package/dist/harness/installed-skill.test.js +0 -162
- package/dist/harness/interruption.test.js +0 -31
- package/dist/harness/judge-accounting.test.js +0 -216
- package/dist/harness/judge.test.js +0 -181
- package/dist/harness/kimi-usage.test.js +0 -62
- package/dist/harness/native-diff.test.js +0 -53
- package/dist/harness/oss-lru-cache.test.js +0 -79
- package/dist/harness/oss-normalize-url.test.js +0 -64
- package/dist/harness/oss-regression-witness.test.js +0 -89
- package/dist/harness/oss-skill-followup.test.js +0 -59
- package/dist/harness/prompt.test.js +0 -48
- package/dist/harness/receipts.test.js +0 -148
- package/dist/harness/report.test.js +0 -297
- package/dist/harness/runner.test.js +0 -635
- package/dist/harness/skill-revision.test.js +0 -148
- package/dist/harness/stats.test.js +0 -124
- package/dist/harness/target.test.js +0 -60
- package/dist/harness/trigger.test.js +0 -261
- package/dist/harness/verifier-summary.test.js +0 -99
- package/dist/harness/verifier.test.js +0 -128
- package/dist/harness/waza-behavior.test.js +0 -139
- package/dist/mcp/probe.test.js +0 -139
- package/evidence/artifacts/2026-10-12-diagnosing-revision/calibration-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-revision/interrupted-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-revision/validation-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-v2/regression-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-v2/transfer-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-available/readiness-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-comparison/records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-recovery/records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-validated/records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-13-debugging-completed-development/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-13-debugging-controls-and-sleep-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-13-debugging-development-stops/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-followup-routing-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-independent-validation/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-reading-pilot-and-cost-review/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-spending-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
|
-
import { cpSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { spawnSync } from 'node:child_process';
|
|
8
|
-
import { test } from 'node:test';
|
|
9
|
-
import { runVerifier } from './runner.js';
|
|
10
|
-
import { verdictFromOutput } from './verifier-summary.js';
|
|
11
|
-
const bench = fileURLToPath(new URL('../../benches/contrib/oss-normalize-url', import.meta.url));
|
|
12
|
-
const fixture = join(bench, 'fixtures/query-shape');
|
|
13
|
-
function workspace(t) {
|
|
14
|
-
const root = mkdtempSync(join(tmpdir(), 'skillfit-normalize-test-'));
|
|
15
|
-
cpSync(fixture, root, { recursive: true });
|
|
16
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
17
|
-
return root;
|
|
18
|
-
}
|
|
19
|
-
function oracle(root) {
|
|
20
|
-
const result = spawnSync(process.execPath, [join(bench, 'ground-truth/oracle-query-shape.mjs'), root]);
|
|
21
|
-
assert.equal(result.status, 0);
|
|
22
|
-
}
|
|
23
|
-
async function grade(root) {
|
|
24
|
-
const result = await runVerifier(bench, 'node verifiers/query-shape.mjs', root);
|
|
25
|
-
return { ...result, summary: verdictFromOutput(result.output) };
|
|
26
|
-
}
|
|
27
|
-
test('normalize-url fixture retains every pinned upstream Git blob and SHA-256', () => {
|
|
28
|
-
const provenance = JSON.parse(readFileSync(join(bench, 'provenance.json'), 'utf8'));
|
|
29
|
-
for (const entry of provenance.files) {
|
|
30
|
-
const bytes = readFileSync(join(fixture, entry.path));
|
|
31
|
-
assert.equal(createHash('sha256').update(bytes).digest('hex'), entry.sha256);
|
|
32
|
-
assert.equal(createHash('sha1').update(Buffer.concat([Buffer.from(`blob ${bytes.length}\0`), bytes])).digest('hex'), entry.gitBlob);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
test('real query-shape failure reproduces untouched and maintainer repair passes all facets', async (t) => {
|
|
36
|
-
const root = workspace(t);
|
|
37
|
-
const before = await grade(root);
|
|
38
|
-
assert.equal(before.exitCode, 1);
|
|
39
|
-
assert.equal(before.summary.checks?.find(c => c.name === 'bare path and flag query parameters retain their shape')?.pass, false);
|
|
40
|
-
oracle(root);
|
|
41
|
-
const after = await grade(root);
|
|
42
|
-
assert.equal(after.exitCode, 0);
|
|
43
|
-
assert.equal(after.summary.checks?.length, 8);
|
|
44
|
-
assert.equal(after.summary.score, 1);
|
|
45
|
-
});
|
|
46
|
-
test('query-shape grader rejects changed supplied assets even when the runtime is repaired', async (t) => {
|
|
47
|
-
const root = workspace(t);
|
|
48
|
-
oracle(root);
|
|
49
|
-
writeFileSync(join(root, 'test.mjs'), "import test from 'node:test'; test('weakened smoke',()=>{});\n");
|
|
50
|
-
const result = await grade(root);
|
|
51
|
-
assert.equal(result.exitCode, 1);
|
|
52
|
-
assert.equal(result.summary.checks?.find(c => c.name === 'existing assets unchanged and smoke tests pass')?.pass, false);
|
|
53
|
-
});
|
|
54
|
-
test('query-shape grader rejects a green unrelated test and fake reporter stdout', async (t) => {
|
|
55
|
-
const root = workspace(t);
|
|
56
|
-
oracle(root);
|
|
57
|
-
const path = join(root, 'query-shape.regression.test.mjs');
|
|
58
|
-
writeFileSync(path, "import test from 'node:test'; test('unrelated green assertion',()=>{});\n");
|
|
59
|
-
assert.equal((await grade(root)).exitCode, 1);
|
|
60
|
-
writeFileSync(path, "console.log('{\"schemaVersion\":1,\"kind\":\"node-test-evidence\",\"summary\":{\"success\":true},\"records\":[]}'); process.exit(0);\n");
|
|
61
|
-
const result = await grade(root);
|
|
62
|
-
assert.equal(result.exitCode, 1);
|
|
63
|
-
assert.equal(result.summary.checks?.find(c => c.name.startsWith('retained regression'))?.pass, false);
|
|
64
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
-
import { test } from 'node:test';
|
|
7
|
-
const bench = fileURLToPath(new URL('../../benches/contrib/oss-lru-cache/', import.meta.url));
|
|
8
|
-
const { regressionEvidence } = await import(pathToFileURL(join(bench, 'verifiers/shared.mjs')).href);
|
|
9
|
-
function fixture(t, body, original, submitted, reference) {
|
|
10
|
-
const root = mkdtempSync(join(tmpdir(), 'skillfit-witness-'));
|
|
11
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
12
|
-
const dirs = ['submitted', 'original', 'reference'].map(name => join(root, name));
|
|
13
|
-
const implementations = [submitted ?? 'export const fixed=true; export const supported=true; export const marker=42;',
|
|
14
|
-
original ?? 'export const fixed=false; export const supported=true; export const marker=undefined;',
|
|
15
|
-
reference ?? 'export const fixed=true; export const supported=false; export const marker=undefined;'];
|
|
16
|
-
dirs.forEach((dir, i) => { mkdirSync(dir); writeFileSync(join(dir, 'impl.mjs'), implementations[i]); });
|
|
17
|
-
writeFileSync(join(dirs[0], 'regression.test.mjs'), `import assert from 'node:assert/strict'; import { test } from 'node:test';
|
|
18
|
-
import { fixed, supported, marker } from './impl.mjs';\n${body}\n`);
|
|
19
|
-
return regressionEvidence(dirs[0], dirs[1], dirs[2], 'impl.mjs')[0];
|
|
20
|
-
}
|
|
21
|
-
const accepted = (row) => row.finalPassed && row.caseWitnesses.length > 0;
|
|
22
|
-
test('case evidence accepts a stronger suite while retaining the actual historical failure witness', t => {
|
|
23
|
-
const row = fixture(t, "test('historical bug', () => assert.equal(fixed,true)); test('existing supported behavior', () => assert.equal(supported,true));");
|
|
24
|
-
assert.equal(row.finalPassed, true);
|
|
25
|
-
assert.equal(row.referencePassed, false);
|
|
26
|
-
assert.equal(accepted(row), true);
|
|
27
|
-
assert.deepEqual(row.caseWitnesses.map(w => w.path), [['historical bug']]);
|
|
28
|
-
});
|
|
29
|
-
test('case evidence rejects an unrelated field even when it creates file-level RED to GREEN', t => {
|
|
30
|
-
const row = fixture(t, "test('unrelated marker', () => assert.equal(marker,42));");
|
|
31
|
-
assert.equal(row.finalPassed, true);
|
|
32
|
-
assert.equal(row.originalFailed, true);
|
|
33
|
-
assert.equal(row.referencePassed, false);
|
|
34
|
-
assert.equal(accepted(row), false);
|
|
35
|
-
});
|
|
36
|
-
test('duplicate full test identities cannot supply a witness', t => {
|
|
37
|
-
const row = fixture(t, "test('duplicate', () => assert.equal(fixed,true)); test('duplicate', () => assert.equal(fixed,true));");
|
|
38
|
-
assert.equal(row.finalPassed, true);
|
|
39
|
-
assert.equal(accepted(row), false);
|
|
40
|
-
});
|
|
41
|
-
test('the full parent path distinguishes same-named tests in different suites', t => {
|
|
42
|
-
const row = fixture(t, "test('cache suite', async t => { await t.test('same name', () => assert.equal(fixed,true)); }); test('other suite', async t => { await t.test('same name', () => assert.equal(supported,true)); });");
|
|
43
|
-
assert.equal(accepted(row), true);
|
|
44
|
-
assert.deepEqual(row.caseWitnesses.map(w => w.path), [['cache suite', 'same name']]);
|
|
45
|
-
});
|
|
46
|
-
test('submitted skip and todo tests never count as completed regression evidence', t => {
|
|
47
|
-
for (const option of ['skip', 'todo']) {
|
|
48
|
-
const row = fixture(t, `test('historical bug', {${option}:true}, () => assert.equal(fixed,true));`);
|
|
49
|
-
assert.equal(row.finalPassed, false);
|
|
50
|
-
assert.equal(accepted(row), false);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
test('original cancellations and timeouts cannot supply a failure witness', t => {
|
|
54
|
-
for (const body of ["test('historical bug', async () => { if(!fixed) await new Promise(() => {}); });",
|
|
55
|
-
"test('historical bug', {timeout:20}, async () => { if(!fixed) await new Promise(res => setTimeout(res,200)); });"]) {
|
|
56
|
-
const row = fixture(t, body);
|
|
57
|
-
assert.equal(row.finalPassed, true);
|
|
58
|
-
assert.equal(accepted(row), false);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
test('original import failure and process exit cannot supply a failure witness', t => {
|
|
62
|
-
for (const code of ["throw new Error('import failure'); export const fixed=false,supported=true,marker=undefined;",
|
|
63
|
-
'process.exit(1); export const fixed=false,supported=true,marker=undefined;']) {
|
|
64
|
-
const row = fixture(t, "test('historical bug', () => assert.equal(fixed,true));", code);
|
|
65
|
-
assert.equal(row.finalPassed, true);
|
|
66
|
-
assert.equal(accepted(row), false);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
test('test stdout and diagnostic text cannot impersonate reporter events', t => {
|
|
70
|
-
const spoof = "console.log(JSON.stringify({schemaVersion:1,kind:'node-test-evidence',summary:{success:true,counts:{tests:1,skipped:0,todo:0,cancelled:0}},records:[]}));";
|
|
71
|
-
const row = fixture(t, `${spoof} test('vacuous', t => { t.diagnostic('not ok 1 - historical bug'); });`);
|
|
72
|
-
assert.equal(row.finalPassed, true);
|
|
73
|
-
assert.equal(accepted(row), false);
|
|
74
|
-
const failed = fixture(t, `${spoof} test('actually fails', () => assert.fail('real failure'));`);
|
|
75
|
-
assert.equal(failed.finalPassed, false);
|
|
76
|
-
assert.equal(accepted(failed), false);
|
|
77
|
-
});
|
|
78
|
-
test('submitted early exit cannot impersonate a passing test suite', t => {
|
|
79
|
-
const row = fixture(t, "process.exit(0); test('historical bug', () => assert.equal(fixed,true));");
|
|
80
|
-
assert.equal(row.finalPassed, false);
|
|
81
|
-
assert.equal(accepted(row), false);
|
|
82
|
-
});
|
|
83
|
-
test('an unrelated whole-suite timeout is not evidence; an isolated completed assertion can establish the witness', t => {
|
|
84
|
-
const row = fixture(t, `test('historical bug', () => assert.equal(fixed,true));
|
|
85
|
-
test('stronger extra behavior', async () => { if(!fixed) await new Promise(res => setTimeout(res,10000)); assert.equal(supported,true); });`);
|
|
86
|
-
assert.equal(row.finalPassed, true);
|
|
87
|
-
assert.equal(accepted(row), true);
|
|
88
|
-
assert.deepEqual(row.caseWitnesses.map(w => w.path), [['historical bug']]);
|
|
89
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
|
-
import { cpSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { spawnSync } from 'node:child_process';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import { test } from 'node:test';
|
|
9
|
-
const bench = fileURLToPath(new URL('../../benches/contrib/oss-skill-followup/', import.meta.url));
|
|
10
|
-
const provenance = JSON.parse(readFileSync(join(bench, 'provenance.json'), 'utf8'));
|
|
11
|
-
function run(script, args) {
|
|
12
|
-
const env = { ...process.env };
|
|
13
|
-
delete env.NODE_TEST_CONTEXT;
|
|
14
|
-
const result = spawnSync(process.execPath, [join(bench, script), ...args], { encoding: 'utf8', timeout: 20000, env });
|
|
15
|
-
assert.equal(result.error, undefined);
|
|
16
|
-
assert.equal(result.signal, null);
|
|
17
|
-
return { status: result.status, value: JSON.parse(result.stdout.trim().split('\n').at(-1)) };
|
|
18
|
-
}
|
|
19
|
-
function scratch(t, id) {
|
|
20
|
-
const root = mkdtempSync(join(tmpdir(), 'skillfit-followup-integrity-'));
|
|
21
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
22
|
-
cpSync(join(bench, 'fixtures', id), root, { recursive: true });
|
|
23
|
-
return root;
|
|
24
|
-
}
|
|
25
|
-
test('followup sources retain exact independent parent and maintainer bytes', () => {
|
|
26
|
-
assert.equal(provenance.tasks.length, 8);
|
|
27
|
-
for (const task of provenance.tasks) {
|
|
28
|
-
const hash = (path) => createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
29
|
-
assert.equal(hash(join(bench, 'fixtures', task.task, 'index.js')), task.beforeSourceSha256);
|
|
30
|
-
assert.equal(hash(join(bench, 'ground-truth', task.task, 'index.js')), task.fixedSourceSha256);
|
|
31
|
-
assert.notEqual(task.beforeSourceSha256, task.fixedSourceSha256);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
for (const task of provenance.tasks)
|
|
35
|
-
test(`followup ${task.task}: original behavior fails and full maintainer repair passes`, t => {
|
|
36
|
-
const root = scratch(t, task.task);
|
|
37
|
-
const original = run('verifiers/probe.mjs', [task.task, root]);
|
|
38
|
-
assert.equal(original.status, 0);
|
|
39
|
-
assert.equal(original.value.checks.length, 4);
|
|
40
|
-
assert.ok(original.value.checks.some(check => !check.pass), 'the original must fail actual public behavior, not only lack a regression file');
|
|
41
|
-
const oracle = spawnSync(process.execPath, [join(bench, `ground-truth/oracle-${task.task}.mjs`), root], { encoding: 'utf8' });
|
|
42
|
-
assert.equal(oracle.status, 0);
|
|
43
|
-
const fixed = run(`verifiers/${task.task}.mjs`, [root]);
|
|
44
|
-
assert.equal(fixed.status, 0);
|
|
45
|
-
assert.equal(fixed.value.passed, true);
|
|
46
|
-
assert.equal(fixed.value.score, 1);
|
|
47
|
-
assert.equal(fixed.value.checks.length, 6);
|
|
48
|
-
assert.ok(fixed.value.checks.every(check => check.pass));
|
|
49
|
-
});
|
|
50
|
-
test('followup outcome verification rejects a changed supplied clock helper', t => {
|
|
51
|
-
const id = 'debounce-timer-boundary', root = scratch(t, id);
|
|
52
|
-
const oracle = spawnSync(process.execPath, [join(bench, `ground-truth/oracle-${id}.mjs`), root], { encoding: 'utf8' });
|
|
53
|
-
assert.equal(oracle.status, 0);
|
|
54
|
-
writeFileSync(join(root, 'test-clock.mjs'), readFileSync(join(root, 'test-clock.mjs'), 'utf8') + '\n// changed supplied helper\n');
|
|
55
|
-
const result = run(`verifiers/${id}.mjs`, [root]);
|
|
56
|
-
assert.equal(result.status, 1);
|
|
57
|
-
assert.equal(result.value.passed, false);
|
|
58
|
-
assert.equal(result.value.checks[0].pass, false);
|
|
59
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { test } from 'node:test';
|
|
6
|
-
import { buildTaskPrompt, snapshotRepoFiles } from './prompt.js';
|
|
7
|
-
function makeRepo(t) {
|
|
8
|
-
const dir = mkdtempSync(join(tmpdir(), 'skillfit-prompt-'));
|
|
9
|
-
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
10
|
-
mkdirSync(join(dir, '.git'), { recursive: true });
|
|
11
|
-
mkdirSync(join(dir, 'src'), { recursive: true });
|
|
12
|
-
writeFileSync(join(dir, 'src', 'a.js'), 'export const a = 1;\n');
|
|
13
|
-
writeFileSync(join(dir, '.git', 'config'), '[core]\n');
|
|
14
|
-
writeFileSync(join(dir, '_prompt.txt'), 'hidden\n');
|
|
15
|
-
writeFileSync(join(dir, '.skillfit-mock.json'), '{}\n');
|
|
16
|
-
return dir;
|
|
17
|
-
}
|
|
18
|
-
test('snapshotRepoFiles hides .git, underscore files and the mock marker', (t) => {
|
|
19
|
-
const dir = makeRepo(t);
|
|
20
|
-
const snapshot = snapshotRepoFiles(dir);
|
|
21
|
-
assert.match(snapshot, /--- repository file: src\/a\.js ---/);
|
|
22
|
-
assert.match(snapshot, /export const a = 1;/);
|
|
23
|
-
assert.ok(!snapshot.includes('.git'));
|
|
24
|
-
assert.ok(!snapshot.includes('hidden'));
|
|
25
|
-
assert.ok(!snapshot.includes('skillfit-mock'));
|
|
26
|
-
});
|
|
27
|
-
test('buildTaskPrompt omits the skill block for baseline', () => {
|
|
28
|
-
const prompt = buildTaskPrompt('Do the task.\n', '--- repository file: a ---\n1', null);
|
|
29
|
-
assert.match(prompt, /^Do the task\./);
|
|
30
|
-
assert.match(prompt, /Experiment isolation rules:/);
|
|
31
|
-
assert.match(prompt, /Repository snapshot:/);
|
|
32
|
-
assert.match(prompt, /Output contract:/);
|
|
33
|
-
assert.ok(!prompt.includes('<skill name='));
|
|
34
|
-
});
|
|
35
|
-
test('buildTaskPrompt embeds the skill payload for treatment', () => {
|
|
36
|
-
const prompt = buildTaskPrompt('Do the task.', 'snapshot', 'Treatment material:\n<skill name="s">X</skill>');
|
|
37
|
-
assert.match(prompt, /<skill name="s">X<\/skill>/);
|
|
38
|
-
assert.ok(prompt.indexOf('<skill name=') > prompt.indexOf('Repository snapshot:'));
|
|
39
|
-
assert.ok(prompt.indexOf('Output contract:') > prompt.indexOf('<skill name='));
|
|
40
|
-
});
|
|
41
|
-
test('buildTaskPrompt workspace mode swaps isolation rules for workspace rules', () => {
|
|
42
|
-
const prompt = buildTaskPrompt('Fix the code.', 'snapshot', null, { workspace: true });
|
|
43
|
-
assert.match(prompt, /Workspace rules:/);
|
|
44
|
-
assert.match(prompt, /inspect, edit, and run/);
|
|
45
|
-
assert.ok(!prompt.includes('Experiment isolation rules'));
|
|
46
|
-
const isolated = buildTaskPrompt('Fix the code.', 'snapshot', null);
|
|
47
|
-
assert.match(isolated, /Experiment isolation rules:/);
|
|
48
|
-
});
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { test } from 'node:test';
|
|
6
|
-
import { collectReceipts, measureSkillTax, walkGlob } from './receipts.js';
|
|
7
|
-
function makeHome(t) {
|
|
8
|
-
const home = mkdtempSync(join(tmpdir(), 'skillfit-receipts-'));
|
|
9
|
-
t.after(() => rmSync(home, { recursive: true, force: true }));
|
|
10
|
-
const kimiWire1 = join(home, '.kimi-code', 'sessions', 'wd_demo', 's1', 'agents', 'main');
|
|
11
|
-
const kimiWire2 = join(home, '.kimi-code', 'sessions', 'wd_demo', 's2', 'agents', 'main');
|
|
12
|
-
mkdirSync(kimiWire1, { recursive: true });
|
|
13
|
-
mkdirSync(kimiWire2, { recursive: true });
|
|
14
|
-
writeFileSync(join(kimiWire1, 'wire.jsonl'), [
|
|
15
|
-
'{"type":"metadata"}',
|
|
16
|
-
'{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"alpha"}},"time":1}',
|
|
17
|
-
'{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"alpha"}},"time":2}',
|
|
18
|
-
'{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Read","args":{"path":"x"}},"time":3}',
|
|
19
|
-
'not json at all',
|
|
20
|
-
'{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"beta"}},"time":4}',
|
|
21
|
-
'',
|
|
22
|
-
].join('\n'));
|
|
23
|
-
writeFileSync(join(kimiWire2, 'wire.jsonl'), '{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"alpha"}},"time":5}\n');
|
|
24
|
-
const claudeDir = join(home, '.claude', 'projects', 'proj-x');
|
|
25
|
-
mkdirSync(claudeDir, { recursive: true });
|
|
26
|
-
writeFileSync(join(claudeDir, 'sess-1.jsonl'), [
|
|
27
|
-
'{"type":"assistant","message":{"content":[{"type":"tool_use","name":"Skill","input":{"skill":"gamma"}}]}}',
|
|
28
|
-
'{"type":"user","message":{"content":"hi"}}',
|
|
29
|
-
'{"type":"assistant","message":{"content":[{"type":"text","text":"ok"},{"type":"tool_use","name":"Bash","input":{}}]}}',
|
|
30
|
-
].join('\n'));
|
|
31
|
-
for (const [base, name] of [
|
|
32
|
-
['.kimi-code/skills', 'alpha'],
|
|
33
|
-
['.agents/skills', 'beta'],
|
|
34
|
-
['.agents/skills', 'never-skill'],
|
|
35
|
-
['.claude/skills', 'gamma'],
|
|
36
|
-
['.claude/skills', 'delta'],
|
|
37
|
-
]) {
|
|
38
|
-
mkdirSync(join(home, base, name), { recursive: true });
|
|
39
|
-
writeFileSync(join(home, base, name, 'SKILL.md'), `# ${name}\n`);
|
|
40
|
-
}
|
|
41
|
-
return home;
|
|
42
|
-
}
|
|
43
|
-
test('walkGlob matches single-star segments and suffix patterns', (t) => {
|
|
44
|
-
const home = makeHome(t);
|
|
45
|
-
const kimiFiles = walkGlob(join(home, '.kimi-code', 'sessions'), '*/*/agents/*/wire.jsonl');
|
|
46
|
-
assert.equal(kimiFiles.length, 2);
|
|
47
|
-
const claudeFiles = walkGlob(join(home, '.claude', 'projects'), '*/*.jsonl');
|
|
48
|
-
assert.equal(claudeFiles.length, 1);
|
|
49
|
-
});
|
|
50
|
-
test('collectReceipts aggregates skill fires per agent and computes never-fired', async (t) => {
|
|
51
|
-
const home = makeHome(t);
|
|
52
|
-
const receipts = await collectReceipts({ homeDir: home });
|
|
53
|
-
const kimi = receipts.find((r) => r.agentId === 'kimi-code');
|
|
54
|
-
const claude = receipts.find((r) => r.agentId === 'claude-code');
|
|
55
|
-
const codex = receipts.find((r) => r.agentId === 'codex');
|
|
56
|
-
assert.ok(kimi?.present);
|
|
57
|
-
assert.equal(kimi.sessionsFound, 2);
|
|
58
|
-
assert.equal(kimi.transcriptsRead, 2);
|
|
59
|
-
const alpha = kimi.skills.find((s) => s.name === 'alpha');
|
|
60
|
-
const beta = kimi.skills.find((s) => s.name === 'beta');
|
|
61
|
-
assert.deepEqual({ fires: alpha?.fires, sessions: alpha?.sessionCount }, { fires: 3, sessions: 2 });
|
|
62
|
-
assert.deepEqual({ fires: beta?.fires, sessions: beta?.sessionCount }, { fires: 1, sessions: 1 });
|
|
63
|
-
assert.deepEqual(kimi.neverFired, ['never-skill']);
|
|
64
|
-
assert.ok(claude?.present);
|
|
65
|
-
const gamma = claude.skills.find((s) => s.name === 'gamma');
|
|
66
|
-
assert.equal(gamma?.fires, 1);
|
|
67
|
-
assert.deepEqual(claude.neverFired, ['delta']);
|
|
68
|
-
assert.ok(codex);
|
|
69
|
-
assert.equal(codex.present, false);
|
|
70
|
-
assert.equal(codex.skills.length, 0);
|
|
71
|
-
});
|
|
72
|
-
test('collectReceipts sees Codex skills installed under ~/.codex/skills', async (t) => {
|
|
73
|
-
const home = mkdtempSync(join(tmpdir(), 'skillfit-receipts-codex-skills-'));
|
|
74
|
-
t.after(() => rmSync(home, { recursive: true, force: true }));
|
|
75
|
-
mkdirSync(join(home, '.codex', 'skills', 'from-codex'), { recursive: true });
|
|
76
|
-
writeFileSync(join(home, '.codex', 'skills', 'from-codex', 'SKILL.md'), '# from-codex\n');
|
|
77
|
-
const receipts = await collectReceipts({ homeDir: home, agent: 'codex' });
|
|
78
|
-
assert.deepEqual(receipts[0]?.installed, ['from-codex']);
|
|
79
|
-
});
|
|
80
|
-
test('collectReceipts handles a home with no session stores at all', async (t) => {
|
|
81
|
-
const home = mkdtempSync(join(tmpdir(), 'skillfit-receipts-empty-'));
|
|
82
|
-
t.after(() => rmSync(home, { recursive: true, force: true }));
|
|
83
|
-
const receipts = await collectReceipts({ homeDir: home });
|
|
84
|
-
for (const receipt of receipts) {
|
|
85
|
-
assert.equal(receipt.present, false);
|
|
86
|
-
assert.equal(receipt.skills.length, 0);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
test('collectReceipts filters to a single agent when asked', async (t) => {
|
|
90
|
-
const home = makeHome(t);
|
|
91
|
-
const receipts = await collectReceipts({ homeDir: home, agent: 'kimi-code' });
|
|
92
|
-
assert.equal(receipts.length, 1);
|
|
93
|
-
assert.equal(receipts[0]?.agentId, 'kimi-code');
|
|
94
|
-
});
|
|
95
|
-
test('walkGlob supports ** for any depth', (t) => {
|
|
96
|
-
const home = makeHome(t);
|
|
97
|
-
const deep = join(home, '.codex', 'sessions', '2026', '09', '22');
|
|
98
|
-
mkdirSync(deep, { recursive: true });
|
|
99
|
-
writeFileSync(join(deep, 'rollout-x.jsonl'), '');
|
|
100
|
-
const files = walkGlob(join(home, '.codex', 'sessions'), '**/rollout-*.jsonl');
|
|
101
|
-
assert.equal(files.length, 1);
|
|
102
|
-
});
|
|
103
|
-
test('collectReceipts reads codex rollouts (custom_tool_call skill-path evidence)', async (t) => {
|
|
104
|
-
const home = makeHome(t);
|
|
105
|
-
const deep = join(home, '.codex', 'sessions', '2026', '09', '22');
|
|
106
|
-
mkdirSync(deep, { recursive: true });
|
|
107
|
-
writeFileSync(join(deep, 'rollout-2026-09-22T00-00-00-aaaa.jsonl'), [
|
|
108
|
-
'{"type":"response_item","payload":{"type":"message","role":"user"}}',
|
|
109
|
-
'{"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","name":"exec","input":"Get-Content -Raw C:\\\\repo\\\\.agents\\\\skills\\\\alpha\\\\SKILL.md"}}',
|
|
110
|
-
'{"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","name":"exec","input":"type src\\\\main.js"}}',
|
|
111
|
-
].join('\n'));
|
|
112
|
-
mkdirSync(join(home, '.agents', 'skills', 'codex-only-skill'), { recursive: true });
|
|
113
|
-
writeFileSync(join(home, '.agents', 'skills', 'codex-only-skill', 'SKILL.md'), '# x\n');
|
|
114
|
-
const receipts = await collectReceipts({ homeDir: home, agent: 'codex' });
|
|
115
|
-
const codex = receipts[0];
|
|
116
|
-
assert.ok(codex);
|
|
117
|
-
assert.equal(codex.present, true);
|
|
118
|
-
const alpha = codex.skills.find((s) => s.name === 'alpha');
|
|
119
|
-
assert.equal(alpha?.fires, 1);
|
|
120
|
-
assert.deepEqual(codex.neverFired, ['beta', 'codex-only-skill', 'never-skill']);
|
|
121
|
-
});
|
|
122
|
-
test('collectReceipts uses CODEX_HOME for Codex sessions', async (t) => {
|
|
123
|
-
const home = makeHome(t);
|
|
124
|
-
const codexHome = join(home, 'alternate-codex');
|
|
125
|
-
const sessionsDir = join(codexHome, 'sessions', '2026', '09', '29');
|
|
126
|
-
mkdirSync(sessionsDir, { recursive: true });
|
|
127
|
-
for (const id of ['one', 'two']) {
|
|
128
|
-
writeFileSync(join(sessionsDir, `rollout-${id}.jsonl`), '{"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","name":"exec","input":"Get-Content C:\\\\repo\\\\.agents\\\\skills\\\\example\\\\SKILL.md"}}\n');
|
|
129
|
-
}
|
|
130
|
-
const receipt = (await collectReceipts({ homeDir: home, agent: 'codex', env: { CODEX_HOME: codexHome } }))[0];
|
|
131
|
-
assert.equal(receipt?.sessionsDir, join(codexHome, 'sessions'));
|
|
132
|
-
assert.equal(receipt?.skills.find((skill) => skill.name === 'example')?.sessionCount, 2);
|
|
133
|
-
});
|
|
134
|
-
test('measureSkillTax reads frontmatter description and body size', (t) => {
|
|
135
|
-
const dir = mkdtempSync(join(tmpdir(), 'skillfit-tax-'));
|
|
136
|
-
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
137
|
-
writeFileSync(join(dir, 'SKILL.md'), '---\nname: demo\ndescription: Twelve chars\n---\n\n# Demo\n\nbody body body body\n');
|
|
138
|
-
const tax = measureSkillTax(dir);
|
|
139
|
-
assert.equal(tax.descTokens, 3);
|
|
140
|
-
assert.equal(tax.bodyTokens, Math.ceil('---\nname: demo\ndescription: Twelve chars\n---\n\n# Demo\n\nbody body body body\n'.length / 4));
|
|
141
|
-
});
|
|
142
|
-
test('measureSkillTax tolerates missing frontmatter and missing files', (t) => {
|
|
143
|
-
const dir = mkdtempSync(join(tmpdir(), 'skillfit-tax-'));
|
|
144
|
-
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
145
|
-
assert.deepEqual(measureSkillTax(dir), { descTokens: 0, bodyTokens: 0 });
|
|
146
|
-
writeFileSync(join(dir, 'SKILL.md'), '# plain\n');
|
|
147
|
-
assert.deepEqual(measureSkillTax(dir), { descTokens: 0, bodyTokens: 2 });
|
|
148
|
-
});
|