@rulemetric/cli 0.2.1 → 0.2.3
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 +26 -10
- 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
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// src/lib/auth.ts
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as os from "node:os";
|
|
5
|
+
function getConfigDir() {
|
|
6
|
+
return process.env.RULEMETRIC_CONFIG_DIR || path.join(os.homedir(), ".config", "rulemetric");
|
|
7
|
+
}
|
|
8
|
+
function createAuthStore(configDir = getConfigDir()) {
|
|
9
|
+
const authFile = path.join(configDir, "auth.json");
|
|
10
|
+
function saveToken2(token) {
|
|
11
|
+
fs.mkdirSync(configDir, { recursive: true, mode: 448 });
|
|
12
|
+
fs.writeFileSync(authFile, JSON.stringify(token, null, 2), {
|
|
13
|
+
encoding: "utf-8",
|
|
14
|
+
mode: 384
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function loadToken2() {
|
|
18
|
+
try {
|
|
19
|
+
const data = fs.readFileSync(authFile, "utf-8");
|
|
20
|
+
const parsed = JSON.parse(data);
|
|
21
|
+
if (parsed && typeof parsed === "object" && "accessToken" in parsed && "expiresAt" in parsed && "email" in parsed && typeof parsed.accessToken === "string" && typeof parsed.expiresAt === "string") {
|
|
22
|
+
return parsed;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function clearToken2() {
|
|
30
|
+
try {
|
|
31
|
+
fs.unlinkSync(authFile);
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function isAuthenticated2() {
|
|
36
|
+
const token = loadToken2();
|
|
37
|
+
if (!token) return false;
|
|
38
|
+
const expiresAt = new Date(token.expiresAt).getTime();
|
|
39
|
+
if (Number.isNaN(expiresAt)) return false;
|
|
40
|
+
return Date.now() < expiresAt;
|
|
41
|
+
}
|
|
42
|
+
function saveEnvFile2(accessToken, apiUrl) {
|
|
43
|
+
fs.mkdirSync(configDir, { recursive: true, mode: 448 });
|
|
44
|
+
const envPath = path.join(configDir, "env");
|
|
45
|
+
let existingApiKey = "";
|
|
46
|
+
try {
|
|
47
|
+
const existing = fs.readFileSync(envPath, "utf-8");
|
|
48
|
+
const match = existing.match(/^RULEMETRIC_API_KEY=(.+)$/m);
|
|
49
|
+
if (match) existingApiKey = match[1];
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
const lines = [
|
|
53
|
+
`RULEMETRIC_ACCESS_TOKEN=${accessToken}`
|
|
54
|
+
];
|
|
55
|
+
if (existingApiKey) {
|
|
56
|
+
lines.push(`RULEMETRIC_API_KEY=${existingApiKey}`);
|
|
57
|
+
}
|
|
58
|
+
if (apiUrl) {
|
|
59
|
+
lines.push(`RULEMETRIC_API_URL=${apiUrl}`);
|
|
60
|
+
}
|
|
61
|
+
fs.writeFileSync(envPath, lines.join("\n") + "\n", {
|
|
62
|
+
encoding: "utf-8",
|
|
63
|
+
mode: 384
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function saveApiKeyToEnv(apiKey, apiUrl) {
|
|
67
|
+
fs.mkdirSync(configDir, { recursive: true, mode: 448 });
|
|
68
|
+
const envPath = path.join(configDir, "env");
|
|
69
|
+
let existingToken = "";
|
|
70
|
+
let existingUrl = "";
|
|
71
|
+
try {
|
|
72
|
+
const existing = fs.readFileSync(envPath, "utf-8");
|
|
73
|
+
const tokenMatch = existing.match(/^RULEMETRIC_ACCESS_TOKEN=(.+)$/m);
|
|
74
|
+
if (tokenMatch) existingToken = tokenMatch[1];
|
|
75
|
+
const urlMatch = existing.match(/^RULEMETRIC_API_URL=(.+)$/m);
|
|
76
|
+
if (urlMatch) existingUrl = urlMatch[1];
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
const lines = [
|
|
80
|
+
`RULEMETRIC_API_KEY=${apiKey}`
|
|
81
|
+
];
|
|
82
|
+
if (existingToken) {
|
|
83
|
+
lines.push(`RULEMETRIC_ACCESS_TOKEN=${existingToken}`);
|
|
84
|
+
}
|
|
85
|
+
const url = apiUrl ?? existingUrl;
|
|
86
|
+
if (url) {
|
|
87
|
+
lines.push(`RULEMETRIC_API_URL=${url}`);
|
|
88
|
+
}
|
|
89
|
+
fs.writeFileSync(envPath, lines.join("\n") + "\n", {
|
|
90
|
+
encoding: "utf-8",
|
|
91
|
+
mode: 384
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function clearEnvFile2() {
|
|
95
|
+
const envPath = path.join(configDir, "env");
|
|
96
|
+
try {
|
|
97
|
+
fs.unlinkSync(envPath);
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return { saveToken: saveToken2, loadToken: loadToken2, clearToken: clearToken2, isAuthenticated: isAuthenticated2, saveEnvFile: saveEnvFile2, saveApiKeyToEnv, clearEnvFile: clearEnvFile2, configDir, authFile };
|
|
102
|
+
}
|
|
103
|
+
function getStore() {
|
|
104
|
+
return createAuthStore();
|
|
105
|
+
}
|
|
106
|
+
function saveToken(token) {
|
|
107
|
+
getStore().saveToken(token);
|
|
108
|
+
}
|
|
109
|
+
function loadToken() {
|
|
110
|
+
return getStore().loadToken();
|
|
111
|
+
}
|
|
112
|
+
function clearToken() {
|
|
113
|
+
getStore().clearToken();
|
|
114
|
+
}
|
|
115
|
+
function isAuthenticated() {
|
|
116
|
+
if (process.env.RULEMETRIC_API_KEY) return true;
|
|
117
|
+
return getStore().isAuthenticated();
|
|
118
|
+
}
|
|
119
|
+
function saveEnvFile(accessToken, apiUrl) {
|
|
120
|
+
getStore().saveEnvFile(accessToken, apiUrl);
|
|
121
|
+
}
|
|
122
|
+
function saveApiKey(apiKey, apiUrl) {
|
|
123
|
+
getStore().saveApiKeyToEnv(apiKey, apiUrl);
|
|
124
|
+
}
|
|
125
|
+
function clearEnvFile() {
|
|
126
|
+
getStore().clearEnvFile();
|
|
127
|
+
}
|
|
128
|
+
function getDefaultConfigDir() {
|
|
129
|
+
return getConfigDir();
|
|
130
|
+
}
|
|
131
|
+
var CONFIG_DIR = getConfigDir();
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
createAuthStore,
|
|
135
|
+
saveToken,
|
|
136
|
+
loadToken,
|
|
137
|
+
clearToken,
|
|
138
|
+
isAuthenticated,
|
|
139
|
+
saveEnvFile,
|
|
140
|
+
saveApiKey,
|
|
141
|
+
clearEnvFile,
|
|
142
|
+
getDefaultConfigDir,
|
|
143
|
+
CONFIG_DIR
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=chunk-KZRFUXGF.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lib/auth.ts"],
|
|
4
|
+
"sourcesContent": ["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as os from 'node:os';\n\nexport interface AuthToken {\n accessToken: string;\n refreshToken: string;\n expiresAt: string;\n email: string;\n}\n\nfunction getConfigDir(): string {\n return process.env.RULEMETRIC_CONFIG_DIR || path.join(os.homedir(), '.config', 'rulemetric');\n}\n\nexport function createAuthStore(configDir: string = getConfigDir()) {\n const authFile = path.join(configDir, 'auth.json');\n\n function saveToken(token: AuthToken): void {\n fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });\n fs.writeFileSync(authFile, JSON.stringify(token, null, 2), {\n encoding: 'utf-8',\n mode: 0o600,\n });\n }\n\n function loadToken(): AuthToken | null {\n try {\n const data = fs.readFileSync(authFile, 'utf-8');\n const parsed: unknown = JSON.parse(data);\n if (\n parsed &&\n typeof parsed === 'object' &&\n 'accessToken' in parsed &&\n 'expiresAt' in parsed &&\n 'email' in parsed &&\n typeof (parsed as AuthToken).accessToken === 'string' &&\n typeof (parsed as AuthToken).expiresAt === 'string'\n ) {\n return parsed as AuthToken;\n }\n return null;\n } catch {\n return null;\n }\n }\n\n function clearToken(): void {\n try {\n fs.unlinkSync(authFile);\n } catch {\n // File doesn't exist, nothing to clear\n }\n }\n\n function isAuthenticated(): boolean {\n const token = loadToken();\n if (!token) return false;\n const expiresAt = new Date(token.expiresAt).getTime();\n if (Number.isNaN(expiresAt)) return false;\n return Date.now() < expiresAt;\n }\n\n function saveEnvFile(accessToken: string, apiUrl?: string): void {\n fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });\n const envPath = path.join(configDir, 'env');\n\n // Preserve existing RULEMETRIC_API_KEY if present\n let existingApiKey = '';\n try {\n const existing = fs.readFileSync(envPath, 'utf-8');\n const match = existing.match(/^RULEMETRIC_API_KEY=(.+)$/m);\n if (match) existingApiKey = match[1];\n } catch { /* file doesn't exist */ }\n\n const lines = [\n `RULEMETRIC_ACCESS_TOKEN=${accessToken}`,\n ];\n if (existingApiKey) {\n lines.push(`RULEMETRIC_API_KEY=${existingApiKey}`);\n }\n if (apiUrl) {\n lines.push(`RULEMETRIC_API_URL=${apiUrl}`);\n }\n\n fs.writeFileSync(envPath, lines.join('\\n') + '\\n', {\n encoding: 'utf-8',\n mode: 0o600,\n });\n }\n\n function saveApiKeyToEnv(apiKey: string, apiUrl?: string): void {\n fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });\n const envPath = path.join(configDir, 'env');\n\n // Preserve existing ACCESS_TOKEN if present\n let existingToken = '';\n let existingUrl = '';\n try {\n const existing = fs.readFileSync(envPath, 'utf-8');\n const tokenMatch = existing.match(/^RULEMETRIC_ACCESS_TOKEN=(.+)$/m);\n if (tokenMatch) existingToken = tokenMatch[1];\n const urlMatch = existing.match(/^RULEMETRIC_API_URL=(.+)$/m);\n if (urlMatch) existingUrl = urlMatch[1];\n } catch { /* file doesn't exist */ }\n\n const lines = [\n `RULEMETRIC_API_KEY=${apiKey}`,\n ];\n if (existingToken) {\n lines.push(`RULEMETRIC_ACCESS_TOKEN=${existingToken}`);\n }\n const url = apiUrl ?? existingUrl;\n if (url) {\n lines.push(`RULEMETRIC_API_URL=${url}`);\n }\n\n fs.writeFileSync(envPath, lines.join('\\n') + '\\n', {\n encoding: 'utf-8',\n mode: 0o600,\n });\n }\n\n function clearEnvFile(): void {\n const envPath = path.join(configDir, 'env');\n try { fs.unlinkSync(envPath); } catch { /* noop */ }\n }\n\n return { saveToken, loadToken, clearToken, isAuthenticated, saveEnvFile, saveApiKeyToEnv, clearEnvFile, configDir, authFile };\n}\n\n// Lazy accessors \u2014 re-evaluate config dir from env on each call\nfunction getStore() {\n return createAuthStore();\n}\n\nexport function saveToken(token: AuthToken): void { getStore().saveToken(token); }\nexport function loadToken(): AuthToken | null { return getStore().loadToken(); }\nexport function clearToken(): void { getStore().clearToken(); }\nexport function isAuthenticated(): boolean {\n // API key counts as authenticated\n if (process.env.RULEMETRIC_API_KEY) return true;\n return getStore().isAuthenticated();\n}\nexport function saveEnvFile(accessToken: string, apiUrl?: string): void { getStore().saveEnvFile(accessToken, apiUrl); }\nexport function saveApiKey(apiKey: string, apiUrl?: string): void { getStore().saveApiKeyToEnv(apiKey, apiUrl); }\nexport function clearEnvFile(): void { getStore().clearEnvFile(); }\nexport function getDefaultConfigDir(): string { return getConfigDir(); }\n// Re-exported for backward compat (evaluated at import time; prefer getDefaultConfigDir() for dynamic usage)\nexport const CONFIG_DIR = getConfigDir();\n"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,QAAQ;AASpB,SAAS,eAAuB;AAC9B,SAAO,QAAQ,IAAI,yBAA8B,UAAQ,WAAQ,GAAG,WAAW,YAAY;AAC7F;AAEO,SAAS,gBAAgB,YAAoB,aAAa,GAAG;AAClE,QAAM,WAAgB,UAAK,WAAW,WAAW;AAEjD,WAASA,WAAU,OAAwB;AACzC,IAAG,aAAU,WAAW,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACxD,IAAG,iBAAc,UAAU,KAAK,UAAU,OAAO,MAAM,CAAC,GAAG;AAAA,MACzD,UAAU;AAAA,MACV,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,WAASC,aAA8B;AACrC,QAAI;AACF,YAAM,OAAU,gBAAa,UAAU,OAAO;AAC9C,YAAM,SAAkB,KAAK,MAAM,IAAI;AACvC,UACE,UACA,OAAO,WAAW,YAClB,iBAAiB,UACjB,eAAe,UACf,WAAW,UACX,OAAQ,OAAqB,gBAAgB,YAC7C,OAAQ,OAAqB,cAAc,UAC3C;AACA,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAEA,WAASC,cAAmB;AAC1B,QAAI;AACF,MAAG,cAAW,QAAQ;AAAA,IACxB,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,WAASC,mBAA2B;AAClC,UAAM,QAAQF,WAAU;AACxB,QAAI,CAAC,MAAO,QAAO;AACnB,UAAM,YAAY,IAAI,KAAK,MAAM,SAAS,EAAE,QAAQ;AACpD,QAAI,OAAO,MAAM,SAAS,EAAG,QAAO;AACpC,WAAO,KAAK,IAAI,IAAI;AAAA,EACtB;AAEA,WAASG,aAAY,aAAqB,QAAuB;AAC/D,IAAG,aAAU,WAAW,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACxD,UAAM,UAAe,UAAK,WAAW,KAAK;AAG1C,QAAI,iBAAiB;AACrB,QAAI;AACF,YAAM,WAAc,gBAAa,SAAS,OAAO;AACjD,YAAM,QAAQ,SAAS,MAAM,4BAA4B;AACzD,UAAI,MAAO,kBAAiB,MAAM,CAAC;AAAA,IACrC,QAAQ;AAAA,IAA2B;AAEnC,UAAM,QAAQ;AAAA,MACZ,2BAA2B,WAAW;AAAA,IACxC;AACA,QAAI,gBAAgB;AAClB,YAAM,KAAK,sBAAsB,cAAc,EAAE;AAAA,IACnD;AACA,QAAI,QAAQ;AACV,YAAM,KAAK,sBAAsB,MAAM,EAAE;AAAA,IAC3C;AAEA,IAAG,iBAAc,SAAS,MAAM,KAAK,IAAI,IAAI,MAAM;AAAA,MACjD,UAAU;AAAA,MACV,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,WAAS,gBAAgB,QAAgB,QAAuB;AAC9D,IAAG,aAAU,WAAW,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACxD,UAAM,UAAe,UAAK,WAAW,KAAK;AAG1C,QAAI,gBAAgB;AACpB,QAAI,cAAc;AAClB,QAAI;AACF,YAAM,WAAc,gBAAa,SAAS,OAAO;AACjD,YAAM,aAAa,SAAS,MAAM,iCAAiC;AACnE,UAAI,WAAY,iBAAgB,WAAW,CAAC;AAC5C,YAAM,WAAW,SAAS,MAAM,4BAA4B;AAC5D,UAAI,SAAU,eAAc,SAAS,CAAC;AAAA,IACxC,QAAQ;AAAA,IAA2B;AAEnC,UAAM,QAAQ;AAAA,MACZ,sBAAsB,MAAM;AAAA,IAC9B;AACA,QAAI,eAAe;AACjB,YAAM,KAAK,2BAA2B,aAAa,EAAE;AAAA,IACvD;AACA,UAAM,MAAM,UAAU;AACtB,QAAI,KAAK;AACP,YAAM,KAAK,sBAAsB,GAAG,EAAE;AAAA,IACxC;AAEA,IAAG,iBAAc,SAAS,MAAM,KAAK,IAAI,IAAI,MAAM;AAAA,MACjD,UAAU;AAAA,MACV,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,WAASC,gBAAqB;AAC5B,UAAM,UAAe,UAAK,WAAW,KAAK;AAC1C,QAAI;AAAE,MAAG,cAAW,OAAO;AAAA,IAAG,QAAQ;AAAA,IAAa;AAAA,EACrD;AAEA,SAAO,EAAE,WAAAL,YAAW,WAAAC,YAAW,YAAAC,aAAY,iBAAAC,kBAAiB,aAAAC,cAAa,iBAAiB,cAAAC,eAAc,WAAW,SAAS;AAC9H;AAGA,SAAS,WAAW;AAClB,SAAO,gBAAgB;AACzB;AAEO,SAAS,UAAU,OAAwB;AAAE,WAAS,EAAE,UAAU,KAAK;AAAG;AAC1E,SAAS,YAA8B;AAAE,SAAO,SAAS,EAAE,UAAU;AAAG;AACxE,SAAS,aAAmB;AAAE,WAAS,EAAE,WAAW;AAAG;AACvD,SAAS,kBAA2B;AAEzC,MAAI,QAAQ,IAAI,mBAAoB,QAAO;AAC3C,SAAO,SAAS,EAAE,gBAAgB;AACpC;AACO,SAAS,YAAY,aAAqB,QAAuB;AAAE,WAAS,EAAE,YAAY,aAAa,MAAM;AAAG;AAChH,SAAS,WAAW,QAAgB,QAAuB;AAAE,WAAS,EAAE,gBAAgB,QAAQ,MAAM;AAAG;AACzG,SAAS,eAAqB;AAAE,WAAS,EAAE,aAAa;AAAG;AAC3D,SAAS,sBAA8B;AAAE,SAAO,aAAa;AAAG;AAEhE,IAAM,aAAa,aAAa;",
|
|
6
|
+
"names": ["saveToken", "loadToken", "clearToken", "isAuthenticated", "saveEnvFile", "clearEnvFile"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
// src/lib/hooks-config.ts
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
function detectInstalledTools(projectPath) {
|
|
7
|
+
const tools = ["claude_code"];
|
|
8
|
+
if (existsSync(join(projectPath, ".cursor"))) {
|
|
9
|
+
tools.push("cursor");
|
|
10
|
+
}
|
|
11
|
+
if (existsSync(join(projectPath, ".github"))) {
|
|
12
|
+
tools.push("copilot_agent");
|
|
13
|
+
}
|
|
14
|
+
if (existsSync(join(projectPath, ".agents"))) {
|
|
15
|
+
tools.push("antigravity");
|
|
16
|
+
}
|
|
17
|
+
return tools;
|
|
18
|
+
}
|
|
19
|
+
function generateCursorHooksConfig() {
|
|
20
|
+
return {
|
|
21
|
+
version: 1,
|
|
22
|
+
hooks: {
|
|
23
|
+
sessionStart: [
|
|
24
|
+
{ command: "rulemetric hooks run session-start" }
|
|
25
|
+
],
|
|
26
|
+
beforeSubmitPrompt: [
|
|
27
|
+
{ command: "rulemetric hooks run user-prompt" }
|
|
28
|
+
],
|
|
29
|
+
afterFileEdit: [
|
|
30
|
+
{ command: "rulemetric hooks run post-tool-use" }
|
|
31
|
+
],
|
|
32
|
+
beforeShellExecution: [
|
|
33
|
+
{ command: "rulemetric hooks run post-tool-use" }
|
|
34
|
+
],
|
|
35
|
+
afterShellExecution: [
|
|
36
|
+
{ command: "rulemetric hooks run post-tool-use" }
|
|
37
|
+
],
|
|
38
|
+
beforeMCPExecution: [
|
|
39
|
+
{ command: "rulemetric hooks run post-tool-use" }
|
|
40
|
+
],
|
|
41
|
+
afterMCPExecution: [
|
|
42
|
+
{ command: "rulemetric hooks run post-tool-use" }
|
|
43
|
+
],
|
|
44
|
+
// `afterAgentResponse` carries the full assistant response text +
|
|
45
|
+
// token usage. Verified empirically via a probe hook on
|
|
46
|
+
// 2026-05-12 — Cursor passes `text`, `input_tokens`,
|
|
47
|
+
// `output_tokens`, `cache_read_tokens`, `cache_write_tokens`. This
|
|
48
|
+
// is the cleanest path to per-turn assistant content for Cursor
|
|
49
|
+
// (chat traffic itself bypasses the proxy via HTTP/2 — see
|
|
50
|
+
// docs/audits/2026-05-11-cursor-capture-architecture.md).
|
|
51
|
+
afterAgentResponse: [
|
|
52
|
+
{ command: "rulemetric hooks run assistant-response" }
|
|
53
|
+
],
|
|
54
|
+
// `stop` fires when the agent loop ends for a single turn (status:
|
|
55
|
+
// completed|aborted|error). Per-turn, NOT per-session — route it to
|
|
56
|
+
// post-tool-use, not session-end. The real session boundary is
|
|
57
|
+
// `sessionEnd` below.
|
|
58
|
+
stop: [
|
|
59
|
+
{ command: "rulemetric hooks run post-tool-use" }
|
|
60
|
+
],
|
|
61
|
+
sessionEnd: [
|
|
62
|
+
{ command: "rulemetric hooks run session-end" }
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function generateCopilotHooksConfig() {
|
|
68
|
+
return {
|
|
69
|
+
version: 1,
|
|
70
|
+
hooks: {
|
|
71
|
+
sessionStart: [
|
|
72
|
+
{ type: "command", bash: "rulemetric hooks run session-start" }
|
|
73
|
+
],
|
|
74
|
+
userPromptSubmitted: [
|
|
75
|
+
{ type: "command", bash: "rulemetric hooks run user-prompt" }
|
|
76
|
+
],
|
|
77
|
+
postToolUse: [
|
|
78
|
+
{ type: "command", bash: "rulemetric hooks run post-tool-use" }
|
|
79
|
+
],
|
|
80
|
+
sessionEnd: [
|
|
81
|
+
{ type: "command", bash: "rulemetric hooks run session-end" }
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function writeCursorHooksToDir(cursorDir) {
|
|
87
|
+
if (!existsSync(cursorDir)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const configPath = join(cursorDir, "hooks.json");
|
|
91
|
+
const generated = generateCursorHooksConfig();
|
|
92
|
+
let existing = {};
|
|
93
|
+
if (existsSync(configPath)) {
|
|
94
|
+
try {
|
|
95
|
+
existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
96
|
+
} catch {
|
|
97
|
+
existing = {};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const merged = { ...existing.hooks ?? {} };
|
|
101
|
+
for (const [event, hooks] of Object.entries(generated.hooks)) {
|
|
102
|
+
const current = merged[event] ?? [];
|
|
103
|
+
const hasRulemetric = current.some(
|
|
104
|
+
(h) => typeof h === "object" && h !== null && "command" in h && typeof h.command === "string" && h.command.includes("rulemetric")
|
|
105
|
+
);
|
|
106
|
+
if (!hasRulemetric) {
|
|
107
|
+
merged[event] = [...current, ...hooks];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const result = {
|
|
111
|
+
version: existing.version ?? generated.version,
|
|
112
|
+
hooks: merged
|
|
113
|
+
};
|
|
114
|
+
writeFileSync(configPath, JSON.stringify(result, null, 2) + "\n");
|
|
115
|
+
return configPath;
|
|
116
|
+
}
|
|
117
|
+
function writeCursorHooks(projectPath) {
|
|
118
|
+
return writeCursorHooksToDir(join(projectPath, ".cursor"));
|
|
119
|
+
}
|
|
120
|
+
function writeCursorUserHooks() {
|
|
121
|
+
return writeCursorHooksToDir(join(homedir(), ".cursor"));
|
|
122
|
+
}
|
|
123
|
+
function writeCopilotHooks(projectPath) {
|
|
124
|
+
const githubDir = join(projectPath, ".github");
|
|
125
|
+
if (!existsSync(githubDir)) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const hooksDir = join(githubDir, "hooks");
|
|
129
|
+
mkdirSync(hooksDir, { recursive: true });
|
|
130
|
+
const configPath = join(hooksDir, "rulemetric.json");
|
|
131
|
+
const config = generateCopilotHooksConfig();
|
|
132
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
133
|
+
return configPath;
|
|
134
|
+
}
|
|
135
|
+
function removeCursorHooksFromFile(configPath) {
|
|
136
|
+
if (!existsSync(configPath)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
let config;
|
|
140
|
+
try {
|
|
141
|
+
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
142
|
+
} catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
if (!config.hooks) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
let changed = false;
|
|
149
|
+
for (const [event, hooks] of Object.entries(config.hooks)) {
|
|
150
|
+
const filtered = hooks.filter((h) => {
|
|
151
|
+
if (typeof h !== "object" || h === null || !("command" in h)) return true;
|
|
152
|
+
const cmd = h.command;
|
|
153
|
+
if (typeof cmd === "string" && cmd.includes("rulemetric")) {
|
|
154
|
+
changed = true;
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
return true;
|
|
158
|
+
});
|
|
159
|
+
if (filtered.length === 0) {
|
|
160
|
+
delete config.hooks[event];
|
|
161
|
+
} else {
|
|
162
|
+
config.hooks[event] = filtered;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (changed) {
|
|
166
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
167
|
+
}
|
|
168
|
+
return changed;
|
|
169
|
+
}
|
|
170
|
+
function removeCursorHooks(projectPath) {
|
|
171
|
+
return removeCursorHooksFromFile(join(projectPath, ".cursor", "hooks.json"));
|
|
172
|
+
}
|
|
173
|
+
function removeCursorUserHooks() {
|
|
174
|
+
return removeCursorHooksFromFile(join(homedir(), ".cursor", "hooks.json"));
|
|
175
|
+
}
|
|
176
|
+
function writeCursorProxyConfig(projectPath, gatewayPort, certPath) {
|
|
177
|
+
const cursorDir = join(projectPath, ".cursor");
|
|
178
|
+
if (!existsSync(cursorDir)) return false;
|
|
179
|
+
const settingsPath = join(cursorDir, "settings.json");
|
|
180
|
+
let settings = {};
|
|
181
|
+
if (existsSync(settingsPath)) {
|
|
182
|
+
try {
|
|
183
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
184
|
+
} catch {
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
settings["http.proxy"] = `http://localhost:${gatewayPort}`;
|
|
188
|
+
settings["http.proxyStrictSSL"] = existsSync(certPath);
|
|
189
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
function writeVSCodeProxyConfig(projectPath, gatewayPort, certPath) {
|
|
193
|
+
const vscodeDir = join(projectPath, ".vscode");
|
|
194
|
+
mkdirSync(vscodeDir, { recursive: true });
|
|
195
|
+
const settingsPath = join(vscodeDir, "settings.json");
|
|
196
|
+
let settings = {};
|
|
197
|
+
if (existsSync(settingsPath)) {
|
|
198
|
+
try {
|
|
199
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
200
|
+
} catch {
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
settings["http.proxy"] = `http://localhost:${gatewayPort}`;
|
|
204
|
+
settings["http.proxyStrictSSL"] = existsSync(certPath);
|
|
205
|
+
const copilotAdvanced = settings["github.copilot.advanced"] ?? {};
|
|
206
|
+
copilotAdvanced["debug.overrideProxyUrl"] = `http://localhost:${gatewayPort}`;
|
|
207
|
+
settings["github.copilot.advanced"] = copilotAdvanced;
|
|
208
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
function removeVSCodeProxyConfig(projectPath) {
|
|
212
|
+
const settingsPath = join(projectPath, ".vscode", "settings.json");
|
|
213
|
+
if (!existsSync(settingsPath)) return false;
|
|
214
|
+
let settings;
|
|
215
|
+
try {
|
|
216
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
217
|
+
} catch {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
let changed = false;
|
|
221
|
+
if (settings["http.proxy"]) {
|
|
222
|
+
delete settings["http.proxy"];
|
|
223
|
+
delete settings["http.proxyStrictSSL"];
|
|
224
|
+
changed = true;
|
|
225
|
+
}
|
|
226
|
+
const copilotAdvanced = settings["github.copilot.advanced"];
|
|
227
|
+
if (copilotAdvanced?.["debug.overrideProxyUrl"]) {
|
|
228
|
+
delete copilotAdvanced["debug.overrideProxyUrl"];
|
|
229
|
+
if (Object.keys(copilotAdvanced).length === 0) {
|
|
230
|
+
delete settings["github.copilot.advanced"];
|
|
231
|
+
}
|
|
232
|
+
changed = true;
|
|
233
|
+
}
|
|
234
|
+
if (changed) {
|
|
235
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
236
|
+
}
|
|
237
|
+
return changed;
|
|
238
|
+
}
|
|
239
|
+
function removeCopilotHooks(projectPath) {
|
|
240
|
+
const configPath = join(projectPath, ".github", "hooks", "rulemetric.json");
|
|
241
|
+
if (!existsSync(configPath)) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
unlinkSync(configPath);
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
var LAUNCH_AGENT_LABEL = "com.rulemetric.env";
|
|
248
|
+
function getLaunchAgentPath() {
|
|
249
|
+
return join(homedir(), "Library", "LaunchAgents", `${LAUNCH_AGENT_LABEL}.plist`);
|
|
250
|
+
}
|
|
251
|
+
function installMacOSProxyEnv(gatewayPort, certPath) {
|
|
252
|
+
if (process.platform !== "darwin") return false;
|
|
253
|
+
const proxyUrl = `http://localhost:${gatewayPort}`;
|
|
254
|
+
try {
|
|
255
|
+
execSync(`launchctl setenv HTTPS_PROXY ${proxyUrl}`, { stdio: "pipe" });
|
|
256
|
+
if (existsSync(certPath)) {
|
|
257
|
+
execSync(`launchctl setenv NODE_EXTRA_CA_CERTS ${certPath}`, { stdio: "pipe" });
|
|
258
|
+
}
|
|
259
|
+
} catch {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
const plistPath = getLaunchAgentPath();
|
|
263
|
+
const agentsDir = join(homedir(), "Library", "LaunchAgents");
|
|
264
|
+
mkdirSync(agentsDir, { recursive: true });
|
|
265
|
+
const certLine = existsSync(certPath) ? `launchctl setenv NODE_EXTRA_CA_CERTS ${certPath};` : "";
|
|
266
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
267
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
|
268
|
+
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
269
|
+
<plist version="1.0">
|
|
270
|
+
<dict>
|
|
271
|
+
<key>Label</key>
|
|
272
|
+
<string>${LAUNCH_AGENT_LABEL}</string>
|
|
273
|
+
<key>ProgramArguments</key>
|
|
274
|
+
<array>
|
|
275
|
+
<string>/bin/sh</string>
|
|
276
|
+
<string>-c</string>
|
|
277
|
+
<string>launchctl setenv HTTPS_PROXY ${proxyUrl};${certLine}</string>
|
|
278
|
+
</array>
|
|
279
|
+
<key>RunAtLoad</key>
|
|
280
|
+
<true/>
|
|
281
|
+
</dict>
|
|
282
|
+
</plist>
|
|
283
|
+
`;
|
|
284
|
+
writeFileSync(plistPath, plist);
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
function uninstallMacOSProxyEnv() {
|
|
288
|
+
if (process.platform !== "darwin") return false;
|
|
289
|
+
let changed = false;
|
|
290
|
+
try {
|
|
291
|
+
execSync("launchctl unsetenv HTTPS_PROXY", { stdio: "pipe" });
|
|
292
|
+
execSync("launchctl unsetenv NODE_EXTRA_CA_CERTS", { stdio: "pipe" });
|
|
293
|
+
} catch {
|
|
294
|
+
}
|
|
295
|
+
const plistPath = getLaunchAgentPath();
|
|
296
|
+
if (existsSync(plistPath)) {
|
|
297
|
+
unlinkSync(plistPath);
|
|
298
|
+
changed = true;
|
|
299
|
+
}
|
|
300
|
+
return changed;
|
|
301
|
+
}
|
|
302
|
+
function getVSCodeUserSettingsPath() {
|
|
303
|
+
if (process.platform === "darwin") {
|
|
304
|
+
return join(homedir(), "Library", "Application Support", "Code", "User", "settings.json");
|
|
305
|
+
}
|
|
306
|
+
if (process.platform === "win32") {
|
|
307
|
+
return join(process.env.APPDATA ?? "", "Code", "User", "settings.json");
|
|
308
|
+
}
|
|
309
|
+
return join(homedir(), ".config", "Code", "User", "settings.json");
|
|
310
|
+
}
|
|
311
|
+
function writeVSCodeUserProxyConfig(gatewayPort) {
|
|
312
|
+
const settingsPath = getVSCodeUserSettingsPath();
|
|
313
|
+
if (!existsSync(join(settingsPath, ".."))) return false;
|
|
314
|
+
let settings = {};
|
|
315
|
+
if (existsSync(settingsPath)) {
|
|
316
|
+
try {
|
|
317
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
318
|
+
} catch {
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (settings["http.proxy"] && !settings["http.proxy"].includes("localhost")) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
settings["http.proxy"] = `http://localhost:${gatewayPort}`;
|
|
325
|
+
settings["http.proxyStrictSSL"] = false;
|
|
326
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
function removeVSCodeUserProxyConfig() {
|
|
330
|
+
const settingsPath = getVSCodeUserSettingsPath();
|
|
331
|
+
if (!existsSync(settingsPath)) return false;
|
|
332
|
+
let settings;
|
|
333
|
+
try {
|
|
334
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
335
|
+
} catch {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
const proxy = settings["http.proxy"];
|
|
339
|
+
if (!proxy?.includes("localhost")) return false;
|
|
340
|
+
delete settings["http.proxy"];
|
|
341
|
+
delete settings["http.proxyStrictSSL"];
|
|
342
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
function getCursorUserSettingsPath() {
|
|
346
|
+
if (process.platform === "darwin") {
|
|
347
|
+
return join(homedir(), "Library", "Application Support", "Cursor", "User", "settings.json");
|
|
348
|
+
}
|
|
349
|
+
if (process.platform === "win32") {
|
|
350
|
+
return join(process.env.APPDATA ?? "", "Cursor", "User", "settings.json");
|
|
351
|
+
}
|
|
352
|
+
return join(homedir(), ".config", "Cursor", "User", "settings.json");
|
|
353
|
+
}
|
|
354
|
+
function writeCursorUserProxyConfig(gatewayPort) {
|
|
355
|
+
const settingsPath = getCursorUserSettingsPath();
|
|
356
|
+
if (!existsSync(join(settingsPath, ".."))) return false;
|
|
357
|
+
let settings = {};
|
|
358
|
+
if (existsSync(settingsPath)) {
|
|
359
|
+
try {
|
|
360
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
361
|
+
} catch {
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (settings["http.proxy"] && !settings["http.proxy"].includes("localhost")) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
settings["http.proxy"] = `http://localhost:${gatewayPort}`;
|
|
368
|
+
settings["http.proxyStrictSSL"] = false;
|
|
369
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
function removeCursorUserProxyConfig() {
|
|
373
|
+
const settingsPath = getCursorUserSettingsPath();
|
|
374
|
+
if (!existsSync(settingsPath)) return false;
|
|
375
|
+
let settings;
|
|
376
|
+
try {
|
|
377
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
378
|
+
} catch {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
const proxy = settings["http.proxy"];
|
|
382
|
+
if (!proxy?.includes("localhost")) return false;
|
|
383
|
+
delete settings["http.proxy"];
|
|
384
|
+
delete settings["http.proxyStrictSSL"];
|
|
385
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
function getRulemetricCommand() {
|
|
389
|
+
const nodeBin = process.execPath;
|
|
390
|
+
const cliEntry = process.argv[1];
|
|
391
|
+
if (cliEntry && cliEntry.endsWith("run.js")) {
|
|
392
|
+
return `${nodeBin} ${cliEntry}`;
|
|
393
|
+
}
|
|
394
|
+
return "rulemetric";
|
|
395
|
+
}
|
|
396
|
+
function generateAntigravityHooksConfig() {
|
|
397
|
+
const cmd = getRulemetricCommand();
|
|
398
|
+
const mk = (name) => ({
|
|
399
|
+
type: "command",
|
|
400
|
+
command: `RULEMETRIC_HOOK_TOOL=antigravity ${cmd} hooks run ${name}`,
|
|
401
|
+
timeout: 30
|
|
402
|
+
});
|
|
403
|
+
return {
|
|
404
|
+
rulemetric: {
|
|
405
|
+
enabled: true,
|
|
406
|
+
SessionStart: [{ hooks: [mk("session-start")] }],
|
|
407
|
+
UserPromptSubmit: [{ hooks: [mk("user-prompt")] }],
|
|
408
|
+
PreToolUse: [{ matcher: ".*", hooks: [mk("post-tool-use")] }],
|
|
409
|
+
PostToolUse: [{ matcher: ".*", hooks: [mk("post-tool-use")] }],
|
|
410
|
+
Stop: [{ hooks: [mk("assistant-response")] }],
|
|
411
|
+
SessionEnd: [{ hooks: [mk("session-end")] }]
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function writeAntigravityHooksToDir(dir) {
|
|
416
|
+
const configPath = join(dir, "hooks.json");
|
|
417
|
+
let existing = {};
|
|
418
|
+
if (existsSync(configPath)) {
|
|
419
|
+
try {
|
|
420
|
+
existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
421
|
+
} catch {
|
|
422
|
+
existing = {};
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const generated = generateAntigravityHooksConfig();
|
|
426
|
+
const merged = { ...existing, rulemetric: generated.rulemetric };
|
|
427
|
+
mkdirSync(dir, { recursive: true });
|
|
428
|
+
writeFileSync(configPath, JSON.stringify(merged, null, 2) + "\n");
|
|
429
|
+
return configPath;
|
|
430
|
+
}
|
|
431
|
+
function writeAntigravityHooks(projectPath) {
|
|
432
|
+
return writeAntigravityHooksToDir(join(projectPath, ".agents"));
|
|
433
|
+
}
|
|
434
|
+
function writeAntigravityUserHooks() {
|
|
435
|
+
const configDir = join(homedir(), ".gemini", "config");
|
|
436
|
+
return writeAntigravityHooksToDir(configDir);
|
|
437
|
+
}
|
|
438
|
+
function removeAntigravityHooksFromFile(configPath) {
|
|
439
|
+
if (!existsSync(configPath)) return false;
|
|
440
|
+
let existing;
|
|
441
|
+
try {
|
|
442
|
+
existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
443
|
+
} catch {
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
if (!("rulemetric" in existing)) return false;
|
|
447
|
+
delete existing.rulemetric;
|
|
448
|
+
if (Object.keys(existing).length === 0) {
|
|
449
|
+
try {
|
|
450
|
+
unlinkSync(configPath);
|
|
451
|
+
} catch {
|
|
452
|
+
}
|
|
453
|
+
} else {
|
|
454
|
+
writeFileSync(configPath, JSON.stringify(existing, null, 2) + "\n");
|
|
455
|
+
}
|
|
456
|
+
return true;
|
|
457
|
+
}
|
|
458
|
+
function removeAntigravityHooks(projectPath) {
|
|
459
|
+
return removeAntigravityHooksFromFile(join(projectPath, ".agents", "hooks.json"));
|
|
460
|
+
}
|
|
461
|
+
function removeAntigravityUserHooks() {
|
|
462
|
+
const modern = removeAntigravityHooksFromFile(join(homedir(), ".gemini", "config", "hooks.json"));
|
|
463
|
+
const legacy = removeAntigravityHooksFromFile(join(homedir(), ".gemini", "hooks.json"));
|
|
464
|
+
return modern || legacy;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export {
|
|
468
|
+
detectInstalledTools,
|
|
469
|
+
generateCursorHooksConfig,
|
|
470
|
+
generateCopilotHooksConfig,
|
|
471
|
+
writeCursorHooks,
|
|
472
|
+
writeCursorUserHooks,
|
|
473
|
+
writeCopilotHooks,
|
|
474
|
+
removeCursorHooks,
|
|
475
|
+
removeCursorUserHooks,
|
|
476
|
+
writeCursorProxyConfig,
|
|
477
|
+
writeVSCodeProxyConfig,
|
|
478
|
+
removeVSCodeProxyConfig,
|
|
479
|
+
removeCopilotHooks,
|
|
480
|
+
installMacOSProxyEnv,
|
|
481
|
+
uninstallMacOSProxyEnv,
|
|
482
|
+
writeVSCodeUserProxyConfig,
|
|
483
|
+
removeVSCodeUserProxyConfig,
|
|
484
|
+
writeCursorUserProxyConfig,
|
|
485
|
+
removeCursorUserProxyConfig,
|
|
486
|
+
generateAntigravityHooksConfig,
|
|
487
|
+
writeAntigravityHooks,
|
|
488
|
+
writeAntigravityUserHooks,
|
|
489
|
+
removeAntigravityHooks,
|
|
490
|
+
removeAntigravityUserHooks
|
|
491
|
+
};
|
|
492
|
+
//# sourceMappingURL=chunk-L674RNKQ.js.map
|