skillfit 0.9.1 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/README.md +48 -14
  2. package/README.zh-CN.md +48 -14
  3. package/benches/README.md +23 -0
  4. package/benches/contrib/README.md +1 -0
  5. package/benches/contrib/oss-skill-independent/README.md +60 -0
  6. package/benches/contrib/oss-skill-independent/bench.json +79 -0
  7. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/LICENSE +22 -0
  8. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/Readme.md +1015 -0
  9. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/esm.mjs +15 -0
  10. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/index.js +27 -0
  11. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/argument.js +147 -0
  12. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/command.js +1944 -0
  13. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/error.js +45 -0
  14. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/help.js +396 -0
  15. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/option.js +208 -0
  16. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/suggestSimilar.js +100 -0
  17. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package-support.json +16 -0
  18. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package.json +63 -0
  19. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test-clock.mjs +65 -0
  20. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test.mjs +4 -0
  21. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.d.ts +774 -0
  22. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.test-d.ts +416 -0
  23. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/upstream-package.json +69 -0
  24. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/LICENSE +22 -0
  25. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/Readme.md +1149 -0
  26. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/esm.mjs +16 -0
  27. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/index.js +24 -0
  28. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/argument.js +149 -0
  29. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/command.js +2662 -0
  30. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/error.js +39 -0
  31. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/help.js +713 -0
  32. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/option.js +367 -0
  33. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/suggestSimilar.js +101 -0
  34. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package-support.json +16 -0
  35. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package.json +71 -0
  36. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test-clock.mjs +65 -0
  37. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test.mjs +4 -0
  38. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/esm.d.mts +3 -0
  39. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.d.ts +1045 -0
  40. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.test-d.ts +737 -0
  41. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/upstream-package.json +82 -0
  42. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.d.ts +40 -0
  43. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.js +68 -0
  44. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/license +9 -0
  45. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/package.json +54 -0
  46. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/readme.md +99 -0
  47. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test-clock.mjs +65 -0
  48. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test.mjs +4 -0
  49. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/upstream-package.json +54 -0
  50. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/index.js +67 -0
  51. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/license +9 -0
  52. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/package.json +46 -0
  53. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.d.ts +136 -0
  54. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.js +132 -0
  55. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/license +9 -0
  56. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/package.json +57 -0
  57. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/readme.md +181 -0
  58. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test-clock.mjs +65 -0
  59. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test.mjs +4 -0
  60. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/upstream-package.json +58 -0
  61. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
  62. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
  63. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
  64. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.d.ts +136 -0
  65. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.js +116 -0
  66. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/license +9 -0
  67. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/package.json +60 -0
  68. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/readme.md +170 -0
  69. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test-clock.mjs +65 -0
  70. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test.mjs +4 -0
  71. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/upstream-package.json +60 -0
  72. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.d.ts +149 -0
  73. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.js +93 -0
  74. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/license +9 -0
  75. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/package.json +52 -0
  76. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/readme.md +192 -0
  77. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test-clock.mjs +65 -0
  78. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test.mjs +4 -0
  79. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/upstream-package.json +52 -0
  80. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.d.ts +151 -0
  81. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.js +114 -0
  82. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/license +9 -0
  83. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/package.json +48 -0
  84. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/readme.md +158 -0
  85. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test-clock.mjs +65 -0
  86. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test.mjs +4 -0
  87. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/upstream-package.json +48 -0
  88. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.d.ts +151 -0
  89. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.js +122 -0
  90. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/license +9 -0
  91. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/package.json +50 -0
  92. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/readme.md +190 -0
  93. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test-clock.mjs +65 -0
  94. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test.mjs +4 -0
  95. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/upstream-package.json +50 -0
  96. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/LICENSE +22 -0
  97. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/Readme.md +1015 -0
  98. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/esm.mjs +15 -0
  99. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/index.js +27 -0
  100. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/argument.js +147 -0
  101. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/command.js +1948 -0
  102. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/error.js +45 -0
  103. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/help.js +396 -0
  104. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/option.js +208 -0
  105. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/suggestSimilar.js +100 -0
  106. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package-support.json +16 -0
  107. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package.json +63 -0
  108. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/regression.test.mjs +5 -0
  109. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test-clock.mjs +65 -0
  110. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test.mjs +4 -0
  111. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.d.ts +774 -0
  112. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.test-d.ts +416 -0
  113. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/upstream-package.json +69 -0
  114. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/LICENSE +22 -0
  115. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/Readme.md +1149 -0
  116. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/esm.mjs +16 -0
  117. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/index.js +24 -0
  118. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/argument.js +149 -0
  119. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/command.js +2666 -0
  120. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/error.js +39 -0
  121. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/help.js +713 -0
  122. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/option.js +367 -0
  123. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/suggestSimilar.js +101 -0
  124. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package-support.json +16 -0
  125. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package.json +71 -0
  126. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/regression.test.mjs +5 -0
  127. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test-clock.mjs +65 -0
  128. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test.mjs +4 -0
  129. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/esm.d.mts +3 -0
  130. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.d.ts +1045 -0
  131. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.test-d.ts +737 -0
  132. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/upstream-package.json +82 -0
  133. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/async-hooks-stub.js +15 -0
  134. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.d.ts +40 -0
  135. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.js +71 -0
  136. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/license +9 -0
  137. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/package.json +61 -0
  138. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/readme.md +99 -0
  139. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/regression.test.mjs +6 -0
  140. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test-clock.mjs +65 -0
  141. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test.mjs +4 -0
  142. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/upstream-package.json +54 -0
  143. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/index.js +67 -0
  144. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/license +9 -0
  145. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/package.json +46 -0
  146. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.d.ts +136 -0
  147. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.js +148 -0
  148. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/license +9 -0
  149. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/package.json +57 -0
  150. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/readme.md +181 -0
  151. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/regression.test.mjs +5 -0
  152. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test-clock.mjs +65 -0
  153. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test.mjs +4 -0
  154. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/upstream-package.json +58 -0
  155. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
  156. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
  157. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
  158. package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-async-listener-order.mjs +1 -0
  159. package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-output-isolation.mjs +1 -0
  160. package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-async-context.mjs +1 -0
  161. package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-map-iteration-rejection.mjs +1 -0
  162. package/benches/contrib/oss-skill-independent/ground-truth/oracle-throttle-sync-throw.mjs +1 -0
  163. package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-custom-timers.mjs +1 -0
  164. package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-infinity-abort.mjs +1 -0
  165. package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-rejection-listener.mjs +1 -0
  166. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.d.ts +136 -0
  167. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.js +121 -0
  168. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/license +9 -0
  169. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/package.json +60 -0
  170. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/readme.md +170 -0
  171. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/regression.test.mjs +6 -0
  172. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test-clock.mjs +65 -0
  173. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test.mjs +4 -0
  174. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/upstream-package.json +60 -0
  175. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.d.ts +149 -0
  176. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.js +95 -0
  177. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/license +9 -0
  178. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/package.json +52 -0
  179. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/readme.md +192 -0
  180. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/regression.test.mjs +5 -0
  181. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test-clock.mjs +65 -0
  182. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test.mjs +4 -0
  183. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/upstream-package.json +52 -0
  184. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.d.ts +151 -0
  185. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.js +114 -0
  186. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/license +9 -0
  187. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/package.json +48 -0
  188. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/readme.md +158 -0
  189. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/regression.test.mjs +5 -0
  190. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test-clock.mjs +65 -0
  191. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test.mjs +4 -0
  192. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/upstream-package.json +48 -0
  193. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.d.ts +151 -0
  194. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.js +122 -0
  195. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/license +9 -0
  196. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/package.json +50 -0
  197. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/readme.md +190 -0
  198. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/regression.test.mjs +5 -0
  199. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test-clock.mjs +65 -0
  200. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test.mjs +4 -0
  201. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/upstream-package.json +50 -0
  202. package/benches/contrib/oss-skill-independent/prompts/commander-async-listener-order.md +3 -0
  203. package/benches/contrib/oss-skill-independent/prompts/commander-output-isolation.md +3 -0
  204. package/benches/contrib/oss-skill-independent/prompts/limit-async-context.md +3 -0
  205. package/benches/contrib/oss-skill-independent/prompts/limit-map-iteration-rejection.md +3 -0
  206. package/benches/contrib/oss-skill-independent/prompts/throttle-sync-throw.md +3 -0
  207. package/benches/contrib/oss-skill-independent/prompts/timeout-custom-timers.md +3 -0
  208. package/benches/contrib/oss-skill-independent/prompts/timeout-infinity-abort.md +3 -0
  209. package/benches/contrib/oss-skill-independent/prompts/timeout-rejection-listener.md +3 -0
  210. package/benches/contrib/oss-skill-independent/provenance.json +1903 -0
  211. package/benches/contrib/oss-skill-independent/task-specs.json +63 -0
  212. package/benches/contrib/oss-skill-independent/test-clock.mjs +65 -0
  213. package/benches/contrib/oss-skill-independent/verifiers/cases.mjs +197 -0
  214. package/benches/contrib/oss-skill-independent/verifiers/commander-async-listener-order.mjs +1 -0
  215. package/benches/contrib/oss-skill-independent/verifiers/commander-output-isolation.mjs +1 -0
  216. package/benches/contrib/oss-skill-independent/verifiers/grade.mjs +48 -0
  217. package/benches/contrib/oss-skill-independent/verifiers/limit-async-context.mjs +1 -0
  218. package/benches/contrib/oss-skill-independent/verifiers/limit-map-iteration-rejection.mjs +1 -0
  219. package/benches/contrib/oss-skill-independent/verifiers/probe.mjs +16 -0
  220. package/benches/contrib/oss-skill-independent/verifiers/regression-evidence.mjs +105 -0
  221. package/benches/contrib/oss-skill-independent/verifiers/test-reporter.mjs +29 -0
  222. package/benches/contrib/oss-skill-independent/verifiers/throttle-sync-throw.mjs +1 -0
  223. package/benches/contrib/oss-skill-independent/verifiers/timeout-custom-timers.mjs +1 -0
  224. package/benches/contrib/oss-skill-independent/verifiers/timeout-infinity-abort.mjs +1 -0
  225. package/benches/contrib/oss-skill-independent/verifiers/timeout-rejection-listener.mjs +1 -0
  226. package/dist/cli.js +183 -64
  227. package/dist/commands/bench-check-json.test.js +221 -0
  228. package/dist/commands/bench-check-report.js +48 -0
  229. package/dist/commands/bench-command-template.js +129 -0
  230. package/dist/commands/bench-manage.js +91 -0
  231. package/dist/commands/bench-manage.test.js +87 -0
  232. package/dist/commands/bench.js +166 -128
  233. package/dist/commands/bench.test.js +101 -0
  234. package/dist/commands/eval-component.js +25 -1
  235. package/dist/commands/eval-export.js +178 -0
  236. package/dist/commands/eval-export.test.js +279 -0
  237. package/dist/commands/eval-interruption.test.js +238 -0
  238. package/dist/commands/eval-preflight.js +61 -0
  239. package/dist/commands/eval-preflight.test.js +239 -0
  240. package/dist/commands/eval-report.js +44 -13
  241. package/dist/commands/eval-report.test.js +2 -2
  242. package/dist/commands/eval.js +94 -61
  243. package/dist/commands/eval.test.js +58 -1
  244. package/dist/harness/bench.js +21 -2
  245. package/dist/harness/eval-audit.js +45 -5
  246. package/dist/harness/eval-budget.js +51 -0
  247. package/dist/harness/eval-budget.test.js +212 -0
  248. package/dist/harness/eval-component.test.js +36 -0
  249. package/dist/harness/eval-contract.js +5 -1
  250. package/dist/harness/executors/api.js +10 -1
  251. package/dist/harness/executors/api.test.js +43 -0
  252. package/dist/harness/executors/cli.js +24 -3
  253. package/dist/harness/experiment-session.js +60 -9
  254. package/dist/harness/experiment-session.test.js +43 -1
  255. package/dist/harness/input-snapshot.js +150 -0
  256. package/dist/harness/interruption.js +48 -0
  257. package/dist/harness/interruption.test.js +31 -0
  258. package/dist/harness/replay-package.js +85 -0
  259. package/dist/harness/runner.js +74 -15
  260. package/dist/harness/trigger.js +20 -4
  261. package/docs/bench-authoring.md +40 -0
  262. package/docs/bench-check-json.md +122 -0
  263. package/docs/case-management.md +65 -0
  264. package/docs/eval-case-preflight.md +110 -0
  265. package/docs/eval-component.md +88 -49
  266. package/docs/eval-costs.md +9 -0
  267. package/docs/evaluation-input-snapshots.md +124 -0
  268. package/docs/evaluation-interruption.md +89 -0
  269. package/docs/evaluation-reports.md +49 -0
  270. package/docs/examples/check-receiver-mechanism-proposal.mjs +124 -0
  271. package/docs/examples/prepare-native-diff-probe.mjs +75 -0
  272. package/docs/examples/reproduce-independent-comparison-budget.mjs +73 -0
  273. package/docs/experiment-workflow.md +9 -2
  274. package/docs/first-real-eval.md +10 -1
  275. package/docs/growth-roadmap-2026-10.md +62 -93
  276. package/docs/metrics.md +52 -0
  277. package/docs/plans/2026-10-14-evidence-and-release-sequence.md +29 -12
  278. package/docs/plans/2026-10-15-independent-comparison-budget.json +1769 -0
  279. package/docs/plans/2026-10-15-independent-comparison-inputs.json +373 -0
  280. package/docs/plans/2026-10-15-independent-comparison-proposal.md +177 -0
  281. package/docs/plans/2026-10-15-native-diff-mechanism.md +105 -0
  282. package/docs/plans/2026-10-15-receiver-mechanism-proposal.json +342 -0
  283. package/docs/plans/2026-10-15-receiver-mechanism-proposal.md +146 -0
  284. package/docs/plans/2026-10-15-receiver-mechanism-verification.json +105 -0
  285. package/docs/plans/2026-10-16-case-workflow-and-release.md +49 -0
  286. package/docs/releases/0.10.0-ci-registry-install.json +140 -0
  287. package/docs/releases/0.10.0-feature-smoke.json +22 -0
  288. package/docs/releases/0.10.0-feature-smoke.mjs +62 -0
  289. package/docs/releases/0.10.0-signatures.txt +7 -0
  290. package/docs/releases/0.10.0-verification.json +76 -0
  291. package/docs/releases/0.10.0.md +81 -0
  292. package/docs/releases/0.10.1-feature-smoke.mjs +95 -0
  293. package/docs/releases/0.10.1.md +38 -0
  294. package/docs/releases/0.9.1-first-publication.json +249 -0
  295. package/docs/releases/0.9.1-verification.json +122 -0
  296. package/docs/releases/0.9.1.md +33 -1
  297. package/docs/releases/trusted-publishing.md +61 -0
  298. package/docs/replay-packages.md +97 -0
  299. package/docs/schemas/bench-check.schema.json +109 -0
  300. package/docs/schemas/eval-preflight.schema.json +57 -0
  301. package/docs/schemas/eval-request.schema.json +12 -0
  302. package/docs/schemas/eval-result.schema.json +11 -0
  303. package/docs/sharing-results.md +11 -2
  304. package/docs/skill-evaluation-evidence.md +52 -0
  305. package/evidence/2026-10-15-diagnosing-receiver-correction.md +140 -0
  306. package/evidence/2026-10-15-independent-comparison-regression-stop.md +162 -0
  307. package/evidence/2026-10-15-independent-offline-readiness.md +144 -0
  308. package/evidence/2026-10-15-native-diff-mechanism.md +196 -0
  309. package/evidence/2026-10-15-receiver-mechanism-stop.md +154 -0
  310. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/README.md +35 -0
  311. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/expected.json +577 -0
  312. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/receiver-contract.test.mjs +138 -0
  313. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/replay.mjs +127 -0
  314. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/verification.json +105 -0
  315. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/README.md +32 -0
  316. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/checks.json +32 -0
  317. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
  318. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/verification.json +25 -0
  319. package/evidence/artifacts/2026-10-15-independent-offline-readiness/README.md +17 -0
  320. package/evidence/artifacts/2026-10-15-independent-offline-readiness/verification.json +1548 -0
  321. package/evidence/artifacts/2026-10-15-native-diff-mechanism/README.md +48 -0
  322. package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
  323. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/README.md +38 -0
  324. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/checks.json +118 -0
  325. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
  326. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/verification.json +36 -0
  327. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/LICENSE +21 -0
  328. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/SKILL.md +51 -0
  329. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/agents/openai.yaml +3 -0
  330. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/scripts/hitl-loop.template.sh +44 -0
  331. package/package.json +1 -1
  332. package/skills/skillfit/SKILL.md +17 -5
@@ -0,0 +1,48 @@
1
+ import { verdictFromOutput } from '../harness/verifier-summary.js';
2
+ import { MOCK_MARKER_FILE } from '../harness/constants.js';
3
+ const GATES = {
4
+ BENCH_LOAD: [null, 'Fix bench.json and its referenced files, then run bench check again.'],
5
+ UNTOUCHED_FIXTURE: ['verifier', 'Make the verifier executable and ensure the untouched fixture fails for the intended defect.'],
6
+ MISSING_OUTPUT: ['verifier', 'Make the verifier executable and reject a missing _output.md.'],
7
+ EMPTY_OUTPUT: ['verifier', 'Make the verifier executable and reject an empty _output.md.'],
8
+ FACET_COUNT: ['verifier', 'Decompose acceptance into 2–8 deterministic named checks.'],
9
+ ORACLE: ['oracle', 'Inspect the oracle and verifier output; register a reference repair that passes every check.'],
10
+ MOCK_COVERAGE: ['fixture', 'Add a valid .skillfit-mock.json marker for output tasks if mock coverage is needed.'],
11
+ MOCK_MARKER: ['fixture', 'Fix the .skillfit-mock.json file so it contains valid JSON.'],
12
+ MOCK_BASELINE: ['fixture', 'Inspect the baseline mock output and verifier.'],
13
+ MOCK_TREATMENT: ['fixture', 'Inspect the treatment mock output and verifier.'],
14
+ FIXTURE_SIZE: ['fixture', 'Shrink the fixture while preserving the real defect and acceptance checks.'],
15
+ TRIGGER_LABEL: ['shouldTrigger', 'Label trigger tasks and include appropriate negative controls.'],
16
+ NEGATIVE_CONTROLS: ['shouldTrigger', 'Add representative shouldTrigger:false tasks to reach the documented 30% target.'],
17
+ CALIBRATION: [null, 'Inspect the calibration records before considering a separately budgeted run.'],
18
+ };
19
+ export function benchDiagnostic(code, status, message, task, evidence = null) {
20
+ const [field, remediation] = GATES[code];
21
+ const marker = code.startsWith('MOCK_');
22
+ const path = task && field === 'fixture'
23
+ ? `${task.fixture}${marker ? `/${MOCK_MARKER_FILE}` : ''}` : 'bench.json';
24
+ return { code, status, message, taskId: task?.id ?? null,
25
+ location: { path, field: path === 'bench.json' && field ? `tasks[].${field}` : null },
26
+ remediation: status === 'FAIL' || status === 'WARN' ? remediation : null, evidence };
27
+ }
28
+ /** Bound process text without dropping exit status or individual verifier checks. */
29
+ export function benchCheckEvidence(result, command) {
30
+ // Verifier JSON is interpreted consistently with the existing runner.
31
+ return { command, exitCode: result.exitCode, error: result.error,
32
+ output: result.output.slice(-8192), outputTruncated: result.output.length > 8192,
33
+ checks: verdictFromOutput(result.output)?.checks ?? null };
34
+ }
35
+ export function benchCheckJson(report) {
36
+ if (report.checks.some(c => c.code === 'CALIBRATION'))
37
+ throw new Error('JSON bench checks must be offline; calibration results are not supported.');
38
+ return { schemaVersion: 1, kind: 'skillfit.bench-check', status: report.failures ? 'failed' : 'passed',
39
+ scope: 'offline-integrity', dir: report.dir, bench: report.bench, checks: report.checks,
40
+ summary: { total: report.checks.length, passed: report.checks.filter(c => c.status === 'PASS').length,
41
+ warnings: report.warnings, failures: report.failures, info: report.checks.filter(c => c.status === 'INFO').length },
42
+ error: null };
43
+ }
44
+ export function benchCheckError(error) {
45
+ return { schemaVersion: 1, kind: 'skillfit.bench-check', status: 'error', scope: 'offline-integrity',
46
+ dir: null, bench: null, checks: [], summary: null,
47
+ error: { code: 'INVALID_OR_FAILED_CHECK', message: error instanceof Error ? error.message : String(error) } };
48
+ }
@@ -0,0 +1,129 @@
1
+ /** A dependency-free teaching case; users replace it with their own real task. */
2
+ export function commandTemplateFiles(benchName) {
3
+ const prompt = `# Repair the addition function
4
+
5
+ The repository in your current working directory exports \`add(a, b)\` from
6
+ \`index.js\`. It should return the sum of two numbers, including zero, negatives
7
+ and fractions, but currently subtracts them. Fix the implementation and run
8
+ \`node --test test.mjs\`. Keep \`package.json\` and \`test.mjs\` unchanged.
9
+ `;
10
+ return {
11
+ 'bench.json': JSON.stringify({
12
+ schemaVersion: 1,
13
+ name: benchName,
14
+ description: 'Teaching case for file edits; replace with a real task from your work.',
15
+ tasks: [{
16
+ id: 'example-task',
17
+ fixture: 'fixtures/example-task',
18
+ prompt: 'prompts/example-task.md',
19
+ promptTrigger: 'prompts/example-task.trigger.md',
20
+ verifierKind: 'command',
21
+ verifier: 'node verifiers/example-task.mjs',
22
+ oracle: 'node ground-truth/oracle-example-task.mjs',
23
+ rubric: 'ground-truth/example-task.md',
24
+ }],
25
+ }, null, 2) + '\n',
26
+ 'prompts/example-task.md': prompt,
27
+ 'prompts/example-task.trigger.md': prompt,
28
+ 'fixtures/example-task/package.json': JSON.stringify({
29
+ private: true, type: 'module', scripts: { test: 'node --test test.mjs' },
30
+ }, null, 2) + '\n',
31
+ 'fixtures/example-task/index.js': 'export function add(a, b) { return a - b; }\n',
32
+ 'fixtures/example-task/test.mjs': `import assert from 'node:assert/strict';
33
+ import { test } from 'node:test';
34
+ import { add } from './index.js';
35
+
36
+ test('positive numbers and zero', () => {
37
+ assert.equal(add(2, 3), 5);
38
+ assert.equal(add(0, 4), 4);
39
+ });
40
+ test('negative numbers', () => {
41
+ assert.equal(add(-2, -3), -5);
42
+ assert.equal(add(-2, 5), 3);
43
+ });
44
+ test('fractions', () => {
45
+ assert.equal(add(0.25, 0.5), 0.75);
46
+ assert.equal(add(-0.5, 0.25), -0.25);
47
+ });
48
+ `,
49
+ 'verifiers/example-task.mjs': String.raw `import { spawnSync } from 'node:child_process';
50
+ import { readFileSync } from 'node:fs';
51
+ import { join } from 'node:path';
52
+ import { fileURLToPath } from 'node:url';
53
+
54
+ const runDir = process.argv[2];
55
+ if (!runDir) {
56
+ console.error('usage: node example-task.mjs <run-dir>');
57
+ process.exit(2);
58
+ }
59
+ const names = ['positive-and-zero', 'negative-numbers', 'fractions'];
60
+ const checks = [{ name: 'protected-assets', pass: false },
61
+ ...names.map(name => ({ name, pass: false }))];
62
+ try {
63
+ checks[0].pass = ['package.json', 'test.mjs'].every(file =>
64
+ readFileSync(join(runDir, file)).equals(
65
+ readFileSync(new URL('../fixtures/example-task/' + file, import.meta.url))));
66
+ } catch { /* Missing protected files fail the same gate. */ }
67
+
68
+ if (checks[0].pass) {
69
+ // Grade behavior outside the editable fixture tests, in a separate process.
70
+ // A crash, early exit, syntax error or deadline cannot become a passing grade.
71
+ const probe = fileURLToPath(new URL('./probe-example-task.mjs', import.meta.url));
72
+ const result = spawnSync(process.execPath, [probe, runDir],
73
+ { cwd: runDir, encoding: 'utf8', timeout: 5_000, maxBuffer: 64 * 1024 });
74
+ try {
75
+ const values = JSON.parse(result.stdout.trim().split('\n').at(-1));
76
+ if (!result.error && result.status === 0 && Array.isArray(values) &&
77
+ values.length === names.length && values.every(value => typeof value === 'boolean')) {
78
+ values.forEach((pass, i) => { checks[i + 1].pass = pass; });
79
+ }
80
+ } catch { /* No valid result means the behavior checks stay false. */ }
81
+ }
82
+ const passed = checks.every(check => check.pass);
83
+ console.log(JSON.stringify({ passed, checks }));
84
+ process.exit(passed ? 0 : 1);
85
+ `,
86
+ 'verifiers/probe-example-task.mjs': `import { pathToFileURL } from 'node:url';
87
+ import { join } from 'node:path';
88
+
89
+ const { add } = await import(pathToFileURL(join(process.argv[2], 'index.js')).href);
90
+ const groups = [
91
+ [[2, 3, 5], [0, 4, 4], [8, 0, 8]],
92
+ [[-2, -3, -5], [-2, 5, 3], [3, -7, -4]],
93
+ [[0.25, 0.5, 0.75], [-0.5, 0.25, -0.25]],
94
+ ];
95
+ const results = groups.map(cases => cases.every(([a, b, expected]) => {
96
+ try { return add(a, b) === expected; } catch { return false; }
97
+ }));
98
+ console.log(JSON.stringify(results));
99
+ `,
100
+ 'ground-truth/oracle-example-task.mjs': String.raw `import { writeFileSync } from 'node:fs';
101
+ import { join } from 'node:path';
102
+
103
+ const runDir = process.argv[2];
104
+ if (!runDir) {
105
+ console.error('usage: node oracle-example-task.mjs <run-dir>');
106
+ process.exit(2);
107
+ }
108
+ writeFileSync(join(runDir, 'index.js'), 'export function add(a, b) { return a + b; }\n');
109
+ `,
110
+ 'ground-truth/example-task.md': `# Ground truth — example-task
111
+
112
+ This is a synthetic teaching case, not evidence that a Skill improves real tasks.
113
+ The original subtracts; the reference repair returns the sum. Equivalent repairs
114
+ are accepted by behavior rather than matching reference source bytes.
115
+
116
+ The verifier checks protected fixture assets, positive numbers / zero, negatives,
117
+ and fractions. It runs its own behavior probes outside the agent's editable
118
+ fixture. Changing or removing \`package.json\` or \`test.mjs\` fails validation.
119
+
120
+ Replace the fixture, prompt, verifier and oracle together with your real task.
121
+ Keep reference answers outside the fixture; freeze independent acceptance checks
122
+ before comparing Skills. Run \`skillfit bench check\` before spending on an agent.
123
+ Use \`--input workspace\` with a local CLI executor to evaluate file edits.
124
+ The starter has one task and no trigger labels; it cannot support an adoption
125
+ claim or measure trigger recall. Add representative tasks and negative controls
126
+ where appropriate. See docs/bench-authoring.md in the skillfit repository.
127
+ `,
128
+ };
129
+ }
@@ -0,0 +1,91 @@
1
+ import { lstatSync, readFileSync } from 'node:fs';
2
+ import { join, resolve } from 'node:path';
3
+ import { loadBench, validateBenchTask } from '../harness/bench.js';
4
+ import { applyBenchWrites } from './bench.js';
5
+ import { BACKUP_SUFFIX } from './install.js';
6
+ const EDITABLE = ['fixture', 'prompt', 'promptTrigger', 'verifier', 'verifierKind', 'oracle', 'rubric', 'shouldTrigger'];
7
+ const OPTIONAL = ['promptTrigger', 'oracle', 'rubric', 'shouldTrigger'];
8
+ export function inspectBench(dir, taskId) {
9
+ const bench = loadBench(dir);
10
+ const tasks = taskId === undefined ? bench.tasks : bench.tasks.filter(task => task.id === taskId);
11
+ if (!tasks.length)
12
+ throw new Error(`Unknown task: ${taskId}`);
13
+ return { schemaVersion: 1, kind: taskId === undefined ? 'skillfit.bench-list' : 'skillfit.bench-task',
14
+ dir: bench.dir, name: bench.name, sha256: bench.contentSha256,
15
+ tasks: tasks.map(task => ({ ...task, verifierKind: task.verifierKind ?? 'output', shouldTrigger: task.shouldTrigger ?? null })) };
16
+ }
17
+ /** Modify only the registration; shared fixtures, graders and evidence stay in place. */
18
+ export function manageBench(options) {
19
+ const dir = resolve(options.dir), path = join(dir, 'bench.json');
20
+ if (lstatSync(path).isSymbolicLink())
21
+ throw new Error('Refusing to edit a symlinked bench.json.');
22
+ const before = readFileSync(path, 'utf8');
23
+ const bench = loadBench(dir);
24
+ const manifest = JSON.parse(before);
25
+ const index = manifest.tasks.findIndex(task => task.id === options.taskId);
26
+ if (index < 0)
27
+ throw new Error(`Unknown task: ${options.taskId}`);
28
+ const original = { ...manifest.tasks[index] };
29
+ if (options.action === 'remove') {
30
+ if (options.set?.length || options.unset?.length)
31
+ throw new Error('Removal cannot be combined with --set or --unset.');
32
+ if (manifest.tasks.length === 1)
33
+ throw new Error('Cannot remove the last task. Add a real task before removing the teaching case.');
34
+ manifest.tasks.splice(index, 1);
35
+ }
36
+ else {
37
+ if (!options.set?.length && !options.unset?.length)
38
+ throw new Error('Editing requires --set field=value or --unset field.');
39
+ const next = { ...original }, touched = new Set();
40
+ for (const assignment of options.set ?? []) {
41
+ const at = assignment.indexOf('=');
42
+ if (at < 1)
43
+ throw new Error(`Invalid --set: ${assignment}; expected field=value.`);
44
+ const field = assignment.slice(0, at), value = assignment.slice(at + 1);
45
+ if (!EDITABLE.includes(field))
46
+ throw new Error(`Field is not editable: ${field}`);
47
+ if (touched.has(field))
48
+ throw new Error(`Repeated edit field: ${field}`);
49
+ touched.add(field);
50
+ if (field === 'shouldTrigger') {
51
+ if (value !== 'true' && value !== 'false')
52
+ throw new Error('shouldTrigger must be true or false.');
53
+ next[field] = value === 'true';
54
+ }
55
+ else
56
+ next[field] = value;
57
+ }
58
+ for (const field of options.unset ?? []) {
59
+ if (!OPTIONAL.includes(field))
60
+ throw new Error(`Field cannot be unset: ${field}`);
61
+ if (touched.has(field))
62
+ throw new Error(`Repeated edit field: ${field}`);
63
+ touched.add(field);
64
+ delete next[field];
65
+ }
66
+ validateBenchTask(dir, next, index);
67
+ manifest.tasks[index] = next;
68
+ }
69
+ const after = options.action === 'remove' ? null : manifest.tasks[index];
70
+ const changed = JSON.stringify(original) !== JSON.stringify(after);
71
+ const apply = !!options.yes && !options.dryRun && changed;
72
+ const result = { schemaVersion: 1, kind: 'skillfit.bench-change', action: options.action,
73
+ dir, taskId: options.taskId, status: apply ? 'applied' : changed ? 'planned' : 'unchanged',
74
+ before: original, after, filesPreserved: true, backup: path + BACKUP_SUFFIX,
75
+ previousSha256: bench.contentSha256, sha256: bench.contentSha256 };
76
+ const log = options.log ?? console.log;
77
+ log(`${options.action === 'edit' ? 'Edit' : 'Unregister'} task ${options.taskId} in ${path}`);
78
+ log(`Before: ${JSON.stringify(original)}`);
79
+ log(`After: ${JSON.stringify(after)}`);
80
+ log('Only bench.json changes; task files remain in place.');
81
+ if (apply) {
82
+ if (readFileSync(path, 'utf8') !== before)
83
+ throw new Error('bench.json changed after the plan; nothing written.');
84
+ applyBenchWrites(dir, [{ target: path, content: JSON.stringify(manifest, null, 2) + '\n' }]);
85
+ result.sha256 = loadBench(dir).contentSha256;
86
+ log(`Applied and verified. Backup: ${result.backup}`);
87
+ }
88
+ else
89
+ log(changed ? 'Plan only — re-run with --yes to apply.' : 'No changes needed.');
90
+ return result;
91
+ }
@@ -0,0 +1,87 @@
1
+ import assert from 'node:assert/strict';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { existsSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { join } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { test } from 'node:test';
8
+ import { inspectBench, manageBench } from './bench-manage.js';
9
+ import { applyBenchWrites, runBenchInit } from './bench.js';
10
+ import { loadBench } from '../harness/bench.js';
11
+ const CLI = fileURLToPath(new URL('../cli.js', import.meta.url));
12
+ async function setup(t) {
13
+ const root = mkdtempSync(join(tmpdir(), 'skillfit-manage-'));
14
+ t.after(() => rmSync(root, { recursive: true, force: true }));
15
+ const dir = join(root, 'bench');
16
+ await runBenchInit({ dir, kind: 'command', yes: true, log: () => { } });
17
+ return { root, dir, path: join(dir, 'bench.json') };
18
+ }
19
+ test('case listing/showing and default edit plans are read-only', async (t) => {
20
+ const { dir, path } = await setup(t), before = readFileSync(path, 'utf8');
21
+ assert.equal(inspectBench(dir).tasks.length, 1);
22
+ assert.equal(inspectBench(dir, 'example-task').tasks[0].verifierKind, 'command');
23
+ assert.throws(() => inspectBench(dir, 'missing'), /Unknown task/);
24
+ const result = manageBench({ dir, taskId: 'example-task', action: 'edit', set: ['shouldTrigger=false'], log: () => { } });
25
+ assert.equal(result.status, 'planned');
26
+ assert.equal(result.after.shouldTrigger, false);
27
+ assert.equal(readFileSync(path, 'utf8'), before);
28
+ assert.ok(!existsSync(path + '.skillfit-bak'));
29
+ });
30
+ test('case edits verify schema, preserve first backups and unregister without deleting shared files', async (t) => {
31
+ const { dir, path } = await setup(t);
32
+ const raw = JSON.parse(readFileSync(path, 'utf8'));
33
+ raw.tasks.push({ ...raw.tasks[0], id: 'real-task', provenance: 'keep me' });
34
+ writeFileSync(path, JSON.stringify(raw));
35
+ const before = readFileSync(path, 'utf8');
36
+ const base = { dir, taskId: 'real-task', yes: true, log: () => { } };
37
+ assert.equal(manageBench({ ...base, action: 'edit', set: ['shouldTrigger=true'] }).status, 'applied');
38
+ assert.equal(readFileSync(path + '.skillfit-bak', 'utf8'), before);
39
+ assert.equal(JSON.parse(readFileSync(path, 'utf8')).tasks[1].provenance, 'keep me');
40
+ manageBench({ ...base, action: 'edit', unset: ['shouldTrigger'] });
41
+ assert.equal(readFileSync(path + '.skillfit-bak', 'utf8'), before);
42
+ const result = manageBench({ ...base, taskId: 'example-task', action: 'remove' });
43
+ assert.equal(result.status, 'applied');
44
+ assert.deepEqual(loadBench(dir).tasks.map(task => task.id), ['real-task']);
45
+ assert.ok(existsSync(join(dir, 'fixtures/example-task/index.js')));
46
+ assert.ok(existsSync(join(dir, 'verifiers/example-task.mjs')));
47
+ assert.throws(() => manageBench({ ...base, action: 'remove' }), /last task/);
48
+ });
49
+ test('invalid edits, repeated fields and rollback never replace a valid bench', async (t) => {
50
+ const { dir, path } = await setup(t), before = readFileSync(path, 'utf8');
51
+ for (const set of [['id=renamed'], ['fixture=../outside'], ['verifier='], ['shouldTrigger=maybe'], ['shouldTrigger=true', 'shouldTrigger=false']]) {
52
+ assert.throws(() => manageBench({ dir, taskId: 'example-task', action: 'edit', set, yes: true, log: () => { } }));
53
+ assert.equal(readFileSync(path, 'utf8'), before);
54
+ }
55
+ assert.throws(() => applyBenchWrites(dir, [{ target: path, content: '{' }]));
56
+ assert.equal(readFileSync(path, 'utf8'), before);
57
+ });
58
+ test('a dangling backup symlink cannot write outside the case directory', async (t) => {
59
+ const { root, dir, path } = await setup(t), outside = join(root, 'outside');
60
+ try {
61
+ symlinkSync(outside, path + '.skillfit-bak', 'file');
62
+ }
63
+ catch (error) {
64
+ if (error.code === 'EPERM') {
65
+ t.skip('File symlinks require platform privileges.');
66
+ return;
67
+ }
68
+ throw error;
69
+ }
70
+ const before = readFileSync(path, 'utf8');
71
+ assert.throws(() => manageBench({ dir, taskId: 'example-task', action: 'edit', set: ['shouldTrigger=true'], yes: true, log: () => { } }), /unsafe backup/);
72
+ assert.equal(readFileSync(path, 'utf8'), before);
73
+ assert.ok(!existsSync(outside));
74
+ });
75
+ test('case-management CLI returns JSON plans and structured errors without prompts', async (t) => {
76
+ const { dir, path } = await setup(t), before = readFileSync(path, 'utf8');
77
+ for (const args of [['list', dir], ['show', dir, 'example-task'], ['edit', dir, 'example-task', '--set', 'shouldTrigger=false']]) {
78
+ const result = spawnSync(process.execPath, [CLI, 'bench', ...args, '--json'], { encoding: 'utf8', input: '', timeout: 30_000 });
79
+ assert.equal(result.status, 0, result.stderr);
80
+ assert.equal(result.stderr, '');
81
+ assert.equal(JSON.parse(result.stdout).schemaVersion, 1);
82
+ }
83
+ assert.equal(readFileSync(path, 'utf8'), before);
84
+ const bad = spawnSync(process.execPath, [CLI, 'bench', 'show', dir, 'missing', '--json'], { encoding: 'utf8' });
85
+ assert.equal(bad.status, 2);
86
+ assert.equal(JSON.parse(bad.stdout).kind, 'skillfit.bench-error');
87
+ });