skillfit 0.0.0-stage → 0.8.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/LICENSE +21 -0
- package/README.md +226 -2
- package/README.zh-CN.md +224 -0
- package/benches/README.md +172 -0
- package/benches/code-review/bench.json +57 -0
- package/benches/code-review/fixtures/explain-x1/.skillfit-mock.json +10 -0
- package/benches/code-review/fixtures/explain-x1/SPEC.md +16 -0
- package/benches/code-review/fixtures/explain-x1/src/compact.js +18 -0
- package/benches/code-review/fixtures/explain-x1/tests/compact.test.js +18 -0
- package/benches/code-review/fixtures/review-r1/.skillfit-mock.json +10 -0
- package/benches/code-review/fixtures/review-r1/CHANGES.diff +42 -0
- package/benches/code-review/fixtures/review-r1/SPEC.md +16 -0
- package/benches/code-review/fixtures/review-r1/src/errors.js +7 -0
- package/benches/code-review/fixtures/review-r1/src/money.js +3 -0
- package/benches/code-review/fixtures/review-r1/src/order.js +13 -0
- package/benches/code-review/fixtures/review-r1/tests/order.test.js +17 -0
- package/benches/code-review/fixtures/review-r2/.skillfit-mock.json +10 -0
- package/benches/code-review/fixtures/review-r2/CHANGES.diff +81 -0
- package/benches/code-review/fixtures/review-r2/SPEC.md +25 -0
- package/benches/code-review/fixtures/review-r2/src/errors.js +7 -0
- package/benches/code-review/fixtures/review-r2/src/invoice.js +9 -0
- package/benches/code-review/fixtures/review-r2/src/money.js +3 -0
- package/benches/code-review/fixtures/review-r2/tests/invoice.test.js +13 -0
- package/benches/code-review/fixtures/review-r3/.skillfit-mock.json +10 -0
- package/benches/code-review/fixtures/review-r3/CHANGES.diff +76 -0
- package/benches/code-review/fixtures/review-r3/SPEC.md +24 -0
- package/benches/code-review/fixtures/review-r3/src/errors.js +7 -0
- package/benches/code-review/fixtures/review-r3/src/money.js +3 -0
- package/benches/code-review/fixtures/review-r3/src/pricing.js +20 -0
- package/benches/code-review/fixtures/review-r3/tests/pricing.test.js +15 -0
- package/benches/code-review/fixtures/summarize-s1/.skillfit-mock.json +16 -0
- package/benches/code-review/fixtures/summarize-s1/CHANGES.diff +27 -0
- package/benches/code-review/fixtures/summarize-s1/SPEC.md +15 -0
- package/benches/code-review/fixtures/summarize-s1/src/discount.js +20 -0
- package/benches/code-review/fixtures/summarize-s1/src/errors.js +7 -0
- package/benches/code-review/fixtures/summarize-s1/src/money.js +7 -0
- package/benches/code-review/ground-truth/oracle-r1.mjs +21 -0
- package/benches/code-review/ground-truth/oracle-r2.mjs +21 -0
- package/benches/code-review/ground-truth/oracle-r3.mjs +20 -0
- package/benches/code-review/ground-truth/oracle-summarize-s1.mjs +21 -0
- package/benches/code-review/ground-truth/oracle-x1.mjs +18 -0
- package/benches/code-review/ground-truth/r1.md +22 -0
- package/benches/code-review/ground-truth/r2.md +21 -0
- package/benches/code-review/ground-truth/r3.md +18 -0
- package/benches/code-review/ground-truth/summarize-s1.md +26 -0
- package/benches/code-review/ground-truth/x1.md +7 -0
- package/benches/code-review/prompts/explain-x1.md +5 -0
- package/benches/code-review/prompts/explain-x1.trigger.md +5 -0
- package/benches/code-review/prompts/review-r1.md +7 -0
- package/benches/code-review/prompts/review-r1.trigger.md +7 -0
- package/benches/code-review/prompts/review-r2.md +7 -0
- package/benches/code-review/prompts/review-r2.trigger.md +7 -0
- package/benches/code-review/prompts/review-r3.md +7 -0
- package/benches/code-review/prompts/review-r3.trigger.md +7 -0
- package/benches/code-review/prompts/summarize-s1.md +9 -0
- package/benches/code-review/prompts/summarize-s1.trigger.md +9 -0
- package/benches/code-review/verifiers/explain-x1.mjs +30 -0
- package/benches/code-review/verifiers/review-r2.mjs +66 -0
- package/benches/code-review/verifiers/review-r3.mjs +60 -0
- package/benches/code-review/verifiers/seeded-bugs.mjs +74 -0
- package/benches/code-review/verifiers/summarize-s1.mjs +80 -0
- package/benches/contrib/README.md +42 -0
- package/benches/contrib/oss-lru-cache/README.md +24 -0
- package/benches/contrib/oss-lru-cache/bench.json +37 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/LICENSE +15 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/README.md +3 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/index.js +1044 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/package.json +11 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/runtime.mjs +22 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/test.mjs +11 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/LICENSE.md +55 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/README.md +3 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/package.json +11 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/runtime.mjs +22 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-browser.ts +11 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-cjs.cts +11 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-esm.mts +29 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-node.ts +7 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel.ts +6 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/index.ts +3148 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/perf.ts +17 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/test.mjs +11 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-size/LICENSE +15 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-size/README.md +3 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-size/index.js +1028 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-size/package.json +11 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-size/runtime.mjs +22 -0
- package/benches/contrib/oss-lru-cache/fixtures/fetch-size/test.mjs +11 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort/LICENSE +15 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort/index.js +1053 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort.md +11 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/LICENSE.md +55 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-browser.ts +11 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-cjs.cts +11 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-esm.mts +29 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-node.ts +7 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel.ts +6 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/index.ts +3174 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/perf.ts +17 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle.md +11 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-size/LICENSE +15 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-size/index.js +1028 -0
- package/benches/contrib/oss-lru-cache/ground-truth/fetch-size.md +11 -0
- package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-abort.mjs +8 -0
- package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-lifecycle.mjs +7 -0
- package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-size.mjs +7 -0
- package/benches/contrib/oss-lru-cache/ground-truth/oracle.mjs +9 -0
- package/benches/contrib/oss-lru-cache/prompts/fetch-abort.md +5 -0
- package/benches/contrib/oss-lru-cache/prompts/fetch-lifecycle.md +5 -0
- package/benches/contrib/oss-lru-cache/prompts/fetch-size.md +5 -0
- package/benches/contrib/oss-lru-cache/provenance.json +62 -0
- package/benches/contrib/oss-lru-cache/runtime.mjs +22 -0
- package/benches/contrib/oss-lru-cache/verifiers/cases.mjs +74 -0
- package/benches/contrib/oss-lru-cache/verifiers/fetch-abort.mjs +3 -0
- package/benches/contrib/oss-lru-cache/verifiers/fetch-lifecycle.mjs +3 -0
- package/benches/contrib/oss-lru-cache/verifiers/fetch-size.mjs +3 -0
- package/benches/contrib/oss-lru-cache/verifiers/probe.mjs +14 -0
- package/benches/contrib/oss-lru-cache/verifiers/shared.mjs +130 -0
- package/benches/contrib/oss-lru-cache/verifiers/test-reporter.mjs +29 -0
- package/benches/contrib/oss-mcp-use-utf8/LICENSE.upstream +21 -0
- package/benches/contrib/oss-mcp-use-utf8/README.md +56 -0
- package/benches/contrib/oss-mcp-use-utf8/bench.json +16 -0
- package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/LICENSE +21 -0
- package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/package.json +3 -0
- package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/src/ext-apps-bridge.js +3 -0
- package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/src/resolve-view-resource.ts +96 -0
- package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/test/basic.test.mjs +13 -0
- package/benches/contrib/oss-mcp-use-utf8/ground-truth/README.md +5 -0
- package/benches/contrib/oss-mcp-use-utf8/ground-truth/oracle-view-utf8.mjs +11 -0
- package/benches/contrib/oss-mcp-use-utf8/ground-truth/solutions/view-utf8/src/resolve-view-resource.ts +96 -0
- package/benches/contrib/oss-mcp-use-utf8/ground-truth/solutions/view-utf8/test/utf8.regression.test.mjs +14 -0
- package/benches/contrib/oss-mcp-use-utf8/prompts/view-utf8.md +8 -0
- package/benches/contrib/oss-mcp-use-utf8/verifiers/view-utf8.mjs +120 -0
- package/benches/contrib/waza-behavior/LICENSE.upstream +21 -0
- package/benches/contrib/waza-behavior/README.md +31 -0
- package/benches/contrib/waza-behavior/bench.json +10 -0
- package/benches/contrib/waza-behavior/fixtures/explicit-hold/README.md +1 -0
- package/benches/contrib/waza-behavior/fixtures/explicit-hold/notes.txt +1 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-current/README.md +1 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-current/docs/guide.md +2 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-current/notes.txt +1 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-current/scripts/check-links.mjs +16 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-current/validation-receipt.json +10 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-stale/README.md +1 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-stale/docs/guide.md +3 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-stale/notes.txt +1 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-stale/scripts/check-links.mjs +16 -0
- package/benches/contrib/waza-behavior/fixtures/receipt-stale/validation-receipt.json +10 -0
- package/benches/contrib/waza-behavior/ground-truth/oracle.mjs +24 -0
- package/benches/contrib/waza-behavior/prompts/explicit-hold.md +1 -0
- package/benches/contrib/waza-behavior/prompts/receipt-current.md +1 -0
- package/benches/contrib/waza-behavior/prompts/receipt-stale.md +1 -0
- package/benches/contrib/waza-behavior/verifiers/behavior.mjs +59 -0
- package/benches/debugging/bench.json +93 -0
- package/benches/debugging/fixtures/async-queue/src/task-queue.mjs +50 -0
- package/benches/debugging/fixtures/async-queue/test/basic.test.mjs +18 -0
- package/benches/debugging/fixtures/chunked-decoder/src/frame-decoder.mjs +39 -0
- package/benches/debugging/fixtures/chunked-decoder/test/basic.test.mjs +17 -0
- package/benches/debugging/fixtures/debug-redaction/src/debug-redaction.mjs +33 -0
- package/benches/debugging/fixtures/debug-redaction/test/basic.test.mjs +26 -0
- package/benches/debugging/fixtures/document-queue/.skillfit-mock.json +16 -0
- package/benches/debugging/fixtures/document-queue/src/task-queue.mjs +52 -0
- package/benches/debugging/fixtures/document-queue/test/basic.test.mjs +23 -0
- package/benches/debugging/fixtures/explain-cache/.skillfit-mock.json +16 -0
- package/benches/debugging/fixtures/explain-cache/src/ttl-cache.mjs +31 -0
- package/benches/debugging/fixtures/explain-cache/test/basic.test.mjs +28 -0
- package/benches/debugging/fixtures/feat-slug/test/slug.test.mjs +15 -0
- package/benches/debugging/fixtures/range-parser/src/range-parser.mjs +9 -0
- package/benches/debugging/fixtures/range-parser/test/basic.test.mjs +8 -0
- package/benches/debugging/fixtures/ttl-cache/src/ttl-cache.mjs +30 -0
- package/benches/debugging/fixtures/ttl-cache/test/basic.test.mjs +11 -0
- package/benches/debugging/ground-truth/async-queue.md +81 -0
- package/benches/debugging/ground-truth/chunked-decoder.md +91 -0
- package/benches/debugging/ground-truth/debug-redaction.md +113 -0
- package/benches/debugging/ground-truth/document-queue.md +24 -0
- package/benches/debugging/ground-truth/explain-cache.md +22 -0
- package/benches/debugging/ground-truth/feat-slug.md +45 -0
- package/benches/debugging/ground-truth/oracle-async-queue.mjs +14 -0
- package/benches/debugging/ground-truth/oracle-chunked-decoder.mjs +14 -0
- package/benches/debugging/ground-truth/oracle-debug-redaction.mjs +30 -0
- package/benches/debugging/ground-truth/oracle-document-queue.mjs +27 -0
- package/benches/debugging/ground-truth/oracle-explain-cache.mjs +28 -0
- package/benches/debugging/ground-truth/oracle-feat-slug.mjs +13 -0
- package/benches/debugging/ground-truth/oracle-range-parser.mjs +14 -0
- package/benches/debugging/ground-truth/oracle-ttl-cache.mjs +14 -0
- package/benches/debugging/ground-truth/range-parser.md +121 -0
- package/benches/debugging/ground-truth/solutions/async-queue/src/task-queue.mjs +52 -0
- package/benches/debugging/ground-truth/solutions/chunked-decoder/src/frame-decoder.mjs +50 -0
- package/benches/debugging/ground-truth/solutions/debug-redaction/src/debug-redaction.mjs +27 -0
- package/benches/debugging/ground-truth/solutions/debug-redaction/test/debug-leak.regression.test.mjs +27 -0
- package/benches/debugging/ground-truth/solutions/feat-slug/src/slug.mjs +6 -0
- package/benches/debugging/ground-truth/solutions/range-parser/src/range-parser.mjs +34 -0
- package/benches/debugging/ground-truth/solutions/range-parser/test/basic.test.mjs +26 -0
- package/benches/debugging/ground-truth/solutions/ttl-cache/src/ttl-cache.mjs +31 -0
- package/benches/debugging/ground-truth/ttl-cache.md +69 -0
- package/benches/debugging/prompts/async-queue.md +13 -0
- package/benches/debugging/prompts/async-queue.trigger.md +13 -0
- package/benches/debugging/prompts/chunked-decoder.md +13 -0
- package/benches/debugging/prompts/chunked-decoder.trigger.md +13 -0
- package/benches/debugging/prompts/debug-redaction.md +23 -0
- package/benches/debugging/prompts/debug-redaction.trigger.md +23 -0
- package/benches/debugging/prompts/document-queue.md +10 -0
- package/benches/debugging/prompts/document-queue.trigger.md +10 -0
- package/benches/debugging/prompts/explain-cache.md +10 -0
- package/benches/debugging/prompts/explain-cache.trigger.md +10 -0
- package/benches/debugging/prompts/feat-slug.md +3 -0
- package/benches/debugging/prompts/feat-slug.trigger.md +5 -0
- package/benches/debugging/prompts/range-parser.md +15 -0
- package/benches/debugging/prompts/range-parser.trigger.md +15 -0
- package/benches/debugging/prompts/ttl-cache.md +18 -0
- package/benches/debugging/prompts/ttl-cache.trigger.md +18 -0
- package/benches/debugging/verifiers/async-queue.mjs +221 -0
- package/benches/debugging/verifiers/chunked-decoder.mjs +208 -0
- package/benches/debugging/verifiers/debug-redaction.mjs +283 -0
- package/benches/debugging/verifiers/document-queue.mjs +52 -0
- package/benches/debugging/verifiers/explain-cache.mjs +62 -0
- package/benches/debugging/verifiers/feat-slug.mjs +127 -0
- package/benches/debugging/verifiers/range-parser.mjs +146 -0
- package/benches/debugging/verifiers/ttl-cache.mjs +111 -0
- package/dist/agents.js +26 -0
- package/dist/cli.js +310 -0
- package/dist/cli.test.js +76 -0
- package/dist/commands/bench.js +1035 -0
- package/dist/commands/bench.test.js +1061 -0
- package/dist/commands/bundle.js +334 -0
- package/dist/commands/bundle.test.js +142 -0
- package/dist/commands/confirm.js +39 -0
- package/dist/commands/doctor.js +399 -0
- package/dist/commands/doctor.test.js +280 -0
- package/dist/commands/eval-report.js +485 -0
- package/dist/commands/eval-report.test.js +306 -0
- package/dist/commands/eval.js +391 -0
- package/dist/commands/eval.test.js +446 -0
- package/dist/commands/install.js +653 -0
- package/dist/commands/install.test.js +555 -0
- package/dist/commands/mcp.js +20 -0
- package/dist/commands/report.js +78 -0
- package/dist/commands/report.test.js +110 -0
- package/dist/commands/setup.js +95 -0
- package/dist/commands/setup.test.js +150 -0
- package/dist/commands/upstream.js +210 -0
- package/dist/commands/upstream.test.js +139 -0
- package/dist/docs.test.js +154 -0
- package/dist/frontmatter.js +53 -0
- package/dist/frontmatter.test.js +49 -0
- package/dist/harness/bench.js +134 -0
- package/dist/harness/bench.test.js +109 -0
- package/dist/harness/bundle.js +46 -0
- package/dist/harness/bundle.test.js +71 -0
- package/dist/harness/constants.js +2 -0
- package/dist/harness/executors/api.js +68 -0
- package/dist/harness/executors/api.test.js +75 -0
- package/dist/harness/executors/cli.js +348 -0
- package/dist/harness/executors/cli.test.js +402 -0
- package/dist/harness/executors/mock.js +34 -0
- package/dist/harness/executors/mock.test.js +43 -0
- package/dist/harness/experiment-session.js +345 -0
- package/dist/harness/experiment-session.test.js +223 -0
- package/dist/harness/hash.js +29 -0
- package/dist/harness/installed-skill.js +78 -0
- package/dist/harness/installed-skill.test.js +162 -0
- package/dist/harness/judge.js +108 -0
- package/dist/harness/judge.test.js +181 -0
- package/dist/harness/kill-tree.js +43 -0
- package/dist/harness/kimi-usage.js +94 -0
- package/dist/harness/kimi-usage.test.js +62 -0
- package/dist/harness/oss-lru-cache.test.js +79 -0
- package/dist/harness/oss-regression-witness.test.js +89 -0
- package/dist/harness/prompt.js +57 -0
- package/dist/harness/prompt.test.js +48 -0
- package/dist/harness/receipts.js +297 -0
- package/dist/harness/receipts.test.js +148 -0
- package/dist/harness/report.js +225 -0
- package/dist/harness/report.test.js +297 -0
- package/dist/harness/runner.js +629 -0
- package/dist/harness/runner.test.js +555 -0
- package/dist/harness/stats.js +93 -0
- package/dist/harness/stats.test.js +124 -0
- package/dist/harness/target.js +90 -0
- package/dist/harness/target.test.js +60 -0
- package/dist/harness/trigger.js +368 -0
- package/dist/harness/trigger.test.js +249 -0
- package/dist/harness/types.js +1 -0
- package/dist/harness/verifier-summary.js +59 -0
- package/dist/harness/verifier-summary.test.js +99 -0
- package/dist/harness/waza-behavior.test.js +139 -0
- package/dist/invocation.js +21 -0
- package/dist/matrix/agents.json +200 -0
- package/dist/matrix/agents.schema.json +152 -0
- package/dist/mcp/probe.js +317 -0
- package/dist/mcp/probe.test.js +87 -0
- package/dist/version.js +4 -0
- package/docs/assets/skillfit-flow.en.svg +47 -0
- package/docs/assets/skillfit-flow.zh-CN.svg +47 -0
- package/docs/assets/skillfit-mark.svg +9 -0
- package/docs/audit-2026-09-24-triage.md +231 -0
- package/docs/audit-2026-09-24.md +876 -0
- package/docs/bench-authoring.md +407 -0
- package/docs/codex-upstream-audit.md +41 -0
- package/docs/config-experiments.md +119 -0
- package/docs/examples/bench-check.yml +32 -0
- package/docs/examples/eval-manifest.synthetic.json +61 -0
- package/docs/experiment-workflow.md +15 -0
- package/docs/first-real-eval.md +90 -0
- package/docs/growth-roadmap-2026-10.md +100 -0
- package/docs/installed-skill-evaluation.md +77 -0
- package/docs/metrics.md +318 -0
- package/docs/oss-task-evaluation.md +139 -0
- package/docs/plans/2026-10-01-oss-task-evaluation.md +73 -0
- package/docs/plans/2026-10-09-experiment-workflow.md +18 -0
- package/docs/plans/2026-10-09-grader-calibration-audit.md +13 -0
- package/docs/plans/2026-10-09-waza-resource-evaluation.md +46 -0
- package/docs/portable-codex.md +31 -0
- package/docs/reproducible-offline-example.md +29 -0
- package/docs/selectable-codex.md +41 -0
- package/docs/sharing-results.md +53 -0
- package/evidence/2026-07-skill-baseline.md +34 -0
- package/evidence/2026-09-22-codex-trigger-capture.md +36 -0
- package/evidence/2026-09-bench-calibration.md +46 -0
- package/evidence/2026-09-debugging-bench-exploratory.md +55 -0
- package/evidence/2026-09-debugging-hardening.md +42 -0
- package/evidence/2026-09-ocr-vs-code-review.md +31 -0
- package/evidence/2026-09-trigger-snapshot-correction.md +48 -0
- package/evidence/2026-10-01-codex-diagnosing-bugs-pilot.md +58 -0
- package/evidence/2026-10-01-oss-case-selection.md +42 -0
- package/evidence/2026-10-01-oss-workspace-smoke.md +110 -0
- package/evidence/README.md +47 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/README.md +27 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/artifact-index.json +118 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/output.md +5 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/prompt.txt +14 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/result.json +65 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/verifier.txt +2 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/LICENSE +21 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/package.json +3 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/src/ext-apps-bridge.js +3 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/src/resolve-view-resource.ts +100 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/test/basic.test.mjs +13 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/test/resolve-view-resource.test.mjs +102 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/manifest.json +206 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/original-console.txt +44 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/report.md +67 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/output.md +5 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/prompt.txt +163 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/result.json +65 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/verifier.txt +2 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/LICENSE +21 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/package.json +3 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/src/ext-apps-bridge.js +3 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/src/resolve-view-resource.ts +100 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/test/basic.test.mjs +13 -0
- package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/test/resolve-view-resource.test.mjs +136 -0
- package/evidence/inputs/README.md +15 -0
- package/evidence/inputs/diagnosing-bugs/LICENSE +21 -0
- package/evidence/inputs/diagnosing-bugs/SKILL.md +138 -0
- package/evidence/inputs/diagnosing-bugs/agents/openai.yaml +3 -0
- package/evidence/inputs/diagnosing-bugs/scripts/hitl-loop.template.sh +44 -0
- package/evidence/plans/2026-10-01-oss-workspace-smoke.json +29 -0
- package/package.json +47 -4
- package/profiles/codex-curated/catalog.json +28 -0
- package/profiles/codex-curated/profile.json +282 -0
- package/profiles/codex-curated/rules/global.md +12 -0
- package/profiles/codex-curated/skills/autonomous-iteration/SKILL.md +75 -0
- package/profiles/codex-curated/skills/autonomous-iteration/agents/openai.yaml +4 -0
- package/profiles/codex-curated/skills/vibe-coding/SKILL.md +45 -0
- package/profiles/codex-curated/skills/vibe-coding/agents/openai.yaml +4 -0
- package/profiles/codex-upstream-sources.json +2980 -0
- package/profiles/recommended/profile.json +12 -0
- package/profiles/recommended/rules/core-workflow.md +41 -0
- package/profiles/recommended/skills/commit-message/SKILL.md +18 -0
- package/skills/skillfit/SKILL.md +60 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# skillfit benches
|
|
2
|
+
|
|
3
|
+
A **bench** is a portable, deterministic test suite for measuring whether a skill (or rules file, or MCP configuration) actually improves an AI coding agent on tasks that resemble your real work. Skills markets tell you what is popular; benches tell you what works.
|
|
4
|
+
|
|
5
|
+
> **This file is the reference** — layout, schema, the verifier contract, fixture rules. If you are
|
|
6
|
+
> about to write a bench, read [docs/bench-authoring.md](../docs/bench-authoring.md) first: it walks the
|
|
7
|
+
> seven steps end to end on one real task and explains why each one is non-optional.
|
|
8
|
+
|
|
9
|
+
`skillfit eval <skill-path> --bench <bench-dir>` pairs every task twice — once **baseline** (no skill injected) and once **treatment** (skill injected into the prompt) — for `N` trials each, then compares pass rates. `skillfit bench init` scaffolds a new bench (with a working example task) and `skillfit bench check` validates one offline — verifier self-tests, oracle/NOP gates, facet-count bounds, mock-arm probes, fixture hygiene — before you spend a single token on runs. Add `--calibrate --agent <id>` to also run real baseline-difficulty probes: one inject-mode arm per task with an empty skill payload, so `shouldTrigger` labels are **not** required and you pay for one arm, not two. Each task is banded against the L0 floor/ceiling as too hard or broken (≤10% baseline pass rate), discriminative (in between), or too easy/saturated (≥90%); aim for 30–70%. A calibration that completes no runs fails loudly instead of reporting a band it never measured.
|
|
10
|
+
|
|
11
|
+
## Bench directory layout
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
my-bench/
|
|
15
|
+
bench.json # required: manifest
|
|
16
|
+
prompts/
|
|
17
|
+
<task-id>.md # task instructions shown to the agent
|
|
18
|
+
fixtures/
|
|
19
|
+
<task-id>/ # synthetic repository copied into each run directory
|
|
20
|
+
...
|
|
21
|
+
.skillfit-mock.json # optional: canned outputs for offline/mock runs
|
|
22
|
+
verifiers/
|
|
23
|
+
<task-id>.mjs # deterministic grader; exit code 0 = pass
|
|
24
|
+
ground-truth/ # seed answers / rubrics (never copied into run directories)
|
|
25
|
+
<task-id>.md
|
|
26
|
+
oracle-<task-id>.mjs # optional: applies the reference solution to a fixture copy
|
|
27
|
+
solutions/<task-id>/ # optional: the reference solution as real files, for the oracle to copy
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Only the task's `fixtures/<task-id>/` directory is copied into a run directory. Everything else — prompts, verifiers, ground truth — stays in the bench directory, so agents never see the answers.
|
|
31
|
+
|
|
32
|
+
## `bench.json` schema
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"schemaVersion": 1,
|
|
37
|
+
"name": "my-bench",
|
|
38
|
+
"tasks": [
|
|
39
|
+
{
|
|
40
|
+
"id": "review-r1",
|
|
41
|
+
"fixture": "fixtures/review-r1",
|
|
42
|
+
"prompt": "prompts/review-r1.md",
|
|
43
|
+
"verifier": "node verifiers/seeded-bugs.mjs",
|
|
44
|
+
"oracle": "node ground-truth/oracle-r1.mjs",
|
|
45
|
+
"rubric": "ground-truth/r1.md"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Field | Required | Meaning |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| `schemaVersion` | yes | Must be `1`. |
|
|
54
|
+
| `name` | no | Display name; defaults to the directory name. |
|
|
55
|
+
| `tasks` | yes | Non-empty array. Task `id`s must be unique and match `^[A-Za-z0-9][A-Za-z0-9._-]*$`. |
|
|
56
|
+
| `tasks[].fixture` | yes | Directory (relative to the bench root) with the synthetic repository. Convention: `fixtures/<task-id>/`. |
|
|
57
|
+
| `tasks[].prompt` | yes | Markdown file with the task instructions. Convention: `prompts/<task-id>.md`. |
|
|
58
|
+
| `tasks[].verifier` | yes | Command run from the bench root; the run directory is appended as the last argument. Spawned without a shell, so the first token must be a real executable. Convention: `node verifiers/<task-id>.mjs`. |
|
|
59
|
+
| `tasks[].verifierKind` | no | `output` (default): the verifier grades the agent's final message at `_output.md`. `command`: the verifier runs a real command (e.g. a test suite) inside the run directory, for tasks where the agent edits files. `command` tasks need a CLI executor (`--agent <id>`), because only that works inside the run directory — an API-key-only `eval` refuses the bench at plan time rather than silently scoring both arms 0. |
|
|
60
|
+
| `tasks[].oracle` | no (warned when absent) | Command (same invocation convention as the verifier) that applies the reference solution to a fixture copy — writes `_output.md` for `output` tasks, edits files for `command` tasks. `bench check` fails when the oracle-solved fixture does not pass the verifier with every check green. A task that registers **no** oracle gets a WARN naming the consequence — winnability is unverified, so nothing proves the task is solvable — rather than a FAIL, because `bench add --freeze` legitimately produces oracle-less tasks mid-authoring. Convention: `node ground-truth/oracle-<task-id>.mjs`. |
|
|
61
|
+
| `tasks[].rubric` | no | Markdown file injected into the optional LLM judge prompt (never shown to the agent under test). |
|
|
62
|
+
| `tasks[].shouldTrigger` | no | Whether an in-scope skill *should* fire on this task. Required for `--mode trigger` (unlabeled tasks are skipped there). Include negative controls (`false`) — aim for ≥30% of tasks; `bench check` reports the fraction and warns below that target, because false-trigger rate is the metric a thin negative sample undermines first. |
|
|
63
|
+
|
|
64
|
+
All paths must stay inside the bench directory.
|
|
65
|
+
|
|
66
|
+
## Verifier contract
|
|
67
|
+
|
|
68
|
+
The verifier is the heart of a bench. It must be **deterministic**: same run directory in, same verdict out — no network, no clocks, no randomness.
|
|
69
|
+
|
|
70
|
+
- Invocation: `<verifier command> <absolute run directory>`, working directory = bench root. The command is split on whitespace and spawned **without a shell**, so its first token must be an executable the operating system can start directly: `node verifiers/x.mjs` works, while a bare `npm test` or a `.cmd`/`.bat` wrapper does not (`ENOENT` / `EINVAL` on Windows). If the verdict genuinely comes from a shell command, use `bench add --freeze --verifier-cmd "<cmd>"`, which writes a generated `verifiers/<task-id>.mjs` that node runs and that runs your command under a shell inside. Keeping the harness's own spawn shell-free is deliberate, not an oversight — benches are contributed by third parties, and a shell here would turn `"verifier": "node v.mjs & curl …"` in somebody else's `bench.json` into code execution on your machine.
|
|
71
|
+
- A verifier that produces **no exit code at all** — unspawnable, or killed by the 2-minute timeout — has graded nothing, so it is never read as a verdict: `bench check` fails the task and names the cause, and `eval` excludes that trial *and its paired arm* from the rates rather than scoring a fabricated failure. Without that, a broken verifier command would look like a 0% pass rate in both arms and get reported as "bench too hard".
|
|
72
|
+
- **Exit code 0 = pass, anything else = fail.** That is the only pass/fail signal the harness aggregates.
|
|
73
|
+
- Print a one-line JSON summary as the **last stdout line**. The harness parses it (tolerating surrounding noise) and saves the raw output to `_verifier.txt`:
|
|
74
|
+
- `passed` (boolean) — informational; the exit code is authoritative, and a disagreement is flagged as a warning.
|
|
75
|
+
- `checks` (optional) — `[{"name": "discount-boundary", "pass": true}, ...]`: the acceptance criteria decomposed into 2–8 named programmatic checks. The trial **score** is the fraction of checks passed; scores feed the per-facet table and the paired-bootstrap Δscore CI in the report, letting a bench resolve effects binary pass/fail cannot at small sample sizes. Checks never flip a verdict. Keep them deterministic and outcome-focused. `bench check` reads the count back out of your verifier and warns outside 2–8: one check is binary pass/fail in facet costume and carries none of the graded signal, while a dozen lets whatever those checks happen to measure dominate the score.
|
|
76
|
+
- Anything else (`hits`, `missed`, `decoys`, …) is free-form and preserved for humans.
|
|
77
|
+
- The run directory contains the agent's raw final message at `_output.md`, the full prompt at `_prompt.txt`, plus any files the agent created or modified in place (CLI executors run inside the run directory).
|
|
78
|
+
- Two kinds: `output` verifiers (default) grade `_output.md`; `command` verifiers (`verifierKind: "command"`) run a real command — e.g. the repo's test suite — inside the run directory, for tasks where the agent edits files. A command verifier must *fail on the untouched fixture* (the task is unsolved as shipped); `bench check` verifies exactly that. When the task registers an `oracle`, `bench check` also verifies the other direction: the oracle-solved fixture must exit 0 with every check passing. Together these are the NOP/oracle gates — they catch broken verifiers and unwinnable tasks before you spend tokens.
|
|
79
|
+
|
|
80
|
+
Node is the recommended verifier runtime because it is everywhere skillfit runs: `node verifiers/<task-id>.mjs`.
|
|
81
|
+
|
|
82
|
+
## Fixture rules
|
|
83
|
+
|
|
84
|
+
- Keep fixtures small and self-contained; every file is embedded into the prompt, so size is tokens.
|
|
85
|
+
- Files whose name starts with `_`, any `.git` directory, and `.skillfit-mock.json` are never shown to the agent. For non-mock executors the marker file is deleted from the run directory before the agent starts, so it cannot leak into real runs.
|
|
86
|
+
- Seed defects deliberately and record them in `ground-truth/`. The best benches are ported from real production incidents: take a bug that actually escaped, shrink the repo around it, and assert the reviewer finds it.
|
|
87
|
+
- Include decoys (plausible-but-correct code) so that a treatment which simply "reports more" is penalized by your scoring logic.
|
|
88
|
+
- Include a `.skillfit-mock.json` marker so the bench can be exercised offline with the MockExecutor:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"baseline": { "output": "…what a skill-less agent typically says…" },
|
|
93
|
+
"treatment": { "output": "…what the same agent says with the skill…" }
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The mock picks `treatment` whenever the prompt contains a `<skill name="…">` block, otherwise `baseline`. Optional `tokens: {"input": n, "output": n}` per condition feed the token-delta report; without them the mock estimates tokens as `length / 4`.
|
|
98
|
+
|
|
99
|
+
`verifierKind: "command"` tasks cannot be mock-probed: a mock produces `_output.md` *text*, while a command verifier grades *file state*, so there is nothing for the marker to stand in for. Their offline coverage is the two gates instead — the NOP probe proves the task ships unsolved, and the oracle gate proves a correct solution passes with every check green. That is why registering an oracle matters more on a command-kind bench: without one, nothing offline shows the task is solvable, and `bench check` says so.
|
|
100
|
+
|
|
101
|
+
## What the harness records
|
|
102
|
+
|
|
103
|
+
Each run writes to `runs/<runGroup>/<task-id>/<condition>/trial-<n>/`:
|
|
104
|
+
|
|
105
|
+
- `_prompt.txt` — the exact prompt sent to the executor (task prompt + isolation rules + repository snapshot + skill payload for treatment + output contract)
|
|
106
|
+
- `_output.md` — the raw agent output
|
|
107
|
+
- `_verifier.txt` — verifier stdout/stderr
|
|
108
|
+
- `_result.json` — timing, pass flag, verifier exit code, facet checks + score, token usage, skill bundle hash
|
|
109
|
+
- `runs/<runGroup>/manifest.json` — model/executor identity, skill bundle sha256, bench content sha256, date, per-task per-condition pass rates, graded trial counts and executor-error counts, facet scores, token deltas, verdicts, and warnings
|
|
110
|
+
|
|
111
|
+
A trial whose executor errored, or that produced no engagement (empty final text, and no fixture edit on a command task), was never graded, so it is excluded from the rates rather than counted as a failure — and excluded *pairwise*, because every statistic here is paired: an error in either arm drops that (task, trial) pair from both. Each condition reports `errors` next to `trials`, and a warning names the exclusion.
|
|
112
|
+
|
|
113
|
+
Verdicts follow the [metrics protocol](../docs/metrics.md): `effective` requires McNemar exact p < 0.05 and a positive pass-rate delta; `ineffective` requires p < 0.05 and a negative delta; otherwise the verdict is `inconclusive`. Fewer than 6 discordant pairs cannot reach significance. The report marks runs below 8 tasks × 5 trials per condition as *indicative* even if their within-bench verdict is significant. The CLI defaults to 5 trials per condition. The report also warns when a task's baseline pass rate is ≥ 90% (too easy to discriminate anything) or ≤ 10% (too hard or broken), and flags any individual check the baseline already passes ≥ 90% of the time as saturated.
|
|
114
|
+
|
|
115
|
+
## Optional LLM judge
|
|
116
|
+
|
|
117
|
+
Verifiers measure pass/fail. For a second, softer dimension, set `SKILLFIT_JUDGE=1` (plus `SKILLFIT_API_KEY` or `SKILLFIT_JUDGE_API_KEY`; tune with `SKILLFIT_JUDGE_MODEL` / `SKILLFIT_JUDGE_BASE_URL`), or pass `--judge-agent <id>`. Each pair is judged twice in swapped A/B and B/A positions with a binary checklist; only position-consistent results enter `tasks[].judge`. The judge never replaces the deterministic verifier. A judge adds model calls and is optional for a first experiment.
|
|
118
|
+
|
|
119
|
+
## Trigger mode (`--mode trigger`)
|
|
120
|
+
|
|
121
|
+
Inject mode answers "does the skill help when it is used?". Trigger mode answers the prior question — "does the agent use it at all?" — and its flip side, "does it fire when it shouldn't?".
|
|
122
|
+
|
|
123
|
+
In trigger mode the skill is **installed** into each run directory (the agent's project skills directory from the capability matrix, e.g. `.kimi-code/skills/`), never injected into the prompt. The agent runs headless with structured (stream-json) output, and skillfit detects invocation mechanically from the transcript: a call to the agent's skill tool naming the skill under test (see `headless.streamJson` in `src/matrix/agents.json`). The raw transcript is saved as `_transcript.jsonl` for audit.
|
|
124
|
+
|
|
125
|
+
Only the skill under test is installed — the run directory's skills folder is otherwise empty. Real routing quality depends on lexical competition with everything else the user has installed, so **read trigger recall as an upper bound**. Reproducing that competition would mean copying the user's real skill set into a sandbox, which is tracked as a future enhancement rather than done here (see `docs/metrics.md` L1).
|
|
126
|
+
|
|
127
|
+
Every task needs a `shouldTrigger` label:
|
|
128
|
+
|
|
129
|
+
- `true` — in-domain tasks. Recall = fired / should-trigger runs.
|
|
130
|
+
- `false` — negative controls: plausible, in-scope-looking tasks that are actually out of domain. False-trigger rate = fired / negative runs.
|
|
131
|
+
|
|
132
|
+
The manifest reports recall, false-trigger rate, and precision, each with a Wilson 95% CI, plus F1 — which is deliberately bare, because a harmonic mean of two proportions has no closed-form binomial interval and printing one would be invented precision. Executor errors and undetectable transcripts are excluded from the rates and surfaced as warnings. Trigger capture is currently verified for **Kimi Code** and **Codex CLI**; agents without a `streamJson` template fail with a clear error.
|
|
133
|
+
|
|
134
|
+
## Porting your production scenario
|
|
135
|
+
|
|
136
|
+
The command reference for the three import paths is below; [docs/bench-authoring.md](../docs/bench-authoring.md)
|
|
137
|
+
is the version that explains what to do with them and in what order.
|
|
138
|
+
|
|
139
|
+
The fastest path is freezing a failure you just watched happen:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
skillfit bench add <bench-dir> --freeze --task <id> \
|
|
143
|
+
--prompt "What went wrong and what the agent should have done" \
|
|
144
|
+
--verifier-cmd "node --test" # or: --expect "string the output must contain"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This snapshots the current directory (git-tracked files only, so `node_modules` and build output stay out) into `fixtures/<task-id>/`, generates the verifier wrapper, and registers the task. If writing the verifier by hand is the bottleneck, let an agent draft it — and get a reference solution in the bargain:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
skillfit bench add <bench-dir> --freeze --task <id> \
|
|
151
|
+
--prompt "What went wrong and what the agent should have done" \
|
|
152
|
+
--decompose --agent <id> [--verifier-kind command]
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`--decompose` stages the frozen fixture, has the agent write `verifier.mjs` + `oracle.mjs` (acceptance criteria as named checks), and **admits the draft only if both gates pass locally**: the verifier must fail the untouched fixture (NOP gate) and must exit 0 with full checks after the oracle solves it (oracle gate). A draft that fails either gate is rejected and nothing is written. Note the provenance rule: a bench generated *from the skill under test* is fine as a smoke test but proves nothing about efficacy — decompose from real failures, not from the skill's own content. Already have a reference-solution script? Register it with `--oracle "node ground-truth/oracle-<id>.mjs"` so `bench check` gates on it.
|
|
156
|
+
|
|
157
|
+
Or mine a fix straight out of git history:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
skillfit bench add <bench-dir> --from-commit <sha> [--source-dir <repo>] [--include <dir>...]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The commit must change at least one test file and one non-test file: the parent commit becomes the fixture, and the fix's own tests are embedded into the verifier (hidden from the agent; they must fail on the parent state and pass once the fix is re-implemented — the SWE-bench FAIL_TO_PASS pattern). Root commits, test-only commits, and fixtures over 200 files / 1 MB are rejected with clear errors.
|
|
164
|
+
|
|
165
|
+
Constraints for both importers: the verifier must run against the copied fixture **without a build step or installed dependencies** (a TypeScript repo that needs `tsc`, or tests that need `node_modules`, will not work as mined fixtures — narrow with `--include` or hand-port a self-contained slice instead). The manual path, for shaping a task by hand:
|
|
166
|
+
|
|
167
|
+
1. Pick one recurring, expensive task shape (reviewing a PR, migrating a module, writing a migration plan).
|
|
168
|
+
2. Shrink a real instance into `fixtures/<task-id>/` — keep the trap, drop everything else.
|
|
169
|
+
3. Write the prompt a teammate would write, in `prompts/<task-id>.md`.
|
|
170
|
+
4. Encode the acceptance criteria you would check by hand into `verifiers/<task-id>.mjs`. Exit code is the whole contract.
|
|
171
|
+
5. Record the seed answer in `ground-truth/` so future bench edits stay honest.
|
|
172
|
+
6. Dry-run: `skillfit eval <skill> --bench my-bench --dry-run`, inspect the planned call count, then a real run with the default 5 trials per condition. More trials do not compensate for too few distinct tasks.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"name": "code-review",
|
|
4
|
+
"description": "Review small pull requests against a spec and find the seeded defects; mixes in one non-review explanation task (explain-x1) as a negative trigger control.",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"id": "review-r1",
|
|
8
|
+
"fixture": "fixtures/review-r1",
|
|
9
|
+
"prompt": "prompts/review-r1.md",
|
|
10
|
+
"promptTrigger": "prompts/review-r1.trigger.md",
|
|
11
|
+
"verifier": "node verifiers/seeded-bugs.mjs",
|
|
12
|
+
"oracle": "node ground-truth/oracle-r1.mjs",
|
|
13
|
+
"rubric": "ground-truth/r1.md",
|
|
14
|
+
"shouldTrigger": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "review-r2",
|
|
18
|
+
"fixture": "fixtures/review-r2",
|
|
19
|
+
"prompt": "prompts/review-r2.md",
|
|
20
|
+
"promptTrigger": "prompts/review-r2.trigger.md",
|
|
21
|
+
"verifier": "node verifiers/review-r2.mjs",
|
|
22
|
+
"oracle": "node ground-truth/oracle-r2.mjs",
|
|
23
|
+
"rubric": "ground-truth/r2.md",
|
|
24
|
+
"shouldTrigger": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "review-r3",
|
|
28
|
+
"fixture": "fixtures/review-r3",
|
|
29
|
+
"prompt": "prompts/review-r3.md",
|
|
30
|
+
"promptTrigger": "prompts/review-r3.trigger.md",
|
|
31
|
+
"verifier": "node verifiers/review-r3.mjs",
|
|
32
|
+
"oracle": "node ground-truth/oracle-r3.mjs",
|
|
33
|
+
"rubric": "ground-truth/r3.md",
|
|
34
|
+
"shouldTrigger": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "explain-x1",
|
|
38
|
+
"fixture": "fixtures/explain-x1",
|
|
39
|
+
"prompt": "prompts/explain-x1.md",
|
|
40
|
+
"promptTrigger": "prompts/explain-x1.trigger.md",
|
|
41
|
+
"verifier": "node verifiers/explain-x1.mjs",
|
|
42
|
+
"oracle": "node ground-truth/oracle-x1.mjs",
|
|
43
|
+
"rubric": "ground-truth/x1.md",
|
|
44
|
+
"shouldTrigger": false
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "summarize-s1",
|
|
48
|
+
"fixture": "fixtures/summarize-s1",
|
|
49
|
+
"prompt": "prompts/summarize-s1.md",
|
|
50
|
+
"promptTrigger": "prompts/summarize-s1.trigger.md",
|
|
51
|
+
"verifier": "node verifiers/summarize-s1.mjs",
|
|
52
|
+
"oracle": "node ground-truth/oracle-summarize-s1.mjs",
|
|
53
|
+
"rubric": "ground-truth/summarize-s1.md",
|
|
54
|
+
"shouldTrigger": false
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseline": {
|
|
3
|
+
"output": "The library exports compactObject, which removes null, undefined, and empty-string values from an object, and countDropped, which reports how many keys that removes. The tests cover removing empty values, keeping falsy-but-meaningful values like 0 and false, and not mutating the input.",
|
|
4
|
+
"tokens": { "input": 900, "output": 70 }
|
|
5
|
+
},
|
|
6
|
+
"treatment": {
|
|
7
|
+
"output": "This repository is a tiny utility that compacts an object by stripping null, undefined, and empty-string values while keeping meaningful falsy values like 0 and false. The tests cover the removal rule, falsy retention, input purity, and the countDropped helper.",
|
|
8
|
+
"tokens": { "input": 1300, "output": 80 }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# compact-object specification
|
|
2
|
+
|
|
3
|
+
## §1 Purpose
|
|
4
|
+
`compactObject(obj)` returns a new object with every `null`, `undefined`, or empty-string value removed.
|
|
5
|
+
|
|
6
|
+
## §2 Empty values
|
|
7
|
+
Only `null`, `undefined`, and `''` count as empty. Falsy values such as `0` and `false` are meaningful and must be kept.
|
|
8
|
+
|
|
9
|
+
## §3 Purity
|
|
10
|
+
Exported functions never mutate their input; `compactObject` returns a new object.
|
|
11
|
+
|
|
12
|
+
## §4 Helpers
|
|
13
|
+
`countDropped(obj)` reports how many keys `compactObject` would remove.
|
|
14
|
+
|
|
15
|
+
## §5 Tests
|
|
16
|
+
Behavior is covered by the unit tests in `tests/compact.test.js`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function isEmptyValue(value) {
|
|
2
|
+
return value === null || value === undefined || value === '';
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function compactObject(obj) {
|
|
6
|
+
const result = {};
|
|
7
|
+
for (const key of Object.keys(obj)) {
|
|
8
|
+
const value = obj[key];
|
|
9
|
+
if (!isEmptyValue(value)) {
|
|
10
|
+
result[key] = value;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function countDropped(obj) {
|
|
17
|
+
return Object.keys(obj).length - Object.keys(compactObject(obj)).length;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { compactObject, countDropped } from '../src/compact.js';
|
|
4
|
+
|
|
5
|
+
test('compactObject removes null, undefined, and empty-string values', () => {
|
|
6
|
+
assert.deepEqual(compactObject({ a: 1, b: null, c: undefined, d: '' }), { a: 1 });
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test('compactObject keeps falsy values that are not empty', () => {
|
|
10
|
+
assert.deepEqual(compactObject({ a: 0, b: false }), { a: 0, b: false });
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('compactObject does not mutate its input; countDropped counts removed keys', () => {
|
|
14
|
+
const input = { a: null, b: 'x' };
|
|
15
|
+
compactObject(input);
|
|
16
|
+
assert.deepEqual(input, { a: null, b: 'x' });
|
|
17
|
+
assert.equal(countDropped(input), 1);
|
|
18
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseline": {
|
|
3
|
+
"output": "Findings:\n\n- high: src/order.js:25 throws a bare `Error` with no `code`; SPEC §1 requires every caller-facing error to be an `AppError`, and SPEC §5 mandates the code `INVALID_QUANTITY` for a negative quantity.\n- low: src/order.js:22-23 uses a C-style `for (let i = 0; ...)` loop while the rest of the file iterates with `for...of`.",
|
|
4
|
+
"tokens": { "input": 1800, "output": 120 }
|
|
5
|
+
},
|
|
6
|
+
"treatment": {
|
|
7
|
+
"output": "Findings:\n\n- high: src/order.js:25 throws a bare `Error` with no `code`; SPEC §1 requires `AppError` and SPEC §5 mandates `INVALID_QUANTITY` for negative quantities.\n- high: src/order.js:30 `item.qty > 10` should be `>= 10`: SPEC §4 grants the 5% bulk discount at quantity 10, but with the strict comparison a line with qty = 10 pays full price.\n- medium: `applyBulkDiscount` is a new exported function with new branches, yet the PR adds nothing under `tests/`; SPEC §2 requires unit tests for it.",
|
|
8
|
+
"tokens": { "input": 2600, "output": 200 }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
diff --git a/src/money.js b/src/money.js
|
|
2
|
+
--- a/src/money.js
|
|
3
|
+
+++ b/src/money.js
|
|
4
|
+
@@ -1,3 +1,7 @@
|
|
5
|
+
export function roundCents(value) {
|
|
6
|
+
return Math.round(value * 100) / 100;
|
|
7
|
+
}
|
|
8
|
+
+
|
|
9
|
+
+export function percentOff(amount, percent) {
|
|
10
|
+
+ return roundCents(amount * (percent / 100));
|
|
11
|
+
+}
|
|
12
|
+
diff --git a/src/order.js b/src/order.js
|
|
13
|
+
--- a/src/order.js
|
|
14
|
+
+++ b/src/order.js
|
|
15
|
+
@@ -10,4 +10,27 @@ export function orderTotal(items) {
|
|
16
|
+
total += lineTotal(item);
|
|
17
|
+
}
|
|
18
|
+
return total;
|
|
19
|
+
}
|
|
20
|
+
+
|
|
21
|
+
+// Returns a new list of items with bulk-discount pricing applied.
|
|
22
|
+
+export function applyBulkDiscount(items) {
|
|
23
|
+
+ const discounted = [];
|
|
24
|
+
+ if (items.length === 0) {
|
|
25
|
+
+ return discounted;
|
|
26
|
+
+ }
|
|
27
|
+
+
|
|
28
|
+
+ for (let i = 0; i < items.length; i++) {
|
|
29
|
+
+ const item = items[i];
|
|
30
|
+
+ if (item.qty < 0) {
|
|
31
|
+
+ throw new Error('invalid quantity: ' + item.qty);
|
|
32
|
+
+ }
|
|
33
|
+
+ let unitPrice = item.price;
|
|
34
|
+
+ if (item.qty === 0) {
|
|
35
|
+
+ unitPrice = 0;
|
|
36
|
+
+ } else if (item.qty > 10) {
|
|
37
|
+
+ unitPrice = roundCents(unitPrice * 0.95);
|
|
38
|
+
+ }
|
|
39
|
+
+ discounted.push({ ...item, price: unitPrice });
|
|
40
|
+
+ }
|
|
41
|
+
+ return discounted;
|
|
42
|
+
+}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Pricing service specification
|
|
2
|
+
|
|
3
|
+
## §1 Error surface
|
|
4
|
+
Every error thrown by an exported function must be an `AppError` (`src/errors.js`) carrying a stable `code` string. Never throw a bare `Error` or `TypeError` at the caller-facing surface.
|
|
5
|
+
|
|
6
|
+
## §2 Tests
|
|
7
|
+
Every new exported function must ship with unit tests under `tests/` that cover its new branches.
|
|
8
|
+
|
|
9
|
+
## §3 Money math
|
|
10
|
+
Public money values pass through `roundCents` (`src/money.js`) exactly once before being returned.
|
|
11
|
+
|
|
12
|
+
## §4 Bulk discount
|
|
13
|
+
Order lines with quantity **>= 10** receive a 5% unit-price discount. Quantities below 10 pay full price. Lines with quantity 0 are free.
|
|
14
|
+
|
|
15
|
+
## §5 Invalid quantities
|
|
16
|
+
A negative quantity is rejected with an `AppError` whose code is `INVALID_QUANTITY`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { roundCents } from './money.js';
|
|
2
|
+
|
|
3
|
+
export function lineTotal(item) {
|
|
4
|
+
return roundCents(item.price * item.qty);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function orderTotal(items) {
|
|
8
|
+
let total = 0;
|
|
9
|
+
for (const item of items) {
|
|
10
|
+
total += lineTotal(item);
|
|
11
|
+
}
|
|
12
|
+
return total;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { lineTotal, orderTotal } from '../src/order.js';
|
|
4
|
+
|
|
5
|
+
test('lineTotal multiplies price by quantity', () => {
|
|
6
|
+
assert.equal(lineTotal({ price: 10, qty: 3 }), 30);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test('orderTotal sums line totals', () => {
|
|
10
|
+
assert.equal(
|
|
11
|
+
orderTotal([
|
|
12
|
+
{ price: 10, qty: 1 },
|
|
13
|
+
{ price: 5, qty: 2 },
|
|
14
|
+
]),
|
|
15
|
+
20,
|
|
16
|
+
);
|
|
17
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseline": {
|
|
3
|
+
"output": "Findings:\n\n- medium: src/invoice.js:33 `line.qty = 1` mutates the caller's line objects in place, violating SPEC §2 (purity); return new objects instead.",
|
|
4
|
+
"tokens": { "input": 1900, "output": 100 }
|
|
5
|
+
},
|
|
6
|
+
"treatment": {
|
|
7
|
+
"output": "Findings:\n\n- high: src/invoice.js:20 throws an `AppError` with code `QTY_NEGATIVE`, which is not in SPEC §1's stable-code table even though the table already defines `INVALID_QUANTITY` for exactly this case.\n- high: src/invoice.js:22 rounds the per-line unit price with `roundCents` before `subtotal` multiplies it by quantity, while SPEC §3 requires intermediate unit prices to stay at full precision and be rounded once in the final amount.\n- medium: src/invoice.js:33 `line.qty = 1` mutates the caller's line objects, violating SPEC §2 purity; return new objects instead.",
|
|
8
|
+
"tokens": { "input": 2700, "output": 220 }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
diff --git a/src/invoice.js b/src/invoice.js
|
|
2
|
+
--- a/src/invoice.js
|
|
3
|
+
+++ b/src/invoice.js
|
|
4
|
+
@@ -1,4 +1,5 @@
|
|
5
|
+
import { roundCents } from './money.js';
|
|
6
|
+
+import { AppError } from './errors.js';
|
|
7
|
+
|
|
8
|
+
export function subtotal(lines) {
|
|
9
|
+
let sum = 0;
|
|
10
|
+
@@ -7,3 +8,30 @@ export function subtotal(lines) {
|
|
11
|
+
}
|
|
12
|
+
return sum;
|
|
13
|
+
}
|
|
14
|
+
+
|
|
15
|
+
+// Applies per-line tax and returns new lines sorted by taxed unit price, descending.
|
|
16
|
+
+export function applyLineTax(lines, taxRate) {
|
|
17
|
+
+ if (!taxRate || taxRate <= 0) {
|
|
18
|
+
+ throw new AppError('INVALID_RATE', 'taxRate must be positive');
|
|
19
|
+
+ }
|
|
20
|
+
+ const taxed = [];
|
|
21
|
+
+ for (const line of lines) {
|
|
22
|
+
+ if (line.qty < 0) {
|
|
23
|
+
+ throw new AppError('QTY_NEGATIVE', 'negative quantity');
|
|
24
|
+
+ }
|
|
25
|
+
+ const unitWithTax = roundCents(line.unitPrice * (1 + taxRate));
|
|
26
|
+
+ taxed.push({ ...line, unitPrice: unitWithTax });
|
|
27
|
+
+ }
|
|
28
|
+
+ taxed.sort((a, b) => b.unitPrice - a.unitPrice);
|
|
29
|
+
+ return taxed;
|
|
30
|
+
+}
|
|
31
|
+
+
|
|
32
|
+
+// Fills in missing quantities with the default of 1.
|
|
33
|
+
+export function normalizeQuantities(lines) {
|
|
34
|
+
+ for (const line of lines) {
|
|
35
|
+
+ if (line.qty == null) {
|
|
36
|
+
+ line.qty = 1;
|
|
37
|
+
+ }
|
|
38
|
+
+ }
|
|
39
|
+
+ return lines;
|
|
40
|
+
+}
|
|
41
|
+
diff --git a/src/money.js b/src/money.js
|
|
42
|
+
--- a/src/money.js
|
|
43
|
+
+++ b/src/money.js
|
|
44
|
+
@@ -1,3 +1,7 @@
|
|
45
|
+
export function roundCents(value) {
|
|
46
|
+
return Math.round(value * 100) / 100;
|
|
47
|
+
}
|
|
48
|
+
+
|
|
49
|
+
+export function formatCents(amount) {
|
|
50
|
+
+ return roundCents(amount).toFixed(2);
|
|
51
|
+
+}
|
|
52
|
+
diff --git a/tests/invoice.test.js b/tests/invoice.test.js
|
|
53
|
+
--- a/tests/invoice.test.js
|
|
54
|
+
+++ b/tests/invoice.test.js
|
|
55
|
+
@@ -1,6 +1,7 @@
|
|
56
|
+
import { test } from 'node:test';
|
|
57
|
+
import assert from 'node:assert/strict';
|
|
58
|
+
-import { subtotal } from '../src/invoice.js';
|
|
59
|
+
+import { applyLineTax, normalizeQuantities, subtotal } from '../src/invoice.js';
|
|
60
|
+
+import { formatCents } from '../src/money.js';
|
|
61
|
+
|
|
62
|
+
test('subtotal sums line amounts', () => {
|
|
63
|
+
assert.equal(
|
|
64
|
+
@@ -11,3 +12,17 @@ test('subtotal sums line amounts', () => {
|
|
65
|
+
20,
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
+
|
|
69
|
+
+test('applyLineTax applies the rate to each line', () => {
|
|
70
|
+
+ const taxed = applyLineTax([{ unitPrice: 10, qty: 2 }], 0.1);
|
|
71
|
+
+ assert.equal(taxed[0]?.unitPrice, 11);
|
|
72
|
+
+});
|
|
73
|
+
+
|
|
74
|
+
+test('normalizeQuantities defaults missing qty to 1', () => {
|
|
75
|
+
+ const [line] = normalizeQuantities([{ unitPrice: 2 }]);
|
|
76
|
+
+ assert.equal(line?.qty, 1);
|
|
77
|
+
+});
|
|
78
|
+
+
|
|
79
|
+
+test('formatCents formats a rounded amount', () => {
|
|
80
|
+
+ assert.equal(formatCents(11.1), '11.10');
|
|
81
|
+
+});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Invoice service specification
|
|
2
|
+
|
|
3
|
+
## §1 Error surface
|
|
4
|
+
Every error thrown by an exported function must be an `AppError` (`src/errors.js`) whose `code` appears in the stable-code table below. Codes are part of the public API; introducing or renaming a code requires a spec amendment.
|
|
5
|
+
|
|
6
|
+
| Code | Meaning |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| `INVALID_QUANTITY` | A line quantity is negative or non-numeric. |
|
|
9
|
+
| `INVALID_RATE` | A tax or conversion rate is missing or non-positive. |
|
|
10
|
+
| `EMPTY_INVOICE` | Totals were requested for an invoice with no lines. |
|
|
11
|
+
|
|
12
|
+
## §2 Purity
|
|
13
|
+
Exported functions must not mutate their arguments or any object reachable from them. Return new objects and arrays instead.
|
|
14
|
+
|
|
15
|
+
## §3 Money math
|
|
16
|
+
A public money amount passes through `roundCents` (`src/money.js`) exactly once, at the point the final amount is produced. Intermediate factors — unit prices, tax rates, quantities — are combined at full precision and rounded only when the final amount is computed. In particular, a per-line unit price is an intermediate value and must stay unrounded, so that `subtotal` rounds each line amount exactly once.
|
|
17
|
+
|
|
18
|
+
## §4 Tax
|
|
19
|
+
`applyLineTax` multiplies each unit price by `1 + taxRate`. A missing or non-positive `taxRate` is rejected with an `AppError` whose code is `INVALID_RATE`.
|
|
20
|
+
|
|
21
|
+
## §5 Tests
|
|
22
|
+
Every new exported function must ship with unit tests under `tests/`.
|
|
23
|
+
|
|
24
|
+
## §6 Scope
|
|
25
|
+
Only defects introduced by the pull request under review count. Pre-existing code outside the diff is out of scope.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { subtotal } from '../src/invoice.js';
|
|
4
|
+
|
|
5
|
+
test('subtotal sums line amounts', () => {
|
|
6
|
+
assert.equal(
|
|
7
|
+
subtotal([
|
|
8
|
+
{ unitPrice: 10, qty: 1 },
|
|
9
|
+
{ unitPrice: 5, qty: 2 },
|
|
10
|
+
]),
|
|
11
|
+
20,
|
|
12
|
+
);
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseline": {
|
|
3
|
+
"output": "Findings:\n\n- low: src/pricing.js:34 `formatOrder` returns a string, so callers expecting a numeric total may break.",
|
|
4
|
+
"tokens": { "input": 2100, "output": 90 }
|
|
5
|
+
},
|
|
6
|
+
"treatment": {
|
|
7
|
+
"output": "Findings:\n\n- high: src/pricing.js:25 `orderTotal` no longer throws `AppError` with code `EMPTY_ORDER` for an empty order — SPEC §4 requires it, and the PR also deletes the covering test in `tests/pricing.test.js`, so the regression escapes CI.\n- high: src/pricing.js:13 `effectiveUnitPrice` applies the 5% bulk discount on top of the promotional price, but SPEC §3 says a promotional price replaces the list price and is never itself discounted; only lines without a `promoPrice` are bulk-eligible.",
|
|
8
|
+
"tokens": { "input": 2900, "output": 210 }
|
|
9
|
+
}
|
|
10
|
+
}
|