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.
Files changed (371) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -2
  3. package/README.zh-CN.md +224 -0
  4. package/benches/README.md +172 -0
  5. package/benches/code-review/bench.json +57 -0
  6. package/benches/code-review/fixtures/explain-x1/.skillfit-mock.json +10 -0
  7. package/benches/code-review/fixtures/explain-x1/SPEC.md +16 -0
  8. package/benches/code-review/fixtures/explain-x1/src/compact.js +18 -0
  9. package/benches/code-review/fixtures/explain-x1/tests/compact.test.js +18 -0
  10. package/benches/code-review/fixtures/review-r1/.skillfit-mock.json +10 -0
  11. package/benches/code-review/fixtures/review-r1/CHANGES.diff +42 -0
  12. package/benches/code-review/fixtures/review-r1/SPEC.md +16 -0
  13. package/benches/code-review/fixtures/review-r1/src/errors.js +7 -0
  14. package/benches/code-review/fixtures/review-r1/src/money.js +3 -0
  15. package/benches/code-review/fixtures/review-r1/src/order.js +13 -0
  16. package/benches/code-review/fixtures/review-r1/tests/order.test.js +17 -0
  17. package/benches/code-review/fixtures/review-r2/.skillfit-mock.json +10 -0
  18. package/benches/code-review/fixtures/review-r2/CHANGES.diff +81 -0
  19. package/benches/code-review/fixtures/review-r2/SPEC.md +25 -0
  20. package/benches/code-review/fixtures/review-r2/src/errors.js +7 -0
  21. package/benches/code-review/fixtures/review-r2/src/invoice.js +9 -0
  22. package/benches/code-review/fixtures/review-r2/src/money.js +3 -0
  23. package/benches/code-review/fixtures/review-r2/tests/invoice.test.js +13 -0
  24. package/benches/code-review/fixtures/review-r3/.skillfit-mock.json +10 -0
  25. package/benches/code-review/fixtures/review-r3/CHANGES.diff +76 -0
  26. package/benches/code-review/fixtures/review-r3/SPEC.md +24 -0
  27. package/benches/code-review/fixtures/review-r3/src/errors.js +7 -0
  28. package/benches/code-review/fixtures/review-r3/src/money.js +3 -0
  29. package/benches/code-review/fixtures/review-r3/src/pricing.js +20 -0
  30. package/benches/code-review/fixtures/review-r3/tests/pricing.test.js +15 -0
  31. package/benches/code-review/fixtures/summarize-s1/.skillfit-mock.json +16 -0
  32. package/benches/code-review/fixtures/summarize-s1/CHANGES.diff +27 -0
  33. package/benches/code-review/fixtures/summarize-s1/SPEC.md +15 -0
  34. package/benches/code-review/fixtures/summarize-s1/src/discount.js +20 -0
  35. package/benches/code-review/fixtures/summarize-s1/src/errors.js +7 -0
  36. package/benches/code-review/fixtures/summarize-s1/src/money.js +7 -0
  37. package/benches/code-review/ground-truth/oracle-r1.mjs +21 -0
  38. package/benches/code-review/ground-truth/oracle-r2.mjs +21 -0
  39. package/benches/code-review/ground-truth/oracle-r3.mjs +20 -0
  40. package/benches/code-review/ground-truth/oracle-summarize-s1.mjs +21 -0
  41. package/benches/code-review/ground-truth/oracle-x1.mjs +18 -0
  42. package/benches/code-review/ground-truth/r1.md +22 -0
  43. package/benches/code-review/ground-truth/r2.md +21 -0
  44. package/benches/code-review/ground-truth/r3.md +18 -0
  45. package/benches/code-review/ground-truth/summarize-s1.md +26 -0
  46. package/benches/code-review/ground-truth/x1.md +7 -0
  47. package/benches/code-review/prompts/explain-x1.md +5 -0
  48. package/benches/code-review/prompts/explain-x1.trigger.md +5 -0
  49. package/benches/code-review/prompts/review-r1.md +7 -0
  50. package/benches/code-review/prompts/review-r1.trigger.md +7 -0
  51. package/benches/code-review/prompts/review-r2.md +7 -0
  52. package/benches/code-review/prompts/review-r2.trigger.md +7 -0
  53. package/benches/code-review/prompts/review-r3.md +7 -0
  54. package/benches/code-review/prompts/review-r3.trigger.md +7 -0
  55. package/benches/code-review/prompts/summarize-s1.md +9 -0
  56. package/benches/code-review/prompts/summarize-s1.trigger.md +9 -0
  57. package/benches/code-review/verifiers/explain-x1.mjs +30 -0
  58. package/benches/code-review/verifiers/review-r2.mjs +66 -0
  59. package/benches/code-review/verifiers/review-r3.mjs +60 -0
  60. package/benches/code-review/verifiers/seeded-bugs.mjs +74 -0
  61. package/benches/code-review/verifiers/summarize-s1.mjs +80 -0
  62. package/benches/contrib/README.md +42 -0
  63. package/benches/contrib/oss-lru-cache/README.md +24 -0
  64. package/benches/contrib/oss-lru-cache/bench.json +37 -0
  65. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/LICENSE +15 -0
  66. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/README.md +3 -0
  67. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/index.js +1044 -0
  68. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/package.json +11 -0
  69. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/runtime.mjs +22 -0
  70. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/test.mjs +11 -0
  71. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/LICENSE.md +55 -0
  72. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/README.md +3 -0
  73. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/package.json +11 -0
  74. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/runtime.mjs +22 -0
  75. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-browser.ts +11 -0
  76. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-cjs.cts +11 -0
  77. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-esm.mts +29 -0
  78. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-node.ts +7 -0
  79. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel.ts +6 -0
  80. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/index.ts +3148 -0
  81. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/perf.ts +17 -0
  82. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/test.mjs +11 -0
  83. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/LICENSE +15 -0
  84. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/README.md +3 -0
  85. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/index.js +1028 -0
  86. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/package.json +11 -0
  87. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/runtime.mjs +22 -0
  88. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/test.mjs +11 -0
  89. package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort/LICENSE +15 -0
  90. package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort/index.js +1053 -0
  91. package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort.md +11 -0
  92. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/LICENSE.md +55 -0
  93. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-browser.ts +11 -0
  94. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-cjs.cts +11 -0
  95. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-esm.mts +29 -0
  96. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-node.ts +7 -0
  97. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel.ts +6 -0
  98. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/index.ts +3174 -0
  99. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/perf.ts +17 -0
  100. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle.md +11 -0
  101. package/benches/contrib/oss-lru-cache/ground-truth/fetch-size/LICENSE +15 -0
  102. package/benches/contrib/oss-lru-cache/ground-truth/fetch-size/index.js +1028 -0
  103. package/benches/contrib/oss-lru-cache/ground-truth/fetch-size.md +11 -0
  104. package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-abort.mjs +8 -0
  105. package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-lifecycle.mjs +7 -0
  106. package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-size.mjs +7 -0
  107. package/benches/contrib/oss-lru-cache/ground-truth/oracle.mjs +9 -0
  108. package/benches/contrib/oss-lru-cache/prompts/fetch-abort.md +5 -0
  109. package/benches/contrib/oss-lru-cache/prompts/fetch-lifecycle.md +5 -0
  110. package/benches/contrib/oss-lru-cache/prompts/fetch-size.md +5 -0
  111. package/benches/contrib/oss-lru-cache/provenance.json +62 -0
  112. package/benches/contrib/oss-lru-cache/runtime.mjs +22 -0
  113. package/benches/contrib/oss-lru-cache/verifiers/cases.mjs +74 -0
  114. package/benches/contrib/oss-lru-cache/verifiers/fetch-abort.mjs +3 -0
  115. package/benches/contrib/oss-lru-cache/verifiers/fetch-lifecycle.mjs +3 -0
  116. package/benches/contrib/oss-lru-cache/verifiers/fetch-size.mjs +3 -0
  117. package/benches/contrib/oss-lru-cache/verifiers/probe.mjs +14 -0
  118. package/benches/contrib/oss-lru-cache/verifiers/shared.mjs +130 -0
  119. package/benches/contrib/oss-lru-cache/verifiers/test-reporter.mjs +29 -0
  120. package/benches/contrib/oss-mcp-use-utf8/LICENSE.upstream +21 -0
  121. package/benches/contrib/oss-mcp-use-utf8/README.md +56 -0
  122. package/benches/contrib/oss-mcp-use-utf8/bench.json +16 -0
  123. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/LICENSE +21 -0
  124. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/package.json +3 -0
  125. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/src/ext-apps-bridge.js +3 -0
  126. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/src/resolve-view-resource.ts +96 -0
  127. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/test/basic.test.mjs +13 -0
  128. package/benches/contrib/oss-mcp-use-utf8/ground-truth/README.md +5 -0
  129. package/benches/contrib/oss-mcp-use-utf8/ground-truth/oracle-view-utf8.mjs +11 -0
  130. package/benches/contrib/oss-mcp-use-utf8/ground-truth/solutions/view-utf8/src/resolve-view-resource.ts +96 -0
  131. package/benches/contrib/oss-mcp-use-utf8/ground-truth/solutions/view-utf8/test/utf8.regression.test.mjs +14 -0
  132. package/benches/contrib/oss-mcp-use-utf8/prompts/view-utf8.md +8 -0
  133. package/benches/contrib/oss-mcp-use-utf8/verifiers/view-utf8.mjs +120 -0
  134. package/benches/contrib/waza-behavior/LICENSE.upstream +21 -0
  135. package/benches/contrib/waza-behavior/README.md +31 -0
  136. package/benches/contrib/waza-behavior/bench.json +10 -0
  137. package/benches/contrib/waza-behavior/fixtures/explicit-hold/README.md +1 -0
  138. package/benches/contrib/waza-behavior/fixtures/explicit-hold/notes.txt +1 -0
  139. package/benches/contrib/waza-behavior/fixtures/receipt-current/README.md +1 -0
  140. package/benches/contrib/waza-behavior/fixtures/receipt-current/docs/guide.md +2 -0
  141. package/benches/contrib/waza-behavior/fixtures/receipt-current/notes.txt +1 -0
  142. package/benches/contrib/waza-behavior/fixtures/receipt-current/scripts/check-links.mjs +16 -0
  143. package/benches/contrib/waza-behavior/fixtures/receipt-current/validation-receipt.json +10 -0
  144. package/benches/contrib/waza-behavior/fixtures/receipt-stale/README.md +1 -0
  145. package/benches/contrib/waza-behavior/fixtures/receipt-stale/docs/guide.md +3 -0
  146. package/benches/contrib/waza-behavior/fixtures/receipt-stale/notes.txt +1 -0
  147. package/benches/contrib/waza-behavior/fixtures/receipt-stale/scripts/check-links.mjs +16 -0
  148. package/benches/contrib/waza-behavior/fixtures/receipt-stale/validation-receipt.json +10 -0
  149. package/benches/contrib/waza-behavior/ground-truth/oracle.mjs +24 -0
  150. package/benches/contrib/waza-behavior/prompts/explicit-hold.md +1 -0
  151. package/benches/contrib/waza-behavior/prompts/receipt-current.md +1 -0
  152. package/benches/contrib/waza-behavior/prompts/receipt-stale.md +1 -0
  153. package/benches/contrib/waza-behavior/verifiers/behavior.mjs +59 -0
  154. package/benches/debugging/bench.json +93 -0
  155. package/benches/debugging/fixtures/async-queue/src/task-queue.mjs +50 -0
  156. package/benches/debugging/fixtures/async-queue/test/basic.test.mjs +18 -0
  157. package/benches/debugging/fixtures/chunked-decoder/src/frame-decoder.mjs +39 -0
  158. package/benches/debugging/fixtures/chunked-decoder/test/basic.test.mjs +17 -0
  159. package/benches/debugging/fixtures/debug-redaction/src/debug-redaction.mjs +33 -0
  160. package/benches/debugging/fixtures/debug-redaction/test/basic.test.mjs +26 -0
  161. package/benches/debugging/fixtures/document-queue/.skillfit-mock.json +16 -0
  162. package/benches/debugging/fixtures/document-queue/src/task-queue.mjs +52 -0
  163. package/benches/debugging/fixtures/document-queue/test/basic.test.mjs +23 -0
  164. package/benches/debugging/fixtures/explain-cache/.skillfit-mock.json +16 -0
  165. package/benches/debugging/fixtures/explain-cache/src/ttl-cache.mjs +31 -0
  166. package/benches/debugging/fixtures/explain-cache/test/basic.test.mjs +28 -0
  167. package/benches/debugging/fixtures/feat-slug/test/slug.test.mjs +15 -0
  168. package/benches/debugging/fixtures/range-parser/src/range-parser.mjs +9 -0
  169. package/benches/debugging/fixtures/range-parser/test/basic.test.mjs +8 -0
  170. package/benches/debugging/fixtures/ttl-cache/src/ttl-cache.mjs +30 -0
  171. package/benches/debugging/fixtures/ttl-cache/test/basic.test.mjs +11 -0
  172. package/benches/debugging/ground-truth/async-queue.md +81 -0
  173. package/benches/debugging/ground-truth/chunked-decoder.md +91 -0
  174. package/benches/debugging/ground-truth/debug-redaction.md +113 -0
  175. package/benches/debugging/ground-truth/document-queue.md +24 -0
  176. package/benches/debugging/ground-truth/explain-cache.md +22 -0
  177. package/benches/debugging/ground-truth/feat-slug.md +45 -0
  178. package/benches/debugging/ground-truth/oracle-async-queue.mjs +14 -0
  179. package/benches/debugging/ground-truth/oracle-chunked-decoder.mjs +14 -0
  180. package/benches/debugging/ground-truth/oracle-debug-redaction.mjs +30 -0
  181. package/benches/debugging/ground-truth/oracle-document-queue.mjs +27 -0
  182. package/benches/debugging/ground-truth/oracle-explain-cache.mjs +28 -0
  183. package/benches/debugging/ground-truth/oracle-feat-slug.mjs +13 -0
  184. package/benches/debugging/ground-truth/oracle-range-parser.mjs +14 -0
  185. package/benches/debugging/ground-truth/oracle-ttl-cache.mjs +14 -0
  186. package/benches/debugging/ground-truth/range-parser.md +121 -0
  187. package/benches/debugging/ground-truth/solutions/async-queue/src/task-queue.mjs +52 -0
  188. package/benches/debugging/ground-truth/solutions/chunked-decoder/src/frame-decoder.mjs +50 -0
  189. package/benches/debugging/ground-truth/solutions/debug-redaction/src/debug-redaction.mjs +27 -0
  190. package/benches/debugging/ground-truth/solutions/debug-redaction/test/debug-leak.regression.test.mjs +27 -0
  191. package/benches/debugging/ground-truth/solutions/feat-slug/src/slug.mjs +6 -0
  192. package/benches/debugging/ground-truth/solutions/range-parser/src/range-parser.mjs +34 -0
  193. package/benches/debugging/ground-truth/solutions/range-parser/test/basic.test.mjs +26 -0
  194. package/benches/debugging/ground-truth/solutions/ttl-cache/src/ttl-cache.mjs +31 -0
  195. package/benches/debugging/ground-truth/ttl-cache.md +69 -0
  196. package/benches/debugging/prompts/async-queue.md +13 -0
  197. package/benches/debugging/prompts/async-queue.trigger.md +13 -0
  198. package/benches/debugging/prompts/chunked-decoder.md +13 -0
  199. package/benches/debugging/prompts/chunked-decoder.trigger.md +13 -0
  200. package/benches/debugging/prompts/debug-redaction.md +23 -0
  201. package/benches/debugging/prompts/debug-redaction.trigger.md +23 -0
  202. package/benches/debugging/prompts/document-queue.md +10 -0
  203. package/benches/debugging/prompts/document-queue.trigger.md +10 -0
  204. package/benches/debugging/prompts/explain-cache.md +10 -0
  205. package/benches/debugging/prompts/explain-cache.trigger.md +10 -0
  206. package/benches/debugging/prompts/feat-slug.md +3 -0
  207. package/benches/debugging/prompts/feat-slug.trigger.md +5 -0
  208. package/benches/debugging/prompts/range-parser.md +15 -0
  209. package/benches/debugging/prompts/range-parser.trigger.md +15 -0
  210. package/benches/debugging/prompts/ttl-cache.md +18 -0
  211. package/benches/debugging/prompts/ttl-cache.trigger.md +18 -0
  212. package/benches/debugging/verifiers/async-queue.mjs +221 -0
  213. package/benches/debugging/verifiers/chunked-decoder.mjs +208 -0
  214. package/benches/debugging/verifiers/debug-redaction.mjs +283 -0
  215. package/benches/debugging/verifiers/document-queue.mjs +52 -0
  216. package/benches/debugging/verifiers/explain-cache.mjs +62 -0
  217. package/benches/debugging/verifiers/feat-slug.mjs +127 -0
  218. package/benches/debugging/verifiers/range-parser.mjs +146 -0
  219. package/benches/debugging/verifiers/ttl-cache.mjs +111 -0
  220. package/dist/agents.js +26 -0
  221. package/dist/cli.js +310 -0
  222. package/dist/cli.test.js +76 -0
  223. package/dist/commands/bench.js +1035 -0
  224. package/dist/commands/bench.test.js +1061 -0
  225. package/dist/commands/bundle.js +334 -0
  226. package/dist/commands/bundle.test.js +142 -0
  227. package/dist/commands/confirm.js +39 -0
  228. package/dist/commands/doctor.js +399 -0
  229. package/dist/commands/doctor.test.js +280 -0
  230. package/dist/commands/eval-report.js +485 -0
  231. package/dist/commands/eval-report.test.js +306 -0
  232. package/dist/commands/eval.js +391 -0
  233. package/dist/commands/eval.test.js +446 -0
  234. package/dist/commands/install.js +653 -0
  235. package/dist/commands/install.test.js +555 -0
  236. package/dist/commands/mcp.js +20 -0
  237. package/dist/commands/report.js +78 -0
  238. package/dist/commands/report.test.js +110 -0
  239. package/dist/commands/setup.js +95 -0
  240. package/dist/commands/setup.test.js +150 -0
  241. package/dist/commands/upstream.js +210 -0
  242. package/dist/commands/upstream.test.js +139 -0
  243. package/dist/docs.test.js +154 -0
  244. package/dist/frontmatter.js +53 -0
  245. package/dist/frontmatter.test.js +49 -0
  246. package/dist/harness/bench.js +134 -0
  247. package/dist/harness/bench.test.js +109 -0
  248. package/dist/harness/bundle.js +46 -0
  249. package/dist/harness/bundle.test.js +71 -0
  250. package/dist/harness/constants.js +2 -0
  251. package/dist/harness/executors/api.js +68 -0
  252. package/dist/harness/executors/api.test.js +75 -0
  253. package/dist/harness/executors/cli.js +348 -0
  254. package/dist/harness/executors/cli.test.js +402 -0
  255. package/dist/harness/executors/mock.js +34 -0
  256. package/dist/harness/executors/mock.test.js +43 -0
  257. package/dist/harness/experiment-session.js +345 -0
  258. package/dist/harness/experiment-session.test.js +223 -0
  259. package/dist/harness/hash.js +29 -0
  260. package/dist/harness/installed-skill.js +78 -0
  261. package/dist/harness/installed-skill.test.js +162 -0
  262. package/dist/harness/judge.js +108 -0
  263. package/dist/harness/judge.test.js +181 -0
  264. package/dist/harness/kill-tree.js +43 -0
  265. package/dist/harness/kimi-usage.js +94 -0
  266. package/dist/harness/kimi-usage.test.js +62 -0
  267. package/dist/harness/oss-lru-cache.test.js +79 -0
  268. package/dist/harness/oss-regression-witness.test.js +89 -0
  269. package/dist/harness/prompt.js +57 -0
  270. package/dist/harness/prompt.test.js +48 -0
  271. package/dist/harness/receipts.js +297 -0
  272. package/dist/harness/receipts.test.js +148 -0
  273. package/dist/harness/report.js +225 -0
  274. package/dist/harness/report.test.js +297 -0
  275. package/dist/harness/runner.js +629 -0
  276. package/dist/harness/runner.test.js +555 -0
  277. package/dist/harness/stats.js +93 -0
  278. package/dist/harness/stats.test.js +124 -0
  279. package/dist/harness/target.js +90 -0
  280. package/dist/harness/target.test.js +60 -0
  281. package/dist/harness/trigger.js +368 -0
  282. package/dist/harness/trigger.test.js +249 -0
  283. package/dist/harness/types.js +1 -0
  284. package/dist/harness/verifier-summary.js +59 -0
  285. package/dist/harness/verifier-summary.test.js +99 -0
  286. package/dist/harness/waza-behavior.test.js +139 -0
  287. package/dist/invocation.js +21 -0
  288. package/dist/matrix/agents.json +200 -0
  289. package/dist/matrix/agents.schema.json +152 -0
  290. package/dist/mcp/probe.js +317 -0
  291. package/dist/mcp/probe.test.js +87 -0
  292. package/dist/version.js +4 -0
  293. package/docs/assets/skillfit-flow.en.svg +47 -0
  294. package/docs/assets/skillfit-flow.zh-CN.svg +47 -0
  295. package/docs/assets/skillfit-mark.svg +9 -0
  296. package/docs/audit-2026-09-24-triage.md +231 -0
  297. package/docs/audit-2026-09-24.md +876 -0
  298. package/docs/bench-authoring.md +407 -0
  299. package/docs/codex-upstream-audit.md +41 -0
  300. package/docs/config-experiments.md +119 -0
  301. package/docs/examples/bench-check.yml +32 -0
  302. package/docs/examples/eval-manifest.synthetic.json +61 -0
  303. package/docs/experiment-workflow.md +15 -0
  304. package/docs/first-real-eval.md +90 -0
  305. package/docs/growth-roadmap-2026-10.md +100 -0
  306. package/docs/installed-skill-evaluation.md +77 -0
  307. package/docs/metrics.md +318 -0
  308. package/docs/oss-task-evaluation.md +139 -0
  309. package/docs/plans/2026-10-01-oss-task-evaluation.md +73 -0
  310. package/docs/plans/2026-10-09-experiment-workflow.md +18 -0
  311. package/docs/plans/2026-10-09-grader-calibration-audit.md +13 -0
  312. package/docs/plans/2026-10-09-waza-resource-evaluation.md +46 -0
  313. package/docs/portable-codex.md +31 -0
  314. package/docs/reproducible-offline-example.md +29 -0
  315. package/docs/selectable-codex.md +41 -0
  316. package/docs/sharing-results.md +53 -0
  317. package/evidence/2026-07-skill-baseline.md +34 -0
  318. package/evidence/2026-09-22-codex-trigger-capture.md +36 -0
  319. package/evidence/2026-09-bench-calibration.md +46 -0
  320. package/evidence/2026-09-debugging-bench-exploratory.md +55 -0
  321. package/evidence/2026-09-debugging-hardening.md +42 -0
  322. package/evidence/2026-09-ocr-vs-code-review.md +31 -0
  323. package/evidence/2026-09-trigger-snapshot-correction.md +48 -0
  324. package/evidence/2026-10-01-codex-diagnosing-bugs-pilot.md +58 -0
  325. package/evidence/2026-10-01-oss-case-selection.md +42 -0
  326. package/evidence/2026-10-01-oss-workspace-smoke.md +110 -0
  327. package/evidence/README.md +47 -0
  328. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/README.md +27 -0
  329. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/artifact-index.json +118 -0
  330. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/output.md +5 -0
  331. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/prompt.txt +14 -0
  332. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/result.json +65 -0
  333. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/verifier.txt +2 -0
  334. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/LICENSE +21 -0
  335. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/package.json +3 -0
  336. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/src/ext-apps-bridge.js +3 -0
  337. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/src/resolve-view-resource.ts +100 -0
  338. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/test/basic.test.mjs +13 -0
  339. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/test/resolve-view-resource.test.mjs +102 -0
  340. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/manifest.json +206 -0
  341. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/original-console.txt +44 -0
  342. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/report.md +67 -0
  343. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/output.md +5 -0
  344. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/prompt.txt +163 -0
  345. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/result.json +65 -0
  346. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/verifier.txt +2 -0
  347. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/LICENSE +21 -0
  348. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/package.json +3 -0
  349. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/src/ext-apps-bridge.js +3 -0
  350. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/src/resolve-view-resource.ts +100 -0
  351. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/test/basic.test.mjs +13 -0
  352. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/test/resolve-view-resource.test.mjs +136 -0
  353. package/evidence/inputs/README.md +15 -0
  354. package/evidence/inputs/diagnosing-bugs/LICENSE +21 -0
  355. package/evidence/inputs/diagnosing-bugs/SKILL.md +138 -0
  356. package/evidence/inputs/diagnosing-bugs/agents/openai.yaml +3 -0
  357. package/evidence/inputs/diagnosing-bugs/scripts/hitl-loop.template.sh +44 -0
  358. package/evidence/plans/2026-10-01-oss-workspace-smoke.json +29 -0
  359. package/package.json +47 -4
  360. package/profiles/codex-curated/catalog.json +28 -0
  361. package/profiles/codex-curated/profile.json +282 -0
  362. package/profiles/codex-curated/rules/global.md +12 -0
  363. package/profiles/codex-curated/skills/autonomous-iteration/SKILL.md +75 -0
  364. package/profiles/codex-curated/skills/autonomous-iteration/agents/openai.yaml +4 -0
  365. package/profiles/codex-curated/skills/vibe-coding/SKILL.md +45 -0
  366. package/profiles/codex-curated/skills/vibe-coding/agents/openai.yaml +4 -0
  367. package/profiles/codex-upstream-sources.json +2980 -0
  368. package/profiles/recommended/profile.json +12 -0
  369. package/profiles/recommended/rules/core-workflow.md +41 -0
  370. package/profiles/recommended/skills/commit-message/SKILL.md +18 -0
  371. package/skills/skillfit/SKILL.md +60 -0
@@ -0,0 +1,139 @@
1
+ import assert from 'node:assert/strict';
2
+ import { createHash } from 'node:crypto';
3
+ import { promises as fs } from 'node:fs';
4
+ import * as os from 'node:os';
5
+ import * as path from 'node:path';
6
+ import test from 'node:test';
7
+ import { prepareUpstreamProfile, readUpstreamLock } from './upstream.js';
8
+ const body = '---\nname: remote-skill\ndescription: Remote tasks.\n---\nUse this skill.\n';
9
+ const hash = createHash('sha256').update(body).digest('hex');
10
+ const metadata = 'policy:\n allow_implicit_invocation: false\n';
11
+ const metadataHash = createHash('sha256').update(metadata).digest('hex');
12
+ const commit = 'a'.repeat(40);
13
+ test('prepares a mixed portable profile from pinned GitHub files', async (t) => {
14
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'skillfit-upstream-test-'));
15
+ t.after(async () => fs.rm(root, { recursive: true, force: true }));
16
+ const bundle = path.join(root, 'personal-codex');
17
+ await fs.mkdir(path.join(bundle, 'rules'), { recursive: true });
18
+ await fs.mkdir(path.join(bundle, 'skills', 'local-skill'), { recursive: true });
19
+ await fs.writeFile(path.join(bundle, 'rules', 'global.md'), 'Use relevant Skills.\n');
20
+ await fs.writeFile(path.join(bundle, 'skills', 'local-skill', 'SKILL.md'), '---\nname: local-skill\ndescription: Local tasks.\n---\nUse locally.\n');
21
+ await fs.writeFile(path.join(bundle, 'profile.json'), JSON.stringify({
22
+ name: 'personal-codex', version: '1.0.0', agents: ['codex'], scope: 'user',
23
+ rules: { template: 'rules/global.md' },
24
+ skills: [{ name: 'local-skill', source: 'skills/local-skill' }, { name: 'remote-skill', source: 'skills/remote-skill' }],
25
+ }));
26
+ await fs.writeFile(path.join(bundle, 'upstream.lock.json'), JSON.stringify({ version: 1, skills: [{
27
+ name: 'remote-skill', repo: 'owner/repo', commit, path: 'skills/remote-skill',
28
+ files: [{ path: 'SKILL.md', sha256: hash }, { path: 'agents/openai.yaml', sha256: metadataHash }], explicitOnly: true,
29
+ }] }));
30
+ const requested = [];
31
+ const prepared = await prepareUpstreamProfile(bundle, {
32
+ fetcher: async (url) => {
33
+ requested.push(String(url));
34
+ return new Response(String(url).endsWith('/SKILL.md') ? body : metadata, { status: 200 });
35
+ },
36
+ });
37
+ try {
38
+ assert.deepEqual(requested, [
39
+ `https://raw.githubusercontent.com/owner/repo/${commit}/skills/remote-skill/SKILL.md`,
40
+ `https://raw.githubusercontent.com/owner/repo/${commit}/skills/remote-skill/agents/openai.yaml`,
41
+ ]);
42
+ assert.equal(await fs.readFile(path.join(prepared.profileDir, 'skills', 'remote-skill', 'SKILL.md'), 'utf8'), body);
43
+ assert.match(await fs.readFile(path.join(prepared.profileDir, 'skills', 'local-skill', 'SKILL.md'), 'utf8'), /Use locally/);
44
+ }
45
+ finally {
46
+ await prepared.cleanup();
47
+ }
48
+ await assert.rejects(fs.stat(prepared.profileDir), { code: 'ENOENT' });
49
+ const lockPath = path.join(bundle, 'upstream.lock.json');
50
+ const inconsistent = JSON.parse(await fs.readFile(lockPath, 'utf8'));
51
+ delete inconsistent.skills[0]?.explicitOnly;
52
+ await fs.writeFile(lockPath, JSON.stringify(inconsistent));
53
+ await assert.rejects(prepareUpstreamProfile(bundle, {
54
+ fetcher: async (url) => new Response(String(url).endsWith('/SKILL.md') ? body : metadata, { status: 200 }),
55
+ }), /Invocation policy mismatch/);
56
+ });
57
+ test('rejects unpinned, unsafe, or tampered upstream records before installation', async (t) => {
58
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'skillfit-upstream-invalid-'));
59
+ t.after(async () => fs.rm(root, { recursive: true, force: true }));
60
+ const file = path.join(root, 'upstream.lock.json');
61
+ const record = { name: 'remote-skill', repo: 'owner/repo', commit, path: 'skills/remote-skill', files: [{ path: 'SKILL.md', sha256: hash }] };
62
+ for (const bad of [
63
+ { ...record, commit: 'main' },
64
+ { ...record, path: '../escape' },
65
+ { ...record, files: [{ path: '../outside', sha256: hash }] },
66
+ { ...record, files: [{ path: 'SKILL.md', sha256: 'bad' }] },
67
+ { ...record, files: [{ path: 'SKILL.md', sha256: hash }, { path: 'old.skillfit-bak', sha256: hash }] },
68
+ ]) {
69
+ await fs.writeFile(file, JSON.stringify({ version: 1, skills: [bad] }));
70
+ await assert.rejects(readUpstreamLock(file));
71
+ }
72
+ });
73
+ test('cleans partial downloads when a later upstream file is unavailable', async (t) => {
74
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'skillfit-upstream-partial-'));
75
+ t.after(async () => fs.rm(root, { recursive: true, force: true }));
76
+ const bundle = path.join(root, 'portable');
77
+ const tempRoot = path.join(root, 'scratch');
78
+ await fs.mkdir(bundle);
79
+ await fs.mkdir(tempRoot);
80
+ await fs.writeFile(path.join(bundle, 'profile.json'), JSON.stringify({
81
+ name: 'portable', version: '1.0.0', agents: ['codex'], scope: 'user',
82
+ skills: [{ name: 'remote-skill', source: 'skills/remote-skill' }],
83
+ }));
84
+ await fs.writeFile(path.join(bundle, 'upstream.lock.json'), JSON.stringify({ version: 1, skills: [{
85
+ name: 'remote-skill', repo: 'owner/repo', commit, path: 'skills/remote-skill',
86
+ files: [{ path: 'SKILL.md', sha256: hash }, { path: 'references/missing.md', sha256: hash }],
87
+ }] }));
88
+ await assert.rejects(prepareUpstreamProfile(bundle, {
89
+ tempRoot,
90
+ fetcher: async (url) => String(url).endsWith('/SKILL.md')
91
+ ? new Response(body, { status: 200 })
92
+ : new Response('not found', { status: 404 }),
93
+ }), /download failed/);
94
+ assert.deepEqual(await fs.readdir(tempRoot), []);
95
+ });
96
+ test('refuses a changed upstream file before creating any installable profile', async (t) => {
97
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'skillfit-upstream-tampered-'));
98
+ t.after(async () => fs.rm(root, { recursive: true, force: true }));
99
+ const bundle = path.join(root, 'portable');
100
+ await fs.mkdir(bundle);
101
+ await fs.writeFile(path.join(bundle, 'profile.json'), JSON.stringify({
102
+ name: 'portable', version: '1.0.0', agents: ['codex'], scope: 'user',
103
+ skills: [{ name: 'remote-skill', source: 'skills/remote-skill' }],
104
+ }));
105
+ await fs.writeFile(path.join(bundle, 'upstream.lock.json'), JSON.stringify({ version: 1, skills: [{
106
+ name: 'remote-skill', repo: 'owner/repo', commit, path: 'skills/remote-skill',
107
+ files: [{ path: 'SKILL.md', sha256: hash }],
108
+ }] }));
109
+ await assert.rejects(prepareUpstreamProfile(bundle, { fetcher: async () => new Response('changed', { status: 200 }) }), /SHA-256 mismatch/);
110
+ await assert.rejects(fs.stat(path.join(root, 'skills')), { code: 'ENOENT' });
111
+ });
112
+ test('retries transient upstream connection failures', async (t) => {
113
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'skillfit-upstream-retry-'));
114
+ t.after(async () => fs.rm(root, { recursive: true, force: true }));
115
+ const bundle = path.join(root, 'portable');
116
+ await fs.mkdir(bundle);
117
+ await fs.writeFile(path.join(bundle, 'profile.json'), JSON.stringify({
118
+ name: 'portable', version: '1.0.0', agents: ['codex'], scope: 'user',
119
+ skills: [{ name: 'remote-skill', source: 'skills/remote-skill' }],
120
+ }));
121
+ await fs.writeFile(path.join(bundle, 'upstream.lock.json'), JSON.stringify({ version: 1, skills: [{
122
+ name: 'remote-skill', repo: 'owner/repo', commit, path: 'skills/remote-skill',
123
+ files: [{ path: 'SKILL.md', sha256: hash }],
124
+ }] }));
125
+ let attempts = 0;
126
+ const prepared = await prepareUpstreamProfile(bundle, { fetcher: async () => {
127
+ attempts++;
128
+ if (attempts === 1)
129
+ throw new Error('transient network failure');
130
+ return new Response(body, { status: 200 });
131
+ } });
132
+ try {
133
+ assert.equal(attempts, 2);
134
+ assert.equal(await fs.readFile(path.join(prepared.profileDir, 'skills', 'remote-skill', 'SKILL.md'), 'utf8'), body);
135
+ }
136
+ finally {
137
+ await prepared.cleanup();
138
+ }
139
+ });
@@ -0,0 +1,154 @@
1
+ import assert from 'node:assert/strict';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { dirname, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { test } from 'node:test';
6
+ const PACKAGE_ROOT = fileURLToPath(new URL('..', import.meta.url));
7
+ const GUIDE = 'docs/bench-authoring.md';
8
+ const READMES = ['README.md', 'README.zh-CN.md'];
9
+ function read(rel) {
10
+ return readFileSync(resolve(PACKAGE_ROOT, rel), 'utf8');
11
+ }
12
+ // AGENTS.md requires the English and Simplified Chinese READMEs to mirror each other section by
13
+ // section. A link added to one and forgotten in the other is the drift these checks prevent.
14
+ test('the bench authoring guide is linked from every README and every entry point', () => {
15
+ for (const readme of READMES) {
16
+ assert.match(read(readme), /\(docs\/bench-authoring\.md\)/, `${readme} must link the guide`);
17
+ }
18
+ for (const doc of ['benches/README.md', 'benches/contrib/README.md', 'docs/metrics.md', 'CONTRIBUTING.md']) {
19
+ assert.match(read(doc), /bench-authoring\.md\)/, `${doc} must link the guide`);
20
+ }
21
+ });
22
+ test('portable Codex setup is linked and its command block matches across README languages', () => {
23
+ const normalized = (file) => read(file).replace(/\r\n/g, '\n');
24
+ const english = normalized('README.md');
25
+ const commandBlock = /```bash\nnode dist\/cli\.js bundle export \.\/personal-codex --dry-run[\s\S]*?node \.\/personal-codex\/setup\.mjs --yes\n```/.exec(english)?.[0];
26
+ assert.ok(commandBlock);
27
+ for (const readme of READMES) {
28
+ const content = normalized(readme);
29
+ assert.match(content, /\(docs\/portable-codex\.md\)/, `${readme} must link the portable setup guide`);
30
+ assert.ok(content.includes(commandBlock), `${readme} must use the same setup commands`);
31
+ }
32
+ });
33
+ test('selectable Codex setup commands match across README languages', () => {
34
+ const normalized = (file) => read(file).replace(/\r\n/g, '\n');
35
+ const english = normalized('README.md');
36
+ const commandBlock = /```bash\nnode dist\/cli\.js setup codex --list[\s\S]*?node dist\/cli\.js setup codex --skill vibe-coding --skill diagnosing-bugs --yes\n```/.exec(english)?.[0];
37
+ assert.ok(commandBlock);
38
+ for (const readme of READMES) {
39
+ const content = normalized(readme);
40
+ assert.match(content, /\(docs\/selectable-codex\.md\)/, `${readme} must link the selectable setup guide`);
41
+ assert.ok(content.includes(commandBlock), `${readme} must use the same selectable setup commands`);
42
+ }
43
+ });
44
+ test('the first-run commands work in Bash and PowerShell and match across README languages', () => {
45
+ const normalized = (file) => read(file).replace(/\r\n/g, '\n');
46
+ const english = normalized('README.md');
47
+ const commandBlock = /```bash\ngit clone https:\/\/github\.com\/remote-controlled-man\/skillfit\.git\ncd skillfit[\s\S]*?node dist\/cli\.js install --agent codex --dry-run\n```/.exec(english)?.[0];
48
+ assert.ok(commandBlock);
49
+ const commands = commandBlock.split('\n').slice(1, -1).join('\n');
50
+ assert.doesNotMatch(commands, /\b(?:bash|cp)\s|~\/|some-skill|my-server\.probe\.json/);
51
+ for (const readme of READMES) {
52
+ const content = normalized(readme);
53
+ assert.ok(content.includes(commandBlock), `${readme} must use the same first-run commands`);
54
+ assert.match(content, /\(docs\/growth-roadmap-2026-10\.md\)/, `${readme} must link the delivery plan`);
55
+ }
56
+ });
57
+ test('a read-only synthetic report is discoverable in every README language', () => {
58
+ const normalized = (file) => read(file).replace(/\r\n/g, '\n');
59
+ const commandBlock = '```bash\nnode dist/cli.js report eval docs/examples/eval-manifest.synthetic.json\n```';
60
+ for (const readme of READMES) {
61
+ const content = normalized(readme);
62
+ assert.ok(content.includes(commandBlock), `${readme} must show the same runnable report example`);
63
+ assert.match(content, /\(docs\/sharing-results\.md\)/, `${readme} must link the sharing guide`);
64
+ }
65
+ assert.ok(existsSync(resolve(PACKAGE_ROOT, 'docs/examples/eval-manifest.synthetic.json')));
66
+ assert.ok(existsSync(resolve(PACKAGE_ROOT, 'docs/examples/bench-check.yml')));
67
+ });
68
+ test('the first real evaluation guide and its five-trial default are visible in every README language', () => {
69
+ for (const readme of READMES) {
70
+ const content = read(readme);
71
+ assert.match(content, /\(docs\/first-real-eval\.md\)/, `${readme} must link the guide`);
72
+ assert.match(content, /\*\*5\s*(?:trials|次|回|회|intentos)/, `${readme} must explain the default`);
73
+ }
74
+ const guide = read('docs/first-real-eval.md');
75
+ assert.match(guide, /8 distinct tasks × 5 trials per condition/);
76
+ assert.match(guide, /80 agent executions/);
77
+ assert.match(guide, /already available globally/);
78
+ });
79
+ test('the evidence index links only to files present in a clean checkout', () => {
80
+ const base = resolve(PACKAGE_ROOT, 'evidence');
81
+ for (const [, target] of read('evidence/README.md').matchAll(/\]\(([^)#]+?)(?:#[^)]*)?\)/g)) {
82
+ if (!target || /^https?:/.test(target))
83
+ continue;
84
+ assert.ok(existsSync(resolve(base, target)), `broken evidence index link: ${target}`);
85
+ }
86
+ });
87
+ test('rules and MCP evaluation tour stays present across README languages', () => {
88
+ for (const [readme, figure, language, label] of [
89
+ ['README.md', 'docs/assets/skillfit-flow.en.svg', 'en', 'Baseline'],
90
+ ['README.zh-CN.md', 'docs/assets/skillfit-flow.zh-CN.svg', 'zh-CN', '基线组'],
91
+ ]) {
92
+ const content = read(readme).replace(/\r\n/g, '\n');
93
+ assert.ok(content.includes('docs/assets/skillfit-mark.svg'), `${readme} must show the logo`);
94
+ assert.ok(content.includes(figure), `${readme} must show its localized evidence loop`);
95
+ const svg = read(figure);
96
+ assert.ok(svg.includes(`lang="${language}"`), `${figure} must declare its language`);
97
+ assert.ok(svg.includes(label), `${figure} must contain localized copy`);
98
+ assert.ok(!/9\/20|16\/20/.test(svg), `${figure} must not imply unpublished evaluation results`);
99
+ assert.match(content, /skillfit mcp check/, `${readme} must mention MCP preflight`);
100
+ assert.match(content, /node dist\/cli\.js eval \.\/context7-experiment --bench \.\/my-context7-bench --agent codex --trials 5/, `${readme} must show config A\/B`);
101
+ assert.match(content, /\(docs\/config-experiments\.md\)/, `${readme} must link the config experiment guide`);
102
+ assert.match(content, /\| `mcp check <spec>` \|/, `${readme} must list the MCP command`);
103
+ assert.match(content, /npm ci\nnpm run build\nnode dist\/cli\.js --help\nnode dist\/cli\.js bench check benches\/code-review/, `${readme} must provide an offline first run`);
104
+ }
105
+ });
106
+ test('bench-authoring.md carries all seven steps and both gates', () => {
107
+ const guide = read(GUIDE);
108
+ for (const step of [
109
+ '### 1. Start from a real failure',
110
+ '### 2. Freeze the scene, then shrink it',
111
+ '### 3. Write the grader',
112
+ '### 4. Or mine it from git history',
113
+ '### 5. Write the trigger variant',
114
+ '### 6. Label it, load it, and plant decoys',
115
+ '### 7. Rehearse before you pay',
116
+ ]) {
117
+ assert.ok(guide.includes(step), `missing step heading: ${step}`);
118
+ }
119
+ assert.match(guide, /\*\*NOP\*\*/, 'the NOP gate must be named');
120
+ assert.match(guide, /\*\*Oracle\*\*/, 'the oracle gate must be named');
121
+ });
122
+ // The guide describes gates that must actually exist, so each threshold it quotes is read back out of
123
+ // the source: changing a constant now breaks the doc's test instead of silently making the doc wrong.
124
+ test('bench-authoring.md quotes the thresholds the code enforces', () => {
125
+ const guide = read(GUIDE);
126
+ const benchSrc = read('src/commands/bench.ts');
127
+ const reportSrc = read('src/harness/report.ts');
128
+ const statsSrc = read('src/harness/stats.ts');
129
+ const minFacets = /MIN_FACET_CHECKS = (\d+)/.exec(benchSrc)?.[1];
130
+ const maxFacets = /MAX_FACET_CHECKS = (\d+)/.exec(benchSrc)?.[1];
131
+ const controlTarget = /NEGATIVE_CONTROL_TARGET = ([\d.]+)/.exec(benchSrc)?.[1];
132
+ const conclusiveTasks = /CONCLUSIVE_TASKS = (\d+)/.exec(reportSrc)?.[1];
133
+ const conclusiveTrials = /CONCLUSIVE_TRIALS = (\d+)/.exec(reportSrc)?.[1];
134
+ const minDiscordant = /MIN_DISCORDANT_FOR_SIGNIFICANCE = (\d+)/.exec(statsSrc)?.[1];
135
+ const thresholds = { minFacets, maxFacets, controlTarget, conclusiveTasks, conclusiveTrials, minDiscordant };
136
+ for (const [name, value] of Object.entries(thresholds)) {
137
+ assert.ok(value !== undefined, `could not read ${name} out of the source`);
138
+ }
139
+ assert.ok(guide.includes(`${minFacets}–${maxFacets} checks`), 'facet-check range');
140
+ assert.ok(guide.includes(`${Math.round(Number(controlTarget) * 100)}%`), 'negative-control target');
141
+ assert.ok(guide.includes(`${conclusiveTasks} tasks × ${conclusiveTrials} trials`), 'conclusive bar');
142
+ assert.ok(guide.includes(`${minDiscordant} discordant pairs`), 'significance floor');
143
+ });
144
+ test('every relative link in the guide resolves', () => {
145
+ const guide = read(GUIDE);
146
+ const base = dirname(resolve(PACKAGE_ROOT, GUIDE));
147
+ const targets = [...guide.matchAll(/\]\(([^)#]+?)(?:#[^)]*)?\)/g)].map((match) => match[1]);
148
+ assert.ok(targets.length >= 4, 'expected the guide to link the rest of the doc set');
149
+ for (const target of targets) {
150
+ if (/^https?:/.test(target))
151
+ continue;
152
+ assert.ok(existsSync(resolve(base, target)), `broken link in ${GUIDE}: ${target}`);
153
+ }
154
+ });
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Minimal YAML frontmatter reader for SKILL.md files.
3
+ *
4
+ * There is deliberately no YAML dependency (AGENTS.md: zero runtime dependencies), so this handles
5
+ * the subset agent skill files actually use — `key: value` pairs, quoted scalars, and `>` / `|` block
6
+ * scalars including their chomping indicators. It is not a YAML parser and does not claim to be one.
7
+ *
8
+ * This module exists because `doctor` and `install` each grew their own copy and the two drifted:
9
+ * install's did not strip a BOM, did not tolerate spaces after the `---` fence, did not unquote
10
+ * values, and stored the literal `>` for a folded description. The same SKILL.md could pass `doctor`
11
+ * and be rejected by `install`. Neither handled `>-`, so a folded description was stored as the two
12
+ * characters `>-` and still counted as present. One implementation, one behaviour.
13
+ */
14
+ const BLOCK_SCALAR = /^([>|])[+-]?\d*$/;
15
+ function unquote(value) {
16
+ const match = /^(['"])([\s\S]*)\1$/.exec(value);
17
+ return match?.[2] ?? value;
18
+ }
19
+ export function parseFrontmatter(content) {
20
+ const text = content.replace(/^\uFEFF/, '');
21
+ const match = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(text);
22
+ if (!match || match[1] === undefined)
23
+ return null;
24
+ const fields = {};
25
+ let blockKey = null;
26
+ let blockIsLiteral = false;
27
+ for (const line of match[1].split(/\r?\n/)) {
28
+ const kv = /^([A-Za-z0-9_-]+):(?:[ \t]+(.*))?$/.exec(line);
29
+ if (kv && kv[1] !== undefined) {
30
+ const raw = (kv[2] ?? '').trim();
31
+ const block = BLOCK_SCALAR.exec(raw);
32
+ if (block) {
33
+ fields[kv[1]] = '';
34
+ blockKey = kv[1];
35
+ // `|` keeps line breaks; `>` folds them into spaces.
36
+ blockIsLiteral = block[1] === '|';
37
+ }
38
+ else {
39
+ fields[kv[1]] = unquote(raw);
40
+ blockKey = null;
41
+ }
42
+ continue;
43
+ }
44
+ if (blockKey !== null && /^\s+\S/.test(line)) {
45
+ const prior = fields[blockKey] ?? '';
46
+ const piece = line.trim();
47
+ fields[blockKey] = prior === '' ? piece : `${prior}${blockIsLiteral ? '\n' : ' '}${piece}`;
48
+ continue;
49
+ }
50
+ blockKey = null;
51
+ }
52
+ return fields;
53
+ }
@@ -0,0 +1,49 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { parseFrontmatter } from './frontmatter.js';
4
+ test('parses name and description', () => {
5
+ const fields = parseFrontmatter('---\nname: demo\ndescription: does things\n---\nbody');
6
+ assert.deepEqual(fields, { name: 'demo', description: 'does things' });
7
+ });
8
+ test('returns null without a closing fence or any frontmatter', () => {
9
+ assert.equal(parseFrontmatter('---\nname: demo\n'), null);
10
+ assert.equal(parseFrontmatter('no frontmatter here'), null);
11
+ });
12
+ test('handles CRLF line endings', () => {
13
+ assert.equal(parseFrontmatter('---\r\nname: x\r\n---\r\n')?.name, 'x');
14
+ });
15
+ // The four cases below are the reason this module exists. doctor and install each had their own
16
+ // parser and disagreed on all four, so the same SKILL.md could pass `doctor` and be rejected by
17
+ // `install` — or validate with the two characters ">-" as its description.
18
+ test('tolerates a byte-order mark', () => {
19
+ const fields = parseFrontmatter('\uFEFF---\nname: demo\ndescription: does things\n---\n');
20
+ assert.deepEqual(fields, { name: 'demo', description: 'does things' });
21
+ });
22
+ test('tolerates trailing spaces after the opening fence', () => {
23
+ const fields = parseFrontmatter('--- \nname: demo\ndescription: does things\n---\n');
24
+ assert.deepEqual(fields, { name: 'demo', description: 'does things' });
25
+ });
26
+ test('unquotes single- and double-quoted scalars', () => {
27
+ const fields = parseFrontmatter('---\nname: "demo skill"\ndescription: \'does things\'\n---\n');
28
+ assert.equal(fields?.name, 'demo skill');
29
+ assert.equal(fields?.description, 'does things');
30
+ });
31
+ test('joins a folded block scalar with spaces', () => {
32
+ const fields = parseFrontmatter('---\nname: demo\ndescription: >\n first line\n second line\n---\n');
33
+ assert.equal(fields?.description, 'first line second line');
34
+ });
35
+ test('keeps line breaks in a literal block scalar', () => {
36
+ const fields = parseFrontmatter('---\nname: demo\ndescription: |\n first line\n second line\n---\n');
37
+ assert.equal(fields?.description, 'first line\nsecond line');
38
+ });
39
+ test('handles chomping indicators, which both old parsers stored literally', () => {
40
+ for (const indicator of ['>-', '|-', '>+', '|+']) {
41
+ const fields = parseFrontmatter(`---\nname: demo\ndescription: ${indicator}\n does things\n across lines\n---\n`);
42
+ assert.ok(fields?.description?.includes('does things'), `description: ${indicator} should be read as a block scalar, got ${JSON.stringify(fields?.description)}`);
43
+ assert.ok(!fields?.description?.includes(indicator), `the indicator itself must not end up in the value, got ${JSON.stringify(fields?.description)}`);
44
+ }
45
+ });
46
+ test('a key with no value is empty rather than absent', () => {
47
+ const fields = parseFrontmatter('---\nname: demo\ndescription:\n---\n');
48
+ assert.deepEqual(fields, { name: 'demo', description: '' });
49
+ });
@@ -0,0 +1,134 @@
1
+ import { existsSync, readFileSync, statSync } from 'node:fs';
2
+ import { basename, isAbsolute, join, resolve, sep } from 'node:path';
3
+ import { hashFileSet, listFilesRecursive } from './hash.js';
4
+ export const BENCH_SCHEMA_VERSION = 1;
5
+ const TASK_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
6
+ function assertRelativeInside(benchDir, rel, label) {
7
+ if (isAbsolute(rel) || rel.split(/[\\/]/).includes('..')) {
8
+ throw new Error(`${label} must be a relative path inside the bench directory: ${rel}`);
9
+ }
10
+ const abs = resolve(benchDir, rel);
11
+ if (abs !== benchDir && !abs.startsWith(benchDir + sep)) {
12
+ throw new Error(`${label} escapes the bench directory: ${rel}`);
13
+ }
14
+ return abs;
15
+ }
16
+ function assertCommandTokensExist(benchDir, command, label) {
17
+ for (const token of command.split(/\s+/).filter(Boolean)) {
18
+ if (!token.includes('/') && !token.includes('\\'))
19
+ continue;
20
+ const tokenAbs = assertRelativeInside(benchDir, token, label);
21
+ if (!existsSync(tokenAbs)) {
22
+ throw new Error(`${label} references a missing file: ${token}`);
23
+ }
24
+ }
25
+ }
26
+ function validateTask(benchDir, raw, index) {
27
+ if (typeof raw !== 'object' || raw === null) {
28
+ throw new Error(`bench.json task #${index + 1} must be an object`);
29
+ }
30
+ const task = raw;
31
+ const id = task['id'];
32
+ if (typeof id !== 'string' || !TASK_ID_PATTERN.test(id)) {
33
+ throw new Error(`bench.json task #${index + 1} has an invalid id (expected ${TASK_ID_PATTERN})`);
34
+ }
35
+ for (const field of ['fixture', 'prompt', 'verifier']) {
36
+ if (typeof task[field] !== 'string' || task[field].trim() === '') {
37
+ throw new Error(`bench.json task "${id}" is missing a non-empty "${field}" field`);
38
+ }
39
+ }
40
+ const fixture = task['fixture'];
41
+ const prompt = task['prompt'];
42
+ const verifier = task['verifier'];
43
+ const rubric = task['rubric'];
44
+ const shouldTrigger = task['shouldTrigger'];
45
+ const promptTrigger = task['promptTrigger'];
46
+ const verifierKind = task['verifierKind'];
47
+ if (verifierKind !== undefined && verifierKind !== 'output' && verifierKind !== 'command') {
48
+ throw new Error(`bench.json task "${id}" has an invalid "verifierKind" field (expected "output" or "command")`);
49
+ }
50
+ const verifierKindField = verifierKind === undefined ? {} : { verifierKind: verifierKind };
51
+ if (shouldTrigger !== undefined && typeof shouldTrigger !== 'boolean') {
52
+ throw new Error(`bench.json task "${id}" has an invalid "shouldTrigger" field`);
53
+ }
54
+ const triggerClass = task['triggerClass'];
55
+ if (triggerClass !== undefined && triggerClass !== 'explicit' && triggerClass !== 'implicit' && triggerClass !== 'contextual') {
56
+ throw new Error(`bench.json task "${id}" has an invalid "triggerClass" field (expected "explicit", "implicit", or "contextual")`);
57
+ }
58
+ if (triggerClass !== undefined && shouldTrigger !== true) {
59
+ throw new Error(`bench.json task "${id}" sets triggerClass without shouldTrigger: true`);
60
+ }
61
+ const triggerField = {
62
+ ...(shouldTrigger === undefined ? {} : { shouldTrigger }),
63
+ ...(triggerClass === undefined ? {} : { triggerClass: triggerClass }),
64
+ };
65
+ if (promptTrigger !== undefined && (typeof promptTrigger !== 'string' || promptTrigger.trim() === '')) {
66
+ throw new Error(`bench.json task "${id}" has an invalid "promptTrigger" field`);
67
+ }
68
+ const promptTriggerField = promptTrigger === undefined ? {} : { promptTrigger };
69
+ const fixtureAbs = assertRelativeInside(benchDir, fixture, `task "${id}" fixture`);
70
+ if (!existsSync(fixtureAbs) || !statSync(fixtureAbs).isDirectory()) {
71
+ throw new Error(`task "${id}" fixture directory not found: ${fixture}`);
72
+ }
73
+ const promptAbs = assertRelativeInside(benchDir, prompt, `task "${id}" prompt`);
74
+ if (!existsSync(promptAbs) || !statSync(promptAbs).isFile()) {
75
+ throw new Error(`task "${id}" prompt file not found: ${prompt}`);
76
+ }
77
+ if (promptTrigger !== undefined) {
78
+ const promptTriggerAbs = assertRelativeInside(benchDir, promptTrigger, `task "${id}" promptTrigger`);
79
+ if (!existsSync(promptTriggerAbs) || !statSync(promptTriggerAbs).isFile()) {
80
+ throw new Error(`task "${id}" promptTrigger file not found: ${promptTrigger}`);
81
+ }
82
+ }
83
+ assertCommandTokensExist(benchDir, verifier, `task "${id}" verifier`);
84
+ const oracle = task['oracle'];
85
+ if (oracle !== undefined) {
86
+ if (typeof oracle !== 'string' || oracle.trim() === '') {
87
+ throw new Error(`bench.json task "${id}" has an invalid "oracle" field`);
88
+ }
89
+ assertCommandTokensExist(benchDir, oracle, `task "${id}" oracle`);
90
+ }
91
+ const oracleField = oracle === undefined ? {} : { oracle: oracle };
92
+ if (rubric !== undefined) {
93
+ if (typeof rubric !== 'string' || rubric.trim() === '') {
94
+ throw new Error(`bench.json task "${id}" has an invalid "rubric" field`);
95
+ }
96
+ const rubricAbs = assertRelativeInside(benchDir, rubric, `task "${id}" rubric`);
97
+ if (!existsSync(rubricAbs) || !statSync(rubricAbs).isFile()) {
98
+ throw new Error(`task "${id}" rubric file not found: ${rubric}`);
99
+ }
100
+ return { id, fixture, prompt, verifier, rubric, ...triggerField, ...promptTriggerField, ...verifierKindField, ...oracleField };
101
+ }
102
+ return { id, fixture, prompt, verifier, ...triggerField, ...promptTriggerField, ...verifierKindField, ...oracleField };
103
+ }
104
+ export function loadBench(benchDir) {
105
+ const dir = resolve(benchDir);
106
+ const benchJsonPath = join(dir, 'bench.json');
107
+ if (!existsSync(benchJsonPath)) {
108
+ throw new Error(`Not a bench directory (missing bench.json): ${dir}`);
109
+ }
110
+ let raw;
111
+ try {
112
+ raw = JSON.parse(readFileSync(benchJsonPath, 'utf8'));
113
+ }
114
+ catch (error) {
115
+ throw new Error(`Invalid bench.json in ${dir}: ${error.message}`);
116
+ }
117
+ if (raw.schemaVersion !== BENCH_SCHEMA_VERSION) {
118
+ throw new Error(`Unsupported bench schemaVersion ${String(raw.schemaVersion)} in ${dir} (expected ${BENCH_SCHEMA_VERSION})`);
119
+ }
120
+ if (!Array.isArray(raw.tasks) || raw.tasks.length === 0) {
121
+ throw new Error(`bench.json in ${dir} must list at least one task`);
122
+ }
123
+ const tasks = raw.tasks.map((task, index) => validateTask(dir, task, index));
124
+ const seen = new Set();
125
+ for (const task of tasks) {
126
+ if (seen.has(task.id)) {
127
+ throw new Error(`Duplicate task id in bench.json: ${task.id}`);
128
+ }
129
+ seen.add(task.id);
130
+ }
131
+ const name = typeof raw.name === 'string' && raw.name.trim() !== '' ? raw.name : basename(dir);
132
+ const contentSha256 = hashFileSet(dir, listFilesRecursive(dir));
133
+ return { dir, name, schemaVersion: BENCH_SCHEMA_VERSION, tasks, contentSha256 };
134
+ }
@@ -0,0 +1,109 @@
1
+ import assert from 'node:assert/strict';
2
+ import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
3
+ import { tmpdir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { test } from 'node:test';
7
+ import { loadBench } from './bench.js';
8
+ const PACKAGE_ROOT = fileURLToPath(new URL('../..', import.meta.url));
9
+ const BUNDLED_CODE_REVIEW = join(PACKAGE_ROOT, 'benches', 'code-review');
10
+ function makeBench(t, benchJson) {
11
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-bench-'));
12
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
13
+ mkdirSync(join(dir, 'fixtures', 't1'), { recursive: true });
14
+ mkdirSync(join(dir, 'prompts'), { recursive: true });
15
+ mkdirSync(join(dir, 'verifiers'), { recursive: true });
16
+ writeFileSync(join(dir, 'fixtures', 't1', 'index.txt'), 'fixture\n');
17
+ writeFileSync(join(dir, 'prompts', 't1.md'), 'do it\n');
18
+ writeFileSync(join(dir, 'verifiers', 't1.mjs'), 'process.exit(0);\n');
19
+ writeFileSync(join(dir, 'bench.json'), JSON.stringify(benchJson));
20
+ return dir;
21
+ }
22
+ const validTask = {
23
+ id: 't1',
24
+ fixture: 'fixtures/t1',
25
+ prompt: 'prompts/t1.md',
26
+ verifier: 'node verifiers/t1.mjs',
27
+ };
28
+ test('loadBench loads the bundled code-review bench', () => {
29
+ const bench = loadBench(BUNDLED_CODE_REVIEW);
30
+ assert.equal(bench.name, 'code-review');
31
+ assert.equal(bench.schemaVersion, 1);
32
+ assert.equal(bench.tasks.length, 5);
33
+ assert.equal(bench.tasks[0]?.id, 'review-r1');
34
+ assert.equal(bench.tasks[0]?.rubric, 'ground-truth/r1.md');
35
+ assert.equal(bench.tasks[0]?.oracle, 'node ground-truth/oracle-r1.mjs');
36
+ assert.equal(bench.tasks[0]?.shouldTrigger, true);
37
+ assert.equal(bench.tasks[0]?.promptTrigger, 'prompts/review-r1.trigger.md');
38
+ assert.equal(bench.tasks[1]?.id, 'review-r2');
39
+ assert.equal(bench.tasks[1]?.verifier, 'node verifiers/review-r2.mjs');
40
+ assert.equal(bench.tasks[2]?.id, 'review-r3');
41
+ assert.equal(bench.tasks[2]?.rubric, 'ground-truth/r3.md');
42
+ assert.equal(bench.tasks[3]?.id, 'explain-x1');
43
+ assert.equal(bench.tasks[3]?.shouldTrigger, false);
44
+ assert.equal(bench.tasks[4]?.id, 'summarize-s1');
45
+ assert.equal(bench.tasks[4]?.shouldTrigger, false);
46
+ assert.equal(bench.tasks[4]?.oracle, 'node ground-truth/oracle-summarize-s1.mjs');
47
+ assert.match(bench.contentSha256, /^[0-9a-f]{64}$/);
48
+ });
49
+ test('loadBench accepts a valid synthetic bench', (t) => {
50
+ const dir = makeBench(t, { schemaVersion: 1, tasks: [validTask] });
51
+ const bench = loadBench(dir);
52
+ assert.equal(bench.tasks.length, 1);
53
+ assert.equal(bench.tasks[0]?.verifier, 'node verifiers/t1.mjs');
54
+ });
55
+ test('loadBench rejects unsupported schemaVersion', (t) => {
56
+ const dir = makeBench(t, { schemaVersion: 2, tasks: [validTask] });
57
+ assert.throws(() => loadBench(dir), /Unsupported bench schemaVersion 2/);
58
+ });
59
+ test('loadBench rejects a missing bench.json', () => {
60
+ assert.throws(() => loadBench(join(tmpdir(), 'skillfit-no-such-bench')), /missing bench\.json/);
61
+ });
62
+ test('loadBench rejects an empty task list', (t) => {
63
+ const dir = makeBench(t, { schemaVersion: 1, tasks: [] });
64
+ assert.throws(() => loadBench(dir), /at least one task/);
65
+ });
66
+ test('loadBench rejects a missing fixture directory', (t) => {
67
+ const dir = makeBench(t, { schemaVersion: 1, tasks: [{ ...validTask, fixture: 'fixtures/nope' }] });
68
+ assert.throws(() => loadBench(dir), /fixture directory not found/);
69
+ });
70
+ test('loadBench rejects a missing verifier script', (t) => {
71
+ const dir = makeBench(t, { schemaVersion: 1, tasks: [{ ...validTask, verifier: 'node verifiers/nope.mjs' }] });
72
+ assert.throws(() => loadBench(dir), /missing file: verifiers\/nope\.mjs/);
73
+ });
74
+ test('loadBench rejects duplicate task ids', (t) => {
75
+ const dir = makeBench(t, { schemaVersion: 1, tasks: [validTask, validTask] });
76
+ assert.throws(() => loadBench(dir), /Duplicate task id/);
77
+ });
78
+ test('loadBench rejects paths escaping the bench directory', (t) => {
79
+ const dir = makeBench(t, { schemaVersion: 1, tasks: [{ ...validTask, fixture: '../elsewhere' }] });
80
+ assert.throws(() => loadBench(dir), /relative path inside the bench directory/);
81
+ });
82
+ test('loadBench accepts a task with a valid oracle command', (t) => {
83
+ const dir = makeBench(t, {
84
+ schemaVersion: 1,
85
+ tasks: [{ ...validTask, oracle: 'node ground-truth/o1.mjs' }],
86
+ });
87
+ mkdirSync(join(dir, 'ground-truth'), { recursive: true });
88
+ writeFileSync(join(dir, 'ground-truth', 'o1.mjs'), 'process.exit(0);\n');
89
+ const bench = loadBench(dir);
90
+ assert.equal(bench.tasks[0]?.oracle, 'node ground-truth/o1.mjs');
91
+ });
92
+ test('loadBench rejects an oracle referencing a missing file', (t) => {
93
+ const dir = makeBench(t, {
94
+ schemaVersion: 1,
95
+ tasks: [{ ...validTask, oracle: 'node ground-truth/nope.mjs' }],
96
+ });
97
+ assert.throws(() => loadBench(dir), /oracle references a missing file: ground-truth\/nope\.mjs/);
98
+ });
99
+ test('loadBench rejects an oracle escaping the bench directory', (t) => {
100
+ const dir = makeBench(t, {
101
+ schemaVersion: 1,
102
+ tasks: [{ ...validTask, oracle: 'node ../elsewhere/o1.mjs' }],
103
+ });
104
+ assert.throws(() => loadBench(dir), /relative path inside the bench directory/);
105
+ });
106
+ test('loadBench rejects a non-string oracle field', (t) => {
107
+ const dir = makeBench(t, { schemaVersion: 1, tasks: [{ ...validTask, oracle: 42 }] });
108
+ assert.throws(() => loadBench(dir), /invalid "oracle" field/);
109
+ });