@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,442 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
detectTmux
|
|
3
|
-
} from "../../chunk-BO76WKJR.js";
|
|
4
|
-
import {
|
|
5
|
-
RULEMETRIC_NO_PROXY,
|
|
6
|
-
claudeSettingsInstallPath,
|
|
7
|
-
installMacOSProxyEnv,
|
|
8
|
-
mergeClaudeCodeHooks,
|
|
9
|
-
migrateSharedClaudeSettings,
|
|
10
|
-
readClaudeSettings,
|
|
11
|
-
removeClaudeCodeHooks,
|
|
12
|
-
writeAntigravityHooks,
|
|
13
|
-
writeAntigravityUserHooks,
|
|
14
|
-
writeClaudeSettingsWithBackup,
|
|
15
|
-
writeCopilotHooks,
|
|
16
|
-
writeCursorHooks,
|
|
17
|
-
writeCursorProxyConfig,
|
|
18
|
-
writeCursorUserHooks,
|
|
19
|
-
writeCursorUserProxyConfig,
|
|
20
|
-
writeVSCodeProxyConfig,
|
|
21
|
-
writeVSCodeUserProxyConfig
|
|
22
|
-
} from "../../chunk-LXKPNATC.js";
|
|
23
|
-
import {
|
|
24
|
-
STATUSLINE_SETTINGS_VALUE,
|
|
25
|
-
STATUSLINE_SHIM_PATH,
|
|
26
|
-
isStatuslineShimInstalled,
|
|
27
|
-
readCurrentStatusLine,
|
|
28
|
-
writeStatuslineShim
|
|
29
|
-
} from "../../chunk-OQBBVTDG.js";
|
|
30
|
-
import "../../chunk-KRBQLMOP.js";
|
|
31
|
-
import {
|
|
32
|
-
findBinary
|
|
33
|
-
} from "../../chunk-42GFSAJP.js";
|
|
34
|
-
import {
|
|
35
|
-
GATEWAY_PORT,
|
|
36
|
-
isGatewayRunning,
|
|
37
|
-
isRulemetricGatewayListening,
|
|
38
|
-
spawnGateway,
|
|
39
|
-
stopGateway,
|
|
40
|
-
waitForRulemetricGateway
|
|
41
|
-
} from "../../chunk-4LYCDS2N.js";
|
|
42
|
-
import {
|
|
43
|
-
describePortOwner
|
|
44
|
-
} from "../../chunk-7LVVKQMZ.js";
|
|
45
|
-
import "../../chunk-5EDMGK3W.js";
|
|
46
|
-
import {
|
|
47
|
-
ensureDeviceApiKey
|
|
48
|
-
} from "../../chunk-EJ3YAFDP.js";
|
|
49
|
-
import {
|
|
50
|
-
BaseCommand
|
|
51
|
-
} from "../../chunk-2HK7RGZB.js";
|
|
52
|
-
import "../../chunk-R56PH7YE.js";
|
|
53
|
-
import {
|
|
54
|
-
emitSetupEvent
|
|
55
|
-
} from "../../chunk-GQNJO2P2.js";
|
|
56
|
-
import {
|
|
57
|
-
bootstrapActiveOrg
|
|
58
|
-
} from "../../chunk-37LN5O7M.js";
|
|
59
|
-
import "../../chunk-EKJ2CABV.js";
|
|
60
|
-
import "../../chunk-ZUJBM6HE.js";
|
|
61
|
-
import {
|
|
62
|
-
loadEnvFileAuth
|
|
63
|
-
} from "../../chunk-W2YERO7E.js";
|
|
64
|
-
import "../../chunk-NSBPE2FW.js";
|
|
65
|
-
|
|
66
|
-
// src/commands/hooks/install.ts
|
|
67
|
-
import { Flags } from "@oclif/core";
|
|
68
|
-
import { execFileSync, spawnSync } from "node:child_process";
|
|
69
|
-
import { existsSync } from "node:fs";
|
|
70
|
-
import { homedir } from "node:os";
|
|
71
|
-
import { join, dirname } from "node:path";
|
|
72
|
-
function resolveHookBinDir() {
|
|
73
|
-
try {
|
|
74
|
-
const out = execFileSync("/bin/sh", ["-c", "command -v rulemetric"], {
|
|
75
|
-
encoding: "utf-8"
|
|
76
|
-
}).trim();
|
|
77
|
-
if (out && existsSync(out)) return dirname(out);
|
|
78
|
-
} catch {
|
|
79
|
-
}
|
|
80
|
-
return void 0;
|
|
81
|
-
}
|
|
82
|
-
function isGatewayLaunchdManaged() {
|
|
83
|
-
try {
|
|
84
|
-
execFileSync("launchctl", ["list", "com.rulemetric.gateway"], {
|
|
85
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
86
|
-
});
|
|
87
|
-
return true;
|
|
88
|
-
} catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
var CERT_PATH = join(homedir(), ".mitmproxy", "mitmproxy-ca-cert.pem");
|
|
93
|
-
var HooksInstall = class _HooksInstall extends BaseCommand {
|
|
94
|
-
static description = "Install session tracking hooks and context capture proxy for Claude Code";
|
|
95
|
-
static examples = [
|
|
96
|
-
"<%= config.bin %> hooks install",
|
|
97
|
-
"<%= config.bin %> hooks install --global",
|
|
98
|
-
"<%= config.bin %> hooks install --no-proxy"
|
|
99
|
-
];
|
|
100
|
-
static flags = {
|
|
101
|
-
"no-proxy": Flags.boolean({
|
|
102
|
-
default: false,
|
|
103
|
-
description: "Skip proxy/gateway configuration (hooks only)"
|
|
104
|
-
}),
|
|
105
|
-
"project-dir": Flags.string({
|
|
106
|
-
description: "Project directory to install hooks in (defaults to cwd)"
|
|
107
|
-
}),
|
|
108
|
-
global: Flags.boolean({
|
|
109
|
-
char: "g",
|
|
110
|
-
default: false,
|
|
111
|
-
description: "Install hooks globally (~/.claude/settings.json) so all projects are tracked"
|
|
112
|
-
}),
|
|
113
|
-
"statusline-usage": Flags.boolean({
|
|
114
|
-
default: false,
|
|
115
|
-
description: "Install the statusline shim so Claude Code pushes live rate_limits on every refresh (makes /usage rings update in real time without needing the proxy)"
|
|
116
|
-
})
|
|
117
|
-
};
|
|
118
|
-
async run() {
|
|
119
|
-
const { flags } = await this.parse(_HooksInstall);
|
|
120
|
-
const isGlobal = flags.global;
|
|
121
|
-
const projectPath = isGlobal ? homedir() : flags["project-dir"] ?? process.cwd();
|
|
122
|
-
const configDir = join(projectPath, ".claude");
|
|
123
|
-
const configPath = claudeSettingsInstallPath(configDir, isGlobal);
|
|
124
|
-
const settingsFileName = isGlobal ? "settings.json" : "settings.local.json";
|
|
125
|
-
const noProxy = flags["no-proxy"];
|
|
126
|
-
let proxyActive = false;
|
|
127
|
-
let proxyReason = noProxy ? "no_proxy_flag" : void 0;
|
|
128
|
-
let caTrusted = false;
|
|
129
|
-
let pkgManagers = [];
|
|
130
|
-
if (isGlobal) {
|
|
131
|
-
this.log(`Installing hooks globally \u2192 ${configPath}`);
|
|
132
|
-
}
|
|
133
|
-
const { settings, recoveredBackup } = readClaudeSettings(configPath);
|
|
134
|
-
if (recoveredBackup) {
|
|
135
|
-
this.log(`[!!] ${configPath} was not valid JSON \u2014 backed it up to ${recoveredBackup} and continued with a fresh file.`);
|
|
136
|
-
}
|
|
137
|
-
if (!isGlobal) {
|
|
138
|
-
const migration = migrateSharedClaudeSettings(join(configDir, "settings.json"), GATEWAY_PORT);
|
|
139
|
-
if (migration.migrated) {
|
|
140
|
-
this.log("[OK] Moved RuleMetric machine-local state out of the shared .claude/settings.json (it now lives in .claude/settings.local.json)");
|
|
141
|
-
if (migration.backupPath) {
|
|
142
|
-
this.log(` Previous shared settings backed up \u2192 ${migration.backupPath}`);
|
|
143
|
-
}
|
|
144
|
-
if (migration.removedStatusline && existsSync(STATUSLINE_SHIM_PATH) && !isStatuslineShimInstalled(settings)) {
|
|
145
|
-
settings.statusLine = STATUSLINE_SETTINGS_VALUE;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
const envAuth = loadEnvFileAuth();
|
|
150
|
-
if ((envAuth.accessToken || process.env.RULEMETRIC_ACCESS_TOKEN) && !envAuth.apiKey && !process.env.RULEMETRIC_API_KEY) {
|
|
151
|
-
await ensureDeviceApiKey(this.log.bind(this), this.warn.bind(this), this.config.version);
|
|
152
|
-
}
|
|
153
|
-
const refreshedHooks = removeClaudeCodeHooks(settings);
|
|
154
|
-
const hookBinDir = resolveHookBinDir();
|
|
155
|
-
mergeClaudeCodeHooks(settings, hookBinDir);
|
|
156
|
-
this.log(
|
|
157
|
-
refreshedHooks ? `[OK] Refreshed RuleMetric Claude Code session hooks \u2192 .claude/${settingsFileName}` : `[OK] Installed RuleMetric Claude Code session hooks \u2192 .claude/${settingsFileName}`
|
|
158
|
-
);
|
|
159
|
-
if (!noProxy) {
|
|
160
|
-
let mitmAvailable = Boolean(findBinary("mitmdump"));
|
|
161
|
-
if (!mitmAvailable) {
|
|
162
|
-
this.log("");
|
|
163
|
-
this.log("[!!] mitmproxy not found \u2014 installing...");
|
|
164
|
-
pkgManagers = ["brew", "pipx", "uv"].filter((m) => Boolean(findBinary(m)));
|
|
165
|
-
mitmAvailable = this.installMitmproxy();
|
|
166
|
-
if (!mitmAvailable) {
|
|
167
|
-
this.log("[!!] Could not install mitmproxy. Skipping proxy config.");
|
|
168
|
-
this.log(" Install manually: pipx install mitmproxy");
|
|
169
|
-
this.log(" Then re-run: rulemetric hooks install");
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (!existsSync(CERT_PATH)) {
|
|
173
|
-
this.log("[..] Generating CA certificate...");
|
|
174
|
-
const mitmdump = findBinary("mitmdump");
|
|
175
|
-
if (mitmdump) {
|
|
176
|
-
spawnSync(mitmdump, ["--set", "listen_port=0", "-q"], {
|
|
177
|
-
timeout: 5e3,
|
|
178
|
-
stdio: "ignore"
|
|
179
|
-
});
|
|
180
|
-
if (existsSync(CERT_PATH)) {
|
|
181
|
-
this.log(`[OK] CA certificate generated at ${CERT_PATH}`);
|
|
182
|
-
} else {
|
|
183
|
-
this.log("[!!] Could not generate CA cert");
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
} else {
|
|
187
|
-
this.log("[OK] CA certificate found");
|
|
188
|
-
}
|
|
189
|
-
const caGenerated = existsSync(CERT_PATH);
|
|
190
|
-
if (caGenerated && !this.isCACertTrusted()) {
|
|
191
|
-
this.log("[..] Installing CA certificate into system trust store (requires admin)...");
|
|
192
|
-
caTrusted = this.trustCACert();
|
|
193
|
-
if (caTrusted) {
|
|
194
|
-
this.log("[OK] CA certificate trusted by system");
|
|
195
|
-
} else {
|
|
196
|
-
this.log("[!!] Could not install CA cert automatically.");
|
|
197
|
-
if (process.platform === "darwin") {
|
|
198
|
-
this.log(` Run manually: sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${CERT_PATH}`);
|
|
199
|
-
} else if (process.platform === "linux") {
|
|
200
|
-
this.log(` Run manually: sudo cp ${CERT_PATH} /usr/local/share/ca-certificates/mitmproxy-ca.crt && sudo update-ca-certificates`);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
} else if (caGenerated) {
|
|
204
|
-
this.log("[OK] CA certificate already trusted");
|
|
205
|
-
caTrusted = true;
|
|
206
|
-
}
|
|
207
|
-
const launchdManaged = isGatewayLaunchdManaged();
|
|
208
|
-
const portIdentity = await isRulemetricGatewayListening(GATEWAY_PORT);
|
|
209
|
-
if (launchdManaged) {
|
|
210
|
-
this.log("[OK] Gateway managed by launchd (com.rulemetric.gateway)");
|
|
211
|
-
} else if (portIdentity.status === "ours-live") {
|
|
212
|
-
this.log("[OK] Gateway already running");
|
|
213
|
-
} else if (portIdentity.status === "foreign" && isGatewayRunning()) {
|
|
214
|
-
this.log("[..] Restarting gateway (running build predates the identity handshake)...");
|
|
215
|
-
stopGateway();
|
|
216
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
217
|
-
try {
|
|
218
|
-
const pid = spawnGateway(this.config.version);
|
|
219
|
-
this.log(`[OK] Gateway restarted (PID ${pid})`);
|
|
220
|
-
} catch (err) {
|
|
221
|
-
this.log(`[!!] Could not restart gateway: ${err.message}`);
|
|
222
|
-
}
|
|
223
|
-
} else if (portIdentity.status === "foreign") {
|
|
224
|
-
} else {
|
|
225
|
-
try {
|
|
226
|
-
const pid = spawnGateway(this.config.version);
|
|
227
|
-
this.log(`[OK] Gateway started (PID ${pid})`);
|
|
228
|
-
} catch (err) {
|
|
229
|
-
this.log(`[!!] Could not start gateway: ${err.message}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
const gatewayIdentity = await waitForRulemetricGateway(GATEWAY_PORT, { timeoutMs: 4e3 });
|
|
233
|
-
if (!caGenerated) {
|
|
234
|
-
proxyReason = mitmAvailable ? "ca_not_generated" : pkgManagers.length === 0 ? "no_package_manager" : "mitmproxy_install_failed";
|
|
235
|
-
this.log("[!!] No CA certificate \u2014 NOT setting HTTPS_PROXY (capture stays hooks-only).");
|
|
236
|
-
this.log(" Install mitmproxy, then re-run: rulemetric hooks install");
|
|
237
|
-
} else if (gatewayIdentity.status === "foreign" && !launchdManaged) {
|
|
238
|
-
proxyReason = "gateway_port_foreign";
|
|
239
|
-
const owner = describePortOwner(GATEWAY_PORT);
|
|
240
|
-
this.log(`[!!] Port :${GATEWAY_PORT} is held by a process that is NOT the RuleMetric gateway \u2014 NOT setting HTTPS_PROXY.`);
|
|
241
|
-
this.log(
|
|
242
|
-
owner ? ` Holding the port: ${owner}` : ` Could not identify the holder (try: lsof -nP -iTCP:${GATEWAY_PORT} -sTCP:LISTEN)`
|
|
243
|
-
);
|
|
244
|
-
this.log(" Capture still works via hooks. Free the port, then re-run: rulemetric hooks install");
|
|
245
|
-
} else if (gatewayIdentity.status === "dead") {
|
|
246
|
-
proxyReason = "gateway_not_live";
|
|
247
|
-
this.log(`[!!] Gateway is not answering on :${GATEWAY_PORT} \u2014 NOT setting HTTPS_PROXY.`);
|
|
248
|
-
this.log(" Capture still works via hooks. To enable deep (proxy) capture later:");
|
|
249
|
-
this.log(" rulemetric proxy start && rulemetric hooks install");
|
|
250
|
-
} else {
|
|
251
|
-
const env = settings.env ?? {};
|
|
252
|
-
env.HTTPS_PROXY = `http://localhost:${GATEWAY_PORT}`;
|
|
253
|
-
env.NO_PROXY = RULEMETRIC_NO_PROXY;
|
|
254
|
-
if (existsSync(CERT_PATH)) {
|
|
255
|
-
env.NODE_EXTRA_CA_CERTS = CERT_PATH;
|
|
256
|
-
}
|
|
257
|
-
settings.env = env;
|
|
258
|
-
proxyActive = true;
|
|
259
|
-
this.log(`[OK] HTTPS_PROXY set to gateway on :${GATEWAY_PORT} (verified live)`);
|
|
260
|
-
const cursorProxy = writeCursorProxyConfig(projectPath, GATEWAY_PORT, CERT_PATH);
|
|
261
|
-
if (cursorProxy) {
|
|
262
|
-
this.log("[OK] Cursor proxy configured \u2192 .cursor/settings.json");
|
|
263
|
-
}
|
|
264
|
-
const vscodeProxy = writeVSCodeProxyConfig(projectPath, GATEWAY_PORT, CERT_PATH);
|
|
265
|
-
if (vscodeProxy) {
|
|
266
|
-
this.log("[OK] VS Code workspace proxy configured \u2192 .vscode/settings.json");
|
|
267
|
-
}
|
|
268
|
-
const vscodeUserProxy = writeVSCodeUserProxyConfig(GATEWAY_PORT);
|
|
269
|
-
if (vscodeUserProxy) {
|
|
270
|
-
this.log("[OK] VS Code user proxy configured \u2192 ~/Library/Application Support/Code/User/settings.json");
|
|
271
|
-
}
|
|
272
|
-
const cursorUserProxy = writeCursorUserProxyConfig(GATEWAY_PORT);
|
|
273
|
-
if (cursorUserProxy) {
|
|
274
|
-
this.log("[OK] Cursor user proxy configured \u2192 ~/Library/Application Support/Cursor/User/settings.json");
|
|
275
|
-
}
|
|
276
|
-
if (caTrusted) {
|
|
277
|
-
const macProxy = installMacOSProxyEnv(GATEWAY_PORT, CERT_PATH);
|
|
278
|
-
if (macProxy) {
|
|
279
|
-
this.log("[OK] HTTPS_PROXY set for GUI apps (launchctl + LaunchAgent)");
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
proxyReason = "ca_untrusted";
|
|
283
|
-
this.log("[!!] CA not trusted \u2014 skipping machine-wide GUI proxy (would break native-app TLS).");
|
|
284
|
-
this.log(" Claude Code capture is unaffected. Trust the CA + re-run to enable cross-app capture.");
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (!isGlobal) {
|
|
289
|
-
const cursorHooks = writeCursorHooks(projectPath, hookBinDir);
|
|
290
|
-
if (cursorHooks) {
|
|
291
|
-
this.log(`[OK] Cursor hooks configured \u2192 ${cursorHooks}`);
|
|
292
|
-
}
|
|
293
|
-
const copilotHooks = writeCopilotHooks(projectPath, hookBinDir);
|
|
294
|
-
if (copilotHooks) {
|
|
295
|
-
this.log(`[OK] Copilot Agent hooks configured \u2192 ${copilotHooks}`);
|
|
296
|
-
}
|
|
297
|
-
const antigravityHooks = writeAntigravityHooks(projectPath);
|
|
298
|
-
if (antigravityHooks) {
|
|
299
|
-
this.log(`[OK] Antigravity workspace hooks configured \u2192 ${antigravityHooks}`);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
const antigravityUserHooks = writeAntigravityUserHooks();
|
|
303
|
-
if (antigravityUserHooks) {
|
|
304
|
-
this.log(`[OK] Antigravity user hooks configured \u2192 ${antigravityUserHooks}`);
|
|
305
|
-
}
|
|
306
|
-
const cursorUserHooks = writeCursorUserHooks(hookBinDir);
|
|
307
|
-
if (cursorUserHooks) {
|
|
308
|
-
this.log(`[OK] Cursor user hooks configured \u2192 ${cursorUserHooks}`);
|
|
309
|
-
}
|
|
310
|
-
if (flags["statusline-usage"]) {
|
|
311
|
-
if (isStatuslineShimInstalled(settings)) {
|
|
312
|
-
this.log("[OK] Statusline shim already installed");
|
|
313
|
-
} else {
|
|
314
|
-
const prevCmd = readCurrentStatusLine(settings);
|
|
315
|
-
writeStatuslineShim(prevCmd);
|
|
316
|
-
settings.statusLine = STATUSLINE_SETTINGS_VALUE;
|
|
317
|
-
if (prevCmd) {
|
|
318
|
-
this.log(`[OK] Statusline shim installed \u2192 ${STATUSLINE_SETTINGS_VALUE.command} (chains to: ${prevCmd})`);
|
|
319
|
-
} else {
|
|
320
|
-
this.log(`[OK] Statusline shim installed \u2192 ${STATUSLINE_SETTINGS_VALUE.command}`);
|
|
321
|
-
}
|
|
322
|
-
this.log(" Rate-limit rings will now update on Claude Code's statusline refresh cadence");
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
const { backupPath } = writeClaudeSettingsWithBackup(configPath, settings);
|
|
326
|
-
if (backupPath) {
|
|
327
|
-
this.log(`[OK] Backed up previous settings \u2192 ${backupPath}`);
|
|
328
|
-
}
|
|
329
|
-
this.log("");
|
|
330
|
-
this.log("Setup complete! Next steps:");
|
|
331
|
-
if (isGlobal) {
|
|
332
|
-
this.log(" 1. Install always-on API: rulemetric service install");
|
|
333
|
-
this.log(" 2. Start Claude Code in any project \u2014 all sessions tracked automatically");
|
|
334
|
-
this.log("");
|
|
335
|
-
this.log("The API service starts on login and restarts on crash.");
|
|
336
|
-
} else if (!noProxy) {
|
|
337
|
-
this.log(" 1. Start Claude Code \u2014 sessions are captured by hooks immediately");
|
|
338
|
-
if (proxyActive) {
|
|
339
|
-
this.log(" 2. Full-depth capture is ON \u2014 the proxy is live on :" + GATEWAY_PORT + ".");
|
|
340
|
-
} else {
|
|
341
|
-
this.log(" 2. Enable full depth (proxy not yet live): rulemetric proxy start");
|
|
342
|
-
}
|
|
343
|
-
this.log("");
|
|
344
|
-
this.log("Hooks capture every session (lifecycle + transcript). The proxy adds the");
|
|
345
|
-
this.log("rendered system prompt (instruction-effectiveness linking) + cross-tool capture.");
|
|
346
|
-
this.log("");
|
|
347
|
-
this.log("To capture traffic from other clients (Python, curl, etc.):");
|
|
348
|
-
this.log(' eval "$(rulemetric proxy env --all)"');
|
|
349
|
-
} else {
|
|
350
|
-
this.log(" 1. Start Claude Code \u2014 sessions are captured by the hooks just installed");
|
|
351
|
-
this.log("");
|
|
352
|
-
this.log("No proxy means no mitmproxy / CA cert needed. The hooks capture full");
|
|
353
|
-
this.log("sessions on their own; re-run without --no-proxy to also capture system");
|
|
354
|
-
this.log("prompts for instruction-effectiveness linking.");
|
|
355
|
-
}
|
|
356
|
-
await bootstrapActiveOrg();
|
|
357
|
-
void emitSetupEvent(
|
|
358
|
-
"hooks_installed",
|
|
359
|
-
{ proxy: proxyActive, caTrusted, reason: proxyReason, installers: pkgManagers, global: isGlobal },
|
|
360
|
-
this.config.version
|
|
361
|
-
);
|
|
362
|
-
const tmux = await detectTmux();
|
|
363
|
-
this.log("");
|
|
364
|
-
if (tmux.available) {
|
|
365
|
-
this.log(`[OK] tmux found${tmux.version ? ` (v${tmux.version})` : ""} \u2014 live send enabled`);
|
|
366
|
-
} else {
|
|
367
|
-
this.log("[!!] tmux not found \u2014 live send will fall back to opening Terminal. Install with: brew install tmux");
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
installMitmproxy() {
|
|
371
|
-
for (const [cmd, args] of [
|
|
372
|
-
["pipx", ["install", "mitmproxy"]],
|
|
373
|
-
["uv", ["tool", "install", "mitmproxy"]],
|
|
374
|
-
["brew", ["install", "mitmproxy"]]
|
|
375
|
-
]) {
|
|
376
|
-
const bin = findBinary(cmd);
|
|
377
|
-
if (bin) {
|
|
378
|
-
this.log(` Installing via ${cmd}...`);
|
|
379
|
-
const result = spawnSync(bin, [...args], { stdio: "inherit" });
|
|
380
|
-
if (result.status === 0) return true;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
isCACertTrusted() {
|
|
386
|
-
if (process.platform === "darwin") {
|
|
387
|
-
const result = spawnSync("security", ["verify-cert", "-c", CERT_PATH], {
|
|
388
|
-
stdio: "pipe"
|
|
389
|
-
});
|
|
390
|
-
return result.status === 0;
|
|
391
|
-
}
|
|
392
|
-
if (process.platform === "linux") {
|
|
393
|
-
return existsSync("/usr/local/share/ca-certificates/mitmproxy-ca.crt");
|
|
394
|
-
}
|
|
395
|
-
if (process.platform === "win32") {
|
|
396
|
-
const result = spawnSync("certutil", ["-verify", CERT_PATH], {
|
|
397
|
-
stdio: "pipe"
|
|
398
|
-
});
|
|
399
|
-
return result.status === 0;
|
|
400
|
-
}
|
|
401
|
-
return false;
|
|
402
|
-
}
|
|
403
|
-
trustCACert() {
|
|
404
|
-
if (process.platform === "darwin") {
|
|
405
|
-
const result = spawnSync("sudo", [
|
|
406
|
-
"security",
|
|
407
|
-
"add-trusted-cert",
|
|
408
|
-
"-d",
|
|
409
|
-
"-r",
|
|
410
|
-
"trustRoot",
|
|
411
|
-
"-k",
|
|
412
|
-
"/Library/Keychains/System.keychain",
|
|
413
|
-
CERT_PATH
|
|
414
|
-
], { stdio: "inherit" });
|
|
415
|
-
return result.status === 0;
|
|
416
|
-
}
|
|
417
|
-
if (process.platform === "linux") {
|
|
418
|
-
const cp = spawnSync("sudo", [
|
|
419
|
-
"cp",
|
|
420
|
-
CERT_PATH,
|
|
421
|
-
"/usr/local/share/ca-certificates/mitmproxy-ca.crt"
|
|
422
|
-
], { stdio: "inherit" });
|
|
423
|
-
if (cp.status !== 0) return false;
|
|
424
|
-
const update = spawnSync("sudo", ["update-ca-certificates"], { stdio: "inherit" });
|
|
425
|
-
return update.status === 0;
|
|
426
|
-
}
|
|
427
|
-
if (process.platform === "win32") {
|
|
428
|
-
const result = spawnSync("certutil", [
|
|
429
|
-
"-addstore",
|
|
430
|
-
"-f",
|
|
431
|
-
"Root",
|
|
432
|
-
CERT_PATH
|
|
433
|
-
], { stdio: "inherit" });
|
|
434
|
-
return result.status === 0;
|
|
435
|
-
}
|
|
436
|
-
return false;
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
export {
|
|
440
|
-
HooksInstall as default
|
|
441
|
-
};
|
|
442
|
-
//# sourceMappingURL=install.js.map
|
|
1
|
+
import{a as pt}from"../../chunk-6XEC6474.js";import{B as ut,E as dt,H as gt,I as ht,e as z,f as Q,g as Z,i as tt,j as et,k as st,n as ot,p as it,q as rt,r as at,u as nt,v as lt,y as ct}from"../../chunk-O7ZMHCMG.js";import{a as q,b as W,c as m,d as J,g as A}from"../../chunk-I2DZGJRR.js";import"../../chunk-N7ODX6PO.js";import{a as f}from"../../chunk-67QCYUJU.js";import{c as s,g as X,h as D,i as F,k as O,l as V}from"../../chunk-MVM6OGAF.js";import{e as B}from"../../chunk-KKDHD4XA.js";import"../../chunk-SZ62CP55.js";import{a as Y}from"../../chunk-AHRHCERJ.js";import{a as M}from"../../chunk-LQRYQE6Q.js";import"../../chunk-IZTIYR5Q.js";import{c as N}from"../../chunk-CRAKDQ4H.js";import{b as L}from"../../chunk-WPJ2BND4.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-TIQ7DQ3M.js";import{a as G}from"../../chunk-M6AJDVCL.js";import{a as v}from"../../chunk-ZLLER3HP.js";import{Flags as w}from"@oclif/core";import{execFileSync as ft,spawnSync as l}from"node:child_process";import{existsSync as c}from"node:fs";import{homedir as mt}from"node:os";import{join as _,dirname as Ct}from"node:path";function vt(){try{let d=ft("/bin/sh",["-c","command -v rulemetric"],{encoding:"utf-8"}).trim();if(d&&c(d))return Ct(d)}catch{}}v(vt,"resolveHookBinDir");function wt(){try{return ft("launchctl",["list","com.rulemetric.gateway"],{stdio:["ignore","pipe","pipe"]}),!0}catch{return!1}}v(wt,"isGatewayLaunchdManaged");var o=_(mt(),".mitmproxy","mitmproxy-ca-cert.pem"),R=class d extends M{static{v(this,"HooksInstall")}static description="Install session tracking hooks and context capture proxy for Claude Code";static examples=["<%= config.bin %> hooks install","<%= config.bin %> hooks install --global","<%= config.bin %> hooks install --no-proxy"];static flags={"no-proxy":w.boolean({default:!1,description:"Skip proxy/gateway configuration (hooks only)"}),"project-dir":w.string({description:"Project directory to install hooks in (defaults to cwd)"}),global:w.boolean({char:"g",default:!1,description:"Install hooks globally (~/.claude/settings.json) so all projects are tracked"}),"statusline-usage":w.boolean({default:!1,description:"Install the statusline shim so Claude Code pushes live rate_limits on every refresh (makes /usage rings update in real time without needing the proxy)"})};async run(){let{flags:i}=await this.parse(d),r=i.global,n=r?mt():i["project-dir"]??process.cwd(),x=_(n,".claude"),y=st(x,r),K=r?"settings.json":"settings.local.json",k=i["no-proxy"],P=!1,g=k?"no_proxy_flag":void 0,h=!1,S=[];r&&this.log(`Installing hooks globally \u2192 ${y}`);let{settings:a,recoveredBackup:$}=z(y);if($&&this.log(`[!!] ${y} was not valid JSON \u2014 backed it up to ${$} and continued with a fresh file.`),!r){let e=ot(_(x,"settings.json"),s);e.migrated&&(this.log("[OK] Moved RuleMetric machine-local state out of the shared .claude/settings.json (it now lives in .claude/settings.local.json)"),e.backupPath&&this.log(` Previous shared settings backed up \u2192 ${e.backupPath}`),e.removedStatusline&&c(q)&&!A(a)&&(a.statusLine=m))}let I=G();(I.accessToken||process.env.RULEMETRIC_ACCESS_TOKEN)&&!I.apiKey&&!process.env.RULEMETRIC_API_KEY&&await Y(this.log.bind(this),this.warn.bind(this),this.config.version);let yt=tt(a),C=vt();if(Z(a,C),this.log(yt?`[OK] Refreshed RuleMetric Claude Code session hooks \u2192 .claude/${K}`:`[OK] Installed RuleMetric Claude Code session hooks \u2192 .claude/${K}`),!k){let e=!!f("mitmdump");if(e||(this.log(""),this.log("[!!] mitmproxy not found \u2014 installing..."),S=["brew","pipx","uv"].filter(t=>!!f(t)),e=this.installMitmproxy(),e||(this.log("[!!] Could not install mitmproxy. Skipping proxy config."),this.log(" Install manually: pipx install mitmproxy"),this.log(" Then re-run: rulemetric hooks install"))),c(o))this.log("[OK] CA certificate found");else{this.log("[..] Generating CA certificate...");let t=f("mitmdump");t&&(l(t,["--set","listen_port=0","-q"],{timeout:5e3,stdio:"ignore"}),c(o)?this.log(`[OK] CA certificate generated at ${o}`):this.log("[!!] Could not generate CA cert"))}let u=c(o);u&&!this.isCACertTrusted()?(this.log("[..] Installing CA certificate into system trust store (requires admin)..."),h=this.trustCACert(),h?this.log("[OK] CA certificate trusted by system"):(this.log("[!!] Could not install CA cert automatically."),process.platform==="darwin"?this.log(` Run manually: sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${o}`):process.platform==="linux"&&this.log(` Run manually: sudo cp ${o} /usr/local/share/ca-certificates/mitmproxy-ca.crt && sudo update-ca-certificates`))):u&&(this.log("[OK] CA certificate already trusted"),h=!0);let p=wt(),b=await X(s);if(p)this.log("[OK] Gateway managed by launchd (com.rulemetric.gateway)");else if(b.status==="ours-live")this.log("[OK] Gateway already running");else if(b.status==="foreign"&&F()){this.log("[..] Restarting gateway (running build predates the identity handshake)..."),V(),await new Promise(t=>setTimeout(t,500));try{let t=O(this.config.version);this.log(`[OK] Gateway restarted (PID ${t})`)}catch(t){this.log(`[!!] Could not restart gateway: ${t.message}`)}}else if(b.status!=="foreign")try{let t=O(this.config.version);this.log(`[OK] Gateway started (PID ${t})`)}catch(t){this.log(`[!!] Could not start gateway: ${t.message}`)}let j=await D(s,{timeoutMs:4e3});if(!u)g=e?"ca_not_generated":S.length===0?"no_package_manager":"mitmproxy_install_failed",this.log("[!!] No CA certificate \u2014 NOT setting HTTPS_PROXY (capture stays hooks-only)."),this.log(" Install mitmproxy, then re-run: rulemetric hooks install");else if(j.status==="foreign"&&!p){g="gateway_port_foreign";let t=B(s);this.log(`[!!] Port :${s} is held by a process that is NOT the RuleMetric gateway \u2014 NOT setting HTTPS_PROXY.`),this.log(t?` Holding the port: ${t}`:` Could not identify the holder (try: lsof -nP -iTCP:${s} -sTCP:LISTEN)`),this.log(" Capture still works via hooks. Free the port, then re-run: rulemetric hooks install")}else if(j.status==="dead")g="gateway_not_live",this.log(`[!!] Gateway is not answering on :${s} \u2014 NOT setting HTTPS_PROXY.`),this.log(" Capture still works via hooks. To enable deep (proxy) capture later:"),this.log(" rulemetric proxy start && rulemetric hooks install");else{let t=a.env??{};t.HTTPS_PROXY=`http://localhost:${s}`,t.NO_PROXY=et,c(o)&&(t.NODE_EXTRA_CA_CERTS=o),a.env=t,P=!0,this.log(`[OK] HTTPS_PROXY set to gateway on :${s} (verified live)`),nt(n,s,o)&&this.log("[OK] Cursor proxy configured \u2192 .cursor/settings.json"),lt(n,s,o)&&this.log("[OK] VS Code workspace proxy configured \u2192 .vscode/settings.json"),ut(s)&&this.log("[OK] VS Code user proxy configured \u2192 ~/Library/Application Support/Code/User/settings.json"),dt(s)&&this.log("[OK] Cursor user proxy configured \u2192 ~/Library/Application Support/Cursor/User/settings.json"),h?ct(s,o)&&this.log("[OK] HTTPS_PROXY set for GUI apps (launchctl + LaunchAgent)"):(g="ca_untrusted",this.log("[!!] CA not trusted \u2014 skipping machine-wide GUI proxy (would break native-app TLS)."),this.log(" Claude Code capture is unaffected. Trust the CA + re-run to enable cross-app capture."))}}if(!r){let e=it(n,C);e&&this.log(`[OK] Cursor hooks configured \u2192 ${e}`);let u=at(n,C);u&&this.log(`[OK] Copilot Agent hooks configured \u2192 ${u}`);let p=gt(n);p&&this.log(`[OK] Antigravity workspace hooks configured \u2192 ${p}`)}let E=ht();E&&this.log(`[OK] Antigravity user hooks configured \u2192 ${E}`);let H=rt(C);if(H&&this.log(`[OK] Cursor user hooks configured \u2192 ${H}`),i["statusline-usage"])if(A(a))this.log("[OK] Statusline shim already installed");else{let e=J(a);W(e),a.statusLine=m,e?this.log(`[OK] Statusline shim installed \u2192 ${m.command} (chains to: ${e})`):this.log(`[OK] Statusline shim installed \u2192 ${m.command}`),this.log(" Rate-limit rings will now update on Claude Code's statusline refresh cadence")}let{backupPath:U}=Q(y,a);U&&this.log(`[OK] Backed up previous settings \u2192 ${U}`),this.log(""),this.log("Setup complete! Next steps:"),r?(this.log(" 1. Install always-on API: rulemetric service install"),this.log(" 2. Start Claude Code in any project \u2014 all sessions tracked automatically"),this.log(""),this.log("The API service starts on login and restarts on crash.")):k?(this.log(" 1. Start Claude Code \u2014 sessions are captured by the hooks just installed"),this.log(""),this.log("No proxy means no mitmproxy / CA cert needed. The hooks capture full"),this.log("sessions on their own; re-run without --no-proxy to also capture system"),this.log("prompts for instruction-effectiveness linking.")):(this.log(" 1. Start Claude Code \u2014 sessions are captured by hooks immediately"),P?this.log(" 2. Full-depth capture is ON \u2014 the proxy is live on :"+s+"."):this.log(" 2. Enable full depth (proxy not yet live): rulemetric proxy start"),this.log(""),this.log("Hooks capture every session (lifecycle + transcript). The proxy adds the"),this.log("rendered system prompt (instruction-effectiveness linking) + cross-tool capture."),this.log(""),this.log("To capture traffic from other clients (Python, curl, etc.):"),this.log(' eval "$(rulemetric proxy env --all)"')),await L(),N("hooks_installed",{proxy:P,caTrusted:h,reason:g,installers:S,global:r},this.config.version);let T=await pt();this.log(""),T.available?this.log(`[OK] tmux found${T.version?` (v${T.version})`:""} \u2014 live send enabled`):this.log("[!!] tmux not found \u2014 live send will fall back to opening Terminal. Install with: brew install tmux")}installMitmproxy(){for(let[i,r]of[["pipx",["install","mitmproxy"]],["uv",["tool","install","mitmproxy"]],["brew",["install","mitmproxy"]]]){let n=f(i);if(n&&(this.log(` Installing via ${i}...`),l(n,[...r],{stdio:"inherit"}).status===0))return!0}return!1}isCACertTrusted(){return process.platform==="darwin"?l("security",["verify-cert","-c",o],{stdio:"pipe"}).status===0:process.platform==="linux"?c("/usr/local/share/ca-certificates/mitmproxy-ca.crt"):process.platform==="win32"?l("certutil",["-verify",o],{stdio:"pipe"}).status===0:!1}trustCACert(){return process.platform==="darwin"?l("sudo",["security","add-trusted-cert","-d","-r","trustRoot","-k","/Library/Keychains/System.keychain",o],{stdio:"inherit"}).status===0:process.platform==="linux"?l("sudo",["cp",o,"/usr/local/share/ca-certificates/mitmproxy-ca.crt"],{stdio:"inherit"}).status!==0?!1:l("sudo",["update-ca-certificates"],{stdio:"inherit"}).status===0:process.platform==="win32"?l("certutil",["-addstore","-f","Root",o],{stdio:"inherit"}).status===0:!1}};export{R as default};
|
|
@@ -1,81 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
import "../../chunk-R56PH7YE.js";
|
|
5
|
-
import "../../chunk-GQNJO2P2.js";
|
|
6
|
-
import "../../chunk-37LN5O7M.js";
|
|
7
|
-
import "../../chunk-EKJ2CABV.js";
|
|
8
|
-
import "../../chunk-ZUJBM6HE.js";
|
|
9
|
-
import "../../chunk-W2YERO7E.js";
|
|
10
|
-
import "../../chunk-NSBPE2FW.js";
|
|
11
|
-
|
|
12
|
-
// src/commands/hooks/run.ts
|
|
13
|
-
import { Args } from "@oclif/core";
|
|
14
|
-
import { execFileSync } from "node:child_process";
|
|
15
|
-
import { existsSync } from "node:fs";
|
|
16
|
-
import { join, delimiter } from "node:path";
|
|
17
|
-
var VALID_HOOKS = ["session-start", "session-end", "user-prompt", "post-tool-use", "assistant-response"];
|
|
18
|
-
var HooksRun = class _HooksRun extends BaseCommand {
|
|
19
|
-
static description = "Execute a hook script (called by AI tool hooks, not for direct use)";
|
|
20
|
-
static hidden = true;
|
|
21
|
-
static args = {
|
|
22
|
-
hook: Args.string({
|
|
23
|
-
description: "Hook name to run",
|
|
24
|
-
required: true,
|
|
25
|
-
options: [...VALID_HOOKS]
|
|
26
|
-
})
|
|
27
|
-
};
|
|
28
|
-
async run() {
|
|
29
|
-
const { args } = await this.parse(_HooksRun);
|
|
30
|
-
const hookName = args.hook;
|
|
31
|
-
const { scriptsDir } = await import("@rulemetric/hooks/scripts-dir");
|
|
32
|
-
const scriptPath = join(scriptsDir, `${hookName}.sh`);
|
|
33
|
-
if (!existsSync(scriptPath)) {
|
|
34
|
-
this.error(`Hook script not found: ${scriptPath}`);
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
const stdin = await this.readStdin();
|
|
38
|
-
const augmentedPath = `${process.env.PATH ?? ""}${delimiter}${scriptsDir}`;
|
|
39
|
-
const timeout = hookName === "session-end" ? 3e4 : 1e4;
|
|
40
|
-
execFileSync("bash", [scriptPath], {
|
|
41
|
-
input: stdin,
|
|
42
|
-
stdio: ["pipe", "inherit", "inherit"],
|
|
43
|
-
timeout,
|
|
44
|
-
env: { ...process.env, PATH: augmentedPath }
|
|
45
|
-
});
|
|
46
|
-
if (process.env.RULEMETRIC_HOOK_TOOL === "antigravity" && hookName === "post-tool-use") {
|
|
47
|
-
try {
|
|
48
|
-
const { tailAntigravityTranscript } = await import("../../lib/antigravity-transcript.js");
|
|
49
|
-
await tailAntigravityTranscript(stdin);
|
|
50
|
-
} catch (err) {
|
|
51
|
-
process.stderr.write(
|
|
52
|
-
`[antigravity-tailer] ${err.message}
|
|
53
|
-
`
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
} catch (error) {
|
|
58
|
-
const code = error.status;
|
|
59
|
-
if (process.env.RULEMETRIC_HOOK_DEBUG) {
|
|
60
|
-
process.stderr.write(
|
|
61
|
-
`[rulemetric hooks run ${hookName}] non-fatal exit ${code ?? "?"}: ${error.message ?? ""}
|
|
62
|
-
`
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
readStdin() {
|
|
68
|
-
return new Promise((resolve) => {
|
|
69
|
-
const chunks = [];
|
|
70
|
-
process.stdin.on("data", (chunk) => chunks.push(chunk));
|
|
71
|
-
process.stdin.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")));
|
|
72
|
-
if (process.stdin.readableEnded) {
|
|
73
|
-
resolve(Buffer.concat(chunks).toString("utf-8"));
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
HooksRun as default
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=run.js.map
|
|
1
|
+
import{a as d}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 as c}from"../../chunk-ZLLER3HP.js";import{Args as m}from"@oclif/core";import{execFileSync as u}from"node:child_process";import{existsSync as f}from"node:fs";import{join as h,delimiter as g}from"node:path";var l=["session-start","session-end","user-prompt","post-tool-use","assistant-response"],a=class p extends d{static{c(this,"HooksRun")}static description="Execute a hook script (called by AI tool hooks, not for direct use)";static hidden=!0;static args={hook:m.string({description:"Hook name to run",required:!0,options:[...l]})};async run(){let{args:r}=await this.parse(p),t=r.hook,{scriptsDir:e}=await import("@rulemetric/hooks/scripts-dir"),o=h(e,`${t}.sh`);f(o)||this.error(`Hook script not found: ${o}`);try{let s=await this.readStdin(),i=`${process.env.PATH??""}${g}${e}`;if(u("bash",[o],{input:s,stdio:["pipe","inherit","inherit"],timeout:t==="session-end"?3e4:1e4,env:{...process.env,PATH:i}}),process.env.RULEMETRIC_HOOK_TOOL==="antigravity"&&t==="post-tool-use")try{let{tailAntigravityTranscript:n}=await import("../../lib/antigravity-transcript.js");await n(s)}catch(n){process.stderr.write(`[antigravity-tailer] ${n.message}
|
|
2
|
+
`)}}catch(s){let i=s.status;process.env.RULEMETRIC_HOOK_DEBUG&&process.stderr.write(`[rulemetric hooks run ${t}] non-fatal exit ${i??"?"}: ${s.message??""}
|
|
3
|
+
`)}}readStdin(){return new Promise(r=>{let t=[];process.stdin.on("data",e=>t.push(e)),process.stdin.on("end",()=>r(Buffer.concat(t).toString("utf-8"))),process.stdin.readableEnded&&r(Buffer.concat(t).toString("utf-8"))})}};export{a as default};
|