skillfit 0.9.1 → 0.10.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 +41 -15
- package/README.zh-CN.md +41 -15
- package/benches/README.md +23 -0
- package/benches/contrib/README.md +1 -0
- package/benches/contrib/oss-skill-independent/README.md +60 -0
- package/benches/contrib/oss-skill-independent/bench.json +79 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/Readme.md +1015 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/esm.mjs +15 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/index.js +27 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/argument.js +147 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/command.js +1944 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/error.js +45 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/help.js +396 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/option.js +208 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/suggestSimilar.js +100 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package.json +63 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.d.ts +774 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.test-d.ts +416 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/upstream-package.json +69 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/Readme.md +1149 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/esm.mjs +16 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/index.js +24 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/argument.js +149 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/command.js +2662 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/error.js +39 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/help.js +713 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/option.js +367 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/suggestSimilar.js +101 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package.json +71 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/esm.d.mts +3 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.d.ts +1045 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.test-d.ts +737 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/upstream-package.json +82 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.d.ts +40 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.js +68 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/package.json +54 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/readme.md +99 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/upstream-package.json +54 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/index.js +67 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/package.json +46 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.js +132 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/package.json +57 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/readme.md +181 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/upstream-package.json +58 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.js +116 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/package.json +60 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/readme.md +170 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/upstream-package.json +60 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.d.ts +149 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.js +93 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/package.json +52 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/readme.md +192 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/upstream-package.json +52 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.js +114 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/package.json +48 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/readme.md +158 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/upstream-package.json +48 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.js +122 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/package.json +50 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/readme.md +190 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/upstream-package.json +50 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/Readme.md +1015 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/esm.mjs +15 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/index.js +27 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/argument.js +147 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/command.js +1948 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/error.js +45 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/help.js +396 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/option.js +208 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/suggestSimilar.js +100 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package.json +63 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.d.ts +774 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.test-d.ts +416 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/upstream-package.json +69 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/Readme.md +1149 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/esm.mjs +16 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/index.js +24 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/argument.js +149 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/command.js +2666 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/error.js +39 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/help.js +713 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/option.js +367 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/suggestSimilar.js +101 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package.json +71 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/esm.d.mts +3 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.d.ts +1045 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.test-d.ts +737 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/upstream-package.json +82 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/async-hooks-stub.js +15 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.d.ts +40 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.js +71 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/package.json +61 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/readme.md +99 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/regression.test.mjs +6 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/upstream-package.json +54 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/index.js +67 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/package.json +46 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.js +148 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/package.json +57 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/readme.md +181 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/upstream-package.json +58 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-async-listener-order.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-output-isolation.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-async-context.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-map-iteration-rejection.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-throttle-sync-throw.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-custom-timers.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-infinity-abort.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-rejection-listener.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.js +121 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/package.json +60 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/readme.md +170 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/regression.test.mjs +6 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/upstream-package.json +60 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.d.ts +149 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.js +95 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/package.json +52 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/readme.md +192 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/upstream-package.json +52 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.js +114 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/package.json +48 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/readme.md +158 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/upstream-package.json +48 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.js +122 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/package.json +50 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/readme.md +190 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/upstream-package.json +50 -0
- package/benches/contrib/oss-skill-independent/prompts/commander-async-listener-order.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/commander-output-isolation.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/limit-async-context.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/limit-map-iteration-rejection.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/throttle-sync-throw.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/timeout-custom-timers.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/timeout-infinity-abort.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/timeout-rejection-listener.md +3 -0
- package/benches/contrib/oss-skill-independent/provenance.json +1903 -0
- package/benches/contrib/oss-skill-independent/task-specs.json +63 -0
- package/benches/contrib/oss-skill-independent/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/verifiers/cases.mjs +197 -0
- package/benches/contrib/oss-skill-independent/verifiers/commander-async-listener-order.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/commander-output-isolation.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/grade.mjs +48 -0
- package/benches/contrib/oss-skill-independent/verifiers/limit-async-context.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/limit-map-iteration-rejection.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/probe.mjs +16 -0
- package/benches/contrib/oss-skill-independent/verifiers/regression-evidence.mjs +105 -0
- package/benches/contrib/oss-skill-independent/verifiers/test-reporter.mjs +29 -0
- package/benches/contrib/oss-skill-independent/verifiers/throttle-sync-throw.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/timeout-custom-timers.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/timeout-infinity-abort.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/timeout-rejection-listener.mjs +1 -0
- package/dist/cli.js +166 -53
- package/dist/commands/bench-check-json.test.js +221 -0
- package/dist/commands/bench-check-report.js +48 -0
- package/dist/commands/bench-command-template.js +129 -0
- package/dist/commands/bench-manage.js +91 -0
- package/dist/commands/bench-manage.test.js +87 -0
- package/dist/commands/bench.js +68 -38
- package/dist/commands/bench.test.js +101 -0
- package/dist/commands/eval-component.js +17 -0
- package/dist/commands/eval-export.js +152 -0
- package/dist/commands/eval-export.test.js +122 -0
- package/dist/commands/eval.js +14 -3
- package/dist/commands/eval.test.js +58 -1
- package/dist/harness/bench.js +21 -2
- package/dist/harness/eval-audit.js +42 -4
- package/dist/harness/eval-budget.js +51 -0
- package/dist/harness/eval-budget.test.js +210 -0
- package/dist/harness/eval-component.test.js +36 -0
- package/dist/harness/eval-contract.js +5 -1
- package/dist/harness/replay-package.js +85 -0
- package/dist/harness/runner.js +22 -1
- package/docs/bench-authoring.md +40 -0
- package/docs/bench-check-json.md +115 -0
- package/docs/case-management.md +65 -0
- package/docs/eval-component.md +60 -49
- package/docs/examples/check-receiver-mechanism-proposal.mjs +124 -0
- package/docs/examples/prepare-native-diff-probe.mjs +75 -0
- package/docs/examples/reproduce-independent-comparison-budget.mjs +73 -0
- package/docs/first-real-eval.md +6 -0
- package/docs/growth-roadmap-2026-10.md +57 -93
- package/docs/metrics.md +21 -0
- package/docs/plans/2026-10-14-evidence-and-release-sequence.md +29 -12
- package/docs/plans/2026-10-15-independent-comparison-budget.json +1769 -0
- package/docs/plans/2026-10-15-independent-comparison-inputs.json +373 -0
- package/docs/plans/2026-10-15-independent-comparison-proposal.md +177 -0
- package/docs/plans/2026-10-15-native-diff-mechanism.md +105 -0
- package/docs/plans/2026-10-15-receiver-mechanism-proposal.json +342 -0
- package/docs/plans/2026-10-15-receiver-mechanism-proposal.md +146 -0
- package/docs/plans/2026-10-15-receiver-mechanism-verification.json +105 -0
- package/docs/plans/2026-10-16-case-workflow-and-release.md +30 -0
- package/docs/releases/0.10.0.md +45 -0
- package/docs/releases/0.9.1-first-publication.json +249 -0
- package/docs/releases/0.9.1-verification.json +122 -0
- package/docs/releases/0.9.1.md +33 -1
- package/docs/releases/trusted-publishing.md +61 -0
- package/docs/replay-packages.md +88 -0
- package/docs/schemas/bench-check.schema.json +109 -0
- package/docs/schemas/eval-request.schema.json +12 -0
- package/docs/sharing-results.md +6 -0
- package/docs/skill-evaluation-evidence.md +52 -0
- package/evidence/2026-10-15-diagnosing-receiver-correction.md +140 -0
- package/evidence/2026-10-15-independent-comparison-regression-stop.md +162 -0
- package/evidence/2026-10-15-independent-offline-readiness.md +144 -0
- package/evidence/2026-10-15-native-diff-mechanism.md +196 -0
- package/evidence/2026-10-15-receiver-mechanism-stop.md +154 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/README.md +35 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/expected.json +577 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/receiver-contract.test.mjs +138 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/replay.mjs +127 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/verification.json +105 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/README.md +32 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/checks.json +32 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/verification.json +25 -0
- package/evidence/artifacts/2026-10-15-independent-offline-readiness/README.md +17 -0
- package/evidence/artifacts/2026-10-15-independent-offline-readiness/verification.json +1548 -0
- package/evidence/artifacts/2026-10-15-native-diff-mechanism/README.md +48 -0
- package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/README.md +38 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/checks.json +118 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/verification.json +36 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/LICENSE +21 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/SKILL.md +51 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/agents/openai.yaml +3 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/scripts/hitl-loop.template.sh +44 -0
- package/package.json +1 -1
- package/skills/skillfit/SKILL.md +17 -5
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/** A dependency-free teaching case; users replace it with their own real task. */
|
|
2
|
+
export function commandTemplateFiles(benchName) {
|
|
3
|
+
const prompt = `# Repair the addition function
|
|
4
|
+
|
|
5
|
+
The repository in your current working directory exports \`add(a, b)\` from
|
|
6
|
+
\`index.js\`. It should return the sum of two numbers, including zero, negatives
|
|
7
|
+
and fractions, but currently subtracts them. Fix the implementation and run
|
|
8
|
+
\`node --test test.mjs\`. Keep \`package.json\` and \`test.mjs\` unchanged.
|
|
9
|
+
`;
|
|
10
|
+
return {
|
|
11
|
+
'bench.json': JSON.stringify({
|
|
12
|
+
schemaVersion: 1,
|
|
13
|
+
name: benchName,
|
|
14
|
+
description: 'Teaching case for file edits; replace with a real task from your work.',
|
|
15
|
+
tasks: [{
|
|
16
|
+
id: 'example-task',
|
|
17
|
+
fixture: 'fixtures/example-task',
|
|
18
|
+
prompt: 'prompts/example-task.md',
|
|
19
|
+
promptTrigger: 'prompts/example-task.trigger.md',
|
|
20
|
+
verifierKind: 'command',
|
|
21
|
+
verifier: 'node verifiers/example-task.mjs',
|
|
22
|
+
oracle: 'node ground-truth/oracle-example-task.mjs',
|
|
23
|
+
rubric: 'ground-truth/example-task.md',
|
|
24
|
+
}],
|
|
25
|
+
}, null, 2) + '\n',
|
|
26
|
+
'prompts/example-task.md': prompt,
|
|
27
|
+
'prompts/example-task.trigger.md': prompt,
|
|
28
|
+
'fixtures/example-task/package.json': JSON.stringify({
|
|
29
|
+
private: true, type: 'module', scripts: { test: 'node --test test.mjs' },
|
|
30
|
+
}, null, 2) + '\n',
|
|
31
|
+
'fixtures/example-task/index.js': 'export function add(a, b) { return a - b; }\n',
|
|
32
|
+
'fixtures/example-task/test.mjs': `import assert from 'node:assert/strict';
|
|
33
|
+
import { test } from 'node:test';
|
|
34
|
+
import { add } from './index.js';
|
|
35
|
+
|
|
36
|
+
test('positive numbers and zero', () => {
|
|
37
|
+
assert.equal(add(2, 3), 5);
|
|
38
|
+
assert.equal(add(0, 4), 4);
|
|
39
|
+
});
|
|
40
|
+
test('negative numbers', () => {
|
|
41
|
+
assert.equal(add(-2, -3), -5);
|
|
42
|
+
assert.equal(add(-2, 5), 3);
|
|
43
|
+
});
|
|
44
|
+
test('fractions', () => {
|
|
45
|
+
assert.equal(add(0.25, 0.5), 0.75);
|
|
46
|
+
assert.equal(add(-0.5, 0.25), -0.25);
|
|
47
|
+
});
|
|
48
|
+
`,
|
|
49
|
+
'verifiers/example-task.mjs': String.raw `import { spawnSync } from 'node:child_process';
|
|
50
|
+
import { readFileSync } from 'node:fs';
|
|
51
|
+
import { join } from 'node:path';
|
|
52
|
+
import { fileURLToPath } from 'node:url';
|
|
53
|
+
|
|
54
|
+
const runDir = process.argv[2];
|
|
55
|
+
if (!runDir) {
|
|
56
|
+
console.error('usage: node example-task.mjs <run-dir>');
|
|
57
|
+
process.exit(2);
|
|
58
|
+
}
|
|
59
|
+
const names = ['positive-and-zero', 'negative-numbers', 'fractions'];
|
|
60
|
+
const checks = [{ name: 'protected-assets', pass: false },
|
|
61
|
+
...names.map(name => ({ name, pass: false }))];
|
|
62
|
+
try {
|
|
63
|
+
checks[0].pass = ['package.json', 'test.mjs'].every(file =>
|
|
64
|
+
readFileSync(join(runDir, file)).equals(
|
|
65
|
+
readFileSync(new URL('../fixtures/example-task/' + file, import.meta.url))));
|
|
66
|
+
} catch { /* Missing protected files fail the same gate. */ }
|
|
67
|
+
|
|
68
|
+
if (checks[0].pass) {
|
|
69
|
+
// Grade behavior outside the editable fixture tests, in a separate process.
|
|
70
|
+
// A crash, early exit, syntax error or deadline cannot become a passing grade.
|
|
71
|
+
const probe = fileURLToPath(new URL('./probe-example-task.mjs', import.meta.url));
|
|
72
|
+
const result = spawnSync(process.execPath, [probe, runDir],
|
|
73
|
+
{ cwd: runDir, encoding: 'utf8', timeout: 5_000, maxBuffer: 64 * 1024 });
|
|
74
|
+
try {
|
|
75
|
+
const values = JSON.parse(result.stdout.trim().split('\n').at(-1));
|
|
76
|
+
if (!result.error && result.status === 0 && Array.isArray(values) &&
|
|
77
|
+
values.length === names.length && values.every(value => typeof value === 'boolean')) {
|
|
78
|
+
values.forEach((pass, i) => { checks[i + 1].pass = pass; });
|
|
79
|
+
}
|
|
80
|
+
} catch { /* No valid result means the behavior checks stay false. */ }
|
|
81
|
+
}
|
|
82
|
+
const passed = checks.every(check => check.pass);
|
|
83
|
+
console.log(JSON.stringify({ passed, checks }));
|
|
84
|
+
process.exit(passed ? 0 : 1);
|
|
85
|
+
`,
|
|
86
|
+
'verifiers/probe-example-task.mjs': `import { pathToFileURL } from 'node:url';
|
|
87
|
+
import { join } from 'node:path';
|
|
88
|
+
|
|
89
|
+
const { add } = await import(pathToFileURL(join(process.argv[2], 'index.js')).href);
|
|
90
|
+
const groups = [
|
|
91
|
+
[[2, 3, 5], [0, 4, 4], [8, 0, 8]],
|
|
92
|
+
[[-2, -3, -5], [-2, 5, 3], [3, -7, -4]],
|
|
93
|
+
[[0.25, 0.5, 0.75], [-0.5, 0.25, -0.25]],
|
|
94
|
+
];
|
|
95
|
+
const results = groups.map(cases => cases.every(([a, b, expected]) => {
|
|
96
|
+
try { return add(a, b) === expected; } catch { return false; }
|
|
97
|
+
}));
|
|
98
|
+
console.log(JSON.stringify(results));
|
|
99
|
+
`,
|
|
100
|
+
'ground-truth/oracle-example-task.mjs': String.raw `import { writeFileSync } from 'node:fs';
|
|
101
|
+
import { join } from 'node:path';
|
|
102
|
+
|
|
103
|
+
const runDir = process.argv[2];
|
|
104
|
+
if (!runDir) {
|
|
105
|
+
console.error('usage: node oracle-example-task.mjs <run-dir>');
|
|
106
|
+
process.exit(2);
|
|
107
|
+
}
|
|
108
|
+
writeFileSync(join(runDir, 'index.js'), 'export function add(a, b) { return a + b; }\n');
|
|
109
|
+
`,
|
|
110
|
+
'ground-truth/example-task.md': `# Ground truth — example-task
|
|
111
|
+
|
|
112
|
+
This is a synthetic teaching case, not evidence that a Skill improves real tasks.
|
|
113
|
+
The original subtracts; the reference repair returns the sum. Equivalent repairs
|
|
114
|
+
are accepted by behavior rather than matching reference source bytes.
|
|
115
|
+
|
|
116
|
+
The verifier checks protected fixture assets, positive numbers / zero, negatives,
|
|
117
|
+
and fractions. It runs its own behavior probes outside the agent's editable
|
|
118
|
+
fixture. Changing or removing \`package.json\` or \`test.mjs\` fails validation.
|
|
119
|
+
|
|
120
|
+
Replace the fixture, prompt, verifier and oracle together with your real task.
|
|
121
|
+
Keep reference answers outside the fixture; freeze independent acceptance checks
|
|
122
|
+
before comparing Skills. Run \`skillfit bench check\` before spending on an agent.
|
|
123
|
+
Use \`--input workspace\` with a local CLI executor to evaluate file edits.
|
|
124
|
+
The starter has one task and no trigger labels; it cannot support an adoption
|
|
125
|
+
claim or measure trigger recall. Add representative tasks and negative controls
|
|
126
|
+
where appropriate. See docs/bench-authoring.md in the skillfit repository.
|
|
127
|
+
`,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { lstatSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { loadBench, validateBenchTask } from '../harness/bench.js';
|
|
4
|
+
import { applyBenchWrites } from './bench.js';
|
|
5
|
+
import { BACKUP_SUFFIX } from './install.js';
|
|
6
|
+
const EDITABLE = ['fixture', 'prompt', 'promptTrigger', 'verifier', 'verifierKind', 'oracle', 'rubric', 'shouldTrigger'];
|
|
7
|
+
const OPTIONAL = ['promptTrigger', 'oracle', 'rubric', 'shouldTrigger'];
|
|
8
|
+
export function inspectBench(dir, taskId) {
|
|
9
|
+
const bench = loadBench(dir);
|
|
10
|
+
const tasks = taskId === undefined ? bench.tasks : bench.tasks.filter(task => task.id === taskId);
|
|
11
|
+
if (!tasks.length)
|
|
12
|
+
throw new Error(`Unknown task: ${taskId}`);
|
|
13
|
+
return { schemaVersion: 1, kind: taskId === undefined ? 'skillfit.bench-list' : 'skillfit.bench-task',
|
|
14
|
+
dir: bench.dir, name: bench.name, sha256: bench.contentSha256,
|
|
15
|
+
tasks: tasks.map(task => ({ ...task, verifierKind: task.verifierKind ?? 'output', shouldTrigger: task.shouldTrigger ?? null })) };
|
|
16
|
+
}
|
|
17
|
+
/** Modify only the registration; shared fixtures, graders and evidence stay in place. */
|
|
18
|
+
export function manageBench(options) {
|
|
19
|
+
const dir = resolve(options.dir), path = join(dir, 'bench.json');
|
|
20
|
+
if (lstatSync(path).isSymbolicLink())
|
|
21
|
+
throw new Error('Refusing to edit a symlinked bench.json.');
|
|
22
|
+
const before = readFileSync(path, 'utf8');
|
|
23
|
+
const bench = loadBench(dir);
|
|
24
|
+
const manifest = JSON.parse(before);
|
|
25
|
+
const index = manifest.tasks.findIndex(task => task.id === options.taskId);
|
|
26
|
+
if (index < 0)
|
|
27
|
+
throw new Error(`Unknown task: ${options.taskId}`);
|
|
28
|
+
const original = { ...manifest.tasks[index] };
|
|
29
|
+
if (options.action === 'remove') {
|
|
30
|
+
if (options.set?.length || options.unset?.length)
|
|
31
|
+
throw new Error('Removal cannot be combined with --set or --unset.');
|
|
32
|
+
if (manifest.tasks.length === 1)
|
|
33
|
+
throw new Error('Cannot remove the last task. Add a real task before removing the teaching case.');
|
|
34
|
+
manifest.tasks.splice(index, 1);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (!options.set?.length && !options.unset?.length)
|
|
38
|
+
throw new Error('Editing requires --set field=value or --unset field.');
|
|
39
|
+
const next = { ...original }, touched = new Set();
|
|
40
|
+
for (const assignment of options.set ?? []) {
|
|
41
|
+
const at = assignment.indexOf('=');
|
|
42
|
+
if (at < 1)
|
|
43
|
+
throw new Error(`Invalid --set: ${assignment}; expected field=value.`);
|
|
44
|
+
const field = assignment.slice(0, at), value = assignment.slice(at + 1);
|
|
45
|
+
if (!EDITABLE.includes(field))
|
|
46
|
+
throw new Error(`Field is not editable: ${field}`);
|
|
47
|
+
if (touched.has(field))
|
|
48
|
+
throw new Error(`Repeated edit field: ${field}`);
|
|
49
|
+
touched.add(field);
|
|
50
|
+
if (field === 'shouldTrigger') {
|
|
51
|
+
if (value !== 'true' && value !== 'false')
|
|
52
|
+
throw new Error('shouldTrigger must be true or false.');
|
|
53
|
+
next[field] = value === 'true';
|
|
54
|
+
}
|
|
55
|
+
else
|
|
56
|
+
next[field] = value;
|
|
57
|
+
}
|
|
58
|
+
for (const field of options.unset ?? []) {
|
|
59
|
+
if (!OPTIONAL.includes(field))
|
|
60
|
+
throw new Error(`Field cannot be unset: ${field}`);
|
|
61
|
+
if (touched.has(field))
|
|
62
|
+
throw new Error(`Repeated edit field: ${field}`);
|
|
63
|
+
touched.add(field);
|
|
64
|
+
delete next[field];
|
|
65
|
+
}
|
|
66
|
+
validateBenchTask(dir, next, index);
|
|
67
|
+
manifest.tasks[index] = next;
|
|
68
|
+
}
|
|
69
|
+
const after = options.action === 'remove' ? null : manifest.tasks[index];
|
|
70
|
+
const changed = JSON.stringify(original) !== JSON.stringify(after);
|
|
71
|
+
const apply = !!options.yes && !options.dryRun && changed;
|
|
72
|
+
const result = { schemaVersion: 1, kind: 'skillfit.bench-change', action: options.action,
|
|
73
|
+
dir, taskId: options.taskId, status: apply ? 'applied' : changed ? 'planned' : 'unchanged',
|
|
74
|
+
before: original, after, filesPreserved: true, backup: path + BACKUP_SUFFIX,
|
|
75
|
+
previousSha256: bench.contentSha256, sha256: bench.contentSha256 };
|
|
76
|
+
const log = options.log ?? console.log;
|
|
77
|
+
log(`${options.action === 'edit' ? 'Edit' : 'Unregister'} task ${options.taskId} in ${path}`);
|
|
78
|
+
log(`Before: ${JSON.stringify(original)}`);
|
|
79
|
+
log(`After: ${JSON.stringify(after)}`);
|
|
80
|
+
log('Only bench.json changes; task files remain in place.');
|
|
81
|
+
if (apply) {
|
|
82
|
+
if (readFileSync(path, 'utf8') !== before)
|
|
83
|
+
throw new Error('bench.json changed after the plan; nothing written.');
|
|
84
|
+
applyBenchWrites(dir, [{ target: path, content: JSON.stringify(manifest, null, 2) + '\n' }]);
|
|
85
|
+
result.sha256 = loadBench(dir).contentSha256;
|
|
86
|
+
log(`Applied and verified. Backup: ${result.backup}`);
|
|
87
|
+
}
|
|
88
|
+
else
|
|
89
|
+
log(changed ? 'Plan only — re-run with --yes to apply.' : 'No changes needed.');
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { test } from 'node:test';
|
|
8
|
+
import { inspectBench, manageBench } from './bench-manage.js';
|
|
9
|
+
import { applyBenchWrites, runBenchInit } from './bench.js';
|
|
10
|
+
import { loadBench } from '../harness/bench.js';
|
|
11
|
+
const CLI = fileURLToPath(new URL('../cli.js', import.meta.url));
|
|
12
|
+
async function setup(t) {
|
|
13
|
+
const root = mkdtempSync(join(tmpdir(), 'skillfit-manage-'));
|
|
14
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
15
|
+
const dir = join(root, 'bench');
|
|
16
|
+
await runBenchInit({ dir, kind: 'command', yes: true, log: () => { } });
|
|
17
|
+
return { root, dir, path: join(dir, 'bench.json') };
|
|
18
|
+
}
|
|
19
|
+
test('case listing/showing and default edit plans are read-only', async (t) => {
|
|
20
|
+
const { dir, path } = await setup(t), before = readFileSync(path, 'utf8');
|
|
21
|
+
assert.equal(inspectBench(dir).tasks.length, 1);
|
|
22
|
+
assert.equal(inspectBench(dir, 'example-task').tasks[0].verifierKind, 'command');
|
|
23
|
+
assert.throws(() => inspectBench(dir, 'missing'), /Unknown task/);
|
|
24
|
+
const result = manageBench({ dir, taskId: 'example-task', action: 'edit', set: ['shouldTrigger=false'], log: () => { } });
|
|
25
|
+
assert.equal(result.status, 'planned');
|
|
26
|
+
assert.equal(result.after.shouldTrigger, false);
|
|
27
|
+
assert.equal(readFileSync(path, 'utf8'), before);
|
|
28
|
+
assert.ok(!existsSync(path + '.skillfit-bak'));
|
|
29
|
+
});
|
|
30
|
+
test('case edits verify schema, preserve first backups and unregister without deleting shared files', async (t) => {
|
|
31
|
+
const { dir, path } = await setup(t);
|
|
32
|
+
const raw = JSON.parse(readFileSync(path, 'utf8'));
|
|
33
|
+
raw.tasks.push({ ...raw.tasks[0], id: 'real-task', provenance: 'keep me' });
|
|
34
|
+
writeFileSync(path, JSON.stringify(raw));
|
|
35
|
+
const before = readFileSync(path, 'utf8');
|
|
36
|
+
const base = { dir, taskId: 'real-task', yes: true, log: () => { } };
|
|
37
|
+
assert.equal(manageBench({ ...base, action: 'edit', set: ['shouldTrigger=true'] }).status, 'applied');
|
|
38
|
+
assert.equal(readFileSync(path + '.skillfit-bak', 'utf8'), before);
|
|
39
|
+
assert.equal(JSON.parse(readFileSync(path, 'utf8')).tasks[1].provenance, 'keep me');
|
|
40
|
+
manageBench({ ...base, action: 'edit', unset: ['shouldTrigger'] });
|
|
41
|
+
assert.equal(readFileSync(path + '.skillfit-bak', 'utf8'), before);
|
|
42
|
+
const result = manageBench({ ...base, taskId: 'example-task', action: 'remove' });
|
|
43
|
+
assert.equal(result.status, 'applied');
|
|
44
|
+
assert.deepEqual(loadBench(dir).tasks.map(task => task.id), ['real-task']);
|
|
45
|
+
assert.ok(existsSync(join(dir, 'fixtures/example-task/index.js')));
|
|
46
|
+
assert.ok(existsSync(join(dir, 'verifiers/example-task.mjs')));
|
|
47
|
+
assert.throws(() => manageBench({ ...base, action: 'remove' }), /last task/);
|
|
48
|
+
});
|
|
49
|
+
test('invalid edits, repeated fields and rollback never replace a valid bench', async (t) => {
|
|
50
|
+
const { dir, path } = await setup(t), before = readFileSync(path, 'utf8');
|
|
51
|
+
for (const set of [['id=renamed'], ['fixture=../outside'], ['verifier='], ['shouldTrigger=maybe'], ['shouldTrigger=true', 'shouldTrigger=false']]) {
|
|
52
|
+
assert.throws(() => manageBench({ dir, taskId: 'example-task', action: 'edit', set, yes: true, log: () => { } }));
|
|
53
|
+
assert.equal(readFileSync(path, 'utf8'), before);
|
|
54
|
+
}
|
|
55
|
+
assert.throws(() => applyBenchWrites(dir, [{ target: path, content: '{' }]));
|
|
56
|
+
assert.equal(readFileSync(path, 'utf8'), before);
|
|
57
|
+
});
|
|
58
|
+
test('a dangling backup symlink cannot write outside the case directory', async (t) => {
|
|
59
|
+
const { root, dir, path } = await setup(t), outside = join(root, 'outside');
|
|
60
|
+
try {
|
|
61
|
+
symlinkSync(outside, path + '.skillfit-bak', 'file');
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (error.code === 'EPERM') {
|
|
65
|
+
t.skip('File symlinks require platform privileges.');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
const before = readFileSync(path, 'utf8');
|
|
71
|
+
assert.throws(() => manageBench({ dir, taskId: 'example-task', action: 'edit', set: ['shouldTrigger=true'], yes: true, log: () => { } }), /unsafe backup/);
|
|
72
|
+
assert.equal(readFileSync(path, 'utf8'), before);
|
|
73
|
+
assert.ok(!existsSync(outside));
|
|
74
|
+
});
|
|
75
|
+
test('case-management CLI returns JSON plans and structured errors without prompts', async (t) => {
|
|
76
|
+
const { dir, path } = await setup(t), before = readFileSync(path, 'utf8');
|
|
77
|
+
for (const args of [['list', dir], ['show', dir, 'example-task'], ['edit', dir, 'example-task', '--set', 'shouldTrigger=false']]) {
|
|
78
|
+
const result = spawnSync(process.execPath, [CLI, 'bench', ...args, '--json'], { encoding: 'utf8', input: '', timeout: 30_000 });
|
|
79
|
+
assert.equal(result.status, 0, result.stderr);
|
|
80
|
+
assert.equal(result.stderr, '');
|
|
81
|
+
assert.equal(JSON.parse(result.stdout).schemaVersion, 1);
|
|
82
|
+
}
|
|
83
|
+
assert.equal(readFileSync(path, 'utf8'), before);
|
|
84
|
+
const bad = spawnSync(process.execPath, [CLI, 'bench', 'show', dir, 'missing', '--json'], { encoding: 'utf8' });
|
|
85
|
+
assert.equal(bad.status, 2);
|
|
86
|
+
assert.equal(JSON.parse(bad.stdout).kind, 'skillfit.bench-error');
|
|
87
|
+
});
|
package/dist/commands/bench.js
CHANGED
|
@@ -12,6 +12,8 @@ import { runTrial, runVerifier, verifierFailure } from '../harness/runner.js';
|
|
|
12
12
|
import { MOCK_MARKER_FILE, RUN_GROUP_PATTERN } from '../harness/constants.js';
|
|
13
13
|
import { verdictFromOutput } from '../harness/verifier-summary.js';
|
|
14
14
|
import { confirm as confirmPrompt } from './confirm.js';
|
|
15
|
+
import { commandTemplateFiles } from './bench-command-template.js';
|
|
16
|
+
import { benchDiagnostic, benchCheckEvidence } from './bench-check-report.js';
|
|
15
17
|
import { BACKUP_SUFFIX } from './install.js';
|
|
16
18
|
const FIXTURE_SIZE_WARN_BYTES = 64 * 1024;
|
|
17
19
|
// benches/README.md: a verifier decomposes its acceptance criteria into 2–8 named checks.
|
|
@@ -101,8 +103,12 @@ a real task from your own work:
|
|
|
101
103
|
}
|
|
102
104
|
export async function runBenchInit(options) {
|
|
103
105
|
const log = options.log ?? ((msg) => console.log(msg));
|
|
106
|
+
const kind = options.kind ?? 'output';
|
|
107
|
+
if (kind !== 'output' && kind !== 'command') {
|
|
108
|
+
throw new Error(`Unknown bench kind: ${kind} (expected "output" or "command")`);
|
|
109
|
+
}
|
|
104
110
|
const dir = resolve(options.cwd ?? process.cwd(), options.dir ?? 'skillfit-bench');
|
|
105
|
-
const files = templateFiles(basename(dir));
|
|
111
|
+
const files = kind === 'command' ? commandTemplateFiles(basename(dir)) : templateFiles(basename(dir));
|
|
106
112
|
const created = Object.keys(files);
|
|
107
113
|
if (options.dryRun) {
|
|
108
114
|
log(`Bench scaffold plan (dry run) — ${dir}:`);
|
|
@@ -131,7 +137,8 @@ export async function runBenchInit(options) {
|
|
|
131
137
|
log(`Bench scaffolded at ${dir} (${created.length} files, self-check passed).`);
|
|
132
138
|
log('Next:');
|
|
133
139
|
log(` skillfit bench check ${dir}`);
|
|
134
|
-
log(` skillfit eval <skill-path> --bench ${dir} --agent <id
|
|
140
|
+
log(` skillfit eval <skill-path> --bench ${dir} --agent <id>${kind === 'command' ? ' --input workspace' : ''} --trials 1 --max-calls 2 --dry-run`);
|
|
141
|
+
log('This is a teaching case. Replace it with your own task before measuring Skill benefit.');
|
|
135
142
|
return { dir, created };
|
|
136
143
|
}
|
|
137
144
|
async function probeVerifier(benchDir, verifier, output) {
|
|
@@ -144,6 +151,7 @@ async function probeVerifier(benchDir, verifier, output) {
|
|
|
144
151
|
return {
|
|
145
152
|
exitCode: result.exitCode,
|
|
146
153
|
error: result.error,
|
|
154
|
+
output: result.output,
|
|
147
155
|
checks: verdictFromOutput(result.output)?.checks ?? null,
|
|
148
156
|
};
|
|
149
157
|
}
|
|
@@ -184,6 +192,8 @@ async function runOracleGate(benchDir, fixtureDir, oracle, verifier) {
|
|
|
184
192
|
if (oracleRun.exitCode !== 0) {
|
|
185
193
|
return {
|
|
186
194
|
kind: 'oracle-failed',
|
|
195
|
+
result: oracleRun,
|
|
196
|
+
command: oracle,
|
|
187
197
|
exitCode: oracleRun.exitCode,
|
|
188
198
|
reason: oracleRun.exitCode === null ? verifierFailure('oracle', oracle, oracleRun.error) : null,
|
|
189
199
|
};
|
|
@@ -192,14 +202,16 @@ async function runOracleGate(benchDir, fixtureDir, oracle, verifier) {
|
|
|
192
202
|
if (graded.exitCode !== 0) {
|
|
193
203
|
return {
|
|
194
204
|
kind: 'verifier-failed',
|
|
205
|
+
result: graded,
|
|
206
|
+
command: verifier,
|
|
195
207
|
reason: graded.exitCode === null ? verifierFailure('verifier', verifier, graded.error) : null,
|
|
196
208
|
};
|
|
197
209
|
}
|
|
198
210
|
const score = verdictFromOutput(graded.output)?.score ?? null;
|
|
199
211
|
if (score !== null && score < 1) {
|
|
200
|
-
return { kind: 'low-score', score };
|
|
212
|
+
return { kind: 'low-score', score, result: graded, command: verifier };
|
|
201
213
|
}
|
|
202
|
-
return { kind: 'pass', score };
|
|
214
|
+
return { kind: 'pass', score, result: graded, command: verifier };
|
|
203
215
|
}
|
|
204
216
|
finally {
|
|
205
217
|
rmSync(dir, { recursive: true, force: true });
|
|
@@ -211,22 +223,26 @@ async function probeOracle(benchDir, fixture, oracle, verifier) {
|
|
|
211
223
|
case 'oracle-failed':
|
|
212
224
|
return {
|
|
213
225
|
status: 'FAIL',
|
|
226
|
+
evidence: benchCheckEvidence(gate.result, gate.command),
|
|
214
227
|
message: gate.reason ??
|
|
215
228
|
`oracle command itself failed (exit ${gate.exitCode}) — the reference solution cannot run`,
|
|
216
229
|
};
|
|
217
230
|
case 'verifier-failed':
|
|
218
231
|
return {
|
|
219
232
|
status: 'FAIL',
|
|
233
|
+
evidence: benchCheckEvidence(gate.result, gate.command),
|
|
220
234
|
message: gate.reason ?? 'oracle solution does not pass the verifier — the task is unwinnable or the oracle is stale',
|
|
221
235
|
};
|
|
222
236
|
case 'low-score':
|
|
223
237
|
return {
|
|
224
238
|
status: 'FAIL',
|
|
239
|
+
evidence: benchCheckEvidence(gate.result, gate.command),
|
|
225
240
|
message: `oracle passes the verifier but scores ${gate.score.toFixed(2)} on its checks — the checks are stricter than the exit code`,
|
|
226
241
|
};
|
|
227
242
|
case 'pass':
|
|
228
243
|
return {
|
|
229
244
|
status: 'PASS',
|
|
245
|
+
evidence: benchCheckEvidence(gate.result, gate.command),
|
|
230
246
|
message: `oracle solution passes the verifier${gate.score !== null ? ' with full checks' : ''}`,
|
|
231
247
|
};
|
|
232
248
|
}
|
|
@@ -238,8 +254,9 @@ export async function runBenchCheck(options) {
|
|
|
238
254
|
const log = options.log ?? ((msg) => console.log(msg));
|
|
239
255
|
const dir = resolve(options.dir ?? '.');
|
|
240
256
|
const checks = [];
|
|
241
|
-
|
|
242
|
-
|
|
257
|
+
let identity = null;
|
|
258
|
+
const push = (code, status, message, task, evidence) => {
|
|
259
|
+
checks.push(benchDiagnostic(code, status, message, task, evidence));
|
|
243
260
|
log(renderCheck({ status, message }));
|
|
244
261
|
};
|
|
245
262
|
let bench;
|
|
@@ -247,10 +264,11 @@ export async function runBenchCheck(options) {
|
|
|
247
264
|
bench = loadBench(dir);
|
|
248
265
|
}
|
|
249
266
|
catch (error) {
|
|
250
|
-
push('FAIL', `bench does not load: ${error.message}`);
|
|
251
|
-
return finish(dir, checks, log);
|
|
267
|
+
push('BENCH_LOAD', 'FAIL', `bench does not load: ${error.message}`);
|
|
268
|
+
return finish(dir, checks, log, false, identity);
|
|
252
269
|
}
|
|
253
|
-
|
|
270
|
+
identity = { name: bench.name, sha256: bench.contentSha256, taskCount: bench.tasks.length };
|
|
271
|
+
push('BENCH_LOAD', 'PASS', `bench.json valid (${bench.tasks.length} task(s), content sha256 ${bench.contentSha256.slice(0, 12)}…)`);
|
|
254
272
|
if (options.calibrate) {
|
|
255
273
|
const trials = options.calibrate.trials ?? CALIBRATE_DEFAULT_TRIALS;
|
|
256
274
|
if (!Number.isInteger(trials) || trials < 1 || trials > 20)
|
|
@@ -260,6 +278,7 @@ export async function runBenchCheck(options) {
|
|
|
260
278
|
let labeledTasks = 0;
|
|
261
279
|
let negativeTasks = 0;
|
|
262
280
|
for (const task of bench.tasks) {
|
|
281
|
+
const taskPush = (code, status, message, evidence) => push(code, status, message, task, evidence);
|
|
263
282
|
let facetChecks = null;
|
|
264
283
|
if ((task.verifierKind ?? 'output') === 'command') {
|
|
265
284
|
const fixtureCopy = mkdtempSync(join(tmpdir(), 'skillfit-check-'));
|
|
@@ -270,13 +289,13 @@ export async function runBenchCheck(options) {
|
|
|
270
289
|
if (pristine.exitCode === null) {
|
|
271
290
|
// Without this branch a verifier that cannot even be spawned reads as a clean NOP gate:
|
|
272
291
|
// "fails on the untouched fixture" is exactly what `exitCode !== 0` looks like.
|
|
273
|
-
|
|
292
|
+
taskPush('UNTOUCHED_FIXTURE', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, pristine.error)}`, benchCheckEvidence(pristine, task.verifier));
|
|
274
293
|
}
|
|
275
294
|
else if (pristine.exitCode === 0) {
|
|
276
|
-
|
|
295
|
+
taskPush('UNTOUCHED_FIXTURE', 'FAIL', `${task.id}: command verifier already passes on the untouched fixture — the task is solved or the verifier is broken`, benchCheckEvidence(pristine, task.verifier));
|
|
277
296
|
}
|
|
278
297
|
else {
|
|
279
|
-
|
|
298
|
+
taskPush('UNTOUCHED_FIXTURE', 'PASS', `${task.id}: command verifier fails on the untouched fixture (the failure reproduces)`, benchCheckEvidence(pristine, task.verifier));
|
|
280
299
|
}
|
|
281
300
|
}
|
|
282
301
|
finally {
|
|
@@ -286,39 +305,39 @@ export async function runBenchCheck(options) {
|
|
|
286
305
|
else {
|
|
287
306
|
const missing = await probeVerifier(bench.dir, task.verifier, null);
|
|
288
307
|
if (missing.exitCode === null) {
|
|
289
|
-
|
|
308
|
+
taskPush('MISSING_OUTPUT', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, missing.error)}`, benchCheckEvidence(missing, task.verifier));
|
|
290
309
|
}
|
|
291
310
|
else if (missing.exitCode === 0) {
|
|
292
|
-
|
|
311
|
+
taskPush('MISSING_OUTPUT', 'FAIL', `${task.id}: verifier does not reject a missing _output.md`, benchCheckEvidence(missing, task.verifier));
|
|
293
312
|
}
|
|
294
313
|
else {
|
|
295
|
-
|
|
314
|
+
taskPush('MISSING_OUTPUT', 'PASS', `${task.id}: verifier rejects missing output`, benchCheckEvidence(missing, task.verifier));
|
|
296
315
|
}
|
|
297
316
|
const empty = await probeVerifier(bench.dir, task.verifier, '');
|
|
298
317
|
facetChecks = empty.checks;
|
|
299
318
|
if (empty.exitCode === null) {
|
|
300
|
-
|
|
319
|
+
taskPush('EMPTY_OUTPUT', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, empty.error)}`, benchCheckEvidence(empty, task.verifier));
|
|
301
320
|
}
|
|
302
321
|
else if (empty.exitCode === 0) {
|
|
303
|
-
|
|
322
|
+
taskPush('EMPTY_OUTPUT', 'FAIL', `${task.id}: verifier passes an empty output — it cannot tell success from silence`, benchCheckEvidence(empty, task.verifier));
|
|
304
323
|
}
|
|
305
324
|
else {
|
|
306
|
-
|
|
325
|
+
taskPush('EMPTY_OUTPUT', 'PASS', `${task.id}: verifier rejects empty output`, benchCheckEvidence(empty, task.verifier));
|
|
307
326
|
}
|
|
308
327
|
}
|
|
309
328
|
const facetGate = facetCountCheck(task.id, facetChecks);
|
|
310
329
|
if (facetGate)
|
|
311
|
-
|
|
330
|
+
taskPush('FACET_COUNT', facetGate.status, facetGate.message);
|
|
312
331
|
if (task.oracle) {
|
|
313
332
|
const oracleResult = await probeOracle(bench.dir, task.fixture, task.oracle, task.verifier);
|
|
314
|
-
|
|
333
|
+
taskPush('ORACLE', oracleResult.status, `${task.id}: ${oracleResult.message}`, oracleResult.evidence);
|
|
315
334
|
}
|
|
316
335
|
else {
|
|
317
|
-
|
|
336
|
+
taskPush('ORACLE', 'WARN', `${task.id}: no oracle — task winnability is unverified (nothing proves a correct solution passes this verifier; register one with --oracle or write ground-truth/oracle-${task.id}.mjs)`);
|
|
318
337
|
}
|
|
319
338
|
const markerPath = join(bench.dir, task.fixture, MOCK_MARKER_FILE);
|
|
320
339
|
if ((task.verifierKind ?? 'output') === 'command') {
|
|
321
|
-
|
|
340
|
+
taskPush('MOCK_COVERAGE', 'INFO', `${task.id}: command verifier — mock-arm probes not applicable (a mock writes _output.md text, not file edits)${task.oracle
|
|
322
341
|
? '; offline coverage comes from the oracle and NOP gates above'
|
|
323
342
|
: '; with no oracle registered, nothing offline shows this task is solvable'}`);
|
|
324
343
|
}
|
|
@@ -330,28 +349,28 @@ export async function runBenchCheck(options) {
|
|
|
330
349
|
if (behavior?.output === undefined)
|
|
331
350
|
continue;
|
|
332
351
|
const probe = await probeVerifier(bench.dir, task.verifier, behavior.output);
|
|
333
|
-
|
|
352
|
+
taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', 'INFO', `${task.id}: mock ${arm} output → verifier ${probe.exitCode === 0 ? 'pass' : 'fail'}`, benchCheckEvidence(probe, task.verifier));
|
|
334
353
|
}
|
|
335
354
|
}
|
|
336
355
|
catch (error) {
|
|
337
|
-
|
|
356
|
+
taskPush('MOCK_MARKER', 'FAIL', `${task.id}: ${MOCK_MARKER_FILE} is unreadable (${error.message})`);
|
|
338
357
|
}
|
|
339
358
|
}
|
|
340
359
|
else {
|
|
341
|
-
|
|
360
|
+
taskPush('MOCK_COVERAGE', 'INFO', `${task.id}: no ${MOCK_MARKER_FILE} (offline mock runs will produce empty outputs)`);
|
|
342
361
|
}
|
|
343
362
|
const fixtureDir = join(bench.dir, task.fixture);
|
|
344
363
|
const fixtureBytes = listFilesRecursive(fixtureDir)
|
|
345
364
|
.map((rel) => statSync(join(fixtureDir, rel)).size)
|
|
346
365
|
.reduce((sum, size) => sum + size, 0);
|
|
347
366
|
if (fixtureBytes > FIXTURE_SIZE_WARN_BYTES) {
|
|
348
|
-
|
|
367
|
+
taskPush('FIXTURE_SIZE', 'WARN', `${task.id}: fixture is ${Math.round(fixtureBytes / 1024)} KB — inject mode inlines it into every prompt; keep it lean`);
|
|
349
368
|
}
|
|
350
369
|
else {
|
|
351
|
-
|
|
370
|
+
taskPush('FIXTURE_SIZE', 'PASS', `${task.id}: fixture size ${Math.round(fixtureBytes / 1024)} KB`);
|
|
352
371
|
}
|
|
353
372
|
if (task.shouldTrigger === undefined) {
|
|
354
|
-
|
|
373
|
+
taskPush('TRIGGER_LABEL', 'INFO', `${task.id}: no shouldTrigger label (trigger mode will skip this task)`);
|
|
355
374
|
}
|
|
356
375
|
else {
|
|
357
376
|
labeledTasks++;
|
|
@@ -363,19 +382,19 @@ export async function runBenchCheck(options) {
|
|
|
363
382
|
const fraction = negativeTasks / labeledTasks;
|
|
364
383
|
const percent = Math.round(fraction * 100);
|
|
365
384
|
if (negativeTasks === 0) {
|
|
366
|
-
push('WARN', 'no shouldTrigger:false (negative-control) tasks — trigger mode cannot measure false-trigger rate (see docs/metrics.md)');
|
|
385
|
+
push('NEGATIVE_CONTROLS', 'WARN', 'no shouldTrigger:false (negative-control) tasks — trigger mode cannot measure false-trigger rate (see docs/metrics.md)');
|
|
367
386
|
}
|
|
368
387
|
else if (fraction < NEGATIVE_CONTROL_TARGET) {
|
|
369
|
-
push('WARN', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — below the ${NEGATIVE_CONTROL_PERCENT}% target in docs/metrics.md, so false-trigger rate rests on a thin sample`);
|
|
388
|
+
push('NEGATIVE_CONTROLS', 'WARN', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — below the ${NEGATIVE_CONTROL_PERCENT}% target in docs/metrics.md, so false-trigger rate rests on a thin sample`);
|
|
370
389
|
}
|
|
371
390
|
else {
|
|
372
|
-
push('PASS', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — at or above the ${NEGATIVE_CONTROL_PERCENT}% target`);
|
|
391
|
+
push('NEGATIVE_CONTROLS', 'PASS', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — at or above the ${NEGATIVE_CONTROL_PERCENT}% target`);
|
|
373
392
|
}
|
|
374
393
|
}
|
|
375
394
|
if (options.calibrate) {
|
|
376
|
-
await calibrateBench(bench, options.calibrate, push, log);
|
|
395
|
+
await calibrateBench(bench, options.calibrate, (status, message) => push('CALIBRATION', status, message), log);
|
|
377
396
|
}
|
|
378
|
-
return finish(dir, checks, log, options.calibrate !== false && options.calibrate !== undefined);
|
|
397
|
+
return finish(dir, checks, log, options.calibrate !== false && options.calibrate !== undefined, identity);
|
|
379
398
|
}
|
|
380
399
|
const CALIBRATE_DEFAULT_TRIALS = 2;
|
|
381
400
|
async function calibrateBench(bench, options, push, log) {
|
|
@@ -492,7 +511,7 @@ async function calibrateBench(bench, options, push, log) {
|
|
|
492
511
|
rmSync(emptySkillDir, { recursive: true, force: true });
|
|
493
512
|
}
|
|
494
513
|
}
|
|
495
|
-
function finish(dir, checks, log, calibrated = false) {
|
|
514
|
+
function finish(dir, checks, log, calibrated = false, bench = null) {
|
|
496
515
|
const failures = checks.filter((c) => c.status === 'FAIL').length;
|
|
497
516
|
const warnings = checks.filter((c) => c.status === 'WARN').length;
|
|
498
517
|
const passes = checks.filter((c) => c.status === 'PASS').length;
|
|
@@ -503,7 +522,7 @@ function finish(dir, checks, log, calibrated = false) {
|
|
|
503
522
|
log(` skillfit eval <skill-path> --bench ${dir} --agent <id> --trials 5`);
|
|
504
523
|
log(' target: baseline pass rate 30–70%; --calibrate warns outside 10–90% (docs/metrics.md L0).');
|
|
505
524
|
}
|
|
506
|
-
return { dir, checks, failures, warnings };
|
|
525
|
+
return { dir, bench, checks, failures, warnings };
|
|
507
526
|
}
|
|
508
527
|
const TASK_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
509
528
|
export function captureSourceFiles(sourceDir) {
|
|
@@ -661,7 +680,7 @@ function assertInsideBench(benchDir, target) {
|
|
|
661
680
|
throw new Error(`Refusing to write outside the bench directory: ${target}`);
|
|
662
681
|
}
|
|
663
682
|
}
|
|
664
|
-
function applyBenchWrites(benchDir, writes) {
|
|
683
|
+
export function applyBenchWrites(benchDir, writes) {
|
|
665
684
|
const applied = [];
|
|
666
685
|
try {
|
|
667
686
|
for (const write of writes) {
|
|
@@ -676,8 +695,19 @@ function applyBenchWrites(benchDir, writes) {
|
|
|
676
695
|
throw new Error(`Refusing to overwrite a non-file: ${write.target}`);
|
|
677
696
|
previous = readFileSync(write.target);
|
|
678
697
|
const backup = write.target + BACKUP_SUFFIX;
|
|
679
|
-
|
|
680
|
-
|
|
698
|
+
let backupExists = false;
|
|
699
|
+
try {
|
|
700
|
+
const backupStat = lstatSync(backup);
|
|
701
|
+
if (backupStat.isSymbolicLink() || !backupStat.isFile())
|
|
702
|
+
throw new Error(`Refusing an unsafe backup target: ${backup}`);
|
|
703
|
+
backupExists = true;
|
|
704
|
+
}
|
|
705
|
+
catch (error) {
|
|
706
|
+
if (error.code !== 'ENOENT')
|
|
707
|
+
throw error;
|
|
708
|
+
}
|
|
709
|
+
if (!backupExists)
|
|
710
|
+
writeFileSync(backup, previous, { flag: 'wx' });
|
|
681
711
|
}
|
|
682
712
|
catch (error) {
|
|
683
713
|
if (error.code !== 'ENOENT')
|