skillfit 0.15.3 → 0.16.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/CHANGELOG.md +46 -0
- package/README.md +33 -25
- package/README.zh-CN.md +33 -25
- package/benches/code-review/ground-truth/r1.md +3 -3
- package/benches/code-review/verifiers/seeded-bugs.mjs +25 -10
- package/dist/agents/adapters/cli.js +4 -2
- package/dist/agents/mcp-probe.js +138 -13
- package/dist/bench/authoring.js +111 -3
- package/dist/cli/definition.js +31 -10
- package/dist/cli/doctor.js +33 -14
- package/dist/cli/eval-report.js +1 -1
- package/dist/cli/main.js +112 -6
- package/dist/cli/mcp.js +23 -7
- package/dist/cli/report.js +4 -1
- package/dist/composition.js +20 -0
- package/dist/configuration/bundle.js +150 -47
- package/dist/configuration/install.js +109 -23
- package/dist/configuration/lock.js +28 -0
- package/dist/configuration/mcp-write.js +311 -0
- package/dist/configuration/uninstall.js +241 -0
- package/dist/configuration/upstream.js +3 -0
- package/dist/evaluation/application/preparation.js +150 -0
- package/dist/evaluation/records/audit.js +3 -2
- package/dist/evaluation/records/session.js +16 -8
- package/docs/README.md +7 -7
- package/docs/guides/experiment-workflow.md +25 -0
- package/docs/guides/selectable-codex.md +35 -4
- package/docs/maintainers/architecture.md +1 -1
- package/docs/reference/eval-component.md +41 -2
- package/docs/reference/evaluation-reports.md +3 -1
- package/docs/schemas/doctor-report.schema.json +92 -0
- package/package.json +1 -1
- package/skills/skillfit/SKILL.md +33 -15
package/dist/bench/authoring.js
CHANGED
|
@@ -608,12 +608,20 @@ function gitRun(repo, args) {
|
|
|
608
608
|
encoding: "utf8",
|
|
609
609
|
maxBuffer: 64 * 1024 * 1024,
|
|
610
610
|
});
|
|
611
|
-
return {
|
|
611
|
+
return { ...result, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
612
612
|
}
|
|
613
613
|
function gitMust(repo, args) {
|
|
614
614
|
const result = gitRun(repo, args);
|
|
615
615
|
if (result.status !== 0) {
|
|
616
|
-
|
|
616
|
+
const details = [
|
|
617
|
+
result.stderr.trim(),
|
|
618
|
+
`exit ${result.status}`,
|
|
619
|
+
result.error ? String(result.error) : "",
|
|
620
|
+
result.signal ? `signal ${result.signal}` : "",
|
|
621
|
+
]
|
|
622
|
+
.filter(Boolean)
|
|
623
|
+
.join(", ");
|
|
624
|
+
throw new Error(`git ${args.join(" ")} failed in ${repo}: ${details}`);
|
|
617
625
|
}
|
|
618
626
|
return result.stdout;
|
|
619
627
|
}
|
|
@@ -669,7 +677,7 @@ if (result.error) {
|
|
|
669
677
|
process.exit(result.status ?? 1);
|
|
670
678
|
`;
|
|
671
679
|
}
|
|
672
|
-
function prepareFromCommit(options, cwd, preparedAt) {
|
|
680
|
+
function prepareFromCommit(options, cwd, preparedAt, reference = false) {
|
|
673
681
|
const issuePrompt = options.prompt ??
|
|
674
682
|
(options.promptFile !== undefined
|
|
675
683
|
? readFileSync(resolve(cwd, options.promptFile), "utf8")
|
|
@@ -743,6 +751,16 @@ function prepareFromCommit(options, cwd, preparedAt) {
|
|
|
743
751
|
content: gitShow(repo, sha, entry.path),
|
|
744
752
|
}));
|
|
745
753
|
const verifierCmd = options.verifierCmd ?? "node --test";
|
|
754
|
+
const referenceFiles = reference
|
|
755
|
+
? nonTests.map((entry) => {
|
|
756
|
+
if (isAbsolute(entry.path) || entry.path.split(/[\\/]/).includes(".."))
|
|
757
|
+
throw new Error(`Invalid reference path: ${entry.path}`);
|
|
758
|
+
return {
|
|
759
|
+
path: entry.path,
|
|
760
|
+
content: entry.status === "D" ? null : gitShow(repo, sha, entry.path).toString("base64"),
|
|
761
|
+
};
|
|
762
|
+
})
|
|
763
|
+
: [];
|
|
746
764
|
return {
|
|
747
765
|
defaultTaskId: `fix-${shortSha}`,
|
|
748
766
|
promptText: issuePrompt ??
|
|
@@ -760,6 +778,20 @@ ${subject}${body !== "" ? `\n\n${body}` : ""}
|
|
|
760
778
|
- Hidden grading runs the project's tests afterward — make the behavior correct, not merely plausible.`,
|
|
761
779
|
verifierSource: verifierForMinedTests(tests, verifierCmd),
|
|
762
780
|
verifierKind: "command",
|
|
781
|
+
...(reference
|
|
782
|
+
? {
|
|
783
|
+
oracleSource: `import { mkdirSync, writeFileSync, rmSync } from 'node:fs';
|
|
784
|
+
import { join, dirname } from 'node:path';
|
|
785
|
+
const root = process.argv[2];
|
|
786
|
+
if (!root) throw new Error('Missing run directory');
|
|
787
|
+
for (const file of ${JSON.stringify(referenceFiles)}) {
|
|
788
|
+
const target = join(root, file.path);
|
|
789
|
+
if (file.content === null) rmSync(target, {force: true});
|
|
790
|
+
else { mkdirSync(dirname(target), {recursive: true}); writeFileSync(target, Buffer.from(file.content, 'base64')); }
|
|
791
|
+
}
|
|
792
|
+
`,
|
|
793
|
+
}
|
|
794
|
+
: {}),
|
|
763
795
|
fixtureFiles,
|
|
764
796
|
groundTruth: `# Ground truth — fix-${shortSha}
|
|
765
797
|
|
|
@@ -924,6 +956,82 @@ function prepareManagement(options) {
|
|
|
924
956
|
},
|
|
925
957
|
});
|
|
926
958
|
}
|
|
959
|
+
/** Mine a complete, fresh bench without writing a teaching task or invoking a drafter. */
|
|
960
|
+
export function prepareCommitBench(options) {
|
|
961
|
+
if (!options.fromCommit || !options.promptFile)
|
|
962
|
+
throw new Error("Commit preparation requires --from-commit and an issue-style --prompt-file.");
|
|
963
|
+
const cwd = options.cwd ?? process.cwd(), dir = resolve(cwd, options.dir), at = new Date();
|
|
964
|
+
const capture = () => prepareFromCommit(options, cwd, at, true);
|
|
965
|
+
const source = capture(), fingerprint = sha256Text(JSON.stringify(source));
|
|
966
|
+
const files = taskFilePaths(source.defaultTaskId);
|
|
967
|
+
const writes = source.fixtureFiles.map((file) => ({
|
|
968
|
+
target: join(dir, files.fixture, file.rel),
|
|
969
|
+
content: file.content,
|
|
970
|
+
}));
|
|
971
|
+
for (const [rel, content] of Object.entries({
|
|
972
|
+
[files.prompt]: source.promptText,
|
|
973
|
+
[files.promptTrigger]: source.promptText,
|
|
974
|
+
[files.verifier]: source.verifierSource,
|
|
975
|
+
[files.oracle]: source.oracleSource,
|
|
976
|
+
[files.rubric]: source.groundTruth.replace("TODO: summarize the correct fix here so future bench edits stay honest.", "The reference oracle applies the fix commit's non-test file changes; the verifier supplies the commit's tests."),
|
|
977
|
+
"bench.json": JSON.stringify({
|
|
978
|
+
schemaVersion: 1,
|
|
979
|
+
name: basename(dir),
|
|
980
|
+
tasks: [
|
|
981
|
+
{
|
|
982
|
+
id: source.defaultTaskId,
|
|
983
|
+
fixture: files.fixture,
|
|
984
|
+
prompt: files.prompt,
|
|
985
|
+
promptTrigger: files.promptTrigger,
|
|
986
|
+
verifier: `node ${files.verifier}`,
|
|
987
|
+
verifierKind: "command",
|
|
988
|
+
oracle: `node ${files.oracle}`,
|
|
989
|
+
rubric: files.rubric,
|
|
990
|
+
},
|
|
991
|
+
],
|
|
992
|
+
}, null, 2) + "\n",
|
|
993
|
+
}))
|
|
994
|
+
writes.push({ target: join(dir, rel), content });
|
|
995
|
+
const assertCurrent = () => {
|
|
996
|
+
try {
|
|
997
|
+
lstatSync(dir);
|
|
998
|
+
throw new Error(`Target directory already exists: ${dir}`);
|
|
999
|
+
}
|
|
1000
|
+
catch (error) {
|
|
1001
|
+
if (error.code !== "ENOENT")
|
|
1002
|
+
throw error;
|
|
1003
|
+
}
|
|
1004
|
+
if (sha256Text(JSON.stringify(capture())) !== fingerprint)
|
|
1005
|
+
throw new Error("Commit source changed; prepare a fresh plan.");
|
|
1006
|
+
};
|
|
1007
|
+
assertCurrent();
|
|
1008
|
+
return prepared({
|
|
1009
|
+
operation: "init",
|
|
1010
|
+
dir,
|
|
1011
|
+
writes,
|
|
1012
|
+
sourceSha256: fingerprint,
|
|
1013
|
+
targetSha256: sha256Text(JSON.stringify(writes)),
|
|
1014
|
+
lines: { before: [], preview: [], after: [] },
|
|
1015
|
+
confirmation: `Create commit-derived bench in ${dir}? [y/N] `,
|
|
1016
|
+
draft: false,
|
|
1017
|
+
result: { dir },
|
|
1018
|
+
assertCurrent,
|
|
1019
|
+
}, {
|
|
1020
|
+
apply: () => {
|
|
1021
|
+
assertCurrent();
|
|
1022
|
+
mkdirSync(dirname(dir), { recursive: true });
|
|
1023
|
+
mkdirSync(dir);
|
|
1024
|
+
try {
|
|
1025
|
+
applyBenchWrites(dir, writes);
|
|
1026
|
+
return { dir };
|
|
1027
|
+
}
|
|
1028
|
+
catch (error) {
|
|
1029
|
+
rmSync(dir, { recursive: true, force: true });
|
|
1030
|
+
throw error;
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
927
1035
|
export function prepareBenchChange(request, dependencies = {}) {
|
|
928
1036
|
if (request.operation === "init")
|
|
929
1037
|
return prepareInit({ ...request.options }, dependencies);
|
package/dist/cli/definition.js
CHANGED
|
@@ -3,13 +3,14 @@ import { DEFAULT_EVAL_TRIALS } from "./eval.js";
|
|
|
3
3
|
// Help and parseArgs declarations share this CLI-owned source.
|
|
4
4
|
const TITLE = `skillfit ${VERSION} — evidence-driven configuration for AI coding agents`;
|
|
5
5
|
const option = (text) => text;
|
|
6
|
-
const agent = option(" --agent <id> Target agent: claude-code | codex | kimi-code (default:
|
|
6
|
+
const agent = option(" --agent <id> Target/source agent: claude-code | codex | kimi-code (default: detected; bundle: codex)");
|
|
7
7
|
const judgeAgent = option(" --judge-agent <id> Drive a paired eval's blind judge (prefer a different family than --agent)");
|
|
8
8
|
const mode = option(" --mode <mode> Eval mode: inject (default) | installed (paired complete Skill) | trigger (single arm)");
|
|
9
9
|
const baselineSkill = option(" --baseline-skill <path> With --mode installed, compare a previous Skill version against the target");
|
|
10
10
|
const request = option(" --request <path> Version 1 Skill revision request (JSON output; excludes positional eval options)");
|
|
11
|
+
const prepare = option(" --prepare <dir> Prepare a fresh revision workspace; requires --baseline-skill, --from-commit, --source-dir, --prompt-file and --agent (no model calls)");
|
|
11
12
|
const planSha = option(" --plan-sha <hash> Confirm an eval/calibration/self-test dry-run plan (also needs --run-group)");
|
|
12
|
-
const json = option(" --json Machine output for bench check/self-test/list/show/edit/remove, report, eval and calibration");
|
|
13
|
+
const json = option(" --json Machine output for doctor, bench check/self-test/list/show/edit/remove, report, eval and calibration");
|
|
13
14
|
const spendingBudget = option(" --spending-budget <file> Eval/calibration/drafting: input, cachedInput, uncachedInput, output, durationSeconds stop lines");
|
|
14
15
|
const executorTimeout = option(" --executor-timeout-seconds <n|none> Eval/calibration/drafting: executor deadline (integer 1–3600; none requires Token-only budget)");
|
|
15
16
|
const pairOrder = option(" --pair-order <order> Paired eval: baseline-first (default) | balanced");
|
|
@@ -28,16 +29,22 @@ const trials = option(` --trials <n> Repetitions per condition for eval
|
|
|
28
29
|
const maxCalls = option(" --max-calls <n> Call ceiling for eval / bench check --calibrate / bench add --decompose\n Also controls baseline calibration repetitions");
|
|
29
30
|
const profile = option(' --profile <name> Profile for install (default: "recommended")');
|
|
30
31
|
const profilePath = option(" --profile-path <dir> Install a portable profile from a local directory");
|
|
31
|
-
const skill = option(" --skill <name> With
|
|
32
|
+
const skill = option(" --skill <name> With uninstall, select a managed Skill (repeatable)\n With bundle export/setup codex, include or select a Skill (repeatable)");
|
|
33
|
+
const server = option(" --server <name> With mcp check, select a named server from the Agent configuration");
|
|
34
|
+
const from = option(" --from <path> With mcp apply, read a validated probe spec without starting the server");
|
|
35
|
+
const remove = option(" --remove With mcp apply, remove the selected managed MCP entry");
|
|
32
36
|
const all = option(" --all With setup codex, select all catalog Skills (not an efficacy recommendation)");
|
|
33
37
|
const starter = option(" --starter With setup codex, select the legacy 13-Skill set (not evaluated as a set)");
|
|
34
38
|
const list = option(" --list With setup codex, list choices without downloading");
|
|
35
39
|
const noRules = option(" --no-rules With setup codex, skip the global AGENTS.md block");
|
|
40
|
+
const rules = option(" --rules With uninstall, remove the managed AGENTS.md rules block");
|
|
41
|
+
const allowSymlinkRoot = option(" --allow-symlink-root <dir> With bundle export, approve a specific Skill symlink source root (repeatable)");
|
|
42
|
+
const mcpExport = option(" --mcp <name> With bundle export, include a credential-free JSON MCP declaration (repeatable)");
|
|
36
43
|
const minSessions = option(" --min-sessions <n> With bundle export, default selection needs this many sessions (default: 2)");
|
|
37
44
|
const upstreamLock = option(" --upstream-lock <path> With bundle export, fetch listed GitHub Skills at pinned commits during setup");
|
|
38
|
-
const project = option(" --project
|
|
45
|
+
const project = option(" --project With install/uninstall/mcp selection, use current-project instead of user-level config");
|
|
39
46
|
const dryRun = option(" --dry-run Print the plan without writing anything");
|
|
40
|
-
const strict = option(" --strict With install --dry-run,
|
|
47
|
+
const strict = option(" --strict With doctor, exit 1 on FAIL findings; with install --dry-run, fail on conflicts");
|
|
41
48
|
const yes = option(" --yes Non-interactive mode (CI-friendly)");
|
|
42
49
|
const help = option(" --help, -h Show help");
|
|
43
50
|
const versionFlag = option(" --version, -v Show version");
|
|
@@ -49,14 +56,17 @@ function page(usage, options, extra = "") {
|
|
|
49
56
|
export const USAGE = `${TITLE}
|
|
50
57
|
|
|
51
58
|
Usage:
|
|
52
|
-
skillfit doctor [--agent <id>]
|
|
59
|
+
skillfit doctor [--agent <id>] [--json] [--strict] Inspect current agent configuration health
|
|
53
60
|
skillfit report [--agent <id>] [--json] Skill usage receipts from local session history (read-only)
|
|
54
61
|
skillfit eval <target-path> [options] A/B-test a Skill, rules, or MCP setup against a bench
|
|
55
62
|
skillfit mcp check <spec.json> Handshake with a stdio or Streamable HTTP MCP server and audit its tool catalog
|
|
63
|
+
skillfit mcp check --agent <id> --server <name> [--project] [--dry-run] Select a server from existing Agent configuration
|
|
64
|
+
skillfit mcp apply --agent <id> --server <name> (--from <probe.json> | --remove) [--project] [--dry-run] [--yes] Apply one managed JSON MCP entry without contacting it
|
|
56
65
|
skillfit bench <subcommand> [options] Scaffold, inspect, edit and validate tasks
|
|
57
66
|
skillfit install [options] Inspect or apply a managed configuration profile
|
|
67
|
+
skillfit uninstall [options] Remove selected managed Skills or AGENTS.md rules
|
|
58
68
|
skillfit setup codex [options] Select verified upstream Skills and global Codex guidance
|
|
59
|
-
skillfit bundle export <dir> [options] Export
|
|
69
|
+
skillfit bundle export <dir> [options] Export Codex/Kimi rules, Skills and safe MCP declarations
|
|
60
70
|
|
|
61
71
|
Run skillfit <command> --help for that command's options.
|
|
62
72
|
${common}
|
|
@@ -64,7 +74,7 @@ ${common}
|
|
|
64
74
|
Docs: https://github.com/remote-controlled-man/skillfit
|
|
65
75
|
`;
|
|
66
76
|
const COMMAND_HELP = {
|
|
67
|
-
doctor: page(" skillfit doctor [--agent <id>]
|
|
77
|
+
doctor: page(" skillfit doctor [--agent <id>] [--json] [--strict] Inspect current agent configuration health", [agent, json, strict].join("\n")),
|
|
68
78
|
report: page(` skillfit report [--agent <id>] [--json] Skill usage receipts from local session history (read-only)
|
|
69
79
|
skillfit report eval <summary-or-run-dir> Read paired, calibration or trigger reports (read-only)
|
|
70
80
|
skillfit report eval <summary-or-run-dir> --json Return a typed saved-evidence report for an Agent
|
|
@@ -77,6 +87,7 @@ const COMMAND_HELP = {
|
|
|
77
87
|
mode,
|
|
78
88
|
baselineSkill,
|
|
79
89
|
request,
|
|
90
|
+
prepare,
|
|
80
91
|
planSha,
|
|
81
92
|
json,
|
|
82
93
|
spendingBudget,
|
|
@@ -93,7 +104,10 @@ const COMMAND_HELP = {
|
|
|
93
104
|
dryRun,
|
|
94
105
|
yes,
|
|
95
106
|
].join("\n")),
|
|
96
|
-
mcp: page(
|
|
107
|
+
mcp: page(` skillfit mcp check <spec.json> Handshake with a stdio or Streamable HTTP MCP server and audit its tool catalog
|
|
108
|
+
skillfit mcp check --agent <id> --server <name> [--project] [--dry-run] Select a server from existing Agent configuration
|
|
109
|
+
skillfit mcp apply --agent <id> --server <name> (--from <probe.json> | --remove) [--project] [--dry-run] [--yes] Apply one managed JSON MCP entry without contacting it`, [agent, server, project, from, remove, dryRun, yes].join("\n")),
|
|
110
|
+
uninstall: page(" skillfit uninstall --agent <id> (--skill <name> ... | --rules) [--project] [--dry-run] [--yes]", [agent, skill, rules, project, dryRun, yes].join("\n")),
|
|
97
111
|
bench: page(` skillfit bench init [dir] [--kind output|command] Scaffold a text-output or code-editing case
|
|
98
112
|
skillfit bench check [path-or-name] [--json] Validate a local/bundled bench offline
|
|
99
113
|
skillfit bench self-test <path-or-name> [--json] Check declared synthetic controls through the paired pipeline; zero model calls
|
|
@@ -158,7 +172,7 @@ bench add --from-commit options:
|
|
|
158
172
|
`),
|
|
159
173
|
install: page(" skillfit install [options] Inspect or apply a managed configuration profile", [agent, profile, profilePath, project, dryRun, strict, yes].join("\n")),
|
|
160
174
|
setup: page(" skillfit setup codex [options] Select verified upstream Skills and global Codex guidance", [skill, all, starter, list, noRules, dryRun, yes].join("\n")),
|
|
161
|
-
bundle: page(" skillfit bundle export <dir> [options] Export
|
|
175
|
+
bundle: page(" skillfit bundle export <dir> [options] Export Codex/Kimi rules, Skills and safe MCP declarations", [agent, skill, allowSymlinkRoot, mcpExport, minSessions, upstreamLock, dryRun, yes].join("\n")),
|
|
162
176
|
};
|
|
163
177
|
export function helpFor(command) {
|
|
164
178
|
return COMMAND_HELP[command];
|
|
@@ -174,6 +188,7 @@ export const CLI_OPTIONS = {
|
|
|
174
188
|
mode: { type: "string" },
|
|
175
189
|
"baseline-skill": { type: "string" },
|
|
176
190
|
request: { type: "string" },
|
|
191
|
+
prepare: { type: "string" },
|
|
177
192
|
"plan-sha": { type: "string" },
|
|
178
193
|
"spending-budget": { type: "string" },
|
|
179
194
|
"executor-timeout-seconds": { type: "string" },
|
|
@@ -191,6 +206,9 @@ export const CLI_OPTIONS = {
|
|
|
191
206
|
profile: { type: "string" },
|
|
192
207
|
"profile-path": { type: "string" },
|
|
193
208
|
skill: { type: "string", multiple: true },
|
|
209
|
+
"allow-symlink-root": { type: "string", multiple: true },
|
|
210
|
+
server: { type: "string" },
|
|
211
|
+
mcp: { type: "string", multiple: true },
|
|
194
212
|
all: { type: "boolean", default: false },
|
|
195
213
|
starter: { type: "boolean", default: false },
|
|
196
214
|
list: { type: "boolean", default: false },
|
|
@@ -206,6 +224,8 @@ export const CLI_OPTIONS = {
|
|
|
206
224
|
"prompt-file": { type: "string" },
|
|
207
225
|
freeze: { type: "boolean", default: false },
|
|
208
226
|
"from-commit": { type: "string" },
|
|
227
|
+
from: { type: "string" },
|
|
228
|
+
remove: { type: "boolean", default: false },
|
|
209
229
|
include: { type: "string", multiple: true },
|
|
210
230
|
"source-dir": { type: "string" },
|
|
211
231
|
"verifier-cmd": { type: "string" },
|
|
@@ -222,6 +242,7 @@ export const CLI_OPTIONS = {
|
|
|
222
242
|
json: { type: "boolean", default: false },
|
|
223
243
|
"dry-run": { type: "boolean", default: false },
|
|
224
244
|
project: { type: "boolean", default: false },
|
|
245
|
+
rules: { type: "boolean", default: false },
|
|
225
246
|
strict: { type: "boolean", default: false },
|
|
226
247
|
yes: { type: "boolean", default: false },
|
|
227
248
|
help: { type: "boolean", short: "h", default: false },
|
package/dist/cli/doctor.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { agentIds } from "../agents/matrix.js";
|
|
2
2
|
import { collectDoctorReport } from "../agents/health.js";
|
|
3
3
|
export { collectDoctorReport } from "../agents/health.js";
|
|
4
|
+
function summarizeDoctorReport(report) {
|
|
5
|
+
const checks = { total: 0, PASS: 0, WARN: 0, FAIL: 0, INFO: 0 };
|
|
6
|
+
for (const agent of report.health) {
|
|
7
|
+
for (const section of agent.sections) {
|
|
8
|
+
for (const item of section.checks) {
|
|
9
|
+
checks[item.status]++;
|
|
10
|
+
checks.total++;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
agents: {
|
|
16
|
+
detected: report.detection.filter((entry) => entry.detected).length,
|
|
17
|
+
total: report.detection.length,
|
|
18
|
+
},
|
|
19
|
+
checks,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
4
22
|
export function formatDoctorReport(report) {
|
|
5
23
|
const lines = [
|
|
6
24
|
"skillfit doctor — read-only configuration health report",
|
|
@@ -30,28 +48,29 @@ export function formatDoctorReport(report) {
|
|
|
30
48
|
}
|
|
31
49
|
}
|
|
32
50
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
for (const agent of report.health) {
|
|
36
|
-
for (const section of agent.sections) {
|
|
37
|
-
for (const item of section.checks) {
|
|
38
|
-
counts[item.status]++;
|
|
39
|
-
total++;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const detected = report.detection.filter((entry) => entry.detected).length;
|
|
44
|
-
lines.push("", "Summary", "=======", `${detected}/${report.detection.length} agents detected — ${total} checks: ${counts.PASS} PASS, ${counts.WARN} WARN, ${counts.FAIL} FAIL, ${counts.INFO} INFO`, "Findings are advisory: skillfit doctor is read-only and always exits 0.");
|
|
51
|
+
const summary = summarizeDoctorReport(report);
|
|
52
|
+
lines.push("", "Summary", "=======", `${summary.agents.detected}/${summary.agents.total} agents detected — ${summary.checks.total} checks: ${summary.checks.PASS} PASS, ${summary.checks.WARN} WARN, ${summary.checks.FAIL} FAIL, ${summary.checks.INFO} INFO`, "Findings are advisory by default; skillfit doctor is read-only. Use --strict to exit 1 on FAIL.");
|
|
45
53
|
return lines.join("\n");
|
|
46
54
|
}
|
|
55
|
+
export function formatDoctorReportJson(report) {
|
|
56
|
+
return JSON.stringify({
|
|
57
|
+
schemaVersion: 1,
|
|
58
|
+
kind: "skillfit.doctor-report",
|
|
59
|
+
...report,
|
|
60
|
+
summary: summarizeDoctorReport(report),
|
|
61
|
+
}, null, 2);
|
|
62
|
+
}
|
|
47
63
|
export async function runDoctor(args = {}) {
|
|
48
64
|
if (args.agent !== undefined && !agentIds().includes(args.agent)) {
|
|
49
65
|
console.error(`Unknown agent "${args.agent}". Known agents: ${agentIds().join(", ")}`);
|
|
50
|
-
// A usage error, not a finding. Findings are advisory
|
|
66
|
+
// A usage error, not a finding. Findings are advisory by default, but an unrecognised
|
|
51
67
|
// --agent means the health check never ran, and exiting 0 there lets CI read a typo as a clean
|
|
52
68
|
// bill of health. 2 is this CLI's usage-error code.
|
|
53
69
|
process.exitCode = 2;
|
|
54
70
|
return;
|
|
55
71
|
}
|
|
56
|
-
|
|
72
|
+
const report = collectDoctorReport({ agent: args.agent });
|
|
73
|
+
if (args.strict && summarizeDoctorReport(report).checks.FAIL > 0)
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
console.log(args.json ? formatDoctorReportJson(report) : formatDoctorReport(report));
|
|
57
76
|
}
|
package/dist/cli/eval-report.js
CHANGED
|
@@ -177,7 +177,7 @@ export function renderEvalMarkdown(report) {
|
|
|
177
177
|
lines.push("- None");
|
|
178
178
|
else
|
|
179
179
|
lines.push(...report.warnings.map((warning) => `- ${escapeMarkdown(warning)}`));
|
|
180
|
-
lines.push("", "The verdict follows [the skillfit metrics protocol](https://github.com/remote-controlled-man/skillfit/blob/main/docs/metrics.md). Review the pinned manifest before comparing runs.", "");
|
|
180
|
+
lines.push("", "The verdict follows [the skillfit metrics protocol](https://github.com/remote-controlled-man/skillfit/blob/main/docs/reference/metrics.md). Review the pinned manifest before comparing runs.", "");
|
|
181
181
|
return lines.join("\n");
|
|
182
182
|
}
|
|
183
183
|
export async function runEvalReport(inputPath, log = console.log, options = {}) {
|
package/dist/cli/main.js
CHANGED
|
@@ -17,10 +17,11 @@ import { parseSpendingBudget } from "../evaluation/execution/budget.js";
|
|
|
17
17
|
import { runEvalReport } from "./eval-report.js";
|
|
18
18
|
import { componentError, runEvalComponent } from "./eval-component.js";
|
|
19
19
|
import { readEvaluationReport } from "./evaluation-report.js";
|
|
20
|
-
import { runInstall } from "../composition.js";
|
|
20
|
+
import { runInstall, runMcpApply, runUninstall } from "../composition.js";
|
|
21
21
|
import { runMcpCheck } from "./mcp.js";
|
|
22
22
|
import { runReport } from "./report.js";
|
|
23
23
|
import { runCodexSetup } from "../composition.js";
|
|
24
|
+
import { prepareSkillRevision } from "../composition.js";
|
|
24
25
|
import { VERSION } from "../shared/version.js";
|
|
25
26
|
function jsonBenchCommand() {
|
|
26
27
|
const supported = ["check", "self-test", "list", "show", "edit", "remove"];
|
|
@@ -125,6 +126,64 @@ async function main() {
|
|
|
125
126
|
}
|
|
126
127
|
if (values.controls !== undefined || values.suite !== undefined)
|
|
127
128
|
throw new Error("--controls and --suite apply only to bench self-test.");
|
|
129
|
+
if (values.prepare !== undefined) {
|
|
130
|
+
if (values.json && !values["dry-run"] && !values.yes)
|
|
131
|
+
throw new Error("JSON preparation requires --yes; preview first with --dry-run.");
|
|
132
|
+
if (command !== "eval" || positionals.length !== 2)
|
|
133
|
+
throw new Error("--prepare requires eval <candidate-skill>.");
|
|
134
|
+
const allowed = new Set([
|
|
135
|
+
"prepare",
|
|
136
|
+
"baseline-skill",
|
|
137
|
+
"from-commit",
|
|
138
|
+
"source-dir",
|
|
139
|
+
"prompt-file",
|
|
140
|
+
"agent",
|
|
141
|
+
"include",
|
|
142
|
+
"verifier-cmd",
|
|
143
|
+
"spending-budget",
|
|
144
|
+
"executor-timeout-seconds",
|
|
145
|
+
"dry-run",
|
|
146
|
+
"yes",
|
|
147
|
+
"json",
|
|
148
|
+
]);
|
|
149
|
+
for (const [key, value] of Object.entries(values))
|
|
150
|
+
if (value !== undefined && value !== false && !allowed.has(key))
|
|
151
|
+
throw new Error(`--${key} is unsupported with --prepare; no evaluation started.`);
|
|
152
|
+
if (!values["baseline-skill"] ||
|
|
153
|
+
!values["from-commit"] ||
|
|
154
|
+
!values["source-dir"] ||
|
|
155
|
+
!values["prompt-file"] ||
|
|
156
|
+
!values.agent)
|
|
157
|
+
throw new Error("--prepare requires --baseline-skill, --from-commit, --source-dir, --prompt-file and --agent.");
|
|
158
|
+
const result = await prepareSkillRevision({
|
|
159
|
+
candidateSkill: positionals[1],
|
|
160
|
+
baselineSkill: values["baseline-skill"],
|
|
161
|
+
workspace: values.prepare,
|
|
162
|
+
sourceDir: values["source-dir"],
|
|
163
|
+
fromCommit: values["from-commit"],
|
|
164
|
+
promptFile: values["prompt-file"],
|
|
165
|
+
agent: values.agent,
|
|
166
|
+
include: values.include,
|
|
167
|
+
verifierCmd: values["verifier-cmd"],
|
|
168
|
+
dryRun: values["dry-run"],
|
|
169
|
+
yes: values.yes,
|
|
170
|
+
spendingBudget: values["spending-budget"] === undefined
|
|
171
|
+
? undefined
|
|
172
|
+
: parseSpendingBudget(readComponentJson(resolve(values["spending-budget"])).value),
|
|
173
|
+
executorTimeoutSeconds: executorTimeoutArgument(values["executor-timeout-seconds"]),
|
|
174
|
+
log: (line) => (values.json ? console.error(line) : console.log(line)),
|
|
175
|
+
});
|
|
176
|
+
if (values.json)
|
|
177
|
+
console.log(JSON.stringify(result, null, 2));
|
|
178
|
+
else {
|
|
179
|
+
console.log(`Revision workspace: ${result.status}; ${result.files.length} files; 0 model calls.\nRequest: ${result.requestPath}`);
|
|
180
|
+
for (const command of result.nextCommands)
|
|
181
|
+
console.log(` ${command}`);
|
|
182
|
+
}
|
|
183
|
+
if (result.status === "blocked")
|
|
184
|
+
process.exitCode = 2;
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
128
187
|
const calibrationCommand = command === "bench" && positionals[1] === "check" && values.calibrate;
|
|
129
188
|
if (values["baseline-skill"] !== undefined && command !== "eval") {
|
|
130
189
|
throw new Error("--baseline-skill applies only to eval --mode installed.");
|
|
@@ -219,7 +278,7 @@ async function main() {
|
|
|
219
278
|
}
|
|
220
279
|
switch (command) {
|
|
221
280
|
case "doctor":
|
|
222
|
-
await runDoctor(common);
|
|
281
|
+
await runDoctor({ ...common, json: values.json ?? false, strict: values.strict ?? false });
|
|
223
282
|
return;
|
|
224
283
|
case "report":
|
|
225
284
|
if (positionals[1] === "eval") {
|
|
@@ -347,12 +406,42 @@ async function main() {
|
|
|
347
406
|
return;
|
|
348
407
|
}
|
|
349
408
|
case "mcp": {
|
|
350
|
-
|
|
351
|
-
|
|
409
|
+
const specPath = positionals[2];
|
|
410
|
+
const server = values.server;
|
|
411
|
+
if (positionals[1] === "apply") {
|
|
412
|
+
if (!values.agent ||
|
|
413
|
+
!server ||
|
|
414
|
+
(!values.from && !values.remove) ||
|
|
415
|
+
(values.from !== undefined && values.remove)) {
|
|
416
|
+
console.error("Usage: skillfit mcp apply --agent <id> --server <name> (--from <probe.json> | --remove) [--project] [--dry-run] [--yes]");
|
|
417
|
+
process.exitCode = 2;
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
await runMcpApply({
|
|
421
|
+
...common,
|
|
422
|
+
agent: values.agent,
|
|
423
|
+
server,
|
|
424
|
+
from: values.from,
|
|
425
|
+
remove: values.remove ?? false,
|
|
426
|
+
project: values.project ?? false,
|
|
427
|
+
});
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (positionals[1] !== "check" ||
|
|
431
|
+
(specPath !== undefined && server !== undefined) ||
|
|
432
|
+
(specPath === undefined && (!values.agent || !server))) {
|
|
433
|
+
console.error("Usage: skillfit mcp check <spec.json> [--dry-run]\n" +
|
|
434
|
+
" skillfit mcp check --agent <id> --server <name> [--project] [--dry-run]");
|
|
352
435
|
process.exitCode = 2;
|
|
353
436
|
return;
|
|
354
437
|
}
|
|
355
|
-
await runMcpCheck({
|
|
438
|
+
await runMcpCheck({
|
|
439
|
+
specPath,
|
|
440
|
+
agent: values.agent,
|
|
441
|
+
server,
|
|
442
|
+
project: values.project ?? false,
|
|
443
|
+
dryRun: values["dry-run"] ?? false,
|
|
444
|
+
});
|
|
356
445
|
return;
|
|
357
446
|
}
|
|
358
447
|
case "install":
|
|
@@ -364,6 +453,20 @@ async function main() {
|
|
|
364
453
|
strict: values.strict ?? false,
|
|
365
454
|
});
|
|
366
455
|
return;
|
|
456
|
+
case "uninstall":
|
|
457
|
+
if (!values.agent || (!values.skill?.length && !values.rules)) {
|
|
458
|
+
console.error("Usage: skillfit uninstall --agent <id> (--skill <name> ... | --rules) [--project] [--dry-run] [--yes]");
|
|
459
|
+
process.exitCode = 2;
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
await runUninstall({
|
|
463
|
+
...common,
|
|
464
|
+
agent: values.agent,
|
|
465
|
+
skills: values.skill,
|
|
466
|
+
rules: values.rules ?? false,
|
|
467
|
+
project: values.project ?? false,
|
|
468
|
+
});
|
|
469
|
+
return;
|
|
367
470
|
case "setup":
|
|
368
471
|
if (positionals[1] !== "codex") {
|
|
369
472
|
console.error("Usage: skillfit setup codex [--list | --starter | --all | --skill <name> ...] [--no-rules] [--dry-run] [--yes]");
|
|
@@ -383,13 +486,16 @@ async function main() {
|
|
|
383
486
|
return;
|
|
384
487
|
case "bundle": {
|
|
385
488
|
if (positionals[1] !== "export" || !positionals[2]) {
|
|
386
|
-
console.error("Usage: skillfit bundle export <dir> [--skill <name> ...] [--upstream-lock <path>] [--min-sessions <n>] [--dry-run] [--yes]");
|
|
489
|
+
console.error("Usage: skillfit bundle export <dir> [--agent codex|kimi-code] [--skill <name> ...] [--allow-symlink-root <dir> ...] [--mcp <name> ...] [--upstream-lock <path>] [--min-sessions <n>] [--dry-run] [--yes]");
|
|
387
490
|
process.exitCode = 2;
|
|
388
491
|
return;
|
|
389
492
|
}
|
|
390
493
|
await runBundleExport({
|
|
391
494
|
outputDir: positionals[2],
|
|
495
|
+
agent: values.agent,
|
|
392
496
|
skillNames: values.skill,
|
|
497
|
+
allowedSkillLinkRoots: values["allow-symlink-root"],
|
|
498
|
+
mcpServerNames: values.mcp,
|
|
393
499
|
minSessions: values["min-sessions"] === undefined ? undefined : Number(values["min-sessions"]),
|
|
394
500
|
upstreamLockPath: values["upstream-lock"],
|
|
395
501
|
dryRun: values["dry-run"] ?? false,
|
package/dist/cli/mcp.js
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { loadMcpProbeSpec, probeMcp, renderMcpProbe, selectAgentMcpProbe, } from "../agents/mcp-probe.js";
|
|
2
3
|
export async function runMcpCheck(options) {
|
|
3
4
|
const log = options.log ?? ((message) => console.log(message));
|
|
4
|
-
|
|
5
|
+
if (options.specPath !== undefined && options.server !== undefined)
|
|
6
|
+
throw new Error("Choose either an MCP probe spec path or --server selection, not both.");
|
|
7
|
+
if (options.specPath === undefined && (!options.agent || !options.server))
|
|
8
|
+
throw new Error("Real-config MCP checks require both --agent and --server.");
|
|
9
|
+
const selected = options.specPath === undefined
|
|
10
|
+
? selectAgentMcpProbe({
|
|
11
|
+
agent: options.agent,
|
|
12
|
+
server: options.server,
|
|
13
|
+
project: options.project ?? false,
|
|
14
|
+
homeDir: options.homeDir ?? homedir(),
|
|
15
|
+
cwd: options.cwd ?? process.cwd(),
|
|
16
|
+
env: options.env ?? process.env,
|
|
17
|
+
})
|
|
18
|
+
: null;
|
|
19
|
+
const spec = selected?.spec ?? loadMcpProbeSpec(options.specPath);
|
|
5
20
|
if (options.dryRun) {
|
|
6
21
|
const target = spec.transport === "http"
|
|
7
22
|
? `Endpoint : ${new URL(spec.url).origin}${new URL(spec.url).pathname} (query withheld)`
|
|
8
23
|
: `Command : ${spec.command} (${spec.args.length} argument(s); values withheld)`;
|
|
9
|
-
|
|
24
|
+
const lines = [
|
|
10
25
|
"MCP check plan (dry run)",
|
|
11
26
|
`Server : ${spec.name}`,
|
|
12
27
|
`Transport: ${spec.transport}`,
|
|
13
28
|
target,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
];
|
|
30
|
+
if (selected)
|
|
31
|
+
lines.push(`Source : ${selected.sourcePath}`, `Scope : ${selected.scope}`);
|
|
32
|
+
lines.push("Checks : initialize handshake, capabilities, tools/list, unique names, descriptions, input schemas, annotations", "Tool calls: none", "Dry run — the server was not contacted.");
|
|
33
|
+
log(lines.join("\n"));
|
|
18
34
|
return null;
|
|
19
35
|
}
|
|
20
36
|
const result = await probeMcp(spec);
|
package/dist/cli/report.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAgent } from "../agents/matrix.js";
|
|
1
2
|
import { collectReceipts } from "../usage/receipts.js";
|
|
2
3
|
const OTHER_READS_SHOWN = 8;
|
|
3
4
|
function pad(text, width) {
|
|
@@ -19,6 +20,8 @@ function renderAgent(receipt, lines) {
|
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
22
|
lines.push(`${receipt.agentId} — ${receipt.sessionsFound} session(s), ${receipt.transcriptsRead} transcript(s)`);
|
|
23
|
+
const nativeSignal = getAgent(receipt.agentId).sessions?.skillToolName;
|
|
24
|
+
lines.push(` signal: ${nativeSignal ? `native ${nativeSignal} invocation events` : "registered SKILL.md read commands; not native Skill events"}`);
|
|
22
25
|
const installed = new Set(receipt.installed);
|
|
23
26
|
const installedFired = receipt.skills.filter((skill) => installed.has(skill.name));
|
|
24
27
|
const rows = installed.size === 0
|
|
@@ -84,7 +87,7 @@ export function renderReceipts(receipts) {
|
|
|
84
87
|
const never = [...installed].filter((name) => !firedNames.has(name)).sort();
|
|
85
88
|
lines.push(`Overall: ${installed.size} installed skill(s), ${fired.length} observed firing, ${never.length} with no observed fire in retained history.`);
|
|
86
89
|
if (never.length > 0) {
|
|
87
|
-
lines.push("Treat this as a prioritization signal, not proof of uselessness: install dates are unavailable.
|
|
90
|
+
lines.push("Treat this as a prioritization signal, not proof of uselessness: install dates are unavailable.", "Preview a bounded trigger check with: skillfit eval <skill> --mode trigger --dry-run. Trigger observations are not task-quality outcomes or evidence of benefit.");
|
|
88
91
|
}
|
|
89
92
|
return lines.join("\n");
|
|
90
93
|
}
|
package/dist/composition.js
CHANGED
|
@@ -8,8 +8,14 @@ import * as evaluation from "./evaluation/application/evaluation.js";
|
|
|
8
8
|
import { readEvaluation as read } from "./evaluation/application/read.js";
|
|
9
9
|
import { runBenchSelfTest as selfTest, } from "./evaluation/application/self-test.js";
|
|
10
10
|
import { runInstall as install } from "./configuration/install.js";
|
|
11
|
+
import { runUninstall as uninstall } from "./configuration/uninstall.js";
|
|
12
|
+
import { runMcpApply as mcpApply } from "./configuration/mcp-write.js";
|
|
11
13
|
import { runBundleExport as bundle } from "./configuration/bundle.js";
|
|
12
14
|
import { runCodexSetup as setup } from "./configuration/setup.js";
|
|
15
|
+
import { prepareSkillRevision as prepareRevision, } from "./evaluation/application/preparation.js";
|
|
16
|
+
export function prepareSkillRevision(options) {
|
|
17
|
+
return withEvaluationInterrupts(() => prepareRevision({ ...options, confirm: options.confirm ?? confirm }));
|
|
18
|
+
}
|
|
13
19
|
export function executeEvalPlan(...args) {
|
|
14
20
|
return withEvaluationInterrupts(() => evaluation.executeEvalPlan(...args));
|
|
15
21
|
}
|
|
@@ -37,6 +43,20 @@ export function runInstall(options) {
|
|
|
37
43
|
log: options.log ?? console.log,
|
|
38
44
|
});
|
|
39
45
|
}
|
|
46
|
+
export function runUninstall(options) {
|
|
47
|
+
return uninstall({
|
|
48
|
+
...options,
|
|
49
|
+
confirm: options.confirm ?? confirm,
|
|
50
|
+
log: options.log ?? console.log,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function runMcpApply(options) {
|
|
54
|
+
return mcpApply({
|
|
55
|
+
...options,
|
|
56
|
+
confirm: options.confirm ?? confirm,
|
|
57
|
+
log: options.log ?? console.log,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
40
60
|
export function runBundleExport(options) {
|
|
41
61
|
return bundle({
|
|
42
62
|
...options,
|