@rulemetric/cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +13 -52
- package/dist/base-command.js.map +7 -1
- package/dist/chunk-2AM54TUK.js +59 -0
- package/dist/chunk-2AM54TUK.js.map +7 -0
- package/dist/chunk-3TIMQ3O6.js +96 -0
- package/dist/chunk-3TIMQ3O6.js.map +7 -0
- package/dist/chunk-4BHDHHKL.js +48 -0
- package/dist/chunk-4BHDHHKL.js.map +7 -0
- package/dist/chunk-4D537GXE.js +99 -0
- package/dist/chunk-4D537GXE.js.map +7 -0
- package/dist/chunk-4SCZK7AL.js +129 -0
- package/dist/chunk-4SCZK7AL.js.map +7 -0
- package/dist/chunk-4WFE4PFP.js +61 -0
- package/dist/chunk-4WFE4PFP.js.map +7 -0
- package/dist/chunk-52WIYRZH.js +73 -0
- package/dist/chunk-52WIYRZH.js.map +7 -0
- package/dist/chunk-7FAA3YNB.js +1549 -0
- package/dist/chunk-7FAA3YNB.js.map +7 -0
- package/dist/chunk-7NYKWN7U.js +12 -0
- package/dist/chunk-7NYKWN7U.js.map +7 -0
- package/dist/chunk-AULP2OWH.js +99 -0
- package/dist/chunk-AULP2OWH.js.map +7 -0
- package/dist/chunk-B5KNTGMJ.js +1788 -0
- package/dist/chunk-B5KNTGMJ.js.map +7 -0
- package/dist/chunk-BD7CY42U.js +23 -0
- package/dist/chunk-BD7CY42U.js.map +7 -0
- package/dist/chunk-BO76WKJR.js +42 -0
- package/dist/chunk-BO76WKJR.js.map +7 -0
- package/dist/chunk-BRD5RUGM.js +53 -0
- package/dist/chunk-BRD5RUGM.js.map +7 -0
- package/dist/chunk-BT6Z6545.js +43 -0
- package/dist/chunk-BT6Z6545.js.map +7 -0
- package/dist/chunk-BZDKEQKU.js +39 -0
- package/dist/chunk-BZDKEQKU.js.map +7 -0
- package/dist/chunk-CROYS75W.js +161 -0
- package/dist/chunk-CROYS75W.js.map +7 -0
- package/dist/chunk-DGHWRQXL.js +17 -0
- package/dist/chunk-DGHWRQXL.js.map +7 -0
- package/dist/chunk-DQ3KELXD.js +74 -0
- package/dist/chunk-DQ3KELXD.js.map +7 -0
- package/dist/chunk-DTFXCHHI.js +108 -0
- package/dist/chunk-DTFXCHHI.js.map +7 -0
- package/dist/chunk-DU73QUS3.js +75 -0
- package/dist/chunk-DU73QUS3.js.map +7 -0
- package/dist/chunk-EHZJ6OXD.js +307 -0
- package/dist/chunk-EHZJ6OXD.js.map +7 -0
- package/dist/chunk-EJOI2ZGU.js +109 -0
- package/dist/chunk-EJOI2ZGU.js.map +7 -0
- package/dist/chunk-EKJ2CABV.js +76 -0
- package/dist/chunk-EKJ2CABV.js.map +7 -0
- package/dist/chunk-EKP32DLN.js +16 -0
- package/dist/chunk-EKP32DLN.js.map +7 -0
- package/dist/chunk-EOOP6WTC.js +148 -0
- package/dist/chunk-EOOP6WTC.js.map +7 -0
- package/dist/chunk-ERPMDAO3.js +20 -0
- package/dist/chunk-ERPMDAO3.js.map +7 -0
- package/dist/chunk-FTJRMUID.js +96 -0
- package/dist/chunk-FTJRMUID.js.map +7 -0
- package/dist/chunk-FZKLLNDS.js +228 -0
- package/dist/chunk-FZKLLNDS.js.map +7 -0
- package/dist/chunk-GQCISMAH.js +157 -0
- package/dist/chunk-GQCISMAH.js.map +7 -0
- package/dist/chunk-IGXX624H.js +55 -0
- package/dist/chunk-IGXX624H.js.map +7 -0
- package/dist/chunk-IJGF2ETG.js +68 -0
- package/dist/chunk-IJGF2ETG.js.map +7 -0
- package/dist/chunk-IWYCRLEK.js +220 -0
- package/dist/chunk-IWYCRLEK.js.map +7 -0
- package/dist/chunk-J7N3DLH6.js +117 -0
- package/dist/chunk-J7N3DLH6.js.map +7 -0
- package/dist/chunk-JX5UI6RW.js +99 -0
- package/dist/chunk-JX5UI6RW.js.map +7 -0
- package/dist/chunk-K3BFZ7KG.js +154 -0
- package/dist/chunk-K3BFZ7KG.js.map +7 -0
- package/dist/chunk-KHJUQFIK.js +51 -0
- package/dist/chunk-KHJUQFIK.js.map +7 -0
- package/dist/chunk-KRBQLMOP.js +41 -0
- package/dist/chunk-KRBQLMOP.js.map +7 -0
- package/dist/chunk-KZRFUXGF.js +145 -0
- package/dist/chunk-KZRFUXGF.js.map +7 -0
- package/dist/chunk-L674RNKQ.js +492 -0
- package/dist/chunk-L674RNKQ.js.map +7 -0
- package/dist/chunk-N52AHNBH.js +47 -0
- package/dist/chunk-N52AHNBH.js.map +7 -0
- package/dist/chunk-NIDLJO6F.js +228 -0
- package/dist/chunk-NIDLJO6F.js.map +7 -0
- package/dist/chunk-NSBPE2FW.js +17 -0
- package/dist/chunk-NSBPE2FW.js.map +7 -0
- package/dist/chunk-OGVORIFM.js +70 -0
- package/dist/chunk-OGVORIFM.js.map +7 -0
- package/dist/chunk-OQSQC7VB.js +77 -0
- package/dist/chunk-OQSQC7VB.js.map +7 -0
- package/dist/chunk-PHLMIZKM.js +153 -0
- package/dist/chunk-PHLMIZKM.js.map +7 -0
- package/dist/chunk-PQU7GZ7A.js +92 -0
- package/dist/chunk-PQU7GZ7A.js.map +7 -0
- package/dist/chunk-PXVQLD7S.js +196 -0
- package/dist/chunk-PXVQLD7S.js.map +7 -0
- package/dist/chunk-QD6X4L4L.js +79 -0
- package/dist/chunk-QD6X4L4L.js.map +7 -0
- package/dist/chunk-QJQS6TUN.js +44 -0
- package/dist/chunk-QJQS6TUN.js.map +7 -0
- package/dist/chunk-QJXAULRC.js +191 -0
- package/dist/chunk-QJXAULRC.js.map +7 -0
- package/dist/chunk-QN34TGD3.js +83 -0
- package/dist/chunk-QN34TGD3.js.map +7 -0
- package/dist/chunk-R5MFHGHR.js +122 -0
- package/dist/chunk-R5MFHGHR.js.map +7 -0
- package/dist/chunk-RH7NHVSK.js +16 -0
- package/dist/chunk-RH7NHVSK.js.map +7 -0
- package/dist/chunk-RJ7BHDLM.js +121 -0
- package/dist/chunk-RJ7BHDLM.js.map +7 -0
- package/dist/chunk-RQ2TMLKG.js +142 -0
- package/dist/chunk-RQ2TMLKG.js.map +7 -0
- package/dist/chunk-S56LOTGQ.js +63 -0
- package/dist/chunk-S56LOTGQ.js.map +7 -0
- package/dist/chunk-UF73WX2J.js +49 -0
- package/dist/chunk-UF73WX2J.js.map +7 -0
- package/dist/chunk-W53GKIZQ.js +50 -0
- package/dist/chunk-W53GKIZQ.js.map +7 -0
- package/dist/chunk-WA4MWYRW.js +254 -0
- package/dist/chunk-WA4MWYRW.js.map +7 -0
- package/dist/chunk-WFULKPEQ.js +269 -0
- package/dist/chunk-WFULKPEQ.js.map +7 -0
- package/dist/chunk-XC6M4CSW.js +44 -0
- package/dist/chunk-XC6M4CSW.js.map +7 -0
- package/dist/chunk-XPUEGHXN.js +243 -0
- package/dist/chunk-XPUEGHXN.js.map +7 -0
- package/dist/chunk-XZXS2W24.js +148 -0
- package/dist/chunk-XZXS2W24.js.map +7 -0
- package/dist/chunk-YBNW7ARH.js +167 -0
- package/dist/chunk-YBNW7ARH.js.map +7 -0
- package/dist/chunk-YNIH3KMU.js +121 -0
- package/dist/chunk-YNIH3KMU.js.map +7 -0
- package/dist/commands/antigravity/backfill.js +135 -0
- package/dist/commands/antigravity/backfill.js.map +7 -0
- package/dist/commands/auth/create-key.js +48 -33
- package/dist/commands/auth/create-key.js.map +7 -1
- package/dist/commands/auth/login.js +58 -46
- package/dist/commands/auth/login.js.map +7 -1
- package/dist/commands/auth/logout.js +28 -13
- package/dist/commands/auth/logout.js.map +7 -1
- package/dist/commands/auth/revoke-key.js +32 -18
- package/dist/commands/auth/revoke-key.js.map +7 -1
- package/dist/commands/auth/status.js +40 -22
- package/dist/commands/auth/status.js.map +7 -1
- package/dist/commands/catalog/index.js +50 -34
- package/dist/commands/catalog/index.js.map +7 -1
- package/dist/commands/catalog/recommend.js +41 -26
- package/dist/commands/catalog/recommend.js.map +7 -1
- package/dist/commands/convert.js +72 -54
- package/dist/commands/convert.js.map +7 -1
- package/dist/commands/converters.js +52 -38
- package/dist/commands/converters.js.map +7 -1
- package/dist/commands/crons/list.js +50 -24
- package/dist/commands/crons/list.js.map +7 -1
- package/dist/commands/crons/run.js +72 -47
- package/dist/commands/crons/run.js.map +7 -1
- package/dist/commands/dashboard.js +45 -24
- package/dist/commands/dashboard.js.map +7 -1
- package/dist/commands/eval-targets/create.js +51 -39
- package/dist/commands/eval-targets/create.js.map +7 -1
- package/dist/commands/eval-targets/list.js +52 -35
- package/dist/commands/eval-targets/list.js.map +7 -1
- package/dist/commands/evals/agent.js +292 -0
- package/dist/commands/evals/agent.js.map +7 -0
- package/dist/commands/evals/benchmark.js +70 -51
- package/dist/commands/evals/benchmark.js.map +7 -1
- package/dist/commands/evals/compare.js +90 -78
- package/dist/commands/evals/compare.js.map +7 -1
- package/dist/commands/evals/create.js +64 -50
- package/dist/commands/evals/create.js.map +7 -1
- package/dist/commands/evals/optimize-description.js +225 -222
- package/dist/commands/evals/optimize-description.js.map +7 -1
- package/dist/commands/evals/optimize.js +206 -196
- package/dist/commands/evals/optimize.js.map +7 -1
- package/dist/commands/evals/run.js +178 -164
- package/dist/commands/evals/run.js.map +7 -1
- package/dist/commands/gateway/ensure.js +33 -19
- package/dist/commands/gateway/ensure.js.map +7 -1
- package/dist/commands/hooks/install.js +335 -275
- package/dist/commands/hooks/install.js.map +7 -1
- package/dist/commands/hooks/run.js +72 -53
- package/dist/commands/hooks/run.js.map +7 -1
- package/dist/commands/hooks/uninstall.js +117 -94
- package/dist/commands/hooks/uninstall.js.map +7 -1
- package/dist/commands/import.js +63 -53
- package/dist/commands/import.js.map +7 -1
- package/dist/commands/instructions/create.js +71 -58
- package/dist/commands/instructions/create.js.map +7 -1
- package/dist/commands/instructions/delete.js +53 -36
- package/dist/commands/instructions/delete.js.map +7 -1
- package/dist/commands/instructions/fork.js +33 -19
- package/dist/commands/instructions/fork.js.map +7 -1
- package/dist/commands/instructions/get.js +66 -49
- package/dist/commands/instructions/get.js.map +7 -1
- package/dist/commands/instructions/list.js +63 -46
- package/dist/commands/instructions/list.js.map +7 -1
- package/dist/commands/instructions/promote.js +41 -27
- package/dist/commands/instructions/promote.js.map +7 -1
- package/dist/commands/instructions/pull.js +37 -21
- package/dist/commands/instructions/pull.js.map +7 -1
- package/dist/commands/instructions/upstream.js +36 -21
- package/dist/commands/instructions/upstream.js.map +7 -1
- package/dist/commands/instructions/versions.js +51 -33
- package/dist/commands/instructions/versions.js.map +7 -1
- package/dist/commands/launcher.js +39 -0
- package/dist/commands/launcher.js.map +7 -0
- package/dist/commands/org/current.js +74 -68
- package/dist/commands/org/current.js.map +7 -1
- package/dist/commands/org/list.js +50 -36
- package/dist/commands/org/list.js.map +7 -1
- package/dist/commands/org/switch.js +69 -51
- package/dist/commands/org/switch.js.map +7 -1
- package/dist/commands/packs/add-instruction.js +36 -22
- package/dist/commands/packs/add-instruction.js.map +7 -1
- package/dist/commands/packs/apply.js +38 -24
- package/dist/commands/packs/apply.js.map +7 -1
- package/dist/commands/packs/create.js +47 -33
- package/dist/commands/packs/create.js.map +7 -1
- package/dist/commands/packs/fork.js +33 -19
- package/dist/commands/packs/fork.js.map +7 -1
- package/dist/commands/packs/get.js +54 -35
- package/dist/commands/packs/get.js.map +7 -1
- package/dist/commands/packs/list.js +64 -47
- package/dist/commands/packs/list.js.map +7 -1
- package/dist/commands/packs/remove-instruction.js +34 -20
- package/dist/commands/packs/remove-instruction.js.map +7 -1
- package/dist/commands/proxy/env.js +126 -116
- package/dist/commands/proxy/env.js.map +7 -1
- package/dist/commands/proxy/logs.js +83 -74
- package/dist/commands/proxy/logs.js.map +7 -1
- package/dist/commands/proxy/restart.js +34 -36
- package/dist/commands/proxy/restart.js.map +7 -1
- package/dist/commands/proxy/setup.js +432 -375
- package/dist/commands/proxy/setup.js.map +7 -1
- package/dist/commands/proxy/start.js +289 -289
- package/dist/commands/proxy/start.js.map +7 -1
- package/dist/commands/proxy/status.js +74 -64
- package/dist/commands/proxy/status.js.map +7 -1
- package/dist/commands/proxy/stop.js +81 -75
- package/dist/commands/proxy/stop.js.map +7 -1
- package/dist/commands/research/backfill.js +58 -0
- package/dist/commands/research/backfill.js.map +7 -0
- package/dist/commands/research/tail-transcript.js +69 -0
- package/dist/commands/research/tail-transcript.js.map +7 -0
- package/dist/commands/service/install.js +639 -405
- package/dist/commands/service/install.js.map +7 -1
- package/dist/commands/service/status.js +178 -111
- package/dist/commands/service/status.js.map +7 -1
- package/dist/commands/service/uninstall.js +85 -110
- package/dist/commands/service/uninstall.js.map +7 -1
- package/dist/commands/sessions/analyze.js +46 -25
- package/dist/commands/sessions/analyze.js.map +7 -1
- package/dist/commands/sessions/end.js +81 -79
- package/dist/commands/sessions/end.js.map +7 -1
- package/dist/commands/sessions/import.js +44 -27
- package/dist/commands/sessions/import.js.map +7 -1
- package/dist/commands/sessions/list.js +46 -33
- package/dist/commands/sessions/list.js.map +7 -1
- package/dist/commands/sessions/start.js +88 -87
- package/dist/commands/sessions/start.js.map +7 -1
- package/dist/commands/signals/report.js +42 -34
- package/dist/commands/signals/report.js.map +7 -1
- package/dist/commands/skills/export-approved.js +44 -30
- package/dist/commands/skills/export-approved.js.map +7 -1
- package/dist/commands/skills/install.js +99 -84
- package/dist/commands/skills/install.js.map +7 -1
- package/dist/commands/skills/list.js +59 -42
- package/dist/commands/skills/list.js.map +7 -1
- package/dist/commands/skills/publish.js +95 -78
- package/dist/commands/skills/publish.js.map +7 -1
- package/dist/commands/skills/search.js +68 -53
- package/dist/commands/skills/search.js.map +7 -1
- package/dist/commands/skills/update.js +52 -39
- package/dist/commands/skills/update.js.map +7 -1
- package/dist/commands/suggestions/accept.js +82 -59
- package/dist/commands/suggestions/accept.js.map +7 -1
- package/dist/commands/suggestions/dismiss.js +44 -26
- package/dist/commands/suggestions/dismiss.js.map +7 -1
- package/dist/commands/suggestions/list.js +59 -39
- package/dist/commands/suggestions/list.js.map +7 -1
- package/dist/commands/suggestions/refresh.js +26 -11
- package/dist/commands/suggestions/refresh.js.map +7 -1
- package/dist/cursor-BGQJ4CWI.js +134 -0
- package/dist/cursor-BGQJ4CWI.js.map +7 -0
- package/dist/dashboard/Dashboard.js +229 -126
- package/dist/dashboard/Dashboard.js.map +7 -1
- package/dist/dashboard/data.js +13 -137
- package/dist/dashboard/data.js.map +7 -1
- package/dist/dashboard/launcher/ActiveJobsList.js +10 -0
- package/dist/dashboard/launcher/ActiveJobsList.js.map +7 -0
- package/dist/dashboard/launcher/LauncherOverlay.js +14 -0
- package/dist/dashboard/launcher/LauncherOverlay.js.map +7 -0
- package/dist/dashboard/launcher/NewLaunchForm.js +10 -0
- package/dist/dashboard/launcher/NewLaunchForm.js.map +7 -0
- package/dist/dashboard/launcher/api.js +14 -0
- package/dist/dashboard/launcher/api.js.map +7 -0
- package/dist/dashboard/launcher/tool-labels.js +10 -0
- package/dist/dashboard/launcher/tool-labels.js.map +7 -0
- package/dist/dashboard/launcher/types.js +1 -0
- package/dist/dashboard/launcher/types.js.map +7 -0
- package/dist/dashboard/launcher/useLaunchJobs.js +9 -0
- package/dist/dashboard/launcher/useLaunchJobs.js.map +7 -0
- package/dist/dashboard/panels/friction.js +10 -22
- package/dist/dashboard/panels/friction.js.map +7 -1
- package/dist/dashboard/panels/insights.js +10 -109
- package/dist/dashboard/panels/insights.js.map +7 -1
- package/dist/dashboard/panels/instructions.js +10 -17
- package/dist/dashboard/panels/instructions.js.map +7 -1
- package/dist/dashboard/panels/outcomes.js +9 -28
- package/dist/dashboard/panels/outcomes.js.map +7 -1
- package/dist/dashboard/panels/overview.js +10 -20
- package/dist/dashboard/panels/overview.js.map +7 -1
- package/dist/dashboard/panels/shared.js +18 -61
- package/dist/dashboard/panels/shared.js.map +7 -1
- package/dist/dashboard/types.js +23 -26
- package/dist/dashboard/types.js.map +7 -1
- package/dist/dist-CSUYFYKI.js +52 -0
- package/dist/dist-CSUYFYKI.js.map +7 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +7 -1
- package/dist/lib/active-org-refresh.js +15 -108
- package/dist/lib/active-org-refresh.js.map +7 -1
- package/dist/lib/active-org.js +15 -95
- package/dist/lib/active-org.js.map +7 -1
- package/dist/lib/agent-loop.js +44 -0
- package/dist/lib/agent-loop.js.map +7 -0
- package/dist/lib/antigravity-transcript.js +22 -0
- package/dist/lib/antigravity-transcript.js.map +7 -0
- package/dist/lib/api-client.js +21 -92
- package/dist/lib/api-client.js.map +7 -1
- package/dist/lib/auth.js +26 -137
- package/dist/lib/auth.js.map +7 -1
- package/dist/lib/detect-languages.js +8 -113
- package/dist/lib/detect-languages.js.map +7 -1
- package/dist/lib/detect-tmux.js +9 -0
- package/dist/lib/detect-tmux.js.map +7 -0
- package/dist/lib/eval-analyzer.js +9 -89
- package/dist/lib/eval-analyzer.js.map +7 -1
- package/dist/lib/eval-benchmark.js +12 -92
- package/dist/lib/eval-benchmark.js.map +7 -1
- package/dist/lib/eval-conversation-handler.js +13 -200
- package/dist/lib/eval-conversation-handler.js.map +7 -1
- package/dist/lib/eval-executor.js +8 -83
- package/dist/lib/eval-executor.js.map +7 -1
- package/dist/lib/eval-grader.js +9 -123
- package/dist/lib/eval-grader.js.map +7 -1
- package/dist/lib/eval-meta-judge.js +9 -116
- package/dist/lib/eval-meta-judge.js.map +7 -1
- package/dist/lib/eval-trigger-tester.js +11 -96
- package/dist/lib/eval-trigger-tester.js.map +7 -1
- package/dist/lib/eval-worktree.js +8 -87
- package/dist/lib/eval-worktree.js.map +7 -1
- package/dist/lib/gateway-entry.js +20 -18
- package/dist/lib/gateway-entry.js.map +7 -1
- package/dist/lib/gateway-lifecycle.js +22 -97
- package/dist/lib/gateway-lifecycle.js.map +7 -1
- package/dist/lib/gateway.js +12 -216
- package/dist/lib/gateway.js.map +7 -1
- package/dist/lib/handlers/cron-close-stale-sessions.js +18 -7
- package/dist/lib/handlers/cron-close-stale-sessions.js.map +7 -1
- package/dist/lib/handlers/cron-data-integrity-audit.js +21 -15
- package/dist/lib/handlers/cron-data-integrity-audit.js.map +7 -1
- package/dist/lib/handlers/cron-refresh-skills.js +7 -90
- package/dist/lib/handlers/cron-refresh-skills.js.map +7 -1
- package/dist/lib/handlers/cron-suggest-instructions.js +14 -158
- package/dist/lib/handlers/cron-suggest-instructions.js.map +7 -1
- package/dist/lib/handlers/process-announcement.js +11 -0
- package/dist/lib/handlers/process-announcement.js.map +7 -0
- package/dist/lib/handlers/process-changelog.js +11 -0
- package/dist/lib/handlers/process-changelog.js.map +7 -0
- package/dist/lib/handlers/process-conversation.js +14 -35
- package/dist/lib/handlers/process-conversation.js.map +7 -1
- package/dist/lib/handlers/process-eval.js +15 -207
- package/dist/lib/handlers/process-eval.js.map +7 -1
- package/dist/lib/handlers/process-insights.js +14 -300
- package/dist/lib/handlers/process-insights.js.map +7 -1
- package/dist/lib/handlers/process-launch.js +16 -41
- package/dist/lib/handlers/process-launch.js.map +7 -1
- package/dist/lib/handlers/process-run-cleanup.js +13 -0
- package/dist/lib/handlers/process-run-cleanup.js.map +7 -0
- package/dist/lib/handlers/process-send-message.js +10 -0
- package/dist/lib/handlers/process-send-message.js.map +7 -0
- package/dist/lib/handlers/process-session-goal.js +11 -74
- package/dist/lib/handlers/process-session-goal.js.map +7 -1
- package/dist/lib/hooks-config.js +52 -544
- package/dist/lib/hooks-config.js.map +7 -1
- package/dist/lib/insights-prompts.js +12 -145
- package/dist/lib/insights-prompts.js.map +7 -1
- package/dist/lib/job-helpers.js +1 -0
- package/dist/lib/job-helpers.js.map +7 -0
- package/dist/lib/llm-client.js +16 -274
- package/dist/lib/llm-client.js.map +7 -1
- package/dist/lib/manual-tasks.js +22 -0
- package/dist/lib/manual-tasks.js.map +7 -0
- package/dist/lib/output.js +12 -36
- package/dist/lib/output.js.map +7 -1
- package/dist/lib/permanent-job-error.js +10 -23
- package/dist/lib/permanent-job-error.js.map +7 -1
- package/dist/lib/provider-aggregator.js +57 -55
- package/dist/lib/provider-aggregator.js.map +7 -1
- package/dist/lib/research-client.js +12 -0
- package/dist/lib/research-client.js.map +7 -0
- package/dist/lib/skills-loader.js +8 -51
- package/dist/lib/skills-loader.js.map +7 -1
- package/dist/lib/statusline-shim.js +16 -0
- package/dist/lib/statusline-shim.js.map +7 -0
- package/dist/lib/terminal-target-heartbeat.js +15 -0
- package/dist/lib/terminal-target-heartbeat.js.map +7 -0
- package/dist/lib/tmux.js +16 -0
- package/dist/lib/tmux.js.map +7 -0
- package/dist/lib/transcript-rate-limit-watcher.js +22 -0
- package/dist/lib/transcript-rate-limit-watcher.js.map +7 -0
- package/dist/lib/types.js +8 -7
- package/dist/lib/types.js.map +7 -1
- package/dist/lib/version-check.js +10 -106
- package/dist/lib/version-check.js.map +7 -1
- package/dist/lib/which.js +8 -0
- package/dist/lib/which.js.map +7 -0
- package/dist/lib/worktree.js +17 -0
- package/dist/lib/worktree.js.map +7 -0
- package/dist/opencode-IQ7X5YMJ.js +190 -0
- package/dist/opencode-IQ7X5YMJ.js.map +7 -0
- package/oclif.manifest.json +299 -66
- package/package.json +27 -11
- package/dist/base-command.d.ts +0 -12
- package/dist/base-command.d.ts.map +0 -1
- package/dist/commands/auth/create-key.d.ts +0 -11
- package/dist/commands/auth/create-key.d.ts.map +0 -1
- package/dist/commands/auth/login.d.ts +0 -11
- package/dist/commands/auth/login.d.ts.map +0 -1
- package/dist/commands/auth/logout.d.ts +0 -7
- package/dist/commands/auth/logout.d.ts.map +0 -1
- package/dist/commands/auth/revoke-key.d.ts +0 -10
- package/dist/commands/auth/revoke-key.d.ts.map +0 -1
- package/dist/commands/auth/status.d.ts +0 -7
- package/dist/commands/auth/status.d.ts.map +0 -1
- package/dist/commands/catalog/index.d.ts +0 -11
- package/dist/commands/catalog/index.d.ts.map +0 -1
- package/dist/commands/catalog/recommend.d.ts +0 -9
- package/dist/commands/catalog/recommend.d.ts.map +0 -1
- package/dist/commands/convert.d.ts +0 -15
- package/dist/commands/convert.d.ts.map +0 -1
- package/dist/commands/converters.d.ts +0 -12
- package/dist/commands/converters.d.ts.map +0 -1
- package/dist/commands/crons/list.d.ts +0 -7
- package/dist/commands/crons/list.d.ts.map +0 -1
- package/dist/commands/crons/run.d.ts +0 -13
- package/dist/commands/crons/run.d.ts.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -10
- package/dist/commands/dashboard.d.ts.map +0 -1
- package/dist/commands/eval-targets/create.d.ts +0 -14
- package/dist/commands/eval-targets/create.d.ts.map +0 -1
- package/dist/commands/eval-targets/list.d.ts +0 -10
- package/dist/commands/eval-targets/list.d.ts.map +0 -1
- package/dist/commands/evals/benchmark.d.ts +0 -13
- package/dist/commands/evals/benchmark.d.ts.map +0 -1
- package/dist/commands/evals/compare.d.ts +0 -15
- package/dist/commands/evals/compare.d.ts.map +0 -1
- package/dist/commands/evals/create.d.ts +0 -17
- package/dist/commands/evals/create.d.ts.map +0 -1
- package/dist/commands/evals/listen.d.ts +0 -37
- package/dist/commands/evals/listen.d.ts.map +0 -1
- package/dist/commands/evals/listen.js +0 -188
- package/dist/commands/evals/listen.js.map +0 -1
- package/dist/commands/evals/listen.test.d.ts +0 -2
- package/dist/commands/evals/listen.test.d.ts.map +0 -1
- package/dist/commands/evals/listen.test.js +0 -48
- package/dist/commands/evals/listen.test.js.map +0 -1
- package/dist/commands/evals/optimize-description.d.ts +0 -22
- package/dist/commands/evals/optimize-description.d.ts.map +0 -1
- package/dist/commands/evals/optimize.d.ts +0 -22
- package/dist/commands/evals/optimize.d.ts.map +0 -1
- package/dist/commands/evals/run.d.ts +0 -21
- package/dist/commands/evals/run.d.ts.map +0 -1
- package/dist/commands/gateway/ensure.d.ts +0 -7
- package/dist/commands/gateway/ensure.d.ts.map +0 -1
- package/dist/commands/hooks/install.d.ts +0 -16
- package/dist/commands/hooks/install.d.ts.map +0 -1
- package/dist/commands/hooks/run.d.ts +0 -11
- package/dist/commands/hooks/run.d.ts.map +0 -1
- package/dist/commands/hooks/uninstall.d.ts +0 -7
- package/dist/commands/hooks/uninstall.d.ts.map +0 -1
- package/dist/commands/import.d.ts +0 -17
- package/dist/commands/import.d.ts.map +0 -1
- package/dist/commands/instructions/create.d.ts +0 -17
- package/dist/commands/instructions/create.d.ts.map +0 -1
- package/dist/commands/instructions/delete.d.ts +0 -13
- package/dist/commands/instructions/delete.d.ts.map +0 -1
- package/dist/commands/instructions/fork.d.ts +0 -10
- package/dist/commands/instructions/fork.d.ts.map +0 -1
- package/dist/commands/instructions/get.d.ts +0 -15
- package/dist/commands/instructions/get.d.ts.map +0 -1
- package/dist/commands/instructions/list.d.ts +0 -12
- package/dist/commands/instructions/list.d.ts.map +0 -1
- package/dist/commands/instructions/promote.d.ts +0 -14
- package/dist/commands/instructions/promote.d.ts.map +0 -1
- package/dist/commands/instructions/pull.d.ts +0 -9
- package/dist/commands/instructions/pull.d.ts.map +0 -1
- package/dist/commands/instructions/upstream.d.ts +0 -9
- package/dist/commands/instructions/upstream.d.ts.map +0 -1
- package/dist/commands/instructions/versions.d.ts +0 -12
- package/dist/commands/instructions/versions.d.ts.map +0 -1
- package/dist/commands/org/current.d.ts +0 -7
- package/dist/commands/org/current.d.ts.map +0 -1
- package/dist/commands/org/list.d.ts +0 -7
- package/dist/commands/org/list.d.ts.map +0 -1
- package/dist/commands/org/switch.d.ts +0 -13
- package/dist/commands/org/switch.d.ts.map +0 -1
- package/dist/commands/packs/add-instruction.d.ts +0 -11
- package/dist/commands/packs/add-instruction.d.ts.map +0 -1
- package/dist/commands/packs/apply.d.ts +0 -13
- package/dist/commands/packs/apply.d.ts.map +0 -1
- package/dist/commands/packs/create.d.ts +0 -13
- package/dist/commands/packs/create.d.ts.map +0 -1
- package/dist/commands/packs/fork.d.ts +0 -10
- package/dist/commands/packs/fork.d.ts.map +0 -1
- package/dist/commands/packs/get.d.ts +0 -10
- package/dist/commands/packs/get.d.ts.map +0 -1
- package/dist/commands/packs/list.d.ts +0 -22
- package/dist/commands/packs/list.d.ts.map +0 -1
- package/dist/commands/packs/remove-instruction.d.ts +0 -11
- package/dist/commands/packs/remove-instruction.d.ts.map +0 -1
- package/dist/commands/proxy/env.d.ts +0 -14
- package/dist/commands/proxy/env.d.ts.map +0 -1
- package/dist/commands/proxy/logs.d.ts +0 -11
- package/dist/commands/proxy/logs.d.ts.map +0 -1
- package/dist/commands/proxy/restart.d.ts +0 -11
- package/dist/commands/proxy/restart.d.ts.map +0 -1
- package/dist/commands/proxy/setup.d.ts +0 -23
- package/dist/commands/proxy/setup.d.ts.map +0 -1
- package/dist/commands/proxy/start.d.ts +0 -17
- package/dist/commands/proxy/start.d.ts.map +0 -1
- package/dist/commands/proxy/status.d.ts +0 -7
- package/dist/commands/proxy/status.d.ts.map +0 -1
- package/dist/commands/proxy/stop.d.ts +0 -8
- package/dist/commands/proxy/stop.d.ts.map +0 -1
- package/dist/commands/service/install.d.ts +0 -33
- package/dist/commands/service/install.d.ts.map +0 -1
- package/dist/commands/service/install.test.d.ts +0 -2
- package/dist/commands/service/install.test.d.ts.map +0 -1
- package/dist/commands/service/install.test.js +0 -345
- package/dist/commands/service/install.test.js.map +0 -1
- package/dist/commands/service/status.d.ts +0 -6
- package/dist/commands/service/status.d.ts.map +0 -1
- package/dist/commands/service/uninstall.d.ts +0 -6
- package/dist/commands/service/uninstall.d.ts.map +0 -1
- package/dist/commands/sessions/analyze.d.ts +0 -10
- package/dist/commands/sessions/analyze.d.ts.map +0 -1
- package/dist/commands/sessions/end.d.ts +0 -9
- package/dist/commands/sessions/end.d.ts.map +0 -1
- package/dist/commands/sessions/import.d.ts +0 -13
- package/dist/commands/sessions/import.d.ts.map +0 -1
- package/dist/commands/sessions/list.d.ts +0 -11
- package/dist/commands/sessions/list.d.ts.map +0 -1
- package/dist/commands/sessions/start.d.ts +0 -11
- package/dist/commands/sessions/start.d.ts.map +0 -1
- package/dist/commands/signals/report.d.ts +0 -10
- package/dist/commands/signals/report.d.ts.map +0 -1
- package/dist/commands/signals/report.test.d.ts +0 -2
- package/dist/commands/signals/report.test.d.ts.map +0 -1
- package/dist/commands/signals/report.test.js +0 -65
- package/dist/commands/signals/report.test.js.map +0 -1
- package/dist/commands/skills/export-approved.d.ts +0 -10
- package/dist/commands/skills/export-approved.d.ts.map +0 -1
- package/dist/commands/skills/install.d.ts +0 -15
- package/dist/commands/skills/install.d.ts.map +0 -1
- package/dist/commands/skills/list.d.ts +0 -11
- package/dist/commands/skills/list.d.ts.map +0 -1
- package/dist/commands/skills/publish.d.ts +0 -17
- package/dist/commands/skills/publish.d.ts.map +0 -1
- package/dist/commands/skills/search.d.ts +0 -17
- package/dist/commands/skills/search.d.ts.map +0 -1
- package/dist/commands/skills/update.d.ts +0 -10
- package/dist/commands/skills/update.d.ts.map +0 -1
- package/dist/commands/suggestions/accept.d.ts +0 -16
- package/dist/commands/suggestions/accept.d.ts.map +0 -1
- package/dist/commands/suggestions/accept.test.d.ts +0 -2
- package/dist/commands/suggestions/accept.test.d.ts.map +0 -1
- package/dist/commands/suggestions/accept.test.js +0 -52
- package/dist/commands/suggestions/accept.test.js.map +0 -1
- package/dist/commands/suggestions/dismiss.d.ts +0 -10
- package/dist/commands/suggestions/dismiss.d.ts.map +0 -1
- package/dist/commands/suggestions/list.d.ts +0 -10
- package/dist/commands/suggestions/list.d.ts.map +0 -1
- package/dist/commands/suggestions/refresh.d.ts +0 -7
- package/dist/commands/suggestions/refresh.d.ts.map +0 -1
- package/dist/dashboard/Dashboard.d.ts +0 -3
- package/dist/dashboard/Dashboard.d.ts.map +0 -1
- package/dist/dashboard/data.d.ts +0 -11
- package/dist/dashboard/data.d.ts.map +0 -1
- package/dist/dashboard/panels/friction.d.ts +0 -7
- package/dist/dashboard/panels/friction.d.ts.map +0 -1
- package/dist/dashboard/panels/insights.d.ts +0 -8
- package/dist/dashboard/panels/insights.d.ts.map +0 -1
- package/dist/dashboard/panels/instructions.d.ts +0 -9
- package/dist/dashboard/panels/instructions.d.ts.map +0 -1
- package/dist/dashboard/panels/outcomes.d.ts +0 -7
- package/dist/dashboard/panels/outcomes.d.ts.map +0 -1
- package/dist/dashboard/panels/overview.d.ts +0 -8
- package/dist/dashboard/panels/overview.d.ts.map +0 -1
- package/dist/dashboard/panels/shared.d.ts +0 -17
- package/dist/dashboard/panels/shared.d.ts.map +0 -1
- package/dist/dashboard/types.d.ts +0 -80
- package/dist/dashboard/types.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/active-org-refresh.d.ts +0 -22
- package/dist/lib/active-org-refresh.d.ts.map +0 -1
- package/dist/lib/active-org-refresh.test.d.ts +0 -2
- package/dist/lib/active-org-refresh.test.d.ts.map +0 -1
- package/dist/lib/active-org-refresh.test.js +0 -190
- package/dist/lib/active-org-refresh.test.js.map +0 -1
- package/dist/lib/active-org.d.ts +0 -43
- package/dist/lib/active-org.d.ts.map +0 -1
- package/dist/lib/active-org.test.d.ts +0 -2
- package/dist/lib/active-org.test.d.ts.map +0 -1
- package/dist/lib/active-org.test.js +0 -147
- package/dist/lib/active-org.test.js.map +0 -1
- package/dist/lib/api-client.d.ts +0 -17
- package/dist/lib/api-client.d.ts.map +0 -1
- package/dist/lib/api-client.test.d.ts +0 -2
- package/dist/lib/api-client.test.d.ts.map +0 -1
- package/dist/lib/api-client.test.js +0 -161
- package/dist/lib/api-client.test.js.map +0 -1
- package/dist/lib/auth.d.ts +0 -27
- package/dist/lib/auth.d.ts.map +0 -1
- package/dist/lib/auth.test.d.ts +0 -2
- package/dist/lib/auth.test.d.ts.map +0 -1
- package/dist/lib/auth.test.js +0 -110
- package/dist/lib/auth.test.js.map +0 -1
- package/dist/lib/cron-registry.d.ts +0 -47
- package/dist/lib/cron-registry.d.ts.map +0 -1
- package/dist/lib/cron-registry.js +0 -102
- package/dist/lib/cron-registry.js.map +0 -1
- package/dist/lib/cron-registry.test.d.ts +0 -2
- package/dist/lib/cron-registry.test.d.ts.map +0 -1
- package/dist/lib/cron-registry.test.js +0 -136
- package/dist/lib/cron-registry.test.js.map +0 -1
- package/dist/lib/cron-runner.d.ts +0 -16
- package/dist/lib/cron-runner.d.ts.map +0 -1
- package/dist/lib/cron-runner.js +0 -68
- package/dist/lib/cron-runner.js.map +0 -1
- package/dist/lib/detect-languages.d.ts +0 -7
- package/dist/lib/detect-languages.d.ts.map +0 -1
- package/dist/lib/detect-languages.test.d.ts +0 -2
- package/dist/lib/detect-languages.test.d.ts.map +0 -1
- package/dist/lib/detect-languages.test.js +0 -29
- package/dist/lib/detect-languages.test.js.map +0 -1
- package/dist/lib/eval-analyzer.d.ts +0 -23
- package/dist/lib/eval-analyzer.d.ts.map +0 -1
- package/dist/lib/eval-benchmark.d.ts +0 -17
- package/dist/lib/eval-benchmark.d.ts.map +0 -1
- package/dist/lib/eval-conversation-handler.d.ts +0 -9
- package/dist/lib/eval-conversation-handler.d.ts.map +0 -1
- package/dist/lib/eval-executor.d.ts +0 -21
- package/dist/lib/eval-executor.d.ts.map +0 -1
- package/dist/lib/eval-executor.test.d.ts +0 -2
- package/dist/lib/eval-executor.test.d.ts.map +0 -1
- package/dist/lib/eval-executor.test.js +0 -8
- package/dist/lib/eval-executor.test.js.map +0 -1
- package/dist/lib/eval-grader.d.ts +0 -38
- package/dist/lib/eval-grader.d.ts.map +0 -1
- package/dist/lib/eval-grader.test.d.ts +0 -2
- package/dist/lib/eval-grader.test.d.ts.map +0 -1
- package/dist/lib/eval-grader.test.js +0 -8
- package/dist/lib/eval-grader.test.js.map +0 -1
- package/dist/lib/eval-meta-judge.d.ts +0 -28
- package/dist/lib/eval-meta-judge.d.ts.map +0 -1
- package/dist/lib/eval-trigger-tester.d.ts +0 -19
- package/dist/lib/eval-trigger-tester.d.ts.map +0 -1
- package/dist/lib/eval-worktree.d.ts +0 -11
- package/dist/lib/eval-worktree.d.ts.map +0 -1
- package/dist/lib/eval-worktree.test.d.ts +0 -2
- package/dist/lib/eval-worktree.test.d.ts.map +0 -1
- package/dist/lib/eval-worktree.test.js +0 -68
- package/dist/lib/eval-worktree.test.js.map +0 -1
- package/dist/lib/gateway-entry.d.ts +0 -3
- package/dist/lib/gateway-entry.d.ts.map +0 -1
- package/dist/lib/gateway-lifecycle.d.ts +0 -9
- package/dist/lib/gateway-lifecycle.d.ts.map +0 -1
- package/dist/lib/gateway.d.ts +0 -11
- package/dist/lib/gateway.d.ts.map +0 -1
- package/dist/lib/graphile-worker-runner.d.ts +0 -124
- package/dist/lib/graphile-worker-runner.d.ts.map +0 -1
- package/dist/lib/graphile-worker-runner.js +0 -530
- package/dist/lib/graphile-worker-runner.js.map +0 -1
- package/dist/lib/graphile-worker-runner.test.d.ts +0 -2
- package/dist/lib/graphile-worker-runner.test.d.ts.map +0 -1
- package/dist/lib/graphile-worker-runner.test.js +0 -153
- package/dist/lib/graphile-worker-runner.test.js.map +0 -1
- package/dist/lib/handlers/cron-close-stale-sessions.d.ts +0 -3
- package/dist/lib/handlers/cron-close-stale-sessions.d.ts.map +0 -1
- package/dist/lib/handlers/cron-data-integrity-audit.d.ts +0 -3
- package/dist/lib/handlers/cron-data-integrity-audit.d.ts.map +0 -1
- package/dist/lib/handlers/cron-refresh-skills.d.ts +0 -3
- package/dist/lib/handlers/cron-refresh-skills.d.ts.map +0 -1
- package/dist/lib/handlers/cron-refresh-skills.test.d.ts +0 -2
- package/dist/lib/handlers/cron-refresh-skills.test.d.ts.map +0 -1
- package/dist/lib/handlers/cron-refresh-skills.test.js +0 -114
- package/dist/lib/handlers/cron-refresh-skills.test.js.map +0 -1
- package/dist/lib/handlers/cron-regenerate-insights.d.ts +0 -3
- package/dist/lib/handlers/cron-regenerate-insights.d.ts.map +0 -1
- package/dist/lib/handlers/cron-regenerate-insights.js +0 -6
- package/dist/lib/handlers/cron-regenerate-insights.js.map +0 -1
- package/dist/lib/handlers/cron-suggest-instructions.d.ts +0 -3
- package/dist/lib/handlers/cron-suggest-instructions.d.ts.map +0 -1
- package/dist/lib/handlers/cron-suggest-instructions.test.d.ts +0 -2
- package/dist/lib/handlers/cron-suggest-instructions.test.d.ts.map +0 -1
- package/dist/lib/handlers/cron-suggest-instructions.test.js +0 -80
- package/dist/lib/handlers/cron-suggest-instructions.test.js.map +0 -1
- package/dist/lib/handlers/process-conversation.d.ts +0 -35
- package/dist/lib/handlers/process-conversation.d.ts.map +0 -1
- package/dist/lib/handlers/process-eval.d.ts +0 -32
- package/dist/lib/handlers/process-eval.d.ts.map +0 -1
- package/dist/lib/handlers/process-insights.d.ts +0 -39
- package/dist/lib/handlers/process-insights.d.ts.map +0 -1
- package/dist/lib/handlers/process-launch.d.ts +0 -29
- package/dist/lib/handlers/process-launch.d.ts.map +0 -1
- package/dist/lib/handlers/process-session-goal.d.ts +0 -29
- package/dist/lib/handlers/process-session-goal.d.ts.map +0 -1
- package/dist/lib/handlers/process-session-goal.test.d.ts +0 -2
- package/dist/lib/handlers/process-session-goal.test.d.ts.map +0 -1
- package/dist/lib/handlers/process-session-goal.test.js +0 -134
- package/dist/lib/handlers/process-session-goal.test.js.map +0 -1
- package/dist/lib/hooks-config.d.ts +0 -119
- package/dist/lib/hooks-config.d.ts.map +0 -1
- package/dist/lib/hooks-config.test.d.ts +0 -2
- package/dist/lib/hooks-config.test.d.ts.map +0 -1
- package/dist/lib/hooks-config.test.js +0 -231
- package/dist/lib/hooks-config.test.js.map +0 -1
- package/dist/lib/insights-prompts.d.ts +0 -13
- package/dist/lib/insights-prompts.d.ts.map +0 -1
- package/dist/lib/llm-client.d.ts +0 -26
- package/dist/lib/llm-client.d.ts.map +0 -1
- package/dist/lib/llm-client.test.d.ts +0 -2
- package/dist/lib/llm-client.test.d.ts.map +0 -1
- package/dist/lib/llm-client.test.js +0 -62
- package/dist/lib/llm-client.test.js.map +0 -1
- package/dist/lib/mirror-writer-db.d.ts +0 -12
- package/dist/lib/mirror-writer-db.d.ts.map +0 -1
- package/dist/lib/mirror-writer-db.js +0 -51
- package/dist/lib/mirror-writer-db.js.map +0 -1
- package/dist/lib/mirror-writer.d.ts +0 -35
- package/dist/lib/mirror-writer.d.ts.map +0 -1
- package/dist/lib/mirror-writer.js +0 -27
- package/dist/lib/mirror-writer.js.map +0 -1
- package/dist/lib/mirror-writer.test.d.ts +0 -2
- package/dist/lib/mirror-writer.test.d.ts.map +0 -1
- package/dist/lib/mirror-writer.test.js +0 -47
- package/dist/lib/mirror-writer.test.js.map +0 -1
- package/dist/lib/output.d.ts +0 -4
- package/dist/lib/output.d.ts.map +0 -1
- package/dist/lib/output.test.d.ts +0 -2
- package/dist/lib/output.test.d.ts.map +0 -1
- package/dist/lib/output.test.js +0 -71
- package/dist/lib/output.test.js.map +0 -1
- package/dist/lib/permanent-job-error.d.ts +0 -17
- package/dist/lib/permanent-job-error.d.ts.map +0 -1
- package/dist/lib/permanent-job-error.test.d.ts +0 -2
- package/dist/lib/permanent-job-error.test.d.ts.map +0 -1
- package/dist/lib/permanent-job-error.test.js +0 -29
- package/dist/lib/permanent-job-error.test.js.map +0 -1
- package/dist/lib/provider-aggregator.d.ts +0 -24
- package/dist/lib/provider-aggregator.d.ts.map +0 -1
- package/dist/lib/provider-aggregator.test.d.ts +0 -2
- package/dist/lib/provider-aggregator.test.d.ts.map +0 -1
- package/dist/lib/provider-aggregator.test.js +0 -103
- package/dist/lib/provider-aggregator.test.js.map +0 -1
- package/dist/lib/skills-loader.d.ts +0 -6
- package/dist/lib/skills-loader.d.ts.map +0 -1
- package/dist/lib/types.d.ts +0 -48
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/version-check.d.ts +0 -11
- package/dist/lib/version-check.d.ts.map +0 -1
- package/dist/test-helpers.d.ts +0 -58
- package/dist/test-helpers.d.ts.map +0 -1
- package/dist/test-helpers.js +0 -58
- package/dist/test-helpers.js.map +0 -1
|
@@ -1,391 +1,448 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import {
|
|
2
|
+
findBinary
|
|
3
|
+
} from "../../chunk-ERPMDAO3.js";
|
|
4
|
+
import {
|
|
5
|
+
BaseCommand
|
|
6
|
+
} from "../../chunk-S56LOTGQ.js";
|
|
7
|
+
import "../../chunk-OGVORIFM.js";
|
|
8
|
+
import "../../chunk-2AM54TUK.js";
|
|
9
|
+
import "../../chunk-EJOI2ZGU.js";
|
|
10
|
+
import {
|
|
11
|
+
isAuthenticated
|
|
12
|
+
} from "../../chunk-KZRFUXGF.js";
|
|
13
|
+
import "../../chunk-EKJ2CABV.js";
|
|
14
|
+
import "../../chunk-NSBPE2FW.js";
|
|
15
|
+
|
|
16
|
+
// src/commands/proxy/setup.ts
|
|
17
|
+
import { Flags } from "@oclif/core";
|
|
18
|
+
import { execSync, spawnSync } from "node:child_process";
|
|
19
|
+
import { existsSync, readFileSync, appendFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
20
|
+
import { homedir } from "node:os";
|
|
21
|
+
import { dirname, join } from "node:path";
|
|
22
|
+
var CERT_PATH = join(homedir(), ".mitmproxy", "mitmproxy-ca-cert.pem");
|
|
23
|
+
var CONFIG_DIR = join(homedir(), ".config", "rulemetric");
|
|
24
|
+
var DEFAULT_PORT = 8787;
|
|
25
|
+
var ProxySetup = class _ProxySetup extends BaseCommand {
|
|
26
|
+
static description = "Set up context capture proxy (installs mitmproxy, configures shell)";
|
|
27
|
+
static examples = [
|
|
28
|
+
"<%= config.bin %> proxy setup",
|
|
29
|
+
"<%= config.bin %> proxy setup --shell zsh",
|
|
30
|
+
"<%= config.bin %> proxy setup --check"
|
|
31
|
+
];
|
|
32
|
+
static flags = {
|
|
33
|
+
shell: Flags.string({
|
|
34
|
+
description: "Shell to configure (auto-detected if omitted)",
|
|
35
|
+
options: ["zsh", "bash", "fish", "powershell"]
|
|
36
|
+
}),
|
|
37
|
+
port: Flags.integer({
|
|
38
|
+
char: "p",
|
|
39
|
+
default: DEFAULT_PORT,
|
|
40
|
+
description: "Proxy listen port"
|
|
41
|
+
}),
|
|
42
|
+
check: Flags.boolean({
|
|
43
|
+
description: "Only check prerequisites, do not install anything",
|
|
44
|
+
default: false
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
async run() {
|
|
48
|
+
const { flags } = await this.parse(_ProxySetup);
|
|
49
|
+
const checkOnly = flags.check;
|
|
50
|
+
const port = flags.port;
|
|
51
|
+
this.log("RuleMetric Proxy Setup");
|
|
52
|
+
this.log("=====================\n");
|
|
53
|
+
const checks = [
|
|
54
|
+
await this.checkAuth(),
|
|
55
|
+
await this.checkMitmproxy(),
|
|
56
|
+
await this.checkCACert(),
|
|
57
|
+
await this.checkHooks(),
|
|
58
|
+
this.checkShellEnv(port)
|
|
17
59
|
];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
port: Flags.integer({
|
|
24
|
-
char: 'p',
|
|
25
|
-
default: DEFAULT_PORT,
|
|
26
|
-
description: 'Proxy listen port',
|
|
27
|
-
}),
|
|
28
|
-
check: Flags.boolean({
|
|
29
|
-
description: 'Only check prerequisites, do not install anything',
|
|
30
|
-
default: false,
|
|
31
|
-
}),
|
|
32
|
-
};
|
|
33
|
-
async run() {
|
|
34
|
-
const { flags } = await this.parse(ProxySetup);
|
|
35
|
-
const checkOnly = flags.check;
|
|
36
|
-
const port = flags.port;
|
|
37
|
-
this.log('RuleMetric Proxy Setup');
|
|
38
|
-
this.log('=====================\n');
|
|
39
|
-
const checks = [
|
|
40
|
-
await this.checkAuth(),
|
|
41
|
-
await this.checkMitmproxy(),
|
|
42
|
-
await this.checkCACert(),
|
|
43
|
-
await this.checkHooks(),
|
|
44
|
-
this.checkShellEnv(port),
|
|
45
|
-
];
|
|
46
|
-
// Display results
|
|
47
|
-
let allPassed = true;
|
|
48
|
-
for (const check of checks) {
|
|
49
|
-
const icon = check.ok ? '[OK]' : '[!!]';
|
|
50
|
-
this.log(`${icon} ${check.name}: ${check.message}`);
|
|
51
|
-
if (!check.ok)
|
|
52
|
-
allPassed = false;
|
|
53
|
-
}
|
|
54
|
-
if (allPassed) {
|
|
55
|
-
this.log('\nAll checks passed. Run `rulemetric proxy start` to begin capturing.');
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (checkOnly) {
|
|
59
|
-
this.log('\nSome checks failed. Run `rulemetric proxy setup` (without --check) to fix.');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
// Fix failures
|
|
63
|
-
this.log('\nFixing issues...\n');
|
|
64
|
-
for (const check of checks) {
|
|
65
|
-
if (check.ok || !check.fix)
|
|
66
|
-
continue;
|
|
67
|
-
this.log(`Fixing: ${check.name}...`);
|
|
68
|
-
const fixed = await check.fix();
|
|
69
|
-
if (fixed) {
|
|
70
|
-
this.log(` Fixed.\n`);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.log(` Could not auto-fix. See instructions above.\n`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// Re-check
|
|
77
|
-
this.log('---\nVerifying...\n');
|
|
78
|
-
const reChecks = [
|
|
79
|
-
await this.checkAuth(),
|
|
80
|
-
await this.checkMitmproxy(),
|
|
81
|
-
await this.checkCACert(),
|
|
82
|
-
await this.checkHooks(),
|
|
83
|
-
this.checkShellEnv(port),
|
|
84
|
-
];
|
|
85
|
-
let finalOk = true;
|
|
86
|
-
for (const check of reChecks) {
|
|
87
|
-
const icon = check.ok ? '[OK]' : '[!!]';
|
|
88
|
-
this.log(`${icon} ${check.name}: ${check.message}`);
|
|
89
|
-
if (!check.ok)
|
|
90
|
-
finalOk = false;
|
|
91
|
-
}
|
|
92
|
-
if (finalOk) {
|
|
93
|
-
this.log('\nSetup complete! Next steps:');
|
|
94
|
-
this.log(' 1. Restart your shell (or run `source ~/.zshrc`)');
|
|
95
|
-
this.log(' 2. Run `rulemetric proxy start`');
|
|
96
|
-
this.log(' 3. Start Claude Code — context will be captured automatically');
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
this.log('\nSome issues remain. Fix manually and re-run `rulemetric proxy setup --check`.');
|
|
100
|
-
}
|
|
60
|
+
let allPassed = true;
|
|
61
|
+
for (const check of checks) {
|
|
62
|
+
const icon = check.ok ? "[OK]" : "[!!]";
|
|
63
|
+
this.log(`${icon} ${check.name}: ${check.message}`);
|
|
64
|
+
if (!check.ok) allPassed = false;
|
|
101
65
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return { name: 'Authentication', ok: true, message: 'Logged in (JWT)' };
|
|
106
|
-
}
|
|
107
|
-
// Check API key auth (env vars or env file)
|
|
108
|
-
const apiKey = process.env.RULEMETRIC_API_KEY;
|
|
109
|
-
if (apiKey) {
|
|
110
|
-
return { name: 'Authentication', ok: true, message: `API key (RULEMETRIC_API_KEY=${apiKey.slice(0, 8)}...)` };
|
|
111
|
-
}
|
|
112
|
-
// Check env file
|
|
113
|
-
const envFile = join(homedir(), '.config', 'rulemetric', 'env');
|
|
114
|
-
if (existsSync(envFile)) {
|
|
115
|
-
const content = readFileSync(envFile, 'utf-8');
|
|
116
|
-
if (content.includes('RULEMETRIC_API_KEY') || content.includes('RULEMETRIC_ACCESS_TOKEN')) {
|
|
117
|
-
return { name: 'Authentication', ok: true, message: 'Configured via ~/.config/rulemetric/env' };
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
name: 'Authentication',
|
|
122
|
-
ok: false,
|
|
123
|
-
message: 'Not authenticated',
|
|
124
|
-
fix: async () => {
|
|
125
|
-
this.log(' Run `rulemetric auth login` to authenticate.');
|
|
126
|
-
this.log(' Or set RULEMETRIC_API_KEY in ~/.config/rulemetric/env.');
|
|
127
|
-
return false;
|
|
128
|
-
},
|
|
129
|
-
};
|
|
66
|
+
if (allPassed) {
|
|
67
|
+
this.log("\nAll checks passed. Run `rulemetric proxy start` to begin capturing.");
|
|
68
|
+
return;
|
|
130
69
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// Get version
|
|
135
|
-
try {
|
|
136
|
-
const output = execSync(`${binary} --version 2>&1`, { encoding: 'utf-8' });
|
|
137
|
-
const version = output.match(/Mitmproxy:\s*([\d.]+)/)?.[1] ?? 'unknown';
|
|
138
|
-
return { name: 'mitmproxy', ok: true, message: `Installed (v${version})` };
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
return { name: 'mitmproxy', ok: true, message: `Found at ${binary}` };
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
name: 'mitmproxy',
|
|
146
|
-
ok: false,
|
|
147
|
-
message: 'Not installed',
|
|
148
|
-
fix: async () => this.installMitmproxy(),
|
|
149
|
-
};
|
|
70
|
+
if (checkOnly) {
|
|
71
|
+
this.log("\nSome checks failed. Run `rulemetric proxy setup` (without --check) to fix.");
|
|
72
|
+
return;
|
|
150
73
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (result.status === 0)
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
// Try pip with --user
|
|
167
|
-
if (this.findBinary('pip3') || this.findBinary('pip')) {
|
|
168
|
-
const pip = this.findBinary('pip3') || this.findBinary('pip');
|
|
169
|
-
this.log(` Installing via ${pip} --user...`);
|
|
170
|
-
const result = spawnSync(pip, ['install', '--user', 'mitmproxy'], { stdio: 'inherit' });
|
|
171
|
-
if (result.status === 0)
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
// Try brew
|
|
175
|
-
if (this.findBinary('brew')) {
|
|
176
|
-
this.log(' Installing via brew...');
|
|
177
|
-
const result = spawnSync('brew', ['install', 'mitmproxy'], { stdio: 'inherit' });
|
|
178
|
-
if (result.status === 0)
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
this.log(' Could not auto-install mitmproxy. Install manually:');
|
|
182
|
-
this.log(' pipx install mitmproxy # recommended');
|
|
183
|
-
this.log(' brew install mitmproxy # macOS');
|
|
184
|
-
this.log(' pip install --user mitmproxy');
|
|
185
|
-
return false;
|
|
74
|
+
this.log("\nFixing issues...\n");
|
|
75
|
+
for (const check of checks) {
|
|
76
|
+
if (check.ok || !check.fix) continue;
|
|
77
|
+
this.log(`Fixing: ${check.name}...`);
|
|
78
|
+
const fixed = await check.fix();
|
|
79
|
+
if (fixed) {
|
|
80
|
+
this.log(` Fixed.
|
|
81
|
+
`);
|
|
82
|
+
} else {
|
|
83
|
+
this.log(` Could not auto-fix. See instructions above.
|
|
84
|
+
`);
|
|
85
|
+
}
|
|
186
86
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
87
|
+
this.log("---\nVerifying...\n");
|
|
88
|
+
const reChecks = [
|
|
89
|
+
await this.checkAuth(),
|
|
90
|
+
await this.checkMitmproxy(),
|
|
91
|
+
await this.checkCACert(),
|
|
92
|
+
await this.checkHooks(),
|
|
93
|
+
this.checkShellEnv(port)
|
|
94
|
+
];
|
|
95
|
+
let finalOk = true;
|
|
96
|
+
for (const check of reChecks) {
|
|
97
|
+
const icon = check.ok ? "[OK]" : "[!!]";
|
|
98
|
+
this.log(`${icon} ${check.name}: ${check.message}`);
|
|
99
|
+
if (!check.ok) finalOk = false;
|
|
197
100
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return true;
|
|
230
|
-
}
|
|
231
|
-
this.log(' Failed to generate cert. Try running: mitmdump --help');
|
|
101
|
+
if (finalOk) {
|
|
102
|
+
this.log("\nSetup complete! Next steps:");
|
|
103
|
+
this.log(" 1. Restart your shell (or run `source ~/.zshrc`)");
|
|
104
|
+
this.log(" 2. Run `rulemetric proxy start`");
|
|
105
|
+
this.log(" 3. Start Claude Code \u2014 context will be captured automatically");
|
|
106
|
+
} else {
|
|
107
|
+
this.log("\nSome issues remain. Fix manually and re-run `rulemetric proxy setup --check`.");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async checkAuth() {
|
|
111
|
+
if (isAuthenticated()) {
|
|
112
|
+
return { name: "Authentication", ok: true, message: "Logged in (JWT)" };
|
|
113
|
+
}
|
|
114
|
+
const apiKey = process.env.RULEMETRIC_API_KEY;
|
|
115
|
+
if (apiKey) {
|
|
116
|
+
return { name: "Authentication", ok: true, message: `API key (RULEMETRIC_API_KEY=${apiKey.slice(0, 8)}...)` };
|
|
117
|
+
}
|
|
118
|
+
const envFile = join(homedir(), ".config", "rulemetric", "env");
|
|
119
|
+
if (existsSync(envFile)) {
|
|
120
|
+
const content = readFileSync(envFile, "utf-8");
|
|
121
|
+
if (content.includes("RULEMETRIC_API_KEY") || content.includes("RULEMETRIC_ACCESS_TOKEN")) {
|
|
122
|
+
return { name: "Authentication", ok: true, message: "Configured via ~/.config/rulemetric/env" };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
name: "Authentication",
|
|
127
|
+
ok: false,
|
|
128
|
+
message: "Not authenticated",
|
|
129
|
+
fix: async () => {
|
|
130
|
+
this.log(" Run `rulemetric auth login` to authenticate.");
|
|
131
|
+
this.log(" Or set RULEMETRIC_API_KEY in ~/.config/rulemetric/env.");
|
|
232
132
|
return false;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
async checkMitmproxy() {
|
|
137
|
+
const binary = this.findBinary("mitmdump");
|
|
138
|
+
if (binary) {
|
|
139
|
+
try {
|
|
140
|
+
const output = execSync(`${binary} --version 2>&1`, { encoding: "utf-8" });
|
|
141
|
+
const version = output.match(/Mitmproxy:\s*([\d.]+)/)?.[1] ?? "unknown";
|
|
142
|
+
return { name: "mitmproxy", ok: true, message: `Installed (v${version})` };
|
|
143
|
+
} catch {
|
|
144
|
+
return { name: "mitmproxy", ok: true, message: `Found at ${binary}` };
|
|
145
|
+
}
|
|
233
146
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
try {
|
|
248
|
-
const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
249
|
-
const hasHooks = settings.hooks && Object.keys(settings.hooks).length > 0;
|
|
250
|
-
if (hasHooks) {
|
|
251
|
-
return { name: 'Session Hooks', ok: true, message: 'Installed in current project' };
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
catch { /* fall through */ }
|
|
255
|
-
return {
|
|
256
|
-
name: 'Session Hooks',
|
|
257
|
-
ok: false,
|
|
258
|
-
message: 'settings.json exists but hooks not configured',
|
|
259
|
-
fix: async () => {
|
|
260
|
-
this.log(' Run `rulemetric hooks install` to configure hooks.');
|
|
261
|
-
return false;
|
|
262
|
-
},
|
|
263
|
-
};
|
|
147
|
+
return {
|
|
148
|
+
name: "mitmproxy",
|
|
149
|
+
ok: false,
|
|
150
|
+
message: "Not installed",
|
|
151
|
+
fix: async () => this.installMitmproxy()
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
async installMitmproxy() {
|
|
155
|
+
if (this.findBinary("pipx")) {
|
|
156
|
+
this.log(" Installing via pipx...");
|
|
157
|
+
const result = spawnSync("pipx", ["install", "mitmproxy"], { stdio: "inherit" });
|
|
158
|
+
if (result.status === 0) return true;
|
|
264
159
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
return { name: 'Shell Environment', ok: true, message: 'HTTPS_PROXY and NODE_EXTRA_CA_CERTS set' };
|
|
270
|
-
}
|
|
271
|
-
const missing = [];
|
|
272
|
-
if (!proxySet)
|
|
273
|
-
missing.push('HTTPS_PROXY');
|
|
274
|
-
if (!certSet)
|
|
275
|
-
missing.push('NODE_EXTRA_CA_CERTS');
|
|
276
|
-
return {
|
|
277
|
-
name: 'Shell Environment',
|
|
278
|
-
ok: false,
|
|
279
|
-
message: `Missing: ${missing.join(', ')}`,
|
|
280
|
-
fix: async () => this.writeShellEnv(port),
|
|
281
|
-
};
|
|
160
|
+
if (this.findBinary("uv")) {
|
|
161
|
+
this.log(" Installing via uv...");
|
|
162
|
+
const result = spawnSync("uv", ["tool", "install", "mitmproxy"], { stdio: "inherit" });
|
|
163
|
+
if (result.status === 0) return true;
|
|
282
164
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this.log(` export HTTPS_PROXY=http://localhost:${port}`);
|
|
289
|
-
this.log(` export NODE_EXTRA_CA_CERTS=${CERT_PATH}`);
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
const oldMarker = '# RuleMetric proxy';
|
|
293
|
-
const marker = '# RuleMetric proxy (auto-detect)';
|
|
294
|
-
const envFile = join(CONFIG_DIR, 'proxy.env');
|
|
295
|
-
const pidFile = join(CONFIG_DIR, 'proxy.pid');
|
|
296
|
-
// Dynamic proxy env: re-evaluates on every prompt so stopping the proxy
|
|
297
|
-
// immediately unsets HTTPS_PROXY without needing a new shell.
|
|
298
|
-
const block = shell === 'fish'
|
|
299
|
-
? [
|
|
300
|
-
'',
|
|
301
|
-
marker,
|
|
302
|
-
'function _rulemetric_proxy_check',
|
|
303
|
-
` if test -f ${pidFile}; and kill -0 (cat ${pidFile}) 2>/dev/null`,
|
|
304
|
-
` source ${envFile} 2>/dev/null`,
|
|
305
|
-
' else',
|
|
306
|
-
' set -e HTTPS_PROXY 2>/dev/null',
|
|
307
|
-
' set -e NODE_EXTRA_CA_CERTS 2>/dev/null',
|
|
308
|
-
' end',
|
|
309
|
-
'end',
|
|
310
|
-
'',
|
|
311
|
-
].join('\n')
|
|
312
|
-
: shell === 'zsh'
|
|
313
|
-
? [
|
|
314
|
-
'',
|
|
315
|
-
marker,
|
|
316
|
-
'_rulemetric_proxy_check() {',
|
|
317
|
-
` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
|
|
318
|
-
` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
|
|
319
|
-
' else',
|
|
320
|
-
` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
|
|
321
|
-
' fi',
|
|
322
|
-
'}',
|
|
323
|
-
'precmd_functions+=(_rulemetric_proxy_check)',
|
|
324
|
-
'',
|
|
325
|
-
].join('\n')
|
|
326
|
-
: [
|
|
327
|
-
'',
|
|
328
|
-
marker,
|
|
329
|
-
'_rulemetric_proxy_check() {',
|
|
330
|
-
` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
|
|
331
|
-
` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
|
|
332
|
-
' else',
|
|
333
|
-
` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
|
|
334
|
-
' fi',
|
|
335
|
-
'}',
|
|
336
|
-
'PROMPT_COMMAND="_rulemetric_proxy_check${PROMPT_COMMAND:+;$PROMPT_COMMAND}"',
|
|
337
|
-
'',
|
|
338
|
-
].join('\n');
|
|
339
|
-
if (existsSync(rcFile)) {
|
|
340
|
-
let content = readFileSync(rcFile, 'utf-8');
|
|
341
|
-
// Remove old static block if present
|
|
342
|
-
if (content.includes(oldMarker) && !content.includes(marker)) {
|
|
343
|
-
content = content.replace(/\n# RuleMetric proxy\nexport HTTPS_PROXY=[^\n]*\nexport NODE_EXTRA_CA_CERTS=[^\n]*\n/, '\n');
|
|
344
|
-
writeFileSync(rcFile, content);
|
|
345
|
-
this.log(` Removed old static env vars from ${rcFile}`);
|
|
346
|
-
}
|
|
347
|
-
// Remove old auto-detect block (the one without precmd that doesn't unset on stop)
|
|
348
|
-
if (content.includes('# RuleMetric proxy (auto-detect') && !content.includes('_rulemetric_proxy_check')) {
|
|
349
|
-
content = content.replace(/\n# RuleMetric proxy \(auto-detect[^\n]*\)\nif \[.*?\nfi\n/s, '\n');
|
|
350
|
-
writeFileSync(rcFile, content);
|
|
351
|
-
this.log(` Upgraded old auto-detect block in ${rcFile}`);
|
|
352
|
-
}
|
|
353
|
-
if (content.includes('_rulemetric_proxy_check')) {
|
|
354
|
-
this.log(` Shell env already configured in ${rcFile}`);
|
|
355
|
-
return true;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
this.log(` Appending proxy auto-detect hook to ${rcFile}`);
|
|
359
|
-
this.log(` (HTTPS_PROXY is set/unset automatically when proxy starts/stops)`);
|
|
360
|
-
appendFileSync(rcFile, block);
|
|
361
|
-
return true;
|
|
165
|
+
if (this.findBinary("pip3") || this.findBinary("pip")) {
|
|
166
|
+
const pip = this.findBinary("pip3") || this.findBinary("pip");
|
|
167
|
+
this.log(` Installing via ${pip} --user...`);
|
|
168
|
+
const result = spawnSync(pip, ["install", "--user", "mitmproxy"], { stdio: "inherit" });
|
|
169
|
+
if (result.status === 0) return true;
|
|
362
170
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
if (shell.includes('bash'))
|
|
368
|
-
return 'bash';
|
|
369
|
-
if (shell.includes('fish'))
|
|
370
|
-
return 'fish';
|
|
371
|
-
return 'zsh'; // default on macOS
|
|
171
|
+
if (this.findBinary("brew")) {
|
|
172
|
+
this.log(" Installing via brew...");
|
|
173
|
+
const result = spawnSync("brew", ["install", "mitmproxy"], { stdio: "inherit" });
|
|
174
|
+
if (result.status === 0) return true;
|
|
372
175
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
176
|
+
this.log(" Could not auto-install mitmproxy. Install manually:");
|
|
177
|
+
this.log(" pipx install mitmproxy # recommended");
|
|
178
|
+
this.log(" brew install mitmproxy # macOS");
|
|
179
|
+
this.log(" pip install --user mitmproxy");
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
async checkCACert() {
|
|
183
|
+
if (existsSync(CERT_PATH)) {
|
|
184
|
+
return { name: "CA Certificate", ok: true, message: `Found at ${CERT_PATH}` };
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
name: "CA Certificate",
|
|
188
|
+
ok: false,
|
|
189
|
+
message: "Not generated yet",
|
|
190
|
+
fix: async () => this.generateCACert()
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
async generateCACert() {
|
|
194
|
+
const mitmdump = this.findBinary("mitmdump");
|
|
195
|
+
if (!mitmdump) {
|
|
196
|
+
this.log(" Cannot generate cert \u2014 mitmproxy not installed.");
|
|
197
|
+
return false;
|
|
381
198
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
199
|
+
this.log(" Generating CA certificate...");
|
|
200
|
+
const result = spawnSync(mitmdump, ["--set", "listen_port=0", "-q"], {
|
|
201
|
+
timeout: 5e3,
|
|
202
|
+
stdio: "ignore"
|
|
203
|
+
});
|
|
204
|
+
if (existsSync(CERT_PATH)) {
|
|
205
|
+
this.log(` Certificate generated at ${CERT_PATH}`);
|
|
206
|
+
if (process.platform === "darwin") {
|
|
207
|
+
this.log(" Adding CA cert to macOS keychain (may require sudo)...");
|
|
208
|
+
const trustResult = spawnSync("sudo", [
|
|
209
|
+
"security",
|
|
210
|
+
"add-trusted-cert",
|
|
211
|
+
"-d",
|
|
212
|
+
"-r",
|
|
213
|
+
"trustRoot",
|
|
214
|
+
"-k",
|
|
215
|
+
"/Library/Keychains/System.keychain",
|
|
216
|
+
CERT_PATH
|
|
217
|
+
], { stdio: "inherit" });
|
|
218
|
+
if (trustResult.status === 0) {
|
|
219
|
+
this.log(" CA cert trusted system-wide.");
|
|
220
|
+
} else {
|
|
221
|
+
this.log(" Could not auto-trust cert. You may need NODE_EXTRA_CA_CERTS env var.");
|
|
385
222
|
}
|
|
386
|
-
|
|
387
|
-
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
this.log(" Failed to generate cert. Try running: mitmdump --help");
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
async checkHooks() {
|
|
230
|
+
const settingsPath = join(process.cwd(), ".claude", "settings.json");
|
|
231
|
+
if (!existsSync(settingsPath)) {
|
|
232
|
+
return {
|
|
233
|
+
name: "Session Hooks",
|
|
234
|
+
ok: false,
|
|
235
|
+
message: "Not installed in current project",
|
|
236
|
+
fix: async () => {
|
|
237
|
+
this.log(" Run `rulemetric hooks install` in your project directory.");
|
|
238
|
+
return false;
|
|
388
239
|
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
244
|
+
const hasHooks = settings.hooks && Object.keys(settings.hooks).length > 0;
|
|
245
|
+
if (hasHooks) {
|
|
246
|
+
return { name: "Session Hooks", ok: true, message: "Installed in current project" };
|
|
247
|
+
}
|
|
248
|
+
} catch {
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
name: "Session Hooks",
|
|
252
|
+
ok: false,
|
|
253
|
+
message: "settings.json exists but hooks not configured",
|
|
254
|
+
fix: async () => {
|
|
255
|
+
this.log(" Run `rulemetric hooks install` to configure hooks.");
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
checkShellEnv(port) {
|
|
261
|
+
const proxySet = process.env.HTTPS_PROXY?.includes(String(port));
|
|
262
|
+
const certSet = !!process.env.NODE_EXTRA_CA_CERTS;
|
|
263
|
+
if (proxySet && certSet) {
|
|
264
|
+
return { name: "Shell Environment", ok: true, message: "HTTPS_PROXY and NODE_EXTRA_CA_CERTS set" };
|
|
265
|
+
}
|
|
266
|
+
const missing = [];
|
|
267
|
+
if (!proxySet) missing.push("HTTPS_PROXY");
|
|
268
|
+
if (!certSet) missing.push("NODE_EXTRA_CA_CERTS");
|
|
269
|
+
return {
|
|
270
|
+
name: "Shell Environment",
|
|
271
|
+
ok: false,
|
|
272
|
+
message: `Missing: ${missing.join(", ")}`,
|
|
273
|
+
fix: async () => this.writeShellEnv(port)
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
async writeShellEnv(port) {
|
|
277
|
+
const shell = this.detectShell();
|
|
278
|
+
const rcFile = this.getShellRcFile(shell);
|
|
279
|
+
if (!rcFile) {
|
|
280
|
+
this.log(` Could not detect shell RC file. Add these to your shell profile:`);
|
|
281
|
+
this.log(` export HTTPS_PROXY=http://localhost:${port}`);
|
|
282
|
+
this.log(` export NODE_EXTRA_CA_CERTS=${CERT_PATH}`);
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
const oldMarker = "# RuleMetric proxy";
|
|
286
|
+
const marker = "# RuleMetric proxy (auto-detect)";
|
|
287
|
+
const envFile = join(CONFIG_DIR, "proxy.env");
|
|
288
|
+
const pidFile = join(CONFIG_DIR, "proxy.pid");
|
|
289
|
+
const sentinel = shell === "powershell" ? "_RuleMetricProxyCheck" : "_rulemetric_proxy_check";
|
|
290
|
+
const block = shell === "powershell" ? this.buildPowerShellBlock(marker, pidFile, port) : shell === "fish" ? [
|
|
291
|
+
"",
|
|
292
|
+
marker,
|
|
293
|
+
"function _rulemetric_proxy_check",
|
|
294
|
+
` if test -f ${pidFile}; and kill -0 (cat ${pidFile}) 2>/dev/null`,
|
|
295
|
+
` source ${envFile} 2>/dev/null`,
|
|
296
|
+
" else",
|
|
297
|
+
" set -e HTTPS_PROXY 2>/dev/null",
|
|
298
|
+
" set -e NODE_EXTRA_CA_CERTS 2>/dev/null",
|
|
299
|
+
" end",
|
|
300
|
+
"end",
|
|
301
|
+
""
|
|
302
|
+
].join("\n") : shell === "zsh" ? [
|
|
303
|
+
"",
|
|
304
|
+
marker,
|
|
305
|
+
"_rulemetric_proxy_check() {",
|
|
306
|
+
` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
|
|
307
|
+
` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
|
|
308
|
+
" else",
|
|
309
|
+
` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
|
|
310
|
+
" fi",
|
|
311
|
+
"}",
|
|
312
|
+
"precmd_functions+=(_rulemetric_proxy_check)",
|
|
313
|
+
""
|
|
314
|
+
].join("\n") : [
|
|
315
|
+
"",
|
|
316
|
+
marker,
|
|
317
|
+
"_rulemetric_proxy_check() {",
|
|
318
|
+
` if [ -f "${pidFile}" ] && kill -0 "$(cat "${pidFile}" 2>/dev/null)" 2>/dev/null; then`,
|
|
319
|
+
` [ -z "\${HTTPS_PROXY:-}" ] && source "${envFile}" 2>/dev/null`,
|
|
320
|
+
" else",
|
|
321
|
+
` [ -n "\${HTTPS_PROXY:-}" ] && unset HTTPS_PROXY NODE_EXTRA_CA_CERTS`,
|
|
322
|
+
" fi",
|
|
323
|
+
"}",
|
|
324
|
+
'PROMPT_COMMAND="_rulemetric_proxy_check${PROMPT_COMMAND:+;$PROMPT_COMMAND}"',
|
|
325
|
+
""
|
|
326
|
+
].join("\n");
|
|
327
|
+
mkdirSync(dirname(rcFile), { recursive: true });
|
|
328
|
+
if (existsSync(rcFile)) {
|
|
329
|
+
let content = readFileSync(rcFile, "utf-8");
|
|
330
|
+
if (content.includes(oldMarker) && !content.includes(marker)) {
|
|
331
|
+
content = content.replace(
|
|
332
|
+
/\n# RuleMetric proxy\nexport HTTPS_PROXY=[^\n]*\nexport NODE_EXTRA_CA_CERTS=[^\n]*\n/,
|
|
333
|
+
"\n"
|
|
334
|
+
);
|
|
335
|
+
writeFileSync(rcFile, content);
|
|
336
|
+
this.log(` Removed old static env vars from ${rcFile}`);
|
|
337
|
+
}
|
|
338
|
+
if (content.includes("# RuleMetric proxy (auto-detect") && !content.includes("_rulemetric_proxy_check")) {
|
|
339
|
+
content = content.replace(
|
|
340
|
+
/\n# RuleMetric proxy \(auto-detect[^\n]*\)\nif \[.*?\nfi\n/s,
|
|
341
|
+
"\n"
|
|
342
|
+
);
|
|
343
|
+
writeFileSync(rcFile, content);
|
|
344
|
+
this.log(` Upgraded old auto-detect block in ${rcFile}`);
|
|
345
|
+
}
|
|
346
|
+
if (content.includes(sentinel)) {
|
|
347
|
+
this.log(` Shell env already configured in ${rcFile}`);
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
this.log(` Appending proxy auto-detect hook to ${rcFile}`);
|
|
352
|
+
this.log(` (HTTPS_PROXY is set/unset automatically when proxy starts/stops)`);
|
|
353
|
+
appendFileSync(rcFile, block);
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
detectShell() {
|
|
357
|
+
if (process.platform === "win32") return "powershell";
|
|
358
|
+
const shell = process.env.SHELL || "";
|
|
359
|
+
if (shell.includes("zsh")) return "zsh";
|
|
360
|
+
if (shell.includes("bash")) return "bash";
|
|
361
|
+
if (shell.includes("fish")) return "fish";
|
|
362
|
+
return "zsh";
|
|
363
|
+
}
|
|
364
|
+
getShellRcFile(shell) {
|
|
365
|
+
const home = homedir();
|
|
366
|
+
switch (shell) {
|
|
367
|
+
case "zsh":
|
|
368
|
+
return join(home, ".zshrc");
|
|
369
|
+
case "bash":
|
|
370
|
+
return join(home, ".bashrc");
|
|
371
|
+
case "fish":
|
|
372
|
+
return join(home, ".config", "fish", "config.fish");
|
|
373
|
+
case "powershell":
|
|
374
|
+
return this.getPowerShellProfilePath();
|
|
375
|
+
default:
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Resolve the PowerShell profile that loads for every host (console, VS Code
|
|
381
|
+
* integrated terminal, etc.). We ask PowerShell itself for the canonical path
|
|
382
|
+
* — guessing `~/Documents/...` is wrong when Documents is OneDrive-redirected.
|
|
383
|
+
* Falls back to the PowerShell 7 default only if no PS binary is reachable.
|
|
384
|
+
*/
|
|
385
|
+
getPowerShellProfilePath() {
|
|
386
|
+
const psBin = findBinary("pwsh") || findBinary("powershell");
|
|
387
|
+
if (psBin) {
|
|
388
|
+
try {
|
|
389
|
+
const out = execSync(`"${psBin}" -NoProfile -Command "$PROFILE.CurrentUserAllHosts"`, {
|
|
390
|
+
encoding: "utf-8"
|
|
391
|
+
}).trim();
|
|
392
|
+
if (out) return out;
|
|
393
|
+
} catch {
|
|
394
|
+
}
|
|
389
395
|
}
|
|
390
|
-
|
|
391
|
-
|
|
396
|
+
return join(homedir(), "Documents", "PowerShell", "profile.ps1");
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Self-contained PowerShell prompt hook. Unlike the POSIX blocks it does NOT
|
|
400
|
+
* source `proxy.env` (that file is `export KEY=val` syntax PowerShell can't
|
|
401
|
+
* read) — it embeds the values directly. Each prompt it sets HTTPS_PROXY while
|
|
402
|
+
* the proxy PID is alive and removes the vars once it stops, so a dead proxy
|
|
403
|
+
* never leaves a dangling HTTPS_PROXY that would break Claude Code.
|
|
404
|
+
*/
|
|
405
|
+
buildPowerShellBlock(marker, pidFile, port) {
|
|
406
|
+
const proxyUrl = `http://localhost:${port}`;
|
|
407
|
+
const psPid = pidFile.replace(/'/g, "''");
|
|
408
|
+
const psCert = CERT_PATH.replace(/'/g, "''");
|
|
409
|
+
return [
|
|
410
|
+
"",
|
|
411
|
+
marker,
|
|
412
|
+
"function _RuleMetricProxyCheck {",
|
|
413
|
+
` $pidFile = '${psPid}'`,
|
|
414
|
+
" $alive = $false",
|
|
415
|
+
" if (Test-Path $pidFile) {",
|
|
416
|
+
" $procId = (Get-Content $pidFile -ErrorAction SilentlyContinue | Select-Object -First 1)",
|
|
417
|
+
" if ($procId -match '^\\d+$' -and (Get-Process -Id ([int]$procId) -ErrorAction SilentlyContinue)) {",
|
|
418
|
+
" $alive = $true",
|
|
419
|
+
" }",
|
|
420
|
+
" }",
|
|
421
|
+
" if ($alive) {",
|
|
422
|
+
` $env:HTTPS_PROXY = '${proxyUrl}'`,
|
|
423
|
+
` $env:HTTP_PROXY = '${proxyUrl}'`,
|
|
424
|
+
` $env:NODE_EXTRA_CA_CERTS = '${psCert}'`,
|
|
425
|
+
" } else {",
|
|
426
|
+
" Remove-Item Env:HTTPS_PROXY, Env:HTTP_PROXY, Env:NODE_EXTRA_CA_CERTS -ErrorAction SilentlyContinue",
|
|
427
|
+
" }",
|
|
428
|
+
"}",
|
|
429
|
+
"# Wrap the existing prompt once so the check runs every prompt.",
|
|
430
|
+
"if (-not (Test-Path Function:\\_RuleMetricOriginalPrompt)) {",
|
|
431
|
+
" $existing = Get-Command prompt -ErrorAction SilentlyContinue",
|
|
432
|
+
" if ($existing) { Set-Item Function:\\_RuleMetricOriginalPrompt $existing.ScriptBlock }",
|
|
433
|
+
"}",
|
|
434
|
+
"function prompt {",
|
|
435
|
+
" _RuleMetricProxyCheck",
|
|
436
|
+
' if (Test-Path Function:\\_RuleMetricOriginalPrompt) { & _RuleMetricOriginalPrompt } else { "PS $($PWD.Path)> " }',
|
|
437
|
+
"}",
|
|
438
|
+
""
|
|
439
|
+
].join("\n");
|
|
440
|
+
}
|
|
441
|
+
findBinary(name) {
|
|
442
|
+
return findBinary(name);
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
export {
|
|
446
|
+
ProxySetup as default
|
|
447
|
+
};
|
|
448
|
+
//# sourceMappingURL=setup.js.map
|