skillfit 0.11.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.
- package/README.md +68 -104
- package/README.zh-CN.md +68 -101
- package/benches/README.md +6 -2
- package/dist/cli.js +28 -16
- package/dist/commands/bench-calibration.js +5 -1
- package/dist/commands/bench-check-report.js +1 -34
- package/dist/commands/bench-draft.js +167 -0
- package/dist/commands/bench-draft.test.js +168 -0
- package/dist/commands/bench-manage.js +5 -4
- package/dist/commands/bench-source.js +101 -0
- package/dist/commands/bench-source.test.js +84 -0
- package/dist/commands/bench.js +157 -328
- package/dist/commands/eval-api-failure.test.js +46 -0
- package/dist/commands/eval-layout.test.js +126 -0
- 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/eval.js +7 -32
- package/dist/commands/install.js +14 -98
- package/dist/harness/agent-preflight.js +18 -2
- package/dist/harness/bench-check.js +277 -0
- package/dist/harness/bench-diagnostics.js +34 -0
- package/dist/harness/bench-location.js +29 -0
- package/dist/harness/bench-location.test.js +33 -0
- package/dist/harness/bench.js +8 -3
- package/dist/harness/eval-acceptance.js +1 -1
- package/dist/harness/eval-audit.js +2 -2
- package/dist/harness/eval-manifest.js +456 -0
- package/dist/harness/evaluation-layout.js +30 -0
- package/dist/harness/executors/api.js +20 -7
- package/dist/harness/executors/cli.js +15 -25
- package/dist/harness/experiment-session.js +5 -15
- package/dist/harness/hash.js +3 -1
- package/dist/harness/runner.js +5 -4
- package/dist/harness/single-arm-audit.js +1 -1
- package/dist/harness/trigger.js +1 -1
- package/dist/harness/verifier-timeout.js +8 -0
- package/dist/harness/verifier-timeout.test.js +76 -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/bench-authoring.md +23 -3
- package/docs/bench-drafting.md +75 -0
- package/docs/case-management.md +12 -1
- package/docs/eval-agent-preflight.md +15 -2
- package/docs/eval-costs.md +28 -2
- package/docs/eval-planning.md +14 -0
- package/docs/evaluation-input-snapshots.md +20 -4
- package/docs/evaluation-reports.md +1 -1
- package/docs/first-real-eval.md +28 -3
- package/docs/growth-roadmap-2026-10.md +23 -18
- package/docs/package-contents.md +73 -0
- package/docs/plans/2026-10-17-workflow-foundations.md +37 -2
- 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 +41 -0
- package/docs/releases/0.11.0-ci-registry-install.json +130 -0
- package/docs/releases/0.11.0-feature-smoke.json +1576 -0
- package/docs/releases/0.11.0-local-attempt-1.json +24 -0
- package/docs/releases/0.11.0-local-attempt-1.log +19 -0
- package/docs/releases/0.11.0-local-registry-install.json +25 -0
- package/docs/releases/0.11.0-registry-metadata.json +33 -0
- package/docs/releases/0.11.0-signatures.txt +12 -0
- package/docs/releases/0.11.0-verification.json +95 -0
- package/docs/releases/0.11.0.md +54 -11
- 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-feature-smoke.mjs +73 -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 +82 -0
- package/docs/releases/0.13.0-feature-smoke.mjs +114 -0
- package/docs/releases/0.13.0-preparation.json +102 -0
- package/docs/releases/0.13.0.md +61 -0
- package/docs/releases/archive-delivery-smoke.mjs +37 -0
- package/docs/reproducible-offline-example.md +1 -1
- package/docs/schemas/agent-preflight.schema.json +1 -1
- package/docs/verifier-contract.md +9 -0
- 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 +25 -5
- 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 -1162
- 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 -245
- 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 -238
- 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/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 -136
- package/dist/harness/executors/cli.test.js +0 -510
- 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
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { constants, promises as fs } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const PACKAGE_ROOT = fileURLToPath(new URL('..', import.meta.url));
|
|
8
|
+
export const CATALOG_PATH = 'evidence/archive-catalog.v1.json';
|
|
9
|
+
const digest = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
10
|
+
const inside = (root, target) => target === root || target.startsWith(root + path.sep);
|
|
11
|
+
const message = error => error instanceof Error ? error.message : String(error);
|
|
12
|
+
|
|
13
|
+
function safePath(value) {
|
|
14
|
+
return typeof value === 'string' && value.startsWith('evidence/') && !value.includes('\\') &&
|
|
15
|
+
value.split('/').every(part => part && part !== '.' && part !== '..');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function validateCatalog(catalog) {
|
|
19
|
+
if (catalog?.version !== 1 || catalog.source?.repository !== 'remote-controlled-man/skillfit' ||
|
|
20
|
+
!/^[a-f0-9]{40}$/.test(catalog.source?.commit ?? '')) throw new Error('Unsupported archive catalog/source');
|
|
21
|
+
if (!Array.isArray(catalog.archives) || !catalog.archives.length || !Array.isArray(catalog.supportFiles)) {
|
|
22
|
+
throw new Error('Invalid archive catalog inventory');
|
|
23
|
+
}
|
|
24
|
+
const paths = new Set(), ids = new Set();
|
|
25
|
+
for (const [archive, rows] of [[true, catalog.archives], [false, catalog.supportFiles]]) {
|
|
26
|
+
for (const row of rows) {
|
|
27
|
+
if (!safePath(row.path) || paths.has(row.path) || !Number.isSafeInteger(row.bytes) || row.bytes < 0 ||
|
|
28
|
+
row.bytes > 16 * 1024 * 1024 || !/^[a-f0-9]{64}$/.test(row.sha256 ?? '')) {
|
|
29
|
+
throw new Error(`Invalid catalog file: ${row.path}`);
|
|
30
|
+
}
|
|
31
|
+
if (archive && (!row.path.startsWith('evidence/artifacts/') || !row.path.endsWith('.tar.gz') ||
|
|
32
|
+
!/^[a-z0-9][a-z0-9-]*$/.test(row.id ?? '') || ids.has(row.id))) throw new Error(`Invalid archive ID/path: ${row.id}`);
|
|
33
|
+
if (!archive && /\.(?:tar\.gz|tgz|zip)$/.test(row.path)) throw new Error(`Archive in support inventory: ${row.path}`);
|
|
34
|
+
if (row.inlineBase64 !== undefined) {
|
|
35
|
+
if (archive || typeof row.inlineBase64 !== 'string' || row.inlineBase64.length > Math.ceil(row.bytes / 3) * 4 ||
|
|
36
|
+
Buffer.from(row.inlineBase64, 'base64').toString('base64') !== row.inlineBase64) throw new Error(`Invalid inline support: ${row.path}`);
|
|
37
|
+
verify(row, Buffer.from(row.inlineBase64, 'base64'));
|
|
38
|
+
}
|
|
39
|
+
paths.add(row.path);
|
|
40
|
+
if (archive) ids.add(row.id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return catalog;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function readCatalog(packageRoot = PACKAGE_ROOT) {
|
|
47
|
+
return validateCatalog(JSON.parse(await fs.readFile(path.join(packageRoot, CATALOG_PATH), 'utf8')));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function verify(row, bytes) {
|
|
51
|
+
if (bytes.length !== row.bytes || digest(bytes) !== row.sha256) throw new Error(`Integrity mismatch: ${row.path}`);
|
|
52
|
+
return bytes;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function localBytes(root, row) {
|
|
56
|
+
const target = path.join(root, row.path), real = await fs.realpath(target);
|
|
57
|
+
if (!inside(root, real) || !(await fs.lstat(target)).isFile()) throw new Error(`Unsafe source file: ${row.path}`);
|
|
58
|
+
const stat = await fs.stat(target);
|
|
59
|
+
if (stat.size !== row.bytes) throw new Error(`Integrity mismatch: ${row.path}`);
|
|
60
|
+
return verify(row, await fs.readFile(target));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function archiveUrl(catalog, row) {
|
|
64
|
+
return `https://raw.githubusercontent.com/${catalog.source.repository}/${catalog.source.commit}/${row.path}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function remoteBytes(catalog, row, fetchImpl, timeoutMs) {
|
|
68
|
+
const response = await fetchImpl(archiveUrl(catalog, row), { redirect: 'error', signal: AbortSignal.timeout(timeoutMs) });
|
|
69
|
+
if (!response.ok) throw new Error(`Archive download failed: ${row.id} (HTTP ${response.status})`);
|
|
70
|
+
if (response.headers.has('content-length') && Number(response.headers.get('content-length')) !== row.bytes) {
|
|
71
|
+
await response.body?.cancel();
|
|
72
|
+
throw new Error(`Integrity mismatch: ${row.path} (download size)`);
|
|
73
|
+
}
|
|
74
|
+
if (!response.body) throw new Error(`Empty archive response: ${row.id}`);
|
|
75
|
+
const reader = response.body.getReader(), chunks = [];
|
|
76
|
+
let size = 0;
|
|
77
|
+
try {
|
|
78
|
+
while (true) {
|
|
79
|
+
const { done, value } = await reader.read();
|
|
80
|
+
if (done) break;
|
|
81
|
+
size += value.length;
|
|
82
|
+
if (size > row.bytes) throw new Error(`Archive exceeds catalog size: ${row.id}`);
|
|
83
|
+
chunks.push(value);
|
|
84
|
+
}
|
|
85
|
+
} catch (error) {
|
|
86
|
+
await reader.cancel().catch(() => {});
|
|
87
|
+
throw error;
|
|
88
|
+
} finally {
|
|
89
|
+
reader.releaseLock();
|
|
90
|
+
}
|
|
91
|
+
return verify(row, Buffer.concat(chunks, size));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function requireAbsent(target) {
|
|
95
|
+
try { await fs.lstat(target); } catch (error) { if (error.code === 'ENOENT') return; throw error; }
|
|
96
|
+
throw new Error(`Output already exists: ${target}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Claim a fresh directory exclusively. Copy files exclusively too: portable directory rename
|
|
100
|
+
// can replace an empty competing directory on POSIX, and cannot replace it on Windows.
|
|
101
|
+
// Rollback removes only our files/directories; it never recursively removes the destination.
|
|
102
|
+
async function publish(staging, output, rows) {
|
|
103
|
+
await fs.mkdir(output);
|
|
104
|
+
const files = [], directories = [output];
|
|
105
|
+
try {
|
|
106
|
+
for (const row of rows) {
|
|
107
|
+
let dir = output;
|
|
108
|
+
for (const part of row.path.split('/').slice(0, -1)) {
|
|
109
|
+
dir = path.join(dir, part);
|
|
110
|
+
try { await fs.mkdir(dir); directories.push(dir); } catch (error) {
|
|
111
|
+
if (error.code !== 'EEXIST' || !(await fs.lstat(dir)).isDirectory()) throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const target = path.join(output, row.path);
|
|
115
|
+
await fs.copyFile(path.join(staging, row.path), target, constants.COPYFILE_EXCL);
|
|
116
|
+
files.push({ path: target, stat: await fs.lstat(target) });
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
const failures = [];
|
|
120
|
+
for (const file of files.reverse()) {
|
|
121
|
+
try {
|
|
122
|
+
const stat = await fs.lstat(file.path);
|
|
123
|
+
if (stat.ino !== file.stat.ino || stat.dev !== file.stat.dev) throw new Error('file changed during publication');
|
|
124
|
+
await fs.unlink(file.path);
|
|
125
|
+
} catch (cleanupError) { failures.push(`${file.path}: ${message(cleanupError)}`); }
|
|
126
|
+
}
|
|
127
|
+
for (const dir of directories.reverse()) {
|
|
128
|
+
try { await fs.rmdir(dir); } catch (cleanupError) { failures.push(`${dir}: ${message(cleanupError)}`); }
|
|
129
|
+
}
|
|
130
|
+
if (failures.length) throw new Error(`${message(error)}; output cleanup incomplete: ${failures.join('; ')}`, { cause: error });
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Only explicit yes applies. Injected roots/transport keep tests offline and detached. */
|
|
136
|
+
export async function restoreArchives({ all = false, ids = [], output, yes = false, from, offline = false,
|
|
137
|
+
list = false, packageRoot = PACKAGE_ROOT, catalog, fetchImpl = globalThis.fetch, timeoutMs = 30_000, log = console.log } = {}) {
|
|
138
|
+
catalog = validateCatalog(catalog ?? await readCatalog(packageRoot));
|
|
139
|
+
if (list) {
|
|
140
|
+
if (all || ids.length || output || yes || from || offline) throw new Error('--list cannot be combined with restore options');
|
|
141
|
+
for (const row of catalog.archives) log(`${row.id}\t${row.bytes}\t${row.path}`);
|
|
142
|
+
return { status: 'listed', archives: catalog.archives.length };
|
|
143
|
+
}
|
|
144
|
+
if (all === (ids.length > 0) || new Set(ids).size !== ids.length) throw new Error('Choose --all or one or more unique --id values');
|
|
145
|
+
const selected = all ? catalog.archives : ids.map(id => {
|
|
146
|
+
const row = catalog.archives.find(row => row.id === id);
|
|
147
|
+
if (!row) throw new Error(`Unknown archive ID: ${id}`);
|
|
148
|
+
return row;
|
|
149
|
+
});
|
|
150
|
+
if (!output) throw new Error('A fresh --output directory is required');
|
|
151
|
+
if (offline && !from) throw new Error('--offline requires --from <archive-root>');
|
|
152
|
+
const packagePath = await fs.realpath(packageRoot), sourcePath = from ? await fs.realpath(from) : null;
|
|
153
|
+
const requested = path.resolve(output), parent = await fs.realpath(path.dirname(requested));
|
|
154
|
+
output = path.join(parent, path.basename(requested));
|
|
155
|
+
if (inside(packagePath, output) || (sourcePath && inside(sourcePath, output))) throw new Error('Output must be outside package and archive source directories');
|
|
156
|
+
await requireAbsent(output);
|
|
157
|
+
log(`Archive restore plan: ${selected.length} archive(s), ${catalog.supportFiles.length} shared support file(s)`);
|
|
158
|
+
log(`Source: ${sourcePath ?? `${catalog.source.repository}@${catalog.source.commit} (HTTPS)`}`);
|
|
159
|
+
log(`Output: ${output}`);
|
|
160
|
+
if (!yes) { log('Preview only. Add --yes to restore; no files were written or downloaded.'); return { status: 'planned', archives: selected.length }; }
|
|
161
|
+
const staging = await fs.mkdtemp(path.join(parent, '.skillfit-archives-'));
|
|
162
|
+
let failure;
|
|
163
|
+
try {
|
|
164
|
+
for (const row of catalog.supportFiles) {
|
|
165
|
+
const bytes = row.inlineBase64 === undefined ? await localBytes(packagePath, row) : verify(row, Buffer.from(row.inlineBase64, 'base64'));
|
|
166
|
+
const target = path.join(staging, row.path);
|
|
167
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
168
|
+
await fs.writeFile(target, bytes, { flag: 'wx' });
|
|
169
|
+
}
|
|
170
|
+
for (const row of selected) {
|
|
171
|
+
const bytes = sourcePath ? await localBytes(sourcePath, row) : await remoteBytes(catalog, row, fetchImpl, timeoutMs);
|
|
172
|
+
const target = path.join(staging, row.path);
|
|
173
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
174
|
+
await fs.writeFile(target, bytes, { flag: 'wx' });
|
|
175
|
+
}
|
|
176
|
+
// A competing output created during download is rejected by the exclusive mkdir.
|
|
177
|
+
await publish(staging, output, [...catalog.supportFiles, ...selected]);
|
|
178
|
+
} catch (error) { failure = error; }
|
|
179
|
+
try { await fs.rm(staging, { recursive: true, force: true }); } catch (error) {
|
|
180
|
+
failure = new Error(`${failure ? message(failure) + '; ' : ''}Staging cleanup failed: ${staging}: ${message(error)}`, { cause: failure ?? error });
|
|
181
|
+
}
|
|
182
|
+
if (failure) throw failure;
|
|
183
|
+
log(`Restored and verified ${selected.length} archive(s). Follow the historical README for manual offline replay.`);
|
|
184
|
+
return { status: 'restored', archives: selected.length, output };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export async function main(args = process.argv.slice(2)) {
|
|
188
|
+
const opts = { ids: [] };
|
|
189
|
+
for (let i = 0; i < args.length; i++) {
|
|
190
|
+
const arg = args[i];
|
|
191
|
+
if (arg === '--help') {
|
|
192
|
+
console.log('Usage: node evidence/fetch-archives.mjs --list | (--all | --id <id>...) --output <new-directory> [--yes] [--from <archive-root>] [--offline]');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (['--all', '--yes', '--offline', '--list'].includes(arg)) {
|
|
196
|
+
const key = arg.slice(2);
|
|
197
|
+
if (opts[key]) throw new Error(`Duplicate option: ${arg}`);
|
|
198
|
+
opts[key] = true;
|
|
199
|
+
} else if (['--id', '--output', '--from'].includes(arg)) {
|
|
200
|
+
const value = args[++i];
|
|
201
|
+
if (!value || value.startsWith('--')) throw new Error(`Missing value for ${arg}`);
|
|
202
|
+
if (arg === '--id') opts.ids.push(value);
|
|
203
|
+
else { const key = arg.slice(2); if (opts[key]) throw new Error(`Duplicate option: ${arg}`); opts[key] = value; }
|
|
204
|
+
} else throw new Error(`Unknown option: ${arg}`);
|
|
205
|
+
}
|
|
206
|
+
return restoreArchives(opts);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
210
|
+
main().catch(error => { console.error(`Archive restore failed: ${message(error)}`); process.exitCode = 1; });
|
|
211
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skillfit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Evidence-driven configuration for AI coding agents: measure which skills, rules and MCP servers actually help — then install only those.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,14 @@
|
|
|
10
10
|
"node": ">=22"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"dist",
|
|
13
|
+
"dist/**/!(*.test).js",
|
|
14
|
+
"dist/**/*.json",
|
|
15
|
+
"dist/commands/bench-source.test.js",
|
|
16
|
+
"dist/commands/bench-draft.test.js",
|
|
17
|
+
"dist/commands/eval-layout.test.js",
|
|
18
|
+
"dist/commands/eval-api-failure.test.js",
|
|
19
|
+
"dist/harness/verifier-timeout.test.js",
|
|
20
|
+
"dist/harness/bench-location.test.js",
|
|
14
21
|
"benches",
|
|
15
22
|
"docs",
|
|
16
23
|
"evidence",
|
package/skills/skillfit/SKILL.md
CHANGED
|
@@ -10,11 +10,11 @@ truth for all numbers; your job is to pick the right command, run it, and interp
|
|
|
10
10
|
|
|
11
11
|
## Prerequisites
|
|
12
12
|
|
|
13
|
-
Check availability with `npx skillfit@0.
|
|
13
|
+
Check availability with `npx skillfit@0.12.0 --version`, or `node dist/cli.js --version` inside a clone.
|
|
14
14
|
If neither works, tell the user to install from https://github.com/remote-controlled-man/skillfit and stop.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
Use 0.12.0 or newer for the complete workflow below, including Git-bench/layout,
|
|
16
|
+
ordinary CLI costs, API-failure evidence, bundled names and recorded case drafting.
|
|
17
|
+
Earlier versions lack some of these fixes; inspect the installed version before using new flags.
|
|
18
18
|
|
|
19
19
|
## Which command for which question
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ the immutable npm 0.10.1 package does not contain these additions.
|
|
|
22
22
|
|---|---|
|
|
23
23
|
| "我的 skill 有没有被用到 / are my skills used at all" | `skillfit report` — read-only, free, instant; start here |
|
|
24
24
|
| "这个配置健不健康" | `skillfit doctor` — read-only |
|
|
25
|
-
| "这个 skill 值不值得装 / does this skill help" | Preview `skillfit eval <skill-path> --bench <bench> --agent <id> --trials 3 --dry-run`, then run within authorized spending |
|
|
25
|
+
| "这个 skill 值不值得装 / does this skill help" | Preview `skillfit eval <skill-path> --mode installed --bench <bench> --agent <id> --trials 3 --dry-run`, then run within authorized spending |
|
|
26
26
|
| "新版 Skill 是否值得采用 / evaluate a candidate for a Skill evolution workflow" | With npm 0.9.0 or a current checkout, use `eval --request <request.json> --dry-run`; read the [component contract](https://github.com/remote-controlled-man/skillfit/blob/main/docs/eval-component.md) for inputs and acceptance policy |
|
|
27
27
|
| "agent 自己想不想得起用它 / does it trigger" | same + `--mode trigger`. Add `--compete-installed` to copy other user Skills; otherwise recall is an upper bound. Codex counts a `SKILL.md` read |
|
|
28
28
|
| "这个 MCP 能不能连上 / is this MCP catalog valid" | `skillfit mcp check <probe.json>` — read-only discovery; calls no tools |
|
|
@@ -42,6 +42,20 @@ It uses that CLI's authentication; offline preflight cannot confirm login.
|
|
|
42
42
|
Without `--agent`, paired eval needs `SKILLFIT_API_KEY`/`OPENAI_API_KEY`. Trigger mode currently verified for
|
|
43
43
|
kimi-code and codex only.
|
|
44
44
|
|
|
45
|
+
Installed mode delivers the complete Skill; default inject mode measures injected
|
|
46
|
+
text. Version 0.12.0 shares bundled-name resolution for read-only bench
|
|
47
|
+
commands and eval; local paths win. Editing still needs an owned local directory.
|
|
48
|
+
Git-root benches are supported in 0.12.0, with metadata excluded consistently.
|
|
49
|
+
Keep `--runs-root` outside the bench/Skill/runtime and Git metadata; bad layouts
|
|
50
|
+
are rejected at preview, including aliases. See the
|
|
51
|
+
[first-run guide](https://github.com/remote-controlled-man/skillfit/blob/main/docs/first-real-eval.md).
|
|
52
|
+
|
|
53
|
+
In 0.12.0, `--freeze` selects tracked ordinary files inside Git; outside Git,
|
|
54
|
+
explicit `--include <file-or-dir>` selections are required. Narrow large fixtures
|
|
55
|
+
before importing. For `--decompose`, preview and authorize its single call within
|
|
56
|
+
existing spending permission. Failed/interrupted drafts retain costs and inputs;
|
|
57
|
+
never retry implicitly. See [drafting records](https://github.com/remote-controlled-man/skillfit/blob/main/docs/bench-drafting.md).
|
|
58
|
+
|
|
45
59
|
## Spend discipline
|
|
46
60
|
|
|
47
61
|
Real eval and calibration runs cost tokens and time. Before any non-dry-run run:
|
|
@@ -93,6 +107,12 @@ credentials fails instead of silently disabling judging. Ctrl+C/SIGTERM stop
|
|
|
93
107
|
managed work and retain records; do not retry, replace or expand stopped calls
|
|
94
108
|
without a fresh authorized plan.
|
|
95
109
|
|
|
110
|
+
In version 0.12.0, ordinary CLI usage parsing is independent of trigger
|
|
111
|
+
detection. Inspect `USAGE_CAPABILITY`: known missing adapter counters block a
|
|
112
|
+
strict budget before calls; API/injected coverage remains unknown. API response
|
|
113
|
+
format/HTTP failures retain reported counters and raw evidence while stopping
|
|
114
|
+
the batch. Missing fields remain unknown, not zero or permission to retry.
|
|
115
|
+
|
|
96
116
|
- Read the verdict line, the discordant-pair counts, and the CI — not just the delta. `inconclusive` means
|
|
97
117
|
the run cannot tell, not that the skill is useless.
|
|
98
118
|
- Anything printed as `indicative` (small benches, few trials) must be reported as indicative.
|
package/dist/cli.test.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { cpSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { test } from 'node:test';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
const PACKAGE_ROOT = fileURLToPath(new URL('..', import.meta.url));
|
|
9
|
-
const CLI = fileURLToPath(new URL('./cli.js', import.meta.url));
|
|
10
|
-
const COMMANDS = [
|
|
11
|
-
['eval', join(PACKAGE_ROOT, 'skills', 'skillfit'), '--bench', join(PACKAGE_ROOT, 'benches', 'code-review')],
|
|
12
|
-
['bench', 'check', join(PACKAGE_ROOT, 'benches', 'code-review'), '--calibrate'],
|
|
13
|
-
];
|
|
14
|
-
test('CLI rejects fractional, malformed and out-of-range trials in eval and calibration dry-runs', (t) => {
|
|
15
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-trials-'));
|
|
16
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
17
|
-
for (const command of COMMANDS) {
|
|
18
|
-
for (const value of ['2.9', '2junk', '', '0', '21', 'NaN']) {
|
|
19
|
-
// Dry-run is mandatory even when exercising the broken parser: no agent CLI may run in tests.
|
|
20
|
-
const result = spawnSync(process.execPath, [CLI, ...command, '--agent', 'codex', '--input', 'workspace', '--trials', value, '--dry-run'], { cwd, encoding: 'utf8', timeout: 30_000 });
|
|
21
|
-
assert.ifError(result.error);
|
|
22
|
-
assert.equal(result.status, 1, `${command[0]} --trials ${JSON.stringify(value)}`);
|
|
23
|
-
assert.match(result.stderr, /--trials must be an integer between 1 and 20/);
|
|
24
|
-
assert.equal(result.stdout, '', 'reject before a bench verifier or experiment plan starts');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
assert.ok(!existsSync(join(cwd, 'runs')));
|
|
28
|
-
});
|
|
29
|
-
test('CLI keeps valid and default repetition counts in offline eval and calibration plans', (t) => {
|
|
30
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-trials-'));
|
|
31
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
32
|
-
for (const command of COMMANDS) {
|
|
33
|
-
for (const trialArgs of [[], ['--trials', '3']]) {
|
|
34
|
-
const result = spawnSync(process.execPath, [CLI, ...command, '--agent', 'codex', '--input', 'workspace', ...trialArgs, '--dry-run'], { cwd, encoding: 'utf8', timeout: 30_000 });
|
|
35
|
-
assert.ifError(result.error);
|
|
36
|
-
assert.equal(result.status, 0, result.stderr);
|
|
37
|
-
const repetitions = trialArgs.length ? 3 : command[0] === 'eval' ? 5 : 2;
|
|
38
|
-
if (command[0] === 'eval')
|
|
39
|
-
assert.match(result.stdout, new RegExp(`Trials\\s+: ${repetitions} per condition`));
|
|
40
|
-
else
|
|
41
|
-
assert.ok(result.stdout.includes(`× ${repetitions} baseline run(s)`));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
assert.ok(!existsSync(join(cwd, 'runs')));
|
|
45
|
-
});
|
|
46
|
-
test('CLI rejects malformed call ceilings and unrelated commands without writes', t => {
|
|
47
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-budget-'));
|
|
48
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
49
|
-
for (const value of ['0', '-1', '1.5', '2junk', 'NaN', '9007199254740992']) {
|
|
50
|
-
const result = spawnSync(process.execPath, [CLI, 'eval', `--max-calls=${value}`, '--dry-run'], { cwd, encoding: 'utf8' });
|
|
51
|
-
assert.equal(result.status, 1);
|
|
52
|
-
assert.match(result.stderr, /positive safe integer/);
|
|
53
|
-
assert.equal(result.stdout, '');
|
|
54
|
-
}
|
|
55
|
-
const unrelated = spawnSync(process.execPath, [CLI, 'doctor', '--max-calls', '2'], { cwd, encoding: 'utf8' });
|
|
56
|
-
assert.equal(unrelated.status, 1);
|
|
57
|
-
assert.match(unrelated.stderr, /applies only to eval/);
|
|
58
|
-
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
59
|
-
});
|
|
60
|
-
test('CLI version comes from package.json and the matrix schema file exists', () => {
|
|
61
|
-
const version = JSON.parse(readFileSync(join(PACKAGE_ROOT, 'package.json'), 'utf8')).version;
|
|
62
|
-
const result = spawnSync(process.execPath, [CLI, '--version'], { encoding: 'utf8' });
|
|
63
|
-
assert.equal(result.status, 0);
|
|
64
|
-
assert.equal(result.stdout.trim(), version);
|
|
65
|
-
const matrix = JSON.parse(readFileSync(join(PACKAGE_ROOT, 'src/matrix/agents.json'), 'utf8'));
|
|
66
|
-
assert.equal(matrix.$schema, './agents.schema.json');
|
|
67
|
-
assert.equal(existsSync(join(PACKAGE_ROOT, 'src/matrix/agents.schema.json')), true);
|
|
68
|
-
});
|
|
69
|
-
test('baseline calibration plans use the matrix transcript CLI without starting it', t => {
|
|
70
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-calibrate-wire-'));
|
|
71
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
72
|
-
const result = spawnSync(process.execPath, [CLI, ...COMMANDS[1], '--agent', 'codex', '--input', 'workspace', '--trials', '2', '--max-calls', '10', '--dry-run'], { cwd, encoding: 'utf8', timeout: 30_000 });
|
|
73
|
-
assert.equal(result.status, 0, result.stderr);
|
|
74
|
-
assert.match(result.stdout, /calibration executor: codex: codex exec --json/);
|
|
75
|
-
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
76
|
-
});
|
|
77
|
-
test('CLI wires the previous Skill into an installed dry-run and rejects single-arm comparison', t => {
|
|
78
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-revision-'));
|
|
79
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
80
|
-
const current = join(cwd, 'new');
|
|
81
|
-
const previous = join(cwd, 'old');
|
|
82
|
-
for (const dir of [current, previous])
|
|
83
|
-
cpSync(join(PACKAGE_ROOT, 'skills', 'skillfit'), dir, { recursive: true });
|
|
84
|
-
writeFileSync(join(previous, 'SKILL.md'), readFileSync(join(previous, 'SKILL.md'), 'utf8') + '\nPrevious-version fixture.\n');
|
|
85
|
-
const args = ['eval', current, '--baseline-skill', previous, '--bench', join(PACKAGE_ROOT, 'benches', 'code-review'), '--agent', 'codex', '--trials', '1', '--dry-run'];
|
|
86
|
-
const result = spawnSync(process.execPath, [CLI, ...args, '--mode', 'installed'], { cwd, encoding: 'utf8', timeout: 30_000 });
|
|
87
|
-
assert.equal(result.status, 0, result.stderr);
|
|
88
|
-
assert.match(result.stdout, /Baseline\s+: skillfit/);
|
|
89
|
-
assert.match(result.stdout, /previous Skill in baseline vs target Skill in treatment/);
|
|
90
|
-
assert.match(result.stdout, /installed in both conditions/);
|
|
91
|
-
const invalid = spawnSync(process.execPath, [CLI, ...args, '--mode', 'trigger'], { cwd, encoding: 'utf8', timeout: 30_000 });
|
|
92
|
-
assert.equal(invalid.status, 1);
|
|
93
|
-
assert.match(invalid.stderr, /requires --mode installed/);
|
|
94
|
-
const unrelated = spawnSync(process.execPath, [CLI, 'doctor', '--baseline-skill', previous], { cwd, encoding: 'utf8' });
|
|
95
|
-
assert.equal(unrelated.status, 1);
|
|
96
|
-
assert.match(unrelated.stderr, /applies only to eval/);
|
|
97
|
-
assert.equal(unrelated.stdout, '');
|
|
98
|
-
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
99
|
-
});
|
|
100
|
-
test('ordinary JSON/human and Agent request previews expose the same effective installed no-Skill plan', t => {
|
|
101
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-shared-plan-'));
|
|
102
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
103
|
-
const skill = join(cwd, 'candidate');
|
|
104
|
-
cpSync(join(PACKAGE_ROOT, 'skills/skillfit'), skill, { recursive: true });
|
|
105
|
-
const bench = join(PACKAGE_ROOT, 'benches/code-review'), task = JSON.parse(readFileSync(join(bench, 'bench.json'), 'utf8')).tasks[0].id;
|
|
106
|
-
const limits = { input: 1000, cachedInput: 1000, uncachedInput: 1000, output: 1000, durationSeconds: 1000 };
|
|
107
|
-
const budget = join(cwd, 'budget.json'), request = join(cwd, 'request.json');
|
|
108
|
-
writeFileSync(budget, JSON.stringify(limits));
|
|
109
|
-
writeFileSync(request, JSON.stringify({ schemaVersion: 1, baselineSkill: null, candidateSkill: skill, bench, taskIds: [task], agent: 'codex',
|
|
110
|
-
purpose: 'development', trials: 1, maxCalls: 2, pairOrder: 'balanced', executorTimeoutSeconds: 17, spendingBudget: limits,
|
|
111
|
-
runsRoot: join(cwd, 'runs'), runGroup: 'shared' }));
|
|
112
|
-
const args = ['eval', skill, '--mode', 'installed', '--bench', bench, '--task', task, '--agent', 'codex', '--trials', '1', '--max-calls', '2',
|
|
113
|
-
'--pair-order', 'balanced', '--executor-timeout-seconds', '17', '--spending-budget', budget, '--runs-root', join(cwd, 'runs'), '--run-group', 'shared', '--dry-run'];
|
|
114
|
-
const env = { ...process.env, SKILLFIT_JUDGE: '0' };
|
|
115
|
-
const ordinary = spawnSync(process.execPath, [CLI, ...args, '--json'], { cwd, env, encoding: 'utf8', timeout: 30_000 });
|
|
116
|
-
const agent = spawnSync(process.execPath, [CLI, 'eval', '--request', request, '--dry-run'], { cwd, env, encoding: 'utf8', timeout: 30_000 });
|
|
117
|
-
const human = spawnSync(process.execPath, [CLI, ...args], { cwd, env, encoding: 'utf8', timeout: 30_000 });
|
|
118
|
-
for (const result of [ordinary, agent, human])
|
|
119
|
-
assert.equal(result.status, 0, result.stderr);
|
|
120
|
-
const plan = JSON.parse(ordinary.stdout).plan, agentPlan = JSON.parse(agent.stdout).plan;
|
|
121
|
-
assert.deepEqual(plan.evaluation, agentPlan.evaluation);
|
|
122
|
-
assert.equal(plan.evaluation.baseline, null);
|
|
123
|
-
assert.deepEqual(plan.evaluation.spendingBudget, limits);
|
|
124
|
-
assert.equal(plan.evaluation.executorTimeoutSeconds, 17);
|
|
125
|
-
assert.equal(agentPlan.request.baselineSkill, null);
|
|
126
|
-
assert.match(human.stdout, /no Skill installed by the harness/);
|
|
127
|
-
assert.ok(human.stdout.includes(plan.sha256));
|
|
128
|
-
assert.match(human.stdout, /Agent deadline: 17s/);
|
|
129
|
-
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
130
|
-
for (const override of [['--executor-timeout-seconds', '18'], ['--spending-budget', budget], ['--run-group', 'other']]) {
|
|
131
|
-
const bad = spawnSync(process.execPath, [CLI, 'eval', '--request', request, '--dry-run', ...override], { cwd, env, encoding: 'utf8' });
|
|
132
|
-
assert.equal(bad.status, 2);
|
|
133
|
-
assert.match(JSON.parse(bad.stdout).error.message, /cannot be combined/);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
test('positional JSON eval rejects unconfirmed execution and invalid new controls without writes or calls', t => {
|
|
137
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-new-controls-'));
|
|
138
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
139
|
-
// No target or executor is supplied: even a broken guard cannot dispatch a real model.
|
|
140
|
-
for (const args of [['eval', '--json'], ['eval', '--json', '--plan-sha', 'a'.repeat(64)]]) {
|
|
141
|
-
const result = spawnSync(process.execPath, [CLI, ...args], { cwd, encoding: 'utf8' });
|
|
142
|
-
assert.equal(result.status, 2);
|
|
143
|
-
const error = JSON.parse(result.stdout);
|
|
144
|
-
assert.equal(error.kind, 'skillfit.eval-error');
|
|
145
|
-
assert.match(error.error.message, /plan-sha|run-group/);
|
|
146
|
-
assert.equal(error.acceptance.eligibleForUpgrade, false);
|
|
147
|
-
}
|
|
148
|
-
for (const value of ['0', '3601', '1.5', 'NaN', '2junk']) {
|
|
149
|
-
const result = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--agent', 'codex', '--dry-run', '--json', '--executor-timeout-seconds', value], { cwd, encoding: 'utf8' });
|
|
150
|
-
assert.equal(result.status, 2);
|
|
151
|
-
assert.match(JSON.parse(result.stdout).error.message, /executorTimeoutSeconds/);
|
|
152
|
-
}
|
|
153
|
-
const file = join(cwd, 'budget.json');
|
|
154
|
-
writeFileSync(file, JSON.stringify({ input: 10 }));
|
|
155
|
-
const invalid = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json', '--spending-budget', file], { cwd, encoding: 'utf8' });
|
|
156
|
-
assert.equal(invalid.status, 2);
|
|
157
|
-
assert.match(JSON.parse(invalid.stdout).error.message, /spendingBudget/);
|
|
158
|
-
const unrelated = spawnSync(process.execPath, [CLI, 'doctor', '--executor-timeout-seconds', '17'], { cwd, encoding: 'utf8' });
|
|
159
|
-
assert.equal(unrelated.status, 1);
|
|
160
|
-
assert.match(unrelated.stderr, /apply only to eval/);
|
|
161
|
-
for (const args of [['eval'], [...COMMANDS[0], '--mode', 'invalid'], [...COMMANDS[0], '--runs-root', '']]) {
|
|
162
|
-
const invalid = spawnSync(process.execPath, [CLI, ...args, '--json', '--dry-run'], { cwd, encoding: 'utf8' });
|
|
163
|
-
assert.equal(invalid.status, 2);
|
|
164
|
-
assert.equal(JSON.parse(invalid.stdout).kind, 'skillfit.eval-error');
|
|
165
|
-
}
|
|
166
|
-
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
167
|
-
});
|
|
168
|
-
test('API, trigger and judged paired previews bind deadlines and budgets without starting executors', t => {
|
|
169
|
-
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-api-plan-'));
|
|
170
|
-
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
171
|
-
const env = { ...process.env, SKILLFIT_API_KEY: 'synthetic-dry-run-only', SKILLFIT_API_BASE_URL: 'https://offline.invalid/v1', SKILLFIT_JUDGE: '0' };
|
|
172
|
-
const api = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json', '--executor-timeout-seconds', '9'], { cwd, env, encoding: 'utf8' });
|
|
173
|
-
assert.equal(api.status, 0, api.stderr);
|
|
174
|
-
const plan = JSON.parse(api.stdout).plan.evaluation;
|
|
175
|
-
assert.equal(plan.executor.kind, 'api');
|
|
176
|
-
assert.equal(plan.executorTimeoutSeconds, 9);
|
|
177
|
-
const defaults = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json'], { cwd, env, encoding: 'utf8' });
|
|
178
|
-
assert.equal(defaults.status, 0, defaults.stderr);
|
|
179
|
-
assert.equal(JSON.parse(defaults.stdout).plan.evaluation.executorTimeoutSeconds, 120);
|
|
180
|
-
const trigger = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--agent', 'codex', '--mode', 'trigger', '--dry-run', '--json'], { cwd, env, encoding: 'utf8' });
|
|
181
|
-
assert.equal(trigger.status, 0, trigger.stderr);
|
|
182
|
-
assert.equal(JSON.parse(trigger.stdout).plan.evaluation.mode, 'trigger');
|
|
183
|
-
const file = join(cwd, 'budget.json');
|
|
184
|
-
writeFileSync(file, JSON.stringify({ input: 100, cachedInput: 100, uncachedInput: 100, output: 100, durationSeconds: 100 }));
|
|
185
|
-
for (const flags of [['--mode', 'trigger', '--agent', 'codex'], ['--judge-agent', 'codex', '--agent', 'codex']]) {
|
|
186
|
-
const result = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json', '--spending-budget', file, ...flags], { cwd, env, encoding: 'utf8' });
|
|
187
|
-
assert.equal(result.status, 0, result.stderr);
|
|
188
|
-
const preview = JSON.parse(result.stdout).plan.evaluation;
|
|
189
|
-
assert.deepEqual(preview.spendingBudget, JSON.parse(readFileSync(file, 'utf8')));
|
|
190
|
-
assert.equal(preview.plannedCalls, flags[0] === '--mode' ? 25 : 100);
|
|
191
|
-
}
|
|
192
|
-
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
193
|
-
});
|