@rulemetric/cli 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +1 -14
- package/dist/chunk-2TC6WCUT.js +34 -0
- package/dist/chunk-2UC3ULIG.js +1 -0
- package/dist/chunk-3AV3GTMP.js +1 -0
- package/dist/chunk-4Z5ECCJE.js +1 -0
- package/dist/chunk-5RBLIVBF.js +1 -0
- package/dist/chunk-67QCYUJU.js +1 -0
- package/dist/chunk-6QKI756T.js +2 -0
- package/dist/chunk-6V4WM73L.js +1 -0
- package/dist/chunk-6XEC6474.js +1 -0
- package/dist/chunk-72XLQE3X.js +2 -0
- package/dist/chunk-7DFNBRLY.js +61 -0
- package/dist/chunk-7XQ4VPLC.js +2 -0
- package/dist/chunk-AHRHCERJ.js +1 -0
- package/dist/chunk-ARNZQBMX.js +1 -0
- package/dist/chunk-CADKBP3D.js +58 -0
- package/dist/chunk-CDI5CCHU.js +1 -0
- package/dist/chunk-CNQ5DTNC.js +1 -0
- package/dist/chunk-CRAKDQ4H.js +1 -0
- package/dist/chunk-DNF4HDI6.js +14 -0
- package/dist/chunk-DSO2U4Y6.js +56 -0
- package/dist/chunk-DT4GKEP5.js +5 -0
- package/dist/chunk-DVN7GFJG.js +1 -0
- package/dist/chunk-E4SFUPYR.js +15 -0
- package/dist/chunk-EUHNCVJQ.js +33 -0
- package/dist/chunk-F2VP4B4J.js +1 -0
- package/dist/chunk-FEHM5OKW.js +1 -0
- package/dist/chunk-FHVBTDBM.js +69 -0
- package/dist/chunk-GBMF3TP6.js +1 -0
- package/dist/chunk-GY5IJ4RS.js +1 -0
- package/dist/chunk-HOHD5HY2.js +5 -0
- package/dist/chunk-HP2BUPGS.js +24 -0
- package/dist/{chunk-OQBBVTDG.js → chunk-I2DZGJRR.js} +6 -71
- package/dist/chunk-I4YJ7NTX.js +1 -0
- package/dist/chunk-IY5NXR3N.js +1 -0
- package/dist/chunk-IZTIYR5Q.js +2 -0
- package/dist/chunk-KKDHD4XA.js +2 -0
- package/dist/chunk-LQRYQE6Q.js +4 -0
- package/dist/chunk-M6AJDVCL.js +5 -0
- package/dist/chunk-MGHFDHHM.js +1 -0
- package/dist/chunk-ML36XQW7.js +1 -0
- package/dist/chunk-MODXEGCU.js +1 -0
- package/dist/chunk-MVM6OGAF.js +4 -0
- package/dist/chunk-N7ODX6PO.js +1 -0
- package/dist/chunk-NBTC5FNV.js +1 -0
- package/dist/chunk-NJ5UED3H.js +1 -0
- package/dist/chunk-NVKX36YN.js +3 -0
- package/dist/chunk-NVOTOQBA.js +1 -0
- package/dist/chunk-O7ZMHCMG.js +31 -0
- package/dist/chunk-OMXUK4M6.js +1 -0
- package/dist/chunk-PZS2KOU7.js +1 -0
- package/dist/chunk-RSKQRVPJ.js +1 -0
- package/dist/chunk-RTEATXTP.js +1 -0
- package/dist/chunk-RTWRHIKY.js +7 -0
- package/dist/chunk-RVO4HV3M.js +1 -0
- package/dist/chunk-SBILN45P.js +1 -0
- package/dist/chunk-SZ62CP55.js +1 -0
- package/dist/chunk-T3W5N3BP.js +2 -0
- package/dist/chunk-TDD7IOV2.js +1 -0
- package/dist/chunk-TIQ7DQ3M.js +1 -0
- package/dist/chunk-TU2AR6XO.js +1 -0
- package/dist/chunk-UF6US7VU.js +1 -0
- package/dist/chunk-V5QFOF4F.js +9 -0
- package/dist/chunk-V5U3E4BZ.js +1 -0
- package/dist/chunk-VAFAH6QL.js +1 -0
- package/dist/chunk-VMWY7KHH.js +1 -0
- package/dist/chunk-VUGRXM7R.js +1 -0
- package/dist/{chunk-XZXS2W24.js → chunk-VWEXKDWG.js} +10 -56
- package/dist/chunk-W2MV25SB.js +1 -0
- package/dist/chunk-WJ3H73G6.js +1 -0
- package/dist/chunk-WJUQBMTF.js +9 -0
- package/dist/chunk-WLVQJH4E.js +1 -0
- package/dist/chunk-WPJ2BND4.js +1 -0
- package/dist/chunk-WSCK4WNK.js +1 -0
- package/dist/chunk-Y65CSJFF.js +3 -0
- package/dist/chunk-ZL4MZMUK.js +34 -0
- package/dist/chunk-ZLLER3HP.js +1 -0
- package/dist/chunk-ZXF5NE54.js +1 -0
- package/dist/commands/antigravity/backfill.js +2 -136
- package/dist/commands/auth/create-key.js +1 -52
- package/dist/commands/auth/login.js +1 -85
- package/dist/commands/auth/logout.js +1 -29
- package/dist/commands/auth/revoke-key.js +1 -33
- package/dist/commands/auth/signup.js +1 -89
- package/dist/commands/auth/status.js +1 -42
- package/dist/commands/catalog/index.js +2 -52
- package/dist/commands/catalog/recommend.js +3 -43
- package/dist/commands/convert.js +1 -75
- package/dist/commands/converters.js +1 -54
- package/dist/commands/crons/list.js +1 -41
- package/dist/commands/crons/run.js +2 -76
- package/dist/commands/dashboard.js +1 -46
- package/dist/commands/diagnostics.js +1 -117
- package/dist/commands/eval-targets/create.js +1 -53
- package/dist/commands/eval-targets/list.js +1 -54
- package/dist/commands/evals/agent.js +3 -310
- package/dist/commands/evals/benchmark.js +6 -73
- package/dist/commands/evals/compare.js +13 -96
- package/dist/commands/evals/create.js +1 -67
- package/dist/commands/evals/optimize-description.js +25 -239
- package/dist/commands/evals/optimize.js +5 -211
- package/dist/commands/evals/run.js +3 -183
- package/dist/commands/gateway/ensure.js +1 -104
- package/dist/commands/hooks/emit-instructions.js +1 -25
- package/dist/commands/hooks/install.js +1 -442
- package/dist/commands/hooks/run.js +3 -81
- package/dist/commands/hooks/uninstall.js +2 -156
- package/dist/commands/import.js +1 -66
- package/dist/commands/instructions/create.js +1 -74
- package/dist/commands/instructions/delete.js +1 -55
- package/dist/commands/instructions/fork.js +1 -34
- package/dist/commands/instructions/get.js +1 -68
- package/dist/commands/instructions/list.js +1 -65
- package/dist/commands/instructions/promote.js +1 -42
- package/dist/commands/instructions/pull.js +1 -39
- package/dist/commands/instructions/upstream.js +1 -38
- package/dist/commands/instructions/versions.js +1 -53
- package/dist/commands/launcher.js +1 -40
- package/dist/commands/org/current.js +1 -77
- package/dist/commands/org/list.js +1 -52
- package/dist/commands/org/switch.js +1 -71
- package/dist/commands/packs/add-instruction.js +1 -37
- package/dist/commands/packs/apply.js +1 -39
- package/dist/commands/packs/create.js +1 -50
- package/dist/commands/packs/fork.js +1 -34
- package/dist/commands/packs/get.js +3 -56
- package/dist/commands/packs/list.js +1 -66
- package/dist/commands/packs/remove-instruction.js +1 -35
- package/dist/commands/proxy/env.js +3 -131
- package/dist/commands/proxy/logs.js +3 -85
- package/dist/commands/proxy/restart.js +1 -35
- package/dist/commands/proxy/setup.js +15 -454
- package/dist/commands/proxy/start.js +10 -333
- package/dist/commands/proxy/status.js +1 -78
- package/dist/commands/proxy/stop.js +1 -94
- package/dist/commands/research/backfill.js +1 -59
- package/dist/commands/research/tail-transcript.js +1 -70
- package/dist/commands/service/install.js +57 -796
- package/dist/commands/service/status.js +1 -180
- package/dist/commands/service/uninstall.js +1 -119
- package/dist/commands/sessions/analyze.js +3 -48
- package/dist/commands/sessions/end.js +2 -85
- package/dist/commands/sessions/import.js +1 -46
- package/dist/commands/sessions/list.js +1 -48
- package/dist/commands/sessions/start.js +3 -90
- package/dist/commands/setup.js +3 -150
- package/dist/commands/skills/export-approved.js +1 -46
- package/dist/commands/skills/install.js +4 -107
- package/dist/commands/skills/list.js +4 -65
- package/dist/commands/skills/publish.js +2 -98
- package/dist/commands/skills/search.js +3 -72
- package/dist/commands/skills/update.js +3 -55
- package/dist/commands/suggestions/accept.js +8 -84
- package/dist/commands/suggestions/dismiss.js +1 -45
- package/dist/commands/suggestions/list.js +1 -61
- package/dist/commands/suggestions/refresh.js +1 -27
- package/dist/cursor-T7AMCMKS.js +13 -0
- package/dist/dashboard/Dashboard.js +1 -243
- package/dist/dashboard/data.js +1 -15
- package/dist/dashboard/launcher/ActiveJobsList.js +1 -10
- package/dist/dashboard/launcher/LauncherOverlay.js +1 -16
- package/dist/dashboard/launcher/NewLaunchForm.js +1 -10
- package/dist/dashboard/launcher/api.js +1 -16
- package/dist/dashboard/launcher/tool-labels.js +1 -10
- package/dist/dashboard/launcher/types.js +0 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +1 -11
- package/dist/dashboard/panels/friction.js +1 -10
- package/dist/dashboard/panels/insights.js +1 -10
- package/dist/dashboard/panels/instructions.js +1 -10
- package/dist/dashboard/panels/outcomes.js +1 -10
- package/dist/dashboard/panels/overview.js +1 -10
- package/dist/dashboard/panels/shared.js +1 -19
- package/dist/dashboard/types.js +1 -24
- package/dist/dist-FAVALJ5C.js +1 -0
- package/dist/index.js +1 -8
- package/dist/lib/active-org-refresh.js +1 -15
- package/dist/lib/active-org.js +1 -16
- package/dist/lib/agent-loop.js +1 -47
- package/dist/lib/antigravity-transcript.js +1 -22
- package/dist/lib/api-client.js +1 -23
- package/dist/lib/auth.js +1 -30
- package/dist/lib/capture-hosts.js +1 -8
- package/dist/lib/detect-languages.js +1 -8
- package/dist/lib/detect-tmux.js +1 -9
- package/dist/lib/diagnostics.js +1 -12
- package/dist/lib/editor-proxy-pins.js +1 -14
- package/dist/lib/ensure-api-key.js +1 -11
- package/dist/lib/eval-analyzer.js +1 -9
- package/dist/lib/eval-benchmark.js +1 -12
- package/dist/lib/eval-conversation-handler.js +1 -13
- package/dist/lib/eval-executor.js +1 -8
- package/dist/lib/eval-grader.js +1 -9
- package/dist/lib/eval-meta-judge.js +1 -9
- package/dist/lib/eval-trigger-tester.js +1 -11
- package/dist/lib/eval-worktree.js +1 -8
- package/dist/lib/gateway-entry.js +1 -61
- package/dist/lib/gateway-identity.js +1 -16
- package/dist/lib/gateway-lifecycle.js +1 -32
- package/dist/lib/gateway.js +1 -14
- package/dist/lib/handlers/cron-refresh-pricing.js +1 -0
- package/dist/lib/handlers/cron-refresh-skills.js +1 -8
- package/dist/lib/handlers/cron-suggest-instructions.js +1 -16
- package/dist/lib/handlers/process-announcement.js +1 -11
- package/dist/lib/handlers/process-changelog.js +1 -11
- package/dist/lib/handlers/process-conversation.js +1 -14
- package/dist/lib/handlers/process-eval.js +1 -15
- package/dist/lib/handlers/process-insights.js +1 -15
- package/dist/lib/handlers/process-launch.js +1 -16
- package/dist/lib/handlers/process-run-cleanup.js +1 -13
- package/dist/lib/handlers/process-send-message.js +1 -10
- package/dist/lib/handlers/process-session-goal.js +1 -12
- package/dist/lib/hooks-config.js +1 -81
- package/dist/lib/insights-prompts.js +1 -12
- package/dist/lib/instruction-snapshot.js +1 -8
- package/dist/lib/job-helpers.js +0 -1
- package/dist/lib/llm-client.js +1 -20
- package/dist/lib/manual-tasks-meta.js +1 -8
- package/dist/lib/manual-tasks.js +1 -80
- package/dist/lib/output.js +1 -12
- package/dist/lib/permanent-job-error.js +1 -10
- package/dist/lib/pid-identity.js +1 -14
- package/dist/lib/proxy-respawn.js +1 -12
- package/dist/lib/research-client.js +1 -12
- package/dist/lib/setup-steps.js +1 -33
- package/dist/lib/skills-loader.js +1 -8
- package/dist/lib/statusline-shim.js +1 -20
- package/dist/lib/telemetry.js +1 -16
- package/dist/lib/terminal-target-heartbeat.js +1 -15
- package/dist/lib/tmux.js +1 -16
- package/dist/lib/transcript-rate-limit-watcher.js +1 -22
- package/dist/lib/types.js +1 -8
- package/dist/lib/version-check.js +1 -12
- package/dist/lib/which.js +1 -8
- package/dist/lib/worktree.js +1 -17
- package/dist/opencode-QRJ3BH23.js +1 -0
- package/oclif.manifest.json +135 -135
- package/package.json +9 -8
- package/dist/base-command.js.map +0 -7
- package/dist/chunk-2HK7RGZB.js +0 -82
- package/dist/chunk-2HK7RGZB.js.map +0 -7
- package/dist/chunk-2ORJWTNZ.js +0 -307
- package/dist/chunk-2ORJWTNZ.js.map +0 -7
- package/dist/chunk-37LN5O7M.js +0 -59
- package/dist/chunk-37LN5O7M.js.map +0 -7
- package/dist/chunk-3S7223UR.js +0 -81
- package/dist/chunk-3S7223UR.js.map +0 -7
- package/dist/chunk-3TIMQ3O6.js +0 -96
- package/dist/chunk-3TIMQ3O6.js.map +0 -7
- package/dist/chunk-42GFSAJP.js +0 -32
- package/dist/chunk-42GFSAJP.js.map +0 -7
- package/dist/chunk-4BHDHHKL.js +0 -48
- package/dist/chunk-4BHDHHKL.js.map +0 -7
- package/dist/chunk-4D537GXE.js +0 -99
- package/dist/chunk-4D537GXE.js.map +0 -7
- package/dist/chunk-4LYCDS2N.js +0 -139
- package/dist/chunk-4LYCDS2N.js.map +0 -7
- package/dist/chunk-4SCZK7AL.js +0 -129
- package/dist/chunk-4SCZK7AL.js.map +0 -7
- package/dist/chunk-4XAWK6S2.js +0 -161
- package/dist/chunk-4XAWK6S2.js.map +0 -7
- package/dist/chunk-52WIYRZH.js +0 -73
- package/dist/chunk-52WIYRZH.js.map +0 -7
- package/dist/chunk-5BAOGNUH.js +0 -79
- package/dist/chunk-5BAOGNUH.js.map +0 -7
- package/dist/chunk-5EDMGK3W.js +0 -39
- package/dist/chunk-5EDMGK3W.js.map +0 -7
- package/dist/chunk-6NBS5XFS.js +0 -99
- package/dist/chunk-6NBS5XFS.js.map +0 -7
- package/dist/chunk-7LVVKQMZ.js +0 -98
- package/dist/chunk-7LVVKQMZ.js.map +0 -7
- package/dist/chunk-7NNFYWKK.js +0 -243
- package/dist/chunk-7NNFYWKK.js.map +0 -7
- package/dist/chunk-7NYKWN7U.js +0 -12
- package/dist/chunk-7NYKWN7U.js.map +0 -7
- package/dist/chunk-BO76WKJR.js +0 -42
- package/dist/chunk-BO76WKJR.js.map +0 -7
- package/dist/chunk-BRD5RUGM.js +0 -53
- package/dist/chunk-BRD5RUGM.js.map +0 -7
- package/dist/chunk-BT6Z6545.js +0 -43
- package/dist/chunk-BT6Z6545.js.map +0 -7
- package/dist/chunk-BZDKEQKU.js +0 -39
- package/dist/chunk-BZDKEQKU.js.map +0 -7
- package/dist/chunk-DGHWRQXL.js +0 -17
- package/dist/chunk-DGHWRQXL.js.map +0 -7
- package/dist/chunk-DIQUV5FR.js +0 -257
- package/dist/chunk-DIQUV5FR.js.map +0 -7
- package/dist/chunk-DMX5YOTM.js +0 -167
- package/dist/chunk-DMX5YOTM.js.map +0 -7
- package/dist/chunk-DNKSVWMD.js +0 -108
- package/dist/chunk-DNKSVWMD.js.map +0 -7
- package/dist/chunk-DQ3KELXD.js +0 -74
- package/dist/chunk-DQ3KELXD.js.map +0 -7
- package/dist/chunk-DUJSRBLP.js +0 -122
- package/dist/chunk-DUJSRBLP.js.map +0 -7
- package/dist/chunk-E3BIT53W.js +0 -154
- package/dist/chunk-E3BIT53W.js.map +0 -7
- package/dist/chunk-EARWG4EV.js +0 -22
- package/dist/chunk-EARWG4EV.js.map +0 -7
- package/dist/chunk-EI5BHWXA.js +0 -1662
- package/dist/chunk-EI5BHWXA.js.map +0 -7
- package/dist/chunk-EJ3YAFDP.js +0 -37
- package/dist/chunk-EJ3YAFDP.js.map +0 -7
- package/dist/chunk-EKJ2CABV.js +0 -76
- package/dist/chunk-EKJ2CABV.js.map +0 -7
- package/dist/chunk-EKP32DLN.js +0 -16
- package/dist/chunk-EKP32DLN.js.map +0 -7
- package/dist/chunk-EYPAAGN5.js +0 -51
- package/dist/chunk-EYPAAGN5.js.map +0 -7
- package/dist/chunk-F5N6CLJJ.js +0 -1995
- package/dist/chunk-F5N6CLJJ.js.map +0 -7
- package/dist/chunk-GIUBARWS.js +0 -99
- package/dist/chunk-GIUBARWS.js.map +0 -7
- package/dist/chunk-GQNJO2P2.js +0 -102
- package/dist/chunk-GQNJO2P2.js.map +0 -7
- package/dist/chunk-IJGF2ETG.js +0 -68
- package/dist/chunk-IJGF2ETG.js.map +0 -7
- package/dist/chunk-ILYDELUE.js +0 -46
- package/dist/chunk-ILYDELUE.js.map +0 -7
- package/dist/chunk-J6QFW4LD.js +0 -55
- package/dist/chunk-J6QFW4LD.js.map +0 -7
- package/dist/chunk-J7N3DLH6.js +0 -117
- package/dist/chunk-J7N3DLH6.js.map +0 -7
- package/dist/chunk-JFDWKLQC.js +0 -23
- package/dist/chunk-JFDWKLQC.js.map +0 -7
- package/dist/chunk-JULOLTZS.js +0 -61
- package/dist/chunk-JULOLTZS.js.map +0 -7
- package/dist/chunk-KJKBDQ4D.js +0 -220
- package/dist/chunk-KJKBDQ4D.js.map +0 -7
- package/dist/chunk-KRBQLMOP.js +0 -41
- package/dist/chunk-KRBQLMOP.js.map +0 -7
- package/dist/chunk-LXKPNATC.js +0 -624
- package/dist/chunk-LXKPNATC.js.map +0 -7
- package/dist/chunk-NSBPE2FW.js +0 -17
- package/dist/chunk-NSBPE2FW.js.map +0 -7
- package/dist/chunk-OCKHW72U.js +0 -55
- package/dist/chunk-OCKHW72U.js.map +0 -7
- package/dist/chunk-OKWCKCPE.js +0 -414
- package/dist/chunk-OKWCKCPE.js.map +0 -7
- package/dist/chunk-OO7JDFS4.js +0 -157
- package/dist/chunk-OO7JDFS4.js.map +0 -7
- package/dist/chunk-OQBBVTDG.js.map +0 -7
- package/dist/chunk-OQSQC7VB.js +0 -77
- package/dist/chunk-OQSQC7VB.js.map +0 -7
- package/dist/chunk-PED7L5GX.js +0 -92
- package/dist/chunk-PED7L5GX.js.map +0 -7
- package/dist/chunk-QJQS6TUN.js +0 -44
- package/dist/chunk-QJQS6TUN.js.map +0 -7
- package/dist/chunk-QN34TGD3.js +0 -83
- package/dist/chunk-QN34TGD3.js.map +0 -7
- package/dist/chunk-QSN77T7C.js +0 -250
- package/dist/chunk-QSN77T7C.js.map +0 -7
- package/dist/chunk-R56PH7YE.js +0 -78
- package/dist/chunk-R56PH7YE.js.map +0 -7
- package/dist/chunk-RAXRZYOB.js +0 -299
- package/dist/chunk-RAXRZYOB.js.map +0 -7
- package/dist/chunk-RH7NHVSK.js +0 -16
- package/dist/chunk-RH7NHVSK.js.map +0 -7
- package/dist/chunk-RMTT4KDY.js +0 -191
- package/dist/chunk-RMTT4KDY.js.map +0 -7
- package/dist/chunk-RQ2TMLKG.js +0 -142
- package/dist/chunk-RQ2TMLKG.js.map +0 -7
- package/dist/chunk-SO3T35U7.js +0 -80
- package/dist/chunk-SO3T35U7.js.map +0 -7
- package/dist/chunk-UKMLICWS.js +0 -51
- package/dist/chunk-UKMLICWS.js.map +0 -7
- package/dist/chunk-VA5FFOS7.js +0 -243
- package/dist/chunk-VA5FFOS7.js.map +0 -7
- package/dist/chunk-W2YERO7E.js +0 -170
- package/dist/chunk-W2YERO7E.js.map +0 -7
- package/dist/chunk-W53GKIZQ.js +0 -50
- package/dist/chunk-W53GKIZQ.js.map +0 -7
- package/dist/chunk-WA4MWYRW.js +0 -254
- package/dist/chunk-WA4MWYRW.js.map +0 -7
- package/dist/chunk-XC6M4CSW.js +0 -44
- package/dist/chunk-XC6M4CSW.js.map +0 -7
- package/dist/chunk-XK42ZBDE.js +0 -23
- package/dist/chunk-XK42ZBDE.js.map +0 -7
- package/dist/chunk-XUV6DDBF.js +0 -124
- package/dist/chunk-XUV6DDBF.js.map +0 -7
- package/dist/chunk-XZXS2W24.js.map +0 -7
- package/dist/chunk-Y3WD5CSW.js +0 -49
- package/dist/chunk-Y3WD5CSW.js.map +0 -7
- package/dist/chunk-Y4BJXXYV.js +0 -148
- package/dist/chunk-Y4BJXXYV.js.map +0 -7
- package/dist/chunk-YNIH3KMU.js +0 -121
- package/dist/chunk-YNIH3KMU.js.map +0 -7
- package/dist/chunk-ZUJBM6HE.js +0 -125
- package/dist/chunk-ZUJBM6HE.js.map +0 -7
- package/dist/commands/antigravity/backfill.js.map +0 -7
- package/dist/commands/auth/create-key.js.map +0 -7
- package/dist/commands/auth/login.js.map +0 -7
- package/dist/commands/auth/logout.js.map +0 -7
- package/dist/commands/auth/revoke-key.js.map +0 -7
- package/dist/commands/auth/signup.js.map +0 -7
- package/dist/commands/auth/status.js.map +0 -7
- package/dist/commands/catalog/index.js.map +0 -7
- package/dist/commands/catalog/recommend.js.map +0 -7
- package/dist/commands/convert.js.map +0 -7
- package/dist/commands/converters.js.map +0 -7
- package/dist/commands/crons/list.js.map +0 -7
- package/dist/commands/crons/run.js.map +0 -7
- package/dist/commands/dashboard.js.map +0 -7
- package/dist/commands/diagnostics.js.map +0 -7
- package/dist/commands/eval-targets/create.js.map +0 -7
- package/dist/commands/eval-targets/list.js.map +0 -7
- package/dist/commands/evals/agent.js.map +0 -7
- package/dist/commands/evals/benchmark.js.map +0 -7
- package/dist/commands/evals/compare.js.map +0 -7
- package/dist/commands/evals/create.js.map +0 -7
- package/dist/commands/evals/optimize-description.js.map +0 -7
- package/dist/commands/evals/optimize.js.map +0 -7
- package/dist/commands/evals/run.js.map +0 -7
- package/dist/commands/gateway/ensure.js.map +0 -7
- package/dist/commands/hooks/emit-instructions.js.map +0 -7
- package/dist/commands/hooks/install.js.map +0 -7
- package/dist/commands/hooks/run.js.map +0 -7
- package/dist/commands/hooks/uninstall.js.map +0 -7
- package/dist/commands/import.js.map +0 -7
- package/dist/commands/instructions/create.js.map +0 -7
- package/dist/commands/instructions/delete.js.map +0 -7
- package/dist/commands/instructions/fork.js.map +0 -7
- package/dist/commands/instructions/get.js.map +0 -7
- package/dist/commands/instructions/list.js.map +0 -7
- package/dist/commands/instructions/promote.js.map +0 -7
- package/dist/commands/instructions/pull.js.map +0 -7
- package/dist/commands/instructions/upstream.js.map +0 -7
- package/dist/commands/instructions/versions.js.map +0 -7
- package/dist/commands/launcher.js.map +0 -7
- package/dist/commands/org/current.js.map +0 -7
- package/dist/commands/org/list.js.map +0 -7
- package/dist/commands/org/switch.js.map +0 -7
- package/dist/commands/packs/add-instruction.js.map +0 -7
- package/dist/commands/packs/apply.js.map +0 -7
- package/dist/commands/packs/create.js.map +0 -7
- package/dist/commands/packs/fork.js.map +0 -7
- package/dist/commands/packs/get.js.map +0 -7
- package/dist/commands/packs/list.js.map +0 -7
- package/dist/commands/packs/remove-instruction.js.map +0 -7
- package/dist/commands/proxy/env.js.map +0 -7
- package/dist/commands/proxy/logs.js.map +0 -7
- package/dist/commands/proxy/restart.js.map +0 -7
- package/dist/commands/proxy/setup.js.map +0 -7
- package/dist/commands/proxy/start.js.map +0 -7
- package/dist/commands/proxy/status.js.map +0 -7
- package/dist/commands/proxy/stop.js.map +0 -7
- package/dist/commands/research/backfill.js.map +0 -7
- package/dist/commands/research/tail-transcript.js.map +0 -7
- package/dist/commands/service/install.js.map +0 -7
- package/dist/commands/service/status.js.map +0 -7
- package/dist/commands/service/uninstall.js.map +0 -7
- package/dist/commands/sessions/analyze.js.map +0 -7
- package/dist/commands/sessions/end.js.map +0 -7
- package/dist/commands/sessions/import.js.map +0 -7
- package/dist/commands/sessions/list.js.map +0 -7
- package/dist/commands/sessions/start.js.map +0 -7
- package/dist/commands/setup.js.map +0 -7
- package/dist/commands/skills/export-approved.js.map +0 -7
- package/dist/commands/skills/install.js.map +0 -7
- package/dist/commands/skills/list.js.map +0 -7
- package/dist/commands/skills/publish.js.map +0 -7
- package/dist/commands/skills/search.js.map +0 -7
- package/dist/commands/skills/update.js.map +0 -7
- package/dist/commands/suggestions/accept.js.map +0 -7
- package/dist/commands/suggestions/dismiss.js.map +0 -7
- package/dist/commands/suggestions/list.js.map +0 -7
- package/dist/commands/suggestions/refresh.js.map +0 -7
- package/dist/cursor-BGQJ4CWI.js +0 -134
- package/dist/cursor-BGQJ4CWI.js.map +0 -7
- package/dist/dashboard/Dashboard.js.map +0 -7
- package/dist/dashboard/data.js.map +0 -7
- package/dist/dashboard/launcher/ActiveJobsList.js.map +0 -7
- package/dist/dashboard/launcher/LauncherOverlay.js.map +0 -7
- package/dist/dashboard/launcher/NewLaunchForm.js.map +0 -7
- package/dist/dashboard/launcher/api.js.map +0 -7
- package/dist/dashboard/launcher/tool-labels.js.map +0 -7
- package/dist/dashboard/launcher/types.js.map +0 -7
- package/dist/dashboard/launcher/useLaunchJobs.js.map +0 -7
- package/dist/dashboard/panels/friction.js.map +0 -7
- package/dist/dashboard/panels/insights.js.map +0 -7
- package/dist/dashboard/panels/instructions.js.map +0 -7
- package/dist/dashboard/panels/outcomes.js.map +0 -7
- package/dist/dashboard/panels/overview.js.map +0 -7
- package/dist/dashboard/panels/shared.js.map +0 -7
- package/dist/dashboard/types.js.map +0 -7
- package/dist/dist-UNYP5PJR.js +0 -56
- package/dist/dist-UNYP5PJR.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/lib/active-org-refresh.js.map +0 -7
- package/dist/lib/active-org.js.map +0 -7
- package/dist/lib/agent-loop.js.map +0 -7
- package/dist/lib/antigravity-transcript.js.map +0 -7
- package/dist/lib/api-client.js.map +0 -7
- package/dist/lib/auth.js.map +0 -7
- package/dist/lib/capture-hosts.js.map +0 -7
- package/dist/lib/detect-languages.js.map +0 -7
- package/dist/lib/detect-tmux.js.map +0 -7
- package/dist/lib/diagnostics.js.map +0 -7
- package/dist/lib/editor-proxy-pins.js.map +0 -7
- package/dist/lib/ensure-api-key.js.map +0 -7
- package/dist/lib/eval-analyzer.js.map +0 -7
- package/dist/lib/eval-benchmark.js.map +0 -7
- package/dist/lib/eval-conversation-handler.js.map +0 -7
- package/dist/lib/eval-executor.js.map +0 -7
- package/dist/lib/eval-grader.js.map +0 -7
- package/dist/lib/eval-meta-judge.js.map +0 -7
- package/dist/lib/eval-trigger-tester.js.map +0 -7
- package/dist/lib/eval-worktree.js.map +0 -7
- package/dist/lib/gateway-entry.js.map +0 -7
- package/dist/lib/gateway-identity.js.map +0 -7
- package/dist/lib/gateway-lifecycle.js.map +0 -7
- package/dist/lib/gateway.js.map +0 -7
- package/dist/lib/handlers/cron-refresh-skills.js.map +0 -7
- package/dist/lib/handlers/cron-suggest-instructions.js.map +0 -7
- package/dist/lib/handlers/process-announcement.js.map +0 -7
- package/dist/lib/handlers/process-changelog.js.map +0 -7
- package/dist/lib/handlers/process-conversation.js.map +0 -7
- package/dist/lib/handlers/process-eval.js.map +0 -7
- package/dist/lib/handlers/process-insights.js.map +0 -7
- package/dist/lib/handlers/process-launch.js.map +0 -7
- package/dist/lib/handlers/process-run-cleanup.js.map +0 -7
- package/dist/lib/handlers/process-send-message.js.map +0 -7
- package/dist/lib/handlers/process-session-goal.js.map +0 -7
- package/dist/lib/hooks-config.js.map +0 -7
- package/dist/lib/insights-prompts.js.map +0 -7
- package/dist/lib/instruction-snapshot.js.map +0 -7
- package/dist/lib/job-helpers.js.map +0 -7
- package/dist/lib/llm-client.js.map +0 -7
- package/dist/lib/manual-tasks-meta.js.map +0 -7
- package/dist/lib/manual-tasks.js.map +0 -7
- package/dist/lib/output.js.map +0 -7
- package/dist/lib/permanent-job-error.js.map +0 -7
- package/dist/lib/pid-identity.js.map +0 -7
- package/dist/lib/proxy-respawn.js.map +0 -7
- package/dist/lib/research-client.js.map +0 -7
- package/dist/lib/setup-steps.js.map +0 -7
- package/dist/lib/skills-loader.js.map +0 -7
- package/dist/lib/statusline-shim.js.map +0 -7
- package/dist/lib/telemetry.js.map +0 -7
- package/dist/lib/terminal-target-heartbeat.js.map +0 -7
- package/dist/lib/tmux.js.map +0 -7
- package/dist/lib/transcript-rate-limit-watcher.js.map +0 -7
- package/dist/lib/types.js.map +0 -7
- package/dist/lib/version-check.js.map +0 -7
- package/dist/lib/which.js.map +0 -7
- package/dist/lib/worktree.js.map +0 -7
- package/dist/opencode-IQ7X5YMJ.js +0 -190
- package/dist/opencode-IQ7X5YMJ.js.map +0 -7
|
@@ -1,211 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../../chunk-YNIH3KMU.js";
|
|
7
|
-
import {
|
|
8
|
-
executeEval
|
|
9
|
-
} from "../../chunk-QN34TGD3.js";
|
|
10
|
-
import {
|
|
11
|
-
BaseCommand
|
|
12
|
-
} from "../../chunk-2HK7RGZB.js";
|
|
13
|
-
import "../../chunk-R56PH7YE.js";
|
|
14
|
-
import "../../chunk-GQNJO2P2.js";
|
|
15
|
-
import "../../chunk-37LN5O7M.js";
|
|
16
|
-
import "../../chunk-EKJ2CABV.js";
|
|
17
|
-
import {
|
|
18
|
-
apiGet,
|
|
19
|
-
apiPost,
|
|
20
|
-
apiPut
|
|
21
|
-
} from "../../chunk-ZUJBM6HE.js";
|
|
22
|
-
import "../../chunk-W2YERO7E.js";
|
|
23
|
-
import "../../chunk-NSBPE2FW.js";
|
|
24
|
-
|
|
25
|
-
// src/commands/evals/optimize.ts
|
|
26
|
-
import { Args, Flags } from "@oclif/core";
|
|
27
|
-
var EvalOptimizeCommand = class _EvalOptimizeCommand extends BaseCommand {
|
|
28
|
-
static description = "Iteratively optimize eval target content using eval results as feedback";
|
|
29
|
-
static examples = [
|
|
30
|
-
"<%= config.bin %> evals optimize <target-id>",
|
|
31
|
-
"<%= config.bin %> evals optimize <target-id> --auto --max-iterations 3"
|
|
32
|
-
];
|
|
33
|
-
static args = {
|
|
34
|
-
targetId: Args.string({ description: "Eval target ID", required: true })
|
|
35
|
-
};
|
|
36
|
-
static flags = {
|
|
37
|
-
auto: Flags.boolean({ description: "Skip interactive review, apply suggestions automatically", default: false }),
|
|
38
|
-
"max-iterations": Flags.integer({ description: "Maximum optimization iterations", default: 5 }),
|
|
39
|
-
threshold: Flags.string({ description: "Stop if pass rate reaches this threshold (0-1)", default: "0.95" }),
|
|
40
|
-
model: Flags.string({ description: "Model for eval execution" }),
|
|
41
|
-
"analyzer-model": Flags.string({ description: "Model for analysis/suggestions" }),
|
|
42
|
-
"runs-per-eval": Flags.integer({ description: "Runs per eval per iteration", default: 1 }),
|
|
43
|
-
parallel: Flags.integer({ description: "Number of parallel eval executions", default: 1 }),
|
|
44
|
-
timeout: Flags.integer({ description: "Timeout per eval in ms", default: 12e4 })
|
|
45
|
-
};
|
|
46
|
-
async run() {
|
|
47
|
-
const { args, flags } = await this.parse(_EvalOptimizeCommand);
|
|
48
|
-
this.requireAuth();
|
|
49
|
-
let target = await apiGet(`/api/eval-targets/${args.targetId}`);
|
|
50
|
-
const allEvals = await apiGet(`/api/eval-targets/${args.targetId}/evals`);
|
|
51
|
-
if (allEvals.length === 0) {
|
|
52
|
-
this.error("No evals found. Create some first with `rulemetric evals create`.");
|
|
53
|
-
}
|
|
54
|
-
const shuffled = [...allEvals].sort(() => Math.random() - 0.5);
|
|
55
|
-
const splitIdx = Math.ceil(shuffled.length * 0.6);
|
|
56
|
-
const trainEvals = shuffled.slice(0, splitIdx);
|
|
57
|
-
const testEvals = shuffled.slice(splitIdx);
|
|
58
|
-
this.log(`Optimizing "${target.name}" v${target.version}`);
|
|
59
|
-
this.log(`Evals: ${trainEvals.length} train, ${testEvals.length} test`);
|
|
60
|
-
const threshold = parseFloat(flags.threshold);
|
|
61
|
-
this.log(`Config: max ${flags["max-iterations"]} iterations, threshold ${(threshold * 100).toFixed(0)}%`);
|
|
62
|
-
if (flags.auto) this.log("Mode: auto (no interactive review)");
|
|
63
|
-
this.log("");
|
|
64
|
-
let bestVersion = target.version;
|
|
65
|
-
let bestTestScore = 0;
|
|
66
|
-
let noImprovementCount = 0;
|
|
67
|
-
for (let iteration = 1; iteration <= flags["max-iterations"]; iteration++) {
|
|
68
|
-
this.log(`
|
|
69
|
-
=== Iteration ${iteration} ===`);
|
|
70
|
-
const optRun = await apiPost("/api/optimization-runs", {
|
|
71
|
-
evalTargetId: target.id,
|
|
72
|
-
type: "content",
|
|
73
|
-
iteration,
|
|
74
|
-
inputVersion: target.version,
|
|
75
|
-
status: "running"
|
|
76
|
-
});
|
|
77
|
-
this.log("Running train evals...");
|
|
78
|
-
const trainResults = await this.runEvalsOnTarget(target, trainEvals, flags);
|
|
79
|
-
const trainScore = this.computePassRate(trainResults);
|
|
80
|
-
this.log(`Train pass rate: ${(trainScore * 100).toFixed(1)}%`);
|
|
81
|
-
if (trainScore >= threshold) {
|
|
82
|
-
this.log(`Train score ${(trainScore * 100).toFixed(1)}% >= threshold ${(threshold * 100).toFixed(0)}%. Stopping.`);
|
|
83
|
-
const testResults2 = await this.runEvalsOnTarget(target, testEvals, flags);
|
|
84
|
-
const testScore2 = this.computePassRate(testResults2);
|
|
85
|
-
this.log(`Final test score: ${(testScore2 * 100).toFixed(1)}%`);
|
|
86
|
-
await apiPost("/api/optimization-runs", {
|
|
87
|
-
evalTargetId: target.id,
|
|
88
|
-
type: "content",
|
|
89
|
-
iteration,
|
|
90
|
-
inputVersion: target.version,
|
|
91
|
-
trainScore,
|
|
92
|
-
testScore: testScore2,
|
|
93
|
-
analysis: { reason: "threshold_reached" },
|
|
94
|
-
status: "completed"
|
|
95
|
-
});
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
this.log("Analyzing results...");
|
|
99
|
-
const evalResults = trainResults.map((r) => ({
|
|
100
|
-
evalName: r.evalName,
|
|
101
|
-
prompt: r.prompt,
|
|
102
|
-
expectations: r.expectations,
|
|
103
|
-
grading: r.grading
|
|
104
|
-
}));
|
|
105
|
-
const analysis = await analyzeEvalResults({
|
|
106
|
-
content: target.content,
|
|
107
|
-
evalResults,
|
|
108
|
-
model: flags["analyzer-model"] ?? flags.model,
|
|
109
|
-
timeout: flags.timeout
|
|
110
|
-
});
|
|
111
|
-
this.log(`
|
|
112
|
-
Assessment: ${analysis.overallAssessment}`);
|
|
113
|
-
this.log(`Suggestions: ${analysis.suggestions.length}`);
|
|
114
|
-
for (const s of analysis.suggestions) {
|
|
115
|
-
this.log(` - [${s.section}] ${s.reasoning}`);
|
|
116
|
-
}
|
|
117
|
-
if (!flags.auto) {
|
|
118
|
-
this.log("\nProposed changes above. Applying in auto mode would proceed automatically.");
|
|
119
|
-
this.log("(Interactive approval not yet implemented \u2014 use --auto for now)");
|
|
120
|
-
}
|
|
121
|
-
if (analysis.proposedContent === target.content) {
|
|
122
|
-
this.log("No changes proposed. Stopping.");
|
|
123
|
-
await apiPost("/api/optimization-runs", {
|
|
124
|
-
evalTargetId: target.id,
|
|
125
|
-
type: "content",
|
|
126
|
-
iteration,
|
|
127
|
-
inputVersion: target.version,
|
|
128
|
-
trainScore,
|
|
129
|
-
analysis: { reason: "no_changes" },
|
|
130
|
-
status: "completed"
|
|
131
|
-
});
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
const newTarget = await apiPut(`/api/eval-targets/${target.id}`, {
|
|
135
|
-
content: analysis.proposedContent
|
|
136
|
-
});
|
|
137
|
-
this.log(`Created v${newTarget.version}`);
|
|
138
|
-
this.log("Running test evals...");
|
|
139
|
-
const testResults = await this.runEvalsOnTarget(newTarget, testEvals, flags);
|
|
140
|
-
const testScore = this.computePassRate(testResults);
|
|
141
|
-
this.log(`Test pass rate: ${(testScore * 100).toFixed(1)}%`);
|
|
142
|
-
await apiPost("/api/optimization-runs", {
|
|
143
|
-
evalTargetId: newTarget.id,
|
|
144
|
-
type: "content",
|
|
145
|
-
iteration,
|
|
146
|
-
inputVersion: target.version,
|
|
147
|
-
outputVersion: newTarget.version,
|
|
148
|
-
trainScore,
|
|
149
|
-
testScore,
|
|
150
|
-
analysis: {
|
|
151
|
-
suggestions: analysis.suggestions,
|
|
152
|
-
overallAssessment: analysis.overallAssessment
|
|
153
|
-
},
|
|
154
|
-
status: "completed"
|
|
155
|
-
});
|
|
156
|
-
if (testScore > bestTestScore) {
|
|
157
|
-
bestTestScore = testScore;
|
|
158
|
-
bestVersion = newTarget.version;
|
|
159
|
-
noImprovementCount = 0;
|
|
160
|
-
} else {
|
|
161
|
-
noImprovementCount++;
|
|
162
|
-
if (noImprovementCount >= 2) {
|
|
163
|
-
this.log("No improvement for 2 consecutive iterations. Stopping.");
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
target = newTarget;
|
|
168
|
-
}
|
|
169
|
-
this.log(`
|
|
170
|
-
=== Optimization Complete ===`);
|
|
171
|
-
this.log(`Best version: v${bestVersion} (test score: ${(bestTestScore * 100).toFixed(1)}%)`);
|
|
172
|
-
}
|
|
173
|
-
async runEvalsOnTarget(target, evalSet, flags) {
|
|
174
|
-
const results = [];
|
|
175
|
-
for (const eval_ of evalSet) {
|
|
176
|
-
const execResult = await executeEval({
|
|
177
|
-
prompt: eval_.prompt,
|
|
178
|
-
targetContent: target.content,
|
|
179
|
-
timeout: flags.timeout,
|
|
180
|
-
model: flags.model
|
|
181
|
-
});
|
|
182
|
-
if (execResult.error) {
|
|
183
|
-
results.push({ evalName: eval_.name, prompt: eval_.prompt, expectations: eval_.expectations, grading: {} });
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (eval_.expectations.length > 0) {
|
|
187
|
-
const grading = await gradeEvalOutput({
|
|
188
|
-
prompt: eval_.prompt,
|
|
189
|
-
output: execResult.output,
|
|
190
|
-
expectations: eval_.expectations,
|
|
191
|
-
model: flags.model,
|
|
192
|
-
timeout: flags.timeout
|
|
193
|
-
});
|
|
194
|
-
results.push({ evalName: eval_.name, prompt: eval_.prompt, expectations: eval_.expectations, grading });
|
|
195
|
-
} else {
|
|
196
|
-
results.push({ evalName: eval_.name, prompt: eval_.prompt, expectations: eval_.expectations, grading: {} });
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return results;
|
|
200
|
-
}
|
|
201
|
-
computePassRate(results) {
|
|
202
|
-
const graded = results.filter((r) => Object.keys(r.grading).length > 0);
|
|
203
|
-
if (graded.length === 0) return 0;
|
|
204
|
-
const rates = graded.map((r) => r.grading.summary?.pass_rate ?? 0);
|
|
205
|
-
return rates.reduce((a, b) => a + b, 0) / rates.length;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
export {
|
|
209
|
-
EvalOptimizeCommand as default
|
|
210
|
-
};
|
|
211
|
-
//# sourceMappingURL=optimize.js.map
|
|
1
|
+
import{a as A}from"../../chunk-DSO2U4Y6.js";import{a as k}from"../../chunk-CADKBP3D.js";import{a as I}from"../../chunk-MGHFDHHM.js";import{a as z}from"../../chunk-LQRYQE6Q.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-CRAKDQ4H.js";import"../../chunk-WPJ2BND4.js";import"../../chunk-3AV3GTMP.js";import{d as y,e as c,f as T}from"../../chunk-TIQ7DQ3M.js";import"../../chunk-M6AJDVCL.js";import{a as R}from"../../chunk-ZLLER3HP.js";import{Args as P,Flags as o}from"@oclif/core";var w=class N extends z{static{R(this,"EvalOptimizeCommand")}static description="Iteratively optimize eval target content using eval results as feedback";static examples=["<%= config.bin %> evals optimize <target-id>","<%= config.bin %> evals optimize <target-id> --auto --max-iterations 3"];static args={targetId:P.string({description:"Eval target ID",required:!0})};static flags={auto:o.boolean({description:"Skip interactive review, apply suggestions automatically",default:!1}),"max-iterations":o.integer({description:"Maximum optimization iterations",default:5}),threshold:o.string({description:"Stop if pass rate reaches this threshold (0-1)",default:"0.95"}),model:o.string({description:"Model for eval execution"}),"analyzer-model":o.string({description:"Model for analysis/suggestions"}),"runs-per-eval":o.integer({description:"Runs per eval per iteration",default:1}),parallel:o.integer({description:"Number of parallel eval executions",default:1}),timeout:o.integer({description:"Timeout per eval in ms",default:12e4})};async run(){let{args:l,flags:s}=await this.parse(N);this.requireAuth();let t=await y(`/api/eval-targets/${l.targetId}`),i=await y(`/api/eval-targets/${l.targetId}/evals`);i.length===0&&this.error("No evals found. Create some first with `rulemetric evals create`.");let e=[...i].sort(()=>Math.random()-.5),u=Math.ceil(e.length*.6),m=e.slice(0,u),v=e.slice(u);this.log(`Optimizing "${t.name}" v${t.version}`),this.log(`Evals: ${m.length} train, ${v.length} test`);let h=parseFloat(s.threshold);this.log(`Config: max ${s["max-iterations"]} iterations, threshold ${(h*100).toFixed(0)}%`),s.auto&&this.log("Mode: auto (no interactive review)"),this.log("");let $=t.version,f=0,x=0;for(let n=1;n<=s["max-iterations"];n++){this.log(`
|
|
2
|
+
=== Iteration ${n} ===`);let C=await c("/api/optimization-runs",{evalTargetId:t.id,type:"content",iteration:n,inputVersion:t.version,status:"running"});this.log("Running train evals...");let b=await this.runEvalsOnTarget(t,m,s),p=this.computePassRate(b);if(this.log(`Train pass rate: ${(p*100).toFixed(1)}%`),p>=h){this.log(`Train score ${(p*100).toFixed(1)}% >= threshold ${(h*100).toFixed(0)}%. Stopping.`);let a=await this.runEvalsOnTarget(t,v,s),E=this.computePassRate(a);this.log(`Final test score: ${(E*100).toFixed(1)}%`),await c("/api/optimization-runs",{evalTargetId:t.id,type:"content",iteration:n,inputVersion:t.version,trainScore:p,testScore:E,analysis:{reason:"threshold_reached"},status:"completed"});break}this.log("Analyzing results...");let F=b.map(a=>({evalName:a.evalName,prompt:a.prompt,expectations:a.expectations,grading:a.grading})),r=await A({content:t.content,evalResults:F,model:s["analyzer-model"]??s.model,timeout:s.timeout});this.log(`
|
|
3
|
+
Assessment: ${r.overallAssessment}`),this.log(`Suggestions: ${r.suggestions.length}`);for(let a of r.suggestions)this.log(` - [${a.section}] ${a.reasoning}`);if(s.auto||(this.log(`
|
|
4
|
+
Proposed changes above. Applying in auto mode would proceed automatically.`),this.log("(Interactive approval not yet implemented \u2014 use --auto for now)")),r.proposedContent===t.content){this.log("No changes proposed. Stopping."),await c("/api/optimization-runs",{evalTargetId:t.id,type:"content",iteration:n,inputVersion:t.version,trainScore:p,analysis:{reason:"no_changes"},status:"completed"});break}let g=await T(`/api/eval-targets/${t.id}`,{content:r.proposedContent});this.log(`Created v${g.version}`),this.log("Running test evals...");let S=await this.runEvalsOnTarget(g,v,s),d=this.computePassRate(S);if(this.log(`Test pass rate: ${(d*100).toFixed(1)}%`),await c("/api/optimization-runs",{evalTargetId:g.id,type:"content",iteration:n,inputVersion:t.version,outputVersion:g.version,trainScore:p,testScore:d,analysis:{suggestions:r.suggestions,overallAssessment:r.overallAssessment},status:"completed"}),d>f)f=d,$=g.version,x=0;else if(x++,x>=2){this.log("No improvement for 2 consecutive iterations. Stopping.");break}t=g}this.log(`
|
|
5
|
+
=== Optimization Complete ===`),this.log(`Best version: v${$} (test score: ${(f*100).toFixed(1)}%)`)}async runEvalsOnTarget(l,s,t){let i=[];for(let e of s){let u=await I({prompt:e.prompt,targetContent:l.content,timeout:t.timeout,model:t.model});if(u.error){i.push({evalName:e.name,prompt:e.prompt,expectations:e.expectations,grading:{}});continue}if(e.expectations.length>0){let m=await k({prompt:e.prompt,output:u.output,expectations:e.expectations,model:t.model,timeout:t.timeout});i.push({evalName:e.name,prompt:e.prompt,expectations:e.expectations,grading:m})}else i.push({evalName:e.name,prompt:e.prompt,expectations:e.expectations,grading:{}})}return i}computePassRate(l){let s=l.filter(i=>Object.keys(i.grading).length>0);if(s.length===0)return 0;let t=s.map(i=>i.grading.summary?.pass_rate??0);return t.reduce((i,e)=>i+e,0)/t.length}};export{w as default};
|
|
@@ -1,183 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
import {
|
|
5
|
-
executeEval
|
|
6
|
-
} from "../../chunk-QN34TGD3.js";
|
|
7
|
-
import {
|
|
8
|
-
BaseCommand
|
|
9
|
-
} from "../../chunk-2HK7RGZB.js";
|
|
10
|
-
import "../../chunk-R56PH7YE.js";
|
|
11
|
-
import "../../chunk-GQNJO2P2.js";
|
|
12
|
-
import "../../chunk-37LN5O7M.js";
|
|
13
|
-
import "../../chunk-EKJ2CABV.js";
|
|
14
|
-
import {
|
|
15
|
-
apiGet,
|
|
16
|
-
apiPost
|
|
17
|
-
} from "../../chunk-ZUJBM6HE.js";
|
|
18
|
-
import "../../chunk-W2YERO7E.js";
|
|
19
|
-
import "../../chunk-NSBPE2FW.js";
|
|
20
|
-
|
|
21
|
-
// src/commands/evals/run.ts
|
|
22
|
-
import { Args, Flags } from "@oclif/core";
|
|
23
|
-
var EvalRunCommand = class _EvalRunCommand extends BaseCommand {
|
|
24
|
-
static description = "Run evals against a target, optionally grade results, and post to API";
|
|
25
|
-
static examples = [
|
|
26
|
-
"<%= config.bin %> evals run <target-id>",
|
|
27
|
-
"<%= config.bin %> evals run <target-id> --parallel 3 --runs-per-eval 2",
|
|
28
|
-
"<%= config.bin %> evals run <target-id> --skip-baseline --skip-grading"
|
|
29
|
-
];
|
|
30
|
-
static args = {
|
|
31
|
-
targetId: Args.string({ description: "Eval target ID", required: true })
|
|
32
|
-
};
|
|
33
|
-
static flags = {
|
|
34
|
-
parallel: Flags.integer({ description: "Number of parallel eval executions", default: 1 }),
|
|
35
|
-
"runs-per-eval": Flags.integer({ description: "Number of runs per eval for variance analysis", default: 1 }),
|
|
36
|
-
iteration: Flags.integer({ description: "Iteration number for tracking", default: 1 }),
|
|
37
|
-
"skip-baseline": Flags.boolean({ description: "Skip baseline (without_target) runs", default: false }),
|
|
38
|
-
"skip-grading": Flags.boolean({ description: "Skip LLM grading step", default: false }),
|
|
39
|
-
model: Flags.string({ description: "Model for eval execution (default: user configured)" }),
|
|
40
|
-
"grader-model": Flags.string({ description: "Model for grading (default: same as execution model)" }),
|
|
41
|
-
timeout: Flags.integer({ description: "Timeout per eval in ms", default: 12e4 })
|
|
42
|
-
};
|
|
43
|
-
async run() {
|
|
44
|
-
const { args, flags } = await this.parse(_EvalRunCommand);
|
|
45
|
-
this.requireAuth();
|
|
46
|
-
const target = await apiGet(`/api/eval-targets/${args.targetId}`);
|
|
47
|
-
const evals = await apiGet(`/api/eval-targets/${args.targetId}/evals`);
|
|
48
|
-
if (evals.length === 0) {
|
|
49
|
-
this.error(`No evals found for target "${target.name}". Create some with \`rulemetric evals create\`.`);
|
|
50
|
-
}
|
|
51
|
-
this.log(`Running ${evals.length} eval(s) for "${target.name}" v${target.version}`);
|
|
52
|
-
this.log(`Config: ${flags["runs-per-eval"]} run(s) per eval, parallel=${flags.parallel}, iteration=${flags.iteration}`);
|
|
53
|
-
if (flags["skip-baseline"]) this.log("Skipping baseline runs");
|
|
54
|
-
if (flags["skip-grading"]) this.log("Skipping grading");
|
|
55
|
-
this.log("");
|
|
56
|
-
const configurations = [
|
|
57
|
-
{ name: "with_target", content: target.content }
|
|
58
|
-
];
|
|
59
|
-
if (!flags["skip-baseline"]) {
|
|
60
|
-
configurations.push({ name: "without_target" });
|
|
61
|
-
}
|
|
62
|
-
const workQueue = [];
|
|
63
|
-
for (const eval_ of evals) {
|
|
64
|
-
for (const config of configurations) {
|
|
65
|
-
for (let run = 1; run <= flags["runs-per-eval"]; run++) {
|
|
66
|
-
workQueue.push({
|
|
67
|
-
eval_,
|
|
68
|
-
configuration: config.name,
|
|
69
|
-
targetContent: config.content,
|
|
70
|
-
runNumber: run
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const results = [];
|
|
76
|
-
const concurrency = flags.parallel;
|
|
77
|
-
for (let i = 0; i < workQueue.length; i += concurrency) {
|
|
78
|
-
const batch = workQueue.slice(i, i + concurrency);
|
|
79
|
-
const batchResults = await Promise.all(
|
|
80
|
-
batch.map((item) => this.executeAndGrade(item, target, flags))
|
|
81
|
-
);
|
|
82
|
-
results.push(...batchResults);
|
|
83
|
-
}
|
|
84
|
-
this.log("");
|
|
85
|
-
this.log("Posting results to API...");
|
|
86
|
-
for (const result of results) {
|
|
87
|
-
await apiPost("/api/eval-runs", result);
|
|
88
|
-
}
|
|
89
|
-
this.log("");
|
|
90
|
-
this.log("=== Results Summary ===");
|
|
91
|
-
for (const config of configurations) {
|
|
92
|
-
const configResults = results.filter((r) => r.configuration === config.name);
|
|
93
|
-
const completedRuns = configResults.filter((r) => r.status === "completed");
|
|
94
|
-
const gradedRuns = completedRuns.filter((r) => Object.keys(r.grading).length > 0);
|
|
95
|
-
this.log(`
|
|
96
|
-
${config.name}:`);
|
|
97
|
-
this.log(` Runs: ${completedRuns.length}/${configResults.length} completed`);
|
|
98
|
-
if (gradedRuns.length > 0) {
|
|
99
|
-
const passRates = gradedRuns.map((r) => r.grading.summary?.pass_rate ?? 0);
|
|
100
|
-
const avgPassRate = passRates.reduce((a, b) => a + b, 0) / passRates.length;
|
|
101
|
-
this.log(` Avg pass_rate: ${(avgPassRate * 100).toFixed(1)}%`);
|
|
102
|
-
}
|
|
103
|
-
for (const r of configResults) {
|
|
104
|
-
const evalName = evals.find((e) => e.id === r.evalId)?.name ?? r.evalId;
|
|
105
|
-
const passRate = r.grading.summary?.pass_rate;
|
|
106
|
-
const passRateStr = passRate !== void 0 ? ` pass_rate=${(passRate * 100).toFixed(0)}%` : "";
|
|
107
|
-
const timeStr = r.timing.duration_ms ? ` ${(r.timing.duration_ms / 1e3).toFixed(1)}s` : "";
|
|
108
|
-
this.log(` [${r.status}] ${evalName} run#${r.runNumber}${passRateStr}${timeStr}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (!flags["skip-baseline"] && results.length > 0) {
|
|
112
|
-
const withTarget = results.filter((r) => r.configuration === "with_target" && Object.keys(r.grading).length > 0);
|
|
113
|
-
const withoutTarget = results.filter((r) => r.configuration === "without_target" && Object.keys(r.grading).length > 0);
|
|
114
|
-
if (withTarget.length > 0 && withoutTarget.length > 0) {
|
|
115
|
-
const avgWith = withTarget.map((r) => r.grading.summary?.pass_rate ?? 0).reduce((a, b) => a + b, 0) / withTarget.length;
|
|
116
|
-
const avgWithout = withoutTarget.map((r) => r.grading.summary?.pass_rate ?? 0).reduce((a, b) => a + b, 0) / withoutTarget.length;
|
|
117
|
-
const delta = avgWith - avgWithout;
|
|
118
|
-
this.log(`
|
|
119
|
-
Delta: ${delta > 0 ? "+" : ""}${(delta * 100).toFixed(1)}% (with_target vs without_target)`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
async executeAndGrade(item, target, flags) {
|
|
124
|
-
const { eval_, configuration, targetContent, runNumber } = item;
|
|
125
|
-
this.log(`[${configuration}] ${eval_.name} run#${runNumber} \u2014 executing...`);
|
|
126
|
-
const execResult = await executeEval({
|
|
127
|
-
prompt: eval_.prompt,
|
|
128
|
-
targetContent,
|
|
129
|
-
timeout: flags.timeout,
|
|
130
|
-
model: flags.model
|
|
131
|
-
});
|
|
132
|
-
if (execResult.error) {
|
|
133
|
-
this.log(`[${configuration}] ${eval_.name} run#${runNumber} \u2014 FAILED: ${execResult.error}`);
|
|
134
|
-
return {
|
|
135
|
-
evalId: eval_.id,
|
|
136
|
-
evalTargetId: target.id,
|
|
137
|
-
evalTargetVersion: target.version,
|
|
138
|
-
configuration,
|
|
139
|
-
runNumber,
|
|
140
|
-
iteration: flags.iteration,
|
|
141
|
-
status: "failed",
|
|
142
|
-
outputs: { error: execResult.error },
|
|
143
|
-
timing: { duration_ms: execResult.durationMs, total_tokens: execResult.totalTokens },
|
|
144
|
-
grading: {}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
this.log(`[${configuration}] ${eval_.name} run#${runNumber} \u2014 completed in ${(execResult.durationMs / 1e3).toFixed(1)}s`);
|
|
148
|
-
let grading = {};
|
|
149
|
-
if (!flags["skip-grading"] && eval_.expectations.length > 0) {
|
|
150
|
-
this.log(`[${configuration}] ${eval_.name} run#${runNumber} \u2014 grading...`);
|
|
151
|
-
const gradingResult = await gradeEvalOutput({
|
|
152
|
-
prompt: eval_.prompt,
|
|
153
|
-
output: execResult.output,
|
|
154
|
-
expectations: eval_.expectations,
|
|
155
|
-
model: flags["grader-model"] ?? flags.model,
|
|
156
|
-
timeout: flags.timeout
|
|
157
|
-
});
|
|
158
|
-
grading = gradingResult;
|
|
159
|
-
const passRate = gradingResult.summary.pass_rate;
|
|
160
|
-
this.log(`[${configuration}] ${eval_.name} run#${runNumber} \u2014 grading done: pass_rate=${(passRate * 100).toFixed(0)}%`);
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
evalId: eval_.id,
|
|
164
|
-
evalTargetId: target.id,
|
|
165
|
-
evalTargetVersion: target.version,
|
|
166
|
-
configuration,
|
|
167
|
-
runNumber,
|
|
168
|
-
iteration: flags.iteration,
|
|
169
|
-
status: "completed",
|
|
170
|
-
outputs: { transcript: execResult.output },
|
|
171
|
-
timing: {
|
|
172
|
-
duration_ms: execResult.durationMs,
|
|
173
|
-
total_tokens: execResult.totalTokens,
|
|
174
|
-
total_duration_seconds: execResult.durationMs / 1e3
|
|
175
|
-
},
|
|
176
|
-
grading
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
export {
|
|
181
|
-
EvalRunCommand as default
|
|
182
|
-
};
|
|
183
|
-
//# sourceMappingURL=run.js.map
|
|
1
|
+
import{a as w}from"../../chunk-CADKBP3D.js";import{a as _}from"../../chunk-MGHFDHHM.js";import{a as R}from"../../chunk-LQRYQE6Q.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-CRAKDQ4H.js";import"../../chunk-WPJ2BND4.js";import"../../chunk-3AV3GTMP.js";import{d as h,e as k}from"../../chunk-TIQ7DQ3M.js";import"../../chunk-M6AJDVCL.js";import{a as $}from"../../chunk-ZLLER3HP.js";import{Args as T,Flags as c}from"@oclif/core";var b=class x extends R{static{$(this,"EvalRunCommand")}static description="Run evals against a target, optionally grade results, and post to API";static examples=["<%= config.bin %> evals run <target-id>","<%= config.bin %> evals run <target-id> --parallel 3 --runs-per-eval 2","<%= config.bin %> evals run <target-id> --skip-baseline --skip-grading"];static args={targetId:T.string({description:"Eval target ID",required:!0})};static flags={parallel:c.integer({description:"Number of parallel eval executions",default:1}),"runs-per-eval":c.integer({description:"Number of runs per eval for variance analysis",default:1}),iteration:c.integer({description:"Iteration number for tracking",default:1}),"skip-baseline":c.boolean({description:"Skip baseline (without_target) runs",default:!1}),"skip-grading":c.boolean({description:"Skip LLM grading step",default:!1}),model:c.string({description:"Model for eval execution (default: user configured)"}),"grader-model":c.string({description:"Model for grading (default: same as execution model)"}),timeout:c.integer({description:"Timeout per eval in ms",default:12e4})};async run(){let{args:f,flags:i}=await this.parse(x);this.requireAuth();let s=await h(`/api/eval-targets/${f.targetId}`),r=await h(`/api/eval-targets/${f.targetId}/evals`);r.length===0&&this.error(`No evals found for target "${s.name}". Create some with \`rulemetric evals create\`.`),this.log(`Running ${r.length} eval(s) for "${s.name}" v${s.version}`),this.log(`Config: ${i["runs-per-eval"]} run(s) per eval, parallel=${i.parallel}, iteration=${i.iteration}`),i["skip-baseline"]&&this.log("Skipping baseline runs"),i["skip-grading"]&&this.log("Skipping grading"),this.log("");let l=[{name:"with_target",content:s.content}];i["skip-baseline"]||l.push({name:"without_target"});let p=[];for(let e of r)for(let a of l)for(let n=1;n<=i["runs-per-eval"];n++)p.push({eval_:e,configuration:a.name,targetContent:a.content,runNumber:n});let o=[],g=i.parallel;for(let e=0;e<p.length;e+=g){let a=p.slice(e,e+g),n=await Promise.all(a.map(m=>this.executeAndGrade(m,s,i)));o.push(...n)}this.log(""),this.log("Posting results to API...");for(let e of o)await k("/api/eval-runs",e);this.log(""),this.log("=== Results Summary ===");for(let e of l){let a=o.filter(t=>t.configuration===e.name),n=a.filter(t=>t.status==="completed"),m=n.filter(t=>Object.keys(t.grading).length>0);if(this.log(`
|
|
2
|
+
${e.name}:`),this.log(` Runs: ${n.length}/${a.length} completed`),m.length>0){let t=m.map(d=>d.grading.summary?.pass_rate??0),u=t.reduce((d,v)=>d+v,0)/t.length;this.log(` Avg pass_rate: ${(u*100).toFixed(1)}%`)}for(let t of a){let u=r.find(I=>I.id===t.evalId)?.name??t.evalId,d=t.grading.summary?.pass_rate,v=d!==void 0?` pass_rate=${(d*100).toFixed(0)}%`:"",y=t.timing.duration_ms?` ${(t.timing.duration_ms/1e3).toFixed(1)}s`:"";this.log(` [${t.status}] ${u} run#${t.runNumber}${v}${y}`)}}if(!i["skip-baseline"]&&o.length>0){let e=o.filter(n=>n.configuration==="with_target"&&Object.keys(n.grading).length>0),a=o.filter(n=>n.configuration==="without_target"&&Object.keys(n.grading).length>0);if(e.length>0&&a.length>0){let n=e.map(u=>u.grading.summary?.pass_rate??0).reduce((u,d)=>u+d,0)/e.length,m=a.map(u=>u.grading.summary?.pass_rate??0).reduce((u,d)=>u+d,0)/a.length,t=n-m;this.log(`
|
|
3
|
+
Delta: ${t>0?"+":""}${(t*100).toFixed(1)}% (with_target vs without_target)`)}}}async executeAndGrade(f,i,s){let{eval_:r,configuration:l,targetContent:p,runNumber:o}=f;this.log(`[${l}] ${r.name} run#${o} \u2014 executing...`);let g=await _({prompt:r.prompt,targetContent:p,timeout:s.timeout,model:s.model});if(g.error)return this.log(`[${l}] ${r.name} run#${o} \u2014 FAILED: ${g.error}`),{evalId:r.id,evalTargetId:i.id,evalTargetVersion:i.version,configuration:l,runNumber:o,iteration:s.iteration,status:"failed",outputs:{error:g.error},timing:{duration_ms:g.durationMs,total_tokens:g.totalTokens},grading:{}};this.log(`[${l}] ${r.name} run#${o} \u2014 completed in ${(g.durationMs/1e3).toFixed(1)}s`);let e={};if(!s["skip-grading"]&&r.expectations.length>0){this.log(`[${l}] ${r.name} run#${o} \u2014 grading...`);let a=await w({prompt:r.prompt,output:g.output,expectations:r.expectations,model:s["grader-model"]??s.model,timeout:s.timeout});e=a;let n=a.summary.pass_rate;this.log(`[${l}] ${r.name} run#${o} \u2014 grading done: pass_rate=${(n*100).toFixed(0)}%`)}return{evalId:r.id,evalTargetId:i.id,evalTargetVersion:i.version,configuration:l,runNumber:o,iteration:s.iteration,status:"completed",outputs:{transcript:g.output},timing:{duration_ms:g.durationMs,total_tokens:g.totalTokens,total_duration_seconds:g.durationMs/1e3},grading:e}}};export{b as default};
|
|
@@ -1,104 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
repinEditorProxies,
|
|
3
|
-
unpinEditorProxies
|
|
4
|
-
} from "../../chunk-3S7223UR.js";
|
|
5
|
-
import {
|
|
6
|
-
writeCursorUserProxyConfig,
|
|
7
|
-
writeVSCodeUserProxyConfig
|
|
8
|
-
} from "../../chunk-LXKPNATC.js";
|
|
9
|
-
import "../../chunk-OQBBVTDG.js";
|
|
10
|
-
import {
|
|
11
|
-
GATEWAY_PORT,
|
|
12
|
-
isGatewayRunning,
|
|
13
|
-
isRulemetricGatewayListening,
|
|
14
|
-
spawnGateway
|
|
15
|
-
} from "../../chunk-4LYCDS2N.js";
|
|
16
|
-
import "../../chunk-7LVVKQMZ.js";
|
|
17
|
-
import {
|
|
18
|
-
MITMPROXY_COMMAND_PATTERN,
|
|
19
|
-
isPidLiveAndMatching
|
|
20
|
-
} from "../../chunk-5EDMGK3W.js";
|
|
21
|
-
import {
|
|
22
|
-
BaseCommand
|
|
23
|
-
} from "../../chunk-2HK7RGZB.js";
|
|
24
|
-
import "../../chunk-R56PH7YE.js";
|
|
25
|
-
import "../../chunk-GQNJO2P2.js";
|
|
26
|
-
import "../../chunk-37LN5O7M.js";
|
|
27
|
-
import "../../chunk-EKJ2CABV.js";
|
|
28
|
-
import "../../chunk-ZUJBM6HE.js";
|
|
29
|
-
import "../../chunk-W2YERO7E.js";
|
|
30
|
-
import "../../chunk-NSBPE2FW.js";
|
|
31
|
-
|
|
32
|
-
// src/commands/gateway/ensure.ts
|
|
33
|
-
import { spawn } from "node:child_process";
|
|
34
|
-
import { existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
35
|
-
import { homedir } from "node:os";
|
|
36
|
-
import { join } from "node:path";
|
|
37
|
-
var CONFIG_DIR = join(homedir(), ".config", "rulemetric");
|
|
38
|
-
var ADDON_VERSION_FILE = join(CONFIG_DIR, "proxy-addon.version");
|
|
39
|
-
var PROXY_PID_FILE = join(CONFIG_DIR, "proxy.pid");
|
|
40
|
-
var DRIFT_RESTART_MARKER = join(CONFIG_DIR, "proxy-drift-restart.at");
|
|
41
|
-
var DRIFT_RESTART_COOLDOWN_MS = 10 * 6e4;
|
|
42
|
-
var GatewayEnsure = class _GatewayEnsure extends BaseCommand {
|
|
43
|
-
static description = "Ensure the gateway proxy is running (called by hooks, not for direct use)";
|
|
44
|
-
static hidden = true;
|
|
45
|
-
async run() {
|
|
46
|
-
await this.parse(_GatewayEnsure);
|
|
47
|
-
this.maybeRestartStaleProxy();
|
|
48
|
-
const identity = await isRulemetricGatewayListening(GATEWAY_PORT);
|
|
49
|
-
if (identity.status === "ours-live") {
|
|
50
|
-
const repinned = repinEditorProxies((editor) => {
|
|
51
|
-
if (editor === "vscode") writeVSCodeUserProxyConfig(GATEWAY_PORT);
|
|
52
|
-
else writeCursorUserProxyConfig(GATEWAY_PORT);
|
|
53
|
-
});
|
|
54
|
-
if (repinned.length > 0) {
|
|
55
|
-
console.error(`[RuleMetric] Gateway healthy again \u2014 restored ${repinned.join(", ")} proxy settings.`);
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (identity.status === "foreign") {
|
|
60
|
-
if (isGatewayRunning()) return;
|
|
61
|
-
const unpinned = unpinEditorProxies(GATEWAY_PORT);
|
|
62
|
-
console.error(
|
|
63
|
-
`[RuleMetric] A non-RuleMetric process holds :${GATEWAY_PORT} \u2014 cannot start gateway. ` + (unpinned.length > 0 ? `Unpinned ${unpinned.join(", ")} proxy settings so editors are not routed through it. ` : "") + "Run `rulemetric diagnostics` if Claude Code HTTPS requests fail."
|
|
64
|
-
);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
spawnGateway(this.config.version);
|
|
69
|
-
} catch (err) {
|
|
70
|
-
console.error(`[RuleMetric] Could not start gateway: ${err.message}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
maybeRestartStaleProxy() {
|
|
74
|
-
try {
|
|
75
|
-
if (!existsSync(ADDON_VERSION_FILE)) return;
|
|
76
|
-
const runningVersion = readFileSync(ADDON_VERSION_FILE, "utf-8").trim();
|
|
77
|
-
if (!runningVersion || runningVersion === this.config.version) return;
|
|
78
|
-
const pidRaw = readFileSync(PROXY_PID_FILE, "utf-8").trim();
|
|
79
|
-
const pid = Number(pidRaw);
|
|
80
|
-
if (!Number.isFinite(pid) || !isPidLiveAndMatching(pid, MITMPROXY_COMMAND_PATTERN)) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
try {
|
|
84
|
-
const age = Date.now() - statSync(DRIFT_RESTART_MARKER).mtimeMs;
|
|
85
|
-
if (age < DRIFT_RESTART_COOLDOWN_MS) return;
|
|
86
|
-
} catch {
|
|
87
|
-
}
|
|
88
|
-
writeFileSync(DRIFT_RESTART_MARKER, (/* @__PURE__ */ new Date()).toISOString());
|
|
89
|
-
const child = spawn(process.execPath, [process.argv[1], "proxy", "restart"], {
|
|
90
|
-
detached: true,
|
|
91
|
-
stdio: "ignore"
|
|
92
|
-
});
|
|
93
|
-
child.unref();
|
|
94
|
-
console.error(
|
|
95
|
-
`[RuleMetric] Capture proxy is running CLI ${runningVersion} but ${this.config.version} is installed \u2014 restarting it in the background.`
|
|
96
|
-
);
|
|
97
|
-
} catch {
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
export {
|
|
102
|
-
GatewayEnsure as default
|
|
103
|
-
};
|
|
104
|
-
//# sourceMappingURL=ensure.js.map
|
|
1
|
+
import{b as y,c as h}from"../../chunk-Y65CSJFF.js";import{B as l,E as g}from"../../chunk-O7ZMHCMG.js";import"../../chunk-I2DZGJRR.js";import{c as e,g as p,i as m,k as f}from"../../chunk-MVM6OGAF.js";import"../../chunk-KKDHD4XA.js";import{b as d,d as u}from"../../chunk-SZ62CP55.js";import{a as c}from"../../chunk-LQRYQE6Q.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-CRAKDQ4H.js";import"../../chunk-WPJ2BND4.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-TIQ7DQ3M.js";import"../../chunk-M6AJDVCL.js";import{a}from"../../chunk-ZLLER3HP.js";import{spawn as S}from"node:child_process";import{existsSync as v,readFileSync as R,statSync as C,writeFileSync as M}from"node:fs";import{homedir as T}from"node:os";import{join as o}from"node:path";var s=o(T(),".config","rulemetric"),x=o(s,"proxy-addon.version"),_=o(s,"proxy.pid"),w=o(s,"proxy-drift-restart.at"),E=10*6e4,n=class P extends c{static{a(this,"GatewayEnsure")}static description="Ensure the gateway proxy is running (called by hooks, not for direct use)";static hidden=!0;async run(){await this.parse(P),this.maybeRestartStaleProxy();let t=await p(e);if(t.status==="ours-live"){let r=h(i=>{i==="vscode"?l(e):g(e)});r.length>0&&console.error(`[RuleMetric] Gateway healthy again \u2014 restored ${r.join(", ")} proxy settings.`);return}if(t.status==="foreign"){if(m())return;let r=y(e);console.error(`[RuleMetric] A non-RuleMetric process holds :${e} \u2014 cannot start gateway. `+(r.length>0?`Unpinned ${r.join(", ")} proxy settings so editors are not routed through it. `:"")+"Run `rulemetric diagnostics` if Claude Code HTTPS requests fail.");return}try{f(this.config.version)}catch(r){console.error(`[RuleMetric] Could not start gateway: ${r.message}`)}}maybeRestartStaleProxy(){try{if(!v(x))return;let t=R(x,"utf-8").trim();if(!t||t===this.config.version)return;let r=R(_,"utf-8").trim(),i=Number(r);if(!Number.isFinite(i)||!u(i,d))return;try{if(Date.now()-C(w).mtimeMs<E)return}catch{}M(w,new Date().toISOString()),S(process.execPath,[process.argv[1],"proxy","restart"],{detached:!0,stdio:"ignore"}).unref(),console.error(`[RuleMetric] Capture proxy is running CLI ${t} but ${this.config.version} is installed \u2014 restarting it in the background.`)}catch{}}};export{n as default};
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildInstructionSnapshot
|
|
3
|
-
} from "../../chunk-SO3T35U7.js";
|
|
4
|
-
import "../../chunk-NSBPE2FW.js";
|
|
5
|
-
|
|
6
|
-
// src/commands/hooks/emit-instructions.ts
|
|
7
|
-
import { Command, Flags } from "@oclif/core";
|
|
8
|
-
var HooksEmitInstructions = class _HooksEmitInstructions extends Command {
|
|
9
|
-
static description = "Print a synthetic instruction snapshot (on-disk CLAUDE.md) as JSON for zero-proxy instruction linking";
|
|
10
|
-
static hidden = true;
|
|
11
|
-
static flags = {
|
|
12
|
-
"project-dir": Flags.string({ description: "Project directory to scan (defaults to cwd)" })
|
|
13
|
-
};
|
|
14
|
-
async run() {
|
|
15
|
-
const { flags } = await this.parse(_HooksEmitInstructions);
|
|
16
|
-
const snapshot = buildInstructionSnapshot(flags["project-dir"] ?? process.cwd());
|
|
17
|
-
if (snapshot) {
|
|
18
|
-
process.stdout.write(JSON.stringify(snapshot));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
HooksEmitInstructions as default
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=emit-instructions.js.map
|
|
1
|
+
import{a as s}from"../../chunk-CNQ5DTNC.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{Command as n,Flags as c}from"@oclif/core";var t=class o extends n{static{i(this,"HooksEmitInstructions")}static description="Print a synthetic instruction snapshot (on-disk CLAUDE.md) as JSON for zero-proxy instruction linking";static hidden=!0;static flags={"project-dir":c.string({description:"Project directory to scan (defaults to cwd)"})};async run(){let{flags:e}=await this.parse(o),r=s(e["project-dir"]??process.cwd());r&&process.stdout.write(JSON.stringify(r))}};export{t as default};
|