@su-record/vibe 3.2.14 → 3.2.16

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 (351) hide show
  1. package/dist/cli/commands/index.d.ts +1 -1
  2. package/dist/cli/commands/index.d.ts.map +1 -1
  3. package/dist/cli/commands/index.js +1 -1
  4. package/dist/cli/commands/index.js.map +1 -1
  5. package/dist/cli/commands/info.d.ts +3 -1
  6. package/dist/cli/commands/info.d.ts.map +1 -1
  7. package/dist/cli/commands/info.js +12 -3
  8. package/dist/cli/commands/info.js.map +1 -1
  9. package/dist/cli/commands/init.d.ts +0 -7
  10. package/dist/cli/commands/init.d.ts.map +1 -1
  11. package/dist/cli/commands/init.js +5 -37
  12. package/dist/cli/commands/init.js.map +1 -1
  13. package/dist/cli/commands/update.d.ts.map +1 -1
  14. package/dist/cli/commands/update.js +4 -6
  15. package/dist/cli/commands/update.js.map +1 -1
  16. package/dist/cli/commands/upgrade.d.ts +1 -1
  17. package/dist/cli/commands/upgrade.d.ts.map +1 -1
  18. package/dist/cli/commands/upgrade.js +7 -2
  19. package/dist/cli/commands/upgrade.js.map +1 -1
  20. package/dist/cli/postinstall/claude-agents.js +1 -1
  21. package/dist/cli/postinstall/claude-agents.js.map +1 -1
  22. package/dist/cli/postinstall/constants.d.ts +0 -1
  23. package/dist/cli/postinstall/constants.d.ts.map +1 -1
  24. package/dist/cli/postinstall/constants.js +0 -8
  25. package/dist/cli/postinstall/constants.js.map +1 -1
  26. package/dist/cli/postinstall/main.d.ts.map +1 -1
  27. package/dist/cli/postinstall/main.js +20 -13
  28. package/dist/cli/postinstall/main.js.map +1 -1
  29. package/dist/cli/postinstall.d.ts +0 -3
  30. package/dist/cli/postinstall.d.ts.map +1 -1
  31. package/dist/cli/postinstall.js +0 -3
  32. package/dist/cli/postinstall.js.map +1 -1
  33. package/dist/cli/setup/InstallHome.d.ts +27 -0
  34. package/dist/cli/setup/InstallHome.d.ts.map +1 -0
  35. package/dist/cli/setup/InstallHome.js +105 -0
  36. package/dist/cli/setup/InstallHome.js.map +1 -0
  37. package/dist/cli/setup/ProjectSetup.d.ts +0 -8
  38. package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
  39. package/dist/cli/setup/ProjectSetup.js +0 -96
  40. package/dist/cli/setup/ProjectSetup.js.map +1 -1
  41. package/dist/cli/setup.d.ts +1 -1
  42. package/dist/cli/setup.d.ts.map +1 -1
  43. package/dist/cli/setup.js +1 -1
  44. package/dist/cli/setup.js.map +1 -1
  45. package/dist/infra/lib/codex-proxy.d.ts +126 -0
  46. package/dist/infra/lib/codex-proxy.d.ts.map +1 -1
  47. package/dist/infra/lib/codex-proxy.js +16 -16
  48. package/dist/infra/lib/codex-proxy.js.map +1 -1
  49. package/dist/infra/lib/figma/audit.d.ts.map +1 -1
  50. package/dist/infra/lib/figma/audit.js +0 -2
  51. package/dist/infra/lib/figma/audit.js.map +1 -1
  52. package/dist/infra/lib/figma/extract.d.ts +6 -1
  53. package/dist/infra/lib/figma/extract.d.ts.map +1 -1
  54. package/dist/infra/lib/figma/extract.js +17 -15
  55. package/dist/infra/lib/figma/extract.js.map +1 -1
  56. package/dist/infra/lib/figma/types.d.ts +103 -0
  57. package/dist/infra/lib/figma/types.d.ts.map +1 -1
  58. package/dist/infra/lib/figma/types.js +8 -0
  59. package/dist/infra/lib/figma/types.js.map +1 -1
  60. package/hooks/scripts/clone-extract.js +16 -1
  61. package/hooks/scripts/code-check.js +12 -5
  62. package/hooks/scripts/lib/dispatcher.js +43 -3
  63. package/hooks/scripts/utils.js +32 -2
  64. package/package.json +10 -8
  65. package/dist/__tests__/agent-model-sync.test.d.ts +0 -2
  66. package/dist/__tests__/agent-model-sync.test.d.ts.map +0 -1
  67. package/dist/__tests__/agent-model-sync.test.js +0 -71
  68. package/dist/__tests__/agent-model-sync.test.js.map +0 -1
  69. package/dist/__tests__/architecture.test.d.ts +0 -2
  70. package/dist/__tests__/architecture.test.d.ts.map +0 -1
  71. package/dist/__tests__/architecture.test.js +0 -207
  72. package/dist/__tests__/architecture.test.js.map +0 -1
  73. package/dist/__tests__/engines-contract.test.d.ts +0 -2
  74. package/dist/__tests__/engines-contract.test.d.ts.map +0 -1
  75. package/dist/__tests__/engines-contract.test.js +0 -72
  76. package/dist/__tests__/engines-contract.test.js.map +0 -1
  77. package/dist/__tests__/instruction-drift.test.d.ts +0 -2
  78. package/dist/__tests__/instruction-drift.test.d.ts.map +0 -1
  79. package/dist/__tests__/instruction-drift.test.js +0 -116
  80. package/dist/__tests__/instruction-drift.test.js.map +0 -1
  81. package/dist/__tests__/skill-namespace.test.d.ts +0 -2
  82. package/dist/__tests__/skill-namespace.test.d.ts.map +0 -1
  83. package/dist/__tests__/skill-namespace.test.js +0 -60
  84. package/dist/__tests__/skill-namespace.test.js.map +0 -1
  85. package/dist/__tests__/stakes-contract.test.d.ts +0 -2
  86. package/dist/__tests__/stakes-contract.test.d.ts.map +0 -1
  87. package/dist/__tests__/stakes-contract.test.js +0 -173
  88. package/dist/__tests__/stakes-contract.test.js.map +0 -1
  89. package/dist/__tests__/stuck-semantics.test.d.ts +0 -2
  90. package/dist/__tests__/stuck-semantics.test.d.ts.map +0 -1
  91. package/dist/__tests__/stuck-semantics.test.js +0 -161
  92. package/dist/__tests__/stuck-semantics.test.js.map +0 -1
  93. package/dist/__tests__/wiring-integrity.test.d.ts +0 -2
  94. package/dist/__tests__/wiring-integrity.test.d.ts.map +0 -1
  95. package/dist/__tests__/wiring-integrity.test.js +0 -160
  96. package/dist/__tests__/wiring-integrity.test.js.map +0 -1
  97. package/dist/cli/commands/info.test.d.ts +0 -2
  98. package/dist/cli/commands/info.test.d.ts.map +0 -1
  99. package/dist/cli/commands/info.test.js +0 -74
  100. package/dist/cli/commands/info.test.js.map +0 -1
  101. package/dist/cli/commands/upgrade.test.d.ts +0 -2
  102. package/dist/cli/commands/upgrade.test.d.ts.map +0 -1
  103. package/dist/cli/commands/upgrade.test.js +0 -99
  104. package/dist/cli/commands/upgrade.test.js.map +0 -1
  105. package/dist/cli/design/design-md-parser.test.d.ts +0 -2
  106. package/dist/cli/design/design-md-parser.test.d.ts.map +0 -1
  107. package/dist/cli/design/design-md-parser.test.js +0 -149
  108. package/dist/cli/design/design-md-parser.test.js.map +0 -1
  109. package/dist/cli/detect.characterization.test.d.ts +0 -7
  110. package/dist/cli/detect.characterization.test.d.ts.map +0 -1
  111. package/dist/cli/detect.characterization.test.js +0 -294
  112. package/dist/cli/detect.characterization.test.js.map +0 -1
  113. package/dist/cli/postinstall/cursor-agents.d.ts +0 -13
  114. package/dist/cli/postinstall/cursor-agents.d.ts.map +0 -1
  115. package/dist/cli/postinstall/cursor-agents.js +0 -89
  116. package/dist/cli/postinstall/cursor-agents.js.map +0 -1
  117. package/dist/cli/postinstall/cursor-rules.d.ts +0 -11
  118. package/dist/cli/postinstall/cursor-rules.d.ts.map +0 -1
  119. package/dist/cli/postinstall/cursor-rules.js +0 -205
  120. package/dist/cli/postinstall/cursor-rules.js.map +0 -1
  121. package/dist/cli/postinstall/cursor-skills.d.ts +0 -9
  122. package/dist/cli/postinstall/cursor-skills.d.ts.map +0 -1
  123. package/dist/cli/postinstall/cursor-skills.js +0 -796
  124. package/dist/cli/postinstall/cursor-skills.js.map +0 -1
  125. package/dist/cli/postinstall/fs-utils.test.d.ts +0 -2
  126. package/dist/cli/postinstall/fs-utils.test.d.ts.map +0 -1
  127. package/dist/cli/postinstall/fs-utils.test.js +0 -259
  128. package/dist/cli/postinstall/fs-utils.test.js.map +0 -1
  129. package/dist/cli/setup/CodexHooks.test.d.ts +0 -2
  130. package/dist/cli/setup/CodexHooks.test.d.ts.map +0 -1
  131. package/dist/cli/setup/CodexHooks.test.js +0 -52
  132. package/dist/cli/setup/CodexHooks.test.js.map +0 -1
  133. package/dist/cli/setup/GlobalInstaller.test.d.ts +0 -2
  134. package/dist/cli/setup/GlobalInstaller.test.d.ts.map +0 -1
  135. package/dist/cli/setup/GlobalInstaller.test.js +0 -16
  136. package/dist/cli/setup/GlobalInstaller.test.js.map +0 -1
  137. package/dist/cli/utils/cli-detector.test.d.ts +0 -2
  138. package/dist/cli/utils/cli-detector.test.d.ts.map +0 -1
  139. package/dist/cli/utils/cli-detector.test.js +0 -52
  140. package/dist/cli/utils/cli-detector.test.js.map +0 -1
  141. package/dist/infra/lib/SkillFrontmatter.test.d.ts +0 -2
  142. package/dist/infra/lib/SkillFrontmatter.test.d.ts.map +0 -1
  143. package/dist/infra/lib/SkillFrontmatter.test.js +0 -60
  144. package/dist/infra/lib/SkillFrontmatter.test.js.map +0 -1
  145. package/dist/infra/lib/__tests__/AutomationLevel.test.d.ts +0 -2
  146. package/dist/infra/lib/__tests__/AutomationLevel.test.d.ts.map +0 -1
  147. package/dist/infra/lib/__tests__/AutomationLevel.test.js +0 -297
  148. package/dist/infra/lib/__tests__/AutomationLevel.test.js.map +0 -1
  149. package/dist/infra/lib/__tests__/ComponentRegistry.test.d.ts +0 -2
  150. package/dist/infra/lib/__tests__/ComponentRegistry.test.d.ts.map +0 -1
  151. package/dist/infra/lib/__tests__/ComponentRegistry.test.js +0 -99
  152. package/dist/infra/lib/__tests__/ComponentRegistry.test.js.map +0 -1
  153. package/dist/infra/lib/__tests__/DecisionTracer.test.d.ts +0 -2
  154. package/dist/infra/lib/__tests__/DecisionTracer.test.d.ts.map +0 -1
  155. package/dist/infra/lib/__tests__/DecisionTracer.test.js +0 -274
  156. package/dist/infra/lib/__tests__/DecisionTracer.test.js.map +0 -1
  157. package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.d.ts +0 -2
  158. package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.d.ts.map +0 -1
  159. package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.js +0 -350
  160. package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.js.map +0 -1
  161. package/dist/infra/lib/__tests__/LoopBreaker.test.d.ts +0 -2
  162. package/dist/infra/lib/__tests__/LoopBreaker.test.d.ts.map +0 -1
  163. package/dist/infra/lib/__tests__/LoopBreaker.test.js +0 -340
  164. package/dist/infra/lib/__tests__/LoopBreaker.test.js.map +0 -1
  165. package/dist/infra/lib/__tests__/VerificationLoop.test.d.ts +0 -2
  166. package/dist/infra/lib/__tests__/VerificationLoop.test.d.ts.map +0 -1
  167. package/dist/infra/lib/__tests__/VerificationLoop.test.js +0 -486
  168. package/dist/infra/lib/__tests__/VerificationLoop.test.js.map +0 -1
  169. package/dist/infra/lib/config/GlobalConfigManager.test.d.ts +0 -2
  170. package/dist/infra/lib/config/GlobalConfigManager.test.d.ts.map +0 -1
  171. package/dist/infra/lib/config/GlobalConfigManager.test.js +0 -9
  172. package/dist/infra/lib/config/GlobalConfigManager.test.js.map +0 -1
  173. package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.d.ts +0 -2
  174. package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.d.ts.map +0 -1
  175. package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.js +0 -43
  176. package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.js.map +0 -1
  177. package/dist/infra/lib/embedding/__tests__/VectorStore.test.d.ts +0 -2
  178. package/dist/infra/lib/embedding/__tests__/VectorStore.test.d.ts.map +0 -1
  179. package/dist/infra/lib/embedding/__tests__/VectorStore.test.js +0 -94
  180. package/dist/infra/lib/embedding/__tests__/VectorStore.test.js.map +0 -1
  181. package/dist/infra/lib/embedding/__tests__/cosine.test.d.ts +0 -2
  182. package/dist/infra/lib/embedding/__tests__/cosine.test.d.ts.map +0 -1
  183. package/dist/infra/lib/embedding/__tests__/cosine.test.js +0 -73
  184. package/dist/infra/lib/embedding/__tests__/cosine.test.js.map +0 -1
  185. package/dist/infra/lib/evolution/__tests__/deprecation.test.d.ts +0 -2
  186. package/dist/infra/lib/evolution/__tests__/deprecation.test.d.ts.map +0 -1
  187. package/dist/infra/lib/evolution/__tests__/deprecation.test.js +0 -251
  188. package/dist/infra/lib/evolution/__tests__/deprecation.test.js.map +0 -1
  189. package/dist/infra/lib/evolution/__tests__/eval.test.d.ts +0 -2
  190. package/dist/infra/lib/evolution/__tests__/eval.test.d.ts.map +0 -1
  191. package/dist/infra/lib/evolution/__tests__/eval.test.js +0 -603
  192. package/dist/infra/lib/evolution/__tests__/eval.test.js.map +0 -1
  193. package/dist/infra/lib/evolution/__tests__/generation.test.d.ts +0 -2
  194. package/dist/infra/lib/evolution/__tests__/generation.test.d.ts.map +0 -1
  195. package/dist/infra/lib/evolution/__tests__/generation.test.js +0 -396
  196. package/dist/infra/lib/evolution/__tests__/generation.test.js.map +0 -1
  197. package/dist/infra/lib/evolution/__tests__/insight.test.d.ts +0 -2
  198. package/dist/infra/lib/evolution/__tests__/insight.test.d.ts.map +0 -1
  199. package/dist/infra/lib/evolution/__tests__/insight.test.js +0 -204
  200. package/dist/infra/lib/evolution/__tests__/insight.test.js.map +0 -1
  201. package/dist/infra/lib/evolution/__tests__/integration.test.d.ts +0 -2
  202. package/dist/infra/lib/evolution/__tests__/integration.test.d.ts.map +0 -1
  203. package/dist/infra/lib/evolution/__tests__/integration.test.js +0 -206
  204. package/dist/infra/lib/evolution/__tests__/integration.test.js.map +0 -1
  205. package/dist/infra/lib/evolution/__tests__/lifecycle.test.d.ts +0 -2
  206. package/dist/infra/lib/evolution/__tests__/lifecycle.test.d.ts.map +0 -1
  207. package/dist/infra/lib/evolution/__tests__/lifecycle.test.js +0 -350
  208. package/dist/infra/lib/evolution/__tests__/lifecycle.test.js.map +0 -1
  209. package/dist/infra/lib/evolution/__tests__/parity.test.d.ts +0 -2
  210. package/dist/infra/lib/evolution/__tests__/parity.test.d.ts.map +0 -1
  211. package/dist/infra/lib/evolution/__tests__/parity.test.js +0 -319
  212. package/dist/infra/lib/evolution/__tests__/parity.test.js.map +0 -1
  213. package/dist/infra/lib/llm/auth/AuthProfileManager.test.d.ts +0 -5
  214. package/dist/infra/lib/llm/auth/AuthProfileManager.test.d.ts.map +0 -1
  215. package/dist/infra/lib/llm/auth/AuthProfileManager.test.js +0 -168
  216. package/dist/infra/lib/llm/auth/AuthProfileManager.test.js.map +0 -1
  217. package/dist/infra/lib/llm/auth/TokenRefresher.test.d.ts +0 -2
  218. package/dist/infra/lib/llm/auth/TokenRefresher.test.d.ts.map +0 -1
  219. package/dist/infra/lib/llm/auth/TokenRefresher.test.js +0 -120
  220. package/dist/infra/lib/llm/auth/TokenRefresher.test.js.map +0 -1
  221. package/dist/infra/lib/llm/timeout.test.d.ts +0 -2
  222. package/dist/infra/lib/llm/timeout.test.d.ts.map +0 -1
  223. package/dist/infra/lib/llm/timeout.test.js +0 -50
  224. package/dist/infra/lib/llm/timeout.test.js.map +0 -1
  225. package/dist/infra/lib/llm-availability.test.d.ts +0 -2
  226. package/dist/infra/lib/llm-availability.test.d.ts.map +0 -1
  227. package/dist/infra/lib/llm-availability.test.js +0 -37
  228. package/dist/infra/lib/llm-availability.test.js.map +0 -1
  229. package/dist/infra/lib/memory/KnowledgeGraph.test.d.ts +0 -2
  230. package/dist/infra/lib/memory/KnowledgeGraph.test.d.ts.map +0 -1
  231. package/dist/infra/lib/memory/KnowledgeGraph.test.js +0 -189
  232. package/dist/infra/lib/memory/KnowledgeGraph.test.js.map +0 -1
  233. package/dist/infra/lib/memory/MemorySearch.test.d.ts +0 -2
  234. package/dist/infra/lib/memory/MemorySearch.test.d.ts.map +0 -1
  235. package/dist/infra/lib/memory/MemorySearch.test.js +0 -149
  236. package/dist/infra/lib/memory/MemorySearch.test.js.map +0 -1
  237. package/dist/infra/lib/memory/MemoryStorage.test.d.ts +0 -2
  238. package/dist/infra/lib/memory/MemoryStorage.test.d.ts.map +0 -1
  239. package/dist/infra/lib/memory/MemoryStorage.test.js +0 -198
  240. package/dist/infra/lib/memory/MemoryStorage.test.js.map +0 -1
  241. package/dist/infra/lib/memory/SessionRAGRetriever.test.d.ts +0 -2
  242. package/dist/infra/lib/memory/SessionRAGRetriever.test.d.ts.map +0 -1
  243. package/dist/infra/lib/memory/SessionRAGRetriever.test.js +0 -180
  244. package/dist/infra/lib/memory/SessionRAGRetriever.test.js.map +0 -1
  245. package/dist/infra/lib/memory/SessionRAGStore.test.d.ts +0 -2
  246. package/dist/infra/lib/memory/SessionRAGStore.test.d.ts.map +0 -1
  247. package/dist/infra/lib/memory/SessionRAGStore.test.js +0 -326
  248. package/dist/infra/lib/memory/SessionRAGStore.test.js.map +0 -1
  249. package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.d.ts +0 -2
  250. package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.d.ts.map +0 -1
  251. package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.js +0 -114
  252. package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.js.map +0 -1
  253. package/dist/infra/lib/memory/__tests__/ReflectionStore.test.d.ts +0 -2
  254. package/dist/infra/lib/memory/__tests__/ReflectionStore.test.d.ts.map +0 -1
  255. package/dist/infra/lib/memory/__tests__/ReflectionStore.test.js +0 -196
  256. package/dist/infra/lib/memory/__tests__/ReflectionStore.test.js.map +0 -1
  257. package/dist/infra/lib/memory/index.test.d.ts +0 -2
  258. package/dist/infra/lib/memory/index.test.d.ts.map +0 -1
  259. package/dist/infra/lib/memory/index.test.js +0 -23
  260. package/dist/infra/lib/memory/index.test.js.map +0 -1
  261. package/dist/infra/lib/telemetry/SkillTelemetry.test.d.ts +0 -2
  262. package/dist/infra/lib/telemetry/SkillTelemetry.test.d.ts.map +0 -1
  263. package/dist/infra/lib/telemetry/SkillTelemetry.test.js +0 -124
  264. package/dist/infra/lib/telemetry/SkillTelemetry.test.js.map +0 -1
  265. package/dist/infra/lib/ui-ux/Bm25Engine.test.d.ts +0 -2
  266. package/dist/infra/lib/ui-ux/Bm25Engine.test.d.ts.map +0 -1
  267. package/dist/infra/lib/ui-ux/Bm25Engine.test.js +0 -159
  268. package/dist/infra/lib/ui-ux/Bm25Engine.test.js.map +0 -1
  269. package/dist/infra/lib/ui-ux/CsvDataLoader.test.d.ts +0 -2
  270. package/dist/infra/lib/ui-ux/CsvDataLoader.test.d.ts.map +0 -1
  271. package/dist/infra/lib/ui-ux/CsvDataLoader.test.js +0 -141
  272. package/dist/infra/lib/ui-ux/CsvDataLoader.test.js.map +0 -1
  273. package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.d.ts +0 -2
  274. package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.d.ts.map +0 -1
  275. package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.js +0 -370
  276. package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.js.map +0 -1
  277. package/dist/infra/lib/ui-ux/SearchService.test.d.ts +0 -2
  278. package/dist/infra/lib/ui-ux/SearchService.test.d.ts.map +0 -1
  279. package/dist/infra/lib/ui-ux/SearchService.test.js +0 -215
  280. package/dist/infra/lib/ui-ux/SearchService.test.js.map +0 -1
  281. package/dist/test-helpers/index.d.ts +0 -36
  282. package/dist/test-helpers/index.d.ts.map +0 -1
  283. package/dist/test-helpers/index.js +0 -85
  284. package/dist/test-helpers/index.js.map +0 -1
  285. package/dist/test-helpers/index.test.d.ts +0 -2
  286. package/dist/test-helpers/index.test.d.ts.map +0 -1
  287. package/dist/test-helpers/index.test.js +0 -92
  288. package/dist/test-helpers/index.test.js.map +0 -1
  289. package/dist/tests/curated-release-notes.test.d.ts +0 -2
  290. package/dist/tests/curated-release-notes.test.d.ts.map +0 -1
  291. package/dist/tests/curated-release-notes.test.js +0 -160
  292. package/dist/tests/curated-release-notes.test.js.map +0 -1
  293. package/dist/tools/convention/analyzeComplexity.test.d.ts +0 -2
  294. package/dist/tools/convention/analyzeComplexity.test.d.ts.map +0 -1
  295. package/dist/tools/convention/analyzeComplexity.test.js +0 -207
  296. package/dist/tools/convention/analyzeComplexity.test.js.map +0 -1
  297. package/dist/tools/convention/validateCodeQuality.test.d.ts +0 -2
  298. package/dist/tools/convention/validateCodeQuality.test.d.ts.map +0 -1
  299. package/dist/tools/convention/validateCodeQuality.test.js +0 -230
  300. package/dist/tools/convention/validateCodeQuality.test.js.map +0 -1
  301. package/dist/tools/loop/validateLoopDefinition.test.d.ts +0 -14
  302. package/dist/tools/loop/validateLoopDefinition.test.d.ts.map +0 -1
  303. package/dist/tools/loop/validateLoopDefinition.test.js +0 -229
  304. package/dist/tools/loop/validateLoopDefinition.test.js.map +0 -1
  305. package/dist/tools/spec/executionPacket.test.d.ts +0 -2
  306. package/dist/tools/spec/executionPacket.test.d.ts.map +0 -1
  307. package/dist/tools/spec/executionPacket.test.js +0 -374
  308. package/dist/tools/spec/executionPacket.test.js.map +0 -1
  309. package/dist/tools/spec/prdParser.test.d.ts +0 -6
  310. package/dist/tools/spec/prdParser.test.d.ts.map +0 -1
  311. package/dist/tools/spec/prdParser.test.js +0 -332
  312. package/dist/tools/spec/prdParser.test.js.map +0 -1
  313. package/dist/tools/spec/specGenerator.test.d.ts +0 -2
  314. package/dist/tools/spec/specGenerator.test.d.ts.map +0 -1
  315. package/dist/tools/spec/specGenerator.test.js +0 -130
  316. package/dist/tools/spec/specGenerator.test.js.map +0 -1
  317. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts +0 -10
  318. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts.map +0 -1
  319. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js +0 -120
  320. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js.map +0 -1
  321. package/dist/tools/spec/traceabilityMatrix.test.d.ts +0 -6
  322. package/dist/tools/spec/traceabilityMatrix.test.d.ts.map +0 -1
  323. package/dist/tools/spec/traceabilityMatrix.test.js +0 -359
  324. package/dist/tools/spec/traceabilityMatrix.test.js.map +0 -1
  325. package/hooks/scripts/__tests__/.vibe/command-log.txt +0 -3
  326. package/hooks/scripts/__tests__/anchor-inbox.test.js +0 -119
  327. package/hooks/scripts/__tests__/auto-test-debounce.test.js +0 -145
  328. package/hooks/scripts/__tests__/clone-behaviors.test.js +0 -152
  329. package/hooks/scripts/__tests__/clone-merge-responsive.test.js +0 -106
  330. package/hooks/scripts/__tests__/code-check-detectors.test.js +0 -213
  331. package/hooks/scripts/__tests__/code-check-false-positive.test.js +0 -74
  332. package/hooks/scripts/__tests__/code-check-memory-write.test.js +0 -81
  333. package/hooks/scripts/__tests__/codex-hook-adapter.test.js +0 -64
  334. package/hooks/scripts/__tests__/curation-index.test.js +0 -157
  335. package/hooks/scripts/__tests__/dispatcher-inprocess.test.js +0 -99
  336. package/hooks/scripts/__tests__/figma-extract.test.js +0 -338
  337. package/hooks/scripts/__tests__/fixtures/seq-harness.js +0 -13
  338. package/hooks/scripts/__tests__/fixtures/seq-step.js +0 -22
  339. package/hooks/scripts/__tests__/hook-payload.test.js +0 -29
  340. package/hooks/scripts/__tests__/llm-orchestrate-antigravity.test.js +0 -66
  341. package/hooks/scripts/__tests__/loop-ledger.test.js +0 -321
  342. package/hooks/scripts/__tests__/post-edit-dispatcher.test.js +0 -139
  343. package/hooks/scripts/__tests__/pre-tool-guard.test.js +0 -523
  344. package/hooks/scripts/__tests__/recipe-extractor.test.js +0 -244
  345. package/hooks/scripts/__tests__/run-ledger-verify-required.test.js +0 -151
  346. package/hooks/scripts/__tests__/run-ledger.test.js +0 -481
  347. package/hooks/scripts/__tests__/scope-from-spec.test.js +0 -215
  348. package/hooks/scripts/__tests__/sentinel-guard.test.js +0 -263
  349. package/hooks/scripts/__tests__/step-counter.test.js +0 -459
  350. package/hooks/scripts/__tests__/stop-dispatcher-sequential.test.js +0 -74
  351. package/hooks/scripts/__tests__/utils-npm-root.test.js +0 -99
@@ -1,603 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
- import { join } from 'path';
3
- import { tmpdir } from 'os';
4
- import { rmSync } from 'fs';
5
- import { MemoryStorage } from '../../memory/MemoryStorage.js';
6
- import { SkillEvalRunner } from '../SkillEvalRunner.js';
7
- import { SkillBenchmark } from '../SkillBenchmark.js';
8
- import { SkillClassifier } from '../SkillClassifier.js';
9
- import { DescriptionOptimizer } from '../DescriptionOptimizer.js';
10
- // ─── SkillEvalRunner ─────────────────────────────────────────────────────────
11
- describe('SkillEvalRunner', () => {
12
- let storage;
13
- let runner;
14
- let testDir;
15
- beforeEach(() => {
16
- testDir = join(tmpdir(), `eval-runner-${Date.now()}-${Math.random().toString(36).slice(2)}`);
17
- storage = new MemoryStorage(testDir);
18
- runner = new SkillEvalRunner(storage);
19
- });
20
- afterEach(() => {
21
- storage.close();
22
- try {
23
- rmSync(testDir, { recursive: true, force: true });
24
- }
25
- catch { /* ignore */ }
26
- });
27
- it('should create eval set and retrieve cases', () => {
28
- const cases = runner.createEvalSet({
29
- skillName: 'csv-analyzer',
30
- evals: [
31
- {
32
- prompt: 'Analyze this CSV file and generate a summary',
33
- expectedOutput: 'A statistical summary of the CSV data',
34
- files: ['data.csv'],
35
- assertions: [
36
- { description: 'Contains row count', type: 'contains', value: 'rows' },
37
- { description: 'Contains column info', type: 'contains', value: 'columns' },
38
- ],
39
- },
40
- {
41
- prompt: 'Parse the CSV and find outliers',
42
- expectedOutput: 'List of outlier values',
43
- },
44
- ],
45
- });
46
- expect(cases).toHaveLength(2);
47
- expect(cases[0].skillName).toBe('csv-analyzer');
48
- expect(cases[0].assertions).toHaveLength(2);
49
- expect(cases[0].files).toEqual(['data.csv']);
50
- expect(cases[1].assertions).toHaveLength(0);
51
- const retrieved = runner.getEvalCases('csv-analyzer');
52
- expect(retrieved).toHaveLength(2);
53
- });
54
- it('should start and complete eval runs', () => {
55
- const cases = runner.createEvalSet({
56
- skillName: 'test-skill',
57
- evals: [{ prompt: 'Test prompt', expectedOutput: 'Expected output' }],
58
- });
59
- const runId = runner.startRun(cases[0].id, 'test-skill', 'with_skill');
60
- expect(runId).toBeTruthy();
61
- runner.completeRun(runId, 'Generated output with rows and columns', [
62
- { assertionId: 'a1', description: 'Has content', passed: true, evidence: 'Output is non-empty' },
63
- ], 1500, 5000);
64
- const runs = runner.getRunsForEval(cases[0].id);
65
- expect(runs).toHaveLength(1);
66
- expect(runs[0].status).toBe('passed');
67
- expect(runs[0].durationMs).toBe(1500);
68
- expect(runs[0].tokenCount).toBe(5000);
69
- });
70
- it('should mark run as failed when assertions fail', () => {
71
- const cases = runner.createEvalSet({
72
- skillName: 'test-skill',
73
- evals: [{ prompt: 'Test', expectedOutput: 'Expected' }],
74
- });
75
- const runId = runner.startRun(cases[0].id, 'test-skill', 'with_skill');
76
- runner.completeRun(runId, 'Bad output', [
77
- { assertionId: 'a1', description: 'Has rows', passed: false, evidence: 'Missing' },
78
- { assertionId: 'a2', description: 'Has cols', passed: true, evidence: 'Present' },
79
- ], 1000, 3000);
80
- const runs = runner.getRunsForEval(cases[0].id);
81
- expect(runs[0].status).toBe('failed');
82
- });
83
- it('should handle error runs', () => {
84
- const cases = runner.createEvalSet({
85
- skillName: 'test-skill',
86
- evals: [{ prompt: 'Test', expectedOutput: 'Expected' }],
87
- });
88
- const runId = runner.startRun(cases[0].id, 'test-skill', 'baseline');
89
- runner.failRun(runId, 'Connection timeout');
90
- const runs = runner.getRunsForEval(cases[0].id);
91
- expect(runs[0].status).toBe('error');
92
- expect(runs[0].output).toBe('Connection timeout');
93
- });
94
- it('should grade output against assertions', () => {
95
- const assertions = [
96
- { id: 'a1', description: 'Contains summary', type: 'contains', value: 'summary' },
97
- { id: 'a2', description: 'No errors', type: 'not_contains', value: 'error' },
98
- { id: 'a3', description: 'Has number', type: 'matches_regex', value: '\\d+' },
99
- { id: 'a4', description: 'Custom check', type: 'custom', value: 'quality > 8' },
100
- ];
101
- const grades = runner.gradeOutput('Here is the summary: 42 items found', assertions);
102
- expect(grades).toHaveLength(4);
103
- expect(grades[0].passed).toBe(true); // contains 'summary'
104
- expect(grades[1].passed).toBe(true); // not contains 'error'
105
- expect(grades[2].passed).toBe(true); // matches \d+
106
- expect(grades[3].passed).toBe(false); // custom always false without external grading
107
- });
108
- it('should grade failing contains assertion', () => {
109
- const assertions = [
110
- { id: 'a1', description: 'Contains missing word', type: 'contains', value: 'nonexistent' },
111
- ];
112
- const grades = runner.gradeOutput('Some output text', assertions);
113
- expect(grades[0].passed).toBe(false);
114
- expect(grades[0].evidence).toContain('does not contain');
115
- });
116
- it('should grade failing not_contains assertion', () => {
117
- const assertions = [
118
- { id: 'a1', description: 'No errors', type: 'not_contains', value: 'error' },
119
- ];
120
- const grades = runner.gradeOutput('An error occurred', assertions);
121
- expect(grades[0].passed).toBe(false);
122
- expect(grades[0].evidence).toContain('unexpectedly contains');
123
- });
124
- it('should handle invalid regex gracefully', () => {
125
- const assertions = [
126
- { id: 'a1', description: 'Bad regex', type: 'matches_regex', value: '[invalid' },
127
- ];
128
- const grades = runner.gradeOutput('test', assertions);
129
- expect(grades[0].passed).toBe(false);
130
- expect(grades[0].evidence).toContain('Invalid regex');
131
- });
132
- it('should get latest runs grouped by eval and variant', () => {
133
- const cases = runner.createEvalSet({
134
- skillName: 'grouped-skill',
135
- evals: [
136
- { prompt: 'Eval 1', expectedOutput: 'Expected 1' },
137
- { prompt: 'Eval 2', expectedOutput: 'Expected 2' },
138
- ],
139
- });
140
- // Run both variants for eval 1
141
- const wsRun = runner.startRun(cases[0].id, 'grouped-skill', 'with_skill');
142
- runner.completeRun(wsRun, 'Output ws', [], 100, 500);
143
- const blRun = runner.startRun(cases[0].id, 'grouped-skill', 'baseline');
144
- runner.completeRun(blRun, 'Output bl', [], 200, 600);
145
- // Only with_skill for eval 2
146
- const wsRun2 = runner.startRun(cases[1].id, 'grouped-skill', 'with_skill');
147
- runner.completeRun(wsRun2, 'Output ws2', [], 150, 550);
148
- const grouped = runner.getLatestRuns('grouped-skill');
149
- expect(grouped.size).toBe(2);
150
- const eval1 = grouped.get(cases[0].id);
151
- expect(eval1?.withSkill).not.toBeNull();
152
- expect(eval1?.baseline).not.toBeNull();
153
- const eval2 = grouped.get(cases[1].id);
154
- expect(eval2?.withSkill).not.toBeNull();
155
- expect(eval2?.baseline).toBeNull();
156
- });
157
- it('should delete eval set and associated runs', () => {
158
- runner.createEvalSet({
159
- skillName: 'to-delete',
160
- evals: [{ prompt: 'Test', expectedOutput: 'Expected' }],
161
- });
162
- const cases = runner.getEvalCases('to-delete');
163
- runner.startRun(cases[0].id, 'to-delete', 'with_skill');
164
- const deleted = runner.deleteEvalSet('to-delete');
165
- expect(deleted).toBe(1);
166
- expect(runner.getEvalCases('to-delete')).toHaveLength(0);
167
- });
168
- it('should get eval case by ID', () => {
169
- const cases = runner.createEvalSet({
170
- skillName: 'by-id-test',
171
- evals: [{ prompt: 'Specific prompt', expectedOutput: 'Specific output' }],
172
- });
173
- const found = runner.getEvalCase(cases[0].id);
174
- expect(found).not.toBeNull();
175
- expect(found.prompt).toBe('Specific prompt');
176
- const notFound = runner.getEvalCase('nonexistent');
177
- expect(notFound).toBeNull();
178
- });
179
- });
180
- // ─── SkillBenchmark ──────────────────────────────────────────────────────────
181
- describe('SkillBenchmark', () => {
182
- let storage;
183
- let runner;
184
- let benchmark;
185
- let testDir;
186
- beforeEach(() => {
187
- testDir = join(tmpdir(), `eval-bench-${Date.now()}-${Math.random().toString(36).slice(2)}`);
188
- storage = new MemoryStorage(testDir);
189
- runner = new SkillEvalRunner(storage);
190
- benchmark = new SkillBenchmark(storage);
191
- });
192
- afterEach(() => {
193
- storage.close();
194
- try {
195
- rmSync(testDir, { recursive: true, force: true });
196
- }
197
- catch { /* ignore */ }
198
- });
199
- function setupSkillWithRuns(skillName, wsPass, blPass) {
200
- const cases = runner.createEvalSet({
201
- skillName,
202
- evals: [
203
- { prompt: 'Eval A', expectedOutput: 'Expected A', assertions: [{ description: 'Check A', type: 'contains', value: 'result' }] },
204
- { prompt: 'Eval B', expectedOutput: 'Expected B', assertions: [{ description: 'Check B', type: 'contains', value: 'data' }] },
205
- ],
206
- });
207
- for (const evalCase of cases) {
208
- const wsId = runner.startRun(evalCase.id, skillName, 'with_skill');
209
- const wsOutput = wsPass ? 'Here is the result with data' : 'Incomplete output';
210
- const wsGrades = runner.gradeOutput(wsOutput, evalCase.assertions);
211
- runner.completeRun(wsId, wsOutput, wsGrades, 1200, 4500);
212
- const blId = runner.startRun(evalCase.id, skillName, 'baseline');
213
- const blOutput = blPass ? 'Here is the result with data' : 'No useful output';
214
- const blGrades = runner.gradeOutput(blOutput, evalCase.assertions);
215
- runner.completeRun(blId, blOutput, blGrades, 1500, 5000);
216
- }
217
- }
218
- it('should aggregate benchmark results', () => {
219
- setupSkillWithRuns('bench-test', true, false);
220
- const result = benchmark.aggregate('bench-test');
221
- expect(result.skillName).toBe('bench-test');
222
- expect(result.iteration).toBe(1);
223
- expect(result.summary.totalEvals).toBe(2);
224
- expect(result.summary.withSkill.passRate).toBe(1.0);
225
- expect(result.summary.baseline.passRate).toBe(0);
226
- expect(result.summary.delta.passRateDelta).toBe(1.0);
227
- expect(result.evalBreakdowns).toHaveLength(2);
228
- });
229
- it('should track benchmark history across iterations', () => {
230
- setupSkillWithRuns('history-test', true, false);
231
- benchmark.aggregate('history-test');
232
- // Second iteration with improved baseline
233
- setupSkillWithRuns('history-test', true, true);
234
- benchmark.aggregate('history-test');
235
- const history = benchmark.getHistory('history-test');
236
- expect(history).toHaveLength(2);
237
- expect(history[0].iteration).toBe(1);
238
- expect(history[1].iteration).toBe(2);
239
- });
240
- it('should get latest benchmark', () => {
241
- setupSkillWithRuns('latest-test', true, false);
242
- benchmark.aggregate('latest-test');
243
- const latest = benchmark.getLatest('latest-test');
244
- expect(latest).not.toBeNull();
245
- expect(latest.iteration).toBe(1);
246
- const none = benchmark.getLatest('nonexistent');
247
- expect(none).toBeNull();
248
- });
249
- it('should compare two iterations', () => {
250
- setupSkillWithRuns('compare-test', true, false);
251
- benchmark.aggregate('compare-test');
252
- setupSkillWithRuns('compare-test', true, true);
253
- benchmark.aggregate('compare-test');
254
- const comparison = benchmark.compare('compare-test', 1, 2);
255
- expect(comparison.iterationA).not.toBeNull();
256
- expect(comparison.iterationB).not.toBeNull();
257
- expect(comparison.improvement).not.toBeNull();
258
- });
259
- it('should handle compare with missing iteration', () => {
260
- const comparison = benchmark.compare('missing', 1, 2);
261
- expect(comparison.iterationA).toBeNull();
262
- expect(comparison.iterationB).toBeNull();
263
- expect(comparison.improvement).toBeNull();
264
- });
265
- it('should format benchmark report as markdown', () => {
266
- setupSkillWithRuns('report-test', true, false);
267
- const result = benchmark.aggregate('report-test');
268
- const report = benchmark.formatReport(result);
269
- expect(report).toContain('# Benchmark: report-test');
270
- expect(report).toContain('Pass Rate');
271
- expect(report).toContain('Mean Duration');
272
- expect(report).toContain('Per-Eval Breakdown');
273
- });
274
- it('should compute stddev for duration and tokens', () => {
275
- const cases = runner.createEvalSet({
276
- skillName: 'stddev-test',
277
- evals: [
278
- { prompt: 'A', expectedOutput: 'A' },
279
- { prompt: 'B', expectedOutput: 'B' },
280
- { prompt: 'C', expectedOutput: 'C' },
281
- ],
282
- });
283
- // Varying durations and tokens
284
- const durations = [1000, 2000, 3000];
285
- const tokens = [4000, 5000, 6000];
286
- for (let i = 0; i < cases.length; i++) {
287
- const wsId = runner.startRun(cases[i].id, 'stddev-test', 'with_skill');
288
- runner.completeRun(wsId, 'output', [], durations[i], tokens[i]);
289
- const blId = runner.startRun(cases[i].id, 'stddev-test', 'baseline');
290
- runner.completeRun(blId, 'output', [], durations[i] + 500, tokens[i] + 500);
291
- }
292
- const result = benchmark.aggregate('stddev-test');
293
- expect(result.summary.withSkill.stddevDurationMs).toBeGreaterThan(0);
294
- expect(result.summary.withSkill.stddevTokens).toBeGreaterThan(0);
295
- });
296
- });
297
- // ─── SkillClassifier ─────────────────────────────────────────────────────────
298
- describe('SkillClassifier', () => {
299
- let storage;
300
- let runner;
301
- let benchmarkObj;
302
- let classifier;
303
- let testDir;
304
- beforeEach(() => {
305
- testDir = join(tmpdir(), `eval-class-${Date.now()}-${Math.random().toString(36).slice(2)}`);
306
- storage = new MemoryStorage(testDir);
307
- runner = new SkillEvalRunner(storage);
308
- benchmarkObj = new SkillBenchmark(storage);
309
- classifier = new SkillClassifier(storage);
310
- });
311
- afterEach(() => {
312
- storage.close();
313
- try {
314
- rmSync(testDir, { recursive: true, force: true });
315
- }
316
- catch { /* ignore */ }
317
- });
318
- function createBenchmark(skillName, wsPassRate, blPassRate) {
319
- const totalEvals = 10;
320
- const wsPassCount = Math.round(wsPassRate * totalEvals);
321
- const blPassCount = Math.round(blPassRate * totalEvals);
322
- const evals = Array.from({ length: totalEvals }, (_, i) => ({
323
- prompt: `Eval ${i}`,
324
- expectedOutput: `Expected ${i}`,
325
- assertions: [{ description: 'Check', type: 'contains', value: 'pass' }],
326
- }));
327
- const cases = runner.createEvalSet({ skillName, evals });
328
- for (let i = 0; i < cases.length; i++) {
329
- const wsId = runner.startRun(cases[i].id, skillName, 'with_skill');
330
- const wsOutput = i < wsPassCount ? 'pass' : 'fail';
331
- const wsGrades = runner.gradeOutput(wsOutput, cases[i].assertions);
332
- runner.completeRun(wsId, wsOutput, wsGrades, 1000, 5000);
333
- const blId = runner.startRun(cases[i].id, skillName, 'baseline');
334
- const blOutput = i < blPassCount ? 'pass' : 'fail';
335
- const blGrades = runner.gradeOutput(blOutput, cases[i].assertions);
336
- runner.completeRun(blId, blOutput, blGrades, 1200, 5500);
337
- }
338
- benchmarkObj.aggregate(skillName);
339
- }
340
- it('should classify as unknown when no benchmarks exist', () => {
341
- const result = classifier.classify('nonexistent');
342
- expect(result.category).toBe('unknown');
343
- expect(result.confidence).toBe(0);
344
- expect(result.trend).toBe('insufficient_data');
345
- });
346
- it('should classify as capability_uplift when baseline is high', () => {
347
- createBenchmark('cap-uplift', 0.9, 0.8);
348
- const result = classifier.classify('cap-uplift');
349
- expect(result.category).toBe('capability_uplift');
350
- expect(result.baselinePassRate).toBeGreaterThanOrEqual(0.7);
351
- });
352
- it('should classify as encoded_preference when baseline is low and gap is large', () => {
353
- createBenchmark('enc-pref', 0.9, 0.1);
354
- const result = classifier.classify('enc-pref');
355
- expect(result.category).toBe('encoded_preference');
356
- expect(result.baselinePassRate).toBeLessThanOrEqual(0.3);
357
- expect(result.withSkillPassRate).toBeGreaterThan(result.baselinePassRate);
358
- });
359
- it('should detect converging trend as capability_uplift', () => {
360
- // First benchmark: large gap
361
- createBenchmark('converge', 0.9, 0.2);
362
- // Second benchmark: gap shrinks
363
- createBenchmark('converge', 0.9, 0.7);
364
- const result = classifier.classify('converge');
365
- expect(result.trend).toBe('converging');
366
- });
367
- it('should detect stable trend as encoded_preference', () => {
368
- // Both benchmarks: consistent gap
369
- createBenchmark('stable', 0.9, 0.1);
370
- createBenchmark('stable', 0.9, 0.1);
371
- const result = classifier.classify('stable');
372
- expect(result.trend).toBe('stable');
373
- });
374
- it('should classify from explicit rates', () => {
375
- const result = classifier.classifyFromRates('test-skill', 0.95, 0.1);
376
- expect(result.category).toBe('encoded_preference');
377
- expect(result.skillName).toBe('test-skill');
378
- });
379
- it('should detect becoming obsolete', () => {
380
- createBenchmark('obsolete', 0.9, 0.85);
381
- const result = classifier.isBecomingObsolete('obsolete');
382
- expect(result.obsolete).toBe(true);
383
- expect(result.reason).toContain('well without the skill');
384
- });
385
- it('should not flag non-obsolete skills', () => {
386
- createBenchmark('healthy', 0.9, 0.1);
387
- const result = classifier.isBecomingObsolete('healthy');
388
- expect(result.obsolete).toBe(false);
389
- });
390
- });
391
- // ─── DescriptionOptimizer ────────────────────────────────────────────────────
392
- describe('DescriptionOptimizer', () => {
393
- let storage;
394
- let optimizer;
395
- let testDir;
396
- beforeEach(() => {
397
- testDir = join(tmpdir(), `eval-opt-${Date.now()}-${Math.random().toString(36).slice(2)}`);
398
- storage = new MemoryStorage(testDir);
399
- optimizer = new DescriptionOptimizer(storage);
400
- });
401
- afterEach(() => {
402
- storage.close();
403
- try {
404
- rmSync(testDir, { recursive: true, force: true });
405
- }
406
- catch { /* ignore */ }
407
- });
408
- it('should split eval set into train/test with stratification', () => {
409
- const queries = [
410
- { query: 'analyze this csv file', shouldTrigger: true },
411
- { query: 'parse my spreadsheet data', shouldTrigger: true },
412
- { query: 'generate a chart from data', shouldTrigger: true },
413
- { query: 'create csv summary', shouldTrigger: true },
414
- { query: 'write me an email', shouldTrigger: false },
415
- { query: 'fix this bug in the auth module', shouldTrigger: false },
416
- { query: 'deploy the application', shouldTrigger: false },
417
- { query: 'review my pull request', shouldTrigger: false },
418
- ];
419
- const { train, test } = optimizer.splitEvalSet(queries);
420
- // Both sets should have queries
421
- expect(train.length).toBeGreaterThan(0);
422
- expect(test.length).toBeGreaterThan(0);
423
- // Combined should cover all queries
424
- expect(train.length + test.length).toBe(queries.length);
425
- // Both sets should have both types
426
- expect(train.some(q => q.shouldTrigger)).toBe(true);
427
- expect(train.some(q => !q.shouldTrigger)).toBe(true);
428
- expect(test.some(q => q.shouldTrigger)).toBe(true);
429
- expect(test.some(q => !q.shouldTrigger)).toBe(true);
430
- });
431
- it('should evaluate description against trigger queries', () => {
432
- const description = 'Analyze CSV files, parse spreadsheet data, generate statistical summaries';
433
- const queries = [
434
- { query: 'analyze this csv file and show me stats', shouldTrigger: true },
435
- { query: 'write a blog post about cooking', shouldTrigger: false },
436
- ];
437
- const results = optimizer.evaluateDescription(description, queries);
438
- expect(results).toHaveLength(2);
439
- expect(results[0].shouldTrigger).toBe(true);
440
- expect(results[1].shouldTrigger).toBe(false);
441
- });
442
- it('should score results correctly', () => {
443
- const allCorrect = [
444
- { query: 'q1', shouldTrigger: true, didTrigger: true, triggerRate: 0.5, correct: true },
445
- { query: 'q2', shouldTrigger: false, didTrigger: false, triggerRate: 0.0, correct: true },
446
- ];
447
- expect(optimizer.scoreResults(allCorrect)).toBe(1.0);
448
- const halfCorrect = [
449
- { query: 'q1', shouldTrigger: true, didTrigger: true, triggerRate: 0.5, correct: true },
450
- { query: 'q2', shouldTrigger: false, didTrigger: true, triggerRate: 0.3, correct: false },
451
- ];
452
- expect(optimizer.scoreResults(halfCorrect)).toBe(0.5);
453
- expect(optimizer.scoreResults([])).toBe(0);
454
- });
455
- it('should suggest improvements for false negatives', () => {
456
- const description = 'Process data files';
457
- const failedResults = [
458
- { query: 'analyze csv spreadsheet', shouldTrigger: true, didTrigger: false, triggerRate: 0.05, correct: false },
459
- ];
460
- const improved = optimizer.suggestImprovement(description, failedResults);
461
- expect(improved).not.toBe(description);
462
- expect(improved.length).toBeGreaterThan(description.length);
463
- });
464
- it('should suggest improvements for false positives', () => {
465
- const description = 'Analyze data and generate reports from spreadsheets';
466
- const failedResults = [
467
- { query: 'generate random passwords for security testing', shouldTrigger: false, didTrigger: true, triggerRate: 0.2, correct: false },
468
- ];
469
- const improved = optimizer.suggestImprovement(description, failedResults);
470
- expect(improved).not.toBe(description);
471
- expect(improved).toContain('Does NOT');
472
- });
473
- it('should return original description when no failures', () => {
474
- const description = 'Perfect description';
475
- const improved = optimizer.suggestImprovement(description, []);
476
- expect(improved).toBe(description);
477
- });
478
- it('should run full optimization loop', () => {
479
- const queries = [
480
- { query: 'analyze this csv file and create a statistical report', shouldTrigger: true },
481
- { query: 'parse my data spreadsheet and find patterns', shouldTrigger: true },
482
- { query: 'summarize the csv columns with averages', shouldTrigger: true },
483
- { query: 'generate csv from database export', shouldTrigger: true },
484
- { query: 'help me write a novel', shouldTrigger: false },
485
- { query: 'fix the authentication bug', shouldTrigger: false },
486
- { query: 'deploy to production servers', shouldTrigger: false },
487
- { query: 'review this pull request code', shouldTrigger: false },
488
- ];
489
- const result = optimizer.optimize('csv-analyzer', 'Analyze CSV files', queries, 3);
490
- expect(result.skillName).toBe('csv-analyzer');
491
- expect(result.originalDescription).toBe('Analyze CSV files');
492
- expect(result.candidates.length).toBeGreaterThan(0);
493
- expect(result.candidates.length).toBeLessThanOrEqual(3);
494
- // Best description should be selected by test score
495
- expect(result.bestDescription).toBeTruthy();
496
- });
497
- it('should persist and retrieve optimization history', () => {
498
- const queries = [
499
- { query: 'analyze csv data', shouldTrigger: true },
500
- { query: 'write a poem', shouldTrigger: false },
501
- { query: 'parse spreadsheet', shouldTrigger: true },
502
- { query: 'cook dinner recipe', shouldTrigger: false },
503
- ];
504
- optimizer.optimize('persist-test', 'Initial description', queries, 2);
505
- const history = optimizer.getHistory('persist-test');
506
- expect(history).toHaveLength(1);
507
- const latest = optimizer.getLatest('persist-test');
508
- expect(latest).not.toBeNull();
509
- expect(latest.skillName).toBe('persist-test');
510
- });
511
- it('should evaluate candidate on both train and test sets', () => {
512
- const train = [
513
- { query: 'analyze csv file', shouldTrigger: true },
514
- { query: 'write poetry', shouldTrigger: false },
515
- ];
516
- const test = [
517
- { query: 'parse data spreadsheet', shouldTrigger: true },
518
- { query: 'fix security bug', shouldTrigger: false },
519
- ];
520
- const candidate = optimizer.evaluateCandidate('Analyze CSV data files', train, test, 1);
521
- expect(candidate.iteration).toBe(1);
522
- expect(candidate.trainScore).toBeGreaterThanOrEqual(0);
523
- expect(candidate.trainScore).toBeLessThanOrEqual(1);
524
- expect(candidate.testScore).toBeGreaterThanOrEqual(0);
525
- expect(candidate.testScore).toBeLessThanOrEqual(1);
526
- expect(candidate.results).toHaveLength(4); // train + test
527
- });
528
- it('should generate 20-query trigger eval set', () => {
529
- const queries = optimizer.generateTriggerEvalSet('csv-analyzer', 'Analyze CSV files, parse spreadsheet data, generate statistical summaries and charts');
530
- expect(queries).toHaveLength(20);
531
- const shouldTrigger = queries.filter(q => q.shouldTrigger);
532
- const shouldNot = queries.filter(q => !q.shouldTrigger);
533
- expect(shouldTrigger).toHaveLength(10);
534
- expect(shouldNot).toHaveLength(10);
535
- });
536
- it('should generate near-miss queries from existing skills', () => {
537
- const existingSkills = new Map([
538
- ['pdf-processor', 'Process PDF files, extract text and tables from PDF documents'],
539
- ['email-writer', 'Write professional emails, compose messages, draft correspondence'],
540
- ]);
541
- const queries = optimizer.generateTriggerEvalSet('csv-analyzer', 'Analyze CSV files, parse spreadsheet data, generate statistical summaries', existingSkills);
542
- expect(queries).toHaveLength(20);
543
- // Should have near-miss queries from adjacent skills
544
- const shouldNot = queries.filter(q => !q.shouldTrigger);
545
- expect(shouldNot.length).toBe(10);
546
- });
547
- it('should validate trigger accuracy', () => {
548
- const result = optimizer.validateTriggers('csv-analyzer', 'Analyze CSV files, parse spreadsheet data, generate statistical summaries', [
549
- { query: 'analyze this csv file and show statistics', shouldTrigger: true },
550
- { query: 'parse my data spreadsheet', shouldTrigger: true },
551
- { query: 'write a poem about nature', shouldTrigger: false },
552
- { query: 'deploy to production', shouldTrigger: false },
553
- ]);
554
- expect(result.accuracy).toBeGreaterThanOrEqual(0);
555
- expect(result.accuracy).toBeLessThanOrEqual(1);
556
- expect(result.results).toHaveLength(4);
557
- expect(Array.isArray(result.falsePositives)).toBe(true);
558
- expect(Array.isArray(result.falseNegatives)).toBe(true);
559
- });
560
- it('should detect trigger collisions between skills', () => {
561
- const existingSkills = new Map([
562
- ['data-analyzer', 'Analyze data files, parse CSV and JSON, generate reports'],
563
- ['email-writer', 'Write professional emails and compose messages'],
564
- ['pdf-processor', 'Process PDF documents, extract text and tables'],
565
- ]);
566
- const collisions = optimizer.checkCollisions('csv-analyzer', 'Analyze CSV data files, parse spreadsheets, generate statistical reports', existingSkills);
567
- // data-analyzer should collide (similar keywords)
568
- expect(collisions.length).toBeGreaterThanOrEqual(1);
569
- expect(collisions[0].collidingSkill).toBe('data-analyzer');
570
- expect(collisions[0].overlapScore).toBeGreaterThan(0);
571
- expect(collisions[0].sharedKeywords.length).toBeGreaterThan(0);
572
- });
573
- it('should batch validate multiple skills', () => {
574
- const skills = new Map([
575
- ['csv-analyzer', 'Analyze CSV files, parse spreadsheet data, generate statistical summaries'],
576
- ['email-writer', 'Write professional emails, compose messages, draft correspondence'],
577
- ['pdf-processor', 'Process PDF files, extract text and tables from PDF documents'],
578
- ]);
579
- const results = optimizer.batchValidate(skills, 0.7);
580
- expect(results).toHaveLength(3);
581
- for (const result of results) {
582
- expect(result.skillName).toBeTruthy();
583
- expect(result.accuracy).toBeGreaterThanOrEqual(0);
584
- expect(result.accuracy).toBeLessThanOrEqual(1);
585
- expect(typeof result.needsImprovement).toBe('boolean');
586
- }
587
- // Results should be sorted by accuracy (ascending)
588
- for (let i = 1; i < results.length; i++) {
589
- expect(results[i].accuracy).toBeGreaterThanOrEqual(results[i - 1].accuracy);
590
- }
591
- });
592
- it('should stop optimization early on perfect score', () => {
593
- // Simple case where description already matches perfectly
594
- const queries = [
595
- { query: 'csv analysis report with statistics', shouldTrigger: true },
596
- { query: 'completely unrelated cooking recipe topic', shouldTrigger: false },
597
- ];
598
- const result = optimizer.optimize('perfect-test', 'CSV analysis and statistics reporting tool', queries, 5);
599
- // Should stop before max iterations if already perfect
600
- expect(result.candidates.length).toBeLessThanOrEqual(5);
601
- });
602
- });
603
- //# sourceMappingURL=eval.test.js.map