@rulemetric/cli 0.2.1 → 0.2.2

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 (780) hide show
  1. package/dist/base-command.js +13 -52
  2. package/dist/base-command.js.map +7 -1
  3. package/dist/chunk-2AM54TUK.js +59 -0
  4. package/dist/chunk-2AM54TUK.js.map +7 -0
  5. package/dist/chunk-3TIMQ3O6.js +96 -0
  6. package/dist/chunk-3TIMQ3O6.js.map +7 -0
  7. package/dist/chunk-4BHDHHKL.js +48 -0
  8. package/dist/chunk-4BHDHHKL.js.map +7 -0
  9. package/dist/chunk-4D537GXE.js +99 -0
  10. package/dist/chunk-4D537GXE.js.map +7 -0
  11. package/dist/chunk-4SCZK7AL.js +129 -0
  12. package/dist/chunk-4SCZK7AL.js.map +7 -0
  13. package/dist/chunk-4WFE4PFP.js +61 -0
  14. package/dist/chunk-4WFE4PFP.js.map +7 -0
  15. package/dist/chunk-52WIYRZH.js +73 -0
  16. package/dist/chunk-52WIYRZH.js.map +7 -0
  17. package/dist/chunk-7FAA3YNB.js +1549 -0
  18. package/dist/chunk-7FAA3YNB.js.map +7 -0
  19. package/dist/chunk-7NYKWN7U.js +12 -0
  20. package/dist/chunk-7NYKWN7U.js.map +7 -0
  21. package/dist/chunk-AULP2OWH.js +99 -0
  22. package/dist/chunk-AULP2OWH.js.map +7 -0
  23. package/dist/chunk-B5KNTGMJ.js +1788 -0
  24. package/dist/chunk-B5KNTGMJ.js.map +7 -0
  25. package/dist/chunk-BD7CY42U.js +23 -0
  26. package/dist/chunk-BD7CY42U.js.map +7 -0
  27. package/dist/chunk-BO76WKJR.js +42 -0
  28. package/dist/chunk-BO76WKJR.js.map +7 -0
  29. package/dist/chunk-BRD5RUGM.js +53 -0
  30. package/dist/chunk-BRD5RUGM.js.map +7 -0
  31. package/dist/chunk-BT6Z6545.js +43 -0
  32. package/dist/chunk-BT6Z6545.js.map +7 -0
  33. package/dist/chunk-BZDKEQKU.js +39 -0
  34. package/dist/chunk-BZDKEQKU.js.map +7 -0
  35. package/dist/chunk-CROYS75W.js +161 -0
  36. package/dist/chunk-CROYS75W.js.map +7 -0
  37. package/dist/chunk-DGHWRQXL.js +17 -0
  38. package/dist/chunk-DGHWRQXL.js.map +7 -0
  39. package/dist/chunk-DQ3KELXD.js +74 -0
  40. package/dist/chunk-DQ3KELXD.js.map +7 -0
  41. package/dist/chunk-DTFXCHHI.js +108 -0
  42. package/dist/chunk-DTFXCHHI.js.map +7 -0
  43. package/dist/chunk-DU73QUS3.js +75 -0
  44. package/dist/chunk-DU73QUS3.js.map +7 -0
  45. package/dist/chunk-EHZJ6OXD.js +307 -0
  46. package/dist/chunk-EHZJ6OXD.js.map +7 -0
  47. package/dist/chunk-EJOI2ZGU.js +109 -0
  48. package/dist/chunk-EJOI2ZGU.js.map +7 -0
  49. package/dist/chunk-EKJ2CABV.js +76 -0
  50. package/dist/chunk-EKJ2CABV.js.map +7 -0
  51. package/dist/chunk-EKP32DLN.js +16 -0
  52. package/dist/chunk-EKP32DLN.js.map +7 -0
  53. package/dist/chunk-EOOP6WTC.js +148 -0
  54. package/dist/chunk-EOOP6WTC.js.map +7 -0
  55. package/dist/chunk-ERPMDAO3.js +20 -0
  56. package/dist/chunk-ERPMDAO3.js.map +7 -0
  57. package/dist/chunk-FTJRMUID.js +96 -0
  58. package/dist/chunk-FTJRMUID.js.map +7 -0
  59. package/dist/chunk-FZKLLNDS.js +228 -0
  60. package/dist/chunk-FZKLLNDS.js.map +7 -0
  61. package/dist/chunk-GQCISMAH.js +157 -0
  62. package/dist/chunk-GQCISMAH.js.map +7 -0
  63. package/dist/chunk-IGXX624H.js +55 -0
  64. package/dist/chunk-IGXX624H.js.map +7 -0
  65. package/dist/chunk-IJGF2ETG.js +68 -0
  66. package/dist/chunk-IJGF2ETG.js.map +7 -0
  67. package/dist/chunk-IWYCRLEK.js +220 -0
  68. package/dist/chunk-IWYCRLEK.js.map +7 -0
  69. package/dist/chunk-J7N3DLH6.js +117 -0
  70. package/dist/chunk-J7N3DLH6.js.map +7 -0
  71. package/dist/chunk-JX5UI6RW.js +99 -0
  72. package/dist/chunk-JX5UI6RW.js.map +7 -0
  73. package/dist/chunk-K3BFZ7KG.js +154 -0
  74. package/dist/chunk-K3BFZ7KG.js.map +7 -0
  75. package/dist/chunk-KHJUQFIK.js +51 -0
  76. package/dist/chunk-KHJUQFIK.js.map +7 -0
  77. package/dist/chunk-KRBQLMOP.js +41 -0
  78. package/dist/chunk-KRBQLMOP.js.map +7 -0
  79. package/dist/chunk-KZRFUXGF.js +145 -0
  80. package/dist/chunk-KZRFUXGF.js.map +7 -0
  81. package/dist/chunk-L674RNKQ.js +492 -0
  82. package/dist/chunk-L674RNKQ.js.map +7 -0
  83. package/dist/chunk-N52AHNBH.js +47 -0
  84. package/dist/chunk-N52AHNBH.js.map +7 -0
  85. package/dist/chunk-NIDLJO6F.js +228 -0
  86. package/dist/chunk-NIDLJO6F.js.map +7 -0
  87. package/dist/chunk-NSBPE2FW.js +17 -0
  88. package/dist/chunk-NSBPE2FW.js.map +7 -0
  89. package/dist/chunk-OGVORIFM.js +70 -0
  90. package/dist/chunk-OGVORIFM.js.map +7 -0
  91. package/dist/chunk-OQSQC7VB.js +77 -0
  92. package/dist/chunk-OQSQC7VB.js.map +7 -0
  93. package/dist/chunk-PHLMIZKM.js +153 -0
  94. package/dist/chunk-PHLMIZKM.js.map +7 -0
  95. package/dist/chunk-PQU7GZ7A.js +92 -0
  96. package/dist/chunk-PQU7GZ7A.js.map +7 -0
  97. package/dist/chunk-PXVQLD7S.js +196 -0
  98. package/dist/chunk-PXVQLD7S.js.map +7 -0
  99. package/dist/chunk-QD6X4L4L.js +79 -0
  100. package/dist/chunk-QD6X4L4L.js.map +7 -0
  101. package/dist/chunk-QJQS6TUN.js +44 -0
  102. package/dist/chunk-QJQS6TUN.js.map +7 -0
  103. package/dist/chunk-QJXAULRC.js +191 -0
  104. package/dist/chunk-QJXAULRC.js.map +7 -0
  105. package/dist/chunk-QN34TGD3.js +83 -0
  106. package/dist/chunk-QN34TGD3.js.map +7 -0
  107. package/dist/chunk-R5MFHGHR.js +122 -0
  108. package/dist/chunk-R5MFHGHR.js.map +7 -0
  109. package/dist/chunk-RH7NHVSK.js +16 -0
  110. package/dist/chunk-RH7NHVSK.js.map +7 -0
  111. package/dist/chunk-RJ7BHDLM.js +121 -0
  112. package/dist/chunk-RJ7BHDLM.js.map +7 -0
  113. package/dist/chunk-RQ2TMLKG.js +142 -0
  114. package/dist/chunk-RQ2TMLKG.js.map +7 -0
  115. package/dist/chunk-S56LOTGQ.js +63 -0
  116. package/dist/chunk-S56LOTGQ.js.map +7 -0
  117. package/dist/chunk-UF73WX2J.js +49 -0
  118. package/dist/chunk-UF73WX2J.js.map +7 -0
  119. package/dist/chunk-W53GKIZQ.js +50 -0
  120. package/dist/chunk-W53GKIZQ.js.map +7 -0
  121. package/dist/chunk-WA4MWYRW.js +254 -0
  122. package/dist/chunk-WA4MWYRW.js.map +7 -0
  123. package/dist/chunk-WFULKPEQ.js +269 -0
  124. package/dist/chunk-WFULKPEQ.js.map +7 -0
  125. package/dist/chunk-XC6M4CSW.js +44 -0
  126. package/dist/chunk-XC6M4CSW.js.map +7 -0
  127. package/dist/chunk-XPUEGHXN.js +243 -0
  128. package/dist/chunk-XPUEGHXN.js.map +7 -0
  129. package/dist/chunk-XZXS2W24.js +148 -0
  130. package/dist/chunk-XZXS2W24.js.map +7 -0
  131. package/dist/chunk-YBNW7ARH.js +167 -0
  132. package/dist/chunk-YBNW7ARH.js.map +7 -0
  133. package/dist/chunk-YNIH3KMU.js +121 -0
  134. package/dist/chunk-YNIH3KMU.js.map +7 -0
  135. package/dist/commands/antigravity/backfill.js +135 -0
  136. package/dist/commands/antigravity/backfill.js.map +7 -0
  137. package/dist/commands/auth/create-key.js +48 -33
  138. package/dist/commands/auth/create-key.js.map +7 -1
  139. package/dist/commands/auth/login.js +58 -46
  140. package/dist/commands/auth/login.js.map +7 -1
  141. package/dist/commands/auth/logout.js +28 -13
  142. package/dist/commands/auth/logout.js.map +7 -1
  143. package/dist/commands/auth/revoke-key.js +32 -18
  144. package/dist/commands/auth/revoke-key.js.map +7 -1
  145. package/dist/commands/auth/status.js +40 -22
  146. package/dist/commands/auth/status.js.map +7 -1
  147. package/dist/commands/catalog/index.js +50 -34
  148. package/dist/commands/catalog/index.js.map +7 -1
  149. package/dist/commands/catalog/recommend.js +41 -26
  150. package/dist/commands/catalog/recommend.js.map +7 -1
  151. package/dist/commands/convert.js +72 -54
  152. package/dist/commands/convert.js.map +7 -1
  153. package/dist/commands/converters.js +52 -38
  154. package/dist/commands/converters.js.map +7 -1
  155. package/dist/commands/crons/list.js +50 -24
  156. package/dist/commands/crons/list.js.map +7 -1
  157. package/dist/commands/crons/run.js +72 -47
  158. package/dist/commands/crons/run.js.map +7 -1
  159. package/dist/commands/dashboard.js +45 -24
  160. package/dist/commands/dashboard.js.map +7 -1
  161. package/dist/commands/eval-targets/create.js +51 -39
  162. package/dist/commands/eval-targets/create.js.map +7 -1
  163. package/dist/commands/eval-targets/list.js +52 -35
  164. package/dist/commands/eval-targets/list.js.map +7 -1
  165. package/dist/commands/evals/agent.js +292 -0
  166. package/dist/commands/evals/agent.js.map +7 -0
  167. package/dist/commands/evals/benchmark.js +70 -51
  168. package/dist/commands/evals/benchmark.js.map +7 -1
  169. package/dist/commands/evals/compare.js +90 -78
  170. package/dist/commands/evals/compare.js.map +7 -1
  171. package/dist/commands/evals/create.js +64 -50
  172. package/dist/commands/evals/create.js.map +7 -1
  173. package/dist/commands/evals/optimize-description.js +225 -222
  174. package/dist/commands/evals/optimize-description.js.map +7 -1
  175. package/dist/commands/evals/optimize.js +206 -196
  176. package/dist/commands/evals/optimize.js.map +7 -1
  177. package/dist/commands/evals/run.js +178 -164
  178. package/dist/commands/evals/run.js.map +7 -1
  179. package/dist/commands/gateway/ensure.js +33 -19
  180. package/dist/commands/gateway/ensure.js.map +7 -1
  181. package/dist/commands/hooks/install.js +335 -275
  182. package/dist/commands/hooks/install.js.map +7 -1
  183. package/dist/commands/hooks/run.js +72 -53
  184. package/dist/commands/hooks/run.js.map +7 -1
  185. package/dist/commands/hooks/uninstall.js +117 -94
  186. package/dist/commands/hooks/uninstall.js.map +7 -1
  187. package/dist/commands/import.js +63 -53
  188. package/dist/commands/import.js.map +7 -1
  189. package/dist/commands/instructions/create.js +71 -58
  190. package/dist/commands/instructions/create.js.map +7 -1
  191. package/dist/commands/instructions/delete.js +53 -36
  192. package/dist/commands/instructions/delete.js.map +7 -1
  193. package/dist/commands/instructions/fork.js +33 -19
  194. package/dist/commands/instructions/fork.js.map +7 -1
  195. package/dist/commands/instructions/get.js +66 -49
  196. package/dist/commands/instructions/get.js.map +7 -1
  197. package/dist/commands/instructions/list.js +63 -46
  198. package/dist/commands/instructions/list.js.map +7 -1
  199. package/dist/commands/instructions/promote.js +41 -27
  200. package/dist/commands/instructions/promote.js.map +7 -1
  201. package/dist/commands/instructions/pull.js +37 -21
  202. package/dist/commands/instructions/pull.js.map +7 -1
  203. package/dist/commands/instructions/upstream.js +36 -21
  204. package/dist/commands/instructions/upstream.js.map +7 -1
  205. package/dist/commands/instructions/versions.js +51 -33
  206. package/dist/commands/instructions/versions.js.map +7 -1
  207. package/dist/commands/launcher.js +39 -0
  208. package/dist/commands/launcher.js.map +7 -0
  209. package/dist/commands/org/current.js +74 -68
  210. package/dist/commands/org/current.js.map +7 -1
  211. package/dist/commands/org/list.js +50 -36
  212. package/dist/commands/org/list.js.map +7 -1
  213. package/dist/commands/org/switch.js +69 -51
  214. package/dist/commands/org/switch.js.map +7 -1
  215. package/dist/commands/packs/add-instruction.js +36 -22
  216. package/dist/commands/packs/add-instruction.js.map +7 -1
  217. package/dist/commands/packs/apply.js +38 -24
  218. package/dist/commands/packs/apply.js.map +7 -1
  219. package/dist/commands/packs/create.js +47 -33
  220. package/dist/commands/packs/create.js.map +7 -1
  221. package/dist/commands/packs/fork.js +33 -19
  222. package/dist/commands/packs/fork.js.map +7 -1
  223. package/dist/commands/packs/get.js +54 -35
  224. package/dist/commands/packs/get.js.map +7 -1
  225. package/dist/commands/packs/list.js +64 -47
  226. package/dist/commands/packs/list.js.map +7 -1
  227. package/dist/commands/packs/remove-instruction.js +34 -20
  228. package/dist/commands/packs/remove-instruction.js.map +7 -1
  229. package/dist/commands/proxy/env.js +126 -116
  230. package/dist/commands/proxy/env.js.map +7 -1
  231. package/dist/commands/proxy/logs.js +83 -74
  232. package/dist/commands/proxy/logs.js.map +7 -1
  233. package/dist/commands/proxy/restart.js +34 -36
  234. package/dist/commands/proxy/restart.js.map +7 -1
  235. package/dist/commands/proxy/setup.js +432 -375
  236. package/dist/commands/proxy/setup.js.map +7 -1
  237. package/dist/commands/proxy/start.js +289 -289
  238. package/dist/commands/proxy/start.js.map +7 -1
  239. package/dist/commands/proxy/status.js +74 -64
  240. package/dist/commands/proxy/status.js.map +7 -1
  241. package/dist/commands/proxy/stop.js +81 -75
  242. package/dist/commands/proxy/stop.js.map +7 -1
  243. package/dist/commands/research/backfill.js +58 -0
  244. package/dist/commands/research/backfill.js.map +7 -0
  245. package/dist/commands/research/tail-transcript.js +69 -0
  246. package/dist/commands/research/tail-transcript.js.map +7 -0
  247. package/dist/commands/service/install.js +639 -405
  248. package/dist/commands/service/install.js.map +7 -1
  249. package/dist/commands/service/status.js +178 -111
  250. package/dist/commands/service/status.js.map +7 -1
  251. package/dist/commands/service/uninstall.js +85 -110
  252. package/dist/commands/service/uninstall.js.map +7 -1
  253. package/dist/commands/sessions/analyze.js +46 -25
  254. package/dist/commands/sessions/analyze.js.map +7 -1
  255. package/dist/commands/sessions/end.js +81 -79
  256. package/dist/commands/sessions/end.js.map +7 -1
  257. package/dist/commands/sessions/import.js +44 -27
  258. package/dist/commands/sessions/import.js.map +7 -1
  259. package/dist/commands/sessions/list.js +46 -33
  260. package/dist/commands/sessions/list.js.map +7 -1
  261. package/dist/commands/sessions/start.js +88 -87
  262. package/dist/commands/sessions/start.js.map +7 -1
  263. package/dist/commands/signals/report.js +42 -34
  264. package/dist/commands/signals/report.js.map +7 -1
  265. package/dist/commands/skills/export-approved.js +44 -30
  266. package/dist/commands/skills/export-approved.js.map +7 -1
  267. package/dist/commands/skills/install.js +99 -84
  268. package/dist/commands/skills/install.js.map +7 -1
  269. package/dist/commands/skills/list.js +59 -42
  270. package/dist/commands/skills/list.js.map +7 -1
  271. package/dist/commands/skills/publish.js +95 -78
  272. package/dist/commands/skills/publish.js.map +7 -1
  273. package/dist/commands/skills/search.js +68 -53
  274. package/dist/commands/skills/search.js.map +7 -1
  275. package/dist/commands/skills/update.js +52 -39
  276. package/dist/commands/skills/update.js.map +7 -1
  277. package/dist/commands/suggestions/accept.js +82 -59
  278. package/dist/commands/suggestions/accept.js.map +7 -1
  279. package/dist/commands/suggestions/dismiss.js +44 -26
  280. package/dist/commands/suggestions/dismiss.js.map +7 -1
  281. package/dist/commands/suggestions/list.js +59 -39
  282. package/dist/commands/suggestions/list.js.map +7 -1
  283. package/dist/commands/suggestions/refresh.js +26 -11
  284. package/dist/commands/suggestions/refresh.js.map +7 -1
  285. package/dist/cursor-BGQJ4CWI.js +134 -0
  286. package/dist/cursor-BGQJ4CWI.js.map +7 -0
  287. package/dist/dashboard/Dashboard.js +229 -126
  288. package/dist/dashboard/Dashboard.js.map +7 -1
  289. package/dist/dashboard/data.js +13 -137
  290. package/dist/dashboard/data.js.map +7 -1
  291. package/dist/dashboard/launcher/ActiveJobsList.js +10 -0
  292. package/dist/dashboard/launcher/ActiveJobsList.js.map +7 -0
  293. package/dist/dashboard/launcher/LauncherOverlay.js +14 -0
  294. package/dist/dashboard/launcher/LauncherOverlay.js.map +7 -0
  295. package/dist/dashboard/launcher/NewLaunchForm.js +10 -0
  296. package/dist/dashboard/launcher/NewLaunchForm.js.map +7 -0
  297. package/dist/dashboard/launcher/api.js +14 -0
  298. package/dist/dashboard/launcher/api.js.map +7 -0
  299. package/dist/dashboard/launcher/tool-labels.js +10 -0
  300. package/dist/dashboard/launcher/tool-labels.js.map +7 -0
  301. package/dist/dashboard/launcher/types.js +1 -0
  302. package/dist/dashboard/launcher/types.js.map +7 -0
  303. package/dist/dashboard/launcher/useLaunchJobs.js +9 -0
  304. package/dist/dashboard/launcher/useLaunchJobs.js.map +7 -0
  305. package/dist/dashboard/panels/friction.js +10 -22
  306. package/dist/dashboard/panels/friction.js.map +7 -1
  307. package/dist/dashboard/panels/insights.js +10 -109
  308. package/dist/dashboard/panels/insights.js.map +7 -1
  309. package/dist/dashboard/panels/instructions.js +10 -17
  310. package/dist/dashboard/panels/instructions.js.map +7 -1
  311. package/dist/dashboard/panels/outcomes.js +9 -28
  312. package/dist/dashboard/panels/outcomes.js.map +7 -1
  313. package/dist/dashboard/panels/overview.js +10 -20
  314. package/dist/dashboard/panels/overview.js.map +7 -1
  315. package/dist/dashboard/panels/shared.js +18 -61
  316. package/dist/dashboard/panels/shared.js.map +7 -1
  317. package/dist/dashboard/types.js +23 -26
  318. package/dist/dashboard/types.js.map +7 -1
  319. package/dist/dist-CSUYFYKI.js +52 -0
  320. package/dist/dist-CSUYFYKI.js.map +7 -0
  321. package/dist/index.js +8 -2
  322. package/dist/index.js.map +7 -1
  323. package/dist/lib/active-org-refresh.js +15 -108
  324. package/dist/lib/active-org-refresh.js.map +7 -1
  325. package/dist/lib/active-org.js +15 -95
  326. package/dist/lib/active-org.js.map +7 -1
  327. package/dist/lib/agent-loop.js +44 -0
  328. package/dist/lib/agent-loop.js.map +7 -0
  329. package/dist/lib/antigravity-transcript.js +22 -0
  330. package/dist/lib/antigravity-transcript.js.map +7 -0
  331. package/dist/lib/api-client.js +21 -92
  332. package/dist/lib/api-client.js.map +7 -1
  333. package/dist/lib/auth.js +26 -137
  334. package/dist/lib/auth.js.map +7 -1
  335. package/dist/lib/detect-languages.js +8 -113
  336. package/dist/lib/detect-languages.js.map +7 -1
  337. package/dist/lib/detect-tmux.js +9 -0
  338. package/dist/lib/detect-tmux.js.map +7 -0
  339. package/dist/lib/eval-analyzer.js +9 -89
  340. package/dist/lib/eval-analyzer.js.map +7 -1
  341. package/dist/lib/eval-benchmark.js +12 -92
  342. package/dist/lib/eval-benchmark.js.map +7 -1
  343. package/dist/lib/eval-conversation-handler.js +13 -200
  344. package/dist/lib/eval-conversation-handler.js.map +7 -1
  345. package/dist/lib/eval-executor.js +8 -83
  346. package/dist/lib/eval-executor.js.map +7 -1
  347. package/dist/lib/eval-grader.js +9 -123
  348. package/dist/lib/eval-grader.js.map +7 -1
  349. package/dist/lib/eval-meta-judge.js +9 -116
  350. package/dist/lib/eval-meta-judge.js.map +7 -1
  351. package/dist/lib/eval-trigger-tester.js +11 -96
  352. package/dist/lib/eval-trigger-tester.js.map +7 -1
  353. package/dist/lib/eval-worktree.js +8 -87
  354. package/dist/lib/eval-worktree.js.map +7 -1
  355. package/dist/lib/gateway-entry.js +20 -18
  356. package/dist/lib/gateway-entry.js.map +7 -1
  357. package/dist/lib/gateway-lifecycle.js +22 -97
  358. package/dist/lib/gateway-lifecycle.js.map +7 -1
  359. package/dist/lib/gateway.js +12 -216
  360. package/dist/lib/gateway.js.map +7 -1
  361. package/dist/lib/handlers/cron-close-stale-sessions.js +18 -7
  362. package/dist/lib/handlers/cron-close-stale-sessions.js.map +7 -1
  363. package/dist/lib/handlers/cron-data-integrity-audit.js +21 -15
  364. package/dist/lib/handlers/cron-data-integrity-audit.js.map +7 -1
  365. package/dist/lib/handlers/cron-refresh-skills.js +7 -90
  366. package/dist/lib/handlers/cron-refresh-skills.js.map +7 -1
  367. package/dist/lib/handlers/cron-suggest-instructions.js +14 -158
  368. package/dist/lib/handlers/cron-suggest-instructions.js.map +7 -1
  369. package/dist/lib/handlers/process-announcement.js +11 -0
  370. package/dist/lib/handlers/process-announcement.js.map +7 -0
  371. package/dist/lib/handlers/process-changelog.js +11 -0
  372. package/dist/lib/handlers/process-changelog.js.map +7 -0
  373. package/dist/lib/handlers/process-conversation.js +14 -35
  374. package/dist/lib/handlers/process-conversation.js.map +7 -1
  375. package/dist/lib/handlers/process-eval.js +15 -207
  376. package/dist/lib/handlers/process-eval.js.map +7 -1
  377. package/dist/lib/handlers/process-insights.js +14 -300
  378. package/dist/lib/handlers/process-insights.js.map +7 -1
  379. package/dist/lib/handlers/process-launch.js +16 -41
  380. package/dist/lib/handlers/process-launch.js.map +7 -1
  381. package/dist/lib/handlers/process-run-cleanup.js +13 -0
  382. package/dist/lib/handlers/process-run-cleanup.js.map +7 -0
  383. package/dist/lib/handlers/process-send-message.js +10 -0
  384. package/dist/lib/handlers/process-send-message.js.map +7 -0
  385. package/dist/lib/handlers/process-session-goal.js +11 -74
  386. package/dist/lib/handlers/process-session-goal.js.map +7 -1
  387. package/dist/lib/hooks-config.js +52 -544
  388. package/dist/lib/hooks-config.js.map +7 -1
  389. package/dist/lib/insights-prompts.js +12 -145
  390. package/dist/lib/insights-prompts.js.map +7 -1
  391. package/dist/lib/job-helpers.js +1 -0
  392. package/dist/lib/job-helpers.js.map +7 -0
  393. package/dist/lib/llm-client.js +16 -274
  394. package/dist/lib/llm-client.js.map +7 -1
  395. package/dist/lib/manual-tasks.js +22 -0
  396. package/dist/lib/manual-tasks.js.map +7 -0
  397. package/dist/lib/output.js +12 -36
  398. package/dist/lib/output.js.map +7 -1
  399. package/dist/lib/permanent-job-error.js +10 -23
  400. package/dist/lib/permanent-job-error.js.map +7 -1
  401. package/dist/lib/provider-aggregator.js +57 -55
  402. package/dist/lib/provider-aggregator.js.map +7 -1
  403. package/dist/lib/research-client.js +12 -0
  404. package/dist/lib/research-client.js.map +7 -0
  405. package/dist/lib/skills-loader.js +8 -51
  406. package/dist/lib/skills-loader.js.map +7 -1
  407. package/dist/lib/statusline-shim.js +16 -0
  408. package/dist/lib/statusline-shim.js.map +7 -0
  409. package/dist/lib/terminal-target-heartbeat.js +15 -0
  410. package/dist/lib/terminal-target-heartbeat.js.map +7 -0
  411. package/dist/lib/tmux.js +16 -0
  412. package/dist/lib/tmux.js.map +7 -0
  413. package/dist/lib/transcript-rate-limit-watcher.js +22 -0
  414. package/dist/lib/transcript-rate-limit-watcher.js.map +7 -0
  415. package/dist/lib/types.js +8 -7
  416. package/dist/lib/types.js.map +7 -1
  417. package/dist/lib/version-check.js +10 -106
  418. package/dist/lib/version-check.js.map +7 -1
  419. package/dist/lib/which.js +8 -0
  420. package/dist/lib/which.js.map +7 -0
  421. package/dist/lib/worktree.js +17 -0
  422. package/dist/lib/worktree.js.map +7 -0
  423. package/dist/opencode-IQ7X5YMJ.js +190 -0
  424. package/dist/opencode-IQ7X5YMJ.js.map +7 -0
  425. package/oclif.manifest.json +299 -66
  426. package/package.json +27 -11
  427. package/dist/base-command.d.ts +0 -12
  428. package/dist/base-command.d.ts.map +0 -1
  429. package/dist/commands/auth/create-key.d.ts +0 -11
  430. package/dist/commands/auth/create-key.d.ts.map +0 -1
  431. package/dist/commands/auth/login.d.ts +0 -11
  432. package/dist/commands/auth/login.d.ts.map +0 -1
  433. package/dist/commands/auth/logout.d.ts +0 -7
  434. package/dist/commands/auth/logout.d.ts.map +0 -1
  435. package/dist/commands/auth/revoke-key.d.ts +0 -10
  436. package/dist/commands/auth/revoke-key.d.ts.map +0 -1
  437. package/dist/commands/auth/status.d.ts +0 -7
  438. package/dist/commands/auth/status.d.ts.map +0 -1
  439. package/dist/commands/catalog/index.d.ts +0 -11
  440. package/dist/commands/catalog/index.d.ts.map +0 -1
  441. package/dist/commands/catalog/recommend.d.ts +0 -9
  442. package/dist/commands/catalog/recommend.d.ts.map +0 -1
  443. package/dist/commands/convert.d.ts +0 -15
  444. package/dist/commands/convert.d.ts.map +0 -1
  445. package/dist/commands/converters.d.ts +0 -12
  446. package/dist/commands/converters.d.ts.map +0 -1
  447. package/dist/commands/crons/list.d.ts +0 -7
  448. package/dist/commands/crons/list.d.ts.map +0 -1
  449. package/dist/commands/crons/run.d.ts +0 -13
  450. package/dist/commands/crons/run.d.ts.map +0 -1
  451. package/dist/commands/dashboard.d.ts +0 -10
  452. package/dist/commands/dashboard.d.ts.map +0 -1
  453. package/dist/commands/eval-targets/create.d.ts +0 -14
  454. package/dist/commands/eval-targets/create.d.ts.map +0 -1
  455. package/dist/commands/eval-targets/list.d.ts +0 -10
  456. package/dist/commands/eval-targets/list.d.ts.map +0 -1
  457. package/dist/commands/evals/benchmark.d.ts +0 -13
  458. package/dist/commands/evals/benchmark.d.ts.map +0 -1
  459. package/dist/commands/evals/compare.d.ts +0 -15
  460. package/dist/commands/evals/compare.d.ts.map +0 -1
  461. package/dist/commands/evals/create.d.ts +0 -17
  462. package/dist/commands/evals/create.d.ts.map +0 -1
  463. package/dist/commands/evals/listen.d.ts +0 -37
  464. package/dist/commands/evals/listen.d.ts.map +0 -1
  465. package/dist/commands/evals/listen.js +0 -188
  466. package/dist/commands/evals/listen.js.map +0 -1
  467. package/dist/commands/evals/listen.test.d.ts +0 -2
  468. package/dist/commands/evals/listen.test.d.ts.map +0 -1
  469. package/dist/commands/evals/listen.test.js +0 -48
  470. package/dist/commands/evals/listen.test.js.map +0 -1
  471. package/dist/commands/evals/optimize-description.d.ts +0 -22
  472. package/dist/commands/evals/optimize-description.d.ts.map +0 -1
  473. package/dist/commands/evals/optimize.d.ts +0 -22
  474. package/dist/commands/evals/optimize.d.ts.map +0 -1
  475. package/dist/commands/evals/run.d.ts +0 -21
  476. package/dist/commands/evals/run.d.ts.map +0 -1
  477. package/dist/commands/gateway/ensure.d.ts +0 -7
  478. package/dist/commands/gateway/ensure.d.ts.map +0 -1
  479. package/dist/commands/hooks/install.d.ts +0 -16
  480. package/dist/commands/hooks/install.d.ts.map +0 -1
  481. package/dist/commands/hooks/run.d.ts +0 -11
  482. package/dist/commands/hooks/run.d.ts.map +0 -1
  483. package/dist/commands/hooks/uninstall.d.ts +0 -7
  484. package/dist/commands/hooks/uninstall.d.ts.map +0 -1
  485. package/dist/commands/import.d.ts +0 -17
  486. package/dist/commands/import.d.ts.map +0 -1
  487. package/dist/commands/instructions/create.d.ts +0 -17
  488. package/dist/commands/instructions/create.d.ts.map +0 -1
  489. package/dist/commands/instructions/delete.d.ts +0 -13
  490. package/dist/commands/instructions/delete.d.ts.map +0 -1
  491. package/dist/commands/instructions/fork.d.ts +0 -10
  492. package/dist/commands/instructions/fork.d.ts.map +0 -1
  493. package/dist/commands/instructions/get.d.ts +0 -15
  494. package/dist/commands/instructions/get.d.ts.map +0 -1
  495. package/dist/commands/instructions/list.d.ts +0 -12
  496. package/dist/commands/instructions/list.d.ts.map +0 -1
  497. package/dist/commands/instructions/promote.d.ts +0 -14
  498. package/dist/commands/instructions/promote.d.ts.map +0 -1
  499. package/dist/commands/instructions/pull.d.ts +0 -9
  500. package/dist/commands/instructions/pull.d.ts.map +0 -1
  501. package/dist/commands/instructions/upstream.d.ts +0 -9
  502. package/dist/commands/instructions/upstream.d.ts.map +0 -1
  503. package/dist/commands/instructions/versions.d.ts +0 -12
  504. package/dist/commands/instructions/versions.d.ts.map +0 -1
  505. package/dist/commands/org/current.d.ts +0 -7
  506. package/dist/commands/org/current.d.ts.map +0 -1
  507. package/dist/commands/org/list.d.ts +0 -7
  508. package/dist/commands/org/list.d.ts.map +0 -1
  509. package/dist/commands/org/switch.d.ts +0 -13
  510. package/dist/commands/org/switch.d.ts.map +0 -1
  511. package/dist/commands/packs/add-instruction.d.ts +0 -11
  512. package/dist/commands/packs/add-instruction.d.ts.map +0 -1
  513. package/dist/commands/packs/apply.d.ts +0 -13
  514. package/dist/commands/packs/apply.d.ts.map +0 -1
  515. package/dist/commands/packs/create.d.ts +0 -13
  516. package/dist/commands/packs/create.d.ts.map +0 -1
  517. package/dist/commands/packs/fork.d.ts +0 -10
  518. package/dist/commands/packs/fork.d.ts.map +0 -1
  519. package/dist/commands/packs/get.d.ts +0 -10
  520. package/dist/commands/packs/get.d.ts.map +0 -1
  521. package/dist/commands/packs/list.d.ts +0 -22
  522. package/dist/commands/packs/list.d.ts.map +0 -1
  523. package/dist/commands/packs/remove-instruction.d.ts +0 -11
  524. package/dist/commands/packs/remove-instruction.d.ts.map +0 -1
  525. package/dist/commands/proxy/env.d.ts +0 -14
  526. package/dist/commands/proxy/env.d.ts.map +0 -1
  527. package/dist/commands/proxy/logs.d.ts +0 -11
  528. package/dist/commands/proxy/logs.d.ts.map +0 -1
  529. package/dist/commands/proxy/restart.d.ts +0 -11
  530. package/dist/commands/proxy/restart.d.ts.map +0 -1
  531. package/dist/commands/proxy/setup.d.ts +0 -23
  532. package/dist/commands/proxy/setup.d.ts.map +0 -1
  533. package/dist/commands/proxy/start.d.ts +0 -17
  534. package/dist/commands/proxy/start.d.ts.map +0 -1
  535. package/dist/commands/proxy/status.d.ts +0 -7
  536. package/dist/commands/proxy/status.d.ts.map +0 -1
  537. package/dist/commands/proxy/stop.d.ts +0 -8
  538. package/dist/commands/proxy/stop.d.ts.map +0 -1
  539. package/dist/commands/service/install.d.ts +0 -33
  540. package/dist/commands/service/install.d.ts.map +0 -1
  541. package/dist/commands/service/install.test.d.ts +0 -2
  542. package/dist/commands/service/install.test.d.ts.map +0 -1
  543. package/dist/commands/service/install.test.js +0 -345
  544. package/dist/commands/service/install.test.js.map +0 -1
  545. package/dist/commands/service/status.d.ts +0 -6
  546. package/dist/commands/service/status.d.ts.map +0 -1
  547. package/dist/commands/service/uninstall.d.ts +0 -6
  548. package/dist/commands/service/uninstall.d.ts.map +0 -1
  549. package/dist/commands/sessions/analyze.d.ts +0 -10
  550. package/dist/commands/sessions/analyze.d.ts.map +0 -1
  551. package/dist/commands/sessions/end.d.ts +0 -9
  552. package/dist/commands/sessions/end.d.ts.map +0 -1
  553. package/dist/commands/sessions/import.d.ts +0 -13
  554. package/dist/commands/sessions/import.d.ts.map +0 -1
  555. package/dist/commands/sessions/list.d.ts +0 -11
  556. package/dist/commands/sessions/list.d.ts.map +0 -1
  557. package/dist/commands/sessions/start.d.ts +0 -11
  558. package/dist/commands/sessions/start.d.ts.map +0 -1
  559. package/dist/commands/signals/report.d.ts +0 -10
  560. package/dist/commands/signals/report.d.ts.map +0 -1
  561. package/dist/commands/signals/report.test.d.ts +0 -2
  562. package/dist/commands/signals/report.test.d.ts.map +0 -1
  563. package/dist/commands/signals/report.test.js +0 -65
  564. package/dist/commands/signals/report.test.js.map +0 -1
  565. package/dist/commands/skills/export-approved.d.ts +0 -10
  566. package/dist/commands/skills/export-approved.d.ts.map +0 -1
  567. package/dist/commands/skills/install.d.ts +0 -15
  568. package/dist/commands/skills/install.d.ts.map +0 -1
  569. package/dist/commands/skills/list.d.ts +0 -11
  570. package/dist/commands/skills/list.d.ts.map +0 -1
  571. package/dist/commands/skills/publish.d.ts +0 -17
  572. package/dist/commands/skills/publish.d.ts.map +0 -1
  573. package/dist/commands/skills/search.d.ts +0 -17
  574. package/dist/commands/skills/search.d.ts.map +0 -1
  575. package/dist/commands/skills/update.d.ts +0 -10
  576. package/dist/commands/skills/update.d.ts.map +0 -1
  577. package/dist/commands/suggestions/accept.d.ts +0 -16
  578. package/dist/commands/suggestions/accept.d.ts.map +0 -1
  579. package/dist/commands/suggestions/accept.test.d.ts +0 -2
  580. package/dist/commands/suggestions/accept.test.d.ts.map +0 -1
  581. package/dist/commands/suggestions/accept.test.js +0 -52
  582. package/dist/commands/suggestions/accept.test.js.map +0 -1
  583. package/dist/commands/suggestions/dismiss.d.ts +0 -10
  584. package/dist/commands/suggestions/dismiss.d.ts.map +0 -1
  585. package/dist/commands/suggestions/list.d.ts +0 -10
  586. package/dist/commands/suggestions/list.d.ts.map +0 -1
  587. package/dist/commands/suggestions/refresh.d.ts +0 -7
  588. package/dist/commands/suggestions/refresh.d.ts.map +0 -1
  589. package/dist/dashboard/Dashboard.d.ts +0 -3
  590. package/dist/dashboard/Dashboard.d.ts.map +0 -1
  591. package/dist/dashboard/data.d.ts +0 -11
  592. package/dist/dashboard/data.d.ts.map +0 -1
  593. package/dist/dashboard/panels/friction.d.ts +0 -7
  594. package/dist/dashboard/panels/friction.d.ts.map +0 -1
  595. package/dist/dashboard/panels/insights.d.ts +0 -8
  596. package/dist/dashboard/panels/insights.d.ts.map +0 -1
  597. package/dist/dashboard/panels/instructions.d.ts +0 -9
  598. package/dist/dashboard/panels/instructions.d.ts.map +0 -1
  599. package/dist/dashboard/panels/outcomes.d.ts +0 -7
  600. package/dist/dashboard/panels/outcomes.d.ts.map +0 -1
  601. package/dist/dashboard/panels/overview.d.ts +0 -8
  602. package/dist/dashboard/panels/overview.d.ts.map +0 -1
  603. package/dist/dashboard/panels/shared.d.ts +0 -17
  604. package/dist/dashboard/panels/shared.d.ts.map +0 -1
  605. package/dist/dashboard/types.d.ts +0 -80
  606. package/dist/dashboard/types.d.ts.map +0 -1
  607. package/dist/index.d.ts +0 -2
  608. package/dist/index.d.ts.map +0 -1
  609. package/dist/lib/active-org-refresh.d.ts +0 -22
  610. package/dist/lib/active-org-refresh.d.ts.map +0 -1
  611. package/dist/lib/active-org-refresh.test.d.ts +0 -2
  612. package/dist/lib/active-org-refresh.test.d.ts.map +0 -1
  613. package/dist/lib/active-org-refresh.test.js +0 -190
  614. package/dist/lib/active-org-refresh.test.js.map +0 -1
  615. package/dist/lib/active-org.d.ts +0 -43
  616. package/dist/lib/active-org.d.ts.map +0 -1
  617. package/dist/lib/active-org.test.d.ts +0 -2
  618. package/dist/lib/active-org.test.d.ts.map +0 -1
  619. package/dist/lib/active-org.test.js +0 -147
  620. package/dist/lib/active-org.test.js.map +0 -1
  621. package/dist/lib/api-client.d.ts +0 -17
  622. package/dist/lib/api-client.d.ts.map +0 -1
  623. package/dist/lib/api-client.test.d.ts +0 -2
  624. package/dist/lib/api-client.test.d.ts.map +0 -1
  625. package/dist/lib/api-client.test.js +0 -161
  626. package/dist/lib/api-client.test.js.map +0 -1
  627. package/dist/lib/auth.d.ts +0 -27
  628. package/dist/lib/auth.d.ts.map +0 -1
  629. package/dist/lib/auth.test.d.ts +0 -2
  630. package/dist/lib/auth.test.d.ts.map +0 -1
  631. package/dist/lib/auth.test.js +0 -110
  632. package/dist/lib/auth.test.js.map +0 -1
  633. package/dist/lib/cron-registry.d.ts +0 -47
  634. package/dist/lib/cron-registry.d.ts.map +0 -1
  635. package/dist/lib/cron-registry.js +0 -102
  636. package/dist/lib/cron-registry.js.map +0 -1
  637. package/dist/lib/cron-registry.test.d.ts +0 -2
  638. package/dist/lib/cron-registry.test.d.ts.map +0 -1
  639. package/dist/lib/cron-registry.test.js +0 -136
  640. package/dist/lib/cron-registry.test.js.map +0 -1
  641. package/dist/lib/cron-runner.d.ts +0 -16
  642. package/dist/lib/cron-runner.d.ts.map +0 -1
  643. package/dist/lib/cron-runner.js +0 -68
  644. package/dist/lib/cron-runner.js.map +0 -1
  645. package/dist/lib/detect-languages.d.ts +0 -7
  646. package/dist/lib/detect-languages.d.ts.map +0 -1
  647. package/dist/lib/detect-languages.test.d.ts +0 -2
  648. package/dist/lib/detect-languages.test.d.ts.map +0 -1
  649. package/dist/lib/detect-languages.test.js +0 -29
  650. package/dist/lib/detect-languages.test.js.map +0 -1
  651. package/dist/lib/eval-analyzer.d.ts +0 -23
  652. package/dist/lib/eval-analyzer.d.ts.map +0 -1
  653. package/dist/lib/eval-benchmark.d.ts +0 -17
  654. package/dist/lib/eval-benchmark.d.ts.map +0 -1
  655. package/dist/lib/eval-conversation-handler.d.ts +0 -9
  656. package/dist/lib/eval-conversation-handler.d.ts.map +0 -1
  657. package/dist/lib/eval-executor.d.ts +0 -21
  658. package/dist/lib/eval-executor.d.ts.map +0 -1
  659. package/dist/lib/eval-executor.test.d.ts +0 -2
  660. package/dist/lib/eval-executor.test.d.ts.map +0 -1
  661. package/dist/lib/eval-executor.test.js +0 -8
  662. package/dist/lib/eval-executor.test.js.map +0 -1
  663. package/dist/lib/eval-grader.d.ts +0 -38
  664. package/dist/lib/eval-grader.d.ts.map +0 -1
  665. package/dist/lib/eval-grader.test.d.ts +0 -2
  666. package/dist/lib/eval-grader.test.d.ts.map +0 -1
  667. package/dist/lib/eval-grader.test.js +0 -8
  668. package/dist/lib/eval-grader.test.js.map +0 -1
  669. package/dist/lib/eval-meta-judge.d.ts +0 -28
  670. package/dist/lib/eval-meta-judge.d.ts.map +0 -1
  671. package/dist/lib/eval-trigger-tester.d.ts +0 -19
  672. package/dist/lib/eval-trigger-tester.d.ts.map +0 -1
  673. package/dist/lib/eval-worktree.d.ts +0 -11
  674. package/dist/lib/eval-worktree.d.ts.map +0 -1
  675. package/dist/lib/eval-worktree.test.d.ts +0 -2
  676. package/dist/lib/eval-worktree.test.d.ts.map +0 -1
  677. package/dist/lib/eval-worktree.test.js +0 -68
  678. package/dist/lib/eval-worktree.test.js.map +0 -1
  679. package/dist/lib/gateway-entry.d.ts +0 -3
  680. package/dist/lib/gateway-entry.d.ts.map +0 -1
  681. package/dist/lib/gateway-lifecycle.d.ts +0 -9
  682. package/dist/lib/gateway-lifecycle.d.ts.map +0 -1
  683. package/dist/lib/gateway.d.ts +0 -11
  684. package/dist/lib/gateway.d.ts.map +0 -1
  685. package/dist/lib/graphile-worker-runner.d.ts +0 -124
  686. package/dist/lib/graphile-worker-runner.d.ts.map +0 -1
  687. package/dist/lib/graphile-worker-runner.js +0 -530
  688. package/dist/lib/graphile-worker-runner.js.map +0 -1
  689. package/dist/lib/graphile-worker-runner.test.d.ts +0 -2
  690. package/dist/lib/graphile-worker-runner.test.d.ts.map +0 -1
  691. package/dist/lib/graphile-worker-runner.test.js +0 -153
  692. package/dist/lib/graphile-worker-runner.test.js.map +0 -1
  693. package/dist/lib/handlers/cron-close-stale-sessions.d.ts +0 -3
  694. package/dist/lib/handlers/cron-close-stale-sessions.d.ts.map +0 -1
  695. package/dist/lib/handlers/cron-data-integrity-audit.d.ts +0 -3
  696. package/dist/lib/handlers/cron-data-integrity-audit.d.ts.map +0 -1
  697. package/dist/lib/handlers/cron-refresh-skills.d.ts +0 -3
  698. package/dist/lib/handlers/cron-refresh-skills.d.ts.map +0 -1
  699. package/dist/lib/handlers/cron-refresh-skills.test.d.ts +0 -2
  700. package/dist/lib/handlers/cron-refresh-skills.test.d.ts.map +0 -1
  701. package/dist/lib/handlers/cron-refresh-skills.test.js +0 -114
  702. package/dist/lib/handlers/cron-refresh-skills.test.js.map +0 -1
  703. package/dist/lib/handlers/cron-regenerate-insights.d.ts +0 -3
  704. package/dist/lib/handlers/cron-regenerate-insights.d.ts.map +0 -1
  705. package/dist/lib/handlers/cron-regenerate-insights.js +0 -6
  706. package/dist/lib/handlers/cron-regenerate-insights.js.map +0 -1
  707. package/dist/lib/handlers/cron-suggest-instructions.d.ts +0 -3
  708. package/dist/lib/handlers/cron-suggest-instructions.d.ts.map +0 -1
  709. package/dist/lib/handlers/cron-suggest-instructions.test.d.ts +0 -2
  710. package/dist/lib/handlers/cron-suggest-instructions.test.d.ts.map +0 -1
  711. package/dist/lib/handlers/cron-suggest-instructions.test.js +0 -80
  712. package/dist/lib/handlers/cron-suggest-instructions.test.js.map +0 -1
  713. package/dist/lib/handlers/process-conversation.d.ts +0 -35
  714. package/dist/lib/handlers/process-conversation.d.ts.map +0 -1
  715. package/dist/lib/handlers/process-eval.d.ts +0 -32
  716. package/dist/lib/handlers/process-eval.d.ts.map +0 -1
  717. package/dist/lib/handlers/process-insights.d.ts +0 -39
  718. package/dist/lib/handlers/process-insights.d.ts.map +0 -1
  719. package/dist/lib/handlers/process-launch.d.ts +0 -29
  720. package/dist/lib/handlers/process-launch.d.ts.map +0 -1
  721. package/dist/lib/handlers/process-session-goal.d.ts +0 -29
  722. package/dist/lib/handlers/process-session-goal.d.ts.map +0 -1
  723. package/dist/lib/handlers/process-session-goal.test.d.ts +0 -2
  724. package/dist/lib/handlers/process-session-goal.test.d.ts.map +0 -1
  725. package/dist/lib/handlers/process-session-goal.test.js +0 -134
  726. package/dist/lib/handlers/process-session-goal.test.js.map +0 -1
  727. package/dist/lib/hooks-config.d.ts +0 -119
  728. package/dist/lib/hooks-config.d.ts.map +0 -1
  729. package/dist/lib/hooks-config.test.d.ts +0 -2
  730. package/dist/lib/hooks-config.test.d.ts.map +0 -1
  731. package/dist/lib/hooks-config.test.js +0 -231
  732. package/dist/lib/hooks-config.test.js.map +0 -1
  733. package/dist/lib/insights-prompts.d.ts +0 -13
  734. package/dist/lib/insights-prompts.d.ts.map +0 -1
  735. package/dist/lib/llm-client.d.ts +0 -26
  736. package/dist/lib/llm-client.d.ts.map +0 -1
  737. package/dist/lib/llm-client.test.d.ts +0 -2
  738. package/dist/lib/llm-client.test.d.ts.map +0 -1
  739. package/dist/lib/llm-client.test.js +0 -62
  740. package/dist/lib/llm-client.test.js.map +0 -1
  741. package/dist/lib/mirror-writer-db.d.ts +0 -12
  742. package/dist/lib/mirror-writer-db.d.ts.map +0 -1
  743. package/dist/lib/mirror-writer-db.js +0 -51
  744. package/dist/lib/mirror-writer-db.js.map +0 -1
  745. package/dist/lib/mirror-writer.d.ts +0 -35
  746. package/dist/lib/mirror-writer.d.ts.map +0 -1
  747. package/dist/lib/mirror-writer.js +0 -27
  748. package/dist/lib/mirror-writer.js.map +0 -1
  749. package/dist/lib/mirror-writer.test.d.ts +0 -2
  750. package/dist/lib/mirror-writer.test.d.ts.map +0 -1
  751. package/dist/lib/mirror-writer.test.js +0 -47
  752. package/dist/lib/mirror-writer.test.js.map +0 -1
  753. package/dist/lib/output.d.ts +0 -4
  754. package/dist/lib/output.d.ts.map +0 -1
  755. package/dist/lib/output.test.d.ts +0 -2
  756. package/dist/lib/output.test.d.ts.map +0 -1
  757. package/dist/lib/output.test.js +0 -71
  758. package/dist/lib/output.test.js.map +0 -1
  759. package/dist/lib/permanent-job-error.d.ts +0 -17
  760. package/dist/lib/permanent-job-error.d.ts.map +0 -1
  761. package/dist/lib/permanent-job-error.test.d.ts +0 -2
  762. package/dist/lib/permanent-job-error.test.d.ts.map +0 -1
  763. package/dist/lib/permanent-job-error.test.js +0 -29
  764. package/dist/lib/permanent-job-error.test.js.map +0 -1
  765. package/dist/lib/provider-aggregator.d.ts +0 -24
  766. package/dist/lib/provider-aggregator.d.ts.map +0 -1
  767. package/dist/lib/provider-aggregator.test.d.ts +0 -2
  768. package/dist/lib/provider-aggregator.test.d.ts.map +0 -1
  769. package/dist/lib/provider-aggregator.test.js +0 -103
  770. package/dist/lib/provider-aggregator.test.js.map +0 -1
  771. package/dist/lib/skills-loader.d.ts +0 -6
  772. package/dist/lib/skills-loader.d.ts.map +0 -1
  773. package/dist/lib/types.d.ts +0 -48
  774. package/dist/lib/types.d.ts.map +0 -1
  775. package/dist/lib/version-check.d.ts +0 -11
  776. package/dist/lib/version-check.d.ts.map +0 -1
  777. package/dist/test-helpers.d.ts +0 -58
  778. package/dist/test-helpers.d.ts.map +0 -1
  779. package/dist/test-helpers.js +0 -58
  780. package/dist/test-helpers.js.map +0 -1
@@ -1,391 +1,448 @@
1
- import { Flags } from '@oclif/core';
2
- import { execSync, spawnSync } from 'node:child_process';
3
- import { existsSync, readFileSync, appendFileSync, writeFileSync } from 'node:fs';
4
- import { homedir } from 'node:os';
5
- import { join } from 'node:path';
6
- import { BaseCommand } from '../../base-command.js';
7
- import { isAuthenticated } from '../../lib/auth.js';
8
- const CERT_PATH = join(homedir(), '.mitmproxy', 'mitmproxy-ca-cert.pem');
9
- const CONFIG_DIR = join(homedir(), '.config', 'rulemetric');
10
- const DEFAULT_PORT = 8787;
11
- export default class ProxySetup extends BaseCommand {
12
- static description = 'Set up context capture proxy (installs mitmproxy, configures shell)';
13
- static examples = [
14
- '<%= config.bin %> proxy setup',
15
- '<%= config.bin %> proxy setup --shell zsh',
16
- '<%= config.bin %> proxy setup --check',
1
+ import {
2
+ findBinary
3
+ } from "../../chunk-ERPMDAO3.js";
4
+ import {
5
+ BaseCommand
6
+ } from "../../chunk-S56LOTGQ.js";
7
+ import "../../chunk-OGVORIFM.js";
8
+ import "../../chunk-2AM54TUK.js";
9
+ import "../../chunk-EJOI2ZGU.js";
10
+ import {
11
+ isAuthenticated
12
+ } from "../../chunk-KZRFUXGF.js";
13
+ import "../../chunk-EKJ2CABV.js";
14
+ import "../../chunk-NSBPE2FW.js";
15
+
16
+ // src/commands/proxy/setup.ts
17
+ import { Flags } from "@oclif/core";
18
+ import { execSync, spawnSync } from "node:child_process";
19
+ import { existsSync, readFileSync, appendFileSync, writeFileSync, mkdirSync } from "node:fs";
20
+ import { homedir } from "node:os";
21
+ import { dirname, join } from "node:path";
22
+ var CERT_PATH = join(homedir(), ".mitmproxy", "mitmproxy-ca-cert.pem");
23
+ var CONFIG_DIR = join(homedir(), ".config", "rulemetric");
24
+ var DEFAULT_PORT = 8787;
25
+ var ProxySetup = class _ProxySetup extends BaseCommand {
26
+ static description = "Set up context capture proxy (installs mitmproxy, configures shell)";
27
+ static examples = [
28
+ "<%= config.bin %> proxy setup",
29
+ "<%= config.bin %> proxy setup --shell zsh",
30
+ "<%= config.bin %> proxy setup --check"
31
+ ];
32
+ static flags = {
33
+ shell: Flags.string({
34
+ description: "Shell to configure (auto-detected if omitted)",
35
+ options: ["zsh", "bash", "fish", "powershell"]
36
+ }),
37
+ port: Flags.integer({
38
+ char: "p",
39
+ default: DEFAULT_PORT,
40
+ description: "Proxy listen port"
41
+ }),
42
+ check: Flags.boolean({
43
+ description: "Only check prerequisites, do not install anything",
44
+ default: false
45
+ })
46
+ };
47
+ async run() {
48
+ const { flags } = await this.parse(_ProxySetup);
49
+ const checkOnly = flags.check;
50
+ const port = flags.port;
51
+ this.log("RuleMetric Proxy Setup");
52
+ this.log("=====================\n");
53
+ const checks = [
54
+ await this.checkAuth(),
55
+ await this.checkMitmproxy(),
56
+ await this.checkCACert(),
57
+ await this.checkHooks(),
58
+ this.checkShellEnv(port)
17
59
  ];
18
- static flags = {
19
- shell: Flags.string({
20
- description: 'Shell to configure (auto-detected if omitted)',
21
- options: ['zsh', 'bash', 'fish'],
22
- }),
23
- port: Flags.integer({
24
- char: 'p',
25
- default: DEFAULT_PORT,
26
- description: 'Proxy listen port',
27
- }),
28
- check: Flags.boolean({
29
- description: 'Only check prerequisites, do not install anything',
30
- default: false,
31
- }),
32
- };
33
- async run() {
34
- const { flags } = await this.parse(ProxySetup);
35
- const checkOnly = flags.check;
36
- const port = flags.port;
37
- this.log('RuleMetric Proxy Setup');
38
- this.log('=====================\n');
39
- const checks = [
40
- await this.checkAuth(),
41
- await this.checkMitmproxy(),
42
- await this.checkCACert(),
43
- await this.checkHooks(),
44
- this.checkShellEnv(port),
45
- ];
46
- // Display results
47
- let allPassed = true;
48
- for (const check of checks) {
49
- const icon = check.ok ? '[OK]' : '[!!]';
50
- this.log(`${icon} ${check.name}: ${check.message}`);
51
- if (!check.ok)
52
- allPassed = false;
53
- }
54
- if (allPassed) {
55
- this.log('\nAll checks passed. Run `rulemetric proxy start` to begin capturing.');
56
- return;
57
- }
58
- if (checkOnly) {
59
- this.log('\nSome checks failed. Run `rulemetric proxy setup` (without --check) to fix.');
60
- return;
61
- }
62
- // Fix failures
63
- this.log('\nFixing issues...\n');
64
- for (const check of checks) {
65
- if (check.ok || !check.fix)
66
- continue;
67
- this.log(`Fixing: ${check.name}...`);
68
- const fixed = await check.fix();
69
- if (fixed) {
70
- this.log(` Fixed.\n`);
71
- }
72
- else {
73
- this.log(` Could not auto-fix. See instructions above.\n`);
74
- }
75
- }
76
- // Re-check
77
- this.log('---\nVerifying...\n');
78
- const reChecks = [
79
- await this.checkAuth(),
80
- await this.checkMitmproxy(),
81
- await this.checkCACert(),
82
- await this.checkHooks(),
83
- this.checkShellEnv(port),
84
- ];
85
- let finalOk = true;
86
- for (const check of reChecks) {
87
- const icon = check.ok ? '[OK]' : '[!!]';
88
- this.log(`${icon} ${check.name}: ${check.message}`);
89
- if (!check.ok)
90
- finalOk = false;
91
- }
92
- if (finalOk) {
93
- this.log('\nSetup complete! Next steps:');
94
- this.log(' 1. Restart your shell (or run `source ~/.zshrc`)');
95
- this.log(' 2. Run `rulemetric proxy start`');
96
- this.log(' 3. Start Claude Code — context will be captured automatically');
97
- }
98
- else {
99
- this.log('\nSome issues remain. Fix manually and re-run `rulemetric proxy setup --check`.');
100
- }
60
+ let allPassed = true;
61
+ for (const check of checks) {
62
+ const icon = check.ok ? "[OK]" : "[!!]";
63
+ this.log(`${icon} ${check.name}: ${check.message}`);
64
+ if (!check.ok) allPassed = false;
101
65
  }
102
- async checkAuth() {
103
- // Check JWT auth (auth.json)
104
- if (isAuthenticated()) {
105
- return { name: 'Authentication', ok: true, message: 'Logged in (JWT)' };
106
- }
107
- // Check API key auth (env vars or env file)
108
- const apiKey = process.env.RULEMETRIC_API_KEY;
109
- if (apiKey) {
110
- return { name: 'Authentication', ok: true, message: `API key (RULEMETRIC_API_KEY=${apiKey.slice(0, 8)}...)` };
111
- }
112
- // Check env file
113
- const envFile = join(homedir(), '.config', 'rulemetric', 'env');
114
- if (existsSync(envFile)) {
115
- const content = readFileSync(envFile, 'utf-8');
116
- if (content.includes('RULEMETRIC_API_KEY') || content.includes('RULEMETRIC_ACCESS_TOKEN')) {
117
- return { name: 'Authentication', ok: true, message: 'Configured via ~/.config/rulemetric/env' };
118
- }
119
- }
120
- return {
121
- name: 'Authentication',
122
- ok: false,
123
- message: 'Not authenticated',
124
- fix: async () => {
125
- this.log(' Run `rulemetric auth login` to authenticate.');
126
- this.log(' Or set RULEMETRIC_API_KEY in ~/.config/rulemetric/env.');
127
- return false;
128
- },
129
- };
66
+ if (allPassed) {
67
+ this.log("\nAll checks passed. Run `rulemetric proxy start` to begin capturing.");
68
+ return;
130
69
  }
131
- async checkMitmproxy() {
132
- const binary = this.findBinary('mitmdump');
133
- if (binary) {
134
- // Get version
135
- try {
136
- const output = execSync(`${binary} --version 2>&1`, { encoding: 'utf-8' });
137
- const version = output.match(/Mitmproxy:\s*([\d.]+)/)?.[1] ?? 'unknown';
138
- return { name: 'mitmproxy', ok: true, message: `Installed (v${version})` };
139
- }
140
- catch {
141
- return { name: 'mitmproxy', ok: true, message: `Found at ${binary}` };
142
- }
143
- }
144
- return {
145
- name: 'mitmproxy',
146
- ok: false,
147
- message: 'Not installed',
148
- fix: async () => this.installMitmproxy(),
149
- };
70
+ if (checkOnly) {
71
+ this.log("\nSome checks failed. Run `rulemetric proxy setup` (without --check) to fix.");
72
+ return;
150
73
  }
151
- async installMitmproxy() {
152
- // Try pipx first (cleanest isolation)
153
- if (this.findBinary('pipx')) {
154
- this.log(' Installing via pipx...');
155
- const result = spawnSync('pipx', ['install', 'mitmproxy'], { stdio: 'inherit' });
156
- if (result.status === 0)
157
- return true;
158
- }
159
- // Try uv tool install
160
- if (this.findBinary('uv')) {
161
- this.log(' Installing via uv...');
162
- const result = spawnSync('uv', ['tool', 'install', 'mitmproxy'], { stdio: 'inherit' });
163
- if (result.status === 0)
164
- return true;
165
- }
166
- // Try pip with --user
167
- if (this.findBinary('pip3') || this.findBinary('pip')) {
168
- const pip = this.findBinary('pip3') || this.findBinary('pip');
169
- this.log(` Installing via ${pip} --user...`);
170
- const result = spawnSync(pip, ['install', '--user', 'mitmproxy'], { stdio: 'inherit' });
171
- if (result.status === 0)
172
- return true;
173
- }
174
- // Try brew
175
- if (this.findBinary('brew')) {
176
- this.log(' Installing via brew...');
177
- const result = spawnSync('brew', ['install', 'mitmproxy'], { stdio: 'inherit' });
178
- if (result.status === 0)
179
- return true;
180
- }
181
- this.log(' Could not auto-install mitmproxy. Install manually:');
182
- this.log(' pipx install mitmproxy # recommended');
183
- this.log(' brew install mitmproxy # macOS');
184
- this.log(' pip install --user mitmproxy');
185
- return false;
74
+ this.log("\nFixing issues...\n");
75
+ for (const check of checks) {
76
+ if (check.ok || !check.fix) continue;
77
+ this.log(`Fixing: ${check.name}...`);
78
+ const fixed = await check.fix();
79
+ if (fixed) {
80
+ this.log(` Fixed.
81
+ `);
82
+ } else {
83
+ this.log(` Could not auto-fix. See instructions above.
84
+ `);
85
+ }
186
86
  }
187
- async checkCACert() {
188
- if (existsSync(CERT_PATH)) {
189
- return { name: 'CA Certificate', ok: true, message: `Found at ${CERT_PATH}` };
190
- }
191
- return {
192
- name: 'CA Certificate',
193
- ok: false,
194
- message: 'Not generated yet',
195
- fix: async () => this.generateCACert(),
196
- };
87
+ this.log("---\nVerifying...\n");
88
+ const reChecks = [
89
+ await this.checkAuth(),
90
+ await this.checkMitmproxy(),
91
+ await this.checkCACert(),
92
+ await this.checkHooks(),
93
+ this.checkShellEnv(port)
94
+ ];
95
+ let finalOk = true;
96
+ for (const check of reChecks) {
97
+ const icon = check.ok ? "[OK]" : "[!!]";
98
+ this.log(`${icon} ${check.name}: ${check.message}`);
99
+ if (!check.ok) finalOk = false;
197
100
  }
198
- async generateCACert() {
199
- const mitmdump = this.findBinary('mitmdump');
200
- if (!mitmdump) {
201
- this.log(' Cannot generate cert mitmproxy not installed.');
202
- return false;
203
- }
204
- // Run mitmdump briefly to generate certs
205
- this.log(' Generating CA certificate...');
206
- const result = spawnSync(mitmdump, ['--set', 'listen_port=0', '-q'], {
207
- timeout: 5000,
208
- stdio: 'ignore',
209
- });
210
- // mitmdump will timeout (expected) — certs should be generated
211
- if (existsSync(CERT_PATH)) {
212
- this.log(` Certificate generated at ${CERT_PATH}`);
213
- // On macOS, offer to trust the cert
214
- if (process.platform === 'darwin') {
215
- this.log(' Adding CA cert to macOS keychain (may require sudo)...');
216
- const trustResult = spawnSync('sudo', [
217
- 'security', 'add-trusted-cert', '-d',
218
- '-r', 'trustRoot',
219
- '-k', '/Library/Keychains/System.keychain',
220
- CERT_PATH,
221
- ], { stdio: 'inherit' });
222
- if (trustResult.status === 0) {
223
- this.log(' CA cert trusted system-wide.');
224
- }
225
- else {
226
- this.log(' Could not auto-trust cert. You may need NODE_EXTRA_CA_CERTS env var.');
227
- }
228
- }
229
- return true;
230
- }
231
- this.log(' Failed to generate cert. Try running: mitmdump --help');
101
+ if (finalOk) {
102
+ this.log("\nSetup complete! Next steps:");
103
+ this.log(" 1. Restart your shell (or run `source ~/.zshrc`)");
104
+ this.log(" 2. Run `rulemetric proxy start`");
105
+ this.log(" 3. Start Claude Code \u2014 context will be captured automatically");
106
+ } else {
107
+ this.log("\nSome issues remain. Fix manually and re-run `rulemetric proxy setup --check`.");
108
+ }
109
+ }
110
+ async checkAuth() {
111
+ if (isAuthenticated()) {
112
+ return { name: "Authentication", ok: true, message: "Logged in (JWT)" };
113
+ }
114
+ const apiKey = process.env.RULEMETRIC_API_KEY;
115
+ if (apiKey) {
116
+ return { name: "Authentication", ok: true, message: `API key (RULEMETRIC_API_KEY=${apiKey.slice(0, 8)}...)` };
117
+ }
118
+ const envFile = join(homedir(), ".config", "rulemetric", "env");
119
+ if (existsSync(envFile)) {
120
+ const content = readFileSync(envFile, "utf-8");
121
+ if (content.includes("RULEMETRIC_API_KEY") || content.includes("RULEMETRIC_ACCESS_TOKEN")) {
122
+ return { name: "Authentication", ok: true, message: "Configured via ~/.config/rulemetric/env" };
123
+ }
124
+ }
125
+ return {
126
+ name: "Authentication",
127
+ ok: false,
128
+ message: "Not authenticated",
129
+ fix: async () => {
130
+ this.log(" Run `rulemetric auth login` to authenticate.");
131
+ this.log(" Or set RULEMETRIC_API_KEY in ~/.config/rulemetric/env.");
232
132
  return false;
133
+ }
134
+ };
135
+ }
136
+ async checkMitmproxy() {
137
+ const binary = this.findBinary("mitmdump");
138
+ if (binary) {
139
+ try {
140
+ const output = execSync(`${binary} --version 2>&1`, { encoding: "utf-8" });
141
+ const version = output.match(/Mitmproxy:\s*([\d.]+)/)?.[1] ?? "unknown";
142
+ return { name: "mitmproxy", ok: true, message: `Installed (v${version})` };
143
+ } catch {
144
+ return { name: "mitmproxy", ok: true, message: `Found at ${binary}` };
145
+ }
233
146
  }
234
- async checkHooks() {
235
- const settingsPath = join(process.cwd(), '.claude', 'settings.json');
236
- if (!existsSync(settingsPath)) {
237
- return {
238
- name: 'Session Hooks',
239
- ok: false,
240
- message: 'Not installed in current project',
241
- fix: async () => {
242
- this.log(' Run `rulemetric hooks install` in your project directory.');
243
- return false; // User needs to run in the right directory
244
- },
245
- };
246
- }
247
- try {
248
- const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
249
- const hasHooks = settings.hooks && Object.keys(settings.hooks).length > 0;
250
- if (hasHooks) {
251
- return { name: 'Session Hooks', ok: true, message: 'Installed in current project' };
252
- }
253
- }
254
- catch { /* fall through */ }
255
- return {
256
- name: 'Session Hooks',
257
- ok: false,
258
- message: 'settings.json exists but hooks not configured',
259
- fix: async () => {
260
- this.log(' Run `rulemetric hooks install` to configure hooks.');
261
- return false;
262
- },
263
- };
147
+ return {
148
+ name: "mitmproxy",
149
+ ok: false,
150
+ message: "Not installed",
151
+ fix: async () => this.installMitmproxy()
152
+ };
153
+ }
154
+ async installMitmproxy() {
155
+ if (this.findBinary("pipx")) {
156
+ this.log(" Installing via pipx...");
157
+ const result = spawnSync("pipx", ["install", "mitmproxy"], { stdio: "inherit" });
158
+ if (result.status === 0) return true;
264
159
  }
265
- checkShellEnv(port) {
266
- const proxySet = process.env.HTTPS_PROXY?.includes(String(port));
267
- const certSet = !!process.env.NODE_EXTRA_CA_CERTS;
268
- if (proxySet && certSet) {
269
- return { name: 'Shell Environment', ok: true, message: 'HTTPS_PROXY and NODE_EXTRA_CA_CERTS set' };
270
- }
271
- const missing = [];
272
- if (!proxySet)
273
- missing.push('HTTPS_PROXY');
274
- if (!certSet)
275
- missing.push('NODE_EXTRA_CA_CERTS');
276
- return {
277
- name: 'Shell Environment',
278
- ok: false,
279
- message: `Missing: ${missing.join(', ')}`,
280
- fix: async () => this.writeShellEnv(port),
281
- };
160
+ if (this.findBinary("uv")) {
161
+ this.log(" Installing via uv...");
162
+ const result = spawnSync("uv", ["tool", "install", "mitmproxy"], { stdio: "inherit" });
163
+ if (result.status === 0) return true;
282
164
  }
283
- async writeShellEnv(port) {
284
- const shell = this.detectShell();
285
- const rcFile = this.getShellRcFile(shell);
286
- if (!rcFile) {
287
- this.log(` Could not detect shell RC file. Add these to your shell profile:`);
288
- this.log(` export HTTPS_PROXY=http://localhost:${port}`);
289
- this.log(` export NODE_EXTRA_CA_CERTS=${CERT_PATH}`);
290
- return false;
291
- }
292
- const oldMarker = '# RuleMetric proxy';
293
- const marker = '# RuleMetric proxy (auto-detect)';
294
- const envFile = join(CONFIG_DIR, 'proxy.env');
295
- const pidFile = join(CONFIG_DIR, 'proxy.pid');
296
- // Dynamic proxy env: re-evaluates on every prompt so stopping the proxy
297
- // immediately unsets HTTPS_PROXY without needing a new shell.
298
- const block = shell === 'fish'
299
- ? [
300
- '',
301
- marker,
302
- 'function _rulemetric_proxy_check',
303
- ` if test -f ${pidFile}; and kill -0 (cat ${pidFile}) 2>/dev/null`,
304
- ` source ${envFile} 2>/dev/null`,
305
- ' else',
306
- ' set -e HTTPS_PROXY 2>/dev/null',
307
- ' set -e NODE_EXTRA_CA_CERTS 2>/dev/null',
308
- ' end',
309
- 'end',
310
- '',
311
- ].join('\n')
312
- : shell === 'zsh'
313
- ? [
314
- '',
315
- marker,
316
- '_rulemetric_proxy_check() {',
317
- ` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
318
- ` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
319
- ' else',
320
- ` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
321
- ' fi',
322
- '}',
323
- 'precmd_functions+=(_rulemetric_proxy_check)',
324
- '',
325
- ].join('\n')
326
- : [
327
- '',
328
- marker,
329
- '_rulemetric_proxy_check() {',
330
- ` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
331
- ` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
332
- ' else',
333
- ` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
334
- ' fi',
335
- '}',
336
- 'PROMPT_COMMAND="_rulemetric_proxy_check${PROMPT_COMMAND:+;$PROMPT_COMMAND}"',
337
- '',
338
- ].join('\n');
339
- if (existsSync(rcFile)) {
340
- let content = readFileSync(rcFile, 'utf-8');
341
- // Remove old static block if present
342
- if (content.includes(oldMarker) && !content.includes(marker)) {
343
- content = content.replace(/\n# RuleMetric proxy\nexport HTTPS_PROXY=[^\n]*\nexport NODE_EXTRA_CA_CERTS=[^\n]*\n/, '\n');
344
- writeFileSync(rcFile, content);
345
- this.log(` Removed old static env vars from ${rcFile}`);
346
- }
347
- // Remove old auto-detect block (the one without precmd that doesn't unset on stop)
348
- if (content.includes('# RuleMetric proxy (auto-detect') && !content.includes('_rulemetric_proxy_check')) {
349
- content = content.replace(/\n# RuleMetric proxy \(auto-detect[^\n]*\)\nif \[.*?\nfi\n/s, '\n');
350
- writeFileSync(rcFile, content);
351
- this.log(` Upgraded old auto-detect block in ${rcFile}`);
352
- }
353
- if (content.includes('_rulemetric_proxy_check')) {
354
- this.log(` Shell env already configured in ${rcFile}`);
355
- return true;
356
- }
357
- }
358
- this.log(` Appending proxy auto-detect hook to ${rcFile}`);
359
- this.log(` (HTTPS_PROXY is set/unset automatically when proxy starts/stops)`);
360
- appendFileSync(rcFile, block);
361
- return true;
165
+ if (this.findBinary("pip3") || this.findBinary("pip")) {
166
+ const pip = this.findBinary("pip3") || this.findBinary("pip");
167
+ this.log(` Installing via ${pip} --user...`);
168
+ const result = spawnSync(pip, ["install", "--user", "mitmproxy"], { stdio: "inherit" });
169
+ if (result.status === 0) return true;
362
170
  }
363
- detectShell() {
364
- const shell = process.env.SHELL || '';
365
- if (shell.includes('zsh'))
366
- return 'zsh';
367
- if (shell.includes('bash'))
368
- return 'bash';
369
- if (shell.includes('fish'))
370
- return 'fish';
371
- return 'zsh'; // default on macOS
171
+ if (this.findBinary("brew")) {
172
+ this.log(" Installing via brew...");
173
+ const result = spawnSync("brew", ["install", "mitmproxy"], { stdio: "inherit" });
174
+ if (result.status === 0) return true;
372
175
  }
373
- getShellRcFile(shell) {
374
- const home = homedir();
375
- switch (shell) {
376
- case 'zsh': return join(home, '.zshrc');
377
- case 'bash': return join(home, '.bashrc');
378
- case 'fish': return join(home, '.config', 'fish', 'config.fish');
379
- default: return null;
380
- }
176
+ this.log(" Could not auto-install mitmproxy. Install manually:");
177
+ this.log(" pipx install mitmproxy # recommended");
178
+ this.log(" brew install mitmproxy # macOS");
179
+ this.log(" pip install --user mitmproxy");
180
+ return false;
181
+ }
182
+ async checkCACert() {
183
+ if (existsSync(CERT_PATH)) {
184
+ return { name: "CA Certificate", ok: true, message: `Found at ${CERT_PATH}` };
185
+ }
186
+ return {
187
+ name: "CA Certificate",
188
+ ok: false,
189
+ message: "Not generated yet",
190
+ fix: async () => this.generateCACert()
191
+ };
192
+ }
193
+ async generateCACert() {
194
+ const mitmdump = this.findBinary("mitmdump");
195
+ if (!mitmdump) {
196
+ this.log(" Cannot generate cert \u2014 mitmproxy not installed.");
197
+ return false;
381
198
  }
382
- findBinary(name) {
383
- try {
384
- return execSync(`which ${name} 2>/dev/null`, { encoding: 'utf-8' }).trim() || null;
199
+ this.log(" Generating CA certificate...");
200
+ const result = spawnSync(mitmdump, ["--set", "listen_port=0", "-q"], {
201
+ timeout: 5e3,
202
+ stdio: "ignore"
203
+ });
204
+ if (existsSync(CERT_PATH)) {
205
+ this.log(` Certificate generated at ${CERT_PATH}`);
206
+ if (process.platform === "darwin") {
207
+ this.log(" Adding CA cert to macOS keychain (may require sudo)...");
208
+ const trustResult = spawnSync("sudo", [
209
+ "security",
210
+ "add-trusted-cert",
211
+ "-d",
212
+ "-r",
213
+ "trustRoot",
214
+ "-k",
215
+ "/Library/Keychains/System.keychain",
216
+ CERT_PATH
217
+ ], { stdio: "inherit" });
218
+ if (trustResult.status === 0) {
219
+ this.log(" CA cert trusted system-wide.");
220
+ } else {
221
+ this.log(" Could not auto-trust cert. You may need NODE_EXTRA_CA_CERTS env var.");
385
222
  }
386
- catch {
387
- return null;
223
+ }
224
+ return true;
225
+ }
226
+ this.log(" Failed to generate cert. Try running: mitmdump --help");
227
+ return false;
228
+ }
229
+ async checkHooks() {
230
+ const settingsPath = join(process.cwd(), ".claude", "settings.json");
231
+ if (!existsSync(settingsPath)) {
232
+ return {
233
+ name: "Session Hooks",
234
+ ok: false,
235
+ message: "Not installed in current project",
236
+ fix: async () => {
237
+ this.log(" Run `rulemetric hooks install` in your project directory.");
238
+ return false;
388
239
  }
240
+ };
241
+ }
242
+ try {
243
+ const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
244
+ const hasHooks = settings.hooks && Object.keys(settings.hooks).length > 0;
245
+ if (hasHooks) {
246
+ return { name: "Session Hooks", ok: true, message: "Installed in current project" };
247
+ }
248
+ } catch {
249
+ }
250
+ return {
251
+ name: "Session Hooks",
252
+ ok: false,
253
+ message: "settings.json exists but hooks not configured",
254
+ fix: async () => {
255
+ this.log(" Run `rulemetric hooks install` to configure hooks.");
256
+ return false;
257
+ }
258
+ };
259
+ }
260
+ checkShellEnv(port) {
261
+ const proxySet = process.env.HTTPS_PROXY?.includes(String(port));
262
+ const certSet = !!process.env.NODE_EXTRA_CA_CERTS;
263
+ if (proxySet && certSet) {
264
+ return { name: "Shell Environment", ok: true, message: "HTTPS_PROXY and NODE_EXTRA_CA_CERTS set" };
265
+ }
266
+ const missing = [];
267
+ if (!proxySet) missing.push("HTTPS_PROXY");
268
+ if (!certSet) missing.push("NODE_EXTRA_CA_CERTS");
269
+ return {
270
+ name: "Shell Environment",
271
+ ok: false,
272
+ message: `Missing: ${missing.join(", ")}`,
273
+ fix: async () => this.writeShellEnv(port)
274
+ };
275
+ }
276
+ async writeShellEnv(port) {
277
+ const shell = this.detectShell();
278
+ const rcFile = this.getShellRcFile(shell);
279
+ if (!rcFile) {
280
+ this.log(` Could not detect shell RC file. Add these to your shell profile:`);
281
+ this.log(` export HTTPS_PROXY=http://localhost:${port}`);
282
+ this.log(` export NODE_EXTRA_CA_CERTS=${CERT_PATH}`);
283
+ return false;
284
+ }
285
+ const oldMarker = "# RuleMetric proxy";
286
+ const marker = "# RuleMetric proxy (auto-detect)";
287
+ const envFile = join(CONFIG_DIR, "proxy.env");
288
+ const pidFile = join(CONFIG_DIR, "proxy.pid");
289
+ const sentinel = shell === "powershell" ? "_RuleMetricProxyCheck" : "_rulemetric_proxy_check";
290
+ const block = shell === "powershell" ? this.buildPowerShellBlock(marker, pidFile, port) : shell === "fish" ? [
291
+ "",
292
+ marker,
293
+ "function _rulemetric_proxy_check",
294
+ ` if test -f ${pidFile}; and kill -0 (cat ${pidFile}) 2>/dev/null`,
295
+ ` source ${envFile} 2>/dev/null`,
296
+ " else",
297
+ " set -e HTTPS_PROXY 2>/dev/null",
298
+ " set -e NODE_EXTRA_CA_CERTS 2>/dev/null",
299
+ " end",
300
+ "end",
301
+ ""
302
+ ].join("\n") : shell === "zsh" ? [
303
+ "",
304
+ marker,
305
+ "_rulemetric_proxy_check() {",
306
+ ` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
307
+ ` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
308
+ " else",
309
+ ` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
310
+ " fi",
311
+ "}",
312
+ "precmd_functions+=(_rulemetric_proxy_check)",
313
+ ""
314
+ ].join("\n") : [
315
+ "",
316
+ marker,
317
+ "_rulemetric_proxy_check() {",
318
+ ` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
319
+ ` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
320
+ " else",
321
+ ` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
322
+ " fi",
323
+ "}",
324
+ 'PROMPT_COMMAND="_rulemetric_proxy_check${PROMPT_COMMAND:+;$PROMPT_COMMAND}"',
325
+ ""
326
+ ].join("\n");
327
+ mkdirSync(dirname(rcFile), { recursive: true });
328
+ if (existsSync(rcFile)) {
329
+ let content = readFileSync(rcFile, "utf-8");
330
+ if (content.includes(oldMarker) && !content.includes(marker)) {
331
+ content = content.replace(
332
+ /\n# RuleMetric proxy\nexport HTTPS_PROXY=[^\n]*\nexport NODE_EXTRA_CA_CERTS=[^\n]*\n/,
333
+ "\n"
334
+ );
335
+ writeFileSync(rcFile, content);
336
+ this.log(` Removed old static env vars from ${rcFile}`);
337
+ }
338
+ if (content.includes("# RuleMetric proxy (auto-detect") && !content.includes("_rulemetric_proxy_check")) {
339
+ content = content.replace(
340
+ /\n# RuleMetric proxy \(auto-detect[^\n]*\)\nif \[.*?\nfi\n/s,
341
+ "\n"
342
+ );
343
+ writeFileSync(rcFile, content);
344
+ this.log(` Upgraded old auto-detect block in ${rcFile}`);
345
+ }
346
+ if (content.includes(sentinel)) {
347
+ this.log(` Shell env already configured in ${rcFile}`);
348
+ return true;
349
+ }
350
+ }
351
+ this.log(` Appending proxy auto-detect hook to ${rcFile}`);
352
+ this.log(` (HTTPS_PROXY is set/unset automatically when proxy starts/stops)`);
353
+ appendFileSync(rcFile, block);
354
+ return true;
355
+ }
356
+ detectShell() {
357
+ if (process.platform === "win32") return "powershell";
358
+ const shell = process.env.SHELL || "";
359
+ if (shell.includes("zsh")) return "zsh";
360
+ if (shell.includes("bash")) return "bash";
361
+ if (shell.includes("fish")) return "fish";
362
+ return "zsh";
363
+ }
364
+ getShellRcFile(shell) {
365
+ const home = homedir();
366
+ switch (shell) {
367
+ case "zsh":
368
+ return join(home, ".zshrc");
369
+ case "bash":
370
+ return join(home, ".bashrc");
371
+ case "fish":
372
+ return join(home, ".config", "fish", "config.fish");
373
+ case "powershell":
374
+ return this.getPowerShellProfilePath();
375
+ default:
376
+ return null;
377
+ }
378
+ }
379
+ /**
380
+ * Resolve the PowerShell profile that loads for every host (console, VS Code
381
+ * integrated terminal, etc.). We ask PowerShell itself for the canonical path
382
+ * — guessing `~/Documents/...` is wrong when Documents is OneDrive-redirected.
383
+ * Falls back to the PowerShell 7 default only if no PS binary is reachable.
384
+ */
385
+ getPowerShellProfilePath() {
386
+ const psBin = findBinary("pwsh") || findBinary("powershell");
387
+ if (psBin) {
388
+ try {
389
+ const out = execSync(`"${psBin}" -NoProfile -Command "$PROFILE.CurrentUserAllHosts"`, {
390
+ encoding: "utf-8"
391
+ }).trim();
392
+ if (out) return out;
393
+ } catch {
394
+ }
389
395
  }
390
- }
391
- //# sourceMappingURL=setup.js.map
396
+ return join(homedir(), "Documents", "PowerShell", "profile.ps1");
397
+ }
398
+ /**
399
+ * Self-contained PowerShell prompt hook. Unlike the POSIX blocks it does NOT
400
+ * source `proxy.env` (that file is `export KEY=val` syntax PowerShell can't
401
+ * read) — it embeds the values directly. Each prompt it sets HTTPS_PROXY while
402
+ * the proxy PID is alive and removes the vars once it stops, so a dead proxy
403
+ * never leaves a dangling HTTPS_PROXY that would break Claude Code.
404
+ */
405
+ buildPowerShellBlock(marker, pidFile, port) {
406
+ const proxyUrl = `http://localhost:${port}`;
407
+ const psPid = pidFile.replace(/'/g, "''");
408
+ const psCert = CERT_PATH.replace(/'/g, "''");
409
+ return [
410
+ "",
411
+ marker,
412
+ "function _RuleMetricProxyCheck {",
413
+ ` $pidFile = '${psPid}'`,
414
+ " $alive = $false",
415
+ " if (Test-Path $pidFile) {",
416
+ " $procId = (Get-Content $pidFile -ErrorAction SilentlyContinue | Select-Object -First 1)",
417
+ " if ($procId -match '^\\d+$' -and (Get-Process -Id ([int]$procId) -ErrorAction SilentlyContinue)) {",
418
+ " $alive = $true",
419
+ " }",
420
+ " }",
421
+ " if ($alive) {",
422
+ ` $env:HTTPS_PROXY = '${proxyUrl}'`,
423
+ ` $env:HTTP_PROXY = '${proxyUrl}'`,
424
+ ` $env:NODE_EXTRA_CA_CERTS = '${psCert}'`,
425
+ " } else {",
426
+ " Remove-Item Env:HTTPS_PROXY, Env:HTTP_PROXY, Env:NODE_EXTRA_CA_CERTS -ErrorAction SilentlyContinue",
427
+ " }",
428
+ "}",
429
+ "# Wrap the existing prompt once so the check runs every prompt.",
430
+ "if (-not (Test-Path Function:\\_RuleMetricOriginalPrompt)) {",
431
+ " $existing = Get-Command prompt -ErrorAction SilentlyContinue",
432
+ " if ($existing) { Set-Item Function:\\_RuleMetricOriginalPrompt $existing.ScriptBlock }",
433
+ "}",
434
+ "function prompt {",
435
+ " _RuleMetricProxyCheck",
436
+ ' if (Test-Path Function:\\_RuleMetricOriginalPrompt) { & _RuleMetricOriginalPrompt } else { "PS $($PWD.Path)> " }',
437
+ "}",
438
+ ""
439
+ ].join("\n");
440
+ }
441
+ findBinary(name) {
442
+ return findBinary(name);
443
+ }
444
+ };
445
+ export {
446
+ ProxySetup as default
447
+ };
448
+ //# sourceMappingURL=setup.js.map